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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 17 14:25:51 UTC 2019


 writerfilter/source/dmapper/PropertyMap.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 3f680aef65a158cfbc98c8afd1c3628d7f4f7b83
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Dec 17 12:16:05 2019 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue Dec 17 15:24:45 2019 +0100

    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 at cib.de>

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& )


More information about the Libreoffice-commits mailing list