diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-07-08 12:48:26 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-07-08 13:41:37 +0200 |
commit | 3a87ba9725ef7e1e9a15c5b7abda87d36c9dc614 (patch) | |
tree | 4903f796d9d893d4b31146008a2c04abca0c03c7 | |
parent | 9c773140935c056896c79c8380640918b6ea161e (diff) |
bnc#822175 DOCX filter: export wrapping of text frames
Change-Id: I5c5128686e96a97570b8cdf109dd75976a071ca8
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/n822175.odt | bin | 0 -> 7633 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 40 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 1 |
4 files changed, 53 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/n822175.odt b/sw/qa/extras/ooxmlexport/data/n822175.odt Binary files differnew file mode 100644 index 000000000000..d49a59194f4b --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/n822175.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 84470813673e..7230a4c7b409 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 4614efc186e5..f592e2756a27 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 3227062b901c..a1132e947d66 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. |