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
506680d3
Commit
506680d3
authored
Apr 24, 2016
by
ElenaSubbotina
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormatReader - конвертация embedded математических формул формата OOX
parent
4e193650
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
456 additions
and
152 deletions
+456
-152
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
+25
-17
ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
+4
-3
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
+62
-3
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
+3
-0
ASCOfficeDocFile/DocFormatTest/DocFormatTest.vcproj
ASCOfficeDocFile/DocFormatTest/DocFormatTest.vcproj
+4
-0
ASCOfficeDocFile/Win32/ASCOfficeDocFile2005.vcproj
ASCOfficeDocFile/Win32/ASCOfficeDocFile2005.vcproj
+12
-0
ASCOfficeDocFile/Win32/OfficeDocFile_VS2005.sln
ASCOfficeDocFile/Win32/OfficeDocFile_VS2005.sln
+4
-0
Common/DocxFormat/Source/Common/SimpleTypes_Word.h
Common/DocxFormat/Source/Common/SimpleTypes_Word.h
+8
-1
Common/DocxFormat/Source/DocxFormat/Math/OMath.h
Common/DocxFormat/Source/DocxFormat/Math/OMath.h
+42
-6
Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h
Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h
+76
-2
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h
+215
-119
No files found.
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
View file @
506680d3
...
...
@@ -571,22 +571,15 @@ namespace DocFileFormat
RevisionData
oData
=
RevisionData
(
chpxPic
);
/// <w:rPr>
CharacterPropertiesMapping
*
rPr
=
new
CharacterPropertiesMapping
(
m_pXmlWriter
,
m_document
,
&
oData
,
_lastValidPapx
,
false
);
if
(
rPr
)
{
chpxPic
->
Convert
(
rPr
);
RELEASEOBJECT
(
rPr
);
}
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"w:object"
),
TRUE
);
XmlUtils
::
CXmlWriter
OleWriter
;
OleWriter
.
WriteNodeBegin
(
_T
(
"w:object"
),
TRUE
);
//append the origin attributes
m_pXmlWriter
->
WriteAttribute
(
_T
(
"w:dxaOrig"
),
FormatUtils
::
IntToWideString
(
(
pic
.
dxaGoal
+
pic
.
dxaOrigin
)
).
c_str
()
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"w:dyaOrig"
),
FormatUtils
::
IntToWideString
(
(
pic
.
dyaGoal
+
pic
.
dyaOrigin
)
).
c_str
()
);
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
""
),
TRUE
,
FALSE
);
OleWriter
.
WriteAttribute
(
_T
(
"w:dxaOrig"
),
FormatUtils
::
IntToWideString
(
(
pic
.
dxaGoal
+
pic
.
dxaOrigin
)
).
c_str
()
);
OleWriter
.
WriteAttribute
(
_T
(
"w:dyaOrig"
),
FormatUtils
::
IntToWideString
(
(
pic
.
dyaGoal
+
pic
.
dyaOrigin
)
).
c_str
()
);
OleWriter
.
WriteNodeEnd
(
_T
(
""
),
TRUE
,
FALSE
);
VMLPictureMapping
oVmlMapper
(
m_context
,
m_pXml
Writer
,
true
,
_caller
);
VMLPictureMapping
oVmlMapper
(
m_context
,
&
Ole
Writer
,
true
,
_caller
);
pic
.
Convert
(
&
oVmlMapper
);
RELEASEOBJECT
(
chpxs
);
...
...
@@ -597,9 +590,9 @@ namespace DocFileFormat
CharacterPropertyExceptions
*
chpxSep
=
chpxs
->
front
();
OleObject
ole
(
chpxSep
,
m_document
->
GetStorage
()
);
OleObjectMapping
oleObjectMapping
(
m_pXml
Writer
,
m_context
,
&
pic
,
_caller
,
oVmlMapper
.
GetShapeId
()
);
OleObjectMapping
oleObjectMapping
(
&
Ole
Writer
,
m_context
,
&
pic
,
_caller
,
oVmlMapper
.
GetShapeId
()
);
if
(
oVmlMapper
.
m_isE
quation
||
oVmlMapper
.
m_isE
mbedded
)
if
(
oVmlMapper
.
m_isEmbedded
)
{
ole
.
isEquation
=
oVmlMapper
.
m_isEquation
;
ole
.
isEmbedded
=
oVmlMapper
.
m_isEmbedded
;
...
...
@@ -610,7 +603,22 @@ namespace DocFileFormat
RELEASEOBJECT
(
chpxs
);
}
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
"w:object"
)
);
OleWriter
.
WriteNodeEnd
(
_T
(
"w:object"
)
);
if
(
!
oVmlMapper
.
m_isEmbedded
&&
oVmlMapper
.
m_isEquation
)
{
m_pXmlWriter
->
WriteString
(
oVmlMapper
.
m_equationXml
.
c_str
());
}
else
{
CharacterPropertiesMapping
*
rPr
=
new
CharacterPropertiesMapping
(
m_pXmlWriter
,
m_document
,
&
oData
,
_lastValidPapx
,
false
);
if
(
rPr
)
{
chpxPic
->
Convert
(
rPr
);
RELEASEOBJECT
(
rPr
);
}
m_pXmlWriter
->
WriteString
(
OleWriter
.
GetXmlString
());
}
}
if
(
search
(
f
.
begin
(),
f
.
end
(),
embed
.
begin
(),
embed
.
end
())
!=
f
.
end
()
)
...
...
@@ -713,7 +721,7 @@ namespace DocFileFormat
VMLPictureMapping
oVmlMapper
(
m_context
,
m_pXmlWriter
,
false
,
_caller
);
oPicture
.
Convert
(
&
oVmlMapper
);
if
(
oVmlMapper
.
m_isE
quation
||
oVmlMapper
.
m_isE
mbedded
)
if
(
oVmlMapper
.
m_isEmbedded
)
{
OleObject
ole
(
chpx
,
m_document
->
GetStorage
()
);
OleObjectMapping
oleObjectMapping
(
m_pXmlWriter
,
m_context
,
&
oPicture
,
_caller
,
oVmlMapper
.
GetShapeId
()
);
...
...
ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp
View file @
506680d3
...
...
@@ -31,10 +31,10 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteAttribute
(
_T
(
"xmlns:o"
),
OpenXmlNamespaces
::
Office
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"xmlns:w10"
),
OpenXmlNamespaces
::
OfficeWord
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"xmlns:r"
),
OpenXmlNamespaces
::
Relationships
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"xmlns:m"
),
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/math"
));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wpc"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:mc"), _T("http://schemas.openxmlformats.org/markup-compatibility/2006"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:m"), _T("http://schemas.openxmlformats.org/officeDocument/2006/math"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wp14"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wp"), _T("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:w14"), _T("http://schemas.microsoft.com/office/word/2010/wordml"));
...
...
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
View file @
506680d3
...
...
@@ -23,10 +23,10 @@ namespace DocFileFormat
if
(
ole
!=
NULL
)
{
if
(
ole
->
isE
quation
||
ole
->
isE
mbedded
)
if
(
ole
->
isEmbedded
)
{
if
(
ole
->
isEquation
)
ole
->
ClipboardFormat
=
L"Equation"
;
if
(
ole
->
isEmbedded
)
ole
->
ClipboardFormat
=
L"MSWordDocx"
;
else
ole
->
ClipboardFormat
=
L"MSWordDocx"
;
ole
->
Program
=
L"Word.Document"
;
}
...
...
@@ -46,7 +46,8 @@ namespace DocFileFormat
else
{
int
relID
=
-
1
;
if
(
ole
->
isEquation
||
ole
->
isEmbedded
)
if
(
ole
->
isEmbedded
)
relID
=
m_context
->
_docx
->
RegisterPackage
(
_caller
,
ole
->
ClipboardFormat
);
else
relID
=
m_context
->
_docx
->
RegisterOLEObject
(
_caller
,
ole
->
ClipboardFormat
);
...
...
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
View file @
506680d3
...
...
@@ -5,10 +5,65 @@
#include "OfficeDrawing/GeometryTextBooleanProperties.h"
#include "../../DesktopEditor/common/String.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
namespace
DocFileFormat
{
bool
ParseEmbeddedEquation
(
const
std
::
string
&
xmlString
,
std
::
wstring
&
newXmlString
)
{
newXmlString
.
clear
();
std
::
wstring
sTempXmlFile
=
FileSystem
::
Directory
::
CreateTempFileWithUniqueName
(
FileSystem
::
Directory
::
GetTempPathW
(),
L"emb"
);
sTempXmlFile
+=
L".xml"
;
NSFile
::
CFileBinary
file
;
file
.
CreateFileW
(
sTempXmlFile
);
file
.
WriteFile
((
BYTE
*
)
xmlString
.
c_str
(),
xmlString
.
size
());
file
.
CloseFile
();
OOX
::
CPath
path
(
sTempXmlFile
.
c_str
());
OOX
::
CDocument
docEmbedded
(
path
,
path
);
bool
res
=
false
;
for
(
int
i
=
0
;
i
<
docEmbedded
.
m_arrItems
.
size
();
i
++
)
{
if
(
docEmbedded
.
m_arrItems
[
i
]
->
getType
()
==
OOX
::
et_w_p
)
{
OOX
::
Logic
::
CParagraph
*
paragraph
=
dynamic_cast
<
OOX
::
Logic
::
CParagraph
*>
(
docEmbedded
.
m_arrItems
[
i
]);
for
(
int
j
=
0
;
(
paragraph
)
&&
(
j
<
paragraph
->
m_arrItems
.
size
());
j
++
)
{
if
(
paragraph
->
m_arrItems
[
j
]
->
getType
()
==
OOX
::
et_m_oMath
)
{
res
=
true
;
newXmlString
=
paragraph
->
m_arrItems
[
j
]
->
toXML
().
GetBuffer
();
break
;
}
else
if
(
paragraph
->
m_arrItems
[
j
]
->
getType
()
==
OOX
::
et_m_oMathPara
)
{
OOX
::
Logic
::
COMathPara
*
mathPara
=
dynamic_cast
<
OOX
::
Logic
::
COMathPara
*>
(
paragraph
->
m_arrItems
[
j
]);
for
(
int
k
=
0
;
(
mathPara
)
&&
(
k
<
mathPara
->
m_arrItems
.
size
());
k
++
)
{
if
(
mathPara
->
m_arrItems
[
k
]
->
getType
()
==
OOX
::
et_m_oMath
)
{
res
=
true
;
newXmlString
=
mathPara
->
m_arrItems
[
k
]
->
toXML
().
GetBuffer
();
break
;
}
}
}
if
(
res
)
break
;
}
if
(
res
)
break
;
}
}
return
res
;
}
//---------------------------------------------------------------
static
int
count_vml_objects
=
0
;
void
VMLPictureMapping
::
appendStyleProperty
(
std
::
wstring
*
b
,
const
std
::
wstring
&
propName
,
const
std
::
wstring
&
propValue
)
const
{
...
...
@@ -42,10 +97,7 @@ namespace DocFileFormat
{
RELEASEOBJECT
(
m_imageData
);
}
}
namespace
DocFileFormat
{
void
VMLPictureMapping
::
Apply
(
IVisitable
*
visited
)
{
PictureDescriptor
*
pict
=
static_cast
<
PictureDescriptor
*>
(
visited
);
...
...
@@ -97,7 +149,14 @@ namespace DocFileFormat
case
wzEquationXML
:
{
m_isEquation
=
true
;
m_isEmbedded
=
true
;
m_embeddedData
=
std
::
string
((
char
*
)
iter
->
opComplex
,
iter
->
op
);
if
(
ParseEmbeddedEquation
(
m_embeddedData
,
m_equationXml
))
{
m_isEmbedded
=
false
;
}
}
break
;
case
metroBlob
:
{
...
...
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
View file @
506680d3
...
...
@@ -13,6 +13,8 @@
namespace
DocFileFormat
{
bool
ParseEmbeddedEquation
(
const
std
::
string
&
xmlString
,
std
::
wstring
&
newXmlString
);
class
VMLPictureMapping
:
public
PropertiesMapping
,
public
IMapping
{
public:
...
...
@@ -39,6 +41,7 @@ namespace DocFileFormat
bool
m_isEquation
;
bool
m_isEmbedded
;
std
::
string
m_embeddedData
;
std
::
wstring
m_equationXml
;
private:
ConversionContext
*
m_ctx
;
...
...
ASCOfficeDocFile/DocFormatTest/DocFormatTest.vcproj
View file @
506680d3
...
...
@@ -378,6 +378,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\..\Common\DocxFormat\Source\XML\libxml2\libxml2.cpp"
>
</File>
</Files>
<Globals>
</Globals>
...
...
ASCOfficeDocFile/Win32/ASCOfficeDocFile2005.vcproj
View file @
506680d3
...
...
@@ -636,6 +636,18 @@
RelativePath=
".\ASCOfficeDocFile.cpp"
>
</File>
<File
RelativePath=
"..\..\Common\DocxFormat\Source\XML\libxml2\libxml2.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
</FileConfiguration>
</File>
<File
RelativePath=
".\stdafx.cpp"
>
...
...
ASCOfficeDocFile/Win32/OfficeDocFile_VS2005.sln
View file @
506680d3
...
...
@@ -4,6 +4,7 @@ Microsoft Visual Studio Solution File, Format Version 9.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeDocFile", "ASCOfficeDocFile2005.vcproj", "{DA13D6D4-39B5-49DB-B5D7-D1AFDBB7C320}"
ProjectSection(ProjectDependencies) = postProject
{C5371405-338F-4B70-83BD-2A5CDF64F383} = {C5371405-338F-4B70-83BD-2A5CDF64F383}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\DocFormatLib\Win32\DocFormatLib.vcproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}"
...
...
@@ -24,6 +25,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml2", "..\..\Common\DocxFormat\Source\XML\libxml2\win_build\libxml2.vcproj", "{21663823-DE45-479B-91D0-B4FEF4916EF0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
ProjectSection(ProjectDependencies) = postProject
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatTest", "..\DocFormatTest\DocFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject
...
...
Common/DocxFormat/Source/Common/SimpleTypes_Word.h
View file @
506680d3
...
...
@@ -3026,7 +3026,14 @@ namespace SimpleTypes
{
CString
sResult
;
if
(
m_bUnit
)
{
sResult
.
Format
(
_T
(
"%fpt"
),
m_dValue
);
}
else
{
sResult
.
Format
(
_T
(
"%d"
),
(
int
)(
m_dValue
*
2
));
}
return
sResult
;
}
...
...
Common/DocxFormat/Source/DocxFormat/Math/OMath.h
View file @
506680d3
...
...
@@ -19,10 +19,12 @@ namespace OOX
CMathArgNodes
(
XmlUtils
::
CXmlNode
&
oNode
)
{
fromXML
(
oNode
);
sNodeName
=
GetMathNodeName
(
getType
());
}
CMathArgNodes
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
fromXML
(
oReader
);
sNodeName
=
GetMathNodeName
(
getType
());
}
virtual
~
CMathArgNodes
()
{
...
...
@@ -51,6 +53,8 @@ namespace OOX
virtual
CString
toXML
()
const
{
if
(
sNodeName
.
IsEmpty
())
return
L""
;
CString
sResult
=
_T
(
"<"
)
+
sNodeName
+
_T
(
">"
);
for
(
unsigned
int
nIndex
=
0
;
nIndex
<
m_arrItems
.
size
();
nIndex
++
)
...
...
@@ -61,7 +65,7 @@ namespace OOX
}
}
sResult
=
_T
(
"</"
)
+
sNodeName
+
_T
(
">"
);
sResult
+
=
_T
(
"</"
)
+
sNodeName
+
_T
(
">"
);
return
sResult
;
}
...
...
@@ -72,13 +76,45 @@ namespace OOX
}
private:
EElementType
eType
;
public:
CString
sNodeName
;
public:
CString
GetMathNodeName
(
const
EElementType
&
enumType
)
const
{
//todooo - MathBottomNodes
switch
(
enumType
)
{
case
OOX
:
:
et_m_deg
:
return
L"m:deg"
;
case
OOX
:
:
et_m_den
:
return
L"m:den"
;
case
OOX
:
:
et_m_e
:
return
L"m:e"
;
case
OOX
:
:
et_m_fName
:
return
L"m:fName"
;
case
OOX
:
:
et_m_lim
:
return
L"m:lim"
;
case
OOX
:
:
et_m_num
:
return
L"m:num"
;
case
OOX
:
:
et_m_oMath
:
return
L"m:oMath"
;
case
OOX
:
:
et_m_sub
:
return
L"m:sub"
;
case
OOX
:
:
et_m_sup
:
return
L"m:sup"
;
}
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
Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h
View file @
506680d3
...
...
@@ -179,6 +179,8 @@ namespace OOX
}
virtual
CString
toXML
()
const
{
if
(
sNodeName
.
IsEmpty
())
return
L""
;
CString
sResult
=
_T
(
"<"
)
+
sNodeName
+
_T
(
" m:val=
\"
"
);
sResult
+=
m_val
->
ToString
();
sResult
+=
_T
(
"
\"
/>"
);
...
...
@@ -191,7 +193,6 @@ namespace OOX
}
private:
EElementType
eType
;
CString
sNodeName
;
void
ReadAttributes
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
...
...
@@ -200,8 +201,79 @@ namespace OOX
WritingElement_ReadAttributes_ReadSingle
(
oReader
,
_T
(
"m:val"
),
m_val
)
WritingElement_ReadAttributes_End
(
oReader
)
}
public:
CString
sNodeName
;
CString
GetMathNodeName
(
const
EElementType
&
enumType
)
const
{
//todooo - MathArgNodes
switch
(
enumType
)
{
case
OOX
:
:
et_m_deg
:
return
L"m:deg"
;
case
OOX
:
:
et_m_aln
:
return
L"m:aln"
;
case
OOX
:
:
et_m_alnScr
:
return
L"m:alnScr"
;
case
OOX
:
:
et_m_argSz
:
return
L"m:argSz"
;
case
OOX
:
:
et_m_baseJc
:
return
L"m:baseJc"
;
case
OOX
:
:
et_m_begChr
:
return
L"m:begChr"
;
case
OOX
:
:
et_m_brkBin
:
return
L"m:brkBin"
;
case
OOX
:
:
et_m_brkBinSub
:
return
L"m:brkBinSub"
;
case
OOX
:
:
et_m_cGp
:
return
L"m:cGp"
;
case
OOX
:
:
et_m_cGpRule
:
return
L"m:cGpRule"
;
case
OOX
:
:
et_m_chr
:
return
L"m:chr"
;
case
OOX
:
:
et_m_count
:
return
L"m:count"
;
case
OOX
:
:
et_m_cSp
:
return
L"m:cSp"
;
case
OOX
:
:
et_m_defJc
:
return
L"m:defJc"
;
case
OOX
:
:
et_m_degHide
:
return
L"m:degHide"
;
case
OOX
:
:
et_m_diff
:
return
L"m:diff"
;
case
OOX
:
:
et_m_dispDef
:
return
L"m:dispDef"
;
case
OOX
:
:
et_m_endChr
:
return
L"m:endChr"
;
case
OOX
:
:
et_m_grow
:
return
L"m:grow"
;
case
OOX
:
:
et_m_hideBot
:
return
L"m:hideBot"
;
case
OOX
:
:
et_m_hideLeft
:
return
L"m:hideLeft"
;
case
OOX
:
:
et_m_hideRight
:
return
L"m:hideRight"
;
case
OOX
:
:
et_m_hideTop
:
return
L"m:hideTop"
;
case
OOX
:
:
et_m_interSp
:
return
L"m:interSp"
;
case
OOX
:
:
et_m_intLim
:
return
L"m:intLim"
;
case
OOX
:
:
et_m_intraSp
:
return
L"m:intraSp"
;
case
OOX
:
:
et_m_jc
:
return
L"m:jc"
;
case
OOX
:
:
et_m_limLoc
:
return
L"m:limLoc"
;
case
OOX
:
:
et_m_lit
:
return
L"m:lit"
;
case
OOX
:
:
et_m_lMargin
:
return
L"m:lMargin"
;
case
OOX
:
:
et_m_maxDist
:
return
L"m:maxDist"
;
case
OOX
:
:
et_m_mcJc
:
return
L"m:mcJc"
;
case
OOX
:
:
et_m_naryLim
:
return
L"m:naryLim"
;
case
OOX
:
:
et_m_noBreak
:
return
L"m:noBreak"
;
case
OOX
:
:
et_m_nor
:
return
L"m:nor"
;
case
OOX
:
:
et_m_objDist
:
return
L"m:objDist"
;
case
OOX
:
:
et_m_opEmu
:
return
L"m:opEmu"
;
case
OOX
:
:
et_m_plcHide
:
return
L"m:plcHide"
;
case
OOX
:
:
et_m_pos
:
return
L"m:pos"
;
case
OOX
:
:
et_m_postSp
:
return
L"m:postSp"
;
case
OOX
:
:
et_m_preSp
:
return
L"m:preSp"
;
case
OOX
:
:
et_m_rMargin
:
return
L"m:rMargin"
;
case
OOX
:
:
et_m_rSp
:
return
L"m:rSp"
;
case
OOX
:
:
et_m_rSpRule
:
return
L"m:rSpRule"
;
case
OOX
:
:
et_m_scr
:
return
L"m:scr"
;
case
OOX
:
:
et_m_sepChr
:
return
L"m:sepChr"
;
case
OOX
:
:
et_m_show
:
return
L"m:show"
;
case
OOX
:
:
et_m_shp
:
return
L"m:shp"
;
case
OOX
:
:
et_m_smallFrac
:
return
L"m:smallFrac"
;
case
OOX
:
:
et_m_strikeBLTR
:
return
L"m:strikeBLTR"
;
case
OOX
:
:
et_m_strikeH
:
return
L"m:strikeH"
;
case
OOX
:
:
et_m_strikeTLBR
:
return
L"m:strikeTLBR"
;
case
OOX
:
:
et_m_strikeV
:
return
L"m:strikeV"
;
case
OOX
:
:
et_m_sty
:
return
L"m:sty"
;
case
OOX
:
:
et_m_subHide
:
return
L"m:subHide"
;
case
OOX
:
:
et_m_supHide
:
return
L"m:supHide"
;
case
OOX
:
:
et_m_transp
:
return
L"m:transp"
;
case
OOX
:
:
et_m_type
:
return
L"m:type"
;
case
OOX
:
:
et_m_vertJc
:
return
L"m:vertJc"
;
case
OOX
:
:
et_m_wrapIndent
:
return
L"m:wrapIndent"
;
case
OOX
:
:
et_m_wrapRight
:
return
L"m:wrapRight"
;
case
OOX
:
:
et_m_zeroAsc
:
return
L"m:zeroAsc"
;
case
OOX
:
:
et_m_zeroDesc
:
return
L"m:zeroDesc"
;
case
OOX
:
:
et_m_zeroWid
:
return
L"m:zeroWid"
;
}
return
L""
;
}
nullable
<
TMathBottomType
>
m_val
;
};
...
...
@@ -213,10 +285,12 @@ namespace OOX
CMathBottomNodesEx
(
XmlUtils
::
CXmlNode
&
oNode
)
{
fromXML
(
oNode
);
sNodeName
=
GetMathNodeName
(
getType
());
}
CMathBottomNodesEx
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
fromXML
(
oReader
);
sNodeName
=
GetMathNodeName
(
getType
());
}
virtual
EElementType
getType
()
const
{
...
...
Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h
View file @
506680d3
...
...
@@ -18,15 +18,15 @@ namespace OOX
// Elements 22.1.2
namespace
Logic
{
typedef
CMathArgNodes
CDeg
;
typedef
CMathArgNodes
CDen
;
typedef
CMathArgNodes
CElement
;
typedef
CMathArgNodes
CFName
;
typedef
CMathArgNodes
CLim
;
typedef
CMathArgNodes
CNum
;
typedef
CMathArgNodes
COMath
;
typedef
CMathArgNodes
CSub
;
typedef
CMathArgNodes
CSup
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_deg
>
CDeg
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_den
>
CDen
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_e
>
CElement
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_fName
>
CFName
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_lim
>
CLim
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_num
>
CNum
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_oMath
>
COMath
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_sub
>
CSub
;
typedef
CMathArgNodes
Ex
<
OOX
::
et_m_sup
>
CSup
;
//--------------------------------------------------------------------------------
// CAcc 22.1.2.1 (Accent)
//--------------------------------------------------------------------------------
...
...
@@ -2566,19 +2566,17 @@ namespace OOX
// Childs
nullable
<
CMRun
>
m_oRun
;
};
//--------------------------------------------------------------------------------
// CRad
22.1.2.88 (Radical Object
)
// CRad
Pr 22.1.2.89 (Radical Properties
)
//--------------------------------------------------------------------------------
class
CRadPr
;
class
CRad
:
public
WritingElement
class
CRadPr
:
public
WritingElement
{
public:
WritingElement_AdditionConstructors
(
CRad
)
CRad
()
WritingElement_AdditionConstructors
(
CRad
Pr
)
CRad
Pr
()
{
}
virtual
~
CRad
()
virtual
~
CRad
Pr
()
{
}
...
...
@@ -2594,42 +2592,46 @@ namespace OOX
while
(
oReader
.
ReadNextSiblingNode
(
nParentDepth
)
)
{
CWCharWrapper
sName
=
oReader
.
GetName
();
if
(
_T
(
"m:deg"
)
==
sName
)
m_oDeg
=
oReader
;
else
if
(
_T
(
"m:e"
)
==
sName
)
m_oElement
=
oReader
;
else
if
(
_T
(
"m:radPr"
)
==
sName
)
m_oRadPr
=
oReader
;
if
(
_T
(
"m:ctrlPr"
)
==
sName
)
m_oCtrlPr
=
oReader
;
else
if
(
_T
(
"m:degHide"
)
==
sName
)
m_oDegHide
=
oReader
;
}
}
virtual
CString
toXML
()
const
{
CString
sResult
=
_T
(
"<m:rad>"
);
CString
sResult
=
_T
(
"<m:rad
Pr
>"
);
if
(
m_oCtrlPr
.
IsInit
()
)
sResult
+=
m_oCtrlPr
->
toXML
();
if
(
m_oDegHide
.
IsInit
()
)
sResult
+=
m_oDegHide
->
toXML
();
sResult
+=
_T
(
"</m:radPr>"
);
return
sResult
;
}
virtual
EElementType
getType
()
const
{
return
et_m_rad
;
return
et_m_rad
Pr
;
}
public:
//Childs
nullable
<
OOX
::
Logic
::
CDeg
>
m_oDeg
;
nullable
<
OOX
::
Logic
::
CElement
>
m_oElement
;
nullable
<
OOX
::
Logic
::
CRadPr
>
m_oRadPr
;
nullable
<
OOX
::
Logic
::
CCtrlPr
>
m_oCtrlPr
;
nullable
<
OOX
::
Logic
::
CDegHide
>
m_oDegHide
;
};
//--------------------------------------------------------------------------------
// CRad
Pr 22.1.2.89 (Radical Properties
)
// CRad
22.1.2.88 (Radical Object
)
//--------------------------------------------------------------------------------
class
CRad
Pr
:
public
WritingElement
class
CRad
:
public
WritingElement
{
public:
WritingElement_AdditionConstructors
(
CRad
Pr
)
CRad
Pr
()
WritingElement_AdditionConstructors
(
CRad
)
CRad
()
{
}
virtual
~
CRad
Pr
()
virtual
~
CRad
()
{
}
...
...
@@ -2645,27 +2647,40 @@ namespace OOX
while
(
oReader
.
ReadNextSiblingNode
(
nParentDepth
)
)
{
CWCharWrapper
sName
=
oReader
.
GetName
();
if
(
_T
(
"m:ctrlPr"
)
==
sName
)
m_oCtrlPr
=
oReader
;
else
if
(
_T
(
"m:degHide"
)
==
sName
)
m_oDegHide
=
oReader
;
if
(
_T
(
"m:deg"
)
==
sName
)
m_oDeg
=
oReader
;
else
if
(
_T
(
"m:e"
)
==
sName
)
m_oElement
=
oReader
;
else
if
(
_T
(
"m:radPr"
)
==
sName
)
m_oRadPr
=
oReader
;
}
}
virtual
CString
toXML
()
const
{
CString
sResult
=
_T
(
"<m:radPr>"
);
CString
sResult
=
_T
(
"<m:rad>"
);
if
(
m_oRadPr
.
IsInit
())
sResult
+=
m_oRadPr
->
toXML
();
if
(
m_oDeg
.
IsInit
()
)
sResult
+=
m_oDeg
->
toXML
();
if
(
m_oElement
.
IsInit
()
)
sResult
+=
m_oElement
->
toXML
();
sResult
+=
_T
(
"</m:rad>"
);
return
sResult
;
}
virtual
EElementType
getType
()
const
{
return
et_m_rad
Pr
;
return
et_m_rad
;
}
public:
//Childs
nullable
<
OOX
::
Logic
::
CCtrlPr
>
m_oCtrlPr
;
nullable
<
OOX
::
Logic
::
CDegHide
>
m_oDegHide
;
nullable
<
OOX
::
Logic
::
CDeg
>
m_oDeg
;
nullable
<
OOX
::
Logic
::
CElement
>
m_oElement
;
nullable
<
OOX
::
Logic
::
CRadPr
>
m_oRadPr
;
};
//--------------------------------------------------------------------------------
// CMRPr 22.1.2.91 (Run Properties)
...
...
@@ -2711,6 +2726,25 @@ namespace OOX
{
CString
sResult
=
_T
(
"<m:rPr>"
);
if
(
m_oAln
.
IsInit
()
)
sResult
+=
m_oAln
->
toXML
();
if
(
m_oBrk
.
IsInit
()
)
sResult
+=
m_oBrk
->
toXML
();
if
(
m_oLit
.
IsInit
()
)
sResult
+=
m_oLit
->
toXML
();
if
(
m_oNor
.
IsInit
()
)
sResult
+=
m_oNor
->
toXML
();
if
(
m_oScr
.
IsInit
()
)
sResult
+=
m_oScr
->
toXML
();
if
(
m_oSty
.
IsInit
()
)
sResult
+=
m_oSty
->
toXML
();
sResult
+=
_T
(
"</m:rPr>"
);
return
sResult
;
}
...
...
@@ -2728,9 +2762,58 @@ namespace OOX
nullable
<
OOX
::
Logic
::
CSty
>
m_oSty
;
};
//--------------------------------------------------------------------------------
// CSPrePr 22.1.2.100 (Pre-Sub-Superscript Properties))
//--------------------------------------------------------------------------------
class
CSPrePr
:
public
WritingElement
{
public:
WritingElement_AdditionConstructors
(
CSPrePr
)
CSPrePr
()
{
}
virtual
~
CSPrePr
()
{
}
public:
virtual
void
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
{
}
virtual
void
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
if
(
oReader
.
IsEmptyNode
()
)
return
;
int
nParentDepth
=
oReader
.
GetDepth
();
while
(
oReader
.
ReadNextSiblingNode
(
nParentDepth
)
)
{
CWCharWrapper
sName
=
oReader
.
GetName
();
if
(
_T
(
"m:ctrlPr"
)
==
sName
)
m_oCtrlPr
=
oReader
;
}
}
virtual
CString
toXML
()
const
{
CString
sResult
=
_T
(
"<m:sPrePr>"
);
if
(
m_oCtrlPr
.
IsInit
())
sResult
+=
m_oCtrlPr
->
toXML
();
sResult
+=
_T
(
"</m:sPrePr>"
);
return
sResult
;
}
virtual
EElementType
getType
()
const
{
return
et_m_sPrePr
;
}
public:
//Childs
nullable
<
OOX
::
Logic
::
CCtrlPr
>
m_oCtrlPr
;
};
//--------------------------------------------------------------------------------
// CSPre 22.1.2.99 (Pre-Sub-Superscript Object)
//--------------------------------------------------------------------------------
class
CSPrePr
;
class
CSPre
:
public
WritingElement
{
public:
...
...
@@ -2768,6 +2851,19 @@ namespace OOX
{
CString
sResult
=
_T
(
"<m:sPre>"
);
if
(
m_oSPrePr
.
IsInit
()
)
sResult
+=
m_oSPrePr
->
toXML
();
if
(
m_oElement
.
IsInit
()
)
sResult
+=
m_oElement
->
toXML
();
if
(
m_oSub
.
IsInit
()
)
sResult
+=
m_oSub
->
toXML
();
if
(
m_oSup
.
IsInit
()
)
sResult
+=
m_oSup
->
toXML
();
sResult
+=
_T
(
"</m:sPre>"
);
return
sResult
;
}
...
...
@@ -2785,16 +2881,16 @@ namespace OOX
//--------------------------------------------------------------------------------
// CS
PrePr 22.1.2.100 (Pre-Sub-Superscript Properties)
)
// CS
SubPr 22.1.2.102 (Subscript Properties
)
//--------------------------------------------------------------------------------
class
CS
Pre
Pr
:
public
WritingElement
class
CS
Sub
Pr
:
public
WritingElement
{
public:
WritingElement_AdditionConstructors
(
CS
Pre
Pr
)
CS
Pre
Pr
()
WritingElement_AdditionConstructors
(
CS
Sub
Pr
)
CS
Sub
Pr
()
{
}
virtual
~
CS
Pre
Pr
()
virtual
~
CS
Sub
Pr
()
{
}
...
...
@@ -2816,14 +2912,18 @@ namespace OOX
}
virtual
CString
toXML
()
const
{
CString
sResult
=
_T
(
"<m:sPrePr>"
);
CString
sResult
=
_T
(
"<m:sSubPr>"
);
if
(
m_oCtrlPr
.
IsInit
())
sResult
+=
m_oCtrlPr
->
toXML
();
sResult
+=
_T
(
"</m:sSubPr>"
);
return
sResult
;
}
virtual
EElementType
getType
()
const
{
return
et_m_s
Pre
Pr
;
return
et_m_s
Sub
Pr
;
}
public:
//Childs
...
...
@@ -2832,7 +2932,6 @@ namespace OOX
//--------------------------------------------------------------------------------
// CSSub 22.1.2.101 (Subscript Object)
//--------------------------------------------------------------------------------
class
CSSubPr
;
class
CSSub
:
public
WritingElement
{
public:
...
...
@@ -2868,6 +2967,16 @@ namespace OOX
{
CString
sResult
=
_T
(
"<m:sSub>"
);
if
(
m_oSSubPr
.
IsInit
())
sResult
+=
m_oSSubPr
->
toXML
();
if
(
m_oElement
.
IsInit
())
sResult
+=
m_oElement
->
toXML
();
if
(
m_oSub
.
IsInit
())
sResult
+=
m_oSub
->
toXML
();
sResult
+=
_T
(
"</m:sSub>"
);
return
sResult
;
}
...
...
@@ -2884,16 +2993,16 @@ namespace OOX
//--------------------------------------------------------------------------------
// CSSub
Pr 22.1.2.102 (Sub
script Properties)
// CSSub
SupPr 22.1.2.104 (Sub-Super
script Properties)
//--------------------------------------------------------------------------------
class
CSSubPr
:
public
WritingElement
class
CSSub
Sup
Pr
:
public
WritingElement
{
public:
WritingElement_AdditionConstructors
(
CSSubPr
)
CSSubPr
()
WritingElement_AdditionConstructors
(
CSSub
Sup
Pr
)
CSSub
Sup
Pr
()
{
}
virtual
~
CSSubPr
()
virtual
~
CSSub
Sup
Pr
()
{
}
...
...
@@ -2909,29 +3018,38 @@ namespace OOX
while
(
oReader
.
ReadNextSiblingNode
(
nParentDepth
)
)
{
CWCharWrapper
sName
=
oReader
.
GetName
();
if
(
_T
(
"m:ctrlPr"
)
==
sName
)
if
(
_T
(
"m:alnScr"
)
==
sName
)
m_oAlnScr
=
oReader
;
else
if
(
_T
(
"m:ctrlPr"
)
==
sName
)
m_oCtrlPr
=
oReader
;
}
}
virtual
CString
toXML
()
const
{
CString
sResult
=
_T
(
"<m:sSubPr>"
);
CString
sResult
=
_T
(
"<m:sSub
Sup
Pr>"
);
if
(
m_oAlnScr
.
IsInit
())
sResult
+=
m_oAlnScr
->
toXML
();
if
(
m_oCtrlPr
.
IsInit
())
sResult
+=
m_oCtrlPr
->
toXML
();
sResult
+=
_T
(
"</m:sSubSupPr>"
);
return
sResult
;
}
virtual
EElementType
getType
()
const
{
return
et_m_sSubPr
;
return
et_m_sSub
Sup
Pr
;
}
public:
//Childs
nullable
<
OOX
::
Logic
::
CAlnScr
>
m_oAlnScr
;
nullable
<
OOX
::
Logic
::
CCtrlPr
>
m_oCtrlPr
;
};
//--------------------------------------------------------------------------------
// CSSubSup 22.1.2.103 (Sub-Superscript Object)
//--------------------------------------------------------------------------------
class
CSSubSupPr
;
class
CSSubSup
:
public
WritingElement
{
public:
...
...
@@ -2969,6 +3087,19 @@ namespace OOX
{
CString
sResult
=
_T
(
"<m:sSubSup>"
);
if
(
m_oSSubSupPr
.
IsInit
())
sResult
+=
m_oSSubSupPr
->
toXML
();
if
(
m_oElement
.
IsInit
())
sResult
+=
m_oElement
->
toXML
();
if
(
m_oSub
.
IsInit
())
sResult
+=
m_oSub
->
toXML
();
if
(
m_oSup
.
IsInit
())
sResult
+=
m_oSup
->
toXML
();
sResult
+=
_T
(
"</m:sSubSup>"
);
return
sResult
;
}
...
...
@@ -2984,16 +3115,16 @@ namespace OOX
nullable
<
OOX
::
Logic
::
CSup
>
m_oSup
;
};
//--------------------------------------------------------------------------------
// CSSu
bSupPr 22.1.2.104 (Sub-Superscript Properties)
// CSSu
pPr 22.1.2.106 (Superscript Properties)
//--------------------------------------------------------------------------------
class
CSSu
bSu
pPr
:
public
WritingElement
class
CSSupPr
:
public
WritingElement
{
public:
WritingElement_AdditionConstructors
(
CSSu
bSu
pPr
)
CSSu
bSu
pPr
()
WritingElement_AdditionConstructors
(
CSSupPr
)
CSSupPr
()
{
}
virtual
~
CSSu
bSu
pPr
()
virtual
~
CSSupPr
()
{
}
...
...
@@ -3009,32 +3140,32 @@ namespace OOX
while
(
oReader
.
ReadNextSiblingNode
(
nParentDepth
)
)
{
CWCharWrapper
sName
=
oReader
.
GetName
();
if
(
_T
(
"m:alnScr"
)
==
sName
)
m_oAlnScr
=
oReader
;
else
if
(
_T
(
"m:ctrlPr"
)
==
sName
)
if
(
_T
(
"m:ctrlPr"
)
==
sName
)
m_oCtrlPr
=
oReader
;
}
}
virtual
CString
toXML
()
const
{
CString
sResult
=
_T
(
"<m:sSubSupPr>"
);
CString
sResult
=
_T
(
"<m:sSupPr>"
);
if
(
m_oCtrlPr
.
IsInit
())
sResult
+=
m_oCtrlPr
->
toXML
();
sResult
+=
_T
(
"</m:sSupPr>"
);
return
sResult
;
}
virtual
EElementType
getType
()
const
{
return
et_m_sSu
bSu
pPr
;
return
et_m_sSupPr
;
}
public:
//Childs
nullable
<
OOX
::
Logic
::
CAlnScr
>
m_oAlnScr
;
nullable
<
OOX
::
Logic
::
CCtrlPr
>
m_oCtrlPr
;
};
//--------------------------------------------------------------------------------
// CSSup 22.1.2.105 (Superscript Object)
//--------------------------------------------------------------------------------
class
CSSupPr
;
class
CSSup
:
public
WritingElement
{
public:
...
...
@@ -3070,6 +3201,16 @@ namespace OOX
{
CString
sResult
=
_T
(
"<m:sSup>"
);
if
(
m_oSSupPr
.
IsInit
())
sResult
+=
m_oSSupPr
->
toXML
();
if
(
m_oElement
.
IsInit
())
sResult
+=
m_oElement
->
toXML
();
if
(
m_oSup
.
IsInit
())
sResult
+=
m_oSup
->
toXML
();
sResult
+=
_T
(
"</m:sSup>"
);
return
sResult
;
}
...
...
@@ -3085,51 +3226,6 @@ namespace OOX
};
//--------------------------------------------------------------------------------
// CSSupPr 22.1.2.106 (Superscript Properties)
//--------------------------------------------------------------------------------
class
CSSupPr
:
public
WritingElement
{
public:
WritingElement_AdditionConstructors
(
CSSupPr
)
CSSupPr
()
{
}
virtual
~
CSSupPr
()
{
}
public:
virtual
void
fromXML
(
XmlUtils
::
CXmlNode
&
oNode
)
{
}
virtual
void
fromXML
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
if
(
oReader
.
IsEmptyNode
()
)
return
;
int
nParentDepth
=
oReader
.
GetDepth
();
while
(
oReader
.
ReadNextSiblingNode
(
nParentDepth
)
)
{
CWCharWrapper
sName
=
oReader
.
GetName
();
if
(
_T
(
"m:ctrlPr"
)
==
sName
)
m_oCtrlPr
=
oReader
;
}
}
virtual
CString
toXML
()
const
{
CString
sResult
=
_T
(
"<m:sSupPr>"
);
return
sResult
;
}
virtual
EElementType
getType
()
const
{
return
et_m_sSupPr
;
}
public:
//Childs
nullable
<
OOX
::
Logic
::
CCtrlPr
>
m_oCtrlPr
;
};
//--------------------------------------------------------------------------------
// CMText 22.1.2.116 (Math Text)
//--------------------------------------------------------------------------------
...
...
@@ -3170,7 +3266,7 @@ namespace OOX
else
sResult
=
_T
(
"<m:t>"
);
sResult
+=
m_sText
;
sResult
+=
XmlUtils
::
EncodeXmlString
(
m_sText
)
;
sResult
+=
_T
(
"</m:t>"
);
return
sResult
;
...
...
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