diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-01-11 08:57:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-01-12 11:18:50 +0000 |
commit | a70a62c013318b45eb23d6451d442bc6f702a282 (patch) | |
tree | d99d300392946cf0c2dc0a1df6f4c36baf85f438 /slideshow/source | |
parent | d2f5da94188a7db8a5815130caadaccd806a1826 (diff) |
silence coverity#1371305 Missing move assignment operator
Change-Id: I761e07d1583262d83074addbff4ca67b01640387
Diffstat (limited to 'slideshow/source')
-rw-r--r-- | slideshow/source/engine/shapes/shapeimporter.cxx | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index 4caa9bc7269d..1add73896181 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -60,16 +60,16 @@ namespace internal { namespace { -bool importShapeGraphic( - GraphicObject & o_rGraphic, - uno::Reference<beans::XPropertySet> const& xPropSet ) +std::unique_ptr<GraphicObject> importShapeGraphic(uno::Reference<beans::XPropertySet> const& xPropSet) { + std::unique_ptr<GraphicObject> xRet; + OUString aURL; if( !getPropertyValue( aURL, xPropSet, "GraphicURL") || aURL.isEmpty() ) { // no or empty property - cannot import shape graphic - return false; + return xRet; } OUString const aVndUrl( @@ -85,7 +85,7 @@ bool importShapeGraphic( { OSL_FAIL( "ShapeImporter::importShape(): " "embedded graphic has no graphic ID" ); - return false; + return nullptr; } // unique ID string found in URL, extract @@ -100,14 +100,14 @@ bool importShapeGraphic( // fetch already loaded graphic from graphic manager. OString const aOldString(OUStringToOString(aUniqueId, RTL_TEXTENCODING_UTF8)); - o_rGraphic = GraphicObject( aOldString ); + xRet.reset(new GraphicObject(aOldString)); - if( GraphicType::Default == o_rGraphic.GetType() - || GraphicType::NONE == o_rGraphic.GetType() ) + if (GraphicType::Default == xRet->GetType() + || GraphicType::NONE == xRet->GetType()) { // even the GrfMgr does not seem to know this graphic - return false; + return nullptr; } } else @@ -123,7 +123,7 @@ bool importShapeGraphic( { OSL_FAIL( "ShapeImporter::importShape(): " "cannot create input stream for graphic" ); - return false; + return nullptr; } Graphic aTmpGraphic; @@ -132,12 +132,12 @@ bool importShapeGraphic( { OSL_FAIL( "ShapeImporter::importShape(): " "Failed to import shape graphic from given URL" ); - return false; + return nullptr; } - o_rGraphic = GraphicObject( aTmpGraphic ); + xRet.reset(new GraphicObject(aTmpGraphic)); } - return true; + return xRet; } /** This shape implementation just acts as a dummy for the layermanager. @@ -307,18 +307,17 @@ ShapeSharedPtr ShapeImporter::createShape( } else if( shapeType == "com.sun.star.drawing.GraphicObjectShape" || shapeType == "com.sun.star.presentation.GraphicObjectShape" ) { - GraphicObject aGraphicObject; - // to get hold of GIF animations, inspect Graphic // objects more thoroughly (the plain-jane shape // metafile of course would only contain the first // animation frame) - if( !importShapeGraphic( aGraphicObject, xPropSet ) ) + std::unique_ptr<GraphicObject> xGraphicObject(importShapeGraphic(xPropSet)); + if (!xGraphicObject) return ShapeSharedPtr(); // error loading graphic - // no placeholders in // slideshow - if( !aGraphicObject.IsAnimated() ) + if (!xGraphicObject->IsAnimated()) { // no animation - simply utilize plain draw shape import @@ -381,9 +380,9 @@ ShapeSharedPtr ShapeImporter::createShape( Graphic aGraphic( - aGraphicObject.GetTransformedGraphic( - aGraphicObject.GetPrefSize(), - aGraphicObject.GetPrefMapMode(), + xGraphicObject->GetTransformedGraphic( + xGraphicObject->GetPrefSize(), + xGraphicObject->GetPrefMapMode(), aGraphAttrs ) ); return DrawShape::create( xCurrShape, |