diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-07-08 12:48:26 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-07-09 08:25:49 +0000 |
commit | deb07d0f4d54dbbd65194bd533499706dea0d8b8 (patch) | |
tree | 97433bb290332df9b6260d9e39c16b118df8537b /sw | |
parent | 6eb2fdb168c6e6da6c30b71eb80c759c553f1770 (diff) |
bnc#822175 DOCX filter: export wrapping of text frames
(cherry picked from commits 3a87ba9725ef7e1e9a15c5b7abda87d36c9dc614 and
00d8a4071628a88465f13d2e860ccd87c3a85b9e)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Change-Id: I5c5128686e96a97570b8cdf109dd75976a071ca8
Reviewed-on: https://gerrit.libreoffice.org/4772
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sw')
-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 | 43 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 1 |
4 files changed, 56 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 8dc69f2a197e..dc5b2152d1cb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> #include <unotools/tempfile.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -69,6 +70,7 @@ public: void testMathLiteral(); void testFdo48557(); void testI120928(); + void testN822175(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -116,6 +118,7 @@ void Test::run() {"math-literal.docx", &Test::testMathLiteral}, {"fdo48557.odt", &Test::testFdo48557}, {"i120928.docx", &Test::testI120928}, + {"n822175.odt", &Test::testN822175}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -672,6 +675,15 @@ void Test::testI120928() CPPUNIT_ASSERT_EQUAL(true, bIsGraphic); } +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 66c003ea2898..803fe03b7ac5 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -338,6 +338,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 ); @@ -4463,6 +4471,40 @@ 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"; + break; + case SURROUND_LEFT: + sType = "square"; + sSide = "left"; + break; + case SURROUND_RIGHT: + sType = "square"; + sSide = "right"; + break; + case SURROUND_THROUGHT: + /* empty type and side means 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 ) { @@ -4860,6 +4902,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 32d0a848d1ae..d120f3048aa6 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -565,6 +565,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. |