summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-29 14:43:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-29 17:37:31 +0200
commit52b8697a1f6af99061984140ecbca36808ae4a55 (patch)
tree423905bd18653ec3301ffb06833caa0af40ffddd
parent962b6307da5d1248481bf9efa534a7bbd37f3a41 (diff)
rtl::Static -> static local
Change-Id: Ib8d9a24659a37e6b94237d98f030cd2be00bcb39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119665 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svl/zforlist.hxx3
-rw-r--r--sfx2/source/appl/workwin.cxx9
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx14
-rw-r--r--sfx2/source/dialog/dockwin.cxx6
-rw-r--r--sot/source/base/exchange.cxx7
-rw-r--r--svl/source/misc/urihelper.cxx6
-rw-r--r--svl/source/numbers/zforlist.cxx10
-rw-r--r--svx/source/accessibility/lookupcolorname.cxx10
-rw-r--r--svx/source/sidebar/nbdtmg.cxx27
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx10
-rw-r--r--svx/source/unodraw/unoprov.cxx12
-rw-r--r--sw/source/core/doc/number.cxx9
-rw-r--r--sw/source/core/docnode/retrievedinputstreamdata.cxx11
-rw-r--r--sw/source/core/docnode/swthreadmanager.cxx9
14 files changed, 37 insertions, 106 deletions
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index b929e6255277..f6227f0cd6bc 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -33,7 +33,6 @@
#include <map>
#include <memory>
-#include <set>
namespace com::sun::star::i18n { class XNumberFormatCode; }
namespace com::sun::star::i18n { struct Currency; }
@@ -297,8 +296,6 @@ typedef std::map<sal_uInt16, sal_uInt32> SvNumberFormatterIndexTable;
typedef ::std::map< sal_uInt32, sal_uInt32> SvNumberFormatterMergeMap;
-typedef ::std::set< LanguageType > NfInstalledLocales;
-
/** Language/country dependent currency entries
*/
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index d647526d6141..387c6d9aeeac 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -326,17 +326,12 @@ namespace
return OUString();
}
};
-
- class theFilledToolBarResIdToResourceURLMap
- : public rtl::Static<FilledToolBarResIdToResourceURLMap,
- theFilledToolBarResIdToResourceURLMap>
- {
- };
}
static OUString GetResourceURLFromToolbarId(ToolbarId eId)
{
- return theFilledToolBarResIdToResourceURLMap::get().findURL(eId);
+ static FilledToolBarResIdToResourceURLMap theFilledToolBarResIdToResourceURLMap;
+ return theFilledToolBarResIdToResourceURLMap.findURL(eId);
}
static sal_uInt16 TbxMatch( sal_uInt16 nPos )
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 83b25b015e4d..00a9b3d517e6 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -75,17 +75,6 @@ using namespace com::sun::star;
namespace
{
class theSfxFilterListener : public rtl::Static<SfxFilterListener, theSfxFilterListener> {};
- class SfxFilterArray
- {
- SfxFilterList_Impl aList;
- public:
-
- SfxFilterList_Impl& getList()
- {
- return aList;
- }
- };
- class theSfxFilterArray : public rtl::Static<SfxFilterArray, theSfxFilterArray > {};
}
static SfxFilterList_Impl* pFilterArr = nullptr;
@@ -93,7 +82,8 @@ static bool bFirstRead = true;
static void CreateFilterArr()
{
- pFilterArr = &theSfxFilterArray::get().getList();
+ static SfxFilterList_Impl theSfxFilterArray;
+ pFilterArr = &theSfxFilterArray;
theSfxFilterListener::get();
}
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index e2e39bed93ca..48e57efaacc4 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -27,7 +27,6 @@
#include <vcl/idle.hxx>
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
-#include <rtl/instance.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/debug.hxx>
#include <comphelper/processfactory.hxx>
@@ -288,11 +287,6 @@ void SfxTitleDockingWindow::Resizing( Size &rSize )
m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
}
-namespace
-{
- struct ChildrenRegisteredMap : public rtl::Static< bool, ChildrenRegisteredMap > {};
-}
-
static bool lcl_checkDockingWindowID( sal_uInt16 nID )
{
return nID >= SID_DOCKWIN_START && nID < o3tl::make_unsigned(SID_DOCKWIN_START+NUM_OF_DOCKINGWINDOWS);
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 091dd7a10e13..dde5a31cd8fa 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -212,15 +212,14 @@ struct DataFlavorRepresentation
: public rtl::StaticAggregate<
const DataFlavorRepresentation, ImplFormatArray_Impl > {};
-
typedef std::vector<css::datatransfer::DataFlavor> tDataFlavorList;
-
- struct ImplData : public rtl::Static<tDataFlavorList, ImplData> {};
}
static tDataFlavorList& InitFormats_Impl()
{
- return ImplData::get();
+ static tDataFlavorList gImplData;
+
+ return gImplData;
}
/*************************************************************************
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index f5ac858474c2..c945c1f2e3e5 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -107,16 +107,16 @@ OUString URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
return aAbsURIRef.GetMainURL(eDecodeMechanism, eCharset);
}
-namespace { struct MaybeFileHdl : public rtl::Static< Link<OUString *, bool>, MaybeFileHdl > {}; }
+namespace { Link<OUString *, bool> gMaybeFileHdl; }
void URIHelper::SetMaybeFileHdl(Link<OUString *, bool> const & rTheMaybeFileHdl)
{
- MaybeFileHdl::get() = rTheMaybeFileHdl;
+ gMaybeFileHdl = rTheMaybeFileHdl;
}
Link<OUString *, bool> const & URIHelper::GetMaybeFileHdl()
{
- return MaybeFileHdl::get();
+ return gMaybeFileHdl;
}
namespace {
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index f61dd50e901a..0d7c2d36eba1 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -55,6 +55,7 @@
#include <math.h>
#include <limits>
#include <memory>
+#include <set>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -253,8 +254,7 @@ namespace
public rtl::Static< NfCurrencyTable, theLegacyOnlyCurrencyTable > {};
/** THE set of installed locales. */
- struct theInstalledLocales :
- public rtl::Static< NfInstalledLocales, theInstalledLocales> {};
+ std::set< LanguageType > theInstalledLocales;
}
sal_uInt16 SvNumberFormatter::nSystemCurrencyPosition = 0;
@@ -4054,8 +4054,7 @@ bool SvNumberFormatter::IsLocaleInstalled( LanguageType eLang )
// created, make sure that exists, which usually is the case unless a
// SvNumberFormatter was never instantiated.
GetTheCurrencyTable();
- const NfInstalledLocales &rInstalledLocales = theInstalledLocales::get();
- return rInstalledLocales.find( eLang) != rInstalledLocales.end();
+ return theInstalledLocales.find( eLang) != theInstalledLocales.end();
}
// static
@@ -4095,12 +4094,11 @@ void SvNumberFormatter::ImpInitCurrencyTable()
SAL_INFO( "svl.numbers", "number of locales: \"" << nLocaleCount << "\"" );
NfCurrencyTable &rCurrencyTable = theCurrencyTable::get();
NfCurrencyTable &rLegacyOnlyCurrencyTable = theLegacyOnlyCurrencyTable::get();
- NfInstalledLocales &rInstalledLocales = theInstalledLocales::get();
sal_uInt16 nLegacyOnlyCurrencyPos = 0;
for ( css::lang::Locale const & rLocale : xLoc )
{
LanguageType eLang = LanguageTag::convertToLanguageType( rLocale, false);
- rInstalledLocales.insert( eLang);
+ theInstalledLocales.insert( eLang);
pLocaleData.emplace(
::comphelper::getProcessComponentContext(),
LanguageTag(rLocale) );
diff --git a/svx/source/accessibility/lookupcolorname.cxx b/svx/source/accessibility/lookupcolorname.cxx
index 520843c26caa..373dae4693fa 100644
--- a/svx/source/accessibility/lookupcolorname.cxx
+++ b/svx/source/accessibility/lookupcolorname.cxx
@@ -107,15 +107,15 @@ OUString ColorNameMap::lookUp(tools::Long color) const
// Did not find the given color; return its RGB tuple representation:
return "#" + OUString::number(color, 16);
}
-
-struct theColorNameMap : public rtl::Static<ColorNameMap, theColorNameMap>
-{
-};
}
namespace accessibility
{
-OUString lookUpColorName(tools::Long color) { return theColorNameMap::get().lookUp(color); }
+OUString lookUpColorName(tools::Long color)
+{
+ static ColorNameMap theColorNameMap;
+ return theColorNameMap.lookUp(color);
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 3c744fbf97b4..fbbc3b3da03a 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -248,15 +248,10 @@ BulletsTypeMgr::BulletsTypeMgr()
Init();
}
-namespace {
-
-class theBulletsTypeMgr : public rtl::Static<BulletsTypeMgr, theBulletsTypeMgr> {};
-
-}
-
BulletsTypeMgr& BulletsTypeMgr::GetInstance()
{
- return theBulletsTypeMgr::get();
+ static BulletsTypeMgr theBulletsTypeMgr;
+ return theBulletsTypeMgr;
}
void BulletsTypeMgr::Init()
@@ -397,15 +392,10 @@ static const char* RID_SVXSTR_SINGLENUM_DESCRIPTIONS[] =
RID_SVXSTR_SINGLENUM_DESCRIPTION_7
};
-namespace {
-
-class theNumberingTypeMgr : public rtl::Static<NumberingTypeMgr, theNumberingTypeMgr> {};
-
-}
-
NumberingTypeMgr& NumberingTypeMgr::GetInstance()
{
- return theNumberingTypeMgr::get();
+ static NumberingTypeMgr theNumberingTypeMgr;
+ return theNumberingTypeMgr;
}
void NumberingTypeMgr::Init()
@@ -572,15 +562,10 @@ OutlineTypeMgr::OutlineTypeMgr()
ImplLoad(u"standard.syc");
}
-namespace {
-
-class theOutlineTypeMgr : public rtl::Static<OutlineTypeMgr, theOutlineTypeMgr> {};
-
-}
-
OutlineTypeMgr& OutlineTypeMgr::GetInstance()
{
- return theOutlineTypeMgr::get();
+ static OutlineTypeMgr theOutlineTypeMgr;
+ return theOutlineTypeMgr;
}
void OutlineTypeMgr::Init()
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index eebb536d6c1b..ecaaab2cd5d1 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -55,7 +55,6 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/svapp.hxx>
-#include <rtl/instance.hxx>
#include <svx/labelitemwindow.hxx>
#include <svx/srchdlg.hxx>
#include <vcl/event.hxx>
@@ -437,15 +436,10 @@ SearchToolbarControllersManager::SearchToolbarControllersManager()
{
}
-class theSearchToolbarControllersManager
- : public rtl::Static<SearchToolbarControllersManager,
- theSearchToolbarControllersManager>
-{
-};
-
SearchToolbarControllersManager& SearchToolbarControllersManager::createControllersManager()
{
- return theSearchToolbarControllersManager::get();
+ static SearchToolbarControllersManager theSearchToolbarControllersManager;
+ return theSearchToolbarControllersManager;
}
void SearchToolbarControllersManager::saveSearchHistory(const FindTextFieldControl* pFindTextFieldControl)
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index e90d980ebd89..9cc61bcea7ae 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -877,18 +877,10 @@ sal_uInt32 UHashMap::getId( const OUString& rCompareString )
return it->second;
}
-namespace {
-
-struct theSvxMapProvider :
- public rtl::Static<SvxUnoPropertyMapProvider, theSvxMapProvider>
-{
-};
-
-}
-
SvxUnoPropertyMapProvider& getSvxMapProvider()
{
- return theSvxMapProvider::get();
+ static SvxUnoPropertyMapProvider theSvxMapProvider;
+ return theSvxMapProvider;
}
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index b98b376348f4..674a242e48c0 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -1185,13 +1185,12 @@ namespace numfunc
std::unique_ptr<vcl::Font> mpFont;
};
- class theSwDefBulletConfig
- : public rtl::Static<SwDefBulletConfig, theSwDefBulletConfig>{};
}
SwDefBulletConfig& SwDefBulletConfig::getInstance()
{
- return theSwDefBulletConfig::get();
+ static SwDefBulletConfig theSwDefBulletConfig;
+ return theSwDefBulletConfig;
}
SwDefBulletConfig::SwDefBulletConfig()
@@ -1384,12 +1383,12 @@ namespace numfunc
bool mbChangeIndentOnTabAtFirstPosOfFirstListItem;
};
- class theSwNumberingUIBehaviorConfig : public rtl::Static<SwNumberingUIBehaviorConfig, theSwNumberingUIBehaviorConfig>{};
}
SwNumberingUIBehaviorConfig& SwNumberingUIBehaviorConfig::getInstance()
{
- return theSwNumberingUIBehaviorConfig::get();
+ static SwNumberingUIBehaviorConfig theSwNumberingUIBehaviorConfig;
+ return theSwNumberingUIBehaviorConfig;
}
SwNumberingUIBehaviorConfig::SwNumberingUIBehaviorConfig()
diff --git a/sw/source/core/docnode/retrievedinputstreamdata.cxx b/sw/source/core/docnode/retrievedinputstreamdata.cxx
index 4f81fd02f975..5612096c1fc4 100644
--- a/sw/source/core/docnode/retrievedinputstreamdata.cxx
+++ b/sw/source/core/docnode/retrievedinputstreamdata.cxx
@@ -25,17 +25,10 @@
SwRetrievedInputStreamDataManager::tDataKey SwRetrievedInputStreamDataManager::snNextKeyValue = 1;
-namespace
-{
- class theSwRetrievedInputStreamDataManager :
- public rtl::Static< SwRetrievedInputStreamDataManager, theSwRetrievedInputStreamDataManager>
- {
- };
-}
-
SwRetrievedInputStreamDataManager& SwRetrievedInputStreamDataManager::GetManager()
{
- return theSwRetrievedInputStreamDataManager::get();
+ static SwRetrievedInputStreamDataManager theSwRetrievedInputStreamDataManager;
+ return theSwRetrievedInputStreamDataManager;
}
SwRetrievedInputStreamDataManager::tDataKey SwRetrievedInputStreamDataManager::ReserveData(
diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx
index 0409e5a96200..3c81ff57016c 100644
--- a/sw/source/core/docnode/swthreadmanager.cxx
+++ b/sw/source/core/docnode/swthreadmanager.cxx
@@ -39,15 +39,10 @@ SwThreadManager::~SwThreadManager()
{
}
-namespace {
-
-struct InitInstance : public rtl::Static<SwThreadManager, InitInstance> {};
-
-}
-
SwThreadManager& SwThreadManager::GetThreadManager()
{
- return InitInstance::get();
+ static SwThreadManager gThreadManager;
+ return gThreadManager;
}
bool SwThreadManager::ExistsThreadManager()