summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-12-17 12:16:05 +0100
committerMichael Stahl <michael.stahl@cib.de>2019-12-17 15:24:45 +0100
commit3f680aef65a158cfbc98c8afd1c3628d7f4f7b83 (patch)
tree4cb7d0930e3570d3ee753ebe61087ea6752b79a2 /writerfilter
parentd7e9daf2d21d3bcafaa6aae4aed6c9df5e0999c4 (diff)
tdf#112201 writerfilter: try to apply continuous section page style...
... on the last node of the previous section. This works for this particular document, but it's quite dubious that it will work in the general case; feel free to revert this if it causes problems. Change-Id: Ia03d41a1127df505c4e9da7131323b70d88a285f Reviewed-on: https://gerrit.libreoffice.org/85294 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 0026ac8fe5ae..c971f229d95e 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1406,6 +1406,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
uno::UNO_QUERY_THROW);
uno::Reference<container::XEnumeration> const xEnum(
xCursor->createEnumeration());
+ bool isFound = false;
while (xEnum->hasMoreElements())
{
uno::Reference<beans::XPropertySet> xElem;
@@ -1419,10 +1420,24 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
// tdf#112201: do *not* use m_sFirstPageStyleName here!
xElem->setPropertyValue(getPropertyName(PROP_PAGE_DESC_NAME),
uno::makeAny(m_sFollowPageStyleName));
+ isFound = true;
break;
}
}
}
+ if (!isFound)
+ { // HACK: try the last paragraph of the previous section
+ uno::Reference<text::XParagraphCursor> const xPCursor(xCursor, uno::UNO_QUERY_THROW);
+ xPCursor->gotoPreviousParagraph(false);
+ uno::Reference<beans::XPropertySet> const xPSCursor(xCursor, uno::UNO_QUERY_THROW);
+ style::BreakType bt;
+ if ((xPSCursor->getPropertyValue("BreakType") >>= bt)
+ && bt == style::BreakType_PAGE_BEFORE)
+ {
+ xPSCursor->setPropertyValue(getPropertyName(PROP_PAGE_DESC_NAME),
+ uno::makeAny(m_sFollowPageStyleName));
+ }
+ }
}
}
catch ( const uno::Exception& )