summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-07-01 10:33:48 -0500
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-02 07:31:30 +0000
commit6a08067902ddc0ec61a7c7b4b0035b303f643a50 (patch)
treecd49d1824cd169d9d224925b836eaa70de27414e /unotools
parent82a1d75ee59c46e6bb361b98c520cc4eff2e770c (diff)
OUString convertion for unotools
Change-Id: Ifae7f344e3827875e32afa3cda23c771f5735707 Reviewed-on: https://gerrit.libreoffice.org/4659 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/defaultoptions.cxx96
-rw-r--r--unotools/source/config/fontcfg.cxx87
-rw-r--r--unotools/source/config/pathoptions.cxx217
-rw-r--r--unotools/source/config/securityoptions.cxx7
-rw-r--r--unotools/source/config/syslocaleoptions.cxx75
-rw-r--r--unotools/source/i18n/calendarwrapper.cxx13
-rw-r--r--unotools/source/i18n/charclass.cxx133
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx23
-rw-r--r--unotools/source/i18n/textsearch.cxx223
-rw-r--r--unotools/source/i18n/transliterationwrapper.cxx58
-rw-r--r--unotools/source/misc/fontcvt.cxx43
-rw-r--r--unotools/source/misc/fontdefs.cxx23
-rw-r--r--unotools/source/misc/syslocale.cxx11
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx112
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx54
-rw-r--r--unotools/source/ucbhelper/ucbstreamhelper.cxx24
16 files changed, 578 insertions, 621 deletions
diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx
index b31176cd6ed0..017d16308a25 100644
--- a/unotools/source/config/defaultoptions.cxx
+++ b/unotools/source/config/defaultoptions.cxx
@@ -67,32 +67,32 @@ using namespace com::sun::star::uno;
class SvtDefaultOptions_Impl : public utl::ConfigItem
{
public:
- String m_aAddinPath;
- String m_aAutoCorrectPath;
- String m_aAutoTextPath;
- String m_aBackupPath;
- String m_aBasicPath;
- String m_aBitmapPath;
- String m_aConfigPath;
- String m_aDictionaryPath;
- String m_aFavoritesPath;
- String m_aFilterPath;
- String m_aGalleryPath;
- String m_aGraphicPath;
- String m_aHelpPath;
- String m_aLinguisticPath;
- String m_aModulePath;
- String m_aPalettePath;
- String m_aPluginPath;
- String m_aTempPath;
- String m_aTemplatePath;
- String m_aUserConfigPath;
- String m_aWorkPath;
- String m_aUserDictionaryPath;
+ OUString m_aAddinPath;
+ OUString m_aAutoCorrectPath;
+ OUString m_aAutoTextPath;
+ OUString m_aBackupPath;
+ OUString m_aBasicPath;
+ OUString m_aBitmapPath;
+ OUString m_aConfigPath;
+ OUString m_aDictionaryPath;
+ OUString m_aFavoritesPath;
+ OUString m_aFilterPath;
+ OUString m_aGalleryPath;
+ OUString m_aGraphicPath;
+ OUString m_aHelpPath;
+ OUString m_aLinguisticPath;
+ OUString m_aModulePath;
+ OUString m_aPalettePath;
+ OUString m_aPluginPath;
+ OUString m_aTempPath;
+ OUString m_aTemplatePath;
+ OUString m_aUserConfigPath;
+ OUString m_aWorkPath;
+ OUString m_aUserDictionaryPath;
SvtDefaultOptions_Impl();
- String GetDefaultPath( sal_uInt16 nId ) const;
+ OUString GetDefaultPath( sal_uInt16 nId ) const;
virtual void Commit();
virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames);
};
@@ -102,7 +102,7 @@ public:
static SvtDefaultOptions_Impl* pOptions = NULL;
static sal_Int32 nRefCount = 0;
-typedef String SvtDefaultOptions_Impl:: *PathStrPtr;
+typedef OUString SvtDefaultOptions_Impl:: *PathStrPtr;
struct PathToDefaultMapping_Impl
{
@@ -185,7 +185,7 @@ void SvtDefaultOptions_Impl::Commit()
// class SvtDefaultOptions_Impl ------------------------------------------
-String SvtDefaultOptions_Impl::GetDefaultPath( sal_uInt16 nId ) const
+OUString SvtDefaultOptions_Impl::GetDefaultPath( sal_uInt16 nId ) const
{
OUString aRet;
sal_uInt16 nIdx = 0;
@@ -277,28 +277,28 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( "Office.Common/Pa
switch ( nProp )
{
- case DEFAULTPATH__ADDIN: m_aAddinPath = String( aFullPath ); break;
- case DEFAULTPATH__AUTOCORRECT: m_aAutoCorrectPath = String( aFullPath ); break;
- case DEFAULTPATH__AUTOTEXT: m_aAutoTextPath = String( aFullPath ); break;
- case DEFAULTPATH__BACKUP: m_aBackupPath = String( aFullPath ); break;
- case DEFAULTPATH__BASIC: m_aBasicPath = String( aFullPath ); break;
- case DEFAULTPATH__BITMAP: m_aBitmapPath = String( aFullPath ); break;
- case DEFAULTPATH__CONFIG: m_aConfigPath = String( aFullPath ); break;
- case DEFAULTPATH__DICTIONARY: m_aDictionaryPath = String( aFullPath ); break;
- case DEFAULTPATH__FAVORITES: m_aFavoritesPath = String( aFullPath ); break;
- case DEFAULTPATH__FILTER: m_aFilterPath = String( aFullPath ); break;
- case DEFAULTPATH__GALLERY: m_aGalleryPath = String( aFullPath ); break;
- case DEFAULTPATH__GRAPHIC: m_aGraphicPath = String( aFullPath ); break;
- case DEFAULTPATH__HELP: m_aHelpPath = String( aFullPath ); break;
- case DEFAULTPATH__LINGUISTIC: m_aLinguisticPath = String( aFullPath ); break;
- case DEFAULTPATH__MODULE: m_aModulePath = String( aFullPath ); break;
- case DEFAULTPATH__PALETTE: m_aPalettePath = String( aFullPath ); break;
- case DEFAULTPATH__PLUGIN: m_aPluginPath = String( aFullPath ); break;
- case DEFAULTPATH__TEMP: m_aTempPath = String( aFullPath ); break;
- case DEFAULTPATH__TEMPLATE: m_aTemplatePath = String( aFullPath ); break;
- case DEFAULTPATH__USERCONFIG: m_aUserConfigPath = String( aFullPath ); break;
- case DEFAULTPATH__WORK: m_aWorkPath = String( aFullPath ); break;
- case DEFAULTPATH__USERDICTIONARY: m_aUserDictionaryPath = String( aFullPath );break;
+ case DEFAULTPATH__ADDIN: m_aAddinPath = aFullPath; break;
+ case DEFAULTPATH__AUTOCORRECT: m_aAutoCorrectPath = aFullPath; break;
+ case DEFAULTPATH__AUTOTEXT: m_aAutoTextPath = aFullPath; break;
+ case DEFAULTPATH__BACKUP: m_aBackupPath = aFullPath; break;
+ case DEFAULTPATH__BASIC: m_aBasicPath = aFullPath; break;
+ case DEFAULTPATH__BITMAP: m_aBitmapPath = aFullPath; break;
+ case DEFAULTPATH__CONFIG: m_aConfigPath = aFullPath; break;
+ case DEFAULTPATH__DICTIONARY: m_aDictionaryPath = aFullPath; break;
+ case DEFAULTPATH__FAVORITES: m_aFavoritesPath = aFullPath; break;
+ case DEFAULTPATH__FILTER: m_aFilterPath = aFullPath; break;
+ case DEFAULTPATH__GALLERY: m_aGalleryPath = aFullPath; break;
+ case DEFAULTPATH__GRAPHIC: m_aGraphicPath = aFullPath; break;
+ case DEFAULTPATH__HELP: m_aHelpPath = aFullPath; break;
+ case DEFAULTPATH__LINGUISTIC: m_aLinguisticPath = aFullPath; break;
+ case DEFAULTPATH__MODULE: m_aModulePath = aFullPath; break;
+ case DEFAULTPATH__PALETTE: m_aPalettePath = aFullPath; break;
+ case DEFAULTPATH__PLUGIN: m_aPluginPath = aFullPath; break;
+ case DEFAULTPATH__TEMP: m_aTempPath = aFullPath; break;
+ case DEFAULTPATH__TEMPLATE: m_aTemplatePath = aFullPath; break;
+ case DEFAULTPATH__USERCONFIG: m_aUserConfigPath = aFullPath; break;
+ case DEFAULTPATH__WORK: m_aWorkPath = aFullPath; break;
+ case DEFAULTPATH__USERDICTIONARY: m_aUserDictionaryPath = aFullPath;break;
default:
SAL_WARN( "unotools.config", "invalid index to load a default path" );
@@ -340,7 +340,7 @@ SvtDefaultOptions::~SvtDefaultOptions()
// -----------------------------------------------------------------------
-String SvtDefaultOptions::GetDefaultPath( sal_uInt16 nId ) const
+OUString SvtDefaultOptions::GetDefaultPath( sal_uInt16 nId ) const
{
return pImp->GetDefaultPath( nId );
}
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 9da6e05c0d67..e44b8d22ba69 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -649,12 +649,12 @@ static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] =
// -----------------------------------------------------------------------
-static bool ImplKillLeading( String& rName, const char* const* ppStr )
+static bool ImplKillLeading( OUString& rName, const char* const* ppStr )
{
for(; *ppStr; ++ppStr )
{
const char* pStr = *ppStr;
- const sal_Unicode* pNameStr = rName.GetBuffer();
+ const sal_Unicode* pNameStr = rName.getStr();
while ( (*pNameStr == (sal_Unicode)(unsigned char)*pStr) && *pStr )
{
pNameStr++;
@@ -662,19 +662,19 @@ static bool ImplKillLeading( String& rName, const char* const* ppStr )
}
if ( !*pStr )
{
- xub_StrLen nLen = sal::static_int_cast<xub_StrLen>(pNameStr - rName.GetBuffer());
- rName.Erase( 0, nLen );
+ sal_Int32 nLen = (sal_Int32)(pNameStr - rName.getStr());
+ rName = rName.copy(nLen);
return true;
}
}
// special case for Baekmuk
// TODO: allow non-ASCII KillLeading list
- const sal_Unicode* pNameStr = rName.GetBuffer();
+ const sal_Unicode* pNameStr = rName.getStr();
if( (pNameStr[0]==0xBC31) && (pNameStr[1]==0xBC35) )
{
- xub_StrLen nLen = (pNameStr[2]==0x0020) ? 3 : 2;
- rName.Erase( 0, nLen );
+ sal_Int32 nLen = (pNameStr[2]==0x0020) ? 3 : 2;
+ rName = rName.copy(nLen);
return true;
}
@@ -683,13 +683,13 @@ static bool ImplKillLeading( String& rName, const char* const* ppStr )
// -----------------------------------------------------------------------
-static xub_StrLen ImplIsTrailing( const String& rName, const char* pStr )
+static sal_Int32 ImplIsTrailing( const OUString& rName, const char* pStr )
{
- xub_StrLen nStrLen = static_cast<xub_StrLen>( strlen( pStr ) );
- if( nStrLen >= rName.Len() )
+ sal_Int32 nStrLen = (sal_Int32)strlen( pStr );
+ if( nStrLen >= rName.getLength() )
return 0;
- const sal_Unicode* pEndName = rName.GetBuffer() + rName.Len();
+ const sal_Unicode* pEndName = rName.getStr() + rName.getLength();
const sal_Unicode* pNameStr = pEndName - nStrLen;
do if( *(pNameStr++) != *(pStr++) )
return 0;
@@ -700,14 +700,14 @@ static xub_StrLen ImplIsTrailing( const String& rName, const char* pStr )
// -----------------------------------------------------------------------
-static bool ImplKillTrailing( String& rName, const char* const* ppStr )
+static bool ImplKillTrailing( OUString& rName, const char* const* ppStr )
{
for(; *ppStr; ++ppStr )
{
- xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr );
+ sal_Int32 nTrailLen = ImplIsTrailing( rName, *ppStr );
if( nTrailLen )
{
- rName.Erase( rName.Len()-nTrailLen );
+ rName = rName.copy(0, rName.getLength() - nTrailLen );
return true;
}
}
@@ -717,11 +717,11 @@ static bool ImplKillTrailing( String& rName, const char* const* ppStr )
// -----------------------------------------------------------------------
-static bool ImplKillTrailingWithExceptions( String& rName, const char* const* ppStr )
+static bool ImplKillTrailingWithExceptions( OUString& rName, const char* const* ppStr )
{
for(; *ppStr; ++ppStr )
{
- xub_StrLen nTrailLen = ImplIsTrailing( rName, *ppStr );
+ sal_Int32 nTrailLen = ImplIsTrailing( rName, *ppStr );
if( nTrailLen )
{
// check string match against string exceptions
@@ -729,7 +729,7 @@ static bool ImplKillTrailingWithExceptions( String& rName, const char* const* pp
if( ImplIsTrailing( rName, *ppStr ) )
return false;
- rName.Erase( rName.Len()-nTrailLen );
+ rName = rName.copy(0, rName.getLength() - nTrailLen );
return true;
}
else
@@ -744,23 +744,24 @@ static bool ImplKillTrailingWithExceptions( String& rName, const char* const* pp
// -----------------------------------------------------------------------
-static sal_Bool ImplFindAndErase( String& rName, const char* pStr )
+static bool ImplFindAndErase( OUString& rName, const char* pStr )
{
- xub_StrLen nPos = rName.SearchAscii( pStr );
- if ( nPos == STRING_NOTFOUND )
- return sal_False;
-
- const char* pTempStr = pStr;
- while ( *pTempStr )
- pTempStr++;
- rName.Erase( nPos, (xub_StrLen)(pTempStr-pStr) );
- return sal_True;
+ sal_Int32 nLen = (sal_Int32)strlen(pStr);
+ sal_Int32 nPos = rName.indexOfAsciiL(pStr, nLen );
+ if ( nPos < 0 )
+ return false;
+
+ OUStringBuffer sBuff(rName);
+ sBuff.remove(nPos, nLen);
+ rName = sBuff.makeStringAndClear();
+ return true;
}
// =======================================================================
-void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortName,
- String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, sal_uLong& rType )
+void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rShortName,
+ OUString& rFamilyName, FontWeight& rWeight,
+ FontWidth& rWidth, sal_uLong& rType )
{
rShortName = rOrgName;
@@ -815,12 +816,13 @@ void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortN
// Remove numbers
// TODO: also remove localized and fullwidth digits
- xub_StrLen i = 0;
- while ( i < rFamilyName.Len() )
+ sal_Int32 i = 0;
+ OUStringBuffer sBuff(rFamilyName);
+ while ( i < sBuff.getLength() )
{
- sal_Unicode c = rFamilyName.GetChar( i );
+ sal_Unicode c = sBuff[ i ];
if ( (c >= 0x0030) && (c <= 0x0039) )
- rFamilyName.Erase( i, 1 );
+ sBuff.remove(i, 1);
else
i++;
}
@@ -830,7 +832,7 @@ void FontSubstConfiguration::getMapName( const String& rOrgName, String& rShortN
struct StrictStringSort : public ::std::binary_function< const FontNameAttr&, const FontNameAttr&, bool >
{
bool operator()( const FontNameAttr& rLeft, const FontNameAttr& rRight )
- { return rLeft.Name.CompareTo( rRight.Name ) == COMPARE_LESS ; }
+ { return rLeft.Name.compareTo( rRight.Name ) == -1 ; }
};
static const char* const pAttribNames[] =
@@ -910,7 +912,7 @@ static const enum_convert pWidthNames[] =
void FontSubstConfiguration::fillSubstVector( const com::sun::star::uno::Reference< XNameAccess > xFont,
const OUString& rType,
- std::vector< String >& rSubstVector ) const
+ std::vector< OUString >& rSubstVector ) const
{
try
{
@@ -1036,9 +1038,9 @@ unsigned long FontSubstConfiguration::getSubstType( const com::sun::star::uno::R
sal_Int32 nIndex = 0;
while( nIndex != -1 )
{
- String aToken( pLine->getToken( 0, ',', nIndex ) );
+ OUString aToken( pLine->getToken( 0, ',', nIndex ) );
for( int k = 0; k < 32; k++ )
- if( aToken.EqualsIgnoreCaseAscii( pAttribNames[k] ) )
+ if( aToken.equalsIgnoreAsciiCaseAscii( pAttribNames[k] ) )
{
type |= 1 << k;
break;
@@ -1137,15 +1139,14 @@ void FontSubstConfiguration::readLocaleSubst( const com::sun::star::lang::Locale
}
}
-const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontName, const Locale& rLocale ) const
+const FontNameAttr* FontSubstConfiguration::getSubstInfo( const OUString& rFontName, const Locale& rLocale ) const
{
- if( !rFontName.Len() )
+ if( rFontName.isEmpty() )
return NULL;
// search if a (language dep.) replacement table for the given font exists
// fallback is english
- String aSearchFont( rFontName );
- aSearchFont.ToLowerAscii();
+ OUString aSearchFont( rFontName.toAsciiLowerCase() );
FontNameAttr aSearchAttr;
aSearchAttr.Name = aSearchFont;
@@ -1172,8 +1173,8 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam
const FontNameAttr& rFoundAttr = *it;
// a search for "abcblack" may match with an entry for "abc"
// the reverse is not a good idea (e.g. #i112731# alba->albani)
- if( rFoundAttr.Name.Len() <= aSearchFont.Len() )
- if( aSearchFont.CompareTo( rFoundAttr.Name, rFoundAttr.Name.Len() ) == COMPARE_EQUAL )
+ if( rFoundAttr.Name.getLength() <= aSearchFont.getLength() )
+ if( aSearchFont.startsWith( rFoundAttr.Name))
return &rFoundAttr;
}
}
diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx
index 1cd2c54bdf3d..2acbea03de3f 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -21,6 +21,7 @@
#include <unotools/configitem.hxx>
#include <unotools/configmgr.hxx>
#include <tools/urlobj.hxx>
+#include <tools/solar.h>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <osl/mutex.hxx>
@@ -104,7 +105,7 @@ class SvtPathOptions_Impl
{
private:
// Local variables to return const references
- std::vector< String > m_aPathArray;
+ std::vector< OUString > m_aPathArray;
Reference< XFastPropertySet > m_xPathSettings;
Reference< XStringSubstitution > m_xSubstVariables;
Reference< XMacroExpander > m_xMacroExpander;
@@ -112,63 +113,63 @@ class SvtPathOptions_Impl
VarNameToEnumMap m_aMapVarNamesToEnum;
LanguageTag m_aLanguageTag;
- String m_aEmptyString;
+ OUString m_aEmptyString;
mutable ::osl::Mutex m_aMutex;
public:
SvtPathOptions_Impl();
// get the paths, not const because of using a mutex
- const String& GetPath( SvtPathOptions::Paths );
- const String& GetAddinPath() { return GetPath( SvtPathOptions::PATH_ADDIN ); }
- const String& GetAutoCorrectPath() { return GetPath( SvtPathOptions::PATH_AUTOCORRECT ); }
- const String& GetAutoTextPath() { return GetPath( SvtPathOptions::PATH_AUTOTEXT ); }
- const String& GetBackupPath() { return GetPath( SvtPathOptions::PATH_BACKUP ); }
- const String& GetBasicPath() { return GetPath( SvtPathOptions::PATH_BASIC ); }
- const String& GetBitmapPath() { return GetPath( SvtPathOptions::PATH_BITMAP ); }
- const String& GetConfigPath() { return GetPath( SvtPathOptions::PATH_CONFIG ); }
- const String& GetDictionaryPath() { return GetPath( SvtPathOptions::PATH_DICTIONARY ); }
- const String& GetFavoritesPath() { return GetPath( SvtPathOptions::PATH_FAVORITES ); }
- const String& GetFilterPath() { return GetPath( SvtPathOptions::PATH_FILTER ); }
- const String& GetGalleryPath() { return GetPath( SvtPathOptions::PATH_GALLERY ); }
- const String& GetGraphicPath() { return GetPath( SvtPathOptions::PATH_GRAPHIC ); }
- const String& GetHelpPath() { return GetPath( SvtPathOptions::PATH_HELP ); }
- const String& GetLinguisticPath() { return GetPath( SvtPathOptions::PATH_LINGUISTIC ); }
- const String& GetModulePath() { return GetPath( SvtPathOptions::PATH_MODULE ); }
- const String& GetPalettePath() { return GetPath( SvtPathOptions::PATH_PALETTE ); }
- const String& GetPluginPath() { return GetPath( SvtPathOptions::PATH_PLUGIN ); }
- const String& GetStoragePath() { return GetPath( SvtPathOptions::PATH_STORAGE ); }
- const String& GetTempPath() { return GetPath( SvtPathOptions::PATH_TEMP ); }
- const String& GetTemplatePath() { return GetPath( SvtPathOptions::PATH_TEMPLATE ); }
- const String& GetUserConfigPath() { return GetPath( SvtPathOptions::PATH_USERCONFIG ); }
- const String& GetWorkPath() { return GetPath( SvtPathOptions::PATH_WORK ); }
- const String& GetUIConfigPath() { return GetPath( SvtPathOptions::PATH_UICONFIG ); }
- const String& GetFingerprintPath() { return GetPath( SvtPathOptions::PATH_FINGERPRINT ); }
+ const OUString& GetPath( SvtPathOptions::Paths );
+ const OUString& GetAddinPath() { return GetPath( SvtPathOptions::PATH_ADDIN ); }
+ const OUString& GetAutoCorrectPath() { return GetPath( SvtPathOptions::PATH_AUTOCORRECT ); }
+ const OUString& GetAutoTextPath() { return GetPath( SvtPathOptions::PATH_AUTOTEXT ); }
+ const OUString& GetBackupPath() { return GetPath( SvtPathOptions::PATH_BACKUP ); }
+ const OUString& GetBasicPath() { return GetPath( SvtPathOptions::PATH_BASIC ); }
+ const OUString& GetBitmapPath() { return GetPath( SvtPathOptions::PATH_BITMAP ); }
+ const OUString& GetConfigPath() { return GetPath( SvtPathOptions::PATH_CONFIG ); }
+ const OUString& GetDictionaryPath() { return GetPath( SvtPathOptions::PATH_DICTIONARY ); }
+ const OUString& GetFavoritesPath() { return GetPath( SvtPathOptions::PATH_FAVORITES ); }
+ const OUString& GetFilterPath() { return GetPath( SvtPathOptions::PATH_FILTER ); }
+ const OUString& GetGalleryPath() { return GetPath( SvtPathOptions::PATH_GALLERY ); }
+ const OUString& GetGraphicPath() { return GetPath( SvtPathOptions::PATH_GRAPHIC ); }
+ const OUString& GetHelpPath() { return GetPath( SvtPathOptions::PATH_HELP ); }
+ const OUString& GetLinguisticPath() { return GetPath( SvtPathOptions::PATH_LINGUISTIC ); }
+ const OUString& GetModulePath() { return GetPath( SvtPathOptions::PATH_MODULE ); }
+ const OUString& GetPalettePath() { return GetPath( SvtPathOptions::PATH_PALETTE ); }
+ const OUString& GetPluginPath() { return GetPath( SvtPathOptions::PATH_PLUGIN ); }
+ const OUString& GetStoragePath() { return GetPath( SvtPathOptions::PATH_STORAGE ); }
+ const OUString& GetTempPath() { return GetPath( SvtPathOptions::PATH_TEMP ); }
+ const OUString& GetTemplatePath() { return GetPath( SvtPathOptions::PATH_TEMPLATE ); }
+ const OUString& GetUserConfigPath() { return GetPath( SvtPathOptions::PATH_USERCONFIG ); }
+ const OUString& GetWorkPath() { return GetPath( SvtPathOptions::PATH_WORK ); }
+ const OUString& GetUIConfigPath() { return GetPath( SvtPathOptions::PATH_UICONFIG ); }
+ const OUString& GetFingerprintPath() { return GetPath( SvtPathOptions::PATH_FINGERPRINT ); }
// set the paths
- void SetPath( SvtPathOptions::Paths, const String& rNewPath );
- void SetAddinPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_ADDIN, rPath ); }
- void SetAutoCorrectPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_AUTOCORRECT, rPath ); }
- void SetAutoTextPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_AUTOTEXT, rPath ); }
- void SetBackupPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BACKUP, rPath ); }
- void SetBasicPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BASIC, rPath ); }
- void SetBitmapPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BITMAP, rPath ); }
- void SetConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_CONFIG, rPath ); }
- void SetDictionaryPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_DICTIONARY, rPath ); }
- void SetFavoritesPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_FAVORITES, rPath ); }
- void SetFilterPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_FILTER, rPath ); }
- void SetGalleryPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_GALLERY, rPath ); }
- void SetGraphicPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_GRAPHIC, rPath ); }
- void SetHelpPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_HELP, rPath ); }
- void SetLinguisticPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_LINGUISTIC, rPath ); }
- void SetModulePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_MODULE, rPath ); }
- void SetPalettePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_PALETTE, rPath ); }
- void SetPluginPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_PLUGIN, rPath ); }
- void SetStoragePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_STORAGE, rPath ); }
- void SetTempPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_TEMP, rPath ); }
- void SetTemplatePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_TEMPLATE, rPath ); }
- void SetUserConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_USERCONFIG, rPath ); }
- void SetWorkPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_WORK, rPath ); }
+ void SetPath( SvtPathOptions::Paths, const OUString& rNewPath );
+ void SetAddinPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_ADDIN, rPath ); }
+ void SetAutoCorrectPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_AUTOCORRECT, rPath ); }
+ void SetAutoTextPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_AUTOTEXT, rPath ); }
+ void SetBackupPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_BACKUP, rPath ); }
+ void SetBasicPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_BASIC, rPath ); }
+ void SetBitmapPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_BITMAP, rPath ); }
+ void SetConfigPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_CONFIG, rPath ); }
+ void SetDictionaryPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_DICTIONARY, rPath ); }
+ void SetFavoritesPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_FAVORITES, rPath ); }
+ void SetFilterPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_FILTER, rPath ); }
+ void SetGalleryPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_GALLERY, rPath ); }
+ void SetGraphicPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_GRAPHIC, rPath ); }
+ void SetHelpPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_HELP, rPath ); }
+ void SetLinguisticPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_LINGUISTIC, rPath ); }
+ void SetModulePath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_MODULE, rPath ); }
+ void SetPalettePath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_PALETTE, rPath ); }
+ void SetPluginPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_PLUGIN, rPath ); }
+ void SetStoragePath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_STORAGE, rPath ); }
+ void SetTempPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_TEMP, rPath ); }
+ void SetTemplatePath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_TEMPLATE, rPath ); }
+ void SetUserConfigPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_USERCONFIG, rPath ); }
+ void SetWorkPath( const OUString& rPath ) { SetPath( SvtPathOptions::PATH_WORK, rPath ); }
OUString SubstVar( const OUString& rVar ) const;
OUString ExpandMacros( const OUString& rPath ) const;
@@ -233,7 +234,7 @@ static VarNameAttribute aVarNameAttribute[] =
// class SvtPathOptions_Impl ---------------------------------------------
-const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Paths ePath )
+const OUString& SvtPathOptions_Impl::GetPath( SvtPathOptions::Paths ePath )
{
if ( ePath >= SvtPathOptions::PATH_COUNT )
return m_aEmptyString;
@@ -272,7 +273,7 @@ const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Paths ePath )
return m_aEmptyString;
}
-void SvtPathOptions_Impl::SetPath( SvtPathOptions::Paths ePath, const String& rNewPath )
+void SvtPathOptions_Impl::SetPath( SvtPathOptions::Paths ePath, const OUString& rNewPath )
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -341,7 +342,7 @@ OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const
OUString aWorkText = rVar;
// Convert the returned path to system path!
- sal_Bool bConvertLocal = sal_False;
+ bool bConvertLocal = false;
// Search for first occure of "$(...".
sal_Int32 nPosition = aWorkText.indexOf( SIGN_STARTVARIABLE ); // = first position of "$(" in string
@@ -367,7 +368,7 @@ OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const
// Look for special variable that needs a system path.
VarNameToEnumMap::const_iterator pIter = m_aMapVarNamesToEnum.find( aSubString );
if ( pIter != m_aMapVarNamesToEnum.end() )
- bConvertLocal = sal_True;
+ bConvertLocal = true;
nPosition += nLength;
@@ -395,7 +396,7 @@ OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const
}
}
- aWorkText = m_xSubstVariables->substituteVariables( rVar, sal_False );
+ aWorkText = m_xSubstVariables->substituteVariables( rVar, false );
if ( bConvertLocal )
{
@@ -495,320 +496,320 @@ SvtPathOptions::~SvtPathOptions()
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetAddinPath() const
+const OUString& SvtPathOptions::GetAddinPath() const
{
return pImp->GetAddinPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetAutoCorrectPath() const
+const OUString& SvtPathOptions::GetAutoCorrectPath() const
{
return pImp->GetAutoCorrectPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetAutoTextPath() const
+const OUString& SvtPathOptions::GetAutoTextPath() const
{
return pImp->GetAutoTextPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetBackupPath() const
+const OUString& SvtPathOptions::GetBackupPath() const
{
return pImp->GetBackupPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetBasicPath() const
+const OUString& SvtPathOptions::GetBasicPath() const
{
return pImp->GetBasicPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetBitmapPath() const
+const OUString& SvtPathOptions::GetBitmapPath() const
{
return pImp->GetBitmapPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetConfigPath() const
+const OUString& SvtPathOptions::GetConfigPath() const
{
return pImp->GetConfigPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetDictionaryPath() const
+const OUString& SvtPathOptions::GetDictionaryPath() const
{
return pImp->GetDictionaryPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetFavoritesPath() const
+const OUString& SvtPathOptions::GetFavoritesPath() const
{
return pImp->GetFavoritesPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetFilterPath() const
+const OUString& SvtPathOptions::GetFilterPath() const
{
return pImp->GetFilterPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetGalleryPath() const
+const OUString& SvtPathOptions::GetGalleryPath() const
{
return pImp->GetGalleryPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetGraphicPath() const
+const OUString& SvtPathOptions::GetGraphicPath() const
{
return pImp->GetGraphicPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetHelpPath() const
+const OUString& SvtPathOptions::GetHelpPath() const
{
return pImp->GetHelpPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetLinguisticPath() const
+const OUString& SvtPathOptions::GetLinguisticPath() const
{
return pImp->GetLinguisticPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetFingerprintPath() const
+const OUString& SvtPathOptions::GetFingerprintPath() const
{
return pImp->GetFingerprintPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetModulePath() const
+const OUString& SvtPathOptions::GetModulePath() const
{
return pImp->GetModulePath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetPalettePath() const
+const OUString& SvtPathOptions::GetPalettePath() const
{
return pImp->GetPalettePath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetPluginPath() const
+const OUString& SvtPathOptions::GetPluginPath() const
{
return pImp->GetPluginPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetStoragePath() const
+const OUString& SvtPathOptions::GetStoragePath() const
{
return pImp->GetStoragePath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetTempPath() const
+const OUString& SvtPathOptions::GetTempPath() const
{
return pImp->GetTempPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetTemplatePath() const
+const OUString& SvtPathOptions::GetTemplatePath() const
{
return pImp->GetTemplatePath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetUserConfigPath() const
+const OUString& SvtPathOptions::GetUserConfigPath() const
{
return pImp->GetUserConfigPath();
}
-const String& SvtPathOptions::GetUIConfigPath() const
+const OUString& SvtPathOptions::GetUIConfigPath() const
{
return pImp->GetUIConfigPath();
}
// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetWorkPath() const
+const OUString& SvtPathOptions::GetWorkPath() const
{
return pImp->GetWorkPath();
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetAddinPath( const String& rPath )
+void SvtPathOptions::SetAddinPath( const OUString& rPath )
{
pImp->SetAddinPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetAutoCorrectPath( const String& rPath )
+void SvtPathOptions::SetAutoCorrectPath( const OUString& rPath )
{
pImp->SetAutoCorrectPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetAutoTextPath( const String& rPath )
+void SvtPathOptions::SetAutoTextPath( const OUString& rPath )
{
pImp->SetAutoTextPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetBackupPath( const String& rPath )
+void SvtPathOptions::SetBackupPath( const OUString& rPath )
{
pImp->SetBackupPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetBasicPath( const String& rPath )
+void SvtPathOptions::SetBasicPath( const OUString& rPath )
{
pImp->SetBasicPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetBitmapPath( const String& rPath )
+void SvtPathOptions::SetBitmapPath( const OUString& rPath )
{
pImp->SetBitmapPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetConfigPath( const String& rPath )
+void SvtPathOptions::SetConfigPath( const OUString& rPath )
{
pImp->SetConfigPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetDictionaryPath( const String& rPath )
+void SvtPathOptions::SetDictionaryPath( const OUString& rPath )
{
pImp->SetDictionaryPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetFavoritesPath( const String& rPath )
+void SvtPathOptions::SetFavoritesPath( const OUString& rPath )
{
pImp->SetFavoritesPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetFilterPath( const String& rPath )
+void SvtPathOptions::SetFilterPath( const OUString& rPath )
{
pImp->SetFilterPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetGalleryPath( const String& rPath )
+void SvtPathOptions::SetGalleryPath( const OUString& rPath )
{
pImp->SetGalleryPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetGraphicPath( const String& rPath )
+void SvtPathOptions::SetGraphicPath( const OUString& rPath )
{
pImp->SetGraphicPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetHelpPath( const String& rPath )
+void SvtPathOptions::SetHelpPath( const OUString& rPath )
{
pImp->SetHelpPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetLinguisticPath( const String& rPath )
+void SvtPathOptions::SetLinguisticPath( const OUString& rPath )
{
pImp->SetLinguisticPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetModulePath( const String& rPath )
+void SvtPathOptions::SetModulePath( const OUString& rPath )
{
pImp->SetModulePath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetPalettePath( const String& rPath )
+void SvtPathOptions::SetPalettePath( const OUString& rPath )
{
pImp->SetPalettePath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetPluginPath( const String& rPath )
+void SvtPathOptions::SetPluginPath( const OUString& rPath )
{
pImp->SetPluginPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetStoragePath( const String& rPath )
+void SvtPathOptions::SetStoragePath( const OUString& rPath )
{
pImp->SetStoragePath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetTempPath( const String& rPath )
+void SvtPathOptions::SetTempPath( const OUString& rPath )
{
pImp->SetTempPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetTemplatePath( const String& rPath )
+void SvtPathOptions::SetTemplatePath( const OUString& rPath )
{
pImp->SetTemplatePath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetUserConfigPath( const String& rPath )
+void SvtPathOptions::SetUserConfigPath( const OUString& rPath )
{
pImp->SetUserConfigPath( rPath );
}
// -----------------------------------------------------------------------
-void SvtPathOptions::SetWorkPath( const String& rPath )
+void SvtPathOptions::SetWorkPath( const OUString& rPath )
{
pImp->SetWorkPath( rPath );
}
@@ -836,24 +837,24 @@ OUString SvtPathOptions::UseVariable( const OUString& rPath ) const
// -----------------------------------------------------------------------
-sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Paths ePath )
+bool SvtPathOptions::SearchFile( OUString& rIniFile, Paths ePath )
{
// check parameter: empty inifile name?
- if ( !rIniFile.Len() )
+ if ( rIniFile.isEmpty() )
{
SAL_WARN( "unotools.config", "SvtPathOptions::SearchFile(): invalid parameter" );
- return sal_False;
+ return false;
}
OUString aIniFile = pImp->SubstVar( rIniFile );
- sal_Bool bRet = sal_False;
+ bool bRet = false;
switch ( ePath )
{
case PATH_USERCONFIG:
{
// path is a URL
- bRet = sal_True;
+ bRet = true;
INetURLObject aObj( GetUserConfigPath() );
sal_Int32 nIniIndex = 0;
@@ -912,12 +913,12 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Paths ePath )
sal_Int32 nPathIndex = 0;
do
{
- sal_Bool bIsURL = sal_True;
+ bool bIsURL = true;
OUString aPathToken = aPath.getToken( 0, SEARCHPATH_DELIMITER, nPathIndex );
INetURLObject aObj( aPathToken );
if ( aObj.HasError() )
{
- bIsURL = sal_False;
+ bIsURL = false;
OUString aURL;
if ( LocalFileHelper::ConvertPhysicalNameToURL( aPathToken, aURL ) )
aObj.SetURL( aURL );
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx
index cd0e6c7ba2ed..3abe34af1a4c 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -704,9 +704,8 @@ void SvtSecurityOptions_Impl::Commit()
sal_Int32 nCnt = m_seqTrustedAuthors.getLength();
if( nCnt )
{
- String s;
- s.AppendAscii( CSTR_MACRO_TRUSTEDAUTHORS );
- s.AppendAscii( "/a" );
+ OUString s(CSTR_MACRO_TRUSTEDAUTHORS);
+ s += "/a";
Sequence< Sequence< com::sun::star::beans::PropertyValue > > lPropertyValuesSeq( nCnt );
for( sal_Int32 i = 0 ; i < nCnt ; ++i )
@@ -908,7 +907,7 @@ sal_Bool SvtSecurityOptions_Impl::IsSecureURL( const OUString& sURL ,
}
if ( !bState )
- bState = sRef.compareToAscii("private:user") == COMPARE_EQUAL;
+ bState = sRef.compareToAscii("private:user") == 0;
}
}
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index 372387f2b1e9..31879c400496 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -32,7 +32,7 @@
#include "itemholder1.hxx"
-#define CFG_READONLY_DEFAULT sal_False
+#define CFG_READONLY_DEFAULT false
using namespace osl;
using namespace utl;
@@ -56,15 +56,15 @@ class SvtSysLocaleOptions_Impl : public utl::ConfigItem
OUString m_aUILocaleString; // en-US or de-DE or empty for SYSTEM
OUString m_aCurrencyString; // USD-en-US or EUR-de-DE
OUString m_aDatePatternsString; // "Y-M-D;M-D"
- sal_Bool m_bDecimalSeparator; //use decimal separator same as locale
- sal_Bool m_bIgnoreLanguageChange; //OS language change doesn't affect LO document language
+ bool m_bDecimalSeparator; //use decimal separator same as locale
+ bool m_bIgnoreLanguageChange; //OS language change doesn't affect LO document language
- sal_Bool m_bROLocale;
- sal_Bool m_bROUILocale;
- sal_Bool m_bROCurrency;
- sal_Bool m_bRODatePatterns;
- sal_Bool m_bRODecimalSeparator;
- sal_Bool m_bROIgnoreLanguageChange;
+ bool m_bROLocale;
+ bool m_bROUILocale;
+ bool m_bROCurrency;
+ bool m_bRODatePatterns;
+ bool m_bRODecimalSeparator;
+ bool m_bROIgnoreLanguageChange;
static const Sequence< /* const */ OUString > GetPropertyNames();
void MakeRealLocale();
@@ -93,13 +93,13 @@ public:
{ return m_aDatePatternsString; }
void SetDatePatternsString( const OUString& rStr );
- sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;}
- void SetDecimalSeparatorAsLocale( sal_Bool bSet);
+ bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;}
+ void SetDecimalSeparatorAsLocale( bool bSet);
- sal_Bool IsIgnoreLanguageChange() const { return m_bIgnoreLanguageChange;}
- void SetIgnoreLanguageChange( sal_Bool bSet);
+ bool IsIgnoreLanguageChange() const { return m_bIgnoreLanguageChange;}
+ void SetIgnoreLanguageChange( bool bSet);
- sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const;
+ bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const;
const LanguageTag& GetRealLocale() { return m_aRealLocale; }
const LanguageTag& GetRealUILocale() { return m_aRealUILocale; }
};
@@ -145,13 +145,13 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
: ConfigItem( ROOTNODE_SYSLOCALE )
, m_aRealLocale( LANGUAGE_SYSTEM)
, m_aRealUILocale( LANGUAGE_SYSTEM)
- , m_bDecimalSeparator( sal_True )
+ , m_bDecimalSeparator( true )
, m_bROLocale(CFG_READONLY_DEFAULT)
, m_bROUILocale(CFG_READONLY_DEFAULT)
, m_bROCurrency(CFG_READONLY_DEFAULT)
, m_bRODatePatterns(CFG_READONLY_DEFAULT)
- , m_bRODecimalSeparator(sal_False)
- , m_bROIgnoreLanguageChange(sal_False)
+ , m_bRODecimalSeparator(false)
+ , m_bROIgnoreLanguageChange(false)
{
if ( IsValidConfigMgr() )
@@ -209,7 +209,7 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
break;
case PROPERTYHANDLE_DECIMALSEPARATOR:
{
- sal_Bool bValue = sal_Bool();
+ bool bValue = false;
if ( pValues[nProp] >>= bValue )
m_bDecimalSeparator = bValue;
else
@@ -233,7 +233,7 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
break;
case PROPERTYHANDLE_IGNORELANGCHANGE :
{
- sal_Bool bValue = sal_Bool();
+ bool bValue = false;
if ( pValues[nProp] >>= bValue )
m_bIgnoreLanguageChange = bValue;
else
@@ -289,9 +289,9 @@ void SvtSysLocaleOptions_Impl::MakeRealUILocale()
}
}
-sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const
+bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const
{
- sal_Bool bReadOnly = CFG_READONLY_DEFAULT;
+ bool bReadOnly = CFG_READONLY_DEFAULT;
switch(eOption)
{
case SvtSysLocaleOptions::E_LOCALE :
@@ -449,7 +449,7 @@ void SvtSysLocaleOptions_Impl::SetDatePatternsString( const OUString& rStr )
}
}
-void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet)
+void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( bool bSet)
{
if(bSet != m_bDecimalSeparator)
{
@@ -459,7 +459,7 @@ void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet)
}
}
-void SvtSysLocaleOptions_Impl::SetIgnoreLanguageChange( sal_Bool bSet)
+void SvtSysLocaleOptions_Impl::SetIgnoreLanguageChange( bool bSet)
{
if(bSet != m_bIgnoreLanguageChange)
{
@@ -572,7 +572,7 @@ Mutex& SvtSysLocaleOptions::GetMutex()
}
-sal_Bool SvtSysLocaleOptions::IsModified()
+bool SvtSysLocaleOptions::IsModified()
{
MutexGuard aGuard( GetMutex() );
return pOptions->IsModified();
@@ -636,63 +636,64 @@ void SvtSysLocaleOptions::SetDatePatternsConfigString( const OUString& rStr )
pOptions->SetDatePatternsString( rStr );
}
-sal_Bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const
+bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const
{
MutexGuard aGuard( GetMutex() );
return pOptions->IsDecimalSeparatorAsLocale();
}
-void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet)
+void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( bool bSet)
{
MutexGuard aGuard( GetMutex() );
pOptions->SetDecimalSeparatorAsLocale(bSet);
}
-sal_Bool SvtSysLocaleOptions::IsIgnoreLanguageChange() const
+bool SvtSysLocaleOptions::IsIgnoreLanguageChange() const
{
MutexGuard aGuard( GetMutex() );
return pOptions->IsIgnoreLanguageChange();
}
-void SvtSysLocaleOptions::SetIgnoreLanguageChange( sal_Bool bSet)
+void SvtSysLocaleOptions::SetIgnoreLanguageChange( bool bSet)
{
MutexGuard aGuard( GetMutex() );
pOptions->SetIgnoreLanguageChange(bSet);
}
-sal_Bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const
+bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const
{
MutexGuard aGuard( GetMutex() );
return pOptions->IsReadOnly( eOption );
}
// static
-void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev,
- LanguageType& eLang, const OUString& rConfigString )
+void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( OUString& rAbbrev,
+ LanguageType& eLang,
+ const OUString& rConfigString )
{
sal_Int32 nDelim = rConfigString.indexOf( '-' );
if ( nDelim >= 0 )
{
rAbbrev = rConfigString.copy( 0, nDelim );
- String aIsoStr( rConfigString.copy( nDelim+1 ) );
+ OUString aIsoStr( rConfigString.copy( nDelim+1 ) );
eLang = LanguageTag( aIsoStr ).getLanguageType();
}
else
{
rAbbrev = rConfigString;
- eLang = (rAbbrev.Len() ? LANGUAGE_NONE : LANGUAGE_SYSTEM);
+ eLang = (rAbbrev.isEmpty() ? LANGUAGE_SYSTEM : LANGUAGE_NONE);
}
}
// static
OUString SvtSysLocaleOptions::CreateCurrencyConfigString(
- const String& rAbbrev, LanguageType eLang )
+ const OUString& rAbbrev, LanguageType eLang )
{
- String aIsoStr( LanguageTag( eLang ).getBcp47() );
- if ( aIsoStr.Len() )
+ OUString aIsoStr( LanguageTag( eLang ).getBcp47() );
+ if ( !aIsoStr.isEmpty() )
{
- OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() );
+ OUStringBuffer aStr( rAbbrev.getLength() + 1 + aIsoStr.getLength() );
aStr.append( rAbbrev );
aStr.append( sal_Unicode('-') );
aStr.append( aIsoStr );
diff --git a/unotools/source/i18n/calendarwrapper.cxx b/unotools/source/i18n/calendarwrapper.cxx
index 700a8d0d8500..c7b96eedbe29 100644
--- a/unotools/source/i18n/calendarwrapper.cxx
+++ b/unotools/source/i18n/calendarwrapper.cxx
@@ -19,7 +19,6 @@
#include <rtl/strbuf.hxx>
-#include <tools/string.hxx>
#include <tools/debug.hxx>
#include <unotools/calendarwrapper.hxx>
#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
@@ -260,7 +259,7 @@ void CalendarWrapper::setValue( sal_Int16 nFieldIndex, sal_Int16 nValue )
}
-sal_Bool CalendarWrapper::isValid() const
+bool CalendarWrapper::isValid() const
{
try
{
@@ -271,7 +270,7 @@ sal_Bool CalendarWrapper::isValid() const
{
SAL_WARN( "unotools.i18n", "isValue: Exception caught " << e.Message );
}
- return sal_False;
+ return false;
}
@@ -379,7 +378,7 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const
}
-String CalendarWrapper::getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType ) const
+OUString CalendarWrapper::getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType ) const
{
try
{
@@ -390,13 +389,13 @@ String CalendarWrapper::getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int
{
SAL_WARN( "unotools.i18n", "getDisplayName: Exception caught " << e.Message );
}
- return String();
+ return OUString();
}
// --- XExtendedCalendar -----------------------------------------------------
-String CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) const
+OUString CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) const
{
try
{
@@ -407,7 +406,7 @@ String CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_In
{
SAL_WARN( "unotools.i18n", "getDisplayString: Exception caught " << e.Message );
}
- return String();
+ return OUString();
}
diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx
index 35f327238609..2b620262030c 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -20,7 +20,6 @@
#include <comphelper/processfactory.hxx>
#include <unotools/charclass.hxx>
-#include <tools/string.hxx>
#include <tools/debug.hxx>
#include <com/sun/star/i18n/CharacterClassification.hpp>
@@ -77,41 +76,47 @@ const ::com::sun::star::lang::Locale& CharClass::getMyLocale() const
// static
-sal_Bool CharClass::isAsciiNumeric( const String& rStr )
+bool CharClass::isAsciiNumeric( const OUString& rStr )
{
- if ( !rStr.Len() )
- return sal_False;
- const sal_Unicode* p = rStr.GetBuffer();
- const sal_Unicode* const pStop = p + rStr.Len();
+ if ( rStr.isEmpty() )
+ return false;
+ const sal_Unicode* p = rStr.getStr();
+ const sal_Unicode* const pStop = p + rStr.getLength();
+
do
{
if ( !isAsciiDigit( *p ) )
- return sal_False;
- } while ( ++p < pStop );
- return sal_True;
+ return false;
+ }
+ while ( ++p < pStop );
+
+ return true;
}
// static
-sal_Bool CharClass::isAsciiAlpha( const String& rStr )
+bool CharClass::isAsciiAlpha( const OUString& rStr )
{
- if ( !rStr.Len() )
- return sal_False;
- const sal_Unicode* p = rStr.GetBuffer();
- const sal_Unicode* const pStop = p + rStr.Len();
+ if ( rStr.isEmpty() )
+ return false;
+ const sal_Unicode* p = rStr.getStr();
+ const sal_Unicode* const pStop = p + rStr.getLength();
+
do
{
if ( !isAsciiAlpha( *p ) )
- return sal_False;
- } while ( ++p < pStop );
- return sal_True;
+ return false;
+ }
+ while ( ++p < pStop );
+
+ return true;
}
-sal_Bool CharClass::isAlpha( const String& rStr, xub_StrLen nPos ) const
+bool CharClass::isAlpha( const OUString& rStr, sal_Int32 nPos ) const
{
- sal_Unicode c = rStr.GetChar( nPos );
+ sal_Unicode c = rStr[nPos];
if ( c < 128 )
return isAsciiAlpha( c );
@@ -119,22 +124,22 @@ sal_Bool CharClass::isAlpha( const String& rStr, xub_StrLen nPos ) const
{
if ( xCC.is() )
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
- nCharClassAlphaType) != 0;
+ nCharClassAlphaType) != 0;
else
- return sal_False;
+ return false;
}
catch ( const Exception& )
{
SAL_WARN( "unotools.i18n", "isAlpha: Exception caught!" );
- return sal_False;
+ return false;
}
}
-sal_Bool CharClass::isLetter( const String& rStr, xub_StrLen nPos ) const
+bool CharClass::isLetter( const OUString& rStr, sal_Int32 nPos ) const
{
- sal_Unicode c = rStr.GetChar( nPos );
+ sal_Unicode c = rStr[nPos];
if ( c < 128 )
return isAsciiAlpha( c );
@@ -142,38 +147,38 @@ sal_Bool CharClass::isLetter( const String& rStr, xub_StrLen nPos ) const
{
if ( xCC.is() )
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
- nCharClassLetterType) != 0;
+ nCharClassLetterType) != 0;
else
- return sal_False;
+ return false;
}
catch ( const Exception& )
{
SAL_WARN( "unotools.i18n", "isLetter: Exception caught!" );
- return sal_False;
+ return false;
}
}
-sal_Bool CharClass::isLetter( const String& rStr ) const
+bool CharClass::isLetter( const OUString& rStr ) const
{
try
{
if ( xCC.is() )
- return isLetterType( xCC->getStringType( rStr, 0, rStr.Len(), getMyLocale() ) );
+ return isLetterType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
else
- return sal_False;
+ return false;
}
catch ( const Exception& )
{
SAL_WARN( "unotools.i18n", "isLetter: Exception caught!" );
- return sal_False;
+ return false;
}
}
-sal_Bool CharClass::isDigit( const String& rStr, xub_StrLen nPos ) const
+bool CharClass::isDigit( const OUString& rStr, sal_Int32 nPos ) const
{
- sal_Unicode c = rStr.GetChar( nPos );
+ sal_Unicode c = rStr[ nPos ];
if ( c < 128 )
return isAsciiDigit( c );
@@ -181,38 +186,38 @@ sal_Bool CharClass::isDigit( const String& rStr, xub_StrLen nPos ) const
{
if ( xCC.is() )
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
- KCharacterType::DIGIT) != 0;
+ KCharacterType::DIGIT) != 0;
else
- return sal_False;
+ return false;
}
catch ( const Exception& )
{
SAL_WARN( "unotools.i18n", "isDigit: Exception caught!" );
- return sal_False;
+ return false;
}
}
-sal_Bool CharClass::isNumeric( const String& rStr ) const
+bool CharClass::isNumeric( const OUString& rStr ) const
{
try
{
if ( xCC.is() )
- return isNumericType( xCC->getStringType( rStr, 0, rStr.Len(), getMyLocale() ) );
+ return isNumericType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
else
- return sal_False;
+ return false;
}
catch ( const Exception& )
{
SAL_WARN( "unotools.i18n", "isNumeric: Exception caught!" );
- return sal_False;
+ return false;
}
}
-sal_Bool CharClass::isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const
+bool CharClass::isAlphaNumeric( const OUString& rStr, sal_Int32 nPos ) const
{
- sal_Unicode c = rStr.GetChar( nPos );
+ sal_Unicode c = rStr[nPos];
if ( c < 128 )
return isAsciiAlphaNumeric( c );
@@ -222,19 +227,19 @@ sal_Bool CharClass::isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
(nCharClassAlphaType | KCharacterType::DIGIT)) != 0;
else
- return sal_False;
+ return false;
}
catch ( const Exception& )
{
SAL_WARN( "unotools.i18n", "isAlphaNumeric: Exception caught!" );
- return sal_False;
+ return false;
}
}
-sal_Bool CharClass::isLetterNumeric( const String& rStr, xub_StrLen nPos ) const
+bool CharClass::isLetterNumeric( const OUString& rStr, sal_Int32 nPos ) const
{
- sal_Unicode c = rStr.GetChar( nPos );
+ sal_Unicode c = rStr[nPos];
if ( c < 128 )
return isAsciiAlphaNumeric( c );
@@ -242,31 +247,31 @@ sal_Bool CharClass::isLetterNumeric( const String& rStr, xub_StrLen nPos ) const
{
if ( xCC.is() )
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
- (nCharClassLetterType | KCharacterType::DIGIT)) != 0;
+ (nCharClassLetterType | KCharacterType::DIGIT)) != 0;
else
- return sal_False;
+ return false;
}
catch ( const Exception& )
{
SAL_WARN( "unotools.i18n", "isLetterNumeric: Exception caught!" );
- return sal_False;
+ return false;
}
}
-sal_Bool CharClass::isLetterNumeric( const String& rStr ) const
+bool CharClass::isLetterNumeric( const OUString& rStr ) const
{
try
{
if ( xCC.is() )
- return isLetterNumericType( xCC->getStringType( rStr, 0, rStr.Len(), getMyLocale() ) );
+ return isLetterNumericType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
else
- return sal_False;
+ return false;
}
catch ( const Exception& )
{
SAL_WARN( "unotools.i18n", "isLetterNumeric: Exception caught!" );
- return sal_False;
+ return false;
}
}
@@ -318,7 +323,7 @@ OUString CharClass::lowercase( const OUString& rStr, sal_Int32 nPos, sal_Int32 n
}
}
-sal_Int16 CharClass::getType( const String& rStr, xub_StrLen nPos ) const
+sal_Int16 CharClass::getType( const OUString& rStr, sal_Int32 nPos ) const
{
try
{
@@ -335,7 +340,7 @@ sal_Int16 CharClass::getType( const String& rStr, xub_StrLen nPos ) const
}
-sal_Int16 CharClass::getCharacterDirection( const String& rStr, xub_StrLen nPos ) const
+sal_Int16 CharClass::getCharacterDirection( const OUString& rStr, sal_Int32 nPos ) const
{
try
{
@@ -352,7 +357,7 @@ sal_Int16 CharClass::getCharacterDirection( const String& rStr, xub_StrLen nPos
}
-sal_Int16 CharClass::getScript( const String& rStr, xub_StrLen nPos ) const
+sal_Int16 CharClass::getScript( const OUString& rStr, sal_Int32 nPos ) const
{
try
{
@@ -369,7 +374,7 @@ sal_Int16 CharClass::getScript( const String& rStr, xub_StrLen nPos ) const
}
-sal_Int32 CharClass::getCharacterType( const String& rStr, xub_StrLen nPos ) const
+sal_Int32 CharClass::getCharacterType( const OUString& rStr, sal_Int32 nPos ) const
{
try
{
@@ -386,7 +391,7 @@ sal_Int32 CharClass::getCharacterType( const String& rStr, xub_StrLen nPos ) con
}
-sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+sal_Int32 CharClass::getStringType( const OUString& rStr, sal_Int32 nPos, sal_Int32 nCount ) const
{
try
{
@@ -404,12 +409,12 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str
::com::sun::star::i18n::ParseResult CharClass::parseAnyToken(
- const String& rStr,
+ const OUString& rStr,
sal_Int32 nPos,
sal_Int32 nStartCharFlags,
- const String& userDefinedCharactersStart,
+ const OUString& userDefinedCharactersStart,
sal_Int32 nContCharFlags,
- const String& userDefinedCharactersCont ) const
+ const OUString& userDefinedCharactersCont ) const
{
try
{
@@ -430,12 +435,12 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str
::com::sun::star::i18n::ParseResult CharClass::parsePredefinedToken(
sal_Int32 nTokenType,
- const String& rStr,
+ const OUString& rStr,
sal_Int32 nPos,
sal_Int32 nStartCharFlags,
- const String& userDefinedCharactersStart,
+ const OUString& userDefinedCharactersStart,
sal_Int32 nContCharFlags,
- const String& userDefinedCharactersCont ) const
+ const OUString& userDefinedCharactersCont ) const
{
try
{
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 82b55c1a3ffc..a0c800cdf176 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -26,7 +26,6 @@
#include <unotools/numberformatcodewrapper.hxx>
#include <unotools/calendarwrapper.hxx>
#include <unotools/digitgroupingiterator.hxx>
-#include <tools/string.hxx>
#include <tools/debug.hxx>
#include <i18nlangtag/languagetag.hxx>
@@ -672,7 +671,7 @@ void LocaleDataWrapper::scanCurrFormatImpl( const OUString& rCode,
p = pStop;
break;
default:
- if (!nInSection && nSym == -1 && String(rCode).Equals( aCurrSymbol, (xub_StrLen)(p-pStr), aCurrSymbol.getLength()))
+ if (!nInSection && nSym == -1 && rCode.match(aCurrSymbol, (sal_Int32)(p - pStr)))
{ // currency symbol not surrounded by [$...]
nSym = p - pStr;
if (nBlank == -1 && pStr < p && *(p-1) == ' ')
@@ -1430,7 +1429,7 @@ OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCa
using namespace ::com::sun::star::i18n;
sal_Unicode aBuf[20];
sal_Unicode* pBuf;
- String aStr;
+ OUString aStr;
sal_Int16 nVal;
rCal.setGregorianDateTime( rDate );
// day of week
@@ -1455,25 +1454,13 @@ OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCa
switch ( getLongDateFormat() )
{
case DMY :
- aStr += aDay;
- aStr += getLongDateDaySep();
- aStr += aMonth;
- aStr += getLongDateMonthSep();
- aStr += aYear;
+ aStr += aDay + getLongDateDaySep() + aMonth + getLongDateMonthSep() + aYear;
break;
case MDY :
- aStr += aMonth;
- aStr += getLongDateMonthSep();
- aStr += aDay;
- aStr += getLongDateDaySep();
- aStr += aYear;
+ aStr += aMonth + getLongDateMonthSep() + aDay + getLongDateDaySep() + aYear;
break;
default: // YMD
- aStr += aYear;
- aStr += getLongDateYearSep();
- aStr += aMonth;
- aStr += getLongDateMonthSep();
- aStr += aDay;
+ aStr += aYear + getLongDateYearSep() + aMonth + getLongDateMonthSep() + aDay;
}
return aStr;
}
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index dfb871e70439..5e8327fdf42c 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -26,6 +26,7 @@
#include <comphelper/processfactory.hxx>
#include <unotools/textsearch.hxx>
#include <rtl/instance.hxx>
+#include <rtl/ustrbuf.hxx>
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::uno;
@@ -38,21 +39,21 @@ namespace utl
SearchParam::SearchParam( const OUString &rText,
SearchType eType,
- sal_Bool bCaseSensitive,
- sal_Bool bWrdOnly,
- sal_Bool bSearchInSel )
+ bool bCaseSensitive,
+ bool bWrdOnly,
+ bool bSearchInSel )
{
sSrchStr = rText;
- m_eSrchType = eType;
+ m_eSrchType = eType;
- m_bWordOnly = bWrdOnly;
- m_bSrchInSel = bSearchInSel;
- m_bCaseSense = bCaseSensitive;
+ m_bWordOnly = bWrdOnly;
+ m_bSrchInSel = bSearchInSel;
+ m_bCaseSense = bCaseSensitive;
nTransliterationFlags = 0;
// Parameters for weighted Levenshtein distance
- bLEV_Relaxed = sal_True;
+ bLEV_Relaxed = true;
nLEV_OtherX = 2;
nLEV_ShorterY = 1;
nLEV_LongerZ = 3;
@@ -62,11 +63,11 @@ SearchParam::SearchParam( const SearchParam& rParam )
{
sSrchStr = rParam.sSrchStr;
sReplaceStr = rParam.sReplaceStr;
- m_eSrchType = rParam.m_eSrchType;
+ m_eSrchType = rParam.m_eSrchType;
- m_bWordOnly = rParam.m_bWordOnly;
- m_bSrchInSel = rParam.m_bSrchInSel;
- m_bCaseSense = rParam.m_bCaseSense;
+ m_bWordOnly = rParam.m_bWordOnly;
+ m_bSrchInSel = rParam.m_bSrchInSel;
+ m_bCaseSense = rParam.m_bCaseSense;
bLEV_Relaxed = rParam.bLEV_Relaxed;
nLEV_OtherX = rParam.nLEV_OtherX;
@@ -206,51 +207,19 @@ TextSearch::~TextSearch()
* methods, such as ordinary string searching or regular expression
* matching, using the method pointer.
*/
-int TextSearch::SearchFrwrd( const String & rStr, xub_StrLen* pStart,
- xub_StrLen* pEnde, SearchResult* pRes )
-{
- int nRet = 0;
- try
- {
- if( xTextSearch.is() )
- {
- SearchResult aRet( xTextSearch->searchForward(
- rStr, *pStart, *pEnde ));
- if( aRet.subRegExpressions > 0 )
- {
- nRet = 1;
- // the XTextsearch returns in startOffset the higher position
- // and the endposition is always exclusive.
- // The caller of this function will have in startPos the
- // lower pos. and end
- *pStart = (xub_StrLen)aRet.startOffset[ 0 ];
- *pEnde = (xub_StrLen)aRet.endOffset[ 0 ];
- if( pRes )
- *pRes = aRet;
- }
- }
- }
- catch ( Exception& )
- {
- SAL_WARN( "unotools.i18n", "SearchForward: Exception caught!" );
- }
- return nRet;
-}
-
-sal_Bool TextSearch::SearchForward( const OUString &rStr,
+bool TextSearch::SearchForward( const OUString &rStr,
sal_Int32* pStart, sal_Int32* pEnd,
::com::sun::star::util::SearchResult* pRes)
{
- sal_Bool nRet = sal_False;
+ bool nRet = false;
try
{
if( xTextSearch.is() )
{
- SearchResult aRet( xTextSearch->searchForward(
- rStr, *pStart, *pEnd ));
+ SearchResult aRet( xTextSearch->searchForward( rStr, *pStart, *pEnd ));
if( aRet.subRegExpressions > 0 )
{
- nRet = sal_True;
+ nRet = true;
// the XTextsearch returns in startOffset the higher position
// and the endposition is always exclusive.
// The caller of this function will have in startPos the
@@ -270,25 +239,24 @@ sal_Bool TextSearch::SearchForward( const OUString &rStr,
}
-int TextSearch::SearchBkwrd( const String & rStr, xub_StrLen* pStart,
- xub_StrLen* pEnde, SearchResult* pRes )
+bool TextSearch::SearchBackward( const OUString & rStr, sal_Int32* pStart,
+ sal_Int32* pEnde, SearchResult* pRes )
{
- int nRet = 0;
+ bool nRet = false;
try
{
if( xTextSearch.is() )
{
- SearchResult aRet( xTextSearch->searchBackward(
- rStr, *pStart, *pEnde ));
+ SearchResult aRet( xTextSearch->searchBackward( rStr, *pStart, *pEnde ));
if( aRet.subRegExpressions )
{
- nRet = 1;
+ nRet = true;
// the XTextsearch returns in startOffset the higher position
// and the endposition is always exclusive.
// The caller of this function will have in startPos the
// lower pos. and end
- *pEnde = (xub_StrLen)aRet.startOffset[ 0 ];
- *pStart = (xub_StrLen)aRet.endOffset[ 0 ];
+ *pEnde = aRet.startOffset[ 0 ];
+ *pStart = aRet.endOffset[ 0 ];
if( pRes )
*pRes = aRet;
}
@@ -301,103 +269,92 @@ int TextSearch::SearchBkwrd( const String & rStr, xub_StrLen* pStart,
return nRet;
}
-void TextSearch::ReplaceBackReferences( String& rReplaceStr, const String &rStr, const SearchResult& rResult )
+void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &rStr, const SearchResult& rResult )
{
if( rResult.subRegExpressions > 0 )
{
- OUString sTab( '\t' );
- sal_Unicode sSrchChrs[] = {'\\', '&', '$', 0};
- String sTmp;
- xub_StrLen nPos = 0;
sal_Unicode sFndChar;
- while( STRING_NOTFOUND != ( nPos = rReplaceStr.SearchChar( sSrchChrs, nPos )) )
+ sal_Int32 i;
+ OUStringBuffer sBuff(rReplaceStr.getLength()*4);
+ for(i = 0; i < rReplaceStr.getLength(); i++)
{
- if( rReplaceStr.GetChar( nPos ) == '&')
+ if( rReplaceStr[i] == '&')
{
- sal_uInt16 nStart = (sal_uInt16)(rResult.startOffset[0]);
- sal_uInt16 nLength = (sal_uInt16)(rResult.endOffset[0] - rResult.startOffset[0]);
- rReplaceStr.Erase( nPos, 1 ); // delete ampersand
- // replace by found string
- rReplaceStr.Insert( rStr, nStart, nLength, nPos );
- // jump over
- nPos = nPos + nLength;
+ sal_Int32 nStart = rResult.startOffset[0];
+ sal_Int32 nLength = rResult.endOffset[0] - rResult.startOffset[0];
+ sBuff.append(rStr.getStr() + nStart, nLength);
}
- else if( rReplaceStr.GetChar( nPos ) == '$')
+ else if( rReplaceStr[i] == '$' && i < rReplaceStr.getLength() - 1)
{
- if( nPos + 1 < rReplaceStr.Len())
- {
- sFndChar = rReplaceStr.GetChar( nPos + 1 );
- switch(sFndChar)
- { // placeholder for a backward reference?
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
+ sFndChar = rReplaceStr[ i + 1 ];
+ switch(sFndChar)
+ { // placeholder for a backward reference?
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ int j = sFndChar - '0'; // index
+ if(j < rResult.subRegExpressions)
{
- rReplaceStr.Erase( nPos, 2 ); // delete both
- int i = sFndChar - '0'; // index
- if(i < rResult.subRegExpressions)
+ sal_Int32 nSttReg = rResult.startOffset[j];
+ sal_Int32 nRegLen = rResult.endOffset[j];
+ if( nRegLen > nSttReg )
{
- sal_uInt16 nSttReg = (sal_uInt16)(rResult.startOffset[i]);
- sal_uInt16 nRegLen = (sal_uInt16)(rResult.endOffset[i]);
- if( nRegLen > nSttReg )
- nRegLen = nRegLen - nSttReg;
- else
- {
- nRegLen = nSttReg - nRegLen;
- nSttReg = (sal_uInt16)(rResult.endOffset[i]);
- }
- // Copy reference from found string
- sTmp = rStr.Copy((sal_uInt16)nSttReg, (sal_uInt16)nRegLen);
- // insert
- rReplaceStr.Insert( sTmp, nPos );
- // and step over
- nPos = nPos + sTmp.Len();
+ nRegLen = nRegLen - nSttReg;
}
+ else
+ {
+ nRegLen = nSttReg - nRegLen;
+ nSttReg = rResult.endOffset[j];
+ }
+ // Copy reference from found string
+ sBuff.append(rStr.getStr() + nSttReg, nRegLen);
}
- break;
- default:
- nPos += 2; // leave both chars unchanged
- break;
+ i += 1;
}
+ break;
+ default:
+ sBuff.append(rReplaceStr[i]);
+ sBuff.append(rReplaceStr[i+1]);
+ i += 1;
+ break;
}
- else
- ++nPos;
}
- else
+ else if( rReplaceStr[i] == '\\' && i < rReplaceStr.getLength() - 1)
{
- // at least another character?
- if( nPos + 1 < rReplaceStr.Len())
+ sFndChar = rReplaceStr[ i+1 ];
+ switch(sFndChar)
{
- sFndChar = rReplaceStr.GetChar( nPos + 1 );
- switch(sFndChar)
- {
- case '\\':
- case '&':
- case '$':
- rReplaceStr.Erase( nPos, 1 );
- nPos++;
- break;
- case 't':
- rReplaceStr.Erase( nPos, 2 ); // delete both
- rReplaceStr.Insert( sTab, nPos ); // insert tabulator
- nPos++; // step over
- break;
- default:
- nPos += 2; // ignore both characters
- break;
- }
+ case '\\':
+ case '&':
+ case '$':
+ sBuff.append(sFndChar);
+ i+=1;
+ break;
+ case 't':
+ sBuff.append('\t');
+ i += 1;
+ break;
+ default:
+ sBuff.append(rReplaceStr[i]);
+ sBuff.append(rReplaceStr[i+1]);
+ i += 1;
+ break;
}
- else
- ++nPos;
+ }
+ else
+ {
+ sBuff.append(rReplaceStr[i]);
}
}
+ rReplaceStr = sBuff.makeStringAndClear();
}
}
diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx
index 703c37e148cc..abaac0b1953d 100644
--- a/unotools/source/i18n/transliterationwrapper.cxx
+++ b/unotools/source/i18n/transliterationwrapper.cxx
@@ -44,12 +44,11 @@ TransliterationWrapper::~TransliterationWrapper()
}
-String TransliterationWrapper::transliterate(
- const String& rStr, sal_uInt16 nLang,
- xub_StrLen nStart, xub_StrLen nLen,
- Sequence <sal_Int32>* pOffset )
+OUString TransliterationWrapper::transliterate(const OUString& rStr, sal_uInt16 nLang,
+ sal_Int32 nStart, sal_Int32 nLen,
+ Sequence <sal_Int32>* pOffset )
{
- String sRet;
+ OUString sRet;
if( xTrans.is() )
{
try
@@ -70,12 +69,11 @@ String TransliterationWrapper::transliterate(
}
-String TransliterationWrapper::transliterate(
- const String& rStr,
- xub_StrLen nStart, xub_StrLen nLen,
- Sequence <sal_Int32>* pOffset ) const
+OUString TransliterationWrapper::transliterate( const OUString& rStr,
+ sal_Int32 nStart, sal_Int32 nLen,
+ Sequence <sal_Int32>* pOffset ) const
{
- String sRet( rStr );
+ OUString sRet( rStr );
if( xTrans.is() )
{
try
@@ -93,7 +91,7 @@ String TransliterationWrapper::transliterate(
return sRet;
}
-sal_Bool TransliterationWrapper::needLanguageForTheMode() const
+bool TransliterationWrapper::needLanguageForTheMode() const
{
return TransliterationModules_UPPERCASE_LOWERCASE == nType ||
TransliterationModules_LOWERCASE_UPPERCASE == nType ||
@@ -114,8 +112,8 @@ void TransliterationWrapper::setLanguageLocaleImpl( sal_uInt16 nLang )
void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang )
{
- sal_Bool bLoad = bFirstCall;
- bFirstCall = sal_False;
+ bool bLoad = bFirstCall;
+ bFirstCall = false;
if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::SENTENCE_CASE )
{
@@ -161,12 +159,12 @@ void TransliterationWrapper::loadModuleImpl() const
SAL_WARN( "unotools.i18n", "loadModuleImpl: Exception caught " << e.Message );
}
- bFirstCall = sal_False;
+ bFirstCall = false;
}
-void TransliterationWrapper::loadModuleByImplName(
- const String& rModuleName, sal_uInt16 nLang )
+void TransliterationWrapper::loadModuleByImplName(const OUString& rModuleName,
+ sal_uInt16 nLang )
{
try
{
@@ -183,13 +181,13 @@ void TransliterationWrapper::loadModuleByImplName(
SAL_WARN( "unotools.i18n", "loadModuleByImplName: Exception caught " << e.Message );
}
- bFirstCall = sal_False;
+ bFirstCall = false;
}
-sal_Bool TransliterationWrapper::equals(
- const String& rStr1, sal_Int32 nPos1, sal_Int32 nCount1, sal_Int32& nMatch1,
- const String& rStr2, sal_Int32 nPos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) const
+bool TransliterationWrapper::equals(
+ const OUString& rStr1, sal_Int32 nPos1, sal_Int32 nCount1, sal_Int32& nMatch1,
+ const OUString& rStr2, sal_Int32 nPos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) const
{
try
{
@@ -202,10 +200,10 @@ sal_Bool TransliterationWrapper::equals(
{
SAL_WARN( "unotools.i18n", "equals: Exception caught " << e.Message );
}
- return sal_False;
+ return false;
}
-sal_Int32 TransliterationWrapper::compareString( const String& rStr1, const String& rStr2 ) const
+sal_Int32 TransliterationWrapper::compareString( const OUString& rStr1, const OUString& rStr2 ) const
{
try
{
@@ -224,23 +222,23 @@ sal_Int32 TransliterationWrapper::compareString( const String& rStr1, const Stri
// --- helpers --------------------------------------------------------
-sal_Bool TransliterationWrapper::isEqual( const String& rStr1, const String& rStr2 ) const
+bool TransliterationWrapper::isEqual( const OUString& rStr1, const OUString& rStr2 ) const
{
sal_Int32 nMatch1, nMatch2;
- sal_Bool bMatch = equals(
- rStr1, 0, rStr1.Len(), nMatch1,
- rStr2, 0, rStr2.Len(), nMatch2 );
+ bool bMatch = equals(
+ rStr1, 0, rStr1.getLength(), nMatch1,
+ rStr2, 0, rStr2.getLength(), nMatch2 );
return bMatch;
}
-sal_Bool TransliterationWrapper::isMatch( const String& rStr1, const String& rStr2 ) const
+bool TransliterationWrapper::isMatch( const OUString& rStr1, const OUString& rStr2 ) const
{
sal_Int32 nMatch1, nMatch2;
equals(
- rStr1, 0, rStr1.Len(), nMatch1,
- rStr2, 0, rStr2.Len(), nMatch2 );
- return (nMatch1 <= nMatch2) && (nMatch1 == rStr1.Len());
+ rStr1, 0, rStr1.getLength(), nMatch1,
+ rStr2, 0, rStr2.getLength(), nMatch2 );
+ return (nMatch1 <= nMatch2) && (nMatch1 == rStr1.getLength());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index 2b44624c39a2..f1156cbe16e2 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -1049,8 +1049,8 @@ private:
::std::multimap<sal_Unicode, SymbolEntry> maMagicMap;
public:
StarSymbolToMSMultiFontImpl(bool bPerfectOnly);
- String ConvertChar(sal_Unicode &rChar);
- String ConvertString(String &rString, xub_StrLen& rIndex);
+ OUString ConvertChar(sal_Unicode &rChar);
+ OUString ConvertString(OUString &rString, sal_Int32& rIndex);
};
struct ExtraTable { sal_Unicode cStar; sal_uInt8 cMS;};
@@ -1237,9 +1237,9 @@ const char *SymbolFontToString(int nResult)
return *ppName;
}
-String StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar)
+OUString StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar)
{
- String sRet;
+ OUString sRet;
::std::multimap<sal_Unicode, SymbolEntry>::const_iterator aResult =
maMagicMap.find(rChar);
@@ -1247,32 +1247,33 @@ String StarSymbolToMSMultiFontImpl::ConvertChar(sal_Unicode &rChar)
if (aResult != maMagicMap.end())
{
const SymbolEntry &rEntry = (*aResult).second;
- sRet.AssignAscii(SymbolFontToString(rEntry.eFont));
+ const char* pc = SymbolFontToString(rEntry.eFont);
+ sRet = OUString(pc, strlen(pc), RTL_TEXTENCODING_ASCII_US);
rChar = rEntry.cIndex;
}
return sRet;
}
-String StarSymbolToMSMultiFontImpl::ConvertString(String &rString,
- xub_StrLen& rIndex)
+OUString StarSymbolToMSMultiFontImpl::ConvertString(OUString &rString,
+ sal_Int32& rIndex)
{
typedef ::std::multimap<sal_Unicode, SymbolEntry>::iterator MI;
typedef ::std::pair<MI, MI> Result;
- String sRet;
+ OUString sRet;
- xub_StrLen nLen = rString.Len();
+ sal_Int32 nLen = rString.getLength();
if (rIndex >= nLen)
return sRet;
int nTotal = 0, nResult = 0;
::std::vector<Result> aPossibilities;
aPossibilities.reserve(nLen - rIndex);
- xub_StrLen nStart = rIndex;
+ sal_Int32 nStart = rIndex;
do
{
- Result aResult = maMagicMap.equal_range(rString.GetChar(rIndex));
+ Result aResult = maMagicMap.equal_range(rString[rIndex]);
int nBitfield = 0;
for (MI aIndex = aResult.first; aIndex != aResult.second; ++aIndex)
nBitfield |= aIndex->second.eFont;
@@ -1304,10 +1305,12 @@ String StarSymbolToMSMultiFontImpl::ConvertString(String &rString,
else
break;
}
- sRet.AssignAscii(SymbolFontToString(nI));
+ const char* pc = SymbolFontToString(nI);
+ sRet = OUString(pc, strlen(pc), RTL_TEXTENCODING_ASCII_US);
- xub_StrLen nSize = sal::static_int_cast<xub_StrLen>(aPossibilities.size());
- for(xub_StrLen nPos = 0; nPos < nSize; ++nPos)
+ sal_Int32 nSize = aPossibilities.size();
+ OUStringBuffer sBuff(rString);
+ for(sal_Int32 nPos = 0; nPos < nSize; ++nPos)
{
const Result &rResult = aPossibilities[nPos];
@@ -1315,11 +1318,12 @@ String StarSymbolToMSMultiFontImpl::ConvertString(String &rString,
{
if (aIndex->second.eFont == nI)
{
- rString.SetChar(nPos+nStart, aIndex->second.cIndex);
+ sBuff[nPos + nStart] = aIndex->second.cIndex;
break;
}
}
}
+ rString = sBuff.makeStringAndClear();
}
return sRet;
@@ -1432,7 +1436,7 @@ static ConvertChar aImplStarSymbolCvt = { NULL, "StarBats", ImplStarSymbolToStar
// -----------------------------------------------------------------------
-const ConvertChar* ConvertChar::GetRecodeData( const String& rOrgFontName, const String& rMapFontName )
+const ConvertChar* ConvertChar::GetRecodeData( const OUString& rOrgFontName, const OUString& rMapFontName )
{
const ConvertChar* pCvt = NULL;
OUString aOrgName( rOrgFontName );
@@ -1478,8 +1482,7 @@ const ConvertChar* ConvertChar::GetRecodeData( const String& rOrgFontName, const
//=======================================================================
-FontToSubsFontConverter CreateFontToSubsFontConverter(
- const String& rOrgName, sal_uLong nFlags )
+FontToSubsFontConverter CreateFontToSubsFontConverter( const OUString& rOrgName, sal_uLong nFlags )
{
const ConvertChar* pCvt = NULL;
@@ -1529,10 +1532,10 @@ sal_Unicode ConvertFontToSubsFontChar(
// -----------------------------------------------------------------------
-String GetFontToSubsFontName( FontToSubsFontConverter hConverter )
+OUString GetFontToSubsFontName( FontToSubsFontConverter hConverter )
{
if ( !hConverter )
- return String();
+ return OUString();
const char* pName = ((ConvertChar*)hConverter)->mpSubsFontName;
return OUString::createFromAscii( pName );
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index b81a5b38c012..cdb8bd6568c6 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -473,19 +473,24 @@ OUString GetNextFontToken( const OUString& rTokenStr, sal_Int32& rIndex )
{
// no token delimiter found => handle last token
rIndex = -1;
- nTokenLen = STRING_LEN;
// optimize if the token string consists of just one token
if( !nTokenStart )
+ {
return rTokenStr;
+ }
+ else
+ {
+ nTokenLen = nStringLen - nTokenStart;
+ }
}
- return String( rTokenStr, nTokenStart, nTokenLen );
+ return OUString( rTokenStr.getStr() + nTokenStart, nTokenLen );
}
// =======================================================================
-static bool ImplIsFontToken( const OUString& rName, const String& rToken )
+static bool ImplIsFontToken( const OUString& rName, const OUString& rToken )
{
OUString aTempName;
sal_Int32 nIndex = 0;
@@ -502,7 +507,7 @@ static bool ImplIsFontToken( const OUString& rName, const String& rToken )
// -----------------------------------------------------------------------
-static void ImplAppendFontToken( OUString& rName, const String& rNewToken )
+static void ImplAppendFontToken( OUString& rName, const OUString& rNewToken )
{
if ( !rName.isEmpty() )
{
@@ -539,7 +544,7 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags )
{
for( int i = 0; i < 3; i++ )
{
- const ::std::vector< String >* pVector = NULL;
+ const ::std::vector< OUString >* pVector = NULL;
switch( i )
{
case 0:
@@ -557,7 +562,7 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags )
}
if( ! pVector )
continue;
- for( ::std::vector< String >::const_iterator it = pVector->begin(); it != pVector->end(); ++it )
+ for( ::std::vector< OUString >::const_iterator it = pVector->begin(); it != pVector->end(); ++it )
if( ! ImplIsFontToken( rName, *it ) )
{
ImplAppendFontToken( aName, *it );
@@ -576,12 +581,12 @@ OUString GetSubsFontName( const OUString& rName, sal_uLong nFlags )
// -----------------------------------------------------------------------
// TODO: use a more generic String hash
-int FontNameHash::operator()( const String& rStr ) const
+int FontNameHash::operator()( const OUString& rStr ) const
{
// this simple hash just has to be good enough for font names
int nHash = 0;
- const int nLen = rStr.Len();
- const sal_Unicode* p = rStr.GetBuffer();
+ const int nLen = rStr.getLength();
+ const sal_Unicode* p = rStr.getStr();
switch( nLen )
{
default: nHash = (p[0]<<16) - (p[1]<<8) + p[2];
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx
index bf67a4d2cd6b..9ff0fc47c068 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -23,6 +23,7 @@
#include <comphelper/processfactory.hxx>
#include <rtl/tencinfo.h>
#include <rtl/locale.h>
+#include <osl/thread.h>
#include <osl/nlsupport.h>
#include <vector>
@@ -41,14 +42,14 @@ public:
LocaleDataWrapper* pLocaleData;
CharClass* pCharClass;
- SvtSysLocale_Impl();
- virtual ~SvtSysLocale_Impl();
+ SvtSysLocale_Impl();
+ virtual ~SvtSysLocale_Impl();
- CharClass* GetCharClass();
- virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
+ CharClass* GetCharClass();
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
private:
- void setDateAcceptancePatternsConfig();
+ void setDateAcceptancePatternsConfig();
};
// -----------------------------------------------------------------------
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 798f61be5816..bbfe67f9254d 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -49,10 +49,10 @@ namespace utl
struct TempFile_Impl
{
- String aName;
- String aURL;
+ OUString aName;
+ OUString aURL;
SvStream* pStream;
- sal_Bool bIsDirectory;
+ bool bIsDirectory;
TempFile_Impl()
: pStream(0)
@@ -62,7 +62,7 @@ struct TempFile_Impl
OUString getParentName( const OUString& aFileName )
{
sal_Int32 lastIndex = aFileName.lastIndexOf( sal_Unicode('/') );
- OUString aParent = aFileName.copy( 0,lastIndex );
+ OUString aParent = aFileName.copy( 0, lastIndex );
if( aParent[ aParent.getLength()-1] == sal_Unicode(':') && aParent.getLength() == 6 )
aParent += OUString("/");
@@ -73,11 +73,11 @@ OUString getParentName( const OUString& aFileName )
return aParent;
}
-sal_Bool ensuredir( const OUString& rUnqPath )
+bool ensuredir( const OUString& rUnqPath )
{
OUString aPath;
if ( rUnqPath.isEmpty() )
- return sal_False;
+ return false;
// remove trailing slash
if ( rUnqPath[ rUnqPath.getLength() - 1 ] == sal_Unicode( '/' ) )
@@ -98,11 +98,11 @@ umask(old_mode);
#endif
aDirectory.close();
if( nError == osl::File::E_None )
- return sal_True;
+ return true;
// try to create the directory
nError = osl::Directory::create( aPath );
- sal_Bool bSuccess = ( nError == osl::File::E_None || nError == osl::FileBase::E_EXIST );
+ bool bSuccess = ( nError == osl::File::E_None || nError == osl::FileBase::E_EXIST );
if( !bSuccess )
{
// perhaps parent(s) don't exist
@@ -124,10 +124,10 @@ umask(old_mode);
return bSuccess;
}
-String ConstructTempDir_Impl( const String* pParent )
+OUString ConstructTempDir_Impl( const OUString* pParent )
{
- String aName;
- if ( pParent && pParent->Len() )
+ OUString aName;
+ if ( pParent && !pParent->isEmpty() )
{
com::sun::star::uno::Reference<
com::sun::star::ucb::XUniversalContentBroker > pBroker(
@@ -154,7 +154,7 @@ String ConstructTempDir_Impl( const String* pParent )
}
}
- if ( !aName.Len() )
+ if ( aName.isEmpty() )
{
OUString &rTempNameBase_Impl = TempNameBase_Impl::get();
if (rTempNameBase_Impl.isEmpty())
@@ -172,30 +172,29 @@ String ConstructTempDir_Impl( const String* pParent )
}
// Make sure that directory ends with a separator
- xub_StrLen i = aName.Len();
- if( i>0 && aName.GetChar(i-1) != '/' )
- aName += '/';
+ sal_Int32 i = aName.getLength();
+ if( i>0 && aName[i-1] != '/' )
+ aName += "/";
return aName;
}
-void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_True )
+void CreateTempName_Impl( OUString& rName, bool bKeep, bool bDir = true )
{
// add a suitable tempname
// 36 ** 6 == 2176782336
unsigned const nRadix = 36;
unsigned long const nMax = (nRadix*nRadix*nRadix*nRadix*nRadix*nRadix);
- String aName( rName );
- aName += OUString( "lu" );
+ OUString aName = rName + "lu";
- rName.Erase();
+ rName = "";
static unsigned long u = Time::GetSystemTicks() % nMax;
for ( unsigned long nSeed = u; ++u != nSeed; )
{
u %= nMax;
- String aTmp( aName );
+ OUString aTmp( aName );
aTmp += OUString::valueOf(static_cast<sal_Int64>(u), nRadix);
- aTmp += OUString( ".tmp" );
+ aTmp += ".tmp" ;
if ( bDir )
{
@@ -252,26 +251,27 @@ void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_Tru
}
}
-void lcl_createName(TempFile_Impl& _rImpl,const String& rLeadingChars,sal_Bool _bStartWithZero, const String* pExtension, const String* pParent, sal_Bool bDirectory)
+void lcl_createName(TempFile_Impl& _rImpl,const OUString& rLeadingChars, bool _bStartWithZero,
+ const OUString* pExtension, const OUString* pParent, bool bDirectory)
{
_rImpl.bIsDirectory = bDirectory;
// get correct directory
- String aName = ConstructTempDir_Impl( pParent );
+ OUString aName = ConstructTempDir_Impl( pParent );
- sal_Bool bUseNumber = _bStartWithZero;
+ bool bUseNumber = _bStartWithZero;
// now use special naming scheme ( name takes leading chars and an index counting up from zero
aName += rLeadingChars;
for ( sal_Int32 i=0;; i++ )
{
- String aTmp( aName );
+ OUString aTmp( aName );
if ( bUseNumber )
aTmp += OUString::number( i );
- bUseNumber = sal_True;
+ bUseNumber = true;
if ( pExtension )
aTmp += *pExtension;
else
- aTmp += OUString( ".tmp" );
+ aTmp += ".tmp" ;
if ( bDirectory )
{
FileBase::RC err = Directory::create( aTmp );
@@ -320,24 +320,24 @@ umask(old_mode);
}
-String TempFile::CreateTempName( const String* pParent )
+OUString TempFile::CreateTempName( const OUString* pParent )
{
// get correct directory
- String aName = ConstructTempDir_Impl( pParent );
+ OUString aName = ConstructTempDir_Impl( pParent );
// get TempFile name with default naming scheme
- CreateTempName_Impl( aName, sal_False );
+ CreateTempName_Impl( aName, false );
// convert to file URL
OUString aTmp;
- if ( aName.Len() )
+ if ( !aName.isEmpty() )
FileBase::getSystemPathFromFileURL( aName, aTmp );
return aTmp;
}
-TempFile::TempFile( const String* pParent, sal_Bool bDirectory )
+TempFile::TempFile( const OUString* pParent, bool bDirectory )
: pImp( new TempFile_Impl )
- , bKillingFileEnabled( sal_False )
+ , bKillingFileEnabled( false )
{
pImp->bIsDirectory = bDirectory;
@@ -345,20 +345,20 @@ TempFile::TempFile( const String* pParent, sal_Bool bDirectory )
pImp->aName = ConstructTempDir_Impl( pParent );
// get TempFile with default naming scheme
- CreateTempName_Impl( pImp->aName, sal_True, bDirectory );
+ CreateTempName_Impl( pImp->aName, true, bDirectory );
}
-TempFile::TempFile( const String& rLeadingChars, const String* pExtension, const String* pParent, sal_Bool bDirectory)
+TempFile::TempFile( const OUString& rLeadingChars, const OUString* pExtension, const OUString* pParent, bool bDirectory)
: pImp( new TempFile_Impl )
- , bKillingFileEnabled( sal_False )
+ , bKillingFileEnabled( false )
{
- lcl_createName(*pImp,rLeadingChars,sal_True, pExtension, pParent, bDirectory);
+ lcl_createName(*pImp, rLeadingChars, true, pExtension, pParent, bDirectory);
}
-TempFile::TempFile( const String& rLeadingChars,sal_Bool _bStartWithZero, const String* pExtension, const String* pParent, sal_Bool bDirectory)
+TempFile::TempFile( const OUString& rLeadingChars, bool _bStartWithZero, const OUString* pExtension, const OUString* pParent, bool bDirectory)
: pImp( new TempFile_Impl )
- , bKillingFileEnabled( sal_False )
+ , bKillingFileEnabled( false )
{
- lcl_createName(*pImp,rLeadingChars,_bStartWithZero, pExtension, pParent, bDirectory);
+ lcl_createName(*pImp, rLeadingChars, _bStartWithZero, pExtension, pParent, bDirectory);
}
TempFile::~TempFile()
@@ -380,21 +380,21 @@ TempFile::~TempFile()
delete pImp;
}
-sal_Bool TempFile::IsValid() const
+bool TempFile::IsValid() const
{
- return pImp->aName.Len() != 0;
+ return !(pImp->aName.isEmpty());
}
-String TempFile::GetFileName() const
+OUString TempFile::GetFileName() const
{
OUString aTmp;
FileBase::getSystemPathFromFileURL( pImp->aName, aTmp );
return aTmp;
}
-String TempFile::GetURL() const
+OUString TempFile::GetURL() const
{
- if ( !pImp->aURL.Len() )
+ if ( pImp->aURL.isEmpty() )
{
OUString aTmp;
LocalFileHelper::ConvertPhysicalNameToURL( GetFileName(), aTmp );
@@ -408,8 +408,8 @@ SvStream* TempFile::GetStream( StreamMode eMode )
{
if ( !pImp->pStream )
{
- if ( GetURL().Len() )
- pImp->pStream = UcbStreamHelper::CreateStream( pImp->aURL, eMode, sal_True /* bFileExists */ );
+ if ( !GetURL().isEmpty() )
+ pImp->pStream = UcbStreamHelper::CreateStream( pImp->aURL, eMode, true /* bFileExists */ );
else
pImp->pStream = new SvMemoryStream( eMode );
}
@@ -426,37 +426,37 @@ void TempFile::CloseStream()
}
}
-String TempFile::SetTempNameBaseDirectory( const String &rBaseName )
+OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName )
{
- if( !rBaseName.Len() )
- return String();
+ if( rBaseName.isEmpty() )
+ return OUString();
OUString aUnqPath( rBaseName );
// remove trailing slash
- if ( rBaseName.GetChar( rBaseName.Len() - 1 ) == sal_Unicode( '/' ) )
- aUnqPath = rBaseName.Copy( 0, rBaseName.Len() - 1 );
+ if ( rBaseName[ rBaseName.getLength() - 1 ] == sal_Unicode( '/' ) )
+ aUnqPath = rBaseName.copy( 0, rBaseName.getLength() - 1 );
// try to create the directory
- sal_Bool bRet = sal_False;
+ bool bRet = false;
osl::FileBase::RC err = osl::Directory::create( aUnqPath );
if ( err != FileBase::E_None && err != FileBase::E_EXIST )
// perhaps parent(s) don't exist
bRet = ensuredir( aUnqPath );
else
- bRet = sal_True;
+ bRet = true;
// failure to create base directory means returning an empty string
OUString aTmp;
if ( bRet )
{
// append own internal directory
- bRet = sal_True;
+ bRet = true;
OUString &rTempNameBase_Impl = TempNameBase_Impl::get();
rTempNameBase_Impl = rBaseName;
rTempNameBase_Impl += OUString('/');
- TempFile aBase( NULL, sal_True );
+ TempFile aBase( NULL, true );
if ( aBase.IsValid() )
// use it in case of success
rTempNameBase_Impl = aBase.pImp->aName;
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 73a10f77b9b1..ca4e57839389 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -194,10 +194,10 @@ void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc
sal_Int32 k, m = aHead.getLength();
for (k = 0; k < m; k++)
{
- String aName( aHead[k].Name );
- String aValue( aHead[k].Value );
+ OUString aName( aHead[k].Name );
+ OUString aValue( aHead[k].Value );
- if (aName.CompareIgnoreCaseToAscii("Expires") == COMPARE_EQUAL)
+ if (aName.compareToIgnoreAsciiCaseAscii("Expires") == 0)
{
DateTime aExpires (0, 0);
if (INetRFC822Message::ParseDateField (aValue, aExpires))
@@ -878,7 +878,7 @@ void SAL_CALL Moderator::onTerminated()
Function for opening UCB contents synchronously,
but with handled timeout;
*/
-static sal_Bool _UCBOpenContentSync(
+static bool _UCBOpenContentSync(
UcbLockBytesRef xLockBytes,
Reference < XContent > xContent,
const Command& rArg,
@@ -888,7 +888,7 @@ static sal_Bool _UCBOpenContentSync(
UcbLockBytesHandlerRef xHandler );
-static sal_Bool UCBOpenContentSync(
+static bool UCBOpenContentSync(
UcbLockBytesRef xLockBytes,
Reference < XContent > xContent,
const Command& rArg,
@@ -917,8 +917,8 @@ static sal_Bool UCBOpenContentSync(
return _UCBOpenContentSync(
xLockBytes,xContent,rArg,xSink,xInteract,xProgress,xHandler);
- if ( (aScheme.compareToAscii( "http" ) != COMPARE_EQUAL) ||
- (aScheme.compareToAscii( "https" ) != COMPARE_EQUAL) )
+ if ( (aScheme.compareToAscii( "http" ) != 0) ||
+ (aScheme.compareToAscii( "https" ) != 0) )
xLockBytes->SetStreamValid_Impl();
Reference< XPropertiesChangeListener > xListener;
@@ -1137,7 +1137,7 @@ static sal_Bool UCBOpenContentSync(
/**
Function for opening UCB contents synchronously
*/
-static sal_Bool _UCBOpenContentSync(
+static bool _UCBOpenContentSync(
UcbLockBytesRef xLockBytes,
Reference < XContent > xContent,
const Command& rArg,
@@ -1154,7 +1154,7 @@ static sal_Bool _UCBOpenContentSync(
// http protocol must be handled in a special way: during the opening process the input stream may change
// only the last inputstream after notifying the document headers is valid
- if ( aScheme.compareToAscii("http") != COMPARE_EQUAL )
+ if ( aScheme.compareToAscii("http") != 0 )
xLockBytes->SetStreamValid_Impl();
Reference< XPropertiesChangeListener > xListener = new UcbPropertiesChangeListener_Impl( xLockBytes );
@@ -1235,11 +1235,11 @@ UcbLockBytes::UcbLockBytes( UcbLockBytesHandler* pHandler )
, m_pCommandThread( NULL )
, m_xHandler( pHandler )
, m_nError( ERRCODE_NONE )
- , m_bTerminated (sal_False)
- , m_bDontClose( sal_False )
- , m_bStreamValid (sal_False)
+ , m_bTerminated (false)
+ , m_bDontClose( false )
+ , m_bStreamValid (false)
{
- SetSynchronMode( sal_True );
+ SetSynchronMode( true );
}
//----------------------------------------------------------------------------
@@ -1280,19 +1280,19 @@ UcbLockBytes::~UcbLockBytes()
Reference < XInputStream > UcbLockBytes::getInputStream()
{
osl::MutexGuard aGuard( m_aMutex );
- m_bDontClose = sal_True;
+ m_bDontClose = true;
return m_xInputStream;
}
//----------------------------------------------------------------------------
-sal_Bool UcbLockBytes::setStream_Impl( const Reference<XStream>& aStream )
+bool UcbLockBytes::setStream_Impl( const Reference<XStream>& aStream )
{
osl::MutexGuard aGuard( m_aMutex );
if ( aStream.is() )
{
m_xOutputStream = aStream->getOutputStream();
- setInputStream_Impl( aStream->getInputStream(), sal_False );
+ setInputStream_Impl( aStream->getInputStream(), false );
m_xSeekable = Reference < XSeekable > ( aStream, UNO_QUERY );
}
else
@@ -1304,9 +1304,9 @@ sal_Bool UcbLockBytes::setStream_Impl( const Reference<XStream>& aStream )
return m_xInputStream.is();
}
-sal_Bool UcbLockBytes::setInputStream_Impl( const Reference<XInputStream> &rxInputStream, sal_Bool bSetXSeekable )
+bool UcbLockBytes::setInputStream_Impl( const Reference<XInputStream> &rxInputStream, bool bSetXSeekable )
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
try
{
@@ -1345,7 +1345,7 @@ sal_Bool UcbLockBytes::setInputStream_Impl( const Reference<XInputStream> &rxInp
void UcbLockBytes::SetStreamValid_Impl()
{
- m_bStreamValid = sal_True;
+ m_bStreamValid = true;
if ( m_xInputStream.is() )
m_aInitialized.set();
}
@@ -1353,7 +1353,7 @@ void UcbLockBytes::SetStreamValid_Impl()
//----------------------------------------------------------------------------
void UcbLockBytes::terminate_Impl()
{
- m_bTerminated = sal_True;
+ m_bTerminated = true;
m_aInitialized.set();
m_aTerminated.set();
@@ -1637,13 +1637,13 @@ UcbLockBytesRef UcbLockBytes::CreateLockBytes( const Reference < XContent >& xCo
Reference< XProgressHandler > xProgressHdl = new ProgressHandler_Impl( LINK( &xLockBytes, UcbLockBytes, DataAvailHdl ) );
- sal_Bool bError = UCBOpenContentSync( xLockBytes,
- xContent,
- aCommand,
- xSink,
- xInteractionHandler,
- xProgressHdl,
- pHandler );
+ bool bError = UCBOpenContentSync( xLockBytes,
+ xContent,
+ aCommand,
+ xSink,
+ xInteractionHandler,
+ xProgressHdl,
+ pHandler );
if ( xLockBytes->GetError() == ERRCODE_NONE && ( bError || !xLockBytes->getInputStream().is() ) )
{
diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx
index e4c763cd2434..4c1d57619e8f 100644
--- a/unotools/source/ucbhelper/ucbstreamhelper.cxx
+++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <tools/string.hxx>
+#include <rtl/ustring.hxx>
#include <unotools/ucblockbytes.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <comphelper/processfactory.hxx>
@@ -40,9 +40,9 @@ using namespace ::com::sun::star::beans;
namespace utl
{
-static SvStream* lcl_CreateStream( const String& rFileName, StreamMode eOpenMode,
- Reference < XInteractionHandler > xInteractionHandler,
- UcbLockBytesHandler* pHandler, sal_Bool bEnsureFileExists )
+static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+ Reference < XInteractionHandler > xInteractionHandler,
+ UcbLockBytesHandler* pHandler, bool bEnsureFileExists )
{
SvStream* pStream = NULL;
Reference< XUniversalContentBroker > ucb(
@@ -140,22 +140,22 @@ static SvStream* lcl_CreateStream( const String& rFileName, StreamMode eOpenMode
//============================================================================
-SvStream* UcbStreamHelper::CreateStream( const String& rFileName, StreamMode eOpenMode,
- UcbLockBytesHandler* pHandler )
+SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+ UcbLockBytesHandler* pHandler )
{
return lcl_CreateStream( rFileName, eOpenMode, Reference < XInteractionHandler >(), pHandler, sal_True /* bEnsureFileExists */ );
}
-SvStream* UcbStreamHelper::CreateStream( const String& rFileName, StreamMode eOpenMode,
- Reference < XInteractionHandler > xInteractionHandler,
- UcbLockBytesHandler* pHandler )
+SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+ Reference < XInteractionHandler > xInteractionHandler,
+ UcbLockBytesHandler* pHandler )
{
return lcl_CreateStream( rFileName, eOpenMode, xInteractionHandler, pHandler, sal_True /* bEnsureFileExists */ );
}
-SvStream* UcbStreamHelper::CreateStream( const String& rFileName, StreamMode eOpenMode,
- sal_Bool bFileExists,
- UcbLockBytesHandler* pHandler )
+SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+ bool bFileExists,
+ UcbLockBytesHandler* pHandler )
{
return lcl_CreateStream( rFileName, eOpenMode, Reference < XInteractionHandler >(), pHandler, !bFileExists );
}