summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-08-05 21:41:49 +0200
committerMichael Meeks <michael.meeks@suse.com>2013-08-06 16:18:32 +0200
commit203dad15bf1c381e3b45b3253faf92f4a470c8de (patch)
tree6817617e49e8e186b4c7497d038724c6286d54c7
parent7afc29809ec9db8c5064d5b5857f64db9bd843be (diff)
initial cut at ref-counting GraphicObjects
Change-Id: Ia87c429fc9e8b470fe066ee2179928de01c1fa1b
-rw-r--r--canvas/source/vcl/cachedbitmap.hxx2
-rw-r--r--canvas/source/vcl/canvashelper.cxx14
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx20
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx3
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx16
-rw-r--r--drawinglayer/source/primitive2d/mediaprimitive2d.cxx4
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx8
-rw-r--r--editeng/source/items/bulitem.cxx59
-rw-r--r--editeng/source/items/frmitems.cxx91
-rw-r--r--editeng/source/outliner/outliner.cxx9
-rw-r--r--editeng/source/uno/unonrule.cxx14
-rw-r--r--filter/source/msfilter/escherex.cxx62
-rw-r--r--filter/source/msfilter/msdffimp.cxx6
-rw-r--r--include/drawinglayer/primitive2d/graphicprimitive2d.hxx8
-rw-r--r--include/editeng/brushitem.hxx7
-rw-r--r--include/editeng/bulletitem.hxx6
-rw-r--r--include/editeng/outliner.hxx10
-rw-r--r--include/svtools/grfmgr.hxx71
-rw-r--r--include/svx/galctrl.hxx8
-rw-r--r--include/svx/galmisc.hxx3
-rw-r--r--include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx6
-rw-r--r--include/svx/svdograf.hxx10
-rw-r--r--include/svx/xbitmap.hxx4
-rw-r--r--include/svx/xbtmpit.hxx12
-rw-r--r--include/svx/xmlgrhlp.hxx2
-rw-r--r--include/svx/xtable.hxx8
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/source/graphic/graphicunofactory.cxx95
-rw-r--r--svtools/source/graphic/grfmgr.cxx85
-rw-r--r--svtools/source/graphic/grfmgr2.cxx20
-rw-r--r--svtools/source/graphic/provider.cxx7
-rw-r--r--svtools/source/graphic/renderer.cxx5
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx5
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx11
-rw-r--r--svx/source/dialog/compressgraphicdialog.cxx2
-rw-r--r--svx/source/dialog/dlgctrl.cxx8
-rw-r--r--svx/source/gallery2/galctrl.cxx14
-rw-r--r--svx/source/gallery2/galmisc.cxx27
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx22
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx6
-rw-r--r--svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx6
-rw-r--r--svx/source/svdraw/svddrgmt.cxx8
-rw-r--r--svx/source/svdraw/svdetc.cxx2
-rw-r--r--svx/source/svdraw/svdfmtf.cxx3
-rw-r--r--svx/source/svdraw/svdhdl.cxx2
-rw-r--r--svx/source/svdraw/svdmrkv.cxx4
-rw-r--r--svx/source/svdraw/svdoashp.cxx12
-rw-r--r--svx/source/svdraw/svdograf.cxx169
-rw-r--r--svx/source/svdraw/svdoole2.cxx21
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx2
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx8
-rw-r--r--svx/source/unodraw/unobtabl.cxx2
-rw-r--r--svx/source/unodraw/unoshap2.cxx14
-rw-r--r--svx/source/unodraw/unoshap4.cxx14
-rw-r--r--svx/source/xml/xmlgrhlp.cxx52
-rw-r--r--svx/source/xoutdev/xattr.cxx6
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx73
-rw-r--r--svx/source/xoutdev/xpool.cxx2
-rw-r--r--svx/source/xoutdev/xtabbtmp.cxx8
-rw-r--r--svx/source/xoutdev/xtable.cxx7
61 files changed, 584 insertions, 604 deletions
diff --git a/canvas/source/vcl/cachedbitmap.hxx b/canvas/source/vcl/cachedbitmap.hxx
index 948fdd3aa4ff..117d560943f1 100644
--- a/canvas/source/vcl/cachedbitmap.hxx
+++ b/canvas/source/vcl/cachedbitmap.hxx
@@ -39,7 +39,7 @@ namespace vclcanvas
/** Create an XCachedPrimitive for given GraphicObject
*/
- CachedBitmap( const GraphicObjectSharedPtr& rGraphicObject,
+ CachedBitmap( const rtl::Reference< GraphicObject> &xGraphicObject,
const ::Point& rPoint,
const ::Size& rSize,
const GraphicAttr& rAttr,
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index 54fff82b4d74..d1adb780f8d5 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -762,8 +762,8 @@ namespace vclcanvas
double nShearX;
aMatrix.decompose( aScale, aOutputPos, nRotate, nShearX );
- GraphicAttr aGrfAttr;
- GraphicObjectSharedPtr pGrfObj;
+ GraphicAttr aGrfAttr;
+ rtl::Reference< GraphicObject> xGrfObj;
::Size aBmpSize( aBmpEx.GetSizePixel() );
@@ -803,7 +803,7 @@ namespace vclcanvas
const double nAngleInTenthOfDegrees (3600.0 - nRotate * 3600.0 / (2*M_PI));
aGrfAttr.SetRotation( static_cast< sal_uInt16 >(::basegfx::fround(nAngleInTenthOfDegrees)) );
- pGrfObj.reset( new GraphicObject( aBmpEx ) );
+ xGrfObj = GraphicObject::Create( aBmpEx );
}
else
{
@@ -828,7 +828,7 @@ namespace vclcanvas
renderState.DeviceColor,
tools::MODULATE_NONE );
- pGrfObj.reset( new GraphicObject( aBmpEx ) );
+ xGrfObj = GraphicObject::Create( aBmpEx );
// clear scale values, generated bitmap already
// contains scaling
@@ -843,13 +843,13 @@ namespace vclcanvas
const ::Size aSz( ::basegfx::fround( aScale.getX() * aBmpSize.Width() ),
::basegfx::fround( aScale.getY() * aBmpSize.Height() ) );
- pGrfObj->Draw( &mpOutDev->getOutDev(),
+ xGrfObj->Draw( &mpOutDev->getOutDev(),
aPt,
aSz,
&aGrfAttr );
if( mp2ndOutDev )
- pGrfObj->Draw( &mp2ndOutDev->getOutDev(),
+ xGrfObj->Draw( &mp2ndOutDev->getOutDev(),
aPt,
aSz,
&aGrfAttr );
@@ -858,7 +858,7 @@ namespace vclcanvas
// display bitmap - return cache object, to retain
// that information.
return uno::Reference< rendering::XCachedPrimitive >(
- new CachedBitmap( pGrfObj,
+ new CachedBitmap( xGrfObj,
aPt,
aSz,
aGrfAttr,
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index 2da3dc607ae8..6d4947ce4841 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -69,7 +69,7 @@ namespace vclcanvas
namespace
{
bool textureFill( OutputDevice& rOutDev,
- GraphicObject& rGraphic,
+ const rtl::Reference< GraphicObject > &xGraphic,
const ::Point& rPosPixel,
const ::Size& rNextTileX,
const ::Size& rNextTileY,
@@ -91,7 +91,7 @@ namespace vclcanvas
{
// update return value. This method should return true, if
// at least one of the looped Draws succeeded.
- bRet |= ( sal_True == rGraphic.Draw( &rOutDev,
+ bRet |= ( sal_True == xGraphic->Draw( &rOutDev,
aCurrPos,
rTileSize,
&rAttr ) );
@@ -842,7 +842,7 @@ namespace vclcanvas
aTotalTransform.decompose( aScale, aOutputPos, nRotate, nShearX );
GraphicAttr aGrfAttr;
- GraphicObjectSharedPtr pGrfObj;
+ rtl::Reference< GraphicObject > xGrfObj;
if( ::basegfx::fTools::equalZero( nShearX ) )
{
@@ -856,7 +856,7 @@ namespace vclcanvas
( aScale.getY() < 0.0 ? BMP_MIRROR_VERT : 0 ) );
aGrfAttr.SetRotation( static_cast< sal_uInt16 >(::basegfx::fround( nRotate*10.0 )) );
- pGrfObj.reset( new GraphicObject( aBmpEx ) );
+ xGrfObj = GraphicObject::Create( aBmpEx );
}
else
{
@@ -867,7 +867,7 @@ namespace vclcanvas
uno::Sequence< double >(),
tools::MODULATE_NONE);
- pGrfObj.reset( new GraphicObject( aBmpEx ) );
+ xGrfObj = GraphicObject::Create( aBmpEx );
// clear scale values, generated bitmap already
// contains scaling
@@ -989,7 +989,7 @@ namespace vclcanvas
rOutDev.IntersectClipRegion( aPolygonDeviceRect );
textureFill( rOutDev,
- *pGrfObj,
+ xGrfObj,
aPt,
aIntegerNextTileX,
aIntegerNextTileY,
@@ -1003,7 +1003,7 @@ namespace vclcanvas
OutputDevice& r2ndOutDev( mp2ndOutDev->getOutDev() );
r2ndOutDev.IntersectClipRegion( aPolygonDeviceRect );
textureFill( r2ndOutDev,
- *pGrfObj,
+ xGrfObj,
aPt,
aIntegerNextTileX,
aIntegerNextTileY,
@@ -1038,7 +1038,7 @@ namespace vclcanvas
aVDev.SetClipRegion( aPolyClipRegion );
textureFill( aVDev,
- *pGrfObj,
+ xGrfObj,
aOutPos,
aIntegerNextTileX,
aIntegerNextTileY,
@@ -1075,7 +1075,7 @@ namespace vclcanvas
rOutDev.SetClipRegion( aPolyClipRegion );
textureFill( rOutDev,
- *pGrfObj,
+ xGrfObj,
aPt,
aIntegerNextTileX,
aIntegerNextTileY,
@@ -1092,7 +1092,7 @@ namespace vclcanvas
r2ndOutDev.SetClipRegion( aPolyClipRegion );
textureFill( r2ndOutDev,
- *pGrfObj,
+ xGrfObj,
aPt,
aIntegerNextTileX,
aIntegerNextTileY,
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index b8e37ef1c34e..e692dd9b3cfb 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -635,7 +635,8 @@ void ChartModel::impl_loadGraphics(
*apIStm.get(),
aGraphic ) )
{
- m_aGraphicObjectVector.push_back( aGraphic );
+ m_aGraphicObjectVector.push_back(
+ GraphicObject::Create( aGraphic ) );
}
}
}
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index df69a36cdd94..2329ace80688 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -71,8 +71,8 @@ namespace drawinglayer
aSuppressGraphicAttr.SetRotation(0);
aSuppressGraphicAttr.SetMirrorFlags(0);
- const GraphicObject& rGraphicObject = getGraphicObject();
- const Graphic aTransformedGraphic(rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr));
+ rtl::Reference< GraphicObject > xGraphicObject = getGraphicObject();
+ const Graphic aTransformedGraphic(xGraphicObject->GetTransformedGraphic(&aSuppressGraphicAttr));
aRetval = create2DDecompositionOfGraphic(
aTransformedGraphic,
@@ -87,7 +87,7 @@ namespace drawinglayer
// is necessary since the crop values are relative to original bitmap size
const basegfx::B2DVector aObjectScale(aTransform * basegfx::B2DVector(1.0, 1.0));
const basegfx::B2DVector aCropScaleFactor(
- rGraphicObject.calculateCropScaling(
+ xGraphicObject->calculateCropScaling(
aObjectScale.getX(),
aObjectScale.getY(),
getGraphicAttr().GetLeftCrop(),
@@ -115,21 +115,21 @@ namespace drawinglayer
GraphicPrimitive2D::GraphicPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
- const GraphicObject& rGraphicObject,
+ const rtl::Reference< GraphicObject >& xGraphicObject,
const GraphicAttr& rGraphicAttr)
: BufferedDecompositionPrimitive2D(),
maTransform(rTransform),
- maGraphicObject(rGraphicObject),
+ mxGraphicObject(GraphicObject::Create(xGraphicObject)),
maGraphicAttr(rGraphicAttr)
{
}
GraphicPrimitive2D::GraphicPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
- const GraphicObject& rGraphicObject)
+ const rtl::Reference< GraphicObject >& xGraphicObject)
: BufferedDecompositionPrimitive2D(),
maTransform(rTransform),
- maGraphicObject(rGraphicObject),
+ mxGraphicObject(GraphicObject::Create(xGraphicObject)),
maGraphicAttr()
{
}
@@ -141,7 +141,7 @@ namespace drawinglayer
const GraphicPrimitive2D& rCompare = (GraphicPrimitive2D&)rPrimitive;
return (getTransform() == rCompare.getTransform()
- && getGraphicObject() == rCompare.getGraphicObject()
+ && *getGraphicObject().get() == *rCompare.getGraphicObject().get()
&& getGraphicAttr() == rCompare.getGraphicAttr());
}
diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
index b0bc413a4485..cf5bb1eabf08 100644
--- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
@@ -49,11 +49,11 @@ namespace drawinglayer
if(GRAPHIC_BITMAP == maSnapshot.GetType() || GRAPHIC_GDIMETAFILE == maSnapshot.GetType())
{
- const GraphicObject aGraphicObject(maSnapshot);
+ const rtl::Reference< GraphicObject > xGraphicObject = GraphicObject::Create(maSnapshot);
const GraphicAttr aGraphicAttr;
xRetval.realloc(2);
xRetval[0] = xRefBackground;
- xRetval[1] = Primitive2DReference(new GraphicPrimitive2D(getTransform(), aGraphicObject, aGraphicAttr));
+ xRetval[1] = Primitive2DReference(new GraphicPrimitive2D(getTransform(), xGraphicObject, aGraphicAttr));
}
if(getDiscreteBorder())
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index c9f4af1c3784..9ed958fbaa41 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -789,7 +789,7 @@ namespace drawinglayer
{
// emulate data handling from UnoControlPDFExportContact, original see
// svtools/source/graphic/grfmgr.cxx
- const Graphic& rGraphic = rGraphicPrimitive.getGraphicObject().GetGraphic();
+ const Graphic& rGraphic = rGraphicPrimitive.getGraphicObject()->GetGraphic();
if(rGraphic.IsLink())
{
@@ -836,8 +836,8 @@ namespace drawinglayer
{
const MapMode aMapMode100thmm(MAP_100TH_MM);
const Size aBitmapSize(Application::GetDefaultDevice()->LogicToLogic(
- rGraphicPrimitive.getGraphicObject().GetPrefSize(),
- rGraphicPrimitive.getGraphicObject().GetPrefMapMode(), aMapMode100thmm));
+ rGraphicPrimitive.getGraphicObject()->GetPrefSize(),
+ rGraphicPrimitive.getGraphicObject()->GetPrefMapMode(), aMapMode100thmm));
const double fDivX(aBitmapSize.Width() - rAttr.GetLeftCrop() - rAttr.GetRightCrop());
const double fDivY(aBitmapSize.Height() - rAttr.GetTopCrop() - rAttr.GetBottomCrop());
@@ -862,7 +862,7 @@ namespace drawinglayer
sal_Int32(ceil(aCropRange.getMaxX())), sal_Int32(ceil(aCropRange.getMaxY())));
}
- mpPDFExtOutDevData->EndGroup(rGraphicPrimitive.getGraphicObject().GetGraphic(),
+ mpPDFExtOutDevData->EndGroup(rGraphicPrimitive.getGraphicObject()->GetGraphic(),
rAttr.GetTransparency(),
aCurrentRect,
aCropRect);
diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx
index e76869e9575f..d89476cfbac3 100644
--- a/editeng/source/items/bulitem.cxx
+++ b/editeng/source/items/bulitem.cxx
@@ -112,8 +112,7 @@ SvxBulletItem::SvxBulletItem( sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
// -----------------------------------------------------------------------
SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
- SfxPoolItem( _nWhich ),
- pGraphicObject( NULL )
+ SfxPoolItem( _nWhich )
{
rStrm >> nStyle;
@@ -140,7 +139,7 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
nStyle = BS_NONE;
}
else
- pGraphicObject = new GraphicObject( aBmp );
+ mxGraphicObject = GraphicObject::Create( aBmp );
}
//#fdo39428 SvStream no longer supports operator>>(long&)
@@ -170,7 +169,7 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
{
aFont = rItem.aFont;
- pGraphicObject = ( rItem.pGraphicObject ? new GraphicObject( *rItem.pGraphicObject ) : NULL );
+ mxGraphicObject = GraphicObject::Create( rItem.mxGraphicObject );
aPrevText = rItem.aPrevText;
aFollowText = rItem.aFollowText;
nStart = rItem.nStart;
@@ -186,8 +185,6 @@ SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
SvxBulletItem::~SvxBulletItem()
{
- if( pGraphicObject )
- delete pGraphicObject;
}
// -----------------------------------------------------------------------
@@ -217,7 +214,7 @@ void SvxBulletItem::SetDefaultFont_Impl()
void SvxBulletItem::SetDefaults_Impl()
{
- pGraphicObject = NULL;
+ mxGraphicObject = rtl::Reference< GraphicObject >();
nWidth = 1200; // 1.2cm
nStart = 1;
nStyle = BS_123;
@@ -290,12 +287,13 @@ int SvxBulletItem::operator==( const SfxPoolItem& rItem ) const
if( nStyle == BS_BMP )
{
- if( ( pGraphicObject && !rBullet.pGraphicObject ) || ( !pGraphicObject && rBullet.pGraphicObject ) )
+ if( ( mxGraphicObject.is() && !rBullet.mxGraphicObject.is() ) ||
+ ( !mxGraphicObject.is() && rBullet.mxGraphicObject.is() ) )
return 0;
- if( ( pGraphicObject && rBullet.pGraphicObject ) &&
- ( ( *pGraphicObject != *rBullet.pGraphicObject ) ||
- ( pGraphicObject->GetPrefSize() != rBullet.pGraphicObject->GetPrefSize() ) ) )
+ if( ( mxGraphicObject.is() && rBullet.mxGraphicObject.is() ) &&
+ ( ( mxGraphicObject.get() != rBullet.mxGraphicObject.get() ) ||
+ ( mxGraphicObject->GetPrefSize() != rBullet.mxGraphicObject->GetPrefSize() ) ) )
{
return 0;
}
@@ -310,13 +308,10 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c
{
// Correction for empty bitmap
if( ( nStyle == BS_BMP ) &&
- ( !pGraphicObject || ( GRAPHIC_NONE == pGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == pGraphicObject->GetType() ) ) )
+ ( !mxGraphicObject.is() || ( GRAPHIC_NONE == mxGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == mxGraphicObject->GetType() ) ) )
{
- if( pGraphicObject )
- {
- delete( const_cast< SvxBulletItem* >( this )->pGraphicObject );
- const_cast< SvxBulletItem* >( this )->pGraphicObject = NULL;
- }
+ if( mxGraphicObject.is() )
+ const_cast< SvxBulletItem* >( this )->mxGraphicObject.clear();
const_cast< SvxBulletItem* >( this )->nStyle = BS_NONE;
}
@@ -331,7 +326,7 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c
// Small preliminary estimate of the size ...
sal_uInt16 nFac = ( rStrm.GetCompressMode() != COMPRESSMODE_NONE ) ? 3 : 1;
- const Bitmap aBmp( pGraphicObject->GetGraphic().GetBitmap() );
+ const Bitmap aBmp( mxGraphicObject->GetGraphic().GetBitmap() );
sal_uLong nBytes = aBmp.GetSizeBytes();
if ( nBytes < sal_uLong(0xFF00*nFac) )
{
@@ -406,34 +401,26 @@ SfxItemPresentation SvxBulletItem::GetPresentation
//------------------------------------------------------------------------
-const GraphicObject& SvxBulletItem::GetGraphicObject() const
+rtl::Reference< GraphicObject > SvxBulletItem::GetGraphicObject() const
{
- if( pGraphicObject )
- return *pGraphicObject;
+ if( mxGraphicObject.is() )
+ return mxGraphicObject;
else
{
- static const GraphicObject aDefaultObject;
- return aDefaultObject;
+ static const rtl::Reference< GraphicObject > xDefaultObject = GraphicObject::Create();
+ return xDefaultObject;
}
}
//------------------------------------------------------------------------
-void SvxBulletItem::SetGraphicObject( const GraphicObject& rGraphicObject )
+void SvxBulletItem::SetGraphicObject( const rtl::Reference< GraphicObject > &xGraphicObject )
{
- if( ( GRAPHIC_NONE == rGraphicObject.GetType() ) || ( GRAPHIC_DEFAULT == rGraphicObject.GetType() ) )
- {
- if( pGraphicObject )
- {
- delete pGraphicObject;
- pGraphicObject = NULL;
- }
- }
+ if( GRAPHIC_NONE == xGraphicObject->GetType() ||
+ GRAPHIC_DEFAULT == xGraphicObject->GetType() )
+ mxGraphicObject.clear();
else
- {
- delete pGraphicObject;
- pGraphicObject = new GraphicObject( rGraphicObject );
- }
+ mxGraphicObject = GraphicObject::Create( xGraphicObject );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 987c888be328..02c93014efff 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3302,13 +3302,14 @@ void SvxLineItem::SetLine( const SvxBorderLine* pNew )
class SvxBrushItem_Impl
{
public:
- GraphicObject* pGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
sal_Int8 nGraphicTransparency; //contains a percentage value which is
//copied to the GraphicObject when necessary
Link aDoneLink;
SvStream* pStream;
- SvxBrushItem_Impl( GraphicObject* p ) : pGraphicObject( p ), nGraphicTransparency(0), pStream(0) {}
+ SvxBrushItem_Impl( const rtl::Reference< GraphicObject > & x ) :
+ mxGraphicObject( x ), nGraphicTransparency(0), pStream(0) {}
};
// -----------------------------------------------------------------------
@@ -3361,7 +3362,7 @@ SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos,
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
- pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphic ) ) ),
+ pImpl ( new SvxBrushItem_Impl( GraphicObject::Create( rGraphic ) ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
@@ -3373,14 +3374,14 @@ SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos,
// -----------------------------------------------------------------------
-SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj,
+SvxBrushItem::SvxBrushItem( const rtl::Reference< GraphicObject > &xGraphicObj,
SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
SfxPoolItem( _nWhich ),
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
- pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphicObj ) ) ),
+ pImpl ( new SvxBrushItem_Impl( GraphicObject::Create( xGraphicObj ) ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
@@ -3493,7 +3494,7 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
Graphic aGraphic;
rStream >> aGraphic;
- pImpl->pGraphicObject = new GraphicObject( aGraphic );
+ pImpl->mxGraphicObject = GraphicObject::Create( aGraphic );
if( SVSTREAM_FILEFORMAT_ERROR == rStream.GetError() )
{
@@ -3548,7 +3549,6 @@ SvxBrushItem::SvxBrushItem( const SvxBrushItem& rItem ) :
SvxBrushItem::~SvxBrushItem()
{
- delete pImpl->pGraphicObject;
delete pImpl;
delete pStrLink;
delete pStrFilter;
@@ -3603,12 +3603,12 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
OUString sLink;
if ( pStrLink )
sLink = *pStrLink;
- else if( pImpl->pGraphicObject )
+ else if( pImpl->mxGraphicObject.is() )
{
OUString sPrefix(
UNO_NAME_GRAPHOBJ_URLPREFIX);
OUString sId(OStringToOUString(
- pImpl->pGraphicObject->GetUniqueID(),
+ pImpl->mxGraphicObject->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US));
sLink = sPrefix + sId;
}
@@ -3708,10 +3708,9 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
OString sId(OUStringToOString(sTmp.Copy(
sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1),
RTL_TEXTENCODING_ASCII_US));
- GraphicObject *pOldGrfObj = pImpl->pGraphicObject;
- pImpl->pGraphicObject = new GraphicObject( sId );
+ rtl::Reference< GraphicObject > xOldGrfObj = pImpl->mxGraphicObject;
+ pImpl->mxGraphicObject = GraphicObject::Create( sId );
ApplyGraphicTransparency_Impl();
- delete pOldGrfObj;
}
else
{
@@ -3742,7 +3741,7 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(nTmp >= 0 && nTmp <= 100)
{
pImpl->nGraphicTransparency = sal_Int8(nTmp);
- if(pImpl->pGraphicObject)
+ if(pImpl->mxGraphicObject.is())
ApplyGraphicTransparency_Impl();
}
}
@@ -3810,7 +3809,7 @@ SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
aColor = rItem.aColor;
eGraphicPos = rItem.eGraphicPos;
- DELETEZ( pImpl->pGraphicObject );
+ pImpl->mxGraphicObject.clear();
DELETEZ( pStrLink );
DELETEZ( pStrFilter );
@@ -3820,10 +3819,8 @@ SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
pStrLink = new String( *rItem.pStrLink );
if ( rItem.pStrFilter )
pStrFilter = new String( *rItem.pStrFilter );
- if ( rItem.pImpl->pGraphicObject )
- {
- pImpl->pGraphicObject = new GraphicObject( *rItem.pImpl->pGraphicObject );
- }
+ if ( rItem.pImpl->mxGraphicObject.is() )
+ pImpl->mxGraphicObject = GraphicObject::Create( rItem.pImpl->mxGraphicObject );
}
nShadingValue = rItem.nShadingValue;
@@ -3861,11 +3858,11 @@ int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
if ( bEqual && !rCmp.pStrLink )
{
- if ( !rCmp.pImpl->pGraphicObject )
- bEqual = !pImpl->pGraphicObject;
+ if ( !rCmp.pImpl->mxGraphicObject.is() )
+ bEqual = !pImpl->mxGraphicObject.is();
else
- bEqual = pImpl->pGraphicObject &&
- ( *pImpl->pGraphicObject == *rCmp.pImpl->pGraphicObject );
+ bEqual = pImpl->mxGraphicObject.is() &&
+ ( *pImpl->mxGraphicObject.get() == *rCmp.pImpl->mxGraphicObject.get() );
}
}
@@ -3903,7 +3900,7 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ )
sal_uInt16 nDoLoad = 0;
- if ( pImpl->pGraphicObject && !pStrLink )
+ if ( pImpl->mxGraphicObject.is() && !pStrLink )
nDoLoad |= LOAD_GRAPHIC;
if ( pStrLink )
nDoLoad |= LOAD_LINK;
@@ -3911,8 +3908,8 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ )
nDoLoad |= LOAD_FILTER;
rStream << nDoLoad;
- if ( pImpl->pGraphicObject && !pStrLink )
- rStream << pImpl->pGraphicObject->GetGraphic();
+ if ( pImpl->mxGraphicObject.is() && !pStrLink )
+ rStream << pImpl->mxGraphicObject->GetGraphic();
if ( pStrLink )
{
OSL_FAIL("No BaseURL!");
@@ -3938,9 +3935,9 @@ void SvxBrushItem::PurgeMedium() const
}
// -----------------------------------------------------------------------
-const GraphicObject* SvxBrushItem::GetGraphicObject() const
+rtl::Reference< GraphicObject > SvxBrushItem::GetGraphicObject() const
{
- if ( bLoadAgain && pStrLink && !pImpl->pGraphicObject )
+ if ( bLoadAgain && pStrLink && !pImpl->mxGraphicObject.is() )
// when graphics already loaded, use as a cache
{
// only with "valid" names - empty names now allowed
@@ -3962,8 +3959,8 @@ const GraphicObject* SvxBrushItem::GetGraphicObject() const
}
else
{
- pImpl->pGraphicObject = new GraphicObject;
- pImpl->pGraphicObject->SetGraphic( aGraphic );
+ pImpl->mxGraphicObject = GraphicObject::Create();
+ pImpl->mxGraphicObject->SetGraphic( aGraphic );
const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl();
}
}
@@ -3974,15 +3971,15 @@ const GraphicObject* SvxBrushItem::GetGraphicObject() const
}
}
- return pImpl->pGraphicObject;
+ return pImpl->mxGraphicObject;
}
// -----------------------------------------------------------------------
const Graphic* SvxBrushItem::GetGraphic() const
{
- const GraphicObject* pGrafObj = GetGraphicObject();
- return( pGrafObj ? &( pGrafObj->GetGraphic() ) : NULL );
+ rtl::Reference< GraphicObject > xGrafObj = GetGraphicObject();
+ return xGrafObj.is() ? &( xGrafObj->GetGraphic() ) : NULL;
}
// -----------------------------------------------------------------------
@@ -3993,16 +3990,14 @@ void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew )
if ( GPOS_NONE == eGraphicPos )
{
- DELETEZ( pImpl->pGraphicObject );
+ pImpl->mxGraphicObject.clear();
DELETEZ( pStrLink );
DELETEZ( pStrFilter );
}
else
{
- if ( !pImpl->pGraphicObject && !pStrLink )
- {
- pImpl->pGraphicObject = new GraphicObject; // Creating a dummy
- }
+ if ( !pImpl->mxGraphicObject.is() && !pStrLink )
+ pImpl->mxGraphicObject = GraphicObject::Create(); // Creating a dummy
}
}
@@ -4012,10 +4007,10 @@ void SvxBrushItem::SetGraphic( const Graphic& rNew )
{
if ( !pStrLink )
{
- if ( pImpl->pGraphicObject )
- pImpl->pGraphicObject->SetGraphic( rNew );
+ if ( pImpl->mxGraphicObject.is() )
+ pImpl->mxGraphicObject->SetGraphic( rNew );
else
- pImpl->pGraphicObject = new GraphicObject( rNew );
+ pImpl->mxGraphicObject = GraphicObject::Create( rNew );
ApplyGraphicTransparency_Impl();
@@ -4030,15 +4025,11 @@ void SvxBrushItem::SetGraphic( const Graphic& rNew )
// -----------------------------------------------------------------------
-void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj )
+void SvxBrushItem::SetGraphicObject( const rtl::Reference< GraphicObject >& xNewObj )
{
if ( !pStrLink )
{
- if ( pImpl->pGraphicObject )
- *pImpl->pGraphicObject = rNewObj;
- else
- pImpl->pGraphicObject = new GraphicObject( rNewObj );
-
+ pImpl->mxGraphicObject = GraphicObject::Create( xNewObj );
ApplyGraphicTransparency_Impl();
if ( GPOS_NONE == eGraphicPos )
@@ -4063,7 +4054,7 @@ void SvxBrushItem::SetGraphicLink( const String& rNew )
else
pStrLink = new String( rNew );
- DELETEZ( pImpl->pGraphicObject );
+ pImpl->mxGraphicObject.clear();
}
}
@@ -4154,12 +4145,12 @@ SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich )
void SvxBrushItem::ApplyGraphicTransparency_Impl()
{
DBG_ASSERT(pImpl->pGraphicObject, "no GraphicObject available" );
- if(pImpl->pGraphicObject)
+ if(pImpl->mxGraphicObject.is())
{
- GraphicAttr aAttr(pImpl->pGraphicObject->GetAttr());
+ GraphicAttr aAttr(pImpl->mxGraphicObject->GetAttr());
aAttr.SetTransparency(lcl_PercentToTransparency(
pImpl->nGraphicTransparency));
- pImpl->pGraphicObject->SetAttr(aAttr);
+ pImpl->mxGraphicObject->SetAttr(aAttr);
}
}
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index db6915d29cce..ea4d1312c3e1 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1054,7 +1054,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
}
else
{
- if ( pFmt->GetBrush()->GetGraphicObject() )
+ if ( pFmt->GetBrush()->GetGraphicObject().is() )
{
Point aBulletPos;
if ( !bVertical )
@@ -1080,7 +1080,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
// created aDrawBulletHdl, Set/GetDrawBulletHdl.
// created DrawBulletInfo and added handling to sdrtextdecomposition.cxx
DrawBulletInfo aDrawBulletInfo(
- *pFmt->GetBrush()->GetGraphicObject(),
+ pFmt->GetBrush()->GetGraphicObject(),
aBulletPos,
pPara->aBulSize);
@@ -1089,8 +1089,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
}
else
{
- // Remove CAST when KA made the Draw-Method const
- ((GraphicObject*)pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize );
+ pFmt->GetBrush()->GetGraphicObject()->Draw( pOutDev, aBulletPos, pPara->aBulSize );
}
}
}
@@ -1735,7 +1734,7 @@ EBulletInfo Outliner::GetBulletInfo( sal_Int32 nPara )
if( pFmt->GetBulletFont() )
aInfo.aFont = *pFmt->GetBulletFont();
}
- else if ( pFmt->GetBrush()->GetGraphicObject() )
+ else if ( pFmt->GetBrush()->GetGraphicObject().is() )
{
aInfo.aGraphic = pFmt->GetBrush()->GetGraphicObject()->GetGraphic();
}
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index d3a45cbb1dbb..1713b637bac5 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -225,11 +225,11 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex( sa
{
const SvxBrushItem* pBrush = rFmt.GetBrush();
- if(pBrush && pBrush->GetGraphicObject())
+ if(pBrush && pBrush->GetGraphicObject().is())
{
- const GraphicObject* pGrafObj = pBrush->GetGraphicObject();
+ const rtl::Reference<GraphicObject> xGrafObj = pBrush->GetGraphicObject();
OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(pGrafObj->GetUniqueID(),
+ aURL += OStringToOUString(xGrafObj->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US);
aVal <<= aURL;
@@ -375,8 +375,8 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::Prope
OUString aURL;
if( aVal >>= aURL )
{
- GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
- SvxBrushItem aBrushItem( aGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
+ rtl::Reference< GraphicObject > xGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
+ SvxBrushItem aBrushItem( xGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
aFmt.SetGraphicBrush( &aBrushItem );
continue;
}
@@ -463,8 +463,8 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::Prope
{
if( NULL == aFmt.GetBrush() )
{
- GraphicObject aGrafObj;
- SvxBrushItem aBrushItem( aGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
+ rtl::Reference< GraphicObject > xGrafObj = GraphicObject::Create();
+ SvxBrushItem aBrushItem( xGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
aFmt.SetGraphicBrush( &aBrushItem );
}
}
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index d6edcb772a28..b8df2b08b1a8 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1279,8 +1279,8 @@ sal_Bool EscherPropertyContainer::CreateOLEGraphicProperties(
const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic();
if ( pGraphic )
{
- GraphicObject aGraphicObject( *pGraphic );
- bRetValue = CreateGraphicProperties( rXShape,aGraphicObject );
+ rtl::Reference< GraphicObject > xGraphicObject( GraphicObject::Create( *pGraphic ) );
+ bRetValue = CreateGraphicProperties( rXShape, xGraphicObject );
}
}
}
@@ -1328,8 +1328,8 @@ sal_Bool EscherPropertyContainer::CreateMediaGraphicProperties(
SdrObject* pSdrMedia( GetSdrObjectFromXShape( rXShape ) ); // SJ: leaving unoapi, because currently there is
if ( pSdrMedia && pSdrMedia->ISA( SdrMediaObj ) ) // no access to the native graphic object
{
- GraphicObject aGraphicObject( ((SdrMediaObj*)pSdrMedia)->getSnapshot() );
- bRetValue = CreateGraphicProperties( rXShape, aGraphicObject );
+ rtl::Reference< GraphicObject > xGraphicObject( GraphicObject::Create( ((SdrMediaObj*)pSdrMedia)->getSnapshot() ) );
+ bRetValue = CreateGraphicProperties( rXShape, xGraphicObject );
}
}
return bRetValue;
@@ -1385,7 +1385,7 @@ sal_Bool EscherPropertyContainer::CreateEmbeddedBitmapProperties(
namespace {
-GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground, const Rectangle& rRect )
+rtl::Reference< GraphicObject > lclDrawHatch( const ::com::sun::star::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).
@@ -1408,7 +1408,7 @@ GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, cons
aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM));
aMtf.SetPrefSize(rRect.GetSize());
- return GraphicObject(Graphic(aMtf));
+ return GraphicObject::Create(Graphic(aMtf));
}
} // namespace
@@ -1417,8 +1417,8 @@ GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, cons
sal_Bool EscherPropertyContainer::CreateEmbeddedHatchProperties( const ::com::sun::star::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();
+ rtl::Reference< GraphicObject > xGraphicObject( lclDrawHatch( rHatch, rBackColor, bFillBackground, aRect ) );
+ OString aUniqueId = xGraphicObject->GetUniqueID();
sal_Bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId );
if ( bRetValue )
AddOpt( ESCHER_Prop_fillType, ESCHER_FillTexture );
@@ -1437,7 +1437,7 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
sal_Bool bMirrored = sal_False;
sal_Bool bRotate = sal_True;
GraphicAttr* pGraphicAttr = NULL;
- GraphicObject aGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
OUString aGraphicUrl;
OString aUniqueId;
bool bIsGraphicMtf(false);
@@ -1470,9 +1470,9 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
sal_uInt32 nErrCode = GraphicConverter::Import( aTemp, aGraphic, CVT_WMF );
if ( nErrCode == ERRCODE_NONE )
{
- aGraphicObject = aGraphic;
- aUniqueId = aGraphicObject.GetUniqueID();
- bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+ mxGraphicObject = GraphicObject::Create( aGraphic );
+ aUniqueId = mxGraphicObject->GetUniqueID();
+ bIsGraphicMtf = mxGraphicObject->GetType() == GRAPHIC_GDIMETAFILE;
}
}
}
@@ -1486,9 +1486,9 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
{
BitmapEx aBitmapEx( VCLUnoHelper::GetBitmap( xBmp ) );
Graphic aGraphic( aBitmapEx );
- aGraphicObject = aGraphic;
- aUniqueId = aGraphicObject.GetUniqueID();
- bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+ mxGraphicObject = GraphicObject::Create( aGraphic );
+ aUniqueId = mxGraphicObject->GetUniqueID();
+ bIsGraphicMtf = mxGraphicObject->GetType() == GRAPHIC_GDIMETAFILE;
}
}
}
@@ -1518,10 +1518,10 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
}
const Rectangle aRect(Point(0, 0), pShapeBoundRect ? pShapeBoundRect->GetSize() : Size(28000, 21000));
- aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground, aRect );
- aUniqueId = aGraphicObject.GetUniqueID();
+ mxGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground, aRect );
+ aUniqueId = mxGraphicObject->GetUniqueID();
eBitmapMode = ::com::sun::star::drawing::BitmapMode_REPEAT;
- bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+ bIsGraphicMtf = mxGraphicObject->GetType() == GRAPHIC_GDIMETAFILE;
}
}
@@ -1611,8 +1611,8 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
if ( nErrCode == ERRCODE_NONE )
{
// no.
- aGraphicObject = aGraphic;
- aUniqueId = aGraphicObject.GetUniqueID();
+ mxGraphicObject = GraphicObject::Create(aGraphic);
+ aUniqueId = mxGraphicObject->GetUniqueID();
}
// else: simply keep the graphic link
delete pIn;
@@ -3813,8 +3813,8 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi
return GetCustomShapeType( rXShape, nMirrorFlags, aShapeType );
}
-//Implement for form control export
-sal_Bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape)
+// Implement for form control export
+sal_Bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape)
{
SdrObject* pShape = GetSdrObjectFromXShape( rXShape );
if ( pShape )
@@ -3822,8 +3822,8 @@ sal_Bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const ::co
SdrModel* pMod = pShape->GetModel();
Graphic aGraphic(SdrExchangeView::GetObjGraphic( pMod, pShape));
- GraphicObject aGraphicObject = aGraphic;
- OString aUniqueId = aGraphicObject.GetUniqueID();
+ rtl::Reference< GraphicObject > xGraphicObject( GraphicObject::Create( aGraphic ) );
+ OString aUniqueId = xGraphicObject->GetUniqueID();
if ( aUniqueId.getLength() )
{
if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
@@ -3979,13 +3979,13 @@ sal_Bool EscherPropertyValueHelper::GetPropertyValue(
return eRetValue;
}
-EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject& rObject, const OString& rId,
+EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const rtl::Reference< GraphicObject > &xObject, const OString& rId,
const GraphicAttr* pGraphicAttr ) :
mnPictureOffset ( nPictureOffset ),
mnRefCount ( 1 ),
mnSizeExtra ( 0 ),
- maPrefSize ( rObject.GetPrefSize() ),
- maPrefMapMode ( rObject.GetPrefMapMode() ),
+ maPrefSize ( xObject->GetPrefSize() ),
+ maPrefMapMode ( xObject->GetPrefMapMode() ),
mbIsEmpty ( sal_True )
{
mbIsNativeGraphicPossible = ( pGraphicAttr == NULL );
@@ -3994,7 +3994,7 @@ EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject
sal_uInt32 nLen = static_cast<sal_uInt32>(rId.getLength());
const sal_Char* pData = rId.getStr();
- GraphicType eType( rObject.GetType() );
+ GraphicType eType( xObject->GetType() );
if ( nLen && pData && ( eType != GRAPHIC_NONE ) )
{
mnIdentifier[ 0 ] = rtl_crc32( 0,pData, nLen );
@@ -4221,9 +4221,9 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
const Rectangle& /* rBoundRect */, const com::sun::star::awt::Rectangle* pVisArea, const GraphicAttr* pGraphicAttr )
{
sal_uInt32 nBlibId = 0;
- GraphicObject aGraphicObject( rId );
+ rtl::Reference< GraphicObject > xGraphicObject = GraphicObject::Create( 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++ )
@@ -4238,7 +4238,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
sal_Bool bUseNativeGraphic( sal_False );
- Graphic aGraphic( aGraphicObject.GetTransformedGraphic( pGraphicAttr ) );
+ Graphic aGraphic( mxGraphicObject->GetTransformedGraphic( pGraphicAttr ) );
GfxLink aGraphicLink;
SvMemoryStream aStream;
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index c7b24da063fa..64ae2d920fdf 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1234,7 +1234,7 @@ void ApplyRectangularGradientAsBitmap( const SvxMSDffManager& rManager, SvStream
}
rSet.Put(XFillBmpTileItem(false));
- rSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmap)));
+ rSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aBitmap))));
}
}
}
@@ -1356,12 +1356,12 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
aGraf = Graphic( aXOBitmap.GetBitmap() );
}
- rSet.Put(XFillBitmapItem(OUString(), aGraf));
+ rSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(aGraf)));
}
else if ( eMSO_FillType == mso_fillTexture )
{
rSet.Put(XFillBmpTileItem(true));
- rSet.Put(XFillBitmapItem(OUString(), aGraf));
+ rSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(aGraf)));
rSet.Put(XFillBmpSizeXItem(GetPropertyValue(DFF_Prop_fillWidth, 0) / 360));
rSet.Put(XFillBmpSizeYItem(GetPropertyValue(DFF_Prop_fillHeight, 0) / 360));
rSet.Put(XFillBmpSizeLogItem(true));
diff --git a/include/drawinglayer/primitive2d/graphicprimitive2d.hxx b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
index 27fa8ffea63d..83de0137e72e 100644
--- a/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
@@ -54,7 +54,7 @@ namespace drawinglayer
basegfx::B2DHomMatrix maTransform;
/// the GraphicObject with all it's content possibilities
- GraphicObject maGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
/// The GraphicAttr with all it's modification possibilities
GraphicAttr maGraphicAttr;
@@ -67,15 +67,15 @@ namespace drawinglayer
/// constructor(s)
GraphicPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
- const GraphicObject& rGraphicObject,
+ const rtl::Reference< GraphicObject >& xGraphicObject,
const GraphicAttr& rGraphicAttr);
GraphicPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
- const GraphicObject& rGraphicObject);
+ const rtl::Reference< GraphicObject >& xGraphicObject);
/// data read access
const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
- const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+ rtl::Reference< GraphicObject > getGraphicObject() const { return mxGraphicObject; }
const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
bool isTransparent() const;
diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx
index d05ee3bf56a8..7897680d75d8 100644
--- a/include/editeng/brushitem.hxx
+++ b/include/editeng/brushitem.hxx
@@ -19,6 +19,7 @@
#ifndef _SVX_BRSHITEM_HXX
#define _SVX_BRSHITEM_HXX
+#include <rtl/ref.hxx>
#include <svl/poolitem.hxx>
#include <vcl/wall.hxx>
#include <tools/link.hxx>
@@ -70,7 +71,7 @@ public:
SvxBrushItem( const Graphic& rGraphic,
SvxGraphicPosition ePos, sal_uInt16 nWhich );
- SvxBrushItem( const GraphicObject& rGraphicObj,
+ SvxBrushItem( const rtl::Reference< GraphicObject >& xGraphicObj,
SvxGraphicPosition ePos, sal_uInt16 nWhich );
SvxBrushItem( const String& rLink, const String& rFilter,
SvxGraphicPosition ePos, sal_uInt16 nWhich );
@@ -107,14 +108,14 @@ public:
sal_uInt32 GetShadingValue() const { return nShadingValue; }
const Graphic* GetGraphic() const;
- const GraphicObject* GetGraphicObject() const;
+ rtl::Reference<GraphicObject> GetGraphicObject() const;
const String* GetGraphicLink() const { return pStrLink; }
const String* GetGraphicFilter() const { return pStrFilter; }
void SetShadingValue( const sal_uInt32 nNew );
void SetGraphicPos( SvxGraphicPosition eNew );
void SetGraphic( const Graphic& rNew );
- void SetGraphicObject( const GraphicObject& rNewObj );
+ void SetGraphicObject( const rtl::Reference< GraphicObject> & xNewObj );
void SetGraphicLink( const String& rNew );
void SetGraphicFilter( const String& rNew );
diff --git a/include/editeng/bulletitem.hxx b/include/editeng/bulletitem.hxx
index deb122f556d4..2fe05a0975a3 100644
--- a/include/editeng/bulletitem.hxx
+++ b/include/editeng/bulletitem.hxx
@@ -62,7 +62,7 @@
class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem
{
Font aFont;
- GraphicObject* pGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
String aPrevText;
String aFollowText;
sal_uInt16 nStart;
@@ -101,8 +101,8 @@ public:
Font GetFont() const { return aFont; }
sal_uInt16 GetScale() const { return nScale; }
- const GraphicObject& GetGraphicObject() const;
- void SetGraphicObject( const GraphicObject& rGraphicObject );
+ rtl::Reference< GraphicObject > GetGraphicObject() const;
+ void SetGraphicObject( const rtl::Reference< GraphicObject > &xGraphicObject );
void SetSymbol( sal_Unicode c) { cSymbol = c; }
void SetPrevText( const String& rStr) { aPrevText = rStr;}
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index c9c0b0bc1a23..d68d107f123a 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -466,15 +466,15 @@ public:
class EDITENG_DLLPUBLIC DrawBulletInfo
{
public:
- const GraphicObject maBulletGraphicObject;
- Point maBulletPosition;
- Size maBulletSize;
+ rtl::Reference< GraphicObject > mxBulletGraphicObject;
+ Point maBulletPosition;
+ Size maBulletSize;
DrawBulletInfo(
- const GraphicObject& rBulletGraphicObject,
+ const rtl::Reference< GraphicObject >& xBulletGraphicObject,
const Point& rBulletPosition,
const Size& rBulletSize)
- : maBulletGraphicObject(rBulletGraphicObject),
+ : mxBulletGraphicObject(xBulletGraphicObject),
maBulletPosition(rBulletPosition),
maBulletSize(rBulletSize)
{}
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index 0523cc24d804..dd43f336cff6 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -20,8 +20,11 @@
#ifndef _GRFMGR_HXX
#define _GRFMGR_HXX
+#include <rtl/ref.hxx>
#include <vcl/graph.hxx>
#include <svtools/svtdllapi.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/graphic/XGraphicObject.hpp>
#define GRFMGR_DRAW_NOTCACHED 0x00000000UL
#define GRFMGR_DRAW_CACHED 0x00000001UL
@@ -154,12 +157,60 @@ public:
friend SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr );
};
-class SVT_DLLPUBLIC GraphicObject : public SvDataCopyStream
+typedef ::cppu::WeakImplHelper1< css::graphic::XGraphicObject > GraphicObject_BASE;
+
+class SVT_DLLPUBLIC GraphicObject : public SvDataCopyStream, public GraphicObject_BASE
{
friend class GraphicManager;
+ sal_uInt32 nRefCount;
+
+public:
+ // XGraphicObject
+ virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getGraphic()
+ throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setGraphic( const css::uno::Reference< css::graphic::XGraphic >& xGraphic )
+ throw (css::uno::RuntimeException);
+ OUString SAL_CALL getUniqueID() throw (css::uno::RuntimeException);
private:
+ explicit GraphicObject( const GraphicManager* pMgr = NULL );
+ GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr );
+ GraphicObject( const GraphicObject& rCacheObj, const GraphicManager* pMgr );
+ GraphicObject& operator=( const GraphicObject& rCacheObj );
+
+ explicit GraphicObject( const OString& rUniqueID, const GraphicManager* pMgr );
+
+public: // only for internal access:
+ GraphicObject( css::uno::Sequence< css::uno::Any > const & args,
+ css::uno::Reference< css::uno::XComponentContext > const & xComponentContext )
+ throw( css::uno::RuntimeException );
+ virtual ~GraphicObject();
+
+ static rtl::Reference< GraphicObject > Create( const GraphicManager* pMgr = NULL )
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject( pMgr ) );
+ }
+ static rtl::Reference< GraphicObject > Create( const Graphic& rGraphic, const GraphicManager* pMgr = NULL )
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject( rGraphic, pMgr ) );
+ }
+ static rtl::Reference< GraphicObject > Create( const GraphicObject& rCacheObj, const GraphicManager* pMgr = NULL )
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject( rCacheObj, pMgr ) );
+ }
+ static rtl::Reference< GraphicObject > Create( const rtl::Reference< GraphicObject > &xCacheObj, const GraphicManager* pMgr = NULL )
+ {
+ if( xCacheObj.is() )
+ return rtl::Reference< GraphicObject >( new GraphicObject( *xCacheObj.get(), pMgr ) );
+ else
+ return rtl::Reference< GraphicObject >();
+ }
+ static rtl::Reference< GraphicObject > Create( const OString& rUniqueID, const GraphicManager* pMgr = NULL )
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject( rUniqueID, pMgr ) );
+ }
+private:
static GraphicManager* mpGlobalMgr;
Graphic maGraphic;
@@ -188,7 +239,8 @@ private:
void SVT_DLLPRIVATE ImplSetGraphicManager(
const GraphicManager* pMgr,
const OString* pID = NULL,
- const GraphicObject* pCopyObj = NULL
+ const rtl::Reference< GraphicObject > &xCopyObj =
+ rtl::Reference< GraphicObject > () );
);
void SVT_DLLPRIVATE ImplAutoSwapIn();
sal_Bool SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; }
@@ -309,16 +361,8 @@ protected:
virtual void Assign( const SvDataCopyStream& );
public:
-
TYPEINFO();
- GraphicObject( const GraphicManager* pMgr = NULL );
- GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr = NULL );
- GraphicObject( const GraphicObject& rCacheObj, const GraphicManager* pMgr = NULL );
- explicit GraphicObject( const OString& rUniqueID, const GraphicManager* pMgr = NULL );
- ~GraphicObject();
-
- GraphicObject& operator=( const GraphicObject& rCacheObj );
sal_Bool operator==( const GraphicObject& rCacheObj ) const;
sal_Bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); }
@@ -342,7 +386,7 @@ public:
void ReleaseFromCache();
const Graphic& GetGraphic() const;
- void SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0);
+ void SetGraphic( const Graphic& rGraphic, const rtl::Reference< GraphicObject >& pCopyObj = rtl::Reference< GraphicObject >() );
void SetGraphic( const Graphic& rGraphic, const String& rLink );
/** Get graphic transformed according to given attributes
@@ -487,7 +531,7 @@ public:
friend SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj );
friend SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj );
- static GraphicObject CreateGraphicObjectFromURL( const OUString &rURL );
+ static rtl::Reference< GraphicObject > CreateGraphicObjectFromURL( const OUString &rURL );
// will inspect an object ( e.g. a control ) for any 'ImageURL'
// properties and return these in a vector. Note: this implementation
// will cater for XNameContainer objects and deepinspect any containees
@@ -580,7 +624,8 @@ private:
const GraphicObject& rObj,
Graphic& rSubstitute,
const OString* pID = NULL,
- const GraphicObject* pCopyObj = NULL
+ const rtl::Reference< GraphicObject > &xCopyObj =
+ rtl::Reference< GraphicObject > ()
);
void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj );
inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); }
diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx
index 31810169a2d4..5851b52cee6c 100644
--- a/include/svx/galctrl.hxx
+++ b/include/svx/galctrl.hxx
@@ -44,9 +44,9 @@ class SVX_DLLPUBLIC GalleryPreview : public Window, public DropTargetHelper, pub
{
private:
- GraphicObject aGraphicObj;
- Rectangle aPreviewRect;
- GalleryTheme* mpTheme;
+ rtl::Reference< GraphicObject > mxGraphicObj;
+ Rectangle maPreviewRect;
+ GalleryTheme* mpTheme;
SVX_DLLPRIVATE sal_Bool ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const;
SVX_DLLPRIVATE void InitSettings();
@@ -74,7 +74,7 @@ public:
GalleryPreview( Window* pParent, const ResId& rResId );
~GalleryPreview();
- void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
+ void SetGraphic( const Graphic& rGraphic ) { mxGraphicObj->SetGraphic( rGraphic ); }
bool SetGraphic( const INetURLObject& );
void PreviewMedia( const INetURLObject& rURL );
};
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
index 16f84cbe907b..b4eca27b4e67 100644
--- a/include/svx/galmisc.hxx
+++ b/include/svx/galmisc.hxx
@@ -20,6 +20,7 @@
#ifndef _SVX_GALMISC_HXX_
#define _SVX_GALMISC_HXX_
+#include <rtl/ref.hxx>
#include <sot/storage.hxx>
#include <tools/urlobj.hxx>
#include <svtools/imap.hxx>
@@ -160,7 +161,7 @@ private:
SgaObjKind meObjectKind;
sal_uInt32 mnObjectPos;
SotStorageStreamRef mxModelStream;
- GraphicObject* mpGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
ImageMap* mpImageMap;
INetURLObject* mpURL;
diff --git a/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx
index 720048f5b63f..515450734693 100644
--- a/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx
+++ b/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx
@@ -39,7 +39,7 @@ namespace drawinglayer
private:
::basegfx::B2DHomMatrix maTransform;
attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
- GraphicObject maGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
GraphicAttr maGraphicAttr;
protected:
@@ -50,13 +50,13 @@ namespace drawinglayer
SdrGrafPrimitive2D(
const ::basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
- const GraphicObject& rGraphicObject,
+ const rtl::Reference< GraphicObject >& xGraphicObject,
const GraphicAttr& rGraphicAttr);
// data access
const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
- const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+ rtl::Reference< GraphicObject > getGraphicObject() const { return mxGraphicObject; }
const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
bool isTransparent() const;
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index c97ba69a6f08..49a5824b526d 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -80,8 +80,8 @@ private:
OUString aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
OUString aFilterName;
- GraphicObject* pGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
- GraphicObject* mpReplacementGraphic;
+ rtl::Reference< GraphicObject> mxGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
+ rtl::Reference< GraphicObject> mxReplacementGraphic;
SdrGraphicLink* pGraphicLink; // Und hier noch ein Pointer fuer gelinkte Grafiken
bool bMirrored:1; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben.
@@ -110,9 +110,9 @@ public:
SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect);
virtual ~SdrGrafObj();
- void SetGraphicObject( const GraphicObject& rGrfObj );
- const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
- const GraphicObject* GetReplacementGraphicObject() const;
+ void SetGraphicObject( const rtl::Reference< GraphicObject > & xGrfObj );
+ rtl::Reference< GraphicObject > GetGraphicObject(bool bForceSwapIn = false) const;
+ rtl::Reference< GraphicObject > GetReplacementGraphicObject() const;
void NbcSetGraphic(const Graphic& rGrf);
void SetGraphic(const Graphic& rGrf);
diff --git a/include/svx/xbitmap.hxx b/include/svx/xbitmap.hxx
index 959ceafdbd72..deec23785e09 100644
--- a/include/svx/xbitmap.hxx
+++ b/include/svx/xbitmap.hxx
@@ -30,14 +30,14 @@ class SVX_DLLPUBLIC XOBitmap
{
private:
XBitmapType eType;
- GraphicObject aGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
sal_uInt16* pPixelArray;
Size aArraySize;
Color aPixelColor;
Color aBckgrColor;
sal_Bool bGraphicDirty;
- const GraphicObject& GetGraphicObject() const;
+ rtl::Reference< GraphicObject > GetGraphicObject() const;
public:
XOBitmap( const Bitmap& rBitmap );
diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx
index d30e2fd5001f..a0e655e46c1f 100644
--- a/include/svx/xbtmpit.hxx
+++ b/include/svx/xbtmpit.hxx
@@ -39,13 +39,13 @@ bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBa
class SVX_DLLPUBLIC XFillBitmapItem : public NameOrIndex
{
private:
- GraphicObject maGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
public:
TYPEINFO();
- XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) {}
- XFillBitmapItem(const String& rName, const GraphicObject& rGraphicObject);
- XFillBitmapItem(SfxItemPool* pPool, const GraphicObject& rGraphicObject);
+ XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) { mxGraphicObject = GraphicObject::Create(); }
+ XFillBitmapItem(const String& rName, const rtl::Reference< GraphicObject > & xGraphicObject);
+ XFillBitmapItem(SfxItemPool* pPool, const rtl::Reference< GraphicObject > & xGraphicObject);
XFillBitmapItem( const XFillBitmapItem& rItem );
XFillBitmapItem( SvStream& rIn, sal_uInt16 nVer = 0 );
@@ -63,8 +63,8 @@ public:
SfxMapUnit ePresMetric,
OUString &rText, const IntlWrapper * = 0 ) const;
- const GraphicObject& GetGraphicObject() const;
- void SetGraphicObject(const GraphicObject& rGraphicObject);
+ rtl::Reference< GraphicObject > GetGraphicObject() const;
+ void SetGraphicObject(const rtl::Reference< GraphicObject >& xGraphicObject);
static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
XFillBitmapItem* checkForUniqueItem( SdrModel* pModel ) const;
diff --git a/include/svx/xmlgrhlp.hxx b/include/svx/xmlgrhlp.hxx
index d14c9dc5cd23..9a309850a4d9 100644
--- a/include/svx/xmlgrhlp.hxx
+++ b/include/svx/xmlgrhlp.hxx
@@ -57,7 +57,7 @@ private:
typedef ::std::pair< OUString, OUString > URLPair;
typedef ::std::vector< URLPair > URLPairVector;
- typedef ::std::vector< GraphicObject > GraphicObjectVector;
+ typedef ::std::vector< rtl::Reference< GraphicObject > > GraphicObjectVector;
typedef ::std::set< OUString > URLSet;
typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > > GraphicOutputStreamVector;
diff --git a/include/svx/xtable.hxx b/include/svx/xtable.hxx
index 194547acbdd9..961df6434836 100644
--- a/include/svx/xtable.hxx
+++ b/include/svx/xtable.hxx
@@ -153,15 +153,15 @@ public:
class SVX_DLLPUBLIC XBitmapEntry : public XPropertyEntry
{
private:
- GraphicObject maGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
public:
- XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName);
+ XBitmapEntry(const rtl::Reference< GraphicObject >& xGraphicObject, const String& rName);
XBitmapEntry(const XBitmapEntry& rOther);
- const GraphicObject& GetGraphicObject() const
+ rtl::Reference< GraphicObject > GetGraphicObject() const
{
- return maGraphicObject;
+ return mxGraphicObject;
}
};
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index 89456ecae3d0..5d9a2e83dbbc 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -151,7 +151,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/filter/exportdialog \
svtools/source/graphic/descriptor \
svtools/source/graphic/graphic \
- svtools/source/graphic/graphicunofactory \
svtools/source/graphic/grfattr \
svtools/source/graphic/grfcache \
svtools/source/graphic/grfmgr \
diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx
deleted file mode 100644
index b7fffe7645ec..000000000000
--- a/svtools/source/graphic/graphicunofactory.cxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <comphelper/servicedecl.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/graphic/XGraphicObject.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <svtools/grfmgr.hxx>
-
-using namespace com::sun::star;
-
-namespace unographic {
-
-typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE;
- // Simple uno wrapper around the GraphicObject class to allow basic
- // access. ( and solves a horrible cyclic link problem between
- // goodies/toolkit/extensions )
-class GObjectImpl : public GObjectAccess_BASE
-{
- ::osl::Mutex m_aMutex;
- std::auto_ptr< GraphicObject > mpGObject;
-public:
- GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException);
-
- // XGraphicObject
- virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException);
- virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException);
- OUString SAL_CALL getUniqueID() throw (uno::RuntimeException);
-};
-
-GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & /*xComponentContext*/ ) throw (uno::RuntimeException)
-{
- if ( args.getLength() == 1 )
- {
- OUString sId;
- if ( !( args[ 0 ] >>= sId ) || sId.isEmpty() )
- throw lang::IllegalArgumentException();
- OString bsId(OUStringToOString(sId, RTL_TEXTENCODING_UTF8));
- mpGObject.reset( new GraphicObject( bsId ) );
- }
- else
- mpGObject.reset( new GraphicObject() );
-}
-
-uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !mpGObject.get() )
- throw uno::RuntimeException();
- return mpGObject->GetGraphic().GetXGraphic();
-}
-
-void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !mpGObject.get() )
- throw uno::RuntimeException();
- Graphic aGraphic( _graphic );
- mpGObject->SetGraphic( aGraphic );
-}
-
-OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- OUString sId;
- if ( mpGObject.get() )
- sId = OStringToOUString(mpGObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
- return sId;
-}
-
-
-namespace sdecl = comphelper::service_decl;
-sdecl::class_<GObjectImpl, sdecl::with_args<true> > serviceBI;
-extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObject", "com.sun.star.graphic.GraphicObject" );
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 6577c0ef1d89..076e1e3bbcb2 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -35,6 +35,8 @@
#include <vcl/pdfextoutdevdata.hxx>
+#include <comphelper/servicedecl.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -42,6 +44,7 @@ using com::sun::star::uno::Reference;
using com::sun::star::uno::XInterface;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Sequence;
+using com::sun::star::uno::RuntimeException;
using com::sun::star::container::XNameContainer;
using com::sun::star::beans::XPropertySet;
@@ -52,8 +55,8 @@ struct GrfSimpleCacheObj
Graphic maGraphic;
GraphicAttr maAttr;
- GrfSimpleCacheObj( const Graphic& rGraphic, const GraphicAttr& rAttr ) :
- maGraphic( rGraphic ), maAttr( rAttr ) {}
+ GrfSimpleCacheObj( const Graphic& rGraphic, const GraphicAttr& rAttr ) :
+ maGraphic( rGraphic ), maAttr( rAttr ) {}
};
TYPEINIT1_AUTOFACTORY( GraphicObject, SvDataCopyStream );
@@ -104,6 +107,52 @@ GraphicObject::GraphicObject( const OString& rUniqueID, const GraphicManager* pM
ImplAssignGraphicData();
}
+GraphicObject::GraphicObject( css::uno::Sequence< css::uno::Any > const & args,
+ css::uno::Reference< css::uno::XComponentContext > const & )
+ throw( RuntimeException ) :
+ mpLink ( NULL ),
+ mpUserData ( NULL )
+{
+ ImplConstruct();
+ ImplAssignGraphicData();
+
+ if ( args.getLength() == 1 )
+ {
+ OUString sId;
+ if ( !( args[ 0 ] >>= sId ) || sId.isEmpty() )
+ throw css::lang::IllegalArgumentException();
+
+ OString bsId ( OUStringToOString ( sId, RTL_TEXTENCODING_UTF8 ) );
+ ImplSetGraphicManager( NULL, &bsId );
+ }
+ else
+ ImplSetGraphicManager( NULL );
+}
+
+css::uno::Reference< css::graphic::XGraphic > SAL_CALL GraphicObject::getGraphic()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aSolarGuard;
+ return GetGraphic().GetXGraphic();
+}
+
+void SAL_CALL GraphicObject::setGraphic( const css::uno::Reference< css::graphic::XGraphic >& xGraphic )
+ throw( RuntimeException )
+{
+ SolarMutexGuard aSolarGuard;
+
+ Graphic aGraphic( xGraphic );
+ SetGraphic( aGraphic );
+}
+
+OUString SAL_CALL GraphicObject::getUniqueID()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aSolarGuard;
+
+ return OStringToOUString(GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+}
+
GraphicObject::~GraphicObject()
{
if( mpMgr )
@@ -146,7 +195,7 @@ void GraphicObject::ImplAssignGraphicData()
mnAnimationLoopCount = ( mbAnimated ? maGraphic.GetAnimationLoopCount() : 0 );
}
-void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const OString* pID, const GraphicObject* pCopyObj )
+void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const OString* pID, const rtl::Reference< GraphicObject > &xCopyObj )
{
if( !mpMgr || ( pMgr != mpMgr ) )
{
@@ -181,7 +230,7 @@ void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const OSt
else
mpMgr = (GraphicManager*) pMgr;
- mpMgr->ImplRegisterObj( *this, maGraphic, pID, pCopyObj );
+ mpMgr->ImplRegisterObj( *this, maGraphic, pID, xCopyObj );
}
}
}
@@ -319,6 +368,9 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size&
GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj )
{
+ // FIXME: mmeeks this operator should be removed [!] ...
+ assert(false);
+
if( &rGraphicObj != this )
{
mpMgr->ImplUnregisterObj( *this );
@@ -336,7 +388,8 @@ GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj )
mbAutoSwapped = sal_False;
mpMgr = rGraphicObj.mpMgr;
- mpMgr->ImplRegisterObj( *this, maGraphic, NULL, &rGraphicObj );
+ mpMgr->ImplRegisterObj( *this, maGraphic, NULL,
+ GraphicObject::Create( &rGraphicObj ) );
}
return *this;
@@ -734,7 +787,7 @@ const Graphic& GraphicObject::GetGraphic() const
return maGraphic;
}
-void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj )
+void GraphicObject::SetGraphic( const Graphic& rGraphic, const rtl::Reference< GraphicObject > &xCopyObj )
{
mpMgr->ImplUnregisterObj( *this );
@@ -747,7 +800,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pC
delete mpLink, mpLink = NULL;
delete mpSimpleCache, mpSimpleCache = NULL;
- mpMgr->ImplRegisterObj( *this, maGraphic, 0, pCopyObj);
+ mpMgr->ImplRegisterObj( *this, maGraphic, 0, xCopyObj);
if( mpSwapOutTimer )
mpSwapOutTimer->Start();
@@ -964,8 +1017,8 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo
aTransGraphic.SetPrefMapMode( rDestMap );
}
- GraphicObject aGrfObj( aTransGraphic );
- aTransGraphic = aGrfObj.GetTransformedGraphic( &rAttr );
+ rtl::Reference< GraphicObject > xGrfObj = GraphicObject::Create( aTransGraphic );
+ aTransGraphic = xGrfObj->GetTransformedGraphic( &rAttr );
return aTransGraphic;
}
@@ -1149,14 +1202,14 @@ SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj )
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-GraphicObject GraphicObject::CreateGraphicObjectFromURL( const OUString &rURL )
+rtl::Reference< GraphicObject > GraphicObject::CreateGraphicObjectFromURL( const OUString &rURL )
{
const String aURL( rURL ), aPrefix( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX) );
if( aURL.Search( aPrefix ) == 0 )
{
// graphic manager url
OString aUniqueID(OUStringToOString(rURL.copy(sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX) - 1), RTL_TEXTENCODING_UTF8));
- return GraphicObject( aUniqueID );
+ return GraphicObject::Create( aUniqueID );
}
else
{
@@ -1168,7 +1221,7 @@ GraphicObject GraphicObject::CreateGraphicObjectFromURL( const OUString &rURL )
GraphicConverter::Import( *pStream, aGraphic );
}
- return GraphicObject( aGraphic );
+ return GraphicObject::Create( aGraphic );
}
}
@@ -1242,4 +1295,12 @@ basegfx::B2DVector GraphicObject::calculateCropScaling(
return basegfx::B2DVector(fFactorX,fFactorY);
}
+namespace unographic {
+ namespace sdecl = comphelper::service_decl;
+ sdecl::class_<GraphicObject, sdecl::with_args<true> > serviceBI;
+ extern sdecl::ServiceDecl const serviceDecl( serviceBI,
+ "com.sun.star.graphic.GraphicObject",
+ "com.sun.star.graphic.GraphicObject" );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 45c368612b2c..5e5a5eae9cf2 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -1653,7 +1653,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
sal_uLong nFlags, ImplTileInfo& rTileInfo )
{
// gets loaded with our tile bitmap
- GraphicObject aTmpGraphic;
+ rtl::Reference< GraphicObject > xTmpGraphic;
// stores a flag that renders the zero'th tile position
// (i.e. (0,0)+rCurrPos) only if we're at the bottom of the
@@ -1677,7 +1677,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
// check for recursion's end condition: LSB place reached?
if( nMSBFactor == 1 )
{
- aTmpGraphic = *this;
+ xTmpGraphic = rtl::Reference< GraphicObject >( this );
// set initial tile size -> orig size
aTileInfo.aTileSizePixel = rTileSizePixel;
@@ -1692,7 +1692,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
// extract generated tile -> see comment on the first loop below
BitmapEx aTileBitmap( rVDev.GetBitmap( aTileInfo.aTileTopLeft, aTileInfo.aTileSizePixel ) );
- aTmpGraphic = GraphicObject( aTileBitmap );
+ xTmpGraphic = GraphicObject::Create( aTileBitmap );
// fill stripes left over from upstream levels:
//
@@ -1719,7 +1719,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
aCurrPos.Y() = aTileInfo.aTileTopLeft.Y();
for( nX=0; nX < aTileInfo.nTilesEmptyX; nX += nMSBFactor )
{
- if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ if( !xTmpGraphic->Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
return false;
aCurrPos.X() += aTileInfo.aTileSizePixel.Width();
@@ -1740,7 +1740,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
aCurrPos.Y() = aTileInfo.aNextTileTopLeft.Y();
for( nY=0; nY < aTileInfo.nTilesEmptyY; nY += nMSBFactor )
{
- if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ if( !xTmpGraphic->Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
return false;
aCurrPos.Y() += aTileInfo.aTileSizePixel.Height();
@@ -1800,7 +1800,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
{
if( bNoFirstTileDraw )
bNoFirstTileDraw = false; // don't draw first tile position
- else if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ else if( !xTmpGraphic->Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
return false;
aCurrPos.X() += aTileInfo.aTileSizePixel.Width();
@@ -1879,10 +1879,10 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c
}
// paint generated tile
- GraphicObject aTmpGraphic( aTileBitmap );
- bRet = aTmpGraphic.ImplDrawTiled( pOut, rArea,
- aTileBitmap.GetSizePixel(),
- rOffset, pAttr, nFlags, nTileCacheSize1D );
+ rtl::Reference< GraphicObject > xTmpGraphic = GraphicObject::Create( aTileBitmap );
+ bRet = xTmpGraphic->ImplDrawTiled( pOut, rArea,
+ aTileBitmap.GetSizePixel(),
+ rOffset, pAttr, nFlags, nTileCacheSize1D );
}
}
else
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 9bc54b915211..d247f784f104 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -147,18 +147,19 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId()
uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadGraphicObject( const OUString& rResourceURL ) const
{
- uno::Reference< ::graphic::XGraphic > xRet;
+ uno::Reference< ::graphic::XGraphic > xRet;
if( rResourceURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
{
// graphic manager url
String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) );
OString aUniqueID(OUStringToOString(aTmpStr,
RTL_TEXTENCODING_UTF8));
- GraphicObject aGrafObj(aUniqueID);
+
+ rtl::Reference< GraphicObject > xGrafObj = GraphicObject::Create( aUniqueID );
// I don't call aGrafObj.GetXGraphic because it will call us back
// into implLoadMemory ( with "private:memorygraphic" test )
::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
- pUnoGraphic->init( aGrafObj.GetGraphic() );
+ pUnoGraphic->init( xGrafObj->GetGraphic() );
xRet = pUnoGraphic;
}
return xRet;
diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx
index 95097fbe7bd1..cfd07b003a52 100644
--- a/svtools/source/graphic/renderer.cxx
+++ b/svtools/source/graphic/renderer.cxx
@@ -319,10 +319,7 @@ void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphi
const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace );
if( pGraphic )
- {
- GraphicObject aGraphicObject( *pGraphic );
- aGraphicObject.Draw( mpOutDev, maDestRect.TopLeft(), maDestRect.GetSize() );
- }
+ GraphicObject::Create( *pGraphic )->Draw( mpOutDev, maDestRect.TopLeft(), maDestRect.GetSize() );
}
}
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index c6bc3971ec7f..f4512946e96d 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2191,13 +2191,14 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC
{
if ( nColorCount || rObj.GetBrightness() != 1.0 )
{
- Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap());
+ Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetGraphicObject()->GetGraphic().GetBitmapEx().GetBitmap());
aBitmap.Adjust(
static_cast< short > ( GetLuminanceChange(
std::min(nColorIndex, nColorCount-1))));
- rObj.SetMergedItem(XFillBitmapItem(String(), Graphic(aBitmap)));
+ rObj.SetMergedItem(XFillBitmapItem(
+ String(), GraphicObject::Create(Graphic(aBitmap))));
}
break;
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 010b037e7df5..f2d812ea7b8d 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -495,7 +495,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
if ( bFillBmpTile )
{
const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
- aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
+ aFillBmp = rBmpItm.GetGraphicObject()->GetGraphic().GetBitmapEx();
Size aLogicalSize = aFillBmp.GetPrefSize();
if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL )
aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM );
@@ -505,14 +505,14 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
aLogicalSize.Height() *= 5;
aFillBmp.SetPrefSize( aLogicalSize );
aFillBmp.SetPrefMapMode( MAP_100TH_MM );
- p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
+ p3DObj->SetMergedItem(XFillBitmapItem(String(), GraphicObject::Create(Graphic(aFillBmp))));
}
else
{
if ( aSnapRect != aBoundRect )
{
const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
- aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
+ aFillBmp = rBmpItm.GetGraphicObject()->GetGraphic().GetBitmapEx();
Size aBmpSize( aFillBmp.GetSizePixel() );
double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth();
double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight();
@@ -523,7 +523,8 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
(sal_Int32)( aBmpSize.Height() * fYScale ) );
Rectangle aCropRect( aPt, aSize );
aFillBmp.Crop( aCropRect );
- p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
+ p3DObj->SetMergedItem(XFillBitmapItem(String(),
+ GraphicObject::Create(Graphic(aFillBmp))));
}
}
pScene->Insert3DObj( p3DObj );
@@ -546,7 +547,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
if ( ( aLocalFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
{
- p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
+ p3DObj->SetMergedItem(XFillBitmapItem(String(), GraphicObject::Create(Graphic(aFillBmp))));
}
}
else if ( aLocalFillStyle == XFILL_NONE )
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index efc480ad4d1c..5320d685f0a6 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -41,7 +41,7 @@ using namespace com::sun::star::beans;
CompressGraphicsDialog::CompressGraphicsDialog( Window* pParent, SdrGrafObj* pGraphicObj, SfxBindings& rBindings ) :
ModalDialog ( pParent, "CompressGraphicDialog", "svx/ui/compressgraphicdialog.ui" ),
m_pGraphicObj ( pGraphicObj ),
- m_aGraphic ( pGraphicObj->GetGraphicObject().GetGraphic() ),
+ m_aGraphic ( pGraphicObj->GetGraphicObject()->GetGraphic() ),
m_aViewSize100mm ( pGraphicObj->GetLogicRect().GetSize() ),
m_rBindings ( rBindings ),
m_dResolution ( 96.0 )
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 76ba1b741635..2a5ab7eeddd7 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1366,7 +1366,7 @@ void BitmapLB::Fill( const XBitmapListRef &pList )
for(long i(0); i < nCount; i++)
{
pEntry = pList->GetBitmap(i);
- maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
+ maBitmapEx = pEntry->GetGraphicObject()->GetGraphic().GetBitmapEx();
formatBitmapExToSize(maBitmapEx, aSize);
InsertEntry(pEntry->GetName(), maBitmapEx);
}
@@ -1379,7 +1379,7 @@ void BitmapLB::Fill( const XBitmapListRef &pList )
void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry)
{
- maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx();
+ maBitmapEx = rEntry.GetGraphicObject()->GetGraphic().GetBitmapEx();
if(!maBitmapEx.IsEmpty())
{
@@ -1399,7 +1399,7 @@ void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry)
void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos)
{
RemoveEntry(nPos);
- maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx();
+ maBitmapEx = rEntry.GetGraphicObject()->GetGraphic().GetBitmapEx();
if(!maBitmapEx.IsEmpty())
{
@@ -1431,7 +1431,7 @@ void FillAttrLB::Fill( const XBitmapListRef &pList )
for(long i(0); i < nCount; i++)
{
pEntry = pList->GetBitmap( i );
- maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
+ maBitmapEx = pEntry->GetGraphicObject()->GetGraphic().GetBitmapEx();
formatBitmapExToSize(maBitmapEx, aSize);
ListBox::InsertEntry(pEntry->GetName(), maBitmapEx);
}
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index a96a34e02661..8aa10e90bb32 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -49,6 +49,7 @@ GalleryPreview::GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme )
SetHelpId( HID_GALLERY_WINDOW );
InitSettings();
+ mxGraphicObj = GraphicObject::Create();
}
GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) :
@@ -61,6 +62,7 @@ GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) :
SetHelpId( HID_GALLERY_PREVIEW );
InitSettings();
+ mxGraphicObj = GraphicObject::Create();
}
GalleryPreview::~GalleryPreview()
@@ -142,15 +144,15 @@ void GalleryPreview::Paint( const Rectangle& rRect )
{
Window::Paint( rRect );
- if( ImplGetGraphicCenterRect( aGraphicObj.GetGraphic(), aPreviewRect ) )
+ if( ImplGetGraphicCenterRect( mxGraphicObj->GetGraphic(), maPreviewRect ) )
{
- const Point aPos( aPreviewRect.TopLeft() );
- const Size aSize( aPreviewRect.GetSize() );
+ const Point aPos( maPreviewRect.TopLeft() );
+ const Size aSize( maPreviewRect.GetSize() );
- if( aGraphicObj.IsAnimated() )
- aGraphicObj.StartAnimation( this, aPos, aSize );
+ if( mxGraphicObj->IsAnimated() )
+ mxGraphicObj->StartAnimation( this, aPos, aSize );
else
- aGraphicObj.Draw( this, aPos, aSize );
+ mxGraphicObj->Draw( this, aPos, aSize );
}
}
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index 692a67027002..5c64360dfaca 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -447,7 +447,6 @@ GalleryTransferable::GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObj
mpTheme( pTheme ),
meObjectKind( mpTheme->GetObjectKind( nObjectPos ) ),
mnObjectPos( nObjectPos ),
- mpGraphicObject( NULL ),
mpImageMap( NULL ),
mpURL( NULL )
{
@@ -473,12 +472,12 @@ void GalleryTransferable::InitData( bool bLazy )
{
if( !bLazy )
{
- if( !mpGraphicObject )
+ if( !mxGraphicObject.is() )
{
Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
- mpGraphicObject = new GraphicObject( aGraphic );
+ mxGraphicObject = GraphicObject::Create( aGraphic );
}
if( !mxModelStream.Is() )
@@ -508,12 +507,12 @@ void GalleryTransferable::InitData( bool bLazy )
delete mpURL, mpURL = NULL;
}
- if( ( SGA_OBJ_SOUND != meObjectKind ) && !mpGraphicObject )
+ if( ( SGA_OBJ_SOUND != meObjectKind ) && !mxGraphicObject.is() )
{
Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
- mpGraphicObject = new GraphicObject( aGraphic );
+ mxGraphicObject = GraphicObject::Create( aGraphic );
}
}
break;
@@ -540,11 +539,11 @@ void GalleryTransferable::AddSupportedFormats()
if( mpURL )
AddFormat( FORMAT_FILE );
- if( mpGraphicObject )
+ if( mxGraphicObject.is() )
{
AddFormat( SOT_FORMATSTR_ID_SVXB );
- if( mpGraphicObject->GetType() == GRAPHIC_GDIMETAFILE )
+ if( mxGraphicObject->GetType() == GRAPHIC_GDIMETAFILE )
{
AddFormat( FORMAT_GDIMETAFILE );
AddFormat( FORMAT_BITMAP );
@@ -580,17 +579,17 @@ sal_Bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor )
{
bRet = SetString( mpURL->GetMainURL( INetURLObject::NO_DECODE ), rFlavor );
}
- else if( ( SOT_FORMATSTR_ID_SVXB == nFormat ) && mpGraphicObject )
+ else if( ( SOT_FORMATSTR_ID_SVXB == nFormat ) && mxGraphicObject.is() )
{
- bRet = SetGraphic( mpGraphicObject->GetGraphic(), rFlavor );
+ bRet = SetGraphic( mxGraphicObject->GetGraphic(), rFlavor );
}
- else if( ( FORMAT_GDIMETAFILE == nFormat ) && mpGraphicObject )
+ else if( ( FORMAT_GDIMETAFILE == nFormat ) && mxGraphicObject.is() )
{
- bRet = SetGDIMetaFile( mpGraphicObject->GetGraphic().GetGDIMetaFile(), rFlavor );
+ bRet = SetGDIMetaFile( mxGraphicObject->GetGraphic().GetGDIMetaFile(), rFlavor );
}
- else if( ( FORMAT_BITMAP == nFormat ) && mpGraphicObject )
+ else if( ( FORMAT_BITMAP == nFormat ) && mxGraphicObject.is() )
{
- bRet = SetBitmapEx( mpGraphicObject->GetGraphic().GetBitmapEx(), rFlavor );
+ bRet = SetBitmapEx( mxGraphicObject->GetGraphic().GetBitmapEx(), rFlavor );
}
return bRet;
@@ -631,7 +630,7 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction )
void GalleryTransferable::ObjectReleased()
{
mxModelStream.Clear();
- delete mpGraphicObject, mpGraphicObject = NULL;
+ mxGraphicObject.clear();
delete mpImageMap, mpImageMap = NULL;
delete mpURL, mpURL = NULL;
}
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 05e709db15ba..03434b82eed5 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -87,14 +87,14 @@ namespace sdr
const GraphicAttr& rLocalGrafInfo) const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- GraphicObject aEmptyGraphicObject;
+ rtl::Reference< GraphicObject > xEmptyGraphicObject = GraphicObject::Create();
GraphicAttr aEmptyGraphicAttr;
// SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
rObjectMatrix,
rAttribute,
- aEmptyGraphicObject,
+ xEmptyGraphicObject,
aEmptyGraphicAttr));
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
@@ -132,11 +132,11 @@ namespace sdr
aSmallerMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate)
* aSmallerMatrix;
- const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ rtl::Reference< GraphicObject > xGraphicObject = GetGrafObject().GetGraphicObject(false);
const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
aSmallerMatrix,
drawinglayer::attribute::SdrLineFillShadowTextAttribute(),
- rGraphicObject,
+ xGraphicObject,
rLocalGrafInfo));
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB);
@@ -150,14 +150,14 @@ namespace sdr
const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- GraphicObject aEmptyGraphicObject;
+ rtl::Reference< GraphicObject > xEmptyGraphicObject = GraphicObject::Create();
GraphicAttr aEmptyGraphicAttr;
// SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
rObjectMatrix,
rAttribute,
- aEmptyGraphicObject,
+ xEmptyGraphicObject,
aEmptyGraphicAttr));
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
@@ -367,7 +367,7 @@ namespace sdr
aObjectRange.getMinX(), aObjectRange.getMinY()));
// get the current, unchenged graphic obect from SdrGrafObj
- const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ rtl::Reference< GraphicObject > xGraphicObject = GetGrafObject().GetGraphicObject(false);
if(visualisationUsesPresObj())
{
@@ -392,7 +392,7 @@ namespace sdr
new drawinglayer::primitive2d::SdrGrafPrimitive2D(
aObjectMatrix,
aAttribute,
- rGraphicObject,
+ xGraphicObject,
aLocalGrafInfo));
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
@@ -418,14 +418,14 @@ namespace sdr
return false;
// draft when swapped out
- const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ rtl::Reference< GraphicObject > xGraphicObject = GetGrafObject().GetGraphicObject(false);
static bool bAllowReplacements(true);
- if(rGraphicObject.IsSwappedOut() && bAllowReplacements)
+ if(xGraphicObject->IsSwappedOut() && bAllowReplacements)
return true;
// draft when no graphic
- if(GRAPHIC_NONE == rGraphicObject.GetType() || GRAPHIC_DEFAULT == rGraphicObject.GetType())
+ if(GRAPHIC_NONE == xGraphicObject->GetType() || GRAPHIC_DEFAULT == xGraphicObject->GetType())
return true;
return false;
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index fcfba853bdf4..9adbf2af2f0f 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -612,7 +612,7 @@ namespace drawinglayer
attribute::SdrFillGraphicAttribute createNewSdrFillGraphicAttribute(const SfxItemSet& rSet)
{
- Graphic aGraphic(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject().GetGraphic());
+ Graphic aGraphic(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject()->GetGraphic());
if(!(GRAPHIC_BITMAP == aGraphic.GetType() || GRAPHIC_GDIMETAFILE == aGraphic.GetType()))
{
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
index 44ed09dd7fd9..d6cdd21093a1 100644
--- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -127,12 +127,12 @@ namespace drawinglayer
SdrGrafPrimitive2D::SdrGrafPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
- const GraphicObject& rGraphicObject,
+ const rtl::Reference< GraphicObject > &xGraphicObject,
const GraphicAttr& rGraphicAttr)
: BufferedDecompositionPrimitive2D(),
maTransform(rTransform),
maSdrLFSTAttribute(rSdrLFSTAttribute),
- maGraphicObject(rGraphicObject),
+ mxGraphicObject(xGraphicObject),
maGraphicAttr(rGraphicAttr)
{
// reset some values from GraphicAttr which are part of transformation already
@@ -157,7 +157,7 @@ namespace drawinglayer
bool SdrGrafPrimitive2D::isTransparent() const
{
return ((0L != getGraphicAttr().GetTransparency())
- || (getGraphicObject().IsTransparent()));
+ || (getGraphicObject()->IsTransparent()));
}
// provide unique ID
diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
index 4e141844cc67..b512c6ff0cb0 100644
--- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
@@ -61,7 +61,7 @@ namespace drawinglayer
#endif
if(GRAPHIC_NONE != aGraphic.GetType())
{
- const GraphicObject aGraphicObject(aGraphic);
+ const rtl::Reference<GraphicObject> xGraphicObject = GraphicObject::Create(aGraphic);
const GraphicAttr aGraphicAttr;
drawinglayer::primitive2d::Primitive2DSequence xOLEContent;
@@ -98,7 +98,7 @@ namespace drawinglayer
const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive(
new drawinglayer::primitive2d::GraphicPrimitive2D(
aInnerObjectMatrix,
- aGraphicObject,
+ xGraphicObject,
aGraphicAttr));
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive);
}
@@ -109,7 +109,7 @@ namespace drawinglayer
const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive(
new drawinglayer::primitive2d::GraphicPrimitive2D(
getObjectTransform(),
- aGraphicObject,
+ xGraphicObject,
aGraphicAttr));
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive);
}
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 2255d58ad9a8..f1c904424365 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -3693,14 +3693,14 @@ bool SdrDragCrop::EndSdrDrag(bool bCopy)
if( !pObj || (pObj->GetGraphicType() == GRAPHIC_NONE) || (pObj->GetGraphicType() == GRAPHIC_DEFAULT) )
return false;
- const GraphicObject& rGraphicObject = pObj->GetGraphicObject();
+ rtl::Reference< GraphicObject> xGraphicObject = pObj->GetGraphicObject();
const MapMode aMapMode100thmm(MAP_100TH_MM);
- Size aGraphicSize(rGraphicObject.GetPrefSize());
+ Size aGraphicSize(xGraphicObject->GetPrefSize());
- if( MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit() )
+ if( MAP_PIXEL == xGraphicObject->GetPrefMapMode().GetMapUnit() )
aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm );
else
- aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm);
+ aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, xGraphicObject->GetPrefMapMode(), aMapMode100thmm);
if( aGraphicSize.A() == 0 || aGraphicSize.B() == 0 )
return false;
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 4caca9417a72..8164ac3bfc51 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -321,7 +321,7 @@ bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
}
case XFILL_BITMAP:
{
- Bitmap aBitmap(((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap());
+ Bitmap aBitmap(((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetGraphicObject()->GetGraphic().GetBitmapEx().GetBitmap());
const Size aSize(aBitmap.GetSizePixel());
const sal_uInt32 nWidth = aSize.Width();
const sal_uInt32 nHeight = aSize.Height();
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index a6e27ff3380f..849d58a1af9f 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -599,7 +599,8 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale)
aClipSize);
pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
- pObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aClippedBitmap)));
+ pObj->SetMergedItem(
+ XFillBitmapItem(String(), GraphicObject::Create(Graphic(aClippedBitmap))));
pObj->SetMergedItem(XFillBmpTileItem(false));
pObj->SetMergedItem(XFillBmpStretchItem(true));
}
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 34f514901e57..d7328fdf7948 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2493,7 +2493,7 @@ void SdrCropViewHdl::CreateB2dIAObject()
const drawinglayer::primitive2d::Primitive2DReference aGraphic(
new drawinglayer::primitive2d::GraphicPrimitive2D(
aCroppedTransform,
- maGraphic));
+ GraphicObject::Create(maGraphic)));
// prepare outline polygon for whole graphic
const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index cefe73b1cf8b..6b8086734ee3 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -691,7 +691,7 @@ void SdrMarkView::SetMarkHandles()
{
// get crop scale
const basegfx::B2DVector aCropScaleFactor(
- pSdrGrafObj->GetGraphicObject().calculateCropScaling(
+ pSdrGrafObj->GetGraphicObject()->calculateCropScaling(
aScale.getX(),
aScale.getY(),
rCrop.GetLeft(),
@@ -708,7 +708,7 @@ void SdrMarkView::SetMarkHandles()
aHdl.AddHdl(
new SdrCropViewHdl(
aMatrix,
- pSdrGrafObj->GetGraphicObject().GetGraphic(),
+ pSdrGrafObj->GetGraphicObject()->GetGraphic(),
fCropLeft,
fCropTop,
fCropRight,
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 3de2a643bf50..0c596b08f9ee 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -342,8 +342,8 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS
// bitmap and transparency like shadow
if(bBitmapFillUsed)
{
- GraphicObject aGraphicObject(((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetGraphicObject());
- const BitmapEx aBitmapEx(aGraphicObject.GetGraphic().GetBitmapEx());
+ rtl::Reference< GraphicObject > xGraphicObject(((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetGraphicObject());
+ const BitmapEx aBitmapEx(xGraphicObject->GetGraphic().GetBitmapEx());
Bitmap aBitmap(aBitmapEx.GetBitmap());
if(!aBitmap.IsEmpty())
@@ -379,21 +379,21 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS
{
if(aBitmapEx.IsAlpha())
{
- aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha())));
+ xGraphicObject->SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha())));
}
else
{
- aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask())));
+ xGraphicObject->SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask())));
}
}
else
{
- aGraphicObject.SetGraphic(Graphic(aDestBitmap));
+ xGraphicObject->SetGraphic(Graphic(aDestBitmap));
}
}
}
- aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), aGraphicObject));
+ aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), xGraphicObject));
aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
}
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 65ef13a0278d..07d1f1b067e2 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -281,9 +281,9 @@ void SdrGrafObj::onGraphicChanged()
String aTitle;
String aDesc;
- if(pGraphic)
+ if(mxGraphic.is())
{
- const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = mxGraphic->GetGraphic().getSvgData();
if(rSvgDataPtr.get())
{
@@ -331,9 +331,8 @@ SdrGrafObj::SdrGrafObj()
pGraphicLink ( NULL ),
bMirrored ( false )
{
- pGraphic = new GraphicObject;
- mpReplacementGraphic = 0;
- pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ mxGraphic = GraphicObject::Create();
+ mxGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
onGraphicChanged();
// #i118485# Shear allowed and possible now
@@ -355,9 +354,8 @@ SdrGrafObj::SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect)
pGraphicLink ( NULL ),
bMirrored ( false )
{
- pGraphic = new GraphicObject( rGrf );
- mpReplacementGraphic = 0;
- pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ mxGraphic = GraphicObject::Create( rGrf );
+ mxGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
onGraphicChanged();
// #i118485# Shear allowed and possible now
@@ -379,9 +377,8 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf )
pGraphicLink ( NULL ),
bMirrored ( false )
{
- pGraphic = new GraphicObject( rGrf );
- mpReplacementGraphic = 0;
- pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ mxGraphic = GraphicObject::Create( rGrf );
+ mxGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
onGraphicChanged();
// #i118485# Shear allowed and possible now
@@ -400,55 +397,49 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf )
SdrGrafObj::~SdrGrafObj()
{
- delete pGraphic;
- delete mpReplacementGraphic;
ImpLinkAbmeldung();
}
-void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj )
+void SdrGrafObj::SetGraphicObject( const rtl::Reference< GraphicObject > &xGrfObj )
{
- *pGraphic = rGrfObj;
- delete mpReplacementGraphic;
- mpReplacementGraphic = 0;
- pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
- pGraphic->SetUserData();
+ mxGraphic = xGrfObj;
+ mxReplacementGraphic.clear();
+ mxGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ mxGraphic->SetUserData();
mbIsPreview = false;
SetChanged();
BroadcastObjectChange();
onGraphicChanged();
}
-const GraphicObject& SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const
+rtl::Reference< GraphicObject > SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const
{
if(bForceSwapIn)
- {
ForceSwapIn();
- }
- return *pGraphic;
+ return mxGraphic;
}
-const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const
+rtl::Reference< GraphicObject > SdrGrafObj::GetReplacementGraphicObject() const
{
- if(!mpReplacementGraphic && pGraphic)
+ if(!mxReplacementGraphic.is() && mxGraphic.is())
{
- const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = mxGraphic->GetGraphic().getSvgData();
if(rSvgDataPtr.get())
{
- const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
+ const_cast< SdrGrafObj* >(this)->mxReplacementGraphic = GraphicObject::Create(rSvgDataPtr->getReplacement());
}
}
- return mpReplacementGraphic;
+ return mxReplacementGraphic;
}
void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf )
{
- pGraphic->SetGraphic( rGrf );
- delete mpReplacementGraphic;
- mpReplacementGraphic = 0;
- pGraphic->SetUserData();
+ mxGraphic->SetGraphic( rGrf );
+ mxReplacementGraphic.clear();
+ mxGraphic->SetUserData();
mbIsPreview = false;
onGraphicChanged();
}
@@ -463,7 +454,7 @@ void SdrGrafObj::SetGraphic( const Graphic& rGrf )
const Graphic& SdrGrafObj::GetGraphic() const
{
ForceSwapIn();
- return pGraphic->GetGraphic();
+ return mxGraphic->GetGraphic();
}
Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const
@@ -503,37 +494,37 @@ Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const
}
// Delegate to moved code in GraphicObject
- return GetGraphicObject().GetTransformedGraphic( aDestSize, aDestMap, aActAttr );
+ return GetGraphicObject()->GetTransformedGraphic( aDestSize, aDestMap, aActAttr );
}
GraphicType SdrGrafObj::GetGraphicType() const
{
- return pGraphic->GetType();
+ return mxGraphic->GetType();
}
bool SdrGrafObj::IsAnimated() const
{
- return pGraphic->IsAnimated();
+ return mxGraphic->IsAnimated();
}
bool SdrGrafObj::IsEPS() const
{
- return pGraphic->IsEPS();
+ return mxGraphic->IsEPS();
}
bool SdrGrafObj::IsSwappedOut() const
{
- return mbIsPreview ? true : pGraphic->IsSwappedOut();
+ return mbIsPreview ? true : mxGraphic->IsSwappedOut();
}
const MapMode& SdrGrafObj::GetGrafPrefMapMode() const
{
- return pGraphic->GetPrefMapMode();
+ return mxGraphic->GetPrefMapMode();
}
const Size& SdrGrafObj::GetGrafPrefSize() const
{
- return pGraphic->GetPrefSize();
+ return mxGraphic->GetPrefSize();
}
void SdrGrafObj::SetGrafStreamURL( const String& rGraphicStreamURL )
@@ -541,21 +532,21 @@ void SdrGrafObj::SetGrafStreamURL( const String& rGraphicStreamURL )
mbIsPreview = false;
if( !rGraphicStreamURL.Len() )
{
- pGraphic->SetUserData();
+ mxGraphic->SetUserData();
}
else if( pModel->IsSwapGraphics() )
{
- pGraphic->SetUserData( rGraphicStreamURL );
+ mxGraphic->SetUserData( rGraphicStreamURL );
// set state of graphic object to 'swapped out'
- if( pGraphic->GetType() == GRAPHIC_NONE )
- pGraphic->SetSwapState();
+ if( mxGraphic->GetType() == GRAPHIC_NONE )
+ mxGraphic->SetSwapState();
}
}
String SdrGrafObj::GetGrafStreamURL() const
{
- return pGraphic->GetUserData();
+ return mxGraphic->GetUserData();
}
void SdrGrafObj::ForceSwapIn() const
@@ -563,33 +554,33 @@ void SdrGrafObj::ForceSwapIn() const
if( mbIsPreview )
{
// removing preview graphic
- const String aUserData( pGraphic->GetUserData() );
+ const String aUserData( mxGraphic->GetUserData() );
Graphic aEmpty;
- pGraphic->SetGraphic( aEmpty );
- pGraphic->SetUserData( aUserData );
- pGraphic->SetSwapState();
+ mxGraphic->SetGraphic( aEmpty );
+ mxGraphic->SetUserData( aUserData );
+ mxGraphic->SetSwapState();
const_cast< SdrGrafObj* >( this )->mbIsPreview = false;
}
- if ( pGraphicLink && pGraphic->IsSwappedOut() )
+ if ( pGraphicLink && mxGraphic->IsSwappedOut() )
ImpUpdateGraphicLink( false );
else
- pGraphic->FireSwapInRequest();
+ mxGraphic->FireSwapInRequest();
- if( pGraphic->IsSwappedOut() ||
- ( pGraphic->GetType() == GRAPHIC_NONE ) ||
- ( pGraphic->GetType() == GRAPHIC_DEFAULT ) )
+ if( mxGraphic->IsSwappedOut() ||
+ ( mxGraphic->GetType() == GRAPHIC_NONE ) ||
+ ( mxGraphic->GetType() == GRAPHIC_DEFAULT ) )
{
Graphic aDefaultGraphic;
aDefaultGraphic.SetDefaultType();
- pGraphic->SetGraphic( aDefaultGraphic );
+ mxGraphic->SetGraphic( aDefaultGraphic );
}
}
void SdrGrafObj::ForceSwapOut() const
{
- pGraphic->FireSwapOutRequest();
+ mxGraphic->FireSwapOutRequest();
}
void SdrGrafObj::ImpLinkAnmeldung()
@@ -626,10 +617,10 @@ void SdrGrafObj::SetGraphicLink(const OUString& rFileName, const String& rFilter
aFileName = rFileName;
aFilterName = rFilterName;
ImpLinkAnmeldung();
- pGraphic->SetUserData();
+ mxGraphic->SetUserData();
// A linked graphic is per definition swapped out (has to be loaded)
- pGraphic->SetSwapState();
+ mxGraphic->SetSwapState();
}
void SdrGrafObj::ReleaseGraphicLink()
@@ -656,7 +647,7 @@ const OUString& SdrGrafObj::GetFilterName() const
void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
- bool bNoPresGrf = ( pGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj;
+ bool bNoPresGrf = ( mxGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj;
rInfo.bResizeFreeAllowed = aGeo.nDrehWink % 9000 == 0 ||
aGeo.nDrehWink % 18000 == 0 ||
@@ -715,10 +706,10 @@ void SdrGrafObj::ImpSetLinkedGraphic( const Graphic& rGraphic )
OUString SdrGrafObj::TakeObjNameSingul() const
{
- if (!pGraphic)
+ if (!mxGraphic.is())
return OUString();
- const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = mxGraphic->GetGraphic().getSvgData();
OUStringBuffer sName;
@@ -728,11 +719,11 @@ OUString SdrGrafObj::TakeObjNameSingul() const
}
else
{
- switch( pGraphic->GetType() )
+ switch( mxGraphic->GetType() )
{
case GRAPHIC_BITMAP:
{
- const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+ const sal_uInt16 nId = ( ( mxGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) :
( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) );
@@ -768,10 +759,10 @@ OUString SdrGrafObj::TakeObjNameSingul() const
OUString SdrGrafObj::TakeObjNamePlural() const
{
- if(!pGraphic)
+ if(!mxGraphic.is())
return OUString();
- const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = mxGraphic->GetGraphic().getSvgData();
OUStringBuffer sName;
@@ -781,11 +772,11 @@ OUString SdrGrafObj::TakeObjNamePlural() const
}
else
{
- switch( pGraphic->GetType() )
+ switch( mxGraphic->GetType() )
{
case GRAPHIC_BITMAP:
{
- const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+ const sal_uInt16 nId = ( ( mxGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) :
( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) );
@@ -847,7 +838,7 @@ SdrGrafObj& SdrGrafObj::operator=( const SdrGrafObj& rObj )
return *this;
SdrRectObj::operator=( rObj );
- pGraphic->SetGraphic( rObj.GetGraphic(), &rObj.GetGraphicObject() );
+ mxGraphic->SetGraphic( rObj.GetGraphic(), rObj.GetGraphicObject() );
aFileName = rObj.aFileName;
aFilterName = rObj.aFilterName;
bMirrored = rObj.bMirrored;
@@ -962,8 +953,8 @@ void SdrGrafObj::SetPage( SdrPage* pNewPage )
if( bRemove )
{
// No SwapIn necessary here, because if something's not loaded, it can't be animated either.
- if( pGraphic->IsAnimated())
- pGraphic->StopAnimation();
+ if( mxGraphic->IsAnimated())
+ mxGraphic->StopAnimation();
if( pGraphicLink != NULL )
ImpLinkAbmeldung();
@@ -1001,10 +992,10 @@ void SdrGrafObj::SetModel( SdrModel* pNewModel )
if( bChg )
{
- if( pGraphic->HasUserData() )
+ if( mxGraphic->HasUserData() )
{
ForceSwapIn();
- pGraphic->SetUserData();
+ mxGraphic->SetUserData();
}
if( pGraphicLink != NULL )
@@ -1025,7 +1016,7 @@ void SdrGrafObj::StartAnimation( OutputDevice* /*pOutDev*/, const Point& /*rPoin
bool SdrGrafObj::HasGDIMetaFile() const
{
- return( pGraphic->GetType() == GRAPHIC_GDIMETAFILE );
+ return( mxGraphic->GetType() == GRAPHIC_GDIMETAFILE );
}
bool SdrGrafObj::isEmbeddedSvg() const
@@ -1180,7 +1171,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier, bool bAddText ) cons
aSet.Put(XFillStyleItem(XFILL_BITMAP));
const BitmapEx aBitmapEx(GetTransformedGraphic().GetBitmapEx());
- aSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmapEx)));
+ aSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aBitmapEx))));
aSet.Put(XFillBmpTileItem(false));
pRetval->SetMergedItemSet(aSet);
@@ -1240,11 +1231,11 @@ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly )
{
Size aSize;
Size aMaxSize( rMaxRect.GetSize() );
- if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
- aSize = Application::GetDefaultDevice()->PixelToLogic( pGraphic->GetPrefSize(), MAP_100TH_MM );
+ if ( mxGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aSize = Application::GetDefaultDevice()->PixelToLogic( mxGraphic->GetPrefSize(), MAP_100TH_MM );
else
- aSize = OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
- pGraphic->GetPrefMapMode(),
+ aSize = OutputDevice::LogicToLogic( mxGraphic->GetPrefSize(),
+ mxGraphic->GetPrefMapMode(),
MapMode( MAP_100TH_MM ) );
if( aSize.Height() != 0 && aSize.Width() != 0 )
@@ -1292,7 +1283,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
if( pO->IsInSwapOut() )
{
- if( pModel && !mbIsPreview && pModel->IsSwapGraphics() && pGraphic->GetSizeBytes() > 20480 )
+ if( pModel && !mbIsPreview && pModel->IsSwapGraphics() && mxGraphic->GetSizeBytes() > 20480 )
{
// test if this object is visualized from someone
// ## test only if there are VOCs other than the preview renderer
@@ -1300,7 +1291,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
{
const sal_uIntPtr nSwapMode = pModel->GetSwapGraphicsMode();
- if( ( pGraphic->HasUserData() || pGraphicLink ) &&
+ if( ( mxGraphic->HasUserData() || pGraphicLink ) &&
( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) )
{
pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
@@ -1308,7 +1299,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
else if( nSwapMode & SDR_SWAPGRAPHICSMODE_TEMP )
{
pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
- pGraphic->SetUserData();
+ mxGraphic->SetUserData();
}
// #i102380#
@@ -1326,10 +1317,10 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
// can be loaded from the original document stream later
if( pModel != NULL )
{
- if( pGraphic->HasUserData() )
+ if( mxGraphic->HasUserData() )
{
::comphelper::LifecycleProxy proxy;
- OUString aUserData = pGraphic->GetUserData();
+ OUString aUserData = mxGraphic->GetUserData();
uno::Reference<io::XInputStream> const xStream(
pModel->GetDocumentStream(aUserData, proxy));
@@ -1364,10 +1355,10 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
aGraphic, aUserData, *pStream,
GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData))
{
- const String aNewUserData( pGraphic->GetUserData() );
+ const String aNewUserData( mxGraphic->GetUserData() );
- pGraphic->SetGraphic( aGraphic );
- pGraphic->SetUserData( aNewUserData );
+ mxGraphic->SetGraphic( aGraphic );
+ mxGraphic->SetUserData( aNewUserData );
// Graphic successfully swapped in.
pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
@@ -1409,11 +1400,11 @@ Reference< XInputStream > SdrGrafObj::getInputStream()
if( pModel )
{
// can be loaded from the original document stream later
- if( pGraphic->HasUserData() )
+ if( mxGraphic->HasUserData() )
{
::comphelper::LifecycleProxy proxy;
xStream.set(
- pModel->GetDocumentStream(pGraphic->GetUserData(), proxy));
+ pModel->GetDocumentStream(mxGraphic->GetUserData(), proxy));
// fdo#46340: this may look completely insane, and it is,
// but it also prevents a crash: the LifecycleProxy will go out
// of scope, but the xStream must be returned; the UcbStreamHelper
@@ -1423,7 +1414,7 @@ Reference< XInputStream > SdrGrafObj::getInputStream()
utl::UcbStreamHelper::CreateStream(xStream);
xStream.set(new utl::OInputStreamWrapper(pStream, true));
}
- else if( pGraphic && GetGraphic().IsLink() )
+ else if( mxGraphic.is() && GetGraphic().IsLink() )
{
Graphic aGraphic( GetGraphic() );
GfxLink aLink( aGraphic.GetLink() );
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index b97bf73733af..ed952de74620 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -674,7 +674,7 @@ class SdrOle2ObjImpl
{
public:
// TODO/LATER: do we really need this pointer?
- GraphicObject* pGraphicObject;
+ rtl::Reference< GraphicObject > mxGraphicObject;
String aPersistName; // name of object in persist
SdrLightEmbeddedClient_Impl* pLightClient; // must be registered as client only using AddOwnLightClient() call
@@ -686,8 +686,7 @@ public:
String maLinkURL;
SdrOle2ObjImpl()
- : pGraphicObject( NULL )
- , pLightClient ( NULL )
+ : pLightClient ( NULL )
// init to start situation, loading did not fail
, mbLoadingOLEObjectFailed( false )
, mbConnected( false )
@@ -780,7 +779,7 @@ void SdrOle2Obj::Init()
mpImpl = new SdrOle2ObjImpl;
pModifyListener = NULL;
pGraphic=NULL;
- mpImpl->pGraphicObject=NULL;
+ mpImpl->mxGraphicObject.clear();
mpImpl->pLightClient = 0;
xObjRef.Lock( sal_True );
@@ -798,7 +797,7 @@ SdrOle2Obj::~SdrOle2Obj()
delete pGraphic;
- delete mpImpl->pGraphicObject;
+ mpImpl->mxGraphicObject.clear();
if(pModifyListener)
{
@@ -843,14 +842,13 @@ void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf)
{
delete pGraphic;
pGraphic = NULL;
- delete mpImpl->pGraphicObject;
- mpImpl->pGraphicObject = NULL;
+ mpImpl->mxGraphicObject.clear();
}
if (pGrf!=NULL)
{
pGraphic = new Graphic(*pGrf);
- mpImpl->pGraphicObject = new GraphicObject( *pGraphic );
+ mpImpl->mxGraphicObject = GraphicObject::Create( *pGraphic );
}
SetChanged();
@@ -1337,7 +1335,8 @@ SdrObject* SdrOle2Obj::createSdrGrafObjReplacement(bool bAddText, bool /* bUseHC
// bitmap fill
pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
- pClone->SetMergedItem(XFillBitmapItem(String(), GetEmptyOLEReplacementGraphic()));
+ pClone->SetMergedItem(XFillBitmapItem(String(),
+ GraphicObject::Create(GetEmptyOLEReplacementGraphic())));
pClone->SetMergedItem(XFillBmpTileItem(false));
pClone->SetMergedItem(XFillBmpStretchItem(false));
@@ -1649,11 +1648,11 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
if( pGraphic )
{
delete pGraphic;
- delete mpImpl->pGraphicObject;
+ mpImpl->mxGraphicObject.clear();
}
pGraphic = new Graphic( *rOle2Obj.pGraphic );
- mpImpl->pGraphicObject = new GraphicObject( *pGraphic );
+ mpImpl->mxGraphicObject = GraphicObject::Create( *pGraphic );
}
if( pModel && rObj.GetModel() && !IsEmptyPresObj() )
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 0365429203f2..11c9c000e0a0 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -538,7 +538,7 @@ namespace
// create GraphicPrimitive2D
const drawinglayer::primitive2d::Primitive2DReference aNewReference(new drawinglayer::primitive2d::GraphicPrimitive2D(
aNewTransform,
- rInfo.maBulletGraphicObject,
+ rInfo.mxBulletGraphicObject,
aGraphicAttr));
// embed in TextHierarchyBulletPrimitive2D
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index ededdfd1eff3..d33ee615669f 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -669,8 +669,8 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XP
uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw()
{
OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
- const GraphicObject& rGraphicObject(((XBitmapEntry*)pEntry)->GetGraphicObject());
- aURL += OStringToOUString(rGraphicObject.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+ rtl::Reference< GraphicObject > xGraphicObject(((XBitmapEntry*)pEntry)->GetGraphicObject());
+ aURL += OStringToOUString(xGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
uno::Any aAny;
aAny <<= aURL;
@@ -683,10 +683,10 @@ XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno::
if(!(rAny >>= aURL))
return NULL;
- const GraphicObject aGrafObj(GraphicObject::CreateGraphicObjectFromURL(aURL));
+ rtl::Reference< GraphicObject > xGrafObj(GraphicObject::CreateGraphicObjectFromURL(aURL));
const String aName(rName);
- return new XBitmapEntry(aGrafObj, aName);
+ return new XBitmapEntry(xGrafObj, aName);
}
// XElementAccess
diff --git a/svx/source/unodraw/unobtabl.cxx b/svx/source/unodraw/unobtabl.cxx
index 398ebc9cc621..6d5dba233b15 100644
--- a/svx/source/unodraw/unobtabl.cxx
+++ b/svx/source/unodraw/unobtabl.cxx
@@ -69,7 +69,7 @@ bool SvxUnoBitmapTable::isValid( const NameOrIndex* pItem ) const
const XFillBitmapItem* pBitmapItem = dynamic_cast< const XFillBitmapItem* >( pItem );
if( pBitmapItem )
{
- const Graphic& rGraphic = pBitmapItem->GetGraphicObject().GetGraphic();
+ const Graphic& rGraphic = pBitmapItem->GetGraphicObject()->GetGraphic();
return rGraphic.GetSizeBytes() > 0;
}
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index d2ecf6b8516c..c12af2823080 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1513,7 +1513,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
String aTmpStr(aURL);
OString aUniqueID(OUStringToOString(aTmpStr, RTL_TEXTENCODING_UTF8));
- GraphicObject aGrafObj(aUniqueID);
+ rtl::Reference< GraphicObject > xGrafObj(GraphicObject::Create(aUniqueID));
// #101808# since loading a graphic can cause a reschedule of the office
// it is possible that our shape is removed while where in this
@@ -1521,7 +1521,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
if( mpObj.is() )
{
static_cast<SdrGrafObj*>(mpObj.get())->ReleaseGraphicLink();
- static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj );
+ static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( xGrafObj );
}
}
else if( !aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
@@ -1649,9 +1649,9 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
else
{
sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
- const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
+ rtl::Reference< GraphicObject > xGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(rGrafObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+ aURL += OStringToOUString(xGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
rValue <<= aURL;
if ( bSwapped )
static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
@@ -1661,12 +1661,12 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_REPLACEMENTGRAFURL:
{
- const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
+ rtl::Reference< GraphicObject > xGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
- if(pGrafObj)
+ if(xGrafObj.is())
{
OUString aURL(UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(pGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+ aURL += OStringToOUString(xGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
rValue <<= aURL;
}
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 768896d9da36..0b968782a0de 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -147,8 +147,8 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
OUString aURL;
if( rValue >>= aURL )
{
- GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
- static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &aGrafObj.GetGraphic() );
+ rtl::Reference< GraphicObject > xGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
+ static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &xGrafObj->GetGraphic() );
return true;
}
break;
@@ -161,8 +161,8 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
if( pOle )
{
- GraphicObject aGrafObj( xGraphic );
- const Graphic aGraphic( aGrafObj.GetGraphic() );
+ rtl::Reference< GraphicObject > xGrafObj( GraphicObject::Create( xGraphic ) );
+ const Graphic aGraphic( xGrafObj->GetGraphic() );
pOle->SetGraphicToObj( aGraphic, OUString() );
}
return true;
@@ -338,10 +338,10 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
if( pGraphic )
{
- GraphicObject aObj( *pGraphic );
+ rtl::Reference< GraphicObject > xObj( GraphicObject::Create( *pGraphic ) );
aURL = OUString( UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(aObj.GetUniqueID(),
- RTL_TEXTENCODING_ASCII_US);
+ aURL += OStringToOUString(xObj->GetUniqueID(),
+ RTL_TEXTENCODING_ASCII_US);
}
}
rValue <<= aURL;
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 99d5548b1c0a..cb7ef74d04c1 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -96,17 +96,17 @@ public:
SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId )
{
- GraphicObject aGrfObject( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) );
+ rtl::Reference< GraphicObject > xGrfObject( GraphicObject::Create( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) ) );
maTmp.EnableKillingFile();
- if( aGrfObject.GetType() != GRAPHIC_NONE )
+ if( xGrfObject->GetType() != GRAPHIC_NONE )
{
SvStream* pStm = ::utl::UcbStreamHelper::CreateStream( maTmp.GetURL(), STREAM_WRITE | STREAM_TRUNC );
if( pStm )
{
- Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
+ Graphic aGraphic( (Graphic&) xGrfObject->GetGraphic() );
const GfxLink aGfxLink( aGraphic.GetLink() );
sal_Bool bRet = sal_False;
@@ -210,7 +210,7 @@ private:
::utl::TempFile* mpTmp;
SvStream* mpOStm;
Reference< XOutputStream > mxStmWrapper;
- GraphicObject maGrfObj;
+ rtl::Reference< GraphicObject > mxGrfObj;
sal_Bool mbClosed;
// not available
@@ -223,7 +223,7 @@ public:
virtual ~SvXMLGraphicOutputStream();
bool Exists() const { return mxStmWrapper.is(); }
- const GraphicObject& GetGraphicObject();
+ rtl::Reference< GraphicObject > GetGraphicObject();
};
SvXMLGraphicOutputStream::SvXMLGraphicOutputStream() :
@@ -274,9 +274,9 @@ void SAL_CALL SvXMLGraphicOutputStream::closeOutput()
mbClosed = sal_True;
}
-const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
+rtl::Reference< GraphicObject > SvXMLGraphicOutputStream::GetGraphicObject()
{
- if( mbClosed && ( maGrfObj.GetType() == GRAPHIC_NONE ) && mpOStm )
+ if( mbClosed && ( mxGrfObj->GetType() == GRAPHIC_NONE ) && mpOStm )
{
Graphic aGraphic;
@@ -334,15 +334,15 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
}
}
- maGrfObj = aGraphic;
- if( maGrfObj.GetType() != GRAPHIC_NONE )
+ mxGrfObj = GraphicObject::Create( aGraphic );
+ if( mxGrfObj->GetType() != GRAPHIC_NONE )
{
delete mpOStm, mpOStm = NULL;
delete mpTmp, mpTmp = NULL;
}
}
- return maGrfObj;
+ return mxGrfObj;
}
SvXMLGraphicHelper::SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode ) :
@@ -490,7 +490,7 @@ String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) con
Graphic SvXMLGraphicHelper::ImplReadGraphic( const OUString& rPictureStorageName,
const OUString& rPictureStreamName )
{
- Graphic aGraphic;
+ Graphic aGraphic;
SvxGraphicHelperStream_Impl aStream( ImplGetGraphicStream( rPictureStorageName, rPictureStreamName, sal_False ) );
if( aStream.xStream.is() )
{
@@ -507,15 +507,15 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageNa
const OUString& rGraphicId,
bool bUseGfxLink )
{
- GraphicObject aGrfObject( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) );
+ rtl::Reference< GraphicObject > xGrfObject( GraphicObject::Create( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) ) );
sal_Bool bRet = sal_False;
- if( aGrfObject.GetType() != GRAPHIC_NONE )
+ if( xGrfObject->GetType() != GRAPHIC_NONE )
{
SvxGraphicHelperStream_Impl aStream( ImplGetGraphicStream( rPictureStorageName, rPictureStreamName, sal_False ) );
if( aStream.xStream.is() )
{
- Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
+ Graphic aGraphic( (Graphic&) xGrfObject->GetGraphic() );
const GfxLink aGfxLink( aGraphic.GetLink() );
const OUString aMimeType( ImplGetGraphicMimeType( rPictureStreamName ) );
uno::Any aAny;
@@ -609,15 +609,15 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
if( GRAPHICHELPER_MODE_READ == meCreateMode )
{
- const GraphicObject aObj( ImplReadGraphic( aPictureStorageName, aPictureStreamName ) );
+ rtl::Reference< GraphicObject > xObj( GraphicObject::Create( ImplReadGraphic( aPictureStorageName, aPictureStreamName ) ) );
- if( aObj.GetType() != GRAPHIC_NONE )
+ if( xObj->GetType() != GRAPHIC_NONE )
{
- maGrfObjs.push_back( aObj );
+ maGrfObjs.push_back( xObj );
OUString aBaseURL( XML_GRAPHICOBJECT_URL_BASE );
rURLPair.second = aBaseURL;
- rURLPair.second += OStringToOUString(aObj.GetUniqueID(),
+ rURLPair.second += OStringToOUString(xObj->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US);
}
else
@@ -627,11 +627,11 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
{
const String aGraphicObjectId( aPictureStreamName );
const OString aAsciiObjectID(OUStringToOString(aGraphicObjectId, RTL_TEXTENCODING_ASCII_US));
- const GraphicObject aGrfObject( aAsciiObjectID );
- if( aGrfObject.GetType() != GRAPHIC_NONE )
+ rtl::Reference< GraphicObject > xGrfObject( GraphicObject::Create(aAsciiObjectID ) );
+ if( xGrfObject->GetType() != GRAPHIC_NONE )
{
String aStreamName( aGraphicObjectId );
- Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
+ Graphic aGraphic( (Graphic&) xGrfObject->GetGraphic() );
const GfxLink aGfxLink( aGraphic.GetLink() );
String aExtension;
bool bUseGfxLink( true );
@@ -670,14 +670,14 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
}
else
{
- if( aGrfObject.GetType() == GRAPHIC_BITMAP )
+ if( xGrfObject->GetType() == GRAPHIC_BITMAP )
{
- if( aGrfObject.IsAnimated() )
+ if( xGrfObject->IsAnimated() )
aExtension = String( ".gif" );
else
aExtension = String( ".png" );
}
- else if( aGrfObject.GetType() == GRAPHIC_GDIMETAFILE )
+ else if( xGrfObject->GetType() == GRAPHIC_GDIMETAFILE )
{
// SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm
GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() );
@@ -868,9 +868,9 @@ OUString SAL_CALL SvXMLGraphicHelper::resolveOutputStream( const Reference< XOut
if( pOStm )
{
- const GraphicObject& rGrfObj = pOStm->GetGraphicObject();
+ rtl::Reference< GraphicObject > xGrfObj = pOStm->GetGraphicObject();
const OUString aId(OStringToOUString(
- rGrfObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US));
+ xGrfObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US));
if( !aId.isEmpty() )
{
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index e3b50dd6ccf4..d0341a703053 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -242,10 +242,10 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn
{
case XATTR_FILLBITMAP:
{
- const GraphicObject& rGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject());
- const GraphicObject& rGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject());
+ rtl::Reference< GraphicObject > xGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject());
+ rtl::Reference< GraphicObject > xGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject());
- bFound = (rGraphicObjectA == rGraphicObjectB);
+ bFound = (*xGraphicObjectA.get() == *xGraphicObjectB.get());
break;
}
case XATTR_LINEDASH:
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 78e56e87eea2..210653936240 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -50,7 +50,7 @@ using namespace ::com::sun::star;
XOBitmap::XOBitmap( const Bitmap& rBmp ) :
eType ( XBITMAP_IMPORT ),
- aGraphicObject ( rBmp ),
+ mxGraphicObject ( GraphicObject::Create( rBmp ) ),
pPixelArray ( NULL ),
bGraphicDirty ( sal_False )
{
@@ -66,7 +66,7 @@ XOBitmap::XOBitmap( const XOBitmap& rXBmp ) :
pPixelArray ( NULL )
{
eType = rXBmp.eType;
- aGraphicObject = rXBmp.aGraphicObject;
+ mxGraphicObject = GraphicObject::Create( rXBmp.mxGraphicObject );
aArraySize = rXBmp.aArraySize;
aPixelColor = rXBmp.aPixelColor;
aBckgrColor = rXBmp.aBckgrColor;
@@ -104,7 +104,7 @@ XOBitmap::~XOBitmap()
XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
{
eType = rXBmp.eType;
- aGraphicObject = rXBmp.aGraphicObject;
+ mxGraphicObject = GraphicObject::Create( rXBmp.mxGraphicObject );
aArraySize = rXBmp.aArraySize;
aPixelColor = rXBmp.aPixelColor;
aBckgrColor = rXBmp.aBckgrColor;
@@ -132,7 +132,7 @@ XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
{
if( eType != rXOBitmap.eType ||
- aGraphicObject != rXOBitmap.aGraphicObject ||
+ *mxGraphicObject.get() != *rXOBitmap.mxGraphicObject.get() ||
aArraySize != rXOBitmap.aArraySize ||
aPixelColor != rXOBitmap.aPixelColor ||
aBckgrColor != rXOBitmap.aBckgrColor ||
@@ -161,7 +161,7 @@ int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
Bitmap XOBitmap::GetBitmap() const
{
- return GetGraphicObject().GetGraphic().GetBitmap();
+ return GetGraphicObject()->GetGraphic().GetBitmap();
}
/*************************************************************************
@@ -170,12 +170,12 @@ Bitmap XOBitmap::GetBitmap() const
|*
*************************************************************************/
-const GraphicObject& XOBitmap::GetGraphicObject() const
+rtl::Reference< GraphicObject > XOBitmap::GetGraphicObject() const
{
if( bGraphicDirty )
- ( (XOBitmap*) this )->Array2Bitmap();
+ const_cast< XOBitmap * >( this )->Array2Bitmap();
- return aGraphicObject;
+ return mxGraphicObject;
}
/*************************************************************************
@@ -253,7 +253,7 @@ void XOBitmap::Array2Bitmap()
}
}
- aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
+ mxGraphicObject = GraphicObject::Create( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
bGraphicDirty = sal_False;
}
@@ -264,9 +264,9 @@ TYPEINIT1_AUTOFACTORY(XFillBitmapItem, NameOrIndex);
//////////////////////////////////////////////////////////////////////////////
-XFillBitmapItem::XFillBitmapItem(const XubString& rName, const GraphicObject& rGraphicObject)
+XFillBitmapItem::XFillBitmapItem(const XubString& rName, const rtl::Reference< GraphicObject >& xGraphicObject)
: NameOrIndex(XATTR_FILLBITMAP, rName),
- maGraphicObject(rGraphicObject)
+ mxGraphicObject(GraphicObject::Create(xGraphicObject))
{
}
@@ -274,7 +274,7 @@ XFillBitmapItem::XFillBitmapItem(const XubString& rName, const GraphicObject& rG
XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem)
: NameOrIndex(rItem),
- maGraphicObject(rItem.maGraphicObject)
+ mxGraphicObject(GraphicObject::Create(rItem.mxGraphicObject))
{
}
@@ -359,7 +359,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
Bitmap aBmp;
ReadDIB(aBmp, rIn, true);
- maGraphicObject = Graphic(aBmp);
+ mxGraphicObject = GraphicObject::Create(Graphic(aBmp));
}
else if(1 == nVer)
{
@@ -373,7 +373,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
Bitmap aBmp;
ReadDIB(aBmp, rIn, true);
- maGraphicObject = Graphic(aBmp);
+ mxGraphicObject = GraphicObject::Create(Graphic(aBmp));
}
else if(XBITMAP_8X8 == iTmp)
{
@@ -392,7 +392,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
const Bitmap aBitmap(createHistorical8x8FromArray(aArray, aColorPix, aColorBack));
- maGraphicObject = Graphic(aBitmap);
+ mxGraphicObject = GraphicObject::Create(Graphic(aBitmap));
}
}
else if(2 == nVer)
@@ -400,16 +400,17 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
BitmapEx aBmpEx;
ReadDIBBitmapEx(aBmpEx, rIn);
- maGraphicObject = Graphic(aBmpEx);
+ mxGraphicObject = GraphicObject::Create(Graphic(aBmpEx));
}
}
}
//////////////////////////////////////////////////////////////////////////////
-XFillBitmapItem::XFillBitmapItem(SfxItemPool* /*pPool*/, const GraphicObject& rGraphicObject)
+XFillBitmapItem::XFillBitmapItem(SfxItemPool* /*pPool*/,
+ const rtl::Reference< GraphicObject >& xGraphicObject)
: NameOrIndex( XATTR_FILLBITMAP, -1),
- maGraphicObject(rGraphicObject)
+ mxGraphicObject( GraphicObject::Create( xGraphicObject ) )
{
}
@@ -425,7 +426,7 @@ SfxPoolItem* XFillBitmapItem::Clone(SfxItemPool* /*pPool*/) const
int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
{
return (NameOrIndex::operator==(rItem)
- && maGraphicObject == ((const XFillBitmapItem&)rItem).maGraphicObject);
+ && *mxGraphicObject.get() == *((const XFillBitmapItem&)rItem).mxGraphicObject.get());
}
//////////////////////////////////////////////////////////////////////////////
@@ -442,25 +443,23 @@ SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) cons
NameOrIndex::Store(rOut, nItemVersion);
if(!IsIndex())
- {
- WriteDIBBitmapEx(maGraphicObject.GetGraphic().GetBitmapEx(), rOut);
- }
+ WriteDIBBitmapEx(mxGraphicObject->GetGraphic().GetBitmapEx(), rOut);
return rOut;
}
//////////////////////////////////////////////////////////////////////////////
-const GraphicObject& XFillBitmapItem::GetGraphicObject() const
+rtl::Reference< GraphicObject > XFillBitmapItem::GetGraphicObject() const
{
- return maGraphicObject;
+ return mxGraphicObject;
}
//////////////////////////////////////////////////////////////////////////////
-void XFillBitmapItem::SetGraphicObject(const GraphicObject& rGraphicObject)
+void XFillBitmapItem::SetGraphicObject(const rtl::Reference< GraphicObject >& xGraphicObject)
{
- maGraphicObject = rGraphicObject;
+ mxGraphicObject = xGraphicObject;
}
//////////////////////////////////////////////////////////////////////////////
@@ -523,13 +522,13 @@ bool XFillBitmapItem::QueryValue(::com::sun::star::uno::Any& rVal, sal_uInt8 nMe
aURL = OUString(
UNO_NAME_GRAPHOBJ_URLPREFIX);
aURL += OStringToOUString(
- GetGraphicObject().GetUniqueID(),
+ GetGraphicObject()->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US);
}
if( nMemberId == MID_BITMAP ||
nMemberId == 0 )
{
- xBmp.set(VCLUnoHelper::CreateBitmap(GetGraphicObject().GetGraphic().GetBitmapEx()));
+ xBmp.set(VCLUnoHelper::CreateBitmap(GetGraphicObject()->GetGraphic().GetBitmapEx()));
}
if( nMemberId == MID_NAME )
@@ -606,23 +605,21 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt
}
if( bSetURL )
{
- maGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL);
+ mxGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL);
// #121194# Prefer GraphicObject over bitmap object if both are provided
- if(bSetBitmap && GRAPHIC_NONE != maGraphicObject.GetType())
- {
+ if(bSetBitmap && GRAPHIC_NONE != mxGraphicObject->GetType())
bSetBitmap = false;
- }
}
if( bSetBitmap )
{
if(xBmp.is())
{
- maGraphicObject = Graphic(VCLUnoHelper::GetBitmap(xBmp));
+ mxGraphicObject = GraphicObject::Create(Graphic(VCLUnoHelper::GetBitmap(xBmp)));
}
else if(xGraphic.is())
{
- maGraphicObject = Graphic(xGraphic);
+ mxGraphicObject = GraphicObject::Create(Graphic(xGraphic));
}
}
@@ -633,10 +630,10 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt
sal_Bool XFillBitmapItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
{
- const GraphicObject& aGraphicObjectA(((XFillBitmapItem*)p1)->GetGraphicObject());
- const GraphicObject& aGraphicObjectB(((XFillBitmapItem*)p2)->GetGraphicObject());
+ rtl::Reference< GraphicObject > xGraphicObjectA(((XFillBitmapItem*)p1)->GetGraphicObject());
+ rtl::Reference< GraphicObject > xGraphicObjectB(((XFillBitmapItem*)p2)->GetGraphicObject());
- return aGraphicObjectA == aGraphicObjectB;
+ return *xGraphicObjectA.get() == *xGraphicObjectB.get();
}
//////////////////////////////////////////////////////////////////////////////
@@ -654,7 +651,7 @@ XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const
// if the given name is not valid, replace it!
if( aUniqueName != GetName() )
{
- return new XFillBitmapItem(aUniqueName, maGraphicObject);
+ return new XFillBitmapItem(aUniqueName, mxGraphicObject);
}
}
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
index 5f1124eb15cb..99fc70aebc70 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -85,7 +85,7 @@ XOutdevItemPool::XOutdevItemPool(
mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol);
mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(aNullGrad);
mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (this,aNullHatch);
- mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this, aNullGraphic);
+ mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this, GraphicObject::Create(aNullGraphic));
mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem;
mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem;
mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem;
diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx
index 961c501b3356..d807dfa27f18 100644
--- a/svx/source/xoutdev/xtabbtmp.cxx
+++ b/svx/source/xoutdev/xtabbtmp.cxx
@@ -59,28 +59,28 @@ bool XBitmapList::Create()
// white/white bitmap
aStr.AppendAscii(" 1");
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_WHITE), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aStr));
// black/white bitmap
aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1;
aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1;
aStr.SetChar(nLen, sal_Unicode('2'));
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aStr));
// lightred/white bitmap
aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1;
aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1;
aStr.SetChar(nLen, sal_Unicode('3'));
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTRED), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aStr));
// lightblue/white bitmap
aArray[24] = 1; aArray[25] = 1; aArray[26] = 1;
aArray[29] = 1; aArray[30] = 1; aArray[31] = 1;
aStr.SetChar(nLen, sal_Unicode('4'));
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTBLUE), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aStr));
return sal_True;
}
diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx
index 5fd2d5e558e5..8318e06c40e6 100644
--- a/svx/source/xoutdev/xtable.cxx
+++ b/svx/source/xoutdev/xtable.cxx
@@ -115,15 +115,16 @@ XGradientEntry::XGradientEntry(const XGradientEntry& rOther)
//////////////////////////////////////////////////////////////////////////////
// class XBitmapEntry
-XBitmapEntry::XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName)
+XBitmapEntry::XBitmapEntry(const rtl::Reference< GraphicObject >& xGraphicObject,
+ const String& rName)
: XPropertyEntry(rName),
- maGraphicObject(rGraphicObject)
+ mxGraphicObject(xGraphicObject)
{
}
XBitmapEntry::XBitmapEntry(const XBitmapEntry& rOther)
: XPropertyEntry(rOther),
- maGraphicObject(rOther.maGraphicObject)
+ mxGraphicObject(GraphicObject::Create(rOther.mxGraphicObject))
{
}