From 300ea910badeef2c8038d9bb20683ea26f4b1973 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 28 Jun 2022 07:48:45 +0200 Subject: chart2: add UI to the data table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- chart2/Library_chartcontroller.mk | 2 + chart2/UIConfig_chart2.mk | 1 + chart2/inc/strings.hrc | 2 + .../controller/dialogs/ObjectNameProvider.cxx | 3 + .../controller/dialogs/dlg_ObjectProperties.cxx | 7 ++ chart2/source/controller/dialogs/tp_DataTable.cxx | 113 ++++++++++++++++++++ chart2/source/controller/dialogs/tp_DataTable.hxx | 43 ++++++++ .../controller/inc/DataTableItemConverter.hxx | 57 ++++++++++ .../itemsetwrapper/DataTableItemConverter.cxx | 112 ++++++++++++++++++++ .../controller/itemsetwrapper/SchWhichPairs.hxx | 8 ++ .../controller/main/ChartController_Properties.cxx | 12 +++ chart2/source/controller/main/ObjectHierarchy.cxx | 8 ++ chart2/source/inc/ObjectIdentifier.hxx | 4 + chart2/source/inc/chartview/ChartSfxItemIds.hxx | 9 +- chart2/source/tools/ObjectIdentifier.cxx | 23 +++++ chart2/source/view/main/ChartItemPool.cxx | 5 + chart2/uiconfig/ui/tp_DataTable.ui | 115 +++++++++++++++++++++ 17 files changed, 523 insertions(+), 1 deletion(-) create mode 100644 chart2/source/controller/dialogs/tp_DataTable.cxx create mode 100644 chart2/source/controller/dialogs/tp_DataTable.hxx create mode 100644 chart2/source/controller/inc/DataTableItemConverter.hxx create mode 100644 chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx create mode 100644 chart2/uiconfig/ui/tp_DataTable.ui 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 #include #include @@ -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 +#include + +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 DataTableTabPage::Create(weld::Container* pPage, + weld::DialogController* pController, + const SfxItemSet* rAttrs) +{ + return std::make_unique(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(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(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(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(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 + +namespace weld +{ +class CheckButton; +} + +namespace chart +{ +class DataTableTabPage : public SfxTabPage +{ +private: + std::unique_ptr m_xCbHorizontalBorder; + std::unique_ptr m_xCbVerticalBorder; + std::unique_ptr m_xCbOutilne; + std::unique_ptr m_xCbKeys; + +public: + DataTableTabPage(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet& rInAttrs); + virtual ~DataTableTabPage() override; + + static std::unique_ptr + 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 +#include + +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& 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> 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 +#include +#include +#include +#include +#include +#include +#include "SchWhichPairs.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +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& 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 #include #include +#include #include #include #include @@ -287,6 +288,17 @@ wrapper::ItemConverter* createItemConverter( rDrawModel, xChartModel, wrapper::GraphicObjectType::LineAndFillProperties ); break; + case OBJECTTYPE_DATA_TABLE: + { + std::unique_ptr 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 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 SCHATTR_REGRESSION_YNAME constexpr TypedWhichId 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 SCHATTR_DATA_TABLE_HORIZONTAL_BORDER (SCHATTR_DATA_TABLE_START + 0); +constexpr TypedWhichId SCHATTR_DATA_TABLE_VERTICAL_BORDER (SCHATTR_DATA_TABLE_START + 1); +constexpr TypedWhichId SCHATTR_DATA_TABLE_OUTLINE (SCHATTR_DATA_TABLE_START + 2); +constexpr TypedWhichId 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 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 @@ + + + + + + True + False + True + True + 6 + vertical + 12 + + + True + False + True + True + 0 + none + + + True + False + 12 + 6 + True + True + vertical + 6 + + + Show Horizontal Border + True + True + False + start + True + True + + + False + True + 0 + + + + + Show Vertical Border + True + True + False + start + True + True + + + False + True + 1 + + + + + Show Outline + True + True + False + start + True + True + + + False + True + 2 + + + + + Show Keys + True + True + False + start + True + True + + + False + True + 3 + + + + + + + True + False + Data Table Properties + + + + + + + + False + True + 0 + + + + -- cgit v1.2.3