Rebased ref, commits from common ancestor: commit dbb95218b62bc2f48c2ecd8cc5fa5b93237e7547 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jul 1 22:00:38 2022 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Fri Jul 1 22:00:38 2022 +0200
chart2: add InsertDataTableDialog for adding the data table Change-Id: Ie3c033c587b150723e7aa39cd5ddf5774104db9a 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 7c660af86f81..8766cc80559b 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_InsertDataTable() { - 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> commit 280dc937dce493250243d830c63580f7b1decde6 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Jun 30 23:43:52 2022 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:54 2022 +0200 chart2: add some data table default properties Change-Id: I4fac46ac2a119275bcdaa6ebc8b7382ad6fb5684 diff --git a/chart2/source/model/main/DataTable.cxx b/chart2/source/model/main/DataTable.cxx index 0620ce5ccaba..c67fab5c1740 100644 --- a/chart2/source/model/main/DataTable.cxx +++ b/chart2/source/model/main/DataTable.cxx @@ -70,6 +70,14 @@ private: true); ::chart::PropertyHelper::setPropertyValueDefault(aMap, DataTableProperty_Outilne, true); ::chart::PropertyHelper::setPropertyValueDefault(aMap, DataTableProperty_Keys, false); + + float fDefaultCharHeight = 10.0; + ::chart::PropertyHelper::setPropertyValue( + aMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight); + ::chart::PropertyHelper::setPropertyValue( + aMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight); + ::chart::PropertyHelper::setPropertyValue( + aMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight); } }; commit e5a684fa4216579057b435f3a11f8a6b815f1247 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Thu Jun 30 23:34:19 2022 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:54 2022 +0200 chart2: add "InsertDataTable" action to menu Change-Id: Ib60a2b061966eb61834480b63dc0653410a43a14 diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index 505b109fdcc7..e8b78a309e12 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -440,6 +440,7 @@ private: void executeDispatch_OpenLegendDialog(); void executeDispatch_InsertAxes(); void executeDispatch_InsertGrid(); + void executeDispatch_InsertDataTable(); void executeDispatch_InsertMenu_DataLabels(); void executeDispatch_InsertMenu_Trendlines(); diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index a4bd7a3972cc..79e05b77e885 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -1169,6 +1169,8 @@ void SAL_CALL ChartController::dispatch( this->executeDispatch_InsertErrorBars(false); else if( aCommand == "InsertMenuYErrorBars" ) this->executeDispatch_InsertErrorBars(true); + else if( aCommand == "InsertDataTable" ) + this->executeDispatch_InsertDataTable(); else if( aCommand == "InsertSymbol" ) this->executeDispatch_InsertSpecialCharacter(); else if( aCommand == "InsertTrendline" ) @@ -1631,6 +1633,7 @@ const o3tl::sorted_vector< OUString >& ChartController::impl_getAvailableCommand "DeleteTrendline", "DeleteMeanValue", "DeleteTrendlineEquation", "DeleteXErrorBars", "DeleteYErrorBars", "DeleteDataLabels", "DeleteDataLabel", + "InsertDataTable", //format objects "FormatSelection", "TransformDialog", "DiagramType", "View3D", diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 4f39f1068cdb..7c660af86f81 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -52,6 +52,7 @@ #include <ObjectNameProvider.hxx> #include <Legend.hxx> #include <LegendHelper.hxx> +#include <DataTable.hxx> #include <RegressionCurveModel.hxx> #include <com/sun/star/chart2/XRegressionCurve.hpp> @@ -155,6 +156,24 @@ void ChartController::executeDispatch_InsertGrid() } } +void ChartController::executeDispatch_InsertDataTable() +{ + rtl::Reference<Diagram> xDiagram = getFirstDiagram(); + SolarMutexGuard aGuard; + if (xDiagram->getDataTable().is()) + { + xDiagram->setDataTable(uno::Reference<chart2::XDataTable>()); + } + else + { + uno::Reference<chart2::XDataTable> xDataTable(new DataTable); + if (xDataTable.is()) + { + xDiagram->setDataTable(xDataTable); + } + } +} + void ChartController::executeDispatch_InsertTitles() { UndoGuard aUndoGuard( diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index e5035b4f053c..b7872b93e708 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -584,6 +584,7 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ ".uno:InsertMenuXErrorBars" ] = bIsWritable && m_apModelState->bSupportsStatistics; m_aCommandAvailability[ ".uno:InsertMenuYErrorBars" ] = bIsWritable && m_apModelState->bSupportsStatistics; m_aCommandAvailability[ ".uno:InsertSymbol" ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsTextObject; + m_aCommandAvailability[ ".uno:InsertDataTable" ] = bIsWritable; // format objects bool bFormatObjectAvailable = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected; diff --git a/chart2/uiconfig/menubar/menubar.xml b/chart2/uiconfig/menubar/menubar.xml index 354ebbc1903a..581aff37153b 100644 --- a/chart2/uiconfig/menubar/menubar.xml +++ b/chart2/uiconfig/menubar/menubar.xml @@ -56,6 +56,7 @@ <menu:menuitem menu:id=".uno:InsertMenuLegend"/> <menu:menuitem menu:id=".uno:InsertMenuAxes"/> <menu:menuitem menu:id=".uno:InsertMenuGrids"/> + <menu:menuitem menu:id=".uno:InsertDataTable"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:InsertMenuDataLabels"/> <menu:menuitem menu:id=".uno:InsertMenuTrendlines"/> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu index d3a54a052c8e..7739522a866e 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu @@ -64,6 +64,11 @@ <value xml:lang="en-US">Y Error ~Bars...</value> </prop> </node> + <node oor:name=".uno:InsertDataTable" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Data Table</value> + </prop> + </node> <!-- Menu - Format --> <node oor:name=".uno:FormatSelection" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> commit 091bd7fef3e3ffd135cc7ae10d250e0285c5849a Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Jun 29 19:25:47 2022 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:54 2022 +0200 chart2: allow to select the data table, fix object CID Change-Id: I0a8d3643fcaefe8105e935b929947174bd9bdc96 diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx index 7d985051a4a7..814d3afd7858 100644 --- a/chart2/source/view/axes/VAxisBase.cxx +++ b/chart2/source/view/axes/VAxisBase.cxx @@ -187,7 +187,7 @@ bool VAxisBase::prepareShapeCreation() if (m_aAxisProperties.m_bDisplayLabels) m_xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget, m_aCID ); if (m_aAxisProperties.m_bDisplayDataTable) - m_xDataTableTarget = ShapeFactory::createGroup2D(m_xFinalTarget, m_aCID); + m_xDataTableTarget = ShapeFactory::createGroup2D(m_xFinalTarget); return true; } diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx index d6c05af04d18..b44612e74a4f 100644 --- a/chart2/source/view/inc/ShapeFactory.hxx +++ b/chart2/source/view/inc/ShapeFactory.hxx @@ -217,7 +217,7 @@ public: const css::uno::Reference< css::beans::XPropertySet > & xTextProperties, double nRotation, const OUString& aName, sal_Int32 nTextMaxWidth ); - static rtl::Reference<SvxTableShape> createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget); + static rtl::Reference<SvxTableShape> createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget, OUString const& rName = OUString()); static rtl::Reference<SvxShapeRect> createInvisibleRectangle( diff --git a/chart2/source/view/main/DataTableView.cxx b/chart2/source/view/main/DataTableView.cxx index dfda4130a921..c5ece1370efb 100644 --- a/chart2/source/view/main/DataTableView.cxx +++ b/chart2/source/view/main/DataTableView.cxx @@ -12,6 +12,7 @@ #include <ShapeFactory.hxx> #include <ExplicitCategoriesProvider.hxx> #include <ChartModel.hxx> +#include <ObjectIdentifier.hxx> #include <svx/svdotable.hxx> @@ -191,7 +192,9 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV return; ShapeFactory::removeSubShapes(m_xTarget); - m_xTableShape = ShapeFactory::createTable(m_xTarget); + auto sParticle = ObjectIdentifier::createParticleForDataTable(m_xChartModel); + auto sCID = ObjectIdentifier::createClassifiedIdentifierForParticle(sParticle); + m_xTableShape = ShapeFactory::createTable(m_xTarget, sCID); uno::Reference<table::XTable> xTable; try diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 7fddc5d018d5..8f9f29ced232 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -2533,16 +2533,17 @@ void ShapeFactory::removeSubShapes( const rtl::Reference<SvxShapeGroupAnyD>& xSh } rtl::Reference<SvxTableShape> -ShapeFactory::createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget) +ShapeFactory::createTable(rtl::Reference<SvxShapeGroupAnyD> const& xTarget, OUString const& rName) { - if( !xTarget.is() ) + if (!xTarget.is()) return nullptr; //create table shape rtl::Reference<SvxTableShape> xShape = new SvxTableShape(nullptr); xShape->setShapeKind(SdrObjKind::Table); xTarget->addShape(*xShape); - + if (!rName.isEmpty()) + setShapeName(xShape, rName); return xShape; } commit a849d1ba4649dab643aa802ea51494653a6275ec Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Tue Jun 28 07:48:45 2022 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:54 2022 +0200 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 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..ad5d1aed4fc4 --- /dev/null +++ b/chart2/source/controller/inc/DataTableItemConverter.hxx @@ -0,0 +1,60 @@ +/* -*- 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; + + virtual void FillSpecialItem(sal_uInt16 nWhichId, SfxItemSet& rOutItemSet) const override; + virtual bool ApplySpecialItem(sal_uInt16 nWhichId, const SfxItemSet& rItemSet) 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..103724816d42 --- /dev/null +++ b/chart2/source/controller/itemsetwrapper/DataTableItemConverter.cxx @@ -0,0 +1,119 @@ +/* -*- 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; +} + +void DataTableItemConverter::FillSpecialItem(sal_uInt16 nWhichId, SfxItemSet& rOutItemSet) const {} + +bool DataTableItemConverter::ApplySpecialItem(sal_uInt16 nWhichId, const SfxItemSet& rItemSet) +{ + return false; +} + +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> commit 6d846b2b7b3c11ed9f9cdd8a6e2cdee5e3f48e8d Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jun 17 16:38:54 2022 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:54 2022 +0200 chart2: remove unneeded class prefix in ObjectHierarchy.cxx Change-Id: Iee007f7ff4d9665ee089712e7ba98090a8090609 diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index ab1fa891377e..c696a94d8fcd 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -115,7 +115,7 @@ void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xCh ObjectIdentifier aDiaOID; if( xDiagram.is() ) aDiaOID = ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( static_cast<cppu::OWeakObject*>(xDiagram.get()), xChartDocument ) ); - ObjectHierarchy::tChildContainer aTopLevelContainer; + tChildContainer aTopLevelContainer; // First Level @@ -158,7 +158,7 @@ void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xCh createDiagramTree( aTopLevelContainer, xChartDocument, xDiagram ); else { - ObjectHierarchy::tChildContainer aSubContainer; + tChildContainer aSubContainer; createDiagramTree( aSubContainer, xChartDocument, xDiagram ); if( !aSubContainer.empty() ) m_aChildMap[ aDiaOID ] = aSubContainer; @@ -179,11 +179,11 @@ void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xCh aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) ); if( ! aTopLevelContainer.empty()) - m_aChildMap[ ObjectHierarchy::getRootNodeOID() ] = aTopLevelContainer; + m_aChildMap[ObjectHierarchy::getRootNodeOID()] = aTopLevelContainer; } void ObjectHierarchy::createLegendTree( - ObjectHierarchy::tChildContainer & rContainer, + tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, const rtl::Reference< Diagram > & xDiagram ) { @@ -199,7 +199,7 @@ void ObjectHierarchy::createLegendTree( rtl::Reference< SvxShapeGroupAnyD > xLegendShapeContainer = dynamic_cast<SvxShapeGroupAnyD*>( m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ).get() ); - ObjectHierarchy::tChildContainer aLegendEntryOIDs; + tChildContainer aLegendEntryOIDs; lcl_getChildOIDs( aLegendEntryOIDs, xLegendShapeContainer ); m_aChildMap[ aLegendOID ] = aLegendEntryOIDs; @@ -207,7 +207,7 @@ void ObjectHierarchy::createLegendTree( } void ObjectHierarchy::createAxesTree( - ObjectHierarchy::tChildContainer & rContainer, + tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, const rtl::Reference< Diagram > & xDiagram ) { @@ -271,7 +271,7 @@ void ObjectHierarchy::createAxesTree( } void ObjectHierarchy::createWallAndFloor( - ObjectHierarchy::tChildContainer & rContainer, + tChildContainer & rContainer, const rtl::Reference< Diagram > & xDiagram ) { sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); @@ -289,7 +289,7 @@ void ObjectHierarchy::createWallAndFloor( } void ObjectHierarchy::createDiagramTree( - ObjectHierarchy::tChildContainer & rContainer, + tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, const rtl::Reference< Diagram > & xDiagram ) { @@ -307,7 +307,7 @@ void ObjectHierarchy::createDiagramTree( } void ObjectHierarchy::createDataSeriesTree( - ObjectHierarchy::tChildContainer & rOutDiagramSubContainer, + tChildContainer & rOutDiagramSubContainer, const rtl::Reference< Diagram > & xDiagram ) { try @@ -334,7 +334,7 @@ void ObjectHierarchy::createDataSeriesTree( ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForParticle( aSeriesParticle ) ) ); rOutDiagramSubContainer.push_back( aSeriesOID ); - ObjectHierarchy::tChildContainer aSeriesSubContainer; + tChildContainer aSeriesSubContainer; rtl::Reference< DataSeries > const & xSeries = aSeriesSeq[nSeriesIdx]; @@ -406,7 +406,7 @@ void ObjectHierarchy::createDataSeriesTree( } } -void ObjectHierarchy::createAdditionalShapesTree( ObjectHierarchy::tChildContainer& rContainer ) +void ObjectHierarchy::createAdditionalShapesTree(tChildContainer& rContainer) { try { @@ -453,7 +453,7 @@ const ObjectHierarchy::tChildContainer & ObjectHierarchy::getChildren( const Obj if( aIt != m_aChildMap.end()) return aIt->second; } - static const ObjectHierarchy::tChildContainer EMPTY; + static const tChildContainer EMPTY; return EMPTY; } @@ -463,13 +463,13 @@ const ObjectHierarchy::tChildContainer & ObjectHierarchy::getSiblings( const Obj { for (auto const& child : m_aChildMap) { - ObjectHierarchy::tChildContainer::const_iterator aElemIt( + tChildContainer::const_iterator aElemIt( std::find( child.second.begin(), child.second.end(), rNode )); if( aElemIt != child.second.end()) return child.second; } } - static const ObjectHierarchy::tChildContainer EMPTY; + static const tChildContainer EMPTY; return EMPTY; } @@ -478,8 +478,8 @@ ObjectIdentifier ObjectHierarchy::getParentImpl( const ObjectIdentifier & rOID ) const { // search children - ObjectHierarchy::tChildContainer aChildren( getChildren( rParentOID )); - ObjectHierarchy::tChildContainer::const_iterator aIt( + tChildContainer aChildren( getChildren( rParentOID )); + tChildContainer::const_iterator aIt( std::find( aChildren.begin(), aChildren.end(), rOID )); // recursion end if( aIt != aChildren.end()) commit 110d4b5ee4517fe277fd054f8cccca7c22a9f428 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jun 17 16:29:23 2022 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:54 2022 +0200 chart2: call clear instead of creating a new empty map Change-Id: I8b21909e92b558240e84cffd9432e0d9e270284e diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index e1f3697e6250..ab1fa891377e 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -105,7 +105,7 @@ namespace chart void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xChartDocument ) { - m_aChildMap = tChildMap();//clear tree + m_aChildMap.clear(); if( !xChartDocument.is() ) return; commit bd64e2beaa0a5141ff3feba8320663a2030c93ac Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Jun 17 16:28:38 2022 +0200 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:54 2022 +0200 chart2: remove unneeded class prefix in ObjectHierarchy.hxx Change-Id: I1c851933e9b25dcd9a0dc29758baad8f3be7cb2e diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx index 1255b7ac9910..1531866aaf2b 100644 --- a/chart2/source/controller/inc/ObjectHierarchy.hxx +++ b/chart2/source/controller/inc/ObjectHierarchy.hxx @@ -52,11 +52,10 @@ public: static bool isRootNode( const ObjectIdentifier& rOID ); /// equal to getChildren( getRootNodeOID()) - const tChildContainer & getTopLevelChildren() const; - bool hasChildren( const ObjectIdentifier& rParent ) const; - const tChildContainer & getChildren( const ObjectIdentifier& rParent ) const; - - const tChildContainer & getSiblings( const ObjectIdentifier& rNode ) const; + const tChildContainer& getTopLevelChildren() const; + bool hasChildren(const ObjectIdentifier& rParent) const; + const tChildContainer& getChildren(const ObjectIdentifier& rParent) const; + const tChildContainer& getSiblings(const ObjectIdentifier& rNode) const; /// The result is empty, if the node cannot be found in the tree ObjectIdentifier getParent( const ObjectIdentifier& rNode ) const; @@ -66,30 +65,29 @@ public: private: void createTree( const rtl::Reference<::chart::ChartModel> & xChartDocument ); void createAxesTree( - ObjectHierarchy::tChildContainer & rContainer, + tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, const rtl::Reference< ::chart::Diagram > & xDiagram ); void createDiagramTree( - ObjectHierarchy::tChildContainer& rContainer, + tChildContainer& rContainer, const rtl::Reference<::chart::ChartModel>& xChartDoc, const rtl::Reference< ::chart::Diagram >& xDiagram ); void createDataSeriesTree( - ObjectHierarchy::tChildContainer & rOutDiagramSubContainer, + tChildContainer & rOutDiagramSubContainer, const rtl::Reference< ::chart::Diagram > & xDiagram ); static void createWallAndFloor( - ObjectHierarchy::tChildContainer & rContainer, + tChildContainer & rContainer, const rtl::Reference< ::chart::Diagram > & xDiagram ); void createLegendTree( - ObjectHierarchy::tChildContainer & rContainer, + tChildContainer & rContainer, const rtl::Reference<::chart::ChartModel> & xChartDoc, const rtl::Reference< ::chart::Diagram > & xDiagram ); - void createAdditionalShapesTree( ObjectHierarchy::tChildContainer& rContainer ); + void createAdditionalShapesTree(tChildContainer& rContainer); ObjectIdentifier getParentImpl( const ObjectIdentifier& rParentOID, const ObjectIdentifier& rOID ) const; - typedef std::map< ObjectIdentifier, ObjectHierarchy::tChildContainer > - tChildMap; + typedef std::map<ObjectIdentifier, tChildContainer> tChildMap; tChildMap m_aChildMap; ExplicitValueProvider* m_pExplicitValueProvider; bool m_bFlattenDiagram; commit 373c79f0b0d5a0cd8c87c3a4b576cec628898820 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon May 23 15:50:59 2022 +0900 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:53 2022 +0200 oox export: export line/fill and text props. of a data table Change-Id: I02a4c35693b599578e073d52a2d22ad59bc31786 diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 988fe4413529..458f72112907 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -2066,6 +2066,9 @@ void ChartExport::exportDataTable( ) if (bShowKeys) pFS->singleElement(FSNS(XML_c, XML_showKeys), XML_val, "1"); + exportShapeProps(aPropSet); + exportTextProps(aPropSet); + pFS->endElement(FSNS(XML_c, XML_dTable)); } commit 2dec391a7da6d61bd7c010f06ee21add71260044 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat May 21 10:52:51 2022 +0900 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:53 2022 +0200 chart2: set the char props. to the cells of a data table from model This copies the char. properties from the model to the cells of a data table, so the correct char width, font is used for text when the table is rendered. Also add margin to the text, so it looks better. Change-Id: Ib74a8136459a31d64a86dec36a6ba14d2c313cf2 diff --git a/chart2/source/view/main/DataTableView.cxx b/chart2/source/view/main/DataTableView.cxx index da857fbd560d..dfda4130a921 100644 --- a/chart2/source/view/main/DataTableView.cxx +++ b/chart2/source/view/main/DataTableView.cxx @@ -5,7 +5,6 @@ * 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 <DataTableView.hxx> @@ -59,11 +58,70 @@ void setTopCell(uno::Reference<beans::XPropertySet>& xPropertySet) xPropertySet->setPropertyValue("TopBorder", uno::Any(aBorderLine)); xPropertySet->setPropertyValue("LeftBorder", uno::Any(aBorderLine)); } + +void copyProperty(uno::Reference<beans::XPropertySet>& xOut, + uno::Reference<beans::XPropertySet>& xIn, OUString const& sPropertyName) +{ + xOut->setPropertyValue(sPropertyName, xIn->getPropertyValue(sPropertyName)); +} } void DataTableView::setCellDefaults(uno::Reference<beans::XPropertySet>& xPropertySet, bool bLeft, bool bTop, bool bRight, bool bBottom) { + uno::Reference<beans::XPropertySet> xDataTableProperties = m_xDataTableModel.get(); + + copyProperty(xPropertySet, xDataTableProperties, "CharColor"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontFamily"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontFamilyAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontFamilyComplex"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSet"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSetAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontCharSetComplex"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontName"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontNameAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontNameComplex"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontPitch"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontPitchAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontPitchComplex"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontStyleName"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontStyleNameAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharFontStyleNameComplex"); + + copyProperty(xPropertySet, xDataTableProperties, "CharHeight"); + copyProperty(xPropertySet, xDataTableProperties, "CharHeightAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharHeightComplex"); + copyProperty(xPropertySet, xDataTableProperties, "CharKerning"); + copyProperty(xPropertySet, xDataTableProperties, "CharLocale"); + copyProperty(xPropertySet, xDataTableProperties, "CharLocaleAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharLocaleComplex"); + copyProperty(xPropertySet, xDataTableProperties, "CharPosture"); + copyProperty(xPropertySet, xDataTableProperties, "CharPostureAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharPostureComplex"); + copyProperty(xPropertySet, xDataTableProperties, "CharRelief"); + copyProperty(xPropertySet, xDataTableProperties, "CharShadowed"); + copyProperty(xPropertySet, xDataTableProperties, "CharStrikeout"); + copyProperty(xPropertySet, xDataTableProperties, "CharUnderline"); + copyProperty(xPropertySet, xDataTableProperties, "CharUnderlineColor"); + copyProperty(xPropertySet, xDataTableProperties, "CharUnderlineHasColor"); + copyProperty(xPropertySet, xDataTableProperties, "CharOverline"); + copyProperty(xPropertySet, xDataTableProperties, "CharOverlineColor"); + copyProperty(xPropertySet, xDataTableProperties, "CharOverlineHasColor"); + copyProperty(xPropertySet, xDataTableProperties, "CharWeight"); + copyProperty(xPropertySet, xDataTableProperties, "CharWeightAsian"); + copyProperty(xPropertySet, xDataTableProperties, "CharWeightComplex"); + copyProperty(xPropertySet, xDataTableProperties, "CharWordMode"); + + float fFontHeight = 0.0; + xDataTableProperties->getPropertyValue("CharHeight") >>= fFontHeight; + fFontHeight = o3tl::convert(fFontHeight, o3tl::Length::pt, o3tl::Length::mm100); + uno::Any aXDistanceAny(sal_Int32(std::round(fFontHeight * 0.18f))); + uno::Any aYDistanceAny(sal_Int32(std::round(fFontHeight * 0.30f))); + xPropertySet->setPropertyValue("TextLeftDistance", aXDistanceAny); + xPropertySet->setPropertyValue("TextRightDistance", aXDistanceAny); + xPropertySet->setPropertyValue("TextUpperDistance", aYDistanceAny); + xPropertySet->setPropertyValue("TextLowerDistance", aYDistanceAny); + xPropertySet->setPropertyValue("FillColor", uno::Any(Color(0xFFFFFF))); xPropertySet->setPropertyValue("TextVerticalAdjust", uno::Any(drawing::TextVerticalAdjust_TOP)); xPropertySet->setPropertyValue("ParaAdjust", uno::Any(style::ParagraphAdjust_CENTER)); commit 9646109088d1dcc4d5d21f1ca92ed12e59221787 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat May 21 10:51:55 2022 +0900 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:53 2022 +0200 chart2: add char properties to the DataTable model Change-Id: Ie4b49f36def7d20f89695157c3b95e6ee5d16d83 diff --git a/chart2/source/model/main/DataTable.cxx b/chart2/source/model/main/DataTable.cxx index 83ebd9e3a6e2..0620ce5ccaba 100644 --- a/chart2/source/model/main/DataTable.cxx +++ b/chart2/source/model/main/DataTable.cxx @@ -91,8 +91,9 @@ private: { std::vector<beans::Property> aProperties; lcl_AddPropertiesToVector(aProperties); - chart::LinePropertiesHelper::AddPropertiesToVector(aProperties); - chart::FillProperties::AddPropertiesToVector(aProperties); + ::chart::LinePropertiesHelper::AddPropertiesToVector(aProperties); + ::chart::FillProperties::AddPropertiesToVector(aProperties); + ::chart::CharacterProperties::AddPropertiesToVector(aProperties); std::sort(aProperties.begin(), aProperties.end(), chart::PropertyNameLess()); return comphelper::containerToSequence(aProperties); @@ -211,7 +212,8 @@ sal_Bool SAL_CALL DataTable::supportsService(const OUString& rServiceName) uno::Sequence<OUString> SAL_CALL DataTable::getSupportedServiceNames() { return { "com.sun.star.chart2.DataTable", "com.sun.star.beans.PropertySet", - "com.sun.star.drawing.FillProperties", "com.sun.star.drawing.LineProperties" }; + "com.sun.star.drawing.FillProperties", "com.sun.star.drawing.LineProperties", + "com.sun.star.style.CharacterProperties" }; } IMPLEMENT_FORWARD_XINTERFACE2(DataTable, DataTable_Base, ::property::OPropertySet) commit c7026aa1a8a90eaee3ee1fee97abeddc989cf8d8 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat May 21 00:00:30 2022 +0900 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:53 2022 +0200 oox export: add export of basic properties of a data table Change-Id: I2c8b76125fc788a9e4df164171d6cbd351bc1c4a diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 8a6d5fa7d298..988fe4413529 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1732,6 +1732,7 @@ void ChartExport::exportPlotArea(const Reference< css::chart::XChartDocument >& } //Axis Data exportAxes( ); + // Data Table exportDataTable(); @@ -2033,35 +2034,41 @@ void ChartExport::exportGradientFill( const Reference< XPropertySet >& xPropSet void ChartExport::exportDataTable( ) { + auto xDataTable = mxNewDiagram->getDataTable(); + if (!xDataTable.is()) + return; + FSHelperPtr pFS = GetFS(); - Reference< beans::XPropertySet > aPropSet( mxDiagram, uno::UNO_QUERY ); + uno::Reference<beans::XPropertySet> aPropSet(xDataTable, uno::UNO_QUERY); bool bShowVBorder = false; bool bShowHBorder = false; bool bShowOutline = false; + bool bShowKeys = false; - if (GetProperty( aPropSet, "DataTableHBorder")) + if (GetProperty(aPropSet, "HBorder")) mAny >>= bShowHBorder; - if (GetProperty( aPropSet, "DataTableVBorder")) + if (GetProperty(aPropSet, "VBorder")) mAny >>= bShowVBorder; - if (GetProperty( aPropSet, "DataTableOutline")) + if (GetProperty(aPropSet, "Outline")) + mAny >>= bShowOutline; + if (GetProperty(aPropSet, "Keys")) mAny >>= bShowOutline; - - if (!(bShowVBorder || bShowHBorder || bShowOutline)) - return; pFS->startElement(FSNS(XML_c, XML_dTable)); + if (bShowHBorder) - pFS->singleElement( FSNS( XML_c, XML_showHorzBorder ), - XML_val, "1" ); + pFS->singleElement(FSNS(XML_c, XML_showHorzBorder), XML_val, "1" ); if (bShowVBorder) pFS->singleElement(FSNS(XML_c, XML_showVertBorder), XML_val, "1"); if (bShowOutline) pFS->singleElement(FSNS(XML_c, XML_showOutline), XML_val, "1"); + if (bShowKeys) + pFS->singleElement(FSNS(XML_c, XML_showKeys), XML_val, "1"); - pFS->endElement( FSNS( XML_c, XML_dTable)); - + pFS->endElement(FSNS(XML_c, XML_dTable)); } + void ChartExport::exportAreaChart( const Reference< chart2::XChartType >& xChartType ) { FSHelperPtr pFS = GetFS(); commit ef3b4459517fb8c9219e7da490cacb2a7067014d Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri May 20 23:55:45 2022 +0900 Commit: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> CommitDate: Thu Jun 30 23:55:53 2022 +0200 chart2: apply line props. to borders when rendering a data table This sets the color, line width, line style to the borders of the table when rendering the data table. We also need the ChartModel inside DataTableView, so we can access the needed line dashes. Change-Id: Id3bef23b75e88517d6569ad87a716f178ed64343 diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx index 95125beed1cf..7d985051a4a7 100644 --- a/chart2/source/view/axes/VAxisBase.cxx +++ b/chart2/source/view/axes/VAxisBase.cxx @@ -243,7 +243,8 @@ void VAxisBase::updateUnscaledValuesAtTicks( TickIter& rIter ) } void VAxisBase::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& /*rSeriesPlotterList*/, - uno::Reference<util::XNumberFormatsSupplier> const& /*xNumberFormatsSupplier*/) + uno::Reference<util::XNumberFormatsSupplier> const& /*xNumberFormatsSupplier*/, + rtl::Reference<::chart::ChartModel> const& /*xChartDoc*/) { } diff --git a/chart2/source/view/axes/VAxisBase.hxx b/chart2/source/view/axes/VAxisBase.hxx index 4da1936a452b..2c4123ba951d 100644 --- a/chart2/source/view/axes/VAxisBase.hxx +++ b/chart2/source/view/axes/VAxisBase.hxx @@ -29,6 +29,7 @@ namespace chart class VSeriesPlotter; class DataTableView; +class ChartModel; class VAxisBase : public VAxisOrGridBase { @@ -63,7 +64,8 @@ public: void setExtraLinePositionAtOtherAxis( double fCrossingAt ); virtual void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList, - css::uno::Reference<css::util::XNumberFormatsSupplier> const& xNumberFormatsSupplier); + css::uno::Reference<css::util::XNumberFormatsSupplier> const& xNumberFormatsSupplier, + rtl::Reference<::chart::ChartModel> const& xChartDoc); std::shared_ptr<DataTableView> getDataTableView() { return m_pDataTableView; } diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 096586279454..d7e78d5d2e85 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -37,6 +37,7 @@ #include <svx/unoshtxt.hxx> #include <VSeriesPlotter.hxx> ... etc. - the rest is truncated