summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-03-27 17:12:20 -0800
committerJim Raykowski <raykowj@gmail.com>2020-05-01 07:14:11 +0200
commita7e0375e40dd98b3bdc544967b5652a4dc0965fc (patch)
tree417769306832e1b9358fd99e99bfb40d1ab89280
parented1c11e9213ad11cfe38440294b95a3cf08d0db0 (diff)
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@documentfoundation.org> Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r--sw/source/uibase/utlui/content.cxx29
1 files changed, 29 insertions, 0 deletions
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())