Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
b0aaaeb7
Kaydet (Commit)
b0aaaeb7
authored
Ara 22, 2011
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
recognize arbitrary y-m-d format for editing as ISO 8601 yyyy-mm-dd
üst
f31656f1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
8 deletions
+91
-8
zforlist.hxx
svl/inc/svl/zforlist.hxx
+2
-1
zformat.hxx
svl/inc/svl/zformat.hxx
+16
-4
zforlist.cxx
svl/source/numbers/zforlist.cxx
+5
-3
zformat.cxx
svl/source/numbers/zformat.cxx
+68
-0
No files found.
svl/inc/svl/zforlist.hxx
Dosyayı görüntüle @
b0aaaeb7
...
...
@@ -596,7 +596,8 @@ public:
bool
IsSpecialStandardFormat
(
sal_uInt32
nFIndex
,
LanguageType
eLnge
);
/** Return the corresponding edit format of a format. */
sal_uInt32
GetEditFormat
(
double
fNumber
,
sal_uInt32
nFIndex
,
short
eType
,
LanguageType
eLnge
);
sal_uInt32
GetEditFormat
(
double
fNumber
,
sal_uInt32
nFIndex
,
short
eType
,
LanguageType
eLnge
,
SvNumberformat
*
pFormat
);
/// Return the reference date
Date
*
GetNullDate
();
...
...
svl/inc/svl/zformat.hxx
Dosyayı görüntüle @
b0aaaeb7
...
...
@@ -456,6 +456,15 @@ public:
return
false
;
}
#endif
/// Whether it's a (YY)YY-M(M)-D(D) format.
bool
IsIso8601
(
sal_uInt16
nNumFor
)
{
if
(
nNumFor
<
4
)
return
ImpIsIso8601
(
NumFor
[
nNumFor
]);
return
false
;
}
private
:
ImpSvNumFor
NumFor
[
4
];
// Array for the 4 subformats
String
sFormatstring
;
// The format code string
...
...
@@ -476,6 +485,11 @@ private:
SVL_DLLPRIVATE
bool
ImpIsOtherCalendar
(
const
ImpSvNumFor
&
rNumFor
)
const
;
#ifdef THE_FUTURE
SVL_DLLPRIVATE
bool
ImpSwitchToSpecifiedCalendar
(
String
&
rOrgCalendar
,
double
&
fOrgDateTime
,
const
ImpSvNumFor
&
rNumFor
)
const
;
#endif
/** Whether to use possessive genitive case month name, or partitive case
month name, instead of nominative name (noun).
...
...
@@ -496,10 +510,8 @@ private:
*/
SVL_DLLPRIVATE
sal_Int32
ImpUseMonthCase
(
int
&
io_nState
,
const
ImpSvNumFor
&
rNumFor
,
NfKeywordIndex
eCodeType
)
const
;
#ifdef THE_FUTURE
SVL_DLLPRIVATE
bool
ImpSwitchToSpecifiedCalendar
(
String
&
rOrgCalendar
,
double
&
fOrgDateTime
,
const
ImpSvNumFor
&
rNumFor
)
const
;
#endif
/// Whether it's a (YY)YY-M(M)-D(D) format.
SVL_DLLPRIVATE
bool
ImpIsIso8601
(
const
ImpSvNumFor
&
rNumFor
);
#ifdef _ZFORMAT_CXX // ----- private implementation methods -----
...
...
svl/source/numbers/zforlist.cxx
Dosyayı görüntüle @
b0aaaeb7
...
...
@@ -1437,7 +1437,8 @@ sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIn
}
}
sal_uInt32
SvNumberFormatter
::
GetEditFormat
(
double
fNumber
,
sal_uInt32
nFIndex
,
short
eType
,
LanguageType
eLang
)
sal_uInt32
SvNumberFormatter
::
GetEditFormat
(
double
fNumber
,
sal_uInt32
nFIndex
,
short
eType
,
LanguageType
eLang
,
SvNumberformat
*
pFormat
)
{
sal_uInt32
nKey
=
nFIndex
;
switch
(
eType
)
...
...
@@ -1456,7 +1457,8 @@ sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex,
// Preserve ISO 8601 format.
if
(
nFIndex
==
GetFormatIndex
(
NF_DATE_DIN_YYYYMMDD
,
eLang
)
||
nFIndex
==
GetFormatIndex
(
NF_DATE_DIN_YYMMDD
,
eLang
)
||
nFIndex
==
GetFormatIndex
(
NF_DATE_DIN_MMDD
,
eLang
))
nFIndex
==
GetFormatIndex
(
NF_DATE_DIN_MMDD
,
eLang
)
||
(
pFormat
&&
pFormat
->
IsIso8601
(
0
)))
nKey
=
GetFormatIndex
(
NF_DATE_DIN_YYYYMMDD
,
eLang
);
else
nKey
=
GetFormatIndex
(
NF_DATE_SYS_DDMMYYYY
,
eLang
);
...
...
@@ -1517,7 +1519,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
ChangeStandardPrec
(
INPUTSTRING_PRECISION
);
bPrecChanged
=
true
;
}
sal_uInt32
nKey
=
GetEditFormat
(
fOutNumber
,
nFIndex
,
eType
,
eLang
);
sal_uInt32
nKey
=
GetEditFormat
(
fOutNumber
,
nFIndex
,
eType
,
eLang
,
pFormat
);
if
(
nKey
!=
nFIndex
)
pFormat
=
(
SvNumberformat
*
)
aFTable
.
Get
(
nKey
);
if
(
pFormat
)
...
...
svl/source/numbers/zformat.cxx
Dosyayı görüntüle @
b0aaaeb7
...
...
@@ -3195,6 +3195,74 @@ void SvNumberformat::ImpAppendEraG( String& OutString,
OutString
+=
rCal
.
getDisplayString
(
CalendarDisplayCode
::
SHORT_ERA
,
nNatNum
);
}
bool
SvNumberformat
::
ImpIsIso8601
(
const
ImpSvNumFor
&
rNumFor
)
{
bool
bIsIso
=
false
;
if
((
eType
&
NUMBERFORMAT_DATE
)
==
NUMBERFORMAT_DATE
)
{
enum
State
{
eNone
,
eAtYear
,
eAtSep1
,
eAtMonth
,
eAtSep2
,
eNotIso
};
State
eState
=
eNone
;
short
const
*
const
pType
=
rNumFor
.
Info
().
nTypeArray
;
sal_uInt16
nAnz
=
rNumFor
.
GetCount
();
for
(
sal_uInt16
i
=
0
;
i
<
nAnz
&&
!
bIsIso
&&
eState
!=
eNotIso
;
++
i
)
{
switch
(
pType
[
i
]
)
{
case
NF_KEY_YY
:
// two digits not strictly ISO 8601
case
NF_KEY_YYYY
:
if
(
eState
!=
eNone
)
eState
=
eNotIso
;
else
eState
=
eAtYear
;
break
;
case
NF_KEY_M
:
// single digit not strictly ISO 8601
case
NF_KEY_MM
:
if
(
eState
!=
eAtSep1
)
eState
=
eNotIso
;
else
eState
=
eAtMonth
;
break
;
case
NF_KEY_D
:
// single digit not strictly ISO 8601
case
NF_KEY_DD
:
if
(
eState
!=
eAtSep2
)
eState
=
eNotIso
;
else
bIsIso
=
true
;
break
;
case
NF_SYMBOLTYPE_STRING
:
case
NF_SYMBOLTYPE_DATESEP
:
if
(
rNumFor
.
Info
().
sStrArray
[
i
]
==
'-'
)
{
if
(
eState
==
eAtYear
)
eState
=
eAtSep1
;
else
if
(
eState
==
eAtMonth
)
eState
=
eAtSep2
;
else
eState
=
eNotIso
;
}
else
eState
=
eNotIso
;
break
;
default
:
eState
=
eNotIso
;
}
}
}
else
{
OSL_FAIL
(
"SvNumberformat::ImpIsIso8601: no date"
);
}
return
bIsIso
;
}
bool
SvNumberformat
::
ImpGetDateOutput
(
double
fNumber
,
sal_uInt16
nIx
,
String
&
OutString
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment