diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-04 12:52:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-08-04 15:05:30 +0200 |
commit | 5a925ea8bb0cb305ac05a4f39113465295d1c600 (patch) | |
tree | 3a8fb2898cd5493942aaae9d408cd3c2a6e0b706 /svx | |
parent | 0330b1a591be25b857af65606f9b2db328e93580 (diff) |
establish that DbCellControl Window member is always a ControlBase
and remove resulting known redundant dynamic_casting
Change-Id: I5f098ef1adee3ad5d2a2bc5fcd30523f980df2f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119999
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 24 | ||||
-rw-r--r-- | svx/source/inc/gridcell.hxx | 14 |
2 files changed, 16 insertions, 22 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index cb5129e89326..9b28ac4043a7 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -801,16 +801,12 @@ void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxMode if ( !(m_pWindow && _rxModel.is()) ) return; - ControlBase* pEditWindow = dynamic_cast<ControlBase*>(m_pWindow.get()); - if ( pEditWindow ) + bool bReadOnly = m_rColumn.IsReadOnly(); + if ( !bReadOnly ) { - bool bReadOnly = m_rColumn.IsReadOnly(); - if ( !bReadOnly ) - { - _rxModel->getPropertyValue( i_bReadOnly ? OUString(FM_PROP_READONLY) : OUString(FM_PROP_ISREADONLY)) >>= bReadOnly; - } - pEditWindow->SetEditableReadOnly(bReadOnly); + _rxModel->getPropertyValue( i_bReadOnly ? OUString(FM_PROP_READONLY) : OUString(FM_PROP_ISREADONLY)) >>= bReadOnly; } + m_pWindow->SetEditableReadOnly(bReadOnly); } void DbCellControl::implAdjustEnabled( const Reference< XPropertySet >& _rxModel ) @@ -1920,7 +1916,7 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe rPaintFormatter.SetFormat( sFormatString, aAppLanguage ); } -VclPtr<Control> DbNumericField::createField(BrowserDataWin* pParent, bool bSpinButton, const Reference<XPropertySet>& /*rxModel*/) +VclPtr<svt::ControlBase> DbNumericField::createField(BrowserDataWin* pParent, bool bSpinButton, const Reference<XPropertySet>& /*rxModel*/) { return VclPtr<DoubleNumericControl>::Create(pParent, bSpinButton); } @@ -2040,7 +2036,7 @@ void DbCurrencyField::implAdjustGenericFieldSetting( const Reference< XPropertyS rPaintCurrencyFormatter.SetCurrencySymbol(aStr); } -VclPtr<Control> DbCurrencyField::createField(BrowserDataWin* pParent, bool bSpinButton, const Reference< XPropertySet >& /*rxModel*/) +VclPtr<svt::ControlBase> DbCurrencyField::createField(BrowserDataWin* pParent, bool bSpinButton, const Reference< XPropertySet >& /*rxModel*/) { return VclPtr<LongCurrencyControl>::Create(pParent, bSpinButton); } @@ -2123,7 +2119,7 @@ DbDateField::DbDateField( DbGridColumn& _rColumn ) doPropertyListening( FM_PROP_DATE_SHOW_CENTURY ); } -VclPtr<Control> DbDateField::createField(BrowserDataWin* pParent, bool bSpinButton, const Reference< XPropertySet >& rxModel) +VclPtr<svt::ControlBase> DbDateField::createField(BrowserDataWin* pParent, bool bSpinButton, const Reference< XPropertySet >& rxModel) { // check if there is a DropDown property set to TRUE bool bDropDown = !hasProperty( FM_PROP_DROPDOWN, rxModel ) @@ -2249,7 +2245,7 @@ DbTimeField::DbTimeField( DbGridColumn& _rColumn ) doPropertyListening( FM_PROP_STRICTFORMAT ); } -VclPtr<Control> DbTimeField::createField(BrowserDataWin* pParent, bool bSpinButton, const Reference< XPropertySet >& /*rxModel*/ ) +VclPtr<svt::ControlBase> DbTimeField::createField(BrowserDataWin* pParent, bool bSpinButton, const Reference< XPropertySet >& /*rxModel*/ ) { return VclPtr<TimeControl>::Create(pParent, bSpinButton); } @@ -2762,9 +2758,7 @@ void DbFilterField::Init(BrowserDataWin& rParent, const Reference< XRowSet >& xC DbCellControl::Init( rParent, xCursor ); // filter cells are never readonly - ControlBase* pAsEdit = dynamic_cast<ControlBase*>(m_pWindow.get()); - if (pAsEdit) - pAsEdit->SetEditableReadOnly(false); + m_pWindow->SetEditableReadOnly(false); } CellControllerRef DbFilterField::CreateController() const diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index 8a0ecc5b52fa..2135f78d0d9a 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -211,8 +211,8 @@ private: protected: DbGridColumn& m_rColumn; - VclPtr<vcl::Window> m_pPainter; - VclPtr<vcl::Window> m_pWindow; + VclPtr<svt::ControlBase> m_pPainter; + VclPtr<svt::ControlBase> m_pWindow; protected: // attribute access @@ -542,7 +542,7 @@ public: virtual ::svt::CellControllerRef CreateController() const override; protected: - virtual VclPtr<Control> createField( + virtual VclPtr<svt::ControlBase> createField( BrowserDataWin* _pParent, bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel @@ -562,7 +562,7 @@ private: virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; // DbSpinField - virtual VclPtr<Control> createField( + virtual VclPtr<svt::ControlBase> createField( BrowserDataWin* _pParent, bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel @@ -585,7 +585,7 @@ private: virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; // DbSpinField - virtual VclPtr<Control> createField( + virtual VclPtr<svt::ControlBase> createField( BrowserDataWin* _pParent, bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel @@ -608,7 +608,7 @@ private: virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; // DbSpinField - virtual VclPtr<Control> createField( + virtual VclPtr<svt::ControlBase> createField( BrowserDataWin* _pParent, bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel @@ -632,7 +632,7 @@ private: virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; // DbSpinField - virtual VclPtr<Control> createField( + virtual VclPtr<svt::ControlBase> createField( BrowserDataWin* _pParent, bool bSpinButton, const css::uno::Reference< css::beans::XPropertySet >& _rxModel |