Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / ui / inc / datatransformation.hxx
blob9fa167d50289a6f43c0aa757a2f5182f8d45c030
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 #ifndef INCLUDED_SC_SOURCE_UI_DATAPROVIDER_DATATRANSFORMATION_HXX
11 #define INCLUDED_SC_SOURCE_UI_DATAPROVIDER_DATATRANSFORMATION_HXX
13 #include <types.hxx>
14 #include <scdllapi.h>
16 #include <sortparam.hxx>
18 #include <set>
20 class ScDocument;
22 namespace sc {
24 enum class TransformationType
26 MERGE_TRANSFORMATION,
27 SPLIT_TRANSFORMATION,
28 DELETE_TRANSFORMATION,
29 SORT_TRANSFORMATION,
30 TEXT_TRANSFORMATION,
31 AGGREGATE_FUNCTION,
32 NUMBER_TRANSFORMATION,
33 REMOVE_NULL_TRANSFORMATION,
34 DATETIME_TRANSFORMATION
37 enum class TEXT_TRANSFORM_TYPE { TO_LOWER, TO_UPPER, CAPITALIZE, TRIM };
39 enum class AGGREGATE_FUNCTION { SUM, AVERAGE, MIN, MAX };
41 enum class NUMBER_TRANSFORM_TYPE { ROUND, ROUND_UP, ROUND_DOWN, ABSOLUTE, LOG_E, LOG_10, CUBE,
42 SQUARE, SQUARE_ROOT, EXPONENT, IS_EVEN, IS_ODD, SIGN };
44 enum class DATETIME_TRANSFORMATION_TYPE { DATE_STRING, YEAR, START_OF_YEAR, END_OF_YEAR, MONTH,
45 MONTH_NAME, START_OF_MONTH, END_OF_MONTH, DAY, DAY_OF_WEEK, DAY_OF_YEAR, QUARTER, START_OF_QUARTER,
46 END_OF_QUARTER, TIME, HOUR, MINUTE, SECOND };
48 class SC_DLLPUBLIC DataTransformation
50 protected:
52 static SCROW getLastRow(const ScDocument& rDoc, SCCOL nCol);
54 public:
55 virtual ~DataTransformation();
57 virtual void Transform(ScDocument& rDoc) const = 0;
59 virtual TransformationType getTransformationType() const = 0;
63 class SC_DLLPUBLIC ColumnRemoveTransformation : public DataTransformation
65 std::set<SCCOL> const maColumns;
67 public:
69 ColumnRemoveTransformation(const std::set<SCCOL>& rColumns);
70 virtual ~ColumnRemoveTransformation() override;
71 virtual void Transform(ScDocument& rDoc) const override;
72 virtual TransformationType getTransformationType() const override;
73 const std::set<SCCOL> & getColumns() const;
76 class SC_DLLPUBLIC SplitColumnTransformation : public DataTransformation
78 SCCOL const mnCol;
79 sal_Unicode const mcSeparator;
81 public:
83 SplitColumnTransformation(SCCOL nCol, sal_Unicode cSeparator);
84 virtual void Transform(ScDocument& rDoc) const override;
85 virtual TransformationType getTransformationType() const override;
86 SCCOL getColumn() const;
87 sal_Unicode getSeparator() const;
90 class SC_DLLPUBLIC MergeColumnTransformation : public DataTransformation
92 std::set<SCCOL> const maColumns;
93 OUString maMergeString;
95 public:
97 MergeColumnTransformation(const std::set<SCCOL>& rColumns, const OUString& rMergeString);
98 virtual void Transform(ScDocument& rDoc) const override;
99 virtual TransformationType getTransformationType() const override;
100 const OUString & getMergeString() const;
101 const std::set<SCCOL> & getColumns() const;
104 class SC_DLLPUBLIC SortTransformation : public DataTransformation
106 ScSortParam const maSortParam;
107 public:
109 SortTransformation(const ScSortParam& rParam);
110 virtual void Transform(ScDocument& rDoc) const override;
111 virtual TransformationType getTransformationType() const override;
112 const ScSortParam & getSortParam() const;
115 class SC_DLLPUBLIC TextTransformation : public DataTransformation
117 std::set<SCCOL> const mnCol;
118 TEXT_TRANSFORM_TYPE const maType;
120 public:
121 TextTransformation(const std::set<SCCOL>& nCol, const TEXT_TRANSFORM_TYPE rType);
122 virtual void Transform(ScDocument& rDoc) const override;
123 virtual TransformationType getTransformationType() const override;
124 TEXT_TRANSFORM_TYPE getTextTransformationType() const;
125 const std::set<SCCOL>& getColumns() const;
128 class SC_DLLPUBLIC AggregateFunction : public DataTransformation
130 std::set<SCCOL> const maColumns;
131 AGGREGATE_FUNCTION const maType;
133 public:
134 AggregateFunction(const std::set<SCCOL>& rColumns, const AGGREGATE_FUNCTION rType);
135 virtual void Transform(ScDocument& rDoc) const override;
136 virtual TransformationType getTransformationType() const override;
137 AGGREGATE_FUNCTION getAggregateType() const;
138 const std::set<SCCOL>& getColumns() const;
141 class SC_DLLPUBLIC NumberTransformation : public DataTransformation
143 std::set<SCCOL> const mnCol;
144 NUMBER_TRANSFORM_TYPE const maType;
145 int const maPrecision;
147 public:
148 NumberTransformation(const std::set<SCCOL>& nCol, const NUMBER_TRANSFORM_TYPE rType);
149 NumberTransformation(const std::set<SCCOL>& nCol, const NUMBER_TRANSFORM_TYPE rType,
150 int nPrecision);
151 virtual void Transform(ScDocument& rDoc) const override;
152 virtual TransformationType getTransformationType() const override;
153 NUMBER_TRANSFORM_TYPE getNumberTransformationType() const;
154 int getPrecision() const;
155 const std::set<SCCOL>& getColumn() const;
158 class SC_DLLPUBLIC ReplaceNullTransformation : public DataTransformation
160 std::set<SCCOL> const mnCol;
161 OUString const msReplaceWith;
163 public:
164 ReplaceNullTransformation(const std::set<SCCOL>& nCol, const OUString& sReplaceWith);
165 virtual void Transform(ScDocument& rDoc) const override;
166 virtual TransformationType getTransformationType() const override;
167 const std::set<SCCOL>& getColumn() const;
168 const OUString& getReplaceString() const;
171 class SC_DLLPUBLIC DateTimeTransformation : public DataTransformation
173 std::set<SCCOL> const mnCol;
174 DATETIME_TRANSFORMATION_TYPE const maType;
176 public:
177 DateTimeTransformation(const std::set<SCCOL>& nCol,
178 const DATETIME_TRANSFORMATION_TYPE rType);
179 virtual void Transform(ScDocument& rDoc) const override;
180 virtual TransformationType getTransformationType() const override;
181 DATETIME_TRANSFORMATION_TYPE getDateTimeTransformationType() const;
182 const std::set<SCCOL>& getColumn() const;
187 #endif
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */