[PATCH] fdo#65655 : fix for Different_Odd_And_Even_Pages flag ignore...

Adam CloudOn (via Code Review) gerrit at gerrit.libreoffice.org
Tue Jun 11 08:22:04 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4229

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/29/4229/1

fdo#65655 : fix for Different_Odd_And_Even_Pages flag ignored

Change-Id: Icf9949bb00aa905d22aedfd8f2b297dfa89dfedb
---
A sw/qa/extras/ooxmlexport/data/fdo65655.docx
M sw/qa/extras/ooxmlexport/ooxmlexport.cxx
A sw/qa/extras/ooxmlimport/data/fdo65655.docx
M sw/qa/extras/ooxmlimport/ooxmlimport.cxx
M writerfilter/source/dmapper/DomainMapper_Impl.cxx
5 files changed, 39 insertions(+), 2 deletions(-)



diff --git a/sw/qa/extras/ooxmlexport/data/fdo65655.docx b/sw/qa/extras/ooxmlexport/data/fdo65655.docx
new file mode 100644
index 0000000..5fe9451
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo65655.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ca6fad6..55221c2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -72,6 +72,7 @@
     void testI120928();
     void testFdo64826();
     void testPageBackground();
+    void testFdo65655();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -121,6 +122,7 @@
         {"i120928.docx", &Test::testI120928},
         {"fdo64826.docx", &Test::testFdo64826},
         {"page-background.docx", &Test::testPageBackground},
+        {"fdo65655.docx", &Test::testFdo65655},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -688,6 +690,20 @@
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
 }
 
+void Test::testFdo65655()
+{
+    // The problem was that the DOCX had a non-blank odd footer and a blank even footer
+    // The 'Different Odd & Even Pages' was turned on
+    // However - LO assumed that because the 'even' footer is blank - it should ignore the 'Different Odd & Even Pages' flag
+    // So it did not import it and did not export it
+    uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+    sal_Bool bValue = false;
+    xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue;
+    CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
+    xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
+    CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/ooxmlimport/data/fdo65655.docx b/sw/qa/extras/ooxmlimport/data/fdo65655.docx
new file mode 100644
index 0000000..5fe9451
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/fdo65655.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index c422ecc..128961f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -117,6 +117,7 @@
     void testWatermark();
     void testPageBorderShadow();
     void testN816593();
+    void testFdo65655();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -202,6 +203,7 @@
         {"watermark.docx", &Test::testWatermark},
         {"page-border-shadow.docx", &Test::testPageBorderShadow},
         {"n816593.docx", &Test::testN816593},
+        {"fdo65655.docx", &Test::testFdo65655},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1441,6 +1443,19 @@
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
 }
 
+void Test::testFdo65655()
+{
+    // The problem was that the DOCX had a non-blank odd footer and a blank even footer
+    // The 'Different Odd & Even Pages' was turned on
+    // However - LO assumed that because the 'even' footer is blank - it should ignore the 'Different Odd & Even Pages' flag
+    uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+    sal_Bool bValue = false;
+    xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue;
+    CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
+    xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
+    CPPUNIT_ASSERT_EQUAL(false, bool(bValue));
+}
+
 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 fbc633d..c822739 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1377,7 +1377,10 @@
                     uno::makeAny(sal_True) );
             // if a left header is available then header are not shared
             bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-            if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders())
+
+            // If the 'Different Even & Odd Pages' flag is turned on - do not ignore it
+            // Even if the 'Even' header is blank - the flag should be imported (so it would look in LO like in Word)
+            if( m_pSettingsTable->GetEvenAndOddHeaders())
                 xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), uno::makeAny( false ));
 
             //set the interface
@@ -1419,7 +1422,10 @@
                     uno::makeAny(sal_True) );
             // if a left header is available then footer is not shared
             bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-            if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders())
+
+            // If the 'Different Even & Odd Pages' flag is turned on - do not ignore it
+            // Even if the 'Even' footer is blank - the flag should be imported (so it would look in LO like in Word)
+            if( m_pSettingsTable->GetEvenAndOddHeaders())
                 xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), uno::makeAny( false ));
             //set the interface
             uno::Reference< text::XText > xFooterText;

-- 
To view, visit https://gerrit.libreoffice.org/4229
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf9949bb00aa905d22aedfd8f2b297dfa89dfedb
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Adam CloudOn <rattles2013 at gmail.com>



More information about the LibreOffice mailing list