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
4d5b9503
Commit
4d5b9503
authored
May 11, 2016
by
ElenaSubbotina
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - конвертация смартаартов, организционных диаграмм ...
parent
1fc2e22b
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
403 additions
and
214 deletions
+403
-214
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
+29
-19
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
+121
-103
ASCOfficeOdfFile/src/docx/docx_drawing.h
ASCOfficeOdfFile/src/docx/docx_drawing.h
+5
-2
ASCOfficeOdfFile/src/docx/mediaitems.h
ASCOfficeOdfFile/src/docx/mediaitems.h
+1
-1
ASCOfficeOdfFile/src/odf/draw_frame.h
ASCOfficeOdfFile/src/odf/draw_frame.h
+3
-5
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+91
-19
ASCOfficeOdfFile/src/odf/draw_shapes_docx.cpp
ASCOfficeOdfFile/src/odf/draw_shapes_docx.cpp
+10
-10
DesktopEditor/raster/Metafile/StarView/SvmFile.cpp
DesktopEditor/raster/Metafile/StarView/SvmFile.cpp
+129
-41
DesktopEditor/raster/Metafile/StarView/SvmFile.h
DesktopEditor/raster/Metafile/StarView/SvmFile.h
+7
-2
DesktopEditor/raster/Metafile/StarView/SvmPlayer.cpp
DesktopEditor/raster/Metafile/StarView/SvmPlayer.cpp
+0
-2
DesktopEditor/raster/Metafile/StarView/SvmPlayer.h
DesktopEditor/raster/Metafile/StarView/SvmPlayer.h
+6
-9
DesktopEditor/raster/Metafile/TestMain.cpp
DesktopEditor/raster/Metafile/TestMain.cpp
+1
-1
No files found.
ASCOfficeOdfFile/src/docx/docx_conversion_context.h
View file @
4d5b9503
...
...
@@ -112,7 +112,7 @@ public:
current_level_
++
;
objects_count_
++
;
_frame_
fr
=
{
drawFrame
,
L""
,
objects_count_
,
false
};
_frame_
fr
=
{
drawFrame
,
L""
,
objects_count_
,
false
};
frames_
.
push_back
(
fr
);
}
...
...
@@ -125,6 +125,14 @@ public:
current_object_name_
=
L""
;
current_shape_
=
drawShape
;
}
void
start_group
()
{
current_level_
++
;
objects_count_
++
;
current_shape_id_
=
objects_count_
;
groups_
.
push_back
(
current_level_
);
}
void
add_name_object
(
const
std
::
wstring
&
name
)
{
current_object_name_
=
name
;
...
...
@@ -146,10 +154,8 @@ public:
bool
&
get_use_image_replace
()
{
bool
res
=
false
;
if
(
frames_
.
size
()
>
0
)
return
frames_
.
back
().
use_image_replace
;
else
return
res
;
if
(
frames_
.
size
()
>
0
)
return
frames_
.
back
().
use_image_replace
;
else
return
res
;
}
std
::
wstring
&
get_text_stream_shape
()
...
...
@@ -172,17 +178,20 @@ public:
shape_text_content_
=
L""
;
current_shape_id_
=
0
;
}
int
get_current_level
()
const
{
return
current_level_
;
}
void
stop_group
()
{
current_level_
--
;
groups_
.
pop_back
();
}
int
get_current_frame_id
()
const
{
if
(
frames_
.
size
()
>
0
)
return
frames_
.
back
().
id
;
else
return
0
;
if
(
frames_
.
size
()
>
0
)
return
frames_
.
back
().
id
;
else
return
0
;
}
int
get_current_shape_id
()
const
{
return
current_shape_id_
;
}
bool
in_group
()
{
return
groups_
.
size
()
>
0
;
}
int
get_current_level
()
const
{
return
current_level_
;
}
int
get_current_shape_id
()
const
{
return
current_shape_id_
;
}
const
std
::
wstring
&
get_current_object_name
()
const
{
return
current_object_name_
;
}
...
...
@@ -194,19 +203,20 @@ public:
odf_reader
::
draw_shape
*
get_current_shape
()
const
{
return
current_shape_
;
}
private:
std
::
wstring
shape_text_content_
;
std
::
wstring
shape_text_content_
;
std
::
wstring
current_object_name_
;
unsigned
int
objects_count_
;
std
::
wstring
current_object_name_
;
unsigned
int
objects_count_
;
int
current_level_
;
int
current_level_
;
std
::
vector
<
_frame_
>
frames_
;
std
::
vector
<
int
>
groups_
;
std
::
vector
<
_frame_
>
frames_
;
odf_reader
::
draw_shape
*
current_shape_
;
size_t
current_shape_id_
;
size_t
current_shape_id_
;
std
::
wstring
zero_string_
;
std
::
wstring
zero_string_
;
};
...
...
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
View file @
4d5b9503
...
...
@@ -179,101 +179,114 @@ void docx_serialize_text(std::wostream & strm, const std::vector<odf_reader::_pr
oox_serialize_bodyPr
(
strm
,
properties
,
L"wps"
);
}
void
docx_serialize_image
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
//--------------------------------------------------------------------
void
docx_serialize_image_child
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
CP_XML_WRITER
(
strm
)
{
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_NODE
(
L"wp:cNvGraphicFramePr"
)
CP_XML_NODE
(
L"pic:pic"
)
{
CP_XML_
NODE
(
L"a:graphicFrameLocks"
)
CP_XML_
ATTR
(
L"xmlns:pic"
,
L"http://schemas.openxmlformats.org/drawingml/2006/picture"
);
{
CP_XML_ATTR
(
L"xmlns:a"
,
L"http://schemas.openxmlformats.org/drawingml/2006/main"
);
CP_XML_ATTR
(
L"noChangeAspect"
,
1
);
}
}
CP_XML_NODE
(
L"a:graphic"
)
{
CP_XML_ATTR
(
L"xmlns:a"
,
L"http://schemas.openxmlformats.org/drawingml/2006/main"
);
CP_XML_NODE
(
L"a:graphicData"
)
{
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.openxmlformats.org/drawingml/2006/picture"
);
CP_XML_NODE
(
L"pic:pic"
)
CP_XML_NODE
(
L"pic:nvPicPr"
)
{
CP_XML_
ATTR
(
L"xmlns:pic"
,
L"http://schemas.openxmlformats.org/drawingml/2006/picture"
);
CP_XML_
NODE
(
L"pic:cNvPr"
)
{
CP_XML_NODE
(
L"pic:nvPicPr"
)
{
CP_XML_NODE
(
L"pic:cNvPr"
)
{
//CP_XML_ATTR(L"desc text",L"");
CP_XML_ATTR
(
L"id"
,
val
.
id
);
CP_XML_ATTR
(
L"name"
,
val
.
name
);
}
CP_XML_NODE
(
L"pic:cNvPicPr"
)
{
CP_XML_NODE
(
L"a:picLocks"
)
CP_XML_ATTR
(
L"noChangeAspect"
,
1
);
}
}
//CP_XML_ATTR(L"desc text",L"");
CP_XML_ATTR
(
L"id"
,
val
.
id
);
CP_XML_ATTR
(
L"name"
,
val
.
name
);
}
val
.
fill
.
bitmap
->
name_space
=
L"pic"
;
oox_serialize_fill
(
CP_XML_STREAM
(),
val
.
fill
);
CP_XML_NODE
(
L"pic:spPr"
)
CP_XML_NODE
(
L"pic:cNvPicPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
CP_XML_NODE
(
L"a:picLocks"
)
CP_XML_ATTR
(
L"noChangeAspect"
,
1
);
}
}
}
val
.
fill
.
bitmap
->
name_space
=
L"pic"
;
oox_serialize_fill
(
CP_XML_STREAM
(),
val
.
fill
);
CP_XML_NODE
(
L"a:prstGeom"
)
{
CP_XML_ATTR
(
L"prst"
,
L"rect"
);
CP_XML_NODE
(
L"a:avLst"
);
}
CP_XML_NODE
(
L"pic:spPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
oox_serialize_ln
(
CP_XML_STREAM
(),
val
.
additional
);
}
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
);
}
}
}
}
void
docx_serialize_chart
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
void
docx_serialize_shape_child
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"wp
:docPr
"
)
CP_XML_NODE
(
L"wp
s:wsp
"
)
{
CP_XML_ATTR
(
L"name"
,
val
.
name
);
CP_XML_ATTR
(
L"id"
,
val
.
id
+
1
);
//oox_serialize_hlink(CP_XML_STREAM(),val.hlink);
}
CP_XML_NODE
(
L"wps:cNvSpPr"
)
{
if
(
val
.
sub_type
==
1
||
val
.
sub_type
==
0
)
//frame
{
CP_XML_ATTR
(
L"txBox"
,
1
);
}
CP_XML_NODE
(
L"a:spLocks"
)
{
CP_XML_ATTR
(
L"noChangeAspect"
,
1
);
}
}
CP_XML_NODE
(
L"wp:cNvGraphicFramePr"
);
CP_XML_NODE
(
L"wps:spPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
CP_XML_NODE
(
L"a:graphic"
)
{
CP_XML_ATTR
(
L"xmlns:a"
,
L"http://schemas.openxmlformats.org/drawingml/2006/main"
);
CP_XML_NODE
(
L"a:graphicData"
)
oox_serialize_shape
(
CP_XML_STREAM
(),
val
);
oox_serialize_ln
(
CP_XML_STREAM
(),
val
.
additional
);
}
docx_serialize_text
(
CP_XML_STREAM
(),
val
.
additional
);
}
}
}
void
docx_serialize_group_child
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"wpg:wgp"
)
{
CP_XML_NODE
(
L"wpg:cNvGrpSpPr"
)
{
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.openxmlformats.org/drawingml/2006/chart"
);
CP_XML_NODE
(
L"c:chart"
)
CP_XML_NODE
(
L"a:spLocks"
)
{
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
.
chartId
);
CP_XML_ATTR
(
L"noChangeAspect"
,
1
);
}
}
}
CP_XML_NODE
(
L"wpg:grpSpPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
}
CP_XML_STREAM
()
<<
val
.
content_group_
;
}
}
}
void
docx_serialize_chart_child
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"c:chart"
)
{
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
.
chartId
);
}
}
}
void
docx_serialize_
shape
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
void
docx_serialize_
common
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
CP_XML_WRITER
(
strm
)
{
...
...
@@ -297,39 +310,55 @@ void docx_serialize_shape(std::wostream & strm, _docx_drawing & val)
CP_XML_ATTR
(
L"xmlns:a"
,
L"http://schemas.openxmlformats.org/drawingml/2006/main"
);
CP_XML_NODE
(
L"a:graphicData"
)
{
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
);
CP_XML_NODE
(
L"wps:wsp"
)
if
(
val
.
type
==
mediaitems
::
typeShape
)
{
CP_XML_NODE
(
L"wps:cNvSpPr"
)
{
if
(
val
.
sub_type
==
1
||
val
.
sub_type
==
0
)
//frame
{
CP_XML_ATTR
(
L"txBox"
,
1
);
}
CP_XML_NODE
(
L"a:spLocks"
)
{
CP_XML_ATTR
(
L"noChangeAspect"
,
1
);
}
}
CP_XML_NODE
(
L"wps:spPr"
)
{
oox_serialize_xfrm
(
CP_XML_STREAM
(),
val
);
oox_serialize_shape
(
CP_XML_STREAM
(),
val
);
oox_serialize_ln
(
CP_XML_STREAM
(),
val
.
additional
);
}
docx_serialize_text
(
CP_XML_STREAM
(),
val
.
additional
);
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
==
mediaitems
::
typeImage
)
{
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.openxmlformats.org/drawingml/2006/picture"
);
docx_serialize_image_child
(
CP_XML_STREAM
(),
val
);
}
else
if
(
val
.
type
==
mediaitems
::
typeChart
)
{
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
==
mediaitems
::
typeGroup
)
{
CP_XML_ATTR
(
L"uri"
,
L"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
);
docx_serialize_group_child
(
CP_XML_STREAM
(),
val
);
}
}
}
}
}
void
docx_serialize_child
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
if
(
val
.
type
==
mediaitems
::
typeShape
)
{
docx_serialize_shape_child
(
strm
,
val
);
}
else
if
(
val
.
type
==
mediaitems
::
typeImage
)
{
docx_serialize_image_child
(
strm
,
val
);
}
else
if
(
val
.
type
==
mediaitems
::
typeChart
)
{
docx_serialize_chart_child
(
strm
,
val
);
}
else
if
(
val
.
type
==
mediaitems
::
typeGroup
)
{
docx_serialize_group_child
(
strm
,
val
);
}
}
void
docx_serialize
(
std
::
wostream
&
strm
,
_docx_drawing
&
val
)
{
if
(
val
.
inGroup
)
return
docx_serialize_child
(
strm
,
val
);
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"w:drawing"
)
...
...
@@ -426,18 +455,7 @@ void docx_serialize(std::wostream & strm, _docx_drawing & val)
serialize_wrap
(
CP_XML_STREAM
(),
val
);
}
if
(
val
.
type
==
mediaitems
::
typeShape
)
{
docx_serialize_shape
(
CP_XML_STREAM
(),
val
);
}
else
if
(
val
.
type
==
mediaitems
::
typeImage
)
{
docx_serialize_image
(
CP_XML_STREAM
(),
val
);
}
else
if
(
val
.
type
==
mediaitems
::
typeChart
)
{
docx_serialize_chart
(
CP_XML_STREAM
(),
val
);
}
docx_serialize_common
(
CP_XML_STREAM
(),
val
);
}
}
}
...
...
ASCOfficeOdfFile/src/docx/docx_drawing.h
View file @
4d5b9503
...
...
@@ -14,8 +14,8 @@ namespace cpdoccore {
namespace
oox
{
struct
_docx_drawing
:
_oox_drawing
{
_docx_drawing
()
:
_oox_drawing
(),
parallel
(
0
),
isInline
(
false
),
number_wrapped_paragraphs
(
0
),
posOffsetV
(
0
),
posOffsetH
(
0
)
{
_docx_drawing
()
:
_oox_drawing
(),
parallel
(
0
),
isInline
(
false
),
inGroup
(
false
),
number_wrapped_paragraphs
(
0
),
posOffsetV
(
0
),
posOffsetH
(
0
)
{
}
unsigned
int
parallel
;
...
...
@@ -28,6 +28,7 @@ struct _docx_drawing : _oox_drawing
_CP_OPT
(
odf_types
::
style_wrap
)
styleWrap
;
bool
inGroup
;
bool
isInline
;
int
number_wrapped_paragraphs
;
...
...
@@ -43,6 +44,8 @@ struct _docx_drawing : _oox_drawing
// std::wstring distL;
// std::wstring distR;
std
::
wstring
content_group_
;
friend
void
docx_serialize
(
std
::
wostream
&
_Wostream
,
_docx_drawing
&
val
);
};
}
...
...
ASCOfficeOdfFile/src/docx/mediaitems.h
View file @
4d5b9503
...
...
@@ -11,7 +11,7 @@ class rels;
class
mediaitems
{
public:
enum
Type
{
typeUnknown
=
0
,
typeImage
,
typeChart
,
typeShape
,
typeTable
,
typeHyperlink
,
typeComment
,
typeMedia
};
enum
Type
{
typeUnknown
=
0
,
typeImage
,
typeChart
,
typeShape
,
typeTable
,
typeHyperlink
,
typeComment
,
typeMedia
,
typeGroup
};
mediaitems
(
const
std
::
wstring
&
odfPacket
)
:
odf_packet_
(
odfPacket
)
{
...
...
ASCOfficeOdfFile/src/odf/draw_frame.h
View file @
4d5b9503
...
...
@@ -164,8 +164,6 @@ class draw_g_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
};
...
...
@@ -188,10 +186,10 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
public:
odf_types
::
union_common_draw_attlists
common_draw_attlists_
;
draw_g_attlist
draw_g_attlist_
;
odf_types
::
union_common_draw_attlists
common_draw_attlists_
;
draw_g_attlist
draw_g_attlist_
;
office_element_ptr_array
content_
;
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_g
);
...
...
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
4d5b9503
...
...
@@ -940,9 +940,9 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
oox
::
_docx_drawing
drawing
=
oox
::
_docx_drawing
();
drawing
.
type
=
oox
::
mediaitems
::
typeShape
;
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_shape_id
();
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
.
inGroup
=
Context
.
get_drawing_context
().
in_group
();
drawing
.
sub_type
=
sub_type_
;
drawing
.
additional
=
additional_
;
// ...
...
...
@@ -970,7 +970,8 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
Context
.
set_paragraph_state
(
false
);
bool
new_run
=
true
;
if
(
pState
==
false
&&
Context
.
get_drawing_context
().
get_current_level
()
==
1
)
if
((
pState
==
false
&&
Context
.
get_drawing_context
().
get_current_level
()
==
1
)
||
(
Context
.
get_drawing_context
().
in_group
()))
{
new_run
=
false
;
}
...
...
@@ -1026,10 +1027,12 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
/////////////////////////////////////////////////////////////////////////////////////////////////////
oox
::
_docx_drawing
drawing
=
oox
::
_docx_drawing
();
drawing
.
type
=
oox
::
mediaitems
::
typeImage
;
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
.
type
=
oox
::
mediaitems
::
typeImage
;
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
.
inGroup
=
Context
.
get_drawing_context
().
in_group
();
//////////////////////////////////////////////////////////////////////////////////////////////////
oox
::
hyperlinks
::
_ref
hyperlink
=
Context
.
last_hyperlink
();
// - "" - ( )
...
...
@@ -1082,9 +1085,13 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
pState
=
Context
.
get_paragraph_state
();
Context
.
set_paragraph_state
(
false
);
Context
.
add_new_run
(
_T
(
""
));
if
(
!
Context
.
get_drawing_context
().
in_group
())
Context
.
add_new_run
(
_T
(
""
));
docx_serialize
(
strm
,
drawing
);
Context
.
finish_run
();
if
(
!
Context
.
get_drawing_context
().
in_group
())
Context
.
finish_run
();
Context
.
set_paragraph_state
(
pState
);
...
...
@@ -1130,10 +1137,10 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
return
;
oox
::
_docx_drawing
drawing
=
oox
::
_docx_drawing
();
drawing
.
type
=
oox
::
mediaitems
::
typeShape
;
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
.
type
=
oox
::
mediaitems
::
typeShape
;
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
.
inGroup
=
Context
.
get_drawing_context
().
in_group
();
drawing
.
sub_type
=
1
;
//textBox
...
...
@@ -1188,23 +1195,81 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
pState
=
Context
.
get_paragraph_state
();
Context
.
set_paragraph_state
(
false
);
Context
.
add_new_run
(
_T
(
""
));
if
(
!
Context
.
get_drawing_context
().
in_group
())
Context
.
add_new_run
(
_T
(
""
));
docx_serialize
(
strm
,
drawing
);
Context
.
finish_run
();
if
(
!
Context
.
get_drawing_context
().
in_group
())
Context
.
finish_run
();
Context
.
set_paragraph_state
(
pState
);
}
void
draw_g
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
if
((
!
Context
.
get_paragraph_state
()
&&
!
Context
.
get_drawing_context
().
in_group
())
&&
!
Context
.
delayed_converting_
)
{
Context
.
add_delayed_element
(
this
);
return
;
}
oox
::
_docx_drawing
drawing
=
oox
::
_docx_drawing
();
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_shape_id
();
drawing
.
type
=
oox
::
mediaitems
::
typeGroup
;
drawing
.
inGroup
=
Context
.
get_drawing_context
().
in_group
();
Context
.
get_drawing_context
().
start_group
();
/////////
common_draw_docx_convert
(
Context
,
common_draw_attlists_
,
drawing
);
/////////
oox
::
docx_conversion_context
::
StreamsManPtr
prev
=
Context
.
get_stream_man
();
std
::
wstringstream
temp_stream
(
drawing
.
content_group_
);
Context
.
set_stream_man
(
boost
::
shared_ptr
<
oox
::
streams_man
>
(
new
oox
::
streams_man
(
temp_stream
)
));
bool
runState
=
Context
.
get_run_state
();
Context
.
set_run_state
(
false
);
bool
pState
=
Context
.
get_paragraph_state
();
Context
.
set_paragraph_state
(
false
);
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
ElementType
type
=
elm
->
get_type
();
elm
->
docx_convert
(
Context
);
}
if
(
drawing
.
cx
<
1
||
drawing
.
cy
<
1
&&
content_
.
size
()
>
0
)
{
// - ...
draw_frame
*
frame
=
dynamic_cast
<
draw_frame
*>
(
content_
[
0
].
get
());
if
(
frame
)
{
drawing
.
cx
=
get_value_emu
(
frame
->
common_draw_attlists_
.
rel_size_
.
common_draw_size_attlist_
.
svg_width_
);
drawing
.
cy
=
get_value_emu
(
frame
->
common_draw_attlists_
.
rel_size_
.
common_draw_size_attlist_
.
svg_height_
);
}
else
{
draw_shape
*
shape
=
dynamic_cast
<
draw_shape
*>
(
content_
[
0
].
get
());
if
(
shape
)
{
drawing
.
cx
=
get_value_emu
(
shape
->
common_draw_attlists_
.
rel_size_
.
common_draw_size_attlist_
.
svg_width_
);
drawing
.
cy
=
get_value_emu
(
shape
->
common_draw_attlists_
.
rel_size_
.
common_draw_size_attlist_
.
svg_height_
);
}
}
}
drawing
.
content_group_
=
temp_stream
.
str
();
Context
.
set_stream_man
(
prev
);
Context
.
set_run_state
(
runState
);
Context
.
set_paragraph_state
(
pState
);
docx_serialize
(
Context
.
output_stream
(),
drawing
);
Context
.
get_drawing_context
().
stop_group
();
}
void
draw_frame
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
!
Context
.
get_paragraph_state
(
)
&&
!
Context
.
delayed_converting_
)
if
(
(
!
Context
.
get_paragraph_state
()
&&
!
Context
.
get_drawing_context
().
in_group
()
)
&&
!
Context
.
delayed_converting_
)
{
Context
.
add_delayed_element
(
this
);
return
;
...
...
@@ -1271,6 +1336,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
.
inGroup
=
Context
.
get_drawing_context
().
in_group
();
bool
isMediaInternal
=
true
;
drawing
.
chartId
=
Context
.
add_mediaitem
(
href
,
drawing
.
type
,
isMediaInternal
,
href
);
...
...
@@ -1283,11 +1349,13 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
Context
.
set_run_state
(
false
);
Context
.
set_paragraph_state
(
false
);
Context
.
add_new_run
(
_T
(
""
));
if
(
!
Context
.
get_drawing_context
().
in_group
())
Context
.
add_new_run
(
_T
(
""
));
docx_serialize
(
Context
.
output_stream
(),
drawing
);
Context
.
finish_run
();
if
(
!
Context
.
get_drawing_context
().
in_group
())
Context
.
finish_run
();
Context
.
set_run_state
(
runState
);
Context
.
set_paragraph_state
(
pState
);
...
...
@@ -1299,6 +1367,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
drawing
.
type
=
oox
::
mediaitems
::
typeShape
;
drawing
.
id
=
Context
.
get_drawing_context
().
get_current_frame_id
();
drawing
.
name
=
Context
.
get_drawing_context
().
get_current_object_name
();
drawing
.
inGroup
=
Context
.
get_drawing_context
().
in_group
();
common_draw_docx_convert
(
Context
,
frame
->
common_draw_attlists_
,
drawing
);
...
...
@@ -1310,6 +1379,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
if
(
drawing
.
fill
.
type
>
0
)
in_frame
=
true
;
if
(
in_frame
)
{
drawing
.
additional
.
push_back
(
_property
(
L"text-content"
,
std
::
wstring
(
L"<w:p><m:oMathPara><m:oMathParaPr/>"
)
+
...
...
@@ -1317,11 +1387,13 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
Context
.
set_run_state
(
false
);
Context
.
set_paragraph_state
(
false
);
Context
.
add_new_run
(
_T
(
""
));
if
(
!
Context
.
get_drawing_context
().
in_group
())
Context
.
add_new_run
(
_T
(
""
));
docx_serialize
(
Context
.
output_stream
(),
drawing
);
Context
.
finish_run
();
if
(
!
Context
.
get_drawing_context
().
in_group
())
Context
.
finish_run
();
Context
.
set_run_state
(
runState
);
Context
.
set_paragraph_state
(
pState
);
...
...
ASCOfficeOdfFile/src/odf/draw_shapes_docx.cpp
View file @
4d5b9503
...
...
@@ -84,7 +84,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
}
void
draw_rect
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
@@ -93,7 +93,7 @@ void draw_rect::docx_convert(oox::docx_conversion_context & Context)
}
void
draw_ellipse
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
@@ -101,7 +101,7 @@ void draw_ellipse::docx_convert(oox::docx_conversion_context & Context)
}
void
draw_circle
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
@@ -109,7 +109,7 @@ void draw_circle::docx_convert(oox::docx_conversion_context & Context)
}
void
draw_line
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
reset_svg_attributes
();
...
...
@@ -120,7 +120,7 @@ void draw_line::docx_convert(oox::docx_conversion_context & Context)
void
draw_path
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
@@ -130,7 +130,7 @@ void draw_path::docx_convert(oox::docx_conversion_context & Context)
void
draw_connector
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
@@ -139,7 +139,7 @@ void draw_connector::docx_convert(oox::docx_conversion_context & Context)
}
void
draw_polygon
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
@@ -148,7 +148,7 @@ void draw_polygon::docx_convert(oox::docx_conversion_context & Context)
}
void
draw_polyline
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
@@ -157,7 +157,7 @@ void draw_polyline::docx_convert(oox::docx_conversion_context & Context)
}
void
draw_custom_shape
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
@@ -165,7 +165,7 @@ void draw_custom_shape::docx_convert(oox::docx_conversion_context & Context)
}
void
draw_caption
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
Context
.
get_drawing_context
().
get_current_level
()
>
0
)
return
;
//
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert
(
Context
);
//...
...
...
DesktopEditor/raster/Metafile/StarView/SvmFile.cpp
View file @
4d5b9503
This diff is collapsed.
Click to expand it.
DesktopEditor/raster/Metafile/StarView/SvmFile.h
View file @
4d5b9503
...
...
@@ -17,6 +17,7 @@ class CSvmFile : virtual public IMetaFileBase
m_currentActionVersion
=
0
;
m_currentCharset
=
0
;
m_currentActionType
=
0
;
m_bMainStream
=
true
;
};
CSvmFile
(
BYTE
*
Data
,
int
DataSize
)
:
m_oPlayer
(
this
)
{
...
...
@@ -26,6 +27,7 @@ class CSvmFile : virtual public IMetaFileBase
m_currentActionVersion
=
0
;
m_currentCharset
=
0
;
m_currentActionType
=
0
;
m_bMainStream
=
true
;
}
~
CSvmFile
()
...
...
@@ -151,10 +153,12 @@ class CSvmFile : virtual public IMetaFileBase
}
private:
TSvmPoint
m_oCurrnetOffset
;
BYTE
*
m_pBufferData
;
CSvmDC
*
m_pDC
;
CSvmPlayer
m_oPlayer
;
SvmHeader
m_oHeader
;
bool
m_bMainStream
;
unsigned
short
m_currentActionVersion
;
unsigned
short
m_currentCharset
;
...
...
@@ -195,6 +199,7 @@ class CSvmFile : virtual public IMetaFileBase
void
Read_META_GRADIENTEX
();
void
Read_META_TRANSPARENT
();
void
Read_META_FLOATTRANSPARENT
();
void
Read_META_LAYOUTMODE
();
void
Read_META_SECTRECTCLIPREGION
();
void
Read_META_SECTREGIONCLIPREGION
();
...
...
@@ -215,8 +220,8 @@ class CSvmFile : virtual public IMetaFileBase
//TSvmWindow* pWindow = m_pDC->GetWindow();
//TSvmWindow* pViewport = m_pDC->GetViewport();
dX
=
(
double
)(
nX
)
*
m_pDC
->
m_dPixelWidth
;
dY
=
(
double
)(
nY
)
*
m_pDC
->
m_dPixelHeight
;
//
dX = (double)(nX) * m_pDC->m_dPixelWidth ;
//
dY = (double)(nY) * m_pDC->m_dPixelHeight ;
//dX = (double)((double)(nX - pWindow->lX) * m_pDC->m_dPixelWidth) + pViewport->lX;
//dY = (double)((double)(nY - pWindow->lY) * m_pDC->m_dPixelHeight) + pViewport->lY;
...
...
DesktopEditor/raster/Metafile/StarView/SvmPlayer.cpp
View file @
4d5b9503
...
...
@@ -542,9 +542,7 @@ void CSvmDC::SetMapMode(TSvmMapMode & mapMode, bool prefered )
{
m_dPixelHeightPrefered
=
m_dPixelHeight
;
m_dPixelWidthPrefered
=
m_dPixelWidth
;
}
}
TXForm
*
CSvmDC
::
GetTransform
()
...
...
DesktopEditor/raster/Metafile/StarView/SvmPlayer.h
View file @
4d5b9503
...
...
@@ -41,15 +41,12 @@ private:
typedef
std
::
map
<
unsigned
int
,
CSvmObjectBase
*
>
CSvmObjectMap
;
CSvmDC
*
m_pDC
;
std
::
vector
<
CSvmDC
*>
m_vDCStack
;
CSvmFile
*
m_pFile
;
CSvmObjectMap
m_mObjects
;
int
m_nFlags
;
ESvnRasterOp
m_eRasterOp
;
typedef
std
::
map
<
unsigned
int
,
CWmfObjectBase
*>
CWmfObjectMap
;
CSvmDC
*
m_pDC
;
std
::
vector
<
CSvmDC
*>
m_vDCStack
;
CSvmFile
*
m_pFile
;
CSvmObjectMap
m_mObjects
;
int
m_nFlags
;
ESvnRasterOp
m_eRasterOp
;
unsigned
short
m_ushIndex
;
std
::
vector
<
unsigned
short
>
m_vAvailableIndexes
;
...
...
DesktopEditor/raster/Metafile/TestMain.cpp
View file @
4d5b9503
...
...
@@ -78,7 +78,7 @@ void main()
oFonts
.
Initialize
();
CMetaFile
oMetaFile
(
&
oFonts
);
ConvertFolder
(
oMetaFile
,
L"D://test//_svm//
5
//"
,
c_lMetaSvm
);
ConvertFolder
(
oMetaFile
,
L"D://test//_svm//
1
//"
,
c_lMetaSvm
);
//ConvertFolder(oMetaFile, L"D://Test Files//Wmf//Test//", c_lMetaWmf);
//ConvertFolder(oMetaFile, L"D://Test Files//Emf//Temp//", c_lMetaEmf);
...
...
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