From e964c55f463c5b9daeb41dbed6c330b40911c313 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 29 Jan 2016 18:52:34 +0000 Subject: implement missing FID_FUNCTION_BOX GetState since it was turned into a sidebar thing Change-Id: Ic7e53b9da3255bb8dfde048e0a12f1d9c89102d0 --- include/sfx2/sidebar/Sidebar.hxx | 6 +++++- sc/source/ui/view/tabvwsha.cxx | 9 +++++++++ sfx2/source/sidebar/Sidebar.cxx | 37 +++++++++++++++++++++++++++---------- 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& rxFrame); + + static bool IsPanelVisible( + const OUString& rsPanelId, const css::uno::Reference& 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 #include #include +#include #include #include #include @@ -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& 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& 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 -- cgit