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

Noel Grandin noel.grandin at collabora.co.uk
Fri Nov 24 06:59:49 UTC 2017


 sc/inc/cellform.hxx                          |    6 +++---
 sc/inc/conditio.hxx                          |    2 +-
 sc/inc/dociter.hxx                           |   14 +++++++-------
 sc/inc/document.hxx                          |    4 ++--
 sc/inc/dpgroup.hxx                           |    2 +-
 sc/inc/dpshttab.hxx                          |    2 +-
 sc/inc/dptabdat.hxx                          |    2 +-
 sc/inc/global.hxx                            |    2 +-
 sc/inc/patattr.hxx                           |    6 +++---
 sc/source/core/data/column2.cxx              |    2 +-
 sc/source/core/data/column3.cxx              |    8 ++++----
 sc/source/core/data/column4.cxx              |    2 +-
 sc/source/core/data/conditio.cxx             |    2 +-
 sc/source/core/data/dociter.cxx              |   10 +++++-----
 sc/source/core/data/documen6.cxx             |    4 ++--
 sc/source/core/data/document.cxx             |    2 +-
 sc/source/core/data/dpgroup.cxx              |    2 +-
 sc/source/core/data/dpshttab.cxx             |    2 +-
 sc/source/core/data/dptabdat.cxx             |    2 +-
 sc/source/core/data/dputil.cxx               |    4 ++--
 sc/source/core/data/formulacell.cxx          |    2 +-
 sc/source/core/data/global2.cxx              |    2 +-
 sc/source/core/data/patattr.cxx              |    8 ++++----
 sc/source/core/data/stlsheet.cxx             |    2 +-
 sc/source/core/data/table3.cxx               |    2 +-
 sc/source/core/data/table4.cxx               |    4 ++--
 sc/source/core/inc/interpre.hxx              |   20 ++++++++++----------
 sc/source/core/tool/cellform.cxx             |    8 ++++----
 sc/source/core/tool/chgtrack.cxx             |    2 +-
 sc/source/core/tool/interpr1.cxx             |    6 +++---
 sc/source/core/tool/interpr4.cxx             |   16 ++++++++--------
 sc/source/core/tool/interpr5.cxx             |    6 +++---
 sc/source/core/tool/interpr6.cxx             |    2 +-
 sc/source/core/tool/scmatrix.cxx             |    8 ++++----
 sc/source/filter/excel/xestyle.cxx           |   16 ++++++++--------
 sc/source/filter/excel/xicontent.cxx         |    2 +-
 sc/source/filter/excel/xistyle.cxx           |    6 +++---
 sc/source/filter/html/htmlexp.cxx            |    2 +-
 sc/source/filter/inc/numberformatsbuffer.hxx |   12 ++++++------
 sc/source/filter/inc/stylesbuffer.hxx        |    4 ++--
 sc/source/filter/inc/xestyle.hxx             |   14 +++++++-------
 sc/source/filter/inc/xistyle.hxx             |    4 ++--
 sc/source/filter/inc/xlstyle.hxx             |    4 ++--
 sc/source/filter/oox/numberformatsbuffer.cxx |   25 +++++++++++--------------
 sc/source/filter/oox/stylesbuffer.cxx        |    2 +-
 sc/source/filter/rtf/rtfexp.cxx              |    2 +-
 sc/source/filter/xml/xmlcelli.cxx            |    2 +-
 sc/source/filter/xml/xmlexprt.cxx            |    2 +-
 sc/source/ui/app/transobj.cxx                |    2 +-
 sc/source/ui/docshell/impex.cxx              |    2 +-
 sc/source/ui/unoobj/chart2uno.cxx            |    4 ++--
 sc/source/ui/unoobj/textuno.cxx              |    2 +-
 sc/source/ui/view/cellsh1.cxx                |    2 +-
 sc/source/ui/view/cellsh2.cxx                |    2 +-
 sc/source/ui/view/output2.cxx                |    4 ++--
 sc/source/ui/view/spelleng.cxx               |    2 +-
 56 files changed, 141 insertions(+), 144 deletions(-)

New commits:
commit a1c0e999b271ac4c6ecb163a1cd2a310b87e9dec
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Nov 23 17:30:42 2017 +0200

    consistently use sal_uInt32 for number formats in sc
    
    instead of a mix of short/sal_uLong/sal_uInt32
    
    Change-Id: Ie5bd26e1a6f716c0c4e174a6d560827084b3f421
    Reviewed-on: https://gerrit.libreoffice.org/45159
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index ff2bb8ae328b..37a2cebea216 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -35,17 +35,17 @@ class SC_DLLPUBLIC ScCellFormat
 public:
 
     static void GetString(
-        ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString,
+        ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString,
         Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument* pDoc, bool bNullVals = true,
         bool bFormula  = false, bool bUseStarFormat = false );
 
     static OUString GetString(
-        ScDocument& rDoc, const ScAddress& rPos, sal_uLong nFormat,
+        ScDocument& rDoc, const ScAddress& rPos, sal_uInt32 nFormat,
         Color** ppColor, SvNumberFormatter& rFormatter, bool bNullVals = true,
         bool bFormula  = false );
 
     static void GetInputString(
-        ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, SvNumberFormatter& rFormatter,
+        ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString, SvNumberFormatter& rFormatter,
         const ScDocument* pDoc );
 
     static OUString GetOutputString(
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 27acc6e0d668..79554b1a8d67 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -250,7 +250,7 @@ public:
     void            SetFormula1( const ScTokenArray& rArray );
     void            SetFormula2( const ScTokenArray& rArray );
 
-    OUString          GetExpression( const ScAddress& rCursor, sal_uInt16 nPos, sal_uLong nNumFmt = 0,
+    OUString          GetExpression( const ScAddress& rCursor, sal_uInt16 nPos, sal_uInt32 nNumFmt = 0,
                                     const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
 
                     /** Create a flat copy using ScTokenArray copy-ctor with
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 904f471c3c4f..6e8011438d73 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -53,8 +53,8 @@ class ScValueIterator            // walk through all values in an area
 
     ScDocument*     pDoc;
     const ScAttrArray*  pAttrArray;
-    sal_uLong           nNumFormat;     // for CalcAsShown
-    sal_uLong           nNumFmtIndex;
+    sal_uInt32      nNumFormat;     // for CalcAsShown
+    sal_uInt32      nNumFmtIndex;
     ScAddress       maStartPos;
     ScAddress       maEndPos;
     SCCOL           mnCol;
@@ -85,7 +85,7 @@ public:
         ScDocument* pDocument, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE,
         bool bTextAsZero = false );
 
-    void GetCurNumFmtInfo( const ScInterpreterContext& rContext, short& nType, sal_uLong& nIndex );
+    void GetCurNumFmtInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex );
 
     /// Does NOT reset rValue if no value found!
     bool GetFirst( double& rValue, FormulaError& rErr );
@@ -142,13 +142,13 @@ private:
         ScDocument*         mpDoc;
         const ScInterpreterContext& mrContext;
         const ScAttrArray*  pAttrArray;
-        sal_uLong               nNumFormat;     // for CalcAsShown
-        sal_uLong               nNumFmtIndex;
+        sal_uInt32          nNumFormat;     // for CalcAsShown
+        sal_uInt32          nNumFmtIndex;
         SCCOL               nCol;
         SCROW               nRow;
         SCROW               nAttrEndRow;
         SCTAB               nTab;
-        short               nNumFmtType;
+        sal_uInt32          nNumFmtType;
         bool                bCalcAsShown;
     };
 
@@ -454,7 +454,7 @@ private:
     const ScAttrArray        *pAttrArray;
     std::unique_ptr<ScHorizontalCellIterator>
                               pCellIter;
-    sal_uLong                 nNumFormat;     // for CalcAsShown
+    sal_uInt32                nNumFormat;     // for CalcAsShown
     SCTAB                     nEndTab;
     SCCOL                     nCurCol;
     SCROW                     nCurRow;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index bb7bad7652b2..321f4ebbc8e3 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1122,7 +1122,7 @@ public:
     SC_DLLPUBLIC sal_uInt32                   GetNumberFormat( const ScInterpreterContext& rContext, const ScAddress& ) const;
     void                                      SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberFormat );
 
-    void                                      GetNumberFormatInfo( const ScInterpreterContext& rContext, short& nType, sal_uLong& nIndex, const ScAddress& rPos ) const;
+    void                                      GetNumberFormatInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex, const ScAddress& rPos ) const;
     SC_DLLPUBLIC const ScFormulaCell*         GetFormulaCell( const ScAddress& rPos ) const;
     SC_DLLPUBLIC ScFormulaCell*               GetFormulaCell( const ScAddress& rPos );
     SC_DLLPUBLIC void                         GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rFormula ) const;
@@ -1628,7 +1628,7 @@ public:
     SC_DLLPUBLIC const css::uno::Reference< css::i18n::XBreakIterator >& GetBreakIterator();
     bool                        HasStringWeakCharacters( const OUString& rString );
     SC_DLLPUBLIC SvtScriptType  GetStringScriptType( const OUString& rString );
-    SC_DLLPUBLIC SvtScriptType  GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat );
+    SC_DLLPUBLIC SvtScriptType  GetCellScriptType( const ScAddress& rPos, sal_uInt32 nNumberFormat );
     SC_DLLPUBLIC SvtScriptType  GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab );
     SvtScriptType               GetRangeScriptType( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rPos, SCROW nLength );
     SvtScriptType               GetRangeScriptType( const ScRangeList& rRanges );
diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx
index 421d61f2b3e9..4c294b66aa5e 100644
--- a/sc/inc/dpgroup.hxx
+++ b/sc/inc/dpgroup.hxx
@@ -157,7 +157,7 @@ public:
     virtual OUString                getDimensionName(long nColumn) override;
     virtual bool                    getIsDataLayoutDimension(long nColumn) override;
     virtual bool                    IsDateDimension(long nDim) override;
-    virtual sal_uLong               GetNumberFormat(long nDim) override;
+    virtual sal_uInt32              GetNumberFormat(long nDim) override;
     virtual void                    DisposeData() override;
     virtual void                    SetEmptyFlags( bool bIgnoreEmptyRows, bool bRepeatIfEmpty ) override;
 
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index 03653d36208e..899de85ccf13 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -105,7 +105,7 @@ public:
     virtual OUString                getDimensionName(long nColumn) override;
     virtual bool                    getIsDataLayoutDimension(long nColumn) override;
     virtual bool                    IsDateDimension(long nDim) override;
-    virtual sal_uLong               GetNumberFormat(long nDim) override;
+    virtual sal_uInt32              GetNumberFormat(long nDim) override;
     virtual void                    DisposeData() override;
     virtual void                    SetEmptyFlags( bool bIgnoreEmptyRows, bool bRepeatIfEmpty ) override;
 
diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx
index d9682c437181..2c5870940b21 100644
--- a/sc/inc/dptabdat.hxx
+++ b/sc/inc/dptabdat.hxx
@@ -111,7 +111,7 @@ public:
     virtual OUString                getDimensionName(long nColumn) = 0;
     virtual bool                    getIsDataLayoutDimension(long nColumn) = 0;
     virtual bool                    IsDateDimension(long nDim) = 0;
-    virtual sal_uLong               GetNumberFormat(long nDim);
+    virtual sal_uInt32              GetNumberFormat(long nDim);
     sal_uInt32                      GetNumberFormatByIdx( NfIndexTableOffset );
     virtual void                    DisposeData() = 0;
     virtual void                    SetEmptyFlags( bool bIgnoreEmptyRows, bool bRepeatIfEmpty ) = 0;
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 66633f53e4da..879902d5758f 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -812,7 +812,7 @@ public:
      */
     static double ConvertStringToValue( const OUString& rStr, const ScCalcConfig& rConfig,
             FormulaError & rError, FormulaError nStringNoValueError,
-            SvNumberFormatter* pFormatter, short & rCurFmtType );
+            SvNumberFormatter* pFormatter, sal_uInt32 & rCurFmtType );
 
 };
 
diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 115072b863f5..8abfdd8ae278 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -135,9 +135,9 @@ public:
                                 with text encoding RTL_TEXTENC_SYMBOL */
     bool                    IsSymbolFont() const;
 
-    sal_uLong                   GetNumberFormat( SvNumberFormatter* ) const;
-    sal_uLong                   GetNumberFormat( SvNumberFormatter* pFormatter,
-                                                const SfxItemSet* pCondSet ) const;
+    sal_uInt32              GetNumberFormat( SvNumberFormatter* ) const;
+    sal_uInt32              GetNumberFormat( SvNumberFormatter* pFormatter,
+                                             const SfxItemSet* pCondSet ) const;
 
     long                    GetRotateVal( const SfxItemSet* pCondSet ) const;
     ScRotateDir             GetRotateDir( const SfxItemSet* pCondSet ) const;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 0f0d8dee6347..b0d69b8c4bb8 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -157,7 +157,7 @@ long ScColumn::GetNeededSize(
         bBreak = pPattern->GetItem(ATTR_LINEBREAK).GetValue();
 
     SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
-    sal_uLong nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
+    sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
     // #i111387# disable automatic line breaks only for "General" number format
     if (bBreak && ( nFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
     {
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 2aebf53e90e0..397fe3310087 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -531,7 +531,7 @@ bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::
 
     OUString aStr;
     Color* pColor;
-    sal_uLong nFormat = pPattern->GetNumberFormat(pFormatter, pCondSet);
+    sal_uInt32 nFormat = pPattern->GetNumberFormat(pFormatter, pCondSet);
     ScCellFormat::GetString(aCell, nFormat, aStr, &pColor, *pFormatter, pDocument);
 
     // Store the real script type to the array.
@@ -2063,7 +2063,7 @@ class FilterEntriesHandler
     {
         SvNumberFormatter* pFormatter = mrColumn.GetDoc().GetFormatTable();
         OUString aStr;
-        sal_uLong nFormat = mrColumn.GetNumberFormat(mrColumn.GetDoc().GetNonThreadedContext(), nRow);
+        sal_uInt32 nFormat = mrColumn.GetNumberFormat(mrColumn.GetDoc().GetNonThreadedContext(), nRow);
         ScCellFormat::GetInputString(rCell, nFormat, aStr, *pFormatter, &mrColumn.GetDoc());
 
         if (rCell.hasString())
@@ -2551,7 +2551,7 @@ void ScColumn::GetString( SCROW nRow, OUString& rString ) const
     if (aCell.meType == CELLTYPE_FORMULA)
         aCell.mpFormula->MaybeInterpret();
 
-    sal_uLong nFormat = GetNumberFormat(pDocument->GetNonThreadedContext(), nRow);
+    sal_uInt32 nFormat = GetNumberFormat(pDocument->GetNonThreadedContext(), nRow);
     Color* pColor = nullptr;
     ScCellFormat::GetString(aCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable()), pDocument);
 }
@@ -2572,7 +2572,7 @@ double* ScColumn::GetValueCell( SCROW nRow )
 void ScColumn::GetInputString( SCROW nRow, OUString& rString ) const
 {
     ScRefCellValue aCell = GetCellValue(nRow);
-    sal_uLong nFormat = GetNumberFormat(pDocument->GetNonThreadedContext(), nRow);
+    sal_uInt32 nFormat = GetNumberFormat(pDocument->GetNonThreadedContext(), nRow);
     ScCellFormat::GetInputString(aCell, nFormat, rString, *(pDocument->GetFormatTable()), pDocument);
 }
 
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 59b338568acd..e18c61a76d17 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1018,7 +1018,7 @@ private:
 
         OUString aStr;
         Color* pColor;
-        sal_uLong nFormat = pPat->GetNumberFormat(mpFormatter, pCondSet);
+        sal_uInt32 nFormat = pPat->GetNumberFormat(mpFormatter, pCondSet);
         ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *mpFormatter, &mrCol.GetDoc());
 
         rAttr.mnScriptType = mrCol.GetDoc().GetStringScriptType(aStr);
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index d953d8f275e4..4d31210e4afc 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1315,7 +1315,7 @@ bool ScConditionEntry::IsCellValid( ScRefCellValue& rCell, const ScAddress& rPos
 }
 
 OUString ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 nIndex,
-                                        sal_uLong nNumFmt,
+                                        sal_uInt32 nNumFmt,
                                         const FormulaGrammar::Grammar eGrammar ) const
 {
     assert( nIndex <= 1);
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index fa7f9dfb8c05..02e7b776ceef 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -74,7 +74,7 @@ void decBlock(std::pair<Iter, size_t>& rPos)
 
 }
 
-void ScAttrArray_IterGetNumberFormat( sal_uLong& nFormat, const ScAttrArray*& rpArr,
+void ScAttrArray_IterGetNumberFormat( sal_uInt32& nFormat, const ScAttrArray*& rpArr,
         SCROW& nAttrEndRow, const ScAttrArray* pNewArr, SCROW nRow,
         const ScDocument* pDoc )
 {
@@ -262,7 +262,7 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr)
     }
 }
 
-void ScValueIterator::GetCurNumFmtInfo( const ScInterpreterContext& rContext, short& nType, sal_uLong& nIndex )
+void ScValueIterator::GetCurNumFmtInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex )
 {
     if (!bNumValid && mnTab < pDoc->GetTableCount())
     {
@@ -1683,7 +1683,7 @@ bool ScQueryCellIterator::BinarySearch()
         if (aPos.first->type == sc::element_type_string || aPos.first->type == sc::element_type_edittext)
         {
             aCell = sc::toRefCell(aPos.first, aPos.second);
-            sal_uLong nFormat = pCol->GetNumberFormat(mrContext, nRow);
+            sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, nRow);
             OUString aCellStr;
             ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc);
             sal_Int32 nTmp = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString.getString());
@@ -1717,7 +1717,7 @@ bool ScQueryCellIterator::BinarySearch()
     aCell = aCellData.first;
     if (aCell.hasString())
     {
-        sal_uLong nFormat = pCol->GetNumberFormat(mrContext, aCellData.second);
+        sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, aCellData.second);
         OUString aStr;
         ScCellFormat::GetInputString(aCell, nFormat, aStr, rFormatter, pDoc);
         aLastInRangeString = aStr;
@@ -1816,7 +1816,7 @@ bool ScQueryCellIterator::BinarySearch()
         else if (bStr && bByString)
         {
             OUString aCellStr;
-            sal_uLong nFormat = pCol->GetNumberFormat(mrContext, aCellData.second);
+            sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, aCellData.second);
             ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc);
 
             nRes = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString.getString());
diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx
index a2504d594bd7..0a882e31857c 100644
--- a/sc/source/core/data/documen6.cxx
+++ b/sc/source/core/data/documen6.cxx
@@ -110,7 +110,7 @@ SvtScriptType ScDocument::GetStringScriptType( const OUString& rString )
     return nRet;
 }
 
-SvtScriptType ScDocument::GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat )
+SvtScriptType ScDocument::GetCellScriptType( const ScAddress& rPos, sal_uInt32 nNumberFormat )
 {
     SvtScriptType nStored = GetScriptType(rPos);
     if ( nStored != SvtScriptType::UNKNOWN )         // stored value valid?
@@ -143,7 +143,7 @@ SvtScriptType ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab )
     if ( !pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty() )
         pCondSet = GetCondResult( nCol, nRow, nTab );
 
-    sal_uLong nFormat = pPattern->GetNumberFormat( mxPoolHelper->GetFormTable(), pCondSet );
+    sal_uInt32 nFormat = pPattern->GetNumberFormat( mxPoolHelper->GetFormTable(), pCondSet );
 
     return GetCellScriptType(aPos, nFormat);
 }
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index a585c0342774..2151269a1612 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3720,7 +3720,7 @@ void ScDocument::SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberForma
     maTabs[nTab]->SetNumberFormat(rPos.Col(), rPos.Row(), nNumberFormat);
 }
 
-void ScDocument::GetNumberFormatInfo( const ScInterpreterContext& rContext, short& nType, sal_uLong& nIndex,
+void ScDocument::GetNumberFormatInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex,
             const ScAddress& rPos ) const
 {
     SCTAB nTab = rPos.Tab();
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index 4a36ff7ed702..f328b04a8f9a 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -593,7 +593,7 @@ bool ScDPGroupTableData::IsDateDimension(long nDim)
     return pSourceData->IsDateDimension( nDim );
 }
 
-sal_uLong ScDPGroupTableData::GetNumberFormat(long nDim)
+sal_uInt32 ScDPGroupTableData::GetNumberFormat(long nDim)
 {
     if ( nDim >= nSourceCount )
     {
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index 3b8b6e5b84c4..1e25ab88c514 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -118,7 +118,7 @@ bool ScSheetDPData::IsDateDimension(long nDim)
     }
 }
 
-sal_uLong ScSheetDPData::GetNumberFormat(long nDim)
+sal_uInt32 ScSheetDPData::GetNumberFormat(long nDim)
 {
     CreateCacheTable();
     if (getIsDataLayoutDimension(nDim))
diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx
index 681a06dd3871..c8d8a8c5cbe2 100644
--- a/sc/source/core/data/dptabdat.cxx
+++ b/sc/source/core/data/dptabdat.cxx
@@ -110,7 +110,7 @@ bool ScDPTableData::IsRepeatIfEmpty()
     return false;
 }
 
-sal_uLong ScDPTableData::GetNumberFormat(long)
+sal_uInt32 ScDPTableData::GetNumberFormat(long)
 {
     return 0;           // default format
 }
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index f703cb62bbf4..41694403ec2b 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -41,7 +41,7 @@ OUString getTwoDigitString(sal_Int32 nValue)
 
 void appendDateStr(OUStringBuffer& rBuffer, double fValue, SvNumberFormatter* pFormatter)
 {
-    sal_uLong nFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::DATE, ScGlobal::eLnge );
+    sal_uInt32 nFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::DATE, ScGlobal::eLnge );
     OUString aString;
     pFormatter->GetInputLineString(fValue, nFormat, aString);
     rBuffer.append(aString);
@@ -196,7 +196,7 @@ namespace {
 
 void lcl_AppendDateStr( OUStringBuffer& rBuffer, double fValue, SvNumberFormatter* pFormatter )
 {
-    sal_uLong nFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::DATE, ScGlobal::eLnge );
+    sal_uInt32 nFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::DATE, ScGlobal::eLnge );
     OUString aString;
     pFormatter->GetInputLineString( fValue, nFormat, aString );
     rBuffer.append( aString );
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 79b51cc9d25c..2f541d8514c7 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2063,7 +2063,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
           && nFormatType != css::util::NumberFormat::TIME
           && nFormatType != css::util::NumberFormat::DATETIME )
         {
-            sal_uLong nFormat = pDocument->GetNumberFormat( aPos );
+            sal_uInt32 nFormat = pDocument->GetNumberFormat( aPos );
             aResult.SetDouble( pDocument->RoundValueAsShown(
                         aResult.GetDouble(), nFormat));
         }
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index d772e319ebc2..a64e457926a4 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -375,7 +375,7 @@ bool isEmptyString( const OUString& rStr )
 
 double ScGlobal::ConvertStringToValue( const OUString& rStr, const ScCalcConfig& rConfig,
         FormulaError & rError, FormulaError nStringNoValueError,
-        SvNumberFormatter* pFormatter, short & rCurFmtType )
+        SvNumberFormatter* pFormatter, sal_uInt32 & rCurFmtType )
 {
     // We keep ScCalcConfig::StringConversion::LOCALE default until
     // we provide a friendly way to convert string numbers into numbers in the UI.
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 78dff05264a3..86aec0b7d450 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1228,9 +1228,9 @@ LanguageType getLanguageType(const SfxItemSet& rSet)
 
 }
 
-sal_uLong ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter ) const
+sal_uInt32 ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter ) const
 {
-    sal_uLong nFormat = getNumberFormatKey(GetItemSet());
+    sal_uInt32 nFormat = getNumberFormatKey(GetItemSet());
     LanguageType eLang = getLanguageType(GetItemSet());
     if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLang == LANGUAGE_SYSTEM )
         ;       // it remains as it is
@@ -1241,8 +1241,8 @@ sal_uLong ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter ) const
 
 // the same if conditional formatting is in play:
 
-sal_uLong ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter,
-                                        const SfxItemSet* pCondSet ) const
+sal_uInt32 ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter,
+                                           const SfxItemSet* pCondSet ) const
 {
     assert(pFormatter);
     if (!pCondSet)
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 8461994ff61c..7565d7626d25 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -242,7 +242,7 @@ SfxItemSet& ScStyleSheet::GetItemSet()
                 ScDocument* pDoc = pool->GetDocument();
                 if ( pDoc )
                 {
-                    sal_uLong nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::CURRENCY,ScGlobal::eLnge );
+                    sal_uInt32 nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::CURRENCY,ScGlobal::eLnge );
                     pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
                 }
             }
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index fba985e7d28d..a562093cfdd6 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2468,7 +2468,7 @@ public:
                 aCellStr = *rCell.mpString;
             else
             {
-                sal_uLong nFormat = mrTab.GetNumberFormat( static_cast<SCCOL>(rEntry.nField), nRow );
+                sal_uInt32 nFormat = mrTab.GetNumberFormat( static_cast<SCCOL>(rEntry.nField), nRow );
                 OUString aStr;
                 ScCellFormat::GetInputString(rCell, nFormat, aStr, *mrDoc.GetFormatTable(), &mrDoc);
                 aCellStr = mrStrPool.intern(aStr);
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 846850300f5f..f7bab382a76c 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -948,7 +948,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
                     break;
                     case CELLTYPE_VALUE:
                     {
-                        sal_uLong nNumFmt = GetNumberFormat( nSrcX, nSrcY );
+                        sal_uInt32 nNumFmt = GetNumberFormat( nSrcX, nSrcY );
                         //  overflow is possible...
                         double nVal = aCell.mfValue;
                         if ( !(nScFillModeMouseModifier & KEY_MOD1) )
@@ -1050,7 +1050,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
                 {
                     //TODO: get number format according to Index?
                     Color* pColor;
-                    sal_uLong nNumFmt = GetNumberFormat( nCol1, nRow1 );
+                    sal_uInt32 nNumFmt = GetNumberFormat( nCol1, nRow1 );
                     pDocument->GetFormatTable()->GetOutputString( nStart, nNumFmt, aValue, &pColor );
                 }
             }
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index d6a77f2b9c1a..3ad2bfe228ae 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -216,12 +216,12 @@ private:
     FormulaError nGlobalError;          // global (local to this formula expression) error
     sal_uInt16  sp;                     // stack pointer
     sal_uInt16  maxsp;                  // the maximal used stack pointer
-    sal_uLong   nFuncFmtIndex;          // NumberFormatIndex of a function
-    sal_uLong   nCurFmtIndex;           // current NumberFormatIndex
-    sal_uLong   nRetFmtIndex;           // NumberFormatIndex of an expression, if any
-    short       nFuncFmtType;           // NumberFormatType of a function
-    short       nCurFmtType;            // current NumberFormatType
-    short       nRetFmtType;            // NumberFormatType of an expression
+    sal_uInt32  nFuncFmtIndex;          // NumberFormatIndex of a function
+    sal_uInt32  nCurFmtIndex;           // current NumberFormatIndex
+    sal_uInt32  nRetFmtIndex;           // NumberFormatIndex of an expression, if any
+    sal_uInt32  nFuncFmtType;           // NumberFormatType of a function
+    sal_uInt32  nCurFmtType;            // current NumberFormatType
+    sal_uInt32  nRetFmtType;            // NumberFormatType of an expression
     FormulaError  mnStringNoValueError; // the error set in ConvertStringToValue() if no value
     SubtotalFlags mnSubTotalFlags;      // flags for subtotal and aggregate functions
     sal_uInt8   cPar;                   // current count of parameters
@@ -247,13 +247,13 @@ private:
 
     void ReplaceCell( ScAddress& );     // for TableOp
     bool IsTableOpInRange( const ScRange& );
-    sal_uLong GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell );
+    sal_uInt32 GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell );
     double ConvertStringToValue( const OUString& );
     public:
     static double ScGetGCD(double fx, double fy);
     /** For matrix back calls into the current interpreter.
         Uses rError instead of nGlobalError and rCurFmtType instead of nCurFmtType. */
-    double ConvertStringToValue( const OUString&, FormulaError& rError, short& rCurFmtType );
+    double ConvertStringToValue( const OUString&, FormulaError& rError, sal_uInt32& rCurFmtType );
     private:
     double GetCellValue( const ScAddress&, ScRefCellValue& rCell );
     double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell );
@@ -331,7 +331,7 @@ private:
                 FormulaDoubleToken or a FormulaTypedDoubleToken.
      */
     void PushCellResultToken( bool bDisplayEmptyAsString, const ScAddress & rAddress,
-            short * pRetTypeExpr, sal_uLong * pRetIndexExpr, bool bFinalResult = false );
+            sal_uInt32 * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult = false );
 
     formula::FormulaConstTokenRef PopToken();
     void Pop();
@@ -393,7 +393,7 @@ private:
     inline bool MatrixParameterConversion();
     ScMatrixRef PopMatrix();
     sc::RangeMatrix PopRangeMatrix();
-    void QueryMatrixType(const ScMatrixRef& xMat, short& rRetTypeExpr, sal_uLong& rRetIndexExpr);
+    void QueryMatrixType(const ScMatrixRef& xMat, sal_uInt32& rRetTypeExpr, sal_uInt32& rRetIndexExpr);
 
     formula::FormulaToken* CreateFormulaDoubleToken( double fVal, short nFmt = css::util::NumberFormat::NUMBER );
     formula::FormulaToken* CreateDoubleOrTypedToken( double fVal );
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 614b1f5ab366..ce40a1daefe4 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -30,7 +30,7 @@
 #include <sc.hrc>
 #include <editutil.hxx>
 
-void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString,
+void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString,
                               Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument* pDoc,
                               bool bNullVals, bool bFormula, bool bUseStarFormat )
 {
@@ -106,7 +106,7 @@ void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString
 }
 
 OUString ScCellFormat::GetString(
-    ScDocument& rDoc, const ScAddress& rPos, sal_uLong nFormat, Color** ppColor,
+    ScDocument& rDoc, const ScAddress& rPos, sal_uInt32 nFormat, Color** ppColor,
     SvNumberFormatter& rFormatter, bool bNullVals, bool bFormula )
 {
     OUString aString;
@@ -118,7 +118,7 @@ OUString ScCellFormat::GetString(
 }
 
 void ScCellFormat::GetInputString(
-    ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, SvNumberFormatter& rFormatter, const ScDocument* pDoc )
+    ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString, SvNumberFormatter& rFormatter, const ScDocument* pDoc )
 {
     OUString aString = rString;
     switch (rCell.meType)
@@ -177,7 +177,7 @@ OUString ScCellFormat::GetOutputString( ScDocument& rDoc, const ScAddress& rPos,
     {
         //  like in GetString for document (column)
         Color* pColor;
-        sal_uLong nNumFmt = rDoc.GetNumberFormat(rPos);
+        sal_uInt32 nNumFmt = rDoc.GetNumberFormat(rPos);
         GetString(rCell, nNumFmt, aVal, &pColor, *rDoc.GetFormatTable(), &rDoc);
     }
     return aVal;
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index e10bac450aa1..67fe8aee6c41 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1702,7 +1702,7 @@ void ScChangeActionContent::SetValue(
     OUString& rStr, ScCellValue& rCell, const ScAddress& rPos, const ScCellValue& rOrgCell,
     const ScDocument* pFromDoc, ScDocument* pToDoc )
 {
-    sal_uLong nFormat = NeedsNumberFormat(rOrgCell) ? pFromDoc->GetNumberFormat(rPos) : 0;
+    sal_uInt32 nFormat = NeedsNumberFormat(rOrgCell) ? pFromDoc->GetNumberFormat(rPos) : 0;
     SetValue(rStr, rCell, nFormat, rOrgCell, pFromDoc, pToDoc);
 }
 
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index fc17e7be64e1..5bb02e6e363d 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1988,7 +1988,7 @@ void ScInterpreter::ScIsLogical()
             {
                 if (aCell.hasNumeric())
                 {
-                    sal_uLong nFormat = GetCellNumberFormat(aAdr, aCell);
+                    sal_uInt32 nFormat = GetCellNumberFormat(aAdr, aCell);
                     bRes = (pFormatter->GetType(nFormat) == css::util::NumberFormat::LOGICAL);
                 }
             }
@@ -2036,7 +2036,7 @@ void ScInterpreter::ScType()
                         break;
                     case CELLTYPE_VALUE :
                     {
-                        sal_uLong nFormat = GetCellNumberFormat(aAdr, aCell);
+                        sal_uInt32 nFormat = GetCellNumberFormat(aAdr, aCell);
                         if (pFormatter->GetType(nFormat) == css::util::NumberFormat::LOGICAL)
                             nType = 4;
                         else
@@ -2321,7 +2321,7 @@ void ScInterpreter::ScCell()
             else if( aInfoType == "FORMAT" )
             {   // specific format code for standard formats
                 OUString aFuncResult;
-                sal_uLong   nFormat = pDok->GetNumberFormat( aCellPos );
+                sal_uInt32 nFormat = pDok->GetNumberFormat( aCellPos );
                 getFormatString(pFormatter, nFormat, aFuncResult);
                 PushString( aFuncResult );
             }
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 67052e8906d4..f80afe2bd5a8 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -124,9 +124,9 @@ bool ScInterpreter::IsTableOpInRange( const ScRange& rRange )
     return false;
 }
 
-sal_uLong ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell )
+sal_uInt32 ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& rCell )
 {
-    sal_uLong nFormat;
+    sal_uInt32 nFormat;
     FormulaError nErr;
     if (rCell.isEmpty())
     {
@@ -151,7 +151,7 @@ double ScInterpreter::GetValueCellValue( const ScAddress& rPos, double fOrig )
 {
     if ( bCalcAsShown && fOrig != 0.0 )
     {
-        sal_uLong nFormat = pDok->GetNumberFormat( rPos );
+        sal_uInt32 nFormat = pDok->GetNumberFormat( rPos );
         fOrig = pDok->RoundValueAsShown( fOrig, nFormat );
     }
     return fOrig;
@@ -172,7 +172,7 @@ double ScInterpreter::ConvertStringToValue( const OUString& rStr )
     return fValue;
 }
 
-double ScInterpreter::ConvertStringToValue( const OUString& rStr, FormulaError& rError, short& rCurFmtType )
+double ScInterpreter::ConvertStringToValue( const OUString& rStr, FormulaError& rError, sal_uInt32& rCurFmtType )
 {
     return ScGlobal::ConvertStringToValue( rStr, maCalcConfig, rError, mnStringNoValueError, pFormatter, rCurFmtType);
 }
@@ -690,7 +690,7 @@ void ScInterpreter::PushTokenRef( const formula::FormulaConstTokenRef& x )
 }
 
 void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString,
-        const ScAddress & rAddress, short * pRetTypeExpr, sal_uLong * pRetIndexExpr, bool bFinalResult )
+        const ScAddress & rAddress, sal_uInt32 * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult )
 {
     ScRefCellValue aCell(*pDok, rAddress);
     if (aCell.hasEmptyValue())
@@ -1675,7 +1675,7 @@ sc::RangeMatrix ScInterpreter::PopRangeMatrix()
     return aRet;
 }
 
-void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, short& rRetTypeExpr, sal_uLong& rRetIndexExpr)
+void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, sal_uInt32& rRetTypeExpr, sal_uInt32& rRetIndexExpr)
 {
     if (xMat)
     {
@@ -3955,8 +3955,8 @@ bool IsErrFunc(OpCode oc)
 
 StackVar ScInterpreter::Interpret()
 {
-    short nRetTypeExpr = css::util::NumberFormat::UNDEFINED;
-    sal_uLong nRetIndexExpr = 0;
+    sal_uInt32 nRetTypeExpr = css::util::NumberFormat::UNDEFINED;
+    sal_uInt32 nRetIndexExpr = 0;
     sal_uInt16 nErrorFunction = 0;
     sal_uInt16 nErrorFunctionCount = 0;
     std::vector<sal_uInt16> aErrorFunctionStack;
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 29d9d845b8f6..8dcbced00bee 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1137,12 +1137,12 @@ static ScMatrixRef lcl_MatrixCalculation(
                 else if ((!bVal1 && rMat1.IsString(i,j)) || (!bVal2 && rMat2.IsString(i,j)))
                 {
                     FormulaError nError1 = FormulaError::NONE;
-                    short nFmt1 = 0;
+                    sal_uInt32 nFmt1 = 0;
                     double fVal1 = (bVal1 ? rMat1.GetDouble(i,j) :
                             pInterpreter->ConvertStringToValue( rMat1.GetString(i,j).getString(), nError1, nFmt1));
 
                     FormulaError nError2 = FormulaError::NONE;
-                    short nFmt2 = 0;
+                    sal_uInt32 nFmt2 = 0;
                     double fVal2 = (bVal2 ? rMat2.GetDouble(i,j) :
                             pInterpreter->ConvertStringToValue( rMat2.GetString(i,j).getString(), nError2, nFmt2));
 
@@ -1181,7 +1181,7 @@ ScMatrixRef ScInterpreter::MatConcat(const ScMatrixRef& pMat1, const ScMatrixRef
 }
 
 // for DATE, TIME, DATETIME
-static void lcl_GetDiffDateTimeFmtType( short& nFuncFmt, short nFmt1, short nFmt2 )
+static void lcl_GetDiffDateTimeFmtType( sal_uInt32& nFuncFmt, short nFmt1, short nFmt2 )
 {
     if ( nFmt1 != css::util::NumberFormat::UNDEFINED || nFmt2 != css::util::NumberFormat::UNDEFINED )
     {
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 00f399fab47c..04a664831c9f 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -401,7 +401,7 @@ public:
 
 void IterateMatrix(
     const ScMatrixRef& pMat, ScIterFunc eFunc, bool bTextAsZero,
-    sal_uLong& rCount, short& rFuncFmtType, double& fRes, double& fMem )
+    sal_uLong& rCount, sal_uInt32& rFuncFmtType, double& fRes, double& fMem )
 {
     if (!pMat)
         return;
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 1cf9641771d6..dc42c399549b 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -74,7 +74,7 @@ double convertStringToValue( ScInterpreter* pErrorInterpreter, const OUString& r
     if (pErrorInterpreter)
     {
         FormulaError nError = FormulaError::NONE;
-        short nCurFmtType = 0;
+        sal_uInt32 nCurFmtType = 0;
         double fValue = pErrorInterpreter->ConvertStringToValue( rStr, nError, nCurFmtType);
         if (nError != FormulaError::NONE)
         {
@@ -689,7 +689,7 @@ svl::SharedString ScMatrixImpl::GetString( SvNumberFormatter& rFormatter, SCSIZE
                 return svl::SharedString::getEmptyString();
 
             // result of empty FALSE jump path
-            sal_uLong nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::LOGICAL,
+            sal_uInt32 nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::LOGICAL,
                     ScGlobal::eLnge);
             OUString aStr;
             Color* pColor = nullptr;
@@ -711,7 +711,7 @@ svl::SharedString ScMatrixImpl::GetString( SvNumberFormatter& rFormatter, SCSIZE
         return svl::SharedString( ScGlobal::GetErrorString( nError));   // string not interned
     }
 
-    sal_uLong nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::NUMBER,
+    sal_uInt32 nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::NUMBER,
             ScGlobal::eLnge);
     OUString aStr;
     rFormatter.GetInputLineString( fVal, nKey, aStr);
@@ -2610,7 +2610,7 @@ void ScMatrixImpl::MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef&
     xMat1->GetDimensions(nC1, nR1);
     xMat2->GetDimensions(nC2, nR2);
 
-    sal_uLong nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::NUMBER,
+    sal_uInt32 nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::NUMBER,
             ScGlobal::eLnge);
 
     std::vector<OUString> aString(nMaxCol * nMaxRow);
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 0e8753643b9f..163a12aff31f 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1336,8 +1336,8 @@ size_t XclExpFontBuffer::Find( const XclFontData& rFontData )
 /** Predicate for search algorithm. */
 struct XclExpNumFmtPred
 {
-    sal_uLong               mnScNumFmt;
-    explicit     XclExpNumFmtPred( sal_uLong nScNumFmt ) : mnScNumFmt( nScNumFmt ) {}
+    sal_uInt32   mnScNumFmt;
+    explicit     XclExpNumFmtPred( sal_uInt32 nScNumFmt ) : mnScNumFmt( nScNumFmt ) {}
     bool         operator()( const XclExpNumFmt& rFormat ) const
                             { return rFormat.mnScNumFmt == mnScNumFmt; }
 };
@@ -2043,7 +2043,7 @@ void XclExpXFId::ConvertXFIndex( const XclExpRoot& rRoot )
 
 XclExpXF::XclExpXF(
         const XclExpRoot& rRoot, const ScPatternAttr& rPattern, sal_Int16 nScript,
-        sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) :
+        sal_uInt32 nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) :
     XclXFBase( true ),
     XclExpRoot( rRoot )
 {
@@ -2071,7 +2071,7 @@ XclExpXF::XclExpXF( const XclExpRoot& rRoot, bool bCellXF ) :
 }
 
 bool XclExpXF::Equals( const ScPatternAttr& rPattern,
-        sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const
+        sal_uInt32 nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const
 {
     return IsCellXF() && (mpItemSet == &rPattern.GetItemSet()) &&
         (!bForceLineBreak || maAlignment.mbLineBreak) &&
@@ -2109,7 +2109,7 @@ void XclExpXF::InitDefault()
 }
 
 void XclExpXF::Init( const SfxItemSet& rItemSet, sal_Int16 nScript,
-        sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak, bool bDefStyle )
+        sal_uInt32 nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak, bool bDefStyle )
 {
     InitDefault();
     mpItemSet = &rItemSet;
@@ -2451,7 +2451,7 @@ sal_uInt32 XclExpXFBuffer::InsertWithFont( const ScPatternAttr* pPattern, sal_In
     return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak );
 }
 
-sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, sal_uLong nForceScNumFmt, bool bForceLineBreak )
+sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, sal_uInt32 nForceScNumFmt, bool bForceLineBreak )
 {
     return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, bForceLineBreak );
 }
@@ -2710,7 +2710,7 @@ void XclExpXFBuffer::SaveXFXml( XclExpXmlStream& rStrm, XclExpXF& rXF )
 }
 
 sal_uInt32 XclExpXFBuffer::FindXF( const ScPatternAttr& rPattern,
-        sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const
+        sal_uInt32 nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const
 {
     for( size_t nPos = 0, nSize = maXFList.GetSize(); nPos < nSize; ++nPos )
         if( maXFList.GetRecord( nPos )->Equals( rPattern, nForceScNumFmt, nForceXclFont, bForceLineBreak ) )
@@ -2735,7 +2735,7 @@ sal_uInt32 XclExpXFBuffer::FindBuiltInXF( sal_uInt8 nStyleId, sal_uInt8 nLevel )
 }
 
 sal_uInt32 XclExpXFBuffer::InsertCellXF( const ScPatternAttr* pPattern, sal_Int16 nScript,
-        sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak )
+        sal_uInt32 nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak )
 {
     const ScPatternAttr* pDefPattern = GetDoc().GetDefPattern();
     if( !pPattern )
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 27072e4dab12..bf7316026d15 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -173,7 +173,7 @@ void lclInsertUrl( XclImpRoot& rRoot, const OUString& rUrl, SCCOL nScCol, SCROW
         case CELLTYPE_STRING:
         case CELLTYPE_EDIT:
         {
-            sal_uLong nNumFmt = rDoc.getDoc().GetNumberFormat(rDoc.getDoc().GetNonThreadedContext(), aScPos);
+            sal_uInt32 nNumFmt = rDoc.getDoc().GetNumberFormat(rDoc.getDoc().GetNonThreadedContext(), aScPos);
             SvNumberFormatter* pFormatter = rDoc.getDoc().GetFormatTable();
             Color* pColor;
             OUString aDisplText;
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 03bc06f8d0ca..b5ec74794629 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -709,7 +709,7 @@ void XclImpNumFmtBuffer::CreateScFormats()
     }
 }
 
-sal_uLong XclImpNumFmtBuffer::GetScFormat( sal_uInt16 nXclNumFmt ) const
+sal_uInt32 XclImpNumFmtBuffer::GetScFormat( sal_uInt16 nXclNumFmt ) const
 {
     XclImpIndexMap::const_iterator aIt = maIndexMap.find( nXclNumFmt );
     return (aIt != maIndexMap.end()) ? aIt->second : NUMBERFORMAT_ENTRY_NOT_FOUND;
@@ -717,13 +717,13 @@ sal_uLong XclImpNumFmtBuffer::GetScFormat( sal_uInt16 nXclNumFmt ) const
 
 void XclImpNumFmtBuffer::FillToItemSet( SfxItemSet& rItemSet, sal_uInt16 nXclNumFmt, bool bSkipPoolDefs ) const
 {
-    sal_uLong nScNumFmt = GetScFormat( nXclNumFmt );
+    sal_uInt32 nScNumFmt = GetScFormat( nXclNumFmt );
     if( nScNumFmt == NUMBERFORMAT_ENTRY_NOT_FOUND )
         nScNumFmt = GetStdScNumFmt();
     FillScFmtToItemSet( rItemSet, nScNumFmt, bSkipPoolDefs );
 }
 
-void XclImpNumFmtBuffer::FillScFmtToItemSet( SfxItemSet& rItemSet, sal_uLong nScNumFmt, bool bSkipPoolDefs ) const
+void XclImpNumFmtBuffer::FillScFmtToItemSet( SfxItemSet& rItemSet, sal_uInt32 nScNumFmt, bool bSkipPoolDefs ) const
 {
     OSL_ENSURE( nScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND, "XclImpNumFmtBuffer::FillScFmtToItemSet - invalid number format" );
     ScfTools::PutItem( rItemSet, SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ), bSkipPoolDefs );
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 0668e766f6d8..3d4864e5e863 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -869,7 +869,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
 
     ScRefCellValue aCell(*pDoc, aPos);
 
-    sal_uLong nFormat = pAttr->GetNumberFormat( pFormatter );
+    sal_uInt32 nFormat = pAttr->GetNumberFormat( pFormatter );
     bool bValueData = aCell.hasNumeric();
     SvtScriptType nScriptType = SvtScriptType::NONE;
     if (!aCell.isEmpty())
diff --git a/sc/source/filter/inc/numberformatsbuffer.hxx b/sc/source/filter/inc/numberformatsbuffer.hxx
index 4098095cdaa0..b311191c742a 100644
--- a/sc/source/filter/inc/numberformatsbuffer.hxx
+++ b/sc/source/filter/inc/numberformatsbuffer.hxx
@@ -69,7 +69,7 @@ public:
     void                finalizeImport(
                             const css::uno::Reference< css::util::XNumberFormats >& rxNumFmts,
                             const css::lang::Locale& rFromLocale );
-    sal_uLong fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
+    sal_uInt32          fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
 
 private:
     NumFmtModel         maModel;
@@ -84,7 +84,7 @@ public:
     explicit            NumberFormatsBuffer( const WorkbookHelper& rHelper );
 
     /** Inserts a new number format. */
-    NumberFormatRef     createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode );
+    NumberFormatRef     createNumFmt( sal_uInt32 nNumFmtId, const OUString& rFmtCode );
 
     /** Inserts a new number format code. */
     NumberFormatRef     importNumFmt( const AttributeList& rAttribs );
@@ -94,19 +94,19 @@ public:
     /** Final processing after import of all style settings. */
     void                finalizeImport();
 
-    sal_uLong           fillToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const;
+    sal_uInt32          fillToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const;
 
-    sal_Int32           nextFreeId(){ return ++mnHighestId; }
+    sal_uInt32          nextFreeId(){ return ++mnHighestId; }
 private:
     /** Inserts built-in number formats for the current system language. */
     void                insertBuiltinFormats();
 
 private:
-    typedef RefMap< sal_Int32, NumberFormat > NumberFormatMap;
+    typedef RefMap< sal_uInt32, NumberFormat > NumberFormatMap;
 
     NumberFormatMap     maNumFmts;          /// List of number formats.
     OUString     maLocaleStr;        /// Current office locale.
-    sal_Int32           mnHighestId;
+    sal_uInt32          mnHighestId;
 };
 
 } // namespace xls
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 0447d2eb16c4..66319f8b981d 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -632,7 +632,7 @@ private:
     typedef ::std::unique_ptr< ::ScPatternAttr > ScPatternAttrPtr;
 
     ScPatternAttrPtr    mpPattern;          /// Calc item set.
-    sal_uLong           mnScNumFmt;         /// Calc number format.
+    sal_uInt32          mnScNumFmt;         /// Calc number format.
 
     XfModel             maModel;            /// Cell XF or style XF model data.
     Alignment           maAlignment;        /// Cell alignment data.
@@ -852,7 +852,7 @@ public:
     OUString     createDxfStyle( sal_Int32 nDxfId ) const;
 
     void                writeFontToItemSet( SfxItemSet& rItemSet, sal_Int32 nFontId, bool bSkipPoolDefs ) const;
-    sal_uLong           writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const;
+    sal_uInt32          writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const;
     /** Writes the specified number format to the passed property map. */
     void                writeBorderToItemSet( SfxItemSet& rItemSet, sal_Int32 nBorderId, bool bSkipPoolDefs ) const;
     /** Writes the fill attributes of the specified fill data to the passed property map. */
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index 0e6056b372e4..dc12247b418f 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -434,7 +434,7 @@ public:
                             const XclExpRoot& rRoot,
                             const ScPatternAttr& rPattern,
                             sal_Int16 nScript,
-                            sal_uLong nScForceNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND,
+                            sal_uInt32 nScForceNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND,
                             sal_uInt16 nForceXclFont = EXC_FONT_NOTFOUND,
                             bool bForceLineBreak = false );
     /** Constructs a style XF record from the passed cell style sheet. */
@@ -455,7 +455,7 @@ public:
         @descr  Searches for cell XFs only. */
     bool                Equals(
                             const ScPatternAttr& rPattern,
-                            sal_uLong nScForceNumFmt,
+                            sal_uInt32 nScForceNumFmt,
                             sal_uInt16 nForceXclFont,
                             bool bForceLineBreak ) const;
 
@@ -484,7 +484,7 @@ protected:  // access for XclExpDefaultXF
     XclExpCellBorder    maBorder;           /// Border line style.
     XclExpCellArea      maArea;             /// Background area style.
     sal_uInt32          mnParentXFId;       /// XF ID of parent XF record.
-    sal_uLong               mnScNumFmt;         /// Calc number format index.
+    sal_uInt32          mnScNumFmt;         /// Calc number format index.
     sal_uInt16          mnXclFont;          /// Excel font index.
     sal_uInt16          mnXclNumFmt;        /// Excel number format index.
     sal_Int32           mnBorderId;         /// OOXML Border Index
@@ -500,7 +500,7 @@ private:
     void                Init(
                             const SfxItemSet& rItemSet,
                             sal_Int16 nScript,
-                            sal_uLong nForceScNumFmt,
+                            sal_uInt32 nForceScNumFmt,
                             sal_uInt16 nForceXclFont,
                             bool bForceLineBreak,
                             bool bDefStyle );
@@ -599,7 +599,7 @@ public:
         @return  A unique XF record ID. */
     sal_uInt32          InsertWithNumFmt(
                             const ScPatternAttr* pPattern, sal_Int16 nScript,
-                            sal_uLong nForceScNumFmt,
+                            sal_uInt32 nForceScNumFmt,
                             bool bForceLineBreak );
     /** Inserts the passed cell style. Creates a style XF record and a STYLE record.
         @return  A unique XF record ID. */
@@ -632,7 +632,7 @@ private:
 
 private:
     /** Returns the XF ID of the cell XF containing the passed format. */
-    sal_uInt32          FindXF( const ScPatternAttr& rPattern, sal_uLong nForceScNumFmt,
+    sal_uInt32          FindXF( const ScPatternAttr& rPattern, sal_uInt32 nForceScNumFmt,
                             sal_uInt16 nForceXclFont, bool bForceLineBreak ) const;
     /** Returns the XF ID of the style XF containing the passed style. */
     sal_uInt32          FindXF( const SfxStyleSheetBase& rStyleSheet ) const;
@@ -643,7 +643,7 @@ private:
     /** Tries to find the XF record containing the passed format or inserts a new record.
         @return  The XF record ID. */
     sal_uInt32          InsertCellXF( const ScPatternAttr* pPattern, sal_Int16 nScript,
-                            sal_uLong nForceScNumFmt,
+                            sal_uInt32 nForceScNumFmt,
                             sal_uInt16 nForceXclFont, bool bForceLineBreak );
     /** Inserts the passed cell style. Creates a style XF record and a STYLE record.
         @return  The XF record ID. */
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index bc6b3db8da85..da818321dabd 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -224,7 +224,7 @@ public:
     void                CreateScFormats();
 
     /** Returns the format key with the passed Excel index or NUMBERFORMAT_ENTRY_NOT_FOUND on error. */
-    sal_uLong               GetScFormat( sal_uInt16 nXclNumFmt ) const;
+    sal_uInt32          GetScFormat( sal_uInt16 nXclNumFmt ) const;
 
     /** Fills an Excel number format to the passed item set.
         @param rItemSet  The destination item set.
@@ -238,7 +238,7 @@ public:
         @param nScNumFmt  The Calc number formatter index of the format.
         @param bSkipPoolDefs  true = Do not put items equal to pool default; false = Put all items. */
     void                FillScFmtToItemSet(
-                            SfxItemSet& rItemSet, sal_uLong nScNumFmt,
+                            SfxItemSet& rItemSet, sal_uInt32 nScNumFmt,
                             bool bSkipPoolDefs = false ) const;
 
 private:
diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx
index 5b1a6e918a71..4b8dd97109d4 100644
--- a/sc/source/filter/inc/xlstyle.hxx
+++ b/sc/source/filter/inc/xlstyle.hxx
@@ -452,7 +452,7 @@ public:
     explicit            XclNumFmtBuffer( const XclRoot& rRoot );
 
     /** Returns the core index of the current standard number format. */
-    sal_uLong        GetStdScNumFmt() const { return mnStdScNumFmt; }
+    sal_uInt32          GetStdScNumFmt() const { return mnStdScNumFmt; }
 
 protected:
     typedef ::std::map< sal_uInt16, XclNumFmt > XclNumFmtMap;
@@ -472,7 +472,7 @@ private:
 
     XclNumFmtMap        maFmtMap;       /// Map containing all default and user-defined formats.
     const LanguageType  meSysLang;      /// Current system language.
-    const sal_uLong     mnStdScNumFmt;  /// Calc format key for standard number format.
+    const sal_uInt32    mnStdScNumFmt;  /// Calc format key for standard number format.
 };
 
 // Cell formatting data (XF) ==================================================
diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx
index ba66b7ed7077..75a6d8b44205 100644
--- a/sc/source/filter/oox/numberformatsbuffer.cxx
+++ b/sc/source/filter/oox/numberformatsbuffer.cxx
@@ -1950,11 +1950,11 @@ void NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNumFmts,
         maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maModel.mnPredefId, maModel.maLocale );
 }
 
-sal_uLong NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
+sal_uInt32 NumberFormat::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
 {
     const ScDocument& rDoc = getScDocument();
-    static sal_uLong  nDflt = rDoc.GetFormatTable()->GetStandardIndex( ScGlobal::eLnge );
-    sal_uLong nScNumFmt = nDflt;
+    static sal_uInt32  nDflt = rDoc.GetFormatTable()->GetStandardIndex( ScGlobal::eLnge );
+    sal_uInt32 nScNumFmt = nDflt;
     if ( maApiData.mnIndex )
         nScNumFmt = maApiData.mnIndex;
 
@@ -1982,17 +1982,14 @@ NumberFormatsBuffer::NumberFormatsBuffer( const WorkbookHelper& rHelper )
     insertBuiltinFormats();
 }
 
-NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode )
+NumberFormatRef NumberFormatsBuffer::createNumFmt( sal_uInt32 nNumFmtId, const OUString& rFmtCode )
 {
     NumberFormatRef xNumFmt;
-    if( nNumFmtId >= 0 )
-    {
-        xNumFmt.reset( new NumberFormat( *this ) );
-        maNumFmts[ nNumFmtId ] = xNumFmt;
-        if ( nNumFmtId > mnHighestId )
-            mnHighestId = nNumFmtId;
-        xNumFmt->setFormatCode( rFmtCode );
-    }
+    xNumFmt.reset( new NumberFormat( *this ) );
+    maNumFmts[ nNumFmtId ] = xNumFmt;
+    if ( nNumFmtId > mnHighestId )
+        mnHighestId = nNumFmtId;
+    xNumFmt->setFormatCode( rFmtCode );
     return xNumFmt;
 }
 
@@ -2015,7 +2012,7 @@ void NumberFormatsBuffer::finalizeImport()
     maNumFmts.forEach( NumberFormatFinalizer( *this ) );
 }
 
-sal_uLong NumberFormatsBuffer::fillToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const
+sal_uInt32 NumberFormatsBuffer::fillToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const
 {
     const NumberFormat* pNumFmt = maNumFmts.get(nNumFmtId).get();
     if (!pNumFmt)
@@ -2052,7 +2049,7 @@ void NumberFormatsBuffer::insertBuiltinFormats()
         aBuiltinVec.push_back( aMIt->second );
 
     // insert the default formats in the format map (in reverse order from default table to system locale)
-    typedef ::std::map< sal_Int32, sal_Int32 > ReuseMap;
+    typedef ::std::map< sal_uInt32, sal_uInt32 > ReuseMap;
     ReuseMap aReuseMap;
     for( BuiltinVec::reverse_iterator aVIt = aBuiltinVec.rbegin(), aVEnd = aBuiltinVec.rend(); aVIt != aVEnd; ++aVIt )
     {
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 93cf0ca1e251..7a33511ee449 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2904,7 +2904,7 @@ void StylesBuffer::writeFontToItemSet( SfxItemSet& rItemSet, sal_Int32 nFontId,
         pFont->fillToItemSet( rItemSet, false, bSkipPoolDefs );
 }
 
-sal_uLong StylesBuffer::writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_Int32 nNumFmtId, bool bSkipPoolDefs ) const
+sal_uInt32 StylesBuffer::writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const
 {
     return maNumFmts.fillToItemSet( rItemSet, nNumFmtId, bSkipPoolDefs );
 }
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index ffb06e8ebc65..22cd382bd593 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -183,7 +183,7 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol )
         default:
         {
             bValueData = pDoc->HasValueData(aPos);
-            sal_uLong nFormat = pAttr->GetNumberFormat(pFormatter);
+            sal_uInt32 nFormat = pAttr->GetNumberFormat(pFormatter);
             Color* pColor;
             aContent = ScCellFormat::GetString(*pDoc, aPos, nFormat, &pColor, *pFormatter);
         }
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 415e261a581b..0148dc965026 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1310,7 +1310,7 @@ OUString getOutputString( ScDocument* pDoc, const ScAddress& aCellPos )
         {
             //  like in GetString for document (column)
             Color* pColor;
-            sal_uLong nNumFmt = pDoc->GetNumberFormat(aCellPos);
+            sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aCellPos);
             OUString aStr;
             ScCellFormat::GetString(aCell, nNumFmt, aStr, &pColor, *pDoc->GetFormatTable(), pDoc);
             return aStr;
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 10d04f2fc529..3a9e60a99691 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -218,7 +218,7 @@ OUString lcl_GetFormattedString(ScDocument* pDoc, ScRefCellValue& rCell, const S
             Color* pColor;
             SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
 
-            sal_uLong nFormat = pDoc->GetNumberFormat(rAddr);
+            sal_uInt32 nFormat = pDoc->GetNumberFormat(rAddr);
             ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *pFormatter, pDoc);
             return aStr;
         }
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index fdbf874ceb66..4d01a67db4d2 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -280,7 +280,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
             else
             {
                 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-                sal_uLong nNumFmt = pPattern->GetNumberFormat(pFormatter);
+                sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter);
                 OUString aText;
                 Color* pColor;
                 ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, pDoc);
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 4167ce11c8b1..88bab11ffb11 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1618,7 +1618,7 @@ bool ScImportExport::Doc2Text( SvStream& rStrm )
             for (nCol = nStartCol; nCol <= nEndCol; nCol++)
             {
                 ScAddress aPos(nCol, nRow, nStartTab);
-                sal_uLong nNumFmt = pDoc->GetNumberFormat(aPos);
+                sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aPos);
                 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
 
                 ScRefCellValue aCell(*pDoc, aPos);
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 7aae443e1089..ffea02a88546 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -3160,9 +3160,9 @@ uno::Sequence< OUString > SAL_CALL ScChart2DataSequence::generateLabel(chart2::d
 
 namespace {
 
-sal_uLong getDisplayNumberFormat(const ScDocument* pDoc, const ScAddress& rPos)
+sal_uInt32 getDisplayNumberFormat(const ScDocument* pDoc, const ScAddress& rPos)
 {
-    sal_uLong nFormat = pDoc->GetNumberFormat(rPos); // original format from cell.
+    sal_uInt32 nFormat = pDoc->GetNumberFormat(rPos); // original format from cell.
     return nFormat;
 }
 
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 3f7787d7d736..81a2448c9f59 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -966,7 +966,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
         }
         else
         {
-            sal_uLong nFormat = rDoc.GetNumberFormat(aCellPos);
+            sal_uInt32 nFormat = rDoc.GetNumberFormat(aCellPos);
             ScCellFormat::GetInputString(aCell, nFormat, aText, *rDoc.GetFormatTable(), &rDoc);
             if (!aText.isEmpty())
                 pEditEngine->SetTextNewDefaults(aText, aDefaults);
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 79e3441cc492..41d74671b5f4 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -789,7 +789,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         }
                         rReq.AppendItem( SfxStringItem( FN_PARAM_2, aPara ) );
 
-                        sal_uLong nFormatKey = pFormatter->GetStandardFormat(css::util::NumberFormat::NUMBER,
+                        sal_uInt32 nFormatKey = pFormatter->GetStandardFormat(css::util::NumberFormat::NUMBER,
                                     ScGlobal::eLnge );
 
                         pFormatter->GetOutputString( fIncVal, nFormatKey, aPara, &pColor );
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 11fb12fe3f5c..36c13b3a2175 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -841,7 +841,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                         {
                             eMode = pOldData->GetDataMode();
                             eOper = pOldData->GetOperation();
-                            sal_uLong nNumFmt = 0;
+                            sal_uInt32 nNumFmt = 0;
                             if ( eMode == SC_VALID_DATE || eMode == SC_VALID_TIME )
                             {
                                 short nType = ( eMode == SC_VALID_DATE ) ? css::util::NumberFormat::DATE
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index e05b619c4ec2..20f8b606e517 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2359,7 +2359,7 @@ bool ScOutputData::DrawEditParam::readCellContent(
     }
     else
     {
-        sal_uLong nFormat = mpPattern->GetNumberFormat(
+        sal_uInt32 nFormat = mpPattern->GetNumberFormat(
                                     pDoc->GetFormatTable(), mpCondSet );
         OUString aString;
         Color* pColor;
@@ -4799,7 +4799,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
                             }
                             else
                             {
-                                sal_uLong nFormat = pPattern->GetNumberFormat(
+                                sal_uInt32 nFormat = pPattern->GetNumberFormat(
                                                             mpDoc->GetFormatTable(), pCondSet );
                                 OUString aString;
                                 Color* pColor;
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 7fad99809081..15fedc1f9733 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -255,7 +255,7 @@ void ScConversionEngineBase::FillFromCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
         case CELLTYPE_STRING:
         {
             SvNumberFormatter* pFormatter = mrDoc.GetFormatTable();
-            sal_uLong nNumFmt = mrDoc.GetNumberFormat(aPos);
+            sal_uInt32 nNumFmt = mrDoc.GetNumberFormat(aPos);
             OUString aText;
             Color* pColor;
             ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, &mrDoc);


More information about the Libreoffice-commits mailing list