summaryrefslogtreecommitdiff
path: root/filter/source/config
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/config')
-rw-r--r--filter/source/config/cache/basecontainer.cxx10
-rw-r--r--filter/source/config/cache/contenthandlerfactory.cxx2
-rw-r--r--filter/source/config/cache/filtercache.hxx3
-rw-r--r--filter/source/config/cache/filterfactory.cxx10
-rw-r--r--filter/source/config/cache/frameloaderfactory.cxx2
-rw-r--r--filter/source/config/cache/typedetection.cxx20
6 files changed, 26 insertions, 21 deletions
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx
index 4047f4df2719..023afd29415a 100644
--- a/filter/source/config/cache/basecontainer.cxx
+++ b/filter/source/config/cache/basecontainer.cxx
@@ -38,7 +38,7 @@ BaseContainer::BaseContainer()
, m_eType()
, m_lListener (m_aLock)
{
- TheFilterCache::get().load(FilterCache::E_CONTAINS_STANDARD);
+ GetTheFilterCache().load(FilterCache::E_CONTAINS_STANDARD);
}
@@ -93,7 +93,7 @@ void BaseContainer::impl_loadOnDemand()
break;
}
- TheFilterCache::get().load(eRequiredState);
+ GetTheFilterCache().load(eRequiredState);
// <- SAFE
#endif
}
@@ -104,7 +104,7 @@ void BaseContainer::impl_initFlushMode()
// SAFE ->
osl::MutexGuard aLock(m_aLock);
if (!m_pFlushCache)
- m_pFlushCache = TheFilterCache::get().clone();
+ m_pFlushCache = GetTheFilterCache().clone();
if (!m_pFlushCache)
throw css::uno::RuntimeException( "Can not create write copy of internal used cache on demand.",
static_cast< OWeakObject* >(this));
@@ -119,7 +119,7 @@ FilterCache* BaseContainer::impl_getWorkingCache() const
if (m_pFlushCache)
return m_pFlushCache.get();
else
- return &TheFilterCache::get();
+ return &GetTheFilterCache();
// <- SAFE
}
@@ -422,7 +422,7 @@ void SAL_CALL BaseContainer::flush()
If the global cache gets this information via listener,
we should remove this method!
*/
- TheFilterCache::get().takeOver(*m_pFlushCache);
+ GetTheFilterCache().takeOver(*m_pFlushCache);
}
catch(const css::uno::Exception& ex)
{
diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx
index a5140acdbed2..a3bf71cf22ed 100644
--- a/filter/source/config/cache/contenthandlerfactory.cxx
+++ b/filter/source/config/cache/contenthandlerfactory.cxx
@@ -55,7 +55,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea
// SAFE ->
osl::MutexGuard aLock(m_aLock);
- auto & cache = TheFilterCache::get();
+ auto & cache = GetTheFilterCache();
// search handler on cache
CacheItem aHandler = cache.getItem(FilterCache::E_CONTENTHANDLER, sHandler);
diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx
index 66d07467f6f3..a0ef79c93931 100644
--- a/filter/source/config/cache/filtercache.hxx
+++ b/filter/source/config/cache/filtercache.hxx
@@ -29,7 +29,6 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Any.h>
#include <comphelper/documentconstants.hxx>
-#include <rtl/instance.hxx>
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
@@ -933,7 +932,7 @@ class FilterCache : public BaseLock
static css::uno::Sequence< OUString > impl_convertFlagField2FlagNames(SfxFilterFlags nFlags);
};
-struct TheFilterCache: public rtl::Static<FilterCache, TheFilterCache> {};
+FilterCache& GetTheFilterCache();
} // namespace filter::config
diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx
index e499b4bad633..8832330d5a04 100644
--- a/filter/source/config/cache/filterfactory.cxx
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -30,6 +30,12 @@
namespace filter::config{
+FilterCache& GetTheFilterCache()
+{
+ static FilterCache CACHE;
+ return CACHE;
+}
+
/** @short define all possible parts of a filter query.
@descr syntax: "<query>[:<param>[=<value>]]"
@@ -73,7 +79,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan
// SAFE ->
osl::MutexGuard aLock(m_aLock);
- auto & cache = TheFilterCache::get();
+ auto & cache = GetTheFilterCache();
// search filter on cache
CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter);
@@ -122,7 +128,7 @@ css::uno::Sequence< OUString > SAL_CALL FilterFactory::getAvailableServiceNames(
std::vector<OUString> lUNOFilters;
try
{
- lUNOFilters = TheFilterCache::get().getMatchingItemsByProps(FilterCache::E_FILTER, lIProps, lEProps);
+ lUNOFilters = GetTheFilterCache().getMatchingItemsByProps(FilterCache::E_FILTER, lIProps, lEProps);
}
catch(const css::uno::RuntimeException&)
{ throw; }
diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx
index c7906b4acf1d..a3aef82e4c6c 100644
--- a/filter/source/config/cache/frameloaderfactory.cxx
+++ b/filter/source/config/cache/frameloaderfactory.cxx
@@ -53,7 +53,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI
// SAFE ->
osl::MutexGuard aLock(m_aLock);
- auto & cache = TheFilterCache::get();
+ auto & cache = GetTheFilterCache();
// search loader on cache
CacheItem aLoader = cache.getItem(m_eType, sLoader);
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index 34d0d49d5af9..1fd7cccc49ab 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -82,7 +82,7 @@ OUString SAL_CALL TypeDetection::queryTypeByURL(const OUString& sURL)
// set std types as minimum requirement first!
// Only in case no type was found for given URL,
// use optional types too ...
- auto & cache = TheFilterCache::get();
+ auto & cache = GetTheFilterCache();
FlatDetection lFlatTypes;
cache.detectFlatForURL(aURL, lFlatTypes);
@@ -473,7 +473,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes
if (!sFilter.isEmpty())
return;
- auto & cache = TheFilterCache::get();
+ auto & cache = GetTheFilterCache();
// b)
// check a preselected document service too.
@@ -642,7 +642,7 @@ bool TypeDetection::impl_getPreselectionForType(
{
// SAFE -> --------------------------
osl::MutexGuard aLock(m_aLock);
- aType = TheFilterCache::get().getItem(FilterCache::E_TYPE, sType);
+ aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sType);
// <- SAFE --------------------------
}
catch(const css::container::NoSuchElementException&)
@@ -732,7 +732,7 @@ void TypeDetection::impl_getPreselectionForDocumentService(
// Attention: For executing next lines of code, We must be sure that
// all filters already loaded :-(
// That can disturb our "load on demand feature". But we have no other chance!
- auto & cache = TheFilterCache::get();
+ auto & cache = GetTheFilterCache();
cache.load(FilterCache::E_CONTAINS_FILTERS);
CacheItem lIProps;
@@ -766,7 +766,7 @@ OUString TypeDetection::impl_getTypeFromFilter(const OUString& rFilterName)
try
{
osl::MutexGuard aLock(m_aLock);
- aFilter = TheFilterCache::get().getItem(FilterCache::E_FILTER, rFilterName);
+ aFilter = GetTheFilterCache().getItem(FilterCache::E_FILTER, rFilterName);
}
catch (const container::NoSuchElementException&)
{
@@ -788,7 +788,7 @@ void TypeDetection::impl_getAllFormatTypes(
try
{
osl::MutexGuard aLock(m_aLock);
- auto & cache = TheFilterCache::get();
+ auto & cache = GetTheFilterCache();
cache.load(FilterCache::E_CONTAINS_FILTERS);
aFilterNames = cache.getItemNames(FilterCache::E_FILTER);
}
@@ -813,7 +813,7 @@ void TypeDetection::impl_getAllFormatTypes(
{
// Get all types that match the URL alone.
FlatDetection aFlatByURL;
- TheFilterCache::get().detectFlatForURL(aParsedURL, aFlatByURL);
+ GetTheFilterCache().detectFlatForURL(aParsedURL, aFlatByURL);
for (auto const& elem : aFlatByURL)
{
FlatDetection::iterator itPos = std::find_if(rFlatTypes.begin(), rFlatTypes.end(), FindByType(elem.sType));
@@ -900,7 +900,7 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& r
{
// SAFE -> ----------------------------------
osl::ClearableMutexGuard aLock(m_aLock);
- CacheItem aType = TheFilterCache::get().getItem(FilterCache::E_TYPE, sFlatType);
+ CacheItem aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sFlatType);
aLock.clear();
OUString sDetectService;
@@ -1155,7 +1155,7 @@ bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescript
// SAFE ->
{
osl::MutexGuard aLock(m_aLock);
- if (TheFilterCache::get().hasItem(FilterCache::E_TYPE, sType))
+ if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType))
{
rDescriptor[utl::MediaDescriptor::PROP_TYPENAME()] <<= sType;
return true;
@@ -1177,7 +1177,7 @@ bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescri
// SAFE ->
osl::ClearableMutexGuard aLock(m_aLock);
- auto & cache = TheFilterCache::get();
+ auto & cache = GetTheFilterCache();
CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter);
OUString sType;
aFilter[PROPNAME_TYPE] >>= sType;