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

Michael Stahl mstahl at redhat.com
Fri May 12 19:21:18 UTC 2017


 sw/source/core/layout/findfrm.cxx |    2 +-
 sw/source/core/layout/flowfrm.cxx |    2 ++
 sw/source/core/layout/tabfrm.cxx  |   17 +++++++++++++++++
 sw/source/core/txtnode/thints.cxx |    4 ++++
 4 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit c9fb347642729017ad0c613fe26310befd021db8
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri May 12 18:34:17 2017 +0200

    sw: table-in-footnote: delete SwFootnoteFrame if it becomes empty
    
    Crashed in a11y code with a SwFootnoteFrame that survived a JoinNode and
    subsequent deletion of its reference-containing SwTextFrame and thus had
    a stale "pRef" member; presumably the SwTableFrame needs to delete an
    empty footnote frame like the SwTextFrame does from SwContentFrame::Cut(),
    called from DelFrames(), called from CutImpl().
    
    Change-Id: I5a30357ecd3bf474bfc4a5451de89beb245fb0ae

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 147f517914bb..1de4d238e270 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3458,6 +3458,22 @@ void SwTabFrame::Cut()
                 pSct->InvalidateSize_();
             }
         }
+        // table-in-footnote: delete empty footnote frames (like SwContentFrame::Cut)
+        else if (!pUp->Lower() && pUp->IsFootnoteFrame() && !pUp->IsColLocked())
+        {
+            if (pUp->GetNext() && !pUp->GetPrev())
+            {
+                if (SwFrame *const pTmp = static_cast<SwLayoutFrame*>(pUp->GetNext())->ContainsAny())
+                {
+                    pTmp->InvalidatePrt_();
+                }
+            }
+            if (!pUp->IsDeleteForbidden())
+            {
+                pUp->Cut();
+                SwFrame::DestroyFrame(pUp);
+            }
+        }
         else if( aRectFnSet.GetHeight(Frame()) )
         {
             // OD 26.08.2003 #i18103# - *no* 'ColUnlock' of section -
@@ -3466,6 +3482,7 @@ void SwTabFrame::Cut()
         }
     }
 
+
     if ( pPage && !IsFollow() && pPage->GetUpper() )
         static_cast<SwRootFrame*>(pPage->GetUpper())->InvalidateBrowseWidth();
 }
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 2737ddad4e8b..c590a6e5cab7 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1384,6 +1384,10 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode )
                         SwContentNode* pCNd = rNodes[ nSttIdx ]->GetContentNode();
                         if( nullptr != pCNd )
                             pCNd->DelFrames();
+                        else if (SwTableNode *const pTable = rNodes[nSttIdx]->GetTableNode())
+                        {
+                            pTable->DelFrames();
+                        }
                     }
                 }
 
commit f6785b99a3f7e7531c8ef7ed16402cc4e02c9750
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri May 12 17:08:01 2017 +0200

    tdf#107568 sw: prevent moving/splitting of tables in footnotes
    
    The problem here is that for a table in a footnote on page 42,
    SwTabFrm::MakeAll() calls Split(), which first creates a
    follow-table-frame and then reformats the last row of the table;
    somehow the SwTextFrame id="4636" in that row doesn't fit and wants
    to split and then move to the following page with that page's footnote
    container as its parent.
    
    So this doesn't work currently.
    
    commit 971adcd9e19e0bcab5855aae9be58d2203b46169 tried to prevent just
    the moving forward of the table itself, but the table can still be split;
    if IsMoveable() returns false then that also prevents splitting the table.
    
    Change-Id: I1977c65f97cb0f66dbe5b89d7ef7e2cd05125331

diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index eded8b3def6d..490a95439715 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1329,7 +1329,7 @@ bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const
                         }
                     }
                 }
-                else
+                else if (!(_pLayoutFrame->IsInFootnote() && (IsTabFrame() || IsInTab())))
                 {
                     bRetVal = true;
                 }
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 5724da1b87a9..cf10f8805a96 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1803,6 +1803,8 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways )
     SwFootnoteBossFrame *pOldBoss = m_rThis.FindFootnoteBossFrame();
     if (m_rThis.IsInFootnote())
     {
+        assert(!m_rThis.IsTabFrame()); // prevented by IsMoveable()
+        assert(!m_rThis.IsInTab());
         if (!m_rThis.IsContentFrame() || !pOldBoss)
         {
             SAL_WARN("sw.core", "Tables in footnotes are not truly supported");


More information about the Libreoffice-commits mailing list