LibreOffice Module sw (master)  1
SwDocIdle.cxx
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 #include <view.hxx>
21 #include <wrtsh.hxx>
22 #include <doc.hxx>
23 #include <docsh.hxx>
24 #include <viewopt.hxx>
25 #include <vcl/scheduler.hxx>
26 
27 #include <SwDocIdle.hxx>
28 #include <IDocumentTimerAccess.hxx>
29 
30 namespace sw
31 {
32 
33 sal_uInt64 SwDocIdle::UpdateMinPeriod( sal_uInt64 /* nMinPeriod */, sal_uInt64 /* nTimeNow */ ) const
34 {
35  bool bReadyForSchedule = true;
36 
37  SwView* pView = m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetView() : nullptr;
38  if( pView )
39  {
40  SwWrtShell& rWrtShell = pView->GetWrtShell();
41  bReadyForSchedule = rWrtShell.GetViewOptions()->IsIdle();
42  }
43 
44  if( bReadyForSchedule && !m_rDoc.getIDocumentTimerAccess().IsDocIdle() )
45  bReadyForSchedule = false;
46 
47  return bReadyForSchedule
49 }
50 
52  : m_rDoc( doc )
53 {
54 }
55 
57 {
58 }
59 
60 }
61 
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwDocShell * GetDocShell()
Definition: doc.hxx:1340
SwDoc & m_rDoc
Definition: SwDocIdle.hxx:39
Definition: doc.hxx:185
Dialog to specify the properties of date form field.
Definition: accfrmobj.cxx:40
SwWrtShell & GetWrtShell() const
Definition: view.hxx:400
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
virtual sal_uInt64 UpdateMinPeriod(sal_uInt64 nMinPeriod, sal_uInt64 nTimeNow) const override
Definition: SwDocIdle.cxx:33
bool IsIdle() const
Definition: viewopt.hxx:202
virtual ~SwDocIdle() override
Definition: SwDocIdle.cxx:56
virtual bool IsDocIdle() const =0
Is the document ready to be processed?
static constexpr sal_uInt64 ImmediateTimeoutMs
static constexpr sal_uInt64 InfiniteTimeoutMs
SwDocIdle(SwDoc &doc)
Definition: SwDocIdle.cxx:51
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
const SwView * GetView() const
Definition: docsh.hxx:220
Definition: view.hxx:146
IDocumentTimerAccess const & getIDocumentTimerAccess() const
Definition: doc.cxx:281