diff --git a/OdfFile/Writer/Converter/DocxConverter.cpp b/OdfFile/Writer/Converter/DocxConverter.cpp index a8394c214d..6a61b455a8 100644 --- a/OdfFile/Writer/Converter/DocxConverter.cpp +++ b/OdfFile/Writer/Converter/DocxConverter.cpp @@ -3287,7 +3287,7 @@ void DocxConverter::convert(OOX::Drawing::CAnchor* oox_anchor) if (oox_anchor->m_oPositionV.IsInit() && oox_anchor->m_oPositionV->m_oRelativeFrom.IsInit()) { - int vert_rel = oox_anchor->m_oPositionV->m_oRelativeFrom->GetValue(); + SimpleTypes::ERelFromV vert_rel = oox_anchor->m_oPositionV->m_oRelativeFrom->GetValue(); odt_context->drawing_context()->set_vertical_rel(vert_rel); @@ -3296,20 +3296,12 @@ void DocxConverter::convert(OOX::Drawing::CAnchor* oox_anchor) else if (oox_anchor->m_oPositionV->m_oPosOffset.IsInit()) { - // relfromvBottomMargin = 0, - // relfromvInsideMargin = 1, - // relfromvLine = 2, - // relfromvMargin = 3, - // relfromvOutsideMargin = 4, - // relfromvPage = 5, - // relfromvParagraph = 6, - // relfromvTopMargin = 7 switch (vert_rel) { - case 2: anchor_type_x = anchor_type::Char; break; - case 5: anchor_type_y = anchor_type::Page; break; - case 3: - case 6: anchor_type_y = anchor_type::Paragraph; break; + case SimpleTypes::relfromvLine: anchor_type_x = anchor_type::Char; break; + case SimpleTypes::relfromvPage: anchor_type_y = anchor_type::Page; break; + case SimpleTypes::relfromvMargin: + case SimpleTypes::relfromvParagraph: anchor_type_y = anchor_type::Paragraph; break; } odt_context->drawing_context()->set_vertical_pos(oox_anchor->m_oPositionV->m_oPosOffset->ToPoints()); } @@ -3318,7 +3310,7 @@ void DocxConverter::convert(OOX::Drawing::CAnchor* oox_anchor) } if (oox_anchor->m_oPositionH.IsInit() && oox_anchor->m_oPositionH->m_oRelativeFrom.IsInit()) { - int horiz_rel = oox_anchor->m_oPositionH->m_oRelativeFrom->GetValue(); + SimpleTypes::ERelFromH horiz_rel = oox_anchor->m_oPositionH->m_oRelativeFrom->GetValue(); odt_context->drawing_context()->set_horizontal_rel(horiz_rel); if (oox_anchor->m_oPositionH->m_oAlign.IsInit()) @@ -3327,21 +3319,14 @@ void DocxConverter::convert(OOX::Drawing::CAnchor* oox_anchor) else if (oox_anchor->m_oPositionH->m_oPosOffset.IsInit()) { odt_context->drawing_context()->set_horizontal_pos(oox_anchor->m_oPositionH->m_oPosOffset->ToPoints()); - // relfromhCharacter = 0, - // relfromhColumn = 1, - // relfromhInsideMargin = 2, - // relfromhLeftMargin = 3, - // relfromhMargin = 4, - // relfromhOutsideMargin = 5, - // relfromhPage = 6, - // relfromhRightMargin = 7 + switch (horiz_rel) { - case 0: anchor_type_x = anchor_type::Char; break; - case 1: anchor_type_x = anchor_type::Frame; break; - case 4: - case 2: anchor_type_x = anchor_type::Paragraph; break; - case 6: anchor_type_x = anchor_type::Page; break; + case SimpleTypes::relfromhCharacter: anchor_type_x = anchor_type::Char; break; + case SimpleTypes::relfromhColumn: anchor_type_x = anchor_type::Frame; break; + case SimpleTypes::relfromhMargin: + case SimpleTypes::relfromhInsideMargin: anchor_type_x = anchor_type::Paragraph; break; + case SimpleTypes::relfromhPage: anchor_type_x = anchor_type::Page; break; } } else @@ -3350,6 +3335,9 @@ void DocxConverter::convert(OOX::Drawing::CAnchor* oox_anchor) if (anchor_type_x && anchor_type_y) { + if (*anchor_type_x == anchor_type::Paragraph || *anchor_type_y == anchor_type::Paragraph) + *anchor_type_x = *anchor_type_y = anchor_type::Paragraph; + if (*anchor_type_x == *anchor_type_y) odt_context->drawing_context()->set_anchor(*anchor_type_x); else if (*anchor_type_x == anchor_type::Frame && *anchor_type_y == anchor_type::Paragraph) diff --git a/OdfFile/Writer/Format/odf_text_context.cpp b/OdfFile/Writer/Format/odf_text_context.cpp index 286ca3c708..195bd3e02b 100644 --- a/OdfFile/Writer/Format/odf_text_context.cpp +++ b/OdfFile/Writer/Format/odf_text_context.cpp @@ -773,7 +773,7 @@ bool odf_text_context::set_type_break(int type, int clear)//todooo clear ??? end_element(); need_break_ = fo_break(fo_break::Page); - need_restart = true; + need_restart = clear != 0; // brclearAll = 0, } else //brtypeTextWrapping {