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.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2025-02-20 14:03:28 +01:00
parent 240a3a5303
commit d0fe2b9cf9
17 changed files with 36 additions and 49 deletions
@@ -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() );
@@ -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() );
@@ -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));
}
}
@@ -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 >();
@@ -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 ));
@@ -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 )
@@ -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 )
{
@@ -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() );
}
}
}
@@ -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
+1 -1
View File
@@ -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() );
@@ -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));
}
}
+2 -5
View File
@@ -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
+1 -1
View File
@@ -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 );
+4 -5
View File
@@ -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
+3 -6
View File
@@ -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);
@@ -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)
+3 -4
View File
@@ -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" )
{