summaryrefslogtreecommitdiff
path: root/sd/source/ui/view
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-02-28 02:15:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-28 16:51:04 +0000
commitb1cf64fe51fd0bb1e9bc8c3bb38d5cc7254d8d5f (patch)
tree0a119fe314b8c820faf3de401378e4afb4adf3fc /sd/source/ui/view
parent51f73a9be8270487885d185eaa3dda13ec43d9b0 (diff)
Resolves: #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 Change-Id: I86bb17bf422356247a319f89e54d1ead97b368b8
Diffstat (limited to 'sd/source/ui/view')
-rw-r--r--sd/source/ui/view/drviews1.cxx14
-rw-r--r--sd/source/ui/view/drviews2.cxx18
-rw-r--r--sd/source/ui/view/drviews3.cxx29
-rw-r--r--sd/source/ui/view/drviews4.cxx6
-rw-r--r--sd/source/ui/view/drviews7.cxx29
-rw-r--r--sd/source/ui/view/drviewsb.cxx6
6 files changed, 81 insertions, 21 deletions
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 146aea802730..82d86c90104a 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -344,7 +344,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
@@ -593,7 +599,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 b0eeb9e3b852..faad29ae88c3 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 89e6ac9606ca..813138ceaf15 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, 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 21a8b4fb04b1..0141322e8341 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -95,6 +95,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 26d6b950e022..2b7d3c5e2d6f 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -894,20 +894,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);
- 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));
+ 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 d6dddd58a60d..eeb5b7dcb3e8 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();