32#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
33#include <com/sun/star/frame/XModel.hpp>
44 maStatsUpdateIdle( i_rSwdoc,
"sw::DocumentStatisticsManager maStatsUpdateIdle" )
54 if (isEnableSetModified)
94 std::numeric_limits<tools::Long>::max(), bFields)) {}
121 nChars -= (
mpDocStat->nChar - nOldChars);
136 std::vector<SwFormatField*> vFields;
138 for(
auto pFormatField : vFields)
140 const auto pField =
static_cast<SwPostItField const*
>(pFormatField->GetField());
141 mpDocStat->nAllPara += pField->GetNumberOfParagraphs();
148 css::uno::Sequence < css::beans::NamedValue > aStat(
mpDocStat->nPage ? 8 : 7);
149 auto pStat = aStat.getArray();
151 pStat[
n].Name =
"TableCount";
152 pStat[
n++].Value <<=
static_cast<sal_Int32
>(
mpDocStat->nTable);
153 pStat[
n].Name =
"ImageCount";
154 pStat[
n++].Value <<=
static_cast<sal_Int32
>(
mpDocStat->nGrf);
155 pStat[
n].Name =
"ObjectCount";
156 pStat[
n++].Value <<=
static_cast<sal_Int32
>(
mpDocStat->nOLE);
159 pStat[
n].Name =
"PageCount";
160 pStat[
n++].Value <<=
static_cast<sal_Int32
>(
mpDocStat->nPage);
162 pStat[
n].Name =
"ParagraphCount";
163 pStat[
n++].Value <<=
static_cast<sal_Int32
>(
mpDocStat->nPara);
164 pStat[
n].Name =
"WordCount";
165 pStat[
n++].Value <<=
static_cast<sal_Int32
>(
mpDocStat->nWord);
166 pStat[
n].Name =
"CharacterCount";
167 pStat[
n++].Value <<=
static_cast<sal_Int32
>(
mpDocStat->nChar);
168 pStat[
n].Name =
"NonWhitespaceCharacterCount";
169 pStat[
n++].Value <<=
static_cast<sal_Int32
>(
mpDocStat->nCharExcludingSpaces);
175 const uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
176 pObjShell->
GetModel(), uno::UNO_QUERY_THROW);
177 const uno::Reference<document::XDocumentProperties> xDocProps(
178 xDPS->getDocumentProperties());
185 xDocProps->setDocumentStatistics(aStat);
186 if (!bDocWasModified)
204 if (IncrementalDocStatCalculate(32000))
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual void ResetModified()=0
virtual void SetModified()=0
Must be called manually at changes of format.
virtual bool IsModified() const =0
Changes of document?
virtual void Start(bool bStartTimer=true) override
css::uno::Reference< css::frame::XModel3 > GetModel() const
const SwView * GetView() const
virtual std::unique_ptr< LockAllViewsGuard > LockAllViews() override
IDocumentState const & getIDocumentState() const
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SwDocShell * GetDocShell()
Instances of SwFields and those derived from it occur 0 to n times.
virtual void UpdateFields()
void GatherFields(std::vector< SwFormatField * > &rvFormatFields, bool bCollectOnlyInDocNodes=true) const
Base class of the Writer document model elements.
SwNodeType GetNodeType() const
SwNodeOffset Count() const
sal_uInt16 GetPageNum() const
SwTextNode is a paragraph in the document model.
bool CountWords(SwDocStat &rStat, sal_Int32 nStart, sal_Int32 nEnd) const
count words in given range - returns true if we refreshed out count
const OUString & GetText() const
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
DocumentStatisticsManager(SwDoc &i_rSwdoc)
SwDocIdle maStatsUpdateIdle
std::unique_ptr< SwDocStat > mpDocStat
const SwDocStat & GetDocStat() const override
Document - Statistics.
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...
void SetDocStat(const SwDocStat &rStat) override
Set the document statistics.
void SetDocStatModified(bool bSet)
void UpdateDocStat(bool bCompleteAsync, bool bFields) override
Updates the internal document's statistics.
virtual ~DocumentStatisticsManager() override
bool IncrementalDocStatCalculate(tools::Long nChars, bool bFields=true)
continue computing a chunk of document statistics
void DocInfoChgd(bool isEnableSetModified) override
DocInfo has changed (notify via DocShell): make required fields update.
#define LINK(Instance, Class, Member)
Dialog to specify the properties of date form field.
IMPL_LINK(DocumentStatisticsManager, DoIdleStatsUpdate, Timer *, pIdle, void)
@ Table
SwTableNode is derived from SwStartNode.
@ Section
SwSectionNode is derived from SwStartNode.