From d4d56067b7e0d654701912a3fd54cf2b452a8d28 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 16 Jul 2015 18:44:01 +0200 Subject: add skeleton for chart series panel Change-Id: Ib1e5da270812aa909a6e773abbd9716256f4d5f4 --- chart2/Library_chartcontroller.mk | 1 + chart2/UIConfig_chart2.mk | 1 + .../controller/sidebar/Chart2PanelFactory.cxx | 3 + .../source/controller/sidebar/ChartSeriesPanel.cxx | 129 +++++++++++++++++ .../source/controller/sidebar/ChartSeriesPanel.hxx | 90 ++++++++++++ chart2/uiconfig/ui/sidebarseries.ui | 156 +++++++++++++++++++++ 6 files changed, 380 insertions(+) create mode 100644 chart2/source/controller/sidebar/ChartSeriesPanel.cxx create mode 100644 chart2/source/controller/sidebar/ChartSeriesPanel.hxx create mode 100644 chart2/uiconfig/ui/sidebarseries.ui diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index 1b2b46dbe300..facaf66eedca 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -189,6 +189,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\ chart2/source/controller/main/UndoGuard \ chart2/source/controller/sidebar/Chart2PanelFactory \ chart2/source/controller/sidebar/ChartElementsPanel \ + chart2/source/controller/sidebar/ChartSeriesPanel \ )) # Runtime dependency for unit-tests diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk index ab8ce34a9e03..d2e840871aed 100644 --- a/chart2/UIConfig_chart2.mk +++ b/chart2/UIConfig_chart2.mk @@ -43,6 +43,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\ chart2/uiconfig/ui/inserttitledlg \ chart2/uiconfig/ui/paradialog \ chart2/uiconfig/ui/sidebarelements \ + chart2/uiconfig/ui/sidebarseries \ chart2/uiconfig/ui/smoothlinesdlg \ chart2/uiconfig/ui/steppedlinesdlg \ chart2/uiconfig/ui/titlerotationtabpage \ diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx index 29ea916783cf..61e167700216 100644 --- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx +++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx @@ -30,6 +30,7 @@ #include #include "ChartElementsPanel.hxx" +#include "ChartSeriesPanel.hxx" #include "ChartController.hxx" using namespace css::uno; @@ -93,6 +94,8 @@ Reference SAL_CALL ChartPanelFactory::createUIElement ( VclPtr pPanel; if (rsResourceURL.endsWith("/ElementsPanel")) pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pBindings, pController ); + else if (rsResourceURL.endsWith("/SeriesPanel")) + pPanel = ChartSeriesPanel::Create(pParentWindow, xFrame, pBindings, pController); /* else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel")) pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx new file mode 100644 index 000000000000..732aefc9c014 --- /dev/null +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx @@ -0,0 +1,129 @@ +/* -*- 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 +#include +#include + +#include "ChartSeriesPanel.hxx" +#include "ChartController.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ChartModel.hxx" + +using namespace css; +using namespace css::uno; +using ::sfx2::sidebar::Theme; + +namespace chart { namespace sidebar { + +ChartSeriesPanel::ChartSeriesPanel( + vcl::Window* pParent, + const css::uno::Reference& rxFrame, + SfxBindings* pBindings, + ChartController* pController) + : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui", rxFrame), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings), + mxModel(pController->getModel()) +{ + Initialize(); +} + +ChartSeriesPanel::~ChartSeriesPanel() +{ + disposeOnce(); +} + +void ChartSeriesPanel::dispose() +{ + + PanelLayout::dispose(); +} + +void ChartSeriesPanel::Initialize() +{ +} + +void ChartSeriesPanel::updateData() +{ + SolarMutexGuard aGuard; +} + +VclPtr ChartSeriesPanel::Create ( + vcl::Window* pParent, + const css::uno::Reference& rxFrame, + SfxBindings* pBindings, ChartController* pController) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException("no parent Window given to ChartSeriesPanel::Create", NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException("no XFrame given to ChartSeriesPanel::Create", NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException("no SfxBindings given to ChartSeriesPanel::Create", NULL, 2); + + return VclPtr::Create( + pParent, rxFrame, pBindings, pController); +} + +void ChartSeriesPanel::DataChanged( + const DataChangedEvent& ) +{ + updateData(); +} + +void ChartSeriesPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext& rContext) +{ + if(maContext == rContext) + { + // Nothing to do. + return; + } + + maContext = rContext; + updateData(); +} + +void ChartSeriesPanel::NotifyItemUpdate( + sal_uInt16 /*nSID*/, + SfxItemState /*eState*/, + const SfxPoolItem* /*pState*/, + const bool ) +{ +} + +void ChartSeriesPanel::modelInvalid() +{ + +} + +}} // end of namespace ::chart::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx new file mode 100644 index 000000000000..6fa61e351a76 --- /dev/null +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx @@ -0,0 +1,90 @@ +/* -*- 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_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSERIESPANEL_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSERIESPANEL_HXX + +#include +#include +#include + +#include + +class FixedText; +class ListBox; +class NumericField; + +namespace chart { + +class ChartController; + +namespace sidebar { + +class ChartSeriesPanel : public PanelLayout, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static VclPtr Create( + vcl::Window* pParent, + const css::uno::Reference& rxFrame, + SfxBindings* pBindings, ChartController* pController); + + virtual void DataChanged( + const DataChangedEvent& rEvent) SAL_OVERRIDE; + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext& rContext) SAL_OVERRIDE; + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState, + const bool bIsEnabled) SAL_OVERRIDE; + + SfxBindings* GetBindings() { return mpBindings;} + + // constructor/destuctor + ChartSeriesPanel( + vcl::Window* pParent, + const css::uno::Reference& rxFrame, + SfxBindings* pBindings, ChartController* pController); + virtual ~ChartSeriesPanel(); + virtual void dispose() SAL_OVERRIDE; + + void updateData(); + void modelInvalid(); + +private: + //ui controls + + css::uno::Reference mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + css::uno::Reference mxModel; + css::uno::Reference mxListener; + + void Initialize(); +}; + +} } // end of namespace ::chart::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/uiconfig/ui/sidebarseries.ui b/chart2/uiconfig/ui/sidebarseries.ui new file mode 100644 index 000000000000..afcc7a995911 --- /dev/null +++ b/chart2/uiconfig/ui/sidebarseries.ui @@ -0,0 +1,156 @@ + + + + + + True + False + + + True + False + + + True + False + label + + + 0 + 0 + + + + + Show data label + True + True + False + 0 + True + + + 0 + 1 + + + + + Trendline + True + True + False + 0 + True + + + 0 + 2 + + + + + True + False + Axis: + + + 0 + 3 + + + + + Primary Y-Axis + True + True + False + 0 + True + True + + + 1 + 3 + + + + + Secondary Y-Axis + True + True + False + 0 + 0.49000000953674316 + True + True + radiobutton_primary_axis + + + 1 + 4 + + + + + Y Error Bars + True + True + False + 0 + True + + + 0 + 5 + + + + + X Error Bars + True + True + False + 0 + True + + + 1 + 5 + + + + + True + False + + Above + Below + Center + Outside + Inside + Near origin + + + + 1 + 1 + + + + + + + + + + + + + + 0 + 0 + + + + -- cgit