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/.
10 #ifndef INCLUDED_SC_SOURCE_UI_DATAPROVIDER_DATATRANSFORMATION_HXX
11 #define INCLUDED_SC_SOURCE_UI_DATAPROVIDER_DATATRANSFORMATION_HXX
16 #include <sortparam.hxx>
24 enum class TransformationType
28 DELETE_TRANSFORMATION
,
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
52 static SCROW
getLastRow(const ScDocument
& rDoc
, SCCOL nCol
);
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
;
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
79 sal_Unicode
const mcSeparator
;
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
;
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
;
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
;
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
;
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
;
148 NumberTransformation(const std::set
<SCCOL
>& nCol
, const NUMBER_TRANSFORM_TYPE rType
);
149 NumberTransformation(const std::set
<SCCOL
>& nCol
, const NUMBER_TRANSFORM_TYPE rType
,
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
;
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
;
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;
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */