Calc/Implementation/Chart Filter Process

From Apache OpenOffice Wiki
< Calc‎ | Implementation
Revision as of 05:10, 28 April 2012 by Leiw (Talk | contribs)

Jump to: navigation, search


This wiki is about the ODF filter process of chart.

Classes

In ODF filter (xmloff), there are 4 major classes used to do filter works of key chart elements:

  • SchXMLChartContext for whole chart
  • SchXMLPlotAreaContext for chart area
  • SchXMLSeries2Context for data series
  • SchXMLDataPointContext for data points

SchXMLChartContext creates SchXMLPlotAreaContext after call it's StartElement method; SchXMLPlotAreaContext creates SchXMLSeries2Context, SchXMLSeries2Context creates SchXMLDataPointContext respectively after call their StartElement method.

675px-ChartFilterObjects.jpg

SchXMLChartContext has a critical member maSeriesDefaultsAndStyles which stores default values for series and styles for series and data points. This member will be passed to SchXMLPlotAreaContext, SchXMLSeries2Context and SchXMLDataPointContext one by one as reference because the values can only be filled when the corresponding context begin to work. Another critical member in SchXMLChartContext is mbAllRangeAddressesAvailable, which means whether the data sequences are all valid. For some charts, in special for stock charts, if the data source range is not correct, the chart will contain some empty data sequences. In this case, mbAllRangeAddressesAvailable will be false. Similar as maSeriesDefaultsAndStyles, it is also passed to SchXMLPlotAreaContext and lower context one by one as reference and will be filled when the corresponding context begin to work.

ChartFilterClasses.jpg

Import Process

This process is for both data series in column and data series in row. Paste will follow the same process. But this process is only for chart whose mbAllRangeAddressesAvailable of SchXMLChartContext is true, which means there are no empty data sequence.

800px-ChartImportProcess.jpg

Export Process

This process is for both data series in column and data series in row. Copy will follow the same process.

800px-ChartExportProcess.jpg

Import Process for charts which contain empty data sequences

In this case, mbAllRangeAddressesAvailable of SchXMLChartContext is false. Basically, the process is same as normal import. The only difference is at the beginning of SchXMLChartContext.EndElement, it will additionally call ApplyDataFromRectangularRangeToDiagram because mbAllRangeAddressesAvailable is false. In this method, it will reorganise the data series, which will probably make delete old series and reset to new ones.

800px-ChartComplexExportProcess.jpg

Personal tools