summaryrefslogtreecommitdiff
path: root/svx/source/stbctrls/pszctrl.cxx
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/source/stbctrls/pszctrl.cxx
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/source/stbctrls/pszctrl.cxx')
-rw-r--r--svx/source/stbctrls/pszctrl.cxx31
1 files changed, 25 insertions, 6 deletions
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: */