LibreOffice Module sw (master)  1
DocumentTimerManager.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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTTIMERMANAGER_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTTIMERMANAGER_HXX
22 
23 #include <IDocumentTimerAccess.hxx>
24 #include <SwDocIdle.hxx>
25 
26 #include <sal/types.h>
27 #include <tools/link.hxx>
28 
29 class SwDoc;
30 
31 namespace sw
32 {
33 
35 {
36 public:
37  enum class IdleJob
38  {
39  None,
40  Busy,
41  Grammar,
42  Layout,
43  Fields,
44  };
45 
46  DocumentTimerManager( SwDoc& i_rSwdoc );
47  virtual ~DocumentTimerManager() override;
48 
49  void StartIdling() override;
50 
51  void StopIdling() override;
52 
53  void BlockIdling() override;
54 
55  void UnblockIdling() override;
56 
57  bool IsDocIdle() const override;
58 
59 private:
62 
65  DECL_LINK( FireIdleJobsTimeout, Timer *, void );
66 
67  DECL_LINK( DoIdleJobs, Timer *, void );
68 
69  IdleJob GetNextIdleJob() const;
70 
72 
73  sal_uInt32 m_nIdleBlockCount;
78 };
79 
81 {
82  return ((0 == m_nIdleBlockCount) && (GetNextIdleJob() != IdleJob::Busy));
83 }
84 
85 }
86 
87 #endif
88 
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Handle the background jobs of a Writer document.
Definition: doc.hxx:185
Dialog to specify the properties of date form field.
document has no idle jobs to do
bool m_bStartOnUnblock
true, if the last unblock should start the timer
bool m_bWaitForLokInit
true if we waited for LOK to initialize already.
virtual ~DocumentTimerManager() override
sal_uInt32 m_nIdleBlockCount
Don't run the Idle, if > 0.
bool IsDocIdle() const override
Is the document ready to be processed?
DECL_LINK(FireIdleJobsTimeout, Timer *, void)
Delay starting idle jobs to allow for post-load activity.
void UnblockIdling() override
Decrement block count.
DocumentTimerManager & operator=(DocumentTimerManager const &)=delete
void StopIdling() override
Stop idle processing.
void BlockIdling() override
Increment block count.
An Idle, which is just ready to be scheduled for idle documents.
Definition: SwDocIdle.hxx:36
document is busy and idle jobs are postponed
DocumentTimerManager(SwDoc &i_rSwdoc)
void StartIdling() override
Start the idle task.