remove unnecessary use of OUString constructor in XMLHELP module

Change-Id: I033bcf9cddc58f605fe8d65731f8b312410da7e5
This commit is contained in:
Noel Grandin
2013-10-31 13:17:17 +02:00
parent c87a8fc648
commit 58fa3d50aa
4 changed files with 38 additions and 40 deletions

View File

@@ -221,9 +221,9 @@ static bool impl_getZipFile(
OUString aFileName = pPathArray[ i ]; OUString aFileName = pPathArray[ i ];
if ( !aFileName.isEmpty() ) if ( !aFileName.isEmpty() )
{ {
if ( 1 + aFileName.lastIndexOf( '/' ) != aFileName.getLength() ) if ( !aFileName.endsWith("/") )
{ {
aFileName += OUString( "/" ); aFileName += "/";
} }
aFileName += rZipName; aFileName += rZipName;
// the icons are not read when the URL is a symlink // the icons are not read when the URL is a symlink
@@ -249,7 +249,7 @@ OString Databases::getImagesZipFileURL()
// set root path // set root path
uno::Sequence < uno::Any > lParams(1); uno::Sequence < uno::Any > lParams(1);
beans::PropertyValue aParam ; beans::PropertyValue aParam ;
aParam.Name = OUString("nodepath"); aParam.Name = "nodepath";
aParam.Value <<= OUString("org.openoffice.Office.Common"); aParam.Value <<= OUString("org.openoffice.Office.Common");
lParams[0] = uno::makeAny(aParam); lParams[0] = uno::makeAny(aParam);
@@ -285,9 +285,7 @@ OString Databases::getImagesZipFileURL()
else else
aSymbolsStyleName = "tango"; aSymbolsStyleName = "tango";
} }
OUString aZipName = OUString( "images_" ); OUString aZipName = "images_" + aSymbolsStyleName + ".zip";
aZipName += aSymbolsStyleName;
aZipName += OUString( ".zip" );
bFound = impl_getZipFile( m_aImagesZipPaths, aZipName, aImageZip ); bFound = impl_getZipFile( m_aImagesZipPaths, aZipName, aImageZip );
} }
@@ -296,7 +294,7 @@ OString Databases::getImagesZipFileURL()
bFound = impl_getZipFile( m_aImagesZipPaths, OUString( "images.zip" ), aImageZip ); bFound = impl_getZipFile( m_aImagesZipPaths, OUString( "images.zip" ), aImageZip );
if ( ! bFound ) if ( ! bFound )
aImageZip = OUString(); aImageZip = "";
m_aImagesZipFileURL = OUStringToOString( m_aImagesZipFileURL = OUStringToOString(
rtl::Uri::encode( rtl::Uri::encode(
@@ -601,7 +599,7 @@ helpdatafileproxy::Hdf* Databases::getHelpDataFile( const OUString& Database,
OUString fileNameHDFHelp( fileURL ); OUString fileNameHDFHelp( fileURL );
//Extensions always use the new format //Extensions always use the new format
if( pExtensionPath != NULL ) if( pExtensionPath != NULL )
fileNameHDFHelp += OUString( "_" ); fileNameHDFHelp += "_";
//SimpleFileAccess takes file URLs as arguments!!! Using filenames works accidentally but //SimpleFileAccess takes file URLs as arguments!!! Using filenames works accidentally but
//fails for example when using long path names on Windows (starting with \\?\) //fails for example when using long path names on Windows (starting with \\?\)
if( m_xSFA->exists( fileNameHDFHelp ) ) if( m_xSFA->exists( fileNameHDFHelp ) )
@@ -636,21 +634,21 @@ Databases::getCollator( const OUString& Language,
if( countryStr.isEmpty() ) if( countryStr.isEmpty() )
{ {
if( langStr.compareToAscii("de") == 0 ) if( langStr.compareToAscii("de") == 0 )
countryStr = OUString("DE"); countryStr = "DE";
else if( langStr.compareToAscii("en") == 0 ) else if( langStr.compareToAscii("en") == 0 )
countryStr = OUString("US"); countryStr = "US";
else if( langStr.compareToAscii("es") == 0 ) else if( langStr.compareToAscii("es") == 0 )
countryStr = OUString("ES"); countryStr = "ES";
else if( langStr.compareToAscii("it") == 0 ) else if( langStr.compareToAscii("it") == 0 )
countryStr = OUString("IT"); countryStr = "IT";
else if( langStr.compareToAscii("fr") == 0 ) else if( langStr.compareToAscii("fr") == 0 )
countryStr = OUString("FR"); countryStr = "FR";
else if( langStr.compareToAscii("sv") == 0 ) else if( langStr.compareToAscii("sv") == 0 )
countryStr = OUString("SE"); countryStr = "SE";
else if( langStr.compareToAscii("ja") == 0 ) else if( langStr.compareToAscii("ja") == 0 )
countryStr = OUString("JP"); countryStr = "JP";
else if( langStr.compareToAscii("ko") == 0 ) else if( langStr.compareToAscii("ko") == 0 )
countryStr = OUString("KR"); countryStr = "KR";
} }
/* FIXME-BCP47: all this does not look right for language tag context, /* FIXME-BCP47: all this does not look right for language tag context,
* also check processLang() and country() methods */ * also check processLang() and country() methods */
@@ -961,7 +959,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( const OUString& jar,
// let ZipPackage be used ( no manifest.xml is required ) // let ZipPackage be used ( no manifest.xml is required )
beans::NamedValue aArg; beans::NamedValue aArg;
aArg.Name = OUString( "StorageFormat" ); aArg.Name = "StorageFormat";
aArg.Value <<= ZIP_STORAGE_FORMAT_STRING; aArg.Value <<= ZIP_STORAGE_FORMAT_STRING;
aArguments[ 1 ] <<= aArg; aArguments[ 1 ] <<= aArg;
@@ -1081,7 +1079,7 @@ void Databases::cascadingStylesheet( const OUString& Language,
uno::Any aHCMode = xVclWindowPeer->getProperty( OUString( "HighContrastMode" ) ); uno::Any aHCMode = xVclWindowPeer->getProperty( OUString( "HighContrastMode" ) );
if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode ) if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode )
{ {
aCSS = OUString( "highcontrastblack" ); aCSS = "highcontrastblack";
#ifdef WNT #ifdef WNT
HKEY hKey = NULL; HKEY hKey = NULL;
LONG lResult = RegOpenKeyExA( HKEY_CURRENT_USER, "Control Panel\\Accessibility\\HighContrast", 0, KEY_QUERY_VALUE, &hKey ); LONG lResult = RegOpenKeyExA( HKEY_CURRENT_USER, "Control Panel\\Accessibility\\HighContrast", 0, KEY_QUERY_VALUE, &hKey );
@@ -1094,11 +1092,11 @@ void Databases::cascadingStylesheet( const OUString& Language,
{ {
szBuffer[nSize] = '\0'; szBuffer[nSize] = '\0';
if ( strncmp( szBuffer, "High Contrast #1", strlen("High Contrast #1") ) == 0 ) if ( strncmp( szBuffer, "High Contrast #1", strlen("High Contrast #1") ) == 0 )
aCSS = OUString( "highcontrast1" ); aCSS = "highcontrast1";
if ( strncmp( szBuffer, "High Contrast #2", strlen("High Contrast #2") ) == 0 ) if ( strncmp( szBuffer, "High Contrast #2", strlen("High Contrast #2") ) == 0 )
aCSS = OUString( "highcontrast2" ); aCSS = "highcontrast2";
if ( strncmp( szBuffer, "High Contrast White", strlen("High Contrast White") ) == 0 ) if ( strncmp( szBuffer, "High Contrast White", strlen("High Contrast White") ) == 0 )
aCSS = OUString( "highcontrastwhite" ); aCSS = "highcontrastwhite";
} }
RegCloseKey( hKey ); RegCloseKey( hKey );
} }
@@ -1147,7 +1145,7 @@ void Databases::cascadingStylesheet( const OUString& Language,
if ( !retry && error && bHighContrastMode ) if ( !retry && error && bHighContrastMode )
{ {
// fall back to default css // fall back to default css
aCSS = OUString( "default" ); aCSS = "default";
retry = 2; retry = 2;
bHighContrastMode = sal_False; bHighContrastMode = sal_False;
} }
@@ -1235,8 +1233,8 @@ void Databases::setInstallPath( const OUString& aInstDir )
osl::FileBase::getFileURLFromSystemPath( aInstDir,m_aInstallDirectory ); osl::FileBase::getFileURLFromSystemPath( aInstDir,m_aInstallDirectory );
//TODO: check returned error code //TODO: check returned error code
if( m_aInstallDirectory.lastIndexOf( sal_Unicode( '/' ) ) != m_aInstallDirectory.getLength() - 1 ) if( m_aInstallDirectory.endsWith( "/" ) )
m_aInstallDirectory += OUString( "/" ); m_aInstallDirectory += "/";
} }
// class ExtensionIteratorBase // class ExtensionIteratorBase
@@ -1760,7 +1758,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage
// let ZipPackage be used ( no manifest.xml is required ) // let ZipPackage be used ( no manifest.xml is required )
beans::NamedValue aArg; beans::NamedValue aArg;
aArg.Name = OUString( "StorageFormat" ); aArg.Name = "StorageFormat";
aArg.Value <<= ZIP_STORAGE_FORMAT_STRING; aArg.Value <<= ZIP_STORAGE_FORMAT_STRING;
aArguments[ 1 ] <<= aArg; aArguments[ 1 ] <<= aArg;
@@ -1912,7 +1910,7 @@ OUString IndexFolderIterator::implGetIndexFolderFromPackage( bool& o_rbTemporary
if( nLastSlash != -1 ) if( nLastSlash != -1 )
aLang = aLangURL.copy( nLastSlash + 1 ); aLang = aLangURL.copy( nLastSlash + 1 );
else else
aLang = OUString( "en" ); aLang = "en";
OUString aMod("help"); OUString aMod("help");

View File

@@ -224,7 +224,7 @@ void ContentProvider::init()
OUString instPath( getKey( xHierAccess,"Path/Current/Help" ) ); OUString instPath( getKey( xHierAccess,"Path/Current/Help" ) );
if( instPath.isEmpty() ) if( instPath.isEmpty() )
// try to determine path from default // try to determine path from default
instPath = OUString( "$(instpath)/" LIBO_SHARE_HELP_FOLDER ); instPath = "$(instpath)/" LIBO_SHARE_HELP_FOLDER;
// replace anything like $(instpath); // replace anything like $(instpath);
subst( instPath ); subst( instPath );
@@ -260,7 +260,7 @@ void ContentProvider::init()
uno::Sequence < uno::Any > lParams(1); uno::Sequence < uno::Any > lParams(1);
beans::PropertyValue aParam ; beans::PropertyValue aParam ;
aParam.Name = OUString("nodepath"); aParam.Name = "nodepath";
aParam.Value <<= OUString("/org.openoffice.Setup/Product"); aParam.Value <<= OUString("/org.openoffice.Setup/Product");
lParams[0] = uno::makeAny(aParam); lParams[0] = uno::makeAny(aParam);
@@ -290,7 +290,7 @@ void ContentProvider::init()
subst( aPath ); subst( aPath );
aImagesZipPaths[ 0 ] = aPath; aImagesZipPaths[ 0 ] = aPath;
aPath = OUString("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config"); aPath = "$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config";
rtl::Bootstrap::expandMacros(aPath); rtl::Bootstrap::expandMacros(aPath);
aImagesZipPaths[ 1 ] = aPath; aImagesZipPaths[ 1 ] = aPath;

View File

@@ -167,7 +167,7 @@ OUString URLParameter::get_title()
m_aTitle = inf->get_title(); m_aTitle = inf->get_title();
} }
else // This must be the root else // This must be the root
m_aTitle = OUString("root"); m_aTitle = "root";
return m_aTitle; return m_aTitle;
} }
@@ -610,7 +610,7 @@ bool URLParameter::query()
if( delimIdx == -1 ) if( delimIdx == -1 )
{ {
value = query_.copy( equalIdx + 1 ).trim(); value = query_.copy( equalIdx + 1 ).trim();
query_ = OUString(); query_ = "";
} }
else else
{ {

View File

@@ -329,9 +329,9 @@ TVRead::getElementNames( )
{ {
Sequence< OUString > seq( 3 ); Sequence< OUString > seq( 3 );
seq[0] = OUString( "Title" ); seq[0] = "Title";
seq[1] = OUString( "TargetURL" ); seq[1] = "TargetURL";
seq[2] = OUString( "Children" ); seq[2] = "Children";
return seq; return seq;
} }
@@ -669,7 +669,7 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
OUString instPath( getKey( xHierAccess,"Path/Current/Help" ) ); OUString instPath( getKey( xHierAccess,"Path/Current/Help" ) );
if( instPath.isEmpty() ) if( instPath.isEmpty() )
// try to determine path from default // try to determine path from default
instPath = OUString( "$(instpath)/help" ); instPath = "$(instpath)/help";
// replace anything like $(instpath); // replace anything like $(instpath);
subst( instPath ); subst( instPath );
@@ -690,7 +690,7 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
uno::Sequence < uno::Any > lParams(1); uno::Sequence < uno::Any > lParams(1);
beans::PropertyValue aParam ; beans::PropertyValue aParam ;
aParam.Name = OUString("nodepath"); aParam.Name = "nodepath";
aParam.Value <<= OUString("/org.openoffice.Setup/Product"); aParam.Value <<= OUString("/org.openoffice.Setup/Product");
lParams[0] = uno::makeAny(aParam); lParams[0] = uno::makeAny(aParam);
@@ -718,7 +718,7 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
osl::FileBase::RC errFile = osl::FileBase::getFileURLFromSystemPath( instPath,url ); osl::FileBase::RC errFile = osl::FileBase::getFileURLFromSystemPath( instPath,url );
if( errFile != osl::FileBase::E_None ) return configData; if( errFile != osl::FileBase::E_None ) return configData;
if( url.lastIndexOf( sal_Unicode( '/' ) ) != url.getLength() - 1 ) if( url.lastIndexOf( sal_Unicode( '/' ) ) != url.getLength() - 1 )
url += OUString( "/" ); url += "/";
OUString ret; OUString ret;
sal_Int32 idx; sal_Int32 idx;
osl::DirectoryItem aDirItem; osl::DirectoryItem aDirItem;
@@ -731,8 +731,8 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext )
ret = locale.copy( 0,idx ); ret = locale.copy( 0,idx );
else else
{ {
locale = OUString( "en-US" ); locale = "en-US";
ret = OUString("en"); ret = "en";
} }
url = url + ret; url = url + ret;
@@ -1229,7 +1229,7 @@ OUString TreeFileIterator::implGetTreeFileFromPackage
if( m_xSFA->exists( aRetFile ) ) if( m_xSFA->exists( aRetFile ) )
rnFileSize = m_xSFA->getSize( aRetFile ); rnFileSize = m_xSFA->getSize( aRetFile );
else else
aRetFile = OUString(); aRetFile = "";
return aRetFile; return aRetFile;
} }