Re: OOo Pivoting Code Extraction
Niklas Nebel <[email protected]>
| Newsgroups | gmane.comp.openoffice.devel.general |
|---|---|
| Message-ID | <[email protected]> |
On 28.02.2011 23:23, Nuno Oliveira wrote: > As I'm taking this project again, I bumped into some questions that you > may answer me immediately, I'm sure! > > Well I'm trying to discover which and where is the function that > performs the pivoting calculation. > By the hints you gave me before I'm searching for this function on > dptabres.cxx, and there I found a Calculate function, but it makes me > believe that it is not the function I'm searching for... > Also I am searching for the input for this calculation, and that > function takes some arguments that I can't assume as a structure holding > all the data to perform such computation. > > Can you give me some more hints about the form that the input takes for > the calculation? > And which is the main function where the pivoting calculation starts? It's all distributed across several classes. ScDPSource::CreateRes_Impl creates ScDPResultMember objects pColResRoot and pRowResRoot which (in their children) contain the results. The CalcResults call then creates a cache of the source data and iterates through the rows (in ScDPTableData::CalcResultsFromCacheTable and ProcessRowData). For each source data row, ScDPResultMember::ProcessData is called which updates the results. In the results, ScDPResultMember has the information about a whole column or row. pChildDimension (ScDPResultDimension) is an array of ScDPResultMember objects for the next nested field. pDataRoot (ScDPDataMember) holds the column/row result, and in the case of pRowRoot it also has a similar structure of child member arrays (pChildDimension) for the results within that row. The data for an individual result value is updated with each source entry in ScDPAggData::Update, and the result is calculated from that in ScDPAggData::Calculate. Does that help a bit? Niklas --