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
ed3c83cb
Commit
ed3c83cb
authored
Oct 14, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatWriter - odt - change page layouts, fix write anchor vml shapes
parent
39e3a29c
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
336 additions
and
207 deletions
+336
-207
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
+22
-21
ASCOfficeOdfFileW/source/OdfFormat/odf_page_layout_context.cpp
...ficeOdfFileW/source/OdfFormat/odf_page_layout_context.cpp
+15
-64
ASCOfficeOdfFileW/source/OdfFormat/odf_page_layout_context.h
ASCOfficeOdfFileW/source/OdfFormat/odf_page_layout_context.h
+2
-4
ASCOfficeOdfFileW/source/OdfFormat/style_page_layout_properties.cpp
...dfFileW/source/OdfFormat/style_page_layout_properties.cpp
+105
-27
ASCOfficeOdfFileW/source/OdfFormat/style_page_layout_properties.h
...eOdfFileW/source/OdfFormat/style_page_layout_properties.h
+33
-35
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp
+82
-41
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
+77
-15
No files found.
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
View file @
ed3c83cb
...
...
@@ -1178,6 +1178,7 @@ void odf_drawing_context::set_flip_V(bool bVal)
void
odf_drawing_context
::
set_rotate
(
double
dVal
)
{
if
(
dVal
>
180
)
dVal
=
dVal
-
360
;
double
dRotate
=
dVal
/
180.
*
3.14159265358979323846
;
impl_
->
current_drawing_state_
.
rotateAngle
=
dRotate
;
}
...
...
@@ -1270,10 +1271,10 @@ void odf_drawing_context::set_vertical_rel(int from)
case
0
:
type
=
vertical_rel
::
Baseline
;
break
;
// relfromvBottomMargin ???
case
1
:
type
=
vertical_rel
::
PageContent
;
break
;
// relfromvInsideMargin ???
case
2
:
type
=
vertical_rel
::
Baseline
;
break
;
// relfromvLine
case
3
:
type
=
vertical_rel
::
Paragraph
;
set_anchor
(
anchor_type
::
Paragraph
);
break
;
// relfromvMargin
case
3
:
type
=
vertical_rel
::
Paragraph
;
break
;
// relfromvMargin
case
4
:
type
=
vertical_rel
::
Baseline
;
break
;
// relfromvOutsideMargin ???
case
5
:
type
=
vertical_rel
::
Page
;
set_anchor
(
anchor_type
::
Page
);
break
;
// relfromvPage
case
6
:
type
=
vertical_rel
::
Paragraph
;
set_anchor
(
anchor_type
::
Paragraph
);
break
;
// relfromvParagraph
case
5
:
type
=
vertical_rel
::
Page
;
break
;
// relfromvPage
case
6
:
type
=
vertical_rel
::
Paragraph
;
break
;
// relfromvParagraph
case
7
:
type
=
vertical_rel
::
Baseline
;
break
;
// relfromvTopMargin ???
}
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_page_layout_context.cpp
View file @
ed3c83cb
...
...
@@ -428,93 +428,44 @@ bool odf_page_layout_context::add_header(int type)
return
true
;
}
void
odf_page_layout_context
::
set_page_border_
padding_bottom
(
int
offset_type
,
int
type
,
double
length_pt
)
void
odf_page_layout_context
::
set_page_border_
offset
(
int
type
)
{
if
(
type
<
1
)
return
;
style_page_layout_properties
*
props
=
get_properties
();
if
(
!
props
)
return
;
length
length_
=
length
(
length
(
length_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
offset_type
==
2
&&
props
->
style_page_layout_properties_attlist_
.
common_vertical_margin_attlist_
.
fo_margin_bottom_
)
{
length
new_margin
=
length_
;
length_
=
props
->
style_page_layout_properties_attlist_
.
common_vertical_margin_attlist_
.
fo_margin_bottom_
->
get_length
()
-
length_
;
props
->
style_page_layout_properties_attlist_
.
common_vertical_margin_attlist_
.
fo_margin_bottom_
=
new_margin
;
}
props
->
style_page_layout_properties_attlist_
.
common_padding_attlist_
.
fo_padding_bottom_
=
length_
;
}
void
odf_page_layout_context
::
set_page_border_padding_top
(
int
offset_type
,
int
type
,
double
length_pt
)
{
if
(
type
<
1
)
return
;
style_page_layout_properties
*
props
=
get_properties
();
if
(
!
props
)
return
;
length
length_
=
length
(
length
(
length_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
offset_type
==
2
&&
props
->
style_page_layout_properties_attlist_
.
common_vertical_margin_attlist_
.
fo_margin_top_
)
{
length
new_margin
=
length_
;
length_
=
props
->
style_page_layout_properties_attlist_
.
common_vertical_margin_attlist_
.
fo_margin_top_
->
get_length
()
-
length_
;
props
->
style_page_layout_properties_attlist_
.
common_vertical_margin_attlist_
.
fo_margin_top_
=
new_margin
;
}
props
->
style_page_layout_properties_attlist_
.
common_padding_attlist_
.
fo_padding_top_
=
length_
;
props
->
style_page_layout_properties_attlist_
.
offset_page_border_
=
type
;
}
void
odf_page_layout_context
::
set_page_border_padding_left
(
int
offset_type
,
int
type
,
double
length_pt
)
void
odf_page_layout_context
::
set_page_border_padding
(
int
border
,
double
length_pt
)
{
if
(
type
<
1
)
return
;
style_page_layout_properties
*
props
=
get_properties
();
if
(
!
props
)
return
;
length
length_
=
length
(
length
(
length_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
length
length_
=
length
(
length
(
length_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
offset_type
==
2
&&
props
->
style_page_layout_properties_attlist_
.
common_horizontal_margin_attlist_
.
fo_margin_left_
)
switch
(
border
)
{
length
new_margin
=
length_
;
length_
=
props
->
style_page_layout_properties_attlist_
.
common_horizontal_margin_attlist_
.
fo_margin_left_
->
get_length
()
-
length_
;
props
->
style_page_layout_properties_attlist_
.
common_horizontal_margin_attlist_
.
fo_margin_left_
=
new_margin
;
case
1
:
props
->
style_page_layout_properties_attlist_
.
common_padding_attlist_
.
fo_padding_top_
=
length_
;
break
;
case
2
:
props
->
style_page_layout_properties_attlist_
.
common_padding_attlist_
.
fo_padding_bottom_
=
length_
;
break
;
case
3
:
props
->
style_page_layout_properties_attlist_
.
common_padding_attlist_
.
fo_padding_left_
=
length_
;
break
;
case
4
:
props
->
style_page_layout_properties_attlist_
.
common_padding_attlist_
.
fo_padding_right_
=
length_
;
break
;
}
props
->
style_page_layout_properties_attlist_
.
common_padding_attlist_
.
fo_padding_left_
=
length_
;
}
void
odf_page_layout_context
::
set_page_border_padding_right
(
int
offset_type
,
int
type
,
double
length_pt
)
{
if
(
type
<
1
)
return
;
style_page_layout_properties
*
props
=
get_properties
();
if
(
!
props
)
return
;
length
length_
=
length
(
length
(
length_pt
,
length
::
pt
).
get_value_unit
(
length
::
cm
),
length
::
cm
);
if
(
offset_type
==
2
&&
props
->
style_page_layout_properties_attlist_
.
common_horizontal_margin_attlist_
.
fo_margin_right_
)
{
length
new_margin
=
length_
;
length_
=
props
->
style_page_layout_properties_attlist_
.
common_horizontal_margin_attlist_
.
fo_margin_right_
->
get_length
()
-
length_
;
props
->
style_page_layout_properties_attlist_
.
common_horizontal_margin_attlist_
.
fo_margin_right_
=
new_margin
;
}
props
->
style_page_layout_properties_attlist_
.
common_padding_attlist_
.
fo_padding_right_
=
length_
;
}
void
odf_page_layout_context
::
set_page_border_shadow
(
bool
val
)
void
odf_page_layout_context
::
set_page_border_shadow
(
bool
val
)
{
style_page_layout_properties
*
props
=
get_properties
();
if
(
!
props
)
return
;
props
->
style_page_layout_properties_attlist_
.
common_shadow_attlist_
.
style_shadow_
=
shadow_type
::
parse
(
L"#000000 0.159cm 0.159cm"
);
}
void
odf_page_layout_context
::
set_page_border
(
std
::
wstring
top
,
std
::
wstring
left
,
std
::
wstring
bottom
,
std
::
wstring
right
)
void
odf_page_layout_context
::
set_page_border
(
std
::
wstring
top
,
std
::
wstring
left
,
std
::
wstring
bottom
,
std
::
wstring
right
)
{
style_page_layout_properties
*
props
=
get_properties
();
if
(
!
props
)
return
;
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_page_layout_context.h
View file @
ed3c83cb
...
...
@@ -83,10 +83,8 @@ public:
void
set_page_border
(
std
::
wstring
top
,
std
::
wstring
left
,
std
::
wstring
bottom
,
std
::
wstring
right
);
void
set_page_border_shadow
(
bool
val
);
void
set_page_border_padding_bottom
(
int
offset_type
,
int
type
,
double
length_pt
);
void
set_page_border_padding_top
(
int
offset_type
,
int
type
,
double
length_pt
);
void
set_page_border_padding_left
(
int
offset_type
,
int
type
,
double
length_pt
);
void
set_page_border_padding_right
(
int
offset_type
,
int
type
,
double
length_pt
);
void
set_page_border_padding
(
int
border
,
double
length_pt
);
void
set_page_border_offset
(
int
type
);
void
set_page_orientation
(
int
type
);
void
set_page_size
(
_CP_OPT
(
odf_types
::
length
)
width
,
_CP_OPT
(
odf_types
::
length
)
height
);
...
...
ASCOfficeOdfFileW/source/OdfFormat/style_page_layout_properties.cpp
View file @
ed3c83cb
...
...
@@ -48,16 +48,87 @@ namespace cpdoccore {
namespace
odf_writer
{
/// style:page-layout-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
void
style_page_layout_properties_attlist
::
serialize
(
CP_ATTR_NODE
)
{
CP_XML_ATTR_OPT
(
L"fo:page-width"
,
fo_page_width_
);
CP_XML_ATTR_OPT
(
L"fo:page-height"
,
fo_page_height_
);
if
(
offset_page_border_
==
2
)
{
//from page to from text
if
(
common_padding_attlist_
.
fo_padding_
)
{
if
(
common_margin_attlist_
.
fo_margin_
)
{
length
new_margin
=
*
common_padding_attlist_
.
fo_padding_
;
length
new_padding
=
common_margin_attlist_
.
fo_margin_
->
get_length
()
-
*
common_padding_attlist_
.
fo_padding_
;
common_margin_attlist_
.
fo_margin_
=
new_margin
;
common_padding_attlist_
.
fo_padding_
=
new_padding
;
}
else
{
common_padding_attlist_
.
fo_padding_top_
=
common_padding_attlist_
.
fo_padding_bottom_
=
common_padding_attlist_
.
fo_padding_left_
=
common_padding_attlist_
.
fo_padding_right_
=
common_padding_attlist_
.
fo_padding_
;
common_padding_attlist_
.
fo_padding_
=
boost
::
none
;
}
}
if
(
common_padding_attlist_
.
fo_padding_top_
&&
(
common_vertical_margin_attlist_
.
fo_margin_top_
||
common_margin_attlist_
.
fo_margin_
))
{
if
(
!
common_vertical_margin_attlist_
.
fo_margin_top_
)
common_vertical_margin_attlist_
.
fo_margin_top_
=
common_margin_attlist_
.
fo_margin_
;
length
new_margin
=
*
common_padding_attlist_
.
fo_padding_top_
;
length
new_padding
=
common_vertical_margin_attlist_
.
fo_margin_top_
->
get_length
()
-
*
common_padding_attlist_
.
fo_padding_top_
;
common_vertical_margin_attlist_
.
fo_margin_top_
=
new_margin
;
common_padding_attlist_
.
fo_padding_top_
=
new_padding
;
}
if
(
common_padding_attlist_
.
fo_padding_bottom_
&&
(
common_vertical_margin_attlist_
.
fo_margin_bottom_
||
common_margin_attlist_
.
fo_margin_
))
{
if
(
!
common_vertical_margin_attlist_
.
fo_margin_bottom_
)
common_vertical_margin_attlist_
.
fo_margin_bottom_
=
common_margin_attlist_
.
fo_margin_
;
length
new_margin
=
*
common_padding_attlist_
.
fo_padding_bottom_
;
length
new_padding
=
common_vertical_margin_attlist_
.
fo_margin_bottom_
->
get_length
()
-
*
common_padding_attlist_
.
fo_padding_bottom_
;
common_vertical_margin_attlist_
.
fo_margin_bottom_
=
new_margin
;
common_padding_attlist_
.
fo_padding_bottom_
=
new_padding
;
}
if
(
common_padding_attlist_
.
fo_padding_left_
&&
(
common_horizontal_margin_attlist_
.
fo_margin_left_
||
common_margin_attlist_
.
fo_margin_
))
{
if
(
!
common_horizontal_margin_attlist_
.
fo_margin_left_
)
common_horizontal_margin_attlist_
.
fo_margin_left_
=
common_margin_attlist_
.
fo_margin_
;
length
new_margin
=
*
common_padding_attlist_
.
fo_padding_left_
;
length
new_padding
=
common_horizontal_margin_attlist_
.
fo_margin_left_
->
get_length
()
-
*
common_padding_attlist_
.
fo_padding_top_
;
common_horizontal_margin_attlist_
.
fo_margin_left_
=
new_margin
;
common_padding_attlist_
.
fo_padding_left_
=
new_padding
;
}
if
(
common_padding_attlist_
.
fo_padding_right_
&&
(
common_horizontal_margin_attlist_
.
fo_margin_right_
||
common_margin_attlist_
.
fo_margin_
))
{
if
(
!
common_horizontal_margin_attlist_
.
fo_margin_right_
)
common_horizontal_margin_attlist_
.
fo_margin_right_
=
common_margin_attlist_
.
fo_margin_
;
length
new_margin
=
*
common_padding_attlist_
.
fo_padding_right_
;
length
new_padding
=
common_horizontal_margin_attlist_
.
fo_margin_right_
->
get_length
()
-
*
common_padding_attlist_
.
fo_padding_right_
;
common_horizontal_margin_attlist_
.
fo_margin_right_
=
new_margin
;
common_padding_attlist_
.
fo_padding_right_
=
new_padding
;
}
}
CP_XML_ATTR_OPT
(
L"fo:page-width"
,
fo_page_width_
);
CP_XML_ATTR_OPT
(
L"fo:page-height"
,
fo_page_height_
);
common_num_format_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_num_format_prefix_suffix_attlist_
.
serialize
(
CP_GET_XML_NODE
());
CP_XML_ATTR_OPT
(
L"style:paper-tray-name"
,
style_paper_tray_name_
);
CP_XML_ATTR_OPT
(
L"style:print-orientation"
,
style_print_orientation_
);
CP_XML_ATTR_OPT
(
L"style:paper-tray-name"
,
style_paper_tray_name_
);
CP_XML_ATTR_OPT
(
L"style:print-orientation"
,
style_print_orientation_
);
common_horizontal_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_vertical_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
...
...
@@ -66,23 +137,24 @@ void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE)
common_padding_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_shadow_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_background_color_attlist_
.
serialize
(
CP_GET_XML_NODE
());
CP_XML_ATTR_OPT
(
L"style:register-truth-ref-style-name"
,
style_register_truth_ref_style_name_
);
CP_XML_ATTR_OPT
(
L"style:print"
,
style_print_
);
CP_XML_ATTR_OPT
(
L"style:print-page-order"
,
style_print_page_order_
);
CP_XML_ATTR_OPT
(
L"style:first-page-number"
,
style_first_page_number_
);
CP_XML_ATTR_OPT
(
L"style:scale-to"
,
style_scale_to_
);
CP_XML_ATTR_OPT
(
L"style:scale-to_pages"
,
style_scale_to_pages_
);
CP_XML_ATTR_OPT
(
L"style:table-centering"
,
style_table_centering_
);
CP_XML_ATTR_OPT
(
L"style:footnote-max-height"
,
style_footnote_max_height_
);
CP_XML_ATTR_OPT
(
L"style:register-truth-ref-style-name"
,
style_register_truth_ref_style_name_
);
CP_XML_ATTR_OPT
(
L"style:print"
,
style_print_
);
CP_XML_ATTR_OPT
(
L"style:print-page-order"
,
style_print_page_order_
);
CP_XML_ATTR_OPT
(
L"style:first-page-number"
,
style_first_page_number_
);
CP_XML_ATTR_OPT
(
L"style:scale-to"
,
style_scale_to_
);
CP_XML_ATTR_OPT
(
L"style:scale-to_pages"
,
style_scale_to_pages_
);
CP_XML_ATTR_OPT
(
L"style:table-centering"
,
style_table_centering_
);
CP_XML_ATTR_OPT
(
L"style:footnote-max-height"
,
style_footnote_max_height_
);
common_writing_mode_attlist_
.
serialize
(
CP_GET_XML_NODE
());
CP_XML_ATTR_OPT
(
L"style:layout-grid-mode"
,
style_layout_grid_mode_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-base-height"
,
style_layout_grid_base_height_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-ruby-height"
,
style_layout_grid_ruby_height_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-lines"
,
style_layout_grid_lines_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-color"
,
style_layout_grid_color_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-ruby-below"
,
style_layout_grid_ruby_below_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-print"
,
style_layout_grid_print_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-display"
,
style_layout_grid_display_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-mode"
,
style_layout_grid_mode_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-base-height"
,
style_layout_grid_base_height_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-ruby-height"
,
style_layout_grid_ruby_height_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-lines"
,
style_layout_grid_lines_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-color"
,
style_layout_grid_color_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-ruby-below"
,
style_layout_grid_ruby_below_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-print"
,
style_layout_grid_print_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-display"
,
style_layout_grid_display_
);
}
const
wchar_t
*
style_page_layout_properties
::
ns
=
L"style"
;
const
wchar_t
*
style_page_layout_properties
::
name
=
L"page-layout-properties"
;
...
...
@@ -108,7 +180,7 @@ void style_page_layout_properties::serialize(std::wostream & strm)
}
}
}
// style-page-layout-properties-elements
//////////////////////////////////////////////////////////////////////////////////////////////////
void
style_page_layout_properties_elements
::
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
,
odf_conversion_context
*
Context
)
{
...
...
@@ -144,13 +216,19 @@ void style_page_layout_properties_elements::add_child_element( const office_elem
break
;
case
typeStyleFootnoteSep
:
style_footnote_sep_
=
child
;
break
;
}
}
void
style_page_layout_properties_elements
::
serialize
(
std
::
wostream
&
strm
)
{
if
(
style_background_image_
)
style_background_image_
->
serialize
(
strm
);
if
(
style_columns_
)
style_columns_
->
serialize
(
strm
);
if
(
style_footnote_sep_
)
style_footnote_sep_
->
serialize
(
strm
);
if
(
style_background_image_
)
style_background_image_
->
serialize
(
strm
);
if
(
style_columns_
)
style_columns_
->
serialize
(
strm
);
if
(
style_footnote_sep_
)
style_footnote_sep_
->
serialize
(
strm
);
}
}
...
...
ASCOfficeOdfFileW/source/OdfFormat/style_page_layout_properties.h
View file @
ed3c83cb
...
...
@@ -53,10 +53,10 @@
namespace
cpdoccore
{
namespace
odf_writer
{
// style:page-layout-properties-attlist
class
style_page_layout_properties_attlist
{
public:
style_page_layout_properties_attlist
()
:
offset_page_border_
(
1
)
{}
void
serialize
(
CP_ATTR_NODE
);
_CP_OPT
(
odf_types
::
length
)
fo_page_width_
;
...
...
@@ -96,10 +96,10 @@ public:
_CP_OPT
(
odf_types
::
Bool
)
style_layout_grid_print_
;
_CP_OPT
(
odf_types
::
Bool
)
style_layout_grid_display_
;
}
;
int
offset_page_border_
;
};
// style:page-layout-properties-elements
class
style_page_layout_properties_elements
{
public:
...
...
@@ -110,12 +110,10 @@ public:
office_element_ptr
style_background_image_
;
office_element_ptr
style_columns_
;
// 15.2.20
office_element_ptr
style_footnote_sep_
;
};
// style:page-layout-properties
class
style_page_layout_properties
:
public
office_element_impl
<
style_page_layout_properties
>
{
public:
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp
View file @
ed3c83cb
...
...
@@ -91,9 +91,9 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
{
if
(
vml_style
==
NULL
)
return
;
_CP_OPT
(
double
)
width
_pt
,
height_pt
,
x
,
y
;
_CP_OPT
(
double
)
width
,
height
,
x
,
y
,
x2
,
y2
;
// in pt
bool
anchor_set
=
false
;
_CP_OPT
(
int
)
anchor_type_x
,
anchor_type_y
;
for
(
unsigned
int
i
=
0
;
i
<
vml_style
->
m_arrProperties
.
size
();
i
++
)
{
...
...
@@ -102,10 +102,10 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
switch
(
vml_style
->
m_arrProperties
[
i
]
->
get_Type
())
{
case
SimpleTypes
:
:
Vml
::
cssptHeight
:
height
_pt
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
height
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
break
;
case
SimpleTypes
:
:
Vml
::
cssptWidth
:
width
_pt
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
width
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
break
;
case
SimpleTypes
:
:
Vml
::
cssptTop
:
y
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
...
...
@@ -114,22 +114,20 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
x
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
break
;
case
SimpleTypes
:
:
Vml
::
cssptMarginBottom
:
//odf_context()->drawing_context()->set_margin_bottom(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
//x = vml_style->m_arrProperties[i].get_Value().oValue.dValue;
y2
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
break
;
case
SimpleTypes
:
:
Vml
::
cssptMarginLeft
:
//odf_context()->drawing_context()->set_margin_left (vml_style->m_arrProperties[i].get_Value().oValue.dValue);
x
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
break
;
case
SimpleTypes
:
:
Vml
::
cssptMarginRight
:
//odf_context()->drawing_context()->set_margin_right(vml_style->m_arrProperties[i].get_Value().oValue.dValue)
;
x2
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
break
;
case
SimpleTypes
:
:
Vml
::
cssptMarginTop
:
//odf_context()->drawing_context()->set_margin_top(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
y
=
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oValue
.
dValue
;
break
;
////////////////////////////////////////////////////////////////
case
SimpleTypes
:
:
Vml
::
cssptMsoPositionHorizontal
:
{
switch
(
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
eMsoPosHor
)
{
case
SimpleTypes
:
:
Vml
::
cssmsoposhorAbsolute
:
odf_context
()
->
drawing_context
()
->
set_horizontal_pos
(
2
);
break
;
...
...
@@ -139,17 +137,29 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
case
SimpleTypes
:
:
Vml
::
cssmsoposhorInside
:
odf_context
()
->
drawing_context
()
->
set_horizontal_pos
(
1
);
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposhorOutside
:
odf_context
()
->
drawing_context
()
->
set_horizontal_pos
(
3
);
break
;
}
break
;
}
break
;
case
SimpleTypes
:
:
Vml
::
cssptMsoPositionHorizontalRelative
:
{
switch
(
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
eMsoPosHorRel
)
{
case
SimpleTypes
:
:
Vml
::
cssmsoposhorrelMargin
:
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
2
);
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposhorrelPage
:
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
6
);
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposhorrelText
:
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
1
);
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposhorrelChar
:
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
0
);
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposhorrelMargin
:
{
anchor_type_x
=
2
;
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
2
);
}
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposhorrelPage
:
{
anchor_type_x
=
0
;
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
6
);
}
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposhorrelText
:
case
SimpleTypes
:
:
Vml
::
cssmsoposhorrelChar
:
{
anchor_type_x
=
4
;
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
0
);
}
break
;
}
anchor_set
=
true
;
break
;
}
break
;
case
SimpleTypes
:
:
Vml
::
cssptMsoPositionVertical
:
switch
(
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
eMsoPosVer
)
{
...
...
@@ -162,15 +172,30 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
}
break
;
case
SimpleTypes
:
:
Vml
::
cssptMsoPositionVerticalRelative
:
{
switch
(
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
eMsoPosVerRel
)
{
case
SimpleTypes
:
:
Vml
::
cssmsoposverrelMargin
:
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
3
);
break
;
//3 ???
case
SimpleTypes
:
:
Vml
::
cssmsoposverrelPage
:
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
5
);
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposverrelText
:
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
6
);
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposverrelLine
:
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
2
);
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposverrelMargin
:
{
anchor_type_y
=
2
;
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
3
);
}
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposverrelPage
:
{
anchor_type_y
=
0
;
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
5
);
}
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposverrelText
:
{
anchor_type_y
=
4
;
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
6
);
}
break
;
case
SimpleTypes
:
:
Vml
::
cssmsoposverrelLine
:
{
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
2
);
}
break
;
}
anchor_set
=
true
;
break
;
}
break
;
case
SimpleTypes
:
:
Vml
::
cssptZIndex
:
{
if
(
vml_style
->
m_arrProperties
[
i
]
->
get_Value
().
oZIndex
.
eType
==
SimpleTypes
::
Vml
::
csszindextypeOrder
)
...
...
@@ -239,21 +264,30 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
}
break
;
}
}
if
(
x2
&&
!
x
&&
width
)
x
=
*
x2
-
*
width
;
if
(
y2
&&
!
y
&&
height
)
y
=
*
y2
-
*
height
;
if
(
group
)
{
_CP_OPT
(
double
)
not_set
;
odf_context
()
->
drawing_context
()
->
set_group_size
(
width
_pt
,
height_pt
,
width_pt
,
height_p
t
);
//not_set ,not_set);
odf_context
()
->
drawing_context
()
->
set_group_size
(
width
,
height
,
width
,
heigh
t
);
//not_set ,not_set);
odf_context
()
->
drawing_context
()
->
set_group_position
(
x
,
y
,
x
,
y
);
//not_set , not_set );
}
else
{
odf_context
()
->
drawing_context
()
->
set_size
(
width
_pt
,
height_p
t
);
odf_context
()
->
drawing_context
()
->
set_size
(
width
,
heigh
t
);
odf_context
()
->
drawing_context
()
->
set_position
(
x
,
y
);
if
(
x
&&
y
&&
!
anchor_set
)
if
(
(
anchor_type_x
&&
anchor_type_y
)
&&
(
*
anchor_type_x
==
*
anchor_type_y
))
odf_context
()
->
drawing_context
()
->
set_anchor
(
*
anchor_type_x
);
else
if
(
x
&&
y
)
odf_context
()
->
drawing_context
()
->
set_anchor
(
2
);
//if (x && y && !anchor_set)
// odf_context()->drawing_context()->set_anchor(2);
}
//if (width_pt && height_pt)
...
...
@@ -675,6 +709,7 @@ void OoxConverter::convert(OOX::VmlWord::CWrap *vml_wrap)
}
break
;
}
}
bool
anchor_page_x
=
false
;
if
(
vml_wrap
->
m_oAnchorX
.
IsInit
())
{
switch
(
vml_wrap
->
m_oAnchorX
->
GetValue
())
...
...
@@ -682,7 +717,10 @@ void OoxConverter::convert(OOX::VmlWord::CWrap *vml_wrap)
case
SimpleTypes
:
:
horizontalanchorMargin
:
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
4
);
break
;
case
SimpleTypes
:
:
horizontalanchorPage
:
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
6
);
break
;
{
anchor_page_x
=
true
;
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
6
);
}
break
;
case
SimpleTypes
:
:
horizontalanchorText
:
odf_context
()
->
drawing_context
()
->
set_horizontal_rel
(
1
);
break
;
//???? paragraph ????
case
SimpleTypes
:
:
horizontalanchorChar
:
...
...
@@ -697,8 +735,11 @@ void OoxConverter::convert(OOX::VmlWord::CWrap *vml_wrap)
case
SimpleTypes
:
:
verticalanchorMargin
:
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
0
);
break
;
case
SimpleTypes
:
:
verticalanchorPage
:
{
if
(
anchor_page_x
)
odf_context
()
->
drawing_context
()
->
set_anchor
(
0
);
//page
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
5
);
break
;
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
5
);
}
break
;
case
SimpleTypes
:
:
verticalanchorText
:
odf_context
()
->
drawing_context
()
->
set_vertical_rel
(
0
);
break
;
case
SimpleTypes
:
:
verticalanchorLine
:
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
View file @
ed3c83cb
This diff is collapsed.
Click to expand it.
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