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
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
609 additions
and
444 deletions
+609
-444
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
Common/DocxFormat/Source/DocxFormat/Logic/SmartTag.h
Common/DocxFormat/Source/DocxFormat/Logic/SmartTag.h
+2
-2
XlsxSerializerCom/Reader/BinaryWriter.h
XlsxSerializerCom/Reader/BinaryWriter.h
+2
-2
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
(
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
(
"<?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>"
)));
oFile
.
WriteStringUTF8
(
CString
(
_T
(
"</w:document>"
)));
oFile
.
CloseFile
();
}
CString
WriteSectPrHdrFtr
()
...
...
ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h
View file @
8cdf4911
...
...
@@ -39,7 +39,8 @@ namespace Writers
class
ContentWriter
{
public:
XmlUtils
::
CStringWriter
m_oContent
;
XmlUtils
::
CStringWriter
m_oBackground
;
XmlUtils
::
CStringWriter
m_oContent
;
XmlUtils
::
CStringWriter
m_oSecPr
;
};
class
HdrFtrItem
...
...
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
View file @
8cdf4911
...
...
@@ -265,19 +265,64 @@ 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:
BYTE
Value
;
docRGB
Color
;
BYTE
Value
;
docRGB
Color
;
CThemeColor
ThemeColor
;
bool
bColor
;
bool
bThemeColor
;
Shd
()
{
Value
=
shd_Nil
;
bColor
=
false
;
Value
=
shd_Nil
;
bColor
=
false
;
bThemeColor
=
false
;
}
CString
ToString
()
...
...
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
8cdf4911
This diff is collapsed.
Click to expand it.
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
{
...
...
@@ -446,20 +447,21 @@ extern int g_nCurFormatVersion;
};}
namespace
c_oSerParType
{
enum
c_oSerParType
{
Par
=
0
,
pPr
=
1
,
Content
=
2
,
Table
=
3
,
sectPr
=
4
,
Run
=
5
,
CommentStart
=
6
,
CommentEnd
=
7
,
OMathPara
=
8
,
OMath
=
9
,
Hyperlink
=
10
,
FldSimple
=
11
,
Del
=
12
,
Ins
=
13
Par
=
0
,
pPr
=
1
,
Content
=
2
,
Table
=
3
,
sectPr
=
4
,
Run
=
5
,
CommentStart
=
6
,
CommentEnd
=
7
,
OMathPara
=
8
,
OMath
=
9
,
Hyperlink
=
10
,
FldSimple
=
11
,
Del
=
12
,
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
This diff is collapsed.
Click to expand it.
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
...
...
@@ -75,14 +75,14 @@ namespace OOX
}
public:
virtual
void
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
virtual
void
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
{
oNode
.
ReadAttributeBase
(
_T
(
"w:color"
),
m_oColor
);
oNode
.
ReadAttributeBase
(
_T
(
"w:themeColor"
),
m_oThemeColor
);
oNode
.
ReadAttributeBase
(
_T
(
"w:themeShade"
),
m_oThemeShade
);
oNode
.
ReadAttributeBase
(
_T
(
"w:themeTint"
),
m_oThemeTint
);
}
virtual
void
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
virtual
void
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
ReadAttributes
(
oReader
);
...
...
@@ -96,9 +96,11 @@ namespace OOX
if
(
_T
(
"w:drawing"
)
==
sName
)
m_oDrawing
=
oReader
;
else
if
(
_T
(
"v:background"
)
==
sName
)
m_oBackground
=
oReader
;
}
}
virtual
CString
toXML
()
const
virtual
CString
toXML
()
const
{
CString
sResult
=
_T
(
"<w:background "
);
...
...
@@ -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
(
"/>"
);
...
...
@@ -165,13 +172,14 @@ namespace OOX
public:
// Attributes
nullable
<
SimpleTypes
::
CHexColor
<>
>
m_oColor
;
nullable
<
SimpleTypes
::
CThemeColor
<>
>
m_oThemeColor
;
nullable
<
SimpleTypes
::
CUcharHexNumber
<>
>
m_oThemeShade
;
nullable
<
SimpleTypes
::
CUcharHexNumber
<>
>
m_oThemeTint
;
nullable
<
SimpleTypes
::
CHexColor
<>
>
m_oColor
;
nullable
<
SimpleTypes
::
CThemeColor
<>
>
m_oThemeColor
;
nullable
<
SimpleTypes
::
CUcharHexNumber
<>
>
m_oThemeShade
;
nullable
<
SimpleTypes
::
CUcharHexNumber
<>
>
m_oThemeTint
;
// Childs
nullable
<
OOX
::
Logic
::
CDrawing
>
m_oDrawing
;
nullable
<
OOX
::
Logic
::
CDrawing
>
m_oDrawing
;
nullable
<
OOX
::
Vml
::
CBackground
>
m_oBackground
;
};
}
}
...
...
Common/DocxFormat/Source/DocxFormat/Logic/SmartTag.h
View file @
8cdf4911
...
...
@@ -103,8 +103,8 @@ namespace OOX
std
::
wstring
wsName
=
oReader
.
GetName
();
while
(
!
wsName
.
empty
()
)
{
if
(
_T
(
"w:element"
)
==
wsName
)
m_sElement
=
oReader
.
GetText
();
else
if
(
_T
(
"w:uri"
)
==
wsName
)
m_sUri
=
oReader
.
GetText
();
if
(
_T
(
"w:element"
)
==
wsName
)
m_sElement
=
oReader
.
GetText
();
else
if
(
_T
(
"w:uri"
)
==
wsName
)
m_sUri
=
oReader
.
GetText
();
if
(
!
oReader
.
MoveToNextAttribute
()
)
break
;
...
...
XlsxSerializerCom/Reader/BinaryWriter.h
View file @
8cdf4911
...
...
@@ -1327,7 +1327,7 @@ namespace BinXlsxRW {
{
OOX
::
Spreadsheet
::
CRun
*
pRun
=
static_cast
<
OOX
::
Spreadsheet
::
CRun
*>
(
we
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerSharedStringTypes
::
Run
);
WriteRun
(
*
pRun
,
pIndexedColors
,
pTheme
,
oFontProcessor
);
WriteRun
(
*
pRun
,
pIndexedColors
,
pTheme
,
oFontProcessor
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
else
if
(
OOX
::
Spreadsheet
::
et_t
==
we
->
getType
())
...
...
@@ -1344,7 +1344,7 @@ namespace BinXlsxRW {
void
WriteRun
(
OOX
::
Spreadsheet
::
CRun
&
run
,
OOX
::
Spreadsheet
::
CIndexedColors
*
pIndexedColors
,
OOX
::
CTheme
*
pTheme
,
DocWrapper
::
FontProcessor
&
oFontProcessor
)
{
int
nCurPos
;
//rPr
//rPr
if
(
run
.
m_oRPr
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerSharedStringTypes
::
RPr
);
...
...
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