summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r--sw/source/core/unocore/unoframe.cxx2
-rw-r--r--sw/source/core/unocore/unoportenum.cxx12
-rw-r--r--sw/source/core/unocore/unotext.cxx14
3 files changed, 16 insertions, 12 deletions
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 9681279c350f..14ffb5c2442d 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2078,6 +2078,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
aFrmSet.Put( SwFmtAnchor( FLY_AT_PAGE, 1 ));
}
+ aPam.DeleteMark(); // mark position node will be deleted!
+ aIntPam.DeleteMark(); // mark position node will be deleted!
pFmt = pDoc->MakeFlyAndMove( *m_pCopySource, aFrmSet,
0,
pParentFrmFmt );
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 138f3d615ae2..620b9d212f70 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -155,12 +155,16 @@ namespace
++ppMark)
{
::sw::mark::IMark* const pBkmk = ppMark->get();
- bool hasOther = pBkmk->IsExpanded();
+ ::sw::mark::CrossRefBookmark *const pCrossRefMark(
+ dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk));
+ bool const hasOther = pBkmk->IsExpanded();
const SwPosition& rStartPos = pBkmk->GetMarkStart();
if(rStartPos.nNode == nOwnNode)
{
- const sal_uInt8 nType = hasOther ? BKM_TYPE_START : BKM_TYPE_START_END;
+ // #i109272#: cross reference marks: need special handling!
+ sal_uInt8 const nType = (hasOther || pCrossRefMark)
+ ? BKM_TYPE_START : BKM_TYPE_START_END;
rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr(
new SwXBookmarkPortion_Impl(
SwXBookmark::CreateXBookmark(rDoc, *pBkmk),
@@ -173,8 +177,10 @@ namespace
auto_ptr<SwPosition> pCrossRefEndPos;
const SwPosition* pEndPos = NULL;
if(hasOther)
+ {
pEndPos = &rEndPos;
- else if(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk))
+ }
+ else if (pCrossRefMark)
{
// Crossrefbookmarks only remember the start position but have to span the whole paragraph
pCrossRefEndPos = auto_ptr<SwPosition>(new SwPosition(rEndPos));
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 2bb2842fb508..73751f2a1259 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1754,13 +1754,15 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
// DelFullPara is called
const uno::Reference< text::XTextRange> xInsertTextRange =
new SwXTextRange(aStartPam, this);
+ aStartPam.DeleteMark(); // mark position node may be deleted!
pNewFrame->attach( xInsertTextRange );
pNewFrame->setName(m_pImpl->m_pDoc->GetUniqueFrameName());
}
- if (!aStartPam.GetTxt().Len())
+ SwTxtNode *const pTxtNode(aStartPam.GetNode()->GetTxtNode());
+ OSL_ASSERT(pTxtNode);
+ if (!pTxtNode || !pTxtNode->Len()) // don't remove if it contains text!
{
- bool bMoved = false;
{ // has to be in a block to remove the SwIndexes before
// DelFullPara is called
SwPaM aMovePam( *aStartPam.GetNode() );
@@ -1772,14 +1774,8 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
m_pImpl->m_pDoc->SetAttr(
aNewAnchor, *pNewFrame->GetFrmFmt() );
}
- bMoved = true;
- }
- if (bMoved)
- {
- aStartPam.DeleteMark();
-// SwPaM aDelPam( *aStartPam.GetNode() );
- m_pImpl->m_pDoc->DelFullPara(aStartPam/*aDelPam*/);
}
+ m_pImpl->m_pDoc->DelFullPara(aStartPam);
}
}
catch (lang::IllegalArgumentException& rIllegal)