diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-11-07 02:27:54 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-11-08 05:34:37 +0100 |
commit | d833992e7e06f7d385fca6ffe35ce66b79360a63 (patch) | |
tree | 857f8e8edbbbf0754e8fdf097703b5b9a16c59c4 /chart2/source | |
parent | 56f3dbffdf5b3264c1c71201733e3ff6bb5e48cb (diff) |
Avoid checking exact interface type of Any value
Change-Id: Ic883c3a9fd8eb87469aec6b6570a39aadf575c3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176184
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 8 | ||||
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 5 | ||||
-rw-r--r-- | chart2/source/tools/RangeHighlighter.cxx | 7 |
3 files changed, 7 insertions, 13 deletions
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index a4e54a5fd13e..b0fbf6a25cb4 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1644,8 +1644,7 @@ sal_Bool SAL_CALL ChartController::select( const uno::Any& rSelection ) if ( rSelection.hasValue() ) { - const uno::Type& rType = rSelection.getValueType(); - if ( rType == cppu::UnoType< OUString >::get() ) + if (rSelection.getValueType() == cppu::UnoType<OUString>::get()) { OUString aNewCID; if ( ( rSelection >>= aNewCID ) && m_aSelection.setSelection( aNewCID ) ) @@ -1653,10 +1652,9 @@ sal_Bool SAL_CALL ChartController::select( const uno::Any& rSelection ) bSuccess = true; } } - else if ( rType == cppu::UnoType<drawing::XShape>::get() ) + else if (uno::Reference<drawing::XShape> xShape; rSelection >>= xShape) { - uno::Reference< drawing::XShape > xShape; - if ( ( rSelection >>= xShape ) && m_aSelection.setSelection( xShape ) ) + if (m_aSelection.setSelection(xShape)) { bSuccess = true; } diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 1e4e2764d063..7e6314b15c69 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -239,12 +239,11 @@ ObjectIdentifier::ObjectIdentifier( const Reference< drawing::XShape >& rxShape ObjectIdentifier::ObjectIdentifier( const Any& rAny ) { - const uno::Type& rType = rAny.getValueType(); - if ( rType == cppu::UnoType<OUString>::get() ) + if (rAny.getValueType() == cppu::UnoType<OUString>::get()) { rAny >>= m_aObjectCID; } - else if ( rType == cppu::UnoType< drawing::XShape >::get() ) + else { rAny >>= m_xAdditionalShape; } diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx index eb3dffb2bdcc..63c8809be081 100644 --- a/chart2/source/tools/RangeHighlighter.cxx +++ b/chart2/source/tools/RangeHighlighter.cxx @@ -100,9 +100,8 @@ void RangeHighlighter::determineRanges() m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( m_xChartModel ); uno::Any aSelection( m_xSelectionSupplier->getSelection()); - const uno::Type& rType = aSelection.getValueType(); - if ( rType == cppu::UnoType<OUString>::get() ) + if (aSelection.getValueType() == cppu::UnoType<OUString>::get()) { // @todo??: maybe getSelection() should return a model object rather than a CID @@ -169,11 +168,9 @@ void RangeHighlighter::determineRanges() } } } - else if ( rType == cppu::UnoType< drawing::XShape >::get() ) + else if (Reference<drawing::XShape> xShape; aSelection >>= xShape) { // #i12587# support for shapes in chart - Reference< drawing::XShape > xShape; - aSelection >>= xShape; if ( xShape.is() ) { return; |