diff options
author | Armin Le Grand <alg@apache.org> | 2014-02-28 02:15:29 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-06-05 21:33:27 +0000 |
commit | b4c090d8e6ad7727fc5a0399349b9ed0b5ff75f2 (patch) | |
tree | 5c1d1c7d12d29d84574e3d6f19ae005dcdfcb7b1 /sd | |
parent | 2dd048b2613a8309ba7673ef2cefae6dee56b235 (diff) |
Resolves: fdo#78953 secured usage of LayerTabBar in Draw...
was #i87182# secured usage of LayerTabBar in Draw...
ensured initialization when used as OLE
(cherry picked from commit 903afaa8ea0766e01ba41a227d2794c2c40b129a)
Conflicts:
sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
sd/source/ui/view/drviews3.cxx
sd/source/ui/view/drviews7.cxx
sd/source/ui/view/drviewsb.cxx
(cherry picked from commit b1cf64fe51fd0bb1e9bc8c3bb38d5cc7254d8d5f)
Conflicts:
sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
sd/source/ui/view/drviews3.cxx
sd/source/ui/view/drviews7.cxx
Change-Id: I86bb17bf422356247a319f89e54d1ead97b368b8
Reviewed-on: https://gerrit.libreoffice.org/9654
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/drviews1.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/view/drviews3.cxx | 29 | ||||
-rw-r--r-- | sd/source/ui/view/drviews4.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 29 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsb.cxx | 6 |
6 files changed, 81 insertions, 21 deletions
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 2df556dd7413..bffde5d6f88e 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -352,7 +352,13 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) GetViewShellBase().GetDrawController().BroadcastContextChange(); meEditMode = eEMode; - mbIsLayerModeActive = bIsLayerModeActive; + + if(pLayerBar) + { + // #i87182# 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 @@ -601,7 +607,11 @@ IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab ) aTabSize.Width() = std::min(pTab->GetSplitSize(), (long)(nMax-1)); maTabControl.SetSizePixel(aTabSize); - GetLayerTabControl()->SetSizePixel(aTabSize); + + if(GetLayerTabControl()) // #i87182# + { + GetLayerTabControl()->SetSizePixel(aTabSize); + } Point aPos = maTabControl.GetPosPixel(); aPos.X() += aTabSize.Width(); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 003835e1feec..a81e2ffbc881 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1538,6 +1538,14 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_MODIFYLAYER: { + if(!GetLayerTabControl()) // #i87182# + { + OSL_ENSURE(false, "No LayerTabBar (!)"); + Cancel(); + rReq.Ignore(); + break; + } + if ( mpDrawView->IsTextEdit() ) { mpDrawView->SdrEndTextEdit(); @@ -1694,8 +1702,14 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) mpDrawView->SdrEndTextEdit(); } - GetLayerTabControl()->StartEditMode( - GetLayerTabControl()->GetCurPageId() ); + if(GetLayerTabControl()) // #i87182# + { + GetLayerTabControl()->StartEditMode(GetLayerTabControl()->GetCurPageId()); + } + else + { + OSL_ENSURE(false, "No LayerTabBar (!)"); + } Cancel(); rReq.Ignore (); diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 31e89a4b8e36..f2929425c49d 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -199,17 +199,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) + // #i87182# + 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 a0d0dc019ee2..a907a4d7bac8 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -94,6 +94,12 @@ void DrawViewShell::DeleteActualPage() void DrawViewShell::DeleteActualLayer() { + if(!GetLayerTabControl()) // #i87182# + { + OSL_ENSURE(false, "No LayerTabBar (!)"); + return; + } + SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin(); const OUString& rName = GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId()); OUString aString(SD_RESSTR(STR_ASK_DELETE_LAYER)); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index ee80d434c3c5..7987b7ae79ed 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -891,20 +891,27 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) // is it allowed to delete the current layer? if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_LAYER ) ) { - sal_uInt16 nCurrentLayer = GetLayerTabControl()->GetCurPageId(); - const OUString& rName = GetLayerTabControl()->GetPageText(nCurrentLayer); + if(GetLayerTabControl()) // #i87182# + { + sal_uInt16 nCurrentLayer = GetLayerTabControl()->GetCurPageId(); + const OUString& rName = GetLayerTabControl()->GetPageText(nCurrentLayer); - sal_Bool bDisableIt = !IsLayerModeActive(); - bDisableIt |= (rName == SD_RESSTR(STR_LAYER_LAYOUT)); - bDisableIt |= (rName == SD_RESSTR(STR_LAYER_BCKGRND)); - bDisableIt |= (rName == SD_RESSTR(STR_LAYER_BCKGRNDOBJ)); - bDisableIt |= (rName == SD_RESSTR(STR_LAYER_CONTROLS)); - bDisableIt |= (rName == SD_RESSTR(STR_LAYER_MEASURELINES)); + sal_Bool bDisableIt = !IsLayerModeActive(); + bDisableIt |= (rName == SD_RESSTR(STR_LAYER_LAYOUT)); + bDisableIt |= (rName == SD_RESSTR(STR_LAYER_BCKGRND)); + bDisableIt |= (rName == SD_RESSTR(STR_LAYER_BCKGRNDOBJ)); + bDisableIt |= (rName == SD_RESSTR(STR_LAYER_CONTROLS)); + bDisableIt |= (rName == SD_RESSTR(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 26dc337f6124..879e78fc52a8 100644 --- a/sd/source/ui/view/drviewsb.cxx +++ b/sd/source/ui/view/drviewsb.cxx @@ -166,6 +166,12 @@ void DrawViewShell::ModifyLayer ( bool bIsLocked, bool bIsPrintable) { + if(!GetLayerTabControl()) // #i87182# + { + OSL_ENSURE(false, "No LayerTabBar (!)"); + return; + } + if( pLayer ) { const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount(); |