Kaydet (Commit) e746cf65 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

Vcl: Add TooltipLabel to vcl buttons also

Change-Id: I332041e2d1d53f56cd38c1cd1ca325252535a53c
üst 617c72c1
......@@ -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(
......
......@@ -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)
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment