LibreOffice Module sd (master) 1
MasterPageContainerQueue.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
24
25#include <vcl/timer.hxx>
26
27#include <memory>
28
29namespace sd::sidebar {
30
38{
39public:
41 public:
42 virtual bool UpdateDescriptor (
43 const SharedMasterPageDescriptor& rpDescriptor,
44 bool bForcePageObject,
45 bool bForcePreview,
46 bool bSendEvents) = 0;
47
48 protected:
50 };
51
53 const std::weak_ptr<ContainerAdapter>& rpContainer);
55
62 bool RequestPreview (const SharedMasterPageDescriptor& rDescriptor);
63
67 bool HasRequest (MasterPageContainer::Token aToken) const;
68
71 bool IsEmpty() const;
72
78 void ProcessAllRequests();
79
80private:
81 std::weak_ptr<ContainerAdapter> mpWeakContainer;
83 class RequestQueue;
84 std::unique_ptr<RequestQueue> mpRequestQueue;
87
88 // There are a couple of values that define various aspects of the
89 // heuristic that defines the order and timing in which requests for
90 // preview creation are processed.
91
94 static const sal_Int32 snDelayedCreationTimeout;
95
99
103 static const sal_Int32 snMasterPagePriorityBoost;
104
110
116 static sal_uInt32 snWaitForMoreRequestsCount;
117
118 explicit MasterPageContainerQueue (std::weak_ptr<ContainerAdapter> pContainer);
119 void LateInit();
120
124 static sal_Int32 CalculatePriority (const SharedMasterPageDescriptor& rDescriptor);
125
126 DECL_LINK(DelayedPreviewCreation, Timer *, void);
127};
128
129} // end of namespace sd::sidebar
130
131/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool UpdateDescriptor(const SharedMasterPageDescriptor &rpDescriptor, bool bForcePageObject, bool bForcePreview, bool bSendEvents)=0
The queue stores and processes all requests from a MasterPageContainer for the creation of previews.
static sal_Int32 CalculatePriority(const SharedMasterPageDescriptor &rDescriptor)
Calculate the priority that defines the order in which requests are processed.
bool RequestPreview(const SharedMasterPageDescriptor &rDescriptor)
This method is typically called for entries in the container for which GetPreviewState() returns OS_C...
bool HasRequest(MasterPageContainer::Token aToken) const
Return <TRUE> when there is a request currently in the queue for the given token.
bool IsEmpty() const
Return <TRUE> when there is at least one request in the queue.
static MasterPageContainerQueue * Create(const std::weak_ptr< ContainerAdapter > &rpContainer)
MasterPageContainerQueue(std::weak_ptr< ContainerAdapter > pContainer)
DECL_LINK(DelayedPreviewCreation, Timer *, void)
static const sal_Int32 snMasterPagePriorityBoost
Requests for previews of master pages in a document have their priority increased by this value.
std::unique_ptr< RequestQueue > mpRequestQueue
void ProcessAllRequests()
After this call the queue does not wait anymore for requests with higher priority when only a small n...
static const sal_Int32 snWaitForMoreRequestsPriorityThreshold
When only requests which a priority lower than this threshold exist and not many requests have been m...
std::weak_ptr< ContainerAdapter > mpWeakContainer
static const sal_Int32 snDelayedCreationTimeoutWhenNotIdle
The time to wait when the system is not idle.
static const sal_Int32 snDelayedCreationTimeout
The time to wait (in milliseconds) between the creation of previews.
static sal_uInt32 snWaitForMoreRequestsCount
When only requests which a priority lower than a threshold exist and not more requests than this numb...
std::shared_ptr< MasterPageDescriptor > SharedMasterPageDescriptor