summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore/unodraw.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-06-06 20:29:57 +0200
committerAndras Timar <atimar@suse.com>2013-01-13 22:00:36 +0100
commit5af027dbea69d9159b000c2bac41433d50b250a0 (patch)
tree95314766b974bcd8a9e268bd5d69fe663ea1819f /sw/source/core/unocore/unodraw.cxx
parente41a40dd821c21e726415a66400e74750fa76996 (diff)
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/source/core/unocore/unodraw.cxx')
-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 6cf0c6d2c140..1bf4b20f00b3 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1360,18 +1360,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);