[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 2 commits - sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Dec 7 03:51:57 PST 2012
sw/source/core/unocore/unodraw.cxx | 47 ++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 18 deletions(-)
New commits:
commit 0b6b550aafe320e81bc48abff0f84ba59e0b3ecf
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Jun 6 20:29:57 2012 +0200
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 at redhat.com>
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 329bed9..267f6f2 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);
commit d1c01080d76a7599b79eb6a4960064be86d75858
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed Jun 6 18:17:50 2012 +0200
fix incorrect OSL_ENSURE -> SAL_WARN_IF conversion (condition not inverted)
Change-Id: I57dfa64c55e046ed51797b2abeb7ba3242e637da
(cherry picked from commit dfc4832049c140b7442c085062599aef1953e8fd)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 662a8ff..329bed9 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1174,7 +1174,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
else if(RES_OPAQUE == pEntry->nWID)
{
SvxShape* pSvxShape = GetSvxShape();
- SAL_WARN_IF(pSvxShape, "sw.uno", "No SvxShape found!");
+ SAL_WARN_IF(!pSvxShape, "sw.uno", "No SvxShape found!");
if(pSvxShape)
{
SdrObject* pObj = pSvxShape->GetSdrObject();
@@ -1220,14 +1220,14 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
//To prevent this the connection between format and attribute has to be broken before.
const SwPosition *pPos = aAnchor.GetCntntAnchor();
SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
- SAL_WARN_IF( pTxtNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
+ SAL_WARN_IF( !pTxtNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
SwTxtAttr * const pHnt =
pTxtNode->GetTxtAttrForCharAt(
nIdx, RES_TXTATR_FLYCNT );
- SAL_WARN_IF( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
+ SAL_WARN_IF( !pHnt || pHnt->Which() != RES_TXTATR_FLYCNT,
"sw.uno", "Missing FlyInCnt-Hint." );
- SAL_WARN_IF( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFmt,
+ SAL_WARN_IF( !pHnt || pHnt->GetFlyCnt().GetFrmFmt() != pFmt,
"sw.uno", "Wrong TxtFlyCnt-Hint." );
const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt())
.SetFlyFmt();
@@ -1237,7 +1237,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
RES_TXTATR_FLYCNT, nIdx );
//create a new one
SwTxtNode *pNd = pInternalPam->GetNode()->GetTxtNode();
- SAL_WARN_IF( pNd, "sw.uno", "Cursor not at TxtNode." );
+ SAL_WARN_IF( !pNd, "sw.uno", "Cursor not at TxtNode." );
SwFmtFlyCnt aFmt( pFmt );
pNd->InsertItem(aFmt, pInternalPam->GetPoint()
->nContent.GetIndex(), 0 );
@@ -1306,14 +1306,14 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
//To prevent this the connection between format and attribute has to be broken before.
const SwPosition *pPos = rOldAnchor.GetCntntAnchor();
SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
- SAL_WARN_IF( pTxtNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
+ SAL_WARN_IF( !pTxtNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
const xub_StrLen nIdx = pPos->nContent.GetIndex();
SwTxtAttr * const pHnt =
pTxtNode->GetTxtAttrForCharAt(
nIdx, RES_TXTATR_FLYCNT );
- SAL_WARN_IF( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
+ SAL_WARN_IF( !pHnt || pHnt->Which() != RES_TXTATR_FLYCNT,
"sw.uno", "Missing FlyInCnt-Hint." );
- SAL_WARN_IF( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == pFlyFmt,
+ SAL_WARN_IF( !pHnt || pHnt->GetFlyCnt().GetFrmFmt() != pFlyFmt,
"sw.uno", "Wrong TxtFlyCnt-Hint." );
const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt())
.SetFlyFmt();
@@ -1349,7 +1349,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A
{
//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." );
+ SAL_WARN_IF( !pNd, "sw.uno", "Crsr is not in a TxtNode." );
SwFmtFlyCnt aFmt( pFlyFmt );
pNd->InsertItem(aFmt,
aPam.GetPoint()->nContent.GetIndex(), 0 );
More information about the Libreoffice-commits
mailing list