diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sc/source/filter/inc/xepivotxml.hxx | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/source/filter/inc/xepivotxml.hxx')
-rw-r--r-- | sc/source/filter/inc/xepivotxml.hxx | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/sc/source/filter/inc/xepivotxml.hxx b/sc/source/filter/inc/xepivotxml.hxx new file mode 100644 index 000000000..30fb25a30 --- /dev/null +++ b/sc/source/filter/inc/xepivotxml.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "xerecord.hxx" +#include "xeroot.hxx" + +#include <memory> +#include <map> +#include <unordered_map> + +class ScDPCache; +class ScDPObject; + +class XclExpXmlPivotCaches : public XclExpRecordBase, protected XclExpRoot +{ +public: + struct Entry + { + const ScDPCache* mpCache; + ScRange maSrcRange; + }; + + XclExpXmlPivotCaches(const XclExpRoot& rRoot); + virtual void SaveXml(XclExpXmlStream& rStrm) override; + + void SetCaches(std::vector<Entry>&& rCaches); + bool HasCaches() const; + const Entry* GetCache(sal_Int32 nCacheId) const; + +private: + void SavePivotCacheXml(XclExpXmlStream& rStrm, const Entry& rEntry, sal_Int32 nCacheId); + +private: + std::vector<Entry> maCaches; +}; + +class XclExpXmlPivotTables : public XclExpRecordBase, protected XclExpRoot +{ + struct Entry + { + const ScDPObject* mpTable; + sal_Int32 mnCacheId; + sal_Int32 mnPivotId; /// used as [n] in pivotTable[n].xml part name. + + Entry(const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId); + }; + + const XclExpXmlPivotCaches& mrCaches; + typedef std::vector<Entry> TablesType; + TablesType maTables; + +public: + XclExpXmlPivotTables(const XclExpRoot& rRoot, const XclExpXmlPivotCaches& rCaches); + + virtual void SaveXml(XclExpXmlStream& rStrm) override; + + void AppendTable(const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId); + +private: + void SavePivotTableXml(XclExpXmlStream& rStrm, const ScDPObject& rObj, sal_Int32 nCacheId); +}; + +class XclExpXmlPivotTableManager : protected XclExpRoot +{ + typedef std::map<SCTAB, std::unique_ptr<XclExpXmlPivotTables>> TablesType; + typedef std::unordered_map<const ScDPObject*, sal_Int32> CacheIdMapType; + +public: + XclExpXmlPivotTableManager(const XclExpRoot& rRoot); + + void Initialize(); + + XclExpXmlPivotCaches& GetCaches(); + XclExpXmlPivotTables* GetTablesBySheet(SCTAB nTab); + +private: + XclExpXmlPivotCaches maCaches; + TablesType m_Tables; + CacheIdMapType maCacheIdMap; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |