[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Aug 30 00:10:49 PDT 2012
sw/qa/extras/ooxmlimport/data/n777337.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 20 ++++++++++++++++++--
writerfilter/source/dmapper/PropertyMap.cxx | 4 ++++
3 files changed, 22 insertions(+), 2 deletions(-)
New commits:
commit dd11bca8ab191ce10054a5f2de7010ca400eb0b5
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Aug 30 09:11:58 2012 +0100
n#777337 testcase
Also remove the #if 0 I forgot to remove previously.
Change-Id: I2cc5e1407c509414c8395d0fd63ab3b379bef04f
diff --git a/sw/qa/extras/ooxmlimport/data/n777337.docx b/sw/qa/extras/ooxmlimport/data/n777337.docx
new file mode 100644
index 0000000..8bb377d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n777337.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 00e36b8..ec61993 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -88,10 +88,10 @@ public:
void testN775906();
void testN775899();
void testN777345();
+ void testN777337();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
-#if 0
CPPUNIT_TEST(testN751054);
CPPUNIT_TEST(testN751117);
CPPUNIT_TEST(testN751017);
@@ -118,8 +118,8 @@ public:
CPPUNIT_TEST(testAllGapsWord);
CPPUNIT_TEST(testN775906);
CPPUNIT_TEST(testN775899);
-#endif
CPPUNIT_TEST(testN777345);
+ CPPUNIT_TEST(testN777337);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -785,6 +785,22 @@ void Test::testN777345()
CPPUNIT_ASSERT_EQUAL(sal_uLong(2404338915U), aGraphic.GetChecksum());
}
+void Test::testN777337()
+{
+ /*
+ * The problem was that the top and bottom margin on the first page was only 0.1cm instead of 1.7cm.
+ *
+ * oFirst = ThisComponent.StyleFamilies.PageStyles.getByName("First Page")
+ * xray oFirst.TopMargin
+ * xray oFirst.BottomMargin
+ */
+ load("n777337.docx");
+
+ uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty<sal_Int32>(xPropertySet, "TopMargin"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1702), getProperty<sal_Int32>(xPropertySet, "BottomMargin"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
commit a474559ff1e560b83952f00595dbd8ae7fde88b6
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Aug 30 09:11:17 2012 +0100
n#777337 fix DOCX import of title page top/bottom margin with headers/footers
SectionPropertyMap::PrepareHeaderFooterProperties() already backed up
m_nTopMargin to have the same result when that method is called multiple
times. Do the same for the header footer height values as well to match
the WW8 behaviour.
Change-Id: Ib2347abc3db39308900c7721c0e15de040d9a01f
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 70bb53b..aceba89 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -712,6 +712,7 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Imp
void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
{
sal_Int32 nTopMargin = m_nTopMargin;
+ sal_Int32 nHeaderTop = m_nHeaderTop;
if(HasHeader(bFirstPage))
{
m_nTopMargin = m_nHeaderTop;
@@ -745,6 +746,7 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
}
sal_Int32 nBottomMargin = m_nBottomMargin;
+ sal_Int32 nHeaderBottom = m_nHeaderBottom;
if( HasFooter( bFirstPage ) )
{
m_nBottomMargin = m_nHeaderBottom;
@@ -779,6 +781,8 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
// Restore original top margin, so we don't end up with a smaller margin in case we have to produce two page styles from one Word section.
m_nTopMargin = nTopMargin;
+ m_nHeaderTop = nHeaderTop;
+ m_nHeaderBottom = nHeaderBottom;
}
uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection, DomainMapper_Impl& rDM_Impl, uno::Reference<text::XTextRange> xStartingRange)
More information about the Libreoffice-commits
mailing list