fdo#85937 Add 'Close Sidebar' command to Sidebar menu
Change-Id: I83248398a9a8f2a8abb4e10d7ef9f1c203dddbf5
diff --git a/sfx2/source/sidebar/Sidebar.hrc b/sfx2/source/sidebar/Sidebar.hrc
index 06d1e04..a351c1e 100644
--- a/sfx2/source/sidebar/Sidebar.hrc
+++ b/sfx2/source/sidebar/Sidebar.hrc
@@ -52,6 +52,7 @@
#define IMAGE_SIDEBAR_DECK_FUNCTIONS_SMALL 132
#define STRING_CUSTOMIZATION 200
#define STRING_RESTORE 201
#define STRING_HIDE_SIDEBAR 202
#define SFX_STR_SIDEBAR_MORE_OPTIONS (RID_SFX_SIDEBAR_START + 1)
#define SFX_STR_SIDEBAR_CLOSE_DECK (RID_SFX_SIDEBAR_START + 2)
diff --git a/sfx2/source/sidebar/Sidebar.src b/sfx2/source/sidebar/Sidebar.src
index 548fa02..eaa55c0 100644
--- a/sfx2/source/sidebar/Sidebar.src
+++ b/sfx2/source/sidebar/Sidebar.src
@@ -154,6 +154,10 @@ Resource RID_SIDEBAR_RESOURCE
{
Text [en-US] = "Restore Default";
};
String STRING_HIDE_SIDEBAR
{
Text [en-US] = "Close Sidebar";
};
};
String SFX_STR_SIDEBAR_MORE_OPTIONS
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 4787587..7f950a24 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -63,6 +63,7 @@ using ::rtl::OUString;
namespace
{
const static char gsReadOnlyCommandName[] = ".uno:EditDoc";
const static char gsHideSidebarCommandName[] = ".uno:Sidebar";
const static sal_Int32 gnMaximumSidebarWidth (400);
const static sal_Int32 gnWidthCloseThreshold (70);
const static sal_Int32 gnWidthOpenThreshold (40);
@@ -77,6 +78,7 @@ namespace {
{
MID_UNLOCK_TASK_PANEL = 1,
MID_LOCK_TASK_PANEL,
MID_HIDE_SIDEBAR,
MID_CUSTOMIZATION,
MID_RESTORE_DEFAULT,
MID_FIRST_PANEL,
@@ -889,6 +891,7 @@ void SidebarController::ShowPopupMenu (
else
pMenu->InsertItem(MID_UNLOCK_TASK_PANEL, SFX2_RESSTR(STR_SFX_UNDOCK));
pMenu->InsertItem(MID_HIDE_SIDEBAR, SFX2_RESSTR(STRING_HIDE_SIDEBAR));
pCustomizationMenu->InsertSeparator();
pCustomizationMenu->InsertItem(MID_RESTORE_DEFAULT, SFX2_RESSTR(STRING_RESTORE));
@@ -924,6 +927,14 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu)
mpTabBar->RestoreHideFlags();
break;
case MID_HIDE_SIDEBAR:
{
const util::URL aURL (Tools::GetURL(gsHideSidebarCommandName));
Reference<frame::XDispatch> mxDispatch (Tools::GetDispatch(mxFrame, aURL));
if (mxDispatch.is())
mxDispatch->dispatch(aURL, Sequence<beans::PropertyValue>());
break;
}
default:
{
try