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
a8fe23a1
Kaydet (Commit)
a8fe23a1
authored
Kas 24, 2012
tarafından
Norbert Thiebaud
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
clean-up few more String out of zformat internals
Change-Id: I83f7794a3cc413c7720ad605a22c00efe966e1a5
üst
389713cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
44 deletions
+53
-44
zformat.hxx
svl/inc/svl/zformat.hxx
+12
-9
zformat.cxx
svl/source/numbers/zformat.cxx
+41
-35
No files found.
svl/inc/svl/zformat.hxx
Dosyayı görüntüle @
a8fe23a1
...
...
@@ -347,7 +347,7 @@ public:
// of [$xxx-nnn] are returned
bool
GetNewCurrencySymbol
(
OUString
&
rSymbol
,
OUString
&
rExtension
)
const
;
static
bool
HasStringNegativeSign
(
const
String
&
rStr
);
static
bool
HasStringNegativeSign
(
const
OU
String
&
rStr
);
/**
Whether a character at position nPos is somewhere between two matching
...
...
@@ -359,9 +359,9 @@ public:
The default '\0' results in no escapement possible.
Defaults are set right according to the "unlogic" of the Numberformatter
*/
static
bool
IsInQuote
(
const
String
&
rString
,
xub_StrLen
nPos
,
sal_Unicode
cQuote
=
'"'
,
sal_Unicode
cEscIn
=
'\0'
,
sal_Unicode
cEscOut
=
'\\'
);
static
bool
IsInQuote
(
const
OUString
&
rString
,
sal_Int32
nPos
,
sal_Unicode
cQuote
=
'"'
,
sal_Unicode
cEscIn
=
'\0'
,
sal_Unicode
cEscOut
=
'\\'
);
/**
Return the position of a matching closing cQuote if the character at
...
...
@@ -483,8 +483,9 @@ private:
SVL_DLLPRIVATE
bool
ImpIsOtherCalendar
(
const
ImpSvNumFor
&
rNumFor
)
const
;
#ifdef THE_FUTURE
SVL_DLLPRIVATE
bool
ImpSwitchToSpecifiedCalendar
(
String
&
rOrgCalendar
,
double
&
fOrgDateTime
,
const
ImpSvNumFor
&
rNumFor
)
const
;
SVL_DLLPRIVATE
bool
ImpSwitchToSpecifiedCalendar
(
OUString
&
rOrgCalendar
,
double
&
fOrgDateTime
,
const
ImpSvNumFor
&
rNumFor
)
const
;
#endif
/** Whether to use possessive genitive case month name, or partitive case
...
...
@@ -652,14 +653,16 @@ private:
// normal digits or other digits, depending on ImpSvNumFor.aNatNum,
// [NatNum1], [NatNum2], ...
SVL_DLLPRIVATE
String
ImpGetNatNumString
(
const
SvNumberNatNum
&
rNum
,
sal_Int32
nVal
,
sal_uInt16
nMinDigits
=
0
)
const
;
SVL_DLLPRIVATE
OU
String
ImpGetNatNumString
(
const
SvNumberNatNum
&
rNum
,
sal_Int32
nVal
,
sal_uInt16
nMinDigits
=
0
)
const
;
String
ImpIntToString
(
sal_uInt16
nIx
,
sal_Int32
nVal
,
sal_uInt16
nMinDigits
=
0
)
const
OU
String
ImpIntToString
(
sal_uInt16
nIx
,
sal_Int32
nVal
,
sal_uInt16
nMinDigits
=
0
)
const
{
const
SvNumberNatNum
&
rNum
=
NumFor
[
nIx
].
GetNatNum
();
if
(
nMinDigits
||
rNum
.
IsComplete
()
)
{
return
ImpGetNatNumString
(
rNum
,
nVal
,
nMinDigits
);
}
return
rtl
::
OUString
::
valueOf
(
nVal
);
}
...
...
svl/source/numbers/zformat.cxx
Dosyayı görüntüle @
a8fe23a1
...
...
@@ -3487,7 +3487,7 @@ bool SvNumberformat::ImpFallBackToGregorianCalendar( OUString& rOrgCalendar, dou
* SwitchToSpecifiedCalendar(), see comment in
* ImpSvNumberInputScan::GetDateRef() */
bool
SvNumberformat
::
ImpSwitchToSpecifiedCalendar
(
String
&
rOrgCalendar
,
bool
SvNumberformat
::
ImpSwitchToSpecifiedCalendar
(
OU
String
&
rOrgCalendar
,
double
&
fOrgDateTime
,
const
ImpSvNumFor
&
rNumFor
)
const
{
...
...
@@ -3498,7 +3498,7 @@ bool SvNumberformat::ImpSwitchToSpecifiedCalendar( String& rOrgCalendar,
if
(
rInfo
.
nTypeArray
[
i
]
==
NF_SYMBOLTYPE_CALENDAR
)
{
CalendarWrapper
&
rCal
=
GetCal
();
if
(
!
rOrgCalendar
.
Len
()
)
if
(
!
rOrgCalendar
.
getLength
()
)
{
rOrgCalendar
=
rCal
.
getUniqueID
();
fOrgDateTime
=
rCal
.
getDateTime
();
...
...
@@ -5004,7 +5004,7 @@ Color* SvNumberformat::GetColor( sal_uInt16 nNumFor ) const
return
NumFor
[
nNumFor
].
GetColor
();
}
static
void
lcl_SvNumberformat_AddLimitStringImpl
(
String
&
rStr
,
static
void
lcl_SvNumberformat_AddLimitStringImpl
(
OU
String
&
rStr
,
SvNumberformatLimitOps
eOp
,
double
fLimit
,
const
String
&
rDecSep
)
{
...
...
@@ -5013,31 +5013,31 @@ static void lcl_SvNumberformat_AddLimitStringImpl( String& rStr,
switch
(
eOp
)
{
case
NUMBERFORMAT_OP_EQ
:
rStr
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
"[="
)
)
;
rStr
=
"[="
;
break
;
case
NUMBERFORMAT_OP_NE
:
rStr
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
"[<>"
)
)
;
rStr
=
"[<>"
;
break
;
case
NUMBERFORMAT_OP_LT
:
rStr
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
"[<"
)
)
;
rStr
=
"[<"
;
break
;
case
NUMBERFORMAT_OP_LE
:
rStr
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
"[<="
)
)
;
rStr
=
"[<="
;
break
;
case
NUMBERFORMAT_OP_GT
:
rStr
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
"[>"
)
)
;
rStr
=
"[>"
;
break
;
case
NUMBERFORMAT_OP_GE
:
rStr
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
"[>="
)
)
;
rStr
=
"[>="
;
break
;
default
:
SAL_WARN
(
"svl.numbers"
,
"unsupported number format"
);
break
;
}
rStr
+=
String
(
::
rtl
::
math
::
doubleToUString
(
fLimit
,
rtl_math_StringFormat_Automatic
,
rtl_math_DecimalPlaces_Max
,
rDecSep
.
GetChar
(
0
),
true
)
);
rStr
+=
']'
;
rStr
+=
::
rtl
::
math
::
doubleToUString
(
fLimit
,
rtl_math_StringFormat_Automatic
,
rtl_math_DecimalPlaces_Max
,
rDecSep
.
GetChar
(
0
),
true
);
rStr
+=
"]"
;
}
}
...
...
@@ -5098,7 +5098,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{
nSem
++
;
}
String
aPrefix
;
OU
String
aPrefix
;
bool
LCIDInserted
=
false
;
if
(
!
bDefaults
)
...
...
@@ -5124,9 +5124,9 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{
if
(
rKey
[
j
]
==
rColorName
)
{
aPrefix
+=
'['
;
aPrefix
+=
String
(
rKeywords
[
j
])
;
aPrefix
+=
']'
;
aPrefix
+=
"["
;
aPrefix
+=
rKeywords
[
j
]
;
aPrefix
+=
"]"
;
break
;
// for
}
}
...
...
@@ -5135,7 +5135,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
const
SvNumberNatNum
&
rNum
=
NumFor
[
n
].
GetNatNum
();
sal_uInt16
nAnz
=
NumFor
[
n
].
GetCount
();
if
(
nSem
&&
(
nAnz
||
aPrefix
.
Len
())
)
if
(
nSem
&&
(
nAnz
||
!
aPrefix
.
isEmpty
())
)
{
for
(
;
nSem
;
--
nSem
)
{
...
...
@@ -5147,7 +5147,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
}
}
if
(
aPrefix
.
Len
()
)
if
(
!
aPrefix
.
isEmpty
()
)
{
aStr
.
append
(
aPrefix
);
}
...
...
@@ -5161,7 +5161,9 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{
aStr
.
append
(
rKeywords
[
pType
[
j
]]
);
if
(
NF_KEY_NNNN
==
pType
[
j
]
)
{
aStr
.
append
(
rLocWrp
.
getLongDateDayOfWeekSep
()
);
}
}
else
{
...
...
@@ -5235,12 +5237,12 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
}
for
(
;
nSub
<
4
&&
bDefault
[
nSub
];
++
nSub
)
{
// append empty subformats
aStr
.
append
(
';'
);
aStr
.
append
(
(
sal_Unicode
)
';'
);
}
return
aStr
.
makeStringAndClear
();
}
String
SvNumberformat
::
ImpGetNatNumString
(
const
SvNumberNatNum
&
rNum
,
OU
String
SvNumberformat
::
ImpGetNatNumString
(
const
SvNumberNatNum
&
rNum
,
sal_Int32
nVal
,
sal_uInt16
nMinDigits
)
const
{
OUString
aStr
;
...
...
@@ -5263,16 +5265,18 @@ String SvNumberformat::ImpGetNatNumString( const SvNumberNatNum& rNum,
}
else
{
String
aValStr
(
rtl
::
OUString
::
valueOf
(
nVal
)
);
if
(
aValStr
.
Len
()
>=
nMinDigits
)
OU
String
aValStr
(
rtl
::
OUString
::
valueOf
(
nVal
)
);
if
(
aValStr
.
getLength
()
>=
nMinDigits
)
{
aStr
=
aValStr
;
}
else
{
using
namespace
comphelper
::
string
;
OUStringBuffer
aBuf
;
padToLength
(
aBuf
,
nMinDigits
-
aValStr
.
Len
(),
'0'
);
for
(
sal_Int32
index
=
0
;
index
<
nMinDigits
-
aValStr
.
getLength
();
++
index
)
{
aBuf
.
append
((
sal_Unicode
)
'0'
);
}
aBuf
.
append
(
aValStr
);
aStr
=
aBuf
.
makeStringAndClear
();
}
...
...
@@ -5328,47 +5332,49 @@ void SvNumberformat::GetNatNumXml( com::sun::star::i18n::NativeNumberXmlAttribut
}
// static
bool
SvNumberformat
::
HasStringNegativeSign
(
const
String
&
rStr
)
bool
SvNumberformat
::
HasStringNegativeSign
(
const
OU
String
&
rStr
)
{
// fuer Sign muss '-' am Anfang oder am Ende des TeilStrings sein (Blanks ignored)
xub_StrLen
nLen
=
rStr
.
Len
();
sal_Int32
nLen
=
rStr
.
getLength
();
if
(
!
nLen
)
{
return
false
;
}
const
sal_Unicode
*
const
pBeg
=
rStr
.
GetBuffe
r
();
const
sal_Unicode
*
const
pBeg
=
rStr
.
getSt
r
();
const
sal_Unicode
*
const
pEnd
=
pBeg
+
nLen
;
register
const
sal_Unicode
*
p
=
pBeg
;
do
{
// Anfang
if
(
*
p
==
'-'
)
if
(
*
p
==
(
sal_Unicode
)
'-'
)
{
return
true
;
}
}
while
(
*
p
==
' '
&&
++
p
<
pEnd
);
while
(
*
p
==
(
sal_Unicode
)
' '
&&
++
p
<
pEnd
);
p
=
pEnd
-
1
;
do
{
// Ende
if
(
*
p
==
'-'
)
if
(
*
p
==
(
sal_Unicode
)
'-'
)
{
return
true
;
}
}
while
(
*
p
==
' '
&&
pBeg
<
--
p
);
while
(
*
p
==
(
sal_Unicode
)
' '
&&
pBeg
<
--
p
);
return
false
;
}
// static
bool
SvNumberformat
::
IsInQuote
(
const
String
&
rStr
,
xub_StrLen
nPos
,
bool
SvNumberformat
::
IsInQuote
(
const
OUString
&
rStr
,
sal_Int32
nPos
,
sal_Unicode
cQuote
,
sal_Unicode
cEscIn
,
sal_Unicode
cEscOut
)
{
xub_StrLen
nLen
=
rStr
.
Len
();
sal_Int32
nLen
=
rStr
.
getLength
();
if
(
nPos
>=
nLen
)
{
return
false
;
}
register
const
sal_Unicode
*
p0
=
rStr
.
GetBuffe
r
();
register
const
sal_Unicode
*
p0
=
rStr
.
getSt
r
();
register
const
sal_Unicode
*
p
=
p0
;
register
const
sal_Unicode
*
p1
=
p0
+
nPos
;
bool
bQuoted
=
false
;
...
...
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