summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-10-26 17:52:42 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-10-27 14:37:58 +0100
commitbf1772c9fe7206c2594b2db5f6da3ca97003ba98 (patch)
tree2fbd21c9b2a610f13de5fd76cd9488486bb21e4f /writerfilter/source/dmapper/DomainMapper.cxx
parent5e07e42556e1399e37ad3ccf02b75f3b1d03551a (diff)
DOCX import, altChunk: fix missing page break
Somewhat similar to copy&paste, the altChunk mechanism drops styles from the inner document by default. A surprising consequence of that is sections in the inner document have the default page size. This leads to a page break when the content of the outer document ends and the content of the inner document starts. Fix the importer to support this: 1) Ignore the page size and number in DomainMapper::lcl_attribute(). 2) Pass the start of the current section to the sub-importer, so that it can insert the starting page break at the right place. (cherry picked from commit 32c322e9d037b29ded2297b400a2c596c042f1fa) Conflicts: writerfilter/source/dmapper/DomainMapper_Impl.hxx Change-Id: Id3955f2b35a139692254c4ac1233e96eef2620e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104870 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 04f5e2a6bec6..7789b54c0f5c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1050,7 +1050,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
m_pImpl->m_oBackgroundColor = nIntValue;
break;
case NS_ooxml::LN_CT_PageNumber_start:
- if (pSectionContext != nullptr)
+ if (pSectionContext != nullptr && !m_pImpl->IsAltChunk())
pSectionContext->SetPageNumber(nIntValue);
break;
case NS_ooxml::LN_CT_PageNumber_fmt:
@@ -2110,9 +2110,15 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
if(pSectionContext)
{
- pSectionContext->Insert( PROP_HEIGHT, uno::makeAny( CT_PageSz.h ) );
+ if (!m_pImpl->IsAltChunk())
+ {
+ pSectionContext->Insert(PROP_HEIGHT, uno::makeAny(CT_PageSz.h));
+ }
pSectionContext->Insert( PROP_IS_LANDSCAPE, uno::makeAny( CT_PageSz.orient ));
- pSectionContext->Insert( PROP_WIDTH, uno::makeAny( CT_PageSz.w ) );
+ if (!m_pImpl->IsAltChunk())
+ {
+ pSectionContext->Insert(PROP_WIDTH, uno::makeAny(CT_PageSz.w));
+ }
}
break;