LibreOffice Module sd (master) 1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
sd::sidebar::MasterPageContainerQueue Class Referencefinal

The queue stores and processes all requests from a MasterPageContainer for the creation of previews. More...

#include <MasterPageContainerQueue.hxx>

Collaboration diagram for sd::sidebar::MasterPageContainerQueue:
[legend]

Classes

class  ContainerAdapter
 
class  PreviewCreationRequest
 
class  RequestQueue
 

Public Member Functions

 ~MasterPageContainerQueue ()
 
bool RequestPreview (const SharedMasterPageDescriptor &rDescriptor)
 This method is typically called for entries in the container for which GetPreviewState() returns OS_CREATABLE. More...
 
bool HasRequest (MasterPageContainer::Token aToken) const
 Return <TRUE> when there is a request currently in the queue for the given token. More...
 
bool IsEmpty () const
 Return <TRUE> when there is at least one request in the queue. More...
 
void ProcessAllRequests ()
 After this call the queue does not wait anymore for requests with higher priority when only a small number of requests with lower priority are present. More...
 

Static Public Member Functions

static MasterPageContainerQueueCreate (const std::weak_ptr< ContainerAdapter > &rpContainer)
 

Private Member Functions

 MasterPageContainerQueue (std::weak_ptr< ContainerAdapter > pContainer)
 
void LateInit ()
 
 DECL_LINK (DelayedPreviewCreation, Timer *, void)
 

Static Private Member Functions

static sal_Int32 CalculatePriority (const SharedMasterPageDescriptor &rDescriptor)
 Calculate the priority that defines the order in which requests are processed. More...
 

Private Attributes

std::weak_ptr< ContainerAdaptermpWeakContainer
 
std::unique_ptr< RequestQueuempRequestQueue
 
Timer maDelayedPreviewCreationTimer
 
sal_uInt32 mnRequestsServedCount
 

Static Private Attributes

static const sal_Int32 snDelayedCreationTimeout
 The time to wait (in milliseconds) between the creation of previews. More...
 
static const sal_Int32 snDelayedCreationTimeoutWhenNotIdle
 The time to wait when the system is not idle. More...
 
static const sal_Int32 snMasterPagePriorityBoost
 Requests for previews of master pages in a document have their priority increased by this value. More...
 
static const sal_Int32 snWaitForMoreRequestsPriorityThreshold
 When only requests which a priority lower than this threshold exist and not many requests have been made yet then wait with processing them until more requests are present. More...
 
static sal_uInt32 snWaitForMoreRequestsCount
 When only requests which a priority lower than a threshold exist and not more requests than this number have been made or already processed then wait with processing them until more requests are present. More...
 

Detailed Description

The queue stores and processes all requests from a MasterPageContainer for the creation of previews.

The order of request processing and its timing is controlled by a heuristic that uses values given with each request and which is controlled by various parameters that are described below.

Definition at line 37 of file MasterPageContainerQueue.hxx.

Constructor & Destructor Documentation

◆ ~MasterPageContainerQueue()

sd::sidebar::MasterPageContainerQueue::~MasterPageContainerQueue ( )

◆ MasterPageContainerQueue()

sd::sidebar::MasterPageContainerQueue::MasterPageContainerQueue ( std::weak_ptr< ContainerAdapter pContainer)
explicitprivate

Definition at line 94 of file MasterPageContainerQueue.cxx.

Referenced by Create().

Member Function Documentation

◆ CalculatePriority()

sal_Int32 sd::sidebar::MasterPageContainerQueue::CalculatePriority ( const SharedMasterPageDescriptor rDescriptor)
staticprivate

Calculate the priority that defines the order in which requests are processed.

Definition at line 151 of file MasterPageContainerQueue.cxx.

References sd::sidebar::MasterPageContainer::MASTERPAGE, and snMasterPagePriorityBoost.

Referenced by RequestPreview().

◆ Create()

MasterPageContainerQueue * sd::sidebar::MasterPageContainerQueue::Create ( const std::weak_ptr< ContainerAdapter > &  rpContainer)
static

◆ DECL_LINK()

sd::sidebar::MasterPageContainerQueue::DECL_LINK ( DelayedPreviewCreation  ,
Timer ,
void   
)
private

◆ HasRequest()

bool sd::sidebar::MasterPageContainerQueue::HasRequest ( MasterPageContainer::Token  aToken) const

Return <TRUE> when there is a request currently in the queue for the given token.

Definition at line 242 of file MasterPageContainerQueue.cxx.

References mpRequestQueue.

◆ IsEmpty()

bool sd::sidebar::MasterPageContainerQueue::IsEmpty ( ) const

Return <TRUE> when there is at least one request in the queue.

Definition at line 250 of file MasterPageContainerQueue.cxx.

References mpRequestQueue.

◆ LateInit()

void sd::sidebar::MasterPageContainerQueue::LateInit ( )
private

◆ ProcessAllRequests()

void sd::sidebar::MasterPageContainerQueue::ProcessAllRequests ( )

After this call the queue does not wait anymore for requests with higher priority when only a small number of requests with lower priority are present.

This method should be called when all templates are inserted into the MasterPageContainer.

Definition at line 255 of file MasterPageContainerQueue.cxx.

References maDelayedPreviewCreationTimer, mpRequestQueue, snWaitForMoreRequestsCount, and Timer::Start().

◆ RequestPreview()

bool sd::sidebar::MasterPageContainerQueue::RequestPreview ( const SharedMasterPageDescriptor rDescriptor)

This method is typically called for entries in the container for which GetPreviewState() returns OS_CREATABLE.

The creation of the preview is then scheduled to be executed asynchronously at a later point in time. When the preview is available the change listeners will be notified.

Definition at line 118 of file MasterPageContainerQueue.cxx.

References CalculatePriority(), maDelayedPreviewCreationTimer, mpRequestQueue, and Timer::Start().

Member Data Documentation

◆ maDelayedPreviewCreationTimer

Timer sd::sidebar::MasterPageContainerQueue::maDelayedPreviewCreationTimer
private

◆ mnRequestsServedCount

sal_uInt32 sd::sidebar::MasterPageContainerQueue::mnRequestsServedCount
private

Definition at line 86 of file MasterPageContainerQueue.hxx.

◆ mpRequestQueue

std::unique_ptr<RequestQueue> sd::sidebar::MasterPageContainerQueue::mpRequestQueue
private

◆ mpWeakContainer

std::weak_ptr<ContainerAdapter> sd::sidebar::MasterPageContainerQueue::mpWeakContainer
private

Definition at line 81 of file MasterPageContainerQueue.hxx.

◆ snDelayedCreationTimeout

const sal_Int32 sd::sidebar::MasterPageContainerQueue::snDelayedCreationTimeout
staticprivate

The time to wait (in milliseconds) between the creation of previews.

Definition at line 94 of file MasterPageContainerQueue.hxx.

Referenced by LateInit().

◆ snDelayedCreationTimeoutWhenNotIdle

const sal_Int32 sd::sidebar::MasterPageContainerQueue::snDelayedCreationTimeoutWhenNotIdle
staticprivate

The time to wait when the system is not idle.

Definition at line 98 of file MasterPageContainerQueue.hxx.

◆ snMasterPagePriorityBoost

const sal_Int32 sd::sidebar::MasterPageContainerQueue::snMasterPagePriorityBoost
staticprivate

Requests for previews of master pages in a document have their priority increased by this value.

Definition at line 103 of file MasterPageContainerQueue.hxx.

Referenced by CalculatePriority().

◆ snWaitForMoreRequestsCount

sal_uInt32 sd::sidebar::MasterPageContainerQueue::snWaitForMoreRequestsCount
staticprivate

When only requests which a priority lower than a threshold exist and not more requests than this number have been made or already processed then wait with processing them until more requests are present.

Definition at line 116 of file MasterPageContainerQueue.hxx.

Referenced by ProcessAllRequests().

◆ snWaitForMoreRequestsPriorityThreshold

const sal_Int32 sd::sidebar::MasterPageContainerQueue::snWaitForMoreRequestsPriorityThreshold
staticprivate

When only requests which a priority lower than this threshold exist and not many requests have been made yet then wait with processing them until more requests are present.

Definition at line 109 of file MasterPageContainerQueue.hxx.


The documentation for this class was generated from the following files: