rtl::Static to thread-safe-static
Change-Id: Ife02e6d2be3ebfbb08522ab0183ef4aa31a99e19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
462ebbd10b
commit
e7dbef922a
@@ -245,13 +245,15 @@ IMPL_STATIC_LINK(MissingPluginInstaller, launchUi, void *, p, void)
|
||||
}
|
||||
|
||||
|
||||
struct TheMissingPluginInstaller:
|
||||
public rtl::Static<MissingPluginInstaller, TheMissingPluginInstaller>
|
||||
{};
|
||||
MissingPluginInstaller& TheMissingPluginInstaller()
|
||||
{
|
||||
static MissingPluginInstaller theInstaller;
|
||||
return theInstaller;
|
||||
}
|
||||
|
||||
|
||||
void MissingPluginInstallerThread::execute() {
|
||||
MissingPluginInstaller & inst = TheMissingPluginInstaller::get();
|
||||
MissingPluginInstaller & inst = TheMissingPluginInstaller();
|
||||
for (;;) {
|
||||
std::vector<OString> details;
|
||||
{
|
||||
@@ -330,7 +332,7 @@ Player::~Player()
|
||||
|
||||
void SAL_CALL Player::disposing()
|
||||
{
|
||||
TheMissingPluginInstaller::get().detach(this);
|
||||
TheMissingPluginInstaller().detach(this);
|
||||
|
||||
::osl::MutexGuard aGuard(m_aMutex);
|
||||
|
||||
@@ -532,7 +534,7 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message )
|
||||
maSizeCondition.set();
|
||||
}
|
||||
} else if (gst_is_missing_plugin_message(message)) {
|
||||
TheMissingPluginInstaller::get().report(this, message);
|
||||
TheMissingPluginInstaller().report(this, message);
|
||||
if( mnWidth == 0 ) {
|
||||
// an error occurred, set condition so that OOo thread doesn't wait for us
|
||||
maSizeCondition.set();
|
||||
|
@@ -3431,7 +3431,11 @@ struct RandomNumberGenerator
|
||||
}
|
||||
};
|
||||
|
||||
class theRandomNumberGenerator : public rtl::Static<RandomNumberGenerator, theRandomNumberGenerator> {};
|
||||
RandomNumberGenerator& theRandomNumberGenerator()
|
||||
{
|
||||
static RandomNumberGenerator theGenerator;
|
||||
return theGenerator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3444,7 +3448,7 @@ void SbRtl_Randomize(StarBASIC *, SbxArray & rPar, bool)
|
||||
if (rPar.Count() == 2)
|
||||
{
|
||||
int nSeed = static_cast<int>(rPar.Get(1)->GetInteger());
|
||||
theRandomNumberGenerator::get().global_rng.seed(nSeed);
|
||||
theRandomNumberGenerator().global_rng.seed(nSeed);
|
||||
}
|
||||
// without parameter, no need to do anything - RNG is seeded at first use
|
||||
}
|
||||
@@ -3458,7 +3462,7 @@ void SbRtl_Rnd(StarBASIC *, SbxArray & rPar, bool)
|
||||
else
|
||||
{
|
||||
std::uniform_real_distribution<double> dist(0.0, 1.0);
|
||||
double const tmp(dist(theRandomNumberGenerator::get().global_rng));
|
||||
double const tmp(dist(theRandomNumberGenerator().global_rng));
|
||||
rPar.Get(0)->PutDouble(tmp);
|
||||
}
|
||||
}
|
||||
|
@@ -188,22 +188,11 @@ namespace dxcanvas
|
||||
return uno::Any();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
struct DeviceColorSpace: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>,
|
||||
DeviceColorSpace>
|
||||
{
|
||||
uno::Reference<rendering::XColorSpace> operator()()
|
||||
{
|
||||
return vcl::unotools::createStandardColorSpace();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
uno::Reference<rendering::XColorSpace> DeviceHelper::getColorSpace() const
|
||||
{
|
||||
// always the same
|
||||
return DeviceColorSpace::get();
|
||||
static uno::Reference<rendering::XColorSpace> theSpace = vcl::unotools::createStandardColorSpace();
|
||||
return theSpace;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -62,15 +62,17 @@ using namespace ::com::sun::star::uno;
|
||||
namespace dp_misc {
|
||||
namespace {
|
||||
|
||||
struct UnoRc : public rtl::StaticWithInit<
|
||||
std::shared_ptr<rtl::Bootstrap>, UnoRc> {
|
||||
std::shared_ptr<rtl::Bootstrap> operator () () {
|
||||
OUString unorc( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("louno") );
|
||||
::rtl::Bootstrap::expandMacros( unorc );
|
||||
auto ret = std::make_shared<::rtl::Bootstrap>( unorc );
|
||||
OSL_ASSERT( ret->getHandle() != nullptr );
|
||||
return ret;
|
||||
}
|
||||
std::shared_ptr<rtl::Bootstrap> & UnoRc()
|
||||
{
|
||||
static std::shared_ptr<rtl::Bootstrap> theRc = []()
|
||||
{
|
||||
OUString unorc( "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("louno") );
|
||||
::rtl::Bootstrap::expandMacros( unorc );
|
||||
auto ret = std::make_shared<::rtl::Bootstrap>( unorc );
|
||||
OSL_ASSERT( ret->getHandle() != nullptr );
|
||||
return ret;
|
||||
}();
|
||||
return theRc;
|
||||
};
|
||||
|
||||
OUString generateOfficePipeId()
|
||||
@@ -293,7 +295,7 @@ OUString makeURLAppendSysPathSegment( std::u16string_view baseURL, OUString cons
|
||||
OUString expandUnoRcTerm( OUString const & term_ )
|
||||
{
|
||||
OUString term(term_);
|
||||
UnoRc::get()->expandMacrosFrom( term );
|
||||
UnoRc()->expandMacrosFrom( term );
|
||||
return term;
|
||||
}
|
||||
|
||||
@@ -318,7 +320,7 @@ OUString expandUnoRcUrl( OUString const & url )
|
||||
rcurl = ::rtl::Uri::decode(
|
||||
rcurl, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
|
||||
// expand macro string:
|
||||
UnoRc::get()->expandMacrosFrom( rcurl );
|
||||
UnoRc()->expandMacrosFrom( rcurl );
|
||||
return rcurl;
|
||||
}
|
||||
else {
|
||||
|
@@ -32,36 +32,39 @@ namespace dp_misc
|
||||
{
|
||||
namespace
|
||||
{
|
||||
struct StrOperatingSystem :
|
||||
public rtl::StaticWithInit<OUString, StrOperatingSystem> {
|
||||
OUString operator () () {
|
||||
const OUString & StrOperatingSystem()
|
||||
{
|
||||
static const OUString theOS = []()
|
||||
{
|
||||
OUString os( "$_OS" );
|
||||
::rtl::Bootstrap::expandMacros( os );
|
||||
return os;
|
||||
}
|
||||
}();
|
||||
return theOS;
|
||||
};
|
||||
|
||||
struct StrCPU :
|
||||
public rtl::StaticWithInit<OUString, StrCPU> {
|
||||
OUString operator () () {
|
||||
const OUString & StrCPU()
|
||||
{
|
||||
static const OUString theCPU = []()
|
||||
{
|
||||
OUString arch( "$_ARCH" );
|
||||
::rtl::Bootstrap::expandMacros( arch );
|
||||
return arch;
|
||||
}
|
||||
}();
|
||||
return theCPU;
|
||||
};
|
||||
|
||||
|
||||
struct StrPlatform : public rtl::StaticWithInit<
|
||||
OUString, StrPlatform> {
|
||||
OUString operator () () {
|
||||
return StrOperatingSystem::get() + "_" + StrCPU::get();
|
||||
}
|
||||
const OUString & StrPlatform()
|
||||
{
|
||||
static const OUString thePlatform = StrOperatingSystem() + "_" + StrCPU();
|
||||
return thePlatform;
|
||||
};
|
||||
|
||||
bool checkOSandCPU(std::u16string_view os, std::u16string_view cpu)
|
||||
{
|
||||
return (os == StrOperatingSystem::get())
|
||||
&& (cpu == StrCPU::get());
|
||||
return (os == StrOperatingSystem())
|
||||
&& (cpu == StrCPU());
|
||||
}
|
||||
|
||||
bool isPlatformSupported( std::u16string_view token )
|
||||
@@ -161,7 +164,7 @@ namespace
|
||||
|
||||
OUString const & getPlatformString()
|
||||
{
|
||||
return StrPlatform::get();
|
||||
return StrPlatform();
|
||||
}
|
||||
|
||||
bool platform_fits( std::u16string_view platform_string )
|
||||
@@ -172,9 +175,9 @@ bool platform_fits( std::u16string_view platform_string )
|
||||
const std::u16string_view token(
|
||||
o3tl::trim(o3tl::getToken(platform_string, 0, ',', index )) );
|
||||
// check if this platform:
|
||||
if (o3tl::equalsIgnoreAsciiCase( token, StrPlatform::get() ) ||
|
||||
if (o3tl::equalsIgnoreAsciiCase( token, StrPlatform() ) ||
|
||||
(token.find( '_' ) == std::u16string_view::npos && /* check OS part only */
|
||||
o3tl::equalsIgnoreAsciiCase( token, StrOperatingSystem::get() )))
|
||||
o3tl::equalsIgnoreAsciiCase( token, StrOperatingSystem() )))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContex
|
||||
// the configuration for the backend would create another instance of the
|
||||
// backend, which would try and read the configuration which would...
|
||||
{
|
||||
osl::Mutex & aInitMutex = rtl::Static< osl::Mutex, LdapUserProfileBe >::get();
|
||||
static osl::Mutex aInitMutex;
|
||||
osl::MutexGuard aInitGuard(aInitMutex);
|
||||
|
||||
static bool bReentrantCall; // = false
|
||||
|
@@ -65,7 +65,11 @@ struct TSharedStorages final
|
||||
a) shared root storages
|
||||
b) shared "inbetween" storages
|
||||
of the share and user layer. */
|
||||
struct SharedStorages: public rtl::Static<TSharedStorages, SharedStorages> {};
|
||||
TSharedStorages& SharedStorages()
|
||||
{
|
||||
static TSharedStorages theStorages;
|
||||
return theStorages;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -103,7 +107,7 @@ PresetHandler::~PresetHandler()
|
||||
Otherwise we will disconnect all other open configuration access
|
||||
objects which base on these storages.
|
||||
*/
|
||||
auto & sharedStorages = SharedStorages::get();
|
||||
auto & sharedStorages = SharedStorages();
|
||||
sharedStorages.m_lStoragesShare.closePath(m_sRelPathShare);
|
||||
sharedStorages.m_lStoragesUser.closePath (m_sRelPathUser );
|
||||
|
||||
@@ -169,7 +173,7 @@ void lcl_throwCorruptedUIConfigurationException(
|
||||
|
||||
css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorageShare()
|
||||
{
|
||||
auto & sharedStorages = SharedStorages::get();
|
||||
auto & sharedStorages = SharedStorages();
|
||||
css::uno::Reference< css::embed::XStorage > xRoot = sharedStorages.m_lStoragesShare.getRootStorage();
|
||||
if (xRoot.is())
|
||||
return xRoot;
|
||||
@@ -228,7 +232,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag
|
||||
|
||||
css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorageUser()
|
||||
{
|
||||
auto & sharedStorages = SharedStorages::get();
|
||||
auto & sharedStorages = SharedStorages();
|
||||
css::uno::Reference< css::embed::XStorage > xRoot = sharedStorages.m_lStoragesUser.getRootStorage();
|
||||
if (xRoot.is())
|
||||
return xRoot;
|
||||
@@ -287,7 +291,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageShare
|
||||
xWorking = m_xWorkingStorageShare;
|
||||
}
|
||||
|
||||
return SharedStorages::get().m_lStoragesShare.getParentStorage(xWorking);
|
||||
return SharedStorages().m_lStoragesShare.getParentStorage(xWorking);
|
||||
}
|
||||
|
||||
css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageUser()
|
||||
@@ -298,7 +302,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getParentStorageUser(
|
||||
xWorking = m_xWorkingStorageUser;
|
||||
}
|
||||
|
||||
return SharedStorages::get().m_lStoragesUser.getParentStorage(xWorking);
|
||||
return SharedStorages().m_lStoragesUser.getParentStorage(xWorking);
|
||||
}
|
||||
|
||||
void PresetHandler::connectToResource( PresetHandler::EConfigType eConfigType ,
|
||||
@@ -538,7 +542,7 @@ void PresetHandler::commitUserChanges()
|
||||
case E_GLOBAL :
|
||||
case E_MODULES :
|
||||
{
|
||||
auto & sharedStorages = SharedStorages::get();
|
||||
auto & sharedStorages = SharedStorages();
|
||||
sPath = sharedStorages.m_lStoragesUser.getPathOfStorage(xWorking);
|
||||
sharedStorages.m_lStoragesUser.commitPath(sPath);
|
||||
sharedStorages.m_lStoragesUser.notifyPath(sPath);
|
||||
@@ -573,7 +577,7 @@ void PresetHandler::addStorageListener(XMLBasedAcceleratorConfiguration* pListen
|
||||
case E_GLOBAL :
|
||||
case E_MODULES :
|
||||
{
|
||||
SharedStorages::get().m_lStoragesUser.addStorageListener(pListener, sRelPath);
|
||||
SharedStorages().m_lStoragesUser.addStorageListener(pListener, sRelPath);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -603,7 +607,7 @@ void PresetHandler::removeStorageListener(XMLBasedAcceleratorConfiguration* pLis
|
||||
case E_GLOBAL :
|
||||
case E_MODULES :
|
||||
{
|
||||
SharedStorages::get().m_lStoragesUser.removeStorageListener(pListener, sRelPath);
|
||||
SharedStorages().m_lStoragesUser.removeStorageListener(pListener, sRelPath);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -623,9 +627,9 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
|
||||
try
|
||||
{
|
||||
if (bShare)
|
||||
xPath = SharedStorages::get().m_lStoragesShare.openPath(sPath, eMode);
|
||||
xPath = SharedStorages().m_lStoragesShare.openPath(sPath, eMode);
|
||||
else
|
||||
xPath = SharedStorages::get().m_lStoragesUser.openPath(sPath, eMode);
|
||||
xPath = SharedStorages().m_lStoragesUser.openPath(sPath, eMode);
|
||||
}
|
||||
catch(const css::uno::RuntimeException&)
|
||||
{ throw; }
|
||||
|
@@ -159,7 +159,11 @@ PresetColorsPool::PresetColorsPool() :
|
||||
maHighlightColors[static_cast<size_t>(nEntry.first)] = nEntry.second;
|
||||
}
|
||||
|
||||
struct StaticPresetColorsPool : public ::rtl::Static< PresetColorsPool, StaticPresetColorsPool > {};
|
||||
PresetColorsPool& StaticPresetColorsPool()
|
||||
{
|
||||
static PresetColorsPool thePool;
|
||||
return thePool;
|
||||
}
|
||||
|
||||
const double DEC_GAMMA = 2.3;
|
||||
const double INC_GAMMA = 1.0 / DEC_GAMMA;
|
||||
@@ -264,7 +268,7 @@ Color::Color() :
|
||||
/* Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
|
||||
able to catch the existing vector entries without corresponding XML
|
||||
token identifier. */
|
||||
::Color nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maDmlColors, nToken, API_RGB_TRANSPARENT );
|
||||
::Color nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool().maDmlColors, nToken, API_RGB_TRANSPARENT );
|
||||
return (sal_Int32(nRgbValue) >= 0) ? nRgbValue : nDefaultRgb;
|
||||
}
|
||||
|
||||
@@ -273,7 +277,7 @@ Color::Color() :
|
||||
/* Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
|
||||
able to catch the existing vector entries without corresponding XML
|
||||
token identifier. */
|
||||
::Color nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maVmlColors, nToken, API_RGB_TRANSPARENT );
|
||||
::Color nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool().maVmlColors, nToken, API_RGB_TRANSPARENT );
|
||||
return (sal_Int32(nRgbValue) >= 0) ? nRgbValue : nDefaultRgb;
|
||||
}
|
||||
|
||||
@@ -282,7 +286,7 @@ Color::Color() :
|
||||
/* Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
|
||||
able to catch the existing vector entries without corresponding XML
|
||||
token identifier. */
|
||||
::Color nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maHighlightColors, nToken, API_RGB_TRANSPARENT );
|
||||
::Color nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool().maHighlightColors, nToken, API_RGB_TRANSPARENT );
|
||||
return (sal_Int32(nRgbValue) >= 0) ? nRgbValue : nDefaultRgb;
|
||||
}
|
||||
|
||||
|
@@ -30,9 +30,10 @@
|
||||
|
||||
namespace {
|
||||
|
||||
struct StaticDebugBaseAddressFilter
|
||||
: rtl::StaticWithInit<std::vector<OString>, StaticDebugBaseAddressFilter> {
|
||||
std::vector<OString> operator()() const {
|
||||
const std::vector<OString>& StaticDebugBaseAddressFilter()
|
||||
{
|
||||
static const std::vector<OString> theFilter = []()
|
||||
{
|
||||
std::vector<OString> vec;
|
||||
rtl_uString * pStr = nullptr;
|
||||
OUString const name(
|
||||
@@ -49,7 +50,8 @@ struct StaticDebugBaseAddressFilter
|
||||
while (nIndex >= 0);
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
}();
|
||||
return theFilter;
|
||||
};
|
||||
|
||||
bool isSubStr( char const* pStr, OString const& subStr )
|
||||
@@ -81,7 +83,7 @@ osl::Mutex & SAL_CALL osl_detail_ObjectRegistry_getMutex()
|
||||
bool SAL_CALL osl_detail_ObjectRegistry_storeAddresses( char const* pName )
|
||||
SAL_THROW_EXTERN_C()
|
||||
{
|
||||
std::vector<OString> const& rVec = StaticDebugBaseAddressFilter::get();
|
||||
std::vector<OString> const& rVec = StaticDebugBaseAddressFilter();
|
||||
if (rVec.empty())
|
||||
return false;
|
||||
// check for "all":
|
||||
|
@@ -67,12 +67,10 @@ public:
|
||||
|
||||
namespace
|
||||
{
|
||||
//thread-safe double-locked class to ensure createNonDocMSPs is called once
|
||||
class theNonDocMSPCreator : public rtl::StaticWithArg<NonDocMSPCreator, ActiveMSPList*, theNonDocMSPCreator> {};
|
||||
|
||||
//thread-safe method to ensure createNonDocMSPs is called once
|
||||
void ensureNonDocMSPs(ActiveMSPList *pList)
|
||||
{
|
||||
theNonDocMSPCreator::get(pList);
|
||||
static NonDocMSPCreator theCreator(pList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -788,18 +788,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct OGLColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, OGLColorSpaceHolder>
|
||||
{
|
||||
uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
|
||||
{
|
||||
return new OGLColorSpace();
|
||||
}
|
||||
};
|
||||
|
||||
uno::Reference<rendering::XIntegerBitmapColorSpace> const &
|
||||
getOGLColorSpace()
|
||||
{
|
||||
return OGLColorSpaceHolder::get();
|
||||
static uno::Reference<rendering::XIntegerBitmapColorSpace> theSpace = new OGLColorSpace();
|
||||
return theSpace;
|
||||
}
|
||||
|
||||
void buildMipmaps(
|
||||
|
@@ -72,15 +72,13 @@ namespace
|
||||
|
||||
SmCmdBoxWrapper::RegisterChildWindow(true);
|
||||
}
|
||||
|
||||
struct theSmDLLInstance : public rtl::Static<SmDLL, theSmDLLInstance> {};
|
||||
}
|
||||
|
||||
namespace SmGlobals
|
||||
{
|
||||
void ensure()
|
||||
{
|
||||
theSmDLLInstance::get();
|
||||
static SmDLL theDll;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -338,13 +338,17 @@ namespace {
|
||||
// global
|
||||
std::weak_ptr<SvtCTLOptions_Impl> g_pCTLOptions;
|
||||
|
||||
struct CTLMutex : public rtl::Static< osl::Mutex, CTLMutex > {};
|
||||
osl::Mutex& CTLMutex()
|
||||
{
|
||||
static osl::Mutex aMutex;
|
||||
return aMutex;
|
||||
}
|
||||
}
|
||||
|
||||
SvtCTLOptions::SvtCTLOptions( bool bDontLoad )
|
||||
{
|
||||
// Global access, must be guarded (multithreading)
|
||||
::osl::MutexGuard aGuard( CTLMutex::get() );
|
||||
::osl::MutexGuard aGuard( CTLMutex() );
|
||||
|
||||
m_pImpl = g_pCTLOptions.lock();
|
||||
if ( !m_pImpl )
|
||||
@@ -364,7 +368,7 @@ SvtCTLOptions::SvtCTLOptions( bool bDontLoad )
|
||||
SvtCTLOptions::~SvtCTLOptions()
|
||||
{
|
||||
// Global access, must be guarded (multithreading)
|
||||
::osl::MutexGuard aGuard( CTLMutex::get() );
|
||||
::osl::MutexGuard aGuard( CTLMutex() );
|
||||
|
||||
m_pImpl->RemoveListener(this);
|
||||
m_pImpl.reset();
|
||||
|
@@ -84,7 +84,11 @@ public:
|
||||
void AddEntry( const OUString& rString, const LanguageType eType);
|
||||
};
|
||||
|
||||
struct theLanguageTable : public rtl::Static< SvtLanguageTableImpl, theLanguageTable > {};
|
||||
SvtLanguageTableImpl& theLanguageTable()
|
||||
{
|
||||
static SvtLanguageTableImpl aTable;
|
||||
return aTable;
|
||||
}
|
||||
}
|
||||
|
||||
OUString ApplyLreOrRleEmbedding( const OUString &rText )
|
||||
@@ -224,7 +228,7 @@ bool SvtLanguageTableImpl::HasType( const LanguageType eType ) const
|
||||
|
||||
bool SvtLanguageTable::HasLanguageType( const LanguageType eType )
|
||||
{
|
||||
return theLanguageTable::get().HasType( eType );
|
||||
return theLanguageTable().HasType( eType );
|
||||
}
|
||||
|
||||
OUString SvtLanguageTableImpl::GetString( const LanguageType eType ) const
|
||||
@@ -251,7 +255,7 @@ OUString SvtLanguageTableImpl::GetString( const LanguageType eType ) const
|
||||
|
||||
OUString SvtLanguageTable::GetLanguageString( const LanguageType eType )
|
||||
{
|
||||
return theLanguageTable::get().GetString( eType );
|
||||
return theLanguageTable().GetString( eType );
|
||||
}
|
||||
|
||||
LanguageType SvtLanguageTableImpl::GetType( std::u16string_view rStr ) const
|
||||
@@ -272,7 +276,7 @@ LanguageType SvtLanguageTableImpl::GetType( std::u16string_view rStr ) const
|
||||
|
||||
LanguageType SvtLanguageTable::GetLanguageType( std::u16string_view rStr )
|
||||
{
|
||||
return theLanguageTable::get().GetType( rStr );
|
||||
return theLanguageTable().GetType( rStr );
|
||||
}
|
||||
|
||||
sal_uInt32 SvtLanguageTableImpl::GetEntryCount() const
|
||||
@@ -282,7 +286,7 @@ sal_uInt32 SvtLanguageTableImpl::GetEntryCount() const
|
||||
|
||||
sal_uInt32 SvtLanguageTable::GetLanguageEntryCount()
|
||||
{
|
||||
return theLanguageTable::get().GetEntryCount();
|
||||
return theLanguageTable().GetEntryCount();
|
||||
}
|
||||
|
||||
|
||||
@@ -296,7 +300,7 @@ LanguageType SvtLanguageTableImpl::GetTypeAtIndex( sal_uInt32 nIndex ) const
|
||||
|
||||
LanguageType SvtLanguageTable::GetLanguageTypeAtIndex( sal_uInt32 nIndex )
|
||||
{
|
||||
return theLanguageTable::get().GetTypeAtIndex( nIndex);
|
||||
return theLanguageTable().GetTypeAtIndex( nIndex);
|
||||
}
|
||||
|
||||
void SvtLanguageTableImpl::AddEntry( const OUString& rString, const LanguageType eType )
|
||||
@@ -337,7 +341,7 @@ void SvtLanguageTableImpl::AddEntry( const OUString& rString, const LanguageType
|
||||
|
||||
void SvtLanguageTable::AddLanguageTag( const LanguageTag& rLanguageTag )
|
||||
{
|
||||
theLanguageTable::get().AddEntry( lcl_getDescription(rLanguageTag), rLanguageTag.getLanguageType());
|
||||
theLanguageTable().AddEntry( lcl_getDescription(rLanguageTag), rLanguageTag.getLanguageType());
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -59,7 +59,11 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
struct theSwDLLInstance : public rtl::Static<SwDLLInstance, theSwDLLInstance> {};
|
||||
SwDLLInstance& theSwDLLInstance()
|
||||
{
|
||||
static SwDLLInstance aInstance;
|
||||
return aInstance;
|
||||
}
|
||||
}
|
||||
|
||||
namespace SwGlobals
|
||||
@@ -67,12 +71,12 @@ namespace SwGlobals
|
||||
void ensure()
|
||||
{
|
||||
// coverity[side_effect_free : FALSE] - not actually side-effect-free
|
||||
theSwDLLInstance::get();
|
||||
theSwDLLInstance();
|
||||
}
|
||||
|
||||
sw::Filters & getFilters()
|
||||
{
|
||||
return theSwDLLInstance::get()->getFilters();
|
||||
return theSwDLLInstance()->getFilters();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -343,14 +343,10 @@ std::vector< SvtCompatibilityEntry > SvtCompatibilityOptions::GetList() const
|
||||
return m_pImpl->GetOptions();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class theCompatibilityOptionsMutex : public rtl::Static<osl::Mutex, theCompatibilityOptionsMutex>{};
|
||||
}
|
||||
|
||||
Mutex& SvtCompatibilityOptions::GetOwnStaticMutex()
|
||||
{
|
||||
return theCompatibilityOptionsMutex::get();
|
||||
static osl::Mutex aMutex;
|
||||
return aMutex;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -613,17 +613,10 @@ void SvtFilterOptions::SetVisio2Draw(bool bFlag)
|
||||
SetModified();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class theFilterOptions
|
||||
: public rtl::Static<SvtFilterOptions, theFilterOptions>
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
SvtFilterOptions& SvtFilterOptions::Get()
|
||||
{
|
||||
return theFilterOptions::get();
|
||||
static SvtFilterOptions aOptions;
|
||||
return aOptions;
|
||||
}
|
||||
|
||||
bool SvtFilterOptions::IsEnablePPTPreview() const
|
||||
|
@@ -385,20 +385,13 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
struct PaletteColorSpaceHolder: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>,
|
||||
PaletteColorSpaceHolder>
|
||||
{
|
||||
uno::Reference<rendering::XColorSpace> operator()()
|
||||
{
|
||||
return vcl::unotools::createStandardColorSpace();
|
||||
}
|
||||
};
|
||||
|
||||
virtual uno::Reference< rendering::XColorSpace > SAL_CALL getColorSpace( ) override
|
||||
{
|
||||
// this is the method from XBitmapPalette. Return palette color
|
||||
// space here
|
||||
return PaletteColorSpaceHolder::get();
|
||||
static uno::Reference<rendering::XColorSpace> aColorSpace =
|
||||
vcl::unotools::createStandardColorSpace();
|
||||
return aColorSpace;
|
||||
}
|
||||
|
||||
// XIntegerBitmapColorSpace
|
||||
|
@@ -70,73 +70,73 @@ void XMLPropStyleContext::SetAttribute( sal_Int32 nElement,
|
||||
|
||||
namespace
|
||||
{
|
||||
struct theStandardSet :
|
||||
public rtl::StaticWithInit<OldFillStyleDefinitionSet, theStandardSet>
|
||||
const OldFillStyleDefinitionSet & theStandardSet()
|
||||
{
|
||||
OldFillStyleDefinitionSet operator () ()
|
||||
{
|
||||
OldFillStyleDefinitionSet aSet;
|
||||
aSet.insert("BackColorRGB");
|
||||
aSet.insert("BackTransparent");
|
||||
aSet.insert("BackColorTransparency");
|
||||
aSet.insert("BackGraphic");
|
||||
aSet.insert("BackGraphicFilter");
|
||||
aSet.insert("BackGraphicLocation");
|
||||
aSet.insert("BackGraphicTransparency");
|
||||
return aSet;
|
||||
}
|
||||
static const OldFillStyleDefinitionSet theSet = []()
|
||||
{
|
||||
OldFillStyleDefinitionSet aSet;
|
||||
aSet.insert("BackColorRGB");
|
||||
aSet.insert("BackTransparent");
|
||||
aSet.insert("BackColorTransparency");
|
||||
aSet.insert("BackGraphic");
|
||||
aSet.insert("BackGraphicFilter");
|
||||
aSet.insert("BackGraphicLocation");
|
||||
aSet.insert("BackGraphicTransparency");
|
||||
return aSet;
|
||||
}();
|
||||
return theSet;
|
||||
};
|
||||
struct theHeaderSet :
|
||||
public rtl::StaticWithInit<OldFillStyleDefinitionSet, theHeaderSet>
|
||||
const OldFillStyleDefinitionSet & theHeaderSet()
|
||||
{
|
||||
OldFillStyleDefinitionSet operator () ()
|
||||
{
|
||||
OldFillStyleDefinitionSet aSet;
|
||||
aSet.insert("HeaderBackColorRGB");
|
||||
aSet.insert("HeaderBackTransparent");
|
||||
aSet.insert("HeaderBackColorTransparency");
|
||||
aSet.insert("HeaderBackGraphic");
|
||||
aSet.insert("HeaderBackGraphicFilter");
|
||||
aSet.insert("HeaderBackGraphicLocation");
|
||||
aSet.insert("HeaderBackGraphicTransparency");
|
||||
return aSet;
|
||||
}
|
||||
static const OldFillStyleDefinitionSet theSet = []()
|
||||
{
|
||||
OldFillStyleDefinitionSet aSet;
|
||||
aSet.insert("HeaderBackColorRGB");
|
||||
aSet.insert("HeaderBackTransparent");
|
||||
aSet.insert("HeaderBackColorTransparency");
|
||||
aSet.insert("HeaderBackGraphic");
|
||||
aSet.insert("HeaderBackGraphicFilter");
|
||||
aSet.insert("HeaderBackGraphicLocation");
|
||||
aSet.insert("HeaderBackGraphicTransparency");
|
||||
return aSet;
|
||||
}();
|
||||
return theSet;
|
||||
};
|
||||
struct theFooterSet :
|
||||
public rtl::StaticWithInit<OldFillStyleDefinitionSet, theFooterSet>
|
||||
const OldFillStyleDefinitionSet & theFooterSet()
|
||||
{
|
||||
OldFillStyleDefinitionSet operator () ()
|
||||
{
|
||||
OldFillStyleDefinitionSet aSet;
|
||||
aSet.insert("FooterBackColorRGB");
|
||||
aSet.insert("FooterBackTransparent");
|
||||
aSet.insert("FooterBackColorTransparency");
|
||||
aSet.insert("FooterBackGraphic");
|
||||
aSet.insert("FooterBackGraphicFilter");
|
||||
aSet.insert("FooterBackGraphicLocation");
|
||||
aSet.insert("FooterBackGraphicTransparency");
|
||||
return aSet;
|
||||
}
|
||||
static const OldFillStyleDefinitionSet theSet = []()
|
||||
{
|
||||
OldFillStyleDefinitionSet aSet;
|
||||
aSet.insert("FooterBackColorRGB");
|
||||
aSet.insert("FooterBackTransparent");
|
||||
aSet.insert("FooterBackColorTransparency");
|
||||
aSet.insert("FooterBackGraphic");
|
||||
aSet.insert("FooterBackGraphicFilter");
|
||||
aSet.insert("FooterBackGraphicLocation");
|
||||
aSet.insert("FooterBackGraphicTransparency");
|
||||
return aSet;
|
||||
}();
|
||||
return theSet;
|
||||
};
|
||||
struct theParaSet :
|
||||
public rtl::StaticWithInit<OldFillStyleDefinitionSet, theParaSet>
|
||||
const OldFillStyleDefinitionSet & theParaSet()
|
||||
{
|
||||
OldFillStyleDefinitionSet operator () ()
|
||||
{
|
||||
OldFillStyleDefinitionSet aSet;
|
||||
// Caution: here it is *not* 'ParaBackColorRGB' as it should be, but indeed
|
||||
// 'ParaBackColor' is used, see aXMLParaPropMap definition (line 313)
|
||||
aSet.insert("ParaBackColor");
|
||||
aSet.insert("ParaBackTransparent");
|
||||
aSet.insert("ParaBackGraphicLocation");
|
||||
aSet.insert("ParaBackGraphicFilter");
|
||||
aSet.insert("ParaBackGraphic");
|
||||
static const OldFillStyleDefinitionSet theSet = []()
|
||||
{
|
||||
OldFillStyleDefinitionSet aSet;
|
||||
// Caution: here it is *not* 'ParaBackColorRGB' as it should be, but indeed
|
||||
// 'ParaBackColor' is used, see aXMLParaPropMap definition (line 313)
|
||||
aSet.insert("ParaBackColor");
|
||||
aSet.insert("ParaBackTransparent");
|
||||
aSet.insert("ParaBackGraphicLocation");
|
||||
aSet.insert("ParaBackGraphicFilter");
|
||||
aSet.insert("ParaBackGraphic");
|
||||
|
||||
// These are not used in aXMLParaPropMap definition, thus not needed here
|
||||
// aSet.insert("ParaBackColorTransparency");
|
||||
// aSet.insert("ParaBackGraphicTransparency");
|
||||
return aSet;
|
||||
}
|
||||
// These are not used in aXMLParaPropMap definition, thus not needed here
|
||||
// aSet.insert("ParaBackColorTransparency");
|
||||
// aSet.insert("ParaBackGraphicTransparency");
|
||||
return aSet;
|
||||
}();
|
||||
return theSet;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -159,17 +159,17 @@ XMLPropStyleContext::~XMLPropStyleContext()
|
||||
|
||||
const OldFillStyleDefinitionSet& XMLPropStyleContext::getStandardSet()
|
||||
{
|
||||
return theStandardSet::get();
|
||||
return theStandardSet();
|
||||
}
|
||||
|
||||
const OldFillStyleDefinitionSet& XMLPropStyleContext::getHeaderSet()
|
||||
{
|
||||
return theHeaderSet::get();
|
||||
return theHeaderSet();
|
||||
}
|
||||
|
||||
const OldFillStyleDefinitionSet& XMLPropStyleContext::getFooterSet()
|
||||
{
|
||||
return theFooterSet::get();
|
||||
return theFooterSet();
|
||||
}
|
||||
|
||||
css::uno::Reference< css::xml::sax::XFastContextHandler > XMLPropStyleContext::createFastChildContext(
|
||||
@@ -272,7 +272,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
|
||||
|
||||
if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle))
|
||||
{
|
||||
deactivateOldFillStyleDefinitions(theParaSet::get());
|
||||
deactivateOldFillStyleDefinitions(theParaSet());
|
||||
bDrawingLayerFillStylesUsed = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user