[Libreoffice-commits] .: writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Thu Jun 28 04:18:04 PDT 2012


 writerfilter/source/dmapper/PropertyMap.cxx |   19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 45e60ae3120b81e2987151a8485766c2fa946d48
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jun 28 13:06:52 2012 +0200

    dmapper: better fix for import of titlepg top/bottom margin
    
    This commit reverts the fix for fdo#44176, and implements a better fix,
    which keeps the original testcase passing, but also fixes the layout of
    a simple document, having different first, odd and even headers within
    the same section.
    
    Change-Id: I96893ce3e886e479f1d7640b126ad7a1dd828bdb

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 2d3d4cb..8542d7e 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -782,19 +782,12 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
         operator[]( PropertyDefinition( PROP_FOOTER_BODY_DISTANCE, false )) = uno::makeAny( m_nHeaderBottom );
     }
 
-    //now set the top/bottom margin
-    sal_Int32 nHeaderHeight = 0, nFooterHeight = 0;
-    if (bFirstPage)
-    {
-        PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
-        // make sure the height of the header/footer is added to the top/bottom margin if necessary
-        if (m_aFollowPageStyle.is() && !HasHeader(true) && HasHeader(false))
-            m_aFollowPageStyle->getPropertyValue(rPropNameSupplier.GetName(PROP_HEADER_HEIGHT)) >>= nHeaderHeight;
-        if (m_aFollowPageStyle.is() && !HasFooter(true) && HasFooter(false))
-            m_aFollowPageStyle->getPropertyValue(rPropNameSupplier.GetName(PROP_FOOTER_HEIGHT)) >>= nFooterHeight;
-    }
-    operator[]( PropertyDefinition( PROP_TOP_MARGIN, false )) = uno::makeAny( m_nTopMargin + nHeaderHeight );
-    operator[]( PropertyDefinition( PROP_BOTTOM_MARGIN, false )) = uno::makeAny( m_nBottomMargin + nFooterHeight );
+    //now set the top/bottom margin for the follow page style
+    operator[]( PropertyDefinition( PROP_TOP_MARGIN, false )) = uno::makeAny( m_nTopMargin );
+    operator[]( PropertyDefinition( PROP_BOTTOM_MARGIN, false )) = uno::makeAny( m_nBottomMargin );
+
+    // 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;
 }
 
 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