1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTSTATISTICSMANAGER_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTSTATISTICSMANAGER_HXX
22 #include <IDocumentStatistics.hxx>
23 #include <SwDocIdle.hxx>
24 #include <tools/long.hxx>
32 class DocumentStatisticsManager final
: public IDocumentStatistics
35 DocumentStatisticsManager(SwDoc
& i_rSwdoc
);
37 void DocInfoChgd(bool isEnableSetModified
) override
;
38 const SwDocStat
& GetDocStat() const override
;
39 void SetDocStatModified(bool bSet
);
40 const SwDocStat
& GetUpdatedDocStat(bool bCompleteAsync
, bool bFields
) override
;
41 void SetDocStat(const SwDocStat
& rStat
) override
;
42 void UpdateDocStat(bool bCompleteAsync
, bool bFields
) override
;
43 virtual ~DocumentStatisticsManager() override
;
46 DocumentStatisticsManager(DocumentStatisticsManager
const&) = delete;
47 DocumentStatisticsManager
& operator=(DocumentStatisticsManager
const&) = delete;
51 /** continue computing a chunk of document statistics
52 * \param nChars number of characters to count before exiting
53 * \param bFields if stat. fields should be updated
55 * returns false when there is no more to calculate
57 bool IncrementalDocStatCalculate(tools::Long nChars
, bool bFields
= true);
59 // Our own 'StatsUpdateTimer' calls the following method
60 DECL_LINK(DoIdleStatsUpdate
, Timer
*, void);
62 std::unique_ptr
<SwDocStat
> mpDocStat
; //< Statistics information
63 bool mbInitialized
; //< allow first time update
64 SwDocIdle maStatsUpdateIdle
; //< Idle for asynchronous stats calculation
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */