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 | |
parent | d2f5da94188a7db8a5815130caadaccd806a1826 (diff) |
silence coverity#1371305 Missing move assignment operator
Change-Id: I761e07d1583262d83074addbff4ca67b01640387
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 52 | ||||
-rw-r--r-- | include/svx/xbitmap.hxx | 2 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 8 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/shapeimporter.cxx | 39 | ||||
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 17 | ||||
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 6 |
6 files changed, 61 insertions, 63 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 80e09f92b8a1..575cb6e18ff8 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1266,8 +1266,8 @@ bool EscherPropertyContainer::CreateOLEGraphicProperties( const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic(); if ( pGraphic ) { - GraphicObject aGraphicObject( *pGraphic ); - bRetValue = CreateGraphicProperties( rXShape,aGraphicObject ); + std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(*pGraphic)); + bRetValue = CreateGraphicProperties(rXShape, *xGraphicObject); } } } @@ -1314,8 +1314,8 @@ bool EscherPropertyContainer::CreateMediaGraphicProperties( SdrObject* pSdrMedia( GetSdrObjectFromXShape( rXShape ) ); // SJ: leaving unoapi, because currently there is if ( dynamic_cast<const SdrMediaObj* >(pSdrMedia) != nullptr ) // no access to the native graphic object { - GraphicObject aGraphicObject( static_cast<SdrMediaObj*>(pSdrMedia)->getSnapshot() ); - bRetValue = CreateGraphicProperties( rXShape, aGraphicObject ); + std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(static_cast<SdrMediaObj*>(pSdrMedia)->getSnapshot())); + bRetValue = CreateGraphicProperties(rXShape, *xGraphicObject); } } return bRetValue; @@ -1367,7 +1367,7 @@ void EscherPropertyContainer::CreateEmbeddedBitmapProperties( namespace { -GraphicObject lclDrawHatch( const css::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground, const Rectangle& rRect ) +GraphicObject* lclDrawHatch( const css::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground, const Rectangle& rRect ) { // #i121183# For hatch, do no longer create a bitmap with the fixed size of 28x28 pixels. Also // do not create a bitmap in page size, that would explode file sizes (and have no good quality). @@ -1390,23 +1390,21 @@ GraphicObject lclDrawHatch( const css::drawing::Hatch& rHatch, const Color& rBac aMtf.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); aMtf.SetPrefSize(rRect.GetSize()); - return GraphicObject(Graphic(aMtf)); + return new GraphicObject(Graphic(aMtf)); } } // namespace - void EscherPropertyContainer::CreateEmbeddedHatchProperties( const css::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground ) { const Rectangle aRect(pShapeBoundRect ? *pShapeBoundRect : Rectangle(Point(0,0), Size(28000, 21000))); - GraphicObject aGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground, aRect ); - OString aUniqueId = aGraphicObject.GetUniqueID(); + std::unique_ptr<GraphicObject> xGraphicObject(lclDrawHatch(rHatch, rBackColor, bFillBackground, aRect)); + OString aUniqueId = xGraphicObject->GetUniqueID(); bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId ); if ( bRetValue ) AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture ); } - bool EscherPropertyContainer::CreateGraphicProperties( const css::uno::Reference< css::beans::XPropertySet > & rXPropSet, const OUString& rSource, const bool bCreateFillBitmap, const bool bCreateCroppingAttributes, @@ -1416,7 +1414,7 @@ bool EscherPropertyContainer::CreateGraphicProperties( bool bCreateFillStyles = false; std::unique_ptr<GraphicAttr> pGraphicAttr; - GraphicObject aGraphicObject; + std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject); OUString aGraphicUrl; OString aUniqueId; @@ -1451,9 +1449,9 @@ bool EscherPropertyContainer::CreateGraphicProperties( sal_uInt32 nErrCode = GraphicConverter::Import( aTemp, aGraphic, ConvertDataFormat::WMF ); if ( nErrCode == ERRCODE_NONE ) { - aGraphicObject = aGraphic; - aUniqueId = aGraphicObject.GetUniqueID(); - bIsGraphicMtf = aGraphicObject.GetType() == GraphicType::GdiMetafile; + xGraphicObject.reset(new GraphicObject(aGraphic)); + aUniqueId = xGraphicObject->GetUniqueID(); + bIsGraphicMtf = xGraphicObject->GetType() == GraphicType::GdiMetafile; } } } @@ -1468,9 +1466,9 @@ bool EscherPropertyContainer::CreateGraphicProperties( { BitmapEx aBitmapEx( VCLUnoHelper::GetBitmap( xBmp ) ); Graphic aGraphic( aBitmapEx ); - aGraphicObject = aGraphic; - aUniqueId = aGraphicObject.GetUniqueID(); - bIsGraphicMtf = aGraphicObject.GetType() == GraphicType::GdiMetafile; + xGraphicObject.reset(new GraphicObject(aGraphic)); + aUniqueId = xGraphicObject->GetUniqueID(); + bIsGraphicMtf = xGraphicObject->GetType() == GraphicType::GdiMetafile; } } } @@ -1500,10 +1498,10 @@ bool EscherPropertyContainer::CreateGraphicProperties( } const Rectangle aRect(Point(0, 0), pShapeBoundRect ? pShapeBoundRect->GetSize() : Size(28000, 21000)); - aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground, aRect ); - aUniqueId = aGraphicObject.GetUniqueID(); + xGraphicObject.reset(lclDrawHatch(aHatch, aBackColor, bFillBackground, aRect)); + aUniqueId = xGraphicObject->GetUniqueID(); eBitmapMode = css::drawing::BitmapMode_REPEAT; - bIsGraphicMtf = aGraphicObject.GetType() == GraphicType::GdiMetafile; + bIsGraphicMtf = xGraphicObject->GetType() == GraphicType::GdiMetafile; } } @@ -1593,8 +1591,8 @@ bool EscherPropertyContainer::CreateGraphicProperties( if ( nErrCode == ERRCODE_NONE ) { // no - aGraphicObject = aGraphic; - aUniqueId = aGraphicObject.GetUniqueID(); + xGraphicObject.reset(new GraphicObject(aGraphic)); + aUniqueId = xGraphicObject->GetUniqueID(); } // else: simply keep the graphic link } @@ -3809,8 +3807,8 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const css::uno SdrModel* pMod = pShape->GetModel(); Graphic aGraphic(SdrExchangeView::GetObjGraphic( pMod, pShape)); - GraphicObject aGraphicObject = aGraphic; - OString aUniqueId = aGraphicObject.GetUniqueID(); + std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(aGraphic)); + OString aUniqueId = xGraphicObject->GetUniqueID(); if ( aUniqueId.getLength() ) { if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect ) @@ -4198,9 +4196,9 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin const GraphicAttr* pGraphicAttr, const bool bOOxmlExport ) { sal_uInt32 nBlibId = 0; - GraphicObject aGraphicObject( rId ); + std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(rId)); - EscherBlibEntry* p_EscherBlibEntry = new EscherBlibEntry( rPicOutStrm.Tell(), aGraphicObject, rId, pGraphicAttr ); + EscherBlibEntry* p_EscherBlibEntry = new EscherBlibEntry( rPicOutStrm.Tell(), *xGraphicObject, rId, pGraphicAttr ); if ( !p_EscherBlibEntry->IsEmpty() ) { for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ ) @@ -4215,7 +4213,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin bool bUseNativeGraphic( false ); - Graphic aGraphic( aGraphicObject.GetTransformedGraphic( pGraphicAttr ) ); + Graphic aGraphic(xGraphicObject->GetTransformedGraphic(pGraphicAttr)); GfxLink aGraphicLink; SvMemoryStream aStream; diff --git a/include/svx/xbitmap.hxx b/include/svx/xbitmap.hxx index 0a2128e3d1a8..761e8e1b1861 100644 --- a/include/svx/xbitmap.hxx +++ b/include/svx/xbitmap.hxx @@ -30,7 +30,7 @@ class SVX_DLLPUBLIC XOBitmap { private: XBitmapType eType; - GraphicObject aGraphicObject; + std::unique_ptr<GraphicObject> xGraphicObject; sal_uInt16* pPixelArray; Size aArraySize; Color aPixelColor; diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 69f2fc02fbdc..aa1ffcb07b7e 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -113,8 +113,8 @@ sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicS if ( !rUniqueId.isEmpty() ) { Rectangle aRect; - GraphicObject aGraphicObject( rUniqueId ); - Graphic aMappedGraphic, aGraphic( aGraphicObject.GetGraphic() ); + std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(rUniqueId)); + Graphic aMappedGraphic, aGraphic(xGraphicObject->GetGraphic()); Size aPrefSize( aGraphic.GetPrefSize() ); BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); @@ -139,10 +139,10 @@ sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicS rGraphicSize = aNewSize; aMappedGraphic = Graphic( aBmpEx ); - aGraphicObject = GraphicObject( aMappedGraphic ); + xGraphicObject.reset(new GraphicObject(aMappedGraphic)); } } - sal_uInt32 nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aRect ); + sal_uInt32 nId = pGraphicProv->GetBlibID(aBuExPictureStream, xGraphicObject->GetUniqueID(), aRect); if ( nId && ( nId < 0x10000 ) ) nRetValue = (sal_uInt16)nId - 1; 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, diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 0212dc95b36b..4ef3bfe43dff 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -208,7 +208,7 @@ private: ::utl::TempFile* mpTmp; SvStream* mpOStm; Reference< XOutputStream > mxStmWrapper; - GraphicObject maGrfObj; + std::unique_ptr<GraphicObject> mxGrfObj; bool mbClosed; public: @@ -222,9 +222,10 @@ public: const GraphicObject& GetGraphicObject(); }; -SvXMLGraphicOutputStream::SvXMLGraphicOutputStream() : - mpTmp( new ::utl::TempFile ), - mbClosed( false ) +SvXMLGraphicOutputStream::SvXMLGraphicOutputStream() + : mpTmp(new ::utl::TempFile) + , mxGrfObj(new GraphicObject) + , mbClosed(false) { mpTmp->EnableKillingFile(); @@ -272,7 +273,7 @@ void SAL_CALL SvXMLGraphicOutputStream::closeOutput() const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() { - if( mbClosed && ( maGrfObj.GetType() == GraphicType::NONE ) && mpOStm ) + if (mbClosed && mxGrfObj->GetType() == GraphicType::NONE && mpOStm) { Graphic aGraphic; @@ -329,8 +330,8 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() } } - maGrfObj = aGraphic; - if( maGrfObj.GetType() != GraphicType::NONE ) + mxGrfObj.reset(new GraphicObject(aGraphic)); + if (mxGrfObj->GetType() != GraphicType::NONE) { delete mpOStm; mpOStm = nullptr; @@ -339,7 +340,7 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() } } - return maGrfObj; + return *mxGrfObj; } } diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 343c0f859ac4..f6fd2c967466 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -46,7 +46,7 @@ using namespace ::com::sun::star; XOBitmap::XOBitmap( const Bitmap& rBmp ) : eType ( XBitmapType::Import ), - aGraphicObject ( rBmp ), + xGraphicObject (new GraphicObject(rBmp)), pPixelArray ( nullptr ), bGraphicDirty ( false ) { @@ -67,7 +67,7 @@ const GraphicObject& XOBitmap::GetGraphicObject() const if( bGraphicDirty ) const_cast<XOBitmap*>(this)->Array2Bitmap(); - return aGraphicObject; + return *xGraphicObject; } void XOBitmap::Bitmap2Array() @@ -127,7 +127,7 @@ void XOBitmap::Array2Bitmap() } } - aGraphicObject = GraphicObject( pVDev->GetBitmap( Point(), Size( nLines, nLines ) ) ); + xGraphicObject.reset(new GraphicObject(pVDev->GetBitmap(Point(), Size(nLines, nLines)))); bGraphicDirty = false; } |