summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docfly.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-10-20 19:19:35 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-10-20 22:08:00 +0200
commit1b3310a5805cf50f7aca88a83768ffa5adc42a0b (patch)
tree5dbf70ccc2f63afa77dcc36477841a1cd92745f7 /sw/source/core/doc/docfly.cxx
parent09bcd753036bb6f8abeeb5a523f7dfbcf770aca0 (diff)
tdf#136385 sw: fix Undo of changing anchor type
There were a few problems here: 1. the changes to positions in SwAnchoredDrawObject::AdjustPositioningAttr() weren't recorded 2. the Undo of setting the anchor type ran last, which ended up calling SwDrawContact::Changed_() via some callback, which changed the position from the correct one to a wrong one 3. if the fixup for FLY_AT_PAGE is done after AdjustPositioningAttr() then that doesn't need to take into account the anchor type (regression from 1de2b0d3234462b488db54d36ebc17e2b579b0f0) Change-Id: If70408ad6140a5bec739dea176936ffcbfe3f5ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104571 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source/core/doc/docfly.cxx')
-rw-r--r--sw/source/core/doc/docfly.cxx26
1 files changed, 14 insertions, 12 deletions
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index e435920da879..988e59c76a58 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -932,18 +932,6 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
// #i26791# - Direct object positioning no longer needed. Apply
// of attributes (method call <SetAttr(..)>) takes care of the
// invalidation of the object position.
- SetAttr( aNewAnch, *pContact->GetFormat() );
- if (aNewAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
- {
- SwFormatHoriOrient item(pContact->GetFormat()->GetHoriOrient());
- sal_Int16 nRelOrient(item.GetRelationOrient());
- if (sw::GetAtPageRelOrientation(nRelOrient, false))
- {
- SAL_INFO("sw.ui", "fixing horizontal RelOrientation for at-page anchor");
- item.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
- SetAttr(item, *pContact->GetFormat());
- }
- }
if ( _bPosCorr )
{
// #i33313# - consider not connected 'virtual' drawing
@@ -962,6 +950,20 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
->AdjustPositioningAttr( pNewAnchorFrame );
}
}
+ if (aNewAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
+ {
+ SwFormatHoriOrient item(pContact->GetFormat()->GetHoriOrient());
+ sal_Int16 nRelOrient(item.GetRelationOrient());
+ if (sw::GetAtPageRelOrientation(nRelOrient, false))
+ {
+ SAL_INFO("sw.ui", "fixing horizontal RelOrientation for at-page anchor");
+ item.SetRelationOrient(nRelOrient);
+ SetAttr(item, *pContact->GetFormat());
+ }
+ }
+ // tdf#136385 set the anchor last - otherwise it messes up the
+ // position in SwDrawContact::Changed_() callback
+ SetAttr(aNewAnch, *pContact->GetFormat());
}
// we have changed the anchoring attributes, and those are used to