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

New commits:
commit 5d59d1b4344baf2fe276fe6a0bfe9afe782a32e0
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Dec 17 12:16:05 2019 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Thu Jan 16 18:27:21 2020 +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 <[email protected]>
    (cherry picked from commit 3f680aef65a158cfbc98c8afd1c3628d7f4f7b83)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86913
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 430389495ff8..120fb7872ed3 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1396,6 +1396,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;
@@ -1409,10 +1410,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& )
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to