[Libreoffice-commits] core.git: Branch 'feature/graphicobject' - canvas/source chart2/source cui/source dbaccess/source editeng/source filter/source include/filter include/svtools include/svx oox/source sc/source sd/source slideshow/source svtools/source svx/source sw/inc sw/source writerfilter/source
Norbert Thiebaud
nthiebaud at gmail.com
Fri Sep 27 07:45:41 PDT 2013
canvas/source/vcl/cachedbitmap.cxx | 6
canvas/source/vcl/cachedbitmap.hxx | 3
canvas/source/vcl/canvas.cxx | 2
canvas/source/vcl/canvas.hxx | 2
canvas/source/vcl/canvasbitmap.cxx | 2
canvas/source/vcl/canvasbitmap.hxx | 2
canvas/source/vcl/canvascustomsprite.cxx | 2
canvas/source/vcl/canvascustomsprite.hxx | 2
canvas/source/vcl/canvashelper.cxx | 4
canvas/source/vcl/canvashelper.hxx | 2
canvas/source/vcl/repainttarget.hxx | 2
canvas/source/vcl/spritecanvas.cxx | 2
canvas/source/vcl/spritecanvas.hxx | 2
chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx | 8
chart2/source/model/main/ChartModel.hxx | 2
cui/source/dialogs/cuigaldlg.cxx | 2
cui/source/options/optmemory.cxx | 10
cui/source/tabpages/backgrnd.cxx | 6
cui/source/tabpages/tpbitmap.cxx | 29 -
dbaccess/source/ui/app/AppDetailPageHelper.cxx | 17
dbaccess/source/ui/app/AppDetailPageHelper.hxx | 4
editeng/source/items/bulitem.cxx | 22 -
editeng/source/items/frmitems.cxx | 43 +-
editeng/source/uno/unonrule.cxx | 4
filter/source/msfilter/escherex.cxx | 6
filter/source/msfilter/msdffimp.cxx | 8
filter/source/msfilter/svdfppt.cxx | 2
include/filter/msfilter/escherex.hxx | 4
include/svtools/grfmgr.hxx | 37 +
include/svx/extedit.hxx | 4
include/svx/galctrl.hxx | 3
include/svx/grfflt.hxx | 2
include/svx/svdograf.hxx | 2
include/svx/xbtmpit.hxx | 2
oox/source/export/drawingml.cxx | 116 +++--
sc/source/ui/drawfunc/graphsh.cxx | 13
sc/source/ui/view/printfun.cxx | 8
sd/source/core/drawdoc4.cxx | 2
sd/source/filter/eppt/epptso.cxx | 8
sd/source/ui/func/fupage.cxx | 2
sd/source/ui/view/GraphicObjectBar.cxx | 7
sd/source/ui/view/drviews2.cxx | 10
sd/source/ui/view/sdview3.cxx | 2
sd/source/ui/view/sdview4.cxx | 2
slideshow/source/engine/shapes/shapeimporter.cxx | 24 -
svtools/source/graphic/grfmgr.cxx | 58 +-
svx/source/core/extedit.cxx | 7
svx/source/dialog/grfflt.cxx | 63 +--
svx/source/gallery2/galbrws2.cxx | 6
svx/source/gallery2/galctrl.cxx | 35 +
svx/source/sdr/contact/viewcontactofgraphic.cxx | 4
svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 8
svx/source/svdraw/svdoashp.cxx | 6
svx/source/svdraw/svdograf.cxx | 51 +-
sw/inc/IDocumentContentOperations.hxx | 9
sw/inc/doc.hxx | 2
sw/inc/ndarr.hxx | 4
sw/inc/ndgrf.hxx | 34 -
sw/source/core/doc/doc.cxx | 4
sw/source/core/doc/notxtfrm.cxx | 26 -
sw/source/core/docnode/swbaslnk.cxx | 8
sw/source/core/edit/editsh.cxx | 10
sw/source/core/graphic/ndgrf.cxx | 197 +++++-----
sw/source/core/layout/atrfrm.cxx | 9
sw/source/core/layout/fly.cxx | 22 -
sw/source/core/layout/paintfrm.cxx | 49 +-
sw/source/core/unocore/unoframe.cxx | 36 -
sw/source/filter/ww8/rtfsdrexport.cxx | 3
sw/source/filter/ww8/writerhelper.cxx | 2
sw/source/filter/ww8/wrtw8esh.cxx | 21 -
sw/source/filter/ww8/ww8graf.cxx | 8
sw/source/filter/xml/xmlbrsh.cxx | 4
sw/source/ui/shells/grfsh.cxx | 9
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3
74 files changed, 586 insertions(+), 556 deletions(-)
New commits:
commit 134741211d5c95a1a0ef07e13eb4846c62adce22
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Fri Sep 27 16:39:56 2013 +0200
Save Commit: must be squashed!!! ObjectGraphic refactor
Change-Id: I69f0b8bef3a08d1a325ccbe2b5f128df9cc14880
diff --git a/canvas/source/vcl/cachedbitmap.cxx b/canvas/source/vcl/cachedbitmap.cxx
index bdbbcab..657b509 100644
--- a/canvas/source/vcl/cachedbitmap.cxx
+++ b/canvas/source/vcl/cachedbitmap.cxx
@@ -35,7 +35,7 @@ using namespace ::com::sun::star;
namespace vclcanvas
{
- CachedBitmap::CachedBitmap( const GraphicObjectSharedPtr& rGraphicObject,
+ CachedBitmap::CachedBitmap( const rtl::Reference< GraphicObject>& xGraphicObject,
const ::Point& rPoint,
const ::Size& rSize,
const GraphicAttr& rAttr,
@@ -43,7 +43,7 @@ namespace vclcanvas
const rendering::RenderState& rUsedRenderState,
const uno::Reference< rendering::XCanvas >& rTarget ) :
CachedPrimitiveBase( rUsedViewState, rTarget, true ),
- mpGraphicObject( rGraphicObject ),
+ mpGraphicObject( xGraphicObject ),
maRenderState(rUsedRenderState),
maPoint( rPoint ),
maSize( rSize ),
@@ -55,7 +55,7 @@ namespace vclcanvas
{
::osl::MutexGuard aGuard( m_aMutex );
- mpGraphicObject.reset();
+ mpGraphicObject.clear();
CachedPrimitiveBase::disposing();
}
diff --git a/canvas/source/vcl/cachedbitmap.hxx b/canvas/source/vcl/cachedbitmap.hxx
index 117d560..5e52983 100644
--- a/canvas/source/vcl/cachedbitmap.hxx
+++ b/canvas/source/vcl/cachedbitmap.hxx
@@ -31,7 +31,6 @@
namespace vclcanvas
{
- typedef ::boost::shared_ptr< GraphicObject > GraphicObjectSharedPtr;
class CachedBitmap : public ::canvas::CachedPrimitiveBase
{
@@ -59,7 +58,7 @@ namespace vclcanvas
bool bSameViewTransform );
- GraphicObjectSharedPtr mpGraphicObject;
+ rtl::Reference< GraphicObject> mpGraphicObject;
const ::com::sun::star::rendering::RenderState maRenderState;
const ::Point maPoint;
const ::Size maSize;
diff --git a/canvas/source/vcl/canvas.cxx b/canvas/source/vcl/canvas.cxx
index 5a44e40..30c0aeb 100644
--- a/canvas/source/vcl/canvas.cxx
+++ b/canvas/source/vcl/canvas.cxx
@@ -135,7 +135,7 @@ namespace vclcanvas
return OUString( CANVAS_SERVICE_NAME );
}
- bool Canvas::repaint( const GraphicObjectSharedPtr& rGrf,
+ bool Canvas::repaint( const rtl::Reference< GraphicObject>& rGrf,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/canvas.hxx b/canvas/source/vcl/canvas.hxx
index 10bee3b..3337651 100644
--- a/canvas/source/vcl/canvas.hxx
+++ b/canvas/source/vcl/canvas.hxx
@@ -101,7 +101,7 @@ namespace vclcanvas
virtual OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
// RepaintTarget
- virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
+ virtual bool repaint( const rtl::Reference< GraphicObject>& rGrf,
const com::sun::star::rendering::ViewState& viewState,
const com::sun::star::rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/canvasbitmap.cxx b/canvas/source/vcl/canvasbitmap.cxx
index a469e44..21c8356 100644
--- a/canvas/source/vcl/canvasbitmap.cxx
+++ b/canvas/source/vcl/canvasbitmap.cxx
@@ -101,7 +101,7 @@ namespace vclcanvas
return maCanvasHelper.getBitmap();
}
- bool CanvasBitmap::repaint( const GraphicObjectSharedPtr& rGrf,
+ bool CanvasBitmap::repaint( const rtl::Reference< GraphicObject>& rGrf,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/canvasbitmap.hxx b/canvas/source/vcl/canvasbitmap.hxx
index 176d4fa..d7bb305 100644
--- a/canvas/source/vcl/canvasbitmap.hxx
+++ b/canvas/source/vcl/canvasbitmap.hxx
@@ -84,7 +84,7 @@ namespace vclcanvas
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
// RepaintTarget interface
- virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
+ virtual bool repaint( const rtl::Reference< GraphicObject>& rGrf,
const ::com::sun::star::rendering::ViewState& viewState,
const ::com::sun::star::rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/canvascustomsprite.cxx b/canvas/source/vcl/canvascustomsprite.cxx
index 9dead83..9d6a029 100644
--- a/canvas/source/vcl/canvascustomsprite.cxx
+++ b/canvas/source/vcl/canvascustomsprite.cxx
@@ -161,7 +161,7 @@ namespace vclcanvas
mbSurfaceDirty = false;
}
- bool CanvasCustomSprite::repaint( const GraphicObjectSharedPtr& rGrf,
+ bool CanvasCustomSprite::repaint( const rtl::Reference< GraphicObject>& rGrf,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/canvascustomsprite.hxx b/canvas/source/vcl/canvascustomsprite.hxx
index 0014c3f..dd7a446 100644
--- a/canvas/source/vcl/canvascustomsprite.hxx
+++ b/canvas/source/vcl/canvascustomsprite.hxx
@@ -111,7 +111,7 @@ namespace vclcanvas
bool bBufferedUpdate ) const;
// RepaintTarget
- virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
+ virtual bool repaint( const rtl::Reference< GraphicObject>& rGrf,
const ::com::sun::star::rendering::ViewState& viewState,
const ::com::sun::star::rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index d1adb78..c611e92 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -1410,14 +1410,14 @@ namespace vclcanvas
return true;
}
- bool CanvasHelper::repaint( const GraphicObjectSharedPtr& rGrf,
+ bool CanvasHelper::repaint( const rtl::Reference< GraphicObject>& rGrf,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
const ::Point& rPt,
const ::Size& rSz,
const GraphicAttr& rAttr ) const
{
- ENSURE_OR_RETURN_FALSE( rGrf,
+ ENSURE_OR_RETURN_FALSE( rGrf.is(),
"Invalid Graphic" );
if( !mpOutDev )
diff --git a/canvas/source/vcl/canvashelper.hxx b/canvas/source/vcl/canvashelper.hxx
index 5729d60..77fdafc 100644
--- a/canvas/source/vcl/canvashelper.hxx
+++ b/canvas/source/vcl/canvashelper.hxx
@@ -264,7 +264,7 @@ namespace vclcanvas
::com::sun::star::rendering::IntegerBitmapLayout getMemoryLayout();
/// Repaint a cached bitmap
- bool repaint( const GraphicObjectSharedPtr& rGrf,
+ bool repaint( const rtl::Reference< GraphicObject>& rGrf,
const ::com::sun::star::rendering::ViewState& viewState,
const ::com::sun::star::rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/repainttarget.hxx b/canvas/source/vcl/repainttarget.hxx
index 84363da..dd45056 100644
--- a/canvas/source/vcl/repainttarget.hxx
+++ b/canvas/source/vcl/repainttarget.hxx
@@ -43,7 +43,7 @@ namespace vclcanvas
virtual ~RepaintTarget() {}
// call this when a bitmap is repainted
- virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
+ virtual bool repaint( const rtl::Reference< GraphicObject>& rGrf,
const ::com::sun::star::rendering::ViewState& viewState,
const ::com::sun::star::rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/spritecanvas.cxx b/canvas/source/vcl/spritecanvas.cxx
index c18a7f9..9dbccf9 100644
--- a/canvas/source/vcl/spritecanvas.cxx
+++ b/canvas/source/vcl/spritecanvas.cxx
@@ -154,7 +154,7 @@ namespace vclcanvas
return OUString( SPRITECANVAS_SERVICE_NAME );
}
- bool SpriteCanvas::repaint( const GraphicObjectSharedPtr& rGrf,
+ bool SpriteCanvas::repaint( const rtl::Reference< GraphicObject>& rGrf,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/canvas/source/vcl/spritecanvas.hxx b/canvas/source/vcl/spritecanvas.hxx
index 5ca1f77..18dfc97 100644
--- a/canvas/source/vcl/spritecanvas.hxx
+++ b/canvas/source/vcl/spritecanvas.hxx
@@ -135,7 +135,7 @@ namespace vclcanvas
virtual OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
// RepaintTarget
- virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
+ virtual bool repaint( const rtl::Reference< GraphicObject>& rGrf,
const ::com::sun::star::rendering::ViewState& viewState,
const ::com::sun::star::rendering::RenderState& renderState,
const ::Point& rPt,
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
index a9eb28b..d418e53 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
@@ -334,9 +334,9 @@ OUString WrappedSymbolBitmapURLProperty::getValueFromSeries( const Reference< be
if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue("Symbol") >>= aSymbol )
&& aSymbol.Graphic.is())
{
- GraphicObject aGrObj( Graphic( aSymbol.Graphic ));
+ rtl::Reference<GraphicObject> aGrObj = GraphicObject::Create( aSymbol.Graphic);
aRet = UNO_NAME_GRAPHOBJ_URLPREFIX +
- OStringToOUString(aGrObj.GetUniqueID(),
+ OStringToOUString(aGrObj->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US);
}
return aRet;
@@ -355,9 +355,9 @@ void WrappedSymbolBitmapURLProperty::setValueToSeries(
bool bMatchesPrefix = aNewGraphicURL.match( UNO_NAME_GRAPHOBJ_URLPREFIX );
if( bMatchesPrefix )
{
- GraphicObject aGrObj = GraphicObject(
+ rtl::Reference<GraphicObject> aGrObj = GraphicObject::Create(
OUStringToOString(aNewGraphicURL.copy( RTL_CONSTASCII_LENGTH(UNO_NAME_GRAPHOBJ_URLPREFIX) ), RTL_TEXTENCODING_ASCII_US));
- aSymbol.Graphic.set( aGrObj.GetGraphic().GetXGraphic());
+ aSymbol.Graphic.set( aGrObj->GetGraphic().GetXGraphic());
xSeriesPropertySet->setPropertyValue( "Symbol", uno::makeAny( aSymbol ) );
}
else
diff --git a/chart2/source/model/main/ChartModel.hxx b/chart2/source/model/main/ChartModel.hxx
index ee36ddd..298bb92 100644
--- a/chart2/source/model/main/ChartModel.hxx
+++ b/chart2/source/model/main/ChartModel.hxx
@@ -137,7 +137,7 @@ private:
::com::sun::star::awt::Size m_aVisualAreaSize;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xParent;
::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeHighlighter > m_xRangeHighlighter;
- ::std::vector< GraphicObject > m_aGraphicObjectVector;
+ ::std::vector< rtl::Reference <GraphicObject >> m_aGraphicObjectVector;
::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
/** is only valid if m_xDataProvider is set. If m_xDataProvider is set to an
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index f333f10..f131f18 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -1082,7 +1082,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickPreviewHdl)
if( !aCbxPreview.IsChecked() )
{
xMediaPlayer.clear();
- aWndPreview.SetGraphic( Graphic() );
+ aWndPreview.ClearGraphic();
aWndPreview.Invalidate();
}
else
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
index 9e8976d..97107b2 100644
--- a/cui/source/options/optmemory.cxx
+++ b/cui/source/options/optmemory.cxx
@@ -180,13 +180,11 @@ sal_Bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet& rSet )
officecfg::Office::Common::Cache::GraphicManager::ObjectReleaseTime::set(
objectReleaseTime, batch);
- // create a dummy graphic object to get access to the common GraphicManager
- GraphicObject aDummyObject;
- GraphicManager& rGrfMgr = aDummyObject.GetGraphicManager();
+ GraphicManager* pGrfMgr = GraphicManager::GetGlobalManager();
- rGrfMgr.SetMaxCacheSize(totalCacheSize);
- rGrfMgr.SetMaxObjCacheSize(objectCacheSize, true);
- rGrfMgr.SetCacheTimeout(objectReleaseTime);
+ pGrfMgr->SetMaxCacheSize(totalCacheSize);
+ pGrfMgr->SetMaxObjCacheSize(objectCacheSize, true);
+ pGrfMgr->SetCacheTimeout(objectReleaseTime);
// OLECache
officecfg::Office::Common::Cache::Writer::OLE_Objects::set(
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 2b80d10..b7fe6f8 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -1874,9 +1874,9 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
if(bGraphTransparency)
{
- const GraphicObject* pObject = rBgdAttr.GetGraphicObject();
- if(pObject)
- m_pGraphTransMF->SetValue(lcl_TransparencyToPercent(pObject->GetAttr().GetTransparency()));
+ const rtl::Reference<GraphicObject> xGraphObj = rBgdAttr.GetGraphicObject();
+ if(xGraphObj.is())
+ m_pGraphTransMF->SetValue(lcl_TransparencyToPercent(xGraphObj->GetAttr().GetTransparency()));
else
m_pGraphTransMF->SetValue(0);
m_pGraphTransMF->SaveValue();
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 833330b..0a50679 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -65,7 +65,7 @@ SvxBitmapTabPage::SvxBitmapTabPage( Window* pParent, const SfxItemSet& rInAttrs
pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
aXFStyleItem ( XFILL_BITMAP ),
- aXBitmapItem ( String(), Graphic() ),
+ aXBitmapItem (),
aXFillAttr ( pXPool ),
rXFSet ( aXFillAttr.GetItemSet() )
{
@@ -241,7 +241,7 @@ sal_Bool SvxBitmapTabPage::FillItemSet( SfxItemSet& _rOutAttrs )
}
else
{
- _rOutAttrs.Put(XFillBitmapItem(m_pBitmapCtl->GetBitmapEx());
+ _rOutAttrs.Put(XFillBitmapItem(m_pBitmapCtl->GetBitmapEx()));
}
}
}
@@ -296,12 +296,12 @@ SfxTabPage* SvxBitmapTabPage::Create( Window* pWindow,
IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
{
- GraphicObject* pGraphicObject = 0;
+ rtl::Reference<GraphicObject> xGraphicObject;
int nPos(m_pLbBitmaps->GetSelectEntryPos());
if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
- pGraphicObject = new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
+ xGraphicObject = GraphicObject::Create(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
}
else
{
@@ -313,27 +313,27 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
if((XFILL_BITMAP == eXFS) && (SFX_ITEM_SET == rOutAttrs.GetItemState(GetWhich(XATTR_FILLBITMAP), true, &pPoolItem)))
{
- pGraphicObject = new GraphicObject(((const XFillBitmapItem*)pPoolItem)->GetGraphicObject());
+ xGraphicObject = GraphicObject::Create(((const XFillBitmapItem*)pPoolItem)->GetGraphicObject());
}
}
- if(!pGraphicObject)
+ if(!xGraphicObject.is())
{
m_pLbBitmaps->SelectEntryPos(0);
nPos = m_pLbBitmaps->GetSelectEntryPos();
if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
- pGraphicObject = new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
+ xGraphicObject = GraphicObject::Create(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
}
}
}
- if(pGraphicObject)
+ if(xGraphicObject.is())
{
BitmapColor aBack;
BitmapColor aFront;
- bool bIs8x8(isHistorical8x8(pGraphicObject->GetGraphic().GetBitmap(), aBack, aFront));
+ bool bIs8x8(isHistorical8x8(xGraphicObject->GetGraphic().GetBitmap(), aBack, aFront));
m_pLbColor->SetNoSelection();
m_pLbBackgroundColor->SetNoSelection();
@@ -347,7 +347,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
// setting the pixel control
- m_pCtlPixel->SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx());
+ m_pCtlPixel->SetXBitmap(xGraphicObject->GetGraphic().GetBitmapEx());
Color aPixelColor = aFront;
Color aBackColor = aBack;
@@ -388,14 +388,13 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
m_pCtlPixel->Invalidate();
// display bitmap
- const XFillBitmapItem aXBmpItem(*pGraphicObject);
+ const XFillBitmapItem aXBmpItem(xGraphicObject);
rXFSet.Put( aXBmpItem );
m_pCtlPreview->SetAttributes( aXFillAttr.GetItemSet() );
m_pCtlPreview->Invalidate();
bBmpChanged = sal_False;
- delete pGraphicObject;
}
return 0;
@@ -518,7 +517,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl)
{
const BitmapEx aBitmapEx(m_pBitmapCtl->GetBitmapEx());
- pEntry = new XBitmapEntry(Graphic(aBitmapEx), aName);
+ pEntry = new XBitmapEntry(GraphicObject::Create(Graphic(aBitmapEx)), aName);
}
else // it must be a not existing imported bitmap
{
@@ -625,7 +624,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
if( !nError )
{
- XBitmapEntry* pEntry = new XBitmapEntry( aGraphic, aName );
+ XBitmapEntry* pEntry = new XBitmapEntry( GraphicObject::Create(aGraphic), aName );
pBitmapList->Insert( pEntry );
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
@@ -687,7 +686,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl)
bLoop = sal_False;
const BitmapEx aBitmapEx(m_pBitmapCtl->GetBitmapEx());
- const XBitmapEntry aEntry(Graphic(aBitmapEx), aName);
+ const XBitmapEntry aEntry(GraphicObject::Create(Graphic(aBitmapEx)), aName);
m_pLbBitmaps->Modify( rStyleSettings.GetListBoxPreviewDefaultPixelSize(), aEntry, nPos );
m_pLbBitmaps->SelectEntryPos( nPos );
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 79a0aff..724c417 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -1351,15 +1351,18 @@ void OPreviewWindow::Paint( const Rectangle& rRect )
{
Window::Paint( rRect );
- if( ImplGetGraphicCenterRect( m_aGraphicObj.GetGraphic(), m_aPreviewRect ) )
+ if(m_xGraphicObj.is())
{
- const Point aPos( m_aPreviewRect.TopLeft() );
- const Size aSize( m_aPreviewRect.GetSize() );
+ if( ImplGetGraphicCenterRect( m_xGraphicObj->GetGraphic(), m_aPreviewRect ) )
+ {
+ const Point aPos( m_aPreviewRect.TopLeft() );
+ const Size aSize( m_aPreviewRect.GetSize() );
- if( m_aGraphicObj.IsAnimated() )
- m_aGraphicObj.StartAnimation( this, aPos, aSize );
- else
- m_aGraphicObj.Draw( this, aPos, aSize );
+ if( m_xGraphicObj->IsAnimated() )
+ m_xGraphicObj->StartAnimation( this, aPos, aSize );
+ else
+ m_xGraphicObj->Draw( this, aPos, aSize );
+ }
}
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index 92202ec..f9467cc 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
@@ -49,7 +49,7 @@ namespace dbaui
class OPreviewWindow : public Window
{
- GraphicObject m_aGraphicObj;
+ rtl::Reference<GraphicObject> m_xGraphicObj;
Rectangle m_aPreviewRect;
/** gets the graphic cnter rect
@@ -71,7 +71,7 @@ namespace dbaui
// window overloads
virtual void Paint(const Rectangle& rRect);
- void setGraphic(const Graphic& _rGraphic ) { m_aGraphicObj.SetGraphic(_rGraphic); }
+ void setGraphic(const Graphic& _rGraphic ) { m_xGraphicObj = GraphicObject::Create(_rGraphic); }
};
//==================================================================
// A helper class for the controls in the detail page.
diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx
index d89476c..c8afe12 100644
--- a/editeng/source/items/bulitem.cxx
+++ b/editeng/source/items/bulitem.cxx
@@ -214,7 +214,7 @@ void SvxBulletItem::SetDefaultFont_Impl()
void SvxBulletItem::SetDefaults_Impl()
{
- mxGraphicObject = rtl::Reference< GraphicObject >();
+ mxGraphicObject = GraphicObject::Create(Graphic());
nWidth = 1200; // 1.2cm
nStart = 1;
nStyle = BS_123;
@@ -287,12 +287,7 @@ int SvxBulletItem::operator==( const SfxPoolItem& rItem ) const
if( nStyle == BS_BMP )
{
- if( ( mxGraphicObject.is() && !rBullet.mxGraphicObject.is() ) ||
- ( !mxGraphicObject.is() && rBullet.mxGraphicObject.is() ) )
- return 0;
-
- if( ( mxGraphicObject.is() && rBullet.mxGraphicObject.is() ) &&
- ( ( mxGraphicObject.get() != rBullet.mxGraphicObject.get() ) ||
+ if( ( ( mxGraphicObject.get() != rBullet.mxGraphicObject.get() ) ||
( mxGraphicObject->GetPrefSize() != rBullet.mxGraphicObject->GetPrefSize() ) ) )
{
return 0;
@@ -308,10 +303,9 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c
{
// Correction for empty bitmap
if( ( nStyle == BS_BMP ) &&
- ( !mxGraphicObject.is() || ( GRAPHIC_NONE == mxGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == mxGraphicObject->GetType() ) ) )
+ ( GRAPHIC_NONE == mxGraphicObject->GetType() || GRAPHIC_DEFAULT == mxGraphicObject->GetType() ) )
{
- if( mxGraphicObject.is() )
- const_cast< SvxBulletItem* >( this )->mxGraphicObject.clear();
+ const_cast< SvxBulletItem* >( this )->mxGraphicObject.clear();
const_cast< SvxBulletItem* >( this )->nStyle = BS_NONE;
}
@@ -403,13 +397,7 @@ SfxItemPresentation SvxBulletItem::GetPresentation
rtl::Reference< GraphicObject > SvxBulletItem::GetGraphicObject() const
{
- if( mxGraphicObject.is() )
- return mxGraphicObject;
- else
- {
- static const rtl::Reference< GraphicObject > xDefaultObject = GraphicObject::Create();
- return xDefaultObject;
- }
+ return mxGraphicObject;
}
//------------------------------------------------------------------------
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index a4eceeb..3aa9b47 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3602,8 +3602,10 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
{
OUString sLink;
if ( pStrLink )
+ {
sLink = *pStrLink;
- else if( pImpl->mxGraphicObject.is() )
+ }
+ else
{
OUString sPrefix(
UNO_NAME_GRAPHOBJ_URLPREFIX);
@@ -3741,8 +3743,7 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(nTmp >= 0 && nTmp <= 100)
{
pImpl->nGraphicTransparency = sal_Int8(nTmp);
- if(pImpl->mxGraphicObject.is())
- ApplyGraphicTransparency_Impl();
+ ApplyGraphicTransparency_Impl();
}
}
break;
@@ -3819,8 +3820,11 @@ SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
pStrLink = new String( *rItem.pStrLink );
if ( rItem.pStrFilter )
pStrFilter = new String( *rItem.pStrFilter );
- if ( rItem.pImpl->mxGraphicObject.is() )
- pImpl->mxGraphicObject = GraphicObject::Create( rItem.pImpl->mxGraphicObject );
+ pImpl->mxGraphicObject = GraphicObject::Create( rItem.pImpl->mxGraphicObject );
+ }
+ else
+ {
+ pImpl->mxGraphicObject = GraphicObject::Create( Graphic() );
}
nShadingValue = rItem.nShadingValue;
@@ -3858,11 +3862,7 @@ int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
if ( bEqual && !rCmp.pStrLink )
{
- if ( !rCmp.pImpl->mxGraphicObject.is() )
- bEqual = !pImpl->mxGraphicObject.is();
- else
- bEqual = pImpl->mxGraphicObject.is() &&
- ( *pImpl->mxGraphicObject.get() == *rCmp.pImpl->mxGraphicObject.get() );
+ bEqual = *pImpl->mxGraphicObject.get() == *rCmp.pImpl->mxGraphicObject.get();
}
}
@@ -3900,17 +3900,25 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ )
sal_uInt16 nDoLoad = 0;
- if ( pImpl->mxGraphicObject.is() && !pStrLink )
+ if ( !pStrLink )
+ {
nDoLoad |= LOAD_GRAPHIC;
- if ( pStrLink )
+ }
+ else
+ {
nDoLoad |= LOAD_LINK;
+ }
if ( pStrFilter )
+ {
nDoLoad |= LOAD_FILTER;
+ }
rStream << nDoLoad;
- if ( pImpl->mxGraphicObject.is() && !pStrLink )
+ if ( !pStrLink )
+ {
rStream << pImpl->mxGraphicObject->GetGraphic();
- if ( pStrLink )
+ }
+ else
{
OSL_FAIL("No BaseURL!");
// TODO/MBA: how to get a BaseURL?!
@@ -3937,7 +3945,7 @@ void SvxBrushItem::PurgeMedium() const
// -----------------------------------------------------------------------
rtl::Reference< GraphicObject > SvxBrushItem::GetGraphicObject() const
{
- if ( bLoadAgain && pStrLink && !pImpl->mxGraphicObject.is() )
+ if ( bLoadAgain && pStrLink )
// when graphics already loaded, use as a cache
{
// only with "valid" names - empty names now allowed
@@ -3978,7 +3986,7 @@ rtl::Reference< GraphicObject > SvxBrushItem::GetGraphicObject() const
const Graphic* SvxBrushItem::GetGraphic() const
{
rtl::Reference< GraphicObject > xGrafObj = GetGraphicObject();
- return xGrafObj.is() ? &( xGrafObj->GetGraphic() ) : NULL;
+ return &( xGrafObj->GetGraphic());
}
// -----------------------------------------------------------------------
@@ -3992,11 +4000,12 @@ void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew )
pImpl->mxGraphicObject.clear();
DELETEZ( pStrLink );
DELETEZ( pStrFilter );
+ pImpl->mxGraphicObject = GraphicObject::Create(Graphic()); // Creating a dummy
}
else
{
if ( !pImpl->mxGraphicObject.is() && !pStrLink )
- pImpl->mxGraphicObject = GraphicObject::Create(); // Creating a dummy
+ pImpl->mxGraphicObject = GraphicObject::Create(Graphic()); // Creating a dummy
}
}
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 1713b63..b83eaab 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -463,8 +463,8 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::Prope
{
if( NULL == aFmt.GetBrush() )
{
- rtl::Reference< GraphicObject > xGrafObj = GraphicObject::Create();
- SvxBrushItem aBrushItem( xGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
+ rtl::Reference< GraphicObject > xGrafObj = rtl::Reference< GraphicObject >();
+ SvxBrushItem aBrushItem( rtl::Reference< GraphicObject >(), GPOS_AREA, SID_ATTR_BRUSH );
aFmt.SetGraphicBrush( &aBrushItem );
}
}
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index b8df2b0..ccfc96e 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1287,10 +1287,10 @@ sal_Bool EscherPropertyContainer::CreateOLEGraphicProperties(
return bRetValue;
}
-sal_Bool EscherPropertyContainer::CreateGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, const GraphicObject& rGraphicObj )
+sal_Bool EscherPropertyContainer::CreateGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, const rtl::Reference<GraphicObject>& rGraphicObj )
{
sal_Bool bRetValue = sal_False;
- OString aUniqueId( rGraphicObj.GetUniqueID() );
+ OString aUniqueId( rGraphicObj->GetUniqueID() );
if ( !aUniqueId.isEmpty() )
{
AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
@@ -4238,7 +4238,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
sal_Bool bUseNativeGraphic( sal_False );
- Graphic aGraphic( mxGraphicObject->GetTransformedGraphic( pGraphicAttr ) );
+ Graphic aGraphic( xGraphicObject->GetTransformedGraphic( pGraphicAttr ) );
GfxLink aGraphicLink;
SvMemoryStream aStream;
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 6110458..cf18bae 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6132,8 +6132,8 @@ sal_Bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, Rectangle* p
{
/* if this entry is available, then it should be possible
to get the Graphic via GraphicObject */
- GraphicObject aGraphicObject( iter->second );
- rData = aGraphicObject.GetGraphic();
+ rtl::Reference <GraphicObject> xGraphicObject = GraphicObject::Create( iter->second );
+ rData = xGraphicObject->GetGraphic();
if ( rData.GetType() != GRAPHIC_NONE )
bOk = sal_True;
else
@@ -6190,8 +6190,8 @@ sal_Bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rData, Rectangle* p
if ( bOk )
{
// create new BlipCacheEntry for this graphic
- GraphicObject aGraphicObject( rData );
- aEscherBlipCache.insert(std::make_pair(nIdx_,aGraphicObject.GetUniqueID()));
+ rtl::Reference<GraphicObject> xGraphicObject = GraphicObject::Create( rData );
+ aEscherBlipCache.insert(std::make_pair(nIdx_, xGraphicObject->GetUniqueID()));
}
}
}
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 41307b7..9ef91fd 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -7355,7 +7355,7 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell )
const XFillBitmapItem aXFillBitmapItem((const XFillBitmapItem&)pObj->GetMergedItem( XATTR_FILLBITMAP ));
OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
aURL += OStringToOUString(
- aXFillBitmapItem.GetGraphicObject().GetUniqueID(),
+ aXFillBitmapItem.GetGraphicObject()->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US);
xPropSet->setPropertyValue("FillBitmapURL", Any( aURL ) );
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index e21805a..68e36f4 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -1052,7 +1052,7 @@ public:
EscherBlibEntry(
sal_uInt32 nPictureOffset,
- const GraphicObject& rObj,
+ const rtl::Reference<GraphicObject>& rObj,
const OString& rId,
const GraphicAttr* pAttr = NULL
);
@@ -1233,7 +1233,7 @@ public:
);
sal_Bool CreateGraphicProperties(
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
- const GraphicObject& rGraphicObj
+ const rtl::Reference<GraphicObject>& rGraphicObj
);
sal_Bool CreateMediaGraphicProperties(
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXMediaObject
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index f7e9da3..0c8da67 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -153,13 +153,13 @@ public:
mnGPercent != 0 || mnBPercent != 0 || mfGamma != 1.0 || mbInvert );
}
- friend SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr );
- friend SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr );
+ friend SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr );
+ friend SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr );
};
typedef ::cppu::WeakImplHelper1< css::graphic::XGraphicObject > GraphicObject_BASE;
-class SVT_DLLPUBLIC GraphicObject : public SvDataCopyStream, public GraphicObject_BASE
+class SVT_DLLPUBLIC GraphicObject : public GraphicObject_BASE
{
friend class GraphicManager;
sal_uInt32 nRefCount;
@@ -196,10 +196,8 @@ public: // only for internal access:
}
static rtl::Reference< GraphicObject > Create( const rtl::Reference< GraphicObject > &xCacheObj )
{
- if( xCacheObj.is() )
- return rtl::Reference< GraphicObject >( new GraphicObject( *xCacheObj.get() ) );
- else
- return rtl::Reference< GraphicObject >();
+ assert(xCacheObj.is());
+ return rtl::Reference< GraphicObject >( new GraphicObject( *xCacheObj.get() ) );
}
static rtl::Reference< GraphicObject > Create( const OString& rUniqueID )
{
@@ -351,9 +349,9 @@ protected:
virtual void GraphicManagerDestroyed();
virtual SvStream* GetSwapStream() const;
- virtual void Load( SvStream& );
- virtual void Save( SvStream& );
- virtual void Assign( const SvDataCopyStream& );
+// virtual void Load( SvStream& );
+// virtual void Save( SvStream& );
+// virtual void Assign( const SvDataCopyStream& );
public:
TYPEINFO();
@@ -522,9 +520,8 @@ public:
void StopAnimation( OutputDevice* pOut = NULL, long nExtraData = 0L );
- friend SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj );
- friend SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj );
-
+// friend SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj );
+// friend SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj );
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
@@ -553,7 +550,8 @@ class SVT_DLLPUBLIC GraphicManager
private:
/// GraphicManager is a singleton
- static GraphicManager *pGlobalManager;
+ /// FIXME: make sure it is initialized as such, thread-safely
+ static GraphicManager* mpGlobalManager;
GraphicObjectList_impl maObjList;
GraphicCache* mpCache;
@@ -667,6 +665,17 @@ public:
const sal_uLong nFlags,
sal_Bool& rCached
);
+ static void InitGlobal();
+ static GraphicManager * GetGlobalManager()
+ {
+ /* FIXME: this is racy */
+ if(!GraphicManager::mpGlobalManager)
+ {
+ GraphicManager::InitGlobal();
+ };
+ return GraphicManager::mpGlobalManager;
+ }
+ static void SetGlobalManager(GraphicManager* pMgr) { GraphicManager::mpGlobalManager = pMgr; }
};
#endif // _GRFMGR_HXX
diff --git a/include/svx/extedit.hxx b/include/svx/extedit.hxx
index a2580ed..ea8273e 100644
--- a/include/svx/extedit.hxx
+++ b/include/svx/extedit.hxx
@@ -20,14 +20,14 @@
class SVX_DLLPUBLIC ExternalToolEdit
{
public:
- GraphicObject* m_pGraphicObject;
+ rtl::Reference<GraphicObject> m_xGraphicObject;
OUString m_aFileName;
ExternalToolEdit();
virtual ~ExternalToolEdit();
virtual void Update( Graphic& aGraphic ) = 0;
- void Edit( GraphicObject *pGraphic );
+ void Edit( rtl::Reference<GraphicObject> xGraphicObj );
DECL_LINK( StartListeningEvent, void *pEvent );
diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx
index 5851b52..9f1ae8b 100644
--- a/include/svx/galctrl.hxx
+++ b/include/svx/galctrl.hxx
@@ -74,8 +74,9 @@ public:
GalleryPreview( Window* pParent, const ResId& rResId );
~GalleryPreview();
- void SetGraphic( const Graphic& rGraphic ) { mxGraphicObj->SetGraphic( rGraphic ); }
+ void ClearGraphic();
bool SetGraphic( const INetURLObject& );
+ bool SetGraphic( Graphic& rGraphic );
void PreviewMedia( const INetURLObject& rURL );
};
diff --git a/include/svx/grfflt.hxx b/include/svx/grfflt.hxx
index 8557c12..15dcb34 100644
--- a/include/svx/grfflt.hxx
+++ b/include/svx/grfflt.hxx
@@ -52,7 +52,7 @@ class SVX_DLLPUBLIC SvxGraphicFilter
{
public:
- static sal_uLong ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject );
+ static sal_uLong ExecuteGrfFilterSlot( SfxRequest& rReq, Graphic** pFilterObject );
static void DisableGraphicFilterSlots( SfxItemSet& rSet );
};
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 49a5824..2278cbc 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -80,7 +80,7 @@ private:
OUString aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
OUString aFilterName;
- rtl::Reference< GraphicObject> mxGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
+ mutable 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.
diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx
index 5476393..2354b14 100644
--- a/include/svx/xbtmpit.hxx
+++ b/include/svx/xbtmpit.hxx
@@ -43,7 +43,7 @@ private:
public:
TYPEINFO();
- XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) { mxGraphicObject = GraphicObject::Create(); }
+ XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) { mxGraphicObject = rtl::Reference< GraphicObject >(); }
explicit XFillBitmapItem(const Graphic & rGraphic);
explicit XFillBitmapItem(const BitmapEx & rBitmapEx);
explicit XFillBitmapItem(const rtl::Reference< GraphicObject > & xGraphicObject);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7d08cab..a6c5937 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -419,10 +419,13 @@ OUString DrawingML::WriteImage( const OUString& rURL )
if ( index != -1 )
{
DBG(printf ("begin: %ld %s\n", long( sizeof( aURLBegin ) ), USS( rURL ) + RTL_CONSTASCII_LENGTH( aURLBegin ) ));
- Graphic aGraphic = GraphicObject( aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)) ).GetTransformedGraphic ();
+ rtl::Reference<GraphicObject> xGraphicObj = GraphicObject::Create(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)));
+ Graphic aGraphic = xGraphicObj->GetTransformedGraphic();
return WriteImage( aGraphic );
- } else {
+ }
+ else
+ {
// add link to relations
}
@@ -433,9 +436,9 @@ const char* DrawingML::GetComponentDir()
{
switch ( meDocumentType )
{
- case DOCUMENT_DOCX: return "word";
- case DOCUMENT_PPTX: return "ppt";
- case DOCUMENT_XLSX: return "xl";
+ case DOCUMENT_DOCX: return "word";
+ case DOCUMENT_PPTX: return "ppt";
+ case DOCUMENT_XLSX: return "xl";
}
return "unknown";
@@ -445,9 +448,9 @@ const char* DrawingML::GetRelationCompPrefix()
{
switch ( meDocumentType )
{
- case DOCUMENT_DOCX: return "";
- case DOCUMENT_PPTX:
- case DOCUMENT_XLSX: return "../";
+ case DOCUMENT_DOCX: return "";
+ case DOCUMENT_PPTX:
+ case DOCUMENT_XLSX: return "../";
}
return "unknown";
@@ -459,59 +462,64 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
OUString sMediaType;
const char* pExtension = "";
OUString sRelId;
-
+ GraphicType aType;
SvMemoryStream aStream;
const void* aData = aLink.GetData();
sal_Size nDataSize = aLink.GetDataSize();
- switch ( aLink.GetType() ) {
- case GFX_LINK_TYPE_NATIVE_GIF:
- sMediaType = "image/gif";
- pExtension = ".gif";
- break;
- case GFX_LINK_TYPE_NATIVE_JPG:
- sMediaType = "image/jpeg";
- pExtension = ".jpeg";
- break;
- case GFX_LINK_TYPE_NATIVE_PNG:
+ switch ( aLink.GetType() )
+ {
+ case GFX_LINK_TYPE_NATIVE_GIF:
+ sMediaType = "image/gif";
+ pExtension = ".gif";
+ break;
+ case GFX_LINK_TYPE_NATIVE_JPG:
+ sMediaType = "image/jpeg";
+ pExtension = ".jpeg";
+ break;
+ case GFX_LINK_TYPE_NATIVE_PNG:
+ sMediaType = "image/png";
+ pExtension = ".png";
+ break;
+ case GFX_LINK_TYPE_NATIVE_TIF:
+ sMediaType = "image/tiff";
+ pExtension = ".tiff";
+ break;
+ case GFX_LINK_TYPE_NATIVE_WMF:
+ sMediaType = "image/x-wmf";
+ pExtension = ".wmf";
+ break;
+ case GFX_LINK_TYPE_NATIVE_MET:
+ sMediaType = "image/x-met";
+ pExtension = ".met";
+ break;
+ case GFX_LINK_TYPE_NATIVE_PCT:
+ sMediaType = "image/x-pict";
+ pExtension = ".pct";
+ break;
+ default:
+ aType = rGraphic.GetType();
+ if ( aType == GRAPHIC_BITMAP )
+ {
+ GraphicConverter::Export( aStream, rGraphic, CVT_PNG );
sMediaType = "image/png";
pExtension = ".png";
+ }
+ else if( aType == GRAPHIC_GDIMETAFILE )
+ {
+ GraphicConverter::Export( aStream, rGraphic, CVT_EMF );
+ sMediaType = "image/x-emf";
+ pExtension = ".emf";
+ }
+ else
+ {
+ OSL_TRACE( "unhandled graphic type" );
break;
- case GFX_LINK_TYPE_NATIVE_TIF:
- sMediaType = "image/tiff";
- pExtension = ".tiff";
- break;
- case GFX_LINK_TYPE_NATIVE_WMF:
- sMediaType = "image/x-wmf";
- pExtension = ".wmf";
- break;
- case GFX_LINK_TYPE_NATIVE_MET:
- sMediaType = "image/x-met";
- pExtension = ".met";
- break;
- case GFX_LINK_TYPE_NATIVE_PCT:
- sMediaType = "image/x-pict";
- pExtension = ".pct";
- break;
- default: {
- GraphicType aType = rGraphic.GetType();
- if ( aType == GRAPHIC_BITMAP ) {
- GraphicConverter::Export( aStream, rGraphic, CVT_PNG );
- sMediaType = "image/png";
- pExtension = ".png";
- } else if ( aType == GRAPHIC_GDIMETAFILE ) {
- GraphicConverter::Export( aStream, rGraphic, CVT_EMF );
- sMediaType = "image/x-emf";
- pExtension = ".emf";
- } else {
- OSL_TRACE( "unhandled graphic type" );
- break;
- }
+ }
- aData = aStream.GetData();
- nDataSize = aStream.GetEndOfData();
- break;
- }
+ aData = aStream.GetData();
+ nDataSize = aStream.GetEndOfData();
+ break;
}
Reference< XOutputStream > xOutStream = mpFB->openFragmentStream( OUStringBuffer()
@@ -617,7 +625,7 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sUR
void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, const OUString& rURL )
{
- Size aOriginalSize( GraphicObject::CreateGraphicObjectFromURL( rURL ).GetPrefSize() );
+ Size aOriginalSize( GraphicObject::CreateGraphicObjectFromURL( rURL )->GetPrefSize() );
if ( GetProperty( rXPropSet, "GraphicCrop" ) )
{
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index 6276575..9b295b6 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -59,7 +59,7 @@ public:
aStr.Append( sal_Unicode(' ') );
aStr.Append( String( "External Edit" ) );
m_pView->BegUndo( aStr );
- pNewObj->SetGraphicObject( aGraphic );
+ pNewObj->SetGraphicObject( GraphicObject::Create(aGraphic) );
m_pView->ReplaceObjectAtView( m_pObj, *pPageView, pNewObj );
m_pView->EndUndo();
}
@@ -135,10 +135,10 @@ void ScGraphicShell::ExecuteFilter( SfxRequest& rReq )
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
- GraphicObject aFilterObj( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+ Graphic* pFilterObj = new Graphic( ( (SdrGrafObj*) pObj )->GetGraphicObject()->GetGraphic() );
if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, &pFilterObj ) )
{
SdrPageView* pPageView = pView->GetSdrPageView();
@@ -150,11 +150,12 @@ void ScGraphicShell::ExecuteFilter( SfxRequest& rReq )
aStr.Append( sal_Unicode(' ') );
aStr.Append( String( ScResId( SCSTR_UNDO_GRAFFILTER ) ) );
pView->BegUndo( aStr );
- pFilteredObj->SetGraphicObject( aFilterObj );
+ pFilteredObj->SetGraphicObject( GraphicObject::Create(*pFilterObj ));
pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
pView->EndUndo();
}
}
+ delete pFilterObj;
}
}
@@ -189,9 +190,9 @@ void ScGraphicShell::ExecuteExternalEdit( SfxRequest& )
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
- GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+ rtl::Reference<GraphicObject> xGraphicObject = ( (SdrGrafObj*) pObj )->GetGraphicObject();
ScExternalToolEdit* aExternalToolEdit = new ScExternalToolEdit( pView, pObj );
- aExternalToolEdit->Edit( &aGraphicObject );
+ aExternalToolEdit->Edit( xGraphicObject );
}
}
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index e7fa2bb..8d0f1f8 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1146,10 +1146,10 @@ static void lcl_DrawGraphic( const SvxBrushItem &rBrush, OutputDevice *pOut, Out
// (pixel rounding is handled correctly, and a very small bitmap
// is duplicated into a bigger one for better performance)
- GraphicObject aObject( *pGraphic );
+ rtl::Reference<GraphicObject> xObject = GraphicObject::Create( *pGraphic );
if( pOut->GetPDFWriter() &&
- (aObject.GetType() == GRAPHIC_BITMAP || aObject.GetType() == GRAPHIC_DEFAULT) )
+ (xObject->GetType() == GRAPHIC_BITMAP || xObject->GetType() == GRAPHIC_DEFAULT) )
{
// For PDF export, every draw
// operation for bitmaps takes a noticeable
@@ -1178,13 +1178,13 @@ static void lcl_DrawGraphic( const SvxBrushItem &rBrush, OutputDevice *pOut, Out
const Size aSize( rOrg.GetSize() );
const double Abitmap( k1/k2 * aSize.Width()*aSize.Height() );
- aObject.DrawTiled( pOut, rOrg, aGrfSize, Size(0,0),
+ xObject->DrawTiled( pOut, rOrg, aGrfSize, Size(0,0),
NULL, GRFMGR_DRAW_STANDARD,
::std::max( 128, static_cast<int>( sqrt(sqrt( Abitmap)) + .5 ) ) );
}
else
{
- aObject.DrawTiled( pOut, rOrg, aGrfSize, Size(0,0) );
+ xObject->DrawTiled( pOut, rOrg, aGrfSize, Size(0,0) );
}
bDraw = false;
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 6954913..9c17c1d 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -168,7 +168,7 @@ void SdDrawDocument::CreateLayoutTemplates()
Color aNullColor( COL_WHITE );
Bitmap aNullBmp( aNullSize, 8 );
aNullBmp.Erase( aNullColor );
- rISet.Put(XFillBitmapItem(pPool, Graphic(aNullBmp)));
+ rISet.Put(XFillBitmapItem(pPool, GraphicObject::Create(Graphic(aNullBmp))));
// Shadow attributes (Drawing Engine)
rISet.Put(SdrShadowItem(sal_False));
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 7a0ebb7..5741125 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -118,8 +118,8 @@ sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicS
if ( !rUniqueId.isEmpty() )
{
Rectangle aRect;
- GraphicObject aGraphicObject( rUniqueId );
- Graphic aMappedGraphic, aGraphic( aGraphicObject.GetGraphic() );
+ rtl::Reference<GraphicObject> xGraphicObject = GraphicObject::Create( rUniqueId );
+ Graphic aMappedGraphic, aGraphic( xGraphicObject->GetGraphic() );
Size aPrefSize( aGraphic.GetPrefSize() );
BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
@@ -144,10 +144,10 @@ sal_uInt16 PPTExBulletProvider::GetId( const OString& rUniqueId, Size& rGraphicS
rGraphicSize = aNewSize;
aMappedGraphic = Graphic( aBmpEx );
- aGraphicObject = GraphicObject( aMappedGraphic );
+ xGraphicObject = GraphicObject::Create( aMappedGraphic );
}
}
- sal_uInt32 nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aRect, NULL, NULL );
+ sal_uInt32 nId = pGraphicProv->GetBlibID( aBuExPictureStream, xGraphicObject->GetUniqueID(), aRect, NULL, NULL );
if ( nId && ( nId < 0x10000 ) )
nRetValue = (sal_uInt16)nId - 1;
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index abae128..6b159d7 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -294,7 +294,7 @@ const SfxItemSet* FuPage::ExecuteDialog( Window* pParent )
// MigrateItemSet makes sure the XFillBitmapItem will have a unique name
SfxItemSet aMigrateSet( mpDoc->GetPool(), XATTR_FILLBITMAP, XATTR_FILLBITMAP );
- aMigrateSet.Put(XFillBitmapItem(OUString("background"), aGraphic));
+ aMigrateSet.Put(XFillBitmapItem(OUString("background"), GraphicObject::Create(aGraphic)));
mpDoc->MigrateItemSet( &aMigrateSet, pTempSet.get(), NULL );
pTempSet->Put( XFillBmpStretchItem( sal_True ));
diff --git a/sd/source/ui/view/GraphicObjectBar.cxx b/sd/source/ui/view/GraphicObjectBar.cxx
index aed500b..bf8004c 100644
--- a/sd/source/ui/view/GraphicObjectBar.cxx
+++ b/sd/source/ui/view/GraphicObjectBar.cxx
@@ -144,10 +144,10 @@ void GraphicObjectBar::ExecuteFilter( SfxRequest& rReq )
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
- GraphicObject aFilterObj( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+ Graphic* pFilterObj = new Graphic( ( (SdrGrafObj*) pObj )->GetGraphicObject()->GetGraphic() );
if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, &pFilterObj ) )
{
SdrPageView* pPageView = mpView->GetSdrPageView();
@@ -159,13 +159,14 @@ void GraphicObjectBar::ExecuteFilter( SfxRequest& rReq )
aStr.Append( sal_Unicode(' ') );
aStr.Append( String( SdResId( STR_UNDO_GRAFFILTER ) ) );
mpView->BegUndo( aStr );
- pFilteredObj->SetGraphicObject( aFilterObj );
+ pFilteredObj->SetGraphicObject( GraphicObject::Create(*pFilterObj ));
::sd::View* const pView = mpView;
pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
pView->EndUndo();
return;
}
}
+ delete pFilterObj;
}
}
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 835cc93..300262b 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -194,7 +194,7 @@ public:
aStr.Append( sal_Unicode(' ') );
aStr.Append( String( "External Edit" ) );
m_pView->BegUndo( aStr );
- pNewObj->SetGraphicObject( aGraphic );
+ pNewObj->SetGraphicObject( GraphicObject::Create(aGraphic) );
m_pView->ReplaceObjectAtView( m_pObj, *pPageView, pNewObj );
m_pView->EndUndo();
}
@@ -970,9 +970,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
- GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+ rtl::Reference<GraphicObject> xGraphicObject = ( (SdrGrafObj*) pObj )->GetGraphicObject();
{
- GraphicHelper::ExportGraphic( aGraphicObject.GetGraphic(), String("") );
+ GraphicHelper::ExportGraphic( xGraphicObject->GetGraphic(), String("") );
}
}
}
@@ -989,9 +989,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
- GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+ rtl::Reference<GraphicObject> xGraphicObject = ( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
SdExternalToolEdit* aExternalToolEdit = new SdExternalToolEdit( mpDrawView, pObj );
- aExternalToolEdit->Edit( &aGraphicObject );
+ aExternalToolEdit->Edit( xGraphicObject );
}
}
Cancel();
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index cdbe0ae..b3c0793 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -756,7 +756,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper,
// If we have a graphic as source object, use it's graphic
// content as fill style
aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(&mrDoc.GetPool(), pSdrGrafObj->GetGraphic()));
+ aSet.Put(XFillBitmapItem(&mrDoc.GetPool(), GraphicObject::Create(pSdrGrafObj->GetGraphic())));
}
pPickObj->SetMergedItemSetAndBroadcast( aSet );
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 067b677..49ee09d 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -151,7 +151,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), rGraphic));
+ aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), GraphicObject::Create(rGraphic)));
pPickObj->SetMergedItemSetAndBroadcast(aSet);
}
}
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx
index 6c958a0..c07ca00 100644
--- a/slideshow/source/engine/shapes/shapeimporter.cxx
+++ b/slideshow/source/engine/shapes/shapeimporter.cxx
@@ -64,8 +64,8 @@ namespace internal {
namespace {
bool importShapeGraphic(
- GraphicObject & o_rGraphic,
- uno::Reference<beans::XPropertySet> const& xPropSet )
+ rtl::Reference<GraphicObject> & o_rGraphic,
+ uno::Reference<beans::XPropertySet> const& xPropSet )
{
OUString aURL;
if( !getPropertyValue( aURL, xPropSet, "GraphicURL") ||
@@ -103,11 +103,11 @@ bool importShapeGraphic(
// fetch already loaded graphic from graphic manager.
OString const aOldString(OUStringToOString(aUniqueId,
RTL_TEXTENCODING_UTF8));
- o_rGraphic = GraphicObject( aOldString );
+ o_rGraphic = GraphicObject::Create( aOldString );
- if( GRAPHIC_DEFAULT == o_rGraphic.GetType()
- || GRAPHIC_NONE == o_rGraphic.GetType() )
+ if( GRAPHIC_DEFAULT == o_rGraphic->GetType()
+ || GRAPHIC_NONE == o_rGraphic->GetType() )
{
// even the GrfMgr does not seem to know this graphic
return false;
@@ -138,7 +138,7 @@ bool importShapeGraphic(
return false;
}
- o_rGraphic = GraphicObject( aTmpGraphic );
+ o_rGraphic = GraphicObject::Create( aTmpGraphic );
}
return true;
}
@@ -329,18 +329,18 @@ ShapeSharedPtr ShapeImporter::createShape(
}
else if( shapeType == "com.sun.star.drawing.GraphicObjectShape" || shapeType == "com.sun.star.presentation.GraphicObjectShape" )
{
- GraphicObject aGraphicObject;
+ rtl::Reference<GraphicObject> xGraphicObject;
// to get hold of GIF animations, inspect Graphic
// objects more thoroughly (the plain-jane shape
// metafile of course would only contain the first
// animation frame)
- if( !importShapeGraphic( aGraphicObject, xPropSet ) )
+ if( !importShapeGraphic( xGraphicObject, xPropSet ) )
return ShapeSharedPtr(); // error loading graphic -
// no placeholders in
// slideshow
- if( !aGraphicObject.IsAnimated() )
+ if( !xGraphicObject->IsAnimated() )
{
// no animation - simply utilize plain draw shape import
@@ -403,9 +403,9 @@ ShapeSharedPtr ShapeImporter::createShape(
// ---------------------------------------------
Graphic aGraphic(
- aGraphicObject.GetTransformedGraphic(
- aGraphicObject.GetPrefSize(),
- aGraphicObject.GetPrefMapMode(),
+ xGraphicObject->GetTransformedGraphic(
+ xGraphicObject->GetPrefSize(),
+ xGraphicObject->GetPrefMapMode(),
aGraphAttrs ) );
return DrawShape::create( xCurrShape,
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 5a286a9..fe24069 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -48,7 +48,7 @@ using com::sun::star::uno::RuntimeException;
using com::sun::star::container::XNameContainer;
using com::sun::star::beans::XPropertySet;
-GraphicManager* GraphicObject::mpGlobalMgr = NULL;
+GraphicManager* GraphicManager::mpGlobalManager = NULL;
struct GrfSimpleCacheObj
{
@@ -81,7 +81,6 @@ GraphicObject::GraphicObject( const Graphic& rGraphic ) :
}
GraphicObject::GraphicObject( const GraphicObject& rGraphicObj ) :
- SvDataCopyStream(),
maGraphic ( rGraphicObj.GetGraphic() ),
maAttr ( rGraphicObj.maAttr ),
mpLink ( rGraphicObj.mpLink ? ( new String( *rGraphicObj.mpLink ) ) : NULL ),
@@ -192,25 +191,24 @@ void GraphicObject::ImplAssignGraphicData()
mnAnimationLoopCount = ( mbAnimated ? maGraphic.GetAnimationLoopCount() : 0 );
}
-void GraphicObject::ImplSetup( const OString* pID )
+void GraphicManager::InitGlobal()
{
- GraphicManager *pGlobalMgr;
+ GraphicManager* pMgr = new GraphicManager(
+ (officecfg::Office::Common::Cache::GraphicManager::
+ TotalCacheSize::get()),
+ (officecfg::Office::Common::Cache::GraphicManager::
+ ObjectCacheSize::get()));
+ pMgr->SetCacheTimeout(
+ officecfg::Office::Common::Cache::GraphicManager::
+ ObjectReleaseTime::get());
+ GraphicManager::SetGlobalManager(pMgr);
+}
- if ( ! ( pGlobalMgr = GraphicManager::pGlobalManager ) )
- {
- pGlobalMgr = new GraphicManager(
- (officecfg::Office::Common::Cache::GraphicManager::
- TotalCacheSize::get()),
- (officecfg::Office::Common::Cache::GraphicManager::
- ObjectCacheSize::get()));
- pGlobalMgr->SetCacheTimeout(
- officecfg::Office::Common::Cache::GraphicManager::
- ObjectReleaseTime::get());
- GraphicManager::pGlobalManager = pGlobalMgr;
- }
+void GraphicObject::ImplSetup( const OString* pID )
+{
// FIXME: remove this member in favour of the global eventually
- mpMgr = pGlobalMgr;
+ mpMgr = GraphicManager::GetGlobalManager();
mpMgr->ImplRegisterObj( *this, maGraphic, pID );
}
@@ -353,20 +351,10 @@ sal_Bool GraphicObject::operator==( const GraphicObject& rGraphicObj ) const
( rGraphicObj.GetLink() == GetLink() ) );
}
-void GraphicObject::Load( SvStream& rIStm )
-{
- rIStm >> *this;
-}
-
-void GraphicObject::Save( SvStream& rOStm )
-{
- rOStm << *this;
-}
-
-void GraphicObject::Assign( const SvDataCopyStream& rCopyStream )
-{
- *this = (const GraphicObject& ) rCopyStream;
-}
+//void GraphicObject::Assign( const SvDataCopyStream& rCopyStream )
+//{
+// *this = (const GraphicObject& ) rCopyStream;
+//}
OString GraphicObject::GetUniqueID() const
{
@@ -1106,10 +1094,11 @@ GraphicObject::GraphicObject( SvStream& rIStm ) :
else
SetLink();
- SetSwapStreamHdl();
+// SetSwapStreamHdl();
}
// FIXME: should we match the above create with a save method ?
+/*
SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj )
{
VersionCompat aCompat( rOStm, STREAM_WRITE, 1 );
@@ -1122,6 +1111,7 @@ SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj )
return rOStm;
}
+*/
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
@@ -1148,8 +1138,8 @@ rtl::Reference< GraphicObject > GraphicObject::CreateGraphicObjectFromURL( const
}
}
-void
-GraphicObject::InspectForGraphicObjectImageURL( const Reference< XInterface >& xIf, std::vector< OUString >& rvEmbedImgUrls )
+void GraphicObject::InspectForGraphicObjectImageURL( const Reference< XInterface >& xIf,
+ std::vector< OUString >& rvEmbedImgUrls )
{
static OUString sImageURL( "ImageURL" );
Reference< XPropertySet > xProps( xIf, UNO_QUERY );
diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index bcc79e9..1f2edb8 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -77,11 +77,12 @@ void ExternalToolEdit::threadWorker(void* pThreadData)
xSystemShellExecute->execute( pData->m_aFileName, OUString(), SystemShellExecuteFlags::URIS_ONLY );
}
-void ExternalToolEdit::Edit( GraphicObject* pGraphicObject )
+void ExternalToolEdit::Edit( rtl::Reference<GraphicObject> xGraphicObject )
{
+ assert(xGraphicObject.is());
//Get the graphic from the GraphicObject
- m_pGraphicObject = pGraphicObject;
- const Graphic aGraphic = pGraphicObject->GetGraphic();
+ m_xGraphicObject = xGraphicObject;
+ const Graphic aGraphic = xGraphicObject->GetGraphic();
//get the Preferred File Extension for this graphic
OUString fExtension;
diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx
index 74ad3d1..dc5f674 100644
--- a/svx/source/dialog/grfflt.cxx
+++ b/svx/source/dialog/grfflt.cxx
@@ -33,12 +33,11 @@
// - SvxGraphicFilter -
// --------------------
-sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject )
+sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, Graphic** ppGraphic )
{
- const Graphic& rGraphic = rFilterObject.GetGraphic();
sal_uIntPtr nRet = SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE;
-
- if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ Graphic* pGraphic = *ppGraphic;
+ if( pGraphic->GetType() == GRAPHIC_BITMAP )
{
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL;
@@ -52,16 +51,16 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
if( pShell )
pShell->SetWaitCursor( sal_True );
- if( rGraphic.IsAnimated() )
+ if( pGraphic->IsAnimated() )
{
- Animation aAnimation( rGraphic.GetAnimation() );
+ Animation aAnimation( pGraphic->GetAnimation() );
if( aAnimation.Invert() )
aGraphic = aAnimation;
}
else
{
- BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ BitmapEx aBmpEx( pGraphic->GetBitmapEx() );
if( aBmpEx.Invert() )
aGraphic = aBmpEx;
@@ -77,10 +76,10 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterSmooth( pWindow, rGraphic, 0.7, RID_SVX_GRFFILTER_DLG_SEPIA);
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterSmooth( pWindow, *pGraphic, 0.7, RID_SVX_GRFFILTER_DLG_SEPIA);
DBG_ASSERT(aDlg, "Dialogdiet fail!");
if( aDlg->Execute() == RET_OK )
- aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ aGraphic = aDlg->GetFilteredGraphic( *pGraphic, 1.0, 1.0 );
delete aDlg;
}
}
@@ -91,16 +90,16 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
if( pShell )
pShell->SetWaitCursor( sal_True );
- if( rGraphic.IsAnimated() )
+ if( pGraphic->IsAnimated() )
{
- Animation aAnimation( rGraphic.GetAnimation() );
+ Animation aAnimation( pGraphic->GetAnimation() );
if( aAnimation.Filter( BMP_FILTER_SHARPEN ) )
aGraphic = aAnimation;
}
else
{
- BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ BitmapEx aBmpEx( pGraphic->GetBitmapEx() );
if( aBmpEx.Filter( BMP_FILTER_SHARPEN ) )
aGraphic = aBmpEx;
@@ -116,16 +115,16 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
if( pShell )
pShell->SetWaitCursor( sal_True );
- if( rGraphic.IsAnimated() )
+ if( pGraphic->IsAnimated() )
{
- Animation aAnimation( rGraphic.GetAnimation() );
+ Animation aAnimation( pGraphic->GetAnimation() );
if( aAnimation.Filter( BMP_FILTER_REMOVENOISE ) )
aGraphic = aAnimation;
}
else
{
- BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ BitmapEx aBmpEx( pGraphic->GetBitmapEx() );
if( aBmpEx.Filter( BMP_FILTER_REMOVENOISE ) )
aGraphic = aBmpEx;
@@ -141,16 +140,16 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
if( pShell )
pShell->SetWaitCursor( sal_True );
- if( rGraphic.IsAnimated() )
+ if( pGraphic->IsAnimated() )
{
- Animation aAnimation( rGraphic.GetAnimation() );
+ Animation aAnimation( pGraphic->GetAnimation() );
if( aAnimation.Filter( BMP_FILTER_SOBEL_GREY ) )
aGraphic = aAnimation;
}
else
{
- BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ BitmapEx aBmpEx( pGraphic->GetBitmapEx() );
if( aBmpEx.Filter( BMP_FILTER_SOBEL_GREY ) )
aGraphic = aBmpEx;
@@ -166,10 +165,10 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterMosaic( pWindow, rGraphic, 4, 4, sal_False, RID_SVX_GRFFILTER_DLG_MOSAIC);
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterMosaic( pWindow, *pGraphic, 4, 4, sal_False, RID_SVX_GRFFILTER_DLG_MOSAIC);
DBG_ASSERT(aDlg, "Dialogdiet fail!");
if( aDlg->Execute() == RET_OK )
- aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ aGraphic = aDlg->GetFilteredGraphic( *pGraphic, 1.0, 1.0 );
delete aDlg;
}
}
@@ -180,10 +179,10 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterEmboss( pWindow, rGraphic, RP_MM, RID_SVX_GRFFILTER_DLG_EMBOSS );
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterEmboss( pWindow, *pGraphic, RP_MM, RID_SVX_GRFFILTER_DLG_EMBOSS );
DBG_ASSERT(aDlg, "Dialogdiet fail!");
if( aDlg->Execute() == RET_OK )
- aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ aGraphic = aDlg->GetFilteredGraphic( *pGraphic, 1.0, 1.0 );
delete aDlg;
}
}
@@ -194,10 +193,10 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterPosterSepia( pWindow, rGraphic, 16, RID_SVX_GRFFILTER_DLG_POSTER );
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterPosterSepia( pWindow, *pGraphic, 16, RID_SVX_GRFFILTER_DLG_POSTER );
DBG_ASSERT(aDlg, "Dialogdiet fail!");
if( aDlg->Execute() == RET_OK )
- aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ aGraphic = aDlg->GetFilteredGraphic( *pGraphic, 1.0, 1.0 );
delete aDlg;
}
}
@@ -208,16 +207,16 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
if( pShell )
pShell->SetWaitCursor( sal_True );
- if( rGraphic.IsAnimated() )
+ if( pGraphic->IsAnimated() )
{
- Animation aAnimation( rGraphic.GetAnimation() );
+ Animation aAnimation( pGraphic->GetAnimation() );
if( aAnimation.Filter( BMP_FILTER_POPART ) )
aGraphic = aAnimation;
}
else
{
- BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ BitmapEx aBmpEx( pGraphic->GetBitmapEx() );
if( aBmpEx.Filter( BMP_FILTER_POPART ) )
aGraphic = aBmpEx;
@@ -233,10 +232,10 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterPosterSepia( pWindow, rGraphic, 10, RID_SVX_GRFFILTER_DLG_SEPIA );
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterPosterSepia( pWindow, *pGraphic, 10, RID_SVX_GRFFILTER_DLG_SEPIA );
DBG_ASSERT(aDlg, "Dialogdiet fail!");
if( aDlg->Execute() == RET_OK )
- aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ aGraphic = aDlg->GetFilteredGraphic( *pGraphic, 1.0, 1.0 );
delete aDlg;
}
}
@@ -247,10 +246,10 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
{
- AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterSolarize( pWindow, rGraphic, 128, sal_False, RID_SVX_GRFFILTER_DLG_SOLARIZE );
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterSolarize( pWindow, *pGraphic, 128, sal_False, RID_SVX_GRFFILTER_DLG_SOLARIZE );
DBG_ASSERT(aDlg, "Dialogdiet fail!");
if( aDlg->Execute() == RET_OK )
- aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ aGraphic = aDlg->GetFilteredGraphic( *pGraphic, 1.0, 1.0 );
delete aDlg;
}
}
@@ -273,7 +272,7 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
if( aGraphic.GetType() != GRAPHIC_NONE )
{
- rFilterObject.SetGraphic( aGraphic );
+ *ppGraphic = new Graphic(aGraphic);
nRet = SVX_GRAPHICFILTER_ERRCODE_NONE;
}
}
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 7ac6425..8532202 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -804,7 +804,7 @@ void GalleryBrowser2::SetMode( GalleryBrowserMode eMode )
mpListView->Hide();
mpPreview->Hide();
- mpPreview->SetGraphic( Graphic() );
+ mpPreview->ClearGraphic();
mpPreview->PreviewMedia( INetURLObject() );
mpIconView->Show();
@@ -822,7 +822,7 @@ void GalleryBrowser2::SetMode( GalleryBrowserMode eMode )
mpIconView->Hide();
mpPreview->Hide();
- mpPreview->SetGraphic( Graphic() );
+ mpPreview->ClearGraphic();
mpPreview->PreviewMedia( INetURLObject() );
mpListView->Show();
@@ -852,7 +852,7 @@ void GalleryBrowser2::SetMode( GalleryBrowserMode eMode )
mpCurTheme->GetGraphic( nPos, aGraphic );
mpPreview->SetGraphic( aGraphic );
- mpPreview->Show();
+ mpPreview->Show();
if( mpCurTheme && mpCurTheme->GetObjectKind( nPos ) == SGA_OBJ_SOUND )
mpPreview->PreviewMedia( mpCurTheme->GetObjectURL( nPos ) );
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index 8aa10e9..a730371 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -49,7 +49,7 @@ GalleryPreview::GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme )
SetHelpId( HID_GALLERY_WINDOW );
InitSettings();
- mxGraphicObj = GraphicObject::Create();
+ mxGraphicObj = rtl::Reference< GraphicObject >();
}
GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) :
@@ -62,7 +62,7 @@ GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) :
SetHelpId( HID_GALLERY_PREVIEW );
InitSettings();
- mxGraphicObj = GraphicObject::Create();
+ mxGraphicObj = rtl::Reference< GraphicObject >();
}
GalleryPreview::~GalleryPreview()
@@ -70,6 +70,11 @@ GalleryPreview::~GalleryPreview()
DBG_DTOR(GalleryPreview,NULL);
}
+bool GalleryPreview::SetGraphic( Graphic& rGraphic )
+{
+ mxGraphicObj = GraphicObject::Create(rGraphic);
+ return true;
+};
bool GalleryPreview::SetGraphic( const INetURLObject& _aURL )
{
@@ -86,12 +91,16 @@ bool GalleryPreview::SetGraphic( const INetURLObject& _aURL )
if( rFilter.ImportGraphic( aGraphic, _aURL, GRFILTER_FORMAT_DONTKNOW ) )
bRet = false;
}
-
- SetGraphic( aGraphic );
+ mxGraphicObj = GraphicObject::Create(aGraphic);
Invalidate();
return bRet;
}
+void GalleryPreview::ClearGraphic()
+{
+ mxGraphicObj.clear();
+}
+
void GalleryPreview::InitSettings()
{
SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
@@ -143,16 +152,18 @@ sal_Bool GalleryPreview::ImplGetGraphicCenterRect( const Graphic& rGraphic, Rect
void GalleryPreview::Paint( const Rectangle& rRect )
{
Window::Paint( rRect );
-
- if( ImplGetGraphicCenterRect( mxGraphicObj->GetGraphic(), maPreviewRect ) )
+ if(mxGraphicObj.is())
{
- const Point aPos( maPreviewRect.TopLeft() );
- const Size aSize( maPreviewRect.GetSize() );
+ if( ImplGetGraphicCenterRect( mxGraphicObj->GetGraphic(), maPreviewRect ) )
+ {
+ const Point aPos( maPreviewRect.TopLeft() );
+ const Size aSize( maPreviewRect.GetSize() );
- if( mxGraphicObj->IsAnimated() )
- mxGraphicObj->StartAnimation( this, aPos, aSize );
- else
- mxGraphicObj->Draw( this, aPos, aSize );
+ if( mxGraphicObj->IsAnimated() )
+ mxGraphicObj->StartAnimation( this, aPos, aSize );
+ else
+ mxGraphicObj->Draw( this, aPos, aSize );
+ }
}
}
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 03434b8..04d2c7d 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -87,7 +87,7 @@ namespace sdr
const GraphicAttr& rLocalGrafInfo) const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- rtl::Reference< GraphicObject > xEmptyGraphicObject = GraphicObject::Create();
+ rtl::Reference< GraphicObject > xEmptyGraphicObject= rtl::Reference< GraphicObject >();
GraphicAttr aEmptyGraphicAttr;
// SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
@@ -150,7 +150,7 @@ namespace sdr
const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- rtl::Reference< GraphicObject > xEmptyGraphicObject = GraphicObject::Create();
+ rtl::Reference< GraphicObject > xEmptyGraphicObject = rtl::Reference< GraphicObject >();
GraphicAttr aEmptyGraphicAttr;
// SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
index d6cdd21..693ab61 100644
--- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -146,9 +146,9 @@ namespace drawinglayer
const SdrGrafPrimitive2D& rCompare = (SdrGrafPrimitive2D&)rPrimitive;
return (getTransform() == rCompare.getTransform()
- && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()
- && getGraphicObject() == rCompare.getGraphicObject()
- && getGraphicAttr() == rCompare.getGraphicAttr());
+ && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()
+ && getGraphicObject() == rCompare.getGraphicObject()
+ && getGraphicAttr() == rCompare.getGraphicAttr());
}
return false;
@@ -157,7 +157,7 @@ namespace drawinglayer
bool SdrGrafPrimitive2D::isTransparent() const
{
return ((0L != getGraphicAttr().GetTransparency())
- || (getGraphicObject()->IsTransparent()));
+ || (getGraphicObject().is() && getGraphicObject()->IsTransparent()));
}
// provide unique ID
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 0c596b0..e20bb77 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -379,16 +379,16 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS
{
if(aBitmapEx.IsAlpha())
{
- xGraphicObject->SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha())));
+ xGraphicObject = GraphicObject::Create(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha())));
}
else
{
- xGraphicObject->SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask())));
+ xGraphicObject = GraphicObject::Create(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask())));
}
}
else
{
- xGraphicObject->SetGraphic(Graphic(aDestBitmap));
+ xGraphicObject = GraphicObject::Create(Graphic(aDestBitmap));
}
}
}
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 6bd8406..d51ef7a 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -331,7 +331,7 @@ SdrGrafObj::SdrGrafObj()
pGraphicLink ( NULL ),
bMirrored ( false )
{
- mxGraphic = GraphicObject::Create();
+ mxGraphic = rtl::Reference<GraphicObject>();
mxGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
onGraphicChanged();
@@ -437,7 +437,7 @@ rtl::Reference< GraphicObject > SdrGrafObj::GetReplacementGraphicObject() const
void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf )
{
- mxGraphic->SetGraphic( rGrf );
+ mxGraphic = GraphicObject::Create( rGrf );
mxReplacementGraphic.clear();
mxGraphic->SetUserData();
mbIsPreview = false;
@@ -551,30 +551,27 @@ String SdrGrafObj::GetGrafStreamURL() const
void SdrGrafObj::ForceSwapIn() const
{
- if( mbIsPreview )
+ if(mxGraphic.is())
{
- // removing preview graphic
- const String aUserData( mxGraphic->GetUserData() );
-
- Graphic aEmpty;
- mxGraphic->SetGraphic( aEmpty );
- mxGraphic->SetUserData( aUserData );
- mxGraphic->SetSwapState();
-
- const_cast< SdrGrafObj* >( this )->mbIsPreview = false;
- }
- if ( pGraphicLink && mxGraphic->IsSwappedOut() )
- ImpUpdateGraphicLink( false );
- else
- mxGraphic->FireSwapInRequest();
+ if( mbIsPreview )
+ {
+ // removing preview graphic
+ mxGraphic->SetSwapState();
+ const_cast< SdrGrafObj* >( this )->mbIsPreview = false;
+ }
+ if ( pGraphicLink && mxGraphic->IsSwappedOut() )
+ ImpUpdateGraphicLink( false );
+ else
+ mxGraphic->FireSwapInRequest();
- if( mxGraphic->IsSwappedOut() ||
- ( mxGraphic->GetType() == GRAPHIC_NONE ) ||
- ( mxGraphic->GetType() == GRAPHIC_DEFAULT ) )
- {
- Graphic aDefaultGraphic;
- aDefaultGraphic.SetDefaultType();
- mxGraphic->SetGraphic( aDefaultGraphic );
+ if( mxGraphic->IsSwappedOut() ||
+ ( mxGraphic->GetType() == GRAPHIC_NONE ) ||
+ ( mxGraphic->GetType() == GRAPHIC_DEFAULT ) )
+ {
+ Graphic aDefaultGraphic;
+ aDefaultGraphic.SetDefaultType();
+ mxGraphic = GraphicObject::Create(aDefaultGraphic);
+ }
}
}
@@ -838,7 +835,7 @@ SdrGrafObj& SdrGrafObj::operator=( const SdrGrafObj& rObj )
return *this;
SdrRectObj::operator=( rObj );
- mxGraphic->SetGraphic( rObj.GetGraphic(), rObj.GetGraphicObject() );
+ mxGraphic = GraphicObject::Create(rObj.GetGraphic());
aFileName = rObj.aFileName;
aFilterName = rObj.aFilterName;
bMirrored = rObj.bMirrored;
@@ -1170,7 +1167,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier, bool bAddText ) cons
SfxItemSet aSet(GetObjectItemSet());
aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(GetTransformedGraphic().GetBitmapEx());
+ aSet.Put(XFillBitmapItem(GetTransformedGraphic().GetBitmapEx()));
aSet.Put(XFillBmpTileItem(false));
pRetval->SetMergedItemSet(aSet);
@@ -1356,7 +1353,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
{
const String aNewUserData( mxGraphic->GetUserData() );
- mxGraphic->SetGraphic( aGraphic );
+ mxGraphic = GraphicObject::Create(aGraphic);
mxGraphic->SetUserData( aNewUserData );
// Graphic successfully swapped in.
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 6f0bf40..75ccb34 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -17,10 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
- #ifndef IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
- #define IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
+#ifndef IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
+#define IDOCUMENTCONTENTOPERATIONS_HXX_INCLUDED
- #include <sal/types.h>
+#include <sal/types.h>
+#include <rtl/ref.hxx>
class SwPaM;
struct SwPosition;
@@ -115,7 +116,7 @@
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
- virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
+ virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, rtl::Reference< GraphicObject> xGrfObj, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
/** Transpose graphic (with undo)
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 854b869..4b16a93 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -868,7 +868,7 @@ public:
virtual bool UpdateRsid( const SwPaM &rRg, xub_StrLen nLen );
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const String& rGrfName, const String& rFltName, const Graphic* pGraphic,
const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
- virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
+ virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, rtl::Reference< GraphicObject> xGrfObj, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*);
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 4acccc3..d662e5b 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -23,7 +23,7 @@
#include <vector>
#include <boost/utility.hpp>
-
+#include <rtl/ref.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <svtools/embedhlp.hxx>
@@ -231,7 +231,7 @@ public:
sal_Bool bDelayed = sal_False ); ///< in ndgrf.cxx
SwGrfNode *MakeGrfNode( const SwNodeIndex & rWhere,
- const GraphicObject& rGrfObj,
+ rtl::Reference<GraphicObject> xGrfObj,
SwGrfFmtColl *pColl,
SwAttrSet* pAutoAttr = 0 ); ///< in ndgrf.cxx
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index e970615..99eb355 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -37,8 +37,8 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
{
friend class SwNodes;
- GraphicObject maGrfObj;
- GraphicObject *mpReplacementGraphic;
+ rtl::Reference<GraphicObject> mxGrfObj;
+ rtl::Reference<GraphicObject> mxReplacementGraphic;
::sfx2::SvBaseLinkRef refLink; ///< If graphics only as link then pointer is set.
Size nGrfSize;
String aNewStrmName; /**< SW3/XML: new stream name (either SW3 stream
@@ -70,13 +70,13 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
SwGrfFmtColl* pGrfColl,
SwAttrSet* pAutoAttr = 0 );
SwGrfNode( const SwNodeIndex& rWhere,
- const GraphicObject& rGrfObj,
+ rtl::Reference<GraphicObject> xGrfObj,
SwGrfFmtColl* pGrfColl,
SwAttrSet* pAutoAttr = 0 );
void InsertLink( const String& rGrfName, const String& rFltName );
sal_Bool ImportGraphic( SvStream& rStrm );
- sal_Bool HasStreamName() const { return maGrfObj.HasUserData(); }
+ sal_Bool HasStreamName() const { return mxGrfObj.is() && mxGrfObj->HasUserData(); }
/** adjust return type and rename method to
indicate that its an private one. */
@@ -85,7 +85,7 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
void _GetStreamStorageNames( String& rStrmName, String& rStgName ) const;
void DelStreamName();
- DECL_LINK( SwapGraphic, GraphicObject* );
+ DECL_LINK( SwapGraphic, const GraphicObject* );
/** helper method to determine stream for the embedded graphic.
@@ -128,19 +128,19 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode
public:
virtual ~SwGrfNode();
- const Graphic& GetGrf() const { return maGrfObj.GetGraphic(); }
- const GraphicObject& GetGrfObj() const { return maGrfObj; }
- const GraphicObject* GetReplacementGrfObj() const;
+ const Graphic& GetGrf() const { return mxGrfObj->GetGraphic(); }
+ rtl::Reference<GraphicObject> GetGrfObj() const { return mxGrfObj; }
+ const GraphicObject* GetReplacementGrfObj() const;
virtual SwCntntNode *SplitCntntNode( const SwPosition & );
/// isolated only way to set GraphicObject to allow more actions when doing so
void SetGraphic(const Graphic& rGraphic, const String& rLink);
/// wrappers for non-const calls at GraphicObject
- void ReleaseGraphicFromCache() { maGrfObj.ReleaseFromCache(); }
- void DrawGraphicWithPDFHandling(OutputDevice& rOutDev, const Point& rPt, const Size& rSz, const GraphicAttr* pGrfAttr = NULL, const sal_uLong nFlags = GRFMGR_DRAW_STANDARD) { maGrfObj.DrawWithPDFHandling(rOutDev, rPt, rSz, pGrfAttr, nFlags); }
- void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData = 0, const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD, OutputDevice* pFirstFrameOutDev = NULL) { maGrfObj.StartAnimation(pOut, rPt, rSz, nExtraData, pAttr, nFlags, pFirstFrameOutDev); }
- void StopGraphicAnimation(OutputDevice* pOut = NULL, long nExtraData = 0) { maGrfObj.StopAnimation(pOut, nExtraData); }
+ void ReleaseGraphicFromCache() { /*FIXME : maGrfObj.ReleaseFromCache(); */ }
+ void DrawGraphicWithPDFHandling(OutputDevice& rOutDev, const Point& rPt, const Size& rSz, const GraphicAttr* pGrfAttr = NULL, const sal_uLong nFlags = GRFMGR_DRAW_STANDARD) { mxGrfObj->DrawWithPDFHandling(rOutDev, rPt, rSz, pGrfAttr, nFlags); }
+ void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData = 0, const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD, OutputDevice* pFirstFrameOutDev = NULL) { mxGrfObj->StartAnimation(pOut, rPt, rSz, nExtraData, pAttr, nFlags, pFirstFrameOutDev); }
+ void StopGraphicAnimation(OutputDevice* pOut = NULL, long nExtraData = 0) { mxGrfObj->StopAnimation(pOut, nExtraData); }
/// allow reaction on change of content of GraphicObject, so always call
/// when GraphicObject content changes
@@ -152,7 +152,7 @@ public:
sal_Bool IsTransparent() const;
- inline sal_Bool IsAnimated() const { return maGrfObj.IsAnimated(); }
+ inline sal_Bool IsAnimated() const { return mxGrfObj.is() && mxGrfObj->IsAnimated(); }
inline sal_Bool IsChgTwipSize() const { return bChgTwipSize; }
inline sal_Bool IsChgTwipSizeFromPixel() const { return bChgTwipSizeFromPixel; }
@@ -174,15 +174,15 @@ public:
/** Re-read in case graphic was not OK. The current one
gets replaced by the new one. */
sal_Bool ReRead( const String& rGrfName, const String& rFltName,
- const Graphic* pGraphic = 0,
- const GraphicObject* pGrfObj = 0,
- sal_Bool bModify = sal_True );
+ const Graphic* pGraphic = 0,
+ const GraphicObject* pGrfObj = 0,
+ sal_Bool bModify = sal_True );
/// Loading of graphic immediately before displaying.
short SwapIn( sal_Bool bWaitForData = sal_False );
/// Remove graphic in order to free memory.
short SwapOut();
/// Access to storage stream-name.
- void SetStreamName( const String& r ) { maGrfObj.SetUserData( r ); }
+ void SetStreamName( const String& r ) { mxGrfObj->SetUserData( r ); }
void SetNewStreamName( const String& r ) { aNewStrmName = r; }
/// Is this node selected by any shell?
sal_Bool IsSelected() const;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 4840727..2d08be4 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1043,7 +1043,7 @@ SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg,
return pSwFlyFrmFmt;
}
-SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg, const GraphicObject& rGrfObj,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list