diff options
Diffstat (limited to 'sw/source/core/unocore/unotext.cxx')
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 408372ff72f3..05c50fdde8ed 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -992,8 +992,8 @@ SwXText::setString(const OUString& rString) throw (uno::RuntimeException) } //FIXME why is CheckForOwnMember duplicated in some insert methods? -// Description: Checks if pRange/pCursor are member of the same text interface. -// Only one of the pointers has to be set! +// Description: Checks if pRange/pCursor are member of the same text interface. +// Only one of the pointers has to be set! bool SwXText::Impl::CheckForOwnMember( const SwPaM & rPaM) throw (lang::IllegalArgumentException, uno::RuntimeException) @@ -1654,11 +1654,20 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) SfxItemSet aFrameItemSet(m_pImpl->m_pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1, 0 ); - + // If there is no content in the frame the shape is in + // it gets deleted in the DelFullPara call below, + // In this case insert a tmp text node ( we delete it later ) + if ( aStartPam.Start()->nNode == pEndPam->Start()->nNode + && aStartPam.End()->nNode == pEndPam->End()->nNode ) + { + SwPosition aEnd(*aStartPam.End()); + bParaAfterInserted = GetDoc()->AppendTxtNode( aEnd ); + pEndPam->DeleteMark(); + *pEndPam->GetPoint() = aEnd; + } aStartPam.SetMark(); *aStartPam.End() = *pEndPam->End(); pEndPam.reset(0); - SwXTextFrame *const pNewFrame = new SwXTextFrame(m_pImpl->m_pDoc); const uno::Reference< text::XTextFrame > xNewFrame = pNewFrame; pNewFrame->SetSelection( aStartPam ); @@ -1788,13 +1797,13 @@ void SwXText::copyText( SwXText* pText = 0; pText = reinterpret_cast< SwXText* >( sal::static_int_cast< sal_IntPtr >( xTTunnel->getSomething( SwXText::getUnoTunnelId()) )); - + uno::Reference< text::XText > xText( xSource, uno::UNO_QUERY_THROW ); uno::Reference< text::XTextCursor > xCursor = xText->createTextCursor( ); xCursor->gotoEnd( sal_True ); - + uno::Reference< lang::XUnoTunnel > xTunnel( xCursor, uno::UNO_QUERY_THROW ); - + OTextCursorHelper* pCursor = 0; pCursor = reinterpret_cast< OTextCursorHelper* >( sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); @@ -1831,26 +1840,26 @@ void SwXText::Impl::ConvertCell( { throw lang::IllegalArgumentException(); } - - SwNodeRange aTmpRange(aStartCellPam.Start()->nNode, + + SwNodeRange aTmpRange(aStartCellPam.Start()->nNode, aEndCellPam.End()->nNode); - SwNodeRange * pCorrectedRange = + SwNodeRange * pCorrectedRange = m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange); - + if (pCorrectedRange != NULL) { SwPaM aNewStartPaM(pCorrectedRange->aStart, 0); aStartCellPam = aNewStartPaM; - - xub_StrLen nEndLen = 0; + + xub_StrLen nEndLen = 0; SwTxtNode * pTxtNode = pCorrectedRange->aEnd.GetNode().GetTxtNode(); if (pTxtNode != NULL) nEndLen = pTxtNode->Len(); - + SwPaM aNewEndPaM(pCorrectedRange->aEnd, nEndLen); aEndCellPam = aNewEndPaM; } - + /** check the nodes between start and end it is allowed to have pairs of StartNode/EndNodes */ @@ -2541,7 +2550,7 @@ SwXBodyText::hasElements() throw (uno::RuntimeException) } /****************************************************************** - * SwXHeadFootText + * SwXHeadFootText ******************************************************************/ class SwXHeadFootText::Impl : public SwClient |