sd/qa/unit/export-tests-ooxml1.cxx                        |    4 -
 sd/qa/unit/export-tests-ooxml2.cxx                        |    2 
 sd/qa/unit/export-tests.cxx                               |   18 +++----
 sd/qa/unit/import-tests-smartart.cxx                      |   15 ++---
 sd/qa/unit/import-tests.cxx                               |    5 -
 sd/qa/unit/misc-tests.cxx                                 |    2 
 sd/qa/unit/tiledrendering/tiledrendering.cxx              |    6 +-
 sd/source/core/CustomAnimationEffect.cxx                  |   36 ++++++--------
 sd/source/core/sdpage.cxx                                 |    2 
 sd/source/filter/eppt/pptexanimations.cxx                 |    6 +-
 sd/source/filter/eppt/pptx-animations.cxx                 |    4 -
 sd/source/filter/eppt/pptx-epptbase.cxx                   |    4 -
 sd/source/filter/eppt/pptx-epptooxml.cxx                  |   17 ++----
 sd/source/filter/ppt/pptinanimations.cxx                  |    2 
 sd/source/filter/xml/sdxmlwrp.cxx                         |    9 +--
 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx |    2 
 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx |   10 +--
 sd/source/ui/dlg/PhotoAlbumDialog.cxx                     |    5 -
 sd/source/ui/dlg/sdtreelb.cxx                             |    5 -
 sd/source/ui/dlg/tpaction.cxx                             |    7 +-
 sd/source/ui/dlg/tpoption.cxx                             |    4 -
 sd/source/ui/framework/factories/BasicViewFactory.cxx     |    5 -
 sd/source/ui/framework/factories/ViewShellWrapper.cxx     |    2 
 sd/source/ui/func/fuinsert.cxx                            |   12 +---
 sd/source/ui/presenter/PresenterCanvas.cxx                |    2 
 sd/source/ui/presenter/PresenterHelper.cxx                |    3 -
 sd/source/ui/remotecontrol/Communicator.cxx               |    2 
 sd/source/ui/remotecontrol/ImagePreparer.cxx              |   11 +---
 sd/source/ui/sidebar/DocumentHelper.cxx                   |    4 -
 sd/source/ui/sidebar/MasterPageContainer.cxx              |    4 -
 sd/source/ui/sidebar/SlideBackground.cxx                  |    6 +-
 sd/source/ui/slideshow/slideshowimpl.cxx                  |    2 
 sd/source/ui/slidesorter/controller/SlsListener.cxx       |   10 +--
 sd/source/ui/slidesorter/model/SlideSorterModel.cxx       |    4 -
 sd/source/ui/tools/EventMultiplexer.cxx                   |   15 ++---
 sd/source/ui/unoidl/SdUnoDrawView.cxx                     |    4 -
 sd/source/ui/unoidl/UnoDocumentSettings.cxx               |    3 -
 sd/source/ui/unoidl/randomnode.cxx                        |    2 
 sd/source/ui/unoidl/unomodel.cxx                          |   12 +---
 sd/source/ui/unoidl/unosrch.cxx                           |    9 +--
 sd/source/ui/view/outlview.cxx                            |    2 
 sd/source/ui/view/sdview3.cxx                             |    2 
 42 files changed, 125 insertions(+), 156 deletions(-)

New commits:
commit 775c8a76d61f5692c54f524725b369cfd2a91539
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jul 19 20:10:21 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Jul 20 07:57:28 2019 +0200

    loplugin:referencecasting in sd
    
    Change-Id: Ief0d02006afd6cb9cd6da1da9208e374df644a42
    Reviewed-on: https://gerrit.libreoffice.org/75977
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

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());
diff --git a/sd/source/core/CustomAnimationEffect.cxx 
b/sd/source/core/CustomAnimationEffect.cxx
index cf362b7ae901..b5f96d8ff7cf 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -217,7 +217,7 @@ void CustomAnimationEffect::setNode( const 
css::uno::Reference< css::animations:
     Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY );
     if( xEnumerationAccess.is() )
     {
-        Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+        Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
         if( xEnumeration.is() )
         {
             while( xEnumeration->hasMoreElements() )
@@ -551,7 +551,7 @@ bool CustomAnimationEffect::checkForText()
             Reference< XEnumerationAccess > xEA( xText, UNO_QUERY );
             if( xEA.is() )
             {
-                Reference< XEnumeration > xEnumeration( 
xEA->createEnumeration(), UNO_QUERY );
+                Reference< XEnumeration > xEnumeration = 
xEA->createEnumeration();
                 if( xEnumeration.is() )
                 {
                     bool bHasText = xEnumeration->hasMoreElements();
@@ -653,7 +653,7 @@ void CustomAnimationEffect::setTarget( const css::uno::Any& 
rTarget )
                 Reference< XEnumerationAccess > xEnumerationAccess( mxNode, 
UNO_QUERY );
                 if( xEnumerationAccess.is() )
                 {
-                    Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+                    Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
                     if( xEnumeration.is() )
                     {
                         while( xEnumeration->hasMoreElements() )
@@ -697,7 +697,7 @@ void CustomAnimationEffect::setTargetSubItem( sal_Int16 
nSubItem )
             Reference< XEnumerationAccess > xEnumerationAccess( mxNode, 
UNO_QUERY );
             if( xEnumerationAccess.is() )
             {
-                Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+                Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
                 if( xEnumeration.is() )
                 {
                     while( xEnumeration->hasMoreElements() )
@@ -733,7 +733,7 @@ void CustomAnimationEffect::setDuration( double fDuration )
         Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY 
);
         if( xEnumerationAccess.is() )
         {
-            Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+            Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
             if( xEnumeration.is() )
             {
                 while( xEnumeration->hasMoreElements() )
@@ -1146,7 +1146,7 @@ Any CustomAnimationEffect::getProperty( sal_Int32 
nNodeType, const OUString& rAt
         Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY 
);
         if( xEnumerationAccess.is() )
         {
-            Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+            Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
             if( xEnumeration.is() )
             {
                 while( xEnumeration->hasMoreElements() && 
!aProperty.hasValue() )
@@ -1186,7 +1186,7 @@ bool CustomAnimationEffect::setProperty( sal_Int32 
nNodeType, const OUString& rA
         Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY 
);
         if( xEnumerationAccess.is() )
         {
-            Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+            Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
             if( xEnumeration.is() )
             {
                 while( xEnumeration->hasMoreElements() )
@@ -1243,7 +1243,7 @@ Any CustomAnimationEffect::getColor( sal_Int32 nIndex )
         Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY 
);
         if( xEnumerationAccess.is() )
         {
-            Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+            Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
             if( xEnumeration.is() )
             {
                 while( xEnumeration->hasMoreElements() && !aColor.hasValue() )
@@ -1293,7 +1293,7 @@ void CustomAnimationEffect::setColor( sal_Int32 nIndex, 
const Any& rColor )
         Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY 
);
         if( xEnumerationAccess.is() )
         {
-            Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+            Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
             if( xEnumeration.is() )
             {
                 while( xEnumeration->hasMoreElements() )
@@ -1346,7 +1346,7 @@ Any CustomAnimationEffect::getTransformationProperty( 
sal_Int32 nTransformType,
         Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY 
);
         if( xEnumerationAccess.is() )
         {
-            Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+            Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
             if( xEnumeration.is() )
             {
                 while( xEnumeration->hasMoreElements() && 
!aProperty.hasValue() )
@@ -1383,7 +1383,7 @@ bool CustomAnimationEffect::setTransformationProperty( 
sal_Int32 nTransformType,
         Reference< XEnumerationAccess > xEnumerationAccess( mxNode, UNO_QUERY 
);
         if( xEnumerationAccess.is() )
         {
-            Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+            Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
             if( xEnumeration.is() )
             {
                 while( xEnumeration->hasMoreElements() )
@@ -1476,12 +1476,12 @@ void CustomAnimationEffect::removeAudio()
 
         if( mxAudio.is() )
         {
-            xChild.set( mxAudio, UNO_QUERY );
+            xChild = mxAudio;
             mxAudio.clear();
         }
         else if( mnCommand == EffectCommands::STOPAUDIO )
         {
-            xChild.set( findCommandNode( mxNode ), UNO_QUERY );
+            xChild = findCommandNode( mxNode );
             mnCommand = 0;
         }
 
@@ -1509,9 +1509,8 @@ void CustomAnimationEffect::setAudio( const Reference< 
css::animations::XAudio >
         removeAudio();
         mxAudio = xAudio;
         Reference< XTimeContainer > xContainer( mxNode, UNO_QUERY );
-        Reference< XAnimationNode > xChild( mxAudio, UNO_QUERY );
-        if( xContainer.is() && xChild.is() )
-            xContainer->appendChild( xChild );
+        if( xContainer.is() && mxAudio.is() )
+            xContainer->appendChild( mxAudio );
     }
     catch( Exception& )
     {
@@ -1645,8 +1644,7 @@ void EffectSequenceHelper::reset()
 
 Reference< XAnimationNode > EffectSequenceHelper::getRootNode()
 {
-    Reference< XAnimationNode > xRoot( mxSequenceRoot, UNO_QUERY );
-    return xRoot;
+    return mxSequenceRoot;
 }
 
 void EffectSequenceHelper::append( const CustomAnimationEffectPtr& pEffect )
@@ -2185,7 +2183,7 @@ static bool isParagraphTargetTextEmpty( ParagraphTarget 
aParaTarget )
         Reference< XEnumerationAccess > xEA( xText, UNO_QUERY );
         if( xEA.is() )
         {
-            Reference< XEnumeration > xEnumeration( xEA->createEnumeration(), 
UNO_QUERY );
+            Reference< XEnumeration > xEnumeration = xEA->createEnumeration();
             if( xEnumeration.is() )
             {
                 // advance to the Nth paragraph
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index c850461f3c9d..594c2dfec7f0 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -140,7 +140,7 @@ namespace
         css::uno::Reference<css::container::XEnumerationAccess > 
xEnumerationAccess(rAnimationNode, UNO_QUERY);
         if (!xEnumerationAccess.is())
             return;
-        css::uno::Reference<css::container::XEnumeration> 
xEnumeration(xEnumerationAccess->createEnumeration(), UNO_QUERY);
+        css::uno::Reference<css::container::XEnumeration> xEnumeration = 
xEnumerationAccess->createEnumeration();
         if (!xEnumeration.is())
             return;
         while (xEnumeration->hasMoreElements())
diff --git a/sd/source/filter/eppt/pptexanimations.cxx 
b/sd/source/filter/eppt/pptexanimations.cxx
index e90e9e16efc2..21b8fbd3a370 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -435,7 +435,7 @@ bool AnimationExporter::isEmptyNode( const Reference< 
XAnimationNode >& xNode )
             Reference< XEnumerationAccess > xEnumerationAccess( xNode, 
UNO_QUERY );
             if( xEnumerationAccess.is() )
             {
-                Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+                Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
                 if( xEnumeration.is() )
                 {
                     while( xEnumeration->hasMoreElements() )
@@ -698,7 +698,7 @@ void AnimationExporter::exportNode( SvStream& rStrm, 
Reference< XAnimationNode >
             Reference< XEnumerationAccess > xEnumerationAccess( xNode, 
UNO_QUERY );
             if( xEnumerationAccess.is() )
             {
-                Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+                Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
                 if( xEnumeration.is() )
                 {
                     while( xEnumeration->hasMoreElements() )
@@ -2129,7 +2129,7 @@ void AnimationExporter::exportIterate( SvStream& rStrm, 
const Reference< XAnimat
     Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
     if( xEnumerationAccess.is() )
     {
-        Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+        Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
         if( xEnumeration.is() )
         {
             while( xEnumeration->hasMoreElements() )
diff --git a/sd/source/filter/eppt/pptx-animations.cxx 
b/sd/source/filter/eppt/pptx-animations.cxx
index 1a35c7777e2a..cdd1bbdd6d5a 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -1258,7 +1258,7 @@ void PPTXAnimationExport::WriteAnimations(const 
Reference<XDrawPage>& rXDrawPage
     if (!xEnumerationAccess.is())
         return;
 
-    Reference<XEnumeration> 
xEnumeration(xEnumerationAccess->createEnumeration(), UNO_QUERY);
+    Reference<XEnumeration> xEnumeration = 
xEnumerationAccess->createEnumeration();
     if (!(xEnumeration.is() && xEnumeration->hasMoreElements()))
         return;
 
@@ -1372,7 +1372,7 @@ bool NodeContext::initChildNodes()
     Reference<XEnumerationAccess> xEnumerationAccess(mxNode, UNO_QUERY);
     if (xEnumerationAccess.is())
     {
-        Reference<XEnumeration> 
xEnumeration(xEnumerationAccess->createEnumeration(), UNO_QUERY);
+        Reference<XEnumeration> xEnumeration = 
xEnumerationAccess->createEnumeration();
         bool bIsMainSeq = mnEffectNodeType == EffectNodeType::MAIN_SEQUENCE;
         bool bIsIterateChild = mxNode->getType() == AnimationNodeType::ITERATE;
         if (xEnumeration.is())
diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx 
b/sd/source/filter/eppt/pptx-epptbase.cxx
index 0c10c2bada54..01b837c1870a 100644
--- a/sd/source/filter/eppt/pptx-epptbase.cxx
+++ b/sd/source/filter/eppt/pptx-epptbase.cxx
@@ -289,7 +289,7 @@ bool PPTWriterBase::GetPageByIndex( sal_uInt32 nIndex, 
PageType ePageType )
         if (GetPropertyValue( aAny, mXPagePropSet, "IsBackgroundDark" ) )
             aAny >>= mbIsBackgroundDark;
 
-        mXShapes.set( mXDrawPage, UNO_QUERY );
+        mXShapes = mXDrawPage;
         if ( !mXShapes.is() )
             break;
 
@@ -625,7 +625,7 @@ bool PPTWriterBase::CreateMainNotes()
     if ( !mXPropSet.is() )
         return false;
 
-    mXShapes.set( mXDrawPage, css::uno::UNO_QUERY );
+    mXShapes = mXDrawPage;
     if ( !mXShapes.is() )
         return false;
 
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index e6a1495ee4a5..fb0b5cb8a6bf 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -378,7 +378,7 @@ bool PowerPointExport::exportDocument()
     DrawingML::ResetCounters();
     maShapeMap.clear();
 
-    mXModel.set(getModel(), UNO_QUERY);
+    mXModel = getModel();
 
     //write document properties
     writeDocumentProperties();
@@ -417,7 +417,7 @@ bool PowerPointExport::exportDocument()
 
     mPresentationFS->startElementNS(XML_p, XML_presentation, PNMSS);
 
-    mXStatusIndicator.set(getStatusIndicator(), UNO_QUERY);
+    mXStatusIndicator = getStatusIndicator();
 
     std::vector< PropertyValue > aProperties;
     PropertyValue aProperty;
@@ -1045,7 +1045,7 @@ void PowerPointExport::WriteVBA()
     if (!xStorageBasedDocument.is())
         return;
 
-    uno::Reference<embed::XStorage> 
xDocumentStorage(xStorageBasedDocument->getDocumentStorage(), uno::UNO_QUERY);
+    uno::Reference<embed::XStorage> xDocumentStorage = 
xStorageBasedDocument->getDocumentStorage();
     OUString aMacrosName("_MS_VBA_Macros");
     if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName))
         return;
@@ -1320,11 +1320,8 @@ void PowerPointExport::ImplWritePPTXLayout(sal_Int32 
nOffset, sal_uInt32 nMaster
     SAL_INFO("sd.eppt", "write layout: " << nOffset);
 
     Reference< drawing::XDrawPagesSupplier > xDPS(getModel(), uno::UNO_QUERY);
-    Reference< drawing::XDrawPages > xDrawPages(xDPS->getDrawPages(), 
uno::UNO_QUERY);
-    Reference< drawing::XDrawPage > xSlide;
-    Reference< container::XIndexAccess > xIndexAccess(xDrawPages, 
uno::UNO_QUERY);
-
-    xSlide = xDrawPages->insertNewByIndex(xIndexAccess->getCount());
+    Reference< drawing::XDrawPages > xDrawPages = xDPS->getDrawPages();
+    Reference< drawing::XDrawPage > xSlide = 
xDrawPages->insertNewByIndex(xDrawPages->getCount());
 
 #ifdef DEBUG
     if (xSlide.is())
@@ -1337,7 +1334,7 @@ void PowerPointExport::ImplWritePPTXLayout(sal_Int32 
nOffset, sal_uInt32 nMaster
     dump_pset(xPropSet);
 #endif
     mXPagePropSet.set(xSlide, UNO_QUERY);
-    mXShapes.set(xSlide, UNO_QUERY);
+    mXShapes = xSlide;
 
     if (mLayoutInfo[ nOffset ].mnFileIdArray.size() < mnMasterPages)
     {
@@ -1952,7 +1949,7 @@ void PowerPointExport::embedEffectAudio(const 
FSHelperPtr& pFS, const OUString&
         if (!xStorageBasedDocument.is())
             return;
 
-        uno::Reference<embed::XStorage> 
xDocumentStorage(xStorageBasedDocument->getDocumentStorage(), uno::UNO_QUERY);
+        uno::Reference<embed::XStorage> xDocumentStorage = 
xStorageBasedDocument->getDocumentStorage();
         if (!xDocumentStorage.is())
             return;
 
diff --git a/sd/source/filter/ppt/pptinanimations.cxx 
b/sd/source/filter/ppt/pptinanimations.cxx
index ba1d4a725a51..64b87265744c 100644
--- a/sd/source/filter/ppt/pptinanimations.cxx
+++ b/sd/source/filter/ppt/pptinanimations.cxx
@@ -303,7 +303,7 @@ int AnimationImporter::importAnimationContainer( const 
Atom* pAtom, const Refere
                     Reference< XEnumerationAccess > xEnumerationAccess( xNode, 
UNO_QUERY );
                     if( xEnumerationAccess.is() )
                     {
-                        Reference< XEnumeration > xEnumeration( 
xEnumerationAccess->createEnumeration(), UNO_QUERY );
+                        Reference< XEnumeration > xEnumeration = 
xEnumerationAccess->createEnumeration();
                         if( xEnumeration.is() )
                         {
                             while( xEnumeration->hasMoreElements() )
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx 
b/sd/source/filter/xml/sdxmlwrp.cxx
index e6e5adb26c4d..d44379d72421 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -523,7 +523,7 @@ bool SdXMLFilter::Import( ErrCode& nError )
     Reference< document::XEmbeddedObjectResolver > xObjectResolver;
     rtl::Reference<SvXMLEmbeddedObjectHelper> xObjectHelper;
 
-    Reference< lang::XComponent > xModelComp( mxModel, uno::UNO_QUERY );
+    Reference< lang::XComponent > xModelComp = mxModel;
 
     // try to get an XStatusIndicator from the Medium
     {
@@ -913,8 +913,6 @@ bool SdXMLFilter::Export()
                 xInfoSet->setPropertyValue( "ProgressCurrent" , aProgCurrent);
             }
 
-            uno::Reference< lang::XComponent > xComponent( mxModel, 
uno::UNO_QUERY );
-
             XML_SERVICES const * pServiceNames = getServices( false, IsDraw(), 
mnStoreVer );
 
             XML_SERVICEMAP aServices[5]; sal_uInt16 i = 0;
@@ -970,8 +968,7 @@ bool SdXMLFilter::Export()
                     xInfoSet->setPropertyValue( sStreamName, Any( sDocName ) );
                 }
 
-                uno::Reference< io::XActiveDataSource > xDocSrc( xWriter, 
uno::UNO_QUERY );
-                xDocSrc->setOutputStream( xDocOut );
+                xWriter->setOutputStream( xDocOut );
 
                 uno::Sequence< uno::Any > aArgs( 2 + ( mxStatusIndicator.is() 
? 1 : 0 ) + ( xGraphicStorageHandler.is() ? 1 : 0 ) + ( xObjectResolver.is() ? 
1 : 0 ) );
                 uno::Any* pArgs = aArgs.getArray();
@@ -991,7 +988,7 @@ bool SdXMLFilter::Export()
                     uno::Reference< document::XExporter > xExporter( xFilter, 
uno::UNO_QUERY );
                     if( xExporter.is() )
                     {
-                        xExporter->setSourceDocument( xComponent );
+                        xExporter->setSourceDocument( mxModel );
                         // outputstream will be closed by SAX parser
                         bDocRet = xFilter->filter( aDescriptor );
                     }
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx 
b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index c271e70718cb..96c922cf41ac 100644
--- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -111,7 +111,7 @@ void AccessibleDocumentViewBase::Init()
     uno::Reference<drawing::XShapes> xShapeList;
     uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
     if (xView.is())
-        xShapeList.set( xView->getCurrentPage(), uno::UNO_QUERY);
+        xShapeList = xView->getCurrentPage();
 
     // Register this object as dispose event listener at the model.
     if (mxModel.is())
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx 
b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index 4a03e06b83b9..1e02117aa0ba 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -100,7 +100,7 @@ void AccessibleDrawDocumentView::Init()
     uno::Reference<drawing::XShapes> xShapeList;
     uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
     if (xView.is())
-        xShapeList.set( xView->getCurrentPage(), uno::UNO_QUERY);
+        xShapeList = xView->getCurrentPage();
 
     // Create the children manager.
     mpChildrenManager.reset(new ChildrenManager(this, xShapeList, 
maShapeTreeInfo, *this));
@@ -298,8 +298,7 @@ void SAL_CALL
             // Inform the children manager to forget all children and give
             // him the new ones.
             mpChildrenManager->ClearAccessibleShapeList ();
-            mpChildrenManager->SetShapeList (uno::Reference<drawing::XShapes> (
-                xView->getCurrentPage(), uno::UNO_QUERY));
+            mpChildrenManager->SetShapeList (xView->getCurrentPage());
 
             rtl::Reference<AccessiblePageShape> xPage(CreateDrawPageShape ());
             if (xPage.is())
@@ -346,8 +345,7 @@ void SAL_CALL
                     xSlide = xSlideController->getCurrentSlide();
                     if (xSlide.is())
                     {
-                        mpChildrenManager->SetShapeList 
(uno::Reference<drawing::XShapes> (
-                                    xSlide, uno::UNO_QUERY));
+                        mpChildrenManager->SetShapeList (xSlide);
                     }
                 }
             }
@@ -918,7 +916,7 @@ void AccessibleDrawDocumentView::UpdateAccessibleName()
     Reference<drawing::XDrawPagesSupplier> xPagesSupplier (mxModel, UNO_QUERY);
     if (xPagesSupplier.is())
     {
-        Reference<container::XIndexAccess> xPages 
(xPagesSupplier->getDrawPages(), UNO_QUERY);
+        Reference<container::XIndexAccess> xPages = 
xPagesSupplier->getDrawPages();
         if (xPages.is())
         {
             sNewName += " / ";
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx 
b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 2a65ba448f01..914674c31700 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -96,7 +96,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl, weld::Button&, 
void)
     else
     {
         Reference< drawing::XDrawPagesSupplier > xDPS( m_pDoc->getUnoModel(), 
uno::UNO_QUERY );
-        Reference< drawing::XDrawPages > xDrawPages( xDPS->getDrawPages(), 
uno::UNO_QUERY );
+        Reference< drawing::XDrawPages > xDrawPages = xDPS->getDrawPages();
         Reference< lang::XMultiServiceFactory > xShapeFactory( 
m_pDoc->getUnoModel(), uno::UNO_QUERY );
 
         Reference< XComponentContext > 
xContext(::comphelper::getProcessComponentContext());
@@ -667,8 +667,7 @@ Reference< drawing::XDrawPage > 
SdPhotoAlbumDialog::appendNewSlide(AutoLayout aL
 )
 {
     Reference< drawing::XDrawPage > xSlide; // Create the slide
-    Reference< container::XIndexAccess > xIndexAccess( xDrawPages, 
uno::UNO_QUERY );
-    xSlide = xDrawPages->insertNewByIndex( xIndexAccess->getCount() );
+    xSlide = xDrawPages->insertNewByIndex( xDrawPages->getCount() );
     SdPage* pSlide = m_pDoc->GetSdPage( 
m_pDoc->GetSdPageCount(PageKind::Standard)-1, PageKind::Standard);
     pSlide->SetAutoLayout(aLayout, true); // Set the layout here
     return xSlide;
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 695a7c97dac2..2d6b2ae0fe45 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1353,11 +1353,10 @@ void SdPageObjsTLB::AddShapeToTransferable (
 
         uno::Reference<frame::XDesktop2> xDesktop = 
frame::Desktop::create(xContext);
 
-        uno::Reference<frame::XFramesSupplier> xFrameSupplier (xDesktop, 
uno::UNO_QUERY);
-        if ( ! xFrameSupplier.is())
+        if ( ! xDesktop.is())
             return nullptr;
 
-        uno::Reference<container::XIndexAccess> xFrameAccess 
(xFrameSupplier->getFrames(), uno::UNO_QUERY);
+        uno::Reference<container::XIndexAccess> xFrameAccess = 
xDesktop->getFrames();
         if ( ! xFrameAccess.is())
             return nullptr;
 
diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx
index 928f39259f82..7e8bb51a0471 100644
--- a/sd/source/ui/dlg/tpaction.cxx
+++ b/sd/source/ui/dlg/tpaction.cxx
@@ -638,13 +638,12 @@ IMPL_LINK_NOARG(SdTPAction, CheckFileHdl, weld::Widget&, 
void)
             uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage();
             DBG_ASSERT( xStorage.is(), "No storage!" );
 
-            uno::Reference < container::XNameAccess > xAccess( xStorage, 
uno::UNO_QUERY );
-            if (xAccess.is())
+            if (xStorage.is())
             {
                 try
                 {
-                    if (xAccess->hasByName(pStarDrawXMLContent) ||
-                        xAccess->hasByName(pStarDrawOldXMLContent))
+                    if (xStorage->hasByName(pStarDrawXMLContent) ||
+                        xStorage->hasByName(pStarDrawOldXMLContent))
                     {
                         if (SdDrawDocument* pBookmarkDoc = 
mpDoc->OpenBookmarkDoc(aFile))
                         {
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 71f7017e0154..e670b3f91485 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -623,8 +623,8 @@ void SdTpOptionsMisc::UpdateCompatibilityControls()
         {
             Reference<frame::XDesktop2> xDesktop = 
frame::Desktop::create(xContext);
 
-            Reference<container::XEnumerationAccess> xComponents (
-                xDesktop->getComponents(), UNO_QUERY);
+            Reference<container::XEnumerationAccess> xComponents =
+                xDesktop->getComponents();
             if ( ! xComponents.is())
                 break;
 
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx 
b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index fa3628550e99..6cd3de93bfa7 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -401,9 +401,8 @@ void BasicViewFactory::ReleaseView (
         Reference<XRelocatableResource> xResource (rpDescriptor->mxView, 
UNO_QUERY);
         if (xResource.is())
         {
-            Reference<XResource> xNewAnchor (mxLocalPane, UNO_QUERY);
-            if (xNewAnchor.is())
-                if (xResource->relocateToAnchor(xNewAnchor))
+            if (mxLocalPane.is())
+                if (xResource->relocateToAnchor(mxLocalPane))
                     mpViewCache->push_back(rpDescriptor);
                 else
                     bIsCacheable = false;
diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx 
b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
index ce78f380259f..2055867dfd36 100644
--- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx
+++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx
@@ -197,7 +197,7 @@ sal_Bool SAL_CALL ViewShellWrapper::relocateToAnchor (
                 bResult = true;
 
                 // Attach to the window of the new pane.
-                xWindow.set(xPane->getWindow(), UNO_QUERY);
+                xWindow = xPane->getWindow();
                 if (xWindow.is())
                 {
                     xWindow->addWindowListener(this);
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 3ce7708cb4f9..0ed716ec7246 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -304,14 +304,10 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
                 GetEmbeddedObjectContainer().CreateEmbeddedObject( 
aName.GetByteSequence(), aObjName );
         if ( xObj.is() )
         {
-            uno::Reference<embed::XComponentSupplier> xCompSupp(xObj, 
uno::UNO_QUERY);
-            if (xCompSupp.is())
-            {
-                // Create default chart type.
-                uno::Reference<chart2::XChartDocument> 
xChartDoc(xCompSupp->getComponent(), uno::UNO_QUERY);
-                if (xChartDoc.is())
-                    xChartDoc->createDefaultChart();
-            }
+            // Create default chart type.
+            uno::Reference<chart2::XChartDocument> 
xChartDoc(xObj->getComponent(), uno::UNO_QUERY);
+            if (xChartDoc.is())
+                xChartDoc->createDefaultChart();
 
             sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
 
diff --git a/sd/source/ui/presenter/PresenterCanvas.cxx 
b/sd/source/ui/presenter/PresenterCanvas.cxx
index 5a9908026519..2c852fe86c51 100644
--- a/sd/source/ui/presenter/PresenterCanvas.cxx
+++ b/sd/source/ui/presenter/PresenterCanvas.cxx
@@ -670,7 +670,7 @@ Reference<rendering::XPolyPolygon2D> 
PresenterCanvas::UpdateSpriteClip (
             xDevice->createCompatibleLinePolyPolygon(aPoints));
         if (xLinePolygon.is())
             xLinePolygon->setClosed(0, true);
-        xPolygon.set(xLinePolygon, UNO_QUERY);
+        xPolygon = xLinePolygon;
     }
 
     return xPolygon;
diff --git a/sd/source/ui/presenter/PresenterHelper.cxx 
b/sd/source/ui/presenter/PresenterHelper.cxx
index a10934f5f5c4..f340b507e8d3 100644
--- a/sd/source/ui/presenter/PresenterHelper.cxx
+++ b/sd/source/ui/presenter/PresenterHelper.cxx
@@ -390,8 +390,7 @@ Reference<rendering::XBitmap> SAL_CALL 
PresenterHelper::loadBitmap (
     ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
 
     const cppcanvas::CanvasSharedPtr pCanvas (
-        cppcanvas::VCLFactory::createCanvas(
-            Reference<css::rendering::XCanvas>(rxCanvas,UNO_QUERY)));
+        cppcanvas::VCLFactory::createCanvas(rxCanvas));
 
     if (pCanvas.get() != nullptr)
     {
diff --git a/sd/source/ui/remotecontrol/Communicator.cxx 
b/sd/source/ui/remotecontrol/Communicator.cxx
index cf5540078e89..81a5cf04c6ef 100644
--- a/sd/source/ui/remotecontrol/Communicator.cxx
+++ b/sd/source/ui/remotecontrol/Communicator.cxx
@@ -66,7 +66,7 @@ void Communicator::execute()
     Receiver aReceiver( pTransmitter.get() );
     try {
         uno::Reference< frame::XDesktop2 > xFramesSupplier = 
frame::Desktop::create( ::comphelper::getProcessComponentContext() );
-        uno::Reference< frame::XFrame > xFrame ( 
xFramesSupplier->getActiveFrame(), uno::UNO_QUERY );
+        uno::Reference< frame::XFrame > xFrame = 
xFramesSupplier->getActiveFrame();
 
         uno::Reference<presentation::XPresentationSupplier> xPS;
         if( xFrame.is() )
diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx 
b/sd/source/ui/remotecontrol/ImagePreparer.cxx
index baf117ac4b7a..fe42b2a81599 100644
--- a/sd/source/ui/remotecontrol/ImagePreparer.cxx
+++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx
@@ -225,17 +225,16 @@ OString ImagePreparer::prepareNotes( sal_uInt32 
aSlideNumber )
     static const OUString sTextShapeName (
         "com.sun.star.drawing.TextShape" );
 
-    uno::Reference<container::XIndexAccess> xIndexAccess ( aNotesPage, 
UNO_QUERY);
-    if (xIndexAccess.is())
+    if (aNotesPage.is())
     {
 
         // Iterate over all shapes and find the one that holds the text.
-        sal_Int32 nCount (xIndexAccess->getCount());
+        sal_Int32 nCount (aNotesPage->getCount());
         for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
         {
 
             uno::Reference<lang::XServiceName> xServiceName (
-                xIndexAccess->getByIndex(nIndex), UNO_QUERY);
+                aNotesPage->getByIndex(nIndex), UNO_QUERY);
             if (xServiceName.is()
                 && xServiceName->getServiceName() == sNotesShapeName)
             {
@@ -249,14 +248,14 @@ OString ImagePreparer::prepareNotes( sal_uInt32 
aSlideNumber )
             else
             {
                 uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor (
-                    xIndexAccess->getByIndex(nIndex), UNO_QUERY);
+                    aNotesPage->getByIndex(nIndex), UNO_QUERY);
                 if (xShapeDescriptor.is())
                 {
                     OUString sType (xShapeDescriptor->getShapeType());
                     if (sType == sNotesShapeName || sType == sTextShapeName)
                     {
                         uno::Reference<text::XTextRange> xText (
-                            xIndexAccess->getByIndex(nIndex), UNO_QUERY);
+                            aNotesPage->getByIndex(nIndex), UNO_QUERY);
                         if (xText.is())
                         {
                             aRet.append(xText->getString());
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx 
b/sd/source/ui/sidebar/DocumentHelper.cxx
index 215793b95489..c6e3d6afd4ab 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -110,8 +110,8 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument (
             rTargetDocument.getUnoModel(), uno::UNO_QUERY);
         if ( ! xSlideSupplier.is())
             break;
-        uno::Reference<drawing::XDrawPages> xSlides (
-            xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
+        uno::Reference<drawing::XDrawPages> xSlides =
+            xSlideSupplier->getDrawPages();
         if ( ! xSlides.is())
             break;
         xSlides->insertNewByIndex (xSlides->getCount());
diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx 
b/sd/source/ui/sidebar/MasterPageContainer.cxx
index dd6b65cef5d6..425a04574910 100644
--- a/sd/source/ui/sidebar/MasterPageContainer.cxx
+++ b/sd/source/ui/sidebar/MasterPageContainer.cxx
@@ -843,8 +843,8 @@ Reference<frame::XModel> 
MasterPageContainer::Implementation::GetModel()
         uno::Reference<drawing::XDrawPagesSupplier> xSlideSupplier (mxModel, 
uno::UNO_QUERY);
         if (xSlideSupplier.is())
         {
-            uno::Reference<drawing::XDrawPages> xSlides (
-                xSlideSupplier->getDrawPages(), uno::UNO_QUERY);
+            uno::Reference<drawing::XDrawPages> xSlides =
+                xSlideSupplier->getDrawPages();
             if (xSlides.is())
             {
                 uno::Reference<drawing::XDrawPage> xNewPage 
(xSlides->insertNewByIndex(0));
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx 
b/sd/source/ui/sidebar/SlideBackground.cxx
index 488690f28e80..f90ea5afe201 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -469,11 +469,11 @@ void SlideBackground::SetPanelTitle( const OUString& 
rTitle )
     if ( !xController.is() )
         return;
 
-    Reference<ui::XSidebarProvider> xSidebarProvider( 
xController->getSidebar(), uno::UNO_QUERY );
+    Reference<ui::XSidebarProvider> xSidebarProvider = 
xController->getSidebar();
     if ( !xSidebarProvider.is() )
         return;
 
-    Reference<ui::XDecks> xDecks ( xSidebarProvider->getDecks(), 
uno::UNO_QUERY);
+    Reference<ui::XDecks> xDecks = xSidebarProvider->getDecks();
     if ( !xDecks.is() )
         return;
 
@@ -481,7 +481,7 @@ void SlideBackground::SetPanelTitle( const OUString& rTitle 
)
     if ( !xDeck.is() )
         return;
 
-    Reference<ui::XPanels> xPanels ( xDeck->getPanels(), uno::UNO_QUERY);
+    Reference<ui::XPanels> xPanels = xDeck->getPanels();
     if ( !xPanels.is() )
         return;
 
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx 
b/sd/source/ui/slideshow/slideshowimpl.cxx
index af948c513548..de9e191f8203 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -1243,7 +1243,7 @@ void SlideshowImpl::registerShapeEvents(sal_Int32 
nSlideNumber)
             Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, 
UNO_QUERY );
             if( xMasterPageTarget.is() )
             {
-                Reference< XShapes > xMasterPage( 
xMasterPageTarget->getMasterPage(), UNO_QUERY );
+                Reference< XShapes > xMasterPage = 
xMasterPageTarget->getMasterPage();
                 if( xMasterPage.is() )
                     registerShapeEvents( xMasterPage );
             }
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx 
b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index 604b4e609b01..49a03529795b 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -221,10 +221,9 @@ void Listener::ConnectToController()
     }
 
     // Listen for disposing events.
-    Reference<XComponent> xComponent (xController, UNO_QUERY);
-    if (xComponent.is())
+    if (xController.is())
     {
-        xComponent->addEventListener (
+        xController->addEventListener (
             Reference<lang::XEventListener>(static_cast<XWeak*>(this), 
UNO_QUERY));
 
         mxControllerWeak = xController;
@@ -249,9 +248,8 @@ void Listener::DisconnectFromController()
         }
 
         // Remove the dispose listener.
-        Reference<XComponent> xComponent (xController, UNO_QUERY);
-        if (xComponent.is())
-            xComponent->removeEventListener (
+        if (xController.is())
+            xController->removeEventListener (
                 Reference<lang::XEventListener>(
                     static_cast<XWeak*>(this), UNO_QUERY));
     }
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx 
b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index ec35f545448b..94e70833c4c6 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -444,7 +444,7 @@ void SlideSorterModel::UpdatePageList()
                     xController->getModel(), UNO_QUERY);
                 if (xSupplier.is())
                 {
-                    xPages.set( xSupplier->getMasterPages(), UNO_QUERY);
+                    xPages = xSupplier->getMasterPages();
                 }
             }
             break;
@@ -455,7 +455,7 @@ void SlideSorterModel::UpdatePageList()
                     xController->getModel(), UNO_QUERY);
                 if (xSupplier.is())
                 {
-                    xPages.set( xSupplier->getDrawPages(), UNO_QUERY);
+                    xPages = xSupplier->getDrawPages();
                 }
             }
             break;
diff --git a/sd/source/ui/tools/EventMultiplexer.cxx 
b/sd/source/ui/tools/EventMultiplexer.cxx
index 23f8e8ac1767..1dcb9b1c28d0 100644
--- a/sd/source/ui/tools/EventMultiplexer.cxx
+++ b/sd/source/ui/tools/EventMultiplexer.cxx
@@ -200,9 +200,8 @@ EventMultiplexer::Implementation::Implementation 
(ViewShellBase& rBase)
 {
     // Connect to the frame to listen for controllers being exchanged.
     // Listen to changes of certain properties.
-    Reference<frame::XFrame> xFrame (
-        mrBase.GetFrame()->GetFrame().GetFrameInterface(),
-        uno::UNO_QUERY);
+    Reference<frame::XFrame> xFrame =
+        mrBase.GetFrame()->GetFrame().GetFrameInterface();
     mxFrameWeak = xFrame;
     if (xFrame.is())
     {
@@ -326,10 +325,9 @@ void 
EventMultiplexer::Implementation::ConnectToController()
     try
     {
         // Listen for disposing events.
-        Reference<lang::XComponent> xComponent (xController, UNO_QUERY);
-        if (xComponent.is())
+        if (xController.is())
         {
-            xComponent->addEventListener (
+            xController->addEventListener (
                 Reference<lang::XEventListener>(
                     static_cast<XWeak*>(this), UNO_QUERY));
             mbListeningToController = true;
@@ -411,10 +409,9 @@ void 
EventMultiplexer::Implementation::DisconnectFromController()
     }
 
     // Remove listener for disposing events.
-    Reference<lang::XComponent> xComponent (xController, UNO_QUERY);
-    if (xComponent.is())
+    if (xController.is())
     {
-        xComponent->removeEventListener (
+        xController->removeEventListener (
             Reference<lang::XEventListener>(static_cast<XWeak*>(this), 
UNO_QUERY));
     }
 }
diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx 
b/sd/source/ui/unoidl/SdUnoDrawView.cxx
index c714b0f8dce5..2a4f9bff7f11 100644
--- a/sd/source/ui/unoidl/SdUnoDrawView.cxx
+++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -251,8 +251,8 @@ Any SAL_CALL SdUnoDrawView::getSelection()
         const size_t nCount = rMarkList.GetMarkCount();
         if( nCount )
         {
-            Reference< drawing::XShapes > xShapes( 
drawing::ShapeCollection::create(
-                        comphelper::getProcessComponentContext()), UNO_QUERY );
+            Reference< drawing::XShapes > xShapes = 
drawing::ShapeCollection::create(
+                        comphelper::getProcessComponentContext());
             for( size_t nNum = 0; nNum < nCount; ++nNum)
             {
                 SdrMark *pMark = rMarkList.GetMark(nNum);
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx 
b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 0355be1ce110..3add9902b8c7 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -381,8 +381,7 @@ uno::Sequence<beans::PropertyValue>
         uno::Reference< embed::XTransactedObject > xTrans( xSubStorage, 
UNO_QUERY );
         if( xTrans.is() )
             xTrans->commit();
-        uno::Reference< lang::XComponent > xComp( xSubStorage, UNO_QUERY );
-        if( xComp.is() )
+        if( xSubStorage.is() )
             xSubStorage->dispose();
     } catch (const uno::Exception &) {
 //        fprintf (stderr, "saving etc. exception '%s'\n",
diff --git a/sd/source/ui/unoidl/randomnode.cxx 
b/sd/source/ui/unoidl/randomnode.cxx
index 61f514af10f7..8281bd812833 100644
--- a/sd/source/ui/unoidl/randomnode.cxx
+++ b/sd/source/ui/unoidl/randomnode.cxx
@@ -476,7 +476,7 @@ Reference< XEnumeration > SAL_CALL 
RandomAnimationNode::createEnumeration()
 
     if( aEnumAccess.is() )
     {
-        Reference< XEnumeration > xEnumeration( 
aEnumAccess->createEnumeration(), UNO_QUERY );
+        Reference< XEnumeration > xEnumeration = 
aEnumAccess->createEnumeration();
         if( xEnumeration.is() )
         {
             while( xEnumeration->hasMoreElements() )
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 1d1c98752398..f414d6ec9246 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -616,7 +616,7 @@ uno::Reference < container::XIndexAccess > SAL_CALL 
SdXImpressDocument::getViewD
 
         if( !rList.empty() )
         {
-            xRet.set(document::IndexedPropertyValues::create( 
::comphelper::getProcessComponentContext() ), uno::UNO_QUERY);
+            xRet = document::IndexedPropertyValues::create( 
::comphelper::getProcessComponentContext() );
 
             uno::Reference < container::XIndexContainer > xCont( xRet, 
uno::UNO_QUERY );
             DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed 
for OLE object" );
@@ -1998,11 +1998,10 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 
nRenderer, const uno::Any& r
                                 uno::Reference< drawing::XDrawPage > 
xMasterPage = xMasterPageTarget->getMasterPage();
                                 if ( xMasterPage.is() )
                                 {
-                                    uno::Reference< drawing::XShapes> xShapes( 
xMasterPage, uno::UNO_QUERY );
-                                    sal_Int32 i, nCount = xShapes->getCount();
+                                    sal_Int32 i, nCount = 
xMasterPage->getCount();
                                     for ( i = 0; i < nCount; i++ )
                                     {
-                                        aAny = xShapes->getByIndex( i );
+                                        aAny = xMasterPage->getByIndex( i );
                                         uno::Reference< drawing::XShape > 
xShape;
                                         if ( aAny >>= xShape )
                                             ImplPDFExportShapeInteraction( 
xShape, *mpDoc, *pPDFExtOutDevData );
@@ -2012,11 +2011,10 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 
nRenderer, const uno::Any& r
                         }
 
                         // exporting slide page object interactions
-                        uno::Reference< drawing::XShapes> xShapes( xPage, 
uno::UNO_QUERY );
-                        sal_Int32 i, nCount = xShapes->getCount();
+                        sal_Int32 i, nCount = xPage->getCount();
                         for ( i = 0; i < nCount; i++ )
                         {
-                            aAny = xShapes->getByIndex( i );
+                            aAny = xPage->getByIndex( i );
                             uno::Reference< drawing::XShape > xShape;
                             if ( aAny >>= xShape )
                                 ImplPDFExportShapeInteraction( xShape, *mpDoc, 
*pPDFExtOutDevData );
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
index be11e8d28a7c..657786649c3d 100644
--- a/sd/source/ui/unoidl/unosrch.cxx
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -131,7 +131,7 @@ sal_Int32 SAL_CALL SdUnoSearchReplaceShape::replaceAll( 
const uno::Reference< ut
     {
         // replace in xShape
         uno::Reference< text::XText >  xText(xShape, uno::UNO_QUERY);
-        uno::Reference< text::XTextRange >  xRange(xText, uno::UNO_QUERY);
+        uno::Reference< text::XTextRange >  xRange = xText;
         uno::Reference< text::XTextRange >  xFound;
 
         while( xRange.is() )
@@ -217,7 +217,7 @@ uno::Reference< css::container::XIndexAccess > SAL_CALL 
SdUnoSearchReplaceShape:
     {
         // find in xShape
         uno::Reference< text::XText >  xText(xShape, uno::UNO_QUERY);
-        uno::Reference< text::XTextRange >  xRange(xText, uno::UNO_QUERY);
+        uno::Reference< text::XTextRange >  xRange = xText;
         uno::Reference< text::XTextRange >  xFound;
 
         while( xRange.is() )
@@ -542,9 +542,8 @@ uno::Reference< text::XTextRange >  
SdUnoSearchReplaceShape::Search( const uno::
     uno::Reference< text::XTextRange >  xFound;
     ESelection aSel;
 
-    uno::Reference< text::XTextRange > xRangeRef( xText, uno::UNO_QUERY );
-    if( xRangeRef.is() )
-        aSel = GetSelection( xRangeRef );
+    if( xText.is() )
+        aSel = GetSelection( xText );
 
     sal_Int32 nStartPos;
     sal_Int32 nEndPos   = 0;
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index a0e80edc01dc..b05d86d1dbd2 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -125,7 +125,7 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, 
vcl::Window* pWindow, OutlineVie
     Link<tools::EventMultiplexerEvent&,void> aLink( 
LINK(this,OutlineView,EventMultiplexerListener) );
     
mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->AddEventListener(aLink);
 
-    Reference<XFrame> xFrame 
(mrOutlineViewShell.GetViewShellBase().GetFrame()->GetFrame().GetFrameInterface(),
 UNO_QUERY);
+    Reference<XFrame> xFrame = 
mrOutlineViewShell.GetViewShellBase().GetFrame()->GetFrame().GetFrameInterface();
     maSlideImage = 
vcl::CommandInfoProvider::GetImageForCommand(".uno:ShowSlide", xFrame, 
vcl::ImageType::Size26);
 
     // Tell undo manager of the document about the undo manager of the
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index a5ef90d7f7c6..bf452204c092 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -685,7 +685,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
             SdDrawDocument* pModel = xShell->GetDoc();
             pModel->InsertPage(pModel->AllocPage(false));
 
-            Reference< XComponent > xComponent( xShell->GetModel(), UNO_QUERY 
);
+            Reference< XComponent > xComponent = xShell->GetModel();
             xStm->Seek( 0 );
 
             css::uno::Reference< css::io::XInputStream > xInputStream( new 
utl::OInputStreamWrapper( *xStm ) );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to