loplugin:referencecasting in filter

Change-Id: Ia437fa8f18052afa2b70dfedc1b4badcfd165d6a
Reviewed-on: https://gerrit.libreoffice.org/75956
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-07-19 15:32:24 +02:00
parent 9b122d23e3
commit c3741a89a9
12 changed files with 28 additions and 41 deletions

View File

@@ -1518,7 +1518,6 @@ void FilterCache::impl_savePatchUINames(const css::uno::Reference< css::containe
const CacheItem& rItem)
{
css::uno::Reference< css::container::XNameContainer > xAdd (xNode, css::uno::UNO_QUERY);
css::uno::Reference< css::container::XNameAccess > xCheck(xNode, css::uno::UNO_QUERY);
css::uno::Sequence< css::beans::PropertyValue > lUINames = rItem.getUnpackedValueOrDefault(PROPNAME_UINAMES, css::uno::Sequence< css::beans::PropertyValue >());
sal_Int32 c = lUINames.getLength();
@@ -1526,7 +1525,7 @@ void FilterCache::impl_savePatchUINames(const css::uno::Reference< css::containe
for (sal_Int32 i=0; i<c; ++i)
{
if (xCheck->hasByName(pUINames[i].Name))
if (xNode->hasByName(pUINames[i].Name))
xNode->replaceByName(pUINames[i].Name, pUINames[i].Value);
else
xAdd->insertByName(pUINames[i].Name, pUINames[i].Value);

View File

@@ -121,7 +121,7 @@ bool FlashExporter::exportAll( const Reference< XComponent >& xDoc, Reference< X
if(!xDrawPagesSupplier.is())
return false;
Reference< XIndexAccess > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
Reference< XIndexAccess > xDrawPages = xDrawPagesSupplier->getDrawPages();
if(!xDrawPages.is())
return false;
@@ -451,9 +451,7 @@ sal_uInt16 FlashExporter::exportDrawPageBackground(sal_uInt16 nPage, Reference<
sal_uInt16 FlashExporter::exportMasterPageObjects(sal_uInt16 nPage, Reference< XDrawPage > const & xMasterPage)
{
Reference< XShapes > xShapes( xMasterPage, UNO_QUERY );
BitmapChecksum shapesum = ActionSummer(xShapes);
BitmapChecksum shapesum = ActionSummer(xMasterPage);
ChecksumCache::iterator it = gObjectCache.find(shapesum);
@@ -481,8 +479,7 @@ sal_uInt16 FlashExporter::exportMasterPageObjects(sal_uInt16 nPage, Reference< X
shape infos to the current PageInfo */
void FlashExporter::exportDrawPageContents( const Reference< XDrawPage >& xPage, bool bStream, bool bMaster )
{
Reference< XShapes > xShapes( xPage, UNO_QUERY );
exportShapes(xShapes, bStream, bMaster);
exportShapes(xPage, bStream, bMaster);
}

View File

@@ -308,7 +308,7 @@ void FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue >& a
if(!xDrawPagesSupplier.is())
return;
Reference< XIndexAccess > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
Reference< XIndexAccess > xDrawPages = xDrawPagesSupplier->getDrawPages();
if(!xDrawPages.is())
return;

View File

@@ -95,7 +95,7 @@ bool CGMImpressOutAct::ImplInitPage()
bool bStatRet = false;
if( maXDrawPage.is() )
{
maXShapes = uno::Reference< drawing::XShapes >( maXDrawPage, uno::UNO_QUERY );
maXShapes = maXDrawPage;
if ( maXShapes.is() )
{
bStatRet = true;
@@ -381,7 +381,7 @@ void CGMImpressOutAct::InsertPage()
{
if ( mnCurrentPage ) // one side is always existing, therefore the first side will be left out
{
uno::Reference< drawing::XDrawPage > xPage( maXDrawPages->insertNewByIndex( 0xffff ), uno::UNO_QUERY );
uno::Reference< drawing::XDrawPage > xPage = maXDrawPages->insertNewByIndex( 0xffff );
maXDrawPage = xPage;
if ( !ImplInitPage() )
mpCGM->mbStatus = false;

View File

@@ -171,7 +171,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
if( const SdrObject* pSdrObj = rObj.GetSdrObject() )
if (!pSdrObj->GetName().isEmpty())
aShapeName = pSdrObj->GetName();
uno::Reference< drawing::XShape> xShape(rObj.GetShapeRef(), uno::UNO_QUERY);
uno::Reference< drawing::XShape> xShape = rObj.GetShapeRef();
if (xShape.is())
{
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
@@ -414,7 +414,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
}
else if ( rObj.GetType() == "drawing.Control" )
{
const Reference< XPropertySet > xPropSet(rObj.mXPropSet, UNO_QUERY);
const Reference< XPropertySet > xPropSet = rObj.mXPropSet;
const Reference<XPropertySetInfo> xPropInfo = xPropSet.is() ? xPropSet->getPropertySetInfo() : Reference<XPropertySetInfo>();
// This code is expected to be called only for DOCX format.
if (xPropInfo.is() && xPropInfo->hasPropertyByName("AnchorType") && bOOxmlExport)
@@ -868,7 +868,7 @@ bool ImplEESdrWriter::ImplInitPage( const SdrPage& rPage )
if (xOldDrawPage.is())
xOldDrawPage->dispose();
mXDrawPage = pSvxDrawPage = new SvxFmDrawPage( const_cast<SdrPage*>(&rPage) );
mXShapes.set( mXDrawPage, UNO_QUERY );
mXShapes = mXDrawPage;
if ( !mXShapes.is() )
return false;
ImplInitPageValues();

View File

@@ -74,9 +74,7 @@ const uno::Reference< drawing::XShapes >& SvxMSConvertOCXControls::GetShapes()
GetDrawPage();
if( xDrawPage.is() )
{
xShapes.set(xDrawPage, uno::UNO_QUERY);
OSL_ENSURE( xShapes.is(), "UNO_QUERY failed for XShapes from XDrawPage" );
xShapes = xDrawPage;
}
}
return xShapes;

View File

@@ -147,7 +147,7 @@ CustomToolBarImportHelper::createMenu( const OUString& rName, const uno::Referen
aPopupMenu[3].Value <<= sal_Int32( 0 );
xPopup->insertByIndex( xPopup->getCount(), uno::makeAny( aPopupMenu ) );
xCfgManager->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xPopup, uno::UNO_QUERY ) );
xCfgManager->insertSettings( sMenuBar, xPopup );
uno::Reference< ui::XUIConfigurationPersistence > xPersistence( xCfgManager, uno::UNO_QUERY_THROW );
xPersistence->store();
}

View File

@@ -92,7 +92,7 @@ OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence<beans::PropertyValue
if ( !xInStream.is() )
return OUString();
uno::Reference< embed::XStorage > xStorage( ::comphelper::OStorageHelper::GetStorageFromInputStream( xInStream, mxCxt ), uno::UNO_QUERY );
uno::Reference< embed::XStorage > xStorage = ::comphelper::OStorageHelper::GetStorageFromInputStream( xInStream, mxCxt );
if ( !xStorage.is() )
return OUString();

View File

@@ -553,7 +553,7 @@ bool SVGFilter::implExportImpressOrDraw( const Reference< XOutputStream >& rxOSt
{
if( !mSelectedPages.empty() && !mMasterPageTargets.empty() )
{
Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( rxOStm ), UNO_QUERY );
Reference< XDocumentHandler > xDocHandler = implCreateExportDocumentHandler( rxOStm );
if( xDocHandler.is() )
{
@@ -643,7 +643,7 @@ bool SVGFilter::implExportWriterOrCalc( const Reference< XOutputStream >& rxOStm
if( rxOStm.is() )
{
Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( rxOStm ), UNO_QUERY );
Reference< XDocumentHandler > xDocHandler = implCreateExportDocumentHandler( rxOStm );
if( xDocHandler.is() )
{
@@ -1114,7 +1114,7 @@ void SVGFilter::implGenerateMetaData()
{
const Reference< css::drawing::XDrawPage > & xDrawPage = mSelectedPages[i];
Reference< css::drawing::XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY );
Reference< css::drawing::XDrawPage > xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY );
Reference< css::drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage();
OUString aSlideId(aId + "_" + OUString::number( i ));
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aSlideId );

View File

@@ -186,7 +186,7 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
}
// get the DrawPages
uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), uno::UNO_QUERY );
uno::Reference< drawing::XDrawPages > xDrawPages = xDrawPagesSupplier->getDrawPages();
if(!xDrawPages.is())
{
@@ -469,8 +469,8 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
if( xMasterPagesSupplier.is() && xDrawPagesSupplier.is() )
{
uno::Reference< drawing::XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), uno::UNO_QUERY );
uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), uno::UNO_QUERY );
uno::Reference< drawing::XDrawPages > xMasterPages = xMasterPagesSupplier->getMasterPages();
uno::Reference< drawing::XDrawPages > xDrawPages = xDrawPagesSupplier->getDrawPages();
if( xMasterPages.is() && xMasterPages->getCount() &&
xDrawPages.is() && xDrawPages->getCount() )
{

View File

@@ -53,7 +53,7 @@ using namespace ::com::sun::star::embed;
namespace XSLT
{
Reference<XStream> OleHandler::createTempFile() {
Reference<XStream> tempFile( TempFile::create(m_xContext), UNO_QUERY);
Reference<XStream> tempFile = TempFile::create(m_xContext);
OSL_ASSERT(tempFile.is());
return tempFile;
}

View File

@@ -334,19 +334,15 @@ namespace XSLT
this));
// connect input to transformer
css::uno::Reference<XActiveDataSink> tsink(m_tcontrol, UNO_QUERY);
tsink->setInputStream(xInputStream);
m_tcontrol->setInputStream(xInputStream);
// create pipe
css::uno::Reference<XOutputStream> pipeout(
Pipe::create(m_xContext),
UNO_QUERY);
css::uno::Reference<XOutputStream> pipeout =
Pipe::create(m_xContext);
css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY);
//connect transformer to pipe
css::uno::Reference<XActiveDataSource> tsource(m_tcontrol,
UNO_QUERY);
tsource->setOutputStream(pipeout);
m_tcontrol->setOutputStream(pipeout);
// connect pipe to sax parser
InputSource aInput;
@@ -477,9 +473,8 @@ namespace XSLT
m_tcontrol->addListener(css::uno::Reference<XStreamListener> (this));
// create pipe
css::uno::Reference<XOutputStream> pipeout(
Pipe::create(m_xContext),
UNO_QUERY);
css::uno::Reference<XOutputStream> pipeout =
Pipe::create(m_xContext);
css::uno::Reference<XInputStream> pipein(pipeout, UNO_QUERY);
// connect sax writer to pipe
@@ -488,12 +483,10 @@ namespace XSLT
xmlsource->setOutputStream(pipeout);
// connect pipe to transformer
css::uno::Reference<XActiveDataSink> tsink(m_tcontrol, UNO_QUERY);
tsink->setInputStream(pipein);
m_tcontrol->setInputStream(pipein);
// connect transformer to output
css::uno::Reference<XActiveDataSource> tsource(m_tcontrol, UNO_QUERY);
tsource->setOutputStream(m_rOutputStream);
m_tcontrol->setOutputStream(m_rOutputStream);
// we will start receiving events after returning 'true'.
// we will start the transformation as soon as we receive the startDocument