summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/sidebar/Sidebar.hxx6
-rw-r--r--sc/source/ui/view/tabvwsha.cxx9
-rw-r--r--sfx2/source/sidebar/Sidebar.cxx37
3 files changed, 41 insertions, 11 deletions
diff --git a/include/sfx2/sidebar/Sidebar.hxx b/include/sfx2/sidebar/Sidebar.hxx
index aea1fcbec4e0..46620745f63b 100644
--- a/include/sfx2/sidebar/Sidebar.hxx
+++ b/include/sfx2/sidebar/Sidebar.hxx
@@ -38,7 +38,11 @@ public:
this function probably returns before the requested panel is visible.
*/
static void ShowPanel (
- const ::rtl::OUString& rsPanelId,
+ const OUString& rsPanelId,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
+
+ static bool IsPanelVisible(
+ const OUString& rsPanelId,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
};
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 7eebef015072..513c735af81d 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -28,6 +28,7 @@
#include <svl/int64item.hxx>
#include <svx/zoomslideritem.hxx>
#include <sfx2/bindings.hxx>
+#include <sfx2/sidebar/Sidebar.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
@@ -312,6 +313,14 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
}
break;
+ case FID_FUNCTION_BOX:
+ {
+ const bool bBoxOpen = ::sfx2::sidebar::Sidebar::IsPanelVisible("ScFunctionsPanel",
+ pThisFrame->GetFrame().GetFrameInterface());
+ rSet.Put(SfxBoolItem(nWhich, bBoxOpen));
+ break;
+ }
+
case FID_TOGGLESYNTAX:
rSet.Put(SfxBoolItem(nWhich, GetViewData().IsSyntaxMode()));
break;
diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx
index 88f0b062bfed..ac45f616275a 100644
--- a/sfx2/source/sidebar/Sidebar.cxx
+++ b/sfx2/source/sidebar/Sidebar.cxx
@@ -26,23 +26,40 @@ using namespace css;
namespace sfx2 { namespace sidebar {
void Sidebar::ShowPanel (
- const ::rtl::OUString& rsPanelId,
+ const OUString& rsPanelId,
const css::uno::Reference<frame::XFrame>& rxFrame)
{
SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
+ if (!pController)
+ return;
const PanelDescriptor* pPanelDescriptor = pController->GetResourceManager()->GetPanelDescriptor(rsPanelId);
- if (pController!=nullptr && pPanelDescriptor != nullptr)
- {
- // This should be a lot more sophisticated:
- // - Make the deck switching asynchronous
- // - Make sure to use a context that really shows the panel
+ if (!pPanelDescriptor)
+ return;
- // All that is not necessary for the current use cases so lets
- // keep it simple for the time being.
- pController->OpenThenSwitchToDeck(pPanelDescriptor->msDeckId);
- }
+ // This should be a lot more sophisticated:
+ // - Make the deck switching asynchronous
+ // - Make sure to use a context that really shows the panel
+
+ // All that is not necessary for the current use cases so lets
+ // keep it simple for the time being.
+ pController->OpenThenSwitchToDeck(pPanelDescriptor->msDeckId);
+}
+
+bool Sidebar::IsPanelVisible(
+ const OUString& rsPanelId,
+ const css::uno::Reference<frame::XFrame>& rxFrame)
+{
+ SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
+ if (!pController)
+ return false;
+
+ const PanelDescriptor* pPanelDescriptor = pController->GetResourceManager()->GetPanelDescriptor(rsPanelId);
+ if (!pPanelDescriptor)
+ return false;
+
+ return pController->IsDeckVisible(pPanelDescriptor->msDeckId);
}
} } // end of namespace sfx2::sidebar