From d60bc5d0827247797811d766aafb7d26a502152f Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 3 Jul 2020 19:48:46 +0100 Subject: clarify this arg is to determine if its a spinbutton or entry variant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If102441312bf0c6d27462535268e79242bcde48c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97894 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- svx/source/fmcomp/gridcell.cxx | 26 +++++++++++++------------- svx/source/inc/gridcell.hxx | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'svx') diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 4a2a452b3ecb..2a4213ffcede 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -1851,20 +1851,19 @@ DbSpinField::DbSpinField( DbGridColumn& _rColumn, sal_Int16 _nStandardAlign ) { } - void DbSpinField::Init( vcl::Window& _rParent, const Reference< XRowSet >& _rxCursor ) { m_rColumn.SetAlignmentFromModel( m_nStandardAlign ); Reference< XPropertySet > xModel( m_rColumn.getModel() ); - // determine the WinBits for the field - WinBits nFieldStyle = 0; + // determine if we need a spinbutton version + bool bSpinButton(false); if ( ::comphelper::getBOOL( xModel->getPropertyValue( FM_PROP_SPIN ) ) ) - nFieldStyle = WB_REPEAT | WB_SPIN; + bSpinButton = true; // create the fields - m_pWindow = createField( &_rParent, nFieldStyle, xModel ); - m_pPainter = createField( &_rParent, nFieldStyle, xModel ); + m_pWindow = createField( &_rParent, bSpinButton, xModel ); + m_pPainter = createField( &_rParent, bSpinButton, xModel ); // adjust all other settings which depend on the property values implAdjustGenericFieldSetting( xModel ); @@ -1873,7 +1872,6 @@ void DbSpinField::Init( vcl::Window& _rParent, const Reference< XRowSet >& _rxCu DbCellControl::Init( _rParent, _rxCursor ); } - CellControllerRef DbSpinField::CreateController() const { return new SpinCellController( static_cast< SpinField* >( m_pWindow.get() ) ); @@ -1946,8 +1944,9 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe rPaintFormatter.SetFormat( sFormatString, aAppLanguage ); } -VclPtr DbNumericField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ ) +VclPtr DbNumericField::createField( vcl::Window* _pParent, bool bSpinButton, const Reference< XPropertySet >& /*_rxModel*/ ) { + WinBits _nFieldStyle = bSpinButton ? (WB_REPEAT | WB_SPIN) : 0; return VclPtr::Create( _pParent, _nFieldStyle ); } @@ -2074,8 +2073,9 @@ void DbCurrencyField::implAdjustGenericFieldSetting( const Reference< XPropertyS } -VclPtr DbCurrencyField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ ) +VclPtr DbCurrencyField::createField( vcl::Window* _pParent, bool bSpinButton, const Reference< XPropertySet >& /*_rxModel*/ ) { + WinBits _nFieldStyle = bSpinButton ? (WB_REPEAT | WB_SPIN) : 0; return VclPtr::Create( _pParent, _nFieldStyle ); } @@ -2179,8 +2179,9 @@ DbDateField::DbDateField( DbGridColumn& _rColumn ) doPropertyListening( FM_PROP_DATE_SHOW_CENTURY ); } -VclPtr DbDateField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& _rxModel ) +VclPtr DbDateField::createField( vcl::Window* _pParent, bool bSpinButton, const Reference< XPropertySet >& _rxModel ) { + WinBits _nFieldStyle = bSpinButton ? (WB_REPEAT | WB_SPIN) : 0; // check if there is a DropDown property set to TRUE bool bDropDown = !hasProperty( FM_PROP_DROPDOWN, _rxModel ) || getBOOL( _rxModel->getPropertyValue( FM_PROP_DROPDOWN ) ); @@ -2305,13 +2306,12 @@ DbTimeField::DbTimeField( DbGridColumn& _rColumn ) doPropertyListening( FM_PROP_STRICTFORMAT ); } - -VclPtr DbTimeField::createField( vcl::Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ ) +VclPtr DbTimeField::createField( vcl::Window* _pParent, bool bSpinButton, const Reference< XPropertySet >& /*_rxModel*/ ) { + WinBits _nFieldStyle = bSpinButton ? (WB_REPEAT | WB_SPIN) : 0; return VclPtr::Create( _pParent, _nFieldStyle ); } - void DbTimeField::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel ) { DBG_ASSERT( m_pWindow, "DbTimeField::implAdjustGenericFieldSetting: not to be called without window!" ); diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index 2e43144fcb1d..2491152cbf0d 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -547,7 +547,7 @@ public: protected: virtual VclPtr createField( vcl::Window* _pParent, - WinBits _nFieldStyle, + bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) = 0; }; @@ -568,7 +568,7 @@ protected: // DbSpinField virtual VclPtr createField( vcl::Window* _pParent, - WinBits _nFieldStyle, + bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; @@ -592,7 +592,7 @@ protected: // DbSpinField virtual VclPtr createField( vcl::Window* _pParent, - WinBits _nFieldStyle, + bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; @@ -620,7 +620,7 @@ protected: // DbSpinField virtual VclPtr createField( vcl::Window* _pParent, - WinBits _nFieldStyle, + bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; @@ -644,7 +644,7 @@ protected: // DbSpinField virtual VclPtr createField( vcl::Window* _pParent, - WinBits _nFieldStyle, + bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; -- cgit