summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basic/source/inc/runtime.hxx4
-rw-r--r--basic/source/runtime/runtime.cxx26
-rw-r--r--basic/source/sbx/sbxdate.cxx26
-rw-r--r--include/svl/zformat.hxx2
-rw-r--r--include/unotools/localedatawrapper.hxx23
-rw-r--r--svl/source/numbers/zforfind.cxx81
-rw-r--r--svl/source/numbers/zforfind.hxx6
-rw-r--r--svl/source/numbers/zforlist.cxx2
-rw-r--r--svl/source/numbers/zformat.cxx10
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx65
-rw-r--r--vcl/source/control/field2.cxx46
11 files changed, 147 insertions, 144 deletions
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index cf6d32a1e755..1b11dcd02ffe 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -142,7 +142,7 @@ class SbiInstance
std::unique_ptr<SvNumberFormatter> pNumberFormatter;
StarBASIC* pBasic;
LanguageType meFormatterLangType;
- DateFormat meFormatterDateFormat;
+ DateOrder meFormatterDateOrder;
sal_uInt32 nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx;
SbError nErr;
@@ -200,7 +200,7 @@ public:
// offer NumberFormatter also static
static SvNumberFormatter* PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx,
sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
- LanguageType* peFormatterLangType=nullptr, DateFormat* peFormatterDateFormat=nullptr );
+ LanguageType* peFormatterLangType=nullptr, DateOrder* peFormatterDateOrder=nullptr );
};
// There's one instance of this class for every executed sub-program.
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index a2cab4a629a5..5e4e5f299559 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -307,7 +307,7 @@ SbiInstance::SbiInstance( StarBASIC* p )
, pDdeCtrl(new SbiDdeControl)
, pBasic(p)
, meFormatterLangType(LANGUAGE_DONTKNOW)
- , meFormatterDateFormat(YMD)
+ , meFormatterDateOrder(DateOrder::YMD)
, nStdDateIdx(0)
, nStdTimeIdx(0)
, nStdDateTimeIdx(0)
@@ -363,21 +363,21 @@ SvNumberFormatter* SbiInstance::GetNumberFormatter()
{
LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType();
SvtSysLocale aSysLocale;
- DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
+ DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder();
if( pNumberFormatter )
{
if( eLangType != meFormatterLangType ||
- eDate != meFormatterDateFormat )
+ eDate != meFormatterDateOrder )
{
pNumberFormatter.reset(nullptr);
}
}
meFormatterLangType = eLangType;
- meFormatterDateFormat = eDate;
+ meFormatterDateOrder = eDate;
if( !pNumberFormatter )
{
pNumberFormatter.reset(PrepareNumberFormatter( nStdDateIdx, nStdTimeIdx, nStdDateTimeIdx,
- &meFormatterLangType, &meFormatterDateFormat ));
+ &meFormatterLangType, &meFormatterDateOrder ));
}
return pNumberFormatter.get();
}
@@ -385,7 +385,7 @@ SvNumberFormatter* SbiInstance::GetNumberFormatter()
// #39629 offer NumberFormatter static too
SvNumberFormatter* SbiInstance::PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx,
sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
- LanguageType* peFormatterLangType, DateFormat* peFormatterDateFormat )
+ LanguageType* peFormatterLangType, DateOrder* peFormatterDateOrder )
{
SvNumberFormatter* pNumberFormater = nullptr;
LanguageType eLangType;
@@ -397,15 +397,15 @@ SvNumberFormatter* SbiInstance::PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx
{
eLangType = Application::GetSettings().GetLanguageTag().getLanguageType();
}
- DateFormat eDate;
- if( peFormatterDateFormat )
+ DateOrder eDate;
+ if( peFormatterDateOrder )
{
- eDate = *peFormatterDateFormat;
+ eDate = *peFormatterDateOrder;
}
else
{
SvtSysLocale aSysLocale;
- eDate = aSysLocale.GetLocaleData().getDateFormat();
+ eDate = aSysLocale.GetLocaleData().getDateOrder();
}
pNumberFormater = new SvNumberFormatter( comphelper::getProcessComponentContext(), eLangType );
@@ -425,9 +425,9 @@ SvNumberFormatter* SbiInstance::PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx
switch( eDate )
{
default:
- case MDY: aDateStr = "MM/DD/YYYY"; break;
- case DMY: aDateStr = "DD/MM/YYYY"; break;
- case YMD: aDateStr = "YYYY/MM/DD"; break;
+ case DateOrder::MDY: aDateStr = "MM/DD/YYYY"; break;
+ case DateOrder::DMY: aDateStr = "DD/MM/YYYY"; break;
+ case DateOrder::YMD: aDateStr = "YYYY/MM/DD"; break;
}
OUString aStr( aDateStr ); // PutandConvertEntry() modifies string!
pNumberFormater->PutandConvertEntry( aStr, nCheckPos, nType,
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index 76b9c7306fa2..342aa0ef482c 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -116,14 +116,14 @@ double ImpGetDate( const SbxValues* p )
// quod vide basic/source/runtime/runtime.cxx
SvtSysLocale aSysLocale;
- DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
+ DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder();
OUString aDateStr;
switch( eDate )
{
default:
- case MDY: aDateStr = "MM/DD/YYYY"; break;
- case DMY: aDateStr = "DD/MM/YYYY"; break;
- case YMD: aDateStr = "YYYY/MM/DD"; break;
+ case DateOrder::MDY: aDateStr = "MM/DD/YYYY"; break;
+ case DateOrder::DMY: aDateStr = "DD/MM/YYYY"; break;
+ case DateOrder::YMD: aDateStr = "YYYY/MM/DD"; break;
}
OUString aStr = aDateStr + " HH:MM:SS";
@@ -275,7 +275,7 @@ start:
short nType;
SvtSysLocale aSysLocale;
- DateFormat eDate = aSysLocale.GetLocaleData().getDateFormat();
+ DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder();
OUString aStr;
// if the whole-number part is 0, we want no year!
if( n <= -1.0 || n >= 1.0 )
@@ -285,20 +285,20 @@ start:
{
switch( eDate )
{
- case MDY: aStr = "MM.TT.JJJJ"; break;
- case DMY: aStr = "TT.MM.JJJJ"; break;
- case YMD: aStr = "JJJJ.MM.TT"; break;
- default: aStr = "MM.TT.JJJJ";
+ case DateOrder::MDY: aStr = "MM.TT.JJJJ"; break;
+ case DateOrder::DMY: aStr = "TT.MM.JJJJ"; break;
+ case DateOrder::YMD: aStr = "JJJJ.MM.TT"; break;
+ default: aStr = "MM.TT.JJJJ";
}
}
else
{
switch( eDate )
{
- case MDY: aStr = "MM.TT.JJJJ HH:MM:SS"; break;
- case DMY: aStr = "TT.MM.JJJJ HH:MM:SS"; break;
- case YMD: aStr = "JJJJ.MM.TT HH:MM:SS"; break;
- default: aStr = "MM.TT.JJJJ HH:MM:SS";
+ case DateOrder::MDY: aStr = "MM.TT.JJJJ HH:MM:SS"; break;
+ case DateOrder::DMY: aStr = "TT.MM.JJJJ HH:MM:SS"; break;
+ case DateOrder::YMD: aStr = "JJJJ.MM.TT HH:MM:SS"; break;
+ default: aStr = "MM.TT.JJJJ HH:MM:SS";
}
}
}
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index d5086d7a7fc2..5d6a326e5970 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -387,7 +387,7 @@ public:
static sal_Int32 InsertBlanks( OUStringBuffer& r, sal_Int32 nPos, sal_Unicode c );
/// One of YMD,DMY,MDY if date format
- DateFormat GetDateOrder() const;
+ DateOrder GetDateOrder() const;
/** A coded value of the exact YMD combination used, if date format.
For example: YYYY-MM-DD => ('Y' << 16) | ('M' << 8) | 'D'
diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx
index fce96406ab7d..3a6ed7c3389a 100644
--- a/include/unotools/localedatawrapper.hxx
+++ b/include/unotools/localedatawrapper.hxx
@@ -39,10 +39,11 @@ class Date;
namespace tools { class Time; }
class CalendarWrapper;
-enum DateFormat {
- MDY,
+enum class DateOrder {
+ Invalid = -1,
+ MDY = 0,
DMY,
- YMD
+ YMD,
};
enum MeasurementSystem {
@@ -68,8 +69,8 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
OUString aReservedWord[css::i18n::reservedWords::COUNT];
OUString aCurrSymbol;
OUString aCurrBankSymbol;
- int nDateFormat;
- int nLongDateFormat;
+ DateOrder nDateOrder;
+ DateOrder nLongDateOrder;
sal_uInt16 nCurrPositiveFormat;
sal_uInt16 nCurrNegativeFormat;
sal_uInt16 nCurrDigits;
@@ -87,10 +88,10 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
void invalidateData();
void getOneLocaleItemImpl( sal_Int16 nItem );
- const OUString& getOneLocaleItem( sal_Int16 nItem ) const;
+ const OUString& getOneLocaleItem( sal_Int16 nItem ) const;
void getOneReservedWordImpl( sal_Int16 nWord );
- const OUString& getOneReservedWord( sal_Int16 nWord ) const;
+ const OUString& getOneReservedWord( sal_Int16 nWord ) const;
void getCurrSymbolsImpl();
void getCurrFormatsImpl();
@@ -100,8 +101,8 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
sal_Int32& nPar, sal_Int32& nNum,
sal_Int32& nBlank, sal_Int32& nSym );
- void getDateFormatsImpl();
- DateFormat scanDateFormatImpl( const OUString& rCode );
+ void getDateOrdersImpl();
+ DateOrder scanDateOrderImpl( const OUString& rCode );
void getDefaultCalendarImpl();
void getSecondaryCalendarImpl();
@@ -244,8 +245,8 @@ public:
sal_uInt16 getCurrDigits() const;
// simple date and time formatting
- DateFormat getDateFormat() const;
- DateFormat getLongDateFormat() const;
+ DateOrder getDateOrder() const;
+ DateOrder getLongDateOrder() const;
/// only numerical values of Gregorian calendar
OUString getDate( const Date& rDate ) const;
OUString getTime( const tools::Time& rTime, bool bSec = true,
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 9c257130373f..e9c7fabb4405 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1039,7 +1039,7 @@ bool ImpSvNumberInputScan::MayBeIso8601()
}
-bool ImpSvNumberInputScan::CanForceToIso8601( DateFormat eDateFormat )
+bool ImpSvNumberInputScan::CanForceToIso8601( DateOrder eDateOrder )
{
if (nCanForceToIso8601 == 0)
{
@@ -1058,23 +1058,24 @@ bool ImpSvNumberInputScan::CanForceToIso8601( DateFormat eDateFormat )
}
sal_Int32 n;
- switch (eDateFormat)
+ switch (eDateOrder)
{
- case DMY: // "day" value out of range => ISO 8601 year
+ case DateOrder::DMY: // "day" value out of range => ISO 8601 year
if ((n = sStrArray[nNums[0]].toInt32()) < 1 || n > 31)
{
nCanForceToIso8601 = 2;
}
break;
- case MDY: // "month" value out of range => ISO 8601 year
+ case DateOrder::MDY: // "month" value out of range => ISO 8601 year
if ((n = sStrArray[nNums[0]].toInt32()) < 1 || n > 12)
{
nCanForceToIso8601 = 2;
}
break;
- case YMD: // always possible
+ case DateOrder::YMD: // always possible
nCanForceToIso8601 = 2;
break;
+ default: break;
}
}
return nCanForceToIso8601 > 1;
@@ -1381,31 +1382,31 @@ sal_uInt32 ImpSvNumberInputScan::GetDatePatternOrder()
}
-DateFormat ImpSvNumberInputScan::GetDateOrder()
+DateOrder ImpSvNumberInputScan::GetDateOrder()
{
sal_uInt32 nOrder = GetDatePatternOrder();
if (!nOrder)
{
- return pFormatter->GetLocaleData()->getDateFormat();
+ return pFormatter->GetLocaleData()->getDateOrder();
}
switch ((nOrder & 0xff0000) >> 16)
{
case 'Y':
if ((((nOrder & 0xff00) >> 8) == 'M') && ((nOrder & 0xff) == 'D'))
{
- return YMD;
+ return DateOrder::YMD;
}
break;
case 'M':
if ((((nOrder & 0xff00) >> 8) == 'D') && ((nOrder & 0xff) == 'Y'))
{
- return MDY;
+ return DateOrder::MDY;
}
break;
case 'D':
if ((((nOrder & 0xff00) >> 8) == 'M') && ((nOrder & 0xff) == 'Y'))
{
- return DMY;
+ return DateOrder::DMY;
}
break;
default:
@@ -1416,25 +1417,25 @@ DateFormat ImpSvNumberInputScan::GetDateOrder()
switch ((nOrder & 0xff))
{
case 'M':
- return YMD;
+ return DateOrder::YMD;
}
break;
case 'M':
switch ((nOrder & 0xff))
{
case 'Y':
- return DMY;
+ return DateOrder::DMY;
case 'D':
- return MDY;
+ return DateOrder::MDY;
}
break;
case 'D':
switch ((nOrder & 0xff))
{
case 'Y':
- return MDY;
+ return DateOrder::MDY;
case 'M':
- return DMY;
+ return DateOrder::DMY;
}
break;
default:
@@ -1442,17 +1443,17 @@ DateFormat ImpSvNumberInputScan::GetDateOrder()
switch ((nOrder & 0xff))
{
case 'Y':
- return YMD;
+ return DateOrder::YMD;
case 'M':
- return MDY;
+ return DateOrder::MDY;
case 'D':
- return DMY;
+ return DateOrder::DMY;
}
break;
}
}
SAL_WARN( "svl.numbers", "ImpSvNumberInputScan::GetDateOrder: undefined, falling back to locale's default");
- return pFormatter->GetLocaleData()->getDateFormat();
+ return pFormatter->GetLocaleData()->getDateOrder();
}
bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter,
@@ -1492,7 +1493,7 @@ bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter,
{
pCal->setGregorianDateTime( Date( Date::SYSTEM ) ); // today
OUString aOrgCalendar; // empty => not changed yet
- DateFormat DateFmt;
+ DateOrder DateFmt;
bool bFormatTurn;
switch ( eEDF )
{
@@ -1530,7 +1531,7 @@ bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter,
break;
default:
SAL_WARN( "svl.numbers", "ImpSvNumberInputScan::GetDateRef: unknown NfEvalDateFormat" );
- DateFmt = YMD;
+ DateFmt = DateOrder::YMD;
bFormatTurn = false;
}
if ( bFormatTurn )
@@ -1625,8 +1626,8 @@ input for the following reasons:
pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 );
switch (DateFmt)
{
- case MDY:
- case YMD:
+ case DateOrder::MDY:
+ case DateOrder::YMD:
{
sal_uInt16 nDay = ImplGetDay(0);
sal_uInt16 nYear = ImplGetYear(0);
@@ -1640,7 +1641,7 @@ input for the following reasons:
}
break;
}
- case DMY:
+ case DateOrder::DMY:
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
break;
default:
@@ -1652,10 +1653,10 @@ input for the following reasons:
pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 );
switch (DateFmt)
{
- case DMY:
+ case DateOrder::DMY:
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
break;
- case YMD:
+ case DateOrder::YMD:
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
break;
default:
@@ -1739,7 +1740,7 @@ input for the following reasons:
}
switch (DateFmt)
{
- case MDY:
+ case DateOrder::MDY:
// M D
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
@@ -1750,7 +1751,7 @@ input for the following reasons:
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
}
break;
- case DMY:
+ case DateOrder::DMY:
// D M
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) );
@@ -1761,7 +1762,7 @@ input for the following reasons:
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
}
break;
- case YMD:
+ case DateOrder::YMD:
// M D
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
@@ -1801,14 +1802,14 @@ input for the following reasons:
case 2: // month in the middle (10 Jan 94)
{
pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 );
- DateFormat eDF = (MayBeMonthDate() ? (nMayBeMonthDate == 2 ? DMY : YMD) : DateFmt);
+ DateOrder eDF = (MayBeMonthDate() ? (nMayBeMonthDate == 2 ? DateOrder::DMY : DateOrder::YMD) : DateFmt);
switch (eDF)
{
- case DMY:
+ case DateOrder::DMY:
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
break;
- case YMD:
+ case DateOrder::YMD:
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
break;
@@ -1842,22 +1843,22 @@ input for the following reasons:
}
}
// ISO 8601 yyyy-mm-dd forced recognition
- DateFormat eDF = (CanForceToIso8601( DateFmt) ? YMD : DateFmt);
+ DateOrder eDF = (CanForceToIso8601( DateFmt) ? DateOrder::YMD : DateFmt);
switch (eDF)
{
- case MDY:
+ case DateOrder::MDY:
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
if ( nCounter > 2 )
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(2) );
break;
- case DMY:
+ case DateOrder::DMY:
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) );
if ( nCounter > 2 )
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(2) );
break;
- case YMD:
+ case DateOrder::YMD:
if ( nCounter > 2 )
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(2) );
pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) );
@@ -1873,7 +1874,7 @@ input for the following reasons:
nCounter = 2;
switch (DateFmt)
{
- case MDY:
+ case DateOrder::MDY:
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 );
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
@@ -1888,11 +1889,11 @@ input for the following reasons:
pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 );
switch (DateFmt)
{
- case DMY:
+ case DateOrder::DMY:
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
break;
- case YMD:
+ case DateOrder::YMD:
pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
break;
@@ -2446,7 +2447,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString,
switch (eScannedType)
{
case css::util::NumberFormat::DATE:
- if (nMonthPos == 1 && pLoc->getLongDateFormat() == MDY)
+ if (nMonthPos == 1 && pLoc->getLongDateOrder() == DateOrder::MDY)
{
// #68232# recognize long date separators like ", " in "September 5, 1999"
if (SkipString( pLoc->getLongDateDaySep(), rString, nPos ))
diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx
index cedda8c7d73d..e7d0be0d9acf 100644
--- a/svl/source/numbers/zforfind.hxx
+++ b/svl/source/numbers/zforfind.hxx
@@ -62,13 +62,13 @@ public:
Depends on locale's date separator and a specific date format order.
- @param eDateFormat
+ @param eDateOrder
Evaluated only on first call during one scan process, subsequent
calls return state of nCanForceToIso8601!
@see nCanForceToIso8601
*/
- bool CanForceToIso8601( DateFormat eDateFormat );
+ bool CanForceToIso8601( DateOrder eDateOrder );
void InvalidateDateAcceptancePatterns();
@@ -402,7 +402,7 @@ private:
/** Obtain date format order, from accepted date pattern if available or
otherwise the locale's default order.
*/
- DateFormat GetDateOrder();
+ DateOrder GetDateOrder();
/** Whether input may be an ISO 8601 date format, yyyy-mm-dd...
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 086b02fe490d..e2284f83782d 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1105,7 +1105,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
{
case css::util::NumberFormat::DATE :
// Preserve ISO 8601 input.
- if (pStringScanner->CanForceToIso8601( DMY))
+ if (pStringScanner->CanForceToIso8601( DateOrder::DMY))
{
F_Index = GetFormatIndex( NF_DATE_DIN_YYYYMMDD, ActLnge );
}
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 80841f320f16..b180eb384bee 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -4789,7 +4789,7 @@ bool SvNumberformat::HasPositiveBracketPlaceholder() const
return tmpStr[nAnz-1] == "_)";
}
-DateFormat SvNumberformat::GetDateOrder() const
+DateOrder SvNumberformat::GetDateOrder() const
{
if ( (eType & css::util::NumberFormat::DATE) == css::util::NumberFormat::DATE )
{
@@ -4801,20 +4801,20 @@ DateFormat SvNumberformat::GetDateOrder() const
{
case NF_KEY_D :
case NF_KEY_DD :
- return DMY;
+ return DateOrder::DMY;
case NF_KEY_M :
case NF_KEY_MM :
case NF_KEY_MMM :
case NF_KEY_MMMM :
case NF_KEY_MMMMM :
- return MDY;
+ return DateOrder::MDY;
case NF_KEY_YY :
case NF_KEY_YYYY :
case NF_KEY_EC :
case NF_KEY_EEC :
case NF_KEY_R :
case NF_KEY_RR :
- return YMD;
+ return DateOrder::YMD;
}
}
}
@@ -4822,7 +4822,7 @@ DateFormat SvNumberformat::GetDateOrder() const
{
SAL_WARN( "svl.numbers", "SvNumberformat::GetDateOrder: no date" );
}
- return rLoc().getDateFormat();
+ return rLoc().getDateOrder();
}
sal_uInt32 SvNumberformat::GetExactDateOrder() const
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 56f73b94ef94..477794e23667 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -42,7 +42,6 @@
#include <osl/diagnose.h>
#include <sal/macros.h>
-static const int nDateFormatInvalid = -1;
static const sal_uInt16 nCurrFormatInvalid = 0xffff;
static const sal_uInt16 nCurrFormatDefault = 0;
@@ -136,7 +135,7 @@ void LocaleDataWrapper::invalidateData()
{
aCurrSymbol.clear();
aCurrBankSymbol.clear();
- nDateFormat = nLongDateFormat = nDateFormatInvalid;
+ nDateOrder = nLongDateOrder = DateOrder::Invalid;
nCurrPositiveFormat = nCurrNegativeFormat = nCurrDigits = nCurrFormatInvalid;
if ( bLocaleDataItemValid )
{
@@ -890,29 +889,29 @@ void LocaleDataWrapper::getCurrFormatsImpl()
// --- date -----------------------------------------------------------
-DateFormat LocaleDataWrapper::getDateFormat() const
+DateOrder LocaleDataWrapper::getDateOrder() const
{
::utl::ReadWriteGuard aGuard( aMutex );
- if ( nDateFormat == nDateFormatInvalid )
+ if ( nDateOrder == DateOrder::Invalid )
{
aGuard.changeReadToWrite();
- const_cast<LocaleDataWrapper*>(this)->getDateFormatsImpl();
+ const_cast<LocaleDataWrapper*>(this)->getDateOrdersImpl();
}
- return (DateFormat) nDateFormat;
+ return (DateOrder) nDateOrder;
}
-DateFormat LocaleDataWrapper::getLongDateFormat() const
+DateOrder LocaleDataWrapper::getLongDateOrder() const
{
::utl::ReadWriteGuard aGuard( aMutex );
- if ( nLongDateFormat == nDateFormatInvalid )
+ if ( nLongDateOrder == DateOrder::Invalid )
{
aGuard.changeReadToWrite();
- const_cast<LocaleDataWrapper*>(this)->getDateFormatsImpl();
+ const_cast<LocaleDataWrapper*>(this)->getDateOrdersImpl();
}
- return (DateFormat) nLongDateFormat;
+ return (DateOrder) nLongDateOrder;
}
-DateFormat LocaleDataWrapper::scanDateFormatImpl( const OUString& rCode )
+DateOrder LocaleDataWrapper::scanDateOrderImpl( const OUString& rCode )
{
// Only some european versions were translated, the ones with different
// keyword combinations are:
@@ -964,7 +963,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const OUString& rCode )
{
if (areChecksEnabled())
{
- OUString aMsg( "LocaleDataWrapper::scanDateFormat: not all DMY present" );
+ OUString aMsg( "LocaleDataWrapper::scanDateOrder: not all DMY present" );
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
if (nDay == -1)
@@ -977,23 +976,23 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const OUString& rCode )
}
// compare with <= because each position may equal rCode.getLength()
if ( nDay <= nMonth && nMonth <= nYear )
- return DMY; // also if every position equals rCode.getLength()
+ return DateOrder::DMY; // also if every position equals rCode.getLength()
else if ( nMonth <= nDay && nDay <= nYear )
- return MDY;
+ return DateOrder::MDY;
else if ( nYear <= nMonth && nMonth <= nDay )
- return YMD;
+ return DateOrder::YMD;
else
{
if (areChecksEnabled())
{
- OUString aMsg( "LocaleDataWrapper::scanDateFormat: no magic applicable" );
+ OUString aMsg( "LocaleDataWrapper::scanDateOrder: no magic applicable" );
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
- return DMY;
+ return DateOrder::DMY;
}
}
-void LocaleDataWrapper::getDateFormatsImpl()
+void LocaleDataWrapper::getDateOrdersImpl()
{
css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( m_xContext );
uno::Sequence< NumberFormatCode > aFormatSeq = xNFC->getAllFormatCode( KNumberFormatUsage::DATE, getMyLocale() );
@@ -1002,10 +1001,10 @@ void LocaleDataWrapper::getDateFormatsImpl()
{ // bad luck
if (areChecksEnabled())
{
- OUString aMsg( "LocaleDataWrapper::getDateFormatsImpl: no date formats" );
+ OUString aMsg( "LocaleDataWrapper::getDateOrdersImpl: no date formats" );
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
- nDateFormat = nLongDateFormat = DMY;
+ nDateOrder = nLongDateOrder = DateOrder::DMY;
return;
}
// find the edit (21), a default (medium preferred),
@@ -1046,14 +1045,14 @@ void LocaleDataWrapper::getDateFormatsImpl()
{
if (areChecksEnabled())
{
- OUString aMsg( "LocaleDataWrapper::getDateFormatsImpl: no edit" );
+ OUString aMsg( "LocaleDataWrapper::getDateOrdersImpl: no edit" );
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
if ( nDef == -1 )
{
if (areChecksEnabled())
{
- OUString aMsg( "LocaleDataWrapper::getDateFormatsImpl: no default" );
+ OUString aMsg( "LocaleDataWrapper::getDateOrdersImpl: no default" );
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
if ( nMedium != -1 )
@@ -1065,18 +1064,18 @@ void LocaleDataWrapper::getDateFormatsImpl()
}
nEdit = nDef;
}
- DateFormat nDF = scanDateFormatImpl( pFormatArr[nEdit].Code );
+ DateOrder nDF = scanDateOrderImpl( pFormatArr[nEdit].Code );
if ( pFormatArr[nEdit].Type == KNumberFormatType::LONG )
{ // normally this is not the case
- nLongDateFormat = nDateFormat = nDF;
+ nLongDateOrder = nDateOrder = nDF;
}
else
{
- nDateFormat = nDF;
+ nDateOrder = nDF;
if ( nLong == -1 )
- nLongDateFormat = nDF;
+ nLongDateOrder = nDF;
else
- nLongDateFormat = scanDateFormatImpl( pFormatArr[nLong].Code );
+ nLongDateOrder = scanDateOrderImpl( pFormatArr[nLong].Code );
}
}
@@ -1400,16 +1399,16 @@ OUString LocaleDataWrapper::getDate( const Date& rDate ) const
nYear %= 100;
}
- switch ( getDateFormat() )
+ switch ( getDateOrder() )
{
- case DMY :
+ case DateOrder::DMY :
pBuf = ImplAdd2UNum( pBuf, nDay, true /* IsDateDayLeadingZero() */ );
pBuf = ImplAddString( pBuf, getDateSep() );
pBuf = ImplAdd2UNum( pBuf, nMonth, true /* IsDateMonthLeadingZero() */ );
pBuf = ImplAddString( pBuf, getDateSep() );
pBuf = ImplAddNum( pBuf, nYear, nYearLen );
break;
- case MDY :
+ case DateOrder::MDY :
pBuf = ImplAdd2UNum( pBuf, nMonth, true /* IsDateMonthLeadingZero() */ );
pBuf = ImplAddString( pBuf, getDateSep() );
pBuf = ImplAdd2UNum( pBuf, nDay, true /* IsDateDayLeadingZero() */ );
@@ -1484,12 +1483,12 @@ OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCa
pBuf = ImplAddUNum( aBuf, nVal );
OUString aYear(aBuf, pBuf-aBuf);
// concatenate
- switch ( getLongDateFormat() )
+ switch ( getLongDateOrder() )
{
- case DMY :
+ case DateOrder::DMY :
aStr += aDay + getLongDateDaySep() + aMonth + getLongDateMonthSep() + aYear;
break;
- case MDY :
+ case DateOrder::MDY :
aStr += aMonth + getLongDateMonthSep() + aDay + getLongDateDaySep() + aYear;
break;
default: // YMD
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index dd7acf7aeae1..ff5897737313 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -939,13 +939,13 @@ void PatternBox::ReformatAll()
SetUpdateMode( true );
}
-static ExtDateFieldFormat ImplGetExtFormat( DateFormat eOld )
+static ExtDateFieldFormat ImplGetExtFormat( DateOrder eOld )
{
switch( eOld )
{
- case DMY: return ExtDateFieldFormat::ShortDDMMYY;
- case MDY: return ExtDateFieldFormat::ShortMMDDYY;
- default: return ExtDateFieldFormat::ShortYYMMDD;
+ case DateOrder::DMY: return ExtDateFieldFormat::ShortDDMMYY;
+ case DateOrder::MDY: return ExtDateFieldFormat::ShortMMDDYY;
+ default: return ExtDateFieldFormat::ShortYYMMDD;
}
}
@@ -1012,7 +1012,7 @@ static bool ImplDateProcessKeyInput( Edit*, const KeyEvent& rKEvt, ExtDateFieldF
return true;
}
-static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFormat eDateFormat,
+static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFormat eDateOrder,
const LocaleDataWrapper& rLocaleDataWrapper, const CalendarWrapper& rCalendarWrapper,
const AllSettings& )
{
@@ -1022,22 +1022,22 @@ static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFor
bool bError = false;
OUString aStr( rStr );
- if ( eDateFormat == ExtDateFieldFormat::SystemLong )
+ if ( eDateOrder == ExtDateFieldFormat::SystemLong )
{
- DateFormat eFormat = rLocaleDataWrapper.getLongDateFormat();
+ DateOrder eFormat = rLocaleDataWrapper.getLongDateOrder();
switch( eFormat )
{
- case MDY:
+ case DateOrder::MDY:
nMonth = ImplCutMonthFromString( aStr, rCalendarWrapper );
nDay = ImplCutNumberFromString( aStr );
nYear = ImplCutNumberFromString( aStr );
break;
- case DMY:
+ case DateOrder::DMY:
nDay = ImplCutNumberFromString( aStr );
nMonth = ImplCutMonthFromString( aStr, rCalendarWrapper );
nYear = ImplCutNumberFromString( aStr );
break;
- case YMD:
+ case DateOrder::YMD:
default:
nYear = ImplCutNumberFromString( aStr );
nMonth = ImplCutMonthFromString( aStr, rCalendarWrapper );
@@ -1050,7 +1050,7 @@ static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFor
bool bYear = true;
// Check if year is present:
- OUString aDateSep = ImplGetDateSep( rLocaleDataWrapper, eDateFormat );
+ OUString aDateSep = ImplGetDateSep( rLocaleDataWrapper, eDateOrder );
sal_Int32 nSepPos = aStr.indexOf( aDateSep );
if ( nSepPos < 0 )
return false;
@@ -1064,7 +1064,7 @@ static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFor
const sal_Unicode* pBuf = aStr.getStr();
ImplSkipDelimiters( pBuf );
- switch ( eDateFormat )
+ switch ( eDateOrder )
{
case ExtDateFieldFormat::ShortDDMMYY:
case ExtDateFieldFormat::ShortDDMMYYYY:
@@ -1104,7 +1104,7 @@ static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFor
default:
{
- OSL_FAIL( "DateFormat???" );
+ OSL_FAIL( "DateOrder???" );
}
}
}
@@ -1224,7 +1224,7 @@ OUString DateFormatter::ImplGetDateAsText( const Date& rDate,
break;
default:
{
- OSL_FAIL( "DateFormat???" );
+ OSL_FAIL( "DateOrder???" );
}
}
@@ -1340,7 +1340,7 @@ void DateField::ImplDateSpinArea( bool bUp )
ExtDateFieldFormat eFormat = GetExtDateFormat( true );
if ( eFormat == ExtDateFieldFormat::SystemLong )
{
- eFormat = ImplGetExtFormat( ImplGetLocaleDataWrapper().getLongDateFormat() );
+ eFormat = ImplGetExtFormat( ImplGetLocaleDataWrapper().getLongDateOrder() );
nDateArea = 1;
}
else
@@ -1467,14 +1467,16 @@ ExtDateFieldFormat DateFormatter::GetExtDateFormat( bool bResolveSystemFormat )
if ( bResolveSystemFormat && ( eDateFormat <= ExtDateFieldFormat::SystemShortYYYY ) )
{
bool bShowCentury = (eDateFormat == ExtDateFieldFormat::SystemShortYYYY);
- switch ( ImplGetLocaleDataWrapper().getDateFormat() )
+ switch ( ImplGetLocaleDataWrapper().getDateOrder() )
{
- case DMY: eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortDDMMYYYY : ExtDateFieldFormat::ShortDDMMYY;
- break;
- case MDY: eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortMMDDYYYY : ExtDateFieldFormat::ShortMMDDYY;
- break;
- default: eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortYYYYMMDD : ExtDateFieldFormat::ShortYYMMDD;
-
+ case DateOrder::DMY:
+ eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortDDMMYYYY : ExtDateFieldFormat::ShortDDMMYY;
+ break;
+ case DateOrder::MDY:
+ eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortMMDDYYYY : ExtDateFieldFormat::ShortMMDDYY;
+ break;
+ default:
+ eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortYYYYMMDD : ExtDateFieldFormat::ShortYYMMDD;
}
}