vcl/inc/hyperlabel.hxx | 12 ++++-- vcl/source/control/hyperlabel.cxx | 66 ++++++++++++-------------------------- 2 files changed, 28 insertions(+), 50 deletions(-)
New commits: commit f2b0fd132a52796a89d0c0b3f46b3d32d08c3bea Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Oct 29 20:07:08 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Oct 30 08:57:27 2020 +0100 remove pimpl from HyperLabel Change-Id: Iaf156065b85a0a809946236148a85d768ca5f51b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105026 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/inc/hyperlabel.hxx b/vcl/inc/hyperlabel.hxx index 5ff87d878465..d12cbd405db2 100644 --- a/vcl/inc/hyperlabel.hxx +++ b/vcl/inc/hyperlabel.hxx @@ -25,11 +25,8 @@ namespace vcl { - class HyperLabelImpl; - class HyperLabel final : public FixedText { - std::unique_ptr<HyperLabelImpl> m_pImpl; Link<HyperLabel*,void> maClickHdl; virtual void MouseMove( const MouseEvent& rMEvt ) override; @@ -44,7 +41,6 @@ namespace vcl public: HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle ); virtual ~HyperLabel( ) override; - virtual void dispose() override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; @@ -62,7 +58,13 @@ namespace vcl void SetClickHdl( const Link<HyperLabel*,void>& rLink ) { maClickHdl = rLink; } - Size const & CalcMinimumSize( tools::Long nMaxWidth ) const; + Size const & CalcMinimumSize( tools::Long nMaxWidth ); + private: + sal_Int16 ID; + sal_Int32 Index; + bool bInteractive; + Size m_aMinSize; + bool m_bHyperMode; }; } diff --git a/vcl/source/control/hyperlabel.cxx b/vcl/source/control/hyperlabel.cxx index d3afea1ce848..34f10750ae2b 100644 --- a/vcl/source/control/hyperlabel.cxx +++ b/vcl/source/control/hyperlabel.cxx @@ -25,42 +25,24 @@ namespace vcl { - class HyperLabelImpl - { - public: - sal_Int16 ID; - sal_Int32 Index; - bool bInteractive; - Size m_aMinSize; - bool m_bHyperMode; - - HyperLabelImpl(); - }; - - - HyperLabelImpl::HyperLabelImpl() - : ID(0) + HyperLabel::HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle ) + :FixedText( _pParent, _nWinStyle ) + , ID(0) , Index(0) , bInteractive(false) , m_bHyperMode(false) - { - } - - HyperLabel::HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle ) - :FixedText( _pParent, _nWinStyle ) - ,m_pImpl( new HyperLabelImpl ) { implInit(); } - Size const & HyperLabel::CalcMinimumSize( tools::Long nMaxWidth ) const + Size const & HyperLabel::CalcMinimumSize( tools::Long nMaxWidth ) { - m_pImpl->m_aMinSize = FixedText::CalcMinimumSize( nMaxWidth ); + m_aMinSize = FixedText::CalcMinimumSize( nMaxWidth ); // the MinimumSize is used to size the FocusRectangle // and for the MouseMove method - m_pImpl->m_aMinSize.AdjustHeight(2 ); - m_pImpl->m_aMinSize.AdjustWidth(1 ); - return m_pImpl->m_aMinSize; + m_aMinSize.AdjustHeight(2 ); + m_aMinSize.AdjustWidth(1 ); + return m_aMinSize; } void HyperLabel::implInit() @@ -84,14 +66,14 @@ namespace vcl vcl::Font aFont = GetControlFont( ); bool bHyperMode = false; - if (!rMEvt.IsLeaveWindow() && IsEnabled() && m_pImpl->bInteractive) + if (!rMEvt.IsLeaveWindow() && IsEnabled() && bInteractive) { Point aPoint = GetPointerPosPixel(); - if (aPoint.X() < m_pImpl->m_aMinSize.Width()) + if (aPoint.X() < m_aMinSize.Width()) bHyperMode = true; } - m_pImpl->m_bHyperMode = bHyperMode; + m_bHyperMode = bHyperMode; if (bHyperMode) { aFont.SetUnderline(LINESTYLE_SINGLE); @@ -107,7 +89,7 @@ namespace vcl void HyperLabel::MouseButtonDown( const MouseEvent& ) { - if ( m_pImpl->m_bHyperMode && m_pImpl->bInteractive ) + if ( m_bHyperMode && bInteractive ) { maClickHdl.Call( this ); } @@ -115,10 +97,10 @@ namespace vcl void HyperLabel::GetFocus() { - if ( IsEnabled() && m_pImpl->bInteractive ) + if ( IsEnabled() && bInteractive ) { Point aPoint(0,0); - tools::Rectangle rRect(aPoint, Size( m_pImpl->m_aMinSize.Width(), GetSizePixel().Height() ) ); + tools::Rectangle rRect(aPoint, Size( m_aMinSize.Width(), GetSizePixel().Height() ) ); ShowFocus( rRect ); } } @@ -133,35 +115,29 @@ namespace vcl disposeOnce(); } - void HyperLabel::dispose() - { - m_pImpl.reset(); - FixedText::dispose(); - } - void HyperLabel::SetInteractive( bool _bInteractive ) { - m_pImpl->bInteractive = ( _bInteractive && IsEnabled() ); + bInteractive = ( _bInteractive && IsEnabled() ); } sal_Int16 HyperLabel::GetID() const { - return m_pImpl->ID; + return ID; } sal_Int32 HyperLabel::GetIndex() const { - return m_pImpl->Index; + return Index; } - void HyperLabel::SetID( sal_Int16 ID ) + void HyperLabel::SetID( sal_Int16 newID ) { - m_pImpl->ID = ID; + this->ID = newID; } - void HyperLabel::SetIndex( sal_Int32 Index ) + void HyperLabel::SetIndex( sal_Int32 newIndex ) { - m_pImpl->Index = Index; + Index = newIndex; } void HyperLabel::SetLabel( const OUString& _rText ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits