incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1352786 - in /incubator/ooo/trunk/main/sw/source/core/layout: flylay.cxx frmtool.cxx
Date Fri, 22 Jun 2012 07:28:00 GMT
Author: orw
Date: Fri Jun 22 07:27:59 2012
New Revision: 1352786

URL: http://svn.apache.org/viewvc?rev=1352786&view=rev
Log:
#119945# - improved setting of OrdNums to reflect "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>

Modified:
    incubator/ooo/trunk/main/sw/source/core/layout/flylay.cxx
    incubator/ooo/trunk/main/sw/source/core/layout/frmtool.cxx

Modified: incubator/ooo/trunk/main/sw/source/core/layout/flylay.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/layout/flylay.cxx?rev=1352786&r1=1352785&r2=1352786&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/layout/flylay.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/layout/flylay.cxx Fri Jun 22 07:27:59 2012
@@ -666,15 +666,16 @@ void SwPageFrm::AppendFlyToPage( SwFlyFr
 
     SdrObject* pObj = pNew->GetVirtDrawObj();
     ASSERT( pNew->GetAnchorFrm(), "Fly without Anchor" );
-    const SwFlyFrm* pFly = pNew->GetAnchorFrm()->FindFlyFrm();
-	if ( pFly && pObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum()
)
-	{
-        sal_uInt32 nNewNum = pFly->GetVirtDrawObj()->GetOrdNumDirect();
-		if ( pObj->GetPage() )
-			pObj->GetPage()->SetObjectOrdNum( pObj->GetOrdNumDirect(), nNewNum);
-		else
-			pObj->SetOrdNum( nNewNum );
-	}
+    SwFlyFrm* pFly = (SwFlyFrm*)pNew->GetAnchorFrm()->FindFlyFrm();
+    if ( pFly && pObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum()
)
+    {
+        //#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( pFly->GetVirtDrawObj()->GetOrdNumDirect(),
nNewNum );
+        else
+            pFly->GetVirtDrawObj()->SetOrdNum( nNewNum );
+    }
 
 	//Flys die im Cntnt sitzen beachten wir nicht weiter.
 	if ( pNew->IsFlyInCntFrm() )
@@ -936,16 +937,16 @@ void SwPageFrm::AppendDrawObjToPage( SwA
     }
 
     ASSERT( _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);
-        else
-            _rNewObj.DrawObj()->SetOrdNum( nNewNum );
+            _rNewObj.DrawObj()->GetPage()->SetObjectOrdNum( pFlyFrm->GetVirtDrawObj()->GetOrdNumDirect(),
nNewNum );
+        else 
+            pFlyFrm->GetVirtDrawObj()->SetOrdNum( nNewNum );
     }
 
     if ( FLY_AS_CHAR == _rNewObj.GetFrmFmt().GetAnchor().GetAnchorId() )

Modified: incubator/ooo/trunk/main/sw/source/core/layout/frmtool.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/layout/frmtool.cxx?rev=1352786&r1=1352785&r2=1352786&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/layout/frmtool.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/layout/frmtool.cxx Fri Jun 22 07:27:59 2012
@@ -2804,9 +2804,9 @@ void MA_FASTCALL lcl_Regist( SwPageFrm *
              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()
);
         }
 	}
 }



Mime
View raw message