compilerplugins/clang/fieldcast.results | 3 --- sc/source/filter/inc/pivottablebuffer.hxx | 4 +++- sc/source/filter/oox/pivottablebuffer.cxx | 15 +++++---------- 3 files changed, 8 insertions(+), 14 deletions(-)
New commits: commit b9312a055ab7759fba68a9353ae64d37b460a2d3 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Nov 23 20:27:35 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Nov 24 06:27:18 2023 +0100 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.gran...@collabora.co.uk> diff --git a/compilerplugins/clang/fieldcast.results b/compilerplugins/clang/fieldcast.results index 6b16aeb370f9..b3a206434484 100644 --- a/compilerplugins/clang/fieldcast.results +++ b/compilerplugins/clang/fieldcast.results @@ -298,9 +298,6 @@ sc/source/filter/excel/xeformula.cxx:60 sc/source/filter/inc/eeimport.hxx:43 ScEEImport mpParser std::unique_ptr<ScEEParser> ScHTMLParser -sc/source/filter/inc/pivottablebuffer.hxx:382 - oox::xls::PivotTable mxDPDescriptor css::uno::Reference<css::sheet::XDataPilotDescriptor> - ScDataPilotDescriptorBase sc/source/filter/xml/xmlimprt.hxx:156 ScXMLImport xSheetCellRanges css::uno::Reference<css::sheet::XSheetCellRangeContainer> ScCellRangesObj diff --git a/sc/source/filter/inc/pivottablebuffer.hxx b/sc/source/filter/inc/pivottablebuffer.hxx index 04db017bfefc..a4ba60022dea 100644 --- a/sc/source/filter/inc/pivottablebuffer.hxx +++ b/sc/source/filter/inc/pivottablebuffer.hxx @@ -21,6 +21,7 @@ #include "pivotcachebuffer.hxx" #include "stylesbuffer.hxx" +#include <rtl/ref.hxx> namespace com::sun::star { namespace sheet { class XDataPilotDescriptor; } @@ -28,6 +29,7 @@ namespace com::sun::star { } class ScDPObject; +class ScDataPilotDescriptorBase; namespace oox::xls { @@ -378,7 +380,7 @@ private: PTDefinitionModel maDefModel; /// Global pivot table settings. PTLocationModel maLocationModel; /// Location settings of the pivot table. PivotCache* mpPivotCache; /// The pivot cache this table is based on. - css::uno::Reference< css::sheet::XDataPilotDescriptor > + rtl::Reference< ScDataPilotDescriptorBase > // css::sheet::XDataPilotDescriptor mxDPDescriptor; /// Descriptor of the DataPilot object. std::map<OUString, css::uno::Any> maInteropGrabBag; 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& ) {