core.git: i18npool/source
i18npool/source/localedata/data/en_ZA.xml | 46 +++--- 1 file changed, 23 insertions(+), 23 deletions(-) New commits: commit 92ea59703da91771ca78ade82ca796077c066da8 Author: Eike Rathke AuthorDate: Wed Apr 24 18:09:45 2024 +0200 Commit: Eike Rathke CommitDate: Wed Apr 24 22:40:02 2024 +0200 Resolves: tdf#159829 DecimalSeparator '.' period, ThousandSeparator ',' comma Follows https://unicode-org.atlassian.net/browse/CLDR-16247 https://unicode-org.atlassian.net/browse/CLDR-14707?focusedCommentId=161272 Change-Id: I7ad049dd06102b36ac8d7ff13f7604e5cbb10f9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166602 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/source/localedata/data/en_ZA.xml b/i18npool/source/localedata/data/en_ZA.xml index 1e9175837279..dd61e98a2349 100644 --- a/i18npool/source/localedata/data/en_ZA.xml +++ b/i18npool/source/localedata/data/en_ZA.xml @@ -31,10 +31,10 @@ / - - , + , + . : - , + . ; @@ -62,22 +62,22 @@ 0 - 0,00 + 0.00 - # ##0 + #,##0 - # ##0,00 + #,##0.00 - # ###,00 + #,###.00 - # ##0_);(# ##0) + #,##0_);(#,##0) - # ##0,00_);(# ##0,00) + #,##0.00_);(#,##0.00) [NatNum12 cardinal]0 @@ -92,49 +92,49 @@ [NatNum12 upper cardinal]0 - 0,00E+000 + 0.00E+000 - 0,00E+00 + 0.00E+00 - ##0,00E+00 + ##0.00E+00 0% - 0,00% + 0.00% - [CURRENCY] # ##0;[CURRENCY]-# ##0 + [CURRENCY] #,##0;[CURRENCY]-#,##0 - [CURRENCY] # ##0,00;[CURRENCY]-# ##0,00 + [CURRENCY] #,##0.00;[CURRENCY]-#,##0.00 - [CURRENCY] # ##0;[RED][CURRENCY]-# ##0 + [CURRENCY] #,##0;[RED][CURRENCY]-#,##0 - [CURRENCY] # ##0,00;[RED][CURRENCY]-# ##0,00 + [CURRENCY] #,##0.00;[RED][CURRENCY]-#,##0.00 - # ##0,00 CCC + #,##0.00 CCC - [CURRENCY] # ##0,--;[RED][CURRENCY]-# ##0,-- + [CURRENCY] #,##0,--;[RED][CURRENCY]-#,##0,-- [NatNum12 title CURRENCY]0 - [NatNum12 title CURRENCY]0,00 + [NatNum12 title CURRENCY]0.00 [NatNum12 upper CURRENCY]0 - [NatNum12 upper CURRENCY]0,00 + [NatNum12 upper CURRENCY]0.00 YY-MM-DD @@ -222,10 +222,10 @@ [HH]:MM:SS - MM:SS,00 + MM:SS.00 - [HH]:MM:SS,00 + [HH]:MM:SS.00 YY-MM-DD HH:MM
core.git: Branch 'libreoffice-7-6' - i18npool/source
i18npool/source/localedata/data/bg_BG.xml | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) New commits: commit 88f6a250076eb2a825084c84193b84f3b94ce112 Author: Eike Rathke AuthorDate: Sun Apr 14 16:03:39 2024 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Mon Apr 15 02:10:12 2024 +0200 Correct {bg-BG} formats with group separator The leading # digit before the separator was omitted. This never worked as intended. Change-Id: Idf8a6cf246b8db4e6d5361bc1c5f66c1c0c057c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166072 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 2e29c97ec2ba64e5e26ee571e227db9dd2d752e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166090 Reviewed-by: Adolfo Jayme Barrientos diff --git a/i18npool/source/localedata/data/bg_BG.xml b/i18npool/source/localedata/data/bg_BG.xml index 8813942ff893..55c63049089f 100644 --- a/i18npool/source/localedata/data/bg_BG.xml +++ b/i18npool/source/localedata/data/bg_BG.xml @@ -67,13 +67,13 @@ 0,00 - ##0 + # ##0 - ##0,00 + # ##0,00 - ###,00 + # ###,00 [NatNum12 cardinal]0 @@ -100,22 +100,22 @@ 0,00% - ##0 [CURRENCY];- ##0 [CURRENCY] + # ##0 [CURRENCY];-# ##0 [CURRENCY] - ##0,00 [CURRENCY];- ##0,00 [CURRENCY] + # ##0,00 [CURRENCY];-# ##0,00 [CURRENCY] - ##0 [CURRENCY];[RED]- ##0 [CURRENCY] + # ##0 [CURRENCY];[RED]-# ##0 [CURRENCY] - ##0,00 [CURRENCY];[RED]- ##0,00 [CURRENCY] + # ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY] - ##0,00 CCC + # ##0,00 CCC - ##0,-- [CURRENCY];[RED]- ##0,-- [CURRENCY] + # ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY] [NatNum12 CURRENCY]0
core.git: Branch 'libreoffice-24-2' - i18npool/source
i18npool/source/localedata/data/bg_BG.xml | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) New commits: commit ae35c7770169a7ab8721ac26adf55e22491494ec Author: Eike Rathke AuthorDate: Sun Apr 14 16:03:39 2024 +0200 Commit: Caolán McNamara CommitDate: Sun Apr 14 20:30:27 2024 +0200 Correct {bg-BG} formats with group separator The leading # digit before the separator was omitted. This never worked as intended. Change-Id: Idf8a6cf246b8db4e6d5361bc1c5f66c1c0c057c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166072 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit afa957aeb9f0afd8179f02a4b4281c77b737300b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165949 Reviewed-by: Adolfo Jayme Barrientos diff --git a/i18npool/source/localedata/data/bg_BG.xml b/i18npool/source/localedata/data/bg_BG.xml index 8813942ff893..55c63049089f 100644 --- a/i18npool/source/localedata/data/bg_BG.xml +++ b/i18npool/source/localedata/data/bg_BG.xml @@ -67,13 +67,13 @@ 0,00 - ##0 + # ##0 - ##0,00 + # ##0,00 - ###,00 + # ###,00 [NatNum12 cardinal]0 @@ -100,22 +100,22 @@ 0,00% - ##0 [CURRENCY];- ##0 [CURRENCY] + # ##0 [CURRENCY];-# ##0 [CURRENCY] - ##0,00 [CURRENCY];- ##0,00 [CURRENCY] + # ##0,00 [CURRENCY];-# ##0,00 [CURRENCY] - ##0 [CURRENCY];[RED]- ##0 [CURRENCY] + # ##0 [CURRENCY];[RED]-# ##0 [CURRENCY] - ##0,00 [CURRENCY];[RED]- ##0,00 [CURRENCY] + # ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY] - ##0,00 CCC + # ##0,00 CCC - ##0,-- [CURRENCY];[RED]- ##0,-- [CURRENCY] + # ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY] [NatNum12 CURRENCY]0
core.git: i18npool/source
i18npool/source/localedata/data/bg_BG.xml | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) New commits: commit 2e29c97ec2ba64e5e26ee571e227db9dd2d752e1 Author: Eike Rathke AuthorDate: Sun Apr 14 16:03:39 2024 +0200 Commit: Eike Rathke CommitDate: Sun Apr 14 18:41:40 2024 +0200 Correct {bg-BG} formats with group separator The leading # digit before the separator was omitted. This never worked as intended. Change-Id: Idf8a6cf246b8db4e6d5361bc1c5f66c1c0c057c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166072 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/source/localedata/data/bg_BG.xml b/i18npool/source/localedata/data/bg_BG.xml index 8813942ff893..55c63049089f 100644 --- a/i18npool/source/localedata/data/bg_BG.xml +++ b/i18npool/source/localedata/data/bg_BG.xml @@ -67,13 +67,13 @@ 0,00 - ##0 + # ##0 - ##0,00 + # ##0,00 - ###,00 + # ###,00 [NatNum12 cardinal]0 @@ -100,22 +100,22 @@ 0,00% - ##0 [CURRENCY];- ##0 [CURRENCY] + # ##0 [CURRENCY];-# ##0 [CURRENCY] - ##0,00 [CURRENCY];- ##0,00 [CURRENCY] + # ##0,00 [CURRENCY];-# ##0,00 [CURRENCY] - ##0 [CURRENCY];[RED]- ##0 [CURRENCY] + # ##0 [CURRENCY];[RED]-# ##0 [CURRENCY] - ##0,00 [CURRENCY];[RED]- ##0,00 [CURRENCY] + # ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY] - ##0,00 CCC + # ##0,00 CCC - ##0,-- [CURRENCY];[RED]- ##0,-- [CURRENCY] + # ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY] [NatNum12 CURRENCY]0
core.git: svtools/inc svx/source
svtools/inc/langtab.hrc |2 ++ svx/source/dialog/langbox.cxx |4 2 files changed, 6 insertions(+) New commits: commit d4375cf6e6086c3b9cb169cbb40781e8b1124b4d Author: Eike Rathke AuthorDate: Thu Apr 11 19:15:17 2024 +0200 Commit: Eike Rathke CommitDate: Fri Apr 12 12:06:28 2024 +0200 Resolves: tdf#160256 Add "[Multiple]" and "[Undetermined]" to language list Such that they are added to the top of the list after "[None]" and only if "[None]" was requested. {mul} and {und} ISO codes. Change-Id: I024311fe7d638124932a1d38759305e8efec5962 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166012 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/svtools/inc/langtab.hrc b/svtools/inc/langtab.hrc index f2d223840229..9cd73c366425 100644 --- a/svtools/inc/langtab.hrc +++ b/svtools/inc/langtab.hrc @@ -27,6 +27,8 @@ const std::pair STR_ARR_SVT_LANGUAGE_TABLE[] = { { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "[None]") , LANGUAGE_NONE }, +{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "[Multiple]") , LANGUAGE_MULTIPLE }, +{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "[Undetermined]") , LANGUAGE_UNDETERMINED }, { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Unknown") , LANGUAGE_DONTKNOW }, { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Default") , LANGUAGE_SYSTEM }, { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Default") , LANGUAGE_USER_SYSTEM_CONFIG }, diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 8699a6798d59..477e4047e828 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -101,6 +101,8 @@ bool lcl_isPrerequisite(LanguageType nLangType, bool requireSublang) nLangType != LANGUAGE_DONTKNOW && nLangType != LANGUAGE_SYSTEM && nLangType != LANGUAGE_NONE && +nLangType != LANGUAGE_MULTIPLE && +nLangType != LANGUAGE_UNDETERMINED && nLangType != LANGUAGE_USER_KEYID && !MsLangId::isLegacy( nLangType) && (!requireSublang || MsLangId::getSubLanguage( nLangType)); @@ -311,6 +313,8 @@ void SvxLanguageBox::SetLanguageList(SvxLanguageListFlags nLangList, bool bHasLa if (bHasLangNone) { m_xControl->append(BuildEntry(LANGUAGE_NONE)); +m_xControl->append(BuildEntry(LANGUAGE_MULTIPLE)); +m_xControl->append(BuildEntry(LANGUAGE_UNDETERMINED)); bAddSeparator = true; }
core.git: Branch 'libreoffice-24-2-0' - svl/source
svl/source/numbers/zforfind.cxx | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) New commits: commit 73dd4d13f503d09d6d20a349a5bf9052680f592a Author: Eike Rathke AuthorDate: Fri Jan 12 17:03:35 2024 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Tue Jan 16 17:56:25 2024 +0100 Resolves: tdf#159148 Accept int32 hours:minutes:seconds input ... and detect overflow to result in text instead of 00:00 input loss. Change-Id: Ib2b9f16ab6c3c2963c5a2058c27366219f090096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161977 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit e69192b51fc00cbc38006230364af07983a9a827) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161995 Reviewed-by: Michael Stahl Reviewed-by: Xisco Fauli Tested-by: Adolfo Jayme Barrientos Reviewed-by: Adolfo Jayme Barrientos diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index d29a6a025cd8..c1898104a905 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -983,9 +983,9 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, ) const { bool bRet = true; -sal_uInt16 nHour; -sal_uInt16 nMinute = 0; -sal_uInt16 nSecond = 0; +sal_Int32 nHour; +sal_Int32 nMinute = 0; +sal_Int32 nSecond = 0; double fSecond100 = 0.0; sal_uInt16 nStartIndex = nIndex; @@ -1000,7 +1000,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } else if (nIndex - nStartIndex < nCnt) { -nHour = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nHour = rValStr.toInt32(); +if (nHour == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text } else { @@ -1031,7 +1034,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } else if (nIndex - nStartIndex < nCnt) { -nMinute = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nMinute = rValStr.toInt32(); +if (nMinute == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration && nIndex > 1 && nMinute > 59) bRet = false; // 1:60 or 1:123 is invalid, 123:1 or 0:123 is valid @@ -1040,7 +1046,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } if (nIndex - nStartIndex < nCnt) { -nSecond = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nSecond = rValStr.toInt32(); +if (nSecond == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration && nIndex > 1 && nSecond > 59 && !(nHour == 23 && nMinute == 59 && nSecond == 60)) bRet = false; // 1:60 or 1:123 or 1:1:123 is invalid, 123:1 or 123:1:1 or 0:0:123 is valid, or leap second
core.git: Branch 'libreoffice-7-6' - svl/source
svl/source/numbers/zforfind.cxx | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) New commits: commit d0f4bad08e03762dd7f163a147b0d489262aa169 Author: Eike Rathke AuthorDate: Fri Jan 12 17:03:35 2024 +0100 Commit: Michael Stahl CommitDate: Mon Jan 15 10:49:09 2024 +0100 Resolves: tdf#159148 Accept int32 hours:minutes:seconds input ... and detect overflow to result in text instead of 00:00 input loss. Change-Id: Ib2b9f16ab6c3c2963c5a2058c27366219f090096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161977 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 988db36e0992829b01a1341e92d6d2df715a7be5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161994 Reviewed-by: Michael Stahl diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index da993232e677..2277c824734c 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -983,9 +983,9 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, ) const { bool bRet = true; -sal_uInt16 nHour; -sal_uInt16 nMinute = 0; -sal_uInt16 nSecond = 0; +sal_Int32 nHour; +sal_Int32 nMinute = 0; +sal_Int32 nSecond = 0; double fSecond100 = 0.0; sal_uInt16 nStartIndex = nIndex; @@ -1000,7 +1000,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } else if (nIndex - nStartIndex < nCnt) { -nHour = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nHour = rValStr.toInt32(); +if (nHour == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text } else { @@ -1031,7 +1034,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } else if (nIndex - nStartIndex < nCnt) { -nMinute = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nMinute = rValStr.toInt32(); +if (nMinute == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration && nIndex > 1 && nMinute > 59) bRet = false; // 1:60 or 1:123 is invalid, 123:1 or 0:123 is valid @@ -1040,7 +1046,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } if (nIndex - nStartIndex < nCnt) { -nSecond = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nSecond = rValStr.toInt32(); +if (nSecond == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration && nIndex > 1 && nSecond > 59 && !(nHour == 23 && nMinute == 59 && nSecond == 60)) bRet = false; // 1:60 or 1:123 or 1:1:123 is invalid, 123:1 or 123:1:1 or 0:0:123 is valid, or leap second
core.git: Branch 'libreoffice-24-2' - svl/source
svl/source/numbers/zforfind.cxx | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) New commits: commit 9d5b078120f1151e9afaf30ca8e088a871c5d443 Author: Eike Rathke AuthorDate: Fri Jan 12 17:03:35 2024 +0100 Commit: Michael Stahl CommitDate: Mon Jan 15 10:48:09 2024 +0100 Resolves: tdf#159148 Accept int32 hours:minutes:seconds input ... and detect overflow to result in text instead of 00:00 input loss. Change-Id: Ib2b9f16ab6c3c2963c5a2058c27366219f090096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161977 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit e69192b51fc00cbc38006230364af07983a9a827) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161993 Reviewed-by: Michael Stahl diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index d29a6a025cd8..c1898104a905 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -983,9 +983,9 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, ) const { bool bRet = true; -sal_uInt16 nHour; -sal_uInt16 nMinute = 0; -sal_uInt16 nSecond = 0; +sal_Int32 nHour; +sal_Int32 nMinute = 0; +sal_Int32 nSecond = 0; double fSecond100 = 0.0; sal_uInt16 nStartIndex = nIndex; @@ -1000,7 +1000,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } else if (nIndex - nStartIndex < nCnt) { -nHour = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nHour = rValStr.toInt32(); +if (nHour == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text } else { @@ -1031,7 +1034,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } else if (nIndex - nStartIndex < nCnt) { -nMinute = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nMinute = rValStr.toInt32(); +if (nMinute == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration && nIndex > 1 && nMinute > 59) bRet = false; // 1:60 or 1:123 is invalid, 123:1 or 0:123 is valid @@ -1040,7 +1046,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } if (nIndex - nStartIndex < nCnt) { -nSecond = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nSecond = rValStr.toInt32(); +if (nSecond == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration && nIndex > 1 && nSecond > 59 && !(nHour == 23 && nMinute == 59 && nSecond == 60)) bRet = false; // 1:60 or 1:123 or 1:1:123 is invalid, 123:1 or 123:1:1 or 0:0:123 is valid, or leap second
core.git: 2 commits - helpcontent2 svl/source
helpcontent2|2 +- svl/source/numbers/zforfind.cxx | 21 +++-- 2 files changed, 16 insertions(+), 7 deletions(-) New commits: commit 988db36e0992829b01a1341e92d6d2df715a7be5 Author: Eike Rathke AuthorDate: Fri Jan 12 17:03:35 2024 +0100 Commit: Eike Rathke CommitDate: Fri Jan 12 18:10:36 2024 +0100 Resolves: tdf#159148 Accept int32 hours:minutes:seconds input ... and detect overflow to result in text instead of 00:00 input loss. Change-Id: Ib2b9f16ab6c3c2963c5a2058c27366219f090096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161977 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index d29a6a025cd8..c1898104a905 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -983,9 +983,9 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, ) const { bool bRet = true; -sal_uInt16 nHour; -sal_uInt16 nMinute = 0; -sal_uInt16 nSecond = 0; +sal_Int32 nHour; +sal_Int32 nMinute = 0; +sal_Int32 nSecond = 0; double fSecond100 = 0.0; sal_uInt16 nStartIndex = nIndex; @@ -1000,7 +1000,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } else if (nIndex - nStartIndex < nCnt) { -nHour = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nHour = rValStr.toInt32(); +if (nHour == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text } else { @@ -1031,7 +1034,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } else if (nIndex - nStartIndex < nCnt) { -nMinute = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nMinute = rValStr.toInt32(); +if (nMinute == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration && nIndex > 1 && nMinute > 59) bRet = false; // 1:60 or 1:123 is invalid, 123:1 or 0:123 is valid @@ -1040,7 +1046,10 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber, } if (nIndex - nStartIndex < nCnt) { -nSecond = static_cast(sStrArray[nNums[nIndex++]].toInt32()); +const OUString& rValStr = sStrArray[nNums[nIndex++]]; +nSecond = rValStr.toInt32(); +if (nSecond == 0 && rValStr != "0" && rValStr != "00") +bRet = false; // overflow -> Text if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration && nIndex > 1 && nSecond > 59 && !(nHour == 23 && nMinute == 59 && nSecond == 60)) bRet = false; // 1:60 or 1:123 or 1:1:123 is invalid, 123:1 or 123:1:1 or 0:0:123 is valid, or leap second commit 23987653e8f0b6f15f546496b4895cefc0d89a94 Author: Dione Maddern AuthorDate: Fri Jan 12 18:10:21 2024 +0100 Commit: Gerrit Code Review CommitDate: Fri Jan 12 18:10:21 2024 +0100 Update git submodules * Update helpcontent2 from branch 'master' to 2039fbabf053a19c9eaeee3db95dc8d710dfeb69 - tdf#155877 Update help page with "how to get" information Change-Id: I1348ad34fc3e6180df2e0396f176dc6badbc529f Reviewed-on: https://gerrit.libreoffice.org/c/help/+/161677 Tested-by: Jenkins Reviewed-by: Olivier Hallot diff --git a/helpcontent2 b/helpcontent2 index 04877b3bb878..2039fbabf053 16 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 04877b3bb878e30f8df562a35bc97163ee6be9ff +Subproject commit 2039fbabf053a19c9eaeee3db95dc8d710dfeb69
core.git: Branch 'libreoffice-24-2' - include/systools
include/systools/curlinit.hxx|2 ++ include/systools/opensslinit.hxx |4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) New commits: commit af7e6fe6c7a76433ccb63d10d7cddd8335c0630c Author: Eike Rathke AuthorDate: Sat Dec 9 11:44:43 2023 +0100 Commit: Eike Rathke CommitDate: Mon Dec 11 18:31:36 2023 +0100 Fix build --with-system-openssl but --without-system-curl Change-Id: I60e2e995a159ebbbdc0991204d765b5654d5a4fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160510 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 7b2166c8217cb32f2f7951f074e33d9fe890bb9b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160489 Tested-by: Eike Rathke diff --git a/include/systools/curlinit.hxx b/include/systools/curlinit.hxx index bf2899ee1e23..d03c620a3c75 100644 --- a/include/systools/curlinit.hxx +++ b/include/systools/curlinit.hxx @@ -16,7 +16,9 @@ #if defined(LINUX) && !defined(SYSTEM_CURL) #include +#define LO_CURL_NEEDS_CA_BUNDLE #include "opensslinit.hxx" +#undef LO_CURL_NEEDS_CA_BUNDLE #endif #include diff --git a/include/systools/opensslinit.hxx b/include/systools/opensslinit.hxx index 9c3f4c860895..04f38faa0821 100644 --- a/include/systools/opensslinit.hxx +++ b/include/systools/opensslinit.hxx @@ -11,7 +11,9 @@ #include -#if defined(LINUX) && !defined(SYSTEM_OPENSSL) +// Also include/systools/curlinit.hxx needs GetCABundleFile() if +// !defined(SYSTEM_CURL) it defines LO_CURL_NEEDS_CA_BUNDLE. +#if defined(LINUX) && (!defined(SYSTEM_OPENSSL) || defined(LO_CURL_NEEDS_CA_BUNDLE)) #include #include
core.git: Branch 'libreoffice-24-2' - i18npool/source
i18npool/source/localedata/data/bn_IN.xml |6 +++--- i18npool/source/localedata/data/hi_IN.xml |6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) New commits: commit e75ca418aa2fd9ac2be6828547d2136edc584553 Author: Eike Rathke AuthorDate: Sat Dec 9 12:33:19 2023 +0100 Commit: Xisco Fauli CommitDate: Mon Dec 11 14:11:57 2023 +0100 {bn-IN}{hi-IN} MM-DD-YY DATE_TIME is very likely wrong, all other are DD-MM-YY Wrong since its initial commit. Change-Id: I75214226ef5e1e58798ca0eaf396bad590918ee5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160511 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit d48ad3187d82aca8d9c35c43698822865cad58a0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160570 Reviewed-by: Xisco Fauli diff --git a/i18npool/source/localedata/data/bn_IN.xml b/i18npool/source/localedata/data/bn_IN.xml index 7064336deb0a..7de868c0145e 100644 --- a/i18npool/source/localedata/data/bn_IN.xml +++ b/i18npool/source/localedata/data/bn_IN.xml @@ -192,13 +192,13 @@ [HH]:MM:SS.00 - MM-DD-YY HH:MM AM/PM + DD-MM-YY HH:MM AM/PM - MM-DD- HH:MM:SS + DD-MM- HH:MM:SS - MM-DD- HH:MM + DD-MM- HH:MM diff --git a/i18npool/source/localedata/data/hi_IN.xml b/i18npool/source/localedata/data/hi_IN.xml index 33d27757dd3d..150dbce6e729 100644 --- a/i18npool/source/localedata/data/hi_IN.xml +++ b/i18npool/source/localedata/data/hi_IN.xml @@ -190,13 +190,13 @@ [HH]:MM:SS.00 - MM-DD-YY HH:MM + DD-MM-YY HH:MM - MM-DD- HH:MM:SS + DD-MM- HH:MM:SS - MM-DD- HH:MM + DD-MM- HH:MM
core.git: i18npool/source
i18npool/source/localedata/data/bn_IN.xml |6 +++--- i18npool/source/localedata/data/hi_IN.xml |6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) New commits: commit d48ad3187d82aca8d9c35c43698822865cad58a0 Author: Eike Rathke AuthorDate: Sat Dec 9 12:33:19 2023 +0100 Commit: Eike Rathke CommitDate: Sat Dec 9 17:19:32 2023 +0100 {bn-IN}{hi-IN} MM-DD-YY DATE_TIME is very likely wrong, all other are DD-MM-YY Wrong since its initial commit. Change-Id: I75214226ef5e1e58798ca0eaf396bad590918ee5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160511 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/source/localedata/data/bn_IN.xml b/i18npool/source/localedata/data/bn_IN.xml index 7064336deb0a..7de868c0145e 100644 --- a/i18npool/source/localedata/data/bn_IN.xml +++ b/i18npool/source/localedata/data/bn_IN.xml @@ -192,13 +192,13 @@ [HH]:MM:SS.00 - MM-DD-YY HH:MM AM/PM + DD-MM-YY HH:MM AM/PM - MM-DD- HH:MM:SS + DD-MM- HH:MM:SS - MM-DD- HH:MM + DD-MM- HH:MM diff --git a/i18npool/source/localedata/data/hi_IN.xml b/i18npool/source/localedata/data/hi_IN.xml index 33d27757dd3d..150dbce6e729 100644 --- a/i18npool/source/localedata/data/hi_IN.xml +++ b/i18npool/source/localedata/data/hi_IN.xml @@ -190,13 +190,13 @@ [HH]:MM:SS.00 - MM-DD-YY HH:MM + DD-MM-YY HH:MM - MM-DD- HH:MM:SS + DD-MM- HH:MM:SS - MM-DD- HH:MM + DD-MM- HH:MM
core.git: include/systools
include/systools/curlinit.hxx|2 ++ include/systools/opensslinit.hxx |4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) New commits: commit 7b2166c8217cb32f2f7951f074e33d9fe890bb9b Author: Eike Rathke AuthorDate: Sat Dec 9 11:44:43 2023 +0100 Commit: Eike Rathke CommitDate: Sat Dec 9 12:50:32 2023 +0100 Fix build --with-system-openssl but --without-system-curl Change-Id: I60e2e995a159ebbbdc0991204d765b5654d5a4fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160510 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/include/systools/curlinit.hxx b/include/systools/curlinit.hxx index bf2899ee1e23..d03c620a3c75 100644 --- a/include/systools/curlinit.hxx +++ b/include/systools/curlinit.hxx @@ -16,7 +16,9 @@ #if defined(LINUX) && !defined(SYSTEM_CURL) #include +#define LO_CURL_NEEDS_CA_BUNDLE #include "opensslinit.hxx" +#undef LO_CURL_NEEDS_CA_BUNDLE #endif #include diff --git a/include/systools/opensslinit.hxx b/include/systools/opensslinit.hxx index 9c3f4c860895..04f38faa0821 100644 --- a/include/systools/opensslinit.hxx +++ b/include/systools/opensslinit.hxx @@ -11,7 +11,9 @@ #include -#if defined(LINUX) && !defined(SYSTEM_OPENSSL) +// Also include/systools/curlinit.hxx needs GetCABundleFile() if +// !defined(SYSTEM_CURL) it defines LO_CURL_NEEDS_CA_BUNDLE. +#if defined(LINUX) && (!defined(SYSTEM_OPENSSL) || defined(LO_CURL_NEEDS_CA_BUNDLE)) #include #include
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/core/tool/refupdat.cxx | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) New commits: commit c0b46a8270507dc59b731e9c996960374b0db472 Author: Eike Rathke AuthorDate: Tue Dec 5 20:58:49 2023 +0100 Commit: Xisco Fauli CommitDate: Wed Dec 6 09:27:36 2023 +0100 Resolves: tdf#158223 Revert "fix" for tdf#156174 and follow-up ... introducing a real fix. commit 94ca402cd1fe2fd9776d08448f7216b7f638e69a CommitDate: Tue Jul 25 15:04:01 2023 +0200 tdf#156174 sc DBData: fix regression of database ranges just cured a symptom by removing a condition that shouldn't had been removed, instead of getting to the real cause of an odd reference update. Shrinking the end of a sheet reference range and thus moving it one before the previously referenced relative position is only possible if the deleted sheet actually touches the referenced range, which here the start value points to and thus checking ref>=start+delta is not necessary and subtracting 1 even harms. This is different from deleting columns or rows where the start value points behind the deleted area of moving the following area. Change-Id: If9ae5dd6f6ae5cd248ad5d999f1aa7577d4ec035 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160374 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit ec165d6fe3784f5cd78351a537abf69e88b68420) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160354 Reviewed-by: Xisco Fauli diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index e05a14d0137f..95f738c4ed84 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -25,12 +25,12 @@ #include template< typename R, typename S, typename U > -static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask ) +static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask, bool bShrink = true ) { bool bCut = false; if ( rRef >= nStart ) rRef = sal::static_int_cast( rRef + nDelta ); -else if ( nDelta < 0 && rRef >= nStart + nDelta ) +else if ( nDelta < 0 && bShrink && rRef >= nStart + nDelta ) rRef = nStart + nDelta; //TODO: limit ??? if ( rRef < 0 ) { @@ -46,12 +46,12 @@ static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask ) } template< typename R, typename S, typename U > -static bool lcl_MoveEnd( R& rRef, U nStart, S nDelta, U nMask ) +static bool lcl_MoveEnd( R& rRef, U nStart, S nDelta, U nMask, bool bShrink = true ) { bool bCut = false; if ( rRef >= nStart ) rRef = sal::static_int_cast( rRef + nDelta ); -else if ( nDelta < 0 && rRef >= nStart + nDelta ) +else if ( nDelta < 0 && bShrink && rRef >= nStart + nDelta ) rRef = nStart + nDelta - 1; //TODO: limit ??? if (rRef < 0) { @@ -284,9 +284,14 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, UpdateRefMode eUpdat SCTAB nMaxTab = pDoc->GetTableCount() - 1; nMaxTab = sal::static_int_cast(nMaxTab + nDz); // adjust to new count bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz )); -bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab ); -bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab ); -if ( bCut1 || bCut2 ) +bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab, false /*bShrink*/); +bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab, false /*bShrink*/); +if ( theTab2 < theTab1 ) +{ +eRet = UR_INVALID; +theTab2 = theTab1; +} +else if ( bCut1 || bCut2 ) eRet = UR_UPDATED; if ( bExp ) {
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/refupdat.cxx | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) New commits: commit f35b540279b00575ff79eda1c65fb0f8caad86bf Author: Eike Rathke AuthorDate: Tue Dec 5 20:58:49 2023 +0100 Commit: Eike Rathke CommitDate: Tue Dec 5 22:40:50 2023 +0100 Resolves: tdf#158223 Revert "fix" for tdf#156174 and follow-up ... introducing a real fix. commit 94ca402cd1fe2fd9776d08448f7216b7f638e69a CommitDate: Tue Jul 25 15:04:01 2023 +0200 tdf#156174 sc DBData: fix regression of database ranges just cured a symptom by removing a condition that shouldn't had been removed, instead of getting to the real cause of an odd reference update. Shrinking the end of a sheet reference range and thus moving it one before the previously referenced relative position is only possible if the deleted sheet actually touches the referenced range, which here the start value points to and thus checking ref>=start+delta is not necessary and subtracting 1 even harms. This is different from deleting columns or rows where the start value points behind the deleted area of moving the following area. Change-Id: If9ae5dd6f6ae5cd248ad5d999f1aa7577d4ec035 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160374 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index e05a14d0137f..95f738c4ed84 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -25,12 +25,12 @@ #include template< typename R, typename S, typename U > -static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask ) +static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask, bool bShrink = true ) { bool bCut = false; if ( rRef >= nStart ) rRef = sal::static_int_cast( rRef + nDelta ); -else if ( nDelta < 0 && rRef >= nStart + nDelta ) +else if ( nDelta < 0 && bShrink && rRef >= nStart + nDelta ) rRef = nStart + nDelta; //TODO: limit ??? if ( rRef < 0 ) { @@ -46,12 +46,12 @@ static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask ) } template< typename R, typename S, typename U > -static bool lcl_MoveEnd( R& rRef, U nStart, S nDelta, U nMask ) +static bool lcl_MoveEnd( R& rRef, U nStart, S nDelta, U nMask, bool bShrink = true ) { bool bCut = false; if ( rRef >= nStart ) rRef = sal::static_int_cast( rRef + nDelta ); -else if ( nDelta < 0 && rRef >= nStart + nDelta ) +else if ( nDelta < 0 && bShrink && rRef >= nStart + nDelta ) rRef = nStart + nDelta - 1; //TODO: limit ??? if (rRef < 0) { @@ -284,9 +284,14 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, UpdateRefMode eUpdat SCTAB nMaxTab = pDoc->GetTableCount() - 1; nMaxTab = sal::static_int_cast(nMaxTab + nDz); // adjust to new count bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz )); -bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab ); -bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab ); -if ( bCut1 || bCut2 ) +bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab, false /*bShrink*/); +bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab, false /*bShrink*/); +if ( theTab2 < theTab1 ) +{ +eRet = UR_INVALID; +theTab2 = theTab1; +} +else if ( bCut1 || bCut2 ) eRet = UR_UPDATED; if ( bExp ) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - xmloff/source
xmloff/source/core/xmluconv.cxx | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) New commits: commit 7d79afebef281657a58cba065af0c5ba79a4e9e1 Author: Eike Rathke AuthorDate: Wed Nov 29 19:11:22 2023 +0100 Commit: Xisco Fauli CommitDate: Thu Nov 30 13:07:05 2023 +0100 Resolves: tdf#158265 Store more than 100th seconds precision in date+time e.g. office:date-value Change-Id: I9bb4b589cdb8c6f04fa39ba7ec4254207eaa3663 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160124 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 1627271703a39aad92cc5d5f5bfd75a8d7ab3d2b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160040 Reviewed-by: Michael Stahl diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index a95de5ecb66c..544bea50d3c5 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -61,7 +61,6 @@ using namespace ::com::sun::star::i18n; using namespace ::xmloff::token; -const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11; constexpr OUStringLiteral XML_NULLDATE = u"NullDate"; struct SvXMLUnitConverter::Impl @@ -444,6 +443,16 @@ void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer, else fCount = 0.0; const int nDigits = sal_Int16(fCount) + 4; // +4 for *86400 in seconds + +// Since the beginning from initial source code import this was 11 without +// further explanation, effectively limiting fractions in ~current +// date+time to 2 decimals (maybe because old class Time code had a +// resolution of only 100th seconds). Preserve at least milliseconds, but +// strive for more. +// NOTE: sax/source/tools/converter.cxx uses 14-5 in a different context +// rounding nanoseconds and fractions of seconds. +constexpr int XML_MAXDIGITSCOUNT_TIME = 14; + const int nFractionDecimals = std::max( XML_MAXDIGITSCOUNT_TIME - nDigits, 0); sal_uInt16 nHour, nMinute, nSecond;
[Libreoffice-commits] core.git: xmloff/source
xmloff/source/core/xmluconv.cxx | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) New commits: commit 0c3f57487c9cc29d172121b178938cdb2a8adc7b Author: Eike Rathke AuthorDate: Wed Nov 29 19:11:22 2023 +0100 Commit: Eike Rathke CommitDate: Wed Nov 29 23:56:53 2023 +0100 Resolves: tdf#158265 Store more than 100th seconds precision in date+time e.g. office:date-value Change-Id: I9bb4b589cdb8c6f04fa39ba7ec4254207eaa3663 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160124 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index a95de5ecb66c..544bea50d3c5 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -61,7 +61,6 @@ using namespace ::com::sun::star::i18n; using namespace ::xmloff::token; -const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11; constexpr OUStringLiteral XML_NULLDATE = u"NullDate"; struct SvXMLUnitConverter::Impl @@ -444,6 +443,16 @@ void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer, else fCount = 0.0; const int nDigits = sal_Int16(fCount) + 4; // +4 for *86400 in seconds + +// Since the beginning from initial source code import this was 11 without +// further explanation, effectively limiting fractions in ~current +// date+time to 2 decimals (maybe because old class Time code had a +// resolution of only 100th seconds). Preserve at least milliseconds, but +// strive for more. +// NOTE: sax/source/tools/converter.cxx uses 14-5 in a different context +// rounding nanoseconds and fractions of seconds. +constexpr int XML_MAXDIGITSCOUNT_TIME = 14; + const int nFractionDecimals = std::max( XML_MAXDIGITSCOUNT_TIME - nDigits, 0); sal_uInt16 nHour, nMinute, nSecond;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/tools sc/source
include/tools/duration.hxx |8 +++- sc/source/core/tool/interpr5.cxx |9 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) New commits: commit 4582516259812aa1ca8ae95e0bdaae08d0b88f0c Author: Eike Rathke AuthorDate: Mon Nov 13 14:26:38 2023 +0100 Commit: Michael Stahl CommitDate: Wed Nov 15 10:54:32 2023 +0100 Resolves: tdf#125580 Limit operator +|- date+time resolution to microseconds This is a combination of 2 commits. Resolves: tdf#125580 Limit operator +|- date+time resolution to microseconds With tools::Duration that is now finally easily possible. xChange-Id: Ib22e6f94d321be78578997bef5094284f2bd549b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159378 Reviewed-by: Eike Rathke Tested-by: Eike Rathke Related: tdf#125580 Use tools::Duration constexpr accuracy epsilon values xChange-Id: I8f83c23206686ce23fb3f8be7d7098bbe252dc41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159388 Reviewed-by: Eike Rathke Tested-by: Jenkins Change-Id: Ib22e6f94d321be78578997bef5094284f2bd549b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159393 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx index 9fae80d1d7c9..9f032539e142 100644 --- a/include/tools/duration.hxx +++ b/include/tools/duration.hxx @@ -31,8 +31,13 @@ public: minutes and seconds values here though. */ Duration(const Time& rStart, const Time& rEnd); +constexpr static sal_uInt64 kAccuracyEpsilonNanoseconds = 300; +constexpr static sal_uInt64 kAccuracyEpsilonNanosecondsMicroseconds = 999; + /** Difference in days, like DateTime()-DateTime(). +Can also be used to round a date+time value to, for example, microseconds. + @param nAccuracyEpsilonNanoseconds Round for example by 1 nanosecond if it's just 1 off to a second, i.e. 09 or 01. This can be loosened if @@ -41,7 +46,8 @@ public: accuracy epsilon (=unsharpness) of ~300 is required. Hence default. Must be 0 <= nAccuracyEpsilonNanoseconds <= Time::nanoSecPerSec - 1. */ -explicit Duration(double fTimeInDays, sal_uInt64 nAccuracyEpsilonNanoseconds = 300); +explicit Duration(double fTimeInDays, + sal_uInt64 nAccuracyEpsilonNanoseconds = kAccuracyEpsilonNanoseconds); /** Time can be a limited duration as well and can have out-of-range values, it will be normalized. Sign of both days and Time must be equal diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index dcb5ee6ea343..ae499ec492d1 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1342,10 +1342,15 @@ void ScInterpreter::CalculateAddSub(bool _bSub) && ((_bSub && std::fabs(fVal1 - fVal2) <= SAL_MAX_INT32) || (!_bSub && std::fabs(fVal1 + fVal2) <= SAL_MAX_INT32))) { +// Limit to microseconds resolution on date inflicted or duration +// values of 24 hours or more. +const sal_uInt64 nEpsilon = ((std::fabs(fVal1) >= 1.0 || std::fabs(fVal2) >= 1.0) ? +::tools::Duration::kAccuracyEpsilonNanosecondsMicroseconds : +::tools::Duration::kAccuracyEpsilonNanoseconds); if (_bSub) -PushDouble( ::tools::Duration( fVal1 - fVal2).GetInDays()); +PushDouble( ::tools::Duration( fVal1 - fVal2, nEpsilon).GetInDays()); else -PushDouble( ::tools::Duration( fVal1 + fVal2).GetInDays()); +PushDouble( ::tools::Duration( fVal1 + fVal2, nEpsilon).GetInDays()); } else {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/core/tool/interpr2.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 7bc797fc5715dfd291554d84ba5fd821e9f30426 Author: Eike Rathke AuthorDate: Mon Nov 13 17:08:13 2023 +0100 Commit: Michael Stahl CommitDate: Tue Nov 14 11:13:06 2023 +0100 Resolves: tdf#127498 Force corrected TIMEVALUE() result Change-Id: I750a3251c3cf5e8cad4a37c7c4b646c0457f2dbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159389 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit c5a49da6ddec01d0ef8f53dd92983cf6ebc7bad0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159246 Reviewed-by: Michael Stahl diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 67ec57fef9ab..12a48078440b 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -922,6 +923,7 @@ void ScInterpreter::ScGetTimeValue() nFuncFmtType = SvNumFormatType::TIME; double fDateVal = rtl::math::approxFloor(fVal); double fTimeVal = fVal - fDateVal; +fTimeVal = ::tools::Duration(fTimeVal).GetInDays(); // force corrected PushDouble(fTimeVal); } else
[Libreoffice-commits] core.git: 2 commits - include/tools sc/source
include/tools/duration.hxx |8 +++- sc/source/core/tool/interpr5.cxx |9 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) New commits: commit d646341e5ddc625d9cf69777b4be174aebb43700 Author: Eike Rathke AuthorDate: Mon Nov 13 16:26:05 2023 +0100 Commit: Eike Rathke CommitDate: Mon Nov 13 19:37:49 2023 +0100 Related: tdf#125580 Use tools::Duration constexpr accuracy epsilon values Change-Id: I8f83c23206686ce23fb3f8be7d7098bbe252dc41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159388 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx index 9fae80d1d7c9..9f032539e142 100644 --- a/include/tools/duration.hxx +++ b/include/tools/duration.hxx @@ -31,8 +31,13 @@ public: minutes and seconds values here though. */ Duration(const Time& rStart, const Time& rEnd); +constexpr static sal_uInt64 kAccuracyEpsilonNanoseconds = 300; +constexpr static sal_uInt64 kAccuracyEpsilonNanosecondsMicroseconds = 999; + /** Difference in days, like DateTime()-DateTime(). +Can also be used to round a date+time value to, for example, microseconds. + @param nAccuracyEpsilonNanoseconds Round for example by 1 nanosecond if it's just 1 off to a second, i.e. 09 or 01. This can be loosened if @@ -41,7 +46,8 @@ public: accuracy epsilon (=unsharpness) of ~300 is required. Hence default. Must be 0 <= nAccuracyEpsilonNanoseconds <= Time::nanoSecPerSec - 1. */ -explicit Duration(double fTimeInDays, sal_uInt64 nAccuracyEpsilonNanoseconds = 300); +explicit Duration(double fTimeInDays, + sal_uInt64 nAccuracyEpsilonNanoseconds = kAccuracyEpsilonNanoseconds); /** Time can be a limited duration as well and can have out-of-range values, it will be normalized. Sign of both days and Time must be equal diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 90015018eec6..ae499ec492d1 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1344,7 +1344,9 @@ void ScInterpreter::CalculateAddSub(bool _bSub) { // Limit to microseconds resolution on date inflicted or duration // values of 24 hours or more. -const sal_uInt64 nEpsilon = ((std::fabs(fVal1) >= 1.0 || std::fabs(fVal2) >= 1.0) ? 999 : 300); +const sal_uInt64 nEpsilon = ((std::fabs(fVal1) >= 1.0 || std::fabs(fVal2) >= 1.0) ? +::tools::Duration::kAccuracyEpsilonNanosecondsMicroseconds : +::tools::Duration::kAccuracyEpsilonNanoseconds); if (_bSub) PushDouble( ::tools::Duration( fVal1 - fVal2, nEpsilon).GetInDays()); else commit 007e9e46d936ad7631792188168dffec7051b27f Author: Eike Rathke AuthorDate: Mon Nov 13 14:26:38 2023 +0100 Commit: Eike Rathke CommitDate: Mon Nov 13 19:37:35 2023 +0100 Resolves: tdf#125580 Limit operator +|- date+time resolution to microseconds With tools::Duration that is now finally easily possible. Change-Id: Ib22e6f94d321be78578997bef5094284f2bd549b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159378 Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index dcb5ee6ea343..90015018eec6 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1342,10 +1342,13 @@ void ScInterpreter::CalculateAddSub(bool _bSub) && ((_bSub && std::fabs(fVal1 - fVal2) <= SAL_MAX_INT32) || (!_bSub && std::fabs(fVal1 + fVal2) <= SAL_MAX_INT32))) { +// Limit to microseconds resolution on date inflicted or duration +// values of 24 hours or more. +const sal_uInt64 nEpsilon = ((std::fabs(fVal1) >= 1.0 || std::fabs(fVal2) >= 1.0) ? 999 : 300); if (_bSub) -PushDouble( ::tools::Duration( fVal1 - fVal2).GetInDays()); +PushDouble( ::tools::Duration( fVal1 - fVal2, nEpsilon).GetInDays()); else -PushDouble( ::tools::Duration( fVal1 + fVal2).GetInDays()); +PushDouble( ::tools::Duration( fVal1 + fVal2, nEpsilon).GetInDays()); } else {
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/interpr2.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 61d5f971496cb0091f9b37aaafcb87694f3810ea Author: Eike Rathke AuthorDate: Mon Nov 13 17:08:13 2023 +0100 Commit: Eike Rathke CommitDate: Mon Nov 13 19:31:38 2023 +0100 Resolves: tdf#127498 Force corrected TIMEVALUE() result Change-Id: I750a3251c3cf5e8cad4a37c7c4b646c0457f2dbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159389 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 8255fe7f76c1..61f88d638a00 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -923,6 +924,7 @@ void ScInterpreter::ScGetTimeValue() nFuncFmtType = SvNumFormatType::TIME; double fDateVal = rtl::math::approxFloor(fVal); double fTimeVal = fVal - fDateVal; +fTimeVal = ::tools::Duration(fTimeVal).GetInDays(); // force corrected PushDouble(fTimeVal); } else
[Libreoffice-commits] core.git: i18npool/source
i18npool/source/localedata/data/locale.dtd |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit f3811e06b27afcbac7f63c2d184db4b1f8b01a1f Author: Eike Rathke AuthorDate: Wed Nov 1 21:53:52 2023 +0100 Commit: Eike Rathke CommitDate: Thu Nov 2 02:03:38 2023 +0100 Update pointers to yet again moved ICU site / CLDR pages Change-Id: Icf33b45a013393ac114e5a8866921bc8ce368189 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158778 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/source/localedata/data/locale.dtd b/i18npool/source/localedata/data/locale.dtd index 616351e19f8f..81a8bdfbb35d 100644 --- a/i18npool/source/localedata/data/locale.dtd +++ b/i18npool/source/localedata/data/locale.dtd @@ -521,7 +521,7 @@ Optional ICU tailoring. See Collation Customization in ICU User Guide for syntax, - http://www.icu-project.org/userguide/Collate_Customization.html + https://unicode-org.github.io/icu/userguide/collation/customization/ There are two ways to add language specific tailoring in LibreOffice. For small tailoring, you can directly add it in locale data here. For @@ -560,9 +560,9 @@ The initial data was setup according to the ICU collation chart at http://oss.software.ibm.com/icu/charts/collation/ -Note: ICU site was moved to http://www.icu-project.org/ and as ICU per +Note: ICU site was moved to https://icu.unicode.org/ and as ICU per default uses CLDR, collation charts are available at -http://unicode.org/cldr/comparison_charts.html#Collation +https://www.unicode.org/cldr/charts/latest/ Possible notations in the syntax of the IndexKey element are:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/core/tool/interpr4.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 1ed6f4ba6fcae232705d005de6fcbdcc8769585f Author: Eike Rathke AuthorDate: Mon Oct 16 20:35:13 2023 +0200 Commit: Caolán McNamara CommitDate: Sat Oct 21 17:31:48 2023 +0200 Resolves: tdf#157797 Let GetCellValue() propagate previous error, if any Change-Id: I27ee8d19e4f45bef81e133c82ac17b825790208f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158064 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit aa2632885d8b169016ce8f888cc04796544213b0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158040 Reviewed-by: Caolán McNamara diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 45ae430f5025..29072181bd91 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -180,7 +180,9 @@ double ScInterpreter::GetCellValue( const ScAddress& rPos, ScRefCellValue& rCell FormulaError nErr = nGlobalError; nGlobalError = FormulaError::NONE; double nVal = GetCellValueOrZero(rPos, rCell); -if ( nGlobalError == FormulaError::NONE || nGlobalError == FormulaError::CellNoValue ) +// Propagate previous error, if any; nGlobalError==CellNoValue is not an +// error here, preserve previous error or non-error. +if (nErr != FormulaError::NONE || nGlobalError == FormulaError::CellNoValue) nGlobalError = nErr; return nVal; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/core/inc/interpre.hxx |2 ++ sc/source/core/tool/interpr2.cxx | 24 sc/source/core/tool/interpr4.cxx | 17 + 3 files changed, 31 insertions(+), 12 deletions(-) New commits: commit 030c77d3e048a5235691db316e614ce3335037fe Author: Eike Rathke AuthorDate: Mon Oct 16 13:51:28 2023 +0200 Commit: Xisco Fauli CommitDate: Tue Oct 17 08:55:42 2023 +0200 Resolves: tdf#157786 Use GetFloor32() for date days instead of GetInt32() Change-Id: I1d6242b516f4b23473151bb99cbdf1a057a15746 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158029 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit a5d263d3deca6315f9128bc785e9fb6cb2e697f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158039 Reviewed-by: Xisco Fauli diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 5897a6b6c757..64b9a8ae5b2c 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -427,6 +427,8 @@ private: sal_Int32 GetInt32(); /** if GetDoubleWithDefault() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */ sal_Int32 GetInt32WithDefault( sal_Int32 nDefault ); +/** if GetDouble() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */ +sal_Int32 GetFloor32(); /** if GetDouble() not within int16 limits sets nGlobalError and returns SAL_MAX_INT16 */ sal_Int16 GetInt16(); /** if GetDouble() not within uint32 limits sets nGlobalError and returns SAL_MAX_UINT32 */ diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 60bde22f534b..67ec57fef9ab 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -121,21 +121,21 @@ void ScInterpreter::ScGetActTime() void ScInterpreter::ScGetYear() { Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushDouble( static_cast(aDate.GetYear()) ); } void ScInterpreter::ScGetMonth() { Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushDouble( static_cast(aDate.GetMonth()) ); } void ScInterpreter::ScGetDay() { Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushDouble(static_cast(aDate.GetDay())); } @@ -199,7 +199,7 @@ void ScInterpreter::ScGetDayOfWeek() nFlag = 1; Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); int nVal = static_cast(aDate.GetDayOfWeek()); // MONDAY = 0 switch (nFlag) { @@ -240,7 +240,7 @@ void ScInterpreter::ScWeeknumOOo() sal_Int16 nFlag = GetInt16(); Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushInt( static_cast(aDate.GetWeekOfYear( nFlag == 1 ? SUNDAY : MONDAY ))); } } @@ -254,7 +254,7 @@ void ScInterpreter::ScGetWeekOfYear() sal_Int16 nFlag = ( nParamCount == 1 ) ? 1 : GetInt16(); Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); sal_Int32 nMinimumNumberOfDaysInWeek; DayOfWeek eFirstDayOfWeek; @@ -296,7 +296,7 @@ void ScInterpreter::ScGetIsoWeekOfYear() if ( MustHaveParamCount( GetByte(), 1 ) ) { Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushInt( static_cast(aDate.GetWeekOfYear()) ); } } @@ -571,7 +571,7 @@ void ScInterpreter::ScWorkday_MS() PushError( nErr ); else { -sal_Int32 nDays = GetInt32(); +sal_Int32 nDays = GetFloor32(); sal_uInt32 nDate = GetUInt32(); if (nGlobalError != FormulaError::NONE || (nDate > SAL_MAX_UINT32 - nNullDate)) { @@ -701,8 +701,8 @@ void ScInterpreter::ScGetDiffDate360() return; bool bFlag = nParamCount == 3 && GetBool(); -sal_Int32 nDate2 = GetInt32(); -sal_Int32 nDate1 = GetInt32(); +sal_Int32 nDate2 = GetFloor32(); +sal_Int32 nDate1 = GetFloor32(); if (nGlobalError != FormulaError::NONE) PushError( nGlobalError); else @@ -766,8 +766,8 @@ void ScInterpreter::ScGetDateDif() return; OUString aInterval = GetString().getString(); -sal_Int32 nDate2 = GetInt32(); -sal_Int32 nDate1 = GetInt32(); +sal_Int32 nDate2 = GetFloor32(); +sal_Int32 nDate1 = GetFloor32(); if (nGlobalError != FormulaError::NONE) { diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 97c3d06cdf49..45ae430f5025 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2217,6 +2217,23 @@ sal_Int32 ScInterpreter::GetInt32WithDefault( sal_Int32 nDefault )
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/interpr4.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 3161a6c351a2f5f70c0420ee8cccf2eb23de1ecf Author: Eike Rathke AuthorDate: Mon Oct 16 20:35:13 2023 +0200 Commit: Eike Rathke CommitDate: Mon Oct 16 23:35:02 2023 +0200 Resolves: tdf#157797 Let GetCellValue() propagate previous error, if any Change-Id: I27ee8d19e4f45bef81e133c82ac17b825790208f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158064 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 0ac2e151f5cc..95dff9f1cc18 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -181,7 +181,9 @@ double ScInterpreter::GetCellValue( const ScAddress& rPos, ScRefCellValue& rCell FormulaError nErr = nGlobalError; nGlobalError = FormulaError::NONE; double nVal = GetCellValueOrZero(rPos, rCell); -if ( nGlobalError == FormulaError::NONE || nGlobalError == FormulaError::CellNoValue ) +// Propagate previous error, if any; nGlobalError==CellNoValue is not an +// error here, preserve previous error or non-error. +if (nErr != FormulaError::NONE || nGlobalError == FormulaError::CellNoValue) nGlobalError = nErr; return nVal; }
[Libreoffice-commits] core.git: sc/source
sc/source/core/inc/interpre.hxx |2 ++ sc/source/core/tool/interpr2.cxx | 24 sc/source/core/tool/interpr4.cxx | 17 + 3 files changed, 31 insertions(+), 12 deletions(-) New commits: commit 2fa1cdcaeff7d1583aedfcee5b7c802e951b3a86 Author: Eike Rathke AuthorDate: Mon Oct 16 13:51:28 2023 +0200 Commit: Eike Rathke CommitDate: Mon Oct 16 16:31:32 2023 +0200 Resolves: tdf#157786 Use GetFloor32() for date days instead of GetInt32() Change-Id: I1d6242b516f4b23473151bb99cbdf1a057a15746 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158029 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 5897a6b6c757..64b9a8ae5b2c 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -427,6 +427,8 @@ private: sal_Int32 GetInt32(); /** if GetDoubleWithDefault() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */ sal_Int32 GetInt32WithDefault( sal_Int32 nDefault ); +/** if GetDouble() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32 */ +sal_Int32 GetFloor32(); /** if GetDouble() not within int16 limits sets nGlobalError and returns SAL_MAX_INT16 */ sal_Int16 GetInt16(); /** if GetDouble() not within uint32 limits sets nGlobalError and returns SAL_MAX_UINT32 */ diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index a6753a4aa78b..8255fe7f76c1 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -122,21 +122,21 @@ void ScInterpreter::ScGetActTime() void ScInterpreter::ScGetYear() { Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushDouble( static_cast(aDate.GetYear()) ); } void ScInterpreter::ScGetMonth() { Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushDouble( static_cast(aDate.GetMonth()) ); } void ScInterpreter::ScGetDay() { Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushDouble(static_cast(aDate.GetDay())); } @@ -200,7 +200,7 @@ void ScInterpreter::ScGetDayOfWeek() nFlag = 1; Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); int nVal = static_cast(aDate.GetDayOfWeek()); // MONDAY = 0 switch (nFlag) { @@ -241,7 +241,7 @@ void ScInterpreter::ScWeeknumOOo() sal_Int16 nFlag = GetInt16(); Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushInt( static_cast(aDate.GetWeekOfYear( nFlag == 1 ? SUNDAY : MONDAY ))); } } @@ -255,7 +255,7 @@ void ScInterpreter::ScGetWeekOfYear() sal_Int16 nFlag = ( nParamCount == 1 ) ? 1 : GetInt16(); Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); sal_Int32 nMinimumNumberOfDaysInWeek; DayOfWeek eFirstDayOfWeek; @@ -297,7 +297,7 @@ void ScInterpreter::ScGetIsoWeekOfYear() if ( MustHaveParamCount( GetByte(), 1 ) ) { Date aDate = pFormatter->GetNullDate(); -aDate.AddDays( GetInt32()); +aDate.AddDays( GetFloor32()); PushInt( static_cast(aDate.GetWeekOfYear()) ); } } @@ -572,7 +572,7 @@ void ScInterpreter::ScWorkday_MS() PushError( nErr ); else { -sal_Int32 nDays = GetInt32(); +sal_Int32 nDays = GetFloor32(); sal_uInt32 nDate = GetUInt32(); if (nGlobalError != FormulaError::NONE || (nDate > SAL_MAX_UINT32 - nNullDate)) { @@ -702,8 +702,8 @@ void ScInterpreter::ScGetDiffDate360() return; bool bFlag = nParamCount == 3 && GetBool(); -sal_Int32 nDate2 = GetInt32(); -sal_Int32 nDate1 = GetInt32(); +sal_Int32 nDate2 = GetFloor32(); +sal_Int32 nDate1 = GetFloor32(); if (nGlobalError != FormulaError::NONE) PushError( nGlobalError); else @@ -767,8 +767,8 @@ void ScInterpreter::ScGetDateDif() return; OUString aInterval = GetString().getString(); -sal_Int32 nDate2 = GetInt32(); -sal_Int32 nDate1 = GetInt32(); +sal_Int32 nDate2 = GetFloor32(); +sal_Int32 nDate1 = GetFloor32(); if (nGlobalError != FormulaError::NONE) { diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index c40c111f226e..0ac2e151f5cc 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2227,6 +2227,23 @@ sal_Int32 ScInterpreter::GetInt32WithDefault( sal_Int32 nDefault ) return double_to_int32(fVal); } +sal_Int32 ScInterpreter::GetFloor32() +{ +double fVal = GetDouble(); +if (!std::isfinite(fVal)) +{ +SetError(
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5-8' - sc/inc sc/source
sc/inc/arraysumfunctor.hxx | 17 - sc/inc/kahan.hxx | 66 +-- sc/source/core/tool/arraysum.hxx | 36 --- sc/source/core/tool/arraysumSSE2.cxx |6 +-- 4 files changed, 50 insertions(+), 75 deletions(-) New commits: commit d9db92481aa8bb98122729acf1d5759e510479d7 Author: Eike Rathke AuthorDate: Sun Oct 15 17:29:01 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Oct 16 14:11:14 2023 +0200 Follow-up: tdf#156985 Use SC_USE_SSE2 to determine which KahanSum::add() to use Also, the CPU identifier for MSVC WIN32 is not X86 but INTEL, so actually use SSE2 there as well, which was the cause of things failing on that platform. For other platforms than Intel x86/x86_64 SSE2 is not defined, so exclude the new unit test based on that and live on with the old slightly off value. Experiments did not yield any solution that works, even using plain sumNeumaierNormal() (similar to SSE2) in the executeUnrolled() case instead of KahanSum with its m_fMem did not help, nor trying to add the internal values in different orders or with long double, au contraire the error was slightly larger. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156899 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 361c4f008e48b08df635839d2e5dcad7389df44a) Conflicts: sc/qa/unit/ucalc_formula2.cxx Change-Id: Ica0b2963f76c01f248799e9a809ef06eb099e722 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157965 Reviewed-by: Stephan Bergmann Reviewed-by: Michael Stahl Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index c261c120addf..c1eabb220e27 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -12,29 +12,12 @@ #include #include "kahan.hxx" -#include "arraysumfunctor.hxx" #include namespace sc::op { -// Checkout available optimization options. -// Note that it turned out to be problematic to support CPU-specific code -// that's not guaranteed to be available on that specific platform (see -// git history). SSE2 is guaranteed on x86_64 and it is our baseline requirement -// for x86 on Windows, so SSE2 use is hardcoded on those platforms. -// Whenever we raise baseline to e.g. AVX, this may get -// replaced with AVX code (get it from git history). -// Do it similarly with other platforms. -#if defined(X86_64) || (defined(X86) && defined(_WIN32)) -#define SC_USE_SSE2 1 -KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); -#else -#define SC_USE_SSE2 0 -#endif - /** * If no boosts available, Unrolled KahanSum. - * Most likely to use on android. */ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pCurrent) { diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index ac97ae4394fa..03b05c25aa6b 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -12,6 +12,26 @@ #include #include +class KahanSum; +namespace sc::op +{ +// Checkout available optimization options. +// Note that it turned out to be problematic to support CPU-specific code +// that's not guaranteed to be available on that specific platform (see +// git commit 2d36e7f5186ba5215f2b228b98c24520bd4f2882). SSE2 is guaranteed on +// x86_64 and it is our baseline requirement for x86 on Windows, so SSE2 use is +// hardcoded on those platforms. +// Whenever we raise baseline to e.g. AVX, this may get +// replaced with AVX code (get it from mentioned git commit). +// Do it similarly with other platforms. +#if defined(X86_64) || (defined(INTEL) && defined(_WIN32)) +#define SC_USE_SSE2 1 +KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); +#else +#define SC_USE_SSE2 0 +#endif +} + /** * This class provides LO with Kahan summation algorithm * About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm @@ -41,6 +61,21 @@ public: constexpr KahanSum(const KahanSum& fSum) = default; public: +/** + * Performs one step of the Neumaier sum of doubles. + * Overwrites the summand and error. + * T could be double or long double. + */ +template static inline void sumNeumaierNormal(T& sum, T& err, const double& value) +{ +T t = sum + value; +if (std::abs(sum) >= std::abs(value)) +err += (sum - t) + value; +else +err += (value - t) + sum; +sum = t; +} + /** * Adds a value to the sum using Kahan summation. * @param x_i @@ -71,32 +106,27 @@ public: */ inline void add(const KahanSum& fSum) { -#ifdef _WIN32 -// For some odd unknown reason WIN32 fails badly with the -// sum+compensation value. Continue keeping the old though slightly off -// (see tdf#156985) explicit addition of the
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/inc sc/source
sc/inc/arraysumfunctor.hxx | 17 - sc/inc/kahan.hxx | 66 +-- sc/source/core/tool/arraysum.hxx | 36 --- sc/source/core/tool/arraysumSSE2.cxx |6 +-- 4 files changed, 50 insertions(+), 75 deletions(-) New commits: commit 342ba2605f84279f5dd58b8227e73d75e3b9d462 Author: Eike Rathke AuthorDate: Sun Oct 15 17:29:01 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Oct 16 11:39:59 2023 +0200 Follow-up: tdf#156985 Use SC_USE_SSE2 to determine which KahanSum::add() to use Also, the CPU identifier for MSVC WIN32 is not X86 but INTEL, so actually use SSE2 there as well, which was the cause of things failing on that platform. For other platforms than Intel x86/x86_64 SSE2 is not defined, so exclude the new unit test based on that and live on with the old slightly off value. Experiments did not yield any solution that works, even using plain sumNeumaierNormal() (similar to SSE2) in the executeUnrolled() case instead of KahanSum with its m_fMem did not help, nor trying to add the internal values in different orders or with long double, au contraire the error was slightly larger. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156899 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 361c4f008e48b08df635839d2e5dcad7389df44a) Conflicts: sc/qa/unit/ucalc_formula2.cxx Change-Id: Ica0b2963f76c01f248799e9a809ef06eb099e722 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157964 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index c261c120addf..c1eabb220e27 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -12,29 +12,12 @@ #include #include "kahan.hxx" -#include "arraysumfunctor.hxx" #include namespace sc::op { -// Checkout available optimization options. -// Note that it turned out to be problematic to support CPU-specific code -// that's not guaranteed to be available on that specific platform (see -// git history). SSE2 is guaranteed on x86_64 and it is our baseline requirement -// for x86 on Windows, so SSE2 use is hardcoded on those platforms. -// Whenever we raise baseline to e.g. AVX, this may get -// replaced with AVX code (get it from git history). -// Do it similarly with other platforms. -#if defined(X86_64) || (defined(X86) && defined(_WIN32)) -#define SC_USE_SSE2 1 -KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); -#else -#define SC_USE_SSE2 0 -#endif - /** * If no boosts available, Unrolled KahanSum. - * Most likely to use on android. */ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pCurrent) { diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index ac97ae4394fa..03b05c25aa6b 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -12,6 +12,26 @@ #include #include +class KahanSum; +namespace sc::op +{ +// Checkout available optimization options. +// Note that it turned out to be problematic to support CPU-specific code +// that's not guaranteed to be available on that specific platform (see +// git commit 2d36e7f5186ba5215f2b228b98c24520bd4f2882). SSE2 is guaranteed on +// x86_64 and it is our baseline requirement for x86 on Windows, so SSE2 use is +// hardcoded on those platforms. +// Whenever we raise baseline to e.g. AVX, this may get +// replaced with AVX code (get it from mentioned git commit). +// Do it similarly with other platforms. +#if defined(X86_64) || (defined(INTEL) && defined(_WIN32)) +#define SC_USE_SSE2 1 +KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); +#else +#define SC_USE_SSE2 0 +#endif +} + /** * This class provides LO with Kahan summation algorithm * About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm @@ -41,6 +61,21 @@ public: constexpr KahanSum(const KahanSum& fSum) = default; public: +/** + * Performs one step of the Neumaier sum of doubles. + * Overwrites the summand and error. + * T could be double or long double. + */ +template static inline void sumNeumaierNormal(T& sum, T& err, const double& value) +{ +T t = sum + value; +if (std::abs(sum) >= std::abs(value)) +err += (sum - t) + value; +else +err += (value - t) + sum; +sum = t; +} + /** * Adds a value to the sum using Kahan summation. * @param x_i @@ -71,32 +106,27 @@ public: */ inline void add(const KahanSum& fSum) { -#ifdef _WIN32 -// For some odd unknown reason WIN32 fails badly with the -// sum+compensation value. Continue keeping the old though slightly off -// (see tdf#156985) explicit addition of the compensation value. -add(fSum.m_fSum); -add(fSum.m_fError);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/inc sc/source
sc/inc/arraysumfunctor.hxx | 17 - sc/inc/kahan.hxx | 66 +-- sc/source/core/tool/arraysum.hxx | 36 --- sc/source/core/tool/arraysumSSE2.cxx |6 +-- 4 files changed, 50 insertions(+), 75 deletions(-) New commits: commit d782e07cf1e326cbb26e8a2b4c26be3e48d9fea8 Author: Eike Rathke AuthorDate: Sun Oct 15 17:29:01 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Oct 16 11:39:38 2023 +0200 Follow-up: tdf#156985 Use SC_USE_SSE2 to determine which KahanSum::add() to use Also, the CPU identifier for MSVC WIN32 is not X86 but INTEL, so actually use SSE2 there as well, which was the cause of things failing on that platform. For other platforms than Intel x86/x86_64 SSE2 is not defined, so exclude the new unit test based on that and live on with the old slightly off value. Experiments did not yield any solution that works, even using plain sumNeumaierNormal() (similar to SSE2) in the executeUnrolled() case instead of KahanSum with its m_fMem did not help, nor trying to add the internal values in different orders or with long double, au contraire the error was slightly larger. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156899 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 361c4f008e48b08df635839d2e5dcad7389df44a) Conflicts: sc/qa/unit/ucalc_formula2.cxx Change-Id: Ica0b2963f76c01f248799e9a809ef06eb099e722 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157990 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index c261c120addf..c1eabb220e27 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -12,29 +12,12 @@ #include #include "kahan.hxx" -#include "arraysumfunctor.hxx" #include namespace sc::op { -// Checkout available optimization options. -// Note that it turned out to be problematic to support CPU-specific code -// that's not guaranteed to be available on that specific platform (see -// git history). SSE2 is guaranteed on x86_64 and it is our baseline requirement -// for x86 on Windows, so SSE2 use is hardcoded on those platforms. -// Whenever we raise baseline to e.g. AVX, this may get -// replaced with AVX code (get it from git history). -// Do it similarly with other platforms. -#if defined(X86_64) || (defined(X86) && defined(_WIN32)) -#define SC_USE_SSE2 1 -KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); -#else -#define SC_USE_SSE2 0 -#endif - /** * If no boosts available, Unrolled KahanSum. - * Most likely to use on android. */ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pCurrent) { diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index ac97ae4394fa..03b05c25aa6b 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -12,6 +12,26 @@ #include #include +class KahanSum; +namespace sc::op +{ +// Checkout available optimization options. +// Note that it turned out to be problematic to support CPU-specific code +// that's not guaranteed to be available on that specific platform (see +// git commit 2d36e7f5186ba5215f2b228b98c24520bd4f2882). SSE2 is guaranteed on +// x86_64 and it is our baseline requirement for x86 on Windows, so SSE2 use is +// hardcoded on those platforms. +// Whenever we raise baseline to e.g. AVX, this may get +// replaced with AVX code (get it from mentioned git commit). +// Do it similarly with other platforms. +#if defined(X86_64) || (defined(INTEL) && defined(_WIN32)) +#define SC_USE_SSE2 1 +KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); +#else +#define SC_USE_SSE2 0 +#endif +} + /** * This class provides LO with Kahan summation algorithm * About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm @@ -41,6 +61,21 @@ public: constexpr KahanSum(const KahanSum& fSum) = default; public: +/** + * Performs one step of the Neumaier sum of doubles. + * Overwrites the summand and error. + * T could be double or long double. + */ +template static inline void sumNeumaierNormal(T& sum, T& err, const double& value) +{ +T t = sum + value; +if (std::abs(sum) >= std::abs(value)) +err += (sum - t) + value; +else +err += (value - t) + sum; +sum = t; +} + /** * Adds a value to the sum using Kahan summation. * @param x_i @@ -71,32 +106,27 @@ public: */ inline void add(const KahanSum& fSum) { -#ifdef _WIN32 -// For some odd unknown reason WIN32 fails badly with the -// sum+compensation value. Continue keeping the old though slightly off -// (see tdf#156985) explicit addition of the compensation value. -add(fSum.m_fSum); -add(fSum.m_fError);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - download.lst
download.lst |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 772f747667d6bf0aff5dc9267cb4e8c004a133b1 Author: Eike Rathke AuthorDate: Fri Oct 13 17:35:38 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Oct 16 11:16:47 2023 +0200 Update language-subtag-registry to 2023-08-02 Change-Id: I61e7e6c0a7010ff6f8db61a72b57a57de3e61c74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157943 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 234da25e9134c99cad0d825e0f99890b64d45859) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157955 Reviewed-by: Xisco Fauli diff --git a/download.lst b/download.lst index 3e5944f85423..09c449b11a92 100644 --- a/download.lst +++ b/download.lst @@ -279,8 +279,8 @@ LIBJPEG_TURBO_TARBALL := libjpeg-turbo-2.1.5.1.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -LANGTAGREG_SHA256SUM := 9042b64cd473bf36073513b474046f13778107b57c2ac47fb2633104120d69da -LANGTAGREG_TARBALL := language-subtag-registry-2023-05-11.tar.bz2 +LANGTAGREG_SHA256SUM := 59fdc026b5088e7947e1e6add482d2a40e1f7e25c50f198b456954216462c2eb +LANGTAGREG_TARBALL := language-subtag-registry-2023-08-02.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts
[Libreoffice-commits] core.git: sc/inc
sc/inc/kahan.hxx |7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) New commits: commit c25eaf109a64ae90473b09134540832dafa936c3 Author: Eike Rathke AuthorDate: Sun Oct 15 23:51:04 2023 +0200 Commit: Eike Rathke CommitDate: Mon Oct 16 10:54:04 2023 +0200 Factor out an occurrence of sumNeumaierNormal() Change-Id: I693f78be36005cd1fc387a2878112de60bd24905 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158012 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index 03b05c25aa6b..c2560635fbdf 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -91,12 +91,7 @@ public: return; } -double t = m_fSum + m_fMem; -if (std::abs(m_fSum) >= std::abs(m_fMem)) -m_fError += (m_fSum - t) + m_fMem; -else -m_fError += (m_fMem - t) + m_fSum; -m_fSum = t; +sumNeumaierNormal(m_fSum, m_fError, m_fMem); m_fMem = x_i; }
[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
sc/inc/arraysumfunctor.hxx | 17 - sc/inc/kahan.hxx | 66 +-- sc/qa/unit/ucalc_formula2.cxx|3 + sc/source/core/tool/arraysum.hxx | 36 --- sc/source/core/tool/arraysumSSE2.cxx |6 +-- 5 files changed, 52 insertions(+), 76 deletions(-) New commits: commit 361c4f008e48b08df635839d2e5dcad7389df44a Author: Eike Rathke AuthorDate: Sun Oct 15 17:29:01 2023 +0200 Commit: Eike Rathke CommitDate: Sun Oct 15 18:46:01 2023 +0200 Follow-up: tdf#156985 Use SC_USE_SSE2 to determine which KahanSum::add() to use Also, the CPU identifier for MSVC WIN32 is not X86 but INTEL, so actually use SSE2 there as well, which was the cause of things failing on that platform. For other platforms than Intel x86/x86_64 SSE2 is not defined, so exclude the new unit test based on that and live on with the old slightly off value. Experiments did not yield any solution that works, even using plain sumNeumaierNormal() (similar to SSE2) in the executeUnrolled() case instead of KahanSum with its m_fMem did not help, nor trying to add the internal values in different orders or with long double, au contraire the error was slightly larger. Change-Id: Ica0b2963f76c01f248799e9a809ef06eb099e722 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156899 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/inc/arraysumfunctor.hxx b/sc/inc/arraysumfunctor.hxx index c261c120addf..c1eabb220e27 100644 --- a/sc/inc/arraysumfunctor.hxx +++ b/sc/inc/arraysumfunctor.hxx @@ -12,29 +12,12 @@ #include #include "kahan.hxx" -#include "arraysumfunctor.hxx" #include namespace sc::op { -// Checkout available optimization options. -// Note that it turned out to be problematic to support CPU-specific code -// that's not guaranteed to be available on that specific platform (see -// git history). SSE2 is guaranteed on x86_64 and it is our baseline requirement -// for x86 on Windows, so SSE2 use is hardcoded on those platforms. -// Whenever we raise baseline to e.g. AVX, this may get -// replaced with AVX code (get it from git history). -// Do it similarly with other platforms. -#if defined(X86_64) || (defined(X86) && defined(_WIN32)) -#define SC_USE_SSE2 1 -KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); -#else -#define SC_USE_SSE2 0 -#endif - /** * If no boosts available, Unrolled KahanSum. - * Most likely to use on android. */ static inline KahanSum executeUnrolled(size_t& i, size_t nSize, const double* pCurrent) { diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index ac97ae4394fa..03b05c25aa6b 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -12,6 +12,26 @@ #include #include +class KahanSum; +namespace sc::op +{ +// Checkout available optimization options. +// Note that it turned out to be problematic to support CPU-specific code +// that's not guaranteed to be available on that specific platform (see +// git commit 2d36e7f5186ba5215f2b228b98c24520bd4f2882). SSE2 is guaranteed on +// x86_64 and it is our baseline requirement for x86 on Windows, so SSE2 use is +// hardcoded on those platforms. +// Whenever we raise baseline to e.g. AVX, this may get +// replaced with AVX code (get it from mentioned git commit). +// Do it similarly with other platforms. +#if defined(X86_64) || (defined(INTEL) && defined(_WIN32)) +#define SC_USE_SSE2 1 +KahanSum executeSSE2(size_t& i, size_t nSize, const double* pCurrent); +#else +#define SC_USE_SSE2 0 +#endif +} + /** * This class provides LO with Kahan summation algorithm * About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm @@ -41,6 +61,21 @@ public: constexpr KahanSum(const KahanSum& fSum) = default; public: +/** + * Performs one step of the Neumaier sum of doubles. + * Overwrites the summand and error. + * T could be double or long double. + */ +template static inline void sumNeumaierNormal(T& sum, T& err, const double& value) +{ +T t = sum + value; +if (std::abs(sum) >= std::abs(value)) +err += (sum - t) + value; +else +err += (value - t) + sum; +sum = t; +} + /** * Adds a value to the sum using Kahan summation. * @param x_i @@ -71,32 +106,27 @@ public: */ inline void add(const KahanSum& fSum) { -#ifdef _WIN32 -// For some odd unknown reason WIN32 fails badly with the -// sum+compensation value. Continue keeping the old though slightly off -// (see tdf#156985) explicit addition of the compensation value. -add(fSum.m_fSum); -add(fSum.m_fError); -#else +#if SC_USE_SSE2 add(fSum.m_fSum + fSum.m_fError); -#endif add(fSum.m_fMem); +#else +// Without SSE2 the sum+compensation value fails badly. Continue +// keeping the old
[Libreoffice-commits] core.git: download.lst
download.lst |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 1f43a341885412b89dc3d6e9bc2bbc5f9f086a84 Author: Eike Rathke AuthorDate: Fri Oct 13 17:35:38 2023 +0200 Commit: Eike Rathke CommitDate: Fri Oct 13 22:07:27 2023 +0200 Update language-subtag-registry to 2023-08-02 Change-Id: I61e7e6c0a7010ff6f8db61a72b57a57de3e61c74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157943 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/download.lst b/download.lst index 33e691aebdb3..ef42c2555cbf 100644 --- a/download.lst +++ b/download.lst @@ -349,8 +349,8 @@ LIBJPEG_TURBO_TARBALL := libjpeg-turbo-2.1.5.1.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -LANGTAGREG_SHA256SUM := 9042b64cd473bf36073513b474046f13778107b57c2ac47fb2633104120d69da -LANGTAGREG_TARBALL := language-subtag-registry-2023-05-11.tar.bz2 +LANGTAGREG_SHA256SUM := 59fdc026b5088e7947e1e6add482d2a40e1f7e25c50f198b456954216462c2eb +LANGTAGREG_TARBALL := language-subtag-registry-2023-08-02.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts
[Libreoffice-commits] core.git: helpcontent2
helpcontent2 |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 8f42a36aecaf78b1fb004ed95c52b2f541dadc95 Author: Eike Rathke AuthorDate: Wed Oct 11 16:06:01 2023 +0200 Commit: Gerrit Code Review CommitDate: Wed Oct 11 16:06:01 2023 +0200 Update git submodules * Update helpcontent2 from branch 'master' to 379510d74d95dd4e7878e8e86401a3b60a6ef107 - Follow-up: tdf#152412 Re-add the note to the STYLE() function ... to not use it without reason.. This got lost with commit 20d4c17ca1fb161bf5fccf3d94db93b0a4d322f2 CommitDate: Wed Jan 11 00:09:58 2023 + tdf#152412 Improve the STYLE function help page Change-Id: I48b11d8360a0a95ae1a76e4d0a339b5fe6488d2d Reviewed-on: https://gerrit.libreoffice.org/c/help/+/157835 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/helpcontent2 b/helpcontent2 index 3dda8f8e1aa7..379510d74d95 16 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 3dda8f8e1aa70b6a89482e223c021cc0188beef2 +Subproject commit 379510d74d95dd4e7878e8e86401a3b60a6ef107
[Libreoffice-commits] help.git: source/text
source/text/scalc/01/func_style.xhp |1 + 1 file changed, 1 insertion(+) New commits: commit 379510d74d95dd4e7878e8e86401a3b60a6ef107 Author: Eike Rathke AuthorDate: Wed Oct 11 15:59:31 2023 +0200 Commit: Eike Rathke CommitDate: Wed Oct 11 16:06:00 2023 +0200 Follow-up: tdf#152412 Re-add the note to the STYLE() function ... to not use it without reason.. This got lost with commit 20d4c17ca1fb161bf5fccf3d94db93b0a4d322f2 CommitDate: Wed Jan 11 00:09:58 2023 + tdf#152412 Improve the STYLE function help page Change-Id: I48b11d8360a0a95ae1a76e4d0a339b5fe6488d2d Reviewed-on: https://gerrit.libreoffice.org/c/help/+/157835 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/source/text/scalc/01/func_style.xhp b/source/text/scalc/01/func_style.xhp index b5f1d8c2ac..643ba2af6b 100644 --- a/source/text/scalc/01/func_style.xhp +++ b/source/text/scalc/01/func_style.xhp @@ -26,6 +26,7 @@ Applies a style to the cell containing the formula. After a set amount of time, another style can be applied. This function always returns the numeric value 0, which allows to use it by adding the STYLE function to other functions in the same cell without changing its value. + The STYLE function should not be used without compelling reason, its purpose is the use with asynchronous Add-In functions to visually notify about the availability of a result. In almost all other cases using conditional formatting instead is a better choice.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6-1' - sc/inc
sc/inc/kahan.hxx | 11 +++ 1 file changed, 11 insertions(+) New commits: commit 5928323090fa5cd95866b46b91e292aabaddff73 Author: Eike Rathke AuthorDate: Fri Sep 1 15:20:28 2023 +0200 Commit: Christian Lohmaier CommitDate: Wed Sep 6 17:34:53 2023 +0200 Resolves: tdf#156985 Treat adding two KahanSum differently When summing mixed formula cells and numeric cells, cell type runs are summed using KahanSum that when switching cell types are added. Using add() to explicitly add the rhs m_fError compensation value separately may had lead to effectively cancelling out the relation of sum and error, living on with an unrelated error value. Instead, add a "final" rhs sum+compensation. Change-Id: I751d3e0eeef9cd80482895c24f05b1ab667c3020 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156253 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit caafee1a4805e40d29be5c90f3a021ed6ef5c4d2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156431 Reviewed-by: Xisco Fauli (cherry picked from commit 3cb3b713e1f3b8abe8d9bb46c89f58c7efdf8196) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156444 Reviewed-by: Ilmari Lauhakangas Reviewed-by: Hossein Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index 6c84f6eeef2e..ac97ae4394fa 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -71,8 +71,15 @@ public: */ inline void add(const KahanSum& fSum) { +#ifdef _WIN32 +// For some odd unknown reason WIN32 fails badly with the +// sum+compensation value. Continue keeping the old though slightly off +// (see tdf#156985) explicit addition of the compensation value. add(fSum.m_fSum); add(fSum.m_fError); +#else +add(fSum.m_fSum + fSum.m_fError); +#endif add(fSum.m_fMem); } @@ -82,8 +89,12 @@ public: */ inline void subtract(const KahanSum& fSum) { +#ifdef _WIN32 add(-fSum.m_fSum); add(-fSum.m_fError); +#else +add(-(fSum.m_fSum + fSum.m_fError)); +#endif add(-fSum.m_fMem); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/inc
sc/inc/kahan.hxx | 11 +++ 1 file changed, 11 insertions(+) New commits: commit 1f320173fc92dcf3873751bffe490931542679bc Author: Eike Rathke AuthorDate: Fri Sep 1 15:20:28 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 4 10:40:22 2023 +0200 Resolves: tdf#156985 Treat adding two KahanSum differently When summing mixed formula cells and numeric cells, cell type runs are summed using KahanSum that when switching cell types are added. Using add() to explicitly add the rhs m_fError compensation value separately may had lead to effectively cancelling out the relation of sum and error, living on with an unrelated error value. Instead, add a "final" rhs sum+compensation. Change-Id: I751d3e0eeef9cd80482895c24f05b1ab667c3020 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156253 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit caafee1a4805e40d29be5c90f3a021ed6ef5c4d2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156431 Reviewed-by: Xisco Fauli diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index 6c84f6eeef2e..ac97ae4394fa 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -71,8 +71,15 @@ public: */ inline void add(const KahanSum& fSum) { +#ifdef _WIN32 +// For some odd unknown reason WIN32 fails badly with the +// sum+compensation value. Continue keeping the old though slightly off +// (see tdf#156985) explicit addition of the compensation value. add(fSum.m_fSum); add(fSum.m_fError); +#else +add(fSum.m_fSum + fSum.m_fError); +#endif add(fSum.m_fMem); } @@ -82,8 +89,12 @@ public: */ inline void subtract(const KahanSum& fSum) { +#ifdef _WIN32 add(-fSum.m_fSum); add(-fSum.m_fError); +#else +add(-(fSum.m_fSum + fSum.m_fError)); +#endif add(-fSum.m_fMem); }
[Libreoffice-commits] core.git: sc/inc
sc/inc/kahan.hxx | 11 +++ 1 file changed, 11 insertions(+) New commits: commit 1f8cc7644293e62ad6430bbeec243d3283e478d7 Author: Eike Rathke AuthorDate: Fri Sep 1 15:20:28 2023 +0200 Commit: Eike Rathke CommitDate: Fri Sep 1 18:07:21 2023 +0200 Resolves: tdf#156985 Treat adding two KahanSum differently When summing mixed formula cells and numeric cells, cell type runs are summed using KahanSum that when switching cell types are added. Using add() to explicitly add the rhs m_fError compensation value separately may had lead to effectively cancelling out the relation of sum and error, living on with an unrelated error value. Instead, add a "final" rhs sum+compensation. Change-Id: I751d3e0eeef9cd80482895c24f05b1ab667c3020 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156253 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/inc/kahan.hxx b/sc/inc/kahan.hxx index 6c84f6eeef2e..ac97ae4394fa 100644 --- a/sc/inc/kahan.hxx +++ b/sc/inc/kahan.hxx @@ -71,8 +71,15 @@ public: */ inline void add(const KahanSum& fSum) { +#ifdef _WIN32 +// For some odd unknown reason WIN32 fails badly with the +// sum+compensation value. Continue keeping the old though slightly off +// (see tdf#156985) explicit addition of the compensation value. add(fSum.m_fSum); add(fSum.m_fError); +#else +add(fSum.m_fSum + fSum.m_fError); +#endif add(fSum.m_fMem); } @@ -82,8 +89,12 @@ public: */ inline void subtract(const KahanSum& fSum) { +#ifdef _WIN32 add(-fSum.m_fSum); add(-fSum.m_fError); +#else +add(-(fSum.m_fSum + fSum.m_fError)); +#endif add(-fSum.m_fMem); }
[Libreoffice-commits] core.git: sc/qa
sc/qa/unit/data/functions/statistical/fods/KahanSum.fods | 3830 +++ 1 file changed, 1971 insertions(+), 1859 deletions(-) New commits: commit 0603e8fd85f626340c756d80df5612343480beea Author: Eike Rathke AuthorDate: Thu Aug 31 15:01:21 2023 +0200 Commit: Eike Rathke CommitDate: Thu Aug 31 18:53:15 2023 +0200 Related: tdf#156985 Adjust doc layout to what FunctionsTest::load() expects In case of failure to show failure details sc/qa/unit/functions_test.cxx FunctionsTest::load() assumes result in A, expected in B, check in C and formula in D. Change-Id: I48d9e123664da314a1f7791f949d89569150b0c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156346 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/qa/unit/data/functions/statistical/fods/KahanSum.fods b/sc/qa/unit/data/functions/statistical/fods/KahanSum.fods index e2bba0018e1f..c2b87afcd480 100644 --- a/sc/qa/unit/data/functions/statistical/fods/KahanSum.fods +++ b/sc/qa/unit/data/functions/statistical/fods/KahanSum.fods @@ -1,227 +1,227 @@ -http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc; xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:rpt="http://openoffice.org/2005/report; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:nam es:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:fo rm:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> +http://www.w3.org/TR/css3-text/; xmlns:grddl="http://www.w3.org/2003/g/data-view#; xmlns:xhtml="http://www.w3.org/1999/xhtml; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd="http://www.w3.org/2001/XMLSchema; xmlns:xforms="http://www.w3.org/2002/xforms; xmlns:dom="http://www.w3.org/2001/xml-events; xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML; xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer; xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:oooc="http://o penoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report; xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
[Libreoffice-commits] core.git: sc/qa
sc/qa/unit/functions_test.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 63582b234ddcca3bcb1f76843363e5e7d0b0a08e Author: Eike Rathke AuthorDate: Thu Aug 31 14:53:37 2023 +0200 Commit: Eike Rathke CommitDate: Thu Aug 31 17:07:09 2023 +0200 Related: tdf#156985 Do not fail for first empty check cell in test failure case So we can actually find a detail if there are empty rows and not just bail out with "Sheet2.A1 '' result: 0, expected: 0" or such. Change-Id: I163f84edebfb98f6f0351ba3dc889d3fab0e6789 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156344 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/qa/unit/functions_test.cxx b/sc/qa/unit/functions_test.cxx index 8efdfa5b0f82..40504480d04d 100644 --- a/sc/qa/unit/functions_test.cxx +++ b/sc/qa/unit/functions_test.cxx @@ -40,8 +40,10 @@ bool FunctionsTest::load(const OUString& rFilter, const OUString& rURL, SCROW maxRow = rDoc.GetLastDataRow(tab, 2, 2, rDoc.MaxRow()); for(SCROW row = 0; row <= maxRow; ++row) { -// Column C has the check result, column D has the formula text. -if(rDoc.HasStringData(2, row, tab)) +// Column A has the result value, column B has the expected +// value, Column C has the check result (1 or 0), column D has +// the formula text. +if(rDoc.HasStringData(2, row, tab) || !rDoc.HasData(2, row, tab)) continue; if(!rtl::math::approxEqual(1.0, rDoc.GetValue(2, row, 1))) CPPUNIT_FAIL( OUString( "Testing " + rURL + " failed, "
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - include/tools sc/source tools/qa tools/source
include/tools/duration.hxx | 30 ++- sc/source/core/tool/interpr5.cxx | 22 +++- tools/qa/cppunit/test_duration.cxx | 78 + tools/source/datetime/duration.cxx | 97 - tools/source/datetime/ttime.cxx| 12 5 files changed, 221 insertions(+), 18 deletions(-) New commits: commit c17641839855ba88b1c071c4f5e4533725ff2dbb Author: Eike Rathke AuthorDate: Mon Aug 7 16:37:26 2023 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Wed Aug 16 13:13:14 2023 +0200 Resolves: tdf#127334 Backport tools::Duration ScInterpreter::CalculateAddSub() All tools::Duration implementation for completeness. This is a combination of 5 (+2 typo) commits. Introduce tools::Duration(sal_Int32 nDays, const Time& rTime) ctor xChange-Id: If002e04536149b49b2249103ac914d17dec3fae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153409 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 986c2d86a7b53a6599d014db7327f47cb33d4fea) Introduce tools::Duration individual time values ctor xChange-Id: I516d3727cbcf6667b32dc963febbf4b753ef6a91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153497 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit c968d8989004301b49d67a093a6eb8a629533837) Clamp and assert maximum hours value in Time::init() xChange-Id: Ia777222f3c797b90663b55499a57025e410b1d70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153407 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit b07d72c6c1075efa6b64c67758566426c22c5225) Use tools::Duration in ScInterpreter::CalculateAddSub() ... for all (date+)time inflicted operands. xChange-Id: I93043d912867e2ef7d4af271b5c4566a3ffb4ef9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153291 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 174a72f3fd50d1146d6bedd4cc2a1971aa33be67) Resolves: tdf#127334 Increase tools::Duration accuracy epsilon unsharpness ... when converting from double, i.e. to 300 nanoseconds. Empirically determined.. xChange-Id: I92c43b5f244923363af5d44bece9c155126ca343 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155324 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 46e672db8002e7aaac881bee65b5c50c4e14c666) Change-Id: I92c43b5f244923363af5d44bece9c155126ca343 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155427 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx index 83b9d12a77b3..9fae80d1d7c9 100644 --- a/include/tools/duration.hxx +++ b/include/tools/duration.hxx @@ -31,8 +31,30 @@ public: minutes and seconds values here though. */ Duration(const Time& rStart, const Time& rEnd); -/** Difference in days, like DateTime()-DateTime(). */ -explicit Duration(double fTimeInDays); +/** Difference in days, like DateTime()-DateTime(). + +@param nAccuracyEpsilonNanoseconds +Round for example by 1 nanosecond if it's just 1 off to a +second, i.e. 09 or 01. This can be loosened if +necessary. For example, if fTimeInDays is a date+time in +"today's" range with a significant seconds resolution, an +accuracy epsilon (=unsharpness) of ~300 is required. Hence default. +Must be 0 <= nAccuracyEpsilonNanoseconds <= Time::nanoSecPerSec - 1. + */ +explicit Duration(double fTimeInDays, sal_uInt64 nAccuracyEpsilonNanoseconds = 300); + +/** Time can be a limited duration as well and can have out-of-range +values, it will be normalized. Sign of both days and Time must be equal +unless one is 0. */ +Duration(sal_Int32 nDays, const Time& rTime); + +/** Individual time values can be out-of-range, all will be normalized. +Additionally, the resulting time overall hour value is not restricted +to sal_uInt16 like it is with Time, as values >=24 flow over into days. +For a negative duration only a negative nDays can be given, thus a +negative duration of less than one day is not possible. */ +Duration(sal_Int32 nDays, sal_uInt32 nHours, sal_uInt32 nMinutes, sal_uInt32 nSeconds, + sal_uInt64 nNanoseconds); bool IsNegative() const { return mnDays < 0 || maTime.GetTime() < 0; } sal_Int32 GetDays() const { return mnDays; } @@ -55,6 +77,10 @@ private: /** Internal days and Time values. */ Duration(sal_Int32 nDays, sal_Int64 nTime); +/** Prerequisite: mnDays is already set. */ +void Normalize(sal_uInt64 nHours, sal_uInt64 nMinutes, sal_uInt64 nSeconds, + sal_uInt64
[Libreoffice-commits] core.git: include/tools tools/source
include/tools/duration.hxx | 13 +++-- tools/source/datetime/duration.cxx | 25 ++--- 2 files changed, 25 insertions(+), 13 deletions(-) New commits: commit 46e672db8002e7aaac881bee65b5c50c4e14c666 Author: Eike Rathke AuthorDate: Thu Aug 3 20:52:43 2023 +0200 Commit: Eike Rathke CommitDate: Thu Aug 3 21:42:53 2023 +0200 Resolves: tdf#127334 Increase tools::Duration accuracy epsilon unsharpness ... when converting from double, i.e. to 300 nanoseconds. Empirically determined.. Change-Id: I92c43b5f244923363af5d44bece9c155126ca343 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155324 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx index ea33953751b8..9fae80d1d7c9 100644 --- a/include/tools/duration.hxx +++ b/include/tools/duration.hxx @@ -31,8 +31,17 @@ public: minutes and seconds values here though. */ Duration(const Time& rStart, const Time& rEnd); -/** Difference in days, like DateTime()-DateTime(). */ -explicit Duration(double fTimeInDays); +/** Difference in days, like DateTime()-DateTime(). + +@param nAccuracyEpsilonNanoseconds +Round for example by 1 nanosecond if it's just 1 off to a +second, i.e. 09 or 01. This can be loosened if +necessary. For example, if fTimeInDays is a date+time in +"today's" range with a significant seconds resolution, an +accuracy epsilon (=unsharpness) of ~300 is required. Hence default. +Must be 0 <= nAccuracyEpsilonNanoseconds <= Time::nanoSecPerSec - 1. + */ +explicit Duration(double fTimeInDays, sal_uInt64 nAccuracyEpsilonNanoseconds = 300); /** Time can be a limited duration as well and can have out-of-range values, it will be normalized. Sign of both days and Time must be equal diff --git a/tools/source/datetime/duration.cxx b/tools/source/datetime/duration.cxx index a7b2762fff49..a655f016a1bc 100644 --- a/tools/source/datetime/duration.cxx +++ b/tools/source/datetime/duration.cxx @@ -47,8 +47,9 @@ Duration::Duration(const Time& rStart, const Time& rEnd) } } -Duration::Duration(double fTimeInDays) +Duration::Duration(double fTimeInDays, sal_uInt64 nAccuracyEpsilonNanoseconds) { +assert(nAccuracyEpsilonNanoseconds <= Time::nanoSecPerSec - 1); double fInt, fFrac; if (fTimeInDays < 0.0) { @@ -66,19 +67,21 @@ Duration::Duration(double fTimeInDays) fFrac *= Time::nanoSecPerDay; fFrac = ::rtl::math::approxFloor(fFrac); sal_Int64 nNS = static_cast(fFrac); -// Round by 1 nanosecond if it's just 1 off to a second, i.e. -// 09 or 01. This could be loosened to rounding by 2 or -// such if necessary. const sal_Int64 nN = nNS % Time::nanoSecPerSec; -if (std::abs(nN) == 1) -nNS -= (nNS < 0) ? -1 : 1; -else if (std::abs(nN) == Time::nanoSecPerSec - 1) +if (nN) { -nNS += (nNS < 0) ? -1 : 1; -if (std::abs(nNS) >= Time::nanoSecPerDay) +const sal_uInt64 nA = std::abs(nN); +if (nA <= nAccuracyEpsilonNanoseconds) +nNS -= (nNS < 0) ? -nN : nN; +else if (nA >= Time::nanoSecPerSec - nAccuracyEpsilonNanoseconds) { -mnDays += nNS / Time::nanoSecPerDay; -nNS %= Time::nanoSecPerDay; +const sal_Int64 nD = Time::nanoSecPerSec - nA; +nNS += (nNS < 0) ? -nD : nD; +if (std::abs(nNS) >= Time::nanoSecPerDay) +{ +mnDays += nNS / Time::nanoSecPerDay; +nNS %= Time::nanoSecPerDay; +} } } maTime.MakeTimeFromNS(nNS);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - i18npool/source
i18npool/source/localedata/data/eo.xml | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) New commits: commit 596dd17209c7039fc1711216465a6b6dcba18574 Author: Eike Rathke AuthorDate: Mon Jul 31 20:13:02 2023 +0200 Commit: Xisco Fauli CommitDate: Tue Aug 1 14:41:01 2023 +0200 Correct Esperanto {eo} group separator formats wrong since initial 2005 commit Instead of # ##0,00 and similar it used # #0,00 that probably went unnoticed since ever because it generates an expected display string using the group separator at the right position; editing such format yielded the format code ##0,00 with the group separator flag set. Change-Id: Id6ebb533f43a49a9aea1dd9ba87230e5d59901ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155114 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 613c3524eb798392040c691d5c0e17fac0b654b8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155048 Reviewed-by: Adolfo Jayme Barrientos (cherry picked from commit b6ed7c7be2a94777ee9b1c4a5ddf77e3f5343efe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155142 Reviewed-by: Xisco Fauli diff --git a/i18npool/source/localedata/data/eo.xml b/i18npool/source/localedata/data/eo.xml index 6cef3274b54d..ba718f92f4a1 100644 --- a/i18npool/source/localedata/data/eo.xml +++ b/i18npool/source/localedata/data/eo.xml @@ -157,31 +157,31 @@ 0,00 - # #0 + # ##0 - # #0,00 + # ##0,00 - # ##,00 + # ###,00 - # #0 [CURRENCY];-# #0 [CURRENCY] + # ##0 [CURRENCY];-# ##0 [CURRENCY] - # #0,00 [CURRENCY];-# #0,00 [CURRENCY] + # ##0,00 [CURRENCY];-# ##0,00 [CURRENCY] - # #0 [CURRENCY];[RED]-# #0 [CURRENCY] + # ##0 [CURRENCY];[RED]-# ##0 [CURRENCY] - # #0,00 [CURRENCY];[RED]-# #0,00 [CURRENCY] + # ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY] - # #0,00 CCC + # ##0,00 CCC - # #0,-- [CURRENCY];[RED]-# #0,-- [CURRENCY] + # ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY] 0%
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - i18npool/source
i18npool/source/localedata/data/eo.xml | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) New commits: commit b6ed7c7be2a94777ee9b1c4a5ddf77e3f5343efe Author: Eike Rathke AuthorDate: Mon Jul 31 20:13:02 2023 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Tue Aug 1 03:52:28 2023 +0200 Correct Esperanto {eo} group separator formats wrong since initial 2005 commit Instead of # ##0,00 and similar it used # #0,00 that probably went unnoticed since ever because it generates an expected display string using the group separator at the right position; editing such format yielded the format code ##0,00 with the group separator flag set. Change-Id: Id6ebb533f43a49a9aea1dd9ba87230e5d59901ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155114 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 613c3524eb798392040c691d5c0e17fac0b654b8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155048 Reviewed-by: Adolfo Jayme Barrientos diff --git a/i18npool/source/localedata/data/eo.xml b/i18npool/source/localedata/data/eo.xml index 6cef3274b54d..ba718f92f4a1 100644 --- a/i18npool/source/localedata/data/eo.xml +++ b/i18npool/source/localedata/data/eo.xml @@ -157,31 +157,31 @@ 0,00 - # #0 + # ##0 - # #0,00 + # ##0,00 - # ##,00 + # ###,00 - # #0 [CURRENCY];-# #0 [CURRENCY] + # ##0 [CURRENCY];-# ##0 [CURRENCY] - # #0,00 [CURRENCY];-# #0,00 [CURRENCY] + # ##0,00 [CURRENCY];-# ##0,00 [CURRENCY] - # #0 [CURRENCY];[RED]-# #0 [CURRENCY] + # ##0 [CURRENCY];[RED]-# ##0 [CURRENCY] - # #0,00 [CURRENCY];[RED]-# #0,00 [CURRENCY] + # ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY] - # #0,00 CCC + # ##0,00 CCC - # #0,-- [CURRENCY];[RED]-# #0,-- [CURRENCY] + # ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY] 0%
[Libreoffice-commits] core.git: i18npool/source
i18npool/source/localedata/data/eo.xml | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) New commits: commit 2a9e83a673300dfe15a3acc66acd560b2a7cae43 Author: Eike Rathke AuthorDate: Mon Jul 31 20:13:02 2023 +0200 Commit: Eike Rathke CommitDate: Tue Aug 1 01:48:04 2023 +0200 Correct Esperanto {eo} group separator formats wrong since initial 2005 commit Instead of # ##0,00 and similar it used # #0,00 that probably went unnoticed since ever because it generates an expected display string using the group separator at the right position; editing such format yielded the format code ##0,00 with the group separator flag set. Change-Id: Id6ebb533f43a49a9aea1dd9ba87230e5d59901ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155114 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/source/localedata/data/eo.xml b/i18npool/source/localedata/data/eo.xml index 6cef3274b54d..ba718f92f4a1 100644 --- a/i18npool/source/localedata/data/eo.xml +++ b/i18npool/source/localedata/data/eo.xml @@ -157,31 +157,31 @@ 0,00 - # #0 + # ##0 - # #0,00 + # ##0,00 - # ##,00 + # ###,00 - # #0 [CURRENCY];-# #0 [CURRENCY] + # ##0 [CURRENCY];-# ##0 [CURRENCY] - # #0,00 [CURRENCY];-# #0,00 [CURRENCY] + # ##0,00 [CURRENCY];-# ##0,00 [CURRENCY] - # #0 [CURRENCY];[RED]-# #0 [CURRENCY] + # ##0 [CURRENCY];[RED]-# ##0 [CURRENCY] - # #0,00 [CURRENCY];[RED]-# #0,00 [CURRENCY] + # ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY] - # #0,00 CCC + # ##0,00 CCC - # #0,-- [CURRENCY];[RED]-# #0,-- [CURRENCY] + # ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY] 0%
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/core/tool/interpr1.cxx | 42 +++ 1 file changed, 30 insertions(+), 12 deletions(-) New commits: commit 74d1aad00b1dad10534ecd80a845ae182fbd08c3 Author: Eike Rathke AuthorDate: Tue Jul 25 23:41:23 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 28 10:03:26 2023 +0200 Resolves: tdf#156467 Let array ROW() and COLUMN() return a scalar value ... instead of a single element matrix. Change-Id: I8307e24ef68dc54350fbdda74bc61b1df6a5107b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154908 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 49b601937f5ba7739198a1b16ba6da2351897750) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154952 Reviewed-by: Caolán McNamara diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index a8fba640b732..56840ceaeff3 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4457,20 +4457,29 @@ void ScInterpreter::ScColumn() SCROW nRows = 0; if (pMyFormulaCell) pMyFormulaCell->GetMatColsRows( nCols, nRows); +bool bMayBeScalar; if (nCols == 0) { // Happens if called via ScViewFunc::EnterMatrix() // ScFormulaCell::GetResultDimensions() as of course a // matrix result is not available yet. nCols = 1; +bMayBeScalar = false; } -ScMatrixRef pResMat = GetNewMat( static_cast(nCols), 1, /*bEmpty*/true ); -if (pResMat) +else { -for (SCCOL i=0; i < nCols; ++i) -pResMat->PutDouble( nVal + i, static_cast(i), 0); -PushMatrix( pResMat); -return; +bMayBeScalar = true; +} +if (!bMayBeScalar || nCols != 1 || nRows != 1) +{ +ScMatrixRef pResMat = GetNewMat( static_cast(nCols), 1, /*bEmpty*/true ); +if (pResMat) +{ +for (SCCOL i=0; i < nCols; ++i) +pResMat->PutDouble( nVal + i, static_cast(i), 0); +PushMatrix( pResMat); +return; +} } } } @@ -4561,20 +4570,29 @@ void ScInterpreter::ScRow() SCROW nRows = 0; if (pMyFormulaCell) pMyFormulaCell->GetMatColsRows( nCols, nRows); +bool bMayBeScalar; if (nRows == 0) { // Happens if called via ScViewFunc::EnterMatrix() // ScFormulaCell::GetResultDimensions() as of course a // matrix result is not available yet. nRows = 1; +bMayBeScalar = false; } -ScMatrixRef pResMat = GetNewMat( 1, static_cast(nRows), /*bEmpty*/true); -if (pResMat) +else { -for (SCROW i=0; i < nRows; i++) -pResMat->PutDouble( nVal + i, 0, static_cast(i)); -PushMatrix( pResMat); -return; +bMayBeScalar = true; +} +if (!bMayBeScalar || nCols != 1 || nRows != 1) +{ +ScMatrixRef pResMat = GetNewMat( 1, static_cast(nRows), /*bEmpty*/true); +if (pResMat) +{ +for (SCROW i=0; i < nRows; i++) +pResMat->PutDouble( nVal + i, 0, static_cast(i)); +PushMatrix( pResMat); +return; +} } } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/source
sc/source/filter/inc/workbookhelper.hxx |4 ++ sc/source/filter/oox/formulabuffer.cxx| 44 +- sc/source/filter/oox/workbookfragment.cxx |7 sc/source/filter/oox/workbookhelper.cxx | 17 +++ 4 files changed, 59 insertions(+), 13 deletions(-) New commits: commit 69184e2eff8eeb1f2a0b10279c1d08f70b2e7000 Author: Eike Rathke AuthorDate: Wed Jul 26 17:43:32 2023 +0200 Commit: Michael Stahl CommitDate: Thu Jul 27 13:29:30 2023 +0200 Resolves: tdf#147955 Recalculate OOXML for bad generators with all 0.0 results Change-Id: I0ad301dddfe986a38303ce1134e080bafbf312de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154944 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit ec912956903b2657f4a6b67a68c2687e8be32508) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154953 Reviewed-by: Michael Stahl diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index 7aec3a68409c..7b3047759329 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -121,6 +121,10 @@ public: sal_Int16 getCurrentSheetIndex() const; /** Returns true when reading a file generated by a known good generator. */ boolisGeneratorKnownGood() const; +/** Returns true if any formula cell is calculated. */ +boolhasCalculatedFormulaCells() const; +/** Set if any formula cell is calculated. */ +voidsetCalculatedFormulaCells(); /** Sets the VBA project storage used to import VBA source code and forms. */ voidsetVbaProjectStorage( const StorageRef& rxVbaPrjStrg ); diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index dc934d1d41a4..0e7f3cdd5001 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -106,7 +106,7 @@ void applySharedFormulas( SvNumberFormatter& rFormatter, std::vector& rSharedFormulas, std::vector& rCells, -bool bGeneratorKnownGood) +WorkbookHelper& rWorkbookHelper) { sc::SharedFormulaGroups aGroups; { @@ -130,6 +130,8 @@ void applySharedFormulas( { svl::SharedStringPool& rStrPool = rDoc.getDoc().GetSharedStringPool(); +const bool bGeneratorKnownGood = rWorkbookHelper.isGeneratorKnownGood(); +bool bHasCalculatedFormulaCells = rWorkbookHelper.hasCalculatedFormulaCells(); // Process formulas that use shared formulas. for (const FormulaBuffer::SharedFormulaDesc& rDesc : rCells) { @@ -192,12 +194,20 @@ void applySharedFormulas( break; case XML_n: // numeric value. -pCell->SetResultDouble(rDesc.maCellValue.toDouble()); -/* TODO: is it on purpose that we never reset dirty here - * and thus recalculate anyway if cell was dirty? Or is it - * never dirty and therefore set dirty below otherwise? This - * is different from the non-shared case in - * applyCellFormulaValues(). */ +{ +const double fVal = rDesc.maCellValue.toDouble(); +if (!bHasCalculatedFormulaCells && fVal != 0.0) +{ +rWorkbookHelper.setCalculatedFormulaCells(); +bHasCalculatedFormulaCells = true; +} +pCell->SetResultDouble(fVal); +/* TODO: is it on purpose that we never reset dirty here + * and thus recalculate anyway if cell was dirty? Or is it + * never dirty and therefore set dirty below otherwise? This + * is different from the non-shared case in + * applyCellFormulaValues(). */ +} break; case XML_str: if (bGeneratorKnownGood) @@ -301,9 +311,11 @@ void applyArrayFormulas( } void applyCellFormulaValues( -ScDocumentImport& rDoc, const std::vector& rVector, bool bGeneratorKnownGood ) +ScDocumentImport& rDoc, const std::vector& rVector, WorkbookHelper& rWorkbookHelper ) { svl::SharedStringPool& rStrPool = rDoc.getDoc().GetSharedStringPool(); +const bool bGeneratorKnownGood = rWorkbookHelper.isGeneratorKnownGood(); +bool bHasCalculatedFormulaCells = rWorkbookHelper.hasCalculatedFormulaCells(); for (const FormulaBuffer::FormulaValue& rValue : rVector) { @@ -317,7 +329,13 @@ void applyCellFormulaValues( { case XML_n: { -pCell->SetResultDouble(rValueStr.toDouble()); +const double fVal = rValueStr.toDouble();
[Libreoffice-commits] core.git: sc/source
sc/source/filter/inc/workbookhelper.hxx |4 ++ sc/source/filter/oox/formulabuffer.cxx| 44 +- sc/source/filter/oox/workbookfragment.cxx |7 sc/source/filter/oox/workbookhelper.cxx | 17 +++ 4 files changed, 59 insertions(+), 13 deletions(-) New commits: commit ec912956903b2657f4a6b67a68c2687e8be32508 Author: Eike Rathke AuthorDate: Wed Jul 26 17:43:32 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jul 26 20:29:57 2023 +0200 Resolves: tdf#147955 Recalculate OOXML for bad generators with all 0.0 results Change-Id: I0ad301dddfe986a38303ce1134e080bafbf312de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154944 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/filter/inc/workbookhelper.hxx b/sc/source/filter/inc/workbookhelper.hxx index 7aec3a68409c..7b3047759329 100644 --- a/sc/source/filter/inc/workbookhelper.hxx +++ b/sc/source/filter/inc/workbookhelper.hxx @@ -121,6 +121,10 @@ public: sal_Int16 getCurrentSheetIndex() const; /** Returns true when reading a file generated by a known good generator. */ boolisGeneratorKnownGood() const; +/** Returns true if any formula cell is calculated. */ +boolhasCalculatedFormulaCells() const; +/** Set if any formula cell is calculated. */ +voidsetCalculatedFormulaCells(); /** Sets the VBA project storage used to import VBA source code and forms. */ voidsetVbaProjectStorage( const StorageRef& rxVbaPrjStrg ); diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index dc934d1d41a4..0e7f3cdd5001 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -106,7 +106,7 @@ void applySharedFormulas( SvNumberFormatter& rFormatter, std::vector& rSharedFormulas, std::vector& rCells, -bool bGeneratorKnownGood) +WorkbookHelper& rWorkbookHelper) { sc::SharedFormulaGroups aGroups; { @@ -130,6 +130,8 @@ void applySharedFormulas( { svl::SharedStringPool& rStrPool = rDoc.getDoc().GetSharedStringPool(); +const bool bGeneratorKnownGood = rWorkbookHelper.isGeneratorKnownGood(); +bool bHasCalculatedFormulaCells = rWorkbookHelper.hasCalculatedFormulaCells(); // Process formulas that use shared formulas. for (const FormulaBuffer::SharedFormulaDesc& rDesc : rCells) { @@ -192,12 +194,20 @@ void applySharedFormulas( break; case XML_n: // numeric value. -pCell->SetResultDouble(rDesc.maCellValue.toDouble()); -/* TODO: is it on purpose that we never reset dirty here - * and thus recalculate anyway if cell was dirty? Or is it - * never dirty and therefore set dirty below otherwise? This - * is different from the non-shared case in - * applyCellFormulaValues(). */ +{ +const double fVal = rDesc.maCellValue.toDouble(); +if (!bHasCalculatedFormulaCells && fVal != 0.0) +{ +rWorkbookHelper.setCalculatedFormulaCells(); +bHasCalculatedFormulaCells = true; +} +pCell->SetResultDouble(fVal); +/* TODO: is it on purpose that we never reset dirty here + * and thus recalculate anyway if cell was dirty? Or is it + * never dirty and therefore set dirty below otherwise? This + * is different from the non-shared case in + * applyCellFormulaValues(). */ +} break; case XML_str: if (bGeneratorKnownGood) @@ -301,9 +311,11 @@ void applyArrayFormulas( } void applyCellFormulaValues( -ScDocumentImport& rDoc, const std::vector& rVector, bool bGeneratorKnownGood ) +ScDocumentImport& rDoc, const std::vector& rVector, WorkbookHelper& rWorkbookHelper ) { svl::SharedStringPool& rStrPool = rDoc.getDoc().GetSharedStringPool(); +const bool bGeneratorKnownGood = rWorkbookHelper.isGeneratorKnownGood(); +bool bHasCalculatedFormulaCells = rWorkbookHelper.hasCalculatedFormulaCells(); for (const FormulaBuffer::FormulaValue& rValue : rVector) { @@ -317,7 +329,13 @@ void applyCellFormulaValues( { case XML_n: { -pCell->SetResultDouble(rValueStr.toDouble()); +const double fVal = rValueStr.toDouble(); +if (!bHasCalculatedFormulaCells && fVal != 0.0) +{ +rWorkbookHelper.setCalculatedFormulaCells(); +
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/interpr1.cxx | 42 +++ 1 file changed, 30 insertions(+), 12 deletions(-) New commits: commit 49b601937f5ba7739198a1b16ba6da2351897750 Author: Eike Rathke AuthorDate: Tue Jul 25 23:41:23 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jul 26 10:29:36 2023 +0200 Resolves: tdf#156467 Let array ROW() and COLUMN() return a scalar value ... instead of a single element matrix. Change-Id: I8307e24ef68dc54350fbdda74bc61b1df6a5107b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154908 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index fa0c56d5257f..e5197dd34ece 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4457,20 +4457,29 @@ void ScInterpreter::ScColumn() SCROW nRows = 0; if (pMyFormulaCell) pMyFormulaCell->GetMatColsRows( nCols, nRows); +bool bMayBeScalar; if (nCols == 0) { // Happens if called via ScViewFunc::EnterMatrix() // ScFormulaCell::GetResultDimensions() as of course a // matrix result is not available yet. nCols = 1; +bMayBeScalar = false; } -ScMatrixRef pResMat = GetNewMat( static_cast(nCols), 1, /*bEmpty*/true ); -if (pResMat) +else { -for (SCCOL i=0; i < nCols; ++i) -pResMat->PutDouble( nVal + i, static_cast(i), 0); -PushMatrix( pResMat); -return; +bMayBeScalar = true; +} +if (!bMayBeScalar || nCols != 1 || nRows != 1) +{ +ScMatrixRef pResMat = GetNewMat( static_cast(nCols), 1, /*bEmpty*/true ); +if (pResMat) +{ +for (SCCOL i=0; i < nCols; ++i) +pResMat->PutDouble( nVal + i, static_cast(i), 0); +PushMatrix( pResMat); +return; +} } } } @@ -4561,20 +4570,29 @@ void ScInterpreter::ScRow() SCROW nRows = 0; if (pMyFormulaCell) pMyFormulaCell->GetMatColsRows( nCols, nRows); +bool bMayBeScalar; if (nRows == 0) { // Happens if called via ScViewFunc::EnterMatrix() // ScFormulaCell::GetResultDimensions() as of course a // matrix result is not available yet. nRows = 1; +bMayBeScalar = false; } -ScMatrixRef pResMat = GetNewMat( 1, static_cast(nRows), /*bEmpty*/true); -if (pResMat) +else { -for (SCROW i=0; i < nRows; i++) -pResMat->PutDouble( nVal + i, 0, static_cast(i)); -PushMatrix( pResMat); -return; +bMayBeScalar = true; +} +if (!bMayBeScalar || nCols != 1 || nRows != 1) +{ +ScMatrixRef pResMat = GetNewMat( 1, static_cast(nRows), /*bEmpty*/true); +if (pResMat) +{ +for (SCROW i=0; i < nRows; i++) +pResMat->PutDouble( nVal + i, 0, static_cast(i)); +PushMatrix( pResMat); +return; +} } } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5-5' - include/tools sc/inc sc/source tools/CppunitTest_tools_test.mk tools/Library_tl.mk tools/qa tools/source
include/tools/datetime.hxx |9 + include/tools/duration.hxx | 72 + sc/inc/table.hxx |8 - sc/source/core/data/documen3.cxx |3 sc/source/core/data/table4.cxx | 117 +-- tools/CppunitTest_tools_test.mk|1 tools/Library_tl.mk|1 tools/qa/cppunit/test_duration.cxx | 278 + tools/source/datetime/datetime.cxx | 38 ++--- tools/source/datetime/duration.cxx | 258 ++ 10 files changed, 719 insertions(+), 66 deletions(-) New commits: commit 4cd26ad13f11b69cca01274a4ed90194618bc003 Author: Eike Rathke AuthorDate: Sat Jun 17 00:57:42 2023 +0200 Commit: Christian Lohmaier CommitDate: Wed Jul 12 19:03:49 2023 +0200 Resolves: tdf#153517 Use tools::Duration for FillSeries with (date+)time This is a combination of 3 commits. Related: tdf#153517 Introduce class tools::Duration xChange-Id: I73ea6e162c73382ba470a306ce2852dbff3d1314 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153202 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit eac63ab120a181a1dff6317ee3d223327080e992) Conflicts: include/tools/datetime.hxx Resolves: tdf#153517 Use tools::Duration for FillSeries with (date+)time xChange-Id: I18567fdac512ee786ce4b0785b01b2ae6da7450e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153203 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit 30c48379c7b791edc615e7691691e344baa455a3) Fix TB Jenkins_Linux_Ubsan (duration.cxx) /tools/source/datetime/duration.cxx:190:77: runtime error: negation of -2147483648 cannot be represented in type 'sal_Int32' (aka 'int'); cast to an unsigned type to negate this value to itself 0 0x7f08bd84936d in tools::Duration::Mult(int, bool&) const /tools/source/datetime/duration.cxx:190:77 1 0x7f08c1c1d27a in tools::DurationTest::testDuration() /tools/qa/cppunit/test_duration.cxx:219:26 Detected thanks to eac63ab120a181a1dff6317ee3d223327080e992 Related: tdf#153517 Introduce class tools::Duration xChange-Id: I3804cc4ff4011a7f3b393b82b27f0c805682fbb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153254 Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit 99d01ff26fe69ccc66f49b3ddd43b258c3687f2c) Change-Id: I18567fdac512ee786ce4b0785b01b2ae6da7450e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153209 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 29d4ee512dcdddaf33c00b59c4650e13b23819eb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154321 Reviewed-by: Michael Weghorn Reviewed-by: Stéphane Guillou Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index 7b78b29bdfc5..10303b216e04 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -26,6 +26,11 @@ #include +namespace tools +{ +class Duration; +} + class SAL_WARN_UNUSED TOOLS_DLLPUBLIC DateTime : public Date, public tools::Time { public: @@ -83,6 +88,8 @@ public: voidAddTime( double fTimeInDays ); DateTime& operator +=( const tools::Time& rTime ); DateTime& operator -=( const tools::Time& rTime ); +/** Duration can be negative, so adding it will subtract its value. */ +DateTime& operator +=( const tools::Duration& rDuration ); TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, sal_Int32 nDays ); TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, sal_Int32 nDays ); @@ -94,6 +101,8 @@ public: TOOLS_DLLPUBLIC friend double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ); TOOLS_DLLPUBLIC friend sal_Int64 operator -( const DateTime& rDateTime, const Date& rDate ) { return static_cast(rDateTime) - rDate; } +/** Duration can be negative, so adding it will subtract its value. */ +TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const tools::Duration& rDuration ); DateTime& operator =( const DateTime& rDateTime ); DateTime& operator =( const css::util::DateTime& rUDateTime ); diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx new file mode 100644 index ..83b9d12a77b3 --- /dev/null +++ b/include/tools/duration.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - include/tools sc/inc sc/source tools/CppunitTest_tools_test.mk tools/Library_tl.mk tools/qa tools/source
include/tools/datetime.hxx |9 + include/tools/duration.hxx | 72 + sc/inc/table.hxx |8 - sc/source/core/data/documen3.cxx |3 sc/source/core/data/table4.cxx | 117 +-- tools/CppunitTest_tools_test.mk|1 tools/Library_tl.mk|1 tools/qa/cppunit/test_duration.cxx | 278 + tools/source/datetime/datetime.cxx | 38 ++--- tools/source/datetime/duration.cxx | 258 ++ 10 files changed, 719 insertions(+), 66 deletions(-) New commits: commit 3732522cb499fa13a7ec905be0628376b7c024e3 Author: Eike Rathke AuthorDate: Sat Jun 17 00:57:42 2023 +0200 Commit: Xisco Fauli CommitDate: Wed Jul 12 09:14:34 2023 +0200 Resolves: tdf#153517 Use tools::Duration for FillSeries with (date+)time This is a combination of 3 commits. Related: tdf#153517 Introduce class tools::Duration xChange-Id: I73ea6e162c73382ba470a306ce2852dbff3d1314 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153202 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit eac63ab120a181a1dff6317ee3d223327080e992) Conflicts: include/tools/datetime.hxx Resolves: tdf#153517 Use tools::Duration for FillSeries with (date+)time xChange-Id: I18567fdac512ee786ce4b0785b01b2ae6da7450e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153203 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit 30c48379c7b791edc615e7691691e344baa455a3) Fix TB Jenkins_Linux_Ubsan (duration.cxx) /tools/source/datetime/duration.cxx:190:77: runtime error: negation of -2147483648 cannot be represented in type 'sal_Int32' (aka 'int'); cast to an unsigned type to negate this value to itself 0 0x7f08bd84936d in tools::Duration::Mult(int, bool&) const /tools/source/datetime/duration.cxx:190:77 1 0x7f08c1c1d27a in tools::DurationTest::testDuration() /tools/qa/cppunit/test_duration.cxx:219:26 Detected thanks to eac63ab120a181a1dff6317ee3d223327080e992 Related: tdf#153517 Introduce class tools::Duration xChange-Id: I3804cc4ff4011a7f3b393b82b27f0c805682fbb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153254 Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit 99d01ff26fe69ccc66f49b3ddd43b258c3687f2c) Change-Id: I18567fdac512ee786ce4b0785b01b2ae6da7450e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153209 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index 7b78b29bdfc5..10303b216e04 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -26,6 +26,11 @@ #include +namespace tools +{ +class Duration; +} + class SAL_WARN_UNUSED TOOLS_DLLPUBLIC DateTime : public Date, public tools::Time { public: @@ -83,6 +88,8 @@ public: voidAddTime( double fTimeInDays ); DateTime& operator +=( const tools::Time& rTime ); DateTime& operator -=( const tools::Time& rTime ); +/** Duration can be negative, so adding it will subtract its value. */ +DateTime& operator +=( const tools::Duration& rDuration ); TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, sal_Int32 nDays ); TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, sal_Int32 nDays ); @@ -94,6 +101,8 @@ public: TOOLS_DLLPUBLIC friend double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ); TOOLS_DLLPUBLIC friend sal_Int64 operator -( const DateTime& rDateTime, const Date& rDate ) { return static_cast(rDateTime) - rDate; } +/** Duration can be negative, so adding it will subtract its value. */ +TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const tools::Duration& rDuration ); DateTime& operator =( const DateTime& rDateTime ); DateTime& operator =( const css::util::DateTime& rUDateTime ); diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx new file mode 100644 index ..83b9d12a77b3 --- /dev/null +++ b/include/tools/duration.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include + +class DateTime; + +namespace tools +{ +/** Duration in days and time. Can be negative in which case days is 0 and time +is negative or both days and time are negative. +*/ +class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Duration +{ +public: +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - download.lst
download.lst |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 05916bdfe0fa29150f6edb7ea7f2a8d33b76ccb4 Author: Eike Rathke AuthorDate: Tue Jun 27 13:39:13 2023 +0200 Commit: Michael Stahl CommitDate: Wed Jun 28 11:10:02 2023 +0200 Update language-subtag-registry to 2023-05-11 Change-Id: Ieb1c3eab66c06c8e7b3d9751d9e4548dbd7efc04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153643 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit bc82afbfd320ecf5e7ed5dc87d1606b97dd10821) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153665 Reviewed-by: Xisco Fauli Reviewed-by: Michael Stahl diff --git a/download.lst b/download.lst index 24b3ae91da00..3e7b6beafda4 100644 --- a/download.lst +++ b/download.lst @@ -275,8 +275,8 @@ LIBJPEG_TURBO_TARBALL := libjpeg-turbo-2.1.5.1.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -LANGTAGREG_SHA256SUM := e2d9224e0e50fc8ad12a3cf47396bbcadf45b2515839d4770432653a88972c00 -LANGTAGREG_TARBALL := language-subtag-registry-2022-08-08.tar.bz2 +LANGTAGREG_SHA256SUM := 9042b64cd473bf36073513b474046f13778107b57c2ac47fb2633104120d69da +LANGTAGREG_TARBALL := language-subtag-registry-2023-05-11.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - download.lst
download.lst |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 03661c8f5a07e49fe54ae521d250aa45080cdbf2 Author: Eike Rathke AuthorDate: Tue Jun 27 13:39:13 2023 +0200 Commit: Xisco Fauli CommitDate: Tue Jun 27 22:35:13 2023 +0200 Update language-subtag-registry to 2023-05-11 Change-Id: Ieb1c3eab66c06c8e7b3d9751d9e4548dbd7efc04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153643 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 41dbc7eb47f5f0392da77cd6693249471e135fcb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153664 diff --git a/download.lst b/download.lst index 8d9f83b8db7a..ae37b394ae52 100644 --- a/download.lst +++ b/download.lst @@ -279,8 +279,8 @@ LIBJPEG_TURBO_TARBALL := libjpeg-turbo-2.1.5.1.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -LANGTAGREG_SHA256SUM := e2d9224e0e50fc8ad12a3cf47396bbcadf45b2515839d4770432653a88972c00 -LANGTAGREG_TARBALL := language-subtag-registry-2022-08-08.tar.bz2 +LANGTAGREG_SHA256SUM := 9042b64cd473bf36073513b474046f13778107b57c2ac47fb2633104120d69da +LANGTAGREG_TARBALL := language-subtag-registry-2023-05-11.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts
[Libreoffice-commits] core.git: download.lst
download.lst |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit bc82afbfd320ecf5e7ed5dc87d1606b97dd10821 Author: Eike Rathke AuthorDate: Tue Jun 27 13:39:13 2023 +0200 Commit: Eike Rathke CommitDate: Tue Jun 27 16:56:29 2023 +0200 Update language-subtag-registry to 2023-05-11 Change-Id: Ieb1c3eab66c06c8e7b3d9751d9e4548dbd7efc04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153643 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/download.lst b/download.lst index d38c37f48cf3..c25d371f47e7 100644 --- a/download.lst +++ b/download.lst @@ -279,8 +279,8 @@ LIBJPEG_TURBO_TARBALL := libjpeg-turbo-2.1.5.1.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -LANGTAGREG_SHA256SUM := e2d9224e0e50fc8ad12a3cf47396bbcadf45b2515839d4770432653a88972c00 -LANGTAGREG_TARBALL := language-subtag-registry-2022-08-08.tar.bz2 +LANGTAGREG_SHA256SUM := 9042b64cd473bf36073513b474046f13778107b57c2ac47fb2633104120d69da +LANGTAGREG_TARBALL := language-subtag-registry-2023-05-11.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/formula sc/inc sc/source
include/formula/tokenarray.hxx |5 + sc/inc/document.hxx|2 +- sc/inc/formulacell.hxx |3 ++- sc/source/core/data/formulacell.cxx|8 +++- sc/source/filter/oox/formulabuffer.cxx | 31 --- sc/source/ui/view/output2.cxx | 13 +++-- 6 files changed, 46 insertions(+), 16 deletions(-) New commits: commit 447296c3c2676c855d98200b03bcec15310629bc Author: Eike Rathke AuthorDate: Thu Feb 23 01:22:16 2023 +0100 Commit: Aron Budea CommitDate: Sat Jun 24 12:28:48 2023 +0200 Resolves: tdf#153767 Try harder to import OOXML bool shared formula result ... by setting the result value or if necessary recalculating even if AutoCalc is turned off for the document. Similar for other implicitly recalculating formula types. Also set a boolean number format if none. Change-Id: I2f75735707180eccf4b2c525738ac0b763901230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147425 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 05ac57f85eb622b798719db03bbdd07b79e1703a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147444 Reviewed-by: Xisco Fauli (cherry picked from commit 816b0e97f32df82a1ffc23950d5bf21760a4cd39) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153546 Tested-by: Jenkins CollaboraOffice Reviewed-by: Aron Budea diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx index 6b373ff44e15..e3c44e934a11 100644 --- a/include/formula/tokenarray.hxx +++ b/include/formula/tokenarray.hxx @@ -429,6 +429,11 @@ public: example OOXML. */ boolIsRecalcModeMustAfterImport() const { return (nMode & ScRecalcMode::EMask) <= ScRecalcMode::ONLOAD_ONCE; } +voidClearRecalcModeMustAfterImport() +{ +if (IsRecalcModeMustAfterImport() && !IsRecalcModeAlways()) +SetExclusiveRecalcModeNormal(); +} /** Get OpCode of the most outer function */ inline OpCode GetOuterFuncOpCode() const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 4f06b4b6473b..1188bbd9da2c 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1226,7 +1226,7 @@ public: SC_DLLPUBLIC sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; sal_uInt32GetNumberFormat( const ScRange& rRange ) const; SC_DLLPUBLIC sal_uInt32 GetNumberFormat( const ScInterpreterContext& rContext, const ScAddress& ) const; -void SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberFormat ); +SC_DLLPUBLIC void SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberFormat ); void GetNumberFormatInfo( const ScInterpreterContext& rContext, SvNumFormatType& nType, sal_uInt32& nIndex, const ScAddress& rPos ) const; SC_DLLPUBLIC const ScFormulaCell* GetFormulaCell( const ScAddress& rPos ) const; diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 013a0058ba5d..6c1bca21f035 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -443,7 +443,8 @@ public: if (!IsDirtyOrInTableOpDirty()) return false; -return (rDocument.GetAutoCalc() || (cMatrixFlag != ScMatrixMode::NONE)); +return rDocument.GetAutoCalc() || (cMatrixFlag != ScMatrixMode::NONE) +|| (pCode->IsRecalcModeMustAfterImport() && !pCode->IsRecalcModeAlways()); } void MaybeInterpret() diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 93cc0697090d..9547dcf8c072 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2331,6 +2331,8 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa OSL_ENSURE( pCode->GetCodeError() != FormulaError::NONE, "no RPN code and no errors ?!?!" ); ResetDirty(); } + +pCode->ClearRecalcModeMustAfterImport(); } void ScFormulaCell::HandleStuffAfterParallelCalculation(ScInterpreter* pInterpreter) @@ -2546,7 +2548,7 @@ void ScFormulaCell::SetDirty( bool bDirtyFlag ) // the FormulaTree, once in there it would be assumed that its // dependents already had been tracked and it would be skipped on a // subsequent notify. Postpone tracking until all listeners are set. -if (!rDocument.IsImportingXML()) +if (!rDocument.IsImportingXML() && !rDocument.IsInsertingFromOtherDoc()) rDocument.TrackFormulas(); } @@ -2647,10 +2649,6 @@ void
[Libreoffice-commits] core.git: avmedia/source include/unotools sd/source sfx2/source unotools/source vcl/source
avmedia/source/framework/MediaControlBase.cxx |7 +-- include/unotools/localedatawrapper.hxx|8 ++-- sd/source/ui/slideshow/showwin.cxx|3 ++- sfx2/source/dialog/dinfdlg.cxx| 10 ++ unotools/source/i18n/localedatawrapper.cxx| 21 + vcl/source/control/field2.cxx |9 +++-- 6 files changed, 39 insertions(+), 19 deletions(-) New commits: commit c20337889469e41cec89bd421fab533f16b4b451 Author: Eike Rathke AuthorDate: Fri Jun 23 14:44:44 2023 +0200 Commit: Eike Rathke CommitDate: Sat Jun 24 01:20:12 2023 +0200 Change LocaleDataWrapper::getDuration() parameter to tools::Duration ... instead of tools::Time Change-Id: I8e49de43a1870541d75add34089eec67b7a8be31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153533 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/avmedia/source/framework/MediaControlBase.cxx b/avmedia/source/framework/MediaControlBase.cxx index d2c254293811..fb8f91066b67 100644 --- a/avmedia/source/framework/MediaControlBase.cxx +++ b/avmedia/source/framework/MediaControlBase.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -46,9 +47,11 @@ void MediaControlBase::UpdateTimeField( MediaItem const & aMediaItem, double fTi SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); -aTimeString += rLocaleData.getDuration( tools::Time( 0, 0, static_cast< sal_uInt32 >( floor( fTime ) ) ) ) + +aTimeString += rLocaleData.getDuration( +tools::Duration( 0, 0, 0, static_cast( floor( fTime )), 0)) + " / " + -rLocaleData.getDuration( tools::Time( 0, 0, static_cast< sal_uInt32 >( floor( aMediaItem.getDuration() ) )) ); +rLocaleData.getDuration( +tools::Duration( 0, 0, 0, static_cast( floor( aMediaItem.getDuration())), 0)); if( mxTimeEdit->get_text() != aTimeString ) mxTimeEdit->set_text( aTimeString ); diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx index 5fbdcd0782b7..d6eeb174e735 100644 --- a/include/unotools/localedatawrapper.hxx +++ b/include/unotools/localedatawrapper.hxx @@ -42,7 +42,11 @@ namespace com::sun::star::i18n { struct FormatElement; } namespace com::sun::star::i18n { struct CalendarItem2; } class Date; -namespace tools { class Time; } +namespace tools +{ +class Time; +class Duration; +} class CalendarWrapper; enum class DateOrder { @@ -311,7 +315,7 @@ public: OUString getDate( const Date& rDate ) const; OUString getTime( const tools::Time& rTime, bool bSec = true, bool b100Sec = false ) const; -OUString getDuration( const tools::Time& rTime, +OUString getDuration( const tools::Duration& rDuration, bool bSec = true, bool b100Sec = false ) const; /** Simple number formatting diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx index 8e1f8a6d49cd..4bc0d414307c 100644 --- a/sd/source/ui/slideshow/showwin.cxx +++ b/sd/source/ui/slideshow/showwin.cxx @@ -38,6 +38,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -512,7 +513,7 @@ void ShowWindow::DrawPauseScene( bool bTimeoutOnly ) SvtSysLocaleaSysLocale; const LocaleDataWrapper&aLocaleData = aSysLocale.GetLocaleData(); -aText += " ( " + aLocaleData.getDuration( ::tools::Time( 0, 0, mnPauseTimeout ) ) + " )"; +aText += " ( " + aLocaleData.getDuration( ::tools::Duration( 0, 0, 0, mnPauseTimeout, 0 )) + " )"; pVDev->DrawText( Point( aOffset.Width(), 0 ), aText ); GetOutDev()->DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, *pVDev ); bDrawn = true; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index f702c2ec10c1..5c564af981a2 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -745,8 +746,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, DeleteHdl, weld::Button&, void) m_xCreateValFt->set_label( ConvertDateTime_Impl( aName, uDT, rLocaleWrapper ) ); m_xChangeValFt->set_label( "" ); m_xPrintValFt->set_label( "" ); -const tools::Time aTime( 0 ); -m_xTimeLogValFt->set_label( rLocaleWrapper.getDuration( aTime ) ); +m_xTimeLogValFt->set_label( rLocaleWrapper.getDuration( tools::Duration() ) ); m_xDocNoValFt->set_label(OUString('1')); bHandleDelete = true; } @@ -1065,8 +1065,10 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) const tools::Long nTime = rInfoItem.getEditingDuration(); if ( bUseUserData ) { -
[Libreoffice-commits] core.git: include/tools tools/qa tools/source
include/tools/duration.hxx | 12 ++ tools/qa/cppunit/test_duration.cxx | 65 +- tools/source/datetime/duration.cxx | 70 + 3 files changed, 115 insertions(+), 32 deletions(-) New commits: commit c968d8989004301b49d67a093a6eb8a629533837 Author: Eike Rathke AuthorDate: Fri Jun 23 12:42:29 2023 +0200 Commit: Eike Rathke CommitDate: Fri Jun 23 18:32:17 2023 +0200 Introduce tools::Duration individual time values ctor Change-Id: I516d3727cbcf6667b32dc963febbf4b753ef6a91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153497 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx index a027cd671cd1..ea33953751b8 100644 --- a/include/tools/duration.hxx +++ b/include/tools/duration.hxx @@ -39,6 +39,14 @@ public: unless one is 0. */ Duration(sal_Int32 nDays, const Time& rTime); +/** Individual time values can be out-of-range, all will be normalized. +Additionally, the resulting time overall hour value is not restricted +to sal_uInt16 like it is with Time, as values >=24 flow over into days. +For a negative duration only a negative nDays can be given, thus a +negative duration of less than one day is not possible. */ +Duration(sal_Int32 nDays, sal_uInt32 nHours, sal_uInt32 nMinutes, sal_uInt32 nSeconds, + sal_uInt64 nNanoseconds); + bool IsNegative() const { return mnDays < 0 || maTime.GetTime() < 0; } sal_Int32 GetDays() const { return mnDays; } const Time& GetTime() const { return maTime; } @@ -60,6 +68,10 @@ private: /** Internal days and Time values. */ Duration(sal_Int32 nDays, sal_Int64 nTime); +/** Prerequisite: mnDays is already set. */ +void Normalize(sal_uInt64 nHours, sal_uInt64 nMinutes, sal_uInt64 nSeconds, + sal_uInt64 nNanoseconds, bool bNegative); + /** Prerequisite: mnDays is already correctly set and absolute value of nanoseconds less than one day. */ void ApplyTime(sal_Int64 nNS); diff --git a/tools/qa/cppunit/test_duration.cxx b/tools/qa/cppunit/test_duration.cxx index c328db7cec38..c4032be83a03 100644 --- a/tools/qa/cppunit/test_duration.cxx +++ b/tools/qa/cppunit/test_duration.cxx @@ -114,12 +114,73 @@ void DurationTest::testDuration() } { // 235929599 seconds == SAL_MAX_UINT16 hours + 59 minutes + 59 seconds -const Duration aD(0, Time(0, 0, 235929599)); +const Duration aD(0, Time(0, 0, 235929599, Time::nanoSecPerSec - 1)); CPPUNIT_ASSERT_EQUAL(static_cast(2730), aD.GetDays()); CPPUNIT_ASSERT_EQUAL(static_cast(15), aD.GetTime().GetHour()); CPPUNIT_ASSERT_EQUAL(static_cast(59), aD.GetTime().GetMin()); CPPUNIT_ASSERT_EQUAL(static_cast(59), aD.GetTime().GetSec()); -CPPUNIT_ASSERT_EQUAL(static_cast(0), aD.GetTime().GetNanoSec()); +CPPUNIT_ASSERT_EQUAL(static_cast(9), aD.GetTime().GetNanoSec()); +} +{ +// 235929599 seconds == SAL_MAX_UINT16 hours + 59 minutes + 59 seconds +const Duration aD(0, 0, 0, 235929599, Time::nanoSecPerSec - 1); +CPPUNIT_ASSERT_EQUAL(static_cast(2730), aD.GetDays()); +CPPUNIT_ASSERT_EQUAL(static_cast(15), aD.GetTime().GetHour()); +CPPUNIT_ASSERT_EQUAL(static_cast(59), aD.GetTime().GetMin()); +CPPUNIT_ASSERT_EQUAL(static_cast(59), aD.GetTime().GetSec()); +CPPUNIT_ASSERT_EQUAL(static_cast(9), aD.GetTime().GetNanoSec()); +} +{ +const Duration aD(1, 2, 3, 4, 5); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aD.GetDays()); +CPPUNIT_ASSERT_EQUAL(static_cast(2), aD.GetTime().GetHour()); +CPPUNIT_ASSERT_EQUAL(static_cast(3), aD.GetTime().GetMin()); +CPPUNIT_ASSERT_EQUAL(static_cast(4), aD.GetTime().GetSec()); +CPPUNIT_ASSERT_EQUAL(static_cast(5), aD.GetTime().GetNanoSec()); +} +{ +const Duration aD(-1, 2, 3, 4, 5); +CPPUNIT_ASSERT(aD.IsNegative()); +CPPUNIT_ASSERT_EQUAL(static_cast(-1), aD.GetDays()); +CPPUNIT_ASSERT_EQUAL(static_cast(2), aD.GetTime().GetHour()); +CPPUNIT_ASSERT_EQUAL(static_cast(3), aD.GetTime().GetMin()); +CPPUNIT_ASSERT_EQUAL(static_cast(4), aD.GetTime().GetSec()); +CPPUNIT_ASSERT_EQUAL(static_cast(5), aD.GetTime().GetNanoSec()); +} +{ +const Duration aD(1, SAL_MAX_UINT32, SAL_MAX_UINT32, SAL_MAX_UINT32, SAL_MAX_UINT64); +CPPUNIT_ASSERT_EQUAL(static_cast(182202802), aD.GetDays()); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aD.GetTime().GetHour()); +CPPUNIT_ASSERT_EQUAL(static_cast(17), aD.GetTime().GetMin()); +CPPUNIT_ASSERT_EQUAL(static_cast(48), aD.GetTime().GetSec()); +CPPUNIT_ASSERT_EQUAL(static_cast(709551615), aD.GetTime().GetNanoSec()); +} +{ +const Duration aD(-1,
[Libreoffice-commits] core.git: tools/source
tools/source/datetime/ttime.cxx | 12 1 file changed, 12 insertions(+) New commits: commit b07d72c6c1075efa6b64c67758566426c22c5225 Author: Eike Rathke AuthorDate: Wed Jun 21 21:46:17 2023 +0200 Commit: Eike Rathke CommitDate: Fri Jun 23 14:27:05 2023 +0200 Clamp and assert maximum hours value in Time::init() Change-Id: Ia777222f3c797b90663b55499a57025e410b1d70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153407 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index 148bf0cbecc6..fcfa2e080e99 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -125,6 +125,18 @@ void tools::Time::init( sal_uInt32 nHour, sal_uInt32 nMin, sal_uInt32 nSec, sal_ nHour+= nMin / minInHour; nMin %= minInHour; +// 922337 * HOUR_MASK = 9223370 largest possible value, 922338 +// would be -9223364073709551616. +assert(HOUR_MASK * nHour >= 0 && "use tools::Duration with days instead!"); +if (HOUR_MASK * nHour < 0) +nHour = 922337; + +// But as is, GetHour() retrieves only sal_uInt16. Though retrieving in +// nanoseconds or milliseconds might be possible this is all crap. +assert(nHour <= SAL_MAX_UINT16 && "use tools::Duration with days instead!"); +if (nHour > SAL_MAX_UINT16) +nHour = SAL_MAX_UINT16; + // construct time nTime = nNanoSec + nSec * SEC_MASK +
[Libreoffice-commits] core.git: include/tools tools/qa tools/source
include/tools/duration.hxx |5 +++ tools/qa/cppunit/test_duration.cxx | 17 ++ tools/source/datetime/duration.cxx | 58 + 3 files changed, 80 insertions(+) New commits: commit 986c2d86a7b53a6599d014db7327f47cb33d4fea Author: Eike Rathke AuthorDate: Wed Jun 21 21:56:56 2023 +0200 Commit: Eike Rathke CommitDate: Thu Jun 22 01:40:00 2023 +0200 Introduce tools::Duration(sal_Int32 nDays, const Time& rTime) ctor Change-Id: If002e04536149b49b2249103ac914d17dec3fae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153409 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx index 83b9d12a77b3..a027cd671cd1 100644 --- a/include/tools/duration.hxx +++ b/include/tools/duration.hxx @@ -34,6 +34,11 @@ public: /** Difference in days, like DateTime()-DateTime(). */ explicit Duration(double fTimeInDays); +/** Time can be a limited duration as well and can have out-of-range +values, it will be normalized. Sign of both days and Time must be equal +unless one is 0. */ +Duration(sal_Int32 nDays, const Time& rTime); + bool IsNegative() const { return mnDays < 0 || maTime.GetTime() < 0; } sal_Int32 GetDays() const { return mnDays; } const Time& GetTime() const { return maTime; } diff --git a/tools/qa/cppunit/test_duration.cxx b/tools/qa/cppunit/test_duration.cxx index 0f5a4e002219..c328db7cec38 100644 --- a/tools/qa/cppunit/test_duration.cxx +++ b/tools/qa/cppunit/test_duration.cxx @@ -104,6 +104,23 @@ void DurationTest::testDuration() const Duration aN = -aD; CPPUNIT_ASSERT_EQUAL(1.5, aN.GetInDays()); } +{ +const Duration aD(1, Time(2, 3, 4, 5)); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aD.GetDays()); +CPPUNIT_ASSERT_EQUAL(static_cast(2), aD.GetTime().GetHour()); +CPPUNIT_ASSERT_EQUAL(static_cast(3), aD.GetTime().GetMin()); +CPPUNIT_ASSERT_EQUAL(static_cast(4), aD.GetTime().GetSec()); +CPPUNIT_ASSERT_EQUAL(static_cast(5), aD.GetTime().GetNanoSec()); +} +{ +// 235929599 seconds == SAL_MAX_UINT16 hours + 59 minutes + 59 seconds +const Duration aD(0, Time(0, 0, 235929599)); +CPPUNIT_ASSERT_EQUAL(static_cast(2730), aD.GetDays()); +CPPUNIT_ASSERT_EQUAL(static_cast(15), aD.GetTime().GetHour()); +CPPUNIT_ASSERT_EQUAL(static_cast(59), aD.GetTime().GetMin()); +CPPUNIT_ASSERT_EQUAL(static_cast(59), aD.GetTime().GetSec()); +CPPUNIT_ASSERT_EQUAL(static_cast(0), aD.GetTime().GetNanoSec()); +} { // Add() const DateTime aS(Date(23, 11, 1999), Time(0, 0, 0)); const DateTime aE(Date(23, 11, 1999), Time(1, 23, 45)); diff --git a/tools/source/datetime/duration.cxx b/tools/source/datetime/duration.cxx index 3aa195cfbda5..255706f0486a 100644 --- a/tools/source/datetime/duration.cxx +++ b/tools/source/datetime/duration.cxx @@ -86,6 +86,64 @@ Duration::Duration(double fTimeInDays) } } +Duration::Duration(sal_Int32 nDays, const Time& rTime) +: mnDays(nDays) +{ +assert(nDays == 0 || rTime.GetTime() == 0 || (nDays < 0) == (rTime.GetTime() < 0)); +sal_uInt64 nN = rTime.GetNanoSec(); +sal_uInt64 nS = rTime.GetSec(); +if (nN >= Time::nanoSecPerSec) +{ +nS += nN / Time::nanoSecPerSec; +nN %= Time::nanoSecPerSec; +} +sal_uInt64 nM = rTime.GetMin(); +if (nS >= Time::secondPerMinute) +{ +nM += nS / Time::secondPerMinute; +nS %= Time::secondPerMinute; +} +sal_uInt64 nH = rTime.GetHour(); +if (nM >= Time::minutePerHour) +{ +nH += nM / Time::minutePerHour; +nM %= Time::minutePerHour; +} +if (nH >= Time::hourPerDay) +{ +sal_Int64 nDiff = nH / Time::hourPerDay; +nH %= Time::hourPerDay; +bool bOverflow = false; +if (rTime.GetTime() < 0) +{ +nDiff = -nDiff; +bOverflow = (nDiff < SAL_MIN_INT32); +bOverflow |= o3tl::checked_add(mnDays, static_cast(nDiff), mnDays); +if (bOverflow) +mnDays = SAL_MIN_INT32; +} +else +{ +bOverflow = (nDiff > SAL_MAX_INT32); +bOverflow |= o3tl::checked_add(mnDays, static_cast(nDiff), mnDays); +if (bOverflow) +mnDays = SAL_MAX_INT32; +} +assert(!bOverflow); +if (bOverflow) +{ +nH = Time::hourPerDay - 1; +nM = Time::minutePerHour - 1; +nS = Time::secondPerMinute - 1; +nN = Time::nanoSecPerSec - 1; +} +} +maTime = Time(nH, nM, nS, nN); +if (rTime.GetTime() < 0) +maTime = -maTime; +assert(mnDays == 0 || maTime.GetTime() == 0 || (mnDays < 0) == (maTime.GetTime() < 0)); +} + Duration::Duration(sal_Int32 nDays, sal_Int64 nTime) : maTime(nTime)
[Libreoffice-commits] core.git: include/tools tools/source
include/tools/datetime.hxx | 11 --- tools/source/datetime/datetime.cxx |4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) New commits: commit 9cf4983e7e6db5c2198c61c30b9c77d089105b3a Author: Eike Rathke AuthorDate: Wed Jun 21 14:31:02 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 21:48:12 2023 +0200 Change DateTime friend operator-() to return tools::Duration instead of double Change-Id: Ica69b1a8916c73443d9ec91dd35ed126fcf97151 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153392 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index 21cb65921d27..17d2f89a80b6 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -101,9 +101,14 @@ public: { return operator+( rDateTime, -fTimeInDays ); } TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const tools::Time& rTime ); TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, const tools::Time& rTime ); -TOOLS_DLLPUBLIC friend double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ); -/** Same as friend operator-() to be able to disable operator-() to find -places where tools::Duration could be used instead. */ +/** Use operator-() if a duration is to be remembered or processed. */ +TOOLS_DLLPUBLIC friend tools::Duration operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ); +/** Use Sub() if the floating point "time in days" value is to be +processed. This also takes a shortcut for whole days values (equal +times), and only for times inflicted values uses an intermediary +tools::Duration for conversion. Note that the resulting floating point +value neverthless in many cases is not an exact representation down to +nanoseconds. */ static double Sub( const DateTime& rDateTime1, const DateTime& rDateTime2 ); TOOLS_DLLPUBLIC friend sal_Int64 operator -( const DateTime& rDateTime, const Date& rDate ) { return static_cast(rDateTime) - rDate; } diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index f2e5a0e69c57..6f9dea26c6e8 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -194,9 +194,9 @@ DateTime operator +( const DateTime& rDateTime, double fTimeInDays ) return aDateTime; } -double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ) +tools::Duration operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ) { -return DateTime::Sub( rDateTime1, rDateTime2); +return tools::Duration( rDateTime2, rDateTime1); } // static
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - tools/source
tools/source/datetime/duration.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 9a52d5b11c74d996f9300f8b4126635aad0e8317 Author: Eike Rathke AuthorDate: Wed Jun 21 14:32:55 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 18:46:15 2023 +0200 rbOverflow was already set for bBadNS, unnecessary to set it again Change-Id: I26e32b25b53be590bc24646803c7442385ec4d3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153393 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit b72a7c01b927912dd746f033b2ad4933e46b1b86) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153411 diff --git a/tools/source/datetime/duration.cxx b/tools/source/datetime/duration.cxx index 7140e2b99579..1199ced39443 100644 --- a/tools/source/datetime/duration.cxx +++ b/tools/source/datetime/duration.cxx @@ -173,7 +173,6 @@ Duration Duration::Mult(sal_Int32 nMult, bool& rbOverflow) const const sal_uInt64 nMult64 = (nMult < 0) ? -nMult : nMult; do { -rbOverflow = true; sal_uInt64 nN; if (o3tl::checked_multiply(static_cast(maTime.GetNanoSec()), nMult64, nN)) break;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - tools/source
tools/source/datetime/datetime.cxx | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) New commits: commit f42a9bf1a4520115954bc25d12d11da841e50b9d Author: Eike Rathke AuthorDate: Tue Jun 20 15:07:59 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 16:38:08 2023 +0200 Use tools::Duration in friend double operator-() if DateTime has Time set Change-Id: Iff3e2aad596fdfd1530c46cdeff28b44e5142517 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153327 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit d3d77d99e3e6f05b232923edc2ea23e513a721d5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153349 diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index ec2c53673b17..bb4c1ff173a5 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -196,18 +196,13 @@ DateTime operator +( const DateTime& rDateTime, double fTimeInDays ) double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ) { -sal_Int32 nDays = static_cast(rDateTime1) -- static_cast(rDateTime2); -sal_Int64 nTime = rDateTime1.GetNSFromTime() - rDateTime2.GetNSFromTime(); -if ( nTime ) +if (static_cast(rDateTime1) != static_cast(rDateTime2)) { -double fTime = double(nTime); -fTime /= ::tools::Time::nanoSecPerDay; // convert from nanoseconds to fraction -if ( nDays < 0 && fTime > 0.0 ) -fTime = 1.0 - fTime; -return double(nDays) + fTime; +// Use Duration to diminish floating point accuracy errors. +const tools::Duration aDuration( rDateTime2, rDateTime1); +return aDuration.GetInDays(); } -return double(nDays); +return static_cast(rDateTime1) - static_cast(rDateTime2); } void DateTime::GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper ) const
[Libreoffice-commits] core.git: tools/source
tools/source/datetime/duration.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit c7b2277f57cf72b7dc6e4cbd179ce40951fbae8c Author: Eike Rathke AuthorDate: Wed Jun 21 14:32:55 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 16:34:46 2023 +0200 rbOverflow was already set for bBadNS, unnecessary to set it again Change-Id: I26e32b25b53be590bc24646803c7442385ec4d3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153393 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/tools/source/datetime/duration.cxx b/tools/source/datetime/duration.cxx index be51a6e95e0f..3aa195cfbda5 100644 --- a/tools/source/datetime/duration.cxx +++ b/tools/source/datetime/duration.cxx @@ -173,7 +173,6 @@ Duration Duration::Mult(sal_Int32 nMult, bool& rbOverflow) const const sal_uInt64 nMult64 = (nMult < 0) ? -nMult : nMult; do { -rbOverflow = true; sal_uInt64 nN; if (o3tl::checked_multiply(static_cast(maTime.GetNanoSec()), nMult64, nN)) break;
[Libreoffice-commits] core.git: sw/source
sw/source/core/fields/flddat.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit dd33515b8c1a718f314683235738131cb2759bb1 Author: Eike Rathke AuthorDate: Wed Jun 21 11:48:30 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 15:55:48 2023 +0200 sw: Use DateTime::Sub() instead of operator-() Change-Id: I0c2ce0e3eb6eab70e694adc567b688b579bb52d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153385 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx index 51246f6eea0e..3dcaf848f417 100644 --- a/sw/source/core/fields/flddat.cxx +++ b/sw/source/core/fields/flddat.cxx @@ -124,7 +124,7 @@ double SwDateTimeField::GetDateTime(SwDoc& rDoc, const DateTime& rDT) SvNumberFormatter* pFormatter = rDoc.GetNumberFormatter(); const Date& rNullDate = pFormatter->GetNullDate(); -double fResult = rDT - DateTime(rNullDate); +double fResult = DateTime::Sub(rDT, DateTime(rNullDate)); return fResult; }
[Libreoffice-commits] core.git: svl/source
svl/source/numbers/zforfind.cxx |2 +- svl/source/numbers/zformat.cxx | 10 +- 2 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 02fc35d879dda6e9c48c89fbb09fe1c618d6673b Author: Eike Rathke AuthorDate: Wed Jun 21 10:57:52 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 13:15:16 2023 +0200 svl: Use DateTime::Sub() instead of operator-() Change-Id: I036798013404df4bcfb988d4f231fcf30cec3162 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153382 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index da993232e677..b99f32c1e5b2 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -2265,7 +2265,7 @@ input for the following reasons: if ( res && pCal->isValid() ) { -double fDiff = DateTime(*moNullDate) - pCal->getEpochStart(); +double fDiff = DateTime::Sub( DateTime(*moNullDate), pCal->getEpochStart()); fDays = ::rtl::math::approxFloor( pCal->getLocalDateTime() ); fDays -= fDiff; nTryOrder = nFormatOrder; // break for diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 5128c5cca118..62bd7957d635 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3228,7 +3228,7 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, case NF_KEY_AMPM: // AM/PM if ( !bCalendarSet ) { -double fDiff = DateTime(rScan.GetNullDate()) - GetCal().getEpochStart(); +double fDiff = DateTime::Sub( DateTime(rScan.GetNullDate()), GetCal().getEpochStart()); fDiff += fNumberOrig; GetCal().setLocalDateTime( fDiff ); bCalendarSet = true; @@ -3688,13 +3688,13 @@ static bool lcl_getValidDate( const DateTime& rNullDate, const DateTime& rEpochS static const DateTime aCE( Date(1,1,1)); static const DateTime aMin( Date(1,1, SAL_MIN_INT16)); static const DateTime aMax( Date(31,12, SAL_MAX_INT16), tools::Time(23,59,59, tools::Time::nanoSecPerSec - 1)); -static const double fMin = aMin - aCE; -static const double fMax = aMax - aCE; +static const double fMin = DateTime::Sub( aMin, aCE); +static const double fMax = DateTime::Sub( aMax, aCE); // Value must be representable in our tools::Date proleptic Gregorian // calendar as well. -const double fOff = (rNullDate - aCE) + fNumber; +const double fOff = DateTime::Sub( rNullDate, aCE) + fNumber; // Add diff between epochs to serial date number. -const double fDiff = rNullDate - rEpochStart; +const double fDiff = DateTime::Sub( rNullDate, rEpochStart); fNumber += fDiff; return fMin <= fOff && fOff <= fMax; }
[Libreoffice-commits] core.git: 2 commits - include/unotools sc/source
include/unotools/calendarwrapper.hxx |2 +- sc/source/filter/excel/xlroot.cxx |2 +- sc/source/filter/oox/pivotcachebuffer.cxx |2 +- sc/source/ui/docshell/impex.cxx |5 +++-- sc/source/ui/view/viewfun6.cxx|7 ++- 5 files changed, 8 insertions(+), 10 deletions(-) New commits: commit ea4f47752391cecef670cbefc9dbfc8b51182c49 Author: Eike Rathke AuthorDate: Wed Jun 21 10:48:40 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 12:48:51 2023 +0200 sc: Use DateTime::Sub() instead of operator-() Change-Id: Ib73eec1c11ced76890b8eacb0079ae336072a4c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153379 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 71d308d2f29c..f816339b34d7 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -341,7 +341,7 @@ const DateTime theExcelCutOverDate( Date( 1, 3, 1900 )); double XclRoot::GetDoubleFromDateTime( const DateTime& rDateTime ) const { -double fValue = rDateTime - GetNullDate(); +double fValue = DateTime::Sub( rDateTime, GetNullDate()); // adjust dates before 1900-03-01 to get correct time values in the range [0.0,1.0) /* XXX: this is only used when reading BIFF, otherwise we'd have to check * for dateCompatibility==true as mentioned below. */ diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx index 4896f3123e92..cbbacc8a6123 100644 --- a/sc/source/filter/oox/pivotcachebuffer.cxx +++ b/sc/source/filter/oox/pivotcachebuffer.cxx @@ -253,7 +253,7 @@ OUString PivotCacheItem::getFormattedName(const ScDPSaveDimension& rSaveDim, ScD SAL_WARN("sc", "PivotCacheField::getFormattedName - invalid date"); return OUString(); } -return pObj->GetFormattedString(rSaveDim.GetName(), aDateTime - rNullDate); +return pObj->GetFormattedString(rSaveDim.GetName(), DateTime::Sub(aDateTime, rNullDate)); } case XML_e: return maValue.get< OUString >(); } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index c405fb2c45a3..970e75aadd9e 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1426,8 +1426,9 @@ static bool lcl_PutString( pCalendar->setValue( i18n::CalendarFieldIndex::MILLISECOND, 0 ); if ( pCalendar->isValid() ) { -double fDiff = DateTime(pDocFormatter->GetNullDate()) - -pCalendar->getEpochStart(); +// Whole days diff. +double fDiff = DateTime::Sub( DateTime(pDocFormatter->GetNullDate()), +pCalendar->getEpochStart()); // #i14974# must use getLocalDateTime to get the same // date values as set above double fDays = pCalendar->getLocalDateTime() + fFrac; diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index 2a68f730b9bf..e8e9dbc554ed 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -334,7 +334,7 @@ void ScViewFunc::InsertCurrentTime(SvNumFormatType nReqFmt, const OUString& rUnd case SvNumFormatType::DATETIME: { DateTime aActDateTime( DateTime::SYSTEM ); -fVal = aActDateTime - DateTime( pFormatter->GetNullDate()); +fVal = DateTime::Sub( aActDateTime, DateTime( pFormatter->GetNullDate())); if (nCurNumFormatType == SvNumFormatType::DATETIME) nFormat = nCurNumFormat; } @@ -470,10 +470,7 @@ void ScViewFunc::InsertCurrentTime(SvNumFormatType nReqFmt, const OUString& rUnd default: { DateTime aActDateTime( DateTime::SYSTEM ); -// Converting the null date to DateTime forces the -// correct operator-() to be used, resulting in a -// fractional date+time instead of only date value. -fVal = aActDateTime - DateTime( pFormatter->GetNullDate()); +fVal = DateTime::Sub( aActDateTime, DateTime( pFormatter->GetNullDate())); } } break; commit ba54ce4c65b2fcaa549ec3962604c4d5c9bd10fd Author: Eike Rathke AuthorDate: Wed Jun 21 10:42:51 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 12:48:37 2023 +0200 Use DateTime::Sub() instead of operator-() Commit this central place use early. Change-Id: Ib2e40ae7fbe9dc219ba0a7ec4e0f12a82d7b37b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153378
[Libreoffice-commits] core.git: include/tools tools/source
include/tools/datetime.hxx |3 +++ tools/source/datetime/datetime.cxx |6 ++ 2 files changed, 9 insertions(+) New commits: commit 66da786bdd4588b31755058acf46034c2056215c Author: Eike Rathke AuthorDate: Tue Jun 20 16:05:58 2023 +0200 Commit: Eike Rathke CommitDate: Wed Jun 21 02:17:19 2023 +0200 Introduce double DateTime::Sub() as a substitute for friend double operator-() Change-Id: Idb93b3e9b4dcbd09ad7f4253a523fe5be24d0776 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153354 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index 2194711dc208..21cb65921d27 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -102,6 +102,9 @@ public: TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const tools::Time& rTime ); TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, const tools::Time& rTime ); TOOLS_DLLPUBLIC friend double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ); +/** Same as friend operator-() to be able to disable operator-() to find +places where tools::Duration could be used instead. */ +static double Sub( const DateTime& rDateTime1, const DateTime& rDateTime2 ); TOOLS_DLLPUBLIC friend sal_Int64 operator -( const DateTime& rDateTime, const Date& rDate ) { return static_cast(rDateTime) - rDate; } /** Duration can be negative, so adding it will subtract its value. */ diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index bb4c1ff173a5..f2e5a0e69c57 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -195,6 +195,12 @@ DateTime operator +( const DateTime& rDateTime, double fTimeInDays ) } double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ) +{ +return DateTime::Sub( rDateTime1, rDateTime2); +} + +// static +double DateTime::Sub( const DateTime& rDateTime1, const DateTime& rDateTime2 ) { if (static_cast(rDateTime1) != static_cast(rDateTime2)) {
[Libreoffice-commits] core.git: tools/source
tools/source/datetime/datetime.cxx | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) New commits: commit d3d77d99e3e6f05b232923edc2ea23e513a721d5 Author: Eike Rathke AuthorDate: Tue Jun 20 15:07:59 2023 +0200 Commit: Eike Rathke CommitDate: Tue Jun 20 16:52:23 2023 +0200 Use tools::Duration in friend double operator-() if DateTime has Time set Change-Id: Iff3e2aad596fdfd1530c46cdeff28b44e5142517 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153327 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index ec2c53673b17..bb4c1ff173a5 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -196,18 +196,13 @@ DateTime operator +( const DateTime& rDateTime, double fTimeInDays ) double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ) { -sal_Int32 nDays = static_cast(rDateTime1) -- static_cast(rDateTime2); -sal_Int64 nTime = rDateTime1.GetNSFromTime() - rDateTime2.GetNSFromTime(); -if ( nTime ) +if (static_cast(rDateTime1) != static_cast(rDateTime2)) { -double fTime = double(nTime); -fTime /= ::tools::Time::nanoSecPerDay; // convert from nanoseconds to fraction -if ( nDays < 0 && fTime > 0.0 ) -fTime = 1.0 - fTime; -return double(nDays) + fTime; +// Use Duration to diminish floating point accuracy errors. +const tools::Duration aDuration( rDateTime2, rDateTime1); +return aDuration.GetInDays(); } -return double(nDays); +return static_cast(rDateTime1) - static_cast(rDateTime2); } void DateTime::GetWin32FileDateTime( sal_uInt32 & rLower, sal_uInt32 & rUpper ) const
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/interpr5.cxx | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) New commits: commit 174a72f3fd50d1146d6bedd4cc2a1971aa33be67 Author: Eike Rathke AuthorDate: Mon Jun 19 16:52:40 2023 +0200 Commit: Eike Rathke CommitDate: Mon Jun 19 18:29:12 2023 +0200 Use tools::Duration in ScInterpreter::CalculateAddSub() ... for all (date+)time inflicted operands. Change-Id: I93043d912867e2ef7d4af271b5c4566a3ffb4ef9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153291 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index b27e27c5e188..dcb5ee6ea343 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -1220,6 +1221,7 @@ void ScInterpreter::CalculateAddSub(bool _bSub) double fVal1 = 0.0, fVal2 = 0.0; SvNumFormatType nFmt1, nFmt2; nFmt1 = nFmt2 = SvNumFormatType::UNDEFINED; +bool bDuration = false; SvNumFormatType nFmtCurrencyType = nCurFmtType; sal_uLong nFmtCurrencyIndex = nCurFmtIndex; SvNumFormatType nFmtPercentType = nCurFmtType; @@ -1235,6 +1237,7 @@ void ScInterpreter::CalculateAddSub(bool _bSub) case SvNumFormatType::DATETIME : case SvNumFormatType::DURATION : nFmt2 = nCurFmtType; +bDuration = true; break; case SvNumFormatType::CURRENCY : nFmtCurrencyType = nCurFmtType; @@ -1258,6 +1261,7 @@ void ScInterpreter::CalculateAddSub(bool _bSub) case SvNumFormatType::DATETIME : case SvNumFormatType::DURATION : nFmt1 = nCurFmtType; +bDuration = true; break; case SvNumFormatType::CURRENCY : nFmtCurrencyType = nCurFmtType; @@ -1334,10 +1338,22 @@ void ScInterpreter::CalculateAddSub(bool _bSub) if (nFmtPercentType == SvNumFormatType::PERCENT && nFuncFmtType == SvNumFormatType::NUMBER) nFuncFmtType = SvNumFormatType::PERCENT; } -if ( _bSub ) -PushDouble( ::rtl::math::approxSub( fVal1, fVal2 ) ); +if ((nFuncFmtType == SvNumFormatType::DURATION || bDuration) +&& ((_bSub && std::fabs(fVal1 - fVal2) <= SAL_MAX_INT32) +|| (!_bSub && std::fabs(fVal1 + fVal2) <= SAL_MAX_INT32))) +{ +if (_bSub) +PushDouble( ::tools::Duration( fVal1 - fVal2).GetInDays()); +else +PushDouble( ::tools::Duration( fVal1 + fVal2).GetInDays()); +} else -PushDouble( ::rtl::math::approxAdd( fVal1, fVal2 ) ); +{ +if (_bSub) +PushDouble( ::rtl::math::approxSub( fVal1, fVal2 ) ); +else +PushDouble( ::rtl::math::approxAdd( fVal1, fVal2 ) ); +} } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - 2 commits - include/tools sc/inc sc/source tools/CppunitTest_tools_test.mk tools/Library_tl.mk tools/qa tools/source
include/tools/datetime.hxx |9 + include/tools/duration.hxx | 72 + sc/inc/table.hxx |8 - sc/source/core/data/documen3.cxx |3 sc/source/core/data/table4.cxx | 117 +-- tools/CppunitTest_tools_test.mk|1 tools/Library_tl.mk|1 tools/qa/cppunit/test_duration.cxx | 278 + tools/source/datetime/datetime.cxx | 38 ++--- tools/source/datetime/duration.cxx | 256 ++ 10 files changed, 717 insertions(+), 66 deletions(-) New commits: commit 0770c99928fa0c4af23b06cbf694ee77ee78b836 Author: Eike Rathke AuthorDate: Sat Jun 17 01:05:48 2023 +0200 Commit: Eike Rathke CommitDate: Sat Jun 17 18:04:56 2023 +0200 Resolves: tdf#153517 Use tools::Duration for FillSeries with (date+)time Change-Id: I18567fdac512ee786ce4b0785b01b2ae6da7450e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153203 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit 45bee6b9a0e620758d0d4079d832d80095164b0a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153219 diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index a2cc60f9d70e..0662053cb89c 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -715,7 +715,8 @@ public: sc::UpdatedRangeNames& rIndexes) const; voidFill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt64 nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, -double nStepValue, double nMaxValue, ScProgress* pProgress); +double nStepValue, const tools::Duration& rDurationStep, +double nMaxValue, ScProgress* pProgress); OUStringGetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY ); void UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark ); @@ -1191,13 +1192,14 @@ private: voidFillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt64 nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, -double nStepValue, double nMaxValue, sal_uInt16 nMinDigits, +double nStepValue, const tools::Duration& rDurationStep, +double nMaxValue, sal_uInt16 nMinDigits, bool bAttribs, ScProgress* pProgress, bool bSkipOverlappedCells = false, std::vector* pNonOverlappedCellIdx = nullptr); voidFillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, FillCmd& rCmd, FillDateCmd& rDateCmd, -double& rInc, sal_uInt16& rMinDigits, +double& rInc, tools::Duration& rDuration, sal_uInt16& rMinDigits, ScUserListData*& rListData, sal_uInt16& rListIndex, bool bHasFiltered, bool& rSkipOverlappedCells, std::vector& rNonOverlappedCellIdx ); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index b1cf5fe81b8c..8d0d2ba9a665 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1171,7 +1172,7 @@ void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScProg { maTabs[rTab]->Fill(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, eFillCmd, eFillDateCmd, -nStepValue, nMaxValue, pProgress); +nStepValue, tools::Duration(), nMaxValue, pProgress); RefreshAutoFilter(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), rTab); } } diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 10c27f8d2c84..9c6852990efe 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -215,32 +216,20 @@ double approxDiff( double a, double b ) return rtl::math::round(c, -std::max(nExp, nExpArg)); } -double approxTimeDiff( double a, double b ) +double approxTypedDiff( double a, double b, bool bTime, tools::Duration& rDuration ) { -// Scale to hours, round to "nanohours" (multiple nanoseconds), scale back. -// Get back 0.0417 instead of 0.04166700621136 or -// 0.0414241347 (raw a-b) for one hour, or worse the approxDiff() -// 0.0416665997 value. Though there is no such
[Libreoffice-commits] core.git: sc/inc sc/source
sc/inc/table.hxx |8 +- sc/source/core/data/documen3.cxx |3 - sc/source/core/data/table4.cxx | 117 --- 3 files changed, 81 insertions(+), 47 deletions(-) New commits: commit 30c48379c7b791edc615e7691691e344baa455a3 Author: Eike Rathke AuthorDate: Sat Jun 17 01:05:48 2023 +0200 Commit: Eike Rathke CommitDate: Sat Jun 17 16:10:08 2023 +0200 Resolves: tdf#153517 Use tools::Duration for FillSeries with (date+)time Change-Id: I18567fdac512ee786ce4b0785b01b2ae6da7450e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153203 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index a2cc60f9d70e..0662053cb89c 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -715,7 +715,8 @@ public: sc::UpdatedRangeNames& rIndexes) const; voidFill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt64 nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, -double nStepValue, double nMaxValue, ScProgress* pProgress); +double nStepValue, const tools::Duration& rDurationStep, +double nMaxValue, ScProgress* pProgress); OUStringGetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY ); void UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark ); @@ -1191,13 +1192,14 @@ private: voidFillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt64 nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, -double nStepValue, double nMaxValue, sal_uInt16 nMinDigits, +double nStepValue, const tools::Duration& rDurationStep, +double nMaxValue, sal_uInt16 nMinDigits, bool bAttribs, ScProgress* pProgress, bool bSkipOverlappedCells = false, std::vector* pNonOverlappedCellIdx = nullptr); voidFillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, FillCmd& rCmd, FillDateCmd& rDateCmd, -double& rInc, sal_uInt16& rMinDigits, +double& rInc, tools::Duration& rDuration, sal_uInt16& rMinDigits, ScUserListData*& rListData, sal_uInt16& rListIndex, bool bHasFiltered, bool& rSkipOverlappedCells, std::vector& rNonOverlappedCellIdx ); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index b1cf5fe81b8c..8d0d2ba9a665 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1171,7 +1172,7 @@ void ScDocument::Fill(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScProg { maTabs[rTab]->Fill(nCol1, nRow1, nCol2, nRow2, nFillCount, eFillDir, eFillCmd, eFillDateCmd, -nStepValue, nMaxValue, pProgress); +nStepValue, tools::Duration(), nMaxValue, pProgress); RefreshAutoFilter(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), rTab); } } diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 10c27f8d2c84..9c6852990efe 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -215,32 +216,20 @@ double approxDiff( double a, double b ) return rtl::math::round(c, -std::max(nExp, nExpArg)); } -double approxTimeDiff( double a, double b ) +double approxTypedDiff( double a, double b, bool bTime, tools::Duration& rDuration ) { -// Scale to hours, round to "nanohours" (multiple nanoseconds), scale back. -// Get back 0.0417 instead of 0.04166700621136 or -// 0.0414241347 (raw a-b) for one hour, or worse the approxDiff() -// 0.0416665997 value. Though there is no such correct value, -// IEEE-754 nearest values are -// 0.041664353702032030923874117434024810791015625 -// (0x3FA5) and -// 0.04167129259593593815225176513195037841796875 -// (0x3FA6). -// This works also for a diff of seconds, unless corner cases would be -// discovered, which would make it necessary to ditch the floating point -// and convert to/from time structure values instead. -return rtl::math::round((a - b) * 24, 9) / 24; -} -
[Libreoffice-commits] core.git: include/tools tools/CppunitTest_tools_test.mk tools/Library_tl.mk tools/qa tools/source
include/tools/datetime.hxx |9 + include/tools/duration.hxx | 72 + tools/CppunitTest_tools_test.mk|1 tools/Library_tl.mk|1 tools/qa/cppunit/test_duration.cxx | 278 + tools/source/datetime/datetime.cxx | 38 ++--- tools/source/datetime/duration.cxx | 256 ++ 7 files changed, 636 insertions(+), 19 deletions(-) New commits: commit eac63ab120a181a1dff6317ee3d223327080e992 Author: Eike Rathke AuthorDate: Sat Jun 17 00:57:42 2023 +0200 Commit: Eike Rathke CommitDate: Sat Jun 17 15:16:09 2023 +0200 Related: tdf#153517 Introduce class tools::Duration Change-Id: I73ea6e162c73382ba470a306ce2852dbff3d1314 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153202 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index dd435e3994ba..2194711dc208 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -26,6 +26,11 @@ #include +namespace tools +{ +class Duration; +} + class SAL_WARN_UNUSED TOOLS_DLLPUBLIC DateTime : public Date, public tools::Time { public: @@ -83,6 +88,8 @@ public: voidAddTime( double fTimeInDays ); DateTime& operator +=( const tools::Time& rTime ); DateTime& operator -=( const tools::Time& rTime ); +/** Duration can be negative, so adding it will subtract its value. */ +DateTime& operator +=( const tools::Duration& rDuration ); private: voidNormalizeTimeRemainderAndApply( tools::Time& rTime ); public: @@ -97,6 +104,8 @@ public: TOOLS_DLLPUBLIC friend double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ); TOOLS_DLLPUBLIC friend sal_Int64 operator -( const DateTime& rDateTime, const Date& rDate ) { return static_cast(rDateTime) - rDate; } +/** Duration can be negative, so adding it will subtract its value. */ +TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const tools::Duration& rDuration ); DateTime& operator =( const DateTime& rDateTime ); DateTime& operator =( const css::util::DateTime& rUDateTime ); diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx new file mode 100644 index ..83b9d12a77b3 --- /dev/null +++ b/include/tools/duration.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include + +class DateTime; + +namespace tools +{ +/** Duration in days and time. Can be negative in which case days is 0 and time +is negative or both days and time are negative. +*/ +class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Duration +{ +public: +Duration() {} + +/** Assumes that DateTime are normalized and there are no Time out-of-range +field values. */ +Duration(const ::DateTime& rStart, const ::DateTime& rEnd); + +/** Time can be a limited duration as well. We don't cater for out-of-range +minutes and seconds values here though. */ +Duration(const Time& rStart, const Time& rEnd); + +/** Difference in days, like DateTime()-DateTime(). */ +explicit Duration(double fTimeInDays); + +bool IsNegative() const { return mnDays < 0 || maTime.GetTime() < 0; } +sal_Int32 GetDays() const { return mnDays; } +const Time& GetTime() const { return maTime; } +double GetInDays() const { return static_cast(GetDays()) + GetTime().GetTimeInDays(); } + +/** Whether a duration is set. */ +operator bool() const { return maTime.GetTime() != 0 || mnDays != 0; } + +/** Unary minus. */ +Duration operator-() const; + +/** Add a duration to this instance. */ +Duration& Add(const Duration& rDuration, bool& rbOverflow); + +/** Get multiple of duration. */ +Duration Mult(sal_Int32 nMult, bool& rbOverflow) const; + +private: +/** Internal days and Time values. */ +Duration(sal_Int32 nDays, sal_Int64 nTime); + +/** Prerequisite: mnDays is already correctly set and absolute value of +nanoseconds less than one day. */ +void ApplyTime(sal_Int64 nNS); + +/** Prerequisite: mnDays is already correctly set and Time hour values +are adjusted. */ +void SetTimeDiff(const Time& rStart, const Time& rEnd); + +private: +Time maTime = Time(0); +sal_Int32 mnDays = 0; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk index 9cf6c671fcef..d27f8c3efa58 100644 ---
[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - sc/source
sc/source/filter/html/htmlpars.cxx | 10 ++ 1 file changed, 10 insertions(+) New commits: commit bf50bfb5aa1f0dae37a703f1dc0ca1199693c3ce Author: Eike Rathke AuthorDate: Sat Feb 5 22:43:13 2022 +0100 Commit: Gabor Kelemen CommitDate: Fri Jun 9 23:07:02 2023 +0200 Resolves: tdf#74577 tdf#92960 Create missing offsets in very outer table ... if local table is outer table. Change-Id: I5996609264f4ad9efa8d76a8d0ab730bf1dded24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129540 Reviewed-by: Eike Rathke Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152805 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index ae46949e4b21..34f481eba09c 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -752,6 +752,16 @@ void ScHTMLLayoutParser::SetWidths() sal_uInt16 nMax = static_cast(pLocalColOffset->back()); if ( aPageSize.Width() < nMax ) aPageSize.setWidth( nMax ); +if (nTableLevel == 0) +{ +// Local table is very outer table, create missing offsets. +for (auto it = pLocalColOffset->begin(); it != pLocalColOffset->end(); ++it) +{ +// Only exact offsets, do not use MakeColNoRef(). +if (maColOffset.find(*it) == maColOffset.end()) +maColOffset.insert(*it); +} +} } for ( size_t i = nFirstTableCell, nListSize = maList.size(); i < nListSize; ++i ) {
[Libreoffice-commits] core.git: include/tools tools/source
include/tools/datetime.hxx |3 ++ tools/source/datetime/datetime.cxx | 48 +++-- 2 files changed, 18 insertions(+), 33 deletions(-) New commits: commit 7e3ddf1e5aae5e4e956495e3d86a8cbf6e251b5e Author: Eike Rathke AuthorDate: Sat May 27 23:14:30 2023 +0200 Commit: Eike Rathke CommitDate: Sun May 28 03:49:55 2023 +0200 Factor out DateTime::NormalizeTimeRemainderAndApply(tools::Time& rTime) Change-Id: Ie520b10baaeb4c94973c44435c3241e5d2254968 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152345 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index 7b78b29bdfc5..dd435e3994ba 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -83,6 +83,9 @@ public: voidAddTime( double fTimeInDays ); DateTime& operator +=( const tools::Time& rTime ); DateTime& operator -=( const tools::Time& rTime ); +private: +voidNormalizeTimeRemainderAndApply( tools::Time& rTime ); +public: TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, sal_Int32 nDays ); TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, sal_Int32 nDays ); diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index efdb928986c3..47dc0555bc87 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -94,33 +94,37 @@ sal_Int64 DateTime::GetSecFromDateTime( const Date& rDate ) const } } -DateTime& DateTime::operator +=( const tools::Time& rTime ) +void DateTime::NormalizeTimeRemainderAndApply( tools::Time& rTime ) { -tools::Time aTime = *this; -aTime += rTime; -sal_uInt16 nHours = aTime.GetHour(); -if ( aTime.GetTime() > 0 ) +sal_uInt16 nHours = rTime.GetHour(); +if ( rTime.GetTime() > 0 ) { if (nHours >= 24) { AddDays( nHours / 24 ); nHours %= 24; -aTime.SetHour( nHours ); +rTime.SetHour( nHours ); } } -else if ( aTime.GetTime() != 0 ) +else if ( rTime.GetTime() != 0 ) { if (nHours >= 24) { AddDays( -static_cast(nHours) / 24 ); nHours %= 24; -aTime.SetHour( nHours ); +rTime.SetHour( nHours ); } Date::operator--(); -aTime = Time( 24, 0, 0 )+aTime; +rTime = Time( 24, 0, 0 ) + rTime; } -tools::Time::operator=( aTime ); +tools::Time::operator=( rTime ); +} +DateTime& DateTime::operator +=( const tools::Time& rTime ) +{ +tools::Time aTime = *this; +aTime += rTime; +NormalizeTimeRemainderAndApply(aTime); return *this; } @@ -128,29 +132,7 @@ DateTime& DateTime::operator -=( const tools::Time& rTime ) { tools::Time aTime = *this; aTime -= rTime; -sal_uInt16 nHours = aTime.GetHour(); -if ( aTime.GetTime() > 0 ) -{ -if (nHours >= 24) -{ -AddDays( nHours / 24 ); -nHours %= 24; -aTime.SetHour( nHours ); -} -} -else if ( aTime.GetTime() != 0 ) -{ -if (nHours >= 24) -{ -AddDays( -static_cast(nHours) / 24 ); -nHours %= 24; -aTime.SetHour( nHours ); -} -Date::operator--(); -aTime = Time( 24, 0, 0 )+aTime; -} -tools::Time::operator=( aTime ); - +NormalizeTimeRemainderAndApply(aTime); return *this; }
[Libreoffice-commits] core.git: tools/source
tools/source/datetime/datetime.cxx | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) New commits: commit 261063e69e80193ad563e086c515fd6e22e48464 Author: Eike Rathke AuthorDate: Thu May 18 23:30:51 2023 +0200 Commit: Eike Rathke CommitDate: Fri May 19 02:29:18 2023 +0200 Eliminate 24h loops in DateTime::operator+=/-=(tools::Time&) ... and repeated Date::operator++/--() that each calculate lcl_DaysToDate( GetAsNormalizedDays() + 1 ) where Date::AddDays() does it once. Also, that probably never worked correctly with negative time results >=24h Change-Id: Ic67aaa3d93e0d6533501d52671acf765e2d9bbdd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151984 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index 00790ff78dd4..efdb928986c3 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -101,19 +101,20 @@ DateTime& DateTime::operator +=( const tools::Time& rTime ) sal_uInt16 nHours = aTime.GetHour(); if ( aTime.GetTime() > 0 ) { -while ( nHours >= 24 ) +if (nHours >= 24) { -Date::operator++(); -nHours -= 24; +AddDays( nHours / 24 ); +nHours %= 24; +aTime.SetHour( nHours ); } -aTime.SetHour( nHours ); } else if ( aTime.GetTime() != 0 ) { -while ( nHours >= 24 ) +if (nHours >= 24) { -Date::operator--(); -nHours -= 24; +AddDays( -static_cast(nHours) / 24 ); +nHours %= 24; +aTime.SetHour( nHours ); } Date::operator--(); aTime = Time( 24, 0, 0 )+aTime; @@ -130,19 +131,20 @@ DateTime& DateTime::operator -=( const tools::Time& rTime ) sal_uInt16 nHours = aTime.GetHour(); if ( aTime.GetTime() > 0 ) { -while ( nHours >= 24 ) +if (nHours >= 24) { -Date::operator++(); -nHours -= 24; +AddDays( nHours / 24 ); +nHours %= 24; +aTime.SetHour( nHours ); } -aTime.SetHour( nHours ); } else if ( aTime.GetTime() != 0 ) { -while ( nHours >= 24 ) +if (nHours >= 24) { -Date::operator--(); -nHours -= 24; +AddDays( -static_cast(nHours) / 24 ); +nHours %= 24; +aTime.SetHour( nHours ); } Date::operator--(); aTime = Time( 24, 0, 0 )+aTime;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source
sc/source/core/tool/token.cxx | 35 --- 1 file changed, 28 insertions(+), 7 deletions(-) New commits: commit 41fb05d4b21ab8fd5a522ff8eba6844333fbf4cf Author: Eike Rathke AuthorDate: Tue May 16 17:33:36 2023 +0200 Commit: Christian Lohmaier CommitDate: Wed May 17 14:02:49 2023 +0200 Resolves: tdf#153790 Suppress duplicated end part sheet reference, tdf#103890 Also keep explicitly given sheet reference relative to the same sheet as user wished. Affected only when moving formula cell position like with cut and drag Change-Id: I6b1da6aea58b88a24567189ef6aa212dab01de49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151845 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit fcb66a74ae3af322b2829040bb84669d5c63e568) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151782 Reviewed-by: Christian Lohmaier diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 4315f017e67c..337a2fb86d21 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -3416,7 +3416,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove( } rRef.SetAddress(*mxSheetLimits, aAbs, rNewPos); -rRef.SetFlag3D(aAbs.Tab() != rNewPos.Tab() || !rRef.IsTabRel()); +rRef.SetFlag3D(rRef.IsFlag3D() || !rRef.IsTabRel() || aAbs.Tab() != rNewPos.Tab()); } break; case svDoubleRef: @@ -3446,12 +3446,33 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove( } rRef.SetRange(*mxSheetLimits, aAbs, rNewPos); -// Absolute sheet reference => set 3D flag. -// More than one sheet referenced => has to have both 3D flags. -// If end part has 3D flag => start part must have it too. -rRef.Ref2.SetFlag3D(aAbs.aStart.Tab() != aAbs.aEnd.Tab() || !rRef.Ref2.IsTabRel()); -rRef.Ref1.SetFlag3D(aAbs.aStart.Tab() != rNewPos.Tab() || !rRef.Ref1.IsTabRel() || -rRef.Ref2.IsFlag3D()); +bool b1, b2; +if (aAbs.aStart.Tab() != aAbs.aEnd.Tab()) +{ +// More than one sheet referenced => has to have +// both 3D flags. +b1 = b2 = true; +} +else +{ +// Keep given 3D flag even for relative sheet +// reference to same sheet. +// Absolute sheet reference => set 3D flag. +// Reference to another sheet => set 3D flag. +b1 = rRef.Ref1.IsFlag3D() || !rRef.Ref1.IsTabRel() || rNewPos.Tab() != aAbs.aStart.Tab(); +b2 = rRef.Ref2.IsFlag3D() || !rRef.Ref2.IsTabRel() || rNewPos.Tab() != aAbs.aEnd.Tab(); +// End part has 3D flag => start part must have it too. +if (b2) +b1 = true; +// End part sheet reference is identical to start +// part sheet reference and end part sheet +// reference was not explicitly given => clear end +// part 3D flag. +if (b1 && b2 && rRef.Ref1.IsTabRel() == rRef.Ref2.IsTabRel() && !rRef.Ref2.IsFlag3D()) +b2 = false; +} +rRef.Ref1.SetFlag3D(b1); +rRef.Ref2.SetFlag3D(b2); } break; case svExternalSingleRef:
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/token.cxx | 35 --- 1 file changed, 28 insertions(+), 7 deletions(-) New commits: commit fcb66a74ae3af322b2829040bb84669d5c63e568 Author: Eike Rathke AuthorDate: Tue May 16 17:33:36 2023 +0200 Commit: Eike Rathke CommitDate: Wed May 17 00:42:06 2023 +0200 Resolves: tdf#153790 Suppress duplicated end part sheet reference, tdf#103890 Also keep explicitly given sheet reference relative to the same sheet as user wished. Affected only when moving formula cell position like with cut and drag Change-Id: I6b1da6aea58b88a24567189ef6aa212dab01de49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151845 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 4315f017e67c..337a2fb86d21 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -3416,7 +3416,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove( } rRef.SetAddress(*mxSheetLimits, aAbs, rNewPos); -rRef.SetFlag3D(aAbs.Tab() != rNewPos.Tab() || !rRef.IsTabRel()); +rRef.SetFlag3D(rRef.IsFlag3D() || !rRef.IsTabRel() || aAbs.Tab() != rNewPos.Tab()); } break; case svDoubleRef: @@ -3446,12 +3446,33 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnMove( } rRef.SetRange(*mxSheetLimits, aAbs, rNewPos); -// Absolute sheet reference => set 3D flag. -// More than one sheet referenced => has to have both 3D flags. -// If end part has 3D flag => start part must have it too. -rRef.Ref2.SetFlag3D(aAbs.aStart.Tab() != aAbs.aEnd.Tab() || !rRef.Ref2.IsTabRel()); -rRef.Ref1.SetFlag3D(aAbs.aStart.Tab() != rNewPos.Tab() || !rRef.Ref1.IsTabRel() || -rRef.Ref2.IsFlag3D()); +bool b1, b2; +if (aAbs.aStart.Tab() != aAbs.aEnd.Tab()) +{ +// More than one sheet referenced => has to have +// both 3D flags. +b1 = b2 = true; +} +else +{ +// Keep given 3D flag even for relative sheet +// reference to same sheet. +// Absolute sheet reference => set 3D flag. +// Reference to another sheet => set 3D flag. +b1 = rRef.Ref1.IsFlag3D() || !rRef.Ref1.IsTabRel() || rNewPos.Tab() != aAbs.aStart.Tab(); +b2 = rRef.Ref2.IsFlag3D() || !rRef.Ref2.IsTabRel() || rNewPos.Tab() != aAbs.aEnd.Tab(); +// End part has 3D flag => start part must have it too. +if (b2) +b1 = true; +// End part sheet reference is identical to start +// part sheet reference and end part sheet +// reference was not explicitly given => clear end +// part 3D flag. +if (b1 && b2 && rRef.Ref1.IsTabRel() == rRef.Ref2.IsTabRel() && !rRef.Ref2.IsFlag3D()) +b2 = false; +} +rRef.Ref1.SetFlag3D(b1); +rRef.Ref2.SetFlag3D(b2); } break; case svExternalSingleRef:
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/column3.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit cda59e72ea7dbd904012ff377588d71ea8c4a2bc Author: Eike Rathke AuthorDate: Tue May 16 17:56:14 2023 +0200 Commit: Eike Rathke CommitDate: Tue May 16 19:42:14 2023 +0200 Remove nonsense OSL_ENSURE() Apparently a legacy leftover; it's perfectly valid to remove EDITATTR along with CONTENTS, i.e. in Cut. Change-Id: I10010e1fc98b5e5863d041d72ddf78d499a0ec45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151846 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 9c035b3b44d0..f615a02e94c3 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1137,7 +1137,6 @@ void ScColumn::DeleteArea( if ( nDelFlag & InsertDeleteFlags::EDITATTR ) { -OSL_ENSURE( nContFlag == InsertDeleteFlags::NONE, "DeleteArea: Wrong Flags" ); RemoveEditAttribs(aBlockPos, nStartRow, nEndRow); }
[Libreoffice-commits] core.git: helpcontent2
helpcontent2 |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f75b4eca9f9f81abbace8fdf192293feed90565c Author: Eike Rathke AuthorDate: Tue May 9 13:59:06 2023 +0200 Commit: Gerrit Code Review CommitDate: Tue May 9 13:59:06 2023 +0200 Update git submodules * Update helpcontent2 from branch 'master' to 59861677cc4ca59020718033f675b54f49fc0b74 - Size in characters, not bytes; tdf#153574 follow-up Change-Id: I67a23a18801d152579f521692550d22493e0cb24 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/151577 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/helpcontent2 b/helpcontent2 index d0d854aabafc..59861677cc4c 16 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit d0d854aabafc612def2622647c8e85b599fcc097 +Subproject commit 59861677cc4ca59020718033f675b54f49fc0b74
[Libreoffice-commits] help.git: source/text
source/text/scalc/05/0214.xhp |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 59861677cc4ca59020718033f675b54f49fc0b74 Author: Eike Rathke AuthorDate: Tue May 9 13:41:14 2023 +0200 Commit: Eike Rathke CommitDate: Tue May 9 13:59:05 2023 +0200 Size in characters, not bytes; tdf#153574 follow-up Change-Id: I67a23a18801d152579f521692550d22493e0cb24 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/151577 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/source/text/scalc/05/0214.xhp b/source/text/scalc/05/0214.xhp index 914d9635b1..26be7ce4d1 100644 --- a/source/text/scalc/05/0214.xhp +++ b/source/text/scalc/05/0214.xhp @@ -193,7 +193,7 @@ - Compiler: an identifier in the formula exceeds 1024 bytes in size. Interpreter: a result of a string operation exceeds 256 MB in size. + Compiler: an identifier in the formula exceeds 1024 characters (UTF-16 code points) in size. Interpreter: a result of a string operation would exceed 256M characters (UTF-16 code points, so 512MiB) in size.
[Libreoffice-commits] core.git: oox/source
oox/source/helper/attributelist.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit c742ab96ccac05465d87e860838c92f1f370aea3 Author: Eike Rathke AuthorDate: Mon May 8 14:25:28 2023 +0200 Commit: Eike Rathke CommitDate: Mon May 8 23:18:46 2023 +0200 Do not copy decodeXString() string and analyse if there is nothing to decode ... which usually isn't. Change-Id: I1cadc5a4c0072d5152173ad41e54e25c224e96db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151509 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index 037483cefb5a..7a973975f3d2 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -98,6 +98,9 @@ OUString AttributeConversion::decodeXString( const OUString& rValue ) // string shorter than one encoded character - no need to decode if( rValue.getLength() < XSTRING_ENCCHAR_LEN ) return rValue; +if (rValue.indexOf(u"_x") == -1) +return rValue; + OUStringBuffer aBuffer; const sal_Unicode* pcStr = rValue.getStr(); const sal_Unicode* pcEnd = pcStr + rValue.getLength();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source
sc/source/ui/app/inputhdl.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c3135bd43e216ef33bc554597c120388cf2babe1 Author: Eike Rathke AuthorDate: Tue Apr 25 19:46:45 2023 +0200 Commit: Xisco Fauli CommitDate: Mon May 8 15:24:46 2023 +0200 Resolves: tdf#41304 Add percent operator % to reference delimiters Change-Id: I094fcb800a29de424db28e1b58f1239381a3b4a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151001 Reviewed-by: Eike Rathke Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151012 Reviewed-by: Michael Stahl diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 422a9a128508..1f9ae0c29eeb 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -364,7 +364,7 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) ScDocument& rDoc = pDocSh->GetDocument(); const sal_Unicode cSheetSep = rDoc.GetSheetSeparator(); -OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\"\t\n"); +OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~%\"\t\n"); // delimiters (in addition to ScEditUtil): only characters that are // allowed in formulas next to references and the quotation mark (so // string constants can be skipped)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source
sc/source/ui/app/inputhdl.cxx | 72 +++--- sc/source/ui/inc/rfindlst.hxx | 12 +++ 2 files changed, 53 insertions(+), 31 deletions(-) New commits: commit f6a783af88b571ff1f3df9bda31eb0aac66a2c5f Author: Eike Rathke AuthorDate: Tue Apr 25 16:44:25 2023 +0200 Commit: Caolán McNamara CommitDate: Sun May 7 20:50:47 2023 +0200 Resolves: tdf#144547 ScRangeFindList: handle references in multi-line formula Also fix a color attribution error if when dragging the reference the new reference string is longer (colored too short) or shorter (colored too much including the next characters/operator/...) than the old reference string. Change-Id: I1b39fd5778d75290a0233f51a4198753fa858f48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150979 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 82b887c026cb6b0506ebecdcbc8e4b30362ec55b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151010 Reviewed-by: Caolán McNamara diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 75655d807b73..422a9a128508 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -341,6 +341,20 @@ void ScInputHandler::SendReferenceMarks( const SfxViewShell* pViewShell, LOK_CALLBACK_REFERENCE_MARKS, aPayload.getStr() ); } +static inline void incPos( const sal_Unicode c, sal_Int32& rPos, ESelection& rSel ) +{ +++rPos; +if (c == '\n') +{ +++rSel.nEndPara; +rSel.nEndPos = 0; +} +else +{ +++rSel.nEndPos; +} +} + void ScInputHandler::InitRangeFinder( const OUString& rFormula ) { DeleteRangeFinder(); @@ -350,7 +364,7 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) ScDocument& rDoc = pDocSh->GetDocument(); const sal_Unicode cSheetSep = rDoc.GetSheetSeparator(); -OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\""); +OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\"\t\n"); // delimiters (in addition to ScEditUtil): only characters that are // allowed in formulas next to references and the quotation mark (so // string constants can be skipped) @@ -366,6 +380,7 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) sal_Int32 nLen = rFormula.getLength(); sal_Int32 nPos = 0; sal_Int32 nStart = 0; +ESelection aSel; sal_uInt16 nCount = 0; ScRange aRange; while ( nPos < nLen && nCount < RANGEFIND_MAX ) @@ -375,14 +390,16 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) { if ( pChar[nPos] == '"' ) // String { -++nPos; +incPos( pChar[nPos], nPos, aSel); while (nPosGetTitle() )); } -Color nColor = pRangeFindList->Insert( ScRangeFindData( aRange, nFlags, nStart, nPos ) ); +Color nColor = pRangeFindList->Insert( ScRangeFindData( aRange, nFlags, aSel)); -ESelection aSel( 0, nStart, 0, nPos ); SfxItemSet aSet( mpEditEngine->GetEmptyItemSet() ); aSet.Put( SvxColorItem( nColor, EE_CHAR_COLOR ) ); mpEditEngine->QuickSetAttribs( aSet, aSel ); @@ -620,8 +636,9 @@ static void lcl_Replace( EditView* pView, const OUString& rNewStr, const ESelect // To do that we need to cancel the selection from above (before QuickInsertText) pView->InsertText( OUString() ); -sal_Int32 nLen = pEngine->GetTextLen(0); -ESelection aSel( 0, nLen, 0, nLen ); +const sal_Int32 nPara = pEngine->GetParagraphCount() - 1; +const sal_Int32 nLen = pEngine->GetTextLen(nPara); +ESelection aSel( nPara, nLen, nPara, nLen ); pView->SetSelection( aSel ); // Set cursor to the end } @@ -631,8 +648,6 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) if ( pDocView && pRangeFindList && nIndex < pRangeFindList->Count() ) { ScRangeFindData& rData = pRangeFindList->GetObject( nIndex ); -sal_Int32 nOldStart = rData.nSelStart; -sal_Int32 nOldEnd = rData.nSelEnd; Color nNewColor = pRangeFindList->FindColor( rNew, nIndex ); ScRange aJustified = rNew; @@ -640,32 +655,39 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) ScDocument& rDoc = pDocView->GetViewData().GetDocument(); const ScAddress::Details aAddrDetails( rDoc, aCursorPos ); OUString aNewStr(aJustified.Format(rDoc, rData.nFlags, aAddrDetails)); -ESelection aOldSel( 0, nOldStart, 0, nOldEnd ); SfxItemSet aSet( mpEditEngine->GetEmptyItemSet() ); DataChanging(); -lcl_Replace( pTopView, aNewStr, aOldSel ); -lcl_Replace( pTableView, aNewStr, aOldSel ); +lcl_Replace( pTopView, aNewStr,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-7' - sc/source
sc/source/core/tool/interpr1.cxx |9 - 1 file changed, 8 insertions(+), 1 deletion(-) New commits: commit 4a1fad2147186f6b150cd10519dda541a4d2e6c0 Author: Eike Rathke AuthorDate: Sat Apr 29 18:59:30 2023 +0200 Commit: Michael Stahl CommitDate: Wed May 3 12:17:39 2023 +0200 Resolves: tdf#119659 Check found position for result vector Change-Id: Idc454462c47b6c7b7b7cb6c86b08650d059221c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151186 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 6b6b83b43fcae13e30a9ca67b421187a5e0d7142) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151192 Reviewed-by: Xisco Fauli Reviewed-by: Christian Lohmaier Tested-by: Michael Stahl Reviewed-by: Michael Stahl diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index eb77bf07e514..94964b1a081c 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7063,7 +7063,8 @@ void ScInterpreter::ScLookup() if (pResMat) { VectorMatrixAccessor aResMatAcc(*pResMat, bVertical); -// result array is matrix. +// Result array is matrix. +// Note this does not replicate the other dimension. if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount()) { PushNA(); @@ -7197,6 +7198,12 @@ void ScInterpreter::ScLookup() { VectorMatrixAccessor aResMatAcc(*pResMat, bVertical); // Use the matrix result array. +// Note this does not replicate the other dimension. +if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount()) +{ +PushNA(); +return; +} if (aResMatAcc.IsValue(nDelta)) PushDouble(aResMatAcc.GetDouble(nDelta)); else
[Libreoffice-commits] core.git: sc/source
sc/source/ui/miscdlgs/anyrefdg.cxx | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) New commits: commit 95c10ff05c4036587302e03e903aa849cba828f3 Author: Eike Rathke AuthorDate: Tue May 2 20:44:37 2023 +0200 Commit: Eike Rathke CommitDate: Wed May 3 00:55:25 2023 +0200 More complete positive list for ScFormulaReferenceHelper::ShowReference() Various operators were omitted so for an expression using only such like '~' range "union"/concatenation the ranges weren't highlighted; also use indexOfAny() instead of repeated indexOf(). Change-Id: I288bb8e0a2bf738bbc3a56025474a18ea18a4d13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151297 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 0ffad93cfe25..579a61ee23a9 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -263,16 +263,12 @@ void ScFormulaReferenceHelper::ShowReference(const OUString& rStr) if( !m_bEnableColorRef ) return; -if( rStr.indexOf('(') != -1 || -rStr.indexOf('+') != -1 || -rStr.indexOf('*') != -1 || -rStr.indexOf('-') != -1 || -rStr.indexOf('/') != -1 || -rStr.indexOf('&') != -1 || -rStr.indexOf('<') != -1 || -rStr.indexOf('>') != -1 || -rStr.indexOf('=') != -1 || -rStr.indexOf('^') != -1 ) +// Exclude ';' semicolon as it is the separator for ParseWithNames() used +// in ShowSimpleReference(). Also sheet separator '.' dot is part of simple +// reference (could be array col/row separator as well but then in '{' '}' +// braces). Prefer '!' exclamation mark to be intersection operator rather +// than Excel sheet separator. +if (comphelper::string::indexOfAny( rStr, u"()+-*/^%&=<>~! #[]{},|\\@", 0) != -1) { ShowFormulaReference(rStr); }
[Libreoffice-commits] core.git: i18npool/Library_localedata_others.mk i18npool/source
i18npool/Library_localedata_others.mk |1 i18npool/source/localedata/data/sat_IN.xml | 180 + i18npool/source/localedata/localedata.cxx |3 3 files changed, 183 insertions(+), 1 deletion(-) New commits: commit d5565b70bc6d3d263e1cc50fa1f343f4e1a428fe Author: Eike Rathke AuthorDate: Tue Apr 25 00:25:51 2023 +0200 Commit: Eike Rathke CommitDate: Tue May 2 12:37:20 2023 +0200 Resolves: tdf#154987 Add Santali {sat-IN} locale data Change-Id: I9da3003a4db91bfa432bb68edcf577b73df5ee2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150949 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/i18npool/Library_localedata_others.mk b/i18npool/Library_localedata_others.mk index 2c0c4e9bf928..1e9bce721a3e 100644 --- a/i18npool/Library_localedata_others.mk +++ b/i18npool/Library_localedata_others.mk @@ -121,6 +121,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,localedata_others,\ CustomTarget/i18npool/localedata/localedata_pui_CO \ CustomTarget/i18npool/localedata/localedata_puu_CG \ CustomTarget/i18npool/localedata/localedata_rw_RW \ + CustomTarget/i18npool/localedata/localedata_sat_IN \ CustomTarget/i18npool/localedata/localedata_sdj_CG \ CustomTarget/i18npool/localedata/localedata_sg_CF \ CustomTarget/i18npool/localedata/localedata_shs_CA \ diff --git a/i18npool/source/localedata/data/sat_IN.xml b/i18npool/source/localedata/data/sat_IN.xml new file mode 100644 index ..8291dbfd534f --- /dev/null +++ b/i18npool/source/localedata/data/sat_IN.xml @@ -0,0 +1,180 @@ + + + + + + + sat + Santali + + + IN + India + + + + + + + +ᱚ-ᱷ +14 +p. +pp. + + + + + + sun + ᱥᱤᱸ + ᱥᱤᱸᱜᱮ + + + mon + ᱚᱛ + ᱚᱛᱮ + + + tue + ᱵᱟ + ᱵᱟᱞᱮ + + + wed + ᱥᱟᱹᱜ + ᱥᱟᱹᱜᱩᱱ + + + thu + ᱥᱟᱹᱨ + ᱥᱟᱹᱨᱫᱤ + + + fri + ᱡᱟᱹᱨ + ᱡᱟᱹᱨᱩᱢ + + + sat + ᱧᱩᱦ + ᱧᱩᱦᱩᱢ + + + + + jan + ᱢᱟᱜᱽ + ᱢᱟᱜᱽ + + + feb + ᱯᱷᱟ.ᱜᱩᱱ + ᱯᱷᱟ.ᱜᱩᱱ + + + mar + ᱪᱟ.ᱛ + ᱪᱟ.ᱛ + + + apr + ᱵᱟ.ᱭᱥᱟ.ᱠ + ᱵᱟ.ᱭᱥᱟ.ᱠ + + + may + ᱡᱷᱮᱸᱴ + ᱡᱷᱮᱸᱴ + + + jun + ᱟᱥᱟᱲ + ᱟᱥᱟᱲ + + + jul + ᱥᱟᱱ + ᱥᱟᱱ + + + aug + ᱵᱷᱟᱫᱚᱨ + ᱵᱷᱟᱫᱚᱨ + + + sep + ᱫᱟᱥᱟᱸᱭ + ᱫᱟᱥᱟᱸᱭ + + + oct + ᱥᱚᱦᱨᱟᱭ + ᱥᱚᱦᱨᱟᱭ + + + nov + ᱟᱜᱷᱟᱬ + ᱟᱜᱷᱟᱬ + + + dec + ᱯᱩᱥ + ᱯᱩᱥ + + + + + bc + ᱡᱤ ᱢᱟ + ᱡᱤᱥᱩ ᱢᱟᱲᱟᱝ + + + ad + ᱥᱚᱱ + ᱥᱚᱱ + + + +sun + + 1 + + + + + + + ᱥᱟᱹᱨᱤ + ᱵᱷᱩᱞ + ᱯᱩᱭᱞᱩ ᱯᱮ ᱪᱟᱸᱫᱚ + ᱫᱚᱥᱟᱨ ᱯᱮ ᱪᱟᱸᱫᱚ + ᱛᱮᱥᱟᱨ ᱯᱮ ᱪᱟᱸᱫᱚ + ᱯᱩᱱᱟᱹᱜ ᱯᱮ ᱪᱟᱸᱫᱚ + ᱪᱮᱛᱟᱱ + ᱞᱟᱛᱟᱨ + Q1 + Q2 + Q3 + Q4 + + + + + diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 8f3d39c768d1..01f527a731d0 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -337,7 +337,8 @@ const struct { { "en_IL", lcl_DATA_OTHERS }, // needs to be in OTHERS instead of EN because inherits from he_IL { "pdc_US", lcl_DATA_OTHERS }, { "dv_MV", lcl_DATA_OTHERS }, -{ "mfe_MU", lcl_DATA_OTHERS } +{ "mfe_MU", lcl_DATA_OTHERS }, +{ "sat_IN", lcl_DATA_OTHERS } }; #else
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/source
sc/source/core/tool/interpr1.cxx |9 - 1 file changed, 8 insertions(+), 1 deletion(-) New commits: commit ade4e5cc9bb5a2026d8a9bdccd18c1645a7dd032 Author: Eike Rathke AuthorDate: Sat Apr 29 18:59:30 2023 +0200 Commit: Xisco Fauli CommitDate: Tue May 2 11:09:28 2023 +0200 Resolves: tdf#119659 Check found position for result vector Change-Id: Idc454462c47b6c7b7b7cb6c86b08650d059221c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151186 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 6b6b83b43fcae13e30a9ca67b421187a5e0d7142) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151191 Reviewed-by: Xisco Fauli diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index eb77bf07e514..94964b1a081c 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7063,7 +7063,8 @@ void ScInterpreter::ScLookup() if (pResMat) { VectorMatrixAccessor aResMatAcc(*pResMat, bVertical); -// result array is matrix. +// Result array is matrix. +// Note this does not replicate the other dimension. if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount()) { PushNA(); @@ -7197,6 +7198,12 @@ void ScInterpreter::ScLookup() { VectorMatrixAccessor aResMatAcc(*pResMat, bVertical); // Use the matrix result array. +// Note this does not replicate the other dimension. +if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount()) +{ +PushNA(); +return; +} if (aResMatAcc.IsValue(nDelta)) PushDouble(aResMatAcc.GetDouble(nDelta)); else
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source
sc/source/core/tool/interpr1.cxx |9 - 1 file changed, 8 insertions(+), 1 deletion(-) New commits: commit 700e918ba7c481034a4629fbbf95e829e2a2786a Author: Eike Rathke AuthorDate: Sat Apr 29 18:59:30 2023 +0200 Commit: Xisco Fauli CommitDate: Tue May 2 11:09:40 2023 +0200 Resolves: tdf#119659 Check found position for result vector Change-Id: Idc454462c47b6c7b7b7cb6c86b08650d059221c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151186 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 89e725dc3236f6f8ad226adf6508f7fc753b5572) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151190 Reviewed-by: Xisco Fauli diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index ac0fb22b6231..b833e3f48f24 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7072,7 +7072,8 @@ void ScInterpreter::ScLookup() if (pResMat) { VectorMatrixAccessor aResMatAcc(*pResMat, bVertical); -// result array is matrix. +// Result array is matrix. +// Note this does not replicate the other dimension. if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount()) { PushNA(); @@ -7206,6 +7207,12 @@ void ScInterpreter::ScLookup() { VectorMatrixAccessor aResMatAcc(*pResMat, bVertical); // Use the matrix result array. +// Note this does not replicate the other dimension. +if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount()) +{ +PushNA(); +return; +} if (aResMatAcc.IsValue(nDelta)) PushDouble(aResMatAcc.GetDouble(nDelta)); else
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/scmatrix.cxx | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-) New commits: commit 595eda782296916ddfec5f6d15e9abc5c61667ee Author: Eike Rathke AuthorDate: Mon May 1 20:17:38 2023 +0200 Commit: Eike Rathke CommitDate: Mon May 1 23:11:32 2023 +0200 Related: tdf#119659 Use ValidColRowOrReplicated() for matrix dimension check ... instead of only ValidColRowReplicated(), and check the return value. With this, the abort wouldn't had happened but an empty string returned for this case (which would had been wrong as well, but the caller has to check dimensions). Change-Id: I75218c479896893146b0e73d3c82215fe61cdf6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151235 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 1f0b6a74d95f..3fdbf3438a47 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -802,7 +802,9 @@ bool ScMatrixImpl::IsStringOrEmpty( SCSIZE nIndex ) const bool ScMatrixImpl::IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const { -ValidColRowReplicated( nC, nR ); +if (!ValidColRowOrReplicated( nC, nR )) +return false; + switch (maMat.get_type(nR, nC)) { case mdds::mtm::element_empty: @@ -816,27 +818,33 @@ bool ScMatrixImpl::IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const bool ScMatrixImpl::IsEmpty( SCSIZE nC, SCSIZE nR ) const { +if (!ValidColRowOrReplicated( nC, nR )) +return false; + // Flag must indicate an 'empty' or 'empty cell' or 'empty result' element, // but not an 'empty path' element. -ValidColRowReplicated( nC, nR ); return maMat.get_type(nR, nC) == mdds::mtm::element_empty && maMatFlag.get_integer(nR, nC) != SC_MATFLAG_EMPTYPATH; } bool ScMatrixImpl::IsEmptyCell( SCSIZE nC, SCSIZE nR ) const { +if (!ValidColRowOrReplicated( nC, nR )) +return false; + // Flag must indicate an 'empty cell' element instead of an // 'empty' or 'empty result' or 'empty path' element. -ValidColRowReplicated( nC, nR ); return maMat.get_type(nR, nC) == mdds::mtm::element_empty && maMatFlag.get_type(nR, nC) == mdds::mtm::element_empty; } bool ScMatrixImpl::IsEmptyResult( SCSIZE nC, SCSIZE nR ) const { +if (!ValidColRowOrReplicated( nC, nR )) +return false; + // Flag must indicate an 'empty result' element instead of an // 'empty' or 'empty cell' or 'empty path' element. -ValidColRowReplicated( nC, nR ); return maMat.get_type(nR, nC) == mdds::mtm::element_empty && maMatFlag.get_integer(nR, nC) == SC_MATFLAG_EMPTYRESULT; } @@ -860,7 +868,9 @@ bool ScMatrixImpl::IsValue( SCSIZE nIndex ) const bool ScMatrixImpl::IsValue( SCSIZE nC, SCSIZE nR ) const { -ValidColRowReplicated(nC, nR); +if (!ValidColRowOrReplicated( nC, nR )) +return false; + switch (maMat.get_type(nR, nC)) { case mdds::mtm::element_boolean: @@ -874,7 +884,9 @@ bool ScMatrixImpl::IsValue( SCSIZE nC, SCSIZE nR ) const bool ScMatrixImpl::IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const { -ValidColRowReplicated(nC, nR); +if (!ValidColRowOrReplicated( nC, nR )) +return false; + switch (maMat.get_type(nR, nC)) { case mdds::mtm::element_boolean: @@ -889,7 +901,9 @@ bool ScMatrixImpl::IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const bool ScMatrixImpl::IsBoolean( SCSIZE nC, SCSIZE nR ) const { -ValidColRowReplicated( nC, nR ); +if (!ValidColRowOrReplicated( nC, nR )) +return false; + return maMat.get_type(nR, nC) == mdds::mtm::element_boolean; }
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/interpr1.cxx |9 - 1 file changed, 8 insertions(+), 1 deletion(-) New commits: commit 6b6b83b43fcae13e30a9ca67b421187a5e0d7142 Author: Eike Rathke AuthorDate: Sat Apr 29 18:59:30 2023 +0200 Commit: Eike Rathke CommitDate: Sat Apr 29 20:03:00 2023 +0200 Resolves: tdf#119659 Check found position for result vector Change-Id: Idc454462c47b6c7b7b7cb6c86b08650d059221c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151186 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index bc7711f08f06..9e2277f60392 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7078,7 +7078,8 @@ void ScInterpreter::ScLookup() if (pResMat) { VectorMatrixAccessor aResMatAcc(*pResMat, bVertical); -// result array is matrix. +// Result array is matrix. +// Note this does not replicate the other dimension. if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount()) { PushNA(); @@ -7212,6 +7213,12 @@ void ScInterpreter::ScLookup() { VectorMatrixAccessor aResMatAcc(*pResMat, bVertical); // Use the matrix result array. +// Note this does not replicate the other dimension. +if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount()) +{ +PushNA(); +return; +} if (aResMatAcc.IsValue(nDelta)) PushDouble(aResMatAcc.GetDouble(nDelta)); else
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source
sc/source/filter/oox/sheetdatacontext.cxx | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) New commits: commit 3e7702774b7309e8fa07930d2960e4e619bfb291 Author: Eike Rathke AuthorDate: Thu Apr 27 14:56:36 2023 +0200 Commit: Xisco Fauli CommitDate: Fri Apr 28 10:53:55 2023 +0200 Resolves: tdf#155046 Accept true and false as 1 and 0 for OOXML boolean cells Encountered in the wild written by https://www.npmjs.com/package/excel4node https://github.com/advisr-io/excel4node/blob/c14213abb9a511ff786c574e473f53006a85e4f9/source/lib/cell/cell.js#L74 Change-Id: Ib21242a55f0d8530fd9120b07a096a9908f451bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151101 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit e45d77a41139aad38151f4d8e48fd894fd9811a6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151119 Reviewed-by: Xisco Fauli diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index c1a270afb41a..bc5855e9f4b7 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -185,7 +185,16 @@ void SheetDataContext::onEndElement() mrSheetData.setValueCell( maCellData, maCellValue.toDouble() ); break; case XML_b: -mrSheetData.setBooleanCell( maCellData, maCellValue.toDouble() != 0.0 ); +{ +// Some generators may write true or false instead of 1 or 0. +/* XXX NOTE: PivotCacheItem::readBool() may suffer from this as + * well, but for now let's assume that software writing this + * here wrong won't write pivot caches at all.. */ +bool bValue = (maCellValue.toDouble() != 0.0); +if (!bValue && maCellValue.equalsIgnoreAsciiCase(u"true")) +bValue = true; +mrSheetData.setBooleanCell( maCellData, bValue ); +} break; case XML_e: mrSheetData.setErrorCell( maCellData, maCellValue );
[Libreoffice-commits] core.git: sc/source
sc/source/filter/oox/sheetdatacontext.cxx | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) New commits: commit e59fdc8b800aa3ab551b3f4fec4bc58366df582e Author: Eike Rathke AuthorDate: Thu Apr 27 14:56:36 2023 +0200 Commit: Eike Rathke CommitDate: Thu Apr 27 18:19:05 2023 +0200 Resolves: tdf#155046 Accept true and false as 1 and 0 for OOXML boolean cells Encountered in the wild written by https://www.npmjs.com/package/excel4node https://github.com/advisr-io/excel4node/blob/c14213abb9a511ff786c574e473f53006a85e4f9/source/lib/cell/cell.js#L74 Change-Id: Ib21242a55f0d8530fd9120b07a096a9908f451bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151101 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx index c1a270afb41a..bc5855e9f4b7 100644 --- a/sc/source/filter/oox/sheetdatacontext.cxx +++ b/sc/source/filter/oox/sheetdatacontext.cxx @@ -185,7 +185,16 @@ void SheetDataContext::onEndElement() mrSheetData.setValueCell( maCellData, maCellValue.toDouble() ); break; case XML_b: -mrSheetData.setBooleanCell( maCellData, maCellValue.toDouble() != 0.0 ); +{ +// Some generators may write true or false instead of 1 or 0. +/* XXX NOTE: PivotCacheItem::readBool() may suffer from this as + * well, but for now let's assume that software writing this + * here wrong won't write pivot caches at all.. */ +bool bValue = (maCellValue.toDouble() != 0.0); +if (!bValue && maCellValue.equalsIgnoreAsciiCase(u"true")) +bValue = true; +mrSheetData.setBooleanCell( maCellData, bValue ); +} break; case XML_e: mrSheetData.setErrorCell( maCellData, maCellValue );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-7' - sc/source
sc/source/core/data/queryiter.cxx | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) New commits: commit d65a5e8d758e6a955076e6d34a57b4b8cd33a0f6 Author: Eike Rathke AuthorDate: Wed Apr 26 21:11:44 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Apr 27 16:59:13 2023 +0200 Resolves: tdf#151958 Disable binary search on sorted cache for current releases Temporary measure until the actual cause is fixed. The by string query of binary search on sorted cache is broken for mixed types like here the numeric date cells and text cells. Change-Id: Icfe0b0c30987fcefdd6ed11066ea9113f3b4dabe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151074 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 9a555d79b3b00793edf1d51a8a7c76b723cc436d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151026 Reviewed-by: Adolfo Jayme Barrientos Reviewed-by: Xisco Fauli Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sc/source/core/data/queryiter.cxx b/sc/source/core/data/queryiter.cxx index b2d43c3ac769..6718c187051a 100644 --- a/sc/source/core/data/queryiter.cxx +++ b/sc/source/core/data/queryiter.cxx @@ -1219,10 +1219,21 @@ ScQueryCellIteratorAccessSpecific< ScQueryCellIteratorAccess::SortedCache >::Mak return SortedCacheIndexer(rCells, nStartRow, nEndRow, sortedCache); } -static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam, -SCTAB nTab, const ScFormulaCell* cell, const ScComplexRefData* refData, -ScInterpreterContext& context) +static bool CanBeUsedForSorterCache(ScDocument& /*rDoc*/, const ScQueryParam& /*rParam*/, +SCTAB /*nTab*/, const ScFormulaCell* /*cell*/, const ScComplexRefData* /*refData*/, +ScInterpreterContext& /*context*/) { +#if 1 +/* TODO: tdf#151958 broken by string query of binary search on sorted + * cache, use the direct query instead for releases and fix SortedCache + * implementation after. Not only COUNTIF() is broken, but also COUNTIFS(), + * and maybe lcl_LookupQuery() for VLOOKUP() etc. as well. Just disable + * this for now. + * Can't just return false because below would be unreachable code. Can't + * just #if/#else/#endif either because parameters would be unused. Crap + * this and comment out parameter names. */ +return false; +#else if(!rParam.GetEntry(0).bDoQuery || rParam.GetEntry(1).bDoQuery || rParam.GetEntry(0).GetQueryItems().size() != 1 ) return false; @@ -1278,6 +1289,7 @@ static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam return false; } return true; +#endif } // Generic query implementation.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5-3' - sc/source
sc/source/core/data/queryiter.cxx | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) New commits: commit 02b4d5027b0a48c192ce2bf35c69abe347eb3601 Author: Eike Rathke AuthorDate: Wed Apr 26 21:11:44 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Apr 27 16:58:55 2023 +0200 Resolves: tdf#151958 Disable binary search on sorted cache for current releases Temporary measure until the actual cause is fixed. The by string query of binary search on sorted cache is broken for mixed types like here the numeric date cells and text cells. Change-Id: Icfe0b0c30987fcefdd6ed11066ea9113f3b4dabe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151074 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit cf3fcb875ecfe47940347286e869b3909ed42274) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151025 Reviewed-by: Adolfo Jayme Barrientos Reviewed-by: Xisco Fauli Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sc/source/core/data/queryiter.cxx b/sc/source/core/data/queryiter.cxx index 5d8a3695f7d1..1fbdb526bc0f 100644 --- a/sc/source/core/data/queryiter.cxx +++ b/sc/source/core/data/queryiter.cxx @@ -1219,10 +1219,21 @@ ScQueryCellIteratorAccessSpecific< ScQueryCellIteratorAccess::SortedCache >::Mak return SortedCacheIndexer(rCells, nStartRow, nEndRow, sortedCache); } -static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam, -SCTAB nTab, const ScFormulaCell* cell, const ScComplexRefData* refData, -ScInterpreterContext& context) +static bool CanBeUsedForSorterCache(ScDocument& /*rDoc*/, const ScQueryParam& /*rParam*/, +SCTAB /*nTab*/, const ScFormulaCell* /*cell*/, const ScComplexRefData* /*refData*/, +ScInterpreterContext& /*context*/) { +#if 1 +/* TODO: tdf#151958 broken by string query of binary search on sorted + * cache, use the direct query instead for releases and fix SortedCache + * implementation after. Not only COUNTIF() is broken, but also COUNTIFS(), + * and maybe lcl_LookupQuery() for VLOOKUP() etc. as well. Just disable + * this for now. + * Can't just return false because below would be unreachable code. Can't + * just #if/#else/#endif either because parameters would be unused. Crap + * this and comment out parameter names. */ +return false; +#else if(!rParam.GetEntry(0).bDoQuery || rParam.GetEntry(1).bDoQuery || rParam.GetEntry(0).GetQueryItems().size() != 1 ) return false; @@ -1278,6 +1289,7 @@ static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam return false; } return true; +#endif } // Generic query implementation.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/source
sc/source/core/data/queryiter.cxx | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) New commits: commit 054455d259037c97b2b67e738b6655e33ddfe126 Author: Eike Rathke AuthorDate: Wed Apr 26 21:11:44 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Apr 27 09:23:29 2023 +0200 Resolves: tdf#151958 Disable binary search on sorted cache for current releases Temporary measure until the actual cause is fixed. The by string query of binary search on sorted cache is broken for mixed types like here the numeric date cells and text cells. Change-Id: Icfe0b0c30987fcefdd6ed11066ea9113f3b4dabe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151074 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit cf3fcb875ecfe47940347286e869b3909ed42274) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151023 Reviewed-by: Xisco Fauli diff --git a/sc/source/core/data/queryiter.cxx b/sc/source/core/data/queryiter.cxx index 5d8a3695f7d1..1fbdb526bc0f 100644 --- a/sc/source/core/data/queryiter.cxx +++ b/sc/source/core/data/queryiter.cxx @@ -1219,10 +1219,21 @@ ScQueryCellIteratorAccessSpecific< ScQueryCellIteratorAccess::SortedCache >::Mak return SortedCacheIndexer(rCells, nStartRow, nEndRow, sortedCache); } -static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam, -SCTAB nTab, const ScFormulaCell* cell, const ScComplexRefData* refData, -ScInterpreterContext& context) +static bool CanBeUsedForSorterCache(ScDocument& /*rDoc*/, const ScQueryParam& /*rParam*/, +SCTAB /*nTab*/, const ScFormulaCell* /*cell*/, const ScComplexRefData* /*refData*/, +ScInterpreterContext& /*context*/) { +#if 1 +/* TODO: tdf#151958 broken by string query of binary search on sorted + * cache, use the direct query instead for releases and fix SortedCache + * implementation after. Not only COUNTIF() is broken, but also COUNTIFS(), + * and maybe lcl_LookupQuery() for VLOOKUP() etc. as well. Just disable + * this for now. + * Can't just return false because below would be unreachable code. Can't + * just #if/#else/#endif either because parameters would be unused. Crap + * this and comment out parameter names. */ +return false; +#else if(!rParam.GetEntry(0).bDoQuery || rParam.GetEntry(1).bDoQuery || rParam.GetEntry(0).GetQueryItems().size() != 1 ) return false; @@ -1278,6 +1289,7 @@ static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam return false; } return true; +#endif } // Generic query implementation.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/source
sc/source/core/data/queryiter.cxx | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) New commits: commit 01ce3266484451e0984ed1ba07944745f44fc9e0 Author: Eike Rathke AuthorDate: Wed Apr 26 21:11:44 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Apr 27 09:23:23 2023 +0200 Resolves: tdf#151958 Disable binary search on sorted cache for current releases Temporary measure until the actual cause is fixed. The by string query of binary search on sorted cache is broken for mixed types like here the numeric date cells and text cells. Change-Id: Icfe0b0c30987fcefdd6ed11066ea9113f3b4dabe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151074 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 9a555d79b3b00793edf1d51a8a7c76b723cc436d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151024 Reviewed-by: Xisco Fauli diff --git a/sc/source/core/data/queryiter.cxx b/sc/source/core/data/queryiter.cxx index b2d43c3ac769..6718c187051a 100644 --- a/sc/source/core/data/queryiter.cxx +++ b/sc/source/core/data/queryiter.cxx @@ -1219,10 +1219,21 @@ ScQueryCellIteratorAccessSpecific< ScQueryCellIteratorAccess::SortedCache >::Mak return SortedCacheIndexer(rCells, nStartRow, nEndRow, sortedCache); } -static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam, -SCTAB nTab, const ScFormulaCell* cell, const ScComplexRefData* refData, -ScInterpreterContext& context) +static bool CanBeUsedForSorterCache(ScDocument& /*rDoc*/, const ScQueryParam& /*rParam*/, +SCTAB /*nTab*/, const ScFormulaCell* /*cell*/, const ScComplexRefData* /*refData*/, +ScInterpreterContext& /*context*/) { +#if 1 +/* TODO: tdf#151958 broken by string query of binary search on sorted + * cache, use the direct query instead for releases and fix SortedCache + * implementation after. Not only COUNTIF() is broken, but also COUNTIFS(), + * and maybe lcl_LookupQuery() for VLOOKUP() etc. as well. Just disable + * this for now. + * Can't just return false because below would be unreachable code. Can't + * just #if/#else/#endif either because parameters would be unused. Crap + * this and comment out parameter names. */ +return false; +#else if(!rParam.GetEntry(0).bDoQuery || rParam.GetEntry(1).bDoQuery || rParam.GetEntry(0).GetQueryItems().size() != 1 ) return false; @@ -1278,6 +1289,7 @@ static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam return false; } return true; +#endif } // Generic query implementation.
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/queryiter.cxx | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) New commits: commit 9a555d79b3b00793edf1d51a8a7c76b723cc436d Author: Eike Rathke AuthorDate: Wed Apr 26 21:11:44 2023 +0200 Commit: Eike Rathke CommitDate: Thu Apr 27 01:29:45 2023 +0200 Resolves: tdf#151958 Disable binary search on sorted cache for current releases Temporary measure until the actual cause is fixed. The by string query of binary search on sorted cache is broken for mixed types like here the numeric date cells and text cells. Change-Id: Icfe0b0c30987fcefdd6ed11066ea9113f3b4dabe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151074 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/core/data/queryiter.cxx b/sc/source/core/data/queryiter.cxx index 7fef5381750e..58709957157a 100644 --- a/sc/source/core/data/queryiter.cxx +++ b/sc/source/core/data/queryiter.cxx @@ -1231,10 +1231,21 @@ ScQueryCellIteratorAccessSpecific< ScQueryCellIteratorAccess::SortedCache >::Mak return SortedCacheIndexer(rCells, nStartRow, nEndRow, sortedCache); } -static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam, -SCTAB nTab, const ScFormulaCell* cell, const ScComplexRefData* refData, -ScInterpreterContext& context) +static bool CanBeUsedForSorterCache(ScDocument& /*rDoc*/, const ScQueryParam& /*rParam*/, +SCTAB /*nTab*/, const ScFormulaCell* /*cell*/, const ScComplexRefData* /*refData*/, +ScInterpreterContext& /*context*/) { +#if 1 +/* TODO: tdf#151958 broken by string query of binary search on sorted + * cache, use the direct query instead for releases and fix SortedCache + * implementation after. Not only COUNTIF() is broken, but also COUNTIFS(), + * and maybe lcl_LookupQuery() for VLOOKUP() etc. as well. Just disable + * this for now. + * Can't just return false because below would be unreachable code. Can't + * just #if/#else/#endif either because parameters would be unused. Crap + * this and comment out parameter names. */ +return false; +#else if(!rParam.GetEntry(0).bDoQuery || rParam.GetEntry(1).bDoQuery || rParam.GetEntry(0).GetQueryItems().size() != 1 ) return false; @@ -1290,6 +1301,7 @@ static bool CanBeUsedForSorterCache(ScDocument& rDoc, const ScQueryParam& rParam return false; } return true; +#endif } // Generic query implementation.
[Libreoffice-commits] core.git: sc/source
sc/source/ui/app/inputhdl.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 2ff1830207d69ddd8aa6637e8ccc586ecabf1567 Author: Eike Rathke AuthorDate: Tue Apr 25 19:46:45 2023 +0200 Commit: Eike Rathke CommitDate: Tue Apr 25 22:08:07 2023 +0200 Resolves: tdf#41304 Add percent operator % to reference delimiters Change-Id: I094fcb800a29de424db28e1b58f1239381a3b4a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151001 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 00fc7e429eb4..d60b10378ffa 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -364,7 +364,7 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) ScDocument& rDoc = pDocSh->GetDocument(); const sal_Unicode cSheetSep = rDoc.GetSheetSeparator(); -OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\"\t\n"); +OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~%\"\t\n"); // delimiters (in addition to ScEditUtil): only characters that are // allowed in formulas next to references and the quotation mark (so // string constants can be skipped)
[Libreoffice-commits] core.git: sc/source
sc/source/ui/app/inputhdl.cxx | 72 +++--- sc/source/ui/inc/rfindlst.hxx | 12 +++ 2 files changed, 53 insertions(+), 31 deletions(-) New commits: commit 5f6d27711a297d1851dc6bc713fd16c44014cf5c Author: Eike Rathke AuthorDate: Tue Apr 25 16:44:25 2023 +0200 Commit: Eike Rathke CommitDate: Tue Apr 25 20:35:00 2023 +0200 Resolves: tdf#144547 ScRangeFindList: handle references in multi-line formula Also fix a color attribution error if when dragging the reference the new reference string is longer (colored too short) or shorter (colored too much including the next characters/operator/...) than the old reference string. Change-Id: I1b39fd5778d75290a0233f51a4198753fa858f48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150979 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index c0ee11966887..00fc7e429eb4 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -341,6 +341,20 @@ void ScInputHandler::SendReferenceMarks( const SfxViewShell* pViewShell, LOK_CALLBACK_REFERENCE_MARKS, aPayload ); } +static inline void incPos( const sal_Unicode c, sal_Int32& rPos, ESelection& rSel ) +{ +++rPos; +if (c == '\n') +{ +++rSel.nEndPara; +rSel.nEndPos = 0; +} +else +{ +++rSel.nEndPos; +} +} + void ScInputHandler::InitRangeFinder( const OUString& rFormula ) { DeleteRangeFinder(); @@ -350,7 +364,7 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) ScDocument& rDoc = pDocSh->GetDocument(); const sal_Unicode cSheetSep = rDoc.GetSheetSeparator(); -OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\""); +OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\"\t\n"); // delimiters (in addition to ScEditUtil): only characters that are // allowed in formulas next to references and the quotation mark (so // string constants can be skipped) @@ -366,6 +380,7 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) sal_Int32 nLen = rFormula.getLength(); sal_Int32 nPos = 0; sal_Int32 nStart = 0; +ESelection aSel; sal_uInt16 nCount = 0; ScRange aRange; while ( nPos < nLen && nCount < RANGEFIND_MAX ) @@ -375,14 +390,16 @@ void ScInputHandler::InitRangeFinder( const OUString& rFormula ) { if ( pChar[nPos] == '"' ) // String { -++nPos; +incPos( pChar[nPos], nPos, aSel); while (nPosGetTitle() )); } -Color nColor = pRangeFindList->Insert( ScRangeFindData( aRange, nFlags, nStart, nPos ) ); +Color nColor = pRangeFindList->Insert( ScRangeFindData( aRange, nFlags, aSel)); -ESelection aSel( 0, nStart, 0, nPos ); SfxItemSet aSet( mpEditEngine->GetEmptyItemSet() ); aSet.Put( SvxColorItem( nColor, EE_CHAR_COLOR ) ); mpEditEngine->QuickSetAttribs( aSet, aSel ); @@ -620,8 +636,9 @@ static void lcl_Replace( EditView* pView, const OUString& rNewStr, const ESelect // To do that we need to cancel the selection from above (before QuickInsertText) pView->InsertText( OUString() ); -sal_Int32 nLen = pEngine->GetTextLen(0); -ESelection aSel( 0, nLen, 0, nLen ); +const sal_Int32 nPara = pEngine->GetParagraphCount() - 1; +const sal_Int32 nLen = pEngine->GetTextLen(nPara); +ESelection aSel( nPara, nLen, nPara, nLen ); pView->SetSelection( aSel ); // Set cursor to the end } @@ -631,8 +648,6 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) if ( pDocView && pRangeFindList && nIndex < pRangeFindList->Count() ) { ScRangeFindData& rData = pRangeFindList->GetObject( nIndex ); -sal_Int32 nOldStart = rData.nSelStart; -sal_Int32 nOldEnd = rData.nSelEnd; Color nNewColor = pRangeFindList->FindColor( rNew, nIndex ); ScRange aJustified = rNew; @@ -640,32 +655,39 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) ScDocument& rDoc = pDocView->GetViewData().GetDocument(); const ScAddress::Details aAddrDetails( rDoc, aCursorPos ); OUString aNewStr(aJustified.Format(rDoc, rData.nFlags, aAddrDetails)); -ESelection aOldSel( 0, nOldStart, 0, nOldEnd ); SfxItemSet aSet( mpEditEngine->GetEmptyItemSet() ); DataChanging(); -lcl_Replace( pTopView, aNewStr, aOldSel ); -lcl_Replace( pTableView, aNewStr, aOldSel ); +lcl_Replace( pTopView, aNewStr, rData.maSel ); +lcl_Replace( pTableView, aNewStr, rData.maSel ); + +// We are within one paragraph. +const sal_Int32 nDiff = aNewStr.getLength() - (rData.maSel.nEndPos
[Libreoffice-commits] core.git: i18npool/source
i18npool/source/localedata/data/bo_IN.xml | 212 +++--- 1 file changed, 106 insertions(+), 106 deletions(-) New commits: commit 5265892378ded9336e24199fe8260dde6be99156 Author: Eike Rathke AuthorDate: Tue Apr 25 01:13:38 2023 +0200 Commit: Eike Rathke CommitDate: Tue Apr 25 12:53:10 2023 +0200 Group sort bo_IN.xml LC_FORMAT FormatElement for better comparability Change-Id: I6e17c01ce4d3a351a2cb49d214f73468d425b4a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150952 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/source/localedata/data/bo_IN.xml b/i18npool/source/localedata/data/bo_IN.xml index 8d9133ae988d..bb364c53468b 100644 --- a/i18npool/source/localedata/data/bo_IN.xml +++ b/i18npool/source/localedata/data/bo_IN.xml @@ -53,55 +53,119 @@ M-D - - [NatNum1]YY-MM-DD + + General - - [NatNum1]NN YY-MMM DD + + [NatNum1]0 - - [NatNum1]YY-MM + + [NatNum1]0.00 - - [NatNum1]MMM-DD + + [NatNum1]#,##0 - - + + [NatNum1]#,##0.00 - - [NatNum1]QQ YY + + [NatNum1]#,###.00 - - [NatNum1]-MM-DD + + 0 - + + 0.00 + + + #,##0 + + + #,##0.00 + + + #,###.00 + + + 0.00E+000 + + + 0.00E+00 + + + [NatNum1]0.00E+00 + + + ##0.00E+00 + + + + [NatNum1]0% + + + [NatNum1]0.00% + + + 0% + + + 0.00% + + + [CURRENCY]#,##0;-[CURRENCY]#,##0 + + + [CURRENCY]#,##0.00;-[CURRENCY]#,##0.00 + + + [CURRENCY]#,##0;[RED]-[CURRENCY]#,##0 + + + [CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00 + + + #,##0.00 CCC + + + [CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.-- + + [NatNum1]YY-MM-DD [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD + + [NatNum1]YY-MM-DD + + + [NatNum1]-MM-DD + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD - + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD - + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD - + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD - + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD - + + [NatNum1]NN YY-MMM DD + + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD - + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD @@ -114,117 +178,53 @@ -MM-DD ISO 8601 + + [NatNum1]YY-MM + + + [NatNum1]MMM-DD + + + + + + [NatNum1]QQ YY + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD - + HH:MM - + HH:MM:SS - + [NatNum1]HH:MM AM/PM - + [NatNum1]HH:MM:SS AM/PM - + [HH]:MM:SS - + [NatNum1]HH:MM:SS.00 - + [HH]:MM:SS.00 - + [NatNum1]"སྤྱི་ལོ" YY "ཟླ་" M "ཚེས་" DD HH:MM AM/PM [NatNum1]DD-MM- HH:MM:SS - + [NatNum1]"སྤྱི་ལོ" "ཟླ་" M "ཚེས་" DD HH:MM AM/PM - - General - - - [NatNum1]0 - - - [NatNum1]0.00 - - - [NatNum1]#,##0 - - - [NatNum1]#,##0.00 - - - [NatNum1]#,###.00 - - - 0 - - - 0.00 - - - #,##0 - - - #,##0.00 - - - #,###.00 - - - [CURRENCY]#,##0;-[CURRENCY]#,##0 - - - [CURRENCY]#,##0.00;-[CURRENCY]#,##0.00 - - - [CURRENCY]#,##0;[RED]-[CURRENCY]#,##0 - - - [CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00 - - - #,##0.00 CCC - - - [CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.-- - - - - [NatNum1]0% - - - [NatNum1]0.00% - - - 0% - - - 0.00% - - - 0.00E+000 - - - 0.00E+00 - - - [NatNum1]0.00E+00 - - - ##0.00E+00 -