LibreOffice Module chart2 (master) 1
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
chart::ChartTypeTemplate Class Referenceabstract

For creating diagrams and modifying existing diagrams. More...

#include <ChartTypeTemplate.hxx>

Inheritance diagram for chart::ChartTypeTemplate:
[legend]
Collaboration diagram for chart::ChartTypeTemplate:
[legend]

Public Member Functions

 ChartTypeTemplate (css::uno::Reference< css::uno::XComponentContext > const &xContext, OUString aServiceName)
 
virtual ~ChartTypeTemplate () override
 
rtl::Reference< ::chart::DiagramcreateDiagramByDataSource2 (const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource, const css::uno::Sequence< css::beans::PropertyValue > &aArguments)
 
virtual css::uno::Reference< css::chart2::XDiagram > SAL_CALL createDiagramByDataSource (const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource, const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override final
 
virtual sal_Bool SAL_CALL supportsCategories () override
 denotes if the chart needs categories at the first scale More...
 
virtual void SAL_CALL changeDiagram (const css::uno::Reference< css::chart2::XDiagram > &xDiagram) override final
 
virtual void SAL_CALL changeDiagramData (const css::uno::Reference< css::chart2::XDiagram > &xDiagram, const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource, const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override final
 
virtual sal_Bool SAL_CALL matchesTemplate (const css::uno::Reference< css::chart2::XDiagram > &xDiagram, sal_Bool bAdaptProperties) override final
 
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getDataInterpreter () override final
 
virtual css::uno::Reference< ::css::chart2::XChartType > SAL_CALL getChartTypeForNewSeries (const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > &aFormerlyUsedChartTypes) override final
 
virtual void SAL_CALL applyStyle (const css::uno::Reference< css::chart2::XDataSeries > &xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount) override final
 
virtual void SAL_CALL resetStyles (const css::uno::Reference< css::chart2::XDiagram > &xDiagram) override final
 
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 bool matchesTemplate2 (const rtl::Reference< ::chart::Diagram > &xDiagram, bool bAdaptProperties)
 
virtual rtl::Reference< ::chart::ChartTypegetChartTypeForNewSeries2 (const std::vector< rtl::Reference< ::chart::ChartType > > &aFormerlyUsedChartTypes)=0
 
virtual rtl::Reference< ::chart::DataInterpretergetDataInterpreter2 ()
 
virtual void applyStyle2 (const rtl::Reference< ::chart::DataSeries > &xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount)
 
virtual void resetStyles2 (const rtl::Reference< ::chart::Diagram > &xDiagram)
 
void applyStyles (const rtl::Reference< ::chart::Diagram > &xDiagram)
 
virtual OUString SAL_CALL getServiceName () override
 
virtual sal_Int32 getDimension () const
 returns 2 by default. Supported are 2 and 3 More...
 
virtual StackMode getStackMode (sal_Int32 nChartTypeIndex) const
 returns StackMode::NONE by default. More...
 
virtual rtl::Reference< ::chart::ChartTypegetChartTypeForIndex (sal_Int32 nChartTypeIndex)=0
 
virtual bool isSwapXAndY () const
 
virtual void adaptDiagram (const rtl::Reference< ::chart::Diagram > &xDiagram)
 Allows derived classes to manipulate the diagrams whole, like changing the wall color. More...
 
virtual void createCoordinateSystems (const rtl::Reference< ::chart::Diagram > &xDiagram)
 Creates a 2d or 3d cartesian coordinate system with mathematically oriented, linear scales with auto-min/max. More...
 
virtual void adaptScales (const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &aCooSysSeq, const css::uno::Reference< css::chart2::data::XLabeledDataSequence > &xCategories)
 Sets categories at the scales of dimension 0 and the percent stacking at the scales of dimension 1 of all given coordinate systems. More...
 
virtual void createChartTypes (const std::vector< std::vector< rtl::Reference< ::chart::DataSeries > > > &aSeriesSeq, const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &rCoordSys, const std::vector< rtl::Reference< ChartType > > &aOldChartTypesSeq)
 create a data series tree, that fits the requirements of the chart type. More...
 
void createAxes (const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &rCoordSys)
 create axes and add them to the given container. More...
 
virtual sal_Int32 getAxisCountByDimension (sal_Int32 nDimension)
 Give the number of requested axis per dimension here. More...
 
virtual void adaptAxes (const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &rCoordSys)
 adapt properties of existing axes and remove superfluous axes More...
 
const css::uno::Reference< css::uno::XComponentContext > & GetComponentContext () const
 

Static Public Member Functions

static void copyPropertiesFromOldToNewCoordinateSystem (const std::vector< rtl::Reference< ChartType > > &rOldChartTypesSeq, const rtl::Reference< ChartType > &xNewChartType)
 

Protected Attributes

css::uno::Reference< css::uno::XComponentContext > m_xContext
 
rtl::Reference< ::chart::DataInterpreterm_xDataInterpreter
 

Private Member Functions

void FillDiagram (const rtl::Reference< ::chart::Diagram > &xDiagram, const std::vector< std::vector< rtl::Reference< ::chart::DataSeries > > > &aSeriesSeq, const css::uno::Reference< css::chart2::data::XLabeledDataSequence > &xCategories, const std::vector< rtl::Reference< ChartType > > &aOldChartTypesSeq)
 modifies the given diagram More...
 

Private Attributes

const OUString m_aServiceName
 

Detailed Description

For creating diagrams and modifying existing diagrams.

A base class that implements XChartTypeTemplate and offers some tooling for classes that derive from this class.

createDiagramByDataSource

This does the following steps using some virtual helper-methods, that may be overridden by derived classes:

creates an XDiagram via service-factory.

convert the given XDataSource to a sequence of XDataSeries using the method createDataSeries(). In this class the DataInterpreter helper class is used to create a standard interpretation (just y-values).

call applyDefaultStyle() for all XDataSeries in order to apply default styles. In this class the series get the system-wide default colors as "Color" property.

call applyStyle() for applying chart-type specific styles to all series. The default implementation is empty.

call createCoordinateSystems() and apply them to the diagram. As default one cartesian system with Scales using a linear Scaling is created.

createChartTypes() is called in order to define the structure of the diagram. For details see comment of this function. As default this method creates a tree where all series appear in one branch with the chart type determined by getChartTypeForNewSeries(). The stacking is determined via the method getStackMode().

create an XLegend via the global service factory, set it at the diagram.

Definition at line 82 of file ChartTypeTemplate.hxx.

Constructor & Destructor Documentation

◆ ChartTypeTemplate()

chart::ChartTypeTemplate::ChartTypeTemplate ( css::uno::Reference< css::uno::XComponentContext > const &  xContext,
OUString  aServiceName 
)
explicit

Definition at line 131 of file ChartTypeTemplate.cxx.

◆ ~ChartTypeTemplate()

chart::ChartTypeTemplate::~ChartTypeTemplate ( )
overridevirtual

Definition at line 139 of file ChartTypeTemplate.cxx.

Member Function Documentation

◆ adaptAxes()

void chart::ChartTypeTemplate::adaptAxes ( const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &  rCoordSys)
virtual

adapt properties of existing axes and remove superfluous axes

Reimplemented in chart::PieChartTypeTemplate.

Definition at line 659 of file ChartTypeTemplate.cxx.

References CHART_UNONAME_LINK_TO_SRC_NUMFMT, CHART_UNONAME_NUMFMT, chart::AxisHelper::getAxis(), getStackMode(), chart::MAIN_AXIS_INDEX, nDimCount, chart::SECONDARY_AXIS_INDEX, and chart::YStackedPercent.

Referenced by FillDiagram().

◆ adaptDiagram()

void chart::ChartTypeTemplate::adaptDiagram ( const rtl::Reference< ::chart::Diagram > &  xDiagram)
virtual

Allows derived classes to manipulate the diagrams whole, like changing the wall color.

The default implementation is empty. It is called by FillDiagram which is called by createDiagramByDataSource and changeDiagram

Reimplemented in chart::PieChartTypeTemplate.

Definition at line 622 of file ChartTypeTemplate.cxx.

Referenced by FillDiagram().

◆ adaptScales()

void chart::ChartTypeTemplate::adaptScales ( const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &  aCooSysSeq,
const css::uno::Reference< css::chart2::data::XLabeledDataSequence > &  xCategories 
)
virtual

Sets categories at the scales of dimension 0 and the percent stacking at the scales of dimension 1 of all given coordinate systems.

Called by FillDiagram.

Reimplemented in chart::PieChartTypeTemplate.

Definition at line 546 of file ChartTypeTemplate.cxx.

References aData, DBG_UNHANDLED_EXCEPTION, getChartTypeForNewSeries2(), getStackMode(), chart::ChartTypeHelper::isSupportingDateAxis(), m_aServiceName, chart::AxisHelper::removeExplicitScaling(), supportsCategories(), and chart::YStackedPercent.

Referenced by chart::PieChartTypeTemplate::adaptScales(), and FillDiagram().

◆ applyStyle()

void chart::ChartTypeTemplate::applyStyle ( const css::uno::Reference< css::chart2::XDataSeries > &  xSeries,
::sal_Int32  nChartTypeIndex,
::sal_Int32  nSeriesIndex,
::sal_Int32  nSeriesCount 
)
finaloverridevirtual

Definition at line 851 of file ChartTypeTemplate.cxx.

References applyStyle2().

◆ applyStyle2()

void chart::ChartTypeTemplate::applyStyle2 ( const rtl::Reference< ::chart::DataSeries > &  xSeries,
::sal_Int32  nChartTypeIndex,
::sal_Int32  nSeriesIndex,
::sal_Int32  nSeriesCount 
)
virtual

◆ applyStyles()

void chart::ChartTypeTemplate::applyStyles ( const rtl::Reference< ::chart::Diagram > &  xDiagram)
Exceptions
css::uno::RuntimeException

Definition at line 397 of file ChartTypeTemplate.cxx.

References applyStyle2(), getChartTypeForIndex(), and i.

Referenced by FillDiagram().

◆ changeDiagram() [1/2]

void chart::ChartTypeTemplate::changeDiagram ( const css::uno::Reference< css::chart2::XDiagram > &  xDiagram)
finaloverridevirtual

Definition at line 824 of file ChartTypeTemplate.cxx.

References changeDiagram().

Referenced by changeDiagram().

◆ changeDiagram() [2/2]

void chart::ChartTypeTemplate::changeDiagram ( const rtl::Reference< ::chart::Diagram > &  xDiagram)

◆ changeDiagramData() [1/2]

void chart::ChartTypeTemplate::changeDiagramData ( const css::uno::Reference< css::chart2::XDiagram > &  xDiagram,
const css::uno::Reference< css::chart2::data::XDataSource > &  xDataSource,
const css::uno::Sequence< css::beans::PropertyValue > &  aArguments 
)
finaloverridevirtual

Definition at line 829 of file ChartTypeTemplate.cxx.

References aArguments, and changeDiagramData().

Referenced by changeDiagramData().

◆ changeDiagramData() [2/2]

void chart::ChartTypeTemplate::changeDiagramData ( const rtl::Reference< ::chart::Diagram > &  xDiagram,
const css::uno::Reference< css::chart2::data::XDataSource > &  xDataSource,
const css::uno::Sequence< css::beans::PropertyValue > &  aArguments 
)

◆ copyPropertiesFromOldToNewCoordinateSystem()

void chart::ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem ( const std::vector< rtl::Reference< ChartType > > &  rOldChartTypesSeq,
const rtl::Reference< ChartType > &  xNewChartType 
)
static

◆ createAxes()

void chart::ChartTypeTemplate::createAxes ( const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &  rCoordSys)

create axes and add them to the given container.

If there are already compatible axes in the container these should be maintained.

As default, this method creates as many axes as there are dimensions in the given first coordinate system. Each of the axis represents one of the dimensions of the coordinate systems. If there are series requesting a secondary axes a secondary y axes is added

Definition at line 626 of file ChartTypeTemplate.cxx.

References chart::AxisHelper::createAxis(), chart::AxisHelper::getAxis(), getAxisCountByDimension(), GetComponentContext(), chart::AxisHelper::isSecondaryYAxisNeeded(), and nDimCount.

Referenced by FillDiagram(), and chart::PieChartTypeTemplate::resetStyles2().

◆ createChartTypes()

void chart::ChartTypeTemplate::createChartTypes ( const std::vector< std::vector< rtl::Reference< ::chart::DataSeries > > > &  aSeriesSeq,
const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > &  rCoordSys,
const std::vector< rtl::Reference< ChartType > > &  aOldChartTypesSeq 
)
virtual

create a data series tree, that fits the requirements of the chart type.

As default, this creates a tree with the following structure:

  root
   |
   +-- chart type (determined by getChartTypeForNewSeries())
           |
           +-- category (DiscreteStackableScaleGroup using scale 0)
                  |
                  +-- values (ContinuousStackableScaleGroup using scale 1)
                        |
                        +-- series 0
                        |
                        +-- series 1
                        |
                        ...
                        |
                        +.. series n-1

If there are less than two scales available the returned tree is empty.

Reimplemented in chart::ColumnLineChartTypeTemplate, chart::PieChartTypeTemplate, and chart::StockChartTypeTemplate.

Definition at line 729 of file ChartTypeTemplate.cxx.

References begin, DBG_UNHANDLED_EXCEPTION, end, getChartTypeForNewSeries2(), and size.

Referenced by FillDiagram().

◆ createCoordinateSystems()

void chart::ChartTypeTemplate::createCoordinateSystems ( const rtl::Reference< ::chart::Diagram > &  xDiagram)
virtual

Creates a 2d or 3d cartesian coordinate system with mathematically oriented, linear scales with auto-min/max.

If the given CoordinateSystemContainer is not empty, those coordinate system should be reused.

The dimension depends on the value returned by getDimension().

Reimplemented in chart::BarChartTypeTemplate.

Definition at line 481 of file ChartTypeTemplate.cxx.

References getChartTypeForNewSeries2(), getDimension(), i, and chart::AxisHelper::makeGridVisible().

Referenced by chart::BarChartTypeTemplate::createCoordinateSystems(), and FillDiagram().

◆ createDiagramByDataSource()

css::uno::Reference< css::chart2::XDiagram > chart::ChartTypeTemplate::createDiagramByDataSource ( const css::uno::Reference< css::chart2::data::XDataSource > &  xDataSource,
const css::uno::Sequence< css::beans::PropertyValue > &  aArguments 
)
finaloverridevirtual

Definition at line 818 of file ChartTypeTemplate.cxx.

References aArguments, and createDiagramByDataSource2().

◆ createDiagramByDataSource2()

rtl::Reference< Diagram > chart::ChartTypeTemplate::createDiagramByDataSource2 ( const css::uno::Reference< css::chart2::data::XDataSource > &  xDataSource,
const css::uno::Sequence< css::beans::PropertyValue > &  aArguments 
)

◆ FillDiagram()

void chart::ChartTypeTemplate::FillDiagram ( const rtl::Reference< ::chart::Diagram > &  xDiagram,
const std::vector< std::vector< rtl::Reference< ::chart::DataSeries > > > &  aSeriesSeq,
const css::uno::Reference< css::chart2::data::XLabeledDataSequence > &  xCategories,
const std::vector< rtl::Reference< ChartType > > &  aOldChartTypesSeq 
)
private

◆ getAxisCountByDimension()

sal_Int32 chart::ChartTypeTemplate::getAxisCountByDimension ( sal_Int32  nDimension)
virtual

Give the number of requested axis per dimension here.

Default is one axis for each dimension

Reimplemented in chart::PieChartTypeTemplate, and chart::StockChartTypeTemplate.

Definition at line 697 of file ChartTypeTemplate.cxx.

References getDimension().

Referenced by createAxes().

◆ getChartTypeForIndex()

virtual rtl::Reference< ::chart::ChartType > chart::ChartTypeTemplate::getChartTypeForIndex ( sal_Int32  nChartTypeIndex)
pure virtual

◆ getChartTypeForNewSeries()

css::uno::Reference<::css::chart2::XChartType > chart::ChartTypeTemplate::getChartTypeForNewSeries ( const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > &  aFormerlyUsedChartTypes)
finaloverridevirtual

Definition at line 842 of file ChartTypeTemplate.cxx.

References getChartTypeForNewSeries2().

◆ getChartTypeForNewSeries2()

virtual rtl::Reference< ::chart::ChartType > chart::ChartTypeTemplate::getChartTypeForNewSeries2 ( const std::vector< rtl::Reference< ::chart::ChartType > > &  aFormerlyUsedChartTypes)
pure virtual

◆ GetComponentContext()

const css::uno::Reference< css::uno::XComponentContext > & chart::ChartTypeTemplate::GetComponentContext ( ) const
inline

Definition at line 256 of file ChartTypeTemplate.hxx.

References m_xContext.

Referenced by createAxes(), and createDiagramByDataSource2().

◆ getDataInterpreter()

css::uno::Reference< css::uno::XInterface > chart::ChartTypeTemplate::getDataInterpreter ( )
finaloverridevirtual

Definition at line 814 of file ChartTypeTemplate.cxx.

References getDataInterpreter2().

◆ getDataInterpreter2()

rtl::Reference< DataInterpreter > chart::ChartTypeTemplate::getDataInterpreter2 ( )
virtual

◆ getDimension()

sal_Int32 chart::ChartTypeTemplate::getDimension ( ) const
virtual

◆ getServiceName()

OUString SAL_CALL chart::ChartTypeTemplate::getServiceName ( )
overridevirtual

Definition at line 461 of file ChartTypeTemplate.cxx.

References m_aServiceName.

◆ getStackMode()

StackMode chart::ChartTypeTemplate::getStackMode ( sal_Int32  nChartTypeIndex) const
virtual

returns StackMode::NONE by default.

This is a global flag used for all series of a specific chart type. If percent stacking is supported, the percent stacking mode is retrieved from the first chart type (index 0)

Parameters
nChartTypeIndexdenotes the index of the charttype in means defined by the template creation order, i.e., 0 means the first chart type that a template creates.

Reimplemented in chart::AreaChartTypeTemplate, chart::BarChartTypeTemplate, chart::BubbleChartTypeTemplate, chart::ColumnLineChartTypeTemplate, chart::LineChartTypeTemplate, chart::NetChartTypeTemplate, and chart::ScatterChartTypeTemplate.

Definition at line 471 of file ChartTypeTemplate.cxx.

References chart::NONE.

Referenced by adaptAxes(), adaptScales(), applyStyle2(), chart::PieChartTypeTemplate::createChartTypes(), matchesTemplate2(), and resetStyles2().

◆ isSwapXAndY()

bool chart::ChartTypeTemplate::isSwapXAndY ( ) const
virtual

Reimplemented in chart::BarChartTypeTemplate.

Definition at line 476 of file ChartTypeTemplate.cxx.

Referenced by applyStyle2(), and resetStyles2().

◆ matchesTemplate()

sal_Bool chart::ChartTypeTemplate::matchesTemplate ( const css::uno::Reference< css::chart2::XDiagram > &  xDiagram,
sal_Bool  bAdaptProperties 
)
finaloverridevirtual

Definition at line 836 of file ChartTypeTemplate.cxx.

References matchesTemplate2().

◆ matchesTemplate2()

bool chart::ChartTypeTemplate::matchesTemplate2 ( const rtl::Reference< ::chart::Diagram > &  xDiagram,
bool  bAdaptProperties 
)
virtual

◆ resetStyles()

void chart::ChartTypeTemplate::resetStyles ( const css::uno::Reference< css::chart2::XDiagram > &  xDiagram)
finaloverridevirtual

Definition at line 859 of file ChartTypeTemplate.cxx.

References resetStyles2().

◆ resetStyles2()

void chart::ChartTypeTemplate::resetStyles2 ( const rtl::Reference< ::chart::Diagram > &  xDiagram)
virtual

◆ supportsCategories()

sal_Bool SAL_CALL chart::ChartTypeTemplate::supportsCategories ( )
overridevirtual

denotes if the chart needs categories at the first scale

Reimplemented in chart::BubbleChartTypeTemplate, and chart::ScatterChartTypeTemplate.

Definition at line 176 of file ChartTypeTemplate.cxx.

Referenced by adaptScales().

Member Data Documentation

◆ m_aServiceName

const OUString chart::ChartTypeTemplate::m_aServiceName
private

Definition at line 267 of file ChartTypeTemplate.hxx.

Referenced by adaptScales(), and getServiceName().

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > chart::ChartTypeTemplate::m_xContext
protected

Definition at line 263 of file ChartTypeTemplate.hxx.

◆ m_xDataInterpreter

rtl::Reference< ::chart::DataInterpreter > chart::ChartTypeTemplate::m_xDataInterpreter
mutableprotected

The documentation for this class was generated from the following files: