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

Bjoern Michaelsen bjoern.michaelsen at libreoffice.org
Wed Sep 20 22:06:27 UTC 2017


 sw/source/core/layout/frmtool.cxx |   29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)

New commits:
commit 4ac6a70524eb1383b8dab5e10bd3532434fe08a0
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
Date:   Wed Sep 20 01:15:54 2017 +0200

    inline lcl_ObjConnected and lcl_InHeaderOrFooter
    
    - lcl_ObjConnected repeatedly fetched an invariant: pRoot
    - lcl_InHeaderOrFooter just checked for FLY_AT_PAGE, which was never the
      case in the one client of the function
    
    Change-Id: I38aa54d3d51f7dcdee015588a9043824a7703c5c
    Reviewed-on: https://gerrit.libreoffice.org/42509
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index e45e558f20ee..44cee9648ad9 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1067,27 +1067,6 @@ void AppendObjs( const SwFrameFormats *pTable, sal_uLong nIndex,
 #endif
 }
 
-static inline bool lcl_ObjConnected(const SwFrameFormat* pFormat, const SwFrame* pSib)
-{
-    const SwRootFrame* pRoot = pSib ? pSib->getRootFrame() : nullptr;
-    bool isConnected(false);
-    pFormat->CallSwClientNotify(sw::GetObjectConnectedHint(isConnected, pRoot));
-    return isConnected;
-}
-
-/** helper method to determine, if a <SwFrameFormat>, which has an object connected,
-    is located in header or footer.
-
-    OD 23.06.2003 #108784#
-*/
-static inline bool lcl_InHeaderOrFooter(const SwFrameFormat& rFormat)
-{
-    const SwFormatAnchor& rAnch = rFormat.GetAnchor();
-    if (rAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
-        return false;
-    return rFormat.GetDoc()->IsInHeaderFooter(rAnch.GetContentAnchor()->nNode);
-}
-
 void AppendAllObjs(const SwFrameFormats* pTable, const SwFrame* pSib)
 {
     //Connecting of all Objects, which are described in the SpzTable with the
@@ -1101,17 +1080,21 @@ void AppendAllObjs(const SwFrameFormats* pTable, const SwFrame* pSib)
         // frames nor objects which are anchored to character bounds.
         if ((rAnch.GetAnchorId() != RndStdIds::FLY_AT_PAGE) && (rAnch.GetAnchorId() != RndStdIds::FLY_AS_CHAR))
         {
-            if(lcl_InHeaderOrFooter(*pFormat))
+            // formats in header/footer have no dependencies
+            if(pFormat->GetDoc()->IsInHeaderFooter(rAnch.GetContentAnchor()->nNode))
                 pFormat->MakeFrames();
             else
                 vFormatsToConnect.push_back(pFormat);
         }
     }
+    const SwRootFrame* pRoot = pSib ? pSib->getRootFrame() : nullptr;
     const SwFrameFormat* pFirstRequeued(nullptr);
     while(!vFormatsToConnect.empty())
     {
         auto& pFormat = vFormatsToConnect.front();
-        if(!lcl_ObjConnected(pFormat, pSib))
+        bool isConnected(false);
+        pFormat->CallSwClientNotify(sw::GetObjectConnectedHint(isConnected, pRoot));
+        if(!isConnected)
         {
             pFormat->MakeFrames();
             pFirstRequeued = nullptr;


More information about the Libreoffice-commits mailing list