summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-25 12:50:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-06-25 14:19:03 +0100
commit2c757293b819118780eef3a30bb4434528d38673 (patch)
tree35beab468034fbeab06137452542d0d9191bb309 /sfx2
parent2ce31e56efaf1e429ecc13fd80b6767cb9ea585b (diff)
reduce static_initialization_and_destruction chain
Change-Id: I0c1b2f2d908c31d1510662880c13504d81445a6a
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appbaslib.cxx24
-rw-r--r--sfx2/source/appl/appinit.cxx10
-rw-r--r--sfx2/source/doc/docfac.cxx7
-rw-r--r--sfx2/source/doc/docmacromode.cxx4
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx13
5 files changed, 15 insertions, 43 deletions
diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx
index fc823061e593..2d467c58429e 100644
--- a/sfx2/source/appl/appbaslib.cxx
+++ b/sfx2/source/appl/appbaslib.cxx
@@ -202,31 +202,15 @@ SFX_IMPL_ONEINSTANCEFACTORY( SfxApplicationScriptLibraryContainer )
Sequence< OUString > SfxApplicationScriptLibraryContainer::impl_getStaticSupportedServiceNames()
{
- static Sequence< OUString > seqServiceNames( 1 );
- static sal_Bool bNeedsInit = sal_True;
-
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if( bNeedsInit )
- {
- OUString* pSeq = seqServiceNames.getArray();
- pSeq[0] = OUString("com.sun.star.script.ApplicationScriptLibraryContainer");
- bNeedsInit = sal_False;
- }
+ Sequence< OUString > seqServiceNames( 1 );
+ OUString* pSeq = seqServiceNames.getArray();
+ pSeq[0] = OUString("com.sun.star.script.ApplicationScriptLibraryContainer");
return seqServiceNames;
}
OUString SfxApplicationScriptLibraryContainer::impl_getStaticImplementationName()
{
- static OUString aImplName;
- static sal_Bool bNeedsInit = sal_True;
-
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if( bNeedsInit )
- {
- aImplName = OUString("com.sun.star.comp.sfx2.ApplicationScriptLibraryContainer");
- bNeedsInit = sal_False;
- }
- return aImplName;
+ return OUString("com.sun.star.comp.sfx2.ApplicationScriptLibraryContainer");
}
Reference< XInterface > SAL_CALL SfxApplicationScriptLibraryContainer::impl_createInstance
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 472a6e7e18fb..f4e9fcb36c44 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -109,9 +109,6 @@ void SAL_CALL SfxTerminateListener_Impl::queryTermination( const EventObject& )
void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& aEvent ) throw(RuntimeException )
{
- static ::rtl::OUString SERVICE_GLOBALEVENTBROADCASTER("com.sun.star.frame.GlobalEventBroadcaster");
- static ::rtl::OUString EVENT_QUIT_APP ("OnCloseApp");
-
Reference< XDesktop > xDesktop( aEvent.Source, UNO_QUERY );
if( xDesktop.is() == sal_True )
xDesktop->removeTerminateListener( this );
@@ -125,11 +122,11 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
pApp->Get_Impl()->pAppDispatch->release();
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
- css::uno::Reference< css::document::XEventListener > xGlobalBroadcaster(xSMGR->createInstance(SERVICE_GLOBALEVENTBROADCASTER), css::uno::UNO_QUERY);
+ css::uno::Reference< css::document::XEventListener > xGlobalBroadcaster(xSMGR->createInstance("com.sun.star.frame.GlobalEventBroadcaster"), css::uno::UNO_QUERY);
if (xGlobalBroadcaster.is())
{
css::document::EventObject aEvent2;
- aEvent2.EventName = EVENT_QUIT_APP;
+ aEvent2.EventName = "OnCloseApp";
xGlobalBroadcaster->notifyEvent(aEvent2);
}
@@ -139,8 +136,7 @@ void SAL_CALL SfxTerminateListener_Impl::notifyTermination( const EventObject& a
::rtl::OUString SAL_CALL SfxTerminateListener_Impl::getImplementationName() throw (RuntimeException)
{
- static const ::rtl::OUString IMPLNAME("com.sun.star.comp.sfx2.SfxTerminateListener");
- return IMPLNAME;
+ return ::rtl::OUString("com.sun.star.comp.sfx2.SfxTerminateListener");
}
::sal_Bool SAL_CALL SfxTerminateListener_Impl::supportsService( const ::rtl::OUString& sServiceName ) throw (RuntimeException)
diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index 3d04c9750c1e..996278f446c1 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -390,20 +390,17 @@ String SfxObjectFactory::GetFactoryURL() const
String SfxObjectFactory::GetModuleName() const
{
- static ::rtl::OUString SERVICENAME_MODULEMANAGER("com.sun.star.frame.ModuleManager");
- static ::rtl::OUString PROP_MODULEUINAME ("ooSetupFactoryUIName");
-
try
{
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
css::uno::Reference< css::container::XNameAccess > xModuleManager(
- xSMGR->createInstance(SERVICENAME_MODULEMANAGER),
+ xSMGR->createInstance("com.sun.star.frame.ModuleManager"),
css::uno::UNO_QUERY_THROW);
::rtl::OUString sDocService(GetDocumentServiceName());
::comphelper::SequenceAsHashMap aPropSet( xModuleManager->getByName(sDocService) );
- ::rtl::OUString sModuleName = aPropSet.getUnpackedValueOrDefault(PROP_MODULEUINAME, ::rtl::OUString());
+ ::rtl::OUString sModuleName = aPropSet.getUnpackedValueOrDefault("ooSetupFactoryUIName", ::rtl::OUString());
return String(sModuleName);
}
catch(const css::uno::RuntimeException&)
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index 3bcbf2de5309..371264fa73ff 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -421,8 +421,8 @@ namespace sfx2
{
try
{
- static const ::rtl::OUString s_sBasicStorageName( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ) );
- static const ::rtl::OUString s_sScriptsStorageName( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Scripts" ) ) );
+ const ::rtl::OUString s_sBasicStorageName( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ) );
+ const ::rtl::OUString s_sScriptsStorageName( ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "Scripts" ) ) );
bHasMacros =( ( rxStorage->hasByName( s_sBasicStorageName )
&& rxStorage->isStorageElement( s_sBasicStorageName )
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 5bddcfe7ce9a..be44438cc3a3 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -481,12 +481,9 @@ SfxSaveGuard::SfxSaveGuard(const uno::Reference< frame::XModel >& xM
, m_pData (pData )
, m_pFramesLock(0 )
{
- static ::rtl::OUString MSG_1("Object already disposed.");
- static ::rtl::OUString MSG_2("Concurrent save requests on the same document are not possible.");
-
if ( m_pData->m_bClosed )
throw ::com::sun::star::lang::DisposedException(
- MSG_1,
+ ::rtl::OUString("Object already disposed."),
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >());
if (
@@ -494,7 +491,7 @@ SfxSaveGuard::SfxSaveGuard(const uno::Reference< frame::XModel >& xM
m_pData->m_bSaving
)
throw ::com::sun::star::io::IOException(
- MSG_2,
+ ::rtl::OUString("Concurrent save requests on the same document are not possible."),
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >());
m_pData->m_bSaving = sal_True;
@@ -1473,8 +1470,6 @@ void SAL_CALL SfxBaseModel::removeModifyListener(const uno::Reference< XMODIFYLI
void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
{
- static ::rtl::OUString MSG_1("Cant close while saving.");
-
SolarMutexGuard aGuard;
if ( impl_isDisposed() || m_pData->m_bClosed || m_pData->m_bClosing )
return;
@@ -1503,7 +1498,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo
if (bDeliverOwnership)
m_pData->m_bSuicide = sal_True;
throw util::CloseVetoException(
- MSG_1,
+ ::rtl::OUString("Cant close while saving."),
static_cast< ::com::sun::star::util::XCloseable* >(this));
}
@@ -3739,7 +3734,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper ()
if ( ! m_pData->m_xTitleHelper.is ())
{
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory ();
- static const ::rtl::OUString SERVICENAME_DESKTOP("com.sun.star.frame.Desktop");
+ const ::rtl::OUString SERVICENAME_DESKTOP("com.sun.star.frame.Desktop");
css::uno::Reference< css::frame::XUntitledNumbers > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::frame::XModel > xThis (static_cast< css::frame::XModel* >(this), css::uno::UNO_QUERY_THROW);