[Libreoffice-commits] core.git: sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 1 05:14:48 UTC 2020
sw/source/uibase/utlui/content.cxx | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
New commits:
commit a7e0375e40dd98b3bdc544967b5652a4dc0965fc
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Fri Mar 27 17:12:20 2020 -0800
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Fri May 1 07:14:11 2020 +0200
tdf#63967 Navigator section tooltip word and character count
Change-Id: I13ef9d71b080d5cac15e402e9198cf3c182eb78e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91268
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index db829431569f..207a0d63f610 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -86,6 +86,9 @@
#include <AnnotationWin.hxx>
#include <memory>
+#include <fmtcntnt.hxx>
+#include <docstat.hxx>
+
#define CTYPE_CNT 0
#define CTYPE_CTT 1
@@ -3289,6 +3292,32 @@ IMPL_LINK(SwContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUStrin
assert(dynamic_cast<SwGraphicContent*>(static_cast<SwTypeNumber*>(pUserData)));
sEntry = static_cast<SwGraphicContent*>(pUserData)->GetLink();
break;
+ case ContentTypeId::REGION:
+ {
+ assert(dynamic_cast<SwRegionContent*>(static_cast<SwTypeNumber*>(pUserData)));
+ sEntry = static_cast<SwRegionContent*>(pUserData)->GetName();
+ const SwSectionFormats& rFormats = GetWrtShell()->GetDoc()->GetSections();
+ for (SwSectionFormats::size_type n = rFormats.size(); n;)
+ {
+ const SwNodeIndex* pIdx = nullptr;
+ const SwSectionFormat* pFormat = rFormats[--n];
+ const SwSection* pSect;
+ if (nullptr != (pSect = pFormat->GetSection()) &&
+ pSect->GetSectionName() == sEntry &&
+ nullptr != (pIdx = pFormat->GetContent().GetContentIdx()) &&
+ pIdx->GetNode().GetNodes().IsDocNodes())
+ {
+ SwDocStat aDocStat;
+ SwPaM aPaM(*pIdx, *pIdx->GetNode().EndOfSectionNode());
+ SwDoc::CountWords(aPaM, aDocStat);
+ sEntry = SwResId(STR_REGION_DEFNAME) + ": " + sEntry + "\n" +
+ SwResId(FLD_STAT_WORD) + ": " + OUString::number(aDocStat.nWord) + "\n" +
+ SwResId(FLD_STAT_CHAR) + ": " + OUString::number(aDocStat.nChar);
+ break;
+ }
+ }
+ }
+ break;
default: break;
}
if(static_cast<SwContent*>(pUserData)->IsInvisible())
More information about the Libreoffice-commits
mailing list