summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2012-06-22 06:27:59 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-08 17:04:40 +0100
commitd2b11ab8cb7f3fba07ad76fdcaff340d4184ec4f (patch)
tree0bbbea8e570f8fe2987fafd733e3078fcce746ae /sw
parentb65859c5c60f1a83c8da8c6dcab0b7c8fc580f13 (diff)
Resolves: #119945# improve setting of OrdNums for "nesting" of objects
- instead of adjusting the OrdNum of the "nested" object the OrdNum of the "parent" is adjusted. Found by: Yan Ji <yanji.yj at gmail dot com> Patch by: yuanlin <yuanlin.ibm at gmail dot com> Review by: Oliver <orw at apache dot org> (cherry picked from commit 73f462e2162847262093c3984dc6c98919e1b3cd) Conflicts: sw/source/core/layout/flylay.cxx Change-Id: I0541dc3775f81efd60a6f4baa172c5297ee9d829
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/flylay.cxx19
-rw-r--r--sw/source/core/layout/frmtool.cxx6
2 files changed, 13 insertions, 12 deletions
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index fece11426d71..5308a951491f 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -603,14 +603,15 @@ void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew )
SdrObject* pObj = pNew->GetVirtDrawObj();
OSL_ENSURE( pNew->GetAnchorFrm(), "Fly without Anchor" );
- const SwFlyFrm* pFly = pNew->GetAnchorFrm()->FindFlyFrm();
+ SwFlyFrm* pFly = (SwFlyFrm*)pNew->GetAnchorFrm()->FindFlyFrm();
if ( pFly && pObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() )
{
- sal_uInt32 nNewNum = pFly->GetVirtDrawObj()->GetOrdNumDirect();
+ //#i119945# set pFly's OrdNum to _rNewObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
+ sal_uInt32 nNewNum = pObj->GetOrdNumDirect();
if ( pObj->GetPage() )
- pObj->GetPage()->SetObjectOrdNum( pObj->GetOrdNumDirect(), nNewNum);
+ pObj->GetPage()->SetObjectOrdNum( pFly->GetVirtDrawObj()->GetOrdNumDirect(), nNewNum );
else
- pObj->SetOrdNum( nNewNum );
+ pFly->GetVirtDrawObj()->SetOrdNum( nNewNum );
}
// Don't look further at Flys that sit inside the Cntnt.
@@ -857,16 +858,16 @@ void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj )
}
OSL_ENSURE( _rNewObj.GetAnchorFrm(), "anchored draw object without anchor" );
- const SwFlyFrm* pFlyFrm = _rNewObj.GetAnchorFrm()->FindFlyFrm();
+ SwFlyFrm* pFlyFrm = (SwFlyFrm*)_rNewObj.GetAnchorFrm()->FindFlyFrm();
if ( pFlyFrm &&
_rNewObj.GetDrawObj()->GetOrdNum() < pFlyFrm->GetVirtDrawObj()->GetOrdNum() )
{
- sal_uInt32 nNewNum = pFlyFrm->GetVirtDrawObj()->GetOrdNumDirect();
+ //#i119945# set pFly's OrdNum to _rNewObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
+ sal_uInt32 nNewNum = _rNewObj.GetDrawObj()->GetOrdNumDirect();
if ( _rNewObj.GetDrawObj()->GetPage() )
- _rNewObj.DrawObj()->GetPage()->SetObjectOrdNum(
- _rNewObj.GetDrawObj()->GetOrdNumDirect(), nNewNum);
+ _rNewObj.DrawObj()->GetPage()->SetObjectOrdNum( pFlyFrm->GetVirtDrawObj()->GetOrdNumDirect(), nNewNum );
else
- _rNewObj.DrawObj()->SetOrdNum( nNewNum );
+ pFlyFrm->GetVirtDrawObj()->SetOrdNum( nNewNum );
}
if ( FLY_AS_CHAR == _rNewObj.GetFrmFmt().GetAnchor().GetAnchorId() )
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index aee7e44a7811..f9337b13e268 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2807,9 +2807,9 @@ static void lcl_Regist( SwPageFrm *pPage, const SwFrm *pAnch )
pObj->GetDrawObj()->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() &&
pObj->GetDrawObj()->GetPage() )
{
- pObj->DrawObj()->GetPage()->SetObjectOrdNum(
- pObj->GetDrawObj()->GetOrdNumDirect(),
- pFly->GetVirtDrawObj()->GetOrdNumDirect() + 1 );
+ //#i119945# set pFly's OrdNum to pObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
+ pObj->DrawObj()->GetPage()->SetObjectOrdNum( pFly->GetVirtDrawObj()->GetOrdNumDirect(),
+ pObj->GetDrawObj()->GetOrdNumDirect() );
}
}
}