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>
diff --git a/icon-themes/breeze/svx/res/adding-selection_10x22.png b/icon-themes/breeze/svx/res/adding-selection_10x22.png
new file mode 100644
index 0000000..3585193
--- /dev/null
+++ b/icon-themes/breeze/svx/res/adding-selection_10x22.png
Binary files differ
diff --git a/icon-themes/breeze/svx/res/block-selection_10x22.png b/icon-themes/breeze/svx/res/block-selection_10x22.png
new file mode 100644
index 0000000..4c12110
--- /dev/null
+++ b/icon-themes/breeze/svx/res/block-selection_10x22.png
Binary files differ
diff --git a/icon-themes/breeze/svx/res/extending-selection_10x22.png b/icon-themes/breeze/svx/res/extending-selection_10x22.png
new file mode 100644
index 0000000..22a24cf
--- /dev/null
+++ b/icon-themes/breeze/svx/res/extending-selection_10x22.png
Binary files differ
diff --git a/icon-themes/breeze/svx/res/standard-selection_10x22.png b/icon-themes/breeze/svx/res/standard-selection_10x22.png
new file mode 100644
index 0000000..bff93be
--- /dev/null
+++ b/icon-themes/breeze/svx/res/standard-selection_10x22.png
Binary files differ
diff --git a/icon-themes/colibre/svx/res/adding-selection_10x22.png b/icon-themes/colibre/svx/res/adding-selection_10x22.png
new file mode 100644
index 0000000..5e9ea98
--- /dev/null
+++ b/icon-themes/colibre/svx/res/adding-selection_10x22.png
Binary files differ
diff --git a/icon-themes/colibre/svx/res/block-selection_10x22.png b/icon-themes/colibre/svx/res/block-selection_10x22.png
new file mode 100644
index 0000000..d244dae
--- /dev/null
+++ b/icon-themes/colibre/svx/res/block-selection_10x22.png
Binary files differ
diff --git a/icon-themes/colibre/svx/res/extending-selection_10x22.png b/icon-themes/colibre/svx/res/extending-selection_10x22.png
new file mode 100644
index 0000000..2046a8f
--- /dev/null
+++ b/icon-themes/colibre/svx/res/extending-selection_10x22.png
Binary files differ
diff --git a/icon-themes/colibre/svx/res/standard-selection_10x22.png b/icon-themes/colibre/svx/res/standard-selection_10x22.png
new file mode 100644
index 0000000..051194b
--- /dev/null
+++ b/icon-themes/colibre/svx/res/standard-selection_10x22.png
Binary files differ
diff --git a/icon-themes/colibre_svg/svx/res/adding-selection_10x22.svg b/icon-themes/colibre_svg/svx/res/adding-selection_10x22.svg
new file mode 100644
index 0000000..61f25cf
--- /dev/null
+++ b/icon-themes/colibre_svg/svx/res/adding-selection_10x22.svg
@@ -0,0 +1 @@
<svg viewBox="0 0 22 10" xmlns="http://www.w3.org/2000/svg"><path d="m14 0v1h2v8h-2v1h5v-1h-2v-8h2v-1z" fill="#3a3a38"/><g fill="#1e8bcd"><path d="m8 2v6h-5v-6zm-1 1h-3v4h3z"/><path d="m14 2v6h-5v-6zm-1 1h-3v4h3z"/></g></svg>
\ No newline at end of file
diff --git a/icon-themes/colibre_svg/svx/res/block-selection_10x22.svg b/icon-themes/colibre_svg/svx/res/block-selection_10x22.svg
new file mode 100644
index 0000000..24430c6
--- /dev/null
+++ b/icon-themes/colibre_svg/svx/res/block-selection_10x22.svg
@@ -0,0 +1 @@
<svg viewBox="0 0 22 10" xmlns="http://www.w3.org/2000/svg"><path d="m14 0v1h2v8h-2v1h5v-1h-2v-8h2v-1z" fill="#3a3a38"/><path d="m12 2v6h-9v-6z" fill="#1e8bcd"/></svg>
\ No newline at end of file
diff --git a/icon-themes/colibre_svg/svx/res/extending-selection_10x22.svg b/icon-themes/colibre_svg/svx/res/extending-selection_10x22.svg
new file mode 100644
index 0000000..5a8b38b
--- /dev/null
+++ b/icon-themes/colibre_svg/svx/res/extending-selection_10x22.svg
@@ -0,0 +1 @@
<svg viewBox="0 0 22 10" xmlns="http://www.w3.org/2000/svg"><path d="m14 0v1h2v8h-2v1h5v-1h-2v-8h2v-1z" fill="#3a3a38"/><g fill="#1e8bcd"><path d="m11 2v6h-5v-6zm-1 1h-3v4h3z"/><path d="m12 2 3.5 3-3.5 3v-1.5l1.750616-1.5-1.750616-1.5z"/><path d="m5 2-3.5 3 3.5 3v-1.5l-1.750616-1.5 1.750616-1.5z"/></g></svg>
\ No newline at end of file
diff --git a/icon-themes/colibre_svg/svx/res/standard-selection_10x22.svg b/icon-themes/colibre_svg/svx/res/standard-selection_10x22.svg
new file mode 100644
index 0000000..9eb87700
--- /dev/null
+++ b/icon-themes/colibre_svg/svx/res/standard-selection_10x22.svg
@@ -0,0 +1 @@
<svg viewBox="0 0 22 10" xmlns="http://www.w3.org/2000/svg"><path d="m14 0v1h2v8h-2v1h5v-1h-2v-8h2v-1z" fill="#3a3a38"/><path d="m12 2v6h-9v-6zm-1 1h-7v4h7z" fill="#1e8bcd"/></svg>
\ No newline at end of file
diff --git a/include/svx/selctrl.hxx b/include/svx/selctrl.hxx
index 75d7f8c..4deea58 100644
--- a/include/svx/selctrl.hxx
+++ b/include/svx/selctrl.hxx
@@ -35,10 +35,11 @@ public:
const SfxPoolItem* pState) override;
virtual bool MouseButtonDown(const MouseEvent& rEvt) override;
virtual void Paint(const UserDrawEvent& rEvt) override;
virtual void Click() override;
private:
sal_uInt16 mnState;
Image maImage;
Image maImages[4];
bool mbFeatureEnabled;
};
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index 3a307cd..466c276 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -1289,6 +1289,7 @@
// To be shown in the status bar when in overwrite mode, please try to make it not longer than the word 'Overwrite'.
#define RID_SVXSTR_OVERWRITE_TEXT NC_("RID_SVXSTR_OVERWRITE_TEXT", "Overwrite")
#define RID_SVXSTR_INSERT_TEXT NC_("RID_SVXSTR_INSERT_TEXT", "Insert")
#define RID_SVXSTR_SELECTIONMODE_HELPTEXT NC_("RID_SVXSTR_SELECTIONMODE_HELPTEXT", "%1. Click to change selection mode.")
#define RID_SVXSTR_XMLSEC_SIG_OK NC_("RID_SVXSTR_XMLSEC_SIG_OK", "Digital Signature: The document signature is OK.")
#define RID_SVXSTR_XMLSEC_SIG_OK_NO_VERIFY NC_("RID_SVXSTR_XMLSEC_SIG_OK_NO_VERIFY", "Digital Signature: The document signature is OK, but the certificates could not be validated.")
#define RID_SVXSTR_XMLSEC_SIG_NOT_OK NC_("RID_SVXSTR_XMLSEC_SIG_NOT_OK", "Digital Signature: The document signature does not match the document content. We strongly recommend you not to trust this document.")
diff --git a/svx/inc/bitmaps.hlst b/svx/inc/bitmaps.hlst
index 684dba8..3bf9543 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 845df5a..6e56e22 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: */
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 3759e96..8600fa78 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1989,24 +1989,6 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq)
}
}
}
else
{
if( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
rSh.ToggleExtMode();
else if ( rSh.IsExtMode() )
{
rSh.ToggleExtMode();
rSh.ToggleAddMode();
}
else if ( rSh.IsAddMode() )
{
rSh.ToggleAddMode();
rSh.ToggleBlockMode();
}
else
rSh.ToggleBlockMode();
}
bUp = true;
break;
}