[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sd/source

Armin Le Grand alg at apache.org
Thu Feb 27 20:07:20 PST 2014


 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx |    3 -
 sd/source/ui/view/drviews1.cxx                            |   14 +++++-
 sd/source/ui/view/drviews3.cxx                            |   29 +++++++++++---
 sd/source/ui/view/drviews4.cxx                            |    6 ++
 sd/source/ui/view/drviews7.cxx                            |   29 ++++++++------
 sd/source/ui/view/drviewsb.cxx                            |   24 ++++++++++-
 6 files changed, 83 insertions(+), 22 deletions(-)

New commits:
commit 903afaa8ea0766e01ba41a227d2794c2c40b129a
Author: Armin Le Grand <alg at apache.org>
Date:   Fri Feb 28 02:15:29 2014 +0000

    i87182 secured usage of LayerTabBar in Draw application, ensured initialization when used as OLE

diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index 5a00795..acd38ae 100644
--- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -876,7 +876,8 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
             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;
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 6dbb4c8..7c1f44b 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -401,7 +401,13 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
         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, TabBar *, pTab )
     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();
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 5fee511..d3079a3 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -222,17 +222,34 @@ void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
         case SID_SWITCHLAYER:  // BASIC
         {
             const SfxItemSet *pArgs = rReq.GetArgs ();
-            sal_uInt16 nCurPage = GetLayerTabControl()->GetCurPageId ();
 
-            if( pArgs && pArgs->Count () == 1)
+            // #87182#
+            bool bCurPageValid(false);
+            sal_uInt16 nCurPage(0);
+
+            if(GetLayerTabControl())
+            {
+                nCurPage = GetLayerTabControl()->GetCurPageId();
+                bCurPageValid = true;
+            }
+
+            if(pArgs && 1 == pArgs->Count())
             {
                 SFX_REQUEST_ARG (rReq, pWhatLayer, SfxUInt32Item, ID_VAL_WHATLAYER, sal_False);
-                if( pWhatLayer )
-                    nCurPage = (short) pWhatLayer->GetValue ();
+
+                if(pWhatLayer)
+                {
+                    nCurPage = (short)pWhatLayer->GetValue();
+                    bCurPageValid = true;
+                }
+            }
+
+            if(bCurPageValid)
+            {
+                mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) );
+                Invalidate();
             }
 
-            mpDrawView->SetActiveLayer( GetLayerTabControl()->GetPageText(nCurPage) );
-            Invalidate();
             rReq.Done ();
 
             break;
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 0b6e2ee..bc3ae88 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -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));
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index db5d0a7..d06209e 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -911,20 +911,27 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
     // 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);
+        if(GetLayerTabControl()) // #87182#
+        {
+            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)));
+            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)
+            if (bDisableIt)
+            {
+                rSet.DisableItem(SID_DELETE_LAYER);
+                rSet.DisableItem(SID_RENAMELAYER);
+            }
+        }
+        else
         {
-            rSet.DisableItem(SID_DELETE_LAYER);
-            rSet.DisableItem(SID_RENAMELAYER);
+            OSL_ENSURE(false, "No LayerTabBar (!)");
         }
     }
 
diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx
index b72e5c1..5002384 100644
--- a/sd/source/ui/view/drviewsb.cxx
+++ b/sd/source/ui/view/drviewsb.cxx
@@ -233,6 +233,14 @@ void DrawViewShell::FuTemp02(SfxRequest& rReq)
 
         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& rReq)
                 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();


More information about the Libreoffice-commits mailing list