Commit b93d4634 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormat - fix roundRect

parent 0aa59b0d
...@@ -95,13 +95,13 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context) ...@@ -95,13 +95,13 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
Context.set_paragraph_state (false); Context.set_paragraph_state (false);
Context.set_run_state (false); Context.set_run_state (false);
BOOST_FOREACH(const office_element_ptr & elm, content_) for (size_t i = 0; i < content_.size(); i++)
{ {
ElementType type = elm->get_type(); ElementType type = content_[i]->get_type();
if (type != typeDrawCustomShape) if (type != typeDrawCustomShape)
{ {
elm->docx_convert(Context); content_[i]->docx_convert(Context);
} }
} }
...@@ -120,9 +120,16 @@ void draw_rect::docx_convert(oox::docx_conversion_context & Context) ...@@ -120,9 +120,16 @@ void draw_rect::docx_convert(oox::docx_conversion_context & Context)
return; return;
} }
common_docx_convert(Context); common_docx_convert(Context);
//...
draw_shape::docx_convert(Context);
if (draw_rect_attlist_.draw_corner_radius_)
{
draw_shape * shape = Context.get_drawing_context().get_current_shape();//owner
double val = draw_rect_attlist_.draw_corner_radius_->get_value() * 6500;
shape->additional_.push_back(_property(L"oox-draw-modifiers", std::to_wstring((int)val)));
}
draw_shape::docx_convert(Context);
} }
void draw_ellipse::docx_convert(oox::docx_conversion_context & Context) void draw_ellipse::docx_convert(oox::docx_conversion_context & Context)
{ {
...@@ -157,6 +164,7 @@ void draw_line::docx_convert(oox::docx_conversion_context & Context) ...@@ -157,6 +164,7 @@ void draw_line::docx_convert(oox::docx_conversion_context & Context)
reset_svg_attributes(); reset_svg_attributes();
common_docx_convert(Context); common_docx_convert(Context);
//...
draw_shape::docx_convert(Context); draw_shape::docx_convert(Context);
} }
......
...@@ -283,6 +283,8 @@ void odt_conversion_context::end_drawings() ...@@ -283,6 +283,8 @@ void odt_conversion_context::end_drawings()
} }
void odt_conversion_context::start_paragraph(bool styled) void odt_conversion_context::start_paragraph(bool styled)
{ {
if (current_field_.enabled && !current_field_.result) return; //Стандартное_составное_письмо.docx
if (is_paragraph_in_current_section_ && !styled) if (is_paragraph_in_current_section_ && !styled)
{ {
styles_context()->create_style(L"", odf_types::style_family::Paragraph, true, false, -1); styles_context()->create_style(L"", odf_types::style_family::Paragraph, true, false, -1);
...@@ -374,8 +376,9 @@ void odt_conversion_context::set_field_instr(std::wstring instr) ...@@ -374,8 +376,9 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
{ {
if (current_field_.enabled == false) return; if (current_field_.enabled == false) return;
current_field_.type = 0; //users field
int res1 = instr.find(L"HYPERLINK"); int res1 = instr.find(L"HYPERLINK");
if (res1 >=0) //это не поле - это hyperlink if (res1 >= 0) //это не поле - это hyperlink
{ {
current_field_.type = 1; current_field_.type = 1;
...@@ -390,24 +393,24 @@ void odt_conversion_context::set_field_instr(std::wstring instr) ...@@ -390,24 +393,24 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
} }
} }
res1 = instr.find(L"NUMPAGES"); res1 = instr.find(L"NUMPAGES");
if (res1 >=0 && current_field_.type == 0) if (res1 >= 0 && current_field_.type == 0)
{ {
current_field_.type = 3; current_field_.type = 3;
} }
res1 = instr.find(L"PAGEREF"); res1 = instr.find(L"PAGEREF");
if (res1 >=0 && current_field_.type == 0 ) //это не поле - это bookmark if (res1 >= 0 && current_field_.type == 0 ) //это не поле - это bookmark
{ {
current_field_.type = 5; current_field_.type = 5;
if (instr.length() > 9) if (instr.length() > 9)
current_field_.value = instr.substr(9, instr.length()-5); current_field_.value = instr.substr(9, instr.length()-5);
} }
res1 = instr.find(L"PAGE"); res1 = instr.find(L"PAGE");
if (res1 >=0 && current_field_.type == 0) if (res1 >= 0 && current_field_.type == 0)
{ {
current_field_.type = 2; current_field_.type = 2;
} }
res1 = instr.find(L"TIME"); res1 = instr.find(L"TIME");
if (res1 >=0 && current_field_.type == 0) if (res1 >= 0 && current_field_.type == 0)
{ {
current_field_.type = 4; current_field_.type = 4;
} }
...@@ -418,20 +421,34 @@ void odt_conversion_context::set_field_instr(std::wstring instr) ...@@ -418,20 +421,34 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
} }
////////////////////////////////////////// //////////////////////////////////////////
res1 = instr.find(L"@"); res1 = instr.find(L"@");
if (res1 >=0) if (res1 >= 0)
{
current_field_.format = instr.substr(res1 + 1, instr.length());
}
if (current_field_.type == 0)
{ {
current_field_.format = instr.substr(res1+1, instr.length()); res1 = instr.find(L" ");
if (res1 >= 0)
{
current_field_.name = instr.substr(0, res1);
}
} }
} }
void odt_conversion_context::start_field(bool in_span) void odt_conversion_context::start_field(bool in_span)
{ {
current_field_.enabled = true; current_field_.enabled = true;
current_field_.result = false;
current_field_.in_span = in_span; current_field_.in_span = in_span;
current_field_.value = L""; current_field_.value.clear();
current_field_.type = 0; current_field_.name.clear();
current_field_.type = 0; // users field
}
void odt_conversion_context::separate_field()
{
current_field_.result = true;
} }
void odt_conversion_context::set_master_page_name(std::wstring master_name) void odt_conversion_context::set_master_page_name(std::wstring master_name)
{ {
if (current_root_elements_.size() < 1)// return; - эффект_штурмовика.docx - 1 страница !! (и ваще - if (current_root_elements_.size() < 1)// return; - эффект_штурмовика.docx - 1 страница !! (и ваще -
...@@ -566,13 +583,17 @@ void odt_conversion_context::end_field() ...@@ -566,13 +583,17 @@ void odt_conversion_context::end_field()
} }
current_field_.value = L""; current_field_.value = L"";
current_field_.format = L""; current_field_.format = L"";
current_field_.name = L"";
current_field_.enabled = false; current_field_.result = false;
current_field_.started = false; current_field_.enabled = false;
current_field_.in_span = false; current_field_.started = false;
current_field_.in_span = false;
} }
void odt_conversion_context::end_paragraph() void odt_conversion_context::end_paragraph()
{ {
if (current_field_.enabled && !current_field_.result) return; //Стандартное_составное_письмо.docx
text_context()->end_paragraph(); text_context()->end_paragraph();
flush_section(); flush_section();
......
...@@ -95,6 +95,7 @@ public: ...@@ -95,6 +95,7 @@ public:
void start_field (bool in_span); void start_field (bool in_span);
void end_field (); void end_field ();
void separate_field ();
void set_field_instr (std::wstring instr); void set_field_instr (std::wstring instr);
void start_run (bool styled = false); void start_run (bool styled = false);
...@@ -182,12 +183,14 @@ private: ...@@ -182,12 +183,14 @@ private:
struct _field_state struct _field_state
{ {
std::wstring name;
bool enabled; bool enabled;
int type; int type;
std::wstring value; std::wstring value;
std::wstring format; std::wstring format;
bool started; bool started;
bool in_span; bool in_span;
bool result;
}current_field_; }current_field_;
struct _text_changes_state struct _text_changes_state
......
...@@ -593,6 +593,14 @@ void OoxConverter::convert(OOX::Vml::CRoundRect *vml_roundrect) ...@@ -593,6 +593,14 @@ void OoxConverter::convert(OOX::Vml::CRoundRect *vml_roundrect)
OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_roundrect); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_roundrect);
convert(vml_common); convert(vml_common);
double arc_size = vml_roundrect->m_oArcSize.GetValue();
if (arc_size > 0)
{
odf_types::length corner = odf_types::length(arc_size * 20, odf_types::length::cm);
odf_context()->drawing_context()->set_corner_radius(corner);
}
} }
void OoxConverter::convert(OOX::Vml::CCurve *vml_curve) void OoxConverter::convert(OOX::Vml::CCurve *vml_curve)
......
...@@ -751,7 +751,7 @@ void DocxConverter::convert(OOX::Logic::CSym *oox_sym) ...@@ -751,7 +751,7 @@ void DocxConverter::convert(OOX::Logic::CSym *oox_sym)
odt_context->text_context()->set_symbol_text(oox_sym->m_oChar->GetValue()); odt_context->text_context()->set_symbol_text(oox_sym->m_oChar->GetValue());
//odt_context->text_context()->add_text_content(std::wstring(L"/") + oox_sym->m_oChar->ToString()); //odt_context->text_context()->add_text_content(std::wstring(L"/") + oox_sym->m_oChar->ToString());
} }
void DocxConverter::convert(OOX::Logic::CFldChar *oox_fld) void DocxConverter::convert(OOX::Logic::CFldChar *oox_fld)
{ {
if (oox_fld == NULL) return; if (oox_fld == NULL) return;
...@@ -762,7 +762,7 @@ void DocxConverter::convert(OOX::Logic::CFldChar *oox_fld) ...@@ -762,7 +762,7 @@ void DocxConverter::convert(OOX::Logic::CFldChar *oox_fld)
{ {
if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeBegin) odt_context->start_field(false); if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeBegin) odt_context->start_field(false);
if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeEnd) odt_context->end_field(); if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeEnd) odt_context->end_field();
if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeSeparate){} if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeSeparate)odt_context->separate_field();
} }
} }
......
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