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
e3f331c1
Commit
e3f331c1
authored
Sep 28, 2016
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open/save math spreadsheet and presentation
parent
e70a2677
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
644 additions
and
141 deletions
+644
-141
ASCOfficeDocxFile2/BinReader/FileWriter.h
ASCOfficeDocxFile2/BinReader/FileWriter.h
+2
-2
ASCOfficeDocxFile2/BinReader/Readers.h
ASCOfficeDocxFile2/BinReader/Readers.h
+11
-0
ASCOfficeDocxFile2/BinReader/fontTableWriter.h
ASCOfficeDocxFile2/BinReader/fontTableWriter.h
+14
-10
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
+3
-2
ASCOfficeDocxFile2/BinWriter/BinWriters.cpp
ASCOfficeDocxFile2/BinWriter/BinWriters.cpp
+94
-0
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+6
-57
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
+65
-9
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h
+8
-2
ASCOfficeDocxFile2/Linux/ASCOfficeDocxFile2Lib.pro
ASCOfficeDocxFile2/Linux/ASCOfficeDocxFile2Lib.pro
+1
-0
ASCOfficePPTXFile/Editor/BinReaderWriterDefines.h
ASCOfficePPTXFile/Editor/BinReaderWriterDefines.h
+2
-0
ASCOfficePPTXFile/PPTXFormat/Comments.h
ASCOfficePPTXFile/PPTXFormat/Comments.h
+3
-1
ASCOfficePPTXFile/PPTXFormat/HandoutMaster.h
ASCOfficePPTXFile/PPTXFormat/HandoutMaster.h
+3
-1
ASCOfficePPTXFile/PPTXFormat/Logic/Paragraph.h
ASCOfficePPTXFile/PPTXFormat/Logic/Paragraph.h
+22
-2
ASCOfficePPTXFile/PPTXFormat/Logic/RunElem.h
ASCOfficePPTXFile/PPTXFormat/Logic/RunElem.h
+4
-1
ASCOfficePPTXFile/PPTXFormat/Logic/Runs/MathParaWrapper.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Runs/MathParaWrapper.cpp
+194
-0
ASCOfficePPTXFile/PPTXFormat/Logic/Runs/MathParaWrapper.h
ASCOfficePPTXFile/PPTXFormat/Logic/Runs/MathParaWrapper.h
+77
-0
ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.cpp
+19
-17
ASCOfficePPTXFile/PPTXFormat/NotesMaster.h
ASCOfficePPTXFile/PPTXFormat/NotesMaster.h
+4
-0
ASCOfficePPTXFile/PPTXFormat/NotesSlide.h
ASCOfficePPTXFile/PPTXFormat/NotesSlide.h
+5
-1
ASCOfficePPTXFile/PPTXFormat/Presentation.h
ASCOfficePPTXFile/PPTXFormat/Presentation.h
+5
-1
ASCOfficePPTXFile/PPTXFormat/Slide.h
ASCOfficePPTXFile/PPTXFormat/Slide.h
+4
-0
ASCOfficePPTXFile/PPTXFormat/SlideLayout.h
ASCOfficePPTXFile/PPTXFormat/SlideLayout.h
+4
-0
ASCOfficePPTXFile/PPTXFormat/SlideMaster.h
ASCOfficePPTXFile/PPTXFormat/SlideMaster.h
+4
-0
ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/PPTXFormatLib.pro
...icePPTXFile/PPTXLib/Linux/PPTXFormatLib/PPTXFormatLib.pro
+2
-0
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
+3
-1
Common/DocxFormat/Source/DocxFormat/Math/OMath.h
Common/DocxFormat/Source/DocxFormat/Math/OMath.h
+1
-20
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.cpp
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.cpp
+4
-1
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h
+36
-9
Common/DocxFormat/Source/XML/Utils.h
Common/DocxFormat/Source/XML/Utils.h
+26
-1
Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h
Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h
+17
-2
Common/DocxFormat/Source/XlsxFormat/Drawing/Drawing.h
Common/DocxFormat/Source/XlsxFormat/Drawing/Drawing.h
+1
-1
No files found.
ASCOfficeDocxFile2/BinReader/FileWriter.h
View file @
e3f331c1
...
...
@@ -76,9 +76,9 @@ namespace Writers
int
m_nDocPrIndex
;
BinDocxRW
::
CComments
*
m_pComments
;
public:
FileWriter
(
CString
sDirOutput
,
CString
sFontDir
,
int
nVersion
,
bool
bSaveChartAsImg
,
NSBinPptxRW
::
CDrawingConverter
*
pDrawingConverter
,
CString
sThemePath
)
:
FileWriter
(
CString
sDirOutput
,
CString
sFontDir
,
bool
bNoFontDir
,
int
nVersion
,
bool
bSaveChartAsImg
,
NSBinPptxRW
::
CDrawingConverter
*
pDrawingConverter
,
CString
sThemePath
)
:
m_pDrawingConverter
(
pDrawingConverter
),
m_sThemePath
(
sThemePath
),
m_bSaveChartAsImg
(
bSaveChartAsImg
),
m_oContentTypesWriter
(
sDirOutput
),
m_oFontTableWriter
(
sDirOutput
,
sFontDir
),
m_oContentTypesWriter
(
sDirOutput
),
m_oFontTableWriter
(
sDirOutput
,
sFontDir
,
bNoFontDir
),
m_oHeaderFooterWriter
(
sDirOutput
,
m_oContentTypesWriter
),
m_oFootnotesWriter
(
sDirOutput
,
m_oContentTypesWriter
),
m_oEndnotesWriter
(
sDirOutput
,
m_oContentTypesWriter
),
...
...
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
e3f331c1
...
...
@@ -5402,6 +5402,17 @@ public:
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadMathMRPr
,
this
,
poResult
);
GetRunStringWriter
().
WriteString
(
CString
(
_T
(
"</m:rPr>"
)));
}
else
if
(
c_oSer_OMathContentType
::
ARPr
==
type
)
{
PPTX
::
Logic
::
RunProperties
rPr
;
m_oBufferedStream
.
Skip
(
1
);
//skip type
rPr
.
fromPPTY
(
&
m_oBufferedStream
);
rPr
.
m_name
=
L"a:rPr"
;
//todo use one writer
NSBinPptxRW
::
CXmlWriter
oWriter
;
rPr
.
toXmlWriter
(
&
oWriter
);
GetRunStringWriter
().
WriteString
(
oWriter
.
GetXmlString
());
}
else
if
(
c_oSer_OMathContentType
::
pagebreak
==
type
)
{
GetRunStringWriter
().
WriteString
(
CString
(
_T
(
"<w:br w:type=
\"
page
\"
/>"
)));
...
...
ASCOfficeDocxFile2/BinReader/fontTableWriter.h
View file @
e3f331c1
...
...
@@ -49,19 +49,23 @@ namespace Writers
public:
std
::
map
<
CString
,
int
>
m_mapFonts
;
public:
FontTableWriter
(
CString
sDir
,
CString
sFontDir
)
:
m_sDir
(
sDir
)
FontTableWriter
(
CString
sDir
,
CString
sFontDir
,
bool
bNoFontDir
)
:
m_sDir
(
sDir
)
{
if
(
sFontDir
.
IsEmpty
())
m_oApplicationFonts
.
Initialize
();
else
m_oApplicationFonts
.
InitializeFromFolder
(
string2std_string
(
sFontDir
));
CFontList
*
pFontList
=
m_oApplicationFonts
.
GetList
();
if
(
NULL
!=
pFontList
)
m_pFontManager
=
NULL
;
if
(
!
bNoFontDir
)
{
std
::
wstring
sDefaultFont
(
_T
(
"Arial"
));
pFontList
->
SetDefaultFont
(
sDefaultFont
);
if
(
sFontDir
.
IsEmpty
())
m_oApplicationFonts
.
Initialize
();
else
m_oApplicationFonts
.
InitializeFromFolder
(
string2std_string
(
sFontDir
));
CFontList
*
pFontList
=
m_oApplicationFonts
.
GetList
();
if
(
NULL
!=
pFontList
)
{
std
::
wstring
sDefaultFont
(
_T
(
"Arial"
));
pFontList
->
SetDefaultFont
(
sDefaultFont
);
}
m_pFontManager
=
m_oApplicationFonts
.
GenerateFontManager
();
}
m_pFontManager
=
m_oApplicationFonts
.
GenerateFontManager
();
}
~
FontTableWriter
()
{
...
...
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
View file @
e3f331c1
...
...
@@ -123,7 +123,7 @@ const double g_dKoef_mm_to_emu = 36000;
const
double
g_dKoef_mm_to_eightpoint
=
8
*
g_dKoef_mm_to_pt
;
const
double
g_dKoef_mm_to_hps
=
2
*
g_dKoef_mm_to_pt
;
const
static
TCHAR
*
g_sFormatSignature
=
_T
(
"DOCY"
)
;
const
static
wchar_t
*
g_sFormatSignature
=
L"DOCY"
;
const
int
g_nFormatVersion
=
5
;
extern
int
g_nCurFormatVersion
;
namespace
c_oAscWrapStyle
{
enum
c_oSerFormat
...
...
@@ -865,7 +865,8 @@ extern int g_nCurFormatVersion;
Run
=
61
,
Ins
=
62
,
Del
=
63
,
columnbreak
=
64
columnbreak
=
64
,
ARPr
=
65
};}
namespace
c_oSer_FramePrType
{
enum
c_oSer_FramePrType
{
...
...
ASCOfficeDocxFile2/BinWriter/BinWriters.cpp
0 → 100644
View file @
e3f331c1
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "BinWriters.h"
namespace
BinDocxRW
{
BinaryHeaderFooterTableWriter
::
BinaryHeaderFooterTableWriter
(
ParamsWriter
&
oParamsWriter
,
OOX
::
IFileContainer
*
oDocumentRels
,
std
::
map
<
int
,
bool
>*
mapIgnoreComments
)
:
m_oBcw
(
oParamsWriter
),
m_oParamsWriter
(
oParamsWriter
),
m_poTheme
(
oParamsWriter
.
m_poTheme
),
m_oFontProcessor
(
*
oParamsWriter
.
m_pFontProcessor
),
m_oSettings
(
oParamsWriter
.
m_oSettings
),
m_pOfficeDrawingConverter
(
oParamsWriter
.
m_pOfficeDrawingConverter
),
m_oDocumentRels
(
oDocumentRels
),
m_mapIgnoreComments
(
mapIgnoreComments
)
{
};
void
BinaryHeaderFooterTableWriter
::
Write
()
{
int
nStart
=
m_oBcw
.
WriteItemWithLengthStart
();
int
nCurPos
=
0
;
//Header
if
(
m_aHeaders
.
size
()
>
0
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerHdrFtrTypes
::
Header
);
WriteHdrFtrContent
(
m_aHeaders
,
m_aHeaderTypes
,
m_aHeaderSectPrs
,
true
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
//Footer
if
(
m_aFooters
.
size
()
>
0
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerHdrFtrTypes
::
Footer
);
WriteHdrFtrContent
(
m_aFooters
,
m_aFooterTypes
,
m_aFooterSectPrs
,
false
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
m_oBcw
.
WriteItemWithLengthEnd
(
nStart
);
};
void
BinaryHeaderFooterTableWriter
::
WriteHdrFtrContent
(
std
::
vector
<
OOX
::
CHdrFtr
*>&
aHdrFtrs
,
std
::
vector
<
SimpleTypes
::
EHdrFtr
>&
aHdrFtrTypes
,
std
::
vector
<
OOX
::
Logic
::
CSectionProperty
*>&
aHdrSectPrs
,
bool
bHdr
)
{
int
nCurPos
=
0
;
for
(
int
i
=
0
,
length
=
aHdrFtrs
.
size
();
i
<
length
;
++
i
)
{
OOX
::
CHdrFtr
*
pHdrFtr
=
aHdrFtrs
[
i
];
SimpleTypes
::
EHdrFtr
eType
=
aHdrFtrTypes
[
i
];
OOX
::
Logic
::
CSectionProperty
*
pSectPr
=
aHdrSectPrs
[
i
];
BYTE
byteHdrFtrType
=
c_oSerHdrFtrTypes
::
HdrFtr_Odd
;
switch
(
eType
)
{
case
SimpleTypes
:
:
hdrftrFirst
:
byteHdrFtrType
=
c_oSerHdrFtrTypes
::
HdrFtr_First
;
break
;
case
SimpleTypes
:
:
hdrftrEven
:
byteHdrFtrType
=
c_oSerHdrFtrTypes
::
HdrFtr_Even
;
break
;
default:
byteHdrFtrType
=
c_oSerHdrFtrTypes
::
HdrFtr_Odd
;
break
;
}
nCurPos
=
m_oBcw
.
WriteItemStart
(
byteHdrFtrType
);
WriteHdrFtrItem
(
pSectPr
,
pHdrFtr
,
bHdr
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
};
void
BinaryHeaderFooterTableWriter
::
WriteHdrFtrItem
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
,
OOX
::
CHdrFtr
*
pHdrFtr
,
bool
bHdr
)
{
int
nCurPos
=
0
;
//Content
ParamsDocumentWriter
oParamsDocumentWriter
(
pHdrFtr
,
pHdrFtr
->
m_oReadPath
.
GetPath
());
m_oParamsWriter
.
m_pCurRels
=
oParamsDocumentWriter
.
m_pRels
;
m_oParamsWriter
.
m_sCurDocumentPath
=
oParamsDocumentWriter
.
m_sDocumentPath
;
BinaryDocumentTableWriter
oBinaryDocumentTableWriter
(
m_oParamsWriter
,
oParamsDocumentWriter
,
m_mapIgnoreComments
,
NULL
);
oBinaryDocumentTableWriter
.
prepareOfficeDrawingConverter
(
m_pOfficeDrawingConverter
,
oParamsDocumentWriter
.
m_sDocumentPath
,
pHdrFtr
->
m_arrShapeTypes
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerHdrFtrTypes
::
HdrFtr_Content
);
oBinaryDocumentTableWriter
.
WriteDocumentContent
(
pHdrFtr
->
m_arrItems
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
};
}
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
e3f331c1
...
...
@@ -3713,6 +3713,12 @@ namespace BinDocxRW
brPrs
.
Write_rPr
(
pMRun
->
m_oRPr
.
get
());
m_oBcw
.
WriteItemEnd
(
nCurPos2
);
}
if
(
pMRun
->
m_oARPr
.
IsInit
()
)
{
int
nCurPos2
=
m_oBcw
.
WriteItemStart
(
c_oSer_OMathContentType
::
ARPr
);
m_oBcw
.
m_oStream
.
WriteRecord2
(
0
,
pMRun
->
m_oARPr
);
m_oBcw
.
WriteItemEnd
(
nCurPos2
);
}
if
(
pMRun
->
m_oMText
.
IsInit
()
)
WriteMathText
(
pMRun
->
m_oMText
.
get
());
...
...
@@ -6383,63 +6389,6 @@ namespace BinDocxRW
RELEASEOBJECT
(
pTcPr
);
};
};
BinaryHeaderFooterTableWriter
::
BinaryHeaderFooterTableWriter
(
ParamsWriter
&
oParamsWriter
,
OOX
::
IFileContainer
*
oDocumentRels
,
std
::
map
<
int
,
bool
>*
mapIgnoreComments
)
:
m_oBcw
(
oParamsWriter
),
m_oParamsWriter
(
oParamsWriter
),
m_poTheme
(
oParamsWriter
.
m_poTheme
),
m_oFontProcessor
(
*
oParamsWriter
.
m_pFontProcessor
),
m_oSettings
(
oParamsWriter
.
m_oSettings
),
m_pOfficeDrawingConverter
(
oParamsWriter
.
m_pOfficeDrawingConverter
),
m_oDocumentRels
(
oDocumentRels
),
m_mapIgnoreComments
(
mapIgnoreComments
)
{
};
void
BinaryHeaderFooterTableWriter
::
Write
()
{
int
nStart
=
m_oBcw
.
WriteItemWithLengthStart
();
int
nCurPos
=
0
;
//Header
if
(
m_aHeaders
.
size
()
>
0
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerHdrFtrTypes
::
Header
);
WriteHdrFtrContent
(
m_aHeaders
,
m_aHeaderTypes
,
m_aHeaderSectPrs
,
true
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
//Footer
if
(
m_aFooters
.
size
()
>
0
)
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerHdrFtrTypes
::
Footer
);
WriteHdrFtrContent
(
m_aFooters
,
m_aFooterTypes
,
m_aFooterSectPrs
,
false
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
m_oBcw
.
WriteItemWithLengthEnd
(
nStart
);
};
void
BinaryHeaderFooterTableWriter
::
WriteHdrFtrContent
(
std
::
vector
<
OOX
::
CHdrFtr
*>&
aHdrFtrs
,
std
::
vector
<
SimpleTypes
::
EHdrFtr
>&
aHdrFtrTypes
,
std
::
vector
<
OOX
::
Logic
::
CSectionProperty
*>&
aHdrSectPrs
,
bool
bHdr
)
{
int
nCurPos
=
0
;
for
(
int
i
=
0
,
length
=
aHdrFtrs
.
size
();
i
<
length
;
++
i
)
{
OOX
::
CHdrFtr
*
pHdrFtr
=
aHdrFtrs
[
i
];
SimpleTypes
::
EHdrFtr
eType
=
aHdrFtrTypes
[
i
];
OOX
::
Logic
::
CSectionProperty
*
pSectPr
=
aHdrSectPrs
[
i
];
BYTE
byteHdrFtrType
=
c_oSerHdrFtrTypes
::
HdrFtr_Odd
;
switch
(
eType
)
{
case
SimpleTypes
:
:
hdrftrFirst
:
byteHdrFtrType
=
c_oSerHdrFtrTypes
::
HdrFtr_First
;
break
;
case
SimpleTypes
:
:
hdrftrEven
:
byteHdrFtrType
=
c_oSerHdrFtrTypes
::
HdrFtr_Even
;
break
;
default:
byteHdrFtrType
=
c_oSerHdrFtrTypes
::
HdrFtr_Odd
;
break
;
}
nCurPos
=
m_oBcw
.
WriteItemStart
(
byteHdrFtrType
);
WriteHdrFtrItem
(
pSectPr
,
pHdrFtr
,
bHdr
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
};
void
BinaryHeaderFooterTableWriter
::
WriteHdrFtrItem
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
,
OOX
::
CHdrFtr
*
pHdrFtr
,
bool
bHdr
)
{
int
nCurPos
=
0
;
//Content
ParamsDocumentWriter
oParamsDocumentWriter
(
pHdrFtr
,
pHdrFtr
->
m_oReadPath
.
GetPath
());
m_oParamsWriter
.
m_pCurRels
=
oParamsDocumentWriter
.
m_pRels
;
m_oParamsWriter
.
m_sCurDocumentPath
=
oParamsDocumentWriter
.
m_sDocumentPath
;
BinaryDocumentTableWriter
oBinaryDocumentTableWriter
(
m_oParamsWriter
,
oParamsDocumentWriter
,
m_mapIgnoreComments
,
NULL
);
oBinaryDocumentTableWriter
.
prepareOfficeDrawingConverter
(
m_pOfficeDrawingConverter
,
oParamsDocumentWriter
.
m_sDocumentPath
,
pHdrFtr
->
m_arrShapeTypes
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerHdrFtrTypes
::
HdrFtr_Content
);
oBinaryDocumentTableWriter
.
WriteDocumentContent
(
pHdrFtr
->
m_arrItems
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
};
class
BinaryCommentsTableWriter
{
class
CCommentWriteTemp
...
...
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
View file @
e3f331c1
...
...
@@ -43,7 +43,7 @@ int BinDocxRW::g_nCurFormatVersion = 0;
BinDocxRW
::
CDocxSerializer
::
CDocxSerializer
()
{
m_
oBinaryFile
Writer
=
NULL
;
m_
pParams
Writer
=
NULL
;
m_pCurFileWriter
=
NULL
;
m_bIsNoBase64Save
=
false
;
m_bSaveChartAsImg
=
false
;
...
...
@@ -136,10 +136,10 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
oDrawingConverter
.
SetMainDocument
(
this
);
oDrawingConverter
.
SetMediaDstPath
(
pathMedia
.
GetPath
());
ParamsWriter
o
ParamsWriter
(
&
oBufferedStream
,
&
fp
,
&
oDrawingConverter
,
pEmbeddedFontsManager
);
m_pParamsWriter
=
new
ParamsWriter
(
&
oBufferedStream
,
&
fp
,
&
oDrawingConverter
,
pEmbeddedFontsManager
);
m_oBinaryFileWriter
=
new
BinaryFileWriter
(
o
ParamsWriter
);
m_oBinaryFileWriter
->
intoBindoc
(
sDstPath
);
BinaryFileWriter
oBinaryFileWriter
(
*
m_p
ParamsWriter
);
oBinaryFileWriter
.
intoBindoc
(
sDstPath
);
BYTE
*
pbBinBuffer
=
oBufferedStream
.
GetBuffer
();
int
nBinBufferLen
=
oBufferedStream
.
GetPosition
();
...
...
@@ -159,13 +159,13 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
{
NSFile
::
CFileBinary
oFile
;
oFile
.
CreateFileW
(
string2std_string
(
sSrcFileName
));
oFile
.
WriteStringUTF8
(
string2std_string
(
m_oBinaryFileWriter
->
WriteFileHeader
(
nBinBufferLen
)));
oFile
.
WriteStringUTF8
(
string2std_string
(
oBinaryFileWriter
.
WriteFileHeader
(
nBinBufferLen
)));
oFile
.
WriteFile
(
pbBase64Buffer
,
nBase64BufferLen
);
oFile
.
CloseFile
();
}
RELEASEARRAYOBJECTS
(
pbBase64Buffer
);
}
RELEASEOBJECT
(
m_
oBinaryFile
Writer
);
RELEASEOBJECT
(
m_
pParams
Writer
);
RELEASEOBJECT
(
pFontPicker
);
return
true
;
}
...
...
@@ -283,7 +283,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
oDrawingConverter
.
SetMainDocument
(
this
);
oDrawingConverter
.
SetMediaDstPath
(
sMediaPath
);
oDrawingConverter
.
SetEmbedDstPath
(
sEmbedPath
);
m_pCurFileWriter
=
new
Writers
::
FileWriter
(
sDstPath
,
m_sFontDir
,
nVersion
,
m_bSaveChartAsImg
,
&
oDrawingConverter
,
sThemePath
);
m_pCurFileWriter
=
new
Writers
::
FileWriter
(
sDstPath
,
m_sFontDir
,
false
,
nVersion
,
m_bSaveChartAsImg
,
&
oDrawingConverter
,
sThemePath
);
//папка с картинками
std
::
wstring
strFileInDir
=
NSSystemPath
::
GetDirectoryName
(
string2std_string
(
sSrcFileName
));
...
...
@@ -380,7 +380,7 @@ bool BinDocxRW::CDocxSerializer::getXmlContent(NSBinPptxRW::CBinaryFileReader& o
}
bool
BinDocxRW
::
CDocxSerializer
::
getBinaryContent
(
const
CString
&
bsTxContent
,
NSBinPptxRW
::
CBinaryFileWriter
&
oBufferedStream
,
long
&
lDataSize
)
{
if
(
NULL
==
m_
oBinaryFile
Writer
)
if
(
NULL
==
m_
pParams
Writer
)
return
false
;
long
nStartPos
=
oBufferedStream
.
GetPosition
();
...
...
@@ -406,7 +406,7 @@ bool BinDocxRW::CDocxSerializer::getBinaryContent(const CString& bsTxContent, NS
oReader
.
ReadNextNode
();
//w:txbxContent
oSdtContent
.
fromXML
(
oReader
);
}
BinDocxRW
::
ParamsWriter
&
oParamsWriter
=
m_oBinaryFileWriter
->
m_o
ParamsWriter
;
BinDocxRW
::
ParamsWriter
&
oParamsWriter
=
*
m_p
ParamsWriter
;
NSBinPptxRW
::
CBinaryFileWriter
*
pBufferedStreamOld
=
oParamsWriter
.
m_pCBufferedStream
;
oParamsWriter
.
m_pCBufferedStream
=
&
oBufferedStream
;
...
...
@@ -422,6 +422,62 @@ bool BinDocxRW::CDocxSerializer::getBinaryContent(const CString& bsTxContent, NS
lDataSize
=
nEndPos
-
nStartPos
;
return
true
;
}
bool
BinDocxRW
::
CDocxSerializer
::
getBinaryContentElem
(
OOX
::
EElementType
eElemType
,
void
*
pElem
,
NSBinPptxRW
::
CBinaryFileWriter
&
oBufferedStream
,
long
&
lDataSize
)
{
if
(
NULL
==
m_pParamsWriter
)
return
false
;
long
nStartPos
=
oBufferedStream
.
GetPosition
();
BinDocxRW
::
ParamsWriter
&
oParamsWriter
=
*
m_pParamsWriter
;
NSBinPptxRW
::
CBinaryFileWriter
*
pBufferedStreamOld
=
oParamsWriter
.
m_pCBufferedStream
;
oParamsWriter
.
m_pCBufferedStream
=
&
oBufferedStream
;
BinDocxRW
::
BinaryCommonWriter
oBinaryCommonWriter
(
oParamsWriter
);
int
nCurPos
=
oBinaryCommonWriter
.
WriteItemWithLengthStart
();
BinDocxRW
::
ParamsDocumentWriter
oParams
(
oParamsWriter
.
m_pCurRels
,
oParamsWriter
.
m_sCurDocumentPath
);
BinDocxRW
::
BinaryDocumentTableWriter
oBinaryDocumentTableWriter
(
oParamsWriter
,
oParams
,
&
oParamsWriter
.
m_mapIgnoreComments
,
NULL
);
if
(
OOX
::
et_m_oMathPara
==
eElemType
)
{
OOX
::
Logic
::
COMathPara
*
pMathPara
=
static_cast
<
OOX
::
Logic
::
COMathPara
*>
(
pElem
);
oBinaryDocumentTableWriter
.
WriteMathOMathPara
(
pMathPara
->
m_arrItems
);
}
else
if
(
OOX
::
et_m_oMath
==
eElemType
)
{
OOX
::
Logic
::
COMath
*
pMath
=
static_cast
<
OOX
::
Logic
::
COMath
*>
(
pElem
);
oBinaryDocumentTableWriter
.
WriteMathArgNodes
(
pMath
->
m_arrItems
);
}
oBinaryCommonWriter
.
WriteItemWithLengthEnd
(
nCurPos
);
oParamsWriter
.
m_pCBufferedStream
=
pBufferedStreamOld
;
long
nEndPos
=
oBufferedStream
.
GetPosition
();
lDataSize
=
nEndPos
-
nStartPos
;
return
true
;
}
bool
BinDocxRW
::
CDocxSerializer
::
getXmlContentElem
(
OOX
::
EElementType
eType
,
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
,
CString
&
sOutputXml
)
{
long
nLength
=
oBufferedStream
.
GetLong
();
Writers
::
ContentWriter
oTempContentWriter
;
BinDocxRW
::
Binary_DocumentTableReader
oBinary_DocumentTableReader
(
oBufferedStream
,
*
m_pCurFileWriter
,
oTempContentWriter
,
m_pCurFileWriter
->
m_pComments
);
if
(
OOX
::
et_m_oMathPara
==
eType
)
{
oTempContentWriter
.
m_oContent
.
WriteString
(
CString
(
_T
(
"<m:oMathPara>"
)));
oBinary_DocumentTableReader
.
Read1
(
nLength
,
&
BinDocxRW
::
Binary_DocumentTableReader
::
ReadMathOMathPara
,
&
oBinary_DocumentTableReader
,
NULL
);
oTempContentWriter
.
m_oContent
.
WriteString
(
CString
(
_T
(
"</m:oMathPara>"
)));
}
else
if
(
OOX
::
et_m_oMath
==
eType
)
{
oTempContentWriter
.
m_oContent
.
WriteString
(
CString
(
_T
(
"<m:oMath>"
)));
oBinary_DocumentTableReader
.
Read1
(
nLength
,
&
BinDocxRW
::
Binary_DocumentTableReader
::
ReadMathArg
,
&
oBinary_DocumentTableReader
,
NULL
);
oTempContentWriter
.
m_oContent
.
WriteString
(
CString
(
_T
(
"</m:oMath>"
)));
}
sOutputXml
=
oTempContentWriter
.
m_oContent
.
GetData
();
return
true
;
}
void
BinDocxRW
::
CDocxSerializer
::
setFontDir
(
const
CString
&
sFontDir
)
{
m_sFontDir
=
sFontDir
;
...
...
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.h
View file @
e3f331c1
...
...
@@ -38,6 +38,7 @@
#else
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
namespace
Writers
{
...
...
@@ -51,14 +52,16 @@ namespace NSBinPptxRW
namespace
BinDocxRW
{
class
BinaryFileWriter
;
class
ParamsWriter
;
class
CDocxSerializer
{
p
rivate
:
p
ublic
:
CString
m_sFontDir
;
CString
m_sEmbeddedFontsDir
;
bool
m_bIsNoBase64Save
;
bool
m_bSaveChartAsImg
;
BinaryFileWriter
*
m_oBinaryFile
Writer
;
ParamsWriter
*
m_pParams
Writer
;
Writers
::
FileWriter
*
m_pCurFileWriter
;
public:
CDocxSerializer
();
...
...
@@ -73,6 +76,9 @@ namespace BinDocxRW
bool
getXmlContent
(
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
,
long
lLength
,
CString
&
sOutputXml
);
bool
getBinaryContent
(
const
CString
&
bsTxContent
,
NSBinPptxRW
::
CBinaryFileWriter
&
oBufferedStream
,
long
&
lDataSize
);
bool
getBinaryContentElem
(
OOX
::
EElementType
eElemType
,
void
*
pElem
,
NSBinPptxRW
::
CBinaryFileWriter
&
oBufferedStream
,
long
&
lDataSize
);
bool
getXmlContentElem
(
OOX
::
EElementType
eType
,
NSBinPptxRW
::
CBinaryFileReader
&
oBufferedStream
,
CString
&
sOutputXml
);
void
setFontDir
(
const
CString
&
sFontDir
);
void
setEmbeddedFontsDir
(
const
CString
&
sEmbeddedFontsDir
);
void
setIsNoBase64Save
(
bool
bIsNoBase64Save
);
...
...
ASCOfficeDocxFile2/Linux/ASCOfficeDocxFile2Lib.pro
View file @
e3f331c1
...
...
@@ -34,6 +34,7 @@ INCLUDEPATH += \
SOURCES
+=
..
/
DocWrapper
/
DocxSerializer
.
cpp
\
..
/
DocWrapper
/
FontProcessor
.
cpp
\
..
/
DocWrapper
/
XlsxSerializer
.
cpp
\
..
/
BinWriter
/
BinWriters
.
cpp
\
..
/../
XlsxSerializerCom
/
Common
/
Common
.
cpp
\
..
/../
XlsxSerializerCom
/
Reader
/
ChartFromToBinary
.
cpp
\
..
/../
XlsxSerializerCom
/
Reader
/
CommonWriter
.
cpp
\
...
...
ASCOfficePPTXFile/Editor/BinReaderWriterDefines.h
View file @
e3f331c1
...
...
@@ -173,6 +173,8 @@ namespace NSBinPptxRW
#define PARRUN_TYPE_RUN 1
#define PARRUN_TYPE_FLD 2
#define PARRUN_TYPE_BR 3
#define PARRUN_TYPE_MATH 4
#define PARRUN_TYPE_MATHPARA 5
#define SPTREE_TYPE_NONE 0
#define SPTREE_TYPE_SHAPE 1
...
...
ASCOfficePPTXFile/PPTXFormat/Comments.h
View file @
e3f331c1
...
...
@@ -356,6 +356,8 @@ namespace PPTX
pWriter
->
WriteAttribute
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
pWriter
->
EndAttributes
();
pWriter
->
WriteArray2
(
m_arComments
);
...
...
@@ -402,4 +404,4 @@ namespace PPTX
};
}
// namespace PPTX
#endif // PPTX_COMMENTS_COMMENTS_H_
\ No newline at end of file
#endif // PPTX_COMMENTS_COMMENTS_H_
ASCOfficePPTXFile/PPTXFormat/HandoutMaster.h
View file @
e3f331c1
...
...
@@ -81,6 +81,8 @@ namespace PPTX
XmlUtils
::
CAttribute
oAttr
;
oAttr
.
Write
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
XmlUtils
::
CNodeValue
oValue
;
oValue
.
Write
(
cSld
);
...
...
@@ -116,4 +118,4 @@ namespace PPTX
};
}
// namespace PPTX
#endif // PPTX_SLIDES_HANDOUTMASTER_INCLUDE_H_
\ No newline at end of file
#endif // PPTX_SLIDES_HANDOUTMASTER_INCLUDE_H_
ASCOfficePPTXFile/PPTXFormat/Logic/Paragraph.h
View file @
e3f331c1
...
...
@@ -81,7 +81,7 @@ namespace PPTX
pPr
=
oNode
;
else
if
(
_T
(
"endParaRPr"
)
==
strName
)
endParaRPr
=
oNode
;
else
if
((
_T
(
"r"
)
==
strName
)
||
(
_T
(
"fld"
)
==
strName
)
||
(
_T
(
"br"
)
==
strName
))
else
if
((
_T
(
"r"
)
==
strName
)
||
(
_T
(
"fld"
)
==
strName
)
||
(
_T
(
"br"
)
==
strName
)
||
(
_T
(
"m"
)
==
strName
)
)
RunElems
.
push_back
(
RunElem
(
oNode
));
}
}
...
...
@@ -273,6 +273,26 @@ namespace PPTX
pReader
->
Seek
(
_end
);
break
;
}
case
PARRUN_TYPE_MATH
:
{
Logic
::
MathParaWrapper
*
pRun
=
new
Logic
::
MathParaWrapper
();
pRun
->
fromPPTY
(
_type
,
pReader
);
RunElem
elm
;
RunElems
.
push_back
(
elm
);
RunElems
.
back
().
InitRun
(
pRun
);
break
;
}
case
PARRUN_TYPE_MATHPARA
:
{
Logic
::
MathParaWrapper
*
pRun
=
new
Logic
::
MathParaWrapper
();
pRun
->
fromPPTY
(
_type
,
pReader
);
RunElem
elm
;
RunElems
.
push_back
(
elm
);
RunElems
.
back
().
InitRun
(
pRun
);
break
;
}
default:
break
;
}
...
...
@@ -320,4 +340,4 @@ namespace PPTX
}
// namespace Logic
}
// namespace PPTX
#endif // PPTX_LOGIC_PARAGRAPH_INCLUDE_H
\ No newline at end of file
#endif // PPTX_LOGIC_PARAGRAPH_INCLUDE_H
ASCOfficePPTXFile/PPTXFormat/Logic/RunElem.h
View file @
e3f331c1
...
...
@@ -38,6 +38,7 @@
#include "Runs/Run.h"
#include "Runs/Fld.h"
#include "Runs/Br.h"
#include "Runs/MathParaWrapper.h"
namespace
PPTX
{
...
...
@@ -59,6 +60,8 @@ namespace PPTX
Elem
.
reset
(
new
Logic
::
Fld
(
node
));
else
if
(
name
==
_T
(
"br"
))
Elem
.
reset
(
new
Logic
::
Br
(
node
));
else
if
(
name
==
_T
(
"m"
))
Elem
.
reset
(
new
Logic
::
MathParaWrapper
(
node
));
else
Elem
.
reset
();
}
virtual
CString
toXML
()
const
...
...
@@ -103,4 +106,4 @@ namespace PPTX
}
// namespace Logic
}
// namespace PPTX
#endif // PPTX_LOGIC_RUNELEM_INCLUDE_H
\ No newline at end of file
#endif // PPTX_LOGIC_RUNELEM_INCLUDE_H
ASCOfficePPTXFile/PPTXFormat/Logic/Runs/MathParaWrapper.cpp
0 → 100644
View file @
e3f331c1
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "MathParaWrapper.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Math/oMathPara.h"
#include "../../../ASCOfficeDocxFile2/BinWriter/BinWriters.h"
#include "../../../ASCOfficeDocxFile2/BinReader/FileWriter.h"
namespace
PPTX
{
namespace
Logic
{
MathParaWrapper
&
MathParaWrapper
::
operator
=
(
const
MathParaWrapper
&
oSrc
)
{
//todo
parentFile
=
oSrc
.
parentFile
;
parentElement
=
oSrc
.
parentElement
;
m_oMathPara
=
oSrc
.
m_oMathPara
;
m_oMath
=
oSrc
.
m_oMath
;
return
*
this
;
}
void
MathParaWrapper
::
fromXML
(
XmlUtils
::
CXmlNode
&
node
)
{
CString
sBegin
(
_T
(
"<root xmlns:wpc=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas
\"
xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
xmlns:p=
\"
urn:schemas-microsoft-com:office:powerpoint
\"
xmlns:v=
\"
urn:schemas-microsoft-com:vml
\"
xmlns:x=
\"
urn:schemas-microsoft-com:office:excel
\"
xmlns:o=
\"
urn:schemas-microsoft-com:office:office
\"
xmlns:w10=
\"
urn:schemas-microsoft-com:office:word
\"
xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
xmlns:ve=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
xmlns:w=
\"
http://schemas.openxmlformats.org/wordprocessingml/2006/main
\"
xmlns:wp=
\"
http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing
\"
xmlns:wp14=
\"
http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing
\"
xmlns:w14=
\"
http://schemas.microsoft.com/office/word/2010/wordml
\"
xmlns:w15=
\"
http://schemas.microsoft.com/office/word/2012/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
\"
xmlns:a=
\"
http://schemas.openxmlformats.org/drawingml/2006/main
\"
xmlns:a14=
\"
http://schemas.microsoft.com/office/drawing/2010/main
\"
xmlns:pic=
\"
http://schemas.openxmlformats.org/drawingml/2006/picture
\"
xmlns:xdr=
\"
http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing
\"
>"
));
CString
sEnd
(
_T
(
"</root>"
));
CString
sXml
=
sBegin
+
node
.
GetXml
()
+
sEnd
;
XmlUtils
::
CXmlLiteReader
oReader
;
oReader
.
FromString
(
sXml
.
GetBuffer
());
sXml
.
ReleaseBuffer
();
oReader
.
ReadNextNode
();
//root
oReader
.
ReadNextNode
();
//a14:m
oReader
.
ReadNextNode
();
//oMath oMathPara
CString
strNameP
=
XmlUtils
::
GetNameNoNS
(
oReader
.
GetName
());
if
(
L"oMathPara"
==
strNameP
)
{
m_oMathPara
=
oReader
;
}
else
if
(
L"oMath"
==
strNameP
)
{
m_oMath
=
oReader
;
}
FillParentPointersForChilds
();
}
CString
MathParaWrapper
::
toXML
()
const
{
if
(
m_oMathPara
.
IsInit
()
||
m_oMath
.
IsInit
()
||
m_oXml
.
IsInit
())
{
CString
sXml
=
L"<mc:AlternateContent xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
><mc:Choice xmlns:a14=
\"
http://schemas.microsoft.com/office/drawing/2010/main
\"
Requires=
\"
a14
\"
><a14:m>"
;
if
(
m_oMathPara
.
IsInit
())
{
sXml
+=
m_oMathPara
->
toXML
();
}
else
if
(
m_oMath
.
IsInit
())
{
sXml
+=
m_oMath
->
toXML
();
}
else
{
sXml
+=
m_oXml
.
get
();
}
sXml
+=
L"</a14:m></mc:Choice><mc:Fallback></mc:Fallback></mc:AlternateContent>"
;
return
sXml
;
}
else
{
return
L""
;
}
}
void
MathParaWrapper
::
toXmlWriter
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
{
pWriter
->
WriteString
(
toXML
());
}
void
MathParaWrapper
::
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
{
int
nRecordType
;
void
*
pElem
=
NULL
;
OOX
::
EElementType
eElemType
;
if
(
m_oMathPara
.
IsInit
())
{
nRecordType
=
PARRUN_TYPE_MATHPARA
;
pElem
=
m_oMathPara
.
GetPointer
();
eElemType
=
m_oMathPara
->
getType
();
}
else
if
(
m_oMath
.
IsInit
())
{
nRecordType
=
PARRUN_TYPE_MATH
;
pElem
=
m_oMath
.
GetPointer
();
eElemType
=
m_oMath
->
getType
();
}
if
(
NULL
!=
pElem
)
{
pWriter
->
StartRecord
(
nRecordType
);
long
lDataSize
=
0
;
if
(
NULL
!=
pWriter
->
m_pMainDocument
)
{
pWriter
->
m_pMainDocument
->
getBinaryContentElem
(
eElemType
,
pElem
,
*
pWriter
,
lDataSize
);
}
else
{
BinDocxRW
::
CDocxSerializer
oDocxSerializer
;
NSBinPptxRW
::
CDrawingConverter
oDrawingConverter
;
NSBinPptxRW
::
CBinaryFileWriter
*
pOldWriter
=
oDrawingConverter
.
m_pBinaryWriter
;
NSCommon
::
smart_ptr
<
PPTX
::
CCommonRels
>
pOldRels
=
*
oDrawingConverter
.
m_pBinaryWriter
->
m_pCommonRels
;
oDrawingConverter
.
m_pBinaryWriter
=
pWriter
;
DocWrapper
::
FontProcessor
fp
;
BinDocxRW
::
ParamsWriter
oParamsWriter
(
pWriter
,
&
fp
,
&
oDrawingConverter
,
NULL
);
oDocxSerializer
.
m_pParamsWriter
=
&
oParamsWriter
;
oDocxSerializer
.
getBinaryContentElem
(
eElemType
,
pElem
,
*
pWriter
,
lDataSize
);
*
oDrawingConverter
.
m_pBinaryWriter
->
m_pCommonRels
=
pOldRels
;
oDrawingConverter
.
m_pBinaryWriter
=
pOldWriter
;
}
pWriter
->
EndRecord
();
}
}
void
MathParaWrapper
::
fromPPTY
(
BYTE
type
,
NSBinPptxRW
::
CBinaryFileReader
*
pReader
)
{
OOX
::
EElementType
eType
;
if
(
PARRUN_TYPE_MATHPARA
==
type
)
{
eType
=
OOX
::
et_m_oMathPara
;
}
else
{
eType
=
OOX
::
et_m_oMath
;
}
LONG
_end
=
pReader
->
GetPos
()
+
pReader
->
GetLong
()
+
4
;
CString
sXml
;
if
(
NULL
!=
pReader
->
m_pMainDocument
)
{
pReader
->
m_pMainDocument
->
getXmlContentElem
(
eType
,
*
pReader
,
m_oXml
.
get
());
}
else
{
BinDocxRW
::
CDocxSerializer
oDocxSerializer
;
NSBinPptxRW
::
CDrawingConverter
oDrawingConverter
;
NSBinPptxRW
::
CImageManager2
*
pOldImageManager
=
oDrawingConverter
.
m_pImageManager
;
NSBinPptxRW
::
CBinaryFileReader
*
pOldReader
=
oDrawingConverter
.
m_pReader
;
oDrawingConverter
.
m_pImageManager
=
pReader
->
m_pRels
->
m_pManager
;
oDrawingConverter
.
m_pReader
=
pReader
;
oDocxSerializer
.
m_pCurFileWriter
=
new
Writers
::
FileWriter
(
L""
,
L""
,
true
,
BinDocxRW
::
g_nFormatVersion
,
false
,
&
oDrawingConverter
,
L""
);
oDocxSerializer
.
getXmlContentElem
(
eType
,
*
pReader
,
sXml
);
oDrawingConverter
.
m_pReader
=
pOldReader
;
oDrawingConverter
.
m_pImageManager
=
pOldImageManager
;
RELEASEOBJECT
(
oDocxSerializer
.
m_pCurFileWriter
);
}
m_oXml
=
sXml
;
pReader
->
Seek
(
_end
);
}
CString
MathParaWrapper
::
GetText
()
const
{
//todo
return
_T
(
""
);
}
}
// namespace Logic
}
// namespace PPTX
ASCOfficePPTXFile/PPTXFormat/Logic/Runs/MathParaWrapper.h
0 → 100644
View file @
e3f331c1
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef PPTX_LOGIC_MATHPARAWRAPPER_INCLUDE_H_
#define PPTX_LOGIC_MATHPARAWRAPPER_INCLUDE_H_
#include "RunBase.h"
namespace
OOX
{
namespace
Logic
{
class
COMathPara
;
class
COMath
;
}
}
namespace
PPTX
{
namespace
Logic
{
class
MathParaWrapper
:
public
RunBase
{
public:
PPTX_LOGIC_BASE
(
MathParaWrapper
)
MathParaWrapper
&
operator
=
(
const
MathParaWrapper
&
oSrc
);
public:
virtual
void
fromXML
(
XmlUtils
::
CXmlNode
&
node
);
virtual
CString
toXML
()
const
;
virtual
void
toXmlWriter
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
;
virtual
void
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
;
virtual
void
fromPPTY
(
BYTE
type
,
NSBinPptxRW
::
CBinaryFileReader
*
pReader
);
virtual
CString
GetText
()
const
;
public:
nullable
<
OOX
::
Logic
::
COMathPara
>
m_oMathPara
;
nullable
<
OOX
::
Logic
::
COMath
>
m_oMath
;
nullable_string
m_oXml
;
protected:
virtual
void
FillParentPointersForChilds
(){}
};
}
// namespace Logic
}
// namespace PPTX
#endif // PPTX_LOGIC_MATHPARAWRAPPER_INCLUDE_H_
ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.cpp
View file @
e3f331c1
...
...
@@ -252,30 +252,32 @@ namespace PPTX
m_elem
.
reset
(
new
Logic
::
GraphicFrame
(
node
));
else
if
(
name
==
_T
(
"AlternateContent"
))
{
XmlUtils
::
CXmlNode
oNodeFall
;
if
(
node
.
GetNode
(
_T
(
"mc:Fallback"
),
oNodeFall
))
bool
isEmpty
=
true
;
XmlUtils
::
CXmlNode
oNodeChoice
;
if
(
node
.
GetNode
(
_T
(
"mc:Choice"
),
oNodeChoice
))
{
XmlUtils
::
CXmlNode
oNodeFall
;
XmlUtils
::
CXmlNodes
oNodesC
;
if
(
oNodeFall
.
GetNodes
(
_T
(
"*"
),
oNodesC
))
CString
sRequires
;
//todo better check (a14 can be math, slicer)
if
(
oNodeChoice
.
GetAttributeIfExist
(
L"Requires"
,
sRequires
)
&&
L"a14"
==
sRequires
)
{
if
(
1
==
oNodesC
.
GetCount
())
{
XmlUtils
::
CXmlNode
oNodeC
;
oNodesC
.
GetAt
(
0
,
oNodeC
);
fromXML
(
oNodeC
);
}
else
{
m_elem
.
reset
();
}
oNodeChoice
.
GetNodes
(
_T
(
"*"
),
oNodesC
);
}
else
else
if
(
node
.
GetNode
(
_T
(
"mc:Fallback"
),
oNodeFall
))
{
m_elem
.
reset
();
oNodeFall
.
GetNodes
(
_T
(
"*"
),
oNodesC
);
}
if
(
1
==
oNodesC
.
GetCount
())
{
XmlUtils
::
CXmlNode
oNodeC
;
oNodesC
.
GetAt
(
0
,
oNodeC
);
fromXML
(
oNodeC
);
isEmpty
=
false
;
}
}
else
if
(
isEmpty
)
{
m_elem
.
reset
();
}
...
...
ASCOfficePPTXFile/PPTXFormat/NotesMaster.h
View file @
e3f331c1
...
...
@@ -84,6 +84,8 @@ namespace PPTX
XmlUtils
::
CAttribute
oAttr
;
oAttr
.
Write
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
XmlUtils
::
CNodeValue
oValue
;
oValue
.
Write
(
cSld
);
...
...
@@ -142,6 +144,8 @@ namespace PPTX
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
pWriter
->
EndAttributes
();
cSld
.
toXmlWriter
(
pWriter
);
...
...
ASCOfficePPTXFile/PPTXFormat/NotesSlide.h
View file @
e3f331c1
...
...
@@ -79,6 +79,8 @@ namespace PPTX
oAttr
.
Write
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
oAttr
.
Write
(
_T
(
"showMasterPhAnim"
),
showMasterPhAnim
);
oAttr
.
Write
(
_T
(
"showMasterSp"
),
showMasterSp
);
...
...
@@ -131,6 +133,8 @@ namespace PPTX
pWriter
->
WriteAttribute
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"showMasterPhAnim"
),
showMasterPhAnim
);
pWriter
->
WriteAttribute
(
_T
(
"showMasterSp"
),
showMasterSp
);
pWriter
->
EndAttributes
();
...
...
@@ -196,4 +200,4 @@ namespace PPTX
};
}
// namespace PPTX
#endif // PPTX_SLIDES_NOTESSLIDE_INCLUDE_H_
\ No newline at end of file
#endif // PPTX_SLIDES_NOTESSLIDE_INCLUDE_H_
ASCOfficePPTXFile/PPTXFormat/Presentation.h
View file @
e3f331c1
...
...
@@ -176,6 +176,8 @@ namespace PPTX
oAttr
.
Write
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
oAttr
.
Write
(
_T
(
"autoCompressPictures"
),
attrAutoCompressPictures
);
oAttr
.
Write
(
_T
(
"bookmarkIdSeed"
),
attrBookmarkIdSeed
);
...
...
@@ -372,6 +374,8 @@ namespace PPTX
pWriter
->
WriteAttribute
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"autoCompressPictures"
),
attrAutoCompressPictures
);
pWriter
->
WriteAttribute
(
_T
(
"bookmarkIdSeed"
),
attrBookmarkIdSeed
);
...
...
@@ -483,4 +487,4 @@ namespace PPTX
};
}
// namespace PPTX
#endif // PPTX_PRESENTATION_FILE_INCLUDE_H_
\ No newline at end of file
#endif // PPTX_PRESENTATION_FILE_INCLUDE_H_
ASCOfficePPTXFile/PPTXFormat/Slide.h
View file @
e3f331c1
...
...
@@ -135,6 +135,8 @@ namespace PPTX
oAttr
.
Write
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
oAttr
.
Write
(
_T
(
"show"
),
show
);
oAttr
.
Write
(
_T
(
"showMasterPhAnim"
),
showMasterPhAnim
);
oAttr
.
Write
(
_T
(
"showMasterSp"
),
showMasterSp
);
...
...
@@ -295,6 +297,8 @@ namespace PPTX
pWriter
->
WriteAttribute
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"showMasterPhAnim"
),
showMasterPhAnim
);
pWriter
->
WriteAttribute
(
_T
(
"showMasterSp"
),
showMasterSp
);
...
...
ASCOfficePPTXFile/PPTXFormat/SlideLayout.h
View file @
e3f331c1
...
...
@@ -115,6 +115,8 @@ namespace PPTX
oAttr
.
Write
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
oAttr
.
Write
(
_T
(
"matchingName"
),
matchingName
);
oAttr
.
Write
(
_T
(
"preserve"
),
preserve
);
...
...
@@ -424,6 +426,8 @@ namespace PPTX
pWriter
->
WriteAttribute
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"matchingName"
),
matchingName
);
pWriter
->
WriteAttribute
(
_T
(
"preserve"
),
preserve
);
...
...
ASCOfficePPTXFile/PPTXFormat/SlideMaster.h
View file @
e3f331c1
...
...
@@ -121,6 +121,8 @@ namespace PPTX
oAttr
.
Write
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
oAttr
.
Write
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
oAttr
.
Write
(
_T
(
"preserve"
),
preserve
);
XmlUtils
::
CNodeValue
oValue
;
...
...
@@ -412,6 +414,8 @@ namespace PPTX
pWriter
->
WriteAttribute
(
_T
(
"xmlns:a"
),
PPTX
::
g_Namespaces
.
a
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:r"
),
PPTX
::
g_Namespaces
.
r
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:p"
),
PPTX
::
g_Namespaces
.
p
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:m"
),
PPTX
::
g_Namespaces
.
m
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"xmlns:w"
),
PPTX
::
g_Namespaces
.
w
.
m_strLink
);
pWriter
->
WriteAttribute
(
_T
(
"preserve"
),
preserve
);
pWriter
->
EndAttributes
();
...
...
ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/PPTXFormatLib.pro
View file @
e3f331c1
...
...
@@ -95,6 +95,7 @@ SOURCES += \
..
/../../
PPTXFormat
/
Logic
/
TxBody
.
cpp
\
..
/../../
PPTXFormat
/
Logic
/
UniColor
.
cpp
\
..
/../../
PPTXFormat
/
Logic
/
UniEffect
.
cpp
\
..
/../../
PPTXFormat
/
Logic
/
Runs
/
MathParaWrapper
.
cpp
\
..
/../../
PPTXFormat
/
FileContainer
.
cpp
\
..
/../../
PPTXFormat
/
FileFactory
.
cpp
\
..
/../../
PPTXFormat
/
FileMap
.
cpp
\
...
...
@@ -300,6 +301,7 @@ HEADERS += pptxformatlib.h \
..
/../../
PPTXFormat
/
Logic
/
Path2D
/
QuadBezTo
.
h
\
..
/../../
PPTXFormat
/
Logic
/
Runs
/
Br
.
h
\
..
/../../
PPTXFormat
/
Logic
/
Runs
/
Fld
.
h
\
..
/../../
PPTXFormat
/
Logic
/
Runs
/
MathParaWrapper
.
h
\
..
/../../
PPTXFormat
/
Logic
/
Runs
/
Run
.
h
\
..
/../../
PPTXFormat
/
Logic
/
Runs
/
RunBase
.
h
\
..
/../../
PPTXFormat
/
Logic
/
Table
/
Table
.
h
\
...
...
Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro
View file @
e3f331c1
...
...
@@ -18,7 +18,9 @@ include(../../../Common/base.pri)
DEFINES
+=
UNICODE
_UNICODE
_USE_LIBXML2_READER_
_USE_XMLLITE_READER_
USE_LITE_READER
LIBXML_READER_ENABLED
INCLUDEPATH
+=
..
/../../
DesktopEditor
/
xml
/
libxml2
/
include
INCLUDEPATH
+=
\
..
/../../
DesktopEditor
/
freetype
-
2.5
.
2
/
include
\
..
/../../
DesktopEditor
/
xml
/
libxml2
/
include
build_fast
{
SOURCES
+=
\
...
...
Common/DocxFormat/Source/DocxFormat/Math/OMath.h
View file @
e3f331c1
...
...
@@ -127,25 +127,6 @@ namespace OOX
return
L""
;
}
// Childs
};
template
<
EElementType
EnumType
=
OOX
::
et_Unknown
>
class
CMathArgNodesEx
:
public
CMathArgNodes
{
public:
CMathArgNodesEx
(
XmlUtils
::
CXmlNode
&
oNode
)
{
fromXML
(
oNode
);
}
CMathArgNodesEx
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
fromXML
(
oReader
);
}
virtual
EElementType
getType
()
const
{
return
EnumType
;
}
};
}
//namespace Logic
}
//namespace OOX
\ No newline at end of file
}
//namespace OOX
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.cpp
View file @
e3f331c1
...
...
@@ -411,6 +411,9 @@ namespace OOX
if
(
m_oMRPr
.
IsInit
()
)
sResult
+=
m_oMRPr
->
toXML
();
if
(
m_oARPr
.
IsInit
()
)
sResult
+=
m_oARPr
->
toXML
();
if
(
m_oRPr
.
IsInit
()
)
sResult
+=
m_oRPr
->
toXML
();
...
...
@@ -444,4 +447,4 @@ namespace OOX
return
sResult
;
}
}
}
\ No newline at end of file
}
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h
View file @
e3f331c1
...
...
@@ -42,6 +42,7 @@
#include "../Logic/Annotations.h"
#include "../Logic/Pict.h"
#include "../Drawing/Drawing.h"
#include "../../../../../ASCOfficePPTXFile/PPTXFormat/Logic/RunProperties.h"
namespace
OOX
...
...
@@ -49,15 +50,32 @@ namespace OOX
// Elements 22.1.2
namespace
Logic
{
typedef
CMathArgNodesEx
<
OOX
::
et_m_deg
>
CDeg
;
typedef
CMathArgNodesEx
<
OOX
::
et_m_den
>
CDen
;
typedef
CMathArgNodesEx
<
OOX
::
et_m_e
>
CElement
;
typedef
CMathArgNodesEx
<
OOX
::
et_m_fName
>
CFName
;
typedef
CMathArgNodesEx
<
OOX
::
et_m_lim
>
CLim
;
typedef
CMathArgNodesEx
<
OOX
::
et_m_num
>
CNum
;
typedef
CMathArgNodesEx
<
OOX
::
et_m_oMath
>
COMath
;
typedef
CMathArgNodesEx
<
OOX
::
et_m_sub
>
CSub
;
typedef
CMathArgNodesEx
<
OOX
::
et_m_sup
>
CSup
;
#define CMathArgNodesEx(name, type)\
class
name
:
public
CMathArgNodes
\
{
\
public:
\
name
(
XmlUtils
::
CXmlNode
&
oNode
)
\
{
\
fromXML
(
oNode
);
\
}
\
name
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
\
{
\
fromXML
(
oReader
);
\
}
\
virtual
EElementType
getType
()
const
\
{
\
return
type
;
\
}
\
};
CMathArgNodesEx
(
CDeg
,
OOX
::
et_m_deg
)
CMathArgNodesEx
(
CDen
,
OOX
::
et_m_den
)
CMathArgNodesEx
(
CElement
,
OOX
::
et_m_e
)
CMathArgNodesEx
(
CFName
,
OOX
::
et_m_fName
)
CMathArgNodesEx
(
CLim
,
OOX
::
et_m_lim
)
CMathArgNodesEx
(
CNum
,
OOX
::
et_m_num
)
CMathArgNodesEx
(
COMath
,
OOX
::
et_m_oMath
)
CMathArgNodesEx
(
CSub
,
OOX
::
et_m_sub
)
CMathArgNodesEx
(
CSup
,
OOX
::
et_m_sup
)
//--------------------------------------------------------------------------------
// CAcc 22.1.2.1 (Accent)
//--------------------------------------------------------------------------------
...
...
@@ -2354,6 +2372,14 @@ namespace OOX
m_oMRPr
=
oReader
;
else
if
(
_T
(
"w:rPr"
)
==
sName
)
m_oRPr
=
oReader
;
else
if
(
_T
(
"a:rPr"
)
==
sName
)
{
CString
sXml
=
oReader
.
GetOuterXml
();
XmlUtils
::
CXmlNode
node
;
node
.
FromXmlString
(
sXml
.
GetBuffer
());
sXml
.
ReleaseBuffer
();
m_oARPr
=
node
;
}
else
if
(
_T
(
"w:ruby"
)
==
sName
)
m_oRuby
=
oReader
;
else
if
(
_T
(
"w:separator"
)
==
sName
)
...
...
@@ -2411,6 +2437,7 @@ namespace OOX
nullable
<
OOX
::
Logic
::
CPTab
>
m_oPtab
;
nullable
<
OOX
::
Logic
::
CRunProperty
>
m_oRPr
;
nullable
<
OOX
::
Logic
::
CMRPr
>
m_oMRPr
;
nullable
<
PPTX
::
Logic
::
RunProperties
>
m_oARPr
;
nullable
<
OOX
::
Logic
::
CRuby
>
m_oRuby
;
nullable
<
OOX
::
Logic
::
CSeparator
>
m_oSeparator
;
nullable
<
OOX
::
Logic
::
CSoftHyphen
>
m_oSoftHyphen
;
...
...
Common/DocxFormat/Source/XML/Utils.h
View file @
e3f331c1
...
...
@@ -438,9 +438,34 @@ namespace XmlUtils
inline
void
WriteEncodeXmlString
(
const
wchar_t
*
pString
)
{
const
wchar_t
*
pData
=
pString
;
bool
isUtf16
=
sizeof
(
wchar_t
)
==
2
;
bool
skipNext
=
false
;
while
(
*
pData
!=
0
)
{
BYTE
_code
=
CheckCode
(
*
pData
);
wchar_t
code
=
*
pData
;
BYTE
_code
;
//todo replace CString with std::wstring and choose one writer
if
(
isUtf16
)
{
if
(
skipNext
)
{
skipNext
=
false
;
_code
=
1
;
}
else
if
(
code
>=
0xD800
&&
code
<=
0xDFFF
&&
*
(
pData
+
1
)
!=
0
)
{
skipNext
=
true
;
_code
=
1
;
}
else
{
_code
=
CheckCode
(
code
);
}
}
else
{
_code
=
CheckCode
(
code
);
}
switch
(
_code
)
{
...
...
Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h
View file @
e3f331c1
...
...
@@ -207,8 +207,10 @@ namespace OOX
while
(
oReader
.
ReadNextSiblingNode
(
nCurDepth
)
)
{
CString
sName
=
XmlUtils
::
GetNameNoNS
(
oReader
.
GetName
());
if
(
_T
(
"Fallback"
)
==
sName
)
if
(
_T
(
"Fallback"
)
==
sName
||
_T
(
"Choice"
)
==
sName
)
{
CString
sRequires
;
ReadAttributesRequire
(
oReader
,
sRequires
);
CString
xmlString
;
// = L"<?xml version=\"1.0\"?>"; //encoding=\"UTF-8\"
xmlString
+=
L"<root "
;
xmlString
+=
L"xmlns:mc=
\"
http://schemas.openxmlformats.org/markup-compatibility/2006
\"
"
;
...
...
@@ -218,7 +220,13 @@ namespace OOX
xmlString
+=
L"xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
"
;
xmlString
+=
L">"
;
xmlString
+=
oReader
.
GetOuterXml
();
xmlString
+=
L"</root>"
;
xmlString
+=
L"</root>"
;
//todo better check (a14 can be math, slicer)
if
(
_T
(
"Choice"
)
==
sName
&&
!
(
L"a14"
==
sRequires
&&
-
1
!=
xmlString
.
Find
(
L"a14:m"
)))
{
continue
;
}
XmlUtils
::
CXmlLiteReader
oSubReader
;
if
(
oSubReader
.
FromString
(
xmlString
))
...
...
@@ -263,6 +271,13 @@ namespace OOX
void
ReadAttributes
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
}
void
ReadAttributesRequire
(
XmlUtils
::
CXmlLiteReader
&
oReader
,
CString
&
sRequire
)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start
(
oReader
)
WritingElement_ReadAttributes_ReadSingle
(
oReader
,
_T
(
"Requires"
),
sRequire
)
WritingElement_ReadAttributes_End
(
oReader
)
}
public:
SimpleTypes
::
Spreadsheet
::
CCellAnchorType
<>
m_oAnchorType
;
nullable
<
OOX
::
Spreadsheet
::
CFromTo
>
m_oFrom
;
...
...
Common/DocxFormat/Source/XlsxFormat/Drawing/Drawing.h
View file @
e3f331c1
...
...
@@ -208,7 +208,7 @@ namespace OOX
virtual
void
write
(
const
CPath
&
oPath
,
const
CPath
&
oDirectory
,
CContentTypes
&
oContent
)
const
{
XmlUtils
::
CStringWriter
sXml
;
sXml
.
WriteString
(
_T
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
standalone=
\"
yes
\"
?><xdr:wsDr xmlns:xdr=
\"
http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing
\"
xmlns:a=
\"
http://schemas.openxmlformats.org/drawingml/2006/main
\"
xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
>"
));
sXml
.
WriteString
(
_T
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
standalone=
\"
yes
\"
?><xdr:wsDr xmlns:xdr=
\"
http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing
\"
xmlns:a=
\"
http://schemas.openxmlformats.org/drawingml/2006/main
\"
xmlns:r=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships
\"
xmlns:m=
\"
http://schemas.openxmlformats.org/officeDocument/2006/math
\"
xmlns:w=
\"
http://schemas.openxmlformats.org/wordprocessingml/2006/main
\"
>"
));
for
(
unsigned
int
i
=
0
,
length
=
m_arrItems
.
size
();
i
<
length
;
++
i
)
m_arrItems
[
i
]
->
toXML
(
sXml
);
sXml
.
WriteString
(
_T
(
"</xdr:wsDr>"
));
...
...
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