chart2/source/controller/dialogs/dlg_ObjectProperties.cxx | 2 +- chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx | 2 +- chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx | 8 ++++---- chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx | 7 ++----- chart2/source/controller/main/ChartController.cxx | 2 +- chart2/source/controller/main/ChartController_Tools.cxx | 6 +++--- chart2/source/controller/main/DrawCommandDispatch.cxx | 2 +- chart2/source/model/template/ChartTypeTemplate.cxx | 6 +++--- chart2/source/model/template/HistogramChartType.cxx | 5 ++--- chart2/source/tools/DataSourceHelper.cxx | 2 +- chart2/source/tools/RegressionCurveHelper.cxx | 7 +++---- chart2/source/tools/TitleHelper.cxx | 7 ++----- chart2/source/view/axes/VPolarAngleAxis.cxx | 2 +- chart2/source/view/main/ChartView.cxx | 9 ++++----- chart2/source/view/main/DataTableView.cxx | 9 +++------ chart2/source/view/main/SeriesPlotterContainer.cxx | 2 +- chart2/source/view/main/ShapeFactory.cxx | 7 +++---- 17 files changed, 36 insertions(+), 49 deletions(-)
New commits: commit d0fe2b9cf985bd77483a716c825734956f3dc828 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 20 12:42:54 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Feb 20 14:03:28 2025 +0100 use more concrete UNO types in some local vars found by a clang plugin I created. Change-Id: I72ebc2b6fadb854a12d69a543facf2fd7e4f1e8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181932 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index e599da2ee4a5..97d922b0f3ac 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -173,7 +173,7 @@ void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartM //is the crossing main axis a category axes?: rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) ); - uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) ); + rtl::Reference< Axis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) ); if( xCrossingMainAxis.is() ) { ScaleData aScale( xCrossingMainAxis->getScaleData() ); diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 3c058c3ecd1f..9f490e42fb2e 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -799,7 +799,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet sal_Int32 nAxisIndex=0; if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 ) { - Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) ); + rtl::Reference< Axis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) ); if( xCrossingMainAxis.is() ) { ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() ); diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx index bbbee7cf318a..1cc120e8fec2 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -52,9 +52,9 @@ AllAxisItemConverter::AllAxisItemConverter( const std::vector< rtl::Reference< Axis > > aElementList = AxisHelper::getAllAxesOfDiagram( xDiagram ); for( rtl::Reference< Axis > const & axis : aElementList ) { - uno::Reference< beans::XPropertySet > xObjectProperties(axis); m_aConverters.emplace_back( new ::chart::wrapper::AxisItemConverter( - xObjectProperties, rItemPool, rDrawModel, + uno::Reference< beans::XPropertySet >(axis), + rItemPool, rDrawModel, xChartModel, nullptr, nullptr, pRefSize)); } @@ -145,10 +145,10 @@ AllTitleItemConverter::AllTitleItemConverter( rtl::Reference< Title > xTitle( TitleHelper::getTitle( TitleHelper::eTitleType(nTitle), xChartModel ) ); if(!xTitle.is()) continue; - uno::Reference< beans::XPropertySet > xObjectProperties( xTitle ); m_aConverters.emplace_back( new ::chart::wrapper::TitleItemConverter( - xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, std::nullopt)); + uno::Reference< beans::XPropertySet >( xTitle ), + rItemPool, rDrawModel, xNamedPropertyContainerFactory, std::nullopt)); } } diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx index e8703926c5a7..99816e894396 100644 --- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx @@ -147,13 +147,10 @@ uno::Reference< beans::XPropertySet > lcl_getCurveProperties( if( bExists ) { uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropSet, uno::UNO_QUERY ); - uno::Reference< chart2::XRegressionCurve > xCurve( + rtl::Reference< ::chart::RegressionCurveModel > xCurve( ::chart::RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt )); if( xCurve.is()) - { - uno::Reference< beans::XPropertySet > xProperties( xCurve, uno::UNO_QUERY ); - return xProperties; - } + return xCurve; } return uno::Reference< beans::XPropertySet >(); diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 747b2319a1a8..5c58f4a525eb 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -799,7 +799,7 @@ void SAL_CALL ChartController::dispose() if( aModelRef.is()) { - uno::Reference< frame::XModel > xModel( aModelRef->getModel() ); + rtl::Reference< ChartModel > xModel( aModelRef->getModel() ); if(xModel.is()) xModel->disconnectController( uno::Reference< frame::XController >( this )); diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index b622a2a9b801..b7ab2e219415 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -346,7 +346,7 @@ void ChartController::impl_PasteGraphic( rtl::Reference<SvxGraphicObject> xGraphicShape = new SvxGraphicObject(nullptr); xGraphicShape->setShapeKind(SdrObjKind::Graphic); - uno::Reference< drawing::XShapes > xPage = pDrawModelWrapper->getMainDrawPage(); + rtl::Reference< SvxDrawPage > xPage = pDrawModelWrapper->getMainDrawPage(); if( xPage.is()) { xPage->add( xGraphicShape ); @@ -394,7 +394,7 @@ void ChartController::impl_PasteShapes( SdrModel* pModel ) if ( !(pDrawModelWrapper && m_pDrawViewWrapper) ) return; - Reference< drawing::XDrawPage > xDestPage( pDrawModelWrapper->getMainDrawPage() ); + rtl::Reference< SvxDrawPage > xDestPage( pDrawModelWrapper->getMainDrawPage() ); SdrPage* pDestPage = GetSdrPageFromXDrawPage( xDestPage ); if ( !pDestPage ) return; @@ -451,7 +451,7 @@ void ChartController::impl_PasteStringAsTextShape( const OUString& rString, cons if ( !(pDrawModelWrapper && m_pDrawViewWrapper) ) return; - const Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() ); + const rtl::Reference< SvxDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() ); OSL_ASSERT( xDrawPage.is() ); if ( !xDrawPage ) diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 39e5956ec0e1..e1d1ad7d3ddb 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -404,7 +404,7 @@ rtl::Reference<SdrObject> DrawCommandDispatch::createDefaultObject( const ChartC if ( pDrawViewWrapper && pDrawModelWrapper ) { - Reference< drawing::XDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() ); + rtl::Reference< SvxDrawPage > xDrawPage( pDrawModelWrapper->getMainDrawPage() ); SdrPage* pPage = GetSdrPageFromXDrawPage( xDrawPage ); if ( pPage ) { diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 46991f23e37a..584cf548aaff 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -648,12 +648,12 @@ void ChartTypeTemplate::createAxes( nAxisCount = 2; for( sal_Int32 nAxisIndex = 0; nAxisIndex < nAxisCount; ++nAxisIndex ) { - Reference< XAxis > xAxis = AxisHelper::getAxis( nDim, nAxisIndex, xCooSys ); + rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDim, nAxisIndex, xCooSys ); if( !xAxis.is()) { // create and add axis - xAxis.set( AxisHelper::createAxis( - nDim, nAxisIndex, xCooSys, GetComponentContext() )); + xAxis = AxisHelper::createAxis( + nDim, nAxisIndex, xCooSys, GetComponentContext() ); } } } diff --git a/chart2/source/model/template/HistogramChartType.cxx b/chart2/source/model/template/HistogramChartType.cxx index 91304e42e14f..2f202de39945 100644 --- a/chart2/source/model/template/HistogramChartType.cxx +++ b/chart2/source/model/template/HistogramChartType.cxx @@ -278,10 +278,9 @@ void HistogramChartType::createCalculatedDataSeries() aValuesDataSequence->setValues(comphelper::containerToSequence(aValues)); aValuesDataSequence->setLabels(comphelper::containerToSequence(aLabels)); - uno::Reference<chart2::data::XDataSequence> aDataSequence = aValuesDataSequence; - setRoleToTheSequence(aDataSequence, u"values-y"_ustr); + setRoleToTheSequence(aValuesDataSequence, u"values-y"_ustr); - m_aDataSeries[0]->addDataSequence(new LabeledDataSequence(aDataSequence)); + m_aDataSeries[0]->addDataSequence(new LabeledDataSequence(aValuesDataSequence)); } } // namespace chart diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx index 3084ec14ab8a..943a46c2909f 100644 --- a/chart2/source/tools/DataSourceHelper.cxx +++ b/chart2/source/tools/DataSourceHelper.cxx @@ -227,7 +227,7 @@ rtl::Reference< DataSource > DataSourceHelper::pressUsedDataIntoRectangularForma std::vector< rtl::Reference< DataSeries > > aSeriesVector; if (xDiagram) aSeriesVector = xDiagram->getDataSeries(); - uno::Reference< chart2::data::XDataSource > xSeriesSource = + rtl::Reference< ::chart::DataSource > xSeriesSource = DataSeriesHelper::getDataSource( aSeriesVector ); const Sequence< Reference< chart2::data::XLabeledDataSequence > > aDataSequences( xSeriesSource->getDataSequences() ); diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 193a525737d9..399d5f41bb9b 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -364,15 +364,14 @@ void RegressionCurveHelper::addMeanValueLine( return; // todo: use a valid context - uno::Reference< XRegressionCurve > xCurve( createMeanValueLine() ); + rtl::Reference< RegressionCurveModel > xCurve( createMeanValueLine() ); xRegCnt->addRegressionCurve( xCurve ); if( xSeriesProp.is()) { - uno::Reference< XPropertySet > xProp( xCurve, uno::UNO_QUERY ); - if( xProp.is()) + if( xCurve.is()) { - xProp->setPropertyValue( u"LineColor"_ustr, + xCurve->setPropertyValue( u"LineColor"_ustr, xSeriesProp->getPropertyValue( u"Color"_ustr)); } } diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index 56d6fcbf44c1..4a2bfa4f0315 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -446,12 +446,9 @@ bool TitleHelper::getTitleType( eTitleType& rType void TitleHelper::hideTitle( TitleHelper::eTitleType nTitleIndex , const rtl::Reference<ChartModel>& xModel) { - uno::Reference< chart2::XTitle > xTitled( TitleHelper::getTitle( nTitleIndex, xModel ) ); + rtl::Reference< Title > xTitled( TitleHelper::getTitle( nTitleIndex, xModel ) ); if( xTitled.is()) - { - css::uno::Reference<css::beans::XPropertySet> xProps(xTitled, css::uno::UNO_QUERY_THROW); - xProps->setPropertyValue(u"Visible"_ustr,css::uno::Any(false)); - } + xTitled->setPropertyValue(u"Visible"_ustr,css::uno::Any(false)); } } //namespace chart diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx index 4779d49390d4..91fec413dbcc 100644 --- a/chart2/source/view/axes/VPolarAngleAxis.cxx +++ b/chart2/source/view/axes/VPolarAngleAxis.cxx @@ -59,7 +59,7 @@ void VPolarAngleAxis::createTextShapes_ForAngleAxis( tNameSequence aPropNames; tAnySequence aPropValues; - uno::Reference< beans::XPropertySet > xProps( m_aAxisProperties.m_xAxisModel ); + rtl::Reference< ::chart::Axis > xProps( m_aAxisProperties.m_xAxisModel ); PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, aPropValues, false, -1, false, false ); LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps , rAxisLabelProperties.m_aFontReferenceSize ); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index b2d27a4e67e1..35482b061b67 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -921,7 +921,6 @@ constexpr sal_Int32 constPageLayoutFixedDistance = 350; bool getAvailablePosAndSizeForDiagram( CreateShapeParam2D& rParam, const awt::Size & rPageSize, rtl::Reference<Diagram> const& xDiagram) { - uno::Reference<beans::XPropertySet> const xProp(xDiagram); rParam.mbUseFixedInnerSize = false; //@todo: we need a size dependent on the axis labels @@ -945,12 +944,12 @@ bool getAvailablePosAndSizeForDiagram( rParam.maRemainingSpace.Height -= 2*nYDistance; bool bPosSizeExcludeAxes = false; - if( xProp.is() ) - xProp->getPropertyValue( u"PosSizeExcludeAxes"_ustr ) >>= bPosSizeExcludeAxes; + if( xDiagram.is() ) + xDiagram->getPropertyValue( u"PosSizeExcludeAxes"_ustr ) >>= bPosSizeExcludeAxes; //size: css::chart2::RelativeSize aRelativeSize; - if( xProp.is() && (xProp->getPropertyValue( u"RelativeSize"_ustr )>>=aRelativeSize) ) + if( xDiagram.is() && (xDiagram->getPropertyValue( u"RelativeSize"_ustr )>>=aRelativeSize) ) { rParam.maRemainingSpace.Height = static_cast<sal_Int32>(aRelativeSize.Secondary*rPageSize.Height); rParam.maRemainingSpace.Width = static_cast<sal_Int32>(aRelativeSize.Primary*rPageSize.Width); @@ -962,7 +961,7 @@ bool getAvailablePosAndSizeForDiagram( //position: chart2::RelativePosition aRelativePosition; - if( xProp.is() && (xProp->getPropertyValue( u"RelativePosition"_ustr )>>=aRelativePosition) ) + if( xDiagram.is() && (xDiagram->getPropertyValue( u"RelativePosition"_ustr )>>=aRelativePosition) ) { //@todo decide whether x is primary or secondary diff --git a/chart2/source/view/main/DataTableView.cxx b/chart2/source/view/main/DataTableView.cxx index bec3999d61fe..33f25afa77e0 100644 --- a/chart2/source/view/main/DataTableView.cxx +++ b/chart2/source/view/main/DataTableView.cxx @@ -95,8 +95,7 @@ DataTableView::DataTableView( , m_xComponentContext(rComponentContext) , m_bAlignAxisValuesWithColumns(bAlignAxisValuesWithColumns) { - uno::Reference<beans::XPropertySet> xPropertySet(m_xDataTableModel); - m_aLineProperties.initFromPropertySet(xPropertySet); + m_aLineProperties.initFromPropertySet(uno::Reference<beans::XPropertySet>(m_xDataTableModel)); } void DataTableView::setCellCharAndParagraphProperties( @@ -162,9 +161,8 @@ void DataTableView::setCellProperties(css::uno::Reference<beans::XPropertySet>& { xPropertySet->setPropertyValue(u"FillColor"_ustr, uno::Any(Color(0xFFFFFF))); - uno::Reference<beans::XPropertySet> xDataTableProperties(m_xDataTableModel); float fFontHeight = 0.0; - xDataTableProperties->getPropertyValue(u"CharHeight"_ustr) >>= fFontHeight; + m_xDataTableModel->getPropertyValue(u"CharHeight"_ustr) >>= fFontHeight; fFontHeight = o3tl::convert(fFontHeight, o3tl::Length::pt, o3tl::Length::mm100); sal_Int32 nXDistance = std::round(fFontHeight * 0.18f); sal_Int32 nYDistance = std::round(fFontHeight * 0.30f); @@ -349,9 +347,8 @@ void DataTableView::createShapes(basegfx::B2DVector const& rStart, basegfx::B2DV constexpr const sal_Int32 constSymbolMargin = 100; // 1mm if (bKeys) { - uno::Reference<beans::XPropertySet> xDataTableProperties(m_xDataTableModel); float fFontHeight = 0.0; - xDataTableProperties->getPropertyValue(u"CharHeight"_ustr) >>= fFontHeight; + m_xDataTableModel->getPropertyValue(u"CharHeight"_ustr) >>= fFontHeight; fFontHeight = o3tl::convert(fFontHeight, o3tl::Length::pt, o3tl::Length::mm100); sal_Int32 nSymbolHeight = sal_Int32(fFontHeight * 0.6); diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index 8ad97c3d1717..a26af212dd42 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -429,7 +429,7 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate) m_nMaxAxisIndex = 0; for (const auto& pVCooSys : m_rVCooSysList) { - uno::Reference<XCoordinateSystem> xCooSys = pVCooSys->getModel(); + rtl::Reference<BaseCoordinateSystem> xCooSys = pVCooSys->getModel(); sal_Int32 nDimCount = xCooSys->getDimension(); for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex) diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index b821c1f5206a..7ae22f5b86ce 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -2337,14 +2337,13 @@ rtl::Reference<SvxShapeGroupAnyD> ShapeFactory::getChartRootShape( const rtl::Reference<SvxDrawPage>& xDrawPage ) { rtl::Reference<SvxShapeGroupAnyD> xRet; - const uno::Reference< drawing::XShapes > xShapes = xDrawPage; - if( xShapes.is() ) + if( xDrawPage.is() ) { - sal_Int32 nCount = xShapes->getCount(); + sal_Int32 nCount = xDrawPage->getCount(); uno::Reference< drawing::XShape > xShape; for( sal_Int32 nN = nCount; nN--; ) { - if( xShapes->getByIndex( nN ) >>= xShape ) + if( xDrawPage->getByIndex( nN ) >>= xShape ) { if( ShapeFactory::getShapeName( xShape ) == "com.sun.star.chart2.shapes" ) {