summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-04-02 09:38:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-04-02 14:53:50 +0100
commite9a467cafbffb380c54e90b24f9ee20cd4adc7e8 (patch)
tree9a5c6d4dcfdcb4ff7b089c0219d51e58c70146fc
parente6409de0f879df204de7b07117798e2d77235458 (diff)
remove static objects from static_initialization_and_destruction chain
-rw-r--r--dbaccess/source/core/inc/core_resource.hxx1
-rw-r--r--dbaccess/source/core/resource/core_resource.cxx13
-rw-r--r--formula/source/core/inc/core_resource.hxx1
-rw-r--r--formula/source/core/resource/core_resource.cxx11
-rw-r--r--formula/source/ui/inc/ModuleHelper.hxx1
-rw-r--r--formula/source/ui/resource/ModuleHelper.cxx13
-rw-r--r--reportdesign/inc/ModuleHelper.hxx1
-rw-r--r--reportdesign/source/core/sdr/ModuleHelper.cxx15
-rw-r--r--sc/source/ui/docshell/impex.cxx14
-rw-r--r--sd/source/ui/dlg/TemplateScanner.cxx38
-rw-r--r--sd/source/ui/tools/EventMultiplexer.cxx21
11 files changed, 71 insertions, 58 deletions
diff --git a/dbaccess/source/core/inc/core_resource.hxx b/dbaccess/source/core/inc/core_resource.hxx
index 42677cd5a72d..81e8bafc7056 100644
--- a/dbaccess/source/core/inc/core_resource.hxx
+++ b/dbaccess/source/core/inc/core_resource.hxx
@@ -51,7 +51,6 @@ namespace dbaccess
class ResourceManager
{
friend class OModuleClient;
- static ::osl::Mutex s_aMutex; /// access safety
static sal_Int32 s_nClients; /// number of registered clients
static ResMgr* m_pImpl;
diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx
index fdaa168f3669..e42ad531aead 100644
--- a/dbaccess/source/core/resource/core_resource.cxx
+++ b/dbaccess/source/core/resource/core_resource.cxx
@@ -34,7 +34,7 @@
// ---- needed as long as we have no contexts for components ---
#include <vcl/svapp.hxx>
//---------------------------------------------------
-
+#include <rtl/instance.hxx>
#include <svl/solar.hrc>
//.........................................................................
@@ -44,7 +44,12 @@ namespace dbaccess
//==================================================================
//= ResourceManager
//==================================================================
- ::osl::Mutex ResourceManager::s_aMutex;
+ namespace
+ {
+ // access safety
+ struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {};
+ }
+
sal_Int32 ResourceManager::s_nClients = 0;
ResMgr* ResourceManager::m_pImpl = NULL;
@@ -92,14 +97,14 @@ namespace dbaccess
//-------------------------------------------------------------------------
void ResourceManager::registerClient()
{
- ::osl::MutexGuard aGuard(s_aMutex);
+ ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
++s_nClients;
}
//-------------------------------------------------------------------------
void ResourceManager::revokeClient()
{
- ::osl::MutexGuard aGuard(s_aMutex);
+ ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
if (!--s_nClients && m_pImpl)
{
delete m_pImpl;
diff --git a/formula/source/core/inc/core_resource.hxx b/formula/source/core/inc/core_resource.hxx
index 6dc198d90141..a78fc3937d39 100644
--- a/formula/source/core/inc/core_resource.hxx
+++ b/formula/source/core/inc/core_resource.hxx
@@ -43,7 +43,6 @@ namespace formula
class ResourceManager
{
friend class OModuleClient;
- static ::osl::Mutex s_aMutex; /// access safety
static sal_Int32 s_nClients; /// number of registered clients
static ResMgr* m_pImpl;
diff --git a/formula/source/core/resource/core_resource.cxx b/formula/source/core/resource/core_resource.cxx
index 9521db87c119..e0c31a6b52e3 100644
--- a/formula/source/core/resource/core_resource.cxx
+++ b/formula/source/core/resource/core_resource.cxx
@@ -32,6 +32,7 @@
// ---- needed as long as we have no contexts for components ---
#include <vcl/svapp.hxx>
+#include <rtl/instance.hxx>
#include <svl/solar.hrc>
//.........................................................................
@@ -41,7 +42,11 @@ namespace formula
//==================================================================
//= ResourceManager
//==================================================================
- ::osl::Mutex ResourceManager::s_aMutex;
+ namespace
+ {
+ // access safety
+ struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {};
+ }
sal_Int32 ResourceManager::s_nClients = 0;
ResMgr* ResourceManager::m_pImpl = NULL;
@@ -59,14 +64,14 @@ namespace formula
//-------------------------------------------------------------------------
void ResourceManager::registerClient()
{
- ::osl::MutexGuard aGuard(s_aMutex);
+ ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
++s_nClients;
}
//-------------------------------------------------------------------------
void ResourceManager::revokeClient()
{
- ::osl::MutexGuard aGuard(s_aMutex);
+ ::osl::MutexGuard aGuard(theResourceManagerMutex::get());
if (!--s_nClients && m_pImpl)
{
delete m_pImpl;
diff --git a/formula/source/ui/inc/ModuleHelper.hxx b/formula/source/ui/inc/ModuleHelper.hxx
index 6599c389bf99..80944de8e613 100644
--- a/formula/source/ui/inc/ModuleHelper.hxx
+++ b/formula/source/ui/inc/ModuleHelper.hxx
@@ -49,7 +49,6 @@ namespace formula
// not implemented. OModule is a static class
protected:
- static ::osl::Mutex s_aMutex; /// access safety
static sal_Int32 s_nClients; /// number of registered clients
static OModuleImpl* s_pImpl; /// impl class. lives as long as at least one client for the module is registered
diff --git a/formula/source/ui/resource/ModuleHelper.cxx b/formula/source/ui/resource/ModuleHelper.cxx
index a0c2ae61f859..f30f58821604 100644
--- a/formula/source/ui/resource/ModuleHelper.cxx
+++ b/formula/source/ui/resource/ModuleHelper.cxx
@@ -32,13 +32,14 @@
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/instance.hxx>
#include <rtl/uri.hxx>
#include <tools/debug.hxx>
#include <svl/solar.hrc>
#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
#define ENTER_MOD_METHOD() \
- ::osl::MutexGuard aGuard(s_aMutex); \
+ ::osl::MutexGuard aGuard(theOModuleMutex::get()); \
ensureImpl()
//.........................................................................
@@ -98,7 +99,11 @@ ResMgr* OModuleImpl::getResManager()
//=========================================================================
//= OModule
//=========================================================================
-::osl::Mutex OModule::s_aMutex;
+namespace
+{
+ // access safety
+ struct theOModuleMutex : public rtl::Static< osl::Mutex, theOModuleMutex > {};
+}
sal_Int32 OModule::s_nClients = 0;
OModuleImpl* OModule::s_pImpl = NULL;
//-------------------------------------------------------------------------
@@ -111,14 +116,14 @@ ResMgr* OModule::getResManager()
//-------------------------------------------------------------------------
void OModule::registerClient()
{
- ::osl::MutexGuard aGuard(s_aMutex);
+ ::osl::MutexGuard aGuard(theOModuleMutex::get());
++s_nClients;
}
//-------------------------------------------------------------------------
void OModule::revokeClient()
{
- ::osl::MutexGuard aGuard(s_aMutex);
+ ::osl::MutexGuard aGuard(theOModuleMutex::get());
if (!--s_nClients && s_pImpl)
{
delete s_pImpl;
diff --git a/reportdesign/inc/ModuleHelper.hxx b/reportdesign/inc/ModuleHelper.hxx
index b3ed01738b36..ad1cb6761256 100644
--- a/reportdesign/inc/ModuleHelper.hxx
+++ b/reportdesign/inc/ModuleHelper.hxx
@@ -50,7 +50,6 @@ namespace rptui
// not implemented. OModule is a static class
protected:
- static ::osl::Mutex s_aMutex; /// access safety
static sal_Int32 s_nClients; /// number of registered clients
static OModuleImpl* s_pImpl; /// impl class. lives as long as at least one client for the module is registered
diff --git a/reportdesign/source/core/sdr/ModuleHelper.cxx b/reportdesign/source/core/sdr/ModuleHelper.cxx
index 9c78d9efc35d..58a286080f2d 100644
--- a/reportdesign/source/core/sdr/ModuleHelper.cxx
+++ b/reportdesign/source/core/sdr/ModuleHelper.cxx
@@ -32,13 +32,14 @@
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/instance.hxx>
#include <rtl/uri.hxx>
#include <tools/debug.hxx>
#include <svl/solar.hrc>
#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
#define ENTER_MOD_METHOD() \
- ::osl::MutexGuard aGuard(s_aMutex); \
+ ::osl::MutexGuard aGuard(theOModuleMutex::get()); \
ensureImpl()
//.........................................................................
@@ -98,7 +99,13 @@ ResMgr* OModuleImpl::getResManager()
//=========================================================================
//= OModule
//=========================================================================
-::osl::Mutex OModule::s_aMutex;
+
+namespace
+{
+ // access safety
+ struct theOModuleMutex : public rtl::Static< osl::Mutex, theOModuleMutex > {};
+}
+
sal_Int32 OModule::s_nClients = 0;
OModuleImpl* OModule::s_pImpl = NULL;
//-------------------------------------------------------------------------
@@ -111,14 +118,14 @@ ResMgr* OModule::getResManager()
//-------------------------------------------------------------------------
void OModule::registerClient()
{
- ::osl::MutexGuard aGuard(s_aMutex);
+ ::osl::MutexGuard aGuard(theOModuleMutex::get());
++s_nClients;
}
//-------------------------------------------------------------------------
void OModule::revokeClient()
{
- ::osl::MutexGuard aGuard(s_aMutex);
+ ::osl::MutexGuard aGuard(theOModuleMutex::get());
if (!--s_nClients && s_pImpl)
{
delete s_pImpl;
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index ff2929f08117..eecae51acbfd 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -89,9 +89,9 @@ class StarBASIC;
namespace
{
- const String SYLK_LF = String::CreateFromAscii("\x1b :");
- const String DOUBLE_SEMICOLON = String::CreateFromAscii(";;");
- const String DOUBLE_DOUBLEQUOTE = String::CreateFromAscii("\"\"");
+ const char SYLK_LF[] = "\x1b :";
+ const char DOUBLE_SEMICOLON[] = ";;";
+ const char DOUBLE_DOUBLEQUOTE[] = "\"\"";
}
enum SylkVersion
@@ -624,11 +624,11 @@ void lcl_UnescapeSylk( String & rString, SylkVersion eVersion )
// Older versions quoted the string and doubled embedded quotes, but not
// the semicolons, which was plain wrong.
if (eVersion >= SYLK_OOO32)
- rString.SearchAndReplaceAll( DOUBLE_SEMICOLON, ';' );
+ rString.SearchAndReplaceAll( rtl::OUString(DOUBLE_SEMICOLON), ';' );
else
- rString.SearchAndReplaceAll( DOUBLE_DOUBLEQUOTE, '"' );
+ rString.SearchAndReplaceAll( rtl::OUString(DOUBLE_DOUBLEQUOTE), '"' );
- rString.SearchAndReplaceAll( SYLK_LF, _LF );
+ rString.SearchAndReplaceAll( rtl::OUString(SYLK_LF), _LF );
}
static const sal_Unicode* lcl_ScanSylkString( const sal_Unicode* p,
@@ -1857,7 +1857,7 @@ sal_Bool ScImportExport::Doc2Sylk( SvStream& rStrm )
case CELLTYPE_EDIT:
hasstring:
pDoc->GetString( nCol, nRow, aRange.aStart.Tab(), aCellStr );
- aCellStr.SearchAndReplaceAll( _LF, SYLK_LF );
+ aCellStr.SearchAndReplaceAll( _LF, rtl::OUString(SYLK_LF) );
aBufStr.AssignAscii(RTL_CONSTASCII_STRINGPARAM( "C;X" ));
aBufStr += String::CreateFromInt32( c );
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx
index 20013b00a3bc..c0adcfe0869c 100644
--- a/sd/source/ui/dlg/TemplateScanner.cxx
+++ b/sd/source/ui/dlg/TemplateScanner.cxx
@@ -52,20 +52,20 @@ using namespace ::com::sun::star::uno;
namespace {
-const ::rtl::OUString TITLE(RTL_CONSTASCII_USTRINGPARAM ("Title"));
-const ::rtl::OUString TARGET_DIR_URL(RTL_CONSTASCII_USTRINGPARAM ("TargetDirURL"));
-const ::rtl::OUString DESCRIPTION(RTL_CONSTASCII_USTRINGPARAM ("TypeDescription"));
-const ::rtl::OUString TARGET_URL(RTL_CONSTASCII_USTRINGPARAM ("TargetURL"));
+const char TITLE[] = "Title";
+const char TARGET_DIR_URL[] = "TargetDirURL";
+const char DESCRIPTION[] = "TypeDescription";
+const char TARGET_URL[] = "TargetURL";
-const ::rtl::OUString DOCTEMPLATES(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.frame.DocumentTemplates"));
+const char DOCTEMPLATES[] = "com.sun.star.frame.DocumentTemplates";
// These strings are used to find impress templates in the tree of
// template files. Should probably be determined dynamically.
-const ::rtl::OUString IMPRESS_BIN_TEMPLATE(RTL_CONSTASCII_USTRINGPARAM ("application/vnd.stardivision.impress"));
-const ::rtl::OUString IMPRESS_XML_TEMPLATE = MIMETYPE_VND_SUN_XML_IMPRESS;
+const char IMPRESS_BIN_TEMPLATE[] = "application/vnd.stardivision.impress";
+const char IMPRESS_XML_TEMPLATE[] = MIMETYPE_VND_SUN_XML_IMPRESS_ASCII;
// The following id comes from the bugdoc in #i2764#.
-const ::rtl::OUString IMPRESS_XML_TEMPLATE_B(RTL_CONSTASCII_USTRINGPARAM ("Impress 2.0"));
-const ::rtl::OUString IMPRESS_XML_TEMPLATE_OASIS = MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION;
+const char IMPRESS_XML_TEMPLATE_B[] = "Impress 2.0";
+const char IMPRESS_XML_TEMPLATE_OASIS[] = MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII;
class FolderDescriptor
@@ -225,7 +225,7 @@ TemplateScanner::State TemplateScanner::GetTemplateRoot (void)
if (xFactory.is())
{
Reference<frame::XDocumentTemplates> xTemplates (
- xFactory->createInstance (DOCTEMPLATES), UNO_QUERY);
+ xFactory->createInstance (rtl::OUString(DOCTEMPLATES)), UNO_QUERY);
DBG_ASSERT (xTemplates.is(), "TemplateScanner::GetTemplateRoot: xTemplates is NULL");
if (xTemplates.is())
@@ -253,9 +253,9 @@ TemplateScanner::State TemplateScanner::InitializeEntryScanning (void)
// We are interested only in three properties: the entry's name,
// its URL, and its content type.
Sequence<rtl::OUString> aProps (3);
- aProps[0] = TITLE;
- aProps[1] = TARGET_URL;
- aProps[2] = DESCRIPTION;
+ aProps[0] = rtl::OUString(TITLE);
+ aProps[1] = rtl::OUString(TARGET_URL);
+ aProps[2] = rtl::OUString(DESCRIPTION);
// Create a cursor to iterate over the templates in this folders.
::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_DOCUMENTS_ONLY;
@@ -294,10 +294,10 @@ TemplateScanner::State TemplateScanner::ScanEntry (void)
// add a new entry to the resulting list (which is created
// first if necessary).
if ( (sContentType == MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE)
- || (sContentType == IMPRESS_XML_TEMPLATE_OASIS)
- || (sContentType == IMPRESS_BIN_TEMPLATE)
- || (sContentType == IMPRESS_XML_TEMPLATE)
- || (sContentType == IMPRESS_XML_TEMPLATE_B))
+ || (sContentType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(IMPRESS_XML_TEMPLATE_OASIS)))
+ || (sContentType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(IMPRESS_BIN_TEMPLATE)))
+ || (sContentType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(IMPRESS_XML_TEMPLATE)))
+ || (sContentType.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(IMPRESS_XML_TEMPLATE_B))))
{
::rtl::OUString sLocalisedTitle = SfxDocumentTemplates::ConvertResourceString(
STR_TEMPLATE_NAME1_DEF, STR_TEMPLATE_NAME1, NUM_TEMPLATE_NAMES, sTitle );
@@ -347,8 +347,8 @@ TemplateScanner::State TemplateScanner::InitializeFolderScanning (void)
// Define the list of properties we are interested in.
Sequence<rtl::OUString> aProps (2);
- aProps[0] = TITLE;
- aProps[1] = TARGET_DIR_URL;
+ aProps[0] = rtl::OUString(TITLE);
+ aProps[1] = rtl::OUString(TARGET_DIR_URL);
// Create an cursor to iterate over the template folders.
::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_ONLY;
diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx
index d6a2953fbed8..2de089665ba5 100644
--- a/sd/source/ui/tools/EventMultiplexer.cxx
+++ b/sd/source/ui/tools/EventMultiplexer.cxx
@@ -153,9 +153,6 @@ private:
::com::sun::star::drawing::framework::XConfigurationController>
mxConfigurationControllerWeak;
- static const ::rtl::OUString msCurrentPagePropertyName;
- static const ::rtl::OUString msEditModePropertyName;
-
void ReleaseListeners (void);
void ConnectToController (void);
@@ -175,10 +172,8 @@ private:
};
-const ::rtl::OUString EventMultiplexer::Implementation::msCurrentPagePropertyName (
- RTL_CONSTASCII_USTRINGPARAM("CurrentPage"));
-const ::rtl::OUString EventMultiplexer::Implementation::msEditModePropertyName (
- RTL_CONSTASCII_USTRINGPARAM("IsMasterPageMode"));
+const char aCurrentPagePropertyName[] = "CurrentPage";
+const char aEditModePropertyName[] = "IsMasterPageMode";
//===== EventMultiplexer ======================================================
@@ -441,7 +436,7 @@ void EventMultiplexer::Implementation::ConnectToController (void)
{
try
{
- xSet->addPropertyChangeListener(msCurrentPagePropertyName, this);
+ xSet->addPropertyChangeListener(rtl::OUString(aCurrentPagePropertyName), this);
}
catch (const beans::UnknownPropertyException&)
{
@@ -450,7 +445,7 @@ void EventMultiplexer::Implementation::ConnectToController (void)
try
{
- xSet->addPropertyChangeListener(msEditModePropertyName, this);
+ xSet->addPropertyChangeListener(rtl::OUString(aEditModePropertyName), this);
}
catch (const beans::UnknownPropertyException&)
{
@@ -488,7 +483,7 @@ void EventMultiplexer::Implementation::DisconnectFromController (void)
{
try
{
- xSet->removePropertyChangeListener(msCurrentPagePropertyName, this);
+ xSet->removePropertyChangeListener(rtl::OUString(aCurrentPagePropertyName), this);
}
catch (const beans::UnknownPropertyException&)
{
@@ -497,7 +492,7 @@ void EventMultiplexer::Implementation::DisconnectFromController (void)
try
{
- xSet->removePropertyChangeListener(msEditModePropertyName, this);
+ xSet->removePropertyChangeListener(rtl::OUString(aEditModePropertyName), this);
}
catch (const beans::UnknownPropertyException&)
{
@@ -560,11 +555,11 @@ void SAL_CALL EventMultiplexer::Implementation::propertyChange (
{
ThrowIfDisposed();
- if (rEvent.PropertyName.equals(msCurrentPagePropertyName))
+ if (rEvent.PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(aCurrentPagePropertyName)))
{
CallListeners(EventMultiplexerEvent::EID_CURRENT_PAGE);
}
- else if (rEvent.PropertyName.equals(msEditModePropertyName))
+ else if (rEvent.PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(aEditModePropertyName)))
{
bool bIsMasterPageMode (false);
rEvent.NewValue >>= bIsMasterPageMode;