LibreOffice Module sw (master)  1
DocumentStatisticsManager.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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTSTATISTICSMANAGER_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTSTATISTICSMANAGER_HXX
21 
22 #include <IDocumentStatistics.hxx>
23 #include <SwDocIdle.hxx>
24 #include <tools/long.hxx>
25 #include <memory>
26 
27 class SwDoc;
28 struct SwDocStat;
29 
30 namespace sw
31 {
33 {
34 public:
36 
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;
44 
45 private:
48 
50 
57  bool IncrementalDocStatCalculate(tools::Long nChars, bool bFields = true);
58 
59  // Our own 'StatsUpdateTimer' calls the following method
60  DECL_LINK(DoIdleStatsUpdate, Timer*, void);
61 
62  std::unique_ptr<SwDocStat> mpDocStat; //< Statistics information
63  bool mbInitialized; //< allow first time update
64  SwDocIdle maStatsUpdateIdle; //< Idle for asynchronous stats calculation
65 };
66 }
67 #endif
68 
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwDocStat & GetUpdatedDocStat(bool bCompleteAsync, bool bFields) override
Updates the document statistics if the document has been modified and returns a reference to the resu...
bool IncrementalDocStatCalculate(tools::Long nChars, bool bFields=true)
continue computing a chunk of document statistics
long Long
Definition: doc.hxx:186
Dialog to specify the properties of date form field.
Document statistics information.
DECL_LINK(DoIdleStatsUpdate, Timer *, void)
void DocInfoChgd(bool isEnableSetModified) override
DocInfo has changed (notify via DocShell): make required fields update.
void UpdateDocStat(bool bCompleteAsync, bool bFields) override
Updates the internal document's statistics.
std::unique_ptr< SwDocStat > mpDocStat
const SwDocStat & GetDocStat() const override
Document - Statistics.
An Idle, which is just ready to be scheduled for idle documents.
Definition: SwDocIdle.hxx:36
void SetDocStat(const SwDocStat &rStat) override
Set the document statistics.
DocumentStatisticsManager & operator=(DocumentStatisticsManager const &)=delete