[Libreoffice-commits] core.git: compilerplugins/clang solenv/clang-format sw/inc sw/source

Michael Stahl mstahl at redhat.com
Thu Jan 4 11:14:36 UTC 2018


 compilerplugins/clang/badstatics.cxx |    4 -
 solenv/clang-format/blacklist        |    1 
 sw/inc/fesh.hxx                      |   11 ++
 sw/inc/tabcol.hxx                    |   13 +++
 sw/source/core/bastyp/init.cxx       |    2 
 sw/source/core/docnode/ndtbl.cxx     |   12 +--
 sw/source/core/docnode/ndtbl1.cxx    |    5 -
 sw/source/core/edit/edtab.cxx        |    4 -
 sw/source/core/frmedt/fetab.cxx      |  130 ++++++++++++++++++-----------------
 sw/source/core/frmedt/fews.cxx       |    1 
 sw/source/core/inc/fetab.hxx         |   28 -------
 sw/source/core/layout/tabfrm.cxx     |   16 ----
 sw/source/core/undo/untbl.cxx        |   24 +++---
 13 files changed, 117 insertions(+), 134 deletions(-)

New commits:
commit 334601603aa04ea968e8a850f4e7f6cf52f7735b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jan 4 11:37:37 2018 +0100

    sw: move some globals in fetab.cxx into SwFEShell
    
    It looks like the main point of these being globals is so that they can
    be cleared from various places when tables or table frames are destroyed.
    
    Add a SwDoc parameter to ClearFEShellTabCols() and just iterate
    over all shells.
    
    Change-Id: I75ad6b695ee1bfa76b9a05c606b07a3574c70ac4

diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx
index bf3f4be4b66f..697a50c8f9b0 100644
--- a/compilerplugins/clang/badstatics.cxx
+++ b/compilerplugins/clang/badstatics.cxx
@@ -168,10 +168,6 @@ public:
                 || name == "s_pVout" // FrameFinit()
                 || name == "s_pPaintQueue" // SwPaintQueue::Remove()
                 || name == "gProp" // only owned (VclPtr) member cleared again
-                || name == "g_pColumnCacheLastTabFrame" // not owning
-                || name == "g_pColumnCacheLastCellFrame" // not owning
-                || name == "g_pRowCacheLastTabFrame" // not owning
-                || name == "g_pRowCacheLastCellFrame" // not owning
                 || name == "g_OszCtrl" // SwCrsrOszControl::Exit()
                 || name == "g_pSpellIter" // SwEditShell::SpellEnd()
                 || name == "g_pConvIter" // SwEditShell::SpellEnd()
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index cecc5025d84c..c5e56cefbf4f 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -15567,7 +15567,6 @@ sw/source/core/inc/dumpfilter.hxx
 sw/source/core/inc/dview.hxx
 sw/source/core/inc/environmentofanchoredobject.hxx
 sw/source/core/inc/fefly.hxx
-sw/source/core/inc/fetab.hxx
 sw/source/core/inc/fieldhint.hxx
 sw/source/core/inc/flowfrm.hxx
 sw/source/core/inc/flyfrm.hxx
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 5149bb478a27..3e5b719d5a9f 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -198,10 +198,13 @@ enum class SwTab
 };
 
 class SdrDropMarkerOverlay;
+struct SwColCache;
 
 class SW_DLLPUBLIC SwFEShell : public SwEditShell
 {
 private:
+    mutable std::unique_ptr<SwColCache> m_pColumnCache;
+    mutable std::unique_ptr<SwColCache> m_pRowCache;
     std::unique_ptr<SdrDropMarkerOverlay> m_pChainTo;
     std::unique_ptr<SdrDropMarkerOverlay> m_pChainFrom;
     bool m_bCheckForOLEInCaption;
@@ -223,8 +226,8 @@ private:
     SAL_DLLPRIVATE static sal_uInt16 GetCurColNum_( const SwFrame *pFrame,
                           SwGetCurColNumPara* pPara );
 
-    SAL_DLLPRIVATE static void GetTabCols_( SwTabCols &rToFill, const SwFrame *pBox );
-    SAL_DLLPRIVATE static void GetTabRows_( SwTabCols &rToFill, const SwFrame *pBox );
+    SAL_DLLPRIVATE void GetTabCols_(SwTabCols &rToFill, const SwFrame *pBox) const;
+    SAL_DLLPRIVATE void GetTabRows_(SwTabCols &rToFill, const SwFrame *pBox) const;
 
     SAL_DLLPRIVATE bool ImpEndCreate();
 
@@ -809,9 +812,11 @@ public:
 
     void ToggleHeaderFooterEdit( );
     static void SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj, sal_uInt16 nSlotId);
+
+    SAL_DLLPRIVATE void ClearColumnRowCache(SwTabFrame const*);
 };
 
-void ClearFEShellTabCols();
+void ClearFEShellTabCols(SwDoc & rDoc, SwTabFrame const*const pFrame);
 
 #endif
 
diff --git a/sw/inc/tabcol.hxx b/sw/inc/tabcol.hxx
index 07644cfecf36..51aa940b99aa 100644
--- a/sw/inc/tabcol.hxx
+++ b/sw/inc/tabcol.hxx
@@ -22,6 +22,8 @@
 #include <tools/solar.h>
 
 #include <vector>
+#include <memory>
+
 #include "swdllapi.h"
 
 struct SwTabColsEntry
@@ -87,6 +89,17 @@ public:
     void SetLastRowAllowedToChange( bool bNew ) { bLastRowAllowedToChange = bNew; }
 };
 
+class SwTable;
+class SwTabFrame;
+class SwFrame;
+
+struct SwColCache {
+    std::unique_ptr<SwTabCols> pLastCols;
+    SwTable const* pLastTable  = nullptr;
+    SwTabFrame const* pLastTabFrame = nullptr;
+    SwFrame const* pLastCellFrame = nullptr;
+};
+
 #endif // INCLUDED_SW_INC_TABCOL_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index a17a1d31b98c..399309fd6a88 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -735,8 +735,6 @@ void FinitCore()
         delete pHt;
     }
 
-    ::ClearFEShellTabCols();
-
     for (SvGlobalName* p : *pGlobalOLEExcludeList)
         delete p;
     delete pGlobalOLEExcludeList;
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index f84948b3c936..ceecdac0f0ac 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1740,7 +1740,7 @@ bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
         if (bRet)
         {
             getIDocumentState().SetModified();
-            ::ClearFEShellTabCols();
+            ::ClearFEShellTabCols(*this, nullptr);
             getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
         }
     }
@@ -1802,7 +1802,7 @@ bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
         if (bRet)
         {
             getIDocumentState().SetModified();
-            ::ClearFEShellTabCols();
+            ::ClearFEShellTabCols(*this, nullptr);
             getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
         }
     }
@@ -1965,7 +1965,7 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
     if( dynamic_cast<const SwDDETable*>( &pTableNd->GetTable() ) !=  nullptr)
         return false;
 
-    ::ClearFEShellTabCols();
+    ::ClearFEShellTabCols(*this, nullptr);
     SwSelBoxes aSelBoxes( rBoxes );
     SwTable &rTable = pTableNd->GetTable();
     long nMin = 0;
@@ -2333,7 +2333,7 @@ TableMergeErr SwDoc::MergeTable( SwPaM& rPam )
         rPam.GetPoint()->nNode = *pMergeBox->GetSttNd();
         rPam.Move();
 
-        ::ClearFEShellTabCols();
+        ::ClearFEShellTabCols(*this, nullptr);
         getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
     }
     GetIDocumentUndoRedo().EndUndo( SwUndoId::TABLE_MERGE, nullptr );
@@ -2864,7 +2864,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly,
 
     GetIDocumentUndoRedo().EndUndo( SwUndoId::TABLE_ATTR, nullptr );
 
-    ::ClearFEShellTabCols();
+    ::ClearFEShellTabCols(*this, nullptr);
 }
 
 /**
@@ -2879,7 +2879,7 @@ void SwDoc::SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rO
             new SwUndoAttrTable( *rTab.GetTableNode(), true ));
     }
     rTab.SetTabCols( rNew, rOld, pStart, bCurRowOnly );
-      ::ClearFEShellTabCols();
+      ::ClearFEShellTabCols(*this, nullptr);
     getIDocumentState().SetModified();
 }
 
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index dc1ef66cb7d5..f5c1d04fe1ee 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -808,9 +808,8 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
             pTableLayout->GetBrowseWidthByTabFrame( *pTabFrame ) );
     }
     SwTableFormatCmp::Delete( aFormatCmp );
-    ::ClearFEShellTabCols();
+    ::ClearFEShellTabCols(*this, nullptr);
     getIDocumentState().SetModified();
-
 }
 
 static void lcl_SetLineStyle( SvxBorderLine *pToSet,
@@ -902,7 +901,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
             pTableLayout->BordersChanged(
                 pTableLayout->GetBrowseWidthByTabFrame( *pTabFrame ) );
         }
-        ::ClearFEShellTabCols();
+        ::ClearFEShellTabCols(*this, nullptr);
         getIDocumentState().SetModified();
     }
 }
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index 83f91423c1e0..57440eec3bc9 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -436,7 +436,7 @@ bool SwEditShell::SplitTable( SplitTable_HeadlineOption eMode )
         bRet = GetDoc()->SplitTable( *pCursor->GetPoint(), eMode, true );
 
         GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
-        ClearFEShellTabCols();
+        ClearFEShellTabCols(*GetDoc(), nullptr);
         EndAllAction();
     }
     return bRet;
@@ -454,7 +454,7 @@ bool SwEditShell::MergeTable( bool bWithPrev )
         bRet = GetDoc()->MergeTable( *pCursor->GetPoint(), bWithPrev );
 
         GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
-        ClearFEShellTabCols();
+        ClearFEShellTabCols(*GetDoc(), nullptr);
         EndAllAction();
     }
     return bRet;
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 21003fe08206..8f3620e7c54c 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -29,7 +29,6 @@
 #include <editeng/brushitem.hxx>
 #include <editeng/frmdiritem.hxx>
 #include <svtools/ruler.hxx>
-#include <fetab.hxx>
 #include <swwait.hxx>
 #include <fmtfsize.hxx>
 #include <fmtornt.hxx>
@@ -73,18 +72,6 @@ using namespace ::com::sun::star;
 
 inline bool IsSame( long nA, long nB ) { return  std::abs(nA-nB) <= COLFUZZY; }
 
-// table column cache
-static SwTabCols *pLastCols   = nullptr;
-const SwTable   *g_pColumnCacheLastTable  = nullptr;
-const SwTabFrame  *g_pColumnCacheLastTabFrame = nullptr;
-const SwFrame     *g_pColumnCacheLastCellFrame = nullptr;
-
-// table row cache
-static SwTabCols *pLastRows   = nullptr;
-const SwTable   *g_pRowCacheLastTable  = nullptr;
-const SwTabFrame  *g_pRowCacheLastTabFrame = nullptr;
-const SwFrame     *g_pRowCacheLastCellFrame = nullptr;
-
 class TableWait
 {
     const std::unique_ptr<SwWait> m_pWait;
@@ -511,8 +498,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight )
         // now delete the columns
         bRet = GetDoc()->SplitTable( aBoxes, bVert, nCnt, bSameHeight );
 
-        DELETEZ( pLastCols );
-        DELETEZ( pLastRows );
+        ClearFEShellTabCols(*GetDoc(), nullptr);
     }
     else
         bRet = false;
@@ -520,13 +506,13 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight )
     return bRet;
 }
 
-void SwFEShell::GetTabCols_( SwTabCols &rToFill, const SwFrame *pBox )
+void SwFEShell::GetTabCols_(SwTabCols &rToFill, const SwFrame *pBox) const
 {
     const SwTabFrame *pTab = pBox->FindTabFrame();
-    if ( pLastCols )
+    if (m_pColumnCache)
     {
         bool bDel = true;
-        if (g_pColumnCacheLastTable == pTab->GetTable())
+        if (m_pColumnCache->pLastTable == pTab->GetTable())
         {
             bDel = false;
             SwRectFnSet aRectFnSet(pTab);
@@ -537,60 +523,61 @@ void SwFEShell::GetTabCols_( SwTabCols &rToFill, const SwFrame *pBox )
             const sal_uLong nRightMax = aRectFnSet.GetRight(pTab->getFrameArea()) -
                                     aRectFnSet.GetLeft(pPage->getFrameArea());
 
-            if (g_pColumnCacheLastTabFrame != pTab)
+            if (m_pColumnCache->pLastTabFrame != pTab)
             {
                 // if TabFrame was changed, we only shift a little bit
                 // as the width is the same
-                SwRectFnSet fnRectX(g_pColumnCacheLastTabFrame);
-                if (fnRectX.GetWidth(g_pColumnCacheLastTabFrame->getFrameArea()) ==
+                SwRectFnSet fnRectX(m_pColumnCache->pLastTabFrame);
+                if (fnRectX.GetWidth(m_pColumnCache->pLastTabFrame->getFrameArea()) ==
                     aRectFnSet.GetWidth(pTab->getFrameArea()) )
                 {
-                    pLastCols->SetLeftMin( nLeftMin );
+                    m_pColumnCache->pLastCols->SetLeftMin( nLeftMin );
 
-                    g_pColumnCacheLastTabFrame = pTab;
+                    m_pColumnCache->pLastTabFrame = pTab;
                 }
                 else
                     bDel = true;
             }
 
             if ( !bDel &&
-                 pLastCols->GetLeftMin () == (sal_uInt16)nLeftMin &&
-                 pLastCols->GetLeft    () == (sal_uInt16)aRectFnSet.GetLeft(pTab->getFramePrintArea()) &&
-                 pLastCols->GetRight   () == (sal_uInt16)aRectFnSet.GetRight(pTab->getFramePrintArea())&&
-                 pLastCols->GetRightMax() == (sal_uInt16)nRightMax - pLastCols->GetLeftMin() )
+                 m_pColumnCache->pLastCols->GetLeftMin () == (sal_uInt16)nLeftMin &&
+                 m_pColumnCache->pLastCols->GetLeft    () == (sal_uInt16)aRectFnSet.GetLeft(pTab->getFramePrintArea()) &&
+                 m_pColumnCache->pLastCols->GetRight   () == (sal_uInt16)aRectFnSet.GetRight(pTab->getFramePrintArea())&&
+                 m_pColumnCache->pLastCols->GetRightMax() == (sal_uInt16)nRightMax - m_pColumnCache->pLastCols->GetLeftMin() )
             {
-                if (g_pColumnCacheLastCellFrame != pBox)
+                if (m_pColumnCache->pLastCellFrame != pBox)
                 {
-                    pTab->GetTable()->GetTabCols( *pLastCols,
+                    pTab->GetTable()->GetTabCols( *m_pColumnCache->pLastCols,
                                         static_cast<const SwCellFrame*>(pBox)->GetTabBox(), true);
-                    g_pColumnCacheLastCellFrame = pBox;
+                    m_pColumnCache->pLastCellFrame = pBox;
                 }
-                rToFill = *pLastCols;
+                rToFill = *m_pColumnCache->pLastCols;
             }
             else
                 bDel = true;
         }
         if ( bDel )
-            DELETEZ(pLastCols);
+            m_pColumnCache.reset();
     }
-    if ( !pLastCols )
+    if (!m_pColumnCache)
     {
         SwDoc::GetTabCols( rToFill, static_cast<const SwCellFrame*>(pBox) );
 
-        pLastCols   = new SwTabCols( rToFill );
-        g_pColumnCacheLastTable  = pTab->GetTable();
-        g_pColumnCacheLastTabFrame = pTab;
-        g_pColumnCacheLastCellFrame= pBox;
+        m_pColumnCache.reset(new SwColCache);
+        m_pColumnCache->pLastCols.reset(new SwTabCols(rToFill));
+        m_pColumnCache->pLastTable = pTab->GetTable();
+        m_pColumnCache->pLastTabFrame = pTab;
+        m_pColumnCache->pLastCellFrame = pBox;
     }
 }
 
-void SwFEShell::GetTabRows_( SwTabCols &rToFill, const SwFrame *pBox )
+void SwFEShell::GetTabRows_(SwTabCols &rToFill, const SwFrame *pBox) const
 {
     const SwTabFrame *pTab = pBox->FindTabFrame();
-    if ( pLastRows )
+    if (m_pRowCache)
     {
         bool bDel = true;
-        if (g_pRowCacheLastTable == pTab->GetTable())
+        if (m_pRowCache->pLastTable == pTab->GetTable())
         {
             bDel = false;
             SwRectFnSet aRectFnSet(pTab);
@@ -602,31 +589,32 @@ void SwFEShell::GetTabRows_( SwTabCols &rToFill, const SwFrame *pBox )
             const long nRight    = aRectFnSet.GetHeight(pTab->getFramePrintArea());
             const long nRightMax = aRectFnSet.IsVert() ? nRight : LONG_MAX;
 
-            if (g_pRowCacheLastTabFrame != pTab || g_pRowCacheLastCellFrame != pBox)
+            if (m_pRowCache->pLastTabFrame != pTab || m_pRowCache->pLastCellFrame != pBox)
                 bDel = true;
 
             if ( !bDel &&
-                 pLastRows->GetLeftMin () == nLeftMin &&
-                 pLastRows->GetLeft    () == nLeft &&
-                 pLastRows->GetRight   () == nRight &&
-                 pLastRows->GetRightMax() == nRightMax )
+                 m_pRowCache->pLastCols->GetLeftMin () == nLeftMin &&
+                 m_pRowCache->pLastCols->GetLeft    () == nLeft &&
+                 m_pRowCache->pLastCols->GetRight   () == nRight &&
+                 m_pRowCache->pLastCols->GetRightMax() == nRightMax )
             {
-                rToFill = *pLastRows;
+                rToFill = *m_pRowCache->pLastCols;
             }
             else
                 bDel = true;
         }
         if ( bDel )
-            DELETEZ(pLastRows);
+            m_pRowCache.reset();
     }
-    if ( !pLastRows )
+    if (!m_pRowCache)
     {
         SwDoc::GetTabRows( rToFill, static_cast<const SwCellFrame*>(pBox) );
 
-        pLastRows   = new SwTabCols( rToFill );
-        g_pRowCacheLastTable = pTab->GetTable();
-        g_pRowCacheLastTabFrame = pTab;
-        g_pRowCacheLastCellFrame = pBox;
+        m_pRowCache.reset(new SwColCache);
+        m_pRowCache->pLastCols.reset(new SwTabCols(rToFill));
+        m_pRowCache->pLastTable = pTab->GetTable();
+        m_pRowCache->pLastTabFrame = pTab;
+        m_pRowCache->pLastCellFrame = pBox;
     }
 }
 
@@ -1250,8 +1238,7 @@ bool SwFEShell::UpdateTableStyleFormatting(SwTableNode *pTableNode,
         StartAllAction();
         bRet = GetDoc()->SetTableAutoFormat(
                 aBoxes, *pTableStyle, bResetDirect, pStyleName != nullptr);
-        DELETEZ( pLastCols );
-        DELETEZ( pLastRows );
+        ClearFEShellTabCols(*GetDoc(), nullptr);
         EndAllActionAndCall();
     }
     else
@@ -1320,8 +1307,7 @@ bool SwFEShell::DeleteTableSel()
 
         bRet = GetDoc()->DeleteRowCol( aBoxes );
 
-        DELETEZ( pLastCols );
-        DELETEZ( pLastRows );
+        ClearFEShellTabCols(*GetDoc(), nullptr);
     }
     else
         bRet = false;
@@ -2097,10 +2083,33 @@ size_t SwFEShell::GetCurMouseTabColNum( const Point &rPt ) const
     return nRet;
 }
 
-void ClearFEShellTabCols()
+void ClearFEShellTabCols(SwDoc & rDoc, SwTabFrame const*const pFrame)
+{
+    for (SwViewShell& rCurrentShell : rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()->GetRingContainer())
+    {
+        if (auto pFE = dynamic_cast<SwFEShell *>(&rCurrentShell))
+        {
+            pFE->ClearColumnRowCache(pFrame);
+        }
+    }
+}
+
+void SwFEShell::ClearColumnRowCache(SwTabFrame const*const pFrame)
 {
-    DELETEZ( pLastCols );
-    DELETEZ( pLastRows );
+    if (m_pColumnCache)
+    {
+        if (pFrame == nullptr || pFrame == m_pColumnCache->pLastTabFrame)
+        {
+            m_pColumnCache.reset();
+        }
+    }
+    if (m_pRowCache)
+    {
+        if (pFrame == nullptr || pFrame == m_pRowCache->pLastTabFrame)
+        {
+            m_pRowCache.reset();
+        }
+    }
 }
 
 void SwFEShell::GetTableAttr( SfxItemSet &rSet ) const
@@ -2225,8 +2234,7 @@ bool SwFEShell::SetColRowWidthHeight( TableChgWidthHeightType eType, sal_uInt16
                     *const_cast<SwTableBox*>(static_cast<SwCellFrame*>(pFrame)->GetTabBox()),
                     eType, nDiff, nLogDiff );
 
-    delete pLastCols;
-    pLastCols = nullptr;
+    ClearFEShellTabCols(*GetDoc(), nullptr);
     EndAllActionAndCall();
 
     if( bRet && (eType & (TableChgWidthHeightType::BiggerMode | TableChgWidthHeightType::InsertDeleteMode)) == TableChgWidthHeightType::InsertDeleteMode )
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 05f011bdb9de..cd29703ced3d 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -22,6 +22,7 @@
 #include <editeng/charhiddenitem.hxx>
 #include <init.hxx>
 #include <fesh.hxx>
+#include <tabcol.hxx>
 #include <pagefrm.hxx>
 #include <rootfrm.hxx>
 #include <cntfrm.hxx>
diff --git a/sw/source/core/inc/fetab.hxx b/sw/source/core/inc/fetab.hxx
deleted file mode 100644
index 02a205b09089..000000000000
--- a/sw/source/core/inc/fetab.hxx
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_SW_SOURCE_CORE_INC_FETAB_HXX
-#define INCLUDED_SW_SOURCE_CORE_INC_FETAB_HXX
-
-#include <sal/config.h>
-
-class SwFrame;
-class SwTabFrame;
-class SwTable;
-
-extern SwFrame const * g_pColumnCacheLastCellFrame;
-extern SwTabFrame const * g_pColumnCacheLastTabFrame;
-extern SwTable const * g_pColumnCacheLastTable;
-extern SwFrame const * g_pRowCacheLastCellFrame;
-extern SwTabFrame const * g_pRowCacheLastTabFrame;
-extern SwTable const * g_pRowCacheLastTable;
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 28b2b9934ea9..1f3024a77592 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -21,10 +21,10 @@
 #include <rootfrm.hxx>
 #include <IDocumentFieldsAccess.hxx>
 #include <viewimp.hxx>
+#include <fesh.hxx>
 #include <swtable.hxx>
 #include <dflyobj.hxx>
 #include <anchoreddrawobject.hxx>
-#include <fetab.hxx>
 #include <fmtanchr.hxx>
 #include <viewopt.hxx>
 #include <hints.hxx>
@@ -126,18 +126,8 @@ SwTabFrame::SwTabFrame( SwTabFrame &rTab )
 void SwTabFrame::DestroyImpl()
 {
     // There is some terrible code in fetab.cxx, that
-    // makes use of these global pointers. Obviously
-    // this code did not consider that a TabFrame can be
-    // deleted.
-    if (this == g_pColumnCacheLastTabFrame)
-    {
-        g_pColumnCacheLastTable  = nullptr;
-        g_pColumnCacheLastTabFrame = nullptr;
-        g_pColumnCacheLastCellFrame = nullptr;
-        g_pRowCacheLastTable  = nullptr;
-        g_pRowCacheLastTabFrame = nullptr;
-        g_pRowCacheLastCellFrame = nullptr;
-    }
+    // caches pointers to SwTabFrames.
+    ::ClearFEShellTabCols(*GetFormat()->GetDoc(), this);
 
     SwLayoutFrame::DestroyImpl();
 }
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 6cd5e2bb3b67..9a053f58e74d 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -510,7 +510,7 @@ void SwUndoTableToText::UndoImpl(::sw::UndoRedoContext & rContext)
     pPam->Exchange();
     pPam->Move( fnMoveBackward, GoInContent );
 
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(rDoc, nullptr);
 }
 
 // located in untbl.cxx and only an Undo object is allowed to call it
@@ -1383,7 +1383,9 @@ void SwUndoAttrTable::UndoImpl(::sw::UndoRedoContext & rContext)
     }
 
     if( bClearTabCol )
-        ClearFEShellTabCols();
+    {
+        ClearFEShellTabCols(rDoc, nullptr);
+    }
 }
 
 void SwUndoAttrTable::RedoImpl(::sw::UndoRedoContext & rContext)
@@ -1800,7 +1802,7 @@ void SwUndoTableNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
 
     if( IsDelBox() )
         nSttNode = pTableNd->GetIndex();
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(rDoc, nullptr);
     CHECK_TABLE( pTableNd->GetTable() )
 }
 
@@ -1918,7 +1920,7 @@ void SwUndoTableNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
     default:
         ;
     }
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(rDoc, nullptr);
     CHECK_TABLE( pTableNd->GetTable() )
 }
 
@@ -2081,7 +2083,7 @@ CHECKTABLE(pTableNd->GetTable())
     pPam->DeleteMark();
 
 CHECKTABLE(pTableNd->GetTable())
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(rDoc, nullptr);
 }
 
 void SwUndoTableMerge::RedoImpl(::sw::UndoRedoContext & rContext)
@@ -2956,7 +2958,7 @@ void SwUndoSplitTable::UndoImpl(::sw::UndoRedoContext & rContext)
         if( pTableNd )
             pTableNd->GetTable().RestoreRowSpan( *mpSaveRowSpan );
     }
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(*pDoc, nullptr);
 }
 
 void SwUndoSplitTable::RedoImpl(::sw::UndoRedoContext & rContext)
@@ -2968,7 +2970,7 @@ void SwUndoSplitTable::RedoImpl(::sw::UndoRedoContext & rContext)
     pPam->GetPoint()->nNode = nTableNode;
     pDoc->SplitTable( *pPam->GetPoint(), nMode, bCalcNewSize );
 
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(*pDoc, nullptr);
 }
 
 void SwUndoSplitTable::RepeatImpl(::sw::RepeatContext & rContext)
@@ -2977,7 +2979,7 @@ void SwUndoSplitTable::RepeatImpl(::sw::RepeatContext & rContext)
     SwDoc *const pDoc = & rContext.GetDoc();
 
     pDoc->SplitTable( *pPam->GetPoint(), nMode, bCalcNewSize );
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(*pDoc, nullptr);
 }
 
 void SwUndoSplitTable::SaveFormula( SwHistory& rHistory )
@@ -3068,7 +3070,7 @@ void SwUndoMergeTable::UndoImpl(::sw::UndoRedoContext & rContext)
     SwContentNode* pCNd = pDoc->GetNodes().GoNext( &rIdx );
     pPam->GetPoint()->nContent.Assign( pCNd, 0 );
 
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(*pDoc, nullptr);
 
     // TL_CHART2: need to inform chart of probably changed cell names
     SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider();
@@ -3093,7 +3095,7 @@ void SwUndoMergeTable::RedoImpl(::sw::UndoRedoContext & rContext)
 
     pDoc->MergeTable( *pPam->GetPoint(), bWithPrev, nMode );
 
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(*pDoc, nullptr);
 }
 
 void SwUndoMergeTable::RepeatImpl(::sw::RepeatContext & rContext)
@@ -3102,7 +3104,7 @@ void SwUndoMergeTable::RepeatImpl(::sw::RepeatContext & rContext)
     SwPaM *const pPam = & rContext.GetRepeatPaM();
 
     pDoc->MergeTable( *pPam->GetPoint(), bWithPrev, nMode );
-    ClearFEShellTabCols();
+    ClearFEShellTabCols(*pDoc, nullptr);
 }
 
 void SwUndoMergeTable::SaveFormula( SwHistory& rHistory )


More information about the Libreoffice-commits mailing list