[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa sw/source
Miklos Vajna
vmiklos at suse.cz
Tue Jul 9 01:26:12 PDT 2013
sw/qa/extras/ooxmlexport/data/n822175.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 +++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 43 +++++++++++++++++++++++++++
sw/source/filter/ww8/docxattributeoutput.hxx | 1
4 files changed, 56 insertions(+)
New commits:
commit deb07d0f4d54dbbd65194bd533499706dea0d8b8
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Jul 8 12:48:26 2013 +0200
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 at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
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 8dc69f2..dc5b215 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 66c003e..803fe03 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 32d0a84..d120f30 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.
More information about the Libreoffice-commits
mailing list