summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-07-01 22:00:38 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-08-10 14:37:03 +0200
commitc4a6e28a2b7cfb1763b0acf83992505b9d1addd6 (patch)
tree1c4d85f7df4a3372dfa49f2b008525b43765b6e7
parentchart2: add some data table default properties (diff)
downloadcore-c4a6e28a2b7cfb1763b0acf83992505b9d1addd6.tar.gz
core-c4a6e28a2b7cfb1763b0acf83992505b9d1addd6.zip
chart2: InsertDataTableDialog for inserting/removing the data table
Change-Id: Ie3c033c587b150723e7aa39cd5ddf5774104db9a
-rw-r--r--chart2/Library_chartcontroller.mk2
-rw-r--r--chart2/UIConfig_chart2.mk3
-rw-r--r--chart2/source/controller/dialogs/dlg_InsertDataTable.cxx61
-rw-r--r--chart2/source/controller/dialogs/res_DataTableProperties.cxx111
-rw-r--r--chart2/source/controller/dialogs/tp_DataTable.cxx78
-rw-r--r--chart2/source/controller/dialogs/tp_DataTable.hxx11
-rw-r--r--chart2/source/controller/inc/dlg_InsertDataTable.hxx47
-rw-r--r--chart2/source/controller/inc/res_DataTableProperties.hxx47
-rw-r--r--chart2/source/controller/main/ChartController_Insert.cxx64
-rw-r--r--chart2/uiconfig/ui/dlg_InsertDataTable.ui215
10 files changed, 548 insertions, 91 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 4bc8c7497915..cc25cdd907ae 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -109,6 +109,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/dialogs/dlg_DataSource \
chart2/source/controller/dialogs/dlg_InsertAxis_Grid \
chart2/source/controller/dialogs/dlg_InsertDataLabel \
+ chart2/source/controller/dialogs/dlg_InsertDataTable \
chart2/source/controller/dialogs/dlg_InsertErrorBars \
chart2/source/controller/dialogs/dlg_InsertLegend \
chart2/source/controller/dialogs/dlg_InsertTitle \
@@ -122,6 +123,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/dialogs/RangeSelectionListener \
chart2/source/controller/dialogs/res_BarGeometry \
chart2/source/controller/dialogs/res_DataLabel \
+ chart2/source/controller/dialogs/res_DataTableProperties \
chart2/source/controller/dialogs/res_ErrorBar \
chart2/source/controller/dialogs/res_LegendPosition \
chart2/source/controller/dialogs/res_Titles \
diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk
index 59af510c5845..274efd02638f 100644
--- a/chart2/UIConfig_chart2.mk
+++ b/chart2/UIConfig_chart2.mk
@@ -44,7 +44,9 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\
chart2/uiconfig/ui/combobox \
chart2/uiconfig/ui/datarangedialog \
chart2/uiconfig/ui/dlg_DataLabel \
+ chart2/uiconfig/ui/dlg_InsertDataTable \
chart2/uiconfig/ui/dlg_InsertErrorBars \
+ chart2/uiconfig/ui/dlg_InsertLegend \
chart2/uiconfig/ui/imagefragment \
chart2/uiconfig/ui/insertaxisdlg \
chart2/uiconfig/ui/insertgriddlg \
@@ -58,7 +60,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\
chart2/uiconfig/ui/smoothlinesdlg \
chart2/uiconfig/ui/steppedlinesdlg \
chart2/uiconfig/ui/titlerotationtabpage \
- chart2/uiconfig/ui/dlg_InsertLegend \
chart2/uiconfig/ui/tp_3D_SceneAppearance \
chart2/uiconfig/ui/tp_3D_SceneGeometry \
chart2/uiconfig/ui/tp_3D_SceneIllumination \
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataTable.cxx b/chart2/source/controller/dialogs/dlg_InsertDataTable.cxx
new file mode 100644
index 000000000000..4b5e928db057
--- /dev/null
+++ b/chart2/source/controller/dialogs/dlg_InsertDataTable.cxx
@@ -0,0 +1,61 @@
+/* -*- 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 <dlg_InsertDataTable.hxx>
+
+namespace chart
+{
+InsertDataTableDialog::InsertDataTableDialog(weld::Window* pWindow)
+ : GenericDialogController(pWindow, "modules/schart/ui/dlg_InsertDataTable.ui",
+ "InsertDataTableDialog")
+ , m_aDataTablePropertiesResources(*m_xBuilder)
+ , m_xCbShowDataTable(m_xBuilder->weld_check_button("showDataTable"))
+{
+ m_xCbShowDataTable->connect_toggled(LINK(this, InsertDataTableDialog, ShowDataTableToggle));
+ init(m_aData);
+}
+
+IMPL_LINK_NOARG(InsertDataTableDialog, ShowDataTableToggle, weld::Toggleable&, void)
+{
+ changeEnabled();
+}
+
+void InsertDataTableDialog::changeEnabled()
+{
+ bool bEnable = m_xCbShowDataTable->get_active();
+ m_aDataTablePropertiesResources.setChecksSensitive(bEnable);
+ m_aData.mbShow = bEnable;
+}
+
+void InsertDataTableDialog::init(DataTableDialogData const& rData)
+{
+ m_aData = rData;
+ m_aDataTablePropertiesResources.setHorizontalBorder(m_aData.mbHorizontalBorders);
+ m_aDataTablePropertiesResources.setVerticalBorder(m_aData.mbVerticalBorders);
+ m_aDataTablePropertiesResources.setOutline(m_aData.mbOutline);
+ m_aDataTablePropertiesResources.setKeys(m_aData.mbKeys);
+ m_xCbShowDataTable->set_active(m_aData.mbShow);
+ changeEnabled();
+}
+
+DataTableDialogData& InsertDataTableDialog::getDataTableDialogData()
+{
+ m_aData.mbShow = m_xCbShowDataTable->get_active();
+
+ m_aData.mbHorizontalBorders = m_aDataTablePropertiesResources.getHorizontalBorder();
+ m_aData.mbVerticalBorders = m_aDataTablePropertiesResources.getVerticalBorder();
+ m_aData.mbOutline = m_aDataTablePropertiesResources.getOutline();
+ m_aData.mbKeys = m_aDataTablePropertiesResources.getKeys();
+
+ return m_aData;
+}
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/res_DataTableProperties.cxx b/chart2/source/controller/dialogs/res_DataTableProperties.cxx
new file mode 100644
index 000000000000..bf87b3e6b9e3
--- /dev/null
+++ b/chart2/source/controller/dialogs/res_DataTableProperties.cxx
@@ -0,0 +1,111 @@
+/* -*- 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 <res_DataTableProperties.hxx>
+
+#include <chartview/ChartSfxItemIds.hxx>
+#include <svl/eitem.hxx>
+
+using namespace css;
+
+namespace chart
+{
+DataTablePropertiesResources::DataTablePropertiesResources(weld::Builder& rBuilder)
+ : m_xCbHorizontalBorder(rBuilder.weld_check_button("horizontalBorderCB"))
+ , m_xCbVerticalBorder(rBuilder.weld_check_button("verticalBorderCB"))
+ , m_xCbOutilne(rBuilder.weld_check_button("outlineCB"))
+ , m_xCbKeys(rBuilder.weld_check_button("keysCB"))
+{
+}
+
+void DataTablePropertiesResources::setChecksSensitive(bool bSensitive)
+{
+ m_xCbHorizontalBorder->set_sensitive(bSensitive);
+ m_xCbVerticalBorder->set_sensitive(bSensitive);
+ m_xCbOutilne->set_sensitive(bSensitive);
+ m_xCbKeys->set_sensitive(bSensitive);
+}
+
+void DataTablePropertiesResources::initFromItemSet(const SfxItemSet& rInAttrs)
+{
+ const SfxPoolItem* pPoolItem = nullptr;
+ SfxItemState aState;
+
+ aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false, &pPoolItem);
+ if (aState == SfxItemState::DONTCARE)
+ {
+ m_xCbHorizontalBorder->set_state(TRISTATE_INDET);
+ }
+ else
+ {
+ if (aState == SfxItemState::SET)
+ m_xCbHorizontalBorder->set_active(
+ static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ }
+
+ aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false, &pPoolItem);
+ if (aState == SfxItemState::DONTCARE)
+ {
+ m_xCbVerticalBorder->set_state(TRISTATE_INDET);
+ }
+ else
+ {
+ if (aState == SfxItemState::SET)
+ m_xCbVerticalBorder->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ }
+
+ aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_OUTLINE, false, &pPoolItem);
+ if (aState == SfxItemState::DONTCARE)
+ {
+ m_xCbOutilne->set_state(TRISTATE_INDET);
+ }
+ else
+ {
+ if (aState == SfxItemState::SET)
+ m_xCbOutilne->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ }
+
+ aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_KEYS, false, &pPoolItem);
+ if (aState == SfxItemState::DONTCARE)
+ {
+ m_xCbKeys->set_state(TRISTATE_INDET);
+ }
+ else
+ {
+ if (aState == SfxItemState::SET)
+ m_xCbKeys->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ }
+}
+
+bool DataTablePropertiesResources::writeToItemSet(SfxItemSet& rOutAttrs) const
+{
+ if (m_xCbHorizontalBorder->get_state() != TRISTATE_INDET)
+ {
+ rOutAttrs.Put(
+ SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, m_xCbHorizontalBorder->get_active()));
+ }
+ if (m_xCbVerticalBorder->get_state() != TRISTATE_INDET)
+ {
+ rOutAttrs.Put(
+ SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, m_xCbVerticalBorder->get_active()));
+ }
+ if (m_xCbOutilne->get_state() != TRISTATE_INDET)
+ {
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, m_xCbOutilne->get_active()));
+ }
+ if (m_xCbKeys->get_state() != TRISTATE_INDET)
+ {
+ rOutAttrs.Put(SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, m_xCbKeys->get_active()));
+ }
+ return true;
+}
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_DataTable.cxx b/chart2/source/controller/dialogs/tp_DataTable.cxx
index d7bed5a53900..e6982b4a5067 100644
--- a/chart2/source/controller/dialogs/tp_DataTable.cxx
+++ b/chart2/source/controller/dialogs/tp_DataTable.cxx
@@ -9,19 +9,13 @@
#include "tp_DataTable.hxx"
-#include <chartview/ChartSfxItemIds.hxx>
-#include <svl/eitem.hxx>
-
namespace chart
{
DataTableTabPage::DataTableTabPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rInAttrs)
: SfxTabPage(pPage, pController, "modules/schart/ui/tp_DataTable.ui", "DataTableTabPage",
&rInAttrs)
- , m_xCbHorizontalBorder(m_xBuilder->weld_check_button("horizontalBorderCB"))
- , m_xCbVerticalBorder(m_xBuilder->weld_check_button("verticalBorderCB"))
- , m_xCbOutilne(m_xBuilder->weld_check_button("outlineCB"))
- , m_xCbKeys(m_xBuilder->weld_check_button("keysCB"))
+ , m_aDataTablePropertiesResources(*m_xBuilder)
{
}
@@ -34,78 +28,14 @@ std::unique_ptr<SfxTabPage> DataTableTabPage::Create(weld::Container* pPage,
return std::make_unique<DataTableTabPage>(pPage, pController, *rAttrs);
}
-bool DataTableTabPage::FillItemSet(SfxItemSet* rOutAttrs)
+bool DataTableTabPage::FillItemSet(SfxItemSet* pOutAttrs)
{
- if (m_xCbHorizontalBorder->get_state() != TRISTATE_INDET)
- {
- rOutAttrs->Put(
- SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, m_xCbHorizontalBorder->get_active()));
- }
- if (m_xCbVerticalBorder->get_state() != TRISTATE_INDET)
- {
- rOutAttrs->Put(
- SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, m_xCbVerticalBorder->get_active()));
- }
- if (m_xCbOutilne->get_state() != TRISTATE_INDET)
- {
- rOutAttrs->Put(SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, m_xCbOutilne->get_active()));
- }
- if (m_xCbKeys->get_state() != TRISTATE_INDET)
- {
- rOutAttrs->Put(SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, m_xCbKeys->get_active()));
- }
- return true;
+ return m_aDataTablePropertiesResources.writeToItemSet(*pOutAttrs);
}
void DataTableTabPage::Reset(const SfxItemSet* pInAttrs)
{
- const SfxPoolItem* pPoolItem = nullptr;
- SfxItemState aState;
-
- aState = pInAttrs->GetItemState(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false, &pPoolItem);
- if (aState == SfxItemState::DONTCARE)
- {
- m_xCbHorizontalBorder->set_state(TRISTATE_INDET);
- }
- else
- {
- if (aState == SfxItemState::SET)
- m_xCbHorizontalBorder->set_active(
- static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- }
-
- aState = pInAttrs->GetItemState(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false, &pPoolItem);
- if (aState == SfxItemState::DONTCARE)
- {
- m_xCbVerticalBorder->set_state(TRISTATE_INDET);
- }
- else
- {
- if (aState == SfxItemState::SET)
- m_xCbVerticalBorder->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- }
-
- aState = pInAttrs->GetItemState(SCHATTR_DATA_TABLE_OUTLINE, false, &pPoolItem);
- if (aState == SfxItemState::DONTCARE)
- {
- m_xCbOutilne->set_state(TRISTATE_INDET);
- }
- else
- {
- if (aState == SfxItemState::SET)
- m_xCbOutilne->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- }
-
- aState = pInAttrs->GetItemState(SCHATTR_DATA_TABLE_KEYS, false, &pPoolItem);
- if (aState == SfxItemState::DONTCARE)
- {
- m_xCbKeys->set_state(TRISTATE_INDET);
- }
- else
- {
- if (aState == SfxItemState::SET)
- m_xCbKeys->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
- }
+ m_aDataTablePropertiesResources.initFromItemSet(*pInAttrs);
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_DataTable.hxx b/chart2/source/controller/dialogs/tp_DataTable.hxx
index 11bcfb9203e1..a4ef6d6cf436 100644
--- a/chart2/source/controller/dialogs/tp_DataTable.hxx
+++ b/chart2/source/controller/dialogs/tp_DataTable.hxx
@@ -10,21 +10,14 @@
#pragma once
#include <sfx2/tabdlg.hxx>
-
-namespace weld
-{
-class CheckButton;
-}
+#include <res_DataTableProperties.hxx>
namespace chart
{
class DataTableTabPage : public SfxTabPage
{
private:
- std::unique_ptr<weld::CheckButton> m_xCbHorizontalBorder;
- std::unique_ptr<weld::CheckButton> m_xCbVerticalBorder;
- std::unique_ptr<weld::CheckButton> m_xCbOutilne;
- std::unique_ptr<weld::CheckButton> m_xCbKeys;
+ DataTablePropertiesResources m_aDataTablePropertiesResources;
public:
DataTableTabPage(weld::Container* pPage, weld::DialogController* pController,
diff --git a/chart2/source/controller/inc/dlg_InsertDataTable.hxx b/chart2/source/controller/inc/dlg_InsertDataTable.hxx
new file mode 100644
index 000000000000..5dda9c3444bc
--- /dev/null
+++ b/chart2/source/controller/inc/dlg_InsertDataTable.hxx
@@ -0,0 +1,47 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+#include <res_DataTableProperties.hxx>
+
+namespace chart
+{
+struct DataTableDialogData
+{
+ bool mbShow = true;
+ bool mbHorizontalBorders = false;
+ bool mbVerticalBorders = false;
+ bool mbOutline = false;
+ bool mbKeys = false;
+};
+
+class InsertDataTableDialog final : public weld::GenericDialogController
+{
+private:
+ DataTablePropertiesResources m_aDataTablePropertiesResources;
+ std::unique_ptr<weld::CheckButton> m_xCbShowDataTable;
+
+ DataTableDialogData m_aData;
+
+ DECL_LINK(ShowDataTableToggle, weld::Toggleable&, void);
+
+ void changeEnabled();
+
+public:
+ InsertDataTableDialog(weld::Window* pParent);
+
+ void init(DataTableDialogData const& rData);
+ DataTableDialogData& getDataTableDialogData();
+};
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/res_DataTableProperties.hxx b/chart2/source/controller/inc/res_DataTableProperties.hxx
new file mode 100644
index 000000000000..299934cb0211
--- /dev/null
+++ b/chart2/source/controller/inc/res_DataTableProperties.hxx
@@ -0,0 +1,47 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <svl/itemset.hxx>
+#include <vcl/weld.hxx>
+
+namespace chart
+{
+class DataTablePropertiesResources final
+{
+private:
+ std::unique_ptr<weld::CheckButton> m_xCbHorizontalBorder;
+ std::unique_ptr<weld::CheckButton> m_xCbVerticalBorder;
+ std::unique_ptr<weld::CheckButton> m_xCbOutilne;
+ std::unique_ptr<weld::CheckButton> m_xCbKeys;
+
+public:
+ DataTablePropertiesResources(weld::Builder& rBuilder);
+
+ void initFromItemSet(SfxItemSet const& rInAttrs);
+ bool writeToItemSet(SfxItemSet& rOutAttrs) const;
+ void setChecksSensitive(bool bSensitive);
+
+ bool getHorizontalBorder() { return m_xCbHorizontalBorder->get_active(); }
+ void setHorizontalBorder(bool bActive) { m_xCbHorizontalBorder->set_active(bActive); }
+
+ bool getVerticalBorder() { return m_xCbVerticalBorder->get_active(); }
+ void setVerticalBorder(bool bActive) { m_xCbVerticalBorder->set_active(bActive); }
+
+ bool getOutline() { return m_xCbOutilne->get_active(); }
+ void setOutline(bool bActive) { m_xCbOutilne->set_active(bActive); }
+
+ bool getKeys() { return m_xCbKeys->get_active(); }
+ void setKeys(bool bActive) { m_xCbKeys->set_active(bActive); }
+};
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 46d00eedb89c..b1b0598d5070 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -25,6 +25,7 @@
#include <dlg_InsertLegend.hxx>
#include <dlg_InsertErrorBars.hxx>
#include <dlg_InsertTitle.hxx>
+#include <dlg_InsertDataTable.hxx>
#include <dlg_ObjectProperties.hxx>
#include <Axis.hxx>
@@ -57,6 +58,7 @@
#include <com/sun/star/chart2/XRegressionCurve.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <svx/ActionDescriptionProvider.hxx>
#include <tools/diagnose_ex.h>
@@ -158,18 +160,66 @@ void ChartController::executeDispatch_InsertGrid()
void ChartController::executeDispatch_OpenInsertDataTableDialog()
{
- rtl::Reference<Diagram> xDiagram = getFirstDiagram();
SolarMutexGuard aGuard;
- if (xDiagram->getDataTable().is())
+ rtl::Reference<Diagram> xDiagram = getFirstDiagram();
+
+ InsertDataTableDialog aDialog(GetChartFrame());
{
- xDiagram->setDataTable(uno::Reference<chart2::XDataTable>());
+ // init values
+ DataTableDialogData aData;
+ auto xDataTable = xDiagram->getDataTable();
+ aData.mbShow = xDataTable.is();
+ if (xDataTable.is())
+ {
+ uno::Reference<beans::XPropertySet> xProperties(xDataTable, uno::UNO_QUERY);
+
+ uno::Any aAny = xProperties->getPropertyValue("HBorder");
+ if (aAny.has<bool>())
+ aData.mbHorizontalBorders = aAny.get<bool>();
+
+ aAny = xProperties->getPropertyValue("VBorder");
+ if (aAny.has<bool>())
+ aData.mbVerticalBorders = aAny.get<bool>();
+
+ aAny = xProperties->getPropertyValue("Outline");
+ if (aAny.has<bool>())
+ aData.mbOutline = aAny.get<bool>();
+
+ aAny = xProperties->getPropertyValue("Keys");
+ if (aAny.has<bool>())
+ aData.mbKeys = aAny.get<bool>();
+ }
+ aDialog.init(aData);
}
- else
+
+ // show the dialog
+ if (aDialog.run() == RET_OK)
{
- uno::Reference<chart2::XDataTable> xDataTable(new DataTable);
- if (xDataTable.is())
+ auto& rDialogData = aDialog.getDataTableDialogData();
+
+ auto xDataTable = xDiagram->getDataTable();
+ if (!rDialogData.mbShow && xDataTable.is())
+ {
+ xDiagram->setDataTable(uno::Reference<chart2::XDataTable>());
+ }
+ else if (rDialogData.mbShow && !xDataTable.is())
+ {
+ uno::Reference<chart2::XDataTable> xNewDataTable(new DataTable);
+ if (xNewDataTable.is())
+ {
+ xDiagram->setDataTable(xNewDataTable);
+ }
+ }
+
+ // Set the properties
+ xDataTable = xDiagram->getDataTable();
+ if (rDialogData.mbShow && xDataTable.is())
{
- xDiagram->setDataTable(xDataTable);
+ uno::Reference<beans::XPropertySet> xProperties(xDataTable, uno::UNO_QUERY);
+ xProperties->setPropertyValue("HBorder" , uno::Any(rDialogData.mbHorizontalBorders));
+ xProperties->setPropertyValue("VBorder" , uno::Any(rDialogData.mbVerticalBorders));
+ xProperties->setPropertyValue("Outline" , uno::Any(rDialogData.mbOutline));
+ xProperties->setPropertyValue("Keys" , uno::Any(rDialogData.mbKeys));
}
}
}
diff --git a/chart2/uiconfig/ui/dlg_InsertDataTable.ui b/chart2/uiconfig/ui/dlg_InsertDataTable.ui
new file mode 100644
index 000000000000..77a4ca4a3618
--- /dev/null
+++ b/chart2/uiconfig/ui/dlg_InsertDataTable.ui
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface domain="chart">
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkDialog" id="InsertDataTableDialog">
+ <property name="can-focus">False</property>
+ <property name="border-width">6</property>
+ <property name="title" translatable="yes" context="dlg_InsertLegend|dlg_InsertLegend">Data Table</property>
+ <property name="modal">True</property>
+ <property name="default-width">0</property>
+ <property name="default-height">0</property>
+ <property name="type-hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can-focus">False</property>
+ <property name="layout-style">end</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label" translatable="yes" context="stock">_OK</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="can-default">True</property>
+ <property name="has-default">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label" translatable="yes" context="stock">_Cancel</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="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label" translatable="yes" context="stock">_Help</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="margin-end">6</property>
+ <property name="use-underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="dlg_LegendPosition">
+ <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">12</property>
+ <child>
+ <object class="GtkCheckButton" id="showDataTable">
+ <property name="label" translatable="yes" context="tp_DataTable|horizontalBorderCB">Show Data Table</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="halign">start</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label-xalign">0</property>
+ <property name="shadow-type">none</property>
+ <child>
+ <object class="GtkBox" id="box4">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-start">12</property>
+ <property name="margin-top">6</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="horizontalBorderCB">
+ <property name="label" translatable="yes" context="tp_DataTable|horizontalBorderCB">Show Horizontal Border</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="halign">start</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="verticalBorderCB">
+ <property name="label" translatable="yes" context="tp_DataTable|verticalBorderCB">Show Vertical Border</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="halign">start</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="outlineCB">
+ <property name="label" translatable="yes" context="tp_DataTable|outlineCB">Show Outline</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="halign">start</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="keysCB">
+ <property name="label" translatable="yes" context="tp_DataTable|keysCB">Show Keys</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">False</property>
+ <property name="halign">start</property>
+ <property name="use-underline">True</property>
+ <property name="draw-indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="dataTablePropertiesLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes" context="tp_axisLabel|textflowL">Data Table Properties</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-5">ok</action-widget>
+ <action-widget response="-6">cancel</action-widget>
+ <action-widget response="-11">help</action-widget>
+ </action-widgets>
+ </object>
+</interface>