24#include <com/sun/star/util/XChangesNotifier.hpp>
25#include <com/sun/star/util/XRefreshable.hpp>
27#include <rtl/ustring.hxx>
35 css::uno::Reference< css::uno::XInterface > xConfigAccess,
37 : m_rCache(rFilterCache)
38 , m_xConfig(
std::move(xConfigAccess))
39 , m_eConfigType(eConfigType)
51 css::uno::Reference< css::util::XChangesNotifier > xNotifier(
m_xConfig, css::uno::UNO_QUERY);
58 css::uno::Reference< css::util::XChangesListener > xThis(
this);
59 xNotifier->addChangesListener(xThis);
67 css::uno::Reference< css::util::XChangesNotifier > xNotifier(
m_xConfig, css::uno::UNO_QUERY);
74 css::uno::Reference< css::util::XChangesListener > xThis(
this);
75 xNotifier->removeChangesListener(xThis);
93 std::vector<OUString> lChangedItems;
94 sal_Int32 c =
aEvent.Changes.getLength();
99 const css::util::ElementChange& aChange =
aEvent.Changes[
i];
116 aChange.Accessor >>= sOrgPath;
117 if ( ! ::utl::splitLastFromConfigurationPath(sOrgPath, sTempPath, sLocale))
119 sOrgPath = sTempPath;
120 if ( ! ::utl::splitLastFromConfigurationPath(sOrgPath, sTempPath, sProperty))
128 sOrgPath = sTempPath;
129 if ( ! ::utl::splitLastFromConfigurationPath(sOrgPath, sTempPath, sNode))
137 if ( sNode.isEmpty() )
140 auto pIt = ::std::find(lChangedItems.cbegin(), lChangedItems.cend(), sNode);
141 if (pIt == lChangedItems.cend())
142 lChangedItems.push_back(sNode);
145 bool bNotifyRefresh =
false;
146 for (
auto const& changedItem : lChangedItems)
152 catch(
const css::container::NoSuchElementException&)
159 bNotifyRefresh =
true;
166 xRefreshBroadcaster->refresh();
css::uno::Reference< css::uno::XInterface > m_xConfig
holds the configuration access, where we listen alive.
virtual ~CacheUpdateListener() override
standard dtor.
void startListening()
starts listening.
FilterCache::EItemType m_eConfigType
every instance of this update listener listen on a special sub set of the filter configuration.
CacheUpdateListener(FilterCache &rFilterCache, css::uno::Reference< css::uno::XInterface > xConfigAccess, FilterCache::EItemType eConfigType)
initialize new instance of this class.
void stopListening()
stop listening.
FilterCache & m_rCache
reference to the singleton(!) filter cache implementation, which should be updated by this thread.
virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent &aEvent) override
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
supports registration of XRefreshListener on the global filter configuration.
implements a cache, which contains all elements of our filter and type detection configuration.
void refreshItem(EItemType eType, const OUString &sItem)
TODO document me ...
EItemType
identify the type of a container item.