[Libreoffice-commits] core.git: Branch 'feature/chart-sidebar' - 2 commits - chart2/source include/sfx2 offapi/com offapi/UnoApi_offapi.mk sfx2/Library_sfx.mk sfx2/source

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Jul 22 16:30:56 PDT 2015


 chart2/source/controller/main/ChartController.cxx       |    1 
 chart2/source/controller/sidebar/ChartAreaPanel.cxx     |   28 ++++++++++++-
 chart2/source/controller/sidebar/ChartAreaPanel.hxx     |    6 ++
 chart2/source/controller/sidebar/ChartAxisPanel.cxx     |   12 +++++
 chart2/source/controller/sidebar/ChartAxisPanel.hxx     |    4 +
 chart2/source/controller/sidebar/ChartElementsPanel.cxx |   12 +++++
 chart2/source/controller/sidebar/ChartElementsPanel.hxx |    4 +
 chart2/source/controller/sidebar/ChartErrorBarPanel.cxx |   12 +++++
 chart2/source/controller/sidebar/ChartErrorBarPanel.hxx |    4 +
 chart2/source/controller/sidebar/ChartSeriesPanel.cxx   |   16 +++++++
 chart2/source/controller/sidebar/ChartSeriesPanel.hxx   |    4 +
 include/sfx2/sidebar/ResourceManager.hxx                |    2 
 include/sfx2/sidebar/SidebarController.hxx              |    2 
 include/sfx2/sidebar/SidebarModelUpdate.hxx             |   30 ++++++++++++++
 include/sfx2/sidebar/SidebarPanelBase.hxx               |   12 ++++-
 offapi/UnoApi_offapi.mk                                 |    1 
 offapi/com/sun/star/ui/XUpdateModel.idl                 |   34 ++++++++++++++++
 sfx2/Library_sfx.mk                                     |    1 
 sfx2/source/sidebar/ResourceManager.cxx                 |   19 ++++++++
 sfx2/source/sidebar/SidebarController.cxx               |    5 ++
 sfx2/source/sidebar/SidebarModelUpdate.cxx              |   20 +++++++++
 sfx2/source/sidebar/SidebarPanelBase.cxx                |   11 +++++
 22 files changed, 233 insertions(+), 7 deletions(-)

New commits:
commit 26601ddbfc2ced2dcc63633750816754c8dcb67e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Jul 23 01:20:45 2015 +0200

    handle more than one chart with chart sidebar
    
    Change-Id: I4998904a9273f2c67114a246d7f234843602573c

diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 9c51cf5..138fc65 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -421,6 +421,7 @@ void SAL_CALL ChartController::attachFrame(
     {
         sfx2::sidebar::SidebarController* pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
         sfx2::sidebar::SidebarController::registerSidebarForFrame(pSidebar, this);
+        pSidebar->updateModel(getModel());
     }
 
     if(m_xFrame.is()) //what happens, if we do have a Frame already??
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 945e505..897d8ad 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -170,6 +170,18 @@ void ChartAreaPanel::modelInvalid()
 {
 }
 
+void ChartAreaPanel::updateModel(
+        css::uno::Reference<css::frame::XModel> xModel)
+{
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcaster->removeModifyListener(mxListener);
+
+    mxModel = xModel;
+
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcasterNew->addModifyListener(mxListener);
+}
+
 
 } }
 
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index f5b45ae..07ca845 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -12,6 +12,7 @@
 
 #include <vcl/ctrl.hxx>
 #include <sfx2/sidebar/ControllerItem.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
 #include <svx/xgrad.hxx>
 #include <svx/itemwin.hxx>
 #include <svx/xfillit0.hxx>
@@ -44,7 +45,8 @@ class ChartController;
 namespace sidebar {
 
 class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase,
-    public ChartSidebarModifyListenerParent
+    public ChartSidebarModifyListenerParent,
+    public sfx2::sidebar::SidebarModelUpdate
 {
 public:
     static VclPtr<vcl::Window> Create(
@@ -74,6 +76,8 @@ public:
 
     virtual void dispose() SAL_OVERRIDE;
 
+    virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
 private:
 
     css::uno::Reference<css::frame::XModel> mxModel;
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index e6fa2e3..ba1a5e7 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -281,6 +281,18 @@ void ChartAxisPanel::modelInvalid()
 {
 }
 
+void ChartAxisPanel::updateModel(
+        css::uno::Reference<css::frame::XModel> xModel)
+{
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcaster->removeModifyListener(mxListener);
+
+    mxModel = xModel;
+
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcasterNew->addModifyListener(mxListener);
+}
+
 IMPL_LINK(ChartAxisPanel, CheckBoxHdl, CheckBox*, pCheckbox)
 {
     OUString aCID = getCID(mxModel);
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index 8737ab4..5c1177f 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -13,6 +13,7 @@
 
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
 
 #include "ChartSidebarModifyListener.hxx"
@@ -32,6 +33,7 @@ namespace sidebar {
 class ChartAxisPanel : public PanelLayout,
     public ::sfx2::sidebar::IContextChangeReceiver,
     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+    public sfx2::sidebar::SidebarModelUpdate,
     public ChartSidebarModifyListenerParent
 {
 public:
@@ -63,6 +65,8 @@ public:
     virtual void updateData() SAL_OVERRIDE;
     virtual void modelInvalid() SAL_OVERRIDE;
 
+    virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
 private:
     //ui controls
     VclPtr<CheckBox> mpCBShowLabel;
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 1cbec9e..fd498ff 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -451,6 +451,18 @@ void ChartElementsPanel::modelInvalid()
 
 }
 
+void ChartElementsPanel::updateModel(
+        css::uno::Reference<css::frame::XModel> xModel)
+{
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcaster->removeModifyListener(mxListener);
+
+    mxModel = xModel;
+
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcasterNew->addModifyListener(mxListener);
+}
+
 IMPL_LINK(ChartElementsPanel, CheckBoxHdl, CheckBox*, pCheckBox)
 {
     bool bChecked = pCheckBox->IsChecked();
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 32ffb7d..766915c 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -21,6 +21,7 @@
 
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
 #include "ChartSidebarModifyListener.hxx"
 
@@ -39,6 +40,7 @@ namespace sidebar {
 class ChartElementsPanel : public PanelLayout,
     public ::sfx2::sidebar::IContextChangeReceiver,
     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+    public sfx2::sidebar::SidebarModelUpdate,
     public ChartSidebarModifyListenerParent
 {
 public:
@@ -70,6 +72,8 @@ public:
     virtual void updateData() SAL_OVERRIDE;
     virtual void modelInvalid() SAL_OVERRIDE;
 
+    virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
 private:
     //ui controls
     VclPtr<CheckBox> mpCBTitle;
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index ccf7990..9a60f17 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -381,6 +381,18 @@ void ChartErrorBarPanel::modelInvalid()
 {
 }
 
+void ChartErrorBarPanel::updateModel(
+        css::uno::Reference<css::frame::XModel> xModel)
+{
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcaster->removeModifyListener(mxListener);
+
+    mxModel = xModel;
+
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcasterNew->addModifyListener(mxListener);
+}
+
 IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl)
 {
     OUString aCID = getCID(mxModel);
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
index 84d4b9c..e9c102b 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -13,6 +13,7 @@
 
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
 
 #include "ChartSidebarModifyListener.hxx"
@@ -33,6 +34,7 @@ namespace sidebar {
 class ChartErrorBarPanel : public PanelLayout,
     public ::sfx2::sidebar::IContextChangeReceiver,
     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+    public sfx2::sidebar::SidebarModelUpdate,
     public ChartSidebarModifyListenerParent
 {
 public:
@@ -64,6 +66,8 @@ public:
     virtual void updateData() SAL_OVERRIDE;
     virtual void modelInvalid() SAL_OVERRIDE;
 
+    virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
 private:
     //ui controls
     VclPtr<RadioButton> mpRBPosAndNeg;
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 5ae9f7a..22d13fd 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -269,7 +269,9 @@ OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
         return OUString();
 
     uno::Any aAny = xSelectionSupplier->getSelection();
-    assert(aAny.hasValue());
+    if (!aAny.hasValue())
+        return OUString();
+
     OUString aCID;
     aAny >>= aCID;
 #ifdef DBG_UTIL
@@ -410,6 +412,18 @@ void ChartSeriesPanel::modelInvalid()
 
 }
 
+void ChartSeriesPanel::updateModel(
+        css::uno::Reference<css::frame::XModel> xModel)
+{
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcaster->removeModifyListener(mxListener);
+
+    mxModel = xModel;
+
+    css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
+    xBroadcasterNew->addModifyListener(mxListener);
+}
+
 IMPL_LINK(ChartSeriesPanel, CheckBoxHdl, CheckBox*, pCheckBox)
 {
     bool bChecked = pCheckBox->IsChecked();
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
index 7c951f6..10d73ee 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -21,6 +21,7 @@
 
 #include <sfx2/sidebar/ControllerItem.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
 
 #include "ChartSidebarModifyListener.hxx"
@@ -40,6 +41,7 @@ namespace sidebar {
 class ChartSeriesPanel : public PanelLayout,
     public ::sfx2::sidebar::IContextChangeReceiver,
     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
+    public sfx2::sidebar::SidebarModelUpdate,
     public ChartSidebarModifyListenerParent
 {
 public:
@@ -71,6 +73,8 @@ public:
     virtual void updateData() SAL_OVERRIDE;
     virtual void modelInvalid() SAL_OVERRIDE;
 
+    virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE;
+
 private:
     //ui controls
     VclPtr<CheckBox> mpCBLabel;
diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx
index 568b7f8..8708707 100644
--- a/include/sfx2/sidebar/ResourceManager.hxx
+++ b/include/sfx2/sidebar/ResourceManager.hxx
@@ -66,6 +66,8 @@ public:
 
     void SetPanelOrderIndex(const OUString& rsPanelId, const sal_Int32 orderIndex);
 
+    void UpdateModel(css::uno::Reference<css::frame::XModel> xModel);
+
 
     class DeckContextDescriptor
     {
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index db0a9a1..00a53b3 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -156,6 +156,8 @@ public:
 
     void notifyDeckTitle(const OUString& targetDeckId);
 
+    void updateModel(css::uno::Reference<css::frame::XModel> xModel);
+
 private:
 
     VclPtr<Deck> mpCurrentDeck;
diff --git a/include/sfx2/sidebar/SidebarModelUpdate.hxx b/include/sfx2/sidebar/SidebarModelUpdate.hxx
new file mode 100644
index 0000000..981f7fa
--- /dev/null
+++ b/include/sfx2/sidebar/SidebarModelUpdate.hxx
@@ -0,0 +1,30 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_INCLUDE_SFX2_SIDEBAR_SIDEBARUPDATEMODEL_HXX
+#define INCLUDED_INCLUDE_SFX2_SIDEBAR_SIDEBARUPDATEMODEL_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <sfx2/dllapi.h>
+
+namespace sfx2 { namespace sidebar {
+
+class SFX2_DLLPUBLIC SidebarModelUpdate
+{
+public:
+    virtual ~SidebarModelUpdate();
+    virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) = 0;
+};
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/SidebarPanelBase.hxx b/include/sfx2/sidebar/SidebarPanelBase.hxx
index e08f3c3..2001bd0 100644
--- a/include/sfx2/sidebar/SidebarPanelBase.hxx
+++ b/include/sfx2/sidebar/SidebarPanelBase.hxx
@@ -22,7 +22,7 @@
 #include <sfx2/sidebar/EnumContext.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
 
-#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/compbase5.hxx>
 #include <cppuhelper/basemutex.hxx>
 
 #include <com/sun/star/frame/XController.hpp>
@@ -30,6 +30,7 @@
 #include <com/sun/star/ui/XUIElement.hpp>
 #include <com/sun/star/ui/XToolPanel.hpp>
 #include <com/sun/star/ui/XSidebarPanel.hpp>
+#include <com/sun/star/ui/XUpdateModel.hpp>
 
 #include <boost/noncopyable.hpp>
 #include <boost/function.hpp>
@@ -43,10 +44,11 @@ namespace sfx2 { namespace sidebar {
 namespace
 {
 
-typedef cppu::WeakComponentImplHelper4<css::ui::XContextChangeEventListener,
+typedef cppu::WeakComponentImplHelper5<css::ui::XContextChangeEventListener,
                                        css::ui::XUIElement,
                                        css::ui::XToolPanel,
-                                       css::ui::XSidebarPanel>
+                                       css::ui::XSidebarPanel,
+                                       css::ui::XUpdateModel>
             SidebarPanelBaseInterfaceBase;
 }
 
@@ -94,6 +96,10 @@ public:
     virtual sal_Int32 SAL_CALL getMinimalWidth()
         throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
+    // XUpdateModel
+    virtual void updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
+        throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
 protected:
     css::uno::Reference<css::frame::XFrame> mxFrame;
 
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index fd1b03a..0a915f4 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -4039,6 +4039,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ui,\
     XUIElementFactoryManager \
 	XUIElementFactoryRegistration \
 	XUIElementSettings \
+	XUpdateModel \
 	XUIFunctionListener \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/ui/dialogs,\
diff --git a/offapi/com/sun/star/ui/XUpdateModel.idl b/offapi/com/sun/star/ui/XUpdateModel.idl
new file mode 100644
index 0000000..59b1f68
--- /dev/null
+++ b/offapi/com/sun/star/ui/XUpdateModel.idl
@@ -0,0 +1,34 @@
+/* -*- 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/.
+ */
+
+#ifndef __com_sun_star_ui_XUpdateModel_idl__
+#define __com_sun_star_ui_XUpdateModel_idl__
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/frame/XModel.idl>
+
+
+module com { module sun { module star { module ui {
+
+
+/** Internal interface to update the used css::frame::XModel
+    </p>
+*/
+
+interface XUpdateModel : com::sun::star::uno::XInterface
+{
+    void updateModel( [in] com::sun::star::frame::XModel xModel);
+};
+
+}; }; }; };
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 5db89dd..7651013 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -251,6 +251,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/sidebar/SidebarChildWindow \
     sfx2/source/sidebar/SidebarDockingWindow \
     sfx2/source/sidebar/SidebarController \
+    sfx2/source/sidebar/SidebarModelUpdate \
     sfx2/source/sidebar/SidebarPanelBase \
     sfx2/source/sidebar/SidebarToolBox \
     sfx2/source/sidebar/Accessible \
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index bce5bbc..28f9e68 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -29,6 +29,7 @@
 #include <tools/diagnose_ex.h>
 
 #include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/ui/XUpdateModel.hpp>
 
 #include <map>
 
@@ -646,6 +647,24 @@ bool ResourceManager::IsDeckEnabled (
     return false;
 }
 
+void ResourceManager::UpdateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+    for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr) {
+        if (!itr->mpDeck)
+            continue;
+
+        const SharedPanelContainer& rContainer = itr->mpDeck->GetPanels();
+
+        for (SharedPanelContainer::const_iterator it = rContainer.begin(); it != rContainer.end(); ++it) {
+            css::uno::Reference<css::ui::XUpdateModel> xPanel((*it)->GetPanelComponent(), css::uno::UNO_QUERY);
+            xPanel->updateModel(xModel);
+        }
+
+    }
+
+
+}
+
 } } // end of namespace sfx2::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 2d86f65..8339127 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1252,6 +1252,11 @@ ResourceManager::PanelContextDescriptorContainer SidebarController::GetMatchingP
     return aPanels;
 }
 
+void SidebarController::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+    mpResourceManager->UpdateModel(xModel);
+}
+
 
 } } // end of namespace sfx2::sidebar
 
diff --git a/sfx2/source/sidebar/SidebarModelUpdate.cxx b/sfx2/source/sidebar/SidebarModelUpdate.cxx
new file mode 100644
index 0000000..91c423b
--- /dev/null
+++ b/sfx2/source/sidebar/SidebarModelUpdate.cxx
@@ -0,0 +1,20 @@
+/* -*- 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/.
+ */
+
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
+
+namespace sfx2 { namespace sidebar {
+
+SidebarModelUpdate::~SidebarModelUpdate()
+{
+}
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index a7ec830..c8d3992 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -20,6 +20,7 @@
 #include <sfx2/sidebar/Theme.hxx>
 #include <sfx2/sidebar/ILayoutableWindow.hxx>
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
 #include <sfx2/imagemgr.hxx>
 #include <vcl/ctrl.hxx>
 #include <vcl/layout.hxx>
@@ -203,6 +204,16 @@ sal_Int32 SAL_CALL SidebarPanelBase::getMinimalWidth () throw(css::uno::RuntimeE
     return 0;
 }
 
+void SAL_CALL SidebarPanelBase::updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
+    throw(css::uno::RuntimeException, std::exception)
+{
+    SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mpControl.get());
+    if (!pModelUpdate)
+        return;
+
+    pModelUpdate->updateModel(xModel);
+}
+
 } } // end of namespace sfx2::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5f5e2e1b580da966991270b89a418d5ca8132e84
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Jul 23 00:44:48 2015 +0200

    implement a few more methods
    
    Change-Id: Ieab088f2ad48f313c913424c60a10b59de4e0bcb

diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 13c4a7c..945e505 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -11,6 +11,9 @@
 
 #include "ChartController.hxx"
 
+#include <svx/xfltrit.hxx>
+#include <svx/xflftrit.hxx>
+
 namespace chart { namespace sidebar {
 
 namespace {
@@ -83,14 +86,23 @@ void ChartAreaPanel::Initialize()
     xBroadcaster->addModifyListener(mxListener);
 }
 
-void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& /*rItem*/)
+void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem)
 {
+    css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+    if (!xPropSet.is())
+        return;
 
+    xPropSet->setPropertyValue("Transparency", css::uno::makeAny(rItem.GetValue()));
 }
 
-void ChartAreaPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& /*rItem*/)
+void ChartAreaPanel::setFillFloatTransparence(
+        const XFillFloatTransparenceItem& rItem)
 {
+    css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
+    if (!xPropSet.is())
+        return;
 
+    xPropSet->setPropertyValue("TransparencyGradientName", css::uno::makeAny(rItem.GetValue()));
 }
 
 void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem)


More information about the Libreoffice-commits mailing list