loplugin:referencecasting in oox..pyuno
Change-Id: Ie920c154aef3074016704c632b15d99110b219aa Reviewed-on: https://gerrit.libreoffice.org/75974 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
defdd8bebe
commit
84abf28e05
@ -44,7 +44,7 @@ bool DocumentDecryption::readEncryptionInfo()
|
||||
if (!mrOleStorage.isStorage())
|
||||
return false;
|
||||
|
||||
uno::Reference<io::XInputStream> xEncryptionInfo(mrOleStorage.openInputStream("EncryptionInfo"), uno::UNO_QUERY);
|
||||
uno::Reference<io::XInputStream> xEncryptionInfo = mrOleStorage.openInputStream("EncryptionInfo");
|
||||
|
||||
BinaryXInputStream aBinaryInputStream(xEncryptionInfo, true);
|
||||
sal_uInt32 aVersion = aBinaryInputStream.readuInt32();
|
||||
@ -93,10 +93,10 @@ bool DocumentDecryption::decrypt(const uno::Reference<io::XStream>& xDocumentStr
|
||||
return false;
|
||||
|
||||
// open the required input streams in the encrypted package
|
||||
uno::Reference<io::XInputStream> xEncryptedPackage(mrOleStorage.openInputStream("EncryptedPackage"), uno::UNO_QUERY);
|
||||
uno::Reference<io::XInputStream> xEncryptedPackage = mrOleStorage.openInputStream("EncryptedPackage");
|
||||
|
||||
// create temporary file for unencrypted package
|
||||
uno::Reference<io::XOutputStream> xDecryptedPackage(xDocumentStream->getOutputStream(), uno::UNO_QUERY);
|
||||
uno::Reference<io::XOutputStream> xDecryptedPackage = xDocumentStream->getOutputStream();
|
||||
BinaryXOutputStream aDecryptedPackage(xDecryptedPackage, true);
|
||||
BinaryXInputStream aEncryptedPackage(xEncryptedPackage, true);
|
||||
|
||||
|
@ -114,7 +114,7 @@ Reference< XLabeledDataSequence > lclCreateLabeledDataSequence(
|
||||
Reference< XLabeledDataSequence > xLabeledSeq;
|
||||
if( xValueSeq.is() || xTitleSeq.is() )
|
||||
{
|
||||
xLabeledSeq.set( LabeledDataSequence::create(rParent.getComponentContext()), UNO_QUERY );
|
||||
xLabeledSeq = LabeledDataSequence::create(rParent.getComponentContext());
|
||||
if( xLabeledSeq.is() )
|
||||
{
|
||||
xLabeledSeq->setValues( xValueSeq );
|
||||
|
@ -1703,7 +1703,7 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >&
|
||||
if( !xChartDoc->hasInternalDataProvider() )
|
||||
{
|
||||
Reference< chart2::data::XDataReceiver > xDataRec( xChartDoc, UNO_QUERY );
|
||||
Reference< chart2::data::XDataSource > xData( xDataRec->getUsedData(), UNO_QUERY );
|
||||
Reference< chart2::data::XDataSource > xData = xDataRec->getUsedData();
|
||||
if( !xData->getDataSequences().hasElements() || !xData->getDataSequences()[0]->getValues().is() ||
|
||||
!xData->getDataSequences()[0]->getValues()->getData().hasElements() )
|
||||
{
|
||||
|
@ -515,10 +515,9 @@ void TextParagraphProperties::dump() const
|
||||
|
||||
const OUString sText = "debug";
|
||||
xText->setString( sText );
|
||||
Reference< css::text::XTextCursor > xStart( xText->createTextCursor(), UNO_QUERY );
|
||||
Reference< css::text::XTextRange > xRange( xStart, UNO_QUERY );
|
||||
Reference< css::text::XTextCursor > xStart = xText->createTextCursor();
|
||||
xStart->gotoEnd( true );
|
||||
Reference< XPropertySet > xPropSet( xRange, UNO_QUERY );
|
||||
Reference< XPropertySet > xPropSet( xStart, UNO_QUERY );
|
||||
pushToPropSet( nullptr, xPropSet, emptyMap, nullptr, false, 0 );
|
||||
PropertySet aPropSet( xPropSet );
|
||||
aPropSet.dump();
|
||||
|
@ -59,7 +59,7 @@ sal_Int32 TextRun::insertAt(
|
||||
{
|
||||
sal_Int32 nCharHeight = 0;
|
||||
try {
|
||||
Reference< XTextRange > xStart( xAt, UNO_QUERY );
|
||||
Reference< XTextRange > xStart = xAt;
|
||||
PropertySet aPropSet( xStart );
|
||||
|
||||
TextCharacterProperties aTextCharacterProps( rTextCharacterStyle );
|
||||
|
@ -543,7 +543,7 @@ Sequence< Sequence< OUString > > ChartExport::getSplitCategoriesList( const OUSt
|
||||
//sort the categories name
|
||||
Sequence<Sequence<OUString>>aFinalSplitSource(aCategories.getLength());
|
||||
for (sal_Int32 i = 0; i < aFinalSplitSource.getLength(); i++) {
|
||||
const uno::Reference< chart2::data::XDataSequence > xCategories(aCategories[i]->getValues(), uno::UNO_QUERY);
|
||||
const uno::Reference< chart2::data::XDataSequence > xCategories = aCategories[i]->getValues();
|
||||
aFinalSplitSource[aFinalSplitSource.getLength() - i - 1] = lcl_getLabelSequence(xCategories);
|
||||
}
|
||||
return aFinalSplitSource;
|
||||
@ -565,7 +565,7 @@ OUString ChartExport::parseFormula( const OUString& rRange )
|
||||
{
|
||||
OUString aResult;
|
||||
Reference< XFormulaParser > xParser;
|
||||
uno::Reference< lang::XMultiServiceFactory > xSF( GetFB()->getModelFactory(), uno::UNO_QUERY );
|
||||
uno::Reference< lang::XMultiServiceFactory > xSF = GetFB()->getModelFactory();
|
||||
if( xSF.is() )
|
||||
{
|
||||
try
|
||||
@ -804,7 +804,7 @@ void ChartExport::exportChartSpace( const Reference< css::chart::XChartDocument
|
||||
// TODO: style
|
||||
// TODO: text properties
|
||||
// TODO: shape properties
|
||||
Reference< XPropertySet > xPropSet( xChartDoc->getArea(), uno::UNO_QUERY );
|
||||
Reference< XPropertySet > xPropSet = xChartDoc->getArea();
|
||||
if( xPropSet.is() )
|
||||
exportShapeProps( xPropSet );
|
||||
|
||||
@ -911,7 +911,7 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC
|
||||
exportView3D();
|
||||
|
||||
// floor
|
||||
Reference< beans::XPropertySet > xFloor( mxNewDiagram->getFloor(), uno::UNO_QUERY );
|
||||
Reference< beans::XPropertySet > xFloor = mxNewDiagram->getFloor();
|
||||
if( xFloor.is() )
|
||||
{
|
||||
pFS->startElement(FSNS(XML_c, XML_floor));
|
||||
@ -921,7 +921,7 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC
|
||||
|
||||
// LibreOffice doesn't distinguish between sideWall and backWall (both are using the same color).
|
||||
// It is controlled by the same Wall property.
|
||||
Reference< beans::XPropertySet > xWall( mxNewDiagram->getWall(), uno::UNO_QUERY );
|
||||
Reference< beans::XPropertySet > xWall = mxNewDiagram->getWall();
|
||||
if( xWall.is() )
|
||||
{
|
||||
// sideWall
|
||||
@ -1304,7 +1304,7 @@ void ChartExport::exportPlotArea( const Reference< css::chart::XChartDocument >&
|
||||
// We cannot write Wall attributes into Plot Area for 3D charts, because Wall us used as background wall.
|
||||
if( !mbIs3DChart && xWallFloorSupplier.is() )
|
||||
{
|
||||
Reference< beans::XPropertySet > xWallPropSet( xWallFloorSupplier->getWall(), uno::UNO_QUERY );
|
||||
Reference< beans::XPropertySet > xWallPropSet = xWallFloorSupplier->getWall();
|
||||
if( xWallPropSet.is() )
|
||||
{
|
||||
uno::Any aAny = xWallPropSet->getPropertyValue("LineStyle");
|
||||
@ -2559,11 +2559,11 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
|
||||
if( xAxisXSupp.is())
|
||||
xAxisProp = xAxisXSupp->getXAxis();
|
||||
if( bHasXAxisTitle )
|
||||
xAxisTitle.set( xAxisXSupp->getXAxisTitle(), uno::UNO_QUERY );
|
||||
xAxisTitle = xAxisXSupp->getXAxisTitle();
|
||||
if( bHasXAxisMajorGrid )
|
||||
xMajorGrid.set( xAxisXSupp->getXMainGrid(), uno::UNO_QUERY );
|
||||
xMajorGrid = xAxisXSupp->getXMainGrid();
|
||||
if( bHasXAxisMinorGrid )
|
||||
xMinorGrid.set( xAxisXSupp->getXHelpGrid(), uno::UNO_QUERY );
|
||||
xMinorGrid = xAxisXSupp->getXHelpGrid();
|
||||
|
||||
sal_Int32 eChartType = getChartType();
|
||||
nAxisType = getXAxisType(eChartType);
|
||||
@ -2577,11 +2577,11 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
|
||||
if( xAxisYSupp.is())
|
||||
xAxisProp = xAxisYSupp->getYAxis();
|
||||
if( bHasYAxisTitle )
|
||||
xAxisTitle.set( xAxisYSupp->getYAxisTitle(), uno::UNO_QUERY );
|
||||
xAxisTitle = xAxisYSupp->getYAxisTitle();
|
||||
if( bHasYAxisMajorGrid )
|
||||
xMajorGrid.set( xAxisYSupp->getYMainGrid(), uno::UNO_QUERY );
|
||||
xMajorGrid = xAxisYSupp->getYMainGrid();
|
||||
if( bHasYAxisMinorGrid )
|
||||
xMinorGrid.set( xAxisYSupp->getYHelpGrid(), uno::UNO_QUERY );
|
||||
xMinorGrid = xAxisYSupp->getYHelpGrid();
|
||||
|
||||
nAxisType = XML_valAx;
|
||||
// FIXME: axPos, need to check axis direction
|
||||
@ -2594,11 +2594,11 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
|
||||
if( xAxisZSupp.is())
|
||||
xAxisProp = xAxisZSupp->getZAxis();
|
||||
if( bHasZAxisTitle )
|
||||
xAxisTitle.set( xAxisZSupp->getZAxisTitle(), uno::UNO_QUERY );
|
||||
xAxisTitle = xAxisZSupp->getZAxisTitle();
|
||||
if( bHasZAxisMajorGrid )
|
||||
xMajorGrid.set( xAxisZSupp->getZMainGrid(), uno::UNO_QUERY );
|
||||
xMajorGrid = xAxisZSupp->getZMainGrid();
|
||||
if( bHasZAxisMinorGrid )
|
||||
xMinorGrid.set( xAxisZSupp->getZHelpGrid(), uno::UNO_QUERY );
|
||||
xMinorGrid = xAxisZSupp->getZHelpGrid();
|
||||
|
||||
sal_Int32 eChartType = getChartType( );
|
||||
if( (eChartType == chart::TYPEID_SCATTER)
|
||||
@ -2620,7 +2620,7 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
|
||||
if( bHasSecondaryXAxisTitle )
|
||||
{
|
||||
Reference< css::chart::XSecondAxisTitleSupplier > xAxisSupp( mxDiagram, uno::UNO_QUERY );
|
||||
xAxisTitle.set( xAxisSupp->getSecondXAxisTitle(), uno::UNO_QUERY );
|
||||
xAxisTitle = xAxisSupp->getSecondXAxisTitle();
|
||||
}
|
||||
|
||||
sal_Int32 eChartType = getChartType();
|
||||
@ -2637,7 +2637,7 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
|
||||
if( bHasSecondaryYAxisTitle )
|
||||
{
|
||||
Reference< css::chart::XSecondAxisTitleSupplier > xAxisSupp( mxDiagram, uno::UNO_QUERY );
|
||||
xAxisTitle.set( xAxisSupp->getSecondYAxisTitle(), uno::UNO_QUERY );
|
||||
xAxisTitle = xAxisSupp->getSecondYAxisTitle();
|
||||
}
|
||||
|
||||
nAxisType = XML_valAx;
|
||||
|
@ -1619,7 +1619,7 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa
|
||||
void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect,
|
||||
bool& rbOverridingCharHeight, sal_Int32& rnCharHeight )
|
||||
{
|
||||
Reference< XPropertySet > rXPropSet( rRun, UNO_QUERY );
|
||||
Reference< XPropertySet > rXPropSet = rRun;
|
||||
Reference< XPropertyState > rXPropState( rRun, UNO_QUERY );
|
||||
OUString usLanguage;
|
||||
PropertyState eState;
|
||||
|
@ -1961,8 +1961,7 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape )
|
||||
xPropSet->getPropertyValue("Model") >>= xChartDoc;
|
||||
assert(xChartDoc.is());
|
||||
//export the chart
|
||||
Reference< XModel > xModel( xChartDoc, UNO_QUERY );
|
||||
ChartExport aChartExport( mnXmlNamespace, GetFS(), xModel, GetFB(), GetDocumentType() );
|
||||
ChartExport aChartExport( mnXmlNamespace, GetFS(), xChartDoc, GetFB(), GetDocumentType() );
|
||||
static sal_Int32 nChartCount = 0;
|
||||
aChartExport.WriteChartObj( xShape, GetNewShapeID( xShape ), ++nChartCount );
|
||||
return *this;
|
||||
|
@ -187,7 +187,7 @@ void VbaProject::importVbaProject( StorageBase& rVbaPrjStrg, const GraphicHelper
|
||||
void VbaProject::importVbaData(const uno::Reference<io::XInputStream>& xInputStream)
|
||||
{
|
||||
uno::Reference<document::XStorageBasedDocument> xStorageBasedDoc(mxDocModel, uno::UNO_QUERY);
|
||||
uno::Reference<embed::XStorage> xDocStorage(xStorageBasedDoc->getDocumentStorage(), uno::UNO_QUERY);
|
||||
uno::Reference<embed::XStorage> xDocStorage = xStorageBasedDoc->getDocumentStorage();
|
||||
{
|
||||
const sal_Int32 nOpenMode = ElementModes::SEEKABLE | ElementModes::WRITE | ElementModes::TRUNCATE;
|
||||
uno::Reference<io::XOutputStream> xDocStream(xDocStorage->openStreamElement("_MS_VBA_Macros_XML", nOpenMode), uno::UNO_QUERY);
|
||||
|
@ -147,7 +147,7 @@ static void ResolveTextFields( XmlFilterBase const & rFilter )
|
||||
aURL = "#" + xNamed->getName();
|
||||
xPropSet->setPropertyValue( sURL, Any( aURL ) );
|
||||
Reference< text::XTextContent > xContent( rTextField.xTextField, UNO_QUERY);
|
||||
Reference< text::XTextRange > xTextRange( rTextField.xTextCursor, UNO_QUERY );
|
||||
Reference< text::XTextRange > xTextRange = rTextField.xTextCursor;
|
||||
rTextField.xText->insertTextContent( xTextRange, xContent, true );
|
||||
}
|
||||
catch( uno::Exception& )
|
||||
|
@ -136,7 +136,7 @@ namespace oox { namespace ppt {
|
||||
// with node
|
||||
xE2->nextElement() >>= xEA2;
|
||||
if( xEA2.is() )
|
||||
xE2.set(xEA2->createEnumeration(), css::uno::UNO_QUERY);
|
||||
xE2 = xEA2->createEnumeration();
|
||||
else
|
||||
xE2.clear();
|
||||
|
||||
|
@ -398,7 +398,7 @@ uno::Reference< drawing::XShape > SAL_CALL
|
||||
ShapeContextHandler::getShape()
|
||||
{
|
||||
uno::Reference< drawing::XShape > xResult;
|
||||
uno::Reference< drawing::XShapes > xShapes( mxDrawPage, uno::UNO_QUERY );
|
||||
uno::Reference< drawing::XShapes > xShapes = mxDrawPage;
|
||||
|
||||
if (mxFilterBase.is() && xShapes.is())
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ namespace
|
||||
|
||||
CPPUNIT_ASSERT(xZip.is());
|
||||
|
||||
mxNA = uno::Reference<container::XNameAccess>(xZip, uno::UNO_QUERY);
|
||||
mxNA = xZip;
|
||||
CPPUNIT_ASSERT(mxNA.is());
|
||||
}
|
||||
|
||||
|
@ -1320,12 +1320,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
|
||||
else
|
||||
m_pAntiImpl = new OWriteStream( this, xStream, bHierarchyAccess );
|
||||
|
||||
uno::Reference< io::XStream > xWriteStream( static_cast< ::cppu::OWeakObject* >( m_pAntiImpl ),
|
||||
uno::UNO_QUERY );
|
||||
|
||||
SAL_WARN_IF( !xWriteStream.is(), "package.xstor", "OWriteStream MUST implement XStream && XComponent interfaces!" );
|
||||
|
||||
return xWriteStream;
|
||||
return m_pAntiImpl;
|
||||
}
|
||||
|
||||
throw lang::IllegalArgumentException(); // TODO
|
||||
@ -1380,7 +1375,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io:
|
||||
{
|
||||
uno::Reference < io::XStream > xTempFile;
|
||||
if ( !xTargetStream.is() )
|
||||
xTempFile.set( io::TempFile::create(m_xContext), uno::UNO_QUERY );
|
||||
xTempFile = io::TempFile::create(m_xContext);
|
||||
else
|
||||
xTempFile = xTargetStream;
|
||||
|
||||
@ -2069,7 +2064,7 @@ uno::Reference< io::XInputStream > SAL_CALL OWriteStream::getInputStream()
|
||||
if ( !m_bInitOnDemand && ( m_bInStreamDisconnected || !m_xInStream.is() ) )
|
||||
return uno::Reference< io::XInputStream >();
|
||||
|
||||
return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY );
|
||||
return this;
|
||||
}
|
||||
|
||||
uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream()
|
||||
@ -2095,7 +2090,7 @@ uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream()
|
||||
if ( !m_xOutStream.is() )
|
||||
return uno::Reference< io::XOutputStream >();
|
||||
|
||||
return uno::Reference< io::XOutputStream >( static_cast< io::XOutputStream* >( this ), uno::UNO_QUERY );
|
||||
return this;
|
||||
}
|
||||
|
||||
void SAL_CALL OWriteStream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
|
||||
|
@ -933,7 +933,7 @@ static int lcl_setitem_index( PyUNO const *me, PyObject *pKey, PyObject *pValue
|
||||
|
||||
xIndexContainer.set( me->members->xInvocation, UNO_QUERY );
|
||||
if ( xIndexContainer.is() )
|
||||
xIndexReplace.set( xIndexContainer, UNO_QUERY );
|
||||
xIndexReplace = xIndexContainer;
|
||||
else
|
||||
xIndexReplace.set( me->members->xInvocation, UNO_QUERY );
|
||||
|
||||
@ -980,7 +980,7 @@ static int lcl_setitem_slice( PyUNO const *me, PyObject *pKey, PyObject *pValue
|
||||
|
||||
xIndexContainer.set( me->members->xInvocation, UNO_QUERY );
|
||||
if ( xIndexContainer.is() )
|
||||
xIndexReplace.set( xIndexContainer, UNO_QUERY );
|
||||
xIndexReplace = xIndexContainer;
|
||||
else
|
||||
xIndexReplace.set( me->members->xInvocation, UNO_QUERY );
|
||||
|
||||
@ -1114,7 +1114,7 @@ static int lcl_setitem_string( PyUNO const *me, PyObject *pKey, PyObject *pValue
|
||||
Reference< XNameContainer > xNameContainer( me->members->xInvocation, UNO_QUERY );
|
||||
Reference< XNameReplace > xNameReplace;
|
||||
if ( xNameContainer.is() )
|
||||
xNameReplace.set( xNameContainer, UNO_QUERY );
|
||||
xNameReplace = xNameContainer;
|
||||
else
|
||||
xNameReplace.set( me->members->xInvocation, UNO_QUERY );
|
||||
|
||||
|
@ -430,7 +430,7 @@ static PyObject *createUnoStructHelper(
|
||||
{
|
||||
OUString typeName( OUString::createFromAscii(PyStr_AsString(structName)));
|
||||
RuntimeCargo *c = runtime.getImpl()->cargo;
|
||||
Reference<XIdlClass> idl_class ( c->xCoreReflection->forName (typeName),UNO_QUERY);
|
||||
Reference<XIdlClass> idl_class = c->xCoreReflection->forName (typeName);
|
||||
if (idl_class.is ())
|
||||
{
|
||||
idl_class->createObject (IdlStruct);
|
||||
|
Loading…
x
Reference in New Issue
Block a user