Resolves tdf#113439 - Show/Hide menu item in Draw's layer menu
Introduces .uno:ToggleLayerVisibility duplicating the existing
LayerTabBar::MouseButtonDown() function
Change-Id: I726d9a620afe22c84e5f20e76fabdfeccbcfb083
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145558
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 8f8dba8..69766003 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -991,6 +991,20 @@
<value>1</value>
</prop>
</node>
<node oor:name=".uno:ToggleLayerVisibility" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Toggle Layer Visibility</value>
</prop>
<prop oor:name="ContextLabel" oor:type="xs:string">
<value xml:lang="en-US">~Show Layer</value>
</prop>
<prop oor:name="PopupLabel" oor:type="xs:string">
<value xml:lang="en-US">~Show Layer (Shift+Click)</value>
</prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
</node>
<node oor:name=".uno:PageMode" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">~Normal</value>
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index dcd09a8..b8fbe47 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -110,6 +110,7 @@
#define SID_MODIFYLAYER (SID_SD_START+45)
#define SID_PAGEMODE (SID_SD_START+46)
#define SID_LAYERMODE (SID_SD_START+47)
#define SID_TOGGLELAYERVISIBILITY (SID_SD_START+48)
// FREE
#define SID_MASTERPAGE (SID_SD_START+50)
// Navigation between slides
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index b9c5205..7d501ba 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -188,6 +188,11 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
SID_TOGGLELAYERVISIBILITY // ole : no, status : ?
[
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
SID_RENAMELAYER // ole : no, status : ?
[
ExecMethod = FuTemporary ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 09124f3..cf4d008 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -2607,6 +2607,22 @@ SfxVoidItem ModifyPage SID_MODIFYPAGE
GroupId = SfxGroupId::Modify;
]
SfxBoolItem ToggleLayerVisibility SID_TOGGLELAYERVISIBILITY
[
AutoUpdate = FALSE,
FastCall = FALSE,
ReadOnlyDoc = FALSE,
Toggle = TRUE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
AccelConfig = TRUE,
MenuConfig = TRUE,
ToolBoxConfig = TRUE,
GroupId = SfxGroupId::Modify;
]
SfxVoidItem AssignLayout SID_ASSIGN_LAYOUT
(SfxUInt32Item WhatPage ID_VAL_WHATPAGE, SfxUInt32Item WhatLayout ID_VAL_WHATLAYOUT)
[
diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx
index 41cc90a..7e09228 100644
--- a/sd/source/ui/dlg/LayerTabBar.cxx
+++ b/sd/source/ui/dlg/LayerTabBar.cxx
@@ -188,6 +188,7 @@ void LayerTabBar::MouseButtonDown(const MouseEvent& rMEvt)
else if (rMEvt.IsShift())
{
// Shift: Toggle between layer visible / hidden
// see also SID_TOGGLELAYERVISIBILITY / tdf#113439
bNewVisible = !bOldVisible;
pPV->SetLayerVisible(aName, bNewVisible);
}
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index da00680..2cddc0c 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -1316,6 +1316,7 @@ void DrawViewShell::ResetActualLayer()
}
pLayerBar->SetCurPageId(nActiveLayerPos + 1);
GetViewFrame()->GetBindings().Invalidate( SID_TOGGLELAYERVISIBILITY );
GetViewFrame()->GetBindings().Invalidate( SID_MODIFYLAYER );
GetViewFrame()->GetBindings().Invalidate( SID_DELETE_LAYER );
}
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index a390533..84a70ee 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2207,6 +2207,25 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
}
break;
case SID_TOGGLELAYERVISIBILITY:
{
// tdf#113439; duplicates LayerTabBar::MouseButtonDown()
sal_uInt16 aTabId = GetLayerTabControl()->GetCurPageId();
OUString aName( GetLayerTabControl()->GetLayerName(aTabId) );
SdrPageView* pPV = mpDrawView->GetSdrPageView();
bool bVisible = !pPV->IsLayerVisible(aName);
pPV->SetLayerVisible(aName, bVisible);
ResetActualLayer();
GetDoc()->SetChanged();
Cancel();
rReq.Ignore ();
}
break;
case SID_RENAMELAYER:
{
if ( mpDrawView->IsTextEdit() )
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 141112b..c3e0e98 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -799,6 +799,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
rSet.DisableItem(SID_RENAMEPAGE_QUICK);
rSet.DisableItem(SID_INSERTLAYER);
rSet.DisableItem(SID_MODIFYLAYER);
rSet.DisableItem(SID_TOGGLELAYERVISIBILITY);
rSet.DisableItem(SID_RENAMELAYER);
rSet.DisableItem(SID_LAYERMODE);
rSet.DisableItem(SID_INSERTFILE);
@@ -824,6 +825,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
{
rSet.DisableItem( SID_INSERTLAYER );
rSet.DisableItem( SID_MODIFYLAYER );
rSet.DisableItem( SID_TOGGLELAYERVISIBILITY );
rSet.DisableItem( SID_DELETE_LAYER );
rSet.DisableItem( SID_RENAMELAYER );
}
@@ -1274,6 +1276,9 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
rSet.DisableItem(SID_3D_PYRAMID);
}
if ( !aActiveLayer.isEmpty() && pPV )
rSet.Put( SfxBoolItem(SID_TOGGLELAYERVISIBILITY, pPageView->IsLayerVisible(aActiveLayer)) );
// are the modules available?
if (!SvtModuleOptions().IsCalc())
diff --git a/sd/uiconfig/sdraw/popupmenu/layertab.xml b/sd/uiconfig/sdraw/popupmenu/layertab.xml
index d15a040..9b3a23a 100644
--- a/sd/uiconfig/sdraw/popupmenu/layertab.xml
+++ b/sd/uiconfig/sdraw/popupmenu/layertab.xml
@@ -12,4 +12,5 @@
<menu:menuitem menu:id=".uno:ModifyLayer"/>
<menu:menuitem menu:id=".uno:DeleteLayer"/>
<menu:menuitem menu:id=".uno:RenameLayer"/>
<menu:menuitem menu:id=".uno:ToggleLayerVisibility"/>
</menu:menupopup>