summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-03-19 20:31:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-03-20 12:57:33 +0000
commitbdfba4dbf666868c6d10b972259884877dd01848 (patch)
tree2860856ab873b182752f2dc60c30d802a9a84aee /desktop
parent260ed4ed0317f4f16a675dde48750bc40923bc96 (diff)
make ResId->OUString the primary route
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/app.cxx80
-rw-r--r--desktop/source/app/cmdlinehelp.cxx18
-rw-r--r--desktop/source/deployment/gui/dp_gui_service.cxx55
3 files changed, 76 insertions, 77 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 5610637297e5..01d1c7de9867 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -291,68 +291,70 @@ namespace
: public rtl::Static< String, WriterCompatibilityVersionOOo11 > {};
}
-void ReplaceStringHookProc( UniString& rStr )
+rtl::OUString ReplaceStringHookProc( const rtl::OUString& rStr )
{
- static int nAll = 0, nPro = 0;
+ rtl::OUString sRet(rStr);
- nAll++;
- if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND )
+ if ( sRet.indexOf( "%PRODUCT" ) != -1 )
{
- String rBrandName = BrandName::get();
- String rVersion = Version::get();
- String rAboutBoxVersion = AboutBoxVersion::get();
- String rAboutBoxVersionSuffix = AboutBoxVersionSuffix::get();
- String rExtension = Extension::get();
- String rXMLFileFormatName = XMLFileFormatName::get();
- String rXMLFileFormatVersion = XMLFileFormatVersion::get();
+ rtl::OUString sBrandName = BrandName::get();
+ rtl::OUString sVersion = Version::get();
+ rtl::OUString sAboutBoxVersion = AboutBoxVersion::get();
+ rtl::OUString sAboutBoxVersionSuffix = AboutBoxVersionSuffix::get();
+ rtl::OUString sExtension = Extension::get();
+ rtl::OUString sXMLFileFormatName = XMLFileFormatName::get();
+ rtl::OUString sXMLFileFormatVersion = XMLFileFormatVersion::get();
- if ( !rBrandName.Len() )
+ if ( sBrandName.isEmpty() )
{
- rBrandName = utl::ConfigManager::getProductName();
- rXMLFileFormatName = utl::ConfigManager::getProductXmlFileFormat();
- rXMLFileFormatVersion =
+ sBrandName = utl::ConfigManager::getProductName();
+ sXMLFileFormatName = utl::ConfigManager::getProductXmlFileFormat();
+ sXMLFileFormatVersion =
utl::ConfigManager::getProductXmlFileFormatVersion();
- rVersion = utl::ConfigManager::getProductVersion();
- rAboutBoxVersion = utl::ConfigManager::getAboutBoxProductVersion();
- rAboutBoxVersionSuffix = utl::ConfigManager::getAboutBoxProductVersionSuffix();
- if ( !rExtension.Len() )
+ sVersion = utl::ConfigManager::getProductVersion();
+ sAboutBoxVersion = utl::ConfigManager::getAboutBoxProductVersion();
+ sAboutBoxVersionSuffix = utl::ConfigManager::getAboutBoxProductVersionSuffix();
+ if ( sExtension.isEmpty() )
{
- rExtension = utl::ConfigManager::getProductExtension();
+ sExtension = utl::ConfigManager::getProductExtension();
}
}
- nPro++;
- rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", rBrandName );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTVERSION", rVersion );
- rStr.SearchAndReplaceAllAscii( "%ABOUTBOXPRODUCTVERSIONSUFFIX", rAboutBoxVersionSuffix );
- rStr.SearchAndReplaceAllAscii( "%ABOUTBOXPRODUCTVERSION", rAboutBoxVersion );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTEXTENSION", rExtension );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATNAME", rXMLFileFormatName );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTXMLFILEFORMATVERSION", rXMLFileFormatVersion );
+ sRet = sRet.replaceAll( "%PRODUCTNAME", sBrandName );
+ sRet = sRet.replaceAll( "%PRODUCTVERSION", sVersion );
+ sRet = sRet.replaceAll( "%ABOUTBOXPRODUCTVERSIONSUFFIX", sAboutBoxVersionSuffix );
+ sRet = sRet.replaceAll( "%ABOUTBOXPRODUCTVERSION", sAboutBoxVersion );
+ sRet = sRet.replaceAll( "%PRODUCTEXTENSION", sExtension );
+ sRet = sRet.replaceAll( "%PRODUCTXMLFILEFORMATNAME", sXMLFileFormatName );
+ sRet = sRet.replaceAll( "%PRODUCTXMLFILEFORMATVERSION", sXMLFileFormatVersion );
}
- if ( rStr.SearchAscii( "%OOOVENDOR" ) != STRING_NOTFOUND )
+
+ if ( sRet.indexOf( "%OOOVENDOR" ) != -1 )
{
- String rOOOVendor = OOOVendor::get();
+ rtl::OUString sOOOVendor = OOOVendor::get();
- if ( !rOOOVendor.Len() )
+ if ( sOOOVendor.isEmpty() )
{
- rOOOVendor = utl::ConfigManager::getVendor();
+ sOOOVendor = utl::ConfigManager::getVendor();
}
- rStr.SearchAndReplaceAllAscii( "%OOOVENDOR" ,rOOOVendor );
+
+ sRet = sRet.replaceAll( "%OOOVENDOR", sOOOVendor );
}
- if ( rStr.SearchAscii( "%WRITERCOMPATIBILITYVERSIONOOO11" ) != STRING_NOTFOUND )
+ if ( sRet.indexOf( "%WRITERCOMPATIBILITYVERSIONOOO11" ) != -1 )
{
- String rWriterCompatibilityVersionOOo11 = WriterCompatibilityVersionOOo11::get();
- if ( !rWriterCompatibilityVersionOOo11.Len() )
+ rtl::OUString sWriterCompatibilityVersionOOo11 = WriterCompatibilityVersionOOo11::get();
+ if ( sWriterCompatibilityVersionOOo11.isEmpty() )
{
- rWriterCompatibilityVersionOOo11 =
+ sWriterCompatibilityVersionOOo11 =
utl::ConfigManager::getWriterCompatibilityVersionOOo_1_1();
}
- rStr.SearchAndReplaceAllAscii( "%WRITERCOMPATIBILITYVERSIONOOO11",
- rWriterCompatibilityVersionOOo11 );
+ sRet = sRet.replaceAll( "%WRITERCOMPATIBILITYVERSIONOOO11",
+ sWriterCompatibilityVersionOOo11 );
}
+
+ return sRet;
}
static const char pLastSyncFileName[] = "lastsynchronized";
diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx
index 39f72782c323..d09b5012f0ba 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -53,14 +53,14 @@ namespace desktop
// __BOTTOM__
// [OK]
- const char *aCmdLineHelp_version =
+ const char aCmdLineHelp_version[] =
"%PRODUCTNAME %PRODUCTVERSION %PRODUCTEXTENSION\n"\
"\n";
- const char *aCmdLineHelp_head =
+ const char aCmdLineHelp_head[] =
"Usage: %CMDNAME [options] [documents...]\n"\
"\n"\
"Options:\n";
- const char *aCmdLineHelp_left =
+ const char aCmdLineHelp_left[] =
"--minimized \n"\
"--invisible \n"\
"--norestore \n"\
@@ -81,7 +81,7 @@ namespace desktop
"--web \n"\
"-o \n"\
"-n \n";
- const char *aCmdLineHelp_right =
+ const char aCmdLineHelp_right[] =
"keep startup bitmap minimized.\n"\
"no startup screen, no default document and no UI.\n"\
"suppress restart/restore after fatal errors.\n"\
@@ -102,7 +102,7 @@ namespace desktop
"create new HTML document.\n"\
"open documents regardless whether they are templates or not.\n"\
"always open documents as new files (use as template).\n";
- const char *aCmdLineHelp_bottom =
+ const char aCmdLineHelp_bottom[] =
"--display <display>\n"\
" Specify X-Display to use in Unix/X11 versions.\n"
"-p <documents...>\n"\
@@ -134,7 +134,7 @@ namespace desktop
" --print-to-file --printer-name nasty_lowres_printer --outdir /home/user *.doc\n"\
"\nRemaining arguments will be treated as filenames or URLs of documents to open.\n\n";
- void ReplaceStringHookProc( UniString& rStr );
+ rtl::OUString ReplaceStringHookProc(const rtl::OUString& rStr);
void displayCmdlineHelp()
{
@@ -145,7 +145,7 @@ namespace desktop
String aHelpMessage_left(aCmdLineHelp_left, RTL_TEXTENCODING_ASCII_US);
String aHelpMessage_right(aCmdLineHelp_right, RTL_TEXTENCODING_ASCII_US);
String aHelpMessage_bottom(aCmdLineHelp_bottom, RTL_TEXTENCODING_ASCII_US);
- ReplaceStringHookProc(aHelpMessage_version);
+ aHelpMessage_version = ReplaceStringHookProc(aHelpMessage_version);
aHelpMessage_head.SearchAndReplaceAscii( "%CMDNAME", String( "soffice", RTL_TEXTENCODING_ASCII_US) );
#ifdef UNX
// on unix use console for output
@@ -181,8 +181,8 @@ namespace desktop
void displayVersion()
{
- String aVersionMsg(aCmdLineHelp_version, RTL_TEXTENCODING_ASCII_US);
- ReplaceStringHookProc(aVersionMsg);
+ rtl::OUString aVersionMsg(aCmdLineHelp_version);
+ aVersionMsg = ReplaceStringHookProc(aVersionMsg);
#ifdef UNX
fprintf(stdout, "%s", rtl::OUStringToOString(aVersionMsg, RTL_TEXTENCODING_ASCII_US).getStr());
#else
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index c0ab4600b61e..d8d31503b1f3 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -100,41 +100,38 @@ namespace
: public rtl::Static< String, Extension > {};
}
-void ReplaceProductNameHookProc( String& rStr )
+rtl::OUString ReplaceProductNameHookProc( const rtl::OUString& rStr )
{
- static int nAll = 0, nPro = 0;
+ if (rStr.indexOf( "%PRODUCT" ) == -1)
+ return rStr;
- nAll++;
- if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND )
+ rtl::OUString sProductName = ProductName::get();
+ rtl::OUString sVersion = Version::get();
+ rtl::OUString sAboutBoxVersion = AboutBoxVersion::get();
+ rtl::OUString sAboutBoxVersionSuffix = AboutBoxVersionSuffix::get();
+ rtl::OUString sExtension = Extension::get();
+ rtl::OUString sOOOVendor = OOOVendor::get();
+
+ if ( sProductName.isEmpty() )
{
- String rProductName = ProductName::get();
- String rVersion = Version::get();
- String rAboutBoxVersion = AboutBoxVersion::get();
- String rAboutBoxVersionSuffix = AboutBoxVersionSuffix::get();
- String rExtension = Extension::get();
- String rOOOVendor = OOOVendor::get();
-
- if ( !rProductName.Len() )
+ sProductName = utl::ConfigManager::getProductName();
+ sVersion = utl::ConfigManager::getProductVersion();
+ sAboutBoxVersion = utl::ConfigManager::getAboutBoxProductVersion();
+ sAboutBoxVersionSuffix = utl::ConfigManager::getAboutBoxProductVersionSuffix();
+ sOOOVendor = utl::ConfigManager::getVendor();
+ if ( sExtension.isEmpty() )
{
- rProductName = utl::ConfigManager::getProductName();
- rVersion = utl::ConfigManager::getProductVersion();
- rAboutBoxVersion = utl::ConfigManager::getAboutBoxProductVersion();
- rAboutBoxVersionSuffix = utl::ConfigManager::getAboutBoxProductVersionSuffix();
- rOOOVendor = utl::ConfigManager::getVendor();
- if ( !rExtension.Len() )
- {
- rExtension = utl::ConfigManager::getProductExtension();
- }
+ sExtension = utl::ConfigManager::getProductExtension();
}
-
- nPro++;
- rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", rProductName );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTVERSION", rVersion );
- rStr.SearchAndReplaceAllAscii( "%ABOUTBOXPRODUCTVERSIONSUFFIX", rAboutBoxVersionSuffix );
- rStr.SearchAndReplaceAllAscii( "%ABOUTBOXPRODUCTVERSION", rAboutBoxVersion );
- rStr.SearchAndReplaceAllAscii( "%OOOVENDOR", rOOOVendor );
- rStr.SearchAndReplaceAllAscii( "%PRODUCTEXTENSION", rExtension );
}
+
+ rtl::OUString sRet = rStr.replaceAll( "%PRODUCTNAME", sProductName );
+ sRet = sRet.replaceAll( "%PRODUCTVERSION", sVersion );
+ sRet = sRet.replaceAll( "%ABOUTBOXPRODUCTVERSIONSUFFIX", sAboutBoxVersionSuffix );
+ sRet = sRet.replaceAll( "%ABOUTBOXPRODUCTVERSION", sAboutBoxVersion );
+ sRet = sRet.replaceAll( "%OOOVENDOR", sOOOVendor );
+ sRet = sRet.replaceAll( "%PRODUCTEXTENSION", sExtension );
+ return sRet;
}
//==============================================================================