summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-11-16 12:23:25 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2015-11-16 14:48:47 +0000
commit40fa83871e18bf7ff54f853e6b665f207ee8fb78 (patch)
tree01d9d3c2a627e1b38ed7451d0be89cb045692de7 /vcl/source/window
parent396b5f411f7ecc7d600efdc0bb2381a7d1ed6d88 (diff)
Move CommandInfoProvider to vcl and use it from there
Change-Id: If7e3ef81cad8974bc54f359096e3ecc700fa62d6 Reviewed-on: https://gerrit.libreoffice.org/19984 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/builder.cxx40
-rw-r--r--vcl/source/window/toolbox2.cxx5
2 files changed, 6 insertions, 39 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 09ed49e6fa64..40036983126b 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -43,6 +43,7 @@
#include <vcl/vclmedit.hxx>
#include <vcl/settings.hxx>
#include <vcl/slider.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <svdata.hxx>
#include <svids.hrc>
#include <window.h>
@@ -892,11 +893,11 @@ namespace
uno::Reference<frame::XModuleManager2> xModuleManager(frame::ModuleManager::create(xContext));
OUString aModuleId(xModuleManager->identify(rFrame));
- OUString aLabel(VclBuilder::getCommandProperty("Label", aCommand, xContext, aModuleId));
+ OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommand, rFrame));
if (!aLabel.isEmpty())
pButton->SetText(aLabel);
- OUString aTooltip(VclBuilder::getCommandProperty("Tooltip", aCommand, xContext, aModuleId));
+ OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommand, rFrame));
if (!aTooltip.isEmpty())
pButton->SetQuickHelpText(aTooltip);
@@ -2168,41 +2169,6 @@ void VclBuilder::reorderWithinParent(std::vector<vcl::Window*>& rChilds, bool bI
}
}
-OUString VclBuilder::getCommandProperty(const OUString& rProperty, const OUString& rCommand,
- const uno::Reference<uno::XComponentContext>& rContext, const OUString& rModuleId)
-{
- if (rCommand.isEmpty())
- return OUString();
-
- try
- {
- uno::Reference<container::XNameAccess> xUICommandLabels;
- uno::Reference<container::XNameAccess> xUICommandDescription(frame::theUICommandDescription::get(rContext));
-
- if ((xUICommandDescription->getByName(rModuleId) >>= xUICommandLabels) && xUICommandLabels.is())
- {
- uno::Sequence<beans::PropertyValue> aProperties;
- if (xUICommandLabels->getByName(rCommand) >>= aProperties)
- {
- for ( sal_Int32 i = 0; i < aProperties.getLength(); i++ )
- {
- if (aProperties[i].Name == rProperty)
- {
- OUString aLabel;
- if (aProperties[i].Value >>= aLabel)
- return aLabel;
- }
- }
- }
- }
- }
- catch (uno::Exception&)
- {
- }
-
- return OUString();
-}
-
Image VclBuilder::getCommandImage(const OUString& rCommand, bool bLarge,
const uno::Reference<uno::XComponentContext>& rContext, const uno::Reference<frame::XFrame>& rFrame,
const OUString& rModuleId)
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 0efb1f8cfa85..5bb123aa4742 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -32,6 +32,7 @@
#include <vcl/menu.hxx>
#include <vcl/settings.hxx>
#include <vcl/IconThemeInfo.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <svdata.hxx>
#include <brdwin.hxx>
@@ -606,8 +607,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::getCommandProperty("Label", rCommand, xContext, aModuleId));
- OUString aTooltip(VclBuilder::getCommandProperty("TooltipLabel", rCommand, xContext, aModuleId));
+ OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(rCommand, rFrame));
+ OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
Image aImage(VclBuilder::getCommandImage(rCommand, (GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE), xContext, rFrame, aModuleId));
// let's invent an ItemId