silence coverity#1371305 Missing move assignment operator

Change-Id: I761e07d1583262d83074addbff4ca67b01640387
This commit is contained in:
Caolán McNamara 2017-01-11 08:57:51 +00:00
parent d2f5da9418
commit a70a62c013
6 changed files with 61 additions and 63 deletions

View File

@ -1266,8 +1266,8 @@ bool EscherPropertyContainer::CreateOLEGraphicProperties(
const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic(); const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic();
if ( pGraphic ) if ( pGraphic )
{ {
GraphicObject aGraphicObject( *pGraphic ); std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(*pGraphic));
bRetValue = CreateGraphicProperties( rXShape,aGraphicObject ); bRetValue = CreateGraphicProperties(rXShape, *xGraphicObject);
} }
} }
} }
@ -1314,8 +1314,8 @@ bool EscherPropertyContainer::CreateMediaGraphicProperties(
SdrObject* pSdrMedia( GetSdrObjectFromXShape( rXShape ) ); // SJ: leaving unoapi, because currently there is 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 if ( dynamic_cast<const SdrMediaObj* >(pSdrMedia) != nullptr ) // no access to the native graphic object
{ {
GraphicObject aGraphicObject( static_cast<SdrMediaObj*>(pSdrMedia)->getSnapshot() ); std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(static_cast<SdrMediaObj*>(pSdrMedia)->getSnapshot()));
bRetValue = CreateGraphicProperties( rXShape, aGraphicObject ); bRetValue = CreateGraphicProperties(rXShape, *xGraphicObject);
} }
} }
return bRetValue; return bRetValue;
@ -1367,7 +1367,7 @@ void EscherPropertyContainer::CreateEmbeddedBitmapProperties(
namespace { 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 // #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). // 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.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
aMtf.SetPrefSize(rRect.GetSize()); aMtf.SetPrefSize(rRect.GetSize());
return GraphicObject(Graphic(aMtf)); return new GraphicObject(Graphic(aMtf));
} }
} // namespace } // namespace
void EscherPropertyContainer::CreateEmbeddedHatchProperties( const css::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground ) 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))); const Rectangle aRect(pShapeBoundRect ? *pShapeBoundRect : Rectangle(Point(0,0), Size(28000, 21000)));
GraphicObject aGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground, aRect ); std::unique_ptr<GraphicObject> xGraphicObject(lclDrawHatch(rHatch, rBackColor, bFillBackground, aRect));
OString aUniqueId = aGraphicObject.GetUniqueID(); OString aUniqueId = xGraphicObject->GetUniqueID();
bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId ); bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId );
if ( bRetValue ) if ( bRetValue )
AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture ); AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture );
} }
bool EscherPropertyContainer::CreateGraphicProperties( bool EscherPropertyContainer::CreateGraphicProperties(
const css::uno::Reference< css::beans::XPropertySet > & rXPropSet, const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
const OUString& rSource, const bool bCreateFillBitmap, const bool bCreateCroppingAttributes, const OUString& rSource, const bool bCreateFillBitmap, const bool bCreateCroppingAttributes,
@ -1416,7 +1414,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(
bool bCreateFillStyles = false; bool bCreateFillStyles = false;
std::unique_ptr<GraphicAttr> pGraphicAttr; std::unique_ptr<GraphicAttr> pGraphicAttr;
GraphicObject aGraphicObject; std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject);
OUString aGraphicUrl; OUString aGraphicUrl;
OString aUniqueId; OString aUniqueId;
@ -1451,9 +1449,9 @@ bool EscherPropertyContainer::CreateGraphicProperties(
sal_uInt32 nErrCode = GraphicConverter::Import( aTemp, aGraphic, ConvertDataFormat::WMF ); sal_uInt32 nErrCode = GraphicConverter::Import( aTemp, aGraphic, ConvertDataFormat::WMF );
if ( nErrCode == ERRCODE_NONE ) if ( nErrCode == ERRCODE_NONE )
{ {
aGraphicObject = aGraphic; xGraphicObject.reset(new GraphicObject(aGraphic));
aUniqueId = aGraphicObject.GetUniqueID(); aUniqueId = xGraphicObject->GetUniqueID();
bIsGraphicMtf = aGraphicObject.GetType() == GraphicType::GdiMetafile; bIsGraphicMtf = xGraphicObject->GetType() == GraphicType::GdiMetafile;
} }
} }
} }
@ -1468,9 +1466,9 @@ bool EscherPropertyContainer::CreateGraphicProperties(
{ {
BitmapEx aBitmapEx( VCLUnoHelper::GetBitmap( xBmp ) ); BitmapEx aBitmapEx( VCLUnoHelper::GetBitmap( xBmp ) );
Graphic aGraphic( aBitmapEx ); Graphic aGraphic( aBitmapEx );
aGraphicObject = aGraphic; xGraphicObject.reset(new GraphicObject(aGraphic));
aUniqueId = aGraphicObject.GetUniqueID(); aUniqueId = xGraphicObject->GetUniqueID();
bIsGraphicMtf = aGraphicObject.GetType() == GraphicType::GdiMetafile; bIsGraphicMtf = xGraphicObject->GetType() == GraphicType::GdiMetafile;
} }
} }
} }
@ -1500,10 +1498,10 @@ bool EscherPropertyContainer::CreateGraphicProperties(
} }
const Rectangle aRect(Point(0, 0), pShapeBoundRect ? pShapeBoundRect->GetSize() : Size(28000, 21000)); const Rectangle aRect(Point(0, 0), pShapeBoundRect ? pShapeBoundRect->GetSize() : Size(28000, 21000));
aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground, aRect ); xGraphicObject.reset(lclDrawHatch(aHatch, aBackColor, bFillBackground, aRect));
aUniqueId = aGraphicObject.GetUniqueID(); aUniqueId = xGraphicObject->GetUniqueID();
eBitmapMode = css::drawing::BitmapMode_REPEAT; 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 ) if ( nErrCode == ERRCODE_NONE )
{ {
// no // no
aGraphicObject = aGraphic; xGraphicObject.reset(new GraphicObject(aGraphic));
aUniqueId = aGraphicObject.GetUniqueID(); aUniqueId = xGraphicObject->GetUniqueID();
} }
// else: simply keep the graphic link // else: simply keep the graphic link
} }
@ -3809,8 +3807,8 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const css::uno
SdrModel* pMod = pShape->GetModel(); SdrModel* pMod = pShape->GetModel();
Graphic aGraphic(SdrExchangeView::GetObjGraphic( pMod, pShape)); Graphic aGraphic(SdrExchangeView::GetObjGraphic( pMod, pShape));
GraphicObject aGraphicObject = aGraphic; std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(aGraphic));
OString aUniqueId = aGraphicObject.GetUniqueID(); OString aUniqueId = xGraphicObject->GetUniqueID();
if ( aUniqueId.getLength() ) if ( aUniqueId.getLength() )
{ {
if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect ) if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
@ -4198,9 +4196,9 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
const GraphicAttr* pGraphicAttr, const bool bOOxmlExport ) const GraphicAttr* pGraphicAttr, const bool bOOxmlExport )
{ {
sal_uInt32 nBlibId = 0; 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() ) if ( !p_EscherBlibEntry->IsEmpty() )
{ {
for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ ) for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ )
@ -4215,7 +4213,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
bool bUseNativeGraphic( false ); bool bUseNativeGraphic( false );
Graphic aGraphic( aGraphicObject.GetTransformedGraphic( pGraphicAttr ) ); Graphic aGraphic(xGraphicObject->GetTransformedGraphic(pGraphicAttr));
GfxLink aGraphicLink; GfxLink aGraphicLink;
SvMemoryStream aStream; SvMemoryStream aStream;

View File

@ -30,7 +30,7 @@ class SVX_DLLPUBLIC XOBitmap
{ {
private: private:
XBitmapType eType; XBitmapType eType;
GraphicObject aGraphicObject; std::unique_ptr<GraphicObject> xGraphicObject;
sal_uInt16* pPixelArray; sal_uInt16* pPixelArray;
Size aArraySize; Size aArraySize;
Color aPixelColor; Color aPixelColor;

View File

@ -113,8 +113,8 @@ sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicS
if ( !rUniqueId.isEmpty() ) if ( !rUniqueId.isEmpty() )
{ {
Rectangle aRect; Rectangle aRect;
GraphicObject aGraphicObject( rUniqueId ); std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(rUniqueId));
Graphic aMappedGraphic, aGraphic( aGraphicObject.GetGraphic() ); Graphic aMappedGraphic, aGraphic(xGraphicObject->GetGraphic());
Size aPrefSize( aGraphic.GetPrefSize() ); Size aPrefSize( aGraphic.GetPrefSize() );
BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
@ -139,10 +139,10 @@ sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicS
rGraphicSize = aNewSize; rGraphicSize = aNewSize;
aMappedGraphic = Graphic( aBmpEx ); 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 ) ) if ( nId && ( nId < 0x10000 ) )
nRetValue = (sal_uInt16)nId - 1; nRetValue = (sal_uInt16)nId - 1;

View File

@ -60,16 +60,16 @@ namespace internal {
namespace { namespace {
bool importShapeGraphic( std::unique_ptr<GraphicObject> importShapeGraphic(uno::Reference<beans::XPropertySet> const& xPropSet)
GraphicObject & o_rGraphic,
uno::Reference<beans::XPropertySet> const& xPropSet )
{ {
std::unique_ptr<GraphicObject> xRet;
OUString aURL; OUString aURL;
if( !getPropertyValue( aURL, xPropSet, "GraphicURL") || if( !getPropertyValue( aURL, xPropSet, "GraphicURL") ||
aURL.isEmpty() ) aURL.isEmpty() )
{ {
// no or empty property - cannot import shape graphic // no or empty property - cannot import shape graphic
return false; return xRet;
} }
OUString const aVndUrl( OUString const aVndUrl(
@ -85,7 +85,7 @@ bool importShapeGraphic(
{ {
OSL_FAIL( "ShapeImporter::importShape(): " OSL_FAIL( "ShapeImporter::importShape(): "
"embedded graphic has no graphic ID" ); "embedded graphic has no graphic ID" );
return false; return nullptr;
} }
// unique ID string found in URL, extract // unique ID string found in URL, extract
@ -100,14 +100,14 @@ bool importShapeGraphic(
// fetch already loaded graphic from graphic manager. // fetch already loaded graphic from graphic manager.
OString const aOldString(OUStringToOString(aUniqueId, OString const aOldString(OUStringToOString(aUniqueId,
RTL_TEXTENCODING_UTF8)); RTL_TEXTENCODING_UTF8));
o_rGraphic = GraphicObject( aOldString ); xRet.reset(new GraphicObject(aOldString));
if( GraphicType::Default == o_rGraphic.GetType() if (GraphicType::Default == xRet->GetType()
|| GraphicType::NONE == o_rGraphic.GetType() ) || GraphicType::NONE == xRet->GetType())
{ {
// even the GrfMgr does not seem to know this graphic // even the GrfMgr does not seem to know this graphic
return false; return nullptr;
} }
} }
else else
@ -123,7 +123,7 @@ bool importShapeGraphic(
{ {
OSL_FAIL( "ShapeImporter::importShape(): " OSL_FAIL( "ShapeImporter::importShape(): "
"cannot create input stream for graphic" ); "cannot create input stream for graphic" );
return false; return nullptr;
} }
Graphic aTmpGraphic; Graphic aTmpGraphic;
@ -132,12 +132,12 @@ bool importShapeGraphic(
{ {
OSL_FAIL( "ShapeImporter::importShape(): " OSL_FAIL( "ShapeImporter::importShape(): "
"Failed to import shape graphic from given URL" ); "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. /** 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" ) else if( shapeType == "com.sun.star.drawing.GraphicObjectShape" || shapeType == "com.sun.star.presentation.GraphicObjectShape" )
{ {
GraphicObject aGraphicObject;
// to get hold of GIF animations, inspect Graphic // to get hold of GIF animations, inspect Graphic
// objects more thoroughly (the plain-jane shape // objects more thoroughly (the plain-jane shape
// metafile of course would only contain the first // metafile of course would only contain the first
// animation frame) // animation frame)
if( !importShapeGraphic( aGraphicObject, xPropSet ) ) std::unique_ptr<GraphicObject> xGraphicObject(importShapeGraphic(xPropSet));
if (!xGraphicObject)
return ShapeSharedPtr(); // error loading graphic - return ShapeSharedPtr(); // error loading graphic -
// no placeholders in // no placeholders in
// slideshow // slideshow
if( !aGraphicObject.IsAnimated() ) if (!xGraphicObject->IsAnimated())
{ {
// no animation - simply utilize plain draw shape import // no animation - simply utilize plain draw shape import
@ -381,9 +380,9 @@ ShapeSharedPtr ShapeImporter::createShape(
Graphic aGraphic( Graphic aGraphic(
aGraphicObject.GetTransformedGraphic( xGraphicObject->GetTransformedGraphic(
aGraphicObject.GetPrefSize(), xGraphicObject->GetPrefSize(),
aGraphicObject.GetPrefMapMode(), xGraphicObject->GetPrefMapMode(),
aGraphAttrs ) ); aGraphAttrs ) );
return DrawShape::create( xCurrShape, return DrawShape::create( xCurrShape,

View File

@ -208,7 +208,7 @@ private:
::utl::TempFile* mpTmp; ::utl::TempFile* mpTmp;
SvStream* mpOStm; SvStream* mpOStm;
Reference< XOutputStream > mxStmWrapper; Reference< XOutputStream > mxStmWrapper;
GraphicObject maGrfObj; std::unique_ptr<GraphicObject> mxGrfObj;
bool mbClosed; bool mbClosed;
public: public:
@ -222,9 +222,10 @@ public:
const GraphicObject& GetGraphicObject(); const GraphicObject& GetGraphicObject();
}; };
SvXMLGraphicOutputStream::SvXMLGraphicOutputStream() : SvXMLGraphicOutputStream::SvXMLGraphicOutputStream()
mpTmp( new ::utl::TempFile ), : mpTmp(new ::utl::TempFile)
mbClosed( false ) , mxGrfObj(new GraphicObject)
, mbClosed(false)
{ {
mpTmp->EnableKillingFile(); mpTmp->EnableKillingFile();
@ -272,7 +273,7 @@ void SAL_CALL SvXMLGraphicOutputStream::closeOutput()
const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject() const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
{ {
if( mbClosed && ( maGrfObj.GetType() == GraphicType::NONE ) && mpOStm ) if (mbClosed && mxGrfObj->GetType() == GraphicType::NONE && mpOStm)
{ {
Graphic aGraphic; Graphic aGraphic;
@ -329,8 +330,8 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
} }
} }
maGrfObj = aGraphic; mxGrfObj.reset(new GraphicObject(aGraphic));
if( maGrfObj.GetType() != GraphicType::NONE ) if (mxGrfObj->GetType() != GraphicType::NONE)
{ {
delete mpOStm; delete mpOStm;
mpOStm = nullptr; mpOStm = nullptr;
@ -339,7 +340,7 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
} }
} }
return maGrfObj; return *mxGrfObj;
} }
} }

View File

@ -46,7 +46,7 @@ using namespace ::com::sun::star;
XOBitmap::XOBitmap( const Bitmap& rBmp ) : XOBitmap::XOBitmap( const Bitmap& rBmp ) :
eType ( XBitmapType::Import ), eType ( XBitmapType::Import ),
aGraphicObject ( rBmp ), xGraphicObject (new GraphicObject(rBmp)),
pPixelArray ( nullptr ), pPixelArray ( nullptr ),
bGraphicDirty ( false ) bGraphicDirty ( false )
{ {
@ -67,7 +67,7 @@ const GraphicObject& XOBitmap::GetGraphicObject() const
if( bGraphicDirty ) if( bGraphicDirty )
const_cast<XOBitmap*>(this)->Array2Bitmap(); const_cast<XOBitmap*>(this)->Array2Bitmap();
return aGraphicObject; return *xGraphicObject;
} }
void XOBitmap::Bitmap2Array() 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; bGraphicDirty = false;
} }