Kaydet (Commit) 0635208e authored tarafından Markus Mohrhard's avatar Markus Mohrhard

handle more than one chart with chart sidebar

Change-Id: I4998904a9273f2c67114a246d7f234843602573c
üst cfac266d
......@@ -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??
......
......@@ -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);
}
} }
......
......@@ -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,9 @@ class ChartController;
namespace sidebar {
class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase,
public ChartSidebarModifyListenerParent
public sfx2::sidebar::SidebarModelUpdate,
public ChartSidebarModifyListenerParent,
public sfx2::sidebar::SidebarModelUpdate
{
public:
static VclPtr<vcl::Window> Create(
......@@ -74,6 +77,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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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
{
......
......@@ -156,6 +156,8 @@ public:
void notifyDeckTitle(const OUString& targetDeckId);
void updateModel(css::uno::Reference<css::frame::XModel> xModel);
private:
VclPtr<Deck> mpCurrentDeck;
......
/* -*- 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: */
......@@ -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 SAL_CALL 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;
......
......@@ -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,\
......
/* -*- 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: */
......@@ -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 \
......
......@@ -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: */
......@@ -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
......
/* -*- 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: */
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment