Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
8f45da5a
Commit
8f45da5a
authored
Oct 02, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RtfWriter - fix read section with fields
parent
84fb75ab
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
626 additions
and
615 deletions
+626
-615
ASCOfficeRtfFile/RtfFormatLib/source/Basic.h
ASCOfficeRtfFile/RtfFormatLib/source/Basic.h
+5
-3
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
+284
-292
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
+37
-34
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h
...iceRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h
+2
-1
ASCOfficeRtfFile/RtfFormatLib/source/RtfBookmark.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfBookmark.cpp
+4
-2
ASCOfficeRtfFile/RtfFormatLib/source/RtfDefine.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfDefine.h
+71
-72
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.cpp
+1
-0
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.h
+16
-10
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
+24
-32
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h
+93
-89
ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.h
+61
-54
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
...eRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
+28
-26
No files found.
ASCOfficeRtfFile/RtfFormatLib/source/Basic.h
View file @
8f45da5a
...
@@ -246,7 +246,7 @@ public:
...
@@ -246,7 +246,7 @@ public:
CString
RenderToRtf
(
RenderParameter
oRenderParameter
)
CString
RenderToRtf
(
RenderParameter
oRenderParameter
)
{
{
CString
sResult
;
CString
sResult
;
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
//идем с конца - из за св-в секций
{
{
sResult
+=
m_aArray
[
i
]
->
RenderToRtf
(
oRenderParameter
);
sResult
+=
m_aArray
[
i
]
->
RenderToRtf
(
oRenderParameter
);
...
@@ -260,8 +260,10 @@ public:
...
@@ -260,8 +260,10 @@ public:
CString
RenderToOOX
(
RenderParameter
oRenderParameter
)
CString
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
{
CString
sResult
;
CString
sResult
;
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
for
(
int
i
=
(
int
)
m_aArray
.
size
()
-
1
;
i
>=
0
;
i
--
)
sResult
+=
m_aArray
[
i
]
->
RenderToOOX
(
oRenderParameter
);
{
sResult
=
m_aArray
[
i
]
->
RenderToOOX
(
oRenderParameter
)
+
sResult
;
}
return
sResult
;
return
sResult
;
}
}
bool
IsValid
()
bool
IsValid
()
...
...
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
View file @
8f45da5a
This diff is collapsed.
Click to expand it.
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
View file @
8f45da5a
...
@@ -1705,9 +1705,10 @@ public:
...
@@ -1705,9 +1705,10 @@ public:
}
}
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
{
m_oParPropDest
.
Finalize
(
oReader
/*, RtfSectionPtr()*/
);
m_oParPropDest
.
Finalize
(
oReader
);
m_oRtfFootnote
.
m_oContent
=
m_oParPropDest
.
m_oTextItems
;
oReader
.
m_nFootnote
=
PROP_DEF
;
m_oRtfFootnote
.
m_oContent
=
m_oParPropDest
.
m_oTextItems
;
oReader
.
m_nFootnote
=
PROP_DEF
;
}
}
};
};
class
RtfDefParPropReader
:
public
RtfAbstractReader
class
RtfDefParPropReader
:
public
RtfAbstractReader
...
@@ -2409,7 +2410,7 @@ public:
...
@@ -2409,7 +2410,7 @@ public:
}
}
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
{
m_oParPropDest
.
Finalize
(
oReader
/*, RtfSectionPtr()*/
);
m_oParPropDest
.
Finalize
(
oReader
);
}
}
};
};
...
@@ -2422,21 +2423,22 @@ class RtfSectionCommand
...
@@ -2422,21 +2423,22 @@ class RtfSectionCommand
{
{
private:
private:
typedef
enum
{
is_none
,
is_border_left
,
is_border_top
,
is_border_right
,
is_border_bottom
}
InternalState
;
typedef
enum
{
is_none
,
is_border_left
,
is_border_top
,
is_border_right
,
is_border_bottom
}
InternalState
;
InternalState
m_eInternalState
;
InternalState
m_eInternalState
;
int
nCurCollumnNumber
;
int
nCurCollumnNumber
;
public:
public:
RtfSectionCommand
()
RtfSectionCommand
()
{
{
m_eInternalState
=
is_none
;
m_eInternalState
=
is_none
;
nCurCollumnNumber
=
PROP_DEF
;
nCurCollumnNumber
=
PROP_DEF
;
}
}
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
RtfAbstractReader
&
oAbstrReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
);
bool
ExecuteCommand
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
,
RtfAbstractReader
&
oAbstrReader
,
CString
sCommand
,
bool
hasParameter
,
int
parameter
);
};
};
class
RtfNormalReader
:
public
RtfAbstractReader
class
RtfNormalReader
:
public
RtfAbstractReader
{
{
public:
public:
ParagraphPropDestination
oParagraphReaderDestination
;
ParagraphPropDestination
oParagraphReaderDestination
;
RtfSectionCommand
oRtfSectionCommand
;
RtfSectionCommand
oRtfSectionCommand
;
RtfNormalReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
RtfNormalReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
{
...
@@ -2457,7 +2459,7 @@ public:
...
@@ -2457,7 +2459,7 @@ public:
}
}
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
{
oParagraphReaderDestination
.
Finalize
(
oReader
/*, RtfSectionPtr()*/
);
oParagraphReaderDestination
.
Finalize
(
oReader
);
_section
section
;
_section
section
;
if
(
true
==
oDocument
.
GetItem
(
section
)
)
if
(
true
==
oDocument
.
GetItem
(
section
)
)
...
@@ -2467,10 +2469,10 @@ public:
...
@@ -2467,10 +2469,10 @@ public:
if
(
NULL
==
oDocument
.
m_oFootnoteCon
)
if
(
NULL
==
oDocument
.
m_oFootnoteCon
)
{
{
oDocument
.
m_oFootnoteCon
=
TextItemContainerPtr
(
new
TextItemContainer
()
);
oDocument
.
m_oFootnoteCon
=
TextItemContainerPtr
(
new
TextItemContainer
()
);
RtfParagraphPtr
oNewPar
=
RtfParagraphPtr
(
new
RtfParagraph
()
);
RtfParagraphPtr
oNewPar
=
RtfParagraphPtr
(
new
RtfParagraph
()
);
RtfCharSpecialPtr
oNewChar
=
RtfCharSpecialPtr
(
new
RtfCharSpecial
()
);
RtfCharSpecialPtr
oNewChar
=
RtfCharSpecialPtr
(
new
RtfCharSpecial
()
);
oNewChar
->
m_eType
=
RtfCharSpecial
::
rsc_chftnsepc
;
oNewChar
->
m_eType
=
RtfCharSpecial
::
rsc_chftnsepc
;
oNewPar
->
AddItem
(
oNewChar
);
oNewPar
->
AddItem
(
oNewChar
);
oDocument
.
m_oFootnoteCon
->
AddItem
(
oNewPar
);
oDocument
.
m_oFootnoteCon
->
AddItem
(
oNewPar
);
...
@@ -2478,10 +2480,10 @@ public:
...
@@ -2478,10 +2480,10 @@ public:
}
}
if
(
NULL
==
oDocument
.
m_oFootnoteSep
)
if
(
NULL
==
oDocument
.
m_oFootnoteSep
)
{
{
oDocument
.
m_oFootnoteSep
=
TextItemContainerPtr
(
new
TextItemContainer
()
);
oDocument
.
m_oFootnoteSep
=
TextItemContainerPtr
(
new
TextItemContainer
()
);
RtfParagraphPtr
oNewPar
=
RtfParagraphPtr
(
new
RtfParagraph
()
);
RtfParagraphPtr
oNewPar
=
RtfParagraphPtr
(
new
RtfParagraph
()
);
RtfCharSpecialPtr
oNewChar
=
RtfCharSpecialPtr
(
new
RtfCharSpecial
()
);
RtfCharSpecialPtr
oNewChar
=
RtfCharSpecialPtr
(
new
RtfCharSpecial
()
);
oNewChar
->
m_eType
=
RtfCharSpecial
::
rsc_chftnsep
;
oNewChar
->
m_eType
=
RtfCharSpecial
::
rsc_chftnsep
;
oNewPar
->
AddItem
(
oNewChar
);
oNewPar
->
AddItem
(
oNewChar
);
oDocument
.
m_oFootnoteSep
->
AddItem
(
oNewPar
);
oDocument
.
m_oFootnoteSep
->
AddItem
(
oNewPar
);
...
@@ -2489,10 +2491,10 @@ public:
...
@@ -2489,10 +2491,10 @@ public:
}
}
if
(
NULL
==
oDocument
.
m_oEndnoteCon
)
if
(
NULL
==
oDocument
.
m_oEndnoteCon
)
{
{
oDocument
.
m_oEndnoteCon
=
TextItemContainerPtr
(
new
TextItemContainer
()
);
oDocument
.
m_oEndnoteCon
=
TextItemContainerPtr
(
new
TextItemContainer
()
);
RtfParagraphPtr
oNewPar
=
RtfParagraphPtr
(
new
RtfParagraph
()
);
RtfParagraphPtr
oNewPar
=
RtfParagraphPtr
(
new
RtfParagraph
()
);
RtfCharSpecialPtr
oNewChar
=
RtfCharSpecialPtr
(
new
RtfCharSpecial
()
);
RtfCharSpecialPtr
oNewChar
=
RtfCharSpecialPtr
(
new
RtfCharSpecial
()
);
oNewChar
->
m_eType
=
RtfCharSpecial
::
rsc_chftnsepc
;
oNewChar
->
m_eType
=
RtfCharSpecial
::
rsc_chftnsepc
;
oNewPar
->
AddItem
(
oNewChar
);
oNewPar
->
AddItem
(
oNewChar
);
oDocument
.
m_oEndnoteCon
->
AddItem
(
oNewPar
);
oDocument
.
m_oEndnoteCon
->
AddItem
(
oNewPar
);
...
@@ -2500,10 +2502,10 @@ public:
...
@@ -2500,10 +2502,10 @@ public:
}
}
if
(
NULL
==
oDocument
.
m_oEndnoteSep
)
if
(
NULL
==
oDocument
.
m_oEndnoteSep
)
{
{
oDocument
.
m_oEndnoteSep
=
TextItemContainerPtr
(
new
TextItemContainer
()
);
oDocument
.
m_oEndnoteSep
=
TextItemContainerPtr
(
new
TextItemContainer
()
);
RtfParagraphPtr
oNewPar
=
RtfParagraphPtr
(
new
RtfParagraph
()
);
RtfParagraphPtr
oNewPar
=
RtfParagraphPtr
(
new
RtfParagraph
()
);
RtfCharSpecialPtr
oNewChar
=
RtfCharSpecialPtr
(
new
RtfCharSpecial
()
);
RtfCharSpecialPtr
oNewChar
=
RtfCharSpecialPtr
(
new
RtfCharSpecial
()
);
oNewChar
->
m_eType
=
RtfCharSpecial
::
rsc_chftnsep
;
oNewChar
->
m_eType
=
RtfCharSpecial
::
rsc_chftnsep
;
oNewPar
->
AddItem
(
oNewChar
);
oNewPar
->
AddItem
(
oNewChar
);
oDocument
.
m_oEndnoteSep
->
AddItem
(
oNewPar
);
oDocument
.
m_oEndnoteSep
->
AddItem
(
oNewPar
);
...
@@ -2514,15 +2516,16 @@ private:
...
@@ -2514,15 +2516,16 @@ private:
void
SectDef
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
void
SectDef
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
{
oReader
.
m_oCurSectionProp
.
SetDefaultRtf
();
oReader
.
m_oCurSectionProp
.
SetDefaultRtf
();
//в соответствии с документацией ставим Page Information свойства как у документа
//в соответствии с документацией ставим Page Information свойства как у документа
oReader
.
m_oCurSectionProp
.
m_nPageWidth
=
oDocument
.
m_oProperty
.
m_nPaperWidth
;
oReader
.
m_oCurSectionProp
.
m_nPageWidth
=
oDocument
.
m_oProperty
.
m_nPaperWidth
;
oReader
.
m_oCurSectionProp
.
m_nPageHeight
=
oDocument
.
m_oProperty
.
m_nPaperHeight
;
oReader
.
m_oCurSectionProp
.
m_nPageHeight
=
oDocument
.
m_oProperty
.
m_nPaperHeight
;
oReader
.
m_oCurSectionProp
.
m_nMarginLeft
=
oDocument
.
m_oProperty
.
m_nMarginLeft
;
oReader
.
m_oCurSectionProp
.
m_nMarginLeft
=
oDocument
.
m_oProperty
.
m_nMarginLeft
;
oReader
.
m_oCurSectionProp
.
m_nMarginRight
=
oDocument
.
m_oProperty
.
m_nMarginRight
;
oReader
.
m_oCurSectionProp
.
m_nMarginRight
=
oDocument
.
m_oProperty
.
m_nMarginRight
;
oReader
.
m_oCurSectionProp
.
m_nMarginTop
=
oDocument
.
m_oProperty
.
m_nMarginTop
;
oReader
.
m_oCurSectionProp
.
m_nMarginTop
=
oDocument
.
m_oProperty
.
m_nMarginTop
;
oReader
.
m_oCurSectionProp
.
m_nMarginBottom
=
oDocument
.
m_oProperty
.
m_nMarginBottom
;
oReader
.
m_oCurSectionProp
.
m_nMarginBottom
=
oDocument
.
m_oProperty
.
m_nMarginBottom
;
oReader
.
m_oCurSectionProp
.
m_nGutterMarginWidth
=
oDocument
.
m_oProperty
.
m_nGutterWidth
;
oReader
.
m_oCurSectionProp
.
m_nGutterMarginWidth
=
oDocument
.
m_oProperty
.
m_nGutterWidth
;
oReader
.
m_oCurSectionProp
.
m_bSwitchMargin
=
oDocument
.
m_oProperty
.
m_bFacingPage
;
oReader
.
m_oCurSectionProp
.
m_bSwitchMargin
=
oDocument
.
m_oProperty
.
m_bFacingPage
;
oReader
.
m_oCurSectionProp
.
m_bLandscapeFormat
=
oDocument
.
m_oProperty
.
m_bLandScape
;
oReader
.
m_oCurSectionProp
.
m_bLandscapeFormat
=
oDocument
.
m_oProperty
.
m_bLandScape
;
}
}
};
};
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h
View file @
8f45da5a
...
@@ -90,7 +90,6 @@ public:
...
@@ -90,7 +90,6 @@ public:
}
}
}
}
}
}
m_poDocument
->
RemoveItem
(
0
);
_section
last_section
;
_section
last_section
;
m_poDocument
->
GetItem
(
last_section
);
m_poDocument
->
GetItem
(
last_section
);
...
@@ -112,6 +111,8 @@ public:
...
@@ -112,6 +111,8 @@ public:
m_poDocument
->
AddItem
(
section
);
m_poDocument
->
AddItem
(
section
);
}
}
m_poDocument
->
RemoveItem
(
0
);
for
(
int
sect
=
0
;
sect
<
m_poDocument
->
GetCount
();
sect
++
)
for
(
int
sect
=
0
;
sect
<
m_poDocument
->
GetCount
();
sect
++
)
{
{
m_oTextItemReader
.
m_oTextItems
=
m_poDocument
->
m_aArray
[
sect
].
props
;
m_oTextItemReader
.
m_oTextItems
=
m_poDocument
->
m_aArray
[
sect
].
props
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfBookmark.cpp
View file @
8f45da5a
...
@@ -163,9 +163,11 @@ CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter)
...
@@ -163,9 +163,11 @@ CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter)
{
{
int
nID
=
poDocument
->
m_oIdGenerator
.
Generate_FootnoteNumber
();
int
nID
=
poDocument
->
m_oIdGenerator
.
Generate_FootnoteNumber
();
OOXFootnoteWriter
*
poFootnoteWriter
=
static_cast
<
OOXFootnoteWriter
*>
(
poOOXWriter
->
m_poFootnoteWriter
);
OOXFootnoteWriter
*
poFootnoteWriter
=
static_cast
<
OOXFootnoteWriter
*>
(
poOOXWriter
->
m_poFootnoteWriter
);
RenderParameter
oNewParameter
=
oRenderParameter
;
RenderParameter
oNewParameter
=
oRenderParameter
;
oNewParameter
.
nType
=
RENDER_TO_OOX_PARAM_UNKNOWN
;
oNewParameter
.
nType
=
RENDER_TO_OOX_PARAM_UNKNOWN
;
oNewParameter
.
poRels
=
poFootnoteWriter
->
m_oRelsWriter
.
get
();
oNewParameter
.
poRels
=
poFootnoteWriter
->
m_oRelsWriter
.
get
();
poFootnoteWriter
->
AddFootnote
(
_T
(
""
),
nID
,
m_oContent
->
RenderToOOX
(
oNewParameter
)
);
poFootnoteWriter
->
AddFootnote
(
_T
(
""
),
nID
,
m_oContent
->
RenderToOOX
(
oNewParameter
)
);
sResult
+=
_T
(
"<w:r>"
);
sResult
+=
_T
(
"<w:r>"
);
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfDefine.h
View file @
8f45da5a
...
@@ -45,80 +45,79 @@ const long g_cdMaxPercent = 1000000;
...
@@ -45,80 +45,79 @@ const long g_cdMaxPercent = 1000000;
//#define RTF_MATH_OOX
//#define RTF_MATH_OOX
#define ELEMENT_UNDEFINED 0x001;
#define ELEMENT_UNDEFINED 0x001;
#define ELEMENT_OOXFIELD 0x010;
#define ELEMENT_OOXFIELD 0x010;
#define TYPE_UNKNOWN 0
#define TYPE_RTF_DOCUMENT 1
#define TYPE_UNKNOWN 0
#define TYPE_RTF_PARAGRAPH 2
#define TYPE_RTF_DOCUMENT 1
#define TYPE_RTF_BOOKMARKSTART 3
#define TYPE_RTF_PARAGRAPH 2
#define TYPE_RTF_BOOKMARKEND 4
#define TYPE_RTF_BOOKMARKSTART 3
#define TYPE_RTF_CHAR 5
#define TYPE_RTF_BOOKMARKEND 4
#define TYPE_RTF_FIELD 6
#define TYPE_RTF_CHAR 5
#define TYPE_RTF_MATH 7
#define TYPE_RTF_FIELD 6
#define TYPE_RTF_PICTURE 8
#define TYPE_RTF_MATH 7
#define TYPE_RTF_PROPERTY_DOCUMENT 9
#define TYPE_RTF_PICTURE 8
#define TYPE_RTF_PROPERTY_SECTION 10
#define TYPE_RTF_PROPERTY_DOCUMENT 9
#define TYPE_RTF_FONT 11
#define TYPE_RTF_PROPERTY_SECTION 10
#define TYPE_RTF_PROPERTY_SHADING 13
#define TYPE_RTF_FONT 11
#define TYPE_RTF_PROPERTY_SHADING 13
#define TYPE_RTF_PROPERTY_SHADING_PARAGRAPH 14
#define TYPE_RTF_PROPERTY_SHADING_PARAGRAPH 14
#define TYPE_RTF_PROPERTY_SHADING_CHAR 15
#define TYPE_RTF_PROPERTY_SHADING_CHAR
15
#define TYPE_RTF_PROPERTY_SHADING_CELL 16
#define TYPE_RTF_PROPERTY_SHADING_CELL
16
#define TYPE_RTF_PROPERTY_SHADING_ROW 17
#define TYPE_RTF_PROPERTY_SHADING_ROW
17
#define TYPE_RTF_PROPERTY_SHADING_TABLESTYLE
18
#define TYPE_RTF_PROPERTY_SHADING_TABLESTYLE 18
#define TYPE_RTF_PROPERTY_BORDER 19
#define TYPE_RTF_PROPERTY_BORDER
19
#define TYPE_RTF_PROPERTY_STYLE_CHAR 21
#define TYPE_RTF_PROPERTY_STYLE_CHAR
21
#define TYPE_RTF_PROPERTY_STYLE_PARAGRAPH 22
#define TYPE_RTF_PROPERTY_STYLE_PARAGRAPH 22
#define TYPE_RTF_PROPERTY_STYLE_TABLE 22
#define TYPE_RTF_PROPERTY_STYLE_TABLE 22
#define TYPE_RTF_SECTION 23
#define TYPE_RTF_SECTION 23
#define TYPE_RTF_TABLE 24
#define TYPE_RTF_TABLE 24
#define TYPE_RTF_TABLE_CELL 25
#define TYPE_RTF_TABLE_CELL 25
#define TYPE_RTF_PROPERTY_CHAR 26
#define TYPE_RTF_PROPERTY_CHAR 26
#define TYPE_RTF_PROPERTY_STYLE 27
#define TYPE_RTF_PROPERTY_STYLE 27
#define TYPE_RTF_TABLE_ROW 28
#define TYPE_RTF_TABLE_ROW 28
#define TYPE_RTF_OLE 29
#define TYPE_RTF_OLE 29
#define TYPE_OOX_FIELD 29
#define TYPE_OOX_FIELD 29
#define TYPE_RTF_FOOTNOTE 30
#define TYPE_RTF_FOOTNOTE 30
#define RENDER_TO_OOX_PARAM_UNKNOWN 0
#define RENDER_TO_OOX_PARAM_LAST 1
#define RENDER_TO_OOX_PARAM_UNKNOWN 0
#define RENDER_TO_OOX_PARAM_RUN 2
#define RENDER_TO_OOX_PARAM_LAST 1
#define RENDER_TO_OOX_PARAM_PLAIN 3
#define RENDER_TO_OOX_PARAM_RUN 2
#define RENDER_TO_OOX_PARAM_TEXT 4
#define RENDER_TO_OOX_PARAM_PLAIN 3
#define RENDER_TO_OOX_PARAM_MATH 5
#define RENDER_TO_OOX_PARAM_TEXT 4
#define RENDER_TO_OOX_PARAM_NESTED 6
#define RENDER_TO_OOX_PARAM_MATH 5
#define RENDER_TO_OOX_PARAM_FONTTABLE 7
#define RENDER_TO_OOX_PARAM_NESTED 6
#define RENDER_TO_OOX_PARAM_MAJOR_FONT 10
#define RENDER_TO_OOX_PARAM_FONTTABLE 7
#define RENDER_TO_OOX_PARAM_MINOR_FONT 11
#define RENDER_TO_OOX_PARAM_MAJOR_FONT 10
#define RENDER_TO_OOX_PARAM_CORE 12
#define RENDER_TO_OOX_PARAM_MINOR_FONT 11
#define RENDER_TO_OOX_PARAM_APP 13
#define RENDER_TO_OOX_PARAM_CORE 12
#define RENDER_TO_OOX_PARAM_COLOR_VALUE 14
#define RENDER_TO_OOX_PARAM_APP 13
#define RENDER_TO_OOX_PARAM_COLOR_ATTRIBUTE 15
#define RENDER_TO_OOX_PARAM_COLOR_VALUE 14
#define RENDER_TO_OOX_PARAM_COLOR_TAG 16
#define RENDER_TO_OOX_PARAM_COLOR_ATTRIBUTE 15
#define RENDER_TO_OOX_PARAM_NUMBERING 17
#define RENDER_TO_OOX_PARAM_COLOR_TAG 16
#define RENDER_TO_OOX_PARAM_STYLES 18
#define RENDER_TO_OOX_PARAM_NUMBERING 17
#define RENDER_TO_OOX_PARAM_BORDER_ATTRIBUTE 19
#define RENDER_TO_OOX_PARAM_STYLES 18
#define RENDER_TO_OOX_PARAM_BORDER_TAG 20
#define RENDER_TO_OOX_PARAM_BORDER_ATTRIBUTE 19
#define RENDER_TO_OOX_PARAM_SHAPE_WSHAPE 22
#define RENDER_TO_OOX_PARAM_BORDER_TAG 20
#define RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2 23
#define RENDER_TO_OOX_PARAM_SHAPE_WSHAPE 22
#define RENDER_TO_OOX_PARAM_FIRST_SECTION 24
#define RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2 23
#define RENDER_TO_OOX_PARAM_OLE_ONLY 25
#define RENDER_TO_OOX_PARAM_FIRST_SECTION 24
#define RENDER_TO_OOX_PARAM_OLDLIST_ABS 26
#define RENDER_TO_OOX_PARAM_OLE_ONLY 25
#define RENDER_TO_OOX_PARAM_OLDLIST_OVR 27
#define RENDER_TO_OOX_PARAM_OLDLIST_ABS 26
#define RENDER_TO_OOX_PARAM_OLDLIST_OVR 27
#define RENDER_TO_RTF_PARAM_UNKNOWN 0
#define RENDER_TO_RTF_PARAM_CHAR 1
#define RENDER_TO_RTF_PARAM_UNKNOWN 0
#define RENDER_TO_RTF_PARAM_NO_PAR 2
#define RENDER_TO_RTF_PARAM_CHAR 1
#define RENDER_TO_RTF_PARAM_PAR 3
#define RENDER_TO_RTF_PARAM_NO_PAR 2
#define RENDER_TO_RTF_PARAM_NESTED 4
#define RENDER_TO_RTF_PARAM_PAR 3
#define RENDER_TO_RTF_PARAM_PLAIN 5
#define RENDER_TO_RTF_PARAM_NESTED 4
#define RENDER_TO_RTF_PARAM_NO_SECT 6
#define RENDER_TO_RTF_PARAM_PLAIN 5
#define RENDER_TO_RTF_PARAM_FONT_TBL 7
#define RENDER_TO_RTF_PARAM_NO_SECT 6
#define RENDER_TO_RTF_PARAM_COLOR_TBL 8
#define RENDER_TO_RTF_PARAM_FONT_TBL 7
#define RENDER_TO_RTF_PARAM_NO_WROWD 9
#define RENDER_TO_RTF_PARAM_COLOR_TBL 8
#define RENDER_TO_RTF_PARAM_NO_WROWD 9
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.cpp
View file @
8f45da5a
...
@@ -43,6 +43,7 @@ RtfDocument::RtfDocument()
...
@@ -43,6 +43,7 @@ RtfDocument::RtfDocument()
{
{
RtfSectionPtr
s
(
new
RtfSection
());
RtfSectionPtr
s
(
new
RtfSection
());
_section
section
(
s
,
0
,
0
);
_section
section
(
s
,
0
,
0
);
m_aArray
.
push_back
(
section
);
m_aArray
.
push_back
(
section
);
m_oProperty
.
SetDefaultOOX
();
m_oProperty
.
SetDefaultOOX
();
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.h
View file @
8f45da5a
...
@@ -68,8 +68,8 @@ typedef boost::shared_ptr<RtfOldList> RtfOldListPtr;
...
@@ -68,8 +68,8 @@ typedef boost::shared_ptr<RtfOldList> RtfOldListPtr;
class
RtfParagraph
:
public
ITextItem
,
public
ItemContainer
<
IDocumentElementPtr
>
class
RtfParagraph
:
public
ITextItem
,
public
ItemContainer
<
IDocumentElementPtr
>
{
{
public:
public:
RtfParagraphProperty
m_oProperty
;
RtfParagraphProperty
m_oProperty
;
RtfOldListPtr
m_oOldList
;
RtfOldListPtr
m_oOldList
;
int
GetType
(
)
int
GetType
(
)
{
{
...
@@ -163,6 +163,17 @@ public:
...
@@ -163,6 +163,17 @@ public:
}
}
else
else
{
{
CString
ParagraphContent
;
// todooo проследить за вложенными объектами (inset fields) - св-ва секций
// нужно чтобы были в последнем параграфе!!! - так что и начнем с него - Australia Electronic Transactions Act 1999.rtf
RenderParameter
oNewParam
=
oRenderParameter
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_RUN
;
for
(
int
i
=
m_aArray
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
ParagraphContent
=
m_aArray
[
i
]
->
RenderToOOX
(
oNewParam
)
+
ParagraphContent
;
}
bool
bCanConvertToNumbering
=
false
;
bool
bCanConvertToNumbering
=
false
;
if
(
NULL
!=
m_oOldList
)
if
(
NULL
!=
m_oOldList
)
bCanConvertToNumbering
=
m_oOldList
->
CanConvertToNumbering
();
bCanConvertToNumbering
=
m_oOldList
->
CanConvertToNumbering
();
...
@@ -190,7 +201,7 @@ public:
...
@@ -190,7 +201,7 @@ public:
if
(
NULL
!=
m_oOldList
->
m_oText
)
if
(
NULL
!=
m_oOldList
->
m_oText
)
oCharProp
.
m_nFont
=
m_oOldList
->
m_oText
->
m_oProperty
.
m_oCharProperty
.
m_nFont
;
oCharProp
.
m_nFont
=
m_oOldList
->
m_oText
->
m_oProperty
.
m_oCharProperty
.
m_nFont
;
RenderParameter
oNewParam
=
oRenderParameter
;
oNewParam
=
oRenderParameter
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_TEXT
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_TEXT
;
for
(
int
i
=
0
;
i
<
m_oOldList
->
m_oText
->
GetCount
();
i
++
)
for
(
int
i
=
0
;
i
<
m_oOldList
->
m_oText
->
GetCount
();
i
++
)
...
@@ -206,13 +217,8 @@ public:
...
@@ -206,13 +217,8 @@ public:
}
}
}
}
RenderParameter
oNewParam
=
oRenderParameter
;
sResult
+=
ParagraphContent
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_RUN
;
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
{
sResult
+=
m_aArray
[
i
]
->
RenderToOOX
(
oNewParam
);
}
sResult
+=
_T
(
"</w:p>"
);
sResult
+=
_T
(
"</w:p>"
);
}
}
return
sResult
;
return
sResult
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
View file @
8f45da5a
...
@@ -1202,14 +1202,14 @@ CString RtfParagraphStyle::RenderToOOX(RenderParameter oRenderParameter)
...
@@ -1202,14 +1202,14 @@ CString RtfParagraphStyle::RenderToOOX(RenderParameter oRenderParameter)
if
(
false
==
sParProp
.
IsEmpty
()
)
if
(
false
==
sParProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
sParProp
;
sResult
+=
sParProp
;
sResult
+=
_T
(
"</w:pPr>"
);
sResult
+=
_T
(
"</w:pPr>"
);
}
}
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCharProp
.
IsEmpty
()
)
if
(
false
==
sCharProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
sCharProp
;
sResult
+=
sCharProp
;
sResult
+=
_T
(
"</w:rPr>"
);
sResult
+=
_T
(
"</w:rPr>"
);
}
}
sResult
+=
RenderToOOXEnd
(
oRenderParameter
)
;
sResult
+=
RenderToOOXEnd
(
oRenderParameter
)
;
...
@@ -1321,35 +1321,35 @@ CString RtfTableStyle::RenderToOOX(RenderParameter oRenderParameter)
...
@@ -1321,35 +1321,35 @@ CString RtfTableStyle::RenderToOOX(RenderParameter oRenderParameter)
if
(
false
==
sTablProp
.
IsEmpty
()
)
if
(
false
==
sTablProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:tblPr>"
);
sResult
+=
_T
(
"<w:tblPr>"
);
sResult
+=
sTablProp
;
sResult
+=
sTablProp
;
sResult
+=
_T
(
"</w:tblPr>"
);
sResult
+=
_T
(
"</w:tblPr>"
);
}
}
CString
sRowProp
=
m_oRowProp
.
RenderToOOX
(
oRenderParameter
);
CString
sRowProp
=
m_oRowProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sRowProp
.
IsEmpty
()
)
if
(
false
==
sRowProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:trPr>"
);
sResult
+=
_T
(
"<w:trPr>"
);
sResult
+=
sRowProp
;
sResult
+=
sRowProp
;
sResult
+=
_T
(
"</w:trPr>"
);
sResult
+=
_T
(
"</w:trPr>"
);
}
}
CString
sCellProp
=
m_oCellProp
.
RenderToOOX
(
oRenderParameter
);
CString
sCellProp
=
m_oCellProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCellProp
.
IsEmpty
()
)
if
(
false
==
sCellProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:tcPr>"
);
sResult
+=
_T
(
"<w:tcPr>"
);
sResult
+=
sCellProp
;
sResult
+=
sCellProp
;
sResult
+=
_T
(
"</w:tcPr>"
);
sResult
+=
_T
(
"</w:tcPr>"
);
}
}
CString
sParProp
=
m_oParProp
.
RenderToOOX
(
oRenderParameter
);
CString
sParProp
=
m_oParProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sParProp
.
IsEmpty
()
)
if
(
false
==
sParProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
sParProp
;
sResult
+=
sParProp
;
sResult
+=
_T
(
"</w:pPr>"
);
sResult
+=
_T
(
"</w:pPr>"
);
}
}
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCharProp
.
IsEmpty
()
)
if
(
false
==
sCharProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
sCharProp
;
sResult
+=
sCharProp
;
sResult
+=
_T
(
"</w:rPr>"
);
sResult
+=
_T
(
"</w:rPr>"
);
}
}
...
@@ -1447,14 +1447,14 @@ CString RtfTableStyle::RenderToOOX(RenderParameter oRenderParameter)
...
@@ -1447,14 +1447,14 @@ CString RtfTableStyle::RenderToOOX(RenderParameter oRenderParameter)
if
(
false
==
sParProp
.
IsEmpty
()
)
if
(
false
==
sParProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
_T
(
"<w:pPr>"
);
sResult
+=
sParProp
;
sResult
+=
sParProp
;
sResult
+=
_T
(
"</w:pPr>"
);
sResult
+=
_T
(
"</w:pPr>"
);
}
}
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
CString
sCharProp
=
m_oCharProp
.
RenderToOOX
(
oRenderParameter
);
if
(
false
==
sCharProp
.
IsEmpty
()
)
if
(
false
==
sCharProp
.
IsEmpty
()
)
{
{
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
_T
(
"<w:rPr>"
);
sResult
+=
sCharProp
;
sResult
+=
sCharProp
;
sResult
+=
_T
(
"</w:rPr>"
);
sResult
+=
_T
(
"</w:rPr>"
);
}
}
sResult
+=
_T
(
"</w:tblStylePr>"
)
;
sResult
+=
_T
(
"</w:tblStylePr>"
)
;
...
@@ -1868,8 +1868,8 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
...
@@ -1868,8 +1868,8 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
}
}
CString
RtfParagraphProperty
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
CString
RtfParagraphProperty
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
{
RtfDocument
*
poRtfDocument
=
static_cast
<
RtfDocument
*>
(
oRenderParameter
.
poDocument
);
RtfDocument
*
poRtfDocument
=
static_cast
<
RtfDocument
*>
(
oRenderParameter
.
poDocument
);
OOXWriter
*
poOOXWriter
=
static_cast
<
OOXWriter
*>
(
oRenderParameter
.
poWriter
);
OOXWriter
*
poOOXWriter
=
static_cast
<
OOXWriter
*>
(
oRenderParameter
.
poWriter
);
CString
sResult
;
CString
sResult
;
if
(
PROP_DEF
!=
m_nStyle
)
if
(
PROP_DEF
!=
m_nStyle
)
...
@@ -1882,21 +1882,13 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
...
@@ -1882,21 +1882,13 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
sResult
+=
_T
(
"
\"
/>"
)
;
sResult
+=
_T
(
"
\"
/>"
)
;
}
}
}
}
if
(
0
==
m_bAutoHyphenation
)
sResult
+=
_T
(
"<w:suppressAutoHyphens/>"
);
else
if
(
1
==
m_bAutoHyphenation
)
sResult
+=
_T
(
"<w:suppressAutoHyphens w:val=
\"
false
\"
/>"
);
_section
section
;
RENDER_OOX_BOOL
(
m_bKeep
,
sResult
,
_T
(
"w:keepLines"
)
);
if
(
true
==
poRtfDocument
->
GetItem
(
section
)
)
RENDER_OOX_BOOL
(
m_bKeepNext
,
sResult
,
_T
(
"w:keepNext"
)
);
{
RENDER_OOX_INT
(
m_nOutlinelevel
,
sResult
,
_T
(
"w:outlineLvl"
)
);
sResult
+=
section
.
props
->
RenderToOOX
(
oRenderParameter
);
RENDER_OOX_BOOL
(
m_bPageBB
,
sResult
,
_T
(
"w:pageBreakBefore"
)
);
section
.
props
->
m_bFinalize
=
false
;
}
if
(
0
==
m_bAutoHyphenation
)
sResult
+=
_T
(
"<w:suppressAutoHyphens/>"
);
else
if
(
1
==
m_bAutoHyphenation
)
sResult
+=
_T
(
"<w:suppressAutoHyphens w:val=
\"
false
\"
/>"
);
RENDER_OOX_BOOL
(
m_bKeep
,
sResult
,
_T
(
"w:keepLines"
)
);
RENDER_OOX_BOOL
(
m_bKeepNext
,
sResult
,
_T
(
"w:keepNext"
)
);
RENDER_OOX_INT
(
m_nOutlinelevel
,
sResult
,
_T
(
"w:outlineLvl"
)
);
RENDER_OOX_BOOL
(
m_bPageBB
,
sResult
,
_T
(
"w:pageBreakBefore"
)
);
switch
(
m_eAlign
)
switch
(
m_eAlign
)
...
@@ -1947,12 +1939,12 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
...
@@ -1947,12 +1939,12 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
if
(
PROP_DEF
==
m_nSpaceAfter
)
m_nSpaceAfter
=
0
;
if
(
PROP_DEF
==
m_nSpaceAfter
)
m_nSpaceAfter
=
0
;
//if( PROP_DEF == m_nSpaceBefore ) m_nSpaceBefore = 0;
//if( PROP_DEF == m_nSpaceBefore ) m_nSpaceBefore = 0;
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceBefore
,
sSpacing
,
_T
(
"w:before"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceBefore
,
sSpacing
,
_T
(
"w:before"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceAfter
,
sSpacing
,
_T
(
"w:after"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceAfter
,
sSpacing
,
_T
(
"w:after"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceBeforeAuto
,
sSpacing
,
_T
(
"w:beforeAutospacing"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceBeforeAuto
,
sSpacing
,
_T
(
"w:beforeAutospacing"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceAfterAuto
,
sSpacing
,
_T
(
"w:afterAutospacing"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceAfterAuto
,
sSpacing
,
_T
(
"w:afterAutospacing"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceBeforeLine
,
sSpacing
,
_T
(
"w:beforeLines"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceBeforeLine
,
sSpacing
,
_T
(
"w:beforeLines"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceAfterLine
,
sSpacing
,
_T
(
"w:afterLines"
)
);
RENDER_OOX_INT_ATTRIBUTE
(
m_nSpaceAfterLine
,
sSpacing
,
_T
(
"w:afterLines"
)
);
if
(
PROP_DEF
!=
m_nSpaceBetween
&&
0
!=
m_nSpaceBetween
)
if
(
PROP_DEF
!=
m_nSpaceBetween
&&
0
!=
m_nSpaceBetween
)
{
{
...
@@ -2024,7 +2016,7 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
...
@@ -2024,7 +2016,7 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
}
}
if
(
true
==
m_oBorderRight
.
IsValid
()
)
if
(
true
==
m_oBorderRight
.
IsValid
()
)
{
{
sBorder
+=
_T
(
"<w:right "
);
sBorder
+=
m_oBorderRight
.
RenderToOOX
(
oNewParam
);
sBorder
+=
_T
(
" />"
);
sBorder
+=
_T
(
"<w:right "
);
sBorder
+=
m_oBorderRight
.
RenderToOOX
(
oNewParam
);
sBorder
+=
_T
(
" />"
);
}
}
}
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h
View file @
8f45da5a
This diff is collapsed.
Click to expand it.
ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.h
View file @
8f45da5a
...
@@ -508,108 +508,114 @@ public:
...
@@ -508,108 +508,114 @@ public:
SetDefault
();
SetDefault
();
//footer - header
//footer - header
m_oHeaderLeft
=
TextItemContainerPtr
();
m_oHeaderLeft
=
TextItemContainerPtr
();
m_oHeaderFirst
=
TextItemContainerPtr
();
m_oHeaderFirst
=
TextItemContainerPtr
();
m_oHeaderRight
=
TextItemContainerPtr
();
m_oHeaderRight
=
TextItemContainerPtr
();
m_oFooterLeft
=
TextItemContainerPtr
();
m_oFooterLeft
=
TextItemContainerPtr
();
m_oFooterFirst
=
TextItemContainerPtr
();
m_oFooterFirst
=
TextItemContainerPtr
();
m_oFooterRight
=
TextItemContainerPtr
();
m_oFooterRight
=
TextItemContainerPtr
();
}
}
int
GetType
()
int
GetType
()
{
{
return
TYPE_RTF_PROPERTY_SECTION
;
return
TYPE_RTF_PROPERTY_SECTION
;
}
}
void
SetDefaultRtf
()
void
SetDefaultRtf
()
{
{
SetDefault
();
SetDefault
();
m_nColumnSpace
=
720
;
DEFAULT_PROPERTY_DEF
(
m_eSectionBreak
,
sb_sbkpage
)
DEFAULT_PROPERTY_DEF
(
m_nColumnSpace
,
720
);
}
}
void
SetDefaultOOX
()
void
SetDefaultOOX
()
{
{
SetDefault
();
SetDefault
();
m_nPageWidth
=
11906
;
m_nPageHeight
=
16838
;
m_nMarginLeft
=
210
;
m_nPageWidth
=
11906
;
m_nMarginRight
=
215
;
m_nPageHeight
=
16838
;
m_nMarginTop
=
204
;
m_nMarginBottom
=
204
;
m_nHeaderTop
=
709
;
m_nMarginLeft
=
210
;
m_nFooterBottom
=
709
;
m_nMarginRight
=
215
;
m_nGutterMarginWidth
=
0
;
m_nMarginTop
=
204
;
m_nMarginBottom
=
204
;
m_nColumnSpace
=
708
;
m_nHeaderTop
=
709
;
m_nFooterBottom
=
709
;
m_nGutterMarginWidth
=
0
;
m_nColumnSpace
=
708
;
}
}
void
SetDefault
()
void
SetDefault
()
{
{
DEFAULT_PROPERTY
(
m_bBidi
)
DEFAULT_PROPERTY
(
m_bBidi
)
DEFAULT_PROPERTY
(
m_nPaperSourceFirst
)
DEFAULT_PROPERTY
(
m_nPaperSourceFirst
)
DEFAULT_PROPERTY
(
m_nPaperSourceOther
)
DEFAULT_PROPERTY
(
m_nPaperSourceOther
)
DEFAULT_PROPERTY
(
m_bRtlGutter
)
DEFAULT_PROPERTY
(
m_bRtlGutter
)
DEFAULT_PROPERTY
(
m_bEndnotes
)
DEFAULT_PROPERTY
(
m_bEndnotes
)
DEFAULT_PROPERTY
(
m_nStyle
)
DEFAULT_PROPERTY
(
m_nStyle
)
DEFAULT_PROPERTY_DEF
(
m_eSectionBreak
,
sb_none
)
DEFAULT_PROPERTY_DEF
(
m_eSectionBreak
,
sb_none
)
//Columns
//Columns
m_nColumnNumber
=
1
;
m_nColumnNumber
=
1
;
DEFAULT_PROPERTY
(
m_nColumnSpace
)
DEFAULT_PROPERTY
(
m_nColumnSpace
)
DEFAULT_PROPERTY
(
m_bColumnLineBetween
)
DEFAULT_PROPERTY
(
m_bColumnLineBetween
)
m_oCollumnProperty
.
m_aCollumnProperty
.
resize
(
m_nColumnNumber
);
m_oCollumnProperty
.
m_aCollumnProperty
.
resize
(
m_nColumnNumber
);
//Footnotes and Endnotes
//Footnotes and Endnotes
DEFAULT_PROPERTY_DEF
(
m_eFootnotesJust
,
fj_none
)
DEFAULT_PROPERTY_DEF
(
m_eFootnotesJust
,
fj_none
)
DEFAULT_PROPERTY
(
m_nFootnotesStart
)
DEFAULT_PROPERTY
(
m_nFootnotesStart
)
DEFAULT_PROPERTY_DEF
(
m_eFootnotesRestart
,
fr_none
)
DEFAULT_PROPERTY_DEF
(
m_eFootnotesRestart
,
fr_none
)
DEFAULT_PROPERTY_DEF
(
m_eFootnotesFormat
,
ff_none
)
DEFAULT_PROPERTY_DEF
(
m_eFootnotesFormat
,
ff_none
)
DEFAULT_PROPERTY
(
m_nEndnotesStart
)
DEFAULT_PROPERTY
(
m_nEndnotesStart
)
DEFAULT_PROPERTY_DEF
(
m_eEndnotesRestart
,
er_none
)
DEFAULT_PROPERTY_DEF
(
m_eEndnotesRestart
,
er_none
)
DEFAULT_PROPERTY_DEF
(
m_eEndnotesFormat
,
ef_none
)
DEFAULT_PROPERTY_DEF
(
m_eEndnotesFormat
,
ef_none
)
//Line Numbering
//Line Numbering
DEFAULT_PROPERTY
(
m_nLineModulus
)
DEFAULT_PROPERTY
(
m_nLineModulus
)
DEFAULT_PROPERTY
(
m_nLineX
)
DEFAULT_PROPERTY
(
m_nLineX
)
DEFAULT_PROPERTY
(
m_nLineStart
)
DEFAULT_PROPERTY
(
m_nLineStart
)
DEFAULT_PROPERTY_DEF
(
m_eLineNumberRestart
,
lnr_none
)
DEFAULT_PROPERTY_DEF
(
m_eLineNumberRestart
,
lnr_none
)
//Page Information
//Page Information
DEFAULT_PROPERTY
(
m_nPageWidth
)
DEFAULT_PROPERTY
(
m_nPageWidth
)
DEFAULT_PROPERTY
(
m_nPageHeight
)
DEFAULT_PROPERTY
(
m_nPageHeight
)
DEFAULT_PROPERTY
(
m_nMarginLeft
)
DEFAULT_PROPERTY
(
m_nMarginLeft
)
DEFAULT_PROPERTY
(
m_nMarginRight
)
DEFAULT_PROPERTY
(
m_nMarginRight
)
DEFAULT_PROPERTY
(
m_nMarginTop
)
DEFAULT_PROPERTY
(
m_nMarginTop
)
DEFAULT_PROPERTY
(
m_nMarginBottom
)
DEFAULT_PROPERTY
(
m_nMarginBottom
)
DEFAULT_PROPERTY
(
m_nGutterMarginWidth
)
DEFAULT_PROPERTY
(
m_nGutterMarginWidth
)
DEFAULT_PROPERTY
(
m_bSwitchMargin
)
DEFAULT_PROPERTY
(
m_bSwitchMargin
)
DEFAULT_PROPERTY
(
m_bLandscapeFormat
)
DEFAULT_PROPERTY
(
m_bLandscapeFormat
)
DEFAULT_PROPERTY
(
m_bTitlePage
)
DEFAULT_PROPERTY
(
m_bTitlePage
)
DEFAULT_PROPERTY_DEF
(
m_nHeaderTop
,
720
)
DEFAULT_PROPERTY_DEF
(
m_nHeaderTop
,
720
)
DEFAULT_PROPERTY_DEF
(
m_nFooterBottom
,
720
)
DEFAULT_PROPERTY_DEF
(
m_nFooterBottom
,
720
)
//Page Numbers
//Page Numbers
DEFAULT_PROPERTY
(
m_nPageNumberStart
)
DEFAULT_PROPERTY
(
m_nPageNumberStart
)
DEFAULT_PROPERTY
(
m_bPageNumberContinuos
)
DEFAULT_PROPERTY
(
m_bPageNumberContinuos
)
DEFAULT_PROPERTY
(
m_bPageNumberRestart
)
DEFAULT_PROPERTY
(
m_bPageNumberRestart
)
DEFAULT_PROPERTY
(
m_nPageNumberX
)
DEFAULT_PROPERTY
(
m_nPageNumberX
)
DEFAULT_PROPERTY
(
m_nPageNumberY
)
DEFAULT_PROPERTY
(
m_nPageNumberY
)
DEFAULT_PROPERTY_DEF
(
m_ePageNumberFormat
,
pnf_none
)
DEFAULT_PROPERTY_DEF
(
m_ePageNumberFormat
,
pnf_none
)
//Vertical Alignment
//Vertical Alignment
DEFAULT_PROPERTY_DEF
(
m_eVerticalAlignment
,
va_none
)
DEFAULT_PROPERTY_DEF
(
m_eVerticalAlignment
,
va_none
)
//Text Flow
//Text Flow
DEFAULT_PROPERTY
(
m_nTextFollow
)
DEFAULT_PROPERTY
(
m_nTextFollow
)
//Page Borders
//Page Borders
m_oBorderLeft
.
SetDefault
();
m_oBorderLeft
.
SetDefault
();
m_oBorderTop
.
SetDefault
();
m_oBorderTop
.
SetDefault
();
m_oBorderRight
.
SetDefault
();
m_oBorderRight
.
SetDefault
();
m_oBorderBottom
.
SetDefault
();
m_oBorderBottom
.
SetDefault
();
DEFAULT_PROPERTY
(
m_nBorderArt
)
DEFAULT_PROPERTY
(
m_nBorderMeasure
)
DEFAULT_PROPERTY
(
m_nBorderArt
)
DEFAULT_PROPERTY
(
m_nBorderAlign
)
DEFAULT_PROPERTY
(
m_nBorderMeasure
)
DEFAULT_PROPERTY
(
m_nBorderAlign
)
//footer - header надо обнулять вручную
//footer - header надо обнулять вручную
//m_oHeaderLeft = TextItemContainerPtr();
//m_oHeaderLeft = TextItemContainerPtr();
...
@@ -660,6 +666,7 @@ public:
...
@@ -660,6 +666,7 @@ public:
CString
RenderToOOX
(
RenderParameter
oRenderParameter
)
CString
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
{
if
(
!
m_bFinalize
)
return
L""
;
if
(
!
m_bFinalize
)
return
L""
;
m_bFinalize
=
false
;
// тут .. чтобы не повторилось при конвертации колонтитулов
m_bFinalize
=
false
;
// тут .. чтобы не повторилось при конвертации колонтитулов
RenderParameter
oNewParam
=
oRenderParameter
;
RenderParameter
oNewParam
=
oRenderParameter
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
View file @
8f45da5a
...
@@ -225,40 +225,42 @@ bool OOXDocumentWriter::SaveByItem()
...
@@ -225,40 +225,42 @@ bool OOXDocumentWriter::SaveByItem()
if
(
m_oDocument
.
GetCount
()
>
1
)
//если что-то есть в следующей секции значит предыдущая закончилась
if
(
m_oDocument
.
GetCount
()
>
1
)
//если что-то есть в следующей секции значит предыдущая закончилась
{
{
if
(
m_oDocument
[
1
].
props
->
GetCount
()
>
0
)
std
::
wstring
sXml
,
sectPr
;
_section
section
;
if
(
m_oDocument
.
GetItem
(
section
,
0
))
{
{
CString
sSectPr
=
m_oDocument
[
0
].
props
->
m_oProperty
.
RenderToOOX
(
oNewParam
);
sectPr
=
section
.
props
->
RenderToOOX
(
oNewParam
).
GetBuffer
();
CString
sXml
=
m_oDocument
[
1
].
props
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
}
int
nIndexP
=
sXml
.
Find
(
_T
(
"<w:p>"
)
);
if
(
nIndexP
==
0
)
//элемент параграф
if
(
m_oDocument
[
0
].
props
->
GetCount
()
>
0
)
{
sXml
=
m_oDocument
[
0
].
props
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
).
GetBuffer
();
int
nFind
=
sXml
.
rfind
(
L"</w:pPr>"
);
if
(
-
1
!=
nFind
)
{
{
int
nIndexpPr
=
sXml
.
Find
(
_T
(
"</w:pPr>"
)
);
sXml
.
insert
(
nFind
,
sectPr
);
if
(
-
1
!=
nIndexpPr
)
{
sXml
.
Insert
(
nIndexpPr
,
sSectPr
);
}
else
{
sSectPr
=
_T
(
"<w:pPr>"
)
+
sSectPr
+
_T
(
"</w:pPr>"
);
sXml
.
Insert
(
5
,
sSectPr
);
}
}
}
else
else
{
{
sXml
=
_T
(
"<w:p><w:pPr>"
)
+
sSectPr
+
_T
(
"</w:pPr></w:p>"
)
+
sXml
;
int
Find
=
sXml
.
rfind
(
L"<w:p>"
);
if
(
-
1
!=
nFind
)
sXml
.
insert
(
nFind
+
5
,
L"<w:pPr>"
+
sectPr
+
L"</w:pPr>"
);
}
}
}
std
::
string
sXmlUTF
=
NSFile
::
CUtf8Converter
::
GetUtf8StringFromUnicode
(
sXml
.
GetBuffer
());
else
{
m_oFileWriter
->
Write
((
BYTE
*
)
sXmlUTF
.
c_str
(),
sXmlUTF
.
length
());
//генерация ???
sXml
=
_T
(
"<w:p><w:pPr>"
)
+
sectPr
+
_T
(
"</w:pPr></w:p>"
);
m_oDocument
[
1
].
props
->
RemoveItem
(
0
);
//удаляем первый параграф
}
m_oDocument
.
RemoveItem
(
0
);
//удаляем секцию
}
std
::
string
sXmlUTF
=
NSFile
::
CUtf8Converter
::
GetUtf8StringFromUnicode
(
sXml
);
m_oFileWriter
->
Write
((
BYTE
*
)
sXmlUTF
.
c_str
(),
sXmlUTF
.
length
());
m_oDocument
.
RemoveItem
(
0
);
//удаляем секцию
}
}
else
if
(
m_oDocument
.
GetCount
()
>
0
&&
m_oDocument
[
0
].
props
->
GetCount
()
>
0
)
//пишем параграф
else
if
(
m_oDocument
.
GetCount
()
>
0
&&
m_oDocument
[
0
].
props
->
GetCount
()
>
1
)
//пишем параграф - один всегда "прозапас для секций"
{
{
CString
sXml
=
m_oDocument
[
0
].
props
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
CString
sXml
=
m_oDocument
[
0
].
props
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
std
::
string
sXmlUTF
=
NSFile
::
CUtf8Converter
::
GetUtf8StringFromUnicode
(
sXml
.
GetBuffer
());
std
::
string
sXmlUTF
=
NSFile
::
CUtf8Converter
::
GetUtf8StringFromUnicode
(
sXml
.
GetBuffer
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment