Difference between revisions of "Calc/Implementation/Chart Filter Process"
Revision as of 05:09, 28 April 2012
This wiki is about the ODF filter process of chart.
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.
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.
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.
This process is for both data series in column and data series in row. Copy will follow the same process.
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.