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>
29
30namespace sw
31{
32
33sal_uInt64 SwDocIdle::UpdateMinPeriod( 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
51SwDocIdle::SwDocIdle( SwDoc &doc, const char * pDebugIdleName )
52 : Idle(pDebugIdleName), m_rDoc( doc )
53{
54}
55
57{
58}
59
60}
61
62/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool IsDocIdle() const =0
Is the document ready to be processed?
static constexpr sal_uInt64 InfiniteTimeoutMs
static constexpr sal_uInt64 ImmediateTimeoutMs
const SwView * GetView() const
Definition: docsh.hxx:221
Definition: doc.hxx:197
IDocumentTimerAccess const & getIDocumentTimerAccess() const
Definition: doc.cxx:263
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
bool IsIdle() const
Definition: viewopt.hxx:332
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
Definition: view.hxx:146
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
virtual ~SwDocIdle() override
Definition: SwDocIdle.cxx:56
SwDoc & m_rDoc
Definition: SwDocIdle.hxx:39
SwDocIdle(SwDoc &doc, const char *pDebugIdleName)
Definition: SwDocIdle.cxx:51
virtual sal_uInt64 UpdateMinPeriod(sal_uInt64 nTimeNow) const override
Definition: SwDocIdle.cxx:33
SwDoc & m_rDoc
Definition: docbm.cxx:1228
Dialog to specify the properties of date form field.