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
9f60ce0a
Commit
9f60ce0a
authored
May 31, 2016
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open/save oleObject xlsx
parent
b1ca7115
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
1040 additions
and
250 deletions
+1040
-250
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
+62
-6
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
+7
-2
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
+4
-0
ASCOfficePPTXFile/Editor/XmlWriter.h
ASCOfficePPTXFile/Editor/XmlWriter.h
+2
-1
ASCOfficePPTXFile/PPTXFormat/DocxFormat/Drawing/VmlDrawing.h
ASCOfficePPTXFile/PPTXFormat/DocxFormat/Drawing/VmlDrawing.h
+6
-4
ASCOfficePPTXFile/PPTXFormat/Logic/Controls.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Controls.cpp
+5
-5
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h
+12
-1
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
+3
-0
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp
+3
-3
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
+111
-35
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h
+7
-0
ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.h
ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.h
+3
-0
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
+2
-1
Common/DocxFormat/Source/Common/SimpleTypes_Base.h
Common/DocxFormat/Source/Common/SimpleTypes_Base.h
+17
-8
Common/DocxFormat/Source/DocxFormat/File.h
Common/DocxFormat/Source/DocxFormat/File.h
+2
-2
Common/DocxFormat/Source/DocxFormat/IFileContainer.cpp
Common/DocxFormat/Source/DocxFormat/IFileContainer.cpp
+5
-3
Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp
Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp
+14
-10
Common/DocxFormat/Source/DocxFormat/Logic/Vml.h
Common/DocxFormat/Source/DocxFormat/Logic/Vml.h
+78
-62
Common/DocxFormat/Source/DocxFormat/Media/OleObject.h
Common/DocxFormat/Source/DocxFormat/Media/OleObject.h
+8
-4
Common/DocxFormat/Source/DocxFormat/VmlDrawing.h
Common/DocxFormat/Source/DocxFormat/VmlDrawing.h
+28
-19
Common/DocxFormat/Source/XlsxFormat/Drawing/Image.h
Common/DocxFormat/Source/XlsxFormat/Drawing/Image.h
+2
-2
Common/DocxFormat/Source/XlsxFormat/FileFactory_Spreadsheet.cpp
.../DocxFormat/Source/XlsxFormat/FileFactory_Spreadsheet.cpp
+5
-0
Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.h
Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.h
+5
-0
Common/DocxFormat/Source/XlsxFormat/IFileContainer_Spreadsheet.cpp
...cxFormat/Source/XlsxFormat/IFileContainer_Spreadsheet.cpp
+7
-7
Common/DocxFormat/Source/XlsxFormat/Ole/OleObjects.h
Common/DocxFormat/Source/XlsxFormat/Ole/OleObjects.h
+293
-0
Common/DocxFormat/Source/XlsxFormat/SimpleTypes_Spreadsheet.h
...on/DocxFormat/Source/XlsxFormat/SimpleTypes_Spreadsheet.h
+64
-0
Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h
Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h
+18
-23
Common/DocxFormat/Source/XlsxFormat/WritingElement.h
Common/DocxFormat/Source/XlsxFormat/WritingElement.h
+2
-0
XlsxSerializerCom/Reader/BinaryWriter.h
XlsxSerializerCom/Reader/BinaryWriter.h
+109
-7
XlsxSerializerCom/Writer/BinaryReader.h
XlsxSerializerCom/Writer/BinaryReader.h
+156
-45
No files found.
ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp
View file @
9f60ce0a
...
...
@@ -1319,7 +1319,7 @@ rIns=\"91440\" bIns=\"45720\" numCol=\"1\" spcCol=\"0\" rtlCol=\"0\" fromWordArt
}
if
(
NULL
!=
pElem
)
{
if
(
NULL
!=
pOle
&&
pOle
->
m_
oId
.
IsInit
()
&&
pOle
->
m_sProgId
.
IsInit
(
))
if
(
NULL
!=
pOle
&&
pOle
->
m_
sProgId
.
IsInit
()
&&
(
pOle
->
m_oId
.
IsInit
()
||
pOle
->
m_sFilepathBin
.
IsInit
()
))
{
PPTX
::
Logic
::
Shape
*
pShape
=
dynamic_cast
<
PPTX
::
Logic
::
Shape
*>
(
pElem
->
GetElem
().
operator
->
());
if
(
NULL
!=
pShape
&&
pShape
->
spPr
.
Fill
.
Fill
.
IsInit
())
...
...
@@ -1327,11 +1327,23 @@ rIns=\"91440\" bIns=\"45720\" numCol=\"1\" spcCol=\"0\" rtlCol=\"0\" fromWordArt
const
PPTX
::
Logic
::
BlipFill
&
oBlipFill
=
pShape
->
spPr
.
Fill
.
Fill
.
as
<
PPTX
::
Logic
::
BlipFill
>
();
if
(
oBlipFill
.
blip
.
IsInit
())
{
oBlipFill
.
blip
->
oleRid
=
pOle
->
m_oId
.
get
().
ToString
();
if
(
pOle
->
m_sFilepathBin
.
IsInit
())
{
oBlipFill
.
blip
->
oleFilepathBin
=
pOle
->
m_sFilepathBin
.
get
();
}
else
if
(
pOle
->
m_oId
.
IsInit
())
{
oBlipFill
.
blip
->
oleRid
=
pOle
->
m_oId
.
get
().
ToString
();
}
if
(
strName
==
_T
(
"object"
))
{
pOle
->
m_oDxaOrig
=
oParseNode
.
ReadAttributeInt
(
_T
(
"w:dxaOrig"
));
pOle
->
m_oDyaOrig
=
oParseNode
.
ReadAttributeInt
(
_T
(
"w:dyaOrig"
));
int
nDxaOrig
=
oParseNode
.
ReadAttributeInt
(
_T
(
"w:dxaOrig"
));
int
nDyaOrig
=
oParseNode
.
ReadAttributeInt
(
_T
(
"w:dyaOrig"
));
if
(
nDxaOrig
>
0
&&
nDyaOrig
>
0
)
{
pOle
->
m_oDxaOrig
=
nDxaOrig
;
pOle
->
m_oDyaOrig
=
nDyaOrig
;
}
}
PPTX
::
Logic
::
Pic
*
newElem
=
new
PPTX
::
Logic
::
Pic
();
...
...
@@ -4291,6 +4303,15 @@ HRESULT CDrawingConverter::SaveObjectEx(LONG lStart, LONG lLength, const CString
m_pReader
->
m_lDocumentType
=
lDocType
;
oElem
.
fromPPTY
(
m_pReader
);
bool
bOle
=
false
;
if
(
oElem
.
is
<
PPTX
::
Logic
::
Pic
>
())
{
PPTX
::
Logic
::
Pic
&
oPic
=
oElem
.
as
<
PPTX
::
Logic
::
Pic
>
();
if
(
oPic
.
oleObject
.
IsInit
())
{
bOle
=
oPic
.
oleObject
->
isValid
();
}
}
m_pReader
->
m_lDocumentType
=
XMLWRITER_DOC_TYPE_PPTX
;
...
...
@@ -4302,12 +4323,29 @@ HRESULT CDrawingConverter::SaveObjectEx(LONG lStart, LONG lLength, const CString
oXmlWriter
.
m_bIsTop
=
(
1
==
m_nCurrentIndexObject
)
?
true
:
false
;
oElem
.
toXmlWriter
(
&
oXmlWriter
);
#if defined(BUILD_CONFIG_FULL_VERSION) && defined(AVS_USE_CONVERT_PPTX_TOCUSTOM_VML)
if
(
NULL
==
m_pOOXToVMLRenderer
)
m_pOOXToVMLRenderer
=
new
COOXToVMLGeometry
();
oXmlWriter
.
m_pOOXToVMLRenderer
=
m_pOOXToVMLRenderer
;
#endif
if
(
bOle
)
{
ConvertPicVML
(
oElem
,
bsMainProps
,
oXmlWriter
);
}
else
{
oElem
.
toXmlWriter
(
&
oXmlWriter
);
}
--
m_nCurrentIndexObject
;
m_pXmlWriter
->
m_lObjectIdVML
=
oXmlWriter
.
m_lObjectIdVML
;
m_pXmlWriter
->
m_lObjectIdOle
=
oXmlWriter
.
m_lObjectIdOle
;
if
(
XMLWRITER_DOC_TYPE_XLSX
==
lDocType
)
{
m_pXmlWriter
->
m_strOleXlsx
=
oXmlWriter
.
m_strOleXlsx
;
}
CString
ret
=
oXmlWriter
.
GetXmlString
();
*
bsXml
=
new
CString
();
...
...
@@ -5008,7 +5046,11 @@ HRESULT CDrawingConverter::SetAdditionalParam(const CString& ParamName, VARIANT
else
if
(
name
==
_T
(
"DocumentChartsCount"
)
&&
ParamValue
.
vt
==
VT_I4
)
{
m_pReader
->
m_lChartNumber
=
ParamValue
.
lVal
+
1
;
}
}
else
if
(
name
==
_T
(
"ObjectIdVML"
)
&&
ParamValue
.
vt
==
VT_I4
)
{
m_pXmlWriter
->
m_lObjectIdVML
=
ParamValue
.
lVal
;
}
return
S_OK
;
}
HRESULT
CDrawingConverter
::
GetAdditionalParam
(
const
CString
&
ParamName
,
BYTE
**
pArray
,
size_t
&
szCount
)
...
...
@@ -5059,6 +5101,20 @@ HRESULT CDrawingConverter::GetAdditionalParam(const CString& ParamName, VARIANT*
ParamValue
->
vt
=
VT_I4
;
ParamValue
->
lVal
=
m_pReader
->
m_lChartNumber
-
1
;
}
else
if
(
name
==
_T
(
"ObjectIdVML"
))
{
ParamValue
->
vt
=
VT_I4
;
ParamValue
->
lVal
=
m_pXmlWriter
->
m_lObjectIdVML
;
}
else
if
(
name
==
_T
(
"OleXlsx"
))
{
ParamValue
->
vt
=
VT_BSTR
;
#if defined(_WIN32) || defined (_WIN64)
ParamValue
->
bstrVal
=
m_pXmlWriter
->
m_strOleXlsx
.
AllocSysString
();
#else
ParamValue
->
bstrVal
=
m_pXmlWriter
->
m_strOleXlsx
;
#endif
}
else
if
(
name
==
_T
(
"ContentTypes"
))
{
ParamValue
->
vt
=
VT_BSTR
;
...
...
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
View file @
9f60ce0a
...
...
@@ -244,9 +244,10 @@ namespace NSBinPptxRW
CString
strExts
=
sExts
;
CString
strImage
;
strImage
.
Format
(
_T
(
"image%d"
),
m_lIndexNextImage
++
);
OOX
::
CPath
pathOutput
;
if
((
_T
(
".jpg"
)
==
strExts
)
||
(
_T
(
".jpeg"
)
==
strExts
)
||
(
_T
(
".png"
)
==
strExts
)
||
(
_T
(
".emf"
)
==
strExts
)
||
(
_T
(
".wmf"
)
==
strExts
))
{
OOX
::
CPath
pathOutput
=
m_strDstMedia
+
FILE_SEPARATOR_STR
+
strImage
+
strExts
;
pathOutput
=
m_strDstMedia
+
FILE_SEPARATOR_STR
+
strImage
+
strExts
;
// теперь нужно скопировать картинку
if
(
pathOutput
.
GetPath
()
!=
strInput
)
CDirectory
::
CopyFile
(
strInput
,
pathOutput
.
GetPath
(),
NULL
,
NULL
);
...
...
@@ -255,9 +256,10 @@ namespace NSBinPptxRW
{
// content types!!!
strExts
=
_T
(
".png"
);
OOX
::
CPath
pathOutput
=
m_strDstMedia
+
FILE_SEPARATOR_STR
+
strImage
+
strExts
;
pathOutput
=
m_strDstMedia
+
FILE_SEPARATOR_STR
+
strImage
+
strExts
;
SaveImageAsPng
(
strInput
,
pathOutput
.
GetPath
());
}
oImageManagerInfo
.
m_sFilepathImg
=
pathOutput
.
GetPath
();;
if
(
!
m_bIsWord
)
strImage
=
_T
(
"../media/"
)
+
strImage
+
strExts
;
else
...
...
@@ -283,6 +285,7 @@ namespace NSBinPptxRW
else
strImageOle
=
_T
(
"embeddings/"
)
+
strImageOle
;
oImageManagerInfo
.
m_sOlePath
=
strImageOle
;
oImageManagerInfo
.
m_sFilepathBin
=
strOleImageOut
;
}
oImageManagerInfo
.
m_sImagePath
=
strImage
;
...
...
@@ -1352,6 +1355,7 @@ namespace NSBinPptxRW
return
pPair
->
second
;
}
CRelsGeneratorInfo
oRelsGeneratorInfo
;
oRelsGeneratorInfo
.
m_sFilepathImg
=
oImageManagerInfo
.
m_sFilepathImg
;
oRelsGeneratorInfo
.
m_nImageRId
=
m_lNextRelsID
++
;
CString
strRid
=
_T
(
""
);
strRid
.
Format
(
_T
(
"rId%d"
),
oRelsGeneratorInfo
.
m_nImageRId
);
...
...
@@ -1364,6 +1368,7 @@ namespace NSBinPptxRW
if
(
!
oImageManagerInfo
.
m_sOlePath
.
IsEmpty
())
{
oRelsGeneratorInfo
.
m_nOleRId
=
m_lNextRelsID
++
;
oRelsGeneratorInfo
.
m_sFilepathBin
=
oImageManagerInfo
.
m_sFilepathBin
;
CString
strRid
=
_T
(
""
);
strRid
.
Format
(
_T
(
"rId%d"
),
oRelsGeneratorInfo
.
m_nOleRId
);
...
...
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h
View file @
9f60ce0a
...
...
@@ -55,12 +55,16 @@ namespace NSBinPptxRW
public:
CString
m_sImagePath
;
CString
m_sOlePath
;
CString
m_sFilepathBin
;
CString
m_sFilepathImg
;
};
class
CRelsGeneratorInfo
{
public:
int
m_nImageRId
;
int
m_nOleRId
;
CString
m_sFilepathBin
;
CString
m_sFilepathImg
;
CRelsGeneratorInfo
()
{
m_nImageRId
=
-
1
;
...
...
ASCOfficePPTXFile/Editor/XmlWriter.h
View file @
9f60ce0a
...
...
@@ -278,7 +278,7 @@ namespace NSBinPptxRW
CString
m_strNodes
;
IRenderer
*
m_pOOXToVMLRenderer
;
bool
m_bIsTop
;
CString
m_strOleXlsx
;
public:
CXmlWriter
()
:
m_oWriter
()
...
...
@@ -298,6 +298,7 @@ namespace NSBinPptxRW
m_pOOXToVMLRenderer
=
NULL
;
m_bIsTop
=
false
;
m_strOleXlsx
=
L""
;
}
~
CXmlWriter
()
{
...
...
ASCOfficePPTXFile/PPTXFormat/DocxFormat/Drawing/VmlDrawing.h
View file @
9f60ce0a
...
...
@@ -19,8 +19,6 @@ namespace PPTX
VmlDrawing
(
const
OOX
::
CPath
&
filename
,
FileMap
&
map
)
{
read
(
filename
,
map
);
m_sFilename
=
filename
.
GetPath
();
}
virtual
~
VmlDrawing
()
{
...
...
@@ -29,6 +27,7 @@ namespace PPTX
public:
virtual
void
read
(
const
OOX
::
CPath
&
filename
,
FileMap
&
map
)
{
m_filename
=
filename
;
//FileContainer::read(filename, map);
//так как это не совсем xml - поправим
...
...
@@ -95,12 +94,15 @@ namespace PPTX
{
return
type
().
DefaultFileName
();
}
const
OOX
::
CPath
filename
()
const
{
return
m_filename
;
}
CString
m_sFilename
;
std
::
map
<
CString
,
CString
>
m_mapShapesXml
;
//связь id (_x0000_s1025) с xml для OfficeDrawing
private:
OOX
::
CPath
m_filename
;
void
replace_all
(
std
::
wstring
&
subject
,
const
std
::
wstring
search
,
const
std
::
wstring
replace
)
{
size_t
pos
=
0
;
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Controls.cpp
View file @
9f60ce0a
#include "Controls.h"
#
include
"Controls.h"
#include "../../ASCOfficeDrawingConverter.h"
#include "../Slide.h"
...
...
@@ -14,23 +14,23 @@ namespace PPTX
if
(
parentFileIs
<
PPTX
::
Slide
>
()
&&
parentFileAs
<
PPTX
::
Slide
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
Slide
>
().
GetVmlXmlBySpid
(
spid
);
rels
=
parentFileAs
<
PPTX
::
Slide
>
().
Vml
->
m_sFilename
;
rels
=
parentFileAs
<
PPTX
::
Slide
>
().
Vml
->
filename
().
GetPath
()
;
}
else
if
(
parentFileIs
<
PPTX
::
SlideLayout
>
()
&&
parentFileAs
<
PPTX
::
SlideLayout
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
GetVmlXmlBySpid
(
spid
);
rels
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
Vml
->
m_sFilename
;
rels
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
Vml
->
filename
().
GetPath
()
;
}
else
if
(
parentFileIs
<
PPTX
::
SlideMaster
>
()
&&
parentFileAs
<
PPTX
::
SlideMaster
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
GetVmlXmlBySpid
(
spid
);
rels
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
Vml
->
m_sFilename
;
rels
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
Vml
->
filename
().
GetPath
()
;
}
return
xml
;
}
void
Control
::
AddObjectTo
(
const
std
::
vector
<
SpTreeElem
>
*
spTreeElements
,
NSShapeImageGen
::
CImageManager
*
pImageManager
)
const
{
//
!!!
{
//
проблема переноса картинок
!!!
if
(
spid
.
IsInit
()
==
false
)
return
;
CString
s
=
*
spid
;
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h
View file @
9f60ce0a
...
...
@@ -29,6 +29,10 @@ namespace PPTX
m_namespace
=
oSrc
.
m_namespace
;
oleRid
=
oSrc
.
oleRid
;
oleFilepathBin
=
oSrc
.
oleFilepathBin
;
oleFilepathImg
=
oSrc
.
oleFilepathImg
;
oleRidImg
=
oSrc
.
oleRidImg
;
return
*
this
;
}
...
...
@@ -101,7 +105,11 @@ namespace PPTX
CString
olePath
;
if
(
!
oleRid
.
IsEmpty
())
if
(
!
oleFilepathBin
.
IsEmpty
())
{
olePath
=
oleFilepathBin
;
}
else
if
(
!
oleRid
.
IsEmpty
())
{
olePath
=
this
->
GetFullOleName
(
PPTX
::
RId
(
oleRid
),
pRels
);
}
...
...
@@ -132,6 +140,9 @@ namespace PPTX
CString
m_namespace
;
//internal
CString
oleRid
;
CString
oleFilepathBin
;
CString
oleFilepathImg
;
CString
oleRidImg
;
protected:
virtual
void
FillParentPointersForChilds
();
};
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
View file @
9f60ce0a
...
...
@@ -382,6 +382,9 @@ namespace PPTX
if
(
oRelsGeneratorInfo
.
m_nOleRId
>
0
)
{
blip
->
oleRid
=
PPTX
::
RId
((
size_t
)
oRelsGeneratorInfo
.
m_nOleRId
).
get
();
blip
->
oleFilepathBin
=
oRelsGeneratorInfo
.
m_sFilepathBin
;
blip
->
oleFilepathImg
=
oRelsGeneratorInfo
.
m_sFilepathImg
;
blip
->
oleRidImg
=
blip
->
embed
->
get
();
}
pReader
->
Skip
(
1
);
// end attribute
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp
View file @
9f60ce0a
...
...
@@ -433,17 +433,17 @@ namespace PPTX
if
(
parentFileIs
<
PPTX
::
Slide
>
()
&&
parentFileAs
<
PPTX
::
Slide
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
Slide
>
().
GetVmlXmlBySpid
(
spid
.
get_value_or
(
_T
(
""
)));
rels
=
parentFileAs
<
PPTX
::
Slide
>
().
Vml
->
m_sFilename
;
rels
=
parentFileAs
<
PPTX
::
Slide
>
().
Vml
->
filename
().
GetPath
()
;
}
else
if
(
parentFileIs
<
PPTX
::
SlideLayout
>
()
&&
parentFileAs
<
PPTX
::
SlideLayout
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
GetVmlXmlBySpid
(
spid
.
get_value_or
(
_T
(
""
)));
rels
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
Vml
->
m_sFilename
;
rels
=
parentFileAs
<
PPTX
::
SlideLayout
>
().
Vml
->
filename
().
GetPath
()
;
}
else
if
(
parentFileIs
<
PPTX
::
SlideMaster
>
()
&&
parentFileAs
<
PPTX
::
SlideMaster
>
().
Vml
.
IsInit
())
{
xml
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
GetVmlXmlBySpid
(
spid
.
get_value_or
(
_T
(
""
)));
rels
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
Vml
->
m_sFilename
;
rels
=
parentFileAs
<
PPTX
::
SlideMaster
>
().
Vml
->
filename
().
GetPath
()
;
}
return
xml
;
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
View file @
9f60ce0a
...
...
@@ -21,20 +21,13 @@ namespace PPTX
node
.
ReadAttributeBase
(
L"ShapeID"
,
m_sShapeId
);
node
.
ReadAttributeBase
(
L"Type"
,
m_oType
);
node
.
ReadAttributeBase
(
L"UpdateMode"
,
m_oUpdateMode
);
node
.
ReadAttributeBase
(
L"pathbin"
,
m_sFilepathBin
);
node
.
ReadAttributeBase
(
L"pathimg"
,
m_sFilepathImg
);
}
CString
COLEObject
::
toXML
()
const
{
XmlUtils
::
CAttribute
oAttribute
;
oAttribute
.
WriteLimitNullable
(
L"DrawAspect"
,
m_oDrawAspect
);
oAttribute
.
WriteNullable
(
L"r:id"
,
m_oId
);
oAttribute
.
WriteNullable
(
L"ObjectID"
,
m_sObjectId
);
oAttribute
.
WriteNullable
(
L"ProgID"
,
m_sProgId
);
oAttribute
.
WriteNullable
(
L"ShapeID"
,
m_sShapeId
);
oAttribute
.
WriteLimitNullable
(
L"Type"
,
m_oType
);
oAttribute
.
WriteLimitNullable
(
L"UpdateMode"
,
m_oUpdateMode
);
return
XmlUtils
::
CreateNode
(
_T
(
"o:OLEObject"
),
oAttribute
);
return
L""
;
}
void
COLEObject
::
toXmlWriter
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
{
...
...
@@ -48,7 +41,7 @@ namespace PPTX
pWriter
->
WriteAttribute
(
L"r:id"
,
m_oId
->
ToString
());
}
pWriter
->
WriteAttribute
(
L"ObjectID"
,
m_sObjectId
);
pWriter
->
WriteAttribute
(
L"ProgID"
,
m_sProgId
);
pWriter
->
WriteAttribute
2
(
L"ProgID"
,
m_sProgId
);
pWriter
->
WriteAttribute
(
L"ShapeID"
,
m_sShapeId
);
pWriter
->
WriteAttribute
(
L"Type"
,
m_oType
);
pWriter
->
WriteAttribute
(
L"UpdateMode"
,
m_oUpdateMode
);
...
...
@@ -56,6 +49,51 @@ namespace PPTX
pWriter
->
EndNode
(
strName
);
}
void
COLEObject
::
toXmlWriterXlsx
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
{
CString
strName
=
L"oleObject"
;
pWriter
->
StartNode
(
strName
);
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute2
(
L"progId"
,
m_sProgId
);
if
(
m_oDrawAspect
.
IsInit
())
{
CString
sDrawAspect
;
if
(
0
==
m_oDrawAspect
->
GetBYTECode
())
{
sDrawAspect
=
L"DVASPECT_CONTENT"
;
}
else
{
sDrawAspect
=
L"DVASPECT_ICON"
;
}
pWriter
->
WriteAttribute
(
L"dvAspect"
,
sDrawAspect
);
}
if
(
m_oUpdateMode
.
IsInit
())
{
CString
sUpdateMode
;
if
(
0
==
m_oUpdateMode
->
GetBYTECode
())
{
sUpdateMode
=
L"OLEUPDATE_ALWAYS"
;
}
else
{
sUpdateMode
=
L"OLEUPDATE_ONCALL"
;
}
pWriter
->
WriteAttribute
(
L"oleUpdate"
,
sUpdateMode
);
}
pWriter
->
WriteAttribute
(
L"shapeId"
,
m_sShapeId
);
if
(
m_oId
.
IsInit
())
{
pWriter
->
WriteAttribute
(
L"r:id"
,
m_oId
->
ToString
());
}
pWriter
->
WriteAttribute2
(
L"pathbin"
,
m_sFilepathBin
);
pWriter
->
WriteAttribute2
(
L"pathimg"
,
m_sFilepathImg
);
pWriter
->
WriteAttribute2
(
L"idimg"
,
m_oIdImg
->
ToString
());
pWriter
->
EndAttributes
();
pWriter
->
EndNode
(
strName
);
}
void
COLEObject
::
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
{
std
::
wstring
sData
;
...
...
@@ -140,7 +178,7 @@ namespace PPTX
}
bool
COLEObject
::
isValid
()
{
return
m_sProgId
.
IsInit
()
&&
(
m_sData
.
IsInit
()
||
m_oId
.
IsInit
());
return
m_sProgId
.
IsInit
()
&&
(
m_sData
.
IsInit
()
||
m_oId
.
IsInit
()
||
m_sFilepathBin
.
IsInit
()
);
}
CString
COLEObject
::
GetFullOleName
(
const
PPTX
::
RId
&
oRId
,
FileContainer
*
pRels
)
const
...
...
@@ -460,21 +498,24 @@ namespace PPTX
bool
bOle
=
oleObject
.
IsInit
()
&&
oleObject
->
isValid
();
CString
sOleNodeName
;
if
(
bOle
&&
oleObject
->
m_oDxaOrig
.
IsInit
()
&&
oleObject
->
m_oDyaOrig
.
IsInit
())
{
sOleNodeName
=
L"w:object"
;
pWriter
->
StartNode
(
sOleNodeName
);
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute
(
_T
(
"w:dxaOrig"
),
oleObject
->
m_oDxaOrig
);
pWriter
->
WriteAttribute
(
_T
(
"w:dyaOrig"
),
oleObject
->
m_oDyaOrig
);
pWriter
->
EndAttributes
();
}
else
if
(
XMLWRITER_DOC_TYPE_XLSX
!=
pWriter
->
m_lDocType
)
{
sOleNodeName
=
L"w:pict"
;
pWriter
->
StartNode
(
sOleNodeName
);
pWriter
->
StartAttributes
();
pWriter
->
EndAttributes
();
if
(
bOle
&&
oleObject
->
m_oDxaOrig
.
IsInit
()
&&
oleObject
->
m_oDyaOrig
.
IsInit
())
{
sOleNodeName
=
L"w:object"
;
pWriter
->
StartNode
(
sOleNodeName
);
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute
(
_T
(
"w:dxaOrig"
),
oleObject
->
m_oDxaOrig
);
pWriter
->
WriteAttribute
(
_T
(
"w:dyaOrig"
),
oleObject
->
m_oDyaOrig
);
pWriter
->
EndAttributes
();
}
else
{
sOleNodeName
=
L"w:pict"
;
pWriter
->
StartNode
(
sOleNodeName
);
pWriter
->
StartAttributes
();
pWriter
->
EndAttributes
();
}
}
int
dL
=
0
;
...
...
@@ -482,8 +523,9 @@ namespace PPTX
int
dW
=
0
;
int
dH
=
0
;
int
nShapeId
=
pWriter
->
m_lObjectIdVML
;
CString
strId
=
_T
(
""
);
strId
.
Format
(
_T
(
"_x0000_i%04d"
),
pWriter
->
m_lObjectIdVML
);
strId
.
Format
(
_T
(
"_x0000_i%04d"
),
nShapeId
);
CString
strSpid
=
_T
(
""
);
strSpid
.
Format
(
_T
(
"_x%04d_s%04d"
),
0xFFFF
&
(
pWriter
->
m_lObjectIdVML
>>
16
),
0xFFFF
&
pWriter
->
m_lObjectIdVML
);
CString
strObjectid
=
_T
(
""
);
...
...
@@ -555,8 +597,15 @@ namespace PPTX
pWriter
->
StartNode
(
_T
(
"v:shape"
));
pWriter
->
WriteAttribute
(
_T
(
"id"
),
strId
);
pWriter
->
WriteAttribute
(
_T
(
"o:spid"
),
strSpid
);
if
(
XMLWRITER_DOC_TYPE_XLSX
==
pWriter
->
m_lDocType
)
{
pWriter
->
WriteAttribute
(
_T
(
"id"
),
strSpid
);
}
else
{
pWriter
->
WriteAttribute
(
_T
(
"id"
),
strId
);
pWriter
->
WriteAttribute
(
_T
(
"o:spid"
),
strSpid
);
}
pWriter
->
StartAttributes
();
if
(
oStylesWriter
.
GetSize
()
==
0
)
...
...
@@ -608,7 +657,14 @@ namespace PPTX
{
pWriter
->
StartNode
(
_T
(
"v:imagedata"
));
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute
(
_T
(
"r:id"
),
blipFill
.
blip
->
embed
->
ToString
());
if
(
XMLWRITER_DOC_TYPE_XLSX
==
pWriter
->
m_lDocType
)
{
pWriter
->
WriteAttribute
(
_T
(
"o:relid"
),
blipFill
.
blip
->
embed
->
ToString
());
}
else
{
pWriter
->
WriteAttribute
(
_T
(
"r:id"
),
blipFill
.
blip
->
embed
->
ToString
());
}
pWriter
->
WriteAttribute
(
_T
(
"o:title"
),
CString
(
_T
(
""
)));
pWriter
->
EndAttributes
();
pWriter
->
EndNode
(
_T
(
"v:imagedata"
));
...
...
@@ -622,8 +678,15 @@ namespace PPTX
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute
(
_T
(
"id"
),
strId
);
pWriter
->
WriteAttribute
(
_T
(
"o:spid"
),
strSpid
);
if
(
XMLWRITER_DOC_TYPE_XLSX
==
pWriter
->
m_lDocType
)
{
pWriter
->
WriteAttribute
(
_T
(
"id"
),
strSpid
);
}
else
{
pWriter
->
WriteAttribute
(
_T
(
"id"
),
strId
);
pWriter
->
WriteAttribute
(
_T
(
"o:spid"
),
strSpid
);
}
if
(
oStylesWriter
.
GetSize
()
==
0
)
{
...
...
@@ -657,11 +720,24 @@ namespace PPTX
if
(
bOle
)
{
oleObject
->
m_sShapeId
=
strId
;
oleObject
->
m_sObjectId
=
strObjectid
;
oleObject
->
toXmlWriter
(
pWriter
);
if
(
XMLWRITER_DOC_TYPE_XLSX
==
pWriter
->
m_lDocType
)
{
oleObject
->
m_sShapeId
=
std_string2string
(
std
::
to_wstring
(
nShapeId
));
NSBinPptxRW
::
CXmlWriter
oTempWriter
;
oleObject
->
toXmlWriterXlsx
(
&
oTempWriter
);
pWriter
->
m_strOleXlsx
=
oTempWriter
.
GetXmlString
();
}
else
{
oleObject
->
m_sShapeId
=
strId
;
oleObject
->
toXmlWriter
(
pWriter
);
}
}
if
(
XMLWRITER_DOC_TYPE_XLSX
!=
pWriter
->
m_lDocType
)
{
pWriter
->
EndNode
(
sOleNodeName
);
}
pWriter
->
EndNode
(
sOleNodeName
);
}
}
// namespace Logic
}
// namespace PPTX
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h
View file @
9f60ce0a
...
...
@@ -154,6 +154,7 @@ namespace PPTX
virtual
void
fromXML
(
XmlUtils
::
CXmlNode
&
node
);
virtual
CString
toXML
()
const
;
virtual
void
toXmlWriter
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
;
void
toXmlWriterXlsx
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
;
virtual
void
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
;
virtual
void
fromPPTY
(
NSBinPptxRW
::
CBinaryFileReader
*
pReader
);
virtual
void
FillParentPointersForChilds
();
...
...
@@ -173,6 +174,9 @@ namespace PPTX
//internal
nullable_string
m_sData
;
nullable_string
m_sFilepathBin
;
nullable_string
m_sFilepathImg
;
nullable
<
PPTX
::
RId
>
m_oIdImg
;
nullable_int
m_oDxaOrig
;
nullable_int
m_oDyaOrig
;
};
...
...
@@ -356,6 +360,9 @@ namespace PPTX
if
(
blipFill
.
blip
.
IsInit
()
&&
!
blipFill
.
blip
->
oleRid
.
IsEmpty
()
&&
oleObject
.
IsInit
())
{
oleObject
->
m_oId
=
PPTX
::
RId
(
blipFill
.
blip
->
oleRid
);
oleObject
->
m_sFilepathBin
=
blipFill
.
blip
->
oleFilepathBin
;
oleObject
->
m_sFilepathImg
=
blipFill
.
blip
->
oleFilepathImg
;
oleObject
->
m_oIdImg
=
PPTX
::
RId
(
blipFill
.
blip
->
oleRidImg
);
}
pReader
->
Seek
(
_end_rec
);
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.h
View file @
9f60ce0a
...
...
@@ -371,6 +371,9 @@ namespace PPTX
if
(
oRelsGeneratorInfo
.
m_nOleRId
>
0
)
{
pFill
->
blip
->
oleRid
=
PPTX
::
RId
((
size_t
)
oRelsGeneratorInfo
.
m_nOleRId
).
get
();
pFill
->
blip
->
oleFilepathBin
=
oRelsGeneratorInfo
.
m_sFilepathBin
;
pFill
->
blip
->
oleFilepathImg
=
oRelsGeneratorInfo
.
m_sFilepathImg
;
pFill
->
blip
->
oleRidImg
=
pFill
->
blip
->
embed
->
get
();
}
pReader
->
Skip
(
1
);
// end attribute
...
...
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
View file @
9f60ce0a
...
...
@@ -349,7 +349,8 @@ HEADERS += docxformatlib.h \
..
/
Source
/
Base
/
unicode_util
.
h
\
..
/
Source
/
XlsxFormat
/
ExternalLinks
/
ExternalLinkPath
.
h
\
..
/
Source
/
XlsxFormat
/
ExternalLinks
/
ExternalLinks
.
h
\
..
/
Source
/
XlsxFormat
/
Worksheets
/
Sparkline
.
h
..
/
Source
/
XlsxFormat
/
Worksheets
/
Sparkline
.
h
\
..
/
Source
/
XlsxFormat
/
Ole
/
OleObjects
.
h
unix
{
target
.
path
=
/
usr
/
lib
INSTALLS
+=
target
...
...
Common/DocxFormat/Source/Common/SimpleTypes_Base.h
View file @
9f60ce0a
#pragma once
#
pragma
once
#include "math.h"
#include "../Common/Unit.h"
...
...
@@ -7,8 +7,8 @@
namespace
SimpleTypes
{
// TO DO:
FromString.
//
,
.
// TO DO:
В будущем надо улучшить функции FromString. Надо отказаться от сравнения
//
строк, вместо этого высчитываем хэш и сравниваем по его значению
.
#define SimpleType_FromString(Enum) \
virtual
Enum
FromString
(
const
BSTR
&
bsValue
)
\
...
...
@@ -231,7 +231,7 @@ namespace SimpleTypes
return
;
}
//
//
Проверим последние два символа
CString
sUnit
=
sValue
.
Mid
(
sValue
.
GetLength
()
-
2
,
2
);
m_bUnit
=
true
;
...
...
@@ -282,11 +282,11 @@ namespace SimpleTypes
protected:
bool
m_bUnit
;
double
m_dValue
;
//
double
m_dValue
;
//
Значение в пунктах
};
//--------------------------------------------------------------------------------
//
CUniversalMeasure, -
.
//
Класс наследуемый от CUniversalMeasure, для которого обычные значения - пункты
.
//--------------------------------------------------------------------------------
class
CPoint
:
public
CUniversalMeasure
{
...
...
@@ -360,7 +360,7 @@ namespace SimpleTypes
//--------------------------------------------------------------------------------
//
CUniversalMeasure,
- emu.
//
Класс наследуемый от CUniversalMeasure, для которого обычные значения
- emu.
//--------------------------------------------------------------------------------
class
CEmu
:
public
CUniversalMeasure
{
...
...
@@ -398,6 +398,11 @@ namespace SimpleTypes
m_dValue
=
Emu_To_Pt
(
dValue
);
return
m_dValue
;
}
virtual
double
FromPx
(
double
dValue
)
{
m_dValue
=
Px_To_Pt
(
dValue
);
return
m_dValue
;
}
virtual
double
ToMm
()
{
return
Pt_To_Mm
(
m_dValue
);
...
...
@@ -406,6 +411,10 @@ namespace SimpleTypes
{
return
(
__int64
)
Pt_To_Emu
(
m_dValue
);
}
virtual
long
ToPx
()
{
return
(
long
)
Pt_To_Px
(
m_dValue
);
}
void
SetValue
(
double
dValue
)
{
m_dValue
=
dValue
;
...
...
@@ -421,7 +430,7 @@ namespace SimpleTypes
//--------------------------------------------------------------------------------
//
double
//
Класс читающий
double
//--------------------------------------------------------------------------------
class
CDouble
{
...
...
Common/DocxFormat/Source/DocxFormat/File.h
View file @
9f60ce0a
...
...
@@ -26,7 +26,7 @@ namespace OOX
virtual
const
OOX
::
FileType
type
()
const
=
0
;
virtual
const
CPath
DefaultDirectory
()
const
=
0
;
virtual
const
CPath
DefaultFileName
()
const
=
0
;
CString
m_sFilename
;
CString
m_s
Output
Filename
;
bool
m_bDoNotAddRels
;
};
class
FileGlobalEnumerated
:
public
File
...
...
@@ -49,4 +49,4 @@ namespace OOX
};
}
// namespace OOX
#endif // OOX_FILE_INCLUDE_H_
\ No newline at end of file
#endif // OOX_FILE_INCLUDE_H_
Common/DocxFormat/Source/DocxFormat/IFileContainer.cpp
View file @
9f60ce0a
#include "IFileContainer.h"
#
include
"IFileContainer.h"
#include "Rels.h"
#include "FileFactory.h"
#include "ContentTypes.h"
...
...
@@ -20,10 +20,10 @@ namespace OOX
void
IFileContainer
::
Read
(
const
OOX
::
CPath
&
oRootPath
,
const
OOX
::
CPath
&
oPath
)
{
//
()
//
Находим связи(рельсы) с данным файлом
OOX
::
CRels
oRels
(
oPath
);
//
//
Читаем все файлы по рельсам
Read
(
oRels
,
oRootPath
,
oPath
.
GetDirectory
()
);
}
...
...
@@ -65,6 +65,8 @@ namespace OOX
{
OOX
::
CPath
oDefDir
=
pFile
->
DefaultDirectory
();
OOX
::
CPath
oName
=
pFile
->
DefaultFileName
();
if
(
false
==
pFile
->
m_sOutputFilename
.
IsEmpty
())
oName
.
SetName
(
pFile
->
m_sOutputFilename
,
false
);
std
::
map
<
CString
,
size_t
>::
const_iterator
pNamePair
=
mNamePair
.
find
(
oName
.
m_strFilename
);
if
(
pNamePair
==
mNamePair
.
end
())
...
...
Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp
View file @
9f60ce0a
#include "Vml.h"
#
include
"Vml.h"
#include "VmlOfficeDrawing.h"
#include "Paragraph.h"
...
...
@@ -14,7 +14,7 @@
namespace
OOX
{
// TO DO:
:
// TO DO:
Нехватающие классы
:
// <w:altChunk>
// <w:customXml>
// <w:moveFrom>
...
...
@@ -26,7 +26,7 @@ namespace OOX
//--------------------------------------------------------------------------------
void
CTxbxContent
::
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
{
// TO DO: CTxbxContent::fromXML(XmlUtils::CXmlNode& oNode)
// TO DO:
Реализовать
CTxbxContent::fromXML(XmlUtils::CXmlNode& oNode)
}
void
CTxbxContent
::
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
...
...
@@ -279,11 +279,11 @@ namespace OOX
void
CVmlCommonElements
::
ReadAttributes
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
//
//
Выставляем значения по умолчанию
m_oHrPct
.
SetValue
(
0
);
m_oSpt
.
SetValue
(
0
);
//
//
Читаем атрибуты
if
(
oReader
.
GetAttributesCount
()
<=
0
)
return
;
...
...
@@ -555,7 +555,7 @@ namespace OOX
//--------------------------------------------------------------------------------
void
CGroup
::
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
{
// TO DO: CGroup::fromXML(XmlUtils::CXmlNode& oNode)
// TO DO:
Реализовать
CGroup::fromXML(XmlUtils::CXmlNode& oNode)
}
void
CGroup
::
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
...
...
@@ -899,7 +899,7 @@ namespace OOX
if
(
m_oPath
.
IsInit
()
)
sResult
+=
_T
(
"path=
\"
"
)
+
m_oPath
->
ToString
()
+
_T
(
"
\"
"
);
// TO DO:
o:gfxdata
// TO DO:
сделать запись
o:gfxdata
if
(
m_sEquationXML
.
IsInit
()
)
{
...
...
@@ -949,7 +949,7 @@ namespace OOX
void
CClientData
::
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
{
// TO DO: CShapeType::fromXML(XmlUtils::CXmlNode& oNode)
// TO DO:
Реализовать
CShapeType::fromXML(XmlUtils::CXmlNode& oNode)
}
void
CClientData
::
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
...
...
@@ -977,9 +977,13 @@ namespace OOX
}
CString
CClientData
::
toXML
()
const
{
CString
sResult
=
_T
(
"<x:ClientData
"
);
CString
sResult
=
_T
(
"<x:ClientData"
);
if
(
m_oObjectType
.
IsInit
())
{
sResult
+=
L" ObjectType=
\"
"
;
sResult
+=
m_oObjectType
->
ToString
();
sResult
+=
L"
\"
"
;
}
sResult
+=
_T
(
">"
);
if
(
m_oMoveWithCells
.
IsInit
()
&&
true
==
m_oMoveWithCells
->
ToBool
())
sResult
+=
_T
(
"<x:MoveWithCells/>"
);
...
...
@@ -1000,7 +1004,7 @@ namespace OOX
CString
sColumn
;
sColumn
.
Format
(
_T
(
"<x:Column>%d</x:Column>"
),
m_oColumn
.
get
().
GetValue
());
sResult
+=
sColumn
;
}
sResult
=
_T
(
"</x:ClientData>"
);
sResult
+
=
_T
(
"</x:ClientData>"
);
return
sResult
;
}
}
// Vml
...
...
Common/DocxFormat/Source/DocxFormat/Logic/Vml.h
View file @
9f60ce0a
This diff is collapsed.
Click to expand it.
Common/DocxFormat/Source/DocxFormat/Media/OleObject.h
View file @
9f60ce0a
...
...
@@ -3,15 +3,16 @@
#define OOX_OLE_OBJECT_INCLUDE_H_
#include "Media.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
namespace
OOX
{
class
OleObject
:
public
Media
{
public:
OleObject
()
OleObject
(
bool
bSpreadsheet_
=
false
)
{
bSpreadsheet
=
bSpreadsheet_
;
}
OleObject
(
const
OOX
::
CPath
&
filename
)
{
...
...
@@ -37,7 +38,8 @@ namespace OOX
public:
virtual
const
FileType
type
()
const
{
return
FileTypes
::
OleObject
;
if
(
bSpreadsheet
)
return
OOX
::
Spreadsheet
::
FileTypes
::
OleObject
;
else
return
OOX
::
FileTypes
::
OleObject
;
}
virtual
const
CPath
DefaultDirectory
()
const
{
...
...
@@ -47,7 +49,9 @@ namespace OOX
{
return
m_filename
.
GetFilename
();
}
private:
bool
bSpreadsheet
;
};
}
// namespace OOX
#endif // OOX_OLE_OBJECT_INCLUDE_H_
\ No newline at end of file
#endif // OOX_OLE_OBJECT_INCLUDE_H_
Common/DocxFormat/Source/DocxFormat/VmlDrawing.h
View file @
9f60ce0a
#pragma once
#
pragma
once
#ifndef OOX_VMLDRAWING_FILE_INCLUDE_H_
#define OOX_VMLDRAWING_FILE_INCLUDE_H_
...
...
@@ -15,7 +15,7 @@
namespace
OOX
{
//
VmlDrawing Xlsx,
//
в файле VmlDrawing могут быть как отобразительная часть комментариев Xlsx, так и просто обычные объекты
class
CVmlDrawing
:
public
OOX
::
WritingElementWithChilds
<
OOX
::
WritingElement
>
,
public
OOX
::
FileGlobalEnumerated
,
public
OOX
::
IFileContainer
{
...
...
@@ -24,13 +24,12 @@ namespace OOX
{
bSpreadsheet
=
bSpreadsheet_
;
m_mapComments
=
NULL
;
m_lObjectIdVML
=
0
;
}
CVmlDrawing
(
const
CPath
&
oRootPath
,
const
CPath
&
oPath
)
{
m_mapComments
=
NULL
;
read
(
oRootPath
,
oPath
);
m_sFilename
=
oPath
.
GetPath
();
}
virtual
~
CVmlDrawing
()
{
...
...
@@ -66,7 +65,7 @@ namespace OOX
ReadAttributes
(
oReader
);
CString
elementContent
;
bool
bReadyElement
=
false
;
//
bool
bReadyElement
=
false
;
//
собираем все до нахождения собственно элемента
if
(
!
oReader
.
IsEmptyNode
()
)
{
...
...
@@ -80,7 +79,7 @@ namespace OOX
strXml
.
Append
(
NodeContent
);
strXml
.
Append
(
_T
(
"</xml>"
));
XmlUtils
::
CXmlLiteReader
oSubReader
;
//
xml
XmlUtils
::
CXmlLiteReader
oSubReader
;
//
нам нужны xml и сами объекты
if
(
oSubReader
.
FromString
(
strXml
)
==
false
)
continue
;
oSubReader
.
ReadNextNode
();
...
...
@@ -91,7 +90,7 @@ namespace OOX
while
(
oSubReader
.
ReadNextSiblingNode
(
nStylesDepth1
)
)
//
{
CWCharWrapper
sName
=
oSubReader
.
GetName
();
switch
(
sName
[
0
])
//
..
switch
(
sName
[
0
])
//
вынесены только объекты
..
{
case
'v'
:
{
...
...
@@ -224,9 +223,10 @@ namespace OOX
}
virtual
void
read
(
const
CPath
&
oRootPath
,
const
CPath
&
oPath
)
{
m_oReadPath
=
oPath
;
IFileContainer
::
Read
(
oRootPath
,
oPath
);
//
xml -
//
так как это не совсем xml - поправим
CFile
file
;
if
(
file
.
OpenFile
(
oPath
.
GetPath
())
!=
S_OK
)
return
;
...
...
@@ -245,12 +245,12 @@ namespace OOX
if
(
fileContent
.
length
()
>
0
)
{
//
<br>
</br>
//
элементы вида <br> без
</br>
// test_vml4.xlsx
replace_all
(
fileContent
,
_T
(
"<br>"
),
_T
(
""
));
//
<![if ...]>, <![endif]>
//
элементы вида
<![if ...]>, <![endif]>
// Zigmunds.pptx
while
(
true
)
{
...
...
@@ -270,14 +270,19 @@ namespace OOX
virtual
void
write
(
const
CPath
&
oPath
,
const
CPath
&
oDirectory
,
CContentTypes
&
oContent
)
const
{
//for Comment SpreadsheetML only
if
(
NULL
!=
m_mapComments
&&
m_mapComments
->
size
()
>
0
)
if
(
(
NULL
!=
m_mapComments
&&
m_mapComments
->
size
()
>
0
)
||
m_aXml
.
size
()
>
0
)
{
XmlUtils
::
CStringWriter
sXml
;
sXml
.
WriteString
(
_T
(
"<xml xmlns:v=
\"
urn:schemas-microsoft-com:vml
\"
xmlns:o=
\"
urn:schemas-microsoft-com:office:office
\"
xmlns:x=
\"
urn:schemas-microsoft-com:office:excel
\"
><o:shapelayout v:ext=
\"
edit
\"
><o:idmap v:ext=
\"
edit
\"
data=
\"
1
\"
/></o:shapelayout><v:shapetype id=
\"
_x0000_t202
\"
coordsize=
\"
21600,21600
\"
o:spt=
\"
202
\"
path=
\"
m,l,21600r21600,l21600,xe
\"
><v:stroke joinstyle=
\"
miter
\"
/><v:path gradientshapeok=
\"
t
\"
o:connecttype=
\"
rect
\"
/></v:shapetype>"
));
int
nIndex
=
1025
;
for
(
std
::
map
<
CString
,
OOX
::
Spreadsheet
::
CCommentItem
*>::
const_iterator
it
=
m_mapComments
->
begin
();
it
!=
m_mapComments
->
end
();
++
it
)
for
(
size_t
i
=
0
;
i
<
m_aXml
.
size
();
++
i
)
{
sXml
.
WriteString
(
m_aXml
[
i
]);
}
long
nIndex
=
m_lObjectIdVML
;
if
(
NULL
!=
m_mapComments
&&
m_mapComments
->
size
()
>
0
)
{
for
(
std
::
map
<
CString
,
OOX
::
Spreadsheet
::
CCommentItem
*>::
const_iterator
it
=
m_mapComments
->
begin
();
it
!=
m_mapComments
->
end
();
++
it
)
{
OOX
::
Spreadsheet
::
CCommentItem
*
comment
=
it
->
second
;
CString
sStyle
;
if
(
comment
->
m_dLeftMM
.
IsInit
())
...
...
@@ -332,7 +337,7 @@ namespace OOX
if
(
comment
->
m_sGfxdata
.
IsInit
())
sGfxdata
.
Format
(
_T
(
"o:gfxdata=
\"
%ls
\"
"
),
comment
->
m_sGfxdata
.
get2
());
CString
sShape
;
sShape
.
Format
(
_T
(
"<v:shape id=
\"
_x0000_s%
d
\"
type=
\"
#_x0000_t202
\"
style='position:absolute;"
),
nIndex
);
sShape
.
Format
(
_T
(
"<v:shape id=
\"
_x0000_s%
04d
\"
type=
\"
#_x0000_t202
\"
style='position:absolute;"
),
nIndex
++
);
sShape
.
Append
(
sStyle
);
sShape
.
Append
(
_T
(
"z-index:4;visibility:hidden' "
));
sShape
.
Append
(
sGfxdata
);
...
...
@@ -340,7 +345,7 @@ namespace OOX
sShape
.
Append
(
sClientData
);
sShape
.
Append
(
_T
(
"</v:shape>"
));
sXml
.
WriteString
(
sShape
);
nIndex
++
;
}
}
sXml
.
WriteString
(
_T
(
"</xml>"
));
...
...
@@ -364,7 +369,7 @@ namespace OOX
}
const
CPath
GetReadPath
()
{
return
m_
sFilename
;
return
m_
oReadPath
;
}
private:
...
...
@@ -375,9 +380,13 @@ namespace OOX
bool
bSpreadsheet
;
public:
CPath
m_oReadPath
;
std
::
map
<
CString
,
OOX
::
Spreadsheet
::
CCommentItem
*>*
m_mapComments
;
std
::
map
<
CString
,
int
>
m_mapShapes
;
// id (_x0000_s1025)
std
::
map
<
CString
,
CString
>
m_mapShapesXml
;
// id (_x0000_s1025) xml OfficeDrawing
std
::
map
<
CString
,
int
>
m_mapShapes
;
//связь id (_x0000_s1025) с номером объекта для комментов
std
::
map
<
CString
,
CString
>
m_mapShapesXml
;
//связь id (_x0000_s1025) с xml для OfficeDrawing
std
::
vector
<
CString
>
m_aXml
;
long
m_lObjectIdVML
;
};
}
// namespace OOX
...
...
Common/DocxFormat/Source/XlsxFormat/Drawing/Image.h
View file @
9f60ce0a
...
...
@@ -27,7 +27,7 @@ namespace OOX
public:
virtual
void
write
(
const
CPath
&
filename
,
const
CPath
&
directory
,
CContentTypes
&
content
)
const
{
content
.
Registration
(
type
().
RelationType
(),
directory
,
filename
.
GetFilename
());
//
content.Registration(type().RelationType(), directory, filename.GetFilename());
}
public:
...
...
@@ -47,4 +47,4 @@ namespace OOX
}
}
// namespace OOX
#endif // OOX_SPREADSHEETIMAGE_INCLUDE_H_
\ No newline at end of file
#endif // OOX_SPREADSHEETIMAGE_INCLUDE_H_
Common/DocxFormat/Source/XlsxFormat/FileFactory_Spreadsheet.cpp
View file @
9f60ce0a
...
...
@@ -6,6 +6,7 @@
#include "../DocxFormat/Theme/Theme.h"
#include "../DocxFormat/Theme/ThemeOverride.h"
#include "../DocxFormat/VmlDrawing.h"
#include "../DocxFormat/Media/OleObject.h"
#include "SharedStrings/SharedStrings.h"
...
...
@@ -63,6 +64,8 @@ namespace OOX
return
smart_ptr
<
OOX
::
File
>
(
new
CExternalLink
(
oRootPath
,
oFileName
));
else
if
(
oRelation
.
Type
()
==
FileTypes
::
ExternalLinkPath
)
return
smart_ptr
<
OOX
::
File
>
(
new
ExternalLinkPath
(
oRelation
.
Target
()));
else
if
(
oRelation
.
Type
()
==
FileTypes
::
OleObject
)
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
OleObject
(
oFileName
));
return
smart_ptr
<
OOX
::
File
>
(
new
UnknowTypeFile
()
);
}
...
...
@@ -109,6 +112,8 @@ namespace OOX
return
smart_ptr
<
OOX
::
File
>
(
new
CExternalLink
(
oRootPath
,
oFileName
));
else
if
(
pRelation
->
Type
()
==
FileTypes
::
ExternalLinkPath
)
return
smart_ptr
<
OOX
::
File
>
(
new
ExternalLinkPath
(
oRelationFilename
));
else
if
(
pRelation
->
Type
()
==
FileTypes
::
OleObject
)
return
smart_ptr
<
OOX
::
File
>
(
new
OOX
::
OleObject
(
oFileName
));
return
smart_ptr
<
OOX
::
File
>
(
new
UnknowTypeFile
()
);
}
...
...
Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.h
View file @
9f60ce0a
...
...
@@ -70,6 +70,11 @@ namespace OOX
const
FileType
VmlDrawing
(
L"../drawings"
,
L"vmlDrawing.vml"
,
_T
(
""
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"
),
true
,
true
);
const
FileType
OleObject
(
L"../embeddings"
,
L"oleObject.bin"
,
_T
(
"application/vnd.openxmlformats-officedocument.oleObject"
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
),
true
,
true
);
}
// namespace FileTypes
}
}
// namespace OOX
...
...
Common/DocxFormat/Source/XlsxFormat/IFileContainer_Spreadsheet.cpp
View file @
9f60ce0a
//#include "stdafx.h"
//#include "stdafx.h"
#include "CommonInclude.h"
#include "IFileContainer_Spreadsheet.h"
...
...
@@ -21,11 +21,11 @@ namespace OOX
void
IFileContainer
::
Read
(
const
OOX
::
CPath
&
oRootPath
,
const
OOX
::
CPath
&
oPath
)
{
//
()
//
Находим связи(рельсы) с данным файлом
RELEASEOBJECT
(
m_pCurRels
);
m_pCurRels
=
new
OOX
::
CRels
(
oPath
);
//
//
Читаем все файлы по рельсам
Read
(
*
m_pCurRels
,
oRootPath
,
oPath
.
GetDirectory
()
);
}
...
...
@@ -61,14 +61,14 @@ namespace OOX
{
OOX
::
CPath
oDefDir
=
pFile
->
DefaultDirectory
();
OOX
::
CPath
oName
=
pFile
->
DefaultFileName
();
if
(
false
==
pFile
->
m_sFilename
.
IsEmpty
())
oName
.
SetName
(
pFile
->
m_sFilename
,
false
);
if
(
false
==
pFile
->
m_s
Output
Filename
.
IsEmpty
())
oName
.
SetName
(
pFile
->
m_s
Output
Filename
,
false
);
OOX
::
CSystemUtility
::
CreateDirectories
(
oCurrent
/
oDefDir
);
pFile
->
write
(
oCurrent
/
oDefDir
/
oName
,
oDir
/
oDefDir
,
oContent
);
if
(
true
!=
pFile
->
m_bDoNotAddRels
)
{
if
(
oDefDir
.
GetPath
().
GetLength
()
>
0
)
//todooo
CPath
if
(
oDefDir
.
GetPath
().
GetLength
()
>
0
)
//todooo
перенести в
CPath
oRels
.
Registration
(
pPair
->
first
,
pFile
->
type
(),
oDefDir
/
oName
);
else
oRels
.
Registration
(
pPair
->
first
,
pFile
->
type
(),
oName
);
...
...
@@ -269,7 +269,7 @@ namespace OOX
CString
sDigit
;
sDigit
.
Format
(
_T
(
"%d"
),
nIndex
);
sPath
.
Insert
(
nDotIndex
,
sDigit
);
}
pFile
->
m_sFilename
=
sPath
;
pFile
->
m_s
Output
Filename
=
sPath
;
if
(
true
==
bEnumeratedGlobal
)
m_mapEnumeratedGlobal
[
pFile
->
type
().
OverrideType
()]
=
nIndex
;
else
...
...
Common/DocxFormat/Source/XlsxFormat/Ole/OleObjects.h
0 → 100644
View file @
9f60ce0a
#pragma once
#ifndef OOX_OLEOBJECTS_FILE_INCLUDE_H_
#define OOX_OLEOBJECTS_FILE_INCLUDE_H_
#include "../CommonInclude.h"
namespace
OOX
{
namespace
Spreadsheet
{
class
COleObject
:
public
WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors
(
COleObject
)
COleObject
()
{
}
virtual
~
COleObject
()
{
}
public:
virtual
CString
toXML
()
const
{
return
_T
(
""
);
}
virtual
void
toXML
(
XmlUtils
::
CStringWriter
&
writer
)
const
{
CString
sRoot
;
writer
.
WriteString
(
CString
(
_T
(
"<oleObject"
)));
if
(
m_oProgId
.
IsInit
())
{
writer
.
WriteString
(
L" progId=
\"
"
);
writer
.
WriteEncodeXmlString
(
m_oProgId
.
get
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oDvAspect
.
IsInit
())
{
writer
.
WriteString
(
L" dvAspect=
\"
"
);
writer
.
WriteString
(
m_oDvAspect
->
ToString
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oLink
.
IsInit
())
{
writer
.
WriteString
(
L" link=
\"
"
);
writer
.
WriteEncodeXmlString
(
m_oLink
.
get
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oOleUpdate
.
IsInit
())
{
writer
.
WriteString
(
L" oleUpdate=
\"
"
);
writer
.
WriteString
(
m_oOleUpdate
->
ToString
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oAutoLoad
.
IsInit
())
{
writer
.
WriteString
(
L" autoLoad=
\"
"
);
writer
.
WriteString
(
m_oAutoLoad
->
ToString2
(
SimpleTypes
::
onofftostring1
));
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oShapeId
.
IsInit
())
{
writer
.
WriteString
(
L" shapeId=
\"
"
);
writer
.
WriteString
(
m_oShapeId
->
ToString
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oRid
.
IsInit
())
{
writer
.
WriteString
(
L" r:id=
\"
"
);
writer
.
WriteString
(
m_oRid
->
GetValue
());
writer
.
WriteString
(
L"
\"
"
);
}
writer
.
WriteString
(
CString
(
_T
(
"/>"
)));
}
void
toXMLPptx
(
XmlUtils
::
CStringWriter
&
writer
,
CString
qqq
)
const
{
CString
sRoot
;
writer
.
WriteString
(
CString
(
_T
(
"<o:OLEObject"
)));
if
(
m_oDvAspect
.
IsInit
())
{
writer
.
WriteString
(
L" DrawAspect=
\"
"
);
if
(
SimpleTypes
::
Spreadsheet
::
Content
==
m_oDvAspect
->
GetValue
())
writer
.
WriteString
(
L"Content"
);
else
writer
.
WriteString
(
L"Icon"
);
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oRid
.
IsInit
())
{
writer
.
WriteString
(
L" r:id=
\"
"
);
writer
.
WriteString
(
m_oRid
->
GetValue
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oProgId
.
IsInit
())
{
writer
.
WriteString
(
L" ProgID=
\"
"
);
writer
.
WriteEncodeXmlString
(
m_oProgId
.
get
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oShapeId
.
IsInit
())
{
writer
.
WriteString
(
L" ShapeID=
\"
"
);
writer
.
WriteString
(
m_oShapeId
->
ToString
());
writer
.
WriteString
(
L"
\"
"
);
}
writer
.
WriteString
(
L" Type=
\"
Embed
\"
"
);
if
(
m_oOleUpdate
.
IsInit
())
{
writer
.
WriteString
(
L" UpdateMode=
\"
"
);
if
(
SimpleTypes
::
Spreadsheet
::
Always
==
m_oOleUpdate
->
GetValue
())
writer
.
WriteString
(
L"Always"
);
else
writer
.
WriteString
(
L"OnCall"
);
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oFilepathBin
.
IsInit
())
{
writer
.
WriteString
(
L" pathbin=
\"
"
);
writer
.
WriteEncodeXmlString
(
m_oFilepathBin
.
get
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oFilepathImg
.
IsInit
())
{
writer
.
WriteString
(
L" pathimg=
\"
"
);
writer
.
WriteEncodeXmlString
(
m_oFilepathImg
.
get
());
writer
.
WriteString
(
L"
\"
"
);
}
if
(
m_oRidImg
.
IsInit
())
{
writer
.
WriteString
(
L" idimg=
\"
"
);
writer
.
WriteString
(
m_oRidImg
->
GetValue
());
writer
.
WriteString
(
L"
\"
"
);
}
writer
.
WriteString
(
CString
(
_T
(
"/>"
)));
}
virtual
void
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
ReadAttributes
(
oReader
);
if
(
oReader
.
IsEmptyNode
()
)
return
;
//todo objectPr
oReader
.
ReadTillEnd
();
}
virtual
EElementType
getType
()
const
{
return
et_OleObject
;
}
private:
void
ReadAttributes
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start
(
oReader
)
WritingElement_ReadAttributes_Read_if
(
oReader
,
_T
(
"progId"
),
m_oProgId
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"dvAspect"
),
m_oDvAspect
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"link"
),
m_oLink
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"oleUpdate"
),
m_oOleUpdate
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"autoLoad"
),
m_oAutoLoad
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"shapeId"
),
m_oShapeId
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"r:id"
),
m_oRid
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"pathbin"
),
m_oFilepathBin
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"pathimg"
),
m_oFilepathImg
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"idimg"
),
m_oRidImg
)
WritingElement_ReadAttributes_End
(
oReader
)
}
public:
nullable
<
CString
>
m_oProgId
;
nullable
<
SimpleTypes
::
Spreadsheet
::
ST_DvAspect
<>
>
m_oDvAspect
;
nullable
<
CString
>
m_oLink
;
nullable
<
SimpleTypes
::
Spreadsheet
::
ST_OleUpdate
<>
>
m_oOleUpdate
;
nullable
<
SimpleTypes
::
COnOff
<>
>
m_oAutoLoad
;
nullable
<
SimpleTypes
::
CUnsignedDecimalNumber
<>
>
m_oShapeId
;
nullable
<
SimpleTypes
::
CRelationshipId
>
m_oRid
;
//internal
nullable
<
CString
>
m_oFilepathBin
;
nullable
<
CString
>
m_oFilepathImg
;
nullable
<
SimpleTypes
::
CRelationshipId
>
m_oRidImg
;
};
class
COleObjects
:
public
WritingElement
{
public:
WritingElementSpreadsheet_AdditionConstructors
(
COleObjects
)
COleObjects
()
{
}
virtual
~
COleObjects
()
{
for
(
std
::
map
<
int
,
COleObject
*>::
const_iterator
it
=
m_mapOleObjects
.
begin
();
it
!=
m_mapOleObjects
.
end
();
it
++
)
{
delete
it
->
second
;
}
m_mapOleObjects
.
clear
();
}
public:
virtual
CString
toXML
()
const
{
return
_T
(
""
);
}
virtual
void
toXML
(
XmlUtils
::
CStringWriter
&
writer
)
const
{
if
(
m_mapOleObjects
.
size
()
>
0
)
{
writer
.
WriteString
(
L"<oleObjects>"
);
for
(
std
::
map
<
int
,
COleObject
*>::
const_iterator
it
=
m_mapOleObjects
.
begin
();
it
!=
m_mapOleObjects
.
end
();
it
++
)
{
it
->
second
->
toXML
(
writer
);
}
writer
.
WriteString
(
CString
(
_T
(
"</oleObjects>"
)));
}
}
virtual
void
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
ReadAttributes
(
oReader
);
if
(
oReader
.
IsEmptyNode
()
)
return
;
int
nCurDepth
=
oReader
.
GetDepth
();
while
(
oReader
.
ReadNextSiblingNode
(
nCurDepth
)
)
{
CString
sName
=
XmlUtils
::
GetNameNoNS
(
oReader
.
GetName
());
if
(
_T
(
"oleObject"
)
==
sName
)
{
COleObject
*
pOleObject
=
new
COleObject
(
oReader
);
if
(
pOleObject
->
m_oShapeId
.
IsInit
())
{
m_mapOleObjects
[
pOleObject
->
m_oShapeId
->
GetValue
()]
=
pOleObject
;
}
else
{
delete
pOleObject
;
}
}
else
if
(
_T
(
"AlternateContent"
)
==
sName
)
{
int
nSubDepth
=
oReader
.
GetDepth
();
while
(
oReader
.
ReadNextSiblingNode
(
nSubDepth
)
)
{
CString
sSubName
=
XmlUtils
::
GetNameNoNS
(
oReader
.
GetName
());
if
(
_T
(
"Fallback"
)
==
sSubName
||
_T
(
"Choice"
)
==
sSubName
)
{
int
nSubSubDepth
=
oReader
.
GetDepth
();
while
(
oReader
.
ReadNextSiblingNode
(
nSubSubDepth
)
)
{
CString
sSubSubName
=
XmlUtils
::
GetNameNoNS
(
oReader
.
GetName
());
if
(
_T
(
"oleObject"
)
==
sSubSubName
)
{
COleObject
*
pOleObject
=
new
COleObject
(
oReader
);
if
(
pOleObject
->
m_oShapeId
.
IsInit
())
{
m_mapOleObjects
[
pOleObject
->
m_oShapeId
->
GetValue
()]
=
pOleObject
;
}
else
{
delete
pOleObject
;
}
m_mapOleObjects
[
pOleObject
->
m_oShapeId
->
GetValue
()]
=
pOleObject
;
}
}
}
}
}
}
}
virtual
EElementType
getType
()
const
{
return
et_OleObjects
;
}
private:
void
ReadAttributes
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
}
public:
std
::
map
<
int
,
COleObject
*>
m_mapOleObjects
;
};
}
//Spreadsheet
}
// namespace OOX
#endif // OOX_OLEOBJECTS_FILE_INCLUDE_H_
Common/DocxFormat/Source/XlsxFormat/SimpleTypes_Spreadsheet.h
View file @
9f60ce0a
...
...
@@ -2357,6 +2357,70 @@ namespace SimpleTypes
SimpleType_FromString
(
ESparklineAxisMinMax
)
SimpleType_Operator_Equal
(
ST_SparklineAxisMinMax
)
};
enum
EDvAspect
{
Content
=
0
,
Icon
=
1
};
template
<
EDvAspect
eDefValue
=
Icon
>
class
ST_DvAspect
:
public
CSimpleType
<
EDvAspect
,
eDefValue
>
{
public:
ST_DvAspect
()
{}
virtual
EDvAspect
FromString
(
CString
&
sValue
)
{
if
(
_T
(
"DVASPECT_CONTENT"
)
==
sValue
)
this
->
m_eValue
=
Content
;
else
if
(
_T
(
"DVASPECT_ICON"
)
==
sValue
)
this
->
m_eValue
=
Icon
;
else
this
->
m_eValue
=
eDefValue
;
return
this
->
m_eValue
;
}
virtual
CString
ToString
()
const
{
switch
(
this
->
m_eValue
)
{
case
Content
:
return
_T
(
"DVASPECT_CONTENT"
);
break
;
case
Icon
:
return
_T
(
"DVASPECT_ICON"
);
break
;
default:
return
_T
(
"DVASPECT_CONTENT"
);
}
}
SimpleType_FromString
(
EDvAspect
)
SimpleType_Operator_Equal
(
ST_DvAspect
)
};
enum
EOleUpdate
{
Always
=
0
,
OnCall
=
1
};
template
<
EOleUpdate
eDefValue
=
Always
>
class
ST_OleUpdate
:
public
CSimpleType
<
EOleUpdate
,
eDefValue
>
{
public:
ST_OleUpdate
()
{}
virtual
EOleUpdate
FromString
(
CString
&
sValue
)
{
if
(
_T
(
"OLEUPDATE_ALWAYS"
)
==
sValue
)
this
->
m_eValue
=
Always
;
else
if
(
_T
(
"OLEUPDATE_ONCALL"
)
==
sValue
)
this
->
m_eValue
=
OnCall
;
else
this
->
m_eValue
=
eDefValue
;
return
this
->
m_eValue
;
}
virtual
CString
ToString
()
const
{
switch
(
this
->
m_eValue
)
{
case
Always
:
return
_T
(
"OLEUPDATE_ALWAYS"
);
break
;
case
OnCall
:
return
_T
(
"OLEUPDATE_ONCALL"
);
break
;
default:
return
_T
(
"OLEUPDATE_ALWAYS"
);
}
}
SimpleType_FromString
(
EOleUpdate
)
SimpleType_Operator_Equal
(
ST_OleUpdate
)
};
};
// Spreadsheet
}
// SimpleTypes
Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h
View file @
9f60ce0a
...
...
@@ -19,6 +19,7 @@
#include "../Chart/Chart.h"
#include "../Table/Table.h"
#include "../Comments/Comments.h"
#include "../Ole/OleObjects.h"
namespace
OOX
{
...
...
@@ -122,6 +123,8 @@ namespace OOX
m_oTableParts
=
oReader
;
else
if
(
_T
(
"legacyDrawing"
)
==
sName
)
m_oLegacyDrawingWorksheet
=
oReader
;
else
if
(
_T
(
"oleObjects"
)
==
sName
)
m_oOleObjects
=
oReader
;
else
if
(
_T
(
"sheetPr"
)
==
sName
)
m_oSheetPr
=
oReader
;
else
if
(
_T
(
"extLst"
)
==
sName
)
...
...
@@ -202,29 +205,18 @@ namespace OOX
CCommentItem
*
pCommentItem
=
pPair
->
second
;
if
(
pShape
->
m_oGfxData
.
IsInit
())
pCommentItem
->
m_sGfxdata
=
pShape
->
m_oGfxData
.
get2
();
if
(
pClientData
->
m_oAnchor
.
IsInit
())
std
::
vector
<
int
>
m_aAnchor
;
pClientData
->
getAnchorArray
(
m_aAnchor
);
if
(
8
==
m_aAnchor
.
size
())
{
const
CString
&
sAnchor
=
pClientData
->
m_oAnchor
.
get
();
std
::
vector
<
int
>
m_aAnchor
;
int
nTokenPos
=
0
;
CString
strToken
=
sAnchor
.
Tokenize
(
_T
(
","
),
nTokenPos
);
while
(
!
strToken
.
IsEmpty
())
{
strToken
.
Trim
();
m_aAnchor
.
push_back
(
_wtoi
(
strToken
));
strToken
=
sAnchor
.
Tokenize
(
_T
(
","
),
nTokenPos
);
}
if
(
8
==
m_aAnchor
.
size
())
{
pCommentItem
->
m_nLeft
=
m_aAnchor
[
0
];
pCommentItem
->
m_nLeftOffset
=
m_aAnchor
[
1
];
pCommentItem
->
m_nTop
=
m_aAnchor
[
2
];
pCommentItem
->
m_nTopOffset
=
m_aAnchor
[
3
];
pCommentItem
->
m_nRight
=
m_aAnchor
[
4
];
pCommentItem
->
m_nRightOffset
=
m_aAnchor
[
5
];
pCommentItem
->
m_nBottom
=
m_aAnchor
[
6
];
pCommentItem
->
m_nBottomOffset
=
m_aAnchor
[
7
];
}
pCommentItem
->
m_nLeft
=
m_aAnchor
[
0
];
pCommentItem
->
m_nLeftOffset
=
m_aAnchor
[
1
];
pCommentItem
->
m_nTop
=
m_aAnchor
[
2
];
pCommentItem
->
m_nTopOffset
=
m_aAnchor
[
3
];
pCommentItem
->
m_nRight
=
m_aAnchor
[
4
];
pCommentItem
->
m_nRightOffset
=
m_aAnchor
[
5
];
pCommentItem
->
m_nBottom
=
m_aAnchor
[
6
];
pCommentItem
->
m_nBottomOffset
=
m_aAnchor
[
7
];
}
if
(
pClientData
->
m_oMoveWithCells
.
IsInit
())
...
...
@@ -336,6 +328,8 @@ namespace OOX
m_oDrawing
->
toXML
(
sXml
);
if
(
m_oLegacyDrawingWorksheet
.
IsInit
())
m_oLegacyDrawingWorksheet
->
toXML
(
sXml
);
if
(
m_oOleObjects
.
IsInit
())
m_oOleObjects
->
toXML
(
sXml
);
if
(
m_oTableParts
.
IsInit
())
m_oTableParts
->
toXML
(
sXml
);
if
(
m_oExtLst
.
IsInit
())
...
...
@@ -358,7 +352,7 @@ namespace OOX
{
return
type
().
DefaultFileName
();
}
const
CPath
&
GetReadPath
()
const
CPath
&
GetReadPath
()
const
{
return
m_oReadPath
;
}
...
...
@@ -504,6 +498,7 @@ namespace OOX
nullable
<
OOX
::
Spreadsheet
::
CAutofilter
>
m_oAutofilter
;
nullable
<
OOX
::
Spreadsheet
::
CTableParts
>
m_oTableParts
;
nullable
<
OOX
::
Spreadsheet
::
CLegacyDrawingWorksheet
>
m_oLegacyDrawingWorksheet
;
nullable
<
OOX
::
Spreadsheet
::
COleObjects
>
m_oOleObjects
;
std
::
map
<
CString
,
CCommentItem
*>
m_mapComments
;
std
::
vector
<
OOX
::
Spreadsheet
::
CConditionalFormatting
*>
m_arrConditionalFormatting
;
nullable
<
OOX
::
Spreadsheet
::
CSheetPr
>
m_oSheetPr
;
...
...
Common/DocxFormat/Source/XlsxFormat/WritingElement.h
View file @
9f60ce0a
...
...
@@ -273,6 +273,8 @@ namespace Spreadsheet
et_c_SeriesShapeOutline
,
et_xdr_GraphicFrame
,
et_xdr_GraphicData
,
et_OleObjects
,
et_OleObject
,
et_TableParts
,
et_TablePart
,
et_Table
,
...
...
XlsxSerializerCom/Reader/BinaryWriter.h
View file @
9f60ce0a
...
...
@@ -6,6 +6,7 @@
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Drawing/DrawingColors.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/OfficeFileFormats.h"
#include "../../Common/Base64.h"
...
...
@@ -1737,7 +1738,7 @@ namespace BinXlsxRW {
m_pOfficeDrawingConverter
->
SetRelsPath
(
sDrawingRelsPath
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerWorksheetsTypes
::
Drawings
);
WriteDrawings
(
pDrawing
,
sDrawingRelsPath
,
currentVmlDrawing
);
WriteDrawings
(
oWorksheet
,
pDrawing
,
sDrawingRelsPath
,
currentVmlDrawing
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
m_pOfficeDrawingConverter
->
SetRelsPath
(
sOldRelsPath
);
...
...
@@ -2382,22 +2383,109 @@ namespace BinXlsxRW {
}
};
void
WriteDrawings
(
OOX
::
Spreadsheet
::
CDrawing
*
pDrawing
,
CString
&
sDrawingRelsPath
,
OOX
::
CVmlDrawing
*
pVmlDrawing
=
NULL
)
void
WriteDrawings
(
const
OOX
::
Spreadsheet
::
CWorksheet
&
oWorksheet
,
OOX
::
Spreadsheet
::
CDrawing
*
pDrawing
,
CString
&
sDrawingRelsPath
,
OOX
::
CVmlDrawing
*
pVmlDrawing
=
NULL
)
{
int
nCurPos
;
for
(
int
i
=
0
,
length
=
pDrawing
->
m_arrItems
.
size
();
i
<
length
;
++
i
)
{
OOX
::
Spreadsheet
::
CCellAnchor
&
pCellAnchor
=
*
pDrawing
->
m_arrItems
[
i
];
if
(
pCellAnchor
.
isValid
())
//OleObject пишутся в новом drawing и старом legacyDrawing, мы используем legacyDrawing, поэтому пропускаем shape из drawing
bool
bShapeOle
=
false
;
if
(
oWorksheet
.
m_oOleObjects
.
IsInit
()
&&
pCellAnchor
.
m_oShape
.
IsInit
()
&&
pCellAnchor
.
m_oShape
->
m_oNvSpPr
.
IsInit
()
&&
pCellAnchor
.
m_oShape
->
m_oNvSpPr
->
m_oCNvPr
.
IsInit
()
&&
pCellAnchor
.
m_oShape
->
m_oNvSpPr
->
m_oCNvPr
->
m_oId
.
IsInit
()
)
{
int
id
=
pCellAnchor
.
m_oShape
->
m_oNvSpPr
->
m_oCNvPr
->
m_oId
->
GetValue
();
std
::
map
<
int
,
COleObject
*>::
const_iterator
itFind
=
oWorksheet
.
m_oOleObjects
->
m_mapOleObjects
.
find
(
id
);
if
(
itFind
!=
oWorksheet
.
m_oOleObjects
->
m_mapOleObjects
.
end
())
{
bShapeOle
=
true
;
}
}
if
(
!
bShapeOle
&&
pCellAnchor
.
isValid
())
{
//Drawing
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerWorksheetsTypes
::
Drawing
);
WriteDrawing
(
pDrawing
,
pCellAnchor
,
sDrawingRelsPath
,
pVmlDrawing
);
WriteDrawing
(
oWorksheet
,
pDrawing
,
pCellAnchor
,
sDrawingRelsPath
,
pVmlDrawing
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
}
//OleObjects
if
(
NULL
!=
pVmlDrawing
&&
oWorksheet
.
m_oOleObjects
.
IsInit
())
{
for
(
std
::
map
<
int
,
COleObject
*>::
const_iterator
it
=
oWorksheet
.
m_oOleObjects
->
m_mapOleObjects
.
begin
();
it
!=
oWorksheet
.
m_oOleObjects
->
m_mapOleObjects
.
end
();
++
it
)
{
OOX
::
Spreadsheet
::
COleObject
*
pOleObject
=
it
->
second
;
if
(
pOleObject
->
m_oShapeId
.
IsInit
())
{
CString
sShapeId
=
_T
(
""
);
sShapeId
.
Format
(
_T
(
"_x0000_s%04d"
),
pOleObject
->
m_oShapeId
->
GetValue
());
std
::
map
<
CString
,
CString
>::
iterator
pFind
=
pVmlDrawing
->
m_mapShapesXml
.
find
(
sShapeId
);
if
(
pFind
!=
pVmlDrawing
->
m_mapShapesXml
.
end
())
{
//ищем shape как обьект, чтобы обработать ClientData
for
(
size_t
i
=
0
;
i
<
pVmlDrawing
->
m_arrItems
.
size
();
++
i
)
{
OOX
::
WritingElement
*
pElem
=
pVmlDrawing
->
m_arrItems
[
i
];
if
(
OOX
::
et_v_shape
==
pElem
->
getType
())
{
OOX
::
Vml
::
CShape
*
pShape
=
static_cast
<
OOX
::
Vml
::
CShape
*>
(
pElem
);
if
((
pShape
->
m_sSpId
.
IsInit
()
&&
sShapeId
==
pShape
->
m_sSpId
.
get
())
||
(
pShape
->
m_sId
.
IsInit
()
&&
sShapeId
==
pShape
->
m_sId
.
get
()))
{
for
(
size_t
j
=
0
;
j
<
pShape
->
m_arrItems
.
size
();
++
j
)
{
OOX
::
WritingElement
*
pElemShape
=
pShape
->
m_arrItems
[
j
];
if
(
OOX
::
et_v_ClientData
==
pElemShape
->
getType
())
{
//преобразуем ClientData в CellAnchor
OOX
::
Vml
::
CClientData
*
pClientData
=
static_cast
<
OOX
::
Vml
::
CClientData
*>
(
pElemShape
);
std
::
vector
<
int
>
m_aAnchor
;
pClientData
->
getAnchorArray
(
m_aAnchor
);
if
(
8
==
m_aAnchor
.
size
())
{
SimpleTypes
::
Spreadsheet
::
CCellAnchorType
<>
eAnchorType
;
eAnchorType
.
SetValue
(
SimpleTypes
::
Spreadsheet
::
cellanchorTwoCell
);
OOX
::
Spreadsheet
::
CCellAnchor
oCellAnchor
=
OOX
::
Spreadsheet
::
CCellAnchor
(
eAnchorType
);
oCellAnchor
.
m_sSpId
.
Init
();
oCellAnchor
.
m_sSpId
->
Append
(
sShapeId
);
oCellAnchor
.
m_oFrom
.
Init
();
oCellAnchor
.
m_oFrom
->
m_oCol
.
Init
();
oCellAnchor
.
m_oFrom
->
m_oCol
->
SetValue
(
m_aAnchor
[
0
]);
oCellAnchor
.
m_oFrom
->
m_oColOff
.
Init
();
oCellAnchor
.
m_oFrom
->
m_oColOff
->
FromPx
(
m_aAnchor
[
1
]);
oCellAnchor
.
m_oFrom
->
m_oRow
.
Init
();
oCellAnchor
.
m_oFrom
->
m_oRow
->
SetValue
(
m_aAnchor
[
2
]);
oCellAnchor
.
m_oFrom
->
m_oRowOff
.
Init
();
oCellAnchor
.
m_oFrom
->
m_oRowOff
->
FromPx
(
m_aAnchor
[
3
]);
oCellAnchor
.
m_oTo
.
Init
();
oCellAnchor
.
m_oTo
->
m_oCol
.
Init
();
oCellAnchor
.
m_oTo
->
m_oCol
->
SetValue
(
m_aAnchor
[
4
]);
oCellAnchor
.
m_oTo
->
m_oColOff
.
Init
();
oCellAnchor
.
m_oTo
->
m_oColOff
->
FromPx
(
m_aAnchor
[
5
]);
oCellAnchor
.
m_oTo
->
m_oRow
.
Init
();
oCellAnchor
.
m_oTo
->
m_oRow
->
SetValue
(
m_aAnchor
[
6
]);
oCellAnchor
.
m_oTo
->
m_oRowOff
.
Init
();
oCellAnchor
.
m_oTo
->
m_oRowOff
->
FromPx
(
m_aAnchor
[
7
]);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerWorksheetsTypes
::
Drawing
);
WriteDrawing
(
oWorksheet
,
pDrawing
,
oCellAnchor
,
sDrawingRelsPath
,
pVmlDrawing
,
pOleObject
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
break
;
}
}
break
;
}
}
}
}
}
}
}
};
void
WriteDrawing
(
OOX
::
Spreadsheet
::
CDrawing
*
pDrawing
,
OOX
::
Spreadsheet
::
CCellAnchor
&
pCellAnchor
,
CString
&
sDrawingRelsPath
,
OOX
::
CVmlDrawing
*
pVmlDrawing
=
NULL
)
void
WriteDrawing
(
const
OOX
::
Spreadsheet
::
CWorksheet
&
oWorksheet
,
OOX
::
Spreadsheet
::
CDrawing
*
pDrawing
,
OOX
::
Spreadsheet
::
CCellAnchor
&
pCellAnchor
,
CString
&
sDrawingRelsPath
,
OOX
::
CVmlDrawing
*
pVmlDrawing
=
NULL
,
OOX
::
Spreadsheet
::
COleObject
*
pOleObject
=
NULL
)
{
//Type
int
nCurPos
;
...
...
@@ -2438,7 +2526,7 @@ namespace BinXlsxRW {
{
bstrXml
=
*
pCellAnchor
.
m_oXml
;
}
else
if
(
pCellAnchor
.
m_sSpId
.
IsInit
()
&&
pVmlDrawing
)
else
if
(
pCellAnchor
.
m_sSpId
.
IsInit
()
&&
pVmlDrawing
)
{
std
::
map
<
CString
,
CString
>::
iterator
pFind
=
pVmlDrawing
->
m_mapShapesXml
.
find
(
pCellAnchor
.
m_sSpId
.
get2
());
if
(
pFind
!=
pVmlDrawing
->
m_mapShapesXml
.
end
())
...
...
@@ -2449,10 +2537,24 @@ namespace BinXlsxRW {
CString
temp
=
_T
(
"<v:object>"
);
temp
.
Append
(
pFind
->
second
);
if
(
NULL
!=
pOleObject
)
{
//ищем физический файл, потому что rId относительно sheet.xml, а SetRelsPath(pVmlDrawing
smart_ptr
<
OOX
::
File
>
pFile
=
oWorksheet
.
Find
(
OOX
::
RId
(
pOleObject
->
m_oRid
->
GetValue
()));
if
(
pFile
.
IsInit
()
&&
OOX
::
FileTypes
::
OleObject
==
pFile
->
type
())
{
OOX
::
OleObject
*
pOleObjectFile
=
static_cast
<
OOX
::
OleObject
*>
(
pFile
.
operator
->
());
XmlUtils
::
CStringWriter
writer
;
pOleObject
->
m_oFilepathBin
.
Init
();
pOleObject
->
m_oFilepathBin
->
Append
(
pOleObjectFile
->
filename
().
GetPath
());
pOleObject
->
toXMLPptx
(
writer
,
L""
);
temp
.
Append
(
writer
.
GetData
());
}
}
temp
.
Append
(
_T
(
"</v:object>"
));
CString
keepRels
=
m_pOfficeDrawingConverter
->
GetRelsPath
();
m_pOfficeDrawingConverter
->
SetRelsPath
(
pVmlDrawing
->
m_sFilename
);
m_pOfficeDrawingConverter
->
SetRelsPath
(
pVmlDrawing
->
GetReadPath
().
GetPath
()
);
HRESULT
hRes
=
m_pOfficeDrawingConverter
->
AddObject
(
temp
,
&
bstrOutputXml
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
...
...
XlsxSerializerCom/Writer/BinaryReader.h
View file @
9f60ce0a
This diff is collapsed.
Click to expand it.
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