diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-23 21:06:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-02-25 08:37:17 +0100 |
commit | b7a1e92a27bc26f222526eb50ab80c0e6966be7a (patch) | |
tree | 4f3825cc2f483e4576d1e3849a759b73fdc969f9 /sd/source | |
parent | e6b9bc3f2ecf0fb7fde5b02f9d750ccbe022f4c1 (diff) |
loplugin:referencecasting
getting --enable-pch=normal working with clang
means that the plugins now have a better view on some
stuff, so trigger more warnings
Change-Id: I83ca010c0ef07c8106068362bb50a354e3cf7dae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89312
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
4 files changed, 26 insertions, 46 deletions
diff --git a/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx index 89fef0c4b934..909f13a156b0 100644 --- a/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx +++ b/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx @@ -20,6 +20,7 @@ #include <AccessiblePresentationGraphicShape.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/drawing/XShapeDescriptor.hpp> +#include <com/sun/star/drawing/XShape.hpp> #include <SdShapeTypes.hxx> @@ -65,9 +66,8 @@ OUString break; default: sName = "UnknownAccessibleImpressShape"; - uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); - if (xDescriptor.is()) - sName += ": " + xDescriptor->getShapeType(); + if (mxShape.is()) + sName += ": " + mxShape->getShapeType(); } return sName; diff --git a/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx index b396a7795f81..0cdba64548c4 100644 --- a/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx +++ b/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx @@ -20,6 +20,7 @@ #include <AccessiblePresentationOLEShape.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/drawing/XShapeDescriptor.hpp> +#include <com/sun/star/drawing/XShape.hpp> #include <SdShapeTypes.hxx> @@ -71,9 +72,8 @@ OUString break; default: sName = "UnknownAccessibleImpressOLEShape"; - uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); - if (xDescriptor.is()) - sName += ": " + xDescriptor->getShapeType(); + if (mxShape.is()) + sName += ": " + mxShape->getShapeType(); } return sName; diff --git a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx index 5fef2489825a..d6e157a374fc 100644 --- a/sd/source/ui/accessibility/AccessiblePresentationShape.cxx +++ b/sd/source/ui/accessibility/AccessiblePresentationShape.cxx @@ -26,6 +26,7 @@ #include <svx/ShapeTypeHandler.hxx> #include <com/sun/star/drawing/XShapeDescriptor.hpp> +#include <com/sun/star/drawing/XShape.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; @@ -93,9 +94,8 @@ OUString AccessiblePresentationShape::CreateAccessibleBaseName() break; default: sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N); - uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); - if (xDescriptor.is()) - sName += ": " + xDescriptor->getShapeType(); + if (mxShape.is()) + sName += ": " + mxShape->getShapeType(); } return sName; @@ -140,9 +140,8 @@ OUString AccessiblePresentationShape::GetStyle() break; default: sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE); - uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); - if (xDescriptor.is()) - sName += ": " + xDescriptor->getShapeType(); + if (mxShape.is()) + sName += ": " + mxShape->getShapeType(); } return sName; diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index 0312bb56d413..b3e3064c6a28 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -21,6 +21,7 @@ #include <sal/config.h> #include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <vcl/svapp.hxx> @@ -117,11 +118,9 @@ sal_Int32 SAL_CALL SdUnoSearchReplaceShape::replaceAll( const uno::Reference< ut std::vector<SearchContext_impl> aContexts; if(mpPage) { - uno::Reference< drawing::XDrawPage > xPage( mpPage ); + xShapes = mpPage; - xShapes.set( xPage, uno::UNO_QUERY ); - - if( xShapes.is() && (xShapes->getCount() > 0) ) + if( xShapes->getCount() ) { aContexts.push_back(SearchContext_impl(xShapes)); xShape = aContexts.back().firstShape(); @@ -204,10 +203,9 @@ uno::Reference< css::container::XIndexAccess > SAL_CALL SdUnoSearchReplaceShape: std::vector<SearchContext_impl> aContexts; if(mpPage) { - uno::Reference< drawing::XDrawPage > xPage( mpPage ); - xShapes.set( xPage, uno::UNO_QUERY ); + xShapes = mpPage; - if( xShapes.is() && xShapes->getCount() > 0 ) + if( xShapes->getCount() > 0 ) { aContexts.push_back(SearchContext_impl(xShapes)); xShape = aContexts.back().firstShape(); @@ -291,18 +289,8 @@ uno::Reference< drawing::XShape > SdUnoSearchReplaceShape::GetCurrentShape() co { uno::Reference< drawing::XShape > xShape; - if( mpPage ) - { - uno::Reference< drawing::XDrawPage > xPage( mpPage ); - uno::Reference< container::XIndexAccess > xShapes( xPage, uno::UNO_QUERY ); - if( xShapes.is() ) - { - if(xShapes->getCount() > 0) - { - xShapes->getByIndex(0) >>= xShape; - } - } - } + if( mpPage && mpPage->getCount() > 0) + mpPage->getByIndex(0) >>= xShape; return xShape; @@ -332,24 +320,17 @@ uno::Reference< css::uno::XInterface > SAL_CALL SdUnoSearchReplaceShape::findNex if(mpPage) { - uno::Reference< drawing::XDrawPage > xPage( mpPage ); - // we do a page wide search, so skip to the next shape here - uno::Reference< container::XIndexAccess > xShapes( xPage, uno::UNO_QUERY ); - // get next shape on our page - if( xShapes.is() ) - { - uno::Reference< drawing::XShape > xFound2( GetNextShape( xShapes, xCurrentShape ) ); - if( xFound2.is() && (xFound2.get() != xCurrentShape.get()) ) - xCurrentShape = xFound2; - else - xCurrentShape = nullptr; + uno::Reference< drawing::XShape > xFound2( GetNextShape( mpPage, xCurrentShape ) ); + if( xFound2.is() && (xFound2.get() != xCurrentShape.get()) ) + xCurrentShape = xFound2; + else + xCurrentShape = nullptr; - xRange.set( xCurrentShape, uno::UNO_QUERY ); - if(!(xCurrentShape.is() && (xRange.is()))) - xRange = nullptr; - } + xRange.set( xCurrentShape, uno::UNO_QUERY ); + if(!(xCurrentShape.is() && (xRange.is()))) + xRange = nullptr; } else { |