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 <memory>
25 
26 class SwDoc;
27 struct SwDocStat;
28 
29 namespace sw {
30 
32 {
33 
34 public:
35 
36  DocumentStatisticsManager( SwDoc& i_rSwdoc );
37 
38  void DocInfoChgd(bool isEnableSetModified) override;
39  const SwDocStat &GetDocStat() const override;
40  void SetDocStatModified(bool bSet);
41  const SwDocStat &GetUpdatedDocStat(bool bCompleteAsync, bool bFields) override;
42  void SetDocStat(const SwDocStat& rStat) override;
43  void UpdateDocStat(bool bCompleteAsync, bool bFields) override;
44  virtual ~DocumentStatisticsManager() override;
45 
46 private:
47 
50 
52 
59  bool IncrementalDocStatCalculate(long nChars, bool bFields = true);
60 
61  // Our own 'StatsUpdateTimer' calls the following method
62  DECL_LINK( DoIdleStatsUpdate, Timer *, void );
63 
64  std::unique_ptr<SwDocStat> mpDocStat;//< Statistics information
65  bool mbInitialized; //< allow first time update
66  SwDocIdle maStatsUpdateIdle; //< Idle for asynchronous stats calculation
67 };
68 
69 }
70 #endif
71 
72 /* 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...
Definition: doc.hxx:185
Dialog to specify the properties of drop-down form field.
Definition: accfrmobj.cxx:40
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.
bool IncrementalDocStatCalculate(long nChars, bool bFields=true)
continue computing a chunk of 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