summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-10-14 19:20:16 +0300
committerAndras Timar <andras.timar@collabora.com>2020-05-17 10:40:55 +0200
commit07c456b5d6e5f52d273c75e7d80976dbea1bdb6b (patch)
tree50aec20a9c1c7b3838d0bef1797e93ac9c388151 /chart2
parentc36e48379ad8cbb6a6a900c28b581f889c2be250 (diff)
Add ChartTypePanel to the ChartDeck
Consists of the first part of the implementation. Pushing to be able to see/use/tinker with it on the online/mobile side. Will be completed with follow-up patches. Change-Id: If49be54418c3b4c5ccc92fc7ee3e414847904162 Reviewed-on: https://gerrit.libreoffice.org/80799 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/82663 Tested-by: Jenkins
Diffstat (limited to 'chart2')
-rw-r--r--chart2/Library_chartcontroller.mk1
-rw-r--r--chart2/UIConfig_chart2.mk1
-rw-r--r--chart2/source/controller/sidebar/Chart2PanelFactory.cxx3
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.cxx553
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.hxx138
-rw-r--r--chart2/uiconfig/ui/sidebartype.ui367
6 files changed, 1063 insertions, 0 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index e57a170a80c7..114fa599b11d 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -196,6 +196,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/sidebar/ChartSeriesPanel \
chart2/source/controller/sidebar/ChartSidebarModifyListener \
chart2/source/controller/sidebar/ChartSidebarSelectionListener \
+ chart2/source/controller/sidebar/ChartTypePanel \
chart2/source/controller/uitest/uiobject \
))
diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk
index 8f703489092d..da0fcc1259a8 100644
--- a/chart2/UIConfig_chart2.mk
+++ b/chart2/UIConfig_chart2.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\
chart2/uiconfig/ui/sidebarelements \
chart2/uiconfig/ui/sidebarerrorbar \
chart2/uiconfig/ui/sidebarseries \
+ chart2/uiconfig/ui/sidebartype \
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 005aff6ebd5c..33e5c75d7f82 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -28,6 +28,7 @@
#include <cppuhelper/supportsservice.hxx>
#include "ChartElementsPanel.hxx"
+#include "ChartTypePanel.hxx"
#include "ChartSeriesPanel.hxx"
#include <ChartController.hxx>
#include "ChartAxisPanel.hxx"
@@ -84,6 +85,8 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
VclPtr<vcl::Window> pPanel;
if (rsResourceURL.endsWith("/ElementsPanel"))
pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pController );
+ else if (rsResourceURL.endsWith("/TypePanel"))
+ pPanel = ChartTypePanel::Create( pParentWindow, xFrame, pController );
else if (rsResourceURL.endsWith("/SeriesPanel"))
pPanel = ChartSeriesPanel::Create(pParentWindow, xFrame, pController);
else if (rsResourceURL.endsWith("/AxisPanel"))
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx
new file mode 100644
index 000000000000..9539095e26c5
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx
@@ -0,0 +1,553 @@
+/* -*- 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 "ChartTypePanel.hxx"
+
+#include <bitmaps.hlst>
+#include <ChartController.hxx>
+#include <ChartModel.hxx>
+#include <ChartModelHelper.hxx>
+#include <ChartTypeDialogController.hxx>
+#include <ChartTypeHelper.hxx>
+#include <DiagramHelper.hxx>
+#include <ResId.hxx>
+#include <strings.hrc>
+#include <unonames.hxx>
+
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/sidebar/ControlFactory.hxx>
+
+#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/button.hxx>
+
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <svtools/valueset.hxx>
+#include <tools/diagnose_ex.h>
+
+//Borrowed from vcl/inc/bitmaps.hlst
+#define IMG_ERROR "dbaccess/res/exerror.png"
+#define IMG_INFO "dbaccess/res/exinfo.png"
+#define IMG_WARN "dbaccess/res/exwarning.png"
+
+using namespace css;
+using namespace css::uno;
+
+namespace chart
+{
+enum
+{
+ POS_3DSCHEME_SIMPLE = 0,
+ POS_3DSCHEME_REALISTIC = 1
+};
+
+class Dim3DLookResourceGroup_unwelded : public ChangingResource
+{
+public:
+ explicit Dim3DLookResourceGroup_unwelded(VclBuilderContainer* pWindow);
+
+ void showControls(bool bShow);
+
+ void fillControls(const ChartTypeParameter& rParameter);
+ void fillParameter(ChartTypeParameter& rParameter);
+
+private:
+ DECL_LINK(Dim3DLookCheckHdl, CheckBox&, void);
+ DECL_LINK(SelectSchemeHdl, ListBox&, void);
+
+private:
+ VclPtr<CheckBox> m_pCB_3DLook;
+ VclPtr<ListBox> m_pLB_Scheme;
+};
+
+Dim3DLookResourceGroup_unwelded::Dim3DLookResourceGroup_unwelded(VclBuilderContainer* pWindow)
+ : ChangingResource()
+{
+ pWindow->get(m_pCB_3DLook, "3dlook");
+ pWindow->get(m_pLB_Scheme, "3dscheme");
+
+ m_pCB_3DLook->SetToggleHdl(LINK(this, Dim3DLookResourceGroup_unwelded, Dim3DLookCheckHdl));
+ m_pLB_Scheme->SetSelectHdl(LINK(this, Dim3DLookResourceGroup_unwelded, SelectSchemeHdl));
+}
+
+void Dim3DLookResourceGroup_unwelded::showControls(bool bShow)
+{
+ m_pCB_3DLook->Show(bShow);
+ m_pLB_Scheme->Show(bShow);
+}
+
+void Dim3DLookResourceGroup_unwelded::fillControls(const ChartTypeParameter& rParameter)
+{
+ m_pCB_3DLook->Check(rParameter.b3DLook);
+ m_pLB_Scheme->Enable(rParameter.b3DLook);
+
+ if (rParameter.eThreeDLookScheme == ThreeDLookScheme_Simple)
+ m_pLB_Scheme->SelectEntryPos(POS_3DSCHEME_SIMPLE);
+ else if (rParameter.eThreeDLookScheme == ThreeDLookScheme_Realistic)
+ m_pLB_Scheme->SelectEntryPos(POS_3DSCHEME_REALISTIC);
+ else
+ m_pLB_Scheme->SetNoSelection();
+}
+
+void Dim3DLookResourceGroup_unwelded::fillParameter(ChartTypeParameter& rParameter)
+{
+ rParameter.b3DLook = m_pCB_3DLook->IsChecked();
+ const sal_Int32 nPos = m_pLB_Scheme->GetSelectedEntryPos();
+ if (nPos == POS_3DSCHEME_SIMPLE)
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Simple;
+ else if (nPos == POS_3DSCHEME_REALISTIC)
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
+ else
+ rParameter.eThreeDLookScheme = ThreeDLookScheme_Unknown;
+}
+
+IMPL_LINK_NOARG(Dim3DLookResourceGroup_unwelded, Dim3DLookCheckHdl, CheckBox&, void)
+{
+ if (m_pChangeListener)
+ m_pChangeListener->stateChanged();
+}
+
+IMPL_LINK_NOARG(Dim3DLookResourceGroup_unwelded, SelectSchemeHdl, ListBox&, void)
+{
+ if (m_pChangeListener)
+ m_pChangeListener->stateChanged();
+}
+
+namespace sidebar
+{
+namespace
+{
+Image createImage(const OUString& rImage)
+{
+ if (rImage.lastIndexOf('.') != rImage.getLength() - 4)
+ {
+ assert((rImage == "dialog-warning" || rImage == "dialog-error"
+ || rImage == "dialog-information")
+ && "unknown stock image");
+ if (rImage == "dialog-warning")
+ return Image(BitmapEx(IMG_WARN));
+ else if (rImage == "dialog-error")
+ return Image(BitmapEx(IMG_ERROR));
+ else if (rImage == "dialog-information")
+ return Image(BitmapEx(IMG_INFO));
+ }
+ return Image(BitmapEx(rImage));
+}
+} //end of anonymous namespace
+
+ChartTypePanel::ChartTypePanel(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ::chart::ChartController* pController)
+ : PanelLayout(pParent, "ChartTypePanel", "modules/schart/ui/sidebartype.ui", rxFrame)
+ , maContext()
+ , mxModel(pController->getModel())
+ , mxListener(new ChartSidebarModifyListener(this))
+ , mbModelValid(true)
+ , m_pDim3DLookResourceGroup(new Dim3DLookResourceGroup_unwelded(this))
+ , m_xChartModel(mxModel, css::uno::UNO_QUERY_THROW)
+ , m_aChartTypeDialogControllerList(0)
+ , m_pCurrentMainType(nullptr)
+ , m_nChangingCalls(0)
+ , m_aTimerTriggeredControllerLock(m_xChartModel)
+{
+ get(mpChartTypeLabel, "lbl_chartType");
+ get(m_pMainTypeList, "cmb_chartType");
+ get(m_pSubTypeList, "subtype");
+
+ //Chart Type related
+ /*m_pMainTypeList->SetSelectHdl(LINK(this, ChartTypePanel, SelectMainTypeHdl));
+ m_pSubTypeList->SetSelectHdl(LINK(this, ChartTypePanel, SelectSubTypeHdl));*/
+
+ Size aSize(m_pSubTypeList->LogicToPixel(Size(120, 40), MapMode(MapUnit::MapAppFont)));
+ m_pSubTypeList->set_width_request(aSize.Width());
+ m_pSubTypeList->set_height_request(aSize.Height());
+
+ m_pSubTypeList->SetStyle(m_pSubTypeList->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER
+ | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK);
+ m_pSubTypeList->SetColCount(4);
+ m_pSubTypeList->SetLineCount(1);
+
+ bool bEnableComplexChartTypes = true;
+ uno::Reference<beans::XPropertySet> xProps(m_xChartModel, uno::UNO_QUERY);
+ if (xProps.is())
+ {
+ try
+ {
+ xProps->getPropertyValue("EnableComplexChartTypes") >>= bEnableComplexChartTypes;
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("chart2", "");
+ }
+ }
+
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<ColumnChartDialogController>());
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<BarChartDialogController>());
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<PieChartDialogController>());
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<AreaChartDialogController>());
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<LineChartDialogController>());
+
+ if (bEnableComplexChartTypes)
+ {
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<XYChartDialogController>());
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<BubbleChartDialogController>());
+ }
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<NetChartDialogController>());
+ if (bEnableComplexChartTypes)
+ {
+ m_aChartTypeDialogControllerList.push_back(std::make_unique<StockChartDialogController>());
+ }
+ m_aChartTypeDialogControllerList.push_back(
+ std::make_unique<CombiColumnLineChartDialogController>());
+
+ for (auto const& elem : m_aChartTypeDialogControllerList)
+ {
+ m_pMainTypeList->InsertEntry(elem->getName(), createImage(elem->getImage()));
+ elem->setChangeListener(this);
+ }
+
+ m_pDim3DLookResourceGroup->setChangeListener(this);
+
+ Initialize();
+}
+
+ChartTypePanel::~ChartTypePanel() { disposeOnce(); }
+
+void ChartTypePanel::dispose()
+{
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel,
+ css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+
+ mpChartTypeLabel.clear();
+ m_pMainTypeList.clear();
+ m_pSubTypeList.clear();
+
+ //delete all resource helpers
+ m_pDim3DLookResourceGroup.reset();
+
+ PanelLayout::dispose();
+}
+
+/*IMPL_LINK_NOARG(ChartTypePanel, SelectMainTypeHdl, ListBox&, void)
+{
+ //selectMainType();
+}
+
+IMPL_LINK_NOARG(ChartTypePanel, SelectSubTypeHdl, ValueSet*, void)
+{
+ if( m_pCurrentMainType )
+ {
+ ChartTypeParameter aParameter( getCurrentParamter() );
+ m_pCurrentMainType->adjustParameterToSubType( aParameter );
+ fillAllControls( aParameter, false );
+ commitToModel( aParameter );
+ }
+}*/
+
+void ChartTypePanel::Initialize()
+{
+ if (!m_xChartModel.is())
+ return;
+ uno::Reference<lang::XMultiServiceFactory> xTemplateManager(
+ m_xChartModel->getChartTypeManager(), uno::UNO_QUERY);
+ uno::Reference<frame::XModel> xModel(m_xChartModel);
+ uno::Reference<css::chart2::XDiagram> xDiagram(ChartModelHelper::findDiagram(xModel));
+ DiagramHelper::tTemplateWithServiceName aTemplate
+ = DiagramHelper::getTemplateForDiagram(xDiagram, xTemplateManager);
+ OUString aServiceName(aTemplate.second);
+
+ bool bFound = false;
+
+ sal_uInt16 nM = 0;
+ for (auto const& elem : m_aChartTypeDialogControllerList)
+ {
+ if (elem->isSubType(aServiceName))
+ {
+ bFound = true;
+
+ m_pMainTypeList->SelectEntryPos(nM);
+ showAllControls(*elem);
+ uno::Reference<beans::XPropertySet> xTemplateProps(aTemplate.first, uno::UNO_QUERY);
+ ChartTypeParameter aParameter
+ = elem->getChartTypeParameterForService(aServiceName, xTemplateProps);
+ m_pCurrentMainType = getSelectedMainType();
+
+ //set ThreeDLookScheme
+ aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
+ if (!aParameter.b3DLook && aParameter.eThreeDLookScheme != ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
+ xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES)
+ >>= aParameter.bSortByXValues;
+ }
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+
+ fillAllControls(aParameter);
+ if (m_pCurrentMainType)
+ m_pCurrentMainType->fillExtraControls(m_xChartModel, xTemplateProps);
+ break;
+ }
+ ++nM;
+ }
+
+ if (!bFound)
+ {
+ m_pSubTypeList->Hide();
+ m_pDim3DLookResourceGroup->showControls(false);
+ /*m_pStackingResourceGroup->showControls( false, false );
+ m_pSplineResourceGroup->showControls( false );
+ m_pGeometryResourceGroup->showControls( false );
+ m_pSortByXValuesResourceGroup->showControls( false );*/
+ }
+}
+
+void ChartTypePanel::updateData()
+{
+ // Chart Type related
+ if (!m_xChartModel.is())
+ return;
+ uno::Reference<lang::XMultiServiceFactory> xTemplateManager(
+ m_xChartModel->getChartTypeManager(), uno::UNO_QUERY);
+ uno::Reference<frame::XModel> xModel(m_xChartModel);
+ uno::Reference<css::chart2::XDiagram> xDiagram(ChartModelHelper::findDiagram(xModel));
+ DiagramHelper::tTemplateWithServiceName aTemplate
+ = DiagramHelper::getTemplateForDiagram(xDiagram, xTemplateManager);
+ OUString aServiceName(aTemplate.second);
+
+ sal_uInt16 nM = 0;
+ for (auto const& elem : m_aChartTypeDialogControllerList)
+ {
+ if (elem->isSubType(aServiceName))
+ {
+ m_pMainTypeList->SelectEntryPos(nM);
+ break;
+ }
+ ++nM;
+ }
+}
+
+VclPtr<vcl::Window> ChartTypePanel::Create(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController)
+{
+ if (pParent == nullptr)
+ throw lang::IllegalArgumentException("no parent Window given to ChartTypePanel::Create",
+ nullptr, 0);
+ if (!rxFrame.is())
+ throw lang::IllegalArgumentException("no XFrame given to ChartTypePanel::Create", nullptr,
+ 1);
+ return VclPtr<ChartTypePanel>::Create(pParent, rxFrame, pController);
+}
+
+void ChartTypePanel::DataChanged(const DataChangedEvent&) { updateData(); }
+
+void ChartTypePanel::HandleContextChange(const vcl::EnumContext& rContext)
+{
+ if (maContext == rContext)
+ {
+ // Nothing to do.
+ return;
+ }
+
+ maContext = rContext;
+ updateData();
+}
+
+void ChartTypePanel::modelInvalid() { mbModelValid = false; }
+
+void ChartTypePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ if (mbModelValid)
+ {
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel,
+ css::uno::UNO_QUERY_THROW);
+ xBroadcaster->removeModifyListener(mxListener);
+ }
+
+ mxModel = xModel;
+ mbModelValid = true;
+
+ css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel,
+ css::uno::UNO_QUERY_THROW);
+ xBroadcasterNew->addModifyListener(mxListener);
+}
+
+ChartTypeDialogController* ChartTypePanel::getSelectedMainType()
+{
+ ChartTypeDialogController* pTypeController = nullptr;
+ auto nM = static_cast<std::vector<ChartTypeDialogController*>::size_type>(
+ m_pMainTypeList->GetSelectedEntryPos());
+ if (nM < m_aChartTypeDialogControllerList.size())
+ pTypeController = m_aChartTypeDialogControllerList[nM].get();
+ return pTypeController;
+}
+
+void ChartTypePanel::showAllControls(ChartTypeDialogController& rTypeController)
+{
+ m_pMainTypeList->Show();
+ m_pSubTypeList->Show();
+
+ bool bShow = rTypeController.shouldShow_3DLookControl();
+ m_pDim3DLookResourceGroup->showControls(bShow);
+ /*bShow = rTypeController.shouldShow_StackingControl();
+ m_pStackingResourceGroup->showControls( bShow, rTypeController.shouldShow_DeepStackingControl() );
+ bShow = rTypeController.shouldShow_SplineControl();
+ m_pSplineResourceGroup->showControls( bShow );
+ bShow = rTypeController.shouldShow_GeometryControl();
+ m_pGeometryResourceGroup->showControls( bShow );
+ bShow = rTypeController.shouldShow_SortByXValuesResourceGroup();
+ m_pSortByXValuesResourceGroup->showControls( bShow );
+ rTypeController.showExtraControls(this);*/
+}
+
+void ChartTypePanel::fillAllControls(const ChartTypeParameter& rParameter,
+ bool bAlsoResetSubTypeList)
+{
+ m_nChangingCalls++;
+ if (m_pCurrentMainType && bAlsoResetSubTypeList)
+ {
+ // FIXME: This is just to test. This if-block should just call m_pCurrentMainType->fillSubTypeList(*m_pSubTypeList, rParameter);
+ // after adding a new method to ColumnChartDialogController and its children
+ //m_pCurrentMainType->fillSubTypeList(*m_pSubTypeList, rParameter);
+ m_pSubTypeList->Clear();
+
+ if (rParameter.b3DLook)
+ {
+ switch (rParameter.nGeometry3D)
+ {
+ case css::chart2::DataPointGeometry3D::CYLINDER:
+ m_pSubTypeList->InsertItem(1, Image(StockImage::Yes, BMP_SAEULE_3D_1));
+ m_pSubTypeList->InsertItem(2, Image(StockImage::Yes, BMP_SAEULE_3D_2));
+ m_pSubTypeList->InsertItem(3, Image(StockImage::Yes, BMP_SAEULE_3D_3));
+ m_pSubTypeList->InsertItem(4, Image(StockImage::Yes, BMP_SAEULE_3D_4));
+ break;
+ case css::chart2::DataPointGeometry3D::CONE:
+ m_pSubTypeList->InsertItem(1, Image(StockImage::Yes, BMP_KEGEL_3D_1));
+ m_pSubTypeList->InsertItem(2, Image(StockImage::Yes, BMP_KEGEL_3D_2));
+ m_pSubTypeList->InsertItem(3, Image(StockImage::Yes, BMP_KEGEL_3D_3));
+ m_pSubTypeList->InsertItem(4, Image(StockImage::Yes, BMP_KEGEL_3D_4));
+ break;
+ case css::chart2::DataPointGeometry3D::PYRAMID:
+ m_pSubTypeList->InsertItem(1, Image(StockImage::Yes, BMP_PYRAMID_3D_1));
+ m_pSubTypeList->InsertItem(2, Image(StockImage::Yes, BMP_PYRAMID_3D_2));
+ m_pSubTypeList->InsertItem(3, Image(StockImage::Yes, BMP_PYRAMID_3D_3));
+ m_pSubTypeList->InsertItem(4, Image(StockImage::Yes, BMP_PYRAMID_3D_4));
+ break;
+ default: //DataPointGeometry3D::CUBOID:
+ m_pSubTypeList->InsertItem(1, Image(StockImage::Yes, BMP_COLUMNS_3D_1));
+ m_pSubTypeList->InsertItem(2, Image(StockImage::Yes, BMP_COLUMNS_3D_2));
+ m_pSubTypeList->InsertItem(3, Image(StockImage::Yes, BMP_COLUMNS_3D_3));
+ m_pSubTypeList->InsertItem(4, Image(StockImage::Yes, BMP_COLUMNS_3D));
+ break;
+ }
+ }
+ else
+ {
+ m_pSubTypeList->InsertItem(1, Image(StockImage::Yes, BMP_COLUMNS_2D_1));
+ m_pSubTypeList->InsertItem(2, Image(StockImage::Yes, BMP_COLUMNS_2D_2));
+ m_pSubTypeList->InsertItem(3, Image(StockImage::Yes, BMP_COLUMNS_2D_3));
+ }
+
+ m_pSubTypeList->SetItemText(1, SchResId(STR_NORMAL));
+ m_pSubTypeList->SetItemText(2, SchResId(STR_STACKED));
+ m_pSubTypeList->SetItemText(3, SchResId(STR_PERCENT));
+ m_pSubTypeList->SetItemText(4, SchResId(STR_DEEP));
+ }
+ m_pSubTypeList->SelectItem(static_cast<sal_uInt16>(rParameter.nSubTypeIndex));
+ m_pDim3DLookResourceGroup->fillControls(rParameter);
+ /*m_pStackingResourceGroup->fillControls( rParameter );
+ m_pSplineResourceGroup->fillControls( rParameter );
+ m_pGeometryResourceGroup->fillControls( rParameter );
+ m_pSortByXValuesResourceGroup->fillControls( rParameter );*/
+ m_nChangingCalls--;
+}
+
+ChartTypeParameter ChartTypePanel::getCurrentParamter() const
+{
+ ChartTypeParameter aParameter;
+ aParameter.nSubTypeIndex = static_cast<sal_Int32>(m_pSubTypeList->GetSelectedItemId());
+ m_pDim3DLookResourceGroup->fillParameter(aParameter);
+ //m_pStackingResourceGroup->fillParameter( aParameter );
+ //m_pSplineResourceGroup->fillParameter( aParameter );
+ //m_pGeometryResourceGroup->fillParameter( aParameter );
+ //m_pSortByXValuesResourceGroup->fillParameter( aParameter );
+ return aParameter;
+}
+
+void ChartTypePanel::stateChanged()
+{
+ if (m_nChangingCalls)
+ return;
+ m_nChangingCalls++;
+
+ ChartTypeParameter aParameter(getCurrentParamter());
+ if (m_pCurrentMainType)
+ {
+ m_pCurrentMainType->adjustParameterToSubType(aParameter);
+ m_pCurrentMainType->adjustSubTypeAndEnableControls(aParameter);
+ }
+ commitToModel(aParameter);
+
+ //detect the new ThreeDLookScheme
+ uno::Reference<css::chart2::XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
+ aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
+ try
+ {
+ uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
+ xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ }
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ //the controls have to be enabled/disabled accordingly
+ fillAllControls(aParameter);
+
+ m_nChangingCalls--;
+}
+
+void ChartTypePanel::commitToModel(const ChartTypeParameter& rParameter)
+{
+ if (!m_pCurrentMainType)
+ return;
+
+ m_aTimerTriggeredControllerLock.startTimer();
+ m_pCurrentMainType->commitToModel(rParameter, m_xChartModel);
+}
+}
+} // end of namespace ::chart::sidebar
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.hxx b/chart2/source/controller/sidebar/ChartTypePanel.hxx
new file mode 100644
index 000000000000..e44ad7168cbf
--- /dev/null
+++ b/chart2/source/controller/sidebar/ChartTypePanel.hxx
@@ -0,0 +1,138 @@
+/* -*- 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_CHARTTYPEPANEL_HXX
+#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTTYPEPANEL_HXX
+
+#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/sidebar/SidebarModelUpdate.hxx>
+#include <svx/sidebar/PanelLayout.hxx>
+//#include <vcl/layout.hxx>
+#include "ChartSidebarModifyListener.hxx"
+#include <ChartTypeDialogController.hxx>
+#include <TimerTriggeredControllerLock.hxx>
+#include <TitleHelper.hxx>
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace util
+{
+class XModifyListener;
+}
+}
+}
+}
+
+class ListBox;
+class ValueSet;
+
+namespace chart
+{
+class ChartController;
+class Dim3DLookResourceGroup_unwelded;
+class StackingResourceGroup_unwelded;
+class SplineResourceGroup_unwelded;
+class GeometryResourceGroup_unwelded;
+class ChartTypeParameter_unwelded;
+class SortByXValuesResourceGroup_unwelded;
+
+namespace sidebar
+{
+class ChartTypePanel : public ResourceChangeListener,
+ public PanelLayout,
+ public ::sfx2::sidebar::IContextChangeReceiver,
+ public sfx2::sidebar::SidebarModelUpdate,
+ public ChartSidebarModifyListenerParent
+{
+public:
+ static VclPtr<vcl::Window> Create(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ChartController* pController);
+
+ virtual void DataChanged(const DataChangedEvent& rEvent) override;
+
+ virtual void HandleContextChange(const vcl::EnumContext& rContext) override;
+
+ // constructor/destructor
+ ChartTypePanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ ::chart::ChartController* pController);
+
+ virtual ~ChartTypePanel() override;
+
+ virtual void dispose() override;
+
+ virtual void updateData() override;
+ virtual void modelInvalid() override;
+
+ virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) override;
+
+private:
+ ChartTypeDialogController* getSelectedMainType();
+ void showAllControls(ChartTypeDialogController& rTypeController);
+ void fillAllControls(const ChartTypeParameter& rParameter, bool bAlsoResetSubTypeList = true);
+ ChartTypeParameter getCurrentParamter() const;
+
+ virtual void stateChanged() override;
+
+ void commitToModel(const ChartTypeParameter& rParameter);
+
+ /*DECL_LINK(SelectMainTypeHdl, ListBox&, void);
+ DECL_LINK(SelectSubTypeHdl, ValueSet*, void);*/
+
+ //ui controls
+ VclPtr<FixedText> mpChartTypeLabel;
+ VclPtr<ListBox> m_pMainTypeList;
+ VclPtr<ValueSet> m_pSubTypeList;
+
+ vcl::EnumContext maContext;
+
+ css::uno::Reference<css::frame::XModel> mxModel;
+ css::uno::Reference<css::util::XModifyListener> mxListener;
+
+ bool mbModelValid;
+
+ OUString maTextTitle;
+ OUString maTextSubTitle;
+
+ void Initialize();
+
+ std::unique_ptr<Dim3DLookResourceGroup_unwelded> m_pDim3DLookResourceGroup;
+ /*std::unique_ptr<StackingResourceGroup> m_pStackingResourceGroup;
+ std::unique_ptr<SplineResourceGroup> m_pSplineResourceGroup;
+ std::unique_ptr<GeometryResourceGroup> m_pGeometryResourceGroup;
+ std::unique_ptr<SortByXValuesResourceGroup> m_pSortByXValuesResourceGroup;*/
+
+ css::uno::Reference<css::chart2::XChartDocument> m_xChartModel;
+
+ std::vector<std::unique_ptr<ChartTypeDialogController>> m_aChartTypeDialogControllerList;
+ ChartTypeDialogController* m_pCurrentMainType;
+
+ sal_Int32 m_nChangingCalls;
+
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+};
+}
+} // end of namespace ::chart::sidebar
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/uiconfig/ui/sidebartype.ui b/chart2/uiconfig/ui/sidebartype.ui
new file mode 100644
index 000000000000..d12e6259154a
--- /dev/null
+++ b/chart2/uiconfig/ui/sidebartype.ui
@@ -0,0 +1,367 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="chart">
+ <requires lib="gtk+" version="3.18"/>
+ <requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkGrid" id="ChartTypePanel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="container">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="lbl_chartType">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="sidebartype|lbl_chartType">Chart Type:</property>
+ <accessibility>
+ <relation type="label-for" target="cmb_chartType"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="cmb_chartType">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <accessibility>
+ <relation type="labelled-by" target="lbl_chartType"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="svtlo-ValueSet" id="subtype:border">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="3dblock">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkGrid" id="grid9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkCheckButton" id="3dlook">
+ <property name="label" translatable="yes" context="sidebartype|3dlook">_3D Look</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <accessibility>
+ <relation type="label-for" target="3dscheme"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="3dscheme">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <items>
+ <item translatable="yes" context="sidebartype|3dscheme">Simple</item>
+ <item translatable="yes" context="sidebartype|3dscheme">Realistic</item>
+ </items>
+ <accessibility>
+ <relation type="labelled-by" target="3dlook"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="shapeft">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="sidebartype|shapeft">Sh_ape</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">shape:border</property>
+ <property name="angle">0.02</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTreeView" id="shape:border">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="search_column">0</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="stackblock">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="stack">
+ <property name="label" translatable="yes" context="sidebartype|stack">_Stack series</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkRadioButton" id="ontop">
+ <property name="label" translatable="yes" context="sidebartype|ontop">On top</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">percent</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="percent">
+ <property name="label" translatable="yes" context="sidebartype|percent">Percent</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">deep</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="deep">
+ <property name="label" translatable="yes" context="sidebartype|deep">Deep</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">ontop</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="linetypeft">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="sidebartype|linetypeft">_Line type</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">linetype</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="linetype">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <items>
+ <item translatable="yes" context="sidebartype|linetype">Straight</item>
+ <item translatable="yes" context="sidebartype|linetype">Smooth</item>
+ <item translatable="yes" context="sidebartype|linetype">Stepped</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="properties">
+ <property name="label" translatable="yes" context="sidebartype|properties">Properties...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="sort">
+ <property name="label" translatable="yes" context="sidebartype|sort">_Sort by X values</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="nolinesft">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes" context="sidebartype|nolinesft">_Number of lines</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">nolines</property>
+ <property name="ellipsize">end</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="nolines">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="value">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>