[Libreoffice-commits] core.git: 7 commits - include/svtools include/vcl svtools/source svx/source vcl/inc vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Wed Mar 4 19:59:40 PST 2015
include/svtools/tabbar.hxx | 52 +++++------
include/vcl/toolbox.hxx | 14 +--
svtools/source/control/tabbar.cxx | 9 +
svx/source/tbxctrls/tbxcolorupdate.cxx | 150 ++++++++++++++++-----------------
vcl/inc/toolbox.h | 2
vcl/source/window/toolbox.cxx | 17 +--
vcl/source/window/toolbox2.cxx | 65 +++++++-------
7 files changed, 152 insertions(+), 157 deletions(-)
New commits:
commit 78be86343bc6ee91fffe3b710f7db3a90f1b23ae
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed Mar 4 20:21:19 2015 +0900
use "using" to redirect to subclass method in toolbox
Change-Id: Ic07cfef8aa6f27ccc4dce23736a3de1a41698838
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index c72c59f..7c4799a 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -493,15 +493,10 @@ public:
bool IsCustomize() { return mbCustomize; }
bool IsInCustomizeMode() const { return mbCustomizeMode; }
- void SetHelpText( const OUString& rText )
- { DockingWindow::SetHelpText( rText ); }
- const OUString& GetHelpText() const
- { return DockingWindow::GetHelpText(); }
-
- void SetHelpId( const OString& rId )
- { DockingWindow::SetHelpId( rId ); }
- const OString& GetHelpId() const
- { return DockingWindow::GetHelpId(); }
+ using DockingWindow::SetHelpText;
+ using DockingWindow::GetHelpText;
+ using DockingWindow::SetHelpId;
+ using DockingWindow::GetHelpId;
void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
const Link& GetClickHdl() const { return maClickHdl; }
commit b73fbf4cf68d61b7b46a3ee488c4ea5c360540bd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue Mar 3 11:22:59 2015 +0900
HiDPI: increase toolbar drag handle hit area width
Change-Id: I8aab6d2990ef5910039ab1ae984d22c6ed699f71
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 9157459..038c472 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -146,7 +146,7 @@ int ToolBox::ImplGetDragWidth( ToolBox* pThis )
{
#define TB_DRAGWIDTH 8 // the default width of the grip
- int width = TB_DRAGWIDTH;
+ int nWidth = TB_DRAGWIDTH;
if( pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) )
{
@@ -158,10 +158,14 @@ int ToolBox::ImplGetDragWidth( ToolBox* pThis )
if ( pThis->GetNativeControlRegion(CTRL_TOOLBAR, pThis->mbHorz ? PART_THUMB_VERT : PART_THUMB_HORZ,
aArea, ControlState::NONE, aControlValue, OUString(), aBound, aContent) )
{
- width = pThis->mbHorz ? aContent.GetWidth() : aContent.GetHeight();
+ nWidth = pThis->mbHorz ? aContent.GetWidth() : aContent.GetHeight();
}
}
- return width;
+
+ // increase the hit area of the drag handle according to DPI scale factor
+ nWidth *= pThis->GetDPIScaleFactor();
+
+ return nWidth;
}
ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType )
commit 4d3ba6eeed42083e9c3f3a0dcfa4c77cbed9a146
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue Mar 3 11:02:40 2015 +0900
tabbar: clean-up header - bitfields to bool, using, ...
Change-Id: I78abbf8e3956ad48c2af0266d7f686dda8b6cccb
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
index 675999d..87cdb9b 100644
--- a/include/svtools/tabbar.hxx
+++ b/include/svtools/tabbar.hxx
@@ -33,10 +33,7 @@ class ImplTabSizer;
class TabBarEdit;
struct ImplTabBarItem;
-typedef ::std::vector< ImplTabBarItem* > ImplTabBarList;
-
-
-
+typedef std::vector<ImplTabBarItem*> ImplTabBarList;
/*
@@ -342,20 +339,22 @@ private:
sal_uInt16 mnDropPos;
sal_uInt16 mnSwitchId;
sal_uInt16 mnEditId;
- bool mbFormat;
- bool mbFirstFormat;
- bool mbSizeFormat;
- bool mbAutoMaxWidth;
- bool mbInSwitching;
- bool mbAutoEditMode;
- bool mbEditCanceled;
- bool mbDropPos;
- bool mbInSelect;
- bool mbSelColor;
- bool mbSelTextColor;
- bool mbMirrored;
- bool mbHasInsertTab; // if true, the tab bar has an extra tab at the end.
- bool mbScrollAlwaysEnabled;
+
+ bool mbFormat : 1;
+ bool mbFirstFormat : 1;
+ bool mbSizeFormat : 1;
+ bool mbAutoMaxWidth : 1;
+ bool mbInSwitching : 1;
+ bool mbAutoEditMode : 1;
+ bool mbEditCanceled : 1;
+ bool mbDropPos : 1;
+ bool mbInSelect : 1;
+ bool mbSelColor : 1;
+ bool mbSelTextColor : 1;
+ bool mbMirrored : 1;
+ bool mbHasInsertTab : 1; // if true, the tab bar has an extra tab at the end.
+ bool mbScrollAlwaysEnabled : 1;
+
Link maSelectHdl;
Link maSplitHdl;
Link maScrollAreaContextHdl;
@@ -378,7 +377,8 @@ private:
SVT_DLLPRIVATE void ImplPrePaint();
SVT_DLLPRIVATE ImplTabBarItem* ImplGetLastTabBarItem( sal_uInt16 nItemCount );
SVT_DLLPRIVATE Rectangle ImplGetInsertTabRect(ImplTabBarItem* pItem) const;
- DECL_DLLPRIVATE_LINK( ImplClickHdl, ImplTabButton* );
+
+ DECL_DLLPRIVATE_LINK( ImplClickHdl, ImplTabButton* );
ImplTabBarItem* seek( size_t i );
ImplTabBarItem* prev();
@@ -499,14 +499,10 @@ public:
long GetSplitSize() const { return mnSplitSize; }
- void SetHelpText( const OUString& rText )
- { Window::SetHelpText( rText ); }
- OUString GetHelpText() const
- { return Window::GetHelpText(); };
- void SetHelpId( const OString& rId )
- { Window::SetHelpId( rId ); }
- const OString& GetHelpId() const
- { return Window::GetHelpId(); }
+ using Window::SetHelpText;
+ using Window::GetHelpText;
+ using Window::SetHelpId;
+ using Window::GetHelpId;
void SetStyle( WinBits nStyle );
WinBits GetStyle() const { return mnWinStyle; }
@@ -520,7 +516,7 @@ public:
void SetScrollAreaContextHdl( const Link& rLink ) { maScrollAreaContextHdl = rLink; }
// accessibility
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
+ virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() SAL_OVERRIDE;
};
#endif // INCLUDED_SVTOOLS_TABBAR_HXX
commit cfab9854f1f0b133169a50528354f19ad37d87fc
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Tue Mar 3 10:44:03 2015 +0900
add margin before/after button handles in tabbar
Change-Id: Id9b16fc4168febd217a2d263a158daca85fdea38
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 2477d8c..217174c 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -42,6 +42,7 @@ namespace {
const sal_uInt16 ADDNEWPAGE_AREAWIDTH = 10;
const sal_uInt16 INSERT_TAB_WIDTH = 32;
+const sal_uInt16 BUTTON_MARGIN = 6;
} // anonymous namespace
@@ -1442,9 +1443,13 @@ void TabBar::Resize()
// adapt font height?
ImplInitSettings( true, false );
- long nX = mbMirrored ? (aNewSize.Width()-nHeight) : 0;
+ long nButtonMargin = BUTTON_MARGIN * GetDPIScaleFactor();
+
+ long nX = mbMirrored ? (aNewSize.Width() - nHeight - nButtonMargin) : nButtonMargin;
long nXDiff = mbMirrored ? -nHeight : nHeight;
+ nButtonWidth += nButtonMargin;
+
Size aBtnSize( nHeight, nHeight );
if ( mpFirstBtn )
{
@@ -1471,6 +1476,8 @@ void TabBar::Resize()
nButtonWidth += nHeight;
}
+ nButtonWidth += nButtonMargin;
+
// store size
maWinSize = aNewSize;
commit b8f21298288890d52c06fef6c84441634c56c986
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 2 20:57:32 2015 +0900
toolbox - preserve the orig. image + use it in menu & color update
In toolbox the images are scaled for HiDPI, which causes various
problems. This change preserves the original image and uses that
when adding images into the menu and also uses that when updating
the color related toolbox-es.
Change-Id: Ib7e7d82ccb1cd774e0e14dd6bab5626eaefea097
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 44b4b8c..c72c59f 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -401,6 +401,7 @@ public:
void* GetItemData( sal_uInt16 nItemId ) const;
void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
Image GetItemImage( sal_uInt16 nItemId ) const;
+ Image GetItemImageOriginal( sal_uInt16 nItemId ) const;
void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror );
void SetItemText( sal_uInt16 nItemId, const OUString& rText );
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 3c9a1ef..27f9de9 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -78,8 +78,9 @@ namespace svx
void ToolboxButtonColorUpdater::Update(const Color& rColor)
{
- Image aImage(mpTbx->GetItemImage(mnBtnId));
- Size aItemSize(mpTbx->GetItemContentSize(mnBtnId));
+ Image aImage(mpTbx->GetItemImageOriginal(mnBtnId));
+ BitmapEx aSource(aImage.GetBitmapEx());
+ Size aItemSize = aSource.GetSizePixel();
const bool bSizeChanged = (maBmpSize != aItemSize);
const bool bDisplayModeChanged = (mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode());
@@ -99,7 +100,7 @@ namespace svx
// (so that it grows in case the original bitmap was smaller)
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/inc/toolbox.h b/vcl/inc/toolbox.h
index 2b23c53..935d118 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -40,6 +40,7 @@ struct ImplToolItem
vcl::Window* mpWindow;
void* mpUserData;
Image maImage;
+ Image maImageOriginal;
long mnImageAngle;
bool mbMirrorMode;
OUString maText;
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index dd675dc..1758850 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1125,7 +1125,12 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
{
Image aImage(rImage);
- if ( GetDPIScaleFactor() > 1)
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ Size aOldSize = pItem->maImage.GetSizePixel();
+
+ pItem->maImageOriginal = aImage;
+
+ if (GetDPIScaleFactor() > 1)
{
BitmapEx aBitmap(aImage.GetBitmapEx());
@@ -1138,19 +1143,16 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
}
}
- ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ pItem->maImage = aImage;
+
// only once all is calculated, do extra work
- if ( !mbCalc )
+ if (!mbCalc)
{
- Size aOldSize = pItem->maImage.GetSizePixel();
- pItem->maImage = aImage;
- if ( aOldSize != pItem->maImage.GetSizePixel() )
+ if (aOldSize != pItem->maImage.GetSizePixel())
ImplInvalidate( true );
else
ImplUpdateItem( nPos );
}
- else
- pItem->maImage = aImage;
}
}
@@ -1196,14 +1198,15 @@ void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 )
if( nDeltaAngle && !!pItem->maImage )
{
pItem->maImage = ImplRotImage( pItem->maImage, nDeltaAngle );
+ pItem->maImageOriginal = ImplRotImage( pItem->maImageOriginal, nDeltaAngle );
}
- if ( !mbCalc )
+ if (!mbCalc)
{
- if ( aOldSize != pItem->maImage.GetSizePixel() )
- ImplInvalidate( true );
+ if (aOldSize != pItem->maImage.GetSizePixel())
+ ImplInvalidate(true);
else
- ImplUpdateItem( nPos );
+ ImplUpdateItem(nPos);
}
}
}
@@ -1226,30 +1229,32 @@ void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror )
{
ImplToolItem* pItem = &mpData->m_aItems[nPos];
- if( ( pItem->mbMirrorMode && ! bMirror ) ||
- ( ! pItem->mbMirrorMode && bMirror )
- )
+ if ((pItem->mbMirrorMode && !bMirror) ||
+ (!pItem->mbMirrorMode && bMirror))
{
pItem->mbMirrorMode = bMirror;
- if( !!pItem->maImage )
+ if (!!pItem->maImage)
{
- pItem->maImage = ImplMirrorImage( pItem->maImage );
+ pItem->maImage = ImplMirrorImage(pItem->maImage);
+ pItem->maImageOriginal = ImplMirrorImage(pItem->maImageOriginal);
}
- if ( !mbCalc )
- ImplUpdateItem( nPos );
+ if (!mbCalc)
+ ImplUpdateItem(nPos);
}
}
}
-Image ToolBox::GetItemImage( sal_uInt16 nItemId ) const
+Image ToolBox::GetItemImage(sal_uInt16 nItemId) const
{
- ImplToolItem* pItem = ImplGetItem( nItemId );
+ ImplToolItem* pItem = ImplGetItem(nItemId);
+ return pItem ? pItem->maImage : Image();
+}
- if ( pItem )
- return pItem->maImage;
- else
- return Image();
+Image ToolBox::GetItemImageOriginal(sal_uInt16 nItemId) const
+{
+ ImplToolItem* pItem = ImplGetItem(nItemId);
+ return pItem ? pItem->maImageOriginal : Image();
}
void ToolBox::SetItemText( sal_uInt16 nItemId, const OUString& rText )
@@ -1830,7 +1835,7 @@ void ToolBox::UpdateCustomMenu()
if( it->IsClipped() )
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
- pMenu->InsertItem( id, it->maText, it->maImage, MenuItemBits::NONE, OString());
+ pMenu->InsertItem( id, it->maText, it->maImageOriginal, MenuItemBits::NONE, OString());
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem ( id, it->meState == TRISTATE_TRUE );
}
@@ -1846,7 +1851,7 @@ void ToolBox::UpdateCustomMenu()
if( it->IsItemHidden() )
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
- pMenu->InsertItem( id, it->maText, it->maImage, MenuItemBits::NONE, OString() );
+ pMenu->InsertItem( id, it->maText, it->maImageOriginal, MenuItemBits::NONE, OString() );
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem( id, it->meState == TRISTATE_TRUE );
}
commit 2c40b082b585d0d4429f3f6915cf96a8f7914448
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 2 20:45:07 2015 +0900
code cleanup in tbxcolorupdate.cxx
Change-Id: I671e59bab5bc649cc12026647531f8612eec394b
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 62a0224..3c9a1ef 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -27,12 +27,8 @@
#include <vcl/settings.hxx>
#include <tools/debug.hxx>
-
namespace svx
{
-
-
-
//= ToolboxButtonColorUpdater
/* Note:
@@ -45,74 +41,70 @@ namespace svx
*/
ToolboxButtonColorUpdater::ToolboxButtonColorUpdater(
- sal_uInt16 nId,
- sal_uInt16 nTbxBtnId,
- ToolBox* ptrTbx) :
- mnBtnId ( nTbxBtnId ),
- mnSlotId ( nId ),
- mpTbx ( ptrTbx ),
- maCurColor ( COL_TRANSPARENT )
+ sal_uInt16 nId, sal_uInt16 nTbxBtnId, ToolBox* pToolBox)
+ : mnBtnId(nTbxBtnId)
+ , mnSlotId(nId)
+ , mpTbx(pToolBox)
+ , maCurColor(COL_TRANSPARENT)
{
- DBG_ASSERT( ptrTbx, "ToolBox not found :-(" );
- mbWasHiContrastMode = ptrTbx ? ( ptrTbx->GetSettings().GetStyleSettings().GetHighContrastMode() ) : sal_False;
- switch( mnSlotId )
+ DBG_ASSERT(pToolBox, "ToolBox not found :-(");
+ mbWasHiContrastMode = pToolBox ? pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode() : false;
+ switch (mnSlotId)
{
- case SID_ATTR_CHAR_COLOR :
- case SID_ATTR_CHAR_COLOR2 :
- Update( COL_RED );
+ case SID_ATTR_CHAR_COLOR:
+ case SID_ATTR_CHAR_COLOR2:
+ Update(COL_RED);
break;
- case SID_FRAME_LINECOLOR :
- Update( COL_BLUE );
+ case SID_FRAME_LINECOLOR:
+ Update(COL_BLUE);
break;
- case SID_ATTR_CHAR_COLOR_BACKGROUND :
- case SID_BACKGROUND_COLOR :
- Update( COL_YELLOW );
+ case SID_ATTR_CHAR_COLOR_BACKGROUND:
+ case SID_BACKGROUND_COLOR:
+ Update(COL_YELLOW);
break;
case SID_ATTR_LINE_COLOR:
- Update( COL_BLACK );
+ Update(COL_BLACK);
break;
case SID_ATTR_FILL_COLOR:
- Update( COL_DEFAULT_SHAPE_FILLING );
+ Update(COL_DEFAULT_SHAPE_FILLING);
break;
- default :
- Update( COL_TRANSPARENT );
+ default:
+ Update(COL_TRANSPARENT);
}
}
-
-
ToolboxButtonColorUpdater::~ToolboxButtonColorUpdater()
- {
- }
-
+ {}
-
- void ToolboxButtonColorUpdater::Update( const Color& rColor )
+ void ToolboxButtonColorUpdater::Update(const Color& rColor)
{
- Image aImage( mpTbx->GetItemImage( mnBtnId ) );
- Size aItemSize( mpTbx->GetItemContentSize( mnBtnId ) );
+ Image aImage(mpTbx->GetItemImage(mnBtnId));
+ Size aItemSize(mpTbx->GetItemContentSize(mnBtnId));
- const bool bSizeChanged = ( maBmpSize != aItemSize );
- const bool bDisplayModeChanged = ( mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode() );
- Color aColor( rColor );
+ const bool bSizeChanged = (maBmpSize != aItemSize);
+ const bool bDisplayModeChanged = (mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode());
+ Color aColor(rColor);
// !!! #109290# Workaround for SetFillColor with COL_AUTO
- if( aColor.GetColor() == COL_AUTO )
- aColor = Color( COL_TRANSPARENT );
+ if (aColor.GetColor() == COL_AUTO)
+ aColor = Color(COL_TRANSPARENT);
// For a shape selected in 'Draw', when color selected in Sidebar > Line > Color
// is COL_BLACK, then (maCurColor != aColor) becomes 'false', therefore we take
// explicit care of COL_BLACK from the last argument in the condition so that the
// Update() does its routine job appropriately !
- if( ( maCurColor != aColor ) || bSizeChanged || bDisplayModeChanged || ( aColor == COL_BLACK ) )
+ if ((maCurColor != aColor) || bSizeChanged || bDisplayModeChanged || (aColor == COL_BLACK))
{
// create an empty bitmap, and copy the original bitmap inside
// (so that it grows in case the original bitmap was smaller)
sal_uInt8 nAlpha = 255;
- BitmapEx aBmpEx( Bitmap( aItemSize, 24 ), AlphaMask( aItemSize, &nAlpha ) );
- BitmapEx aSource( aImage.GetBitmapEx() );
- Rectangle aRect( Point( 0, 0 ),
- Size( std::min( aItemSize.Width(), aSource.GetSizePixel().Width() ), std::min( aItemSize.Height(), aSource.GetSizePixel().Height() ) ) );
+ 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());
+
+ Rectangle aRect(Point(0, 0), Size(nWidth, nHeight));
+
aBmpEx.CopyPixel( aRect, aRect, &aSource );
Bitmap aBmp( aBmpEx.GetBitmap() );
@@ -120,33 +112,41 @@ namespace svx
maBmpSize = aBmp.GetSizePixel();
- if( pBmpAcc )
+ if (pBmpAcc)
{
Bitmap aMsk;
BitmapWriteAccess* pMskAcc;
- if( aBmpEx.IsAlpha() )
- pMskAcc = ( aMsk = aBmpEx.GetAlpha().GetBitmap() ).AcquireWriteAccess();
- else if( aBmpEx.IsTransparent() )
- pMskAcc = ( aMsk = aBmpEx.GetMask() ).AcquireWriteAccess();
+ if (aBmpEx.IsAlpha())
+ {
+ aMsk = aBmpEx.GetAlpha().GetBitmap();
+ pMskAcc = aMsk.AcquireWriteAccess();
+ }
+ else if (aBmpEx.IsTransparent())
+ {
+ aMsk = aBmpEx.GetMask();
+ pMskAcc = aMsk.AcquireWriteAccess();
+ }
else
+ {
pMskAcc = NULL;
+ }
mbWasHiContrastMode = mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode();
- if( ( COL_TRANSPARENT != aColor.GetColor() ) && ( maBmpSize.Width() == maBmpSize.Height() ) )
- pBmpAcc->SetLineColor( aColor );
+ if ((COL_TRANSPARENT != aColor.GetColor()) && (maBmpSize.Width() == maBmpSize.Height()))
+ pBmpAcc->SetLineColor(aColor);
else if( mpTbx->GetBackground().GetColor().IsDark() )
- pBmpAcc->SetLineColor( Color( COL_WHITE ) );
+ pBmpAcc->SetLineColor(Color(COL_WHITE));
else
- pBmpAcc->SetLineColor( Color( COL_BLACK ) );
+ pBmpAcc->SetLineColor(Color(COL_BLACK));
// use not only COL_TRANSPARENT for detection of transparence,
// but the method/way which is designed to do that
const bool bIsTransparent(0xff == aColor.GetTransparency());
maCurColor = aColor;
- if(bIsTransparent)
+ if (bIsTransparent)
{
pBmpAcc->SetFillColor();
}
@@ -155,45 +155,42 @@ namespace svx
pBmpAcc->SetFillColor(maCurColor);
}
- if( maBmpSize.Width() == maBmpSize.Height() )
- maUpdRect = Rectangle( Point( 0, maBmpSize.Height() * 3 / 4 ), Size( maBmpSize.Width(), maBmpSize.Height() / 4 ) );
+ if (maBmpSize.Width() == maBmpSize.Height())
+ maUpdRect = Rectangle(Point( 0, maBmpSize.Height() * 3 / 4), Size(maBmpSize.Width(), maBmpSize.Height() / 4));
else
- maUpdRect = Rectangle( Point( maBmpSize.Height() + 2, 2 ), Point( maBmpSize.Width() - 3, maBmpSize.Height() - 3 ) );
+ maUpdRect = Rectangle(Point( maBmpSize.Height() + 2, 2), Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3));
- pBmpAcc->DrawRect( maUpdRect );
+ pBmpAcc->DrawRect(maUpdRect);
- if( pMskAcc )
+ if (pMskAcc)
{
- if( bIsTransparent )
+ if (bIsTransparent)
{
- pMskAcc->SetLineColor( COL_BLACK );
- pMskAcc->SetFillColor( COL_WHITE );
+ pMskAcc->SetLineColor(COL_BLACK);
+ pMskAcc->SetFillColor(COL_WHITE);
}
else
- pMskAcc->SetFillColor( COL_BLACK );
+ pMskAcc->SetFillColor(COL_BLACK);
- pMskAcc->DrawRect( maUpdRect );
+ pMskAcc->DrawRect(maUpdRect);
}
- aBmp.ReleaseAccess( pBmpAcc );
+ aBmp.ReleaseAccess(pBmpAcc);
- if( pMskAcc )
- aMsk.ReleaseAccess( pMskAcc );
+ if (pMskAcc)
+ aMsk.ReleaseAccess(pMskAcc);
- if( aBmpEx.IsAlpha() )
- aBmpEx = BitmapEx( aBmp, AlphaMask( aMsk ) );
- else if( aBmpEx.IsTransparent() )
- aBmpEx = BitmapEx( aBmp, aMsk );
+ if (aBmpEx.IsAlpha())
+ aBmpEx = BitmapEx(aBmp, AlphaMask(aMsk));
+ else if (aBmpEx.IsTransparent())
+ aBmpEx = BitmapEx(aBmp, aMsk);
else
aBmpEx = aBmp;
- mpTbx->SetItemImage( mnBtnId, Image( aBmpEx ) );
+ mpTbx->SetItemImage(mnBtnId, Image(aBmpEx));
}
}
}
-
-
} // namespace svx
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0451615fc181367f8c318c94205495ebbbcd671e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Mon Mar 2 18:29:19 2015 +0900
remove maHighImage from toolbox as it is unused (no setter)
Change-Id: I5feaae01fd22252654caba34097d77f75134e045
diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h
index 56e08ad..2b23c53 100644
--- a/vcl/inc/toolbox.h
+++ b/vcl/inc/toolbox.h
@@ -40,7 +40,6 @@ struct ImplToolItem
vcl::Window* mpWindow;
void* mpUserData;
Image maImage;
- Image maHighImage;
long mnImageAngle;
bool mbMirrorMode;
OUString maText;
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index cb2b3f5..9157459 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3114,12 +3114,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint,
if ( bImage && ! bLayout )
{
- const Image* pImage;
- if ( (nHighlight != 0) && !!(pItem->maHighImage) )
- pImage = &(pItem->maHighImage);
- else
- pImage = &(pItem->maImage);
-
+ const Image* pImage = &(pItem->maImage);
aImageSize = pImage->GetSizePixel();
// determine drawing flags
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 247aaef..dd675dc 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -135,7 +135,6 @@ ImplToolItem::ImplToolItem( const ImplToolItem& rItem ) :
mpWindow ( rItem.mpWindow ),
mpUserData ( rItem.mpUserData ),
maImage ( rItem.maImage ),
- maHighImage ( rItem.maHighImage ),
mnImageAngle ( rItem.mnImageAngle ),
mbMirrorMode ( rItem.mbMirrorMode ),
maText ( rItem.maText ),
@@ -173,7 +172,6 @@ ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem )
mpWindow = rItem.mpWindow;
mpUserData = rItem.mpUserData;
maImage = rItem.maImage;
- maHighImage = rItem.maHighImage;
mnImageAngle = rItem.mnImageAngle;
mbMirrorMode = rItem.mbMirrorMode;
maText = rItem.maText;
@@ -1198,8 +1196,6 @@ void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 )
if( nDeltaAngle && !!pItem->maImage )
{
pItem->maImage = ImplRotImage( pItem->maImage, nDeltaAngle );
- if( !!pItem->maHighImage )
- pItem->maHighImage = ImplRotImage( pItem->maHighImage, nDeltaAngle );
}
if ( !mbCalc )
@@ -1238,8 +1234,6 @@ void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror )
if( !!pItem->maImage )
{
pItem->maImage = ImplMirrorImage( pItem->maImage );
- if( !!pItem->maHighImage )
- pItem->maHighImage = ImplMirrorImage( pItem->maHighImage );
}
if ( !mbCalc )
More information about the Libreoffice-commits
mailing list