sc/source/ui/vba/vbaaxes.cxx | 3 +-- sc/source/ui/vba/vbaaxis.cxx | 6 +++--- sc/source/ui/vba/vbaaxis.hxx | 9 ++++++--- sc/source/ui/vba/vbaformatconditions.cxx | 6 +++--- sc/source/ui/vba/vbaformatconditions.hxx | 4 +++- 5 files changed, 16 insertions(+), 12 deletions(-)
New commits: commit a85c7cf02603408b09c15344803e293bb4b5bb81 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Nov 8 13:09:48 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Nov 9 09:10:20 2023 +0100 loplugin:fieldcast in ScVbaAxis Change-Id: Ie8ad7f6ff7e0fa52e7c7075520e5bf51ab8af7a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159180 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/ui/vba/vbaaxes.cxx b/sc/source/ui/vba/vbaaxes.cxx index 5dc3fb7a07e9..0a377750aa59 100644 --- a/sc/source/ui/vba/vbaaxes.cxx +++ b/sc/source/ui/vba/vbaaxes.cxx @@ -79,8 +79,7 @@ ScVbaAxes::createAxis( const uno::Reference< excel::XChart >& xChart, const uno: } else DebugHelper::runtimeexception(ERRCODE_BASIC_METHOD_FAILED); - uno::Reference< XHelperInterface > xParent( xChart, uno::UNO_QUERY_THROW ); - return new ScVbaAxis( xParent, xContext, xAxisPropertySet, nType, nAxisGroup); + return new ScVbaAxis( pChart, xContext, xAxisPropertySet, nType, nAxisGroup); } namespace { diff --git a/sc/source/ui/vba/vbaaxis.cxx b/sc/source/ui/vba/vbaaxis.cxx index aa461abee0da..76cf9fe066e3 100644 --- a/sc/source/ui/vba/vbaaxis.cxx +++ b/sc/source/ui/vba/vbaaxis.cxx @@ -37,7 +37,7 @@ constexpr OUStringLiteral VBA_MAX(u"Min"); ScVbaChart* ScVbaAxis::getChartPtr() { - ScVbaChart* pChart = static_cast< ScVbaChart* >( moChartParent.get() ); + ScVbaChart* pChart = moChartParent.get(); if ( !pChart ) throw uno::RuntimeException("Can't access parent chart impl" ); return pChart; @@ -53,17 +53,17 @@ ScVbaAxis::isValueAxis() return true; } -ScVbaAxis::ScVbaAxis( const uno::Reference< XHelperInterface >& xParent, +ScVbaAxis::ScVbaAxis( const rtl::Reference< ScVbaChart >& xParent, const uno::Reference< uno::XComponentContext > & xContext, uno::Reference< beans::XPropertySet > _xPropertySet, sal_Int32 _nType, sal_Int32 _nGroup ) : ScVbaAxis_BASE( xParent, xContext ), + moChartParent(xParent), mxPropertySet(std::move( _xPropertySet )), mnType( _nType ), mnGroup( _nGroup ), maShapeHelper( uno::Reference< drawing::XShape >( mxPropertySet, uno::UNO_QUERY ) ), bCrossesAreCustomized( false ) { - moChartParent.set( xParent, uno::UNO_QUERY_THROW ); setType(_nType); setCrosses(xlAxisCrossesAutomatic); } diff --git a/sc/source/ui/vba/vbaaxis.hxx b/sc/source/ui/vba/vbaaxis.hxx index 787d2e03763a..8fcb9a399092 100644 --- a/sc/source/ui/vba/vbaaxis.hxx +++ b/sc/source/ui/vba/vbaaxis.hxx @@ -21,12 +21,15 @@ #include <ooo/vba/excel/XAxis.hpp> #include <ooo/vba/excel/XChart.hpp> #include <vbahelper/vbahelperinterface.hxx> +#include <rtl/ref.hxx> #include <memory> -typedef InheritedHelperInterfaceWeakImpl< ov::excel::XAxis > ScVbaAxis_BASE; + class ScVbaChart; + +typedef InheritedHelperInterfaceWeakImpl< ov::excel::XAxis > ScVbaAxis_BASE; class ScVbaAxis : public ScVbaAxis_BASE { - css::uno::Reference< ov::excel::XChart > moChartParent; + rtl::Reference< ScVbaChart > moChartParent; css::uno::Reference< css::beans::XPropertySet > mxPropertySet; sal_Int32 mnType; sal_Int32 mnGroup; @@ -39,7 +42,7 @@ class ScVbaAxis : public ScVbaAxis_BASE bool isValueAxis(); public: - ScVbaAxis( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, css::uno::Reference< css::beans::XPropertySet > _xPropertySet, sal_Int32 _nType, sal_Int32 _nGroup ); + ScVbaAxis( const rtl::Reference< ScVbaChart >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, css::uno::Reference< css::beans::XPropertySet > _xPropertySet, sal_Int32 _nType, sal_Int32 _nGroup ); // Methods virtual void SAL_CALL Delete( ) override; virtual css::uno::Reference< ::ooo::vba::excel::XAxisTitle > SAL_CALL getAxisTitle( ) override; commit 33729810b5f8ff5232195a5390c58e6e50900253 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Nov 8 13:07:19 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Nov 9 09:10:12 2023 +0100 loplugin:fieldcast in ScVbaFormatConditions Change-Id: I585387219765dddf48fcbad1cd73e900afc43ea9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159179 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/ui/vba/vbaformatconditions.cxx b/sc/source/ui/vba/vbaformatconditions.cxx index a840a6fb5f78..a6c3ae4125e8 100644 --- a/sc/source/ui/vba/vbaformatconditions.cxx +++ b/sc/source/ui/vba/vbaformatconditions.cxx @@ -37,7 +37,7 @@ ScVbaFormatConditions::Delete( ) { try { - ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() ); + ScVbaStyles* pStyles = mxStyles.get(); if ( !pStyles ) DebugHelper::basicexception(ERRCODE_BASIC_METHOD_FAILED, {} ); sal_Int32 nCount = mxSheetConditionalEntries->getCount(); @@ -235,7 +235,7 @@ ScVbaFormatConditions::getA1Formula(const css::uno::Any& _aFormula) OUString ScVbaFormatConditions::getStyleName() { - ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() ); + ScVbaStyles* pStyles = mxStyles.get(); if ( !pStyles ) DebugHelper::basicexception(ERRCODE_BASIC_METHOD_FAILED, {} ); uno::Sequence< OUString > sCellStyleNames = pStyles->getStyleNames(); @@ -256,7 +256,7 @@ ScVbaFormatConditions::removeFormatCondition( const OUString& _sStyleName, bool mxSheetConditionalEntries->removeByIndex(i); if (_bRemoveStyle) { - ScVbaStyles* pStyles = static_cast< ScVbaStyles* >( mxStyles.get() ); + ScVbaStyles* pStyles = mxStyles.get(); if ( !pStyles ) DebugHelper::basicexception(ERRCODE_BASIC_METHOD_FAILED, {}); pStyles->Delete( _sStyleName ); diff --git a/sc/source/ui/vba/vbaformatconditions.hxx b/sc/source/ui/vba/vbaformatconditions.hxx index fd5a7fc839f0..8fe7cfabb83f 100644 --- a/sc/source/ui/vba/vbaformatconditions.hxx +++ b/sc/source/ui/vba/vbaformatconditions.hxx @@ -21,12 +21,14 @@ #include <ooo/vba/excel/XFormatConditions.hpp> #include <vbahelper/vbacollectionimpl.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::beans { class XPropertySet; } namespace com::sun::star::sheet { class XSheetConditionalEntries; } namespace ooo::vba::excel { class XRange; } namespace ooo::vba::excel { class XStyle; } namespace ooo::vba::excel { class XStyles; } +class ScVbaStyles; // This class is used only as a target for casting, it seems, // and no objects of this type are created as such, I think. @@ -34,7 +36,7 @@ namespace ooo::vba::excel { class XStyles; } class ScVbaFormatConditions: public CollTestImplHelper< ov::excel::XFormatConditions > { css::uno::Reference< css::sheet::XSheetConditionalEntries > mxSheetConditionalEntries; - css::uno::Reference< ov::excel::XStyles > mxStyles; + rtl::Reference< ScVbaStyles > mxStyles; css::uno::Reference< ov::excel::XRange > mxRangeParent; css::uno::Reference< css::beans::XPropertySet > mxParentRangePropertySet; public: