summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-06-06 20:29:57 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-06-07 17:02:11 +0200
commit5de61f7a4ddb502730454e4bf3232f7f4b4175e1 (patch)
treedd1da4cb4978e14ab50459057448d7bd11dcce18
parent50e0fe3f47354138242442e4b48551d43decbfcb (diff)
handle properly anchor transition at page->at paragraph->as character
Otherwise setting text range afterwards crashes with pHnt being NULL. Change-Id: Ib4ac2712c061605dcaaa262280c0307f7a9af2ce
-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);