android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / doc / SwDocIdle.cxx
blob8c37642899b2777443aef23eb761e29c3ab8ea96
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
27 #include <SwDocIdle.hxx>
28 #include <IDocumentTimerAccess.hxx>
30 namespace sw
33 sal_uInt64 SwDocIdle::UpdateMinPeriod( sal_uInt64 /* nTimeNow */ ) const
35 bool bReadyForSchedule = true;
37 SwView* pView = m_rDoc.GetDocShell() ? m_rDoc.GetDocShell()->GetView() : nullptr;
38 if( pView )
40 SwWrtShell& rWrtShell = pView->GetWrtShell();
41 bReadyForSchedule = rWrtShell.GetViewOptions()->IsIdle();
44 if( bReadyForSchedule && !m_rDoc.getIDocumentTimerAccess().IsDocIdle() )
45 bReadyForSchedule = false;
47 return bReadyForSchedule
48 ? Scheduler::ImmediateTimeoutMs : Scheduler::InfiniteTimeoutMs;
51 SwDocIdle::SwDocIdle( SwDoc &doc, const char * pDebugIdleName )
52 : Idle(pDebugIdleName), m_rDoc( doc )
56 SwDocIdle::~SwDocIdle()
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */