diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-19 20:10:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-20 07:57:28 +0200 |
commit | 775c8a76d61f5692c54f524725b369cfd2a91539 (patch) | |
tree | e1c59ea49db80b1866b983221dabc71f1277c1db /sd/qa/unit | |
parent | 8239e13dac39741003dfbce7099c3197080aafa8 (diff) |
loplugin:referencecasting in sd
Change-Id: Ief0d02006afd6cb9cd6da1da9208e374df644a42
Reviewed-on: https://gerrit.libreoffice.org/75977
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/qa/unit')
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 4 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 18 | ||||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 15 | ||||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 5 | ||||
-rw-r--r-- | sd/qa/unit/misc-tests.cxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 6 |
7 files changed, 25 insertions, 27 deletions
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index a3df821e1bf0..de21002e9796 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -465,7 +465,7 @@ void SdOOXMLExportTest1::testFdo83751() CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr ); uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY ); - uno::Reference<document::XDocumentProperties> xProps( xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY ); + uno::Reference<document::XDocumentProperties> xProps = xDocumentPropertiesSupplier->getDocumentProperties(); uno::Reference<beans::XPropertySet> xUDProps( xProps->getUserDefinedProperties(), uno::UNO_QUERY ); OUString propValue; xUDProps->getPropertyValue("Testing") >>= propValue; @@ -492,7 +492,7 @@ void SdOOXMLExportTest1::testTableCellFillProperties() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/Table_with_Cell_Fill.odp"), ODP); // Export the document and import again for a check - uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8); diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index ea41ec84a47a..ac274d631a2a 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -520,7 +520,7 @@ void SdOOXMLExportTest2::testTdf91378() SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr ); uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY ); - uno::Reference<document::XDocumentProperties> xProps( xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY ); + uno::Reference<document::XDocumentProperties> xProps = xDocumentPropertiesSupplier->getDocumentProperties(); uno::Reference<beans::XPropertySet> xUDProps( xProps->getUserDefinedProperties(), uno::UNO_QUERY ); OUString propValue; xUDProps->getPropertyValue("Testing") >>= propValue; diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index d2ab9ba010ed..803caeb163e2 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -460,7 +460,7 @@ void SdExportTest::testSwappedOutImageExport() const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName); // Export the document and import again for a check - uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); @@ -516,7 +516,7 @@ void SdExportTest::testOOoXMLAnimations() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/sxi/ooo41061-1.sxi"), SXI); - uno::Reference<lang::XComponent> xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference<lang::XComponent> xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8); @@ -592,7 +592,7 @@ void SdExportTest::testUnknownAttributes() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/unknown-attribute.fodp"), FODP); - uno::Reference<lang::XComponent> xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference<lang::XComponent> xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8); @@ -615,14 +615,14 @@ void SdExportTest::testTdf80020() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80020.odp"), ODP); { uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("graphics"), uno::UNO_QUERY); uno::Reference<style::XStyle> xStyle(xStyleFamily->getByName("Test Style"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("text"), xStyle->getParentStyle()); xDocShRef = saveAndReload( xDocShRef.get(), ODP ); } uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("graphics"), uno::UNO_QUERY); uno::Reference<style::XStyle> xStyle(xStyleFamily->getByName("Test Style"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("text"), xStyle->getParentStyle()); @@ -645,7 +645,7 @@ void SdExportTest::testLinkedGraphicRT() sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/document_with_linked_graphic.odp"), ODP); // Export the document and import again for a check - uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); @@ -717,7 +717,7 @@ void SdExportTest::testImageWithSpecialID() const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName); // Export the document and import again for a check - uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); @@ -983,7 +983,7 @@ void SdExportTest::testTdf115394PPT() sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/ppt/tdf115394.ppt"), PPT); // Export the document and import again for a check - uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPT].pFilterName), RTL_TEXTENCODING_UTF8); @@ -1022,7 +1022,7 @@ void SdExportTest::testBulletsAsImage() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/BulletsAsImage.odp"), ODP); const OString sFailedMessageBase = OString("Failed on filter '") + OString(aFileFormats[nExportFormat].pFilterName) + OString("': "); - uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY); + uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel(); uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[nExportFormat].pFilterName), RTL_TEXTENCODING_UTF8); diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 9226bbe79152..a55e340e3ec4 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -875,8 +875,8 @@ void SdImportTestSmartArt::testOrgChart() CPPUNIT_ASSERT_GREATER(aAssistantPos.Y, aEmployeePos.Y); // Make sure the connector of the assistant is above the shape. - uno::Reference<drawing::XShape> xAssistantConnector( - getChildShape(getChildShape(getChildShape(xGroup, 1), 1), 0), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xAssistantConnector = + getChildShape(getChildShape(getChildShape(xGroup, 1), 1), 0); CPPUNIT_ASSERT(xAssistantConnector.is()); //awt::Point aAssistantConnectorPos = xAssistantConnector->getPosition(); // This failed, the vertical positions of the connector and the shape of @@ -1039,8 +1039,7 @@ void SdImportTestSmartArt::testPictureStrip() CPPUNIT_ASSERT(xFirstImage.is()); uno::Reference<drawing::XShape> xSecondImageShape(xSecondImage, uno::UNO_QUERY); CPPUNIT_ASSERT(xSecondImage.is()); - uno::Reference<drawing::XShape> xThirdImageShape(getChildShape(getChildShape(xGroup, 3), 1), - uno::UNO_QUERY); + uno::Reference<drawing::XShape> xThirdImageShape = getChildShape(getChildShape(xGroup, 3), 1); CPPUNIT_ASSERT(xThirdImageShape.is()); // Without the accompanying fix in place, this test would have failed: the first and the second // image were in the same row. @@ -1357,10 +1356,10 @@ void SdImportTestSmartArt::testDataFollow() uno::Reference<drawing::XShapes> xGroupLeft(xGroup->getByIndex(1), uno::UNO_QUERY); uno::Reference<drawing::XShape> xGroupB(xGroupLeft->getByIndex(1), uno::UNO_QUERY); - uno::Reference<drawing::XShape> xShapeB1(getChildShape(getChildShape(getChildShape(xGroupB, 1), 0), 0), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShapeB1 = getChildShape(getChildShape(getChildShape(xGroupB, 1), 0), 0); uno::Reference<text::XText> xTextB1(xShapeB1, uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("B1"), xTextB1->getString()); - uno::Reference<drawing::XShape> xShapeB2(getChildShape(getChildShape(getChildShape(xGroupB, 3), 0), 0), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShapeB2 = getChildShape(getChildShape(getChildShape(xGroupB, 3), 0), 0); uno::Reference<text::XText> xTextB2(xShapeB2, uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("B2"), xTextB2->getString()); @@ -1369,10 +1368,10 @@ void SdImportTestSmartArt::testDataFollow() uno::Reference<drawing::XShapes> xGroupRight(xGroup->getByIndex(2), uno::UNO_QUERY); uno::Reference<drawing::XShape> xGroupC(xGroupRight->getByIndex(1), uno::UNO_QUERY); - uno::Reference<drawing::XShape> xShapeC1(getChildShape(getChildShape(getChildShape(xGroupC, 3), 0), 0), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShapeC1 = getChildShape(getChildShape(getChildShape(xGroupC, 3), 0), 0); uno::Reference<text::XText> xTextC1(xShapeC1, uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("C1"), xTextC1->getString()); - uno::Reference<drawing::XShape> xShapeC2(getChildShape(getChildShape(getChildShape(xGroupC, 5), 0), 0), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShapeC2 = getChildShape(getChildShape(getChildShape(xGroupC, 5), 0), 0); uno::Reference<text::XText> xTextC2(xShapeC2, uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("C2"), xTextC2->getString()); diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index e251f3443382..4e23ad69f227 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -722,7 +722,7 @@ void SdImportTest::testTdf97808() uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier( xDocShRef->GetModel(), uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("graphics"), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("objectwithoutfill"), uno::UNO_QUERY); OUString lineend; @@ -2792,8 +2792,7 @@ void SdImportTest::testCropToShape() uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is()); uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); - uno::Reference<drawing::XShapeDescriptor> xDesc(xShape, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString{"com.sun.star.drawing.CustomShape"}, xDesc->getShapeType()); + CPPUNIT_ASSERT_EQUAL(OUString{"com.sun.star.drawing.CustomShape"}, xShape->getShapeType()); CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is()); uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); css::drawing::FillStyle fillStyle; diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 831c12b287e7..293f800aaefb 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -155,7 +155,7 @@ sd::DrawDocShellRef SdMiscTest::Load(const OUString& rURL, sal_Int32 nFormat) uno::Reference< frame::XModel2 > xModel2(xDocSh->GetModel(), uno::UNO_QUERY); CPPUNIT_ASSERT(xModel2.is()); - uno::Reference< frame::XController2 > xController(xModel2->createDefaultViewController(xTargetFrame), uno::UNO_QUERY); + uno::Reference< frame::XController2 > xController = xModel2->createDefaultViewController(xTargetFrame); CPPUNIT_ASSERT(xController.is()); // introduce model/view/controller to each other diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 731a14347af9..40d9ee3f511e 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -884,8 +884,8 @@ void SdTiledRenderingTest::testResizeTable() pView->SdrEndTextEdit(); // Remember the original row heights. - uno::Reference<table::XColumnRowRange> xTable(pTableObject->getTable(), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XColumnRowRange> xTable = pTableObject->getTable(); + uno::Reference<container::XIndexAccess> xRows = xTable->getRows(); uno::Reference<beans::XPropertySet> xRow1(xRows->getByIndex(0), uno::UNO_QUERY); sal_Int32 nExpectedRow1 = xRow1->getPropertyValue("Size").get<sal_Int32>(); uno::Reference<beans::XPropertySet> xRow2(xRows->getByIndex(1), uno::UNO_QUERY); @@ -2104,7 +2104,7 @@ void SdTiledRenderingTest::testTdf115783() pView->SdrEndTextEdit(); // And now verify that the cell has the correct font size. - uno::Reference<table::XCellRange> xTable(pTableObject->getTable(), uno::UNO_QUERY); + uno::Reference<table::XCellRange> xTable = pTableObject->getTable(); CPPUNIT_ASSERT(xTable.is()); uno::Reference<text::XTextRange> xCell(xTable->getCellByPosition(1, 0), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); |