From 33cac418db78f64f7fa84b8e65c01c2b02cf17a7 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 29 May 2020 16:53:59 +0200 Subject: tdf#133498 Make native drawing of FormattedField work (again) Commit 2a694f9e0e7789b4b3b792a9eedd29366fa10c1c ("lok: fix the window type of the formatted field control", 2020-05-06) had introduced the new 'WindowType::FORMATTEDFIELD' and sets it for the 'FormattedField' control, instead of using the previous default value set in the 'SpinField' ctor, which is 'WindowType::SPINFIELD'. This commit adds the corresponding 'WindowType::FORMATTEDFIELD' cases relevant to make native drawing of the control work (again). Also map the corresponding accessibility roles. Change-Id: Ied0b0548c03dee3feaf1b6252c81b2a33b68b938 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95156 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/control/edit.cxx | 1 + vcl/source/control/spinfld.cxx | 1 + vcl/source/window/accessibility.cxx | 4 +++- vcl/source/window/brdwin.cxx | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index fe79d666f68a..000b660ca04a 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -954,6 +954,7 @@ ControlType Edit::ImplGetNativeControlType() const case WindowType::LONGCURRENCYFIELD: case WindowType::NUMERICFIELD: case WindowType::SPINFIELD: + case WindowType::FORMATTEDFIELD: if (pControl->GetStyle() & WB_SPIN) nCtrl = ControlType::Spinbox; else diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 175c0828a540..a5206cf72a4d 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -177,6 +177,7 @@ void ImplDrawSpinButton(vcl::RenderContext& rRenderContext, vcl::Window* pWindow case WindowType::LONGCURRENCYFIELD: case WindowType::NUMERICFIELD: case WindowType::SPINFIELD: + case WindowType::FORMATTEDFIELD: aControl = ControlType::Spinbox; break; default: diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index ba1cdca98492..ddcfd56aaa73 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -310,7 +310,8 @@ sal_uInt16 Window::getDefaultAccessibleRole() const case WindowType::METRICFIELD: case WindowType::CURRENCYFIELD: case WindowType::LONGCURRENCYFIELD: - case WindowType::SPINFIELD: nRole = accessibility::AccessibleRole::SPIN_BOX; break; + case WindowType::SPINFIELD: + case WindowType::FORMATTEDFIELD: nRole = accessibility::AccessibleRole::SPIN_BOX; break; case WindowType::TOOLBOX: nRole = accessibility::AccessibleRole::TOOL_BAR; break; case WindowType::STATUSBAR: nRole = accessibility::AccessibleRole::STATUS_BAR; break; @@ -410,6 +411,7 @@ OUString Window::getDefaultAccessibleName() const case WindowType::DATEFIELD: case WindowType::TIMEFIELD: case WindowType::SPINFIELD: + case WindowType::FORMATTEDFIELD: case WindowType::COMBOBOX: case WindowType::LISTBOX: diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index abfcd3ecf5b0..4195cf0bba95 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -470,6 +470,7 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei case WindowType::LONGCURRENCYFIELD: case WindowType::NUMERICFIELD: case WindowType::SPINFIELD: + case WindowType::FORMATTEDFIELD: case WindowType::CALCINPUTLINE: mbNWFBorder = true; if (pCtrl->GetStyle() & WB_SPIN) @@ -611,6 +612,7 @@ void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, c case WindowType::LONGCURRENCYFIELD: case WindowType::NUMERICFIELD: case WindowType::SPINFIELD: + case WindowType::FORMATTEDFIELD: case WindowType::CALCINPUTLINE: if (pCtrl->GetStyle() & WB_SPIN) aCtrlType = ControlType::Spinbox; -- cgit v1.2.3