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

Justin Luth justin_luth at sil.org
Mon Jul 4 15:32:23 UTC 2016


 sw/qa/extras/ooxmlexport/data/tdf96750_landscapeFollow.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx                   |    6 ++++
 writerfilter/source/dmapper/PropertyMap.cxx                 |   16 ++++++++----
 writerfilter/source/dmapper/PropertyMap.hxx                 |    2 -
 4 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit f76b8d1cfe07e84744bc57a22e815d347f3f8f23
Author: Justin Luth <justin_luth at sil.org>
Date:   Mon Jul 4 12:07:00 2016 +0300

    tdf#96750 docx - ensure all styles are initialized
    
    Change-Id: I50467cb2798ef81dd89006768c66aa7e93cb411c
    Reviewed-on: https://gerrit.libreoffice.org/26892
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf96750_landscapeFollow.docx b/sw/qa/extras/ooxmlexport/data/tdf96750_landscapeFollow.docx
new file mode 100644
index 0000000..c76b14d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf96750_landscapeFollow.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 6e45fc4..f2bb607 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -965,6 +965,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92521, "tdf92521.odt")
         assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf96750_landscapeFollow, "tdf96750_landscapeFollow.docx")
+{
+    uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle, "IsLandscape"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 37f9646..efc8343 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1011,7 +1011,7 @@ uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection,
     return xRangeProperties;
 }
 
-void SectionPropertyMap::HandleMarginsHeaderFooter(DomainMapper_Impl& rDM_Impl)
+void SectionPropertyMap::HandleMarginsHeaderFooter(bool bFirstPage, DomainMapper_Impl& rDM_Impl)
 {
     if( m_nDzaGutter > 0 )
     {
@@ -1030,8 +1030,8 @@ void SectionPropertyMap::HandleMarginsHeaderFooter(DomainMapper_Impl& rDM_Impl)
     /*** if headers/footers are available then the top/bottom margins of the
       header/footer are copied to the top/bottom margin of the page
       */
-    CopyLastHeaderFooter( false, rDM_Impl );
-    PrepareHeaderFooterProperties( false );
+    CopyLastHeaderFooter( bFirstPage, rDM_Impl );
+    PrepareHeaderFooterProperties( bFirstPage );
 }
 
 bool SectionPropertyMap::FloatingTableConversion(FloatingTableInfo& rInfo)
@@ -1152,9 +1152,15 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
                         xRangeProperties->setPropertyValue(getPropertyName(PROP_PAGE_DESC_NAME), uno::makeAny(aName));
 
                     uno::Reference<beans::XPropertySet> xPageStyle (rDM_Impl.GetPageStyles()->getByName(aName), uno::UNO_QUERY_THROW);
-                    HandleMarginsHeaderFooter(rDM_Impl);
+                    HandleMarginsHeaderFooter(false, rDM_Impl);
+                    if( m_bTitlePage )
+                        HandleMarginsHeaderFooter(true, rDM_Impl);
                     if (rDM_Impl.IsNewDoc())
+                    {
                         ApplyProperties_(xPageStyle);
+                        if( m_bTitlePage && m_aFollowPageStyle.is() )
+                            ApplyProperties_(m_aFollowPageStyle);
+                    }
                 }
                 catch( const uno::Exception& )
                 {
@@ -1185,7 +1191,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
         //get the properties and create appropriate page styles
         uno::Reference< beans::XPropertySet > xFollowPageStyle = GetPageStyle( rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), false );
 
-        HandleMarginsHeaderFooter(rDM_Impl);
+        HandleMarginsHeaderFooter(/*bFirstPage=*/false, rDM_Impl);
 
         const OUString sTrayIndex = getPropertyName( PROP_PRINTER_PAPER_TRAY_INDEX );
         if( m_nPaperBin >= 0 )
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 5daf4e8..f6796a6 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -331,7 +331,7 @@ public:
 
     void CloseSectionGroup( DomainMapper_Impl& rDM_Impl );
     /// Handling of margins, header and footer for any kind of sections breaks.
-    void HandleMarginsHeaderFooter(DomainMapper_Impl& rDM_Impl);
+    void HandleMarginsHeaderFooter(bool bFirstPage, DomainMapper_Impl& rDM_Impl);
     void ClearHeaderFooterLinkToPrevious( bool bHeader, PageType eType );
 };
 


More information about the Libreoffice-commits mailing list