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

Attila Bakos (NISZ) (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 3 10:42:22 UTC 2020


 sw/source/core/doc/textboxhelper.cxx |   17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 918608006728cc753dc12a1b1499172dabe15376
Author:     Attila Bakos (NISZ) <bakos.attilakaroly at nisz.hu>
AuthorDate: Tue Nov 24 15:49:41 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Thu Dec 3 11:41:46 2020 +0100

    tdf#137802 sw: fix crash of textbox anchored to page
    
    This is a regression from commit
    a7bd634371285dbdceaf775dc31b6b586c7ca02f
    (tdf#137802 tdf#84691 sw: sync anchoring of
    textbox with UNO), where synching didn't
    remove the anchoring setting.
    
    Steps for reproducing:
    
    1. In an empty document add a new paragraph so that you have two.
    2. Insert – Shape – Basic Shapes – Rectangle and place it to the
       center of page to have it anchored to the second empty paragraph.
    3. Right click on the shape – Add Text Box
    4. Right click on the shape – Position and Size
    5. Set Anchor as To page
    6. Delete the second paragraph that the shape was anchored
    7. Click on the shape and press Delete
    
    Change-Id: I67f076bb9fc26cf47185aa21a84371dd85c6e3ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106531
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 1e276998ca82..0d66639baf83 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -828,17 +828,14 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
     const SfxPoolItem* pItem = aIter.GetCurItem();
 
     const RndStdIds aAnchId = rShape.GetAnchor().GetAnchorId();
-    if ((aAnchId == RndStdIds::FLY_AT_PAGE && rShape.GetAnchor().GetPageNum() != 0)
-        || ((aAnchId == RndStdIds::FLY_AT_PARA || aAnchId == RndStdIds::FLY_AT_CHAR)
-            && rShape.GetAnchor().GetContentAnchor()))
+    if (aAnchId == RndStdIds::FLY_AT_PAGE && rShape.GetAnchor().GetPageNum() != 0)
     {
-        SwFormatAnchor aNewAnch = pFormat->GetAnchor();
-        if (rShape.GetAnchor().GetContentAnchor())
-            aNewAnch.SetAnchor(rShape.GetAnchor().GetContentAnchor());
-        if (rShape.GetAnchor().GetPageNum() > 0)
-            aNewAnch.SetPageNum(rShape.GetAnchor().GetPageNum());
-        aNewAnch.SetType(rShape.GetAnchor().GetAnchorId());
-        aTextBoxSet.Put(aNewAnch);
+        aTextBoxSet.Put(SwFormatAnchor(RndStdIds::FLY_AT_PAGE, rShape.GetAnchor().GetPageNum()));
+    }
+    if ((aAnchId == RndStdIds::FLY_AT_PARA || aAnchId == RndStdIds::FLY_AT_CHAR)
+        && rShape.GetAnchor().GetContentAnchor())
+    {
+        aTextBoxSet.Put(rShape.GetAnchor());
     }
     do
     {


More information about the Libreoffice-commits mailing list