12 #include <document.hxx>
13 #include <rtl/math.hxx>
23 aDate.
AddDays(static_cast<sal_Int32>(::rtl::math::approxFloor(nDateTime)));
69 mcSeparator(cSeparator)
78 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
112 maMergeString(rMergeString)
128 SCCOL nTargetCol = *maColumns.begin();
131 for (
SCROW nRow = 0; nRow <= nMaxRow; ++nRow)
134 for (
auto& itr : maColumns)
136 if (itr != nTargetCol)
141 rDoc.
SetString(nTargetCol, nRow, 0, aStr.makeStringAndClear());
144 for (
auto& itr : maColumns)
146 if (itr == nTargetCol)
169 maSortParam(rSortParam)
197 for(
auto& rCol :
mnCol)
203 for(
auto& rCol : mnCol)
209 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
223 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
237 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
245 sal_Int32
length = aStr.getLength();
250 for (sal_Int32
i = 1;
i < length;
i++){
267 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
274 rDoc.
SetString(rCol, nRow, 0, aStr.trim());
315 for (
auto& rCol : maColumns)
322 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
328 double nVal = rDoc.
GetValue(rCol, nRow, 0);
332 rDoc.
SetValue(rCol, nEndRow + 1, 0, nSum);
338 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)
362 double nVal = rDoc.
GetValue(rCol, nRow, 0);
367 rDoc.
SetValue(rCol, nEndRow + 1, 0, nMin);
372 double nMax = std::numeric_limits<double>::lowest();
373 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
379 double nVal = rDoc.
GetValue(rCol, nRow, 0);
384 rDoc.
SetValue(rCol, nEndRow + 1, 0, nMax);
420 , maPrecision(nPrecision)
427 for(
auto& rCol :
mnCol)
433 for(
auto& rCol : mnCol)
441 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
447 double nVal = rDoc.
GetValue(rCol, nRow, 0);
456 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
462 double nVal = rDoc.
GetValue(rCol, nRow, 0);
463 rDoc.
SetValue(rCol, nRow, 0, rtl::math::approxCeil(nVal));
470 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
476 double nVal = rDoc.
GetValue(rCol, nRow, 0);
477 rDoc.
SetValue(rCol, nRow, 0, rtl::math::approxFloor(nVal));
484 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
490 double nVal = rDoc.
GetValue(rCol, nRow, 0);
491 if(std::signbit(nVal))
492 rDoc.
SetValue(rCol, nRow, 0, -1 * nVal);
499 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
505 double nVal = rDoc.
GetValue(rCol, nRow, 0);
508 rDoc.
SetValue(rCol, nRow, 0, rtl::math::log1p(nVal-1));
512 rDoc.
SetString(rCol, nRow, 0, OUString());
520 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
526 double nVal = rDoc.
GetValue(rCol, nRow, 0);
529 rDoc.
SetValue(rCol, nRow, 0, log10(nVal));
533 rDoc.
SetString(rCol, nRow, 0, OUString());
541 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
547 double nVal = rDoc.
GetValue(rCol, nRow, 0);
548 rDoc.
SetValue(rCol, nRow, 0, nVal * nVal * nVal);
555 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
561 double nVal = rDoc.
GetValue(rCol, nRow, 0);
562 rDoc.
SetValue(rCol, nRow, 0, nVal * nVal);
569 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
575 double nVal = rDoc.
GetValue(rCol, nRow, 0);
576 if (!std::signbit(nVal))
578 rDoc.
SetValue(rCol, nRow, 0, sqrt(nVal));
582 rDoc.
SetString(rCol, nRow, 0, OUString());
590 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
596 double nVal = rDoc.
GetValue(rCol, nRow, 0);
597 if (fmod(nVal, 1) == 0 && fmod(nVal, 2) == 0)
607 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
613 double nVal = rDoc.
GetValue(rCol, nRow, 0);
614 if (fmod(nVal, 1) == 0 && fmod(nVal, 2) != 0)
624 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
630 double nVal = rDoc.
GetValue(rCol, nRow, 0);
668 const OUString& sReplaceWith)
670 , msReplaceWith(sReplaceWith)
679 for(
auto& rCol :
mnCol)
682 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
722 for(
auto& rCol :
mnCol)
728 for(
auto& rCol : mnCol)
736 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
737 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
752 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
758 double nVal = rDoc.
GetValue(rCol, nRow, 0);
759 Date aDate = getDate(nVal, pFormatter);
769 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
770 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
776 double nVal = rDoc.
GetValue(rCol, nRow, 0);
777 Date aDate = getDate(nVal, pFormatter);
792 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
794 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
800 double nVal = rDoc.
GetValue(rCol, nRow, 0);
801 Date aDate = getDate(nVal, pFormatter);
815 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
821 double nVal = rDoc.
GetValue(rCol, nRow, 0);
822 Date aDate = getDate(nVal, pFormatter);
832 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
838 double nVal = rDoc.
GetValue(rCol, nRow, 0);
839 const Color* pColor =
nullptr;
851 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
852 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
858 double nVal = rDoc.
GetValue(rCol, nRow, 0);
860 Date aDate = getDate(nVal, pFormatter);
873 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
874 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
880 double nVal = rDoc.
GetValue(rCol, nRow, 0);
882 Date aDate = getDate(nVal, pFormatter);
894 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
900 double nVal = rDoc.
GetValue(rCol, nRow, 0);
901 Date aDate = getDate(nVal, pFormatter);
910 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
916 double nVal = rDoc.
GetValue(rCol, nRow, 0);
917 Date aDate = getDate(nVal, pFormatter);
926 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
932 double nVal = rDoc.
GetValue(rCol, nRow, 0);
933 Date aDate = getDate(nVal, pFormatter);
942 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
948 double nVal = rDoc.
GetValue(rCol, nRow, 0);
949 Date aDate = getDate(nVal, pFormatter);
953 if(nMonth >= 1 && nMonth <=3)
956 else if(nMonth >= 4 && nMonth <=6)
959 else if(nMonth >= 7 && nMonth <=9)
962 else if(nMonth >= 10 && nMonth <=12)
975 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
976 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
982 double nVal = rDoc.
GetValue(rCol, nRow, 0);
984 Date aDate = getDate(nVal, pFormatter);
988 if(nMonth >= 1 && nMonth <=3)
996 else if(nMonth >= 4 && nMonth <=6)
1001 rDoc.
SetValue(rCol, nRow, 0, nVal);
1004 else if(nMonth >= 7 && nMonth <=9)
1009 rDoc.
SetValue(rCol, nRow, 0, nVal);
1012 else if(nMonth >= 10 && nMonth <=12)
1017 rDoc.
SetValue(rCol, nRow, 0, nVal);
1030 sal_uInt32 nFormat = pFormatter->
GetStandardFormat( SvNumFormatType::DATE, eLanguage );
1031 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1038 double nVal = rDoc.
GetValue(rCol, nRow, 0);
1039 Date aDate = getDate(nVal, pFormatter);
1042 if(nMonth >= 1 && nMonth <=3)
1047 rDoc.
SetValue(rCol, nRow, 0, nVal);
1051 else if(nMonth >= 4 && nMonth <=6)
1056 rDoc.
SetValue(rCol, nRow, 0, nVal);
1060 else if(nMonth >= 7 && nMonth <=9)
1065 rDoc.
SetValue(rCol, nRow, 0, nVal);
1069 else if(nMonth >= 10 && nMonth <=12)
1074 rDoc.
SetValue(rCol, nRow, 0, nVal);
1088 sal_uInt32 nFormat = pFormatter->
GetStandardFormat(SvNumFormatType::TIME, eLanguage);
1089 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1103 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1109 double nVal = rDoc.
GetValue(rCol, nRow, 0);
1110 sal_uInt16 nHour, nMinute, nSecond;
1111 double fFractionOfSecond;
1113 rDoc.
SetValue(rCol, nRow, 0, nHour);
1120 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1126 double nVal = rDoc.
GetValue(rCol, nRow, 0);
1127 sal_uInt16 nHour, nMinute, nSecond;
1128 double fFractionOfSecond;
1130 rDoc.
SetValue(rCol, nRow, 0, nMinute);
1137 for (
SCROW nRow = 0; nRow <= nEndRow; ++nRow)
1143 double nVal = rDoc.
GetValue(rCol, nRow, 0);
1144 sal_uInt16 nHour, nMinute, nSecond;
1145 double fFractionOfSecond;
1147 rDoc.
SetValue(rCol, nRow, 0, nSecond);
void DeleteCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, bool *pUndoOutline=nullptr, const ScMarkData *pTabMark=nullptr)
virtual void Transform(ScDocument &rDoc) const override
AGGREGATE_FUNCTION maType
DayOfWeek GetDayOfWeek() const
TEXT_TRANSFORM_TYPE getTextTransformationType() const
virtual TransformationType getTransformationType() const override
const std::set< SCCOL > & getColumns() const
bool InsertCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTAB nEndTab, SCCOL nStartCol, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
virtual void Transform(ScDocument &rDoc) const override
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
void Sort(SCTAB nTab, const ScSortParam &rSortParam, bool bKeepQuery, bool bUpdateRefs, ScProgress *pProgress, sc::ReorderParam *pUndo)
Sort a range of data.
AGGREGATE_FUNCTION getAggregateType() const
TEXT_TRANSFORM_TYPE maType
SC_DLLPUBLIC SCROW MaxRow() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uInt16 GetMonth() const
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
DATETIME_TRANSFORMATION_TYPE
sal_Int16 GetYear() const
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
sal_uInt16 GetDaysInMonth() const
void SetDay(sal_uInt16 nNewDay)
sal_uInt16 GetDay() const
void AddDays(sal_Int32 nAddDays)
static SC_DLLPUBLIC LanguageType eLnge
void SetNumberFormat(const ScAddress &rPos, sal_uInt32 nNumberFormat)
std::set< SCCOL > maColumns
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
AggregateFunction(const std::set< SCCOL > &rColumns, const AGGREGATE_FUNCTION rType)
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...
const std::set< SCCOL > & getColumns() const
sal_uInt16 GetDayOfYear() const
virtual TransformationType getTransformationType() const override
TextTransformation(const std::set< SCCOL > &nCol, const TEXT_TRANSFORM_TYPE rType)
void SetMonth(sal_uInt16 nNewMonth)
SC_DLLPUBLIC void GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab, CellType &rCellType) const