sd/source/ui/view/drviews1.cxx | 14 ++++++++++++-- sd/source/ui/view/drviews2.cxx | 18 ++++++++++++++++-- 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 | 6 ++++++ 6 files changed, 81 insertions(+), 21 deletions(-)
New commits: commit b4c090d8e6ad7727fc5a0399349b9ed0b5ff75f2 Author: Armin Le Grand <a...@apache.org> Date: Fri Feb 28 02:15:29 2014 +0000 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 <mst...@redhat.com> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 2df556d..bffde5d 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 003835e..a81e2ff 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 31e89a4..f292942 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 a0d0dc0..a907a4d 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 ee80d43..7987b7a 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 26dc337..879e78f 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits