Commit 4f546acc authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

(1.2.0.128): ASCOfficeOdfFileW

канвасы, схемы-диаграммы(smart-art)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57846 954022d7-b5bf-4e40-9824-e11837661b57
parent bbbb523d
...@@ -286,19 +286,11 @@ public: ...@@ -286,19 +286,11 @@ public:
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
public: public:
// fo:padding
_CP_OPT(length) fo_padding_; _CP_OPT(length) fo_padding_;
// fo:padding-top
_CP_OPT(length) fo_padding_top_; _CP_OPT(length) fo_padding_top_;
// fo:padding-bottom
_CP_OPT(length) fo_padding_bottom_; _CP_OPT(length) fo_padding_bottom_;
// fo:padding-left
_CP_OPT(length) fo_padding_left_; _CP_OPT(length) fo_padding_left_;
// fo:padding-right
_CP_OPT(length) fo_padding_right_; _CP_OPT(length) fo_padding_right_;
}; };
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/* File created by MIDL compiler version 7.00.0555 */ /* File created by MIDL compiler version 7.00.0555 */
/* at Mon Apr 07 14:29:55 2014 /* at Wed Aug 13 19:13:58 2014
*/ */
/* Compiler settings for .\ASCOfficeOdfFileW.idl: /* Compiler settings for .\ASCOfficeOdfFileW.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555
......
...@@ -1379,6 +1379,10 @@ ...@@ -1379,6 +1379,10 @@
RelativePath=".\OdfFormat\shapes\oox_shapeStars.h" RelativePath=".\OdfFormat\shapes\oox_shapeStars.h"
> >
</File> </File>
<File
RelativePath=".\OdfFormat\Shapes\oox_shapeWordArt.h"
>
</File>
</Filter> </Filter>
<File <File
RelativePath=".\OdfFormat\abstract_xml.cpp" RelativePath=".\OdfFormat\abstract_xml.cpp"
......
...@@ -372,6 +372,11 @@ void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE) ...@@ -372,6 +372,11 @@ void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:glue-points", draw_glue_points_); CP_XML_ATTR_OPT(L"draw:glue-points", draw_glue_points_);
CP_XML_ATTR_OPT(L"draw:mirror-vertical", draw_mirror_vertical_); CP_XML_ATTR_OPT(L"draw:mirror-vertical", draw_mirror_vertical_);
CP_XML_ATTR_OPT(L"draw:mirror-horizontal", draw_mirror_horizontal_); CP_XML_ATTR_OPT(L"draw:mirror-horizontal", draw_mirror_horizontal_);
CP_XML_ATTR_OPT(L"draw:text-path", draw_text_path_);
CP_XML_ATTR_OPT(L"draw:text-path-mode", draw_text_path_mode_);
CP_XML_ATTR_OPT(L"draw:text-path-scale", draw_text_path_scale_);
CP_XML_ATTR_OPT(L"draw:text-path-same-letter-heights", draw_text_path_same_letter_heights_);
} }
// draw:enhanced_geometry // draw:enhanced_geometry
const wchar_t * draw_enhanced_geometry::ns = L"draw"; const wchar_t * draw_enhanced_geometry::ns = L"draw";
......
...@@ -294,6 +294,11 @@ public: ...@@ -294,6 +294,11 @@ public:
_CP_OPT(Bool) draw_mirror_vertical_; _CP_OPT(Bool) draw_mirror_vertical_;
_CP_OPT(Bool) draw_mirror_horizontal_; _CP_OPT(Bool) draw_mirror_horizontal_;
_CP_OPT(Bool) draw_text_path_;
_CP_OPT(Bool) draw_text_path_same_letter_heights_;
_CP_OPT(std::wstring) draw_text_path_mode_;
_CP_OPT(std::wstring) draw_text_path_scale_;
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
}; };
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
...@@ -319,7 +324,7 @@ public: ...@@ -319,7 +324,7 @@ public:
typedef std::pair<std::wstring,std::wstring> pair_string_value; typedef std::pair<std::wstring,std::wstring> pair_string_value;
std::vector<draw_handle_geometry> draw_handle_geometry_; // std::vector<draw_handle_geometry> draw_handle_geometry_; //
std::vector<pair_string_value>draw_equation_array_; std::vector<pair_string_value> draw_equation_array_;
office_element_ptr_array draw_handle_; office_element_ptr_array draw_handle_;
office_element_ptr_array draw_equation_;// draw_handle - office_element_ptr_array draw_equation_;// draw_handle -
......
...@@ -195,6 +195,7 @@ public: ...@@ -195,6 +195,7 @@ public:
current_graphic_properties = NULL; current_graphic_properties = NULL;
current_paragraph_properties = NULL; current_paragraph_properties = NULL;
current_text_properties = NULL;
width = height = x = y = 0; width = height = x = y = 0;
...@@ -217,6 +218,7 @@ public: ...@@ -217,6 +218,7 @@ public:
style_graphic_properties *current_graphic_properties; style_graphic_properties *current_graphic_properties;
style_paragraph_properties *current_paragraph_properties; style_paragraph_properties *current_paragraph_properties;
style_text_properties *current_text_properties;
anchor_settings anchor_settings_; anchor_settings anchor_settings_;
...@@ -320,7 +322,10 @@ void odf_drawing_context::start_group() ...@@ -320,7 +322,10 @@ void odf_drawing_context::start_group()
impl_->current_graphic_properties->content().common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_; impl_->current_graphic_properties->content().common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_;
if (group) if (group)
{
group->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_text_spreadsheet_shape_attlist_.common_text_anchor_attlist_.type_ = impl_->anchor_settings_.anchor_type_; group->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_text_spreadsheet_shape_attlist_.common_text_anchor_attlist_.type_ = impl_->anchor_settings_.anchor_type_;
impl_->anchor_settings_.anchor_type_ = boost::none;
}
// //
...@@ -397,35 +402,32 @@ void odf_drawing_context::end_drawing() ...@@ -397,35 +402,32 @@ void odf_drawing_context::end_drawing()
double x = impl_->current_drawing_state_.svg_x_->get_value(); double x = impl_->current_drawing_state_.svg_x_->get_value();
double y = impl_->current_drawing_state_.svg_y_->get_value(); double y = impl_->current_drawing_state_.svg_y_->get_value();
if (impl_->current_drawing_state_.rotateAngle) if (impl_->current_drawing_state_.rotateAngle)
{ {
if (impl_->current_drawing_state_.in_group)
{
strTransform += std::wstring(L" translate(-") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_width_.get()/2)
+ std::wstring(L",-") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_height_.get()/2)
+ std::wstring(L")" );
}
strTransform += std::wstring(L"rotate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.rotateAngle.get()) + std::wstring(L")"); strTransform += std::wstring(L"rotate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.rotateAngle.get()) + std::wstring(L")");
// , - // , -
if (impl_->current_drawing_state_.svg_x_ && impl_->current_drawing_state_.svg_y_) if (impl_->current_drawing_state_.svg_x_ && impl_->current_drawing_state_.svg_y_)
{
if (impl_->current_drawing_state_.in_group)
{
strTransform += std::wstring(L" translate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_x_.get()) +
/*(impl_->current_drawing_state_.svg_width_.get()/2))+*/ std::wstring(L",") +
boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_y_.get()) +
/*(impl_->current_drawing_state_.svg_height_.get()/2))+ */std::wstring(L")") ;
}
else
{ {
strTransform += std::wstring(L" translate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_x_.get() + strTransform += std::wstring(L" translate(") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_x_.get() +
(impl_->current_drawing_state_.svg_width_.get()/2))+ std::wstring(L",") + (impl_->current_drawing_state_.svg_width_.get()/2))
boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_y_.get() + + std::wstring(L",") + boost::lexical_cast<std::wstring>(impl_->current_drawing_state_.svg_y_.get() +
(impl_->current_drawing_state_.svg_height_.get()/2))+ std::wstring(L")") ; (impl_->current_drawing_state_.svg_height_.get()/2))
} + std::wstring(L")") ;
}
impl_->current_drawing_state_.svg_x_ = boost::none; impl_->current_drawing_state_.svg_x_ = boost::none;
impl_->current_drawing_state_.svg_y_ = boost::none; impl_->current_drawing_state_.svg_y_ = boost::none;
} }
}
if (strTransform.length()>0) if (strTransform.length()>0)
draw->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_transform_attlist_.draw_transform_ = strTransform; draw->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_transform_attlist_.draw_transform_ = strTransform;
...@@ -474,7 +476,7 @@ void odf_drawing_context::end_drawing() ...@@ -474,7 +476,7 @@ void odf_drawing_context::end_drawing()
impl_->current_graphic_properties->content().common_horizontal_margin_attlist_.fo_margin_right_ = impl_->anchor_settings_.fo_margin_right_; impl_->current_graphic_properties->content().common_horizontal_margin_attlist_.fo_margin_right_ = impl_->anchor_settings_.fo_margin_right_;
impl_->current_graphic_properties->content().common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_; impl_->current_graphic_properties->content().common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_;
if (draw) if (draw && !impl_->current_drawing_state_.in_group)
draw->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_text_spreadsheet_shape_attlist_.common_text_anchor_attlist_.type_ = impl_->anchor_settings_.anchor_type_; draw->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_text_spreadsheet_shape_attlist_.common_text_anchor_attlist_.type_ = impl_->anchor_settings_.anchor_type_;
//if (impl_->current_drawing_state_.in_group == false) //if (impl_->current_drawing_state_.in_group == false)
//{ //{
...@@ -488,6 +490,7 @@ void odf_drawing_context::end_drawing() ...@@ -488,6 +490,7 @@ void odf_drawing_context::end_drawing()
impl_->current_drawing_state_.clear(); impl_->current_drawing_state_.clear();
impl_->current_graphic_properties = NULL; impl_->current_graphic_properties = NULL;
impl_->current_paragraph_properties = NULL; impl_->current_paragraph_properties = NULL;
impl_->current_text_properties = NULL;
} }
...@@ -653,6 +656,7 @@ void odf_drawing_context::end_shape() ...@@ -653,6 +656,7 @@ void odf_drawing_context::end_shape()
if (custom) if (custom)
{ {
std::wstring sub_type; std::wstring sub_type;
bool text_shape = false;
if (impl_->current_drawing_state_.oox_shape_preset < sizeof(Shape_Types_Mapping)/sizeof(_sh_typ)) if (impl_->current_drawing_state_.oox_shape_preset < sizeof(Shape_Types_Mapping)/sizeof(_sh_typ))
{ {
...@@ -660,7 +664,7 @@ void odf_drawing_context::end_shape() ...@@ -660,7 +664,7 @@ void odf_drawing_context::end_shape()
} }
else if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)// 3000 - else if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)// 3000 -
{ {
sub_type = L"fontwork-plain-text"; text_shape = true;
} }
else else
sub_type = L"polyline"; sub_type = L"polyline";
...@@ -673,6 +677,13 @@ void odf_drawing_context::end_shape() ...@@ -673,6 +677,13 @@ void odf_drawing_context::end_shape()
draw_enhanced_geometry* enhanced = dynamic_cast<draw_enhanced_geometry*>(enhanced_elm.get()); draw_enhanced_geometry* enhanced = dynamic_cast<draw_enhanced_geometry*>(enhanced_elm.get());
if (enhanced) if (enhanced)
{ {
if (text_shape)
{
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_same_letter_heights_ = false;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_scale_ = L"path" ;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_mode_ = L"shape" ;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_ = true;
}
if (impl_->current_drawing_state_.path_.length()>1) if (impl_->current_drawing_state_.path_.length()>1)
{ {
...@@ -924,6 +935,16 @@ void odf_drawing_context::add_modifier(std::wstring modifier) ...@@ -924,6 +935,16 @@ void odf_drawing_context::add_modifier(std::wstring modifier)
} }
void odf_drawing_context::set_viewBox(double W, double H) void odf_drawing_context::set_viewBox(double W, double H)
{ {
if (W < 0.01)
{
if (impl_->current_drawing_state_.svg_width_)
W = impl_->current_drawing_state_.svg_width_->get_value_unit(length::emu);
}
if (H < 0.01)
{
if (impl_->current_drawing_state_.svg_height_)
H = impl_->current_drawing_state_.svg_height_->get_value_unit(length::emu);
}
impl_->current_drawing_state_.view_box_ = std::wstring(L"0 0 ") + boost::lexical_cast<std::wstring>((int)W) + L" " + boost::lexical_cast<std::wstring>((int)H); impl_->current_drawing_state_.view_box_ = std::wstring(L"0 0 ") + boost::lexical_cast<std::wstring>((int)W) + L" " + boost::lexical_cast<std::wstring>((int)H);
} }
void odf_drawing_context::set_flip_H(bool bVal) void odf_drawing_context::set_flip_H(bool bVal)
...@@ -1144,8 +1165,11 @@ void odf_drawing_context::set_group_size( double cx, double cy, double ch_cx, do ...@@ -1144,8 +1165,11 @@ void odf_drawing_context::set_group_size( double cx, double cy, double ch_cx, do
{ {
if (impl_->group_list_.size()<1)return; if (impl_->group_list_.size()<1)return;
impl_->current_group_->scale_cx = cx / ch_cx; impl_->current_group_->scale_cx = cx ;
impl_->current_group_->scale_cy = cy / ch_cy; if (ch_cx > 0) impl_->current_group_->scale_cx /= ch_cx;
impl_->current_group_->scale_cy = cy ;
if (ch_cy > 0) impl_->current_group_->scale_cy /= ch_cy;
if(impl_->current_group_->prev_group) if(impl_->current_group_->prev_group)
{ {
...@@ -1219,7 +1243,7 @@ void odf_drawing_context::set_position(double x_pt, double y_pt) ...@@ -1219,7 +1243,7 @@ void odf_drawing_context::set_position(double x_pt, double y_pt)
{ {
if (impl_->group_list_.size() < 1)return; if (impl_->group_list_.size() < 1)return;
if (!impl_->current_drawing_state_.svg_x_) if (!impl_->current_drawing_state_.svg_x_ || impl_->current_drawing_state_.in_group)
{ {
if (impl_->current_drawing_state_.in_group && impl_->current_group_) if (impl_->current_drawing_state_.in_group && impl_->current_group_)
{ {
...@@ -1231,7 +1255,7 @@ void odf_drawing_context::set_position(double x_pt, double y_pt) ...@@ -1231,7 +1255,7 @@ void odf_drawing_context::set_position(double x_pt, double y_pt)
impl_->current_drawing_state_.svg_x_ = length(length(x_pt,length::pt).get_value_unit(length::cm),length::cm); impl_->current_drawing_state_.svg_x_ = length(length(x_pt,length::pt).get_value_unit(length::cm),length::cm);
} }
if (!impl_->current_drawing_state_.svg_y_) if (!impl_->current_drawing_state_.svg_y_ || impl_->current_drawing_state_.in_group)
{ {
if (impl_->current_drawing_state_.in_group && impl_->current_group_) if (impl_->current_drawing_state_.in_group && impl_->current_group_)
{ {
...@@ -1403,6 +1427,44 @@ void odf_drawing_context::set_textarea_wrap(bool Val) ...@@ -1403,6 +1427,44 @@ void odf_drawing_context::set_textarea_wrap(bool Val)
impl_->current_graphic_properties->content().fo_wrap_option_ = wrap_option(wrap_option::NoWrap); impl_->current_graphic_properties->content().fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
} }
void odf_drawing_context::set_textarea_font(_CP_OPT(std::wstring) & latin, _CP_OPT(std::wstring) & cs, _CP_OPT(std::wstring) & ea)
{
if (!latin && !cs && !ea)return;
if (impl_->current_drawing_state_.elements_.size() < 1)return;
if (!impl_->current_text_properties)
{
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
}
if (!impl_->current_text_properties) return;
if (ea) impl_->current_text_properties->content().fo_font_family_ = *ea;
if (cs) impl_->current_text_properties->content().style_font_family_complex_= *cs;
if (latin) impl_->current_text_properties->content().style_font_family_asian_ = *latin;
}
void odf_drawing_context::set_textarea_fontcolor(std::wstring hexColor)
{
if (impl_->current_drawing_state_.elements_.size() < 1)return;
if (!impl_->current_text_properties)
{
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
}
if (!impl_->current_text_properties) return;
impl_->current_text_properties->content().fo_color_ = color(std::wstring(L"#") + hexColor);
}
void odf_drawing_context::set_textarea_writing_mode(int mode) void odf_drawing_context::set_textarea_writing_mode(int mode)
{ {
if (mode == 1) return;// if (mode == 1) return;//
...@@ -1638,6 +1700,39 @@ void odf_drawing_context::set_text(odf_text_context* text_context) ...@@ -1638,6 +1700,39 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
impl_->current_graphic_properties->content().draw_fit_to_size_ = false;//??? impl_->current_graphic_properties->content().draw_fit_to_size_ = false;//???
} }
if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)
{
// - - wordart-
style_text_properties *text_properties_ = text_context->get_text_properties();
if (text_properties_)
{
color color_ = text_properties_->content().fo_color_.get_value_or(color(L"#000000"));
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_ = color_;
if (text_properties_->content().style_text_outline_)
{
//line
impl_->current_graphic_properties->content().svg_stroke_color_ = color_;
impl_->current_graphic_properties->content().draw_stroke_ = line_style(line_style::Solid);
impl_->current_graphic_properties->content().svg_stroke_width_ = length(0.08,length::pt);
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
}
else
{
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::solid);
}
}
//text_context->text_elements_list_[0].style_elm.get()
//start_line_properties();
//
//end_line_properties();
//
//start_area_properties();
//end_area_properties();
}
} }
void odf_drawing_context::start_gradient_style() void odf_drawing_context::start_gradient_style()
{ {
......
...@@ -140,6 +140,8 @@ public: ...@@ -140,6 +140,8 @@ public:
void set_textarea_padding(double left,double top,double right,double bottom);//in cm void set_textarea_padding(double left,double top,double right,double bottom);//in cm
void set_textarea_writing_mode(int mode); void set_textarea_writing_mode(int mode);
void set_textarea_wrap(bool val); void set_textarea_wrap(bool val);
void set_textarea_fontcolor(std::wstring hexColor);
void set_textarea_font(_CP_OPT(std::wstring) & latin, _CP_OPT(std::wstring) & cs, _CP_OPT(std::wstring) & ea);
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
void start_gradient_style(); void start_gradient_style();
void set_gradient_type(int type); void set_gradient_type(int type);
......
...@@ -157,60 +157,30 @@ void odf_page_layout_context::set_page_gutter(_CP_OPT(length) length_) ...@@ -157,60 +157,30 @@ void odf_page_layout_context::set_page_gutter(_CP_OPT(length) length_)
style_page_layout_properties * props = get_properties(); style_page_layout_properties * props = get_properties();
if (!props)return; if (!props)return;
if (props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_) //if (props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_)
{ //{
props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_= // props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_=
props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_->get_length() + length(length_->get_value_unit(length::cm),length::cm); // props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_->get_length() + length(length_->get_value_unit(length::cm),length::cm);
} //}
else //else
props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_= length(length_->get_value_unit(length::cm),length::cm); // props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_= length(length_->get_value_unit(length::cm),length::cm);
} }
void odf_page_layout_context::set_footer_size(_CP_OPT(length) length_)// footer void odf_page_layout_context::set_footer_size(_CP_OPT(length) length_)// footer
{ {
if (!length_) return; if (layout_state_list_.size() < 1) return;
style_header_footer_properties * footer_props = get_footer_properties();
if (!footer_props)return;
style_page_layout_properties * props = get_properties();
if (!props)return;
length_ = length(length_->get_value_unit(length::cm),length::cm);
_CP_OPT(length) bottom_; layout_state_list_.back().footer_size_ = length_;
// layout -
if (props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_) return;
bottom_= props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_->get_length();
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
if (bottom_)
{
double length_cm = bottom_->get_value_unit(length::cm) - length_->get_value_unit(length::cm);
footer_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);//fo_min_height_
}
} }
void odf_page_layout_context::set_header_size(_CP_OPT(length) length_) void odf_page_layout_context::set_header_size(_CP_OPT(length) length_)
{ {
if (!length_) return; if (layout_state_list_.size() < 1) return;
style_header_footer_properties * header_props = get_header_properties();
if (!header_props)return;
style_page_layout_properties * props = get_properties();
if (!props)return;
length_ = length(length_->get_value_unit(length::cm),length::cm); layout_state_list_.back().header_size_ = length_;
_CP_OPT(length) top_;
if (props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_) return;
top_ = props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_->get_length();;
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
if (top_)
{
double length_cm = top_->get_value_unit(length::cm) - length_->get_value_unit(length::cm);
header_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);//fo_min_height_
}
} }
void odf_page_layout_context::set_background(_CP_OPT(color) & color, int type) void odf_page_layout_context::set_background(_CP_OPT(color) & color, int type)
...@@ -253,6 +223,41 @@ void odf_page_layout_context::add_footer(int type) ...@@ -253,6 +223,41 @@ void odf_page_layout_context::add_footer(int type)
create_element(L"style", L"footer", elm, odf_context_); create_element(L"style", L"footer", elm, odf_context_);
master_state_list_.back().add_footer(elm); master_state_list_.back().add_footer(elm);
/////////////////////////////////////////////////////////////////////
// 1
if (!layout_state_list_.back().footer_size_) return;
style_header_footer_properties * footer_props = get_footer_properties();
if (!footer_props)return;
style_page_layout_properties * props = get_properties();
if (!props)return;
length length_ = length(layout_state_list_.back().footer_size_->get_value_unit(length::cm),length::cm);
_CP_OPT(length) bottom_;
if (props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_)
bottom_= props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_->get_length();
if (bottom_)
{
double length_cm = bottom_->get_value_unit(length::cm) - length_.get_value_unit(length::cm);
if (length_cm > 0.01)
{
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
footer_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);//fo_min_height_
}
else if (-length_cm >0.01)
{
footer_props->style_header_footer_properties_attlist_.svg_height_ = length(-length_cm,length::cm);//fo_min_height_
}
}else
{
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
}
layout_state_list_.back().footer_size_ = boost::none;
} }
void odf_page_layout_context::add_header(int type) void odf_page_layout_context::add_header(int type)
{ {
...@@ -266,7 +271,110 @@ void odf_page_layout_context::add_header(int type) ...@@ -266,7 +271,110 @@ void odf_page_layout_context::add_header(int type)
create_element(L"style", L"header", elm, odf_context_); create_element(L"style", L"header", elm, odf_context_);
master_state_list_.back().add_header(elm); master_state_list_.back().add_header(elm);
////////////////////////////////////////////////////////////////////////
//
if (!layout_state_list_.back().header_size_) return;
style_header_footer_properties * header_props = get_header_properties();
if (!header_props)return;
style_page_layout_properties * props = get_properties();
if (!props)return;
length length_ = length(layout_state_list_.back().header_size_->get_value_unit(length::cm),length::cm);
_CP_OPT(length) top_;
if (props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_)
top_ = props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_->get_length();;
if (top_)
{
double length_cm = top_->get_value_unit(length::cm) - length_.get_value_unit(length::cm);
if (length_cm > 0.01)
{
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
header_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);//fo_min_height_
}
else if (-length_cm >0.01)
{
header_props->style_header_footer_properties_attlist_.svg_height_ = length(-length_cm,length::cm);//fo_min_height_
}
}
else
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
layout_state_list_.back().header_size_ = boost::none;
}
void odf_page_layout_context::set_page_border_padding_bottom(int offset_type, double length_pt)
{
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, double length_pt)
{
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_;
}
void odf_page_layout_context::set_page_border_padding_left(int offset_type, double length_pt)
{
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_left_)
{
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;
}
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, double length_pt)
{
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)
...@@ -287,12 +395,18 @@ void odf_page_layout_context::set_page_border(std::wstring top, std::wstring lef ...@@ -287,12 +395,18 @@ void odf_page_layout_context::set_page_border(std::wstring top, std::wstring lef
} }
else else
{ {
props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_bottom_ =
props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_top_ =
props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_left_ =
props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_right_ = props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_;
props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_ = boost::none; props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_ = boost::none;
if (bottom.length() >0 )props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_bottom_ = bottom; if (bottom.length() >0 )props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_bottom_ = bottom;
if (top.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_top_ = top; if (top.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_top_ = top;
if (left.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_left_ = left; if (left.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_left_ = left;
if (right.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_right_ = right; if (right.length() >0 ) props->style_page_layout_properties_attlist_.common_border_attlist_.fo_border_right_ = right;
} }
} }
void odf_page_layout_context::set_page_size(_CP_OPT(length) width, _CP_OPT(length) height) void odf_page_layout_context::set_page_size(_CP_OPT(length) width, _CP_OPT(length) height)
...@@ -308,6 +422,20 @@ void odf_page_layout_context::set_page_size(_CP_OPT(length) width, _CP_OPT(lengt ...@@ -308,6 +422,20 @@ void odf_page_layout_context::set_page_size(_CP_OPT(length) width, _CP_OPT(lengt
length(height->get_value_unit(length::cm),length::cm); length(height->get_value_unit(length::cm),length::cm);
} }
void odf_page_layout_context::set_pages_mirrored(bool val)
{
//for all
for (long i=0; i < layout_state_list_.size(); i++)
{
layout_state_list_[i].set_pages_mirrored(val);
}
}
void odf_page_layout_context::set_title_page_enable(bool val)
{
}
style_page_layout_properties * odf_page_layout_context::get_properties() style_page_layout_properties * odf_page_layout_context::get_properties()
{ {
if (layout_state_list_.size() < 1) return NULL; if (layout_state_list_.size() < 1) return NULL;
......
...@@ -50,9 +50,18 @@ public: ...@@ -50,9 +50,18 @@ public:
void set_page_border(std::wstring top, std::wstring left, std::wstring bottom, std::wstring right); 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_shadow(bool val);
void set_page_border_padding_bottom(int offset_type, double length_pt);
void set_page_border_padding_top(int offset_type, double length_pt);
void set_page_border_padding_left(int offset_type, double length_pt);
void set_page_border_padding_right(int offset_type, double length_pt);
void set_page_orientation(int type); void set_page_orientation(int type);
void set_page_size(_CP_OPT(length) width, _CP_OPT(length) height); void set_page_size(_CP_OPT(length) width, _CP_OPT(length) height);
void set_title_page_enable(bool val);
void set_pages_mirrored(bool val);
void add_footer(int type); void add_footer(int type);
void set_footer_size(_CP_OPT(length) length_); void set_footer_size(_CP_OPT(length) length_);
void add_header(int type); void add_header(int type);
......
...@@ -127,6 +127,16 @@ std::wstring odf_layout_state::get_name() ...@@ -127,6 +127,16 @@ std::wstring odf_layout_state::get_name()
return style_->style_page_layout_attlist_.style_name_.get_value_or(L""); return style_->style_page_layout_attlist_.style_name_.get_value_or(L"");
} }
void odf_layout_state::set_pages_mirrored(bool val)
{
style_page_layout* style_ = dynamic_cast<style_page_layout*>(elements_[0].elm.get());//0 - root
if (!style_)return;
style_->style_page_layout_attlist_.style_page_usage_ = page_usage(page_usage::Mirrored);
}
style_page_layout_properties *odf_layout_state::get_properties() style_page_layout_properties *odf_layout_state::get_properties()
{ {
style_page_layout_properties *result=NULL; style_page_layout_properties *result=NULL;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include "length.h"
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
...@@ -68,6 +69,12 @@ public: ...@@ -68,6 +69,12 @@ public:
style_page_layout_properties *get_properties();// ... style_page_layout_properties *get_properties();// ...
style_header_footer_properties *get_header_properties();//-''- style_header_footer_properties *get_header_properties();//-''-
style_header_footer_properties *get_footer_properties();//-''- style_header_footer_properties *get_footer_properties();//-''-
void set_pages_mirrored(bool val);
_CP_OPT(length) header_size_;
_CP_OPT(length) footer_size_;
private: private:
std::wstring style_oox_name_; std::wstring style_oox_name_;
......
...@@ -30,9 +30,31 @@ odf_text_context::odf_text_context(odf_conversion_context *odf_context) ...@@ -30,9 +30,31 @@ odf_text_context::odf_text_context(odf_conversion_context *odf_context)
current_outline_ = 0; current_outline_ = 0;
in_field_ = false; in_field_ = false;
keep_next_paragraph_ = false;
list_state_.currnet_level = -1 ;
list_state_.started_list = false;
list_state_.started_list_item = false;
} }
odf_text_context::~odf_text_context() odf_text_context::~odf_text_context()
{ {
}
void odf_text_context::clear_params()
{
single_paragraph_ = false;
paragraph_properties_ = NULL;
text_properties_ = NULL;
current_outline_ = 0;
in_field_ = false;
keep_next_paragraph_ = false;
list_state_.currnet_level = -1 ;
list_state_.started_list = false;
list_state_.started_list_item = false;
} }
void odf_text_context::set_styles_context(odf_style_context* styles_context) void odf_text_context::set_styles_context(odf_style_context* styles_context)
{ {
...@@ -202,8 +224,11 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled) ...@@ -202,8 +224,11 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
text_h* h = dynamic_cast<text_h*>(elm.get()); text_h* h = dynamic_cast<text_h*>(elm.get());
if (h)p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(parent_paragraph_style_); if (h)p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(parent_paragraph_style_);
} }
if (paragraph_properties_)paragraph_properties_->content().fo_break_before_ = need_break_; if (paragraph_properties_ && need_break_)
{
paragraph_properties_->content().fo_break_before_ = need_break_;
need_break_ = boost::none; need_break_ = boost::none;
}
odf_element_state state={elm, style_name, style_elm,level}; odf_element_state state={elm, style_name, style_elm,level};
text_elements_list_.push_back(state); text_elements_list_.push_back(state);
...@@ -221,7 +246,7 @@ void odf_text_context::end_paragraph() ...@@ -221,7 +246,7 @@ void odf_text_context::end_paragraph()
current_level_.pop_back(); current_level_.pop_back();
} }
paragraph_properties_ = NULL; paragraph_properties_ = NULL;
//need_break_ = boost::none; text_properties_ = NULL;
} }
void odf_text_context::start_element(office_element_ptr & elm, office_element_ptr style_elm ,std::wstring style_name) void odf_text_context::start_element(office_element_ptr & elm, office_element_ptr style_elm ,std::wstring style_name)
...@@ -260,6 +285,7 @@ void odf_text_context::start_span(bool styled) ...@@ -260,6 +285,7 @@ void odf_text_context::start_span(bool styled)
std::wstring style_name; std::wstring style_name;
office_element_ptr style_elm; office_element_ptr style_elm;
text_properties_ = NULL;
if (styled) if (styled)
{ {
odf_style_state_ptr style_state = styles_context_->last_state(style_family::Text); odf_style_state_ptr style_state = styles_context_->last_state(style_family::Text);
...@@ -324,17 +350,25 @@ void odf_text_context::start_list_item() ...@@ -324,17 +350,25 @@ void odf_text_context::start_list_item()
current_level_.back().elm->add_child_element(list_elm); current_level_.back().elm->add_child_element(list_elm);
current_level_.push_back(state); current_level_.push_back(state);
list_state_.started_list_item = true;
list_state_.currnet_level++;
} }
void odf_text_context::end_list_item() void odf_text_context::end_list_item()
{ {
if (styles_context_ == NULL || single_paragraph_)return; if (styles_context_ == NULL || single_paragraph_)
return;
if (current_level_.size() > 0) if (current_level_.size() > 0)
current_level_.pop_back(); current_level_.pop_back();
list_state_.currnet_level--;
list_state_.started_list_item = false;
} }
void odf_text_context::start_list(std::wstring style_name) void odf_text_context::start_list(std::wstring style_name) //todoooo add new_numbering ???
{ {
if (styles_context_ == NULL || single_paragraph_)return; if (styles_context_ == NULL || single_paragraph_)return;
office_element_ptr list_elm; office_element_ptr list_elm;
create_element(L"text", L"list", list_elm, odf_context_); create_element(L"text", L"list", list_elm, odf_context_);
...@@ -346,7 +380,11 @@ void odf_text_context::start_list(std::wstring style_name) ...@@ -346,7 +380,11 @@ void odf_text_context::start_list(std::wstring style_name)
if (style_name.length() > 0) if (style_name.length() > 0)
{ {
text_list* list = dynamic_cast<text_list*>(list_elm.get()); text_list* list = dynamic_cast<text_list*>(list_elm.get());
if (list) list->text_style_name_ = style_ref(style_name); if (list)
{
list->text_style_name_ = style_ref(style_name);
list->text_continue_numbering_ = true;
}
} }
text_elements_list_.push_back(state); text_elements_list_.push_back(state);
...@@ -354,6 +392,8 @@ void odf_text_context::start_list(std::wstring style_name) ...@@ -354,6 +392,8 @@ void odf_text_context::start_list(std::wstring style_name)
current_level_.back().elm->add_child_element(list_elm); current_level_.back().elm->add_child_element(list_elm);
current_level_.push_back(state); current_level_.push_back(state);
list_state_.started_list = true;
} }
void odf_text_context::end_list() void odf_text_context::end_list()
{ {
...@@ -361,6 +401,9 @@ void odf_text_context::end_list() ...@@ -361,6 +401,9 @@ void odf_text_context::end_list()
if (current_level_.size() > 0) if (current_level_.size() > 0)
current_level_.pop_back(); current_level_.pop_back();
list_state_.started_list_item = false;
list_state_.started_list = false;
} }
/////////////////////////////////////////////////////////////////////////////////////////// LIST /////////////////////////////////////////////////////////////////////////////////////////// LIST
void odf_text_context::start_field(int type) void odf_text_context::start_field(int type)
...@@ -435,7 +478,16 @@ void odf_text_context::add_tab() ...@@ -435,7 +478,16 @@ void odf_text_context::add_tab()
if (current_level_.size()>0) if (current_level_.size()>0)
current_level_.back().elm->add_child_element(elm); current_level_.back().elm->add_child_element(elm);
} }
void odf_text_context::add_break(int type, int clear) void odf_text_context::save_property_break()
{
if (paragraph_properties_ == NULL) return;
if (!need_break_) return;
paragraph_properties_->content().fo_break_before_ = need_break_;
need_break_ = boost::none;
}
void odf_text_context::set_type_break(int type, int clear)
{ {
//brclearAll = 0, //brclearAll = 0,
//brclearLeft = 1, //brclearLeft = 1,
......
...@@ -29,6 +29,7 @@ public: ...@@ -29,6 +29,7 @@ public:
odf_text_context(odf_conversion_context *odf_context); odf_text_context(odf_conversion_context *odf_context);
~odf_text_context(); ~odf_text_context();
public: public:
void clear_params();
void set_styles_context(odf_style_context* styles_context);// embedded void set_styles_context(odf_style_context* styles_context);// embedded
odf_style_context* get_styles_context();// embedded odf_style_context* get_styles_context();// embedded
...@@ -46,7 +47,6 @@ public: ...@@ -46,7 +47,6 @@ public:
void start_paragraph(office_element_ptr & elm, bool styled = false); void start_paragraph(office_element_ptr & elm, bool styled = false);
void end_paragraph(); void end_paragraph();
bool is_need_break(){return bool(need_break_);}
void start_element(office_element_ptr & elm, office_element_ptr style_elm = office_element_ptr(),std::wstring style_name = L""); void start_element(office_element_ptr & elm, office_element_ptr style_elm = office_element_ptr(),std::wstring style_name = L"");
void end_element(); void end_element();
...@@ -63,7 +63,10 @@ public: ...@@ -63,7 +63,10 @@ public:
void start_list(std::wstring style_name); void start_list(std::wstring style_name);
void end_list(); void end_list();
void add_break(int type, int clear); bool is_need_break(){return bool(need_break_);}
void set_type_break(int type, int clear);
void save_property_break();
void add_tab(); void add_tab();
int current_outline_; int current_outline_;
...@@ -79,7 +82,22 @@ public: ...@@ -79,7 +82,22 @@ public:
style_paragraph_properties *get_paragraph_properties(){return paragraph_properties_;} style_paragraph_properties *get_paragraph_properties(){return paragraph_properties_;}
void set_outline_level(int level); void set_outline_level(int level);
bool get_KeepNextParagraph() {return keep_next_paragraph_;}
void set_KeepNextParagraph(bool val) {keep_next_paragraph_ = val;}
bool get_list_item_state() {return list_state_.started_list_item;}
struct _list_state
{
bool started_list_item;
bool started_list;
int currnet_level;
}list_state_;
private: private:
bool keep_next_paragraph_;
_CP_OPT(fo_break) need_break_; _CP_OPT(fo_break) need_break_;
bool single_paragraph_; bool single_paragraph_;
......
...@@ -45,9 +45,6 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc ...@@ -45,9 +45,6 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc
is_hyperlink_ = false; is_hyperlink_ = false;
is_footer_header_ = false; is_footer_header_ = false;
list_state_.currnet_level = -1 ;
list_state_.started = false;
drop_cap_state_.clear(); drop_cap_state_.clear();
} }
...@@ -221,10 +218,16 @@ void odt_conversion_context::add_page_break() ...@@ -221,10 +218,16 @@ void odt_conversion_context::add_page_break()
//http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415190_253892949 //http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415190_253892949
// !! span, ... !! // !! span, ... !!
if (para = dynamic_cast<text_p*>(current_root_elements_.back().elm.get())) //if (para = dynamic_cast<text_p*>(current_root_elements_.back().elm.get()))
//{
// style_ = dynamic_cast<style*>(current_root_elements_.back().style_elm.get());//
// end_paragraph();
//}
//else/* if (header = dynamic_cast<text_h*>(current_root_elements_.back().elm.get()))*/
{ {
style_ = dynamic_cast<style*>(current_root_elements_.back().style_elm.get()); // ( ) -
end_paragraph(); // -
text_context()->save_property_break();
} }
text_context()->start_element(elm); text_context()->start_element(elm);
add_to_root(); add_to_root();
...@@ -238,7 +241,7 @@ void odt_conversion_context::add_page_break() ...@@ -238,7 +241,7 @@ void odt_conversion_context::add_page_break()
{ {
style_paragraph_properties * new_props = NULL; style_paragraph_properties * new_props = NULL;
if (styles_context()->last_state()) if (styles_context()->last_state())
{ {// -
new_props = styles_context()->last_state()->get_paragraph_properties(); new_props = styles_context()->last_state()->get_paragraph_properties();
if (new_props)new_props->apply_from(style_->style_content_.get_style_paragraph_properties()); if (new_props)new_props->apply_from(style_->style_content_.get_style_paragraph_properties());
...@@ -439,55 +442,44 @@ void odt_conversion_context::end_paragraph() ...@@ -439,55 +442,44 @@ void odt_conversion_context::end_paragraph()
void odt_conversion_context::start_list_item(int level, std::wstring style_name ) void odt_conversion_context::start_list_item(int level, std::wstring style_name )
{ {
if (list_state_.started == false) if (text_context()->list_state_.started_list == false)
{ {
text_context()->start_list(style_name); text_context()->start_list(style_name);
list_state_.started = true;
add_to_root(); add_to_root();
} }
/* if (list_state_.currnet_level == level)
{ if (text_context()->list_state_.currnet_level >= level)
text_context()->start_list_item();
list_state_.currnet_level++;
}
else */
if (list_state_.currnet_level >= level)
{ {
while (list_state_.currnet_level >= level) while (text_context()->list_state_.currnet_level >= level)
{ {
text_context()->end_list_item(); text_context()->end_list_item();
list_state_.currnet_level--;
} }
} }
if (list_state_.currnet_level < level) if (text_context()->list_state_.currnet_level < level)
{ {
while (list_state_.currnet_level < level) while (text_context()->list_state_.currnet_level < level)
{ {
text_context()->start_list_item(); text_context()->start_list_item();
list_state_.currnet_level++;
} }
} }
} }
void odt_conversion_context::end_list_item() void odt_conversion_context::end_list_item()
{ {
if (list_state_.currnet_level < 0) return; if (text_context()->list_state_.currnet_level < 0)
return;
text_context()->end_list_item(); text_context()->end_list_item();
list_state_.currnet_level--;
} }
void odt_conversion_context::set_no_list() void odt_conversion_context::set_no_list()
{ {
if (list_state_.started == false) return; if (text_context()->list_state_.started_list == false) return;
while (list_state_.currnet_level >=0) while (text_context()->list_state_.currnet_level >=0)
{ {
text_context()->end_list_item(); text_context()->end_list_item();
list_state_.currnet_level--;
} }
text_context()->end_list(); text_context()->end_list();
list_state_.started = false;
} }
void odt_conversion_context::flush_section() void odt_conversion_context::flush_section()
{ {
...@@ -495,7 +487,8 @@ void odt_conversion_context::flush_section() ...@@ -495,7 +487,8 @@ void odt_conversion_context::flush_section()
{ {
for (long i=0; i< current_root_elements_.size(); i++) for (long i=0; i< current_root_elements_.size(); i++)
{ {
if (sections_.back().continuous && i<2)// - add_page_break if ((sections_.back().continuous && i<2) || !sections_.back().continuous)
// - add_page_break
{ {
text_soft_page_break * break_ = dynamic_cast<text_soft_page_break*>(current_root_elements_[i].elm.get()); text_soft_page_break * break_ = dynamic_cast<text_soft_page_break*>(current_root_elements_[i].elm.get());
if (break_) if (break_)
......
...@@ -154,18 +154,7 @@ private: ...@@ -154,18 +154,7 @@ private:
double characters_size_pt; double characters_size_pt;
}drop_cap_state_; }drop_cap_state_;
struct _list_state
{
// office_element_ptr elm;
// office_element_ptr style_elm;
// std::wstring style_name;
//
// bool empty;
// bool continuous;
bool started;
int currnet_level;
}list_state_;
}; };
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "Shapes\oox_shapePrimitives.h" #include "Shapes\oox_shapePrimitives.h"
#include "Shapes\oox_shapeRibbons.h" #include "Shapes\oox_shapeRibbons.h"
#include "Shapes\oox_shapeConnectors.h" #include "Shapes\oox_shapeConnectors.h"
#include "Shapes\oox_shapeWordArt.h"
#include "..\..\..\Common\DocxFormat\Source\Common\SimpleTypes_Drawing.h" #include "..\..\..\Common\DocxFormat\Source\Common\SimpleTypes_Drawing.h"
...@@ -37,10 +38,51 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType) ...@@ -37,10 +38,51 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
case SimpleTypes::shapetypeStar16: return boost::make_shared<oox_shape_star16>(); case SimpleTypes::shapetypeStar16: return boost::make_shared<oox_shape_star16>();
case SimpleTypes::shapetypeStar32: return boost::make_shared<oox_shape_star32>(); case SimpleTypes::shapetypeStar32: return boost::make_shared<oox_shape_star32>();
//case (2001 + SimpleTypes::textshapetypeTextArchDown):
//case (2001 + SimpleTypes::textshapetypeTextArchDownPour):
//case (2001 + SimpleTypes::textshapetypeTextArchUp):
//case (2001 + SimpleTypes::textshapetypeTextArchUpPour):
//case (2001 + SimpleTypes::textshapetypeTextButton):
//case (2001 + SimpleTypes::textshapetypeTextButtonPour):
//case (2001 + SimpleTypes::textshapetypeTextCanDown):
//case (2001 + SimpleTypes::textshapetypeTextCanUp):
//case (2001 + SimpleTypes::textshapetypeTextCascadeDown):
//case (2001 + SimpleTypes::textshapetypeTextCascadeUp):
//case (2001 + SimpleTypes::textshapetypeTextChevron):
//case (2001 + SimpleTypes::textshapetypeTextChevronInverted):
//case (2001 + SimpleTypes::textshapetypeTextCircle):
case (2001 + SimpleTypes::textshapetypeTextCirclePour): return boost::make_shared<oox_shape_textCirclePour>();
//case (2001 + SimpleTypes::textshapetypeTextCurveDown):
//case (2001 + SimpleTypes::textshapetypeTextCurveUp):
//case (2001 + SimpleTypes::textshapetypeTextDeflate):
//case (2001 + SimpleTypes::textshapetypeTextDeflateBottom):
//case (2001 + SimpleTypes::textshapetypeTextDeflateInflate):
//case (2001 + SimpleTypes::textshapetypeTextDeflateInflateDeflate):
//case (2001 + SimpleTypes::textshapetypeTextDeflateTop):
//case (2001 + SimpleTypes::textshapetypeTextDoubleWave1):
//case (2001 + SimpleTypes::textshapetypeTextFadeDown):
//case (2001 + SimpleTypes::textshapetypeTextFadeLeft):
//case (2001 + SimpleTypes::textshapetypeTextFadeRight):
//case (2001 + SimpleTypes::textshapetypeTextFadeUp):
//case (2001 + SimpleTypes::textshapetypeTextInflate):
//case (2001 + SimpleTypes::textshapetypeTextInflateBottom):
//case (2001 + SimpleTypes::textshapetypeTextInflateTop):
case (2001 + SimpleTypes::textshapetypeTextPlain): return boost::make_shared<oox_shape_textPlain>();
//case (2001 + SimpleTypes::textshapetypeTextRingInside):
//case (2001 + SimpleTypes::textshapetypeTextRingOutside):
//case (2001 + SimpleTypes::textshapetypeTextSlantDown):
//case (2001 + SimpleTypes::textshapetypeTextSlantUp):
//case (2001 + SimpleTypes::textshapetypeTextStop):
//case (2001 + SimpleTypes::textshapetypeTextTriangle):
//case (2001 + SimpleTypes::textshapetypeTextTriangleInverted):
//case (2001 + SimpleTypes::textshapetypeTextWave1):
//case (2001 + SimpleTypes::textshapetypeTextWave2):
//case (2001 + SimpleTypes::textshapetypeTextWave4):
//case SimpleTypes::shapetypeStraightConnector1: return boost::make_shared<oox_shape_straightConnector1>(); //case SimpleTypes::shapetypeStraightConnector1: return boost::make_shared<oox_shape_straightConnector1>();
default: default:
return boost::make_shared<oox_shape>(); if (ooxPrstGeomType > 2000) return boost::make_shared<oox_shape_textPlain>();
else return boost::make_shared<oox_shape>();
} }
} }
......
...@@ -28,73 +28,42 @@ class style_page_layout_properties_attlist ...@@ -28,73 +28,42 @@ class style_page_layout_properties_attlist
{ {
public: public:
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
_CP_OPT(length) fo_page_width_; // +
_CP_OPT(length) fo_page_height_; // + _CP_OPT(length) fo_page_width_;
_CP_OPT(length) fo_page_height_;
common_num_format_attlist common_num_format_attlist_; common_num_format_attlist common_num_format_attlist_;
common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_; common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
_CP_OPT(std::wstring) style_paper_tray_name_;
_CP_OPT(std::wstring) style_print_orientation_; // +
//15.2.5
common_horizontal_margin_attlist common_horizontal_margin_attlist_; common_horizontal_margin_attlist common_horizontal_margin_attlist_;
common_vertical_margin_attlist common_vertical_margin_attlist_; common_vertical_margin_attlist common_vertical_margin_attlist_;
common_margin_attlist common_margin_attlist_; common_margin_attlist common_margin_attlist_;
// 15.2.6
common_border_attlist common_border_attlist_; common_border_attlist common_border_attlist_;
// 15.2.7
common_border_line_width_attlist common_border_line_width_attlist_; common_border_line_width_attlist common_border_line_width_attlist_;
// 15.2.8
common_padding_attlist common_padding_attlist_; common_padding_attlist common_padding_attlist_;
// 15.2.9
common_shadow_attlist common_shadow_attlist_; common_shadow_attlist common_shadow_attlist_;
// 15.2.10
common_background_color_attlist common_background_color_attlist_; common_background_color_attlist common_background_color_attlist_;
// 15.2.12 common_writing_mode_attlist common_writing_mode_attlist_;
_CP_OPT(style_ref) style_register_truth_ref_style_name_; _CP_OPT(style_ref) style_register_truth_ref_style_name_;
// 15.2.13 TODO
_CP_OPT(std::wstring) style_print_; _CP_OPT(std::wstring) style_print_;
_CP_OPT(std::wstring) style_paper_tray_name_;
// 15.2.14 _CP_OPT(std::wstring) style_print_orientation_;
_CP_OPT(direction) style_print_page_order_; _CP_OPT(direction) style_print_page_order_;
// 15.2.15 TODO
_CP_OPT(std::wstring) style_first_page_number_; _CP_OPT(std::wstring) style_first_page_number_;
// 15.2.16
_CP_OPT(percent) style_scale_to_; _CP_OPT(percent) style_scale_to_;
_CP_OPT(unsigned int) style_scale_to_pages_; _CP_OPT(unsigned int) style_scale_to_pages_;
// 15.2.17
_CP_OPT(table_centering) style_table_centering_; _CP_OPT(table_centering) style_table_centering_;
// 15.2.18
_CP_OPT(length) style_footnote_max_height_; _CP_OPT(length) style_footnote_max_height_;
// 15.2.19
common_writing_mode_attlist common_writing_mode_attlist_;
// 15.2.21
_CP_OPT(layout_grid_mode) style_layout_grid_mode_; _CP_OPT(layout_grid_mode) style_layout_grid_mode_;
// 15.2.22
_CP_OPT(length) style_layout_grid_base_height_; _CP_OPT(length) style_layout_grid_base_height_;
// 15.2.23
_CP_OPT(length) style_layout_grid_ruby_height_; _CP_OPT(length) style_layout_grid_ruby_height_;
// 15.2.24
_CP_OPT(unsigned int) style_layout_grid_lines_; _CP_OPT(unsigned int) style_layout_grid_lines_;
// 15.2.25
_CP_OPT(color) style_layout_grid_color_; _CP_OPT(color) style_layout_grid_color_;
// 15.2.26
_CP_OPT(Bool) style_layout_grid_ruby_below_; _CP_OPT(Bool) style_layout_grid_ruby_below_;
// 15.2.27
_CP_OPT(Bool) style_layout_grid_print_; _CP_OPT(Bool) style_layout_grid_print_;
// 15.2.28
_CP_OPT(Bool) style_layout_grid_display_; _CP_OPT(Bool) style_layout_grid_display_;
}; };
......
...@@ -56,209 +56,113 @@ private: ...@@ -56,209 +56,113 @@ private:
public: public:
_CP_OPT(std::wstring) r_style_; _CP_OPT(std::wstring) r_style_;
_CP_OPT(font_variant) fo_font_variant_;
_CP_OPT(text_transform) fo_text_transform_;
_CP_OPT(color) fo_color_;
// 15.4.1 fo:font-variant
_CP_OPT(font_variant) fo_font_variant_; // +
// 15.4.2 fo:text-transform
_CP_OPT(text_transform) fo_text_transform_; // +
// 15.4.3 fo:color
_CP_OPT(color) fo_color_; // +
// 15.4.4 style:use-window-font-color
_CP_OPT(Bool) style_use_window_font_color_; _CP_OPT(Bool) style_use_window_font_color_;
_CP_OPT(Bool) style_text_outline_;
// 15.4.5 style:text-outline _CP_OPT(line_type) style_text_line_through_type_;
_CP_OPT(Bool) style_text_outline_; // + _CP_OPT(line_style) style_text_line_through_style_;
// 15.4.6 style:text-line-through-type
_CP_OPT(line_type) style_text_line_through_type_; // +
// 15.4.7 style:text-line-through-style
_CP_OPT(line_style) style_text_line_through_style_; // +
// 15.4.8 style:text-line-through-width
_CP_OPT(line_width) style_text_line_through_width_; _CP_OPT(line_width) style_text_line_through_width_;
// 15.4.9 style:text-line-through-color
_CP_OPT(color) style_text_line_through_color_; _CP_OPT(color) style_text_line_through_color_;
// 15.4.10 style:text-line-through-text
_CP_OPT(std::wstring) style_text_line_through_text_; _CP_OPT(std::wstring) style_text_line_through_text_;
// 15.4.11 style:text-line-through-text-style
_CP_OPT(style_ref) style_text_line_through_text_style_; _CP_OPT(style_ref) style_text_line_through_text_style_;
// 15.4.12 style:text-position _CP_OPT(text_position) style_text_position_;
_CP_OPT(text_position) style_text_position_; // +
// 15.4.13 style:font-name _CP_OPT(std::wstring) style_font_name_;
_CP_OPT(std::wstring) style_font_name_; // + _CP_OPT(std::wstring) style_font_name_asian_;
// style:font-name-asian _CP_OPT(std::wstring) style_font_name_complex_;
_CP_OPT(std::wstring) style_font_name_asian_; // +
// style:font-name-complex
_CP_OPT(std::wstring) style_font_name_complex_; // +
// 15.4.14 fo:font-family
_CP_OPT(std::wstring) fo_font_family_; _CP_OPT(std::wstring) fo_font_family_;
// style:font-family-asian
_CP_OPT(std::wstring) style_font_family_asian_; _CP_OPT(std::wstring) style_font_family_asian_;
// style:font-family-complex
_CP_OPT(std::wstring) style_font_family_complex_; _CP_OPT(std::wstring) style_font_family_complex_;
// 15.4.15 style:font-family-generic
_CP_OPT(font_family_generic) style_font_family_generic_; _CP_OPT(font_family_generic) style_font_family_generic_;
// style:font-family-generic-asian
_CP_OPT(font_family_generic) style_font_family_generic_asian_; _CP_OPT(font_family_generic) style_font_family_generic_asian_;
// style:font-family-generic-complex
_CP_OPT(font_family_generic) style_font_family_generic_complex_; _CP_OPT(font_family_generic) style_font_family_generic_complex_;
// 15.4.16 style:font-style-name
_CP_OPT(std::wstring) style_font_style_name_; _CP_OPT(std::wstring) style_font_style_name_;
// style:font-style-name-asian
_CP_OPT(std::wstring) style_font_style_name_asian_; _CP_OPT(std::wstring) style_font_style_name_asian_;
// style:font-style-name-complex
_CP_OPT(std::wstring) style_font_style_name_complex_; _CP_OPT(std::wstring) style_font_style_name_complex_;
// 15.4.17 style:font-pitch
_CP_OPT(font_pitch) style_font_pitch_; _CP_OPT(font_pitch) style_font_pitch_;
// style:font-pitch
_CP_OPT(font_pitch) style_font_pitch_asian_; _CP_OPT(font_pitch) style_font_pitch_asian_;
// style:font-pitch-complex
_CP_OPT(font_pitch) style_font_pitch_complex_; _CP_OPT(font_pitch) style_font_pitch_complex_;
// 15.4.18 style:font-charset
_CP_OPT(std::wstring) style_font_charset_; _CP_OPT(std::wstring) style_font_charset_;
// style:font-charset-asian
_CP_OPT(std::wstring) style_font_charset_asian_; _CP_OPT(std::wstring) style_font_charset_asian_;
// style:font-charset-complex
_CP_OPT(std::wstring) style_font_charset_complex_; _CP_OPT(std::wstring) style_font_charset_complex_;
// 15.4.19 fo:font-size _CP_OPT(font_size) fo_font_size_;
_CP_OPT(font_size) fo_font_size_; // +
// style:font-size-asian
_CP_OPT(font_size) style_font_size_asian_; _CP_OPT(font_size) style_font_size_asian_;
// style:font-size-complex
_CP_OPT(font_size) style_font_size_complex_; _CP_OPT(font_size) style_font_size_complex_;
// 15.4.20 style:font-size-rel
_CP_OPT(length) style_font_size_rel_; _CP_OPT(length) style_font_size_rel_;
// style:font-size-rel-asian
_CP_OPT(length) style_font_size_rel_asian_; _CP_OPT(length) style_font_size_rel_asian_;
// style:font-size-rel-complex
_CP_OPT(length) style_font_size_rel_complex_; _CP_OPT(length) style_font_size_rel_complex_;
// 15.4.21 style:script-type
_CP_OPT(script_type) style_script_type_; _CP_OPT(script_type) style_script_type_;
// 15.4.22 fo:letter-spacing _CP_OPT(letter_spacing) fo_letter_spacing_;
_CP_OPT(letter_spacing) fo_letter_spacing_; // +
// 15.4.23 fo:language _CP_OPT(std::wstring) fo_language_;
_CP_OPT(std::wstring) fo_language_; // +
// style:language-asian
_CP_OPT(std::wstring) style_language_asian_; _CP_OPT(std::wstring) style_language_asian_;
// style:language-complex
_CP_OPT(std::wstring) style_language_complex_; _CP_OPT(std::wstring) style_language_complex_;
// 15.4.24 fo:country _CP_OPT(std::wstring) fo_country_;
_CP_OPT(std::wstring) fo_country_; // +
// style:country-asian
_CP_OPT(std::wstring) style_country_asian_; _CP_OPT(std::wstring) style_country_asian_;
// style:country-complex
_CP_OPT(std::wstring) style_country_complex_; _CP_OPT(std::wstring) style_country_complex_;
// 15.4.25 fo:font-style _CP_OPT(font_style) fo_font_style_;
_CP_OPT(font_style) fo_font_style_; // +
// style:font-style-asian
_CP_OPT(font_style) style_font_style_asian_; _CP_OPT(font_style) style_font_style_asian_;
// style:font-style-complex
_CP_OPT(font_style) style_font_style_complex_; _CP_OPT(font_style) style_font_style_complex_;
// 15.4.26 style:font-relief _CP_OPT(font_relief) style_font_relief_;
_CP_OPT(font_relief) style_font_relief_; // +
// 15.4.27 fo:text-shadow
_CP_OPT(shadow_type) fo_text_shadow_; // +
// 15.4.28 style:text-underline-type _CP_OPT(shadow_type) fo_text_shadow_;
_CP_OPT(line_type) style_text_underline_type_; // +
// 15.4.29 style:text-underline-style _CP_OPT(line_type) style_text_underline_type_;
_CP_OPT(line_style) style_text_underline_style_; // + _CP_OPT(line_style) style_text_underline_style_;
_CP_OPT(line_width) style_text_underline_width_;
_CP_OPT(underline_color) style_text_underline_color_;
// 15.4.30 style:text-underline-width _CP_OPT(font_weight) fo_font_weight_;
_CP_OPT(line_width) style_text_underline_width_; // +
// 15.4.31 style:text-underline-color
_CP_OPT(underline_color) style_text_underline_color_; // +
// 15.4.32 fo:font-weight
_CP_OPT(font_weight) fo_font_weight_; // +
// style:font-weight-asian
_CP_OPT(font_weight) style_font_weight_asian_; _CP_OPT(font_weight) style_font_weight_asian_;
// style:font-weight-complex
_CP_OPT(font_weight) style_font_weight_complex_; _CP_OPT(font_weight) style_font_weight_complex_;
// 15.4.33 style:text-underline-mode
_CP_OPT(line_mode) style_text_underline_mode_; _CP_OPT(line_mode) style_text_underline_mode_;
// 15.4.34 style:text-line-through-mode
_CP_OPT(line_mode) style_text_line_through_mode_; _CP_OPT(line_mode) style_text_line_through_mode_;
// 15.4.35 style:letter-kerning
_CP_OPT(Bool) style_letter_kerning_; _CP_OPT(Bool) style_letter_kerning_;
// 15.4.36 style:text-blinking
_CP_OPT(Bool) style_text_blinking_; _CP_OPT(Bool) style_text_blinking_;
// 15.4.37 fo:background-color
_CP_OPT(background_color) fo_background_color_; _CP_OPT(background_color) fo_background_color_;
// 15.4.38 style:text-combine
_CP_OPT(text_combine) style_text_combine_; _CP_OPT(text_combine) style_text_combine_;
// 15.4.39 style:text-combine-start-char
_CP_OPT(wchar_t) style_text_combine_start_char_; _CP_OPT(wchar_t) style_text_combine_start_char_;
//style:text-combine-end-char
_CP_OPT(wchar_t) style_text_combine_end_char_; _CP_OPT(wchar_t) style_text_combine_end_char_;
// 15.4.40 style:text-emphasize _CP_OPT(text_emphasize) style_text_emphasize_;
_CP_OPT(text_emphasize) style_text_emphasize_; // + _CP_OPT(percent) style_text_scale_;
// 15.4.41 style:text-scale
_CP_OPT(percent) style_text_scale_; // +
// 15.4.42 style:text-rotation-angle
_CP_OPT(int) style_text_rotation_angle_; _CP_OPT(int) style_text_rotation_angle_;
// 15.4.43 style:text-rotation-scale
_CP_OPT(text_rotation_scale) style_text_rotation_scale_; _CP_OPT(text_rotation_scale) style_text_rotation_scale_;
// 15.4.44 fo:hyphenate
_CP_OPT(Bool) fo_hyphenate_; _CP_OPT(Bool) fo_hyphenate_;
// 15.4.45 fo:hyphenation-remain-char-count
_CP_OPT(unsigned int) fo_hyphenation_remain_char_count_; _CP_OPT(unsigned int) fo_hyphenation_remain_char_count_;
// 15.4.46 fo:hyphenation-push-char-count
_CP_OPT(unsigned int) fo_hyphenation_push_char_count_; _CP_OPT(unsigned int) fo_hyphenation_push_char_count_;
// 15.4.47 text:display _CP_OPT(text_display) text_display_;
_CP_OPT(text_display) text_display_; // +
// text:condition
_CP_OPT(std::wstring) text_condition_; _CP_OPT(std::wstring) text_condition_;
// style:text-overline-color
_CP_OPT(std::wstring) style_text_overline_color_; _CP_OPT(std::wstring) style_text_overline_color_;
// style:text-overline-mode
_CP_OPT(std::wstring) style_text_overline_mode_; _CP_OPT(std::wstring) style_text_overline_mode_;
// style:text-overline-style
_CP_OPT(std::wstring) style_text_overline_style_; _CP_OPT(std::wstring) style_text_overline_style_;
common_border_attlist common_border_attlist_; common_border_attlist common_border_attlist_;
......
...@@ -129,7 +129,7 @@ public: ...@@ -129,7 +129,7 @@ public:
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
style_ref text_style_name_; style_ref text_style_name_;
_CP_OPT(bool) text_continue_numbering_; _CP_OPT(Bool) text_continue_numbering_;
office_element_ptr text_list_header_; office_element_ptr text_list_header_;
office_element_ptr_array text_list_items_; office_element_ptr_array text_list_items_;
......
...@@ -148,6 +148,10 @@ ...@@ -148,6 +148,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath=".\Oox2OdfConverter\ConvertDiagram.cpp"
>
</File>
<File <File
RelativePath=".\Oox2OdfConverter\Converter.cpp" RelativePath=".\Oox2OdfConverter\Converter.cpp"
> >
......
...@@ -81,6 +81,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -81,6 +81,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Drawing::CShape* pShape = static_cast<OOX::Drawing::CShape*>(oox_unknown); OOX::Drawing::CShape* pShape = static_cast<OOX::Drawing::CShape*>(oox_unknown);
convert(pShape); convert(pShape);
}break; }break;
case OOX::et_a_LockedCanvas:
{
OOX::Drawing::CLockedCanvas* pLockedCanvas = static_cast<OOX::Drawing::CLockedCanvas*>(oox_unknown);
convert(pLockedCanvas);
}break;
case OOX::et_a_prstGeom: case OOX::et_a_prstGeom:
{ {
OOX::Drawing::CPresetGeometry2D* pPresetGeom = static_cast<OOX::Drawing::CPresetGeometry2D*>(oox_unknown); OOX::Drawing::CPresetGeometry2D* pPresetGeom = static_cast<OOX::Drawing::CPresetGeometry2D*>(oox_unknown);
...@@ -208,21 +213,16 @@ void OoxConverter::convert(OOX::Drawing::CShape *oox_shape) ...@@ -208,21 +213,16 @@ void OoxConverter::convert(OOX::Drawing::CShape *oox_shape)
OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer(); OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
type =(geometry->m_oPrst.GetValue()); type =(geometry->m_oPrst.GetValue());
} }
if (oox_shape->m_oNvSpPr.IsInit() && oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit()) if (oox_shape->m_oNvSpPr.IsInit() && oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit() &&
{ oox_shape->m_oNvSpPr->m_oCNvSpPr->m_otxBox.GetValue() == 1) type = 2000; //textBox
if (oox_shape->m_oNvSpPr->m_oCNvSpPr->m_otxBox.GetValue() == 1)
type = 2000; //textBox
}
if (type == SimpleTypes::shapetypeRect && oox_shape->m_oTxSp.IsInit() && oox_shape->m_oTxSp->m_oTxBody.IsInit()) if (type == SimpleTypes::shapetypeRect && oox_shape->m_oTxSp.IsInit() && oox_shape->m_oTxSp->m_oTxBody.IsInit()) type = 2000;
{
type = 2000;// , , ... if (type == 2000 && oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr.IsInit() && oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr->m_oFromWordArt.ToBool())
if (oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr.IsInit())
{ {
int wordart_type = convert(oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr->m_oPrstTxWrap.GetPointer()); int wordart_type = convert(oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr->m_oPrstTxWrap.GetPointer());
if (wordart_type >=0)type = wordart_type; if (wordart_type >0)type = wordart_type;
}
} }
if (type < 0)return; if (type < 0)return;
...@@ -304,7 +304,54 @@ void OoxConverter::convert(OOX::Drawing::CGroupShapeProperties * oox_group_spP ...@@ -304,7 +304,54 @@ void OoxConverter::convert(OOX::Drawing::CGroupShapeProperties * oox_group_spP
} }
} }
void OoxConverter::convert(OOX::Drawing::CFontReference *style_font_ref)
{
if (!style_font_ref) return;
OOX::CTheme *theme = oox_theme();
if (!theme) return;
CString color;
if (style_font_ref->m_eType == OOX::Drawing::colorSheme)
{
color = style_font_ref->m_oShemeClr.m_oVal.ToString();
}
if (style_font_ref->m_oIdx.GetValue() == SimpleTypes::fontcollectionindexMajor)
{
convert(&theme->m_oThemeElements.m_oFontScheme.m_oMajorFont, &color);
}
if (style_font_ref->m_oIdx.GetValue() == SimpleTypes::fontcollectionindexMinor)
{
convert(&theme->m_oThemeElements.m_oFontScheme.m_oMinorFont, &color);
}
}
void OoxConverter::convert(OOX::Drawing::CFontCollection *style_font, CString *sheme_color)
{
if ((sheme_color) && (sheme_color->GetLength() >0))
{
std::wstring hexColor;
_CP_OPT(double) opacity;
OOX::Drawing::CSchemeColor sheme;
sheme.m_oVal.FromString(*sheme_color);
convert(&sheme, hexColor, opacity);
odf_context()->drawing_context()->set_textarea_fontcolor(hexColor);
}
if (style_font == NULL) return;
_CP_OPT(std::wstring) font_latin, font_cs, font_ea;
if (style_font->m_oCs.m_oTypeFace.IsInit()) font_cs = string2std_string(style_font->m_oCs.m_oTypeFace->GetValue());
if (style_font->m_oEa.m_oTypeFace.IsInit()) font_ea = string2std_string(style_font->m_oEa.m_oTypeFace->GetValue());
if (style_font->m_oLatin.m_oTypeFace.IsInit()) font_latin = string2std_string(style_font->m_oLatin.m_oTypeFace->GetValue());
odf_context()->drawing_context()->set_textarea_font(font_latin,font_ea,font_cs);
//nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
//CSimpleArray<OOX::Drawing::CSupplementalFont> m_arrFont;
}
void OoxConverter::convert(OOX::Drawing::CStyleMatrixReference *style_matrix_ref) void OoxConverter::convert(OOX::Drawing::CStyleMatrixReference *style_matrix_ref)
{ {
if (!style_matrix_ref) return; if (!style_matrix_ref) return;
...@@ -376,6 +423,25 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra ...@@ -376,6 +423,25 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra
bool use_fill_from_style = false; bool use_fill_from_style = false;
bool use_line_from_style = false; bool use_line_from_style = false;
if (oox_spPr->m_oXfrm.IsInit()) //CTransform2D
{
if (oox_spPr->m_oXfrm->m_oOff.IsInit())
{
odf_context()->drawing_context()->set_position(oox_spPr->m_oXfrm->m_oOff->m_oX.ToPoints(),
oox_spPr->m_oXfrm->m_oOff->m_oY.ToPoints());
}
if (oox_spPr->m_oXfrm->m_oExt.IsInit())
{
odf_context()->drawing_context()->set_size( oox_spPr->m_oXfrm->m_oExt->m_oCx.ToPoints(),
oox_spPr->m_oXfrm->m_oExt->m_oCy.ToPoints());
}
if (oox_spPr->m_oXfrm->m_oFlipH.GetValue() == SimpleTypes::onoffTrue)
odf_context()->drawing_context()->set_flip_H(true);
if (oox_spPr->m_oXfrm->m_oFlipV.GetValue() == SimpleTypes::onoffTrue)
odf_context()->drawing_context()->set_flip_V(true);
if (oox_spPr->m_oXfrm->m_oRot.GetValue() > 0)
odf_context()->drawing_context()->set_rotate(oox_spPr->m_oXfrm->m_oRot.GetValue());
}
switch(oox_spPr->m_eGeomType) switch(oox_spPr->m_eGeomType)
{ {
case OOX::Drawing::geomtypeCustom : case OOX::Drawing::geomtypeCustom :
...@@ -431,27 +497,6 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra ...@@ -431,27 +497,6 @@ void OoxConverter::convert(OOX::Drawing::CShapeProperties * oox_spPr, OOX::Dra
//nullable<OOX::Drawing::CScene3D> m_oScene3D; //nullable<OOX::Drawing::CScene3D> m_oScene3D;
//nullable<OOX::Drawing::CShape3D> m_oSp3D; //nullable<OOX::Drawing::CShape3D> m_oSp3D;
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
if (oox_spPr->m_oXfrm.IsInit()) //CTransform2D
{
if (oox_spPr->m_oXfrm->m_oOff.IsInit())
{
odf_context()->drawing_context()->set_position(oox_spPr->m_oXfrm->m_oOff->m_oX.ToPoints(),
oox_spPr->m_oXfrm->m_oOff->m_oY.ToPoints());
}
if (oox_spPr->m_oXfrm->m_oExt.IsInit())
{
odf_context()->drawing_context()->set_size( oox_spPr->m_oXfrm->m_oExt->m_oCx.ToPoints(),
oox_spPr->m_oXfrm->m_oExt->m_oCy.ToPoints());
}
if (oox_spPr->m_oXfrm->m_oFlipH.GetValue() == SimpleTypes::onoffTrue)
odf_context()->drawing_context()->set_flip_H(true);
if (oox_spPr->m_oXfrm->m_oFlipV.GetValue() == SimpleTypes::onoffTrue)
odf_context()->drawing_context()->set_flip_V(true);
if (oox_spPr->m_oXfrm->m_oRot.GetValue() > 0)
odf_context()->drawing_context()->set_rotate(oox_spPr->m_oXfrm->m_oRot.GetValue());
}
} }
void OoxConverter::convert(OOX::Drawing::CNonVisualDrawingProps * oox_cnvPr) void OoxConverter::convert(OOX::Drawing::CNonVisualDrawingProps * oox_cnvPr)
{ {
...@@ -972,64 +1017,21 @@ void OoxConverter::convert(OOX::Drawing::CTextBodyProperties *oox_bodyPr) ...@@ -972,64 +1017,21 @@ void OoxConverter::convert(OOX::Drawing::CTextBodyProperties *oox_bodyPr)
//+ style section //+ style section
//+element text:section //+element text:section
} }
if (oox_bodyPr->m_oFromWordArt.ToBool() && oox_bodyPr->m_oPrstTxWrap.IsInit())
//for (long i=0; i<oox_prst_geom->m_oAvLst->m_arrGd.GetSize(); i++) {
//{ for (long i=0; i< oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd.GetSize(); i++)
// odf_context()->drawing_context()->add_modifier(string2std_string(oox_prst_geom->m_oAvLst->m_arrGd[i].m_oFmla.GetValue())); {
//} odf_context()->drawing_context()->add_modifier(string2std_string(oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd[i].m_oFmla.GetValue()));
}
}
} }
int OoxConverter::convert(OOX::Drawing::CPresetTextShape *oox_text_preset) int OoxConverter::convert(OOX::Drawing::CPresetTextShape *oox_text_preset)
{ {
if (oox_text_preset == NULL) return -1; if (oox_text_preset == NULL) return -1;
if (oox_text_preset->m_oPrst.GetValue() == SimpleTypes::textshapetypeTextNoShape) return -1;
int type = 2001 + oox_text_preset->m_oPrst.GetValue(); return 2001 + oox_text_preset->m_oPrst.GetValue();
switch(oox_text_preset->m_oPrst.GetValue())
{
case SimpleTypes::textshapetypeTextArchDown : break;
case SimpleTypes::textshapetypeTextArchDownPour : break;
case SimpleTypes::textshapetypeTextArchUp : break;
case SimpleTypes::textshapetypeTextArchUpPour : break;
case SimpleTypes::textshapetypeTextButton : break;
case SimpleTypes::textshapetypeTextButtonPour : break;
case SimpleTypes::textshapetypeTextCanDown : break;
case SimpleTypes::textshapetypeTextCanUp : break;
case SimpleTypes::textshapetypeTextCascadeDown : break;
case SimpleTypes::textshapetypeTextCascadeUp : break;
case SimpleTypes::textshapetypeTextChevron : break;
case SimpleTypes::textshapetypeTextChevronInverted: break;
case SimpleTypes::textshapetypeTextCircle : break;
case SimpleTypes::textshapetypeTextCirclePour : break;
case SimpleTypes::textshapetypeTextCurveDown : break;
case SimpleTypes::textshapetypeTextCurveUp : break;
case SimpleTypes::textshapetypeTextDeflate : break;
case SimpleTypes::textshapetypeTextDeflateBottom: break;
case SimpleTypes::textshapetypeTextDeflateInflate: break;
case SimpleTypes::textshapetypeTextDeflateInflateDeflate: break;
case SimpleTypes::textshapetypeTextDeflateTop : break;
case SimpleTypes::textshapetypeTextDoubleWave1 : break;
case SimpleTypes::textshapetypeTextFadeDown : break;
case SimpleTypes::textshapetypeTextFadeLeft : break;
case SimpleTypes::textshapetypeTextFadeRight : break;
case SimpleTypes::textshapetypeTextFadeUp : break;
case SimpleTypes::textshapetypeTextInflate : break;
case SimpleTypes::textshapetypeTextInflateBottom: break;
case SimpleTypes::textshapetypeTextInflateTop : break;
case SimpleTypes::textshapetypeTextNoShape : break;
case SimpleTypes::textshapetypeTextPlain : break;
case SimpleTypes::textshapetypeTextRingInside : break;
case SimpleTypes::textshapetypeTextRingOutside : break;
case SimpleTypes::textshapetypeTextSlantDown : break;
case SimpleTypes::textshapetypeTextSlantUp : break;
case SimpleTypes::textshapetypeTextStop : break;
case SimpleTypes::textshapetypeTextTriangle : break;
case SimpleTypes::textshapetypeTextTriangleInverted : break;
case SimpleTypes::textshapetypeTextWave1 : break;
case SimpleTypes::textshapetypeTextWave2 : break;
case SimpleTypes::textshapetypeTextWave4 : break;
}
return type;
} }
void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf::style_text_properties * text_properties) void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf::style_text_properties * text_properties)
{ {
......
...@@ -45,6 +45,7 @@ namespace OOX ...@@ -45,6 +45,7 @@ namespace OOX
namespace Drawing namespace Drawing
{ {
class CDiagrammParts;
class CPresetTextShape; class CPresetTextShape;
class CShape; class CShape;
class CLockedCanvas; class CLockedCanvas;
...@@ -88,6 +89,8 @@ namespace OOX ...@@ -88,6 +89,8 @@ namespace OOX
class CEffectList; class CEffectList;
class COuterShadowEffect; class COuterShadowEffect;
class CInnerShadowEffect; class CInnerShadowEffect;
class CFontReference;
class CFontCollection;
namespace Colors namespace Colors
{ {
...@@ -239,8 +242,11 @@ namespace OOX ...@@ -239,8 +242,11 @@ namespace OOX
class CRichText; class CRichText;
class CTextProperties; class CTextProperties;
} }
namespace Diagram
{
class CShape;
class CShapeTree;
}
namespace Vml namespace Vml
{ {
class CVmlShapeElements; class CVmlShapeElements;
...@@ -329,6 +335,8 @@ public: ...@@ -329,6 +335,8 @@ public:
void convert(OOX::Drawing::COuterShadowEffect *oox_shadow, CString *change_sheme_color = NULL); void convert(OOX::Drawing::COuterShadowEffect *oox_shadow, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CInnerShadowEffect *oox_shadow, CString *change_sheme_color = NULL); void convert(OOX::Drawing::CInnerShadowEffect *oox_shadow, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CFontCollection *style_font, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CFontReference *style_font_ref);
void convert(OOX::Drawing::CStyleMatrixReference *style_matrix_ref); void convert(OOX::Drawing::CStyleMatrixReference *style_matrix_ref);
void convert(OOX::Drawing::CPath2D *oox_geom_path); void convert(OOX::Drawing::CPath2D *oox_geom_path);
void convert(OOX::Drawing::CPath2DLineTo *oox_geom_path); void convert(OOX::Drawing::CPath2DLineTo *oox_geom_path);
...@@ -347,6 +355,9 @@ public: ...@@ -347,6 +355,9 @@ public:
void convert(OOX::Drawing::CRun *oox_run); void convert(OOX::Drawing::CRun *oox_run);
void convert(OOX::Drawing::CRunProperty *oox_run_pr, cpdoccore::odf::style_text_properties * text_properties); void convert(OOX::Drawing::CRunProperty *oox_run_pr, cpdoccore::odf::style_text_properties * text_properties);
void convert(OOX::Drawing::CLineSpacing *oox_spacing, cpdoccore::odf::length_or_percent & length_or_percent); void convert(OOX::Drawing::CLineSpacing *oox_spacing, cpdoccore::odf::length_or_percent & length_or_percent);
//.diagram................................................................................................................................
void convert(OOX::Diagram::CShapeTree *oox_shape_tree);
void convert(OOX::Diagram::CShape *oox_shape);
//.chart............................................................................................................................ //.chart............................................................................................................................
void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart); void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart);
void convert(OOX::Spreadsheet::CT_Title *ct_title); void convert(OOX::Spreadsheet::CT_Title *ct_title);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <DocxFormat\Docx.h> #include <DocxFormat\Docx.h>
#include <DocxFormat\External\Hyperlink.h> #include <DocxFormat\External\Hyperlink.h>
#include <XlsxFormat\Chart\Chart.h> #include <XlsxFormat\Chart\Chart.h>
#include <DocxFormat\Diagram\DiagramDrawing.h>
#include "VmlShapeTypes2Oox.h" #include "VmlShapeTypes2Oox.h"
...@@ -40,8 +41,6 @@ DocxConverter::DocxConverter(const std::wstring & path, const ProgressCallback* ...@@ -40,8 +41,6 @@ DocxConverter::DocxConverter(const std::wstring & path, const ProgressCallback*
docx_document = new OOX::CDocx(oox_path); docx_document = new OOX::CDocx(oox_path);
//set flags to default //set flags to default
m_bKeepNextParagraph = false;
last_setion_properties = NULL; last_setion_properties = NULL;
if (UpdateProgress(290000))return; if (UpdateProgress(290000))return;
...@@ -164,7 +163,7 @@ void DocxConverter::convert_document() ...@@ -164,7 +163,7 @@ void DocxConverter::convert_document()
const OOX::CDocument* document = docx_document->GetDocument(); const OOX::CDocument* document = docx_document->GetDocument();
if (!document)return; if (!document)return;
m_bKeepNextParagraph = false; // odt_context->text_context()->clear_params();
for ( int nIndex = 0; nIndex < document->m_arrItems.GetSize(); nIndex++ ) for ( int nIndex = 0; nIndex < document->m_arrItems.GetSize(); nIndex++ )
{ {
...@@ -234,11 +233,26 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -234,11 +233,26 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Logic::CPicture* pPic = static_cast<OOX::Logic::CPicture*>(oox_unknown); OOX::Logic::CPicture* pPic = static_cast<OOX::Logic::CPicture*>(oox_unknown);
convert(pPic); convert(pPic);
}break; }break;
case OOX::et_pic_pic:
{
OOX::Drawing::CPicture* pPic = static_cast<OOX::Drawing::CPicture*>(oox_unknown);
convert(pPic);
}break;
case OOX::et_w_GroupShape: case OOX::et_w_GroupShape:
{ {
OOX::Logic::CGroupShape* pGroupShape= static_cast<OOX::Logic::CGroupShape*>(oox_unknown); OOX::Logic::CGroupShape* pGroupShape= static_cast<OOX::Logic::CGroupShape*>(oox_unknown);
convert(pGroupShape); convert(pGroupShape);
}break; }break;
case OOX::et_w_LockedCanvas:
{
OOX::Logic::CLockedCanvas* pLockedCanvas= static_cast<OOX::Logic::CLockedCanvas*>(oox_unknown);
convert(pLockedCanvas);
}break;
case OOX::et_dgm_DiagrammParts:
{
OOX::Drawing::CDiagrammParts* pDiagrammParts = static_cast<OOX::Drawing::CDiagrammParts*>(oox_unknown);
convert(pDiagrammParts);
}break;
case OOX::et_w_commentRangeEnd: case OOX::et_w_commentRangeEnd:
{ {
OOX::Logic::CCommentRangeEnd* pCommEnd = static_cast<OOX::Logic::CCommentRangeEnd*>(oox_unknown); OOX::Logic::CCommentRangeEnd* pCommEnd = static_cast<OOX::Logic::CCommentRangeEnd*>(oox_unknown);
...@@ -294,22 +308,23 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -294,22 +308,23 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
if (oox_paragraph == NULL) return; if (oox_paragraph == NULL) return;
bool bStyled = false; bool bStyled = false;
bool bList = false; bool bListItemNeed = false;
bool bStartNewParagraph = !m_bKeepNextParagraph; bool bStartNewParagraph = !odt_context->text_context()->get_KeepNextParagraph();
std::wstring list_style_name; std::wstring list_style_name;
if(oox_paragraph->m_oParagraphProperty && oox_paragraph->m_oParagraphProperty->m_oNumPr.IsInit()) if(oox_paragraph->m_oParagraphProperty && oox_paragraph->m_oParagraphProperty->m_oNumPr.IsInit()
&& odt_context->text_context()->get_list_item_state() == false)
{ {
bList = true; bListItemNeed = true;
} }
if (oox_paragraph->m_oParagraphProperty || odt_context->is_empty_section()) if (oox_paragraph->m_oParagraphProperty || odt_context->is_empty_section())
{ {
bStyled = true; bStyled = true;
odf::style_paragraph_properties *paragraph_properties = NULL; odf::style_paragraph_properties *paragraph_properties = NULL;
if (m_bKeepNextParagraph) if (odt_context->text_context()->get_KeepNextParagraph())
{ {
odf::odf_style_state_ptr state = odt_context->styles_context()->last_state(odf::style_family::Paragraph); odf::odf_style_state_ptr state = odt_context->styles_context()->last_state(odf::style_family::Paragraph);
if (state) if (state)
...@@ -320,7 +335,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -320,7 +335,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
odt_context->styles_context()->create_style(L"",odf::style_family::Paragraph, true, false, -1); odt_context->styles_context()->create_style(L"",odf::style_family::Paragraph, true, false, -1);
paragraph_properties = odt_context->styles_context()->last_state()->get_paragraph_properties(); paragraph_properties = odt_context->styles_context()->last_state()->get_paragraph_properties();
if(bList) if(bListItemNeed)
{ {
if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal.IsInit()) if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal.IsInit())
{ {
...@@ -331,18 +346,23 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -331,18 +346,23 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
} }
convert(oox_paragraph->m_oParagraphProperty, paragraph_properties); convert(oox_paragraph->m_oParagraphProperty, paragraph_properties);
}else m_bKeepNextParagraph = false; // m_bKeepNextParagraph !!! todooo }
else
{
odt_context->text_context()->set_KeepNextParagraph(false); // m_bKeepNextParagraph !!! todooo
// - - !!! // - - !!!
}
if(bList) if(bListItemNeed)
{ {
int level = 0; int level = 0;
if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal.IsInit()) if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal.IsInit())
level = oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal->GetValue(); level = oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal->GetValue();
odt_context->start_list_item(level, list_style_name); odt_context->start_list_item(level, list_style_name);
}else }
odt_context->set_no_list();
if ((bListItemNeed = odt_context->text_context()->get_list_item_state()) == false) odt_context->set_no_list();
if (bStartNewParagraph) odt_context->start_paragraph(bStyled); if (bStartNewParagraph) odt_context->start_paragraph(bStyled);
...@@ -360,11 +380,14 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -360,11 +380,14 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
break; break;
} }
} }
if (m_bKeepNextParagraph) odt_context->end_drop_cap(); if (odt_context->text_context()->get_KeepNextParagraph()) odt_context->end_drop_cap();
if (!m_bKeepNextParagraph) odt_context->end_paragraph(); if (!odt_context->text_context()->get_KeepNextParagraph()) odt_context->end_paragraph();
if(bList)odt_context->end_list_item(); if(bListItemNeed && !odt_context->text_context()->get_KeepNextParagraph())
odt_context->end_list_item();
else
bListItemNeed = bListItemNeed;
} }
void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 math 17.3.2.25 void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 math 17.3.2.25
{ {
...@@ -417,7 +440,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 ...@@ -417,7 +440,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
case OOX::et_w_br: case OOX::et_w_br:
{ {
OOX::Logic::CBr* pBr= static_cast<OOX::Logic::CBr*>(oox_run->m_arrItems[i]); OOX::Logic::CBr* pBr= static_cast<OOX::Logic::CBr*>(oox_run->m_arrItems[i]);
if (pBr)odt_context->text_context()->add_break(pBr->m_oType.GetValue(), pBr->m_oClear.GetValue()); if (pBr)odt_context->text_context()->set_type_break(pBr->m_oType.GetValue(), pBr->m_oClear.GetValue());
}break; }break;
case OOX::et_w_t: case OOX::et_w_t:
{ {
...@@ -516,11 +539,13 @@ void DocxConverter::convert(OOX::Logic::CInstrText *oox_instr) ...@@ -516,11 +539,13 @@ void DocxConverter::convert(OOX::Logic::CInstrText *oox_instr)
} }
void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf::style_paragraph_properties * paragraph_properties) void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf::style_paragraph_properties * paragraph_properties)
{ {
m_bKeepNextParagraph = false; odt_context->text_context()->set_KeepNextParagraph(false);
if (!oox_paragraph_pr) return; if (!oox_paragraph_pr) return;
if (!paragraph_properties) return; if (!paragraph_properties) return;
int outline_level = 0;
if (oox_paragraph_pr->m_oPStyle.IsInit() && oox_paragraph_pr->m_oPStyle->m_sVal.IsInit()) if (oox_paragraph_pr->m_oPStyle.IsInit() && oox_paragraph_pr->m_oPStyle->m_sVal.IsInit())
{ {
std::wstring style_name = string2std_string(*oox_paragraph_pr->m_oPStyle->m_sVal); std::wstring style_name = string2std_string(*oox_paragraph_pr->m_oPStyle->m_sVal);
...@@ -532,7 +557,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp ...@@ -532,7 +557,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
if (parent_paragraph_properties.content().outline_level_) if (parent_paragraph_properties.content().outline_level_)
{ {
odt_context->text_context()->set_outline_level(*parent_paragraph_properties.content().outline_level_); outline_level = *parent_paragraph_properties.content().outline_level_;
} }
// ??? // ???
} }
...@@ -653,21 +678,23 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp ...@@ -653,21 +678,23 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
paragraph_properties->content().style_writing_mode_= odf::writing_mode(odf::writing_mode::TbLr); break; paragraph_properties->content().style_writing_mode_= odf::writing_mode(odf::writing_mode::TbLr); break;
} }
} }
if (oox_paragraph_pr->m_oOutlineLvl.IsInit() && oox_paragraph_pr->m_oOutlineLvl->m_oVal.IsInit()) if (oox_paragraph_pr->m_oOutlineLvl.IsInit())
{ {
int level = oox_paragraph_pr->m_oOutlineLvl->m_oVal->GetValue(); outline_level = 0;
paragraph_properties->content().outline_level_ = level; if (oox_paragraph_pr->m_oOutlineLvl->m_oVal.IsInit())
odt_context->text_context()->set_outline_level ( level); outline_level = oox_paragraph_pr->m_oOutlineLvl->m_oVal->GetValue();
if (outline_level > 0) paragraph_properties->content().outline_level_ = outline_level /*+1*/;
odt_context->text_context()->set_outline_level (outline_level);
} }
if (oox_paragraph_pr->m_oPageBreakBefore.IsInit()) if (oox_paragraph_pr->m_oPageBreakBefore.IsInit())
{ {
paragraph_properties->content().fo_break_before_ = odf::fo_break(odf::fo_break::Page); paragraph_properties->content().fo_break_before_ = odf::fo_break(odf::fo_break::Page);
odt_context->text_context()->add_break(1, 0); //page, clear_all odt_context->text_context()->set_type_break(1, 0); //page, clear_all
} }
if (oox_paragraph_pr->m_oKeepNext.IsInit()& odt_context->table_context()->empty()) if (oox_paragraph_pr->m_oKeepNext.IsInit()& odt_context->table_context()->empty())
{ {
m_bKeepNextParagraph = true; odt_context->text_context()->set_KeepNextParagraph(true);
} }
convert(oox_paragraph_pr->m_oFramePr.GetPointer(), paragraph_properties); // convert(oox_paragraph_pr->m_oFramePr.GetPointer(), paragraph_properties); //
...@@ -794,6 +821,21 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -794,6 +821,21 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
odt_context->page_layout_context()->set_page_border(top,left,bottom, right); odt_context->page_layout_context()->set_page_border(top,left,bottom, right);
int border_offset = 1;
if (oox_section_pr->m_oPgBorders->m_oOffsetFrom.IsInit() &&
(oox_section_pr->m_oPgBorders->m_oOffsetFrom->GetValue() == SimpleTypes::pageborderoffsetPage))border_offset = 2;
if (oox_section_pr->m_oPgBorders->m_oBottom.IsInit() && oox_section_pr->m_oPgBorders->m_oBottom->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_bottom(border_offset,oox_section_pr->m_oPgBorders->m_oBottom->m_oSpace->ToPoints());
if (oox_section_pr->m_oPgBorders->m_oTop.IsInit() && oox_section_pr->m_oPgBorders->m_oTop->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_top(border_offset,oox_section_pr->m_oPgBorders->m_oTop->m_oSpace->ToPoints());
if (oox_section_pr->m_oPgBorders->m_oLeft.IsInit() && oox_section_pr->m_oPgBorders->m_oLeft->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_left(border_offset,oox_section_pr->m_oPgBorders->m_oLeft->m_oSpace->ToPoints());
if (oox_section_pr->m_oPgBorders->m_oRight.IsInit() && oox_section_pr->m_oPgBorders->m_oRight->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_right(border_offset,oox_section_pr->m_oPgBorders->m_oRight->m_oSpace->ToPoints());
bool shadow = false; bool shadow = false;
if (oox_section_pr->m_oPgBorders->m_oBottom.IsInit() && oox_section_pr->m_oPgBorders->m_oBottom->m_oShadow.IsInit() && oox_section_pr->m_oPgBorders->m_oBottom->m_oShadow->ToBool()) shadow = true; if (oox_section_pr->m_oPgBorders->m_oBottom.IsInit() && oox_section_pr->m_oPgBorders->m_oBottom->m_oShadow.IsInit() && oox_section_pr->m_oPgBorders->m_oBottom->m_oShadow->ToBool()) shadow = true;
if (oox_section_pr->m_oPgBorders->m_oTop.IsInit() && oox_section_pr->m_oPgBorders->m_oTop->m_oShadow.IsInit() && oox_section_pr->m_oPgBorders->m_oTop->m_oShadow->ToBool()) shadow = true; if (oox_section_pr->m_oPgBorders->m_oTop.IsInit() && oox_section_pr->m_oPgBorders->m_oTop->m_oShadow.IsInit() && oox_section_pr->m_oPgBorders->m_oTop->m_oShadow->ToBool()) shadow = true;
...@@ -1015,6 +1057,11 @@ void DocxConverter::convert(OOX::Logic::CTblBorders *oox_border, odf::style_tabl ...@@ -1015,6 +1057,11 @@ void DocxConverter::convert(OOX::Logic::CTblBorders *oox_border, odf::style_tabl
} }
else else
{ {
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ =
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ =
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ =
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_;
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_ = boost::none; table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_ = boost::none;
if (bottom.length() >0 )table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = bottom; if (bottom.length() >0 )table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = bottom;
...@@ -1043,6 +1090,11 @@ void DocxConverter::convert(OOX::Logic::CTcBorders *oox_border, odf::style_tabl ...@@ -1043,6 +1090,11 @@ void DocxConverter::convert(OOX::Logic::CTcBorders *oox_border, odf::style_tabl
} }
else else
{ {
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ =
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ =
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ =
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_;
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_ = boost::none; table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_ = boost::none;
if (bottom.length() >0 )table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = bottom; if (bottom.length() >0 )table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = bottom;
...@@ -1081,6 +1133,11 @@ void DocxConverter::convert(OOX::Logic::CPBdr *oox_border, odf::style_paragraph_ ...@@ -1081,6 +1133,11 @@ void DocxConverter::convert(OOX::Logic::CPBdr *oox_border, odf::style_paragraph_
} }
else else
{ {
paragraph_properties->content().common_border_attlist_.fo_border_bottom_ =
paragraph_properties->content().common_border_attlist_.fo_border_top_ =
paragraph_properties->content().common_border_attlist_.fo_border_left_ =
paragraph_properties->content().common_border_attlist_.fo_border_right_ = paragraph_properties->content().common_border_attlist_.fo_border_;
paragraph_properties->content().common_border_attlist_.fo_border_ = boost::none; paragraph_properties->content().common_border_attlist_.fo_border_ = boost::none;
if (bottom.length() >0 )paragraph_properties->content().common_border_attlist_.fo_border_bottom_ = bottom; if (bottom.length() >0 )paragraph_properties->content().common_border_attlist_.fo_border_bottom_ = bottom;
...@@ -1142,7 +1199,7 @@ void DocxConverter::convert(ComplexTypes::Word::CPageBorder *borderProp, std::ws ...@@ -1142,7 +1199,7 @@ void DocxConverter::convert(ComplexTypes::Word::CPageBorder *borderProp, std::ws
break; break;
case SimpleTypes::bordervalueNone: case SimpleTypes::bordervalueNone:
case SimpleTypes::bordervalueNil: case SimpleTypes::bordervalueNil:
odf_border_prop == L"none"; odf_border_prop = L"none";
return; return;
break; break;
default: default:
...@@ -1200,7 +1257,7 @@ void DocxConverter::convert(ComplexTypes::Word::CBorder *borderProp, std::wstrin ...@@ -1200,7 +1257,7 @@ void DocxConverter::convert(ComplexTypes::Word::CBorder *borderProp, std::wstrin
break; break;
case SimpleTypes::bordervalueNone: case SimpleTypes::bordervalueNone:
case SimpleTypes::bordervalueNil: case SimpleTypes::bordervalueNil:
odf_border_prop == L"none"; odf_border_prop = L"none";
return; return;
break; break;
default: default:
...@@ -1414,6 +1471,8 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf::style_tex ...@@ -1414,6 +1471,8 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf::style_tex
if (odf_color) if (odf_color)
text_properties->content().fo_background_color_ = *odf_color; text_properties->content().fo_background_color_ = *odf_color;
} }
if (oox_run_pr->m_oOutline.IsInit())
text_properties->content().style_text_outline_ = true; //
} }
void DocxConverter::convert(SimpleTypes::CTheme<>* oox_font_theme, _CP_OPT(std::wstring) & odf_font_name) void DocxConverter::convert(SimpleTypes::CTheme<>* oox_font_theme, _CP_OPT(std::wstring) & odf_font_name)
...@@ -1753,11 +1812,11 @@ void DocxConverter::convert(OOX::Drawing::CGraphic *oox_graphic) ...@@ -1753,11 +1812,11 @@ void DocxConverter::convert(OOX::Drawing::CGraphic *oox_graphic)
{ {
if (oox_graphic == NULL)return; if (oox_graphic == NULL)return;
convert(oox_graphic->m_oPicture.GetPointer()); for (long i = 0 ; i < oox_graphic->m_arrItems.GetSize(); i++)
convert(oox_graphic->m_oChart.GetPointer()); {
convert(oox_graphic->m_oShape.GetPointer()); convert(oox_graphic->m_arrItems[i]);
convert(oox_graphic->m_oGroupShape.GetPointer()); }
OoxConverter::convert(oox_graphic->m_oLockedCanvas.GetPointer());
} }
void DocxConverter::convert(OOX::Drawing::CPicture * oox_picture) void DocxConverter::convert(OOX::Drawing::CPicture * oox_picture)
{ {
...@@ -1822,6 +1881,56 @@ void DocxConverter::convert(OOX::Drawing::CPicture * oox_picture) ...@@ -1822,6 +1881,56 @@ void DocxConverter::convert(OOX::Drawing::CPicture * oox_picture)
odt_context->drawing_context()->end_image(); odt_context->drawing_context()->end_image();
odt_context->drawing_context()->end_drawing(); odt_context->drawing_context()->end_drawing();
} }
void DocxConverter::convert(OOX::Drawing::CDiagrammParts *oox_diagramm)
{
if (oox_diagramm == NULL)return;
if (oox_diagramm->m_oRId_Data.IsInit() == false) return;
smart_ptr<OOX::Image> pDiagData;
if (oox_current_child_document)
pDiagData = docx_document->GetDocument()->GetImage(oox_diagramm->m_oRId_Data->GetValue());
else
pDiagData = docx_document->GetDocument()->GetImage(oox_diagramm->m_oRId_Data->GetValue());
NSCommon::nullable<OOX::RId> id_drawing;
if (pDiagData.IsInit())
{
CString strDiagDataPath = pDiagData->filename().m_strFilename;
XmlUtils::CXmlNode oNodeDiagData;
if (oNodeDiagData.FromXmlFile2(strDiagDataPath))
{
XmlUtils::CXmlNode oNode2 = oNodeDiagData.ReadNode(_T("dgm:extLst"));
if (oNode2.IsValid())
{
XmlUtils::CXmlNode oNode3 = oNode2.ReadNode(_T("a:ext"));
if (oNode3.IsValid())
{
XmlUtils::CXmlNode oNode4 = oNode3.ReadNode(_T("dsp:dataModelExt"));
if (oNode4.IsValid())
{
oNode4.ReadAttributeBase(L"relId", id_drawing);
}
}
}
}
}
if (id_drawing.is_init() == false) return;
smart_ptr<OOX::File> oFile = docx_document->GetDocument()->Find( *id_drawing );
if (oFile.is_init() && OOX::FileTypes::DiagDrawing == oFile->type())
{
OOX::CDiagramDrawing * diag_drawing = (OOX::CDiagramDrawing*)oFile.operator->();
for (long i=0; i < diag_drawing->m_arrShapeTree.GetSize(); i++)
{
OoxConverter::convert(diag_drawing->m_arrShapeTree[i]);
}
}
}
void DocxConverter::convert(OOX::Drawing::CChart * oox_chart) void DocxConverter::convert(OOX::Drawing::CChart * oox_chart)
{ {
...@@ -1888,6 +1997,23 @@ void DocxConverter::convert(OOX::Logic::CGroupShape *oox_group_shape) ...@@ -1888,6 +1997,23 @@ void DocxConverter::convert(OOX::Logic::CGroupShape *oox_group_shape)
} }
odt_context->drawing_context()->end_group(); odt_context->drawing_context()->end_group();
} }
void DocxConverter::convert(OOX::Logic::CLockedCanvas *oox_canvas)
{
if (oox_canvas== NULL)return;
odf_context()->drawing_context()->start_group();
odf_context()->drawing_context()->set_group_position(0,0, 0, 0);
for (long i=0; i < oox_canvas->m_arrItems.GetSize(); i++)
{
convert(oox_canvas->m_arrItems[i]);
}
odf_context()->drawing_context()->end_group();
}
void DocxConverter::convert(OOX::Logic::CShape *oox_shape) void DocxConverter::convert(OOX::Logic::CShape *oox_shape)
{ {
if (oox_shape == NULL)return; if (oox_shape == NULL)return;
...@@ -1905,19 +2031,23 @@ void DocxConverter::convert(OOX::Logic::CShape *oox_shape) ...@@ -1905,19 +2031,23 @@ void DocxConverter::convert(OOX::Logic::CShape *oox_shape)
OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer(); OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
type =(geometry->m_oPrst.GetValue()); type =(geometry->m_oPrst.GetValue());
} }
if (oox_shape->m_oCNvSpPr.IsInit())
{ if (oox_shape->m_oCNvSpPr.IsInit() && oox_shape->m_oCNvSpPr->m_otxBox.GetValue() == 1) type = 2000; //textBox
if (oox_shape->m_oCNvSpPr->m_otxBox.GetValue() == 1)
type = 2000; //textBox
}
if (type == SimpleTypes::shapetypeRect && oox_shape->m_oTxBody.IsInit() && oox_shape->m_oTxBodyProperties.IsInit() /*&& if (type == SimpleTypes::shapetypeRect && oox_shape->m_oTxBody.IsInit() && oox_shape->m_oTxBodyProperties.IsInit() /*&&
oox_shape->m_oTxBodyProperties->m_eAutoFitType == OOX::Drawing::textautofitShape*/) oox_shape->m_oTxBodyProperties->m_eAutoFitType == OOX::Drawing::textautofitShape*/)
{ { // , , ...
type = 2000;// , , ...
// . // .
// - drawing_context - // - drawing_context -
//todooo //todoo
type = 2000;
}
if (type == 2000)
{
int wordart_type = OoxConverter::convert(oox_shape->m_oTxBodyProperties->m_oPrstTxWrap.GetPointer());
if (wordart_type >0)type = wordart_type;
} }
if (type < 0)return; if (type < 0)return;
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
...@@ -1946,9 +2076,16 @@ void DocxConverter::convert(OOX::Logic::CShape *oox_shape) ...@@ -1946,9 +2076,16 @@ void DocxConverter::convert(OOX::Logic::CShape *oox_shape)
convert(oox_shape->m_oTxBody->m_oTxtbxContent->m_arrItems[i]); convert(oox_shape->m_oTxBody->m_oTxtbxContent->m_arrItems[i]);
} }
odt_context->drawing_context()->set_text( odt_context->text_context()); odt_context->drawing_context()->set_text( odt_context->text_context());
//
OoxConverter::convert(oox_shape->m_oTxBodyProperties.GetPointer());
if (oox_shape->m_oShapeStyle.IsInit() && oox_shape->m_oShapeStyle->m_oFontRef.getType() == OOX::et_a_fontRef)
{
OoxConverter::convert(&oox_shape->m_oShapeStyle->m_oFontRef);
}
odt_context->end_text_context(); odt_context->end_text_context();
} }
OoxConverter::convert(oox_shape->m_oTxBodyProperties.GetPointer());
odt_context->drawing_context()->end_shape(); odt_context->drawing_context()->end_shape();
...@@ -2042,6 +2179,7 @@ void DocxConverter::convert_settings() ...@@ -2042,6 +2179,7 @@ void DocxConverter::convert_settings()
} }
if (docx_settings->m_oMirrorMargins.IsInit()) if (docx_settings->m_oMirrorMargins.IsInit())
{ {
odt_context->page_layout_context()->set_pages_mirrored(true);
} }
if (docx_settings->m_oPrintTwoOnOne.IsInit()) if (docx_settings->m_oPrintTwoOnOne.IsInit())
...@@ -2052,7 +2190,7 @@ void DocxConverter::convert_settings() ...@@ -2052,7 +2190,7 @@ void DocxConverter::convert_settings()
//nullable<ComplexTypes::Word::CLanguage> m_oThemeFontLang; //nullable<ComplexTypes::Word::CLanguage> m_oThemeFontLang;
//nullable<OOX::Settings::CEdnDocProps> m_oEndnotePr; //nullable<OOX::Settings::CEdnDocProps> m_oEndnotePr;
//nullable<OOX::Settings::CCaptions> m_oCaptions; //nullable<OOX::Settings::CCaptions> m_oCaptions;
//m_oFootnotePr; //m_oFootnotePr;
} }
void DocxConverter::convert_lists_styles() void DocxConverter::convert_lists_styles()
{ {
...@@ -2481,11 +2619,15 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table) ...@@ -2481,11 +2619,15 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
{ {
if (oox_table == NULL) return; if (oox_table == NULL) return;
if (m_bKeepNextParagraph) if (odt_context->text_context()->get_KeepNextParagraph())
{ {
odt_context->end_paragraph(); odt_context->end_paragraph();
m_bKeepNextParagraph = false; odt_context->text_context()->set_KeepNextParagraph(false);
} }
//if (in_list, but not in paragraph)
odt_context->set_no_list();
bool styled_table = false; bool styled_table = false;
bool in_frame = false; bool in_frame = false;
...@@ -2906,6 +3048,11 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, ...@@ -2906,6 +3048,11 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
oox_table_cell_pr->m_oShd->m_oThemeFillTint.GetPointer(), oox_table_cell_pr->m_oShd->m_oThemeShade.GetPointer(), odf_color); oox_table_cell_pr->m_oShd->m_oThemeFillTint.GetPointer(), oox_table_cell_pr->m_oShd->m_oThemeShade.GetPointer(), odf_color);
if (odf_color) if (odf_color)
table_cell_properties->style_table_cell_properties_attlist_.common_background_color_attlist_.fo_background_color_ = *odf_color; table_cell_properties->style_table_cell_properties_attlist_.common_background_color_attlist_.fo_background_color_ = *odf_color;
if (oox_table_cell_pr->m_oShd->m_oVal.IsInit())
{
// :(
}
} }
if (oox_table_cell_pr->m_oTextDirection.IsInit() && oox_table_cell_pr->m_oTextDirection->m_oVal.IsInit()) if (oox_table_cell_pr->m_oTextDirection.IsInit() && oox_table_cell_pr->m_oTextDirection->m_oVal.IsInit())
......
...@@ -49,14 +49,14 @@ namespace OOX ...@@ -49,14 +49,14 @@ namespace OOX
class CTblBorders; class CTblBorders;
class CSdt; class CSdt;
class CBackground; class CBackground;
class CLockedCanvas;
} }
namespace Numbering namespace Numbering
{ {
class CAbstractNum; class CAbstractNum;
class CLvl; class CLvl;
}; }
} }
namespace ComplexTypes namespace ComplexTypes
{ {
...@@ -140,12 +140,14 @@ namespace Oox2Odf ...@@ -140,12 +140,14 @@ namespace Oox2Odf
void convert(OOX::Logic::CGroupShape *oox_group_shape); void convert(OOX::Logic::CGroupShape *oox_group_shape);
void convert(OOX::Logic::CShape *oox_shape); void convert(OOX::Logic::CShape *oox_shape);
void convert(OOX::Logic::CPicture *oox_picture); void convert(OOX::Logic::CPicture *oox_picture);
void convert(OOX::Logic::CLockedCanvas *oox_canvas);
void convert(OOX::Drawing::CAnchor *oox_anchor); void convert(OOX::Drawing::CAnchor *oox_anchor);
void convert(OOX::Drawing::CInline *oox_inline); void convert(OOX::Drawing::CInline *oox_inline);
void convert(OOX::Drawing::CGraphic *oox_graphic); void convert(OOX::Drawing::CGraphic *oox_graphic);
void convert(OOX::Drawing::CChart *oox_chart); void convert(OOX::Drawing::CChart *oox_chart);
void convert(OOX::Drawing::CPicture *oox_picture); void convert(OOX::Drawing::CPicture *oox_picture);
void convert(OOX::Drawing::CDiagrammParts *oox_diagramm);
void convert(SimpleTypes::CTheme<> *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name); void convert(SimpleTypes::CTheme<> *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name);
void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf::color) & odf_color); void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf::color) & odf_color);
...@@ -187,6 +189,5 @@ namespace Oox2Odf ...@@ -187,6 +189,5 @@ namespace Oox2Odf
void convert(OOX::Logic::CTableRowProperties *oox_table_row_pr); void convert(OOX::Logic::CTableRowProperties *oox_table_row_pr);
void convert(OOX::Logic::CTableRowProperties *oox_table_row_pr, odf::style_table_row_properties *table_row_properties); void convert(OOX::Logic::CTableRowProperties *oox_table_row_pr, odf::style_table_row_properties *table_row_properties);
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
bool m_bKeepNextParagraph;
}; };
} }
\ No newline at end of file
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//2 //2
//0 //0
//127 //128
#define INTVER 1,2,0,127 #define INTVER 1,2,0,128
#define STRVER "1,2,0,127\0" #define STRVER "1,2,0,128\0"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment