[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 13 09:54:46 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               |    2 ++
 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                |    3 +++
 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, 52 insertions(+), 10 deletions(-)

New commits:
commit d1c16eb7e971af0d24a230f3a393694cef0a20a1
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 9 16:03:44 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Aug 13 11:54:06 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.
    
    Reviewed-on: https://gerrit.libreoffice.org/77340
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit f3c60c60d03947961d893e23c0e4baf20fb0107b)
    
    Change-Id: I829c1e7a92434f93d56e3c88a4ba4a55bab818d4
    Reviewed-on: https://gerrit.libreoffice.org/77343
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Tested-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index ec8f19f291a4..b87aa5e6c9e9 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 10987aa164f6..03147b9a6b12 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 680031e23916..eec983c0c71a 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 fbf5fb8ae821..010a65e2d51e 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"
@@ -125,7 +126,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 436e89330c16..b1eb8d954f69 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -100,8 +100,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);
@@ -448,7 +450,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 11d332f5187e..782a2ead4ee2 100755
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -109,6 +109,8 @@
 #include <swtable.hxx>
 
 #include <comphelper/string.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 b720d9936a45..1b2ff0e733ce 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 912fac09204f..30e1ff3da845 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1317,7 +1317,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();
@@ -1411,7 +1411,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 );
 
@@ -1775,6 +1777,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();
@@ -1902,7 +1905,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
             {
@@ -1922,7 +1925,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 )
@@ -1958,6 +1961,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 f3b80311c52f..fe2f481d3f55 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -27,6 +27,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 937f90246480..3813231511a0 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 e085f98a262c..db4a60981a9e 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -44,6 +44,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 68a8a422cbc7..0baff6b64f87 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 800e6c18fd64..1534db42a239 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -59,6 +59,9 @@
 #include <DocumentSettingManager.hxx>
 #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 e9ff14b753a6..162cd50284ba 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 1420852f05b4..b1b5fe50bc70 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 84dd5808a4b6..8ba8ab621b2f 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 ecdfeec6cff2..4c342564be2a 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 cae759185a0b..90a4261fbd7d 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -709,7 +709,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 )
@@ -737,11 +738,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 dcaf2047ed3a..c90e91bafaf1 100755
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -278,7 +278,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