summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-08-16 15:33:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-08-16 21:40:17 +0200
commitc53f3f8f58f55d0978fb968446975856d72a52f8 (patch)
tree2ea9c7dc98b4e50e6af7b96853d7288a829f6438 /svx
parentdb7701a3072117e9808e73bc3a071b236daacfc5 (diff)
tdf#126819 Can't retrieve the mouse position written in the statusbar
regression from commit 77e260f915e0c77ddb1e915e9fd27ab0bdccc763 Date: Mon Jul 8 11:22:12 2019 +0200 tdf#121793 speedup VCLXAccessibleStatusBarItem::GetItemText Make the custom StatusBarControls set better text on their parent StatusBar. Also remove some unnecessary work being done in the Paint methods, to reduce confusion. Change-Id: I3b0a0af3b01d3b01f85ab335a3eb5993c07a50f4 Reviewed-on: https://gerrit.libreoffice.org/77586 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/stbctrls/insctrl.cxx1
-rw-r--r--svx/source/stbctrls/pszctrl.cxx31
-rw-r--r--svx/source/stbctrls/zoomctrl.cxx12
3 files changed, 33 insertions, 11 deletions
diff --git a/svx/source/stbctrls/insctrl.cxx b/svx/source/stbctrls/insctrl.cxx
index 952f82332f8e..eaad418e4909 100644
--- a/svx/source/stbctrls/insctrl.cxx
+++ b/svx/source/stbctrls/insctrl.cxx
@@ -65,7 +65,6 @@ void SvxInsertStatusBarControl::StateChanged( sal_uInt16 , SfxItemState eState,
void SvxInsertStatusBarControl::Paint( const UserDrawEvent& )
{
- DrawItemText_Impl();
}
void SvxInsertStatusBarControl::DrawItemText_Impl()
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index 474ca2c81f0d..06877c8f06e4 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -231,6 +231,7 @@ SvxPosSizeStatusBarControl::SvxPosSizeStatusBarControl( sal_uInt16 _nSlotId,
addStatusListener( STR_POSITION); // SID_ATTR_POSITION
addStatusListener( STR_TABLECELL); // SID_TABLE_CELL
addStatusListener( STR_FUNC); // SID_PSZ_FUNCTION
+ ImplUpdateItemText();
}
/* [Description]
@@ -334,12 +335,7 @@ void SvxPosSizeStatusBarControl::StateChanged( sal_uInt16 nSID, SfxItemState eSt
GetStatusBar().SetItemData( GetId(), nullptr );
- // set only strings as text at the statusBar, so that the Help-Tips
- // can work with the text, when it is too long for the statusBar
- OUString aText;
- if ( pImpl->bTable )
- aText = pImpl->aStr;
- GetStatusBar().SetItemText( GetId(), aText );
+ ImplUpdateItemText();
}
@@ -461,4 +457,27 @@ void SvxPosSizeStatusBarControl::Paint( const UserDrawEvent& rUsrEvt )
pDev->SetFillColor( aOldFillColor );
}
+void SvxPosSizeStatusBarControl::ImplUpdateItemText()
+{
+ // set only strings as text at the statusBar, so that the Help-Tips
+ // can work with the text, when it is too long for the statusBar
+ OUString aText;
+ if ( pImpl->bPos || pImpl->bSize )
+ {
+ aText = GetMetricStr_Impl( pImpl->aPos.X());
+ aText += " / ";
+ aText += GetMetricStr_Impl( pImpl->aPos.Y());
+ if ( pImpl->bSize )
+ {
+ aText += " ";
+ aText += GetMetricStr_Impl( pImpl->aSize.Width() );
+ aText += " x ";
+ aText += GetMetricStr_Impl( pImpl->aSize.Height() );
+ }
+ }
+ else if ( pImpl->bTable )
+ aText = pImpl->aStr;
+
+ GetStatusBar().SetItemText( GetId(), aText );
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx
index 421fdb64704d..bb019e4a4814 100644
--- a/svx/source/stbctrls/zoomctrl.cxx
+++ b/svx/source/stbctrls/zoomctrl.cxx
@@ -111,6 +111,7 @@ SvxZoomStatusBarControl::SvxZoomStatusBarControl( sal_uInt16 _nSlotId,
nValueSet( SvxZoomEnableFlags::ALL )
{
GetStatusBar().SetQuickHelpText(GetId(), SvxResId(RID_SVXSTR_ZOOMTOOL_HINT));
+ ImplUpdateItemText();
}
void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
@@ -124,9 +125,7 @@ void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
else if ( auto pItem = dynamic_cast< const SfxUInt16Item* >(pState) )
{
nZoom = pItem->GetValue();
-
- OUString aStr(unicode::formatPercent(nZoom, Application::GetSettings().GetUILanguageTag()));
- GetStatusBar().SetItemText( GetId(), aStr );
+ ImplUpdateItemText();
if ( auto pZoomItem = dynamic_cast<const SvxZoomItem*>(pState) )
{
@@ -140,12 +139,16 @@ void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
}
}
-void SvxZoomStatusBarControl::Paint( const UserDrawEvent& )
+void SvxZoomStatusBarControl::ImplUpdateItemText()
{
OUString aStr(unicode::formatPercent(nZoom, Application::GetSettings().GetUILanguageTag()));
GetStatusBar().SetItemText( GetId(), aStr );
}
+void SvxZoomStatusBarControl::Paint( const UserDrawEvent& )
+{
+}
+
void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
{
if ( CommandEventId::ContextMenu == rCEvt.GetCommand() && bool(nValueSet) )
@@ -156,6 +159,7 @@ void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
if (aPop.Execute(&rStatusbar, rCEvt.GetMousePosPixel()) && (nZoom != aPop.GetZoom() || !nZoom))
{
nZoom = aPop.GetZoom();
+ ImplUpdateItemText();
SvxZoomItem aZoom(SvxZoomType::PERCENT, nZoom, GetId());
OString sIdent = aPop.GetCurItemIdent();