diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-06-12 17:04:45 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-23 15:02:41 +0000 |
commit | 2f874b1030d1062c446993af272d99eafdf674e7 (patch) | |
tree | 98e447d4ddf84654ec0167ea5791c6cde833bcc5 /sw/source/core/txtnode/thints.cxx | |
parent | b5222eac84e411d3dc7c5bac09fb70100c6df55e (diff) |
tdf#91228: need to check the format's IsLockModified(), not the node's
commit 9f01951b858453684f2622541af0eb85d4544fc6 also did the extra
Remove/Add for Draw fly objects, and it turns out that that's actually
wrong because SwTextFlyCnt::SetAnchor() will set the anchor without
locking anything if it's a Draw object. Replace it with a different
hack in SetAnchor() that applies only if it calls LockModify().
Thanks to Varun Dhall for creating a reproducer document.
Not sure if the LockModify() could be replaced completely, perhaps it's
just an optimization to avoid re-creating layout frames for the fly.
(cherry picked from commit fae87e03ea3829718ec0381ed3b04ceb52c23720)
Conflicts:
sw/source/core/txtnode/atrflyin.cxx
sw/source/core/txtnode/thints.cxx
Added test for redline with as-char frame
fixed by commits 4dd2e61 and fae87e0
Reviewed-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit f36ac1aa3bef5ba218f3dae24f260ce7e4afba95)
Change-Id: Ib3236f289c2c4202d48ac378a53ce02130d4ce2c
Reviewed-on: https://gerrit.libreoffice.org/16323
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/core/txtnode/thints.cxx')
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 37b0c261aa9b..a03b391a7440 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1277,44 +1277,19 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) { SwTxtFlyCnt *pFly = (SwTxtFlyCnt *)pAttr; SwFrmFmt* pFmt = pAttr->GetFlyCnt().GetFrmFmt(); - - // In order to maintain data coherency, if the hint is a fly - // moved from a text node to another, we have to remove it from - // the first textnode then to add it to the new (this) textnode - const SwFmtAnchor* pAnchor = 0; - pFmt->GetItemState( RES_ANCHOR, false, - reinterpret_cast<const SfxPoolItem**>(&pAnchor) ); - - SwIndex aIdx( this, pAttr->GetStart() ); - - bool bChangeFlyParentNode( false ); - if (pAnchor && - pAnchor->GetAnchorId() == FLY_AS_CHAR && - pAnchor->GetCntntAnchor() && - pAnchor->GetCntntAnchor()->nNode != *this) - { - assert(pAnchor->GetCntntAnchor()->nNode.GetNode().IsTxtNode()); - SwTxtNode* textNode = pAnchor->GetCntntAnchor()->nNode.GetNode().GetTxtNode(); - - if ( textNode->IsModifyLocked() ) - { - // Fly parent has changed but the FlyFormat is locked, so it will - // not be updated by SetAnchor (that calls Modify that updates - // relationships) - textNode->RemoveAnchoredFly( pFmt ); - bChangeFlyParentNode = true; - } - } - if( !(nsSetAttrMode::SETATTR_NOTXTATRCHR & nInsMode) ) { - // Wir muessen zuerst einfuegen, da in SetAnchor() // dem FlyFrm GetStart() uebermittelt wird. //JP 11.05.98: falls das Anker-Attribut schon richtig // gesetzt ist, dann korrigiere dieses nach dem Einfuegen // des Zeichens. Sonst muesste das immer ausserhalb // erfolgen (Fehleranfaellig !) + const SwFmtAnchor* pAnchor = 0; + pFmt->GetItemState( RES_ANCHOR, false, + (const SfxPoolItem**)&pAnchor ); + + SwIndex aIdx( this, pAttr->GetStart() ); const OUString c(GetCharOfTxtAttr(*pAttr)); OUString const ins( InsertText(c, aIdx, nInsertFlags) ); if (ins.isEmpty()) @@ -1378,11 +1353,6 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) return false; } } - - // Finish relationships update now that SetAnchor has fixed part of it. - if (bChangeFlyParentNode) - AddAnchoredFly( pFmt ); - break; } |