LibreOffice Module chart2 (master) 1
ChartTypeTemplate.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#pragma once
20
22#include "DataInterpreter.hxx"
23#include "StackMode.hxx"
24#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
25#include <com/sun/star/lang/XServiceName.hpp>
26#include "charttoolsdllapi.hxx"
27#include <rtl/ref.hxx>
28#include <vector>
29
30namespace com::sun::star::beans { struct PropertyValue; }
31namespace com::sun::star::chart2 { class XChartType; }
32namespace com::sun::star::chart2 { class XCoordinateSystem; }
33namespace com::sun::star::chart2 { class XCoordinateSystemContainer; }
34namespace com::sun::star::chart2 { class XDataSeries; }
35namespace com::sun::star::chart2 { class XDiagram; }
36namespace com::sun::star::chart2::data { class XDataSource; }
37namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
38namespace com::sun::star::uno { class XComponentContext; }
39
40namespace chart
41{
42class BaseCoordinateSystem;
43class ChartType;
44class DataSeries;
45class Diagram;
46class LabeledDataSequence;
47
82class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeTemplate : public ::cppu::WeakImplHelper<
83 css::chart2::XChartTypeTemplate,
84 css::lang::XServiceName >
85{
86public:
87 explicit ChartTypeTemplate( css::uno::Reference< css::uno::XComponentContext > const & xContext,
88 OUString aServiceName );
89 virtual ~ChartTypeTemplate() override;
90
91 rtl::Reference< ::chart::Diagram > createDiagramByDataSource2(
92 const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
93 const css::uno::Sequence< css::beans::PropertyValue >& aArguments );
94
95 // ____ XChartTypeTemplate ____
96 virtual css::uno::Reference< css::chart2::XDiagram > SAL_CALL createDiagramByDataSource(
97 const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
98 const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override final;
100 virtual sal_Bool SAL_CALL supportsCategories() override;
101 virtual void SAL_CALL changeDiagram(
102 const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override final;
103 virtual void SAL_CALL changeDiagramData(
104 const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
105 const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
106 const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override final;
107 virtual sal_Bool SAL_CALL matchesTemplate(
108 const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
109 sal_Bool bAdaptProperties ) override final;
110 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getDataInterpreter() override final;
111 virtual css::uno::Reference< ::css::chart2::XChartType > SAL_CALL getChartTypeForNewSeries(
112 const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override final;
113 virtual void SAL_CALL applyStyle(
114 const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
115 ::sal_Int32 nChartTypeIndex,
116 ::sal_Int32 nSeriesIndex,
117 ::sal_Int32 nSeriesCount ) override final;
118 virtual void SAL_CALL resetStyles(
119 const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override final;
120
122 const rtl::Reference< ::chart::Diagram >& xDiagram );
125 const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource,
126 const css::uno::Sequence< css::beans::PropertyValue >& aArguments );
127 virtual bool matchesTemplate2(
129 bool bAdaptProperties );
131 getChartTypeForNewSeries2( const std::vector<
132 rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) = 0;
133 virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2();
134 virtual void applyStyle2(
136 ::sal_Int32 nChartTypeIndex,
137 ::sal_Int32 nSeriesIndex,
138 ::sal_Int32 nSeriesCount );
139 virtual void resetStyles2(
140 const rtl::Reference< ::chart::Diagram >& xDiagram );
141
143 void applyStyles(
144 const rtl::Reference< ::chart::Diagram >& xDiagram );
145
146 // ____ XServiceName ____
147 virtual OUString SAL_CALL getServiceName() override;
148
149 // Methods to override for automatic creation
150
152 virtual sal_Int32 getDimension() const;
153
162 virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
163
165 getChartTypeForIndex( sal_Int32 nChartTypeIndex ) = 0;
166
167 virtual bool isSwapXAndY() const;
168
169 // Methods for creating the diagram piecewise
170
176 virtual void adaptDiagram(
177 const rtl::Reference< ::chart::Diagram > & xDiagram );
178
186 virtual void createCoordinateSystems(
187 const rtl::Reference< ::chart::Diagram > & xDiagram );
188
194 virtual void adaptScales(
195 const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & aCooSysSeq,
196 const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xCategories );
197
223 virtual void createChartTypes(
224 const std::vector<
225 std::vector<
227 ::chart::DataSeries > > > & aSeriesSeq,
228 const std::vector<
230 ::chart::BaseCoordinateSystem > > & rCoordSys,
231 const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
232 );
233
242 void createAxes(
243 const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys );
244
248 virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension );
249
252 virtual void adaptAxes(
253 const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys );
254
255 const css::uno::Reference< css::uno::XComponentContext >&
257
258 static void copyPropertiesFromOldToNewCoordinateSystem(
259 const std::vector< rtl::Reference< ChartType > > & rOldChartTypesSeq,
260 const rtl::Reference< ChartType > & xNewChartType );
261
262protected:
263 css::uno::Reference< css::uno::XComponentContext > m_xContext;
265
266private:
267 const OUString m_aServiceName;
268
269private:
272 void FillDiagram( const rtl::Reference< ::chart::Diagram >& xDiagram,
273 const std::vector<
274 std::vector<
276 ::chart::DataSeries > > > & aSeriesSeq,
277 const css::uno::Reference< css::chart2::data::XLabeledDataSequence >& xCategories,
278 const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq);
279};
280
281} // namespace chart
282
283/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< uno::XComponentContext > m_xContext
#define OOO_DLLPUBLIC_CHARTTOOLS
For creating diagrams and modifying existing diagrams.
css::uno::Reference< css::uno::XComponentContext > m_xContext
void changeDiagram(const rtl::Reference< ::chart::Diagram > &xDiagram)
void changeDiagramData(const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource, const css::uno::Sequence< css::beans::PropertyValue > &aArguments)
virtual rtl::Reference< ::chart::ChartType > getChartTypeForIndex(sal_Int32 nChartTypeIndex)=0
const css::uno::Reference< css::uno::XComponentContext > & GetComponentContext() const
rtl::Reference< ::chart::DataInterpreter > m_xDataInterpreter
virtual rtl::Reference< ::chart::ChartType > getChartTypeForNewSeries2(const std::vector< rtl::Reference< ::chart::ChartType > > &aFormerlyUsedChartTypes)=0
Sequence< PropertyValue > aArguments
unsigned char sal_Bool