diff options
-rw-r--r-- | include/svx/selctrl.hxx | 1 | ||||
-rw-r--r-- | svx/source/stbctrls/selctrl.cxx | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/include/svx/selctrl.hxx b/include/svx/selctrl.hxx index 2b32e56ede70..75d7f8cc3a84 100644 --- a/include/svx/selctrl.hxx +++ b/include/svx/selctrl.hxx @@ -39,6 +39,7 @@ public: private: sal_uInt16 mnState; Image maImage; + bool mbFeatureEnabled; }; #endif diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx index 2b028e0d71d3..845df5a5d367 100644 --- a/svx/source/stbctrls/selctrl.cxx +++ b/svx/source/stbctrls/selctrl.cxx @@ -100,15 +100,18 @@ SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId, StatusBar& rStb ) : SfxStatusBarControl( _nSlotId, _nId, rStb ), mnState( 0 ), - maImage(StockImage::Yes, RID_SVXBMP_SELECTION) + maImage(StockImage::Yes, RID_SVXBMP_SELECTION), + mbFeatureEnabled(false) { GetStatusBar().SetItemText( GetId(), "" ); + GetStatusBar().SetQuickHelpText(GetId(), u""); } void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState ) { - if ( SfxItemState::DEFAULT == eState ) + mbFeatureEnabled = SfxItemState::DEFAULT == eState; + if (mbFeatureEnabled) { DBG_ASSERT( dynamic_cast< const SfxUInt16Item* >(pState) != nullptr, "invalid item type" ); const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pState); @@ -121,8 +124,8 @@ void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState, bool SvxSelectionModeControl::MouseButtonDown( const MouseEvent& rEvt ) { - if (!rEvt.IsMiddle()) - return false; + if (!mbFeatureEnabled || !rEvt.IsMiddle()) + return true; ::tools::Rectangle aRect(rEvt.GetPosPixel(), Size(1, 1)); weld::Window* pPopupParent = weld::GetPopupParent(GetStatusBar(), aRect); @@ -174,7 +177,7 @@ void SvxSelectionModeControl::Paint( const UserDrawEvent& rUsrEvt ) Point aPos( aRect.Left() + ( aControlRect.GetWidth() - aImgSize.Width() ) / 2, aRect.Top() + ( aControlRect.GetHeight() - aImgSize.Height() ) / 2 ); - pDev->DrawImage( aPos, maImage ); + pDev->DrawImage(aPos, maImage, mbFeatureEnabled ? DrawImageFlags::NONE : DrawImageFlags::Disable); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |