sw/qa/extras/ooxmlexport/data/fdo66773.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 19 +++++++++++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 13 +++++++++++++ sw/source/filter/ww8/docxattributeoutput.hxx | 3 +++ 4 files changed, 35 insertions(+)
New commits: commit 5bb9b70a66d7818844abfaa297893c095e03d24c Author: Adam Co <[email protected]> Date: Wed Jul 10 16:43:51 2013 +0300 fdo#66773: fix for line spacing default Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Change-Id: I7dafa709fd7dcd3df445277505468386c3f1cef2 Reviewed-on: https://gerrit.libreoffice.org/4810 diff --git a/sw/qa/extras/ooxmlexport/data/fdo66773.docx b/sw/qa/extras/ooxmlexport/data/fdo66773.docx new file mode 100644 index 0000000..41f0abe Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo66773.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 6b65c90..4af6477 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -21,6 +21,8 @@ #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XTextSection.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/table/ShadowFormat.hpp> @@ -90,6 +92,7 @@ public: void testFdo66543(); void testN822175(); void testFdo66688(); + void testFdo66773(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -152,6 +155,7 @@ void Test::run() {"fdo66543.docx", &Test::testFdo66543}, {"n822175.odt", &Test::testN822175}, {"fdo66688.docx", &Test::testFdo66688}, + {"fdo66773.docx", &Test::testFdo66773}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -914,6 +918,21 @@ void Test::testFdo66688() CPPUNIT_ASSERT_EQUAL( sal_Int32( 80 ), getProperty< sal_Int32 >( xFrame, "BackColorTransparency" ) ); } +void Test::testFdo66773() +{ + // The problem was the line spacing was interpreted by Word as 'Multiple 1.08' if no default settings were written. + // Now after the 'docDefaults' section is written in <styles.xml> - there is no more problem. + // (Word does not try to calculate some arbitrary value for line spacing). + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + CPPUNIT_ASSERT(xParaEnum->hasMoreElements()); + + style::LineSpacing alineSpacing = getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing"); + CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::PROP, alineSpacing.Mode); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(100), static_cast<sal_Int32>(alineSpacing.Height)); +} + 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 bda961a..cab5cdf 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2179,6 +2179,19 @@ void DocxAttributeOutput::StartStyles() m_pSerializer->startElementNS( XML_w, XML_styles, FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", FSEND ); + + DocDefaults(); +} + +void DocxAttributeOutput::DocDefaults( ) +{ + // To-Do : fill the '<w:docDefaults>' node with actual data + + // Write the '<w:docDefaults>' section here + m_pSerializer->startElementNS( XML_w, XML_docDefaults, FSEND ); + m_pSerializer->singleElementNS( XML_w, XML_rPrDefault, FSEND ); + m_pSerializer->singleElementNS( XML_w, XML_pPrDefault, FSEND ); + m_pSerializer->endElementNS( XML_w, XML_docDefaults ); } void DocxAttributeOutput::EndStyles( sal_uInt16 /*nNumberOfStyles*/ ) diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index a1132e9..c423275 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -192,6 +192,9 @@ public: /// Write default style. virtual void DefaultStyle( sal_uInt16 nStyle ); + /// Write Doc Defaults + void DocDefaults( ); + /// Start of a style in the styles table. virtual void StartStyle( const String& rName, bool bPapFmt, sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId, _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
