summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-05-06 10:25:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-05-06 10:27:18 +0100
commit27d94c482e82ea5d4f202109614c6fb3578fb0a4 (patch)
tree852f57d13cd96e1bb9308c6a7fb0bdfd75c906c7
parentea593a29006e71e25071aaf01c838e5da632adf0 (diff)
color bar doesn't fill tool item
since commit b8f21298288890d52c06fef6c84441634c56c986 Author: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> Date: Mon Mar 2 20:57:32 2015 +0900 the color bar is always drawn under the icon and doesn't get drawn to the right and fill all the empty space of the tool item, e.g. in impress see the new toolbar color selector Change-Id: Ib70fec9c933b9d743e67475899938a5d9f405496
-rw-r--r--include/vcl/toolbox.hxx3
-rw-r--r--svx/source/tbxctrls/tbxcolorupdate.cxx4
-rw-r--r--vcl/source/window/toolbox2.cxx12
3 files changed, 17 insertions, 2 deletions
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index f6a4f14cd199..9c94f80e58d8 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -379,6 +379,9 @@ public:
Rectangle GetItemRect( sal_uInt16 nItemId ) const;
Rectangle GetItemPosRect( sal_uInt16 nPos ) const;
+ /// Returns size of the bitmap / text that is inside this toolbox item.
+ Size GetItemContentSize( sal_uInt16 nItemId ) const;
+
/// Retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown)
Point GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const;
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index ff4dc5e53050..5f1a186c26f1 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -79,8 +79,7 @@ namespace svx
void ToolboxButtonColorUpdater::Update(const Color& rColor)
{
Image aImage(mpTbx->GetItemImageOriginal(mnBtnId));
- BitmapEx aSource(aImage.GetBitmapEx());
- Size aItemSize = aSource.GetSizePixel();
+ Size aItemSize(mpTbx->GetItemContentSize(mnBtnId));
const bool bSizeChanged = (maBmpSize != aItemSize);
const bool bDisplayModeChanged = (mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode());
@@ -101,6 +100,7 @@ namespace svx
sal_uInt8 nAlpha = 255;
BitmapEx aBmpEx(Bitmap(aItemSize, 24), AlphaMask(aItemSize, &nAlpha));
+ BitmapEx aSource(aImage.GetBitmapEx());
long nWidth = std::min(aItemSize.Width(), aSource.GetSizePixel().Width());
long nHeight = std::min(aItemSize.Height(), aSource.GetSizePixel().Height());
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index e209fd22a0c7..13e77ef69eff 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -935,6 +935,18 @@ sal_uInt16 ToolBox::GetItemId( const Point& rPos ) const
return 0;
}
+Size ToolBox::GetItemContentSize( sal_uInt16 nItemId ) const
+{
+ if ( mbCalc || mbFormat )
+ ((ToolBox*)this)->ImplFormat();
+
+ sal_uInt16 nPos = GetItemPos( nItemId );
+ if ( nPos < mpData->m_aItems.size() )
+ return mpData->m_aItems[nPos].maContentSize;
+ else
+ return Size();
+}
+
sal_uInt16 ToolBox::GetItemId(const OUString &rCommand) const
{
if (!mpData)