[Libreoffice-commits] core.git: include/sfx2 sc/source sfx2/source

Caolán McNamara caolanm at redhat.com
Sun Jan 31 03:49:30 PST 2016


 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(-)

New commits:
commit e964c55f463c5b9daeb41dbed6c330b40911c313
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 29 18:52:34 2016 +0000

    implement missing FID_FUNCTION_BOX GetState
    
    since it was turned into a sidebar thing
    
    Change-Id: Ic7e53b9da3255bb8dfde048e0a12f1d9c89102d0

diff --git a/include/sfx2/sidebar/Sidebar.hxx b/include/sfx2/sidebar/Sidebar.hxx
index aea1fcb..46620745 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 7eebef0..513c735 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 88f0b06..ac45f61 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


More information about the Libreoffice-commits mailing list