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
8cdf4911
Commit
8cdf4911
authored
Dec 19, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocxBin - add background document
parent
c5c64cb6
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
605 additions
and
440 deletions
+605
-440
ASCOfficeDocxFile2/BinReader/DocumentWriter.h
ASCOfficeDocxFile2/BinReader/DocumentWriter.h
+16
-7
ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h
ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h
+2
-1
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
+49
-4
ASCOfficeDocxFile2/BinReader/Readers.h
ASCOfficeDocxFile2/BinReader/Readers.h
+120
-71
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
+23
-15
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+361
-334
ASCOfficeOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
...eOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
+6
-0
ASCOfficeOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.vcproj
...fFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.vcproj
+12
-0
Common/DocxFormat/Source/DocxFormat/Document.h
Common/DocxFormat/Source/DocxFormat/Document.h
+16
-8
No files found.
ASCOfficeDocxFile2/BinReader/DocumentWriter.h
View file @
8cdf4911
...
...
@@ -53,13 +53,22 @@ namespace Writers
CFile
oFile
;
oFile
.
CreateFile
(
filePath
.
GetPath
());
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
standalone=
\"
yes
\"
?><w:document xmlns:wpc=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas
\"
xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
xmlns:o=
\"
urn:schemas-microsoft-com:office:office
\"
xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
xmlns:v=
\"
urn:schemas-microsoft-com:vml
\"
xmlns:wp14=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing
\"
xmlns:wp=
\"
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing
\"
xmlns:w10=
\"
urn:schemas-microsoft-com:office:word
\"
xmlns:w=
\"
http://schemas.openxmlformats.org/wordprocessingml/2006/main
\"
xmlns:w14=
\"
http://schemas.microsoft.com/office/word/2010/wordml
\"
xmlns:wpg=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingGroup
\"
xmlns:wpi=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingInk
\"
xmlns:wne=
\"
http://schemas.microsoft.com/office/word/2006/wordml
\"
xmlns:wps=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingShape
\"
mc:Ignorable=
\"
w14 wp14
\"
><w:body>"
)));
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
standalone=
\"
yes
\"
?>"
)));
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"</w:body><w:document xmlns:wpc=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas
\"
xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
xmlns:o=
\"
urn:schemas-microsoft-com:office:office
\"
xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
xmlns:v=
\"
urn:schemas-microsoft-com:vml
\"
xmlns:wp14=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing
\"
xmlns:wp=
\"
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing
\"
xmlns:w10=
\"
urn:schemas-microsoft-com:office:word
\"
xmlns:w=
\"
http://schemas.openxmlformats.org/wordprocessingml/2006/main
\"
xmlns:w14=
\"
http://schemas.microsoft.com/office/word/2010/wordml
\"
xmlns:wpg=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingGroup
\"
xmlns:wpi=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingInk
\"
xmlns:wne=
\"
http://schemas.microsoft.com/office/word/2006/wordml
\"
xmlns:wps=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingShape
\"
mc:Ignorable=
\"
w14 wp14
\"
>"
)));
oFile
.
WriteStringUTF8
(
m_oBackground
.
GetData
());
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"<w:body>"
)));
oFile
.
WriteStringUTF8
(
m_oContent
.
GetData
());
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"<w:sectPr >"
)));
oFile
.
WriteStringUTF8
(
WriteSectPrHdrFtr
());
oFile
.
WriteStringUTF8
(
m_oSecPr
.
GetData
());
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"</w:sectPr>"
)));
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"</w:body></w:document>"
)));
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"</w:body>"
)));
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"</w:document>"
)));
oFile
.
CloseFile
();
}
CString
WriteSectPrHdrFtr
()
...
...
ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h
View file @
8cdf4911
...
...
@@ -39,6 +39,7 @@ namespace Writers
class
ContentWriter
{
public:
XmlUtils
::
CStringWriter
m_oBackground
;
XmlUtils
::
CStringWriter
m_oContent
;
XmlUtils
::
CStringWriter
m_oSecPr
;
};
...
...
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
View file @
8cdf4911
...
...
@@ -265,6 +265,51 @@ public:
bBeforeAuto
=
false
;
}
};
class
Background
{
public:
docRGB
Color
;
CThemeColor
ThemeColor
;
CString
sObject
;
bool
bColor
;
bool
bThemeColor
;
Background
()
:
bColor
(
false
),
bThemeColor
(
false
)
{}
CString
Write
()
{
CString
sBackground
=
L"<w:background"
;
if
(
bColor
)
{
sBackground
+=
L" w:color=
\"
"
+
Color
.
ToString
()
+
L"
\"
"
;
}
if
(
bThemeColor
&&
ThemeColor
.
IsNoEmpty
())
{
if
(
ThemeColor
.
bColor
)
sBackground
+=
L" w:themeColor=
\"
"
+
ThemeColor
.
ToStringColor
()
+
L"
\"
"
;
if
(
ThemeColor
.
bTint
)
sBackground
+=
L" w:themeColorTint=
\"
"
+
ThemeColor
.
ToStringTint
()
+
L"
\"
"
;
if
(
ThemeColor
.
bShade
)
sBackground
+=
L" w:themeColorShade=
\"
"
+
ThemeColor
.
ToStringShade
()
+
L"
\"
"
;
}
if
(
!
bColor
&&
!
bThemeColor
)
{
sBackground
+=
L" w:color=
\"
ffffff
\"
"
;
}
sBackground
+=
L">"
;
sBackground
+=
sObject
;
sBackground
+=
L"</w:background>"
;
return
sBackground
;
}
};
class
Shd
{
public:
...
...
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
8cdf4911
...
...
@@ -614,8 +614,7 @@ public:
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:contextualSpacing w:val=
\"
true
\"
/>"
)));
else
if
(
false
==
bDoNotWriteNullProp
)
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:contextualSpacing w:val=
\"
false
\"
/>"
)));
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
Ind
:
{
XmlUtils
::
CStringWriter
oTempWriter
;
...
...
@@ -638,8 +637,7 @@ public:
case
align_Center
:
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:jc w:val=
\"
center
\"
/>"
)));
break
;
case
align_Justify
:
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:jc w:val=
\"
both
\"
/>"
)));
break
;
}
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
KeepLines
:
{
BYTE
KeepLines
=
m_oBufferedStream
.
GetUChar
();
...
...
@@ -647,8 +645,7 @@ public:
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:keepLines/>"
)));
else
if
(
false
==
bDoNotWriteNullProp
)
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:keepLines w:val=
\"
false
\"
/>"
)));
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
KeepNext
:
{
BYTE
KeepNext
=
m_oBufferedStream
.
GetUChar
();
...
...
@@ -656,8 +653,7 @@ public:
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:keepNext/>"
)));
else
if
(
false
==
bDoNotWriteNullProp
)
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:keepNext w:val=
\"
false
\"
/>"
)));
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
PageBreakBefore
:
{
BYTE
pageBreakBefore
=
m_oBufferedStream
.
GetUChar
();
...
...
@@ -789,8 +785,7 @@ public:
}
pCStringWriter
->
WriteString
(
CString
(
_T
(
"</w:tabs>"
)));
}
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
ParaStyle
:
{
CString
sStyleName
(
m_oBufferedStream
.
GetString3
(
length
));
...
...
@@ -800,13 +795,13 @@ public:
sStyle
.
Append
(
sStyleName
);
sStyle
.
Append
(
_T
(
"
\"
/>"
));
pCStringWriter
->
WriteString
(
sStyle
);
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
numPr
:
{
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:numPr>"
)));
res
=
Read2
(
length
,
&
Binary_pPrReader
::
ReadNumPr
,
this
,
poResult
);
pCStringWriter
->
WriteString
(
CString
(
_T
(
"</w:numPr>"
)));
break
;
}
break
;
case
c_oSerProp_pPrType
:
:
pPr_rPr
:
{
rPr
orPr
(
m_oFontTableWriter
.
m_mapFonts
);
...
...
@@ -814,8 +809,8 @@ public:
//Read2(length, &Binary_pPrReader::ReadNumPr, this, &orPr);
if
(
orPr
.
IsNoEmpty
())
orPr
.
Write
(
pCStringWriter
);
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
pBdr
:
{
docBorders
odocBorders
;
...
...
@@ -826,23 +821,20 @@ public:
odocBorders
.
Write
(
pCStringWriter
,
false
);
pCStringWriter
->
WriteString
(
CString
(
_T
(
"</w:pBdr>"
)));
}
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
FramePr
:
{
CFramePr
oFramePr
;
res
=
Read2
(
length
,
&
Binary_pPrReader
::
ReadFramePr
,
this
,
&
oFramePr
);
if
(
false
==
oFramePr
.
IsEmpty
())
oFramePr
.
Write
(
*
pCStringWriter
);
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
pPrChange
:
{
TrackRevision
oPPrChange
;
res
=
Read1
(
length
,
&
Binary_pPrReader
::
ReadPPrChange
,
this
,
&
oPPrChange
);
oPPrChange
.
Write
(
pCStringWriter
,
_T
(
"w:pPrChange"
));
break
;
}
}
break
;
case
c_oSerProp_pPrType
:
:
SectPr
:
{
SectPr
oSectPr
;
...
...
@@ -850,8 +842,7 @@ public:
pCStringWriter
->
WriteString
(
CString
(
_T
(
"<w:sectPr>"
)));
pCStringWriter
->
WriteString
(
oSectPr
.
Write
());
pCStringWriter
->
WriteString
(
CString
(
_T
(
"</w:sectPr>"
)));
break
;
}
}
break
;
default:
res
=
c_oSerConstants
::
ReadUnknown
;
break
;
...
...
@@ -871,7 +862,7 @@ public:
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
}
int
ReadInd
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -913,7 +904,7 @@ public:
break
;
}
return
res
;
};
}
int
ReadSpacing
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -949,7 +940,7 @@ public:
break
;
}
return
res
;
};
}
int
ReadTabs
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -975,7 +966,7 @@ public:
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
}
int
ReadNumPr
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -1050,7 +1041,7 @@ public:
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
}
int
ReadBorder
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -1083,7 +1074,7 @@ public:
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
}
int
ReadFramePr
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -1161,7 +1152,7 @@ public:
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
}
int
Read_SecPr
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
SectPr
*
pSectPr
=
static_cast
<
SectPr
*>
(
poResult
);
...
...
@@ -3579,6 +3570,9 @@ public:
};
class
Binary_DocumentTableReader
:
public
Binary_CommonReader
<
Binary_DocumentTableReader
>
{
private:
Binary_CommonReader2
oBinary_CommonReader2
;
Writers
::
FileWriter
&
m_oFileWriter
;
Writers
::
FontTableWriter
&
m_oFontTableWriter
;
Binary_pPrReader
oBinary_pPrReader
;
...
...
@@ -3593,8 +3587,20 @@ class Binary_DocumentTableReader : public Binary_CommonReader<Binary_DocumentTab
public:
Writers
::
ContentWriter
&
m_oDocumentWriter
;
Writers
::
MediaWriter
&
m_oMediaWriter
;
public:
Binary_DocumentTableReader
(
NSBinPptxRW
::
CBinaryFileReader
&
poBufferedStream
,
Writers
::
FileWriter
&
oFileWriter
,
Writers
::
ContentWriter
&
oDocumentWriter
,
CComments
*
pComments
)
:
Binary_CommonReader
(
poBufferedStream
),
m_oDocumentWriter
(
oDocumentWriter
),
m_oFileWriter
(
oFileWriter
),
m_oMediaWriter
(
oFileWriter
.
m_oMediaWriter
),
m_oFontTableWriter
(
oFileWriter
.
m_oFontTableWriter
),
oBinary_pPrReader
(
poBufferedStream
,
oFileWriter
),
oBinary_rPrReader
(
poBufferedStream
,
oFileWriter
),
oBinary_tblPrReader
(
poBufferedStream
,
oFileWriter
),
m_oCur_rPr
(
m_oFontTableWriter
.
m_mapFonts
),
m_oMath_rPr
(
m_oFontTableWriter
.
m_mapFonts
),
m_pComments
(
pComments
)
Binary_DocumentTableReader
(
NSBinPptxRW
::
CBinaryFileReader
&
poBufferedStream
,
Writers
::
FileWriter
&
oFileWriter
,
Writers
::
ContentWriter
&
oDocumentWriter
,
CComments
*
pComments
)
:
Binary_CommonReader
(
poBufferedStream
)
,
m_oDocumentWriter
(
oDocumentWriter
)
,
m_oFileWriter
(
oFileWriter
)
,
m_oMediaWriter
(
oFileWriter
.
m_oMediaWriter
)
,
m_oFontTableWriter
(
oFileWriter
.
m_oFontTableWriter
)
,
oBinary_CommonReader2
(
poBufferedStream
)
,
oBinary_pPrReader
(
poBufferedStream
,
oFileWriter
)
,
oBinary_rPrReader
(
poBufferedStream
,
oFileWriter
)
,
oBinary_tblPrReader
(
poBufferedStream
,
oFileWriter
)
,
m_oCur_rPr
(
m_oFontTableWriter
.
m_mapFonts
)
,
m_oMath_rPr
(
m_oFontTableWriter
.
m_mapFonts
)
,
m_pComments
(
pComments
)
{
m_byteLastElemType
=
c_oSerParType
::
Content
;
m_pCurWriter
=
NULL
;
...
...
@@ -3605,7 +3611,7 @@ public:
int
Read
()
{
return
ReadTable
(
&
Binary_DocumentTableReader
::
ReadDocumentContent
,
this
);
};
}
XmlUtils
::
CStringWriter
&
GetRunStringWriter
()
{
if
(
NULL
!=
m_pCurWriter
)
...
...
@@ -3644,10 +3650,16 @@ public:
if
(
oSectPr
.
bEvenAndOddHeaders
&&
oSectPr
.
EvenAndOddHeaders
)
m_oFileWriter
.
m_oSettingWriter
.
AddSetting
(
_T
(
"<w:evenAndOddHeaders/>"
));
}
else
if
(
c_oSerParType
::
Background
==
type
)
{
Background
oBackground
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
Read_Background
,
this
,
&
oBackground
);
m_oDocumentWriter
.
m_oBackground
.
WriteString
(
oBackground
.
Write
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
}
int
ReadParagraph
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -3668,7 +3680,7 @@ public:
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
}
int
ReadParagraphContent
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -6262,7 +6274,7 @@ public:
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
}
int
ReadFootnoteRef
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Logic
::
CFootnoteReference
*
pFootnoteRef
=
static_cast
<
OOX
::
Logic
::
CFootnoteReference
*>
(
poResult
);
...
...
@@ -6339,8 +6351,11 @@ public:
{
CDrawingProperty
oCDrawingProperty
(
m_oFileWriter
.
getNextDocPr
());
res
=
Read2
(
length
,
&
Binary_DocumentTableReader
::
ReadPptxDrawing
,
this
,
&
oCDrawingProperty
);
if
(
oCDrawingProperty
.
bDataPos
&&
oCDrawingProperty
.
bDataLength
)
{
ReadDrawing
(
oCDrawingProperty
);
}
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
...
...
@@ -6380,7 +6395,7 @@ public:
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
};
};
int
Read_tblGrid
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -6545,6 +6560,40 @@ public:
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
int
Read_Background
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
Background
*
pBackground
=
static_cast
<
Background
*>
(
poResult
);
if
(
c_oSerBackgroundType
::
Color
==
type
)
{
pBackground
->
bColor
=
true
;
pBackground
->
Color
=
oBinary_CommonReader2
.
ReadColor
();
}
else
if
(
c_oSerBackgroundType
::
ColorTheme
==
type
)
{
pBackground
->
bThemeColor
=
true
;
oBinary_CommonReader2
.
ReadThemeColor
(
length
,
pBackground
->
ThemeColor
);
}
else
if
(
c_oSerBackgroundType
::
pptxDrawing
==
type
)
{
long
nCurPos
=
m_oBufferedStream
.
GetPos
();
CString
*
bstrDrawingXml
=
NULL
;
m_oFileWriter
.
m_pDrawingConverter
->
SaveObjectEx
(
nCurPos
,
length
,
L""
,
XMLWRITER_DOC_TYPE_DOCX
,
&
bstrDrawingXml
);
m_oBufferedStream
.
Seek
(
nCurPos
);
if
(
NULL
!=
bstrDrawingXml
&&
false
==
bstrDrawingXml
->
IsEmpty
())
{
pBackground
->
sObject
=
*
bstrDrawingXml
;
}
RELEASEOBJECT
(
bstrDrawingXml
);
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
int
ReadPptxDrawing
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
@@ -7035,7 +7084,7 @@ Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReade
int
Binary_HdrFtrTableReader
::
Read
()
{
return
ReadTable
(
&
Binary_HdrFtrTableReader
::
ReadHdrFtrContent
,
this
);
}
;
}
int
Binary_HdrFtrTableReader
::
ReadHdrFtrContent
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
...
...
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
View file @
8cdf4911
...
...
@@ -152,7 +152,8 @@ extern int g_nCurFormatVersion;
Comments
=
8
,
Settings
=
9
,
Footnotes
=
10
,
Endnotes
=
11
Endnotes
=
11
,
Background
};}
namespace
c_oSerSigTypes
{
enum
c_oSerSigTypes
{
...
...
@@ -459,7 +460,8 @@ extern int g_nCurFormatVersion;
Hyperlink
=
10
,
FldSimple
=
11
,
Del
=
12
,
Ins
=
13
Ins
=
13
,
Background
=
14
};}
namespace
c_oSerDocTableType
{
enum
c_oSerDocTableType
{
...
...
@@ -506,6 +508,12 @@ extern int g_nCurFormatVersion;
endnoteReference
=
27
,
arPr
=
28
};}
namespace
c_oSerBackgroundType
{
enum
c_oSerBackgroundType
{
Color
=
0
,
ColorTheme
=
1
,
pptxDrawing
=
2
};}
namespace
c_oSerImageType
{
enum
c_oSerImageType
{
MediaId
=
0
,
...
...
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
8cdf4911
...
...
@@ -154,7 +154,7 @@ namespace BinDocxRW
}
}
}
;
}
void
WriteTblBorders
(
const
OOX
::
Logic
::
CTblBorders
&
Borders
)
{
int
nCurPos
=
0
;
...
...
@@ -188,7 +188,7 @@ namespace BinDocxRW
{
WriteBorder
(
c_oSerBordersType
::
insideH
,
Borders
.
m_oInsideH
.
get
());
}
}
;
}
void
WriteTcBorders
(
const
OOX
::
Logic
::
CTcBorders
&
Borders
)
{
int
nCurPos
=
0
;
...
...
@@ -222,7 +222,7 @@ namespace BinDocxRW
{
WriteBorder
(
c_oSerBordersType
::
insideH
,
Borders
.
m_oInsideH
.
get
());
}
}
;
}
void
WritePBorders
(
const
OOX
::
Logic
::
CPBdr
&
Borders
)
{
int
nCurPos
=
0
;
...
...
@@ -251,7 +251,7 @@ namespace BinDocxRW
{
WriteBorder
(
c_oSerBordersType
::
between
,
Borders
.
m_oBetween
.
get
());
}
}
;
}
void
WriteColor
(
BYTE
type
,
const
SimpleTypes
::
CHexColor
<>&
color
)
{
if
(
SimpleTypes
::
hexcolorRGB
==
color
.
GetValue
())
...
...
@@ -262,7 +262,7 @@ namespace BinDocxRW
m_oStream
.
WriteBYTE
(
color
.
Get_G
());
m_oStream
.
WriteBYTE
(
color
.
Get_B
());
}
}
;
}
void
WriteThemeColor
(
BYTE
type
,
const
nullable
<
SimpleTypes
::
CHexColor
<>>&
oHexColor
,
const
nullable
<
SimpleTypes
::
CThemeColor
<>>&
oThemeColor
,
const
nullable
<
SimpleTypes
::
CUcharHexNumber
<>>&
oThemeTint
,
const
nullable
<
SimpleTypes
::
CUcharHexNumber
<>>&
oThemeShade
)
{
...
...
@@ -296,7 +296,7 @@ namespace BinDocxRW
}
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteShd
(
const
ComplexTypes
::
Word
::
CShading
&
Shd
)
{
//Type
...
...
@@ -314,7 +314,7 @@ namespace BinDocxRW
if
(
false
!=
Shd
.
m_oFill
.
IsInit
())
WriteColor
(
c_oSerShdType
::
Color
,
Shd
.
m_oFill
.
get
());
WriteThemeColor
(
c_oSerShdType
::
ColorTheme
,
Shd
.
m_oFill
,
Shd
.
m_oThemeFill
,
Shd
.
m_oThemeFillTint
,
Shd
.
m_oThemeFillShade
);
}
;
}
void
WriteDistance
(
const
NSCommon
::
nullable
<
SimpleTypes
::
CWrapDistance
<>>&
m_oDistL
,
const
NSCommon
::
nullable
<
SimpleTypes
::
CWrapDistance
<>>&
m_oDistT
,
const
NSCommon
::
nullable
<
SimpleTypes
::
CWrapDistance
<>>&
m_oDistR
,
...
...
@@ -348,7 +348,7 @@ namespace BinDocxRW
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Double
);
m_oStream
.
WriteDouble
(
m_oDistB
.
get
().
ToMM
());
}
}
;
}
void
WritePaddings
(
const
nullable
<
SimpleTypes
::
CTwipsMeasure
>&
left
,
const
nullable
<
SimpleTypes
::
CTwipsMeasure
>&
top
,
const
nullable
<
SimpleTypes
::
CTwipsMeasure
>&
right
,
const
nullable
<
SimpleTypes
::
CTwipsMeasure
>&
bottom
)
{
...
...
@@ -380,7 +380,7 @@ namespace BinDocxRW
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Double
);
m_oStream
.
WriteDouble
(
bottom
.
get
().
ToMm
());
}
}
;
}
void
WriteFont
(
CString
&
sFontName
,
BYTE
bType
,
DocWrapper
::
FontProcessor
&
m_oFontProcessor
)
{
if
(
!
sFontName
.
IsEmpty
())
...
...
@@ -394,7 +394,7 @@ namespace BinDocxRW
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Variable
);
m_oStream
.
WriteStringW
(
sFontName
);
}
}
;
}
void
WriteBytesArray
(
BYTE
*
pData
,
long
nDataSize
)
{
int
nCurPos
=
WriteItemWithLengthStart
();
...
...
@@ -820,7 +820,7 @@ namespace BinDocxRW
Write_rPrChange
(
rPr
.
m_oRPrChange
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
Write_rPrChange
(
const
OOX
::
Logic
::
CRPrChange
&
rPrChange
)
{
int
nCurPos
=
0
;
...
...
@@ -1006,7 +1006,7 @@ namespace BinDocxRW
WriteSectPr
(
pPr
.
m_oSectPr
.
GetPointer
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos2
);
}
}
;
}
void
WritePPrChange
(
const
OOX
::
Logic
::
CPPrChange
&
pPrChange
)
{
int
nCurPos
=
0
;
...
...
@@ -1017,7 +1017,7 @@ namespace BinDocxRW
Write_pPr
(
pPrChange
.
m_pParPr
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteInd
(
const
ComplexTypes
::
Word
::
CInd
&
Ind
)
{
//Left
...
...
@@ -1047,7 +1047,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Double
);
m_oBcw
.
m_oStream
.
WriteDouble
(
-
1
*
Ind
.
m_oHanging
.
get
().
ToMm
());
}
}
;
}
void
WriteSpacing
(
const
ComplexTypes
::
Word
::
CSpacing
&
Spacing
)
{
//LineRule
...
...
@@ -1076,7 +1076,6 @@ namespace BinDocxRW
{
m_oBcw
.
m_oStream
.
WriteDouble
(
dLineMm
);
}
//Write LineRule
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerProp_pPrType
::
Spacing_LineRule
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Byte
);
...
...
@@ -1113,7 +1112,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Double
);
m_oBcw
.
m_oStream
.
WriteDouble
(
Spacing
.
m_oAfter
.
get
().
ToMm
());
}
}
;
}
void
WriteTabs
(
const
OOX
::
Logic
::
CTabs
&
Tab
,
const
nullable
<
ComplexTypes
::
Word
::
CInd
>&
oInd
)
{
int
nCurPos
=
0
;
...
...
@@ -1127,7 +1126,7 @@ namespace BinDocxRW
WriteTabItem
(
tabItem
,
oInd
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteTabItem
(
const
ComplexTypes
::
Word
::
CTabStop
&
TabItem
,
const
nullable
<
ComplexTypes
::
Word
::
CInd
>&
oInd
)
{
//type
...
...
@@ -1159,7 +1158,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Double
);
m_oBcw
.
m_oStream
.
WriteDouble
(
TabItem
.
m_oPos
.
get
().
ToMm
());
}
}
;
}
void
WriteNumPr
(
const
OOX
::
Logic
::
CNumPr
&
numPr
,
const
OOX
::
Logic
::
CParagraphProperty
&
pPr
)
{
int
nCurPos
=
0
;
...
...
@@ -1193,7 +1192,7 @@ namespace BinDocxRW
m_oBcw
.
WriteTrackRevision
(
numPr
.
m_oIns
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteFramePr
(
const
ComplexTypes
::
Word
::
CFramePr
&
oFramePr
)
{
if
(
oFramePr
.
m_oDropCap
.
IsInit
())
...
...
@@ -1281,8 +1280,10 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
((
BYTE
)
oFramePr
.
m_oYAlign
->
GetValue
());
}
}
void
WriteSectPr
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
)
void
WriteSectPr
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
)
{
if
(
pSectPr
==
NULL
)
return
;
int
nCurPos
=
0
;
//pgSz
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerProp_secPrType
::
pgSz
);
...
...
@@ -1348,7 +1349,7 @@ namespace BinDocxRW
NULL
,
&
pSectPr
->
m_oEndnotePr
->
m_oPos
,
NULL
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
;
}
void
WritePageSettings
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
)
{
bool
titlePg
=
false
;
...
...
@@ -1372,7 +1373,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Byte
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
pSectPr
->
m_oType
->
m_oVal
->
GetValue
());
}
}
;
}
void
WritePageSize
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
)
{
double
W
=
Page_Width
;
...
...
@@ -1406,7 +1407,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSer_pgSzType
::
Orientation
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Byte
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
Orientation
);
}
;
}
void
WritePageMargin
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
)
{
double
H
=
Page_Height
;
...
...
@@ -1416,6 +1417,7 @@ namespace BinDocxRW
double
B
=
Y_Bottom_Margin
;
double
Header
=
Y_Default_Header
;
double
Footer
=
Y_Default_Footer
;
if
(
NULL
!=
pSectPr
&&
pSectPr
->
m_oPgSz
.
IsInit
()
&&
pSectPr
->
m_oPgMar
.
IsInit
())
{
const
ComplexTypes
::
Word
::
CPageSz
&
pSz
=
pSectPr
->
m_oPgSz
.
get
();
...
...
@@ -1460,7 +1462,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSer_pgMarType
::
Footer
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Double
);
m_oBcw
.
m_oStream
.
WriteDouble
(
Footer
);
}
;
}
void
WriteHeaderFooter
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
,
std
::
vector
<
ComplexTypes
::
Word
::
CHdrFtrRef
*>&
aRefs
,
bool
bHdr
)
{
int
nCurPos
=
0
;
...
...
@@ -1613,7 +1615,7 @@ namespace BinDocxRW
WritePageBorder
(
PageBorders
.
m_oTop
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WritePageBorder
(
const
ComplexTypes
::
Word
::
CPageBorder
&
pageBorder
)
{
int
nCurPos
=
0
;
...
...
@@ -1653,7 +1655,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBOOL
(
pageBorder
.
m_oShadow
->
ToBool
());
}
//todo id
}
;
}
void
WriteNotePr
(
const
nullable
<
ComplexTypes
::
Word
::
CNumFmt
>&
numFmt
,
const
nullable
<
ComplexTypes
::
Word
::
CNumRestart
>&
numRestart
,
const
nullable
<
ComplexTypes
::
Word
::
CDecimalNumber
>&
numStart
,
nullable
<
ComplexTypes
::
Word
::
CFtnPos
>*
ftnPos
,
nullable
<
ComplexTypes
::
Word
::
CEdnPos
>*
endPos
,
std
::
vector
<
OOX
::
CFtnEdnSepRef
*>*
refs
)
...
...
@@ -1842,7 +1844,7 @@ namespace BinDocxRW
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
}
;
}
void
WriteTblMar
(
const
OOX
::
Logic
::
CTblCellMar
&
cellMar
)
{
int
nCurPos
=
0
;
...
...
@@ -1858,7 +1860,7 @@ namespace BinDocxRW
//Bottom
if
(
cellMar
.
m_oBottom
.
IsInit
())
WriteW
(
c_oSerMarginsType
::
bottom
,
cellMar
.
m_oBottom
.
get
());
}
;
}
void
WriteCellMar
(
const
OOX
::
Logic
::
CTcMar
&
cellMar
)
{
int
nCurPos
=
0
;
...
...
@@ -1874,7 +1876,7 @@ namespace BinDocxRW
//Bottom
if
(
cellMar
.
m_oBottom
.
IsInit
())
WriteW
(
c_oSerMarginsType
::
bottom
,
cellMar
.
m_oBottom
.
get
());
}
;
}
void
Write_tblpPr
(
const
ComplexTypes
::
Word
::
CTblPPr
&
pr
)
{
int
nCurPos
=
0
;
...
...
@@ -1922,7 +1924,7 @@ namespace BinDocxRW
m_oBcw
.
WritePaddings
(
pr
.
m_oLeftFromText
,
pr
.
m_oTopFromText
,
pr
.
m_oRightFromText
,
pr
.
m_oBottomFromText
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteRowPr
(
const
OOX
::
Logic
::
CTableRowProperties
&
rowPr
)
{
int
nCurPos
=
0
;
...
...
@@ -2021,7 +2023,7 @@ namespace BinDocxRW
WriteTrPrChange
(
rowPr
.
m_oTrPrChange
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteAfter
(
const
nullable
<
ComplexTypes
::
Word
::
CDecimalNumber
>&
GridAfter
,
const
nullable
<
ComplexTypes
::
Word
::
CTblWidth
>&
WAfter
)
{
int
nCurPos
=
0
;
...
...
@@ -2053,7 +2055,7 @@ namespace BinDocxRW
{
WriteW
(
c_oSerProp_rowPrType
::
WBefore
,
WBefore
.
get
(),
true
);
}
}
;
}
void
WriteRowHeight
(
const
ComplexTypes
::
Word
::
CHeight
&
rowHeight
)
{
if
(
rowHeight
.
m_oVal
.
IsInit
())
...
...
@@ -2078,7 +2080,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Double
);
m_oBcw
.
m_oStream
.
WriteDouble
(
rowHeight
.
m_oVal
->
ToMm
());
}
}
;
}
void
WriteW
(
int
nType
,
const
ComplexTypes
::
Word
::
CTblWidth
&
tableW
,
bool
bWrite2
=
false
)
{
int
nCurPos
=
0
;
...
...
@@ -2129,7 +2131,7 @@ namespace BinDocxRW
else
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteCellPr
(
const
OOX
::
Logic
::
CTableCellProperties
&
cellPr
)
{
int
nCurPos
=
0
;
...
...
@@ -2261,7 +2263,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Byte
);
m_oBcw
.
m_oStream
.
WriteBOOL
(
cellPr
.
m_oTcFitText
->
m_oVal
.
ToBool
());
}
}
;
}
void
WriteCellMerge
(
const
ComplexTypes
::
Word
::
CCellMergeTrackChange
&
cellMerge
)
{
int
nCurPos
=
0
;
...
...
@@ -2325,13 +2327,13 @@ namespace BinDocxRW
m_oBcw
(
oParamsWriter
),
bpPrs
(
oParamsWriter
,
NULL
),
brPrs
(
oParamsWriter
),
btblPrs
(
oParamsWriter
)
{
m_nReaderGenName
=
0
;
}
;
}
void
Write
(
OOX
::
CStyles
&
styles
)
{
int
nStart
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteStylesContent
(
styles
);
m_oBcw
.
WriteItemWithLengthEnd
(
nStart
);
}
;
}
void
WriteStylesContent
(
OOX
::
CStyles
&
styles
)
{
int
nCurPos
;
...
...
@@ -2380,7 +2382,7 @@ namespace BinDocxRW
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSer_st
::
Styles
);
WriteStyles
(
styles
.
m_arrStyle
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
;
}
void
WriteStyles
(
std
::
vector
<
OOX
::
CStyle
*>&
styles
)
{
int
nCurPos
=
0
;
...
...
@@ -2394,7 +2396,7 @@ namespace BinDocxRW
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
}
;
}
void
WriteStyle
(
const
OOX
::
CStyle
&
style
)
{
int
nCurPos
=
0
;
...
...
@@ -2523,7 +2525,7 @@ namespace BinDocxRW
WriteTblStylePr
(
style
.
m_arrTblStylePr
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
;
}
void
WriteTblStylePr
(
const
std
::
vector
<
OOX
::
Logic
::
CTableStyleProperties
*>&
aProperties
)
{
int
nCurPos
=
0
;
...
...
@@ -2591,13 +2593,13 @@ namespace BinDocxRW
BinaryNumberingTableWriter
(
ParamsWriter
&
oParamsWriter
)
:
m_oBcw
(
oParamsWriter
),
bpPrs
(
oParamsWriter
,
NULL
),
brPrs
(
oParamsWriter
)
{
}
;
}
void
Write
(
const
OOX
::
CNumbering
&
numbering
)
{
int
nStart
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteNumberingContent
(
numbering
);
m_oBcw
.
WriteItemWithLengthEnd
(
nStart
);
}
;
}
void
WriteNumberingContent
(
const
OOX
::
CNumbering
&
numbering
)
{
int
nCurPos
=
0
;
...
...
@@ -2610,7 +2612,7 @@ namespace BinDocxRW
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerNumTypes
::
Nums
);
WriteNums
(
numbering
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
;
}
void
WriteNums
(
const
OOX
::
CNumbering
&
numbering
)
{
int
nCurPos
=
0
;
...
...
@@ -2625,7 +2627,7 @@ namespace BinDocxRW
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
}
;
}
void
WriteNum
(
const
OOX
::
Numbering
::
CNum
&
num
)
{
int
nCurPos
=
0
;
...
...
@@ -2638,7 +2640,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerNumTypes
::
Num_NumId
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Long
);
m_oBcw
.
m_oStream
.
WriteLONG
(
nNumId
);
}
;
}
void
WriteAbstractNums
(
const
OOX
::
CNumbering
&
numbering
)
{
int
nCurPos
=
0
;
...
...
@@ -2654,7 +2656,7 @@ namespace BinDocxRW
nRealCount
++
;
}
}
}
;
}
void
WriteAbstractNum
(
const
OOX
::
Numbering
::
CAbstractNum
&
num
,
int
nIndex
,
const
std
::
vector
<
OOX
::
Numbering
::
CNum
*>&
aNums
)
{
int
nCurPos
=
0
;
...
...
@@ -2693,7 +2695,7 @@ namespace BinDocxRW
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerNumTypes
::
AbstractNum_Lvls
);
WriteLevels
(
num
.
m_arrLvl
,
num
.
m_oAbstractNumId
.
get
().
GetValue
(),
aNums
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
;
}
void
WriteLevels
(
const
std
::
vector
<
OOX
::
Numbering
::
CLvl
*>&
lvls
,
int
nAId
,
const
std
::
vector
<
OOX
::
Numbering
::
CNum
*>&
aNums
)
{
int
nCurPos
=
0
;
...
...
@@ -2703,7 +2705,7 @@ namespace BinDocxRW
WriteLevel
(
*
lvls
[
i
],
i
,
nAId
,
aNums
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
;
}
void
WriteLevel
(
const
OOX
::
Numbering
::
CLvl
&
lvl
,
int
index
,
int
nAId
,
const
std
::
vector
<
OOX
::
Numbering
::
CNum
*>&
aNums
)
{
int
nCurPos
=
0
;
...
...
@@ -2837,7 +2839,7 @@ namespace BinDocxRW
brPrs
.
Write_rPr
(
*
p_rPr
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteLevelText
(
const
CString
&
text
)
{
int
nCurPos
=
0
;
...
...
@@ -2872,7 +2874,7 @@ namespace BinDocxRW
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
}
;
}
};
class
BinaryOtherTableWriter
{
...
...
@@ -2902,7 +2904,7 @@ namespace BinDocxRW
public:
BinaryOtherTableWriter
(
ParamsWriter
&
oParamsWriter
,
BYTE
*
pThemeData
,
long
nThemeDataSize
)
:
m_oParamsWriter
(
oParamsWriter
),
m_oBcw
(
oParamsWriter
),
m_pThemeData
(
pThemeData
),
m_nThemeDataSize
(
nThemeDataSize
)
{
}
;
}
void
Write
()
{
int
nStart
=
m_oBcw
.
WriteItemWithLengthStart
();
...
...
@@ -2928,7 +2930,7 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerOtherTableTypes
::
DocxTheme
);
m_oBcw
.
WriteBytesArray
(
m_pThemeData
,
m_nThemeDataSize
);
}
}
;
}
//void WriteImageMapContent()
//{
// CAtlArray<CString> aMediaArr;
...
...
@@ -2947,7 +2949,7 @@ namespace BinDocxRW
// m_oBcw.m_oStream.WriteBYTE(c_oSerOtherTableTypes::ImageMap_Src);
// m_oBcw.m_oStream.WriteStringW(sMedia);
// }
//}
;
//}
};
class
BinaryDocumentTableWriter
{
...
...
@@ -2969,15 +2971,18 @@ namespace BinDocxRW
public:
Binary_tblPrWriter
btblPrs
;
OOX
::
Logic
::
CSectionProperty
*
pSectPr
;
bool
m_bWriteSectPr
;
//Записывать ли свойства секции в данном экземпляре BinaryOtherTableWriter
public:
OOX
::
Logic
::
CBackground
*
pBackground
;
bool
m_bWriteSectPr
;
//Записывать ли свойства верхнего уровня в данном экземпляре BinaryOtherTableWriter
//---------------------------------
BinaryDocumentTableWriter
(
ParamsWriter
&
oParamsWriter
,
ParamsDocumentWriter
&
oParamsDocumentWriter
,
std
::
map
<
int
,
bool
>*
mapIgnoreComments
,
BinaryHeaderFooterTableWriter
*
oBinaryHeaderFooterTableWriter
)
:
m_oParamsWriter
(
oParamsWriter
),
m_oParamsDocumentWriter
(
oParamsDocumentWriter
),
m_oBcw
(
oParamsWriter
),
bpPrs
(
oParamsWriter
,
oBinaryHeaderFooterTableWriter
),
brPrs
(
oParamsWriter
),
btblPrs
(
oParamsWriter
),
m_oSettings
(
oParamsWriter
.
m_oSettings
),
m_pOfficeDrawingConverter
(
oParamsWriter
.
m_pOfficeDrawingConverter
),
m_mapIgnoreComments
(
mapIgnoreComments
)
{
pBackground
=
NULL
;
pSectPr
=
NULL
;
m_bWriteSectPr
=
false
;
m_eFldState
=
SimpleTypes
::
fldchartypeEnd
;
}
;
}
~
BinaryDocumentTableWriter
()
{
for
(
int
i
=
0
,
length
=
m_aFldChars
.
size
();
i
<
length
;
++
i
)
...
...
@@ -2999,67 +3004,107 @@ namespace BinDocxRW
int
nStart
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteDocumentContent
(
aElems
);
m_oBcw
.
WriteItemWithLengthEnd
(
nStart
);
}
;
}
void
WriteDocumentContent
(
const
std
::
vector
<
OOX
::
WritingElement
*>&
aElems
)
{
int
nCurPos
=
0
;
for
(
size_t
i
=
0
,
length
=
aElems
.
size
();
i
<
length
;
++
i
)
{
OOX
::
WritingElement
*
item
=
aElems
[
i
];
if
(
OOX
::
et_w_p
==
item
->
getType
())
switch
(
item
->
getType
())
{
OOX
::
Logic
::
CParagraph
*
pParagraph
=
static_cast
<
OOX
::
Logic
::
CParagraph
*>
(
item
);
//Ищем pPr
OOX
::
Logic
::
CParagraphProperty
*
pPr
=
NULL
;
for
(
int
i
=
0
,
length
=
pParagraph
->
m_arrItems
.
size
();
i
<
length
;
++
i
)
case
OOX
:
:
et_w_p
:
{
OOX
::
WritingElement
*
pElem
=
pParagraph
->
m_arrItems
[
i
];
if
(
OOX
::
et_w_pPr
==
pElem
->
getType
())
pPr
=
static_cast
<
OOX
::
Logic
::
CParagraphProperty
*>
(
pElem
);
}
OOX
::
Logic
::
CParagraph
*
pParagraph
=
static_cast
<
OOX
::
Logic
::
CParagraph
*>
(
item
);
OOX
::
Logic
::
CParagraphProperty
*
pPr
=
pParagraph
->
m_oParagraphProperty
;
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerParType
::
Par
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteParapraph
(
*
pParagraph
,
pPr
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
else
if
(
OOX
::
et_w_tbl
==
item
->
getType
())
}
break
;
case
OOX
:
:
et_w_tbl
:
{
OOX
::
Logic
::
CTbl
*
pTbl
=
static_cast
<
OOX
::
Logic
::
CTbl
*>
(
item
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerParType
::
Table
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteDocTable
(
*
pTbl
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
else
if
(
OOX
::
et_w_sdt
==
item
->
getType
())
}
break
;
case
OOX
:
:
et_w_sdt
:
{
OOX
::
Logic
::
CSdt
*
pStd
=
static_cast
<
OOX
::
Logic
::
CSdt
*>
(
item
);
if
(
pStd
->
m_oSdtContent
.
IsInit
())
WriteDocumentContent
(
pStd
->
m_oSdtContent
.
get
().
m_arrItems
);
}
else
if
(
OOX
::
et_w_smartTag
==
item
->
getType
())
}
break
;
case
OOX
:
:
et_w_smartTag
:
{
OOX
::
Logic
::
CSmartTag
*
pSmartTag
=
static_cast
<
OOX
::
Logic
::
CSmartTag
*>
(
item
);
WriteDocumentContent
(
pSmartTag
->
m_arrItems
);
}
else
if
(
OOX
::
et_w_dir
==
item
->
getType
())
}
break
;
case
OOX
:
:
et_w_dir
:
{
OOX
::
Logic
::
CDir
*
pDir
=
static_cast
<
OOX
::
Logic
::
CDir
*>
(
item
);
WriteDocumentContent
(
pDir
->
m_arrItems
);
}
else
if
(
OOX
::
et_w_bdo
==
item
->
getType
())
}
break
;
case
OOX
:
:
et_w_bdo
:
{
OOX
::
Logic
::
CBdo
*
pBdo
=
static_cast
<
OOX
::
Logic
::
CBdo
*>
(
item
);
WriteDocumentContent
(
pBdo
->
m_arrItems
);
}
break
;
}
}
//SectPr
if
(
true
==
m_bWriteSectPr
&&
NULL
!=
pSectPr
)
//SectPr & Background
if
(
true
==
m_bWriteSectPr
&&
(
NULL
!=
pSectPr
||
NULL
!=
pBackground
))
{
if
(
NULL
!=
pSectPr
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
sectPr
);
bpPrs
.
WriteSectPr
(
pSectPr
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
};
if
(
NULL
!=
pBackground
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
Background
);
WriteBackground
(
pBackground
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
}
void
WriteBackground
(
OOX
::
Logic
::
CBackground
*
pBackground
)
{
if
(
pBackground
==
NULL
)
return
;
CString
sXml
;
if
(
pBackground
->
m_oDrawing
.
IsInit
())
{
sXml
=
pBackground
->
m_oDrawing
->
m_sXml
.
get2
();
}
else
if
(
pBackground
->
m_oBackground
.
IsInit
())
{
sXml
=
pBackground
->
m_oBackground
->
toXML
();
}
if
(
!
sXml
.
IsEmpty
())
{
int
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerBackgroundType
::
pptxDrawing
);
WriteDrawing
(
&
sXml
,
NULL
,
NULL
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
else
{
if
(
pBackground
->
m_oColor
.
IsInit
())
{
m_oBcw
.
WriteColor
(
c_oSerBackgroundType
::
Color
,
pBackground
->
m_oColor
.
get
());
}
else
if
(
pBackground
->
m_oThemeColor
.
IsInit
())
{
m_oBcw
.
WriteThemeColor
(
c_oSerBackgroundType
::
ColorTheme
,
pBackground
->
m_oColor
,
pBackground
->
m_oThemeColor
,
pBackground
->
m_oThemeTint
,
pBackground
->
m_oThemeShade
);
}
}
}
void
WriteParapraph
(
OOX
::
Logic
::
CParagraph
&
par
,
OOX
::
Logic
::
CParagraphProperty
*
pPr
)
{
int
nCurPos
=
0
;
...
...
@@ -3078,7 +3123,7 @@ namespace BinDocxRW
WriteParagraphContent
(
par
.
m_arrItems
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
;
}
FldStruct
*
ParseField
(
const
CString
&
sFld
)
{
CString
sFldCopy
=
sFld
;
...
...
@@ -3120,7 +3165,7 @@ namespace BinDocxRW
{
OOX
::
Logic
::
CRun
*
pRun
=
static_cast
<
OOX
::
Logic
::
CRun
*>
(
item
);
bool
bMathRun
=
false
;
WriteRun
(
pRun
->
m_arrItems
,
bHyperlink
,
bMathRun
);
WriteRun
(
pRun
,
bHyperlink
,
bMathRun
);
break
;
}
case
OOX
:
:
et_w_sdt
:
...
...
@@ -3194,7 +3239,7 @@ namespace BinDocxRW
}
}
}
}
;
}
void
WriteDel
(
const
OOX
::
Logic
::
CDel
&
oDel
)
{
int
nCurPos
=
0
;
...
...
@@ -3220,8 +3265,8 @@ namespace BinDocxRW
{
switch
(
eType
)
{
case
OOX
:
:
et_w_commentRangeStart
:
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
CommentStart
);
break
;
case
OOX
:
:
et_w_commentRangeEnd
:
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
CommentEnd
);
break
;
case
OOX
:
:
et_w_commentRangeStart
:
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
CommentStart
);
break
;
case
OOX
:
:
et_w_commentRangeEnd
:
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
CommentEnd
);
break
;
case
OOX
:
:
et_w_commentReference
:
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerRunType
::
CommentReference
);
break
;
}
...
...
@@ -3332,46 +3377,35 @@ namespace BinDocxRW
WriteParagraphContent
(
pHyperlink
->
m_arrItems
,
true
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
OOX
::
Logic
::
CRunProperty
*
getRunStyle
(
std
::
vector
<
OOX
::
WritingElement
*>&
m_arrItems
)
{
OOX
::
Logic
::
CRunProperty
*
oCur_rPr
=
NULL
;
for
(
int
i
=
0
,
length
=
m_arrItems
.
size
();
i
<
length
;
++
i
)
{
OOX
::
WritingElement
*
item
=
m_arrItems
[
i
];
if
(
OOX
::
et_w_rPr
==
item
->
getType
())
{
oCur_rPr
=
static_cast
<
OOX
::
Logic
::
CRunProperty
*>
(
item
);
break
;
}
}
return
oCur_rPr
;
}
void
WriteRun
(
std
::
vector
<
OOX
::
WritingElement
*>&
m_arrItems
,
bool
bHyperlink
=
false
,
bool
bMathRun
=
false
)
void
WriteRun
(
OOX
::
Logic
::
CRun
*
pRun
,
bool
bHyperlink
=
false
,
bool
bMathRun
=
false
)
{
int
nCurPos
=
0
;
int
nIndexStart
=
0
;
int
nLength
=
m_arrItems
.
size
();
int
nLength
=
pRun
->
m_arrItems
.
size
();
bool
bWasText
=
false
;
int
nRecordType
;
int
nRecordType
=
0
;
if
(
bMathRun
)
nRecordType
=
c_oSer_OMathContentType
::
Run
;
else
nRecordType
=
c_oSerParType
::
Run
;
//Разбиваем массив по знаку et_w_sym
for
(
int
i
=
0
;
i
<
nLength
;
++
i
)
{
OOX
::
WritingElement
*
item
=
m_arrItems
[
i
];
OOX
::
WritingElement
*
item
=
pRun
->
m_arrItems
[
i
];
if
(
OOX
::
et_w_sym
==
item
->
getType
())
{
if
(
bWasText
)
{
bWasText
=
false
;
nCurPos
=
m_oBcw
.
WriteItemStart
(
nRecordType
);
WritePreparedRun
(
m_arrItems
,
bHyperlink
,
nIndexStart
,
i
);
WritePreparedRun
(
pRun
,
bHyperlink
,
nIndexStart
,
i
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
nCurPos
=
m_oBcw
.
WriteItemStart
(
nRecordType
);
WritePreparedRun
(
m_arrItems
,
bHyperlink
,
i
,
i
+
1
);
WritePreparedRun
(
pRun
,
bHyperlink
,
i
,
i
+
1
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
nIndexStart
=
i
+
1
;
}
...
...
@@ -3381,7 +3415,7 @@ namespace BinDocxRW
if
(
nIndexStart
<
nLength
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
nRecordType
);
WritePreparedRun
(
m_arrItems
,
bHyperlink
,
nIndexStart
,
nLength
);
WritePreparedRun
(
pRun
,
bHyperlink
,
nIndexStart
,
nLength
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
...
...
@@ -3589,6 +3623,7 @@ namespace BinDocxRW
case
OOX
:
:
et_m_oMath
:
{
OOX
::
Logic
::
COMath
*
pOMath
=
static_cast
<
OOX
::
Logic
::
COMath
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSer_OMathContentType
::
OMath
);
WriteMathArgNodes
(
pOMath
->
m_arrItems
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
...
...
@@ -4599,7 +4634,7 @@ namespace BinDocxRW
bool
bHyperlink
=
false
;
bool
bMathRun
=
true
;
OOX
::
Logic
::
CRun
*
pRun
=
static_cast
<
OOX
::
Logic
::
CRun
*>
(
item
);
WriteRun
(
pRun
->
m_arrItems
,
bHyperlink
,
bMathRun
);
WriteRun
(
pRun
,
bHyperlink
,
bMathRun
);
}
}
}
...
...
@@ -4987,11 +5022,13 @@ namespace BinDocxRW
}
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
void
WritePreparedRun
(
std
::
vector
<
OOX
::
WritingElement
*>&
m_arrItems
,
bool
bHyperlink
,
int
nIndexStart
,
int
nIndexStop
)
void
WritePreparedRun
(
OOX
::
Logic
::
CRun
*
pRun
,
bool
bHyperlink
,
int
nIndexStart
,
int
nIndexStop
)
{
if
(
!
pRun
)
return
;
int
nCurPos
=
0
;
//Ищем rPr
OOX
::
Logic
::
CRunProperty
*
oCur_rPr
=
getRunStyle
(
m_arrItems
);
OOX
::
Logic
::
CRunProperty
*
oCur_rPr
=
pRun
->
m_oRunProperty
;
if
(
NULL
!=
oCur_rPr
)
{
//Заглушка для содержания
...
...
@@ -5036,14 +5073,15 @@ namespace BinDocxRW
}
}
//Если первый элемент символ надо выставить в его настройки шрифт
if
(
nIndexStart
<
m_arrItems
.
size
()
&&
OOX
::
et_w_sym
==
m_arrItems
[
nIndexStart
]
->
getType
())
if
(
nIndexStart
<
pRun
->
m_arrItems
.
size
()
&&
OOX
::
et_w_sym
==
pRun
->
m_arrItems
[
nIndexStart
]
->
getType
())
{
OOX
::
Logic
::
CSym
*
oSym
=
static_cast
<
OOX
::
Logic
::
CSym
*>
(
m_arrItems
[
nIndexStart
]);
OOX
::
Logic
::
CSym
*
oSym
=
static_cast
<
OOX
::
Logic
::
CSym
*>
(
pRun
->
m_arrItems
[
nIndexStart
]);
if
(
oSym
->
m_oFont
.
IsInit
())
{
const
CString
&
sFont
=
oSym
->
m_oFont
.
get
();
if
(
NULL
==
oCur_rPr
)
oCur_rPr
=
new
OOX
::
Logic
::
CRunProperty
();
oCur_rPr
->
m_oRFonts
.
Init
();
oCur_rPr
->
m_oRFonts
->
m_sAscii
.
Init
();
oCur_rPr
->
m_oRFonts
->
m_sAscii
->
Append
(
sFont
);
...
...
@@ -5065,7 +5103,7 @@ namespace BinDocxRW
//Content пишется начиная от индекса nIndexStart и заканчивая предшествующим элементом для nIndexStop
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerRunType
::
Content
);
WriteRunContent
(
m_arrItems
,
nIndexStart
,
nIndexStop
,
bHyperlink
);
WriteRunContent
(
pRun
->
m_arrItems
,
nIndexStart
,
nIndexStop
,
bHyperlink
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
void
WriteRunContent
(
std
::
vector
<
OOX
::
WritingElement
*>&
m_arrItems
,
int
nIndexStart
,
int
nIndexStop
,
bool
bHyperlink
=
false
)
...
...
@@ -5081,9 +5119,9 @@ namespace BinDocxRW
int
nBreakType
=
-
1
;
switch
(
pBr
->
m_oType
.
GetValue
())
{
case
SimpleTypes
:
:
brtypeColumn
:
nBreakType
=
c_oSerRunType
::
columnbreak
;
break
;
case
SimpleTypes
:
:
brtypePage
:
nBreakType
=
c_oSerRunType
::
pagebreak
;
break
;
case
SimpleTypes
:
:
brtypeTextWrapping
:
nBreakType
=
c_oSerRunType
::
linebreak
;
break
;
case
SimpleTypes
:
:
brtypeColumn
:
nBreakType
=
c_oSerRunType
::
columnbreak
;
break
;
case
SimpleTypes
:
:
brtypePage
:
nBreakType
=
c_oSerRunType
::
pagebreak
;
break
;
case
SimpleTypes
:
:
brtypeTextWrapping
:
nBreakType
=
c_oSerRunType
::
linebreak
;
break
;
}
if
(
-
1
!=
nBreakType
)
{
...
...
@@ -5337,20 +5375,21 @@ namespace BinDocxRW
m_oBcw
.
m_oStream
.
WriteStringW
(
text
);
if
(
NULL
!=
m_oBcw
.
m_pEmbeddedFontsManager
)
m_oBcw
.
m_pEmbeddedFontsManager
->
CheckString
(
text
);
}
;
}
void
WriteText
(
const
CString
&
text
)
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerRunType
::
run
);
m_oBcw
.
m_oStream
.
WriteStringW
(
text
);
if
(
NULL
!=
m_oBcw
.
m_pEmbeddedFontsManager
)
m_oBcw
.
m_pEmbeddedFontsManager
->
CheckString
(
text
);
}
;
}
void
WriteDrawingPptx
(
OOX
::
WritingElement
*
item
)
{
OOX
::
EElementType
pElementType
=
item
->
getType
();
CString
*
pXml
=
NULL
;
OOX
::
Logic
::
CDrawing
*
pChartDrawing
=
NULL
;
OOX
::
Drawing
::
CGraphic
*
pGraphic
=
NULL
;
if
(
OOX
::
et_mc_alternateContent
==
pElementType
)
{
OOX
::
Logic
::
CAlternateContent
*
pAlternateContent
=
static_cast
<
OOX
::
Logic
::
CAlternateContent
*>
(
item
);
...
...
@@ -5699,7 +5738,7 @@ namespace BinDocxRW
}
if
(
bDeleteDrawing
)
RELEASEOBJECT
(
pDrawing
);
}
;
}
void
WriteNvGraphicFramePr
(
const
OOX
::
Drawing
::
CNonVisualGraphicFrameProperties
&
oGraphicFramePr
)
{
if
(
oGraphicFramePr
.
m_oGraphicFrameLocks
.
IsInit
())
...
...
@@ -5902,6 +5941,7 @@ namespace BinDocxRW
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerWrapSquare
::
EffectExtent
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Variable
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteEffectExtent
(
oWrapSquare
.
m_oEffectExtent
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
...
...
@@ -5932,6 +5972,7 @@ namespace BinDocxRW
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerWrapThroughTight
::
WrapPolygon
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Variable
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteWrapPolygon
(
oWrapThrough
.
m_oWrapPolygon
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
...
...
@@ -5962,6 +6003,7 @@ namespace BinDocxRW
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerWrapThroughTight
::
WrapPolygon
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Variable
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteWrapPolygon
(
oWrapTight
.
m_oWrapPolygon
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
...
...
@@ -5986,6 +6028,7 @@ namespace BinDocxRW
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerWrapTopBottom
::
EffectExtent
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Variable
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteEffectExtent
(
oWrapTopBottom
.
m_oEffectExtent
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
...
...
@@ -6004,6 +6047,7 @@ namespace BinDocxRW
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerWrapPolygon
::
Start
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Variable
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WritePoint2D
(
oWrapPath
.
m_oStart
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
...
...
@@ -6012,6 +6056,7 @@ namespace BinDocxRW
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerWrapPolygon
::
ALineTo
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Variable
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteLineTo
(
oWrapPath
.
m_arrLineTo
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
...
...
@@ -6074,7 +6119,7 @@ namespace BinDocxRW
}
RELEASEOBJECT
(
pTblPr
);
}
;
}
bool
ValidateRow
(
const
std
::
vector
<
OOX
::
WritingElement
*>&
arrItems
)
{
//Проверяем чтобы не все ячейки в ряду были вертикально замержены
...
...
@@ -6240,11 +6285,12 @@ namespace BinDocxRW
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerDocTableType
::
tblGridChange
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Variable
);
nCurPos
=
m_oBcw
.
WriteItemWithLengthStart
();
WriteTblGridChange
(
grid
.
m_oTblGridChange
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
;
}
void
WriteTblGridChange
(
const
OOX
::
Logic
::
CTblGridChange
&
tblGridChange
)
{
int
nCurPos
=
0
;
...
...
@@ -6266,6 +6312,7 @@ namespace BinDocxRW
{
int
nCurPos
=
0
;
int
nCurRowIndex
=
0
;
for
(
int
i
=
0
,
length
=
Content
.
size
();
i
<
length
;
++
i
)
{
OOX
::
WritingElement
*
item
=
Content
[
i
];
...
...
@@ -6298,26 +6345,15 @@ namespace BinDocxRW
WriteTableContent
(
pBdo
->
m_arrItems
,
pTblPr
,
nRows
,
nCols
);
}
}
}
;
}
void
WriteRow
(
const
OOX
::
Logic
::
CTr
&
Row
,
OOX
::
Logic
::
CTableProperty
*
pTblPr
,
int
nCurRowIndex
,
int
nRows
,
int
nCols
)
{
int
nCurPos
=
0
;
//Pr
OOX
::
Logic
::
CTableRowProperties
*
pTrPr
=
NULL
;
for
(
int
i
=
0
,
length
=
Row
.
m_arrItems
.
size
();
i
<
length
;
++
i
)
{
OOX
::
WritingElement
*
item
=
Row
.
m_arrItems
[
i
];
if
(
OOX
::
et_w_trPr
==
item
->
getType
())
{
pTrPr
=
new
OOX
::
Logic
::
CTableRowProperties
();
*
pTrPr
=
*
static_cast
<
OOX
::
Logic
::
CTableRowProperties
*>
(
item
);
break
;
}
}
if
(
NULL
!=
pTrPr
)
if
(
NULL
!=
Row
.
m_oTableRowProperties
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
Row_Pr
);
btblPrs
.
WriteRowPr
(
*
pTrPr
);
btblPrs
.
WriteRowPr
(
*
Row
.
m_oTableRowProperties
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
...
...
@@ -6325,23 +6361,24 @@ namespace BinDocxRW
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
Row_Content
);
WriteRowContent
(
Row
.
m_arrItems
,
pTblPr
,
nCurRowIndex
,
nRows
,
nCols
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
RELEASEOBJECT
(
pTrPr
);
};
}
void
WriteRowContent
(
const
std
::
vector
<
OOX
::
WritingElement
*>&
Content
,
OOX
::
Logic
::
CTableProperty
*
pTblPr
,
int
nCurRowIndex
,
int
nRows
,
int
nCols
)
{
int
nCurPos
=
0
;
int
nCurColIndex
=
0
;
for
(
int
i
=
0
,
length
=
Content
.
size
();
i
<
length
;
i
++
)
{
OOX
::
WritingElement
*
item
=
Content
[
i
];
if
(
OOX
::
et_w_tc
==
item
->
getType
())
{
OOX
::
Logic
::
CTc
*
tc
=
static_cast
<
OOX
::
Logic
::
CTc
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
Cell
);
WriteCell
(
*
tc
,
pTblPr
,
nCurRowIndex
,
nCurColIndex
,
nRows
,
nCols
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
nCurColIndex
++
;
}
else
if
(
OOX
::
et_w_sdt
==
item
->
getType
())
...
...
@@ -6366,38 +6403,24 @@ namespace BinDocxRW
WriteRowContent
(
pBdo
->
m_arrItems
,
pTblPr
,
nCurRowIndex
,
nRows
,
nCols
);
}
}
}
;
}
void
WriteCell
(
OOX
::
Logic
::
CTc
&
tc
,
OOX
::
Logic
::
CTableProperty
*
pTblPr
,
int
nCurRowIndex
,
int
nCurColIndex
,
int
nRows
,
int
nCols
)
{
int
nCurPos
=
0
;
//Pr
//Стили ячейки
OOX
::
Logic
::
CTableCellProperties
*
pTcPr
=
NULL
;
for
(
int
i
=
0
,
length
=
tc
.
m_arrItems
.
size
();
i
<
length
;
++
i
)
{
OOX
::
WritingElement
*
item
=
tc
.
m_arrItems
[
i
];
if
(
OOX
::
et_w_tcPr
==
item
->
getType
())
{
pTcPr
=
new
OOX
::
Logic
::
CTableCellProperties
();
*
pTcPr
=
*
static_cast
<
OOX
::
Logic
::
CTableCellProperties
*>
(
item
);
}
}
if
(
NULL
!=
pTcPr
)
//св-ва ячейки
if
(
NULL
!=
tc
.
m_oTableCellProperties
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
Cell_Pr
);
btblPrs
.
WriteCellPr
(
*
pTcPr
);
btblPrs
.
WriteCellPr
(
*
tc
.
m_oTableCellProperties
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
//Content
BinaryDocumentTableWriter
oBinaryDocumentTableWriter
(
m_oParamsWriter
,
m_oParamsDocumentWriter
,
m_mapIgnoreComments
,
bpPrs
.
m_oBinaryHeaderFooterTableWriter
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
Cell_Content
);
oBinaryDocumentTableWriter
.
WriteDocumentContent
(
tc
.
m_arrItems
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
RELEASEOBJECT
(
pTcPr
);
};
}
};
class
BinaryCommentsTableWriter
{
...
...
@@ -7155,8 +7178,12 @@ namespace BinDocxRW
nCurPos
=
this
->
WriteTableStart
(
BinDocxRW
::
c_oSerTableTypes
::
Document
);
BinDocxRW
::
BinaryDocumentTableWriter
oBinaryDocumentTableWriter
(
m_oParamsWriter
,
oParamsDocumentWriter
,
&
m_oParamsWriter
.
m_mapIgnoreComments
,
&
oBinaryHeaderFooterTableWriter
);
oBinaryDocumentTableWriter
.
prepareOfficeDrawingConverter
(
m_oParamsWriter
.
m_pOfficeDrawingConverter
,
oParamsDocumentWriter
.
m_sDocumentPath
,
poDocument
->
m_arrShapeTypes
);
oBinaryDocumentTableWriter
.
pSectPr
=
pFirstSectPr
;
oBinaryDocumentTableWriter
.
pBackground
=
poDocument
->
m_oBackground
.
GetPointer
();
oBinaryDocumentTableWriter
.
m_bWriteSectPr
=
true
;
// Write content
oBinaryDocumentTableWriter
.
Write
(
poDocument
->
m_arrItems
);
this
->
WriteTableEnd
(
nCurPos
);
...
...
ASCOfficeOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
View file @
8cdf4911
...
...
@@ -47,6 +47,12 @@
#include "../source/Oox2OdfConverter/Oox2OdfConverter.h"
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
std
::
wstring
DetectTypeDocument
(
const
std
::
wstring
&
pathOOX
)
{
std
::
wstring
sRes
;
...
...
ASCOfficeOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.vcproj
View file @
8cdf4911
...
...
@@ -373,6 +373,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\..\UnicodeConverter\UnicodeConverter.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
...
...
Common/DocxFormat/Source/DocxFormat/Document.h
View file @
8cdf4911
...
...
@@ -96,6 +96,8 @@ namespace OOX
if
(
_T
(
"w:drawing"
)
==
sName
)
m_oDrawing
=
oReader
;
else
if
(
_T
(
"v:background"
)
==
sName
)
m_oBackground
=
oReader
;
}
}
virtual
CString
toXML
()
const
...
...
@@ -136,6 +138,11 @@ namespace OOX
sResult
+=
m_oDrawing
->
toXML
();
sResult
+=
_T
(
"</w:background>"
);
}
else
if
(
m_oBackground
.
IsInit
())
{
//наличие атрибута Color обязательно
sResult
+=
m_oBackground
->
toXML
();
sResult
+=
_T
(
"</w:background>"
);
}
else
sResult
+=
_T
(
"/>"
);
...
...
@@ -172,6 +179,7 @@ namespace OOX
// Childs
nullable
<
OOX
::
Logic
::
CDrawing
>
m_oDrawing
;
nullable
<
OOX
::
Vml
::
CBackground
>
m_oBackground
;
};
}
}
...
...
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