summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-10-30 16:24:37 +0100
committerTomaž Vajngerl <quikee@gmail.com>2016-10-30 18:00:05 +0000
commitb1426b5b502fd591402d666994e3f1fb3a8ad959 (patch)
tree3614d896993b004e805f9714a126070ec5d5c29f /vcl
parent17b1ebbf86ceabe2e9cabf9626ca94fae3fb9216 (diff)
tdf#95014 initial support for 32 px icons in toolbar
This adds support for 32 pixel icons - mainly to get them into the toolbar. Most changes made are to change the behavior of having only small and large icons as a boolean choice, but not every code path was converted to non-boolean choice yet. Breeze icon theme has the 32px variants so it can be used already. Change-Id: Iadf832a87826c16b3a83522104dd6c35d61a0f87 Reviewed-on: https://gerrit.libreoffice.org/30398 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/bitmap/CommandImageResolver.cxx3
-rw-r--r--vcl/source/helper/commandinfoprovider.cxx10
-rw-r--r--vcl/source/window/builder.cxx2
-rw-r--r--vcl/source/window/menu.cxx2
-rw-r--r--vcl/source/window/toolbox2.cxx12
5 files changed, 21 insertions, 8 deletions
diff --git a/vcl/source/bitmap/CommandImageResolver.cxx b/vcl/source/bitmap/CommandImageResolver.cxx
index 90a5044e00d4..a165adfee9db 100644
--- a/vcl/source/bitmap/CommandImageResolver.cxx
+++ b/vcl/source/bitmap/CommandImageResolver.cxx
@@ -24,7 +24,8 @@ namespace
static const o3tl::enumarray<ImageType, const char*> ImageType_Prefixes =
{
"cmd/sc_",
- "cmd/lc_"
+ "cmd/lc_",
+ "cmd/32/"
};
OUString lclConvertToCanonicalName(const OUString& rFileName)
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 2b23821fc7f7..764326027707 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -211,8 +211,9 @@ OUString CommandInfoProvider::GetRealCommandForCommand(const OUString& rCommandN
return GetCommandProperty("TargetURL", rCommandName);
}
-Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName, bool bLarge,
- const Reference<frame::XFrame>& rxFrame)
+Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName,
+ const Reference<frame::XFrame>& rxFrame,
+ vcl::ImageType eImageType)
{
SetFrame(rxFrame);
@@ -220,8 +221,11 @@ Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName, boo
return Image();
sal_Int16 nImageType(ui::ImageType::COLOR_NORMAL | ui::ImageType::SIZE_DEFAULT);
- if (bLarge)
+
+ if (eImageType == vcl::ImageType::Size26)
nImageType |= ui::ImageType::SIZE_LARGE;
+ else if (eImageType == vcl::ImageType::Size32)
+ nImageType |= ui::ImageType::SIZE_32;
try
{
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 1c6db662a738..a3d626964eaf 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -890,7 +890,7 @@ namespace
if (!aTooltip.isEmpty())
pButton->SetQuickHelpText(aTooltip);
- Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, /*bLarge=*/ false, rFrame));
+ Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, rFrame));
pButton->SetModeImage(aImage);
pButton->SetCommandHandler(aCommand);
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index fbc6ac1eb40a..1c88c73b53c6 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -513,7 +513,7 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f
{
OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame));
OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
- Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, /*bLarge=*/ false, rFrame));
+ Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, rFrame));
InsertItem(nItemId, aLabel, aImage);
SetHelpText(nItemId, aTooltip);
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 5336f227703f..983fa1fbddf9 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -436,8 +436,16 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css
{
OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(rCommand, rFrame));
OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
- Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(
- rCommand, (GetToolboxButtonSize() == ToolBoxButtonSize::Large), rFrame));
+
+ vcl::ImageType eImageType = vcl::ImageType::Size16;
+
+ if (GetToolboxButtonSize() == ToolBoxButtonSize::Large)
+ eImageType = vcl::ImageType::Size26;
+ else if (GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
+ eImageType = vcl::ImageType::Size32;
+
+ CommandInfoProvider& rInfoProvider = vcl::CommandInfoProvider::Instance();
+ Image aImage(rInfoProvider.GetImageForCommand(rCommand, rFrame, eImageType));
sal_uInt16 nItemId = GetItemCount() + 1;
InsertItem(nItemId, aImage, aLabel, nBits, nPos);