diff options
author | Adrien Ollier <adr.ollier@hotmail.fr> | 2019-11-26 20:17:11 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-07 15:13:59 +0100 |
commit | 7ae70706ad3a3e3aa86fbc7cbd1fcc28f0d2e1b2 (patch) | |
tree | 7122ee3eb57437f152cad0c6b3897a9498ee1a2f /vcl | |
parent | 1de13cab5d38173975af13ed77c8091258be4c01 (diff) |
Use virtual method instead of switch in parent class
Change-Id: I53129ed6b57eb13898a426de0a2ba72c7d6674de
Signed-off-by: Adrien Ollier <adr.ollier@hotmail.fr>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/83825
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/button.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/window3.cxx | 24 |
2 files changed, 5 insertions, 23 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 715752c146c4..e35ab9de4ef6 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2739,7 +2739,7 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, DrawButtonFlags return pSVData->maCtrlData.maRadioImgList[nIndex]; } -void RadioButton::ImplSetMinimumNWFSize() +void RadioButton::ImplAdjustNWFSizes() { Push( PushFlags::MAPMODE ); SetMapMode(MapMode(MapUnit::MapPixel)); @@ -3579,7 +3579,7 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFl return pSVData->maCtrlData.maCheckImgList[nIndex]; } -void CheckBox::ImplSetMinimumNWFSize() +void CheckBox::ImplAdjustNWFSizes() { Push( PushFlags::MAPMODE ); SetMapMode(MapMode(MapUnit::MapPixel)); diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index c3412e0dda46..565a81eb292e 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -19,7 +19,6 @@ #include <vcl/window.hxx> #include <vcl/waitobj.hxx> -#include <vcl/button.hxx> #include <window.h> WaitObject::~WaitObject() @@ -37,26 +36,9 @@ Size Window::GetOptimalSize() const void Window::ImplAdjustNWFSizes() { - switch( GetType() ) - { - case WindowType::CHECKBOX: - static_cast<CheckBox*>(this)->ImplSetMinimumNWFSize(); - break; - case WindowType::RADIOBUTTON: - static_cast<RadioButton*>(this)->ImplSetMinimumNWFSize(); - break; - default: - { - // iterate over children - vcl::Window* pWin = GetWindow( GetWindowType::FirstChild ); - while( pWin ) - { - pWin->ImplAdjustNWFSizes(); - pWin = pWin->GetWindow( GetWindowType::Next ); - } - } - break; - } + for (Window* pWin = GetWindow(GetWindowType::FirstChild); pWin; + pWin = pWin->GetWindow(GetWindowType::Next)) + pWin->ImplAdjustNWFSizes(); } void Window::ImplClearFontData(bool bNewFontLists) |