summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-12-03 21:46:37 +0200
committerEike Rathke <erack@redhat.com>2017-12-19 22:08:26 +0100
commit00bc5a097313fbd003675267be961ad3a152ba42 (patch)
treede9b9e6981d3c2f262b9391335a067d4898185b6
parentRead some configuration items directly (diff)
downloadcore-00bc5a097313fbd003675267be961ad3a152ba42.tar.gz
core-00bc5a097313fbd003675267be961ad3a152ba42.zip
wrap scoped enum around css::util::NumberFormat
Change-Id: Icab5ded8bccdb95f79b3fa35ea164f47919c68fa Reviewed-on: https://gerrit.libreoffice.org/46339 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--basic/source/comp/scanner.cxx4
-rw-r--r--basic/source/runtime/methods.cxx12
-rw-r--r--basic/source/runtime/runtime.cxx5
-rw-r--r--basic/source/sbx/sbxdate.cxx11
-rw-r--r--basic/source/sbx/sbxscan.cxx2
-rw-r--r--chart2/source/controller/dialogs/DataBrowser.cxx4
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx20
-rw-r--r--chart2/source/tools/DiagramHelper.cxx4
-rw-r--r--cui/source/options/optupdt.cxx4
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx2
-rw-r--r--editeng/source/items/flditem.cxx6
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx2
-rw-r--r--extensions/source/propctrlr/usercontrol.cxx8
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx30
-rw-r--r--formula/source/core/api/token.cxx10
-rw-r--r--include/formula/FormulaCompiler.hxx5
-rw-r--r--include/formula/token.hxx16
-rw-r--r--include/svl/zforlist.hxx80
-rw-r--r--include/svl/zformat.hxx21
-rw-r--r--include/svx/numfmtsh.hxx6
-rw-r--r--oox/source/drawingml/chart/datasourcecontext.cxx2
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/inc/dociter.hxx7
-rw-r--r--sc/inc/document.hxx4
-rw-r--r--sc/inc/dpcache.hxx3
-rw-r--r--sc/inc/externalrefmgr.hxx2
-rw-r--r--sc/inc/formulacell.hxx7
-rw-r--r--sc/inc/global.hxx9
-rw-r--r--sc/inc/simpleformulacalc.hxx4
-rw-r--r--sc/inc/stringutil.hxx3
-rw-r--r--sc/inc/table.hxx2
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/source/core/data/clipcontext.cxx4
-rw-r--r--sc/source/core/data/column.cxx8
-rw-r--r--sc/source/core/data/column3.cxx22
-rw-r--r--sc/source/core/data/dbdocutl.cxx10
-rw-r--r--sc/source/core/data/dociter.cxx10
-rw-r--r--sc/source/core/data/documen4.cxx17
-rw-r--r--sc/source/core/data/document.cxx10
-rw-r--r--sc/source/core/data/dpcache.cxx12
-rw-r--r--sc/source/core/data/dpobject.cxx14
-rw-r--r--sc/source/core/data/dputil.cxx4
-rw-r--r--sc/source/core/data/formulacell.cxx43
-rw-r--r--sc/source/core/data/global.cxx2
-rw-r--r--sc/source/core/data/global2.cxx6
-rw-r--r--sc/source/core/data/simpleformulacalc.cxx2
-rw-r--r--sc/source/core/data/stlsheet.cxx2
-rw-r--r--sc/source/core/data/table2.cxx2
-rw-r--r--sc/source/core/data/table3.cxx8
-rw-r--r--sc/source/core/data/table4.cxx14
-rw-r--r--sc/source/core/inc/interpre.hxx16
-rw-r--r--sc/source/core/tool/chartpos.cxx4
-rw-r--r--sc/source/core/tool/compiler.cxx8
-rw-r--r--sc/source/core/tool/interpr1.cxx76
-rw-r--r--sc/source/core/tool/interpr2.cxx66
-rw-r--r--sc/source/core/tool/interpr4.cxx86
-rw-r--r--sc/source/core/tool/interpr5.cxx87
-rw-r--r--sc/source/core/tool/interpr6.cxx10
-rw-r--r--sc/source/core/tool/scmatrix.cxx8
-rw-r--r--sc/source/core/tool/stringutil.cxx2
-rw-r--r--sc/source/core/tool/zforauto.cxx2
-rw-r--r--sc/source/filter/excel/xelink.cxx2
-rw-r--r--sc/source/filter/excel/xepivot.cxx6
-rw-r--r--sc/source/filter/excel/xetable.cxx20
-rw-r--r--sc/source/filter/excel/xipivot.cxx8
-rw-r--r--sc/source/filter/excel/xistyle.cxx2
-rw-r--r--sc/source/filter/html/htmlpars.cxx2
-rw-r--r--sc/source/filter/lotus/tool.cxx42
-rw-r--r--sc/source/filter/orcus/interface.cxx2
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx4
-rw-r--r--sc/source/filter/xcl97/XclImpChangeTrack.cxx2
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx11
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx4
-rw-r--r--sc/source/ui/app/inputhdl.cxx2
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx2
-rw-r--r--sc/source/ui/docshell/docsh8.cxx10
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx6
-rw-r--r--sc/source/ui/docshell/impex.cxx6
-rw-r--r--sc/source/ui/inc/formatsh.hxx3
-rw-r--r--sc/source/ui/inc/viewfunc.hxx4
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx12
-rw-r--r--sc/source/ui/view/cellsh1.cxx10
-rw-r--r--sc/source/ui/view/cellsh2.cxx4
-rw-r--r--sc/source/ui/view/dbfunc3.cxx4
-rw-r--r--sc/source/ui/view/formatsh.cxx176
-rw-r--r--sc/source/ui/view/output2.cxx2
-rw-r--r--sc/source/ui/view/viewfun2.cxx2
-rw-r--r--sc/source/ui/view/viewfun6.cxx60
-rw-r--r--sc/source/ui/view/viewfunc.cxx22
-rw-r--r--sfx2/source/bastyp/sfxhtml.cxx2
-rw-r--r--svl/qa/unit/svl.cxx8
-rw-r--r--svl/source/numbers/numfmuno.cxx19
-rw-r--r--svl/source/numbers/zforfind.cxx277
-rw-r--r--svl/source/numbers/zforfind.hxx7
-rw-r--r--svl/source/numbers/zforlist.cxx252
-rw-r--r--svl/source/numbers/zformat.cxx96
-rw-r--r--svl/source/numbers/zforscan.cxx182
-rw-r--r--svl/source/numbers/zforscan.hxx4
-rw-r--r--svtools/source/control/fmtfield.cxx16
-rw-r--r--svx/source/items/numfmtsh.cxx134
-rw-r--r--sw/source/core/doc/tblafmt.cxx2
-rw-r--r--sw/source/core/docnode/ndtbl.cxx4
-rw-r--r--sw/source/core/fields/cellfml.cxx8
-rw-r--r--sw/source/core/fields/fldbas.cxx6
-rw-r--r--sw/source/core/table/swtable.cxx8
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx2
-rw-r--r--sw/source/core/unocore/unostyle.cxx2
-rw-r--r--sw/source/filter/html/htmlfld.cxx7
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx28
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx6
-rw-r--r--sw/source/ui/fldui/flddinf.cxx24
-rw-r--r--sw/source/ui/fldui/flddok.cxx10
-rw-r--r--sw/source/ui/fldui/fldvar.cxx4
-rw-r--r--sw/source/ui/table/tautofmt.cxx2
-rw-r--r--sw/source/uibase/fldui/fldmgr.cxx8
-rw-r--r--sw/source/uibase/inc/numfmtlb.hxx9
-rw-r--r--sw/source/uibase/shells/tabsh.cxx21
-rw-r--r--sw/source/uibase/utlui/numfmtlb.cxx65
-rw-r--r--uui/source/iahndl-ssl.cxx4
-rw-r--r--xmloff/source/style/xmlnumfe.cxx76
-rw-r--r--xmloff/source/style/xmlnumfi.cxx4
123 files changed, 1327 insertions, 1258 deletions
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 67177b7d9f44..2ecb7310d543 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -575,8 +575,8 @@ bool SbiScanner::NextSym()
bool bSuccess = pFormatter->IsNumberFormat(aSym, nIndex, nVal);
if( bSuccess )
{
- short nType_ = pFormatter->GetType(nIndex);
- if( !(nType_ & css::util::NumberFormat::DATE) )
+ SvNumFormatType nType_ = pFormatter->GetType(nIndex);
+ if( !(nType_ & SvNumFormatType::DATE) )
bSuccess = false;
}
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 542c8817700c..d1f4206c31c5 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2048,7 +2048,7 @@ void SbRtl_DateValue(StarBASIC *, SbxArray & rPar, bool)
double fResult;
OUString aStr( rPar.Get(1)->GetOUString() );
bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult );
- short nType = pFormatter->GetType( nIndex );
+ SvNumFormatType nType = pFormatter->GetType( nIndex );
// DateValue("February 12, 1969") raises error if the system locale is not en_US
// It seems that both locale number formatter and English number
@@ -2061,9 +2061,9 @@ void SbRtl_DateValue(StarBASIC *, SbxArray & rPar, bool)
nType = pFormatter->GetType( nIndex );
}
- if(bSuccess && (nType==css::util::NumberFormat::DATE || nType==css::util::NumberFormat::DATETIME))
+ if(bSuccess && (nType==SvNumFormatType::DATE || nType==SvNumFormatType::DATETIME))
{
- if ( nType == css::util::NumberFormat::DATETIME )
+ if ( nType == SvNumFormatType::DATETIME )
{
// cut time
if ( fResult > 0.0 )
@@ -2105,10 +2105,10 @@ void SbRtl_TimeValue(StarBASIC *, SbxArray & rPar, bool)
double fResult;
bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetOUString(),
nIndex, fResult );
- short nType = pFormatter->GetType(nIndex);
- if(bSuccess && (nType==css::util::NumberFormat::TIME||nType==css::util::NumberFormat::DATETIME))
+ SvNumFormatType nType = pFormatter->GetType(nIndex);
+ if(bSuccess && (nType==SvNumFormatType::TIME||nType==SvNumFormatType::DATETIME))
{
- if ( nType == css::util::NumberFormat::DATETIME )
+ if ( nType == SvNumFormatType::DATETIME )
{
// cut days
fResult = fmod( fResult, 1 );
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 2eaa60f85e5f..2b81778917e0 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -408,8 +408,9 @@ std::shared_ptr<SvNumberFormatter> SbiInstance::PrepareNumberFormatter( sal_uInt
std::shared_ptr<SvNumberFormatter> pNumberFormatter(
new SvNumberFormatter( comphelper::getProcessComponentContext(), eLangType ));
- sal_Int32 nCheckPos = 0; short nType;
- rnStdTimeIdx = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::TIME, eLangType );
+ sal_Int32 nCheckPos = 0;
+ SvNumFormatType nType;
+ rnStdTimeIdx = pNumberFormatter->GetStandardFormat( SvNumFormatType::TIME, eLangType );
// the formatter's standard templates have only got a two-digit date
// -> registering an own format
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index e59c9214a90b..5342d557e1f0 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -116,7 +116,8 @@ double ImpGetDate( const SbxValues* p )
sal_uInt32 nIndex;
sal_Int32 nCheckPos = 0;
- short nType = 127;
+ SvNumFormatType nType = SvNumFormatType::DEFINED | SvNumFormatType::DATE | SvNumFormatType::TIME | SvNumFormatType::CURRENCY
+ | SvNumFormatType::NUMBER | SvNumFormatType::SCIENTIFIC | SvNumFormatType::FRACTION;
// Default templates of the formatter have only two-digit
// date. Therefore register an own format.
@@ -144,9 +145,9 @@ double ImpGetDate( const SbxValues* p )
bool bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes );
if ( bSuccess )
{
- short nType_ = pFormatter->GetType( nIndex );
- if(!(nType_ & ( css::util::NumberFormat::DATETIME | css::util::NumberFormat::DATE |
- css::util::NumberFormat::TIME | css::util::NumberFormat::DEFINED )))
+ SvNumFormatType nType_ = pFormatter->GetType( nIndex );
+ if(!(nType_ & ( SvNumFormatType::DATETIME | SvNumFormatType::DATE |
+ SvNumFormatType::TIME | SvNumFormatType::DEFINED )))
{
bSuccess = false;
}
@@ -292,7 +293,7 @@ start:
sal_uInt32 nIndex;
sal_Int32 nCheckPos = 0;
- short nType;
+ SvNumFormatType nType;
SvtSysLocale aSysLocale;
DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder();
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 3408c0e9f151..d13cacb3616c 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -703,7 +703,7 @@ void SbxValue::Format( OUString& rRes, const OUString* pFmt ) const
if( bSuccess )
{
sal_Int32 nCheckPos = 0;
- short nType;
+ SvNumFormatType nType;
OUString aFmtStr = *pFmt;
const VbaFormatInfo* pInfo = getFormatInfo( aFmtStr );
if( pInfo->meType != VbaFormatType::Null )
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 5071974206a3..31372feab01a 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -1130,8 +1130,8 @@ bool DataBrowser::isDateTimeString( const OUString& aInputString, double& fOutDa
SvNumberFormatter* pSvNumberFormatter = m_spNumberFormatterWrapper.get() ? m_spNumberFormatterWrapper->getSvNumberFormatter() : nullptr;
if( !aInputString.isEmpty() && pSvNumberFormatter && pSvNumberFormatter->IsNumberFormat( aInputString, nNumberFormat, fOutDateTimeValue ) )
{
- short nType = pSvNumberFormatter->GetType( nNumberFormat);
- return (nType & util::NumberFormat::DATE) || (nType & util::NumberFormat::TIME);
+ SvNumFormatType nType = pSvNumberFormatter->GetType( nNumberFormat);
+ return (nType & SvNumFormatType::DATE) || (nType & SvNumFormatType::TIME);
}
return false;
}
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index 3a791f53baf2..c4e04638abda 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -422,11 +422,11 @@ DeactivateRC ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
bool bDateAxis = m_nAxisType == chart2::AxisType::DATE;
sal_uInt32 nMinMaxOriginFmt = m_pFmtFldMax->GetFormatKey();
- if (pNumFormatter->GetType(nMinMaxOriginFmt) == css::util::NumberFormat::TEXT)
+ if (pNumFormatter->GetType(nMinMaxOriginFmt) == SvNumFormatType::TEXT)
nMinMaxOriginFmt = 0;
// numberformat_text cause numbers to fail being numbers... Shouldn't happen, but can.
sal_uInt32 nStepFmt = m_pFmtFldStepMain->GetFormatKey();
- if (pNumFormatter->GetType(nStepFmt) == css::util::NumberFormat::TEXT)
+ if (pNumFormatter->GetType(nStepFmt) == SvNumFormatType::TEXT)
nStepFmt = 0;
Control* pControl = nullptr;
@@ -564,8 +564,8 @@ void ScaleTabPage::SetNumFormat()
if( pNumFormatter )
{
- short eType = pNumFormatter->GetType( nFmt );
- if( eType == css::util::NumberFormat::DATE )
+ SvNumFormatType eType = pNumFormatter->GetType( nFmt );
+ if( eType == SvNumFormatType::DATE )
{
// for intervals use standard format for dates (so you can enter a number of days)
const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
@@ -574,23 +574,23 @@ void ScaleTabPage::SetNumFormat()
else
nFmt = pNumFormatter->GetStandardIndex();
}
- else if( eType == css::util::NumberFormat::DATETIME )
+ else if( eType == SvNumFormatType::DATETIME )
{
// for intervals use time format for date times
const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
if( pFormat )
- nFmt = pNumFormatter->GetStandardFormat( css::util::NumberFormat::TIME, pFormat->GetLanguage() );
+ nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME, pFormat->GetLanguage() );
else
- nFmt = pNumFormatter->GetStandardFormat( css::util::NumberFormat::TIME );
+ nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME );
}
- if( m_nAxisType == chart2::AxisType::DATE && ( eType != css::util::NumberFormat::DATE && eType != css::util::NumberFormat::DATETIME) )
+ if( m_nAxisType == chart2::AxisType::DATE && ( eType != SvNumFormatType::DATE && eType != SvNumFormatType::DATETIME) )
{
const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
if( pFormat )
- nFmt = pNumFormatter->GetStandardFormat( css::util::NumberFormat::DATE, pFormat->GetLanguage() );
+ nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::DATE, pFormat->GetLanguage() );
else
- nFmt = pNumFormatter->GetStandardFormat( css::util::NumberFormat::DATE );
+ nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::DATE );
m_pFmtFldMax->SetFormatKey( nFmt );
m_pFmtFldMin->SetFormatKey( nFmt );
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 7430402e9af5..5d1c3e7c6a90 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -1173,7 +1173,7 @@ sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const Reference< util::XN
SAL_WARN("chart2", "DiagramHelper::getDateTimeInputNumberFormat - no SvNumberFormatter");
else
{
- short nType;
+ SvNumFormatType nType;
// Obtain best matching date, time or datetime format.
nRet = pNumFormatter->GuessDateTimeFormat( nType, fNumber, LANGUAGE_SYSTEM);
// Obtain the corresponding edit format.
@@ -1190,7 +1190,7 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF
SvNumberFormatter* pNumFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
if( pNumFormatter )
{
- nRet = pNumFormatter->GetStandardFormat( util::NumberFormat::PERCENT, rLanguageTag.getLanguageType() );
+ nRet = pNumFormatter->GetStandardFormat( SvNumFormatType::PERCENT, rLanguageTag.getLanguageType() );
}
else
{
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index f0287be40e27..9a517007374d 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -145,11 +145,11 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
SvNumberFormatter *pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessComponentContext(), eUILang );
Color* pColor = nullptr;
const Date& rNullDate = pNumberFormatter->GetNullDate();
- sal_uInt32 nFormat = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::DATE, eUILang );
+ sal_uInt32 nFormat = pNumberFormatter->GetStandardFormat( SvNumFormatType::DATE, eUILang );
pNumberFormatter->GetOutputString( aDate - rNullDate, nFormat, aDateStr, &pColor );
- nFormat = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::TIME, eUILang );
+ nFormat = pNumberFormatter->GetStandardFormat( SvNumFormatType::TIME, eUILang );
pNumberFormatter->GetOutputString( aTime.GetTimeInDays(), nFormat, aTimeStr, &pColor );
delete pColor;
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index bae06ba9c1ca..cc7eb2c97f78 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -834,7 +834,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
pFormatDescriptor->Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, true));
if (!_pFormatter->IsTextFormat(_nFormatKey))
// text fields can only have text formats
- _nFormatKey = _pFormatter->GetStandardFormat(css::util::NumberFormat::TEXT,_pParent->GetSettings().GetLanguageTag().getLanguageType());
+ _nFormatKey = _pFormatter->GetStandardFormat(SvNumFormatType::TEXT,_pParent->GetSettings().GetLanguageTag().getLanguageType());
}
pFormatDescriptor->Put(SfxUInt32Item(SBA_DEF_FMTVALUE, _nFormatKey));
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 4435fcf490b9..21baa1593ee6 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -418,7 +418,7 @@ OUString SvxDateField::GetFormatted( Date const & aDate, SvxDateFormat eFormat,
nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_NNNNDMMMMYYYY, eLang );
break;
default:
- nFormatKey = rFormatter.GetStandardFormat( css::util::NumberFormat::DATE, eLang );
+ nFormatKey = rFormatter.GetStandardFormat( SvNumFormatType::DATE, eLang );
}
double fDiffDate = aDate - rFormatter.GetNullDate();
@@ -675,7 +675,7 @@ OUString SvxExtTimeField::GetFormatted( tools::Time const & aTime, SvxTimeFormat
// no builtin format available, try to insert or reuse
OUString aFormatCode( "HH:MM:SS.00 AM/PM" );
sal_Int32 nCheckPos;
- short nType;
+ SvNumFormatType nType;
rFormatter.PutandConvertEntry( aFormatCode, nCheckPos, nType,
nFormatKey, LANGUAGE_ENGLISH_US, eLang );
DBG_ASSERT( nCheckPos == 0, "SvxTimeFormat::HH12_MM_SS_00: could not insert format code" );
@@ -699,7 +699,7 @@ OUString SvxExtTimeField::GetFormatted( tools::Time const & aTime, SvxTimeFormat
break;
case SvxTimeFormat::Standard:
default:
- nFormatKey = rFormatter.GetStandardFormat( css::util::NumberFormat::TIME, eLang );
+ nFormatKey = rFormatter.GetStandardFormat( SvNumFormatType::TIME, eLang );
}
double fFracTime = aTime.GetTimeInDays();
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 8be81dbb32c1..5985f5f507d1 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -261,7 +261,7 @@ namespace pcr
getTypedControlWindow()->SetFormatter( getTypedControlWindow()->StandardFormatter() );
SvNumberFormatter* pFormatter = getTypedControlWindow()->GetFormatter();
- sal_uLong nStandardDateTimeFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::DATETIME, eSysLanguage );
+ sal_uLong nStandardDateTimeFormat = pFormatter->GetStandardFormat( SvNumFormatType::DATETIME, eSysLanguage );
getTypedControlWindow()->SetFormatKey( nStandardDateTimeFormat );
}
diff --git a/extensions/source/propctrlr/usercontrol.cxx b/extensions/source/propctrlr/usercontrol.cxx
index 7edad44a1367..213d61c6efa1 100644
--- a/extensions/source/propctrlr/usercontrol.cxx
+++ b/extensions/source/propctrlr/usercontrol.cxx
@@ -118,17 +118,17 @@ namespace pcr
double OFormatSampleControl::getPreviewValue( const SvNumberformat& i_rEntry )
{
double nValue = 1234.56789;
- switch ( i_rEntry.GetType() & ~css::util::NumberFormat::DEFINED )
+ switch ( i_rEntry.GetType() & ~SvNumFormatType::DEFINED )
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
{
Date aCurrentDate( Date::SYSTEM );
static css::util::Date STANDARD_DB_DATE(30,12,1899);
nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(aCurrentDate.GetDate()),STANDARD_DB_DATE);
}
break;
- case css::util::NumberFormat::TIME:
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::TIME:
+ case SvNumFormatType::DATETIME:
{
tools::Time aCurrentTime( tools::Time::SYSTEM );
nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime()));
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 0ee613dcd8f0..da9ac30cc136 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -52,7 +52,7 @@ class FormulaCompilerRecursionGuard
~FormulaCompilerRecursionGuard() { --rRecursion; }
};
-short lcl_GetRetFormat( OpCode eOpCode )
+SvNumFormatType lcl_GetRetFormat( OpCode eOpCode )
{
switch (eOpCode)
{
@@ -81,15 +81,15 @@ short lcl_GetRetFormat( OpCode eOpCode )
case ocIsEven:
case ocIsOdd:
case ocExact:
- return css::util::NumberFormat::LOGICAL;
+ return SvNumFormatType::LOGICAL;
case ocGetActDate:
case ocGetDate:
case ocEasterSunday :
- return css::util::NumberFormat::DATE;
+ return SvNumFormatType::DATE;
case ocGetActTime:
- return css::util::NumberFormat::DATETIME;
+ return SvNumFormatType::DATETIME;
case ocGetTime:
- return css::util::NumberFormat::TIME;
+ return SvNumFormatType::TIME;
case ocNPV:
case ocPV:
case ocSYD:
@@ -103,7 +103,7 @@ short lcl_GetRetFormat( OpCode eOpCode )
case ocPpmt:
case ocCumIpmt:
case ocCumPrinc:
- return css::util::NumberFormat::CURRENCY;
+ return SvNumFormatType::CURRENCY;
case ocRate:
case ocIRR:
case ocMIRR:
@@ -111,9 +111,9 @@ short lcl_GetRetFormat( OpCode eOpCode )
case ocEffect:
case ocNominal:
case ocPercentSign:
- return css::util::NumberFormat::PERCENT;
+ return SvNumFormatType::PERCENT;
default:
- return css::util::NumberFormat::NUMBER;
+ return SvNumFormatType::NUMBER;
}
}
@@ -716,7 +716,7 @@ FormulaCompiler::FormulaCompiler( FormulaTokenArray& rArr )
pStack( nullptr ),
eLastOp( ocPush ),
nRecursion( 0 ),
- nNumFmt( css::util::NumberFormat::UNDEFINED ),
+ nNumFmt( SvNumFormatType::UNDEFINED ),
pc( 0 ),
meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ),
bAutoCorrect( false ),
@@ -738,7 +738,7 @@ FormulaCompiler::FormulaCompiler()
pStack( nullptr ),
eLastOp( ocPush ),
nRecursion(0),
- nNumFmt( css::util::NumberFormat::UNDEFINED ),
+ nNumFmt( SvNumFormatType::UNDEFINED ),
pc( 0 ),
meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ),
bAutoCorrect( false ),
@@ -1417,7 +1417,7 @@ void FormulaCompiler::Factor()
}
else
{
- if( nNumFmt == css::util::NumberFormat::UNDEFINED )
+ if( nNumFmt == SvNumFormatType::UNDEFINED )
nNumFmt = lcl_GetRetFormat( eOp );
if ( IsOpCodeVolatile( eOp) )
@@ -1556,8 +1556,8 @@ void FormulaCompiler::Factor()
// standard handling of ocNot, ocNeg and 1-parameter opcodes
pFacToken = mpToken;
eOp = NextToken();
- if( nNumFmt == css::util::NumberFormat::UNDEFINED && eOp == ocNot )
- nNumFmt = css::util::NumberFormat::LOGICAL;
+ if( nNumFmt == SvNumFormatType::UNDEFINED && eOp == ocNot )
+ nNumFmt = SvNumFormatType::LOGICAL;
if (eOp == ocOpen)
{
NextToken();
@@ -2036,8 +2036,8 @@ bool FormulaCompiler::CompileTokenArray()
if ( bWasForced )
pArr->SetRecalcModeForced();
}
- if( nNumFmt == css::util::NumberFormat::UNDEFINED )
- nNumFmt = css::util::NumberFormat::NUMBER;
+ if( nNumFmt == SvNumFormatType::UNDEFINED )
+ nNumFmt = SvNumFormatType::NUMBER;
return glSubTotal;
}
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 07ff7cc59b6e..cfd759562d59 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -210,13 +210,13 @@ double & FormulaToken::GetDoubleAsReference()
return fVal;
}
-short FormulaToken::GetDoubleType() const
+sal_Int16 FormulaToken::GetDoubleType() const
{
SAL_WARN( "formula.core", "FormulaToken::GetDoubleType: virtual dummy called" );
return 0;
}
-void FormulaToken::SetDoubleType( short )
+void FormulaToken::SetDoubleType( sal_Int16 )
{
assert( !"virtual dummy called" );
}
@@ -1785,7 +1785,7 @@ void FormulaTokenArrayPlainIterator::AfterRemoveToken( sal_uInt16 nOffset, sal_u
double FormulaDoubleToken::GetDouble() const { return fDouble; }
double & FormulaDoubleToken::GetDoubleAsReference() { return fDouble; }
-short FormulaDoubleToken::GetDoubleType() const
+sal_Int16 FormulaDoubleToken::GetDoubleType() const
{
// This is a plain double value without type information, don't emit a
// warning via FormulaToken::GetDoubleType().
@@ -1797,12 +1797,12 @@ bool FormulaDoubleToken::operator==( const FormulaToken& r ) const
return FormulaToken::operator==( r ) && fDouble == r.GetDouble();
}
-short FormulaTypedDoubleToken::GetDoubleType() const
+sal_Int16 FormulaTypedDoubleToken::GetDoubleType() const
{
return mnType;
}
-void FormulaTypedDoubleToken::SetDoubleType( short nType )
+void FormulaTypedDoubleToken::SetDoubleType( sal_Int16 nType )
{
mnType = nType;
}
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 852e996dad79..26d996f374e8 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -52,6 +52,7 @@ namespace com { namespace sun { namespace star {
class CharClass;
enum class FormulaError : sal_uInt16;
+enum class SvNumFormatType : sal_Int16;
namespace formula
{
@@ -236,7 +237,7 @@ public:
static sal_Unicode GetNativeSymbolChar( OpCode eOp );
static bool IsMatrixFunction(OpCode _eOpCode); // if a function _always_ returns a Matrix
- short GetNumFormatType() const { return nNumFmt; }
+ SvNumFormatType GetNumFormatType() const { return nNumFmt; }
bool CompileTokenArray();
void CreateStringFromTokenArray( OUString& rFormula );
@@ -340,7 +341,7 @@ protected:
OpCode eLastOp;
short nRecursion; // GetToken() recursions
- short nNumFmt; // set during CompileTokenArray()
+ SvNumFormatType nNumFmt; // set during CompileTokenArray()
sal_uInt16 pc; // program counter
FormulaGrammar::Grammar meGrammar; // The grammar used, language plus convention.
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index c3144b4a2dcb..d464ec67d39e 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -183,8 +183,8 @@ public:
virtual void SetInForceArray( ParamClass c );
virtual double GetDouble() const;
virtual double& GetDoubleAsReference();
- virtual short GetDoubleType() const;
- virtual void SetDoubleType( short nType );
+ virtual sal_Int16 GetDoubleType() const;
+ virtual void SetDoubleType( sal_Int16 nType );
virtual svl::SharedString GetString() const;
virtual void SetString( const svl::SharedString& rStr );
virtual sal_uInt16 GetIndex() const;
@@ -304,7 +304,7 @@ public:
virtual FormulaToken* Clone() const override { return new FormulaDoubleToken(*this); }
virtual double GetDouble() const override;
virtual double& GetDoubleAsReference() override;
- virtual short GetDoubleType() const override; ///< always returns 0 for "not typed"
+ virtual sal_Int16 GetDoubleType() const override; ///< always returns 0 for "not typed"
virtual bool operator==( const FormulaToken& rToken ) const override;
DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaDoubleToken )
@@ -313,19 +313,19 @@ public:
class FORMULA_DLLPUBLIC FormulaTypedDoubleToken : public FormulaDoubleToken
{
private:
- short mnType; /**< Can hold, for example, a value
- of css::util::NumberFormat, or by
+ sal_Int16 mnType; /**< Can hold, for example, a value
+ of SvNumFormatType, or by
contract any other
classification. */
public:
- FormulaTypedDoubleToken( double f, short nType ) :
+ FormulaTypedDoubleToken( double f, sal_Int16 nType ) :
FormulaDoubleToken( f ), mnType( nType ) {}
FormulaTypedDoubleToken( const FormulaTypedDoubleToken& r ) :
FormulaDoubleToken( r ), mnType( r.mnType ) {}
virtual FormulaToken* Clone() const override { return new FormulaTypedDoubleToken(*this); }
- virtual short GetDoubleType() const override;
- virtual void SetDoubleType( short nType ) override;
+ virtual sal_Int16 GetDoubleType() const override;
+ virtual void SetDoubleType( sal_Int16 nType ) override;
virtual bool operator==( const FormulaToken& rToken ) const override;
DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaTypedDoubleToken )
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index a2ff78f90a34..6e7d196c2a61 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -32,6 +32,7 @@
#include <tools/link.hxx>
#include <svl/ondemand.hxx>
#include <svl/nfkeytab.hxx>
+#include <o3tl/typed_flags_set.hxx>
#include <map>
#include <memory>
@@ -61,6 +62,55 @@ constexpr sal_uInt32 NF_STANDARD_FORMAT_TEXT = SV_MAX_COUNT_STANDARD_FORMATS;
#define NUMBERFORMAT_ENTRY_NOT_FOUND (sal_uInt32)(0xffffffff) /// MAX_ULONG
+enum class SvNumFormatType : sal_Int16
+{
+ /** selects all number formats.
+ */
+ ALL = css::util::NumberFormat::ALL, // 0
+ /** selects only user-defined number formats.
+ */
+ DEFINED = css::util::NumberFormat::DEFINED, // 1
+ /** selects date formats.
+ */
+ DATE = css::util::NumberFormat::DATE, // 2
+ /** selects time formats.
+ */
+ TIME = css::util::NumberFormat::TIME, // 4
+ /** selects currency formats.
+ */
+ CURRENCY = css::util::NumberFormat::CURRENCY, // 8
+ /** selects decimal number formats.
+ */
+ NUMBER = css::util::NumberFormat::NUMBER, // 16
+ /** selects scientific number formats.
+ */
+ SCIENTIFIC = css::util::NumberFormat::SCIENTIFIC, // 32
+ /** selects number formats for fractions.
+ */
+ FRACTION = css::util::NumberFormat::FRACTION, // 64
+ /** selects percentage number formats.
+ */
+ PERCENT = css::util::NumberFormat::PERCENT, // 128
+ /** selects text number formats.
+ */
+ TEXT = css::util::NumberFormat::TEXT, // 256
+ /** selects number formats which contain date and time.
+ */
+ DATETIME = DATE | TIME, // 6
+ /** selects boolean number formats.
+ */
+ LOGICAL = css::util::NumberFormat::LOGICAL, // 1024
+ /** is used as a return value if no format exists.
+ */
+ UNDEFINED = css::util::NumberFormat::UNDEFINED, // 2048
+ /** @internal is used to flag an empty sub format.
+ @since LibreOffice 5.1
+ */
+ EMPTY = css::util::NumberFormat::EMPTY, // 4096
+};
+namespace o3tl {
+ template<> struct typed_flags<SvNumFormatType> : is_typed_flags<SvNumFormatType, 0x1dff> {};
+}
/** enum values for <method>SvNumberFormatter::GetFormatIndex</method>
@@ -361,26 +411,26 @@ public:
LanguageType GetLanguage() const;
// Determine whether two format types are input compatible or not
- static bool IsCompatible(short eOldType, short eNewType);
+ static bool IsCompatible(SvNumFormatType eOldType, SvNumFormatType eNewType);
/** Get table of formats of a specific type of a locale. A format FIndex is
tested whether it has the type and locale requested, if it doesn't
match FIndex returns the default format for the type/locale. If no
specific format is to be selected FIndex may be initialized to 0. */
- SvNumberFormatTable& GetEntryTable(short eType,
+ SvNumberFormatTable& GetEntryTable(SvNumFormatType eType,
sal_uInt32& FIndex,
LanguageType eLnge);
/** Get table of formats of a specific type of a language/country.
FIndex returns the default format of that type.
If the language/country was never touched before new entries are generated */
- SvNumberFormatTable& ChangeCL(short eType,
+ SvNumberFormatTable& ChangeCL(SvNumFormatType eType,
sal_uInt32& FIndex,
LanguageType eLnge);
/** Get table of formats of the same type as FIndex; eType and rLnge are
set accordingly. An unknown format is set to Standard/General */
- SvNumberFormatTable& GetFirstEntryTable(short& eType,
+ SvNumberFormatTable& GetFirstEntryTable(SvNumFormatType& eType,
sal_uInt32& FIndex,
LanguageType& rLnge);
@@ -400,14 +450,14 @@ public:
nType contains the type of the format.
nKey contains the index key of the format.
*/
- bool PutEntry( OUString& rString, sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey,
+ bool PutEntry( OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType, sal_uInt32& nKey,
LanguageType eLnge = LANGUAGE_DONTKNOW );
/** Same as <method>PutEntry</method> but the format code string is
considered to be of language/country eLnge and is converted to
language/country eNewLnge */
bool PutandConvertEntry( OUString& rString, sal_Int32& nCheckPos,
- short& nType, sal_uInt32& nKey,
+ SvNumFormatType& nType, sal_uInt32& nKey,
LanguageType eLnge, LanguageType eNewLnge,
bool bForExcelExport = false );
@@ -416,7 +466,7 @@ public:
converted to another System language/country eNewLnge. In this case
the automatic currency is converted too. */
bool PutandConvertEntrySystem( OUString& rString, sal_Int32& nCheckPos,
- short& nType, sal_uInt32& nKey,
+ SvNumFormatType& nType, sal_uInt32& nKey,
LanguageType eLnge, LanguageType eNewLnge );
/** Similar to <method>PutEntry</method> and
@@ -457,7 +507,7 @@ public:
and/or could not be converted.
*/
sal_uInt32 GetIndexPuttingAndConverting( OUString & rString, LanguageType eLnge,
- LanguageType eSysLnge, short & rType,
+ LanguageType eSysLnge, SvNumFormatType & rType,
bool & rNewInserted, sal_Int32 & rCheckPos );
/** Create a format code string using format nIndex as a template and
@@ -566,17 +616,17 @@ public:
sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
/// Return the format index of the default format of a type for language/country
- sal_uInt32 GetStandardFormat(short eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
+ sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
/** Return the format index of the default format of a type for language/country.
Maybe not the default format but a special builtin format, e.g. for
NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */
- sal_uInt32 GetStandardFormat( sal_uInt32 nFIndex, short eType, LanguageType eLnge );
+ sal_uInt32 GetStandardFormat( sal_uInt32 nFIndex, SvNumFormatType eType, LanguageType eLnge );
/** Return the format index of the default format of a type for language/country.
Maybe not the default format but a special builtin format, e.g. for
NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0 */
- sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, short eType,
+ sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
LanguageType eLnge );
/// Whether nFIndex is a special builtin format
@@ -589,10 +639,10 @@ public:
fNumber is assumed to be a date, time or datetime value, but unknown
which. Originally introduced for Chart databrowser editor, probably
should not be used otherwise. */
- sal_uInt32 GuessDateTimeFormat( short& rType, double fNumber, LanguageType eLnge );
+ sal_uInt32 GuessDateTimeFormat( SvNumFormatType& rType, double fNumber, LanguageType eLnge );
/** Return the corresponding edit format of a format. */
- sal_uInt32 GetEditFormat( double fNumber, sal_uInt32 nFIndex, short eType,
+ sal_uInt32 GetEditFormat( double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
LanguageType eLnge, SvNumberformat const * pFormat );
/// Return the reference date
@@ -603,7 +653,7 @@ public:
bool GetNoZero() const;
/** Get the type of a format (or css::util::NumberFormat::UNDEFINED if no entry),
but with css::util::NumberFormat::DEFINED masked out */
- short GetType(sal_uInt32 nFIndex) const;
+ SvNumFormatType GetType(sal_uInt32 nFIndex) const;
/// As the name says
void ClearMergeTable();
@@ -909,7 +959,7 @@ private:
// Return the default format for a given type and current locale.
// May ONLY be called from within GetStandardFormat().
- SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( short nType );
+ SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( SvNumFormatType nType );
// Return the index in a sequence of format codes matching an enum of
// NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index 2b4813184c9d..38479dfc6aef 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -46,7 +46,6 @@ enum SvNumberformatLimitOps
NUMBERFORMAT_OP_GE = 6 // Operator >=
};
-
struct ImpSvNumberformatInfo // Struct for FormatInfo
{
std::vector<OUString> sStrArray; // Array of symbols
@@ -55,7 +54,7 @@ struct ImpSvNumberformatInfo // Struct for FormatInfo
sal_uInt16 nCntPre; // Count of digits before decimal point
sal_uInt16 nCntPost; // Count of digits after decimal point
sal_uInt16 nCntExp; // Count of exponent digits, or AM/PM
- short eScannedType; // Type determined by scan
+ SvNumFormatType eScannedType; // Type determined by scan
bool bThousand; // Has group (AKA thousand) separator
void Copy( const ImpSvNumberformatInfo& rNumFor, sal_uInt16 nAnz );
@@ -176,12 +175,12 @@ public:
~SvNumberformat();
/// Get type of format, may include css::util::NumberFormat::DEFINED bit
- short GetType() const { return eType; }
+ SvNumFormatType GetType() const { return eType; }
/// Get type of format, does not include css::util::NumberFormat::DEFINED
- short GetMaskedType() const { return eType & ~css::util::NumberFormat::DEFINED; }
+ SvNumFormatType GetMaskedType() const { return eType & ~SvNumFormatType::DEFINED; }
- void SetType(const short eSetType) { eType = eSetType; }
+ void SetType(SvNumFormatType eSetType) { eType = eSetType; }
// Standard means the I18N defined standard format of this type
void SetStandard() { bStandard = true; }
bool IsStandard() const { return bStandard; }
@@ -233,12 +232,12 @@ public:
void GetOutputString( const OUString& sString, OUString& OutString, Color** ppColor );
// True if type text
- bool IsTextFormat() const { return (eType & css::util::NumberFormat::TEXT) != 0; }
+ bool IsTextFormat() const { return bool(eType & SvNumFormatType::TEXT); }
// True if 4th subformat present
bool HasTextFormat() const
{
return (NumFor[3].GetCount() > 0) ||
- (NumFor[3].Info().eScannedType == css::util::NumberFormat::TEXT);
+ (NumFor[3].Info().eScannedType == SvNumFormatType::TEXT);
}
void GetFormatSpecialInfo(bool& bThousand,
@@ -318,9 +317,9 @@ public:
sal_uInt16 GetNumForNumberElementCount( sal_uInt16 nNumFor ) const;
/** Get the scanned type of the specified subformat. */
- short GetNumForInfoScannedType( sal_uInt16 nNumFor ) const
+ SvNumFormatType GetNumForInfoScannedType( sal_uInt16 nNumFor ) const
{
- return (nNumFor < 4) ? NumFor[nNumFor].Info().eScannedType : css::util::NumberFormat::UNDEFINED;
+ return (nNumFor < 4) ? NumFor[nNumFor].Info().eScannedType : SvNumFormatType::UNDEFINED;
}
// Whether the second subformat code is really for negative numbers
@@ -427,7 +426,7 @@ public:
void GetConditions( SvNumberformatLimitOps& rOper1, double& rVal1,
SvNumberformatLimitOps& rOper2, double& rVal2 ) const;
Color* GetColor( sal_uInt16 nNumFor ) const;
- void GetNumForInfo( sal_uInt16 nNumFor, short& rScannedType,
+ void GetNumForInfo( sal_uInt16 nNumFor, SvNumFormatType& rScannedType,
bool& bThousand, sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt ) const;
// rAttr.Number not empty if NatNum attributes are to be stored
@@ -483,7 +482,7 @@ private:
LocaleType maLocale; // Language/country of the format, numeral shape and calendar type from Excel.
SvNumberformatLimitOps eOp1; // Operator for first condition
SvNumberformatLimitOps eOp2; // Operator for second condition
- short eType; // Type of format
+ SvNumFormatType eType; // Type of format
bool bAdditionalBuiltin; // If this is an additional built-in format defined by i18n
bool bStarFlag; // Take *n format as ESC n
bool bStandard; // If this is a default standard format
diff --git a/include/svx/numfmtsh.hxx b/include/svx/numfmtsh.hxx
index a7d0fb7662f1..da26e9cbf707 100644
--- a/include/svx/numfmtsh.hxx
+++ b/include/svx/numfmtsh.hxx
@@ -187,7 +187,7 @@ private:
std::vector<sal_uInt32> aDelList;
std::vector<sal_uInt32> aCurEntryList;
sal_uInt32 nCurFormatKey;
- short nCurCategory;
+ SvNumFormatType nCurCategory;
LanguageType eCurLanguage;
std::vector<sal_uInt16> aCurCurrencyList;
NfCurrencyEntry* pCurCurrencyEntry;
@@ -214,8 +214,8 @@ private:
SVX_DLLPRIVATE void GetPreviewString_Impl( OUString& rString,
Color*& rpColor );
- SVX_DLLPRIVATE static void PosToCategory_Impl(sal_uInt16 nPos, short& rCategory);
- SVX_DLLPRIVATE static void CategoryToPos_Impl(short nCategory, sal_uInt16& rPos);
+ SVX_DLLPRIVATE static void PosToCategory_Impl(sal_uInt16 nPos, SvNumFormatType& rCategory);
+ SVX_DLLPRIVATE static void CategoryToPos_Impl(SvNumFormatType nCategory, sal_uInt16& rPos);
};
#endif
diff --git a/oox/source/drawingml/chart/datasourcecontext.cxx b/oox/source/drawingml/chart/datasourcecontext.cxx
index 63779e71435f..527ee336f172 100644
--- a/oox/source/drawingml/chart/datasourcecontext.cxx
+++ b/oox/source/drawingml/chart/datasourcecontext.cxx
@@ -118,7 +118,7 @@ void DoubleSequenceContext::onCharacters( const OUString& rChars )
{
OUString aFormatCode = mrModel.maFormatCode;
sal_Int32 nCheckPos = 0;
- short nType;
+ SvNumFormatType nType;
pNumFrmt->PutEntry( aFormatCode, nCheckPos, nType, nKey );
bNoKey = (nCheckPos != 0);
}
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 60dfd3edf1d6..5c34279ad3c4 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -468,7 +468,7 @@ public:
void SetPatternArea( SCROW nStartRow, SCROW nEndRow,
const ScPatternAttr& rPatAttr );
void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
- const ScPatternAttr& rPattern, short nNewType );
+ const ScPatternAttr& rPattern, SvNumFormatType nNewType );
void ApplyStyle( SCROW nRow, const ScStyleSheet* rStyle );
void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 6e8011438d73..915f478f4bfa 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -46,6 +46,7 @@ struct ScDBQueryParamInternal;
struct ScDBQueryParamMatrix;
class ScFormulaCell;
struct ScInterpreterContext;
+enum class SvNumFormatType : sal_Int16;
class ScValueIterator // walk through all values in an area
{
@@ -61,7 +62,7 @@ class ScValueIterator // walk through all values in an area
SCTAB mnTab;
SCROW nAttrEndRow;
SubtotalFlags mnSubTotalFlags;
- short nNumFmtType;
+ SvNumFormatType nNumFmtType;
bool bNumValid;
bool bCalcAsShown;
bool bTextAsZero;
@@ -85,7 +86,7 @@ public:
ScDocument* pDocument, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE,
bool bTextAsZero = false );
- void GetCurNumFmtInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex );
+ void GetCurNumFmtInfo( const ScInterpreterContext& rContext, SvNumFormatType& nType, sal_uInt32& nIndex );
/// Does NOT reset rValue if no value found!
bool GetFirst( double& rValue, FormulaError& rErr );
@@ -148,7 +149,7 @@ private:
SCROW nRow;
SCROW nAttrEndRow;
SCTAB nTab;
- sal_uInt32 nNumFmtType;
+ SvNumFormatType nNumFmtType;
bool bCalcAsShown;
};
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ac3025ffb1d8..4d908c9e20cb 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1120,7 +1120,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, sal_uInt32& nType, sal_uInt32& nIndex, const ScAddress& rPos ) const;
+ void GetNumberFormatInfo( const ScInterpreterContext& rContext, SvNumFormatType& 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;
@@ -1680,7 +1680,7 @@ public:
SC_DLLPUBLIC void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
const ScMarkData& rMark,
const ScPatternAttr& rPattern,
- short nNewType );
+ SvNumFormatType nNewType );
void ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab,
const ScStyleSheet& rStyle);
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 8601d7177aae..08517c167d0a 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -35,6 +35,7 @@ struct ScQueryParam;
class ScDPObject;
class ScDPItemData;
struct ScDPNumGroupInfo;
+enum class SvNumFormatType : sal_Int16;
/**
* This class represents the cached data part of the datapilot cache table
@@ -98,7 +99,7 @@ public:
virtual bool first() = 0;
virtual bool next() = 0;
virtual void finish() = 0;
- virtual void getValue(long nCol, ScDPItemData& rData, short& rNumType) const = 0;
+ virtual void getValue(long nCol, ScDPItemData& rData, SvNumFormatType& rNumType) const = 0;
virtual ~DBConnector() {}
};
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 19414e2a2084..70cf8f99a65f 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -104,7 +104,7 @@ public:
struct CellFormat
{
bool mbIsSet;
- short mnType;
+ SvNumFormatType mnType;
sal_uLong mnIndex;
explicit CellFormat();
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 867bb89692d2..1eaf33649d77 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -51,6 +51,7 @@ class UpdatedRangeNames;
class ScFormulaCell;
class ScProgress;
class ScTokenArray;
+enum class SvNumFormatType : sal_Int16;
struct SC_DLLPUBLIC ScFormulaCellGroup
{
@@ -66,7 +67,7 @@ public:
ScFormulaCell *mpTopCell;
SCROW mnLength; // How many of these do we have ?
sal_Int32 mnWeight;
- short mnFormatType;
+ SvNumFormatType mnFormatType;
bool mbInvariant:1;
bool mbSubTotal:1;
@@ -118,7 +119,7 @@ private:
ScFormulaCell* pPreviousTrack;
ScFormulaCell* pNextTrack;
sal_uInt16 nSeenInIteration; // Iteration cycle in which the cell was last encountered
- short nFormatType;
+ SvNumFormatType nFormatType;
ScMatrixMode cMatrixFlag;
bool bDirty : 1; // Must be (re)calculated
bool bChanged : 1; // Whether something changed regarding display/representation
@@ -221,7 +222,7 @@ public:
void SetNeedsDirty( bool bVar );
void SetNeedNumberFormat( bool bVal );
bool NeedsNumberFormat() const { return mbNeedsNumberFormat;}
- short GetFormatType() const { return nFormatType; }
+ SvNumFormatType GetFormatType() const { return nFormatType; }
void Compile(const OUString& rFormula,
bool bNoListening,
const formula::FormulaGrammar::Grammar );
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 879902d5758f..fdb05f367094 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -38,6 +38,7 @@ class Color;
struct ScCalcConfig;
enum class SvtScriptType;
enum class FormulaError : sal_uInt16;
+enum class SvNumFormatType : sal_Int16;
#define SC_COLLATOR_IGNORES css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE
@@ -575,7 +576,7 @@ public:
const SfxObjectShell* pShell );
SC_DLLPUBLIC static OUString GetDocTabName( const OUString& rFileName,
const OUString& rTabName );
- SC_DLLPUBLIC static sal_uInt32 GetStandardFormat( SvNumberFormatter&, sal_uInt32 nFormat, short nType );
+ SC_DLLPUBLIC static sal_uInt32 GetStandardFormat( SvNumberFormatter&, sal_uInt32 nFormat, SvNumFormatType nType );
SC_DLLPUBLIC static sal_uInt16 GetStandardRowHeight();
SC_DLLPUBLIC static double nScreenPPTX;
@@ -806,13 +807,13 @@ public:
@param rCurFmtType
Can be assigned a format type in case a date or time or date+time
- string was converted, e.g. css::util::NumberFormat::DATE or
- css::util::NumberFormat::TIME or a combination thereof.
+ string was converted, e.g. SvNumFormatType::DATE or
+ SvNumFormatType::TIME or a combination thereof.
*/
static double ConvertStringToValue( const OUString& rStr, const ScCalcConfig& rConfig,
FormulaError & rError, FormulaError nStringNoValueError,
- SvNumberFormatter* pFormatter, sal_uInt32 & rCurFmtType );
+ SvNumberFormatter* pFormatter, SvNumFormatType & rCurFmtType );
};
diff --git a/sc/inc/simpleformulacalc.hxx b/sc/inc/simpleformulacalc.hxx
index 600507bcb9d0..f14408aa190f 100644
--- a/sc/inc/simpleformulacalc.hxx
+++ b/sc/inc/simpleformulacalc.hxx
@@ -22,7 +22,7 @@ class ScTokenArray;
class ScSimpleFormulaCalculator
{
private:
- short mnFormatType;
+ SvNumFormatType mnFormatType;
bool mbCalculated;
std::unique_ptr<ScTokenArray> mpCode;
@@ -47,7 +47,7 @@ public:
FormulaError GetErrCode();
double GetValue();
svl::SharedString GetString();
- short GetFormatType() const { return mnFormatType; }
+ SvNumFormatType GetFormatType() const { return mnFormatType; }
bool HasColRowName();
diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx
index 005a99713f2f..34c4ce246b9f 100644
--- a/sc/inc/stringutil.hxx
+++ b/sc/inc/stringutil.hxx
@@ -26,6 +26,7 @@
#include "types.hxx"
class SvNumberFormatter;
+enum class SvNumFormatType : sal_Int16;
/**
* Store parameters used in the ScDocument::SetString() method. Various
@@ -115,7 +116,7 @@ struct ScInputStringType
OUString maText;
double mfValue;
- short mnFormatType;
+ SvNumFormatType mnFormatType;
};
class ScStringUtil
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 9cd2342ce103..12a961b59a59 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -707,7 +707,7 @@ public:
}
void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
- const ScPatternAttr& rPattern, short nNewType );
+ const ScPatternAttr& rPattern, SvNumFormatType nNewType );
void AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
void RemoveCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index f03bb90fd470..6c21736a19b0 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6745,7 +6745,7 @@ void Test::checkPrecisionAsShown( OUString& rCode, double fValue, double fExpect
if ( nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
{
sal_Int32 nCheckPos = 0;
- short nType;
+ SvNumFormatType nType;
pFormatter->PutEntry( rCode, nCheckPos, nType, nFormat );
CPPUNIT_ASSERT_EQUAL( nCheckPos, sal_Int32(0) );
}
diff --git a/sc/source/core/data/clipcontext.cxx b/sc/source/core/data/clipcontext.cxx
index 308e0dc91684..6bdabb5bdc82 100644
--- a/sc/source/core/data/clipcontext.cxx
+++ b/sc/source/core/data/clipcontext.cxx
@@ -336,8 +336,8 @@ bool CopyFromClipContext::isCloneNotes() const
bool CopyFromClipContext::isDateCell( const ScColumn& rCol, SCROW nRow ) const
{
sal_uLong nNumIndex = static_cast<const SfxUInt32Item&>(rCol.GetAttr(nRow, ATTR_VALUE_FORMAT)).GetValue();
- short nType = mpClipDoc->GetFormatTable()->GetType(nNumIndex);
- return (nType == css::util::NumberFormat::DATE) || (nType == css::util::NumberFormat::TIME) || (nType == css::util::NumberFormat::DATETIME);
+ SvNumFormatType nType = mpClipDoc->GetFormatTable()->GetType(nNumIndex);
+ return (nType == SvNumFormatType::DATE) || (nType == SvNumFormatType::TIME) || (nType == SvNumFormatType::DATETIME);
}
CopyToClipContext::CopyToClipContext(
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 73afe1a810f8..2ade243a8682 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -522,7 +522,7 @@ void ScColumn::ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPattern
}
void ScColumn::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
- const ScPatternAttr& rPattern, short nNewType )
+ const ScPatternAttr& rPattern, SvNumFormatType nNewType )
{
const SfxItemSet* pSet = &rPattern.GetItemSet();
SfxItemPoolCache aCache( pDocument->GetPool(), pSet );
@@ -534,7 +534,7 @@ void ScColumn::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
const ScPatternAttr* pPattern = pAttrArray->GetPatternRange(
nRow1, nRow2, nRow );
sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter );
- short nOldType = pFormatter->GetType( nFormat );
+ SvNumFormatType nOldType = pFormatter->GetType( nFormat );
if ( nOldType == nNewType || SvNumberFormatter::IsCompatible( nOldType, nNewType ) )
nRow = nRow2;
else
@@ -1233,8 +1233,8 @@ namespace {
bool canCopyValue(const ScDocument& rDoc, const ScAddress& rPos, InsertDeleteFlags nFlags)
{
sal_uInt32 nNumIndex = static_cast<const SfxUInt32Item*>(rDoc.GetAttr(rPos, ATTR_VALUE_FORMAT))->GetValue();
- short nType = rDoc.GetFormatTable()->GetType(nNumIndex);
- if ((nType == css::util::NumberFormat::DATE) || (nType == css::util::NumberFormat::TIME) || (nType == css::util::NumberFormat::DATETIME))
+ SvNumFormatType nType = rDoc.GetFormatTable()->GetType(nNumIndex);
+ if ((nType == SvNumFormatType::DATE) || (nType == SvNumFormatType::TIME) || (nType == SvNumFormatType::DATETIME))
return ((nFlags & InsertDeleteFlags::DATETIME) != InsertDeleteFlags::NONE);
return (nFlags & InsertDeleteFlags::VALUE) != InsertDeleteFlags::NONE;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 178793b5cf69..c04244f31750 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -650,11 +650,11 @@ public:
bool isDateTime(size_t position)
{
- short nType = mrDoc.GetFormatTable()->GetType(static_cast<const SfxUInt32Item&>(
+ SvNumFormatType nType = mrDoc.GetFormatTable()->GetType(static_cast<const SfxUInt32Item&>(
mrCol.GetAttr(position, ATTR_VALUE_FORMAT)).GetValue());
- return (nType == css::util::NumberFormat::DATE) || (nType == css::util::NumberFormat::TIME) ||
- (nType == css::util::NumberFormat::DATETIME);
+ return (nType == SvNumFormatType::DATE) || (nType == SvNumFormatType::TIME) ||
+ (nType == SvNumFormatType::DATETIME);
}
void endFormulas()
@@ -1670,7 +1670,7 @@ namespace {
void applyTextNumFormat( ScColumn& rCol, SCROW nRow, SvNumberFormatter* pFormatter )
{
- sal_uInt32 nFormat = pFormatter->GetStandardFormat(css::util::NumberFormat::TEXT);
+ sal_uInt32 nFormat = pFormatter->GetStandardFormat(SvNumFormatType::TEXT);
ScPatternAttr aNewAttrs(rCol.GetDoc().GetPool());
SfxItemSet& rSet = aNewAttrs.GetItemSet();
rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nFormat));
@@ -1702,7 +1702,7 @@ bool ScColumn::ParseString(
nIndex = nOldIndex = GetNumberFormat( pDocument->GetNonThreadedContext(), nRow );
if ( rString.getLength() > 1
- && aParam.mpNumFormatter->GetType(nIndex) != css::util::NumberFormat::TEXT )
+ && aParam.mpNumFormatter->GetType(nIndex) != SvNumFormatType::TEXT )
cFirstChar = rString[0];
else
cFirstChar = 0; // Text
@@ -1772,9 +1772,9 @@ bool ScColumn::ParseString(
bool bOverwrite = false;
if ( pOldFormat )
{
- short nOldType = pOldFormat->GetMaskedType();
- if ( nOldType == css::util::NumberFormat::NUMBER || nOldType == css::util::NumberFormat::DATE ||
- nOldType == css::util::NumberFormat::TIME || nOldType == css::util::NumberFormat::LOGICAL )
+ SvNumFormatType nOldType = pOldFormat->GetMaskedType();
+ if ( nOldType == SvNumFormatType::NUMBER || nOldType == SvNumFormatType::DATE ||
+ nOldType == SvNumFormatType::TIME || nOldType == SvNumFormatType::LOGICAL )
{
if ( nOldIndex == aParam.mpNumFormatter->GetStandardFormat(
nOldType, pOldFormat->GetLanguage() ) )
@@ -1783,7 +1783,7 @@ bool ScColumn::ParseString(
}
}
}
- if ( !bOverwrite && aParam.mpNumFormatter->GetType( nIndex ) == css::util::NumberFormat::LOGICAL )
+ if ( !bOverwrite && aParam.mpNumFormatter->GetType( nIndex ) == SvNumFormatType::LOGICAL )
{
bOverwrite = true; // overwrite anything if boolean was detected
}
@@ -2102,9 +2102,9 @@ class FilterEntriesHandler
;
}
- short nType = pFormatter->GetType(nFormat);
+ SvNumFormatType nType = pFormatter->GetType(nFormat);
bool bDate = false;
- if ((nType & css::util::NumberFormat::DATE) && !(nType & css::util::NumberFormat::TIME))
+ if ((nType & SvNumFormatType::DATE) && !(nType & SvNumFormatType::TIME))
{
// special case for date values. Disregard the time
// element if the number format is of date type.
diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx
index ce72695fedae..dc7c99c8f1f4 100644
--- a/sc/source/core/data/dbdocutl.cxx
+++ b/sc/source/core/data/dbdocutl.cxx
@@ -56,7 +56,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
case sdbc::DataType::BOOLEAN:
//TODO: use language from doc (here, date/time and currency)?
nFormatIndex = pDoc->GetFormatTable()->GetStandardFormat(
- css::util::NumberFormat::LOGICAL, ScGlobal::eLnge );
+ SvNumFormatType::LOGICAL, ScGlobal::eLnge );
nVal = (xRow->getBoolean(nRowPos) ? 1 : 0);
bEmptyFlag = ( nVal == 0.0 ) && xRow->wasNull();
bValue = true;
@@ -94,7 +94,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
{
SvNumberFormatter* pFormTable = pDoc->GetFormatTable();
nFormatIndex = pFormTable->GetStandardFormat(
- css::util::NumberFormat::DATE, ScGlobal::eLnge );
+ SvNumFormatType::DATE, ScGlobal::eLnge );
nVal = Date( aDate ) - pFormTable->GetNullDate();
}
bValue = true;
@@ -105,7 +105,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
{
SvNumberFormatter* pFormTable = pDoc->GetFormatTable();
nFormatIndex = pFormTable->GetStandardFormat(
- css::util::NumberFormat::TIME, ScGlobal::eLnge );
+ SvNumFormatType::TIME, ScGlobal::eLnge );
util::Time aTime = xRow->getTime(nRowPos);
nVal = aTime.Hours / static_cast<double>(::tools::Time::hourPerDay) +
@@ -121,7 +121,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
{
SvNumberFormatter* pFormTable = pDoc->GetFormatTable();
nFormatIndex = pFormTable->GetStandardFormat(
- css::util::NumberFormat::DATETIME, ScGlobal::eLnge );
+ SvNumFormatType::DATETIME, ScGlobal::eLnge );
util::DateTime aStamp = xRow->getTimestamp(nRowPos);
nVal = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) -
@@ -153,7 +153,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
if ( bValue && bCurrency )
nFormatIndex = pDoc->GetFormatTable()->GetStandardFormat(
- css::util::NumberFormat::CURRENCY, ScGlobal::eLnge );
+ SvNumFormatType::CURRENCY, ScGlobal::eLnge );
ScAddress aPos(nCol, nRow, nTab);
if (bEmptyFlag)
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 13abb17a9fc4..c240368d4aa4 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -107,7 +107,7 @@ ScValueIterator::ScValueIterator( ScDocument* pDocument, const ScRange& rRange,
, mnTab(0)
, nAttrEndRow(0)
, mnSubTotalFlags(nSubTotalFlags)
- , nNumFmtType(css::util::NumberFormat::UNDEFINED)
+ , nNumFmtType(SvNumFormatType::UNDEFINED)
, bNumValid(false)
, bCalcAsShown(pDocument->GetDocOptions().IsCalcAsShown())
, bTextAsZero(bTextZero)
@@ -246,7 +246,7 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr)
{
rErr = FormulaError::NONE;
rValue = 0.0;
- nNumFmtType = css::util::NumberFormat::NUMBER;
+ nNumFmtType = SvNumFormatType::NUMBER;
nNumFmtIndex = 0;
bNumValid = true;
return true;
@@ -262,7 +262,7 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr)
}
}
-void ScValueIterator::GetCurNumFmtInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex )
+void ScValueIterator::GetCurNumFmtInfo( const ScInterpreterContext& rContext, SvNumFormatType& nType, sal_uInt32& nIndex )
{
if (!bNumValid && mnTab < pDoc->GetTableCount())
{
@@ -347,7 +347,7 @@ ScDBQueryDataIterator::DataAccessInternal::DataAccessInternal(ScDBQueryParamInte
, nRow(mpParam->nRow1)
, nAttrEndRow(0)
, nTab(mpParam->nTab)
- , nNumFmtType(0)
+ , nNumFmtType(SvNumFormatType::ALL)
, bCalcAsShown(pDoc->GetDocOptions().IsCalcAsShown())
{
SCSIZE i;
@@ -420,7 +420,7 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue)
nAttrEndRow, pNewAttrArray, nRow, mpDoc );
rValue.mfValue = mpDoc->RoundValueAsShown( rValue.mfValue, nNumFormat );
}
- nNumFmtType = css::util::NumberFormat::NUMBER;
+ nNumFmtType = SvNumFormatType::NUMBER;
nNumFmtIndex = 0;
rValue.mnError = FormulaError::NONE;
return true; // Found it!
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 4f13528d7581..c8a71a25bd88 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -656,9 +656,9 @@ bool ScDocument::GetSelectionFunction( ScSubTotalFunc eFunc,
double ScDocument::RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const
{
const SvNumberformat* pFormat = GetFormatTable()->GetEntry( nFormat );
- short nType;
- if (pFormat && (nType = pFormat->GetMaskedType()) != css::util::NumberFormat::DATE
- && nType != css::util::NumberFormat::TIME && nType != css::util::NumberFormat::DATETIME )
+ SvNumFormatType nType;
+ if (pFormat && (nType = pFormat->GetMaskedType()) != SvNumFormatType::DATE
+ && nType != SvNumFormatType::TIME && nType != SvNumFormatType::DATETIME )
{
short nPrecision;
if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0)
@@ -667,10 +667,10 @@ double ScDocument::RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const
nPrecision = (short)pFormat->GetFormatPrecision( nIdx );
switch ( nType )
{
- case css::util::NumberFormat::PERCENT: // 0.41% == 0.0041
+ case SvNumFormatType::PERCENT: // 0.41% == 0.0041
nPrecision += 2;
break;
- case css::util::NumberFormat::SCIENTIFIC: // 1.23e-3 == 0.00123
+ case SvNumFormatType::SCIENTIFIC: // 1.23e-3 == 0.00123
{
short nExp = 0;
if ( fVal > 0.0 )
@@ -691,16 +691,17 @@ double ScDocument::RoundValueAsShown( double fVal, sal_uInt32 nFormat ) const
}
break;
}
- case css::util::NumberFormat::FRACTION: // get value of fraction representation
+ case SvNumFormatType::FRACTION: // get value of fraction representation
{
return pFormat->GetRoundFractionValue( fVal );
}
- case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::NUMBER:
+ case SvNumFormatType::CURRENCY:
{ // tdf#106253 Thousands divisors for format "0,"
nPrecision -= pFormat->GetThousandDivisorPrecision( nIdx );
break;
}
+ default: break;
}
}
else
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f81fbeb1ecf6..1a7f14d95ba5 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3591,7 +3591,7 @@ FormulaError ScDocument::GetStringForFormula( const ScAddress& rPos, OUString& r
{
double fVal = pFCell->GetValue();
sal_uInt32 nIndex = pFormatter->GetStandardFormat(
- css::util::NumberFormat::NUMBER,
+ SvNumFormatType::NUMBER,
ScGlobal::eLnge);
pFormatter->GetInputLineString(fVal, nIndex, aStr);
}
@@ -3603,7 +3603,7 @@ FormulaError ScDocument::GetStringForFormula( const ScAddress& rPos, OUString& r
{
double fVal = aCell.mfValue;
sal_uInt32 nIndex = pFormatter->GetStandardFormat(
- css::util::NumberFormat::NUMBER,
+ SvNumFormatType::NUMBER,
ScGlobal::eLnge);
pFormatter->GetInputLineString(fVal, nIndex, aStr);
}
@@ -3711,7 +3711,7 @@ void ScDocument::SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberForma
maTabs[nTab]->SetNumberFormat(rPos.Col(), rPos.Row(), nNumberFormat);
}
-void ScDocument::GetNumberFormatInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex,
+void ScDocument::GetNumberFormatInfo( const ScInterpreterContext& rContext, SvNumFormatType& nType, sal_uInt32& nIndex,
const ScAddress& rPos ) const
{
SCTAB nTab = rPos.Tab();
@@ -3722,7 +3722,7 @@ void ScDocument::GetNumberFormatInfo( const ScInterpreterContext& rContext, sal_
}
else
{
- nType = css::util::NumberFormat::UNDEFINED;
+ nType = SvNumFormatType::UNDEFINED;
nIndex = 0;
}
}
@@ -4783,7 +4783,7 @@ void ScDocument::ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow,
}
void ScDocument::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
- const ScMarkData& rMark, const ScPatternAttr& rPattern, short nNewType )
+ const ScMarkData& rMark, const ScPatternAttr& rPattern, SvNumFormatType nNewType )
{
SCTAB nMax = static_cast<SCTAB>(maTabs.size());
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index ca4672f4ca61..c104a68f2aa9 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -652,7 +652,7 @@ bool ScDPCache::InitFromDataBase(DBConnector& rDB)
SCROW nRow = 0;
do
{
- short nFormatType = css::util::NumberFormat::UNDEFINED;
+ SvNumFormatType nFormatType = SvNumFormatType::UNDEFINED;
aData.SetEmpty();
rDB.getValue(nCol, aData, nFormatType);
aBuckets.emplace_back(aData, nRow);
@@ -1102,8 +1102,8 @@ bool ScDPCache::IsDateDimension( long nDim ) const
if (!pFormatter)
return false;
- short eType = pFormatter->GetType(maFields[nDim]->mnNumFormat);
- return (eType == css::util::NumberFormat::DATE) || (eType == css::util::NumberFormat::DATETIME);
+ SvNumFormatType eType = pFormatter->GetType(maFields[nDim]->mnNumFormat);
+ return (eType == SvNumFormatType::DATE) || (eType == SvNumFormatType::DATETIME);
}
long ScDPCache::GetDimMemberCount(long nDim) const
@@ -1201,13 +1201,13 @@ sal_uInt32 ScDPCache::GetLocaleIndependentFormat( SvNumberFormatter& rFormatter,
// Use en-US locale for all.
switch (rFormatter.GetType( nNumFormat))
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
return rFormatter.GetFormatIndex( NF_DATE_ISO_YYYYMMDD, LANGUAGE_ENGLISH_US);
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
return rFormatter.GetFormatIndex( NF_TIME_HHMMSS, LANGUAGE_ENGLISH_US);
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
return rFormatter.GetFormatIndex( NF_DATETIME_ISO_YYYYMMDD_HHMMSS, LANGUAGE_ENGLISH_US);
break;
default:
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 8486df51d431..8d3dd0ef2759 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -123,7 +123,7 @@ public:
bool isValid() const;
- virtual void getValue(long nCol, ScDPItemData &rData, short& rNumType) const override;
+ virtual void getValue(long nCol, ScDPItemData &rData, SvNumFormatType& rNumType) const override;
virtual OUString getColumnLabel(long nCol) const override;
virtual long getColumnCount() const override;
virtual bool first() override;
@@ -171,9 +171,9 @@ OUString DBConnector::getColumnLabel(long nCol) const
return mxMetaData->getColumnLabel(nCol+1);
}
-void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) const
+void DBConnector::getValue(long nCol, ScDPItemData &rData, SvNumFormatType& rNumType) const
{
- rNumType = css::util::NumberFormat::NUMBER;
+ rNumType = SvNumFormatType::NUMBER;
sal_Int32 nType = mxMetaData->getColumnType(nCol+1);
try
@@ -184,7 +184,7 @@ void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) cons
case sdbc::DataType::BIT:
case sdbc::DataType::BOOLEAN:
{
- rNumType = css::util::NumberFormat::LOGICAL;
+ rNumType = SvNumFormatType::LOGICAL;
fValue = mxRow->getBoolean(nCol+1) ? 1 : 0;
rData.SetValue(fValue);
break;
@@ -206,7 +206,7 @@ void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) cons
}
case sdbc::DataType::DATE:
{
- rNumType = css::util::NumberFormat::DATE;
+ rNumType = SvNumFormatType::DATE;
util::Date aDate = mxRow->getDate(nCol+1);
fValue = Date(aDate.Day, aDate.Month, aDate.Year) - maNullDate;
@@ -215,7 +215,7 @@ void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) cons
}
case sdbc::DataType::TIME:
{
- rNumType = css::util::NumberFormat::TIME;
+ rNumType = SvNumFormatType::TIME;
util::Time aTime = mxRow->getTime(nCol+1);
fValue = aTime.Hours / static_cast<double>(::tools::Time::hourPerDay) +
@@ -227,7 +227,7 @@ void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) cons
}
case sdbc::DataType::TIMESTAMP:
{
- rNumType = css::util::NumberFormat::DATETIME;
+ rNumType = SvNumFormatType::DATETIME;
util::DateTime aStamp = mxRow->getTimestamp(nCol+1);
fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - maNullDate ) +
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index 95e4a8beb3e1..3cbc9b28d938 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_uInt32 nFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::DATE, ScGlobal::eLnge );
+ sal_uInt32 nFormat = pFormatter->GetStandardFormat( SvNumFormatType::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_uInt32 nFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::DATE, ScGlobal::eLnge );
+ sal_uInt32 nFormat = pFormatter->GetStandardFormat( SvNumFormatType::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 071ec5b41923..a43a737d2edd 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -524,7 +524,7 @@ ScFormulaCellGroup::ScFormulaCellGroup() :
mpTopCell(nullptr),
mnLength(0),
mnWeight(0),
- mnFormatType(css::util::NumberFormat::NUMBER),
+ mnFormatType(SvNumFormatType::NUMBER),
mbInvariant(false),
mbSubTotal(false),
meCalcState(sc::GroupCalcEnabled)
@@ -611,7 +611,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos ) :
pPreviousTrack(nullptr),
pNextTrack(nullptr),
nSeenInIteration(0),
- nFormatType(css::util::NumberFormat::NUMBER),
+ nFormatType(SvNumFormatType::NUMBER),
cMatrixFlag(ScMatrixMode::NONE),
bDirty(false),
bChanged(false),
@@ -642,7 +642,7 @@ ScFormulaCell::ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos,
pPreviousTrack(nullptr),
pNextTrack(nullptr),
nSeenInIteration(0),
- nFormatType ( css::util::NumberFormat::NUMBER ),
+ nFormatType ( SvNumFormatType::NUMBER ),
cMatrixFlag ( cMatInd ),
bDirty( true ), // -> Because of the use of the Auto Pilot Function was: cMatInd != 0
bChanged( false ),
@@ -676,7 +676,7 @@ ScFormulaCell::ScFormulaCell(
pPreviousTrack(nullptr),
pNextTrack(nullptr),
nSeenInIteration(0),
- nFormatType ( css::util::NumberFormat::NUMBER ),
+ nFormatType ( SvNumFormatType::NUMBER ),
cMatrixFlag ( cMatInd ),
bDirty( true ),
bChanged( false ),
@@ -725,7 +725,7 @@ ScFormulaCell::ScFormulaCell(
pPreviousTrack(nullptr),
pNextTrack(nullptr),
nSeenInIteration(0),
- nFormatType ( css::util::NumberFormat::NUMBER ),
+ nFormatType ( SvNumFormatType::NUMBER ),
cMatrixFlag ( cMatInd ),
bDirty( true ),
bChanged( false ),
@@ -1896,8 +1896,8 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
if (bForceNumberFormat)
{
sal_uInt32 nOldFormatIndex = NUMBERFORMAT_ENTRY_NOT_FOUND;
- const short nRetType = pInterpreter->GetRetFormatType();
- if (nRetType == css::util::NumberFormat::LOGICAL)
+ const SvNumFormatType nRetType = pInterpreter->GetRetFormatType();
+ if (nRetType == SvNumFormatType::LOGICAL)
{
double fVal;
if ((fVal = aNewResult.GetDouble()) != 1.0 && fVal != 0.0)
@@ -1908,20 +1908,21 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
nFormatType = pDocument->GetFormatTable()->GetType( nOldFormatIndex);
switch (nFormatType)
{
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::SCIENTIFIC:
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::PERCENT:
+ case SvNumFormatType::CURRENCY:
+ case SvNumFormatType::SCIENTIFIC:
+ case SvNumFormatType::FRACTION:
bForceNumberFormat = false;
break;
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::NUMBER:
if ((nOldFormatIndex % SV_COUNTRY_LANGUAGE_OFFSET) != 0)
bForceNumberFormat = false;
break;
+ default: break;
}
}
}
- else if (nRetType == css::util::NumberFormat::TEXT)
+ else if (nRetType == SvNumFormatType::TEXT)
{
bForceNumberFormat = false;
}
@@ -1941,16 +1942,16 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
if( mbNeedsNumberFormat || bForceNumberFormat )
{
bool bSetFormat = true;
- const short nOldFormatType = nFormatType;
+ const SvNumFormatType nOldFormatType = nFormatType;
nFormatType = pInterpreter->GetRetFormatType();
sal_uInt32 nFormatIndex = pInterpreter->GetRetFormatIndex();
- if (nFormatType == css::util::NumberFormat::TEXT)
+ if (nFormatType == SvNumFormatType::TEXT)
{
// Don't set text format as hard format.
bSetFormat = false;
}
- else if (nFormatType == css::util::NumberFormat::LOGICAL && cMatrixFlag != ScMatrixMode::NONE)
+ else if (nFormatType == SvNumFormatType::LOGICAL && cMatrixFlag != ScMatrixMode::NONE)
{
// In a matrix range do not set an (inherited) logical format
// as hard format if the value does not represent a strict TRUE
@@ -1974,7 +1975,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
else if ((fVal = aNewResult.GetDouble()) != 1.0 && fVal != 0.0)
{
bSetFormat = false;
- nFormatType = css::util::NumberFormat::NUMBER;
+ nFormatType = SvNumFormatType::NUMBER;
}
}
}
@@ -2060,9 +2061,9 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
// Precision as shown?
if ( aResult.IsValue() && pInterpreter->GetError() == FormulaError::NONE
&& pDocument->GetDocOptions().IsCalcAsShown()
- && nFormatType != css::util::NumberFormat::DATE
- && nFormatType != css::util::NumberFormat::TIME
- && nFormatType != css::util::NumberFormat::DATETIME )
+ && nFormatType != SvNumFormatType::DATE
+ && nFormatType != SvNumFormatType::TIME
+ && nFormatType != SvNumFormatType::DATETIME )
{
sal_uInt32 nFormat = pDocument->GetNumberFormat( aPos );
aResult.SetDouble( pDocument->RoundValueAsShown(
@@ -2528,7 +2529,7 @@ void ScFormulaCell::GetURLResult( OUString& rURL, OUString& rCellText )
const sal_uInt32 nCellFormat = pDocument->GetNumberFormat( aPos );
SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
- const sal_uInt32 nURLFormat = ScGlobal::GetStandardFormat( *pFormatter, nCellFormat, css::util::NumberFormat::NUMBER);
+ const sal_uInt32 nURLFormat = ScGlobal::GetStandardFormat( *pFormatter, nCellFormat, SvNumFormatType::NUMBER);
if ( IsValue() )
{
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 0051dc6357a3..7e55499dcd89 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -162,7 +162,7 @@ bool ScGlobal::HasAttrChanged( const SfxItemSet& rNewAttrs,
}
sal_uInt32 ScGlobal::GetStandardFormat( SvNumberFormatter& rFormatter,
- sal_uInt32 nFormat, short nType )
+ sal_uInt32 nFormat, SvNumFormatType nType )
{
const SvNumberformat* pFormat = rFormatter.GetEntry( nFormat );
if ( pFormat )
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index a64e457926a4..531c6d357e8d 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, sal_uInt32 & rCurFmtType )
+ SvNumberFormatter* pFormatter, SvNumFormatType & rCurFmtType )
{
// We keep ScCalcConfig::StringConversion::LOCALE default until
// we provide a friendly way to convert string numbers into numbers in the UI.
@@ -466,7 +466,7 @@ Label_fallback_to_unambiguous:
sal_Int32 nUnit[done] = {0,0,0,0,0,0,0};
const sal_Int32 nLimit[done] = {0,12,31,0,59,59,0};
State eState = (bDate ? month : minute);
- rCurFmtType = (bDate ? css::util::NumberFormat::DATE : css::util::NumberFormat::TIME);
+ rCurFmtType = (bDate ? SvNumFormatType::DATE : SvNumFormatType::TIME);
nUnit[eState-1] = rStr.copy( 0, nParseEnd).toInt32();
const sal_Unicode* pLastStart = p;
// Ensure there's no preceding sign. Negative dates
@@ -481,7 +481,7 @@ Label_fallback_to_unambiguous:
while (p < pStop && rError == FormulaError::NONE && eState < blank)
{
if (eState == minute)
- rCurFmtType |= css::util::NumberFormat::TIME;
+ rCurFmtType |= SvNumFormatType::TIME;
if (rtl::isAsciiDigit(*p))
{
// Maximum 2 digits per unit, except fractions.
diff --git a/sc/source/core/data/simpleformulacalc.cxx b/sc/source/core/data/simpleformulacalc.cxx
index 859114515e5c..a710d8a34cbf 100644
--- a/sc/source/core/data/simpleformulacalc.cxx
+++ b/sc/source/core/data/simpleformulacalc.cxx
@@ -18,7 +18,7 @@
ScSimpleFormulaCalculator::ScSimpleFormulaCalculator( ScDocument* pDoc, const ScAddress& rAddr,
const OUString& rFormula, bool bMatrixFormula, formula::FormulaGrammar::Grammar eGram )
- : mnFormatType(0)
+ : mnFormatType(SvNumFormatType::ALL)
, mbCalculated(false)
, maAddr(rAddr)
, mpDoc(pDoc)
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 7565d7626d25..d5b82e0cd359 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_uInt32 nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::CURRENCY,ScGlobal::eLnge );
+ sal_uInt32 nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( SvNumFormatType::CURRENCY,ScGlobal::eLnge );
pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
}
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 184f57e719d6..bf6a7d5f9576 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2544,7 +2544,7 @@ void ScTable::ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol,
}
void ScTable::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
- const ScPatternAttr& rPattern, short nNewType )
+ const ScPatternAttr& rPattern, SvNumFormatType nNewType )
{
SCCOL nEndCol = rRange.aEnd.Col();
for ( SCCOL nCol = rRange.aStart.Col(); nCol <= nEndCol; nCol++ )
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index b973dd8fd6bc..17997bc67b28 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2400,14 +2400,14 @@ public:
const SvNumberformat* pEntry = pFormatter->GetEntry(nNumFmt);
if (pEntry)
{
- short nNumFmtType = pEntry->GetType();
+ SvNumFormatType nNumFmtType = pEntry->GetType();
/* NOTE: Omitting the check for absence of
* css::util::NumberFormat::TIME would include also date+time formatted
* values of the same day. That may be desired in some
* cases, querying all time values of a day, but confusing
* in other cases. A user can always setup a standard
* filter query for x >= date AND x < date+1 */
- if ((nNumFmtType & css::util::NumberFormat::DATE) && !(nNumFmtType & css::util::NumberFormat::TIME))
+ if ((nNumFmtType & SvNumFormatType::DATE) && !(nNumFmtType & SvNumFormatType::TIME))
{
// The format is of date type. Strip off the time
// element.
@@ -2936,8 +2936,8 @@ public:
const SvNumberformat* pEntry = mrDoc.GetFormatTable()->GetEntry(nIndex);
if (pEntry)
{
- short nNumFmtType = pEntry->GetType();
- if (!((nNumFmtType & css::util::NumberFormat::DATE) && !(nNumFmtType & css::util::NumberFormat::TIME)))
+ SvNumFormatType nNumFmtType = pEntry->GetType();
+ if (!((nNumFmtType & SvNumFormatType::DATE) && !(nNumFmtType & SvNumFormatType::TIME)))
rItem.meType = ScQueryEntry::ByValue; // not a date only
}
else
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index bd1d18d0443d..666ade0ed1b3 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -262,9 +262,9 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
{
double fVal;
sal_uInt32 nFormat = static_cast<const SfxUInt32Item*>(GetAttr(nCol,nRow,ATTR_VALUE_FORMAT))->GetValue();
- const sal_Int16 nFormatType = pDocument->GetFormatTable()->GetType(nFormat);
- bool bDate = (nFormatType == css::util::NumberFormat::DATE );
- bool bBooleanCell = (!bDate && nFormatType == css::util::NumberFormat::LOGICAL);
+ const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType(nFormat);
+ bool bDate = (nFormatType == SvNumFormatType::DATE );
+ bool bBooleanCell = (!bDate && nFormatType == SvNumFormatType::LOGICAL);
if (bDate)
{
if (nCount > 1)
@@ -370,7 +370,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
bVal = false;
else if ((nVal2 == 0.0 || nVal2 == 1.0) &&
(pDocument->GetFormatTable()->GetType(GetNumberFormat(nCol,nRow)) ==
- css::util::NumberFormat::LOGICAL))
+ SvNumFormatType::LOGICAL))
bVal = false;
nVal1 = nVal2;
}
@@ -967,7 +967,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
if (nVal == 0.0 || nVal == 1.0)
{
bool bBooleanCell = (pDocument->GetFormatTable()->GetType( nNumFmt) ==
- css::util::NumberFormat::LOGICAL);
+ SvNumFormatType::LOGICAL);
if (!bBooleanCell)
nVal += (double) nDelta;
}
@@ -1395,14 +1395,14 @@ void ScTable::FillAutoSimple(
return;
}
bBooleanCell = (pDocument->GetFormatTable()->GetType(
- aCol[rCol].GetNumberFormat( pDocument->GetNonThreadedContext(), nSource)) == css::util::NumberFormat::LOGICAL);
+ aCol[rCol].GetNumberFormat( pDocument->GetNonThreadedContext(), nSource)) == SvNumFormatType::LOGICAL);
}
else // rInner&:=nCol, rOuter&:=nRow
{
aSrcCell = aCol[nSource].GetCellValue(rRow);
bBooleanCell = (pDocument->GetFormatTable()->GetType(
- aCol[nSource].GetNumberFormat( pDocument->GetNonThreadedContext(), rRow)) == css::util::NumberFormat::LOGICAL);
+ aCol[nSource].GetNumberFormat( pDocument->GetNonThreadedContext(), rRow)) == SvNumFormatType::LOGICAL);
}
bGetCell = false;
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 3ad2bfe228ae..4b76a166bef0 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -219,9 +219,9 @@ private:
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
+ SvNumFormatType nFuncFmtType; // NumberFormatType of a function
+ SvNumFormatType nCurFmtType; // current NumberFormatType
+ SvNumFormatType 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
@@ -253,7 +253,7 @@ private:
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, sal_uInt32& rCurFmtType );
+ double ConvertStringToValue( const OUString&, FormulaError& rError, SvNumFormatType& 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,
- sal_uInt32 * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult = false );
+ SvNumFormatType * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult = false );
formula::FormulaConstTokenRef PopToken();
void Pop();
@@ -393,9 +393,9 @@ private:
inline bool MatrixParameterConversion();
ScMatrixRef PopMatrix();
sc::RangeMatrix PopRangeMatrix();
- void QueryMatrixType(const ScMatrixRef& xMat, sal_uInt32& rRetTypeExpr, sal_uInt32& rRetIndexExpr);
+ void QueryMatrixType(const ScMatrixRef& xMat, SvNumFormatType& rRetTypeExpr, sal_uInt32& rRetIndexExpr);
- formula::FormulaToken* CreateFormulaDoubleToken( double fVal, short nFmt = css::util::NumberFormat::NUMBER );
+ formula::FormulaToken* CreateFormulaDoubleToken( double fVal, SvNumFormatType nFmt = SvNumFormatType::NUMBER );
formula::FormulaToken* CreateDoubleOrTypedToken( double fVal );
void PushDouble(double nVal);
@@ -1009,7 +1009,7 @@ public:
svl::SharedString GetStringResult() const;
double GetNumResult() const { return xResult->GetDouble(); }
const formula::FormulaConstTokenRef& GetResultToken() const { return xResult; }
- short GetRetFormatType() const { return nRetFmtType; }
+ SvNumFormatType GetRetFormatType() const { return nRetFmtType; }
sal_uLong GetRetFormatIndex() const { return nRetFmtIndex; }
};
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index ed22a5ecb639..87138b9885cd 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -33,8 +33,8 @@ namespace
{
//treat dates like text #i25706#
sal_uInt32 nNumberFormat = pDocument->GetNumberFormat( ScAddress( nCol, nRow, nTab ) );
- short nType = pDocument->GetFormatTable()->GetType(nNumberFormat);
- bool bIsDate = (nType & css::util::NumberFormat::DATE);
+ SvNumFormatType nType = pDocument->GetFormatTable()->GetType(nNumberFormat);
+ bool bIsDate(nType & SvNumFormatType::DATE);
bReturn = !bIsDate;
}
return bReturn;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 2fd59cbec44e..955bdce9b717 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2960,23 +2960,23 @@ bool ScCompiler::IsValue( const OUString& rSym )
if (!mpFormatter->IsNumberFormat(rSym, nIndex, fVal))
return false;
- sal_uInt16 nType = mpFormatter->GetType(nIndex);
+ SvNumFormatType nType = mpFormatter->GetType(nIndex);
// Don't accept 3:3 as time, it is a reference to entire row 3 instead.
// Dates should never be entered directly and automatically converted
// to serial, because the serial would be wrong if null-date changed.
// Usually it wouldn't be accepted anyway because the date separator
// clashed with other separators or operators.
- if (nType & (css::util::NumberFormat::TIME | css::util::NumberFormat::DATE))
+ if (nType & (SvNumFormatType::TIME | SvNumFormatType::DATE))
return false;
- if (nType == css::util::NumberFormat::LOGICAL)
+ if (nType == SvNumFormatType::LOGICAL)
{
if (lcl_ParenthesisFollows( aFormula.getStr() + nSrcPos))
return false; // Boolean function instead.
}
- if( nType == css::util::NumberFormat::TEXT )
+ if( nType == SvNumFormatType::TEXT )
// HACK: number too big!
SetError( FormulaError::IllegalArgument );
maRawToken.SetDouble( fVal );
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index d3b5829a5db8..f51cc1b1b55d 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -191,7 +191,7 @@ void ScInterpreter::ScIfJump()
}
else
{ // no parameter given for THEN
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
PushInt(1);
aCode.Jump( pJump[ nJumpCount ], pJump[ nJumpCount ] );
}
@@ -204,7 +204,7 @@ void ScInterpreter::ScIfJump()
}
else
{ // no parameter given for ELSE
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
PushInt(0);
aCode.Jump( pJump[ nJumpCount ], pJump[ nJumpCount ] );
}
@@ -925,7 +925,7 @@ double ScInterpreter::Compare( ScQueryOp eOp )
}
if( nGlobalError != FormulaError::NONE )
return 0;
- nCurFmtType = nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nCurFmtType = nFuncFmtType = SvNumFormatType::LOGICAL;
return sc::CompareFunc(aComp);
}
@@ -997,7 +997,7 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScQueryOp eOp, sc::CompareOptions* pO
if (nGlobalError != FormulaError::NONE)
{
- nCurFmtType = nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nCurFmtType = nFuncFmtType = SvNumFormatType::LOGICAL;
return aRes;
}
@@ -1087,14 +1087,14 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScQueryOp eOp, sc::CompareOptions* pO
return aRes;
}
- nCurFmtType = nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nCurFmtType = nFuncFmtType = SvNumFormatType::LOGICAL;
return aRes;
}
ScMatrixRef ScInterpreter::QueryMat( const ScMatrixRef& pMat, sc::CompareOptions& rOptions )
{
- short nSaveCurFmtType = nCurFmtType;
- short nSaveFuncFmtType = nFuncFmtType;
+ SvNumFormatType nSaveCurFmtType = nCurFmtType;
+ SvNumFormatType nSaveFuncFmtType = nFuncFmtType;
PushMatrix( pMat);
const ScQueryEntry::Item& rItem = rOptions.aQueryEntry.GetQueryItem();
if (rItem.meType == ScQueryEntry::ByString)
@@ -1217,7 +1217,7 @@ void ScInterpreter::ScGreaterEqual()
void ScInterpreter::ScAnd()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
short nParamCount = GetByte();
if ( MustHaveParamCountMin( nParamCount, 1 ) )
{
@@ -1315,7 +1315,7 @@ void ScInterpreter::ScAnd()
void ScInterpreter::ScOr()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
short nParamCount = GetByte();
if ( MustHaveParamCountMin( nParamCount, 1 ) )
{
@@ -1415,7 +1415,7 @@ void ScInterpreter::ScOr()
void ScInterpreter::ScXor()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
short nParamCount = GetByte();
if ( MustHaveParamCountMin( nParamCount, 1 ) )
{
@@ -1548,7 +1548,7 @@ void ScInterpreter::ScNeg()
void ScInterpreter::ScPercentSign()
{
- nFuncFmtType = css::util::NumberFormat::PERCENT;
+ nFuncFmtType = SvNumFormatType::PERCENT;
const FormulaToken* pSaveCur = pCur;
sal_uInt8 nSavePar = cPar;
PushInt( 100 );
@@ -1562,7 +1562,7 @@ void ScInterpreter::ScPercentSign()
void ScInterpreter::ScNot()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
switch ( GetStackType() )
{
case svMatrix :
@@ -1693,13 +1693,13 @@ void ScInterpreter::ScRandom()
void ScInterpreter::ScTrue()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
PushInt(1);
}
void ScInterpreter::ScFalse()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
PushInt(0);
}
@@ -1842,7 +1842,7 @@ void ScInterpreter::ScSqrt()
void ScInterpreter::ScIsEmpty()
{
short nRes = 0;
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
switch ( GetRawStackType() )
{
case svEmptyCell:
@@ -1895,7 +1895,7 @@ void ScInterpreter::ScIsEmpty()
bool ScInterpreter::IsString()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
bool bRes = false;
switch ( GetRawStackType() )
{
@@ -1989,7 +1989,7 @@ void ScInterpreter::ScIsLogical()
if (aCell.hasNumeric())
{
sal_uInt32 nFormat = GetCellNumberFormat(aAdr, aCell);
- bRes = (pFormatter->GetType(nFormat) == css::util::NumberFormat::LOGICAL);
+ bRes = (pFormatter->GetType(nFormat) == SvNumFormatType::LOGICAL);
}
}
}
@@ -2005,9 +2005,9 @@ void ScInterpreter::ScIsLogical()
default:
PopError();
if ( nGlobalError == FormulaError::NONE )
- bRes = ( nCurFmtType == css::util::NumberFormat::LOGICAL );
+ bRes = ( nCurFmtType == SvNumFormatType::LOGICAL );
}
- nCurFmtType = nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nCurFmtType = nFuncFmtType = SvNumFormatType::LOGICAL;
nGlobalError = FormulaError::NONE;
PushInt( int(bRes) );
}
@@ -2037,7 +2037,7 @@ void ScInterpreter::ScType()
case CELLTYPE_VALUE :
{
sal_uInt32 nFormat = GetCellNumberFormat(aAdr, aCell);
- if (pFormatter->GetType(nFormat) == css::util::NumberFormat::LOGICAL)
+ if (pFormatter->GetType(nFormat) == SvNumFormatType::LOGICAL)
nType = 4;
else
nType = 1;
@@ -2110,16 +2110,16 @@ void getFormatString(SvNumberFormatter* pFormatter, sal_uLong nFormat, OUString&
switch( pFormatter->GetType( nFormat ) )
{
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::NUMBER:
if(bThousand) rFmtStr = ","; else rFmtStr = "F";
break;
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::CURRENCY:
rFmtStr = "C";
break;
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
rFmtStr = "S";
break;
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
rFmtStr = "P";
break;
default:
@@ -2488,7 +2488,7 @@ void ScInterpreter::ScCellExternal()
void ScInterpreter::ScIsRef()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
bool bRes = false;
switch ( GetStackType() )
{
@@ -2540,7 +2540,7 @@ void ScInterpreter::ScIsRef()
void ScInterpreter::ScIsValue()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
bool bRes = false;
switch ( GetRawStackType() )
{
@@ -2611,7 +2611,7 @@ void ScInterpreter::ScIsValue()
void ScInterpreter::ScIsFormula()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
bool bRes = false;
switch ( GetStackType() )
{
@@ -2712,7 +2712,7 @@ void ScInterpreter::ScFormula()
void ScInterpreter::ScIsNV()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
bool bRes = false;
switch ( GetStackType() )
{
@@ -2769,7 +2769,7 @@ void ScInterpreter::ScIsNV()
void ScInterpreter::ScIsErr()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
bool bRes = false;
switch ( GetStackType() )
{
@@ -2832,7 +2832,7 @@ void ScInterpreter::ScIsErr()
void ScInterpreter::ScIsError()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
bool bRes = false;
switch ( GetStackType() )
{
@@ -2891,7 +2891,7 @@ void ScInterpreter::ScIsError()
bool ScInterpreter::IsEven()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
bool bRes = false;
double fVal = 0.0;
switch ( GetStackType() )
@@ -3518,7 +3518,7 @@ void ScInterpreter::ScMin( bool bTextAsZero )
{
nVal = GetDouble();
if (nMin > nVal) nMin = nVal;
- nFuncFmtType = css::util::NumberFormat::NUMBER;
+ nFuncFmtType = SvNumFormatType::NUMBER;
}
break;
case svSingleRef :
@@ -3585,7 +3585,7 @@ void ScInterpreter::ScMin( bool bTextAsZero )
ScMatrixRef pMat = GetMatrix();
if (pMat)
{
- nFuncFmtType = css::util::NumberFormat::NUMBER;
+ nFuncFmtType = SvNumFormatType::NUMBER;
nVal = pMat->GetMinValue(bTextAsZero);
if (nMin > nVal)
nMin = nVal;
@@ -3675,7 +3675,7 @@ void ScInterpreter::ScMax( bool bTextAsZero )
{
nVal = GetDouble();
if (nMax < nVal) nMax = nVal;
- nFuncFmtType = css::util::NumberFormat::NUMBER;
+ nFuncFmtType = SvNumFormatType::NUMBER;
}
break;
case svSingleRef :
@@ -3742,7 +3742,7 @@ void ScInterpreter::ScMax( bool bTextAsZero )
ScMatrixRef pMat = GetMatrix();
if (pMat)
{
- nFuncFmtType = css::util::NumberFormat::NUMBER;
+ nFuncFmtType = SvNumFormatType::NUMBER;
nVal = pMat->GetMaxValue(bTextAsZero);
if (nMax < nVal)
nMax = nVal;
@@ -8407,7 +8407,7 @@ void ScInterpreter::ScCurrency()
if ( fDec < 0.0 )
fDec = 0.0;
sal_uLong nIndex = pFormatter->GetStandardFormat(
- css::util::NumberFormat::CURRENCY,
+ SvNumFormatType::CURRENCY,
ScGlobal::eLnge);
if ( (sal_uInt16) fDec != pFormatter->GetFormatPrecision( nIndex ) )
{
@@ -8509,7 +8509,7 @@ void ScInterpreter::ScFixed()
if (fDec < 0.0)
fDec = 0.0;
sal_uLong nIndex = pFormatter->GetStandardFormat(
- css::util::NumberFormat::NUMBER,
+ SvNumFormatType::NUMBER,
ScGlobal::eLnge);
OUString sFormatString = pFormatter->GenerateFormat(
nIndex,
@@ -8563,7 +8563,7 @@ void ScInterpreter::ScFind()
void ScInterpreter::ScExact()
{
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
if ( MustHaveParamCount( GetByte(), 2 ) )
{
svl::SharedString s1 = GetString();
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 67573f5ab9c1..5464d9b6c778 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -104,7 +104,7 @@ double ScInterpreter::GetDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int1
void ScInterpreter::ScGetActDate()
{
- nFuncFmtType = css::util::NumberFormat::DATE;
+ nFuncFmtType = SvNumFormatType::DATE;
Date aActDate( Date::SYSTEM );
long nDiff = aActDate - pFormatter->GetNullDate();
PushDouble((double) nDiff);
@@ -112,7 +112,7 @@ void ScInterpreter::ScGetActDate()
void ScInterpreter::ScGetActTime()
{
- nFuncFmtType = css::util::NumberFormat::DATETIME;
+ nFuncFmtType = SvNumFormatType::DATETIME;
Date aActDate( Date::SYSTEM );
long nDiff = aActDate - pFormatter->GetNullDate();
tools::Time aActTime( tools::Time::SYSTEM );
@@ -175,10 +175,10 @@ void ScInterpreter::ScGetDateValue()
double fVal;
if (pFormatter->IsNumberFormat(aInputString, nFIndex, fVal))
{
- short eType = pFormatter->GetType(nFIndex);
- if (eType == css::util::NumberFormat::DATE || eType == css::util::NumberFormat::DATETIME)
+ SvNumFormatType eType = pFormatter->GetType(nFIndex);
+ if (eType == SvNumFormatType::DATE || eType == SvNumFormatType::DATETIME)
{
- nFuncFmtType = css::util::NumberFormat::DATE;
+ nFuncFmtType = SvNumFormatType::DATE;
PushDouble(::rtl::math::approxFloor(fVal));
}
else
@@ -309,7 +309,7 @@ void ScInterpreter::ScGetIsoWeekOfYear()
void ScInterpreter::ScEasterSunday()
{
- nFuncFmtType = css::util::NumberFormat::DATE;
+ nFuncFmtType = SvNumFormatType::DATE;
if ( MustHaveParamCount( GetByte(), 1 ) )
{
sal_Int16 nDay, nMonth, nYear;
@@ -571,7 +571,7 @@ void ScInterpreter::ScWorkday_MS()
sal_uInt8 nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 4 ) )
{
- nFuncFmtType = css::util::NumberFormat::DATE;
+ nFuncFmtType = SvNumFormatType::DATE;
vector<double> nSortArray;
bool bWeekendMask[ 7 ];
const Date& rNullDate = pFormatter->GetNullDate();
@@ -640,7 +640,7 @@ void ScInterpreter::ScWorkday_MS()
void ScInterpreter::ScGetDate()
{
- nFuncFmtType = css::util::NumberFormat::DATE;
+ nFuncFmtType = SvNumFormatType::DATE;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
sal_Int16 nDay = GetInt16();
@@ -659,7 +659,7 @@ void ScInterpreter::ScGetDate()
void ScInterpreter::ScGetTime()
{
- nFuncFmtType = css::util::NumberFormat::TIME;
+ nFuncFmtType = SvNumFormatType::TIME;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double fSec = GetDouble();
@@ -934,10 +934,10 @@ void ScInterpreter::ScGetTimeValue()
double fVal;
if (pFormatter->IsNumberFormat(aInputString, nFIndex, fVal))
{
- short eType = pFormatter->GetType(nFIndex);
- if (eType == css::util::NumberFormat::TIME || eType == css::util::NumberFormat::DATETIME)
+ SvNumFormatType eType = pFormatter->GetType(nFIndex);
+ if (eType == SvNumFormatType::TIME || eType == SvNumFormatType::DATETIME)
{
- nFuncFmtType = css::util::NumberFormat::TIME;
+ nFuncFmtType = SvNumFormatType::TIME;
double fDateVal = rtl::math::approxFloor(fVal);
double fTimeVal = fVal - fDateVal;
PushDouble(fTimeVal);
@@ -1288,7 +1288,7 @@ void ScInterpreter::ScLog10()
void ScInterpreter::ScNPV()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
short nParamCount = GetByte();
if ( MustHaveParamCountMin( nParamCount, 2) )
{
@@ -1387,7 +1387,7 @@ void ScInterpreter::ScNPV()
void ScInterpreter::ScIRR()
{
double fEstimated;
- nFuncFmtType = css::util::NumberFormat::PERCENT;
+ nFuncFmtType = SvNumFormatType::PERCENT;
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 1, 2 ) )
return;
@@ -1452,7 +1452,7 @@ void ScInterpreter::ScIRR()
void ScInterpreter::ScMIRR()
{ // range_of_values ; rate_invest ; rate_reinvest
- nFuncFmtType = css::util::NumberFormat::PERCENT;
+ nFuncFmtType = SvNumFormatType::PERCENT;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double fRate1_reinvest = GetDouble() + 1;
@@ -1613,7 +1613,7 @@ double ScInterpreter::ScGetPV(double fRate, double fNper, double fPmt,
void ScInterpreter::ScPV()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
double fPmt, fNper, fRate, fFv = 0;
bool bPayInAdvance = false;
sal_uInt8 nParamCount = GetByte();
@@ -1631,7 +1631,7 @@ void ScInterpreter::ScPV()
void ScInterpreter::ScSYD()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
if ( MustHaveParamCount( GetByte(), 4 ) )
{
double fPer = GetDouble();
@@ -1672,7 +1672,7 @@ double ScInterpreter::ScGetDDB(double fCost, double fSalvage, double fLife,
void ScInterpreter::ScDDB()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
sal_uInt8 nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 4, 5 ) )
{
@@ -1695,7 +1695,7 @@ void ScInterpreter::ScDDB()
void ScInterpreter::ScDB()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 4, 5 ) )
return ;
@@ -1790,7 +1790,7 @@ inline double DblMin( double a, double b )
void ScInterpreter::ScVDB()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
sal_uInt8 nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 5, 7 ) )
{
@@ -1890,7 +1890,7 @@ void ScInterpreter::ScPDuration()
void ScInterpreter::ScSLN()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double fLife = GetDouble();
@@ -1922,7 +1922,7 @@ void ScInterpreter::ScPMT()
{
double fRate, fNper, fPv, fFv = 0;
bool bPayInAdvance = false;
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 5 ) )
return;
@@ -1938,7 +1938,7 @@ void ScInterpreter::ScPMT()
void ScInterpreter::ScRRI()
{
- nFuncFmtType = css::util::NumberFormat::PERCENT;
+ nFuncFmtType = SvNumFormatType::PERCENT;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double fFutureValue = GetDouble();
@@ -1972,7 +1972,7 @@ void ScInterpreter::ScFV()
{
double fRate, fNper, fPmt, fPv = 0;
bool bPayInAdvance = false;
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 5 ) )
return;
@@ -2120,7 +2120,7 @@ void ScInterpreter::ScRate()
double fFv = 0, fGuess = 0.1, fOrigGuess = 0.1;
bool bPayType = false, bValid = true;
bool bDefaultGuess = true;
- nFuncFmtType = css::util::NumberFormat::PERCENT;
+ nFuncFmtType = SvNumFormatType::PERCENT;
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 6 ) )
return;
@@ -2178,7 +2178,7 @@ double ScInterpreter::ScGetIpmt(double fRate, double fPer, double fNper, double
{
fPmt = ScGetPMT(fRate, fNper, fPv, fFv, bPayInAdvance); // for PPMT also if fPer == 1
double fIpmt;
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
if (fPer == 1.0)
{
if (bPayInAdvance)
@@ -2200,7 +2200,7 @@ void ScInterpreter::ScIpmt()
{
double fRate, fPer, fNper, fPv, fFv = 0;
bool bPayInAdvance = false;
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 4, 6 ) )
return;
@@ -2225,7 +2225,7 @@ void ScInterpreter::ScPpmt()
{
double fRate, fPer, fNper, fPv, fFv = 0;
bool bPayInAdvance = false;
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 4, 6 ) )
return;
@@ -2249,7 +2249,7 @@ void ScInterpreter::ScPpmt()
void ScInterpreter::ScCumIpmt()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
if ( MustHaveParamCount( GetByte(), 6 ) )
{
double fRate, fNper, fPv, fStart, fEnd;
@@ -2291,7 +2291,7 @@ void ScInterpreter::ScCumIpmt()
void ScInterpreter::ScCumPrinc()
{
- nFuncFmtType = css::util::NumberFormat::CURRENCY;
+ nFuncFmtType = SvNumFormatType::CURRENCY;
if ( MustHaveParamCount( GetByte(), 6 ) )
{
double fRate, fNper, fPv, fStart, fEnd;
@@ -2334,7 +2334,7 @@ void ScInterpreter::ScCumPrinc()
void ScInterpreter::ScEffect()
{
- nFuncFmtType = css::util::NumberFormat::PERCENT;
+ nFuncFmtType = SvNumFormatType::PERCENT;
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double fPeriods = GetDouble();
@@ -2353,7 +2353,7 @@ void ScInterpreter::ScEffect()
void ScInterpreter::ScNominal()
{
- nFuncFmtType = css::util::NumberFormat::PERCENT;
+ nFuncFmtType = SvNumFormatType::PERCENT;
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double fPeriods = GetDouble();
@@ -3627,7 +3627,7 @@ void ScInterpreter::ScGetPivotData()
nNumFormat = nCurFmtIndex;
else
{
- if (nCurFmtType == css::util::NumberFormat::UNDEFINED)
+ if (nCurFmtType == SvNumFormatType::UNDEFINED)
nNumFormat = 0;
else
nNumFormat = pFormatter->GetStandardFormat( nCurFmtType, ScGlobal::eLnge);
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index f80afe2bd5a8..0fbc89b56180 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -172,7 +172,7 @@ double ScInterpreter::ConvertStringToValue( const OUString& rStr )
return fValue;
}
-double ScInterpreter::ConvertStringToValue( const OUString& rStr, FormulaError& rError, sal_uInt32& rCurFmtType )
+double ScInterpreter::ConvertStringToValue( const OUString& rStr, FormulaError& rError, SvNumFormatType& 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, sal_uInt32 * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult )
+ const ScAddress & rAddress, SvNumFormatType * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult )
{
ScRefCellValue aCell(*pDok, rAddress);
if (aCell.hasEmptyValue())
@@ -710,7 +710,7 @@ void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString,
{
PushError( nErr);
if (pRetTypeExpr)
- *pRetTypeExpr = css::util::NumberFormat::UNDEFINED;
+ *pRetTypeExpr = SvNumFormatType::UNDEFINED;
if (pRetIndexExpr)
*pRetIndexExpr = 0;
}
@@ -720,7 +720,7 @@ void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString,
GetCellString( aRes, aCell);
PushString( aRes);
if (pRetTypeExpr)
- *pRetTypeExpr = css::util::NumberFormat::TEXT;
+ *pRetTypeExpr = SvNumFormatType::TEXT;
if (pRetIndexExpr)
*pRetIndexExpr = 0;
}
@@ -785,7 +785,7 @@ FormulaConstTokenRef ScInterpreter::PopToken()
double ScInterpreter::PopDouble()
{
- nCurFmtType = css::util::NumberFormat::NUMBER;
+ nCurFmtType = SvNumFormatType::NUMBER;
nCurFmtIndex = 0;
if( sp )
{
@@ -798,8 +798,8 @@ double ScInterpreter::PopDouble()
break;
case svDouble:
{
- short nType = p->GetDoubleType();
- if (nType && nType != css::util::NumberFormat::UNDEFINED)
+ SvNumFormatType nType = static_cast<SvNumFormatType>(p->GetDoubleType());
+ if (nType != SvNumFormatType::ALL && nType != SvNumFormatType::UNDEFINED)
nCurFmtType = nType;
return p->GetDouble();
}
@@ -817,7 +817,7 @@ double ScInterpreter::PopDouble()
svl::SharedString ScInterpreter::PopString()
{
- nCurFmtType = css::util::NumberFormat::TEXT;
+ nCurFmtType = SvNumFormatType::TEXT;
nCurFmtIndex = 0;
if( sp )
{
@@ -1675,7 +1675,7 @@ sc::RangeMatrix ScInterpreter::PopRangeMatrix()
return aRet;
}
-void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, sal_uInt32& rRetTypeExpr, sal_uInt32& rRetIndexExpr)
+void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, SvNumFormatType& rRetTypeExpr, sal_uInt32& rRetIndexExpr)
{
if (xMat)
{
@@ -1689,7 +1689,7 @@ void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, sal_uInt32& rRetTyp
{ // result of empty FALSE jump path
FormulaTokenRef xRes = CreateFormulaDoubleToken( 0.0);
PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
- rRetTypeExpr = css::util::NumberFormat::LOGICAL;
+ rRetTypeExpr = SvNumFormatType::LOGICAL;
}
else if ( xMat->IsEmptyResult( 0, 0))
{ // empty formula result
@@ -1706,7 +1706,7 @@ void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, sal_uInt32& rRetTyp
svl::SharedString aStr( nMatVal.GetString());
FormulaTokenRef xRes = new FormulaStringToken( aStr);
PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
- rRetTypeExpr = css::util::NumberFormat::TEXT;
+ rRetTypeExpr = SvNumFormatType::TEXT;
}
}
else
@@ -1718,8 +1718,8 @@ void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, sal_uInt32& rRetTyp
else
xRes = CreateFormulaDoubleToken( nMatVal.fVal);
PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
- if ( rRetTypeExpr != css::util::NumberFormat::LOGICAL )
- rRetTypeExpr = css::util::NumberFormat::NUMBER;
+ if ( rRetTypeExpr != SvNumFormatType::LOGICAL )
+ rRetTypeExpr = SvNumFormatType::NUMBER;
}
rRetIndexExpr = 0;
xMat->SetErrorInterpreter( nullptr);
@@ -1728,7 +1728,7 @@ void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, sal_uInt32& rRetTyp
SetError( FormulaError::UnknownStackVariable);
}
-formula::FormulaToken* ScInterpreter::CreateFormulaDoubleToken( double fVal, short nFmt )
+formula::FormulaToken* ScInterpreter::CreateFormulaDoubleToken( double fVal, SvNumFormatType nFmt )
{
assert( mrContext.maTokens.size() == TOKEN_CACHE_SIZE );
@@ -1738,13 +1738,13 @@ formula::FormulaToken* ScInterpreter::CreateFormulaDoubleToken( double fVal, sho
if (p && p->GetRef() == 1)
{
p->GetDoubleAsReference() = fVal;
- p->SetDoubleType( nFmt );
+ p->SetDoubleType( (sal_Int16)nFmt );
return p;
}
}
// Allocate a new token
- auto p = new FormulaTypedDoubleToken( fVal, nFmt );
+ auto p = new FormulaTypedDoubleToken( fVal, (sal_Int16)nFmt );
if ( mrContext.maTokens[mrContext.mnTokenCachePos] )
mrContext.maTokens[mrContext.mnTokenCachePos]->DecRef();
mrContext.maTokens[mrContext.mnTokenCachePos] = p;
@@ -1756,8 +1756,8 @@ formula::FormulaToken* ScInterpreter::CreateFormulaDoubleToken( double fVal, sho
formula::FormulaToken* ScInterpreter::CreateDoubleOrTypedToken( double fVal )
{
// NumberFormat::NUMBER is the default untyped double.
- if (nFuncFmtType && nFuncFmtType != css::util::NumberFormat::NUMBER &&
- nFuncFmtType != css::util::NumberFormat::UNDEFINED)
+ if (nFuncFmtType != SvNumFormatType::ALL && nFuncFmtType != SvNumFormatType::NUMBER &&
+ nFuncFmtType != SvNumFormatType::UNDEFINED)
return CreateFormulaDoubleToken( fVal, nFuncFmtType);
else
return CreateFormulaDoubleToken( fVal);
@@ -2509,7 +2509,7 @@ ScMatValType ScInterpreter::GetDoubleOrStringFromMatrix(
svl::SharedString ScInterpreter::GetStringFromDouble( double fVal )
{
sal_uLong nIndex = pFormatter->GetStandardFormat(
- css::util::NumberFormat::NUMBER,
+ SvNumFormatType::NUMBER,
ScGlobal::eLnge);
OUString aStr;
pFormatter->GetInputLineString(fVal, nIndex, aStr);
@@ -3443,10 +3443,10 @@ void ScInterpreter::ScMacro()
switch (eResType)
{
case SbxDATE:
- nFuncFmtType = css::util::NumberFormat::DATE;
+ nFuncFmtType = SvNumFormatType::DATE;
break;
case SbxBOOL:
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
break;
// Do not add SbxCURRENCY, we don't know which currency.
default:
@@ -3828,9 +3828,9 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc, ScInterpre
, nFuncFmtIndex(0)
, nCurFmtIndex(0)
, nRetFmtIndex(0)
- , nFuncFmtType(0)
- , nCurFmtType(0)
- , nRetFmtType(0)
+ , nFuncFmtType(SvNumFormatType::ALL)
+ , nCurFmtType(SvNumFormatType::ALL)
+ , nRetFmtType(SvNumFormatType::ALL)
, mnStringNoValueError(FormulaError::NoValue)
, mnSubTotalFlags(SubtotalFlags::NONE)
, cPar(0)
@@ -3955,7 +3955,7 @@ bool IsErrFunc(OpCode oc)
StackVar ScInterpreter::Interpret()
{
- sal_uInt32 nRetTypeExpr = css::util::NumberFormat::UNDEFINED;
+ SvNumFormatType nRetTypeExpr = SvNumFormatType::UNDEFINED;
sal_uInt32 nRetIndexExpr = 0;
sal_uInt16 nErrorFunction = 0;
sal_uInt16 nErrorFunctionCount = 0;
@@ -3964,8 +3964,8 @@ StackVar ScInterpreter::Interpret()
nGlobalError = FormulaError::NONE;
nStackBase = sp = maxsp = 0;
- nRetFmtType = css::util::NumberFormat::UNDEFINED;
- nFuncFmtType = css::util::NumberFormat::UNDEFINED;
+ nRetFmtType = SvNumFormatType::UNDEFINED;
+ nFuncFmtType = SvNumFormatType::UNDEFINED;
nFuncFmtIndex = nCurFmtIndex = nRetFmtIndex = 0;
xResult = nullptr;
pJumpMatrix = nullptr;
@@ -3990,7 +3990,7 @@ StackVar ScInterpreter::Interpret()
{
// RPN code push without error
PushWithoutError( *pCur );
- nCurFmtType = css::util::NumberFormat::UNDEFINED;
+ nCurFmtType = SvNumFormatType::UNDEFINED;
}
else if (pTokenMatrixMap &&
!(eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == ocChoose) &&
@@ -4011,7 +4011,7 @@ StackVar ScInterpreter::Interpret()
nCurFmtType = nRetTypeExpr;
nCurFmtIndex = nRetIndexExpr;
// default function's format, others are set if needed
- nFuncFmtType = css::util::NumberFormat::NUMBER;
+ nFuncFmtType = SvNumFormatType::NUMBER;
nFuncFmtIndex = 0;
if ( eOp == ocIf || eOp == ocChoose || eOp == ocIfError || eOp == ocIfNA )
@@ -4459,7 +4459,7 @@ StackVar ScInterpreter::Interpret()
case ocBitLshift : ScBitLshift(); break;
case ocTTT : ScTTT(); break;
case ocDebugVar : ScDebugVar(); break;
- case ocNone : nFuncFmtType = css::util::NumberFormat::UNDEFINED; break;
+ case ocNone : nFuncFmtType = SvNumFormatType::UNDEFINED; break;
default : PushError( FormulaError::UnknownOpCode); break;
}
@@ -4478,16 +4478,16 @@ StackVar ScInterpreter::Interpret()
pTokenMatrixMap->emplace(pCur, pStack[sp-1]);
// outer function determines format of an expression
- if ( nFuncFmtType != css::util::NumberFormat::UNDEFINED )
+ if ( nFuncFmtType != SvNumFormatType::UNDEFINED )
{
nRetTypeExpr = nFuncFmtType;
// Inherit the format index for currency, date or time formats.
switch (nFuncFmtType)
{
- case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::DATE:
- case css::util::NumberFormat::TIME:
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::CURRENCY:
+ case SvNumFormatType::DATE:
+ case SvNumFormatType::TIME:
+ case SvNumFormatType::DATETIME:
nRetIndexExpr = nFuncFmtIndex;
break;
default:
@@ -4565,7 +4565,7 @@ StackVar ScInterpreter::Interpret()
case ocGetTimeValue:
// Force final result of DATEVALUE and TIMEVALUE to number type,
// which so far was date or time for calculations.
- nRetTypeExpr = nFuncFmtType = css::util::NumberFormat::NUMBER;
+ nRetTypeExpr = nFuncFmtType = SvNumFormatType::NUMBER;
nRetIndexExpr = nFuncFmtIndex = 0;
bForcedResultType = true;
break;
@@ -4600,7 +4600,7 @@ StackVar ScInterpreter::Interpret()
// push a plain untyped double so the result token to
// be transferred to the formula cell result does not
// unnecessarily duplicate the information.
- if (pCur->GetDoubleType())
+ if (pCur->GetDoubleType() != 0)
{
const double fVal = PopDouble();
if (!bForcedResultType)
@@ -4611,15 +4611,15 @@ StackVar ScInterpreter::Interpret()
}
PushTempToken( CreateFormulaDoubleToken( fVal));
}
- if ( nFuncFmtType == css::util::NumberFormat::UNDEFINED )
+ if ( nFuncFmtType == SvNumFormatType::UNDEFINED )
{
- nRetTypeExpr = css::util::NumberFormat::NUMBER;
+ nRetTypeExpr = SvNumFormatType::NUMBER;
nRetIndexExpr = 0;
}
}
break;
case svString :
- nRetTypeExpr = css::util::NumberFormat::TEXT;
+ nRetTypeExpr = SvNumFormatType::TEXT;
nRetIndexExpr = 0;
break;
case svSingleRef :
@@ -4703,18 +4703,18 @@ StackVar ScInterpreter::Interpret()
else
SetError( FormulaError::NoCode);
- if (bForcedResultType || nRetTypeExpr != css::util::NumberFormat::UNDEFINED)
+ if (bForcedResultType || nRetTypeExpr != SvNumFormatType::UNDEFINED)
{
nRetFmtType = nRetTypeExpr;
nRetFmtIndex = nRetIndexExpr;
}
- else if( nFuncFmtType != css::util::NumberFormat::UNDEFINED )
+ else if( nFuncFmtType != SvNumFormatType::UNDEFINED )
{
nRetFmtType = nFuncFmtType;
nRetFmtIndex = nFuncFmtIndex;
}
else
- nRetFmtType = css::util::NumberFormat::NUMBER;
+ nRetFmtType = SvNumFormatType::NUMBER;
if (nGlobalError != FormulaError::NONE && GetStackType() != svError )
PushError( nGlobalError);
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 8dcbced00bee..9261da060714 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;
- sal_uInt32 nFmt1 = 0;
+ SvNumFormatType nFmt1 = SvNumFormatType::ALL;
double fVal1 = (bVal1 ? rMat1.GetDouble(i,j) :
pInterpreter->ConvertStringToValue( rMat1.GetString(i,j).getString(), nError1, nFmt1));
FormulaError nError2 = FormulaError::NONE;
- sal_uInt32 nFmt2 = 0;
+ SvNumFormatType nFmt2 = SvNumFormatType::ALL;
double fVal2 = (bVal2 ? rMat2.GetDouble(i,j) :
pInterpreter->ConvertStringToValue( rMat2.GetString(i,j).getString(), nError2, nFmt2));
@@ -1181,27 +1181,27 @@ ScMatrixRef ScInterpreter::MatConcat(const ScMatrixRef& pMat1, const ScMatrixRef
}
// for DATE, TIME, DATETIME
-static void lcl_GetDiffDateTimeFmtType( sal_uInt32& nFuncFmt, short nFmt1, short nFmt2 )
+static void lcl_GetDiffDateTimeFmtType( SvNumFormatType& nFuncFmt, SvNumFormatType nFmt1, SvNumFormatType nFmt2 )
{
- if ( nFmt1 != css::util::NumberFormat::UNDEFINED || nFmt2 != css::util::NumberFormat::UNDEFINED )
+ if ( nFmt1 != SvNumFormatType::UNDEFINED || nFmt2 != SvNumFormatType::UNDEFINED )
{
if ( nFmt1 == nFmt2 )
{
- if ( nFmt1 == css::util::NumberFormat::TIME || nFmt1 == css::util::NumberFormat::DATETIME )
- nFuncFmt = css::util::NumberFormat::TIME; // times result in time
+ if ( nFmt1 == SvNumFormatType::TIME || nFmt1 == SvNumFormatType::DATETIME )
+ nFuncFmt = SvNumFormatType::TIME; // times result in time
// else: nothing special, number (date - date := days)
}
- else if ( nFmt1 == css::util::NumberFormat::UNDEFINED )
+ else if ( nFmt1 == SvNumFormatType::UNDEFINED )
nFuncFmt = nFmt2; // e.g. date + days := date
- else if ( nFmt2 == css::util::NumberFormat::UNDEFINED )
+ else if ( nFmt2 == SvNumFormatType::UNDEFINED )
nFuncFmt = nFmt1;
else
{
- if ( nFmt1 == css::util::NumberFormat::DATE || nFmt2 == css::util::NumberFormat::DATE ||
- nFmt1 == css::util::NumberFormat::DATETIME || nFmt2 == css::util::NumberFormat::DATETIME )
+ if ( nFmt1 == SvNumFormatType::DATE || nFmt2 == SvNumFormatType::DATE ||
+ nFmt1 == SvNumFormatType::DATETIME || nFmt2 == SvNumFormatType::DATETIME )
{
- if ( nFmt1 == css::util::NumberFormat::TIME || nFmt2 == css::util::NumberFormat::TIME )
- nFuncFmt = css::util::NumberFormat::DATETIME; // date + time
+ if ( nFmt1 == SvNumFormatType::TIME || nFmt2 == SvNumFormatType::TIME )
+ nFuncFmt = SvNumFormatType::DATETIME; // date + time
}
}
}
@@ -1217,11 +1217,11 @@ void ScInterpreter::CalculateAddSub(bool _bSub)
ScMatrixRef pMat1 = nullptr;
ScMatrixRef pMat2 = nullptr;
double fVal1 = 0.0, fVal2 = 0.0;
- short nFmt1, nFmt2;
- nFmt1 = nFmt2 = css::util::NumberFormat::UNDEFINED;
- short nFmtCurrencyType = nCurFmtType;
+ SvNumFormatType nFmt1, nFmt2;
+ nFmt1 = nFmt2 = SvNumFormatType::UNDEFINED;
+ SvNumFormatType nFmtCurrencyType = nCurFmtType;
sal_uLong nFmtCurrencyIndex = nCurFmtIndex;
- short nFmtPercentType = nCurFmtType;
+ SvNumFormatType nFmtPercentType = nCurFmtType;
if ( GetStackType() == svMatrix )
pMat2 = GetMatrix();
else
@@ -1229,18 +1229,19 @@ void ScInterpreter::CalculateAddSub(bool _bSub)
fVal2 = GetDouble();
switch ( nCurFmtType )
{
- case css::util::NumberFormat::DATE :
- case css::util::NumberFormat::TIME :
- case css::util::NumberFormat::DATETIME :
+ case SvNumFormatType::DATE :
+ case SvNumFormatType::TIME :
+ case SvNumFormatType::DATETIME :
nFmt2 = nCurFmtType;
break;
- case css::util::NumberFormat::CURRENCY :
+ case SvNumFormatType::CURRENCY :
nFmtCurrencyType = nCurFmtType;
nFmtCurrencyIndex = nCurFmtIndex;
break;
- case css::util::NumberFormat::PERCENT :
- nFmtPercentType = css::util::NumberFormat::PERCENT;
+ case SvNumFormatType::PERCENT :
+ nFmtPercentType = SvNumFormatType::PERCENT;
break;
+ default: break;
}
}
if ( GetStackType() == svMatrix )
@@ -1250,18 +1251,19 @@ void ScInterpreter::CalculateAddSub(bool _bSub)
fVal1 = GetDouble();
switch ( nCurFmtType )
{
- case css::util::NumberFormat::DATE :
- case css::util::NumberFormat::TIME :
- case css::util::NumberFormat::DATETIME :
+ case SvNumFormatType::DATE :
+ case SvNumFormatType::TIME :
+ case SvNumFormatType::DATETIME :
nFmt1 = nCurFmtType;
break;
- case css::util::NumberFormat::CURRENCY :
+ case SvNumFormatType::CURRENCY :
nFmtCurrencyType = nCurFmtType;
nFmtCurrencyIndex = nCurFmtIndex;
break;
- case css::util::NumberFormat::PERCENT :
- nFmtPercentType = css::util::NumberFormat::PERCENT;
+ case SvNumFormatType::PERCENT :
+ nFmtPercentType = SvNumFormatType::PERCENT;
break;
+ default: break;
}
}
if (pMat1 && pMat2)
@@ -1318,7 +1320,7 @@ void ScInterpreter::CalculateAddSub(bool _bSub)
else
{
// Determine nFuncFmtType type before PushDouble().
- if ( nFmtCurrencyType == css::util::NumberFormat::CURRENCY )
+ if ( nFmtCurrencyType == SvNumFormatType::CURRENCY )
{
nFuncFmtType = nFmtCurrencyType;
nFuncFmtIndex = nFmtCurrencyIndex;
@@ -1326,8 +1328,8 @@ void ScInterpreter::CalculateAddSub(bool _bSub)
else
{
lcl_GetDiffDateTimeFmtType( nFuncFmtType, nFmt1, nFmt2 );
- if (nFmtPercentType == css::util::NumberFormat::PERCENT && nFuncFmtType == css::util::NumberFormat::NUMBER)
- nFuncFmtType = css::util::NumberFormat::PERCENT;
+ if (nFmtPercentType == SvNumFormatType::PERCENT && nFuncFmtType == SvNumFormatType::NUMBER)
+ nFuncFmtType = SvNumFormatType::PERCENT;
}
if ( _bSub )
PushDouble( ::rtl::math::approxSub( fVal1, fVal2 ) );
@@ -1439,7 +1441,7 @@ void ScInterpreter::ScMul()
ScMatrixRef pMat1 = nullptr;
ScMatrixRef pMat2 = nullptr;
double fVal1 = 0.0, fVal2 = 0.0;
- short nFmtCurrencyType = nCurFmtType;
+ SvNumFormatType nFmtCurrencyType = nCurFmtType;
sal_uLong nFmtCurrencyIndex = nCurFmtIndex;
if ( GetStackType() == svMatrix )
pMat2 = GetMatrix();
@@ -1448,10 +1450,11 @@ void ScInterpreter::ScMul()
fVal2 = GetDouble();
switch ( nCurFmtType )
{
- case css::util::NumberFormat::CURRENCY :
+ case SvNumFormatType::CURRENCY :
nFmtCurrencyType = nCurFmtType;
nFmtCurrencyIndex = nCurFmtIndex;
break;
+ default: break;
}
}
if ( GetStackType() == svMatrix )
@@ -1461,10 +1464,11 @@ void ScInterpreter::ScMul()
fVal1 = GetDouble();
switch ( nCurFmtType )
{
- case css::util::NumberFormat::CURRENCY :
+ case SvNumFormatType::CURRENCY :
nFmtCurrencyType = nCurFmtType;
nFmtCurrencyIndex = nCurFmtIndex;
break;
+ default: break;
}
}
if (pMat1 && pMat2)
@@ -1500,7 +1504,7 @@ void ScInterpreter::ScMul()
else
{
// Determine nFuncFmtType type before PushDouble().
- if ( nFmtCurrencyType == css::util::NumberFormat::CURRENCY )
+ if ( nFmtCurrencyType == SvNumFormatType::CURRENCY )
{
nFuncFmtType = nFmtCurrencyType;
nFuncFmtIndex = nFmtCurrencyIndex;
@@ -1514,9 +1518,9 @@ void ScInterpreter::ScDiv()
ScMatrixRef pMat1 = nullptr;
ScMatrixRef pMat2 = nullptr;
double fVal1 = 0.0, fVal2 = 0.0;
- short nFmtCurrencyType = nCurFmtType;
+ SvNumFormatType nFmtCurrencyType = nCurFmtType;
sal_uLong nFmtCurrencyIndex = nCurFmtIndex;
- short nFmtCurrencyType2 = css::util::NumberFormat::UNDEFINED;
+ SvNumFormatType nFmtCurrencyType2 = SvNumFormatType::UNDEFINED;
if ( GetStackType() == svMatrix )
pMat2 = GetMatrix();
else
@@ -1532,10 +1536,11 @@ void ScInterpreter::ScDiv()
fVal1 = GetDouble();
switch ( nCurFmtType )
{
- case css::util::NumberFormat::CURRENCY :
+ case SvNumFormatType::CURRENCY :
nFmtCurrencyType = nCurFmtType;
nFmtCurrencyIndex = nCurFmtIndex;
break;
+ default: break;
}
}
if (pMat1 && pMat2)
@@ -1576,8 +1581,8 @@ void ScInterpreter::ScDiv()
else
{
// Determine nFuncFmtType type before PushDouble().
- if ( nFmtCurrencyType == css::util::NumberFormat::CURRENCY &&
- nFmtCurrencyType2 != css::util::NumberFormat::CURRENCY)
+ if ( nFmtCurrencyType == SvNumFormatType::CURRENCY &&
+ nFmtCurrencyType2 != SvNumFormatType::CURRENCY)
{ // even USD/USD is not USD
nFuncFmtType = nFmtCurrencyType;
nFuncFmtIndex = nFmtCurrencyIndex;
@@ -3210,7 +3215,7 @@ void ScInterpreter::ScMatRef()
{
if (ScMatrix::IsEmptyPathType( nMatValType))
{ // result of empty false jump path
- nFuncFmtType = css::util::NumberFormat::LOGICAL;
+ nFuncFmtType = SvNumFormatType::LOGICAL;
PushInt(0);
}
else if (ScMatrix::IsEmptyType( nMatValType))
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 62c96376c664..e1bc0d696b0b 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -401,13 +401,13 @@ public:
void IterateMatrix(
const ScMatrixRef& pMat, ScIterFunc eFunc, bool bTextAsZero,
- sal_uLong& rCount, sal_uInt32& rFuncFmtType, double& fRes, double& fMem )
+ sal_uLong& rCount, SvNumFormatType& rFuncFmtType, double& fRes, double& fMem )
{
if (!pMat)
return;
// TODO fdo73148 take mnSubTotalFlags into account
- rFuncFmtType = css::util::NumberFormat::NUMBER;
+ rFuncFmtType = SvNumFormatType::NUMBER;
switch (eFunc)
{
case ifAVERAGE:
@@ -593,7 +593,7 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
case ifPRODUCT: fRes *= fVal; break;
default: ; // nothing
}
- nFuncFmtType = css::util::NumberFormat::NUMBER;
+ nFuncFmtType = SvNumFormatType::NUMBER;
break;
case svExternalSingleRef:
{
@@ -1003,8 +1003,8 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
// A boolean return type makes no sense on sums et al.
// Counts are always numbers.
- if( nFuncFmtType == css::util::NumberFormat::LOGICAL || eFunc == ifCOUNT || eFunc == ifCOUNT2 )
- nFuncFmtType = css::util::NumberFormat::NUMBER;
+ if( nFuncFmtType == SvNumFormatType::LOGICAL || eFunc == ifCOUNT || eFunc == ifCOUNT2 )
+ nFuncFmtType = SvNumFormatType::NUMBER;
if (xResMat)
{
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 95b5ad4d4ec3..c0078b5f8839 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;
- sal_uInt32 nCurFmtType = 0;
+ SvNumFormatType nCurFmtType = SvNumFormatType::ALL;
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_uInt32 nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::LOGICAL,
+ sal_uInt32 nKey = rFormatter.GetStandardFormat( SvNumFormatType::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_uInt32 nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::NUMBER,
+ sal_uInt32 nKey = rFormatter.GetStandardFormat( SvNumFormatType::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_uInt32 nKey = rFormatter.GetStandardFormat( css::util::NumberFormat::NUMBER,
+ sal_uInt32 nKey = rFormatter.GetStandardFormat( SvNumFormatType::NUMBER,
ScGlobal::eLnge);
std::vector<OUString> aString(nMaxCol * nMaxRow);
diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx
index 8ac5a3a6a0d0..62a7f0d53490 100644
--- a/sc/source/core/tool/stringutil.cxx
+++ b/sc/source/core/tool/stringutil.cxx
@@ -487,7 +487,7 @@ ScInputStringType ScStringUtil::parseInputString(
SvNumberFormatter& rFormatter, const OUString& rStr, LanguageType eLang )
{
ScInputStringType aRet;
- aRet.mnFormatType = 0;
+ aRet.mnFormatType = SvNumFormatType::ALL;
aRet.meType = ScInputStringType::Unknown;
aRet.maText = rStr;
aRet.mfValue = 0.0;
diff --git a/sc/source/core/tool/zforauto.cxx b/sc/source/core/tool/zforauto.cxx
index 7c55c4ca656f..89b97a229441 100644
--- a/sc/source/core/tool/zforauto.cxx
+++ b/sc/source/core/tool/zforauto.cxx
@@ -83,7 +83,7 @@ void ScNumFormatAbbrev::PutFormatIndex(sal_uInt32 nFormat,
sal_uInt32 ScNumFormatAbbrev::GetFormatIndex( SvNumberFormatter& rFormatter)
{
- short nType;
+ SvNumFormatType nType;
bool bNewInserted;
sal_Int32 nCheckPos;
return rFormatter.GetIndexPuttingAndConverting( sFormatstring, eLanguage,
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 9c741e5e08d1..2d664ed1f3e1 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -1371,7 +1371,7 @@ bool XclExpXct::BuildCrnList( XclExpCrnList& rCrnRecs )
if( xToken.get() ) switch( xToken->GetType() )
{
case svDouble:
- bValid = (rFormatter.GetType( nScNumFmt ) == css::util::NumberFormat::LOGICAL) ?
+ bValid = (rFormatter.GetType( nScNumFmt ) == SvNumFormatType::LOGICAL) ?
rCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetDouble() != 0 ) ) :
rCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetDouble() ) );
break;
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 21f2963f8abb..c954e85ed097 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -341,10 +341,10 @@ void XclExpPCField::InitStandardField( const ScRange& rRange )
if( rDoc.HasValueData( aPos.Col(), aPos.Row(), aPos.Tab() ) )
{
double fValue = rDoc.GetValue( aPos );
- short nFmtType = rFormatter.GetType( rDoc.GetNumberFormat( rDoc.GetNonThreadedContext(), aPos ) );
- if( nFmtType == css::util::NumberFormat::LOGICAL )
+ SvNumFormatType nFmtType = rFormatter.GetType( rDoc.GetNumberFormat( rDoc.GetNonThreadedContext(), aPos ) );
+ if( nFmtType == SvNumFormatType::LOGICAL )
InsertOrigBoolItem( fValue != 0, aText );
- else if( nFmtType & css::util::NumberFormat::DATETIME )
+ else if( nFmtType & SvNumFormatType::DATETIME )
InsertOrigDateTimeItem( GetDateTimeFromDouble( ::std::max( fValue, 0.0 ) ), aText );
else
InsertOrigDoubleItem( fValue, aText );
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 75980091a640..e8d9bb81062a 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -837,21 +837,21 @@ XclExpFormulaCell::XclExpFormulaCell(
"TRUE";"FALSE" (language dependent). Don't do it for automatic
formula formats, because Excel gets them right. */
/* #i8640# Don't set text format, if we have string results. */
- short nFormatType = mrScFmlaCell.GetFormatType();
+ SvNumFormatType nFormatType = mrScFmlaCell.GetFormatType();
if( ((nScNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0) &&
- (nFormatType != css::util::NumberFormat::LOGICAL) &&
- (nFormatType != css::util::NumberFormat::TEXT) )
+ (nFormatType != SvNumFormatType::LOGICAL) &&
+ (nFormatType != SvNumFormatType::TEXT) )
nAltScNumFmt = nScNumFmt;
/* If cell number format is Boolean and automatic formula
format is Boolean don't write that ugly special format. */
- else if( (nFormatType == css::util::NumberFormat::LOGICAL) &&
- (rFormatter.GetType( nScNumFmt ) == css::util::NumberFormat::LOGICAL) )
+ else if( (nFormatType == SvNumFormatType::LOGICAL) &&
+ (rFormatter.GetType( nScNumFmt ) == SvNumFormatType::LOGICAL) )
nAltScNumFmt = rNumFmtBfr.GetStandardFormat();
// #i41420# find script type according to result type (always latin for numeric results)
sal_Int16 nScript = ApiScriptType::LATIN;
bool bForceLineBreak = false;
- if( nFormatType == css::util::NumberFormat::TEXT )
+ if( nFormatType == SvNumFormatType::TEXT )
{
OUString aResult = mrScFmlaCell.GetString().getString();
bForceLineBreak = mrScFmlaCell.IsMultilineResult();
@@ -1051,14 +1051,14 @@ void XclExpFormulaCell::WriteContents( XclExpStream& rStrm )
// result of the formula
switch( mrScFmlaCell.GetFormatType() )
{
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::NUMBER:
{
// either value or error code
rStrm << mrScFmlaCell.GetValue();
}
break;
- case css::util::NumberFormat::TEXT:
+ case SvNumFormatType::TEXT:
{
OUString aResult = mrScFmlaCell.GetString().getString();
if( !aResult.isEmpty() || (rStrm.GetRoot().GetBiff() <= EXC_BIFF5) )
@@ -1072,7 +1072,7 @@ void XclExpFormulaCell::WriteContents( XclExpStream& rStrm )
}
break;
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
{
sal_uInt8 nXclValue = (mrScFmlaCell.GetValue() == 0.0) ? 0 : 1;
rStrm << EXC_FORMULA_RES_BOOL << sal_uInt8( 0 )
@@ -2538,7 +2538,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
if( pPattern && ((fValue == 0.0) || (fValue == 1.0)) )
{
sal_uInt32 nScNumFmt = pPattern->GetItemSet().Get( ATTR_VALUE_FORMAT ).GetValue();
- if( rFormatter.GetType( nScNumFmt ) == css::util::NumberFormat::LOGICAL )
+ if( rFormatter.GetType( nScNumFmt ) == SvNumFormatType::LOGICAL )
xCell.reset( new XclExpBooleanCell(
GetRoot(), aXclPos, pPattern, nMergeBaseXFId, fValue != 0.0 ) );
}
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index e63db6cdb1ab..122f99fcfe6b 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -79,7 +79,7 @@ XclImpPCItem::XclImpPCItem( XclImpStream& rStrm )
namespace {
-void lclSetValue( XclImpRoot& rRoot, const ScAddress& rScPos, double fValue, short nFormatType )
+void lclSetValue( XclImpRoot& rRoot, const ScAddress& rScPos, double fValue, SvNumFormatType nFormatType )
{
ScDocumentImport& rDoc = rRoot.GetDocImport();
rDoc.setNumericCell(rScPos, fValue);
@@ -100,15 +100,15 @@ void XclImpPCItem::WriteToSource( XclImpRoot& rRoot, const ScAddress& rScPos ) c
else if( const sal_Int16* pnValue = GetInteger() )
rDoc.setNumericCell(rScPos, *pnValue);
else if( const bool* pbValue = GetBool() )
- lclSetValue( rRoot, rScPos, *pbValue ? 1.0 : 0.0, css::util::NumberFormat::LOGICAL );
+ lclSetValue( rRoot, rScPos, *pbValue ? 1.0 : 0.0, SvNumFormatType::LOGICAL );
else if( const DateTime* pDateTime = GetDateTime() )
{
// set number format date, time, or date/time, depending on the value
double fValue = rRoot.GetDoubleFromDateTime( *pDateTime );
double fInt = 0.0;
double fFrac = modf( fValue, &fInt );
- short nFormatType = ((fFrac == 0.0) && (fInt != 0.0)) ? css::util::NumberFormat::DATE :
- ((fInt == 0.0) ? css::util::NumberFormat::TIME : css::util::NumberFormat::DATETIME);
+ SvNumFormatType nFormatType = ((fFrac == 0.0) && (fInt != 0.0)) ? SvNumFormatType::DATE :
+ ((fInt == 0.0) ? SvNumFormatType::TIME : SvNumFormatType::DATETIME);
lclSetValue( rRoot, rScPos, fValue, nFormatType );
}
else if( const sal_uInt16* pnError = GetError() )
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index b5ec74794629..3e7f98a2608b 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -693,7 +693,7 @@ void XclImpNumFmtBuffer::CreateScFormats()
// insert/convert the Excel number format
sal_Int32 nCheckPos;
- short nType = css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
sal_uInt32 nKey;
if( !rNumFmt.maFormat.isEmpty() )
{
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index e73739c84b59..273330749031 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2113,7 +2113,7 @@ void ScHTMLTable::DataOn( const HtmlImportInfo& rInfo )
if (nNumberFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
{
sal_Int32 nErrPos = 0;
- short nDummy;
+ SvNumFormatType nDummy;
bool bValidFmt = GetFormatTable()->PutEntry(aNumFmt, nErrPos, nDummy, nNumberFormat);
if (!bValidFmt)
nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index 420c69e7be5d..6a7945e39b34 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -165,7 +165,7 @@ SfxUInt32Item* FormCache::NewAttr( sal_uInt8 nFormat, sal_uInt8 nSt )
// setup new Format
sal_uInt8 nL, nH; // Low-/High-Nibble
OUString aFormString;
- sal_Int16 eType = css::util::NumberFormat::ALL;
+ SvNumFormatType eType = SvNumFormatType::ALL;
sal_uInt32 nIndex1;
sal_uInt32 nHandle;
NfIndexTableOffset eIndexTableOffset = NF_NUMERIC_START;
@@ -181,49 +181,49 @@ SfxUInt32Item* FormCache::NewAttr( sal_uInt8 nFormat, sal_uInt8 nSt )
case 0x00: // fixed-point number
//fStandard;nL;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::NUMBER, eLanguage );
+ SvNumFormatType::NUMBER, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, false, false, nL);
break;
case 0x01: // scientific notation
//fExponent;nL;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::SCIENTIFIC, eLanguage );
+ SvNumFormatType::SCIENTIFIC, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, false, false, nL);
break;
case 0x02: // currency
//fMoney;nL;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::CURRENCY, eLanguage );
+ SvNumFormatType::CURRENCY, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, false, false, nL);
break;
case 0x03: // percentage
//fPercent;nL;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::PERCENT, eLanguage );
+ SvNumFormatType::PERCENT, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, false, false, nL);
break;
case 0x04: // Decimal
//fStandard;nL;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::NUMBER, eLanguage );
+ SvNumFormatType::NUMBER, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, true, false, nL);
break;
case 0x05: // unspecified
//fStandard;nL;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::NUMBER, eLanguage );
+ SvNumFormatType::NUMBER, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, false, false, nL);
break;
case 0x06: // unspecified
//fStandard;nL;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::NUMBER, eLanguage );
+ SvNumFormatType::NUMBER, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, false, false, nL);
break;
@@ -233,74 +233,74 @@ SfxUInt32Item* FormCache::NewAttr( sal_uInt8 nFormat, sal_uInt8 nSt )
case 0x00: // +/-
//fStandard;nSt;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::NUMBER, eLanguage );
+ SvNumFormatType::NUMBER, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, false, true, nSt);
break;
case 0x01: // general Format
//fStandard;nSt;
nIndex1 = pFormTable->GetStandardFormat(
- css::util::NumberFormat::NUMBER, eLanguage );
+ SvNumFormatType::NUMBER, eLanguage );
aFormString = pFormTable->GenerateFormat(nIndex1,
eLanguage, false, false, nSt);
break;
case 0x02: // Date: Day, Month, Year
//fDate;dfDayMonthYearLong;
- eType = css::util::NumberFormat::DATE;
+ eType = SvNumFormatType::DATE;
eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
break;
case 0x03: // Date: Day, Month
//fDate;dfDayMonthLong;
- eType = css::util::NumberFormat::DATE;
+ eType = SvNumFormatType::DATE;
aFormString = pFormTable->GetKeyword( eLanguage, NF_KEY_DD);
aFormString += pFormTable->GetDateSep(); // matches last eLanguage
aFormString += pFormTable->GetKeyword( eLanguage, NF_KEY_MMMM);
break;
case 0x04: // Date: Month, Year
//fDate;dfMonthYearLong;
- eType = css::util::NumberFormat::DATE;
+ eType = SvNumFormatType::DATE;
aFormString = pFormTable->GetKeyword( eLanguage, NF_KEY_MM);
aFormString += pFormTable->GetDateSep(); // matches last eLanguage
aFormString += pFormTable->GetKeyword( eLanguage, NF_KEY_YYYY);
break;
case 0x05: // Text formats
//fString;nSt;
- eType = css::util::NumberFormat::TEXT;
+ eType = SvNumFormatType::TEXT;
eIndexTableOffset = NF_TEXT;
break;
case 0x06: // hidden
//wFlag |= paHideAll;bSetFormat = sal_False;
- eType = css::util::NumberFormat::NUMBER;
+ eType = SvNumFormatType::NUMBER;
aFormString = "\"\"";
break;
case 0x07: // Time: hour, min, sec
//fTime;tfHourMinSec24;
- eType = css::util::NumberFormat::TIME;
+ eType = SvNumFormatType::TIME;
eIndexTableOffset = NF_TIME_HHMMSS;
break;
case 0x08: // Time: hour, min
//fTime;tfHourMin24;
- eType = css::util::NumberFormat::TIME;
+ eType = SvNumFormatType::TIME;
eIndexTableOffset = NF_TIME_HHMM;
break;
case 0x09: // Date, intern sal_Int32 1
//fDate;dfDayMonthYearLong;
- eType = css::util::NumberFormat::DATE;
+ eType = SvNumFormatType::DATE;
eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
break;
case 0x0A: // Date, intern sal_Int32 2
//fDate;dfDayMonthYearLong;
- eType = css::util::NumberFormat::DATE;
+ eType = SvNumFormatType::DATE;
eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
break;
case 0x0B: // Time, intern sal_Int32 1
//fTime;tfHourMinSec24;
- eType = css::util::NumberFormat::TIME;
+ eType = SvNumFormatType::TIME;
eIndexTableOffset = NF_TIME_HHMMSS;
break;
case 0x0C: // Time, intern sal_Int32 2
//fTime;tfHourMinSec24;
- eType = css::util::NumberFormat::TIME;
+ eType = SvNumFormatType::TIME;
eIndexTableOffset = NF_TIME_HHMMSS;
break;
case 0x0F: // Default
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 89f65027a3e4..6809aae2599a 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1217,7 +1217,7 @@ void ScOrcusStyles::number_format::applyToItemSet(SfxItemSet& rSet, const ScDocu
sal_Int32 nCheckPos;
SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
OUString Code = maCode; /* <-- Done because the SvNumberFormatter::PutEntry demands a non const NumFormat Code*/
- sal_Int16 type = css::util::NumberFormat::ALL;
+ SvNumFormatType type = SvNumFormatType::ALL;
if (pFormatter->PutEntry(Code, nCheckPos, type, nKey, LANGUAGE_ENGLISH_US))
{
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 0214a78240d6..8a0bd018edb4 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -368,8 +368,8 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
if (rSet.GetItemState(ATTR_VALUE_FORMAT, false, &pNumFmt) == SfxItemState::SET)
{
sal_uInt32 nNumFmt = static_cast<const SfxUInt32Item*>(pNumFmt)->GetValue();
- sal_uInt16 nType = pFormatter->GetType(nNumFmt);
- if (nType == css::util::NumberFormat::TEXT)
+ SvNumFormatType nType = pFormatter->GetType(nNumFmt);
+ if (nType == SvNumFormatType::TEXT)
// Format is set to Text.
bTextFormat = true;
}
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index 1e344fbb6325..47b441c10ec7 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -262,7 +262,7 @@ void XclImpChangeTrack::ReadCell(
{
rCell.meType = CELLTYPE_VALUE;
rCell.mfValue = fValue;
- rFormat = GetFormatter().GetStandardFormat( css::util::NumberFormat::LOGICAL, ScGlobal::eLnge );
+ rFormat = GetFormatter().GetStandardFormat( SvNumFormatType::LOGICAL, ScGlobal::eLnge );
}
}
break;
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index ffb75272c9df..0aebfc49f838 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -220,12 +220,12 @@ void ScChangeTrackingExportHelper::SetValueAttributes(const double& fValue, cons
double fTempValue = 0.0;
if (rExport.GetDocument() && rExport.GetDocument()->GetFormatTable()->IsNumberFormat(sValue, nIndex, fTempValue))
{
- sal_uInt16 nType = rExport.GetDocument()->GetFormatTable()->GetType(nIndex);
- if ((nType & css::util::NumberFormat::DEFINED) == css::util::NumberFormat::DEFINED)
- nType -= css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = rExport.GetDocument()->GetFormatTable()->GetType(nIndex);
+ if (nType & SvNumFormatType::DEFINED)
+ nType &= ~SvNumFormatType::DEFINED;
switch(nType)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
{
if ( rExport.GetMM100UnitConverter().setNullDate(rExport.GetModel()) )
{
@@ -237,7 +237,7 @@ void ScChangeTrackingExportHelper::SetValueAttributes(const double& fValue, cons
}
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
{
rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TIME);
OUStringBuffer sBuffer;
@@ -246,6 +246,7 @@ void ScChangeTrackingExportHelper::SetValueAttributes(const double& fValue, cons
bSetAttributes = true;
}
break;
+ default: break;
}
}
}
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index df77e3e6cfe8..d80c867c092f 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -69,9 +69,9 @@ const ScCellValue& ScMyCellInfo::CreateCell( ScDocument* pDoc )
{
sal_uInt32 nFormat(0);
if (nType == css::util::NumberFormat::DATE)
- nFormat = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::DATE, ScGlobal::eLnge );
+ nFormat = pDoc->GetFormatTable()->GetStandardFormat( SvNumFormatType::DATE, ScGlobal::eLnge );
else if (nType == css::util::NumberFormat::TIME)
- nFormat = pDoc->GetFormatTable()->GetStandardFormat( css::util::NumberFormat::TIME, ScGlobal::eLnge );
+ nFormat = pDoc->GetFormatTable()->GetStandardFormat( SvNumFormatType::TIME, ScGlobal::eLnge );
pDoc->GetFormatTable()->GetInputLineString(fValue, nFormat, sInputString);
}
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 4afd6f76e4a1..c1b87303e9a4 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2085,7 +2085,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
if ( SfxItemState::SET == rAttrSet.GetItemState( ATTR_VALUE_FORMAT, true, &pItem ) )
{
sal_uLong nFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
- bCellHasPercentFormat = ( css::util::NumberFormat::PERCENT ==
+ bCellHasPercentFormat = ( SvNumFormatType::PERCENT ==
rDoc.GetFormatTable()->GetType( nFormat ) );
}
else
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 100de526766a..78932e96091f 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -278,7 +278,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet )
{
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
pFormatter->GetInputLineString(rItem.mfVal,
- pFormatter->GetStandardFormat( css::util::NumberFormat::DATE), aValStr);
+ pFormatter->GetStandardFormat( SvNumFormatType::DATE), aValStr);
}
}
else
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 198cc709debe..f24ccce4dfcb 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -270,7 +270,7 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector<long>& rScales
if (nNewFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
{
sal_Int32 nErrPos = 0;
- short nNewType = 0;
+ SvNumFormatType nNewType = SvNumFormatType::ALL;
bool bOk = pFormatter->PutEntry(
aNewPicture, nErrPos, nNewType, nNewFormat, eLang);
@@ -599,16 +599,16 @@ void lcl_GetColumnTypes(
rDoc.GetNumberFormat( nCol, nFirstDataRow, nTab, nFormat );
switch ( pNumFmt->GetType( nFormat ) )
{
- case css::util::NumberFormat::LOGICAL :
+ case SvNumFormatType::LOGICAL :
nDbType = sdbc::DataType::BIT;
nFieldLen = 1;
break;
- case css::util::NumberFormat::DATE :
+ case SvNumFormatType::DATE :
nDbType = sdbc::DataType::DATE;
nFieldLen = 8;
break;
- case css::util::NumberFormat::TIME :
- case css::util::NumberFormat::DATETIME :
+ case SvNumFormatType::TIME :
+ case SvNumFormatType::DATETIME :
nDbType = sdbc::DataType::VARCHAR;
break;
default:
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index fb10655bfb09..4c85fdbd7acc 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -467,7 +467,7 @@ ScExternalRefCache::TableName::TableName(const OUString& rUpper, const OUString&
}
ScExternalRefCache::CellFormat::CellFormat() :
- mbIsSet(false), mnType(css::util::NumberFormat::ALL), mnIndex(0)
+ mbIsSet(false), mnType(SvNumFormatType::ALL), mnIndex(0)
{
}
@@ -2227,8 +2227,8 @@ void ScExternalRefManager::fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCach
if (!pFmt)
return;
- short nFmtType = mpDoc->GetFormatTable()->GetType(nFmtIndex);
- if (nFmtType != css::util::NumberFormat::UNDEFINED)
+ SvNumFormatType nFmtType = mpDoc->GetFormatTable()->GetType(nFmtIndex);
+ if (nFmtType != SvNumFormatType::UNDEFINED)
{
pFmt->mbIsSet = true;
pFmt->mnIndex = nFmtIndex;
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 26208259099d..e11fb4eec704 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -955,7 +955,7 @@ static bool lcl_PutString(
if (pFormatter->IsNumberFormat(rStr, nIndex, fDummy))
{
// Set the format of this cell to Text.
- sal_uInt32 nFormat = pFormatter->GetStandardFormat(css::util::NumberFormat::TEXT);
+ sal_uInt32 nFormat = pFormatter->GetStandardFormat(SvNumFormatType::TEXT);
ScPatternAttr aNewAttrs(pDoc->GetPool());
SfxItemSet& rSet = aNewAttrs.GetItemSet();
rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nFormat) );
@@ -1177,7 +1177,7 @@ static bool lcl_PutString(
pDoc->GetLanguage( eLatin, eCjk, eCtl );
LanguageType eDocLang = eLatin; //! which language for date formats?
- short nType = (nFound > 3 ? css::util::NumberFormat::DATETIME : css::util::NumberFormat::DATE);
+ SvNumFormatType nType = (nFound > 3 ? SvNumFormatType::DATETIME : SvNumFormatType::DATE);
sal_uLong nFormat = pDocFormatter->GetStandardFormat( nType, eDocLang );
// maybe there is a special format including seconds or milliseconds
if (nFound > 5)
@@ -1987,7 +1987,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm )
// get rid of Xcl escape characters
aCode = aCode.replaceAll("\x1b", "");
sal_Int32 nCheckPos;
- short nType;
+ SvNumFormatType nType;
sal_uInt32 nKey;
pDoc->GetFormatTable()->PutandConvertEntry( aCode, nCheckPos, nType, nKey,
LANGUAGE_ENGLISH_US, ScGlobal::eLnge );
diff --git a/sc/source/ui/inc/formatsh.hxx b/sc/source/ui/inc/formatsh.hxx
index 7b1c5e936963..1b2123780e3e 100644
--- a/sc/source/ui/inc/formatsh.hxx
+++ b/sc/source/ui/inc/formatsh.hxx
@@ -26,6 +26,7 @@
#include <svx/svdmark.hxx>
class ScViewData;
+enum class SvNumFormatType : sal_Int16;
class ScFormatShell: public SfxShell
{
@@ -70,7 +71,7 @@ public:
void StateFormatPaintbrush( SfxItemSet& rSet );
private:
- short GetCurrentNumberFormatType();
+ SvNumFormatType GetCurrentNumberFormatType();
};
#endif
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 552dc52172ec..019681be07f4 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -175,7 +175,7 @@ public:
void RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet );
void UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet );
- void SetNumberFormat( short nFormatType, sal_uLong nAdd = 0 );
+ void SetNumberFormat( SvNumFormatType nFormatType, sal_uLong nAdd = 0 );
void SetNumFmtByStr( const OUString& rCode );
void ChangeNumFmtDecimals( bool bIncrement );
@@ -308,7 +308,7 @@ public:
void DetectiveMarkPred();
void DetectiveMarkSucc();
- void InsertCurrentTime(short nCellFmt, const OUString& rUndoStr);
+ void InsertCurrentTime(SvNumFormatType nCellFmt, const OUString& rUndoStr);
void ShowNote( bool bShow );
void EditNote();
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 66470eac4194..995ffc1a19f7 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1385,7 +1385,7 @@ static OUString lcl_GetInputString( ScDocument& rDoc, const ScAddress& rPos, boo
{
// if the string starts with a "'", add another one because setFormula
// strips one (like text input, except for "text" number formats)
- if ( bEnglish || ( pFormatter->GetType(nNumFmt) != css::util::NumberFormat::TEXT ) )
+ if ( bEnglish || ( pFormatter->GetType(nNumFmt) != SvNumFormatType::TEXT ) )
aTempString = "'" + aTempString;
}
aVal = aTempString;
@@ -3538,9 +3538,9 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC
sal_uLong nIndex = (sal_uLong)static_cast<const SfxUInt32Item*>(rDoc.GetAttr(
aIter.GetPos(), ATTR_VALUE_FORMAT))->GetValue();
- short nTyp = rDoc.GetFormatTable()->GetType(nIndex);
- if ((nTyp == css::util::NumberFormat::DATE) || (nTyp == css::util::NumberFormat::TIME) ||
- (nTyp == css::util::NumberFormat::DATETIME))
+ SvNumFormatType nTyp = rDoc.GetFormatTable()->GetType(nIndex);
+ if ((nTyp == SvNumFormatType::DATE) || (nTyp == SvNumFormatType::TIME) ||
+ (nTyp == SvNumFormatType::DATETIME))
{
if ( nContentFlags & sheet::CellFlags::DATETIME )
bAdd = true;
@@ -6107,7 +6107,7 @@ void ScCellObj::InputEnglishString( const OUString& rText )
ScDocument& rDoc = pDocSh->GetDocument();
SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
sal_uInt32 nOldFormat = rDoc.GetNumberFormat( aCellPos );
- if (pFormatter->GetType(nOldFormat) == css::util::NumberFormat::TEXT)
+ if (pFormatter->GetType(nOldFormat) == SvNumFormatType::TEXT)
{
SetString_Impl(rText, false, false); // text cell
return;
@@ -6120,7 +6120,7 @@ void ScCellObj::InputEnglishString( const OUString& rText )
if (aRes.meType != ScInputStringType::Unknown)
{
- if ((nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 && aRes.mnFormatType)
+ if ((nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 && aRes.mnFormatType != SvNumFormatType::ALL)
{
// apply a format for the recognized type and the old format's language
sal_uInt32 nNewFormat = ScGlobal::GetStandardFormat(*pFormatter, nOldFormat, aRes.mnFormatType);
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 947679591bbf..8769766b2539 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -646,8 +646,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
else
{
- short nPrivType = pPrivEntry->GetType();
- if ( ( nPrivType & css::util::NumberFormat::DATE)>0)
+ SvNumFormatType nPrivType = pPrivEntry->GetType();
+ if (nPrivType & SvNumFormatType::DATE)
{
eFillCmd=FILL_DATE;
}
@@ -789,7 +789,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
rReq.AppendItem( SfxStringItem( FN_PARAM_2, aPara ) );
- sal_uInt32 nFormatKey = pFormatter->GetStandardFormat(css::util::NumberFormat::NUMBER,
+ sal_uInt32 nFormatKey = pFormatter->GetStandardFormat(SvNumFormatType::NUMBER,
ScGlobal::eLnge );
pFormatter->GetOutputString( fIncVal, nFormatKey, aPara, &pColor );
@@ -1735,11 +1735,11 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
break;
case SID_INSERT_CURRENT_DATE:
pTabViewShell->InsertCurrentTime(
- css::util::NumberFormat::DATE, ScGlobal::GetRscString(STR_UNDO_INSERT_CURRENT_DATE));
+ SvNumFormatType::DATE, ScGlobal::GetRscString(STR_UNDO_INSERT_CURRENT_DATE));
break;
case SID_INSERT_CURRENT_TIME:
pTabViewShell->InsertCurrentTime(
- css::util::NumberFormat::TIME, ScGlobal::GetRscString(STR_UNDO_INSERT_CURRENT_TIME));
+ SvNumFormatType::TIME, ScGlobal::GetRscString(STR_UNDO_INSERT_CURRENT_TIME));
break;
case SID_SPELL_DIALOG:
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 3f81e5385d9c..0b0c21627944 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -844,8 +844,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
sal_uInt32 nNumFmt = 0;
if ( eMode == SC_VALID_DATE || eMode == SC_VALID_TIME )
{
- short nType = ( eMode == SC_VALID_DATE ) ? css::util::NumberFormat::DATE
- : css::util::NumberFormat::TIME;
+ SvNumFormatType nType = ( eMode == SC_VALID_DATE ) ? SvNumFormatType::DATE
+ : SvNumFormatType::TIME;
nNumFmt = pDoc->GetFormatTable()->GetStandardFormat(
nType, ScGlobal::eLnge );
}
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 9483af89e256..b9dae74dc330 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -847,8 +847,8 @@ bool ScDBFunc::HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32&
{
sal_uLong nIndex = static_cast<const SfxUInt32Item*>(pDoc->GetAttr(
nSelCol, nSelRow, nSelTab, ATTR_VALUE_FORMAT))->GetValue();
- short nType = pDoc->GetFormatTable()->GetType(nIndex);
- if ( nType == css::util::NumberFormat::DATE || nType == css::util::NumberFormat::TIME || nType == css::util::NumberFormat::DATETIME )
+ SvNumFormatType nType = pDoc->GetFormatTable()->GetType(nIndex);
+ if ( nType == SvNumFormatType::DATE || nType == SvNumFormatType::TIME || nType == SvNumFormatType::DATETIME )
{
bFound = true;
// use currently selected value for automatic limits
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index c1938e213908..cc718541f730 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1030,7 +1030,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
}
}
- short nType = GetCurrentNumberFormatType();
+ SvNumFormatType nType = GetCurrentNumberFormatType();
SfxItemSet aSet( GetPool(), {{nSlot, nSlot}} );
switch ( nSlot )
{
@@ -1039,38 +1039,38 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue();
- if ((nType & css::util::NumberFormat::NUMBER) && nNumberFormat == 4)
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+ if ((nType & SvNumFormatType::NUMBER) && nNumberFormat == 4)
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
else
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER, 4 );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER, 4 );
rBindings.Invalidate( nSlot );
rReq.Done();
}
break;
case SID_NUMBER_SCIENTIFIC:
- if (nType & css::util::NumberFormat::SCIENTIFIC)
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+ if (nType & SvNumFormatType::SCIENTIFIC)
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
else
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::SCIENTIFIC );
- aSet.Put( SfxBoolItem(nSlot, !(nType & css::util::NumberFormat::SCIENTIFIC)) );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::SCIENTIFIC );
+ aSet.Put( SfxBoolItem(nSlot, !(nType & SvNumFormatType::SCIENTIFIC)) );
rBindings.Invalidate( nSlot );
rReq.Done();
break;
case SID_NUMBER_DATE:
- if (nType & css::util::NumberFormat::DATE)
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+ if (nType & SvNumFormatType::DATE)
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
else
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::DATE );
- aSet.Put( SfxBoolItem(nSlot, !(nType & css::util::NumberFormat::DATE)) );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::DATE );
+ aSet.Put( SfxBoolItem(nSlot, !(nType & SvNumFormatType::DATE)) );
rBindings.Invalidate( nSlot );
rReq.Done();
break;
case SID_NUMBER_TIME:
- if (nType & css::util::NumberFormat::TIME)
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+ if (nType & SvNumFormatType::TIME)
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
else
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::TIME );
- aSet.Put( SfxBoolItem(nSlot, !(nType & css::util::NumberFormat::TIME)) );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::TIME );
+ aSet.Put( SfxBoolItem(nSlot, !(nType & SvNumFormatType::TIME)) );
rBindings.Invalidate( nSlot );
rReq.Done();
break;
@@ -1100,30 +1100,30 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
pTabViewShell->ApplySelectionPattern( aNewAttrs );
}
else
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
}
}
else
{
- if ( nType & css::util::NumberFormat::CURRENCY )
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+ if ( nType & SvNumFormatType::CURRENCY )
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
else
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::CURRENCY );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::CURRENCY );
}
rBindings.Invalidate( nSlot );
rReq.Done();
break;
case SID_NUMBER_PERCENT:
- if (nType & css::util::NumberFormat::PERCENT)
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+ if (nType & SvNumFormatType::PERCENT)
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
else
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::PERCENT );
- aSet.Put( SfxBoolItem(nSlot, !(nType & css::util::NumberFormat::PERCENT)) );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::PERCENT );
+ aSet.Put( SfxBoolItem(nSlot, !(nType & SvNumFormatType::PERCENT)) );
rBindings.Invalidate( nSlot );
rReq.Done();
break;
case SID_NUMBER_STANDARD:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER );
rReq.Done();
break;
case SID_NUMBER_INCDEC:
@@ -1174,41 +1174,35 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
const SfxPoolItem* pItem;
ScDocument* pDoc = pViewData->GetDocument();
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
- LanguageType eLanguage = ScGlobal::eLnge;
- sal_Int16 eType = -1;
sal_uInt32 nCurrentNumberFormat;
pDoc->GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat);
const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
- if(pEntry)
- {
- eLanguage = pEntry->GetLanguage();
- eType = pEntry->GetType();
- }
+ if(!pEntry)
+ break;
+
+ LanguageType eLanguage = pEntry->GetLanguage();
+ SvNumFormatType eType = pEntry->GetType();
//Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY/SCIENTIFIC/FRACTION
//In sidebar, users can fire SID_NUMBER_FORMAT command by operating the related UI controls before they are disable
- switch(eType)
- {
- case css::util::NumberFormat::ALL:
- case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::NUMBER| css::util::NumberFormat::DEFINED:
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::PERCENT| css::util::NumberFormat::DEFINED:
- case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::CURRENCY|css::util::NumberFormat::DEFINED:
- case css::util::NumberFormat::SCIENTIFIC:
- case css::util::NumberFormat::SCIENTIFIC|css::util::NumberFormat::DEFINED:
- case css::util::NumberFormat::FRACTION:
- case css::util::NumberFormat::FRACTION|css::util::NumberFormat::DEFINED:
- eType = 0;
- break;
- default:
- eType =-1;
- }
+ if(eType == SvNumFormatType::ALL
+ || eType == SvNumFormatType::NUMBER
+ || eType == (SvNumFormatType::NUMBER | SvNumFormatType::DEFINED)
+ || eType == SvNumFormatType::PERCENT
+ || eType == (SvNumFormatType::PERCENT | SvNumFormatType::DEFINED)
+ || eType == SvNumFormatType::CURRENCY
+ || eType == (SvNumFormatType::CURRENCY | SvNumFormatType::DEFINED)
+ || eType == SvNumFormatType::SCIENTIFIC
+ || eType == (SvNumFormatType::SCIENTIFIC | SvNumFormatType::DEFINED)
+ || eType == SvNumFormatType::FRACTION
+ || eType == (SvNumFormatType::FRACTION | SvNumFormatType::DEFINED))
+ eType = SvNumFormatType::ALL;
+ else
+ pEntry = nullptr;
- if(SfxItemState::SET == pReqArgs->GetItemState(nSlot, true, &pItem) && eType != -1)
+ if(SfxItemState::SET == pReqArgs->GetItemState(nSlot, true, &pItem) && pEntry)
{
OUString aCode = static_cast<const SfxStringItem*>(pItem)->GetValue();
sal_uInt16 aLen = aCode.getLength();
@@ -1284,34 +1278,34 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
switch(nFormat)
{
case 0:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER); //Modify
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER); //Modify
break;
case 1:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER, 2 ); //Modify
+ pTabViewShell->SetNumberFormat( SvNumFormatType::NUMBER, 2 ); //Modify
break;
case 2:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::PERCENT );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::PERCENT );
break;
case 3:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::CURRENCY );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::CURRENCY );
break;
case 4:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::DATE );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::DATE );
break;
case 5:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::TIME );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::TIME );
break;
case 6:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::SCIENTIFIC );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::SCIENTIFIC );
break;
case 7:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::FRACTION );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::FRACTION );
break;
case 8:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::LOGICAL );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::LOGICAL );
break;
case 9:
- pTabViewShell->SetNumberFormat( css::util::NumberFormat::TEXT );
+ pTabViewShell->SetNumberFormat( SvNumFormatType::TEXT );
break;
default:
;
@@ -2520,8 +2514,8 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
// selected cells' attribute ranges to
// determine selected types.
// Does *NOT* include the
- // css::util::NumberFormat::DEFINED bit.
- const short nType = (eItemState >= SfxItemState::DEFAULT ? pFormatter->GetType( nNumberFormat) :
+ // SvNumFormatType::DEFINED bit.
+ const SvNumFormatType nType = (eItemState >= SfxItemState::DEFAULT ? pFormatter->GetType( nNumberFormat) :
GetCurrentNumberFormatType());
NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat);
@@ -2537,11 +2531,11 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
bool bEnable = (SfxItemState::DONTCARE != eItemState);
if (bEnable)
{
- bEnable = ((nType != css::util::NumberFormat::ALL) && (nType &
- (css::util::NumberFormat::NUMBER |
- css::util::NumberFormat::PERCENT |
- css::util::NumberFormat::CURRENCY |
- css::util::NumberFormat::FRACTION)));
+ bEnable = ((nType != SvNumFormatType::ALL) && (nType &
+ (SvNumFormatType::NUMBER |
+ SvNumFormatType::PERCENT |
+ SvNumFormatType::CURRENCY |
+ SvNumFormatType::FRACTION)));
if (bEnable)
{
bool bThousand( false );
@@ -2571,7 +2565,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
pFormatter->GetFormatSpecialInfo(nNumberFormat,bThousand, bNegRed, nPrecision, nLeadZeroes);
const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
- if (pFormatEntry && (pFormatEntry->GetType() & css::util::NumberFormat::SCIENTIFIC))
+ if (pFormatEntry && (pFormatEntry->GetType() & SvNumFormatType::SCIENTIFIC))
{
// if scientific, bThousand is used for engineering notation
const sal_uInt16 nIntegerDigits = pFormatEntry->GetFormatIntegerDigits();
@@ -2609,37 +2603,37 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
{
switch(nType)
{
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::NUMBER:
// Determine if General format.
if ((nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
nFormatCategory = 0;
else
nFormatCategory = 1;
break;
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
nFormatCategory = 2;
break;
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::CURRENCY:
nFormatCategory = 3;
break;
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
//Add
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
nFormatCategory = 4;
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
nFormatCategory = 5;
break;
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
nFormatCategory = 6;
break;
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::FRACTION:
nFormatCategory = 7;
break;
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
nFormatCategory = 8;
break;
- case css::util::NumberFormat::TEXT:
+ case SvNumFormatType::TEXT:
nFormatCategory = 9;
break;
default:
@@ -2658,25 +2652,25 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
}
break;
case SID_NUMBER_CURRENCY:
- rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::CURRENCY)) );
+ rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::CURRENCY)) );
break;
case SID_NUMBER_SCIENTIFIC:
- rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::SCIENTIFIC)) );
+ rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::SCIENTIFIC)) );
break;
case SID_NUMBER_DATE:
- rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::DATE)) );
+ rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::DATE)) );
break;
case SID_NUMBER_PERCENT:
- rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::PERCENT)) );
+ rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::PERCENT)) );
break;
case SID_NUMBER_TIME:
- rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::TIME)) );
+ rSet.Put( SfxBoolItem(nWhich, bool(nType & SvNumFormatType::TIME)) );
break;
case SID_NUMBER_TWODEC:
- rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::NUMBER) && nOffset == NF_NUMBER_1000DEC2 ) );
+ rSet.Put( SfxBoolItem(nWhich, (nType & SvNumFormatType::NUMBER) && nOffset == NF_NUMBER_1000DEC2 ) );
break;
case SID_NUMBER_STANDARD:
- rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::NUMBER) && (nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) );
+ rSet.Put( SfxBoolItem(nWhich, (nType & SvNumFormatType::NUMBER) && (nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) );
break;
}
nWhich = aIter.NextWhich();
@@ -2829,9 +2823,9 @@ void ScFormatShell::StateFormatPaintbrush( SfxItemSet& rSet )
rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, pViewData->GetView()->HasPaintBrush() ) );
}
-short ScFormatShell::GetCurrentNumberFormatType()
+SvNumFormatType ScFormatShell::GetCurrentNumberFormatType()
{
- short nType = css::util::NumberFormat::ALL;
+ SvNumFormatType nType = SvNumFormatType::ALL;
ScDocument* pDoc = GetViewData()->GetDocument();
ScMarkData aMark(GetViewData()->GetMarkData());
const SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
@@ -2849,7 +2843,7 @@ short ScFormatShell::GetCurrentNumberFormatType()
const ScMultiSel& rMultiSel = aMark.GetMultiSelData();
- short nComboType = css::util::NumberFormat::ALL;
+ SvNumFormatType nComboType = SvNumFormatType::ALL;
bool bFirstItem = true;
for (SCCOL nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); ++nCol)
{
@@ -2863,7 +2857,7 @@ short ScFormatShell::GetCurrentNumberFormatType()
ScRange aColRange(nCol, nRow1, aRange.aStart.Tab());
aColRange.aEnd.SetRow(nRow2);
sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aColRange);
- short nThisType = pFormatter->GetType(nNumFmt);
+ SvNumFormatType nThisType = pFormatter->GetType(nNumFmt);
if (bFirstItem)
{
bFirstItem = false;
@@ -2871,7 +2865,7 @@ short ScFormatShell::GetCurrentNumberFormatType()
}
else if (nComboType != nThisType)
// mixed number format type.
- return css::util::NumberFormat::ALL;
+ return SvNumFormatType::ALL;
}
}
nType = nComboType;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 25bc75f745ce..9e0d761e64d8 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -284,7 +284,7 @@ bool lcl_isNumberFormatText(const ScDocument* pDoc, SCCOL nCellX, SCROW nCellY,
sal_uInt32 nCurrentNumberFormat;
pDoc->GetNumberFormat( nCellX, nCellY, nTab, nCurrentNumberFormat);
SvNumberFormatter* pNumberFormatter = pDoc->GetFormatTable();
- return pNumberFormatter->GetType( nCurrentNumberFormat ) == css::util::NumberFormat::TEXT;
+ return pNumberFormatter->GetType( nCurrentNumberFormat ) == SvNumFormatType::TEXT;
}
void ScDrawStringsVars::SetPattern(
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index fb4c178e10f1..e3ff5a013a01 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -828,7 +828,7 @@ void ScViewFunc::EnterBlock( const OUString& rString, const EditTextObject* pDat
rMark.GetMarkArea( aRange );
std::unique_ptr<ScPatternAttr> pPattern(new ScPatternAttr( pDoc->GetPool() ));
pPattern->GetItemSet().Put( *pItem );
- short nNewType = pDoc->GetFormatTable()->GetType( pItem->GetValue() );
+ SvNumFormatType nNewType = pDoc->GetFormatTable()->GetType( pItem->GetValue() );
pDoc->ApplyPatternIfNumberformatIncompatible( aRange, rMark,
*pPattern, nNewType );
}
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index e5bc488a7724..6e13f26e27e7 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -255,7 +255,7 @@ void ScViewFunc::DetectiveMarkSucc()
- unless cell was empty => current date+time => date+time formatted cell
- key time on other cell => current time => time formatted cell
*/
-void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
+void ScViewFunc::InsertCurrentTime(SvNumFormatType nReqFmt, const OUString& rUndoStr)
{
ScViewData& rViewData = GetViewData();
@@ -268,8 +268,8 @@ void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
const sal_uInt32 nCurNumFormat = rDoc.GetNumberFormat(aCurPos);
SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
const SvNumberformat* pCurNumFormatEntry = pFormatter->GetEntry(nCurNumFormat);
- const short nCurNumFormatType = (pCurNumFormatEntry ?
- pCurNumFormatEntry->GetMaskedType() : css::util::NumberFormat::UNDEFINED);
+ const SvNumFormatType nCurNumFormatType = (pCurNumFormatEntry ?
+ pCurNumFormatEntry->GetMaskedType() : SvNumFormatType::UNDEFINED);
if (bInputMode)
{
@@ -277,31 +277,31 @@ void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
sal_uInt32 nFormat = 0;
switch (nReqFmt)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
{
Date aActDate( Date::SYSTEM );
fVal = aActDate - pFormatter->GetNullDate();
- if (nCurNumFormatType == css::util::NumberFormat::DATE)
+ if (nCurNumFormatType == SvNumFormatType::DATE)
nFormat = nCurNumFormat;
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
{
tools::Time aActTime( tools::Time::SYSTEM );
fVal = aActTime.GetTimeInDays();
- if (nCurNumFormatType == css::util::NumberFormat::TIME)
+ if (nCurNumFormatType == SvNumFormatType::TIME)
nFormat = nCurNumFormat;
}
break;
default:
SAL_WARN("sc.ui","unhandled current date/time request");
- nReqFmt = css::util::NumberFormat::DATETIME;
+ nReqFmt = SvNumFormatType::DATETIME;
SAL_FALLTHROUGH;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
{
DateTime aActDateTime( DateTime::SYSTEM );
fVal = aActDateTime - DateTime( pFormatter->GetNullDate());
- if (nCurNumFormatType == css::util::NumberFormat::DATETIME)
+ if (nCurNumFormatType == SvNumFormatType::DATETIME)
nFormat = nCurNumFormat;
}
break;
@@ -335,17 +335,17 @@ void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
// Combine requested date/time stamp with existing cell time/date, if any.
switch (nReqFmt)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
switch (nCurNumFormatType)
{
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
// An empty cell formatted as time (or 00:00 time) shall
// not result in the current date with 00:00 time, but only
// in current date.
if (fCell != 0.0)
- nReqFmt = css::util::NumberFormat::DATETIME;
+ nReqFmt = SvNumFormatType::DATETIME;
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
{
// Force to only date if the existing date+time is the
// current date. This way inserting current date twice
@@ -357,22 +357,23 @@ void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
bForceReqFmt = true;
}
break;
+ default: break;
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
switch (nCurNumFormatType)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
// An empty cell formatted as date shall not result in the
// null date and current time, but only in current time.
if (fCell != 0.0)
- nReqFmt = css::util::NumberFormat::DATETIME;
+ nReqFmt = SvNumFormatType::DATETIME;
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
// Requesting current time on an empty date+time cell
// inserts both current date+time.
if (fCell == 0.0)
- nReqFmt = css::util::NumberFormat::DATETIME;
+ nReqFmt = SvNumFormatType::DATETIME;
else
{
// Add current time to an existing date+time where time is
@@ -380,46 +381,47 @@ void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
double fDate = rtl::math::approxFloor( fCell);
double fTime = fCell - fDate;
if (fTime == 0.0 && fDate == (Date( Date::SYSTEM) - pFormatter->GetNullDate()))
- nReqFmt = css::util::NumberFormat::DATETIME;
+ nReqFmt = SvNumFormatType::DATETIME;
else
bForceReqFmt = true;
}
break;
+ default: break;
}
break;
default:
SAL_WARN("sc.ui","unhandled current date/time request");
- nReqFmt = css::util::NumberFormat::DATETIME;
+ nReqFmt = SvNumFormatType::DATETIME;
SAL_FALLTHROUGH;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
break;
}
double fVal = 0.0;
switch (nReqFmt)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
{
Date aActDate( Date::SYSTEM );
fVal = aActDate - pFormatter->GetNullDate();
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
{
tools::Time aActTime( tools::Time::SYSTEM );
fVal = aActTime.GetTimeInDays();
}
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
switch (nCurNumFormatType)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
{
double fDate = rtl::math::approxFloor( fCell);
tools::Time aActTime( tools::Time::SYSTEM );
fVal = fDate + aActTime.GetTimeInDays();
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
{
double fTime = fCell - rtl::math::approxFloor( fCell);
Date aActDate( Date::SYSTEM );
@@ -436,6 +438,8 @@ void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
}
}
break;
+ default: break;
+
}
::svl::IUndoManager* pUndoMgr = pDocSh->GetUndoManager();
@@ -446,7 +450,7 @@ void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
// Set the new cell format only when it differs from the current cell
// format type. Preserve a date+time format unless we force a format
// through.
- if (bForceReqFmt || (nReqFmt != nCurNumFormatType && nCurNumFormatType != css::util::NumberFormat::DATETIME))
+ if (bForceReqFmt || (nReqFmt != nCurNumFormatType && nCurNumFormatType != SvNumFormatType::DATETIME))
SetNumberFormat(nReqFmt);
else
rViewData.UpdateInputHandler(); // update input bar with new value
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index ccbe1671932b..787d9f9a8352 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -513,8 +513,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
aPos.SetTab( i );
const sal_uInt32 nIndex = static_cast<const SfxUInt32Item*>( pDoc->GetAttr(
nCol, nRow, i, ATTR_VALUE_FORMAT ))->GetValue();
- const sal_Int16 nType = pFormatter->GetType( nIndex);
- if (nType == css::util::NumberFormat::TEXT ||
+ const SvNumFormatType nType = pFormatter->GetType( nIndex);
+ if (nType == SvNumFormatType::TEXT ||
((rString[0] == '+' || rString[0] == '-') && nError != FormulaError::NONE && rString == aFormula))
{
if ( pData )
@@ -535,7 +535,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
if(pCell->GetCode()->IsHyperLink())
pCell->GetCode()->SetHyperLink(false);
}
- if (nType == css::util::NumberFormat::LOGICAL)
+ if (nType == SvNumFormatType::LOGICAL)
{
// Reset to General so the actual format can be determined
// after the cell has been interpreted. A sticky boolean
@@ -543,7 +543,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
// General of same locale as current number format.
const SvNumberformat* pEntry = pFormatter->GetEntry( nIndex);
const LanguageType nLang = (pEntry ? pEntry->GetLanguage() : ScGlobal::eLnge);
- const sal_uInt32 nFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::NUMBER, nLang);
+ const sal_uInt32 nFormat = pFormatter->GetStandardFormat( SvNumFormatType::NUMBER, nLang);
ScPatternAttr aPattern( pDoc->GetPool());
aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nFormat));
ScMarkData aMark;
@@ -2571,7 +2571,7 @@ void ScViewFunc::ReplaceNote( const ScAddress& rPos, const OUString& rNoteText,
GetViewData().GetDocShell()->GetDocFunc().ReplaceNote( rPos, rNoteText, pAuthor, pDate, false );
}
-void ScViewFunc::SetNumberFormat( short nFormatType, sal_uLong nAdd )
+void ScViewFunc::SetNumberFormat( SvNumFormatType nFormatType, sal_uLong nAdd )
{
// not editable because of matrix only? attribute OK nonetheless
bool bOnlyNotBecauseOfMatrix;
@@ -2639,7 +2639,7 @@ void ScViewFunc::SetNumFmtByStr( const OUString& rCode )
OUString aFormat = rCode; // will be changed
sal_Int32 nErrPos = 0;
- short nType = 0; //! ???
+ SvNumFormatType nType = SvNumFormatType::ALL; //! ???
bOk = pFormatter->PutEntry( aFormat, nErrPos, nType, nNumberFormat, eLanguage );
}
@@ -2691,9 +2691,9 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
sal_uInt16 nPrecision, nLeading;
pOldEntry->GetFormatSpecialInfo( bThousand, bNegRed, nPrecision, nLeading );
- short nOldType = pOldEntry->GetType();
- if ( 0 == ( nOldType & (
- css::util::NumberFormat::NUMBER | css::util::NumberFormat::CURRENCY | css::util::NumberFormat::PERCENT | css::util::NumberFormat::SCIENTIFIC ) ) )
+ SvNumFormatType nOldType = pOldEntry->GetType();
+ if ( SvNumFormatType::ALL == ( nOldType & (
+ SvNumFormatType::NUMBER | SvNumFormatType::CURRENCY | SvNumFormatType::PERCENT | SvNumFormatType::SCIENTIFIC ) ) )
{
// date, time, fraction, logical, text can not be changed
bError = true;
@@ -2734,7 +2734,7 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
}
else
{
- if ( (nOldType & css::util::NumberFormat::SCIENTIFIC) && !bThousand &&
+ if ( (nOldType & SvNumFormatType::SCIENTIFIC) && !bThousand &&
(pOldEntry->GetFormatIntegerDigits()%3 == 0) && pOldEntry->GetFormatIntegerDigits() > 0 )
bThousand = true;
}
@@ -2768,7 +2768,7 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
if ( nNewFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
{
sal_Int32 nErrPos = 0;
- short nNewType = 0;
+ SvNumFormatType nNewType = SvNumFormatType::ALL;
bool bOk = pFormatter->PutEntry( aNewPicture, nErrPos,
nNewType, nNewFormat, eLanguage );
OSL_ENSURE( bOk, "incorrect numberformat generated" );
diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx
index 4276e0c16df7..e64dd7ed714e 100644
--- a/sfx2/source/bastyp/sfxhtml.cxx
+++ b/sfx2/source/bastyp/sfxhtml.cxx
@@ -332,7 +332,7 @@ double SfxHTMLParser::GetTableDataOptionsValNum( sal_uInt32& nNumForm,
nPos = aNumStr.indexOf( ';', nPos + 1 );
OUString aFormat( aNumStr.copy( nPos + 1 ) );
sal_Int32 nCheckPos;
- short nType;
+ SvNumFormatType nType;
if ( eNumLang != LANGUAGE_SYSTEM )
rFormatter.PutEntry( aFormat, nCheckPos, nType, nNumForm, eNumLang );
else
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index bafb8d13bef9..74e37de42d6e 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -269,7 +269,7 @@ void Test::testNumberFormat()
}
sal_Int32 nPos;
- short nType = css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
sal_uInt32 nKey;
OUString aCode;
// Thai date format (implicit locale).
@@ -1081,7 +1081,7 @@ void Test::checkDateInput( SvNumberFormatter& rFormatter, const char* pTimezone,
CPPUNIT_ASSERT_MESSAGE( OString("Date not recognized: " +
OString(pTimezone) + " " + OString(pIsoDate)).getStr(), bVal);
CPPUNIT_ASSERT_MESSAGE("Format parsed is not date.",
- (rFormatter.GetType(nIndex) & css::util::NumberFormat::DATE));
+ (rFormatter.GetType(nIndex) & SvNumFormatType::DATE));
OUString aOutString;
Color *pColor;
rFormatter.GetOutputString( fVal, nIndex, aOutString, &pColor);
@@ -1495,7 +1495,7 @@ void Test::testColorNamesConversion()
// [FARBE1] -> [COLOR1] can't be tested because we have no color table link
// set, so the scanner returns nCheckPos error.
sal_Int32 nCheckPos;
- short nType;
+ SvNumFormatType nType;
sal_uInt32 nKey;
OUString aFormatCode;
@@ -1504,7 +1504,7 @@ void Test::testColorNamesConversion()
aFormatCode = "[" + aGermanKeywords[i] + "]0";
aFormatter.PutandConvertEntry( aFormatCode, nCheckPos, nType, nKey, LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US);
CPPUNIT_ASSERT_EQUAL_MESSAGE("CheckPos should be 0.", sal_Int32(0), nCheckPos);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Type should be NUMBER.", css::util::NumberFormat::NUMBER, nType);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Type should be NUMBER.", SvNumFormatType::NUMBER, nType);
CPPUNIT_ASSERT_EQUAL( OUString("[" + rEnglishKeywords[i] + "]0"), aFormatCode);
}
}
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 3c50a2e16b71..bf2c13d82e29 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -382,8 +382,8 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType
sal_uInt32 nIndex = 0;
LanguageType eLang = lcl_GetLanguage( nLocale );
SvNumberFormatTable& rTable = bCreate ?
- pFormatter->ChangeCL( nType, nIndex, eLang ) :
- pFormatter->GetEntryTable( nType, nIndex, eLang );
+ pFormatter->ChangeCL( static_cast<SvNumFormatType>(nType), nIndex, eLang ) :
+ pFormatter->GetEntryTable( static_cast<SvNumFormatType>(nType), nIndex, eLang );
sal_uInt32 nCount = rTable.size();
uno::Sequence<sal_Int32> aSeq(nCount);
sal_Int32* pAry = aSeq.getArray();
@@ -427,7 +427,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const OUString& aFormat,
LanguageType eLang = lcl_GetLanguage( nLocale );
sal_uInt32 nKey = 0;
sal_Int32 nCheckPos = 0;
- short nType = 0;
+ SvNumFormatType nType = SvNumFormatType::ALL;
bool bOk = pFormatter->PutEntry( aFormStr, nCheckPos, nType, nKey, eLang );
if (bOk)
nRet = nKey;
@@ -457,7 +457,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const OUString& aFormat,
LanguageType eNewLang = lcl_GetLanguage( nNewLocale );
sal_uInt32 nKey = 0;
sal_Int32 nCheckPos = 0;
- short nType = 0;
+ SvNumFormatType nType = SvNumFormatType::ALL;
bool bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang );
if (bOk || nKey > 0)
nRet = nKey;
@@ -525,8 +525,9 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const
LanguageType eLang = lcl_GetLanguage( nLocale );
// Mask out "defined" bit, so type from an existing number format
// can directly be used for getStandardFormat
- nType &= ~css::util::NumberFormat::DEFINED;
- sal_Int32 nRet = pFormatter->GetStandardFormat(nType, eLang);
+ SvNumFormatType nType2 = static_cast<SvNumFormatType>(nType);
+ nType2 &= ~SvNumFormatType::DEFINED;
+ sal_Int32 nRet = pFormatter->GetStandardFormat(nType2, eLang);
return nRet;
}
@@ -547,7 +548,7 @@ sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_
{
::osl::MutexGuard aGuard( m_aMutex );
- return SvNumberFormatter::IsCompatible( nOldType, nNewType );
+ return SvNumberFormatter::IsCompatible( static_cast<SvNumFormatType>(nOldType), static_cast<SvNumFormatType>(nNewType) );
}
sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale )
@@ -644,7 +645,7 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty
}
else if (aPropertyName == PROPERTYNAME_USERDEF)
{
- aRet <<= ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
+ aRet <<= bool( pFormat->GetType() & SvNumFormatType::DEFINED );
}
else if (aPropertyName == PROPERTYNAME_DECIMALS)
{
@@ -744,7 +745,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValue
OUString aComment = pFormat->GetComment();
bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
//! Pass through SvNumberformat Member bStandard?
- bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
+ bool bUserDef( pFormat->GetType() & SvNumFormatType::DEFINED );
bool bThousand, bRed;
sal_uInt16 nDecimals, nLeading;
pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 7e4f3f69e128..c0f679e97b7a 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -80,8 +80,8 @@ ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP )
bTextInitialized( false ),
bScanGenitiveMonths( false ),
bScanPartitiveMonths( false ),
- eScannedType( css::util::NumberFormat::UNDEFINED ),
- eSetType( css::util::NumberFormat::UNDEFINED )
+ eScannedType( SvNumFormatType::UNDEFINED ),
+ eSetType( SvNumFormatType::UNDEFINED )
{
pFormatter = pFormatterP;
pNullDate = new Date(30,12,1899);
@@ -111,7 +111,7 @@ void ImpSvNumberInputScan::Reset()
nStringsCnt = 0;
nNumericsCnt = 0;
nThousand = 0;
- eScannedType = css::util::NumberFormat::UNDEFINED;
+ eScannedType = SvNumFormatType::UNDEFINED;
nAmPm = 0;
nPosThousandString = 0;
nLogical = 0;
@@ -1102,7 +1102,7 @@ bool ImpSvNumberInputScan::CanForceToIso8601( DateOrder eDateOrder )
bool ImpSvNumberInputScan::IsAcceptableIso8601( const SvNumberformat* pFormat )
{
- if (pFormat && (pFormat->GetType() & css::util::NumberFormat::DATE))
+ if (pFormat && (pFormat->GetType() & SvNumFormatType::DATE))
{
switch (pFormatter->GetEvalDateFormat())
{
@@ -1552,7 +1552,7 @@ bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter,
using namespace ::com::sun::star::i18n;
NfEvalDateFormat eEDF;
int nFormatOrder;
- if ( pFormat && (pFormat->GetType() & css::util::NumberFormat::DATE) )
+ if ( pFormat && (pFormat->GetType() & SvNumFormatType::DATE) )
{
eEDF = pFormatter->GetEvalDateFormat();
switch ( eEDF )
@@ -2149,7 +2149,7 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
}
else if ( GetCurrency(rString, nPos, pFormat) ) // currency (DM 1)?
{
- eScannedType = css::util::NumberFormat::CURRENCY; // !!! it IS currency !!!
+ eScannedType = SvNumFormatType::CURRENCY; // !!! it IS currency !!!
SkipBlanks(rString, nPos);
if (nSign == 0) // no sign yet
{
@@ -2202,7 +2202,7 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
// separator and a (year) number.
if (nPos < rString.getLength() || (nStringsCnt >= 4 && nNumericsCnt >= 2))
{
- eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date !!!
+ eScannedType = SvNumFormatType::DATE; // !!! it IS a date !!!
nMonth = nTempMonth;
nMonthPos = 1; // month at the beginning
if ( nMonth < 0 )
@@ -2222,7 +2222,7 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString,
if ( nTempDayOfWeek )
{
// day of week is just parsed away
- eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date !!!
+ eScannedType = SvNumFormatType::DATE; // !!! it IS a date !!!
if ( nPos < rString.getLength() )
{
if ( nTempDayOfWeek < 0 )
@@ -2299,7 +2299,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
sal_uInt16 nStringPos, const SvNumberformat* pFormat )
{
sal_Int32 nPos = 0;
- short eOldScannedType = eScannedType;
+ SvNumFormatType eOldScannedType = eScannedType;
if ( nMatchedAllStrings )
{ // Match against format in any case, so later on for a "1-2-3-4" input
@@ -2328,15 +2328,15 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
if (bDecSepInDateSeps || // . also date separator
SkipDatePatternSeparator( nStringPos, nPos, bSignedYear))
{
- if ( eScannedType != css::util::NumberFormat::UNDEFINED &&
- eScannedType != css::util::NumberFormat::DATE &&
- eScannedType != css::util::NumberFormat::DATETIME) // already another type
+ if ( eScannedType != SvNumFormatType::UNDEFINED &&
+ eScannedType != SvNumFormatType::DATE &&
+ eScannedType != SvNumFormatType::DATETIME) // already another type
{
return MatchedReturn();
}
- if (eScannedType == css::util::NumberFormat::UNDEFINED)
+ if (eScannedType == SvNumFormatType::UNDEFINED)
{
- eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date
+ eScannedType = SvNumFormatType::DATE; // !!! it IS a date
}
SkipBlanks(rString, nPos);
}
@@ -2351,7 +2351,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
SkipBlanks(rString, nPos);
}
}
- else if ( (eScannedType & css::util::NumberFormat::TIME) &&
+ else if ( (eScannedType & SvNumFormatType::TIME) &&
GetTime100SecSep( rString, nPos ) )
{ // hundredth seconds separator
if ( nDecPos )
@@ -2364,7 +2364,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
// out early to not get confused by later checks for group separator or
// other.
if (bIso8601Tsep && nPos == rString.getLength() &&
- eScannedType == css::util::NumberFormat::DATETIME && (rString == "." || rString == ","))
+ eScannedType == SvNumFormatType::DATETIME && (rString == "." || rString == ","))
return true;
SkipBlanks(rString, nPos);
@@ -2372,13 +2372,13 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
if (SkipChar('/', rString, nPos)) // fraction?
{
- if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type
- eScannedType != css::util::NumberFormat::DATE) // except date
+ if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type
+ eScannedType != SvNumFormatType::DATE) // except date
{
return MatchedReturn(); // => jan/31/1994
}
- else if (eScannedType != css::util::NumberFormat::DATE && // analyzed no date until now
- ( eSetType == css::util::NumberFormat::FRACTION || // and preset was fraction
+ else if (eScannedType != SvNumFormatType::DATE && // analyzed no date until now
+ ( eSetType == SvNumFormatType::FRACTION || // and preset was fraction
(nNumericsCnt == 3 && // or 3 numbers
(nStringPos == 3 || // and 3rd string particle
(nStringPos == 4 && nSign))))) // or 4th if signed
@@ -2386,8 +2386,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
SkipBlanks(rString, nPos);
if (nPos == rString.getLength())
{
- eScannedType = css::util::NumberFormat::FRACTION; // !!! it IS a fraction (so far)
- if (eSetType == css::util::NumberFormat::FRACTION &&
+ eScannedType = SvNumFormatType::FRACTION; // !!! it IS a fraction (so far)
+ if (eSetType == SvNumFormatType::FRACTION &&
nNumericsCnt == 2 &&
(nStringPos == 1 || // for 4/5
(nStringPos == 2 && nSign))) // or signed -4/5
@@ -2404,8 +2404,8 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
if (GetThousandSep(rString, nPos, nStringPos)) // 1,000
{
- if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type
- eScannedType != css::util::NumberFormat::CURRENCY) // except currency
+ if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type
+ eScannedType != SvNumFormatType::CURRENCY) // except currency
{
return MatchedReturn();
}
@@ -2424,13 +2424,13 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
if (bDate || ((MayBeIso8601() || MayBeMonthDate()) && // 1999-12-31 31-Dec-1999
SkipChar( '-', rString, nPos)))
{
- if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type
- eScannedType != css::util::NumberFormat::DATE) // except date
+ if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type
+ eScannedType != SvNumFormatType::DATE) // except date
{
return MatchedReturn();
}
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date
+ eScannedType = SvNumFormatType::DATE; // !!! it IS a date
short nTmpMonth = GetMonth(rString, nPos); // 10. Jan 94
if (nMonth && nTmpMonth) // month dup
{
@@ -2468,14 +2468,14 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
{
return MatchedReturn();
}
- if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type
- eScannedType != css::util::NumberFormat::DATE) // except date
+ if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type
+ eScannedType != SvNumFormatType::DATE) // except date
{
return MatchedReturn();
}
if (nMonthStart > 0 && nPos < rString.getLength()) // 10Jan or Jan94 without separator are not dates
{
- eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date
+ eScannedType = SvNumFormatType::DATE; // !!! it IS a date
nMonth = nTempMonth;
nMonthPos = 2; // month in the middle
if ( nMonth < 0 )
@@ -2494,14 +2494,14 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
if ( SkipChar('E', rString, nPos) || // 10E, 10e, 10,Ee
SkipChar('e', rString, nPos) )
{
- if (eScannedType != css::util::NumberFormat::UNDEFINED) // already another type
+ if (eScannedType != SvNumFormatType::UNDEFINED) // already another type
{
return MatchedReturn();
}
else
{
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::SCIENTIFIC; // !!! it IS scientific
+ eScannedType = SvNumFormatType::SCIENTIFIC; // !!! it IS scientific
if ( nThousand+2 == nNumericsCnt && nDecPos == 2 ) // special case 1.E2
{
nDecPos = 3; // 1,100.E2 1,100,100.E3
@@ -2518,12 +2518,12 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
{
if (bDecSepInDateSeps) // . also date sep
{
- if ( eScannedType != css::util::NumberFormat::DATE && // already another type than date
- eScannedType != css::util::NumberFormat::DATETIME) // or date time
+ if ( eScannedType != SvNumFormatType::DATE && // already another type than date
+ eScannedType != SvNumFormatType::DATETIME) // or date time
{
return MatchedReturn();
}
- if (eScannedType == css::util::NumberFormat::DATE)
+ if (eScannedType == SvNumFormatType::DATE)
{
nDecPos = 0; // reset for time transition
}
@@ -2533,22 +2533,22 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
return MatchedReturn();
}
}
- if ((eScannedType == css::util::NumberFormat::DATE || // already date type
- eScannedType == css::util::NumberFormat::DATETIME) && // or date time
+ if ((eScannedType == SvNumFormatType::DATE || // already date type
+ eScannedType == SvNumFormatType::DATETIME) && // or date time
nNumericsCnt > 3) // and more than 3 numbers? (31.Dez.94 8:23)
{
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::DATETIME; // !!! it IS date with time
+ eScannedType = SvNumFormatType::DATETIME; // !!! it IS date with time
}
- else if ( eScannedType != css::util::NumberFormat::UNDEFINED && // already another type
- eScannedType != css::util::NumberFormat::TIME) // except time
+ else if ( eScannedType != SvNumFormatType::UNDEFINED && // already another type
+ eScannedType != SvNumFormatType::TIME) // except time
{
return MatchedReturn();
}
else
{
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::TIME; // !!! it IS a time
+ eScannedType = SvNumFormatType::TIME; // !!! it IS a time
}
if ( !nTimePos )
{
@@ -2560,7 +2560,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
{
switch (eScannedType)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
if (nMonthPos == 1 && pLoc->getLongDateOrder() == DateOrder::MDY)
{
// #68232# recognize long date separators like ", " in "September 5, 1999"
@@ -2584,12 +2584,12 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
// here if the locale's separator is not ':' so it couldn't
// be detected above in the time block.
if (nNumericsCnt >= 5)
- eScannedType = css::util::NumberFormat::DATETIME;
+ eScannedType = SvNumFormatType::DATETIME;
++nPos;
}
}
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
if (nPos == 0 && rString.getLength() == 1 && MayBeIso8601())
{
if (nStringPos == 9 && rString[0] == ':')
@@ -2628,6 +2628,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
}
#endif
break;
+ default: break;
}
}
@@ -2684,15 +2685,15 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
if (bDecSepInDateSeps || // . also date separator
SkipDatePatternSeparator( nStringsCnt-1, nPos, bSignedYear))
{
- if ( eScannedType != css::util::NumberFormat::UNDEFINED &&
- eScannedType != css::util::NumberFormat::DATE &&
- eScannedType != css::util::NumberFormat::DATETIME) // already another type
+ if ( eScannedType != SvNumFormatType::UNDEFINED &&
+ eScannedType != SvNumFormatType::DATE &&
+ eScannedType != SvNumFormatType::DATETIME) // already another type
{
return MatchedReturn();
}
- if (eScannedType == css::util::NumberFormat::UNDEFINED)
+ if (eScannedType == SvNumFormatType::UNDEFINED)
{
- eScannedType = css::util::NumberFormat::DATE; // !!! it IS a date
+ eScannedType = SvNumFormatType::DATE; // !!! it IS a date
}
SkipBlanks(rString, nPos);
}
@@ -2710,7 +2711,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
bool bSignDetectedHere = false;
if ( nSign == 0 && // conflict - not signed
- eScannedType != css::util::NumberFormat::DATE) // and not date
+ eScannedType != SvNumFormatType::DATE) // and not date
//!? catch time too?
{ // not signed yet
nSign = GetSign(rString, nPos); // 1- DM
@@ -2733,14 +2734,14 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
if ( GetCurrency(rString, nPos, pFormat) ) // currency symbol?
{
- if (eScannedType != css::util::NumberFormat::UNDEFINED) // currency dup
+ if (eScannedType != SvNumFormatType::UNDEFINED) // currency dup
{
return MatchedReturn();
}
else
{
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::CURRENCY;
+ eScannedType = SvNumFormatType::CURRENCY;
} // behind currency a '-' is allowed
if (nSign == 0) // not signed yet
{
@@ -2751,7 +2752,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
return MatchedReturn();
}
}
- if ( nNegCheck && eScannedType == css::util::NumberFormat::CURRENCY &&
+ if ( nNegCheck && eScannedType == SvNumFormatType::CURRENCY &&
SkipChar(')', rString, nPos) )
{
nNegCheck = 0; // ')' skipped
@@ -2761,12 +2762,12 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
if ( SkipChar('%', rString, nPos) ) // 1%
{
- if (eScannedType != css::util::NumberFormat::UNDEFINED) // already another type
+ if (eScannedType != SvNumFormatType::UNDEFINED) // already another type
{
return MatchedReturn();
}
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::PERCENT;
+ eScannedType = SvNumFormatType::PERCENT;
}
const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
@@ -2777,20 +2778,20 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
{
return MatchedReturn();
}
- if (eScannedType == css::util::NumberFormat::DATE && nNumericsCnt > 2) // 31.Dez.94 8:
+ if (eScannedType == SvNumFormatType::DATE && nNumericsCnt > 2) // 31.Dez.94 8:
{
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::DATETIME;
+ eScannedType = SvNumFormatType::DATETIME;
}
- else if (eScannedType != css::util::NumberFormat::UNDEFINED &&
- eScannedType != css::util::NumberFormat::TIME) // already another type
+ else if (eScannedType != SvNumFormatType::UNDEFINED &&
+ eScannedType != SvNumFormatType::TIME) // already another type
{
return MatchedReturn();
}
else
{
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::TIME;
+ eScannedType = SvNumFormatType::TIME;
}
if ( !nTimePos )
{
@@ -2812,15 +2813,15 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
if (bDate || ((MayBeIso8601() || MayBeMonthDate())
&& SkipChar( '-', rString, nPos)))
{
- if (eScannedType != css::util::NumberFormat::UNDEFINED &&
- eScannedType != css::util::NumberFormat::DATE) // already another type
+ if (eScannedType != SvNumFormatType::UNDEFINED &&
+ eScannedType != SvNumFormatType::DATE) // already another type
{
return MatchedReturn();
}
else
{
SkipBlanks(rString, nPos);
- eScannedType = css::util::NumberFormat::DATE;
+ eScannedType = SvNumFormatType::DATE;
}
short nTmpMonth = GetMonth(rString, nPos); // 10. Jan
if (nMonth && nTmpMonth) // month dup
@@ -2847,14 +2848,14 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
{
return MatchedReturn();
}
- if (eScannedType != css::util::NumberFormat::UNDEFINED &&
- eScannedType != css::util::NumberFormat::DATE) // already another type
+ if (eScannedType != SvNumFormatType::UNDEFINED &&
+ eScannedType != SvNumFormatType::DATE) // already another type
{
return MatchedReturn();
}
if (nMonthStart > 0) // 10Jan without separator is not a date
{
- eScannedType = css::util::NumberFormat::DATE;
+ eScannedType = SvNumFormatType::DATE;
nMonth = nTempMonth;
nMonthPos = 3; // month at end
if ( nMonth < 0 )
@@ -2872,9 +2873,9 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
sal_Int32 nOrigPos = nPos;
if (GetTimeAmPm(rString, nPos))
{
- if (eScannedType != css::util::NumberFormat::UNDEFINED &&
- eScannedType != css::util::NumberFormat::TIME &&
- eScannedType != css::util::NumberFormat::DATETIME) // already another type
+ if (eScannedType != SvNumFormatType::UNDEFINED &&
+ eScannedType != SvNumFormatType::TIME &&
+ eScannedType != SvNumFormatType::DATETIME) // already another type
{
return MatchedReturn();
}
@@ -2882,16 +2883,16 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
{
// If not already scanned as time, 6.78am does not result in 6
// seconds and 78 hundredths in the morning. Keep as suffix.
- if (eScannedType != css::util::NumberFormat::TIME && nDecPos == 2 && nNumericsCnt == 2)
+ if (eScannedType != SvNumFormatType::TIME && nDecPos == 2 && nNumericsCnt == 2)
{
nPos = nOrigPos; // rewind am/pm
}
else
{
SkipBlanks(rString, nPos);
- if ( eScannedType != css::util::NumberFormat::DATETIME )
+ if ( eScannedType != SvNumFormatType::DATETIME )
{
- eScannedType = css::util::NumberFormat::TIME;
+ eScannedType = SvNumFormatType::TIME;
}
}
}
@@ -2899,7 +2900,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
if ( nNegCheck && SkipChar(')', rString, nPos) )
{
- if (eScannedType == css::util::NumberFormat::CURRENCY) // only if currency
+ if (eScannedType == SvNumFormatType::CURRENCY) // only if currency
{
nNegCheck = 0; // skip ')'
SkipBlanks(rString, nPos);
@@ -2911,8 +2912,8 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
}
if ( nPos < rString.getLength() &&
- (eScannedType == css::util::NumberFormat::DATE ||
- eScannedType == css::util::NumberFormat::DATETIME) )
+ (eScannedType == SvNumFormatType::DATE ||
+ eScannedType == SvNumFormatType::DATETIME) )
{
// day of week is just parsed away
sal_Int32 nOldPos = nPos;
@@ -2944,7 +2945,7 @@ bool ImpSvNumberInputScan::ScanEndString( const OUString& rString,
}
#if NF_RECOGNIZE_ISO8601_TIMEZONES
- if (nPos == 0 && eScannedType == css::util::NumberFormat::DATETIME &&
+ if (nPos == 0 && eScannedType == SvNumFormatType::DATETIME &&
rString.getLength() == 1 && rString[ 0 ] == 'Z' && MayBeIso8601())
{
// ISO 8601 timezone UTC yyyy-mm-ddThh:mmZ
@@ -3100,7 +3101,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
nLogical = GetLogical( rStrArray );
if ( nLogical )
{
- eScannedType = css::util::NumberFormat::LOGICAL; // !!! it's a BOOLEAN
+ eScannedType = SvNumFormatType::LOGICAL; // !!! it's a BOOLEAN
nMatchedAllStrings &= ~nMatchedVirgin;
return true;
}
@@ -3124,12 +3125,12 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
// nStringsCnt >= 1
if (GetNextNumber(i,j)) // i=1,0
{ // Number at start
- if (eSetType == css::util::NumberFormat::FRACTION) // Fraction 1 = 1/1
+ if (eSetType == SvNumFormatType::FRACTION) // Fraction 1 = 1/1
{
if (i >= nStringsCnt || // no end string nor decimal separator
pFormatter->IsDecimalSep( sStrArray[i]))
{
- eScannedType = css::util::NumberFormat::FRACTION;
+ eScannedType = SvNumFormatType::FRACTION;
nMatchedAllStrings &= ~nMatchedVirgin;
return true;
}
@@ -3144,16 +3145,16 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
i++; // next symbol, i=1
}
GetNextNumber(i,j); // i=1,2
- if (eSetType == css::util::NumberFormat::FRACTION) // Fraction -1 = -1/1
+ if (eSetType == SvNumFormatType::FRACTION) // Fraction -1 = -1/1
{
if (nSign && !nNegCheck && // Sign +, -
- eScannedType == css::util::NumberFormat::UNDEFINED && // not date or currency
+ eScannedType == SvNumFormatType::UNDEFINED && // not date or currency
nDecPos == 0 && // no previous decimal separator
(i >= nStringsCnt || // no end string nor decimal separator
pFormatter->IsDecimalSep( sStrArray[i]))
)
{
- eScannedType = css::util::NumberFormat::FRACTION;
+ eScannedType = SvNumFormatType::FRACTION;
nMatchedAllStrings &= ~nMatchedVirgin;
return true;
}
@@ -3182,14 +3183,14 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
{
return false;
}
- if (eSetType == css::util::NumberFormat::FRACTION) // -1,200. as fraction
+ if (eSetType == SvNumFormatType::FRACTION) // -1,200. as fraction
{
if (!nNegCheck && // no sign '('
- eScannedType == css::util::NumberFormat::UNDEFINED &&
+ eScannedType == SvNumFormatType::UNDEFINED &&
(nDecPos == 0 || nDecPos == 3) // no decimal separator or at end
)
{
- eScannedType = css::util::NumberFormat::FRACTION;
+ eScannedType = SvNumFormatType::FRACTION;
nMatchedAllStrings &= ~nMatchedVirgin;
return true;
}
@@ -3215,7 +3216,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
return false;
}
i++; // i=2,3
- if (eScannedType == css::util::NumberFormat::SCIENTIFIC) // E only at end
+ if (eScannedType == SvNumFormatType::SCIENTIFIC) // E only at end
{
return false;
}
@@ -3230,19 +3231,19 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
{
return false;
}
- if (eSetType == css::util::NumberFormat::FRACTION) // -1,200,100. as fraction
+ if (eSetType == SvNumFormatType::FRACTION) // -1,200,100. as fraction
{
if (!nNegCheck && // no sign '('
- eScannedType == css::util::NumberFormat::UNDEFINED &&
+ eScannedType == SvNumFormatType::UNDEFINED &&
(nDecPos == 0 || nDecPos == 3) // no decimal separator or at end
)
{
- eScannedType = css::util::NumberFormat::FRACTION;
+ eScannedType = SvNumFormatType::FRACTION;
nMatchedAllStrings &= ~nMatchedVirgin;
return true;
}
}
- if ( eScannedType == css::util::NumberFormat::FRACTION && nDecPos )
+ if ( eScannedType == SvNumFormatType::FRACTION && nDecPos )
{
return false; // #36857# not a real fraction
}
@@ -3269,7 +3270,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
// but leave one number.
{ // Loop over group separators
nThOld = nThousand;
- if (eScannedType == css::util::NumberFormat::SCIENTIFIC) // E only at end
+ if (eScannedType == SvNumFormatType::SCIENTIFIC) // E only at end
{
return false;
}
@@ -3281,13 +3282,13 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
i++;
}
}
- if (eScannedType == css::util::NumberFormat::DATE || // long date or
- eScannedType == css::util::NumberFormat::TIME || // long time or
- eScannedType == css::util::NumberFormat::UNDEFINED) // long number
+ if (eScannedType == SvNumFormatType::DATE || // long date or
+ eScannedType == SvNumFormatType::TIME || // long time or
+ eScannedType == SvNumFormatType::UNDEFINED) // long number
{
for (sal_uInt16 k = j; k < nNumericsCnt-1; k++)
{
- if (eScannedType == css::util::NumberFormat::SCIENTIFIC) // E only at endd
+ if (eScannedType == SvNumFormatType::SCIENTIFIC) // E only at endd
{
return false;
}
@@ -3304,26 +3305,26 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
{
return false;
}
- if (eSetType == css::util::NumberFormat::FRACTION) // -1,200,100. as fraction
+ if (eSetType == SvNumFormatType::FRACTION) // -1,200,100. as fraction
{
if (!nNegCheck && // no sign '('
- eScannedType == css::util::NumberFormat::UNDEFINED &&
+ eScannedType == SvNumFormatType::UNDEFINED &&
(nDecPos == 0 || nDecPos == 3) // no decimal separator or at end
)
{
- eScannedType = css::util::NumberFormat::FRACTION;
+ eScannedType = SvNumFormatType::FRACTION;
nMatchedAllStrings &= ~nMatchedVirgin;
return true;
}
}
- if ( eScannedType == css::util::NumberFormat::FRACTION && nDecPos )
+ if ( eScannedType == SvNumFormatType::FRACTION && nDecPos )
{
return false; // #36857# not a real fraction
}
break;
}
- if (eScannedType == css::util::NumberFormat::UNDEFINED)
+ if (eScannedType == SvNumFormatType::UNDEFINED)
{
nMatchedAllStrings &= ~nMatchedVirgin;
// did match including nMatchedUsedAsReturn
@@ -3342,13 +3343,13 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
// A type DEFINED means that no category could be assigned to the
// overall format because of mixed type subformats. Use the scan
// matched subformat's type if any.
- short eForType = eSetType;
- if ((eForType == css::util::NumberFormat::UNDEFINED || eForType == css::util::NumberFormat::DEFINED) && pFormat)
+ SvNumFormatType eForType = eSetType;
+ if ((eForType == SvNumFormatType::UNDEFINED || eForType == SvNumFormatType::DEFINED) && pFormat)
eForType = pFormat->GetNumForInfoScannedType( nStringScanNumFor);
- if (eForType != css::util::NumberFormat::UNDEFINED && eForType != css::util::NumberFormat::DEFINED)
+ if (eForType != SvNumFormatType::UNDEFINED && eForType != SvNumFormatType::DEFINED)
eScannedType = eForType;
else
- eScannedType = css::util::NumberFormat::NUMBER;
+ eScannedType = SvNumFormatType::NUMBER;
}
else if ( bDidMatch )
{
@@ -3356,11 +3357,11 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
}
else
{
- eScannedType = css::util::NumberFormat::NUMBER;
+ eScannedType = SvNumFormatType::NUMBER;
// everything else should have been recognized by now
}
}
- else if ( eScannedType == css::util::NumberFormat::DATE )
+ else if ( eScannedType == SvNumFormatType::DATE )
{
// the very relaxed date input checks may interfere with a preset format
nMatchedAllStrings &= ~nMatchedVirgin;
@@ -3380,10 +3381,10 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const OUString& rString, /
// overall format because of mixed type subformats. Do not override
// the scanned type in this case. Otherwise in IsNumberFormat() the
// first numeric particle would be accepted as number.
- short eForType = eSetType;
- if ((eForType == css::util::NumberFormat::UNDEFINED || eForType == css::util::NumberFormat::DEFINED) && pFormat)
+ SvNumFormatType eForType = eSetType;
+ if ((eForType == SvNumFormatType::UNDEFINED || eForType == SvNumFormatType::DEFINED) && pFormat)
eForType = pFormat->GetNumForInfoScannedType( nStringScanNumFor);
- if (eForType != css::util::NumberFormat::UNDEFINED && eForType != css::util::NumberFormat::DEFINED)
+ if (eForType != SvNumFormatType::UNDEFINED && eForType != SvNumFormatType::DEFINED)
eScannedType = eForType;
}
else if ( bWasReturn )
@@ -3535,7 +3536,7 @@ void ImpSvNumberInputScan::ChangeNullDate( const sal_uInt16 Day,
* Does rString represent a number (also date, time et al)
*/
bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // string to be analyzed
- short& F_Type, // IN: old type, OUT: new type
+ SvNumFormatType& F_Type, // IN: old type, OUT: new type
double& fOutNumber, // OUT: number if convertible
const SvNumberformat* pFormat ) // maybe a number format to match against
{
@@ -3570,8 +3571,8 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
// is year.
// Accept only if the year immediately follows the sign character with
// no space in between.
- if (nSign && (eScannedType == css::util::NumberFormat::DATE ||
- eScannedType == css::util::NumberFormat::DATETIME) && mnEra == kDefaultEra &&
+ if (nSign && (eScannedType == SvNumFormatType::DATE ||
+ eScannedType == SvNumFormatType::DATETIME) && mnEra == kDefaultEra &&
(IsDatePatternNumberOfType(0,'Y') || (MayBeIso8601() && sStrArray[nNums[0]].getLength() >= 4)))
{
const sal_Unicode c = sStrArray[0][sStrArray[0].getLength()-1];
@@ -3584,8 +3585,8 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
}
if ( nNegCheck || // ')' not found for '('
- (nSign && (eScannedType == css::util::NumberFormat::DATE ||
- eScannedType == css::util::NumberFormat::DATETIME))) // signed date/datetime
+ (nSign && (eScannedType == SvNumFormatType::DATE ||
+ eScannedType == SvNumFormatType::DATETIME))) // signed date/datetime
{
res = false;
}
@@ -3593,9 +3594,9 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
{ // check count of partial number strings
switch (eScannedType)
{
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::PERCENT:
+ case SvNumFormatType::CURRENCY:
+ case SvNumFormatType::NUMBER:
if (nDecPos == 1) // .05
{
// matched MidStrings function like group separators
@@ -3634,7 +3635,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
break;
- case css::util::NumberFormat::SCIENTIFIC: // 1.0e-2
+ case SvNumFormatType::SCIENTIFIC: // 1.0e-2
if (nDecPos == 1) // .05
{
if (nNumericsCnt != 2)
@@ -3658,7 +3659,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
break;
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
if (nMonth < 0 && nDayOfWeek < 0 && nNumericsCnt == 3)
{
// If both, short month name and day of week name were
@@ -3695,7 +3696,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
if (nDecPos)
{ // hundredth seconds included
if (nNumericsCnt > 4)
@@ -3712,7 +3713,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
if (nMonth < 0 && nDayOfWeek < 0 && nNumericsCnt >= 5)
{
// If both, abbreviated month name and day of week name
@@ -3774,7 +3775,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
{ // we finally have a number
switch (eScannedType)
{
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
if (nLogical == 1)
{
fOutNumber = 1.0; // True
@@ -3789,11 +3790,11 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
break;
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::SCIENTIFIC:
- case css::util::NumberFormat::DEFINED: // if no category detected handle as number
+ case SvNumFormatType::PERCENT:
+ case SvNumFormatType::CURRENCY:
+ case SvNumFormatType::NUMBER:
+ case SvNumFormatType::SCIENTIFIC:
+ case SvNumFormatType::DEFINED: // if no category detected handle as number
if ( nDecPos == 1 ) // . at start
{
sResString.append("0.");
@@ -3806,7 +3807,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
if ( nDecPos == 2 && k < nNumericsCnt ) // . somewhere
{
sResString.append('.');
- sal_uInt16 nStop = (eScannedType == css::util::NumberFormat::SCIENTIFIC ?
+ sal_uInt16 nStop = (eScannedType == SvNumFormatType::SCIENTIFIC ?
nNumericsCnt-1 : nNumericsCnt);
for ( ; k < nStop; k++)
{
@@ -3814,7 +3815,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
}
- if (eScannedType != css::util::NumberFormat::SCIENTIFIC)
+ if (eScannedType != SvNumFormatType::SCIENTIFIC)
{
fOutNumber = StringToDouble(sResString.makeStringAndClear());
}
@@ -3830,7 +3831,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
fOutNumber = ::rtl::math::stringToDouble( sResString.makeStringAndClear(), '.', ',', &eStatus );
if ( eStatus == rtl_math_ConversionStatus_OutOfRange )
{
- F_Type = css::util::NumberFormat::TEXT; // overflow/underflow -> Text
+ F_Type = SvNumFormatType::TEXT; // overflow/underflow -> Text
if (nESign == -1)
{
fOutNumber = 0.0;
@@ -3859,13 +3860,13 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
fOutNumber = -fOutNumber;
}
- if (eScannedType == css::util::NumberFormat::PERCENT)
+ if (eScannedType == SvNumFormatType::PERCENT)
{
fOutNumber/= 100.0;
}
break;
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::FRACTION:
if (nNumericsCnt == 1)
{
fOutNumber = StringToDouble(sStrArray[nNums[0]]);
@@ -3937,7 +3938,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
res = GetTimeRef(fOutNumber, 0, nNumericsCnt);
if ( nSign < 0 )
{
@@ -3945,11 +3946,11 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
}
break;
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
res = GetDateRef( fOutNumber, k, pFormat );
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
res = GetDateRef( fOutNumber, k, pFormat );
if ( res )
{
@@ -3970,13 +3971,13 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
{
if (fOutNumber < -DBL_MAX) // -1.7E308
{
- F_Type = css::util::NumberFormat::TEXT;
+ F_Type = SvNumFormatType::TEXT;
fOutNumber = -DBL_MAX;
return true;
}
else if (fOutNumber > DBL_MAX) // 1.7E308
{
- F_Type = css::util::NumberFormat::TEXT;
+ F_Type = SvNumFormatType::TEXT;
fOutNumber = DBL_MAX;
return true;
}
@@ -3984,7 +3985,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s
if (!res)
{
- eScannedType = css::util::NumberFormat::TEXT;
+ eScannedType = SvNumFormatType::TEXT;
fOutNumber = 0.0;
}
diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx
index c257eed70608..58021ffff824 100644
--- a/svl/source/numbers/zforfind.hxx
+++ b/svl/source/numbers/zforfind.hxx
@@ -27,6 +27,7 @@
class Date;
class SvNumberformat;
class SvNumberFormatter;
+enum class SvNumFormatType : sal_Int16;
#define SV_MAX_COUNT_INPUT_STRINGS 20 // max count of substrings in input scanner
@@ -45,7 +46,7 @@ public:
/// convert input string to number
bool IsNumberFormat( const OUString& rString, /// input string
- short& F_Type, /// format type (in + out)
+ SvNumFormatType& F_Type, /// format type (in + out)
double& fOutNumber, /// value determined (out)
const SvNumberformat* pFormat); /// number format to which compare against
@@ -113,8 +114,8 @@ private:
sal_Int16 mnEra; // Era if date, 0 => BCE, 1 => CE (currently only Gregorian)
sal_uInt16 nThousand; // Count of group (AKA thousand) separators
sal_uInt16 nPosThousandString; // Position of concatenated 000,000,000 string
- short eScannedType; // Scanned type
- short eSetType; // Preset Type
+ SvNumFormatType eScannedType; // Scanned type
+ SvNumFormatType eSetType; // Preset Type
sal_uInt16 nStringScanNumFor; // Fixed strings recognized in
// pFormat->NumFor[nNumForStringScan]
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 2f3372cef55b..cc3bda8ce139 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -489,14 +489,14 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
pStringScanner, nCheckPos, eLge ));
if ( nCheckPos == 0 )
{
- short eCheckType = pNewEntry->GetType();
- if ( eCheckType != css::util::NumberFormat::UNDEFINED )
+ SvNumFormatType eCheckType = pNewEntry->GetType();
+ if ( eCheckType != SvNumFormatType::UNDEFINED )
{
- pNewEntry->SetType( eCheckType | css::util::NumberFormat::DEFINED );
+ pNewEntry->SetType( eCheckType | SvNumFormatType::DEFINED );
}
else
{
- pNewEntry->SetType( css::util::NumberFormat::DEFINED );
+ pNewEntry->SetType( SvNumFormatType::DEFINED );
}
if ( aFTable.emplace( nKey, std::move(pNewEntry) ).second )
@@ -563,7 +563,7 @@ bool SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const
bool SvNumberFormatter::PutEntry(OUString& rString,
sal_Int32& nCheckPos,
- short& nType,
+ SvNumFormatType& nType,
sal_uInt32& nKey, // format key
LanguageType eLnge)
{
@@ -589,16 +589,16 @@ bool SvNumberFormatter::PutEntry(OUString& rString,
if (nCheckPos == 0) // Format ok
{ // Type comparison:
- short eCheckType = p_Entry->GetType();
- if ( eCheckType != css::util::NumberFormat::UNDEFINED)
+ SvNumFormatType eCheckType = p_Entry->GetType();
+ if ( eCheckType != SvNumFormatType::UNDEFINED)
{
- p_Entry->SetType(eCheckType | css::util::NumberFormat::DEFINED);
+ p_Entry->SetType(eCheckType | SvNumFormatType::DEFINED);
nType = eCheckType;
}
else
{
- p_Entry->SetType(css::util::NumberFormat::DEFINED);
- nType = css::util::NumberFormat::DEFINED;
+ p_Entry->SetType(SvNumFormatType::DEFINED);
+ nType = SvNumFormatType::DEFINED;
}
sal_uInt32 CLOffset = ImpGenerateCL(eLge); // create new standard formats if necessary
@@ -629,7 +629,7 @@ bool SvNumberFormatter::PutEntry(OUString& rString,
bool SvNumberFormatter::PutandConvertEntry(OUString& rString,
sal_Int32& nCheckPos,
- short& nType,
+ SvNumFormatType& nType,
sal_uInt32& nKey,
LanguageType eLnge,
LanguageType eNewLnge,
@@ -649,7 +649,7 @@ bool SvNumberFormatter::PutandConvertEntry(OUString& rString,
bool SvNumberFormatter::PutandConvertEntrySystem(OUString& rString,
sal_Int32& nCheckPos,
- short& nType,
+ SvNumFormatType& nType,
sal_uInt32& nKey,
LanguageType eLnge,
LanguageType eNewLnge)
@@ -667,7 +667,7 @@ bool SvNumberFormatter::PutandConvertEntrySystem(OUString& rString,
}
sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( OUString & rString, LanguageType eLnge,
- LanguageType eSysLnge, short & rType,
+ LanguageType eSysLnge, SvNumFormatType & rType,
bool & rNewInserted, sal_Int32 & rCheckPos )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
@@ -726,7 +726,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( OUString & rString,
rType = GetType( nKey);
// Convert any (!) old "automatic" currency format to new fixed currency
// default format.
- if ((rType & css::util::NumberFormat::CURRENCY) != 0)
+ if (rType & SvNumFormatType::CURRENCY)
{
const SvNumberformat* pFormat = GetEntry( nKey);
if (!pFormat->HasNewCurrency())
@@ -736,7 +736,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( OUString & rString,
DeleteEntry( nKey); // don't leave trails of rubbish
rNewInserted = false;
}
- nKey = GetStandardFormat( css::util::NumberFormat::CURRENCY, eLnge);
+ nKey = GetStandardFormat( SvNumFormatType::CURRENCY, eLnge);
}
}
return nKey;
@@ -803,7 +803,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe
OUString aFormatStr;
if (const SvNumberformat* pEntry = GetEntry( nKey))
{
- if (pEntry->GetType() == css::util::NumberFormat::LOGICAL)
+ if (pEntry->GetType() == SvNumFormatType::LOGICAL)
{
// Build Boolean number format, which needs non-zero and zero
// subformat codes with TRUE and FALSE strings.
@@ -822,7 +822,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe
if (nLang != LANGUAGE_ENGLISH_US)
{
sal_Int32 nCheckPos;
- short nType = css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
sal_uInt32 nTempKey;
OUString aTemp( pEntry->GetFormatstring());
rTempFormatter.PutandConvertEntry( aTemp, nCheckPos, nType, nTempKey, nLang, LANGUAGE_ENGLISH_US, true);
@@ -913,13 +913,13 @@ sal_uInt32 SvNumberFormatter::ImpIsEntry(const OUString& rString,
SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable(
- short& eType,
+ SvNumFormatType& eType,
sal_uInt32& FIndex,
LanguageType& rLnge)
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
- short eTypetmp = eType;
- if (eType == css::util::NumberFormat::ALL) // empty cell or don't care
+ SvNumFormatType eTypetmp = eType;
+ if (eType == SvNumFormatType::ALL) // empty cell or don't care
{
rLnge = IniLnge;
}
@@ -929,22 +929,22 @@ SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable(
if (!pFormat)
{
rLnge = IniLnge;
- eType = css::util::NumberFormat::ALL;
+ eType = SvNumFormatType::ALL;
eTypetmp = eType;
}
else
{
rLnge = pFormat->GetLanguage();
eType = pFormat->GetMaskedType();
- if (eType == 0)
+ if (eType == SvNumFormatType::ALL)
{
- eType = css::util::NumberFormat::DEFINED;
+ eType = SvNumFormatType::DEFINED;
eTypetmp = eType;
}
- else if (eType == css::util::NumberFormat::DATETIME)
+ else if (eType == SvNumFormatType::DATETIME)
{
eTypetmp = eType;
- eType = css::util::NumberFormat::DATE;
+ eType = SvNumFormatType::DATE;
}
else
{
@@ -1016,7 +1016,7 @@ sal_uInt32 SvNumberFormatter::ImpGenerateCL( LanguageType eLnge )
return CLOffset;
}
-SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType,
+SvNumberFormatTable& SvNumberFormatter::ChangeCL(SvNumFormatType eType,
sal_uInt32& FIndex,
LanguageType eLnge)
{
@@ -1026,7 +1026,7 @@ SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType,
}
SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
- short eType,
+ SvNumFormatType eType,
sal_uInt32& FIndex,
LanguageType eLnge)
{
@@ -1048,7 +1048,7 @@ SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
auto it = aFTable.find( CLOffset);
- if (eType == css::util::NumberFormat::ALL)
+ if (eType == SvNumFormatType::ALL)
{
while (it != aFTable.end() && it->second->GetLanguage() == ActLnge)
{ // copy all entries to output table
@@ -1083,26 +1083,26 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
- short FType;
+ SvNumFormatType FType;
const SvNumberformat* pFormat = ImpSubstituteEntry( GetFormatEntry(F_Index));
if (!pFormat)
{
ChangeIntl(IniLnge);
- FType = css::util::NumberFormat::NUMBER;
+ FType = SvNumFormatType::NUMBER;
}
else
{
FType = pFormat->GetMaskedType();
- if (FType == 0)
+ if (FType == SvNumFormatType::ALL)
{
- FType = css::util::NumberFormat::DEFINED;
+ FType = SvNumFormatType::DEFINED;
}
ChangeIntl(pFormat->GetLanguage());
}
bool res;
- short RType = FType;
- if (RType == css::util::NumberFormat::TEXT)
+ SvNumFormatType RType = FType;
+ if (RType == SvNumFormatType::TEXT)
{
res = false; // type text preset => no conversion to number
}
@@ -1114,7 +1114,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
{
switch ( RType )
{
- case css::util::NumberFormat::DATE :
+ case SvNumFormatType::DATE :
// Preserve ISO 8601 input.
if (pStringScanner->CanForceToIso8601( DateOrder::Invalid))
{
@@ -1125,7 +1125,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
F_Index = GetStandardFormat( RType, ActLnge );
}
break;
- case css::util::NumberFormat::TIME :
+ case SvNumFormatType::TIME :
if ( pStringScanner->GetDecPos() )
{
// 100th seconds
@@ -1161,13 +1161,13 @@ LanguageType SvNumberFormatter::GetLanguage() const
}
// static
-bool SvNumberFormatter::IsCompatible(short eOldType, short eNewType)
+bool SvNumberFormatter::IsCompatible(SvNumFormatType eOldType, SvNumFormatType eNewType)
{
if (eOldType == eNewType)
{
return true;
}
- else if (eOldType == css::util::NumberFormat::DEFINED)
+ else if (eOldType == SvNumFormatType::DEFINED)
{
return true;
}
@@ -1175,43 +1175,43 @@ bool SvNumberFormatter::IsCompatible(short eOldType, short eNewType)
{
switch (eNewType)
{
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::NUMBER:
switch (eOldType)
{
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::SCIENTIFIC:
- case css::util::NumberFormat::FRACTION:
- case css::util::NumberFormat::DEFINED:
+ case SvNumFormatType::PERCENT:
+ case SvNumFormatType::CURRENCY:
+ case SvNumFormatType::SCIENTIFIC:
+ case SvNumFormatType::FRACTION:
+ case SvNumFormatType::DEFINED:
return true;
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
default:
return false;
}
break;
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
switch (eOldType)
{
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
return true;
default:
return false;
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
switch (eOldType)
{
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
return true;
default:
return false;
}
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
switch (eOldType)
{
- case css::util::NumberFormat::TIME:
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::TIME:
+ case SvNumFormatType::DATE:
return true;
default:
return false;
@@ -1224,25 +1224,25 @@ bool SvNumberFormatter::IsCompatible(short eOldType, short eNewType)
}
-sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
+sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( SvNumFormatType nType )
{
sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge );
sal_uInt32 nSearch;
switch( nType )
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
nSearch = CLOffset + ZF_STANDARD_DATE;
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
nSearch = CLOffset + ZF_STANDARD_TIME;
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
nSearch = CLOffset + ZF_STANDARD_DATETIME;
break;
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
nSearch = CLOffset + ZF_STANDARD_PERCENT;
break;
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
nSearch = CLOffset + ZF_STANDARD_SCIENTIFIC;
break;
default:
@@ -1273,19 +1273,19 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
{ // none found, use old fixed standards
switch( nType )
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
nDefaultFormat = CLOffset + ZF_STANDARD_DATE;
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
nDefaultFormat = CLOffset + ZF_STANDARD_TIME+1;
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
nDefaultFormat = CLOffset + ZF_STANDARD_DATETIME;
break;
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
nDefaultFormat = CLOffset + ZF_STANDARD_PERCENT+1;
break;
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
nDefaultFormat = CLOffset + ZF_STANDARD_SCIENTIFIC;
break;
default:
@@ -1298,7 +1298,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
}
-sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge )
+sal_uInt32 SvNumberFormatter::GetStandardFormat( SvNumFormatType eType, LanguageType eLnge )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
if (eLnge == LANGUAGE_DONTKNOW)
@@ -1308,24 +1308,24 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge
sal_uInt32 CLOffset = ImpGenerateCL(eLnge);
switch(eType)
{
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::CURRENCY:
return ( eLnge == LANGUAGE_SYSTEM ) ? ImpGetDefaultSystemCurrencyFormat() : ImpGetDefaultCurrencyFormat();
- case css::util::NumberFormat::DATE:
- case css::util::NumberFormat::TIME:
- case css::util::NumberFormat::DATETIME:
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::DATE:
+ case SvNumFormatType::TIME:
+ case SvNumFormatType::DATETIME:
+ case SvNumFormatType::PERCENT:
+ case SvNumFormatType::SCIENTIFIC:
return ImpGetDefaultFormat( eType );
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::FRACTION:
return CLOffset + ZF_STANDARD_FRACTION;
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
return CLOffset + ZF_STANDARD_LOGICAL;
- case css::util::NumberFormat::TEXT:
+ case SvNumFormatType::TEXT:
return CLOffset + ZF_STANDARD_TEXT;
- case css::util::NumberFormat::ALL:
- case css::util::NumberFormat::DEFINED:
- case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::UNDEFINED:
+ case SvNumFormatType::ALL:
+ case SvNumFormatType::DEFINED:
+ case SvNumFormatType::NUMBER:
+ case SvNumFormatType::UNDEFINED:
default:
return CLOffset + ZF_STANDARD;
}
@@ -1342,7 +1342,7 @@ bool SvNumberFormatter::IsSpecialStandardFormat( sal_uInt32 nFIndex,
;
}
-sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, short eType,
+sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, SvNumFormatType eType,
LanguageType eLnge )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
@@ -1376,12 +1376,12 @@ sal_uInt32 SvNumberFormatter::GetTimeFormat( double fNumber, LanguageType eLnge
if ( bSign || fNumber >= 1.0 )
return GetFormatIndex( NF_TIME_HH_MMSS, eLnge );
else
- return GetStandardFormat( css::util::NumberFormat::TIME, eLnge );
+ return GetStandardFormat( SvNumFormatType::TIME, eLnge );
}
}
sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIndex,
- short eType, LanguageType eLnge )
+ SvNumFormatType eType, LanguageType eLnge )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
if ( IsSpecialStandardFormat( nFIndex, eLnge ) )
@@ -1389,14 +1389,14 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIn
switch( eType )
{
- case css::util::NumberFormat::TIME :
+ case SvNumFormatType::TIME :
return GetTimeFormat( fNumber, eLnge);
default:
return GetStandardFormat( eType, eLnge );
}
}
-sal_uInt32 SvNumberFormatter::GuessDateTimeFormat( short& rType, double fNumber, LanguageType eLnge )
+sal_uInt32 SvNumberFormatter::GuessDateTimeFormat( SvNumFormatType& rType, double fNumber, LanguageType eLnge )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
// Categorize the format according to the implementation of
@@ -1406,32 +1406,32 @@ sal_uInt32 SvNumberFormatter::GuessDateTimeFormat( short& rType, double fNumber,
if (0.0 <= fNumber && fNumber < 1.0)
{
// Clearly a time.
- rType = util::NumberFormat::TIME;
+ rType = SvNumFormatType::TIME;
nRet = GetTimeFormat( fNumber, eLnge);
}
else if (fabs( fNumber) * 24 < 0x7fff)
{
// Assuming time within 32k hours or 3.7 years.
- rType = util::NumberFormat::TIME;
+ rType = SvNumFormatType::TIME;
nRet = GetTimeFormat( fNumber, eLnge);
}
else if (rtl::math::approxFloor( fNumber) != fNumber)
{
// Date+Time.
- rType = util::NumberFormat::DATETIME;
+ rType = SvNumFormatType::DATETIME;
nRet = GetFormatIndex( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, eLnge);
}
else
{
// Date only.
- rType = util::NumberFormat::DATE;
+ rType = SvNumFormatType::DATE;
nRet = GetFormatIndex( NF_DATE_SYS_DDMMYYYY, eLnge);
}
return nRet;
}
sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex,
- short eType, LanguageType eLang,
+ SvNumFormatType eType, LanguageType eLang,
SvNumberformat const * pFormat )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
@@ -1439,7 +1439,7 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex,
switch ( eType )
{
// #61619# always edit using 4-digit year
- case css::util::NumberFormat::DATE :
+ case SvNumFormatType::DATE :
{
// Preserve ISO 8601 format.
bool bIsoDate =
@@ -1465,7 +1465,7 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex,
}
}
break;
- case css::util::NumberFormat::TIME :
+ case SvNumFormatType::TIME :
if (fNumber < 0.0 || fNumber >= 1.0)
{
/* XXX NOTE: this is a purely arbitrary value within the limits
@@ -1482,7 +1482,7 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex,
else
nKey = GetStandardFormat( fNumber, nFIndex, eType, eLang );
break;
- case css::util::NumberFormat::DATETIME :
+ case SvNumFormatType::DATETIME :
if (nFIndex == GetFormatIndex( NF_DATETIME_ISO_YYYYMMDD_HHMMSS, eLang) || (pFormat && pFormat->IsIso8601( 0 )))
nKey = GetFormatIndex( NF_DATETIME_ISO_YYYYMMDD_HHMMSS, eLang );
else
@@ -1510,8 +1510,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
LanguageType eLang = pFormat->GetLanguage();
ChangeIntl( eLang );
- short eType = pFormat->GetMaskedType();
- if (eType == 0)
+ SvNumFormatType eType = pFormat->GetMaskedType();
+ if (eType == SvNumFormatType::ALL)
{
// Mixed types in subformats, use first.
/* XXX we could choose a subformat according to fOutNumber and
@@ -1522,15 +1522,15 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
sal_uInt16 nOldPrec = pFormatScanner->GetStandardPrec();
bool bPrecChanged = false;
- if (eType == css::util::NumberFormat::NUMBER ||
- eType == css::util::NumberFormat::PERCENT ||
- eType == css::util::NumberFormat::CURRENCY ||
- eType == css::util::NumberFormat::SCIENTIFIC ||
- eType == css::util::NumberFormat::FRACTION)
+ if (eType == SvNumFormatType::NUMBER ||
+ eType == SvNumFormatType::PERCENT ||
+ eType == SvNumFormatType::CURRENCY ||
+ eType == SvNumFormatType::SCIENTIFIC ||
+ eType == SvNumFormatType::FRACTION)
{
- if (eType != css::util::NumberFormat::PERCENT) // special treatment of % later
+ if (eType != SvNumFormatType::PERCENT) // special treatment of % later
{
- eType = css::util::NumberFormat::NUMBER;
+ eType = SvNumFormatType::NUMBER;
}
ChangeStandardPrec(INPUTSTRING_PRECISION);
bPrecChanged = true;
@@ -1543,7 +1543,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
}
if (pFormat)
{
- if ( eType == css::util::NumberFormat::TIME && pFormat->GetFormatPrecision() )
+ if ( eType == SvNumFormatType::TIME && pFormat->GetFormatPrecision() )
{
ChangeStandardPrec(INPUTSTRING_PRECISION);
bPrecChanged = true;
@@ -2277,7 +2277,7 @@ SvNumberformat* SvNumberFormatter::ImpSubstituteEntry( SvNumberformat* pFormat,
sal_uInt32 nKey;
if (pFormat->IsSystemTimeFormat())
/* TODO: should we have NF_TIME_SYSTEM for consistency? */
- nKey = GetStandardFormat( css::util::NumberFormat::TIME, LANGUAGE_SYSTEM);
+ nKey = GetStandardFormat( SvNumFormatType::TIME, LANGUAGE_SYSTEM);
else if (pFormat->IsSystemLongDateFormat())
/* TODO: either that above, or have a long option for GetStandardFormat() */
nKey = GetFormatIndex( NF_DATE_SYSTEM_LONG, LANGUAGE_SYSTEM);
@@ -2314,12 +2314,12 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
if (pStdFormat)
{
// This is _the_ standard format.
- if (LocaleDataWrapper::areChecksEnabled() && pStdFormat->GetType() != css::util::NumberFormat::NUMBER)
+ if (LocaleDataWrapper::areChecksEnabled() && pStdFormat->GetType() != SvNumFormatType::NUMBER)
{
LocaleDataWrapper::outputCheckMessage( xLocaleData->
appendLocaleInfo( "SvNumberFormatter::ImpGenerateFormats: General format not NUMBER"));
}
- pStdFormat->SetType( css::util::NumberFormat::NUMBER );
+ pStdFormat->SetType( SvNumFormatType::NUMBER );
pStdFormat->SetStandard();
pStdFormat->SetLastInsertKey( SV_MAX_COUNT_STANDARD_FORMATS, SvNumberformat::FormatterPrivateAccess() );
}
@@ -2339,7 +2339,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
std::unique_ptr<SvNumberformat> pNewFormat(new SvNumberformat( aFormatCode, pFormatScanner,
pStringScanner, nCheckPos, ActLnge ));
- pNewFormat->SetType(css::util::NumberFormat::LOGICAL);
+ pNewFormat->SetType(SvNumFormatType::LOGICAL);
pNewFormat->SetStandard();
if ( !aFTable.emplace(CLOffset + ZF_STANDARD_LOGICAL /* NF_BOOLEAN */,
std::move(pNewFormat)).second )
@@ -2351,7 +2351,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
aFormatCode = "@";
pNewFormat.reset(new SvNumberformat( aFormatCode, pFormatScanner,
pStringScanner, nCheckPos, ActLnge ));
- pNewFormat->SetType(css::util::NumberFormat::TEXT);
+ pNewFormat->SetType(SvNumFormatType::TEXT);
pNewFormat->SetStandard();
if ( !aFTable.emplace( CLOffset + ZF_STANDARD_TEXT /* NF_TEXT */,
std::move(pNewFormat)).second )
@@ -2851,12 +2851,12 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
{
eLnge = IniLnge;
}
- short eType = GetType(nIndex);
+ SvNumFormatType eType = GetType(nIndex);
ImpGenerateCL(eLnge); // create new standard formats if necessary
utl::DigitGroupingIterator aGrouping( xLocaleData->getDigitGrouping());
// always group of 3 for Engineering notation
- const sal_Int32 nDigitsInFirstGroup = ( bThousand && (eType == css::util::NumberFormat::SCIENTIFIC) ) ? 3 : aGrouping.get();
+ const sal_Int32 nDigitsInFirstGroup = ( bThousand && (eType == SvNumFormatType::SCIENTIFIC) ) ? 3 : aGrouping.get();
const OUString& rThSep = GetNumThousandSep();
SvNumberformat* pFormat = GetFormatEntry( nIndex );
@@ -2870,7 +2870,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
sString.append('#');
else
{
- if (eType == css::util::NumberFormat::SCIENTIFIC)
+ if (eType == SvNumFormatType::SCIENTIFIC)
{ // for scientific, bThousand is used for Engineering notation
sString.append("###");
}
@@ -2895,7 +2895,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
}
if ( bThousand )
{
- sal_Int32 nDigits = (eType == css::util::NumberFormat::SCIENTIFIC) ? 3*((nLeadingZeros-1)/3 + 1) : nDigitsInFirstGroup + 1;
+ sal_Int32 nDigits = (eType == SvNumFormatType::SCIENTIFIC) ? 3*((nLeadingZeros-1)/3 + 1) : nDigitsInFirstGroup + 1;
for (sal_Int32 i = nLeadingZeros; i < nDigits; i++)
{
if ( i % nDigitsInFirstGroup == 0 )
@@ -2904,16 +2904,16 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
}
}
}
- if (nPrecision > 0 && eType != css::util::NumberFormat::FRACTION )
+ if (nPrecision > 0 && eType != SvNumFormatType::FRACTION )
{
sString.append(GetNumDecimalSep());
padToLength(sString, sString.getLength() + nPrecision, '0');
}
- if (eType == css::util::NumberFormat::PERCENT)
+ if (eType == SvNumFormatType::PERCENT)
{
sString.append('%');
}
- else if (eType == css::util::NumberFormat::SCIENTIFIC)
+ else if (eType == SvNumFormatType::SCIENTIFIC)
{
OUStringBuffer sOldFormatString = pFormat->GetFormatstring();
sal_Int32 nIndexE = ImpPosToken( sOldFormatString, 'E' );
@@ -2926,7 +2926,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
sString.append( sOldFormatString.copy(nIndexE) );
}
}
- else if (eType == css::util::NumberFormat::CURRENCY)
+ else if (eType == SvNumFormatType::CURRENCY)
{
OUStringBuffer sNegStr(sString);
OUString aCurr;
@@ -2979,7 +2979,7 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
}
sString.append(sNegStr.makeStringAndClear());
}
- else if (eType == css::util::NumberFormat::FRACTION)
+ else if (eType == SvNumFormatType::FRACTION)
{
OUString aIntegerFractionDelimiterString = pFormat->GetIntegerFractionDelimiterString( 0 );
if ( aIntegerFractionDelimiterString == " " )
@@ -2997,10 +2997,10 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex,
else
sString.append( '#' );
}
- if (eType != css::util::NumberFormat::CURRENCY)
+ if (eType != SvNumFormatType::CURRENCY)
{
bool insertBrackets = false;
- if ( eType != css::util::NumberFormat::UNDEFINED)
+ if ( eType != SvNumFormatType::UNDEFINED)
{
insertBrackets = pFormat->IsNegativeInBracket();
}
@@ -3056,7 +3056,7 @@ bool SvNumberFormatter::IsUserDefined(const OUString& sStr,
return true;
}
SvNumberformat* pEntry = GetFormatEntry( nKey );
- return pEntry && ((pEntry->GetType() & css::util::NumberFormat::DEFINED) != 0);
+ return pEntry && (pEntry->GetType() & SvNumFormatType::DEFINED);
}
sal_uInt32 SvNumberFormatter::GetEntryKey(const OUString& sStr,
@@ -3078,24 +3078,24 @@ sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge)
{
eLnge = IniLnge;
}
- return GetStandardFormat(css::util::NumberFormat::NUMBER, eLnge);
+ return GetStandardFormat(SvNumFormatType::NUMBER, eLnge);
}
-short SvNumberFormatter::GetType(sal_uInt32 nFIndex) const
+SvNumFormatType SvNumberFormatter::GetType(sal_uInt32 nFIndex) const
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
- short eType;
+ SvNumFormatType eType;
const SvNumberformat* pFormat = GetFormatEntry( nFIndex );
if (!pFormat)
{
- eType = css::util::NumberFormat::UNDEFINED;
+ eType = SvNumFormatType::UNDEFINED;
}
else
{
eType = pFormat->GetMaskedType();
- if (eType == 0)
+ if (eType == SvNumFormatType::ALL)
{
- eType = css::util::NumberFormat::DEFINED;
+ eType = SvNumFormatType::DEFINED;
}
}
return eType;
@@ -3448,7 +3448,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
if ( nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
{
sal_Int32 nCheck;
- short nType;
+ SvNumFormatType nType;
NfWSStringsDtor aCurrList;
sal_uInt16 nDefault = GetCurrencyFormatStrings( aCurrList,
GetCurrencyEntry( LANGUAGE_SYSTEM ), false );
@@ -3480,7 +3480,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
while ( it2 != aFTable.end() && (nKey = it2->first) >= CLOffset && nKey < nStopKey )
{
const SvNumberformat* pEntry = it2->second.get();
- if ( pEntry->IsStandard() && (pEntry->GetType() & css::util::NumberFormat::CURRENCY) )
+ if ( pEntry->IsStandard() && (pEntry->GetType() & SvNumFormatType::CURRENCY) )
{
nDefaultCurrencyFormat = nKey;
break; // while
@@ -3499,7 +3499,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
{
// if already loaded or user defined nDefaultSystemCurrencyFormat
// will be set to the right value
- short nType;
+ SvNumFormatType nType;
PutEntry( aCurrList[ nDefault ], nCheck, nType,
nDefaultCurrencyFormat, ActLnge );
DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" );
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index d9368ea7ea35..de4dd24398b3 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -269,7 +269,7 @@ sal_uInt8 SvNumberNatNum::MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLan
ImpSvNumFor::ImpSvNumFor()
{
nStringsCnt = 0;
- aI.eScannedType = css::util::NumberFormat::UNDEFINED;
+ aI.eScannedType = SvNumFormatType::UNDEFINED;
aI.bThousand = false;
aI.nThousand = 0;
aI.nCntPre = 0;
@@ -793,7 +793,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
fLimit2 = 0.0;
eOp1 = NUMBERFORMAT_OP_NO;
eOp2 = NUMBERFORMAT_OP_NO;
- eType = css::util::NumberFormat::DEFINED;
+ eType = SvNumFormatType::DEFINED;
bool bCancel = false;
bool bCondition = false;
@@ -840,10 +840,10 @@ SvNumberformat::SvNumberformat(OUString& rString,
sal_Int32 nCntChars = ImpGetNumber(sBuff, nPos, sStr);
if (nCntChars > 0)
{
- short F_Type = css::util::NumberFormat::UNDEFINED;
+ SvNumFormatType F_Type = SvNumFormatType::UNDEFINED;
if (!pISc->IsNumberFormat(sStr, F_Type, fNumber, nullptr) ||
- ( F_Type != css::util::NumberFormat::NUMBER &&
- F_Type != css::util::NumberFormat::SCIENTIFIC) )
+ ( F_Type != SvNumFormatType::NUMBER &&
+ F_Type != SvNumFormatType::SCIENTIFIC) )
{
fNumber = 0.0;
nPos = nPos - nCntChars;
@@ -1061,7 +1061,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
if (sStr.isEmpty())
{
// Empty sub format.
- NumFor[nIndex].Info().eScannedType = css::util::NumberFormat::EMPTY;
+ NumFor[nIndex].Info().eScannedType = SvNumFormatType::EMPTY;
}
else
{
@@ -1117,7 +1117,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
// format the omitted subformats act like they were
// not specified and "inherited" the first format,
// e.g. 0;@ behaves like 0;-0;0;@
- if (pSc->GetScannedType() == css::util::NumberFormat::TEXT)
+ if (pSc->GetScannedType() == SvNumFormatType::TEXT)
{
// Reset conditions, reverting any set above.
if (nIndex == 1)
@@ -1136,11 +1136,11 @@ SvNumberformat::SvNumberformat(OUString& rString,
}
else if (nIndex == 3)
{ // #77026# Everything recognized IS text
- NumFor[nIndex].Info().eScannedType = css::util::NumberFormat::TEXT;
+ NumFor[nIndex].Info().eScannedType = SvNumFormatType::TEXT;
}
else if ( NumFor[nIndex].Info().eScannedType != eType)
{
- eType = css::util::NumberFormat::DEFINED;
+ eType = SvNumFormatType::DEFINED;
}
}
else
@@ -1190,7 +1190,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
{
eOp2 = NUMBERFORMAT_OP_LT; // undefined condition, default: < 0
}
- NumFor[nIndex+1].Info().eScannedType = css::util::NumberFormat::EMPTY;
+ NumFor[nIndex+1].Info().eScannedType = SvNumFormatType::EMPTY;
if (sBuff[nPos-1] != ';')
sBuff.insert( nPos++, ';');
}
@@ -1198,13 +1198,13 @@ SvNumberformat::SvNumberformat(OUString& rString,
{
// #83510# A 4th subformat explicitly specified to be empty
// hides any text. Need the type here for HasTextFormat()
- NumFor[3].Info().eScannedType = css::util::NumberFormat::TEXT;
+ NumFor[3].Info().eScannedType = SvNumFormatType::TEXT;
}
bCancel = true;
}
if ( NumFor[nIndex].GetNatNum().IsSet() )
{
- NumFor[nIndex].SetNatNumDate( (NumFor[nIndex].Info().eScannedType & css::util::NumberFormat::DATE) != 0 );
+ NumFor[nIndex].SetNatNumDate( bool(NumFor[nIndex].Info().eScannedType & SvNumFormatType::DATE) );
}
}
@@ -1214,12 +1214,12 @@ SvNumberformat::SvNumberformat(OUString& rString,
// substitute type.
if (IsSystemTimeFormat())
{
- if ((eType & ~css::util::NumberFormat::DEFINED) != css::util::NumberFormat::TIME)
+ if ((eType & ~SvNumFormatType::DEFINED) != SvNumFormatType::TIME)
nCheckPos = std::max<sal_Int32>( sBuff.indexOf(']') + 1, 1);
}
else if (IsSystemLongDateFormat())
{
- if ((eType & ~css::util::NumberFormat::DEFINED) != css::util::NumberFormat::DATE)
+ if ((eType & ~SvNumFormatType::DEFINED) != SvNumFormatType::DATE)
nCheckPos = std::max<sal_Int32>( sBuff.indexOf(']') + 1, 1);
}
else
@@ -1851,7 +1851,7 @@ void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter,
{
sal_Int32 nCheckPos;
sal_uInt32 nKey;
- short nType = eType;
+ SvNumFormatType nType = eType;
OUString aFormatString( sFormatstring );
rConverter.PutandConvertEntry( aFormatString, nCheckPos, nType,
nKey, eConvertFrom, eConvertTo );
@@ -2005,7 +2005,7 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, OUString& rOutS
void SvNumberformat::ImpGetOutputInputLine(double fNumber, OUString& OutString) const
{
bool bModified = false;
- if ( (eType & css::util::NumberFormat::PERCENT) && (fabs(fNumber) < D_MAX_D_BY_100))
+ if ( (eType & SvNumFormatType::PERCENT) && (fabs(fNumber) < D_MAX_D_BY_100))
{
if (fNumber == 0.0)
{
@@ -2027,7 +2027,7 @@ void SvNumberformat::ImpGetOutputInputLine(double fNumber, OUString& OutString)
rtl_math_DecimalPlaces_Max,
GetFormatter().GetNumDecimalSep()[0], true );
- if ( eType & css::util::NumberFormat::PERCENT && bModified)
+ if ( eType & SvNumFormatType::PERCENT && bModified)
{
OutString += "%";
}
@@ -2088,7 +2088,7 @@ void SvNumberformat::GetOutputString(const OUString& sString,
{
OUStringBuffer sOutBuff;
sal_uInt16 nIx;
- if (eType & css::util::NumberFormat::TEXT)
+ if (eType & SvNumFormatType::TEXT)
{
nIx = 0;
}
@@ -2103,7 +2103,7 @@ void SvNumberformat::GetOutputString(const OUString& sString,
}
*ppColor = NumFor[nIx].GetColor();
const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- if (rInfo.eScannedType == css::util::NumberFormat::TEXT)
+ if (rInfo.eScannedType == SvNumFormatType::TEXT)
{
const sal_uInt16 nCnt = NumFor[nIx].GetCount();
for (sal_uInt16 i = 0; i < nCnt; i++)
@@ -2256,7 +2256,7 @@ bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, OUSt
{
using namespace std;
- if (eType != css::util::NumberFormat::NUMBER)
+ if (eType != SvNumFormatType::NUMBER)
{
return false;
}
@@ -2335,7 +2335,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
OUStringBuffer sBuff;
OutString.clear();
*ppColor = nullptr; // No color change
- if (eType & css::util::NumberFormat::LOGICAL)
+ if (eType & SvNumFormatType::LOGICAL)
{
if (fNumber)
{
@@ -2347,7 +2347,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
}
return false;
}
- if (eType & css::util::NumberFormat::TEXT)
+ if (eType & SvNumFormatType::TEXT)
{
ImpGetOutputStandard(fNumber, sBuff);
OutString = sBuff.makeStringAndClear();
@@ -2363,7 +2363,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
}
switch (eType)
{
- case css::util::NumberFormat::NUMBER: // Standard number format
+ case SvNumFormatType::NUMBER: // Standard number format
if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION)
{
if (::rtl::math::isSignBitSet(fNumber))
@@ -2401,18 +2401,19 @@ bool SvNumberformat::GetOutputString(double fNumber,
ImpGetOutputStandard(fNumber, sBuff);
bHadStandard = true;
break;
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
bRes |= ImpGetDateOutput(fNumber, 0, sBuff);
bHadStandard = true;
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
bRes |= ImpGetTimeOutput(fNumber, 0, sBuff);
bHadStandard = true;
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
bRes |= ImpGetDateTimeOutput(fNumber, 0, sBuff);
bHadStandard = true;
break;
+ default: break;
}
}
if ( !bHadStandard )
@@ -2427,7 +2428,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
*ppColor = NumFor[nIx].GetColor();
const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
const sal_uInt16 nCnt = NumFor[nIx].GetCount();
- if (nCnt == 0 && rInfo.eScannedType == css::util::NumberFormat::EMPTY)
+ if (nCnt == 0 && rInfo.eScannedType == SvNumFormatType::EMPTY)
{
return false; // Empty => nothing
}
@@ -2439,8 +2440,8 @@ bool SvNumberformat::GetOutputString(double fNumber,
}
switch (rInfo.eScannedType)
{
- case css::util::NumberFormat::TEXT:
- case css::util::NumberFormat::DEFINED:
+ case SvNumFormatType::TEXT:
+ case SvNumFormatType::DEFINED:
for (sal_uInt16 i = 0; i < nCnt; i++)
{
switch (rInfo.nTypeArray[i])
@@ -2470,26 +2471,27 @@ bool SvNumberformat::GetOutputString(double fNumber,
}
}
break;
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
bRes |= ImpGetDateOutput(fNumber, nIx, sBuff);
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
bRes |= ImpGetTimeOutput(fNumber, nIx, sBuff);
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
bRes |= ImpGetDateTimeOutput(fNumber, nIx, sBuff);
break;
- case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::NUMBER:
+ case SvNumFormatType::PERCENT:
+ case SvNumFormatType::CURRENCY:
bRes |= ImpGetNumberOutput(fNumber, nIx, sBuff);
break;
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::FRACTION:
bRes |= ImpGetFractionOutput(fNumber, nIx, sBuff);
break;
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
bRes |= ImpGetScientificOutput(fNumber, nIx, sBuff);
break;
+ default: break;
}
}
OutString = sBuff.makeStringAndClear();
@@ -3390,7 +3392,7 @@ void SvNumberformat::ImpAppendEraG( OUStringBuffer& OutString,
bool SvNumberformat::ImpIsIso8601( const ImpSvNumFor& rNumFor ) const
{
bool bIsIso = false;
- if ((eType & css::util::NumberFormat::DATE) == css::util::NumberFormat::DATE)
+ if (eType & SvNumFormatType::DATE)
{
enum State
{
@@ -4089,7 +4091,7 @@ bool SvNumberformat::ImpGetNumberOutput(double fNumber,
}
}
const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- if (rInfo.eScannedType == css::util::NumberFormat::PERCENT)
+ if (rInfo.eScannedType == SvNumFormatType::PERCENT)
{
if (fNumber < D_MAX_D_BY_100)
{
@@ -4607,7 +4609,7 @@ void SvNumberformat::GetFormatSpecialInfo(bool& bThousand,
{
// as before: take info from nNumFor=0 for whole format (for dialog etc.)
- short nDummyType;
+ SvNumFormatType nDummyType;
GetNumForInfo( 0, nDummyType, bThousand, nPrecision, nLeadingCnt );
// "negative in red" is only useful for the whole format
@@ -4617,7 +4619,7 @@ void SvNumberformat::GetFormatSpecialInfo(bool& bThousand,
&& (*pColor == ImpSvNumberformatScan::GetRedColor());
}
-void SvNumberformat::GetNumForInfo( sal_uInt16 nNumFor, short& rScannedType,
+void SvNumberformat::GetNumForInfo( sal_uInt16 nNumFor, SvNumFormatType& rScannedType,
bool& bThousand, sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt ) const
{
// take info from a specified sub-format (for XML export)
@@ -4630,14 +4632,14 @@ void SvNumberformat::GetNumForInfo( sal_uInt16 nNumFor, short& rScannedType,
const ImpSvNumberformatInfo& rInfo = NumFor[nNumFor].Info();
rScannedType = rInfo.eScannedType;
bThousand = rInfo.bThousand;
- nPrecision = (rInfo.eScannedType == css::util::NumberFormat::FRACTION)
+ nPrecision = (rInfo.eScannedType == SvNumFormatType::FRACTION)
? rInfo.nCntExp // number of denominator digits for fraction
: rInfo.nCntPost;
sal_Int32 nPosHash = 1;
- if ( rInfo.eScannedType == css::util::NumberFormat::FRACTION &&
+ if ( rInfo.eScannedType == SvNumFormatType::FRACTION &&
( (nPosHash += GetDenominatorString(nNumFor).indexOf('#')) > 0 ) )
nPrecision -= nPosHash;
- if (bStandard && rInfo.eScannedType == css::util::NumberFormat::NUMBER)
+ if (bStandard && rInfo.eScannedType == SvNumFormatType::NUMBER)
{
// StandardFormat
nLeadingCnt = 1;
@@ -4781,7 +4783,7 @@ bool SvNumberformat::HasPositiveBracketPlaceholder() const
DateOrder SvNumberformat::GetDateOrder() const
{
- if ( (eType & css::util::NumberFormat::DATE) == css::util::NumberFormat::DATE )
+ if ( eType & SvNumFormatType::DATE )
{
auto& rTypeArray = NumFor[0].Info().nTypeArray;
sal_uInt16 nCnt = NumFor[0].GetCount();
@@ -4818,7 +4820,7 @@ DateOrder SvNumberformat::GetDateOrder() const
sal_uInt32 SvNumberformat::GetExactDateOrder() const
{
sal_uInt32 nRet = 0;
- if ( (eType & css::util::NumberFormat::DATE) != css::util::NumberFormat::DATE )
+ if ( !(eType & SvNumFormatType::DATE) )
{
SAL_WARN( "svl.numbers", "SvNumberformat::GetExactDateOrder: no date" );
return nRet;
@@ -5004,7 +5006,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
int nSub = 0; // subformats delimited so far
for ( int n=0; n<4; n++ )
{
- if ( n > 0 && NumFor[n].Info().eScannedType != css::util::NumberFormat::UNDEFINED )
+ if ( n > 0 && NumFor[n].Info().eScannedType != SvNumFormatType::UNDEFINED )
{
nSem++;
}
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 3937896bce70..a78dbfdc0530 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1238,7 +1238,7 @@ void ImpSvNumberformatScan::Reset()
{
nStringsCnt = 0;
nResultStringsCnt = 0;
- eScannedType = css::util::NumberFormat::UNDEFINED;
+ eScannedType = SvNumFormatType::UNDEFINED;
bExp = false;
bThousand = false;
nThousand = 0;
@@ -1269,7 +1269,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
sal_Int32 nPos = 0;
sal_uInt16 i = 0;
- short eNewType;
+ SvNumFormatType eNewType;
bool bMatchBracket = false;
bool bHaveGeneral = false; // if General/Standard encountered
bool bIsTimeDetected =false; // hour or second found in format
@@ -1286,7 +1286,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
switch (nTypeArray[i])
{
case NF_KEY_E: // E
- eNewType = css::util::NumberFormat::SCIENTIFIC;
+ eNewType = SvNumFormatType::SCIENTIFIC;
break;
case NF_KEY_H: // H
case NF_KEY_HH: // HH
@@ -1299,7 +1299,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
SAL_FALLTHROUGH;
case NF_KEY_AMPM: // AM,A,PM,P
case NF_KEY_AP:
- eNewType = css::util::NumberFormat::TIME;
+ eNewType = SvNumFormatType::TIME;
break;
case NF_KEY_M: // M
case NF_KEY_MM: // MM
@@ -1327,7 +1327,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
bIsTimeDetected || // tdf#101147
PreviousChar(i) == '[' ) // [M
{
- eNewType = css::util::NumberFormat::TIME;
+ eNewType = SvNumFormatType::TIME;
if ( nTypeArray[i] == NF_KEY_M || nTypeArray[i] == NF_KEY_MM )
{
nTypeArray[i] -= 2; // 6 -> 4, 7 -> 5
@@ -1337,7 +1337,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
}
else
{
- eNewType = css::util::NumberFormat::DATE;
+ eNewType = SvNumFormatType::DATE;
if ( nTypeArray[i] == NF_KEY_MI || nTypeArray[i] == NF_KEY_MMI )
{ // follow resolution of tdf#33689 for Finnish
nTypeArray[i] += 2; // 4 -> 6, 5 -> 7
@@ -1368,18 +1368,18 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
case NF_KEY_GGG : // GGG
case NF_KEY_R : // R
case NF_KEY_RR : // RR
- eNewType = css::util::NumberFormat::DATE;
+ eNewType = SvNumFormatType::DATE;
bIsTimeDetected = false;
break;
case NF_KEY_CCC: // CCC
- eNewType = css::util::NumberFormat::CURRENCY;
+ eNewType = SvNumFormatType::CURRENCY;
break;
case NF_KEY_GENERAL: // Standard
- eNewType = css::util::NumberFormat::NUMBER;
+ eNewType = SvNumFormatType::NUMBER;
bHaveGeneral = true;
break;
default:
- eNewType = css::util::NumberFormat::UNDEFINED;
+ eNewType = SvNumFormatType::UNDEFINED;
break;
}
}
@@ -1389,15 +1389,15 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
{
case '#':
case '?':
- eNewType = css::util::NumberFormat::NUMBER;
+ eNewType = SvNumFormatType::NUMBER;
break;
case '0':
- if ( (eScannedType & css::util::NumberFormat::TIME) == css::util::NumberFormat::TIME )
+ if ( eScannedType & SvNumFormatType::TIME )
{
if ( Is100SecZero( i, bDecSep ) )
{
bDecSep = true; // subsequent 0's
- eNewType = css::util::NumberFormat::TIME;
+ eNewType = SvNumFormatType::TIME;
}
else
{
@@ -1406,28 +1406,28 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
}
else
{
- eNewType = css::util::NumberFormat::NUMBER;
+ eNewType = SvNumFormatType::NUMBER;
}
break;
case '%':
- eNewType = css::util::NumberFormat::PERCENT;
+ eNewType = SvNumFormatType::PERCENT;
break;
case '/':
- eNewType = css::util::NumberFormat::FRACTION;
+ eNewType = SvNumFormatType::FRACTION;
break;
case '[':
if ( i < nStringsCnt-1 &&
nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
sStrArray[i+1][0] == '$' )
{
- eNewType = css::util::NumberFormat::CURRENCY;
+ eNewType = SvNumFormatType::CURRENCY;
bMatchBracket = true;
}
else if ( i < nStringsCnt-1 &&
nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
sStrArray[i+1][0] == '~' )
{
- eNewType = css::util::NumberFormat::DATE;
+ eNewType = SvNumFormatType::DATE;
bMatchBracket = true;
}
else
@@ -1439,7 +1439,7 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
nIndexNex == NF_KEY_MM || // MM
nIndexNex == NF_KEY_S || // S
nIndexNex == NF_KEY_SS ) // SS
- eNewType = css::util::NumberFormat::TIME;
+ eNewType = SvNumFormatType::TIME;
else
{
return nPos; // Error
@@ -1447,44 +1447,44 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
}
break;
case '@':
- eNewType = css::util::NumberFormat::TEXT;
+ eNewType = SvNumFormatType::TEXT;
break;
default:
if (pLoc->getTime100SecSep() == sStrArray[i])
{
bDecSep = true; // for SS,0
}
- eNewType = css::util::NumberFormat::UNDEFINED;
+ eNewType = SvNumFormatType::UNDEFINED;
break;
}
}
- if (eScannedType == css::util::NumberFormat::UNDEFINED)
+ if (eScannedType == SvNumFormatType::UNDEFINED)
{
eScannedType = eNewType;
}
- else if (eScannedType == css::util::NumberFormat::TEXT || eNewType == css::util::NumberFormat::TEXT)
+ else if (eScannedType == SvNumFormatType::TEXT || eNewType == SvNumFormatType::TEXT)
{
- eScannedType = css::util::NumberFormat::TEXT; // Text always remains text
+ eScannedType = SvNumFormatType::TEXT; // Text always remains text
}
- else if (eNewType == css::util::NumberFormat::UNDEFINED)
+ else if (eNewType == SvNumFormatType::UNDEFINED)
{ // Remains as is
}
else if (eScannedType != eNewType)
{
switch (eScannedType)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
switch (eNewType)
{
- case css::util::NumberFormat::TIME:
- eScannedType = css::util::NumberFormat::DATETIME;
+ case SvNumFormatType::TIME:
+ eScannedType = SvNumFormatType::DATETIME;
break;
- case css::util::NumberFormat::FRACTION: // DD/MM
+ case SvNumFormatType::FRACTION: // DD/MM
break;
default:
if (nCurrPos >= 0)
{
- eScannedType = css::util::NumberFormat::UNDEFINED;
+ eScannedType = SvNumFormatType::UNDEFINED;
}
else if ( sStrArray[i] != pFormatter->GetDateSep() )
{
@@ -1492,18 +1492,18 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
}
}
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
switch (eNewType)
{
- case css::util::NumberFormat::DATE:
- eScannedType = css::util::NumberFormat::DATETIME;
+ case SvNumFormatType::DATE:
+ eScannedType = SvNumFormatType::DATETIME;
break;
- case css::util::NumberFormat::FRACTION: // MM/SS
+ case SvNumFormatType::FRACTION: // MM/SS
break;
default:
if (nCurrPos >= 0)
{
- eScannedType = css::util::NumberFormat::UNDEFINED;
+ eScannedType = SvNumFormatType::UNDEFINED;
}
else if (pLoc->getTimeSep() != sStrArray[i])
{
@@ -1512,18 +1512,18 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
break;
}
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
switch (eNewType)
{
- case css::util::NumberFormat::TIME:
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::TIME:
+ case SvNumFormatType::DATE:
break;
- case css::util::NumberFormat::FRACTION: // DD/MM
+ case SvNumFormatType::FRACTION: // DD/MM
break;
default:
if (nCurrPos >= 0)
{
- eScannedType = css::util::NumberFormat::UNDEFINED;
+ eScannedType = SvNumFormatType::UNDEFINED;
}
else if ( pFormatter->GetDateSep() != sStrArray[i] &&
pLoc->getTimeSep() != sStrArray[i] )
@@ -1532,37 +1532,37 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
}
}
break;
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
switch (eNewType)
{
- case css::util::NumberFormat::NUMBER: // Only number to percent
+ case SvNumFormatType::NUMBER: // Only number to percent
break;
default:
return nPos;
}
break;
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
switch (eNewType)
{
- case css::util::NumberFormat::NUMBER: // Only number to E
+ case SvNumFormatType::NUMBER: // Only number to E
break;
default:
return nPos;
}
break;
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::NUMBER:
switch (eNewType)
{
- case css::util::NumberFormat::SCIENTIFIC:
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::FRACTION:
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::SCIENTIFIC:
+ case SvNumFormatType::PERCENT:
+ case SvNumFormatType::FRACTION:
+ case SvNumFormatType::CURRENCY:
eScannedType = eNewType;
break;
default:
if (nCurrPos >= 0)
{
- eScannedType = css::util::NumberFormat::UNDEFINED;
+ eScannedType = SvNumFormatType::UNDEFINED;
}
else
{
@@ -1570,10 +1570,10 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
}
}
break;
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::FRACTION:
switch (eNewType)
{
- case css::util::NumberFormat::NUMBER: // Only number to fraction
+ case SvNumFormatType::NUMBER: // Only number to fraction
break;
default:
return nPos;
@@ -1609,15 +1609,15 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
SkipStrings(i, nPos);
}
- if ((eScannedType == css::util::NumberFormat::NUMBER ||
- eScannedType == css::util::NumberFormat::UNDEFINED) &&
+ if ((eScannedType == SvNumFormatType::NUMBER ||
+ eScannedType == SvNumFormatType::UNDEFINED) &&
nCurrPos >= 0 && !bHaveGeneral)
{
- eScannedType = css::util::NumberFormat::CURRENCY; // old "automatic" currency
+ eScannedType = SvNumFormatType::CURRENCY; // old "automatic" currency
}
- if (eScannedType == css::util::NumberFormat::UNDEFINED)
+ if (eScannedType == SvNumFormatType::UNDEFINED)
{
- eScannedType = css::util::NumberFormat::DEFINED;
+ eScannedType = SvNumFormatType::DEFINED;
}
return 0; // All is fine
}
@@ -1765,8 +1765,8 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
switch (eScannedType)
{
- case css::util::NumberFormat::TEXT:
- case css::util::NumberFormat::DEFINED:
+ case SvNumFormatType::TEXT:
+ case SvNumFormatType::DEFINED:
while (i < nStringsCnt)
{
switch (nTypeArray[i])
@@ -1789,16 +1789,16 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
} // of while
break;
- case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::SCIENTIFIC:
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::NUMBER:
+ case SvNumFormatType::PERCENT:
+ case SvNumFormatType::CURRENCY:
+ case SvNumFormatType::SCIENTIFIC:
+ case SvNumFormatType::FRACTION:
while (i < nStringsCnt)
{
// TODO: rechecking eScannedType is unnecessary.
- // This switch-case is for eScannedType == css::util::NumberFormat::FRACTION anyway
- if (eScannedType == css::util::NumberFormat::FRACTION && // special case
+ // This switch-case is for eScannedType == SvNumFormatType::FRACTION anyway
+ if (eScannedType == SvNumFormatType::FRACTION && // special case
nTypeArray[i] == NF_SYMBOLTYPE_DEL && // # ### #/#
StringEqualsChar( sOldThousandSep, ' ' ) && // e.g. France or Sweden
StringEqualsChar( sStrArray[i], ' ' ) &&
@@ -1827,7 +1827,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
else if (nTypeArray[i] == NF_SYMBOLTYPE_STRING || // No Strings or
nTypeArray[i] > 0) // Keywords
{
- if (eScannedType == css::util::NumberFormat::SCIENTIFIC &&
+ if (eScannedType == SvNumFormatType::SCIENTIFIC &&
nTypeArray[i] == NF_KEY_E) // E+
{
if (bExp) // Double
@@ -1847,7 +1847,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
nCounter = 0;
nTypeArray[i] = NF_SYMBOLTYPE_EXP;
}
- else if (eScannedType == css::util::NumberFormat::FRACTION &&
+ else if (eScannedType == SvNumFormatType::FRACTION &&
(sStrArray[i][0] == ' ' || ( nTypeArray[i] == NF_SYMBOLTYPE_STRING && (sStrArray[i][0] < '0' || sStrArray[i][0] > '9') ) ) )
{
if (!bBlank && !bFrac) // Not double or after a /
@@ -1902,7 +1902,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
nCounter = nCntPre;
}
// don't artificially increment nCntPre for forced denominator
- if ( ( eScannedType != css::util::NumberFormat::FRACTION ) && (!nCntPre) )
+ if ( ( eScannedType != SvNumFormatType::FRACTION ) && (!nCntPre) )
{
nCntPre++;
}
@@ -1988,7 +1988,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
// currency formats the last dash will be
// interpreted literally as a minus sign.
// Has to be this ugly. Period.
- if ( eScannedType == css::util::NumberFormat::CURRENCY
+ if ( eScannedType == SvNumFormatType::CURRENCY
&& rStr.getLength() >= 2 &&
(i == nStringsCnt-1 ||
sStrArray[i+1][0] != '-') )
@@ -2186,7 +2186,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
else // . without meaning
{
if (cSaved == ' ' &&
- eScannedType == css::util::NumberFormat::FRACTION &&
+ eScannedType == SvNumFormatType::FRACTION &&
StringEqualsChar( sStrArray[i], ' ' ) )
{
if (!bBlank && !bFrac) // no dups
@@ -2224,7 +2224,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
}
break;
case '/':
- if (eScannedType == css::util::NumberFormat::FRACTION)
+ if (eScannedType == SvNumFormatType::FRACTION)
{
if ( i == 0 ||
(nTypeArray[i-1] != NF_SYMBOLTYPE_DIGIT &&
@@ -2254,7 +2254,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
}
break;
case '[' :
- if ( eScannedType == css::util::NumberFormat::CURRENCY &&
+ if ( eScannedType == SvNumFormatType::CURRENCY &&
i < nStringsCnt-1 &&
nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
sStrArray[i+1][0] == '$' )
@@ -2320,7 +2320,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
}
break;
default: // Other Dels
- if (eScannedType == css::util::NumberFormat::PERCENT && cHere == '%')
+ if (eScannedType == SvNumFormatType::PERCENT && cHere == '%')
{
nTypeArray[i] = NF_SYMBOLTYPE_PERCENT;
}
@@ -2340,7 +2340,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
i++;
}
} // of while
- if (eScannedType == css::util::NumberFormat::FRACTION)
+ if (eScannedType == SvNumFormatType::FRACTION)
{
if (bFrac)
{
@@ -2447,8 +2447,8 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
}
}
}
- break; // of css::util::NumberFormat::NUMBER
- case css::util::NumberFormat::DATE:
+ break; // of SvNumFormatType::NUMBER
+ case SvNumFormatType::DATE:
while (i < nStringsCnt)
{
switch (nTypeArray[i])
@@ -2556,8 +2556,8 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
break;
}
} // of while
- break; // of css::util::NumberFormat::DATE
- case css::util::NumberFormat::TIME:
+ break; // of SvNumFormatType::DATE
+ case SvNumFormatType::TIME:
while (i < nStringsCnt)
{
sal_Unicode cChar;
@@ -2696,8 +2696,8 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
{
nCntExp = 1; // Remembers AM/PM
}
- break; // of css::util::NumberFormat::TIME
- case css::util::NumberFormat::DATETIME:
+ break; // of SvNumFormatType::TIME
+ case SvNumFormatType::DATETIME:
while (i < nStringsCnt)
{
int nCalRet;
@@ -2891,16 +2891,16 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
{
nCntExp = 1; // Remembers AM/PM
}
- break; // of css::util::NumberFormat::DATETIME
+ break; // of SvNumFormatType::DATETIME
default:
break;
}
- if (eScannedType == css::util::NumberFormat::SCIENTIFIC &&
+ if (eScannedType == SvNumFormatType::SCIENTIFIC &&
(nCntPre + nCntPost == 0 || nCntExp == 0))
{
return nPos;
}
- else if (eScannedType == css::util::NumberFormat::FRACTION && (nCntExp > 8 || nCntExp == 0))
+ else if (eScannedType == SvNumFormatType::FRACTION && (nCntExp > 8 || nCntExp == 0))
{
return nPos;
}
@@ -3021,7 +3021,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
if ( nTypeArray[i] == NF_SYMBOLTYPE_STRING &&
sStrArray[i][0] != '\"' )
{
- if ( bConvertSystemToSystem && eScannedType == css::util::NumberFormat::CURRENCY )
+ if ( bConvertSystemToSystem && eScannedType == SvNumFormatType::CURRENCY )
{
// don't stringize automatic currency, will be converted
if ( sStrArray[i] == sOldCurSymbol )
@@ -3102,7 +3102,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
case ' ':
case '.':
case '/':
- if (((eScannedType & css::util::NumberFormat::DATE) == 0) &&
+ if (!(eScannedType & SvNumFormatType::DATE) &&
(StringEqualsChar( pFormatter->GetNumThousandSep(), c) ||
StringEqualsChar( pFormatter->GetNumDecimalSep(), c) ||
(c == ' ' &&
@@ -3111,18 +3111,18 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
{
rString += sStrArray[i];
}
- else if ((eScannedType & css::util::NumberFormat::DATE) &&
+ else if ((eScannedType & SvNumFormatType::DATE) &&
StringEqualsChar( pFormatter->GetDateSep(), c))
{
rString += sStrArray[i];
}
- else if ((eScannedType & css::util::NumberFormat::TIME) &&
+ else if ((eScannedType & SvNumFormatType::TIME) &&
(StringEqualsChar( pLoc->getTimeSep(), c) ||
StringEqualsChar( pLoc->getTime100SecSep(), c)))
{
rString += sStrArray[i];
}
- else if (eScannedType & css::util::NumberFormat::FRACTION)
+ else if (eScannedType & SvNumFormatType::FRACTION)
{
rString += sStrArray[i];
}
@@ -3142,7 +3142,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
if ( RemoveQuotes( sStrArray[i] ) > 0 )
{
// update currency up to quoted string
- if ( eScannedType == css::util::NumberFormat::CURRENCY )
+ if ( eScannedType == SvNumFormatType::CURRENCY )
{
// dM -> DM or DM -> $ in old automatic
// currency formats, oh my ..., why did we ever introduce them?
@@ -3185,7 +3185,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
{
i--; // enter switch on next symbol again
}
- if ( eScannedType == css::util::NumberFormat::CURRENCY && nStringPos < rString.getLength() )
+ if ( eScannedType == SvNumFormatType::CURRENCY && nStringPos < rString.getLength() )
{
// same as above, since last RemoveQuotes
OUString aTmp( pChrCls->uppercase( sStrArray[iPos], nArrPos,
diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx
index d6da6d3daab6..309f963c9c21 100644
--- a/svl/source/numbers/zforscan.hxx
+++ b/svl/source/numbers/zforscan.hxx
@@ -168,7 +168,7 @@ public:
SvNumberFormatter* GetNumberformatter() { return pFormatter; } // Access to formatter (for zformat.cxx)
/// Get type scanned (so far).
- short GetScannedType() const { return eScannedType; }
+ SvNumFormatType GetScannedType() const { return eScannedType; }
private: // Private section
NfKeywordTable sKeyword; // Syntax keywords
@@ -186,7 +186,7 @@ private: // Private section
short nTypeArray[NF_MAX_FORMAT_SYMBOLS]; // Array of infos
// External Infos:
sal_uInt16 nResultStringsCnt; // Result symbol count
- short eScannedType; // Type according to scan
+ SvNumFormatType eScannedType; // Type according to scan
bool bThousand; // With thousands marker
sal_uInt16 nThousand; // Counts .... series
sal_uInt16 nCntPre; // Counts digits of integral part
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index 5d4c93171028..3b47e08c938b 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -558,7 +558,7 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, bool bResetForm
// get the Office's locale and translate
LanguageType eSysLanguage = SvtSysLocale().GetLanguageTag().getLanguageType( false);
// get the standard numeric format for this language
- m_nFormatKey = m_pFormatter->GetStandardFormat( css::util::NumberFormat::NUMBER, eSysLanguage );
+ m_nFormatKey = m_pFormatter->GetStandardFormat( SvNumFormatType::NUMBER, eSysLanguage );
}
else
m_nFormatKey = 0;
@@ -577,7 +577,7 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, bool bResetForm
// convert the old format string into the new language
sal_Int32 nCheckPos;
- short nType;
+ SvNumFormatType nType;
pFormatter->PutandConvertEntry(sOldFormat, nCheckPos, nType, nDestKey, aOldLang, aNewLang);
m_nFormatKey = nDestKey;
}
@@ -603,7 +603,7 @@ bool FormattedField::SetFormat(const OUString& rFormatString, LanguageType eLang
if (nNewKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
{
sal_Int32 nCheckPos;
- short nType;
+ SvNumFormatType nType;
OUString rFormat(rFormatString);
if (!ImplGetFormatter()->PutEntry(rFormat, nCheckPos, nType, nNewKey, eLang))
return false;
@@ -648,7 +648,7 @@ void FormattedField::SetThousandsSep(bool _bUseSeparator)
// ... and introduce it to the formatter
sal_Int32 nCheckPos = 0;
sal_uInt32 nNewKey;
- short nType;
+ SvNumFormatType nType;
ImplGetFormatter()->PutEntry(sFmtDescription, nCheckPos, nType, nNewKey, eLang);
// set the new key
@@ -689,7 +689,7 @@ void FormattedField::SetDecimalDigits(sal_uInt16 _nPrecision)
// ... and introduce it to the formatter
sal_Int32 nCheckPos = 0;
sal_uInt32 nNewKey;
- short nType;
+ SvNumFormatType nType;
ImplGetFormatter()->PutEntry(sFmtDescription, nCheckPos, nType, nNewKey, eLang);
// set the new key
@@ -911,17 +911,17 @@ bool FormattedField::ImplGetValue(double& dNewVal)
nFormatKey = 0;
// special treatment for percentage formatting
- if (ImplGetFormatter()->GetType(m_nFormatKey) == css::util::NumberFormat::PERCENT)
+ if (ImplGetFormatter()->GetType(m_nFormatKey) == SvNumFormatType::PERCENT)
{
// the language of our format
LanguageType eLanguage = m_pFormatter->GetEntry(m_nFormatKey)->GetLanguage();
// the default number format for this language
- sal_uLong nStandardNumericFormat = m_pFormatter->GetStandardFormat(css::util::NumberFormat::NUMBER, eLanguage);
+ sal_uLong nStandardNumericFormat = m_pFormatter->GetStandardFormat(SvNumFormatType::NUMBER, eLanguage);
sal_uInt32 nTempFormat = nStandardNumericFormat;
double dTemp;
if (m_pFormatter->IsNumberFormat(sText, nTempFormat, dTemp) &&
- css::util::NumberFormat::NUMBER == m_pFormatter->GetType(nTempFormat))
+ SvNumFormatType::NUMBER == m_pFormatter->GetType(nTempFormat))
// the string is equivalent to a number formatted one (has no % sign) -> append it
sText += "%";
// (with this, a input of '3' becomes '3%', which then by the formatter is translated
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 9d46140d83e6..94d3df1cb181 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -34,26 +34,26 @@
namespace {
-double GetDefaultValNum( const short nType )
+double GetDefaultValNum( const SvNumFormatType nType )
{
switch( nType )
{
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::NUMBER:
return fSvxNumValConst[SvxNumValCategory::Standard];
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::CURRENCY:
return fSvxNumValConst[SvxNumValCategory::Currency];
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
return fSvxNumValConst[SvxNumValCategory::Percent];
- case css::util::NumberFormat::DATE:
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATE:
+ case SvNumFormatType::DATETIME:
return fSvxNumValConst[SvxNumValCategory::Date];
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
return fSvxNumValConst[SvxNumValCategory::Time];
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
return fSvxNumValConst[SvxNumValCategory::Scientific];
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::FRACTION:
return fSvxNumValConst[SvxNumValCategory::Fraction];
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
return fSvxNumValConst[SvxNumValCategory::Boolean];
default: break;
}
@@ -91,7 +91,7 @@ SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
, eValType ( eNumValType )
, bUndoAddList ( true )
, nCurFormatKey ( nFormatKey )
- , nCurCategory (css::util::NumberFormat::ALL)
+ , nCurCategory (SvNumFormatType::ALL)
, eCurLanguage (LANGUAGE_NONE)
, pCurCurrencyEntry(nullptr)
, bBankingSymbol (false)
@@ -128,7 +128,7 @@ SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
, eValType ( eNumValType )
, bUndoAddList ( true )
, nCurFormatKey ( nFormatKey )
- , nCurCategory (css::util::NumberFormat::ALL)
+ , nCurCategory (SvNumFormatType::ALL)
, eCurLanguage (LANGUAGE_NONE)
, pCurCurrencyEntry(nullptr)
, bBankingSymbol (false)
@@ -199,13 +199,13 @@ void SvxNumberFormatShell::CategoryChanged( sal_uInt16 nCatLbPos,
short& rFmtSelPos,
std::vector<OUString>& rFmtEntries )
{
- short nOldCategory = nCurCategory;
+ SvNumFormatType nOldCategory = nCurCategory;
PosToCategory_Impl( nCatLbPos, nCurCategory );
pCurFmtTable = &( pFormatter->GetEntryTable( nCurCategory,
nCurFormatKey,
eCurLanguage ) );
// reinitialize currency if category newly entered
- if ( nCurCategory == css::util::NumberFormat::CURRENCY && nOldCategory != nCurCategory )
+ if ( nCurCategory == SvNumFormatType::CURRENCY && nOldCategory != nCurCategory )
pCurCurrencyEntry = nullptr;
rFmtSelPos = FillEntryList_Impl( rFmtEntries );
}
@@ -235,7 +235,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
{
GetPreviewString_Impl( rPreviewStr, rpFontColor );
}
- else if( nCurCategory == css::util::NumberFormat::CURRENCY )
+ else if( nCurCategory == SvNumFormatType::CURRENCY )
{
if( static_cast<size_t>(nFmtLbPos) < aCurrencyFormatList.size() )
{
@@ -454,7 +454,7 @@ void SvxNumberFormatShell::MakePreviewString( const OUString& rFormatStr,
// #50441# if a string was set in addition to the value, use it for text formats
bool bUseText = ( eValType == SvxNumberValueType::String ||
- ( !aValStr.isEmpty() && ( pFormatter->GetType(nExistingFormat) & css::util::NumberFormat::TEXT ) ) );
+ ( !aValStr.isEmpty() && ( pFormatter->GetType(nExistingFormat) & SvNumFormatType::TEXT ) ) );
if ( bUseText )
{
pFormatter->GetOutputString( aValStr, nExistingFormat,
@@ -541,7 +541,7 @@ void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos,
if ( (eValType == SvxNumberValueType::Undefined) && (nCurFormatKey == 0) )
PosToCategory_Impl( CAT_ALL, nCurCategory ); // category = all
else
- nCurCategory = css::util::NumberFormat::UNDEFINED; // category = undefined
+ nCurCategory = SvNumFormatType::UNDEFINED; // category = undefined
pCurFmtTable = &(pFormatter->GetFirstEntryTable( nCurCategory,
nCurFormatKey,
@@ -572,7 +572,7 @@ short SvxNumberFormatShell::FillEntryList_Impl( std::vector<OUString>& rList )
aCurEntryList.clear();
- if(nCurCategory==css::util::NumberFormat::ALL)
+ if(nCurCategory==SvNumFormatType::ALL)
{
FillEListWithStd_Impl(rList,CAT_NUMBER,nSelPos);
FillEListWithStd_Impl(rList,CAT_PERCENT,nSelPos);
@@ -676,8 +676,6 @@ short SvxNumberFormatShell::FillEListWithFormats_Impl( std::vector<OUString>& rL
OUString aStrComment;
OUString aNewFormNInfo;
- short nMyCat = SELPOS_NONE;
-
long nIndex;
for(nIndex=eOffsetStart;nIndex<=eOffsetEnd;nIndex++)
@@ -688,7 +686,7 @@ short SvxNumberFormatShell::FillEListWithFormats_Impl( std::vector<OUString>& rL
if(pNumEntry==nullptr) continue;
- nMyCat=pNumEntry->GetMaskedType();
+ SvNumFormatType nMyCat=pNumEntry->GetMaskedType();
aStrComment=pNumEntry->GetComment();
CategoryToPos_Impl(nMyCat,nMyType);
aNewFormNInfo= pNumEntry->GetFormatstring();
@@ -714,8 +712,6 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<OUString>& r
OUString aStrComment;
OUString aNewFormNInfo;
- short nMyCat = SELPOS_NONE;
-
for (long nIndex = NF_DATETIME_START; nIndex <= NF_DATETIME_END; ++nIndex)
{
nNFEntry=pFormatter->GetFormatIndex((NfIndexTableOffset)nIndex,eCurLanguage);
@@ -723,7 +719,7 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<OUString>& r
const SvNumberformat* pNumEntry = pFormatter->GetEntry(nNFEntry);
if(pNumEntry!=nullptr)
{
- nMyCat=pNumEntry->GetMaskedType();
+ SvNumFormatType nMyCat=pNumEntry->GetMaskedType();
aStrComment=pNumEntry->GetComment();
CategoryToPos_Impl(nMyCat,nMyType);
aNewFormNInfo= pNumEntry->GetFormatstring();
@@ -759,9 +755,9 @@ short SvxNumberFormatShell::FillEListWithCurrency_Impl( std::vector<OUString>& r
if( (!bFlag && pCurCurrencyEntry==nullptr) ||
(bFlag && pTmpCurrencyEntry==nullptr && rSymbol.isEmpty()) ||
- (nCurCategory==css::util::NumberFormat::ALL))
+ (nCurCategory==SvNumFormatType::ALL))
{
- if ( nCurCategory == css::util::NumberFormat::ALL )
+ if ( nCurCategory == SvNumFormatType::ALL )
FillEListWithUserCurrencys(rList,nSelPos);
nSelPos=FillEListWithSysCurrencys(rList,nSelPos);
}
@@ -791,8 +787,6 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
nCurCurrencyEntryPos=0;
- short nMyCat = SELPOS_NONE;
-
for(long nIndex=NF_CURRENCY_START; nIndex<=NF_CURRENCY_END; nIndex++)
{
nNFEntry=pFormatter->GetFormatIndex((NfIndexTableOffset)nIndex,eCurLanguage);
@@ -801,7 +795,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
if(pNumEntry==nullptr) continue;
- nMyCat=pNumEntry->GetMaskedType();
+ SvNumFormatType nMyCat=pNumEntry->GetMaskedType();
aStrComment=pNumEntry->GetComment();
CategoryToPos_Impl(nMyCat,nMyType);
aNewFormNInfo= pNumEntry->GetFormatstring();
@@ -815,7 +809,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
aCurEntryList.push_back( nNFEntry );
}
- if(nCurCategory!=css::util::NumberFormat::ALL)
+ if(nCurCategory!=SvNumFormatType::ALL)
{
for( SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it )
{
@@ -838,9 +832,9 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
bUserNewCurrency=(pTmpCurrencyEntry!=nullptr);
}
- if(!bUserNewCurrency &&(pNumEntry->GetType() & css::util::NumberFormat::DEFINED))
+ if(!bUserNewCurrency &&(pNumEntry->GetType() & SvNumFormatType::DEFINED))
{
- nMyCat=pNumEntry->GetMaskedType();
+ SvNumFormatType nMyCat=pNumEntry->GetMaskedType();
aStrComment=pNumEntry->GetComment();
CategoryToPos_Impl(nMyCat,nMyType);
aNewFormNInfo= pNumEntry->GetFormatstring();
@@ -868,7 +862,6 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
OUString aStrComment;
OUString aNewFormNInfo;
- short nMyCat = SELPOS_NONE;
const NfCurrencyEntry* pTmpCurrencyEntry;
bool bTmpBanking, bAdaptSelPos;
@@ -921,10 +914,10 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
if ( !IsRemoved_Impl( nKey ) )
{
- if( pNumEntry->GetType() & css::util::NumberFormat::DEFINED ||
+ if( pNumEntry->GetType() & SvNumFormatType::DEFINED ||
pNumEntry->IsAdditionalBuiltin() )
{
- nMyCat=pNumEntry->GetMaskedType();
+ SvNumFormatType nMyCat=pNumEntry->GetMaskedType();
aStrComment = pNumEntry->GetComment();
CategoryToPos_Impl(nMyCat,nMyType);
aNewFormNInfo = pNumEntry->GetFormatstring();
@@ -968,7 +961,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
NfWSStringsDtor aWSStringsDtor;
sal_uInt16 nDefault;
- if ( pTmpCurrencyEntry && nCurCategory != css::util::NumberFormat::ALL )
+ if ( pTmpCurrencyEntry && nCurCategory != SvNumFormatType::ALL )
{
nDefault = pFormatter->GetCurrencyFormatStrings(
aWSStringsDtor, *pTmpCurrencyEntry, bTmpBanking );
@@ -978,7 +971,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
}
else
nDefault = 0;
- if ( !bTmpBanking && nCurCategory != css::util::NumberFormat::ALL )
+ if ( !bTmpBanking && nCurCategory != SvNumFormatType::ALL )
{ // append formats for all currencies defined in the current I18N locale
const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
sal_uInt16 nCurrCount = rCurrencyTable.size();
@@ -1039,7 +1032,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
nSelPos = i;
}
- if ( nSelPos == SELPOS_NONE && nCurCategory != css::util::NumberFormat::ALL )
+ if ( nSelPos == SELPOS_NONE && nCurCategory != SvNumFormatType::ALL )
nSelPos = nDefault;
return nSelPos;
@@ -1060,9 +1053,8 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<OUString>& rList,
OUString aStrComment;
OUString aNewFormNInfo;
- short nMyCat = SELPOS_NONE;
bool bAdditional = (nPrivCat != CAT_USERDEFINED &&
- nCurCategory != css::util::NumberFormat::ALL);
+ nCurCategory != SvNumFormatType::ALL);
for( SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it )
{
@@ -1071,10 +1063,10 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<OUString>& rList,
if ( !IsRemoved_Impl( nKey ) )
{
- if( (pNumEntry->GetType() & css::util::NumberFormat::DEFINED) ||
+ if( (pNumEntry->GetType() & SvNumFormatType::DEFINED) ||
(bAdditional && pNumEntry->IsAdditionalBuiltin()) )
{
- nMyCat=pNumEntry->GetMaskedType();
+ SvNumFormatType nMyCat=pNumEntry->GetMaskedType();
aStrComment=pNumEntry->GetComment();
CategoryToPos_Impl(nMyCat,nMyType);
aNewFormNInfo= pNumEntry->GetFormatstring();
@@ -1105,7 +1097,7 @@ void SvxNumberFormatShell::GetPreviewString_Impl( OUString& rString, Color*& rpC
// #50441# if a string was set in addition to the value, use it for text formats
bool bUseText = ( eValType == SvxNumberValueType::String ||
- ( !aValStr.isEmpty() && ( pFormatter->GetType(nCurFormatKey) & css::util::NumberFormat::TEXT ) ) );
+ ( !aValStr.isEmpty() && ( pFormatter->GetType(nCurFormatKey) & SvNumFormatType::TEXT ) ) );
if ( bUseText )
{
@@ -1137,43 +1129,43 @@ bool SvxNumberFormatShell::IsRemoved_Impl( size_t nKey )
// Conversion routines:
-void SvxNumberFormatShell::PosToCategory_Impl(sal_uInt16 nPos, short& rCategory)
+void SvxNumberFormatShell::PosToCategory_Impl(sal_uInt16 nPos, SvNumFormatType& rCategory)
{
// map category css::form positions (->resource)
switch ( nPos )
{
- case CAT_USERDEFINED: rCategory = css::util::NumberFormat::DEFINED; break;
- case CAT_NUMBER: rCategory = css::util::NumberFormat::NUMBER; break;
- case CAT_PERCENT: rCategory = css::util::NumberFormat::PERCENT; break;
- case CAT_CURRENCY: rCategory = css::util::NumberFormat::CURRENCY; break;
- case CAT_DATE: rCategory = css::util::NumberFormat::DATE; break;
- case CAT_TIME: rCategory = css::util::NumberFormat::TIME; break;
- case CAT_SCIENTIFIC: rCategory = css::util::NumberFormat::SCIENTIFIC; break;
- case CAT_FRACTION: rCategory = css::util::NumberFormat::FRACTION; break;
- case CAT_BOOLEAN: rCategory = css::util::NumberFormat::LOGICAL; break;
- case CAT_TEXT: rCategory = css::util::NumberFormat::TEXT; break;
+ case CAT_USERDEFINED: rCategory = SvNumFormatType::DEFINED; break;
+ case CAT_NUMBER: rCategory = SvNumFormatType::NUMBER; break;
+ case CAT_PERCENT: rCategory = SvNumFormatType::PERCENT; break;
+ case CAT_CURRENCY: rCategory = SvNumFormatType::CURRENCY; break;
+ case CAT_DATE: rCategory = SvNumFormatType::DATE; break;
+ case CAT_TIME: rCategory = SvNumFormatType::TIME; break;
+ case CAT_SCIENTIFIC: rCategory = SvNumFormatType::SCIENTIFIC; break;
+ case CAT_FRACTION: rCategory = SvNumFormatType::FRACTION; break;
+ case CAT_BOOLEAN: rCategory = SvNumFormatType::LOGICAL; break;
+ case CAT_TEXT: rCategory = SvNumFormatType::TEXT; break;
case CAT_ALL:
- default: rCategory = css::util::NumberFormat::ALL; break;
+ default: rCategory = SvNumFormatType::ALL; break;
}
}
-void SvxNumberFormatShell::CategoryToPos_Impl(short nCategory, sal_uInt16& rPos)
+void SvxNumberFormatShell::CategoryToPos_Impl(SvNumFormatType nCategory, sal_uInt16& rPos)
{
// map category to css::form positions (->resource)
switch ( nCategory )
{
- case css::util::NumberFormat::DEFINED: rPos = CAT_USERDEFINED; break;
- case css::util::NumberFormat::NUMBER: rPos = CAT_NUMBER; break;
- case css::util::NumberFormat::PERCENT: rPos = CAT_PERCENT; break;
- case css::util::NumberFormat::CURRENCY: rPos = CAT_CURRENCY; break;
- case css::util::NumberFormat::DATETIME:
- case css::util::NumberFormat::DATE: rPos = CAT_DATE; break;
- case css::util::NumberFormat::TIME: rPos = CAT_TIME; break;
- case css::util::NumberFormat::SCIENTIFIC: rPos = CAT_SCIENTIFIC; break;
- case css::util::NumberFormat::FRACTION: rPos = CAT_FRACTION; break;
- case css::util::NumberFormat::LOGICAL: rPos = CAT_BOOLEAN; break;
- case css::util::NumberFormat::TEXT: rPos = CAT_TEXT; break;
- case css::util::NumberFormat::ALL:
+ case SvNumFormatType::DEFINED: rPos = CAT_USERDEFINED; break;
+ case SvNumFormatType::NUMBER: rPos = CAT_NUMBER; break;
+ case SvNumFormatType::PERCENT: rPos = CAT_PERCENT; break;
+ case SvNumFormatType::CURRENCY: rPos = CAT_CURRENCY; break;
+ case SvNumFormatType::DATETIME:
+ case SvNumFormatType::DATE: rPos = CAT_DATE; break;
+ case SvNumFormatType::TIME: rPos = CAT_TIME; break;
+ case SvNumFormatType::SCIENTIFIC: rPos = CAT_SCIENTIFIC; break;
+ case SvNumFormatType::FRACTION: rPos = CAT_FRACTION; break;
+ case SvNumFormatType::LOGICAL: rPos = CAT_BOOLEAN; break;
+ case SvNumFormatType::TEXT: rPos = CAT_TEXT; break;
+ case SvNumFormatType::ALL:
default: rPos = CAT_ALL;
}
}
@@ -1244,10 +1236,10 @@ short SvxNumberFormatShell::GetCategory4Entry(short nEntry) const
if(nMyNfEntry!=NUMBERFORMAT_ENTRY_NOT_FOUND)
{
const SvNumberformat *pNumEntry = pFormatter->GetEntry(nMyNfEntry);
- sal_uInt16 nMyCat,nMyType;
+ sal_uInt16 nMyType;
if(pNumEntry!=nullptr)
{
- nMyCat=pNumEntry->GetMaskedType();
+ SvNumFormatType nMyCat=pNumEntry->GetMaskedType();
CategoryToPos_Impl(nMyCat,nMyType);
return (short) nMyType;
@@ -1278,7 +1270,7 @@ bool SvxNumberFormatShell::GetUserDefined4Entry(short nEntry)
if(pNumEntry!=nullptr)
{
- if((pNumEntry->GetType() & css::util::NumberFormat::DEFINED)>0)
+ if(pNumEntry->GetType() & SvNumFormatType::DEFINED)
{
return true;
}
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 7ec2a4374449..3b0ceb86e03f 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -877,7 +877,7 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
rChg.GetValueFormat( sFormat, eLng, eSys );
if( !sFormat.isEmpty() )
{
- short nType;
+ SvNumFormatType nType;
bool bNew;
sal_Int32 nCheckPos;
sal_uInt32 nKey = pNFormatr->GetIndexPuttingAndConverting( sFormat, eLng,
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index caf0bfcf7537..8f0eea4ed77f 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4052,8 +4052,8 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate )
sal_uLong nOldNumFormat = static_cast<const SwTableBoxNumFormat*>(pNumFormatItem)->GetValue();
SvNumberFormatter* pNumFormatr = GetNumberFormatter();
- short nFormatType = pNumFormatr->GetType( nFormatIdx );
- if( nFormatType == pNumFormatr->GetType( nOldNumFormat ) || css::util::NumberFormat::NUMBER == nFormatType )
+ SvNumFormatType nFormatType = pNumFormatr->GetType( nFormatIdx );
+ if( nFormatType == pNumFormatr->GetType( nOldNumFormat ) || SvNumFormatType::NUMBER == nFormatType )
{
// Current and specified NumFormat match
// -> keep old Format
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 6582cd77e2de..f4a30868686b 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -217,16 +217,16 @@ double SwTableBox::GetValue( SwTableCalcPara& rCalcPara ) const
SvNumberFormatter* pNumFormatr = pDoc->GetNumberFormatter();
- const sal_Int16 nFormatType = pNumFormatr->GetType( nFormatIndex );
- if( nFormatType == css::util::NumberFormat::TEXT )
+ const SvNumFormatType nFormatType = pNumFormatr->GetType( nFormatIndex );
+ if( nFormatType == SvNumFormatType::TEXT )
nFormatIndex = 0;
// JP 22.04.98: Bug 49659 - special treatment for percentages
else if( !sText.isEmpty() &&
- css::util::NumberFormat::PERCENT == nFormatType)
+ SvNumFormatType::PERCENT == nFormatType)
{
sal_uInt32 nTmpFormat = 0;
if( pDoc->IsNumberFormat( sText, nTmpFormat, aNum ) &&
- css::util::NumberFormat::NUMBER == pNumFormatr->GetType( nTmpFormat ))
+ SvNumFormatType::NUMBER == pNumFormatr->GetType( nTmpFormat ))
sText += "%";
}
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 6febf519af6a..7726467f7336 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -477,7 +477,7 @@ OUString SwValueFieldType::ExpandValue( const double& rVal,
if( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && LANGUAGE_SYSTEM != nFormatLng )
{
- short nType = css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
sal_Int32 nDummy;
const SvNumberformat* pEntry = pFormatter->GetEntry(nFormat);
@@ -594,7 +594,7 @@ sal_uInt32 SwValueField::GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt
if (nNewFormat == nFormat)
{
// probably user-defined format
- short nType = css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
sal_Int32 nDummy;
OUString sFormat(pEntry->GetFormatstring());
@@ -637,7 +637,7 @@ void SwValueField::SetLanguage( LanguageType nLng )
if( nNewFormat == GetFormat() )
{
// probably user-defined format
- short nType = css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
sal_Int32 nDummy;
OUString sFormat( pEntry->GetFormatstring() );
pFormatter->PutandConvertEntry( sFormat, nDummy, nType,
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index de2d7775b811..41f7697f8cda 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2291,14 +2291,14 @@ void SwTableBoxFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew
// JP 22.04.98: Bug 49659 -
// Special casing for percent
- if( css::util::NumberFormat::PERCENT ==
+ if( SvNumFormatType::PERCENT ==
pNumFormatr->GetType( nNewFormat ))
{
sal_uInt32 nTmpFormat = 0;
if( GetDoc()->IsNumberFormat(
aText, nTmpFormat, fVal ))
{
- if( css::util::NumberFormat::NUMBER ==
+ if( SvNumFormatType::NUMBER ==
pNumFormatr->GetType( nTmpFormat ))
aText += "%";
@@ -2413,11 +2413,11 @@ bool SwTableBox::HasNumContent( double& rNum, sal_uInt32& rFormatIndex,
{
rFormatIndex = static_cast<const SwTableBoxNumFormat*>(pItem)->GetValue();
// Special casing for percent
- if( !rIsEmptyTextNd && css::util::NumberFormat::PERCENT == pNumFormatr->GetType( rFormatIndex ))
+ if( !rIsEmptyTextNd && SvNumFormatType::PERCENT == pNumFormatr->GetType( rFormatIndex ))
{
sal_uInt32 nTmpFormat = 0;
if( GetFrameFormat()->GetDoc()->IsNumberFormat( aText, nTmpFormat, rNum ) &&
- css::util::NumberFormat::NUMBER == pNumFormatr->GetType( nTmpFormat ))
+ SvNumFormatType::NUMBER == pNumFormatr->GetType( nTmpFormat ))
aText += "%";
}
}
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index cb4f6b37711b..409ff87e520e 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1597,7 +1597,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const Date aDateDiff( pField->GetDate() -
pNumFormatter->GetNullDate() );
const sal_uLong nFormat =
- pNumFormatter->GetStandardFormat( css::util::NumberFormat::DATE, pField->GetLanguage() );
+ pNumFormatter->GetStandardFormat( SvNumFormatType::DATE, pField->GetLanguage() );
OUString sDate;
Color* pColor;
pNumFormatter->GetOutputString( aDateDiff.GetDate(), nFormat, sDate, &pColor );
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index d4c32eefe5d5..10160dd3d8a8 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -5064,7 +5064,7 @@ css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyValue(const OUString& rPrope
m_pBoxAutoFormat->GetValueFormat(sFormat, eLng, eSys);
if(!sFormat.isEmpty())
{
- short nType; bool bNew; sal_Int32 nCheckPos;
+ SvNumFormatType nType; bool bNew; sal_Int32 nCheckPos;
sal_uInt32 nKey = m_pDocShell->GetDoc()->GetNumberFormatter()->GetIndexPuttingAndConverting(sFormat, eLng, eSys, nType, bNew, nCheckPos);
aRet <<= nKey;
}
diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx
index 622d81792af9..1a709be3fb7a 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -380,11 +380,12 @@ void SwHTMLParser::NewField()
double dValue = GetTableDataOptionsValNum(
nNumFormat, eLang, aNumValue, aNumFormat,
*m_xDoc->GetNumberFormatter() );
- short nFormatType = pFormatter->GetType( nNumFormat );
+ SvNumFormatType nFormatType = pFormatter->GetType( nNumFormat );
switch( nFormatType )
{
- case css::util::NumberFormat::DATE: nSub = DATEFLD; break;
- case css::util::NumberFormat::TIME: nSub = TIMEFLD; break;
+ case SvNumFormatType::DATE: nSub = DATEFLD; break;
+ case SvNumFormatType::TIME: nSub = TIMEFLD; break;
+ default: break;
}
if( nSub )
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index f9dedf2c25cb..f9135b0a01a4 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -836,7 +836,7 @@ namespace sw
{
// tell the Formatter about the new entry
sal_Int32 nCheckPos = 0;
- short nType = css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
sal_uInt32 nKey = 0;
SwapQuotesInField(rParams);
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 089bfc574764..3eb92100d532 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1812,7 +1812,7 @@ public: // really private, but can only be done public
eF_ResT Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr );
eF_ResT Read_F_Author( WW8FieldDesc*, OUString& );
eF_ResT Read_F_TemplName( WW8FieldDesc*, OUString& );
- short GetTimeDatePara(OUString const & rStr, sal_uInt32& rFormat, LanguageType &rLang,
+ SvNumFormatType GetTimeDatePara(OUString const & rStr, sal_uInt32& rFormat, LanguageType &rLang,
int nWhichDefault, bool bHijri = false);
bool ForceFieldLanguage(SwField &rField, LanguageType nLang);
eF_ResT Read_F_DateTime( WW8FieldDesc*, OUString& rStr );
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index eb04cb5a50d0..c73f0b2fffe3 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -429,7 +429,7 @@ OUString GetWordDefaultDateStringAsUS(SvNumberFormatter* pFormatter, LanguageTyp
return sParams;
}
-short SwWW8ImplReader::GetTimeDatePara(OUString const & rStr, sal_uInt32& rFormat,
+SvNumFormatType SwWW8ImplReader::GetTimeDatePara(OUString const & rStr, sal_uInt32& rFormat,
LanguageType &rLang, int nWhichDefault, bool bHijri)
{
bool bRTL = false;
@@ -471,7 +471,7 @@ short SwWW8ImplReader::GetTimeDatePara(OUString const & rStr, sal_uInt32& rForma
sParams = "[~hijri]" + sParams;
sal_Int32 nCheckPos = 0;
- short nType = css::util::NumberFormat::DEFINED;
+ SvNumFormatType nType = SvNumFormatType::DEFINED;
rFormat = 0;
OUString sTemp(sParams);
@@ -479,13 +479,13 @@ short SwWW8ImplReader::GetTimeDatePara(OUString const & rStr, sal_uInt32& rForma
LANGUAGE_ENGLISH_US, rLang);
sParams = sTemp;
- return bHasTime ? css::util::NumberFormat::DATETIME : css::util::NumberFormat::DATE;
+ return bHasTime ? SvNumFormatType::DATETIME : SvNumFormatType::DATE;
}
sal_uLong nFormatIdx =
sw::ms::MSDateTimeFormatToSwFormat(sParams, pFormatter, rLang, bHijri,
GetFib().m_lid);
- short nNumFormatType = css::util::NumberFormat::UNDEFINED;
+ SvNumFormatType nNumFormatType = SvNumFormatType::UNDEFINED;
if (nFormatIdx)
nNumFormatType = pFormatter->GetType(nFormatIdx);
rFormat = nFormatIdx;
@@ -1676,16 +1676,16 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr )
LanguageType nLang(LANGUAGE_SYSTEM);
if (bDateTime)
{
- short nDT = GetTimeDatePara(rStr, nFormat, nLang, pF->nId);
+ SvNumFormatType nDT = GetTimeDatePara(rStr, nFormat, nLang, pF->nId);
switch (nDT)
{
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
nReg = DI_SUB_DATE;
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
nReg = DI_SUB_TIME;
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
nReg = DI_SUB_DATE;
break;
default:
@@ -1775,32 +1775,32 @@ eF_ResT SwWW8ImplReader::Read_F_DateTime( WW8FieldDesc*pF, OUString& rStr )
sal_uInt32 nFormat = 0;
LanguageType nLang(LANGUAGE_SYSTEM);
- short nDT = GetTimeDatePara(rStr, nFormat, nLang, ww::eDATE, bHijri);
+ SvNumFormatType nDT = GetTimeDatePara(rStr, nFormat, nLang, ww::eDATE, bHijri);
- if( css::util::NumberFormat::UNDEFINED == nDT ) // no D/T-Formatstring
+ if( SvNumFormatType::UNDEFINED == nDT ) // no D/T-Formatstring
{
if (32 == pF->nId)
{
- nDT = css::util::NumberFormat::TIME;
+ nDT = SvNumFormatType::TIME;
nFormat = m_rDoc.GetNumberFormatter()->GetFormatIndex(
NF_TIME_START, LANGUAGE_SYSTEM );
}
else
{
- nDT = css::util::NumberFormat::DATE;
+ nDT = SvNumFormatType::DATE;
nFormat = m_rDoc.GetNumberFormatter()->GetFormatIndex(
NF_DATE_START, LANGUAGE_SYSTEM );
}
}
- if (nDT & css::util::NumberFormat::DATE)
+ if (nDT & SvNumFormatType::DATE)
{
SwDateTimeField aField(static_cast<SwDateTimeFieldType*>(
m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DateTime )), DATEFLD, nFormat);
ForceFieldLanguage(aField, nLang);
m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) );
}
- else if (nDT == css::util::NumberFormat::TIME)
+ else if (nDT == SvNumFormatType::TIME)
{
SwDateTimeField aField(static_cast<SwDateTimeFieldType*>(
m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DateTime)), TIMEFLD, nFormat);
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index f184357d514c..5833e0ff14a6 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -1132,7 +1132,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
aTableSet.ClearItem( RES_BOXATR_VALUE );
else
{
- if(rNumFormatr.GetType(aNumFormat.GetValue()) & css::util::NumberFormat::DATE)
+ if(rNumFormatr.GetType(aNumFormat.GetValue()) & SvNumFormatType::DATE)
{
::Date aStandard(1,1,1900);
if (rNumFormatr.GetNullDate() != aStandard)
@@ -1366,7 +1366,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
DBL_MAX != nValue )
{
Color* pCol;
- if(rNumFormatr.GetType(pDBCol->nFormat) & css::util::NumberFormat::DATE)
+ if(rNumFormatr.GetType(pDBCol->nFormat) & SvNumFormatType::DATE)
{
::Date aStandard(1,1,1900);
if (rNumFormatr.GetNullDate() != aStandard)
@@ -1818,7 +1818,7 @@ void SwInsertDBColAutoPilot::Load()
if( NUMBERFORMAT_ENTRY_NOT_FOUND == rSet.nUsrNumFormat )
{
sal_Int32 nCheckPos;
- short nType;
+ SvNumFormatType nType;
rNFormatr.PutEntry( rGet.sUsrNumFormat, nCheckPos, nType,
rSet.nUsrNumFormat, rGet.eUsrNumFormatLng );
}
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
index 92024ab1a727..6943b0319cd5 100644
--- a/sw/source/ui/fldui/flddinf.cxx
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -244,7 +244,7 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
sal_uInt16 nSubType = (sal_uInt16)reinterpret_cast<sal_uLong>(pSelEntry->GetUserData());
sal_Int32 nPos = m_pSelectionLB->GetSelectedEntryPos();
sal_uInt16 nExtSubType;
- sal_uInt16 nNewType = 0;
+ SvNumFormatType nNewType = SvNumFormatType::ALL;
if (nSubType != DI_EDIT)
{
@@ -264,15 +264,15 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
const uno::Type& rValueType = aVal.getValueType();
if( rValueType == ::cppu::UnoType<util::DateTime>::get())
{
- nNewType = css::util::NumberFormat::DATETIME;
+ nNewType = SvNumFormatType::DATETIME;
}
else if( rValueType == ::cppu::UnoType<util::Date>::get())
{
- nNewType = css::util::NumberFormat::DATE;
+ nNewType = SvNumFormatType::DATE;
}
else if( rValueType == ::cppu::UnoType<util::Time>::get())
{
- nNewType = css::util::NumberFormat::TIME;
+ nNewType = SvNumFormatType::TIME;
}
}
catch( const uno::Exception& )
@@ -290,7 +290,7 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
else
nExtSubType = DI_SUB_TIME;
- sal_uInt16 nOldType = 0;
+ SvNumFormatType nOldType = SvNumFormatType::ALL;
bool bEnable = false;
bool bOneArea = false;
@@ -303,16 +303,16 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
break;
case DI_SUB_DATE:
- nNewType = css::util::NumberFormat::DATE;
+ nNewType = SvNumFormatType::DATE;
bOneArea = true;
break;
case DI_SUB_TIME:
- nNewType = css::util::NumberFormat::TIME;
+ nNewType = SvNumFormatType::TIME;
bOneArea = true;
break;
}
- if (!nNewType)
+ if (nNewType == SvNumFormatType::ALL)
{
m_pFormatLB->Clear();
}
@@ -340,23 +340,23 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
nOldSubType &= ~DI_SUB_FIXED;
if (nOldSubType == nSubType)
{
- if (!nFormat && (nNewType == css::util::NumberFormat::DATE || nNewType == css::util::NumberFormat::TIME))
+ if (!nFormat && (nNewType == SvNumFormatType::DATE || nNewType == SvNumFormatType::TIME))
{
SwWrtShell *pSh = GetWrtShell();
if(pSh)
{
SvNumberFormatter* pFormatter = pSh->GetNumberFormatter();
LanguageType eLang = m_pFormatLB->GetCurLanguage();
- if (nNewType == css::util::NumberFormat::DATE)
+ if (nNewType == SvNumFormatType::DATE)
nFormat = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLang);
- else if (nNewType == css::util::NumberFormat::TIME)
+ else if (nNewType == SvNumFormatType::TIME)
nFormat = pFormatter->GetFormatIndex( NF_TIME_HHMM, eLang);
}
}
m_pFormatLB->SetDefFormat(nFormat);
}
}
- else if( (nSubType == DI_CUSTOM) && (nNewType != 0) )
+ else if( (nSubType == DI_CUSTOM) && (nNewType != SvNumFormatType::ALL) )
{
m_pFormatLB->SetDefFormat(nFormat);
}
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index d41cb9ee5b48..628b037b6077 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -325,14 +325,14 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
bool bFormat = nSize != 0;
bool bOneArea = false;
bool bFixed = false;
- sal_uInt16 nFormatType = 0;
+ SvNumFormatType nFormatType = SvNumFormatType::ALL;
switch (nTypeId)
{
case TYP_DATEFLD:
bFormat = bNumFormat = bOneArea = bOffset = true;
- nFormatType = css::util::NumberFormat::DATE;
+ nFormatType = SvNumFormatType::DATE;
m_pDateFT->Show();
@@ -346,7 +346,7 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
case TYP_TIMEFLD:
bFormat = bNumFormat = bOneArea = bOffset = true;
- nFormatType = css::util::NumberFormat::TIME;
+ nFormatType = SvNumFormatType::TIME;
m_pTimeFT->Show();
@@ -412,11 +412,11 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
{
m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
- if (m_pNumFormatLB->GetFormatType() == (css::util::NumberFormat::DATE|css::util::NumberFormat::TIME))
+ if (m_pNumFormatLB->GetFormatType() == (SvNumFormatType::DATE|SvNumFormatType::TIME))
{
// always set Format-Type because otherwise when date/time formats are combined,
// both formats would be displayed at the same time
- m_pNumFormatLB->SetFormatType(0);
+ m_pNumFormatLB->SetFormatType(SvNumFormatType::ALL);
m_pNumFormatLB->SetFormatType(nFormatType);
// set correct format once again
m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index 12400a2379dd..c4a7b6ffe580 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -735,7 +735,7 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
}
else if (nTypeId == TYP_GETFLD || nTypeId == TYP_FORMELFLD)
{
- m_pNumFormatLB->SetFormatType(css::util::NumberFormat::NUMBER);
+ m_pNumFormatLB->SetFormatType(SvNumFormatType::NUMBER);
}
}
else
@@ -743,7 +743,7 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
if (nOldNumFormat && nOldNumFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
m_pNumFormatLB->SetDefFormat(nOldNumFormat);
else
- m_pNumFormatLB->SetFormatType(css::util::NumberFormat::NUMBER);
+ m_pNumFormatLB->SetFormatType(SvNumFormatType::NUMBER);
}
}
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index a4e9080be0ed..e5b19273c717 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -690,7 +690,7 @@ MAKENUMSTR:
LanguageType eLng, eSys;
aCurData.GetBoxFormat(sal_uInt8(nNum)).GetValueFormat(sFormat, eLng, eSys);
- short nType;
+ SvNumFormatType nType;
bool bNew;
sal_Int32 nCheckPos;
sal_uInt32 nKey = pNumFormat->GetIndexPuttingAndConverting(sFormat, eLng,
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index e74c9ec12efc..1fa8dfcf07cb 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1823,25 +1823,25 @@ void SwFieldMgr::SetMacroPath(const OUString& rPath)
sal_uInt32 SwFieldMgr::GetDefaultFormat(sal_uInt16 nTypeId, bool bIsText, SvNumberFormatter* pFormatter)
{
- short nDefFormat;
+ SvNumFormatType nDefFormat;
switch (nTypeId)
{
case TYP_TIMEFLD:
case TYP_DATEFLD:
{
- nDefFormat = (nTypeId == TYP_DATEFLD) ? css::util::NumberFormat::DATE : css::util::NumberFormat::TIME;
+ nDefFormat = (nTypeId == TYP_DATEFLD) ? SvNumFormatType::DATE : SvNumFormatType::TIME;
}
break;
default:
if (bIsText)
{
- nDefFormat = css::util::NumberFormat::TEXT;
+ nDefFormat = SvNumFormatType::TEXT;
}
else
{
- nDefFormat = css::util::NumberFormat::ALL;
+ nDefFormat = SvNumFormatType::ALL;
}
break;
}
diff --git a/sw/source/uibase/inc/numfmtlb.hxx b/sw/source/uibase/inc/numfmtlb.hxx
index 220a44d8a1cc..1a392230a8d3 100644
--- a/sw/source/uibase/inc/numfmtlb.hxx
+++ b/sw/source/uibase/inc/numfmtlb.hxx
@@ -27,7 +27,8 @@ class SwView;
class SW_DLLPUBLIC NumFormatListBox : public ListBox
{
- short nCurrFormatType;
+ SvNumFormatType nCurrFormatType;
+ bool mbCurrFormatTypeNeedsInit;
sal_Int32 nStdEntry;
bool bOneArea;
sal_uInt32 nDefFormat;
@@ -38,7 +39,7 @@ class SW_DLLPUBLIC NumFormatListBox : public ListBox
DECL_DLLPRIVATE_LINK( SelectHdl, ListBox&, void );
- SAL_DLLPRIVATE static double GetDefValue(const short nFormatType);
+ SAL_DLLPRIVATE static double GetDefValue(const SvNumFormatType nFormatType);
SAL_DLLPRIVATE void Init();
public:
@@ -50,8 +51,8 @@ public:
void SetOneArea(bool bOnlyOne) { bOneArea = bOnlyOne; }
- void SetFormatType(const short nFormatType);
- short GetFormatType() const { return nCurrFormatType; }
+ void SetFormatType(const SvNumFormatType nFormatType);
+ SvNumFormatType GetFormatType() const { return nCurrFormatType; }
void SetDefFormat(const sal_uInt32 nDefFormat);
sal_uInt32 GetFormat() const;
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index c6e73aa8b2ce..17b3fba4a22b 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -1473,7 +1473,8 @@ void SwTableShell::ExecNumberFormat(SfxRequest const & rReq)
LanguageType eLang = rSh.GetCurLang();
SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
- sal_uInt16 nFormatType = 0, nOffset = 0;
+ SvNumFormatType nFormatType = SvNumFormatType::ALL;
+ sal_uInt16 nOffset = 0;
switch ( nSlot )
{
@@ -1487,22 +1488,22 @@ void SwTableShell::ExecNumberFormat(SfxRequest const & rReq)
{
// Re-enter
sal_Int32 nErrPos;
- short nType;
+ SvNumFormatType nType;
if( !pFormatter->PutEntry( aCode, nErrPos, nType,
nNumberFormat, eLang ))
nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
}
}
break;
- case FN_NUMBER_STANDARD: nFormatType = css::util::NumberFormat::NUMBER; break;
- case FN_NUMBER_SCIENTIFIC: nFormatType = css::util::NumberFormat::SCIENTIFIC; break;
- case FN_NUMBER_DATE: nFormatType = css::util::NumberFormat::DATE; break;
- case FN_NUMBER_TIME: nFormatType = css::util::NumberFormat::TIME; break;
- case FN_NUMBER_CURRENCY: nFormatType = css::util::NumberFormat::CURRENCY; break;
- case FN_NUMBER_PERCENT: nFormatType = css::util::NumberFormat::PERCENT; break;
+ case FN_NUMBER_STANDARD: nFormatType = SvNumFormatType::NUMBER; break;
+ case FN_NUMBER_SCIENTIFIC: nFormatType = SvNumFormatType::SCIENTIFIC; break;
+ case FN_NUMBER_DATE: nFormatType = SvNumFormatType::DATE; break;
+ case FN_NUMBER_TIME: nFormatType = SvNumFormatType::TIME; break;
+ case FN_NUMBER_CURRENCY: nFormatType = SvNumFormatType::CURRENCY; break;
+ case FN_NUMBER_PERCENT: nFormatType = SvNumFormatType::PERCENT; break;
case FN_NUMBER_TWODEC: // #.##0,00
- nFormatType = css::util::NumberFormat::NUMBER;
+ nFormatType = SvNumFormatType::NUMBER;
nOffset = NF_NUMBER_1000DEC2;
break;
@@ -1511,7 +1512,7 @@ void SwTableShell::ExecNumberFormat(SfxRequest const & rReq)
return;
}
- if( nFormatType )
+ if( nFormatType != SvNumFormatType::ALL )
nNumberFormat = pFormatter->GetStandardFormat( nFormatType, eLang ) + nOffset;
if( NUMBERFORMAT_ENTRY_NOT_FOUND != nNumberFormat )
diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx
index 04793affaaa5..c613f1d7213f 100644
--- a/sw/source/uibase/utlui/numfmtlb.cxx
+++ b/sw/source/uibase/utlui/numfmtlb.cxx
@@ -53,7 +53,8 @@ using namespace ::com::sun::star::lang;
NumFormatListBox::NumFormatListBox(vcl::Window* pWin, WinBits nStyle) :
ListBox ( pWin, nStyle ),
- nCurrFormatType (-1),
+ nCurrFormatType (SvNumFormatType::ALL),
+ mbCurrFormatTypeNeedsInit(true),
nStdEntry (0),
bOneArea (false),
nDefFormat (0),
@@ -91,7 +92,7 @@ void NumFormatListBox::Init()
else
eCurLanguage = SvtSysLocale().GetLanguageTag().getLanguageType();
- SetFormatType(css::util::NumberFormat::NUMBER);
+ SetFormatType(SvNumFormatType::NUMBER);
SetDefFormat(nDefFormat);
SetSelectHdl(LINK(this, NumFormatListBox, SelectHdl));
@@ -102,10 +103,10 @@ NumFormatListBox::~NumFormatListBox()
disposeOnce();
}
-void NumFormatListBox::SetFormatType(const short nFormatType)
+void NumFormatListBox::SetFormatType(const SvNumFormatType nFormatType)
{
- if (nCurrFormatType != -1 &&
- (nCurrFormatType & nFormatType) != 0) // there are mixed formats, like for example DateTime
+ if (!mbCurrFormatTypeNeedsInit &&
+ (nCurrFormatType & nFormatType)) // there are mixed formats, like for example DateTime
return;
SwView *pView = GetActiveView();
@@ -122,57 +123,57 @@ void NumFormatListBox::SetFormatType(const short nFormatType)
switch( nFormatType )
{
- case css::util::NumberFormat::NUMBER:
+ case SvNumFormatType::NUMBER:
eOffsetStart=NF_NUMBER_START;
eOffsetEnd=NF_NUMBER_END;
break;
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
eOffsetStart=NF_PERCENT_START;
eOffsetEnd=NF_PERCENT_END;
break;
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::CURRENCY:
eOffsetStart=NF_CURRENCY_START;
eOffsetEnd=NF_CURRENCY_END;
break;
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATETIME:
eOffsetStart=NF_DATE_START;
eOffsetEnd=NF_TIME_END;
break;
- case css::util::NumberFormat::DATE:
+ case SvNumFormatType::DATE:
eOffsetStart=NF_DATE_START;
eOffsetEnd=NF_DATE_END;
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
eOffsetStart=NF_TIME_START;
eOffsetEnd=NF_TIME_END;
break;
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
eOffsetStart=NF_SCIENTIFIC_START;
eOffsetEnd=NF_SCIENTIFIC_END;
break;
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::FRACTION:
eOffsetStart=NF_FRACTION_START;
eOffsetEnd=NF_FRACTION_END;
break;
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
eOffsetStart=NF_BOOLEAN;
eOffsetEnd=NF_BOOLEAN;
break;
- case css::util::NumberFormat::TEXT:
+ case SvNumFormatType::TEXT:
eOffsetStart=NF_TEXT;
eOffsetEnd=NF_TEXT;
break;
- case css::util::NumberFormat::ALL:
+ case SvNumFormatType::ALL:
eOffsetStart=NF_NUMERIC_START;
eOffsetEnd = NfIndexTableOffset( NF_INDEX_TABLE_ENTRIES - 1 );
break;
@@ -204,11 +205,11 @@ void NumFormatListBox::SetFormatType(const short nFormatType)
if( nFormat == pFormatter->GetFormatIndex( NF_NUMBER_STANDARD,
eCurLanguage )
|| const_cast<SvNumberformat*>(pFormat)->GetOutputString( fVal, sValue, &pCol )
- || nFormatType == css::util::NumberFormat::UNDEFINED )
+ || nFormatType == SvNumFormatType::UNDEFINED )
{
sValue = pFormat->GetFormatstring();
}
- else if( nFormatType == css::util::NumberFormat::TEXT )
+ else if( nFormatType == SvNumFormatType::TEXT )
{
pFormatter->GetOutputString( "\"ABC\"", nFormat, sValue, &pCol);
}
@@ -233,6 +234,7 @@ void NumFormatListBox::SetFormatType(const short nFormatType)
SelectEntryPos( nStdEntry );
nCurrFormatType = nFormatType;
+ mbCurrFormatTypeNeedsInit = false;
}
@@ -281,7 +283,7 @@ void NumFormatListBox::SetDefFormat(const sal_uInt32 nDefaultFormat)
SwWrtShell &rSh = pView->GetWrtShell();
SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
- short nType = pFormatter->GetType(nDefaultFormat);
+ SvNumFormatType nType = pFormatter->GetType(nDefaultFormat);
SetFormatType(nType);
@@ -302,7 +304,7 @@ void NumFormatListBox::SetDefFormat(const sal_uInt32 nDefaultFormat)
OUString sValue;
Color* pCol = nullptr;
- if (nType == css::util::NumberFormat::TEXT)
+ if (nType == SvNumFormatType::TEXT)
{
pFormatter->GetOutputString("\"ABC\"", nDefaultFormat, sValue, &pCol);
}
@@ -364,7 +366,7 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox&, rBox, void )
aCoreSet.Put( SvxNumberInfoItem( pFormatter, fValue,
SID_ATTR_NUMBERFORMAT_INFO ) );
- if( (css::util::NumberFormat::DATE | css::util::NumberFormat::TIME) & nCurrFormatType )
+ if( (SvNumFormatType::DATE | SvNumFormatType::TIME) & nCurrFormatType )
aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, bOneArea));
aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_NOLANGUAGE, !bShowLanguageControl));
@@ -411,35 +413,35 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox&, rBox, void )
}
-double NumFormatListBox::GetDefValue(const short nFormatType)
+double NumFormatListBox::GetDefValue(const SvNumFormatType nFormatType)
{
SvxNumValCategory nDefValue = SvxNumValCategory::Standard;
switch (nFormatType)
{
- case css::util::NumberFormat::DATE:
- case css::util::NumberFormat::DATE|css::util::NumberFormat::TIME:
+ case SvNumFormatType::DATE:
+ case SvNumFormatType::DATE|SvNumFormatType::TIME:
nDefValue = SvxNumValCategory::Date;
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
nDefValue = SvxNumValCategory::Time;
break;
- case css::util::NumberFormat::TEXT:
- case css::util::NumberFormat::UNDEFINED:
+ case SvNumFormatType::TEXT:
+ case SvNumFormatType::UNDEFINED:
nDefValue = SvxNumValCategory::Standard;
break;
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::CURRENCY:
nDefValue = SvxNumValCategory::Currency;
break;
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
nDefValue = SvxNumValCategory::Percent;
break;
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
nDefValue = SvxNumValCategory::Boolean;
break;
@@ -454,7 +456,8 @@ double NumFormatListBox::GetDefValue(const short nFormatType)
void NumFormatListBox::Clear()
{
ListBox::Clear();
- nCurrFormatType = -1;
+ mbCurrFormatTypeNeedsInit = true;
+ nCurrFormatType = SvNumFormatType::ALL;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
index 9f3aa12a725c..960945643e25 100644
--- a/uui/source/iahndl-ssl.cxx
+++ b/uui/source/iahndl-ssl.cxx
@@ -121,12 +121,12 @@ getLocalizedDatTimeStr(
Color* pColor = nullptr;
const Date& rNullDate = pNumberFormatter->GetNullDate();
sal_uInt32 nFormat
- = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::DATE, eUILang );
+ = pNumberFormatter->GetStandardFormat( SvNumFormatType::DATE, eUILang );
pNumberFormatter->GetOutputString( aDate - rNullDate, nFormat, aTmpStr, &pColor );
aDateTimeStr = aTmpStr + " ";
- nFormat = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::TIME, eUILang );
+ nFormat = pNumberFormatter->GetStandardFormat( SvNumFormatType::TIME, eUILang );
pNumberFormatter->GetOutputString(
aTime.GetTimeInDays(), nFormat, aTmpStr, &pColor );
aDateTimeStr += aTmpStr;
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index c2f1920e8bda..059bf8739600 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -1049,21 +1049,21 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
NfIndexTableOffset eBuiltIn = pFormatter->GetIndexTableOffset( nRealKey );
- short nFmtType = 0;
+ SvNumFormatType nFmtType = SvNumFormatType::ALL;
bool bThousand = false;
sal_uInt16 nPrecision = 0;
sal_uInt16 nLeading = 0;
rFormat.GetNumForInfo( nPart, nFmtType, bThousand, nPrecision, nLeading);
- nFmtType &= ~css::util::NumberFormat::DEFINED;
+ nFmtType &= ~SvNumFormatType::DEFINED;
// special treatment of builtin formats that aren't detected by normal parsing
// (the same formats that get the type set in SvNumberFormatter::ImpGenerateFormats)
if ( eBuiltIn == NF_NUMBER_STANDARD )
- nFmtType = css::util::NumberFormat::NUMBER;
+ nFmtType = SvNumFormatType::NUMBER;
else if ( eBuiltIn == NF_BOOLEAN )
- nFmtType = css::util::NumberFormat::LOGICAL;
+ nFmtType = SvNumFormatType::LOGICAL;
else if ( eBuiltIn == NF_TEXT )
- nFmtType = css::util::NumberFormat::TEXT;
+ nFmtType = SvNumFormatType::TEXT;
// #101606# An empty subformat is a valid number-style resulting in an
// empty display string for the condition of the subformat.
@@ -1075,42 +1075,43 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// not decide on any format type (and maybe could try harder?), but the
// resulting XMLTokenEnum should be something valid, so make that
// number-style.
- case css::util::NumberFormat::UNDEFINED:
+ case SvNumFormatType::UNDEFINED:
SAL_WARN("xmloff.style","UNDEFINED number format: '" << rFormat.GetFormatstring() << "'");
SAL_FALLTHROUGH;
// Type is 0 if a format contains no recognized elements
// (like text only) - this is handled as a number-style.
- case 0:
- case css::util::NumberFormat::EMPTY:
- case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::SCIENTIFIC:
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::ALL:
+ case SvNumFormatType::EMPTY:
+ case SvNumFormatType::NUMBER:
+ case SvNumFormatType::SCIENTIFIC:
+ case SvNumFormatType::FRACTION:
eType = XML_NUMBER_STYLE;
break;
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::PERCENT:
eType = XML_PERCENTAGE_STYLE;
break;
- case css::util::NumberFormat::CURRENCY:
+ case SvNumFormatType::CURRENCY:
eType = XML_CURRENCY_STYLE;
break;
- case css::util::NumberFormat::DATE:
- case css::util::NumberFormat::DATETIME:
+ case SvNumFormatType::DATE:
+ case SvNumFormatType::DATETIME:
eType = XML_DATE_STYLE;
break;
- case css::util::NumberFormat::TIME:
+ case SvNumFormatType::TIME:
eType = XML_TIME_STYLE;
break;
- case css::util::NumberFormat::TEXT:
+ case SvNumFormatType::TEXT:
eType = XML_TEXT_STYLE;
break;
- case css::util::NumberFormat::LOGICAL:
+ case SvNumFormatType::LOGICAL:
eType = XML_BOOLEAN_STYLE;
break;
+ default: break;
}
SAL_WARN_IF( eType == XML_TOKEN_INVALID, "xmloff.style", "unknown format type" );
OUString sAttrValue;
- bool bUserDef = ( rFormat.GetType() & css::util::NumberFormat::DEFINED );
+ bool bUserDef( rFormat.GetType() & SvNumFormatType::DEFINED );
// common attributes for format
@@ -1155,14 +1156,14 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
bool bLongSysDate = ( eBuiltIn == NF_DATE_SYSTEM_LONG );
// check if the format definition matches the key
- if ( bAutoOrder && ( nFmtType == css::util::NumberFormat::DATE || nFmtType == css::util::NumberFormat::DATETIME ) &&
+ if ( bAutoOrder && ( nFmtType == SvNumFormatType::DATE || nFmtType == SvNumFormatType::DATETIME ) &&
!lcl_IsDefaultDateFormat( rFormat, bSystemDate, eBuiltIn ) )
{
bAutoOrder = bSystemDate = bLongSysDate = false; // don't write automatic-order attribute then
}
if ( bAutoOrder &&
- ( nFmtType == css::util::NumberFormat::CURRENCY || nFmtType == css::util::NumberFormat::DATE || nFmtType == css::util::NumberFormat::DATETIME ) )
+ ( nFmtType == SvNumFormatType::CURRENCY || nFmtType == SvNumFormatType::DATE || nFmtType == SvNumFormatType::DATETIME ) )
{
// #85109# format type must be checked to avoid dtd errors if
// locale data contains other format types at the built-in positions
@@ -1172,7 +1173,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
}
if ( bSystemDate && bAutoOrder &&
- ( nFmtType == css::util::NumberFormat::DATE || nFmtType == css::util::NumberFormat::DATETIME ) )
+ ( nFmtType == SvNumFormatType::DATE || nFmtType == SvNumFormatType::DATETIME ) )
{
// #85109# format type must be checked to avoid dtd errors if
// locale data contains other format types at the built-in positions
@@ -1184,7 +1185,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// overflow for time formats as in [hh]:mm
// controlled by bThousand from number format info
// default for truncate-on-overflow is true
- if ( nFmtType == css::util::NumberFormat::TIME && bThousand )
+ if ( nFmtType == SvNumFormatType::TIME && bThousand )
{
rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TRUNCATE_ON_OVERFLOW,
XML_FALSE );
@@ -1331,9 +1332,9 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// collect strings for embedded-text (must be known before number element is written)
- bool bAllowEmbedded = ( nFmtType == 0 || nFmtType == css::util::NumberFormat::NUMBER ||
- nFmtType == css::util::NumberFormat::CURRENCY ||
- nFmtType == css::util::NumberFormat::PERCENT );
+ bool bAllowEmbedded = ( nFmtType == SvNumFormatType::ALL || nFmtType == SvNumFormatType::NUMBER ||
+ nFmtType == SvNumFormatType::CURRENCY ||
+ nFmtType == SvNumFormatType::PERCENT );
if ( bAllowEmbedded )
{
sal_Int32 nDigitsPassed = 0;
@@ -1418,7 +1419,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
// text is written as embedded-text child of the number,
// don't create a text element
}
- else if ( nFmtType == css::util::NumberFormat::CURRENCY && !bCurrFound && !bCurrencyWritten )
+ else if ( nFmtType == SvNumFormatType::CURRENCY && !bCurrFound && !bCurrencyWritten )
{
// automatic currency symbol is implemented as part of
// normal text -> search for the symbol
@@ -1482,10 +1483,10 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
{
// for type 0 (not recognized as a special type),
// write a "normal" number
- case 0:
- case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::PERCENT:
+ case SvNumFormatType::ALL:
+ case SvNumFormatType::NUMBER:
+ case SvNumFormatType::CURRENCY:
+ case SvNumFormatType::PERCENT:
{
// decimals
// only some built-in formats have automatic decimals
@@ -1518,14 +1519,14 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
bAnyContent = true;
}
break;
- case css::util::NumberFormat::SCIENTIFIC:
+ case SvNumFormatType::SCIENTIFIC:
// #i43959# for scientific numbers, count all integer symbols ("0" and "#")
// as integer digits: use nIntegerSymbols instead of nLeading
// nIntegerSymbols represents exponent interval (for engineering notation)
WriteScientificElement_Impl( nPrecision, nMinDecimals, nLeading, bThousand, nExpDigits, nIntegerSymbols, bExpSign );
bAnyContent = true;
break;
- case css::util::NumberFormat::FRACTION:
+ case SvNumFormatType::FRACTION:
{
sal_Int32 nInteger = nLeading;
if ( rFormat.GetNumForNumberElementCount( nPart ) == 3 )
@@ -1539,6 +1540,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt
bAnyContent = true;
}
break;
+ default: break;
}
bNumWritten = true;
@@ -1775,7 +1777,7 @@ void SvXMLNumFmtExport::ExportFormat_Impl( const SvNumberformat& rFormat, sal_uI
sal_uInt16 nUsedParts = 0;
for (sal_uInt16 nPart=0; nPart<XMLNUM_MAX_PARTS; ++nPart)
{
- if (rFormat.GetNumForInfoScannedType( nPart) != css::util::NumberFormat::UNDEFINED)
+ if (rFormat.GetNumForInfoScannedType( nPart) != SvNumFormatType::UNDEFINED)
{
bParts[nPart] = true;
nUsedParts = nPart + 1;
@@ -1847,7 +1849,7 @@ void SvXMLNumFmtExport::Export( bool bIsAutoStyle )
sal_uInt32 nDefaultIndex = 0;
SvNumberFormatTable& rTable = pFormatter->GetEntryTable(
- css::util::NumberFormat::DEFINED, nDefaultIndex, nLang );
+ SvNumFormatType::DEFINED, nDefaultIndex, nLang );
SvNumberFormatTable::iterator it2 = rTable.begin();
while (it2 != rTable.end())
{
@@ -1855,7 +1857,7 @@ void SvXMLNumFmtExport::Export( bool bIsAutoStyle )
pFormat = it2->second;
if (!pUsedList->IsUsed(nKey))
{
- DBG_ASSERT((pFormat->GetType() & css::util::NumberFormat::DEFINED), "a not user defined numberformat found");
+ DBG_ASSERT((pFormat->GetType() & SvNumFormatType::DEFINED), "a not user defined numberformat found");
sal_uInt32 nRealKey = nKey;
if (pFormat->IsSubstituted())
{
@@ -1928,7 +1930,7 @@ sal_uInt32 SvXMLNumFmtExport::ForceSystemLanguage( sal_uInt32 nKey )
SAL_WARN_IF( pFormatter == nullptr, "xmloff.style", "format without formatter?" );
sal_Int32 nErrorPos;
- short nType = pFormat->GetType();
+ SvNumFormatType nType = pFormat->GetType();
sal_uInt32 nNewKey = pFormatter->GetFormatForLanguageIfBuiltIn(
nKey, LANGUAGE_SYSTEM );
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index dbb4f30e0acf..772e2b63dad8 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -435,7 +435,7 @@ void SvXMLNumImpData::RemoveVolatileFormats()
if ( pObj->bRemoveAfterUse )
{
const SvNumberformat* pFormat = pFormatter->GetEntry(pObj->nKey);
- if (pFormat && (pFormat->GetType() & css::util::NumberFormat::DEFINED))
+ if (pFormat && (pFormat->GetType() & SvNumFormatType::DEFINED))
pFormatter->DeleteEntry( pObj->nKey );
}
}
@@ -1732,7 +1732,7 @@ sal_Int32 SvXMLNumFormatContext::CreateAndInsert(SvNumberFormatter* pFormatter)
if ( nIndex == NUMBERFORMAT_ENTRY_NOT_FOUND )
{
sal_Int32 nErrPos = 0;
- short l_nType = 0;
+ SvNumFormatType l_nType = SvNumFormatType::ALL;
bool bOk = pFormatter->PutEntry( aFormatStr, nErrPos, l_nType, nIndex, nFormatLang );
if ( !bOk && nErrPos == 0 && aFormatStr != sFormat )
{