sc/inc/column.hxx                            |    1 
 sc/inc/dociter.hxx                           |   25 ++++
 sc/inc/document.hxx                          |    1 
 sc/inc/table.hxx                             |    1 
 sc/source/core/data/dociter.cxx              |  140 +++++++++++++++++++++++++++
 sc/source/core/tool/interpr1.cxx             |   12 --
 sw/qa/extras/ooxmlexport/data/tdf128889.fodt |   15 ++
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   11 ++
 sw/source/filter/ww8/attributeoutputbase.hxx |    3 
 sw/source/filter/ww8/docxattributeoutput.cxx |   21 +++-
 sw/source/filter/ww8/docxattributeoutput.hxx |    6 -
 sw/source/filter/ww8/docxexport.cxx          |    4 
 sw/source/filter/ww8/rtfattributeoutput.cxx  |    3 
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    3 
 sw/source/filter/ww8/rtfexport.cxx           |    4 
 sw/source/filter/ww8/ww8atr.cxx              |    8 -
 sw/source/filter/ww8/ww8attributeoutput.hxx  |    2 
 17 files changed, 233 insertions(+), 27 deletions(-)

New commits:
commit e073f996c4ec2582b9560e2fac828c9a73358423
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Nov 20 13:46:49 2019 +0200
Commit:     Xisco Faulí <xiscofa...@libreoffice.org>
CommitDate: Wed Nov 20 23:47:18 2019 +0100

    tdf#128812 speed up loading calc doc with lots of countif
    
    by creating a copy of ScQueryCellIterator that is specialised for this
    use-case.
    Takes the opening time from 50s to 8s on my machine.
    
    Change-Id: I193a7c181a5dfed6fecf75e871729d73625d0df6
    Reviewed-on: https://gerrit.libreoffice.org/83299
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit d468958331f36310d11265ba55d7c27366ab58ab)
    Reviewed-on: https://gerrit.libreoffice.org/83316
    Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org>

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 18cf3de6231f..74fa4e8b37f9 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -141,6 +141,7 @@ friend class ScValueIterator;
 friend class ScHorizontalValueIterator;
 friend class ScDBQueryDataIterator;
 friend class ScQueryCellIterator;
+friend class ScCountIfCellIterator;
 friend class ScFormulaGroupIterator;
 friend class ScCellIterator;
 friend class ScHorizontalCellIterator;
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index a6a8d370270b..3479ee67ca08 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -367,6 +367,31 @@ public:
     bool            FindEqualOrSortedLastInRange( SCCOL& nFoundCol, SCROW& 
nFoundRow );
 };
 
+// Used by ScInterpreter::ScCountIf.
+// Walk through all non-empty cells in an area.
+class ScCountIfCellIterator
+{
+    typedef sc::CellStoreType::const_position_type PositionType;
+    PositionType    maCurPos;
+    ScQueryParam    maParam;
+    ScDocument*     pDoc;
+    const ScInterpreterContext& mrContext;
+    SCTAB           nTab;
+    SCCOL           nCol;
+    SCROW           nRow;
+
+    /** Initialize position for new column. */
+    void            InitPos();
+    void            IncPos();
+    void            IncBlock();
+    void            AdvanceQueryParamEntryField();
+
+public:
+                    ScCountIfCellIterator(ScDocument* pDocument, const 
ScInterpreterContext& rContext, SCTAB nTable,
+                                        const ScQueryParam& aParam);
+    int             GetCount();
+};
+
 class ScDocAttrIterator             // all attribute areas
 {
 private:
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 6b3f8f6ecbb3..758bd4c4b0d0 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -316,6 +316,7 @@ friend class ScDBQueryDataIterator;
 friend class ScFormulaGroupIterator;
 friend class ScCellIterator;
 friend class ScQueryCellIterator;
+friend class ScCountIfCellIterator;
 friend class ScHorizontalCellIterator;
 friend class ScHorizontalAttrIterator;
 friend class ScDocAttrIterator;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 91063a82481e..bf97930109b7 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -250,6 +250,7 @@ friend class ScDBQueryDataIterator;
 friend class ScFormulaGroupIterator;
 friend class ScCellIterator;
 friend class ScQueryCellIterator;
+friend class ScCountIfCellIterator;
 friend class ScHorizontalCellIterator;
 friend class ScHorizontalAttrIterator;
 friend class ScDocAttrIterator;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 3c8e369a575a..919c41c783e5 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1449,6 +1449,146 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( 
SCCOL& nFoundCol,
     return (nFoundCol <= pDoc->MaxCol()) && (nFoundRow <= pDoc->MaxRow());
 }
 
+ScCountIfCellIterator::ScCountIfCellIterator(ScDocument* pDocument, const 
ScInterpreterContext& rContext, SCTAB nTable,
+             const ScQueryParam& rParam ) :
+    maParam(rParam),
+    pDoc( pDocument ),
+    mrContext( rContext ),
+    nTab( nTable)
+{
+    nCol = maParam.nCol1;
+    nRow = maParam.nRow1;
+}
+
+void ScCountIfCellIterator::InitPos()
+{
+    nRow = maParam.nRow1;
+    if (maParam.bHasHeader && maParam.bByRow)
+        ++nRow;
+    ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+    maCurPos = pCol->maCells.position(nRow);
+}
+
+void ScCountIfCellIterator::IncPos()
+{
+    if (maCurPos.second + 1 < maCurPos.first->size)
+    {
+        // Move within the same block.
+        ++maCurPos.second;
+        ++nRow;
+    }
+    else
+        // Move to the next block.
+        IncBlock();
+}
+
+void ScCountIfCellIterator::IncBlock()
+{
+    ++maCurPos.first;
+    maCurPos.second = 0;
+
+    nRow = maCurPos.first->position;
+}
+
+int ScCountIfCellIterator::GetCount()
+{
+    assert(nTab < pDoc->GetTableCount() && "try to access index out of bounds, 
FIX IT");
+    nCol = maParam.nCol1;
+    InitPos();
+
+    const ScQueryEntry& rEntry = maParam.GetEntry(0);
+    const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
+    const bool bSingleQueryItem = rEntry.GetQueryItems().size() == 1;
+    int count = 0;
+
+    ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+    while (true)
+    {
+        bool bNextColumn = maCurPos.first == pCol->maCells.end();
+        if (!bNextColumn)
+        {
+            if (nRow > maParam.nRow2)
+                bNextColumn = true;
+        }
+
+        if (bNextColumn)
+        {
+            do
+            {
+                ++nCol;
+                if (nCol > maParam.nCol2 || nCol >= 
pDoc->maTabs[nTab]->GetAllocatedColumnsCount())
+                    return count; // Over and out
+                AdvanceQueryParamEntryField();
+                pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
+            }
+            while (!rItem.mbMatchEmpty && pCol->IsEmptyData());
+
+            InitPos();
+        }
+
+        if (maCurPos.first->type == sc::element_type_empty)
+        {
+            if (rItem.mbMatchEmpty && bSingleQueryItem)
+            {
+                // This shortcut, instead of determining if any SC_OR query
+                // exists or this query is SC_AND'ed (which wouldn't make
+                // sense, but..) and evaluating them in ValidQuery(), is
+                // possible only because the interpreter is the only caller
+                // that sets mbMatchEmpty and there is only one item in those
+                // cases.
+                // XXX this would have to be reworked if other filters used it
+                // in different manners and evaluation would have to be done in
+                // ValidQuery().
+                count++;
+                IncPos();
+                continue;
+            }
+            else
+            {
+                IncBlock();
+                continue;
+            }
+        }
+
+        ScRefCellValue aCell = sc::toRefCell(maCurPos.first, maCurPos.second);
+
+        if ( pDoc->maTabs[nTab]->ValidQuery( nRow, maParam,
+                (nCol == static_cast<SCCOL>(rEntry.nField) ? &aCell : nullptr),
+                nullptr,
+                &mrContext) )
+        {
+            if (aCell.isEmpty())
+                return count;
+            count++;
+            IncPos();
+            continue;
+        }
+        else
+            IncPos();
+    }
+    return count;
+}
+
+void ScCountIfCellIterator::AdvanceQueryParamEntryField()
+{
+    SCSIZE nEntries = maParam.GetEntryCount();
+    for ( SCSIZE j = 0; j < nEntries; j++  )
+    {
+        ScQueryEntry& rEntry = maParam.GetEntry( j );
+        if ( rEntry.bDoQuery )
+        {
+            if ( rEntry.nField < pDoc->MaxCol() )
+                rEntry.nField++;
+            else
+            {
+                OSL_FAIL( "AdvanceQueryParamEntryField: ++rEntry.nField > 
MAXCOL" );
+            }
+        }
+        else
+            break;  // for
+    }
+}
+
 namespace {
 
 /**
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 151247180655..9069138c3013 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5810,16 +5810,8 @@ void ScInterpreter::ScCountIf()
                 }
                 else
                 {
-                    ScQueryCellIterator aCellIter(pDok, mrContext, nTab1, 
rParam, false);
-                    // Keep Entry.nField in iterator on column change
-                    aCellIter.SetAdvanceQueryParamEntryField( true );
-                    if ( aCellIter.GetFirst() )
-                    {
-                        do
-                        {
-                            fCount++;
-                        } while ( aCellIter.GetNext() );
-                    }
+                    ScCountIfCellIterator aCellIter(pDok, mrContext, nTab1, 
rParam);
+                    fCount += aCellIter.GetCount();
                 }
             }
             else
commit 8e3fa597679a6402bd6d74e2ec25631ae686c423
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Nov 19 22:41:52 2019 +0300
Commit:     Xisco Faulí <xiscofa...@libreoffice.org>
CommitDate: Wed Nov 20 23:46:58 2019 +0100

    tdf#128889: don't write "page break after" into w:pPr
    
    This produced invalid OOXML, which Word considers as "page before",
    and LibreOffice ignores when re-importing.
    
    Make sure to write it as *trailing* w:r with w:br, as Word also does
    when imports ODT with this atribute, and saves as DOCX.
    
    Change-Id: Ifc4f45d65d4455ecb5cd62aed1ef6a03375c8aa4
    Reviewed-on: https://gerrit.libreoffice.org/83232
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit b0e7e494b6bc69d3833c0a6c256ff8106a4a24cb)
    Reviewed-on: https://gerrit.libreoffice.org/83334
    Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf128889.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf128889.fodt
new file mode 100644
index 000000000000..6dc1c4202696
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf128889.fodt
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:paragraph-properties fo:break-after="page"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:body>
+  <office:text>
+   <text:p text:style-name="P1">para1</text:p>
+   <text:p>para2</text:p>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c8c95d1cd132..3e542dc72fcf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -168,6 +168,17 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128820, 
"tdf128820.fodt")
                 "a:graphic/a:graphicData/wpg:wgp/wps:wsp");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128889, "tdf128889.fodt")
+{
+    xmlDocPtr pXml = parseExport("word/document.xml");
+    CPPUNIT_ASSERT(pXml);
+    // There was an w:r (with w:br) as an invalid child of first paragraph's 
w:pPr
+    assertXPath(pXml, "/w:document/w:body/w:p[1]/w:pPr/w:r", 0);
+    assertXPath(pXml, "/w:document/w:body/w:p[1]/w:r", 2);
+    // Check that the break is in proper - last - position
+    assertXPath(pXml, "/w:document/w:body/w:p[1]/w:r[2]/w:br", "type", "page");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx 
b/sw/source/filter/ww8/attributeoutputbase.hxx
index 74084f625590..70509ed47806 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -299,7 +299,8 @@ public:
 
     /// Write a section break
     /// msword::ColumnBreak or msword::PageBreak
-    virtual void SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectionInfo = 
nullptr ) = 0;
+    /// bBreakAfter: the break must be scheduled for insertion in the end of 
current paragraph
+    virtual void SectionBreak( sal_uInt8 nC, bool bBreakAfter, const 
WW8_SepInfo* pSectionInfo = nullptr ) = 0;
 
     // preserve page vertical alignment
     virtual void TextVerticalAdjustment( const 
css::drawing::TextVerticalAdjust) {};
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3c2c614bf096..4f18582b0d7f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -745,6 +745,13 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
         m_bStartedCharSdt = false;
     }
 
+    if (m_bPageBreakAfter)
+    {
+        // tdf#128889 Trailing page break
+        SectionBreak(msword::PageBreak, false);
+        m_bPageBreakAfter = false;
+    }
+
     m_pSerializer->endElementNS( XML_w, XML_p );
     // on export sdt blocks are never nested ATM
     if( !m_bAnchorLinkedToNode && !m_bStartedParaSdt )
@@ -5981,7 +5988,7 @@ void DocxAttributeOutput::PageBreakBefore( bool bBreak )
                 FSNS( XML_w, XML_val ), "false" );
 }
 
-void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* 
pSectionInfo )
+void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, bool bBreakAfter, const 
WW8_SepInfo* pSectionInfo )
 {
     switch ( nC )
     {
@@ -6043,9 +6050,15 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, 
const WW8_SepInfo* pSectio
             }
             else if ( m_bParagraphOpened )
             {
-                m_pSerializer->startElementNS(XML_w, XML_r);
-                m_pSerializer->singleElementNS(XML_w, XML_br, FSNS(XML_w, 
XML_type), "page");
-                m_pSerializer->endElementNS( XML_w, XML_r );
+                if (bBreakAfter)
+                    // tdf#128889
+                    m_bPageBreakAfter = true;
+                else
+                {
+                    m_pSerializer->startElementNS(XML_w, XML_r);
+                    m_pSerializer->singleElementNS(XML_w, XML_br, FSNS(XML_w, 
XML_type), "page");
+                    m_pSerializer->endElementNS(XML_w, XML_r);
+                }
             }
             else
                 m_bPostponedPageBreak = true;
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 2a8a43a76a79..67561087ceb3 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -270,7 +270,8 @@ public:
 
     /// Write a section break
     /// msword::ColumnBreak or msword::PageBreak
-    virtual void SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectionInfo = 
nullptr ) override;
+    /// bBreakAfter: the break must be scheduled for insertion in the end of 
current paragraph
+    virtual void SectionBreak( sal_uInt8 nC, bool bBreakAfter, const 
WW8_SepInfo* pSectionInfo = nullptr ) override;
 
     // preserve DOCX page vertical alignment
     virtual void TextVerticalAdjustment( const 
css::drawing::TextVerticalAdjust ) override;
@@ -841,6 +842,9 @@ private:
     // beginning of the next paragraph
     bool m_bPostponedPageBreak;
 
+    // This paragraph must end with page break
+    bool m_bPageBreakAfter = false;
+
     std::vector<ww8::Frame> m_aFramesOfParagraph;
     std::set<const SwFrameFormat*> m_aFloatingTablesOfParagraph;
     sal_Int32 m_nTextFrameLevel;
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index c6226fd130ab..3e9c4bc5fd1b 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -547,7 +547,7 @@ ErrCode DocxExport::ExportDocument_Impl()
 
 void DocxExport::AppendSection( const SwPageDesc *pPageDesc, const 
SwSectionFormat* pFormat, sal_uLong nLnNum )
 {
-    AttrOutput().SectionBreak( msword::PageBreak, 
m_pSections->CurrentSectionInfo() );
+    AttrOutput().SectionBreak( msword::PageBreak, false, 
m_pSections->CurrentSectionInfo() );
     m_pSections->AppendSection( pPageDesc, pFormat, nLnNum, 
m_pAttrOutput->IsFirstParagraph() );
 }
 
@@ -622,7 +622,7 @@ void DocxExport::PrepareNewPageDesc( const SfxItemSet* pSet,
 {
     // tell the attribute output that we are ready to write the section
     // break [has to be output inside paragraph properties]
-    AttrOutput().SectionBreak( msword::PageBreak, 
m_pSections->CurrentSectionInfo() );
+    AttrOutput().SectionBreak( msword::PageBreak, false, 
m_pSections->CurrentSectionInfo() );
 
     const SwSectionFormat* pFormat = GetSectionFormat( rNd );
     const sal_uLong nLnNm = GetSectionLineNo( pSet, rNd );
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 67622810d0db..6a04e707a706 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1200,7 +1200,8 @@ void RtfAttributeOutput::PageBreakBefore(bool bBreak)
     }
 }
 
-void RtfAttributeOutput::SectionBreak(sal_uInt8 nC, const WW8_SepInfo* 
pSectionInfo)
+void RtfAttributeOutput::SectionBreak(sal_uInt8 nC, bool /*bBreakAfter*/,
+                                      const WW8_SepInfo* pSectionInfo)
 {
     switch (nC)
     {
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx 
b/sw/source/filter/ww8/rtfattributeoutput.hxx
index fe0d093ae0a3..4ea8b3845bcd 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -165,7 +165,8 @@ public:
 
     /// Write a section break
     /// msword::ColumnBreak or msword::PageBreak
-    void SectionBreak(sal_uInt8 nC, const WW8_SepInfo* pSectionInfo = nullptr) 
override;
+    void SectionBreak(sal_uInt8 nC, bool bBreakAfter,
+                      const WW8_SepInfo* pSectionInfo = nullptr) override;
 
     /// Start of the section properties.
     void StartSection() override;
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 787833bbac71..f29268032ed0 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -970,7 +970,7 @@ void RtfExport::PrepareNewPageDesc(const SfxItemSet* pSet, 
const SwNode& rNd,
     // Don't insert a page break, when we're changing page style just because 
the next page has to be a different one.
     if (!m_pAttrOutput->GetPrevPageDesc()
         || m_pAttrOutput->GetPrevPageDesc()->GetFollow() != pNewPgDesc)
-        AttrOutput().SectionBreak(msword::PageBreak, 
m_pSections->CurrentSectionInfo());
+        AttrOutput().SectionBreak(msword::PageBreak, false, 
m_pSections->CurrentSectionInfo());
 }
 
 bool RtfExport::DisallowInheritingOutlineNumbering(const SwFormat& rFormat)
@@ -1026,7 +1026,7 @@ void RtfExport::AppendSection(const SwPageDesc* 
pPageDesc, const SwSectionFormat
                               sal_uLong nLnNum)
 {
     m_pSections->AppendSection(pPageDesc, pFormat, nLnNum);
-    AttrOutput().SectionBreak(msword::PageBreak, 
m_pSections->CurrentSectionInfo());
+    AttrOutput().SectionBreak(msword::PageBreak, false, 
m_pSections->CurrentSectionInfo());
 }
 
 RtfExport::RtfExport(RtfExportFilter* pFilter, SwDoc* pDocument,
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index b72a0246bf21..f4525e09b663 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2191,7 +2191,7 @@ void AttributeOutputBase::StartTOX( const SwSection& 
rSect )
                             SwSection *pParent = rSect.GetParent();
                             WW8_SepInfo rInfo(&GetExport( 
).m_pDoc->GetPageDesc(0),
                                 pParent ? pParent->GetFormat() : nullptr, 
0/*nRstLnNum*/);
-                            GetExport( ).AttrOutput().SectionBreak( 
msword::PageBreak, &rInfo );
+                            GetExport( ).AttrOutput().SectionBreak( 
msword::PageBreak, false, &rInfo );
                         }
 
                         sStr += "\\c \"" + OUString::number( nCol ) + "\"";
@@ -2499,7 +2499,7 @@ void AttributeOutputBase::EndTOX( const SwSection& 
rSect,bool bCareEnd )
             if ( 0 < nCol )
             {
                 WW8_SepInfo rInfo( &GetExport( ).m_pDoc->GetPageDesc( 0 ), 
rSect.GetFormat(), 0/*nRstLnNum*/ );
-                GetExport( ).AttrOutput().SectionBreak( msword::PageBreak, 
&rInfo );
+                GetExport( ).AttrOutput().SectionBreak( msword::PageBreak, 
false, &rInfo );
             }
         }
     }
@@ -3880,13 +3880,13 @@ void AttributeOutputBase::FormatBreak( const 
SvxFormatBreakItem& rBreak )
             }
             if ( !bFollowPageDescWritten )
             {
-                SectionBreak( nC );
+                SectionBreak(nC, !bBefore);
             }
         }
     }
 }
 
-void WW8AttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* 
/*pSectionInfo*/ )
+void WW8AttributeOutput::SectionBreak( sal_uInt8 nC, bool /*bBreakAfter*/, 
const WW8_SepInfo* /*pSectionInfo*/ )
 {
     m_rWW8Export.ReplaceCr( nC );
 }
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx 
b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 35d8db7dfa5e..7e3f2a31ff20 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -147,7 +147,7 @@ public:
 
     /// Write a section break
     /// msword::ColumnBreak or msword::PageBreak
-    virtual void SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectionInfo = 
nullptr ) override;
+    virtual void SectionBreak( sal_uInt8 nC, bool bBreakAfter, const 
WW8_SepInfo* pSectionInfo = nullptr ) override;
 
     // preserve DOC page vertical alignment
     virtual void TextVerticalAdjustment( const 
css::drawing::TextVerticalAdjust ) override;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to