tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / datatransformation.hxx
blobaa822340fa80b35b63eb57c6e9018c91a8e99205
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #pragma once
12 #include <types.hxx>
13 #include <scdllapi.h>
15 #include <sortparam.hxx>
17 #include <set>
19 class ScDocument;
21 namespace sc {
23 enum class TransformationType
25 MERGE_TRANSFORMATION,
26 SPLIT_TRANSFORMATION,
27 DELETE_TRANSFORMATION,
28 SORT_TRANSFORMATION,
29 TEXT_TRANSFORMATION,
30 AGGREGATE_FUNCTION,
31 NUMBER_TRANSFORMATION,
32 REMOVE_NULL_TRANSFORMATION,
33 DATETIME_TRANSFORMATION,
34 FINDREPLACE_TRANSFORMATION,
35 DELETEROW_TRANSFORMATION,
36 SWAPROWS_TRANSFORMATION
39 enum class TEXT_TRANSFORM_TYPE { TO_LOWER, TO_UPPER, CAPITALIZE, TRIM };
41 enum class AGGREGATE_FUNCTION { SUM, AVERAGE, MIN, MAX };
43 enum class NUMBER_TRANSFORM_TYPE { ROUND, ROUND_UP, ROUND_DOWN, ABSOLUTE, LOG_E, LOG_10, CUBE,
44 SQUARE, SQUARE_ROOT, EXPONENT, IS_EVEN, IS_ODD, SIGN };
46 enum class DATETIME_TRANSFORMATION_TYPE { DATE_STRING, YEAR, START_OF_YEAR, END_OF_YEAR, MONTH,
47 MONTH_NAME, START_OF_MONTH, END_OF_MONTH, DAY, DAY_OF_WEEK, DAY_OF_YEAR, QUARTER, START_OF_QUARTER,
48 END_OF_QUARTER, TIME, HOUR, MINUTE, SECOND };
50 class SC_DLLPUBLIC DataTransformation
52 protected:
54 static SCROW getLastRow(const ScDocument& rDoc, SCCOL nCol);
56 public:
57 virtual ~DataTransformation();
59 virtual void Transform(ScDocument& rDoc) const = 0;
61 virtual TransformationType getTransformationType() const = 0;
65 class SC_DLLPUBLIC ColumnRemoveTransformation : public DataTransformation
67 std::set<SCCOL> maColumns;
69 public:
71 ColumnRemoveTransformation(std::set<SCCOL>&& rColumns);
72 virtual ~ColumnRemoveTransformation() override;
73 virtual void Transform(ScDocument& rDoc) const override;
74 virtual TransformationType getTransformationType() const override;
75 const std::set<SCCOL> & getColumns() const;
78 class SC_DLLPUBLIC SplitColumnTransformation : public DataTransformation
80 SCCOL mnCol;
81 sal_Unicode mcSeparator;
83 public:
85 SplitColumnTransformation(SCCOL nCol, sal_Unicode cSeparator);
86 virtual void Transform(ScDocument& rDoc) const override;
87 virtual TransformationType getTransformationType() const override;
88 SCCOL getColumn() const;
89 sal_Unicode getSeparator() const;
92 class SC_DLLPUBLIC MergeColumnTransformation : public DataTransformation
94 std::set<SCCOL> maColumns;
95 OUString maMergeString;
97 public:
99 MergeColumnTransformation(std::set<SCCOL>&& rColumns, OUString aMergeString);
100 virtual void Transform(ScDocument& rDoc) const override;
101 virtual TransformationType getTransformationType() const override;
102 const OUString & getMergeString() const;
103 const std::set<SCCOL> & getColumns() const;
106 class SortTransformation : public DataTransformation
108 ScSortParam maSortParam;
109 public:
111 SortTransformation(const ScSortParam& rParam);
112 virtual void Transform(ScDocument& rDoc) const override;
113 virtual TransformationType getTransformationType() const override;
114 const ScSortParam & getSortParam() const;
117 class SC_DLLPUBLIC TextTransformation : public DataTransformation
119 std::set<SCCOL> mnCol;
120 TEXT_TRANSFORM_TYPE maType;
122 public:
123 TextTransformation(std::set<SCCOL>&& nCol, const TEXT_TRANSFORM_TYPE rType);
124 virtual void Transform(ScDocument& rDoc) const override;
125 virtual TransformationType getTransformationType() const override;
126 TEXT_TRANSFORM_TYPE getTextTransformationType() const;
127 const std::set<SCCOL>& getColumns() const;
130 class SC_DLLPUBLIC AggregateFunction : public DataTransformation
132 std::set<SCCOL> maColumns;
133 AGGREGATE_FUNCTION maType;
135 public:
136 AggregateFunction(std::set<SCCOL>&& rColumns, const AGGREGATE_FUNCTION rType);
137 virtual void Transform(ScDocument& rDoc) const override;
138 virtual TransformationType getTransformationType() const override;
139 AGGREGATE_FUNCTION getAggregateType() const;
140 const std::set<SCCOL>& getColumns() const;
143 class SC_DLLPUBLIC NumberTransformation : public DataTransformation
145 std::set<SCCOL> mnCol;
146 NUMBER_TRANSFORM_TYPE maType;
147 int maPrecision;
149 public:
150 NumberTransformation(std::set<SCCOL>&& nCol, const NUMBER_TRANSFORM_TYPE rType);
151 NumberTransformation(std::set<SCCOL>&& nCol, const NUMBER_TRANSFORM_TYPE rType,
152 int nPrecision);
153 virtual void Transform(ScDocument& rDoc) const override;
154 virtual TransformationType getTransformationType() const override;
155 NUMBER_TRANSFORM_TYPE getNumberTransformationType() const;
156 int getPrecision() const;
157 const std::set<SCCOL>& getColumn() const;
160 class SC_DLLPUBLIC ReplaceNullTransformation : public DataTransformation
162 std::set<SCCOL> mnCol;
163 OUString msReplaceWith;
165 public:
166 ReplaceNullTransformation(std::set<SCCOL>&& nCol, OUString sReplaceWith);
167 virtual void Transform(ScDocument& rDoc) const override;
168 virtual TransformationType getTransformationType() const override;
169 const std::set<SCCOL>& getColumn() const;
170 const OUString& getReplaceString() const;
173 class SC_DLLPUBLIC DateTimeTransformation : public DataTransformation
175 std::set<SCCOL> mnCol;
176 DATETIME_TRANSFORMATION_TYPE maType;
178 public:
179 DateTimeTransformation(std::set<SCCOL>&& nCol,
180 const DATETIME_TRANSFORMATION_TYPE rType);
181 virtual void Transform(ScDocument& rDoc) const override;
182 virtual TransformationType getTransformationType() const override;
183 DATETIME_TRANSFORMATION_TYPE getDateTimeTransformationType() const;
184 const std::set<SCCOL>& getColumn() const;
187 class FindReplaceTransformation : public DataTransformation
189 SCCOL mnCol;
190 OUString maFindString;
191 OUString maReplaceString;
193 public:
194 FindReplaceTransformation(SCCOL nCol, OUString aFindString, OUString aReplaceString);
195 virtual void Transform(ScDocument& rDoc) const override;
196 virtual TransformationType getTransformationType() const override;
197 SCCOL getColumn() const;
198 const OUString & getFindString() const;
199 const OUString & getReplaceString() const;
202 class DeleteRowTransformation : public DataTransformation
204 SCCOL mnCol;
205 OUString maFindString;
207 public:
208 DeleteRowTransformation(SCCOL nCol, OUString aFindString);
209 virtual void Transform(ScDocument& rDoc) const override;
210 virtual TransformationType getTransformationType() const override;
211 SCCOL getColumn() const;
212 const OUString & getFindString() const;
215 class SwapRowsTransformation : public DataTransformation
217 SCROW mxRow, nxRow;
219 public:
220 SwapRowsTransformation(SCROW mRow, SCROW nRow);
221 virtual void Transform(ScDocument& rDoc) const override;
222 virtual TransformationType getTransformationType() const override;
223 SCROW getFirstRow() const;
224 SCROW getSecondRow() const;
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */