[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/source

Michael Stahl mstahl at redhat.com
Mon Jun 12 09:19:53 UTC 2017


 sw/source/core/crsr/crsrsh.cxx         |   20 ++++++++++++--------
 sw/source/core/crsr/swcrsr.cxx         |    1 +
 sw/source/core/edit/autofmt.cxx        |    1 +
 sw/source/core/fields/postithelper.cxx |    5 ++++-
 sw/source/core/frmedt/fews.cxx         |    6 +++++-
 sw/source/core/unocore/unotbl.cxx      |    1 +
 6 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit 59e22664da0ee119d899c038a72d3de7f3d953b5
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jun 9 23:48:25 2017 +0200

    sw: DisableCallbackAction in a bunch more places
    
    ... to prevent recursive layout.
    
    Change-Id: I4a7cdcebe77bd7d8d16c721765ad5eb171e84619
    (cherry picked from commit 2d2af57bc0406cd3afd376dd3c92be112b8c9603)
    Reviewed-on: https://gerrit.libreoffice.org/38617
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 956a334ff41b..197d7d4060c5 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1539,15 +1539,18 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
 
             SwCursorMoveState aTmpState( MV_NONE );
             aTmpState.m_bRealHeight = true;
-            if( !pTableFrame->GetCharRect( m_aCharRect, *m_pTableCursor->GetPoint(), &aTmpState ) )
             {
-                Point aCentrPt( m_aCharRect.Center() );
-                aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
-                pTableFrame->GetCursorOfst( m_pTableCursor->GetPoint(), aCentrPt, &aTmpState );
-                bool const bResult =
-                    pTableFrame->GetCharRect( m_aCharRect, *m_pTableCursor->GetPoint() );
-                OSL_ENSURE( bResult, "GetCharRect failed." );
-                (void) bResult; // non-debug: unused
+                DisableCallbackAction a(*GetLayout());
+                if (!pTableFrame->GetCharRect( m_aCharRect, *m_pTableCursor->GetPoint(), &aTmpState))
+                {
+                    Point aCentrPt( m_aCharRect.Center() );
+                    aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
+                    pTableFrame->GetCursorOfst(m_pTableCursor->GetPoint(), aCentrPt, &aTmpState);
+                    bool const bResult =
+                        pTableFrame->GetCharRect(m_aCharRect, *m_pTableCursor->GetPoint());
+                    OSL_ENSURE( bResult, "GetCharRect failed." );
+                    (void) bResult; // non-debug: unused
+                }
             }
 
             m_pVisibleCursor->Hide(); // always hide visible Cursor
@@ -1802,6 +1805,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
 
         if( !(eFlags & SwCursorShell::UPDOWN ))   // delete old Pos. of Up/Down
         {
+            DisableCallbackAction a(*GetLayout());
             pFrame->Calc(GetOut());
             m_nUpDownX = pFrame->IsVertical() ?
                        m_aCharRect.Top() - pFrame->Frame().Top() :
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index de3452b4f988..23e6a6b59f61 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1843,6 +1843,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
             if( !pTableCursor )
             {
                 // try to position the cursor at half of the char-rect's height
+                DisableCallbackAction a(*GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout());
                 pFrame = GetContentNode()->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aPt, GetPoint() );
                 SwCursorMoveState eTmpState( MV_UPDOWN );
                 eTmpState.m_bSetInReadOnly = bInReadOnly;
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 09bd92e16f6f..f9a992833f10 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -250,6 +250,7 @@ SwTextFrame* SwAutoFormat::GetFrame( const SwTextNode& rTextNd ) const
     OSL_ENSURE( pFrame, "For Autoformat a Layout is needed" );
     if( m_aFlags.bAFormatByInput && !pFrame->IsValid() )
     {
+        DisableCallbackAction a(const_cast<SwRootFrame&>(*pFrame->getRootFrame()));
         SwRect aTmpFrame( pFrame->Frame() );
         SwRect aTmpPrt( pFrame->Prt() );
         pFrame->Calc(pFrame->getRootFrame()->GetCurrShell()->GetOut());
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index cfe556c76e56..8da466867d28 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -60,7 +60,10 @@ SwPostItHelper::SwLayoutStatus SwPostItHelper::getLayoutInfos(
                 aRet = VISIBLE;
 
                 o_rInfo.mpAnchorFrame = pTextFrame;
-                pTextFrame->GetCharRect(o_rInfo.mPosition, rAnchorPos, nullptr, false);
+                {
+                    DisableCallbackAction a(*pTextFrame->getRootFrame());
+                    pTextFrame->GetCharRect(o_rInfo.mPosition, rAnchorPos, nullptr, false);
+                }
                 if ( pAnnotationStartPos != nullptr )
                 {
                     o_rInfo.mnStartNodeIdx = pAnnotationStartPos->nNode.GetIndex();
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index d1b2a0906454..1208a71aa8cf 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -116,9 +116,13 @@ const SwRect& SwFEShell::GetAnyCurRect( CurRectType eType, const Point* pPt,
         case CurRectType::Page :    pFrame = pFrame->FindPageFrame();
                                     break;
 
-        case CurRectType::PageCalc:pFrame->Calc(Imp()->GetShell()->GetOut());
+        case CurRectType::PageCalc:
+                                {
+                                    DisableCallbackAction a(const_cast<SwRootFrame&>(*pFrame->getRootFrame()));
+                                    pFrame->Calc(Imp()->GetShell()->GetOut());
                                     pFrame = pFrame->FindPageFrame();
                                     pFrame->Calc(Imp()->GetShell()->GetOut());
+                                }
                                     break;
 
         case CurRectType::FlyEmbeddedPrt:
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 1a67dcca1dd3..115e1814e1e7 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -616,6 +616,7 @@ static bool lcl_FormatTable(SwFrameFormat* pTableFormat)
         // mba: no TYPEINFO for SwTabFrame
         if(!pFrame->IsTabFrame())
             continue;
+        DisableCallbackAction a(*pFrame->getRootFrame());
         SwTabFrame* pTabFrame = static_cast<SwTabFrame*>(pFrame);
         if(pTabFrame->IsValid())
             pTabFrame->InvalidatePos();


More information about the Libreoffice-commits mailing list