Commit 202b58fb authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - fix after testing

parent b2211507
...@@ -174,7 +174,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy ...@@ -174,7 +174,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"octagon" , 7}, // shapetypeOctagon, { L"octagon" , 7}, // shapetypeOctagon,
{ L"parallelogram" , 7}, // shapetypeParallelogram, { L"parallelogram" , 7}, // shapetypeParallelogram,
{ L"pentagon" , 7}, // shapetypePentagon, { L"pentagon" , 7}, // shapetypePentagon,
{ L"mso-spt100" , 7}, // shapetypePie, { L"" , 7}, // shapetypePie,
{ L"" , 7}, // shapetypePieWedge, { L"" , 7}, // shapetypePieWedge,
{ L"" , 7}, // shapetypePlaque, { L"" , 7}, // shapetypePlaque,
{ L"" , 7}, // shapetypePlaqueTabs, { L"" , 7}, // shapetypePlaqueTabs,
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
// shapetypeHalfFrame, // shapetypeHalfFrame,
// shapetypeHeptagon, // shapetypeHeptagon,
// shapetypeNonIsoscelesTrapezoid, // shapetypeNonIsoscelesTrapezoid,
// shapetypePie, //+ shapetypePie,
//+ shapetypePieWedge, //+ shapetypePieWedge,
//+ shapetypePlaque, //+ shapetypePlaque,
// shapetypePlaqueTabs, // shapetypePlaqueTabs,
...@@ -785,4 +785,57 @@ public: ...@@ -785,4 +785,57 @@ public:
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
} }
}; };
class oox_shape_Pie : public oox_shape
{
public:
oox_shape_Pie()
{
odf_type_name =L"ooxml-pie";
enhanced_path = L"M ?f12 ?f14 G ?f5 ?f7 ?f29 ?f30 L ?f11 ?f13 Z N";
text_areas = L"?f23 ?f24 ?f25 ?f26";
view_box = L"0 0 0 0";
modifiers = L"9000000 16200000";
add(L"f0", L"if(0-$0 ,0,if(21599999-$0 ,$0 ,21599999))");
add(L"f1", L"if(0-$1 ,0,if(21599999-$1 ,$1 ,21599999))");
add(L"f2", L"?f1 +0-?f0 ");
add(L"f3", L"?f2 +21600000-0");
add(L"f4", L"if(?f2 ,?f2 ,?f3 )");
add(L"f5", L"logwidth/2");
add(L"f6", L"?f5 *sin(pi*(?f0 )/10800000)");
add(L"f7", L"logheight/2");
add(L"f8", L"?f7 *cos(pi*(?f0 )/10800000)");
add(L"f9", L"?f5 *(cos(atan2(?f6 ,?f8 )))");
add(L"f10", L"?f7 *(sin(atan2(?f6 ,?f8 )))");
add(L"f11", L"logwidth/2");
add(L"f12", L"?f11 +?f9 -0");
add(L"f13", L"logheight/2");
add(L"f14", L"?f13 +?f10 -0");
add(L"f15", L"?f5 *sin(pi*(?f1 )/10800000)");
add(L"f16", L"?f7 *cos(pi*(?f1 )/10800000)");
add(L"f17", L"?f5 *(cos(atan2(?f15 ,?f16 )))");
add(L"f18", L"?f7 *(sin(atan2(?f15 ,?f16 )))");
add(L"f19", L"?f11 +?f17 -0");
add(L"f20", L"?f13 +?f18 -0");
add(L"f21", L"?f5 *cos(pi*(2700000)/10800000)");
add(L"f22", L"?f7 *sin(pi*(2700000)/10800000)");
add(L"f23", L"?f11 +0-?f21 ");
add(L"f24", L"?f11 +?f21 -0");
add(L"f25", L"?f13 +0-?f22 ");
add(L"f26", L"?f13 +?f22 -0");
add(L"f27", L"logwidth");
add(L"f28", L"logheight");
add(L"f29", L"(?f0 )/60000.0");
add(L"f30", L"(?f4 )/60000.0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f12 ?f14";
handles.push_back(h);
h.position = L"?f19 ?f20";
handles.push_back(h);
}
};
} }
...@@ -353,6 +353,10 @@ void odf_drawing_context::check_anchor() ...@@ -353,6 +353,10 @@ void odf_drawing_context::check_anchor()
set_vertical_pos(0); set_vertical_pos(0);
} }
} }
int odf_drawing_context::get_group_level()
{
return impl_->current_level_.size();
}
void odf_drawing_context::start_group() void odf_drawing_context::start_group()
{ {
office_element_ptr group_elm = impl_->create_draw_element(5000); office_element_ptr group_elm = impl_->create_draw_element(5000);
...@@ -849,7 +853,7 @@ void odf_drawing_context::end_shape() ...@@ -849,7 +853,7 @@ void odf_drawing_context::end_shape()
draw_path* path = dynamic_cast<draw_path*>(impl_->current_drawing_state_.elements_[0].elm.get()); draw_path* path = dynamic_cast<draw_path*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (path) if (path)
{ {
if (impl_->current_drawing_state_.view_box_.length() < 1 && impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_) if (impl_->current_drawing_state_.view_box_.empty() && impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_)
set_viewBox( impl_->current_drawing_state_.svg_width_->get_value_unit(length::cm) * 1000, set_viewBox( impl_->current_drawing_state_.svg_width_->get_value_unit(length::cm) * 1000,
impl_->current_drawing_state_.svg_height_->get_value_unit(length::cm) *1000); impl_->current_drawing_state_.svg_height_->get_value_unit(length::cm) *1000);
...@@ -958,7 +962,11 @@ void odf_drawing_context::end_shape() ...@@ -958,7 +962,11 @@ void odf_drawing_context::end_shape()
if (shape_define) if (shape_define)
{ {
enhanced->svg_viewbox_ = shape_define->view_box; if (impl_->current_drawing_state_.oox_shape_ && impl_->current_drawing_state_.oox_shape_->view_box)
enhanced->svg_viewbox_ = impl_->current_drawing_state_.oox_shape_->view_box;
else
enhanced->svg_viewbox_ = shape_define->view_box;
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name; enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name;
enhanced->draw_enhanced_geometry_attlist_.draw_text_areas_ = shape_define->text_areas; enhanced->draw_enhanced_geometry_attlist_.draw_text_areas_ = shape_define->text_areas;
...@@ -1004,6 +1012,9 @@ void odf_drawing_context::end_shape() ...@@ -1004,6 +1012,9 @@ void odf_drawing_context::end_shape()
if (shape_define->handles[i].y_maximum) h->draw_handle_attlist_.draw_handle_range_y_maximum_ = *shape_define->handles[i].y_maximum; if (shape_define->handles[i].y_maximum) h->draw_handle_attlist_.draw_handle_range_y_maximum_ = *shape_define->handles[i].y_maximum;
if (shape_define->handles[i].x_minimum) h->draw_handle_attlist_.draw_handle_range_x_minimum_ = *shape_define->handles[i].x_minimum; if (shape_define->handles[i].x_minimum) h->draw_handle_attlist_.draw_handle_range_x_minimum_ = *shape_define->handles[i].x_minimum;
if (shape_define->handles[i].x_maximum) h->draw_handle_attlist_.draw_handle_range_x_maximum_ = *shape_define->handles[i].x_maximum; if (shape_define->handles[i].x_maximum) h->draw_handle_attlist_.draw_handle_range_x_maximum_ = *shape_define->handles[i].x_maximum;
if (shape_define->handles[i].r_maximum) h->draw_handle_attlist_.draw_handle_radius_range_maximum_ = *shape_define->handles[i].r_maximum;
if (shape_define->handles[i].r_minimum) h->draw_handle_attlist_.draw_handle_radius_range_minimum_ = *shape_define->handles[i].r_minimum;
} }
end_element(); end_element();
} }
...@@ -1509,6 +1520,8 @@ void odf_drawing_context::set_viewBox (double W, double H) ...@@ -1509,6 +1520,8 @@ void odf_drawing_context::set_viewBox (double W, double H)
if (impl_->current_drawing_state_.oox_shape_) if (impl_->current_drawing_state_.oox_shape_)
{ {
impl_->current_drawing_state_.oox_shape_->view_box = impl_->current_drawing_state_.view_box_;
if (impl_->current_drawing_state_.oox_shape_->sub_view_size) if (impl_->current_drawing_state_.oox_shape_->sub_view_size)
impl_->current_drawing_state_.oox_shape_->sub_view_size = *impl_->current_drawing_state_.oox_shape_->sub_view_size + L" " + std::to_wstring((int)W) + L" " + std::to_wstring((int)H); impl_->current_drawing_state_.oox_shape_->sub_view_size = *impl_->current_drawing_state_.oox_shape_->sub_view_size + L" " + std::to_wstring((int)W) + L" " + std::to_wstring((int)H);
else else
...@@ -2102,17 +2115,15 @@ void odf_drawing_context::set_textarea_wrap(bool Val) ...@@ -2102,17 +2115,15 @@ void odf_drawing_context::set_textarea_wrap(bool Val)
impl_->current_graphic_properties->fo_wrap_option_ = wrap_option(wrap_option::NoWrap); impl_->current_graphic_properties->fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
} }
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea) void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
{ {
if (impl_->current_drawing_state_.elements_.empty())return; if (impl_->current_drawing_state_.elements_.empty())return;
if (!impl_->current_text_properties) odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{ {
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph); impl_->current_text_properties = style_state->get_text_properties();
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
} }
if (!impl_->current_text_properties) return; if (!impl_->current_text_properties) return;
...@@ -2126,13 +2137,10 @@ void odf_drawing_context::set_textarea_fontcolor(std::wstring hexColor) ...@@ -2126,13 +2137,10 @@ void odf_drawing_context::set_textarea_fontcolor(std::wstring hexColor)
{ {
if (impl_->current_drawing_state_.elements_.empty())return; if (impl_->current_drawing_state_.elements_.empty())return;
if (!impl_->current_text_properties) odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{ {
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph); impl_->current_text_properties = style_state->get_text_properties();
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
} }
if (!impl_->current_text_properties) return; if (!impl_->current_text_properties) return;
......
...@@ -104,6 +104,7 @@ public: ...@@ -104,6 +104,7 @@ public:
void end_drawing(); void end_drawing();
void end_drawing_background(odf_types::common_draw_fill_attlist & common_draw_attlist); void end_drawing_background(odf_types::common_draw_fill_attlist & common_draw_attlist);
int get_group_level();
void start_group(); void start_group();
void set_group_flip_H (bool bVal); void set_group_flip_H (bool bVal);
void set_group_flip_V (bool bVal); void set_group_flip_V (bool bVal);
...@@ -166,8 +167,6 @@ public: ...@@ -166,8 +167,6 @@ public:
void finalize(office_element_ptr & root_elm); void finalize(office_element_ptr & root_elm);
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
void get_position (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt); void get_position (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt);
void set_position (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt); void set_position (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt);
void set_position_line (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt, _CP_OPT(double) & x1_pt, _CP_OPT(double) & y1_pt); void set_position_line (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt, _CP_OPT(double) & x1_pt, _CP_OPT(double) & y1_pt);
......
...@@ -53,7 +53,6 @@ namespace cpdoccore ...@@ -53,7 +53,6 @@ namespace cpdoccore
oox_shape::oox_shape() oox_shape::oox_shape()
{ {
odf_type_name = L"ooxml-non-primitive"; odf_type_name = L"ooxml-non-primitive";
view_box = L"0 0 0 0";
} }
oox_shape_ptr oox_shape::create(int ooxPrstGeomType) oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
...@@ -86,6 +85,7 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType) ...@@ -86,6 +85,7 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
case SimpleTypes::shapetypePlaque: return boost::make_shared<oox_shape_Plaque>(); case SimpleTypes::shapetypePlaque: return boost::make_shared<oox_shape_Plaque>();
case SimpleTypes::shapetypeDoubleWave: return boost::make_shared<oox_shape_DoubleWave>(); case SimpleTypes::shapetypeDoubleWave: return boost::make_shared<oox_shape_DoubleWave>();
case SimpleTypes::shapetypePieWedge: return boost::make_shared<oox_shape_PieWedge>(); case SimpleTypes::shapetypePieWedge: return boost::make_shared<oox_shape_PieWedge>();
case SimpleTypes::shapetypePie: return boost::make_shared<oox_shape_Pie>();
......
...@@ -64,6 +64,8 @@ namespace cpdoccore ...@@ -64,6 +64,8 @@ namespace cpdoccore
_CP_OPT(std::wstring) y_maximum; _CP_OPT(std::wstring) y_maximum;
_CP_OPT(std::wstring) x_minimum; _CP_OPT(std::wstring) x_minimum;
_CP_OPT(std::wstring) x_maximum; _CP_OPT(std::wstring) x_maximum;
_CP_OPT(std::wstring) r_minimum;
_CP_OPT(std::wstring) r_maximum;
}; };
void add(std::wstring name,std::wstring frmla) void add(std::wstring name,std::wstring frmla)
...@@ -78,7 +80,8 @@ namespace cpdoccore ...@@ -78,7 +80,8 @@ namespace cpdoccore
std::wstring enhanced_path; std::wstring enhanced_path;
std::wstring modifiers; std::wstring modifiers;
std::wstring text_areas; std::wstring text_areas;
std::wstring view_box;
_CP_OPT(std::wstring) view_box;
_CP_OPT(std::wstring) sub_view_size; _CP_OPT(std::wstring) sub_view_size;
_CP_OPT(std::wstring) glue_points; _CP_OPT(std::wstring) glue_points;
......
...@@ -358,7 +358,7 @@ void OoxConverter::convert(PPTX::Logic::GrpSpPr *oox_grpSpPr) ...@@ -358,7 +358,7 @@ void OoxConverter::convert(PPTX::Logic::GrpSpPr *oox_grpSpPr)
odf_context()->drawing_context()->set_group_size( cx, cy, ch_cx, ch_cy ); odf_context()->drawing_context()->set_group_size( cx, cy, ch_cx, ch_cy );
_CP_OPT(double) x, y, ch_x, ch_y; _CP_OPT(double) x, y, ch_x, ch_y, ext_x, ext_y;
if (oox_grpSpPr->xfrm->offX.IsInit()) if (oox_grpSpPr->xfrm->offX.IsInit())
x = oox_grpSpPr->xfrm->offX.get() / 12700.; x = oox_grpSpPr->xfrm->offX.get() / 12700.;
...@@ -370,6 +370,16 @@ void OoxConverter::convert(PPTX::Logic::GrpSpPr *oox_grpSpPr) ...@@ -370,6 +370,16 @@ void OoxConverter::convert(PPTX::Logic::GrpSpPr *oox_grpSpPr)
if (oox_grpSpPr->xfrm->chOffY.IsInit()) if (oox_grpSpPr->xfrm->chOffY.IsInit())
ch_y = oox_grpSpPr->xfrm->chOffY.get() / 12700.; ch_y = oox_grpSpPr->xfrm->chOffY.get() / 12700.;
int group_level = odf_context()->drawing_context()->get_group_level();
odf_context()->drawing_context()->get_position(ext_x, ext_y);
if (ext_x && ext_y && group_level < 2)
{
x = ext_x;
y = ext_y;
}
odf_context()->drawing_context()->set_group_position( x, y, ch_x, ch_y ); odf_context()->drawing_context()->set_group_position( x, y, ch_x, ch_y );
if (oox_grpSpPr->xfrm->rot.IsInit()) if (oox_grpSpPr->xfrm->rot.IsInit())
...@@ -484,14 +494,21 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape) ...@@ -484,14 +494,21 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
DocxConverter *docx_converter = dynamic_cast<DocxConverter*>(this); DocxConverter *docx_converter = dynamic_cast<DocxConverter*>(this);
if (docx_converter) if (docx_converter)
{ {
odf_context()->start_text_context(); odf_context()->start_text_context();
docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
for (size_t i = 0; i < oox_shape->oTextBoxShape->m_arrItems.size(); i++)
{
docx_converter->convert(oox_shape->oTextBoxShape->m_arrItems[i]);
convert(oox_shape->oTextBoxBodyPr.GetPointer());
if (oox_shape->style.IsInit())
convert(&oox_shape->style->fontRef);
}
odf_context()->drawing_context()->set_text( odf_context()->text_context()); odf_context()->drawing_context()->set_text( odf_context()->text_context());
convert(oox_shape->oTextBoxBodyPr.GetPointer());
if (oox_shape->style.IsInit())
convert(&oox_shape->style->fontRef);
odf_context()->end_text_context(); odf_context()->end_text_context();
} }
} }
......
...@@ -1293,13 +1293,13 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp ...@@ -1293,13 +1293,13 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
} }
if (odt_context->notes_context()->is_started()) if (odt_context->notes_context()->is_started() && !paragraph_properties->content_.fo_margin_left_
&& !paragraph_properties->content_.fo_text_indent_)
{ {
paragraph_properties->content_.fo_margin_left_ = odf_types::length( 0.5, odf_types::length::cm); paragraph_properties->content_.fo_margin_left_ = odf_types::length( 0.2, odf_types::length::cm);
paragraph_properties->content_.fo_text_indent_ = odf_types::length(-0.5, odf_types::length::cm); paragraph_properties->content_.fo_text_indent_ = odf_types::length(-0.2, odf_types::length::cm);
paragraph_properties->content_.fo_line_height_ = odf_types::percent(100.); paragraph_properties->content_.fo_line_height_ = odf_types::percent(100.);
paragraph_properties->content_.style_auto_text_indent_ = false; paragraph_properties->content_.style_auto_text_indent_ = false;
//loext:contextual-spacing="false"
} }
if (oox_paragraph_pr->m_oTabs.IsInit()) if (oox_paragraph_pr->m_oTabs.IsInit())
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
QT -= core QT -= core
QT -= gui QT -= gui
VERSION = 2.4.453.0 VERSION = 2.4.454.0
DEFINES += INTVER=$$VERSION DEFINES += INTVER=$$VERSION
TARGET = x2t TARGET = x2t
......
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