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
4ea7f5f9
Commit
4ea7f5f9
authored
Dec 24, 2016
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for docx background
parent
50a1f3f5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
29 deletions
+73
-29
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
+2
-2
ASCOfficeDocxFile2/BinReader/Readers.h
ASCOfficeDocxFile2/BinReader/Readers.h
+8
-23
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
+35
-4
ASCOfficePPTXFile/ASCOfficeDrawingConverter.h
ASCOfficePPTXFile/ASCOfficeDrawingConverter.h
+1
-0
ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp
+26
-0
ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h
ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h
+1
-0
No files found.
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
View file @
4ea7f5f9
...
...
@@ -292,9 +292,9 @@ public:
if
(
ThemeColor
.
bColor
)
sBackground
+=
L" w:themeColor=
\"
"
+
ThemeColor
.
ToStringColor
()
+
L"
\"
"
;
if
(
ThemeColor
.
bTint
)
sBackground
+=
L" w:theme
Color
Tint=
\"
"
+
ThemeColor
.
ToStringTint
()
+
L"
\"
"
;
sBackground
+=
L" w:themeTint=
\"
"
+
ThemeColor
.
ToStringTint
()
+
L"
\"
"
;
if
(
ThemeColor
.
bShade
)
sBackground
+=
L" w:theme
Color
Shade=
\"
"
+
ThemeColor
.
ToStringShade
()
+
L"
\"
"
;
sBackground
+=
L" w:themeShade=
\"
"
+
ThemeColor
.
ToStringShade
()
+
L"
\"
"
;
}
if
(
!
bColor
&&
!
bThemeColor
)
...
...
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
4ea7f5f9
...
...
@@ -6572,30 +6572,15 @@ public:
}
else
if
(
c_oSerBackgroundType
::
pptxDrawing
==
type
)
{
CDrawingProperty
oCDrawingProperty
(
m_oFileWriter
.
getNextDocPr
());
oCDrawingProperty
.
bType
=
oCDrawingProperty
.
bHeight
=
oCDrawingProperty
.
bWidth
=
true
;
oCDrawingProperty
.
Type
=
c_oAscWrapStyle
::
Inline
;
CString
sDrawingProperty
=
oCDrawingProperty
.
Write
();
BYTE
type
=
m_oBufferedStream
.
GetUChar
();
long
lenType
=
m_oBufferedStream
.
GetUChar
();
int
nRealLen
=
m_oBufferedStream
.
GetLong
();
CString
*
bstrDrawingXml
=
NULL
;
long
nCurPos
=
m_oBufferedStream
.
GetPos
();
m_oFileWriter
.
m_pDrawingConverter
->
SaveObjectEx
(
nCurPos
,
nRealLen
,
sDrawingProperty
,
XMLWRITER_DOC_TYPE_DOCX
,
&
bstrDrawingXml
);
if
(
NULL
!=
bstrDrawingXml
&&
false
==
bstrDrawingXml
->
IsEmpty
())
{
pBackground
->
sObject
=
*
bstrDrawingXml
;
}
RELEASEOBJECT
(
bstrDrawingXml
);
CDrawingProperty
oCDrawingProperty
(
0
);
res
=
Read2
(
length
,
&
Binary_DocumentTableReader
::
ReadPptxDrawing
,
this
,
&
oCDrawingProperty
);
m_oBufferedStream
.
Seek
(
nCurPos
+
nRealLen
);
if
(
oCDrawingProperty
.
bDataPos
&&
oCDrawingProperty
.
bDataLength
)
{
long
nCurPos
=
m_oBufferedStream
.
GetPos
();
pBackground
->
sObject
=
m_oFileWriter
.
m_pDrawingConverter
->
SaveObjectBackground
(
oCDrawingProperty
.
DataPos
,
oCDrawingProperty
.
DataLength
);
m_oBufferedStream
.
Seek
(
nCurPos
);
}
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
...
...
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
View file @
4ea7f5f9
...
...
@@ -1233,10 +1233,8 @@ rIns=\"91440\" bIns=\"45720\" numCol=\"1\" spcCol=\"0\" rtlCol=\"0\" fromWordArt
}
else
if
(
strName
==
L"background"
)
{
m_pBinaryWriter
->
StartRecord
(
1
);
PPTX
::
Logic
::
SpTreeElem
oElem
=
doc_LoadShape
(
oParseNode
,
pMainProps
,
false
);
m_pBinaryWriter
->
WriteRecord1
(
1
,
oElem
);
m_pBinaryWriter
->
EndRecord
();
PPTX
::
Logic
::
SpTreeElem
oElem
=
doc_LoadShape
(
oParseNode
,
pMainProps
,
false
);
m_pBinaryWriter
->
WriteRecord1
(
1
,
oElem
);
break
;
}
else
if
(
strName
==
L"pict"
||
strName
==
L"object"
)
...
...
@@ -4414,6 +4412,39 @@ HRESULT CDrawingConverter::SaveObjectEx(LONG lStart, LONG lLength, const CString
m_pReader
->
Seek
(
_e
);
return
S_OK
;
}
std
::
wstring
CDrawingConverter
::
SaveObjectBackground
(
LONG
lStart
,
LONG
lLength
)
{
m_pReader
->
Seek
(
lStart
);
++
m_nCurrentIndexObject
;
BYTE
typeRec1
=
m_pReader
->
GetUChar
();
// must be 0;
LONG
_e
=
m_pReader
->
GetPos
()
+
m_pReader
->
GetLong
()
+
4
;
m_pReader
->
Skip
(
5
);
// type record (must be 1) + 4 byte - len record
PPTX
::
Logic
::
SpTreeElem
oElem
;
m_pReader
->
m_lDocumentType
=
XMLWRITER_DOC_TYPE_DOCX
;
oElem
.
fromPPTY
(
m_pReader
);
m_pReader
->
m_lDocumentType
=
XMLWRITER_DOC_TYPE_PPTX
;
NSBinPptxRW
::
CXmlWriter
oXmlWriter
;
SaveObjectExWriterInit
(
oXmlWriter
,
XMLWRITER_DOC_TYPE_DOCX
);
oXmlWriter
.
m_bIsTop
=
true
;
// не забыть скинуть в самом шейпе
PPTX
::
Logic
::
Shape
&
oShape
=
oElem
.
as
<
PPTX
::
Logic
::
Shape
>
();
oShape
.
toXmlWriterVMLBackground
(
&
oXmlWriter
,
*
m_pTheme
,
*
m_pClrMap
);
--
m_nCurrentIndexObject
;
SaveObjectExWriterRelease
(
oXmlWriter
);
m_pReader
->
Seek
(
_e
);
return
oXmlWriter
.
GetXmlString
();
}
void
CDrawingConverter
::
ConvertPicVML
(
PPTX
::
Logic
::
SpTreeElem
&
oElem
,
const
CString
&
bsMainProps
,
NSBinPptxRW
::
CXmlWriter
&
oWriter
)
{
...
...
ASCOfficePPTXFile/ASCOfficeDrawingConverter.h
View file @
4ea7f5f9
...
...
@@ -221,6 +221,7 @@ namespace NSBinPptxRW
HRESULT
SaveObjectEx
(
long
lStart
,
long
lLength
,
const
CString
&
bsMainProps
,
long
lDocType
,
CString
**
bsXml
);
void
SaveObjectExWriterInit
(
NSBinPptxRW
::
CXmlWriter
&
oXmlWriter
,
LONG
lDocType
);
void
SaveObjectExWriterRelease
(
NSBinPptxRW
::
CXmlWriter
&
oXmlWriter
);
std
::
wstring
SaveObjectBackground
(
LONG
lStart
,
LONG
lLength
);
HRESULT
GetRecordBinary
(
long
lRecordType
,
const
CString
&
bsXml
);
HRESULT
GetRecordXml
(
long
lStart
,
long
lLength
,
long
lRecType
,
long
lDocType
,
CString
**
bsXml
);
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp
View file @
4ea7f5f9
...
...
@@ -654,5 +654,31 @@ namespace PPTX
pWriter
->
EndNode
(
_T
(
"v:shape"
));
}
}
void
Shape
::
toXmlWriterVMLBackground
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
,
NSCommon
::
smart_ptr
<
PPTX
::
WrapperFile
>&
oTheme
,
NSCommon
::
smart_ptr
<
PPTX
::
WrapperWritingElement
>&
oClrMap
)
{
CString
strFillAttr
=
_T
(
""
);
CString
strFillNode
=
_T
(
""
);
CalculateFill
(
spPr
,
style
,
oTheme
,
oClrMap
,
strFillAttr
,
strFillNode
,
false
);
pWriter
->
StartNode
(
_T
(
"v:background"
));
pWriter
->
StartAttributes
();
pWriter
->
WriteString
(
L" id=
\"
_x0000_s1025
\"
"
);
if
(
!
pWriter
->
m_strAttributesMain
.
empty
())
{
pWriter
->
WriteString
(
pWriter
->
m_strAttributesMain
);
pWriter
->
m_strAttributesMain
.
clear
();
}
pWriter
->
WriteString
(
strFillAttr
);
pWriter
->
EndAttributes
();
pWriter
->
WriteString
(
strFillNode
);
pWriter
->
EndNode
(
_T
(
"v:background"
));
}
}
// namespace Logic
}
// namespace PPTX
ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h
View file @
4ea7f5f9
...
...
@@ -134,6 +134,7 @@ namespace PPTX
}
void
toXmlWriterVML
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
,
smart_ptr
<
PPTX
::
WrapperFile
>&
oTheme
,
smart_ptr
<
PPTX
::
WrapperWritingElement
>&
oClrMap
);
void
toXmlWriterVMLBackground
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
,
NSCommon
::
smart_ptr
<
PPTX
::
WrapperFile
>&
oTheme
,
NSCommon
::
smart_ptr
<
PPTX
::
WrapperWritingElement
>&
oClrMap
);
virtual
void
toXmlWriter
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
{
...
...
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