[Libreoffice-commits] core.git: sc/source

2021-03-23 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/compiler.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit b82d677b3e30a28d084d3d4f8c039949905fd5fa
Author: Eike Rathke 
AuthorDate: Mon Mar 22 01:17:45 2021 +0100
Commit: Eike Rathke 
CommitDate: Tue Mar 23 11:42:25 2021 +0100

Assert supported FormulaGrammar instead of OSL_ENSURE

Change-Id: I80e1c55dbc66d1dcba004aac5cb5759a41bda680
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112860
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 5ed09abc0b73..250e816a2e5e 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2025,8 +2025,7 @@ void ScCompiler::SetRefConvention( const 
ScCompiler::Convention *pConvP )
 {
 pConv = pConvP;
 meGrammar = FormulaGrammar::mergeToGrammar( meGrammar, pConv->meConv);
-OSL_ENSURE( FormulaGrammar::isSupported( meGrammar),
-"ScCompiler::SetRefConvention: unsupported grammar resulting");
+assert( FormulaGrammar::isSupported( meGrammar));
 }
 
 void ScCompiler::SetError(FormulaError nError)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2021-03-22 Thread Eike Rathke (via logerrit)
 sc/source/ui/unoobj/tokenuno.cxx |   46 ++-
 1 file changed, 31 insertions(+), 15 deletions(-)

New commits:
commit d2475f85bf4f0015007746d6af5dd5baaee09566
Author: Eike Rathke 
AuthorDate: Mon Mar 22 01:14:49 2021 +0100
Commit: Eike Rathke 
CommitDate: Mon Mar 22 14:37:44 2021 +0100

Force FormulaLanguage::OOXML for AddressConvention::CONV_XL_OOX

CONV_XL_OOX is used by OOXML ChartExport::parseFormula(), which
only handles ranges so FormulaLanguage doesn't really matter,
calling ScFormulaParserObj::printFormula(), but merging
AddressConvention::CONV_XL_OOX onto default
FormulaLanguage::NATIVE (mbEnglish wasn't set either) is an odd
combination that shouldn't happen.

Change-Id: I678b0da23886d0d5745bb4c0c0cee0bf7db4905c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112859
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index 3de405b605b2..33f005fff8d6 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -59,6 +59,17 @@ static const SfxItemPropertyMapEntry* 
lcl_GetFormulaParserMap()
 return aFormulaParserMap_Impl;
 }
 
+const formula::FormulaGrammar::AddressConvention aConvMap[] = {
+formula::FormulaGrammar::CONV_OOO,// <- AddressConvention::OOO
+formula::FormulaGrammar::CONV_XL_A1,  // <- AddressConvention::XL_A1
+formula::FormulaGrammar::CONV_XL_R1C1,// <- AddressConvention::XL_R1C1
+formula::FormulaGrammar::CONV_XL_OOX, // <- AddressConvention::XL_OOX
+formula::FormulaGrammar::CONV_LOTUS_A1// <- AddressConvention::LOTUS_A1
+};
+// sal_Int16 because of comparison of integer expressions below.
+constexpr sal_Int16 nConvMapCount = SAL_N_ELEMENTS(aConvMap);
+
+
 SC_SIMPLE_SERVICE_INFO( ScFormulaParserObj, "ScFormulaParserObj", 
SC_SERVICENAME_FORMULAPARS )
 
 ScFormulaParserObj::ScFormulaParserObj(ScDocShell* pDocSh) :
@@ -89,14 +100,9 @@ void ScFormulaParserObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 void ScFormulaParserObj::SetCompilerFlags( ScCompiler& rCompiler ) const
 {
-static const formula::FormulaGrammar::AddressConvention aConvMap[] = {
-formula::FormulaGrammar::CONV_OOO,// <- AddressConvention::OOO
-formula::FormulaGrammar::CONV_XL_A1,  // <- 
AddressConvention::XL_A1
-formula::FormulaGrammar::CONV_XL_R1C1,// <- 
AddressConvention::XL_R1C1
-formula::FormulaGrammar::CONV_XL_OOX, // <- 
AddressConvention::XL_OOX
-formula::FormulaGrammar::CONV_LOTUS_A1// <- 
AddressConvention::LOTUS_A1
-};
-static const sal_Int16 nConvMapCount = SAL_N_ELEMENTS(aConvMap);
+formula::FormulaGrammar::AddressConvention eConv = 
formula::FormulaGrammar::CONV_UNSPECIFIED;
+if (mnConv >= 0 && mnConv < nConvMapCount)
+eConv = aConvMap[mnConv];
 
 // If mxOpCodeMap is not empty it overrides mbEnglish, and vice versa. We
 // don't need to initialize things twice.
@@ -104,17 +110,13 @@ void ScFormulaParserObj::SetCompilerFlags( ScCompiler& 
rCompiler ) const
 rCompiler.SetFormulaLanguage( mxOpCodeMap );
 else
 {
-sal_Int32 nFormulaLanguage = mbEnglish ?
-sheet::FormulaLanguage::ENGLISH :
-sheet::FormulaLanguage::NATIVE;
+const sal_Int32 nFormulaLanguage = (eConv == 
formula::FormulaGrammar::CONV_XL_OOX ?
+sheet::FormulaLanguage::OOXML :
+(mbEnglish ? sheet::FormulaLanguage::ENGLISH : 
sheet::FormulaLanguage::NATIVE));
 ScCompiler::OpCodeMapPtr xMap = rCompiler.GetOpCodeMap( 
nFormulaLanguage);
 rCompiler.SetFormulaLanguage( xMap);
 }
 
-formula::FormulaGrammar::AddressConvention eConv = 
formula::FormulaGrammar::CONV_UNSPECIFIED;
-if (mnConv >= 0 && mnConv < nConvMapCount)
-eConv = aConvMap[mnConv];
-
 rCompiler.SetRefConvention( eConv );
 rCompiler.EnableJumpCommandReorder(!mbCompileFAP);
 rCompiler.EnableStopOnError(!mbCompileFAP);
@@ -206,6 +208,20 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
 else if ( aPropertyName == SC_UNO_FORMULACONVENTION )
 {
 aValue >>= mnConv;
+
+bool bOldEnglish = mbEnglish;
+if (mnConv >= 0 && mnConv < nConvMapCount
+&& aConvMap[mnConv] == formula::FormulaGrammar::CONV_XL_OOX)
+mbEnglish = true;
+
+// Same as for SC_UNO_COMPILEENGLISH, though an OpCodeMap should not
+// had been set for CONV_XL_OOX.
+if (mxOpCodeMap && mbEnglish != bOldEnglish)
+{
+ScDocument& rDoc = mpDocShell->GetDocument();
+ScCompiler aCompiler( rDoc, ScAddress(), rDoc.GetGrammar());
+mxOpCodeMap = formula::Formula

[Libreoffice-commits] core.git: helpcontent2

2021-03-22 Thread Eike Rathke (via logerrit)
 helpcontent2 |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ac40fa080ff5d3d33dd42455ae0478638fa5dcf3
Author: Eike Rathke 
AuthorDate: Mon Mar 22 14:37:26 2021 +0100
Commit: Gerrit Code Review 
CommitDate: Mon Mar 22 14:37:26 2021 +0100

Update git submodules

* Update helpcontent2 from branch 'master'
  to 9ab43b71fc1e5e92489f206a515d6f35bf4fd883
  - Use ; semicolon instead of , comma function parameter separator

And don't use localized TRUE number word. Either TRUE() function or 1
number.

Change-Id: I7d2cacd95524ed54316cb623990a4c5a96b53067
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/112891
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/helpcontent2 b/helpcontent2
index c53347c0b4d7..9ab43b71fc1e 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit c53347c0b4d7b2f5ed784e4ad0c03984aeb68999
+Subproject commit 9ab43b71fc1e5e92489f206a515d6f35bf4fd883
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] help.git: source/text

2021-03-22 Thread Eike Rathke (via logerrit)
 source/text/scalc/01/func_textjoin.xhp |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9ab43b71fc1e5e92489f206a515d6f35bf4fd883
Author: Eike Rathke 
AuthorDate: Mon Mar 22 14:34:00 2021 +0100
Commit: Eike Rathke 
CommitDate: Mon Mar 22 14:37:26 2021 +0100

Use ; semicolon instead of , comma function parameter separator

And don't use localized TRUE number word. Either TRUE() function or 1
number.

Change-Id: I7d2cacd95524ed54316cb623990a4c5a96b53067
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/112891
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/source/text/scalc/01/func_textjoin.xhp 
b/source/text/scalc/01/func_textjoin.xhp
index 7a610bb6d..ed3e13b67 100644
--- a/source/text/scalc/01/func_textjoin.xhp
+++ b/source/text/scalc/01/func_textjoin.xhp
@@ -35,8 +35,8 @@
 If there are more 
delimiters than strings to be joined, not all delimiters will be 
used.
 If there are less 
delimiters than strings to be joined, the delimiters will be used again from 
the start.
 
-=TEXTJOIN(" 
",TRUE, "Here", "comes", "the", "sun") returns "Here comes the sun" 
with space character as delimiter and empty strings are ignored.
-if A1:B2 contains 
"Here", "comes", "the", "sun" respectively, 
=TEXTJOIN("-",TRUE,A1:B2) returns "Here-comes-the-sun" with dash 
character as delimiter and empty strings are ignored.
+=TEXTJOIN(" 
"; 1; "Here"; "comes"; "the"; "sun") returns "Here comes the sun" with 
space character as delimiter and empty strings are ignored.
+if A1:B2 contains 
"Here", "comes", "the", "sun" respectively, 
=TEXTJOIN("-";1;A1:B2) returns "Here-comes-the-sun" with dash 
character as delimiter and empty strings are ignored.
 
 
 CONCATENATE
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/xmloff xmloff/source

2021-03-21 Thread Eike Rathke (via logerrit)
 include/xmloff/xmlnumfi.hxx  |   17 +++-
 xmloff/source/style/xmlnumfi.cxx |   82 ++-
 2 files changed, 80 insertions(+), 19 deletions(-)

New commits:
commit 010d6d1562f309a2aee728f8e5590385cc6ce8fd
Author: Eike Rathke 
AuthorDate: Tue Mar 16 21:12:29 2021 +0100
Commit: Eike Rathke 
CommitDate: Sun Mar 21 12:36:02 2021 +0100

ODF load: suppress calendar modifiers in format codes if possible

... for switching to/from implicit secondary calendar, like ja-JP
explicit [~gengou] and [~gregorian] most times are superfluous and
GE or  are used.

In preparation for https://gerrit.libreoffice.org/c/core/+/108532

Change-Id: I8eb412c0fbba0927741bb305f91eb575b5f1bb13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112596
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx
index 1bf6c9228ed6..c863304bc293 100644
--- a/include/xmloff/xmlnumfi.hxx
+++ b/include/xmloff/xmlnumfi.hxx
@@ -115,6 +115,18 @@ struct MyCondition
 
 class XMLOFF_DLLPUBLIC SvXMLNumFormatContext : public SvXMLStyleContext
 {
+public:
+enum ImplicitCalendar
+{
+DEFAULT,
+SECONDARY,
+OTHER,
+DEFAULT_FROM_OTHER,
+SECONDARY_FROM_OTHER
+};
+
+private:
+
 SvXMLNumImpData*pData;
 SvXMLStylesContext* pStyles;
 std::vectoraMyConditions;
@@ -124,6 +136,8 @@ class XMLOFF_DLLPUBLIC SvXMLNumFormatContext : public 
SvXMLStyleContext
 OUString   sFormatTitle;
 //  OUString   sMapName;
 OUString   sCalendar;
+OUString   aImplicitCalendar[2];
+ImplicitCalendar eImplicitCalendar;
 LanguageType   nFormatLang;
 boolbAutoOrder;
 boolbFromSystem;
@@ -178,7 +192,8 @@ public:
 void SetHasLongDoW(bool bSet)   { bHasLongDoW = bSet; }
 bool HasEra() const { return bHasEra; }
 
-void UpdateCalendar( const OUString& rNewCalendar, bool 
bImplicitSecondaryCalendarEC = false );
+void UpdateCalendar( const OUString& rNewCalendar );
+ImplicitCalendar GetImplicitCalendarState() const { return 
eImplicitCalendar; }
 
 const LocaleDataWrapper& GetLocaleData() const;
 
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 734f572608b1..28dbe6574336 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -929,25 +929,17 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
 // Do not replace for default calendar.
 // Also replace Y by E if we're switching to the secondary
 // calendar of a locale if it is known to implicitly use E.
-bool bImplicitEC = (!sCalendar.isEmpty() &&
-rParent.GetLocaleData().doesSecondaryCalendarUseEC( 
sCalendar));
-if (bImplicitEC || (!sCalendar.isEmpty() && rParent.HasEra()
-&& sCalendar != 
rParent.GetLocaleData().getDefaultCalendar()->Name))
+rParent.UpdateCalendar( sCalendar);
+const SvXMLNumFormatContext::ImplicitCalendar eCal = 
rParent.GetImplicitCalendarState();
+if (eCal == SvXMLNumFormatContext::ImplicitCalendar::SECONDARY
+|| eCal == 
SvXMLNumFormatContext::ImplicitCalendar::SECONDARY_FROM_OTHER)
 {
-// If E or EE is the first format keyword, passing
-// bImplicitEC=true suppresses the superfluous calendar
-// modifier for this format. This does not help for
-// something like [~cal]DD/MM/EE but so far only YMD order
-// is used with such calendars. Live with the modifier if
-// other keywords precede this.
-rParent.UpdateCalendar( sCalendar, bImplicitEC);
 rParent.AddNfKeyword(
 sal::static_int_cast< sal_uInt16 >(
 bEffLong ? NF_KEY_EEC : NF_KEY_EC ) );
 }
 else
 {
-rParent.UpdateCalendar( sCalendar );
 rParent.AddNfKeyword(
 sal::static_int_cast< sal_uInt16 >(
 bEffLong ? NF_KEY_ : NF_KEY_YY ) );
@@ -1118,6 +1110,7 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( 
SvXMLImport& rImport,
 aMyConditions(),
 nType( nNewType ),
 nKey(-1),
+eImplicitCalendar(ImplicitCalendar::DEFAULT),
 nFormatLang( LANGUAGE_SYSTEM ),
 bAutoOrder( false ),
 bFromSystem( false ),
@@ -1254,6 +1247,7 @@ SvXMLNumFormatContext::SvXMLNumFormatContext( 
SvXMLImport& rImport,
 aMyConditions(),
 nType( SvXMLStylesTokens::NUMBER_STYLE ),
 nKey(

[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - svl/source

2021-03-16 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zformat.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 9b6805db873b26a22eda8cd35d6553e463775324
Author: Eike Rathke 
AuthorDate: Mon Mar 15 15:49:55 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Mar 16 17:56:58 2021 +0100

xls save: fix writing inline calendar modifiers as format code, don't

E.g. ja-JP
  GGGE [~gregorian]
saved as OOXML ended up as
  [$-411]ggge\ gregorian
which when reloaded became
  GGGE GREGoRian
displaying
  令和3 R033Ro03ian2021
(whatever Xcl might have done with that).

Change-Id: If8a7d5b837b69c32afacc7a8d7646fedc84ab87a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112510
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 3e73d3475711b790cc80b9a286c5d454f3929384)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112519
Reviewed-by: Caolán McNamara 

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 92e62e87aeae..6402aa7f5dbc 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -5309,6 +5309,8 @@ OUString SvNumberformat::GetMappedFormatstring( const 
NfKeywordTable& rKeywords,
 }
 break;
 case NF_SYMBOLTYPE_CALDEL :
+if (j + 1 >= nCnt)
+break;
 if ( rStrArray[j+1] == "gengou" )
 {
 nCalendarID = 0x003;
@@ -5325,9 +5327,10 @@ OUString SvNumberformat::GetMappedFormatstring( const 
NfKeywordTable& rKeywords,
 {
 nCalendarID = 0x008;
 }
-// other calendars (see tdf#36038) not corresponding 
between LibO and XL
-if ( nCalendarID > 0 )
-j = j+2;
+// Other calendars (see tdf#36038) not corresponding 
between LibO and XL.
+// However, skip any calendar modifier and don't write
+// as format code (if not as literal string).
+j += 2;
 break;
 case NF_SYMBOLTYPE_CURREXT :
 nPosHaveLCID = aStr.getLength();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/qa svl/source

2021-03-15 Thread Eike Rathke (via logerrit)
 sc/qa/unit/subsequent_export-test.cxx |5 -
 svl/source/numbers/zformat.cxx|   30 +++---
 2 files changed, 31 insertions(+), 4 deletions(-)

New commits:
commit c98891a4ba67a73d7a683ffb24845512705a4bbf
Author: Eike Rathke 
AuthorDate: Mon Mar 15 15:57:18 2021 +0100
Commit: Eike Rathke 
CommitDate: Mon Mar 15 20:25:47 2021 +0100

xls load: suppress secondary [~gengou] calendar modifier in format code

ja-JP Gengou calendar is an implicit secondary calendar switched
to and from by format codes.

Change-Id: Iea268310ac5e917f2168fec0166754424baa925d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112511
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 0d14b1046793..b0f390206129 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -4725,7 +4725,10 @@ void ScExportTest::testExtendedLCIDXLSX()
 SvNumberFormatter* pNumFormatter = rDoc.GetFormatTable();
 sal_uInt32 nNumberFormat;
 const OUString aLang[5] = { "[$-41E]", "[$-411]", "[$-40D]", "[$-401]", 
"[$-500]" };
-const OUString aCalendar[5] = { "[~buddhist]DD-MM-", 
"[~gengou]DD-MM-EE", "[~jewish]DD-MM-", "[~hijri]DD-MM-", 
"[~dangi]/MM/DD" };
+const OUString aCalendar[5] = { "[~buddhist]DD-MM-", "DD-MM-EE", 
"[~jewish]DD-MM-", "[~hijri]DD-MM-", "[~dangi]/MM/DD" };
+// Note: ja-JP Gengou calendar is an implicit secondary (non-gregorian)
+// calendar, the explicit [~gengou] calendar modifier does not need to be
+// present, the E and EE keywords are used instead of YY and .
 for ( sal_Int16 nCol = 1; nCol <= 2; nCol++ )
 {
 for ( sal_Int16 nRow = 1; nRow <= 4; nRow++ )
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 8787f0977984..f74b178a0419 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -442,8 +442,10 @@ OUString SvNumberformat::ImpObtainCalendarAndNumerals( 
OUStringBuffer& rString,
 switch ( aTmpLocale.mnCalendarType & 0x7F )
 {
 case 0x03 : // Gengou calendar
-sCalendar = "[~gengou]";
-// Only Japanese language support Gengou calendar
+// Only Japanese language support Gengou calendar.
+// It is an implicit "other" calendar where E, EE, R and RR
+// automatically switch to and YY and  switch to Gregorian. Do
+// not add the "[~gengou]" modifier.
 if ( nLocaleLang != LANGUAGE_JAPANESE )
 {
 nLang = maLocale.meLanguage = LANGUAGE_JAPANESE;
@@ -5252,6 +5254,7 @@ OUString SvNumberformat::GetMappedFormatstring( const 
NfKeywordTable& rKeywords,
 sal_Int32 nPosHaveLCID = -1;
 sal_Int32 nPosInsertLCID = aStr.getLength();
 sal_uInt32 nCalendarID = 0x000; // Excel ID of calendar used in 
sub-format see tdf#36038
+constexpr sal_uInt32 kCalGengou = 0x003;
 if ( nCnt )
 {
 auto& rTypeArray = NumFor[n].Info().nTypeArray;
@@ -5265,6 +5268,27 @@ OUString SvNumberformat::GetMappedFormatstring( const 
NfKeywordTable& rKeywords,
 {
 aStr.append( rLocWrp.getLongDateDayOfWeekSep() );
 }
+switch (rTypeArray[j])
+{
+case NF_KEY_EC:
+case NF_KEY_EEC:
+case NF_KEY_R:
+case NF_KEY_RR:
+// Implicit secondary (non-gregorian) calendar.
+// Currently only for ja-JP.
+/* TODO: same for all locales in
+ * LocaleDataWrapper::doesSecondaryCalendarUseEC() 
?
+ * Should split the locales off that then. */
+if (!nCalendarID)
+{
+const LanguageType nLang = 
MsLangId::getRealLanguage( nOriginalLang);
+if (nLang == LANGUAGE_JAPANESE)
+nCalendarID = kCalGengou;
+}
+break;
+default:
+;   // nothing
+}
 }
 else
 {
@@ -5313,7 +5337,7 @@ OUString SvNumberformat::GetMappedFormatstring( const 
NfKeywordTable& rKeywords,
 break;
 if ( rStrArray[j+1] == "gengou" )
  

[Libreoffice-commits] core.git: svl/source

2021-03-15 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zformat.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 3e73d3475711b790cc80b9a286c5d454f3929384
Author: Eike Rathke 
AuthorDate: Mon Mar 15 15:49:55 2021 +0100
Commit: Eike Rathke 
CommitDate: Mon Mar 15 17:45:00 2021 +0100

xls save: fix writing inline calendar modifiers as format code, don't

E.g. ja-JP
  GGGE [~gregorian]
saved as OOXML ended up as
  [$-411]ggge\ gregorian
which when reloaded became
  GGGE GREGoRian
displaying
  令和3 R033Ro03ian2021
(whatever Xcl might have done with that).

Change-Id: If8a7d5b837b69c32afacc7a8d7646fedc84ab87a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112510
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index b0dcad070dd2..8787f0977984 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -5309,6 +5309,8 @@ OUString SvNumberformat::GetMappedFormatstring( const 
NfKeywordTable& rKeywords,
 }
 break;
 case NF_SYMBOLTYPE_CALDEL :
+if (j + 1 >= nCnt)
+break;
 if ( rStrArray[j+1] == "gengou" )
 {
 nCalendarID = 0x003;
@@ -5325,9 +5327,10 @@ OUString SvNumberformat::GetMappedFormatstring( const 
NfKeywordTable& rKeywords,
 {
 nCalendarID = 0x008;
 }
-// other calendars (see tdf#36038) not corresponding 
between LibO and XL
-if ( nCalendarID > 0 )
-j = j+2;
+// Other calendars (see tdf#36038) not corresponding 
between LibO and XL.
+// However, skip any calendar modifier and don't write
+// as format code (if not as literal string).
+j += 2;
 break;
 case NF_SYMBOLTYPE_CURREXT :
 nPosHaveLCID = aStr.getLength();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmloff/source

2021-03-13 Thread Eike Rathke (via logerrit)
 xmloff/source/style/xmlnumfi.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e6d41f285617e4b867042afac5d3d92aa54e8e4c
Author: Eike Rathke 
AuthorDate: Sat Mar 13 00:07:48 2021 +0100
Commit: Eike Rathke 
CommitDate: Sat Mar 13 15:41:42 2021 +0100

ODF load: replace YY/ with E/EE only for secondary calendar

In the context of Gengou calendar with Era a [~gregorian]
should not be [~gregorian]EE (although it works and displays the
same Gregorian year).

Related to https://gerrit.libreoffice.org/c/core/+/108532

Change-Id: Iaec55c997089cbaea424220d858bffdf20ff3706
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112406
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index b33715726b92..734f572608b1 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -931,7 +931,8 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
 // calendar of a locale if it is known to implicitly use E.
 bool bImplicitEC = (!sCalendar.isEmpty() &&
 rParent.GetLocaleData().doesSecondaryCalendarUseEC( 
sCalendar));
-if (bImplicitEC || (!sCalendar.isEmpty() && rParent.HasEra()))
+if (bImplicitEC || (!sCalendar.isEmpty() && rParent.HasEra()
+&& sCalendar != 
rParent.GetLocaleData().getDefaultCalendar()->Name))
 {
 // If E or EE is the first format keyword, passing
 // bImplicitEC=true suppresses the superfluous calendar
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: Adding Dictionary for Central Kurdish (ckb)

2021-03-12 Thread Eike Rathke
Hi Jwtiyar,

On Friday, 2021-03-12 13:09:04 +0300, Jwtiyar ali wrote:

> I have both .aff and .dic files for central kurdish which required to add
> dictionary for a specific language

Probably best to create a dictionary extension and upload to
https://extensions.libreoffice.org/

For a simple example see the Icelandic spellchecker
https://extensions.libreoffice.org/en/extensions/show/hunspell-is-the-icelandic-spelling-dictionary-project

There's also some old technical documentation at
https://wiki.openoffice.org/wiki/Extension_Dictionaries
Take it with a grain of salt but most should still be valid.

  Eike

-- 
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: xmloff/source

2021-03-12 Thread Eike Rathke (via logerrit)
 xmloff/source/style/xmlnumfe.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 1d0b2ae1423142f3688de00d9938917329e958af
Author: Eike Rathke 
AuthorDate: Thu Mar 11 16:55:14 2021 +0100
Commit: Eike Rathke 
CommitDate: Fri Mar 12 11:16:19 2021 +0100

ODF save: write explicit "gregorian" calendar, not empty if default

Other implementations may have different opinions about default
calendars and the context here is to switch to Gregorian.

Change-Id: I14a27826e627f890911adaf01935c58b43ad766a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112354
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 24c0524a4239..1392c4e0f2f7 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1651,12 +1651,12 @@ void SvXMLNumFmtExport::ExportPart_Impl( const 
SvNumberformat& rFormat, sal_uInt
 // Calendar attribute for E and EE and R is set in
 // first loop. If set and not an explicit calendar and
 // YY or  is encountered, switch temporarily to
-// Gregorian, i.e. empty calendar name.
+// Gregorian.
 bool bLong = ( nElemType == NF_KEY_ || nElemType 
== NF_KEY_EEC ||
 nElemType == NF_KEY_R );
 WriteYearElement_Impl(
 ((bImplicitOtherCalendar && !bExplicitCalendar
-  && (nElemType == NF_KEY_YY || nElemType == 
NF_KEY_)) ? OUString() : aCalendar),
+  && (nElemType == NF_KEY_YY || nElemType == 
NF_KEY_)) ? "gregorian" : aCalendar),
 (bSystemDate ? bLongSysDate : bLong));
 bAnyContent = true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmloff/source

2021-03-11 Thread Eike Rathke (via logerrit)
 xmloff/source/style/xmlnumfe.cxx |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit a6b9b1128d5ced0e3f82f88e442a7bba243ce164
Author: Eike Rathke 
AuthorDate: Wed Mar 10 23:02:42 2021 +0100
Commit: Eike Rathke 
CommitDate: Thu Mar 11 16:33:24 2021 +0100

ODF save: handle implicit other calendar and switch to Gregorian for 

In preparation for https://gerrit.libreoffice.org/c/core/+/108532
to add dual calendar mixed formats.

Change-Id: Ibc9294af3ad294c702ee6597b1a8831dec39b948
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112285
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index b961eb2620f5..24c0524a4239 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1268,6 +1268,8 @@ void SvXMLNumFmtExport::ExportPart_Impl( const 
SvNumberformat& rFormat, sal_uInt
 sal_Int32 nMinDecimals = nPrecision;
 OUString sCurrExt;
 OUString aCalendar;
+bool bImplicitOtherCalendar = false;
+bool bExplicitCalendar = false;
 sal_uInt16 nPos = 0;
 bool bEnd = false;
 while (!bEnd)
@@ -1336,7 +1338,10 @@ void SvXMLNumFmtExport::ExportPart_Impl( const 
SvNumberformat& rFormat, sal_uInt
 case NF_KEY_R:
 case NF_KEY_RR:
 if (aCalendar.isEmpty())
+{
 aCalendar = lcl_GetDefaultCalendar( pFormatter, nLang 
);
+bImplicitOtherCalendar = true;
+}
 break;
 }
 ++nPos;
@@ -1579,7 +1584,10 @@ void SvXMLNumFmtExport::ExportPart_Impl( const 
SvNumberformat& rFormat, sal_uInt
 
 case NF_SYMBOLTYPE_CALENDAR:
 if ( pElemStr )
+{
 aCalendar = *pElemStr;
+bExplicitCalendar = true;
+}
 break;
 
 // date elements:
@@ -1640,10 +1648,16 @@ void SvXMLNumFmtExport::ExportPart_Impl( const 
SvNumberformat& rFormat, sal_uInt
 case NF_KEY_R:  //! R acts as EE, no attribute available
 {
 //! distinguish EE and R
-//  calendar attribute for E and EE and R is set in 
first loop
+// Calendar attribute for E and EE and R is set in
+// first loop. If set and not an explicit calendar and
+// YY or  is encountered, switch temporarily to
+// Gregorian, i.e. empty calendar name.
 bool bLong = ( nElemType == NF_KEY_ || nElemType 
== NF_KEY_EEC ||
 nElemType == NF_KEY_R );
-WriteYearElement_Impl( aCalendar, ( bSystemDate ? 
bLongSysDate : bLong ) );
+WriteYearElement_Impl(
+((bImplicitOtherCalendar && !bExplicitCalendar
+  && (nElemType == NF_KEY_YY || nElemType == 
NF_KEY_)) ? OUString() : aCalendar),
+(bSystemDate ? bLongSysDate : bLong));
 bAnyContent = true;
 }
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: Cherry pick for 7.1.1

2021-02-19 Thread Eike Rathke
Hi Dante,

On Thursday, 2021-02-18 18:02:25 +0100, Dante Doménech wrote:

> I did cherry pick a patch for 7.1.1

As a side note, please don't create cherry-picks to release branches
before the original change wasn't even merged to master, here
https://gerrit.libreoffice.org/c/core/+/55

Thanks
  Eike

-- 
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/inc sc/source

2021-02-18 Thread Eike Rathke (via logerrit)
 sc/inc/validat.hxx  |   10 
 sc/source/core/data/validat.cxx |   81 ++--
 2 files changed, 64 insertions(+), 27 deletions(-)

New commits:
commit ada5033f8edc29b0e97962765947ea40bc6dfaa0
Author: Eike Rathke 
AuthorDate: Fri Sep 25 23:26:19 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Feb 18 16:36:22 2021 +0100

Consolidate, factor out common duplicated code, tdf#128797 follow-up

Change-Id: I939c9f88a6cf09e1caa87131562ad67e389c2710
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103470
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit ebe4bbb25a9bcb4263b079a50d932384c7c7fb3e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/45
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index d4e92bd9ce4e..19c4bb31c354 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -34,6 +34,7 @@ struct RefUpdateContext;
 class ScPatternAttr;
 class ScTokenArray;
 class ScTypedStrData;
+struct ScValidationDataIsNumeric;
 
 enum ScValidationMode
 {
@@ -183,6 +184,15 @@ private:
 
 /** Tests, if contents of pCell occur in cell range referenced by own 
formula, or in a string list. */
 bool IsListValid( ScRefCellValue& rCell, const ScAddress& rPos ) const;
+
+/** Tests, if string or numeric data has valid text length.
+@param pDataNumeric
+nullptr if string data to be tested, else for numeric data a
+properly initialized ScValidationDataIsNumeric struct, see
+implementation.
+ */
+bool IsDataValidTextLen( const OUString& rTest, const ScAddress& rPos,
+ScValidationDataIsNumeric* pDataNumeric ) const;
 };
 
 //  list of conditions:
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 221796a9567e..2600d9cc668e 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -471,6 +471,53 @@ bool ScValidationData::IsDataValidCustom(
 return bRet;
 }
 
+/** To test numeric data text length in IsDataValidTextLen().
+
+If mpFormatter is not set, it is obtained from the document and the format
+key is determined from the cell position's attribute pattern.
+ */
+struct ScValidationDataIsNumeric
+{
+SvNumberFormatter*  mpFormatter;
+double  mfVal;
+sal_uInt32  mnFormat;
+
+ScValidationDataIsNumeric( double fVal, SvNumberFormatter* pFormatter = 
nullptr, sal_uInt32 nFormat = 0 )
+: mpFormatter(pFormatter), mfVal(fVal), mnFormat(nFormat)
+{
+}
+
+void init( const ScDocument& rDoc, const ScAddress& rPos )
+{
+const ScPatternAttr* pPattern = rDoc.GetPattern( rPos.Col(), 
rPos.Row(), rPos.Tab());
+mpFormatter = rDoc.GetFormatTable();
+mnFormat = pPattern->GetNumberFormat( mpFormatter);
+}
+};
+
+bool ScValidationData::IsDataValidTextLen( const OUString& rTest, const 
ScAddress& rPos,
+ScValidationDataIsNumeric* pDataNumeric ) const
+{
+sal_Int32 nLen;
+if (!pDataNumeric)
+nLen = rTest.getLength();
+else
+{
+if (!pDataNumeric->mpFormatter)
+pDataNumeric->init( *GetDocument(), rPos);
+
+// For numeric values use the resulting input line string to
+// determine length, otherwise an once accepted value maybe could
+// not be edited again, for example abbreviated dates or leading
+// zeros or trailing zeros after decimal separator change length.
+OUString aStr;
+pDataNumeric->mpFormatter->GetInputLineString( pDataNumeric->mfVal, 
pDataNumeric->mnFormat, aStr);
+nLen = aStr.getLength();
+}
+ScRefCellValue aTmpCell( static_cast(nLen));
+return IsCellValid( aTmpCell, rPos);
+}
+
 bool ScValidationData::IsDataValid(
 const OUString& rTest, const ScPatternAttr& rPattern, const ScAddress& 
rPos ) const
 {
@@ -493,21 +540,13 @@ bool ScValidationData::IsDataValid(
 bool bRet;
 if (SC_VALID_TEXTLEN == eDataMode)
 {
-double nLenVal;
 if (!bIsVal)
-nLenVal = static_cast(rTest.getLength());
+bRet = IsDataValidTextLen( rTest, rPos, nullptr);
 else
 {
-// For numeric values use the resulting input line string to
-// determine length, otherwise an once accepted value maybe could
-// not be edited again, for example abbreviated dates or leading
-// zeros or trailing zeros after decimal separator change length.
-OUString aStr;
-pFormatter->GetInputLineString( nVal, nFormat, aStr);
-nLenVal = static_cast( aStr.getLength() );
+ScValidationDataIsNumeric aDataNumeric( nVal, pFormatter, nFormat);
+bRet = IsDataValidTextLen( rTest, rPos, );
 }
-ScRefCel

[Libreoffice-commits] core.git: sc/source

2021-02-16 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/interpr1.cxx |   19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 64701c68b5878209574663fd1b0ed333cd181511
Author: Eike Rathke 
AuthorDate: Mon Feb 15 20:28:22 2021 +0100
Commit: Eike Rathke 
CommitDate: Tue Feb 16 11:19:56 2021 +0100

Resolves: tdf#66409 CELL() 2nd argument range take top-left cell

... instead of the otherwise usual intersecting position.

Change-Id: I0edbf32b39e45e1c8fe8fcd7af2c84380aa4cd6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110951
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0d86f2c4dac9..65200917a8cc 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2243,7 +2243,6 @@ void ScInterpreter::ScCell()
 return;
 
 ScAddress aCellPos( aPos );
-bool bError = false;
 if( nParamCount == 2 )
 {
 switch (GetStackType())
@@ -2255,13 +2254,25 @@ void ScInterpreter::ScCell()
 ScCellExternal();
 return;
 }
+case svDoubleRef:
+{
+// Exceptionally not an intersecting position but top left.
+// See ODF v1.3 part 4 OpenFormula 6.13.3 CELL
+ScRange aRange;
+PopDoubleRef( aRange);
+aCellPos = aRange.aStart;
+}
+break;
+case svSingleRef:
+PopSingleRef( aCellPos);
+break;
 default:
-;
+PopError();
+SetError( FormulaError::NoRef);
 }
-bError = !PopDoubleRefOrSingleRef( aCellPos );
 }
 OUString aInfoType = GetString().getString();
-if( bError || nGlobalError != FormulaError::NONE )
+if (nGlobalError != FormulaError::NONE)
 PushIllegalParameter();
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: i18nlangtag/source include/i18nlangtag svtools/inc

2021-02-12 Thread Eike Rathke (via logerrit)
 i18nlangtag/source/isolang/isolang.cxx |2 ++
 include/i18nlangtag/lang.h |2 ++
 svtools/inc/langtab.hrc|4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 9b6a84916a8f58f2c4db2c970eb2c366465c6472
Author: Eike Rathke 
AuthorDate: Fri Feb 12 21:27:40 2021 +0100
Commit: Eike Rathke 
CommitDate: Sat Feb 13 00:05:47 2021 +0100

Resolves: tdf#138839 Add Cabécar {cjp-CR} 0x06AA, Bribri {bzd-CR} 0x06AB

Change-Id: Ib80d080fc69ba2c87c9a859a0571f9d82f7c7bac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110832
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/i18nlangtag/source/isolang/isolang.cxx 
b/i18nlangtag/source/isolang/isolang.cxx
index b1dc5dfe4b69..29b957a63976 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -690,6 +690,8 @@ IsoLanguageCountryEntry const aImplIsoLangEntries[] =
 { LANGUAGE_USER_SUNDANESE, "sun", "ID", k0},
 { LANGUAGE_USER_YAKA_DRCONGO,  "yaf", "CD", k0},
 { LANGUAGE_USER_ENGLISH_KENYA,  "en", "KE", k0},
+{ LANGUAGE_USER_CABECAR,   "cjp", "CR", k0},
+{ LANGUAGE_USER_BRIBRI,"bzd", "CR", k0},
 { LANGUAGE_MULTIPLE,   "mul", ""  , k0},// 
multiple languages, many languages are used
 { LANGUAGE_UNDETERMINED,   "und", ""  , k0},// 
undetermined language, language cannot be identified
 { LANGUAGE_NONE,   "zxx", ""  , k0},// added 
to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic 
information
diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h
index 73f839eac9ee..ec264556 100644
--- a/include/i18nlangtag/lang.h
+++ b/include/i18nlangtag/lang.h
@@ -763,6 +763,8 @@ namespace o3tl
 #define LANGUAGE_USER_YAKA_DRCONGO  LanguageType(0x06A9)
 #define LANGUAGE_USER_ENGLISH_KENYA LanguageType(0xAC09)  /* 
makeLangID( 0x2B, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
 #define LANGUAGE_USER_PALI_THAI LanguageType(0x0A67)  /* 
makeLangID( 0x02, getPrimaryLanguage( LANGUAGE_USER_PALI_LATIN)) */
+#define LANGUAGE_USER_CABECAR   LanguageType(0x06AA)
+#define LANGUAGE_USER_BRIBRILanguageType(0x06AB)
 
 
 /* XXX Add new user defined LCIDs ^^^ there.
diff --git a/svtools/inc/langtab.hrc b/svtools/inc/langtab.hrc
index 49e0f8672945..280219f8e960 100644
--- a/svtools/inc/langtab.hrc
+++ b/svtools/inc/langtab.hrc
@@ -428,7 +428,9 @@ const std::pair 
STR_ARR_SVT_LANGUAGE_TABLE[] =
 { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Sundanese") , LANGUAGE_USER_SUNDANESE 
},
 { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "English (Hong Kong)") , 
LANGUAGE_ENGLISH_HONG_KONG_SAR },
 { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "English (Kenya)") , 
LANGUAGE_USER_ENGLISH_KENYA },
-{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Pali Thai") , LANGUAGE_USER_PALI_THAI 
}
+{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Pali Thai") , LANGUAGE_USER_PALI_THAI 
},
+{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Cabécar") , LANGUAGE_USER_CABECAR },
+{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Bribri") , LANGUAGE_USER_BRIBRI }
 };
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: There is a problem with Gerrit WIP.

2021-02-08 Thread Eike Rathke
Hi,

On Wednesday, 2021-02-03 18:39:02 +0100, Eike Rathke wrote:

> Unfortunately git-review (which I prefer due to its check for multiple
> outstanding commits and easy topic handling) seems to not have a similar
> switch for that.

I stand corrected..

As of v1.27 git-review has the -w or --work-in-progress option that does
exactly that. It's not documented in the man page but with git-review
--help.

Thanks to David Ostrovsky for pointing out.

  Eike

-- 
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: There is a problem with Gerrit WIP.

2021-02-03 Thread Eike Rathke
Hi,

On Wednesday, 2021-02-03 08:02:28 +0200, Ilmari Lauhakangas wrote:

>  you can submit
> your patch as WIP from the start with
> 
> ./logerrit submit-wip master

Just to mention for people not using ./logerrit but git push instead,
that appends %wip to the remote gerrit refspec, so equals

git push ssh://logerrit/core HEAD:refs/for/master%wip

Unfortunately git-review (which I prefer due to its check for multiple
outstanding commits and easy topic handling) seems to not have a similar
switch for that.

  Eike

-- 
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: i18nlangtag/source include/i18nlangtag svtools/inc

2021-02-01 Thread Eike Rathke (via logerrit)
 i18nlangtag/source/isolang/isolang.cxx  |1 +
 i18nlangtag/source/isolang/mslangid.cxx |7 +--
 include/i18nlangtag/lang.h  |1 +
 svtools/inc/langtab.hrc |3 ++-
 4 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 6e3877e4da10284d91813cc0b52ea79a7e9c39f0
Author: Eike Rathke 
AuthorDate: Mon Feb 1 16:09:45 2021 +0100
Commit: Eike Rathke 
CommitDate: Mon Feb 1 19:43:13 2021 +0100

Resolves: tdf#139607 Add Pali Thai {pi-Thai} 0x0A67 to CTL language list

Change-Id: Iccd2c93e220c0580ed27d414477b81ebe8efdf45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110257
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/i18nlangtag/source/isolang/isolang.cxx 
b/i18nlangtag/source/isolang/isolang.cxx
index ae1b42ba3ab0..b1dc5dfe4b69 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -725,6 +725,7 @@ IsoLanguageScriptCountryEntry const 
aImplIsoLangScriptEntries[] =
 { LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA,   "mn-Mong", "CN", k0},  
 // macrolanguage code; MS, should actually be mvf-CN
 { LANGUAGE_MONGOLIAN_MONGOLIAN_LSO, "mn-Mong", ""  , k0},  
 // macrolanguage code
 { LANGUAGE_USER_PALI_LATIN, "pi-Latn", ""  , k0},
+{ LANGUAGE_USER_PALI_THAI,  "pi-Thai", ""  , k0},
 { LANGUAGE_USER_KARAKALPAK_LATIN,  "kaa-Latn", "UZ", k0},
 { LANGUAGE_TAJIK,   "tg-Cyrl", "TJ", k0},  
 // MS
 { LANGUAGE_TAJIK_LSO,   "tg-Cyrl", ""  , k0},  
 // MS
diff --git a/i18nlangtag/source/isolang/mslangid.cxx 
b/i18nlangtag/source/isolang/mslangid.cxx
index 0d76ba3b8288..ae6cd6291672 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -310,7 +310,9 @@ bool MsLangId::needsSequenceChecking( LanguageType nLang )
 primary(LANGUAGE_BURMESE),
 primary(LANGUAGE_KHMER),
 primary(LANGUAGE_LAO),
-primary(LANGUAGE_THAI));
+primary(LANGUAGE_THAI))
+|| nLang.anyOf(
+LANGUAGE_USER_PALI_THAI);
 }
 
 
@@ -335,7 +337,8 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang )
  LANGUAGE_USER_MANCHU,
  LANGUAGE_USER_XIBE,
  LANGUAGE_USER_MALAY_ARABIC_MALAYSIA,
- LANGUAGE_USER_MALAY_ARABIC_BRUNEI))
+ LANGUAGE_USER_MALAY_ARABIC_BRUNEI,
+ LANGUAGE_USER_PALI_THAI))
 {
 nScript = css::i18n::ScriptType::COMPLEX;
 }
diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h
index d3b0ece0bce6..73f839eac9ee 100644
--- a/include/i18nlangtag/lang.h
+++ b/include/i18nlangtag/lang.h
@@ -762,6 +762,7 @@ namespace o3tl
 #define LANGUAGE_USER_SUNDANESE LanguageType(0x06A8)
 #define LANGUAGE_USER_YAKA_DRCONGO  LanguageType(0x06A9)
 #define LANGUAGE_USER_ENGLISH_KENYA LanguageType(0xAC09)  /* 
makeLangID( 0x2B, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_PALI_THAI LanguageType(0x0A67)  /* 
makeLangID( 0x02, getPrimaryLanguage( LANGUAGE_USER_PALI_LATIN)) */
 
 
 /* XXX Add new user defined LCIDs ^^^ there.
diff --git a/svtools/inc/langtab.hrc b/svtools/inc/langtab.hrc
index 47bce2b1aa76..49e0f8672945 100644
--- a/svtools/inc/langtab.hrc
+++ b/svtools/inc/langtab.hrc
@@ -427,7 +427,8 @@ const std::pair 
STR_ARR_SVT_LANGUAGE_TABLE[] =
 { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Minangkabau") , 
LANGUAGE_USER_MINANGKABAU },
 { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Sundanese") , LANGUAGE_USER_SUNDANESE 
},
 { NC_("STR_ARR_SVT_LANGUAGE_TABLE", "English (Hong Kong)") , 
LANGUAGE_ENGLISH_HONG_KONG_SAR },
-{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "English (Kenya)") , 
LANGUAGE_USER_ENGLISH_KENYA }
+{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "English (Kenya)") , 
LANGUAGE_USER_ENGLISH_KENYA },
+{ NC_("STR_ARR_SVT_LANGUAGE_TABLE", "Pali Thai") , LANGUAGE_USER_PALI_THAI 
}
 };
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - download.lst

2021-01-19 Thread Eike Rathke (via logerrit)
 download.lst |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 15f83d08ad2fd5be3069e2952483251f95bb9fd9
Author: Eike Rathke 
AuthorDate: Fri Jan 15 18:21:30 2021 +0100
Commit: Xisco Fauli 
CommitDate: Tue Jan 19 10:57:25 2021 +0100

Update language-subtag-registry to 2020-12-18

Change-Id: I8c813005d8a1165e0baab81fd9f8b47c0aa3aa62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109387
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 9e6f2b5eb712cc483d735132b0557dee4e593193)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109574
Reviewed-by: Xisco Fauli 

diff --git a/download.lst b/download.lst
index 7022b6dce4aa..84c8edda6b36 100644
--- a/download.lst
+++ b/download.lst
@@ -142,8 +142,8 @@ export JFREEREPORT_SAC_SHA256SUM := 
085f2112c51fa8c1783fac12fbd45265059641512134
 export JFREEREPORT_SAC_TARBALL := 
39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
 export LIBJPEG_TURBO_SHA256SUM := 
b24890e2bb46e12e72a79f7e965f409f4e16466d00e1dd15d93d73ee6b592523
 export LIBJPEG_TURBO_TARBALL := libjpeg-turbo-1.5.3.tar.gz
-export LANGTAGREG_SHA256SUM := 
cbe9fca811a37056560aab73e9fc9d3522b46b6785cb02db165f521bf42c230f
-export LANGTAGREG_TARBALL := language-subtag-registry-2020-09-29.tar.bz2
+export LANGTAGREG_SHA256SUM := 
62ce680d5db0f28001b64bd57db47f388c13629cdefc9af8e8af0fbe93689ba1
+export LANGTAGREG_TARBALL := language-subtag-registry-2020-12-18.tar.bz2
 export LANGUAGETOOL_SHA256SUM := 
48c87e41636783bba438b65fd895821e369ed139e1465fac654323ad93c5a82d
 export LANGUAGETOOL_TARBALL := 
b63e6340a02ff1cacfeadb2c42286161-JLanguageTool-1.7.0.tar.bz2
 export LCMS2_SHA256SUM := 
dc49b9c8e4d7cdff376040571a722902b682a795bf92985a85b48854c270772e
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: download.lst

2021-01-16 Thread Eike Rathke (via logerrit)
 download.lst |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9e6f2b5eb712cc483d735132b0557dee4e593193
Author: Eike Rathke 
AuthorDate: Fri Jan 15 18:21:30 2021 +0100
Commit: Eike Rathke 
CommitDate: Sat Jan 16 18:06:11 2021 +0100

Update language-subtag-registry to 2020-12-18

Change-Id: I8c813005d8a1165e0baab81fd9f8b47c0aa3aa62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109387
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/download.lst b/download.lst
index f4a442525c03..c2e11b17c695 100644
--- a/download.lst
+++ b/download.lst
@@ -142,8 +142,8 @@ export JFREEREPORT_SAC_SHA256SUM := 
085f2112c51fa8c1783fac12fbd45265059641512134
 export JFREEREPORT_SAC_TARBALL := 
39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
 export LIBJPEG_TURBO_SHA256SUM := 
b24890e2bb46e12e72a79f7e965f409f4e16466d00e1dd15d93d73ee6b592523
 export LIBJPEG_TURBO_TARBALL := libjpeg-turbo-1.5.3.tar.gz
-export LANGTAGREG_SHA256SUM := 
cbe9fca811a37056560aab73e9fc9d3522b46b6785cb02db165f521bf42c230f
-export LANGTAGREG_TARBALL := language-subtag-registry-2020-09-29.tar.bz2
+export LANGTAGREG_SHA256SUM := 
62ce680d5db0f28001b64bd57db47f388c13629cdefc9af8e8af0fbe93689ba1
+export LANGTAGREG_TARBALL := language-subtag-registry-2020-12-18.tar.bz2
 export LANGUAGETOOL_SHA256SUM := 
48c87e41636783bba438b65fd895821e369ed139e1465fac654323ad93c5a82d
 export LANGUAGETOOL_TARBALL := 
b63e6340a02ff1cacfeadb2c42286161-JLanguageTool-1.7.0.tar.bz2
 export LCMS2_SHA256SUM := 
dc49b9c8e4d7cdff376040571a722902b682a795bf92985a85b48854c270772e
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/source

2021-01-07 Thread Eike Rathke (via logerrit)
 sw/source/filter/xml/xmltbli.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 428244a88ab01c68a8dec4d39eff3c0ece69b784
Author: Eike Rathke 
AuthorDate: Wed Jan 6 15:02:05 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Jan 7 10:52:28 2021 +0100

Resolves: tdf#139126 DBL_MAX is a valid value, just not for Writer

Restore the old side effect behaviour where
"1.79769313486232E+308" was not converted back to DBL_MAX, Writer
doesn't check cell value after import for this "special value",
*cough*.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108875
Tested-by: Jenkins
    Reviewed-by: Eike Rathke 
(cherry picked from commit 0e37ded8d4aea25e5d9f7325fba0597f509147bc)

 Conflicts:
sw/source/filter/xml/xmltbli.cxx

Change-Id: I31cf598d5f91d1f727d5f1f0e936a3505ea1b9e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108900
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 5a95befacf47..de540a39e17a 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -498,8 +498,10 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
 break;
 case XML_TOK_TABLE_VALUE:
 {
+// Writer wrongly uses DBL_MAX to flag error but fails to
+// check for it after import, so check that here, tdf#139126.
 double fTmp;
-if (::sax::Converter::convertDouble(fTmp, rValue))
+if (::sax::Converter::convertDouble(fTmp, rValue) && fTmp < 
DBL_MAX)
 {
 m_fValue = fTmp;
 m_bHasValue = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source

2021-01-07 Thread Eike Rathke (via logerrit)
 sw/source/filter/xml/xmltbli.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 2569211290f460b4401a85f0540e965807bc5a34
Author: Eike Rathke 
AuthorDate: Wed Jan 6 15:02:05 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Jan 7 10:52:12 2021 +0100

Resolves: tdf#139126 DBL_MAX is a valid value, just not for Writer

Restore the old side effect behaviour where
"1.79769313486232E+308" was not converted back to DBL_MAX, Writer
doesn't check cell value after import for this "special value",
*cough*.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108875
Tested-by: Jenkins
    Reviewed-by: Eike Rathke 
(cherry picked from commit 0e37ded8d4aea25e5d9f7325fba0597f509147bc)

 Conflicts:
sw/source/filter/xml/xmltbli.cxx

Change-Id: I31cf598d5f91d1f727d5f1f0e936a3505ea1b9e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108916
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 560e568c5f8e..518a0eec75e7 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -498,8 +498,10 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
 break;
 case XML_TOK_TABLE_VALUE:
 {
+// Writer wrongly uses DBL_MAX to flag error but fails to
+// check for it after import, so check that here, tdf#139126.
 double fTmp;
-if (::sax::Converter::convertDouble(fTmp, rValue))
+if (::sax::Converter::convertDouble(fTmp, rValue) && fTmp < 
DBL_MAX)
 {
 m_fValue = fTmp;
 m_bHasValue = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - scaddins/source

2021-01-07 Thread Eike Rathke (via logerrit)
 scaddins/source/analysis/analysis.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8c7266b084fe95460c1e8b5e27bb4464ca1cc20a
Author: Eike Rathke 
AuthorDate: Wed Jan 6 01:24:41 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Jan 7 10:31:53 2021 +0100

Resolves: tdf#139173 One-off error in limits for DEC2HEX()

BIN2HEX() and OCT2HEX() were not affected because the string input
is already limited to 10 characters and the converted decimal
can't even reach the limits.

Change-Id: Iba4212e8fc382287a1a454edf91426ba21497ae2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108824
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 70ea6b36df9ede18b135876d9b9da9945f6c129b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108897
Reviewed-by: Xisco Fauli 

diff --git a/scaddins/source/analysis/analysis.cxx 
b/scaddins/source/analysis/analysis.cxx
index 2669a00c2633..150a989787a1 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -701,7 +701,7 @@ const doubleSCA_MAX2= 511.0;// min. 
val for binary numbe
 const doubleSCA_MIN2= -SCA_MAX2-1.0;// min. val for binary 
numbers (9 bits + sign)
 const doubleSCA_MAX8= 536870911.0;  // max. val for octal 
numbers (29 bits + sign)
 const doubleSCA_MIN8= -SCA_MAX8-1.0;// min. val for octal 
numbers (29 bits + sign)
-const doubleSCA_MAX16   = 549755813888.0;   // max. val for 
hexadecimal numbers (39 bits + sign)
+const doubleSCA_MAX16   = 549755813887.0;   // max. val for 
hexadecimal numbers (39 bits + sign)
 const doubleSCA_MIN16   = -SCA_MAX16-1.0;   // min. val for 
hexadecimal numbers (39 bits + sign)
 const sal_Int32 SCA_MAXPLACES   = 10;   // max. number of places
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - scaddins/source

2021-01-07 Thread Eike Rathke (via logerrit)
 scaddins/source/analysis/analysis.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 072b43a4bdf8392c9a6a8cb1ad5e8a3e61c60117
Author: Eike Rathke 
AuthorDate: Wed Jan 6 01:24:41 2021 +0100
Commit: Xisco Fauli 
CommitDate: Thu Jan 7 10:31:33 2021 +0100

Resolves: tdf#139173 One-off error in limits for DEC2HEX()

BIN2HEX() and OCT2HEX() were not affected because the string input
is already limited to 10 characters and the converted decimal
can't even reach the limits.

Change-Id: Iba4212e8fc382287a1a454edf91426ba21497ae2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108824
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 70ea6b36df9ede18b135876d9b9da9945f6c129b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108896
Reviewed-by: Xisco Fauli 

diff --git a/scaddins/source/analysis/analysis.cxx 
b/scaddins/source/analysis/analysis.cxx
index 9db4d55fee6f..d5226516000d 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -664,7 +664,7 @@ const doubleSCA_MAX2= 511.0;// min. 
val for binary numbe
 const doubleSCA_MIN2= -SCA_MAX2-1.0;// min. val for binary 
numbers (9 bits + sign)
 const doubleSCA_MAX8= 536870911.0;  // max. val for octal 
numbers (29 bits + sign)
 const doubleSCA_MIN8= -SCA_MAX8-1.0;// min. val for octal 
numbers (29 bits + sign)
-const doubleSCA_MAX16   = 549755813888.0;   // max. val for 
hexadecimal numbers (39 bits + sign)
+const doubleSCA_MAX16   = 549755813887.0;   // max. val for 
hexadecimal numbers (39 bits + sign)
 const doubleSCA_MIN16   = -SCA_MAX16-1.0;   // min. val for 
hexadecimal numbers (39 bits + sign)
 const sal_Int32 SCA_MAXPLACES   = 10;   // max. number of places
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2021-01-06 Thread Eike Rathke (via logerrit)
 sw/source/filter/xml/xmltbli.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 0e37ded8d4aea25e5d9f7325fba0597f509147bc
Author: Eike Rathke 
AuthorDate: Wed Jan 6 15:02:05 2021 +0100
Commit: Eike Rathke 
CommitDate: Thu Jan 7 00:32:43 2021 +0100

Resolves: tdf#139126 DBL_MAX is a valid value, just not for Writer

Restore the old side effect behaviour where
"1.79769313486232E+308" was not converted back to DBL_MAX, Writer
doesn't check cell value after import for this "special value",
*cough*.

Change-Id: I31cf598d5f91d1f727d5f1f0e936a3505ea1b9e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108875
Tested-by: Jenkins
    Reviewed-by: Eike Rathke 

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 263fe55c188c..061ea32d63e5 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -396,8 +396,10 @@ SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl(
 break;
 case XML_ELEMENT(OFFICE, XML_VALUE):
 {
+// Writer wrongly uses DBL_MAX to flag error but fails to
+// check for it after import, so check that here, tdf#139126.
 double fTmp;
-if (::sax::Converter::convertDouble(fTmp, aIter.toView()))
+if (::sax::Converter::convertDouble(fTmp, aIter.toView()) && 
fTmp < DBL_MAX)
 {
 m_fValue = fTmp;
 m_bHasValue = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - pyuno/source scaddins/source

2021-01-06 Thread Eike Rathke (via logerrit)
 pyuno/source/module/uno.py|7 ---
 scaddins/source/analysis/analysis.cxx |2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 70ea6b36df9ede18b135876d9b9da9945f6c129b
Author: Eike Rathke 
AuthorDate: Wed Jan 6 01:24:41 2021 +0100
Commit: Eike Rathke 
CommitDate: Wed Jan 6 17:37:40 2021 +0100

Resolves: tdf#139173 One-off error in limits for DEC2HEX()

BIN2HEX() and OCT2HEX() were not affected because the string input
is already limited to 10 characters and the converted decimal
can't even reach the limits.

Change-Id: Iba4212e8fc382287a1a454edf91426ba21497ae2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108824
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/scaddins/source/analysis/analysis.cxx 
b/scaddins/source/analysis/analysis.cxx
index 6fb4e9b958ff..3f7f4317eb55 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -661,7 +661,7 @@ const doubleSCA_MAX2= 511.0;// min. 
val for binary numbe
 const doubleSCA_MIN2= -SCA_MAX2-1.0;// min. val for binary 
numbers (9 bits + sign)
 const doubleSCA_MAX8= 536870911.0;  // max. val for octal 
numbers (29 bits + sign)
 const doubleSCA_MIN8= -SCA_MAX8-1.0;// min. val for octal 
numbers (29 bits + sign)
-const doubleSCA_MAX16   = 549755813888.0;   // max. val for 
hexadecimal numbers (39 bits + sign)
+const doubleSCA_MAX16   = 549755813887.0;   // max. val for 
hexadecimal numbers (39 bits + sign)
 const doubleSCA_MIN16   = -SCA_MAX16-1.0;   // min. val for 
hexadecimal numbers (39 bits + sign)
 const sal_Int32 SCA_MAXPLACES   = 10;   // max. number of places
 
commit c7568cfdec8ababa4d73eddb7bed057404a6a009
Author: Michael Stahl 
AuthorDate: Tue Jan 5 13:30:26 2021 +0100
Commit: Michael Stahl 
CommitDate: Wed Jan 6 17:37:29 2021 +0100

pyuno: uno.Char is UTF-16 code unit, not UCS-4

Check for that in ctor.

Change-Id: Ia69b3d87ac4ccb5b6cc13169d7022c04607c609f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108803
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index c4ca808feaa0..5fa7b135736d 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -225,9 +225,9 @@ class Char:
 
 Use an instance of this class to explicitly pass a char to UNO.
 
-For Python 2, this class only works with unicode objects. Creating
-a Char instance with a normal str object or comparing a Char instance
-to a normal str object will raise an AssertionError.
+For Python 3, this class only works with unicode (str) objects. Creating
+a Char instance with a bytes object or comparing a Char instance
+to a bytes object will raise an AssertionError.
 
 :param value: A Unicode string with length 1
 """
@@ -236,6 +236,7 @@ class Char:
 assert isinstance(value, str), "Expected str object, got %s instead." 
% type(value)
 
 assert len(value) == 1, "Char value must have length of 1."
+assert ord(value[0]) <= 0x, "Char value must be UTF-16 code unit"
 
 self.value = value
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - include/svl svl/source

2021-01-06 Thread Eike Rathke (via logerrit)
 include/svl/zformat.hxx|8 
 svl/source/numbers/zformat.cxx |   27 ++-
 2 files changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 44d17f8feca372acd41142d1b607d3360282bf30
Author: Eike Rathke 
AuthorDate: Tue Oct 13 21:41:45 2020 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jan 6 11:47:06 2021 +0100

Resolves: tdf#137453 Implicit conversion from sal_uInt64 to sal_Int32 is 
bad..

Change-Id: I5681249808cf623d3b7df09988f285268ea8d85f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104255
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 18f8a7056ac7b4677f4d99aac24ed2db44010140)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108730
Reviewed-by: Xisco Fauli 

diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index 089a4b0e48e6..3dbc0f925ceb 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -657,8 +657,8 @@ private:
 SVL_DLLPRIVATE void ImpGetFractionElements( double& fNumber,
 sal_uInt16 nIx,
 double& fIntPart,
-sal_uInt64& nFrac,
-sal_uInt64& nDiv ) const;
+sal_Int64& nFrac,
+sal_Int64& nDiv ) const;
 SVL_DLLPRIVATE bool ImpGetFractionOutput(double fNumber,
  sal_uInt16 nIx,
  OUStringBuffer& OutString);
@@ -697,10 +697,10 @@ private:
 
 // normal digits or other digits, depending on ImpSvNumFor.aNatNum,
 // [NatNum1], [NatNum2], ...
-SVL_DLLPRIVATE OUString ImpGetNatNumString( const SvNumberNatNum& rNum, 
sal_Int32 nVal,
+SVL_DLLPRIVATE OUString ImpGetNatNumString( const SvNumberNatNum& rNum, 
sal_Int64 nVal,
   sal_uInt16 nMinDigits  ) const;
 
-OUString ImpIntToString( sal_uInt16 nIx, sal_Int32 nVal, sal_uInt16 
nMinDigits = 0 ) const
+OUString ImpIntToString( sal_uInt16 nIx, sal_Int64 nVal, sal_uInt16 
nMinDigits = 0 ) const
 {
 const SvNumberNatNum& rNum = NumFor[nIx].GetNatNum();
 if ( nMinDigits || rNum.IsComplete() )
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 9bffb0d833e2..203f27e3ad51 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -63,6 +63,7 @@ const double EXP_ABS_UPPER_BOUND = 1.0E15;  // use 
exponential notation above th
 } // namespace
 
 const double D_MAX_U_INT32 = double(0x);  // 4294967295.0
+constexpr double D_MAX_INTEGER = (sal_uInt64(1) << 53) - 1;
 
 const double D_MAX_D_BY_100  = 1.7E306;
 const double D_MIN_M_BY_1000 = 2.3E-305;
@@ -2759,7 +2760,7 @@ double SvNumberformat::GetRoundFractionValue ( double 
fNumber ) const
 {
 sal_uInt16 nIx = GetSubformatIndex ( fNumber );
 double fIntPart = 0.0;   // integer part of fraction
-sal_uInt64 nFrac = 0, nDiv = 1;  // numerator and denominator
+sal_Int64 nFrac = 0, nDiv = 1;  // numerator and denominator
 double fSign = (fNumber < 0.0) ? -1.0 : 1.0;
 // fNumber is modified in ImpGetFractionElements to absolute fractional 
part
 ImpGetFractionElements ( fNumber, nIx, fIntPart, nFrac, nDiv );
@@ -2770,7 +2771,7 @@ double SvNumberformat::GetRoundFractionValue ( double 
fNumber ) const
 }
 
 void SvNumberformat::ImpGetFractionElements ( double& fNumber, sal_uInt16 nIx,
-  double& fIntPart, sal_uInt64& 
nFrac, sal_uInt64& nDiv ) const
+  double& fIntPart, sal_Int64& 
nFrac, sal_Int64& nDiv ) const
 {
 if ( fNumber < 0.0 )
 fNumber = -fNumber;
@@ -2780,7 +2781,7 @@ void SvNumberformat::ImpGetFractionElements ( double& 
fNumber, sal_uInt16 nIx,
 nDiv = lcl_GetDenominatorString( rInfo, NumFor[nIx].GetCount() ).toInt32();
 if( nDiv > 0 )
 {   // Forced Denominator
-nFrac = static_cast(floor ( fNumber * nDiv ));
+nFrac = static_cast(floor ( fNumber * nDiv ));
 double fFracNew = static_cast(nFrac) / 
static_cast(nDiv);
 double fFracNew1 = static_cast(nFrac + 1) / 
static_cast(nDiv);
 double fDiff = fNumber - fFracNew;
@@ -2792,8 +2793,8 @@ void SvNumberformat::ImpGetFractionElements ( double& 
fNumber, sal_uInt16 nIx,
 else // Calculated Denominator
 {
 nDiv = 1;
-sal_uInt64 nBasis = static_cast(floor( 
pow(10.0,rInfo.nCntExp))) - 1; // 9, 99, 999 ,...
-sal_uInt64 nFracPrev = 1, nDivPrev = 0, nFracNext, nDivNext, 
nPartialDenom;
+sal_Int64 nBasis = static_cast(floor( 
pow(10.0,rInfo.nCntExp))) - 1; // 9, 99, 999 ,...
+

[Libreoffice-commits] core.git: i18npool/source

2020-12-20 Thread Eike Rathke (via logerrit)
 i18npool/source/localedata/LocaleNode.cxx |   25 +
 1 file changed, 25 insertions(+)

New commits:
commit ff804ebff0c94e8780f01dde80c402afd3a5d208
Author: Eike Rathke 
AuthorDate: Sun Dec 20 19:24:36 2020 +0100
Commit: Eike Rathke 
CommitDate: Sun Dec 20 22:11:08 2020 +0100

Check Calendar unoid for unknown and duplicates

https://gerrit.libreoffice.org/c/core/+/108015 tried to add
another Gregorian calendar with a made-up "gregorian_en" unoid.
Prevent that already at build time.

Change-Id: Id1bed6bea28b9c80e75b03753cdb367d3160dac1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108055
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/i18npool/source/localedata/LocaleNode.cxx 
b/i18npool/source/localedata/LocaleNode.cxx
index 3040f3312d42..34c77516cc73 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1559,6 +1560,23 @@ void LCCalendarNode::generateCode (const OFileWriter 
) const
 std::unique_ptr nbOfGenitiveMonths( new 
sal_Int16[nbOfCalendars] );
 std::unique_ptr nbOfPartitiveMonths( new 
sal_Int16[nbOfCalendars] );
 std::unique_ptr nbOfEras( new sal_Int16[nbOfCalendars] );
+
+// Known allowed calendar identifiers (unoid) and whether used or not.
+// Of course there must be an implementation for new to be added
+// identifiers.. see data/locale.dtd
+std::map< OUString, bool > aCalendars;
+aCalendars["buddhist"]   = false;
+aCalendars["gengou"] = false;
+aCalendars["gregorian"]  = false;
+aCalendars["hanja"]  = false;
+aCalendars["hanja_yoil"] = false;
+aCalendars["hijri"]  = false;
+aCalendars["jewish"] = false;
+aCalendars["ROC"]= false;
+// Not in ODF:
+aCalendars["dangi"]  = false;
+aCalendars["persian"]= false;
+
 sal_Int16 j;
 sal_Int16 i;
 bool bHasGregorian = false;
@@ -1571,6 +1589,13 @@ void LCCalendarNode::generateCode (const OFileWriter 
) const
 bool bGregorian = calendarID == "gregorian";
 if (!bHasGregorian)
 bHasGregorian = bGregorian;
+auto calIt = aCalendars.find(calendarID);
+if (calIt == aCalendars.end())
+incErrorStr( "Error: unknown Calendar unoid: %s\n", calendarID);
+else if (calIt->second)
+incErrorStr( "Error: duplicate Calendar unoid: %s\n", calendarID);
+else
+calIt->second = true;
 str = calNode -> getAttr().getValueByName("default");
 of.writeDefaultParameter("Calendar", str, i);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/source

2020-12-20 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/token.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b22674e6283a624308d79a515e5b691f45c2338d
Author: Eike Rathke 
AuthorDate: Fri Dec 18 20:27:34 2020 +0100
Commit: Caolán McNamara 
CommitDate: Sun Dec 20 17:54:46 2020 +0100

Resolves: tdf#138710 Do not push an out-of-bounds bound to boundaries

... if a virtual non-existent row is being shifted in for
MAXROWCOUNT (MAXROW+1), so sc/source/core/tool/sharedformula.cxx
SharedFormulaUtil::splitFormulaCellGroups() is not triggered to
split a group there, which would throw an exception. Instead of
returning false ...

CellStoreType::position_type aPos = rCells.position(nRow);
if (aPos.first == rCells.end())
return false;

However, avoiding the cause is the solution.

Change-Id: I8f9adcb62bb78bc98092677b5d4fdc7fc3baf150
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107979
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 121d4f610a2b4caa871aa0132eccbd4e12d13b3f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107913
Reviewed-by: Caolán McNamara 

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 545ddc8dce08..adf399e2e14e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -4538,7 +4538,8 @@ void checkBounds(
 // No intersections.
 return;
 
-if (aAbs.aStart.Row() <= rCheckRange.aStart.Row())
+// rCheckRange may be a virtual non-existent row being shifted in.
+if (aAbs.aStart.Row() <= rCheckRange.aStart.Row() && 
rCheckRange.aStart.Row() < rLimits.GetMaxRowCount())
 {
 //+-+ < top
 //| |
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/source

2020-12-18 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/token.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit abecbc3eb6d6d9fa6b51c45a52c24a2001ded195
Author: Eike Rathke 
AuthorDate: Fri Dec 18 20:27:34 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Dec 19 02:48:07 2020 +0100

Resolves: tdf#138710 Do not push an out-of-bounds bound to boundaries

... if a virtual non-existent row is being shifted in for
MAXROWCOUNT (MAXROW+1), so sc/source/core/tool/sharedformula.cxx
SharedFormulaUtil::splitFormulaCellGroups() is not triggered to
split a group there, which would throw an exception. Instead of
returning false ...

CellStoreType::position_type aPos = rCells.position(nRow);
if (aPos.first == rCells.end())
return false;

However, avoiding the cause is the solution.

Change-Id: I8f9adcb62bb78bc98092677b5d4fdc7fc3baf150
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107979
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 121d4f610a2b4caa871aa0132eccbd4e12d13b3f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107994

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 859b44327a78..3cb4a8836d61 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -4538,7 +4538,8 @@ void checkBounds(
 // No intersections.
 return;
 
-if (aAbs.aStart.Row() <= rCheckRange.aStart.Row())
+// rCheckRange may be a virtual non-existent row being shifted in.
+if (aAbs.aStart.Row() <= rCheckRange.aStart.Row() && 
rCheckRange.aStart.Row() < rLimits.GetMaxRowCount())
 {
 //+-+ < top
 //| |
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-12-18 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/token.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 121d4f610a2b4caa871aa0132eccbd4e12d13b3f
Author: Eike Rathke 
AuthorDate: Fri Dec 18 20:27:34 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Dec 18 22:47:36 2020 +0100

Resolves: tdf#138710 Do not push an out-of-bounds bound to boundaries

... if a virtual non-existent row is being shifted in for
MAXROWCOUNT (MAXROW+1), so sc/source/core/tool/sharedformula.cxx
SharedFormulaUtil::splitFormulaCellGroups() is not triggered to
split a group there, which would throw an exception. Instead of
returning false ...

CellStoreType::position_type aPos = rCells.position(nRow);
if (aPos.first == rCells.end())
return false;

However, avoiding the cause is the solution.

Change-Id: I8f9adcb62bb78bc98092677b5d4fdc7fc3baf150
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107979
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index df968b26a4fb..91e73e4ac49f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -4530,7 +4530,8 @@ void checkBounds(
 // No intersections.
 return;
 
-if (aAbs.aStart.Row() <= rCheckRange.aStart.Row())
+// rCheckRange may be a virtual non-existent row being shifted in.
+if (aAbs.aStart.Row() <= rCheckRange.aStart.Row() && 
rCheckRange.aStart.Row() < rLimits.GetMaxRowCount())
 {
 //+-+ < top
 //| |
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - include/sal sal/rtl

2020-12-18 Thread Eike Rathke (via logerrit)
 include/sal/mathconf.h |   14 +
 sal/rtl/math.cxx   |  135 +
 2 files changed, 85 insertions(+), 64 deletions(-)

New commits:
commit ead1cdd23f5379f5cd8f69d5e73f410a67896db2
Author: Eike Rathke 
AuthorDate: Thu Dec 17 20:44:43 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Dec 18 11:00:57 2020 +0100

Check intermediate for not to be rounded value, tdf#138360 follow-up

 This is a combination of 3 commits.

Add sal_uInt64 fields to sal_math_Double

We may need them later, and at least don't have a confusing
inf_parts or nan_parts struct name but just parts as well.

Ife0cf279c47d2815aa2a1483223397b147e9d776
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107924
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

Replace log2() call with parts.exponent-1023, tdf#138360 follow-up

... to save some cycles as we anyway need only the integer value
of the exponent and even exactly this value for the number of
possible decimals.

I8d462f53cadde6a95d57d1342d8487fbfa001ae9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107928
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

Check intermediate for not to be rounded value, tdf#138360 follow-up

I98cc25267e7a10c34179bab50d19f49436e1c48c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107929
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

Change-Id: I98cc25267e7a10c34179bab50d19f49436e1c48c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107931
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/include/sal/mathconf.h b/include/sal/mathconf.h
index 687f6e3da133..11bd32c35de0 100644
--- a/include/sal/mathconf.h
+++ b/include/sal/mathconf.h
@@ -104,6 +104,13 @@ union sal_math_Double
 unsigned msw  :32;
 unsigned lsw  :32;
 } w32_parts;
+struct
+{
+sal_uInt64 sign   : 1;
+sal_uInt64 exponent   :11;
+sal_uInt64 fraction   :52;
+} parts;
+sal_uInt64 intrep;
 double value;
 };
 
@@ -130,6 +137,13 @@ union sal_math_Double
 unsigned lsw  :32;
 unsigned msw  :32;
 } w32_parts;
+struct
+{
+sal_uInt64 fraction   :52;
+sal_uInt64 exponent   :11;
+sal_uInt64 sign   : 1;
+} parts;
+sal_uInt64 intrep;
 double value;
 };
 
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 46a3e925b95b..a85c8ac6e959 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1167,9 +1167,10 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 // Determine how many decimals are representable in the precision.
 // Anything greater 2^52 and 0.0 was already ruled out above.
 // Theoretically 0.5, 0.25, 0.125, 0.0625, 0.03125, ...
-const double fDec = 52 - log2(fValue) + 1;
-if (fDec < nDecPlaces)
-nDecPlaces = static_cast(fDec);
+const sal_math_Double* pd = reinterpret_cast();
+const sal_Int32 nDec = 52 - (pd->parts.exponent - 1023);
+if (nDec < nDecPlaces)
+nDecPlaces = nDec;
 }
 
 /* TODO: this was without the inverse factor and determining max
@@ -1190,75 +1191,81 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 fValue *= fFac;
 }
 
-switch ( eMode )
+// Round only if not already in distance precision gaps of integers, where
+// for [2^52,2^53) adding 0.5 would even yield the next representable
+// integer.
+if (fValue < (static_cast(1) << 52))
 {
-case rtl_math_RoundingMode_Corrected :
-fValue = rtl::math::approxFloor(fValue + 0.5);
-break;
-case rtl_math_RoundingMode_Down:
-fValue = rtl::math::approxFloor(fValue);
-break;
-case rtl_math_RoundingMode_Up:
-fValue = rtl::math::approxCeil(fValue);
-break;
-case rtl_math_RoundingMode_Floor:
-fValue = bSign ? rtl::math::approxCeil(fValue)
-: rtl::math::approxFloor( fValue );
-break;
-case rtl_math_RoundingMode_Ceiling:
-fValue = bSign ? rtl::math::approxFloor(fValue)
-: rtl::math::approxCeil(fValue);
-break;
-case rtl_math_RoundingMode_HalfDown :
-{
-double f = floor(fValue);
-fValue = ((fValue - f) <= 0.5) ? f : ceil(fValue);
-}
-break;
-case rtl_math_RoundingMode_HalfUp:
+switch ( eMode )
 {
-double f = floor(fValue);
-fValue = ((fValue - f) < 0.5) ? f : ceil(fValue);
-}
-break;
-case rtl_math_RoundingMode_HalfEven:
+case rtl_math_RoundingMode_Corrected :
+fValue = rtl::math::approxFloor(fValue + 

[Libreoffice-commits] core.git: sal/rtl

2020-12-17 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |  128 ---
 1 file changed, 67 insertions(+), 61 deletions(-)

New commits:
commit ecfcd99abd3f7dfe68a306dd8045d2da79e42d74
Author: Eike Rathke 
AuthorDate: Thu Dec 17 23:25:07 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Dec 18 03:17:21 2020 +0100

Check intermediate for not to be rounded value, tdf#138360 follow-up

Change-Id: I98cc25267e7a10c34179bab50d19f49436e1c48c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107929
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 527b508e848c..a85c8ac6e959 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1191,75 +1191,81 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 fValue *= fFac;
 }
 
-switch ( eMode )
+// Round only if not already in distance precision gaps of integers, where
+// for [2^52,2^53) adding 0.5 would even yield the next representable
+// integer.
+if (fValue < (static_cast(1) << 52))
 {
-case rtl_math_RoundingMode_Corrected :
-fValue = rtl::math::approxFloor(fValue + 0.5);
-break;
-case rtl_math_RoundingMode_Down:
-fValue = rtl::math::approxFloor(fValue);
-break;
-case rtl_math_RoundingMode_Up:
-fValue = rtl::math::approxCeil(fValue);
-break;
-case rtl_math_RoundingMode_Floor:
-fValue = bSign ? rtl::math::approxCeil(fValue)
-: rtl::math::approxFloor( fValue );
-break;
-case rtl_math_RoundingMode_Ceiling:
-fValue = bSign ? rtl::math::approxFloor(fValue)
-: rtl::math::approxCeil(fValue);
-break;
-case rtl_math_RoundingMode_HalfDown :
-{
-double f = floor(fValue);
-fValue = ((fValue - f) <= 0.5) ? f : ceil(fValue);
-}
-break;
-case rtl_math_RoundingMode_HalfUp:
+switch ( eMode )
 {
-double f = floor(fValue);
-fValue = ((fValue - f) < 0.5) ? f : ceil(fValue);
-}
-break;
-case rtl_math_RoundingMode_HalfEven:
+case rtl_math_RoundingMode_Corrected :
+fValue = rtl::math::approxFloor(fValue + 0.5);
+break;
+case rtl_math_RoundingMode_Down:
+fValue = rtl::math::approxFloor(fValue);
+break;
+case rtl_math_RoundingMode_Up:
+fValue = rtl::math::approxCeil(fValue);
+break;
+case rtl_math_RoundingMode_Floor:
+fValue = bSign ? rtl::math::approxCeil(fValue)
+: rtl::math::approxFloor( fValue );
+break;
+case rtl_math_RoundingMode_Ceiling:
+fValue = bSign ? rtl::math::approxFloor(fValue)
+: rtl::math::approxCeil(fValue);
+break;
+case rtl_math_RoundingMode_HalfDown :
+{
+double f = floor(fValue);
+fValue = ((fValue - f) <= 0.5) ? f : ceil(fValue);
+}
+break;
+case rtl_math_RoundingMode_HalfUp:
+{
+double f = floor(fValue);
+fValue = ((fValue - f) < 0.5) ? f : ceil(fValue);
+}
+break;
+case rtl_math_RoundingMode_HalfEven:
 #if defined FLT_ROUNDS
-/*
-Use fast version. FLT_ROUNDS may be defined to a function by some 
compilers!
-
-DBL_EPSILON is the smallest fractional number which can be represented,
-its reciprocal is therefore the smallest number that cannot have a
-fractional part. Once you add this reciprocal to `x', its fractional part
-is stripped off. Simply subtracting the reciprocal back out returns `x'
-without its fractional component.
-Simple, clever, and elegant - thanks to Ross Cottrell, the original author,
-who placed it into public domain.
-
-volatile: prevent compiler from being too smart
-*/
-if (FLT_ROUNDS == 1)
-{
-volatile double x = fValue + 1.0 / DBL_EPSILON;
-fValue = x - 1.0 / DBL_EPSILON;
-}
-else
-#endif // FLT_ROUNDS
-{
-double f = floor(fValue);
-if ((fValue - f) != 0.5)
+/*
+   Use fast version. FLT_ROUNDS may be defined to a function 
by some compilers!
+
+   DBL_EPSILON is the smallest fractional number which can be 
represented,
+   its reciprocal is therefore the smallest number that cannot 
have a
+   fractional part. Once you add this reciprocal to `x', its 
fractional part
+   is stripped off. Simply subtracting the reciprocal back out 
returns `x'
+   without its

[Libreoffice-commits] core.git: sal/rtl

2020-12-17 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit a10c33fdbe980effc3a14e773d1b94a14be7d428
Author: Eike Rathke 
AuthorDate: Thu Dec 17 22:02:48 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Dec 18 03:17:03 2020 +0100

Replace log2() call with parts.exponent-1023, tdf#138360 follow-up

... to save some cycles as we anyway need only the integer value
of the exponent and even exactly this value for the number of
possible decimals.

Change-Id: I8d462f53cadde6a95d57d1342d8487fbfa001ae9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107928
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 46a3e925b95b..527b508e848c 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1167,9 +1167,10 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 // Determine how many decimals are representable in the precision.
 // Anything greater 2^52 and 0.0 was already ruled out above.
 // Theoretically 0.5, 0.25, 0.125, 0.0625, 0.03125, ...
-const double fDec = 52 - log2(fValue) + 1;
-if (fDec < nDecPlaces)
-nDecPlaces = static_cast(fDec);
+const sal_math_Double* pd = reinterpret_cast();
+const sal_Int32 nDec = 52 - (pd->parts.exponent - 1023);
+if (nDec < nDecPlaces)
+nDecPlaces = nDec;
 }
 
 /* TODO: this was without the inverse factor and determining max
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/sal

2020-12-17 Thread Eike Rathke (via logerrit)
 include/sal/mathconf.h |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit cb22636a56b35d4e118446cc3c9fe606db6f46b0
Author: Eike Rathke 
AuthorDate: Thu Dec 17 20:44:43 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Dec 18 01:05:16 2020 +0100

Add sal_uInt64 fields to sal_math_Double

We may need them later, and at least don't have a confusing
inf_parts or nan_parts struct name but just parts as well.

Change-Id: Ife0cf279c47d2815aa2a1483223397b147e9d776
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107924
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/include/sal/mathconf.h b/include/sal/mathconf.h
index 8e5831cde3b5..ab6a4807b59f 100644
--- a/include/sal/mathconf.h
+++ b/include/sal/mathconf.h
@@ -104,6 +104,13 @@ union sal_math_Double
 unsigned msw  :32;
 unsigned lsw  :32;
 } w32_parts;
+struct
+{
+sal_uInt64 sign   : 1;
+sal_uInt64 exponent   :11;
+sal_uInt64 fraction   :52;
+} parts;
+sal_uInt64 intrep;
 double value;
 };
 
@@ -130,6 +137,13 @@ union sal_math_Double
 unsigned lsw  :32;
 unsigned msw  :32;
 } w32_parts;
+struct
+{
+sal_uInt64 fraction   :52;
+sal_uInt64 exponent   :11;
+sal_uInt64 sign   : 1;
+} parts;
+sal_uInt64 intrep;
 double value;
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sal/rtl

2020-12-10 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   78 +++
 1 file changed, 78 insertions(+)

New commits:
commit 4c2c161018165b7484233547fea1511c84b3ffe3
Author: Eike Rathke 
AuthorDate: Fri Nov 27 17:38:46 2020 +0100
Commit: Michael Stahl 
CommitDate: Thu Dec 10 15:21:06 2020 +0100

Resolves: tdf#136272 convert DBL_MAX to 1.7976931348623157e+308

 This is a combination of 4 commits.

Resolves: tdf#136272 convert DBL_MAX to 1.7976931348623157e+308

... and the 4 subsequent nextafters to appropriate strings.

An interim workaround to not write the out-of-range string
1.79769313486232e+308 until we have a proper rounding.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106717
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 4713c19e2b79341dc27e66d4c6449497db1e73d8)

Consistently use RTL_CONSTASCII_LENGTH(), tdf#136272 follow-up

The mix with SAL_N_ELEMENTS() was confusing and even wrong in one
case.

Ife73342b0efc01ed4e76e217d372fc32500c9b2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106764
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 1a0f9a9c56e7b7952b813b3efd34f9be6c853957)

Fix comment

I2ae6e3cadc0f182c4798e5d33b0c7f07fbcbbff6
(cherry picked from commit b8404ae521a9c2d183d4e076a7884627ba353e4b)

Typo in rounded digit string, tdf#138360 follow-up

Ic436d3e9f0c93cb36c5e4377519f2aeb6b7fbd5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107034
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit d8e0b1c81ffa16be8aae2231bcd3c02e8c01cf88)

Change-Id: I5f98a7f0a8e0421fd024a8cc37cc6f3a198d02d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106686
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 9c32cff30f2f..bd9d2c8a601f 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -274,6 +274,84 @@ void doubleToString(typename T::String ** pResult,
 return;
 }
 
+// Unfortunately the old rounding below writes 1.79769313486232e+308 for
+// DBL_MAX and 4 subsequent nextafter(...,0).
+static const double fB1 = std::nextafter( DBL_MAX, 0);
+static const double fB2 = std::nextafter( fB1, 0);
+static const double fB3 = std::nextafter( fB2, 0);
+static const double fB4 = std::nextafter( fB3, 0);
+if ((fValue >= fB4) && eFormat != rtl_math_StringFormat_F)
+{
+// 1.7976931348623157e+308 instead of rounded 1.79769313486232e+308
+// that can't be converted back as out of range. For rounded values if
+// they exceed range they should not be written to exchange strings or
+// file formats.
+
+// Writing pDig up to decimals(-1,-2) then appending one digit from
+// pRou xor one or two digits from pSlot[].
+constexpr char pDig[] = "7976931348623157";
+constexpr char pRou[] = "8087931359623267"; // the only up-carry 
is 80
+static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit 
count mismatch");
+constexpr sal_Int32 nDig2 = RTL_CONSTASCII_LENGTH(pRou) - 2;
+sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
+const char pSlot[5][2][3] =
+{ // rounded, not
+"67", "57", // DBL_MAX
+"65", "55",
+"53", "53",
+"51", "51",
+"59", "49",
+};
+
+if (!pResultCapacity)
+{
+pResultCapacity = 
+T::createBuffer(pResult, pResultCapacity);
+nResultOffset = 0;
+}
+
+if (bSign)
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("-"));
+
+nDecPlaces = std::clamp( nDecPlaces, 0, 
RTL_CONSTASCII_LENGTH(pRou));
+if (nDecPlaces == 0)
+{
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("2"));
+}
+else
+{
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("1"));
+T::appendChars(pResult, pResultCapacity, , 
, 1);
+if (nDecPlaces <= 2)
+{
+T::appendAscii(pResult, pResultCapacity, , pRou, 
nDecPlaces);
+}
+else if (nDecPlaces <= nDig2)
+{
+T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces - 1);
+T::appendAscii(pResult, pResultCapacity, , pRou 
+ nDecPlaces - 1, 1);
+}
+else
+{
+const sal_Int32 nDec =

Re: LO calc formulas

2020-12-09 Thread Eike Rathke
Hi,

On Wednesday, 2020-12-09 20:25:17 +0100, Dante Doménech wrote:

> Does anyone know where are implemented the calc formulas?

Regina already gave pointers. Ask if you need more.

> I'd like to check out if it uses the kahan algorithm, pairwise sum or
> something else.

Kahan is not used, but there's
https://bugs.documentfoundation.org/show_bug.cgi?id=137679
to implement it. I thought Roman would start on that but maybe
I misunderstood. So if you'd like to tackle that you're welcome.

The current approach is quite simple, it just remembers one value to add
that later.

  Eike

-- 
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0-4' - sal/rtl

2020-12-09 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   78 +++
 1 file changed, 78 insertions(+)

New commits:
commit 8a4430197982247d58c512fad1c0aea17578f057
Author: Eike Rathke 
AuthorDate: Fri Nov 27 17:38:46 2020 +0100
Commit: Christian Lohmaier 
CommitDate: Wed Dec 9 19:55:37 2020 +0100

Resolves: tdf#136272 convert DBL_MAX to 1.7976931348623157e+308

 This is a combination of 4 commits.

Resolves: tdf#136272 convert DBL_MAX to 1.7976931348623157e+308

... and the 4 subsequent nextafters to appropriate strings.

An interim workaround to not write the out-of-range string
1.79769313486232e+308 until we have a proper rounding.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106717
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 4713c19e2b79341dc27e66d4c6449497db1e73d8)

Consistently use RTL_CONSTASCII_LENGTH(), tdf#136272 follow-up

The mix with SAL_N_ELEMENTS() was confusing and even wrong in one
case.

Ife73342b0efc01ed4e76e217d372fc32500c9b2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106764
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 1a0f9a9c56e7b7952b813b3efd34f9be6c853957)

Fix comment

I2ae6e3cadc0f182c4798e5d33b0c7f07fbcbbff6
(cherry picked from commit b8404ae521a9c2d183d4e076a7884627ba353e4b)

Typo in rounded digit string, tdf#138360 follow-up

Ic436d3e9f0c93cb36c5e4377519f2aeb6b7fbd5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107034
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit d8e0b1c81ffa16be8aae2231bcd3c02e8c01cf88)

Change-Id: I5f98a7f0a8e0421fd024a8cc37cc6f3a198d02d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106687
Reviewed-by: Michael Stahl 
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 9c32cff30f2f..bd9d2c8a601f 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -274,6 +274,84 @@ void doubleToString(typename T::String ** pResult,
 return;
 }
 
+// Unfortunately the old rounding below writes 1.79769313486232e+308 for
+// DBL_MAX and 4 subsequent nextafter(...,0).
+static const double fB1 = std::nextafter( DBL_MAX, 0);
+static const double fB2 = std::nextafter( fB1, 0);
+static const double fB3 = std::nextafter( fB2, 0);
+static const double fB4 = std::nextafter( fB3, 0);
+if ((fValue >= fB4) && eFormat != rtl_math_StringFormat_F)
+{
+// 1.7976931348623157e+308 instead of rounded 1.79769313486232e+308
+// that can't be converted back as out of range. For rounded values if
+// they exceed range they should not be written to exchange strings or
+// file formats.
+
+// Writing pDig up to decimals(-1,-2) then appending one digit from
+// pRou xor one or two digits from pSlot[].
+constexpr char pDig[] = "7976931348623157";
+constexpr char pRou[] = "8087931359623267"; // the only up-carry 
is 80
+static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit 
count mismatch");
+constexpr sal_Int32 nDig2 = RTL_CONSTASCII_LENGTH(pRou) - 2;
+sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
+const char pSlot[5][2][3] =
+{ // rounded, not
+"67", "57", // DBL_MAX
+"65", "55",
+"53", "53",
+"51", "51",
+"59", "49",
+};
+
+if (!pResultCapacity)
+{
+pResultCapacity = 
+T::createBuffer(pResult, pResultCapacity);
+nResultOffset = 0;
+}
+
+if (bSign)
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("-"));
+
+nDecPlaces = std::clamp( nDecPlaces, 0, 
RTL_CONSTASCII_LENGTH(pRou));
+if (nDecPlaces == 0)
+{
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("2"));
+}
+else
+{
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("1"));
+T::appendChars(pResult, pResultCapacity, , 
, 1);
+if (nDecPlaces <= 2)
+{
+T::appendAscii(pResult, pResultCapacity, , pRou, 
nDecPlaces);
+}
+else if (nDecPlaces <= nDig2)
+{
+T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces - 1);
+T::appendAscii(pResult, pResultCapacity, , pRou 
+ nDecPlaces - 1, 1);
+}
+else
+ 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-0-4' - sal/rtl

2020-12-08 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 699c1115788145e7e02fc376aead663e974e3524
Author: Eike Rathke 
AuthorDate: Wed Nov 25 13:54:31 2020 +0100
Commit: Christian Lohmaier 
CommitDate: Tue Dec 8 15:20:35 2020 +0100

Related: tdf#136272 accept 1.79769313486232e+308 as DBL_MAX

This does not solve writing the badly rounded value, which still
has to be fixed, but at least be able to read/convert it back as
double max value.

This is not even used in the bug scenario because the "fake"
condition in that number format is discarded anyway because it was
only written to satisfy ODF, but it helps in case a
1.7976931348623157e+308 value was entered/used on purpose.

Change-Id: I413dd93d5a3c4df609fd42a3133d6d82c34afff0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106586
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit ee2cc952eeb5385ee37485c822d7ad7abd8fb989)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106613
Reviewed-by: Michael Stahl 
Reviewed-by: Adolfo Jayme Barrientos 
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index b01253c70dfa..9c32cff30f2f 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -976,7 +976,26 @@ double stringToDouble(CharT const * pBegin, CharT const * 
pEnd,
 errno = 0;
 fVal = strtod_nolocale(buf, );
 if (errno == ERANGE)
-eStatus = rtl_math_ConversionStatus_OutOfRange;
+{
+// Check for the dreaded rounded to 15 digits max value
+// 1.79769313486232e+308 for 1.7976931348623157e+308 we wrote
+// everywhere, accept with or without plus sign in exponent.
+const char* b = buf;
+if (b[0] == '-')
+++b;
+if (((pCharParseEnd - b == 21) || (pCharParseEnd - b == 20))
+&& !strncmp( b, "1.79769313486232", 16)
+&& (b[16] == 'e' || b[16] == 'E')
+&& (((pCharParseEnd - b == 21) && !strncmp( b+17, 
"+308", 4))
+ || ((pCharParseEnd - b == 20) && !strncmp( b+17, 
"308", 3
+{
+fVal = (buf < b) ? -DBL_MAX : DBL_MAX;
+}
+else
+{
+eStatus = rtl_math_ConversionStatus_OutOfRange;
+}
+}
 p = bufmap[pCharParseEnd - buf];
 bSign = false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sal/rtl

2020-12-03 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 73d98236ea83296018e6da30d0d7ec0219313776
Author: Eike Rathke 
AuthorDate: Thu Dec 3 18:18:23 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Dec 4 00:52:54 2020 +0100

Better accuracy in rtl_math_approxValue(), tdf#138360 related

Similar to commit 5abb1890ffafe5a2212076208a1c6e226f1ffa4e for
rtl_math_round() use the reciprocal value in an inverse operation
for negative exponents to not use the inexact 1e-1
0.10001 and so on factors.

Change-Id: I05b852e06f2c31d6e0ce622b07277a81a5690833
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107172
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 520949f17a91c531ea0c8b3856ffcf3c7ac8a3b2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107195

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index a296927635bf..46a3e925b95b 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1299,16 +1299,24 @@ double SAL_CALL rtl_math_approxValue( double fValue ) 
SAL_THROW_EXTERN_C()
 
 int nExp = static_cast< int >(floor(log10(fValue)));
 nExp = 14 - nExp;
-double fExpValue = getN10Exp(nExp);
+double fExpValue = getN10Exp(abs(nExp));
+
+if (nExp < 0)
+fValue /= fExpValue;
+else
+fValue *= fExpValue;
 
-fValue *= fExpValue;
 // If the original value was near DBL_MIN we got an overflow. Restore and
 // bail out.
 if (!std::isfinite(fValue))
 return fOrigValue;
 
 fValue = std::round(fValue);
-fValue /= fExpValue;
+
+if (nExp < 0)
+fValue *= fExpValue;
+else
+fValue /= fExpValue;
 
 // If the original value was near DBL_MAX we got an overflow. Restore and
 // bail out.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/rtl

2020-12-03 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 520949f17a91c531ea0c8b3856ffcf3c7ac8a3b2
Author: Eike Rathke 
AuthorDate: Thu Dec 3 18:18:23 2020 +0100
Commit: Eike Rathke 
CommitDate: Thu Dec 3 19:58:43 2020 +0100

Better accuracy in rtl_math_approxValue(), tdf#138360 related

Similar to commit 5abb1890ffafe5a2212076208a1c6e226f1ffa4e for
rtl_math_round() use the reciprocal value in an inverse operation
for negative exponents to not use the inexact 1e-1
0.10001 and so on factors.

Change-Id: I05b852e06f2c31d6e0ce622b07277a81a5690833
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107172
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index a296927635bf..46a3e925b95b 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1299,16 +1299,24 @@ double SAL_CALL rtl_math_approxValue( double fValue ) 
SAL_THROW_EXTERN_C()
 
 int nExp = static_cast< int >(floor(log10(fValue)));
 nExp = 14 - nExp;
-double fExpValue = getN10Exp(nExp);
+double fExpValue = getN10Exp(abs(nExp));
+
+if (nExp < 0)
+fValue /= fExpValue;
+else
+fValue *= fExpValue;
 
-fValue *= fExpValue;
 // If the original value was near DBL_MIN we got an overflow. Restore and
 // bail out.
 if (!std::isfinite(fValue))
 return fOrigValue;
 
 fValue = std::round(fValue);
-fValue /= fExpValue;
+
+if (nExp < 0)
+fValue *= fExpValue;
+else
+fValue /= fExpValue;
 
 // If the original value was near DBL_MAX we got an overflow. Restore and
 // bail out.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: how does arithmetic exactly work in Calc?

2020-12-03 Thread Eike Rathke
Hi Michel,

On Thursday, 2020-12-03 13:48:25 +0100, Michel Onoff wrote:

> I would like to understand how simple arithmetic (+ - * /) works in Calc.
> I kind of guess that the underlying internal number representation is
> IEEE 754 double (64 bit).

Yes.

> I also guess that when a double is shown on the sheet it is approximated
> by a decimal with at most 15 significand digits.

Yes.

> To reproduce the behavior below, use scientific notation with 20 digits
> or more.

Note that with increasing digits beyond 15 significands you currently
will not gain anything except additional zeros.

> I have two slightly different number x and x'.
> x is 2^-49 (a formula) while x' is 1.77635683940025E-15 (a literal).
> Their decimal representation appear equal on the sheet, but they are,
> indeed, slightly different internally. You can set them apart as follows:
> 
> y = x - 1.7763568394002E-15
> y' = x' - 1.7763568394002E-15
> 
> that is, by subtracting the same number from x and x'.
> y and y' appear differently on the sheet, meaning that x and x' are
> different internally to start with.

Yes.

> However, x - x' is exactly 0. In IEEE 754 arithmetic, two numbers are
> equal if and only if their difference is 0. That would mean that x and
> x' are equal, which they are not from the above.

The Calc + and - operators try to cater for numeric inaccuracies and tie
to zero in some ranges, otherwise the famous example of 0.3 - 0.2 - 0.1
would not be 0.0 but -2.77555756156289E-17 instead.

If you want the "raw" subtraction of your two values you can check with
=RAWSUBTRACT(2^-49;1.77635683940025E-015)
that yields 3.94430452610506E-31

The double to string conversion needs further improvement to be able to
more precisely represent values in decimals so could actually convert
2^-49 to 1.7763568394002505E-15

  Eike

-- 
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sal/rtl sc/qa

2020-12-02 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx  |   24 
++
 sc/qa/unit/data/functions/addin/fods/convert.fods |6 +-
 sc/qa/unit/data/functions/financial/fods/nper.fods|2 
 sc/qa/unit/data/functions/fods/gammaln.precise.fods   |4 -
 sc/qa/unit/data/functions/mathematical/fods/convert_add.fods  |6 +-
 sc/qa/unit/data/functions/statistical/fods/chisq.inv.fods |   12 ++---
 sc/qa/unit/data/functions/statistical/fods/forecast.ets.mult.fods |   14 ++---
 sc/qa/unit/data/functions/statistical/fods/gammaln.fods   |4 -
 sc/qa/unit/data/functions/statistical/fods/gammaln.precise.fods   |4 -
 sc/qa/unit/data/functions/statistical/fods/geomean.fods   |2 
 sc/qa/unit/data/functions/statistical/fods/harmean.fods   |6 +-
 sc/qa/unit/data/functions/statistical/fods/lognorm.inv.fods   |4 -
 sc/qa/unit/data/functions/statistical/fods/stdev.fods |4 -
 sc/qa/unit/data/functions/statistical/fods/stdev.p.fods   |6 +-
 sc/qa/unit/data/functions/statistical/fods/stdev.s.fods   |4 -
 sc/qa/unit/data/functions/statistical/fods/stdeva.fods|4 -
 sc/qa/unit/data/functions/statistical/fods/stdevp.fods|6 +-
 17 files changed, 49 insertions(+), 63 deletions(-)

New commits:
commit 84473267c5b77d12e3fa80a116995d645cc768c3
Author: Eike Rathke 
AuthorDate: Wed Dec 2 22:21:12 2020 +0100
Commit: Eike Rathke 
CommitDate: Thu Dec 3 02:19:33 2020 +0100

Related: tdf#138360 Use approxFloor() in rtl_math_round()

Ditch mostly but not always working correction value and use
approxFloor() instead which yields better results. With this we
now have one single place approxValue() in case more fine grained
tuning is needed.

Unfortunately all numeric spreadsheet function tests use ROUND()
in a manner such that they mostly blindly do a ROUND(...;12)
regardless of magnitude, sometimes effectively rounding to the
14th significant digit that may fail in cases like for

14.2040730851385
  ^
where the constant (rounded) value is stored as is but the
calculated value is
14.204073085138471
and the old round() yielded
14.204073085139 for both but the new round() more correctly
results in
14.204073085139 and
14.204073085138
so the spreadsheet test case sources had to be changed to
ROUND(...;11) in such places.

Change-Id: I211bb868a4f4dc9e68f4c7dcc2a187b5e175416f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107135
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit deb119e415213716a76b9b489a700949c031c6fe)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107101

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index e6f09f18030e..a296927635bf 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1133,6 +1133,9 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 {
 OSL_ASSERT(nDecPlaces >= -20 && nDecPlaces <= 20);
 
+if (!std::isfinite(fValue))
+return fValue;
+
 if (fValue == 0.0)
 return fValue;
 
@@ -1190,24 +1193,7 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 switch ( eMode )
 {
 case rtl_math_RoundingMode_Corrected :
-{
-int nExp;   // exponent for correction
-if ( fValue > 0.0 )
-nExp = static_cast( floor( log10( fValue ) ) );
-else
-nExp = 0;
-
-int nIndex;
-
-if (nExp < 0)
-nIndex = 15;
-else if (nExp >= 14)
-nIndex = 0;
-else
-nIndex = 15 - nExp;
-
-fValue = floor(fValue + 0.5 + nCorrVal[nIndex]);
-}
+fValue = rtl::math::approxFloor(fValue + 0.5);
 break;
 case rtl_math_RoundingMode_Down:
 fValue = rtl::math::approxFloor(fValue);
@@ -1321,7 +1307,7 @@ double SAL_CALL rtl_math_approxValue( double fValue ) 
SAL_THROW_EXTERN_C()
 if (!std::isfinite(fValue))
 return fOrigValue;
 
-fValue = rtl_math_round(fValue, 0, rtl_math_RoundingMode_Corrected);
+fValue = std::round(fValue);
 fValue /= fExpValue;
 
 // If the original value was near DBL_MAX we got an overflow. Restore and
diff --git a/sc/qa/unit/data/functions/addin/fods/convert.fods 
b/sc/qa/unit/data/functions/addin/fods/convert.fods
index 12ba09dcd326..64eb2db5ff82 100644
--- a/sc/qa/unit/data/functions/addin/fods/convert.fods
+++ b/sc/qa/unit/data/functions/addin/fods/convert.fods
@@ -3409,7 +3409,7 @@
  
   14.2857127610345
  
- 
+ 
   TRUE
  
  
@@ -4425,7 +4425,7 @@
  
   11.1445349270435
  
- 
+ 
   TRUE
  
  
@@ -5867,4 +5867,4 @@

   
  
-
\ No newline at end of file
+
diff 

[Libreoffice-commits] core.git: sal/rtl sc/qa

2020-12-02 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx  |   24 
++
 sc/qa/unit/data/functions/addin/fods/convert.fods |6 +-
 sc/qa/unit/data/functions/financial/fods/nper.fods|2 
 sc/qa/unit/data/functions/fods/gammaln.precise.fods   |4 -
 sc/qa/unit/data/functions/mathematical/fods/convert_add.fods  |6 +-
 sc/qa/unit/data/functions/statistical/fods/chisq.inv.fods |   12 ++---
 sc/qa/unit/data/functions/statistical/fods/forecast.ets.mult.fods |   14 ++---
 sc/qa/unit/data/functions/statistical/fods/gammaln.fods   |4 -
 sc/qa/unit/data/functions/statistical/fods/gammaln.precise.fods   |4 -
 sc/qa/unit/data/functions/statistical/fods/geomean.fods   |2 
 sc/qa/unit/data/functions/statistical/fods/harmean.fods   |6 +-
 sc/qa/unit/data/functions/statistical/fods/lognorm.inv.fods   |4 -
 sc/qa/unit/data/functions/statistical/fods/stdev.fods |4 -
 sc/qa/unit/data/functions/statistical/fods/stdev.p.fods   |6 +-
 sc/qa/unit/data/functions/statistical/fods/stdev.s.fods   |4 -
 sc/qa/unit/data/functions/statistical/fods/stdeva.fods|4 -
 sc/qa/unit/data/functions/statistical/fods/stdevp.fods|6 +-
 17 files changed, 49 insertions(+), 63 deletions(-)

New commits:
commit deb119e415213716a76b9b489a700949c031c6fe
Author: Eike Rathke 
AuthorDate: Wed Dec 2 22:21:12 2020 +0100
Commit: Eike Rathke 
CommitDate: Thu Dec 3 01:28:18 2020 +0100

Related: tdf#138360 Use approxFloor() in rtl_math_round()

Ditch mostly but not always working correction value and use
approxFloor() instead which yields better results. With this we
now have one single place approxValue() in case more fine grained
tuning is needed.

Unfortunately all numeric spreadsheet function tests use ROUND()
in a manner such that they mostly blindly do a ROUND(...;12)
regardless of magnitude, sometimes effectively rounding to the
14th significant digit that may fail in cases like for

14.2040730851385
  ^
where the constant (rounded) value is stored as is but the
calculated value is
14.204073085138471
and the old round() yielded
14.204073085139 for both but the new round() more correctly
results in
14.204073085139 and
14.204073085138
so the spreadsheet test case sources had to be changed to
ROUND(...;11) in such places.

Change-Id: I211bb868a4f4dc9e68f4c7dcc2a187b5e175416f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107135
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index e6f09f18030e..a296927635bf 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1133,6 +1133,9 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 {
 OSL_ASSERT(nDecPlaces >= -20 && nDecPlaces <= 20);
 
+if (!std::isfinite(fValue))
+return fValue;
+
 if (fValue == 0.0)
 return fValue;
 
@@ -1190,24 +1193,7 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 switch ( eMode )
 {
 case rtl_math_RoundingMode_Corrected :
-{
-int nExp;   // exponent for correction
-if ( fValue > 0.0 )
-nExp = static_cast( floor( log10( fValue ) ) );
-else
-nExp = 0;
-
-int nIndex;
-
-if (nExp < 0)
-nIndex = 15;
-else if (nExp >= 14)
-nIndex = 0;
-else
-nIndex = 15 - nExp;
-
-fValue = floor(fValue + 0.5 + nCorrVal[nIndex]);
-}
+fValue = rtl::math::approxFloor(fValue + 0.5);
 break;
 case rtl_math_RoundingMode_Down:
 fValue = rtl::math::approxFloor(fValue);
@@ -1321,7 +1307,7 @@ double SAL_CALL rtl_math_approxValue( double fValue ) 
SAL_THROW_EXTERN_C()
 if (!std::isfinite(fValue))
 return fOrigValue;
 
-fValue = rtl_math_round(fValue, 0, rtl_math_RoundingMode_Corrected);
+fValue = std::round(fValue);
 fValue /= fExpValue;
 
 // If the original value was near DBL_MAX we got an overflow. Restore and
diff --git a/sc/qa/unit/data/functions/addin/fods/convert.fods 
b/sc/qa/unit/data/functions/addin/fods/convert.fods
index 12ba09dcd326..64eb2db5ff82 100644
--- a/sc/qa/unit/data/functions/addin/fods/convert.fods
+++ b/sc/qa/unit/data/functions/addin/fods/convert.fods
@@ -3409,7 +3409,7 @@
  
   14.2857127610345
  
- 
+ 
   TRUE
  
  
@@ -4425,7 +4425,7 @@
  
   11.1445349270435
  
- 
+ 
   TRUE
  
  
@@ -5867,4 +5867,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/financial/fods/nper.fods 
b/sc/qa/unit/data/functions/financial/fods/nper.fods
index 2eac9b8f339f..83dc4

[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sal/rtl

2020-12-02 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit db72eef56a99392af2579bb9a4026519e843c3bf
Author: Eike Rathke 
AuthorDate: Tue Dec 1 23:22:33 2020 +0100
Commit: Eike Rathke 
CommitDate: Wed Dec 2 17:55:25 2020 +0100

Typo in rounded digit string, tdf#138360 follow-up

Change-Id: Ic436d3e9f0c93cb36c5e4377519f2aeb6b7fbd5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107034
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit d8e0b1c81ffa16be8aae2231bcd3c02e8c01cf88)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107025

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 10417742b3a2..e6f09f18030e 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -290,7 +290,7 @@ void doubleToString(typename T::String ** pResult,
 // Writing pDig up to decimals(-1,-2) then appending one digit from
 // pRou xor one or two digits from pSlot[].
 constexpr char pDig[] = "7976931348623157";
-constexpr char pRou[] = "8087931459623267"; // the only up-carry 
is 80
+constexpr char pRou[] = "8087931359623267"; // the only up-carry 
is 80
 static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit 
count mismatch");
 constexpr sal_Int32 nDig2 = RTL_CONSTASCII_LENGTH(pRou) - 2;
 sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/rtl

2020-12-02 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d8e0b1c81ffa16be8aae2231bcd3c02e8c01cf88
Author: Eike Rathke 
AuthorDate: Tue Dec 1 23:22:33 2020 +0100
Commit: Eike Rathke 
CommitDate: Wed Dec 2 11:37:11 2020 +0100

Typo in rounded digit string, tdf#138360 follow-up

Change-Id: Ic436d3e9f0c93cb36c5e4377519f2aeb6b7fbd5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107034
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 10417742b3a2..e6f09f18030e 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -290,7 +290,7 @@ void doubleToString(typename T::String ** pResult,
 // Writing pDig up to decimals(-1,-2) then appending one digit from
 // pRou xor one or two digits from pSlot[].
 constexpr char pDig[] = "7976931348623157";
-constexpr char pRou[] = "8087931459623267"; // the only up-carry 
is 80
+constexpr char pRou[] = "8087931359623267"; // the only up-carry 
is 80
 static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit 
count mismatch");
 constexpr sal_Int32 nDig2 = RTL_CONSTASCII_LENGTH(pRou) - 2;
 sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sal/rtl

2020-12-02 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 1ad0ec4f10270eb44b558e6e8c6261d793fddb2f
Author: Eike Rathke 
AuthorDate: Tue Dec 1 19:08:26 2020 +0100
Commit: Eike Rathke 
CommitDate: Wed Dec 2 11:36:33 2020 +0100

Related: tdf#138360 Rounding integers to decimals is futile

Change-Id: Ica25747a26d6c2637c46808d1b73aeeed6e1df37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107001
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 49aff144c72a5258cf2ca392a0cfb7a31fb86819)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107017

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 1d6cb88327f9..10417742b3a2 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1146,7 +1146,10 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 
 // Rounding to decimals between integer distance precision (gaps) does not
 // make sense, do not even try to multiply/divide and introduce inaccuracy.
-if (nDecPlaces >= 0 && fValue >= (static_cast(1) << 52))
+// For same reasons, do not attempt to round integers to decimals.
+if (nDecPlaces >= 0
+&& (fValue >= (static_cast(1) << 52)
+|| isRepresentableInteger(fValue)))
 return bSign ? -fValue : fValue;
 
 double fFac = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/rtl

2020-12-01 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 49aff144c72a5258cf2ca392a0cfb7a31fb86819
Author: Eike Rathke 
AuthorDate: Tue Dec 1 19:08:26 2020 +0100
Commit: Eike Rathke 
CommitDate: Wed Dec 2 00:27:30 2020 +0100

Related: tdf#138360 Rounding integers to decimals is futile

Change-Id: Ica25747a26d6c2637c46808d1b73aeeed6e1df37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107001
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 1d6cb88327f9..10417742b3a2 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1146,7 +1146,10 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 
 // Rounding to decimals between integer distance precision (gaps) does not
 // make sense, do not even try to multiply/divide and introduce inaccuracy.
-if (nDecPlaces >= 0 && fValue >= (static_cast(1) << 52))
+// For same reasons, do not attempt to round integers to decimals.
+if (nDecPlaces >= 0
+&& (fValue >= (static_cast(1) << 52)
+|| isRepresentableInteger(fValue)))
 return bSign ? -fValue : fValue;
 
 double fFac = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sal/rtl

2020-11-28 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   39 ---
 1 file changed, 36 insertions(+), 3 deletions(-)

New commits:
commit 0c1736f2dff63f2ac4a08c2b0e4c0d9c20d693cb
Author: Eike Rathke 
AuthorDate: Sat Nov 28 21:40:01 2020 +0100
Commit: Eike Rathke 
CommitDate: Sun Nov 29 00:02:38 2020 +0100

Resolves: tdf#138360 better accuracy in rtl_math_round()

Decimal negative exponents (powers) are imprecise
1e-1   0.10001
1e-2   0.01
1e-3   0.001
1e-4   0.0001
1e-5   1.0001e-05
1e-6   9.9995e-07
1e-7   9.9995e-08
1e-8   1e-08
1e-9   1.0001e-09
1e-10  1e-10
1e-11  9.9994e-12
1e-12  9.9998e-13
1e-13  1e-13
1e-14  1e-14
1e-15  1.0001e-15
1e-16  9.9998e-17
1e-17  1.0001e-17
1e-18  1.0001e-18
1e-19  9.9998e-20
1e-20  9.9995e-21

so use the positive exponents instead and swap multiplication and
division when scaling and scaling back the value, which multiplies
the rounded value with a precise integer instead of dividing it by
an imprecise fraction.

For a large (absolute) value check if it is roundable to the
desired decimals at all with the binade's distance precision gap
and if not then diminish the decimals parameter. This prevents
possible inaccuracies due to overly scaling the value.

Change-Id: I41a113078031a552cf98d72f8cb2b10bdc88dea4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106830
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 5abb1890ffafe5a2212076208a1c6e226f1ffa4e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106814

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 6ed4906270e0..1d6cb88327f9 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1144,16 +1144,44 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 if (bSign)
 fValue = -fValue;
 
+// Rounding to decimals between integer distance precision (gaps) does not
+// make sense, do not even try to multiply/divide and introduce inaccuracy.
+if (nDecPlaces >= 0 && fValue >= (static_cast(1) << 52))
+return bSign ? -fValue : fValue;
+
 double fFac = 0;
 if (nDecPlaces != 0)
 {
+if (nDecPlaces > 1 && fValue > 4294967296.0)
+{
+// 4294967296 is 2^32 with room for at least 20 decimals, checking
+// smaller values is not necessary. Lower the limit if more than 20
+// decimals were to be allowed.
+
+// Determine how many decimals are representable in the precision.
+// Anything greater 2^52 and 0.0 was already ruled out above.
+// Theoretically 0.5, 0.25, 0.125, 0.0625, 0.03125, ...
+const double fDec = 52 - log2(fValue) + 1;
+if (fDec < nDecPlaces)
+nDecPlaces = static_cast(fDec);
+}
+
+/* TODO: this was without the inverse factor and determining max
+ * possible decimals, it could now be adjusted to be more lenient. */
 // max 20 decimals, we don't have unlimited precision
 // #38810# and no overflow on fValue*=fFac
 if (nDecPlaces < -20 || 20 < nDecPlaces || fValue > (DBL_MAX / 1e20))
 return bSign ? -fValue : fValue;
 
-fFac = getN10Exp(nDecPlaces);
-fValue *= fFac;
+// Avoid 1e-5 (1.0001e-05) and such inaccurate fractional
+// factors that later when dividing back spoil things. For negative
+// decimals divide first with the inverse, then multiply the rounded
+// value back.
+fFac = getN10Exp(abs(nDecPlaces));
+if (nDecPlaces < 0)
+fValue /= fFac;
+else
+fValue *= fFac;
 }
 
 switch ( eMode )
@@ -1245,7 +1273,12 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 }
 
 if (nDecPlaces != 0)
-fValue /= fFac;
+{
+if (nDecPlaces < 0)
+fValue *= fFac;
+else
+fValue /= fFac;
+}
 
 return bSign ? -fValue : fValue;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/rtl

2020-11-28 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   39 ---
 1 file changed, 36 insertions(+), 3 deletions(-)

New commits:
commit 5abb1890ffafe5a2212076208a1c6e226f1ffa4e
Author: Eike Rathke 
AuthorDate: Sat Nov 28 21:40:01 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Nov 28 23:09:02 2020 +0100

Resolves: tdf#138360 better accuracy in rtl_math_round()

Decimal negative exponents (powers) are imprecise
1e-1   0.10001
1e-2   0.01
1e-3   0.001
1e-4   0.0001
1e-5   1.0001e-05
1e-6   9.9995e-07
1e-7   9.9995e-08
1e-8   1e-08
1e-9   1.0001e-09
1e-10  1e-10
1e-11  9.9994e-12
1e-12  9.9998e-13
1e-13  1e-13
1e-14  1e-14
1e-15  1.0001e-15
1e-16  9.9998e-17
1e-17  1.0001e-17
1e-18  1.0001e-18
1e-19  9.9998e-20
1e-20  9.9995e-21

so use the positive exponents instead and swap multiplication and
division when scaling and scaling back the value, which multiplies
the rounded value with a precise integer instead of dividing it by
an imprecise fraction.

For a large (absolute) value check if it is roundable to the
desired decimals at all with the binade's distance precision gap
and if not then diminish the decimals parameter. This prevents
possible inaccuracies due to overly scaling the value.

Change-Id: I41a113078031a552cf98d72f8cb2b10bdc88dea4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106830
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 6ed4906270e0..1d6cb88327f9 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1144,16 +1144,44 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 if (bSign)
 fValue = -fValue;
 
+// Rounding to decimals between integer distance precision (gaps) does not
+// make sense, do not even try to multiply/divide and introduce inaccuracy.
+if (nDecPlaces >= 0 && fValue >= (static_cast(1) << 52))
+return bSign ? -fValue : fValue;
+
 double fFac = 0;
 if (nDecPlaces != 0)
 {
+if (nDecPlaces > 1 && fValue > 4294967296.0)
+{
+// 4294967296 is 2^32 with room for at least 20 decimals, checking
+// smaller values is not necessary. Lower the limit if more than 20
+// decimals were to be allowed.
+
+// Determine how many decimals are representable in the precision.
+// Anything greater 2^52 and 0.0 was already ruled out above.
+// Theoretically 0.5, 0.25, 0.125, 0.0625, 0.03125, ...
+const double fDec = 52 - log2(fValue) + 1;
+if (fDec < nDecPlaces)
+nDecPlaces = static_cast(fDec);
+}
+
+/* TODO: this was without the inverse factor and determining max
+ * possible decimals, it could now be adjusted to be more lenient. */
 // max 20 decimals, we don't have unlimited precision
 // #38810# and no overflow on fValue*=fFac
 if (nDecPlaces < -20 || 20 < nDecPlaces || fValue > (DBL_MAX / 1e20))
 return bSign ? -fValue : fValue;
 
-fFac = getN10Exp(nDecPlaces);
-fValue *= fFac;
+// Avoid 1e-5 (1.0001e-05) and such inaccurate fractional
+// factors that later when dividing back spoil things. For negative
+// decimals divide first with the inverse, then multiply the rounded
+// value back.
+fFac = getN10Exp(abs(nDecPlaces));
+if (nDecPlaces < 0)
+fValue /= fFac;
+else
+fValue *= fFac;
 }
 
 switch ( eMode )
@@ -1245,7 +1273,12 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 }
 
 if (nDecPlaces != 0)
-fValue /= fFac;
+{
+if (nDecPlaces < 0)
+fValue *= fFac;
+else
+fValue /= fFac;
+}
 
 return bSign ? -fValue : fValue;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sal/rtl

2020-11-28 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8ee421198ed2ffdabcde76778a3b10bd19a27766
Author: Eike Rathke 
AuthorDate: Fri Nov 27 17:29:05 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Nov 28 12:50:56 2020 +0100

Consistently use RTL_CONSTASCII_LENGTH(), tdf#136272 follow-up

 This is a combination of 2 commits.

Consistently use RTL_CONSTASCII_LENGTH(), tdf#136272 follow-up

The mix with SAL_N_ELEMENTS() was confusing and even wrong in one
case.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106764
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 1a0f9a9c56e7b7952b813b3efd34f9be6c853957)

Fix comment

I2ae6e3cadc0f182c4798e5d33b0c7f07fbcbbff6
(cherry picked from commit b8404ae521a9c2d183d4e076a7884627ba353e4b)

Change-Id: Ife73342b0efc01ed4e76e217d372fc32500c9b2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106782
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 7d46c754b433..6ed4906270e0 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -292,7 +292,7 @@ void doubleToString(typename T::String ** pResult,
 constexpr char pDig[] = "7976931348623157";
 constexpr char pRou[] = "8087931459623267"; // the only up-carry 
is 80
 static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit 
count mismatch");
-constexpr sal_Int32 nDig2 = SAL_N_ELEMENTS(pRou) - 2;
+constexpr sal_Int32 nDig2 = RTL_CONSTASCII_LENGTH(pRou) - 2;
 sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
 const char pSlot[5][2][3] =
 { // rounded, not
@@ -314,7 +314,7 @@ void doubleToString(typename T::String ** pResult,
 T::appendAscii(pResult, pResultCapacity, ,
RTL_CONSTASCII_STRINGPARAM("-"));
 
-nDecPlaces = std::clamp( nDecPlaces, 0, 
SAL_N_ELEMENTS(pRou));
+nDecPlaces = std::clamp( nDecPlaces, 0, 
RTL_CONSTASCII_LENGTH(pRou));
 if (nDecPlaces == 0)
 {
 T::appendAscii(pResult, pResultCapacity, ,
@@ -338,11 +338,11 @@ void doubleToString(typename T::String ** pResult,
 {
 const sal_Int32 nDec = nDecPlaces - nDig2;
 nDecPlaces -= nDec;
-// nDec-1 is also offset into slot, rounded(-1=0) or not(-2=1)
+// nDec-1 is also offset into slot, rounded(1-1=0) or 
not(2-1=1)
 const size_t nSlot = ((fValue < fB3) ? 4 : ((fValue < fB2) ? 3
 : ((fValue < fB1) ? 2 : ((fValue < DBL_MAX) ? 1 : 
0;
 
-T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces - 1);
+T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces);
 T::appendAscii(pResult, pResultCapacity, , 
pSlot[nSlot][nDec-1], nDec);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/qa

2020-11-28 Thread Eike Rathke (via logerrit)
 sal/qa/rtl/math/test-rtl-math.cxx |   88 ++
 1 file changed, 88 insertions(+)

New commits:
commit 87191b03e79e909a8ace3bcac35cfeea7f0d34ea
Author: Eike Rathke 
AuthorDate: Fri Nov 27 17:55:37 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Nov 28 12:26:24 2020 +0100

Unit tests for DBL_MAX to string conversion, tdf#136272

Change-Id: Ied41d1e21fb6e40b54adac3c33fa0d096e25bada
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106783
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/qa/rtl/math/test-rtl-math.cxx 
b/sal/qa/rtl/math/test-rtl-math.cxx
index 4843d66c2aec..799787e9d4a9 100644
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -185,6 +185,37 @@ public:
 CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_OutOfRange, status);
 CPPUNIT_ASSERT_EQUAL(sal_Int32(12), end);
 CPPUNIT_ASSERT_EQUAL(std::numeric_limits::infinity(), res);
+
+// DBL_MAX and 4 nextafters
+double fValAfter = DBL_MAX;
+res = rtl::math::stringToDouble(OUString("1.7976931348623157e+308"), 
'.', ',', , );
+CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(23), end);
+CPPUNIT_ASSERT_EQUAL(fValAfter, res);
+
+fValAfter = std::nextafter( fValAfter, 0);
+res = rtl::math::stringToDouble(OUString("1.7976931348623155e+308"), 
'.', ',', , );
+CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(23), end);
+CPPUNIT_ASSERT_EQUAL(fValAfter, res);
+
+fValAfter = std::nextafter( fValAfter, 0);
+res = rtl::math::stringToDouble(OUString("1.7976931348623153e+308"), 
'.', ',', , );
+CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(23), end);
+CPPUNIT_ASSERT_EQUAL(fValAfter, res);
+
+fValAfter = std::nextafter( fValAfter, 0);
+res = rtl::math::stringToDouble(OUString("1.7976931348623151e+308"), 
'.', ',', , );
+CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(23), end);
+CPPUNIT_ASSERT_EQUAL(fValAfter, res);
+
+fValAfter = std::nextafter( fValAfter, 0);
+res = rtl::math::stringToDouble(OUString("1.7976931348623149e+308"), 
'.', ',', , );
+CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(23), end);
+CPPUNIT_ASSERT_EQUAL(fValAfter, res);
 }
 
 void test_stringToDouble_bad() {
@@ -329,6 +360,63 @@ public:
 fVal = 12345.6789;
 aRes = rtl::math::doubleToUString( fVal, rtl_math_StringFormat_G, -3, 
'.', true);
 CPPUNIT_ASSERT_EQUAL( OUString("1.2E+004"), aRes);
+
+// DBL_MAX and 4 nextafters
+fVal = DBL_MAX;
+aRes = rtl::math::doubleToUString( fVal, 
rtl_math_StringFormat_Automatic,
+rtl_math_DecimalPlaces_Max, '.', true);
+CPPUNIT_ASSERT_EQUAL( OUString("1.7976931348623157E+308"), aRes);
+
+fVal = std::nextafter( fVal, 0);
+aRes = rtl::math::doubleToUString( fVal, 
rtl_math_StringFormat_Automatic,
+rtl_math_DecimalPlaces_Max, '.', true);
+CPPUNIT_ASSERT_EQUAL( OUString("1.7976931348623155E+308"), aRes);
+
+fVal = std::nextafter( fVal, 0);
+aRes = rtl::math::doubleToUString( fVal, 
rtl_math_StringFormat_Automatic,
+rtl_math_DecimalPlaces_Max, '.', true);
+CPPUNIT_ASSERT_EQUAL( OUString("1.7976931348623153E+308"), aRes);
+
+fVal = std::nextafter( fVal, 0);
+aRes = rtl::math::doubleToUString( fVal, 
rtl_math_StringFormat_Automatic,
+rtl_math_DecimalPlaces_Max, '.', true);
+CPPUNIT_ASSERT_EQUAL( OUString("1.7976931348623151E+308"), aRes);
+
+fVal = std::nextafter( fVal, 0);
+aRes = rtl::math::doubleToUString( fVal, 
rtl_math_StringFormat_Automatic,
+rtl_math_DecimalPlaces_Max, '.', true);
+CPPUNIT_ASSERT_EQUAL( OUString("1.7976931348623149E+308"), aRes);
+
+// DBL_MAX and 4 nextafters rounded to 15 decimals
+fVal = DBL_MAX;
+aRes = rtl::math::doubleToUString( fVal, 
rtl_math_StringFormat_Automatic, 15, '.', true);
+CPPUNIT_ASSERT_EQUAL( OUString("1.797693134862316E+308"), aRes);
+
+fVal = std::nextafter( fVal, 0);
+aRes = rtl::math::doubleToUString( fVal, 
rtl_math_StringFormat_Automatic, 15, '.', true);
+CPPUNIT_ASSERT_EQUAL( OUString("1.797693134862316E+308"), aRes);
+
+fVal = std::nextafter( fVal, 0);
+aRes = rtl::math::doubleToUString( fVal, 
rtl_math_StringFormat_Automatic, 15, '.', true);
+CPPUNIT_ASSERT_EQUAL( OUString("1.797693134862315E+308"), aRes);
+

[Libreoffice-commits] core.git: sal/rtl

2020-11-27 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 1a0f9a9c56e7b7952b813b3efd34f9be6c853957
Author: Eike Rathke 
AuthorDate: Fri Nov 27 13:26:26 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Nov 27 17:24:35 2020 +0100

Consistently use RTL_CONSTASCII_LENGTH(), tdf#136272 follow-up

The mix with SAL_N_ELEMENTS() was confusing and even wrong in one
case.

Change-Id: Ife73342b0efc01ed4e76e217d372fc32500c9b2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106764
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 81fa0cf925b7..6ed4906270e0 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -292,7 +292,7 @@ void doubleToString(typename T::String ** pResult,
 constexpr char pDig[] = "7976931348623157";
 constexpr char pRou[] = "8087931459623267"; // the only up-carry 
is 80
 static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit 
count mismatch");
-constexpr sal_Int32 nDig2 = SAL_N_ELEMENTS(pRou) - 2;
+constexpr sal_Int32 nDig2 = RTL_CONSTASCII_LENGTH(pRou) - 2;
 sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
 const char pSlot[5][2][3] =
 { // rounded, not
@@ -314,7 +314,7 @@ void doubleToString(typename T::String ** pResult,
 T::appendAscii(pResult, pResultCapacity, ,
RTL_CONSTASCII_STRINGPARAM("-"));
 
-nDecPlaces = std::clamp( nDecPlaces, 0, 
SAL_N_ELEMENTS(pRou));
+nDecPlaces = std::clamp( nDecPlaces, 0, 
RTL_CONSTASCII_LENGTH(pRou));
 if (nDecPlaces == 0)
 {
 T::appendAscii(pResult, pResultCapacity, ,
@@ -342,7 +342,7 @@ void doubleToString(typename T::String ** pResult,
 const size_t nSlot = ((fValue < fB3) ? 4 : ((fValue < fB2) ? 3
 : ((fValue < fB1) ? 2 : ((fValue < DBL_MAX) ? 1 : 
0;
 
-T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces - 1);
+T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces);
 T::appendAscii(pResult, pResultCapacity, , 
pSlot[nSlot][nDec-1], nDec);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/rtl

2020-11-27 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b8404ae521a9c2d183d4e076a7884627ba353e4b
Author: Eike Rathke 
AuthorDate: Fri Nov 27 10:50:49 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Nov 27 10:51:29 2020 +0100

Fix comment

Change-Id: I2ae6e3cadc0f182c4798e5d33b0c7f07fbcbbff6

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 7d46c754b433..81fa0cf925b7 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -338,7 +338,7 @@ void doubleToString(typename T::String ** pResult,
 {
 const sal_Int32 nDec = nDecPlaces - nDig2;
 nDecPlaces -= nDec;
-// nDec-1 is also offset into slot, rounded(-1=0) or not(-2=1)
+// nDec-1 is also offset into slot, rounded(1-1=0) or 
not(2-1=1)
 const size_t nSlot = ((fValue < fB3) ? 4 : ((fValue < fB2) ? 3
 : ((fValue < fB1) ? 2 : ((fValue < DBL_MAX) ? 1 : 
0;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sal/rtl

2020-11-26 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   78 +++
 1 file changed, 78 insertions(+)

New commits:
commit 013807f152a2c869b863658cd2409344ffb72e39
Author: Eike Rathke 
AuthorDate: Fri Nov 27 01:42:05 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Nov 27 03:40:29 2020 +0100

Resolves: tdf#136272 convert DBL_MAX to 1.7976931348623157e+308

... and the 4 subsequent nextafters to appropriate strings.

An interim workaround to not write the out-of-range string
1.79769313486232e+308 until we have a proper rounding.

Change-Id: I5f98a7f0a8e0421fd024a8cc37cc6f3a198d02d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106717
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 4713c19e2b79341dc27e66d4c6449497db1e73d8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106685

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index c58c646bbc2e..7d46c754b433 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -274,6 +274,84 @@ void doubleToString(typename T::String ** pResult,
 return;
 }
 
+// Unfortunately the old rounding below writes 1.79769313486232e+308 for
+// DBL_MAX and 4 subsequent nextafter(...,0).
+static const double fB1 = std::nextafter( DBL_MAX, 0);
+static const double fB2 = std::nextafter( fB1, 0);
+static const double fB3 = std::nextafter( fB2, 0);
+static const double fB4 = std::nextafter( fB3, 0);
+if ((fValue >= fB4) && eFormat != rtl_math_StringFormat_F)
+{
+// 1.7976931348623157e+308 instead of rounded 1.79769313486232e+308
+// that can't be converted back as out of range. For rounded values if
+// they exceed range they should not be written to exchange strings or
+// file formats.
+
+// Writing pDig up to decimals(-1,-2) then appending one digit from
+// pRou xor one or two digits from pSlot[].
+constexpr char pDig[] = "7976931348623157";
+constexpr char pRou[] = "8087931459623267"; // the only up-carry 
is 80
+static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit 
count mismatch");
+constexpr sal_Int32 nDig2 = SAL_N_ELEMENTS(pRou) - 2;
+sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
+const char pSlot[5][2][3] =
+{ // rounded, not
+"67", "57", // DBL_MAX
+"65", "55",
+"53", "53",
+"51", "51",
+"59", "49",
+};
+
+if (!pResultCapacity)
+{
+pResultCapacity = 
+T::createBuffer(pResult, pResultCapacity);
+nResultOffset = 0;
+}
+
+if (bSign)
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("-"));
+
+nDecPlaces = std::clamp( nDecPlaces, 0, 
SAL_N_ELEMENTS(pRou));
+if (nDecPlaces == 0)
+{
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("2"));
+}
+else
+{
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("1"));
+T::appendChars(pResult, pResultCapacity, , 
, 1);
+if (nDecPlaces <= 2)
+{
+T::appendAscii(pResult, pResultCapacity, , pRou, 
nDecPlaces);
+}
+else if (nDecPlaces <= nDig2)
+{
+T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces - 1);
+T::appendAscii(pResult, pResultCapacity, , pRou 
+ nDecPlaces - 1, 1);
+}
+else
+{
+const sal_Int32 nDec = nDecPlaces - nDig2;
+nDecPlaces -= nDec;
+// nDec-1 is also offset into slot, rounded(-1=0) or not(-2=1)
+const size_t nSlot = ((fValue < fB3) ? 4 : ((fValue < fB2) ? 3
+: ((fValue < fB1) ? 2 : ((fValue < DBL_MAX) ? 1 : 
0;
+
+T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces - 1);
+T::appendAscii(pResult, pResultCapacity, , 
pSlot[nSlot][nDec-1], nDec);
+}
+}
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("E+308"));
+
+return;
+}
+
 // Use integer representation for integer values that fit into the
 // mantissa (1.((2^53)-1)) with a precision of 1 for highest accuracy.
 const sal_Int64 kMaxInt = (static_cast< sal_Int64 >(1) << 53) - 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/rtl

2020-11-26 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   78 +++
 1 file changed, 78 insertions(+)

New commits:
commit 4713c19e2b79341dc27e66d4c6449497db1e73d8
Author: Eike Rathke 
AuthorDate: Fri Nov 27 01:42:05 2020 +0100
Commit: Eike Rathke 
CommitDate: Fri Nov 27 02:44:10 2020 +0100

Resolves: tdf#136272 convert DBL_MAX to 1.7976931348623157e+308

... and the 4 subsequent nextafters to appropriate strings.

An interim workaround to not write the out-of-range string
1.79769313486232e+308 until we have a proper rounding.

Change-Id: I5f98a7f0a8e0421fd024a8cc37cc6f3a198d02d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106717
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index c58c646bbc2e..7d46c754b433 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -274,6 +274,84 @@ void doubleToString(typename T::String ** pResult,
 return;
 }
 
+// Unfortunately the old rounding below writes 1.79769313486232e+308 for
+// DBL_MAX and 4 subsequent nextafter(...,0).
+static const double fB1 = std::nextafter( DBL_MAX, 0);
+static const double fB2 = std::nextafter( fB1, 0);
+static const double fB3 = std::nextafter( fB2, 0);
+static const double fB4 = std::nextafter( fB3, 0);
+if ((fValue >= fB4) && eFormat != rtl_math_StringFormat_F)
+{
+// 1.7976931348623157e+308 instead of rounded 1.79769313486232e+308
+// that can't be converted back as out of range. For rounded values if
+// they exceed range they should not be written to exchange strings or
+// file formats.
+
+// Writing pDig up to decimals(-1,-2) then appending one digit from
+// pRou xor one or two digits from pSlot[].
+constexpr char pDig[] = "7976931348623157";
+constexpr char pRou[] = "8087931459623267"; // the only up-carry 
is 80
+static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit 
count mismatch");
+constexpr sal_Int32 nDig2 = SAL_N_ELEMENTS(pRou) - 2;
+sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
+const char pSlot[5][2][3] =
+{ // rounded, not
+"67", "57", // DBL_MAX
+"65", "55",
+"53", "53",
+"51", "51",
+"59", "49",
+};
+
+if (!pResultCapacity)
+{
+pResultCapacity = 
+T::createBuffer(pResult, pResultCapacity);
+nResultOffset = 0;
+}
+
+if (bSign)
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("-"));
+
+nDecPlaces = std::clamp( nDecPlaces, 0, 
SAL_N_ELEMENTS(pRou));
+if (nDecPlaces == 0)
+{
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("2"));
+}
+else
+{
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("1"));
+T::appendChars(pResult, pResultCapacity, , 
, 1);
+if (nDecPlaces <= 2)
+{
+T::appendAscii(pResult, pResultCapacity, , pRou, 
nDecPlaces);
+}
+else if (nDecPlaces <= nDig2)
+{
+T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces - 1);
+T::appendAscii(pResult, pResultCapacity, , pRou 
+ nDecPlaces - 1, 1);
+}
+else
+{
+const sal_Int32 nDec = nDecPlaces - nDig2;
+nDecPlaces -= nDec;
+// nDec-1 is also offset into slot, rounded(-1=0) or not(-2=1)
+const size_t nSlot = ((fValue < fB3) ? 4 : ((fValue < fB2) ? 3
+: ((fValue < fB1) ? 2 : ((fValue < DBL_MAX) ? 1 : 
0;
+
+T::appendAscii(pResult, pResultCapacity, , pDig, 
nDecPlaces - 1);
+T::appendAscii(pResult, pResultCapacity, , 
pSlot[nSlot][nDec-1], nDec);
+}
+}
+T::appendAscii(pResult, pResultCapacity, ,
+   RTL_CONSTASCII_STRINGPARAM("E+308"));
+
+return;
+}
+
 // Use integer representation for integer values that fit into the
 // mantissa (1.((2^53)-1)) with a precision of 1 for highest accuracy.
 const sal_Int64 kMaxInt = (static_cast< sal_Int64 >(1) << 53) - 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sal/rtl

2020-11-26 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 28521056a22719dffa0814883d06a7c9531b02ad
Author: Eike Rathke 
AuthorDate: Wed Nov 25 13:54:31 2020 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 26 10:02:08 2020 +0100

Related: tdf#136272 accept 1.79769313486232e+308 as DBL_MAX

This does not solve writing the badly rounded value, which still
has to be fixed, but at least be able to read/convert it back as
double max value.

This is not even used in the bug scenario because the "fake"
condition in that number format is discarded anyway because it was
only written to satisfy ODF, but it helps in case a
1.7976931348623157e+308 value was entered/used on purpose.

Change-Id: I413dd93d5a3c4df609fd42a3133d6d82c34afff0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106586
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit ee2cc952eeb5385ee37485c822d7ad7abd8fb989)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106527
Reviewed-by: Michael Stahl 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index b01253c70dfa..9c32cff30f2f 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -976,7 +976,26 @@ double stringToDouble(CharT const * pBegin, CharT const * 
pEnd,
 errno = 0;
 fVal = strtod_nolocale(buf, );
 if (errno == ERANGE)
-eStatus = rtl_math_ConversionStatus_OutOfRange;
+{
+// Check for the dreaded rounded to 15 digits max value
+// 1.79769313486232e+308 for 1.7976931348623157e+308 we wrote
+// everywhere, accept with or without plus sign in exponent.
+const char* b = buf;
+if (b[0] == '-')
+++b;
+if (((pCharParseEnd - b == 21) || (pCharParseEnd - b == 20))
+&& !strncmp( b, "1.79769313486232", 16)
+&& (b[16] == 'e' || b[16] == 'E')
+&& (((pCharParseEnd - b == 21) && !strncmp( b+17, 
"+308", 4))
+ || ((pCharParseEnd - b == 20) && !strncmp( b+17, 
"308", 3
+{
+fVal = (buf < b) ? -DBL_MAX : DBL_MAX;
+}
+else
+{
+eStatus = rtl_math_ConversionStatus_OutOfRange;
+}
+}
 p = bufmap[pCharParseEnd - buf];
 bSign = false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sal/rtl

2020-11-25 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 711e69e333faaf0570ddf2cb1fc721bc59cc61bc
Author: Eike Rathke 
AuthorDate: Wed Nov 25 13:54:31 2020 +0100
Commit: Eike Rathke 
CommitDate: Wed Nov 25 17:45:39 2020 +0100

Related: tdf#136272 accept 1.79769313486232e+308 as DBL_MAX

This does not solve writing the badly rounded value, which still
has to be fixed, but at least be able to read/convert it back as
double max value.

This is not even used in the bug scenario because the "fake"
condition in that number format is discarded anyway because it was
only written to satisfy ODF, but it helps in case a
1.7976931348623157e+308 value was entered/used on purpose.

Change-Id: I413dd93d5a3c4df609fd42a3133d6d82c34afff0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106586
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit ee2cc952eeb5385ee37485c822d7ad7abd8fb989)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106526

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index af3e52f2bf9d..c58c646bbc2e 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -976,7 +976,26 @@ double stringToDouble(CharT const * pBegin, CharT const * 
pEnd,
 errno = 0;
 fVal = strtod_nolocale(buf, );
 if (errno == ERANGE)
-eStatus = rtl_math_ConversionStatus_OutOfRange;
+{
+// Check for the dreaded rounded to 15 digits max value
+// 1.79769313486232e+308 for 1.7976931348623157e+308 we wrote
+// everywhere, accept with or without plus sign in exponent.
+const char* b = buf;
+if (b[0] == '-')
+++b;
+if (((pCharParseEnd - b == 21) || (pCharParseEnd - b == 20))
+&& !strncmp( b, "1.79769313486232", 16)
+&& (b[16] == 'e' || b[16] == 'E')
+&& (((pCharParseEnd - b == 21) && !strncmp( b+17, 
"+308", 4))
+ || ((pCharParseEnd - b == 20) && !strncmp( b+17, 
"308", 3
+{
+fVal = (buf < b) ? -DBL_MAX : DBL_MAX;
+}
+else
+{
+eStatus = rtl_math_ConversionStatus_OutOfRange;
+}
+}
 p = bufmap[pCharParseEnd - buf];
 bSign = false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/rtl

2020-11-25 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |   21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit ee2cc952eeb5385ee37485c822d7ad7abd8fb989
Author: Eike Rathke 
AuthorDate: Wed Nov 25 13:54:31 2020 +0100
Commit: Eike Rathke 
CommitDate: Wed Nov 25 15:47:34 2020 +0100

Related: tdf#136272 accept 1.79769313486232e+308 as DBL_MAX

This does not solve writing the badly rounded value, which still
has to be fixed, but at least be able to read/convert it back as
double max value.

This is not even used in the bug scenario because the "fake"
condition in that number format is discarded anyway because it was
only written to satisfy ODF, but it helps in case a
1.7976931348623157e+308 value was entered/used on purpose.

Change-Id: I413dd93d5a3c4df609fd42a3133d6d82c34afff0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106586
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index af3e52f2bf9d..c58c646bbc2e 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -976,7 +976,26 @@ double stringToDouble(CharT const * pBegin, CharT const * 
pEnd,
 errno = 0;
 fVal = strtod_nolocale(buf, );
 if (errno == ERANGE)
-eStatus = rtl_math_ConversionStatus_OutOfRange;
+{
+// Check for the dreaded rounded to 15 digits max value
+// 1.79769313486232e+308 for 1.7976931348623157e+308 we wrote
+// everywhere, accept with or without plus sign in exponent.
+const char* b = buf;
+if (b[0] == '-')
+++b;
+if (((pCharParseEnd - b == 21) || (pCharParseEnd - b == 20))
+&& !strncmp( b, "1.79769313486232", 16)
+&& (b[16] == 'e' || b[16] == 'E')
+&& (((pCharParseEnd - b == 21) && !strncmp( b+17, 
"+308", 4))
+ || ((pCharParseEnd - b == 20) && !strncmp( b+17, 
"308", 3
+{
+fVal = (buf < b) ? -DBL_MAX : DBL_MAX;
+}
+else
+{
+eStatus = rtl_math_ConversionStatus_OutOfRange;
+}
+}
 p = bufmap[pCharParseEnd - buf];
 bSign = false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: configure.ac download.lst external/icu external/libcdr external/libebook

2020-11-17 Thread Eike Rathke (via logerrit)
 configure.ac  |2 -
 download.lst  |8 ++--
 external/icu/UnpackedTarball_icu.mk   |7 +--
 external/icu/icu4c-link-scrptrun.patch.2  |   43 --
 external/icu/icu4c-mkdir.patch.1  |   20 ++
 external/icu/icu4c-warnings.patch.1   |8 ++--
 external/icu/ubsan.patch.1|   27 +
 external/libcdr/UnpackedTarball_libcdr.mk |1 
 external/libcdr/libcdr-no-icu-boolean.patch.1 |   12 ++
 external/libebook/UnpackedTarball_libebook.mk |4 ++
 external/libebook/libebook-no-icu-boolean.patch.1 |   12 ++
 11 files changed, 57 insertions(+), 87 deletions(-)

New commits:
commit 8335c8c20765d4f167d9b48e6a2757864a3bc7fd
Author: Eike Rathke 
AuthorDate: Mon Nov 16 23:26:56 2020 +0100
Commit: Eike Rathke 
CommitDate: Tue Nov 17 16:33:33 2020 +0100

Update to ICU 68.1

Also made it necessary to adapt two places in libcdr and libebook
that used UBool TRUE which is gone now to use standard true
instead.

Change-Id: I1c1df3030f8b883bec6045756907ee0b78060382
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105964
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/configure.ac b/configure.ac
index 0b382e8f5bf2..8f104514ec19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10245,7 +10245,7 @@ SYSTEM_GENBRK=
 SYSTEM_GENCCODE=
 SYSTEM_GENCMN=
 
-ICU_MAJOR=67
+ICU_MAJOR=68
 ICU_MINOR=1
 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
diff --git a/download.lst b/download.lst
index 759dfc6650dc..1c932acc04f8 100644
--- a/download.lst
+++ b/download.lst
@@ -114,10 +114,10 @@ export HUNSPELL_SHA256SUM := 
57be4e03ae9dd62c3471f667a0d81a14513e314d4d92081292b
 export HUNSPELL_TARBALL := hunspell-1.7.0.tar.gz
 export HYPHEN_SHA256SUM := 
304636d4eccd81a14b6914d07b84c79ebb815288c76fe027b9ebff6ff24d5705
 export HYPHEN_TARBALL := 5ade6ae2a99bc1e9e57031ca88d36dad-hyphen-2.8.8.tar.gz
-export ICU_SHA256SUM := 
94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc
-export ICU_TARBALL := icu4c-67_1-src.tgz
-export ICU_DATA_SHA256SUM := 
7c16a59cc8c06128b7ecc1dc4fc056b36b17349312829b17408b9e67b05c4a7e
-export ICU_DATA_TARBALL := icu4c-67_1-data.zip
+export ICU_SHA256SUM := 
a9f2e3d8b4434b8e53878b4308bd1e6ee51c9c7042e2b1a376abefb6fbb29f2d
+export ICU_TARBALL := icu4c-68_1-src.tgz
+export ICU_DATA_SHA256SUM := 
03ea8b4694155620548c8c0ba20444f1e7db246cc79e3b9c4fc7a960b160d510
+export ICU_DATA_TARBALL := icu4c-68_1-data.zip
 export JFREEREPORT_FLOW_ENGINE_SHA256SUM := 
233f66e8d25c5dd971716d4200203a612a407649686ef3b52075d04b4c9df0dd
 export JFREEREPORT_FLOW_ENGINE_TARBALL := 
ba2930200c9f019c2d93a8c88c651a0f-flow-engine-0.9.4.zip
 export JFREEREPORT_FLUTE_SHA256SUM := 
1b5b24f7bc543c0362b667692f78db8bab4ed6dafc6172f104d0bd3757d8a133
diff --git a/external/icu/UnpackedTarball_icu.mk 
b/external/icu/UnpackedTarball_icu.mk
index 002b7d28cab5..435382fa7988 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -28,20 +28,19 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
external/icu/icu4c-macosx.patch.1 \
external/icu/icu4c-solarisgcc.patch.1 \
external/icu/icu4c-mkdir.patch.1 \
-   external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch.1 \
external/icu/icu4c-ubsan.patch.1 \
external/icu/icu4c-scriptrun.patch.1 \
external/icu/icu4c-rtti.patch.1 \
external/icu/icu4c-clang-cl.patch.1 \
-   $(if $(filter-out 
ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.patch.1) \
external/icu/gcc9.patch \
external/icu/c++20-comparison.patch \
-   external/icu/ubsan.patch \
+   external/icu/ubsan.patch.1 \
external/icu/Wdeprecated-copy-dtor.patch \
external/icu/icu4c-khmerbreakengine.patch.1 \
external/icu/strict_ansi.patch \
-   external/icu/icu4c-link-scrptrun.patch.2 \
external/icu/icu4c-windows-cygwin-cross.patch.1 \
+   external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch.1 \
+   $(if $(filter-out 
ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.patch.1) \
 ))
 
 $(eval $(call 
gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict))
diff --git a/external/icu/icu4c-link-scrptrun.patch.2 
b/external/icu/icu4c-link-scrptrun.patch.2
deleted file mode 100644
index 8c94361a163c..
--- a/external/icu/icu4c-link-scrptrun.patch.2
+++ /dev/null
@@ -1,43 +0,0 @@
-Based on: 
https://github.com/unicode-org/icu/commit/e3f2c0dd70018d924bf22a9b3f0cbf387316b50b.patch
-
-From e3f2c0dd70018d924bf22a9b3f0cbf387316b50b Mon Sep 17 00:00:00 2001
-From: Paul Smith 
-Date: Wed, 5 Aug 2020 13:18:30 -0400
-Subject: [PATCH] ICU-21217 Windows: Fix link command for extra/scrptrun
-

[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - download.lst

2020-11-17 Thread Eike Rathke (via logerrit)
 download.lst |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a9132dc4c79088b25f6b10c5a5ba7dbcbcccf5d3
Author: Eike Rathke 
AuthorDate: Mon Nov 16 18:47:51 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Nov 17 09:57:54 2020 +0100

Update language-subtag-registry to 2020-09-29

Change-Id: Iae3995acb5d9fb27122c76b1ff4ae61c3f9ec05c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105957
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 312a33b7636334f6ce3b6d1702bc5d3e45215601)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105865
Reviewed-by: Caolán McNamara 

diff --git a/download.lst b/download.lst
index 837e23826e05..4a8f922fb9ed 100644
--- a/download.lst
+++ b/download.lst
@@ -140,8 +140,8 @@ export JFREEREPORT_SAC_SHA256SUM := 
085f2112c51fa8c1783fac12fbd45265059641512134
 export JFREEREPORT_SAC_TARBALL := 
39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
 export LIBJPEG_TURBO_SHA256SUM := 
b24890e2bb46e12e72a79f7e965f409f4e16466d00e1dd15d93d73ee6b592523
 export LIBJPEG_TURBO_TARBALL := libjpeg-turbo-1.5.3.tar.gz
-export LANGTAGREG_SHA256SUM := 
fb1ee0dabfd956a445fbe9f351e86a52767808558f20f4256e67fbbb3768e9da
-export LANGTAGREG_TARBALL := language-subtag-registry-2020-04-01.tar.bz2
+export LANGTAGREG_SHA256SUM := 
cbe9fca811a37056560aab73e9fc9d3522b46b6785cb02db165f521bf42c230f
+export LANGTAGREG_TARBALL := language-subtag-registry-2020-09-29.tar.bz2
 export LANGUAGETOOL_SHA256SUM := 
48c87e41636783bba438b65fd895821e369ed139e1465fac654323ad93c5a82d
 export LANGUAGETOOL_TARBALL := 
b63e6340a02ff1cacfeadb2c42286161-JLanguageTool-1.7.0.tar.bz2
 export LCMS2_SHA256SUM := 
48c6fdf98396fa245ed86e622028caf49b96fa22f3e5734f853f806fbc8e7d20
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: download.lst

2020-11-16 Thread Eike Rathke (via logerrit)
 download.lst |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 312a33b7636334f6ce3b6d1702bc5d3e45215601
Author: Eike Rathke 
AuthorDate: Mon Nov 16 18:47:51 2020 +0100
Commit: Eike Rathke 
CommitDate: Tue Nov 17 01:18:13 2020 +0100

Update language-subtag-registry to 2020-09-29

Change-Id: Iae3995acb5d9fb27122c76b1ff4ae61c3f9ec05c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105957
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/download.lst b/download.lst
index 5b29fb7046fb..46a8d3066cc1 100644
--- a/download.lst
+++ b/download.lst
@@ -142,8 +142,8 @@ export JFREEREPORT_SAC_SHA256SUM := 
085f2112c51fa8c1783fac12fbd45265059641512134
 export JFREEREPORT_SAC_TARBALL := 
39bb3fcea1514f1369fcfc87542390fd-sacjava-1.3.zip
 export LIBJPEG_TURBO_SHA256SUM := 
b24890e2bb46e12e72a79f7e965f409f4e16466d00e1dd15d93d73ee6b592523
 export LIBJPEG_TURBO_TARBALL := libjpeg-turbo-1.5.3.tar.gz
-export LANGTAGREG_SHA256SUM := 
fb1ee0dabfd956a445fbe9f351e86a52767808558f20f4256e67fbbb3768e9da
-export LANGTAGREG_TARBALL := language-subtag-registry-2020-04-01.tar.bz2
+export LANGTAGREG_SHA256SUM := 
cbe9fca811a37056560aab73e9fc9d3522b46b6785cb02db165f521bf42c230f
+export LANGTAGREG_TARBALL := language-subtag-registry-2020-09-29.tar.bz2
 export LANGUAGETOOL_SHA256SUM := 
48c87e41636783bba438b65fd895821e369ed139e1465fac654323ad93c5a82d
 export LANGUAGETOOL_TARBALL := 
b63e6340a02ff1cacfeadb2c42286161-JLanguageTool-1.7.0.tar.bz2
 export LCMS2_SHA256SUM := 
dc49b9c8e4d7cdff376040571a722902b682a795bf92985a85b48854c270772e
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/source

2020-11-03 Thread Eike Rathke (via logerrit)
 sc/source/ui/docshell/docsh4.cxx |7 ++-
 sc/source/ui/inc/docsh.hxx   |1 +
 sc/source/ui/view/tabvwsh4.cxx   |9 +
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 486034a22860e8db1ef5ea4ee258d3fe0395886d
Author: Eike Rathke 
AuthorDate: Sun Nov 1 18:09:45 2020 +0100
Commit: Michael Stahl 
CommitDate: Tue Nov 3 10:39:17 2020 +0100

Resolves: tdf#135108 Allow link updates if loaded document so far had none

It is the current user who'll add external references, not the
creator of the loaded document.

Change-Id: I59a6d0b8600a9b299aa54a1efeedfccc16ad69d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105152
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 14f9dac4fbaeb0e13ad4875f77960c4019d8f229)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105055
Reviewed-by: Michael Stahl 

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 3aa1426eb9e7..59caa054701b 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -110,10 +110,15 @@ using namespace ::com::sun::star;
 
 #include 
 
-void ScDocShell::ReloadAllLinks()
+void ScDocShell::AllowLinkUpdate()
 {
 m_aDocument.SetLinkFormulaNeedingCheck(false);
 getEmbeddedObjectContainer().setUserAllowsLinkUpdate(true);
+}
+
+void ScDocShell::ReloadAllLinks()
+{
+AllowLinkUpdate();
 
 ReloadTabLinks();
 weld::Window *pDialogParent = GetActiveDialogParent();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index e23067503bae..dc77bdcbb25b 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -294,6 +294,7 @@ public:
 
 virtual voidReconnectDdeLink(SfxObjectShell& rServer) override;
 voidUpdateLinks() override;
+voidAllowLinkUpdate();
 voidReloadAllLinks();
 voidReloadTabLinks();
 ScLkUpdMode GetLinkUpdateModeState() const;
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index e57caf3c2c33..c3fa4e1fe39f 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1579,6 +1579,15 @@ void ScTabViewShell::Construct( TriState 
nForceDesignMode )
 SfxCallMode::ASYNCHRON | 
SfxCallMode::RECORD );
 }
 }
+else
+{
+// No links yet, but loading an existing document may have
+// disabled link update but there's no "Allow updating" infobar
+// that could enable it again. So in order to enable the user
+// to add formulas with external references allow link updates
+// again.
+pDocSh->AllowLinkUpdate();
+}
 
 bool bReImport = false; // update 
imported data
 ScDBCollection* pDBColl = rDoc.GetDBCollection();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-11-01 Thread Eike Rathke (via logerrit)
 sc/source/ui/docshell/docsh4.cxx |7 ++-
 sc/source/ui/inc/docsh.hxx   |1 +
 sc/source/ui/view/tabvwsh4.cxx   |9 +
 3 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 14f9dac4fbaeb0e13ad4875f77960c4019d8f229
Author: Eike Rathke 
AuthorDate: Sun Nov 1 18:09:45 2020 +0100
Commit: Eike Rathke 
CommitDate: Sun Nov 1 20:39:28 2020 +0100

Resolves: tdf#135108 Allow link updates if loaded document so far had none

It is the current user who'll add external references, not the
creator of the loaded document.

Change-Id: I59a6d0b8600a9b299aa54a1efeedfccc16ad69d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105152
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index c2d1c5047794..737268f9b8e7 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -111,10 +111,15 @@ using namespace ::com::sun::star;
 
 #include 
 
-void ScDocShell::ReloadAllLinks()
+void ScDocShell::AllowLinkUpdate()
 {
 m_aDocument.SetLinkFormulaNeedingCheck(false);
 getEmbeddedObjectContainer().setUserAllowsLinkUpdate(true);
+}
+
+void ScDocShell::ReloadAllLinks()
+{
+AllowLinkUpdate();
 
 ReloadTabLinks();
 weld::Window *pDialogParent = GetActiveDialogParent();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 706d47cc6996..bfdaf85af4b3 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -294,6 +294,7 @@ public:
 
 virtual voidReconnectDdeLink(SfxObjectShell& rServer) override;
 voidUpdateLinks() override;
+voidAllowLinkUpdate();
 voidReloadAllLinks();
 voidReloadTabLinks();
 ScLkUpdMode GetLinkUpdateModeState() const;
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index c173ca5e69bf..68a76c329007 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1583,6 +1583,15 @@ void ScTabViewShell::Construct( TriState 
nForceDesignMode )
 SfxCallMode::ASYNCHRON | 
SfxCallMode::RECORD );
 }
 }
+else
+{
+// No links yet, but loading an existing document may have
+// disabled link update but there's no "Allow updating" infobar
+// that could enable it again. So in order to enable the user
+// to add formulas with external references allow link updates
+// again.
+pDocSh->AllowLinkUpdate();
+}
 
 bool bReImport = false; // update 
imported data
 ScDBCollection* pDBColl = rDoc.GetDBCollection();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/source/ui/namedlg/namepast.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 5805a1d57c4a52566899b7fdaf88d6309056411e
Author: Eike Rathke 
AuthorDate: Sat Oct 31 21:49:36 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 23:26:09 2020 +0100

Enquote sheet name if necessary, tdf#137896 follow-up

Change-Id: I9ebdc30bf0b8b1531d57da299146fda9871442ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105126
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/source/ui/namedlg/namepast.cxx 
b/sc/source/ui/namedlg/namepast.cxx
index 491c69e0f7ba..63ddeccd0ab8 100644
--- a/sc/source/ui/namedlg/namepast.cxx
+++ b/sc/source/ui/namedlg/namepast.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 ScNamePasteDlg::ScNamePasteDlg(weld::Window * pParent, ScDocShell* pShell)
 : GenericDialogController(pParent, "modules/scalc/ui/insertname.ui", 
"InsertNameDialog")
@@ -80,7 +81,11 @@ IMPL_LINK(ScNamePasteDlg, ButtonHdl, weld::Button&, rButton, 
void)
 if (rLine.aScope == aGlobalScope)
 maSelectedNames.push_back(rLine.aName);
 else
-maSelectedNames.push_back(rLine.aScope + m_aSheetSep + 
rLine.aName);
+{
+OUString aSheet( rLine.aScope);
+ScCompiler::CheckTabQuotes( aSheet);
+maSelectedNames.push_back( aSheet + m_aSheetSep + rLine.aName);
+}
 }
 m_xDialog->response(BTN_PASTE_NAME);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/source/ui/app/inputhdl.cxx |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

New commits:
commit 90ec4069e987e7d16b89dd85a3008a7c868bba1f
Author: Eike Rathke 
AuthorDate: Sat Oct 31 19:27:14 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 21:31:10 2020 +0100

Use ScDocument::GetSheetSeparator()

Change-Id: Ib83e66f2184b32f98e01e3deae5600c2e0f2045f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105125
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index df08e89a7b19..7d17b6e0526f 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -105,13 +105,6 @@ namespace {
 // Collation may treat parentheses differently.
 const sal_Unicode cParenthesesReplacement = 0x0001;
 
-sal_Unicode lcl_getSheetSeparator(ScDocument& rDoc)
-{
-const ScCompiler::Convention* pConv = ScCompiler::GetRefConvention(
-FormulaGrammar::extractRefConvention( rDoc.GetGrammar()));
-return pConv ? pConv->getSpecialSymbol( 
ScCompiler::Convention::SHEET_SEPARATOR) : '.';
-}
-
 ScTypedCaseStrSet::const_iterator findText(
 const ScTypedCaseStrSet& rDataSet, ScTypedCaseStrSet::const_iterator const 
& itPos,
 const OUString& rStart, OUString& rResult, bool bBack)
@@ -311,7 +304,7 @@ void ScInputHandler::InitRangeFinder( const OUString& 
rFormula )
 return;
 ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
 ScDocument& rDoc = pDocSh->GetDocument();
-const sal_Unicode cSheetSep = lcl_getSheetSeparator(rDoc);
+const sal_Unicode cSheetSep = rDoc.GetSheetSeparator();
 
 OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !~\"");
 // delimiters (in addition to ScEditUtil): only characters that are
@@ -1064,7 +1057,7 @@ void ScInputHandler::ShowArgumentsTip( OUString& rSelText 
)
 
 ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
 const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
-const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
+const sal_Unicode cSheetSep = pDocSh->GetDocument().GetSheetSeparator();
 FormulaHelper aHelper(ScGlobal::GetStarCalcFunctionMgr());
 bool bFound = false;
 while( !bFound )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/source/ui/inc/namepast.hxx |1 +
 sc/source/ui/namedlg/namepast.cxx |9 -
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 8720ccc3fb40a9e0df0b0c62d0854f744fa715f8
Author: Eike Rathke 
AuthorDate: Sat Oct 31 19:20:14 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 21:30:48 2020 +0100

Resolves: tdf#137896 Paste sheet-local names with sheet name prefix

Change-Id: Ib1779bb42c8b26a825899f8a93bc22b7ee441637
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105124
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/inc/namepast.hxx b/sc/source/ui/inc/namepast.hxx
index b5f09be8b628..cc54ed26e5d0 100644
--- a/sc/source/ui/inc/namepast.hxx
+++ b/sc/source/ui/inc/namepast.hxx
@@ -41,6 +41,7 @@ private:
 
 std::vector maSelectedNames;
 std::map> m_RangeMap;
+OUString m_aSheetSep;
 
 public:
 ScNamePasteDlg(weld::Window* pParent, ScDocShell* pShell);
diff --git a/sc/source/ui/namedlg/namepast.cxx 
b/sc/source/ui/namedlg/namepast.cxx
index 97b04395de43..491c69e0f7ba 100644
--- a/sc/source/ui/namedlg/namepast.cxx
+++ b/sc/source/ui/namedlg/namepast.cxx
@@ -24,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 ScNamePasteDlg::ScNamePasteDlg(weld::Window * pParent, ScDocShell* pShell)
 : GenericDialogController(pParent, "modules/scalc/ui/insertname.ui", 
"InsertNameDialog")
@@ -32,6 +34,7 @@ ScNamePasteDlg::ScNamePasteDlg(weld::Window * pParent, 
ScDocShell* pShell)
 , m_xBtnClose(m_xBuilder->weld_button("close"))
 {
 ScDocument& rDoc = pShell->GetDocument();
+m_aSheetSep = OUString( rDoc.GetSheetSeparator());
 std::map aCopyMap;
 rDoc.GetRangeNameMap(aCopyMap);
 for (const auto& [aTemp, pName] : aCopyMap)
@@ -70,10 +73,14 @@ IMPL_LINK(ScNamePasteDlg, ButtonHdl, weld::Button&, 
rButton, void)
 }
 else if ( == m_xBtnPaste.get())
 {
+const OUString aGlobalScope( ScResId( STR_GLOBAL_SCOPE));
 std::vector aSelectedLines = 
m_xTable->GetSelectedEntries();
 for (const auto& rLine : aSelectedLines)
 {
-maSelectedNames.push_back(rLine.aName);
+if (rLine.aScope == aGlobalScope)
+maSelectedNames.push_back(rLine.aName);
+else
+maSelectedNames.push_back(rLine.aScope + m_aSheetSep + 
rLine.aName);
 }
 m_xDialog->response(BTN_PASTE_NAME);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/inc sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/inc/document.hxx  |6 ++
 sc/source/core/data/documen4.cxx |8 
 2 files changed, 14 insertions(+)

New commits:
commit c87a70c9f66256c85df7e7d33c3ebb46782593a7
Author: Eike Rathke 
AuthorDate: Sat Oct 31 18:27:58 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 21:30:31 2020 +0100

Implement ScDocument::GetSheetSeparator()

That can be reused.

Change-Id: I4805fefa7585ddee026073e3b647020f8a993ab2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105123
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index edc0447949cf..5bab5a19d80c 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -803,6 +803,12 @@ public:
  */
 bool InsertNewRangeName( SCTAB nTab, const OUString& rName, const 
ScAddress& rPos, const OUString& rExpr );
 
+/** Obtain the sheet separator corresponding to the document's grammar.
+
+@return '.' for our own grammars, '!' for Excel grammars.
+ */
+SC_DLLPUBLIC sal_Unicode GetSheetSeparator() const;
+
 SCTAB GetMaxTableNumber() const { return static_cast(maTabs.size()) 
- 1; }
 
 ScRangePairList*GetColNameRanges() { return xColNameRanges.get(); }
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 5e0e19f93035..9190ed109e44 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -1346,4 +1346,12 @@ void ScDocument::CompareDocument( ScDocument& rOtherDoc )
 }
 }
 
+sal_Unicode ScDocument::GetSheetSeparator() const
+{
+const ScCompiler::Convention* pConv = ScCompiler::GetRefConvention(
+FormulaGrammar::extractRefConvention( GetGrammar()));
+assert(pConv);
+return pConv ? pConv->getSpecialSymbol( 
ScCompiler::Convention::SHEET_SEPARATOR) : '.';
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/source/ui/app/inputhdl.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit bd938176a12cda2b7f1e0fe23d8799ce4ed59f71
Author: Eike Rathke 
AuthorDate: Sat Oct 31 17:07:58 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 19:24:40 2020 +0100

Constructing ScCompiler is unnecessary here

The sheet separator can be obtained from the AddressConvention
extracted from the document's FormulaGrammar.

Change-Id: Ieec8f49f1d338c29665192fc73320f76b8fa1484
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105106
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index fef75313ca04..df08e89a7b19 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -107,8 +107,9 @@ const sal_Unicode cParenthesesReplacement = 0x0001;
 
 sal_Unicode lcl_getSheetSeparator(ScDocument& rDoc)
 {
-ScCompiler aComp(rDoc, ScAddress(), rDoc.GetGrammar());
-return 
aComp.GetNativeAddressSymbol(ScCompiler::Convention::SHEET_SEPARATOR);
+const ScCompiler::Convention* pConv = ScCompiler::GetRefConvention(
+FormulaGrammar::extractRefConvention( rDoc.GetGrammar()));
+return pConv ? pConv->getSpecialSymbol( 
ScCompiler::Convention::SHEET_SEPARATOR) : '.';
 }
 
 ScTypedCaseStrSet::const_iterator findText(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/interpr1.cxx |   52 ---
 1 file changed, 48 insertions(+), 4 deletions(-)

New commits:
commit 8100e82509b2f5f29dabf24e19461d649f166b4c
Author: Eike Rathke 
AuthorDate: Sat Oct 31 01:36:18 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 11:47:20 2020 +0100

Support external names in INDIRECT()

Works with external global names, external sheet-local names are
not supported by ScExternalRefManager / ScExternalRefCache.

Change-Id: I59ecc9444268a14eee67439db5ed99181a716151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105092
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 8e50ae7303c5..1bcc37478eb5 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8190,12 +8190,45 @@ void ScInterpreter::ScIndirect()
 }
 while (false);
 
-// It may be even a TableRef.
+// It may be even a TableRef or an external name.
 // Anything else that resolves to one reference could be added
 // here, but we don't want to compile every arbitrary string. This
 // is already nasty enough...
-sal_Int32 nIndex = sRefStr.indexOf('[');
-if (nIndex >= 0 && sRefStr.indexOf(']',nIndex+1) > nIndex)
+sal_Int32 nIndex = ScGlobal::FindUnquoted( sRefStr, '[');
+const bool bTableRef = (nIndex > 0 && ScGlobal::FindUnquoted( sRefStr, 
']', nIndex+1) > nIndex);
+bool bExternalName = false; // External references would had been 
consumed above already.
+if (!bTableRef)
+{
+// This is our own file name reference representation centric.. but
+// would work also for XL '[doc]'!name and also for
+// '[doc]Sheet1'!name ... sickos.
+if (sRefStr[0] == '\'')
+{
+// Minimum 'a'#name or 'a'!name
+// bTryXlA1 means try both, first our own.
+if (bTryXlA1 || eConv == FormulaGrammar::CONV_OOO)
+{
+nIndex = ScGlobal::FindUnquoted( sRefStr, '#');
+if (nIndex >= 3 && sRefStr[nIndex-1] == '\'')
+{
+bExternalName = true;
+eConv = FormulaGrammar::CONV_OOO;
+}
+}
+if (!bExternalName && (bTryXlA1 || eConv != 
FormulaGrammar::CONV_OOO))
+{
+nIndex = ScGlobal::FindUnquoted( sRefStr, '!');
+if (nIndex >= 3 && sRefStr[nIndex-1] == '\'')
+{
+bExternalName = true;
+if (eConv == FormulaGrammar::CONV_OOO)
+eConv = FormulaGrammar::CONV_XL_A1;
+}
+}
+}
+
+}
+if (bExternalName || bTableRef)
 {
 do
 {
@@ -8203,8 +8236,17 @@ void ScInterpreter::ScIndirect()
 aComp.SetRefConvention( eConv); // must be after grammar
 std::unique_ptr pTokArr( aComp.CompileString( 
sRefStr));
 
+if (pTokArr->GetCodeError() != FormulaError::NONE || 
!pTokArr->GetLen())
+break;
+
 // Whatever... use only the specific case.
-if (!pTokArr->HasOpCode( ocTableRef))
+if (bExternalName)
+{
+const formula::FormulaToken* pTok = pTokArr->FirstToken();
+if (!pTok || pTok->GetType() != svExternalName)
+break;
+}
+else if (!pTokArr->HasOpCode( ocTableRef))
 break;
 
 aComp.CompileTokenArray();
@@ -8223,6 +8265,8 @@ void ScInterpreter::ScIndirect()
 {
 case svSingleRef:
 case svDoubleRef:
+case svExternalSingleRef:
+case svExternalDoubleRef:
 case svError:
 PushTokenRef( xTok);
 // success!
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/inc sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/inc/rangeutl.hxx  |3 ++-
 sc/source/core/tool/interpr1.cxx |2 +-
 sc/source/core/tool/rangeutl.cxx |   36 +++-
 3 files changed, 38 insertions(+), 3 deletions(-)

New commits:
commit 075da6f2463c922bcb8c553949756af4e8e103e0
Author: Eike Rathke 
AuthorDate: Sat Oct 31 01:20:55 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 11:47:00 2020 +0100

Resolves: tdf#100818 Support sheet-local scoped names in INDIRECT()

Change-Id: Iae1ef07bf735b5886e391dced9984acee617f051
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105091
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx
index 2212d6bb9a41..7f68a25a9af7 100644
--- a/sc/inc/rangeutl.hxx
+++ b/sc/inc/rangeutl.hxx
@@ -221,7 +221,8 @@ public:
 const ScDocument& rDoc );
 
 /// String to RangeData core
-static ScRangeData* GetRangeDataFromString(const OUString& rString, const 
SCTAB nTab, const ScDocument& rDoc);
+static ScRangeData* GetRangeDataFromString( const OUString& rString, const 
SCTAB nTab,
+const ScDocument& rDoc, 
formula::FormulaGrammar::AddressConvention eConv );
 };
 
 class ScArea
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 321f80328095..8e50ae7303c5 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8128,7 +8128,7 @@ void ScInterpreter::ScIndirect()
 {
 do
 {
-ScRangeData* pData = 
ScRangeStringConverter::GetRangeDataFromString(sRefStr, nTab, mrDoc);
+ScRangeData* pData = 
ScRangeStringConverter::GetRangeDataFromString( sRefStr, nTab, mrDoc, eConv);
 if (!pData)
 break;
 
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 39c4a1a26f58..eb6737f34879 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -894,8 +894,42 @@ void ScRangeStringConverter::GetStringFromXMLRangeString( 
OUString& rString, con
 rString = aRetStr.makeStringAndClear();
 }
 
-ScRangeData* ScRangeStringConverter::GetRangeDataFromString(const OUString& 
rString, const SCTAB nTab, const ScDocument& rDoc)
+ScRangeData* ScRangeStringConverter::GetRangeDataFromString( const OUString& 
rString, const SCTAB nTab,
+const ScDocument& rDoc, formula::FormulaGrammar::AddressConvention 
eConv )
 {
+// This may be called with an external 'doc'#name but wouldn't find any.
+
+// Dot '.' is not allowed in range names, if present only lookup if it's a
+// sheet-local name. Same for '!' Excel syntax.
+// If eConv == FormulaGrammar::CONV_A1_XL_A1 then try both, first our own.
+sal_Int32 nIndex = -1;
+if (eConv == FormulaGrammar::CONV_OOO || eConv == 
FormulaGrammar::CONV_A1_XL_A1)
+nIndex = ScGlobal::FindUnquoted( rString, '.');
+if (nIndex < 0 && (eConv == FormulaGrammar::CONV_A1_XL_A1
+|| eConv == FormulaGrammar::CONV_XL_A1
+|| eConv == FormulaGrammar::CONV_XL_R1C1
+|| eConv == FormulaGrammar::CONV_XL_OOX))
+nIndex = ScGlobal::FindUnquoted( rString, '!');
+
+if (nIndex >= 0)
+{
+if (nIndex == 0)
+return nullptr; // Can't be a name.
+
+OUString aTab( rString.copy( 0, nIndex));
+ScGlobal::EraseQuotes( aTab, '\'');
+SCTAB nLocalTab;
+if (!rDoc.GetTable( aTab, nLocalTab))
+return nullptr;
+
+ScRangeName* pLocalRangeName = rDoc.GetRangeName(nLocalTab);
+if (!pLocalRangeName)
+return nullptr;
+
+const OUString aName( rString.copy( nIndex+1));
+return pLocalRangeName->findByUpperName( 
ScGlobal::getCharClassPtr()->uppercase( aName));
+}
+
 ScRangeName* pLocalRangeName = rDoc.GetRangeName(nTab);
 ScRangeData* pData = nullptr;
 OUString aUpperName = ScGlobal::getCharClassPtr()->uppercase(rString);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/address.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 5f0f3c09230daa40cbe3d0c7f5a1f193c2ccad8c
Author: Eike Rathke 
AuthorDate: Wed Oct 28 23:31:03 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 11:46:23 2020 +0100

Pass ExternalInfo up to caller from lcl_ScAddress_Parse_OOo()

... if external and sheet name was detected but a reference not
completely parsed, which may indicate an external sheet-local
name. This then in ScCompiler::IsSingleReference() is used to
reset mnCurrentSheetEndPos and mnCurrentSheetTab, which without
before was not done and may have lead to the external sheet-local
name being taken as a sheet-local name in the current document if
there was an identical one. External sheet-local names so far are
not supported at all.

The ExternalInfo is filled only if pSheetEndPos was passed but
then could be used by the caller to obtain a name later.
ExternalInfo::maTabName is filled only if a sheet name separator
was encountered.

Change-Id: I2414655a90a961af0e8ac2367cde7bdc4dcbb4c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105089
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index a1cae3fa93b4..e595e7003155 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1430,6 +1430,15 @@ static ScRefFlags lcl_ScAddress_Parse_OOo( const 
sal_Unicode* p, const ScDocumen
 }
 }
 }
+else if (bExtDoc && pExtInfo && !bExtDocInherited && !pExtInfo->mbExternal 
&& pSheetEndPos)
+{
+// Pass partial info up to caller, there may be an external name
+// following, and if after *pSheetEndPos it's external sheet-local.
+// For global names aTab is empty and *pSheetEndPos==0.
+pExtInfo->mbExternal = true;
+pExtInfo->maTabName = aTab;
+pExtInfo->mnFileId = 
rDoc.GetExternalRefManager()->getExternalFileId(aDocName);
+}
 
 rRawRes |= nRes;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/interpr1.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit fc92e4e8c51cee379781b15670507e72510a9f60
Author: Eike Rathke 
AuthorDate: Fri Oct 30 16:57:16 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 11:46:43 2020 +0100

Let INDIRECT() bail out early on empty string

e.g. if obtained from yet empty cell.

Change-Id: I18597b86b37d5d216213f9a101e8b84b307b2a34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105090
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 3268efdf2015..321f80328095 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8084,11 +8084,18 @@ void ScInterpreter::ScIndirect()
 bTryXlA1 = false;
 }
 
+OUString sRefStr = GetString().getString();
+if (sRefStr.isEmpty())
+{
+// Bail out early for empty cells, rely on "we do have a string" below.
+PushError( FormulaError::NoRef);
+return;
+}
 
 const ScAddress::Details aDetails( bTryXlA1 ? FormulaGrammar::CONV_OOO : 
eConv, aPos );
 const ScAddress::Details aDetailsXlA1( FormulaGrammar::CONV_XL_A1, aPos );
 SCTAB nTab = aPos.Tab();
-OUString sRefStr = GetString().getString();
+
 ScRefAddress aRefAd, aRefAd2;
 ScAddress::ExternalInfo aExtInfo;
 if ( ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetails, 
) ||
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/inc sc/source

2020-10-31 Thread Eike Rathke (via logerrit)
 sc/inc/global.hxx  |4 ++--
 sc/source/core/data/global.cxx |5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit a36f606ab319148fef0231e74345001289710feb
Author: Eike Rathke 
AuthorDate: Tue Oct 27 22:06:18 2020 +0100
Commit: Eike Rathke 
CommitDate: Sat Oct 31 11:46:02 2020 +0100

Reintroduce ScGlobal::FindUnquoted() nStart parameter

That got removed early as unused but will be needed.

Change-Id: I71c028bb92f337b10366b3eac44d3eacbf1e1355
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105088
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 84f0d9b4c2d8..e4560fd6c359 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -651,10 +651,10 @@ public:
 quoted strings with a separator, for example, 's1':'s2'. Embedded
 quotes have to be escaped by being doubled. Caller must ensure that
 nStart points into an unquoted range or the opening quote. Specialty:
-if cChar==cQuote the first cQuote character from nStart on is found.
+if cChar=='\'' the first quote character from nStart on is found.
 @returns offset if found, else -1
  */
-SC_DLLPUBLIC static sal_Int32   FindUnquoted( const OUString& rString, 
sal_Unicode cChar);
+SC_DLLPUBLIC static sal_Int32   FindUnquoted( const OUString& rString, 
sal_Unicode cChar, sal_Int32 nStart = 0 );
 
 /** Finds an unquoted instance of cChar in null-terminated pString. Same
 semantics as FindUnquoted( const String&, ...)
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 8b1dafe94e87..b53afafb6324 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -697,12 +697,13 @@ void ScGlobal::EraseQuotes( OUString& rString, 
sal_Unicode cQuote, bool bUnescap
 }
 }
 
-sal_Int32 ScGlobal::FindUnquoted( const OUString& rString, sal_Unicode cChar)
+sal_Int32 ScGlobal::FindUnquoted( const OUString& rString, sal_Unicode cChar, 
sal_Int32 nStart )
 {
+assert(nStart >= 0);
 const sal_Unicode cQuote = '\'';
 const sal_Unicode* const pStart = rString.getStr();
 const sal_Unicode* const pStop = pStart + rString.getLength();
-const sal_Unicode* p = pStart;
+const sal_Unicode* p = pStart + nStart;
 bool bQuoted = false;
 while (p < pStop)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/source

2020-10-29 Thread Eike Rathke (via logerrit)
 sc/source/ui/docshell/docfunc.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3ffaf415f4f76962b29b889cf1c8281664ae512f
Author: Eike Rathke 
AuthorDate: Mon Oct 26 22:02:26 2020 +0100
Commit: Xisco Fauli 
CommitDate: Thu Oct 29 11:54:55 2020 +0100

Resolves: tdf#137617 Use document address convention to create names

... from selection.

Change-Id: I0b170f36cfdb592e7cebae0246fba12c0180e2c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104854
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104867

diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index c66ddeb06a9e..3d840ad3c2ab 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5190,7 +5190,8 @@ void ScDocFunc::CreateOneName( ScRangeName& rList,
 ScRangeData::MakeValidName(, aName);
 if (!aName.isEmpty())
 {
-OUString aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab 
).Format(rDoc, ScRefFlags::RANGE_ABS_3D));
+OUString aContent( ScRange( nX1, nY1, nTab, nX2, nY2, nTab 
).Format(
+rDoc, ScRefFlags::RANGE_ABS_3D, ScAddress::Details( 
rDoc.GetAddressConvention(), nPosY, nPosX)));
 
 bool bInsert = false;
 ScRangeData* pOld = 
rList.findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-26 Thread Eike Rathke (via logerrit)
 sc/source/ui/docshell/docfunc.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 352840a49be8626448f7823a6bae207e65171e52
Author: Eike Rathke 
AuthorDate: Mon Oct 26 22:02:26 2020 +0100
Commit: Eike Rathke 
CommitDate: Tue Oct 27 01:47:59 2020 +0100

Resolves: tdf#137617 Use document address convention to create names

... from selection.

Change-Id: I0b170f36cfdb592e7cebae0246fba12c0180e2c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104854
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 617937cf2231..d98e2773b97d 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5222,7 +5222,8 @@ void ScDocFunc::CreateOneName( ScRangeName& rList,
 if (aName.isEmpty())
 return;
 
-OUString aContent(ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(rDoc, 
ScRefFlags::RANGE_ABS_3D));
+OUString aContent( ScRange( nX1, nY1, nTab, nX2, nY2, nTab ).Format(
+rDoc, ScRefFlags::RANGE_ABS_3D, ScAddress::Details( 
rDoc.GetAddressConvention(), nPosY, nPosX)));
 
 bool bInsert = false;
 ScRangeData* pOld = 
rList.findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: Where are Calc functions implemented in libreoffce?

2020-10-23 Thread Eike Rathke
Hi,

On Thursday, 2020-10-22 19:31:04 +0200, Regina Henschel wrote:

> and the very good guide written by Eike
> https://wiki.openoffice.org/wiki/Calc/Implementation/Spreadsheet_Functions

That one has to be taken with a few grains of salt though.. some things
quite changed and are different now. However, it still may serve as
a good starting point if you abstract from details.

Right, I should distill the essentials and wrap something up in our
wiki, if I find time..

  Eike

-- 
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A


signature.asc
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sal/rtl

2020-10-20 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 52421298155eeea4f907a0a1f52e5725e9c8caf0
Author: Eike Rathke 
AuthorDate: Sun Oct 18 00:12:42 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 20 13:57:33 2020 +0200

Limit nDecPlaces to a sensible value [-20, 20]

Protect against callers using for example rtl_math_StringFormat_F
with rtl_math_DecimalPlaces_Max in worst case..

Change-Id: I9f143df6ae67b22e7732547c0f7a53b498caf2b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104472
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 6ccf4dd2224e4beb567365903249858a2ca00082)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104489
Reviewed-by: Xisco Fauli 

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 981009aa036c..b01253c70dfa 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -433,6 +433,12 @@ void doubleToString(typename T::String ** pResult,
 break;
 }
 
+// Too large values for nDecPlaces make no sense; it might also be
+// rtl_math_DecimalPlaces_Max was passed with rtl_math_StringFormat_F or
+// others, but we don't want to allocate/deallocate 2GB just to fill it
+// with trailing '0' characters..
+nDecPlaces = std::max(std::min(nDecPlaces, 20), -20);
+
 sal_Int32 nDigits = nDecPlaces + 1;
 
 if (eFormat == rtl_math_StringFormat_F)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - formula/source sc/inc sc/source

2020-10-18 Thread Eike Rathke (via logerrit)
 formula/source/core/api/FormulaCompiler.cxx |   19 +-
 sc/inc/compiler.hxx |   10 ++-
 sc/source/core/tool/compiler.cxx|   82 
 3 files changed, 83 insertions(+), 28 deletions(-)

New commits:
commit af75098d524311416a5f7caf6ae76055cc689ad1
Author: Eike Rathke 
AuthorDate: Mon Sep 28 21:02:23 2020 +0200
Commit: Muhammet Kara 
CommitDate: Sun Oct 18 22:36:40 2020 +0200

Resolves: tdf#137091 Use CharClass matching the formula language

 This is a combination of 3 commits.

Resolves: tdf#137091 Use CharClass matching the formula language

... not the current locale. Specifically important for
uppercase/lowercase conversions that may yield different results
for example in Turkish i with/without dot.

I2aa57cdcf530d7a0697c4ffbd5dccb86bb526d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103588
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 3c6177be2705303044e3de262689d593f3d0f282)
Signed-off-by: Xisco Fauli 

Current sytem locale's CharClass for user defined names, tdf#137091 
follow-up

I5f025a12ca183acb3f80d2a7527677aceb9ffbd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103593
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit d41c45a522c5e973d7043d36bc6c82e77735ab9b)

Determine CharClass difference once, tdf#137091 follow-up

As a side note:
Clang plugin simplifybool for
!(rLT1.getLanguage() == "en" && rLT2.getLanguage() == "en")
told "error: logical negation of logical op containing negation, can be 
simplified"
which is nonsense (the message stayed the same while the checks evolved).
It actually complained about !(a==b && c==d) to be rewritten as
(a!=b || c!=d) whether that makes sense or not.. it may save one
boolean operation, yes, but..

Ib478d46d7ff926c1c9f65fec059c7a3f31fa7ce3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103601
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 1acf517906b7cdc4931dd26319d467dff53ae7d2)

 Conflicts:
sc/source/core/tool/compiler.cxx

Change-Id: I2aa57cdcf530d7a0697c4ffbd5dccb86bb526d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103598
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104486
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Muhammet Kara 

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 16e58f9c8e71..5de0b8d76491 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -31,6 +31,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -143,6 +146,14 @@ void lclPushOpCodeMapEntries( ::std::vector< 
sheet::FormulaOpCodeMapEntry >& rVe
 lclPushOpCodeMapEntry( rVec, pTable, *pnOpCodes );
 }
 
+CharClass* createCharClassIfNonEnglishUI()
+{
+const LanguageTag& rLanguageTag( 
Application::GetSettings().GetUILanguageTag());
+if (rLanguageTag.getLanguage() == "en")
+return nullptr;
+return new CharClass( ::comphelper::getProcessComponentContext(), 
rLanguageTag);
+}
+
 class OpCodeList
 {
 public:
@@ -166,8 +177,8 @@ OpCodeList::OpCodeList(bool bLocalized, const 
std::pair* pSymb
 , mpSymbols(pSymbols)
 , mbLocalized(bLocalized)
 {
-SvtSysLocale aSysLocale;
-const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : 
aSysLocale.GetCharClassPtr());
+std::unique_ptr xCharClass( xMap->isEnglish() ? nullptr : 
createCharClassIfNonEnglishUI());
+const CharClass* pCharClass = xCharClass.get();
 if (meSepType == FormulaCompiler::SeparatorType::RESOURCE_BASE)
 {
 for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i)
@@ -813,8 +824,8 @@ FormulaCompiler::OpCodeMapPtr 
FormulaCompiler::CreateOpCodeMap(
 NonConstOpCodeMapPtr xMap( new OpCodeMap( SC_OPCODE_LAST_OPCODE_ID + 1, 
false,
 FormulaGrammar::mergeToGrammar( FormulaGrammar::setEnglishBit(
 FormulaGrammar::GRAM_EXTERNAL, bEnglish), 
FormulaGrammar::CONV_UNSPECIFIED)));
-SvtSysLocale aSysLocale;
-const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : 
aSysLocale.GetCharClassPtr());
+std::unique_ptr xCharClass( xMap->isEnglish() ? nullptr : 
createCharClassIfNonEnglishUI());
+const CharClass* pCharClass = xCharClass.get();
 for (auto const& rMapEntry : rMapping)
 {
 OpCode eOp = OpCode(rMapEntry.Token.OpCode);
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index c19ff834ded9..5de80a6b9fb3 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -

[Libreoffice-commits] core.git: sal/rtl

2020-10-17 Thread Eike Rathke (via logerrit)
 sal/rtl/math.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 6ccf4dd2224e4beb567365903249858a2ca00082
Author: Eike Rathke 
AuthorDate: Sun Oct 18 00:12:42 2020 +0200
Commit: Eike Rathke 
CommitDate: Sun Oct 18 01:46:58 2020 +0200

Limit nDecPlaces to a sensible value [-20, 20]

Protect against callers using for example rtl_math_StringFormat_F
with rtl_math_DecimalPlaces_Max in worst case..

Change-Id: I9f143df6ae67b22e7732547c0f7a53b498caf2b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104472
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index b7dc1cbbc7f0..fe81f4c5a7f7 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -433,6 +433,12 @@ void doubleToString(typename T::String ** pResult,
 break;
 }
 
+// Too large values for nDecPlaces make no sense; it might also be
+// rtl_math_DecimalPlaces_Max was passed with rtl_math_StringFormat_F or
+// others, but we don't want to allocate/deallocate 2GB just to fill it
+// with trailing '0' characters..
+nDecPlaces = std::max(std::min(nDecPlaces, 20), -20);
+
 sal_Int32 nDigits = nDecPlaces + 1;
 
 if (eFormat == rtl_math_StringFormat_F)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/source

2020-10-15 Thread Eike Rathke (via logerrit)
 sc/source/core/data/column4.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 701008631ee257b4c7714ac9e2689c5ecc45bff8
Author: Eike Rathke 
AuthorDate: Tue Oct 13 23:56:28 2020 +0200
Commit: Xisco Fauli 
CommitDate: Thu Oct 15 09:55:59 2020 +0200

Resolves: tdf#137248 Fix wrong condition breaking non-group interpret

Regression from

commit 4f36f2ccab6286ec09480caea602c0fa19195736
CommitDate: Thu Sep 10 11:15:47 2020 +0200

detect if a cell still needs interpreting after Interpret()

The bool return from ScFormulaCell::Interpret() does not indicate
if it was succesful but whether a group interpret was done. As
both calls here happen in a non-group context bailing out on that
if false (no group interpret) is wrong. Instead, ask the cell if
it still needs to be interpreted after having been interpreted.

Change-Id: I40f65e1da3d729cb3fef550620b1ea0a5741
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104261
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 59f86333f3fce091177d1cfb9363aa81686aa497)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104289
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 73adaf72dd71..950b38766c44 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1690,14 +1690,14 @@ static bool 
lcl_InterpretSpan(sc::formula_block::const_iterator& rSpanIter, SCRO
 ++itSpanStart;
 for (SCROW nIdx = nSpanStart+1; nIdx <= nSpanEnd; ++nIdx, 
++itSpanStart)
 {
-if( !(*itSpanStart)->Interpret()) // We know for sure that 
this cell is dirty so directly call Interpret().
+(*itSpanStart)->Interpret(); // We know for sure that this 
cell is dirty so directly call Interpret().
+if ((*itSpanStart)->NeedsInterpret())
 {
 SAL_WARN("sc.core.formulagroup", "Internal error, cell 
" << (*itSpanStart)->aPos
 << " failed running Interpret(), not allowing 
threading");
 bAllowThreading = false;
 return bAnyDirty;
 }
-assert(!(*itSpanStart)->NeedsInterpret());
 
 // Allow early exit like above.
 if ((mxParentGroup && mxParentGroup->mbPartOfCycle) || 
!rRecursionHelper.AreGroupsIndependent())
@@ -1804,14 +1804,14 @@ static void lcl_EvalDirty(sc::CellStoreType& rCells, 
SCROW nRow1, SCROW nRow2, S
 if( (*itCell)->NeedsInterpret())
 {
 bDirtyFlag = true;
-if(!(*itCell)->Interpret())
+(*itCell)->Interpret();
+if ((*itCell)->NeedsInterpret())
 {
 SAL_WARN("sc.core.formulagroup", "Internal 
error, cell " << (*itCell)->aPos
 << " failed running Interpret(), not 
allowing threading");
 bAllowThreading = false;
 return;
 }
-assert(!(*itCell)->NeedsInterpret());
 }
 bIsDirty = bIsDirty || bDirtyFlag;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/source

2020-10-14 Thread Eike Rathke (via logerrit)
 sc/source/core/data/column4.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 59f86333f3fce091177d1cfb9363aa81686aa497
Author: Eike Rathke 
AuthorDate: Tue Oct 13 23:56:28 2020 +0200
Commit: Eike Rathke 
CommitDate: Wed Oct 14 11:20:20 2020 +0200

Resolves: tdf#137248 Fix wrong condition breaking non-group interpret

Regression from

commit 4f36f2ccab6286ec09480caea602c0fa19195736
CommitDate: Thu Sep 10 11:15:47 2020 +0200

detect if a cell still needs interpreting after Interpret()

The bool return from ScFormulaCell::Interpret() does not indicate
if it was succesful but whether a group interpret was done. As
both calls here happen in a non-group context bailing out on that
if false (no group interpret) is wrong. Instead, ask the cell if
it still needs to be interpreted after having been interpreted.

Change-Id: I40f65e1da3d729cb3fef550620b1ea0a5741
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104261
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index a33c3d4b9175..827b9d76831b 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1690,14 +1690,14 @@ static bool 
lcl_InterpretSpan(sc::formula_block::const_iterator& rSpanIter, SCRO
 ++itSpanStart;
 for (SCROW nIdx = nSpanStart+1; nIdx <= nSpanEnd; ++nIdx, 
++itSpanStart)
 {
-if( !(*itSpanStart)->Interpret()) // We know for sure that 
this cell is dirty so directly call Interpret().
+(*itSpanStart)->Interpret(); // We know for sure that this 
cell is dirty so directly call Interpret().
+if ((*itSpanStart)->NeedsInterpret())
 {
 SAL_WARN("sc.core.formulagroup", "Internal error, cell 
" << (*itSpanStart)->aPos
 << " failed running Interpret(), not allowing 
threading");
 bAllowThreading = false;
 return bAnyDirty;
 }
-assert(!(*itSpanStart)->NeedsInterpret());
 
 // Allow early exit like above.
 if ((mxParentGroup && mxParentGroup->mbPartOfCycle) || 
!rRecursionHelper.AreGroupsIndependent())
@@ -1804,14 +1804,14 @@ static void lcl_EvalDirty(sc::CellStoreType& rCells, 
SCROW nRow1, SCROW nRow2, S
 if( (*itCell)->NeedsInterpret())
 {
 bDirtyFlag = true;
-if(!(*itCell)->Interpret())
+(*itCell)->Interpret();
+if ((*itCell)->NeedsInterpret())
 {
 SAL_WARN("sc.core.formulagroup", "Internal 
error, cell " << (*itCell)->aPos
 << " failed running Interpret(), not 
allowing threading");
 bAllowThreading = false;
 return;
 }
-assert(!(*itCell)->NeedsInterpret());
 }
 bIsDirty = bIsDirty || bDirtyFlag;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/svl svl/source

2020-10-14 Thread Eike Rathke (via logerrit)
 include/svl/zformat.hxx|8 
 svl/source/numbers/zformat.cxx |   27 ++-
 2 files changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 18f8a7056ac7b4677f4d99aac24ed2db44010140
Author: Eike Rathke 
AuthorDate: Tue Oct 13 21:41:45 2020 +0200
Commit: Eike Rathke 
CommitDate: Wed Oct 14 11:19:55 2020 +0200

Resolves: tdf#137453 Implicit conversion from sal_uInt64 to sal_Int32 is 
bad..

Change-Id: I5681249808cf623d3b7df09988f285268ea8d85f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104255
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index c1a6f7388ec9..6ced6b0122ff 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -657,8 +657,8 @@ private:
 SVL_DLLPRIVATE void ImpGetFractionElements( double& fNumber,
 sal_uInt16 nIx,
 double& fIntPart,
-sal_uInt64& nFrac,
-sal_uInt64& nDiv ) const;
+sal_Int64& nFrac,
+sal_Int64& nDiv ) const;
 SVL_DLLPRIVATE bool ImpGetFractionOutput(double fNumber,
  sal_uInt16 nIx,
  OUStringBuffer& OutString);
@@ -697,10 +697,10 @@ private:
 
 // normal digits or other digits, depending on ImpSvNumFor.aNatNum,
 // [NatNum1], [NatNum2], ...
-SVL_DLLPRIVATE OUString ImpGetNatNumString( const SvNumberNatNum& rNum, 
sal_Int32 nVal,
+SVL_DLLPRIVATE OUString ImpGetNatNumString( const SvNumberNatNum& rNum, 
sal_Int64 nVal,
   sal_uInt16 nMinDigits  ) const;
 
-OUString ImpIntToString( sal_uInt16 nIx, sal_Int32 nVal, sal_uInt16 
nMinDigits = 0 ) const
+OUString ImpIntToString( sal_uInt16 nIx, sal_Int64 nVal, sal_uInt16 
nMinDigits = 0 ) const
 {
 const SvNumberNatNum& rNum = NumFor[nIx].GetNatNum();
 if ( nMinDigits || rNum.IsComplete() )
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 550fdd8695fb..ae9055852fdf 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -63,6 +63,7 @@ const double EXP_ABS_UPPER_BOUND = 1.0E15;  // use 
exponential notation above th
 } // namespace
 
 const double D_MAX_U_INT32 = double(0x);  // 4294967295.0
+constexpr double D_MAX_INTEGER = (sal_uInt64(1) << 53) - 1;
 
 const double D_MAX_D_BY_100  = 1.7E306;
 const double D_MIN_M_BY_1000 = 2.3E-305;
@@ -2759,7 +2760,7 @@ double SvNumberformat::GetRoundFractionValue ( double 
fNumber ) const
 {
 sal_uInt16 nIx = GetSubformatIndex ( fNumber );
 double fIntPart = 0.0;   // integer part of fraction
-sal_uInt64 nFrac = 0, nDiv = 1;  // numerator and denominator
+sal_Int64 nFrac = 0, nDiv = 1;  // numerator and denominator
 double fSign = (fNumber < 0.0) ? -1.0 : 1.0;
 // fNumber is modified in ImpGetFractionElements to absolute fractional 
part
 ImpGetFractionElements ( fNumber, nIx, fIntPart, nFrac, nDiv );
@@ -2770,7 +2771,7 @@ double SvNumberformat::GetRoundFractionValue ( double 
fNumber ) const
 }
 
 void SvNumberformat::ImpGetFractionElements ( double& fNumber, sal_uInt16 nIx,
-  double& fIntPart, sal_uInt64& 
nFrac, sal_uInt64& nDiv ) const
+  double& fIntPart, sal_Int64& 
nFrac, sal_Int64& nDiv ) const
 {
 if ( fNumber < 0.0 )
 fNumber = -fNumber;
@@ -2780,7 +2781,7 @@ void SvNumberformat::ImpGetFractionElements ( double& 
fNumber, sal_uInt16 nIx,
 nDiv = lcl_GetDenominatorString( rInfo, NumFor[nIx].GetCount() ).toInt32();
 if( nDiv > 0 )
 {   // Forced Denominator
-nFrac = static_cast(floor ( fNumber * nDiv ));
+nFrac = static_cast(floor ( fNumber * nDiv ));
 double fFracNew = static_cast(nFrac) / 
static_cast(nDiv);
 double fFracNew1 = static_cast(nFrac + 1) / 
static_cast(nDiv);
 double fDiff = fNumber - fFracNew;
@@ -2792,8 +2793,8 @@ void SvNumberformat::ImpGetFractionElements ( double& 
fNumber, sal_uInt16 nIx,
 else // Calculated Denominator
 {
 nDiv = 1;
-sal_uInt64 nBasis = static_cast(floor( 
pow(10.0,rInfo.nCntExp))) - 1; // 9, 99, 999 ,...
-sal_uInt64 nFracPrev = 1, nDivPrev = 0, nFracNext, nDivNext, 
nPartialDenom;
+sal_Int64 nBasis = static_cast(floor( 
pow(10.0,rInfo.nCntExp))) - 1; // 9, 99, 999 ,...
+sal_Int64 nFracPrev = 1, nDivPrev = 0, nFracNext, nDivNext, 
nPartialDenom;
 double fRemainder = fNumber;
 
 // Use continued fraction represent

[Libreoffice-commits] core.git: formula/source include/formula

2020-10-13 Thread Eike Rathke (via logerrit)
 formula/source/core/api/token.cxx |5 +
 include/formula/token.hxx |   20 
 2 files changed, 9 insertions(+), 16 deletions(-)

New commits:
commit 5d9e33068e756b4e74aa2a5e8d9ed16dabe27f29
Author: Eike Rathke 
AuthorDate: Wed Oct 14 01:50:03 2020 +0200
Commit: Eike Rathke 
CommitDate: Wed Oct 14 03:52:15 2020 +0200

Derive FormulaExternalToken from FormulaByteToken, tdf#133260 follow-up

This should always have had a ParamClass member variable and
SetInForceArray()/GetInForceArray() functions but never did.

Now with

commit 3a33828b8de7554e497051738c722b1764960a86
CommitDate: Tue Oct 13 21:36:31 2020 +0200

Resolves: tdf#133260 Propagate ForceArrayReturn from inline arrays

it broke CppunitTest_sc_subsequent_filters_test with the virtual
dummy assert() in FormulaToken::SetInForceArray(). Unfortunately
not caught earlier but at least it did now.

Remove the duplicated FormulaToken overrides and simply derive
from FormulaByteToken instead that has all we need.

Change-Id: I7946602955970fb9d6f349efdacb41389e211b68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104262
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/formula/source/core/api/token.cxx 
b/formula/source/core/api/token.cxx
index 68df38517f76..92f60254ec8f 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1929,12 +1929,9 @@ bool FormulaIndexToken::operator==( const FormulaToken& 
r ) const
 mnSheet == r.GetSheet();
 }
 const OUString& FormulaExternalToken::GetExternal() const   { return 
aExternal; }
-sal_uInt8   FormulaExternalToken::GetByte() const   { return 
nByte; }
-voidFormulaExternalToken::SetByte( sal_uInt8 n ){ nByte = n; }
 bool FormulaExternalToken::operator==( const FormulaToken& r ) const
 {
-return FormulaToken::operator==( r ) && nByte == r.GetByte() &&
-aExternal == r.GetExternal();
+return FormulaByteToken::operator==( r ) && aExternal == r.GetExternal();
 }
 
 
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index 02bffd6a0225..4fc6b382d4cd 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -361,26 +361,22 @@ public:
 };
 
 
-class FORMULA_DLLPUBLIC FormulaExternalToken final : public FormulaToken
+class FORMULA_DLLPUBLIC FormulaExternalToken final : public FormulaByteToken
 {
 private:
-OUString  aExternal;
-sal_uInt8   nByte;
+OUStringaExternal;
 public:
 FormulaExternalToken( OpCode e, sal_uInt8 n, 
const OUString& r ) :
-FormulaToken( svExternal, e ), aExternal( 
r ),
-nByte( n ) {}
+FormulaByteToken( e, n, svExternal, 
ParamClass::Unknown ),
+aExternal( r ) {}
 FormulaExternalToken( OpCode e, const 
OUString& r ) :
-FormulaToken(svExternal, e ), aExternal( r 
),
-nByte( 0 ) {}
+FormulaByteToken( e, 0, svExternal, 
ParamClass::Unknown ),
+aExternal( r ) {}
 FormulaExternalToken( const 
FormulaExternalToken& r ) :
-FormulaToken( r ), aExternal( r.aExternal 
),
-nByte( r.nByte ) {}
+FormulaByteToken( r ), aExternal( 
r.aExternal ) {}
 
 virtual FormulaToken*   Clone() const override { return new 
FormulaExternalToken(*this); }
-virtual const OUString&   GetExternal() const override;
-virtual sal_uInt8   GetByte() const override;
-virtual voidSetByte( sal_uInt8 n ) override;
+virtual const OUString& GetExternal() const override;
 virtual booloperator==( const FormulaToken& rToken ) const 
override;
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source

2020-10-13 Thread Eike Rathke (via logerrit)
 formula/source/core/api/FormulaCompiler.cxx |   54 +++-
 1 file changed, 45 insertions(+), 9 deletions(-)

New commits:
commit 3a33828b8de7554e497051738c722b1764960a86
Author: Eike Rathke 
AuthorDate: Tue Oct 13 18:16:24 2020 +0200
Commit: Eike Rathke 
CommitDate: Tue Oct 13 21:36:31 2020 +0200

Resolves: tdf#133260 Propagate ForceArrayReturn from inline arrays

... and functions returning array/matrix.

Same as for TRANSPOSE() and FREQUENCY() but not mentioned in
ECMA-376-1:2016 OOXML.

Change-Id: I1e9f1151b2bc0b7de892f4f3d9f91b9a6b86b67f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104249
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index e969ecba4344..3829ffe562df 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -2714,9 +2714,41 @@ void FormulaCompiler::ForceArrayOperator( 
FormulaTokenRef const & rCurr )
 // CheckSetForceArrayParameter() and later PutCode().
 return;
 
-if (!(rCurr->GetOpCode() != ocPush && (rCurr->GetType() == svByte || 
rCurr->GetType() == svJump)))
+const OpCode eOp = rCurr->GetOpCode();
+const StackVar eType = rCurr->GetType();
+bool bInlineArray = false;
+if (!(eOp != ocPush && (eType == svByte || eType == svJump))
+&& !(bInlineArray = (eOp == ocPush && eType == svMatrix)))
 return;
 
+// Return class for inline arrays and functions returning array/matrix.
+// It's somewhat unclear what Excel actually does there and in
+// ECMA-376-1:2016 OOXML mentions "call to ... shall be an array formula"
+// only for FREQUENCY() and TRANSPOSE() but not for any other function
+// returning array/matrix or inline arrays, though for the latter has one
+// example in 18.17.2 Syntax:
+// "SUM(SQRT({1,2,3,4})) returns 6.14 when entered normally". However,
+// these need to be treated similar but not as ParamClass::ForceArray
+// (which would contradict the example in
+// https://bugs.documentfoundation.org/show_bug.cgi?id=122301#c19 and A6 of
+// https://bugs.documentfoundation.org/show_bug.cgi?id=133260#c10 ).
+// See also
+// commit d0ded163d8e93dc5b10d7a7c9bdab1d0a6a50bac
+// commit 5413c8871dec08eff19f514f5f391b946a45c86c
+constexpr ParamClass eArrayReturn = ParamClass::ForceArrayReturn;
+
+if (bInlineArray)
+{
+// rCurr->SetInForceArray() can not be used with ocPush.
+if (pCurrentFactorToken && pCurrentFactorToken->GetInForceArray() == 
ParamClass::Unknown)
+{
+// Propagate to caller as if a function returning an array/matrix
+// was called (see also below).
+pCurrentFactorToken->SetInForceArray( eArrayReturn);
+}
+return;
+}
+
 if (!pCurrentFactorToken || (pCurrentFactorToken.get() == rCurr.get()))
 {
 if (!pCurrentFactorToken && mbMatrixFlag)
@@ -2760,14 +2792,14 @@ void FormulaCompiler::ForceArrayOperator( 
FormulaTokenRef const & rCurr )
 return;
 
 // Actual current parameter's class.
-const formula::ParamClass eType = GetForceArrayParameter(
+const formula::ParamClass eParamType = GetForceArrayParameter(
 pCurrentFactorToken.get(), 
static_cast(nCurrentFactorParam - 1));
-if (eType == ParamClass::ForceArray)
-rCurr->SetInForceArray( eType);
-else if (eType == ParamClass::ReferenceOrForceArray)
+if (eParamType == ParamClass::ForceArray)
+rCurr->SetInForceArray( eParamType);
+else if (eParamType == ParamClass::ReferenceOrForceArray)
 {
 if (GetForceArrayParameter( rCurr.get(), SAL_MAX_UINT16) != 
ParamClass::Reference)
-rCurr->SetInForceArray( eType);
+rCurr->SetInForceArray( eParamType);
 else
 rCurr->SetInForceArray( 
formula::ParamClass::SuppressedReferenceOrForceArray);
 }
@@ -2775,9 +2807,13 @@ void FormulaCompiler::ForceArrayOperator( 
FormulaTokenRef const & rCurr )
 // Propagate a ForceArrayReturn to caller if the called function
 // returns one and the caller so far does not have a stronger array
 // mode set.
-if (pCurrentFactorToken->GetInForceArray() == ParamClass::Unknown
-&& GetForceArrayParameter( rCurr.get(), SAL_MAX_UINT16) == 
ParamClass::ForceArrayReturn)
-pCurrentFactorToken->SetInForceArray( ParamClass::ForceArrayReturn);
+if (pCurrentFactorToken->GetInForceArray() == ParamClass::Unknown)
+{
+if (IsMatrixFunction( eOp))
+pCurrentFactorToken->SetInForceArray( eArrayReturn);
+else if (GetForceArrayParameter( rCurr.get(), SAL_MAX_UINT16) == 
ParamClass::ForceArrayReturn)
+ 

[Libreoffice-commits] core.git: sc/inc sc/source

2020-10-10 Thread Eike Rathke (via logerrit)
 sc/inc/globstr.hrc  |   19 +--
 sc/source/core/data/stlpool.cxx |   19 ---
 sc/source/core/tool/stylehelper.cxx |   33 +
 3 files changed, 58 insertions(+), 13 deletions(-)

New commits:
commit 4a3466851c22920aa57443cb31b8f0c57d6c73ce
Author: Eike Rathke 
AuthorDate: Sat Oct 10 14:16:56 2020 +0200
Commit: Eike Rathke 
CommitDate: Sat Oct 10 15:59:35 2020 +0200

Resolves: tdf#137370 Re-enable UI translated standard cell style names

Regression from style rework

commit 7b0aed617f1e57335837cf56ef2d222a96f8270d
CommitDate: Wed Sep 28 11:42:56 2016 +

Remove old cell styles from calc

to

commit 06f319937187f76ee402d53b3baa78c391c2af19
CommitDate: Sun Oct 2 13:51:26 2016 +

tdf#90937 Add a set of cell styles to calc

Change-Id: I34dddb3ca3e54e3da5db112e1f9bcc8437fbda77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104141
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index a325e4087555..9cc238bee9ba 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -271,10 +271,25 @@
 #define STR_IMPORT_DIF  NC_("STR_IMPORT_DIF", "Dif 
Import")
 #define STR_STYLENAME_STANDARD_CELL NC_("STR_STYLENAME_STANDARD", 
"Default Cell Style")
 #define STR_STYLENAME_STANDARD_PAGE NC_("STR_STYLENAME_STANDARD", 
"Default Page Style")
+#define STR_STYLENAME_HEADING   NC_("STR_STYLENAME_HEADING", 
"Heading")
+#define STR_STYLENAME_HEADING_1 NC_("STR_STYLENAME_HEADING_1", 
"Heading 1")
+#define STR_STYLENAME_HEADING_2 NC_("STR_STYLENAME_HEADING_2", 
"Heading 2")
+#define STR_STYLENAME_TEXT  NC_("STR_STYLENAME_TEXT", 
"Text")
+#define STR_STYLENAME_NOTE  NC_("STR_STYLENAME_NOTE", 
"Note")
+#define STR_STYLENAME_FOOTNOTE  NC_("STR_STYLENAME_FOOTNOTE", 
"Footnote")
+#define STR_STYLENAME_HYPERLINK NC_("STR_STYLENAME_HYPERLINK", 
"Hyperlink")
+#define STR_STYLENAME_STATUSNC_("STR_STYLENAME_STATUS", 
"Status")
+#define STR_STYLENAME_GOOD  NC_("STR_STYLENAME_GOOD", 
"Good")
+#define STR_STYLENAME_NEUTRAL   NC_("STR_STYLENAME_NEUTRAL", 
"Neutral")
+#define STR_STYLENAME_BAD   NC_("STR_STYLENAME_BAD", "Bad")
+#define STR_STYLENAME_WARNING   NC_("STR_STYLENAME_WARNING", 
"Warning")
+#define STR_STYLENAME_ERROR NC_("STR_STYLENAME_ERROR", 
"Error")
+#define STR_STYLENAME_ACCENTNC_("STR_STYLENAME_ACCENT", 
"Accent")
+#define STR_STYLENAME_ACCENT_1  NC_("STR_STYLENAME_ACCENT_1", 
"Accent 1")
+#define STR_STYLENAME_ACCENT_2  NC_("STR_STYLENAME_ACCENT_2", 
"Accent 2")
+#define STR_STYLENAME_ACCENT_3  NC_("STR_STYLENAME_ACCENT_3", 
"Accent 3")
 #define STR_STYLENAME_RESULTNC_("STR_STYLENAME_RESULT", 
"Result")
 #define STR_STYLENAME_RESULT1   NC_("STR_STYLENAME_RESULT1", 
"Result2")
-#define STR_STYLENAME_HEADLINE  NC_("STR_STYLENAME_HEADLINE", 
"Heading")
-#define STR_STYLENAME_HEADLINE1 NC_("STR_STYLENAME_HEADLINE1", 
"Heading1")
 #define STR_STYLENAME_REPORTNC_("STR_STYLENAME_REPORT", 
"Report")
 #define STR_THESAURUS_NO_STRING NC_("STR_THESAURUS_NO_STRING", 
"Thesaurus can only be used in text cells!")
 #define STR_SPELLING_BEGIN_TAB  NC_("STR_SPELLING_BEGIN_TAB", 
"Should the spellcheck be continued at the beginning of the current sheet?")
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 6a8fcd5f5663..59de29c849de 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 ScStyleSheetPool::ScStyleSheetPool( const SfxItemPool& rPoolP,
 ScDocument* pDocument )
@@ -71,14 +72,14 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument )
 SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName,
SfxStyleFamily eFam, 
SfxStyleSearchBits mask)
 {
-//  When

[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - cui/source

2020-10-04 Thread Eike Rathke (via logerrit)
 cui/source/inc/numfmt.hxx  |5 +++--
 cui/source/tabpages/numfmt.cxx |   35 +++
 2 files changed, 34 insertions(+), 6 deletions(-)

New commits:
commit 893bdbe8ff9fcf96ca212f72d080bad141a5d99e
Author: Eike Rathke 
AuthorDate: Sun Oct 4 00:57:08 2020 +0200
Commit: Caolán McNamara 
CommitDate: Sun Oct 4 15:17:30 2020 +0200

Fix format comment handling in number format dialog

Clicking any format in the Format list could had applied the
default 'User-defined' comment to that format. Also an edited
comment for an already existing format when clicking on another
format applied the new comment to that other format. Sometimes
'User-defined' was displayed instead of a real comment.

Change-Id: I452d41f2860affed2475737e3bc925db687d96c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103907
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit cf40efa7518fb78c6ec12a6fa2c0fef284fa2a87)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103801
Reviewed-by: Caolán McNamara 

diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index 54796c63b736..1be328d9414e 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -77,12 +77,13 @@ public:
 private:
 std::unique_ptrpNumItem;
 std::unique_ptr pNumFmtShell;
-sal_uLong   nInitFormat;
+sal_uLong   nInitFormat;
+short   m_nLbFormatSelPosEdComment;
 
 boolbNumItemFlag; ///< for handling with DocShell
 boolbOneAreaFlag;
 boolbLegacyAutomaticCurrency;
-short   nFixedCategory;
+short   nFixedCategory;
 
 OUString sAutomaticLangEntry;
 OUString sAutomaticCurrencyEntry;
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 4297cd52241e..5e3e4252a05b 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -195,6 +195,7 @@ 
SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::Dia
 const SfxItemSet& rCoreAttrs)
 : SfxTabPage(pPage, pController, "cui/ui/numberingformatpage.ui", 
"NumberingFormatPage", )
 , nInitFormat(ULONG_MAX)
+, m_nLbFormatSelPosEdComment(SELPOS_NONE)
 , bLegacyAutomaticCurrency(false)
 , sAutomaticLangEntry(CuiResId(RID_SVXSTR_AUTO_ENTRY))
 , m_xFtCategory(m_xBuilder->weld_label("categoryft"))
@@ -1166,6 +1167,18 @@ IMPL_LINK(SvxNumberFormatTabPage, 
SelFormatListBoxHdl_Impl, weld::ComboBox&, rLb
 
 void SvxNumberFormatTabPage::SelFormatHdl_Impl(weld::Widget* pLb)
 {
+if (m_nLbFormatSelPosEdComment != SELPOS_NONE)
+{
+// Click handler is called before focus change handler, so finish
+// comment editing of previous format, otherwise a new format will have
+// the old comment displayed after LostFocusHdl_Impl() is called
+// later. Also, clicking into another category invalidates the format
+// list and SvxNumberFormatShell::SetComment4Entry() could either
+// access a wrong format from aCurEntryList[nEntry] or crash there if
+// the new vector has less elements.
+LostFocusHdl_Impl(*pLb);
+}
+
 if (pLb == m_xCbSourceFormat.get())
 {
 EnableBySourceFormat_Impl();// enable/disable everything else
@@ -1424,6 +1437,10 @@ bool SvxNumberFormatTabPage::Click_Impl(weld::Button& 
rIB)
 {
 if (!m_xEdComment->get_visible())
 {
+if (!m_xIbAdd->get_sensitive())
+// Editing for existing format.
+m_nLbFormatSelPosEdComment = m_xLbFormat->get_selected_index();
+
 m_xEdComment->set_text(m_xFtComment->get_label());
 m_xEdComment->show();
 m_xFtComment->hide();
@@ -1432,6 +1449,7 @@ bool SvxNumberFormatTabPage::Click_Impl(weld::Button& rIB)
 else
 {
 m_xEdFormat->grab_focus();
+m_xFtComment->set_label( m_xEdComment->get_text());
 m_xEdComment->hide();
 m_xFtComment->show();
 }
@@ -1600,13 +1618,22 @@ IMPL_LINK_NOARG(SvxNumberFormatTabPage, 
LostFocusHdl_Impl, weld::Widget&, void)
 {
 if (!pNumFmtShell)
 return;
-m_xFtComment->set_label(m_xEdComment->get_text());
+
+const bool bAddSensitive = m_xIbAdd->get_sensitive();
+if (bAddSensitive || m_nLbFormatSelPosEdComment != SELPOS_NONE)
+// Comment editing was possible.
+m_xFtComment->set_label(m_xEdComment->get_text());
+
 m_xEdComment->hide();
 m_xFtComment->show();
-if(!m_xIbAdd->get_sensitive())
+if (m_nLbFormatSelPosEdComment != SELPOS_NONE)
+{
+// Save edited comment of existing format.
+pNumFmtShell->SetComment4Entry( m_nLbFormatSelPosE

[Libreoffice-commits] core.git: cui/source

2020-10-04 Thread Eike Rathke (via logerrit)
 cui/source/inc/numfmt.hxx  |5 +++--
 cui/source/tabpages/numfmt.cxx |   35 +++
 2 files changed, 34 insertions(+), 6 deletions(-)

New commits:
commit cf40efa7518fb78c6ec12a6fa2c0fef284fa2a87
Author: Eike Rathke 
AuthorDate: Sun Oct 4 00:57:08 2020 +0200
Commit: Eike Rathke 
CommitDate: Sun Oct 4 11:31:54 2020 +0200

Fix format comment handling in number format dialog

Clicking any format in the Format list could had applied the
default 'User-defined' comment to that format. Also an edited
comment for an already existing format when clicking on another
format applied the new comment to that other format. Sometimes
'User-defined' was displayed instead of a real comment.

Change-Id: I452d41f2860affed2475737e3bc925db687d96c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103907
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index a3368003859d..a89e6ff2d355 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -76,12 +76,13 @@ public:
 private:
 std::unique_ptrpNumItem;
 std::unique_ptr pNumFmtShell;
-sal_uLong   nInitFormat;
+sal_uLong   nInitFormat;
+short   m_nLbFormatSelPosEdComment;
 
 boolbNumItemFlag; ///< for handling with DocShell
 boolbOneAreaFlag;
 boolbLegacyAutomaticCurrency;
-short   nFixedCategory;
+short   nFixedCategory;
 
 OUString sAutomaticLangEntry;
 OUString sAutomaticCurrencyEntry;
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index 18df998b492c..9cefae5d85ae 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -195,6 +195,7 @@ 
SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::Dia
 const SfxItemSet& rCoreAttrs)
 : SfxTabPage(pPage, pController, "cui/ui/numberingformatpage.ui", 
"NumberingFormatPage", )
 , nInitFormat(ULONG_MAX)
+, m_nLbFormatSelPosEdComment(SELPOS_NONE)
 , bLegacyAutomaticCurrency(false)
 , sAutomaticLangEntry(CuiResId(RID_SVXSTR_AUTO_ENTRY))
 , m_xFtCategory(m_xBuilder->weld_label("categoryft"))
@@ -1166,6 +1167,18 @@ IMPL_LINK(SvxNumberFormatTabPage, 
SelFormatListBoxHdl_Impl, weld::ComboBox&, rLb
 
 void SvxNumberFormatTabPage::SelFormatHdl_Impl(weld::Widget* pLb)
 {
+if (m_nLbFormatSelPosEdComment != SELPOS_NONE)
+{
+// Click handler is called before focus change handler, so finish
+// comment editing of previous format, otherwise a new format will have
+// the old comment displayed after LostFocusHdl_Impl() is called
+// later. Also, clicking into another category invalidates the format
+// list and SvxNumberFormatShell::SetComment4Entry() could either
+// access a wrong format from aCurEntryList[nEntry] or crash there if
+// the new vector has less elements.
+LostFocusHdl_Impl(*pLb);
+}
+
 if (pLb == m_xCbSourceFormat.get())
 {
 EnableBySourceFormat_Impl();// enable/disable everything else
@@ -1424,6 +1437,10 @@ bool SvxNumberFormatTabPage::Click_Impl(weld::Button& 
rIB)
 {
 if (!m_xEdComment->get_visible())
 {
+if (!m_xIbAdd->get_sensitive())
+// Editing for existing format.
+m_nLbFormatSelPosEdComment = m_xLbFormat->get_selected_index();
+
 m_xEdComment->set_text(m_xFtComment->get_label());
 m_xEdComment->show();
 m_xFtComment->hide();
@@ -1432,6 +1449,7 @@ bool SvxNumberFormatTabPage::Click_Impl(weld::Button& rIB)
 else
 {
 m_xEdFormat->grab_focus();
+m_xFtComment->set_label( m_xEdComment->get_text());
 m_xEdComment->hide();
 m_xFtComment->show();
 }
@@ -1600,13 +1618,22 @@ IMPL_LINK_NOARG(SvxNumberFormatTabPage, 
LostFocusHdl_Impl, weld::Widget&, void)
 {
 if (!pNumFmtShell)
 return;
-m_xFtComment->set_label(m_xEdComment->get_text());
+
+const bool bAddSensitive = m_xIbAdd->get_sensitive();
+if (bAddSensitive || m_nLbFormatSelPosEdComment != SELPOS_NONE)
+// Comment editing was possible.
+m_xFtComment->set_label(m_xEdComment->get_text());
+
 m_xEdComment->hide();
 m_xFtComment->show();
-if(!m_xIbAdd->get_sensitive())
+if (m_nLbFormatSelPosEdComment != SELPOS_NONE)
+{
+// Save edited comment of existing format.
+pNumFmtShell->SetComment4Entry( m_nLbFormatSelPosEdComment, 
m_xEdComment->get_text());
+m_nLbFormatSelPosEdComment = SELPOS_NONE;
+}
+if (!bAddSensitive)
 {
-sal_uInt16 nSelPos = m_xLbFormat->get_sele

[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - formula/source sc/inc sc/source

2020-09-30 Thread Eike Rathke (via logerrit)
 formula/source/core/api/FormulaCompiler.cxx |   19 +-
 sc/inc/compiler.hxx |   10 ++-
 sc/source/core/tool/compiler.cxx|   82 
 3 files changed, 83 insertions(+), 28 deletions(-)

New commits:
commit 30d3ae0268290e6244e58c78b8f45ae7373c47ea
Author: Eike Rathke 
AuthorDate: Mon Sep 28 21:02:23 2020 +0200
Commit: Xisco Fauli 
CommitDate: Wed Sep 30 14:04:32 2020 +0200

Resolves: tdf#137091 Use CharClass matching the formula language

 This is a combination of 3 commits.

Resolves: tdf#137091 Use CharClass matching the formula language

... not the current locale. Specifically important for
uppercase/lowercase conversions that may yield different results
for example in Turkish i with/without dot.

I2aa57cdcf530d7a0697c4ffbd5dccb86bb526d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103588
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 3c6177be2705303044e3de262689d593f3d0f282)
Signed-off-by: Xisco Fauli 

Current sytem locale's CharClass for user defined names, tdf#137091 
follow-up

I5f025a12ca183acb3f80d2a7527677aceb9ffbd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103593
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit d41c45a522c5e973d7043d36bc6c82e77735ab9b)

Determine CharClass difference once, tdf#137091 follow-up

As a side note:
Clang plugin simplifybool for
!(rLT1.getLanguage() == "en" && rLT2.getLanguage() == "en")
told "error: logical negation of logical op containing negation, can be 
simplified"
which is nonsense (the message stayed the same while the checks evolved).
It actually complained about !(a==b && c==d) to be rewritten as
(a!=b || c!=d) whether that makes sense or not.. it may save one
boolean operation, yes, but..

Ib478d46d7ff926c1c9f65fec059c7a3f31fa7ce3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103601
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 1acf517906b7cdc4931dd26319d467dff53ae7d2)

 Conflicts:
sc/source/core/tool/compiler.cxx

Change-Id: I2aa57cdcf530d7a0697c4ffbd5dccb86bb526d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103598
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index e6a224fa93a7..e969ecba4344 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -29,6 +29,9 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -140,6 +143,14 @@ void lclPushOpCodeMapEntries( ::std::vector< 
sheet::FormulaOpCodeMapEntry >& rVe
 lclPushOpCodeMapEntry( rVec, pTable, *pnOpCodes );
 }
 
+CharClass* createCharClassIfNonEnglishUI()
+{
+const LanguageTag& rLanguageTag( 
Application::GetSettings().GetUILanguageTag());
+if (rLanguageTag.getLanguage() == "en")
+return nullptr;
+return new CharClass( ::comphelper::getProcessComponentContext(), 
rLanguageTag);
+}
+
 class OpCodeList
 {
 public:
@@ -163,8 +174,8 @@ OpCodeList::OpCodeList(bool bLocalized, const 
std::pair* pSymb
 , mpSymbols(pSymbols)
 , mbLocalized(bLocalized)
 {
-SvtSysLocale aSysLocale;
-const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : 
aSysLocale.GetCharClassPtr());
+std::unique_ptr xCharClass( xMap->isEnglish() ? nullptr : 
createCharClassIfNonEnglishUI());
+const CharClass* pCharClass = xCharClass.get();
 if (meSepType == FormulaCompiler::SeparatorType::RESOURCE_BASE)
 {
 for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i)
@@ -809,8 +820,8 @@ FormulaCompiler::OpCodeMapPtr 
FormulaCompiler::CreateOpCodeMap(
 NonConstOpCodeMapPtr xMap = std::make_shared( 
SC_OPCODE_LAST_OPCODE_ID + 1, false,
 FormulaGrammar::mergeToGrammar( FormulaGrammar::setEnglishBit(
 FormulaGrammar::GRAM_EXTERNAL, bEnglish), 
FormulaGrammar::CONV_UNSPECIFIED));
-SvtSysLocale aSysLocale;
-const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : 
aSysLocale.GetCharClassPtr());
+std::unique_ptr xCharClass( xMap->isEnglish() ? nullptr : 
createCharClassIfNonEnglishUI());
+const CharClass* pCharClass = xCharClass.get();
 for (auto const& rMapEntry : rMapping)
 {
 OpCode eOp = OpCode(rMapEntry.Token.OpCode);
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index 91933ae7865c..a428721658fd 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -254,7 +254,8 @@ public:
 
 private:
 
-static CharClass*pCharClassEnglish;  // 
character classification for en_US locale
+s

[Libreoffice-commits] core.git: sc/inc sc/source

2020-09-29 Thread Eike Rathke (via logerrit)
 sc/inc/compiler.hxx  |1 +
 sc/source/core/tool/compiler.cxx |   16 +++-
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 1acf517906b7cdc4931dd26319d467dff53ae7d2
Author: Eike Rathke 
AuthorDate: Tue Sep 29 11:23:41 2020 +0200
Commit: Eike Rathke 
CommitDate: Tue Sep 29 21:44:38 2020 +0200

Determine CharClass difference once, tdf#137091 follow-up

As a side note:
Clang plugin simplifybool for
!(rLT1.getLanguage() == "en" && rLT2.getLanguage() == "en")
told "error: logical negation of logical op containing negation, can be 
simplified"
which is nonsense (the message stayed the same while the checks evolved).
It actually complained about !(a==b && c==d) to be rewritten as
(a!=b || c!=d) whether that makes sense or not.. it may save one
boolean operation, yes, but..

Change-Id: Ib478d46d7ff926c1c9f65fec059c7a3f31fa7ce3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103601
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index c4550a2ae3f6..a8ea757922b1 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -287,6 +287,7 @@ private:
 std::queue maPendingOpCodes; // additional opcodes generated from 
a single symbol
 
 const CharClass* pCharClass; // which character classification is used for 
parseAnyToken and upper/lower
+boolmbCharClassesDiffer;// whether pCharClass and current 
system locale's CharClass differ
 sal_uInt16  mnPredetectedReference; // reference when reading ODF, 
0 (none), 1 (single) or 2 (double)
 sal_Int32   mnRangeOpPosInSymbol;   // if and where a range operator 
is in symbol
 const Convention *pConv;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index f4967ec2381f..98ff152e30a9 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -294,6 +294,16 @@ void ScCompiler::SetFormulaLanguage( const 
ScCompiler::OpCodeMapPtr & xMap )
 pCharClass = GetCharClassEnglish();
 else
 pCharClass = GetCharClassLocalized();
+
+// The difference is needed for an uppercase() call that usually does not
+// result in different strings but for a few languages like Turkish;
+// though even de-DE and de-CH may differ in ß/SS handling..
+// At least don't care if both are English.
+// The current locale is more likely to not be "en" so check first.
+const LanguageTag& rLT1 = ScGlobal::getCharClassPtr()->getLanguageTag();
+const LanguageTag& rLT2 = pCharClass->getLanguageTag();
+mbCharClassesDiffer = (rLT1 != rLT2 && (rLT1.getLanguage() != "en" || 
rLT2.getLanguage() != "en"));
+
 SetGrammarAndRefConvention( mxSymbols->getGrammar(), GetGrammar());
 }
 
@@ -1832,6 +1842,7 @@ ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, 
const ScAddress& rPos,
 mnCurrentSheetTab(-1),
 mnCurrentSheetEndPos(0),
 pCharClass(ScGlobal::getCharClassPtr()),
+mbCharClassesDiffer(false),
 mnPredetectedReference(0),
 mnRangeOpPosInSymbol(-1),
 pConv(GetRefConvention(FormulaGrammar::CONV_OOO)),
@@ -1855,6 +1866,7 @@ ScCompiler::ScCompiler( ScDocument& rDocument, const 
ScAddress& rPos, ScTokenArr
 mnCurrentSheetEndPos(0),
 nSrcPos(0),
 pCharClass( ScGlobal::getCharClassPtr() ),
+mbCharClassesDiffer(false),
 mnPredetectedReference(0),
 mnRangeOpPosInSymbol(-1),
 pConv( GetRefConvention( FormulaGrammar::CONV_OOO ) ),
@@ -1877,6 +1889,7 @@ ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, 
const ScAddress& rPos,
 mnCurrentSheetTab(-1),
 mnCurrentSheetEndPos(0),
 pCharClass(ScGlobal::getCharClassPtr()),
+mbCharClassesDiffer(false),
 mnPredetectedReference(0),
 mnRangeOpPosInSymbol(-1),
 pConv(GetRefConvention(FormulaGrammar::CONV_OOO)),
@@ -1900,6 +1913,7 @@ ScCompiler::ScCompiler( ScDocument& rDocument, const 
ScAddress& rPos,
 mnCurrentSheetEndPos(0),
 nSrcPos(0),
 pCharClass( ScGlobal::getCharClassPtr() ),
+mbCharClassesDiffer(false),
 mnPredetectedReference(0),
 mnRangeOpPosInSymbol(-1),
 pConv( GetRefConvention( FormulaGrammar::CONV_OOO ) ),
@@ -4411,7 +4425,7 @@ bool ScCompiler::NextNewToken( bool bInArray )
 return true;
 
 // User defined names and such do need i18n upper also in ODF.
-if (bAsciiUpper || pCharClass->getLanguageTag() != 
ScGlobal::getCharClassPtr()->getLanguageTag())
+if (bAsciiUpper || mbCharClassesDiffer)
 {
 // Use current system locale here because user defined symbols are
 // more likely in that localized language than in the formula
__

[Libreoffice-commits] core.git: sc/source

2020-09-28 Thread Eike Rathke (via logerrit)
 sc/source/core/tool/compiler.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit d41c45a522c5e973d7043d36bc6c82e77735ab9b
Author: Eike Rathke 
AuthorDate: Tue Sep 29 01:31:39 2020 +0200
Commit: Eike Rathke 
CommitDate: Tue Sep 29 02:21:55 2020 +0200

Current sytem locale's CharClass for user defined names, tdf#137091 
follow-up

Change-Id: I5f025a12ca183acb3f80d2a7527677aceb9ffbd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103593
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 2050a2100579..f4967ec2381f 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4411,8 +4411,14 @@ bool ScCompiler::NextNewToken( bool bInArray )
 return true;
 
 // User defined names and such do need i18n upper also in ODF.
-if (bAsciiUpper)
-aUpper = pCharClass->uppercase( aOrg );
+if (bAsciiUpper || pCharClass->getLanguageTag() != 
ScGlobal::getCharClassPtr()->getLanguageTag())
+{
+// Use current system locale here because user defined symbols are
+// more likely in that localized language than in the formula
+// language. This in corner cases needs to continue to work for
+// existing documents and environments.
+aUpper = ScGlobal::getCharClassPtr()->uppercase( aOrg );
+}
 
 if (IsNamedRange( aUpper ))
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/inc sc/source

2020-09-28 Thread Eike Rathke (via logerrit)
 formula/source/core/api/FormulaCompiler.cxx |   19 ++--
 sc/inc/compiler.hxx |9 ++--
 sc/source/core/tool/compiler.cxx|   62 ++--
 3 files changed, 62 insertions(+), 28 deletions(-)

New commits:
commit 3c6177be2705303044e3de262689d593f3d0f282
Author: Eike Rathke 
AuthorDate: Mon Sep 28 21:02:23 2020 +0200
Commit: Eike Rathke 
CommitDate: Tue Sep 29 00:54:12 2020 +0200

Resolves: tdf#137091 Use CharClass matching the formula language

... not the current locale. Specifically important for
uppercase/lowercase conversions that may yield different results
for example in Turkish i with/without dot.

Change-Id: I2aa57cdcf530d7a0697c4ffbd5dccb86bb526d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103588
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index e6a224fa93a7..e969ecba4344 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -29,6 +29,9 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -140,6 +143,14 @@ void lclPushOpCodeMapEntries( ::std::vector< 
sheet::FormulaOpCodeMapEntry >& rVe
 lclPushOpCodeMapEntry( rVec, pTable, *pnOpCodes );
 }
 
+CharClass* createCharClassIfNonEnglishUI()
+{
+const LanguageTag& rLanguageTag( 
Application::GetSettings().GetUILanguageTag());
+if (rLanguageTag.getLanguage() == "en")
+return nullptr;
+return new CharClass( ::comphelper::getProcessComponentContext(), 
rLanguageTag);
+}
+
 class OpCodeList
 {
 public:
@@ -163,8 +174,8 @@ OpCodeList::OpCodeList(bool bLocalized, const 
std::pair* pSymb
 , mpSymbols(pSymbols)
 , mbLocalized(bLocalized)
 {
-SvtSysLocale aSysLocale;
-const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : 
aSysLocale.GetCharClassPtr());
+std::unique_ptr xCharClass( xMap->isEnglish() ? nullptr : 
createCharClassIfNonEnglishUI());
+const CharClass* pCharClass = xCharClass.get();
 if (meSepType == FormulaCompiler::SeparatorType::RESOURCE_BASE)
 {
 for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i)
@@ -809,8 +820,8 @@ FormulaCompiler::OpCodeMapPtr 
FormulaCompiler::CreateOpCodeMap(
 NonConstOpCodeMapPtr xMap = std::make_shared( 
SC_OPCODE_LAST_OPCODE_ID + 1, false,
 FormulaGrammar::mergeToGrammar( FormulaGrammar::setEnglishBit(
 FormulaGrammar::GRAM_EXTERNAL, bEnglish), 
FormulaGrammar::CONV_UNSPECIFIED));
-SvtSysLocale aSysLocale;
-const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : 
aSysLocale.GetCharClassPtr());
+std::unique_ptr xCharClass( xMap->isEnglish() ? nullptr : 
createCharClassIfNonEnglishUI());
+const CharClass* pCharClass = xCharClass.get();
 for (auto const& rMapEntry : rMapping)
 {
 OpCode eOp = OpCode(rMapEntry.Token.OpCode);
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index b09bce06797d..c4550a2ae3f6 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -254,7 +254,8 @@ public:
 
 private:
 
-static CharClass*pCharClassEnglish;  // 
character classification for en_US locale
+static const CharClass  *pCharClassEnglish; // character 
classification for en_US locale
+static const CharClass  *pCharClassLocalized;   // character 
classification for UI locale
 static const Convention *pConventions[ 
formula::FormulaGrammar::CONV_LAST ];
 
 static const struct AddInMap
@@ -285,7 +286,7 @@ private:
 
 std::queue maPendingOpCodes; // additional opcodes generated from 
a single symbol
 
-const CharClass*pCharClass; // which character classification 
is used for parseAnyToken
+const CharClass* pCharClass; // which character classification is used for 
parseAnyToken and upper/lower
 sal_uInt16  mnPredetectedReference; // reference when reading ODF, 
0 (none), 1 (single) or 2 (double)
 sal_Int32   mnRangeOpPosInSymbol;   // if and where a range operator 
is in symbol
 const Convention *pConv;
@@ -322,6 +323,7 @@ private:
 #endif
 
 bool   NextNewToken(bool bInArray);
+bool ToUpperAsciiOrI18nIsAscii( OUString& rUpper, const OUString& rOrg ) 
const;
 
 virtual void SetError(FormulaError nError) override;
 sal_Int32 NextSymbol(bool bInArray);
@@ -352,7 +354,8 @@ private:
  */
 ScRangeData* GetRangeData( const formula::FormulaToken& pToken ) const;
 
-static void InitCharClassEnglish();
+static const CharClass* GetCharClassEnglish();
+static const CharClass* GetCharClassLocalized();
 
 public:
 ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos,
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compi

[Libreoffice-commits] core.git: Branch 'libreoffice-7-0-2' - sc/qa sc/res

2020-09-28 Thread Eike Rathke (via logerrit)
 sc/qa/extras/scstylefamilyobj.cxx |6 +-
 sc/res/xml/styles.xml |4 
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit d93051cba341a73fe389e7471fc60d46da3aa1fe
Author: Eike Rathke 
AuthorDate: Sun Sep 27 20:37:34 2020 +0200
Commit: Xisco Fauli 
CommitDate: Mon Sep 28 21:03:59 2020 +0200

Resolves: tdf#133812 Add the 'Result' style again used by the Subtotal tool

Necessary to also adapt the test case that checks for a defined
number of styles.

Regression from

commit 7b0aed617f1e57335837cf56ef2d222a96f8270d
CommitDate: Wed Sep 28 11:42:56 2016 +

Remove old cell styles from calc

and

commit 06f319937187f76ee402d53b3baa78c391c2af19
CommitDate: Sun Oct 2 13:51:26 2016 +

tdf#90937 Add a set of cell styles to calc

Change-Id: I3e47d8e24d375a64d9056e7a85197b89173c8e41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103520
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 930d82550863430c9bef96ac307c3ff2cfefe4d8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103432
Reviewed-by: Caolán McNamara 
(cherry picked from commit 4cabc8e6574feb08cd7b80de9bc59c1c8f1797c3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103442
Reviewed-by: Markus Mohrhard 
Reviewed-by: Xisco Fauli 
Tested-by: Xisco Fauli 

diff --git a/sc/qa/extras/scstylefamilyobj.cxx 
b/sc/qa/extras/scstylefamilyobj.cxx
index a5843a8f3a1f..8597d22b0f71 100644
--- a/sc/qa/extras/scstylefamilyobj.cxx
+++ b/sc/qa/extras/scstylefamilyobj.cxx
@@ -83,10 +83,14 @@ private:
 uno::Reference m_xComponent;
 };
 
+/* TODO: this c/should be derived/defined from the real style count, default
+ * implemented plus sc/res/xml/styles.xml */
+constexpr sal_Int32 kScStyleFamilyObjCount = 20;
+
 ScStyleFamilyObj::ScStyleFamilyObj()
 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
 , XElementAccess(cppu::UnoType::get())
-, XIndexAccess(19)
+, XIndexAccess(kScStyleFamilyObjCount)
 , XNameAccess("ScStyleFamilyObj")
 , XNameContainer("ScStyleFamilyObj")
 , XNameReplace("ScStyleFamilyObj")
diff --git a/sc/res/xml/styles.xml b/sc/res/xml/styles.xml
index 9bfda940c3d9..d1d1a750e241 100644
--- a/sc/res/xml/styles.xml
+++ b/sc/res/xml/styles.xml
@@ -57,4 +57,8 @@
 
 
 
+
+
+
+
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4-7' - sc/qa sc/res

2020-09-28 Thread Eike Rathke (via logerrit)
 sc/qa/extras/scstylefamilyobj.cxx |6 +-
 sc/res/xml/styles.xml |4 
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 7393de6da11104062098cd04968c7c1f469efea9
Author: Eike Rathke 
AuthorDate: Sun Sep 27 20:37:34 2020 +0200
Commit: Markus Mohrhard 
CommitDate: Mon Sep 28 20:58:17 2020 +0200

Resolves: tdf#133812 Add the 'Result' style again used by the Subtotal tool

Necessary to also adapt the test case that checks for a defined
number of styles.

Regression from

commit 7b0aed617f1e57335837cf56ef2d222a96f8270d
CommitDate: Wed Sep 28 11:42:56 2016 +

Remove old cell styles from calc

and

commit 06f319937187f76ee402d53b3baa78c391c2af19
CommitDate: Sun Oct 2 13:51:26 2016 +

tdf#90937 Add a set of cell styles to calc

Change-Id: I3e47d8e24d375a64d9056e7a85197b89173c8e41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103520
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 930d82550863430c9bef96ac307c3ff2cfefe4d8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103434
Reviewed-by: Michael Weghorn 
Reviewed-by: Xisco Fauli 
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/sc/qa/extras/scstylefamilyobj.cxx 
b/sc/qa/extras/scstylefamilyobj.cxx
index fe5d8fb2ec19..6f8965c20bd9 100644
--- a/sc/qa/extras/scstylefamilyobj.cxx
+++ b/sc/qa/extras/scstylefamilyobj.cxx
@@ -83,10 +83,14 @@ private:
 uno::Reference m_xComponent;
 };
 
+/* TODO: this c/should be derived/defined from the real style count, default
+ * implemented plus sc/res/xml/styles.xml */
+constexpr sal_Int32 kScStyleFamilyObjCount = 20;
+
 ScStyleFamilyObj::ScStyleFamilyObj()
 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
 , XElementAccess(cppu::UnoType::get())
-, XIndexAccess(19)
+, XIndexAccess(kScStyleFamilyObjCount)
 , XNameAccess("ScStyleFamilyObj")
 , XNameContainer("ScStyleFamilyObj")
 , XNameReplace("ScStyleFamilyObj")
diff --git a/sc/res/xml/styles.xml b/sc/res/xml/styles.xml
index 9bfda940c3d9..d1d1a750e241 100644
--- a/sc/res/xml/styles.xml
+++ b/sc/res/xml/styles.xml
@@ -57,4 +57,8 @@
 
 
 
+
+
+
+
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sc/qa sc/res

2020-09-28 Thread Eike Rathke (via logerrit)
 sc/qa/extras/scstylefamilyobj.cxx |6 +-
 sc/res/xml/styles.xml |4 
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 916cefa8e3b785489a9ef09cf4c5c6af09bed82d
Author: Eike Rathke 
AuthorDate: Sun Sep 27 20:37:34 2020 +0200
Commit: Xisco Fauli 
CommitDate: Mon Sep 28 19:09:40 2020 +0200

Resolves: tdf#133812 Add the 'Result' style again used by the Subtotal tool

Necessary to also adapt the test case that checks for a defined
number of styles.

Regression from

commit 7b0aed617f1e57335837cf56ef2d222a96f8270d
CommitDate: Wed Sep 28 11:42:56 2016 +

Remove old cell styles from calc

and

commit 06f319937187f76ee402d53b3baa78c391c2af19
CommitDate: Sun Oct 2 13:51:26 2016 +

tdf#90937 Add a set of cell styles to calc

Change-Id: I3e47d8e24d375a64d9056e7a85197b89173c8e41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103520
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 930d82550863430c9bef96ac307c3ff2cfefe4d8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103433
Reviewed-by: Michael Weghorn 
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/extras/scstylefamilyobj.cxx 
b/sc/qa/extras/scstylefamilyobj.cxx
index fe5d8fb2ec19..6f8965c20bd9 100644
--- a/sc/qa/extras/scstylefamilyobj.cxx
+++ b/sc/qa/extras/scstylefamilyobj.cxx
@@ -83,10 +83,14 @@ private:
 uno::Reference m_xComponent;
 };
 
+/* TODO: this c/should be derived/defined from the real style count, default
+ * implemented plus sc/res/xml/styles.xml */
+constexpr sal_Int32 kScStyleFamilyObjCount = 20;
+
 ScStyleFamilyObj::ScStyleFamilyObj()
 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
 , XElementAccess(cppu::UnoType::get())
-, XIndexAccess(19)
+, XIndexAccess(kScStyleFamilyObjCount)
 , XNameAccess("ScStyleFamilyObj")
 , XNameContainer("ScStyleFamilyObj")
 , XNameReplace("ScStyleFamilyObj")
diff --git a/sc/res/xml/styles.xml b/sc/res/xml/styles.xml
index 9bfda940c3d9..d1d1a750e241 100644
--- a/sc/res/xml/styles.xml
+++ b/sc/res/xml/styles.xml
@@ -57,4 +57,8 @@
 
 
 
+
+
+
+
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/source

2020-09-28 Thread Eike Rathke (via logerrit)
 sc/source/core/data/documen3.cxx |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit 6d9652e2864a020b61f26a7b51ca908f1d9790a8
Author: Eike Rathke 
AuthorDate: Sun Sep 27 14:51:50 2020 +0200
Commit: Xisco Fauli 
CommitDate: Mon Sep 28 14:17:39 2020 +0200

Resolves: tdf#67007 display sheet-local range name in Name Box for selection

Change-Id: Ia9980b13ed5c93cc72231ead532e3916e6234f56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103509
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit d3a8fdf3cad0e71ff5e13bb229fed6e52206c6b9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103430
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 33c9a2b5665b..f34389e9fe35 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -239,6 +239,20 @@ bool ScDocument::InsertNewRangeName( SCTAB nTab, const 
OUString& rName, const Sc
 const ScRangeData* ScDocument::GetRangeAtBlock( const ScRange& rBlock, 
OUString* pName ) const
 {
 const ScRangeData* pData = nullptr;
+if (rBlock.aStart.Tab() == rBlock.aEnd.Tab())
+{
+const ScRangeName* pLocalNames = GetRangeName(rBlock.aStart.Tab());
+if (pLocalNames)
+{
+pData = pLocalNames->findByRange( rBlock );
+if (pData)
+{
+if (pName)
+*pName = pData->GetName();
+return pData;
+}
+}
+}
 if ( pRangeName )
 {
 pData = pRangeName->findByRange( rBlock );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/qa sc/res

2020-09-28 Thread Eike Rathke (via logerrit)
 sc/qa/extras/scstylefamilyobj.cxx |6 +-
 sc/res/xml/styles.xml |4 
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 4cabc8e6574feb08cd7b80de9bc59c1c8f1797c3
Author: Eike Rathke 
AuthorDate: Sun Sep 27 20:37:34 2020 +0200
Commit: Caolán McNamara 
CommitDate: Mon Sep 28 12:49:57 2020 +0200

Resolves: tdf#133812 Add the 'Result' style again used by the Subtotal tool

Necessary to also adapt the test case that checks for a defined
number of styles.

Regression from

commit 7b0aed617f1e57335837cf56ef2d222a96f8270d
CommitDate: Wed Sep 28 11:42:56 2016 +

Remove old cell styles from calc

and

commit 06f319937187f76ee402d53b3baa78c391c2af19
CommitDate: Sun Oct 2 13:51:26 2016 +

tdf#90937 Add a set of cell styles to calc

Change-Id: I3e47d8e24d375a64d9056e7a85197b89173c8e41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103520
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 930d82550863430c9bef96ac307c3ff2cfefe4d8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103432
Reviewed-by: Caolán McNamara 

diff --git a/sc/qa/extras/scstylefamilyobj.cxx 
b/sc/qa/extras/scstylefamilyobj.cxx
index a5843a8f3a1f..8597d22b0f71 100644
--- a/sc/qa/extras/scstylefamilyobj.cxx
+++ b/sc/qa/extras/scstylefamilyobj.cxx
@@ -83,10 +83,14 @@ private:
 uno::Reference m_xComponent;
 };
 
+/* TODO: this c/should be derived/defined from the real style count, default
+ * implemented plus sc/res/xml/styles.xml */
+constexpr sal_Int32 kScStyleFamilyObjCount = 20;
+
 ScStyleFamilyObj::ScStyleFamilyObj()
 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
 , XElementAccess(cppu::UnoType::get())
-, XIndexAccess(19)
+, XIndexAccess(kScStyleFamilyObjCount)
 , XNameAccess("ScStyleFamilyObj")
 , XNameContainer("ScStyleFamilyObj")
 , XNameReplace("ScStyleFamilyObj")
diff --git a/sc/res/xml/styles.xml b/sc/res/xml/styles.xml
index 9bfda940c3d9..d1d1a750e241 100644
--- a/sc/res/xml/styles.xml
+++ b/sc/res/xml/styles.xml
@@ -57,4 +57,8 @@
 
 
 
+
+
+
+
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sc/qa sc/res

2020-09-27 Thread Eike Rathke (via logerrit)
 sc/qa/extras/scstylefamilyobj.cxx |6 +-
 sc/res/xml/styles.xml |4 
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 930d82550863430c9bef96ac307c3ff2cfefe4d8
Author: Eike Rathke 
AuthorDate: Sun Sep 27 20:37:34 2020 +0200
Commit: Eike Rathke 
CommitDate: Mon Sep 28 02:52:50 2020 +0200

Resolves: tdf#133812 Add the 'Result' style again used by the Subtotal tool

Necessary to also adapt the test case that checks for a defined
number of styles.

Regression from

commit 7b0aed617f1e57335837cf56ef2d222a96f8270d
CommitDate: Wed Sep 28 11:42:56 2016 +

Remove old cell styles from calc

and

commit 06f319937187f76ee402d53b3baa78c391c2af19
CommitDate: Sun Oct 2 13:51:26 2016 +

tdf#90937 Add a set of cell styles to calc

Change-Id: I3e47d8e24d375a64d9056e7a85197b89173c8e41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103520
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/extras/scstylefamilyobj.cxx 
b/sc/qa/extras/scstylefamilyobj.cxx
index a5843a8f3a1f..8597d22b0f71 100644
--- a/sc/qa/extras/scstylefamilyobj.cxx
+++ b/sc/qa/extras/scstylefamilyobj.cxx
@@ -83,10 +83,14 @@ private:
 uno::Reference m_xComponent;
 };
 
+/* TODO: this c/should be derived/defined from the real style count, default
+ * implemented plus sc/res/xml/styles.xml */
+constexpr sal_Int32 kScStyleFamilyObjCount = 20;
+
 ScStyleFamilyObj::ScStyleFamilyObj()
 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
 , XElementAccess(cppu::UnoType::get())
-, XIndexAccess(19)
+, XIndexAccess(kScStyleFamilyObjCount)
 , XNameAccess("ScStyleFamilyObj")
 , XNameContainer("ScStyleFamilyObj")
 , XNameReplace("ScStyleFamilyObj")
diff --git a/sc/res/xml/styles.xml b/sc/res/xml/styles.xml
index 9bfda940c3d9..d1d1a750e241 100644
--- a/sc/res/xml/styles.xml
+++ b/sc/res/xml/styles.xml
@@ -57,4 +57,8 @@
 
 
 
+
+
+
+
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - i18npool/Library_localedata_others.mk i18npool/source

2020-09-27 Thread Eike Rathke (via logerrit)
 i18npool/Library_localedata_others.mk |1 
 i18npool/source/localedata/data/en_HK.xml |   34 ++
 i18npool/source/localedata/localedata.cxx |1 
 3 files changed, 36 insertions(+)

New commits:
commit 37352332a3b6e6d068ce77b46f616e0b752e3ba8
Author: Eike Rathke 
AuthorDate: Fri Aug 21 11:51:44 2020 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Sep 28 02:09:43 2020 +0200

Resolves: tdf#135518 Add English (Hong Kong) [en-HK] locale data

Inherited from en-GB, zh-HK

Change-Id: I966d19cfa2da26d3d882af35afe79a2f77eaffa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101139
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit 5dffb7ba361ad76aa249d6c93fd87fff67362726)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103328
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/i18npool/Library_localedata_others.mk 
b/i18npool/Library_localedata_others.mk
index f1cb28820c6d..cece0e15fc30 100644
--- a/i18npool/Library_localedata_others.mk
+++ b/i18npool/Library_localedata_others.mk
@@ -50,6 +50,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,localedata_others,\
CustomTarget/i18npool/localedata/localedata_dz_BT \
CustomTarget/i18npool/localedata/localedata_ebo_CG \
CustomTarget/i18npool/localedata/localedata_ee_GH \
+   CustomTarget/i18npool/localedata/localedata_en_HK \
CustomTarget/i18npool/localedata/localedata_en_IN \
CustomTarget/i18npool/localedata/localedata_en_KE \
CustomTarget/i18npool/localedata/localedata_en_MY \
diff --git a/i18npool/source/localedata/data/en_HK.xml 
b/i18npool/source/localedata/data/en_HK.xml
new file mode 100644
index ..e0d913b912ac
--- /dev/null
+++ b/i18npool/source/localedata/data/en_HK.xml
@@ -0,0 +1,34 @@
+
+
+
+
+  
+
+  en
+  English
+
+
+  HK
+  Hong Kong
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+
diff --git a/i18npool/source/localedata/localedata.cxx 
b/i18npool/source/localedata/localedata.cxx
index a0fbd8361068..a25c391ac927 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -201,6 +201,7 @@ static const struct {
 { "zh_SG",  lcl_DATA_OTHERS },
 { "zh_TW",  lcl_DATA_OTHERS },
 { "zh_MO",  lcl_DATA_OTHERS },
+{ "en_HK",  lcl_DATA_OTHERS },  // needs to be in OTHERS instead of EN 
because currency inherited from zh_HK
 
 { "ar_EG",  lcl_DATA_OTHERS },
 { "ar_DZ",  lcl_DATA_OTHERS },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


<    5   6   7   8   9   10   11   12   13   14   >