summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-11-13 09:11:34 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-11-13 09:16:46 +0100
commite746cf656d71b78216b65c3352a8441829bbf6db (patch)
tree9094247f4378c47b2a7277c4a66f16879c0c1f9d
parent617c72c1516417da0134859e0a8818ce1e0bf60a (diff)
Vcl: Add TooltipLabel to vcl buttons also
Change-Id: I332041e2d1d53f56cd38c1cd1ca325252535a53c
-rw-r--r--include/vcl/builder.hxx4
-rw-r--r--vcl/source/window/builder.cxx11
-rw-r--r--vcl/source/window/toolbox2.cxx4
3 files changed, 14 insertions, 5 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index b844f5896b09..fee454591a6f 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -107,7 +107,9 @@ public:
static void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition);
/// Get label of the command (like of .uno:Save) from the description service
- static OUString getCommandLabel(const OUString& rCommand, const css::uno::Reference<css::uno::XComponentContext>& rContext, const OUString& rModuleId);
+ static OUString getCommandProperty(const OUString aProperty, const OUString& rCommand,
+ const css::uno::Reference<css::uno::XComponentContext>& rContext,
+ const OUString& rModuleId);
/// Get image of the command (like of .uno:Save) from the description service
static Image getCommandImage(
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index e39eb6f8435f..626327f90868 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -892,10 +892,14 @@ namespace
uno::Reference<frame::XModuleManager2> xModuleManager(frame::ModuleManager::create(xContext));
OUString aModuleId(xModuleManager->identify(rFrame));
- OUString aLabel(VclBuilder::getCommandLabel(aCommand, xContext, aModuleId));
+ OUString aLabel(VclBuilder::getCommandProperty("Label", aCommand, xContext, aModuleId));
if (!aLabel.isEmpty())
pButton->SetText(aLabel);
+ OUString aTooltip(VclBuilder::getCommandProperty("Tooltip", aCommand, xContext, aModuleId));
+ if (!aTooltip.isEmpty())
+ pButton->SetQuickHelpText(aTooltip);
+
Image aImage(VclBuilder::getCommandImage(aCommand, /* bLarge = */ false, xContext, rFrame, aModuleId));
pButton->SetModeImage(aImage);
@@ -2164,7 +2168,8 @@ void VclBuilder::reorderWithinParent(std::vector<vcl::Window*>& rChilds, bool bI
}
}
-OUString VclBuilder::getCommandLabel(const OUString& rCommand, const uno::Reference<uno::XComponentContext>& rContext, const OUString& rModuleId)
+OUString VclBuilder::getCommandProperty(const OUString aProperty, const OUString& rCommand,
+ const uno::Reference<uno::XComponentContext>& rContext, const OUString& rModuleId)
{
if (rCommand.isEmpty())
return OUString();
@@ -2181,7 +2186,7 @@ OUString VclBuilder::getCommandLabel(const OUString& rCommand, const uno::Refere
{
for ( sal_Int32 i = 0; i < aProperties.getLength(); i++ )
{
- if (aProperties[i].Name == "Label")
+ if (aProperties[i].Name == aProperty)
{
OUString aLabel;
if (aProperties[i].Value >>= aLabel)
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index b2b6adf2e969..0efb1f8cfa85 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -606,7 +606,8 @@ void ToolBox::InsertItem(const OUString& rCommand, const uno::Reference<frame::X
uno::Reference<frame::XModuleManager2> xModuleManager(frame::ModuleManager::create(xContext));
OUString aModuleId(xModuleManager->identify(rFrame));
- OUString aLabel(VclBuilder::getCommandLabel(rCommand, xContext, aModuleId));
+ OUString aLabel(VclBuilder::getCommandProperty("Label", rCommand, xContext, aModuleId));
+ OUString aTooltip(VclBuilder::getCommandProperty("TooltipLabel", rCommand, xContext, aModuleId));
Image aImage(VclBuilder::getCommandImage(rCommand, (GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE), xContext, rFrame, aModuleId));
// let's invent an ItemId
@@ -615,6 +616,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const uno::Reference<frame::X
InsertItem(nItemId, aImage, aLabel, nBits, nPos);
SetItemCommand(nItemId, rCommand);
+ SetQuickHelpText(nItemId, aTooltip);
// set the minimal size
ImplToolItem* pItem = ImplGetItem( nItemId );