sw/qa/extras/ooxmlexport/data/n822175.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 ++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 40 +++++++++++++++++++++++++++ sw/source/filter/ww8/docxattributeoutput.hxx | 1 4 files changed, 53 insertions(+)
New commits: commit 3a87ba9725ef7e1e9a15c5b7abda87d36c9dc614 Author: Miklos Vajna <[email protected]> Date: Mon Jul 8 12:48:26 2013 +0200 bnc#822175 DOCX filter: export wrapping of text frames Change-Id: I5c5128686e96a97570b8cdf109dd75976a071ca8 diff --git a/sw/qa/extras/ooxmlexport/data/n822175.odt b/sw/qa/extras/ooxmlexport/data/n822175.odt new file mode 100644 index 0000000..d49a591 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/n822175.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 8447081..7230a4c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/text/WritingMode2.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> #include <unotools/tempfile.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -87,6 +88,7 @@ public: void testFdo56679(); void testFdo65400(); void testFdo66543(); + void testN822175(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -147,6 +149,7 @@ void Test::run() {"fdo56679.docx", &Test::testFdo56679}, {"fdo65400.docx", &Test::testFdo65400}, {"fdo66543.docx", &Test::testFdo66543}, + {"n822175.odt", &Test::testN822175}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -890,6 +893,15 @@ void Test::testFdo66543() CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), getProperty< sal_Int32 >( paragraph1, "ParaLineNumberStartValue" )); } +void Test::testN822175() +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFrame(xDraws->getByIndex(0), uno::UNO_QUERY); + // Was text::WrapTextMode_THROUGH, due to missing Surround handling in the exporter. + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_PARALLEL, getProperty<text::WrapTextMode>(xFrame, "Surround")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 4614efc..f592e27 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -340,6 +340,14 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT m_rExport.WriteText( ); m_pSerializer->endElementNS( XML_w, XML_txbxContent ); m_pSerializer->endElementNS( XML_v, XML_textbox ); + + if (m_pFlyWrapAttrList) + { + XFastAttributeListRef xFlyWrapAttrList(m_pFlyWrapAttrList); + m_pFlyWrapAttrList = NULL; + m_pSerializer->singleElementNS(XML_w10, XML_wrap, xFlyWrapAttrList); + } + m_pSerializer->endElementNS( XML_v, XML_rect ); m_pSerializer->endElementNS( XML_w, XML_pict ); m_pSerializer->endElementNS( XML_w, XML_r ); @@ -4658,6 +4666,37 @@ void DocxAttributeOutput::FormatSurround( const SwFmtSurround& rSurround ) { if (m_bTextFrameSyntax) { + OString sType, sSide; + switch (rSurround.GetSurround()) + { + case SURROUND_NONE: + sType = "topAndBottom"; + break; + case SURROUND_PARALLEL: + sType = "square"; + break; + case SURROUND_IDEAL: + sType = "square"; + sSide = "largest"; + case SURROUND_LEFT: + sType = "square"; + sSide = "left"; + case SURROUND_RIGHT: + sType = "square"; + sSide = "right"; + break; + case SURROUND_THROUGHT: + default: + break; + } + if (!sType.isEmpty() || !sSide.isEmpty()) + { + m_pFlyWrapAttrList = m_pSerializer->createAttrList(); + if (!sType.isEmpty()) + m_pFlyWrapAttrList->add(XML_type, sType); + if (!sSide.isEmpty()) + m_pFlyWrapAttrList->add(XML_side, sSide); + } } else if ( m_rExport.bOutFlyFrmAttrs ) { @@ -5055,6 +5094,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri m_pHyperlinkAttrList( NULL ), m_pFlyAttrList( NULL ), m_pFlyFillAttrList( NULL ), + m_pFlyWrapAttrList( NULL ), m_pTextboxAttrList( NULL ), m_pFlyFrameSize(0), m_pFootnotesList( new ::docx::FootnotesList() ), diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 3227062..a1132e9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -586,6 +586,7 @@ private: ::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList; ::sax_fastparser::FastAttributeList *m_pFlyAttrList; ::sax_fastparser::FastAttributeList *m_pFlyFillAttrList; + ::sax_fastparser::FastAttributeList *m_pFlyWrapAttrList; /// Attributes of the next v:textbox element. ::sax_fastparser::FastAttributeList *m_pTextboxAttrList; /// When exporting fly frames, this holds the real size of the frame. _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
