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