summaryrefslogtreecommitdiff
path: root/sc/source/filter/oox
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2023-11-23 20:27:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-11-24 06:27:18 +0100
commitb9312a055ab7759fba68a9353ae64d37b460a2d3 (patch)
treefe0eaa847648edb377dba1377075ce35eab16fde /sc/source/filter/oox
parent05d5181e2c19aca7e6098217ddb7065e02819a53 (diff)
loplugin:fieldcast in oox::xls::PivotTable
Change-Id: Ie50626b2e24bba2ee67827afcdf42c1c0ed2c9d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159870 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/filter/oox')
-rw-r--r--sc/source/filter/oox/pivottablebuffer.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx
index 637637eb378c..252b4773ccf2 100644
--- a/sc/source/filter/oox/pivottablebuffer.cxx
+++ b/sc/source/filter/oox/pivottablebuffer.cxx
@@ -1247,7 +1247,7 @@ void PivotTable::finalizeImport()
// create a new data pilot descriptor based on the source data
Reference< XDataPilotTablesSupplier > xDPTablesSupp( getSheetFromDoc( maLocationModel.maRange.aStart.Tab() ), UNO_QUERY_THROW );
Reference< XDataPilotTables > xDPTables( xDPTablesSupp->getDataPilotTables(), UNO_SET_THROW );
- mxDPDescriptor.set( xDPTables->createDataPilotDescriptor(), UNO_SET_THROW );
+ mxDPDescriptor = static_cast<ScDataPilotDescriptorBase*>( xDPTables->createDataPilotDescriptor().get() );
ScRange aRange = mpPivotCache->getSourceRange();
CellRangeAddress aCellRangeAddress( aRange.aStart.Tab(),
aRange.aStart.Col(), aRange.aStart.Row(),
@@ -1255,17 +1255,12 @@ void PivotTable::finalizeImport()
mxDPDescriptor->setSourceRange( aCellRangeAddress );
mxDPDescriptor->setTag( maDefModel.maTag );
- // TODO: This is a hack. Eventually we need to convert the whole thing to the internal API.
- auto pImpl = dynamic_cast<ScDataPilotDescriptorBase*>(mxDPDescriptor.get());
- if (!pImpl)
- return;
-
- mpDPObject = pImpl->GetDPObject();
+ mpDPObject = mxDPDescriptor->GetDPObject();
if (!mpDPObject)
return;
// global data pilot properties
- PropertySet aDescProp( mxDPDescriptor );
+ PropertySet aDescProp(( css::uno::Reference< css::beans::XPropertySet >(mxDPDescriptor) ));
aDescProp.setProperty( PROP_ColumnGrand, maDefModel.mbColGrandTotals );
aDescProp.setProperty( PROP_RowGrand, maDefModel.mbRowGrandTotals );
aDescProp.setProperty( PROP_ShowFilterButton, false );
@@ -1411,8 +1406,8 @@ Reference< XDataPilotField > PivotTable::getDataLayoutField() const
Reference< XDataPilotField > xDPField;
try
{
- Reference< XDataPilotDataLayoutFieldSupplier > xDPDataFieldSupp( mxDPDescriptor, UNO_QUERY_THROW );
- xDPField = xDPDataFieldSupp->getDataLayoutField();
+ if (mxDPDescriptor)
+ xDPField = mxDPDescriptor->getDataLayoutField();
}
catch( Exception& )
{