diff options
68 files changed, 473 insertions, 1296 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 0fae48f193b8..de19df3769cf 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1717,13 +1717,9 @@ void SvxConfigPage::Reset( const SfxItemSet& ) if ( pModuleData != NULL ) { - OUString label; - utl::ConfigManager::GetDirectConfigProperty( - utl::ConfigManager::PRODUCTNAME ) >>= label; - label += OUString(RTL_CONSTASCII_USTRINGPARAM( " " )); - label += aModuleName; - - nPos = aSaveInListBox.InsertEntry( label ); + nPos = aSaveInListBox.InsertEntry( + utl::ConfigManager::getProductName() + + OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) + aModuleName ); aSaveInListBox.SetEntryData( nPos, pModuleData ); } diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx index 7b4c04edbae6..2fbb572241fe 100644 --- a/cui/source/customize/eventdlg.cxx +++ b/cui/source/customize/eventdlg.cxx @@ -101,10 +101,8 @@ SvxEventConfigPage::SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet, if ( xSupplier.is() ) { m_xAppEvents = xSupplier->getEvents(); - OUString label; - utl::ConfigManager::GetDirectConfigProperty( - utl::ConfigManager::PRODUCTNAME ) >>= label; - nPos = aSaveInListBox.InsertEntry( label ); + nPos = aSaveInListBox.InsertEntry( + utl::ConfigManager::getProductName() ); aSaveInListBox.SetEntryData( nPos, new bool(true) ); aSaveInListBox.SelectEntryPos( nPos, sal_True ); } diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index b987b4af08ed..03555748f12d 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -114,9 +114,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : m_aLinkStr(ResId( ABOUT_STR_LINK, *rId.GetResMgr())), m_sBuildStr(ResId(ABOUT_STR_BUILD, *rId.GetResMgr())) { - rtl::OUString sProduct; - utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; - // load image from module path aAppLogo = SfxApplication::GetApplicationLogo(); @@ -162,8 +159,10 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : rtl::OUStringBuffer sText(m_aVendorTextStr); sText.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\n")); - sal_uInt32 nCopyrightId = sProduct.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("LibreOffice" )) ? - ABOUT_STR_COPYRIGHT : ABOUT_STR_COPYRIGHT_DERIVED; + sal_uInt32 nCopyrightId = + utl::ConfigManager::getProductName().equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("LibreOffice")) + ? ABOUT_STR_COPYRIGHT : ABOUT_STR_COPYRIGHT_DERIVED; String aProductCopyrightTextStr(ResId(nCopyrightId, *rId.GetResMgr())); sText.append(aProductCopyrightTextStr); sText.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\n")); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 89855ac28fa4..d5f48812e779 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -2586,7 +2586,7 @@ short OfaTreeOptionsDialog::Execute() ApplyItemSets(); if( mpColorPage ) mpColorPage->SaveToViewFrame( SfxViewFrame::Current() ); - utl::ConfigManager::GetConfigManager().StoreConfigItems(); + utl::ConfigManager::storeConfigItems(); } return nRet; diff --git a/dbaccess/source/core/misc/userinformation.cxx b/dbaccess/source/core/misc/userinformation.cxx index 27ea6bb51f8b..03b51c9fee8b 100644 --- a/dbaccess/source/core/misc/userinformation.cxx +++ b/dbaccess/source/core/misc/userinformation.cxx @@ -34,18 +34,17 @@ #include <osl/diagnose.h> #include <i18npool/mslangid.hxx> #include <unotools/configmgr.hxx> -#include <comphelper/types.hxx> using namespace ::utl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; //-------------------------------------------------------------------------- -UserInformation::UserInformation() -{ - Any aValue = ConfigManager::GetDirectConfigProperty(ConfigManager::LOCALE); - LanguageType eLanguage = MsLangId::convertIsoStringToLanguage(comphelper::getString(aValue),'-'); - m_aUserLocale = MsLangId::convertLanguageToLocale(eLanguage); -} +UserInformation::UserInformation(): + m_aUserLocale( + MsLangId::convertLanguageToLocale( + MsLangId::convertIsoStringToLanguage( + ConfigManager::getLocale(), '-'))) +{} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index 80a1378d6a5d..3abbc2778179 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -456,13 +456,6 @@ struct SQLMessageBox_Impl //------------------------------------------------------------------------------ namespace { - ::rtl::OUString lcl_getProductName() - { - ::rtl::OUString sProductName; - OSL_VERIFY( ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ) >>= sProductName ); - return sProductName; - } - void lcl_positionInAppFont( const Window& _rParent, Window& _rChild, long _nX, long _nY, long _Width, long _Height ) { Point aPos = _rParent.LogicToPixel( Point( _nX, _nY ), MAP_APPFONT ); @@ -694,9 +687,9 @@ void OSQLMessageBox::impl_addDetailsButton() //------------------------------------------------------------------------------ void OSQLMessageBox::Construct( WinBits _nStyle, MessageType _eImage ) { - // Changed as per BugID 79541 Branding/Configuration - String sDialogTitle( lcl_getProductName() ); - SetText( sDialogTitle.AppendAscii( " Base" ) ); + SetText( + utl::ConfigManager::getProductName() + + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Base" ) ) ); // position and size the controls and the dialog, depending on whether we have one or two texts to display impl_positionControls(); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 19687ae69c5b..b0d2dfcbd3e0 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1246,13 +1246,6 @@ void fillAutoIncrementValue(const Reference<XConnection>& _xConnection, // ----------------------------------------------------------------------------- void AppendConfigToken( ::rtl::OUString& _rURL, sal_Bool _bQuestionMark ) { - Any aLocale = - ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty( ::utl::ConfigManager::LOCALE ); - ::rtl::OUString sLocaleStr; - if ( !( aLocale >>= sLocaleStr ) ) - // fallback is english - sLocaleStr = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")); - // query part exists? if ( _bQuestionMark ) // no, so start with '?' @@ -1263,7 +1256,7 @@ void AppendConfigToken( ::rtl::OUString& _rURL, sal_Bool _bQuestionMark ) // set parameters _rURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Language=")); - _rURL += sLocaleStr; + _rURL += utl::ConfigManager::getLocale(); _rURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("&System=")); _rURL += SvtHelpOptions().GetSystem(); } diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 1555510efab7..38ba4db1caa5 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -133,7 +133,6 @@ #include <rtl/strbuf.hxx> #include <rtl/bootstrap.hxx> #include <rtl/instance.hxx> -#include <unotools/configmgr.hxx> #include <vcl/help.hxx> #include <vcl/msgbox.hxx> #include <vcl/bitmap.hxx> @@ -359,41 +358,24 @@ void ReplaceStringHookProc( UniString& rStr ) nAll++; if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND ) { - String &rBrandName = BrandName::get(); - String &rVersion = Version::get(); - String &rAboutBoxVersion = AboutBoxVersion::get(); - String &rExtension = Extension::get(); - String &rXMLFileFormatName = XMLFileFormatName::get(); - String &rXMLFileFormatVersion = XMLFileFormatVersion::get(); + String rBrandName = BrandName::get(); + String rVersion = Version::get(); + String rAboutBoxVersion = AboutBoxVersion::get(); + String rExtension = Extension::get(); + String rXMLFileFormatName = XMLFileFormatName::get(); + String rXMLFileFormatVersion = XMLFileFormatVersion::get(); if ( !rBrandName.Len() ) { - rtl::OUString aTmp; - Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - aRet >>= aTmp; - rBrandName = aTmp; - - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTXMLFILEFORMATNAME ); - aRet >>= aTmp; - rXMLFileFormatName = aTmp; - - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTXMLFILEFORMATVERSION ); - aRet >>= aTmp; - rXMLFileFormatVersion = aTmp; - - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); - aRet >>= aTmp; - rVersion = aTmp; - - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::ABOUTBOXPRODUCTVERSION ); - aRet >>= aTmp; - rAboutBoxVersion = aTmp; - + rBrandName = utl::ConfigManager::getProductName(); + rXMLFileFormatName = utl::ConfigManager::getProductXmlFileFormat(); + rXMLFileFormatVersion = + utl::ConfigManager::getProductXmlFileFormatVersion(); + rVersion = utl::ConfigManager::getProductVersion(); + rAboutBoxVersion = utl::ConfigManager::getAboutBoxProductVersion(); if ( !rExtension.Len() ) { - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTEXTENSION ); - aRet >>= aTmp; - rExtension = aTmp; + rExtension = utl::ConfigManager::getProductExtension(); } } @@ -407,30 +389,22 @@ void ReplaceStringHookProc( UniString& rStr ) } if ( rStr.SearchAscii( "%OOOVENDOR" ) != STRING_NOTFOUND ) { - String &rOOOVendor = OOOVendor::get(); + String rOOOVendor = OOOVendor::get(); if ( !rOOOVendor.Len() ) { - rtl::OUString aTmp; - Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::OOOVENDOR ); - aRet >>= aTmp; - rOOOVendor = aTmp; - + rOOOVendor = utl::ConfigManager::getVendor(); } rStr.SearchAndReplaceAllAscii( "%OOOVENDOR" ,rOOOVendor ); } if ( rStr.SearchAscii( "%WRITERCOMPATIBILITYVERSIONOOO11" ) != STRING_NOTFOUND ) { - String &rWriterCompatibilityVersionOOo11 = WriterCompatibilityVersionOOo11::get(); + String rWriterCompatibilityVersionOOo11 = WriterCompatibilityVersionOOo11::get(); if ( !rWriterCompatibilityVersionOOo11.Len() ) { - rtl::OUString aTmp; - Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::WRITERCOMPATIBILITYVERSIONOOO11 ); - aRet >>= aTmp; - rWriterCompatibilityVersionOOo11 = aTmp; + rWriterCompatibilityVersionOOo11 = + utl::ConfigManager::getWriterCompatibilityVersionOOo_1_1(); } rStr.SearchAndReplaceAllAscii( "%WRITERCOMPATIBILITYVERSIONOOO11", @@ -792,7 +766,7 @@ void Desktop::DeInit() try { // instead of removing of the configManager just let it commit all the changes RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); - utl::ConfigManager::GetConfigManager().StoreConfigItems(); + utl::ConfigManager::storeConfigItems(); FlushConfiguration(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); @@ -822,7 +796,7 @@ sal_Bool Desktop::QueryExit() try { RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); - utl::ConfigManager::GetConfigManager().StoreConfigItems(); + utl::ConfigManager::storeConfigItems(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); } catch ( RuntimeException& ) @@ -2065,18 +2039,14 @@ sal_Bool Desktop::InitializeConfiguration() void Desktop::FlushConfiguration() { - Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager().GetConfigurationProvider(), UNO_QUERY ); - if (xCFGFlush.is()) - { - xCFGFlush->flush(); - } - else - { - // because there is no method to flush the condiguration data, we must dispose the ConfigManager - Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager().GetConfigurationProvider(), UNO_QUERY ); - if (xCFGDispose.is()) - xCFGDispose->dispose(); - } + css::uno::Reference< css::util::XFlushable >( + (css::uno::Reference< css::lang::XMultiServiceFactory >( + comphelper::getProcessServiceFactory(), css::uno::UNO_SET_THROW)-> + createInstance( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider")))), + css::uno::UNO_QUERY_THROW)->flush(); } sal_Bool Desktop::shouldLaunchQuickstart() @@ -2620,19 +2590,15 @@ void Desktop::OpenClients() aHelpURLBuffer.appendAscii("vnd.sun.star.help://smath/start"); } if (bShowHelp) { - Help *pHelp = Application::GetHelp(); - - Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::LOCALE ); - rtl::OUString aTmp; - aRet >>= aTmp; aHelpURLBuffer.appendAscii("?Language="); - aHelpURLBuffer.append(aTmp); + aHelpURLBuffer.append(utl::ConfigManager::getLocale()); #if defined UNX aHelpURLBuffer.appendAscii("&System=UNX"); #elif defined WNT aHelpURLBuffer.appendAscii("&System=WIN"); #endif - pHelp->Start(aHelpURLBuffer.makeStringAndClear(), NULL); + Application::GetHelp()->Start( + aHelpURLBuffer.makeStringAndClear(), NULL); return; } } diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index d9273c029eb3..6d42f7b2df2b 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -826,11 +826,8 @@ void SAL_CALL OfficeIPCThread::run() aHelpURLBuffer.appendAscii("vnd.sun.star.help://smath/start"); } if (bShowHelp) { - Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::LOCALE ); - rtl::OUString aTmp; - aRet >>= aTmp; aHelpURLBuffer.appendAscii("?Language="); - aHelpURLBuffer.append(aTmp); + aHelpURLBuffer.append(utl::ConfigManager::getLocale()); #if defined UNX aHelpURLBuffer.appendAscii("&System=UNX"); #elif defined WNT diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index a0768dd0806c..1cc397b629cf 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -64,6 +64,7 @@ #include "comphelper/processfactory.hxx" #include "ucbhelper/content.hxx" #include "unotools/collatorwrapper.hxx" +#include "unotools/configmgr.hxx" #include "com/sun/star/beans/StringPair.hpp" @@ -577,12 +578,11 @@ ResId DialogHelper::getResId( sal_uInt16 nId ) //------------------------------------------------------------------------------ String DialogHelper::getResourceString( sal_uInt16 id ) { - // init with non-acquired solar mutex: - BrandName::get(); const SolarMutexGuard guard; String ret( ResId( id, *DeploymentGuiResMgr::get() ) ); if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) { - ret.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); + ret.SearchAndReplaceAllAscii( + "%PRODUCTNAME", utl::ConfigManager::getProductName() ); } return ret; } @@ -607,7 +607,8 @@ bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment:: const SolarMutexGuard guard; WarningBox aInfoBox( pParent, getResId( nResID ) ); String aMsgText = aInfoBox.GetMessText(); - aMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); + aMsgText.SearchAndReplaceAllAscii( + "%PRODUCTNAME", utl::ConfigManager::getProductName() ); aInfoBox.SetMessText( aMsgText ); bHadWarning = true; @@ -665,7 +666,8 @@ bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const QueryBox aQuery( m_pVCLWindow, getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) ); String sMsgText = aQuery.GetMessText(); - sMsgText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); + sMsgText.SearchAndReplaceAllAscii( + "%PRODUCTNAME", utl::ConfigManager::getProductName() ); aQuery.SetMessText( sMsgText ); sal_uInt16 nYesBtnID = aQuery.GetButtonId( 0 ); @@ -1279,7 +1281,8 @@ UpdateRequiredDialog::UpdateRequiredDialog( Window *pParent, TheExtensionManager m_aCancelBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) ); String aText = m_aUpdateNeeded.GetText(); - aText.SearchAndReplaceAllAscii( "%PRODUCTNAME", BrandName::get() ); + aText.SearchAndReplaceAllAscii( + "%PRODUCTNAME", utl::ConfigManager::getProductName() ); m_aUpdateNeeded.SetText( aText ); // resize update button diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 38c081b1c3fc..71ee6c466b8a 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -107,36 +107,21 @@ void ReplaceProductNameHookProc( String& rStr ) nAll++; if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND ) { - String &rProductName = ProductName::get(); - String &rVersion = Version::get(); - String &rAboutBoxVersion = AboutBoxVersion::get(); - String &rExtension = Extension::get(); - String &rOOOVendor = OOOVendor::get(); + String rProductName = ProductName::get(); + String rVersion = Version::get(); + String rAboutBoxVersion = AboutBoxVersion::get(); + String rExtension = Extension::get(); + String rOOOVendor = OOOVendor::get(); if ( !rProductName.Len() ) { - rtl::OUString aTmp; - Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - aRet >>= aTmp; - rProductName = aTmp; - - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); - aRet >>= aTmp; - rVersion = aTmp; - - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::ABOUTBOXPRODUCTVERSION ); - aRet >>= aTmp; - rAboutBoxVersion = aTmp; - - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::OOOVENDOR ); - aRet >>= aTmp; - rOOOVendor = aTmp; - + rProductName = utl::ConfigManager::getProductName(); + rVersion = utl::ConfigManager::getProductVersion(); + rAboutBoxVersion = utl::ConfigManager::getAboutBoxProductVersion(); + rOOOVendor = utl::ConfigManager::getVendor(); if ( !rExtension.Len() ) { - aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTEXTENSION ); - aRet >>= aTmp; - rExtension = aTmp; + rExtension = utl::ConfigManager::getProductExtension(); } } @@ -253,19 +238,14 @@ void ServiceImpl::startExecuteModal( throw RuntimeException( OUSTR("Cannot initialize VCL!"), static_cast<OWeakObject *>(this) ); AllSettings as = app->GetSettings(); - OUString slang; - if (! (::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::LOCALE ) >>= slang)) - throw RuntimeException( OUSTR("Cannot determine language!"), - static_cast<OWeakObject *>(this) ); - as.SetUILanguage( MsLangId::convertIsoStringToLanguage( slang ) ); + as.SetUILanguage( + MsLangId::convertIsoStringToLanguage( + utl::ConfigManager::getLocale() ) ); app->SetSettings( as ); - String sTitle = ::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::PRODUCTNAME).get<OUString>() - + String(static_cast<sal_Unicode>(' ')) - + ::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::PRODUCTVERSION).get<OUString>(); - app->SetDisplayName(sTitle); + app->SetDisplayName( + utl::ConfigManager::getProductName() + + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) + + utl::ConfigManager::getProductVersion()); ExtensionCmdQueue::syncRepositories( m_xComponentContext ); } } diff --git a/desktop/source/deployment/gui/dp_gui_shared.hxx b/desktop/source/deployment/gui/dp_gui_shared.hxx index 3e2db45bfdd7..bc2e08e57039 100644 --- a/desktop/source/deployment/gui/dp_gui_shared.hxx +++ b/desktop/source/deployment/gui/dp_gui_shared.hxx @@ -29,7 +29,6 @@ #if !defined INCLUDED_DP_GUI_SHARED_HXX #define INCLUDED_DP_GUI_SHARED_HXX -#include "unotools/configmgr.hxx" #include "rtl/instance.hxx" #include "tools/resmgr.hxx" @@ -45,13 +44,6 @@ struct DeploymentGuiResMgr : } }; -struct BrandName : public ::rtl::StaticWithInit< ::rtl::OUString, BrandName > { - const ::rtl::OUString operator () () { - return ::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::PRODUCTNAME ).get< ::rtl::OUString >(); - } -}; - class DpGuiResId : public ResId { public: diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index f0b3f41d9e09..bf31cf195ed1 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -101,6 +101,7 @@ #include "tools/resmgr.hxx" #include "tools/solar.h" #include "tools/string.hxx" +#include "unotools/configmgr.hxx" #include "vcl/button.hxx" #include "vcl/dialog.hxx" #include "vcl/fixed.hxx" @@ -1288,12 +1289,12 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) nPos = m_noDependencyCurVer.indexOf( sProductName ); if ( nPos >= 0 ) { - m_noDependencyCurVer = m_noDependencyCurVer.replaceAt( nPos, sProductName.getLength(), BrandName::get() ); + m_noDependencyCurVer = m_noDependencyCurVer.replaceAt( nPos, sProductName.getLength(), utl::ConfigManager::getProductName() ); } nPos = m_noDependency.indexOf( sProductName ); if ( nPos >= 0 ) { - m_noDependency = m_noDependency.replaceAt( nPos, sProductName.getLength(), BrandName::get() ); + m_noDependency = m_noDependency.replaceAt( nPos, sProductName.getLength(), utl::ConfigManager::getProductName() ); } b.append(m_noInstall); diff --git a/desktop/source/deployment/misc/dp_resource.cxx b/desktop/source/deployment/misc/dp_resource.cxx index a20f1b3c56d8..89d3de3ef0fb 100644 --- a/desktop/source/deployment/misc/dp_resource.cxx +++ b/desktop/source/deployment/misc/dp_resource.cxx @@ -48,10 +48,7 @@ namespace { struct OfficeLocale : public rtl::StaticWithInit<OUString, OfficeLocale> { const OUString operator () () { - OUString slang; - if (! (::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::LOCALE ) >>= slang)) - throw RuntimeException( OUSTR("Cannot determine language!"), 0 ); + OUString slang(utl::ConfigManager::getLocale()); //fallback, the locale is currently only set when the user starts the //office for the first time. if (slang.getLength() == 0) @@ -83,16 +80,8 @@ String getResourceString( sal_uInt16 id ) { const osl::MutexGuard guard( s_mutex ); String ret( ResId( id, *DeploymentResMgr::get() ) ); - if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) { - static String s_brandName; - if (s_brandName.Len() == 0) { - OUString brandName( - ::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::PRODUCTNAME ).get<OUString>() ); - s_brandName = brandName; - } - ret.SearchAndReplaceAllAscii( "%PRODUCTNAME", s_brandName ); - } + ret.SearchAndReplaceAllAscii( + "%PRODUCTNAME", utl::ConfigManager::getProductName() ); return ret; } diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 906f034a1acd..f242c3449282 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -539,11 +539,6 @@ static FileBase::RC _checkAndCreateDirectory(INetURLObject& dirURL) install_info MigrationImpl::findInstallation(const strings_v& rVersions) { - rtl::OUString aProductName; - uno::Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - aRet >>= aProductName; - aProductName = aProductName.toAsciiLowerCase(); - install_info aInfo; strings_v::const_iterator i_ver = rVersions.begin(); while (i_ver != rVersions.end()) @@ -556,9 +551,10 @@ install_info MigrationImpl::findInstallation(const strings_v& rVersions) aProfileName = (*i_ver).copy( nSeparatorIndex+1 ); } - if ( aVersion.getLength() && aProfileName.getLength() && - ( !aInfo.userdata.getLength() || !aProfileName.toAsciiLowerCase().compareTo( aProductName, aProductName.getLength() ) ) - ) + if ( !aVersion.isEmpty() && !aProfileName.isEmpty() && + ( aInfo.userdata.isEmpty() || + aProfileName.equalsIgnoreAsciiCase( + utl::ConfigManager::getProductName() ) ) ) { ::rtl::OUString aUserInst; osl::Security().getConfigDir( aUserInst ); diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index 1732b3fb5f88..4c9bd17b9f3c 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -66,18 +66,6 @@ using ::rtl::OUString; namespace { //============================================================================== -struct OfficeLocale : - public rtl::StaticWithInit<lang::Locale, OfficeLocale> { - const lang::Locale operator () () { - OUString slang; - if (! (::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::LOCALE ) >>= slang)) - throw RuntimeException( OUSTR("Cannot determine language!"), 0 ); - return toLocale(slang); - } -}; - -//============================================================================== class CommandEnvironmentImpl : public ::cppu::WeakImplHelper3< XCommandEnvironment, task::XInteractionHandler, @@ -189,7 +177,8 @@ void CommandEnvironmentImpl::printLicense( ->createInstanceWithContext( OUSTR("com.sun.star.i18n.Collator"),m_xComponentContext), UNO_QUERY_THROW ); - xCollator->loadDefaultCollator(OfficeLocale::get(), + xCollator->loadDefaultCollator( + toLocale(utl::ConfigManager::getLocale()), css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE); do diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index a2c9baf4986e..84b0b0ae09e9 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -511,8 +511,7 @@ Reference<XComponentContext> getUNO( NULL ); { WarningBox warn(NULL, WB_OK | WB_DEF_OK, sMsg); - warn.SetText(::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::PRODUCTNAME).get<OUString>()); + warn.SetText(utl::ConfigManager::getProductName()); warn.SetIcon(0); warn.Execute(); } diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index feffd892a27e..c8de646b12ce 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -54,24 +54,11 @@ namespace unopkg { return locale; } - - struct OfficeLocale : - public rtl::StaticWithInit<css::lang::Locale, OfficeLocale> { - const css::lang::Locale operator () () { - ::rtl::OUString slang; - if (! (::utl::ConfigManager::GetDirectConfigProperty( - ::utl::ConfigManager::LOCALE ) >>= slang)) - throw css::uno::RuntimeException( OUSTR("Cannot determine language!"), 0 ); - if (slang.getLength() == 0) - slang = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US")); - return toLocale(slang); - } -}; - struct DeploymentResMgr : public rtl::StaticWithInit< ResMgr *, DeploymentResMgr > { ResMgr * operator () () { - return ResMgr::CreateResMgr( "deployment", OfficeLocale::get()); + return ResMgr::CreateResMgr( + "deployment", toLocale( utl::ConfigManager::getLocale() ) ); } }; diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 369c50fdedaf..d53200cacbe9 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -484,15 +484,9 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview ) ImplWriteLine( "%%Pages: 0" ); ::rtl::OUStringBuffer aCreator; aCreator.appendAscii( RTL_CONSTASCII_STRINGPARAM( "%%Creator: " ) ); - ::utl::ConfigManager& rMgr = ::utl::ConfigManager::GetConfigManager(); - Any aProductName = rMgr.GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - ::rtl::OUString sProductName; - aProductName >>= sProductName; - aCreator.append( sProductName ); - aProductName = rMgr.GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); - aProductName >>= sProductName; + aCreator.append( utl::ConfigManager::getProductName() ); aCreator.appendAscii( RTL_CONSTASCII_STRINGPARAM( " " ) ); - aCreator.append( sProductName ); + aCreator.append( utl::ConfigManager::getProductVersion() ); ImplWriteLine( ::rtl::OUStringToOString( aCreator.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ).getStr() ); ImplWriteLine( "%%Title: none" ); ImplWriteLine( "%%CreationDate: none" ); diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 302909f04c84..b183108f4405 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -444,19 +444,10 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue } } // getting the string for the producer - String aProducer; - { - ::utl::ConfigManager& cMgr = ::utl::ConfigManager::GetConfigManager(); - Any aProductName = cMgr.GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - ::rtl::OUString sProductName; - aProductName >>= sProductName; - aProducer = sProductName; - aProductName = cMgr.GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); - aProductName >>= sProductName; - aProducer.AppendAscii(" "); - aProducer += String( sProductName ); - } - aContext.DocumentInfo.Producer = aProducer; + aContext.DocumentInfo.Producer = + utl::ConfigManager::getProductName() + + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) + + utl::ConfigManager::getProductVersion(); aContext.DocumentInfo.Creator = aCreator; for( sal_Int32 nData = 0, nDataCount = rFilterData.getLength(); nData < nDataCount; ++nData ) diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index 7b39cf071a7d..2a444ddc0def 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -542,28 +542,23 @@ void TitleHelper::impl_appendComponentTitle ( ::rtl::OUStringBuffer& //***************************************************************************************************************** void TitleHelper::impl_appendProductName (::rtl::OUStringBuffer& sTitle) { - ::rtl::OUString sProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= sProductName; - - if (sProductName.getLength ()) + rtl::OUString name(utl::ConfigManager::getProductName()); + if (!name.isEmpty()) { - if (sTitle.getLength() > 0) - sTitle.appendAscii (" - "); - - sTitle.append (sProductName); + if (sTitle.getLength() != 0) + sTitle.appendAscii(RTL_CONSTASCII_STRINGPARAM(" - ")); + sTitle.append(name); } } //***************************************************************************************************************** void TitleHelper::impl_appendProductExtension (::rtl::OUStringBuffer& sTitle) { - ::rtl::OUString sProductExtension; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTEXTENSION) >>= sProductExtension; - - if (sProductExtension.getLength ()) + rtl::OUString ext(utl::ConfigManager::getProductExtension()); + if (!ext.isEmpty()) { - sTitle.appendAscii (" "); - sTitle.append (sProductExtension); + sTitle.append(' '); + sTitle.append(ext); } } diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index 832c56b0d1e1..ff5914ab9bee 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -187,9 +187,6 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr ::rtl::OUString sApplicationID; try { - ::rtl::OUString aProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; - // SYNCHRONIZED -> ReadGuard aReadLock(m_aLock); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; @@ -231,7 +228,8 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr sDesktopName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("startcenter")); else sDesktopName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("startcenter")); - sApplicationID = aProductName.toAsciiLowerCase(); + sApplicationID = utl::ConfigManager::getProductName(). + toAsciiLowerCase(); sApplicationID += ::rtl::OUString(sal_Unicode('-')); sApplicationID += sDesktopName; } diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 3455daf1c787..7d79f407fe07 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3621,8 +3621,7 @@ void AutoRecovery::impl_flushALLConfigChanges() // SOLAR SAFE -> SolarMutexGuard aGuard; - ::utl::ConfigManager& rCfgMgr = ::utl::ConfigManager::GetConfigManager(); - rCfgMgr.StoreConfigItems(); + ::utl::ConfigManager::storeConfigItems(); } catch(const css::uno::Exception&) {} diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx index d7e45ef2e8b5..0958fdc2b032 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -1220,9 +1220,8 @@ void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariable // Detect the language type of the current office aPreDefPathVariables.m_eLanguageType = LANGUAGE_ENGLISH_US; - rtl::OUString aLocaleStr; - if ( utl::ConfigManager::GetConfigManager().GetDirectConfigProperty( utl::ConfigManager::LOCALE ) >>= aLocaleStr ) - aPreDefPathVariables.m_eLanguageType = MsLangId::convertIsoStringToLanguage( aLocaleStr ); + rtl::OUString aLocaleStr( utl::ConfigManager::getLocale() ); + aPreDefPathVariables.m_eLanguageType = MsLangId::convertIsoStringToLanguage( aLocaleStr ); // We used to have an else branch here with a LOG_ERROR, but that // always fired in some unit tests when this code was built with // debug=t, so it seems fairly pointless, especially as diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 6702612e8f99..a57618e55469 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -187,7 +187,6 @@ class ConfigurationAccess_UICommand : // Order is neccessary for right initializ rtl::OUString m_aPropName; rtl::OUString m_aPropPopup; rtl::OUString m_aPropProperties; - rtl::OUString m_aBrandName; rtl::OUString m_aXMLFileFormatVersion; rtl::OUString m_aVersion; rtl::OUString m_aExtension; @@ -236,10 +235,6 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUStrin m_aConfigPopupAccess += aModuleName; m_aConfigPopupAccess += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CONFIGURATION_POP_ELEMENT_ACCESS )); - - rtl::OUString aTmp; - ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ) >>= aTmp; - m_aBrandName = aTmp; } ConfigurationAccess_UICommand::~ConfigurationAccess_UICommand() @@ -330,8 +325,8 @@ throw ( RuntimeException ) void ConfigurationAccess_UICommand::fillInfoFromResult( CmdToInfoMap& rCmdInfo, const rtl::OUString& aLabel ) { String rStr( aLabel ); - if ( rStr.SearchAscii( "%PRODUCT" ) != STRING_NOTFOUND ) - rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", m_aBrandName ); + rStr.SearchAndReplaceAllAscii( + "%PRODUCTNAME", utl::ConfigManager::getProductName() ); rCmdInfo.aLabel = ::rtl::OUString( rStr ); rStr.EraseTrailingChars( '.' ); // Remove "..." from string rCmdInfo.aCommandName = ::rtl::OUString( MnemonicGenerator::EraseAllMnemonicChars( rStr )); diff --git a/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk b/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk index bf633e4642c3..41d82a0f6690 100644 --- a/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk +++ b/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk @@ -67,12 +67,14 @@ $(eval $(call gb_CppunitTest_add_components,hwpfilter_test_hwpfilter,\ hwpfilter/source/hwp \ )) $(eval $(call gb_CppunitTest_add_old_components,hwpfilter_test_hwpfilter,\ + configmgr \ ucb1 \ ucpfile1 \ )) $(eval $(call gb_CppunitTest_set_args,hwpfilter_test_hwpfilter,\ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ )) # we need to explicitly depend on library hwp because it is not implied diff --git a/hwpfilter/prj/build.lst b/hwpfilter/prj/build.lst index 5eb79927bdd0..84f786418156 100644 --- a/hwpfilter/prj/build.lst +++ b/hwpfilter/prj/build.lst @@ -1,2 +1,2 @@ -hw hwpfilter : offapi cppuhelper ZLIB:zlib LIBXSLT:libxslt ucbhelper ucb ure test NULL +hw hwpfilter : offapi configmgr cppuhelper ZLIB:zlib LIBXSLT:libxslt ucbhelper ucb ure test NULL hw hwpfilter\prj nmake - all hw_prj NULL diff --git a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk index 6b55f2b40790..362ca4d8ddc7 100644 --- a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk +++ b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk @@ -67,9 +67,16 @@ $(eval $(call gb_CppunitTest_add_components,lotuswordpro_test_lotuswordpro,\ lotuswordpro/util/lwpfilter,\ )) +$(eval $(call gb_CppunitTest_add_old_components,lotuswordpro_test_lotuswordpro,\ + configmgr \ + ucb1 \ + ucpfile1 \ +)) + $(eval $(call gb_CppunitTest_set_args,lotuswordpro_test_lotuswordpro,\ --headless \ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ )) # we need to explicitly depend on library lwpft because it is not implied diff --git a/lotuswordpro/prj/build.lst b/lotuswordpro/prj/build.lst index f6c70c5971df..28f4d8466c73 100644 --- a/lotuswordpro/prj/build.lst +++ b/lotuswordpro/prj/build.lst @@ -1,2 +1,2 @@ -wp lotuswordpro : sfx2 sot svx comphelper BOOST:boost ure test NULL +wp lotuswordpro : sfx2 sot svx comphelper configmgr BOOST:boost ure test NULL wp lotuswordpro\prj nmake - all lwp_prj NULL diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx index 67b84a41716d..67a2bd181bce 100644 --- a/padmin/source/padialog.cxx +++ b/padmin/source/padialog.cxx @@ -417,12 +417,6 @@ void SpaPrinterController::printPage( int ) const pPrinter->SetMapMode( aMapMode ); - Any aRet = utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::PRODUCTNAME ); - OUString aJobName; - aRet >>= aJobName; - - aJobName = aJobName + OUString( RTL_CONSTASCII_USTRINGPARAM( " Testpage" ) ); - Size aPaperSize=pPrinter->GetOutputSize(); Point aCenter( aPaperSize.Width()/2-300, aPaperSize.Height() - aPaperSize.Width()/2 ); diff --git a/padmin/source/pamain.cxx b/padmin/source/pamain.cxx index 63c46fd3160b..71ee0e77e09e 100644 --- a/padmin/source/pamain.cxx +++ b/padmin/source/pamain.cxx @@ -71,15 +71,8 @@ MyApp aMyApp; void MyApp::ReadStringHook( String& rStr ) { - static String maProduct; - if( ! maProduct.Len() ) - { - Any aRet = utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::PRODUCTNAME ); - OUString aProd; - aRet >>= aProd; - maProduct = String( aProd ); - } - rStr.SearchAndReplaceAllAscii( "%PRODUCTNAME", maProduct ); + rStr.SearchAndReplaceAllAscii( + "%PRODUCTNAME", utl::ConfigManager::getProductName() ); }; diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk index 6f0f5837a4dc..22eb247f593c 100644 --- a/sc/CppunitTest_sc_ucalc.mk +++ b/sc/CppunitTest_sc_ucalc.mk @@ -102,6 +102,7 @@ $(eval $(call gb_CppunitTest_add_components,sc_ucalc,\ )) $(eval $(call gb_CppunitTest_add_old_components,sc_ucalc,\ + configmgr \ ucb1 \ ucpfile1 \ )) @@ -109,6 +110,7 @@ $(eval $(call gb_CppunitTest_add_old_components,sc_ucalc,\ $(eval $(call gb_CppunitTest_set_args,sc_ucalc,\ --headless \ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ )) # vim: set noet sw=4 ts=4: diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk index 8b8d909d5410..2b162c29b03f 100644 --- a/sd/CppunitTest_sd_uimpress.mk +++ b/sd/CppunitTest_sd_uimpress.mk @@ -91,9 +91,14 @@ $(eval $(call gb_CppunitTest_add_components,sd_uimpress,\ i18npool/util/i18npool \ )) +$(eval $(call gb_CppunitTest_add_old_components,sd_uimpress,\ + configmgr \ +)) + $(eval $(call gb_CppunitTest_set_args,sd_uimpress,\ --headless \ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ )) # vim: set noet sw=4 ts=4: diff --git a/sd/prj/build.lst b/sd/prj/build.lst index 91456d30371a..3b37cc663471 100644 --- a/sd/prj/build.lst +++ b/sd/prj/build.lst @@ -1,3 +1,3 @@ -sd sd : filter TRANSLATIONS:translations animations svx sfx2 stoc canvas embeddedobj LIBXSLT:libxslt oox ure test xmloff NULL +sd sd : filter TRANSLATIONS:translations animations configmgr svx sfx2 stoc canvas embeddedobj LIBXSLT:libxslt oox ure test xmloff NULL sd sd usr1 - all sd_mkout NULL sd sd\prj nmake - all sd_prj NULL diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 598f41207190..6c5f7d50bc7e 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -127,7 +127,7 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a xDesktop->removeTerminateListener( this ); SolarMutexGuard aGuard; - utl::ConfigManager::GetConfigManager().StoreConfigItems(); + utl::ConfigManager::storeConfigItems(); SfxApplication* pApp = SFX_APP(); pApp->Broadcast( SfxSimpleHint( SFX_HINT_DEINITIALIZING ) ); diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index ff92bf9d7966..e3623820edb0 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -123,14 +123,11 @@ static bool impl_hasHelpInstalled( const rtl::OUString &rLang ); static rtl::OUString HelpLocaleString() { static rtl::OUString aLocaleStr; - if (!aLocaleStr.getLength()) + if (aLocaleStr.isEmpty()) { const rtl::OUString aEnglish( RTL_CONSTASCII_USTRINGPARAM( "en" ) ); // detect installed locale - Any aLocale = - ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty( - ::utl::ConfigManager::LOCALE ); - aLocale >>= aLocaleStr; + aLocaleStr = utl::ConfigManager::getLocale(); bool bOk = aLocaleStr.getLength() != 0; if ( !bOk ) aLocaleStr = aEnglish; diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index dedc88f183b5..2e64e6633dee 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -504,10 +504,7 @@ void SfxDocTplService_Impl::getDefaultLocale() ::osl::MutexGuard aGuard( maMutex ); if ( !mbLocaleSet ) { - rtl::OUString aLocale; - utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::LOCALE ) - >>= aLocale; - + rtl::OUString aLocale( utl::ConfigManager::getLocale() ); if ( aLocale.getLength() > 0 ) { sal_Int32 nPos = aLocale.indexOf( sal_Unicode( '-' ) ); diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index e03206919106..33923ebfaa20 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -236,11 +236,8 @@ String SfxViewFrame::UpdateTitle() GetBindings().Invalidate( SID_FRAMETITLE ); GetBindings().Invalidate( SID_CURRENT_URL ); - ::rtl::OUString aProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; - aTitle += String::CreateFromAscii( " - " ); - aTitle += String(aProductName); + aTitle += utl::ConfigManager::getProductName(); aTitle += ' '; ::rtl::OUString aDocServiceName( GetObjectShell()->GetFactory().GetDocumentServiceName() ); aTitle += String( GetModuleName_Impl( aDocServiceName ) ); diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx index cf486f361402..8a8549b6bbb6 100644 --- a/svl/source/config/itemholder2.cxx +++ b/svl/source/config/itemholder2.cxx @@ -64,7 +64,6 @@ ItemHolder2::ItemHolder2() if (xCfg.is()) xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); } -// #i37892 got errorhandling from ConfigManager::GetConfigurationProvider() catch(css::uno::RuntimeException& rREx) { throw rREx; diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk index 3ccbd5d06c30..48c39f461b01 100644 --- a/svtools/CppunitTest_svtools_filters_test.mk +++ b/svtools/CppunitTest_svtools_filters_test.mk @@ -63,9 +63,14 @@ $(eval $(call gb_CppunitTest_add_type_rdbs,svtools_filters_test,\ types \ )) +$(eval $(call gb_CppunitTest_add_old_components,svtools_filters_test,\ + configmgr \ +)) + $(eval $(call gb_CppunitTest_set_args,svtools_filters_test,\ --headless \ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ )) # vim: set noet sw=4 ts=4: diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index d18c9f9df2a2..b18ec977b997 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -1,2 +1,2 @@ -st svtools : TRANSLATIONS:translations svl offapi toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal salhelper sot jvmfwk LIBXSLT:libxslt ure test NULL +st svtools : TRANSLATIONS:translations svl offapi toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper configmgr sal salhelper sot jvmfwk LIBXSLT:libxslt ure test NULL st svtools\prj nmake - all st_prj NULL diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index 74766fa2e534..dadb1d6f75ec 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -71,7 +71,6 @@ ItemHolder2::ItemHolder2() if (xCfg.is()) xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); } -// #i37892 got errorhandling from ConfigManager::GetConfigurationProvider() catch(css::uno::RuntimeException& rREx) { throw rREx; diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index 7d6bcb9187cf..79e5a6f934fc 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -157,22 +157,6 @@ void SvObjectServerList::FillInsertObjects() ::rtl::OUString aStringProductVersion( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTVERSION" ) ); sal_Int32 nStringProductVersionLength = aStringProductVersion.getLength(); - // TODO/LATER: Do the request only once ( needs incompatible change ) - ::rtl::OUString aProductName; - ::rtl::OUString aProductVersion; - uno::Any aProperty = - ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - if ( !( aProperty >>= aProductName ) ) - { - OSL_FAIL( "Coudn't get PRODUCTNAME variable!\n" ); - aProductName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice" ) ); - } - aProperty = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); - if ( !( aProperty >>= aProductVersion ) ) - { - OSL_FAIL( "Coudn't get PRODUCTVERSION variable!\n" ); - } - for( nInd = 0; nInd < seqNames.getLength(); nInd++ ) { uno::Reference< container::XNameAccess > xEntry ; @@ -190,7 +174,9 @@ void SvObjectServerList::FillInsertObjects() sal_Int32 nIndex = aUIName.indexOf( aStringProductName ); while( nIndex != -1 ) { - aUIName = aUIName.replaceAt( nIndex, nStringProductNameLength, aProductName ); + aUIName = aUIName.replaceAt( + nIndex, nStringProductNameLength, + utl::ConfigManager::getProductName() ); nIndex = aUIName.indexOf( aStringProductName ); } @@ -198,7 +184,9 @@ void SvObjectServerList::FillInsertObjects() nIndex = aUIName.indexOf( aStringProductVersion ); while( nIndex != -1 ) { - aUIName = aUIName.replaceAt( nIndex, nStringProductVersionLength, aProductVersion ); + aUIName = aUIName.replaceAt( + nIndex, nStringProductVersionLength, + utl::ConfigManager::getProductVersion() ); nIndex = aUIName.indexOf( aStringProductVersion ); } } diff --git a/svtools/source/filter/FilterConfigItem.cxx b/svtools/source/filter/FilterConfigItem.cxx index bbe40a0604c0..c6dbc5197ce8 100644 --- a/svtools/source/filter/FilterConfigItem.cxx +++ b/svtools/source/filter/FilterConfigItem.cxx @@ -121,8 +121,6 @@ void FilterConfigItem::ImpInitTree( const String& rSubTree ) { bModified = sal_False; - OUString sTree( ConfigManager::GetConfigBaseURL() ); - sTree += rSubTree; Reference< XMultiServiceFactory > xSMGR = getProcessServiceFactory(); // get global uno service manager Reference< XMultiServiceFactory > xCfgProv( @@ -131,6 +129,9 @@ void FilterConfigItem::ImpInitTree( const String& rSubTree ) if ( xCfgProv.is() ) { + OUString sTree( + OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.")) + + rSubTree); if ( ImpIsTreeAvailable( xCfgProv, String( sTree ) ) ) { Any aAny; diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk index 500405fd6206..4aa77a4c7ecb 100644 --- a/sw/CppunitTest_sw_filters_test.mk +++ b/sw/CppunitTest_sw_filters_test.mk @@ -96,6 +96,7 @@ $(eval $(call gb_CppunitTest_add_components,sw_filters_test,\ )) $(eval $(call gb_CppunitTest_add_old_components,sw_filters_test,\ + configmgr \ ucb1 \ ucpfile1 \ )) @@ -103,6 +104,7 @@ $(eval $(call gb_CppunitTest_add_old_components,sw_filters_test,\ $(eval $(call gb_CppunitTest_set_args,sw_filters_test,\ --headless \ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ )) # we need to explicitly depend on library msword because it is not implied diff --git a/sw/CppunitTest_sw_swdoc_test.mk b/sw/CppunitTest_sw_swdoc_test.mk index 029088942fd9..f3f44bbf736a 100644 --- a/sw/CppunitTest_sw_swdoc_test.mk +++ b/sw/CppunitTest_sw_swdoc_test.mk @@ -104,6 +104,7 @@ $(eval $(call gb_CppunitTest_add_components,sw_swdoc_test,\ )) $(eval $(call gb_CppunitTest_add_old_components,sw_swdoc_test,\ + configmgr \ ucb1 \ ucpfile1 \ )) @@ -114,6 +115,7 @@ $(call gb_CppunitTest_get_target,sw_swdoc_test) : \ $(eval $(call gb_CppunitTest_set_args,sw_swdoc_test,\ --headless \ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ )) # we need to explicitly depend on the sw resource files needed at unit-test diff --git a/sw/prj/build.lst b/sw/prj/build.lst index 75c602e315ab..e2d759dceb36 100644 --- a/sw/prj/build.lst +++ b/sw/prj/build.lst @@ -1,2 +1,2 @@ -sw sw : filter TRANSLATIONS:translations connectivity writerperfect vbahelper svx stoc writerfilter unoxml fileaccess package forms toolkit dbaccess comphelper LIBXSLT:libxslt test NULL +sw sw : filter TRANSLATIONS:translations configmgr connectivity writerperfect vbahelper svx stoc writerfilter unoxml fileaccess package forms toolkit dbaccess comphelper LIBXSLT:libxslt test NULL sw sw\prj nmake - all sw_prj NULL diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index efc597d648ff..a36f233070ae 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -441,9 +441,7 @@ void RtfExport::WriteInfo() } Strm() << '{' << OOO_STRING_SVTOOLS_RTF_COMMENT << " "; - OUString sProduct; - utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; - Strm() << OUStringToOString( sProduct, eCurrentEncoding).getStr() << "}{" << OOO_STRING_SVTOOLS_RTF_VERN; + Strm() << OUStringToOString( utl::ConfigManager::getProductName(), eCurrentEncoding).getStr() << "}{" << OOO_STRING_SVTOOLS_RTF_VERN; OutULong( SUPD*10 ) << '}'; Strm() << '}'; } diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index 9b4de6e12634..acd941f902aa 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -191,24 +191,18 @@ void SwCompatibilityOptPage::ReplaceFormatName( String& rEntry ) static const String sOpenOfficeName = String::CreateFromAscii("OpenOffice.org"); static const String sAsianName = String::CreateFromAscii("StarSuite"); - Any aAny = ::utl::ConfigManager:: - GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - rtl::OUString sTmp; - if ( aAny >>= sTmp ) - { - String sFormatName = sTmp; - String sFormatVersion; - bool bOpenOffice = ( sOpenOfficeName == sFormatName ); - if ( bOpenOffice ) - sFormatVersion = String::CreateFromAscii("1.1"); - else - sFormatVersion = String::CreateFromAscii("6.0/7"); - if ( !bOpenOffice && ( sAsianName != sFormatName ) ) - sFormatName = String::CreateFromAscii("StarOffice"); - - rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATNAME"), sFormatName ); - rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATVERSION"), sFormatVersion ); - } + String sFormatName( utl::ConfigManager::getProductName() ); + String sFormatVersion; + bool bOpenOffice = ( sOpenOfficeName == sFormatName ); + if ( bOpenOffice ) + sFormatVersion = String::CreateFromAscii("1.1"); + else + sFormatVersion = String::CreateFromAscii("6.0/7"); + if ( !bOpenOffice && ( sAsianName != sFormatName ) ) + sFormatName = String::CreateFromAscii("StarOffice"); + + rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATNAME"), sFormatName ); + rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATVERSION"), sFormatVersion ); } sal_uLong convertBools2Ulong_Impl diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index c95cf60d6d38..2729c3ad0eef 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -554,29 +554,10 @@ void SwCaptionOptPage::Reset( const SfxItemSet& rSet) SetOptions(nPos++, GRAPHIC_CAP); // get Productname and -version - String sComplete, sWithoutVersion; - ::rtl::OUString sTemp; - uno::Any aAny = - ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - if ( aAny >>= sTemp ) - { - sComplete = sTemp; - sWithoutVersion = sTemp; - aAny = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); - if ( !( aAny >>= sTemp ) ) - { - OSL_FAIL("Couldn't get PRODUCTVERSION variable" ); - } - else - { - sComplete += ' '; - sComplete += String( sTemp ); - } - } - else - { - OSL_FAIL("Couldn't get PRODUCTNAME variable" ); - } + rtl::OUString sWithoutVersion( utl::ConfigManager::getProductName() ); + rtl::OUString sComplete( + sWithoutVersion + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) + + utl::ConfigManager::getProductVersion() ); SvObjectServerList aObjS; aObjS.FillInsertObjects(); diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index d4e734ed53fd..01a55219d7e9 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -1153,19 +1153,11 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ ) nPreNum++; } pVDev->SetFont(aStdFont); - - // Changed as per BugID 79541 Branding/Configuration - uno::Any MyAny = ::utl::ConfigManager::GetConfigManager(). - GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - ::rtl::OUString aProductName; - - MyAny >>= aProductName; - String sMsg(C2S("%PRODUCTNAME")); - sMsg.SearchAndReplaceAscii( "%PRODUCTNAME" , aProductName ); - - if(pOutlineNames) - sMsg = pOutlineNames[nLevel]; - pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg ); + pVDev->DrawText( + Point(nXStart + nTextOffset, nYStart), + (pOutlineNames == 0 + ? utl::ConfigManager::getProductName() + : rtl::OUString(pOutlineNames[nLevel]))); } } } diff --git a/tail_build/prj/build.lst b/tail_build/prj/build.lst index 16df54b499cb..01e2633042e0 100644 --- a/tail_build/prj/build.lst +++ b/tail_build/prj/build.lst @@ -1,2 +1,2 @@ -tb tail_build : APACHE_COMMONS:apache-commons BSH:beanshell BERKELEYDB:berkeleydb BOOST:boost l10ntools LIBXML2:libxml2 LIBXMLSEC:libxmlsec LIBXSLT:libxslt LIBWPG:libwpg LIBWPS:libwps LIBWPD:libwpd LIBVISIO:libvisio LPSOLVE:lpsolve MDDS:mdds NEON:neon NSS:nss OPENSSL:openssl PYTHON:python REDLAND:redland SAXON:saxon TRANSLATIONS:translations XPDF:xpdf avmedia basegfx basic bridges canvas comphelper connectivity cppcanvas cppu cppuhelper fpicker javaunohelper jurt jvmaccess offapi officecfg oovbaapi qadevOOo DESKTOP:rdbmaker readlicense_oo rhino ridljar sal sax sfx2 solenv soltools sot stoc svtools svx sysui test toolkit tools ucbhelper udkapi unoil unotools ure vcl xmlhelp xmloff xmlscript xsltml NULL +tb tail_build : APACHE_COMMONS:apache-commons BSH:beanshell BERKELEYDB:berkeleydb BOOST:boost l10ntools LIBXML2:libxml2 LIBXMLSEC:libxmlsec LIBXSLT:libxslt LIBWPG:libwpg LIBWPS:libwps LIBWPD:libwpd LIBVISIO:libvisio LPSOLVE:lpsolve MDDS:mdds NEON:neon NSS:nss OPENSSL:openssl PYTHON:python REDLAND:redland SAXON:saxon TRANSLATIONS:translations XPDF:xpdf avmedia basegfx basic bridges canvas comphelper configmgr connectivity cppcanvas cppu cppuhelper fpicker javaunohelper jurt jvmaccess offapi officecfg oovbaapi qadevOOo DESKTOP:rdbmaker readlicense_oo rhino ridljar sal sax sfx2 solenv soltools sot stoc svtools svx sysui test toolkit tools ucbhelper udkapi unoil unotools ure vcl xmlhelp xmloff xmlscript xsltml NULL tb tail_build\prj nmake - all tb_prj NULL diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index a101d9fd8793..cba70c13cfc3 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -391,11 +391,8 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const break; case BASEPROPERTY_CURRENCYSYMBOL: { - Any aDefaultCurrency = ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::DEFAULTCURRENCY); - DBG_ASSERT( TypeClass_STRING == aDefaultCurrency.getValueTypeClass(), "UnoControlModel::ImplGetDefaultValue: invalid currency config value!" ); - - ::rtl::OUString sDefaultCurrency; - aDefaultCurrency >>= sDefaultCurrency; + rtl::OUString sDefaultCurrency( + utl::ConfigManager::getDefaultCurrency() ); // extract the bank symbol sal_Int32 nSepPos = sDefaultCurrency.indexOf( '-' ); diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx index 1b1558d024b4..fe3a0e991ad4 100644 --- a/unotools/inc/unotools/configitem.hxx +++ b/unotools/inc/unotools/configitem.hxx @@ -58,8 +58,6 @@ namespace utl #define CONFIG_MODE_DELAYED_UPDATE 0x01 #define CONFIG_MODE_ALL_LOCALES 0x02 #define CONFIG_MODE_RELEASE_TREE 0x04 -#define CONFIG_MODE_IGNORE_ERRORS 0x08 // prevent assertions, if creation fails -#define CONFIG_MODE_PROPAGATE_ERRORS 0x10 // throw exceptions, if creation fails enum ConfigNameFormat { diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx index 61bcac6b8737..1ac1868585d1 100644 --- a/unotools/inc/unotools/configmgr.hxx +++ b/unotools/inc/unotools/configmgr.hxx @@ -26,92 +26,76 @@ * ************************************************************************/ -#ifndef _UTL_CONFIGMGR_HXX_ -#define _UTL_CONFIGMGR_HXX_ +#ifndef INCLUDED_UNOTOOLS_CONFIGMGR_HXX +#define INCLUDED_UNOTOOLS_CONFIGMGR_HXX -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/uno/Any.hxx> -#include <rtl/ustring.hxx> +#include "sal/config.h" + +#include <list> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "sal/types.h" #include "unotools/unotoolsdllapi.h" -//----------------------------------------------------------------------------- -namespace com{ namespace sun{ namespace star{ - namespace lang{ - class XMultiServiceFactory; - } - namespace container{ - class XHierarchicalNameAccess; - } -}}} - -//----------------------------------------------------------------------------- -namespace utl -{ - struct ConfigMgr_Impl; - class ConfigItem; - class UNOTOOLS_DLLPUBLIC ConfigManager - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - xConfigurationProvider; - ConfigMgr_Impl* pMgrImpl; - - static void getBasisAboutBoxProductVersion( rtl::OUString& rVersion ); - - public: - ConfigManager(); - ConfigManager(com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xConfigProvider); - ~ConfigManager(); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - GetConfigurationProvider(); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - GetLocalConfigurationProvider(); - - com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> - AddConfigItem(utl::ConfigItem& rCfgItem); - - void RegisterConfigItem(utl::ConfigItem& rCfgItem); - com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> - AcquireTree(utl::ConfigItem& rCfgItem); - - - void RemoveConfigItem(utl::ConfigItem& rCfgItem); - - void StoreConfigItems(); - - static ConfigManager& GetConfigManager(); - static rtl::OUString GetConfigBaseURL(); - - enum ConfigProperty - { - INSTALLPATH, // deprecated. don't use - LOCALE, - OFFICEINSTALL, // deprecated. don't use - USERINSTALLURL, // deprecated. don't use - OFFICEINSTALLURL, // deprecated. don't use - PRODUCTNAME, - PRODUCTVERSION, - PRODUCTEXTENSION, - DEFAULTCURRENCY, - PRODUCTXMLFILEFORMATNAME, - PRODUCTXMLFILEFORMATVERSION, - WRITERCOMPATIBILITYVERSIONOOO11, - OPENSOURCECONTEXT, - ABOUTBOXPRODUCTVERSION, - OOOVENDOR - }; - //direct readonly access to some special configuration elements - static com::sun::star::uno::Any GetDirectConfigProperty(ConfigProperty eProp); - - sal_Bool IsLocalConfigProvider(); - com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess> - GetHierarchyAccess(const rtl::OUString& rFullPath); - com::sun::star::uno::Any GetLocalProperty(const rtl::OUString& rProperty); - void PutLocalProperty(const rtl::OUString& , const com::sun::star::uno::Any& rValue); - - }; -}//namespace utl -#endif //_UTL_CONFIGMGR_HXX_ +namespace com { namespace sun { namespace star { + namespace container{ class XHierarchicalNameAccess; } +} } } +namespace rtl { class OUString; } +namespace utl { class ConfigItem; } + +namespace utl { + +class UNOTOOLS_DLLPUBLIC ConfigManager: private boost::noncopyable { +public: + static rtl::OUString getAboutBoxProductVersion(); + + static rtl::OUString getDefaultCurrency(); + + static rtl::OUString getLocale(); + + static rtl::OUString getProductExtension(); + + static rtl::OUString getProductName(); + + static rtl::OUString getProductXmlFileFormat(); + + static rtl::OUString getProductXmlFileFormatVersion(); + + static rtl::OUString getProductVersion(); + + static rtl::OUString getVendor(); + + static rtl::OUString getWriterCompatibilityVersionOOo_1_1(); + + static void storeConfigItems(); + + SAL_DLLPRIVATE static ConfigManager & getConfigManager(); + + SAL_DLLPRIVATE static com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameAccess> + acquireTree(utl::ConfigItem & item); + + SAL_DLLPRIVATE ConfigManager(); + + SAL_DLLPRIVATE ~ConfigManager(); + + SAL_DLLPRIVATE com::sun::star::uno::Reference< + com::sun::star::container::XHierarchicalNameAccess > + addConfigItem(utl::ConfigItem & item); + + SAL_DLLPRIVATE void removeConfigItem(utl::ConfigItem & item); + + SAL_DLLPRIVATE void registerConfigItem(utl::ConfigItem * item); + +private: + void doStoreConfigItems(); + + std::list< ConfigItem * > items_; +}; + +} + +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index d0b29214f108..a0200e6b4d09 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -225,21 +225,19 @@ ConfigItem::ConfigItem(const OUString &rSubTree, sal_Int16 nSetMode ) : { AutoDeleter<ConfigItem_Impl> aNewImpl(pImpl); - pImpl->pManager = &ConfigManager::GetConfigManager(); + pImpl->pManager = &ConfigManager::getConfigManager(); pImpl->nMode = nSetMode; if(0 != (nSetMode&CONFIG_MODE_RELEASE_TREE)) - pImpl->pManager->AddConfigItem(*this); + pImpl->pManager->addConfigItem(*this); else - m_xHierarchyAccess = pImpl->pManager->AddConfigItem(*this); + m_xHierarchyAccess = pImpl->pManager->addConfigItem(*this); - // no more exceptions after c'tor has finished aNewImpl.keep(); - pImpl->nMode &= ~CONFIG_MODE_PROPAGATE_ERRORS; } sal_Bool ConfigItem::IsValidConfigMgr() const { - return ( pImpl->pManager && pImpl->pManager->GetConfigurationProvider().is() ); + return pImpl->pManager != 0; } ConfigItem::~ConfigItem() @@ -247,7 +245,7 @@ ConfigItem::~ConfigItem() if(pImpl->pManager) { RemoveChangesListener(); - pImpl->pManager->RemoveConfigItem(*this); + pImpl->pManager->removeConfigItem(*this); } delete pImpl; } @@ -278,29 +276,6 @@ void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<OUString>& rPro Notify(rPropertyNames); } -sal_Bool lcl_IsLocalProperty(const OUString& rSubTree, const OUString& rProperty) -{ - static const sal_Char* aLocalProperties[] = - { - "Office.Common/Path/Current/Storage", - "Office.Common/Path/Current/Temp" - }; - static const int aLocalPropLen[] = - { - 34, - 31 - }; - OUString sProperty(rSubTree); - sProperty += C2U("/"); - sProperty += rProperty; - - if(sProperty.equalsAsciiL( aLocalProperties[0], aLocalPropLen[0]) || - sProperty.equalsAsciiL( aLocalProperties[1], aLocalPropLen[1])) - return sal_True; - - return sal_False; -} - void ConfigItem::impl_packLocalizedProperties( const Sequence< OUString >& lInNames , const Sequence< Any >& lInValues , Sequence< Any >& lOutValues ) @@ -471,12 +446,6 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se { try { - if(pImpl->pManager->IsLocalConfigProvider() && lcl_IsLocalProperty(sSubTree, rNames[i])) - { - OSL_FAIL("ConfigItem::IsReadonly()\nlocal mode seams to be used!?\n"); - continue; - } - OUString sName = rNames[i]; OUString sPath; OUString sProperty; @@ -546,15 +515,7 @@ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames) { try { - if(pImpl->pManager->IsLocalConfigProvider() && lcl_IsLocalProperty(sSubTree, pNames[i])) - { - OUString sProperty(sSubTree); - sProperty += C2U("/"); - sProperty += pNames[i]; - pRet[i] = pImpl->pManager->GetLocalProperty(sProperty); - } - else - pRet[i] = xHierarchyAccess->getByHierarchicalName(pNames[i]); + pRet[i] = xHierarchyAccess->getByHierarchicalName(pNames[i]); } catch (const Exception& rEx) { @@ -563,10 +524,7 @@ Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames) sMsg += OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - sMsg += OString("\n"); - sMsg += OString(ConfigManager::GetConfigBaseURL().getStr(), - ConfigManager::GetConfigBaseURL().getLength(), - RTL_TEXTENCODING_ASCII_US); + sMsg += OString("\n/org.openoffice."); sMsg += OString(sSubTree.getStr(), sSubTree.getLength(), RTL_TEXTENCODING_ASCII_US); @@ -627,43 +585,33 @@ sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames, } for(int i = 0; i < nNameCount; i++) { - if(pImpl->pManager->IsLocalConfigProvider() && lcl_IsLocalProperty(sSubTree, pNames[i])) - { - OUString sProperty(sSubTree); - sProperty += C2U("/"); - sProperty += pNames[i]; - pImpl->pManager->PutLocalProperty(sProperty, pValues[i]); - } - else + try { - try + OUString sNode, sProperty; + if (splitLastFromConfigurationPath(pNames[i],sNode, sProperty)) { - OUString sNode, sProperty; - if (splitLastFromConfigurationPath(pNames[i],sNode, sProperty)) - { - Any aNode = xHierarchyAccess->getByHierarchicalName(sNode); + Any aNode = xHierarchyAccess->getByHierarchicalName(sNode); - Reference<XNameAccess> xNodeAcc; - aNode >>= xNodeAcc; - Reference<XNameReplace> xNodeReplace(xNodeAcc, UNO_QUERY); - Reference<XNameContainer> xNodeCont (xNodeAcc, UNO_QUERY); + Reference<XNameAccess> xNodeAcc; + aNode >>= xNodeAcc; + Reference<XNameReplace> xNodeReplace(xNodeAcc, UNO_QUERY); + Reference<XNameContainer> xNodeCont (xNodeAcc, UNO_QUERY); - sal_Bool bExist = (xNodeAcc.is() && xNodeAcc->hasByName(sProperty)); - if (bExist && xNodeReplace.is()) - xNodeReplace->replaceByName(sProperty, pValues[i]); - else + sal_Bool bExist = (xNodeAcc.is() && xNodeAcc->hasByName(sProperty)); + if (bExist && xNodeReplace.is()) + xNodeReplace->replaceByName(sProperty, pValues[i]); + else if (!bExist && xNodeCont.is()) xNodeCont->insertByName(sProperty, pValues[i]); else bRet = sal_False; - } - else //direct value - { - xTopNodeReplace->replaceByName(sProperty, pValues[i]); - } } - CATCH_INFO("Exception from PutProperties: "); + else //direct value + { + xTopNodeReplace->replaceByName(sProperty, pValues[i]); + } } + CATCH_INFO("Exception from PutProperties: "); } try { @@ -1314,7 +1262,7 @@ Reference< XHierarchicalNameAccess> ConfigItem::GetTree() { Reference< XHierarchicalNameAccess> xRet; if(!m_xHierarchyAccess.is()) - xRet = pImpl->pManager->AcquireTree(*this); + xRet = ConfigManager::acquireTree(*this); else xRet = m_xHierarchyAccess; return xRet; diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx index 00e46145e360..e11b99dc4d6a 100644 --- a/unotools/source/config/configmgr.cxx +++ b/unotools/source/config/configmgr.cxx @@ -26,693 +26,225 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_unotools.hxx" -#include "unotools/configmgr.hxx" -#include "unotools/configitem.hxx" -#include "unotools/configpathes.hxx" -#include <unotools/processfactory.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XHierarchicalNameAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <osl/diagnose.h> -#include <rtl/bootstrap.hxx> -#include <rtl/instance.hxx> -#if OSL_DEBUG_LEVEL > 0 -#include <rtl/strbuf.hxx> -#endif +#include "sal/config.h" #include <list> -#include <stdio.h> - -//----------------------------------------------------------------------------- - -using namespace utl; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::container; - -using ::rtl::OUString; -#if OSL_DEBUG_LEVEL > 0 -using ::rtl::OString; -#endif +#include "boost/noncopyable.hpp" +#include "com/sun/star/beans/NamedValue.hpp" +#include "com/sun/star/container/XHierarchicalNameAccess.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" +#include "osl/diagnose.h" +#include "rtl/instance.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "unotools/configitem.hxx" +#include "unotools/configmgr.hxx" +#include "unotools/processfactory.hxx" -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +namespace { -//----------------------------------------------------------------------------- -const char aConfigBaseURL[] = "/org.openoffice."; -const char aAccessSrvc[] = "com.sun.star.configuration.ConfigurationUpdateAccess"; +namespace css = com::sun::star; -namespace -{ - struct BrandName - : public rtl::Static< ::rtl::OUString, BrandName > {}; - struct ProductVersion - : public rtl::Static< ::rtl::OUString, ProductVersion > {}; - struct AboutBoxProductVersion - : public rtl::Static< ::rtl::OUString, AboutBoxProductVersion > {}; - struct OOOVendor - : public rtl::Static< ::rtl::OUString, OOOVendor > {}; - struct ProductExtension - : public rtl::Static< ::rtl::OUString, ProductExtension > {}; - struct XMLFileFormatName - : public rtl::Static< ::rtl::OUString, XMLFileFormatName > {}; - struct XMLFileFormatVersion - : public rtl::Static< ::rtl::OUString, XMLFileFormatVersion > {}; - struct WriterCompatibilityVersionOOo11 - : public rtl::Static< ::rtl::OUString, WriterCompatibilityVersionOOo11 > {}; - struct OpenSourceContext : public rtl::StaticWithInit< sal_Int32, OpenSourceContext > +class RegisterConfigItemHelper: private boost::noncopyable { +public: + RegisterConfigItemHelper( + utl::ConfigManager & manager, utl::ConfigItem & item): + manager_(manager), item_(&item) { - sal_Int32 operator() () { return sal_Int32( -1 ); } - }; + manager.registerConfigItem(item_); + } -} + ~RegisterConfigItemHelper() { + if (item_ != 0) { + manager_.removeConfigItem(*item_); + } + } -//----------------------------------------------------------------------------- -struct ConfigItemListEntry_Impl -{ - ConfigItem* pConfigItem; + void keep() { item_ = 0; } - ConfigItemListEntry_Impl(ConfigItem* pItem ) : - pConfigItem(pItem){} -}; -typedef std::list<ConfigItemListEntry_Impl> ConfigItemList; -struct utl::ConfigMgr_Impl -{ - ConfigItemList aItemList; +private: + utl::ConfigManager & manager_; + utl::ConfigItem * item_; }; -ConfigManager::ConfigManager() : - pMgrImpl(new utl::ConfigMgr_Impl) -{ - GetConfigurationProvider(); // attempt to create the provider early +css::uno::Reference< css::lang::XMultiServiceFactory > +getConfigurationProvider() { + return css::uno::Reference< css::lang::XMultiServiceFactory >( + (css::uno::Reference< css::lang::XMultiServiceFactory >( + utl::getProcessServiceFactory(), css::uno::UNO_SET_THROW)-> + createInstance( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider")))), + css::uno::UNO_QUERY_THROW); } -ConfigManager::ConfigManager(Reference< XMultiServiceFactory > xConfigProv) : - xConfigurationProvider(xConfigProv), - pMgrImpl(new utl::ConfigMgr_Impl) +rtl::OUString getConfigurationString( + rtl::OUString const & module, rtl::OUString const & path) { + css::uno::Sequence< css::uno::Any > args(1); + args[0] <<= css::beans::NamedValue( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), + css::uno::makeAny(module)); + return + css::uno::Reference< css::container::XHierarchicalNameAccess >( + getConfigurationProvider()->createInstanceWithArguments( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess")), + args), + css::uno::UNO_QUERY_THROW)-> + getByHierarchicalName(path).get< rtl::OUString >(); } -ConfigManager::~ConfigManager() -{ - //check list content -> should be empty! -#if OSL_DEBUG_LEVEL > 0 - if(!pMgrImpl->aItemList.empty()) - { - ConfigItemList::iterator aListIter; - for (aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) - { - ConfigItemListEntry_Impl& rEntry = *aListIter; - fprintf(stderr, "Dangling config item of %s\n", rtl::OUStringToOString(rEntry.pConfigItem->GetSubTreeName(), RTL_TEXTENCODING_UTF8).getStr()); - } - } -#endif - OSL_ENSURE(pMgrImpl->aItemList.empty(), "some ConfigItems are still alive"); - if(!pMgrImpl->aItemList.empty()) - { - ConfigItemList::iterator aListIter; - for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) - { - ConfigItemListEntry_Impl& rEntry = *aListIter; - rEntry.pConfigItem->ReleaseConfigMgr(); - } - pMgrImpl->aItemList.erase(pMgrImpl->aItemList.begin(), pMgrImpl->aItemList.end()); - } - delete pMgrImpl; +struct theConfigManager: + public rtl::Static< utl::ConfigManager, theConfigManager > +{}; } -Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider() -{ - if(!xConfigurationProvider.is()) - { - Reference< XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory(); - if ( xMSF.is() ) - { - try - { - xConfigurationProvider = Reference< XMultiServiceFactory > - (xMSF->createInstance( - UNISTRING("com.sun.star.configuration.ConfigurationProvider")), - UNO_QUERY); - } -#if OSL_DEBUG_LEVEL > 1 - catch (const Exception& rEx) - { - static sal_Bool bMessage = sal_True; - if(bMessage) - { - bMessage = sal_False; - OString sMsg("CreateInstance with arguments exception: "); - sMsg += OString(rEx.Message.getStr(), - rEx.Message.getLength(), - RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(sMsg.getStr()); - } - } -#else - catch (const Exception&) - { - } -#endif - } - } - return xConfigurationProvider; +rtl::OUString utl::ConfigManager::getAboutBoxProductVersion() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("Product/ooSetupVersionAboutBox"))); } -namespace -{ - // helper to achieve exception - safe registration of a ConfigItem under construction - class RegisterConfigItemHelper // : Noncopyable - { - utl::ConfigManager & rCfgMgr; - utl::ConfigItem* pCfgItem; - public: - RegisterConfigItemHelper(utl::ConfigManager & rMgr, utl::ConfigItem& rCfgItem) - : rCfgMgr(rMgr) - , pCfgItem(&rCfgItem) - { - rCfgMgr.RegisterConfigItem(rCfgItem); - } - - ~RegisterConfigItemHelper() - { - if (pCfgItem) rCfgMgr.RemoveConfigItem(*pCfgItem); - } - - void keep() { pCfgItem = 0; } - }; +rtl::OUString utl::ConfigManager::getDefaultCurrency() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooSetupCurrency"))); } -Reference< XMultiServiceFactory > ConfigManager::GetLocalConfigurationProvider() -{ - return GetConfigurationProvider(); +rtl::OUString utl::ConfigManager::getLocale() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale"))); } -Reference< XHierarchicalNameAccess > ConfigManager::AddConfigItem(utl::ConfigItem& rCfgItem) -{ - RegisterConfigItemHelper registeredItem(*this,rCfgItem); - Reference< XHierarchicalNameAccess > xTree = AcquireTree(rCfgItem); - registeredItem.keep(); - return xTree; +rtl::OUString utl::ConfigManager::getProductExtension() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Product/ooSetupExtension"))); } -void ConfigManager::RegisterConfigItem(utl::ConfigItem& rCfgItem) -{ - ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin(); -#if OSL_DEBUG_LEVEL > 1 - for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) - { - ConfigItemListEntry_Impl& rEntry = *aListIter; - if(rEntry.pConfigItem == &rCfgItem) - OSL_FAIL("RegisterConfigItem: already inserted!"); - } -#endif - pMgrImpl->aItemList.insert(aListIter, ConfigItemListEntry_Impl(&rCfgItem)); +rtl::OUString utl::ConfigManager::getProductName() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Product/ooName"))); } -Reference< XHierarchicalNameAccess> ConfigManager::AcquireTree(utl::ConfigItem& rCfgItem) -{ -#if OSL_DEBUG_LEVEL > 1 - sal_Bool bFound = sal_False; - ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin(); - for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) - { - ConfigItemListEntry_Impl& rEntry = *aListIter; - if(rEntry.pConfigItem == &rCfgItem) - { - bFound = sal_True; - break; - } - } - OSL_ENSURE(bFound, "AcquireTree: ConfigItem unknown!"); -#endif - OUString sPath(RTL_CONSTASCII_USTRINGPARAM(aConfigBaseURL)); - sPath += rCfgItem.GetSubTreeName(); - Sequence< Any > aArgs(2); - Any* pArgs = aArgs.getArray(); - PropertyValue aPath; - aPath.Name = UNISTRING("nodepath"); - aPath.Value <<= sPath; - pArgs[0] <<= aPath; - sal_Bool bLazy = 0 != (rCfgItem.GetMode()&CONFIG_MODE_DELAYED_UPDATE); - PropertyValue aUpdate; - aUpdate.Name = UNISTRING("lazywrite"); - aUpdate.Value.setValue(&bLazy, ::getBooleanCppuType()); - pArgs[1] <<= aUpdate; - - // Initialize item with support for reading/writing more then one locales at same time! - // It's neccessary for creation of a complete configuration entry without changing office locale - // at runtime. - if((rCfgItem.GetMode() & CONFIG_MODE_ALL_LOCALES) == CONFIG_MODE_ALL_LOCALES) - { - sal_Int32 nCount = aArgs.getLength(); - aArgs.realloc(nCount+1); - - PropertyValue aAllLocale; - aAllLocale.Name = UNISTRING("locale"); - aAllLocale.Value <<= UNISTRING("*" ); - aArgs[nCount] <<= aAllLocale; - } - - Reference< XMultiServiceFactory > xCfgProvider = GetConfigurationProvider(); - Reference< XInterface > xIFace; - if(xCfgProvider.is()) - { - try - { - xIFace = xCfgProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM(aAccessSrvc)), - aArgs); - } - catch (const Exception& rEx) - { - if (CONFIG_MODE_PROPAGATE_ERRORS & rCfgItem.GetMode()) - { - OSL_TRACE("ConfigItem: Propagating creation error: %s\n", - OUStringToOString(rEx.Message,RTL_TEXTENCODING_ASCII_US).getStr()); - - throw; - } -#if OSL_DEBUG_LEVEL > 1 - if(0 == (CONFIG_MODE_IGNORE_ERRORS & rCfgItem.GetMode())) - { - OString sMsg("CreateInstance exception: "); - sMsg += OString(rEx.Message.getStr(), - rEx.Message.getLength(), - RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(sMsg.getStr()); - } -#endif - } - } - return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY); +rtl::OUString utl::ConfigManager::getProductVersion() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Product/ooSetupVersion"))); } -void ConfigManager::RemoveConfigItem(utl::ConfigItem& rCfgItem) -{ - if( !pMgrImpl->aItemList.empty() ) - { - ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin(); - for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) - { - ConfigItemListEntry_Impl& rEntry = *aListIter; - if(rEntry.pConfigItem == &rCfgItem) - { - pMgrImpl->aItemList.erase(aListIter); - break; - } - } - } +rtl::OUString utl::ConfigManager::getProductXmlFileFormat() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("Product/ooXMLFileFormatName"))); } -void ConfigManager::StoreConfigItems() -{ - if(!pMgrImpl->aItemList.empty()) - { - ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin(); - for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter) - { - ConfigItemListEntry_Impl& rEntry = *aListIter; - if(rEntry.pConfigItem->IsModified()) - { - rEntry.pConfigItem->Commit(); - rEntry.pConfigItem->ClearModified(); - } - } - } +rtl::OUString utl::ConfigManager::getProductXmlFileFormatVersion() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("Product/ooXMLFileFormatVersion"))); } -struct theConfigManager : public rtl::Static<ConfigManager, theConfigManager> {}; - -ConfigManager& ConfigManager::GetConfigManager() -{ - return theConfigManager::get(); +rtl::OUString utl::ConfigManager::getVendor() { + return getConfigurationString( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Product/ooVendor"))); } -rtl::OUString ConfigManager::GetConfigBaseURL() -{ - return OUString(RTL_CONSTASCII_USTRINGPARAM(aConfigBaseURL)); +rtl::OUString utl::ConfigManager::getWriterCompatibilityVersionOOo_1_1() { + return getConfigurationString( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/org.openoffice.Office.Compatibility")), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("WriterCompatibilityVersion/OOo11"))); } -Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) -{ - switch(eProp) - { - case INSTALLPATH: - OSL_FAIL( "ConfigManager::GetDirectConfigProperty: " - "INSTALLPATH no longer supported." ); - return Any(); - case USERINSTALLURL: - OSL_FAIL( "ConfigManager::GetDirectConfigProperty: " - "USERINSTALLURL no longer supported." ); - return Any(); - case OFFICEINSTALL: - OSL_FAIL( "ConfigManager::GetDirectConfigProperty: " - "OFFICEINSTALL no longer supported." ); - return Any(); - case OFFICEINSTALLURL: - OSL_FAIL( "ConfigManager::GetDirectConfigProperty: " - "OFFICEINSTALLURL no longer supported." ); - return Any(); - default: - break; - } - - Any aRet; - - ::rtl::OUString &rBrandName = BrandName::get(); - if ( eProp == PRODUCTNAME && rBrandName.getLength() ) - { - aRet <<= rBrandName; - return aRet; - } - - rtl::OUString &rProductVersion = ProductVersion::get(); - if ( eProp == PRODUCTVERSION && rProductVersion.getLength() ) - { - aRet <<= rProductVersion; - return aRet; - } - - rtl::OUString &rAboutBoxProductVersion = AboutBoxProductVersion::get(); - if ( eProp == ABOUTBOXPRODUCTVERSION && rAboutBoxProductVersion.getLength() ) - { - aRet <<= rAboutBoxProductVersion; - return aRet; - } - - rtl::OUString &rOOOVendor = OOOVendor::get(); - if ( eProp == OOOVENDOR && rOOOVendor.getLength() ) - { - aRet <<= rOOOVendor; - return aRet; - } - - - rtl::OUString &rProductExtension = ProductExtension::get(); - if ( eProp == PRODUCTEXTENSION && rProductExtension.getLength() ) - { - aRet <<= rProductExtension; - return aRet; - } - - rtl::OUString &rXMLFileFormatName = XMLFileFormatName::get(); - if ( eProp == PRODUCTXMLFILEFORMATNAME && rXMLFileFormatName.getLength() ) - { - aRet <<= rXMLFileFormatName; - return aRet; - } - - rtl::OUString &rXMLFileFormatVersion = XMLFileFormatVersion::get(); - if ( eProp == PRODUCTXMLFILEFORMATVERSION && rXMLFileFormatVersion.getLength() ) - { - aRet <<= rXMLFileFormatVersion; - return aRet; - } - - sal_Int32 &rOpenSourceContext = OpenSourceContext::get(); - if ( eProp == OPENSOURCECONTEXT && ( rOpenSourceContext >= 0 ) ) - { - aRet <<= rOpenSourceContext; - return aRet; - } +void utl::ConfigManager::storeConfigItems() { + getConfigManager().doStoreConfigItems(); +} - rtl::OUString &rWriterCompatibilityVersionOOo11 = WriterCompatibilityVersionOOo11::get(); - if ( eProp == WRITERCOMPATIBILITYVERSIONOOO11 && rWriterCompatibilityVersionOOo11.getLength() ) - { - aRet <<= rWriterCompatibilityVersionOOo11; - return aRet; - } +utl::ConfigManager & utl::ConfigManager::getConfigManager() { + return theConfigManager::get(); +} - if (eProp == PRODUCTEXTENSION) { - rtl::OUString name( +css::uno::Reference< css::container::XHierarchicalNameAccess > +utl::ConfigManager::acquireTree(utl::ConfigItem & item) { + css::uno::Sequence< css::uno::Any > args(1); + args[0] <<= css::beans::NamedValue( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), + css::uno::makeAny( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.")) + + item.GetSubTreeName())); + if ((item.GetMode() & CONFIG_MODE_ALL_LOCALES) != 0) { + args.realloc(2); + args[1] <<= css::beans::NamedValue( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("locale")), + css::uno::makeAny(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")))); + } + return css::uno::Reference< css::container::XHierarchicalNameAccess >( + getConfigurationProvider()->createInstanceWithArguments( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "${BRAND_BASE_DIR}/program/edition/edition.ini")); - rtl::Bootstrap::expandMacros(name); - if (rtl::Bootstrap(name).getFrom( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EDITIONNAME")), - rProductExtension)) - { - return com::sun::star::uno::Any(rProductExtension); - } - } - - OUString sPath(RTL_CONSTASCII_USTRINGPARAM(aConfigBaseURL)); - switch(eProp) - { - case LOCALE: sPath += UNISTRING("Setup/L10N"); break; - - case PRODUCTNAME: - case PRODUCTVERSION: - case PRODUCTEXTENSION: - case PRODUCTXMLFILEFORMATNAME : - case PRODUCTXMLFILEFORMATVERSION: - case OPENSOURCECONTEXT: - case OOOVENDOR: - case ABOUTBOXPRODUCTVERSION: sPath += UNISTRING("Setup/Product"); break; - - case DEFAULTCURRENCY: sPath += UNISTRING("Setup/L10N"); break; - - case WRITERCOMPATIBILITYVERSIONOOO11: - sPath += UNISTRING("Office.Compatibility/WriterCompatibilityVersion"); break; - default: - break; - } - Sequence< Any > aArgs(1); - aArgs[0] <<= sPath; - Reference< XMultiServiceFactory > xCfgProvider = GetConfigManager().GetConfigurationProvider(); - if(!xCfgProvider.is()) - return aRet; - Reference< XInterface > xIFace; - try - { - xIFace = xCfgProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM(aAccessSrvc)), - aArgs); - - } - catch (const Exception&) - { - } - Reference<XNameAccess> xDirectAccess(xIFace, UNO_QUERY); - if(xDirectAccess.is()) - { - OUString sProperty; - switch(eProp) - { - case LOCALE: sProperty = UNISTRING("ooLocale"); break; - case PRODUCTNAME: sProperty = UNISTRING("ooName"); break; - case PRODUCTVERSION: sProperty = UNISTRING("ooSetupVersion"); break; - case ABOUTBOXPRODUCTVERSION: sProperty = UNISTRING("ooSetupVersionAboutBox"); break; - case OOOVENDOR: sProperty = UNISTRING("ooVendor"); break; - case PRODUCTEXTENSION: sProperty = UNISTRING("ooSetupExtension"); break; - case PRODUCTXMLFILEFORMATNAME: sProperty = UNISTRING("ooXMLFileFormatName"); break; - case PRODUCTXMLFILEFORMATVERSION: sProperty = UNISTRING("ooXMLFileFormatVersion"); break; - case OPENSOURCECONTEXT: sProperty = UNISTRING("ooOpenSourceContext"); break; - case DEFAULTCURRENCY: sProperty = UNISTRING("ooSetupCurrency"); break; - case WRITERCOMPATIBILITYVERSIONOOO11: sProperty = UNISTRING("OOo11"); break; - default: - break; - } - try - { - aRet = xDirectAccess->getByName(sProperty); - } - catch (const Exception&) - { - #if OSL_DEBUG_LEVEL > 0 - rtl::OStringBuffer aBuf(256); - aBuf.append( "ConfigManager::GetDirectConfigProperty: could not retrieve the property \"" ); - aBuf.append( rtl::OUStringToOString( sProperty, RTL_TEXTENCODING_ASCII_US ) ); - aBuf.append( "\" under \"" ); - aBuf.append( rtl::OUStringToOString( sPath, RTL_TEXTENCODING_ASCII_US ) ); - aBuf.append( "\" (caught an exception)!" ); - OSL_FAIL( aBuf.getStr() ); - #endif - } - } - - if ( eProp == PRODUCTNAME ) - aRet >>= rBrandName; - - if ( eProp == PRODUCTXMLFILEFORMATNAME ) - aRet >>= rXMLFileFormatName; - - if ( eProp == PRODUCTXMLFILEFORMATVERSION ) - aRet >>= rXMLFileFormatVersion; - - if ( eProp == PRODUCTVERSION ) - aRet >>= rProductVersion; - - if( eProp == OOOVENDOR ) - aRet >>= rOOOVendor; - - if ( eProp == ABOUTBOXPRODUCTVERSION ) - { - aRet >>= rAboutBoxProductVersion; - getBasisAboutBoxProductVersion( rAboutBoxProductVersion ); - aRet <<= rAboutBoxProductVersion; - } - - if ( eProp == PRODUCTEXTENSION ) - aRet >>= rProductExtension; - - if ( eProp == WRITERCOMPATIBILITYVERSIONOOO11 ) - aRet >>= rWriterCompatibilityVersionOOo11; + "com.sun.star.configuration.ConfigurationUpdateAccess")), + args), + css::uno::UNO_QUERY_THROW); +} - if ( eProp == OPENSOURCECONTEXT ) - aRet >>= rOpenSourceContext; +utl::ConfigManager::ConfigManager() {} - return aRet; +utl::ConfigManager::~ConfigManager() { + OSL_ASSERT(items_.empty()); } -/*---------------------------------------------------------------------------*/ -void ConfigManager::getBasisAboutBoxProductVersion( OUString& rVersion ) -{ - rtl::OUString aPackageVersion = UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":OOOPackageVersion}" ); - rtl::Bootstrap::expandMacros( aPackageVersion ); - - if ( aPackageVersion.getLength() ) - { - sal_Int32 nTokIndex = 0; - rtl::OUString aVersionMinor = aPackageVersion.getToken( 1, '.', nTokIndex ); - rtl::OUString aVersionMicro; - - if ( nTokIndex > 0 ) - aVersionMicro = aPackageVersion.getToken( 0, '.', nTokIndex ); - - if ( aVersionMinor.getLength() == 0 ) - aVersionMinor = UNISTRING( "0" ); - if ( aVersionMicro.getLength() == 0 ) - aVersionMicro = UNISTRING( "0" ); - - sal_Int32 nIndex = rVersion.indexOf( '.' ); - if ( nIndex == -1 ) - { - rVersion += UNISTRING( "." ); - rVersion += aVersionMinor; - } - else - { - nIndex = rVersion.indexOf( '.', nIndex+1 ); - } - if ( nIndex == -1 ) - { - rVersion += UNISTRING( "." ); - rVersion += aVersionMicro; - } - else - { - rVersion = rVersion.replaceAt( nIndex+1, rVersion.getLength()-nIndex-1, aVersionMicro ); - } - } +css::uno::Reference< css::container::XHierarchicalNameAccess > +utl::ConfigManager::addConfigItem(utl::ConfigItem & item) { + RegisterConfigItemHelper reg(*this, item); + css::uno::Reference< css::container::XHierarchicalNameAccess > tree( + acquireTree(item)); + reg.keep(); + return tree; } -Reference< XHierarchicalNameAccess> ConfigManager::GetHierarchyAccess(const OUString& rFullPath) -{ - Sequence< Any > aArgs(1); - aArgs[0] <<= rFullPath; - Reference< XMultiServiceFactory > xCfgProvider = GetLocalConfigurationProvider(); - Reference< XInterface > xIFace; - if(xCfgProvider.is()) +void utl::ConfigManager::removeConfigItem(utl::ConfigItem & item) { + for (std::list< ConfigItem * >::iterator i(items_.begin()); + i != items_.end(); ++i) { - try - { - xIFace = xCfgProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM(aAccessSrvc)), - aArgs); - } -#if OSL_DEBUG_LEVEL > 1 - catch (const Exception& rEx) - { - OString sMsg("CreateInstance exception: "); - sMsg += OString(rEx.Message.getStr(), - rEx.Message.getLength(), - RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(sMsg.getStr()); - } -#else - catch (const Exception&) - { + if (*i == &item) { + items_.erase(i); + break; } -#endif } - return Reference<XHierarchicalNameAccess>(xIFace, UNO_QUERY); } -Any ConfigManager::GetLocalProperty(const OUString& rProperty) -{ - OUString sPath(RTL_CONSTASCII_USTRINGPARAM(aConfigBaseURL)); - sPath += rProperty; - - OUString sNode, sProperty; - OSL_VERIFY( splitLastFromConfigurationPath(sPath, sNode, sProperty) ); - - Reference< XNameAccess> xAccess( GetHierarchyAccess(sNode), UNO_QUERY ); - Any aRet; - try - { - if(xAccess.is()) - aRet = xAccess->getByName(sProperty); - } -#if OSL_DEBUG_LEVEL > 1 - catch (const Exception& rEx) - { - OString sMsg("GetLocalProperty: "); - sMsg += OString(rEx.Message.getStr(), - rEx.Message.getLength(), - RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(sMsg.getStr()); - } -#else - catch (const Exception&) - { - } -#endif - return aRet; +void utl::ConfigManager::registerConfigItem(utl::ConfigItem * item) { + OSL_ASSERT(item != 0); + items_.push_back(item); } -void ConfigManager::PutLocalProperty(const OUString& rProperty, const Any& rValue) -{ - OUString sPath(RTL_CONSTASCII_USTRINGPARAM(aConfigBaseURL)); - sPath += rProperty; - - OUString sNode, sProperty; - OSL_VERIFY( splitLastFromConfigurationPath(sPath, sNode, sProperty) ); - - Reference<XNameReplace> xNodeReplace(GetHierarchyAccess(sNode), UNO_QUERY); - if(xNodeReplace.is()) +void utl::ConfigManager::doStoreConfigItems() { + for (std::list< ConfigItem * >::iterator i(items_.begin()); + i != items_.end(); ++i) { - try - { - xNodeReplace->replaceByName(sProperty, rValue); - } -#if OSL_DEBUG_LEVEL > 1 - catch (const Exception& rEx) - { - OString sMsg("PutLocalProperty: "); - sMsg += OString(rEx.Message.getStr(), - rEx.Message.getLength(), - RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(sMsg.getStr()); + if ((*i)->IsModified()) { + (*i)->Commit(); + (*i)->ClearModified(); } -#else - catch (const Exception&) - { - } -#endif } } -sal_Bool ConfigManager::IsLocalConfigProvider() -{ - return false; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx index 0b9f1331b261..b068646341ae 100644 --- a/unotools/source/config/defaultoptions.cxx +++ b/unotools/source/config/defaultoptions.cxx @@ -234,7 +234,6 @@ String SvtDefaultOptions_Impl::GetDefaultPath( sal_uInt16 nId ) const SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( ASCII_STR("Office.Common/Path/Default") ) { - /*ConfigManager* pCfgMgr =*/ ConfigManager::GetConfigManager(); Sequence< OUString > aNames = GetDefaultPropertyNames(); Sequence< Any > aValues = GetProperties( aNames ); EnableNotification( aNames ); diff --git a/unotools/source/config/docinfohelper.cxx b/unotools/source/config/docinfohelper.cxx index 462ab33ca162..537102a9eff7 100644 --- a/unotools/source/config/docinfohelper.cxx +++ b/unotools/source/config/docinfohelper.cxx @@ -47,25 +47,21 @@ namespace utl // First product: branded name + version // version is <product_versions>_<product_extension>$<platform> - utl::ConfigManager& rMgr = utl::ConfigManager::GetConfigManager(); + // plain product name - rtl::OUString aValue; - uno::Any aAny = rMgr.GetDirectConfigProperty( - utl::ConfigManager::PRODUCTNAME); - if ( (aAny >>= aValue) && aValue.getLength() ) + rtl::OUString aValue( utl::ConfigManager::getProductName() ); + if ( !aValue.isEmpty() ) { aResult.append( aValue.replace( ' ', '_' ) ); aResult.append( (sal_Unicode)'/' ); - aAny = rMgr.GetDirectConfigProperty( - utl::ConfigManager::PRODUCTVERSION); - if ( (aAny >>= aValue) && aValue.getLength() ) + aValue = utl::ConfigManager::getProductVersion(); + if ( !aValue.isEmpty() ) { aResult.append( aValue.replace( ' ', '_' ) ); - aAny = rMgr.GetDirectConfigProperty( - utl::ConfigManager::PRODUCTEXTENSION); - if ( (aAny >>= aValue) && aValue.getLength() ) + aValue = utl::ConfigManager::getProductExtension(); + if ( !aValue.isEmpty() ) { aResult.append( (sal_Unicode)'_' ); aResult.append( aValue.replace( ' ', '_' ) ); diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx index ee96bc83e322..92d3971a5365 100644 --- a/unotools/source/config/itemholder1.cxx +++ b/unotools/source/config/itemholder1.cxx @@ -90,7 +90,6 @@ ItemHolder1::ItemHolder1() if (xCfg.is()) xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); } -// #i37892 got errorhandling from ConfigManager::GetConfigurationProvider() #ifdef DBG_UTIL catch(css::uno::Exception& rEx) { diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index b760576c47a1..327401059d5d 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -510,22 +510,11 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() : } // Set language type! - Any aLocale = ConfigManager::GetConfigManager().GetDirectConfigProperty( ConfigManager::LOCALE ); - OUString aLocaleStr; - if ( aLocale >>= aLocaleStr ) - { - sal_Int32 nIndex = 0; - m_aLocale.Language = aLocaleStr.getToken(0, '-', nIndex ); - m_aLocale.Country = aLocaleStr.getToken(0, '-', nIndex ); - m_aLocale.Variant = aLocaleStr.getToken(0, '-', nIndex ); - } - else - { - DBG_ASSERT(!aLocale.hasValue(), "wrong any type"); - m_aLocale.Language = OStringToOUString(OString("en"), RTL_TEXTENCODING_UTF8); - m_aLocale.Country = OStringToOUString(OString("US"), RTL_TEXTENCODING_UTF8); - m_aLocale.Variant = OStringToOUString(OString(""), RTL_TEXTENCODING_UTF8); - } + OUString aLocaleStr( ConfigManager::getLocale() ); + sal_Int32 nIndex = 0; + m_aLocale.Language = aLocaleStr.getToken(0, '-', nIndex ); + m_aLocale.Country = aLocaleStr.getToken(0, '-', nIndex ); + m_aLocale.Variant = aLocaleStr.getToken(0, '-', nIndex ); } // ----------------------------------------------------------------------- diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index 11a781213b4c..dc5599437b24 100644 --- a/unotools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -106,7 +106,6 @@ public: ::rtl::OUString GetApartment() const; ::rtl::OUString GetFullName() const; - ::rtl::OUString GetLocale() const { return m_aLocale; } // set the address token void SetCompany( const ::rtl::OUString& rNewToken ); @@ -136,7 +135,6 @@ private: uno::Reference< util::XChangesListener > m_xChangeListener; css::uno::Reference< css::container::XNameAccess > m_xCfg; css::uno::Reference< css::beans::XPropertySet > m_xData; - ::rtl::OUString m_aLocale; }; // global ---------------------------------------------------------------- @@ -203,15 +201,6 @@ SvtUserOptions_Impl::SvtUserOptions_Impl() : m_xCfg.clear(); LogHelper::logIt(ex); } - - Any aAny = ConfigManager::GetConfigManager().GetDirectConfigProperty( ConfigManager::LOCALE ); - ::rtl::OUString aLocale; - if ( aAny >>= aLocale ) - m_aLocale = aLocale; - else - { - DBG_ERRORFILE( "SvtUserOptions_Impl::SvtUserOptions_Impl(): no locale found" ); - } } // ----------------------------------------------------------------------- @@ -1150,8 +1139,7 @@ namespace ::rtl::OUString SvtUserOptions::GetLocale() const { - ::osl::MutexGuard aGuard( GetInitMutex() ); - return pImp->GetLocale(); + return utl::ConfigManager::getLocale(); } // ----------------------------------------------------------------------- diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 401228c7ea6e..4f6cb6bfc702 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -1324,19 +1324,7 @@ UUIInteractionHelper::handleGenericErrorRequest( boost::scoped_ptr< ResMgr > xManager( ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) ); - ::rtl::OUString aTitle; - - try - { - uno::Any aProductNameAny = - ::utl::ConfigManager::GetConfigManager() - .GetDirectConfigProperty( - ::utl::ConfigManager::PRODUCTNAME ); - aProductNameAny >>= aTitle; - } - catch( uno::Exception& ) - { - } + rtl::OUString aTitle( utl::ConfigManager::getProductName() ); ::rtl::OUString aErrTitle = String( ResId( nError == ERRCODE_SFX_BROKENSIGNATURE @@ -1542,28 +1530,13 @@ UUIInteractionHelper::handleBrokenPackageRequest( else return; - uno::Any aProductNameAny = - ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty( - ::utl::ConfigManager::PRODUCTNAME ); - uno::Any aProductVersionAny = - ::utl::ConfigManager::GetConfigManager().GetDirectConfigProperty( - ::utl::ConfigManager::PRODUCTVERSION ); - ::rtl::OUString aProductName, aProductVersion; - if ( !( aProductNameAny >>= aProductName ) ) - aProductName - = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice") ); - - ::rtl::OUString aTitle( aProductName ); - if( aProductVersionAny >>= aProductVersion ) - { - aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" ") ); - aTitle += aProductVersion; - } + rtl::OUString title( + utl::ConfigManager::getProductName() + + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) + + utl::ConfigManager::getProductVersion() ); - switch ( executeMessageBox( getParentProperty(), - aTitle, - aMessage, - nButtonMask )) + switch ( + executeMessageBox( getParentProperty(), title, aMessage, nButtonMask ) ) { case ERRCODE_BUTTON_OK: OSL_ENSURE( xAbort.is(), "unexpected situation" ); diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 533fe6b3ac64..9267025c455e 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -45,7 +45,6 @@ #include "unotools/fontcfg.hxx" #include "unotools/localedatawrapper.hxx" #include "unotools/collatorwrapper.hxx" -#include "unotools/configmgr.hxx" #include "unotools/confignode.hxx" #include "unotools/syslocaleoptions.hxx" @@ -804,34 +803,16 @@ sal_uLong StyleSettings::GetCurrentSymbolsStyle() const sal_uLong StyleSettings::GetAutoSymbolsStyle() const { - const ::rtl::OUString& rDesktopEnvironment = Application::GetDesktopEnvironment(); - sal_uLong nRet = STYLE_SYMBOLS_DEFAULT; - bool bCont = true; - - try - { - const ::com::sun::star::uno::Any aAny( ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::OPENSOURCECONTEXT ) ); - sal_Int32 nValue( 0 ); - - aAny >>= nValue; - - if( 0 == nValue ) - bCont = false; - } - catch ( ::com::sun::star::uno::Exception& ) - { - } - - if( bCont ) - { - if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) || - rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "windows" ) ) - nRet = STYLE_SYMBOLS_TANGO; - else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) ) - nRet = STYLE_SYMBOLS_CRYSTAL; - else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) ) - nRet = STYLE_SYMBOLS_OXYGEN; - } + rtl::OUString const & env = Application::GetDesktopEnvironment(); + sal_uLong nRet = + ( env.equalsIgnoreAsciiCaseAscii( "gnome" ) || + env.equalsIgnoreAsciiCaseAscii( "windows" ) ) + ? STYLE_SYMBOLS_TANGO + : env.equalsIgnoreAsciiCaseAscii( "kde" ) + ? STYLE_SYMBOLS_CRYSTAL + : env.equalsIgnoreAsciiCaseAscii( "kde4" ) + ? STYLE_SYMBOLS_OXYGEN + : STYLE_SYMBOLS_DEFAULT; // falback to any existing style if ( ! CheckSymbolStyle (nRet) ) diff --git a/writerfilter/CppunitTest_writerfilter_rtftok.mk b/writerfilter/CppunitTest_writerfilter_rtftok.mk index dbb5582d1cf0..13f3f77db574 100644 --- a/writerfilter/CppunitTest_writerfilter_rtftok.mk +++ b/writerfilter/CppunitTest_writerfilter_rtftok.mk @@ -63,12 +63,14 @@ $(eval $(call gb_CppunitTest_add_components,writerfilter_rtftok,\ )) $(eval $(call gb_CppunitTest_add_old_components,writerfilter_rtftok,\ + configmgr \ ucb1 \ ucpfile1 \ )) $(eval $(call gb_CppunitTest_set_args,writerfilter_rtftok,\ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ + "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry)" \ )) # we need to explicitly depend on library rtftok and writerfilter because it is not implied diff --git a/writerfilter/prj/build.lst b/writerfilter/prj/build.lst index 3005e9636218..b31510ab2b28 100644 --- a/writerfilter/prj/build.lst +++ b/writerfilter/prj/build.lst @@ -1,3 +1,3 @@ -wf writerfilter : soltools sal BOOST:boost cppu cppuhelper ucbhelper tools svx LIBXSLT:libxslt oox test NULL +wf writerfilter : soltools sal BOOST:boost configmgr cppu cppuhelper ucbhelper tools svx LIBXSLT:libxslt oox test NULL wf writerfilter usr1 - all wf_mkout NULL wf writerfilter\prj nmake - all wf_prj NULL diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx index 35f84e133b04..33f6ba5ead8f 100644 --- a/xmlhelp/source/cxxhelp/provider/provider.cxx +++ b/xmlhelp/source/cxxhelp/provider/provider.cxx @@ -301,15 +301,6 @@ void ContentProvider::init() { } - /** - * now determing - * productname, - * productversion, - */ - - rtl::OUString productname; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= productname; - xHierAccess = getHierAccess( sProvider, "org.openoffice.Setup" ); rtl::OUString setupversion( @@ -371,7 +362,7 @@ void ContentProvider::init() m_pDatabases = new Databases( showBasic, instPath, aImagesZipPaths, - productname, + utl::ConfigManager::getProductName(), productversion, stylesheet, xContext ); diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 0640ee7dfe03..d23da1f75f0c 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -678,9 +678,6 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) /* reading setup */ /**********************************************************************/ - rtl::OUString productName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= productName; - xHierAccess = getHierAccess( sProvider, "org.openoffice.Setup" ); @@ -803,7 +800,7 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) configData.m_vAdd[2] = 11; configData.m_vAdd[3] = 14; configData.m_vAdd[4] = 12; - configData.m_vReplacement[0] = productName; + configData.m_vReplacement[0] = utl::ConfigManager::getProductName(); configData.m_vReplacement[1] = productVersion; // m_vReplacement[2...4] (vendorName/-Version/-Short) are empty strings |