diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-11-18 10:58:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-11-19 15:50:48 +0100 |
commit | ec6502a1f61fcbd4bf05b62f172650fe442c3a1d (patch) | |
tree | 383be2227aa9d6dd0bef8577bf478b3af3e33767 /offapi | |
parent | a38bb773bb568ef942293f23d0701da933817e8f (diff) |
tdf#151846 Restore XChartTypeTemplate
Which I removed in commit 58766f997d59e4684f2887fd8cdeb12d2f8a9366.
Turns out it does have some usefulness for extensions. So restore most
of it. The exception is the getDataInterpreter method, for which I have
added a placeholder, so that the restored class has the same vtable
layout as the original.
Change-Id: Ief9b48ef2c408580bc24b5a8a0e11131edb3b943
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142908
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'offapi')
-rw-r--r-- | offapi/UnoApi_offapi.mk | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/chart2/ChartTypeTemplate.idl | 46 | ||||
-rw-r--r-- | offapi/com/sun/star/chart2/XChartTypeTemplate.idl | 224 |
3 files changed, 272 insertions, 0 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index a64d2154bfd4..6d0b4c1b5954 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -641,6 +641,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/chart2,\ ChartDocumentWrapper \ ChartType \ ChartTypeManager \ + ChartTypeTemplate\ CoordinateSystem \ CoordinateSystemType \ DataPoint \ @@ -2030,6 +2031,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/chart2,\ XChartType \ XChartTypeContainer \ XChartTypeManager \ + XChartTypeTemplate \ XColorScheme \ XCoordinateSystem \ XCoordinateSystemContainer \ diff --git a/offapi/com/sun/star/chart2/ChartTypeTemplate.idl b/offapi/com/sun/star/chart2/ChartTypeTemplate.idl new file mode 100644 index 000000000000..e2f74c2ba532 --- /dev/null +++ b/offapi/com/sun/star/chart2/ChartTypeTemplate.idl @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef com_sun_star_chart2_ChartTypeTemplate_idl +#define com_sun_star_chart2_ChartTypeTemplate_idl + +#include <com/sun/star/chart2/XChartTypeTemplate.idl> + +module com +{ +module sun +{ +module star +{ +module chart2 +{ + +service ChartTypeTemplate +{ + interface ::com::sun::star::chart2::XChartTypeTemplate; +}; + +} ; // chart2 +} ; // com +} ; // sun +} ; // star + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/chart2/XChartTypeTemplate.idl b/offapi/com/sun/star/chart2/XChartTypeTemplate.idl new file mode 100644 index 000000000000..147343d4b685 --- /dev/null +++ b/offapi/com/sun/star/chart2/XChartTypeTemplate.idl @@ -0,0 +1,224 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef com_sun_star_chart2_XChartTypeTemplate_idl +#define com_sun_star_chart2_XChartTypeTemplate_idl + +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/beans/PropertyValue.idl> +#include <com/sun/star/lang/IllegalArgumentException.idl> +#include <com/sun/star/chart2/XDiagram.idl> +#include <com/sun/star/chart2/data/XDataSource.idl> +#include <com/sun/star/chart2/XChartType.idl> +#include <com/sun/star/chart2/XDataInterpreter.idl> + +module com +{ +module sun +{ +module star +{ +module chart2 +{ + +interface XChartTypeTemplate : ::com::sun::star::uno::XInterface +{ + /** Creates a new diagram based upon the given data . + + @param xDataSource + This data source will be interpreted in a chart-type + specific way and appropriate DataSeries will + be created which serve as input for the new diagram. + + @param aArguments + Arguments that tell the template how to slice the given + range. The properties should be defined in a separate + service. + + <p>For standard parameters that may be used, see the + service StandardDiagramCreationParameters. + </p> + + @return + The new diagram which represents this + ChartTypeTemplate. + */ + XDiagram createDiagramByDataSource( + [in] com::sun::star::chart2::data::XDataSource xDataSource, + [in] sequence< com::sun::star::beans::PropertyValue > aArguments ); + + /** @return + `TRUE` if the template does support categories + */ + boolean supportsCategories(); + + /** Analyses the given diagram and reinterprets its + DataSeries and Categories and + creates a new diagram based on these series. + + <p>Note, that if matchesTemplate() returns + `TRUE` for the given XDiagram, the latter should + not be changed.</p> + + @param xDiagram + The diagram given will be modified such that it represents + this ChartTypeTemplate. + */ + void changeDiagram( [in] XDiagram xDiagram ); + + /** Changes the given diagram <code>xDiagram</code> by using the + new data given in <code>xDataSource</code>. + + <p>Note that the data is interpreted in a way that fits this + template, but not necessarily the chart-types of the diagram. + This method should only be called if the data-format of the + diagram is compatible with the data-format of this + template.</p> + + <p>Ideally a matchesTemplate() call for the + given diagram should return `TRUE` before this method is + called.</p> + + @param xDiagram + The diagram to be changed. + + @param xDataSource + This data source will be interpreted in a chart-type + specific way and the DataSeries found in + <code>xDiagram</code> will be adapted to the new data. + Missing data series will be created and unused ones will + be deleted in <code>xDiagram</code>. + + @param aArguments + Arguments that tell the template how to slice the given + range. The properties should be defined in a separate + service. + + <p>For standard parameters that may be used, see the + service StandardDiagramCreationParameters. + </p> + */ + void changeDiagramData( + [in] XDiagram xDiagram, + [in] com::sun::star::chart2::data::XDataSource xDataSource, + [in] sequence< com::sun::star::beans::PropertyValue > aArguments ); + + /** States whether the given diagram could have been created by + the template. + + <p>The template will parse the DataSeriesTree of + the diagram to determine if the structure matches the one + which would have been created by + createDiagramByDataSource().</p> + + <p>For analysis all parts of the diagram may be used, + e.g. also properties set at the data series (like symbols)./p> + + @param xDiagram + The diagram to be analyzed. + + @param bAdaptProperties + If `TRUE` the properties of the template are set, such + that the template matches more accurately. E.g. for a + line-chart with symbols the property "Symbol" would be set + to `TRUE`. If this parameter is `FALSE` the template + itself stays unmodified. + + @return + `TRUE` if the diagram given is structurally identical to + a diagram that was created using + createDiagramByDataSource() or + changeDiagram(). If `FALSE` is returned + the template stays unmodified even if + <code>bAdaptProperties</code> is `TRUE`. + */ + boolean matchesTemplate( [in] XDiagram xDiagram, + [in] boolean bAdaptProperties ); + + /** Provides a chart type object that can be used to create new + series. + + @param aFormerlyUsedChartTypes + The list can be used to copy some aspects from old chart types during the creation of a new chart type. + The list might be empty. + */ + XChartType getChartTypeForNewSeries( [in] sequence< XChartType > aFormerlyUsedChartTypes ); + + /** + This used to have a return type of XDataInterpreter. + Then I removed the whole XChartTypeTemplate interface in + commit 58766f997d59e4684f2887fd8cdeb12d2f8a9366. + Which turned out to be a bad idea, so I restored it. + I restored it in this form because I want to restore binary compatibily with vtable + layout, but I don't want to restore the XDataInterpreter stuff, which was not + useful for external use. + */ + com::sun::star::uno::XInterface getDataInterpreter(); + + /** Applies a chart-type specific style (e.g. symbols) to all series in the + sequence aSeries. + + @param xSeries + a single data series to which a style will be applied + + @param nChartTypeGroupIndex + Denotes in which chart-type group the series lies, such this method + can apply different styles for different chart-type groups + + @param nSeriesIndex + The index of the series inside the current chart-type group. + nSeriesIndex does not uniquely identify a data series alone, but + only together with nChartTypeGroupIndex + + @param nSeriesCount + The number of series in the current chart-type group. + + @todo In the future, this should only change the "Style" property and no + hard attributes. + */ + void applyStyle( [in] XDataSeries xSeries, + [in] long nChartTypeGroupIndex, + [in] long nSeriesIndex, + [in] long nSeriesCount ); + + /** Resets all styles that were changed from the default at any + object in the chart and have not been later modified. + + <p>In createDiagramByDataSource() or + changeDiagram() a template might e.g. change + the page background color or the line style of all data + series. This method should reset all objects that still have + the changed settings to the default.</p> + + <p>If for example the template changed the + com::sun::star::drawing::LineStyle of all + series to NONE, this method should reset all series with + LineStyle NONE back to SOLID. If a series has a style DASH, + it must not be changed.</p> + */ + void resetStyles( [in] XDiagram xDiagram ); +}; + +} ; // chart2 +} ; // com +} ; // sun +} ; // star + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |