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

Justin Luth justin_luth at sil.org
Thu Sep 8 12:57:48 UTC 2016


 sw/qa/extras/ooxmlexport/data/tdf81345.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx   |   12 ++++++++++++
 writerfilter/source/dmapper/PropertyMap.cxx |    7 +++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 3870c0555aa461268a6d056543f4545d562769ce
Author: Justin Luth <justin_luth at sil.org>
Date:   Wed Sep 7 19:26:30 2016 +0300

    tdf#81345 docx import fix default page break regression
    
    "regression" from 4e653d15eff26aa5283d8ba20611893f4c573f57
    
    If there are new style elements, then don't treat a
    default break in columns as a continuous break.
    
    This fixes both round-tripping, and initial import of
    columns and headers on this particular document. Since
    MS and LO treat sections so differently, it is a balancing
    act of what to change.
    
    Change-Id: I9c79bc1246108da6a5ebbf744acbcfcbb9d33d48
    Reviewed-on: https://gerrit.libreoffice.org/28728
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf81345.docx b/sw/qa/extras/ooxmlexport/data/tdf81345.docx
new file mode 100644
index 0000000..4f18b1e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf81345.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index b837ae2..5da3ee2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -998,6 +998,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92724_continuousBreaksComplex,"tdf92724_continuo
     CPPUNIT_ASSERT_EQUAL(sal_Int16(3), xCursor->getPage());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx")
+{
+    //Header wasn't replaced  and columns were missing because no new style was created.
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+    uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+
+    xCursor->jumpToPage(2);
+    OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+    CPPUNIT_ASSERT(pageStyleName != "Standard");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index b138a28..c0e646c 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1170,9 +1170,12 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
     }
 
     // depending on the break type no page styles should be created
-    // If the section type is missing, but we have columns, then this should be
+    // If the section type is missing, but we have columns without new style info, then this should be
     // handled as a continuous section break.
-    if(m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) || (m_nBreakType == -1 && m_nColumnCount > 0))
+    const bool bTreatAsContinuous = m_nBreakType == -1
+                                    && m_nColumnCount > 0
+                                    && (m_bIsFirstSection || m_sFollowPageStyleName.isEmpty() || (m_sFirstPageStyleName.isEmpty() && m_bTitlePage));
+    if(m_nBreakType == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous) || bTreatAsContinuous)
     {
         //todo: insert a section or access the already inserted section
         uno::Reference< beans::XPropertySet > xSection =


More information about the Libreoffice-commits mailing list