LibreOffice Module sc (master) 1
dpdimsave.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <tools/long.hxx>
23
24#include <vector>
25#include <map>
26#include <string_view>
27
28#include "dpitemdata.hxx"
29#include "dpnumgroupinfo.hxx"
30#include "scdllapi.h"
31#include "dptypes.hxx"
32
35class ScDPObject;
36class ScDPCache;
38
40
47{
48 OUString aGroupName;
49 std::vector<OUString> aElements;
50 mutable std::vector<ScDPItemData> maItems;
51
52public:
53 ScDPSaveGroupItem( OUString aName );
55
58 ScDPSaveGroupItem & operator =(ScDPSaveGroupItem const &) = default;
59 ScDPSaveGroupItem & operator =(ScDPSaveGroupItem &&) = default;
60
61 void AddToData(ScDPGroupDimension& rDataDim) const;
62
63 void AddElement( const OUString& rName );
64 void AddElementsFromGroup( const ScDPSaveGroupItem& rGroup );
65 const OUString& GetGroupName() const { return aGroupName; }
66
68 bool RemoveElement( const OUString& rName );
69
70 bool IsEmpty() const;
71 size_t GetElementCount() const;
72 const OUString* GetElementByIndex(size_t nIndex) const;
73
74 void Rename( const OUString& rNewName );
75
78 void RemoveElementsFromGroups( ScDPSaveGroupDimension& rDimension ) const;
79
80 void ConvertElementsToItems(SvNumberFormatter* pFormatter) const;
81 bool HasInGroup(const ScDPItemData& rItem) const;
82};
83
84typedef ::std::vector<ScDPSaveGroupItem> ScDPSaveGroupItemVec;
85
91{
92 OUString aSourceDim;
93 OUString aGroupDimName;
96 sal_Int32 nDatePart;
97
98public:
99 ScDPSaveGroupDimension( OUString aSource, OUString aName );
100 ScDPSaveGroupDimension( OUString aSource, OUString aName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart );
101
102 void AddToData( ScDPGroupTableData& rData ) const;
103 void AddToCache(ScDPCache& rCache) const;
104 void SetDateInfo( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart );
105
106 void AddGroupItem( const ScDPSaveGroupItem& rItem );
107 const OUString& GetGroupDimName() const { return aGroupDimName; }
108 const OUString& GetSourceDimName() const { return aSourceDim; }
109
110 sal_Int32 GetDatePart() const { return nDatePart; }
111 const ScDPNumGroupInfo& GetDateInfo() const { return aDateInfo; }
112
113 OUString CreateGroupName( std::u16string_view rPrefix );
114 const ScDPSaveGroupItem* GetNamedGroup( const OUString& rGroupName ) const;
115 ScDPSaveGroupItem* GetNamedGroupAcc( const OUString& rGroupName );
116 void RemoveFromGroups( const OUString& rItemName );
117 void RemoveGroup(const OUString& rGroupName);
118 bool IsEmpty() const;
119 bool HasOnlyHidden(const ScDPUniqueStringSet& rVisible);
120
121 tools::Long GetGroupCount() const;
122 const ScDPSaveGroupItem& GetGroupByIndex( tools::Long nIndex ) const;
123
124 void Rename( const OUString& rNewName );
125
126private:
127 bool IsInGroup(const ScDPItemData& rItem) const;
128};
129
136{
140 sal_Int32 nDatePart;
141
142public:
143 ScDPSaveNumGroupDimension( OUString aName, const ScDPNumGroupInfo& rInfo );
144 ScDPSaveNumGroupDimension( OUString aName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart );
145
146 void AddToData( ScDPGroupTableData& rData ) const;
147 void AddToCache(ScDPCache& rCache) const;
148
149 const OUString& GetDimensionName() const { return aDimensionName; }
150 const ScDPNumGroupInfo& GetInfo() const { return aGroupInfo; }
151
152 sal_Int32 GetDatePart() const { return nDatePart; }
153 const ScDPNumGroupInfo& GetDateInfo() const { return aDateInfo; }
154
155 void SetGroupInfo( const ScDPNumGroupInfo& rNew );
156 void SetDateInfo( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart );
157};
158
164{
165public:
168
169 bool operator==( const ScDPDimensionSaveData& r ) const;
170
171 void WriteToData( ScDPGroupTableData& rData ) const;
172
173 void WriteToCache(ScDPCache& rCache) const;
174
175 OUString CreateGroupDimName(
176 const OUString& rSourceName, const ScDPObject& rObject, bool bAllowSource,
177 const ::std::vector<OUString>* pDeletedNames );
178
179 OUString CreateDateGroupDimName(
180 sal_Int32 nDatePart, const ScDPObject& rObject, bool bAllowSource,
181 const ::std::vector<OUString>* pDeletedNames );
182
183 void AddGroupDimension( const ScDPSaveGroupDimension& rGroupDim );
184 void ReplaceGroupDimension( const ScDPSaveGroupDimension& rGroupDim );
185 void RemoveGroupDimension( const OUString& rGroupDimName );
186
187 void AddNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim );
188 void ReplaceNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim );
189 void RemoveNumGroupDimension( const OUString& rGroupDimName );
190
191 const ScDPSaveGroupDimension* GetGroupDimForBase( const OUString& rBaseDimName ) const;
192 const ScDPSaveGroupDimension* GetNamedGroupDim( const OUString& rGroupDimName ) const;
193 const ScDPSaveGroupDimension* GetFirstNamedGroupDim( const OUString& rBaseDimName ) const;
194 const ScDPSaveGroupDimension* GetNextNamedGroupDim( const OUString& rGroupDimName ) const;
195 const ScDPSaveNumGroupDimension* GetNumGroupDim( const OUString& rGroupDimName ) const;
196
197 ScDPSaveGroupDimension* GetGroupDimAccForBase( const OUString& rBaseDimName );
198 ScDPSaveGroupDimension* GetNamedGroupDimAcc( const OUString& rGroupDimName );
199 ScDPSaveGroupDimension* GetFirstNamedGroupDimAcc( const OUString& rBaseDimName );
200 ScDPSaveGroupDimension* GetNextNamedGroupDimAcc( const OUString& rGroupDimName );
201
202 ScDPSaveNumGroupDimension* GetNumGroupDimAcc( const OUString& rGroupDimName );
203
204 bool HasGroupDimensions() const;
205
206 sal_Int32 CollectDateParts( const OUString& rBaseDimName ) const;
207
208private:
209 typedef ::std::vector< ScDPSaveGroupDimension > ScDPSaveGroupDimVec;
210 typedef ::std::map<OUString, ScDPSaveNumGroupDimension> ScDPSaveNumGroupDimMap;
211
213
216};
217
218/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class represents the cached data part of the datapilot cache table implementation.
Definition: dpcache.hxx:48
This class has to do with handling exclusively grouped dimensions? TODO: Find out what this class doe...
Definition: dpdimsave.hxx:164
::std::vector< ScDPSaveGroupDimension > ScDPSaveGroupDimVec
Definition: dpdimsave.hxx:209
::std::map< OUString, ScDPSaveNumGroupDimension > ScDPSaveNumGroupDimMap
Definition: dpdimsave.hxx:210
ScDPDimensionSaveData & operator=(const ScDPDimensionSaveData &)=delete
ScDPSaveGroupDimVec maGroupDims
Definition: dpdimsave.hxx:214
ScDPDimensionSaveData(ScDPDimensionSaveData const &)=default
ScDPSaveNumGroupDimMap maNumGroupDims
Definition: dpdimsave.hxx:215
When assigning a string value, you can also assign an interned string whose life-cycle is managed by ...
Definition: dpitemdata.hxx:29
Represents a new group dimension whose dimension ID is higher than the highest source dimension ID.
Definition: dpdimsave.hxx:91
OUString aSourceDim
always the real source from the original data
Definition: dpdimsave.hxx:92
const OUString & GetSourceDimName() const
Definition: dpdimsave.hxx:108
const OUString & GetGroupDimName() const
Definition: dpdimsave.hxx:107
const ScDPNumGroupInfo & GetDateInfo() const
Definition: dpdimsave.hxx:111
ScDPNumGroupInfo aDateInfo
Definition: dpdimsave.hxx:95
sal_Int32 GetDatePart() const
Definition: dpdimsave.hxx:110
ScDPSaveGroupItemVec aGroups
Definition: dpdimsave.hxx:94
Classes to save Data Pilot settings that create new dimensions (fields).
Definition: dpdimsave.hxx:47
const OUString & GetGroupName() const
Definition: dpdimsave.hxx:65
OUString aGroupName
name of group
Definition: dpdimsave.hxx:48
ScDPSaveGroupItem(ScDPSaveGroupItem const &)=default
ScDPSaveGroupItem(ScDPSaveGroupItem &&)=default
std::vector< ScDPItemData > maItems
items converted from the strings.
Definition: dpdimsave.hxx:50
std::vector< OUString > aElements
names of items in original dimension
Definition: dpdimsave.hxx:49
Represents a group dimension that introduces a new hierarchy for an existing dimension.
Definition: dpdimsave.hxx:136
const OUString & GetDimensionName() const
Definition: dpdimsave.hxx:149
ScDPNumGroupInfo aGroupInfo
Definition: dpdimsave.hxx:138
sal_Int32 GetDatePart() const
Definition: dpdimsave.hxx:152
const ScDPNumGroupInfo & GetDateInfo() const
Definition: dpdimsave.hxx:153
ScDPNumGroupInfo aDateInfo
Definition: dpdimsave.hxx:139
const ScDPNumGroupInfo & GetInfo() const
Definition: dpdimsave.hxx:150
::std::vector< ScDPSaveGroupItem > ScDPSaveGroupItemVec
Definition: dpdimsave.hxx:84
std::unordered_set< OUString > ScDPUniqueStringSet
Definition: dptypes.hxx:16
long Long
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:518