[Libreoffice-commits] core.git: sw/source
Oliver-Rainer Wittmann
orw at apache.org
Wed May 8 09:05:04 PDT 2013
sw/source/core/layout/flylay.cxx | 19 ++++++++++---------
sw/source/core/layout/frmtool.cxx | 6 +++---
2 files changed, 13 insertions(+), 12 deletions(-)
New commits:
commit d2b11ab8cb7f3fba07ad76fdcaff340d4184ec4f
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Jun 22 06:27:59 2012 +0000
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
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index fece114..5308a95 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 aee7e44..f9337b1 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() );
}
}
}
More information about the Libreoffice-commits
mailing list