[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - writerfilter/source

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


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

New commits:
commit 39108ddebe9abd229b9b215c7e78452687422b37
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 18:23:30 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>
    (cherry picked from commit 3f680aef65a158cfbc98c8afd1c3628d7f4f7b83)
    Reviewed-on: https://gerrit.libreoffice.org/85304

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index e60312d02bea..efe03cde337e 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