diff options
author | Attila Bakos (NISZ) <bakos.attilakaroly@nisz.hu> | 2020-11-24 15:49:41 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-12-03 11:41:46 +0100 |
commit | 918608006728cc753dc12a1b1499172dabe15376 (patch) | |
tree | 076402e64809c4a98a72b1c51ca2600f3b0c7d57 /sw | |
parent | 64819ab91555b5afe360cf25aba6431546c4d905 (diff) |
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@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
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 { |