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
26cedc30
Commit
26cedc30
authored
Dec 06, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - embedded objects (ods in odt example)
parent
1e04770e
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
645 additions
and
530 deletions
+645
-530
ASCOfficeOdfFile/src/docx/docx_content_type.h
ASCOfficeOdfFile/src/docx/docx_content_type.h
+1
-1
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
+1
-0
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
+74
-30
ASCOfficeOdfFile/src/docx/docx_drawing.h
ASCOfficeOdfFile/src/docx/docx_drawing.h
+6
-8
ASCOfficeOdfFile/src/docx/docx_package.cpp
ASCOfficeOdfFile/src/docx/docx_package.cpp
+16
-2
ASCOfficeOdfFile/src/docx/docx_package.h
ASCOfficeOdfFile/src/docx/docx_package.h
+1
-0
ASCOfficeOdfFile/src/docx/mediaitems.cpp
ASCOfficeOdfFile/src/docx/mediaitems.cpp
+17
-5
ASCOfficeOdfFile/src/docx/mediaitems.h
ASCOfficeOdfFile/src/docx/mediaitems.h
+2
-1
ASCOfficeOdfFile/src/docx/mediaitems_utils.cpp
ASCOfficeOdfFile/src/docx/mediaitems_utils.cpp
+12
-4
ASCOfficeOdfFile/src/docx/oox_drawing.cpp
ASCOfficeOdfFile/src/docx/oox_drawing.cpp
+57
-43
ASCOfficeOdfFile/src/docx/oox_drawing.h
ASCOfficeOdfFile/src/docx/oox_drawing.h
+27
-34
ASCOfficeOdfFile/src/docx/oox_package.cpp
ASCOfficeOdfFile/src/docx/oox_package.cpp
+53
-6
ASCOfficeOdfFile/src/docx/oox_package.h
ASCOfficeOdfFile/src/docx/oox_package.h
+12
-0
ASCOfficeOdfFile/src/docx/oox_rels.h
ASCOfficeOdfFile/src/docx/oox_rels.h
+1
-1
ASCOfficeOdfFile/src/docx/pptx_drawing.cpp
ASCOfficeOdfFile/src/docx/pptx_drawing.cpp
+20
-18
ASCOfficeOdfFile/src/docx/pptx_drawing.h
ASCOfficeOdfFile/src/docx/pptx_drawing.h
+7
-5
ASCOfficeOdfFile/src/docx/pptx_drawings.cpp
ASCOfficeOdfFile/src/docx/pptx_drawings.cpp
+2
-2
ASCOfficeOdfFile/src/docx/pptx_drawings.h
ASCOfficeOdfFile/src/docx/pptx_drawings.h
+1
-2
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
+2
-2
ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp
ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp
+28
-25
ASCOfficeOdfFile/src/docx/xlsx_drawing.h
ASCOfficeOdfFile/src/docx/xlsx_drawing.h
+6
-7
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
+3
-3
ASCOfficeOdfFile/src/docx/xlsx_drawings.cpp
ASCOfficeOdfFile/src/docx/xlsx_drawings.cpp
+2
-2
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
+13
-5
ASCOfficeOdfFile/src/odf/chart_build_oox.h
ASCOfficeOdfFile/src/odf/chart_build_oox.h
+40
-36
ASCOfficeOdfFile/src/odf/datatypes/length.cpp
ASCOfficeOdfFile/src/odf/datatypes/length.cpp
+1
-1
ASCOfficeOdfFile/src/odf/draw_frame.h
ASCOfficeOdfFile/src/odf/draw_frame.h
+19
-8
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+204
-251
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
+13
-27
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
+4
-1
No files found.
ASCOfficeOdfFile/src/docx/docx_content_type.h
View file @
26cedc30
...
...
@@ -76,7 +76,7 @@ public:
{}
std
::
wostream
&
xml_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
const
std
::
wstring
&
part_name
()
const
{
return
part_name_
;
}
const
std
::
wstring
&
part_name
()
const
{
return
part_name_
;
}
const
std
::
wstring
&
content_type
()
const
{
return
content_type_
;
}
public:
...
...
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
View file @
26cedc30
...
...
@@ -133,6 +133,7 @@ text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wst
docx_conversion_context
::
docx_conversion_context
(
odf_reader
::
odf_document
*
OdfDocument
)
:
next_dump_page_properties_
(
false
),
page_break_
(
false
),
page_break_after_
(
false
),
page_break_before_
(
false
),
in_run_
(
false
),
...
...
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
View file @
26cedc30
...
...
@@ -187,12 +187,10 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
}
}
void
docx_serialize_text
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
void
_docx_drawing
::
serialize_text
(
std
::
wostream
&
strm
)
{
const
std
::
vector
<
odf_reader
::
_property
>
&
properties
=
val
.
additional
;
_CP_OPT
(
std
::
wstring
)
strTextContent
;
odf_reader
::
GetProperty
(
properties
,
L"text-content"
,
strTextContent
);
odf_reader
::
GetProperty
(
additional
,
L"text-content"
,
strTextContent
);
CP_XML_WRITER
(
strm
)
{
...
...
@@ -209,7 +207,7 @@ void docx_serialize_text(std::wostream & strm, _docx_drawing & val)
}
}
oox_serialize_bodyPr
(
strm
,
val
,
L"wps"
);
serialize_bodyPr
(
strm
,
L"wps"
);
}
//--------------------------------------------------------------------
...
...
@@ -240,11 +238,11 @@ void docx_serialize_image_child(std::wostream & strm, _docx_drawing & val)
CP_XML_NODE
(
L"pic:spPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
val
.
serialize_xfrm
(
CP_XML_STREAM
()
);
CP_XML_NODE
(
L"a:prstGeom"
)
{
CP_XML_ATTR
(
L"prst"
,
L"rect"
);
CP_XML_ATTR
(
L"prst"
,
L"rect"
);
CP_XML_NODE
(
L"a:avLst"
);
}
...
...
@@ -280,13 +278,12 @@ void docx_serialize_shape_child(std::wostream & strm, _docx_drawing & val)
}
CP_XML_NODE
(
L"wps:spPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
oox_serialize_shape
(
CP_XML_STREAM
(),
val
);
val
.
serialize_xfrm
(
CP_XML_STREAM
());
val
.
serialize_shape
(
CP_XML_STREAM
());
oox_serialize_ln
(
CP_XML_STREAM
(),
val
.
additional
);
}
docx_serialize_text
(
CP_XML_STREAM
(),
val
);
val
.
serialize_text
(
CP_XML_STREAM
()
);
}
}
}
...
...
@@ -306,13 +303,14 @@ void docx_serialize_group_child(std::wostream & strm, _docx_drawing & val)
CP_XML_NODE
(
L"wpg:grpSpPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
val
.
serialize_xfrm
(
CP_XML_STREAM
()
);
}
CP_XML_STREAM
()
<<
val
.
content_group_
;
}
}
}
void
docx_serialize_chart_child
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
CP_XML_WRITER
(
strm
)
...
...
@@ -321,7 +319,7 @@ void docx_serialize_chart_child(std::wostream & strm, _docx_drawing & val)
{
CP_XML_ATTR
(
L"xmlns:c"
,
L"http://schemas.openxmlformats.org/drawingml/2006/chart"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
CP_XML_ATTR
(
L"r:id"
,
val
.
char
tId
);
CP_XML_ATTR
(
L"r:id"
,
val
.
objec
tId
);
}
}
}
...
...
@@ -332,9 +330,9 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
{
CP_XML_NODE
(
L"wp:docPr"
)
{
CP_XML_ATTR
(
L"name"
,
val
.
name
);
CP_XML_ATTR
(
L"id"
,
val
.
id
+
1
);
oox_serialize_hlink
(
CP_XML_STREAM
(),
val
.
hlinks
);
CP_XML_ATTR
(
L"name"
,
val
.
name
);
CP_XML_ATTR
(
L"id"
,
val
.
id
+
1
);
oox_serialize_hlink
(
CP_XML_STREAM
(),
val
.
hlinks
);
}
CP_XML_NODE
(
L"wp:cNvGraphicFramePr"
)
...
...
@@ -355,6 +353,11 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
);
docx_serialize_shape_child
(
CP_XML_STREAM
(),
val
);
}
else
if
(
val
.
type
==
typeGroupShape
)
{
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
);
docx_serialize_group_child
(
CP_XML_STREAM
(),
val
);
}
else
if
(
val
.
type
==
typeImage
)
{
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.openxmlformats.org/drawingml/2006/picture"
);
...
...
@@ -365,11 +368,6 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.openxmlformats.org/drawingml/2006/chart"
);
docx_serialize_chart_child
(
CP_XML_STREAM
(),
val
);
}
else
if
(
val
.
type
==
typeGroupShape
)
{
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
);
docx_serialize_group_child
(
CP_XML_STREAM
(),
val
);
}
}
}
}
...
...
@@ -481,8 +479,8 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
}
CP_XML_NODE
(
L"wp:extent"
)
{
CP_XML_ATTR
(
L"cx"
,
val
.
cx
);
CP_XML_ATTR
(
L"cy"
,
val
.
cy
);
CP_XML_ATTR
(
L"cx"
,
val
.
cx
);
CP_XML_ATTR
(
L"cy"
,
val
.
cy
);
}
serialize_wrap
(
CP_XML_STREAM
(),
val
);
...
...
@@ -577,16 +575,62 @@ void docx_serialize_alt_content(std::wostream & strm, _docx_drawing & val)
}
}
}
void
docx_serialize_object
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"w:object"
)
{
CP_XML_NODE
(
L"v:shape"
)
{
CP_XML_ATTR
(
L"id"
,
L"ole_"
+
val
.
objectId
);
void
docx_serialize
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
,
bool
insideOtherDrawing
)
CP_XML_ATTR
(
L"o:ole"
,
""
);
std
::
wstring
style_str
;
// = L"width:730.6pt; height:261.8pt";
style_str
+=
L"width:"
+
std
::
to_wstring
(
val
.
cx
/
12700
)
+
L"pt;"
;
style_str
+=
L"height:"
+
std
::
to_wstring
(
val
.
cy
/
12700
)
+
L"pt;"
;
CP_XML_ATTR
(
L"style"
,
style_str
);
if
(
val
.
fill
.
bitmap
)
{
CP_XML_NODE
(
L"v:imagedata"
)
{
CP_XML_ATTR
(
L"o:title"
,
L""
);
CP_XML_ATTR
(
L"r:id"
,
val
.
fill
.
bitmap
->
rId
);
}
}
}
CP_XML_NODE
(
L"o:OLEObject"
)
{
CP_XML_ATTR
(
L"r:id"
,
L"ole_"
+
val
.
objectId
);
CP_XML_ATTR
(
L"ObjectID"
,
L"_1480208863"
);
CP_XML_ATTR
(
L"DrawAspect"
,
L"Content"
);
CP_XML_ATTR
(
L"ShapeID"
,
val
.
objectId
);
CP_XML_ATTR
(
L"Type"
,
L"Embed"
);
CP_XML_ATTR
(
L"ProgID"
,
val
.
objectProgId
);
}
}
}
}
void
_docx_drawing
::
serialize
(
std
::
wostream
&
strm
/*, bool insideOtherDrawing*/
)
{
if
(
val
.
inGroup
)
return
docx_serialize_child
(
strm
,
val
);
if
(
inGroup
)
return
docx_serialize_child
(
strm
,
*
this
);
//if (insideOtherDrawing)
docx_serialize_wps
(
strm
,
val
);
//else
// docx_serialize_alt_content(strm, val);
if
(
type
==
typeObject
)
{
docx_serialize_object
(
strm
,
*
this
);
}
else
{
//if (insideOtherDrawing)
docx_serialize_wps
(
strm
,
*
this
);
//else
// docx_serialize_alt_content(strm, val);
}
}
...
...
ASCOfficeOdfFile/src/docx/docx_drawing.h
View file @
26cedc30
...
...
@@ -44,9 +44,10 @@
namespace
cpdoccore
{
namespace
oox
{
struct
_docx_drawing
:
_oox_drawing
class
_docx_drawing
:
public
_oox_drawing
{
_docx_drawing
()
:
_oox_drawing
(),
parallel
(
0
),
isInline
(
false
),
number_wrapped_paragraphs
(
0
),
posOffsetV
(
0
),
posOffsetH
(
0
)
public:
_docx_drawing
()
:
_oox_drawing
(),
parallel
(
0
),
isInline
(
false
),
number_wrapped_paragraphs
(
0
),
posOffsetV
(
0
),
posOffsetH
(
0
)
{
}
bool
isInline
;
...
...
@@ -72,15 +73,12 @@ struct _docx_drawing : _oox_drawing
_CP_OPT
(
int
)
pctWidth
;
_CP_OPT
(
int
)
pctHeight
;
int
margin_rect
[
4
];
//0-left, 1 -top, 2- right, 3 - bottom
//std::wstring distB;
// std::wstring distT;
// std::wstring distL;
// std::wstring distR;
int
margin_rect
[
4
];
//0-left, 1 -top, 2- right, 3 - bottom
std
::
wstring
content_group_
;
friend
void
docx_serialize
(
std
::
wostream
&
_Wostream
,
_docx_drawing
&
val
,
bool
insideOtherDrawing
);
void
serialize_text
(
std
::
wostream
&
strm
);
void
serialize
(
std
::
wostream
&
strm
/*, bool insideOtherDrawing*/
);
};
}
}
ASCOfficeOdfFile/src/docx/docx_package.cpp
View file @
26cedc30
...
...
@@ -96,8 +96,13 @@ void word_files::write(const std::wstring & RootPath)
{
media_
->
write
(
path
);
}
if
(
embeddings_
)
{
embeddings_
->
write
(
path
);
}
if
(
headers_footers_
)
if
(
headers_footers_
)
{
headers_footers_
->
write
(
path
);
}
...
...
@@ -136,7 +141,15 @@ void word_files::update_rels(docx_conversion_context & Context)
void
word_files
::
set_media
(
mediaitems
&
_Mediaitems
,
CApplicationFonts
*
pAppFonts
)
{
media_
=
element_ptr
(
new
media
(
_Mediaitems
,
pAppFonts
)
);
if
(
_Mediaitems
.
count_image
>
0
)
{
media_
=
element_ptr
(
new
media
(
_Mediaitems
,
pAppFonts
)
);
}
if
(
_Mediaitems
.
count_object
>
0
)
{
embeddings_
=
element_ptr
(
new
embeddings
(
_Mediaitems
)
);
embeddings_
->
set_main_document
(
get_main_document
()
);
}
}
void
word_files
::
set_styles
(
element_ptr
Element
)
...
...
@@ -197,6 +210,7 @@ void docx_charts_files::add_chart(chart_content_ptr chart)
{
charts_
.
push_back
(
chart
);
}
void
docx_charts_files
::
write
(
const
std
::
wstring
&
RootPath
)
{
std
::
wstring
path
=
RootPath
+
FILE_SEPARATOR_STR
+
L"charts"
;
...
...
ASCOfficeOdfFile/src/docx/docx_package.h
View file @
26cedc30
...
...
@@ -148,6 +148,7 @@ private:
element_ptr
fontTable_
;
element_ptr
numbering_
;
element_ptr
media_
;
element_ptr
embeddings_
;
element_ptr
headers_footers_
;
element_ptr
notes_
;
element_ptr
settings_
;
...
...
ASCOfficeOdfFile/src/docx/mediaitems.cpp
View file @
26cedc30
...
...
@@ -82,6 +82,8 @@ std::wstring static get_default_file_name(RelsType type)
return
L"chart"
;
case
typeMedia
:
return
L"media"
;
case
typeObject
:
return
L"oleObject"
;
default:
return
L""
;
}
...
...
@@ -156,21 +158,26 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
{
sub_path
=
L"charts/"
;
}
if
(
type
==
typeObject
)
{
sub_path
=
L"embeddings/"
;
}
int
number
=
0
;
if
(
type
==
typeChart
)
number
=
count_charts
+
1
;
else
if
(
type
==
typeImage
)
number
=
count_image
+
1
;
else
if
(
type
==
typeShape
)
number
=
count_shape
+
1
;
else
if
(
type
==
typeMedia
)
number
=
count_media
+
1
;
else
if
(
type
==
typeObject
)
number
=
count_object
+
1
;
else
number
=
items_
.
size
()
+
1
;
number
=
items_
.
size
()
+
1
;
inputFileName
=
create_file_name
(
href
,
type
,
isMediaInternal
,
number
);
std
::
wstring
inputPath
=
isMediaInternal
?
odf_packet_
+
FILE_SEPARATOR_STR
+
href
:
href
;
std
::
wstring
outputPath
=
isMediaInternal
?
(
sub_path
+
inputFileName
)
:
href
;
if
(
type
==
typeChart
)
outputPath
=
outputPath
+
L".xml"
;
if
(
type
==
typeChart
)
outputPath
=
outputPath
+
L".xml"
;
std
::
wstring
id
;
for
(
int
i
=
0
;
i
<
items_
.
size
();
i
++
)
...
...
@@ -192,7 +199,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
{
if
(
type
==
typeChart
)
{
id
=
std
::
wstring
(
L"chId"
)
+
std
::
to_wstring
(
count_charts
+
1
);
id
=
std
::
wstring
(
L"chId"
)
+
std
::
to_wstring
(
count_charts
+
1
);
count_charts
++
;
}
else
if
(
type
==
typeImage
)
...
...
@@ -205,12 +212,17 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
//------------------------------------------------
if
(
inputFileName
.
empty
())
return
L""
;
id
=
std
::
wstring
(
L"picId"
)
+
std
::
to_wstring
(
count_image
+
1
);
id
=
std
::
wstring
(
L"picId"
)
+
std
::
to_wstring
(
count_image
+
1
);
count_image
++
;
}
else
if
(
type
==
typeObject
)
{
id
=
std
::
wstring
(
L"objId"
)
+
std
::
to_wstring
(
count_object
+
1
);
count_object
++
;
}
else
{
id
=
std
::
wstring
(
L"rId"
)
+
std
::
to_wstring
(
count_shape
+
1
);
id
=
std
::
wstring
(
L"rId"
)
+
std
::
to_wstring
(
count_shape
+
1
);
count_shape
++
;
}
...
...
ASCOfficeOdfFile/src/docx/mediaitems.h
View file @
26cedc30
...
...
@@ -50,7 +50,7 @@ public:
count_image
=
0
;
count_tables
=
0
;
count_media
=
0
;
count_object
=
0
;
}
struct
item
...
...
@@ -77,6 +77,7 @@ public:
size_t
count_media
;
size_t
count_shape
;
size_t
count_tables
;
size_t
count_object
;
std
::
wstring
add_or_find
(
const
std
::
wstring
&
href
,
RelsType
type
,
bool
&
isInternal
);
//возможны ссылки на один и тот же объект
std
::
wstring
add_or_find
(
const
std
::
wstring
&
href
,
RelsType
type
,
bool
&
isInternal
,
std
::
wstring
&
ref
);
...
...
ASCOfficeOdfFile/src/docx/mediaitems_utils.cpp
View file @
26cedc30
...
...
@@ -57,18 +57,26 @@ bool is_internal(const std::wstring & uri, const std::wstring & packetRoot)
std
::
wstring
resultPath
=
packetRoot
+
FILE_SEPARATOR_STR
+
mediaPath
;
return
FileSystem
::
Directory
::
IsExist
(
resultPath
);
return
FileSystem
::
Directory
::
IsExist
(
resultPath
)
||
FileSystem
::
Directory
::
IsExist
(
mediaPath
)
;
}
std
::
wstring
get_rel_type
(
RelsType
type
)
{
switch
(
type
)
{
case
typeImage
:
case
typeImage
:
{
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
;
case
typeChart
:
}
case
typeChart
:
{
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
;
default:
}
case
typeObject
:
{
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"
;
}
break
;
default:
return
L""
;
}
}
...
...
ASCOfficeOdfFile/src/docx/oox_drawing.cpp
View file @
26cedc30
...
...
@@ -37,6 +37,19 @@
namespace
cpdoccore
{
static
const
std
::
wstring
_ooxShapeType
[]
=
{
L"rect"
,
//frame
L"rect"
,
//text box
L"rect"
,
//shape
L"ellipse"
,
L"ellipse"
,
L"line"
,
L"path"
,
L"custGeom"
,
//uses sub-sub type,
L"polygon"
,
};
void
svg_path
::
oox_serialize
(
std
::
wostream
&
strm
,
std
::
vector
<
svg_path
::
_polyline
>
&
path
)
{
CP_XML_WRITER
(
strm
)
...
...
@@ -55,7 +68,7 @@ void svg_path::oox_serialize(std::wostream & strm, svg_path::_polyline const & v
{
BOOST_FOREACH
(
svg_path
::
_point
const
&
p
,
val
.
points
)
{
oox_serialize
(
CP_XML_STREAM
()
,
p
);
oox_serialize
(
CP_XML_STREAM
()
,
p
);
}
}
}
...
...
@@ -235,9 +248,9 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
}
}
}
void
oox_serialize_bodyPr
(
std
::
wostream
&
strm
,
_oox_drawing
&
val
,
const
std
::
wstring
&
namespace_
)
void
_oox_drawing
::
serialize_bodyPr
(
std
::
wostream
&
strm
,
const
std
::
wstring
&
namespace_
)
{
const
std
::
vector
<
odf_reader
::
_property
>
&
prop
=
val
.
additional
;
const
std
::
vector
<
odf_reader
::
_property
>
&
prop
=
additional
;
_CP_OPT
(
bool
)
bWordArt
;
odf_reader
::
GetProperty
(
prop
,
L"wordArt"
,
bWordArt
);
...
...
@@ -257,7 +270,7 @@ void oox_serialize_bodyPr(std::wostream & strm, _oox_drawing & val, const std::w
if
(
dPaddingTop
)
CP_XML_ATTR
(
L"tIns"
,
(
int
)(
*
dPaddingTop
));
if
(
dPaddingBottom
)
CP_XML_ATTR
(
L"bIns"
,
(
int
)(
*
dPaddingBottom
));
if
(
val
.
inGroup
==
false
)
if
(
inGroup
==
false
)
{
_CP_OPT
(
int
)
iWrap
;
odf_reader
::
GetProperty
(
prop
,
L"text-wrap"
,
iWrap
);
...
...
@@ -319,7 +332,7 @@ void oox_serialize_bodyPr(std::wostream & strm, _oox_drawing & val, const std::w
}
}
void
oox_serialize_shape
(
std
::
wostream
&
strm
,
_oox_drawing
&
val
)
void
_oox_drawing
::
serialize_shape
(
std
::
wostream
&
strm
)
{
_CP_OPT
(
std
::
wstring
)
strVal
;
_CP_OPT
(
double
)
dVal
;
...
...
@@ -327,60 +340,61 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing & val)
std
::
wstring
shapeType
;
_CP_OPT
(
bool
)
bWordArt
;
odf_reader
::
GetProperty
(
val
.
additional
,
L"wordArt"
,
bWordArt
);
odf_reader
::
GetProperty
(
additional
,
L"wordArt"
,
bWordArt
);
if
(
val
.
sub_type
==
7
)
//custom
if
(
sub_type
==
7
)
//custom
{
_CP_OPT
(
int
)
iVal
;
odf_reader
::
GetProperty
(
val
.
additional
,
L"odf-custom-draw-index"
,
iVal
);
odf_reader
::
GetProperty
(
additional
,
L"odf-custom-draw-index"
,
iVal
);
if
(
iVal
)
shapeType
=
_OO_OOX_custom_shapes
[
*
iVal
].
oox
;
else
val
.
sub_type
=
6
;
//path
sub_type
=
6
;
//path
if
(
shapeType
==
L"textBox"
)
{
val
.
sub_type
=
1
;
sub_type
=
1
;
shapeType
=
L"rect"
;
}
}
else
if
(
val
.
sub_type
<
9
&&
val
.
sub_type
>=
0
)
else
if
(
sub_type
<
9
&&
sub_type
>=
0
)
{
shapeType
=
_ooxShapeType
[
val
.
sub_type
];
shapeType
=
_ooxShapeType
[
sub_type
];
}
if
(
bWordArt
)
val
.
sub_type
=
1
;
if
(
bWordArt
)
sub_type
=
1
;
CP_XML_WRITER
(
strm
)
{
if
(
val
.
sub_type
==
6
||
val
.
sub_type
==
8
)
if
(
sub_type
==
6
||
sub_type
==
8
)
{
CP_XML_NODE
(
L"a:custGeom"
)
{
oox_serialize_aLst
(
CP_XML_STREAM
(),
val
.
additional
);
oox_serialize_aLst
(
CP_XML_STREAM
(),
additional
);
CP_XML_NODE
(
L"a:ahLst"
);
CP_XML_NODE
(
L"a:gdLst"
);
CP_XML_NODE
(
L"a:rect"
)
{
CP_XML_ATTR
(
L"b"
,
L"b"
);
CP_XML_ATTR
(
L"l"
,
0
);
CP_XML_ATTR
(
L"r"
,
L"r"
);
CP_XML_ATTR
(
L"t"
,
0
);
CP_XML_ATTR
(
L"b"
,
L"b"
);
CP_XML_ATTR
(
L"l"
,
0
);
CP_XML_ATTR
(
L"r"
,
L"r"
);
CP_XML_ATTR
(
L"t"
,
0
);
}
//<a:rect b="b" l="0" r="r" t="0"/>
if
(
odf_reader
::
GetProperty
(
val
.
additional
,
L"custom_path"
,
strVal
))
if
(
odf_reader
::
GetProperty
(
additional
,
L"custom_path"
,
strVal
))
{
_CP_OPT
(
int
)
w
,
h
;
odf_reader
::
GetProperty
(
val
.
additional
,
L"custom_path_w"
,
w
);
odf_reader
::
GetProperty
(
val
.
additional
,
L"custom_path_h"
,
h
);
odf_reader
::
GetProperty
(
additional
,
L"custom_path_w"
,
w
);
odf_reader
::
GetProperty
(
additional
,
L"custom_path_h"
,
h
);
CP_XML_NODE
(
L"a:pathLst"
)
{
CP_XML_NODE
(
L"a:path"
)
{
CP_XML_ATTR
(
L"w"
,
w
?
*
w
:
val
.
cx
);
CP_XML_ATTR
(
L"h"
,
h
?
*
h
:
val
.
cy
);
CP_XML_ATTR
(
L"w"
,
w
?
*
w
:
cx
);
CP_XML_ATTR
(
L"h"
,
h
?
*
h
:
cy
);
CP_XML_STREAM
()
<<
strVal
.
get
();
}
...
...
@@ -393,12 +407,12 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing & val)
if
(
shapeType
.
length
()
<
1
)
{
shapeType
=
L"rect"
;
val
.
sub_type
=
2
;
sub_type
=
2
;
}
CP_XML_NODE
(
L"a:prstGeom"
)
//автофигура
{
CP_XML_ATTR
(
L"prst"
,
shapeType
);
if
(
!
bWordArt
)
oox_serialize_aLst
(
CP_XML_STREAM
(),
val
.
additional
);
if
(
!
bWordArt
)
oox_serialize_aLst
(
CP_XML_STREAM
(),
additional
);
}
}
if
(
bWordArt
)
...
...
@@ -407,25 +421,25 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing & val)
oox_serialize_fill
(
strm
,
no_fill
);
}
else
oox_serialize_fill
(
strm
,
val
.
fill
);
oox_serialize_fill
(
strm
,
fill
);
}
}
void
oox_serialize_xfrm
(
std
::
wostream
&
strm
,
_oox_drawing
&
val
,
const
std
::
wstring
name_space
)
void
_oox_drawing
::
serialize_xfrm
(
std
::
wostream
&
strm
,
const
std
::
wstring
&
name_space
)
{
CP_XML_WRITER
(
strm
)
{
std
::
wstring
xfrm
=
name_space
+
L":xfrm"
;
_CP_OPT
(
double
)
dRotate
;
odf_reader
::
GetProperty
(
val
.
additional
,
L"svg:rotate"
,
dRotate
);
odf_reader
::
GetProperty
(
additional
,
L"svg:rotate"
,
dRotate
);
_CP_OPT
(
double
)
dSkewX
;
odf_reader
::
GetProperty
(
val
.
additional
,
L"svg:skewX"
,
dSkewX
);
odf_reader
::
GetProperty
(
additional
,
L"svg:skewX"
,
dSkewX
);
_CP_OPT
(
double
)
dSkewY
;
odf_reader
::
GetProperty
(
val
.
additional
,
L"svg:skewY"
,
dSkewY
);
odf_reader
::
GetProperty
(
additional
,
L"svg:skewY"
,
dSkewY
);
_CP_OPT
(
double
)
dRotateAngle
;
...
...
@@ -448,18 +462,18 @@ void oox_serialize_xfrm(std::wostream & strm, _oox_drawing & val, const std::wst
CP_XML_ATTR
(
L"rot"
,
(
int
)
d
);
}
_CP_OPT
(
bool
)
bVal
;
if
(
odf_reader
::
GetProperty
(
val
.
additional
,
L"flipH"
,
bVal
))
if
(
odf_reader
::
GetProperty
(
additional
,
L"flipH"
,
bVal
))
CP_XML_ATTR
(
L"flipH"
,
bVal
.
get
());
if
(
odf_reader
::
GetProperty
(
val
.
additional
,
L"flipV"
,
bVal
))
if
(
odf_reader
::
GetProperty
(
additional
,
L"flipV"
,
bVal
))
CP_XML_ATTR
(
L"flipV"
,
bVal
.
get
());
CP_XML_NODE
(
L"a:off"
)
{
if
(
val
.
inGroup
)
if
(
inGroup
)
{
CP_XML_ATTR
(
L"x"
,
val
.
x
);
CP_XML_ATTR
(
L"y"
,
val
.
y
);
CP_XML_ATTR
(
L"x"
,
x
);
CP_XML_ATTR
(
L"y"
,
y
);
}
else
{
...
...
@@ -468,19 +482,19 @@ void oox_serialize_xfrm(std::wostream & strm, _oox_drawing & val, const std::wst
}
}
if
(
val
.
cx
>
0
||
val
.
cy
>
0
)
if
(
cx
>
0
||
cy
>
0
)
{
CP_XML_NODE
(
L"a:ext"
)
{
CP_XML_ATTR
(
L"cx"
,
val
.
cx
);
CP_XML_ATTR
(
L"cy"
,
val
.
cy
);
CP_XML_ATTR
(
L"cx"
,
cx
);
CP_XML_ATTR
(
L"cy"
,
cy
);
}
}
else
{
_CP_LOG
<<
L"[error!!!] not set size object
\n
"
;
}
if
(
val
.
type
==
typeGroupShape
)
if
(
type
==
typeGroupShape
)
{
CP_XML_NODE
(
L"a:chOff"
)
{
...
...
@@ -489,8 +503,8 @@ void oox_serialize_xfrm(std::wostream & strm, _oox_drawing & val, const std::wst
}
CP_XML_NODE
(
L"a:chExt"
)
{
CP_XML_ATTR
(
L"cx"
,
val
.
cx
);
CP_XML_ATTR
(
L"cy"
,
val
.
cy
);
CP_XML_ATTR
(
L"cx"
,
cx
);
CP_XML_ATTR
(
L"cy"
,
cy
);
}
}
}
...
...
@@ -502,7 +516,7 @@ void oox_serialize_hlink(std::wostream & strm, std::vector<_hlink_desc> const &
{
BOOST_FOREACH
(
const
_hlink_desc
&
h
,
val
)
{
if
(
h
.
object
==
true
)
if
(
h
.
in_
object
==
true
)
{
CP_XML_NODE
(
L"a:hlinkClick"
)
{
...
...
ASCOfficeOdfFile/src/docx/oox_drawing.h
View file @
26cedc30
...
...
@@ -42,22 +42,6 @@
#include "../../../Common/DocxFormat/Source/Base/Types_32.h"
static
const
int
_odf_to_oox_ShapeType
[]
=
{
4
,
4
,
4
,
34
,};
static
const
std
::
wstring
_ooxShapeType
[]
=
{
L"rect"
,
//frame
L"rect"
,
//text box
L"rect"
,
//shape
L"ellipse"
,
L"ellipse"
,
L"line"
,
L"path"
,
L"custGeom"
,
//uses sub-sub type,
L"polygon"
,
};
namespace
cpdoccore
{
namespace
oox
{
...
...
@@ -65,38 +49,47 @@ namespace oox {
{
std
::
wstring
hId
;
std
::
wstring
hRef
;
bool
object
;
bool
in_object
;
};
struct
_oox_drawing
class
_oox_drawing
{
public:
_oox_drawing
()
:
type
(
typeUnknown
),
id
(
0
),
x
(
0
),
y
(
0
),
cx
(
0
),
cy
(
0
),
sub_type
(
0
),
inGroup
(
false
),
name
(
L"object"
)
{
}
RelsType
type
;
RelsType
type
;
bool
inGroup
;
size_t
id
;
bool
inGroup
;
size_t
id
;
std
::
wstring
name
;
std
::
wstring
name
;
int
sub_type
;
//odf
_INT32
x
,
y
;
_INT32
cx
,
cy
;
_INT32
x
,
y
;
_INT32
cx
,
cy
;
_oox_fill
fill
;
_oox_fill
fill
;
int
sub_type
;
//odf
std
::
wstring
chartId
;
std
::
wstring
objectId
;
std
::
wstring
objectProgId
;
std
::
vector
<
_hlink_desc
>
hlinks
;
std
::
vector
<
_hlink_desc
>
hlinks
;
std
::
vector
<
odf_reader
::
_property
>
additional
;
std
::
vector
<
odf_reader
::
_property
>
additional
;
virtual
void
serialize
(
std
::
wostream
&
strm
)
=
0
;
void
serialize_shape
(
std
::
wostream
&
strm
);
void
serialize_xfrm
(
std
::
wostream
&
strm
,
const
std
::
wstring
&
namespace_
=
L"a"
);
void
serialize_bodyPr
(
std
::
wostream
&
strm
,
const
std
::
wstring
&
namespace_
=
L"a"
);
};
void
oox_serialize_xfrm
(
std
::
wostream
&
strm
,
_oox_drawing
&
val
,
const
std
::
wstring
namespace_
=
L"a"
);
void
oox_serialize_shape
(
std
::
wostream
&
strm
,
_oox_drawing
&
val
);
void
oox_serialize_ln
(
std
::
wostream
&
strm
,
const
std
::
vector
<
odf_reader
::
_property
>
&
val
,
bool
always_draw
=
false
);
void
oox_serialize_hlink
(
std
::
wostream
&
strm
,
const
std
::
vector
<
_hlink_desc
>
&
val
);
void
oox_serialize_bodyPr
(
std
::
wostream
&
strm
,
_oox_drawing
&
val
,
const
std
::
wstring
&
namespace_
=
L"a"
);
typedef
_CP_PTR
(
_oox_drawing
)
oox_drawing_ptr
;
void
oox_serialize_ln
(
std
::
wostream
&
strm
,
const
std
::
vector
<
odf_reader
::
_property
>
&
val
,
bool
always_draw
=
false
);
void
oox_serialize_aLst
(
std
::
wostream
&
strm
,
const
std
::
vector
<
odf_reader
::
_property
>
&
val
);
void
oox_serialize_hlink
(
std
::
wostream
&
strm
,
const
std
::
vector
<
_hlink_desc
>
&
val
);
}
}
ASCOfficeOdfFile/src/docx/oox_package.cpp
View file @
26cedc30
...
...
@@ -112,14 +112,39 @@ content_type_content * content_types_file::content()
bool
content_types_file
::
add_or_find_default
(
const
std
::
wstring
&
extension
)
{
for
(
int
i
=
0
;
i
<
content_type_content_
.
get_default
().
size
();
i
++
)
std
::
vector
<
default_content_type
>
&
defaults
=
content_type_content_
.
get_default
();
for
(
int
i
=
0
;
i
<
defaults
.
size
();
i
++
)
{
if
(
content_type_content_
.
get_default
()
[
i
].
extension
()
==
extension
)
if
(
defaults
[
i
].
extension
()
==
extension
)
return
true
;
}
content_type_content_
.
add_default
(
extension
,
get_mime_type
(
extension
));
return
true
;
}
bool
content_types_file
::
add_or_find_override
(
const
std
::
wstring
&
fileName
)
{
std
::
vector
<
override_content_type
>
&
override_
=
content_type_content_
.
get_override
();
for
(
int
i
=
0
;
i
<
override_
.
size
();
i
++
)
{
if
(
override_
[
i
].
part_name
()
==
fileName
)
return
true
;
}
std
::
wstring
content_type
;
int
pos
=
fileName
.
rfind
(
L"."
);
std
::
wstring
extension
=
pos
>=
0
?
fileName
.
substr
(
pos
+
1
)
:
L""
;
if
(
extension
==
L"xlsx"
)
content_type
=
L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
;
content_type_content_
.
add_override
(
fileName
,
content_type
);
}
void
content_types_file
::
set_media
(
mediaitems
&
_Mediaitems
)
{
BOOST_FOREACH
(
mediaitems
::
item
&
item
,
_Mediaitems
.
items
()
)
...
...
@@ -285,7 +310,7 @@ void media::write(const std::wstring & RootPath)
BOOST_FOREACH
(
mediaitems
::
item
&
item
,
mediaitems_
.
items
()
)
{
if
(
item
.
mediaInternal
&&
item
.
valid
&&
item
.
type
==
typeImage
)
if
(
item
.
mediaInternal
&&
item
.
valid
&&
(
item
.
type
==
typeImage
||
item
.
type
==
typeMedia
)
)
{
std
::
wstring
&
file_name
=
item
.
href
;
std
::
wstring
file_name_out
=
RootPath
+
FILE_SEPARATOR_STR
+
item
.
outputName
;
...
...
@@ -301,9 +326,7 @@ void media::write(const std::wstring & RootPath)
}
}
///////////////////////////////////////////////////////////////////////////////////
//------------------------------------------------------------------------------------------------------------
charts
::
charts
(
mediaitems
&
_ChartsItems
)
:
chartsitems_
(
_ChartsItems
)
{
}
...
...
@@ -312,6 +335,30 @@ void charts::write(const std::wstring & RootPath)
{
}
//--------------------------------------------------------------------------------------------------------------
embeddings
::
embeddings
(
mediaitems
&
_EmbeddingsItems
)
:
embeddingsitems_
(
_EmbeddingsItems
)
{
}
void
embeddings
::
write
(
const
std
::
wstring
&
RootPath
)
{
std
::
wstring
path
=
RootPath
+
FILE_SEPARATOR_STR
+
L"embeddings"
;
FileSystem
::
Directory
::
CreateDirectory
(
path
.
c_str
());
content_types_file
&
content_types
=
get_main_document
()
->
get_content_types_file
();
BOOST_FOREACH
(
mediaitems
::
item
&
item
,
embeddingsitems_
.
items
()
)
{
if
(
item
.
mediaInternal
&&
item
.
valid
&&
item
.
type
==
typeObject
)
{
content_types
.
add_or_find_override
(
std
::
wstring
(
L"/word/"
)
+
item
.
outputName
);
std
::
wstring
file_name_out
=
RootPath
+
FILE_SEPARATOR_STR
+
item
.
outputName
;
NSFile
::
CFileBinary
::
Copy
(
item
.
href
,
file_name_out
);
}
}
}
}
}
}
ASCOfficeOdfFile/src/docx/oox_package.h
View file @
26cedc30
...
...
@@ -81,6 +81,7 @@ public:
content_types_file
();
void
write
(
const
std
::
wstring
&
RootPath
);
bool
add_or_find_default
(
const
std
::
wstring
&
extension
);
bool
add_or_find_override
(
const
std
::
wstring
&
fileName
);
void
set_media
(
mediaitems
&
_Mediaitems
);
content_type_content
*
content
();
...
...
@@ -224,7 +225,18 @@ private:
mediaitems
&
chartsitems_
;
};
class
embeddings
:
public
element
{
public:
embeddings
(
mediaitems
&
_EmbeddingsItems
);
public:
virtual
void
write
(
const
std
::
wstring
&
RootPath
);
private:
mediaitems
&
embeddingsitems_
;
};
}
// namespace package
}
// namespace oox
}
// namespace cpdoccore
...
...
ASCOfficeOdfFile/src/docx/oox_rels.h
View file @
26cedc30
...
...
@@ -40,7 +40,7 @@
namespace
cpdoccore
{
namespace
oox
{
enum
RelsType
{
typeUnknown
=
0
,
typeImage
,
typeChart
,
typeShape
,
typeTable
,
typeHyperlink
,
typeComment
,
typeMedia
,
typeGroupShape
};
enum
RelsType
{
typeUnknown
=
0
,
typeImage
,
typeChart
,
typeShape
,
typeTable
,
typeHyperlink
,
typeComment
,
typeMedia
,
typeGroupShape
,
typeObject
};
struct
_rel
{
...
...
ASCOfficeOdfFile/src/docx/pptx_drawing.cpp
View file @
26cedc30
...
...
@@ -61,7 +61,8 @@ void pptx_serialize_text(std::wostream & strm, _pptx_drawing & val)
{
CP_XML_NODE
(
L"p:txBody"
)
{
oox_serialize_bodyPr
(
CP_XML_STREAM
(),
val
);
val
.
serialize_bodyPr
(
CP_XML_STREAM
());
if
(
strTextContent
)
{
CP_XML_STREAM
()
<<
strTextContent
.
get
();
...
...
@@ -106,14 +107,14 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val)
CP_XML_NODE
(
L"p:spPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
val
.
serialize_xfrm
(
CP_XML_STREAM
()
);
CP_XML_NODE
(
L"a:prstGeom"
)
{
CP_XML_ATTR
(
L"prst"
,
L"rect"
);
CP_XML_NODE
(
L"a:avLst"
);
}
oox_serialize_ln
(
CP_XML_STREAM
(),
val
.
additional
);
oox_serialize_ln
(
CP_XML_STREAM
(),
val
.
additional
);
}
//_CP_OPT(std::wstring) strTextContent;
//odf::GetProperty(properties,L"text-content",strTextContent);
...
...
@@ -169,13 +170,13 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
if
(
!
bNoRect
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
val
.
serialize_xfrm
(
CP_XML_STREAM
());
val
.
serialize_shape
(
CP_XML_STREAM
());
oox_serialize_shape
(
CP_XML_STREAM
(),
val
);
oox_serialize_ln
(
CP_XML_STREAM
(),
val
.
additional
);
}
}
pptx_serialize_text
(
CP_XML_STREAM
(),
val
);
pptx_serialize_text
(
CP_XML_STREAM
(),
val
);
}
}
// CP_XML_WRITER
}
...
...
@@ -197,7 +198,7 @@ void pptx_serialize_chart(std::wostream & strm, _pptx_drawing & val)
CP_XML_NODE
(
L"p:cNvGraphicFramePr"
);
CP_XML_NODE
(
L"p:nvPr"
);
}
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
,
L"p"
);
val
.
serialize_xfrm
(
CP_XML_STREAM
(),
L"p"
);
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
...
...
@@ -210,7 +211,7 @@ void pptx_serialize_chart(std::wostream & strm, _pptx_drawing & val)
{
CP_XML_ATTR
(
L"xmlns:c"
,
L"http://schemas.openxmlformats.org/drawingml/2006/chart"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
CP_XML_ATTR
(
L"r:id"
,
val
.
char
tId
);
CP_XML_ATTR
(
L"r:id"
,
val
.
objec
tId
);
}
}
}
...
...
@@ -235,7 +236,7 @@ void pptx_serialize_table(std::wostream & strm, _pptx_drawing & val)
CP_XML_NODE
(
L"p:cNvGraphicFramePr"
);
CP_XML_NODE
(
L"p:nvPr"
);
}
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
,
L"p"
);
val
.
serialize_xfrm
(
CP_XML_STREAM
(),
L"p"
);
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
...
...
@@ -258,23 +259,24 @@ void pptx_serialize_table(std::wostream & strm, _pptx_drawing & val)
}
// CP_XML_WRITER
}
void
pptx_serialize
(
std
::
wostream
&
strm
,
_pptx_drawing
&
val
)
void
_pptx_drawing
::
serialize
(
std
::
wostream
&
strm
)
{
if
(
val
.
type
==
typeShape
)
if
(
type
==
typeShape
)
{
pptx_serialize_shape
(
strm
,
val
);
serialize_shape
(
strm
);
}
else
if
(
val
.
type
==
typeImage
)
else
if
(
type
==
typeImage
)
{
pptx_serialize_image
(
strm
,
val
);
pptx_serialize_image
(
strm
,
*
this
);
}
else
if
(
val
.
type
==
typeChart
)
else
if
(
type
==
typeChart
)
{
pptx_serialize_chart
(
strm
,
val
);
pptx_serialize_chart
(
strm
,
*
this
);
}
else
if
(
val
.
type
==
typeTable
)
else
if
(
type
==
typeTable
)
{
pptx_serialize_table
(
strm
,
val
);
pptx_serialize_table
(
strm
,
*
this
);
}
}
...
...
ASCOfficeOdfFile/src/docx/pptx_drawing.h
View file @
26cedc30
...
...
@@ -43,13 +43,15 @@
namespace
cpdoccore
{
namespace
oox
{
struct
_pptx_drawing
:
_oox_drawing
class
_pptx_drawing
:
public
_oox_drawing
{
_pptx_drawing
()
:
place_holder_idx_
(
-
1
){}
std
::
wstring
place_holder_type_
;
int
place_holder_idx_
;
public:
_pptx_drawing
()
:
_oox_drawing
(),
place_holder_idx_
(
-
1
)
{}
std
::
wstring
place_holder_type_
;
int
place_holder_idx_
;
friend
void
pptx_serialize
(
std
::
wostream
&
_Wostream
,
_pptx_drawing
&
val
);
void
serialize
(
std
::
wostream
&
_Wostream
);
};
}
...
...
ASCOfficeOdfFile/src/docx/pptx_drawings.cpp
View file @
26cedc30
...
...
@@ -92,9 +92,9 @@ public:
}
void
serialize
(
std
::
wostream
&
strm
)
{
BOOST_FOREACH
(
_pptx_drawing
&
d
,
pptx_drawings_
)
for
(
int
i
=
0
;
i
<
pptx_drawings_
.
size
();
i
++
)
{
pptx_
serialize
(
strm
,
d
);
pptx_
drawings_
[
i
].
serialize
(
strm
);
}
}
...
...
ASCOfficeOdfFile/src/docx/pptx_drawings.h
View file @
26cedc30
...
...
@@ -40,8 +40,7 @@
namespace
cpdoccore
{
namespace
oox
{
struct
_pptx_drawing
;
class
_pptx_drawing
;
class
rels
;
class
pptx_drawings
;
...
...
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
View file @
26cedc30
...
...
@@ -477,8 +477,8 @@ void pptx_slide_context::process_charts()
////////////////////////////////////////////////////////////////
std
::
wstring
ref
;
bool
isMediaInternal
=
true
;
drawing
.
char
tId
=
impl_
->
get_mediaitems
().
add_or_find
(
pic
.
xlink_href_
,
typeChart
,
isMediaInternal
,
ref
);
impl_
->
add_drawing
(
drawing
,
isMediaInternal
,
drawing
.
char
tId
,
ref
,
typeChart
);
drawing
.
objec
tId
=
impl_
->
get_mediaitems
().
add_or_find
(
pic
.
xlink_href_
,
typeChart
,
isMediaInternal
,
ref
);
impl_
->
add_drawing
(
drawing
,
isMediaInternal
,
drawing
.
objec
tId
,
ref
,
typeChart
);
}
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp
View file @
26cedc30
...
...
@@ -48,7 +48,7 @@ std::wostream & operator << (std::wostream & strm, xlsx_drawing_position::type_t
}
}
void
xlsx_serialize_text
(
std
::
wostream
&
strm
,
_xlsx_drawing
&
val
)
void
xlsx_serialize_text
(
std
::
wostream
&
strm
,
_xlsx_drawing
&
val
)
{
_CP_OPT
(
std
::
wstring
)
strTextContent
;
odf_reader
::
GetProperty
(
val
.
additional
,
L"text-content"
,
strTextContent
);
...
...
@@ -60,7 +60,8 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val )
{
CP_XML_NODE
(
L"xdr:txBody"
)
{
oox_serialize_bodyPr
(
CP_XML_STREAM
(),
val
);
val
.
serialize_bodyPr
(
CP_XML_STREAM
());
CP_XML_NODE
(
L"a:lstStyle"
);
if
(
strTextContent
)
{
...
...
@@ -70,30 +71,30 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val )
}
}
void
xlsx_
serialize
(
std
::
wostream
&
strm
,
const
xlsx_drawing_position
&
val
)
void
xlsx_
drawing_position
::
serialize
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
std
::
wstring
(
L"xdr:"
)
+
(
val
.
type
==
xlsx_drawing_position
::
from
?
L"from"
:
L"to"
)
)
CP_XML_NODE
(
std
::
wstring
(
L"xdr:"
)
+
(
type
==
xlsx_drawing_position
::
from
?
L"from"
:
L"to"
)
)
{
CP_XML_NODE
(
L"xdr:col"
)
{
CP_XML_CONTENT
(
val
.
position
.
col
);
CP_XML_CONTENT
(
position
.
col
);
}
CP_XML_NODE
(
L"xdr:colOff"
)
{
CP_XML_CONTENT
(
static_cast
<
size_t
>
(
val
.
position
.
colOff
));
CP_XML_CONTENT
(
static_cast
<
size_t
>
(
position
.
colOff
));
}
CP_XML_NODE
(
L"xdr:row"
)
{
CP_XML_CONTENT
(
val
.
position
.
row
);
CP_XML_CONTENT
(
position
.
row
);
}
CP_XML_NODE
(
L"xdr:rowOff"
)
{
CP_XML_CONTENT
(
static_cast
<
size_t
>
(
val
.
position
.
rowOff
));
CP_XML_CONTENT
(
static_cast
<
size_t
>
(
position
.
rowOff
));
}
}
}
...
...
@@ -129,7 +130,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
CP_XML_NODE
(
L"xdr:spPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
val
.
serialize_xfrm
(
CP_XML_STREAM
()
);
CP_XML_NODE
(
L"a:prstGeom"
)
{
...
...
@@ -166,9 +167,9 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
}
// xdr:nv_Pr
CP_XML_NODE
(
L"xdr:spPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
val
.
serialize_xfrm
(
CP_XML_STREAM
()
);
oox_serialize_shape
(
CP_XML_STREAM
(),
val
);
val
.
serialize_shape
(
CP_XML_STREAM
()
);
bool
draw_always
=
false
;
if
(
val
.
sub_type
==
5
||
val
.
sub_type
==
6
)
//line собственно ) - если ее нет - в свойствах будет
...
...
@@ -198,7 +199,7 @@ void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val)
}
CP_XML_NODE
(
L"xdr:grpSpPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
val
.
serialize_xfrm
(
CP_XML_STREAM
()
);
}
CP_XML_STREAM
()
<<
val
.
content_group_
;
...
...
@@ -222,7 +223,7 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
CP_XML_NODE
(
L"xdr:cNvGraphicFramePr"
);
}
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
,
L"xdr"
);
val
.
serialize_xfrm
(
CP_XML_STREAM
(),
L"xdr"
);
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
...
...
@@ -235,7 +236,7 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_ATTR
(
L"xmlns:c"
,
L"http://schemas.openxmlformats.org/drawingml/2006/chart"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
CP_XML_ATTR
(
L"r:id"
,
val
.
char
tId
);
CP_XML_ATTR
(
L"r:id"
,
val
.
objec
tId
);
}
}
}
...
...
@@ -261,22 +262,24 @@ void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
xlsx_serialize_group
(
strm
,
val
);
}
}
void
xlsx_serialize
(
std
::
wostream
&
strm
,
_xlsx_drawing
&
val
)
void
_xlsx_drawing
::
serialize
(
std
::
wostream
&
strm
)
{
if
(
val
.
inGroup
)
return
xlsx_serialize_object
(
strm
,
val
);
if
(
inGroup
)
return
xlsx_serialize_object
(
strm
,
*
this
);
CP_XML_WRITER
(
strm
)
{
if
(
val
.
type_anchor
==
1
)
if
(
type_anchor
==
1
)
{
CP_XML_NODE
(
L"xdr:twoCellAnchor"
)
{
CP_XML_ATTR
(
L"editAs"
,
L"oneCell"
);
//"absolute");oneCell
xlsx_serialize
(
CP_XML_STREAM
(),
val
.
from_
);
xlsx_serialize
(
CP_XML_STREAM
(),
val
.
to_
);
from_
.
serialize
(
CP_XML_STREAM
()
);
to_
.
serialize
(
CP_XML_STREAM
()
);
xlsx_serialize_object
(
CP_XML_STREAM
(),
val
);
xlsx_serialize_object
(
CP_XML_STREAM
(),
*
this
);
CP_XML_NODE
(
L"xdr:clientData"
);
}
...
...
@@ -287,17 +290,17 @@ void xlsx_serialize(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_NODE
(
L"xdr:pos"
)
{
CP_XML_ATTR
(
L"x"
,
val
.
x
);
CP_XML_ATTR
(
L"y"
,
val
.
y
);
CP_XML_ATTR
(
L"x"
,
x
);
CP_XML_ATTR
(
L"y"
,
y
);
}
CP_XML_NODE
(
L"xdr:ext"
)
{
CP_XML_ATTR
(
L"cx"
,
val
.
cx
);
CP_XML_ATTR
(
L"cy"
,
val
.
cy
);
CP_XML_ATTR
(
L"cx"
,
cx
);
CP_XML_ATTR
(
L"cy"
,
cy
);
}
xlsx_serialize_object
(
CP_XML_STREAM
(),
val
);
xlsx_serialize_object
(
CP_XML_STREAM
(),
*
this
);
CP_XML_NODE
(
L"xdr:clientData"
);
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawing.h
View file @
26cedc30
...
...
@@ -46,16 +46,16 @@ namespace oox {
struct
xlsx_drawing_position
{
enum
type_t
{
from
,
to
};
type_t
type
;
xlsx_table_position
position
;
enum
type_t
{
from
,
to
}
type
;
xlsx_table_position
position
;
friend
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
xlsx_drawing_position
const
&
val
);
void
serialize
(
std
::
wostream
&
_Wostream
);
};
struct
_xlsx_drawing
:
_oox_drawing
class
_xlsx_drawing
:
public
_oox_drawing
{
public:
_xlsx_drawing
()
:
_oox_drawing
(),
type_anchor
(
1
)
{}
int
type_anchor
;
...
...
@@ -65,8 +65,7 @@ struct _xlsx_drawing : _oox_drawing
std
::
wstring
content_group_
;
friend
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
_xlsx_drawing
&
val
);
void
serialize
(
std
::
wostream
&
_Wostream
);
};
}
}
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
View file @
26cedc30
...
...
@@ -535,11 +535,11 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
std
::
wstring
ref
;
bool
isMediaInternal
=
true
;
drawing
.
char
tId
=
impl_
->
get_mediaitems
().
add_or_find
(
obj
.
xlink_href_
,
obj
.
type_
,
isMediaInternal
,
ref
);
xlsx_drawings_
->
add
(
drawing
,
isMediaInternal
,
drawing
.
char
tId
,
ref
,
obj
.
type_
);
drawing
.
objec
tId
=
impl_
->
get_mediaitems
().
add_or_find
(
obj
.
xlink_href_
,
obj
.
type_
,
isMediaInternal
,
ref
);
xlsx_drawings_
->
add
(
drawing
,
isMediaInternal
,
drawing
.
objec
tId
,
ref
,
obj
.
type_
);
if
(
drawing
.
inGroup
)
impl_
->
get_drawings
()
->
add
(
isMediaInternal
,
drawing
.
char
tId
,
ref
,
obj
.
type_
);
// не объект
impl_
->
get_drawings
()
->
add
(
isMediaInternal
,
drawing
.
objec
tId
,
ref
,
obj
.
type_
);
// не объект
}
void
xlsx_drawing_context
::
process_shape
(
drawing_object_description
&
obj
,
_xlsx_drawing
&
drawing
,
xlsx_drawings_ptr
xlsx_drawings_
)
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawings.cpp
View file @
26cedc30
...
...
@@ -86,7 +86,7 @@ public:
{
for
(
int
i
=
0
;
i
<
xlsx_drawings_
.
size
();
i
++
)
{
xlsx_
serialize
(
strm
,
xlsx_drawings_
[
i
]
);
xlsx_
drawings_
[
i
].
serialize
(
strm
);
}
}
else
...
...
@@ -101,7 +101,7 @@ public:
for
(
int
i
=
0
;
i
<
xlsx_drawings_
.
size
();
i
++
)
{
xlsx_
serialize
(
CP_XML_STREAM
(),
xlsx_drawings_
[
i
]
);
xlsx_
drawings_
[
i
].
serialize
(
CP_XML_STREAM
()
);
}
}
}
...
...
ASCOfficeOdfFile/src/odf/chart_build_oox.cpp
View file @
26cedc30
...
...
@@ -225,6 +225,10 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
Context
.
set_run_state
(
runState
);
Context
.
set_paragraph_state
(
pState
);
}
else
if
(
object_type_
==
4
&&
office_spreadsheet_
)
{
//office_spreadsheet_
}
}
void
object_odf_context
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
...
...
@@ -544,7 +548,7 @@ bool process_build_object::visit_rows(unsigned int repeated)
//////////////////////////////////////////////////
void
process_build_object
::
on_not_impl
(
std
::
string
const
&
message
)
{
_CP_LOG
<<
L"[process_
draw_char
t visitor] : not impliment for
\"
"
<<
utf8_to_utf16
(
message
)
<<
L"
\"
"
<<
std
::
endl
;
_CP_LOG
<<
L"[process_
objec
t visitor] : not impliment for
\"
"
<<
utf8_to_utf16
(
message
)
<<
L"
\"
"
<<
std
::
endl
;
}
//////////////////////////////////////////////////
...
...
@@ -570,14 +574,18 @@ void process_build_object::visit(office_chart& val)
void
process_build_object
::
visit
(
office_text
&
val
)
{
object_odf_context_
.
object_type_
=
2
;
object_odf_context_
.
office_text_
=
&
val
;
//конвертация будет уровнем выше
object_odf_context_
.
office_text_
=
&
val
;
//конвертация будет уровнем выше
}
void
process_build_object
::
visit
(
office_math
&
val
)
{
object_odf_context_
.
object_type_
=
3
;
//0;//временно замещающая картинка
object_odf_context_
.
office_math_
=
&
val
;
//конвертация будет уровнем выше
object_odf_context_
.
object_type_
=
3
;
//= 0 - временно замещающая картинка
object_odf_context_
.
office_math_
=
&
val
;
//конвертация будет уровнем выше
}
void
process_build_object
::
visit
(
office_spreadsheet
&
val
)
{
object_odf_context_
.
object_type_
=
4
;
object_odf_context_
.
office_spreadsheet_
=
&
val
;
//конвертация будет уровнем выше
}
void
process_build_object
::
visit
(
const
chart_chart
&
val
)
{
object_odf_context_
.
object_type_
=
1
;
...
...
ASCOfficeOdfFile/src/odf/chart_build_oox.h
View file @
26cedc30
...
...
@@ -52,6 +52,7 @@
#include "office_body.h"
#include "office_chart.h"
#include "office_text.h"
#include "office_spreadsheet.h"
#include "math_elements.h"
#include "table.h"
#include "odfcontext.h"
...
...
@@ -118,6 +119,7 @@ public:
object_type_
(
0
),
office_text_
(
NULL
),
office_math_
(
NULL
),
office_spreadsheet_
(
NULL
),
baseRef_
(
ref
),
baseFontHeight_
(
12
)
{
...
...
@@ -159,6 +161,7 @@ public:
int
object_type_
;
office_text
*
office_text_
;
office_math
*
office_math_
;
office_spreadsheet
*
office_spreadsheet_
;
int
baseFontHeight_
;
std
::
wstring
baseRef_
;
...
...
@@ -211,7 +214,6 @@ public:
///////////////////////////////////////////
};
// Класс для обхода всех элеменов office:object для построения диаграммы
class
process_build_object
:
public
base_visitor
,
...
...
@@ -222,7 +224,8 @@ class process_build_object
public
visitor
<
office_chart
>
,
public
visitor
<
office_text
>
,
public
visitor
<
office_math
>
,
public
visitor
<
office_spreadsheet
>
,
public
const_visitor
<
chart_chart
>
,
public
const_visitor
<
chart_title
>
,
...
...
@@ -283,47 +286,48 @@ private:
public:
virtual
void
visit
(
const
office_document_content
&
val
);
virtual
void
visit
(
office_document_content
&
val
);
virtual
void
visit
(
office_document_content
&
val
);
virtual
void
visit
(
office_body
&
val
);
virtual
void
visit
(
office_chart
&
val
);
virtual
void
visit
(
office_text
&
val
);
virtual
void
visit
(
office_math
&
val
);
virtual
void
visit
(
const
chart_chart
&
val
);
virtual
void
visit
(
const
chart_title
&
val
);
virtual
void
visit
(
const
chart_subtitle
&
val
);
virtual
void
visit
(
const
chart_footer
&
val
);
virtual
void
visit
(
const
chart_legend
&
val
);
virtual
void
visit
(
office_body
&
val
);
virtual
void
visit
(
office_chart
&
val
);
virtual
void
visit
(
office_text
&
val
);
virtual
void
visit
(
office_math
&
val
);
virtual
void
visit
(
office_spreadsheet
&
val
);
virtual
void
visit
(
const
chart_chart
&
val
);
virtual
void
visit
(
const
chart_title
&
val
);
virtual
void
visit
(
const
chart_subtitle
&
val
);
virtual
void
visit
(
const
chart_footer
&
val
);
virtual
void
visit
(
const
chart_legend
&
val
);
virtual
void
visit
(
const
chart_plot_area
&
val
);
virtual
void
visit
(
const
chart_axis
&
val
);
virtual
void
visit
(
const
chart_series
&
val
);
virtual
void
visit
(
const
chart_domain
&
val
);
virtual
void
visit
(
const
chart_data_point
&
val
);
virtual
void
visit
(
const
chart_mean_value
&
val
);
virtual
void
visit
(
const
chart_error_indicator
&
val
);
virtual
void
visit
(
const
chart_axis
&
val
);
virtual
void
visit
(
const
chart_series
&
val
);
virtual
void
visit
(
const
chart_domain
&
val
);
virtual
void
visit
(
const
chart_data_point
&
val
);
virtual
void
visit
(
const
chart_mean_value
&
val
);
virtual
void
visit
(
const
chart_error_indicator
&
val
);
virtual
void
visit
(
const
chart_regression_curve
&
val
);
virtual
void
visit
(
const
chart_equation
&
val
);
virtual
void
visit
(
const
chart_categories
&
val
);
virtual
void
visit
(
const
chart_grid
&
val
);
virtual
void
visit
(
const
chart_wall
&
val
);
virtual
void
visit
(
const
chart_floor
&
val
);
virtual
void
visit
(
const
table_table
&
val
);
virtual
void
visit
(
const
table_table_rows
&
val
);
virtual
void
visit
(
const
table_rows_no_group
&
val
);
virtual
void
visit
(
const
table_table_row_group
&
val
);
virtual
void
visit
(
const
chart_equation
&
val
);
virtual
void
visit
(
const
chart_categories
&
val
);
virtual
void
visit
(
const
chart_grid
&
val
);
virtual
void
visit
(
const
chart_wall
&
val
);
virtual
void
visit
(
const
chart_floor
&
val
);
virtual
void
visit
(
const
table_table
&
val
);
virtual
void
visit
(
const
table_table_rows
&
val
);
virtual
void
visit
(
const
table_rows_no_group
&
val
);
virtual
void
visit
(
const
table_table_row_group
&
val
);
virtual
void
visit
(
const
table_table_header_rows
&
val
);
virtual
void
visit
(
table_table_header_rows
&
val
);
virtual
void
visit
(
table_table_header_rows
&
val
);
virtual
void
visit
(
table_table_rows
&
val
);
virtual
void
visit
(
const
table_table_row
&
val
);
virtual
void
visit
(
table_table_rows
&
val
);
virtual
void
visit
(
const
table_table_row
&
val
);
virtual
void
visit
(
const
table_columns_no_group
&
val
);
virtual
void
visit
(
table_table_header_columns
&
val
);
virtual
void
visit
(
table_table_columns
&
val
);
virtual
void
visit
(
const
table_columns_no_group
&
val
);
virtual
void
visit
(
table_table_header_columns
&
val
);
virtual
void
visit
(
table_table_columns
&
val
);
virtual
void
visit
(
const
table_table_column_group
&
val
);
virtual
void
visit
(
const
table_table_column
&
val
);
virtual
void
visit
(
const
table_table_column
&
val
);
virtual
void
visit
(
const
table_table_cell
&
val
);
...
...
ASCOfficeOdfFile/src/odf/datatypes/length.cpp
View file @
26cedc30
...
...
@@ -184,7 +184,7 @@ double inch_to_pt(double Val)
double
emu_to_pt
(
double
Val
)
{
return
Val
*
72.0
/
(
360000.0
*
2.54
);
return
Val
/
12700
;
// 1 / 12700 =
72.0 / (360000.0 * 2.54);
}
double
px_to_pt
(
double
Val
)
{
...
...
ASCOfficeOdfFile/src/odf/draw_frame.h
View file @
26cedc30
...
...
@@ -35,12 +35,20 @@
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
#include "../docx/xlsxconversioncontext.h"
//#include "../docx/xlsxconversioncontext.h"
namespace
cpdoccore
{
namespace
oox
{
class
_oox_drawing
;
}
typedef
shared_ptr
<
oox
::
_oox_drawing
>::
Type
oox_drawing_ptr
;
namespace
odf_reader
{
/// draw-image-attlist
...
...
@@ -54,7 +62,6 @@ public:
};
class
draw_image
:
public
office_element_impl
<
draw_image
>
{
public:
...
...
@@ -150,20 +157,17 @@ public:
static
const
ElementType
type
=
typeDrawFrame
;
CPDOCCORE_DEFINE_VISITABLE
();
draw_frame
()
:
oox_drawing_
(
NULL
)
{}
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
virtual
void
pptx_convert_placeHolder
(
oox
::
pptx_conversion_context
&
Context
);
public:
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
public:
int
idx_in_owner
;
odf_types
::
common_presentation_attlist
common_presentation_attlist_
;
odf_types
::
union_common_draw_attlists
common_draw_attlists_
;
...
...
@@ -184,6 +188,13 @@ public:
friend
class
odf_document
;
friend
class
draw_image
;
friend
class
draw_chart
;
oox_drawing_ptr
oox_drawing_
;
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_frame
);
...
...
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
26cedc30
This diff is collapsed.
Click to expand it.
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
View file @
26cedc30
...
...
@@ -55,7 +55,7 @@
#include "odf_document_impl.h"
#include "calcs_styles.h"
#include "../docx/
oo
x_drawing.h"
#include "../docx/
ppt
x_drawing.h"
#include "chart_build_oox.h"
#include "datatypes/length.h"
...
...
@@ -198,14 +198,11 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
Context
.
get_text_context
().
start_base_style
(
baseStyleName
,
odf_types
::
style_family
::
Presentation
);
////////////////////////////////////////////////
int
i
=
0
;
int
size
=
content_
.
size
();
while
(
true
)
oox_drawing_
=
oox_drawing_ptr
(
new
oox
::
_pptx_drawing
())
;
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
if
(
i
>=
size
)
break
;
office_element_ptr
const
&
elm
=
content_
[
i
];
elm
->
pptx_convert
(
Context
);
i
++
;
content_
[
i
]
->
pptx_convert
(
Context
);
}
Context
.
get_text_context
().
end_base_style
();
...
...
@@ -219,13 +216,9 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
////////////////////////////////////в принципе достаточно общая часть ...
Context
.
get_text_context
().
start_object
();
int
i
=
0
;
int
size
=
content_
.
size
();
while
(
true
)
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
if
(
i
>=
size
)
break
;
content_
[
i
]
->
pptx_convert
(
Context
);
i
++
;
content_
[
i
]
->
pptx_convert
(
Context
);
}
std
::
wstring
text_content_
=
Context
.
get_text_context
().
end_object
();
...
...
@@ -241,13 +234,9 @@ void draw_chart::pptx_convert(oox::pptx_conversion_context & Context)
const
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
Context
.
get_slide_context
().
start_chart
(
href
);
int
i
=
0
;
int
size
=
content_
.
size
();
while
(
true
)
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
if
(
i
>=
size
)
break
;
content_
[
i
]
->
pptx_convert
(
Context
);
i
++
;
content_
[
i
]
->
pptx_convert
(
Context
);
}
Context
.
get_slide_context
().
end_chart
();
}
...
...
@@ -256,14 +245,11 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
Context
.
get_slide_context
().
start_shape
(
2
);
//rect с наваротами
Context
.
get_text_context
().
start_object
();
int
i
=
0
;
int
size
=
content_
.
size
();
while
(
true
)
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
if
(
i
>=
size
)
break
;
content_
[
i
]
->
pptx_convert
(
Context
);
i
++
;
content_
[
i
]
->
pptx_convert
(
Context
);
}
std
::
wstring
text_content_
=
Context
.
get_text_context
().
end_object
();
if
(
text_content_
.
length
()
>
0
)
...
...
@@ -330,7 +316,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
std
::
wstring
text_content_
=
Context
.
get_text_context
().
end_object
();
Context
.
get_text_context
().
set_local_styles_container
(
NULL
);
//вытираем вручную ...
if
(
text_content_
.
length
()
>
0
)
if
(
!
text_content_
.
empty
()
)
{
Context
.
get_slide_context
().
set_property
(
_property
(
L"text-content"
,
text_content_
));
}
...
...
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
View file @
26cedc30
...
...
@@ -53,7 +53,7 @@
#include "odf_document_impl.h"
#include "calcs_styles.h"
#include "../docx/
oo
x_drawing.h"
#include "../docx/
xls
x_drawing.h"
#include "chart_build_oox.h"
#include "datatypes/length.h"
...
...
@@ -190,6 +190,9 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
Compute_GraphicFill
(
properties
.
common_draw_fill_attlist_
,
properties
.
style_background_image_
,
Context
.
root
()
->
odf_context
().
drawStyles
()
,
fill
);
Context
.
get_drawing_context
().
set_fill
(
fill
);
oox_drawing_
=
oox_drawing_ptr
(
new
oox
::
_xlsx_drawing
());
////////////////////////////////////////////////
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
...
...
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