From 945251a6c5d1f401de3f08ee37df161e72be373b Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Thu, 5 Dec 2024 17:14:11 -0500 Subject: [PATCH] Word count for references --- src/insets/InsetRef.cpp | 10 ++++++++++ src/insets/InsetRef.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index 29a8c52831..496356ab2e 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -24,6 +24,7 @@ #include "Paragraph.h" #include "ParIterator.h" #include "PDFOptions.h" +#include "Statistics.h" #include "xml.h" #include "texstream.h" #include "TocBackend.h" @@ -669,4 +670,13 @@ docstring InsetRef::getTOCString() const return (broken_ ? _("BROKEN: ") : docstring()) + toc_string_; } +void InsetRef::updateStatistics(Statistics & stats) const +{ + docstring const & ref = getParam("reference"); + string const & cmd = params().getCmdName(); + docstring const refstring = displayString(ref, cmd); + stats.update(refstring); +} + + } // namespace lyx diff --git a/src/insets/InsetRef.h b/src/insets/InsetRef.h index 52c8de79e2..423e53adde 100644 --- a/src/insets/InsetRef.h +++ b/src/insets/InsetRef.h @@ -75,6 +75,8 @@ public: /// void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override; /// + void updateStatistics(Statistics & stats) const override; + /// void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const override; ///