Kaydet (Commit) 903afaa8 authored tarafından Armin Le Grand's avatar Armin Le Grand

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

üst 28c209b6
...@@ -876,7 +876,8 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() ...@@ -876,7 +876,8 @@ uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes()
sValue += sName; sValue += sName;
sValue += String::CreateFromInt32(pDrViewSh->GetPageTabControl()->GetPageCount()) ; sValue += String::CreateFromInt32(pDrViewSh->GetPageTabControl()->GetPageCount()) ;
sValue += rtl::OUString::createFromAscii(";"); sValue += rtl::OUString::createFromAscii(";");
if(pDrViewSh->IsLayerModeActive() )
if(pDrViewSh->IsLayerModeActive() && pDrViewSh->GetLayerTabControl()) // #87182#
{ {
sName = rtl::OUString::createFromAscii("page-name:"); sName = rtl::OUString::createFromAscii("page-name:");
sValue = sName; sValue = sName;
......
...@@ -401,7 +401,13 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive) ...@@ -401,7 +401,13 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
GetViewShellBase().GetDrawController().BroadcastContextChange(); GetViewShellBase().GetDrawController().BroadcastContextChange();
meEditMode = eEMode; 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 // Determine whether to show the master view toolbar. The master
// page mode has to be active and the shell must not be a handout // page mode has to be active and the shell must not be a handout
...@@ -684,7 +690,11 @@ IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab ) ...@@ -684,7 +690,11 @@ IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab )
aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1)); aTabSize.Width() = Min(pTab->GetSplitSize(), (long)(nMax-1));
maTabControl.SetSizePixel(aTabSize); maTabControl.SetSizePixel(aTabSize);
GetLayerTabControl()->SetSizePixel(aTabSize);
if(GetLayerTabControl()) // #87182#
{
GetLayerTabControl()->SetSizePixel(aTabSize);
}
Point aPos = maTabControl.GetPosPixel(); Point aPos = maTabControl.GetPosPixel();
aPos.X() += aTabSize.Width(); aPos.X() += aTabSize.Width();
......
...@@ -222,17 +222,34 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) ...@@ -222,17 +222,34 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq)
case SID_SWITCHLAYER: // BASIC case SID_SWITCHLAYER: // BASIC
{ {
const SfxItemSet *pArgs = rReq.GetArgs (); 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); 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 (); rReq.Done ();
break; break;
......
...@@ -124,6 +124,12 @@ void DrawViewShell::DeleteActualPage() ...@@ -124,6 +124,12 @@ void DrawViewShell::DeleteActualPage()
void DrawViewShell::DeleteActualLayer() void DrawViewShell::DeleteActualLayer()
{ {
if(!GetLayerTabControl()) // #87182#
{
OSL_ENSURE(false, "No LayerTabBar (!)");
return;
}
SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin(); SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin();
const String& rName = GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId()); const String& rName = GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId());
String aString(SdResId(STR_ASK_DELETE_LAYER)); String aString(SdResId(STR_ASK_DELETE_LAYER));
......
...@@ -911,20 +911,27 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) ...@@ -911,20 +911,27 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
// darf der aktuelle Layer geloescht werden? // darf der aktuelle Layer geloescht werden?
if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_LAYER ) ) if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_DELETE_LAYER ) )
{ {
sal_uInt16 nCurrentLayer = GetLayerTabControl()->GetCurPageId(); if(GetLayerTabControl()) // #87182#
const String& rName = GetLayerTabControl()->GetPageText(nCurrentLayer); {
sal_uInt16 nCurrentLayer = GetLayerTabControl()->GetCurPageId();
const String& rName = GetLayerTabControl()->GetPageText(nCurrentLayer);
sal_Bool bDisableIt = !IsLayerModeActive(); sal_Bool bDisableIt = !IsLayerModeActive();
bDisableIt |= (rName == String(SdResId(STR_LAYER_LAYOUT))); bDisableIt |= (rName == String(SdResId(STR_LAYER_LAYOUT)));
bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRND))); bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRND)));
bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRNDOBJ))); bDisableIt |= (rName == String(SdResId(STR_LAYER_BCKGRNDOBJ)));
bDisableIt |= (rName == String(SdResId(STR_LAYER_CONTROLS))); bDisableIt |= (rName == String(SdResId(STR_LAYER_CONTROLS)));
bDisableIt |= (rName == String(SdResId(STR_LAYER_MEASURELINES))); 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); OSL_ENSURE(false, "No LayerTabBar (!)");
rSet.DisableItem(SID_RENAMELAYER);
} }
} }
......
...@@ -233,6 +233,14 @@ void DrawViewShell::FuTemp02(SfxRequest& rReq) ...@@ -233,6 +233,14 @@ void DrawViewShell::FuTemp02(SfxRequest& rReq)
case SID_MODIFYLAYER: case SID_MODIFYLAYER:
{ {
if(!GetLayerTabControl()) // #87182#
{
OSL_ENSURE(false, "No LayerTabBar (!)");
Cancel();
rReq.Ignore();
break;
}
if ( mpDrawView->IsTextEdit() ) if ( mpDrawView->IsTextEdit() )
{ {
mpDrawView->SdrEndTextEdit(); mpDrawView->SdrEndTextEdit();
...@@ -387,8 +395,14 @@ void DrawViewShell::FuTemp02(SfxRequest& rReq) ...@@ -387,8 +395,14 @@ void DrawViewShell::FuTemp02(SfxRequest& rReq)
mpDrawView->SdrEndTextEdit(); mpDrawView->SdrEndTextEdit();
} }
GetLayerTabControl()->StartEditMode( if(GetLayerTabControl()) // #87182#
GetLayerTabControl()->GetCurPageId() ); {
GetLayerTabControl()->StartEditMode(GetLayerTabControl()->GetCurPageId());
}
else
{
OSL_ENSURE(false, "No LayerTabBar (!)");
}
Cancel(); Cancel();
rReq.Ignore (); rReq.Ignore ();
...@@ -825,6 +839,12 @@ void DrawViewShell::ModifyLayer ( ...@@ -825,6 +839,12 @@ void DrawViewShell::ModifyLayer (
bool bIsLocked, bool bIsLocked,
bool bIsPrintable) bool bIsPrintable)
{ {
if(!GetLayerTabControl()) // #87182#
{
OSL_ENSURE(false, "No LayerTabBar (!)");
return;
}
if( pLayer ) if( pLayer )
{ {
const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount(); const sal_uInt16 nPageCount = GetLayerTabControl()->GetPageCount();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment