officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 14 +++++++ sd/inc/app.hrc | 1 sd/sdi/_drvwsh.sdi | 5 ++ sd/sdi/sdraw.sdi | 16 ++++++++ sd/source/ui/dlg/LayerTabBar.cxx | 1 sd/source/ui/view/drviews1.cxx | 1 sd/source/ui/view/drviews2.cxx | 19 ++++++++++ sd/source/ui/view/drviews7.cxx | 5 ++ sd/uiconfig/sdraw/popupmenu/layertab.xml | 1 9 files changed, 63 insertions(+)
New commits: commit 9b9159aa9073318c6892787d721b8cd732525972 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Mon Jan 16 10:36:13 2023 +0100 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Mon Jan 23 09:04:31 2023 +0000 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.tie...@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 8f8dba845c1a..69766003998b 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 dcd09a8c7e46..b8fbe474ac76 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 b9c52054b897..7d501ba20bdc 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 09124f3f4a81..cf4d008f6cc8 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 41cc90ac70c8..7e09228e6ed4 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 da00680667ce..2cddc0cea1c6 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 a390533e89dc..84a70eefff7b 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 141112bf9f9b..c3e0e98ad486 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 d15a040c0aa6..9b3a23ab4d29 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>