[Libreoffice-commits] core.git: Branch 'feature/chart-sidebar' - 5 commits - chart2/Library_chartcontroller.mk chart2/source framework/source include/sfx2 officecfg/registry sfx2/source

Markus Mohrhard markus.mohrhard at googlemail.com
Thu Jul 9 11:40:05 PDT 2015


 chart2/Library_chartcontroller.mk                              |    1 
 chart2/source/controller/chartcontroller.component             |    4 
 chart2/source/controller/sidebar/Chart2PanelFactory.cxx        |  149 ++++++++++
 chart2/source/controller/sidebar/Chart2PanelFactory.hxx        |   71 ++++
 framework/source/uifactory/uielementfactorymanager.cxx         |    6 
 include/sfx2/sidebar/SidebarController.hxx                     |    1 
 officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu |   14 
 officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu   |  136 +++++++++
 officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs |    2 
 sfx2/source/sidebar/Context.cxx                                |    9 
 sfx2/source/sidebar/ResourceManager.cxx                        |    2 
 sfx2/source/sidebar/SidebarController.cxx                      |   44 +-
 12 files changed, 419 insertions(+), 20 deletions(-)

New commits:
commit 701559e0792c7549a4ebae60b6b970e532918572
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Jul 9 20:39:06 2015 +0200

    big step towards real chart sidebar
    
    Change-Id: I9b7d1f963746f7689b02099fbae77c9c943bad58

diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index f77ef70..be73e1e 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -188,6 +188,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
     chart2/source/controller/main/UndoActions \
     chart2/source/controller/main/UndoCommandDispatch \
     chart2/source/controller/main/UndoGuard \
+    chart2/source/controller/sidebar/Chart2PanelFactory \
 ))
 
 # Runtime dependency for unit-tests
diff --git a/chart2/source/controller/chartcontroller.component b/chart2/source/controller/chartcontroller.component
index 396656d..045d61f 100644
--- a/chart2/source/controller/chartcontroller.component
+++ b/chart2/source/controller/chartcontroller.component
@@ -51,4 +51,8 @@
       constructor="com_sun_star_comp_chart2_WizardDialog_get_implementation">
     <service name="com.sun.star.chart2.WizardDialog"/>
   </implementation>
+  <implementation name="org.libreoffice.comp.chart2.sidebar.ChartPanelFactory"
+      constructor="org_libreoffice_comp_chart2_sidebar_ChartPanelFactory">
+    <service name="com.sun.star.ui.UIElementFactory"/>
+  </implementation>
 </component>
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
new file mode 100644
index 0000000..13df31f
--- /dev/null
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -0,0 +1,149 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "Chart2PanelFactory.hxx"
+
+#include <sfx2/sidebar/SidebarPanelBase.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+#include <rtl/ref.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <comphelper/namedvaluecollection.hxx>
+#include <cppuhelper/supportsservice.hxx>
+
+using namespace css;
+using namespace css::uno;
+using ::rtl::OUString;
+
+namespace chart { namespace sidebar {
+
+ChartPanelFactory::ChartPanelFactory()
+    : PanelFactoryInterfaceBase(m_aMutex)
+{
+}
+
+ChartPanelFactory::~ChartPanelFactory()
+{
+}
+
+Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
+    const ::rtl::OUString& rsResourceURL,
+    const ::css::uno::Sequence<css::beans::PropertyValue>& rArguments)
+    throw(
+        container::NoSuchElementException,
+        lang::IllegalArgumentException,
+        RuntimeException, std::exception)
+{
+    Reference<ui::XUIElement> xElement;
+
+    try
+    {
+        const ::comphelper::NamedValueCollection aArguments (rArguments);
+        Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+        Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+        const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
+        SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
+
+        vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+        if ( ! xParentWindow.is() || pParentWindow==NULL)
+            throw RuntimeException(
+                "PanelFactory::createUIElement called without ParentWindow",
+                NULL);
+        if ( ! xFrame.is())
+            throw RuntimeException(
+                "PanelFactory::createUIElement called without Frame",
+                NULL);
+        if (pBindings == NULL)
+            throw RuntimeException(
+                "PanelFactory::createUIElement called without SfxBindings",
+                NULL);
+
+        sal_Int32 nMinimumSize = -1;
+        VclPtr<vcl::Window> pPanel;
+        /*
+        if (rsResourceURL.endsWith("/AlignmentPropertyPanel"))
+            pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+        else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel"))
+            pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
+        else if (rsResourceURL.endsWith("/NumberFormatPropertyPanel"))
+            pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+        else if (rsResourceURL.endsWith("/NavigatorPanel"))
+        {
+            pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, nullptr, pParentWindow, false);
+            nMinimumSize = 0;
+        }
+        else if (rsResourceURL.endsWith("/FunctionsPanel"))
+        {
+            pPanel = VclPtr<ScFunctionDockWin>::Create(pBindings, nullptr, pParentWindow, ScResId(FID_FUNCTION_BOX));
+            nMinimumSize = 0;
+        }
+        */
+
+        if (pPanel)
+            xElement = sfx2::sidebar::SidebarPanelBase::Create(
+                rsResourceURL,
+                xFrame,
+                pPanel,
+                ui::LayoutSize(nMinimumSize,-1,-1));
+    }
+    catch (const uno::RuntimeException &)
+    {
+        throw;
+    }
+    catch (const uno::Exception& e)
+    {
+        throw lang::WrappedTargetRuntimeException(
+            OUString("ChartPanelFactory::createUIElement exception"),
+            0, uno::makeAny(e));
+    }
+
+    return xElement;
+}
+
+OUString ChartPanelFactory::getImplementationName()
+    throw (css::uno::RuntimeException, std::exception)
+{
+    return OUString("org.libreoffice.comp.chart2.sidebar.ChartPanelFactory");
+}
+
+sal_Bool ChartPanelFactory::supportsService(OUString const & ServiceName)
+    throw (css::uno::RuntimeException, std::exception)
+{
+    return cppu::supportsService(this, ServiceName);
+}
+
+css::uno::Sequence<OUString> ChartPanelFactory::getSupportedServiceNames()
+    throw (css::uno::RuntimeException, std::exception)
+{
+    css::uno::Sequence<OUString> aServiceNames(1);
+    aServiceNames[0] = "com.sun.star.ui.UIElementFactory";
+    return aServiceNames;
+}
+
+} } // end of namespace chart::sidebar
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+org_libreoffice_comp_chart2_sidebar_ChartPanelFactory(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new chart::sidebar::ChartPanelFactory());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.hxx b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
new file mode 100644
index 0000000..c96813c
--- /dev/null
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SC_INC_SCPANELFACTORY_HXX
+#define INCLUDED_SC_INC_SCPANELFACTORY_HXX
+
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ui/XUIElementFactory.hpp>
+#include <boost/noncopyable.hpp>
+
+
+namespace chart { namespace sidebar {
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper <
+        css::ui::XUIElementFactory, css::lang::XServiceInfo
+        > PanelFactoryInterfaceBase;
+}
+
+class ChartPanelFactory
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public PanelFactoryInterfaceBase
+{
+public:
+    ChartPanelFactory();
+    virtual ~ChartPanelFactory();
+
+    // XUIElementFactory
+    virtual css::uno::Reference<css::ui::XUIElement> SAL_CALL createUIElement(
+        const ::rtl::OUString& rsResourceURL,
+        const ::css::uno::Sequence<css::beans::PropertyValue>& rArguments)
+        throw(
+            css::container::NoSuchElementException,
+            css::lang::IllegalArgumentException,
+            css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
+
+    virtual OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+};
+
+} } // end of namespace sc::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
index 15c0a04..c26b96e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Factories.xcu
@@ -132,6 +132,20 @@
           <value>org.apache.openoffice.comp.sw.sidebar.SwPanelFactory</value>
         </prop>
       </node>
+      <node oor:name="ChartPanelFactory" oor:op="replace">
+        <prop oor:name="Type">
+          <value>toolpanel</value>
+        </prop>
+        <prop oor:name="Name">
+          <value>ChartPanelFactory</value>
+        </prop>
+        <prop oor:name="Module">
+          <value></value>
+        </prop>
+        <prop oor:name="FactoryImplementation">
+          <value>org.libreoffice.comp.chart2.sidebar.ChartPanelFactory</value>
+        </prop>
+      </node>
     </node>
   </node>
 </oor:component-data>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index 653d826..925e19a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -231,6 +231,26 @@
         </prop>
       </node>
 
+      <node oor:name="ChartDeck" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Chart</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ChartDeck</value>
+        </prop>
+        <prop oor:name="IconURL" oor:type="xs:string">
+          <value>private:graphicrepository/sfx2/res/symphony/sidebar-style-large.png</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Chart, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>10</value>
+        </prop>
+      </node>
+
     </node>
     <node oor:name="PanelList">
 
@@ -1086,6 +1106,122 @@
           <value>true</value>
         </prop>
       </node>
+
+      <node oor:name="ChartElementsPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Elements</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ChartElementsPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>ChartDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Chart, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ChartPanelFactory/ElementsPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
+
+      <node oor:name="ChartAreaPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Area</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ChartAreaPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>ChartDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Chart, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ChartPanelFactory/AreaPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>2</value>
+        </prop>
+      </node>
+
+      <node oor:name="ChartLinePanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Line</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ChartLinePanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>ChartDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Chart, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ChartPanelFactory/LinePanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>3</value>
+        </prop>
+      </node>
+
+      <node oor:name="ChartCharacterPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Character</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ChartCharacterPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>ChartDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Chart, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ChartPanelFactory/CharacterPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>4</value>
+        </prop>
+      </node>
+
+      <node oor:name="ChartAxisPanel" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value xml:lang="en-US">Axis</value>
+        </prop>
+        <prop oor:name="Id" oor:type="xs:string">
+          <value>ChartAxisPanel</value>
+        </prop>
+        <prop oor:name="DeckId" oor:type="xs:string">
+          <value>ChartDeck</value>
+        </prop>
+        <prop oor:name="ContextList">
+          <value oor:separator=";">
+            Chart, any, visible ;
+          </value>
+        </prop>
+        <prop oor:name="ImplementationURL" oor:type="xs:string">
+          <value>private:resource/toolpanel/ChartPanelFactory/AxisPanel</value>
+        </prop>
+        <prop oor:name="OrderIndex" oor:type="xs:int">
+          <value>5</value>
+        </prop>
+      </node>
+
     </node>
   </node>
 </oor:component-data>
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
index d5b90e0..1e6234a 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -86,12 +86,14 @@
                  com.sun.star.sheet.SpreadsheetDocument
                  com.sun.star.presentation.PresentationDocument
                  com.sun.star.drawing.DrawingDocument
+                 com.sun.star.chart2.ChartDocument
 
              Recognized shortcuts:
                  Writer
                  Calc
                  Impress
                  Draw
+                 Chart
 
              Shortcuts for multiple applications:
                  DrawImpress
diff --git a/sfx2/source/sidebar/Context.cxx b/sfx2/source/sidebar/Context.cxx
index 3a7ce01..9baf30b 100644
--- a/sfx2/source/sidebar/Context.cxx
+++ b/sfx2/source/sidebar/Context.cxx
@@ -46,7 +46,14 @@ Context::Context (
 sal_Int32 Context::EvaluateMatch (
     const Context& rOther) const
 {
-    const bool bApplicationNameIsAny (rOther.msApplication == AnyApplicationName);
+    bool bApplicationNameIsAny (rOther.msApplication == AnyApplicationName);
+
+    // special case for charts which use a whole own set of decks
+    if (msApplication == "com.sun.star.chart2.ChartDocument")
+    {
+        bApplicationNameIsAny = false;
+    }
+
     if (rOther.msApplication.equals(msApplication) || bApplicationNameIsAny)
     {
         // Application name matches.
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index 93a1b89..bce5bbc 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -416,6 +416,8 @@ void ResourceManager::ReadContextList (
                 aApplications.push_back(EnumContext::Application_Draw);
             else if (sApplicationName == "Impress")
                 aApplications.push_back(EnumContext::Application_Impress);
+            else if (sApplicationName == "Chart")
+                aApplications.push_back(EnumContext::Application_Chart);
             else if (sApplicationName == "DrawImpress")
             {
                 // A special case among the special names:  it is
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 027c886..c67447f 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -548,7 +548,6 @@ void SidebarController::CreateDeck(const ::rtl::OUString& rDeckId)
                 ::boost::bind(&SidebarController::RequestCloseDeck, this));
 
         mpResourceManager->SetDeckToDescriptor(rDeckId, aDeck);
-
     }
 
 }
commit 69dcdfed537ad3a871d4fe071f88553b1a3f151e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Jul 9 20:37:31 2015 +0200

    allow also to use non-frame modules for sidebar
    
    One more step away from using the frame as key and moving to the
    controller.
    
    Change-Id: I438b7eea2161d49a6f2cbf649bf01b8a2e233ebd

diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index d2b6645..39483ee 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -427,6 +427,7 @@ Reference< XUIElement > SAL_CALL UIElementFactoryManager::createUIElement(
 throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception )
 {
     Reference< XFrame > xFrame;
+    OUString aModuleId;
     { // SAFE
     osl::MutexGuard g(rBHelper.rMutex);
 
@@ -443,6 +444,8 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l
     {
         if ( Args[i].Name == "Frame")
             Args[i].Value >>= xFrame;
+        if (Args[i].Name == "Module")
+            Args[i].Value >>= aModuleId;
     }
     } // SAFE
 
@@ -451,8 +454,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l
     // Determine the module identifier
     try
     {
-        OUString aModuleId;
-        if ( xFrame.is() && xManager.is() )
+        if ( aModuleId.isEmpty() && xFrame.is() && xManager.is() )
             aModuleId = xManager->identify( Reference<XInterface>( xFrame, UNO_QUERY ) );
 
         Reference< XUIElementFactory > xUIElementFactory = getFactory( ResourceURL, aModuleId );
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index a2b0060..027c886 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -807,6 +807,16 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
             Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas());
             aCreationArguments.put("Canvas", makeAny(xCanvas));
         }
+
+        if (mxCurrentController.is())
+        {
+            OUString aModule = Tools::GetModuleName(mxCurrentController);
+            if (!aModule.isEmpty())
+            {
+                aCreationArguments.put("Module", makeAny(aModule));
+            }
+        }
+
         aCreationArguments.put("ApplicationName", makeAny(rContext.msApplication));
         aCreationArguments.put("ContextName", makeAny(rContext.msContext));
 
commit b9dd164f2f8de9356fec681c466599fb00a0c93b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Jul 9 16:21:39 2015 +0200

    use correct controller for sidebar
    
    As we now allow non-frame controllers we need to use them as well in
    this place.
    
    Change-Id: I0d86cdf73f8c044816def0aaafb874e75985aae5

diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index bdc1dc4..063a156 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -173,6 +173,7 @@ private:
     css::uno::Reference<css::frame::XFrame> mxFrame;
     Context maCurrentContext;
     Context maRequestedContext;
+    css::uno::Reference<css::frame::XController> mxCurrentController;
     /// Use a combination of SwitchFlag_* as value.
     sal_Int32 mnRequestedForceFlags;
     ::rtl::OUString msCurrentDeckId;
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index d73a0d9..a2b0060 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -266,6 +266,7 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex
         rEvent.ContextName);
     if (maRequestedContext != maCurrentContext)
     {
+        mxCurrentController = css::uno::Reference<css::frame::XController>(rEvent.Source, css::uno::UNO_QUERY);
         maAsynchronousDeckSwitch.CancelRequest();
         maContextChangeUpdate.RequestCall();
         // TODO: this call is redundant but mandatory for unit test to update context on document loading
@@ -436,11 +437,13 @@ void SidebarController::UpdateConfigurations()
         // Find the set of decks that could be displayed for the new context.
         ResourceManager::DeckContextDescriptorContainer aDecks;
 
+        css::uno::Reference<css::frame::XController> xController = mxCurrentController.is() ? mxCurrentController : mxFrame->getController();
+
         mpResourceManager->GetMatchingDecks (
             aDecks,
             maCurrentContext,
             mbIsDocumentReadOnly,
-            mxFrame->getController());
+            xController);
 
         // Notify the tab bar about the updated set of decks.
         mpTabBar->SetDecks(aDecks);
@@ -575,11 +578,13 @@ void SidebarController::SwitchToDeck (
     // Determine the panels to display in the deck.
     ResourceManager::PanelContextDescriptorContainer aPanelContextDescriptors;
 
+    css::uno::Reference<css::frame::XController> xController = mxCurrentController.is() ? mxCurrentController : mxFrame->getController();
+
     mpResourceManager->GetMatchingPanels(
         aPanelContextDescriptors,
         rContext,
         rDeckDescriptor.msId,
-        mxFrame->getController());
+        xController);
 
     if (aPanelContextDescriptors.empty())
     {
commit 29ae0c5bec20a4b2c5f71c15327a64da4fa95010
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jul 8 22:15:38 2015 +0200

    no need for handling unused arguments like that
    
    Change-Id: I04fa1b854e41a4cbeea0586bc583c58298d96306

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index b5865c4..d73a0d9 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -273,19 +273,15 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex
     }
 }
 
-void SAL_CALL SidebarController::disposing (const css::lang::EventObject& rEventObject)
+void SAL_CALL SidebarController::disposing (const css::lang::EventObject& )
     throw(css::uno::RuntimeException, std::exception)
 {
-    (void)rEventObject;
-
     dispose();
 }
 
-void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChangeEvent& rEvent)
+void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChangeEvent& )
     throw(css::uno::RuntimeException, std::exception)
 {
-    (void)rEvent;
-
     maPropertyChangeForwarder.RequestCall();
 }
 
commit ee8a926784690d8e799ddb680fed93423fe4742d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jul 8 21:10:23 2015 +0200

    fix indentation
    
    Change-Id: I90426772f59db1bdc695bb9a411eaaee19655ce7

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 61492ce..b5865c4 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -205,21 +205,21 @@ void SAL_CALL SidebarController::disposing()
         // clear decks
     ResourceManager::DeckContextDescriptorContainer aDecks;
 
-        mpResourceManager->GetMatchingDecks (
+    mpResourceManager->GetMatchingDecks (
             aDecks,
             GetCurrentContext(),
             IsDocumentReadOnly(),
             mxFrame->getController());
 
-        for (ResourceManager::DeckContextDescriptorContainer::const_iterator
+    for (ResourceManager::DeckContextDescriptorContainer::const_iterator
             iDeck(aDecks.begin()), iEnd(aDecks.end());
             iDeck!=iEnd; ++iDeck)
-            {
-                const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId);
-                VclPtr<Deck> aDeck = deckDesc->mpDeck;
-                if (aDeck)
-                    aDeck.disposeAndClear();
-            }
+    {
+        const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId);
+        VclPtr<Deck> aDeck = deckDesc->mpDeck;
+        if (aDeck)
+            aDeck.disposeAndClear();
+    }
 
     SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame->getController()));
     if (iEntry != maSidebarControllerContainer.end())


More information about the Libreoffice-commits mailing list