Kaydet (Commit) 2d2329f4 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1371200 Missing move assignment operator

adjust things to not need one

Change-Id: I1079f50d8813f86c4828be602687b4cbffe61415
üst d596053e
...@@ -87,6 +87,18 @@ namespace ...@@ -87,6 +87,18 @@ namespace
return nSteps; return nSteps;
} }
// get metafile (copy it)
GDIMetaFile GetMetaFile(const drawinglayer::primitive2d::MetafilePrimitive2D& rMetaCandidate, const basegfx::BColorModifierStack& rColorModifierStack)
{
if (rColorModifierStack.count())
{
const basegfx::BColor aRGBBaseColor(0, 0, 0);
const basegfx::BColor aRGBColor(rColorModifierStack.getModifiedColor(aRGBBaseColor));
return rMetaCandidate.getMetaFile().GetMonochromeMtf(Color(aRGBColor));
}
return rMetaCandidate.getMetaFile();
}
} }
namespace drawinglayer namespace drawinglayer
...@@ -736,18 +748,7 @@ namespace drawinglayer ...@@ -736,18 +748,7 @@ namespace drawinglayer
(sal_Int32)floor(aOutlineRange.getMaxX()), (sal_Int32)floor(aOutlineRange.getMaxY())); (sal_Int32)floor(aOutlineRange.getMaxX()), (sal_Int32)floor(aOutlineRange.getMaxY()));
// get metafile (copy it) // get metafile (copy it)
GDIMetaFile aMetaFile; GDIMetaFile aMetaFile(GetMetaFile(rMetaCandidate, maBColorModifierStack));
if(maBColorModifierStack.count())
{
const basegfx::BColor aRGBBaseColor(0, 0, 0);
const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(aRGBBaseColor));
aMetaFile = rMetaCandidate.getMetaFile().GetMonochromeMtf(Color(aRGBColor));
}
else
{
aMetaFile = rMetaCandidate.getMetaFile();
}
// rotation // rotation
if(!basegfx::fTools::equalZero(fRotate)) if(!basegfx::fTools::equalZero(fRotate))
......
...@@ -124,6 +124,9 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow ...@@ -124,6 +124,9 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow
BitmapEx ImpMaskTransparent( const BitmapEx& rBitmapEx, BitmapEx ImpMaskTransparent( const BitmapEx& rBitmapEx,
const Color& rColor, const Color& rColor,
const long nTol ); const long nTol );
GDIMetaFile GetMetaFile(const Graphic& rGraphic);
static BitmapEx ImpReplaceTransparency( const BitmapEx& rBmpEx, static BitmapEx ImpReplaceTransparency( const BitmapEx& rBmpEx,
const Color& rColor ); const Color& rColor );
static Animation ImpReplaceTransparency( const Animation& rAnim, static Animation ImpReplaceTransparency( const Animation& rAnim,
......
...@@ -113,6 +113,7 @@ private: ...@@ -113,6 +113,7 @@ private:
void ImpSetLinkedGraphic( const Graphic& rGraphic ); void ImpSetLinkedGraphic( const Graphic& rGraphic );
DECL_LINK( ImpSwapHdl, const GraphicObject*, SvStream* ); DECL_LINK( ImpSwapHdl, const GraphicObject*, SvStream* );
void onGraphicChanged(); void onGraphicChanged();
GDIMetaFile GetMetaFile(GraphicType &rGraphicType) const;
public: public:
......
...@@ -123,16 +123,20 @@ namespace slideshow ...@@ -123,16 +123,20 @@ namespace slideshow
{ {
uno::Reference< beans::XPropertySet > xPropSet( xDrawPage, uno::Reference< beans::XPropertySet > xPropSet( xDrawPage,
uno::UNO_QUERY_THROW ); uno::UNO_QUERY_THROW );
GDIMetaFileSharedPtr pMtf( new GDIMetaFile() );
// first try the page background (overrides // first try the page background (overrides
// masterpage background), then try masterpage // masterpage background), then try masterpage
if( !getMetaFile( uno::Reference<lang::XComponent>(xDrawPage, uno::UNO_QUERY), GDIMetaFileSharedPtr xMtf = getMetaFile(uno::Reference<lang::XComponent>(xDrawPage, uno::UNO_QUERY),
xDrawPage, *pMtf, MTF_LOAD_BACKGROUND_ONLY, xDrawPage, MTF_LOAD_BACKGROUND_ONLY,
rContext.mxComponentContext ) && rContext.mxComponentContext);
!getMetaFile( uno::Reference<lang::XComponent>(xMasterPage, uno::UNO_QUERY),
xDrawPage, *pMtf, MTF_LOAD_BACKGROUND_ONLY, if (!xMtf)
rContext.mxComponentContext )) {
xMtf = getMetaFile( uno::Reference<lang::XComponent>(xMasterPage, uno::UNO_QUERY),
xDrawPage, MTF_LOAD_BACKGROUND_ONLY,
rContext.mxComponentContext );
}
if (!xMtf)
{ {
throw ShapeLoadFailedException(); throw ShapeLoadFailedException();
} }
...@@ -140,13 +144,12 @@ namespace slideshow ...@@ -140,13 +144,12 @@ namespace slideshow
// there is a special background shape, add it // there is a special background shape, add it
// as the first one // as the first one
sal_Int32 nDocWidth=0; sal_Int32 nDocWidth=0;
sal_Int32 nDocHeight=0; sal_Int32 nDocHeight=0;
xPropSet->getPropertyValue("Width") >>= nDocWidth; xPropSet->getPropertyValue("Width") >>= nDocWidth;
xPropSet->getPropertyValue("Height") >>= nDocHeight; xPropSet->getPropertyValue("Height") >>= nDocHeight;
mpMtf = pMtf; mpMtf = xMtf;
maBounds = ::basegfx::B2DRectangle( 0,0,nDocWidth, nDocHeight ); maBounds = ::basegfx::B2DRectangle( 0,0,nDocWidth, nDocHeight );
} }
......
...@@ -82,12 +82,13 @@ namespace slideshow ...@@ -82,12 +82,13 @@ namespace slideshow
if ((mnCurrMtfLoadFlags & MTF_LOAD_SCROLL_TEXT_MTF) != MTF_LOAD_SCROLL_TEXT_MTF) if ((mnCurrMtfLoadFlags & MTF_LOAD_SCROLL_TEXT_MTF) != MTF_LOAD_SCROLL_TEXT_MTF)
{ {
// reload with added flags: // reload with added flags:
mpCurrMtf.reset( new GDIMetaFile );
mnCurrMtfLoadFlags |= MTF_LOAD_SCROLL_TEXT_MTF; mnCurrMtfLoadFlags |= MTF_LOAD_SCROLL_TEXT_MTF;
getMetaFile( mpCurrMtf = getMetaFile(uno::Reference<lang::XComponent>(mxShape, uno::UNO_QUERY),
uno::Reference<lang::XComponent>(mxShape, uno::UNO_QUERY), mxPage, mnCurrMtfLoadFlags,
mxPage, *mpCurrMtf, mnCurrMtfLoadFlags, mxComponentContext);
mxComponentContext );
if (!mpCurrMtf)
mpCurrMtf.reset( new GDIMetaFile );
// TODO(F1): Currently, the scroll metafile will // TODO(F1): Currently, the scroll metafile will
// never contain any verbose text comments. Thus, // never contain any verbose text comments. Thus,
...@@ -402,13 +403,12 @@ namespace slideshow ...@@ -402,13 +403,12 @@ namespace slideshow
// must NOT be called from within initializer list, uses // must NOT be called from within initializer list, uses
// state from mnCurrMtfLoadFlags! // state from mnCurrMtfLoadFlags!
mpCurrMtf.reset( new GDIMetaFile ); mpCurrMtf = getMetaFile(uno::Reference<lang::XComponent>(xShape, uno::UNO_QUERY),
getMetaFile( xContainingPage, mnCurrMtfLoadFlags,
uno::Reference<lang::XComponent>(xShape, uno::UNO_QUERY), mxComponentContext );
xContainingPage, *mpCurrMtf, mnCurrMtfLoadFlags, if (!mpCurrMtf)
mxComponentContext ); mpCurrMtf.reset(new GDIMetaFile);
ENSURE_OR_THROW( mpCurrMtf,
"DrawShape::DrawShape(): Invalid metafile" );
maSubsetting.reset( mpCurrMtf ); maSubsetting.reset( mpCurrMtf );
prepareHyperlinkIndices(); prepareHyperlinkIndices();
......
...@@ -127,7 +127,7 @@ public: ...@@ -127,7 +127,7 @@ public:
against unsupported content, and, if necessary, against unsupported content, and, if necessary,
returned as a pre-rendererd bitmap. returned as a pre-rendererd bitmap.
*/ */
GDIMetaFile getMtf( bool bForeignSource ) const GDIMetaFileSharedPtr getMtf( bool bForeignSource ) const
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
...@@ -138,22 +138,19 @@ public: ...@@ -138,22 +138,19 @@ public:
hasUnsupportedActions(aGraphic.GetGDIMetaFile()) ) ) hasUnsupportedActions(aGraphic.GetGDIMetaFile()) ) )
{ {
// wrap bitmap into GDIMetafile // wrap bitmap into GDIMetafile
GDIMetaFile aMtf; GDIMetaFileSharedPtr xMtf(new GDIMetaFile);
::Point aEmptyPoint; ::Point aEmptyPoint;
::BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); ::BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
aMtf.AddAction( new MetaBmpExAction( aEmptyPoint, xMtf->AddAction( new MetaBmpExAction( aEmptyPoint,
aBmpEx ) ); aBmpEx ) );
aMtf.SetPrefSize( aBmpEx.GetPrefSize() ); xMtf->SetPrefSize( aBmpEx.GetPrefSize() );
aMtf.SetPrefMapMode( aBmpEx.GetPrefMapMode() ); xMtf->SetPrefMapMode( aBmpEx.GetPrefMapMode() );
return aMtf; return xMtf;
}
else
{
return aGraphic.GetGDIMetaFile();
} }
return GDIMetaFileSharedPtr(new GDIMetaFile(aGraphic.GetGDIMetaFile()));
} }
private: private:
...@@ -164,14 +161,16 @@ private: ...@@ -164,14 +161,16 @@ private:
// Quick'n'dirty way: tunnel Graphic (only works for // Quick'n'dirty way: tunnel Graphic (only works for
// in-process slideshow, of course) // in-process slideshow, of course)
bool getMetaFile( const uno::Reference< lang::XComponent >& xSource, GDIMetaFileSharedPtr getMetaFile( const uno::Reference< lang::XComponent >& xSource,
const uno::Reference< drawing::XDrawPage >& xContainingPage, const uno::Reference< drawing::XDrawPage >& xContainingPage,
GDIMetaFile& rMtf, int mtfLoadFlags,
int mtfLoadFlags, const uno::Reference< uno::XComponentContext >& rxContext )
const uno::Reference< uno::XComponentContext >& rxContext )
{ {
ENSURE_OR_RETURN_FALSE( rxContext.is(), if (!rxContext.is())
"getMetaFile(): Invalid context" ); {
SAL_WARN("slideshow.opengl", "getMetaFile(): Invalid context" );
return GDIMetaFileSharedPtr();
}
// create dummy XGraphicRenderer, which receives the // create dummy XGraphicRenderer, which receives the
// generated XGraphic from the GraphicExporter // generated XGraphic from the GraphicExporter
...@@ -212,9 +211,9 @@ bool getMetaFile( const uno::Reference< lang::XComponent >& xSource, ...@@ -212,9 +211,9 @@ bool getMetaFile( const uno::Reference< lang::XComponent >& xSource,
xExporter->setSourceDocument( xSource ); xExporter->setSourceDocument( xSource );
if( !xExporter->filter( aProps ) ) if( !xExporter->filter( aProps ) )
return false; return GDIMetaFileSharedPtr();
rMtf = pRenderer->getMtf( (mtfLoadFlags & MTF_LOAD_FOREIGN_SOURCE) != 0 ); GDIMetaFileSharedPtr xMtf = pRenderer->getMtf( (mtfLoadFlags & MTF_LOAD_FOREIGN_SOURCE) != 0 );
// pRenderer is automatically destroyed when xRenderer // pRenderer is automatically destroyed when xRenderer
// goes out of scope // goes out of scope
...@@ -222,7 +221,7 @@ bool getMetaFile( const uno::Reference< lang::XComponent >& xSource, ...@@ -222,7 +221,7 @@ bool getMetaFile( const uno::Reference< lang::XComponent >& xSource,
// TODO(E3): Error handling. Exporter might have // TODO(E3): Error handling. Exporter might have
// generated nothing, a bitmap, threw an exception, // generated nothing, a bitmap, threw an exception,
// whatever. // whatever.
return true; return xMtf;
} }
sal_Int32 getNextActionOffset( MetaAction * pCurrAct ) sal_Int32 getNextActionOffset( MetaAction * pCurrAct )
......
...@@ -90,14 +90,11 @@ namespace slideshow ...@@ -90,14 +90,11 @@ namespace slideshow
import (currently, the UnoGraphicExporter needs this import (currently, the UnoGraphicExporter needs this
information). information).
@param o_rMtf
Metafile to extract shape content into
*/ */
bool getMetaFile( const css::uno::Reference< css::lang::XComponent >& xSource, GDIMetaFileSharedPtr getMetaFile( const css::uno::Reference< css::lang::XComponent >& xSource,
const css::uno::Reference< css::drawing::XDrawPage >& xContainingPage, const css::uno::Reference< css::drawing::XDrawPage >& xContainingPage,
GDIMetaFile& o_rMtf, int mtfLoadFlags,
int mtfLoadFlags, const css::uno::Reference< css::uno::XComponentContext >& rxContext );
const css::uno::Reference< css::uno::XComponentContext >& rxContext );
/** Gets the next action offset for iterating meta actions which is most /** Gets the next action offset for iterating meta actions which is most
often returns 1. often returns 1.
......
...@@ -608,7 +608,6 @@ sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uI ...@@ -608,7 +608,6 @@ sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uI
return nCount; return nCount;
} }
Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap ) Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap )
{ {
Bitmap aBitmap( rBitmap ); Bitmap aBitmap( rBitmap );
...@@ -624,7 +623,6 @@ Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap ) ...@@ -624,7 +623,6 @@ Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap )
return aBitmap; return aBitmap;
} }
BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& rColor, const long nTol ) BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& rColor, const long nTol )
{ {
EnterWait(); EnterWait();
...@@ -979,6 +977,13 @@ GDIMetaFile SvxBmpMask::ImpReplaceTransparency( const GDIMetaFile& rMtf, const C ...@@ -979,6 +977,13 @@ GDIMetaFile SvxBmpMask::ImpReplaceTransparency( const GDIMetaFile& rMtf, const C
return aMtf; return aMtf;
} }
GDIMetaFile SvxBmpMask::GetMetaFile(const Graphic& rGraphic)
{
// Replace transparency?
if (m_pCbxTrans->IsChecked())
return ImpReplaceTransparency(rGraphic.GetGDIMetaFile(), m_pLbColorTrans->GetSelectEntryColor());
return ImpMask(rGraphic.GetGDIMetaFile());
}
Graphic SvxBmpMask::Mask( const Graphic& rGraphic ) Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
{ {
...@@ -1054,14 +1059,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic ) ...@@ -1054,14 +1059,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
case GraphicType::GdiMetafile: case GraphicType::GdiMetafile:
{ {
GDIMetaFile aMtf( aGraphic.GetGDIMetaFile() ); GDIMetaFile aMtf(GetMetaFile(rGraphic));
// Replace transparency?
if( m_pCbxTrans->IsChecked() )
aMtf = ImpReplaceTransparency( aMtf, aReplColor );
else
aMtf = ImpMask( aMtf );
Size aSize( aMtf.GetPrefSize() ); Size aSize( aMtf.GetPrefSize() );
if ( aSize.Width() && aSize.Height() ) if ( aSize.Width() && aSize.Height() )
aGraphic = Graphic( aMtf ); aGraphic = Graphic( aMtf );
......
...@@ -2003,10 +2003,18 @@ void SdrEditView::ConvertMarkedToPolyObj() ...@@ -2003,10 +2003,18 @@ void SdrEditView::ConvertMarkedToPolyObj()
ImpConvertTo(false, false/*bLineToArea*/); ImpConvertTo(false, false/*bLineToArea*/);
} }
namespace
{
GDIMetaFile GetMetaFile(SdrGrafObj* pGraf)
{
if (pGraf->HasGDIMetaFile())
return pGraf->GetTransformedGraphic(SdrGrafObjTransformsAttrs::COLOR|SdrGrafObjTransformsAttrs::MIRROR).GetGDIMetaFile();
assert(pGraf->isEmbeddedSvg());
return pGraf->getMetafileFromEmbeddedSvg();
}
}
// Metafile Import // Metafile Import
void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo)
{ {
const bool bUndo = IsUndoEnabled(); const bool bUndo = IsUndoEnabled();
...@@ -2040,19 +2048,9 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) ...@@ -2040,19 +2048,9 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo)
sal_uIntPtr nInsAnz=0; sal_uIntPtr nInsAnz=0;
Rectangle aLogicRect; Rectangle aLogicRect;
if(pGraf && (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedSvg())) if (pGraf && (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedSvg()))
{ {
GDIMetaFile aMetaFile; GDIMetaFile aMetaFile(GetMetaFile(pGraf));
if(pGraf->HasGDIMetaFile())
{
aMetaFile = pGraf->GetTransformedGraphic(SdrGrafObjTransformsAttrs::COLOR|SdrGrafObjTransformsAttrs::MIRROR).GetGDIMetaFile();
}
else if(pGraf->isEmbeddedSvg())
{
aMetaFile = pGraf->getMetafileFromEmbeddedSvg();
}
if(aMetaFile.GetActionSize()) if(aMetaFile.GetActionSize())
{ {
aLogicRect = pGraf->GetLogicRect(); aLogicRect = pGraf->GetLogicRect();
......
...@@ -1044,27 +1044,30 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const ...@@ -1044,27 +1044,30 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const
return aRetval; return aRetval;
} }
SdrObject* SdrGrafObj::DoConvertToPolyObj(bool bBezier, bool bAddText ) const GDIMetaFile SdrGrafObj::GetMetaFile(GraphicType &rGraphicType) const
{ {
SdrObject* pRetval = nullptr; if (isEmbeddedSvg())
GraphicType aGraphicType(GetGraphicType());
GDIMetaFile aMtf;
if(isEmbeddedSvg())
{ {
// Embedded Svg // Embedded Svg
// There is currently no helper to create SdrObjects from primitives (even if I'm thinking // There is currently no helper to create SdrObjects from primitives (even if I'm thinking
// about writing one for some time). To get the roundtrip to SdrObjects it is necessary to // about writing one for some time). To get the roundtrip to SdrObjects it is necessary to
// use the old converter path over the MetaFile mechanism. Create Metafile from Svg // use the old converter path over the MetaFile mechanism. Create Metafile from Svg
// primitives here pretty directly // primitives here pretty directly
aMtf = getMetafileFromEmbeddedSvg(); rGraphicType = GraphicType::GdiMetafile;
aGraphicType = GraphicType::GdiMetafile; return getMetafileFromEmbeddedSvg();
} }
else if(GraphicType::GdiMetafile == aGraphicType) else if (GraphicType::GdiMetafile == rGraphicType)
{ {
aMtf = GetTransformedGraphic(SdrGrafObjTransformsAttrs::COLOR|SdrGrafObjTransformsAttrs::MIRROR).GetGDIMetaFile(); return GetTransformedGraphic(SdrGrafObjTransformsAttrs::COLOR|SdrGrafObjTransformsAttrs::MIRROR).GetGDIMetaFile();
} }
return GDIMetaFile();
}
SdrObject* SdrGrafObj::DoConvertToPolyObj(bool bBezier, bool bAddText ) const
{
SdrObject* pRetval = nullptr;
GraphicType aGraphicType(GetGraphicType());
GDIMetaFile aMtf(GetMetaFile(aGraphicType));
switch(aGraphicType) switch(aGraphicType)
{ {
case GraphicType::GdiMetafile: case GraphicType::GdiMetafile:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment