[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 30 08:39:14 UTC 2019


 sw/source/core/doc/DocumentRedlineManager.cxx   |    1 +
 sw/source/core/fields/docufld.cxx               |    2 ++
 sw/source/core/frmedt/feshview.cxx              |    1 +
 sw/source/core/inc/flowfrm.hxx                  |    4 +++-
 sw/source/core/inc/frmtool.hxx                  |    3 ++-
 sw/source/core/inc/txtfrm.hxx                   |    4 +++-
 sw/source/core/layout/anchoredobject.cxx        |    1 +
 sw/source/core/layout/dbg_lay.cxx               |    1 +
 sw/source/core/layout/findfrm.cxx               |    1 +
 sw/source/core/layout/frmtool.cxx               |   12 ++++++++----
 sw/source/core/layout/pagechg.cxx               |    1 +
 sw/source/core/layout/paintfrm.cxx              |    2 ++
 sw/source/core/layout/sectfrm.cxx               |    2 ++
 sw/source/core/layout/ssfrm.cxx                 |    1 +
 sw/source/core/layout/tabfrm.cxx                |    2 ++
 sw/source/core/layout/trvlfrm.cxx               |    2 ++
 sw/source/core/layout/wsfrm.cxx                 |    2 ++
 sw/source/core/text/EnhancedPDFExportHelper.cxx |    1 +
 sw/source/core/text/porfld.hxx                  |    2 ++
 sw/source/core/text/txtfrm.cxx                  |   11 +++++++++--
 sw/source/core/tox/ToxTabStopTokenHandler.cxx   |    2 ++
 sw/source/core/txtnode/ndtxt.cxx                |    2 +-
 22 files changed, 50 insertions(+), 10 deletions(-)

New commits:
commit d8d2340a2ee130852d3be1d8330e6e7a720f999a
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 9 16:03:44 2019 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Aug 30 10:38:09 2019 +0200

    tdf#126627 sw_redlinehide: fix corner case in SwUndoDelete::UndoImpl()
    
    The assumption that the merge by the moved nodes would be sufficient to
    handle the end node's frames is wrong: the MakeFrames() uses
    FrameMode::New, so the frames on the end node are not deleted, even if a
    previous node is merged with the end node, so the end node has 2 frames
    in the same layout, which will cause all sorts of problems.
    
    Ensure that the ::MakeFrames() that is called from SwUndoDelete will
    *once* use FrameMode::Existing, which will delete the existing frames on
    the end node *iff* it is merged.  Subsequent SwTextNode::MakeFrames()
    calls on the nodes must use FrameMode::New of course, to prevent
    deleting the newly created frames immediately.
    
    Hopefully the SwUndoDelete is the only caller of MakeFrames() that will
    run into this corner case, as the others typically operate on a
    nodes-array section...
    
    (regression from 723728cd358693b8f4bc9d913541aa4479f2bd48)
    
    Reviewed-on: https://gerrit.libreoffice.org/77211
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit f6a7dee56c984f36261c75a1056cc3a5bf43b2f1)
    Reviewed-on: https://gerrit.libreoffice.org/77220
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 4093811d1327e83edf216639d7b1173d8ebf7165)
    
    Backport needs some tweak to includes to avoid cyclic headers.
    
    Change-Id: I829c1e7a92434f93d56e3c88a4ba4a55bab818d4
    Reviewed-on: https://gerrit.libreoffice.org/77340
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-on: https://gerrit.libreoffice.org/77907
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index a46dc49db8ee..fc28e74798c7 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -23,6 +23,7 @@
 #include <doc.hxx>
 #include <docsh.hxx>
 #include <fmtfld.hxx>
+#include <frmtool.hxx>
 #include <IDocumentUndoRedo.hxx>
 #include <IDocumentFieldsAccess.hxx>
 #include <IDocumentLayoutAccess.hxx>
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index c6da204043ba..c5dce86e1eb8 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -45,6 +45,8 @@
 #include <unotools/useroptions.hxx>
 #include <unotools/syslocale.hxx>
 #include <svl/zforlist.hxx>
+#include <libxml/xmlstring.h>
+#include <libxml/xmlwriter.h>
 
 #include <tools/time.hxx>
 #include <tools/datetime.hxx>
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index d3fa9b126e86..69bfd77ca14e 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -54,6 +54,7 @@
 #include <textboxhelper.hxx>
 #include <frmfmt.hxx>
 #include <frmatr.hxx>
+#include <frmtool.hxx>
 #include <fmtfsize.hxx>
 #include <fmtanchr.hxx>
 #include <fmtornt.hxx>
diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx
index 6f08a70bd39f..33e342851789 100644
--- a/sw/source/core/inc/flowfrm.hxx
+++ b/sw/source/core/inc/flowfrm.hxx
@@ -20,7 +20,9 @@
 #ifndef INCLUDED_SW_SOURCE_CORE_INC_FLOWFRM_HXX
 #define INCLUDED_SW_SOURCE_CORE_INC_FLOWFRM_HXX
 
-#include "frmtool.hxx"
+#include "frame.hxx"
+#include "layfrm.hxx"
+#include <swtypes.hxx>
 
 class SvxFormatKeepItem;
 class SvxFormatBreakItem;
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index a031d11ea136..eea90deeb271 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -23,6 +23,7 @@
 #include <swtypes.hxx>
 #include "layfrm.hxx"
 #include <frmatr.hxx>
+#include "txtfrm.hxx"
 #include "swcache.hxx"
 #include <editeng/lrspitem.hxx>
 #include "swfont.hxx"
@@ -126,7 +127,7 @@ void RestoreContent( SwFrame *pSav, SwLayoutFrame *pParent, SwFrame *pSibling );
 // Get ContentNodes, create ContentFrames, and add them to LayFrame.
 void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, sal_uLong nIndex,
                  bool bPages = false, sal_uLong nEndIndex = 0,
-                 SwFrame *pPrv = nullptr );
+                 SwFrame *pPrv = nullptr, sw::FrameMode eMode = sw::FrameMode::New);
 
 // Creation of frames for a specific section (uses InsertCnt_)
 void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 86882201fbfd..fb62037d151f 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -101,8 +101,10 @@ struct MergedPara;
 std::pair<SwTextNode*, sal_Int32> MapViewToModel(MergedPara const&, TextFrameIndex nIndex);
 TextFrameIndex MapModelToView(MergedPara const&, SwTextNode const* pNode, sal_Int32 nIndex);
 
+// warning: Existing must be used only once; a second use would delete the frame created by the first one...
 enum class FrameMode { New, Existing };
 std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, FrameMode eMode);
+SwTextFrame * MakeTextFrame(SwTextNode & rNode, SwFrame *, sw::FrameMode eMode);
 
 bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex);
 bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode);
@@ -450,7 +452,7 @@ public:
         { return const_cast<SwDoc &>(const_cast<SwTextFrame const*>(this)->GetDoc()); }
     SwDoc const& GetDoc() const;
 
-    SwTextFrame(SwTextNode * const, SwFrame* );
+    SwTextFrame(SwTextNode * const, SwFrame*, sw::FrameMode eMode);
 
     /**
      * SwContentFrame: the shortcut for the Frames
diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx
index dc2cd1326855..c6ebdc328096 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <txtfrm.hxx>
+#include <frmatr.hxx>
 #include <fmtornt.hxx>
 #include <doc.hxx>
 #include <IDocumentSettingAccess.hxx>
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index b3c346e81a6d..2b4d3a3f80f1 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -108,6 +108,7 @@
 #include <frame.hxx>
 #include <swtable.hxx>
 #include <sal/log.hxx>
+#include <tools/stream.hxx>
 
 PROT SwProtocol::nRecord = PROT::FileInit;
 SwImplProtocol* SwProtocol::pImpl = nullptr;
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 849457f2b3ea..3fd4fbee207f 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -25,6 +25,7 @@
 #include <notxtfrm.hxx>
 #include <tabfrm.hxx>
 #include <sectfrm.hxx>
+#include <frmatr.hxx>
 #include <flyfrms.hxx>
 #include <ftnfrm.hxx>
 #include <txtftn.hxx>
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 98918af9b5f6..c532c291788c 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1318,7 +1318,7 @@ static void lcl_SetPos( SwFrame&             _rNewFrame,
 
 void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
                              sal_uLong nIndex, bool bPages, sal_uLong nEndIndex,
-                             SwFrame *pPrv )
+                             SwFrame *pPrv, sw::FrameMode const eMode )
 {
     pDoc->getIDocumentTimerAccess().BlockIdling();
     SwRootFrame* pLayout = pLay->getRootFrame();
@@ -1412,7 +1412,9 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
                 }
                 continue; // skip it
             }
-            pFrame = pNode->MakeFrame(pLay);
+            pFrame = pNode->IsTextNode()
+                        ? sw::MakeTextFrame(*pNode->GetTextNode(), pLay, eMode)
+                        : pNode->MakeFrame(pLay);
             if( pPageMaker )
                 pPageMaker->CheckInsert( nIndex );
 
@@ -1776,6 +1778,7 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
         bool bApres = aTmp < rSttIdx;
         SwNode2Layout aNode2Layout( *pNd, rSttIdx.GetIndex() );
         SwFrame* pFrame;
+        sw::FrameMode eMode = sw::FrameMode::Existing;
         while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
         {
             SwLayoutFrame *pUpper = pFrame->GetUpper();
@@ -1903,7 +1906,7 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
                         pTmp->UnlockJoin();
                 }
                 ::InsertCnt_( pUpper, pDoc, rSttIdx.GetIndex(),
-                              pFrame->IsInDocBody(), nEndIdx, pPrev );
+                              pFrame->IsInDocBody(), nEndIdx, pPrev, eMode );
             }
             else
             {
@@ -1923,7 +1926,7 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
                     bSplit = false;
 
                 ::InsertCnt_( pUpper, pDoc, rSttIdx.GetIndex(), false,
-                              nEndIdx, pPrv );
+                              nEndIdx, pPrv, eMode );
                 // OD 23.06.2003 #108784# - correction: append objects doesn't
                 // depend on value of <bAllowMove>
                 if( !bDontCreateObjects )
@@ -1959,6 +1962,7 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
                     SwFrame::DestroyFrame(pSct);
                 }
             }
+            eMode = sw::FrameMode::New; // use Existing only once!
         }
     }
 
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 83b169828fe1..3893d7063576 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -28,6 +28,7 @@
 #include <fmtornt.hxx>
 #include <fmtsrnd.hxx>
 #include <ftninfo.hxx>
+#include <frmtool.hxx>
 #include <tgrditem.hxx>
 #include <viewopt.hxx>
 #include <docsh.hxx>
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 5eec44333f69..480cf8ea8613 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -39,6 +39,8 @@
 #include <viewimp.hxx>
 #include <dflyobj.hxx>
 #include <flyfrm.hxx>
+#include <frmatr.hxx>
+#include <frmtool.hxx>
 #include <viewopt.hxx>
 #include <dview.hxx>
 #include <dcontact.hxx>
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 093d84d04f4e..06cb53f1d53c 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -45,6 +45,8 @@
 #include <flyfrms.hxx>
 #include <sortedobjs.hxx>
 #include <hints.hxx>
+#include <frmatr.hxx>
+#include <frmtool.hxx>
 
 namespace
 {
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index ab8ed0a8fb5a..a7ac040eb34e 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -32,6 +32,7 @@
 #include <viewimp.hxx>
 #include <sortedobjs.hxx>
 #include <hints.hxx>
+#include <frmtool.hxx>
 
     // No inline cause we need the function pointers
 long SwFrame::GetTopMargin() const
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 141bc7e296af..a379e71dbaed 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -60,6 +60,8 @@
 #include <docary.hxx>
 #include <o3tl/make_unique.hxx>
 #include <sal/log.hxx>
+#include <frmatr.hxx>
+#include <frmtool.hxx>
 
 using namespace ::com::sun::star;
 
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index f564f040552e..343b2c01b788 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -45,6 +45,8 @@
 #include <txatbase.hxx>
 #include <fmtfld.hxx>
 #include <fldbas.hxx>
+#include <frmatr.hxx>
+#include <frmtool.hxx>
 
 #include <cfloat>
 #include <swselectionlist.hxx>
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index efc07cc97ac5..b4bd2ba55d6f 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -54,6 +54,8 @@
 #include <dbg_lay.hxx>
 #include <editeng/frmdiritem.hxx>
 #include <sortedobjs.hxx>
+#include <frmatr.hxx>
+#include <frmtool.hxx>
 
 // RotateFlyFrame3
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index e4312738c5b2..4ad8d67964a2 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -74,6 +74,7 @@
 #include <SwNodeNum.hxx>
 #include <calbck.hxx>
 #include <stack>
+#include <frmtool.hxx>
 
 #include <tools/globname.hxx>
 #include <svx/svdobj.hxx>
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 973fc9146a6e..302722289654 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -20,8 +20,10 @@
 #define INCLUDED_SW_SOURCE_CORE_TEXT_PORFLD_HXX
 
 #include <swtypes.hxx>
+#include <swfont.hxx>
 #include "porexp.hxx"
 #include <fmtornt.hxx>
+#include <o3tl/enumarray.hxx>
 
 class SwFont;
 class SvxBrushItem;
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 10acbec02f5a..65288822e9bb 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -766,7 +766,8 @@ void SwTextFrame::Init()
     }
 }
 
-SwTextFrame::SwTextFrame(SwTextNode * const pNode, SwFrame* pSib )
+SwTextFrame::SwTextFrame(SwTextNode * const pNode, SwFrame* pSib,
+        sw::FrameMode const eMode)
     : SwContentFrame( pNode, pSib )
     , mnAllLines( 0 )
     , mnThisLines( 0 )
@@ -794,11 +795,17 @@ SwTextFrame::SwTextFrame(SwTextNode * const pNode, SwFrame* pSib )
     mnFrameType = SwFrameType::Txt;
     // note: this may call SwClientNotify if it's in a list so do it last
     // note: this may change this->pRegisteredIn to m_pMergedPara->listeners
-    m_pMergedPara = CheckParaRedlineMerge(*this, *pNode, sw::FrameMode::New);
+    m_pMergedPara = CheckParaRedlineMerge(*this, *pNode, eMode);
 }
 
 namespace sw {
 
+SwTextFrame * MakeTextFrame(SwTextNode & rNode, SwFrame *const pSibling,
+        sw::FrameMode const eMode)
+{
+    return new SwTextFrame(&rNode, pSibling, eMode);
+}
+
 void RemoveFootnotesForNode(
         SwRootFrame const& rLayout, SwTextNode const& rTextNode,
         std::vector<std::pair<sal_Int32, sal_Int32>> const*const pExtents)
diff --git a/sw/source/core/tox/ToxTabStopTokenHandler.cxx b/sw/source/core/tox/ToxTabStopTokenHandler.cxx
index 0efd0125a1e1..d45acc676c7f 100644
--- a/sw/source/core/tox/ToxTabStopTokenHandler.cxx
+++ b/sw/source/core/tox/ToxTabStopTokenHandler.cxx
@@ -11,11 +11,13 @@
 
 #include <editeng/tstpitem.hxx>
 #include <editeng/lrspitem.hxx>
+#include <editeng/boxitem.hxx>
 
 #include <cntfrm.hxx>
 #include <fmtfsize.hxx>
 #include <fmtpdsc.hxx>
 #include <frmfmt.hxx>
+#include <frmatr.hxx>
 #include <ndtxt.hxx>
 #include <pagedesc.hxx>
 #include <pagefrm.hxx>
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 1f804ebbe55e..3904e11699e6 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -279,7 +279,7 @@ void SwTextNode::FileLoadedInitHints()
 
 SwContentFrame *SwTextNode::MakeFrame( SwFrame* pSib )
 {
-    SwContentFrame *pFrame = new SwTextFrame( this, pSib );
+    SwContentFrame *pFrame = sw::MakeTextFrame(*this, pSib, sw::FrameMode::New);
     return pFrame;
 }
 


More information about the Libreoffice-commits mailing list