summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-02-04 22:50:47 +0100
committerjan iversen <jani@documentfoundation.org>2016-03-15 16:00:19 +0000
commitc0c41a27dde5779af9d2737e6871d82015aa6395 (patch)
tree1d5a7b9d9db36e143cb82385c3a53bc61a9737aa
parenta27ba3413a6ee46451041ccdfefb4f75913adf01 (diff)
tdf#97429: Fix crash on print selected area
Regression from 9eb61489ee03486a7147acdf923eaf5e3f355183 Use DelFlyInRange to iterate over nodes' range Change-Id: I219c7ec83eaa69990340d423dc34546131bb372c Reviewed-on: https://gerrit.libreoffice.org/22129 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Xisco FaulĂ­ <anistenis@gmail.com> (cherry picked from commit 3f7a0f7dba759ed3763c900112b5eeb7ccfdd84d) Reviewed-on: https://gerrit.libreoffice.org/22426 Reviewed-by: jan iversen <jani@documentfoundation.org>
-rw-r--r--sw/source/core/frmedt/fecopy.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 55ece42fad2f..2092fe8f8d22 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -90,6 +90,7 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpText )
// delete content if ClpDocument contains content
SwNodeIndex aSttIdx( pClpDoc->GetNodes().GetEndOfExtras(), 2 );
+ SwNodeIndex aEndNdIdx( *aSttIdx.GetNode().EndOfSectionNode() );
SwTextNode* pTextNd = aSttIdx.GetNode().GetTextNode();
if (!pTextNd || !pTextNd->GetText().isEmpty() ||
aSttIdx.GetIndex()+1 != pClpDoc->GetNodes().GetEndOfContent().GetIndex() )
@@ -102,11 +103,19 @@ bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpText )
}
// also delete surrounding FlyFrames if any
- for( auto pFormat : *pClpDoc->GetSpzFrameFormats() )
+ for( const auto pFly : *pClpDoc->GetSpzFrameFormats() )
{
- SwFlyFrameFormat* pFly = static_cast<SwFlyFrameFormat*>(pFormat);
- pClpDoc->getIDocumentLayoutAccess().DelLayoutFormat( pFly );
+ SwFormatAnchor const*const pAnchor = &pFly->GetAnchor();
+ SwPosition const*const pAPos = pAnchor->GetContentAnchor();
+ if (pAPos &&
+ ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
+ (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
+ aSttIdx <= pAPos->nNode && pAPos->nNode <= aEndNdIdx )
+ {
+ pClpDoc->getIDocumentLayoutAccess().DelLayoutFormat( pFly );
+ }
}
+
pClpDoc->GetDocumentFieldsManager().GCFieldTypes(); // delete the FieldTypes
// if a string was passed, copy it to the clipboard-