[Libreoffice-commits] .: 2 commits - sw/qa writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Jun 15 06:27:38 PDT 2012


 sw/qa/extras/ooxmltok/ooxmltok.cxx                |   13 +++++++++++++
 sw/qa/extras/rtftok/rtftok.cxx                    |   10 ----------
 sw/qa/extras/swmodeltestbase.hxx                  |   10 ++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    4 ++--
 writerfilter/source/dmapper/SettingsTable.cxx     |   10 ++++++++++
 writerfilter/source/dmapper/SettingsTable.hxx     |    2 ++
 6 files changed, 37 insertions(+), 12 deletions(-)

New commits:
commit 7193d4ef0d61d82fe2138b4736f27b6d27fc8e0a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 15 15:09:53 2012 +0200

    n#750935 fix docx import of w:evenAndOddHeaders
    
    Change-Id: I172073bac10e8d0449c0f5c0a226dd7ace013376

diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 5026530..3afb8b7 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -193,7 +193,20 @@ void Test::testN750935()
     uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
     uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
     xCursor->jumpToLastPage();
+    // Some page break types were ignores, resulting in less pages.
     CPPUNIT_ASSERT_EQUAL(sal_Int16(5), xCursor->getPage());
+
+    /*
+     * The problem was that the header and footer was not shared.
+     *
+     * xray ThisComponent.StyleFamilies.PageStyles.Default.FooterIsShared
+     */
+    uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
+    sal_Bool bValue = false;
+    xPropertySet->getPropertyValue("HeaderIsShared") >>= bValue;
+    CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
+    xPropertySet->getPropertyValue("FooterIsShared") >>= bValue;
+    CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
 }
 
 void Test::testN757890()
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index bda064d..1dcb7f5 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1271,7 +1271,7 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
                     uno::makeAny(sal_True) );
             // if a left header is available then header are not shared
             bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-            if( bLeft )
+            if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders())
                 xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_IS_SHARED), uno::makeAny( false ));
 
             //set the interface
@@ -1310,7 +1310,7 @@ void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType)
                     uno::makeAny(sal_True) );
             // if a left header is available then footer is not shared
             bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
-            if( bLeft )
+            if( bLeft && m_pSettingsTable->GetEvenAndOddHeaders())
                 xPageStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_IS_SHARED), uno::makeAny( false ));
             //set the interface
             uno::Reference< text::XText > xFooterText;
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index ab89c6a..2a69cc6 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -76,6 +76,7 @@ struct SettingsTable_Impl
     ::rtl::OUString     m_sSalt;
     bool                m_bLinkStyles;
     sal_Int16           m_nZoomFactor;
+    bool                m_bEvenAndOddHeaders;
 
     SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) :
     m_rDMapper( rDMapper )
@@ -94,6 +95,7 @@ struct SettingsTable_Impl
     , m_nCryptSpinCount(0)
     , m_bLinkStyles(false)
     , m_nZoomFactor(0)
+    , m_bEvenAndOddHeaders(false)
     {}
 
 };
@@ -165,6 +167,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
     case NS_ooxml::LN_CT_Settings_linkStyles: // 92663;
     m_pImpl->m_bLinkStyles = nIntValue;
     break;
+    case NS_ooxml::LN_CT_Settings_evenAndOddHeaders:
+    m_pImpl->m_bEvenAndOddHeaders = nIntValue;
+    break;
     case NS_ooxml::LN_CT_Settings_noPunctuationKerning: //  92526;
     m_pImpl->m_bNoPunctuationKerning = nIntValue ? true : false;
     break;
@@ -230,6 +235,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const
     return m_pImpl->m_nZoomFactor;
 }
 
+bool SettingsTable::GetEvenAndOddHeaders() const
+{
+    return m_pImpl->m_bEvenAndOddHeaders;
+}
+
 void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
 {
     uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 3d9a560..2c43ec6 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -70,6 +70,8 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo
     /// What's the zoom factor set in percents?
     sal_Int16 GetZoomFactor() const;
 
+    bool GetEvenAndOddHeaders() const;
+
     void ApplyProperties( uno::Reference< text::XTextDocument > xDoc );
 
  private:
commit a234804c9de3f2659f766eae452b25eaf15eae22
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 15 15:21:36 2012 +0200

    sw/qa: move getStyles from rtftok to base class, to be used by ooxmltok
    
    Change-Id: I137c0a42ab8413213d93f1bbd868077e2c042ce0

diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index e1f4fa7..e7ed1bb 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -33,7 +33,6 @@
 #include <com/sun/star/style/CaseMap.hpp>
 #include <com/sun/star/style/LineSpacing.hpp>
 #include <com/sun/star/style/LineSpacingMode.hpp>
-#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/table/BorderLineStyle.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
@@ -144,7 +143,6 @@ private:
     void load(const OUString& rURL);
     /// Get page count.
     int getPages();
-    uno::Reference<container::XNameAccess> getStyles(OUString aFamily);
 };
 
 void Test::load(const OUString& rFilename)
@@ -161,14 +159,6 @@ int Test::getPages()
     return xCursor->getPage();
 }
 
-uno::Reference<container::XNameAccess> Test::getStyles(OUString aFamily)
-{
-    uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
-    uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
-    uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName(aFamily), uno::UNO_QUERY);
-    return xPageStyles;
-}
-
 void Test::testFdo45553()
 {
     load("fdo45553.rtf");
diff --git a/sw/qa/extras/swmodeltestbase.hxx b/sw/qa/extras/swmodeltestbase.hxx
index 347d408..0ddd226 100644
--- a/sw/qa/extras/swmodeltestbase.hxx
+++ b/sw/qa/extras/swmodeltestbase.hxx
@@ -25,6 +25,7 @@
  * instead of those above.
  */
 
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
 
 #include <test/bootstrapfixture.hxx>
@@ -74,6 +75,15 @@ protected:
         return aBuf.getLength();
     }
 
+    /// Get a family of styles, see com.sun.star.style.StyleFamilies for possible values.
+    uno::Reference<container::XNameAccess> getStyles(rtl::OUString aFamily)
+    {
+        uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+        uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
+        uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName(aFamily), uno::UNO_QUERY);
+        return xStyleFamily;
+    }
+
     uno::Reference<lang::XComponent> mxComponent;
 };
 


More information about the Libreoffice-commits mailing list