12#include <document.hxx>
13#include <rtl/math.hxx>
25 aDate.
AddDays(
static_cast<sal_Int32
>(::rtl::math::approxFloor(nDateTime)));
43 maColumns(
std::move(rColumns))
53 sal_Int32 nIncrementIndex = 0;
73 mcSeparator(cSeparator)
85 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
117 maColumns(
std::move(rColumns)),
118 maMergeString(
std::move(aMergeString))
132 assert(nMaxRow != -1);
137 for (
SCROW nRow = 0; nRow <= nMaxRow; ++nRow)
142 if (itr != nTargetCol)
147 rDoc.
SetString(nTargetCol, nRow, 0,
aStr.makeStringAndClear());
152 if (itr == nTargetCol)
175 maSortParam(rSortParam)
203 for(
auto& rCol :
mnCol)
207 assert(nEndRow != -1);
209 for(
auto& rCol :
mnCol)
215 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
228 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
241 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
270 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
303 maColumns(
std::move(rColumns)),
315 assert(nEndRow != -1);
324 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
329 double nVal = rDoc.
GetValue(rCol, nRow, 0);
333 rDoc.
SetValue(rCol, nEndRow + 1, 0, nSum);
339 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
344 double nVal = rDoc.
GetValue(rCol, nRow, 0);
349 double nAvg = nSum / (nEndRow + 1);
350 rDoc.
SetValue(rCol, nEndRow + 1, 0, nAvg);
355 double nMin = std::numeric_limits<double>::max();
356 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
361 double nVal = rDoc.
GetValue(rCol, nRow, 0);
366 rDoc.
SetValue(rCol, nEndRow + 1, 0, nMin);
371 double nMax = std::numeric_limits<double>::lowest();
372 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
377 double nVal = rDoc.
GetValue(rCol, nRow, 0);
382 rDoc.
SetValue(rCol, nEndRow + 1, 0, nMax);
418 , maPrecision(nPrecision)
425 for(
auto& rCol :
mnCol)
429 assert(nEndRow != -1);
431 for(
auto& rCol :
mnCol)
439 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
444 double nVal = rDoc.
GetValue(rCol, nRow, 0);
453 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
458 double nVal = rDoc.
GetValue(rCol, nRow, 0);
459 rDoc.
SetValue(rCol, nRow, 0, rtl::math::approxCeil(nVal));
466 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
471 double nVal = rDoc.
GetValue(rCol, nRow, 0);
472 rDoc.
SetValue(rCol, nRow, 0, rtl::math::approxFloor(nVal));
479 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
484 double nVal = rDoc.
GetValue(rCol, nRow, 0);
485 if(std::signbit(nVal))
486 rDoc.
SetValue(rCol, nRow, 0, -1 * nVal);
493 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
498 double nVal = rDoc.
GetValue(rCol, nRow, 0);
501 rDoc.
SetValue(rCol, nRow, 0, std::log1p(nVal-1));
505 rDoc.
SetString(rCol, nRow, 0, OUString());
513 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
518 double nVal = rDoc.
GetValue(rCol, nRow, 0);
521 rDoc.
SetValue(rCol, nRow, 0, log10(nVal));
525 rDoc.
SetString(rCol, nRow, 0, OUString());
533 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
538 double nVal = rDoc.
GetValue(rCol, nRow, 0);
539 rDoc.
SetValue(rCol, nRow, 0, nVal * nVal * nVal);
546 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
551 double nVal = rDoc.
GetValue(rCol, nRow, 0);
552 rDoc.
SetValue(rCol, nRow, 0, nVal * nVal);
559 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
564 double nVal = rDoc.
GetValue(rCol, nRow, 0);
565 if (!std::signbit(nVal))
567 rDoc.
SetValue(rCol, nRow, 0, sqrt(nVal));
571 rDoc.
SetString(rCol, nRow, 0, OUString());
579 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
584 double nVal = rDoc.
GetValue(rCol, nRow, 0);
585 if (fmod(nVal, 1) == 0 && fmod(nVal, 2) == 0)
595 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
600 double nVal = rDoc.
GetValue(rCol, nRow, 0);
601 if (fmod(nVal, 1) == 0 && fmod(nVal, 2) != 0)
611 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
616 double nVal = rDoc.
GetValue(rCol, nRow, 0);
654 OUString sReplaceWith)
656 , msReplaceWith(
std::move(sReplaceWith))
665 for(
auto& rCol :
mnCol)
668 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
707 for(
auto& rCol :
mnCol)
711 assert(nEndRow != -1);
713 for(
auto& rCol :
mnCol)
721 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
722 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
736 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
741 double nVal = rDoc.
GetValue(rCol, nRow, 0);
742 Date aDate = getDate(nVal, pFormatter);
752 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
753 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
758 double nVal = rDoc.
GetValue(rCol, nRow, 0);
759 Date aDate = getDate(nVal, pFormatter);
774 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
776 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
781 double nVal = rDoc.
GetValue(rCol, nRow, 0);
782 Date aDate = getDate(nVal, pFormatter);
796 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
801 double nVal = rDoc.
GetValue(rCol, nRow, 0);
802 Date aDate = getDate(nVal, pFormatter);
812 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
817 double nVal = rDoc.
GetValue(rCol, nRow, 0);
818 const Color* pColor =
nullptr;
830 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
831 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
836 double nVal = rDoc.
GetValue(rCol, nRow, 0);
838 Date aDate = getDate(nVal, pFormatter);
851 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
852 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
857 double nVal = rDoc.
GetValue(rCol, nRow, 0);
859 Date aDate = getDate(nVal, pFormatter);
871 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
876 double nVal = rDoc.
GetValue(rCol, nRow, 0);
877 Date aDate = getDate(nVal, pFormatter);
886 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
891 double nVal = rDoc.
GetValue(rCol, nRow, 0);
892 Date aDate = getDate(nVal, pFormatter);
901 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
906 double nVal = rDoc.
GetValue(rCol, nRow, 0);
907 Date aDate = getDate(nVal, pFormatter);
916 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
921 double nVal = rDoc.
GetValue(rCol, nRow, 0);
922 Date aDate = getDate(nVal, pFormatter);
926 if(nMonth >= 1 && nMonth <=3)
929 else if(nMonth >= 4 && nMonth <=6)
932 else if(nMonth >= 7 && nMonth <=9)
935 else if(nMonth >= 10 && nMonth <=12)
948 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
949 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
954 double nVal = rDoc.
GetValue(rCol, nRow, 0);
956 Date aDate = getDate(nVal, pFormatter);
960 if(nMonth >= 1 && nMonth <=3)
968 else if(nMonth >= 4 && nMonth <=6)
976 else if(nMonth >= 7 && nMonth <=9)
984 else if(nMonth >= 10 && nMonth <=12)
1002 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
1003 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1009 double nVal = rDoc.
GetValue(rCol, nRow, 0);
1010 Date aDate = getDate(nVal, pFormatter);
1013 if(nMonth >= 1 && nMonth <=3)
1018 rDoc.
SetValue(rCol, nRow, 0, nVal);
1022 else if(nMonth >= 4 && nMonth <=6)
1027 rDoc.
SetValue(rCol, nRow, 0, nVal);
1031 else if(nMonth >= 7 && nMonth <=9)
1036 rDoc.
SetValue(rCol, nRow, 0, nVal);
1040 else if(nMonth >= 10 && nMonth <=12)
1045 rDoc.
SetValue(rCol, nRow, 0, nVal);
1059 sal_uInt32 nFormat = pFormatter->
GetStandardFormat(SvNumFormatType::TIME, eLanguage);
1060 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1073 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1078 double nVal = rDoc.
GetValue(rCol, nRow, 0);
1079 sal_uInt16 nHour, nMinute, nSecond;
1080 double fFractionOfSecond;
1082 rDoc.
SetValue(rCol, nRow, 0, nHour);
1089 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1094 double nVal = rDoc.
GetValue(rCol, nRow, 0);
1095 sal_uInt16 nHour, nMinute, nSecond;
1096 double fFractionOfSecond;
1098 rDoc.
SetValue(rCol, nRow, 0, nMinute);
1105 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1110 double nVal = rDoc.
GetValue(rCol, nRow, 0);
1111 sal_uInt16 nHour, nMinute, nSecond;
1112 double fFractionOfSecond;
1114 rDoc.
SetValue(rCol, nRow, 0, nSecond);
1142 , maFindString(
std::move(aFindString))
1143 , maReplaceString(
std::move(aReplaceString))
1153 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1187 , maFindString(
std::move(aFindString))
1193 sal_Int32 nIncrementIndex = 0;
1198 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1239 for (
SCCOL nCol = 0; nCol <= rDoc.
MaxCol(); ++nCol)
sal_uInt16 GetDayOfYear() const
void AddDays(sal_Int32 nAddDays)
sal_Int16 GetYear() const
sal_uInt16 GetDay() const
sal_uInt16 GetDaysInMonth() const
void SetMonth(sal_uInt16 nNewMonth)
DayOfWeek GetDayOfWeek() const
void SetDay(sal_uInt16 nNewDay)
sal_uInt16 GetMonth() const
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
SC_DLLPUBLIC SCROW GetLastDataRow(SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCROW nLastRow) const
Return the last non-empty row position in given columns that's no greater than the initial last row p...
SC_DLLPUBLIC void SetNumberFormat(const ScAddress &rPos, sal_uInt32 nNumberFormat)
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
void DeleteRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
void DeleteCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
bool InsertCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
void Sort(SCTAB nTab, const ScSortParam &rSortParam, bool bKeepQuery, bool bUpdateRefs, ScProgress *pProgress, sc::ReorderParam *pUndo)
Sort a range of data.
static SC_DLLPUBLIC LanguageType eLnge
static SC_DLLPUBLIC const CharClass & getCharClass()
std::set< SCCOL > maColumns
virtual TransformationType getTransformationType() const override
AGGREGATE_FUNCTION getAggregateType() const
virtual void Transform(ScDocument &rDoc) const override
AggregateFunction(std::set< SCCOL > &&rColumns, const AGGREGATE_FUNCTION rType)
AGGREGATE_FUNCTION maType
const std::set< SCCOL > & getColumns() const
const std::set< SCCOL > & getColumns() const
TEXT_TRANSFORM_TYPE maType
TextTransformation(std::set< SCCOL > &&nCol, const TEXT_TRANSFORM_TYPE rType)
virtual void Transform(ScDocument &rDoc) const override
TEXT_TRANSFORM_TYPE getTextTransformationType() const
virtual TransformationType getTransformationType() const override
CAUTION! The following defines must be in the same namespace as the respective type.
DATETIME_TRANSFORMATION_TYPE
@ DATETIME_TRANSFORMATION
@ DELETEROW_TRANSFORMATION
@ FINDREPLACE_TRANSFORMATION
@ REMOVE_NULL_TRANSFORMATION
@ SWAPROWS_TRANSFORMATION