sc/inc/dpobject.hxx | 8 ++++++++ sc/inc/pivot/PivotTableResultTraverser.hxx | 5 +++++ sc/source/filter/excel/xepivotxml.cxx | 9 +++++++-- 3 files changed, 20 insertions(+), 2 deletions(-)
New commits: commit e4d75b2efa351eb17651bc895291374ae2565681 Author: Tomaž Vajngerl <[email protected]> AuthorDate: Fri Dec 5 18:19:07 2025 +0900 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Dec 8 10:59:30 2025 +0100 sc: document classes for pivot table styles and row/column items Change-Id: I1c4c9e9c263e302a64b5d772e96128bb7baf68ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195067 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index ac563a513a71..fd987fa9d3b8 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -83,15 +83,23 @@ struct ScDPServiceDesc namespace sc { +/** Stores the style information for a pivot table */ struct PivotTableStyleInfo { + // Style name, which is used to determine how the pivot table is styles OUString maName; + + // Shold headers be styled bool mbShowRowHeaders = false; bool mbShowColHeaders = false; + + // Should use stripes / bands bool mbShowRowStripes = false; bool mbShowColStripes = false; + bool mbShowLastColumn = false; + // If no name is set, the style is not used bool isSet() const { return !maName.isEmpty(); diff --git a/sc/inc/pivot/PivotTableResultTraverser.hxx b/sc/inc/pivot/PivotTableResultTraverser.hxx index 3ecd7c0c8c4a..b045d01f6bf8 100644 --- a/sc/inc/pivot/PivotTableResultTraverser.hxx +++ b/sc/inc/pivot/PivotTableResultTraverser.hxx @@ -24,6 +24,10 @@ SC_DLLPUBLIC css::uno::Any getMemberForLevel(css::uno::Reference<css::uno::XInterface> const& xLevel, OUString const& rName); } +/** Visitor interface for traversing the pivot table result tree structure. + * + * Defines the functions that are triggered with data, when the tree is traversed. + **/ class SC_DLLPUBLIC PivotTableResultVisitor { public: @@ -53,6 +57,7 @@ public: = 0; }; +/// Traverses the pivot table result tree and triggers visitiors functions with data class SC_DLLPUBLIC PivotTableResultTraverser { private: diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 5b2596289de0..c2d7a064538e 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -720,6 +720,7 @@ sal_Int32 GetSubtotalAttrToken(ScGeneralFunction eFunc) return XML_defaultSubtotal; } +/** Data for one row/column item entry that will be written to OOXML file */ struct RowOrColumnItemsData { bool mbSet = false; @@ -727,13 +728,16 @@ struct RowOrColumnItemsData bool mbSubtotal = false; bool mbGrandTotal = false; OUString msName; - OUString maLevelName; }; +/** Contains all the data necessary for writing the row/column items as required by OOXML */ struct RowOrColumnMemberResultData { + // Order of fields as written to the file std::vector<OUString> maFieldOrder; + // Collected data from PT results std::vector<std::unordered_map<OUString, RowOrColumnItemsData>> maItemsData; + // Lookup that translates from item name (string value) to an index of the fields values std::unordered_map<OUString, std::unordered_map<OUString, sal_Int32>> maLookUpIndexForMemberName; void ensureItemData(sal_Int32 nSize) @@ -768,6 +772,7 @@ struct RowOrColumnMemberResultData } }; +/** Implementation of a results visitor, to gather information used fro rowItems and columnItems*/ class RowColumnItemsDataVisitor : public sc::PivotTableResultVisitor { RowOrColumnMemberResultData& mrRowMemberResultData; @@ -827,7 +832,6 @@ public: assert(!rItemsData.mbSet); rItemsData.mbSet = true; - rItemsData.maLevelName = maLevelName; bool bHasContinueFlag = rResult.Flags & sheet::MemberResultFlags::CONTINUE; bool bIsGrandTotal = rResult.Flags & sheet::MemberResultFlags::GRANDTOTAL; @@ -853,6 +857,7 @@ public: } }; +/** Combines all the data in RowOrColumnMemberResultData and writes the row/column items */ void writeRowColumnItems(sal_Int32 nItemElement, RowOrColumnMemberResultData& rMemberResultData, sax_fastparser::FSHelperPtr& pStream) { if (rMemberResultData.maItemsData.empty() || rMemberResultData.maFieldOrder.empty())
