summaryrefslogtreecommitdiffstats
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-05-28 21:59:27 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-05-29 16:31:46 +0200
commit02a924831933d964cda209897bab27c48803c891 (patch)
tree2946becf71cf3db6143dd35bf14651166d06d627 /writerfilter
parentweld SvxSwPosSizeTabPage (diff)
downloadcore-02a924831933d964cda209897bab27c48803c891.tar.gz
core-02a924831933d964cda209897bab27c48803c891.zip
tdf#117503 DOCX import: fix out of sync first/later top margin
Improve the synchronization between the first page and follow page style, so that when the DOC export invokes sw::util::IsPlausableSingleWordSection(), it recognizes that originally these were the same Word section. If they don't match up, then the exporter will insert an explicit section break, meaning we get one more page in the export result compared to the original. (cherry picked from commit b7ae863efeb082816cc4fe660527a9650d90e186) Change-Id: I336cf347698187cdede47be2659cec51e4381e85 Reviewed-on: https://gerrit.libreoffice.org/54988 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx27
1 files changed, 26 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index f9a09b31df61..7289a744c3f4 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -899,7 +899,8 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Imp
void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
{
- if (bFirstPage && m_bTitlePage && m_aFollowPageStyle.is())
+ bool bCopyFirstToFollow = bFirstPage && m_bTitlePage && m_aFollowPageStyle.is();
+ if (bCopyFirstToFollow)
{
// This is a first page and has a follow style, then enable the
// header/footer there as well to be consistent.
@@ -932,6 +933,13 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
Insert( PROP_HEADER_BODY_DISTANCE, uno::makeAny( nHeaderTop - MIN_HEAD_FOOT_HEIGHT ) );// ULSpace.Top()
Insert( PROP_HEADER_HEIGHT, uno::makeAny( nHeaderTop ) );
+ if (bCopyFirstToFollow && HasHeader(/*bFirstPage=*/true))
+ {
+ m_aFollowPageStyle->setPropertyValue("HeaderDynamicSpacing",
+ getProperty(PROP_HEADER_DYNAMIC_SPACING)->second);
+ m_aFollowPageStyle->setPropertyValue("HeaderHeight",
+ getProperty(PROP_HEADER_HEIGHT)->second);
+ }
}
else
{
@@ -962,6 +970,14 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
Insert( PROP_FOOTER_DYNAMIC_SPACING, uno::makeAny( true ) );
Insert( PROP_FOOTER_BODY_DISTANCE, uno::makeAny( nHeaderBottom - MIN_HEAD_FOOT_HEIGHT ) );
Insert( PROP_FOOTER_HEIGHT, uno::makeAny( nHeaderBottom ) );
+
+ if (bCopyFirstToFollow && HasFooter(/*bFirstPage=*/true))
+ {
+ m_aFollowPageStyle->setPropertyValue("FooterDynamicSpacing",
+ getProperty(PROP_FOOTER_DYNAMIC_SPACING)->second);
+ m_aFollowPageStyle->setPropertyValue("FooterHeight",
+ getProperty(PROP_FOOTER_HEIGHT)->second);
+ }
}
else
{
@@ -976,6 +992,15 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
//now set the top/bottom margin for the follow page style
Insert( PROP_TOP_MARGIN, uno::makeAny( std::max<sal_Int32>(nTopMargin, 0) ) );
Insert( PROP_BOTTOM_MARGIN, uno::makeAny( std::max<sal_Int32>(nBottomMargin, 0) ) );
+
+ if (bCopyFirstToFollow)
+ {
+ if (HasHeader(/*bFirstPage=*/true))
+ m_aFollowPageStyle->setPropertyValue("TopMargin", getProperty(PROP_TOP_MARGIN)->second);
+ if (HasFooter(/*bFirstPage=*/true))
+ m_aFollowPageStyle->setPropertyValue("BottomMargin",
+ getProperty(PROP_BOTTOM_MARGIN)->second);
+ }
}
uno::Reference< beans::XPropertySet > lcl_GetRangeProperties( bool bIsFirstSection,