[Libreoffice-commits] .: sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 18 06:35:47 PDT 2012
sw/qa/extras/rtfimport/data/leftmargin-default.rtf | 5 +++++
sw/qa/extras/rtfimport/rtfimport.cxx | 9 +++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 +++-
3 files changed, 17 insertions(+), 1 deletion(-)
New commits:
commit f5ef4f27d5f2d82b28be690154102dae72f94545
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Oct 18 13:36:49 2012 +0200
fix import of RTF default page left/right margin
This is one more fallout from fdo#42407, which is still incomplete.
Change-Id: Ie47f06be598ce5236c45bd3750ea7a21fd98175c
diff --git a/sw/qa/extras/rtfimport/data/leftmargin-default.rtf b/sw/qa/extras/rtfimport/data/leftmargin-default.rtf
new file mode 100644
index 0000000..cf3ffd3
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/leftmargin-default.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+\margt0
+foo
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 9c27818..1ebadad 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -119,6 +119,7 @@ public:
void testShptxtPard();
void testDoDhgt();
void testDplinehollow();
+ void testLeftmarginDefault();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -176,6 +177,7 @@ public:
CPPUNIT_TEST(testShptxtPard);
CPPUNIT_TEST(testDoDhgt);
CPPUNIT_TEST(testDplinehollow);
+ CPPUNIT_TEST(testLeftmarginDefault);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -936,6 +938,13 @@ void Test::testDplinehollow()
CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty<drawing::LineStyle>(xPropertySet, "LineStyle"));
}
+void Test::testLeftmarginDefault()
+{
+ // The default left/right margin was incorrect when the top margin was set to zero.
+ load("leftmargin-default.rtf");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2540), getProperty<sal_Int32>(getStyles("PageStyles")->getByName("Default"), "LeftMargin"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4ea9983..069e94c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3471,7 +3471,9 @@ _PageMar::_PageMar()
{
header = footer = ConversionHelper::convertTwipToMM100(sal_Int32(720));
top = bottom = ConversionHelper::convertTwipToMM100( sal_Int32(1440));
- right = left = ConversionHelper::convertTwipToMM100( sal_Int32(1800));
+ // This is strange, the RTF spec says it's 1800, but it's clearly 1440 in Word
+ // OOXML seems not to specify a default value
+ right = left = ConversionHelper::convertTwipToMM100( sal_Int32(1440));
gutter = 0;
}
More information about the Libreoffice-commits
mailing list