summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail..com>2019-11-18 19:43:29 -0900
committerXisco Faulí <xiscofauli@libreoffice.org>2019-11-26 14:08:40 +0100
commit4613b32fc121f5f4e0e440837f94903ad361e89a (patch)
tree37794ac4d255c0fff83d0eee694a9a3024cdd68d /sfx2
parent9cbc55167301cefe9889ad8e604439e0118b627f (diff)
tdf#128557 Add tooltips to styles lists
Change-Id: Ia8f00cd882c1c8c239b95de8e917ff317a6485e8 Reviewed-on: https://gerrit.libreoffice.org/83152 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com> (cherry picked from commit b8bbe9a3ca4758102ce6aa5d1e0fbb077eedbe64) Reviewed-on: https://gerrit.libreoffice.org/83364 Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/templdlg.cxx47
-rw-r--r--sfx2/source/inc/templdgi.hxx1
2 files changed, 48 insertions, 0 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 4710cd2c2aec..4347d9894298 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -314,6 +314,53 @@ bool DropListBox_Impl::EventNotify( NotifyEvent& rNEvt )
return bRet;
}
+void DropListBox_Impl::RequestHelp(const HelpEvent& rHEvt)
+{
+ if (rHEvt.GetMode() & HelpEventMode::QUICK)
+ {
+ Point aPos(ScreenToOutputPixel(rHEvt.GetMousePosPixel()));
+ SvTreeListEntry* pEntry = GetEntry(aPos);
+ if (pEntry)
+ {
+ const OUString aTemplName(GetEntryText(pEntry));
+ OUString sQuickHelpText(aTemplName);
+
+ const SfxStyleFamilyItem* pItem = pDialog->GetFamilyItem_Impl();
+ SfxStyleSheetBase* pStyle = pDialog->pStyleSheetPool->Find(aTemplName, pItem->GetFamily());
+
+ if (pStyle && pStyle->IsUsed()) // pStyle is in use in the document?
+ {
+ OUString sUsedBy;
+ if (pStyle->GetFamily() == SfxStyleFamily::Pseudo)
+ {
+ sUsedBy = pStyle->GetUsedBy();
+ }
+
+ if (!sUsedBy.isEmpty())
+ {
+ const sal_Int32 nMaxLen = 80;
+ if (sUsedBy.getLength() > nMaxLen)
+ {
+ sUsedBy = sUsedBy.copy(0, nMaxLen) + "...";
+ }
+
+ OUString aMessage = SfxResId(STR_STYLEUSEDBY);
+ aMessage = aMessage.replaceFirst("%STYLELIST", sUsedBy);
+ sQuickHelpText = aTemplName + " " + aMessage;
+ }
+ }
+
+ Size aSize(GetOutputSizePixel().Width(), GetEntryHeight());
+ tools::Rectangle aScreenRect(OutputToScreenPixel(GetEntryPosition(pEntry)), aSize);
+
+ Help::ShowQuickHelp(this, aScreenRect,
+ sQuickHelpText, QuickHelpFlags::Left | QuickHelpFlags::VCenter);
+ return;
+ }
+ }
+ SvTreeListBox::RequestHelp(rHEvt);
+}
+
/** ListBox class that starts a PopupMenu (designer specific) in the
command handler.
*/
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 9ab64b0262a7..1981bb25101b 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -83,6 +83,7 @@ public:
}
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual void RequestHelp(const HelpEvent& rHEvt) override;
};