summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-04 17:20:12 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-11-05 11:20:00 +0100
commit663aab4c2dd5d64d49b91a30cfa8f057729eae36 (patch)
tree78f20506486b2d6b3af9affe9afb7e10a0c70254
parent91c5642bf0ee48ff91181d779c3a84c768f340df (diff)
use XGraphic instead of Image
we don't appear to use the Icon in our own code, though there may be a route to set it from an extension or via config Change-Id: I5e169db6335a8e64aeb3d2e6672f5a4b7c65c57f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105309 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/sfx2/sidebar/TabBar.hxx2
-rw-r--r--sfx2/inc/sidebar/TitleBar.hxx2
-rw-r--r--sfx2/inc/sidebar/Tools.hxx4
-rw-r--r--sfx2/source/sidebar/TabBar.cxx4
-rw-r--r--sfx2/source/sidebar/Theme.cxx2
-rw-r--r--sfx2/source/sidebar/TitleBar.cxx4
-rw-r--r--sfx2/source/sidebar/Tools.cxx18
7 files changed, 22 insertions, 14 deletions
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index 1f24d98059df..84ec840a7575 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -109,7 +109,7 @@ private:
PopupMenuProvider maPopupMenuProvider;
VclPtr<RadioButton> CreateTabItem (const DeckDescriptor& rDeckDescriptor);
- Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;
+ css::uno::Reference<css::graphic::XGraphic> GetItemImage(const DeckDescriptor& rDeskDescriptor) const;
void Layout();
void UpdateButtonIcons();
diff --git a/sfx2/inc/sidebar/TitleBar.hxx b/sfx2/inc/sidebar/TitleBar.hxx
index 917a09cda416..e1029b54ee30 100644
--- a/sfx2/inc/sidebar/TitleBar.hxx
+++ b/sfx2/inc/sidebar/TitleBar.hxx
@@ -36,7 +36,7 @@ public:
void SetTitle (const OUString& rsTitle);
const OUString& GetTitle() const {return msTitle; }
- void SetIcon (const Image& rIcon);
+ void SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon);
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override;
diff --git a/sfx2/inc/sidebar/Tools.hxx b/sfx2/inc/sidebar/Tools.hxx
index 97611a7a6b18..b5c0c693713c 100644
--- a/sfx2/inc/sidebar/Tools.hxx
+++ b/sfx2/inc/sidebar/Tools.hxx
@@ -36,12 +36,12 @@ namespace sfx2::sidebar {
class Tools
{
public:
- static Image GetImage (
+ static css::uno::Reference<css::graphic::XGraphic> GetImage(
const OUString& rsImageURL,
const OUString& rsHighContrastImageURL,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- static Image GetImage (
+ static css::uno::Reference<css::graphic::XGraphic> GetImage(
const OUString& rsURL,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 4f49bd461364..7c8d98c7ff7d 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -150,7 +150,7 @@ void TabBar::UpdateButtonIcons()
if (xDeckDescriptor)
{
- aImage = GetItemImage(*xDeckDescriptor);
+ aImage = Image(GetItemImage(*xDeckDescriptor));
item.mpButton->SetModeImage(aImage);
}
}
@@ -292,7 +292,7 @@ VclPtr<RadioButton> TabBar::CreateTabItem(const DeckDescriptor& rDeckDescriptor)
return pItem;
}
-Image TabBar::GetItemImage(const DeckDescriptor& rDeckDescriptor) const
+css::uno::Reference<css::graphic::XGraphic> TabBar::GetItemImage(const DeckDescriptor& rDeckDescriptor) const
{
return Tools::GetImage(
rDeckDescriptor.msIconURL,
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index ce32455b0093..51a0debdc997 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -954,7 +954,7 @@ void Theme::ProcessNewValue (
OUString sURL;
if (rValue >>= sURL)
{
- maImages[nIndex] = Tools::GetImage(sURL, nullptr);
+ maImages[nIndex] = Image(Tools::GetImage(sURL, nullptr));
}
break;
}
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index c9dd0011b176..55aefc0f2725 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -60,9 +60,9 @@ void TitleBar::SetTitle(const OUString& rsTitle)
Invalidate();
}
-void TitleBar::SetIcon(const Image& rIcon)
+void TitleBar::SetIcon(const css::uno::Reference<css::graphic::XGraphic>& rIcon)
{
- maIcon = rIcon;
+ maIcon = Image(rIcon);
Invalidate();
}
diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx
index 382914d8baba..ef9dce06cab6 100644
--- a/sfx2/source/sidebar/Tools.cxx
+++ b/sfx2/source/sidebar/Tools.cxx
@@ -21,6 +21,7 @@
#include <sfx2/sidebar/Theme.hxx>
+#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/processfactory.hxx>
#include <vcl/commandinfoprovider.hxx>
#include <vcl/gradient.hxx>
@@ -29,13 +30,14 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/graphic/GraphicProvider.hpp>
using namespace css;
using namespace css::uno;
namespace sfx2::sidebar {
-Image Tools::GetImage (
+css::uno::Reference<css::graphic::XGraphic> Tools::GetImage(
const OUString& rsImageURL,
const OUString& rsHighContrastImageURL,
const Reference<frame::XFrame>& rxFrame)
@@ -46,19 +48,25 @@ Image Tools::GetImage (
return GetImage(rsImageURL, rxFrame);
}
-Image Tools::GetImage (
+css::uno::Reference<css::graphic::XGraphic> Tools::GetImage(
const OUString& rsURL,
const Reference<frame::XFrame>& rxFrame)
{
if (rsURL.getLength() > 0)
{
if (rsURL.startsWith(".uno:"))
- return vcl::CommandInfoProvider::GetImageForCommand(rsURL, rxFrame);
+ return vcl::CommandInfoProvider::GetXGraphicForCommand(rsURL, rxFrame);
else
- return Image(rsURL);
+ {
+ Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
+ Reference<graphic::XGraphicProvider> xProvider(graphic::GraphicProvider::create(xContext));
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put("URL", rsURL);
+ return xProvider->queryGraphic(aMediaProperties.getPropertyValues());
+ }
}
- return Image();
+ return nullptr;
}
css::awt::Gradient Tools::VclToAwtGradient (const Gradient& rVclGradient)