summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-03-11 10:31:46 -0900
committerJim Raykowski <raykowj@gmail.com>2021-03-27 09:01:30 +0100
commite18b743a840475cfbdfba437a1edf8677a5f93bd (patch)
tree31de6f2e5c2ca2ba85b526e12fbef688ddea8146 /svx
parent30b85dd25836520c6e0f7a11887178f81d2cdc30 (diff)
tdf#140936 statusbar selection mode control improvements
- shows different image for each selection mode - tooltip indicates the current selection mode and mouse click hint - replaces left-click cycle selection mode with context menu popup Change-Id: Ieb2662de99cf42d4ada4c1a590bebc8363861c7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112367 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <rizmut@libreoffice.org>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/bitmaps.hlst5
-rw-r--r--svx/source/stbctrls/selctrl.cxx27
2 files changed, 24 insertions, 8 deletions
diff --git a/svx/inc/bitmaps.hlst b/svx/inc/bitmaps.hlst
index 684dba8772f4..3bf954339846 100644
--- a/svx/inc/bitmaps.hlst
+++ b/svx/inc/bitmaps.hlst
@@ -145,7 +145,10 @@
#define BMP_SQUARE "svx/res/symphony/Square.png"
#define BMP_LINEAR "svx/res/symphony/linear.png"
-#define RID_SVXBMP_SELECTION "svx/res/selection_10x22.png"
+#define RID_SVXBMP_STANDARD_SELECTION "svx/res/standard-selection_10x22.png"
+#define RID_SVXBMP_EXTENDING_SELECTION "svx/res/extending-selection_10x22.png"
+#define RID_SVXBMP_ADDING_SELECTION "svx/res/adding-selection_10x22.png"
+#define RID_SVXBMP_BLOCK_SELECTION "svx/res/block-selection_10x22.png"
#define RID_SVXBMP_POSITION "res/sc10223.png"
#define RID_SVXBMP_SIZE "res/sc10224.png"
#define RID_SVXBMP_SIGNET "svx/res/signet_11x16.png"
diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx
index 845df5a5d367..6e56e22f8d2f 100644
--- a/svx/source/stbctrls/selctrl.cxx
+++ b/svx/source/stbctrls/selctrl.cxx
@@ -36,6 +36,9 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <svx/strings.hrc>
+#include <svx/dialmgr.hxx>
+
SFX_IMPL_STATUSBAR_CONTROL(SvxSelectionModeControl, SfxUInt16Item);
namespace {
@@ -100,10 +103,12 @@ SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId,
StatusBar& rStb ) :
SfxStatusBarControl( _nSlotId, _nId, rStb ),
mnState( 0 ),
- maImage(StockImage::Yes, RID_SVXBMP_SELECTION),
+ maImages{Image(StockImage::Yes, RID_SVXBMP_STANDARD_SELECTION),
+ Image(StockImage::Yes, RID_SVXBMP_EXTENDING_SELECTION),
+ Image(StockImage::Yes, RID_SVXBMP_ADDING_SELECTION),
+ Image(StockImage::Yes, RID_SVXBMP_BLOCK_SELECTION)},
mbFeatureEnabled(false)
{
- GetStatusBar().SetItemText( GetId(), "" );
GetStatusBar().SetQuickHelpText(GetId(), u"");
}
@@ -116,15 +121,17 @@ void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState,
DBG_ASSERT( dynamic_cast< const SfxUInt16Item* >(pState) != nullptr, "invalid item type" );
const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pState);
mnState = pItem->GetValue();
-
SelectionTypePopup aPop(GetStatusBar().GetFrameWeld(), mnState);
- GetStatusBar().SetQuickHelpText(GetId(), aPop.GetItemTextForState(mnState));
+ GetStatusBar().SetQuickHelpText(GetId(),
+ SvxResId(RID_SVXSTR_SELECTIONMODE_HELPTEXT).
+ replaceFirst("%1", aPop.GetItemTextForState(mnState)));
+ GetStatusBar().Invalidate();
}
}
bool SvxSelectionModeControl::MouseButtonDown( const MouseEvent& rEvt )
{
- if (!mbFeatureEnabled || !rEvt.IsMiddle())
+ if (!mbFeatureEnabled)
return true;
::tools::Rectangle aRect(rEvt.GetPosPixel(), Size(1, 1));
@@ -165,6 +172,9 @@ bool SvxSelectionModeControl::MouseButtonDown( const MouseEvent& rEvt )
return true;
}
+void SvxSelectionModeControl::Click()
+{
+}
void SvxSelectionModeControl::Paint( const UserDrawEvent& rUsrEvt )
{
@@ -172,12 +182,15 @@ void SvxSelectionModeControl::Paint( const UserDrawEvent& rUsrEvt )
vcl::RenderContext* pDev = rUsrEvt.GetRenderContext();
tools::Rectangle aRect = rUsrEvt.GetRect();
- Size aImgSize( maImage.GetSizePixel() );
+ Size aImgSize( maImages[mnState].GetSizePixel() );
Point aPos( aRect.Left() + ( aControlRect.GetWidth() - aImgSize.Width() ) / 2,
aRect.Top() + ( aControlRect.GetHeight() - aImgSize.Height() ) / 2 );
- pDev->DrawImage(aPos, maImage, mbFeatureEnabled ? DrawImageFlags::NONE : DrawImageFlags::Disable);
+ if (mbFeatureEnabled)
+ pDev->DrawImage(aPos, maImages[mnState]);
+ else
+ pDev->DrawImage(aPos, Image());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */