1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
15 #include <sortparam.hxx>
23 enum class TransformationType
27 DELETE_TRANSFORMATION
,
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
54 static SCROW
getLastRow(const ScDocument
& rDoc
, SCCOL nCol
);
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
;
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
81 sal_Unicode mcSeparator
;
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
;
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
;
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
;
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
;
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
;
150 NumberTransformation(std::set
<SCCOL
>&& nCol
, const NUMBER_TRANSFORM_TYPE rType
);
151 NumberTransformation(std::set
<SCCOL
>&& nCol
, const NUMBER_TRANSFORM_TYPE rType
,
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
;
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
;
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
190 OUString maFindString
;
191 OUString maReplaceString
;
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
205 OUString maFindString
;
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
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: */