summaryrefslogtreecommitdiff
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-23 18:04:21 +0200
commitcc730643359a000d61e8817fe0168e239678283d (patch)
treef63709588daa87717e8ae732fa079046117f5587
parentee5d2fe74a189d8986a9ea1441c0841347a2d3bc (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> (cherry picked from commit c53f3f8f58f55d0978fb968446975856d72a52f8) Reviewed-on: https://gerrit.libreoffice.org/77697 (cherry picked from commit 3638ac34cab9b8db8454267f53f43f216a373eda) Reviewed-on: https://gerrit.libreoffice.org/77705 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r--include/svx/pszctrl.hxx2
-rw-r--r--include/svx/zoomctrl.hxx2
-rw-r--r--sd/source/ui/app/tmplctrl.cxx1
-rw-r--r--svx/source/stbctrls/insctrl.cxx1
-rw-r--r--svx/source/stbctrls/pszctrl.cxx31
-rw-r--r--svx/source/stbctrls/zoomctrl.cxx12
-rw-r--r--sw/source/uibase/utlui/bookctrl.cxx1
-rw-r--r--sw/source/uibase/utlui/tmplctrl.cxx1
-rw-r--r--sw/source/uibase/utlui/zoomctrl.cxx6
9 files changed, 38 insertions, 19 deletions
diff --git a/include/svx/pszctrl.hxx b/include/svx/pszctrl.hxx
index d22e0ba05d18..faf8923d94cc 100644
--- a/include/svx/pszctrl.hxx
+++ b/include/svx/pszctrl.hxx
@@ -39,6 +39,8 @@ public:
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
virtual void Paint( const UserDrawEvent& rEvt ) override;
virtual void Command( const CommandEvent& rCEvt ) override;
+private:
+ void ImplUpdateItemText();
};
#endif
diff --git a/include/svx/zoomctrl.hxx b/include/svx/zoomctrl.hxx
index afd3130e2c20..e0daa4b971ca 100644
--- a/include/svx/zoomctrl.hxx
+++ b/include/svx/zoomctrl.hxx
@@ -40,6 +40,8 @@ public:
SvxZoomStatusBarControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
+private:
+ void ImplUpdateItemText();
};
class SVX_DLLPUBLIC SvxZoomPageStatusBarControl : public SfxStatusBarControl
diff --git a/sd/source/ui/app/tmplctrl.cxx b/sd/source/ui/app/tmplctrl.cxx
index 2c27db05bafb..c78f1a3ef126 100644
--- a/sd/source/ui/app/tmplctrl.cxx
+++ b/sd/source/ui/app/tmplctrl.cxx
@@ -89,7 +89,6 @@ void SdTemplateControl::StateChanged(
void SdTemplateControl::Paint( const UserDrawEvent& )
{
- GetStatusBar().SetItemText( GetId(), msTemplate );
}
void SdTemplateControl::Command( const CommandEvent& rCEvt )
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 34e0b26c5495..eac10c81fef6 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();
diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index c432e3c6b003..348ffb5f0297 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -96,7 +96,6 @@ void SwBookmarkControl::StateChanged(
void SwBookmarkControl::Paint( const UserDrawEvent& )
{
- GetStatusBar().SetItemText( GetId(), sPageNumber );
}
void SwBookmarkControl::Command( const CommandEvent& rCEvt )
diff --git a/sw/source/uibase/utlui/tmplctrl.cxx b/sw/source/uibase/utlui/tmplctrl.cxx
index 11b304d660be..2ab9883d231f 100644
--- a/sw/source/uibase/utlui/tmplctrl.cxx
+++ b/sw/source/uibase/utlui/tmplctrl.cxx
@@ -88,7 +88,6 @@ void SwTemplateControl::StateChanged(
void SwTemplateControl::Paint( const UserDrawEvent& )
{
- GetStatusBar().SetItemText( GetId(), sTemplate );
}
void SwTemplateControl::Command( const CommandEvent& rCEvt )
diff --git a/sw/source/uibase/utlui/zoomctrl.cxx b/sw/source/uibase/utlui/zoomctrl.cxx
index 967a98ffbf2e..c1e9e95c5140 100644
--- a/sw/source/uibase/utlui/zoomctrl.cxx
+++ b/sw/source/uibase/utlui/zoomctrl.cxx
@@ -56,12 +56,8 @@ void SwZoomControl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
}
}
-void SwZoomControl::Paint( const UserDrawEvent& rUsrEvt )
+void SwZoomControl::Paint( const UserDrawEvent& )
{
- if (sPreviewZoom.isEmpty())
- SvxZoomStatusBarControl::Paint(rUsrEvt);
- else
- GetStatusBar().SetItemText(GetId(), sPreviewZoom);
}
void SwZoomControl::Command( const CommandEvent& rCEvt )