summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-06-06 20:29:57 +0200
committerMichael Stahl <mstahl@redhat.com>2012-12-07 12:50:08 +0100
commit0b6b550aafe320e81bc48abff0f84ba59e0b3ecf (patch)
tree8c5244c7a92f6248907f8207eb536bdebb1c4dde /sw
parentfix incorrect OSL_ENSURE -> SAL_WARN_IF conversion (condition not inverted) (diff)
downloadcore-0b6b550aafe320e81bc48abff0f84ba59e0b3ecf.tar.gz
core-0b6b550aafe320e81bc48abff0f84ba59e0b3ecf.zip
handle properly anchor transition at page->at paragraph->as character
Otherwise setting text range afterwards crashes with pHnt being NULL. Change-Id: Ib4ac2712c061605dcaaa262280c0307f7a9af2ce (cherry picked from commit 5de61f7a4ddb502730454e4bf3232f7f4b4175e1) Signed-off-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unodraw.cxx31
1 files changed, 21 insertions, 10 deletions
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 329bed9fe54a..267f6f2f749d 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1344,18 +1344,29 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
aSet.Put( aNewAnchor );
pFmt->SetFmtAttr(aSet);
bSetAttr = false;
- if( text::TextContentAnchorType_AS_CHARACTER == eNewAnchor &&
- (FLY_AS_CHAR != eOldAnchorId))
+ }
+ if( text::TextContentAnchorType_AS_CHARACTER == eNewAnchor &&
+ (FLY_AS_CHAR != eOldAnchorId))
+ {
+ SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
+ if( pDoc->GetCurrentLayout() )
{
- //the RES_TXTATR_FLYCNT needs to be added now
- SwTxtNode *pNd = aPam.GetNode()->GetTxtNode();
- SAL_WARN_IF( !pNd, "sw.uno", "Crsr is not in a TxtNode." );
- SwFmtFlyCnt aFmt( pFlyFmt );
- pNd->InsertItem(aFmt,
- aPam.GetPoint()->nContent.GetIndex(), 0 );
- //aPam.GetPoint()->nContent--;
-
+ SwCrsrMoveState aState( MV_SETONLYTEXT );
+ Point aTmp( pObj->GetSnapRect().TopLeft() );
+ pDoc->GetCurrentLayout()->GetCrsrOfst( aPam.GetPoint(), aTmp, &aState );
+ }
+ else
+ {
+ //without access to the layout the last node of the body will be used as anchor position
+ aPam.Move( fnMoveBackward, fnGoDoc );
}
+ //the RES_TXTATR_FLYCNT needs to be added now
+ SwTxtNode *pNd = aPam.GetNode()->GetTxtNode();
+ SAL_WARN_IF( !pNd, "sw.uno", "Crsr is not in a TxtNode." );
+ SwFmtFlyCnt aFmt( pFlyFmt );
+ pNd->InsertItem(aFmt,
+ aPam.GetPoint()->nContent.GetIndex(), 0 );
+ //aPam.GetPoint()->nContent--;
}
if( bSetAttr )
pFmt->SetFmtAttr(aSet);