include/svl/numformat.hxx        |    2 +-
 sc/inc/cellform.hxx              |    7 ++++---
 sc/inc/column.hxx                |   10 +++++-----
 sc/inc/document.hxx              |    2 +-
 sc/inc/table.hxx                 |    2 +-
 sc/source/core/data/column3.cxx  |    4 ++--
 sc/source/core/data/document.cxx |    4 ++--
 sc/source/core/data/table2.cxx   |    4 ++--
 sc/source/core/tool/cellform.cxx |    6 +++---
 sc/source/ui/view/cellsh1.cxx    |    7 ++++---
 svl/source/numbers/zforlist.cxx  |    5 +++--
 11 files changed, 28 insertions(+), 25 deletions(-)

New commits:
commit a88419f54b8aa9c23cd80e04bc47f1b5ef3931ca
Author:     Daniel Kamil Kozar <dkk...@gmail.com>
AuthorDate: Tue May 3 02:45:13 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri May 6 14:16:12 2022 +0200

    tdf#148383: Obtain start/end strings always in system locale
    
    ScFillSeriesDlg always expects the strings describing the start and end 
values
    to be in the system locale. This change ensures that and fixes the bug where
    using non-locale-default data in the Fill Series dialog leads to an error.
    
    Change-Id: I25eafa2174294dc35a63473a54c529c2d7bd87ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132532
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx
index 2187810229aa..dc1c704d364d 100644
--- a/include/svl/numformat.hxx
+++ b/include/svl/numformat.hxx
@@ -203,7 +203,7 @@ public:
         in the filtering condition now), instead of the EditFormat string
         (e.g a not rounded value, which is visible during editing).*/
     void GetInputLineString(const double& fOutNumber, sal_uInt32 nFIndex, 
OUString& rOutString,
-                            bool bFiltering = false);
+                            bool bFiltering = false, bool bForceSystemLocale = 
false);
 
     /** Format a number according to a format code string to be scanned.
         @return
diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index cd9b28f7692c..7fb072ee8578 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -46,13 +46,14 @@ public:
     // Note that if pShared is set and a value is returned that way, the 
returned OUString is empty.
     static OUString GetInputString(
         const ScRefCellValue& rCell, sal_uInt32 nFormat, SvNumberFormatter& 
rFormatter,
-        const ScDocument& rDoc, const svl::SharedString** pShared = nullptr, 
bool bFiltering = false );
+        const ScDocument& rDoc, const svl::SharedString** pShared = nullptr, 
bool bFiltering = false,
+        bool bForceSystemLocale = false );
 
     static OUString GetInputString(
         const ScRefCellValue& rCell, sal_uInt32 nFormat, SvNumberFormatter& 
rFormatter,
-        const ScDocument& rDoc, bool bFiltering)
+        const ScDocument& rDoc, bool bFiltering, bool bForceSystemLocale = 
false )
     {
-        return GetInputString( rCell, nFormat, rFormatter, rDoc, nullptr, 
bFiltering );
+        return GetInputString( rCell, nFormat, rFormatter, rDoc, nullptr, 
bFiltering, bForceSystemLocale );
     }
 
     static OUString GetOutputString(
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index ed9ce2e0c77c..3f0785429ca9 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -442,11 +442,11 @@ public:
         { return GetString( GetCellValue( rBlockPos, nRow ), nRow, pContext ); 
}
     double* GetValueCell( SCROW nRow );
     // Note that if pShared is set and a value is returned that way, the 
returned OUString is empty.
-    OUString    GetInputString( SCROW nRow, const svl::SharedString** pShared 
= nullptr ) const
-        { return GetInputString( GetCellValue( nRow ), nRow, pShared ); }
+    OUString    GetInputString( SCROW nRow, const svl::SharedString** pShared 
= nullptr, bool bForceSystemLocale = false ) const
+        { return GetInputString( GetCellValue( nRow ), nRow, pShared, 
bForceSystemLocale ); }
     OUString    GetInputString( sc::ColumnBlockConstPosition& rBlockPos, SCROW 
nRow,
-                    const svl::SharedString** pShared = nullptr ) const
-        { return GetInputString( GetCellValue( rBlockPos, nRow ), nRow, 
pShared ); }
+                    const svl::SharedString** pShared = nullptr, bool 
bForceSystemLocale = false ) const
+        { return GetInputString( GetCellValue( rBlockPos, nRow ), nRow, 
pShared, bForceSystemLocale ); }
     double      GetValue( SCROW nRow ) const;
     const EditTextObject* GetEditText( SCROW nRow ) const;
     void RemoveEditTextCharAttribs( SCROW nRow, const ScPatternAttr& rAttr );
@@ -822,7 +822,7 @@ private:
     SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
 
     OUString GetString( const ScRefCellValue& cell, SCROW nRow, const 
ScInterpreterContext* pContext = nullptr ) const;
-    OUString GetInputString( const ScRefCellValue& cell, SCROW nRow, const 
svl::SharedString** pShared = nullptr ) const;
+    OUString GetInputString( const ScRefCellValue& cell, SCROW nRow, const 
svl::SharedString** pShared = nullptr, bool bForceSystemLocale = false ) const;
 
     /**
      * Called whenever the state of cell array gets modified i.e. new cell
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5fb616b0076b..f83b021393f2 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1216,7 +1216,7 @@ public:
                                                   { 
mbFormulaGroupCxtBlockDiscard = block; }
 
     // Note that if pShared is set and a value is returned that way, the 
returned OUString is empty.
-    SC_DLLPUBLIC OUString                     GetInputString( SCCOL nCol, 
SCROW nRow, SCTAB nTab ) const;
+    SC_DLLPUBLIC OUString                     GetInputString( SCCOL nCol, 
SCROW nRow, SCTAB nTab, bool bForceSystemLocale = false ) const;
     FormulaError                              GetStringForFormula( const 
ScAddress& rPos, OUString& rString );
     SC_DLLPUBLIC double                       GetValue( const ScAddress& rPos 
) const;
     SC_DLLPUBLIC double                       GetValue( SCCOL nCol, SCROW 
nRow, SCTAB nTab ) const;
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7e2d8576a1ee..64b94b0995f0 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -450,7 +450,7 @@ public:
     OUString    GetString( SCCOL nCol, SCROW nRow, const ScInterpreterContext* 
pContext = nullptr ) const;
     double*     GetValueCell( SCCOL nCol, SCROW nRow );
     // Note that if pShared is set and a value is returned that way, the 
returned OUString is empty.
-    OUString    GetInputString( SCCOL nCol, SCROW nRow, const 
svl::SharedString** pShared = nullptr ) const;
+    OUString    GetInputString( SCCOL nCol, SCROW nRow, const 
svl::SharedString** pShared = nullptr, bool bForceSystemLocale = false ) const;
     double      GetValue( SCCOL nCol, SCROW nRow ) const;
     const EditTextObject* GetEditText( SCCOL nCol, SCROW nRow ) const;
     void RemoveEditTextCharAttribs( SCCOL nCol, SCROW nRow, const 
ScPatternAttr& rAttr );
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 795eb8aa2a31..48806d17a865 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -3049,10 +3049,10 @@ double* ScColumn::GetValueCell( SCROW nRow )
     return &sc::numeric_block::at(*it->data, aPos.second);
 }
 
-OUString ScColumn::GetInputString( const ScRefCellValue& aCell, SCROW nRow, 
const svl::SharedString** pShared ) const
+OUString ScColumn::GetInputString( const ScRefCellValue& aCell, SCROW nRow, 
const svl::SharedString** pShared, bool bForceSystemLocale ) const
 {
     sal_uLong nFormat = GetNumberFormat(GetDoc().GetNonThreadedContext(), 
nRow);
-    return ScCellFormat::GetInputString(aCell, nFormat, 
*(GetDoc().GetFormatTable()), GetDoc(), pShared);
+    return ScCellFormat::GetInputString(aCell, nFormat, 
*(GetDoc().GetFormatTable()), GetDoc(), pShared, false, bForceSystemLocale);
 }
 
 double ScColumn::GetValue( SCROW nRow ) const
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 7020095fddf2..5acd603f006e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3581,10 +3581,10 @@ void ScDocument::DiscardFormulaGroupContext()
         mpFormulaGroupCxt.reset();
 }
 
-OUString ScDocument::GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
+OUString ScDocument::GetInputString(SCCOL nCol, SCROW nRow, SCTAB nTab, bool 
bForceSystemLocale ) const
 {
     if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && 
maTabs[nTab] )
-        return maTabs[nTab]->GetInputString( nCol, nRow, nullptr );
+        return maTabs[nTab]->GetInputString( nCol, nRow, nullptr, 
bForceSystemLocale );
     else
         return OUString();
 }
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 55c11a3ce065..8670ae56e7a6 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1771,10 +1771,10 @@ double* ScTable::GetValueCell( SCCOL nCol, SCROW nRow )
     return CreateColumnIfNotExists(nCol).GetValueCell(nRow);
 }
 
-OUString ScTable::GetInputString( SCCOL nCol, SCROW nRow, const 
svl::SharedString** pShared ) const
+OUString ScTable::GetInputString( SCCOL nCol, SCROW nRow, const 
svl::SharedString** pShared, bool bForceSystemLocale ) const
 {
     if (ValidColRow(nCol, nRow) && nCol < GetAllocatedColumnsCount())
-        return aCol[nCol].GetInputString( nRow, pShared );
+        return aCol[nCol].GetInputString( nRow, pShared, bForceSystemLocale );
     else
         return OUString();
 }
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 629491baaa31..0dc6f03de4df 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -128,7 +128,7 @@ OUString ScCellFormat::GetString(
 
 OUString ScCellFormat::GetInputString(
     const ScRefCellValue& rCell, sal_uInt32 nFormat, SvNumberFormatter& 
rFormatter, const ScDocument& rDoc,
-    const svl::SharedString** pShared, bool bFiltering )
+    const svl::SharedString** pShared, bool bFiltering, bool 
bForceSystemLocale )
 {
     if(pShared != nullptr)
         *pShared = nullptr;
@@ -140,7 +140,7 @@ OUString ScCellFormat::GetInputString(
         case CELLTYPE_VALUE:
         {
             OUString str;
-            rFormatter.GetInputLineString(rCell.mfValue, nFormat, str, 
bFiltering);
+            rFormatter.GetInputLineString(rCell.mfValue, nFormat, str, 
bFiltering, bForceSystemLocale);
             return str;
         }
         break;
@@ -151,7 +151,7 @@ OUString ScCellFormat::GetInputString(
             if (pFC->IsEmptyDisplayedAsString())
                 ; // empty
             else if (pFC->IsValue())
-                rFormatter.GetInputLineString(pFC->GetValue(), nFormat, str, 
bFiltering);
+                rFormatter.GetInputLineString(pFC->GetValue(), nFormat, str, 
bFiltering, bForceSystemLocale);
             else
             {
                 const svl::SharedString& shared = pFC->GetString();
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 9234191e008c..1b1953b18e95 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -657,12 +657,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         double fInputEndVal = 0.0;
                         OUString aEndStr;
 
-                        aStartStr = rDoc.GetInputString( nStartCol, nStartRow, 
nStartTab );
+                        const bool forceSystemLocale = true;
+                        aStartStr = rDoc.GetInputString( nStartCol, nStartRow, 
nStartTab, forceSystemLocale );
                         fStartVal = rDoc.GetValue( nStartCol, nStartRow, 
nStartTab );
 
                         if(eFillDir==FILL_TO_BOTTOM && nStartRow < nEndRow )
                         {
-                            aEndStr = rDoc.GetInputString( nStartCol, 
nStartRow+1, nStartTab );
+                            aEndStr = rDoc.GetInputString( nStartCol, 
nStartRow+1, nStartTab, forceSystemLocale );
                             if(!aEndStr.isEmpty())
                             {
                                 fInputEndVal = rDoc.GetValue( nStartCol, 
nStartRow+1, nStartTab );
@@ -673,7 +674,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         {
                             if(nStartCol < nEndCol)
                             {
-                                aEndStr = rDoc.GetInputString( nStartCol+1, 
nStartRow, nStartTab );
+                                aEndStr = rDoc.GetInputString( nStartCol+1, 
nStartRow, nStartTab, forceSystemLocale );
                                 if(!aEndStr.isEmpty())
                                 {
                                     fInputEndVal = rDoc.GetValue( nStartCol+1, 
nStartRow, nStartTab );
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 1ea60fc81784..c1d45cc9bd60 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1676,7 +1676,7 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double 
fNumber, sal_uInt32 nFIndex,
 void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
                                            sal_uInt32 nFIndex,
                                            OUString& sOutString,
-                                           bool bFiltering)
+                                           bool bFiltering, bool 
bForceSystemLocale)
 {
     ::osl::MutexGuard aGuard( GetInstanceMutex() );
     const Color* pColor;
@@ -1716,7 +1716,8 @@ void SvNumberFormatter::GetInputLineString(const double& 
fOutNumber,
         bPrecChanged = true;
     }
 
-    sal_uInt32 nKey = GetEditFormat( fOutNumber, nRealKey, eType, pFormat);
+    sal_uInt32 nKey = GetEditFormat( fOutNumber, nRealKey, eType, pFormat,
+                                     bForceSystemLocale ? LANGUAGE_SYSTEM : 
LANGUAGE_DONTKNOW);
     // if bFiltering true keep the nRealKey format
     if ( nKey != nRealKey && !bFiltering )
     {

Reply via email to