diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-08-05 21:41:49 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-08-06 16:18:32 +0200 |
commit | 203dad15bf1c381e3b45b3253faf92f4a470c8de (patch) | |
tree | 6817617e49e8e186b4c7497d038724c6286d54c7 /filter | |
parent | 7afc29809ec9db8c5064d5b5857f64db9bd843be (diff) |
initial cut at ref-counting GraphicObjects
Change-Id: Ia87c429fc9e8b470fe066ee2179928de01c1fa1b
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 62 | ||||
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 6 |
2 files changed, 34 insertions, 34 deletions
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)); |