[Libreoffice-commits] .: 6 commits - avmedia/inc avmedia/source basic/source comphelper/inc comphelper/qa cui/source editeng/source formula/source sc/source sd/source sfx2/inc sfx2/source starmath/inc starmath/source svl/source svtools/source svx/inc svx/source sw/source tools/inc unotools/inc unotools/source unusedcode.easy vcl/inc vcl/source xmloff/source
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Jun 18 07:20:50 PDT 2012
avmedia/inc/avmedia/mediaplayer.hxx | 2
avmedia/source/framework/mediaplayer.cxx | 2
basic/source/sbx/sbxscan.cxx | 8
comphelper/inc/comphelper/string.hxx | 20 +
comphelper/qa/string/test_string.cxx | 13 +
cui/source/tabpages/tabstpge.cxx | 2
editeng/source/items/paraitem.cxx | 2
formula/source/core/api/FormulaCompiler.cxx | 2
sc/source/core/data/dpcache.cxx | 2
sc/source/core/tool/compiler.cxx | 4
sc/source/filter/excel/excimp8.cxx | 2
sc/source/filter/xcl97/xcl97rec.cxx | 2
sc/source/ui/app/inputwin.cxx | 2
sc/source/ui/cctrl/editfield.cxx | 4
sc/source/ui/formdlg/dwfunctr.cxx | 2
sc/source/ui/inc/dwfunctr.hxx | 2
sc/source/ui/inc/inputwin.hxx | 2
sc/source/ui/inc/reffact.hxx | 49 ++--
sc/source/ui/inc/spelldialog.hxx | 2
sc/source/ui/miscdlgs/solveroptions.cxx | 8
sc/source/ui/view/cellsh2.cxx | 4
sc/source/ui/view/reffact.cxx | 39 +--
sc/source/ui/view/spelldialog.cxx | 2
sd/source/filter/eppt/epptso.cxx | 5
sd/source/ui/dlg/AnimationChildWindow.cxx | 2
sd/source/ui/dlg/LayerDialogChildWindow.cxx | 2
sd/source/ui/dlg/PaneChildWindows.cxx | 6
sd/source/ui/dlg/SpellDialogChildWindow.cxx | 2
sd/source/ui/inc/AnimationChildWindow.hxx | 2
sd/source/ui/inc/LayerDialogChildWindow.hxx | 2
sd/source/ui/inc/PaneChildWindows.hxx | 6
sd/source/ui/inc/SpellDialogChildWindow.hxx | 2
sfx2/inc/sfx2/childwin.hxx | 40 +++
sfx2/inc/sfx2/templdlg.hxx | 2
sfx2/source/dialog/dinfdlg.cxx | 2
sfx2/source/dialog/dockwin.cxx | 6
sfx2/source/dialog/templdlg.cxx | 2
starmath/inc/toolbox.hxx | 2
starmath/inc/view.hxx | 2
starmath/source/toolbox.cxx | 2
starmath/source/view.cxx | 2
svl/source/numbers/zforfind.cxx | 4
svl/source/numbers/zforscan.cxx | 8
svtools/source/contnr/fileview.cxx | 2
svtools/source/filter/sgvtext.cxx | 2
svx/inc/svx/bmpmask.hxx | 2
svx/inc/svx/colrctrl.hxx | 2
svx/inc/svx/contdlg.hxx | 2
svx/inc/svx/f3dchild.hxx | 2
svx/inc/svx/fontwork.hxx | 2
svx/inc/svx/galbrws.hxx | 2
svx/inc/svx/hyperdlg.hxx | 2
svx/inc/svx/imapdlg.hxx | 2
svx/inc/svx/srchdlg.hxx | 2
svx/source/dialog/_bmpmask.cxx | 2
svx/source/dialog/_contdlg.cxx | 6
svx/source/dialog/fontwork.cxx | 2
svx/source/dialog/hyperdlg.cxx | 2
svx/source/dialog/imapdlg.cxx | 6
svx/source/dialog/srchdlg.cxx | 2
svx/source/engine3d/float3d.cxx | 2
svx/source/form/formcontroller.cxx | 2
svx/source/gallery2/galbrws.cxx | 2
svx/source/items/chrtitem.cxx | 2
svx/source/stbctrls/pszctrl.cxx | 2
svx/source/svdraw/svdattr.cxx | 2
svx/source/svdraw/svdmodel.cxx | 4
svx/source/svdraw/svdomeas.cxx | 2
svx/source/svdraw/svdtrans.cxx | 2
svx/source/tbxctrls/colrctrl.cxx | 2
sw/source/core/bastyp/calc.cxx | 10
sw/source/core/doc/docsort.cxx | 4
sw/source/filter/ww8/ww8scan.cxx | 2
sw/source/ui/dialog/SwSpellDialogChildWindow.cxx | 2
sw/source/ui/dialog/wordcountwrapper.cxx | 2
sw/source/ui/fldui/fldwrap.cxx | 2
sw/source/ui/inc/SwSpellDialogChildWindow.hxx | 2
sw/source/ui/inc/fldwrap.hxx | 2
sw/source/ui/inc/idxmrk.hxx | 4
sw/source/ui/inc/inputwin.hxx | 2
sw/source/ui/inc/redlndlg.hxx | 2
sw/source/ui/inc/wordcountdialog.hxx | 2
sw/source/ui/index/idxmrk.cxx | 4
sw/source/ui/misc/redlndlg.cxx | 2
sw/source/ui/ribbar/inputwin.cxx | 2
tools/inc/tools/string.hxx | 5
unotools/inc/unotools/localedatawrapper.hxx | 258 +++++++++++------------
unotools/source/i18n/localedatawrapper.cxx | 211 +++++++++---------
unusedcode.easy | 16 -
vcl/inc/vcl/edit.hxx | 2
vcl/inc/vcl/i18nhelp.hxx | 4
vcl/inc/vcl/longcurr.hxx | 8
vcl/source/app/i18nhelp.cxx | 6
vcl/source/control/edit.cxx | 12 -
vcl/source/control/field.cxx | 9
vcl/source/control/field2.cxx | 26 +-
vcl/source/control/longcurr.cxx | 9
xmloff/source/style/xmlnumfi.cxx | 2
98 files changed, 497 insertions(+), 457 deletions(-)
New commits:
commit e31de5e002a9a0301e3f16eb105697169e67438f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 18 11:32:46 2012 +0100
detect wrong UniString ctor
there's no way j was intended to be used as a rtl_TextEncoding
here. From context it's clearly meant to create a UniString from
a subset of the input ByteString
Change-Id: Ic0a0773f90686d73ec4eb8b8e03a454585758578
diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx
index b87ec91..0f0ae91 100644
--- a/svtools/source/filter/sgvtext.cxx
+++ b/svtools/source/filter/sgvtext.cxx
@@ -1178,7 +1178,7 @@ void SgfFontOne::ReadOne( const rtl::OString& rID, rtl::OString& Dsc )
i--;
j++;
}
- SVFName=String(Dsc,i+1,j); // SV-Fontname rausholen
+ SVFName = rtl::OStringToOUString(Dsc.copy(i+1,j), RTL_TEXTENCODING_IBM_437); // SV-Fontname rausholen
Dsc = rtl::OStringBuffer(Dsc).remove(i,j).makeStringAndClear();
IFID = (sal_uInt32)rID.toInt32();
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index 9ab1540..c4a8c2a 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -151,6 +151,11 @@ private:
//detect and reject use of RTL_CONSTASCII_STRINGPARAM instead of RTL_CONSTASCII_USTRINGPARAM
TOOLS_DLLPRIVATE UniString( const sal_Char*, sal_Int32 );
+
+ //detect and reject wrong way to attempt to create a UniString from a substring of
+ //a rtl::OString
+ TOOLS_DLLPRIVATE UniString(const rtl::OString& rByteStr, xub_StrLen nPos, xub_StrLen nLen,
+ sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS);
public:
UniString();
UniString( const ResId& rResId );
commit 06e2005ed83567452783003e3113ad6a92190c2d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jun 17 21:01:05 2012 +0100
convert LocaleDataWrapper to OUString
Change-Id: Icb5f5adf9139d1c0f0e86d8128ea6742ce20b138
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 80276a3..8bbe8b7 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -59,8 +59,8 @@ void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep )
{
SvtSysLocale aSysLocale;
const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
- rcDecimalSep = rData.getNumDecimalSep().GetBuffer()[0];
- rcThousandSep = rData.getNumThousandSep().GetBuffer()[0];
+ rcDecimalSep = rData.getNumDecimalSep()[0];
+ rcThousandSep = rData.getNumThousandSep()[0];
}
// scanning a string according to BASIC-conventions
@@ -870,8 +870,8 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
{
SvtSysLocale aSysLocale;
const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
- sal_Unicode cComma = rData.getNumDecimalSep().GetBuffer()[0];
- sal_Unicode c1000 = rData.getNumThousandSep().GetBuffer()[0];
+ sal_Unicode cComma = rData.getNumDecimalSep()[0];
+ sal_Unicode c1000 = rData.getNumThousandSep()[0];
String aCurrencyStrg = rData.getCurrSymbol();
// initialize the Basic-formater help object:
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 3b039b5..ecb0461 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -196,7 +196,7 @@ SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent,
// Get the default decimal char from the system
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
- aAktTab.GetDecimal() = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+ aAktTab.GetDecimal() = aLocaleWrapper.getNumDecimalSep()[0];
FreeResource();
}
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 109578b..382f9bd 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -884,7 +884,7 @@ SvxTabStop::SvxTabStop( const sal_Int32 nPos, const SvxTabAdjust eAdjst,
void SvxTabStop::fillDecimal() const
{
if ( cDfltDecimalChar == m_cDecimal )
- m_cDecimal = SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
+ m_cDecimal = SvtSysLocale().GetLocaleData().getNumDecimalSep()[0];
}
// -----------------------------------------------------------------------
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 042e49b..d2936a9 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1757,7 +1757,7 @@ void FormulaCompiler::AppendDouble( rtl::OUStringBuffer& rBuffer, double fVal )
::rtl::math::doubleToUStringBuffer( rBuffer, fVal,
rtl_math_StringFormat_Automatic,
rtl_math_DecimalPlaces_Max,
- aSysLocale.GetLocaleDataPtr()->getNumDecimalSep().GetChar(0),
+ aSysLocale.GetLocaleDataPtr()->getNumDecimalSep()[0],
true );
}
}
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 6908163..742b6eb 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -1006,7 +1006,7 @@ rtl::OUString ScDPCache::GetFormattedString(long nDim, const ScDPItemData& rItem
if (!p)
return rItem.GetString();
- sal_Unicode cDecSep = ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0);
+ sal_Unicode cDecSep = ScGlobal::pLocaleData->getNumDecimalSep()[0];
return ScDPUtil::getNumGroupName(fVal, p->maInfo, cDecSep, mpDoc->GetFormatTable());
}
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 7833786..97ae770 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1867,7 +1867,7 @@ xub_StrLen ScCompiler::NextSymbol(bool bInArray)
sal_Unicode cArrayColSep = mxSymbols->getSymbol( ocArrayColSep).GetChar(0);
sal_Unicode cArrayRowSep = mxSymbols->getSymbol( ocArrayRowSep).GetChar(0);
sal_Unicode cDecSep = (mxSymbols->isEnglish() ? '.' :
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0));
+ ScGlobal::pLocaleData->getNumDecimalSep()[0]);
// special symbols specific to address convention used
sal_Unicode cSheetPrefix = pConv->getSpecialSymbol(ScCompiler::Convention::ABS_SHEET_PREFIX);
@@ -2786,7 +2786,7 @@ bool ScCompiler::IsReference( const String& rName )
// Has to be called before IsValue
sal_Unicode ch1 = rName.GetChar(0);
sal_Unicode cDecSep = ( mxSymbols->isEnglish() ? '.' :
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0) );
+ ScGlobal::pLocaleData->getNumDecimalSep()[0] );
if ( ch1 == cDecSep )
return false;
// Who was that imbecile introducing '.' as the sheet name separator!?!
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 91d5a01..3dbc3cf 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -500,7 +500,7 @@ void XclImpAutoFilterData::CreateFromDouble( rtl::OUString& rStr, double fVal )
{
rStr += ::rtl::math::doubleToUString(fVal,
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), true);
+ ScGlobal::pLocaleData->getNumDecimalSep()[0], true);
}
void XclImpAutoFilterData::SetCellAttribs()
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index f1f8a40..4e7e4af 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1244,7 +1244,7 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
sText = ::rtl::math::doubleToUString( fVal,
rtl_math_StringFormat_Automatic,
rtl_math_DecimalPlaces_Max,
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0),
+ ScGlobal::pLocaleData->getNumDecimalSep()[0],
sal_True );
}
else
diff --git a/sc/source/ui/cctrl/editfield.cxx b/sc/source/ui/cctrl/editfield.cxx
index 51147e5..3ee77c7 100644
--- a/sc/source/ui/cctrl/editfield.cxx
+++ b/sc/source/ui/cctrl/editfield.cxx
@@ -42,12 +42,12 @@ namespace {
sal_Unicode lclGetDecSep()
{
- return ScGlobal::GetpLocaleData()->getNumDecimalSep().GetChar( 0 );
+ return ScGlobal::GetpLocaleData()->getNumDecimalSep()[0];
}
sal_Unicode lclGetGroupSep()
{
- return ScGlobal::GetpLocaleData()->getNumThousandSep().GetChar( 0 );
+ return ScGlobal::GetpLocaleData()->getNumThousandSep()[0];
}
} // namespace
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 232cb1a..cd73cf8 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -105,7 +105,7 @@ void ScSolverOptionsString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16,
if ( mbIsDouble )
sTxt += (String)rtl::math::doubleToUString( mfDoubleValue,
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- ScGlobal::GetpLocaleData()->getNumDecimalSep().GetChar(0), true );
+ ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true );
else
sTxt += String::CreateFromInt32( mnIntValue );
rDev.SetFont( aFont );
@@ -470,7 +470,7 @@ void ScSolverValueDialog::SetValue( double fValue )
{
maEdValue.SetText( rtl::math::doubleToUString( fValue,
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- ScGlobal::GetpLocaleData()->getNumDecimalSep().GetChar(0), true ) );
+ ScGlobal::GetpLocaleData()->getNumDecimalSep()[0], true ) );
}
double ScSolverValueDialog::GetValue() const
@@ -480,8 +480,8 @@ double ScSolverValueDialog::GetValue() const
const LocaleDataWrapper* pLocaleData = ScGlobal::GetpLocaleData();
rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
double fValue = rtl::math::stringToDouble( aInput,
- pLocaleData->getNumDecimalSep().GetChar(0),
- pLocaleData->getNumThousandSep().GetChar(0),
+ pLocaleData->getNumDecimalSep()[0],
+ pLocaleData->getNumThousandSep()[0],
&eStatus, NULL );
return fValue;
}
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 9cf1834..65f89f8 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -842,7 +842,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if (pDoc->GetFormatTable()->IsNumberFormat(aTemp1, nNumIndex, nVal))
aExpr1 =String( ::rtl::math::doubleToUString( nVal,
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), sal_True));
+ ScGlobal::pLocaleData->getNumDecimalSep()[0], sal_True));
else
aExpr1 = aTemp1;
}
@@ -859,7 +859,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
if (pDoc->GetFormatTable()->IsNumberFormat(aTemp2, nNumIndex, nVal))
aExpr2 =String( ::rtl::math::doubleToUString( nVal,
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), sal_True));
+ ScGlobal::pLocaleData->getNumDecimalSep()[0], sal_True));
else
aExpr2 = aTemp2;
}
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index d96b6d0..d60f0ce 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -165,7 +165,7 @@ String CreateSizeText( sal_uIntPtr nSize, sal_Bool bExtraBytes, sal_Bool bSmartE
{
aSizeStr = ::rtl::math::doubleToUString( fSize,
rtl_math_StringFormat_F, nDec,
- rLocaleWrapper.getNumDecimalSep().GetChar(0) );
+ rLocaleWrapper.getNumDecimalSep()[0] );
aSizeStr += aUnitStr;
aSizeStr += DEFINE_CONST_UNICODE(" (");
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 5a21693..6fa22c9 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -726,13 +726,13 @@ bool ImpSvNumberInputScan::GetTimeAmPm( const String& rString, xub_StrLen& nPos
if ( StringContains( pChr->uppercase( pLoc->getTimeAM() ), rString, nPos ) )
{
nAmPm = 1;
- nPos = nPos + pLoc->getTimeAM().Len();
+ nPos = nPos + pLoc->getTimeAM().getLength();
return true;
}
else if ( StringContains( pChr->uppercase( pLoc->getTimePM() ), rString, nPos ) )
{
nAmPm = -1;
- nPos = nPos + pLoc->getTimePM().Len();
+ nPos = nPos + pLoc->getTimePM().getLength();
return true;
}
}
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index c883242..0dfe952 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1224,7 +1224,7 @@ xub_StrLen ImpSvNumberformatScan::ScanType()
eNewType = NUMBERFORMAT_TEXT;
break;
default:
- if ( sStrArray[i] == pLoc->getTime100SecSep() )
+ if (pLoc->getTime100SecSep().equals(sStrArray[i]))
bDecSep = true; // for SS,0
eNewType = NUMBERFORMAT_UNDEFINED;
break;
@@ -1273,7 +1273,7 @@ xub_StrLen ImpSvNumberformatScan::ScanType()
{
if (nCurrPos != STRING_NOTFOUND)
eScannedType = NUMBERFORMAT_UNDEFINED;
- else if ( sStrArray[i] != pLoc->getTimeSep() )
+ else if (!pLoc->getTimeSep().equals(sStrArray[i]))
return nPos;
}
}
@@ -1292,8 +1292,8 @@ xub_StrLen ImpSvNumberformatScan::ScanType()
{
if (nCurrPos != STRING_NOTFOUND)
eScannedType = NUMBERFORMAT_UNDEFINED;
- else if ( sStrArray[i] != pFormatter->GetDateSep()
- && sStrArray[i] != pLoc->getTimeSep() )
+ else if ( pFormatter->GetDateSep() != sStrArray[i]
+ && !pLoc->getTimeSep().equals(sStrArray[i]) )
return nPos;
}
}
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 9f100f8..4acae0d 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -698,7 +698,7 @@ OUString CreateExactSizeText( sal_Int64 nSize )
OUString aSizeStr( ::rtl::math::doubleToUString( fSize,
rtl_math_StringFormat_F, nDec,
- SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0)));
+ SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]) );
aSizeStr += aUnitStr;
return aSizeStr;
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
index 32b962b..50486b8 100644
--- a/svx/source/dialog/_contdlg.cxx
+++ b/svx/source/dialog/_contdlg.cxx
@@ -579,7 +579,7 @@ IMPL_LINK( SvxSuperContourDlg, MousePosHdl, ContourWindow*, pWnd )
const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
const Point& rMousePos = pWnd->GetMousePos();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
- const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
aStr.Append( String::CreateFromAscii( " / " ) );
@@ -596,7 +596,7 @@ IMPL_LINK( SvxSuperContourDlg, GraphSizeHdl, ContourWindow*, pWnd )
const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
const Size& rSize = pWnd->GetGraphicSize();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
- const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );
aStr.Append( String::CreateFromAscii( " x " ) );
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index b6a211e..643fe62 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -676,7 +676,7 @@ IMPL_LINK( SvxIMapDlg, MousePosHdl, IMapWindow*, pWnd )
const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
const Point& rMousePos = pWnd->GetMousePos();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
- const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
aStr.Append( DEFINE_CONST_UNICODE( " / " ) );
@@ -693,7 +693,7 @@ IMPL_LINK( SvxIMapDlg, GraphSizeHdl, IMapWindow*, pWnd )
const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
const Size& rSize = pWnd->GetGraphicSize();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
- const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );
aStr.Append( DEFINE_CONST_UNICODE( " x " ) );
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 374bb29..8a6758e 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -3256,7 +3256,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
,xFormatter
,xField
,aAppLocale
- ,(sal_Char)aLocaleWrapper.getNumDecimalSep().GetChar(0)
+ ,(sal_Char)aLocaleWrapper.getNumDecimalSep()[0]
,getParseContext());
aRow[(*iter).xText] = sCriteria;
}
diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx
index 09eeadc..1d704c5 100644
--- a/svx/source/items/chrtitem.cxx
+++ b/svx/source/items/chrtitem.cxx
@@ -268,7 +268,7 @@ SfxItemPresentation SvxDoubleItem::GetPresentation
if ( pIntlWrapper )
{
rText = ::rtl::math::doubleToUString( fVal, rtl_math_StringFormat_E, 4,
- pIntlWrapper->getLocaleData()->getNumDecimalSep().GetChar(0), true );
+ pIntlWrapper->getLocaleData()->getNumDecimalSep()[0], true );
}
else
rText = GetValueText();
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index 27811db..8b09cb2 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -76,7 +76,7 @@ String SvxPosSizeStatusBarControl::GetMetricStr_Impl( long nVal )
FieldUnit eInUnit = FUNIT_100TH_MM;
String sMetric;
- const sal_Unicode cSep = Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep().GetChar(0);
+ const sal_Unicode cSep = Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep()[0];
sal_Int64 nConvVal = MetricField::ConvertValue( nVal * 100, 0L, 0, eInUnit, eOutUnit );
if ( nConvVal < 0 && ( nConvVal / 100 == 0 ) )
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index e953c4c..8b2b152 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -898,7 +898,7 @@ SfxItemPresentation SdrAngleItem::GetPresentation(
else
{
sal_Unicode cDec =
- pIntlWrapper->getLocaleData()->getNumDecimalSep().GetChar(0);
+ pIntlWrapper->getLocaleData()->getNumDecimalSep()[0];
rText.Insert(cDec, nLen-2);
if(bNull1)
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index eeed2c5..2d194bb 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -1299,7 +1299,7 @@ void SdrModel::TakeMetricStr(long nVal, rtl::OUString& rStr, bool bNoUnitChars,
aBuf.insert(0, sal_Unicode('0'));
}
- sal_Unicode cDec( rLoc.getNumDecimalSep().GetChar(0) );
+ sal_Unicode cDec( rLoc.getNumDecimalSep()[0] );
// insert KommaChar (decimal point character)
sal_Int32 nVorKomma = aBuf.getLength() - nKomma;
@@ -1369,7 +1369,7 @@ void SdrModel::TakeWinkStr(long nWink, rtl::OUString& rStr, bool bNoDegChar) con
while(aBuf.getLength() < nAnz)
aBuf.insert(0, sal_Unicode('0'));
- aBuf.insert(aBuf.getLength()-2, rLoc.getNumDecimalSep().GetChar(0));
+ aBuf.insert(aBuf.getLength()-2, rLoc.getNumDecimalSep()[0]);
if(bNeg)
aBuf.insert(0, sal_Unicode('-'));
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 2e7cd05..439bfba 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -131,7 +131,7 @@ void SdrMeasureObj::TakeRepresentation( XubString& rStr, SdrMeasureFieldKind eMe
rStr += sal_Unicode('?');
}
- sal_Unicode cDec(SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0));
+ sal_Unicode cDec(SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]);
if(rStr.Search(cDec) != STRING_NOTFOUND)
{
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index a9c5853..333582a 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -914,7 +914,7 @@ void SdrFormatter::TakeStr(long nVal, XubString& rStr) const
if(nK > 0)
{
// do we still have decimal places?
- sal_Unicode cDec(rLoc.getNumDecimalSep().GetChar(0));
+ sal_Unicode cDec(rLoc.getNumDecimalSep()[0]);
aStr.Insert(cDec, nVorKomma);
}
}
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index b19c2cc..73baaf1 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -467,7 +467,7 @@ String SwCalc::GetStrResult( double nValue, sal_Bool )
String aRetStr( ::rtl::math::doubleToUString( nValue,
rtl_math_StringFormat_Automatic,
nDec,
- pLclData->getNumDecimalSep().GetChar(0),
+ pLclData->getNumDecimalSep()[0],
true ));
return aRetStr;
@@ -916,8 +916,8 @@ if( !nUseOld )
else
{
sal_Unicode ch;
- sal_Unicode cTSep = pLclData->getNumThousandSep().GetChar(0),
- cDSep = pLclData->getNumDecimalSep().GetChar(0);
+ sal_Unicode cTSep = pLclData->getNumThousandSep()[0],
+ cDSep = pLclData->getNumDecimalSep()[0];
do {
if( 0 == ( ch = NextCh( sCommand, nCommandPos ) ) )
@@ -1528,8 +1528,8 @@ lcl_Str2Double( const String& rCommand, xub_StrLen& rCommandPos, double& rVal,
const sal_Unicode* pEnd;
rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
rCommand.GetBuffer() + rCommand.Len(),
- pLclData->getNumDecimalSep().GetChar(0),
- pLclData->getNumThousandSep().GetChar(0),
+ pLclData->getNumDecimalSep()[0],
+ pLclData->getNumThousandSep()[0],
&eStatus, &pEnd );
rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 2412d98..7f31f84 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -118,8 +118,8 @@ double SwSortElement::StrToDouble( const String& rStr ) const
rtl_math_ConversionStatus eStatus;
sal_Int32 nEnd;
double nRet = ::rtl::math::stringToDouble( rStr,
- pLclData->getNumDecimalSep().GetChar(0),
- pLclData->getNumThousandSep().GetChar(0),
+ pLclData->getNumDecimalSep()[0],
+ pLclData->getNumThousandSep()[0],
&eStatus, &nEnd );
if( rtl_math_ConversionStatus_Ok != eStatus || nEnd == 0 )
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 6af0100..178483b 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -5605,7 +5605,7 @@ WW8Fib::WW8Fib(sal_uInt8 nVer)
Locale aTempLocale;
SvxLanguageToLocale( aTempLocale, lid );
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale );
- nNumDecimalSep = aLocaleWrapper.getNumDecimalSep().GetChar( 0 );
+ nNumDecimalSep = aLocaleWrapper.getNumDecimalSep()[0];
}
sal_Unicode WW8Fib::getNumDecimalSep() const
diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx
index 6474ba0..0743c5b 100644
--- a/unotools/inc/unotools/localedatawrapper.hxx
+++ b/unotools/inc/unotools/localedatawrapper.hxx
@@ -30,16 +30,14 @@
#define _UNOTOOLS_LOCALEDATAWRAPPER_HXX
#include <boost/noncopyable.hpp>
-#include <tools/string.hxx>
+#include <boost/shared_ptr.hpp>
#include <com/sun/star/i18n/XLocaleData4.hpp>
#include <com/sun/star/i18n/LocaleItem.hpp>
#include <com/sun/star/i18n/reservedWords.hpp>
+#include <rtl/ustring.hxx>
#include <unotools/readwritemutexguard.hxx>
#include "unotools/unotoolsdllapi.h"
-#include <boost/shared_ptr.hpp>
-
-
namespace com { namespace sun { namespace star {
namespace lang {
class XMultiServiceFactory;
@@ -75,10 +73,10 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper : private boost::noncopyable
::com::sun::star::uno::Sequence< ::rtl::OUString > aReservedWordSeq;
::com::sun::star::uno::Sequence< sal_Int32 > aGrouping;
// cached items
- String aLocaleItem[::com::sun::star::i18n::LocaleItem::COUNT];
- String aReservedWord[::com::sun::star::i18n::reservedWords::COUNT];
- String aCurrSymbol;
- String aCurrBankSymbol;
+ rtl::OUString aLocaleItem[::com::sun::star::i18n::LocaleItem::COUNT];
+ rtl::OUString aReservedWord[::com::sun::star::i18n::reservedWords::COUNT];
+ rtl::OUString aCurrSymbol;
+ rtl::OUString aCurrBankSymbol;
int nDateFormat;
int nLongDateFormat;
sal_uInt16 nCurrPositiveFormat;
@@ -92,32 +90,32 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper : private boost::noncopyable
sal_Unicode cCurrZeroChar;
// whenever Locale changes
- void invalidateData();
+ void invalidateData();
- void getOneLocaleItemImpl( sal_Int16 nItem );
- const String& getOneLocaleItem( sal_Int16 nItem ) const;
+ void getOneLocaleItemImpl( sal_Int16 nItem );
+ const rtl::OUString& getOneLocaleItem( sal_Int16 nItem ) const;
- void getOneReservedWordImpl( sal_Int16 nWord );
- const String& getOneReservedWord( sal_Int16 nWord ) const;
+ void getOneReservedWordImpl( sal_Int16 nWord );
+ const rtl::OUString& getOneReservedWord( sal_Int16 nWord ) const;
- void getCurrSymbolsImpl();
- void getCurrFormatsImpl();
+ void getCurrSymbolsImpl();
+ void getCurrFormatsImpl();
- void scanCurrFormatImpl( const String& rCode,
- xub_StrLen nStart, xub_StrLen& nSign,
- xub_StrLen& nPar, xub_StrLen& nNum,
- xub_StrLen& nBlank, xub_StrLen& nSym );
+ void scanCurrFormatImpl( const rtl::OUString& rCode,
+ sal_Int32 nStart, sal_Int32& nSign,
+ sal_Int32& nPar, sal_Int32& nNum,
+ sal_Int32& nBlank, sal_Int32& nSym );
- void getDateFormatsImpl();
- DateFormat scanDateFormatImpl( const String& rCode );
+ void getDateFormatsImpl();
+ DateFormat scanDateFormatImpl( const rtl::OUString& rCode );
- void getDefaultCalendarImpl();
+ void getDefaultCalendarImpl();
- sal_Unicode* ImplAddFormatNum( sal_Unicode* pBuf,
- sal_Int64 nNumber, sal_uInt16 nDecimals,
- sal_Bool bUseThousandSep, sal_Bool bTrailingZeros ) const;
+ sal_Unicode* ImplAddFormatNum( sal_Unicode* pBuf,
+ sal_Int64 nNumber, sal_uInt16 nDecimals,
+ sal_Bool bUseThousandSep, sal_Bool bTrailingZeros ) const;
- void getDigitGroupingImpl();
+ void getDigitGroupingImpl();
public:
LocaleDataWrapper(
@@ -172,7 +170,7 @@ public:
static ::com::sun::star::uno::Sequence< sal_uInt16 > getInstalledLanguageTypes();
/// maps the LocaleData string to the International enum
- MeasurementSystem mapMeasurementStringToEnum( const String& rMS ) const;
+ MeasurementSystem mapMeasurementStringToEnum( const rtl::OUString& rMS ) const;
/// Convenience method to obtain the default calendar.
const ::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > getDefaultCalendar() const;
@@ -197,107 +195,107 @@ public:
// Functionality of class International methods, LocaleItem
- inline const String& getDateSep() const
+ const rtl::OUString& getDateSep() const
{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DATE_SEPARATOR ); }
- inline const String& getNumThousandSep() const
+ const rtl::OUString& getNumThousandSep() const
{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::THOUSAND_SEPARATOR ); }
- inline const String& getNumDecimalSep() const
+ const rtl::OUString& getNumDecimalSep() const
{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DECIMAL_SEPARATOR ); }
- inline const String& getTimeSep() const
+ const rtl::OUString& getTimeSep() const
{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_SEPARATOR ); }
- inline const String& getTime100SecSep() const
+ const rtl::OUString& getTime100SecSep() const
{ return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_100SEC_SEPARATOR ); }
- inline const String& getListSep() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LIST_SEPARATOR ); }
- inline const String& getQuotationMarkStart() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::SINGLE_QUOTATION_START ); }
- inline const String& getQuotationMarkEnd() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::SINGLE_QUOTATION_END ); }
- inline const String& getDoubleQuotationMarkStart() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DOUBLE_QUOTATION_START ); }
- inline const String& getDoubleQuotationMarkEnd() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DOUBLE_QUOTATION_END ); }
- inline const String& getMeasurementSystem() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::MEASUREMENT_SYSTEM ); }
- inline MeasurementSystem getMeasurementSystemEnum() const
- { return mapMeasurementStringToEnum( getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::MEASUREMENT_SYSTEM ) ); }
- inline const String& getTimeAM() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_AM ); }
- inline const String& getTimePM() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_PM ); }
- inline const String& getLongDateDayOfWeekSep() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_DAY_OF_WEEK_SEPARATOR ); }
- inline const String& getLongDateDaySep() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_DAY_SEPARATOR ); }
- inline const String& getLongDateMonthSep() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_MONTH_SEPARATOR ); }
- inline const String& getLongDateYearSep() const
- { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_YEAR_SEPARATOR ); }
+ const rtl::OUString& getListSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LIST_SEPARATOR ); }
+ const rtl::OUString& getQuotationMarkStart() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::SINGLE_QUOTATION_START ); }
+ const rtl::OUString& getQuotationMarkEnd() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::SINGLE_QUOTATION_END ); }
+ const rtl::OUString& getDoubleQuotationMarkStart() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DOUBLE_QUOTATION_START ); }
+ const rtl::OUString& getDoubleQuotationMarkEnd() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::DOUBLE_QUOTATION_END ); }
+ const rtl::OUString& getMeasurementSystem() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::MEASUREMENT_SYSTEM ); }
+ MeasurementSystem getMeasurementSystemEnum() const
+ { return mapMeasurementStringToEnum( getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::MEASUREMENT_SYSTEM ) ); }
+ const rtl::OUString& getTimeAM() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_AM ); }
+ const rtl::OUString& getTimePM() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::TIME_PM ); }
+ const rtl::OUString& getLongDateDayOfWeekSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_DAY_OF_WEEK_SEPARATOR ); }
+ const rtl::OUString& getLongDateDaySep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_DAY_SEPARATOR ); }
+ const rtl::OUString& getLongDateMonthSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_MONTH_SEPARATOR ); }
+ const rtl::OUString& getLongDateYearSep() const
+ { return getOneLocaleItem( ::com::sun::star::i18n::LocaleItem::LONG_DATE_YEAR_SEPARATOR ); }
// currency
- const String& getCurrSymbol() const;
- const String& getCurrBankSymbol() const;
- sal_uInt16 getCurrPositiveFormat() const;
- sal_uInt16 getCurrNegativeFormat() const;
- sal_uInt16 getCurrDigits() const;
+ const rtl::OUString& getCurrSymbol() const;
+ const rtl::OUString& getCurrBankSymbol() const;
+ sal_uInt16 getCurrPositiveFormat() const;
+ sal_uInt16 getCurrNegativeFormat() const;
+ sal_uInt16 getCurrDigits() const;
// simple date and time formatting
- DateFormat getDateFormat() const;
- DateFormat getLongDateFormat() const;
- /// only numerical values of Gregorian calendar
- String getDate( const Date& rDate ) const;
- String getTime( const Time& rTime, sal_Bool bSec = sal_True,
- sal_Bool b100Sec = sal_False ) const;
- String getDuration( const Time& rTime,
- sal_Bool bSec = sal_True, sal_Bool b100Sec = sal_False ) const;
-
- /** The CalendarWrapper already <b>MUST</b>
- have loaded a calendar.
- @param nDisplayDayOfWeek
- 0 := abbreviated name
- 1 := full name
- @param bDayOfMonthWithLeadingZero
- <FALSE/> := without leading zero
- <TRUE/> := with leading zero if <10
- @param nDisplayMonth
- 0 := abbreviated name
- 1 := full name
- @param bTwoDigitYear
- <FALSE/> := full year
- <TRUE/> := year % 100
- */
- String getLongDate( const Date& rDate,
- CalendarWrapper& rCal,
- sal_Int16 nDisplayDayOfWeek = 1,
- sal_Bool bDayOfMonthWithLeadingZero = sal_False,
- sal_Int16 nDisplayMonth = 1,
- sal_Bool bTwoDigitYear = sal_False
- ) const;
-
- /** Simple number formatting
- @param nNumber
- value * 10**nDecimals
- @param bTrailingZeros
- </sal_True> := always display trailing zeros in
- decimal places, even if integer value.
- </sal_False> := trailing zeros are only displayed
- if the value is not an integer value.
- */
- String getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
- sal_Bool bUseThousandSep = sal_True,
- sal_Bool bTrailingZeros = sal_True ) const;
-
- /// "Secure" currency formatted string.
- String getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
- const String& rCurrencySymbol,
- sal_Bool bUseThousandSep = sal_True ) const;
- /** Default currency formatted string, use with
- care as default currency may change in any
- locale, for example, DEM -> EUR */
- String getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
- sal_Bool bUseThousandSep = sal_True ) const
- { return getCurr( nNumber, nDecimals,
- getCurrSymbol(), bUseThousandSep ); }
+ DateFormat getDateFormat() const;
+ DateFormat getLongDateFormat() const;
+ /// only numerical values of Gregorian calendar
+ rtl::OUString getDate( const Date& rDate ) const;
+ rtl::OUString getTime( const Time& rTime, sal_Bool bSec = sal_True,
+ sal_Bool b100Sec = sal_False ) const;
+ rtl::OUString getDuration( const Time& rTime,
+ sal_Bool bSec = sal_True, sal_Bool b100Sec = sal_False ) const;
+
+ /** The CalendarWrapper already <b>MUST</b>
+ have loaded a calendar.
+ @param nDisplayDayOfWeek
+ 0 := abbreviated name
+ 1 := full name
+ @param bDayOfMonthWithLeadingZero
+ <FALSE/> := without leading zero
+ <TRUE/> := with leading zero if <10
+ @param nDisplayMonth
+ 0 := abbreviated name
+ 1 := full name
+ @param bTwoDigitYear
+ <FALSE/> := full year
+ <TRUE/> := year % 100
+ */
+ rtl::OUString getLongDate( const Date& rDate,
+ CalendarWrapper& rCal,
+ sal_Int16 nDisplayDayOfWeek = 1,
+ sal_Bool bDayOfMonthWithLeadingZero = sal_False,
+ sal_Int16 nDisplayMonth = 1,
+ sal_Bool bTwoDigitYear = sal_False
+ ) const;
+
+ /** Simple number formatting
+ @param nNumber
+ value * 10**nDecimals
+ @param bTrailingZeros
+ </sal_True> := always display trailing zeros in
+ decimal places, even if integer value.
+ </sal_False> := trailing zeros are only displayed
+ if the value is not an integer value.
+ */
+ rtl::OUString getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
+ sal_Bool bUseThousandSep = sal_True,
+ sal_Bool bTrailingZeros = sal_True ) const;
+
+ /// "Secure" currency formatted string.
+ rtl::OUString getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
+ const rtl::OUString& rCurrencySymbol,
+ sal_Bool bUseThousandSep = sal_True ) const;
+ /** Default currency formatted string, use with
+ care as default currency may change in any
+ locale, for example, DEM -> EUR */
+ rtl::OUString getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
+ sal_Bool bUseThousandSep = sal_True ) const
+ { return getCurr( nNumber, nDecimals,
+ getCurrSymbol(), bUseThousandSep ); }
// dummy returns, to be implemented
inline sal_Unicode getCurrZeroChar() const
@@ -313,19 +311,19 @@ public:
// reserved words
- inline const String& getTrueWord() const
+ const rtl::OUString& getTrueWord() const
{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::TRUE_WORD ); }
- inline const String& getFalseWord() const
+ const rtl::OUString& getFalseWord() const
{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::FALSE_WORD ); }
/// return a quarter string matching nQuarter (0..3) => "1st quarter" .. "4th quarter"
- inline const String& getQuarterWord( sal_Int16 nQuarter ) const
+ const rtl::OUString& getQuarterWord( sal_Int16 nQuarter ) const
{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::QUARTER1_WORD + nQuarter ); }
- inline const String& getAboveWord() const
+ const rtl::OUString& getAboveWord() const
{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::ABOVE_WORD ); }
- inline const String& getBelowWord() const
+ const rtl::OUString& getBelowWord() const
{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::BELOW_WORD ); }
/// return a quarter abbreviation string matching nQuarter (0..3) => "Q1" .. "Q2"
- inline const String& getQuarterAbbreviation( sal_Int16 nQuarter ) const
+ const rtl::OUString& getQuarterAbbreviation( sal_Int16 nQuarter ) const
{ return getOneReservedWord( ::com::sun::star::i18n::reservedWords::QUARTER1_ABBREVIATION + nQuarter ); }
/** Return whether locale data checks are enabled.
@@ -347,7 +345,7 @@ public:
/** Ouput a message during locale data checking. The (UTF-8) string is
written to stderr and in a non-product build or if DBG_UTIL is enabled
also raised as an assertion message box. */
- static void outputCheckMessage( const String& rMsg );
+ static void outputCheckMessage( const rtl::OUString& rMsg );
static void outputCheckMessage( const char* pStr);
private:
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 1e2ee15..698a457 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -110,24 +110,20 @@ const ::com::sun::star::lang::Locale& LocaleDataWrapper::getLocale() const
void LocaleDataWrapper::invalidateData()
{
- aCurrSymbol.Erase();
- aCurrBankSymbol.Erase();
+ aCurrSymbol = rtl::OUString();
+ aCurrBankSymbol = rtl::OUString();
nDateFormat = nLongDateFormat = nDateFormatInvalid;
nCurrPositiveFormat = nCurrNegativeFormat = nCurrDigits = nCurrFormatInvalid;
if ( bLocaleDataItemValid )
{
- for ( sal_Int32 j=0; j<LocaleItem::COUNT; j++ )
- {
- aLocaleItem[j].Erase();
- }
+ for (sal_Int32 j=0; j<LocaleItem::COUNT; ++j)
+ aLocaleItem[j] = rtl::OUString();
bLocaleDataItemValid = sal_False;
}
if ( bReservedWordValid )
{
- for ( sal_Int16 j=0; j<reservedWords::COUNT; j++ )
- {
- aReservedWord[j].Erase();
- }
+ for ( sal_Int16 j=0; j<reservedWords::COUNT; ++j )
+ aReservedWord[j] = rtl::OUString();
bReservedWordValid = sal_False;
}
xDefaultCalendar.reset();
@@ -370,7 +366,7 @@ void LocaleDataWrapper::invalidateData()
return rInstalledLanguageTypes;
}
-const String& LocaleDataWrapper::getOneLocaleItem( sal_Int16 nItem ) const
+const rtl::OUString& LocaleDataWrapper::getOneLocaleItem( sal_Int16 nItem ) const
{
::utl::ReadWriteGuard aGuard( aMutex );
if ( nItem >= LocaleItem::COUNT )
@@ -378,7 +374,7 @@ const String& LocaleDataWrapper::getOneLocaleItem( sal_Int16 nItem ) const
SAL_WARN( "unotools", "getOneLocaleItem: bounds" );
return aLocaleItem[0];
}
- if ( aLocaleItem[nItem].Len() == 0 )
+ if (aLocaleItem[nItem].isEmpty())
{ // no cached content
aGuard.changeReadToWrite();
((LocaleDataWrapper*)this)->getOneLocaleItemImpl( nItem );
@@ -466,7 +462,7 @@ void LocaleDataWrapper::getOneReservedWordImpl( sal_Int16 nWord )
}
-const String& LocaleDataWrapper::getOneReservedWord( sal_Int16 nWord ) const
+const rtl::OUString& LocaleDataWrapper::getOneReservedWord( sal_Int16 nWord ) const
{
::utl::ReadWriteGuard aGuard( aMutex );
if ( nWord < 0 || nWord >= reservedWords::COUNT )
@@ -474,7 +470,7 @@ const String& LocaleDataWrapper::getOneReservedWord( sal_Int16 nWord ) const
SAL_WARN( "unotools", "getOneReservedWord: bounds" );
nWord = reservedWords::FALSE_WORD;
}
- if ( aReservedWord[nWord].Len() == 0 )
+ if (aReservedWord[nWord].isEmpty())
{ // no cached content
aGuard.changeReadToWrite();
((LocaleDataWrapper*)this)->getOneReservedWordImpl( nWord );
@@ -483,10 +479,10 @@ const String& LocaleDataWrapper::getOneReservedWord( sal_Int16 nWord ) const
}
-MeasurementSystem LocaleDataWrapper::mapMeasurementStringToEnum( const String& rMS ) const
+MeasurementSystem LocaleDataWrapper::mapMeasurementStringToEnum( const rtl::OUString& rMS ) const
{
//! TODO: could be cached too
- if ( rMS.EqualsIgnoreCaseAscii( "metric" ) )
+ if ( rMS.equalsIgnoreAsciiCase( "metric" ) )
return MEASURE_METRIC;
//! TODO: other measurement systems? => extend enum MeasurementSystem
return MEASURE_US;
@@ -543,10 +539,10 @@ const ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem2 > L
// --- currencies -----------------------------------------------------
-const String& LocaleDataWrapper::getCurrSymbol() const
+const rtl::OUString& LocaleDataWrapper::getCurrSymbol() const
{
::utl::ReadWriteGuard aGuard( aMutex );
- if ( !aCurrSymbol.Len() )
+ if (aCurrSymbol.isEmpty())
{
aGuard.changeReadToWrite();
((LocaleDataWrapper*)this)->getCurrSymbolsImpl();
@@ -555,10 +551,10 @@ const String& LocaleDataWrapper::getCurrSymbol() const
}
-const String& LocaleDataWrapper::getCurrBankSymbol() const
+const rtl::OUString& LocaleDataWrapper::getCurrBankSymbol() const
{
::utl::ReadWriteGuard aGuard( aMutex );
- if ( !aCurrBankSymbol.Len() )
+ if (aCurrBankSymbol.isEmpty())
{
aGuard.changeReadToWrite();
((LocaleDataWrapper*)this)->getCurrSymbolsImpl();
@@ -628,7 +624,7 @@ void LocaleDataWrapper::getCurrSymbolsImpl()
if (areChecksEnabled())
outputCheckMessage( String( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getCurrSymbolsImpl: no currency at all, using ShellsAndPebbles")));
- aCurrSymbol.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "ShellsAndPebbles" ) );
+ aCurrSymbol = rtl::OUString("ShellsAndPebbles");
aCurrBankSymbol = aCurrSymbol;
nCurrPositiveFormat = nCurrNegativeFormat = nCurrFormatDefault;
nCurrDigits = 2;
@@ -641,13 +637,13 @@ void LocaleDataWrapper::getCurrSymbolsImpl()
}
-void LocaleDataWrapper::scanCurrFormatImpl( const String& rCode,
- xub_StrLen nStart, xub_StrLen& nSign, xub_StrLen& nPar,
- xub_StrLen& nNum, xub_StrLen& nBlank, xub_StrLen& nSym )
+void LocaleDataWrapper::scanCurrFormatImpl( const rtl::OUString& rCode,
+ sal_Int32 nStart, sal_Int32& nSign, sal_Int32& nPar,
+ sal_Int32& nNum, sal_Int32& nBlank, sal_Int32& nSym )
{
- nSign = nPar = nNum = nBlank = nSym = STRING_NOTFOUND;
- const sal_Unicode* const pStr = rCode.GetBuffer();
- const sal_Unicode* const pStop = pStr + rCode.Len();
+ nSign = nPar = nNum = nBlank = nSym = -1;
+ const sal_Unicode* const pStr = rCode.getStr();
+ const sal_Unicode* const pStop = pStr + rCode.getLength();
const sal_Unicode* p = pStr + nStart;
int nInSection = 0;
sal_Bool bQuote = sal_False;
@@ -667,17 +663,17 @@ void LocaleDataWrapper::scanCurrFormatImpl( const String& rCode,
bQuote = sal_True;
break;
case '-' :
- if ( !nInSection && nSign == STRING_NOTFOUND )
- nSign = (xub_StrLen)(p - pStr);
+ if (!nInSection && nSign == -1)
+ nSign = p - pStr;
break;
case '(' :
- if ( !nInSection && nPar == STRING_NOTFOUND )
- nPar = (xub_StrLen)(p - pStr);
+ if (!nInSection && nPar == -1)
+ nPar = p - pStr;
break;
case '0' :
case '#' :
- if ( !nInSection && nNum == STRING_NOTFOUND )
- nNum = (xub_StrLen)(p - pStr);
+ if (!nInSection && nNum == -1)
+ nNum = p - pStr;
break;
case '[' :
nInSection++;
@@ -686,17 +682,17 @@ void LocaleDataWrapper::scanCurrFormatImpl( const String& rCode,
if ( nInSection )
{
nInSection--;
- if ( !nInSection && nBlank == STRING_NOTFOUND
- && nSym != STRING_NOTFOUND && p < pStop-1 && *(p+1) == ' ' )
- nBlank = (xub_StrLen)(p - pStr + 1);
+ if (!nInSection && nBlank == -1
+ && nSym != -1 && p < pStop-1 && *(p+1) == ' ' )
+ nBlank = p - pStr + 1;
}
break;
case '$' :
- if ( nSym == STRING_NOTFOUND && nInSection && *(p-1) == '[' )
+ if (nSym == -1 && nInSection && *(p-1) == '[')
{
- nSym = (xub_StrLen)(p - pStr + 1);
- if ( nNum != STRING_NOTFOUND && *(p-2) == ' ' )
- nBlank = (xub_StrLen)(p - pStr - 2);
+ nSym = p - pStr + 1;
+ if (nNum != -1 && *(p-2) == ' ')
+ nBlank = p - pStr - 2;
}
break;
case ';' :
@@ -704,14 +700,14 @@ void LocaleDataWrapper::scanCurrFormatImpl( const String& rCode,
p = pStop;
break;
default:
- if ( !nInSection && nSym == STRING_NOTFOUND && rCode.Equals( aCurrSymbol, (xub_StrLen)(p-pStr), aCurrSymbol.Len() ) )
+ if (!nInSection && nSym == -1 && String(rCode).Equals( aCurrSymbol, (xub_StrLen)(p-pStr), aCurrSymbol.getLength()))
{ // currency symbol not surrounded by [$...]
- nSym = (xub_StrLen)(p - pStr);
- if ( nBlank == STRING_NOTFOUND && pStr < p && *(p-1) == ' ' )
- nBlank = (xub_StrLen)(p - pStr - 1);
- p += aCurrSymbol.Len() - 1;
- if ( nBlank == STRING_NOTFOUND && p < pStop-2 && *(p+2) == ' ' )
- nBlank = (xub_StrLen)(p - pStr + 2);
+ nSym = p - pStr;
+ if (nBlank == -1 && pStr < p && *(p-1) == ' ')
+ nBlank = p - pStr - 1;
+ p += aCurrSymbol.getLength() - 1;
+ if (nBlank == -1 && p < pStop-2 && *(p+2) == ' ')
+ nBlank = p - pStr + 2;
}
}
}
@@ -719,7 +715,6 @@ void LocaleDataWrapper::scanCurrFormatImpl( const String& rCode,
}
}
-
void LocaleDataWrapper::getCurrFormatsImpl()
{
NumberFormatCodeWrapper aNumberFormatCode( xSMgr, getLocale() );
@@ -772,18 +767,18 @@ void LocaleDataWrapper::getCurrFormatsImpl()
// make sure it's loaded
getCurrSymbol();
- xub_StrLen nSign, nPar, nNum, nBlank, nSym;
+ sal_Int32 nSign, nPar, nNum, nBlank, nSym;
// positive format
nElem = (nDef >= 0 ? nDef : (nNeg >= 0 ? nNeg : 0));
scanCurrFormatImpl( pFormatArr[nElem].Code, 0, nSign, nPar, nNum, nBlank, nSym );
- if (areChecksEnabled() && (nNum == STRING_NOTFOUND || nSym == STRING_NOTFOUND))
+ if (areChecksEnabled() && (nNum == -1 || nSym == -1))
{
rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getCurrFormatsImpl: CurrPositiveFormat?"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
- if ( nBlank == STRING_NOTFOUND )
+ if (nBlank == -1)
{
if ( nSym < nNum )
nCurrPositiveFormat = 0; // $1
@@ -804,17 +799,17 @@ void LocaleDataWrapper::getCurrFormatsImpl()
else
{
const ::rtl::OUString& rCode = pFormatArr[nNeg].Code;
- xub_StrLen nDelim = (xub_StrLen)rCode.indexOf( ';' );
+ sal_Int32 nDelim = rCode.indexOf(';');
scanCurrFormatImpl( rCode, nDelim+1, nSign, nPar, nNum, nBlank, nSym );
- if (areChecksEnabled() && (nNum == STRING_NOTFOUND ||
- nSym == STRING_NOTFOUND || (nPar == STRING_NOTFOUND &&
- nSign == STRING_NOTFOUND)))
+ if (areChecksEnabled() && (nNum == -1 ||
+ nSym == -1 || (nPar == -1 &&
+ nSign == -1)))
{
rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getCurrFormatsImpl: CurrNegativeFormat?"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
- if ( nBlank == STRING_NOTFOUND )
+ if (nBlank == -1)
{
if ( nSym < nNum )
{
@@ -894,7 +889,7 @@ DateFormat LocaleDataWrapper::getLongDateFormat() const
}
-DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode )
+DateFormat LocaleDataWrapper::scanDateFormatImpl( const rtl::OUString& rCode )
{
// Only some european versions were translated, the ones with different
// keyword combinations are:
@@ -902,35 +897,35 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode )
// Dutch DMJ, Finnish PKV
// default is English keywords for every other language
- xub_StrLen nDay = rCode.Search( 'D' );
- xub_StrLen nMonth = rCode.Search( 'M' );
- xub_StrLen nYear = rCode.Search( 'Y' );
- if ( nDay == STRING_NOTFOUND || nMonth == STRING_NOTFOUND || nYear == STRING_NOTFOUND )
+ sal_Int32 nDay = rCode.indexOf('D');
+ sal_Int32 nMonth = rCode.indexOf('M');
+ sal_Int32 nYear = rCode.indexOf('Y');
+ if (nDay == -1 || nMonth == -1 || nYear == -1)
{ // This algorithm assumes that all three parts (DMY) are present
- if ( nMonth == STRING_NOTFOUND )
+ if (nMonth == -1)
{ // only Finnish has something else than 'M' for month
- nMonth = rCode.Search( 'K' );
- if ( nMonth != STRING_NOTFOUND )
+ nMonth = rCode.indexOf('K');
+ if (nMonth != -1)
{
- nDay = rCode.Search( 'P' );
- nYear = rCode.Search( 'V' );
+ nDay = rCode.indexOf('P');
+ nYear = rCode.indexOf('V');
}
}
- else if ( nDay == STRING_NOTFOUND )
+ else if (nDay == -1)
{ // We have a month 'M' if we reach this branch.
// Possible languages containing 'M' but no 'D':
// German, French, Italian
- nDay = rCode.Search( 'T' ); // German
- if ( nDay != STRING_NOTFOUND )
- nYear = rCode.Search( 'J' );
+ nDay = rCode.indexOf('T'); // German
+ if (nDay != -1)
+ nYear = rCode.indexOf('J');
else
{
- nYear = rCode.Search( 'A' ); // French, Italian
- if ( nYear != STRING_NOTFOUND )
+ nYear = rCode.indexOf('A'); // French, Italian
+ if (nYear != -1)
{
- nDay = rCode.Search( 'J' ); // French
- if ( nDay == STRING_NOTFOUND )
- nDay = rCode.Search( 'G' ); // Italian
+ nDay = rCode.indexOf('J'); // French
+ if (nDay == -1)
+ nDay = rCode.indexOf('G'); // Italian
}
}
}
@@ -938,11 +933,11 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode )
{ // We have a month 'M' and a day 'D'.
// Possible languages containing 'D' and 'M' but not 'Y':
// Spanish, Dutch
- nYear = rCode.Search( 'A' ); // Spanish
- if ( nYear == STRING_NOTFOUND )
- nYear = rCode.Search( 'J' ); // Dutch
+ nYear = rCode.indexOf('A'); // Spanish
+ if (nYear == -1)
+ nYear = rCode.indexOf('J'); // Dutch
}
- if ( nDay == STRING_NOTFOUND || nMonth == STRING_NOTFOUND || nYear == STRING_NOTFOUND )
+ if (nDay == -1 || nMonth == -1 || nYear == -1)
{
if (areChecksEnabled())
{
@@ -950,17 +945,17 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode )
"LocaleDataWrapper::scanDateFormat: not all DMY present"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
- if ( nDay == STRING_NOTFOUND )
- nDay = rCode.Len();
- if ( nMonth == STRING_NOTFOUND )
- nMonth = rCode.Len();
- if ( nYear == STRING_NOTFOUND )
- nYear = rCode.Len();
+ if (nDay == -1)
+ nDay = rCode.getLength();
+ if (nMonth == -1)
+ nMonth = rCode.getLength();
+ if (nYear == -1)
+ nYear = rCode.getLength();
}
}
- // compare with <= because each position may equal rCode.Len()
+ // compare with <= because each position may equal rCode.getLength()
if ( nDay <= nMonth && nMonth <= nYear )
- return DMY; // also if every position equals rCode.Len()
+ return DMY; // also if every position equals rCode.getLength()
else if ( nMonth <= nDay && nDay <= nYear )
return MDY;
else if ( nYear <= nMonth && nMonth <= nDay )
@@ -1210,16 +1205,16 @@ static sal_Unicode* ImplAdd2UNum( sal_Unicode* pBuf, sal_uInt16 nNumber, int bLe
}
-inline sal_Unicode* ImplAddString( sal_Unicode* pBuf, const String& rStr )
+inline sal_Unicode* ImplAddString( sal_Unicode* pBuf, const rtl::OUString& rStr )
{
- if ( rStr.Len() == 1 )
- *pBuf++ = rStr.GetChar(0);
- else if ( rStr.Len() == 0 )
+ if ( rStr.getLength() == 1 )
+ *pBuf++ = rStr[0];
+ else if (rStr.isEmpty())
;
else
{
- memcpy( pBuf, rStr.GetBuffer(), rStr.Len() * sizeof(sal_Unicode) );
- pBuf += rStr.Len();
+ memcpy( pBuf, rStr.getStr(), rStr.getLength() * sizeof(sal_Unicode) );
+ pBuf += rStr.getLength();
}
return pBuf;
}
@@ -1302,7 +1297,7 @@ sal_Unicode* LocaleDataWrapper::ImplAddFormatNum( sal_Unicode* pBuf,
}
else
{
- const String& rThoSep = getNumThousandSep();
+ const rtl::OUString& rThoSep = getNumThousandSep();
// copy number to buffer (excluding decimals)
sal_uInt16 nNumLen2 = nNumLen-nDecimals;
@@ -1350,7 +1345,7 @@ sal_Unicode* LocaleDataWrapper::ImplAddFormatNum( sal_Unicode* pBuf,
// --- simple date and time formatting --------------------------------
-String LocaleDataWrapper::getDate( const Date& rDate ) const
+rtl::OUString LocaleDataWrapper::getDate( const Date& rDate ) const
{
::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
//!TODO: leading zeros et al
@@ -1393,11 +1388,11 @@ String LocaleDataWrapper::getDate( const Date& rDate ) const
pBuf = ImplAdd2UNum( pBuf, nDay, sal_True /* IsDateDayLeadingZero() */ );
}
- return String( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) );
+ return rtl::OUString(aBuf, pBuf-aBuf);
}
-String LocaleDataWrapper::getTime( const Time& rTime, sal_Bool bSec, sal_Bool b100Sec ) const
+rtl::OUString LocaleDataWrapper::getTime( const Time& rTime, sal_Bool bSec, sal_Bool b100Sec ) const
{
::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
//!TODO: leading zeros et al
@@ -1431,7 +1426,7 @@ String LocaleDataWrapper::getTime( const Time& rTime, sal_Bool bSec, sal_Bool b1
}
}
- String aStr( aBuf, (xub_StrLen)(sal_uLong)(pBuf-aBuf) );
+ rtl::OUString aStr(aBuf, pBuf - aBuf);
if ( bHour12 )
{
@@ -1445,7 +1440,7 @@ String LocaleDataWrapper::getTime( const Time& rTime, sal_Bool bSec, sal_Bool b1
}
-String LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCal,
+rtl::OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCal,
sal_Int16 nDisplayDayOfWeek, sal_Bool bDayOfMonthWithLeadingZero,
sal_Int16 nDisplayMonth, sal_Bool bTwoDigitYear ) const
{
@@ -1502,7 +1497,7 @@ String LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCal,
}
-String LocaleDataWrapper::getDuration( const Time& rTime, sal_Bool bSec, sal_Bool b100Sec ) const
+rtl::OUString LocaleDataWrapper::getDuration( const Time& rTime, sal_Bool bSec, sal_Bool b100Sec ) const
{
::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
sal_Unicode aBuf[128];
@@ -1541,13 +1536,13 @@ inline size_t ImplGetNumberStringLengthGuess( const LocaleDataWrapper& rLoc, sal
const size_t nDig = ((sizeof(sal_Int64) * 8) / 3) + 1;
// digits, separators (pessimized for insane "every digit may be grouped"), leading zero, sign
size_t nGuess = ((nDecimals < nDig) ?
- (((nDig - nDecimals) * rLoc.getNumThousandSep().Len()) + nDig) :
- nDecimals) + rLoc.getNumDecimalSep().Len() + 3;
+ (((nDig - nDecimals) * rLoc.getNumThousandSep().getLength()) + nDig) :
+ nDecimals) + rLoc.getNumDecimalSep().getLength() + 3;
return nGuess;
}
-String LocaleDataWrapper::getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
+rtl::OUString LocaleDataWrapper::getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
sal_Bool bUseThousandSep, sal_Bool bTrailingZeros ) const
{
::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
@@ -1567,8 +1562,8 @@ String LocaleDataWrapper::getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
}
-String LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
- const String& rCurrencySymbol, sal_Bool bUseThousandSep ) const
+rtl::OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
+ const rtl::OUString& rCurrencySymbol, sal_Bool bUseThousandSep ) const
{
::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
sal_Unicode aBuf[192];
@@ -1581,8 +1576,8 @@ String LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
new sal_Unicode[nGuess + 16]);
sal_Unicode* const pBuffer =
- ((size_t(rCurrencySymbol.Len()) + nGuess + 20) < SAL_N_ELEMENTS(aBuf) ? aBuf :
- new sal_Unicode[ rCurrencySymbol.Len() + nGuess + 20 ]);
+ ((size_t(rCurrencySymbol.getLength()) + nGuess + 20) < SAL_N_ELEMENTS(aBuf) ? aBuf :
+ new sal_Unicode[ rCurrencySymbol.getLength() + nGuess + 20 ]);
sal_Unicode* pBuf = pBuffer;
sal_Bool bNeg;
@@ -1797,7 +1792,7 @@ rtl::OUString LocaleDataWrapper::appendLocaleInfo(const rtl::OUString& rDebugMsg
// static
-void LocaleDataWrapper::outputCheckMessage( const String& rMsg )
+void LocaleDataWrapper::outputCheckMessage( const rtl::OUString& rMsg )
{
outputCheckMessage(rtl::OUStringToOString(rMsg, RTL_TEXTENCODING_UTF8).getStr());
}
diff --git a/vcl/inc/vcl/longcurr.hxx b/vcl/inc/vcl/longcurr.hxx
index 1981000..04564fd 100644
--- a/vcl/inc/vcl/longcurr.hxx
+++ b/vcl/inc/vcl/longcurr.hxx
@@ -51,10 +51,10 @@ protected:
BigInt mnMin;
BigInt mnMax;
BigInt mnCorrectedValue;
- String maCurrencySymbol;
- sal_uInt16 mnType;
- sal_uInt16 mnDecimalDigits;
- sal_Bool mbThousandSep;
+ rtl::OUString maCurrencySymbol;
+ sal_uInt16 mnType;
+ sal_uInt16 mnDecimalDigits;
+ sal_Bool mbThousandSep;
LongCurrencyFormatter();
public:
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 03fdc09..0bc5425 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -48,6 +48,7 @@
#include <unotools/localedatawrapper.hxx>
using namespace ::com::sun::star;
+using namespace ::comphelper;
// -----------------------------------------------------------------------
@@ -84,8 +85,8 @@ static sal_Bool ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt,
if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) ||
(nGroup == KEYGROUP_MISC) ||
((cChar >= '0') && (cChar <= '9')) ||
- (cChar == rLocaleDataWrappper.getNumDecimalSep() ) ||
- (bThousandSep && (cChar == rLocaleDataWrappper.getNumThousandSep())) ||
+ string::equals(rLocaleDataWrappper.getNumDecimalSep(), cChar) ||
+ (bThousandSep && string::equals(rLocaleDataWrappper.getNumThousandSep(), cChar)) ||
(cChar == '-') )
return sal_False;
else
@@ -111,7 +112,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, double& rValue,
return sal_False;
// Fuehrende und nachfolgende Leerzeichen entfernen
- aStr = comphelper::string::strip(aStr, ' ');
+ aStr = string::strip(aStr, ' ');
// Position des Dezimalpunktes suchen
nDecPos = aStr.Search( rLocaleDataWrappper.getNumDecimalSep() );
@@ -1080,7 +1081,7 @@ static FieldUnit ImplStringToMetric(const rtl::OUString &rMetricString)
{
// return FieldUnit
rtl::OUString aStr(rMetricString.toAsciiLowerCase());
- aStr = comphelper::string::remove(aStr, ' ');
+ aStr = string::remove(aStr, ' ');
for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it )
{
if ( it->first.Equals( aStr ) )
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 67b8270..4ed66e5 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -26,6 +26,7 @@
*
************************************************************************/
+#include <comphelper/string.hxx>
#include <tools/rc.h>
#include <vcl/svapp.hxx>
#include <vcl/sound.hxx>
@@ -48,6 +49,7 @@
#include <unotools/misccfg.hxx>
using namespace ::com::sun::star;
+using namespace ::comphelper;
// =======================================================================
@@ -2194,13 +2196,13 @@ static sal_Bool ImplTimeProcessKeyInput( Edit*, const KeyEvent& rKEvt,
if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) ||
(nGroup == KEYGROUP_MISC) ||
((cChar >= '0') && (cChar <= '9')) ||
- (cChar == rLocaleDataWrapper.getTimeSep()) ||
- ( ( rLocaleDataWrapper.getTimeAM().Search( cChar ) != STRING_NOTFOUND ) ) ||
- ( ( rLocaleDataWrapper.getTimePM().Search( cChar ) != STRING_NOTFOUND ) ) ||
+ string::equals(rLocaleDataWrapper.getTimeSep(), cChar) ||
+ (rLocaleDataWrapper.getTimeAM().indexOf(cChar) != -1) ||
+ (rLocaleDataWrapper.getTimePM().indexOf(cChar) != -1) ||
// Accept AM/PM:
(cChar == 'a') || (cChar == 'A') || (cChar == 'm') || (cChar == 'M') || (cChar == 'p') || (cChar == 'P') ||
- ((eFormat == TIMEF_100TH_SEC) && (cChar == rLocaleDataWrapper.getTime100SecSep())) ||
- ((eFormat == TIMEF_SEC_CS) && (cChar == rLocaleDataWrapper.getTime100SecSep())) ||
+ ((eFormat == TIMEF_100TH_SEC) && string::equals(rLocaleDataWrapper.getTime100SecSep(), cChar)) ||
+ ((eFormat == TIMEF_SEC_CS) && string::equals(rLocaleDataWrapper.getTime100SecSep(), cChar)) ||
(bDuration && (cChar == '-')) )
return sal_False;
else
@@ -2263,7 +2265,7 @@ static sal_Bool ImplTimeGetValue( const XubString& rStr, Time& rTime,
return sal_False;
// Nach Separatoren suchen
- if ( rLocaleDataWrapper.getTimeSep().Len() )
+ if (!rLocaleDataWrapper.getTimeSep().isEmpty())
{
XubString aSepStr( RTL_CONSTASCII_USTRINGPARAM( ",.;:/" ) );
if ( !bDuration )
@@ -2272,12 +2274,12 @@ static sal_Bool ImplTimeGetValue( const XubString& rStr, Time& rTime,
// Die obigen Zeichen durch das Separatorzeichen ersetzen
for ( xub_StrLen i = 0; i < aSepStr.Len(); i++ )
{
- if ( aSepStr.GetChar( i ) == rLocaleDataWrapper.getTimeSep() )
+ if (string::equals(rLocaleDataWrapper.getTimeSep(), aSepStr.GetChar(i)))
continue;
for ( xub_StrLen j = 0; j < aStr.Len(); j++ )
{
if ( aStr.GetChar( j ) == aSepStr.GetChar( i ) )
- aStr.SetChar( j, rLocaleDataWrapper.getTimeSep().GetChar(0) );
+ aStr.SetChar( j, rLocaleDataWrapper.getTimeSep()[0] );
}
}
}
diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx
index 8f4eb01..0ae610f 100644
--- a/vcl/source/control/longcurr.cxx
+++ b/vcl/source/control/longcurr.cxx
@@ -44,6 +44,7 @@
#include <unotools/localedatawrapper.hxx>
+using namespace ::comphelper;
// =======================================================================
@@ -126,8 +127,8 @@ static sal_Bool ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt,
if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) ||
(nGroup == KEYGROUP_MISC) ||
((cChar >= '0') && (cChar <= '9')) ||
- (bThousandSep && (cChar == rLocaleDataWrapper.getNumThousandSep())) ||
- (cChar == rLocaleDataWrapper.getNumDecimalSep() ) ||
+ (bThousandSep && string::equals(rLocaleDataWrapper.getNumThousandSep(), cChar)) ||
+ (string::equals(rLocaleDataWrapper.getNumDecimalSep(), cChar) ) ||
(cChar == '-') )
return sal_False;
else
@@ -153,7 +154,7 @@ static sal_Bool ImplNumericGetValue( const XubString& rStr, BigInt& rValue,
return sal_False;
// Fuehrende und nachfolgende Leerzeichen entfernen
- aStr = comphelper::string::strip(aStr, ' ');
+ aStr = string::strip(aStr, ' ');
// Position des Dezimalpunktes suchen
nDecPos = aStr.Search( rLocaleDataWrapper.getNumDecimalSep() );
@@ -360,7 +361,7 @@ void LongCurrencyFormatter::SetCurrencySymbol( const String& rStr )
String LongCurrencyFormatter::GetCurrencySymbol() const
{
- return maCurrencySymbol.Len() ? maCurrencySymbol : GetLocaleDataWrapper().getCurrSymbol();
+ return !maCurrencySymbol.isEmpty() ? maCurrencySymbol : GetLocaleDataWrapper().getCurrSymbol();
}
// -----------------------------------------------------------------------
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 9c825de..7221f2a 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -778,7 +778,7 @@ sal_Bool lcl_ValidChar( sal_Unicode cChar, const SvXMLNumFormatContext& rParent
if ( ( nFormatType == XML_TOK_STYLES_NUMBER_STYLE ||
nFormatType == XML_TOK_STYLES_CURRENCY_STYLE ||
nFormatType == XML_TOK_STYLES_PERCENTAGE_STYLE ) &&
- (cChar == (cTS = rParent.GetLocaleData().getNumThousandSep().GetChar(0)) ||
+ (cChar == (cTS = rParent.GetLocaleData().getNumThousandSep()[0]) ||
(cChar == ' ' && cTS == cNBSP)) )
{
// #i22394# Extra occurrences of thousands separator must be quoted, so they
commit 8e01e881451333eadb8e23f619e2b4014de1442a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jun 17 20:59:10 2012 +0100
add a route to compare a O[U]String to one code unit
Seems very awkward to create an entire temporary O[U]String just to compare it
to another when we want to know if that other contains just one char of a given
value
Change-Id: Iacd4e0d87dc5c5211fa06c61c55e1ed85b1e91f3
diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx
index 9088327..f5ec4a3 100644
--- a/comphelper/inc/comphelper/string.hxx
+++ b/comphelper/inc/comphelper/string.hxx
@@ -91,6 +91,26 @@ COMPHELPER_DLLPUBLIC rtl_uString * SAL_CALL rtl_uString_alloc(sal_Int32 nLen);
*/
COMPHELPER_DLLPUBLIC rtl_String * SAL_CALL rtl_string_alloc(sal_Int32 nLen);
+/** Compare an OString to a single char
+
+ @param rIn The input OString
+ @param c The character to compare againsg
+
+ @return true if rIn has one char and its equal to c
+ */
+inline bool equals(const rtl::OString& rIn, sal_Char c)
+{ return rIn.getLength() == 1 && rIn[0] == c; }
+
+/** Compare an OUString to a single char
+
+ @param rIn The input OUString
+ @param c The character to compare againsg
+
+ @return true if rIn has one char and its equal to c
+ */
+inline bool equals(const rtl::OUString& rIn, sal_Unicode c)
+{ return rIn.getLength() == 1 && rIn[0] == c; }
+
/** Removes all occurrences of a character from within the source string
@deprecated Use rtl::OString::replaceAll(rtl::OString(c), rtl::OString())
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index 96706ac..96dcebd 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -54,6 +54,7 @@ public:
void testDecimalStringToNumber();
void testIsdigitAsciiString();
void testReverseString();
+ void testEqualsString();
CPPUNIT_TEST_SUITE(TestString);
CPPUNIT_TEST(testNatural);
@@ -66,6 +67,7 @@ public:
CPPUNIT_TEST(testDecimalStringToNumber);
CPPUNIT_TEST(testIsdigitAsciiString);
CPPUNIT_TEST(testReverseString);
+ CPPUNIT_TEST(testEqualsString);
CPPUNIT_TEST_SUITE_END();
};
@@ -405,6 +407,17 @@ void TestString::testReverseString()
CPPUNIT_ASSERT(aOut == "CBA");
}
+void TestString::testEqualsString()
+{
+ ::rtl::OString aIn("A");
+ CPPUNIT_ASSERT(::comphelper::string::equals(aIn, 'A'));
+ CPPUNIT_ASSERT(!::comphelper::string::equals(aIn, 'B'));
+ aIn = ::rtl::OString("AA");
+ CPPUNIT_ASSERT(!::comphelper::string::equals(aIn, 'A'));
+ aIn = ::rtl::OString();
+ CPPUNIT_ASSERT(!::comphelper::string::equals(aIn, 'A'));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(TestString);
}
commit 40445a57c6256407bf2381ab456cb5ff58b2f6a8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jun 17 12:19:04 2012 +0100
use boost::noncopyable
Change-Id: I1a72115796dfe876fe20bc3fecd9897c90da8db5
diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx
index 14ba39e..6474ba0 100644
--- a/unotools/inc/unotools/localedatawrapper.hxx
+++ b/unotools/inc/unotools/localedatawrapper.hxx
@@ -29,6 +29,7 @@
#ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX
#define _UNOTOOLS_LOCALEDATAWRAPPER_HXX
+#include <boost/noncopyable.hpp>
#include <tools/string.hxx>
#include <com/sun/star/i18n/XLocaleData4.hpp>
#include <com/sun/star/i18n/LocaleItem.hpp>
@@ -62,7 +63,7 @@ enum MeasurementSystem {
};
-class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
+class UNOTOOLS_DLLPUBLIC LocaleDataWrapper : private boost::noncopyable
{
static sal_uInt8 nLocaleDataChecking; // 0:=dontknow, 1:=yes, 2:=no
@@ -90,11 +91,6 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
// dummies, to be implemented or provided by XML locale data
sal_Unicode cCurrZeroChar;
-
- // not implemented, prevent usage
- LocaleDataWrapper( const LocaleDataWrapper& );
- LocaleDataWrapper& operator=( const LocaleDataWrapper& );
-
// whenever Locale changes
void invalidateData();
commit 5819bec966782b844eb2953f6636a84a01212234
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jun 17 12:17:35 2012 +0100
ditch last (?) String::String(const sal_Unicode*)
Change-Id: I47ce16581a9923729a7e5e1e5cedaf91e4b215ac
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 70cf9a4..dcb752f 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1209,9 +1209,8 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
aFile = aUrl.PathToFileName();
else if ( INET_PROT_SMB == aUrl.GetProtocol() )
{
- // Convert smb notation to '\\'
- aFile = aUrl.GetMainURL( INetURLObject::NO_DECODE );
- aFile = String( aFile.GetBuffer() + 4 ); // skip the 'smb:' part
+ // Convert smb notation to '\\' and skip the 'smb:' part
+ aFile = aUrl.GetMainURL(INetURLObject::NO_DECODE).copy(4);
aFile.SearchAndReplaceAll( '/', '\\' );
aTarget = aFile;
}
diff --git a/unusedcode.easy b/unusedcode.easy
index 4d6601a..da7c664 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -70,6 +70,7 @@ SrchAttrItemList::Replace(SearchAttrItem const&, unsigned short)
SrchAttrItemList::Replace(SearchAttrItem const*, unsigned short, unsigned short)
SrchAttrItemList::_ForEach(unsigned short, unsigned short, unsigned char (*)(SearchAttrItem const&, void*), void*)
StgCache::Pos2Page(int)
+String::String(unsigned short const*)
SvLBoxButton::Check(SvLBox*, SvLBoxEntry*, unsigned char)
SvPtrarr::Replace(void* const*, unsigned short, unsigned short)
SvStringsISortDtor::Insert(String* const*, unsigned short)
diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx
index 9632f9e..16c0e2f 100644
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -102,7 +102,7 @@ private:
SAL_DLLPRIVATE void ImplInvalidateOrRepaint( xub_StrLen nStart = 0, xub_StrLen nEnd = STRING_LEN );
SAL_DLLPRIVATE void ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uInt8 nMode );
SAL_DLLPRIVATE void ImplSetText( const XubString& rStr, const Selection* pNewSelection = 0 );
- SAL_DLLPRIVATE void ImplInsertText( const XubString& rStr, const Selection* pNewSelection = 0, sal_Bool bIsUserInput = sal_False );
+ SAL_DLLPRIVATE void ImplInsertText( const rtl::OUString& rStr, const Selection* pNewSelection = 0, sal_Bool bIsUserInput = sal_False );
SAL_DLLPRIVATE String ImplGetValidString( const String& rString ) const;
SAL_DLLPRIVATE void ImplClearBackground( long nXStart, long nXEnd );
SAL_DLLPRIVATE void ImplShowCursor( sal_Bool bOnlyIfVisible = sal_True );
diff --git a/vcl/inc/vcl/i18nhelp.hxx b/vcl/inc/vcl/i18nhelp.hxx
index 610f5cf..0d1afb0 100644
--- a/vcl/inc/vcl/i18nhelp.hxx
+++ b/vcl/inc/vcl/i18nhelp.hxx
@@ -79,9 +79,9 @@ public:
I18nHelper( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, const ::com::sun::star::lang::Locale& rLocale );
~I18nHelper();
- sal_Int32 CompareString( const String& rStr1, const String& rStr2 ) const;
+ sal_Int32 CompareString( const rtl::OUString& rStr1, const rtl::OUString& rStr2 ) const;
- sal_Bool MatchString( const String& rStr1, const String& rStr2 ) const;
+ sal_Bool MatchString( const rtl::OUString& rStr1, const rtl::OUString& rStr2 ) const;
sal_Bool MatchMnemonic( const String& rString, sal_Unicode cMnemonicChar ) const;
String GetNum( long nNumber, sal_uInt16 nDecimals, sal_Bool bUseThousandSep = sal_True, sal_Bool bTrailingZeros = sal_True ) const;
diff --git a/vcl/source/app/i18nhelp.cxx b/vcl/source/app/i18nhelp.cxx
index ea4eb34..7e43afa 100644
--- a/vcl/source/app/i18nhelp.cxx
+++ b/vcl/source/app/i18nhelp.cxx
@@ -118,7 +118,7 @@ String vcl::I18nHelper::filterFormattingChars( const String& rStr )
return aBuf.makeStringAndClear();
}
-sal_Int32 vcl::I18nHelper::CompareString( const String& rStr1, const String& rStr2 ) const
+sal_Int32 vcl::I18nHelper::CompareString( const rtl::OUString& rStr1, const rtl::OUString& rStr2 ) const
{
::osl::Guard< ::osl::Mutex > aGuard( ((vcl::I18nHelper*)this)->maMutex );
@@ -137,7 +137,7 @@ sal_Int32 vcl::I18nHelper::CompareString( const String& rStr1, const String& rSt
return ImplGetTransliterationWrapper().compareString( aStr1, aStr2 );
}
-sal_Bool vcl::I18nHelper::MatchString( const String& rStr1, const String& rStr2 ) const
+sal_Bool vcl::I18nHelper::MatchString( const rtl::OUString& rStr1, const rtl::OUString& rStr2 ) const
{
::osl::Guard< ::osl::Mutex > aGuard( ((vcl::I18nHelper*)this)->maMutex );
@@ -164,7 +164,7 @@ sal_Bool vcl::I18nHelper::MatchMnemonic( const String& rString, sal_Unicode cMne
if ( n != STRING_NOTFOUND )
{
String aMatchStr( rString, n+1, STRING_LEN ); // not only one char, because of transliteration...
- bEqual = MatchString( cMnemonicChar, aMatchStr );
+ bEqual = MatchString( rtl::OUString(cMnemonicChar), aMatchStr );
}
return bEqual;
}
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index ca56cfd..a18208c 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -857,7 +857,7 @@ bool Edit::ImplTruncateToMaxLen( rtl::OUString& rStr, sal_uInt32 nSelectionLen )
// -----------------------------------------------------------------------
-void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_Bool bIsUserInput )
+void Edit::ImplInsertText( const rtl::OUString& rStr, const Selection* pNewSel, sal_Bool bIsUserInput )
{
Selection aSelection( maSelection );
aSelection.Justify();
@@ -873,9 +873,9 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_
maText.Erase( (xub_StrLen)aSelection.Max(), 1 );
// take care of input-sequence-checking now
- if (bIsUserInput && rStr.Len())
+ if (bIsUserInput && !rStr.isEmpty())
{
- DBG_ASSERT( rStr.Len() == 1, "unexpected string length. User input is expected to providse 1 char only!" );
+ DBG_ASSERT( rStr.getLength() == 1, "unexpected string length. User input is expected to providse 1 char only!" );
// determine if input-sequence-checking should be applied or not
//
@@ -920,7 +920,7 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_
}
//
uno::Reference < i18n::XBreakIterator > xBI( ImplGetBreakIterator(), UNO_QUERY );
- bIsInputSequenceChecking = rStr.Len() == 1 &&
+ bIsInputSequenceChecking = rStr.getLength() == 1 &&
bCTLFontEnabled &&
bCTLSequenceChecking &&
aSelection.Min() > 0 && /* first char needs not to be checked */
@@ -930,7 +930,7 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_
uno::Reference < i18n::XExtendedInputSequenceChecker > xISC;
if (bIsInputSequenceChecking && (xISC = ImplGetInputSequenceChecker()).is())
{
- sal_Unicode cChar = rStr.GetChar(0);
+ sal_Unicode cChar = rStr[0];
xub_StrLen nTmpPos = static_cast< xub_StrLen >( aSelection.Min() );
sal_Int16 nCheckMode = bCTLSequenceCheckingRestricted ?
i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
@@ -1826,7 +1826,7 @@ sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
bDone = sal_True; // Auch bei ReadOnly die Zeichen schlucken.
if ( !mbReadOnly )
{
- ImplInsertText( rKEvt.GetCharCode(), 0, sal_True );
+ ImplInsertText(rtl::OUString(rKEvt.GetCharCode()), 0, sal_True);
if ( maAutocompleteHdl.IsSet() )
{
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.Len()) )
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index e625a1f..67b8270 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -163,10 +163,10 @@ static int ImplIsPatternChar( xub_Unicode cChar, sal_Char cEditMask )
try
{
- String aCharStr( cChar );
- nType = ImplGetCharClass()->getStringType( aCharStr, 0, aCharStr.Len(), Application::GetSettings().GetLocale() );
+ rtl::OUString aCharStr(cChar);
+ nType = ImplGetCharClass()->getStringType( aCharStr, 0, aCharStr.getLength(), Application::GetSettings().GetLocale() );
}
- catch ( ::com::sun::star::uno::Exception& )
+ catch (const ::com::sun::star::uno::Exception&)
{
SAL_WARN( "vcl.control", "ImplIsPatternChar: Exception caught!" );
return sal_False;
@@ -213,7 +213,7 @@ static xub_Unicode ImplPatternChar( xub_Unicode cChar, sal_Char cEditMask )
(cEditMask == EDITMASK_UPPERALPHANUM) ||
( cEditMask == EDITMASK_UPPERALLCHAR ) )
{
- cChar = ImplGetCharClass()->toUpper( String(cChar),0,1,Application::GetSettings().GetLocale() )[0];
+ cChar = ImplGetCharClass()->toUpper(rtl::OUString(cChar), 0, 1, Application::GetSettings().GetLocale())[0];
}
return cChar;
}
commit 0e0aca151b36462cf5f5592fa7e7d21b5c96472d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jun 16 14:12:33 2012 +0100
callcatcher: drop unused macro-generated GetChildWindowId methods
add _WITHID variants for the cases where we (apparently?) still need
them.
Change-Id: I3b8290869368487f04ecd93a5f3a717de7fd10b4
diff --git a/avmedia/inc/avmedia/mediaplayer.hxx b/avmedia/inc/avmedia/mediaplayer.hxx
index f0d6820..8433f04 100644
--- a/avmedia/inc/avmedia/mediaplayer.hxx
+++ b/avmedia/inc/avmedia/mediaplayer.hxx
@@ -56,7 +56,7 @@ public:
MediaPlayer( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
~MediaPlayer();
- SFX_DECL_CHILDWINDOW( MediaPlayer );
+ SFX_DECL_CHILDWINDOW_WITHID( MediaPlayer );
};
// ----------------
diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx
index 350e4e9..c6b35df 100644
--- a/avmedia/source/framework/mediaplayer.cxx
+++ b/avmedia/source/framework/mediaplayer.cxx
@@ -62,7 +62,7 @@ MediaPlayer::~MediaPlayer()
// -----------------------------------------------------------------------------
-SFX_IMPL_DOCKINGWINDOW( MediaPlayer, SID_AVMEDIA_PLAYER )
+SFX_IMPL_DOCKINGWINDOW_WITHID( MediaPlayer, SID_AVMEDIA_PLAYER )
// ----------------
// - MediaFloater -
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a63fb3b..f8c69a4 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -127,7 +127,7 @@ ScTextWndBase::ScTextWndBase( Window* pParent, WinBits nStyle )
// class ScInputWindowWrapper
//==================================================================
-SFX_IMPL_CHILDWINDOW(ScInputWindowWrapper,FID_INPUTLINE_STATUS)
+SFX_IMPL_CHILDWINDOW_WITHID(ScInputWindowWrapper,FID_INPUTLINE_STATUS)
ScInputWindowWrapper::ScInputWindowWrapper( Window* pParentP,
sal_uInt16 nId,
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index 1356fe1..093b579 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -51,7 +51,7 @@
// -----------------------------------------------------------------------
-SFX_IMPL_DOCKINGWINDOW( ScFunctionChildWindow, FID_FUNCTION_BOX )
+SFX_IMPL_DOCKINGWINDOW_WITHID( ScFunctionChildWindow, FID_FUNCTION_BOX )
/*************************************************************************
#* Member: ScFunctionChildWindow
diff --git a/sc/source/ui/inc/dwfunctr.hxx b/sc/source/ui/inc/dwfunctr.hxx
index 5e18492..9da65a9 100644
--- a/sc/source/ui/inc/dwfunctr.hxx
+++ b/sc/source/ui/inc/dwfunctr.hxx
@@ -53,7 +53,7 @@ class ScFunctionChildWindow : public SfxChildWindow
ScFunctionChildWindow( Window*, sal_uInt16, SfxBindings*,
SfxChildWinInfo* );
- SFX_DECL_CHILDWINDOW(ScFunctionChildWindow);
+ SFX_DECL_CHILDWINDOW_WITHID(ScFunctionChildWindow);
};
/*************************************************************************
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 66e7eed..c5462e2 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -325,7 +325,7 @@ public:
SfxBindings* pBindings,
SfxChildWinInfo* pInfo );
- SFX_DECL_CHILDWINDOW(ScInputWindowWrapper);
+ SFX_DECL_CHILDWINDOW_WITHID(ScInputWindowWrapper);
};
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index 07a751c..e1db89d 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -37,33 +37,34 @@
class Class : public SfxChildWindow \
{ \
public: \
- Class( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* ); \
+ Class( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* ); \
SFX_DECL_CHILDWINDOW(Class); \
};
+#define DECL_WRAPPER_WITHID(Class) \
+ class Class : public SfxChildWindow \
+ { \
+ public: \
+ Class( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* ); \
+ SFX_DECL_CHILDWINDOW_WITHID(Class); \
+ };
//==================================================================
-DECL_WRAPPER(ScNameDlgWrapper)
-DECL_WRAPPER(ScNameDefDlgWrapper)
-DECL_WRAPPER(ScSolverDlgWrapper)
-DECL_WRAPPER(ScOptSolverDlgWrapper)
-DECL_WRAPPER(ScPivotLayoutWrapper)
-DECL_WRAPPER(ScTabOpDlgWrapper)
-DECL_WRAPPER(ScFilterDlgWrapper)
-DECL_WRAPPER(ScSpecialFilterDlgWrapper)
-DECL_WRAPPER(ScDbNameDlgWrapper)
-DECL_WRAPPER(ScConsolidateDlgWrapper)
-DECL_WRAPPER(ScPrintAreasDlgWrapper)
-DECL_WRAPPER(ScColRowNameRangesDlgWrapper)
-DECL_WRAPPER(ScFormulaDlgWrapper)
-DECL_WRAPPER(ScHighlightChgDlgWrapper)
-
-/*!!! dafuer muss der Funktionsautopilot noch umgebaut werden
-DECL_WRAPPER(ScFunctionDlgWrapper)
-DECL_WRAPPER(ScEditFunctionDlgWrapper)
-DECL_WRAPPER(ScArgumentDlgWrapper)
-*/
+DECL_WRAPPER_WITHID(ScNameDlgWrapper)
+DECL_WRAPPER_WITHID(ScNameDefDlgWrapper)
+DECL_WRAPPER_WITHID(ScSolverDlgWrapper)
+DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper)
+DECL_WRAPPER_WITHID(ScPivotLayoutWrapper)
+DECL_WRAPPER_WITHID(ScTabOpDlgWrapper)
+DECL_WRAPPER_WITHID(ScFilterDlgWrapper)
+DECL_WRAPPER_WITHID(ScSpecialFilterDlgWrapper)
+DECL_WRAPPER_WITHID(ScDbNameDlgWrapper)
+DECL_WRAPPER_WITHID(ScConsolidateDlgWrapper)
+DECL_WRAPPER_WITHID(ScPrintAreasDlgWrapper)
+DECL_WRAPPER_WITHID(ScColRowNameRangesDlgWrapper)
+DECL_WRAPPER_WITHID(ScFormulaDlgWrapper)
+DECL_WRAPPER_WITHID(ScHighlightChgDlgWrapper)
class ScAcceptChgDlgWrapper: public SfxChildWindow
{
@@ -73,7 +74,7 @@ class ScAcceptChgDlgWrapper: public SfxChildWindow
SfxBindings*,
SfxChildWinInfo* );
- SFX_DECL_CHILDWINDOW(Class);
+ SFX_DECL_CHILDWINDOW_WITHID(Class);
virtual void ReInitDlg();
};
@@ -86,7 +87,7 @@ class ScSimpleRefDlgWrapper: public SfxChildWindow
SfxBindings*,
SfxChildWinInfo* );
- SFX_DECL_CHILDWINDOW(Class);
+ SFX_DECL_CHILDWINDOW_WITHID(Class);
static void SetDefaultPosSize(Point aPos, Size aSize, sal_Bool bSet=sal_True);
virtual String GetRefString();
@@ -107,7 +108,7 @@ class SC_DLLPUBLIC ScValidityRefChildWin : public SfxChildWindow
Window * m_pSavedWndParent;
public:
ScValidityRefChildWin( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
- SFX_DECL_CHILDWINDOW(ScValidityRefChildWin);
+ SFX_DECL_CHILDWINDOW_WITHID(ScValidityRefChildWin);
~ScValidityRefChildWin();
bool LockVisible( bool bLock ){ bool bVis = m_bVisibleLock; m_bVisibleLock = bLock; return bVis; }
bool LockFreeWindow( bool bLock ){ bool bFreeWindow = m_bFreeWindowLock; m_bFreeWindowLock = bLock; return bFreeWindow; }
diff --git a/sc/source/ui/inc/spelldialog.hxx b/sc/source/ui/inc/spelldialog.hxx
index 8bf2172..3320377 100644
--- a/sc/source/ui/inc/spelldialog.hxx
+++ b/sc/source/ui/inc/spelldialog.hxx
@@ -51,7 +51,7 @@ class ScDocument;
class ScSpellDialogChildWindow : public ::svx::SpellDialogChildWindow
{
public:
- SFX_DECL_CHILDWINDOW( ScSpellDialogChildWindow );
+ SFX_DECL_CHILDWINDOW_WITHID( ScSpellDialogChildWindow );
explicit ScSpellDialogChildWindow( Window* pParent, sal_uInt16 nId,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list