diff options
-rw-r--r-- | framework/source/fwe/classes/addonsoptions.cxx | 2 | ||||
-rw-r--r-- | include/vcl/toolbox.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 5 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 24 |
4 files changed, 20 insertions, 13 deletions
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index c3013e4a2532..fc11b4e4c803 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -475,7 +475,7 @@ bool AddonsOptions_Impl::GetMergeToolbarInstructions( static Image ScaleImage( const Image &rImage, bool bBig ) { - Size aSize = ToolBox::GetDefaultImageSize(bBig); + Size aSize = ToolBox::GetDefaultImageSize(bBig ? ToolBoxButtonSize::Large : ToolBoxButtonSize::Small); BitmapEx aScaleBmp(rImage.GetBitmapEx()); SAL_INFO("fwk", "Addons: expensive scale image from " << aScaleBmp.GetSizePixel() << " to " << aSize); diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 03319ba57f26..f2881b8fbc01 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -502,7 +502,7 @@ public: // if an index is found the corresponding item id is filled in (else 0) long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const; - static Size GetDefaultImageSize(bool bLarge); + static Size GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize); Size GetDefaultImageSize() const; void ChangeHighlight( sal_uInt16 nPos ); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 6ad9c21822fe..5095ef21ed45 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1671,9 +1671,8 @@ bool ToolBox::ImplCalcItem() long nDropDownArrowWidth = TB_DROPDOWNARROWWIDTH; // set defaults if image or text is needed but empty - float fDPIScaleFactor = GetDPIScaleFactor(); - nDefWidth = GetDefaultImageSize().Width() * fDPIScaleFactor; - nDefHeight = GetDefaultImageSize().Height() * fDPIScaleFactor; + nDefWidth = GetDefaultImageSize().Width(); + nDefHeight = GetDefaultImageSize().Height(); mnWinHeight = 0; // determine minimum size necessary in NWF diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 38d8dd7a4531..73af1121e980 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -633,20 +633,28 @@ ToolBoxButtonSize ToolBox::GetToolboxButtonSize() const return mpData->meButtonSize; } -/*static*/ Size ToolBox::GetDefaultImageSize(bool bLarge) +/*static*/ Size ToolBox::GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize) { - const long TB_SMALLIMAGESIZE = 16; - if (!bLarge) { - return Size(TB_SMALLIMAGESIZE, TB_SMALLIMAGESIZE); - } + float fScaleFactor = Application::GetDefaultDevice()->GetDPIScaleFactor(); + + Size aUnscaledSize = Size(16, 16); - OUString iconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); - return vcl::IconThemeInfo::SizeByThemeName(iconTheme); + if (eToolBoxButtonSize == ToolBoxButtonSize::Large) + { + OUString iconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); + aUnscaledSize = vcl::IconThemeInfo::SizeByThemeName(iconTheme); + } + else if (eToolBoxButtonSize == ToolBoxButtonSize::Size32) + { + aUnscaledSize = Size(32, 32); + } + return Size(aUnscaledSize.Width() * fScaleFactor, + aUnscaledSize.Height() * fScaleFactor); } Size ToolBox::GetDefaultImageSize() const { - return GetDefaultImageSize( GetToolboxButtonSize() == ToolBoxButtonSize::Large ); + return GetDefaultImageSize(GetToolboxButtonSize()); } void ToolBox::SetAlign( WindowAlign eNewAlign ) |