You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2014/02/28 03:15:29 UTC

svn commit: r1572807 - in /openoffice/trunk/main/sd/source/ui: accessibility/AccessibleDocumentViewBase.cxx view/drviews1.cxx view/drviews3.cxx view/drviews4.cxx view/drviews7.cxx view/drviewsb.cxx

Author: alg
Date: Fri Feb 28 02:15:29 2014
New Revision: 1572807

URL: http://svn.apache.org/r1572807
Log:
i87182 secured usage of LayerTabBar in Draw application, ensured initialization when used as OLE

Modified:
    openoffice/trunk/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
    openoffice/trunk/main/sd/source/ui/view/drviews1.cxx
    openoffice/trunk/main/sd/source/ui/view/drviews3.cxx
    openoffice/trunk/main/sd/source/ui/view/drviews4.cxx
    openoffice/trunk/main/sd/source/ui/view/drviews7.cxx
    openoffice/trunk/main/sd/source/ui/view/drviewsb.cxx

Modified: openoffice/trunk/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx?rev=1572807&r1=1572806&r2=1572807&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx Fri Feb 28 02:15:29 2014
@@ -876,7 +876,8 @@ uno::Any SAL_CALL AccessibleDocumentView
 			sValue += sName;
 			sValue += String::CreateFromInt32(pDrViewSh->GetPageTabControl()->GetPageCount()) ;
 			sValue +=  rtl::OUString::createFromAscii(";");
-		if(pDrViewSh->IsLayerModeActive() )
+
+        if(pDrViewSh->IsLayerModeActive() && pDrViewSh->GetLayerTabControl()) // #87182#
 		{
 			sName = rtl::OUString::createFromAscii("page-name:");
 			sValue = sName;

Modified: openoffice/trunk/main/sd/source/ui/view/drviews1.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drviews1.cxx?rev=1572807&r1=1572806&r2=1572807&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviews1.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviews1.cxx Fri Feb 28 02:15:29 2014
@@ -401,7 +401,13 @@ void DrawViewShell::ChangeEditMode(EditM
         GetViewShellBase().GetDrawController().BroadcastContextChange();
 
 		meEditMode = eEMode;
-		mbIsLayerModeActive = bIsLayerModeActive;
+
+        if(pLayerBar)
+        {
+            // #87182# only switch activation mode of LayerTabBar when there is one,
+            // else it will not get initialized with the current set of Layers as needed
+            mbIsLayerModeActive = bIsLayerModeActive;
+        }
 
         // Determine whether to show the master view toolbar.  The master
         // page mode has to be active and the shell must not be a handout
@@ -684,7 +690,11 @@ IMPL_LINK( DrawViewShell, TabSplitHdl, T
 	aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1));
 
 	maTabControl.SetSizePixel(aTabSize);
-	GetLayerTabControl()->SetSizePixel(aTabSize);
+
+    if(GetLayerTabControl()) // #87182#
+    {
+        GetLayerTabControl()->SetSizePixel(aTabSize);
+    }
 
 	Point aPos = maTabControl.GetPosPixel();
 	aPos.X() += aTabSize.Width();

Modified: openoffice/trunk/main/sd/source/ui/view/drviews3.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drviews3.cxx?rev=1572807&r1=1572806&r2=1572807&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviews3.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviews3.cxx Fri Feb 28 02:15:29 2014
@@ -222,18 +222,35 @@ void  DrawViewShell::ExecCtrl(SfxRequest
 		case SID_SWITCHLAYER:  // BASIC
 		{
 			const SfxItemSet *pArgs = rReq.GetArgs ();
-			sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId ();
 
-			if( pArgs && pArgs->Count () == 1)
-			{
-				SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
-				if( pWhatLayer )
-					nCurPage = (short) pWhatLayer->GetValue ();
-			}
+            // #87182#
+            bool bCurPageValid(false);
+            sal_uInt16 nCurPage(0);
+            
+            if(GetLayerTabControl())
+            {
+                nCurPage = GetLayerTabControl()->GetCurPageId();
+                bCurPageValid = true;
+            }
 
-			mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) );
-			Invalidate();
-			rReq.Done ();
+            if(pArgs && 1 == pArgs->Count())
+            {
+                SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
+
+                if(pWhatLayer)
+                {
+                    nCurPage = (short)pWhatLayer->GetValue();
+                    bCurPageValid = true;
+                }
+            }
+
+            if(bCurPageValid)
+            {
+                mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) );
+                Invalidate();
+            }
+
+            rReq.Done ();
 
 			break;
 		}

Modified: openoffice/trunk/main/sd/source/ui/view/drviews4.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drviews4.cxx?rev=1572807&r1=1572806&r2=1572807&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviews4.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviews4.cxx Fri Feb 28 02:15:29 2014
@@ -124,6 +124,12 @@ void DrawViewShell::DeleteActualPage()
 
 void DrawViewShell::DeleteActualLayer()
 {
+    if(!GetLayerTabControl()) // #87182#
+    {
+        OSL_ENSURE(false, "No LayerTabBar (!)");
+        return;
+    }
+
 	SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin();
 	const String&  rName  = GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId());
 	String         aString(SdResId(STR_ASK_DELETE_LAYER));

Modified: openoffice/trunk/main/sd/source/ui/view/drviews7.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drviews7.cxx?rev=1572807&r1=1572806&r2=1572807&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviews7.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviews7.cxx Fri Feb 28 02:15:29 2014
@@ -911,22 +911,29 @@ void DrawViewShell::GetMenuState( SfxIte
 	// darf der aktuelle Layer geloescht werden?
 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_LAYER ) )
 	{
-		sal_uInt16		  nCurrentLayer = GetLayerTabControl()->GetCurPageId();
-		const String& rName 		= GetLayerTabControl()->GetPageText(nCurrentLayer);
-
-		sal_Bool bDisableIt = !IsLayerModeActive();
-        bDisableIt |= (rName == String(SdResId(STR_LAYER_LAYOUT)));
-        bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRND)));
-        bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRNDOBJ)));
-        bDisableIt |= (rName == String(SdResId(STR_LAYER_CONTROLS)));
-        bDisableIt |= (rName == String(SdResId(STR_LAYER_MEASURELINES)));
+        if(GetLayerTabControl()) // #87182#
+        {
+            sal_uInt16		  nCurrentLayer = GetLayerTabControl()->GetCurPageId();
+            const String& rName 		= GetLayerTabControl()->GetPageText(nCurrentLayer);
 
-		if (bDisableIt)
-		{
-			rSet.DisableItem(SID_DELETE_LAYER);
-            rSet.DisableItem(SID_RENAMELAYER);
-		}
-	}
+            sal_Bool bDisableIt = !IsLayerModeActive();
+            bDisableIt |= (rName == String(SdResId(STR_LAYER_LAYOUT)));
+            bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRND)));
+            bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRNDOBJ)));
+            bDisableIt |= (rName == String(SdResId(STR_LAYER_CONTROLS)));
+            bDisableIt |= (rName == String(SdResId(STR_LAYER_MEASURELINES)));
+
+            if (bDisableIt)
+            {
+                rSet.DisableItem(SID_DELETE_LAYER);
+                rSet.DisableItem(SID_RENAMELAYER);
+            }
+        }
+        else
+        {
+            OSL_ENSURE(false, "No LayerTabBar (!)");
+        }
+    }
 
 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CUT ) ||
 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_COPY ) ||

Modified: openoffice/trunk/main/sd/source/ui/view/drviewsb.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/view/drviewsb.cxx?rev=1572807&r1=1572806&r2=1572807&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/view/drviewsb.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/view/drviewsb.cxx Fri Feb 28 02:15:29 2014
@@ -233,6 +233,14 @@ void DrawViewShell::FuTemp02(SfxRequest&
 
 		case SID_MODIFYLAYER:
 		{
+            if(!GetLayerTabControl()) // #87182#
+            {
+                OSL_ENSURE(false, "No LayerTabBar (!)");
+                Cancel();
+                rReq.Ignore();
+                break;
+            }
+
 			if ( mpDrawView->IsTextEdit() )
 			{
 				mpDrawView->SdrEndTextEdit();
@@ -387,8 +395,14 @@ void DrawViewShell::FuTemp02(SfxRequest&
 				mpDrawView->SdrEndTextEdit();
 			}
 
-			GetLayerTabControl()->StartEditMode(
-                GetLayerTabControl()->GetCurPageId() );
+            if(GetLayerTabControl()) // #87182#
+            {
+                GetLayerTabControl()->StartEditMode(GetLayerTabControl()->GetCurPageId());
+            }
+            else
+            {
+                OSL_ENSURE(false, "No LayerTabBar (!)");
+            }
 
 			Cancel();
 			rReq.Ignore ();
@@ -825,6 +839,12 @@ void DrawViewShell::ModifyLayer (
     bool bIsLocked,
     bool bIsPrintable)
 {
+    if(!GetLayerTabControl()) // #87182#
+    {
+        OSL_ENSURE(false, "No LayerTabBar (!)");
+        return;
+    }
+
 	if( pLayer )
 	{
 		const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount();