summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAdam Co <rattles2013@gmail.com>2013-07-10 16:43:51 +0300
committerMiklos Vajna <vmiklos@suse.cz>2013-07-11 10:10:09 +0200
commit5bb9b70a66d7818844abfaa297893c095e03d24c (patch)
tree9f14991fc8fc93d00fc39a95b292ba636e744fd6 /sw
parentdd3bb0aa49bbf45138d2ea594fb593729ac3b2b0 (diff)
fdo#66773: fix for line spacing default
Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Change-Id: I7dafa709fd7dcd3df445277505468386c3f1cef2 Reviewed-on: https://gerrit.libreoffice.org/4810
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo66773.docxbin0 -> 16239 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx19
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx13
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx3
4 files changed, 35 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo66773.docx b/sw/qa/extras/ooxmlexport/data/fdo66773.docx
new file mode 100644
index 000000000000..41f0abee7b6b
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo66773.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 6b65c901c15f..4af6477305bf 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 bda961aa0195..cab5cdf6e454 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 a1132e947d66..c4232759216b 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,