29#include <com/sun/star/container/XNamed.hpp>
30#include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
38#if DEBUG_SD_CONFIGURATION_TRACE
40void TraceRequest (
const Reference<XConfigurationChangeRequest>& rxRequest)
42 Reference<container::XNamed> xNamed (rxRequest, UNO_QUERY);
44 SAL_INFO(
"sd.fwk", __func__ <<
": " << xNamed->getName());
54 std::shared_ptr<ConfigurationUpdater> pConfigurationUpdater)
55 : mnUserEventId(nullptr),
56 mpConfigurationUpdater(
std::move(pConfigurationUpdater))
67 const Reference<XConfiguration>& rxConfiguration)
69 ::osl::MutexGuard aGuard (
maMutex);
76 const Reference<XConfigurationChangeRequest>& rxRequest)
78 ::osl::MutexGuard aGuard (
maMutex);
80#if DEBUG_SD_CONFIGURATION_TRACE
83 SAL_INFO(
"sd.fwk", __func__ <<
": Adding requests to empty queue");
87 SAL_INFO(
"sd.fwk", __func__ <<
": Adding request");
88 TraceRequest(rxRequest);
97 ::osl::MutexGuard aGuard (
maMutex);
103 SAL_INFO(
"sd.fwk", __func__ <<
": ChangeRequestQueueProcessor scheduling processing");
111 ::osl::MutexGuard aGuard (
maMutex);
113 mnUserEventId =
nullptr;
117 if ( ! maQueue.empty())
126 ::osl::MutexGuard aGuard (
maMutex);
128 SAL_INFO(
"sd.fwk", __func__ <<
": ProcessOneEvent");
134 Reference<XConfigurationChangeRequest> xRequest (
maQueue.front());
140#if DEBUG_SD_CONFIGURATION_TRACE
141 TraceRequest(xRequest);
149 SAL_INFO(
"sd.fwk", __func__ <<
": All requests are processed");
154#if DEBUG_SD_CONFIGURATION_TRACE
175 ::osl::MutexGuard aGuard (
maMutex);
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
The ChangeRequestQueueProcessor owns the ChangeRequestQueue and processes the configuration change re...
void AddRequest(const css::uno::Reference< css::drawing::framework::XConfigurationChangeRequest > &rxRequest)
The given request is appended to the end of the queue and will eventually be processed when all other...
ChangeRequestQueueProcessor(std::shared_ptr< ConfigurationUpdater > pUpdater)
The queue processor is created with a reference to an ConfigurationController so that its UpdateConfi...
ImplSVEvent * mnUserEventId
The id returned by the last PostUserEvent() call.
void StartProcessing()
Initiate the processing of the entries in the queue.
ChangeRequestQueue maQueue
mutable::osl::Mutex maMutex
void ProcessUntilEmpty()
Process all events in the queue synchronously.
void ProcessOneEvent()
Process the first event in queue.
void SetConfiguration(const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration)
Sets the configuration who will be changed by subsequent change requests.
void Clear()
Remove all events from the queue.
bool IsEmpty() const
Returns </sal_True> when the queue is empty.
std::shared_ptr< ConfigurationUpdater > mpConfigurationUpdater
~ChangeRequestQueueProcessor()
css::uno::Reference< css::drawing::framework::XConfiguration > mxConfiguration
The ChangeRequestQueue stores the pending requests for changes to the requested configuration.
static void TraceConfiguration(const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration, const char *pMessage)
#define LINK(Instance, Class, Member)
#define SAL_INFO(area, stream)
IMPL_LINK_NOARG(ChangeRequestQueueProcessor, ProcessEvent, void *, void)