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
2e8c83a6
Commit
2e8c83a6
authored
Mar 29, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RtfFormat, TxtFormat - chage convert from ooxml drawing
parent
e8574965
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
827 additions
and
979 deletions
+827
-979
ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp
ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp
+4
-1
ASCOfficeRtfFile/RtfFormatLib/Win32/RtfFormatLib.vcproj
ASCOfficeRtfFile/RtfFormatLib/Win32/RtfFormatLib.vcproj
+0
-4
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXColorReader.h
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXColorReader.h
+38
-42
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXColorSchemeReader.h
...RtfFile/RtfFormatLib/source/Reader/OOXColorSchemeReader.h
+15
-15
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
...le/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
+24
-100
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.h
...File/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.h
+6
-15
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXFontReader.h
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXFontReader.h
+29
-28
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXFontSchemeReader.h
...eRtfFile/RtfFormatLib/source/Reader/OOXFontSchemeReader.h
+12
-31
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp
...RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp
+337
-351
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphReader.h
...ceRtfFile/RtfFormatLib/source/Reader/OOXParagraphReader.h
+3
-2
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureAnchorReader.h
...fFile/RtfFormatLib/source/Reader/OOXPictureAnchorReader.h
+2
-7
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureInlineReader.h
...fFile/RtfFormatLib/source/Reader/OOXPictureInlineReader.h
+3
-7
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXReader.cpp
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXReader.cpp
+1
-1
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXRunReader.h
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXRunReader.h
+2
-2
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
...ficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
+275
-302
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.h
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.h
+14
-18
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXTextItemReader.h
...iceRtfFile/RtfFormatLib/source/Reader/OOXTextItemReader.h
+1
-1
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXThemeReader.h
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXThemeReader.h
+4
-4
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXpPrReader.h
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXpPrReader.h
+2
-2
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXrPrReader.h
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXrPrReader.h
+2
-2
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXWriter.cpp
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXWriter.cpp
+1
-1
ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFile.cpp
...fficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFile.cpp
+37
-31
ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.cpp
ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.cpp
+15
-12
No files found.
ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp
View file @
2e8c83a6
...
@@ -196,6 +196,8 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
...
@@ -196,6 +196,8 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
<Default Extension=
\"
xml
\"
ContentType=
\"
application/xml
\"
/>\
<Default Extension=
\"
xml
\"
ContentType=
\"
application/xml
\"
/>\
<Default Extension=
\"
gif
\"
ContentType=
\"
image/gif
\"
/>\
<Default Extension=
\"
gif
\"
ContentType=
\"
image/gif
\"
/>\
<Default Extension=
\"
emf
\"
ContentType=
\"
image/x-emf
\"
/>\
<Default Extension=
\"
emf
\"
ContentType=
\"
image/x-emf
\"
/>\
<Default Extension=
\"
xls
\"
ContentType=
\"
application/vnd.ms-excel
\"
/>\
<Default Extension=
\"
xlsx
\"
ContentType=
\"
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
\"
/>\
<Default Extension=
\"
bin
\"
ContentType=
\"
application/vnd.openxmlformats-officedocument.oleObject
\"
/>\
<Default Extension=
\"
bin
\"
ContentType=
\"
application/vnd.openxmlformats-officedocument.oleObject
\"
/>\
<Default Extension=
\"
jpg
\"
ContentType=
\"
application/octet-stream
\"
/>"
);
<Default Extension=
\"
jpg
\"
ContentType=
\"
application/octet-stream
\"
/>"
);
...
@@ -551,7 +553,7 @@ void NSPresentationEditor::CPPTXWriter::WriteThemes()
...
@@ -551,7 +553,7 @@ void NSPresentationEditor::CPPTXWriter::WriteThemes()
oFile
.
WriteStringUTF8
(
oStringWriter
.
GetData
());
oFile
.
WriteStringUTF8
(
oStringWriter
.
GetData
());
oFile
.
CloseFile
();
oFile
.
CloseFile
();
// теперь masterslide
// теперь masterslide
CRelsGenerator
oRels
(
&
m_oManager
);
CRelsGenerator
oRels
(
&
m_oManager
);
int
nCountLayouts
=
(
int
)
pTheme
->
m_arLayouts
.
size
();
int
nCountLayouts
=
(
int
)
pTheme
->
m_arLayouts
.
size
();
...
@@ -767,6 +769,7 @@ void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRe
...
@@ -767,6 +769,7 @@ void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRe
void
NSPresentationEditor
::
CPPTXWriter
::
WriteLayout
(
CLayout
&
oLayout
,
int
nIndexLayout
,
int
nStartLayout
,
int
nIndexTheme
)
void
NSPresentationEditor
::
CPPTXWriter
::
WriteLayout
(
CLayout
&
oLayout
,
int
nIndexLayout
,
int
nStartLayout
,
int
nIndexTheme
)
{
{
CStringWriter
oWriter
;
CStringWriter
oWriter
;
CRelsGenerator
oRels
(
&
m_oManager
);
CRelsGenerator
oRels
(
&
m_oManager
);
oRels
.
StartLayout
(
nIndexTheme
);
oRels
.
StartLayout
(
nIndexTheme
);
...
...
ASCOfficeRtfFile/RtfFormatLib/Win32/RtfFormatLib.vcproj
View file @
2e8c83a6
...
@@ -388,10 +388,6 @@
...
@@ -388,10 +388,6 @@
RelativePath=
"..\source\Reader\OOXPictureAnchorReader.h"
RelativePath=
"..\source\Reader\OOXPictureAnchorReader.h"
>
>
</File>
</File>
<File
RelativePath=
"..\source\Reader\OOXPictureGraphicReader.h"
>
</File>
<File
<File
RelativePath=
"..\source\Reader\OOXPictureInlineReader.h"
RelativePath=
"..\source\Reader\OOXPictureInlineReader.h"
>
>
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXColorReader.h
View file @
2e8c83a6
...
@@ -34,56 +34,52 @@
...
@@ -34,56 +34,52 @@
#include "OOXReader.h"
#include "OOXReader.h"
#include "OOXReaderBasic.h"
#include "OOXReaderBasic.h"
#include "../../../../
Common/DocxFormat/Source/DocxFormat/Drawing/DrawingStyles
.h"
#include "../../../../
ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr
.h"
class
OOXColorReader
class
OOXColorReader
{
{
private:
PPTX
::
nsTheme
::
ClrScheme
*
m_ooxColorScheme
;
public:
public:
OOXColorReader
()
OOXColorReader
()
{
{
m_ooxColorScheme
=
NULL
;
}
}
bool
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
CStyleColor
&
ooxColor
,
RtfColor
&
oOutputColor
)
OOXColorReader
(
PPTX
::
nsTheme
::
ClrScheme
*
ooxColorScheme
)
{
{
if
(
ooxColor
.
getType
()
==
OOX
::
Drawing
::
colorHsl
)
m_ooxColorScheme
=
ooxColorScheme
;
{
}
double
dHue
,
dSat
,
dLum
;
bool
Parse
(
ReaderParameter
oParam
,
const
std
::
wstring
&
name
,
RtfColor
&
oOutputColor
)
ooxColor
.
m_oHslClr
.
GetHSL
(
dHue
,
dSat
,
dLum
);
{
oOutputColor
.
SetHSL
(
dHue
,
dSat
,
dLum
);
if
(
!
m_ooxColorScheme
)
return
false
;
return
true
;
}
std
::
map
<
std
::
wstring
,
PPTX
::
Logic
::
UniColor
>::
iterator
pFind
=
m_ooxColorScheme
->
Scheme
.
find
(
name
);
else
if
(
ooxColor
.
getType
()
==
OOX
::
Drawing
::
colorPrst
)
{
if
(
pFind
==
m_ooxColorScheme
->
Scheme
.
end
())
return
false
;
oOutputColor
=
RtfColor
(
ooxColor
.
m_oPrstClr
.
m_oVal
.
Get_R
(),
ooxColor
.
m_oPrstClr
.
m_oVal
.
Get_G
(),
ooxColor
.
m_oPrstClr
.
m_oVal
.
Get_B
());
PPTX
::
Logic
::
UniColor
&
color
=
pFind
->
second
;
return
true
;
}
switch
(
color
.
getType
())
else
if
(
ooxColor
.
getType
()
==
OOX
::
Drawing
::
colorSheme
)
{
RtfColor
::
_ThemeColor
oTheme
;
if
(
true
==
RtfColor
::
GetThemeByOOX
(
ooxColor
.
m_oShemeClr
.
m_oVal
.
GetValue
(),
oTheme
))
return
oParam
.
oRtf
->
m_oColorTable
.
GetColor
(
oTheme
,
oOutputColor
);
return
false
;
}
else
if
(
ooxColor
.
getType
()
==
OOX
::
Drawing
::
colorSRgb
)
{
oOutputColor
=
RtfColor
(
ooxColor
.
m_oSrgbClr
.
m_oVal
.
Get_R
(),
ooxColor
.
m_oSrgbClr
.
m_oVal
.
Get_G
(),
ooxColor
.
m_oSrgbClr
.
m_oVal
.
Get_B
());
return
true
;
}
else
if
(
ooxColor
.
getType
()
==
OOX
::
Drawing
::
colorScRgb
)
{
unsigned
char
r
,
g
,
b
,
a
;
ooxColor
.
m_oScrgbClr
.
GetRGBA
(
r
,
g
,
b
,
a
);
oOutputColor
=
RtfColor
(
r
,
g
,
b
);
return
true
;
}
else
if
(
ooxColor
.
getType
()
==
OOX
::
Drawing
::
colorSys
)
{
{
//if (ooxColor.m_oSysClr.m_oLastClr)
case
OOX
:
:
et_a_schemeClr
:
//{
{
//}
NSCommon
::
smart_ptr
<
PPTX
::
Logic
::
SchemeClr
>
schemeColor
=
color
.
Color
.
smart_dynamic_cast
<
PPTX
::
Logic
::
SchemeClr
>
();
unsigned
char
r
,
g
,
b
,
a
;
if
(
schemeColor
.
IsInit
())
ooxColor
.
m_oSysClr
.
GetRGBA
(
r
,
g
,
b
,
a
);
{
oOutputColor
=
RtfColor
(
r
,
g
,
b
);
RtfColor
::
_ThemeColor
oTheme
;
return
true
;
if
(
true
==
RtfColor
::
GetThemeByOOX
(
(
SimpleTypes
::
EShemeColorVal
)
schemeColor
->
val
.
GetBYTECode
(),
oTheme
))
return
oParam
.
oRtf
->
m_oColorTable
.
GetColor
(
oTheme
,
oOutputColor
);
}
}
break
;
case
OOX
:
:
et_a_prstClr
:
case
OOX
:
:
et_a_scrgbClr
:
case
OOX
:
:
et_a_srgbClr
:
case
OOX
:
:
et_a_sysClr
:
default:
{
DWORD
rgba
=
color
.
GetRGBA
();
oOutputColor
.
SetRGB
(
rgba
>>
8
);
return
true
;
}
break
;
}
}
return
false
;
return
false
;
}
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXColorSchemeReader.h
View file @
2e8c83a6
...
@@ -36,9 +36,9 @@
...
@@ -36,9 +36,9 @@
class
OOXColorSchemeReader
class
OOXColorSchemeReader
{
{
private:
private:
OOX
::
Drawing
::
CColo
rScheme
*
m_ooxColorScheme
;
PPTX
::
nsTheme
::
Cl
rScheme
*
m_ooxColorScheme
;
public:
public:
OOXColorSchemeReader
(
OOX
::
Drawing
::
CColo
rScheme
*
ooxColorScheme
)
OOXColorSchemeReader
(
PPTX
::
nsTheme
::
Cl
rScheme
*
ooxColorScheme
)
{
{
m_ooxColorScheme
=
ooxColorScheme
;
m_ooxColorScheme
=
ooxColorScheme
;
}
}
...
@@ -48,53 +48,53 @@ public:
...
@@ -48,53 +48,53 @@ public:
if
(
m_ooxColorScheme
==
NULL
)
return
false
;
if
(
m_ooxColorScheme
==
NULL
)
return
false
;
RtfColor
oNewColor
;
RtfColor
oNewColor
;
OOXColorReader
oColorReader
;
OOXColorReader
oColorReader
(
m_ooxColorScheme
)
;
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oAccent1
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"accent1"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
caccentone
;
oNewColor
.
m_eTheme
=
RtfColor
::
caccentone
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oAccent2
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"accent2"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
caccenttwo
;
oNewColor
.
m_eTheme
=
RtfColor
::
caccenttwo
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oAccent3
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"accent3"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
caccentthree
;
oNewColor
.
m_eTheme
=
RtfColor
::
caccentthree
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oAccent4
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"accent4"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
caccentfour
;
oNewColor
.
m_eTheme
=
RtfColor
::
caccentfour
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oAccent5
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"accent5"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
caccentfive
;
oNewColor
.
m_eTheme
=
RtfColor
::
caccentfive
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oAccent6
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"accent6"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
caccentsix
;
oNewColor
.
m_eTheme
=
RtfColor
::
caccentsix
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oDk1
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"dk1"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
cmaindarkone
;
oNewColor
.
m_eTheme
=
RtfColor
::
cmaindarkone
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oDk2
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"dk2"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
cmaindarktwo
;
oNewColor
.
m_eTheme
=
RtfColor
::
cmaindarktwo
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oLt1
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"lt1"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
cmainlightone
;
oNewColor
.
m_eTheme
=
RtfColor
::
cmainlightone
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oLt2
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"lt2"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
cmainlighttwo
;
oNewColor
.
m_eTheme
=
RtfColor
::
cmainlighttwo
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oHlink
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"hlink"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
chyperlink
;
oNewColor
.
m_eTheme
=
RtfColor
::
chyperlink
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oColorReader
.
Parse
(
oParam
,
m_ooxColorScheme
->
m_oFolHlink
,
oNewColor
);
oColorReader
.
Parse
(
oParam
,
L"folHlink"
,
oNewColor
);
oNewColor
.
m_eTheme
=
RtfColor
::
cfollowedhyperlink
;
oNewColor
.
m_eTheme
=
RtfColor
::
cfollowedhyperlink
;
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
oParam
.
oRtf
->
m_oColorTable
.
AddItem
(
oNewColor
);
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.cpp
View file @
2e8c83a6
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
*
*
*/
*/
#include "OOXPictureGraphicReader.h"
#include "OOXDrawingGraphicReader.h"
#include "OOXDrawingGraphicReader.h"
#include "OOXShapeReader.h"
#include "OOXShapeReader.h"
...
@@ -41,114 +40,39 @@ int OOXGraphicReader::Parse( ReaderParameter oParam , RtfShapePtr & pOutput)
...
@@ -41,114 +40,39 @@ int OOXGraphicReader::Parse( ReaderParameter oParam , RtfShapePtr & pOutput)
{
{
if
(
m_ooxGraphic
==
NULL
)
return
0
;
if
(
m_ooxGraphic
==
NULL
)
return
0
;
bool
bTryPicture
=
false
;
if
(
m_ooxGraphic
->
element
.
IsInit
())
switch
(
m_ooxGraphic
->
m_eGraphicType
)
{
{
case
OOX
:
:
Drawing
::
graphictypeShape
:
if
(
m_ooxGraphic
->
element
->
getType
()
==
OOX
::
et_p_ShapeTree
)
{
{
for
(
size_t
i
=
0
;
i
<
m_ooxGraphic
->
m_arrItems
.
size
();
i
++
)
OOXShapeReader
shapeReader
(
m_ooxGraphic
->
element
->
GetElem
().
operator
->
());
{
return
(
shapeReader
.
Parse
(
oParam
,
pOutput
)
?
1
:
0
);
if
(
m_ooxGraphic
->
m_arrItems
[
i
]
==
NULL
)
continue
;
}
else
if
(
m_ooxGraphic
->
m_arrItems
[
i
]
->
getType
()
==
OOX
::
et_w_Shape
)
{
OOXShapeReader
shapeReader
(
dynamic_cast
<
OOX
::
Logic
::
CShape
*>
(
m_ooxGraphic
->
m_arrItems
[
i
]));
return
(
shapeReader
.
Parse
(
oParam
,
pOutput
)
?
1
:
0
);
}
}
}
break
;
case
OOX
:
:
Drawing
::
graphictypeGroupShape
:
{
{
for
(
size_t
i
=
0
;
i
<
m_ooxGraphic
->
m_arrItems
.
size
();
i
++
)
OOXShapeGroupReader
groupReader
(
dynamic_cast
<
PPTX
::
Logic
::
SpTree
*>
(
m_ooxGraphic
->
element
->
GetElem
().
operator
->
()));
{
return
(
groupReader
.
Parse
(
oParam
,
pOutput
)
?
1
:
0
);
if
(
m_ooxGraphic
->
m_arrItems
[
i
]
==
NULL
)
continue
;
}
if
(
m_ooxGraphic
->
m_arrItems
[
i
]
->
getType
()
==
OOX
::
et_w_GroupShape
)
{
OOXShapeGroupReader
groupReader
(
dynamic_cast
<
OOX
::
Logic
::
CGroupShape
*>
(
m_ooxGraphic
->
m_arrItems
[
i
]));
return
(
groupReader
.
Parse
(
oParam
,
pOutput
)
?
1
:
0
);
}
}
}
break
;
case
OOX
:
:
Drawing
::
graphictypePicture
:
case
OOX
:
:
Drawing
::
graphictypeLockedCanvas
:
case
OOX
:
:
Drawing
::
graphictypeChart
:
case
OOX
:
:
Drawing
::
graphictypeDiagram
:
{
//find picture or replacement picture
for
(
size_t
i
=
0
;
i
<
m_ooxGraphic
->
m_arrItems
.
size
();
i
++
)
{
if
(
m_ooxGraphic
->
m_arrItems
[
i
]
==
NULL
)
continue
;
if
(
m_ooxGraphic
->
m_arrItems
[
i
]
->
getType
()
==
OOX
::
et_pic_pic
)
{
pOutput
->
m_nShapeType
=
75
;
OOX
::
Drawing
::
CPicture
*
picture
=
dynamic_cast
<
OOX
::
Drawing
::
CPicture
*>
(
m_ooxGraphic
->
m_arrItems
[
i
]);
OOXShapeReader
::
Parse
(
oParam
,
pOutput
,
&
picture
->
m_oBlipFill
);
// тут если false приходит - картинка-потеряшка
return
1
;
}
}
}
break
;
}
}
if
(
m_ooxGraphic
->
olePic
.
IsInit
())
return
2
;
}
//OOX::Logic::CPicture*
OOX
::
Logic
::
CDrawing
*
OOXDrawingGraphicConverter
::
Convert
(
ReaderParameter
oParam
,
RtfShapePtr
pOutput
)
{
NSBinPptxRW
::
CDrawingConverter
drawingConverter
;
OOX
::
CTheme
*
pTheme
=
oParam
.
oDocx
->
GetTheme
();
if
(
pTheme
)
{
{
NSCommon
::
smart_ptr
<
PPTX
::
Theme
>
theme
(
new
PPTX
::
Theme
());
pOutput
->
m_nShapeType
=
75
;
PPTX
::
FileMap
map
;
theme
->
read
(
pTheme
->
m_oReadPath
,
map
);
(
*
drawingConverter
.
m_pTheme
)
=
theme
.
smart_dynamic_cast
<
PPTX
::
WrapperFile
>
();
}
drawingConverter
.
SetRelsPath
(
oParam
.
oDocx
->
m_pDocument
->
m_oReadPath
.
GetPath
());
std
::
wstring
sXml
;
sXml
=
drawingConverter
.
ObjectToDrawingML
(
m_sXml
,
XMLWRITER_DOC_TYPE_DOCX
);
// sXml = drawingConverter.ObjectToVML(m_sXml);
if
(
sXml
.
empty
())
return
NULL
;
OOX
::
CPath
pathDrawingRels
(
drawingConverter
.
m_strCurrentRelsPath
);
if
(
m_ooxGraphicRels
)
OOXShapeReader
::
Parse
(
oParam
,
pOutput
,
&
m_ooxGraphic
->
olePic
->
blipFill
);
// тут если false приходит - картинка-потеряшка
{
return
1
;
m_ooxGraphicRels
->
Read
(
pathDrawingRels
,
pathDrawingRels
);
}
}
if
(
m_ooxGraphic
->
smartArt
.
IsInit
())
std
::
wstring
sBegin
(
L"<main 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
\"
>"
);
std
::
wstring
sEnd
(
L"</main>"
);
std
::
wstring
strXml
=
sBegin
+
sXml
+
sEnd
;
XmlUtils
::
CXmlLiteReader
oSubReader
;
if
(
oSubReader
.
FromString
(
strXml
)
==
false
)
return
NULL
;
oSubReader
.
ReadNextNode
();
int
nStylesDepth1
=
oSubReader
.
GetDepth
();
while
(
oSubReader
.
ReadNextSiblingNode
(
nStylesDepth1
)
)
{
{
std
::
wstring
sName
=
oSubReader
.
GetName
();
m_ooxGraphic
->
smartArt
->
LoadDrawing
();
//if (sName == L"w:pict")
if
(
m_ooxGraphic
->
smartArt
->
m_diag
.
IsInit
())
//{
// return new OOX::Logic::CPicture(oSubReader);
//}
if
(
sName
==
L"w:drawing"
)
{
{
return
new
OOX
::
Logic
::
CDrawing
(
oSubReader
);
OOXShapeGroupReader
groupReader
(
dynamic_cast
<
PPTX
::
Logic
::
SpTree
*>
(
m_ooxGraphic
->
smartArt
->
m_diag
.
GetPointer
()));
return
(
groupReader
.
Parse
(
oParam
,
pOutput
)
?
1
:
0
);
}
}
}
}
//nullable_string spid;
return
NULL
;
//nullable<Table> table;
//return pPict;
//nullable<ChartRec> chartRec;
return
0
;
}
}
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDrawingGraphicReader.h
View file @
2e8c83a6
...
@@ -40,25 +40,16 @@
...
@@ -40,25 +40,16 @@
#define PICTURE_BUFFER_SIZE 1024
#define PICTURE_BUFFER_SIZE 1024
class
OOX
DrawingGraphicConvert
er
class
OOX
GraphicRead
er
{
{
private:
private:
std
::
wstring
m_sXml
;
PPTX
::
Logic
::
GraphicFrame
*
m_ooxGraphic
;
public:
public:
OOX
::
IFileContainer
*
m_ooxGraphicRels
;
OOXDrawingGraphicConverter
(
std
::
wstring
sXml
)
OOXGraphicReader
(
PPTX
::
Logic
::
GraphicFrame
*
ooxGraphic
)
{
m_sXml
=
sXml
;
m_ooxGraphicRels
=
new
OOX
::
IFileContainer
();
}
virtual
~
OOXDrawingGraphicConverter
()
{
{
if
(
m_ooxGraphicRels
)
m_ooxGraphic
=
ooxGraphic
;
delete
m_ooxGraphicRels
;
m_ooxGraphicRels
=
NULL
;
}
}
//OOX::Logic::CPicture* Parse( ReaderParameter oParam , RtfShapePtr pOutput);
OOX
::
Logic
::
CDrawing
*
Convert
(
ReaderParameter
oParam
,
RtfShapePtr
pOutput
);
int
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
);
};
};
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXFontReader.h
View file @
2e8c83a6
...
@@ -175,12 +175,12 @@ private:
...
@@ -175,12 +175,12 @@ private:
class
OOXFontReader3
class
OOXFontReader3
{
{
private:
private:
OOX
::
Drawing
::
C
TextFont
*
m_asciiFont
;
PPTX
::
Logic
::
TextFont
*
m_asciiFont
;
OOX
::
Drawing
::
C
TextFont
*
m_csFont
;
PPTX
::
Logic
::
TextFont
*
m_csFont
;
OOX
::
Drawing
::
C
TextFont
*
m_asianFont
;
PPTX
::
Logic
::
TextFont
*
m_asianFont
;
public:
public:
OOXFontReader3
(
OOX
::
Drawing
::
CTextFont
*
asciiFont
,
OOX
::
Drawing
::
CTextFont
*
asianFont
,
OOX
::
Drawing
::
C
TextFont
*
csFont
)
OOXFontReader3
(
PPTX
::
Logic
::
TextFont
*
asciiFont
,
PPTX
::
Logic
::
TextFont
*
asianFont
,
PPTX
::
Logic
::
TextFont
*
csFont
)
{
{
m_asciiFont
=
asciiFont
;
m_asciiFont
=
asciiFont
;
m_asianFont
=
asianFont
;
m_asianFont
=
asianFont
;
...
@@ -192,9 +192,9 @@ public:
...
@@ -192,9 +192,9 @@ public:
std
::
wstring
sAscii
,
sCs
,
sEastAsia
;
std
::
wstring
sAscii
,
sCs
,
sEastAsia
;
if
(
(
m_asciiFont
)
&&
(
m_asciiFont
->
m_oTypeFace
.
IsInit
()))
sAscii
=
m_asciiFont
->
m_oTypeFace
->
GetValue
()
;
if
(
m_asciiFont
)
sAscii
=
m_asciiFont
->
typeface
;
if
(
(
m_csFont
)
&&
(
m_csFont
->
m_oTypeFace
.
IsInit
()))
sCs
=
m_csFont
->
m_oTypeFace
->
GetValue
()
;
if
(
m_csFont
)
sCs
=
m_csFont
->
typeface
;
if
(
(
m_asianFont
)
&&
(
m_asianFont
->
m_oTypeFace
.
IsInit
()))
sEastAsia
=
m_asianFont
->
m_oTypeFace
->
GetValue
()
;
if
(
m_asianFont
)
sEastAsia
=
m_asianFont
->
typeface
;
std
::
wstring
sFont
;
std
::
wstring
sFont
;
std
::
wstring
sTempFont
;
std
::
wstring
sTempFont
;
...
@@ -215,27 +215,28 @@ public:
...
@@ -215,27 +215,28 @@ public:
oCurFont
.
m_nID
=
nFont
;
oCurFont
.
m_nID
=
nFont
;
oCurFont
.
m_sName
=
sFont
;
oCurFont
.
m_sName
=
sFont
;
if
(
!
sAscii
.
empty
()
)
//if( !sAscii.empty() )
{
//{
if
(
m_asciiFont
->
m_oPanose
.
IsInit
())
// if (m_asciiFont->m_oPanose.IsInit())
oCurFont
.
m_sPanose
=
m_asciiFont
->
m_oPanose
->
GetValue
();
// oCurFont.m_sPanose = m_asciiFont->m_oPanose->GetValue();
oCurFont
.
m_nCharset
=
m_asciiFont
->
m_oCharset
.
GetValue
();
// if (m_asciiFont->charset.IsInit())
oCurFont
.
m_nPitch
=
m_asciiFont
->
m_oPitchFamily
.
GetValue
();
// oCurFont.m_nCharset = m_asciiFont->charset.get();
}
// oCurFont.m_nPitch = m_asciiFont->m_oPitchFamily.GetValue();
else
if
(
!
sCs
.
empty
()
)
//}
{
//else if( !sCs.empty() )
if
(
m_csFont
->
m_oPanose
.
IsInit
())
//{
oCurFont
.
m_sPanose
=
m_csFont
->
m_oPanose
->
GetValue
();
// if (m_csFont->m_oPanose.IsInit())
oCurFont
.
m_nCharset
=
m_csFont
->
m_oCharset
.
GetValue
();
// oCurFont.m_sPanose = m_csFont->m_oPanose->GetValue();
oCurFont
.
m_nPitch
=
m_csFont
->
m_oPitchFamily
.
GetValue
();
// oCurFont.m_nCharset = m_csFont->m_oCharset.GetValue();
}
// oCurFont.m_nPitch = m_csFont->m_oPitchFamily.GetValue();
else
if
(
!
sEastAsia
.
empty
()
)
//}
{
//else if( !sEastAsia.empty() )
if
(
m_asianFont
->
m_oPanose
.
IsInit
())
//{
oCurFont
.
m_sPanose
=
m_asianFont
->
m_oPanose
->
GetValue
();
// if (m_asianFont->m_oPanose.IsInit())
oCurFont
.
m_nCharset
=
m_asianFont
->
m_oCharset
.
GetValue
();
// oCurFont.m_sPanose = m_asianFont->m_oPanose->GetValue();
oCurFont
.
m_nPitch
=
m_asianFont
->
m_oPitchFamily
.
GetValue
();
// oCurFont.m_nCharset = m_asianFont->m_oCharset.GetValue();
}
// oCurFont.m_nPitch = m_asianFont->m_oPitchFamily.GetValue();
//}
oParam
.
oRtf
->
m_oFontTable
.
AddItem
(
oCurFont
);
oParam
.
oRtf
->
m_oFontTable
.
AddItem
(
oCurFont
);
}
}
}
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXFontSchemeReader.h
View file @
2e8c83a6
...
@@ -37,9 +37,9 @@
...
@@ -37,9 +37,9 @@
class
OOXFontSchemeReader
class
OOXFontSchemeReader
{
{
private:
private:
OOX
::
Drawing
::
C
FontScheme
*
m_ooxFontScheme
;
PPTX
::
nsTheme
::
FontScheme
*
m_ooxFontScheme
;
public:
public:
OOXFontSchemeReader
(
OOX
::
Drawing
::
C
FontScheme
*
ooxFontScheme
)
OOXFontSchemeReader
(
PPTX
::
nsTheme
::
FontScheme
*
ooxFontScheme
)
{
{
m_ooxFontScheme
=
ooxFontScheme
;
m_ooxFontScheme
=
ooxFontScheme
;
}
}
...
@@ -47,36 +47,17 @@ public:
...
@@ -47,36 +47,17 @@ public:
{
{
if
(
m_ooxFontScheme
==
NULL
)
return
false
;
if
(
m_ooxFontScheme
==
NULL
)
return
false
;
if
(
m_ooxFontScheme
->
m_oMajorFont
.
m_oLatin
.
m_oTypeFace
.
IsInit
())
oParam
.
oReader
->
m_smajorAscii
=
m_ooxFontScheme
->
majorFont
.
latin
.
typeface
;
{
oParam
.
oReader
->
m_smajorHAnsi
=
m_ooxFontScheme
->
majorFont
.
latin
.
typeface
;
oParam
.
oReader
->
m_smajorAscii
=
m_ooxFontScheme
->
m_oMajorFont
.
m_oLatin
.
m_oTypeFace
->
GetValue
();
oParam
.
oReader
->
m_smajorHAnsi
=
m_ooxFontScheme
->
m_oMajorFont
.
m_oLatin
.
m_oTypeFace
->
GetValue
();
oParam
.
oReader
->
m_smajorEastAsia
=
m_ooxFontScheme
->
majorFont
.
ea
.
typeface
;
}
oParam
.
oReader
->
m_smajorBidi
=
m_ooxFontScheme
->
majorFont
.
cs
.
typeface
;
if
(
m_ooxFontScheme
->
m_oMajorFont
.
m_oEa
.
m_oTypeFace
.
IsInit
())
{
oParam
.
oReader
->
m_sminorAscii
=
m_ooxFontScheme
->
minorFont
.
latin
.
typeface
;
oParam
.
oReader
->
m_smajorEastAsia
=
m_ooxFontScheme
->
m_oMajorFont
.
m_oEa
.
m_oTypeFace
->
GetValue
();
oParam
.
oReader
->
m_sminorHAnsi
=
m_ooxFontScheme
->
minorFont
.
latin
.
typeface
;
}
if
(
m_ooxFontScheme
->
m_oMajorFont
.
m_oCs
.
m_oTypeFace
.
IsInit
())
{
oParam
.
oReader
->
m_smajorBidi
=
m_ooxFontScheme
->
m_oMajorFont
.
m_oCs
.
m_oTypeFace
->
GetValue
();
}
//for (long i=0 ; i < m_ooxFontScheme->m_oMajorFont.m_arrFont.size(); i++)
//{
//}
if
(
m_ooxFontScheme
->
m_oMinorFont
.
m_oLatin
.
m_oTypeFace
.
IsInit
())
oParam
.
oReader
->
m_sminorEastAsia
=
m_ooxFontScheme
->
minorFont
.
ea
.
typeface
;
{
oParam
.
oReader
->
m_sminorBidi
=
m_ooxFontScheme
->
minorFont
.
cs
.
typeface
;
oParam
.
oReader
->
m_sminorAscii
=
m_ooxFontScheme
->
m_oMinorFont
.
m_oLatin
.
m_oTypeFace
->
GetValue
();
oParam
.
oReader
->
m_sminorHAnsi
=
m_ooxFontScheme
->
m_oMinorFont
.
m_oLatin
.
m_oTypeFace
->
GetValue
();
}
if
(
m_ooxFontScheme
->
m_oMinorFont
.
m_oEa
.
m_oTypeFace
.
IsInit
())
{
oParam
.
oReader
->
m_sminorEastAsia
=
m_ooxFontScheme
->
m_oMinorFont
.
m_oEa
.
m_oTypeFace
->
GetValue
();
}
if
(
m_ooxFontScheme
->
m_oMinorFont
.
m_oCs
.
m_oTypeFace
.
IsInit
())
{
oParam
.
oReader
->
m_sminorBidi
=
m_ooxFontScheme
->
m_oMinorFont
.
m_oCs
.
m_oTypeFace
->
GetValue
();
}
//for (long i=0 ; i < m_ooxFontScheme->m_oMinorFont.m_arrFont.size(); i++)
//for (long i=0 ; i < m_ooxFontScheme->m_oMinorFont.m_arrFont.size(); i++)
//{
//{
//}
//}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp
View file @
2e8c83a6
...
@@ -42,15 +42,19 @@ bool OOXParagraphReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputPa
...
@@ -42,15 +42,19 @@ bool OOXParagraphReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputPa
{
{
if
(
m_drawingParagraph
)
if
(
m_drawingParagraph
)
{
{
if
(
m_drawingParagraph
->
m_oParagraphProperty
.
IsInit
())
if
(
m_drawingParagraph
->
pPr
.
IsInit
())
{
{
OOXpPrReader
opPrReader
(
m_drawingParagraph
->
m_oParagraphProperty
.
GetPointer
());
OOXpPrReader
opPrReader
(
m_drawingParagraph
->
pPr
.
GetPointer
());
opPrReader
.
Parse
(
oParam
,
oOutputParagraph
.
m_oProperty
,
oConditionalTableStyle
);
opPrReader
.
Parse
(
oParam
,
oOutputParagraph
.
m_oProperty
,
oConditionalTableStyle
);
}
}
m_ooxElement
=
dynamic_cast
<
OOX
::
WritingElementWithChilds
<
OOX
::
WritingElement
>*>
(
m_drawingParagraph
);
RtfStylePtr
poStyle
;
for
(
size_t
i
=
0
;
i
<
m_drawingParagraph
->
RunElems
.
size
();
++
i
)
bool
res
=
Parse2
(
oParam
,
oOutputParagraph
,
oConditionalTableStyle
,
RtfStylePtr
()
);
{
NSCommon
::
smart_ptr
<
PPTX
::
Logic
::
RunBase
>
run
=
m_drawingParagraph
->
RunElems
[
i
].
GetElem
();
Parse3
(
oParam
,
oOutputParagraph
,
oConditionalTableStyle
,
poStyle
,
dynamic_cast
<
OOX
::
WritingElement
*>
(
run
.
operator
->
()));
}
return
true
;
return
true
;
}
}
...
@@ -116,342 +120,346 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
...
@@ -116,342 +120,346 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
{
{
if
(
m_ooxElement
==
NULL
)
return
false
;
if
(
m_ooxElement
==
NULL
)
return
false
;
RtfStylePtr
poExternalStyle
;
for
(
size_t
i
=
0
;
i
<
m_ooxElement
->
m_arrItems
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
m_ooxElement
->
m_arrItems
.
size
();
i
++
)
{
{
if
(
m_ooxElement
->
m_arrItems
[
i
]
==
NULL
)
continue
;
Parse3
(
oParam
,
oOutputParagraph
,
oConditionalTableStyle
,
poStyle
,
m_ooxElement
->
m_arrItems
[
i
]);
}
return
true
;
}
bool
OOXParagraphReader
::
Parse3
(
ReaderParameter
oParam
,
RtfParagraph
&
oOutputParagraph
,
CcnfStyle
oConditionalTableStyle
,
RtfStylePtr
poStyle
,
OOX
::
WritingElement
*
m_ooxElement
)
{
if
(
m_ooxElement
==
NULL
)
return
false
;
switch
(
m_ooxElement
->
m_arrItems
[
i
]
->
getType
())
RtfStylePtr
poExternalStyle
;
switch
(
m_ooxElement
->
getType
())
{
case
OOX
:
:
et_w_tbl
:
{
{
case
OOX
:
:
et_w_tbl
:
oParam
.
oReader
->
m_nCurItap
++
;
{
RtfTablePtr
oNewTable
(
new
RtfTable
()
);
oParam
.
oReader
->
m_nCurItap
++
;
OOX
::
Logic
::
CTbl
*
pTbl
=
dynamic_cast
<
OOX
::
Logic
::
CTbl
*>
(
m_ooxElement
);
RtfTablePtr
oNewTable
(
new
RtfTable
()
);
OOX
::
Logic
::
CTbl
*
pTbl
=
dynamic_cast
<
OOX
::
Logic
::
CTbl
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
OOXTableReader
oTableReader
(
pTbl
);
//oNewTable->m_oCharProperty = oOutputParagraph.m_oProperty.m_oCharProperty;
//Merge(oOutputParagraph.m_oProperty.m_oCharProperty)
oTableReader
.
Parse
(
oParam
,
*
oNewTable
);
oOutputParagraph
.
AddItem
(
oNewTable
);
oParam
.
oReader
->
m_nCurItap
--
;
}
break
;
case
OOX
:
:
et_w_ins
:
{
OOX
::
Logic
::
CIns
*
pIns
=
dynamic_cast
<
OOX
::
Logic
::
CIns
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
OOXParagraphReader
oSubParReader
(
pIns
);
OOXTableReader
oTableReader
(
pTbl
);
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
//oNewTable->m_oCharProperty = oOutputParagraph.m_oProperty.m_oCharProperty;
oSubParReader
.
m_oCharProperty
.
m_nRevised
=
1
;
//Merge(oOutputParagraph.m_oProperty.m_oCharProperty)
if
(
pIns
->
m_sAuthor
.
IsInit
())
oSubParReader
.
m_oCharProperty
.
m_nRevauth
=
oParam
.
oRtf
->
m_oRevisionTable
.
AddAuthor
(
pIns
->
m_sAuthor
.
get2
()
)
+
1
;
if
(
pIns
->
m_oDate
.
IsInit
())
{
std
::
wstring
sVal
=
pIns
->
m_oDate
->
GetValue
();
oSubParReader
.
m_oCharProperty
.
m_nRevdttm
=
RtfUtility
::
convertDateTime
(
sVal
);
}
oSubParReader
.
Parse2
(
oParam
,
oOutputParagraph
,
oConditionalTableStyle
,
poStyle
);
oTableReader
.
Parse
(
oParam
,
*
oNewTable
);
}
break
;
oOutputParagraph
.
AddItem
(
oNewTable
);
case
OOX
:
:
et_w_del
:
oParam
.
oReader
->
m_nCurItap
--
;
{
}
break
;
OOX
::
Logic
::
CDel
*
pDel
=
dynamic_cast
<
OOX
::
Logic
::
CDel
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
case
OOX
:
:
et_w_ins
:
{
OOX
::
Logic
::
CIns
*
pIns
=
dynamic_cast
<
OOX
::
Logic
::
CIns
*>
(
m_ooxElement
);
OOXParagraphReader
oSubParReader
(
pDel
);
OOXParagraphReader
oSubParReader
(
pIns
);
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oSubParReader
.
m_oCharProperty
.
m_nDeleted
=
1
;
oSubParReader
.
m_oCharProperty
.
m_nRevised
=
1
;
if
(
pIns
->
m_sAuthor
.
IsInit
())
oSubParReader
.
m_oCharProperty
.
m_nRevauth
=
oParam
.
oRtf
->
m_oRevisionTable
.
AddAuthor
(
pIns
->
m_sAuthor
.
get2
()
)
+
1
;
if
(
pIns
->
m_oDate
.
IsInit
())
{
std
::
wstring
sVal
=
pIns
->
m_oDate
->
GetValue
();
oSubParReader
.
m_oCharProperty
.
m_nRevdttm
=
RtfUtility
::
convertDateTime
(
sVal
);
}
if
(
pDel
->
m_sAuthor
.
IsInit
())
oSubParReader
.
Parse2
(
oParam
,
oOutputParagraph
,
oConditionalTableStyle
,
poStyle
);
oSubParReader
.
m_oCharProperty
.
m_nRevauthDel
=
oParam
.
oRtf
->
m_oRevisionTable
.
AddAuthor
(
pDel
->
m_sAuthor
.
get2
()
)
+
1
;
}
break
;
case
OOX
:
:
et_w_del
:
if
(
pDel
->
m_oDate
.
IsInit
())
{
{
OOX
::
Logic
::
CDel
*
pDel
=
dynamic_cast
<
OOX
::
Logic
::
CDel
*>
(
m_ooxElement
);
std
::
wstring
sVal
=
pDel
->
m_oDate
->
GetValue
();
oSubParReader
.
m_oCharProperty
.
m_nRevdttmDel
=
RtfUtility
::
convertDateTime
(
sVal
);
OOXParagraphReader
oSubParReader
(
pDel
);
}
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oSubParReader
.
m_oCharProperty
.
m_nDeleted
=
1
;
oSubParReader
.
Parse2
(
oParam
,
oOutputParagraph
,
oConditionalTableStyle
,
poStyle
);
}
break
;
if
(
pDel
->
m_sAuthor
.
IsInit
())
case
OOX
:
:
et_a_r
:
oSubParReader
.
m_oCharProperty
.
m_nRevauthDel
=
oParam
.
oRtf
->
m_oRevisionTable
.
AddAuthor
(
pDel
->
m_sAuthor
.
get2
()
)
+
1
;
{
OOX
::
Drawing
::
CRun
*
pRun
=
dynamic_cast
<
OOX
::
Drawing
::
CRun
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
if
(
pDel
->
m_oDate
.
IsInit
())
{
OOXRunReader
oRunReader
(
pRun
);
std
::
wstring
sVal
=
pDel
->
m_oDate
->
GetValue
();
oRunReader
.
Parse
(
oParam
,
oOutputParagraph
,
poExternalStyle
);
oSubParReader
.
m_oCharProperty
.
m_nRevdttmDel
=
RtfUtility
::
convertDateTime
(
sVal
);
}
break
;
}
case
OOX
:
:
et_w_r
:
{
oSubParReader
.
Parse2
(
oParam
,
oOutputParagraph
,
oConditionalTableStyle
,
poStyle
);
OOX
::
Logic
::
CRun
*
pRun
=
dynamic_cast
<
OOX
::
Logic
::
CRun
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
}
break
;
case
OOX
:
:
et_a_r
:
OOXRunReader
oRunReader
(
pRun
);
{
oRunReader
.
m_oCharProperty
=
m_oCharProperty
;
PPTX
::
Logic
::
Run
*
pRun
=
dynamic_cast
<
PPTX
::
Logic
::
Run
*>
(
m_ooxElement
);
oRunReader
.
Parse
(
oParam
,
oOutputParagraph
,
poExternalStyle
);
OOXRunReader
oRunReader
(
pRun
);
}
break
;
oRunReader
.
Parse
(
oParam
,
oOutputParagraph
,
poExternalStyle
);
case
OOX
:
:
et_w_fldSimple
:
}
break
;
case
OOX
:
:
et_w_r
:
{
OOX
::
Logic
::
CRun
*
pRun
=
dynamic_cast
<
OOX
::
Logic
::
CRun
*>
(
m_ooxElement
);
OOXRunReader
oRunReader
(
pRun
);
oRunReader
.
m_oCharProperty
=
m_oCharProperty
;
oRunReader
.
Parse
(
oParam
,
oOutputParagraph
,
poExternalStyle
);
}
break
;
case
OOX
:
:
et_w_fldSimple
:
{
OOX
::
Logic
::
CFldSimple
*
pFldSimple
=
dynamic_cast
<
OOX
::
Logic
::
CFldSimple
*>
(
m_ooxElement
);
RtfFieldPtr
oCurField
(
new
RtfField
()
);
oCurField
->
m_pInsert
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
oCurField
->
m_pResult
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
//добавляем insert
RtfCharPtr
pNewChar
(
new
RtfChar
()
);
pNewChar
->
m_bRtfEncode
=
false
;
if
(
pFldSimple
->
m_sInstr
.
IsInit
())
{
{
OOX
::
Logic
::
CFldSimple
*
pFldSimple
=
dynamic_cast
<
OOX
::
Logic
::
CFldSimple
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
pNewChar
->
setText
(
pFldSimple
->
m_sInstr
.
get2
()
);
}
RtfParagraphPtr
oNewInsertParagraph
(
new
RtfParagraph
()
);
oNewInsertParagraph
->
AddItem
(
pNewChar
);
oCurField
->
m_pInsert
->
m_pTextItems
->
AddItem
(
oNewInsertParagraph
);
RtfFieldPtr
oCurField
(
new
RtfField
()
);
//добаляем свойства
if
(
TRUE
==
pFldSimple
->
m_oFldLock
.
ToBool
()
)
oCurField
->
m_pInsert
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
oCurField
->
m_eMode
=
RtfField
::
fm_fldlock
;
oCurField
->
m_pResult
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
//добавляем insert
RtfCharPtr
pNewChar
(
new
RtfChar
()
);
pNewChar
->
m_bRtfEncode
=
false
;
if
(
pFldSimple
->
m_sInstr
.
IsInit
())
{
pNewChar
->
setText
(
pFldSimple
->
m_sInstr
.
get2
()
);
}
RtfParagraphPtr
oNewInsertParagraph
(
new
RtfParagraph
()
);
oNewInsertParagraph
->
AddItem
(
pNewChar
);
oCurField
->
m_pInsert
->
m_pTextItems
->
AddItem
(
oNewInsertParagraph
);
//добаляем свойства
if
(
TRUE
==
pFldSimple
->
m_oFldLock
.
ToBool
()
)
oCurField
->
m_eMode
=
RtfField
::
fm_fldlock
;
if
(
TRUE
==
pFldSimple
->
m_oDirty
.
ToBool
()
)
if
(
TRUE
==
pFldSimple
->
m_oDirty
.
ToBool
()
)
oCurField
->
m_eMode
=
RtfField
::
fm_flddirty
;
oCurField
->
m_eMode
=
RtfField
::
fm_flddirty
;
RtfParagraphPtr
oNewResultParagraph
(
new
RtfParagraph
()
);
RtfParagraphPtr
oNewResultParagraph
(
new
RtfParagraph
()
);
//применяем к новому параграфу default property
//применяем к новому параграфу default property
oNewResultParagraph
->
m_oProperty
=
oParam
.
oRtf
->
m_oDefaultParagraphProp
;
oNewResultParagraph
->
m_oProperty
=
oParam
.
oRtf
->
m_oDefaultParagraphProp
;
oNewResultParagraph
->
m_oProperty
.
m_oCharProperty
=
oParam
.
oRtf
->
m_oDefaultCharProp
;
oNewResultParagraph
->
m_oProperty
.
m_oCharProperty
=
oParam
.
oRtf
->
m_oDefaultCharProp
;
//применяем к новому параграфу свойства данного параграфа
//применяем к новому параграфу свойства данного параграфа
oNewResultParagraph
->
m_oProperty
=
oOutputParagraph
.
m_oProperty
;
oNewResultParagraph
->
m_oProperty
=
oOutputParagraph
.
m_oProperty
;
if
(
pFldSimple
->
m_arrItems
.
size
()
>
0
)
if
(
pFldSimple
->
m_arrItems
.
size
()
>
0
)
{
OOXParagraphReader
oSubParReader
(
pFldSimple
);
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oSubParReader
.
Parse2
(
oParam
,
*
oNewResultParagraph
,
CcnfStyle
(),
poExternalStyle
);
oCurField
->
m_pResult
->
m_pTextItems
->
AddItem
(
oNewResultParagraph
);
}
oOutputParagraph
.
AddItem
(
oCurField
);
}
break
;
case
OOX
:
:
et_w_hyperlink
:
{
{
OOX
::
Logic
::
CHyperlink
*
pHyperlink
=
dynamic_cast
<
OOX
::
Logic
::
CHyperlink
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
OOXParagraphReader
oSubParReader
(
pFldSimple
);
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oSubParReader
.
Parse2
(
oParam
,
*
oNewResultParagraph
,
CcnfStyle
(),
poExternalStyle
);
oCurField
->
m_pResult
->
m_pTextItems
->
AddItem
(
oNewResultParagraph
);
}
oOutputParagraph
.
AddItem
(
oCurField
);
}
break
;
case
OOX
:
:
et_w_hyperlink
:
{
OOX
::
Logic
::
CHyperlink
*
pHyperlink
=
dynamic_cast
<
OOX
::
Logic
::
CHyperlink
*>
(
m_ooxElement
);
if
(
pHyperlink
->
m_oId
.
IsInit
()
)
if
(
pHyperlink
->
m_oId
.
IsInit
()
)
{
{
std
::
wstring
sTarget
;
std
::
wstring
sTarget
;
if
(
oParam
.
oReader
->
m_currentContainer
)
if
(
oParam
.
oReader
->
m_currentContainer
)
{
{
smart_ptr
<
OOX
::
File
>
oFile
=
oParam
.
oReader
->
m_currentContainer
->
Find
(
pHyperlink
->
m_oId
->
GetValue
());
smart_ptr
<
OOX
::
File
>
oFile
=
oParam
.
oReader
->
m_currentContainer
->
Find
(
pHyperlink
->
m_oId
->
GetValue
());
if
((
oFile
.
IsInit
())
&&
(
OOX
::
FileTypes
::
HyperLink
==
oFile
->
type
()))
if
((
oFile
.
IsInit
())
&&
(
OOX
::
FileTypes
::
HyperLink
==
oFile
->
type
()))
{
OOX
::
HyperLink
*
pH
=
(
OOX
::
HyperLink
*
)
oFile
.
operator
->
();
sTarget
=
pH
->
Uri
().
GetPath
();
}
}
if
(
!
sTarget
.
empty
()
)
{
{
//заменяем пробелы на %20
OOX
::
HyperLink
*
pH
=
(
OOX
::
HyperLink
*
)
oFile
.
operator
->
();
XmlUtils
::
replace_all
(
sTarget
,
L" "
,
L"%20"
);
sTarget
=
pH
->
Uri
().
GetPath
();
}
}
if
(
!
sTarget
.
empty
()
)
{
//заменяем пробелы на %20
XmlUtils
::
replace_all
(
sTarget
,
L" "
,
L"%20"
);
std
::
wstring
sFileUrl
=
L"file:///"
;
std
::
wstring
sFileUrl
=
L"file:///"
;
if
(
0
==
sTarget
.
find
(
sFileUrl
)
)
if
(
0
==
sTarget
.
find
(
sFileUrl
)
)
{
{
int
nFirstDDot
=
sTarget
.
find
(
':'
,
sFileUrl
.
length
()
);
int
nFirstDDot
=
sTarget
.
find
(
':'
,
sFileUrl
.
length
()
);
int
nLen
=
sTarget
.
length
();
int
nLen
=
sTarget
.
length
();
if
(
-
1
!=
nFirstDDot
&&
nFirstDDot
+
2
<
nLen
&&
'\\'
==
sTarget
[
nFirstDDot
+
1
]
)
if
(
-
1
!=
nFirstDDot
&&
nFirstDDot
+
2
<
nLen
&&
'\\'
==
sTarget
[
nFirstDDot
+
1
]
)
{
if
(
'\\'
!=
sTarget
[
nFirstDDot
+
2
]
)
sTarget
.
insert
(
sTarget
.
begin
()
+
nFirstDDot
+
1
,
'\\'
);
}
}
RtfFieldPtr
oCurField
(
new
RtfField
()
);
oCurField
->
m_pInsert
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
oCurField
->
m_pResult
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
//добавляем insert
RtfCharPtr
pNewChar
(
new
RtfChar
()
);
pNewChar
->
m_bRtfEncode
=
true
;
// false;
std
::
wstring
sFieldText
;
sFieldText
+=
L"HYPERLINK
\"
"
+
sTarget
+
L"
\"
"
;
pNewChar
->
setText
(
sFieldText
);
RtfParagraphPtr
oNewInsertParagraph
(
new
RtfParagraph
()
);
oNewInsertParagraph
->
AddItem
(
pNewChar
);
oCurField
->
m_pInsert
->
m_pTextItems
->
AddItem
(
oNewInsertParagraph
);
//добавляем свойства
//pHyperlink->m_arrItems todoooo
//BOOL bLock = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:fldLock", L"false)));
//if( TRUE == bLock )
// oCurField->m_eMode = RtfField::fm_fldlock;
//BOOL bDirty = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:dirty", L"false"));
//if( TRUE == bDirty )
// oCurField->m_eMode = RtfField::fm_flddirty;
RtfParagraphPtr
oNewResultParagraph
(
new
RtfParagraph
()
);
//применяем к новому параграфу default property
oNewResultParagraph
->
m_oProperty
=
oParam
.
oRtf
->
m_oDefaultParagraphProp
;
oNewResultParagraph
->
m_oProperty
.
m_oCharProperty
=
oParam
.
oRtf
->
m_oDefaultCharProp
;
//применяем к новому параграфу свойства данного параграфа
oNewResultParagraph
->
m_oProperty
=
oOutputParagraph
.
m_oProperty
;
if
(
pHyperlink
->
m_arrItems
.
size
()
>
0
)
{
{
OOXParagraphReader
oSubParReader
(
pHyperlink
);
if
(
'\\'
!=
sTarget
[
nFirstDDot
+
2
]
)
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
sTarget
.
insert
(
sTarget
.
begin
()
+
nFirstDDot
+
1
,
'\\'
);
oSubParReader
.
Parse2
(
oParam
,
*
oNewResultParagraph
,
CcnfStyle
(),
poExternalStyle
);
oCurField
->
m_pResult
->
m_pTextItems
->
AddItem
(
oNewResultParagraph
);
}
}
oOutputParagraph
.
AddItem
(
oCurField
);
}
}
}
if
(
pHyperlink
->
m_sAnchor
.
IsInit
()
)
{
RtfFieldPtr
oCurField
(
new
RtfField
()
);
RtfFieldPtr
oCurField
(
new
RtfField
()
);
oCurField
->
m_pInsert
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
oCurField
->
m_pInsert
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
oCurField
->
m_pResult
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
oCurField
->
m_pResult
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
//добавляем insert
//добавляем insert
RtfCharPtr
pNewCharHYPER
(
new
RtfChar
()
);
RtfCharPtr
pNewChar
(
new
RtfChar
()
);
pNewCharHYPER
->
m_bRtfEncode
=
false
;
pNewChar
->
m_bRtfEncode
=
true
;
// false;
pNewCharHYPER
->
setText
(
L"HYPERLINK
\\
l
\"
"
+
pHyperlink
->
m_sAnchor
.
get
()
+
L"
\"
"
);
std
::
wstring
sFieldText
;
sFieldText
+=
L"HYPERLINK
\"
"
+
sTarget
+
L"
\"
"
;
RtfParagraphPtr
oNewInsertParagraph
(
new
RtfParagraph
()
);
pNewChar
->
setText
(
sFieldText
);
oNewInsertParagraph
->
AddItem
(
pNewCharHYPER
);
RtfParagraphPtr
oNewInsertParagraph
(
new
RtfParagraph
()
);
oNewInsertParagraph
->
AddItem
(
pNewChar
);
oCurField
->
m_pInsert
->
m_pTextItems
->
AddItem
(
oNewInsertParagraph
);
oCurField
->
m_pInsert
->
m_pTextItems
->
AddItem
(
oNewInsertParagraph
);
////добаляем свойства
//добавляем свойства
//BOOL bLock = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:fldLock" ,L"false"));
//pHyperlink->m_arrItems todoooo
//BOOL bLock = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:fldLock", L"false)));
//if( TRUE == bLock )
//if( TRUE == bLock )
// oCurField->m_eMode = RtfField::fm_fldlock;
// oCurField->m_eMode = RtfField::fm_fldlock;
//BOOL bDirty = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:dirty", L"false"));
//BOOL bDirty = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:dirty", L"false"));
//if( TRUE == bDirty )
//if( TRUE == bDirty )
// oCurField->m_eMode = RtfField::fm_flddirty;
// oCurField->m_eMode = RtfField::fm_flddirty;
RtfParagraphPtr
oNewResultParagraph
(
new
RtfParagraph
()
);
RtfParagraphPtr
oNewResultParagraph
(
new
RtfParagraph
()
);
//применяем к новому параграфу default property
//применяем к новому параграфу default property
oNewResultParagraph
->
m_oProperty
=
oParam
.
oRtf
->
m_oDefaultParagraphProp
;
oNewResultParagraph
->
m_oProperty
=
oParam
.
oRtf
->
m_oDefaultParagraphProp
;
oNewResultParagraph
->
m_oProperty
.
m_oCharProperty
=
oParam
.
oRtf
->
m_oDefaultCharProp
;
oNewResultParagraph
->
m_oProperty
.
m_oCharProperty
=
oParam
.
oRtf
->
m_oDefaultCharProp
;
//применяем к новому параграфу свойства данного параграфа
//применяем к новому параграфу свойства данного параграфа
oNewResultParagraph
->
m_oProperty
=
oOutputParagraph
.
m_oProperty
;
oNewResultParagraph
->
m_oProperty
=
oOutputParagraph
.
m_oProperty
;
if
(
pHyperlink
->
m_arrItems
.
size
()
>
0
)
if
(
pHyperlink
->
m_arrItems
.
size
()
>
0
)
{
{
OOXParagraphReader
oSubParReader
(
pHyperlink
);
OOXParagraphReader
oSubParReader
(
pHyperlink
);
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oSubParReader
.
m_oCharProperty
.
Merge
(
oOutputParagraph
.
m_oProperty
.
m_oCharProperty
);
oSubParReader
.
Parse2
(
oParam
,
*
oNewResultParagraph
,
CcnfStyle
(),
poExternalStyle
);
oSubParReader
.
Parse2
(
oParam
,
*
oNewResultParagraph
,
CcnfStyle
(),
poExternalStyle
);
oCurField
->
m_pResult
->
m_pTextItems
->
AddItem
(
oNewResultParagraph
);
oCurField
->
m_pResult
->
m_pTextItems
->
AddItem
(
oNewResultParagraph
);
}
}
oOutputParagraph
.
AddItem
(
oCurField
);
oOutputParagraph
.
AddItem
(
oCurField
);
}
}
}
break
;
}
case
OOX
:
:
et_w_bookmarkStart
:
if
(
pHyperlink
->
m_sAnchor
.
IsInit
()
)
{
{
OOX
::
Logic
::
CBookmarkStart
*
pBookmarkStart
=
dynamic_cast
<
OOX
::
Logic
::
CBookmarkStart
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
RtfFieldPtr
oCurField
(
new
RtfField
()
);
RtfBookmarkStartPtr
oNewBookmark
(
new
RtfBookmarkStart
()
);
oNewBookmark
->
m_sName
=
pBookmarkStart
->
m_sName
.
IsInit
()
?
pBookmarkStart
->
m_sName
.
get2
()
:
L""
;
oCurField
->
m_pInsert
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
oCurField
->
m_pResult
=
RtfFieldInstPtr
(
new
RtfFieldInst
()
);
//добавляем insert
RtfCharPtr
pNewCharHYPER
(
new
RtfChar
()
);
pNewCharHYPER
->
m_bRtfEncode
=
false
;
pNewCharHYPER
->
setText
(
L"HYPERLINK
\\
l
\"
"
+
pHyperlink
->
m_sAnchor
.
get
()
+
L"
\"
"
);
if
(
pBookmarkStart
->
m_oColFirst
.
IsInit
())
RtfParagraphPtr
oNewInsertParagraph
(
new
RtfParagraph
()
);
oNewBookmark
->
nFirstColumn
=
pBookmarkStart
->
m_oColFirst
->
GetValue
();
oNewInsertParagraph
->
AddItem
(
pNewCharHYPER
);
if
(
pBookmarkStart
->
m_oColLast
.
IsInit
())
oNewBookmark
->
nLastColumn
=
pBookmarkStart
->
m_oColLast
->
GetValue
();
oCurField
->
m_pInsert
->
m_pTextItems
->
AddItem
(
oNewInsertParagraph
);
////добаляем свойства
//BOOL bLock = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:fldLock" ,L"false"));
//if( TRUE == bLock )
// oCurField->m_eMode = RtfField::fm_fldlock;
//BOOL bDirty = Strings::ToBoolean(oXmlReader.ReadNodeAttribute(i, L"w:dirty", L"false"));
//if( TRUE == bDirty )
// oCurField->m_eMode = RtfField::fm_flddirty;
RtfParagraphPtr
oNewResultParagraph
(
new
RtfParagraph
()
);
//применяем к новому параграфу default property
oNewResultParagraph
->
m_oProperty
=
oParam
.
oRtf
->
m_oDefaultParagraphProp
;
oNewResultParagraph
->
m_oProperty
.
m_oCharProperty
=
oParam
.
oRtf
->
m_oDefaultCharProp
;
//применяем к новому параграфу свойства данного параграфа
oNewResultParagraph
->
m_oProperty
=
oOutputParagraph
.
m_oProperty
;
if
(
pBookmarkStart
->
m_oId
.
IsInit
()
)
if
(
pHyperlink
->
m_arrItems
.
size
()
>
0
)
{
{
int
nId
=
pBookmarkStart
->
m_oId
->
GetValue
();
OOXParagraphReader
oSubParReader
(
pHyperlink
);
oParam
.
oReader
->
m_aBookmarks
.
insert
(
std
::
pair
<
int
,
std
::
wstring
>
(
nId
,
oNewBookmark
->
m_sName
));
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oOutputParagraph
.
AddItem
(
oNewBookmark
);
oSubParReader
.
m_oCharProperty
.
Merge
(
oOutputParagraph
.
m_oProperty
.
m_oCharProperty
);
oSubParReader
.
Parse2
(
oParam
,
*
oNewResultParagraph
,
CcnfStyle
(),
poExternalStyle
);
oCurField
->
m_pResult
->
m_pTextItems
->
AddItem
(
oNewResultParagraph
);
}
}
}
break
;
oOutputParagraph
.
AddItem
(
oCurField
);
case
OOX
:
:
et_w_bookmarkEnd
:
}
}
break
;
case
OOX
:
:
et_w_bookmarkStart
:
{
OOX
::
Logic
::
CBookmarkStart
*
pBookmarkStart
=
dynamic_cast
<
OOX
::
Logic
::
CBookmarkStart
*>
(
m_ooxElement
);
RtfBookmarkStartPtr
oNewBookmark
(
new
RtfBookmarkStart
()
);
oNewBookmark
->
m_sName
=
pBookmarkStart
->
m_sName
.
IsInit
()
?
pBookmarkStart
->
m_sName
.
get2
()
:
L""
;
if
(
pBookmarkStart
->
m_oColFirst
.
IsInit
())
oNewBookmark
->
nFirstColumn
=
pBookmarkStart
->
m_oColFirst
->
GetValue
();
if
(
pBookmarkStart
->
m_oColLast
.
IsInit
())
oNewBookmark
->
nLastColumn
=
pBookmarkStart
->
m_oColLast
->
GetValue
();
if
(
pBookmarkStart
->
m_oId
.
IsInit
())
{
{
OOX
::
Logic
::
CBookmarkEnd
*
pBookmarkEnd
=
dynamic_cast
<
OOX
::
Logic
::
CBookmarkEnd
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
int
nId
=
pBookmarkStart
->
m_oId
->
GetValue
();
oParam
.
oReader
->
m_aBookmarks
.
insert
(
std
::
pair
<
int
,
std
::
wstring
>
(
nId
,
oNewBookmark
->
m_sName
));
oOutputParagraph
.
AddItem
(
oNewBookmark
);
}
}
break
;
case
OOX
:
:
et_w_bookmarkEnd
:
{
OOX
::
Logic
::
CBookmarkEnd
*
pBookmarkEnd
=
dynamic_cast
<
OOX
::
Logic
::
CBookmarkEnd
*>
(
m_ooxElement
);
RtfBookmarkEndPtr
oNewBookmark
(
new
RtfBookmarkEnd
()
);
RtfBookmarkEndPtr
oNewBookmark
(
new
RtfBookmarkEnd
()
);
//oNewBookmark->m_sName = pBookmarkEnd->;
//oNewBookmark->m_sName = pBookmarkEnd->;
int
nId
=
pBookmarkEnd
->
m_oId
->
GetValue
();
int
nId
=
pBookmarkEnd
->
m_oId
->
GetValue
();
std
::
map
<
int
,
std
::
wstring
>::
iterator
pPair
=
oParam
.
oReader
->
m_aBookmarks
.
find
(
nId
);
std
::
map
<
int
,
std
::
wstring
>::
iterator
pPair
=
oParam
.
oReader
->
m_aBookmarks
.
find
(
nId
);
if
(
pPair
!=
oParam
.
oReader
->
m_aBookmarks
.
end
())
if
(
pPair
!=
oParam
.
oReader
->
m_aBookmarks
.
end
())
{
oNewBookmark
->
m_sName
=
pPair
->
second
;
oOutputParagraph
.
AddItem
(
oNewBookmark
);
}
}
break
;
case
OOX
:
:
et_w_smartTag
:
{
{
OOX
::
Logic
::
CSmartTag
*
pSmartTag
=
dynamic_cast
<
OOX
::
Logic
::
CSmartTag
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
oNewBookmark
->
m_sName
=
pPair
->
second
;
oOutputParagraph
.
AddItem
(
oNewBookmark
);
for
(
size_t
i
=
0
;
i
<
pSmartTag
->
m_arrItems
.
size
();
i
++
)
}
{
}
break
;
OOX
::
Logic
::
CRun
*
pRun
=
dynamic_cast
<
OOX
::
Logic
::
CRun
*>
(
pSmartTag
->
m_arrItems
[
i
]);
case
OOX
:
:
et_w_smartTag
:
if
(
pRun
==
NULL
)
continue
;
{
OOX
::
Logic
::
CSmartTag
*
pSmartTag
=
dynamic_cast
<
OOX
::
Logic
::
CSmartTag
*>
(
m_ooxElement
);
OOXRunReader
oRunReader
(
pRun
);
for
(
size_t
i
=
0
;
i
<
pSmartTag
->
m_arrItems
.
size
();
i
++
)
oRunReader
.
m_oCharProperty
=
m_oCharProperty
;
oRunReader
.
Parse
(
oParam
,
oOutputParagraph
,
poExternalStyle
);
}
}
break
;
case
OOX
:
:
et_m_oMath
:
{
{
OOX
::
Logic
::
COMath
*
pMath
=
dynamic_cast
<
OOX
::
Logic
::
COMath
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
OOX
::
Logic
::
CRun
*
pRun
=
dynamic_cast
<
OOX
::
Logic
::
CRun
*>
(
pSmartTag
->
m_arrItems
[
i
]);
if
(
pRun
==
NULL
)
continue
;
OOXRunReader
oRunReader
(
pRun
);
oRunReader
.
m_oCharProperty
=
m_oCharProperty
;
RtfMathPtr
oNewMath
(
new
RtfMath
()
);
oRunReader
.
Parse
(
oParam
,
oOutputParagraph
,
poExternalStyle
);
oNewMath
->
SetOOXType
(
OOX
::
et_m_oMath
);
}
}
break
;
case
OOX
:
:
et_m_oMath
:
{
OOX
::
Logic
::
COMath
*
pMath
=
dynamic_cast
<
OOX
::
Logic
::
COMath
*>
(
m_ooxElement
);
RtfMathPtr
oNewMath
(
new
RtfMath
()
);
oNewMath
->
SetOOXType
(
OOX
::
et_m_oMath
);
OOXMathReader
oMathReader
(
pMath
);
oMathReader
.
m_oCharProperty
=
m_oCharProperty
;
oMathReader
.
m_oCharProperty
.
Merge
(
oOutputParagraph
.
m_oProperty
.
m_oCharProperty
);
if
(
true
==
oMathReader
.
Parse
(
oParam
,
(
*
oNewMath
)
)
)
oOutputParagraph
.
AddItem
(
oNewMath
);
}
break
;
case
OOX
:
:
et_m_oMathPara
:
{
OOX
::
Logic
::
COMathPara
*
pMathPara
=
dynamic_cast
<
OOX
::
Logic
::
COMathPara
*>
(
m_ooxElement
);
RtfMathPtr
oNewMath
(
new
RtfMath
()
);
oNewMath
->
SetOOXType
(
OOX
::
et_m_oMathPara
);
OOXMathReader
oMathReader
(
pMath
);
OOXMathReader
oMathReader
(
pMathPara
);
oMathReader
.
m_oCharProperty
=
m_oCharProperty
;
oMathReader
.
m_oCharProperty
=
m_oCharProperty
;
oMathReader
.
m_oCharProperty
.
Merge
(
oOutputParagraph
.
m_oProperty
.
m_oCharProperty
);
oMathReader
.
m_oCharProperty
.
Merge
(
oOutputParagraph
.
m_oProperty
.
m_oCharProperty
);
if
(
true
==
oMathReader
.
Parse
(
oParam
,
(
*
oNewMath
)
)
)
if
(
true
==
oMathReader
.
Parse
(
oParam
,
(
*
oNewMath
)
)
)
oOutputParagraph
.
AddItem
(
oNewMath
);
oOutputParagraph
.
AddItem
(
oNewMath
);
}
break
;
}
break
;
case
OOX
:
:
et_m_oMathPara
:
case
OOX
:
:
et_w_sdt
:
{
OOX
::
Logic
::
CSdt
*
pSdt
=
dynamic_cast
<
OOX
::
Logic
::
CSdt
*>
(
m_ooxElement
);
if
(
pSdt
->
m_oSdtEndPr
.
IsInit
()
)
{
{
OOX
::
Logic
::
COMathPara
*
pMathPara
=
dynamic_cast
<
OOX
::
Logic
::
COMathPara
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
//todo
}
RtfMathPtr
oNewMath
(
new
RtfMath
()
);
if
(
pSdt
->
m_oSdtContent
.
IsInit
())
oNewMath
->
SetOOXType
(
OOX
::
et_m_oMathPara
);
OOXMathReader
oMathReader
(
pMathPara
);
oMathReader
.
m_oCharProperty
=
m_oCharProperty
;
oMathReader
.
m_oCharProperty
.
Merge
(
oOutputParagraph
.
m_oProperty
.
m_oCharProperty
);
if
(
true
==
oMathReader
.
Parse
(
oParam
,
(
*
oNewMath
)
)
)
oOutputParagraph
.
AddItem
(
oNewMath
);
}
break
;
case
OOX
:
:
et_w_sdt
:
{
{
OOX
::
Logic
::
CSdt
*
pSdt
=
dynamic_cast
<
OOX
::
Logic
::
CSdt
*>
(
m_ooxElement
->
m_arrItems
[
i
]);
if
(
pSdt
->
m_oSdtContent
->
m_arrItems
.
size
()
>
0
)
if
(
pSdt
->
m_oSdtEndPr
.
IsInit
()
)
{
//todo
}
if
(
pSdt
->
m_oSdtContent
.
IsInit
())
{
{
if
(
pSdt
->
m_oSdtContent
->
m_arrItems
.
size
()
>
0
)
OOXParagraphReader
oSubParReader
(
pSdt
->
m_oSdtContent
.
GetPointer
());
{
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
OOXParagraphReader
oSubParReader
(
pSdt
->
m_oSdtContent
.
GetPointer
());
oSubParReader
.
m_oCharProperty
=
m_oCharProperty
;
oSubParReader
.
Parse2
(
oParam
,
oOutputParagraph
,
CcnfStyle
(),
poExternalStyle
);
oSubParReader
.
Parse2
(
oParam
,
oOutputParagraph
,
CcnfStyle
(),
poExternalStyle
);
}
}
}
}
break
;
}
default:
}
break
;
break
;
default:
}
break
;
}
}
return
true
;
return
true
;
}
}
...
@@ -736,23 +744,6 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
...
@@ -736,23 +744,6 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
oOutputParagraph
.
AddItem
(
pNewDrawing
);
oOutputParagraph
.
AddItem
(
pNewDrawing
);
bAddDrawing
=
true
;
bAddDrawing
=
true
;
}
}
else
if
(
result
==
2
&&
ooxDrawing
->
m_sXml
.
IsInit
())
{
OOX
::
IFileContainer
*
store_container
=
oParam
.
oReader
->
m_currentContainer
;
OOXDrawingGraphicConverter
oGraphicConverter
(
*
ooxDrawing
->
m_sXml
);
OOX
::
Logic
::
CDrawing
*
ooxNewDrawing
=
oGraphicConverter
.
Convert
(
oParam
,
pNewDrawing
);
//OOX::Logic::CPicture *ooxPicture = oGraphiceReader.Parse( oParam, pNewDrawing );
oParam
.
oReader
->
m_currentContainer
=
oGraphicConverter
.
m_ooxGraphicRels
;
if
(
Parse
(
oParam
,
oOutputParagraph
,
poStyle
,
oNewProperty
,
ooxNewDrawing
/*ooxPicture*/
))
{
bAddDrawing
=
true
;
}
//if (ooxPicture)delete ooxPicture;
if
(
ooxNewDrawing
)
delete
ooxNewDrawing
;
oParam
.
oReader
->
m_currentContainer
=
store_container
;
}
if
(
!
bAddDrawing
)
if
(
!
bAddDrawing
)
{
{
pNewDrawing
->
SetNotSupportShape
();
pNewDrawing
->
SetNotSupportShape
();
...
@@ -982,23 +973,20 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
...
@@ -982,23 +973,20 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
RtfCharProperty
oNewProperty
;
RtfCharProperty
oNewProperty
;
oNewProperty
.
SetDefaultOOX
();
oNewProperty
.
SetDefaultOOX
();
if
(
m_drawingRun
->
m_oRunProperty
.
IsInit
())
if
(
m_drawingRun
->
rPr
.
IsInit
())
{
{
OOXrPrReader
orPrReader
(
m_drawingRun
->
m_oRunProperty
.
GetPointer
());
OOXrPrReader
orPrReader
(
m_drawingRun
->
rPr
.
GetPointer
());
orPrReader
.
Parse
(
oParam
,
oNewProperty
);
orPrReader
.
Parse
(
oParam
,
oNewProperty
);
}
}
if
(
m_drawingRun
->
m_oText
.
IsInit
())
std
::
wstring
sValue
=
m_drawingRun
->
GetText
();
{
std
::
wstring
sValue
=
m_drawingRun
->
m_oText
->
m_sText
;
RtfCharPtr
pNewChar
(
new
RtfChar
()
)
;
RtfCharPtr
pNewChar
(
new
RtfChar
()
);
pNewChar
->
m_oProperty
=
oNewProperty
;
pNewChar
->
setText
(
sValue
);
pNewChar
->
m_oProperty
=
oNewProperty
;
pNewChar
->
setText
(
sValue
);
oOutputParagraph
.
AddItem
(
pNewChar
);
oOutputParagraph
.
AddItem
(
pNewChar
);
}
}
}
else
else
{
{
...
@@ -1638,12 +1626,12 @@ bool OOXpPrReader::ParseDrawing( ReaderParameter oParam, RtfParagraphProperty& o
...
@@ -1638,12 +1626,12 @@ bool OOXpPrReader::ParseDrawing( ReaderParameter oParam, RtfParagraphProperty& o
{
{
if
(
m_drawingParaProps
==
NULL
)
return
false
;
if
(
m_drawingParaProps
==
NULL
)
return
false
;
if
(
m_drawingParaProps
->
m_oL
vl
.
IsInit
())
if
(
m_drawingParaProps
->
l
vl
.
IsInit
())
oOutputProperty
.
m_nOutlinelevel
=
m_drawingParaProps
->
m_oLvl
->
GetValue
();
oOutputProperty
.
m_nOutlinelevel
=
m_drawingParaProps
->
lvl
.
get
();
if
(
m_drawingParaProps
->
m_oA
lgn
.
IsInit
())
if
(
m_drawingParaProps
->
a
lgn
.
IsInit
())
{
{
switch
(
m_drawingParaProps
->
m_oAlgn
->
GetValu
e
())
switch
(
m_drawingParaProps
->
algn
->
GetBYTECod
e
())
{
{
case
SimpleTypes
:
:
jcBoth
:
oOutputProperty
.
m_eAlign
=
RtfParagraphProperty
::
pa_qj
;
break
;
case
SimpleTypes
:
:
jcBoth
:
oOutputProperty
.
m_eAlign
=
RtfParagraphProperty
::
pa_qj
;
break
;
case
SimpleTypes
:
:
jcCenter
:
oOutputProperty
.
m_eAlign
=
RtfParagraphProperty
::
pa_qc
;
break
;
case
SimpleTypes
:
:
jcCenter
:
oOutputProperty
.
m_eAlign
=
RtfParagraphProperty
::
pa_qc
;
break
;
...
@@ -1680,17 +1668,15 @@ bool OOXpPrReader::ParseDrawing( ReaderParameter oParam, RtfParagraphProperty& o
...
@@ -1680,17 +1668,15 @@ bool OOXpPrReader::ParseDrawing( ReaderParameter oParam, RtfParagraphProperty& o
// oOutputProperty.m_nIndEnd = m_drawingParaProps->m_oInd->m_oEnd->ToTwips();
// oOutputProperty.m_nIndEnd = m_drawingParaProps->m_oInd->m_oEnd->ToTwips();
//}
//}
if
(
m_drawingParaProps
->
m_oBeforeSpacing
.
IsInit
()
if
(
m_drawingParaProps
->
spcBef
.
IsInit
()
&&
m_drawingParaProps
->
m_oBeforeSpacing
->
m_oLineSpacingPoints
.
IsInit
()
&&
m_drawingParaProps
->
spcBef
->
spcPts
.
IsInit
())
&&
m_drawingParaProps
->
m_oBeforeSpacing
->
m_oLineSpacingPoints
->
m_oVal
.
IsInit
())
oOutputProperty
.
m_nSpaceBefore
=
m_drawingParaProps
->
spcBef
->
spcPts
.
get
();
oOutputProperty
.
m_nSpaceBefore
=
m_drawingParaProps
->
m_oBeforeSpacing
->
m_oLineSpacingPoints
->
m_oVal
->
GetValue
();
if
(
m_drawingParaProps
->
m_oAfterSpacing
.
IsInit
()
if
(
m_drawingParaProps
->
spcAft
.
IsInit
()
&&
m_drawingParaProps
->
m_oAfterSpacing
->
m_oLineSpacingPoints
.
IsInit
()
&&
m_drawingParaProps
->
spcAft
->
spcPts
.
IsInit
())
&&
m_drawingParaProps
->
m_oAfterSpacing
->
m_oLineSpacingPoints
->
m_oVal
.
IsInit
())
oOutputProperty
.
m_nSpaceAfter
=
m_drawingParaProps
->
spcAft
->
spcPts
.
get
();
oOutputProperty
.
m_nSpaceAfter
=
m_drawingParaProps
->
m_oAfterSpacing
->
m_oLineSpacingPoints
->
m_oVal
->
GetValue
();
if
(
m_drawingParaProps
->
m_oBuChar
.
IsInit
()
||
m_drawingParaProps
->
m_oBuAutoNum
.
IsIni
t
())
if
(
m_drawingParaProps
->
ParagraphBullet
.
has_bulle
t
())
{
{
oOutputProperty
.
m_nListLevel
=
0
;
oOutputProperty
.
m_nListLevel
=
0
;
oOutputProperty
.
m_nListId
=
oParam
.
oRtf
->
m_oListTable
.
GetCount
()
+
1
;
oOutputProperty
.
m_nListId
=
oParam
.
oRtf
->
m_oListTable
.
GetCount
()
+
1
;
...
@@ -1700,31 +1686,31 @@ bool OOXpPrReader::ParseDrawing( ReaderParameter oParam, RtfParagraphProperty& o
...
@@ -1700,31 +1686,31 @@ bool OOXpPrReader::ParseDrawing( ReaderParameter oParam, RtfParagraphProperty& o
oNewList
.
m_nListSimple
=
1
;
oNewList
.
m_nListSimple
=
1
;
RtfListLevelProperty
oNewLevel
;
RtfListLevelProperty
oNewLevel
;
if
(
m_drawingParaProps
->
m_oBuChar
.
IsInit
()
&&
m_drawingParaProps
->
m_oBuChar
->
m_sChar
.
IsInit
())
//if (m_drawingParaProps->ParagraphBullet
.IsInit() && m_drawingParaProps->m_oBuChar->m_sChar.IsInit())
{
//
{
oNewLevel
.
m_sText
=
m_drawingParaProps
->
m_oBuChar
->
m_sChar
.
get
();
//
oNewLevel.m_sText = m_drawingParaProps->m_oBuChar->m_sChar.get();
oNewLevel
.
m_nNumberType
=
23
;
//
oNewLevel.m_nNumberType = 23;
}
//
}
else
if
(
m_drawingParaProps
->
m_oBuAutoNum
.
IsInit
()
)
//
else if ( m_drawingParaProps->m_oBuAutoNum.IsInit() )
{
//
{
if
(
m_drawingParaProps
->
m_oBuAutoNum
->
m_sType
.
IsInit
())
//
if (m_drawingParaProps->m_oBuAutoNum->m_sType.IsInit())
oNewLevel
.
m_nNumberType
=
oNewLevel
.
GetFormat
(
m_drawingParaProps
->
m_oBuAutoNum
->
m_sType
.
get
());
//
oNewLevel.m_nNumberType = oNewLevel.GetFormat( m_drawingParaProps->m_oBuAutoNum->m_sType.get());
else
//
else
oNewLevel
.
m_nNumberType
=
0
;
//
oNewLevel.m_nNumberType = 0;
if
(
m_drawingParaProps
->
m_oBuAutoNum
->
m_nStartAt
.
IsInit
())
//
if (m_drawingParaProps->m_oBuAutoNum->m_nStartAt.IsInit())
oNewLevel
.
m_nStart
=
m_drawingParaProps
->
m_oBuAutoNum
->
m_nStartAt
->
GetValue
();
//
oNewLevel.m_nStart = m_drawingParaProps->m_oBuAutoNum->m_nStartAt->GetValue();
}
//
}
oNewList
.
AddItem
(
oNewLevel
);
oNewList
.
AddItem
(
oNewLevel
);
oParam
.
oRtf
->
m_oListTable
.
AddItem
(
oNewList
);
}
oParam
.
oRtf
->
m_oListTable
.
AddItem
(
oNewList
);
}
if
(
m_drawingParaProps
->
m_oR
tl
.
IsInit
())
if
(
m_drawingParaProps
->
r
tl
.
IsInit
())
oOutputProperty
.
m_bRtl
=
m_drawingParaProps
->
m_oRtl
->
ToBool
()
?
1
:
0
;
oOutputProperty
.
m_bRtl
=
m_drawingParaProps
->
rtl
.
get
()
?
1
:
0
;
if
(
m_drawingParaProps
->
m_oDefRunProperty
.
IsInit
()
)
if
(
m_drawingParaProps
->
defRPr
.
IsInit
()
)
{
{
OOXrPrReader
orPrReader
(
m_drawingParaProps
->
m_oDefRunProperty
.
GetPointer
());
OOXrPrReader
orPrReader
(
m_drawingParaProps
->
defRPr
.
GetPointer
());
orPrReader
.
Parse
(
oParam
,
oOutputProperty
.
m_oCharProperty
);
orPrReader
.
Parse
(
oParam
,
oOutputProperty
.
m_oCharProperty
);
}
}
...
@@ -1735,29 +1721,29 @@ bool OOXrPrReader::ParseDrawing( ReaderParameter oParam, RtfCharProperty& oOutpu
...
@@ -1735,29 +1721,29 @@ bool OOXrPrReader::ParseDrawing( ReaderParameter oParam, RtfCharProperty& oOutpu
if
(
m_drawingRunProps
==
NULL
)
return
false
;
if
(
m_drawingRunProps
==
NULL
)
return
false
;
if
(
m_drawingRunProps
->
m_oBold
.
IsInit
())
if
(
m_drawingRunProps
->
b
.
IsInit
())
oOutputProperty
.
m_bBold
=
m_drawingRunProps
->
m_oBold
->
ToBool
()
?
1
:
0
;
oOutputProperty
.
m_bBold
=
m_drawingRunProps
->
b
.
get
()
?
1
:
0
;
//if (m_drawingRunProps->m_oCaps.IsInit())
//if (m_drawingRunProps->m_oCaps.IsInit())
// oOutputProperty.m_bCaps = m_drawingRunProps->m_oCaps->ToBool() ? 1 : 0;
// oOutputProperty.m_bCaps = m_drawingRunProps->m_oCaps->ToBool() ? 1 : 0;
if
(
m_drawingRunProps
->
m_oS
z
.
IsInit
())
if
(
m_drawingRunProps
->
s
z
.
IsInit
())
oOutputProperty
.
m_nFontSize
=
m_drawingRunProps
->
m_oSz
->
GetValue
()
/
50
;
oOutputProperty
.
m_nFontSize
=
m_drawingRunProps
->
sz
.
get
()
/
50
;
if
(
m_drawingRunProps
->
m_oItalic
.
IsInit
())
if
(
m_drawingRunProps
->
i
.
IsInit
())
oOutputProperty
.
m_bItalic
=
m_drawingRunProps
->
m_oItalic
->
ToBool
()
?
1
:
0
;
oOutputProperty
.
m_bItalic
=
m_drawingRunProps
->
i
.
get
()
?
1
:
0
;
if
(
m_drawingRunProps
->
m_oLatinFont
.
IsInit
()
||
m_drawingRunProps
->
m_oComplexFont
.
IsInit
()
||
m_drawingRunProps
->
m_oAsianFont
.
IsInit
())
if
(
m_drawingRunProps
->
latin
.
IsInit
()
||
m_drawingRunProps
->
cs
.
IsInit
()
||
m_drawingRunProps
->
ea
.
IsInit
())
{
{
OOXFontReader3
oFontReader3
(
m_drawingRunProps
->
m_oLatinFont
.
GetPointer
(),
OOXFontReader3
oFontReader3
(
m_drawingRunProps
->
latin
.
GetPointer
(),
m_drawingRunProps
->
m_oAsianFont
.
GetPointer
(),
m_drawingRunProps
->
ea
.
GetPointer
(),
m_drawingRunProps
->
m_oComplexFont
.
GetPointer
());
m_drawingRunProps
->
cs
.
GetPointer
());
oFontReader3
.
Parse
(
oParam
,
oOutputProperty
.
m_nFont
);
oFontReader3
.
Parse
(
oParam
,
oOutputProperty
.
m_nFont
);
}
}
//if (m_drawingRunProps->m_oComplexFont.IsInit() && m_drawingRunProps->m_oComplexFont->m_oTypeFace.IsInit())
//if (m_drawingRunProps->m_oComplexFont.IsInit() && m_drawingRunProps->m_oComplexFont->m_oTypeFace.IsInit())
// oOutputProperty.m_nComplexScript = m_drawingRunProps->m_oCs->m_oVal.ToBool() ? 1 : 0;;
// oOutputProperty.m_nComplexScript = m_drawingRunProps->m_oCs->m_oVal.ToBool() ? 1 : 0;;
if
(
m_drawingRunProps
->
m_oOutline
.
IsInit
())
if
(
m_drawingRunProps
->
ln
.
IsInit
())
{
{
//oOutputProperty.m_bOutline = m_drawingRunProps->m_oOutline->ToBool() ? 1 : 0;
//oOutputProperty.m_bOutline = m_drawingRunProps->m_oOutline->ToBool() ? 1 : 0;
}
}
...
@@ -1793,7 +1779,7 @@ bool OOXrPrReader::ParseDrawing( ReaderParameter oParam, RtfCharProperty& oOutpu
...
@@ -1793,7 +1779,7 @@ bool OOXrPrReader::ParseDrawing( ReaderParameter oParam, RtfCharProperty& oOutpu
// m_drawingRunProps->m_oHighlight->m_oVal->Get_G(),
// m_drawingRunProps->m_oHighlight->m_oVal->Get_G(),
// m_drawingRunProps->m_oHighlight->m_oVal->Get_B()));
// m_drawingRunProps->m_oHighlight->m_oVal->Get_B()));
//}
//}
if
(
m_drawingRunProps
->
m_oSolidFill
.
IsI
nit
()
)
if
(
m_drawingRunProps
->
Fill
.
is_i
nit
()
)
{
{
//m_drawingRunProps->m_oSolidFill
//m_drawingRunProps->m_oSolidFill
//OOXColorReader oColorReader;
//OOXColorReader oColorReader;
...
@@ -1803,9 +1789,9 @@ bool OOXrPrReader::ParseDrawing( ReaderParameter oParam, RtfCharProperty& oOutpu
...
@@ -1803,9 +1789,9 @@ bool OOXrPrReader::ParseDrawing( ReaderParameter oParam, RtfCharProperty& oOutpu
// oOutputProperty.m_nForeColor = oParam.oRtf->m_oColorTable.AddItem( oColor );
// oOutputProperty.m_nForeColor = oParam.oRtf->m_oColorTable.AddItem( oColor );
//}
//}
}
}
if
(
m_drawingRunProps
->
m_oUnderline
.
IsInit
())
if
(
m_drawingRunProps
->
u
.
IsInit
())
{
{
switch
(
m_drawingRunProps
->
m_oUnderline
->
GetValu
e
())
switch
(
m_drawingRunProps
->
u
->
GetBYTECod
e
())
{
{
case
SimpleTypes
:
:
underlineDash
:
oOutputProperty
.
m_eUnderStyle
=
RtfCharProperty
::
uls_Dashed
;
break
;
case
SimpleTypes
:
:
underlineDash
:
oOutputProperty
.
m_eUnderStyle
=
RtfCharProperty
::
uls_Dashed
;
break
;
case
SimpleTypes
:
:
underlineDashDotDotHeavy
:
oOutputProperty
.
m_eUnderStyle
=
RtfCharProperty
::
uls_Thick_dash_dot_dotted
;
break
;
case
SimpleTypes
:
:
underlineDashDotDotHeavy
:
oOutputProperty
.
m_eUnderStyle
=
RtfCharProperty
::
uls_Thick_dash_dot_dotted
;
break
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphReader.h
View file @
2e8c83a6
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
class
OOXParagraphReader
class
OOXParagraphReader
{
{
private:
private:
OOX
::
Drawing
::
CParagraph
*
m_drawingParagraph
;
PPTX
::
Logic
::
Paragraph
*
m_drawingParagraph
;
OOX
::
Logic
::
CParagraph
*
m_ooxParagraph
;
OOX
::
Logic
::
CParagraph
*
m_ooxParagraph
;
OOX
::
WritingElementWithChilds
<
OOX
::
WritingElement
>
*
m_ooxElement
;
OOX
::
WritingElementWithChilds
<
OOX
::
WritingElement
>
*
m_ooxElement
;
public:
public:
...
@@ -54,7 +54,7 @@ public:
...
@@ -54,7 +54,7 @@ public:
m_oCharProperty
.
SetDefault
();
m_oCharProperty
.
SetDefault
();
}
}
OOXParagraphReader
(
OOX
::
Drawing
::
C
Paragraph
*
ooxParagraph
)
OOXParagraphReader
(
PPTX
::
Logic
::
Paragraph
*
ooxParagraph
)
{
{
m_ooxElement
=
NULL
;
m_ooxElement
=
NULL
;
m_ooxParagraph
=
NULL
;
m_ooxParagraph
=
NULL
;
...
@@ -70,4 +70,5 @@ public:
...
@@ -70,4 +70,5 @@ public:
}
}
bool
Parse
(
ReaderParameter
oParam
,
RtfParagraph
&
oOutputParagraph
,
CcnfStyle
oConditionalTableStyle
);
bool
Parse
(
ReaderParameter
oParam
,
RtfParagraph
&
oOutputParagraph
,
CcnfStyle
oConditionalTableStyle
);
bool
Parse2
(
ReaderParameter
oParam
,
RtfParagraph
&
oOutputParagraph
,
CcnfStyle
oConditionalTableStyle
,
RtfStylePtr
poStyle
);
bool
Parse2
(
ReaderParameter
oParam
,
RtfParagraph
&
oOutputParagraph
,
CcnfStyle
oConditionalTableStyle
,
RtfStylePtr
poStyle
);
bool
Parse3
(
ReaderParameter
oParam
,
RtfParagraph
&
oOutputParagraph
,
CcnfStyle
oConditionalTableStyle
,
RtfStylePtr
poStyle
,
OOX
::
WritingElement
*
m_ooxElement
);
};
};
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureAnchorReader.h
View file @
2e8c83a6
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
*/
*/
#pragma once
#pragma once
#include "OOXDrawingGraphicReader.h"
#include "OOXDrawingGraphicReader.h"
#include "OOXPictureGraphicReader.h"
#include "OOXReaderBasic.h"
#include "OOXReaderBasic.h"
class
OOXDrawingAnchorReader
class
OOXDrawingAnchorReader
...
@@ -297,13 +296,9 @@ public:
...
@@ -297,13 +296,9 @@ public:
if
(
m_ooxAnchor
->
m_oWrapTopAndBottom
.
IsInit
())
if
(
m_ooxAnchor
->
m_oWrapTopAndBottom
.
IsInit
())
pOutput
->
m_nWrapType
=
1
;
pOutput
->
m_nWrapType
=
1
;
int
result
=
0
;
OOXGraphicReader
oGraphicReader
(
&
m_ooxAnchor
->
m_oGraphic
);
if
(
m_ooxAnchor
->
m_oGraphic
.
IsInit
()
)
{
OOXGraphicReader
oGraphicReader
(
m_ooxAnchor
->
m_oGraphic
.
GetPointer
());
result
=
oGraphicReader
.
Parse
(
oParam
,
pOutput
);
int
result
=
oGraphicReader
.
Parse
(
oParam
,
pOutput
);
}
if
(
PROP_DEF
==
pOutput
->
m_nBottom
&&
pOutput
->
m_nTop
!=
PROP_DEF
)
if
(
PROP_DEF
==
pOutput
->
m_nBottom
&&
pOutput
->
m_nTop
!=
PROP_DEF
)
{
{
pOutput
->
m_nBottom
=
pOutput
->
m_nTop
+
nHeight
;
pOutput
->
m_nBottom
=
pOutput
->
m_nTop
+
nHeight
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXPictureInlineReader.h
View file @
2e8c83a6
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
*
*
*/
*/
#pragma once
#pragma once
#include "OOX
Picture
GraphicReader.h"
#include "OOX
Drawing
GraphicReader.h"
class
OOXDrawingInlineReader
class
OOXDrawingInlineReader
{
{
...
@@ -78,13 +78,9 @@ public:
...
@@ -78,13 +78,9 @@ public:
}
}
}
}
int
result
=
0
;
OOXGraphicReader
oGraphicReader
(
&
m_ooxInline
->
m_oGraphic
);
if
(
m_ooxInline
->
m_oGraphic
.
IsInit
())
{
OOXGraphicReader
oGraphicReader
(
m_ooxInline
->
m_oGraphic
.
GetPointer
());
result
=
oGraphicReader
.
Parse
(
oParam
,
pOutput
);
int
result
=
oGraphicReader
.
Parse
(
oParam
,
pOutput
);
}
return
result
;
return
result
;
}
}
};
};
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXReader.cpp
View file @
2e8c83a6
...
@@ -73,7 +73,7 @@ bool OOXReader::Parse()
...
@@ -73,7 +73,7 @@ bool OOXReader::Parse()
oFontTableReader
.
Parse
(
oReaderParameter
);
oFontTableReader
.
Parse
(
oReaderParameter
);
}
}
OOX
::
C
Theme
*
theme
=
inputDocxFile
.
GetTheme
();
PPTX
::
Theme
*
theme
=
inputDocxFile
.
GetTheme
();
if
(
theme
)
if
(
theme
)
{
{
OOXThemeReader
oThemeReader
(
theme
);
OOXThemeReader
oThemeReader
(
theme
);
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXRunReader.h
View file @
2e8c83a6
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
class
OOXRunReader
class
OOXRunReader
{
{
private:
private:
OOX
::
Drawing
::
C
Run
*
m_drawingRun
;
PPTX
::
Logic
::
Run
*
m_drawingRun
;
OOX
::
Logic
::
CRun
*
m_ooxRun
;
OOX
::
Logic
::
CRun
*
m_ooxRun
;
public:
public:
RtfCharProperty
m_oCharProperty
;
RtfCharProperty
m_oCharProperty
;
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
m_ooxRun
=
ooxRun
;
m_ooxRun
=
ooxRun
;
m_oCharProperty
.
SetDefault
();
m_oCharProperty
.
SetDefault
();
}
}
OOXRunReader
(
OOX
::
Drawing
::
C
Run
*
ooxRun
)
OOXRunReader
(
PPTX
::
Logic
::
Run
*
ooxRun
)
{
{
m_drawingRun
=
ooxRun
;
m_drawingRun
=
ooxRun
;
m_ooxRun
=
NULL
;
m_ooxRun
=
NULL
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp
View file @
2e8c83a6
...
@@ -33,7 +33,9 @@
...
@@ -33,7 +33,9 @@
#include "OOXTextItemReader.h"
#include "OOXTextItemReader.h"
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/Shape.h"
#include "../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SchemeClr.h"
#include "../../../ASCOfficeOdfFile/src/odf/svg_parser.h"
#include "../../../ASCOfficeOdfFile/src/odf/svg_parser.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
...
@@ -262,7 +264,7 @@ OOXShapeReader::OOXShapeReader(OOX::WritingElementWithChilds<OOX::WritingElement
...
@@ -262,7 +264,7 @@ OOXShapeReader::OOXShapeReader(OOX::WritingElementWithChilds<OOX::WritingElement
m_arrElement
=
elem
;
m_arrElement
=
elem
;
m_vmlElement
=
dynamic_cast
<
OOX
::
Vml
::
CVmlCommonElements
*>
(
elem
);
m_vmlElement
=
dynamic_cast
<
OOX
::
Vml
::
CVmlCommonElements
*>
(
elem
);
m_ooxShape
=
dynamic_cast
<
OOX
::
Logic
::
C
Shape
*>
(
elem
);
m_ooxShape
=
dynamic_cast
<
PPTX
::
Logic
::
Shape
*>
(
elem
);
if
(
m_vmlElement
==
NULL
&&
m_ooxShape
==
NULL
)
if
(
m_vmlElement
==
NULL
&&
m_ooxShape
==
NULL
)
{
{
...
@@ -581,112 +583,122 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
...
@@ -581,112 +583,122 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu
}
}
return
true
;
return
true
;
}
}
bool
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
int
indexSchemeColor
,
BYTE
&
ucA
,
BYTE
&
ucG
,
BYTE
&
ucB
,
BYTE
&
ucR
)
//bool OOXShapeReader::Parse(ReaderParameter oParam, int indexSchemeColor, BYTE& ucA, BYTE& ucG, BYTE& ucB, BYTE& ucR)
//{
// OOX::CTheme * theme= oParam.oDocx->GetTheme();
// if (!theme)return false;
//
// bool result = false;
//
// switch(indexSchemeColor)
// {
// case SimpleTypes::shemecolorvalLt1:
// case SimpleTypes::shemecolorvalBg1:
// result = theme->m_oThemeElements.m_oClrScheme.m_oLt1.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalLt2:
// case SimpleTypes::shemecolorvalBg2:
// result = theme->m_oThemeElements.m_oClrScheme.m_oLt2.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalDk1:
// case SimpleTypes::shemecolorvalTx1:
// result = theme->m_oThemeElements.m_oClrScheme.m_oDk1.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalDk2:
// case SimpleTypes::shemecolorvalTx2:
// result = theme->m_oThemeElements.m_oClrScheme.m_oDk2.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalAccent1:
// result = theme->m_oThemeElements.m_oClrScheme.m_oAccent1.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalAccent2:
// result = theme->m_oThemeElements.m_oClrScheme.m_oAccent2.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalAccent3:
// result = theme->m_oThemeElements.m_oClrScheme.m_oAccent3.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalAccent4:
// result = theme->m_oThemeElements.m_oClrScheme.m_oAccent4.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalAccent5:
// result = theme->m_oThemeElements.m_oClrScheme.m_oAccent5.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalAccent6:
// result = theme->m_oThemeElements.m_oClrScheme.m_oAccent6.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalFolHlink:
// result = theme->m_oThemeElements.m_oClrScheme.m_oFolHlink.tryGetRgb(ucR, ucG, ucB, ucA); break;
// case SimpleTypes::shemecolorvalHlink:
// result = theme->m_oThemeElements.m_oClrScheme.m_oHlink.tryGetRgb(ucR, ucG, ucB, ucA); break;
// default: break;
// }
// return result;
//}
//void OOXShapeReader::Parse(ReaderParameter oParam, OOX::Drawing::CSchemeColor *oox_ShemeClr, unsigned int & nColor, _CP_OPT(double) &opacity)
//{
// if (!oox_ShemeClr)return;
//
// int theme_ind = oox_ShemeClr->m_oVal.GetValue();
//
// BYTE ucA = 0, ucG = 0, ucB = 0, ucR = 0;
// bool result = Parse(oParam, theme_ind, ucA, ucG, ucB, ucR);
//
// if (result == true)
// {
// oox_ShemeClr->SetRGBA(ucR, ucG, ucB, ucA);
// oox_ShemeClr->GetRGBA(ucR, ucG, ucB, ucA);
//
// nColor = RGB(ucR, ucG, ucB);
// if ( ucA != 0xff ) opacity = (ucA / 255.) * 100.;
// }
//}
//
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
PPTX
::
Logic
::
ColorBase
*
oox_color
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
)
{
{
OOX
::
CTheme
*
theme
=
oParam
.
oDocx
->
GetTheme
();
if
(
!
oox_color
)
return
;
if
(
!
theme
)
return
false
;
nColor
=
oox_color
->
GetARGB
(
0
);
bool
result
=
false
;
BYTE
alpha
=
nColor
>>
24
;
if
(
alpha
!=
0xff
)
switch
(
indexSchemeColor
)
opacity
=
alpha
;
{
nColor
=
nColor
&
0xff000000
;
case
SimpleTypes
:
:
shemecolorvalLt1
:
//switch( oox_color->m_eType )
case
SimpleTypes
:
:
shemecolorvalBg1
:
//{
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oLt1
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
// case OOX::Drawing::colorSheme: Parse(oParam, &oox_color->m_oShemeClr, nColor, opacity); break;
case
SimpleTypes
:
:
shemecolorvalLt2
:
// case OOX::Drawing::colorHsl: Parse(oParam, &oox_color->m_oHslClr, nColor, opacity); break;
case
SimpleTypes
:
:
shemecolorvalBg2
:
// case OOX::Drawing::colorPrst: Parse(oParam, &oox_color->m_oPrstClr, nColor, opacity); break;
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oLt2
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
// case OOX::Drawing::colorScRgb: Parse(oParam, &oox_color->m_oScrgbClr, nColor, opacity); break;
case
SimpleTypes
:
:
shemecolorvalDk1
:
// case OOX::Drawing::colorSRgb: Parse(oParam, &oox_color->m_oSrgbClr, nColor, opacity); break;
case
SimpleTypes
:
:
shemecolorvalTx1
:
// case OOX::Drawing::colorSys: Parse(oParam, &oox_color->m_oSysClr, nColor, opacity); break;
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oDk1
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
// default: break;
case
SimpleTypes
:
:
shemecolorvalDk2
:
// }
case
SimpleTypes
:
:
shemecolorvalTx2
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oDk2
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
case
SimpleTypes
:
:
shemecolorvalAccent1
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oAccent1
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
case
SimpleTypes
:
:
shemecolorvalAccent2
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oAccent2
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
case
SimpleTypes
:
:
shemecolorvalAccent3
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oAccent3
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
case
SimpleTypes
:
:
shemecolorvalAccent4
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oAccent4
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
case
SimpleTypes
:
:
shemecolorvalAccent5
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oAccent5
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
case
SimpleTypes
:
:
shemecolorvalAccent6
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oAccent6
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
case
SimpleTypes
:
:
shemecolorvalFolHlink
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oFolHlink
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
case
SimpleTypes
:
:
shemecolorvalHlink
:
result
=
theme
->
m_oThemeElements
.
m_oClrScheme
.
m_oHlink
.
tryGetRgb
(
ucR
,
ucG
,
ucB
,
ucA
);
break
;
default:
break
;
}
return
result
;
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
CSchemeColor
*
oox_ShemeClr
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
)
{
if
(
!
oox_ShemeClr
)
return
;
int
theme_ind
=
oox_ShemeClr
->
m_oVal
.
GetValue
();
BYTE
ucA
=
0
,
ucG
=
0
,
ucB
=
0
,
ucR
=
0
;
bool
result
=
Parse
(
oParam
,
theme_ind
,
ucA
,
ucG
,
ucB
,
ucR
);
if
(
result
==
true
)
{
oox_ShemeClr
->
SetRGBA
(
ucR
,
ucG
,
ucB
,
ucA
);
oox_ShemeClr
->
GetRGBA
(
ucR
,
ucG
,
ucB
,
ucA
);
nColor
=
RGB
(
ucR
,
ucG
,
ucB
);
if
(
ucA
!=
0xff
)
opacity
=
(
ucA
/
255.
)
*
100.
;
}
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
CColor
*
oox_color
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
)
{
switch
(
oox_color
->
m_eType
)
{
case
OOX
:
:
Drawing
::
colorSheme
:
Parse
(
oParam
,
&
oox_color
->
m_oShemeClr
,
nColor
,
opacity
);
break
;
case
OOX
:
:
Drawing
::
colorHsl
:
Parse
(
oParam
,
&
oox_color
->
m_oHslClr
,
nColor
,
opacity
);
break
;
case
OOX
:
:
Drawing
::
colorPrst
:
Parse
(
oParam
,
&
oox_color
->
m_oPrstClr
,
nColor
,
opacity
);
break
;
case
OOX
:
:
Drawing
::
colorScRgb
:
Parse
(
oParam
,
&
oox_color
->
m_oScrgbClr
,
nColor
,
opacity
);
break
;
case
OOX
:
:
Drawing
::
colorSRgb
:
Parse
(
oParam
,
&
oox_color
->
m_oSrgbClr
,
nColor
,
opacity
);
break
;
case
OOX
:
:
Drawing
::
colorSys
:
Parse
(
oParam
,
&
oox_color
->
m_oSysClr
,
nColor
,
opacity
);
break
;
default:
break
;
}
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
Colors
::
CColorTransform
*
oox_Clr
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
)
{
if
(
!
oox_Clr
)
return
;
BYTE
ucA
=
0
,
ucG
=
0
,
ucB
=
0
,
ucR
=
0
;
oox_Clr
->
GetRGBA
(
ucR
,
ucG
,
ucB
,
ucA
);
nColor
=
RGB
(
ucR
,
ucG
,
ucB
);
if
(
ucA
!=
255
)
opacity
=
(
ucA
/
255.
)
*
100.
;
}
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
CSolidColorFillProperties
*
oox_solid_fill
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
)
//void OOXShapeReader::Parse(ReaderParameter oParam, OOX::Drawing::Colors::CColorTransform *oox_Clr, unsigned int & nColor, _CP_OPT(double) &opacity)
//{
// if (!oox_Clr)return;
// BYTE ucA=0, ucG=0, ucB=0, ucR =0;
// oox_Clr->GetRGBA(ucR, ucG, ucB, ucA);
//
// nColor = RGB(ucR, ucG, ucB);
// if (ucA !=255)opacity = (ucA/255.)* 100.;
//}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
PPTX
::
Logic
::
SolidFill
*
oox_solid_fill
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
)
{
{
if
(
!
oox_solid_fill
)
return
;
if
(
!
oox_solid_fill
)
return
;
switch
(
oox_solid_fill
->
m_eType
)
Parse
(
oParam
,
oox_solid_fill
->
Color
.
Color
.
operator
->
(),
nColor
,
opacity
);
{
//switch( oox_solid_fill->m_eType )
case
OOX
:
:
Drawing
::
colorSheme
:
Parse
(
oParam
,
&
oox_solid_fill
->
m_oShemeClr
,
nColor
,
opacity
);
break
;
//{
case
OOX
:
:
Drawing
::
colorHsl
:
Parse
(
oParam
,
&
oox_solid_fill
->
m_oHslClr
,
nColor
,
opacity
);
break
;
// case OOX::Drawing::colorSheme: Parse(oParam, &oox_solid_fill->m_oShemeClr, nColor, opacity); break;
case
OOX
:
:
Drawing
::
colorPrst
:
Parse
(
oParam
,
&
oox_solid_fill
->
m_oPrstClr
,
nColor
,
opacity
);
break
;
// case OOX::Drawing::colorHsl: Parse(oParam, &oox_solid_fill->m_oHslClr, nColor, opacity); break;
case
OOX
:
:
Drawing
::
colorScRgb
:
Parse
(
oParam
,
&
oox_solid_fill
->
m_oScrgbClr
,
nColor
,
opacity
);
break
;
// case OOX::Drawing::colorPrst: Parse(oParam, &oox_solid_fill->m_oPrstClr, nColor, opacity); break;
case
OOX
:
:
Drawing
::
colorSRgb
:
Parse
(
oParam
,
&
oox_solid_fill
->
m_oSrgbClr
,
nColor
,
opacity
);
break
;
// case OOX::Drawing::colorScRgb: Parse(oParam, &oox_solid_fill->m_oScrgbClr, nColor, opacity); break;
case
OOX
:
:
Drawing
::
colorSys
:
Parse
(
oParam
,
&
oox_solid_fill
->
m_oSysClr
,
nColor
,
opacity
);
break
;
// case OOX::Drawing::colorSRgb: Parse(oParam, &oox_solid_fill->m_oSrgbClr, nColor, opacity); break;
default:
break
;
// case OOX::Drawing::colorSys: Parse(oParam, &oox_solid_fill->m_oSysClr, nColor, opacity); break;
}
// default: break;
// }
}
}
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CSolidColorFillProperties
*
oox_solid_fill
,
std
::
wstring
*
change_sheme_color
)
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
SolidFill
*
oox_solid_fill
,
std
::
wstring
*
change_sheme_color
)
{
{
if
(
!
oox_solid_fill
)
return
;
if
(
!
oox_solid_fill
)
return
;
unsigned
int
nColor
=
0xffffff
;
//white
unsigned
int
nColor
=
0xffffff
;
//white
_CP_OPT
(
double
)
opacity
;
_CP_OPT
(
double
)
opacity
;
if
(
change_sheme_color
&&
oox_solid_fill
->
m_eType
==
OOX
::
Drawing
::
colorSheme
)
if
(
change_sheme_color
&&
oox_solid_fill
->
Color
.
getType
()
==
OOX
::
et_a_schemeClr
)
oox_solid_fill
->
m_oShemeClr
.
m_oVal
.
FromString
(
*
change_sheme_color
);
{
//oox_solid_fill->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
}
Parse
(
oParam
,
oox_solid_fill
,
nColor
,
opacity
);
Parse
(
oParam
,
oox_solid_fill
,
nColor
,
opacity
);
...
@@ -697,7 +709,7 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -697,7 +709,7 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
pOutput
->
m_nFillOpacity
=
*
opacity
;
pOutput
->
m_nFillOpacity
=
*
opacity
;
}
}
}
}
bool
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CBlipFillProperties
*
oox_bitmap_fill
)
bool
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
BlipFill
*
oox_bitmap_fill
)
{
{
if
(
oox_bitmap_fill
==
NULL
)
return
false
;
if
(
oox_bitmap_fill
==
NULL
)
return
false
;
...
@@ -706,12 +718,13 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -706,12 +718,13 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
bool
result
=
false
;
bool
result
=
false
;
if
(
oox_bitmap_fill
->
m_oB
lip
.
IsInit
())
if
(
oox_bitmap_fill
->
b
lip
.
IsInit
())
{
{
std
::
wstring
sID
=
oox_bitmap_fill
->
m_oBlip
->
m_oEmbed
.
GetValue
()
;
std
::
wstring
sID
;
if
(
oParam
.
oReader
->
m_currentContainer
)
if
(
o
ox_bitmap_fill
->
blip
->
embed
.
IsInit
()
&&
o
Param
.
oReader
->
m_currentContainer
)
{
{
sID
=
oox_bitmap_fill
->
blip
->
embed
->
get
();
smart_ptr
<
OOX
::
File
>
oFile
=
oParam
.
oReader
->
m_currentContainer
->
Find
(
sID
);
smart_ptr
<
OOX
::
File
>
oFile
=
oParam
.
oReader
->
m_currentContainer
->
Find
(
sID
);
if
(
oFile
.
IsInit
()
&&
(
OOX
::
FileTypes
::
Image
==
oFile
->
type
()))
if
(
oFile
.
IsInit
()
&&
(
OOX
::
FileTypes
::
Image
==
oFile
->
type
()))
...
@@ -722,27 +735,27 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -722,27 +735,27 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
result
=
WriteDataToPicture
(
sImagePath
,
*
pOutput
->
m_oPicture
,
oParam
.
oReader
->
m_sPath
);
result
=
WriteDataToPicture
(
sImagePath
,
*
pOutput
->
m_oPicture
,
oParam
.
oReader
->
m_sPath
);
}
}
}
}
else
else
if
(
oox_bitmap_fill
->
blip
->
link
.
IsInit
())
{
{
sID
=
oox_bitmap_fill
->
m_oBlip
->
m_oLink
.
GetValue
();
sID
=
oox_bitmap_fill
->
blip
->
link
->
get
();
//...
//...
}
}
//for (size_t i = 0 ; i < oox_bitmap_fill->m_oBlip->m_arrEffects.size(); i++)
//for (size_t i = 0 ; i < oox_bitmap_fill->m_oBlip->m_arrEffects.size(); i++)
// convert(oox_bitmap_fill->m_oBlip->m_arrEffects[i]);
// convert(oox_bitmap_fill->m_oBlip->m_arrEffects[i]);
}
}
if
(
oox_bitmap_fill
->
m_oS
rcRect
.
IsInit
())
//часть изображения
if
(
oox_bitmap_fill
->
s
rcRect
.
IsInit
())
//часть изображения
{
{
int
nCropedWidthGoal
=
pOutput
->
m_oPicture
->
m_nWidthGoal
;
int
nCropedWidthGoal
=
pOutput
->
m_oPicture
->
m_nWidthGoal
;
if
(
PROP_DEF
!=
nCropedWidthGoal
)
if
(
PROP_DEF
!=
nCropedWidthGoal
)
{
{
//делаем crop
//делаем crop
double
nCropLeft
=
oox_bitmap_fill
->
m_oSrcRect
->
m_oL
.
GetValue
(
)
/
100.
;
double
nCropLeft
=
XmlUtils
::
GetInteger
(
oox_bitmap_fill
->
srcRect
->
l
.
get
()
)
/
100.
;
//pOutput->m_oPicture->m_nCropL = nCropLeft * pOutput->m_oPicture->m_nWidthGoal * pOutput->m_oPicture->m_nScaleX / 100;
//pOutput->m_oPicture->m_nCropL = nCropLeft * pOutput->m_oPicture->m_nWidthGoal * pOutput->m_oPicture->m_nScaleX / 100;
pOutput
->
m_oPicture
->
m_nCropL
=
(
int
)(
nCropLeft
*
pOutput
->
m_oPicture
->
m_nWidthGoal
);
pOutput
->
m_oPicture
->
m_nCropL
=
(
int
)(
nCropLeft
*
pOutput
->
m_oPicture
->
m_nWidthGoal
);
pOutput
->
m_nCropFromLeft
=
(
int
)(
nCropLeft
*
65536
);
pOutput
->
m_nCropFromLeft
=
(
int
)(
nCropLeft
*
65536
);
nCropedWidthGoal
-=
pOutput
->
m_oPicture
->
m_nCropL
;
nCropedWidthGoal
-=
pOutput
->
m_oPicture
->
m_nCropL
;
double
nCropRight
=
oox_bitmap_fill
->
m_oSrcRect
->
m_oR
.
GetValue
(
)
/
100.
;
double
nCropRight
=
XmlUtils
::
GetInteger
(
oox_bitmap_fill
->
srcRect
->
r
.
get
()
)
/
100.
;
//pOutput->m_oPicture->m_nCropR = nCropRight * pOutput->m_oPicture->m_nWidthGoal * pOutput->m_oPicture->m_nScaleX / 100;
//pOutput->m_oPicture->m_nCropR = nCropRight * pOutput->m_oPicture->m_nWidthGoal * pOutput->m_oPicture->m_nScaleX / 100;
pOutput
->
m_oPicture
->
m_nCropR
=
(
int
)(
nCropRight
*
pOutput
->
m_oPicture
->
m_nWidthGoal
);
pOutput
->
m_oPicture
->
m_nCropR
=
(
int
)(
nCropRight
*
pOutput
->
m_oPicture
->
m_nWidthGoal
);
pOutput
->
m_nCropFromRight
=
(
int
)(
nCropRight
*
65536
);
pOutput
->
m_nCropFromRight
=
(
int
)(
nCropRight
*
65536
);
...
@@ -751,13 +764,13 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -751,13 +764,13 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
int
nCropedHeightGoal
=
pOutput
->
m_oPicture
->
m_nHeightGoal
;
int
nCropedHeightGoal
=
pOutput
->
m_oPicture
->
m_nHeightGoal
;
if
(
PROP_DEF
!=
nCropedHeightGoal
)
if
(
PROP_DEF
!=
nCropedHeightGoal
)
{
{
double
nCropTop
=
oox_bitmap_fill
->
m_oSrcRect
->
m_oT
.
GetValue
(
)
/
100.
;
double
nCropTop
=
XmlUtils
::
GetInteger
(
oox_bitmap_fill
->
srcRect
->
t
.
get
()
)
/
100.
;
//pOutput->m_oPicture->m_nCropT = nCropTop * pOutput->m_oPicture->m_nHeightGoal * pOutput->m_oPicture->m_dScaleY / 100;
//pOutput->m_oPicture->m_nCropT = nCropTop * pOutput->m_oPicture->m_nHeightGoal * pOutput->m_oPicture->m_dScaleY / 100;
pOutput
->
m_oPicture
->
m_nCropT
=
(
int
)(
nCropTop
*
pOutput
->
m_oPicture
->
m_nHeightGoal
);
pOutput
->
m_oPicture
->
m_nCropT
=
(
int
)(
nCropTop
*
pOutput
->
m_oPicture
->
m_nHeightGoal
);
pOutput
->
m_nCropFromTop
=
(
int
)(
nCropTop
*
65536
);
pOutput
->
m_nCropFromTop
=
(
int
)(
nCropTop
*
65536
);
nCropedHeightGoal
-=
pOutput
->
m_oPicture
->
m_nCropT
;
nCropedHeightGoal
-=
pOutput
->
m_oPicture
->
m_nCropT
;
double
nCropBottom
=
oox_bitmap_fill
->
m_oSrcRect
->
m_oB
.
GetValue
(
)
/
100.
;
double
nCropBottom
=
XmlUtils
::
GetInteger
(
oox_bitmap_fill
->
srcRect
->
b
.
get
()
)
/
100.
;
//pOutput->m_oPicture->m_nCropT = nCropTop * pOutput->m_oPicture->m_nHeightGoal * pOutput->m_oPicture->m_dScaleY / 100;
//pOutput->m_oPicture->m_nCropT = nCropTop * pOutput->m_oPicture->m_nHeightGoal * pOutput->m_oPicture->m_dScaleY / 100;
pOutput
->
m_oPicture
->
m_nCropB
=
(
int
)(
nCropBottom
*
pOutput
->
m_oPicture
->
m_nHeightGoal
);
pOutput
->
m_oPicture
->
m_nCropB
=
(
int
)(
nCropBottom
*
pOutput
->
m_oPicture
->
m_nHeightGoal
);
pOutput
->
m_nCropFromBottom
=
(
int
)(
nCropBottom
*
65536
);
pOutput
->
m_nCropFromBottom
=
(
int
)(
nCropBottom
*
65536
);
...
@@ -784,31 +797,31 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -784,31 +797,31 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
//pOutput->m_oPicture->m_nCropB = (int)(oox_bitmap_fill->m_oSrcRect->m_oB.GetValue() / 10. * h) ;
//pOutput->m_oPicture->m_nCropB = (int)(oox_bitmap_fill->m_oSrcRect->m_oB.GetValue() / 10. * h) ;
}
}
pOutput
->
m_nFillType
=
3
;
pOutput
->
m_nFillType
=
3
;
if
(
oox_bitmap_fill
->
m_oT
ile
.
IsInit
())
if
(
oox_bitmap_fill
->
t
ile
.
IsInit
())
{
{
pOutput
->
m_nFillType
=
2
;
pOutput
->
m_nFillType
=
2
;
}
}
if
(
oox_bitmap_fill
->
m_oS
tretch
.
IsInit
())
if
(
oox_bitmap_fill
->
s
tretch
.
IsInit
())
{
{
pOutput
->
m_nFillType
=
3
;
pOutput
->
m_nFillType
=
3
;
}
}
return
result
;
return
result
;
}
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CGradientFillProperties
*
oox_grad_fill
,
std
::
wstring
*
change_sheme_color
)
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
GradFill
*
oox_grad_fill
,
std
::
wstring
*
change_sheme_color
)
{
{
if
(
!
oox_grad_fill
)
return
;
if
(
!
oox_grad_fill
)
return
;
pOutput
->
m_nFillType
=
4
;
pOutput
->
m_nFillType
=
4
;
pOutput
->
m_nFillFocus
=
100
;
pOutput
->
m_nFillFocus
=
100
;
if
(
oox_grad_fill
->
m_eGradType
==
OOX
::
Drawing
::
gradfilltypeLinear
&&
oox_grad_fill
->
m_oLin
->
m_oA
ng
.
IsInit
())
if
(
oox_grad_fill
->
lin
.
IsInit
()
&&
oox_grad_fill
->
lin
->
a
ng
.
IsInit
())
{
{
pOutput
->
m_nFillAngle
=
oox_grad_fill
->
m_oLin
->
m_oAng
->
GetAngle
();
pOutput
->
m_nFillAngle
=
oox_grad_fill
->
lin
->
ang
.
get
();
}
}
if
(
oox_grad_fill
->
m_eGradType
==
OOX
::
Drawing
::
gradfilltypePath
&&
oox_grad_fill
->
m_oPath
->
m_oP
ath
.
IsInit
())
if
(
oox_grad_fill
->
p
ath
.
IsInit
())
{
{
switch
(
oox_grad_fill
->
m_oPath
->
m_oPath
->
GetValu
e
())
switch
(
oox_grad_fill
->
path
->
path
->
GetBYTECod
e
())
{
{
case
SimpleTypes
:
:
pathshadetypeCircle
:
case
SimpleTypes
:
:
pathshadetypeCircle
:
pOutput
->
m_nFillFocus
=
50
;
pOutput
->
m_nFillFocus
=
50
;
...
@@ -817,35 +830,35 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -817,35 +830,35 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
case
SimpleTypes
:
:
pathshadetypeRect
:
pOutput
->
m_nFillType
=
4
;
break
;
case
SimpleTypes
:
:
pathshadetypeRect
:
pOutput
->
m_nFillType
=
4
;
break
;
case
SimpleTypes
:
:
pathshadetypeShape
:
pOutput
->
m_nFillType
=
6
;
break
;
case
SimpleTypes
:
:
pathshadetypeShape
:
pOutput
->
m_nFillType
=
6
;
break
;
}
}
if
(
oox_grad_fill
->
m_oPath
->
m_oFillToR
ect
.
IsInit
())
if
(
oox_grad_fill
->
path
->
r
ect
.
IsInit
())
{
{
pOutput
->
m_nFillToBottom
=
(
int
)
oox_grad_fill
->
m_oPath
->
m_oFillToRect
->
m_oB
.
GetValue
(
);
pOutput
->
m_nFillToBottom
=
XmlUtils
::
GetInteger
(
oox_grad_fill
->
path
->
rect
->
b
.
get
()
);
pOutput
->
m_nFillToTop
=
(
int
)
oox_grad_fill
->
m_oPath
->
m_oFillToRect
->
m_oT
.
GetValue
(
);
pOutput
->
m_nFillToTop
=
XmlUtils
::
GetInteger
(
oox_grad_fill
->
path
->
rect
->
t
.
get
()
);
pOutput
->
m_nFillToRight
=
(
int
)
oox_grad_fill
->
m_oPath
->
m_oFillToRect
->
m_oR
.
GetValue
(
);
pOutput
->
m_nFillToRight
=
XmlUtils
::
GetInteger
(
oox_grad_fill
->
path
->
rect
->
r
.
get
()
);
pOutput
->
m_nFillToLeft
=
(
int
)
oox_grad_fill
->
m_oPath
->
m_oFillToRect
->
m_oL
.
GetValue
(
);
pOutput
->
m_nFillToLeft
=
XmlUtils
::
GetInteger
(
oox_grad_fill
->
path
->
rect
->
l
.
get
()
);
}
}
}
}
if
(
oox_grad_fill
->
m_oGsLst
.
IsInit
()
&&
oox_grad_fill
->
m_oGsLst
->
m_arrGs
.
size
()
>
1
&&
oox_grad_fill
->
m_oGsLst
->
m_arrGs
[
0
]
)
if
(
oox_grad_fill
->
GsLst
.
size
()
>
1
)
{
{
bool
bColorsSet
=
false
;
bool
bColorsSet
=
false
;
if
(
oox_grad_fill
->
m_oGsLst
->
m_arrGs
.
size
()
>
2
)
if
(
oox_grad_fill
->
GsLst
.
size
()
>
2
)
{
{
pOutput
->
m_nFillType
=
7
;
pOutput
->
m_nFillType
=
7
;
pOutput
->
m_nFillShadeType
=
0
;
pOutput
->
m_nFillShadeType
=
0
;
bColorsSet
=
true
;
bColorsSet
=
true
;
}
}
for
(
size_t
i
=
0
;
i
<
oox_grad_fill
->
m_oGsLst
->
m_arrGs
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
oox_grad_fill
->
GsLst
.
size
();
i
++
)
{
{
unsigned
int
hexColor
;
unsigned
int
hexColor
;
_CP_OPT
(
double
)
opacity
;
_CP_OPT
(
double
)
opacity
;
if
(
change_sheme_color
&&
oox_grad_fill
->
m_oGsLst
->
m_arrGs
[
i
]
->
m_eType
==
OOX
::
Drawing
::
colorSheme
)
if
(
change_sheme_color
&&
oox_grad_fill
->
GsLst
[
i
].
color
.
getType
()
==
OOX
::
et_a_schemeClr
)
{
{
oox_grad_fill
->
m_oGsLst
->
m_arrGs
[
i
]
->
m_oShemeClr
.
m_oVal
.
FromString
(
*
change_sheme_color
);
//oox_grad_fill->GsLst
[i]->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
}
}
Parse
(
oParam
,
(
OOX
::
Drawing
::
CColor
*
)(
oox_grad_fill
->
m_oGsLst
->
m_arrGs
[
i
]
),
hexColor
,
opacity
);
Parse
(
oParam
,
oox_grad_fill
->
GsLst
[
i
].
color
.
Color
.
operator
->
(
),
hexColor
,
opacity
);
if
(
i
==
0
)
if
(
i
==
0
)
{
{
...
@@ -853,7 +866,7 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -853,7 +866,7 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
if
(
opacity
)
if
(
opacity
)
pOutput
->
m_nFillOpacity
=
(
int
)(
*
opacity
*
100
);
pOutput
->
m_nFillOpacity
=
(
int
)(
*
opacity
*
100
);
}
}
else
if
(
i
==
oox_grad_fill
->
m_oGsLst
->
m_arrGs
.
size
()
-
1
&&
i
>
0
)
else
if
(
i
==
oox_grad_fill
->
GsLst
.
size
()
-
1
&&
i
>
0
)
{
{
pOutput
->
m_nFillColor2
=
hexColor
;
pOutput
->
m_nFillColor2
=
hexColor
;
if
(
opacity
)
if
(
opacity
)
...
@@ -862,69 +875,65 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -862,69 +875,65 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
if
(
bColorsSet
)
if
(
bColorsSet
)
{
{
pOutput
->
m_aFillShadeColors
.
push_back
(
std
::
make_pair
((
int
)
hexColor
,
oox_grad_fill
->
m_oGsLst
->
m_arrGs
[
i
]
->
m_oPos
.
GetValue
()
));
pOutput
->
m_aFillShadeColors
.
push_back
(
std
::
make_pair
((
int
)
hexColor
,
oox_grad_fill
->
GsLst
[
i
].
pos
));
}
}
}
}
}
}
}
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CPatternFillProperties
*
oox_pattern_fill
,
std
::
wstring
*
change_sheme_color
)
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
PattFill
*
oox_pattern_fill
,
std
::
wstring
*
change_sheme_color
)
{
{
if
(
!
oox_pattern_fill
)
return
;
if
(
!
oox_pattern_fill
)
return
;
}
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CLineProperties
*
oox_line_prop
,
std
::
wstring
*
change_sheme_color
)
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
Ln
*
oox_line_prop
,
std
::
wstring
*
change_sheme_color
)
{
{
if
(
!
oox_line_prop
)
return
;
if
(
!
oox_line_prop
)
return
;
pOutput
->
m_bLine
=
true
;
pOutput
->
m_bLine
=
true
;
switch
(
oox_line_prop
->
m_eFillType
)
if
(
oox_line_prop
->
Fill
.
is_init
()
)
{
{
case
OOX
:
:
Drawing
::
filltypePattern
:
NSCommon
::
smart_ptr
<
PPTX
::
Logic
::
SolidFill
>
fill
=
oox_line_prop
->
Fill
.
Fill
.
smart_dynamic_cast
<
PPTX
::
Logic
::
SolidFill
>
();
case
OOX
:
:
Drawing
::
filltypeGradient
:
NSCommon
::
smart_ptr
<
PPTX
::
Logic
::
NoFill
>
no_fill
=
oox_line_prop
->
Fill
.
Fill
.
smart_dynamic_cast
<
PPTX
::
Logic
::
NoFill
>
();
case
OOX
:
:
Drawing
::
filltypeGroup
:
if
(
fill
.
IsInit
())
break
;
case
OOX
:
:
Drawing
::
filltypeSolid
:
{
{
if
(
change_sheme_color
&&
oox_line_prop
->
m_oSolidFill
->
m_eType
==
OOX
::
Drawing
::
colorSheme
)
if
(
change_sheme_color
&&
fill
->
Color
.
getType
()
==
OOX
::
et_a_schemeClr
)
oox_line_prop
->
m_oSolidFill
->
m_oShemeClr
.
m_oVal
.
FromString
(
*
change_sheme_color
);
{
//fill->Color.FromString(*change_sheme_color);
}
unsigned
int
nColor
=
0
;
//black
unsigned
int
nColor
=
0
;
//black
_CP_OPT
(
double
)
opacity
;
_CP_OPT
(
double
)
opacity
;
Parse
(
oParam
,
oox_line_prop
->
m_oSolidFill
.
GetPointer
(),
nColor
,
opacity
);
Parse
(
oParam
,
fill
.
operator
->
(),
nColor
,
opacity
);
pOutput
->
m_nLineColor
=
nColor
;
pOutput
->
m_nLineColor
=
nColor
;
}
break
;
}
case
OOX
:
:
Drawing
::
filltypeNo
:
else
if
(
no_fill
.
IsInit
())
pOutput
->
m_bLine
=
false
;
break
;
{
default:
break
;
pOutput
->
m_bLine
=
false
;
}
}
if
(
oox_line_prop
->
m_oW
.
IsInit
())
{
pOutput
->
m_nLineWidth
=
oox_line_prop
->
m_oW
->
ToPoints
()
*
12700
;
}
}
if
(
oox_line_prop
->
m_oHeadEnd
.
IsInit
())
if
(
oox_line_prop
->
w
.
IsInit
())
{
{
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oLen
.
IsInit
())
pOutput
->
m_nLineEndArrowLength
=
oox_line_prop
->
m_oHeadEnd
->
m_oLen
->
GetValue
();
pOutput
->
m_nLineWidth
=
oox_line_prop
->
w
.
get
()
*
12700
;
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oType
.
IsInit
())
pOutput
->
m_nLineEndArrow
=
oox_line_prop
->
m_oHeadEnd
->
m_oType
->
GetValue
();
if
(
oox_line_prop
->
m_oHeadEnd
->
m_oW
.
IsInit
())
pOutput
->
m_nLineEndArrowWidth
=
oox_line_prop
->
m_oHeadEnd
->
m_oW
->
GetValue
();
}
}
if
(
oox_line_prop
->
m_oTail
End
.
IsInit
())
if
(
oox_line_prop
->
head
End
.
IsInit
())
{
{
if
(
oox_line_prop
->
m_oTailEnd
->
m_oLen
.
IsInit
())
pOutput
->
m_nLineStartArrowLength
=
oox_line_prop
->
m_oTailEnd
->
m_oLen
->
GetValu
e
();
if
(
oox_line_prop
->
headEnd
->
len
.
IsInit
())
pOutput
->
m_nLineEndArrowLength
=
oox_line_prop
->
headEnd
->
len
->
GetBYTECod
e
();
if
(
oox_line_prop
->
m_oTailEnd
->
m_oType
.
IsInit
())
pOutput
->
m_nLineStartArrow
=
oox_line_prop
->
m_oTailEnd
->
m_oType
->
GetValu
e
();
if
(
oox_line_prop
->
headEnd
->
type
.
IsInit
())
pOutput
->
m_nLineEndArrow
=
oox_line_prop
->
headEnd
->
type
->
GetBYTECod
e
();
if
(
oox_line_prop
->
m_oTailEnd
->
m_oW
.
IsInit
())
pOutput
->
m_nLineStartArrowWidth
=
oox_line_prop
->
m_oTailEnd
->
m_oW
->
GetValu
e
();
if
(
oox_line_prop
->
headEnd
->
w
.
IsInit
())
pOutput
->
m_nLineEndArrowWidth
=
oox_line_prop
->
headEnd
->
w
->
GetBYTECod
e
();
}
}
if
(
oox_line_prop
->
tailEnd
.
IsInit
())
if
(
oox_line_prop
->
m_oCustDash
.
IsInit
())
{
{
//через задание стиля и описание геометрии
if
(
oox_line_prop
->
tailEnd
->
len
.
IsInit
())
pOutput
->
m_nLineStartArrowLength
=
oox_line_prop
->
tailEnd
->
len
->
GetBYTECode
();
if
(
oox_line_prop
->
tailEnd
->
type
.
IsInit
())
pOutput
->
m_nLineStartArrow
=
oox_line_prop
->
tailEnd
->
type
->
GetBYTECode
();
if
(
oox_line_prop
->
tailEnd
->
w
.
IsInit
())
pOutput
->
m_nLineStartArrowWidth
=
oox_line_prop
->
tailEnd
->
w
->
GetBYTECode
();
}
}
if
(
oox_line_prop
->
m_oPrstDash
.
IsInit
()
&&
oox_line_prop
->
m_oPrstDash
->
m_oVal
.
IsInit
())
if
(
oox_line_prop
->
prstDash
.
IsInit
()
&&
oox_line_prop
->
prstDash
->
val
.
IsInit
())
{
{
switch
(
oox_line_prop
->
m_oPrstDash
->
m_oVal
->
GetValu
e
())
switch
(
oox_line_prop
->
prstDash
->
val
->
GetBYTECod
e
())
{
{
case
SimpleTypes
:
:
presetlinedashvalDash
:
pOutput
->
m_nLineDashing
=
6
;
break
;
case
SimpleTypes
:
:
presetlinedashvalDash
:
pOutput
->
m_nLineDashing
=
6
;
break
;
case
SimpleTypes
:
:
presetlinedashvalDashDot
:
pOutput
->
m_nLineDashing
=
8
;
break
;
case
SimpleTypes
:
:
presetlinedashvalDashDot
:
pOutput
->
m_nLineDashing
=
8
;
break
;
...
@@ -950,61 +959,37 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
...
@@ -950,61 +959,37 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, OOX::Dr
//nullable<OOX::Drawing::CLineJoinMiterProperties> m_oMiter;
//nullable<OOX::Drawing::CLineJoinMiterProperties> m_oMiter;
//nullable<OOX::Drawing::CLineJoinRound> m_oRound;
//nullable<OOX::Drawing::CLineJoinRound> m_oRound;
}
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CStyleMatrixReference
*
style_matrix_ref
)
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
StyleRef
*
style_ref
,
int
type
)
{
{
if
(
!
style_matrix_ref
)
return
;
if
(
!
style_ref
)
return
;
if
(
style_ref
->
idx
.
IsInit
()
==
false
)
return
;
int
fmt_index
=
style_
matrix_ref
->
m_oIdx
.
GetValue
()
-
1
;
int
fmt_index
=
style_
ref
->
idx
.
get
()
-
1
;
OOX
::
C
Theme
*
theme
=
oParam
.
oDocx
->
GetTheme
();
PPTX
::
Theme
*
theme
=
oParam
.
oDocx
->
GetTheme
();
if
(
!
theme
||
fmt_index
<
0
)
return
;
if
(
!
theme
||
fmt_index
<
0
)
return
;
std
::
wstring
color
=
style_matrix_ref
->
m_oShemeClr
.
m_oVal
.
ToString
();
PPTX
::
Logic
::
SchemeClr
&
schemeClr
=
style_ref
->
Color
.
as
<
PPTX
::
Logic
::
SchemeClr
>
();
std
::
wstring
color
=
schemeClr
.
val
.
get
();
if
(
style_matrix_ref
->
getType
()
==
OOX
::
et_a_fillRef
)
if
(
type
==
1
)
{
{
if
(
fmt_index
<
1000
&&
fmt_index
<
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oFillStyleLst
.
m_arrItems
.
size
())
if
(
fmt_index
<
1000
&&
fmt_index
<
theme
->
themeElements
.
fmtScheme
.
fillStyleLst
.
size
())
{
{
switch
(
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oFillStyleLst
.
m_arrItems
[
fmt_index
]
->
getType
())
Parse
(
oParam
,
pOutput
,
&
theme
->
themeElements
.
fmtScheme
.
fillStyleLst
[
fmt_index
],
&
color
);
{
case
OOX
:
:
et_a_blipFill
:
Parse
(
oParam
,
pOutput
,
(
OOX
::
Drawing
::
CBlipFillProperties
*
)
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oFillStyleLst
.
m_arrItems
[
fmt_index
]
/*, &color*/
);
break
;
case
OOX
:
:
et_a_gradFill
:
Parse
(
oParam
,
pOutput
,
(
OOX
::
Drawing
::
CGradientFillProperties
*
)
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oFillStyleLst
.
m_arrItems
[
fmt_index
],
&
color
);
break
;
case
OOX
:
:
et_a_pattFill
:
Parse
(
oParam
,
pOutput
,
(
OOX
::
Drawing
::
CPatternFillProperties
*
)
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oFillStyleLst
.
m_arrItems
[
fmt_index
],
&
color
);
break
;
case
OOX
:
:
et_a_solidFill
:
Parse
(
oParam
,
pOutput
,
(
OOX
::
Drawing
::
CSolidColorFillProperties
*
)
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oFillStyleLst
.
m_arrItems
[
fmt_index
],
&
color
);
break
;
case
OOX
:
:
Drawing
::
filltypeNo
:
pOutput
->
m_bFilled
=
false
;
break
;
default:
break
;
}
}
}
else
if
(
fmt_index
>
1000
&&
((
fmt_index
-
1000
)
<
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oBgFillStyleLst
.
m_arrItems
.
size
()))
else
if
(
fmt_index
>
1000
&&
((
fmt_index
-
1000
)
<
theme
->
themeElements
.
fmtScheme
.
bgFillStyleLst
.
size
()))
{
{
fmt_index
-=
1000
;
fmt_index
-=
1000
;
switch
(
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oBgFillStyleLst
.
m_arrItems
[
fmt_index
]
->
getType
())
{
Parse
(
oParam
,
pOutput
,
&
theme
->
themeElements
.
fmtScheme
.
bgFillStyleLst
[
fmt_index
],
&
color
);
case
OOX
:
:
et_a_blipFill
:
Parse
(
oParam
,
pOutput
,
(
OOX
::
Drawing
::
CBlipFillProperties
*
)
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oBgFillStyleLst
.
m_arrItems
[
fmt_index
]
/*, &color*/
);
break
;
case
OOX
:
:
et_a_gradFill
:
Parse
(
oParam
,
pOutput
,
(
OOX
::
Drawing
::
CGradientFillProperties
*
)
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oBgFillStyleLst
.
m_arrItems
[
fmt_index
],
&
color
);
break
;
case
OOX
:
:
et_a_pattFill
:
Parse
(
oParam
,
pOutput
,
(
OOX
::
Drawing
::
CPatternFillProperties
*
)
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oBgFillStyleLst
.
m_arrItems
[
fmt_index
],
&
color
);
break
;
case
OOX
:
:
et_a_solidFill
:
Parse
(
oParam
,
pOutput
,
(
OOX
::
Drawing
::
CSolidColorFillProperties
*
)
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oBgFillStyleLst
.
m_arrItems
[
fmt_index
],
&
color
);
break
;
case
OOX
:
:
Drawing
::
filltypeNo
:
pOutput
->
m_bFilled
=
false
;
break
;
default:
break
;
}
}
}
}
}
if
(
style_matrix_ref
->
getType
()
==
OOX
::
et_a_lnRef
&&
fmt_index
<
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oLineStyleLst
.
m_arrLn
.
size
())
if
(
type
==
2
&&
fmt_index
<
theme
->
themeElements
.
fmtScheme
.
lnStyleLst
.
size
())
{
{
Parse
(
oParam
,
pOutput
,
theme
->
m_oThemeElements
.
m_oFmtScheme
.
m_oLineStyleLst
.
m_arrLn
[
fmt_index
],
&
color
);
Parse
(
oParam
,
pOutput
,
&
theme
->
themeElements
.
fmtScheme
.
lnStyleLst
[
fmt_index
],
&
color
);
}
}
//if (style_matrix_ref->getType() == OOX::et_a_effectRef && fmt_index < theme->m_oThemeElements.m_oFmtScheme.m_oEffectStyleLst.m_arrEffectStyle.size())
//if (style_matrix_ref->getType() == OOX::et_a_effectRef && fmt_index < theme->m_oThemeElements.m_oFmtScheme.m_oEffectStyleLst.m_arrEffectStyle.size())
...
@@ -1029,15 +1014,23 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
...
@@ -1029,15 +1014,23 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
if
(
m_vmlElement
||
m_arrElement
)
return
ParseVml
(
oParam
,
pOutput
);
if
(
m_vmlElement
||
m_arrElement
)
return
ParseVml
(
oParam
,
pOutput
);
if
(
m_ooxShape
->
m_oSpPr
.
IsInit
()
==
false
)
return
false
;
PPTX
::
Logic
::
Shape
*
ooxShape
=
dynamic_cast
<
PPTX
::
Logic
::
Shape
*>
(
m_ooxShape
);
//PPTX::Logic::CxnSp* cxnShape = dynamic_cast<PPTX::Logic::CxnSp*> (m_ooxShape);
//PPTX::Logic::Pic * ooxPic = dynamic_cast<PPTX::Logic::Pic*> (m_ooxShape);
if
(
ooxShape
==
NULL
)
return
false
;
if
(
m_ooxShape
->
m_oTxBodyProperties
.
IsInit
()
&&
m_ooxShape
->
m_oTxBodyProperties
->
m_oPrstTxWrap
.
IsInit
())
if
(
ooxShape
->
oTextBoxBodyPr
.
IsInit
())
{
{
if
(
m_ooxShape
->
m_oTxBodyProperties
->
m_oFromWordArt
.
ToBool
(
))
if
(
ooxShape
->
oTextBoxBodyPr
->
fromWordArt
.
get_value_or
(
false
))
{
{
pOutput
->
m_bGtext
=
1
;
pOutput
->
m_bGtext
=
1
;
if
(
m_ooxShape
->
m_oTxBodyProperties
->
m_oPrstTxWrap
.
IsInit
())
if
(
ooxShape
->
oTextBoxBodyPr
->
prstTxWarp
.
IsInit
())
pOutput
->
m_nShapeType
=
OOX
::
PrstTx2VmlShapeType
(
m_ooxShape
->
m_oTxBodyProperties
->
m_oPrstTxWrap
->
m_oPrst
.
GetValue
());
{
SimpleTypes
::
ETextShapeType
type
=
(
SimpleTypes
::
ETextShapeType
)
ooxShape
->
oTextBoxBodyPr
->
prstTxWarp
->
prst
.
GetBYTECode
();
pOutput
->
m_nShapeType
=
OOX
::
PrstTx2VmlShapeType
(
type
);
}
else
else
pOutput
->
m_nShapeType
=
SimpleTypes
::
Vml
::
sptTextPlainText
;
pOutput
->
m_nShapeType
=
SimpleTypes
::
Vml
::
sptTextPlainText
;
...
@@ -1047,19 +1040,20 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
...
@@ -1047,19 +1040,20 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
}
}
std
::
wstring
strXml
;
std
::
wstring
strXml
;
if
(
m_ooxShape
->
m_oSpPr
->
m_oCustGeom
.
IsInit
()
)
if
(
ooxShape
->
spPr
.
Geometry
.
getType
()
==
OOX
::
et_a_custGeom
)
{
{
PPTX
::
Logic
::
CustGeom
&
geometry
=
ooxShape
->
spPr
.
Geometry
.
as
<
PPTX
::
Logic
::
CustGeom
>
();
pOutput
->
m_nShapeType
=
SimpleTypes
::
Vml
::
sptNotPrimitive
;
pOutput
->
m_nShapeType
=
SimpleTypes
::
Vml
::
sptNotPrimitive
;
strXml
=
m_ooxShape
->
m_oSpPr
->
m_oCustGeom
->
toXML
();
strXml
=
geometry
.
toXML
();
}
}
if
(
m_ooxShape
->
m_oSpPr
->
m_oPrstGeom
.
IsInit
()
)
if
(
ooxShape
->
spPr
.
Geometry
.
getType
()
==
OOX
::
et_a_prstGeom
)
{
{
OOX
::
Drawing
::
CPresetGeometry2D
*
geometry
=
m_ooxShape
->
m_oSpPr
->
m_oPrstGeom
.
GetPointer
();
PPTX
::
Logic
::
PrstGeom
&
geometry
=
ooxShape
->
spPr
.
Geometry
.
as
<
PPTX
::
Logic
::
PrstGeom
>
();
SimpleTypes
::
EShapeType
type
=
geometry
->
m_oPrst
.
GetValu
e
();
SimpleTypes
::
EShapeType
type
=
(
SimpleTypes
::
EShapeType
)
geometry
.
prst
.
GetBYTECod
e
();
pOutput
->
m_nShapeType
=
OOX
::
PrstGeom2VmlShapeType
(
type
);
pOutput
->
m_nShapeType
=
OOX
::
PrstGeom2VmlShapeType
(
type
);
if
(
pOutput
->
m_nShapeType
==
SimpleTypes
::
Vml
::
sptNotPrimitive
)
if
(
pOutput
->
m_nShapeType
==
SimpleTypes
::
Vml
::
sptNotPrimitive
)
strXml
=
m_ooxShape
->
m_oSpPr
->
m_oPrstGeom
->
toXML
();
strXml
=
geometry
.
prst
.
get
();
}
}
if
(
pOutput
->
m_nShapeType
==
SimpleTypes
::
Vml
::
sptNotPrimitive
&&
!
strXml
.
empty
())
if
(
pOutput
->
m_nShapeType
==
SimpleTypes
::
Vml
::
sptNotPrimitive
&&
!
strXml
.
empty
())
{
{
...
@@ -1071,10 +1065,10 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
...
@@ -1071,10 +1065,10 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
LONG
lW
=
0
,
lH
=
0
;
LONG
lW
=
0
,
lH
=
0
;
//if ((
m_ooxShape->m_oSpPr->m_oXfrm.IsInit()) && (m_ooxShape->m_oSpPr->m_oX
frm->m_oExt.IsInit()))
//if ((
ooxShape->spPr.xfrm->IsInit()) && (ooxShape->spPr.x
frm->m_oExt.IsInit()))
//{
//{
// lW =
m_ooxShape->m_oSpPr->m_oX
frm->m_oExt->m_oCx.GetValue();
// lW =
ooxShape->spPr.x
frm->m_oExt->m_oCx.GetValue();
// lH =
m_ooxShape->m_oSpPr->m_oX
frm->m_oExt->m_oCy.GetValue();
// lH =
ooxShape->spPr.x
frm->m_oExt->m_oCy.GetValue();
//}
//}
COOXToVMLGeometry
*
renderer
=
new
COOXToVMLGeometry
();
COOXToVMLGeometry
*
renderer
=
new
COOXToVMLGeometry
();
...
@@ -1091,31 +1085,31 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
...
@@ -1091,31 +1085,31 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
pOutput
->
m_nGeoRight
=
100000
;
pOutput
->
m_nGeoRight
=
100000
;
pOutput
->
m_nGeoBottom
=
100000
;
pOutput
->
m_nGeoBottom
=
100000
;
}
}
if
(
m_ooxShape
->
m_oSpPr
->
m_oX
frm
.
IsInit
())
if
(
ooxShape
->
spPr
.
x
frm
.
IsInit
())
{
{
double
rot
=
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oRot
.
GetAngle
()
;
double
rot
=
ooxShape
->
spPr
.
xfrm
->
rot
.
get
()
/
60000.
;
if
(
rot
>
0.01
)
if
(
rot
>
0.01
)
pOutput
->
m_nRotation
=
rot
*
65535
;
pOutput
->
m_nRotation
=
rot
*
65535
;
if
(
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oFlipH
.
ToBool
(
))
pOutput
->
m_bFlipH
=
1
;
if
(
ooxShape
->
spPr
.
xfrm
->
flipH
.
get_value_or
(
false
))
pOutput
->
m_bFlipH
=
1
;
if
(
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oFlipV
.
ToBool
(
))
pOutput
->
m_bFlipV
=
1
;
if
(
ooxShape
->
spPr
.
xfrm
->
flipV
.
get_value_or
(
false
))
pOutput
->
m_bFlipV
=
1
;
if
(
pOutput
->
m_bInGroup
)
if
(
pOutput
->
m_bInGroup
)
{
{
if
(
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oOff
.
IsInit
())
if
(
ooxShape
->
spPr
.
xfrm
->
offX
.
IsInit
()
&&
ooxShape
->
spPr
.
xfrm
->
offY
.
IsInit
())
{
{
pOutput
->
m_nRelLeft
=
(
int
)
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oOff
->
m_oX
.
ToEmu
();
pOutput
->
m_nRelLeft
=
(
int
)
ooxShape
->
spPr
.
xfrm
->
offX
.
get
();
pOutput
->
m_nRelTop
=
(
int
)
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oOff
->
m_oY
.
ToEmu
();
pOutput
->
m_nRelTop
=
(
int
)
ooxShape
->
spPr
.
xfrm
->
offY
.
get
();
}
}
else
else
{
{
pOutput
->
m_nRelLeft
=
0
;
pOutput
->
m_nRelLeft
=
0
;
pOutput
->
m_nRelTop
=
0
;
pOutput
->
m_nRelTop
=
0
;
}
}
if
(
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oExt
.
IsInit
())
if
(
ooxShape
->
spPr
.
xfrm
->
extX
.
IsInit
()
&&
ooxShape
->
spPr
.
xfrm
->
extY
.
IsInit
())
{
{
pOutput
->
m_nRelRight
=
(
int
)
pOutput
->
m_nRelLeft
+
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oExt
->
m_oCx
.
GetValue
();
pOutput
->
m_nRelRight
=
(
int
)
pOutput
->
m_nRelLeft
+
ooxShape
->
spPr
.
xfrm
->
offX
.
get
();
pOutput
->
m_nRelBottom
=
(
int
)
pOutput
->
m_nRelTop
+
m_ooxShape
->
m_oSpPr
->
m_oXfrm
->
m_oExt
->
m_oCy
.
GetValue
();
pOutput
->
m_nRelBottom
=
(
int
)
pOutput
->
m_nRelTop
+
ooxShape
->
spPr
.
xfrm
->
offY
.
get
();
}
}
else
else
{
{
...
@@ -1125,60 +1119,49 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
...
@@ -1125,60 +1119,49 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
pOutput
->
m_nRelRotation
=
pOutput
->
m_nRotation
;
pOutput
->
m_nRelRotation
=
pOutput
->
m_nRotation
;
}
}
}
}
OOX
::
Drawing
::
CShapeStyle
*
oox_sp_style
=
m_ooxShape
->
m_oShapeS
tyle
.
GetPointer
();
PPTX
::
Logic
::
ShapeStyle
*
oox_sp_style
=
ooxShape
->
s
tyle
.
GetPointer
();
bool
use_fill_from_style
=
false
;
bool
use_fill_from_style
=
false
;
pOutput
->
m_bFilled
=
true
;
pOutput
->
m_bFilled
=
true
;
switch
(
m_ooxShape
->
m_oSpPr
->
m_eFillType
)
switch
(
ooxShape
->
spPr
.
Fill
.
m_type
)
{
{
case
OOX
:
:
Drawing
::
filltypeBlip
:
Parse
(
oParam
,
pOutput
,
m_ooxShape
->
m_oSpPr
->
m_oBlipFill
.
GetPointer
());
break
;
case
PPTX
:
:
Logic
::
UniFill
::
blipFill
:
case
OOX
:
:
Drawing
::
filltypeGradient
:
Parse
(
oParam
,
pOutput
,
m_ooxShape
->
m_oSpPr
->
m_oGradFill
.
GetPointer
());
break
;
case
PPTX
:
:
Logic
::
UniFill
::
gradFill
:
case
OOX
:
:
Drawing
::
filltypePattern
:
Parse
(
oParam
,
pOutput
,
m_ooxShape
->
m_oSpPr
->
m_oPattFill
.
GetPointer
());
break
;
case
PPTX
:
:
Logic
::
UniFill
::
pattFill
:
case
OOX
:
:
Drawing
::
filltypeSolid
:
Parse
(
oParam
,
pOutput
,
m_ooxShape
->
m_oSpPr
->
m_oSolidFill
.
GetPointer
());
break
;
case
PPTX
:
:
Logic
::
UniFill
::
solidFill
:
case
OOX
:
:
Drawing
::
filltypeGroup
:
Parse
(
oParam
,
pOutput
,
&
ooxShape
->
spPr
.
Fill
);
case
OOX
:
:
Drawing
::
filltypeNo
:
case
PPTX
:
:
Logic
::
UniFill
::
noFill
:
pOutput
->
m_bFilled
=
false
;
break
;
pOutput
->
m_bFilled
=
false
;
break
;
default:
default:
use_fill_from_style
=
true
;
break
;
use_fill_from_style
=
true
;
break
;
}
}
if
((
use_fill_from_style
&&
oox_sp_style
)
&&
(
oox_sp_style
->
m_oFillRef
.
getType
()
==
OOX
::
et_a_fillRef
))
if
((
use_fill_from_style
&&
oox_sp_style
)
&&
(
oox_sp_style
->
fillRef
.
idx
.
IsInit
()
))
{
{
Parse
(
oParam
,
pOutput
,
&
oox_sp_style
->
m_oFillRef
);
Parse
(
oParam
,
pOutput
,
&
oox_sp_style
->
fillRef
,
1
);
}
}
if
((
oox_sp_style
)
&&
(
oox_sp_style
->
m_oLnRef
.
getType
()
==
OOX
::
et_a_lnRef
))
if
((
oox_sp_style
)
&&
(
oox_sp_style
->
lnRef
.
idx
.
IsInit
()
))
{
{
Parse
(
oParam
,
pOutput
,
&
oox_sp_style
->
m_oLnRef
);
Parse
(
oParam
,
pOutput
,
&
oox_sp_style
->
lnRef
,
2
);
}
}
if
(
m_ooxShape
->
m_oSpPr
->
m_oL
n
.
IsInit
())
if
(
ooxShape
->
spPr
.
l
n
.
IsInit
())
{
{
Parse
(
oParam
,
pOutput
,
m_ooxShape
->
m_oSpPr
->
m_oLn
.
GetPointer
());
Parse
(
oParam
,
pOutput
,
ooxShape
->
spPr
.
ln
.
GetPointer
());
}
if
(
m_ooxShape
->
m_oCNvConnSpPr
.
IsInit
())
{
//OoxConverter::Parse(m_ooxShape->m_oCNvConnSpPr.GetPointer());
pOutput
->
m_bFilled
=
false
;
//частенько приплывает из стиля заполенение объекта .. а он то одномерный :)
}
}
OOX
::
Drawing
::
CTextBodyProperties
*
text_properties
=
NULL
;
//---------------------------------------------------------------------
PPTX
::
Logic
::
TxBody
*
text_properties
=
NULL
;
OOXTextItemReader
oTextItemReader
;
OOXTextItemReader
oTextItemReader
;
if
(
m_ooxShape
->
m_oTxBody
.
IsInit
()
&&
m_ooxShape
->
m_oTxBody
->
m_oTxtbxContent
.
IsInit
())
if
(
ooxShape
->
txBody
.
IsInit
())
{
{
for
(
size_t
i
=
0
;
i
<
m_ooxShape
->
m_oTxBody
->
m_oTxtbxContent
->
m_arrItem
s
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
ooxShape
->
txBody
->
Paragr
s
.
size
();
i
++
)
{
{
oTextItemReader
.
Parse
(
m_ooxShape
->
m_oTxBody
->
m_oTxtbxContent
->
m_arrItem
s
[
i
],
oParam
);
oTextItemReader
.
Parse
(
&
ooxShape
->
txBody
->
Paragr
s
[
i
],
oParam
);
}
}
text_properties
=
m_ooxShape
->
m_oTxBodyProperties
.
GetPointer
();
text_properties
=
ooxShape
->
txBody
.
GetPointer
();
}
else
if
(
m_ooxShape
->
m_oTxBodyAlt
.
IsInit
())
{
for
(
size_t
i
=
0
;
i
<
m_ooxShape
->
m_oTxBodyAlt
->
m_arrItems
.
size
();
i
++
)
{
oTextItemReader
.
Parse
(
m_ooxShape
->
m_oTxBodyAlt
->
m_arrItems
[
i
],
oParam
);
}
text_properties
=
m_ooxShape
->
m_oTxBodyAlt
->
m_oBodyPr
.
GetPointer
();
}
}
if
(
oTextItemReader
.
m_oTextItems
)
if
(
oTextItemReader
.
m_oTextItems
)
...
@@ -1202,6 +1185,18 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
...
@@ -1202,6 +1185,18 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
return
true
;
return
true
;
}
}
void
OOXShapeReader
::
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
UniFill
*
oox_fill
,
std
::
wstring
*
change_sheme_color
)
{
if
(
!
oox_fill
)
return
;
switch
(
oox_fill
->
m_type
)
{
case
PPTX
:
:
Logic
::
UniFill
::
blipFill
:
Parse
(
oParam
,
pOutput
,
dynamic_cast
<
PPTX
::
Logic
::
BlipFill
*>
(
oox_fill
->
Fill
.
operator
->
()));
break
;
case
PPTX
:
:
Logic
::
UniFill
::
gradFill
:
Parse
(
oParam
,
pOutput
,
dynamic_cast
<
PPTX
::
Logic
::
GradFill
*>
(
oox_fill
->
Fill
.
operator
->
()),
change_sheme_color
);
break
;
case
PPTX
:
:
Logic
::
UniFill
::
pattFill
:
Parse
(
oParam
,
pOutput
,
dynamic_cast
<
PPTX
::
Logic
::
PattFill
*>
(
oox_fill
->
Fill
.
operator
->
()),
change_sheme_color
);
break
;
case
PPTX
:
:
Logic
::
UniFill
::
solidFill
:
Parse
(
oParam
,
pOutput
,
dynamic_cast
<
PPTX
::
Logic
::
SolidFill
*>
(
oox_fill
->
Fill
.
operator
->
()),
change_sheme_color
);
break
;
}
}
bool
OOXShapeReader
::
ParseVml
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
)
bool
OOXShapeReader
::
ParseVml
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
)
{
{
...
@@ -1511,41 +1506,41 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
...
@@ -1511,41 +1506,41 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
pOutput
->
m_nWrapType
=
3
;
//def
pOutput
->
m_nWrapType
=
3
;
//def
if
(
m_ooxGroup
->
m_oGroupSpPr
.
IsInit
()
&&
m_ooxGroup
->
m_oGroupSpPr
->
m_oX
frm
.
IsInit
())
if
(
m_ooxGroup
->
grpSpPr
.
x
frm
.
IsInit
())
{
{
double
rot
=
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oRot
.
GetAngle
()
;
double
rot
=
m_ooxGroup
->
grpSpPr
.
xfrm
->
rot
.
get
()
/
60000.
;
if
(
rot
>
0.01
)
if
(
rot
>
0.01
)
pOutput
->
m_nRotation
=
(
int
)(
rot
*
65535
);
pOutput
->
m_nRotation
=
(
int
)(
rot
*
65535
);
if
(
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oFlipH
.
ToBool
(
))
pOutput
->
m_bFlipH
=
1
;
if
(
m_ooxGroup
->
grpSpPr
.
xfrm
->
flipH
.
get_value_or
(
false
))
pOutput
->
m_bFlipH
=
1
;
if
(
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oFlipV
.
ToBool
(
))
pOutput
->
m_bFlipV
=
1
;
if
(
m_ooxGroup
->
grpSpPr
.
xfrm
->
flipV
.
get_value_or
(
false
))
pOutput
->
m_bFlipV
=
1
;
if
(
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oChOff
.
IsInit
()
)
if
(
m_ooxGroup
->
grpSpPr
.
xfrm
->
chOffX
.
IsInit
()
&&
m_ooxGroup
->
grpSpPr
.
xfrm
->
chOffY
.
IsInit
()
)
{
{
pOutput
->
m_nGroupLeft
=
(
int
)
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oChOff
->
m_oX
.
GetValue
();
pOutput
->
m_nGroupLeft
=
m_ooxGroup
->
grpSpPr
.
xfrm
->
chOffX
.
get
();
pOutput
->
m_nGroupTop
=
(
int
)
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oChOff
->
m_oY
.
GetValue
();
pOutput
->
m_nGroupTop
=
m_ooxGroup
->
grpSpPr
.
xfrm
->
chOffY
.
get
();
}
}
if
(
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oChExt
.
IsInit
())
if
(
m_ooxGroup
->
grpSpPr
.
xfrm
->
chExtX
.
IsInit
()
&&
m_ooxGroup
->
grpSpPr
.
xfrm
->
chExtY
.
IsInit
())
{
{
pOutput
->
m_nGroupRight
=
(
pOutput
->
m_nGroupLeft
!=
PROP_DEF
?
pOutput
->
m_nGroupLeft
:
0
)
+
(
int
)
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oChExt
->
m_oCx
.
GetValue
();
pOutput
->
m_nGroupRight
=
(
pOutput
->
m_nGroupLeft
!=
PROP_DEF
?
pOutput
->
m_nGroupLeft
:
0
)
+
(
int
)
m_ooxGroup
->
grpSpPr
.
xfrm
->
chExtX
.
get
();
pOutput
->
m_nGroupBottom
=
(
pOutput
->
m_nGroupTop
!=
PROP_DEF
?
pOutput
->
m_nGroupTop
:
0
)
+
(
int
)
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oChExt
->
m_oCy
.
GetValue
();
pOutput
->
m_nGroupBottom
=
(
pOutput
->
m_nGroupTop
!=
PROP_DEF
?
pOutput
->
m_nGroupTop
:
0
)
+
(
int
)
m_ooxGroup
->
grpSpPr
.
xfrm
->
chExtY
.
get
();
}
}
if
(
pOutput
->
m_bInGroup
)
if
(
pOutput
->
m_bInGroup
)
{
{
if
(
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oOff
.
IsInit
())
if
(
m_ooxGroup
->
grpSpPr
.
xfrm
->
offX
.
IsInit
()
&&
m_ooxGroup
->
grpSpPr
.
xfrm
->
offY
.
IsInit
())
{
{
pOutput
->
m_nRelLeft
=
(
int
)
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oOff
->
m_oX
.
ToEmu
();
pOutput
->
m_nRelLeft
=
m_ooxGroup
->
grpSpPr
.
xfrm
->
offX
.
get
();
pOutput
->
m_nRelTop
=
(
int
)
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oOff
->
m_oY
.
ToEmu
();
pOutput
->
m_nRelTop
=
m_ooxGroup
->
grpSpPr
.
xfrm
->
offY
.
get
();
}
}
else
else
{
{
pOutput
->
m_nRelLeft
=
0
;
pOutput
->
m_nRelLeft
=
0
;
pOutput
->
m_nRelTop
=
0
;
pOutput
->
m_nRelTop
=
0
;
}
}
if
(
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oExt
.
IsInit
())
if
(
m_ooxGroup
->
grpSpPr
.
xfrm
->
extX
.
IsInit
()
&&
m_ooxGroup
->
grpSpPr
.
xfrm
->
extY
.
IsInit
())
{
{
pOutput
->
m_nRelRight
=
(
int
)
pOutput
->
m_nRelLeft
+
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oExt
->
m_oCx
.
GetValue
();
pOutput
->
m_nRelRight
=
(
int
)
pOutput
->
m_nRelLeft
+
m_ooxGroup
->
grpSpPr
.
xfrm
->
extX
.
get
();
pOutput
->
m_nRelBottom
=
(
int
)
pOutput
->
m_nRelTop
+
m_ooxGroup
->
m_oGroupSpPr
->
m_oXfrm
->
m_oExt
->
m_oCy
.
GetValue
();
pOutput
->
m_nRelBottom
=
(
int
)
pOutput
->
m_nRelTop
+
m_ooxGroup
->
grpSpPr
.
xfrm
->
extY
.
get
();
}
}
else
else
{
{
...
@@ -1556,54 +1551,32 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
...
@@ -1556,54 +1551,32 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
}
}
}
}
for
(
size_t
i
=
0
;
i
<
m_ooxGroup
->
m_arrIt
ems
.
size
()
;
i
++
)
for
(
size_t
i
=
0
;
i
<
m_ooxGroup
->
SpTreeEl
ems
.
size
()
;
i
++
)
{
{
if
(
m_ooxGroup
->
m_arrItems
[
i
]
==
NULL
)
continue
;
if
(
m_ooxGroup
->
SpTreeElems
[
i
].
getType
()
==
OOX
::
et_p_ShapeTree
)
if
(
m_ooxGroup
->
m_arrItems
[
i
]
->
getType
()
==
OOX
::
et_w_GroupShape
)
{
{
RtfShapePtr
pNewShape
(
new
RtfShape
()
);
RtfShapePtr
pNewShape
(
new
RtfShape
()
);
pNewShape
->
m_bIsGroup
=
true
;
pNewShape
->
m_bIsGroup
=
true
;
smart_ptr
<
PPTX
::
Logic
::
SpTree
>
&
e
=
m_ooxGroup
->
SpTreeElems
[
i
].
GetElem
().
smart_dynamic_cast
<
PPTX
::
Logic
::
SpTree
>
();
OOXShapeGroupReader
oShapeReader
(
dynamic_cast
<
OOX
::
Logic
::
CGroupShape
*>
(
m_ooxGroup
->
m_arrItems
[
i
]));
OOXShapeGroupReader
oShapeReader
(
e
.
operator
->
());
pNewShape
->
m_bInGroup
=
true
;
if
(
true
==
oShapeReader
.
Parse
(
oParam
,
pNewShape
)
)
pOutput
->
AddItem
(
pNewShape
);
}
else
if
(
m_ooxGroup
->
m_arrItems
[
i
]
->
getType
()
==
OOX
::
et_w_GroupShape
)
{
RtfShapePtr
pNewShape
(
new
RtfShape
()
);
//set type .. .todooo
OOXShapeReader
oShapeReader
(
dynamic_cast
<
OOX
::
Logic
::
CShape
*>
(
m_ooxGroup
->
m_arrItems
[
i
]));
pNewShape
->
m_bInGroup
=
true
;
pNewShape
->
m_bInGroup
=
true
;
if
(
true
==
oShapeReader
.
Parse
(
oParam
,
pNewShape
)
)
if
(
true
==
oShapeReader
.
Parse
(
oParam
,
pNewShape
)
)
pOutput
->
AddItem
(
pNewShape
);
pOutput
->
AddItem
(
pNewShape
);
}
}
else
if
(
m_ooxGroup
->
m_arrItems
[
i
]
->
getType
()
==
OOX
::
et_w_Shape
)
else
{
{
RtfShapePtr
pNewShape
(
new
RtfShape
()
);
RtfShapePtr
pNewShape
(
new
RtfShape
()
);
OOXShapeReader
oShapeReader
(
dynamic_cast
<
OOX
::
Logic
::
CShape
*>
(
m_ooxGroup
->
m_arrItems
[
i
]));
smart_ptr
<
OOX
::
WritingElement
>
&
e
=
m_ooxGroup
->
SpTreeElems
[
i
].
GetElem
().
smart_dynamic_cast
<
OOX
::
WritingElement
>
();
OOXShapeReader
oShapeReader
(
e
.
operator
->
());
pNewShape
->
m_bInGroup
=
true
;
pNewShape
->
m_bInGroup
=
true
;
if
(
true
==
oShapeReader
.
Parse
(
oParam
,
pNewShape
)
)
if
(
true
==
oShapeReader
.
Parse
(
oParam
,
pNewShape
)
)
pOutput
->
AddItem
(
pNewShape
);
pOutput
->
AddItem
(
pNewShape
);
}
}
else
if
(
m_ooxGroup
->
m_arrItems
[
i
]
->
getType
()
==
OOX
::
et_pic_pic
)
{
OOX
::
Drawing
::
CPicture
*
picture
=
dynamic_cast
<
OOX
::
Drawing
::
CPicture
*>
(
m_ooxGroup
->
m_arrItems
[
i
]);
if
(
picture
)
{
RtfShapePtr
pNewShape
(
new
RtfShape
()
);
pNewShape
->
m_bInGroup
=
true
;
pNewShape
->
m_nShapeType
=
75
;
if
(
OOXShapeReader
::
Parse
(
oParam
,
pNewShape
,
&
picture
->
m_oBlipFill
))
pOutput
->
AddItem
(
pNewShape
);
}
}
}
}
}
}
return
true
;
return
true
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.h
View file @
2e8c83a6
...
@@ -30,14 +30,12 @@
...
@@ -30,14 +30,12 @@
*
*
*/
*/
#pragma once
#pragma once
#include "OOXPictureGraphicReader.h"
#include "OOXReaderBasic.h"
#include "OOXReaderBasic.h"
#include "../RtfDocument.h"
#include "../RtfDocument.h"
#include "../RtfShape.h"
#include "../RtfShape.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Logic/Shape.h"
bool
ParseVmlStyle
(
RtfShapePtr
pShape
,
SimpleTypes
::
Vml
::
CCssProperty
*
prop
);
bool
ParseVmlStyle
(
RtfShapePtr
pShape
,
SimpleTypes
::
Vml
::
CCssProperty
*
prop
);
...
@@ -52,7 +50,7 @@ public:
...
@@ -52,7 +50,7 @@ public:
m_arrElement
=
vmlElem
;
m_arrElement
=
vmlElem
;
}
}
OOXShapeReader
(
OOX
::
WritingElementWithChilds
<
OOX
::
WritingElement
>
*
elem
);
OOXShapeReader
(
OOX
::
WritingElementWithChilds
<
OOX
::
WritingElement
>
*
elem
);
OOXShapeReader
(
OOX
::
Logic
::
CShape
*
ooxShape
)
OOXShapeReader
(
OOX
::
WritingElement
*
ooxShape
)
{
{
m_ooxShape
=
ooxShape
;
m_ooxShape
=
ooxShape
;
m_vmlElement
=
NULL
;
m_vmlElement
=
NULL
;
...
@@ -67,26 +65,24 @@ public:
...
@@ -67,26 +65,24 @@ public:
void
ParseAdjustment
(
RtfShape
&
oShape
,
std
::
wstring
sAdjustment
);
void
ParseAdjustment
(
RtfShape
&
oShape
,
std
::
wstring
sAdjustment
);
static
bool
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CBlipFillProperties
*
oox_bitmap_fill
);
static
bool
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
BlipFill
*
oox_bitmap_fill
);
private:
private:
void
Parse
(
ReaderParameter
oParam
,
PPTX
::
Logic
::
ColorBase
*
oox_color
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
);
void
Parse
(
ReaderParameter
oParam
,
PPTX
::
Logic
::
SolidFill
*
oox_solid_fill
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
StyleRef
*
style_ref
,
int
type
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
Ln
*
oox_line_prop
,
std
::
wstring
*
change_sheme_color
=
NULL
);
bool
Parse
(
ReaderParameter
oParam
,
int
indexSchemeColor
,
BYTE
&
ucA
,
BYTE
&
ucG
,
BYTE
&
ucB
,
BYTE
&
ucR
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
UniFill
*
oox_fill
,
std
::
wstring
*
change_sheme_color
=
NULL
);
void
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
CColor
*
oox_color
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
);
void
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
CSchemeColor
*
oox_ShemeClr
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
);
void
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
Colors
::
CColorTransform
*
oox_ScrgbClr
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
);
void
Parse
(
ReaderParameter
oParam
,
OOX
::
Drawing
::
CSolidColorFillProperties
*
oox_solid_fill
,
unsigned
int
&
nColor
,
_CP_OPT
(
double
)
&
opacity
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CStyleMatrixReference
*
style_matrix_ref
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
GradFill
*
oox_grad_fill
,
std
::
wstring
*
change_sheme_color
=
NULL
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CLineProperties
*
oox_line_prop
,
std
::
wstring
*
change_sheme_color
=
NULL
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
PattFill
*
oox_pattern_fill
,
std
::
wstring
*
change_sheme_color
=
NULL
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
PPTX
::
Logic
::
SolidFill
*
oox_solid_fill
,
std
::
wstring
*
change_sheme_color
=
NULL
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CGradientFillProperties
*
oox_grad_fill
,
std
::
wstring
*
change_sheme_color
=
NULL
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CPatternFillProperties
*
oox_pattern_fill
,
std
::
wstring
*
change_sheme_color
=
NULL
);
void
Parse
(
ReaderParameter
oParam
,
RtfShapePtr
&
pOutput
,
OOX
::
Drawing
::
CSolidColorFillProperties
*
oox_solid_fill
,
std
::
wstring
*
change_sheme_color
=
NULL
);
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
OOX
::
Vml
::
CVmlCommonElements
*
m_vmlElement
;
OOX
::
Vml
::
CVmlCommonElements
*
m_vmlElement
;
OOX
::
WritingElementWithChilds
<
OOX
::
WritingElement
>
*
m_arrElement
;
OOX
::
WritingElementWithChilds
<
OOX
::
WritingElement
>
*
m_arrElement
;
OOX
::
Logic
::
CShape
*
m_ooxShape
;
OOX
::
WritingElement
*
m_ooxShape
;
void
ParseVmlPath
(
RtfShapePtr
&
pShape
,
const
std
::
wstring
&
custom_path
);
void
ParseVmlPath
(
RtfShapePtr
&
pShape
,
const
std
::
wstring
&
custom_path
);
bool
ParseVmlStyles
(
RtfShapePtr
&
pShape
,
std
::
vector
<
SimpleTypes
::
Vml
::
CCssPropertyPtr
>
&
props
)
bool
ParseVmlStyles
(
RtfShapePtr
&
pShape
,
std
::
vector
<
SimpleTypes
::
Vml
::
CCssPropertyPtr
>
&
props
)
...
@@ -104,14 +100,14 @@ class OOXShapeGroupReader
...
@@ -104,14 +100,14 @@ class OOXShapeGroupReader
{
{
private:
private:
OOX
::
Vml
::
CGroup
*
m_vmlGroup
;
OOX
::
Vml
::
CGroup
*
m_vmlGroup
;
OOX
::
Logic
::
CGroupShape
*
m_ooxGroup
;
PPTX
::
Logic
::
SpTree
*
m_ooxGroup
;
public:
public:
OOXShapeGroupReader
(
OOX
::
Vml
::
CGroup
*
vmlGroup
)
OOXShapeGroupReader
(
OOX
::
Vml
::
CGroup
*
vmlGroup
)
{
{
m_ooxGroup
=
NULL
;
m_ooxGroup
=
NULL
;
m_vmlGroup
=
vmlGroup
;
m_vmlGroup
=
vmlGroup
;
}
}
OOXShapeGroupReader
(
OOX
::
Logic
::
CGroupShap
e
*
ooxGroup
)
OOXShapeGroupReader
(
PPTX
::
Logic
::
SpTre
e
*
ooxGroup
)
{
{
m_vmlGroup
=
NULL
;
m_vmlGroup
=
NULL
;
m_ooxGroup
=
ooxGroup
;
m_ooxGroup
=
ooxGroup
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXTextItemReader.h
View file @
2e8c83a6
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
{
{
case
OOX
:
:
et_a_p
:
case
OOX
:
:
et_a_p
:
{
{
OOX
::
Drawing
::
CParagraph
*
pParagraph
=
dynamic_cast
<
OOX
::
Drawing
::
C
Paragraph
*>
(
ooxElement
);
PPTX
::
Logic
::
Paragraph
*
pParagraph
=
dynamic_cast
<
PPTX
::
Logic
::
Paragraph
*>
(
ooxElement
);
OOXParagraphReader
m_oParagraphReader
(
pParagraph
);
OOXParagraphReader
m_oParagraphReader
(
pParagraph
);
RtfParagraphPtr
oNewParagraph
(
new
RtfParagraph
()
);
RtfParagraphPtr
oNewParagraph
(
new
RtfParagraph
()
);
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXThemeReader.h
View file @
2e8c83a6
...
@@ -37,10 +37,10 @@
...
@@ -37,10 +37,10 @@
class
OOXThemeReader
class
OOXThemeReader
{
{
private:
private:
OOX
::
C
Theme
*
m_ooxTheme
;
PPTX
::
Theme
*
m_ooxTheme
;
public:
public:
OOXThemeReader
(
OOX
::
C
Theme
*
ooxTheme
)
OOXThemeReader
(
PPTX
::
Theme
*
ooxTheme
)
{
{
m_ooxTheme
=
ooxTheme
;
m_ooxTheme
=
ooxTheme
;
}
}
...
@@ -49,11 +49,11 @@ public:
...
@@ -49,11 +49,11 @@ public:
if
(
m_ooxTheme
==
NULL
)
return
false
;
if
(
m_ooxTheme
==
NULL
)
return
false
;
{
{
OOXColorSchemeReader
oColorSchemeReader
(
&
m_ooxTheme
->
m_oThemeElements
.
m_oC
lrScheme
);
OOXColorSchemeReader
oColorSchemeReader
(
&
m_ooxTheme
->
themeElements
.
c
lrScheme
);
oColorSchemeReader
.
Parse
(
oParam
);
oColorSchemeReader
.
Parse
(
oParam
);
}
}
{
{
OOXFontSchemeReader
oFontSchemeReader
(
&
m_ooxTheme
->
m_oThemeElements
.
m_oF
ontScheme
);
OOXFontSchemeReader
oFontSchemeReader
(
&
m_ooxTheme
->
themeElements
.
f
ontScheme
);
oFontSchemeReader
.
Parse
(
oParam
);
oFontSchemeReader
.
Parse
(
oParam
);
}
}
return
true
;
return
true
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXpPrReader.h
View file @
2e8c83a6
...
@@ -46,7 +46,7 @@ class OOXpPrReader
...
@@ -46,7 +46,7 @@ class OOXpPrReader
private:
private:
bool
ParseDrawing
(
ReaderParameter
oParam
,
RtfParagraphProperty
&
oOutputProperty
);
bool
ParseDrawing
(
ReaderParameter
oParam
,
RtfParagraphProperty
&
oOutputProperty
);
OOX
::
Drawing
::
CParagraphProperty
*
m_drawingParaProps
;
PPTX
::
Logic
::
TextParagraphPr
*
m_drawingParaProps
;
OOX
::
Logic
::
CParagraphProperty
*
m_ooxParaProps
;
OOX
::
Logic
::
CParagraphProperty
*
m_ooxParaProps
;
public:
public:
bool
m_bDefStyle
;
bool
m_bDefStyle
;
...
@@ -57,7 +57,7 @@ public:
...
@@ -57,7 +57,7 @@ public:
m_ooxParaProps
=
ooxParaProps
;
m_ooxParaProps
=
ooxParaProps
;
m_drawingParaProps
=
NULL
;
m_drawingParaProps
=
NULL
;
}
}
OOXpPrReader
(
OOX
::
Drawing
::
CParagraphProperty
*
ooxParaProps
)
OOXpPrReader
(
PPTX
::
Logic
::
TextParagraphPr
*
ooxParaProps
)
{
{
m_bDefStyle
=
true
;
m_bDefStyle
=
true
;
m_ooxParaProps
=
NULL
;
m_ooxParaProps
=
NULL
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXrPrReader.h
View file @
2e8c83a6
...
@@ -45,7 +45,7 @@ class OOXrPrReader
...
@@ -45,7 +45,7 @@ class OOXrPrReader
private:
private:
bool
ParseDrawing
(
ReaderParameter
oParam
,
RtfCharProperty
&
oOutputProperty
);
bool
ParseDrawing
(
ReaderParameter
oParam
,
RtfCharProperty
&
oOutputProperty
);
OOX
::
Drawing
::
CRunProperty
*
m_drawingRunProps
;
PPTX
::
Logic
::
RunProperties
*
m_drawingRunProps
;
OOX
::
Logic
::
CRunProperty
*
m_ooxRunProps
;
OOX
::
Logic
::
CRunProperty
*
m_ooxRunProps
;
public:
public:
bool
m_bDefStyle
;
bool
m_bDefStyle
;
...
@@ -56,7 +56,7 @@ public:
...
@@ -56,7 +56,7 @@ public:
m_ooxRunProps
=
ooxRunProps
;
m_ooxRunProps
=
ooxRunProps
;
m_drawingRunProps
=
NULL
;
m_drawingRunProps
=
NULL
;
}
}
OOXrPrReader
(
OOX
::
Drawing
::
CRunProperty
*
ooxRunProps
)
OOXrPrReader
(
PPTX
::
Logic
::
RunProperties
*
ooxRunProps
)
{
{
m_bDefStyle
=
true
;
m_bDefStyle
=
true
;
m_ooxRunProps
=
NULL
;
m_ooxRunProps
=
NULL
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXWriter.cpp
View file @
2e8c83a6
...
@@ -146,7 +146,7 @@ bool OOXWriter::SaveByItemEnd()
...
@@ -146,7 +146,7 @@ bool OOXWriter::SaveByItemEnd()
if
(
m_poDocPropsApp
)
if
(
m_poDocPropsApp
)
{
{
((
OOX
::
CApp
*
)
m_poDocPropsApp
)
->
SetApplication
(
L"OnlyOffice"
);
((
OOX
::
CApp
*
)
m_poDocPropsApp
)
->
SetApplication
(
L"OnlyOffice"
);
((
OOX
::
CApp
*
)
m_poDocPropsApp
)
->
SetAppVersion
(
L"
3.0000
"
);
((
OOX
::
CApp
*
)
m_poDocPropsApp
)
->
SetAppVersion
(
L"
4.3
"
);
((
OOX
::
CApp
*
)
m_poDocPropsApp
)
->
write
(
pathDocProps
+
FILE_SEPARATOR_STR
+
L"app.xml"
,
pathDocProps
.
GetDirectory
(),
oContentTypes
);
((
OOX
::
CApp
*
)
m_poDocPropsApp
)
->
write
(
pathDocProps
+
FILE_SEPARATOR_STR
+
L"app.xml"
,
pathDocProps
.
GetDirectory
(),
oContentTypes
);
...
...
ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFile.cpp
View file @
2e8c83a6
...
@@ -49,16 +49,16 @@ const int TxtFile::getLinesCount()
...
@@ -49,16 +49,16 @@ const int TxtFile::getLinesCount()
const
std
::
list
<
std
::
string
>
TxtFile
::
readAnsiOrCodePage
()
// == readUtf8withoutPref также
const
std
::
list
<
std
::
string
>
TxtFile
::
readAnsiOrCodePage
()
// == readUtf8withoutPref также
{
{
std
::
list
<
std
::
string
>
result
;
std
::
list
<
std
::
string
>
result
;
CFile
file_binary
;
NSFile
::
CFileBinary
file_binary
;
if
(
file_binary
.
OpenFile
(
m_path
)
!=
S_OK
)
return
result
;
if
(
file_binary
.
OpenFile
(
m_path
)
!=
S_OK
)
return
result
;
long
file_size
=
file_binary
.
GetFileSize
();
DWORD
file_size
=
file_binary
.
GetFileSize
();
char
*
file_data
=
new
char
[
file_size
];
char
*
file_data
=
new
char
[
file_size
];
if
(
file_data
==
NULL
)
return
result
;
if
(
file_data
==
NULL
)
return
result
;
file_binary
.
ReadFile
((
BYTE
*
)
file_data
,
file_size
);
file_binary
.
ReadFile
((
BYTE
*
)
file_data
,
file_size
,
file_size
);
long
start_pos
=
0
;
long
start_pos
=
0
;
...
@@ -116,16 +116,16 @@ const std::list<std::wstring> TxtFile::readUnicodeFromBytes(char *file_data, lon
...
@@ -116,16 +116,16 @@ const std::list<std::wstring> TxtFile::readUnicodeFromBytes(char *file_data, lon
const
std
::
list
<
std
::
wstring
>
TxtFile
::
readUnicode
()
const
std
::
list
<
std
::
wstring
>
TxtFile
::
readUnicode
()
{
{
std
::
list
<
std
::
wstring
>
result
;
std
::
list
<
std
::
wstring
>
result
;
CFile
file_binary
;
NSFile
::
CFileBinary
file_binary
;
if
(
file_binary
.
OpenFile
(
m_path
)
!=
S_OK
)
return
result
;
if
(
file_binary
.
OpenFile
(
m_path
)
!=
S_OK
)
return
result
;
long
file_size
=
file_binary
.
GetFileSize
();
DWORD
file_size
=
file_binary
.
GetFileSize
();
char
*
file_data
=
new
char
[
file_size
];
char
*
file_data
=
new
char
[
file_size
];
if
(
file_data
==
NULL
)
return
result
;
if
(
file_data
==
NULL
)
return
result
;
file_binary
.
ReadFile
((
BYTE
*
)
file_data
,
file_size
);
file_binary
.
ReadFile
((
BYTE
*
)
file_data
,
file_size
,
file_size
);
return
readUnicodeFromBytes
(
file_data
,
file_size
);
return
readUnicodeFromBytes
(
file_data
,
file_size
);
}
}
...
@@ -133,16 +133,16 @@ const std::list<std::wstring> TxtFile::readUnicode()
...
@@ -133,16 +133,16 @@ const std::list<std::wstring> TxtFile::readUnicode()
const
std
::
list
<
std
::
wstring
>
TxtFile
::
readBigEndian
()
const
std
::
list
<
std
::
wstring
>
TxtFile
::
readBigEndian
()
{
{
std
::
list
<
std
::
wstring
>
result
;
std
::
list
<
std
::
wstring
>
result
;
CFile
file_binary
;
NSFile
::
CFileBinary
file_binary
;
if
(
file_binary
.
OpenFile
(
m_path
)
!=
S_OK
)
return
result
;
if
(
file_binary
.
OpenFile
(
m_path
)
!=
S_OK
)
return
result
;
long
file_size
=
file_binary
.
GetFileSize
();
DWORD
file_size
=
file_binary
.
GetFileSize
();
char
*
file_data
=
new
char
[
file_size
];
char
*
file_data
=
new
char
[
file_size
];
if
(
file_data
==
NULL
)
return
result
;
if
(
file_data
==
NULL
)
return
result
;
file_binary
.
ReadFile
((
BYTE
*
)
file_data
,
file_size
);
file_binary
.
ReadFile
((
BYTE
*
)
file_data
,
file_size
,
file_size
);
//swap bytes
//swap bytes
for
(
long
i
=
0
;
i
<
file_size
;
i
+=
2
)
for
(
long
i
=
0
;
i
<
file_size
;
i
+=
2
)
...
@@ -158,16 +158,16 @@ const std::list<std::wstring> TxtFile::readBigEndian()
...
@@ -158,16 +158,16 @@ const std::list<std::wstring> TxtFile::readBigEndian()
const
std
::
list
<
std
::
string
>
TxtFile
::
readUtf8
()
const
std
::
list
<
std
::
string
>
TxtFile
::
readUtf8
()
{
{
std
::
list
<
std
::
string
>
result
;
std
::
list
<
std
::
string
>
result
;
CFile
file_binary
;
NSFile
::
CFileBinary
file_binary
;
if
(
file_binary
.
OpenFile
(
m_path
)
!=
S_OK
)
return
result
;
if
(
file_binary
.
OpenFile
(
m_path
)
!=
S_OK
)
return
result
;
long
file_size
=
file_binary
.
GetFileSize
();
DWORD
file_size
=
file_binary
.
GetFileSize
();
char
*
file_data
=
new
char
[
file_size
];
char
*
file_data
=
new
char
[
file_size
];
if
(
file_data
==
NULL
)
return
result
;
if
(
file_data
==
NULL
)
return
result
;
file_binary
.
ReadFile
((
BYTE
*
)
file_data
,
file_size
);
file_binary
.
ReadFile
((
BYTE
*
)
file_data
,
file_size
,
file_size
);
long
start_pos
=
3
;
//skip header
long
start_pos
=
3
;
//skip header
...
@@ -197,13 +197,13 @@ const std::list<std::string> TxtFile::readUtf8()
...
@@ -197,13 +197,13 @@ const std::list<std::string> TxtFile::readUtf8()
void
TxtFile
::
writeAnsiOrCodePage
(
const
std
::
list
<
std
::
string
>&
content
)
// === writeUtf8withoutPref также
void
TxtFile
::
writeAnsiOrCodePage
(
const
std
::
list
<
std
::
string
>&
content
)
// === writeUtf8withoutPref также
{
{
CFile
file
;
NSFile
::
CFileBinary
file
;
if
(
file
.
CreateFile
(
m_path
)
==
S_OK
)
if
(
file
.
CreateFile
W
(
m_path
)
==
S_OK
)
{
{
BYTE
endLine
[
2
]
=
{
0x0d
,
0x0a
};
BYTE
endLine
[
2
]
=
{
0x0d
,
0x0a
};
for
(
std
::
list
<
std
::
string
>::
const_iterator
iter
=
content
.
begin
();
iter
!=
content
.
end
();
++
iter
)
for
(
std
::
list
<
std
::
string
>::
const_iterator
iter
=
content
.
begin
();
iter
!=
content
.
end
();
++
iter
)
{
{
file
.
WriteFile
((
void
*
)(
*
iter
).
c_str
(),
(
*
iter
).
length
());
file
.
WriteFile
((
BYTE
*
)(
*
iter
).
c_str
(),
(
*
iter
).
length
());
file
.
WriteFile
(
endLine
,
2
);
file
.
WriteFile
(
endLine
,
2
);
m_linesCount
++
;
m_linesCount
++
;
...
@@ -213,8 +213,8 @@ void TxtFile::writeAnsiOrCodePage(const std::list<std::string>& content) // ===
...
@@ -213,8 +213,8 @@ void TxtFile::writeAnsiOrCodePage(const std::list<std::string>& content) // ===
void
TxtFile
::
writeUnicode
(
const
std
::
list
<
std
::
wstring
>&
content
)
void
TxtFile
::
writeUnicode
(
const
std
::
list
<
std
::
wstring
>&
content
)
{
{
CFile
file
;
NSFile
::
CFileBinary
file
;
if
(
file
.
CreateFile
(
m_path
)
==
S_OK
)
if
(
file
.
CreateFile
W
(
m_path
)
==
S_OK
)
{
{
BYTE
Header
[
2
]
=
{
0xff
,
0xfe
};
BYTE
Header
[
2
]
=
{
0xff
,
0xfe
};
BYTE
EndLine
[
4
]
=
{
0x0d
,
0x00
,
0x0a
,
0x00
};
BYTE
EndLine
[
4
]
=
{
0x0d
,
0x00
,
0x0a
,
0x00
};
...
@@ -228,7 +228,7 @@ void TxtFile::writeUnicode(const std::list<std::wstring>& content)
...
@@ -228,7 +228,7 @@ void TxtFile::writeUnicode(const std::list<std::wstring>& content)
if
(
sizeof
(
wchar_t
)
==
2
)
if
(
sizeof
(
wchar_t
)
==
2
)
{
{
file
.
WriteFile
((
void
*
)
data
,
size
<<
1
);
file
.
WriteFile
((
BYTE
*
)
data
,
size
<<
1
);
}
}
else
else
{
{
...
@@ -243,8 +243,8 @@ void TxtFile::writeUnicode(const std::list<std::wstring>& content)
...
@@ -243,8 +243,8 @@ void TxtFile::writeUnicode(const std::list<std::wstring>& content)
void
TxtFile
::
writeBigEndian
(
const
std
::
list
<
std
::
wstring
>&
content
)
void
TxtFile
::
writeBigEndian
(
const
std
::
list
<
std
::
wstring
>&
content
)
{
{
CFile
file
;
NSFile
::
CFileBinary
file
;
if
(
file
.
CreateFile
(
m_path
)
==
S_OK
)
if
(
file
.
CreateFile
W
(
m_path
)
==
S_OK
)
{
{
BYTE
Header
[
2
]
=
{
0xfe
,
0xff
};
BYTE
Header
[
2
]
=
{
0xfe
,
0xff
};
BYTE
EndLine
[
4
]
=
{
0x00
,
0x0d
,
0x00
,
0x0a
};
BYTE
EndLine
[
4
]
=
{
0x00
,
0x0d
,
0x00
,
0x0a
};
...
@@ -264,7 +264,7 @@ void TxtFile::writeBigEndian(const std::list<std::wstring>& content)
...
@@ -264,7 +264,7 @@ void TxtFile::writeBigEndian(const std::list<std::wstring>& content)
data
[
i
]
=
data
[
i
+
1
];
data
[
i
]
=
data
[
i
+
1
];
data
[
i
+
1
]
=
v
;
data
[
i
+
1
]
=
v
;
}
}
file
.
WriteFile
((
void
*
)(
*
iter
).
c_str
(),
size
<<
1
);
file
.
WriteFile
((
BYTE
*
)(
*
iter
).
c_str
(),
size
<<
1
);
}
}
else
else
{
{
...
@@ -279,8 +279,8 @@ void TxtFile::writeBigEndian(const std::list<std::wstring>& content)
...
@@ -279,8 +279,8 @@ void TxtFile::writeBigEndian(const std::list<std::wstring>& content)
void
TxtFile
::
writeUtf8
(
const
std
::
list
<
std
::
string
>&
content
)
void
TxtFile
::
writeUtf8
(
const
std
::
list
<
std
::
string
>&
content
)
{
{
CFile
file
;
NSFile
::
CFileBinary
file
;
if
(
file
.
CreateFile
(
m_path
)
==
S_OK
)
if
(
file
.
CreateFile
W
(
m_path
)
==
S_OK
)
{
{
BYTE
Header
[
3
]
=
{
0xef
,
0xbb
,
0xbf
};
BYTE
Header
[
3
]
=
{
0xef
,
0xbb
,
0xbf
};
BYTE
EndLine
[
2
]
=
{
0x0d
,
0x0a
};
BYTE
EndLine
[
2
]
=
{
0x0d
,
0x0a
};
...
@@ -289,8 +289,8 @@ void TxtFile::writeUtf8(const std::list<std::string>& content)
...
@@ -289,8 +289,8 @@ void TxtFile::writeUtf8(const std::list<std::string>& content)
for
(
std
::
list
<
std
::
string
>::
const_iterator
iter
=
content
.
begin
();
iter
!=
content
.
end
();
++
iter
)
for
(
std
::
list
<
std
::
string
>::
const_iterator
iter
=
content
.
begin
();
iter
!=
content
.
end
();
++
iter
)
{
{
file
.
WriteFile
((
void
*
)(
*
iter
).
c_str
(),
(
*
iter
).
length
());
file
.
WriteFile
((
BYTE
*
)(
*
iter
).
c_str
(),
(
*
iter
).
length
());
file
.
WriteFile
((
void
*
)
EndLine
,
2
);
file
.
WriteFile
((
BYTE
*
)
EndLine
,
2
);
m_linesCount
++
;
m_linesCount
++
;
}
}
...
@@ -299,12 +299,14 @@ void TxtFile::writeUtf8(const std::list<std::string>& content)
...
@@ -299,12 +299,14 @@ void TxtFile::writeUtf8(const std::list<std::string>& content)
const
bool
TxtFile
::
isUnicode
()
const
bool
TxtFile
::
isUnicode
()
{
{
CFile
file
;
NSFile
::
CFileBinary
file
;
if
(
file
.
OpenFile
(
m_path
)
!=
S_OK
)
return
false
;
if
(
file
.
OpenFile
(
m_path
)
!=
S_OK
)
return
false
;
DWORD
dwRead
;
BYTE
data
[
2
];
BYTE
data
[
2
];
file
.
ReadFile
(
data
,
2
);
file
.
ReadFile
(
data
,
2
,
dwRead
);
file
.
CloseFile
();
file
.
CloseFile
();
if
((
data
[
0
]
==
0xff
)
&&
(
data
[
1
]
==
0xfe
))
return
true
;
if
((
data
[
0
]
==
0xff
)
&&
(
data
[
1
]
==
0xfe
))
return
true
;
...
@@ -314,12 +316,14 @@ const bool TxtFile::isUnicode()
...
@@ -314,12 +316,14 @@ const bool TxtFile::isUnicode()
const
bool
TxtFile
::
isBigEndian
()
const
bool
TxtFile
::
isBigEndian
()
{
{
CFile
file
;
NSFile
::
CFileBinary
file
;
if
(
file
.
OpenFile
(
m_path
)
!=
S_OK
)
return
false
;
if
(
file
.
OpenFile
(
m_path
)
!=
S_OK
)
return
false
;
DWORD
dwRead
;
BYTE
data
[
2
];
BYTE
data
[
2
];
file
.
ReadFile
(
data
,
2
);
file
.
ReadFile
(
data
,
2
,
dwRead
);
file
.
CloseFile
();
file
.
CloseFile
();
if
((
data
[
0
]
==
0xfe
)
&&
(
data
[
1
]
==
0xff
))
return
true
;
if
((
data
[
0
]
==
0xfe
)
&&
(
data
[
1
]
==
0xff
))
return
true
;
...
@@ -329,12 +333,14 @@ const bool TxtFile::isBigEndian()
...
@@ -329,12 +333,14 @@ const bool TxtFile::isBigEndian()
const
bool
TxtFile
::
isUtf8
()
const
bool
TxtFile
::
isUtf8
()
{
{
CFile
file
;
NSFile
::
CFileBinary
file
;
if
(
file
.
OpenFile
(
m_path
)
!=
S_OK
)
return
false
;
if
(
file
.
OpenFile
(
m_path
)
!=
S_OK
)
return
false
;
DWORD
dwRead
;
BYTE
data
[
3
];
BYTE
data
[
3
];
file
.
ReadFile
(
data
,
3
);
file
.
ReadFile
(
data
,
3
,
dwRead
);
file
.
CloseFile
();
file
.
CloseFile
();
if
((
data
[
0
]
==
0xef
)
&&
(
data
[
1
]
==
0xbb
)
&&
(
data
[
2
]
==
0xbf
))
return
true
;
if
((
data
[
0
]
==
0xef
)
&&
(
data
[
1
]
==
0xbb
)
&&
(
data
[
2
]
==
0xbf
))
return
true
;
...
...
ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.cpp
View file @
2e8c83a6
...
@@ -50,7 +50,6 @@ namespace NSBinPptxRW
...
@@ -50,7 +50,6 @@ namespace NSBinPptxRW
#include "../../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "../../../DesktopEditor/common/Path.h"
#include "../../../ASCOfficeDocxFile2/DocWrapper/FontProcessor.h"
#include "../../../ASCOfficeDocxFile2/DocWrapper/FontProcessor.h"
#include "../../../ASCOfficeDocxFile2/BinReader/FileWriter.h"
#include "../../../ASCOfficeDocxFile2/BinReader/FileWriter.h"
...
@@ -211,7 +210,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
...
@@ -211,7 +210,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
//default files
//default files
pDocxWriter
->
m_o
Default
Theme
.
Write
(
pathTheme
.
GetPath
());
pDocxWriter
->
m_oTheme
.
Write
(
pathTheme
.
GetPath
());
OOX
::
CContentTypes
oContentTypes
;
OOX
::
CContentTypes
oContentTypes
;
//docProps
//docProps
...
@@ -224,7 +223,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
...
@@ -224,7 +223,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
if
(
pApp
)
if
(
pApp
)
{
{
pApp
->
SetApplication
(
_T
(
"OnlyOffice"
));
pApp
->
SetApplication
(
_T
(
"OnlyOffice"
));
pApp
->
SetAppVersion
(
_T
(
"
3.0
000"
));
pApp
->
SetAppVersion
(
_T
(
"
4.3
000"
));
pApp
->
SetDocSecurity
(
0
);
pApp
->
SetDocSecurity
(
0
);
pApp
->
SetScaleCrop
(
false
);
pApp
->
SetScaleCrop
(
false
);
pApp
->
SetLinksUpToDate
(
false
);
pApp
->
SetLinksUpToDate
(
false
);
...
@@ -243,20 +242,24 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
...
@@ -243,20 +242,24 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
delete
pCore
;
delete
pCore
;
}
}
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
pDocxWriter
->
m_oTheme
.
Write
(
strDirectory
);
pDocxWriter
->
m_oCommentsWriter
.
Write
();
pDocxWriter
->
m_oChartWriter
.
Write
();
pDocxWriter
->
m_oStylesWriter
.
Write
();
pDocxWriter
->
m_oStylesWriter
.
Write
();
pDocxWriter
->
m_oNumberingWriter
.
Write
();
pDocxWriter
->
m_oFontTableWriter
.
Write
();
pDocxWriter
->
m_oFontTableWriter
.
Write
();
pDocxWriter
->
m_oHeaderFooterWriter
.
Write
();
//Setting пишем после HeaderFooter, чтобы заполнить evenAndOddHeaders
pDocxWriter
->
m_oSettingWriter
.
Write
();
pDocxWriter
->
m_oSettingWriter
.
Write
();
pDocxWriter
->
m_oWebSettingsWriter
.
Write
();
pDocxWriter
->
m_oWebSettingsWriter
.
Write
();
//Document пишем после HeaderFooter, чтобы заполнить sectPr
pDocxWriter
->
m_oDocumentWriter
.
Write
();
pDocxWriter
->
m_oDocumentWriter
.
Write
();
//Rels и ContentTypes пишем в конце
pDocxWriter
->
m_oDocumentRelsWriter
.
Write
();
pDocxWriter
->
m_oDocumentRelsWriter
.
Write
();
pDocxWriter
->
m_oContentTypesWriter
.
Write
();
oContentTypes
.
Registration
(
L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
,
OOX
::
CPath
(
L"/word"
),
OOX
::
CPath
(
L"document.xml"
));
oContentTypes
.
Registration
(
L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"
,
OOX
::
CPath
(
L"/word"
),
OOX
::
CPath
(
L"styles.xml"
));
oContentTypes
.
Registration
(
L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"
,
OOX
::
CPath
(
L"/word"
),
OOX
::
CPath
(
L"settings.xml"
));
oContentTypes
.
Registration
(
L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"
,
OOX
::
CPath
(
L"/word"
),
OOX
::
CPath
(
L"webSettings.xml"
));
oContentTypes
.
Registration
(
L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"
,
OOX
::
CPath
(
L"/word"
),
OOX
::
CPath
(
L"fontTable.xml"
));
oContentTypes
.
Registration
(
L"application/vnd.openxmlformats-officedocument.theme+xml"
,
OOX
::
CPath
(
L"/word/theme"
),
OOX
::
CPath
(
L"theme1.xml"
));
oContentTypes
.
Write
(
strDirectory
);
}
}
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