[Libreoffice-commits] core.git: include/vcl vcl/source
Adrien Ollier (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 7 14:14:34 UTC 2020
include/vcl/button.hxx | 4 ++--
include/vcl/window.hxx | 2 +-
vcl/source/control/button.cxx | 4 ++--
vcl/source/window/window3.cxx | 24 +++---------------------
4 files changed, 8 insertions(+), 26 deletions(-)
New commits:
commit 7ae70706ad3a3e3aa86fbc7cbd1fcc28f0d2e1b2
Author: Adrien Ollier <adr.ollier at hotmail.fr>
AuthorDate: Tue Nov 26 20:17:11 2019 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Jan 7 15:13:59 2020 +0100
Use virtual method instead of switch in parent class
Change-Id: I53129ed6b57eb13898a426de0a2ba72c7d6674de
Signed-off-by: Adrien Ollier <adr.ollier at hotmail.fr>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/83825
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index be4ccb334a6b..d0aa24757ae1 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -307,7 +307,6 @@ protected:
public:
SAL_DLLPRIVATE void ImplCallClick( bool bGrabFocus = false, GetFocusFlags nFocusFlags = GetFocusFlags::NONE );
- SAL_DLLPRIVATE void ImplSetMinimumNWFSize();
protected:
virtual void FillLayoutData() const override;
@@ -315,6 +314,7 @@ protected:
GetCanonicalFont( const StyleSettings& _rStyle ) const override;
virtual const Color&
GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+ void ImplAdjustNWFSizes() override;
public:
explicit RadioButton( vcl::Window* pParent, WinBits nWinStyle = 0 );
@@ -418,6 +418,7 @@ protected:
virtual void FillLayoutData() const override;
virtual const vcl::Font& GetCanonicalFont( const StyleSettings& _rStyle ) const override;
virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const override;
+ void ImplAdjustNWFSizes() override;
virtual void ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext);
SAL_DLLPRIVATE const tools::Rectangle& GetStateRect() const { return maStateRect; }
@@ -425,7 +426,6 @@ protected:
public:
SAL_DLLPRIVATE void ImplCheck();
- SAL_DLLPRIVATE void ImplSetMinimumNWFSize();
public:
explicit CheckBox( vcl::Window* pParent, WinBits nStyle = 0 );
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 8c87a78510cb..8ea622a8898e 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -748,7 +748,7 @@ protected:
void ImplRefreshFontData(bool bNewFontLists) override;
// FIXME: this is a hack to workaround missing layout functionality
- SAL_DLLPRIVATE void ImplAdjustNWFSizes();
+ virtual void ImplAdjustNWFSizes();
virtual void CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate) override;
virtual void ClipToPaintRegion( tools::Rectangle& rDstRect ) override;
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)
More information about the Libreoffice-commits
mailing list