| 1 |
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* This file is part of the LibreOffice project. |
| 4 |
* |
| 5 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 6 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 7 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 8 |
* |
| 9 |
*/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include <com/sun/star/frame/XFrame.hpp> |
| 14 |
|
| 15 |
#include <sfx2/sidebar/ControllerItem.hxx> |
| 16 |
#include <sfx2/sidebar/IContextChangeReceiver.hxx> |
| 17 |
#include <sfx2/sidebar/SidebarModelUpdate.hxx> |
| 18 |
#include <sfx2/sidebar/PanelLayout.hxx> |
| 19 |
#include "ChartSidebarModifyListener.hxx" |
| 20 |
#include "ChartSidebarSelectionListener.hxx" |
| 21 |
|
| 22 |
class ToolbarUnoDispatcher; |
| 23 |
|
| 24 |
namespace chart |
| 25 |
{ |
| 26 |
class ChartController; |
| 27 |
|
| 28 |
namespace sidebar |
| 29 |
{ |
| 30 |
class ColorPaletteWrapper; |
| 31 |
|
| 32 |
class ChartColorsPanel final : public PanelLayout, |
| 33 |
public sfx2::sidebar::IContextChangeReceiver, |
| 34 |
public sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface, |
| 35 |
public sfx2::sidebar::SidebarModelUpdate, |
| 36 |
public ChartSidebarModifyListenerParent, |
| 37 |
public ChartSidebarSelectionListenerParent |
| 38 |
{ |
| 39 |
public: |
| 40 |
static const std::vector<ObjectType> maAcceptedTypes; |
| 41 |
|
| 42 |
static std::unique_ptr<PanelLayout> |
| 43 |
Create(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, |
| 44 |
ChartController* pController); |
| 45 |
|
| 46 |
void DataChanged(const DataChangedEvent& rEvent) override; |
| 47 |
|
| 48 |
void HandleContextChange(const vcl::EnumContext& rContext) override; |
| 49 |
|
| 50 |
void NotifyItemUpdate(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState) override; |
| 51 |
|
| 52 |
void GetControlState(const sal_uInt16 /*nSId*/, |
| 53 |
boost::property_tree::ptree& /*rState*/) override |
| 54 |
{ |
| 55 |
} |
| 56 |
|
| 57 |
// constructor/destructor |
| 58 |
ChartColorsPanel(weld::Widget* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, |
| 59 |
ChartController* pController); |
| 60 |
~ChartColorsPanel() override; |
| 61 |
|
| 62 |
void updateData() override; |
| 63 |
void modelInvalid() override; |
| 64 |
|
| 65 |
void selectionChanged(bool bCorrectType) override; |
| 66 |
|
| 67 |
void updateModel(css::uno::Reference<css::frame::XModel> xModel) override; |
| 68 |
|
| 69 |
private: |
| 70 |
rtl::Reference<ChartModel> mxModel; |
| 71 |
css::uno::Reference<css::util::XModifyListener> mxModifyListener; |
| 72 |
rtl::Reference<ChartSidebarSelectionListener> mxSelectionListener; |
| 73 |
|
| 74 |
bool mbModelValid; |
| 75 |
|
| 76 |
std::unique_ptr<weld::Toolbar> mxColorPaletteTB; |
| 77 |
std::unique_ptr<ToolbarUnoDispatcher> mxColorPaletteDispatch; |
| 78 |
std::shared_ptr<ColorPaletteWrapper> mxColorPaletteWrapper; |
| 79 |
|
| 80 |
void Initialize(); |
| 81 |
void doUpdateModel(const rtl::Reference<ChartModel>& xModel); |
| 82 |
}; |
| 83 |
} // end of namespace sidebar |
| 84 |
} // end of namespace chart |
| 85 |
|
| 86 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |