summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-06-28 07:48:45 +0200
committerTomaž Vajngerl <quikee@gmail.com>2022-08-14 18:15:53 +0200
commit300ea910badeef2c8038d9bb20683ea26f4b1973 (patch)
treeb74a9df57023c1c02cf97b55dd05885186945c54
parent7601cf11ea31d4b74d82fde28aba65a2e2051258 (diff)
chart2: add UI to the data table
This adds a new object type "Data Table", with all the object identifiers and converters of properties. The data table is now shown in the drop-down of chart elements. A properties dialog was added, which allows to change properties of a data table. This contains the area, line and font tab pages and a new tab page specific for data tables, to change if the horiz. or vert. borders, key or the outline should be show. Change-Id: I9b4cd58cffbcc952daaa2c0c8f8a5a17e38ac293 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138246 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--chart2/Library_chartcontroller.mk2
-rw-r--r--chart2/UIConfig_chart2.mk1
-rw-r--r--chart2/inc/strings.hrc2
-rw-r--r--chart2/source/controller/dialogs/ObjectNameProvider.cxx3
-rw-r--r--chart2/source/controller/dialogs/dlg_ObjectProperties.cxx7
-rw-r--r--chart2/source/controller/dialogs/tp_DataTable.cxx113
-rw-r--r--chart2/source/controller/dialogs/tp_DataTable.hxx43
-rw-r--r--chart2/source/controller/inc/DataTableItemConverter.hxx57
-rw-r--r--chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx112
-rw-r--r--chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx8
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx12
-rw-r--r--chart2/source/controller/main/ObjectHierarchy.cxx8
-rw-r--r--chart2/source/inc/ObjectIdentifier.hxx4
-rw-r--r--chart2/source/inc/chartview/ChartSfxItemIds.hxx9
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx23
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx5
-rw-r--r--chart2/uiconfig/ui/tp_DataTable.ui115
17 files changed, 523 insertions, 1 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index b7c449cef582..4bc8c7497915 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -138,6 +138,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/dialogs/tp_DataLabel \
chart2/source/controller/dialogs/tp_DataPointOption \
chart2/source/controller/dialogs/tp_DataSource \
+ chart2/source/controller/dialogs/tp_DataTable \
chart2/source/controller/dialogs/tp_ErrorBars \
chart2/source/controller/dialogs/tp_LegendPosition \
chart2/source/controller/dialogs/tp_PointGeometry \
@@ -153,6 +154,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/itemsetwrapper/AxisItemConverter \
chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter \
chart2/source/controller/itemsetwrapper/DataPointItemConverter \
+ chart2/source/controller/itemsetwrapper/DataTableItemConverter \
chart2/source/controller/itemsetwrapper/ErrorBarItemConverter \
chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter \
chart2/source/controller/itemsetwrapper/ItemConverter \
diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk
index 67d64b18b597..59af510c5845 100644
--- a/chart2/UIConfig_chart2.mk
+++ b/chart2/UIConfig_chart2.mk
@@ -68,6 +68,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\
chart2/uiconfig/ui/tp_DataLabel \
chart2/uiconfig/ui/tp_DataPointOption \
chart2/uiconfig/ui/tp_DataSource \
+ chart2/uiconfig/ui/tp_DataTable \
chart2/uiconfig/ui/tp_ErrorBars \
chart2/uiconfig/ui/tp_LegendPosition \
chart2/uiconfig/ui/tp_PolarOptions \
diff --git a/chart2/inc/strings.hrc b/chart2/inc/strings.hrc
index ab6ca48c8376..9a9943df1f3c 100644
--- a/chart2/inc/strings.hrc
+++ b/chart2/inc/strings.hrc
@@ -48,6 +48,7 @@
#define STR_PAGE_APPEARANCE NC_("STR_PAGE_APPEARANCE", "Appearance")
#define STR_PAGE_ILLUMINATION NC_("STR_PAGE_ILLUMINATION", "Illumination")
#define STR_PAGE_ASIAN NC_("STR_PAGE_ASIAN", "Asian Typography")
+#define STR_PAGE_DATA_TABLE NC_("STR_PAGE_DATA_TABLE", "Data Table")
#define STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS NC_("STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS", "Mean value line with value %AVERAGE_VALUE and standard deviation %STD_DEVIATION")
#define STR_OBJECT_AXIS NC_("STR_OBJECT_AXIS", "Axis")
#define STR_OBJECT_AXIS_X NC_("STR_OBJECT_AXIS_X", "X Axis")
@@ -97,6 +98,7 @@
#define STR_OBJECT_DIAGRAM_WALL NC_("STR_OBJECT_DIAGRAM_WALL", "Chart Wall")
#define STR_OBJECT_DIAGRAM_FLOOR NC_("STR_OBJECT_DIAGRAM_FLOOR", "Chart Floor")
#define STR_OBJECT_SHAPE NC_("STR_OBJECT_SHAPE", "Drawing Object")
+#define STR_OBJECT_DATA_TABLE NC_("STR_OBJECT_DATA_TABLE", "Data Table")
#define STR_TIP_DATASERIES NC_("STR_TIP_DATASERIES", "Data Series '%SERIESNAME'")
#define STR_TIP_DATAPOINT_INDEX NC_("STR_TIP_DATAPOINT_INDEX", "Data Point %POINTNUMBER")
#define STR_TIP_DATAPOINT_VALUES NC_("STR_TIP_DATAPOINT_VALUES", "Values: %POINTVALUES")
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index 07b7f3503e92..b105ecc61211 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -314,6 +314,9 @@ OUString ObjectNameProvider::getName( ObjectType eObjectType, bool bPlural )
case OBJECTTYPE_DATA_CURVE_EQUATION:
aRet=SchResId(STR_OBJECT_CURVE_EQUATION);
break;
+ case OBJECTTYPE_DATA_TABLE:
+ aRet=SchResId(STR_OBJECT_DATA_TABLE);
+ break;
default: //OBJECTTYPE_UNKNOWN
;
}
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index c511ebb28527..0ba0b76518cb 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -35,6 +35,7 @@
#include "tp_TitleRotation.hxx"
#include "tp_PolarOptions.hxx"
#include "tp_DataPointOption.hxx"
+#include "tp_DataTable.hxx"
#include <ResId.hxx>
#include <ViewElementListProvider.hxx>
#include <ChartModelHelper.hxx>
@@ -458,6 +459,12 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
case OBJECTTYPE_UNKNOWN:
// nothing
break;
+ case OBJECTTYPE_DATA_TABLE:
+ AddTabPage("datatable", SchResId(STR_PAGE_DATA_TABLE), DataTableTabPage::Create);
+ AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
+ AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
+ AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
+ break;
case OBJECTTYPE_DATA_CURVE_EQUATION:
AddTabPage("border", SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
diff --git a/chart2/source/controller/dialogs/tp_DataTable.cxx b/chart2/source/controller/dialogs/tp_DataTable.cxx
new file mode 100644
index 000000000000..d7bed5a53900
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataTable.cxx
@@ -0,0 +1,113 @@
+/* -*- 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 "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"))
+{
+}
+
+DataTableTabPage::~DataTableTabPage() = default;
+
+std::unique_ptr<SfxTabPage> DataTableTabPage::Create(weld::Container* pPage,
+ weld::DialogController* pController,
+ const SfxItemSet* rAttrs)
+{
+ return std::make_unique<DataTableTabPage>(pPage, pController, *rAttrs);
+}
+
+bool DataTableTabPage::FillItemSet(SfxItemSet* rOutAttrs)
+{
+ 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;
+}
+
+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());
+ }
+}
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_DataTable.hxx b/chart2/source/controller/dialogs/tp_DataTable.hxx
new file mode 100644
index 000000000000..11bcfb9203e1
--- /dev/null
+++ b/chart2/source/controller/dialogs/tp_DataTable.hxx
@@ -0,0 +1,43 @@
+/* -*- 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 <sfx2/tabdlg.hxx>
+
+namespace weld
+{
+class CheckButton;
+}
+
+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;
+
+public:
+ DataTableTabPage(weld::Container* pPage, weld::DialogController* pController,
+ const SfxItemSet& rInAttrs);
+ virtual ~DataTableTabPage() override;
+
+ static std::unique_ptr<SfxTabPage>
+ Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs);
+
+ virtual bool FillItemSet(SfxItemSet* rOutAttrs) override;
+ virtual void Reset(const SfxItemSet* rInAttrs) override;
+};
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/inc/DataTableItemConverter.hxx b/chart2/source/controller/inc/DataTableItemConverter.hxx
new file mode 100644
index 000000000000..65483f0f16f1
--- /dev/null
+++ b/chart2/source/controller/inc/DataTableItemConverter.hxx
@@ -0,0 +1,57 @@
+/* -*- 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 "ItemConverter.hxx"
+#include <rtl/ref.hxx>
+#include <vector>
+
+namespace com::sun::star::awt
+{
+struct Size;
+}
+namespace com::sun::star::beans
+{
+class XPropertySet;
+}
+namespace chart
+{
+class ChartModel;
+}
+
+class SdrModel;
+
+namespace chart::wrapper
+{
+class DataTableItemConverter final : public ItemConverter
+{
+public:
+ DataTableItemConverter(const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
+ SfxItemPool& rItemPool, SdrModel& rDrawModel,
+ const rtl::Reference<::chart::ChartModel>& xChartDoc,
+ const css::awt::Size* pRefSize);
+
+ virtual ~DataTableItemConverter() override;
+
+ virtual void FillItemSet(SfxItemSet& rOutItemSet) const override;
+ virtual bool ApplyItemSet(const SfxItemSet& rItemSet) override;
+
+protected:
+ virtual const WhichRangesContainer& GetWhichPairs() const override;
+ virtual bool GetItemProperty(tWhichIdType nWhichId,
+ tPropertyNameWithMemberId& rOutProperty) const override;
+
+private:
+ std::vector<std::unique_ptr<ItemConverter>> m_aConverters;
+ rtl::Reference<::chart::ChartModel> m_xChartDoc;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx
new file mode 100644
index 000000000000..462cd2517e54
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx
@@ -0,0 +1,112 @@
+/* -*- 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 <DataTableItemConverter.hxx>
+#include <ItemPropertyMap.hxx>
+#include <CharacterPropertyItemConverter.hxx>
+#include <GraphicPropertyItemConverter.hxx>
+#include <chartview/ChartSfxItemIds.hxx>
+#include <chartview/ExplicitScaleValues.hxx>
+#include <chartview/ExplicitValueProvider.hxx>
+#include "SchWhichPairs.hxx"
+#include <ChartModelHelper.hxx>
+#include <ChartModel.hxx>
+#include <CommonConverters.hxx>
+#include <ChartType.hxx>
+#include <ChartTypeHelper.hxx>
+#include <Diagram.hxx>
+#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
+#include <memory>
+
+#include <osl/diagnose.h>
+#include <o3tl/any.hxx>
+#include <svl/eitem.hxx>
+#include <svx/chrtitem.hxx>
+#include <svx/sdangitm.hxx>
+#include <svl/intitem.hxx>
+#include <rtl/math.hxx>
+
+using namespace css;
+
+namespace chart::wrapper
+{
+namespace
+{
+ItemPropertyMapType& lclDataTablePropertyMap()
+{
+ static ItemPropertyMapType aPropertyMap{
+ { SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, { "HBorder", 0 } },
+ { SCHATTR_DATA_TABLE_VERTICAL_BORDER, { "VBorder", 0 } },
+ { SCHATTR_DATA_TABLE_OUTLINE, { "Outline", 0 } },
+ { SCHATTR_DATA_TABLE_KEYS, { "Keys", 0 } },
+ };
+ return aPropertyMap;
+};
+}
+
+DataTableItemConverter::DataTableItemConverter(
+ const uno::Reference<beans::XPropertySet>& rPropertySet, SfxItemPool& rItemPool,
+ SdrModel& rDrawModel, const rtl::Reference<::chart::ChartModel>& xChartDoc,
+ const awt::Size* pRefSize)
+ : ItemConverter(rPropertySet, rItemPool)
+ , m_xChartDoc(xChartDoc)
+{
+ m_aConverters.emplace_back(new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel, xChartDoc, GraphicObjectType::LineProperties));
+ m_aConverters.emplace_back(
+ new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
+}
+
+DataTableItemConverter::~DataTableItemConverter() = default;
+
+void DataTableItemConverter::FillItemSet(SfxItemSet& rOutItemSet) const
+{
+ for (const auto& pConv : m_aConverters)
+ {
+ pConv->FillItemSet(rOutItemSet);
+ }
+
+ // own items
+ ItemConverter::FillItemSet(rOutItemSet);
+}
+
+bool DataTableItemConverter::ApplyItemSet(const SfxItemSet& rItemSet)
+{
+ bool bResult = false;
+
+ for (const auto& pConv : m_aConverters)
+ {
+ bResult = pConv->ApplyItemSet(rItemSet) || bResult;
+ }
+
+ // own items
+ return ItemConverter::ApplyItemSet(rItemSet) || bResult;
+}
+
+const WhichRangesContainer& DataTableItemConverter::GetWhichPairs() const
+{
+ return nDataTableWhichPairs;
+}
+
+bool DataTableItemConverter::GetItemProperty(tWhichIdType nWhichId,
+ tPropertyNameWithMemberId& rOutProperty) const
+{
+ ItemPropertyMapType& rMap(lclDataTablePropertyMap());
+ auto aIt = rMap.find(nWhichId);
+ if (aIt == rMap.cend())
+ return false;
+
+ rOutProperty = (*aIt).second;
+
+ return true;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
index 3c1387009afd..3b33a1b57b29 100644
--- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -171,4 +171,12 @@ const WhichRangesContainer nRegEquationWhichPairs(svl::Items<
SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING // Characters
>);
+const WhichRangesContainer nDataTableWhichPairs(svl::Items<
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END,
+ SCHATTR_DATA_TABLE_START, SCHATTR_DATA_TABLE_END,
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
+ EE_ITEMS_START, EE_ITEMS_END
+>);
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index 1b72833f93bc..feb8cc6c8a59 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -33,6 +33,7 @@
#include <MultipleChartConverters.hxx>
#include <TitleItemConverter.hxx>
#include <LegendItemConverter.hxx>
+#include <DataTableItemConverter.hxx>
#include <RegressionCurveItemConverter.hxx>
#include <RegressionEquationItemConverter.hxx>
#include <ErrorBarItemConverter.hxx>
@@ -287,6 +288,17 @@ wrapper::ItemConverter* createItemConverter(
rDrawModel, xChartModel,
wrapper::GraphicObjectType::LineAndFillProperties );
break;
+ case OBJECTTYPE_DATA_TABLE:
+ {
+ std::unique_ptr<awt::Size> pRefSize;
+ if (pRefSizeProvider)
+ pRefSize.reset(new awt::Size(pRefSizeProvider->getPageSize()));
+
+ pItemConverter = new wrapper::DataTableItemConverter(
+ xObjectProperties, rDrawModel.GetItemPool(),
+ rDrawModel, xChartModel, pRefSize.get());
+ }
+ break;
default: //OBJECTTYPE_UNKNOWN
break;
}
diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx
index c696a94d8fcd..acf1417e3dc7 100644
--- a/chart2/source/controller/main/ObjectHierarchy.cxx
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -217,6 +217,14 @@ void ObjectHierarchy::createAxesTree(
if( !bSupportsAxesGrids )
return;
+ // Data Table
+ uno::Reference<chart2::XDataTable> xDataTable = xDiagram->getDataTable();
+ if (xDataTable.is())
+ {
+ rContainer.push_back(ObjectIdentifier::createClassifiedIdentifierForObject(xDataTable, xChartDoc));
+ }
+
+ // Axes
std::vector< rtl::Reference< Axis > > aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true );
if( !m_bOrderingForElementSelector )
{
diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx
index 0c64234fc68b..b79a5fe9ca1e 100644
--- a/chart2/source/inc/ObjectIdentifier.hxx
+++ b/chart2/source/inc/ObjectIdentifier.hxx
@@ -74,6 +74,7 @@ enum ObjectType
OBJECTTYPE_DATA_STOCK_RANGE,
OBJECTTYPE_DATA_STOCK_LOSS,
OBJECTTYPE_DATA_STOCK_GAIN,
+ OBJECTTYPE_DATA_TABLE,
OBJECTTYPE_SHAPE,
OBJECTTYPE_UNKNOWN
};
@@ -149,6 +150,9 @@ public:
static OUString createParticleForLegend(
const rtl::Reference<::chart::ChartModel>& xChartModel );
+ static OUString createParticleForDataTable(
+ const rtl::Reference<::chart::ChartModel>& xChartModel );
+
static OUString addChildParticle( std::u16string_view rParticle, std::u16string_view rChildParticle );
static OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex );
static sal_Int32 getIndexFromParticleOrCID( const OUString& rParticleOrCID );
diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
index 45773344f873..a5099cc0c31a 100644
--- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx
+++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx
@@ -194,7 +194,14 @@ constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_YNAME
constexpr TypedWhichId<SfxInt32Item> SCHATTR_REGRESSION_MOVING_TYPE (SCHATTR_REGRESSION_START + 12);
constexpr sal_uInt16 SCHATTR_REGRESSION_END (SCHATTR_REGRESSION_MOVING_TYPE);
-constexpr sal_uInt16 SCHATTR_END (SCHATTR_REGRESSION_END);
+constexpr sal_uInt16 SCHATTR_DATA_TABLE_START (SCHATTR_REGRESSION_END + 1);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_HORIZONTAL_BORDER (SCHATTR_DATA_TABLE_START + 0);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_VERTICAL_BORDER (SCHATTR_DATA_TABLE_START + 1);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_OUTLINE (SCHATTR_DATA_TABLE_START + 2);
+constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_KEYS (SCHATTR_DATA_TABLE_START + 3);
+constexpr sal_uInt16 SCHATTR_DATA_TABLE_END (SCHATTR_DATA_TABLE_KEYS);
+
+constexpr sal_uInt16 SCHATTR_END (SCHATTR_DATA_TABLE_END);
// values for Items
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index 38bbdebe3aed..e6a375817a37 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -322,6 +322,12 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject(
}
+ uno::Reference<chart2::XDataTable> xDataTable(xObject, uno::UNO_QUERY);
+ if (xDataTable.is())
+ {
+ return createClassifiedIdentifierForParticle(createParticleForDataTable(xChartModel));
+ }
+
//axis
Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
if( xAxis.is() )
@@ -544,6 +550,11 @@ OUString ObjectIdentifier::createParticleForLegend(
return ObjectIdentifier::createParticleForDiagram() + ":" + getStringForType( OBJECTTYPE_LEGEND ) + "=";
}
+OUString ObjectIdentifier::createParticleForDataTable(const rtl::Reference<::chart::ChartModel>& /* xChartModel */)
+{
+ return ObjectIdentifier::createParticleForDiagram() + ":" + getStringForType(OBJECTTYPE_DATA_TABLE) + "=";
+}
+
OUString ObjectIdentifier::createClassifiedIdentifier(
enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
, std::u16string_view rParticleID )//e.g. SeriesID
@@ -870,6 +881,9 @@ OUString ObjectIdentifier::getStringForType( ObjectType eObjectType )
case OBJECTTYPE_DATA_STOCK_GAIN:
aRet="StockGain";
break;
+ case OBJECTTYPE_DATA_TABLE:
+ aRet="DataTable";
+ break;
default: //OBJECTTYPE_UNKNOWN
;
}
@@ -941,6 +955,8 @@ ObjectType ObjectIdentifier::getObjectType( std::u16string_view aCID )
eRet = OBJECTTYPE_DATA_STOCK_LOSS;
else if( o3tl::starts_with(aCID, u"StockGain") )
eRet = OBJECTTYPE_DATA_STOCK_GAIN;
+ else if( o3tl::starts_with(aCID, u"DataTable") )
+ eRet = OBJECTTYPE_DATA_TABLE;
else
eRet = OBJECTTYPE_UNKNOWN;
@@ -1240,6 +1256,13 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
xChartType->getPropertyValue( "WhiteDay" ) >>= xObjectProperties;
}
break;
+ case OBJECTTYPE_DATA_TABLE:
+ {
+ if (xDiagram.is())
+ xObjectProperties.set(xDiagram->getDataTable(), uno::UNO_QUERY);
+ }
+ break;
+ break;
default: //OBJECTTYPE_UNKNOWN
break;
}
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 37e78c116b76..3cf5a99fc29d 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -175,6 +175,11 @@ ChartItemPool::ChartItemPool():
rPoolDefaults[SCHATTR_REGRESSION_YNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_YNAME, "f(x)");
rPoolDefaults[SCHATTR_REGRESSION_MOVING_TYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_REGRESSION_MOVING_TYPE, css::chart2::MovingAverageType::Prior);
+ rPoolDefaults[SCHATTR_DATA_TABLE_HORIZONTAL_BORDER - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false);
+ rPoolDefaults[SCHATTR_DATA_TABLE_VERTICAL_BORDER - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false);
+ rPoolDefaults[SCHATTR_DATA_TABLE_OUTLINE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, false);
+ rPoolDefaults[SCHATTR_DATA_TABLE_KEYS - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, false);
+
/**************************************************************************
* ItemInfos
**************************************************************************/
diff --git a/chart2/uiconfig/ui/tp_DataTable.ui b/chart2/uiconfig/ui/tp_DataTable.ui
new file mode 100644
index 000000000000..b9544f7c3e4e
--- /dev/null
+++ b/chart2/uiconfig/ui/tp_DataTable.ui
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.2 -->
+<interface domain="chart">
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkBox" id="DataTableTabPage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="border-width">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <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">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>