Kaydet (Commit) e9a467ca authored tarafından Caolán McNamara's avatar Caolán McNamara

remove static objects from static_initialization_and_destruction chain

üst e6409de0
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment