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 {
34 {
35 public:
36  enum class IdleJob
37  {
38  None,
39  Busy,
40  Grammar,
41  Layout,
42  Fields,
43  };
44 
45  DocumentTimerManager(SwDoc& i_rSwdoc);
46  virtual ~DocumentTimerManager() override;
47 
48  void StartIdling() override;
49 
50  void StopIdling() override;
51 
52  void BlockIdling() override;
53 
54  void UnblockIdling() override;
55 
56  bool IsDocIdle() const override;
57 
58 private:
61 
64  DECL_LINK(FireIdleJobsTimeout, Timer*, void);
65 
66  DECL_LINK(DoIdleJobs, Timer*, void);
67 
68  IdleJob GetNextIdleJob() const;
69 
71 
72  sal_uInt32 m_nIdleBlockCount;
77 };
78 
80 {
81  return ((0 == m_nIdleBlockCount) && (GetNextIdleJob() != IdleJob::Busy));
82 }
83 }
84 
85 #endif
86 
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Handle the background jobs of a Writer document.
Definition: doc.hxx:187
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.