sw/source/core/doc/docedt.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
New commits: commit f255df5e56ba54721eb5e201b06d39aa71794090 Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 17 14:03:05 2015 +0200 sw: why doesn't _RestFlyInRange() assign the node to the anchor position? If it's AT_CHAR anchor it needs to have a valid nContent, if not the SwFormatAnchor::SetAnchor() will clear nContent. Change-Id: I876b32110eb9573c1e0807ce02417632a0fcd507 diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index f5df0ef..81abb44 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -73,7 +73,7 @@ void _RestFlyInRange( _SaveFlyArr & rArr, const SwNodeIndex& rSttIdx, else aPos.nNode = rSttIdx.GetIndex() + rSave.nNdDiff; - aPos.nContent.Assign( 0, 0 ); + aPos.nContent.Assign(dynamic_cast<SwIndexReg*>(&aPos.nNode.GetNode()), 0); SwFormatAnchor aAnchor( pFormat->GetAnchor() ); aAnchor.SetAnchor( &aPos ); pFormat->GetDoc()->GetSpzFrameFormats()->push_back( pFormat ); commit 8a1f55365ca609c1f2a79e9067b4857fae19b202 Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 17 14:00:05 2015 +0200 sw: fix assert on exporting ooo75410-1.doc to WW8 Apparently it may happen that some fly does get a different anchor node than before, which means the RemoveAnchoredFly() will be called twice. Prevent the problem differently by clearing the anchor in _SaveFlyInRange(). (regression from a624cf52ab08b18b08711567799a08f47c48f89b) Change-Id: Id796d2e230de065113bcf1e6164d6b8a01ab933c diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index d0a78cf..f5df0ef 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -77,9 +77,8 @@ void _RestFlyInRange( _SaveFlyArr & rArr, const SwNodeIndex& rSttIdx, SwFormatAnchor aAnchor( pFormat->GetAnchor() ); aAnchor.SetAnchor( &aPos ); pFormat->GetDoc()->GetSpzFrameFormats()->push_back( pFormat ); + // SetFormatAttr should call Modify() and add it to the node pFormat->SetFormatAttr( aAnchor ); - // SetFormatAttr will not call Modify() because the node is the same :-/ - aPos.nNode.GetNode().AddAnchoredFly(pFormat); SwContentNode* pCNd = aPos.nNode.GetNode().GetContentNode(); if( pCNd && pCNd->getLayoutFrm( pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false ) ) pFormat->MakeFrms(); @@ -104,7 +103,10 @@ void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr ) pFormat, false ); rArr.push_back( aSave ); pFormat->DelFrms(); - pAPos->nNode.GetNode().RemoveAnchoredFly(pFormat); + // set a dummy anchor position to maintain anchoring invariants + SwFormatAnchor aAnchor( pFormat->GetAnchor() ); + aAnchor.SetAnchor(nullptr); + pFormat->SetFormatAttr(aAnchor); rFormats.erase( rFormats.begin() + n-- ); } } @@ -168,7 +170,10 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos, pFormat, bInsPos ); rArr.push_back( aSave ); pFormat->DelFrms(); - pAPos->nNode.GetNode().RemoveAnchoredFly(pFormat); + // set a dummy anchor position to maintain anchoring invariants + SwFormatAnchor aAnchor( pFormat->GetAnchor() ); + aAnchor.SetAnchor(nullptr); + pFormat->SetFormatAttr(aAnchor); rFormats.erase( rFormats.begin() + n-- ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits