23#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
24#include <com/sun/star/uno/Type.h>
28#include <osl/diagnose.h>
45 const css::uno::Sequence< OUString >& lServiceNames ,
93 throw css::uno::RuntimeException(
"Can not create write copy of internal used cache on demand.",
125 const css::uno::Any& aValue)
128 throw css::lang::IllegalArgumentException(
"empty value not allowed as item name.",
129 static_cast< css::container::XNameContainer*
>(
this),
137 catch(
const css::uno::Exception&
ex)
139 throw css::lang::IllegalArgumentException(
ex.Message,
static_cast< css::container::XNameContainer*
>(
this), 2);
152 throw css::container::ElementExistException(OUString(),
static_cast< css::container::XNameContainer*
>(
this));
175 const css::uno::Any& aValue)
178 throw css::lang::IllegalArgumentException(
"empty value not allowed as item name.",
179 static_cast< css::container::XNameContainer*
>(
this),
187 catch(
const css::uno::Exception&
ex)
189 throw css::lang::IllegalArgumentException(
ex.Message,
static_cast< css::container::XNameContainer*
>(
this), 2);
202 throw css::container::NoSuchElementException(OUString(),
static_cast< css::container::XNameContainer*
>(
this));
211 throw css::container::NoSuchElementException(
"An empty item can't be part of this cache!",
212 static_cast< css::container::XNameAccess*
>(
this));
214 css::uno::Any aValue;
226 catch(
const css::container::NoSuchElementException&)
230 catch(
const css::uno::Exception&)
243 css::uno::Sequence< OUString > lNames;
256 catch(
const css::uno::Exception&)
270 bool bHasOne =
false;
282 catch(
const css::uno::Exception&)
304 bool bHasSome =
false;
316 catch(
const css::uno::Exception&)
330 OSL_FAIL(
"not pure virtual ... but not really implemented .-)");
332 return new ::comphelper::OEnumerationByName(
this, {});
338 std::vector<OUString> lKeys;
352 catch(
const css::uno::Exception&)
371 return new ::comphelper::OEnumerationByName(
this, std::move(lKeys));
381 throw css::lang::WrappedTargetRuntimeException(
382 "Can not guarantee cache consistency. Special flush container does not exists!",
398 catch(
const css::uno::Exception&
ex)
404 throw css::lang::WrappedTargetRuntimeException(
"Flush rejected by internal container.",
411 css::lang::EventObject aSource (
static_cast< css::util::XFlushable*
>(
this));
constexpr OUStringLiteral sImplementationName
constexpr OUStringLiteral sServiceName
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(std::unique_lock< std::mutex > &rGuard, void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event) const
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
OUString m_sImplementationName
the implementation name of our derived class, which we provide at the interface XServiceInfo of our c...
BaseContainer()
standard ctor.
void init(const OUString &sImplementationName, const css::uno::Sequence< OUString > &lServiceNames, FilterCache::EItemType eType)
initialize this generic instance with some specialized values from our derived object.
virtual ~BaseContainer() override
standard dtor.
virtual sal_Bool SAL_CALL hasByName(const OUString &sItem) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByProperties(const css::uno::Sequence< css::beans::NamedValue > &lProperties) override
virtual void SAL_CALL replaceByName(const OUString &sItem, const css::uno::Any &aValue) override
virtual void SAL_CALL removeByName(const OUString &sItem) override
virtual void SAL_CALL flush() override
FilterCache * impl_getWorkingCache(std::unique_lock< std::mutex > &rGuard) const
returns a pointer to the current used cache member.
virtual css::uno::Type SAL_CALL getElementType() override
FilterCache::EItemType m_eType
specify, which sub container of the used filter cache must be wrapped by this container interface.
std::unique_ptr< FilterCache > m_pFlushCache
local filter cache, which is used to collect changes on the filter configuration first and flush it l...
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByQuery(const OUString &sQuery) override
void impl_initFlushMode(std::unique_lock< std::mutex > &rGuard)
it creates the global instance m_pFilterCache, which is a copy of the global instance m_rCache,...
void impl_loadOnDemand(std::unique_lock< std::mutex > &rGuard)
check if the underlying configuration data was already loaded and do it if necessary automatically.
virtual OUString SAL_CALL getImplementationName() override
css::uno::Sequence< OUString > m_lServiceNames
the list of supported uno service names of our derived class, which we provide at the interface XServ...
virtual css::uno::Any SAL_CALL getByName(const OUString &sItem) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL removeFlushListener(const css::uno::Reference< css::util::XFlushListener > &xListener) override
virtual void SAL_CALL insertByName(const OUString &sItem, const css::uno::Any &aValue) override
virtual void SAL_CALL addFlushListener(const css::uno::Reference< css::util::XFlushListener > &xListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
comphelper::OInterfaceContainerHelper4< css::util::XFlushListener > m_lListener
holds all listener, which are registered at this instance.
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
represent an item of a FilterCache instance.
implements a cache, which contains all elements of our filter and type detection configuration.
std::unique_ptr< FilterCache > clone() const
creates a copy of this container.
bool hasItems(EItemType eType) const
indicates if the requested sub container contains some items.
std::vector< OUString > getMatchingItemsByProps(EItemType eType, o3tl::span< const css::beans::NamedValue > lIProps, o3tl::span< const css::beans::NamedValue > lEProps={}) const
return a list of key names for items, which match the specified criteria.
EFillState
indicates, which items already exists inside this cache and which not.
@ E_CONTAINS_CONTENTHANDLERS
@ E_CONTAINS_FRAMELOADERS
std::vector< OUString > getItemNames(EItemType eType) const
return a list of all key names, which represent an item inside the specified sub container.
bool hasItem(EItemType eType, const OUString &sItem)
check if the required item exist inside this container.
void load(EFillState eRequired)
force special fill state of this cache.
EItemType
identify the type of a container item.
css::uno::Any getItemWithStateProps(EItemType eType, const OUString &sItem)
add some implicit properties to the given cache item reference.
void removeItem(EItemType eType, const OUString &sItem)
TODO document me ...
void takeOver(const FilterCache &rClone)
copy the cache content or rClone back to this instance.
void setItem(EItemType eType, const OUString &sItem, const CacheItem &aValue)
TODO document me ...
const EnumerationType m_eType
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
FilterCache & GetTheFilterCache()