diff options
-rw-r--r-- | chart2/source/controller/inc/ChartController.hxx (renamed from chart2/source/controller/main/ChartController.hxx) | 0 | ||||
-rw-r--r-- | chart2/source/controller/inc/CommandDispatchContainer.hxx (renamed from chart2/source/controller/main/CommandDispatchContainer.hxx) | 0 | ||||
-rw-r--r-- | chart2/source/controller/inc/SelectionHelper.hxx (renamed from chart2/source/controller/main/SelectionHelper.hxx) | 0 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/Chart2PanelFactory.cxx | 37 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/ChartElementsPanel.cxx | 28 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/ChartElementsPanel.hxx | 14 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 1 |
7 files changed, 60 insertions, 20 deletions
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index e15f8c6e5658..e15f8c6e5658 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx index adea7db9f2bb..adea7db9f2bb 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.hxx +++ b/chart2/source/controller/inc/CommandDispatchContainer.hxx diff --git a/chart2/source/controller/main/SelectionHelper.hxx b/chart2/source/controller/inc/SelectionHelper.hxx index e10acaafc8ea..e10acaafc8ea 100644 --- a/chart2/source/controller/main/SelectionHelper.hxx +++ b/chart2/source/controller/inc/SelectionHelper.hxx diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx index 12222412604b..29ea916783cf 100644 --- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx +++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx @@ -30,8 +30,8 @@ #include <cppuhelper/supportsservice.hxx> #include "ChartElementsPanel.hxx" +#include "ChartController.hxx" -using namespace css; using namespace css::uno; using ::rtl::OUString; @@ -46,23 +46,24 @@ ChartPanelFactory::~ChartPanelFactory() { } -Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement ( +Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement ( const ::rtl::OUString& rsResourceURL, const ::css::uno::Sequence<css::beans::PropertyValue>& rArguments) throw( - container::NoSuchElementException, - lang::IllegalArgumentException, + css::container::NoSuchElementException, + css::lang::IllegalArgumentException, RuntimeException, std::exception) { - Reference<ui::XUIElement> xElement; + Reference<css::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>())); + Reference<css::frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<css::frame::XFrame>())); + Reference<css::awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<css::awt::XWindow>())); const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + Reference<css::frame::XController> xController (aArguments.getOrDefault("Controller", Reference<css::frame::XController>())); vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); if ( ! xParentWindow.is() || pParentWindow==NULL) @@ -77,11 +78,21 @@ Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement ( throw RuntimeException( "PanelFactory::createUIElement called without SfxBindings", NULL); + if (!xController.is()) + throw RuntimeException( + "ChartPanelFactory::createUIElement called without Controller", + NULL); + + ChartController* pController = dynamic_cast<ChartController*>(xController.get()); + if (!pController) + throw RuntimeException( + "ChartPanelFactory::createUIElement called without valid ChartController", + NULL); sal_Int32 nMinimumSize = -1; VclPtr<vcl::Window> pPanel; if (rsResourceURL.endsWith("/ElementsPanel")) - pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pBindings ); + pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pBindings, pController ); /* else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel")) pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); @@ -104,17 +115,17 @@ Reference<ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement ( rsResourceURL, xFrame, pPanel, - ui::LayoutSize(nMinimumSize,-1,-1)); + css::ui::LayoutSize(nMinimumSize,-1,-1)); } - catch (const uno::RuntimeException &) + catch (const css::uno::RuntimeException &) { throw; } - catch (const uno::Exception& e) + catch (const css::uno::Exception& e) { - throw lang::WrappedTargetRuntimeException( + throw css::lang::WrappedTargetRuntimeException( OUString("ChartPanelFactory::createUIElement exception"), - 0, uno::makeAny(e)); + 0, css::uno::makeAny(e)); } return xElement; diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 343421702a0d..658df2a6de6c 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -21,6 +21,7 @@ #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ControlFactory.hxx> #include "ChartElementsPanel.hxx" +#include "ChartController.hxx" #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/imagemgr.hxx> @@ -40,11 +41,13 @@ namespace chart { namespace sidebar { ChartElementsPanel::ChartElementsPanel( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings) + SfxBindings* pBindings, + ChartController* pController) : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui", rxFrame), mxFrame(rxFrame), maContext(), - mpBindings(pBindings) + mpBindings(pBindings), + mxModel(pController->getModel()) { get(mpCBTitle, "checkbutton_title"); get(mpCBSubtitle, "checkbutton_subtitle"); @@ -93,10 +96,27 @@ void ChartElementsPanel::dispose() PanelLayout::dispose(); } +void ChartElementsPanel::Initialize() +{ + updateData(); +} + +void ChartElementsPanel::updateData() +{ + mpCBLegend->Check(isLegendVisible(mxModel)); + mpCBTitle->Check(isTitleVisisble(mxModel, TitleHelper::MAIN_TITLE)); + mpCBSubtitle->Check(isTitleVisisble(mxModel, TitleHelper::SUB_TITLE)); + mpCBXAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::X_AXIS_TITLE)); + mpCBYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Y_AXIS_TITLE)); + mpCBZAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::Z_AXIS_TITLE)); + mpCB2ndXAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE)); + mpCB2ndYAxisTitle->Check(isTitleVisisble(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE)); +} + VclPtr<vcl::Window> ChartElementsPanel::Create ( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings) + SfxBindings* pBindings, ChartController* pController) { if (pParent == NULL) throw lang::IllegalArgumentException("no parent Window given to ChartElementsPanel::Create", NULL, 0); @@ -106,7 +126,7 @@ VclPtr<vcl::Window> ChartElementsPanel::Create ( throw lang::IllegalArgumentException("no SfxBindings given to ChartElementsPanel::Create", NULL, 2); return VclPtr<ChartElementsPanel>::Create( - pParent, rxFrame, pBindings); + pParent, rxFrame, pBindings, pController); } void ChartElementsPanel::DataChanged( diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx index f23fa1a55dc7..be53c758201f 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx @@ -28,7 +28,11 @@ class FixedText; class ListBox; class NumericField; -namespace chart { namespace sidebar { +namespace chart { + +class ChartController; + +namespace sidebar { class ChartElementsPanel : public PanelLayout, public ::sfx2::sidebar::IContextChangeReceiver, @@ -38,7 +42,7 @@ public: static VclPtr<vcl::Window> Create( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); + SfxBindings* pBindings, ChartController* pController); virtual void DataChanged( const DataChangedEvent& rEvent) SAL_OVERRIDE; @@ -58,7 +62,7 @@ public: ChartElementsPanel( vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, - SfxBindings* pBindings); + SfxBindings* pBindings, ChartController* pController); virtual ~ChartElementsPanel(); virtual void dispose() SAL_OVERRIDE; private: @@ -88,6 +92,10 @@ private: css::uno::Reference<css::frame::XFrame> mxFrame; ::sfx2::sidebar::EnumContext maContext; SfxBindings* mpBindings; + + css::uno::Reference<css::frame::XModel> mxModel; + + void Initialize(); }; } } // end of namespace ::chart::sidebar diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index a87b65352eed..2d86f6598e87 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -802,6 +802,7 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement ( { aCreationArguments.put("Module", makeAny(aModule)); } + aCreationArguments.put("Controller", makeAny(mxCurrentController)); } aCreationArguments.put("ApplicationName", makeAny(rContext.msApplication)); |