Commits

Anonymous committed 879c4cd

sw33bf09: #i113730# - Assure that group objects containing control objects are on control layer

Comments (0)

Files changed (2)

sw/source/core/frmedt/feshview.cxx

         // if we have one marked object, get the SdrObject and check
         // whether it contains a control
         const SdrObject* pSdrObject = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-        bRet = CheckControlLayer( pSdrObject );
+        bRet = ::CheckControlLayer( pSdrObject );
     }
     return bRet;
 }
             SdrObject* pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
             // OD 21.08.2003 #i18447# - no change of layer for controls
             // or group objects containing controls.
-            const bool bControlObj = ::CheckControlLayer( pObj );
-            //if ( pObj->GetLayer() != nLayerId && pObj->GetLayer() != nControls )
+            // --> OD 2010-09-14 #i113730#
+            // consider that a member of a drawing group has been selected.
+            const SwContact* pContact = ::GetUserCall( pObj );
+            ASSERT( pContact && pContact->GetMaster(), "<SwFEShell::ChangeOpaque(..)> - missing contact or missing master object at contact!" );
+            const bool bControlObj = ( pContact && pContact->GetMaster() )
+                                     ? ::CheckControlLayer( pContact->GetMaster() )
+                                     : ::CheckControlLayer( pObj );
+            // <--
             if ( !bControlObj && pObj->GetLayer() != nLayerId )
 			{
 				pObj->SetLayer( nLayerId );

sw/source/core/layout/fly.cxx

 #include <layhelp.hxx>
 #include <ndtxt.hxx>
 
+// --> OD 2010-09-14 #i113730#
+#include <svx/svdogrp.hxx>
+// <--
 // OD 16.04.2003 #i13147# - for <SwFlyFrm::GetContour(..)>
 #include <ndgrf.hxx>
 // OD 29.10.2003 #113049#
         _rNewObj.ChgAnchorFrm( this );
     }
 
+    // --> OD 2010-09-14 #i113730#
+    // Assure the control objects and group objects containing controls are on the control layer
+    if ( ::CheckControlLayer( _rNewObj.DrawObj() ) )
+    {
+        const IDocumentDrawModelAccess* pIDDMA = GetUpper()->GetFmt()->getIDocumentDrawModelAccess();
+        const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer());
+        const SdrLayerID aControlLayerID(pIDDMA->GetControlsId());
+        const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId());
+
+        if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID)
+        {
+            if ( aCurrentLayer == pIDDMA->GetInvisibleHellId() ||
+                 aCurrentLayer == pIDDMA->GetInvisibleHeavenId() )
+            {
+                _rNewObj.DrawObj()->SetLayer(aInvisibleControlLayerID);
+            }
+            else
+            {        
+                _rNewObj.DrawObj()->SetLayer(aControlLayerID);
+            }
+        }
+    }
+    // <--
+
     // no direct positioning needed, but invalidate the drawing object position
     _rNewObj.InvalidateObjPos();