summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-10-08 14:26:21 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2013-10-08 14:26:21 +0200
commit6e2f5bce80ff9008a8fcda7ad434033d46da17a3 (patch)
tree12314a7bbc0b8393fb7ff77aa589aa82e9d75fc2
parent677b93b3993e9a14416275e8bd2a64b12ad91c55 (diff)
wrap GraphicObject in a rtl::Referencefeature/go2
Change-Id: I07842c2920202f39cae054cba866f0d02d767e61
-rw-r--r--canvas/source/vcl/cachedbitmap.cxx8
-rw-r--r--canvas/source/vcl/cachedbitmap.hxx5
-rw-r--r--canvas/source/vcl/canvas.cxx2
-rw-r--r--canvas/source/vcl/canvas.hxx2
-rw-r--r--canvas/source/vcl/canvasbitmap.cxx2
-rw-r--r--canvas/source/vcl/canvasbitmap.hxx2
-rw-r--r--canvas/source/vcl/canvascustomsprite.cxx2
-rw-r--r--canvas/source/vcl/canvascustomsprite.hxx2
-rw-r--r--canvas/source/vcl/canvashelper.cxx19
-rw-r--r--canvas/source/vcl/canvashelper.hxx2
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx20
-rw-r--r--canvas/source/vcl/repainttarget.hxx2
-rw-r--r--canvas/source/vcl/spritecanvas.cxx2
-rw-r--r--canvas/source/vcl/spritecanvas.hxx2
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx8
-rw-r--r--chart2/source/model/main/ChartModel.hxx2
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx2
-rw-r--r--cui/source/options/optmemory.cxx1
-rw-r--r--cui/source/tabpages/backgrnd.cxx14
-rw-r--r--cui/source/tabpages/tpbitmap.cxx41
-rw-r--r--cui/source/tabpages/tpcolor.cxx2
-rw-r--r--cui/source/tabpages/tpgradnt.cxx2
-rw-r--r--cui/source/tabpages/tphatch.cxx2
-rw-r--r--cui/source/tabpages/tplnedef.cxx2
-rw-r--r--cui/source/tabpages/tplneend.cxx2
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx12
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.hxx13
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitive2d.cxx10
-rw-r--r--drawinglayer/source/primitive2d/mediaprimitive2d.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx8
-rw-r--r--editeng/source/items/bulitem.cxx56
-rw-r--r--editeng/source/items/frmitems.cxx159
-rw-r--r--editeng/source/items/numitem.cxx164
-rw-r--r--editeng/source/outliner/outliner.cxx8
-rw-r--r--editeng/source/uno/unonrule.cxx13
-rw-r--r--filter/source/msfilter/escherex.cxx64
-rw-r--r--filter/source/msfilter/msdffimp.cxx16
-rw-r--r--filter/source/msfilter/svdfppt.cxx2
-rw-r--r--include/drawinglayer/primitive2d/graphicprimitive2d.hxx8
-rw-r--r--include/editeng/brushitem.hxx53
-rw-r--r--include/editeng/bulletitem.hxx40
-rw-r--r--include/editeng/numitem.hxx28
-rw-r--r--include/editeng/outliner.hxx15
-rw-r--r--include/filter/msfilter/escherex.hxx4
-rw-r--r--include/sfx2/frmhtmlw.hxx45
-rw-r--r--include/svtools/GraphicManager.hxx27
-rw-r--r--include/svtools/GraphicObject.hxx363
-rw-r--r--include/svtools/htmlout.hxx30
-rw-r--r--include/svx/extedit.hxx4
-rw-r--r--include/svx/galctrl.hxx4
-rw-r--r--include/svx/galmisc.hxx44
-rw-r--r--include/svx/galtheme.hxx16
-rw-r--r--include/svx/grfflt.hxx2
-rw-r--r--include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx6
-rw-r--r--include/svx/svdograf.hxx15
-rw-r--r--include/svx/xbitmap.hxx4
-rw-r--r--include/svx/xbtmpit.hxx10
-rw-r--r--include/svx/xmlgrhlp.hxx2
-rw-r--r--include/svx/xoutbmp.hxx10
-rw-r--r--include/svx/xtable.hxx72
-rw-r--r--oox/source/export/drawingml.cxx4
-rw-r--r--sc/inc/filter.hxx4
-rw-r--r--sc/source/filter/excel/xiescher.cxx2
-rw-r--r--sc/source/filter/html/htmlexp.cxx97
-rw-r--r--sc/source/filter/html/htmlexp2.cxx24
-rw-r--r--sc/source/filter/inc/ftools.hxx4
-rw-r--r--sc/source/filter/inc/htmlexp.hxx28
-rw-r--r--sc/source/ui/docshell/docsh.cxx2
-rw-r--r--sc/source/ui/docshell/impex.cxx4
-rw-r--r--sc/source/ui/drawfunc/graphsh.cxx12
-rw-r--r--sc/source/ui/inc/impex.hxx4
-rw-r--r--sc/source/ui/view/printfun.cxx8
-rw-r--r--sc/source/ui/view/viewfun7.cxx2
-rw-r--r--sd/source/core/drawdoc4.cxx2
-rw-r--r--sd/source/filter/eppt/epptso.cxx8
-rw-r--r--sd/source/ui/func/fupage.cxx2
-rw-r--r--sd/source/ui/view/GraphicObjectBar.cxx6
-rw-r--r--sd/source/ui/view/drviews2.cxx10
-rw-r--r--sd/source/ui/view/sdview3.cxx2
-rw-r--r--sd/source/ui/view/sdview4.cxx2
-rw-r--r--sfx2/source/bastyp/frmhtmlw.cxx91
-rw-r--r--slideshow/source/engine/shapes/shapeimporter.cxx25
-rw-r--r--svtools/source/graphic/GraphicManager.cxx66
-rw-r--r--svtools/source/graphic/GraphicObject.cxx375
-rw-r--r--svtools/source/graphic/graphicunofactory.cxx20
-rw-r--r--svtools/source/graphic/grfattr.cxx11
-rw-r--r--svtools/source/graphic/grfcache.cxx947
-rw-r--r--svtools/source/graphic/grfcache.hxx159
-rw-r--r--svtools/source/graphic/provider.cxx4
-rw-r--r--svtools/source/graphic/renderer.cxx4
-rw-r--r--svtools/source/svhtml/htmlout.cxx63
-rw-r--r--svx/inc/galbrws2.hxx6
-rw-r--r--svx/inc/galobj.hxx22
-rw-r--r--svx/source/core/extedit.cxx12
-rw-r--r--svx/source/core/graphichelper.cxx6
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx4
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx10
-rw-r--r--svx/source/dialog/compressgraphicdialog.cxx2
-rw-r--r--svx/source/dialog/dlgctrl.cxx8
-rw-r--r--svx/source/dialog/grfflt.cxx6
-rw-r--r--svx/source/gallery2/galbrws1.cxx36
-rw-r--r--svx/source/gallery2/galbrws1.hxx6
-rw-r--r--svx/source/gallery2/galbrws2.cxx59
-rw-r--r--svx/source/gallery2/galctrl.cxx26
-rw-r--r--svx/source/gallery2/galmisc.cxx69
-rw-r--r--svx/source/gallery2/galobj.cxx43
-rw-r--r--svx/source/gallery2/galtheme.cxx94
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx14
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx6
-rw-r--r--svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx6
-rw-r--r--svx/source/sidebar/nbdtmg.cxx32
-rw-r--r--svx/source/svdraw/svddrgmt.cxx8
-rw-r--r--svx/source/svdraw/svdetc.cxx2
-rw-r--r--svx/source/svdraw/svdfmtf.cxx2
-rw-r--r--svx/source/svdraw/svdhdl.cxx2
-rw-r--r--svx/source/svdraw/svdmrkv.cxx4
-rw-r--r--svx/source/svdraw/svdoashp.cxx12
-rw-r--r--svx/source/svdraw/svdograf.cxx176
-rw-r--r--svx/source/svdraw/svdoole2.cxx37
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx9
-rw-r--r--svx/source/unodraw/unobtabl.cxx2
-rw-r--r--svx/source/unodraw/unoshap2.cxx14
-rw-r--r--svx/source/unodraw/unoshap4.cxx15
-rw-r--r--svx/source/xml/xmlgrhlp.cxx158
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx26
-rw-r--r--svx/source/xoutdev/xattr.cxx4
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx78
-rw-r--r--svx/source/xoutdev/xpool.cxx50
-rw-r--r--svx/source/xoutdev/xtabbtmp.cxx22
-rw-r--r--svx/source/xoutdev/xtabdash.cxx28
-rw-r--r--svx/source/xoutdev/xtabgrdt.cxx2
-rw-r--r--svx/source/xoutdev/xtabhtch.cxx2
-rw-r--r--svx/source/xoutdev/xtable.cxx39
-rw-r--r--svx/source/xoutdev/xtablend.cxx2
-rw-r--r--sw/inc/IDocumentContentOperations.hxx7
-rw-r--r--sw/inc/doc.hxx4
-rw-r--r--sw/inc/editsh.hxx7
-rw-r--r--sw/inc/ndarr.hxx3
-rw-r--r--sw/inc/ndgrf.hxx33
-rw-r--r--sw/inc/numrule.hxx4
-rw-r--r--sw/source/core/doc/doc.cxx6
-rw-r--r--sw/source/core/doc/notxtfrm.cxx25
-rw-r--r--sw/source/core/doc/number.cxx6
-rw-r--r--sw/source/core/docnode/swbaslnk.cxx8
-rw-r--r--sw/source/core/edit/editsh.cxx21
-rw-r--r--sw/source/core/frmedt/fecopy.cxx4
-rw-r--r--sw/source/core/graphic/ndgrf.cxx227
-rw-r--r--sw/source/core/layout/atrfrm.cxx10
-rw-r--r--sw/source/core/layout/fly.cxx21
-rw-r--r--sw/source/core/layout/paintfrm.cxx61
-rw-r--r--sw/source/core/text/frmpaint.cxx2
-rw-r--r--sw/source/core/unocore/unoframe.cxx41
-rw-r--r--sw/source/filter/html/htmlbas.cxx4
-rw-r--r--sw/source/filter/html/htmlforw.cxx8
-rw-r--r--sw/source/filter/html/wrthtml.cxx2
-rw-r--r--sw/source/filter/html/wrthtml.hxx2
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx2
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx21
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx8
-rw-r--r--sw/source/filter/xml/xmlbrsh.cxx11
-rw-r--r--sw/source/ui/shells/grfsh.cxx35
-rw-r--r--sw/source/ui/shells/txtnum.cxx14
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx2
165 files changed, 2738 insertions, 2497 deletions
diff --git a/canvas/source/vcl/cachedbitmap.cxx b/canvas/source/vcl/cachedbitmap.cxx
index bdbbcab79996..c3941c2bae24 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>& rGraphicObject,
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 ),
+ m_rGraphicObject( rGraphicObject ),
maRenderState(rUsedRenderState),
maPoint( rPoint ),
maSize( rSize ),
@@ -55,7 +55,7 @@ namespace vclcanvas
{
::osl::MutexGuard aGuard( m_aMutex );
- mpGraphicObject.reset();
+ m_rGraphicObject = rtl::Reference<GraphicObject>();
CachedPrimitiveBase::disposing();
}
@@ -78,7 +78,7 @@ namespace vclcanvas
ENSURE_OR_THROW( pTarget,
"CachedBitmap::redraw(): cannot cast target to RepaintTarget" );
- if( !pTarget->repaint( mpGraphicObject,
+ if( !pTarget->repaint( m_rGraphicObject,
rNewState,
maRenderState,
maPoint,
diff --git a/canvas/source/vcl/cachedbitmap.hxx b/canvas/source/vcl/cachedbitmap.hxx
index 4065fdc7fcfb..255aeb60ed8a 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
{
@@ -39,7 +38,7 @@ namespace vclcanvas
/** Create an XCachedPrimitive for given GraphicObject
*/
- CachedBitmap( const GraphicObjectSharedPtr& rGraphicObject,
+ CachedBitmap( const rtl::Reference<GraphicObject>& rGraphicObject,
const ::Point& rPoint,
const ::Size& rSize,
const GraphicAttr& rAttr,
@@ -59,7 +58,7 @@ namespace vclcanvas
bool bSameViewTransform );
- GraphicObjectSharedPtr mpGraphicObject;
+ rtl::Reference<GraphicObject> m_rGraphicObject;
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 5a44e4016307..9f3df1855e5a 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 10bee3b48783..3706efa1d71e 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 a469e448ed41..e145379e5329 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 176d4faea3bf..826582f104da 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 9dead83713de..17d0a2d64451 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 0014c3f91392..5ca7fc608826 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 54fff82b4d74..c1a28dfd7a72 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -763,7 +763,7 @@ namespace vclcanvas
aMatrix.decompose( aScale, aOutputPos, nRotate, nShearX );
GraphicAttr aGrfAttr;
- GraphicObjectSharedPtr pGrfObj;
+ rtl::Reference<GraphicObject> rGrfObj;
::Size aBmpSize( aBmpEx.GetSizePixel() );
@@ -803,7 +803,7 @@ namespace vclcanvas
const double nAngleInTenthOfDegrees (3600.0 - nRotate * 3600.0 / (2*M_PI));
aGrfAttr.SetRotation( static_cast< sal_uInt16 >(::basegfx::fround(nAngleInTenthOfDegrees)) );
- pGrfObj.reset( new GraphicObject( aBmpEx ) );
+ rGrfObj = GraphicObject::Create( aBmpEx );
}
else
{
@@ -828,7 +828,7 @@ namespace vclcanvas
renderState.DeviceColor,
tools::MODULATE_NONE );
- pGrfObj.reset( new GraphicObject( aBmpEx ) );
+ rGrfObj = GraphicObject::Create( aBmpEx );
// clear scale values, generated bitmap already
// contains scaling
@@ -843,22 +843,23 @@ namespace vclcanvas
const ::Size aSz( ::basegfx::fround( aScale.getX() * aBmpSize.Width() ),
::basegfx::fround( aScale.getY() * aBmpSize.Height() ) );
- pGrfObj->Draw( &mpOutDev->getOutDev(),
+ rGrfObj->Draw( &mpOutDev->getOutDev(),
aPt,
aSz,
&aGrfAttr );
if( mp2ndOutDev )
- pGrfObj->Draw( &mp2ndOutDev->getOutDev(),
+ {
+ rGrfObj->Draw( &mp2ndOutDev->getOutDev(),
aPt,
aSz,
&aGrfAttr );
-
+ }
// created GraphicObject, which possibly cached
// display bitmap - return cache object, to retain
// that information.
return uno::Reference< rendering::XCachedPrimitive >(
- new CachedBitmap( pGrfObj,
+ new CachedBitmap( rGrfObj,
aPt,
aSz,
aGrfAttr,
@@ -1410,14 +1411,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 5729d60c103e..a37496160e6c 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/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index 2da3dc607ae8..a235b7b093e1 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -69,7 +69,7 @@ namespace vclcanvas
namespace
{
bool textureFill( OutputDevice& rOutDev,
- GraphicObject& rGraphic,
+ rtl::Reference<GraphicObject>& rGraphicObject,
const ::Point& rPosPixel,
const ::Size& rNextTileX,
const ::Size& rNextTileY,
@@ -91,7 +91,7 @@ namespace vclcanvas
{
// update return value. This method should return true, if
// at least one of the looped Draws succeeded.
- bRet |= ( sal_True == rGraphic.Draw( &rOutDev,
+ bRet |= ( sal_True == rGraphicObject->Draw( &rOutDev,
aCurrPos,
rTileSize,
&rAttr ) );
@@ -842,7 +842,7 @@ namespace vclcanvas
aTotalTransform.decompose( aScale, aOutputPos, nRotate, nShearX );
GraphicAttr aGrfAttr;
- GraphicObjectSharedPtr pGrfObj;
+ rtl::Reference<GraphicObject> rGrfObj;
if( ::basegfx::fTools::equalZero( nShearX ) )
{
@@ -856,7 +856,7 @@ namespace vclcanvas
( aScale.getY() < 0.0 ? BMP_MIRROR_VERT : 0 ) );
aGrfAttr.SetRotation( static_cast< sal_uInt16 >(::basegfx::fround( nRotate*10.0 )) );
- pGrfObj.reset( new GraphicObject( aBmpEx ) );
+ rGrfObj = GraphicObject::Create( aBmpEx );
}
else
{
@@ -867,7 +867,7 @@ namespace vclcanvas
uno::Sequence< double >(),
tools::MODULATE_NONE);
- pGrfObj.reset( new GraphicObject( aBmpEx ) );
+ rGrfObj = GraphicObject::Create( aBmpEx );
// clear scale values, generated bitmap already
// contains scaling
@@ -989,7 +989,7 @@ namespace vclcanvas
rOutDev.IntersectClipRegion( aPolygonDeviceRect );
textureFill( rOutDev,
- *pGrfObj,
+ rGrfObj,
aPt,
aIntegerNextTileX,
aIntegerNextTileY,
@@ -1003,7 +1003,7 @@ namespace vclcanvas
OutputDevice& r2ndOutDev( mp2ndOutDev->getOutDev() );
r2ndOutDev.IntersectClipRegion( aPolygonDeviceRect );
textureFill( r2ndOutDev,
- *pGrfObj,
+ rGrfObj,
aPt,
aIntegerNextTileX,
aIntegerNextTileY,
@@ -1038,7 +1038,7 @@ namespace vclcanvas
aVDev.SetClipRegion( aPolyClipRegion );
textureFill( aVDev,
- *pGrfObj,
+ rGrfObj,
aOutPos,
aIntegerNextTileX,
aIntegerNextTileY,
@@ -1075,7 +1075,7 @@ namespace vclcanvas
rOutDev.SetClipRegion( aPolyClipRegion );
textureFill( rOutDev,
- *pGrfObj,
+ rGrfObj,
aPt,
aIntegerNextTileX,
aIntegerNextTileY,
@@ -1092,7 +1092,7 @@ namespace vclcanvas
r2ndOutDev.SetClipRegion( aPolyClipRegion );
textureFill( r2ndOutDev,
- *pGrfObj,
+ rGrfObj,
aPt,
aIntegerNextTileX,
aIntegerNextTileY,
diff --git a/canvas/source/vcl/repainttarget.hxx b/canvas/source/vcl/repainttarget.hxx
index 84363da81e99..89a495267afa 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 c18a7f9e6a58..b0ea7250b9a5 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 5ca1f77d25f0..83c96549f88a 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 4eb6f0ba8cff..0c9a83f38aea 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> rGrObj = GraphicObject::Create( Graphic( aSymbol.Graphic ));
aRet = UNO_NAME_GRAPHOBJ_URLPREFIX +
- OStringToOUString(aGrObj.GetUniqueID(),
+ OStringToOUString(rGrObj->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> rGrObj = 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( rGrObj->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 480efe832ff3..84273b948d1c 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/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index b8e37ef1c34e..a3779c53af81 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -635,7 +635,7 @@ void ChartModel::impl_loadGraphics(
*apIStm.get(),
aGraphic ) )
{
- m_aGraphicObjectVector.push_back( aGraphic );
+ m_aGraphicObjectVector.push_back( GraphicObject::Create(aGraphic) );
}
}
}
diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
index 3b97b218ae64..7270c202156b 100644
--- a/cui/source/options/optmemory.cxx
+++ b/cui/source/options/optmemory.cxx
@@ -182,7 +182,6 @@ sal_Bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet& rSet )
objectReleaseTime, batch);
// create a dummy graphic object to get access to the common GraphicManager
- GraphicObject aDummyObject;
GraphicManager* rGrfMgr = GraphicManager::GetGlobalManager();
rGrfMgr->SetMaxCacheSize(totalCacheSize);
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index aad927e2f9e5..2c974823b261 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -1849,8 +1849,8 @@ void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr,
}
else
{
- const String* pStrLink = rBgdAttr.GetGraphicLink();
- const String* pStrFilter = rBgdAttr.GetGraphicFilter();
+ const OUString* pStrLink = rBgdAttr.GetGraphicLink();
+ const OUString* pStrFilter = rBgdAttr.GetGraphicFilter();
lcl_setFillStyle(m_pLbSelect, XFILL_BITMAP);
ShowBitmapUI_Impl();
@@ -1874,11 +1874,15 @@ 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> rObject = rBgdAttr.GetGraphicObject();
+ if(rObject.is())
+ {
+ m_pGraphTransMF->SetValue(lcl_TransparencyToPercent(rObject->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 160af950b44c..50ee846c5a85 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 ( OUString(), GraphicObject::Create() ),
aXFillAttr ( pXPool ),
rXFSet ( aXFillAttr.GetItemSet() )
{
@@ -235,7 +235,7 @@ sal_Bool SvxBitmapTabPage::FillItemSet( SfxItemSet& _rOutAttrs )
if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
const XBitmapEntry* pXBitmapEntry = pBitmapList->GetBitmap(nPos);
- const String aString(m_pLbBitmaps->GetSelectEntry());
+ const OUString aString(m_pLbBitmaps->GetSelectEntry());
_rOutAttrs.Put(XFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject()));
}
@@ -243,7 +243,7 @@ sal_Bool SvxBitmapTabPage::FillItemSet( SfxItemSet& _rOutAttrs )
{
const BitmapEx aBitmapEx(m_pBitmapCtl->GetBitmapEx());
- _rOutAttrs.Put(XFillBitmapItem(String(), Graphic(aBitmapEx)));
+ _rOutAttrs.Put(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aBitmapEx))));
}
}
}
@@ -263,7 +263,7 @@ void SvxBitmapTabPage::Reset( const SfxItemSet& )
m_pBitmapCtl->SetBmpArray( m_pCtlPixel->GetBitmapPixelPtr() );
// get bitmap and display it
- const XFillBitmapItem aBmpItem(OUString(), Graphic(m_pBitmapCtl->GetBitmapEx()));
+ const XFillBitmapItem aBmpItem(OUString(), GraphicObject::Create(Graphic(m_pBitmapCtl->GetBitmapEx())));
rXFSet.Put( aBmpItem );
m_pCtlPreview->SetAttributes( aXFillAttr.GetItemSet() );
m_pCtlPreview->Invalidate();
@@ -298,12 +298,12 @@ SfxTabPage* SvxBitmapTabPage::Create( Window* pWindow,
IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
{
- GraphicObject* pGraphicObject = 0;
+ rtl::Reference<GraphicObject> rGraphicObject;
int nPos(m_pLbBitmaps->GetSelectEntryPos());
if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
- pGraphicObject = new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
+ rGraphicObject = GraphicObject::Create(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
}
else
{
@@ -315,27 +315,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());
+ rGraphicObject = GraphicObject::Create(((const XFillBitmapItem*)pPoolItem)->GetGraphicObject());
}
}
- if(!pGraphicObject)
+ if(!rGraphicObject.is())
{
m_pLbBitmaps->SelectEntryPos(0);
nPos = m_pLbBitmaps->GetSelectEntryPos();
if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
- pGraphicObject = new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
+ rGraphicObject = GraphicObject::Create(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
}
}
}
- if(pGraphicObject)
+ if(rGraphicObject.is())
{
BitmapColor aBack;
BitmapColor aFront;
- bool bIs8x8(isHistorical8x8(pGraphicObject->GetGraphic().GetBitmap(), aBack, aFront));
+ bool bIs8x8(isHistorical8x8(rGraphicObject->GetGraphic().GetBitmap(), aBack, aFront));
m_pLbColor->SetNoSelection();
m_pLbBackgroundColor->SetNoSelection();
@@ -349,7 +349,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
// setting the pixel control
- m_pCtlPixel->SetXBitmap(pGraphicObject->GetGraphic().GetBitmapEx());
+ m_pCtlPixel->SetXBitmap(rGraphicObject->GetGraphic().GetBitmapEx());
Color aPixelColor = aFront;
Color aBackColor = aBack;
@@ -390,14 +390,13 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
m_pCtlPixel->Invalidate();
// display bitmap
- const XFillBitmapItem aXBmpItem(String(), *pGraphicObject);
+ const XFillBitmapItem aXBmpItem(OUString(), rGraphicObject);
rXFSet.Put( aXBmpItem );
m_pCtlPreview->SetAttributes( aXFillAttr.GetItemSet() );
m_pCtlPreview->Invalidate();
bBmpChanged = sal_False;
- delete pGraphicObject;
}
return 0;
@@ -520,7 +519,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
{
@@ -627,7 +626,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();
@@ -689,7 +688,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 );
@@ -849,7 +848,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickSaveHdl_Impl)
INetURLObject aFile( SvtPathOptions().GetPalettePath() );
DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
- if( pBitmapList->GetName().Len() )
+ if( !pBitmapList->GetName().isEmpty() )
{
aFile.Append( pBitmapList->GetName() );
@@ -907,7 +906,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangePixelColorHdl_Impl)
m_pBitmapCtl->SetPixelColor( m_pLbColor->GetSelectEntryColor() );
// get bitmap and display it
- rXFSet.Put(XFillBitmapItem(String(), Graphic(m_pBitmapCtl->GetBitmapEx())));
+ rXFSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(m_pBitmapCtl->GetBitmapEx()))));
m_pCtlPreview->SetAttributes( aXFillAttr.GetItemSet() );
m_pCtlPreview->Invalidate();
@@ -926,7 +925,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl)
m_pBitmapCtl->SetBackgroundColor( m_pLbBackgroundColor->GetSelectEntryColor() );
// get bitmap and display it
- rXFSet.Put(XFillBitmapItem(String(), Graphic(m_pBitmapCtl->GetBitmapEx())));
+ rXFSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(m_pBitmapCtl->GetBitmapEx()))));
m_pCtlPreview->SetAttributes( aXFillAttr.GetItemSet() );
m_pCtlPreview->Invalidate();
@@ -944,7 +943,7 @@ void SvxBitmapTabPage::PointChanged( Window* pWindow, RECT_POINT )
m_pBitmapCtl->SetBmpArray( m_pCtlPixel->GetBitmapPixelPtr() );
// get bitmap and display it
- rXFSet.Put(XFillBitmapItem(String(), Graphic(m_pBitmapCtl->GetBitmapEx())));
+ rXFSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(m_pBitmapCtl->GetBitmapEx()))));
m_pCtlPreview->SetAttributes( aXFillAttr.GetItemSet() );
m_pCtlPreview->Invalidate();
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index f14ab7656db7..9f0e5f155927 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -214,7 +214,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickSaveHdl_Impl)
XPropertyListRef pList = GetList();
- if( pList->GetName().Len() )
+ if( !pList->GetName().isEmpty() )
{
aFile.Append( pList->GetName() );
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index e84c892aeff9..674254f9c34c 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -718,7 +718,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickSaveHdl_Impl)
INetURLObject aFile( SvtPathOptions().GetPalettePath() );
DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
- if( pGradientList->GetName().Len() )
+ if( !pGradientList->GetName().isEmpty() )
{
aFile.Append( pGradientList->GetName() );
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 95b64f53516d..9d3098220324 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -752,7 +752,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickSaveHdl_Impl)
INetURLObject aFile( SvtPathOptions().GetPalettePath() );
DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
- if( pHatchingList->GetName().Len() )
+ if( !pHatchingList->GetName().isEmpty() )
{
aFile.Append( pHatchingList->GetName() );
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index 46ded4bc6e56..a4264f23c4b3 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -824,7 +824,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl)
INetURLObject aFile( SvtPathOptions().GetPalettePath() );
DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
- if( pDashList->GetName().Len() )
+ if( !pDashList->GetName().isEmpty() )
{
aFile.Append( pDashList->GetName() );
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index 6756aec1840d..1f4774e36605 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -617,7 +617,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickSaveHdl_Impl)
INetURLObject aFile( SvtPathOptions().GetPalettePath() );
DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
- if( pLineEndList->GetName().Len() )
+ if( !pLineEndList->GetName().isEmpty() )
{
aFile.Append( pLineEndList->GetName() );
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 79a0afff37ee..9e4cb34c5abb 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -1351,15 +1351,19 @@ void OPreviewWindow::Paint( const Rectangle& rRect )
{
Window::Paint( rRect );
- if( ImplGetGraphicCenterRect( m_aGraphicObj.GetGraphic(), m_aPreviewRect ) )
+ if( ImplGetGraphicCenterRect( m_rGraphicObj->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 );
+ if( m_rGraphicObj->IsAnimated() )
+ {
+ m_rGraphicObj->StartAnimation( this, aPos, aSize );
+ }
else
- m_aGraphicObj.Draw( this, aPos, aSize );
+ {
+ m_rGraphicObj->Draw( this, aPos, aSize );
+ }
}
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
index 82cb7ce6985e..348676d0390d 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_rGraphicObj;
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_rGraphicObj = GraphicObject::Create(m_rGraphicObj, _rGraphic); }
};
//==================================================================
// A helper class for the controls in the detail page.
@@ -90,12 +90,9 @@ namespace dbaui
Window* m_pTablePreview;
::std::auto_ptr<PopupMenu> m_aMenu;
PreviewMode m_ePreviewMode;
- ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
- m_xFrame;
- ::com::sun::star::uno::Reference < ::com::sun::star::io::XPersist >
- m_xDocInfo;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
- m_xWindow;
+ ::css::uno::Reference < ::com::sun::star::frame::XFrame2 > m_xFrame;
+ ::css::uno::Reference < ::com::sun::star::io::XPersist > m_xDocInfo;
+ ::css::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow;
/// returns the index of the visible control
int getVisibleControlIndex() const;
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index df69a36cdd94..349d2d7f4fed 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -71,8 +71,8 @@ namespace drawinglayer
aSuppressGraphicAttr.SetRotation(0);
aSuppressGraphicAttr.SetMirrorFlags(0);
- const GraphicObject& rGraphicObject = getGraphicObject();
- const Graphic aTransformedGraphic(rGraphicObject.GetTransformedGraphic(&aSuppressGraphicAttr));
+ const rtl::Reference<GraphicObject>& rGraphicObject = getGraphicObject();
+ const Graphic aTransformedGraphic(rGraphicObject->GetTransformedGraphic(&aSuppressGraphicAttr));
aRetval = create2DDecompositionOfGraphic(
aTransformedGraphic,
@@ -87,7 +87,7 @@ namespace drawinglayer
// is necessary since the crop values are relative to original bitmap size
const basegfx::B2DVector aObjectScale(aTransform * basegfx::B2DVector(1.0, 1.0));
const basegfx::B2DVector aCropScaleFactor(
- rGraphicObject.calculateCropScaling(
+ rGraphicObject->calculateCropScaling(
aObjectScale.getX(),
aObjectScale.getY(),
getGraphicAttr().GetLeftCrop(),
@@ -115,7 +115,7 @@ namespace drawinglayer
GraphicPrimitive2D::GraphicPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
- const GraphicObject& rGraphicObject,
+ const rtl::Reference<GraphicObject>& rGraphicObject,
const GraphicAttr& rGraphicAttr)
: BufferedDecompositionPrimitive2D(),
maTransform(rTransform),
@@ -126,7 +126,7 @@ namespace drawinglayer
GraphicPrimitive2D::GraphicPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
- const GraphicObject& rGraphicObject)
+ const rtl::Reference<GraphicObject>& rGraphicObject)
: BufferedDecompositionPrimitive2D(),
maTransform(rTransform),
maGraphicObject(rGraphicObject),
diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
index 7720353d8815..1aeff8356d82 100644
--- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
@@ -49,7 +49,7 @@ namespace drawinglayer
if(GRAPHIC_BITMAP == maSnapshot.GetType() || GRAPHIC_GDIMETAFILE == maSnapshot.GetType())
{
- const GraphicObject aGraphicObject(maSnapshot);
+ const rtl::Reference<GraphicObject> aGraphicObject = GraphicObject::Create(maSnapshot);
const GraphicAttr aGraphicAttr;
xRetval.realloc(2);
xRetval[0] = xRefBackground;
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index c9f4af1c3784..9ed958fbaa41 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -789,7 +789,7 @@ namespace drawinglayer
{
// emulate data handling from UnoControlPDFExportContact, original see
// svtools/source/graphic/grfmgr.cxx
- const Graphic& rGraphic = rGraphicPrimitive.getGraphicObject().GetGraphic();
+ const Graphic& rGraphic = rGraphicPrimitive.getGraphicObject()->GetGraphic();
if(rGraphic.IsLink())
{
@@ -836,8 +836,8 @@ namespace drawinglayer
{
const MapMode aMapMode100thmm(MAP_100TH_MM);
const Size aBitmapSize(Application::GetDefaultDevice()->LogicToLogic(
- rGraphicPrimitive.getGraphicObject().GetPrefSize(),
- rGraphicPrimitive.getGraphicObject().GetPrefMapMode(), aMapMode100thmm));
+ rGraphicPrimitive.getGraphicObject()->GetPrefSize(),
+ rGraphicPrimitive.getGraphicObject()->GetPrefMapMode(), aMapMode100thmm));
const double fDivX(aBitmapSize.Width() - rAttr.GetLeftCrop() - rAttr.GetRightCrop());
const double fDivY(aBitmapSize.Height() - rAttr.GetTopCrop() - rAttr.GetBottomCrop());
@@ -862,7 +862,7 @@ namespace drawinglayer
sal_Int32(ceil(aCropRange.getMaxX())), sal_Int32(ceil(aCropRange.getMaxY())));
}
- mpPDFExtOutDevData->EndGroup(rGraphicPrimitive.getGraphicObject().GetGraphic(),
+ mpPDFExtOutDevData->EndGroup(rGraphicPrimitive.getGraphicObject()->GetGraphic(),
rAttr.GetTransparency(),
aCurrentRect,
aCropRect);
diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx
index e76869e9575f..a7deb33ed7d6 100644
--- a/editeng/source/items/bulitem.cxx
+++ b/editeng/source/items/bulitem.cxx
@@ -113,7 +113,7 @@ SvxBulletItem::SvxBulletItem( sal_uInt16 _nWhich ) : SfxPoolItem( _nWhich )
SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
SfxPoolItem( _nWhich ),
- pGraphicObject( NULL )
+ m_rGraphicObject(NULL)
{
rStrm >> nStyle;
@@ -140,7 +140,9 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
nStyle = BS_NONE;
}
else
- pGraphicObject = new GraphicObject( aBmp );
+ {
+ m_rGraphicObject = GraphicObject::Create( aBmp );
+ }
}
//#fdo39428 SvStream no longer supports operator>>(long&)
@@ -170,7 +172,7 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
{
aFont = rItem.aFont;
- pGraphicObject = ( rItem.pGraphicObject ? new GraphicObject( *rItem.pGraphicObject ) : NULL );
+ m_rGraphicObject = GraphicObject::Create( rItem.m_rGraphicObject);
aPrevText = rItem.aPrevText;
aFollowText = rItem.aFollowText;
nStart = rItem.nStart;
@@ -186,8 +188,6 @@ SvxBulletItem::SvxBulletItem( const SvxBulletItem& rItem) : SfxPoolItem( rItem )
SvxBulletItem::~SvxBulletItem()
{
- if( pGraphicObject )
- delete pGraphicObject;
}
// -----------------------------------------------------------------------
@@ -217,7 +217,7 @@ void SvxBulletItem::SetDefaultFont_Impl()
void SvxBulletItem::SetDefaults_Impl()
{
- pGraphicObject = NULL;
+ m_rGraphicObject = rtl::Reference<GraphicObject>();
nWidth = 1200; // 1.2cm
nStart = 1;
nStyle = BS_123;
@@ -290,12 +290,12 @@ int SvxBulletItem::operator==( const SfxPoolItem& rItem ) const
if( nStyle == BS_BMP )
{
- if( ( pGraphicObject && !rBullet.pGraphicObject ) || ( !pGraphicObject && rBullet.pGraphicObject ) )
+ if( ( m_rGraphicObject.is() && !rBullet.m_rGraphicObject.is() ) || ( !m_rGraphicObject.is() && rBullet.m_rGraphicObject.is() ) )
return 0;
- if( ( pGraphicObject && rBullet.pGraphicObject ) &&
- ( ( *pGraphicObject != *rBullet.pGraphicObject ) ||
- ( pGraphicObject->GetPrefSize() != rBullet.pGraphicObject->GetPrefSize() ) ) )
+ if( ( m_rGraphicObject.is() && rBullet.m_rGraphicObject.is() ) &&
+ ( ( *(m_rGraphicObject.get()) != *(rBullet.m_rGraphicObject.get() ) ||
+ ( m_rGraphicObject->GetPrefSize() != rBullet.m_rGraphicObject->GetPrefSize() ) ) ))
{
return 0;
}
@@ -310,28 +310,25 @@ SvStream& SvxBulletItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) c
{
// Correction for empty bitmap
if( ( nStyle == BS_BMP ) &&
- ( !pGraphicObject || ( GRAPHIC_NONE == pGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == pGraphicObject->GetType() ) ) )
+ ( !m_rGraphicObject.is() || ( GRAPHIC_NONE == m_rGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == m_rGraphicObject->GetType() ) ) )
{
- if( pGraphicObject )
- {
- delete( const_cast< SvxBulletItem* >( this )->pGraphicObject );
- const_cast< SvxBulletItem* >( this )->pGraphicObject = NULL;
- }
-
+ const_cast< SvxBulletItem* >( this )->m_rGraphicObject = rtl::Reference<GraphicObject>();
const_cast< SvxBulletItem* >( this )->nStyle = BS_NONE;
}
rStrm << nStyle;
if( nStyle != BS_BMP )
+ {
StoreFont( rStrm, aFont );
+ }
else
{
sal_uLong _nStart = rStrm.Tell();
// Small preliminary estimate of the size ...
sal_uInt16 nFac = ( rStrm.GetCompressMode() != COMPRESSMODE_NONE ) ? 3 : 1;
- const Bitmap aBmp( pGraphicObject->GetGraphic().GetBitmap() );
+ const Bitmap aBmp( m_rGraphicObject->GetGraphic().GetBitmap() );
sal_uLong nBytes = aBmp.GetSizeBytes();
if ( nBytes < sal_uLong(0xFF00*nFac) )
{
@@ -406,33 +403,22 @@ SfxItemPresentation SvxBulletItem::GetPresentation
//------------------------------------------------------------------------
-const GraphicObject& SvxBulletItem::GetGraphicObject() const
+const rtl::Reference<GraphicObject> SvxBulletItem::GetGraphicObject() const
{
- if( pGraphicObject )
- return *pGraphicObject;
- else
- {
- static const GraphicObject aDefaultObject;
- return aDefaultObject;
- }
+ return m_rGraphicObject;
}
//------------------------------------------------------------------------
-void SvxBulletItem::SetGraphicObject( const GraphicObject& rGraphicObject )
+void SvxBulletItem::SetGraphicObject( const rtl::Reference<GraphicObject>& rGraphicObject )
{
- if( ( GRAPHIC_NONE == rGraphicObject.GetType() ) || ( GRAPHIC_DEFAULT == rGraphicObject.GetType() ) )
+ if( ( GRAPHIC_NONE == rGraphicObject->GetType() ) || ( GRAPHIC_DEFAULT == rGraphicObject->GetType() ) )
{
- if( pGraphicObject )
- {
- delete pGraphicObject;
- pGraphicObject = NULL;
- }
+ m_rGraphicObject = rtl::Reference<GraphicObject>();
}
else
{
- delete pGraphicObject;
- pGraphicObject = new GraphicObject( rGraphicObject );
+ m_rGraphicObject = GraphicObject::Create( rGraphicObject );
}
}
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 44606be3547d..fab8617410e6 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3302,13 +3302,13 @@ void SvxLineItem::SetLine( const SvxBorderLine* pNew )
class SvxBrushItem_Impl
{
public:
- GraphicObject* pGraphicObject;
+ rtl::Reference<GraphicObject> rGraphicObject;
sal_Int8 nGraphicTransparency; //contains a percentage value which is
//copied to the GraphicObject when necessary
Link aDoneLink;
SvStream* pStream;
- SvxBrushItem_Impl( GraphicObject* p ) : pGraphicObject( p ), nGraphicTransparency(0), pStream(0) {}
+ SvxBrushItem_Impl( rtl::Reference<GraphicObject> r ) : rGraphicObject( r ), nGraphicTransparency(0), pStream(0) {}
};
// -----------------------------------------------------------------------
@@ -3361,7 +3361,7 @@ SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos,
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
- pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphic ) ) ),
+ pImpl ( new SvxBrushItem_Impl( GraphicObject::Create( rGraphic ) ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
@@ -3373,14 +3373,14 @@ SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos,
// -----------------------------------------------------------------------
-SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj,
+SvxBrushItem::SvxBrushItem( const rtl::Reference<GraphicObject>& rGraphicObj,
SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
SfxPoolItem( _nWhich ),
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
- pImpl ( new SvxBrushItem_Impl( new GraphicObject( rGraphicObj ) ) ),
+ pImpl ( new SvxBrushItem_Impl( GraphicObject::Create( rGraphicObj ) ) ),
pStrLink ( NULL ),
pStrFilter ( NULL ),
eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
@@ -3392,17 +3392,16 @@ SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj,
// -----------------------------------------------------------------------
-SvxBrushItem::SvxBrushItem(
- const String& rLink, const String& rFilter,
- SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
+SvxBrushItem::SvxBrushItem( const OUString& rLink, const OUString& rFilter,
+ SvxGraphicPosition ePos, sal_uInt16 _nWhich ) :
SfxPoolItem( _nWhich ),
aColor ( COL_TRANSPARENT ),
nShadingValue ( ShadingPattern::CLEAR ),
pImpl ( new SvxBrushItem_Impl( NULL ) ),
- pStrLink ( new String( rLink ) ),
- pStrFilter ( new String( rFilter ) ),
+ pStrLink ( new OUString( rLink ) ),
+ pStrFilter ( new OUString( rFilter ) ),
eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
bLoadAgain ( sal_True )
@@ -3493,7 +3492,7 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
Graphic aGraphic;
rStream >> aGraphic;
- pImpl->pGraphicObject = new GraphicObject( aGraphic );
+ pImpl->rGraphicObject = GraphicObject::Create( aGraphic );
if( SVSTREAM_FILEFORMAT_ERROR == rStream.GetError() )
{
@@ -3506,18 +3505,18 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
if ( nDoLoad & LOAD_LINK )
{
// UNICODE: rStream >> aRel;
- String aRel = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
+ OUString aRel = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
// TODO/MBA: how can we get a BaseURL here?!
OSL_FAIL("No BaseURL!");
- String aAbs = INetURLObject::GetAbsURL( String(), aRel );
- DBG_ASSERT( aAbs.Len(), "Invalid URL!" );
- pStrLink = new String( aAbs );
+ OUString aAbs = INetURLObject::GetAbsURL( String(), aRel );
+ DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" );
+ pStrLink = new OUString( aAbs );
}
if ( nDoLoad & LOAD_FILTER )
{
- pStrFilter = new String;
+ pStrFilter = new OUString;
// UNICODE: rStream >> *pStrFilter;
*pStrFilter = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
}
@@ -3548,7 +3547,6 @@ SvxBrushItem::SvxBrushItem( const SvxBrushItem& rItem ) :
SvxBrushItem::~SvxBrushItem()
{
- delete pImpl->pGraphicObject;
delete pImpl;
delete pStrLink;
delete pStrFilter;
@@ -3603,12 +3601,12 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
OUString sLink;
if ( pStrLink )
sLink = *pStrLink;
- else if( pImpl->pGraphicObject )
+ else if( pImpl->rGraphicObject.is() )
{
OUString sPrefix(
UNO_NAME_GRAPHOBJ_URLPREFIX);
OUString sId(OStringToOUString(
- pImpl->pGraphicObject->GetUniqueID(),
+ pImpl->rGraphicObject->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US));
sLink = sPrefix + sId;
}
@@ -3704,14 +3702,12 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
else if( sLink.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
{
DELETEZ( pStrLink );
- String sTmp( sLink );
- OString sId(OUStringToOString(sTmp.Copy(
+ OString sId(OUStringToOString(sLink.copy(
sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1),
RTL_TEXTENCODING_ASCII_US));
- GraphicObject *pOldGrfObj = pImpl->pGraphicObject;
- pImpl->pGraphicObject = new GraphicObject( sId );
+ rtl::Reference<GraphicObject> rOldGrfObj = pImpl->rGraphicObject;
+ pImpl->rGraphicObject = GraphicObject::Create( sId );
ApplyGraphicTransparency_Impl();
- delete pOldGrfObj;
}
else
{
@@ -3742,7 +3738,7 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(nTmp >= 0 && nTmp <= 100)
{
pImpl->nGraphicTransparency = sal_Int8(nTmp);
- if(pImpl->pGraphicObject)
+ if(pImpl->rGraphicObject.is())
ApplyGraphicTransparency_Impl();
}
}
@@ -3810,21 +3806,28 @@ SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
aColor = rItem.aColor;
eGraphicPos = rItem.eGraphicPos;
- DELETEZ( pImpl->pGraphicObject );
DELETEZ( pStrLink );
DELETEZ( pStrFilter );
if ( GPOS_NONE != eGraphicPos )
{
if ( rItem.pStrLink )
- pStrLink = new String( *rItem.pStrLink );
+ {
+ pStrLink = new OUString( *rItem.pStrLink );
+ }
if ( rItem.pStrFilter )
- pStrFilter = new String( *rItem.pStrFilter );
- if ( rItem.pImpl->pGraphicObject )
{
- pImpl->pGraphicObject = new GraphicObject( *rItem.pImpl->pGraphicObject );
+ pStrFilter = new OUString( *rItem.pStrFilter );
+ }
+ if ( rItem.pImpl->rGraphicObject.is() )
+ {
+ pImpl->rGraphicObject = GraphicObject::Create( rItem.pImpl->rGraphicObject );
}
}
+ else
+ {
+ pImpl->rGraphicObject = rtl::Reference<GraphicObject>();
+ }
nShadingValue = rItem.nShadingValue;
@@ -3861,11 +3864,15 @@ int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
if ( bEqual && !rCmp.pStrLink )
{
- if ( !rCmp.pImpl->pGraphicObject )
- bEqual = !pImpl->pGraphicObject;
+ if ( !rCmp.pImpl->rGraphicObject.is() )
+ {
+ bEqual = !pImpl->rGraphicObject.is();
+ }
else
- bEqual = pImpl->pGraphicObject &&
- ( *pImpl->pGraphicObject == *rCmp.pImpl->pGraphicObject );
+ {
+ bEqual = pImpl->rGraphicObject.is() &&
+ ( *(pImpl->rGraphicObject.get()) == *(rCmp.pImpl->rGraphicObject.get()) );
+ }
}
}
@@ -3903,21 +3910,29 @@ SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ )
sal_uInt16 nDoLoad = 0;
- if ( pImpl->pGraphicObject && !pStrLink )
+ if ( pImpl->rGraphicObject.is() && !pStrLink )
+ {
nDoLoad |= LOAD_GRAPHIC;
+ }
if ( pStrLink )
+ {
nDoLoad |= LOAD_LINK;
+ }
if ( pStrFilter )
+ {
nDoLoad |= LOAD_FILTER;
+ }
rStream << nDoLoad;
- if ( pImpl->pGraphicObject && !pStrLink )
- rStream << pImpl->pGraphicObject->GetGraphic();
+ if ( pImpl->rGraphicObject.is() && !pStrLink )
+ {
+ rStream << pImpl->rGraphicObject->GetGraphic();
+ }
if ( pStrLink )
{
OSL_FAIL("No BaseURL!");
// TODO/MBA: how to get a BaseURL?!
- String aRel = INetURLObject::GetRelURL( String(), *pStrLink );
+ OUString aRel = INetURLObject::GetRelURL( OUString(), *pStrLink );
// UNICODE: rStream << aRel;
rStream.WriteUniOrByteString(aRel, rStream.GetStreamCharSet());
}
@@ -3938,13 +3953,13 @@ void SvxBrushItem::PurgeMedium() const
}
// -----------------------------------------------------------------------
-const GraphicObject* SvxBrushItem::GetGraphicObject() const
+const rtl::Reference<GraphicObject> SvxBrushItem::GetGraphicObject() const
{
- if ( bLoadAgain && pStrLink && !pImpl->pGraphicObject )
+ if ( bLoadAgain && pStrLink && !pImpl->rGraphicObject.is() )
// when graphics already loaded, use as a cache
{
// only with "valid" names - empty names now allowed
- if( pStrLink->Len() )
+ if( !pStrLink->isEmpty() )
{
pImpl->pStream = utl::UcbStreamHelper::CreateStream( *pStrLink, STREAM_STD_READ );
if( pImpl->pStream && !pImpl->pStream->GetError() )
@@ -3962,8 +3977,7 @@ const GraphicObject* SvxBrushItem::GetGraphicObject() const
}
else
{
- pImpl->pGraphicObject = new GraphicObject;
- pImpl->pGraphicObject->SetGraphic( aGraphic );
+ pImpl->rGraphicObject = GraphicObject::Create(aGraphic);
const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl();
}
}
@@ -3974,15 +3988,15 @@ const GraphicObject* SvxBrushItem::GetGraphicObject() const
}
}
- return pImpl->pGraphicObject;
+ return pImpl->rGraphicObject;
}
// -----------------------------------------------------------------------
const Graphic* SvxBrushItem::GetGraphic() const
{
- const GraphicObject* pGrafObj = GetGraphicObject();
- return( pGrafObj ? &( pGrafObj->GetGraphic() ) : NULL );
+ const rtl::Reference<GraphicObject> rGrafObj = GetGraphicObject();
+ return( rGrafObj.is() ? &( rGrafObj->GetGraphic() ) : NULL );
}
// -----------------------------------------------------------------------
@@ -3993,15 +4007,15 @@ void SvxBrushItem::SetGraphicPos( SvxGraphicPosition eNew )
if ( GPOS_NONE == eGraphicPos )
{
- DELETEZ( pImpl->pGraphicObject );
+ pImpl->rGraphicObject = rtl::Reference<GraphicObject>();
DELETEZ( pStrLink );
DELETEZ( pStrFilter );
}
else
{
- if ( !pImpl->pGraphicObject && !pStrLink )
+ if ( !pImpl->rGraphicObject.is() && !pStrLink )
{
- pImpl->pGraphicObject = new GraphicObject; // Creating a dummy
+ pImpl->rGraphicObject = GraphicObject::Create(); // Creating a dummy
}
}
}
@@ -4012,11 +4026,14 @@ void SvxBrushItem::SetGraphic( const Graphic& rNew )
{
if ( !pStrLink )
{
- if ( pImpl->pGraphicObject )
- pImpl->pGraphicObject->SetGraphic( rNew );
+ if ( pImpl->rGraphicObject.is() )
+ {
+ pImpl->rGraphicObject = GraphicObject::Create(pImpl->rGraphicObject, rNew );
+ }
else
- pImpl->pGraphicObject = new GraphicObject( rNew );
-
+ {
+ pImpl->rGraphicObject = GraphicObject::Create( rNew );
+ }
ApplyGraphicTransparency_Impl();
if ( GPOS_NONE == eGraphicPos )
@@ -4030,14 +4047,11 @@ void SvxBrushItem::SetGraphic( const Graphic& rNew )
// -----------------------------------------------------------------------
-void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj )
+void SvxBrushItem::SetGraphicObject( const rtl::Reference<GraphicObject>& rNewObj )
{
if ( !pStrLink )
{
- if ( pImpl->pGraphicObject )
- *pImpl->pGraphicObject = rNewObj;
- else
- pImpl->pGraphicObject = new GraphicObject( rNewObj );
+ pImpl->rGraphicObject = rNewObj;
ApplyGraphicTransparency_Impl();
@@ -4052,33 +4066,36 @@ void SvxBrushItem::SetGraphicObject( const GraphicObject& rNewObj )
// -----------------------------------------------------------------------
-void SvxBrushItem::SetGraphicLink( const String& rNew )
+void SvxBrushItem::SetGraphicLink( const OUString& rNew )
{
- if ( !rNew.Len() )
+ if ( rNew.isEmpty() )
DELETEZ( pStrLink );
else
{
if ( pStrLink )
+ {
*pStrLink = rNew;
+ }
else
- pStrLink = new String( rNew );
-
- DELETEZ( pImpl->pGraphicObject );
+ {
+ pStrLink = new OUString( rNew );
+ }
+ pImpl->rGraphicObject = rtl::Reference<GraphicObject>();
}
}
// -----------------------------------------------------------------------
-void SvxBrushItem::SetGraphicFilter( const String& rNew )
+void SvxBrushItem::SetGraphicFilter( const OUString& rNew )
{
- if ( !rNew.Len() )
+ if ( rNew.isEmpty() )
DELETEZ( pStrFilter );
else
{
if ( pStrFilter )
*pStrFilter = rNew;
else
- pStrFilter = new String( rNew );
+ pStrFilter = new OUString( rNew );
}
}
@@ -4146,20 +4163,20 @@ SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich )
if (!rItem.GetBitmapURL().isEmpty())
{
- pStrLink = new String( rItem.GetBitmapURL() );
+ pStrLink = new OUString( rItem.GetBitmapURL() );
SetGraphicPos( WallpaperStyle2GraphicPos((WallpaperStyle)rItem.GetStyle() ) );
}
}
void SvxBrushItem::ApplyGraphicTransparency_Impl()
{
- DBG_ASSERT(pImpl->pGraphicObject, "no GraphicObject available" );
- if(pImpl->pGraphicObject)
+ DBG_ASSERT(pImpl->rGraphicObject.is(), "no GraphicObject available" );
+ if(pImpl->rGraphicObject.is())
{
- GraphicAttr aAttr(pImpl->pGraphicObject->GetAttr());
+ GraphicAttr aAttr(pImpl->rGraphicObject->GetAttr());
aAttr.SetTransparency(lcl_PercentToTransparency(
pImpl->nGraphicTransparency));
- pImpl->pGraphicObject->SetAttr(aAttr);
+ pImpl->rGraphicObject->SetAttr(aAttr);
}
}
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 973dd63a03b0..efcc461486b7 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -97,16 +97,16 @@ SvxNumberType::~SvxNumberType()
xFormatter = 0;
}
-String SvxNumberType::GetNumStr( sal_uLong nNo ) const
+OUString SvxNumberType::GetNumStr( sal_uLong nNo ) const
{
const LanguageTag& rLang = Application::GetSettings().GetLanguageTag();
return GetNumStr( nNo, rLang.getLocale() );
}
-String SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const
+OUString SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const
{
lcl_getFormatter(xFormatter);
- String aTmpStr;
+ OUString aTmpStr;
if(!xFormatter.is())
return aTmpStr;
@@ -114,32 +114,32 @@ String SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const
{
switch(nNumType)
{
- case NumberingType::CHAR_SPECIAL:
- case NumberingType::BITMAP:
+ case NumberingType::CHAR_SPECIAL:
+ case NumberingType::BITMAP:
break;
- default:
+ default:
+ // '0' allowed for ARABIC numberings
+ if(NumberingType::ARABIC == nNumType && 0 == nNo )
+ {
+ aTmpStr = "0";
+ }
+ else
+ {
+ Sequence< PropertyValue > aProperties(2);
+ PropertyValue* pValues = aProperties.getArray();
+ pValues[0].Name = OUString("NumberingType");
+ pValues[0].Value <<= nNumType;
+ pValues[1].Name = OUString("Value");
+ pValues[1].Value <<= (sal_Int32)nNo;
+
+ try
+ {
+ aTmpStr = xFormatter->makeNumberingString( aProperties, rLocale );
+ }
+ catch(const Exception&)
{
- // '0' allowed for ARABIC numberings
- if(NumberingType::ARABIC == nNumType && 0 == nNo )
- aTmpStr = '0';
- else
- {
- Sequence< PropertyValue > aProperties(2);
- PropertyValue* pValues = aProperties.getArray();
- pValues[0].Name = OUString("NumberingType");
- pValues[0].Value <<= nNumType;
- pValues[1].Name = OUString("Value");
- pValues[1].Value <<= (sal_Int32)nNo;
-
- try
- {
- aTmpStr = xFormatter->makeNumberingString( aProperties, rLocale );
- }
- catch(const Exception&)
- {
- }
- }
}
+ }
}
}
return aTmpStr;
@@ -196,9 +196,9 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
rStream >> nCharTextDistance;
- sPrefix = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
- sSuffix = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
- sCharStyleName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
+ m_sPrefix = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
+ m_sSuffix = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
+ m_sCharStyleName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
sal_uInt16 hasGraphicBrush = 0;
rStream >> hasGraphicBrush;
@@ -242,7 +242,7 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC
if(pConverter && pBulletFont)
{
cBullet = ConvertFontToSubsFontChar(pConverter, cBullet);
- String sFontName = GetFontToSubsFontName(pConverter);
+ OUString sFontName = GetFontToSubsFontName(pConverter);
pBulletFont->SetName(sFontName);
}
@@ -260,9 +260,9 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC
rStream << nCharTextDistance;
rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
- rStream.WriteUniOrByteString(sPrefix, eEnc);
- rStream.WriteUniOrByteString(sSuffix, eEnc);
- rStream.WriteUniOrByteString(sCharStyleName, eEnc);
+ rStream.WriteUniOrByteString(m_sPrefix, eEnc);
+ rStream.WriteUniOrByteString(m_sSuffix, eEnc);
+ rStream.WriteUniOrByteString(m_sCharStyleName, eEnc);
if(pGraphicBrush)
{
rStream << (sal_uInt16)1;
@@ -272,7 +272,7 @@ SvStream& SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pC
// are present, so Brush save is forced
if(pGraphicBrush->GetGraphicLink() && pGraphicBrush->GetGraphic())
{
- String aEmpty;
+ OUString aEmpty;
pGraphicBrush->SetGraphicLink(aEmpty);
}
@@ -331,13 +331,13 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
mnFirstLineIndent = rFormat.mnFirstLineIndent;
mnIndentAt = rFormat.mnIndentAt;
eVertOrient = rFormat.eVertOrient ;
- sPrefix = rFormat.sPrefix ;
- sSuffix = rFormat.sSuffix ;
- aGraphicSize = rFormat.aGraphicSize ;
- nBulletColor = rFormat.nBulletColor ;
+ m_sPrefix = rFormat.m_sPrefix ;
+ m_sSuffix = rFormat.m_sSuffix ;
+ aGraphicSize = rFormat.aGraphicSize ;
+ nBulletColor = rFormat.nBulletColor ;
nBulletRelSize = rFormat.nBulletRelSize;
SetShowSymbol(rFormat.IsShowSymbol());
- sCharStyleName = rFormat.sCharStyleName;
+ m_sCharStyleName = rFormat.m_sCharStyleName;
DELETEZ(pGraphicBrush);
if(rFormat.pGraphicBrush)
{
@@ -367,13 +367,13 @@ sal_Bool SvxNumberFormat::operator==( const SvxNumberFormat& rFormat) const
mnFirstLineIndent != rFormat.mnFirstLineIndent ||
mnIndentAt != rFormat.mnIndentAt ||
eVertOrient != rFormat.eVertOrient ||
- sPrefix != rFormat.sPrefix ||
- sSuffix != rFormat.sSuffix ||
- aGraphicSize != rFormat.aGraphicSize ||
- nBulletColor != rFormat.nBulletColor ||
+ m_sPrefix != rFormat.m_sPrefix ||
+ m_sSuffix != rFormat.m_sSuffix ||
+ aGraphicSize != rFormat.aGraphicSize ||
+ nBulletColor != rFormat.nBulletColor ||
nBulletRelSize != rFormat.nBulletRelSize ||
IsShowSymbol() != rFormat.IsShowSymbol() ||
- sCharStyleName != rFormat.sCharStyleName
+ m_sCharStyleName != rFormat.m_sCharStyleName
)
return sal_False;
if (
@@ -420,16 +420,16 @@ void SvxNumberFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem,
aGraphicSize.Width() = aGraphicSize.Height() = 0;
}
-void SvxNumberFormat::SetGraphic( const String& rName )
+void SvxNumberFormat::SetGraphic( const OUString& rName )
{
- const String* pName;
+ const OUString* pName;
if( pGraphicBrush &&
0 != (pName = pGraphicBrush->GetGraphicLink())
&& *pName == rName )
return ;
delete pGraphicBrush;
- String sTmp;
+ OUString sTmp;
pGraphicBrush = new SvxBrushItem( rName, sTmp, GPOS_AREA, 0 );
pGraphicBrush->SetDoneLink( STATIC_LINK( this, SvxNumberFormat, GraphicArrived) );
if( eVertOrient == text::VertOrientation::NONE )
@@ -552,7 +552,7 @@ Size SvxNumberFormat::GetGraphicSizeMM100(const Graphic* pGraphic)
return aRetSize;
}
-String SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_Bool bUpper )
+OUString SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_Bool bUpper )
{
nNo %= 4000; // more can not be displayed
// i, ii, iii, iv, v, vi, vii, vii, viii, ix
@@ -561,7 +561,7 @@ String SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_Bool bUpper )
? "MDCLXVI--" // +2 Dummy entries!
: "mdclxvi--"; // +2 Dummy entries!
- String sRet;
+ OUStringBuffer sRet;
sal_uInt16 nMask = 1000;
while( nMask )
{
@@ -572,35 +572,39 @@ String SvxNumberFormat::CreateRomanString( sal_uLong nNo, sal_Bool bUpper )
if( 5 < nZahl )
{
if( nZahl < 9 )
- sRet += sal_Unicode(*(cRomanArr-1));
+ sRet.append(sal_Unicode(*(cRomanArr-1)));
++nDiff;
nZahl -= 5;
}
switch( nZahl )
{
- case 3: { sRet += sal_Unicode(*cRomanArr); }
- case 2: { sRet += sal_Unicode(*cRomanArr); }
- case 1: { sRet += sal_Unicode(*cRomanArr); }
- break;
-
- case 4: {
- sRet += sal_Unicode(*cRomanArr);
- sRet += sal_Unicode(*(cRomanArr-nDiff));
- }
- break;
- case 5: { sRet += sal_Unicode(*(cRomanArr-nDiff)); }
- break;
+ case 3:
+ sRet.append(sal_Unicode(*cRomanArr));
+ // Fall-trough
+ case 2:
+ sRet.append(sal_Unicode(*cRomanArr));
+ // Fall-trough
+ case 1:
+ sRet.append(sal_Unicode(*cRomanArr));
+ break;
+ case 4:
+ sRet.append(sal_Unicode(*cRomanArr));
+ sRet.append(sal_Unicode(*(cRomanArr-nDiff)));
+ break;
+ case 5:
+ sRet.append(sal_Unicode(*(cRomanArr-nDiff)));
+ break;
}
nMask /= 10; // for the next decade
cRomanArr += 2;
}
- return sRet;
+ return sRet.toString();
}
-const String& SvxNumberFormat::GetCharFmtName()const
+OUString SvxNumberFormat::GetCharFmtName()const
{
- return sCharStyleName;
+ return m_sCharStyleName;
}
sal_Int32 SvxNumRule::nRefCount = 0;
@@ -853,9 +857,9 @@ void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt)
}
}
-String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings ) const
+OUString SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings ) const
{
- String aStr;
+ OUStringBuffer aStr;
if( SVX_NO_NUM > rNum.GetLevel() && !( SVX_NO_NUMLEVEL & rNum.GetLevel() ) )
{
const SvxNumberFormat& rMyNFmt = GetLevel( rNum.GetLevel() );
@@ -870,9 +874,13 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings
if( 1 < n )
{
if( i+1 >= n )
+ {
i -= n - 1;
+ }
else
+ {
i = 0;
+ }
}
}
@@ -888,24 +896,28 @@ String SvxNumRule::MakeNumString( const SvxNodeNum& rNum, sal_Bool bInclStrings
if( rNum.GetLevelVal()[ i ] )
{
if(SVX_NUM_BITMAP != rNFmt.GetNumberingType())
- aStr += rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], aLocale );
+ aStr.append(rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], aLocale ));
else
bDot = sal_False;
}
else
- aStr += sal_Unicode('0'); // all 0-levels are a 0
+ {
+ aStr.append(sal_Unicode('0')); // all 0-levels are a 0
+ }
if( i != rNum.GetLevel() && bDot)
- aStr += sal_Unicode('.');
+ {
+ aStr.append(sal_Unicode('.'));
+ }
}
}
if( bInclStrings )
{
- aStr.Insert( rMyNFmt.GetPrefix(), 0 );
- aStr += rMyNFmt.GetSuffix();
+ aStr.insert( 0, rMyNFmt.GetPrefix());
+ aStr.append(rMyNFmt.GetSuffix());
}
}
- return aStr;
+ return aStr.toString();
}
// changes linked to embedded bitmaps
@@ -916,17 +928,17 @@ sal_Bool SvxNumRule::UnLinkGraphics()
{
SvxNumberFormat aFmt(GetLevel(i));
const SvxBrushItem* pBrush = aFmt.GetBrush();
- const String* pLinkStr;
+ const OUString* pLinkStr;
const Graphic* pGraphic;
if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
{
if(pBrush &&
0 != (pLinkStr = pBrush->GetGraphicLink()) &&
- pLinkStr->Len() &&
+ !pLinkStr->isEmpty() &&
0 !=(pGraphic = pBrush->GetGraphic()))
{
SvxBrushItem aTempItem(*pBrush);
- aTempItem.SetGraphicLink( String());
+ aTempItem.SetGraphicLink( OUString());
aTempItem.SetGraphic(*pGraphic);
sal_Int16 eOrient = aFmt.GetVertOrient();
aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient );
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 61e9b74a5287..c25e31ee2531 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1054,7 +1054,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
}
else
{
- if ( pFmt->GetBrush()->GetGraphicObject() )
+ if ( pFmt->GetBrush()->GetGraphicObject().is() )
{
Point aBulletPos;
if ( !bVertical )
@@ -1080,7 +1080,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
// created aDrawBulletHdl, Set/GetDrawBulletHdl.
// created DrawBulletInfo and added handling to sdrtextdecomposition.cxx
DrawBulletInfo aDrawBulletInfo(
- *pFmt->GetBrush()->GetGraphicObject(),
+ pFmt->GetBrush()->GetGraphicObject(),
aBulletPos,
pPara->aBulSize);
@@ -1090,7 +1090,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
else
{
// Remove CAST when KA made the Draw-Method const
- ((GraphicObject*)pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize );
+ pFmt->GetBrush()->GetGraphicObject()->Draw( pOutDev, aBulletPos, pPara->aBulSize );
}
}
}
@@ -1735,7 +1735,7 @@ EBulletInfo Outliner::GetBulletInfo( sal_Int32 nPara )
if( pFmt->GetBulletFont() )
aInfo.aFont = *pFmt->GetBulletFont();
}
- else if ( pFmt->GetBrush()->GetGraphicObject() )
+ else if ( pFmt->GetBrush()->GetGraphicObject().is() )
{
aInfo.aGraphic = pFmt->GetBrush()->GetGraphicObject()->GetGraphic();
}
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 78cb01467a72..a15df445e267 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -225,12 +225,11 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex( sa
{
const SvxBrushItem* pBrush = rFmt.GetBrush();
- if(pBrush && pBrush->GetGraphicObject())
+ if(pBrush && pBrush->GetGraphicObject().is())
{
- const GraphicObject* pGrafObj = pBrush->GetGraphicObject();
+ const rtl::Reference<GraphicObject> rGrafObj = pBrush->GetGraphicObject();
OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(pGrafObj->GetUniqueID(),
- RTL_TEXTENCODING_ASCII_US);
+ aURL += OStringToOUString(rGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
aVal <<= aURL;
const beans::PropertyValue aGraphicProp( OUString("GraphicURL"), -1, aVal, beans::PropertyState_DIRECT_VALUE);
@@ -375,8 +374,8 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::Prope
OUString aURL;
if( aVal >>= aURL )
{
- GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
- SvxBrushItem aBrushItem( aGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
+ rtl::Reference<GraphicObject> rGrafObj = GraphicObject::CreateGraphicObjectFromURL( aURL );
+ SvxBrushItem aBrushItem( rGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
aFmt.SetGraphicBrush( &aBrushItem );
continue;
}
@@ -463,7 +462,7 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::Prope
{
if( NULL == aFmt.GetBrush() )
{
- GraphicObject aGrafObj;
+ rtl::Reference<GraphicObject> aGrafObj(NULL);
SvxBrushItem aBrushItem( aGrafObj, GPOS_AREA, SID_ATTR_BRUSH );
aFmt.SetGraphicBrush( &aBrushItem );
}
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index d6edcb772a28..c140141dcec9 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1279,18 +1279,18 @@ sal_Bool EscherPropertyContainer::CreateOLEGraphicProperties(
const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pSdrOLE2)->GetGraphic();
if ( pGraphic )
{
- GraphicObject aGraphicObject( *pGraphic );
- bRetValue = CreateGraphicProperties( rXShape,aGraphicObject );
+ rtl::Reference<GraphicObject> rGraphicObject = GraphicObject::Create( *pGraphic );
+ bRetValue = CreateGraphicProperties( rXShape, rGraphicObject );
}
}
}
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 );
@@ -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> rGraphicObject = GraphicObject::Create( ((SdrMediaObj*)pSdrMedia)->getSnapshot() );
+ bRetValue = CreateGraphicProperties( rXShape, rGraphicObject );
}
}
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> rGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground, aRect );
+ OString aUniqueId = rGraphicObject->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> rGraphicObject;
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;
+ rGraphicObject = GraphicObject::Create(aGraphic);
+ aUniqueId = rGraphicObject->GetUniqueID();
+ bIsGraphicMtf = rGraphicObject->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;
+ rGraphicObject = GraphicObject::Create(aGraphic);
+ aUniqueId = rGraphicObject->GetUniqueID();
+ bIsGraphicMtf = rGraphicObject->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();
+ rGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground, aRect );
+ aUniqueId = rGraphicObject->GetUniqueID();
eBitmapMode = ::com::sun::star::drawing::BitmapMode_REPEAT;
- bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
+ bIsGraphicMtf = rGraphicObject->GetType() == GRAPHIC_GDIMETAFILE;
}
}
@@ -1611,8 +1611,8 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
if ( nErrCode == ERRCODE_NONE )
{
// no.
- aGraphicObject = aGraphic;
- aUniqueId = aGraphicObject.GetUniqueID();
+ rGraphicObject = GraphicObject::Create(aGraphic);
+ aUniqueId = rGraphicObject->GetUniqueID();
}
// else: simply keep the graphic link
delete pIn;
@@ -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> rGraphicObject = GraphicObject::Create(aGraphic);
+ OString aUniqueId = rGraphicObject->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,
- const GraphicAttr* pGraphicAttr ) :
+EscherBlibEntry::EscherBlibEntry( sal_uInt32 nPictureOffset, const rtl::Reference<GraphicObject>& rObject, const OString& rId,
+ const GraphicAttr* pGraphicAttr ) :
mnPictureOffset ( nPictureOffset ),
mnRefCount ( 1 ),
mnSizeExtra ( 0 ),
- maPrefSize ( rObject.GetPrefSize() ),
- maPrefMapMode ( rObject.GetPrefMapMode() ),
+ maPrefSize ( rObject->GetPrefSize() ),
+ maPrefMapMode ( rObject->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( rObject->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> rGraphicObject = GraphicObject::Create( rId );
- EscherBlibEntry* p_EscherBlibEntry = new EscherBlibEntry( rPicOutStrm.Tell(), aGraphicObject, rId, pGraphicAttr );
+ EscherBlibEntry* p_EscherBlibEntry = new EscherBlibEntry( rPicOutStrm.Tell(), rGraphicObject, 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( rGraphicObject->GetTransformedGraphic( pGraphicAttr ) );
GfxLink aGraphicLink;
SvMemoryStream aStream;
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index c7b24da063fa..6c63ac04b32a 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,19 +1356,19 @@ 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));
}
else
{
- rSet.Put(XFillBitmapItem(OUString(), aGraf));
+ rSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(aGraf)));
rSet.Put(XFillBmpTileItem(false));
}
}
@@ -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> rGraphicObject = GraphicObject::Create( iter->second );
+ rData = rGraphicObject->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> rGraphicObject = GraphicObject::Create( rData );
+ aEscherBlipCache.insert(std::make_pair(nIdx_, rGraphicObject->GetUniqueID()));
}
}
}
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 41307b7b6631..9ef91fd4eace 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/drawinglayer/primitive2d/graphicprimitive2d.hxx b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
index 9948a84f1652..aba444a94245 100644
--- a/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
@@ -54,7 +54,7 @@ namespace drawinglayer
basegfx::B2DHomMatrix maTransform;
/// the GraphicObject with all it's content possibilities
- GraphicObject maGraphicObject;
+ rtl::Reference<GraphicObject> maGraphicObject;
/// The GraphicAttr with all it's modification possibilities
GraphicAttr maGraphicAttr;
@@ -67,15 +67,15 @@ namespace drawinglayer
/// constructor(s)
GraphicPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
- const GraphicObject& rGraphicObject,
+ const rtl::Reference<GraphicObject>& rGraphicObject,
const GraphicAttr& rGraphicAttr);
GraphicPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
- const GraphicObject& rGraphicObject);
+ const rtl::Reference<GraphicObject>& rGraphicObject);
/// data read access
const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
- const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+ const rtl::Reference<GraphicObject>& getGraphicObject() const { return maGraphicObject; }
const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
bool isTransparent() const;
diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx
index d05ee3bf56a8..d0ea64dcd81b 100644
--- a/include/editeng/brushitem.hxx
+++ b/include/editeng/brushitem.hxx
@@ -19,6 +19,7 @@
#ifndef _SVX_BRSHITEM_HXX
#define _SVX_BRSHITEM_HXX
+#include <rtl/ref.hxx>
#include <svl/poolitem.hxx>
#include <vcl/wall.hxx>
#include <tools/link.hxx>
@@ -51,10 +52,10 @@ class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem
Color aColor;
sal_Int32 nShadingValue;
SvxBrushItem_Impl* pImpl;
- String* pStrLink;
- String* pStrFilter;
+ OUString* pStrLink;
+ OUString* pStrFilter;
SvxGraphicPosition eGraphicPos;
- sal_Bool bLoadAgain;
+ sal_Bool bLoadAgain;
void ApplyGraphicTransparency_Impl();
DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *);
@@ -70,9 +71,9 @@ public:
SvxBrushItem( const Graphic& rGraphic,
SvxGraphicPosition ePos, sal_uInt16 nWhich );
- SvxBrushItem( const GraphicObject& rGraphicObj,
+ SvxBrushItem( const rtl::Reference<GraphicObject>& rGraphicObj,
SvxGraphicPosition ePos, sal_uInt16 nWhich );
- SvxBrushItem( const String& rLink, const String& rFilter,
+ SvxBrushItem( const OUString& rLink, const OUString& rFilter,
SvxGraphicPosition ePos, sal_uInt16 nWhich );
SvxBrushItem( const SvxBrushItem& );
SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich );
@@ -86,18 +87,18 @@ public:
SfxMapUnit ePresMetric,
OUString &rText, const IntlWrapper * = 0 ) const;
- virtual int operator==( const SfxPoolItem& ) const;
- virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
- virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
- virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
- virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
- const Color& GetColor() const { return aColor; }
- Color& GetColor() { return aColor; }
- void SetColor( const Color& rCol) { aColor = rCol; }
+ const Color& GetColor() const { return aColor; }
+ Color& GetColor() { return aColor; }
+ void SetColor( const Color& rCol) { aColor = rCol; }
void SetDoneLink( const Link& rLink );
@@ -105,24 +106,24 @@ public:
void PurgeMedium() const;
- sal_uInt32 GetShadingValue() const { return nShadingValue; }
- const Graphic* GetGraphic() const;
- const GraphicObject* GetGraphicObject() const;
- const String* GetGraphicLink() const { return pStrLink; }
- const String* GetGraphicFilter() const { return pStrFilter; }
+ sal_uInt32 GetShadingValue() const { return nShadingValue; }
+ const Graphic* GetGraphic() const;
+ const rtl::Reference<GraphicObject> GetGraphicObject() const;
+ const OUString* GetGraphicLink() const { return pStrLink; }
+ const OUString* GetGraphicFilter() const { return pStrFilter; }
void SetShadingValue( const sal_uInt32 nNew );
void SetGraphicPos( SvxGraphicPosition eNew );
void SetGraphic( const Graphic& rNew );
- void SetGraphicObject( const GraphicObject& rNewObj );
- void SetGraphicLink( const String& rNew );
- void SetGraphicFilter( const String& rNew );
+ void SetGraphicObject( const rtl::Reference<GraphicObject>& rNewObj );
+ void SetGraphicLink( const OUString& rNew );
+ void SetGraphicFilter( const OUString& rNew );
SvxBrushItem& operator=( const SvxBrushItem& rItem);
- static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
- static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
- static sal_Int8 TransparencyToPercent(sal_Int32 nTrans);
+ static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
+ static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
+ static sal_Int8 TransparencyToPercent(sal_Int32 nTrans);
};
#endif // #ifndef _SVX_BRSHITEM_HXX
diff --git a/include/editeng/bulletitem.hxx b/include/editeng/bulletitem.hxx
index 70e558689aa7..b99ce97881eb 100644
--- a/include/editeng/bulletitem.hxx
+++ b/include/editeng/bulletitem.hxx
@@ -62,13 +62,13 @@
class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem
{
Font aFont;
- GraphicObject* pGraphicObject;
+ rtl::Reference<GraphicObject> m_rGraphicObject;
String aPrevText;
String aFollowText;
- sal_uInt16 nStart;
- sal_uInt16 nStyle;
+ sal_uInt16 nStart;
+ sal_uInt16 nStyle;
long nWidth;
- sal_uInt16 nScale;
+ sal_uInt16 nScale;
sal_Unicode cSymbol;
sal_uInt8 nJustify;
sal_uInt16 nValidMask; // Only temporary for GetAttribs / setAttribs,
@@ -85,24 +85,24 @@ public:
SvxBulletItem( const SvxBulletItem& );
~SvxBulletItem();
- virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
- virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
- virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const;
String GetFullText() const;
sal_Unicode GetSymbol() const { return cSymbol; }
String GetPrevText() const { return aPrevText; }
String GetFollowText() const { return aFollowText; }
- sal_uInt16 GetStart() const { return nStart; }
+ sal_uInt16 GetStart() const { return nStart; }
long GetWidth() const { return nWidth; }
- sal_uInt16 GetStyle() const { return nStyle; }
- sal_uInt8 GetJustification() const { return nJustify; }
+ sal_uInt16 GetStyle() const { return nStyle; }
+ sal_uInt8 GetJustification() const { return nJustify; }
Font GetFont() const { return aFont; }
- sal_uInt16 GetScale() const { return nScale; }
+ sal_uInt16 GetScale() const { return nScale; }
- const GraphicObject& GetGraphicObject() const;
- void SetGraphicObject( const GraphicObject& rGraphicObject );
+ const rtl::Reference<GraphicObject> GetGraphicObject() const;
+ void SetGraphicObject( const rtl::Reference<GraphicObject>& rGraphicObject );
void SetSymbol( sal_Unicode c) { cSymbol = c; }
void SetPrevText( const String& rStr) { aPrevText = rStr;}
@@ -115,19 +115,19 @@ public:
void SetFont( const Font& rNew) { aFont = rNew; }
void SetScale( sal_uInt16 nNew ) { nScale = nNew; }
- virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const;
+ virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const;
virtual int operator==( const SfxPoolItem& ) const;
virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- OUString &rText, const IntlWrapper * = 0 ) const;
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
static void StoreFont( SvStream&, const Font& );
static Font CreateFont( SvStream&, sal_uInt16 nVer );
- sal_uInt16& GetValidMask() { return nValidMask; }
- sal_uInt16 GetValidMask() const { return nValidMask; }
- sal_uInt16 IsValid( sal_uInt16 nFlag ) const { return nValidMask & nFlag; }
+ sal_uInt16& GetValidMask() { return nValidMask; }
+ sal_uInt16 GetValidMask() const { return nValidMask; }
+ sal_uInt16 IsValid( sal_uInt16 nFlag ) const { return nValidMask & nFlag; }
void SetValid( sal_uInt16 nFlag, sal_Bool bValid )
{
if ( bValid )
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 9f88e79de0ec..74df81a7c4b8 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -72,8 +72,8 @@ public:
SvxNumberType(const SvxNumberType& rType);
~SvxNumberType();
- String GetNumStr( sal_uLong nNo ) const;
- String GetNumStr( sal_uLong nNo, const com::sun::star::lang::Locale& rLocale ) const;
+ OUString GetNumStr( sal_uLong nNo ) const;
+ OUString GetNumStr( sal_uLong nNo, const com::sun::star::lang::Locale& rLocale ) const;
void SetNumberingType(sal_Int16 nSet) {nNumType = nSet;}
sal_Int16 GetNumberingType() const {return nNumType;}
@@ -105,8 +105,8 @@ public:
};
private:
- OUString sPrefix;
- OUString sSuffix;
+ OUString m_sPrefix;
+ OUString m_sSuffix;
SvxAdjust eNumAdjust;
@@ -149,7 +149,7 @@ private:
Size aGraphicSize; // Always! in 1/100 mm
Font* pBulletFont; // Pointer to the bullet font
- String sCharStyleName; // Character Style
+ OUString m_sCharStyleName; // Character Style
DECL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void * );
virtual void NotifyGraphicArrived();
@@ -170,13 +170,13 @@ public:
void SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;}
SvxAdjust GetNumAdjust() const {return eNumAdjust;}
- void SetPrefix(const OUString& rSet) { sPrefix = rSet;}
- const OUString& GetPrefix() const { return sPrefix;}
- void SetSuffix(const OUString& rSet) { sSuffix = rSet;}
- const OUString& GetSuffix() const { return sSuffix;}
+ void SetPrefix(const OUString& rSet) { m_sPrefix = rSet;}
+ const OUString& GetPrefix() const { return m_sPrefix;}
+ void SetSuffix(const OUString& rSet) { m_sSuffix = rSet;}
+ const OUString& GetSuffix() const { return m_sSuffix;}
- void SetCharFmtName(const String& rSet){ sCharStyleName = rSet; }
- virtual const String& GetCharFmtName()const;
+ void SetCharFmtName(const OUString& rSet){ m_sCharStyleName = rSet; }
+ virtual OUString GetCharFmtName()const;
void SetBulletFont(const Font* pFont);
const Font* GetBulletFont() const {return pBulletFont;}
@@ -194,7 +194,7 @@ public:
virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = 0, const sal_Int16* pOrient = 0);
const SvxBrushItem* GetBrush() const {return pGraphicBrush;}
- void SetGraphic( const String& rName );
+ void SetGraphic( const OUString& rName );
virtual void SetVertOrient(sal_Int16 eSet);
virtual sal_Int16 GetVertOrient() const;
void SetGraphicSize(const Size& rSet) {aGraphicSize = rSet;}
@@ -222,7 +222,7 @@ public:
long GetIndentAt() const;
static Size GetGraphicSizeMM100(const Graphic* pGraphic);
- static String CreateRomanString( sal_uLong nNo, sal_Bool bUpper );
+ static OUString CreateRomanString( sal_uLong nNo, sal_Bool bUpper );
};
enum SvxNumRuleType
@@ -280,7 +280,7 @@ public:
sal_uInt32 GetFeatureFlags() const {return nFeatureFlags;}
void SetFeatureFlag( sal_uInt32 nFlag, sal_Bool bSet = sal_True ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; }
- String MakeNumString( const SvxNodeNum&, sal_Bool bInclStrings = sal_True ) const;
+ OUString MakeNumString( const SvxNodeNum&, sal_Bool bInclStrings = sal_True ) const;
SvxNumRuleType GetNumRuleType() const { return eNumberingType; }
void SetNumRuleType( const SvxNumRuleType& rType ) { eNumberingType = rType; }
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 261a47b41271..e188919578a4 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -466,17 +466,16 @@ public:
class EDITENG_DLLPUBLIC DrawBulletInfo
{
public:
- const GraphicObject maBulletGraphicObject;
+ const rtl::Reference<GraphicObject> maBulletGraphicObject;
Point maBulletPosition;
Size maBulletSize;
- DrawBulletInfo(
- const GraphicObject& rBulletGraphicObject,
- const Point& rBulletPosition,
- const Size& rBulletSize)
- : maBulletGraphicObject(rBulletGraphicObject),
- maBulletPosition(rBulletPosition),
- maBulletSize(rBulletSize)
+ DrawBulletInfo( const rtl::Reference<GraphicObject>& rBulletGraphicObject,
+ const Point& rBulletPosition,
+ const Size& rBulletSize)
+ : maBulletGraphicObject(rBulletGraphicObject)
+ , maBulletPosition(rBulletPosition)
+ , maBulletSize(rBulletSize)
{}
};
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
index 4ad2dae48f02..065fe5bbf6cc 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/sfx2/frmhtmlw.hxx b/include/sfx2/frmhtmlw.hxx
index 3abdfbee3107..6f660970ff2a 100644
--- a/include/sfx2/frmhtmlw.hxx
+++ b/include/sfx2/frmhtmlw.hxx
@@ -43,37 +43,36 @@ class SFX2_DLLPUBLIC SfxFrameHTMLWriter
{
SAL_DLLPRIVATE static const sal_Char sNewLine[];
SAL_DLLPRIVATE static void OutMeta( SvStream& rStrm,
- const sal_Char *pIndent, const String& rName,
- const String& rContent, sal_Bool bHTTPEquiv,
- rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars = 0 );
+ const sal_Char *pIndent, const OUString& rName,
+ const OUString& rContent, sal_Bool bHTTPEquiv,
+ rtl_TextEncoding eDestEnc,
+ OUString* pNonConvertableChars = 0 );
SAL_DLLPRIVATE inline static void OutMeta( SvStream& rStrm,
- const sal_Char *pIndent, const sal_Char *pName,
- const String& rContent, sal_Bool bHTTPEquiv,
- rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars = 0 );
+ const sal_Char *pIndent, const sal_Char *pName,
+ const OUString& rContent, sal_Bool bHTTPEquiv,
+ rtl_TextEncoding eDestEnc,
+ OUString* pNonConvertableChars = 0 );
public:
- static void Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::document::XDocumentProperties>&,
- const sal_Char *pIndent,
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- String *pNonConvertableChars = 0 );
+ static void Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL,
+ const ::css::uno::Reference< ::css::document::XDocumentProperties>&,
+ const sal_Char *pIndent,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ OUString* pNonConvertableChars = 0 );
- static void Out_FrameDescriptor(
- SvStream&, const String& rBaseURL, const com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet >& xSet,
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- String *pNonConvertableChars = 0 );
+ static void Out_FrameDescriptor( SvStream&, const OUString& rBaseURL,
+ const css::uno::Reference < com::sun::star::beans::XPropertySet >& xSet,
+ rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
+ OUString* pNonConvertableChars = 0 );
};
inline void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm,
- const sal_Char *pIndent, const sal_Char *pName,
- const String& rContent, sal_Bool bHTTPEquiv,
- rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars )
+ const sal_Char *pIndent, const sal_Char *pName,
+ const OUString& rContent, sal_Bool bHTTPEquiv,
+ rtl_TextEncoding eDestEnc,
+ OUString* pNonConvertableChars )
{
- String sTmp = OUString::createFromAscii(pName);
+ OUString sTmp = OUString::createFromAscii(pName);
OutMeta( rStrm, pIndent, sTmp, rContent, bHTTPEquiv, eDestEnc, pNonConvertableChars );
}
diff --git a/include/svtools/GraphicManager.hxx b/include/svtools/GraphicManager.hxx
index ee75e4f7b2d5..a062f9659475 100644
--- a/include/svtools/GraphicManager.hxx
+++ b/include/svtools/GraphicManager.hxx
@@ -28,13 +28,14 @@ class GraphicObject;
class GraphicCache;
#include <vector>
+#include <rtl/ref.hxx>
#include <vcl/virdev.hxx>
#include <svtools/svtdllapi.h>
#define GRAPHIC_MANAGER_CACHE_SIZE 15000000UL
#define GRAPHCI_MANAGER_MAX_OBJECT_CACHE_SIZE 3000000UL
-typedef ::std::vector< GraphicObject* > GraphicObjectList;
+typedef ::std::vector< const GraphicObject* > GraphicObjectList;
class SVT_DLLPUBLIC GraphicManager
{
@@ -52,30 +53,34 @@ class SVT_DLLPUBLIC GraphicManager
sal_uInt32 nAdjustmentFlags );
bool Draw( OutputDevice* pOutDev, const Point& rPoint,
- const Size& rSize, GraphicObject& rGraphicObject,
+ const Size& rSize, GraphicObject* pGraphicObject,
const GraphicAttr& rGraphicAttr, const sal_uInt32 nFlags,
bool& rCached);
bool DrawObj( OutputDevice* pOut, const Point& rPt,
- const Size& rSz, GraphicObject& rObj,
+ const Size& rSz, GraphicObject* pObj,
const GraphicAttr& rAttr, const sal_uInt32 nFlags,
bool& rCached);
- bool FillSwappedGraphicObject( const GraphicObject& rGraphicObject, Graphic& rSubstituteGraphicObject );
- OString GetUniqueID( const GraphicObject& rGraphicObject ) const;
- void GraphicObjectWasSwappedIn( const GraphicObject& rGraphicObjet );
- void GraphicObjectWasSwappedOut( const GraphicObject& rGRaphicObject );
+ bool FillSwappedGraphicObject( const rtl::Reference<GraphicObject>& rGraphicObject, Graphic& rSubstituteGraphicObject );
+ OString GetUniqueID( const rtl::Reference<GraphicObject>& rGraphicObject ) const;
+ OString GetUniqueID( const GraphicObject* pGraphicObject ) const;
+ void GraphicObjectWasSwappedIn( const rtl::Reference<GraphicObject>& rGraphicObjet );
+ void GraphicObjectWasSwappedOut( const rtl::Reference<GraphicObject>& rGRaphicObject );
inline bool HasObjects() const { return !maObjectList.empty(); }
bool IsInCache( OutputDevice* pOut, const Point& rPt,
- const Size& rSz, const GraphicObject& rObj,
+ const Size& rSz, const rtl::Reference<GraphicObject>& rObj,
const GraphicAttr& rAttr ) const;
- void RegisterObject( const GraphicObject& rGraphicObject, Graphic& rSubstituteGraphicObject,
- const OString* pID = NULL, const GraphicObject* pCopyObj = NULL );
+ bool IsInCache( OutputDevice* pOut, const Point& rPt,
+ const Size& rSz, const GraphicObject* pObj,
+ const GraphicAttr& rAttr ) const;
+ void RegisterObject( const GraphicObject* rGraphicObject, Graphic& rSubstituteGraphicObject,
+ const OString* pID = NULL, const GraphicObject* pCopyObj = NULL );
void ReleaseFromCache( const GraphicObject& rObj );
void SetCacheTimeout( int nTimeoutSeconds );
void SetMaxCacheSize( size_t nNewCacheSize );
void SetMaxObjCacheSize( size_t nNewMaxObjSize,
bool bDestroyGreaterCached = false);
- void UnregisterObject( const GraphicObject& rGraphicObject );
+ void UnregisterObject( const GraphicObject* pGraphicObject );
static void Draw( OutputDevice* pOutDev, const Point& rPoint,
const Size& rSize, GDIMetaFile& rMtf,
diff --git a/include/svtools/GraphicObject.hxx b/include/svtools/GraphicObject.hxx
index fa0d653cc021..8aa3886b6546 100644
--- a/include/svtools/GraphicObject.hxx
+++ b/include/svtools/GraphicObject.hxx
@@ -20,6 +20,9 @@
#ifndef _GRFMGR_HXX
#define _GRFMGR_HXX
+#include <rtl/ref.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/graphic/XGraphicObject.hpp>
#include <vcl/graph.hxx>
#include <svtools/svtdllapi.h>
@@ -80,7 +83,7 @@ private:
short mnRPercent;
short mnGPercent;
short mnBPercent;
- sal_Bool mbInvert;
+ bool mbInvert;
sal_uInt8 mcTransparency;
GraphicDrawMode meDrawMode;
@@ -89,8 +92,8 @@ public:
GraphicAttr();
~GraphicAttr();
- sal_Bool operator==( const GraphicAttr& rAttr ) const;
- sal_Bool operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); }
+ bool operator==( const GraphicAttr& rAttr ) const;
+ bool operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); }
void SetDrawMode( GraphicDrawMode eDrawMode ) { meDrawMode = eDrawMode; }
GraphicDrawMode GetDrawMode() const { return meDrawMode; }
@@ -129,22 +132,22 @@ public:
void SetGamma( double fGamma ) { mfGamma = fGamma; }
double GetGamma() const { return mfGamma; }
- void SetInvert( sal_Bool bInvert ) { mbInvert = bInvert; }
- sal_Bool IsInvert() const { return mbInvert; }
+ void SetInvert( bool bInvert ) { mbInvert = bInvert; }
+ bool IsInvert() const { return mbInvert; }
void SetTransparency( sal_uInt8 cTransparency ) { mcTransparency = cTransparency; }
sal_uInt8 GetTransparency() const { return mcTransparency; }
- sal_Bool IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); }
- sal_Bool IsMirrored() const { return( mnMirrFlags != 0UL ); }
- sal_Bool IsCropped() const
+ bool IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); }
+ bool IsMirrored() const { return( mnMirrFlags != 0UL ); }
+ bool IsCropped() const
{
return( mnLeftCrop != 0 || mnTopCrop != 0 ||
mnRightCrop != 0 || mnBottomCrop != 0 );
}
- sal_Bool IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); }
- sal_Bool IsTransparent() const { return( mcTransparency > 0 ); }
- sal_Bool IsAdjusted() const
+ bool IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); }
+ bool IsTransparent() const { return( mcTransparency > 0 ); }
+ bool IsAdjusted() const
{
return( mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 ||
mnGPercent != 0 || mnBPercent != 0 || mfGamma != 1.0 || mbInvert );
@@ -154,46 +157,101 @@ public:
friend SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr );
};
-class SVT_DLLPUBLIC GraphicObject : public SvDataCopyStream
+typedef ::cppu::WeakImplHelper1< css::graphic::XGraphicObject > GraphicObject_BASE;
+
+class SVT_DLLPUBLIC GraphicObject : public GraphicObject_BASE
{
+ sal_uInt32 nRefCount;
+ // XGraphicObject
+ virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL getGraphic()
+ throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setGraphic( const css::uno::Reference< css::graphic::XGraphic >& xGraphic )
+ throw (css::uno::RuntimeException);
+ OUString SAL_CALL getUniqueID() throw (css::uno::RuntimeException);
+
+ GraphicObject( void );
+ GraphicObject( const GraphicObject* pGraphicObject);
+ GraphicObject( const GraphicObject* pGraphicObject, const Graphic& rGraphic);
+ GraphicObject( const Graphic& rGraphic);
+ GraphicObject( const GraphicObject& rCacheObj);
+ GraphicObject& operator=( const GraphicObject& rCacheObj );
+
+ explicit GraphicObject( const OString& rUniqueID);
+
+public: // only for internal access:
+ GraphicObject( css::uno::Sequence< css::uno::Any > const & args,
+ css::uno::Reference< css::uno::XComponentContext > const & xComponentContext )
+ throw( css::uno::RuntimeException );
+ virtual ~GraphicObject();
+
+ static rtl::Reference< GraphicObject > Create(void)
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject() );
+ }
+ static rtl::Reference< GraphicObject > Create( const Graphic& rGraphic)
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject( rGraphic) );
+ }
+ static rtl::Reference< GraphicObject > Create( const GraphicObject& rCacheObj)
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject( rCacheObj) );
+ }
+ static rtl::Reference< GraphicObject > Create( const GraphicObject* pCacheObj)
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject( pCacheObj) );
+ }
+ 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 >( new GraphicObject());
+ }
+ static rtl::Reference< GraphicObject > Create( const rtl::Reference< GraphicObject > &xCacheObj, const Graphic& rGraphic)
+ {
+ if( xCacheObj.is() )
+ return rtl::Reference< GraphicObject >( new GraphicObject( xCacheObj.get(), rGraphic) );
+ else
+ return rtl::Reference< GraphicObject >( new GraphicObject(rGraphic));
+ }
+ static rtl::Reference< GraphicObject > Create( const OString& rUniqueID)
+ {
+ return rtl::Reference< GraphicObject >( new GraphicObject( rUniqueID) );
+ }
+
private:
- Graphic maGraphic;
- GraphicAttr maAttr;
- Size maPrefSize;
- MapMode maPrefMapMode;
- sal_uLong mnSizeBytes;
- GraphicType meType;
- String* mpLink;
- Link* mpSwapStreamHdl;
- String* mpUserData;
- Timer* mpSwapOutTimer;
- GrfSimpleCacheObj* mpSimpleCache;
- sal_uLong mnAnimationLoopCount;
- sal_Bool mbAutoSwapped : 1;
- sal_Bool mbTransparent : 1;
- sal_Bool mbAnimated : 1;
- sal_Bool mbEPS : 1;
- sal_Bool mbIsInSwapIn : 1;
- sal_Bool mbIsInSwapOut : 1;
- sal_Bool mbAlpha : 1;
-
- void SVT_DLLPRIVATE ImplConstruct();
- void SVT_DLLPRIVATE ImplAssignGraphicData();
- void SVT_DLLPRIVATE ImplSetGraphicManager(
- const GraphicManager* pMgr,
- const OString* pID = NULL,
- const GraphicObject* pCopyObj = NULL
- );
- void SVT_DLLPRIVATE ImplAutoSwapIn();
- sal_Bool SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; }
- sal_Bool SVT_DLLPRIVATE ImplGetCropParams(
- OutputDevice* pOut,
- Point& rPt,
- Size& rSz,
- const GraphicAttr* pAttr,
- PolyPolygon& rClipPolyPoly,
- sal_Bool& bRectClipRegion
- ) const;
+ Graphic maGraphic;
+ GraphicAttr maAttr;
+ Size maPrefSize;
+ MapMode maPrefMapMode;
+ sal_uLong mnSizeBytes;
+ GraphicType meType;
+ OUString* mpLink;
+ Link* mpSwapStreamHdl;
+ OUString* mpUserData;
+ Timer* mpSwapOutTimer;
+ GrfSimpleCacheObj* mpSimpleCache;
+ sal_uLong mnAnimationLoopCount;
+ bool mbAutoSwapped : 1;
+ bool mbTransparent : 1;
+ bool mbAnimated : 1;
+ bool mbEPS : 1;
+ bool mbIsInSwapIn : 1;
+ bool mbIsInSwapOut : 1;
+ bool mbAlpha : 1;
+
+ void SVT_DLLPRIVATE ImplConstruct();
+ void SVT_DLLPRIVATE ImplAssignGraphicData();
+ void SVT_DLLPRIVATE ImplSetGraphicManager( const OString* pID = NULL,
+ const GraphicObject* pCopyObj = NULL);
+ void SVT_DLLPRIVATE ImplAutoSwapIn();
+ bool SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; }
+ bool SVT_DLLPRIVATE ImplGetCropParams( OutputDevice* pOut,
+ Point& rPoint,
+ Size& rSize,
+ const GraphicAttr* pAttr,
+ PolyPolygon& rClipPolyPoly,
+ bool& bRectClipRegion ) const;
/** Render a given number of tiles in an optimized way
@@ -288,7 +346,7 @@ private:
const Size& rCropRightBottom,
const Rectangle& rCropRect,
const Size& rDstSize,
- sal_Bool bEnlarge
+ bool bEnlarge
) const;
DECL_LINK( ImplAutoSwapOutHdl, void* );
@@ -298,44 +356,36 @@ 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();
- GraphicObject( const GraphicManager* pMgr = NULL );
- GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr = NULL );
- GraphicObject( const GraphicObject& rCacheObj, const GraphicManager* pMgr = NULL );
- explicit GraphicObject( const OString& rUniqueID, const GraphicManager* pMgr = NULL );
- ~GraphicObject();
-
- GraphicObject& operator=( const GraphicObject& rCacheObj );
- sal_Bool operator==( const GraphicObject& rCacheObj ) const;
- sal_Bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); }
+// GraphicObject& operator=( const GraphicObject& rCacheObj );
+ bool operator==( const GraphicObject& rCacheObj ) const;
+ bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); }
- sal_Bool HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); }
- void SetSwapStreamHdl();
- void SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOutTimeout = 0UL );
- sal_uLong GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); }
+ bool HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); }
+ void SetSwapStreamHdl();
+ void SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOutTimeout = 0UL );
+ sal_uLong GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); }
- void FireSwapInRequest();
- void FireSwapOutRequest();
+ void FireSwapInRequest();
+ void FireSwapOutRequest();
- sal_Bool IsCached(
- OutputDevice* pOut,
- const Point& rPt,
- const Size& rSz,
- const GraphicAttr* pAttr = NULL,
- sal_uLong nFlags = GRFMGR_DRAW_STANDARD
- ) const;
- void ReleaseFromCache();
+ bool IsCached( OutputDevice* pOut,
+ const Point& rPoint,
+ const Size& rSize,
+ const GraphicAttr* pAttr = NULL,
+ sal_uLong nFlags = GRFMGR_DRAW_STANDARD ) const;
+ void ReleaseFromCache();
- const Graphic& GetGraphic() const;
- void SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0);
- void SetGraphic( const Graphic& rGraphic, const String& rLink );
+ const Graphic& GetGraphic() const;
+// void SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0);
+// void SetGraphic( const Graphic& rGraphic, const String& rLink );
/** Get graphic transformed according to given attributes
@@ -362,64 +412,58 @@ public:
@return the readily transformed Graphic
*/
- Graphic GetTransformedGraphic(
- const Size& rDestSize,
- const MapMode& rDestMap,
- const GraphicAttr& rAttr
- ) const;
- Graphic GetTransformedGraphic( const GraphicAttr* pAttr = NULL ) const; // TODO: Change to Impl
-
- void SetAttr( const GraphicAttr& rAttr );
- const GraphicAttr& GetAttr() const { return maAttr; }
-
- sal_Bool HasLink() const { return( mpLink != NULL && mpLink->Len() > 0 ); }
- void SetLink();
- void SetLink( const String& rLink );
- String GetLink() const;
-
- sal_Bool HasUserData() const { return( mpUserData != NULL && mpUserData->Len() > 0 ); }
- void SetUserData();
- void SetUserData( const String& rUserData );
- String GetUserData() const;
-
- OString GetUniqueID() const;
-
- GraphicType GetType() const { return meType; }
- const Size& GetPrefSize() const { return maPrefSize; }
- const MapMode& GetPrefMapMode() const { return maPrefMapMode; }
- sal_uLong GetSizeBytes() const { return mnSizeBytes; }
- sal_Bool IsTransparent() const { return mbTransparent; }
- sal_Bool IsAlpha() const { return mbAlpha; }
- sal_Bool IsAnimated() const { return mbAnimated; }
- sal_Bool IsEPS() const { return mbEPS; }
-
- Link GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); }
-
- sal_Bool SwapOut();
- sal_Bool SwapOut( SvStream* pOStm );
- sal_Bool SwapIn();
-
- sal_Bool IsInSwapIn() const { return mbIsInSwapIn; }
- sal_Bool IsInSwapOut() const { return mbIsInSwapOut; }
- sal_Bool IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); }
- sal_Bool IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); }
- void SetSwapState();
-
- bool Draw(
- OutputDevice* pOut,
- const Point& rPt,
- const Size& rSz,
- const GraphicAttr* pAttr = NULL,
- sal_uLong nFlags = GRFMGR_DRAW_STANDARD
- );
-
- sal_Bool DrawWithPDFHandling(
- OutputDevice& rOutDev,
- const Point& rPt,
- const Size& rSz,
- const GraphicAttr* pGrfAttr = NULL,
- const sal_uLong nFlags = GRFMGR_DRAW_STANDARD
- );
+ Graphic GetTransformedGraphic( const Size& rDestSize,
+ const MapMode& rDestMap,
+ const GraphicAttr& rAttr ) const;
+ Graphic GetTransformedGraphic( const GraphicAttr* pAttr = NULL ) const; // TODO: Change to Impl
+
+ void SetAttr( const GraphicAttr& rAttr );
+ const GraphicAttr& GetAttr() const { return maAttr; }
+
+ bool HasLink() const { return( mpLink != NULL && !mpLink->isEmpty() ); }
+ void SetLink();
+ void SetLink( const OUString& rLink );
+ OUString GetLink() const;
+
+ bool HasUserData() const { return( mpUserData != NULL && !mpUserData->isEmpty()); }
+ void SetUserData();
+ void SetUserData( const OUString& rUserData );
+ OUString GetUserData() const;
+
+ OString GetUniqueID() const;
+
+ GraphicType GetType() const { return meType; }
+ const Size& GetPrefSize() const { return maPrefSize; }
+ const MapMode& GetPrefMapMode() const { return maPrefMapMode; }
+ sal_uLong GetSizeBytes() const { return mnSizeBytes; }
+ bool IsTransparent() const { return mbTransparent; }
+ bool IsAlpha() const { return mbAlpha; }
+ bool IsAnimated() const { return mbAnimated; }
+ bool IsEPS() const { return mbEPS; }
+
+ Link GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); }
+
+ bool SwapOut();
+ bool SwapOut( SvStream* pOStm );
+ bool SwapIn();
+
+ bool IsInSwapIn() const { return mbIsInSwapIn; }
+ bool IsInSwapOut() const { return mbIsInSwapOut; }
+ bool IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); }
+ bool IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); }
+ void SetSwapState();
+
+ bool Draw( OutputDevice* pOut,
+ const Point& rPoint,
+ const Size& rSize,
+ const GraphicAttr* pAttr = NULL,
+ sal_uLong nFlags = GRFMGR_DRAW_STANDARD );
+
+ bool DrawWithPDFHandling( OutputDevice& rOutDev,
+ const Point& rPoint,
+ const Size& rSize,
+ const GraphicAttr* pGrfAttr = NULL,
+ const sal_uLong nFlags = GRFMGR_DRAW_STANDARD );
/** Draw the graphic repeatedly into the given output rectangle
@@ -454,32 +498,28 @@ public:
@return sal_True, if drawing completed successfully
*/
- sal_Bool DrawTiled(
- OutputDevice* pOut,
- const Rectangle& rArea,
- const Size& rSize,
- const Size& rOffset,
- const GraphicAttr* pAttr = NULL,
- sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
- int nTileCacheSize1D=128
- );
-
- sal_Bool StartAnimation(
- OutputDevice* pOut,
+ bool DrawTiled( OutputDevice* pOut,
+ const Rectangle& rArea,
+ const Size& rSize,
+ const Size& rOffset,
+ const GraphicAttr* pAttr = NULL,
+ sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
+ int nTileCacheSize1D=128 );
+
+ bool StartAnimation( OutputDevice* pOut,
const Point& rPt,
const Size& rSz,
long nExtraData = 0L,
const GraphicAttr* pAttr = NULL,
sal_uLong nFlags = GRFMGR_DRAW_STANDARD,
- OutputDevice* pFirstFrameOutDev = NULL
- );
+ OutputDevice* pFirstFrameOutDev = NULL );
- void StopAnimation( OutputDevice* pOut = NULL, long nExtraData = 0L );
+ 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 GraphicObject CreateGraphicObjectFromURL( const OUString &rURL );
+ static rtl::Reference<GraphicObject> CreateGraphicObjectFromURL( const OUString &rURL );
// will inspect an object ( e.g. a control ) for any 'ImageURL'
// properties and return these in a vector. Note: this implementation
// will cater for XNameContainer objects and deepinspect any containees
@@ -489,13 +529,12 @@ public:
// create CropScaling information
// fWidth, fHeight: object size
// f*Crop: crop values relative to original bitmap size
- basegfx::B2DVector calculateCropScaling(
- double fWidth,
- double fHeight,
- double fLeftCrop,
- double fTopCrop,
- double fRightCrop,
- double fBottomCrop) const;
+ basegfx::B2DVector calculateCropScaling( double fWidth,
+ double fHeight,
+ double fLeftCrop,
+ double fTopCrop,
+ double fRightCrop,
+ double fBottomCrop) const;
};
#endif // _GRFMGR_HXX
diff --git a/include/svtools/htmlout.hxx b/include/svtools/htmlout.hxx
index 52c92343c61d..0ba7d1d3b2f2 100644
--- a/include/svtools/htmlout.hxx
+++ b/include/svtools/htmlout.hxx
@@ -58,57 +58,57 @@ struct HTMLOutFuncs
static const sal_Char sNewLine[]; // \015\012
#endif
- SVT_DLLPUBLIC static OString ConvertStringToHTML( const String& sSrc,
+ SVT_DLLPUBLIC static OString ConvertStringToHTML( const OUString& sSrc,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- String *pNonConvertableChars = 0 );
+ OUString* pNonConvertableChars = 0 );
SVT_DLLPUBLIC static SvStream& Out_AsciiTag( SvStream&, const sal_Char* pStr,
sal_Bool bOn = sal_True,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252);
SVT_DLLPUBLIC static SvStream& Out_Char( SvStream&, sal_Unicode cChar,
HTMLOutContext& rContext,
- String *pNonConvertableChars = 0 );
+ OUString* pNonConvertableChars = 0 );
SVT_DLLPUBLIC static SvStream& Out_String( SvStream&, const OUString&,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- String *pNonConvertableChars = 0 );
+ OUString* pNonConvertableChars = 0 );
SVT_DLLPUBLIC static SvStream& Out_Hex( SvStream&, sal_uLong nHex, sal_uInt8 nLen,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 );
SVT_DLLPUBLIC static SvStream& Out_Color( SvStream&, const Color&,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 );
- SVT_DLLPUBLIC static SvStream& Out_ImageMap( SvStream&, const String&, const ImageMap&, const String&,
+ SVT_DLLPUBLIC static SvStream& Out_ImageMap( SvStream&, const OUString&, const ImageMap&, const OUString&,
const HTMLOutEvent *pEventTable,
sal_Bool bOutStarBasic,
const sal_Char *pDelim = 0,
const sal_Char *pIndentArea = 0,
const sal_Char *pIndentMap = 0,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- String *pNonConvertableChars = 0 );
+ OUString* pNonConvertableChars = 0 );
SVT_DLLPUBLIC static SvStream& FlushToAscii( SvStream&, HTMLOutContext& rContext );
SVT_DLLPUBLIC static SvStream& OutScript( SvStream& rStrm,
- const String& rBaseURL,
- const String& rSource,
- const String& rLanguage,
+ const OUString& rBaseURL,
+ const OUString& rSource,
+ const OUString& rLanguage,
ScriptType eScriptType,
- const String& rSrc,
- const String *pSBLibrary = 0,
- const String *pSBModule = 0,
+ const OUString& rSrc,
+ const OUString *pSBLibrary = 0,
+ const OUString *pSBModule = 0,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- String *pNonConvertableChars = 0 );
+ OUString* pNonConvertableChars = 0 );
// der 3. Parameter ist ein Array von HTMLOutEvents, das mit einem
// nur aus 0 bestehen Eintrag terminiert ist.
SVT_DLLPUBLIC static SvStream& Out_Events( SvStream&, const SvxMacroTableDtor&,
const HTMLOutEvent*, sal_Bool bOutStarBasic,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- String *pNonConvertableChars = 0 );
+ OUString* pNonConvertableChars = 0 );
// <TD SDVAL="..." SDNUM="...">
SVT_DLLPUBLIC static OString CreateTableDataOptionsValNum(
sal_Bool bValue, double fVal, sal_uLong nFormat,
SvNumberFormatter& rFormatter,
rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- String *pNonConvertableChars = 0);
+ OUString* pNonConvertableChars = 0);
};
#endif
diff --git a/include/svx/extedit.hxx b/include/svx/extedit.hxx
index 8b1483fa835c..1f3ee4093a1a 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_rGraphicObject;
OUString m_aFileName;
ExternalToolEdit();
virtual ~ExternalToolEdit();
virtual void Update( Graphic& aGraphic ) = 0;
- void Edit( GraphicObject *pGraphic );
+ void Edit( rtl::Reference<GraphicObject>& rGraphic );
DECL_LINK( StartListeningEvent, void *pEvent );
diff --git a/include/svx/galctrl.hxx b/include/svx/galctrl.hxx
index a76fc06c55d1..22afd1fdc2e2 100644
--- a/include/svx/galctrl.hxx
+++ b/include/svx/galctrl.hxx
@@ -44,7 +44,7 @@ class SVX_DLLPUBLIC GalleryPreview : public Window, public DropTargetHelper, pub
{
private:
- GraphicObject aGraphicObj;
+ rtl::Reference<GraphicObject> m_rGraphicObj;
Rectangle aPreviewRect;
GalleryTheme* mpTheme;
@@ -74,7 +74,7 @@ public:
GalleryPreview( Window* pParent, const ResId& rResId );
~GalleryPreview();
- void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
+ void SetGraphic( const Graphic& rGraphic ) { m_rGraphicObj = GraphicObject::Create( rGraphic ); }
bool SetGraphic( const INetURLObject& );
void PreviewMedia( const INetURLObject& rURL );
};
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
index 16f84cbe907b..c29c7950b64e 100644
--- a/include/svx/galmisc.hxx
+++ b/include/svx/galmisc.hxx
@@ -20,6 +20,7 @@
#ifndef _SVX_GALMISC_HXX_
#define _SVX_GALMISC_HXX_
+#include <rtl/ref.hxx>
#include <sot/storage.hxx>
#include <tools/urlobj.hxx>
#include <svtools/imap.hxx>
@@ -28,7 +29,7 @@
#include <svx/svdobj.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/awt/XProgressMonitor.hpp>
-#include "svx/svxdllapi.h"
+#include <svx/svxdllapi.h>
#include <tools/date.hxx>
#include <tools/time.hxx>
@@ -37,7 +38,7 @@ class GalleryTheme;
struct ExchangeData
{
GalleryTheme* pTheme;
- String aEditedTitle;
+ OUString aEditedTitle;
Date aThemeChangeDate;
Time aThemeChangeTime;
@@ -78,25 +79,24 @@ enum SgaObjKind
#define GALLERY_DLG_COLOR Application::GetSettings().GetStyleSettings().GetDialogColor()
class ResMgr;
-class String;
class SvStream;
class Graphic;
class FmFormModel;
class ImageMap;
class Gallery;
-SVX_DLLPUBLIC ResMgr* GetGalleryResMgr();
-sal_uInt16 GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, String& rFilterName, sal_Bool bShowProgress = sal_False );
+SVX_DLLPUBLIC ResMgr* GetGalleryResMgr();
+sal_uInt16 GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, OUString& rFilterName, sal_Bool bShowProgress = sal_False );
sal_Bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel );
sal_Bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap );
-SVX_DLLPUBLIC String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen );
-String GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
+SVX_DLLPUBLIC OUString GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen );
+OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
sal_Bool FileExists( const INetURLObject& rURL );
sal_Bool CreateDir( const INetURLObject& rURL );
sal_Bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL );
sal_Bool KillFile( const INetURLObject& rURL );
-BitmapEx GalleryResGetBitmapEx( sal_uInt32 nId );
+BitmapEx GalleryResGetBitmapEx( sal_uInt32 nId );
class SgaIMapInfo : public SdrObjUserData, public SfxListener
{
@@ -125,7 +125,7 @@ class SgaUserDataFactory
{
public:
SgaUserDataFactory() { SdrObjFactory::InsertMakeUserDataHdl( USERDATA_HDL() ); }
- ~SgaUserDataFactory() { SdrObjFactory::RemoveMakeUserDataHdl( USERDATA_HDL() ); }
+ ~SgaUserDataFactory() { SdrObjFactory::RemoveMakeUserDataHdl( USERDATA_HDL() ); }
DECL_LINK( MakeUserData, SdrObjFactory* );
};
@@ -134,15 +134,14 @@ class GraphicFilter;
class SVX_DLLPUBLIC GalleryProgress
{
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XProgressBar > mxProgressBar;
- GraphicFilter* mpFilter;
+ ::css::uno::Reference< ::css::awt::XProgressBar > mxProgressBar;
+ GraphicFilter* mpFilter;
public:
+ GalleryProgress( GraphicFilter* pFilter = NULL );
+ ~GalleryProgress();
- GalleryProgress( GraphicFilter* pFilter = NULL );
- ~GalleryProgress();
-
- void Update( sal_uIntPtr nVal, sal_uIntPtr nMaxVal );
+ void Update( sal_uIntPtr nVal, sal_uIntPtr nMaxVal );
};
class Gallery;
@@ -160,14 +159,13 @@ private:
SgaObjKind meObjectKind;
sal_uInt32 mnObjectPos;
SotStorageStreamRef mxModelStream;
- GraphicObject* mpGraphicObject;
+ rtl::Reference<GraphicObject> m_rGraphicObject;
ImageMap* mpImageMap;
INetURLObject* mpURL;
protected:
-
GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObjectPos, bool bLazy );
- ~GalleryTransferable();
+ ~GalleryTransferable();
void InitData( bool bLazy );
@@ -205,17 +203,17 @@ private:
public:
- GalleryHint( sal_uIntPtr nType, const String& rThemeName, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
+ GalleryHint( sal_uIntPtr nType, const OUString& rThemeName, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
mnType( nType ), maThemeName( rThemeName ), mnData1( nData1 ), mnData2( nData2 ) {}
- GalleryHint( sal_uIntPtr nType, const String& rThemeName, const String& rStringData, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
+ GalleryHint( sal_uIntPtr nType, const OUString& rThemeName, const OUString& rStringData, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
mnType( nType ), maThemeName( rThemeName ), maStringData( rStringData ), mnData1( nData1 ), mnData2( nData2 ) {}
- sal_uIntPtr GetType() const { return mnType; }
+ sal_uIntPtr GetType() const { return mnType; }
const OUString& GetThemeName() const { return maThemeName; }
const OUString& GetStringData() const { return maStringData; }
- sal_uIntPtr GetData1() const { return mnData1; }
- sal_uIntPtr GetData2() const { return mnData2; }
+ sal_uIntPtr GetData1() const { return mnData1; }
+ sal_uIntPtr GetData2() const { return mnData2; }
};
#endif
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index 83899dbc4a45..cef4893704b5 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -50,8 +50,8 @@ struct GalleryObject
//UI visualization buffering
BitmapEx maPreviewBitmapEx;
Size maPreparedSize;
- String maTitle;
- String maPath;
+ OUString maTitle;
+ OUString maPath;
};
typedef ::std::vector< GalleryObject* > GalleryObjectList;
@@ -96,7 +96,7 @@ class GalleryTheme : public SfxBroadcaster
private:
GalleryObjectList aObjectList;
- String m_aDestDir;
+ OUString m_aDestDir;
bool m_bDestDirRelative;
SotStorageRef aSvDrawStorageRef;
Gallery* pParent;
@@ -145,11 +145,11 @@ public:
bool ChangeObjectPos( size_t nOldPos, size_t nNewPos );
SVX_DLLPUBLIC const OUString& GetName() const;
- const OUString& GetRealName() const;
+ const OUString& GetRealName() const;
// used for building gallery themes during compilation:
- const String& GetDestDir() const { return m_aDestDir; }
- void SetDestDir(const String& rDestDir, bool bRelative = true)
+ const OUString& GetDestDir() const { return m_aDestDir; }
+ void SetDestDir(const OUString& rDestDir, bool bRelative = true)
{ m_aDestDir = rDestDir; m_bDestDirRelative = bRelative; }
const INetURLObject& GetThmURL() const;
@@ -226,8 +226,8 @@ public:
static SVX_DLLPUBLIC void InsertAllThemes( ListBox& rListBox );
// for buffering PreviewBitmaps and strings for object and path
- void GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, String& rTitle, String& rPath) const;
- void SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const String& rTitle, const String& rPath);
+ void GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const;
+ void SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath);
};
SvStream& operator<<( SvStream& rOut, const GalleryTheme& rTheme );
diff --git a/include/svx/grfflt.hxx b/include/svx/grfflt.hxx
index 013df90e26b7..bd9fd663cc20 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, rtl::Reference<GraphicObject>* rFilterObject );
static void DisableGraphicFilterSlots( SfxItemSet& rSet );
};
diff --git a/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx
index 5e57fc7bf9fc..e2d195b40f46 100644
--- a/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx
+++ b/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx
@@ -39,7 +39,7 @@ namespace drawinglayer
private:
::basegfx::B2DHomMatrix maTransform;
attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
- GraphicObject maGraphicObject;
+ rtl::Reference<GraphicObject> m_rGraphicObject;
GraphicAttr maGraphicAttr;
protected:
@@ -50,13 +50,13 @@ namespace drawinglayer
SdrGrafPrimitive2D(
const ::basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
- const GraphicObject& rGraphicObject,
+ const rtl::Reference<GraphicObject>& rGraphicObject,
const GraphicAttr& rGraphicAttr);
// data access
const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
- const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+ const rtl::Reference<GraphicObject> getGraphicObject() const { return m_rGraphicObject; }
const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
bool isTransparent() const;
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 77e46437ff31..a7a4ec26b098 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -55,7 +55,6 @@ public:
}
};
-class GraphicObject;
class SdrGraphicLink;
/**
@@ -80,8 +79,8 @@ private:
OUString aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
OUString aFilterName;
- GraphicObject* pGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
- GraphicObject* mpReplacementGraphic;
+ mutable rtl::Reference<GraphicObject> m_rGraphicObject; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
+ rtl::Reference<GraphicObject> m_rReplacementGraphic;
SdrGraphicLink* pGraphicLink; // Und hier noch ein Pointer fuer gelinkte Grafiken
bool bMirrored:1; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben.
@@ -110,9 +109,9 @@ public:
SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect);
virtual ~SdrGrafObj();
- void SetGraphicObject( const GraphicObject& rGrfObj );
- const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const;
- const GraphicObject* GetReplacementGraphicObject() const;
+ void SetGraphicObject( const rtl::Reference<GraphicObject>& rGrfObj );
+ const rtl::Reference<GraphicObject> GetGraphicObject(bool bForceSwapIn = false) const;
+ const rtl::Reference<GraphicObject> GetReplacementGraphicObject() const;
void NbcSetGraphic(const Graphic& rGrf);
void SetGraphic(const Graphic& rGrf);
@@ -131,13 +130,13 @@ public:
const MapMode& GetGrafPrefMapMode() const;
const Size& GetGrafPrefSize() const;
- void SetGrafStreamURL( const String& rGraphicStreamURL );
+ void SetGrafStreamURL( const OUString& rGraphicStreamURL );
String GetGrafStreamURL() const;
void ForceSwapIn() const;
void ForceSwapOut() const;
- void SetGraphicLink(const OUString& rFileName, const String& rFilterName);
+ void SetGraphicLink(const OUString& rFileName, const OUString& rFilterName);
void ReleaseGraphicLink();
bool IsLinkedGraphic() const;
diff --git a/include/svx/xbitmap.hxx b/include/svx/xbitmap.hxx
index 8c245f2ffe42..564984943c00 100644
--- a/include/svx/xbitmap.hxx
+++ b/include/svx/xbitmap.hxx
@@ -30,14 +30,14 @@ class SVX_DLLPUBLIC XOBitmap
{
private:
XBitmapType eType;
- GraphicObject aGraphicObject;
+ rtl::Reference<GraphicObject> m_rGraphicObject;
sal_uInt16* pPixelArray;
Size aArraySize;
Color aPixelColor;
Color aBckgrColor;
sal_Bool bGraphicDirty;
- const GraphicObject& GetGraphicObject() const;
+ const rtl::Reference<GraphicObject> GetGraphicObject() const;
public:
XOBitmap( const Bitmap& rBitmap );
diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx
index e2f28f5f067b..7703b959253a 100644
--- a/include/svx/xbtmpit.hxx
+++ b/include/svx/xbtmpit.hxx
@@ -39,13 +39,13 @@ bool SVX_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, BitmapColor& o_rBa
class SVX_DLLPUBLIC XFillBitmapItem : public NameOrIndex
{
private:
- GraphicObject maGraphicObject;
+ rtl::Reference<GraphicObject> m_rGraphicObject;
public:
TYPEINFO();
XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) {}
- XFillBitmapItem(const String& rName, const GraphicObject& rGraphicObject);
- XFillBitmapItem(SfxItemPool* pPool, const GraphicObject& rGraphicObject);
+ XFillBitmapItem(const String& rName, const rtl::Reference<GraphicObject>& rGraphicObject);
+ XFillBitmapItem(SfxItemPool* pPool, const rtl::Reference<GraphicObject>& rGraphicObject);
XFillBitmapItem( const XFillBitmapItem& rItem );
XFillBitmapItem( SvStream& rIn, sal_uInt16 nVer = 0 );
@@ -63,8 +63,8 @@ public:
SfxMapUnit ePresMetric,
OUString &rText, const IntlWrapper * = 0 ) const;
- const GraphicObject& GetGraphicObject() const;
- void SetGraphicObject(const GraphicObject& rGraphicObject);
+ const rtl::Reference<GraphicObject> GetGraphicObject() const;
+ void SetGraphicObject(const rtl::Reference<GraphicObject>& rGraphicObject);
static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
XFillBitmapItem* checkForUniqueItem( SdrModel* pModel ) const;
diff --git a/include/svx/xmlgrhlp.hxx b/include/svx/xmlgrhlp.hxx
index 6f1cc43b2e95..fd1344d4fd51 100644
--- a/include/svx/xmlgrhlp.hxx
+++ b/include/svx/xmlgrhlp.hxx
@@ -57,7 +57,7 @@ private:
typedef ::std::pair< OUString, OUString > URLPair;
typedef ::std::vector< URLPair > URLPairVector;
- typedef ::std::vector< GraphicObject > GraphicObjectVector;
+ typedef ::std::vector< rtl::Reference<GraphicObject> > GraphicObjectVector;
typedef ::std::set< OUString > URLSet;
typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > > GraphicOutputStreamVector;
diff --git a/include/svx/xoutbmp.hxx b/include/svx/xoutbmp.hxx
index 3bb51cff44ca..3d69864ec0f5 100644
--- a/include/svx/xoutbmp.hxx
+++ b/include/svx/xoutbmp.hxx
@@ -51,14 +51,14 @@ public:
static Graphic MirrorGraphic( const Graphic& rGraphic, const sal_uIntPtr nMirrorFlags );
static Animation MirrorAnimation( const Animation& rAnimation, sal_Bool bHMirr, sal_Bool bVMirr );
- static sal_uInt16 WriteGraphic( const Graphic& rGraphic, String& rFileName,
- const String& rFilterName, const sal_uIntPtr nFlags = 0L,
- const Size* pMtfSize_100TH_MM = NULL );
+ static sal_uInt16 WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
+ const OUString& rFilterName, const sal_uIntPtr nFlags = 0L,
+ const Size* pMtfSize_100TH_MM = NULL );
static sal_uLong GraphicToBase64(const Graphic& rGraphic,OUString& rOUString);
static sal_uInt16 ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
- GraphicFilter& rFilter, const sal_uInt16 nFormat,
- const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL );
+ GraphicFilter& rFilter, const sal_uInt16 nFormat,
+ const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL );
static Bitmap DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold );
diff --git a/include/svx/xtable.hxx b/include/svx/xtable.hxx
index d9b2c3c88443..f4c042f1c639 100644
--- a/include/svx/xtable.hxx
+++ b/include/svx/xtable.hxx
@@ -20,6 +20,7 @@
#define _XTABLE_HXX
#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
#include <svx/xpoly.hxx>
#include <svx/xdash.hxx>
#include <svx/xhatch.hxx>
@@ -28,7 +29,6 @@
#include <svx/xlnasit.hxx>
#include <tools/color.hxx>
-#include <tools/string.hxx>
#include <tools/contnr.hxx>
#include <cppuhelper/weak.hxx>
@@ -61,7 +61,7 @@ private:
Color aColor;
public:
- XColorEntry(const Color& rColor, const String& rName);
+ XColorEntry(const Color& rColor, const OUString& rName);
XColorEntry(const XColorEntry& rOther);
const Color& GetColor() const
@@ -80,7 +80,7 @@ private:
basegfx::B2DPolyPolygon aB2DPolyPolygon;
public:
- XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName);
+ XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const OUString& rName);
XLineEndEntry(const XLineEndEntry& rOther);
const basegfx::B2DPolyPolygon& GetLineEnd() const
@@ -99,7 +99,7 @@ private:
XDash aDash;
public:
- XDashEntry(const XDash& rDash, const String& rName);
+ XDashEntry(const XDash& rDash, const OUString& rName);
XDashEntry(const XDashEntry& rOther);
const XDash& GetDash() const
@@ -118,7 +118,7 @@ private:
XHatch aHatch;
public:
- XHatchEntry(const XHatch& rHatch, const String& rName);
+ XHatchEntry(const XHatch& rHatch, const OUString& rName);
XHatchEntry(const XHatchEntry& rOther);
const XHatch& GetHatch() const
@@ -137,7 +137,7 @@ private:
XGradient aGradient;
public:
- XGradientEntry(const XGradient& rGradient, const String& rName);
+ XGradientEntry(const XGradient& rGradient, const OUString& rName);
XGradientEntry(const XGradientEntry& rOther);
const XGradient& GetGradient() const
@@ -153,15 +153,15 @@ public:
class SVX_DLLPUBLIC XBitmapEntry : public XPropertyEntry
{
private:
- GraphicObject maGraphicObject;
+ rtl::Reference<GraphicObject> m_rGraphicObject;
public:
- XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName);
+ XBitmapEntry(const rtl::Reference<GraphicObject>& rGraphicObject, const OUString& rName);
XBitmapEntry(const XBitmapEntry& rOther);
- const GraphicObject& GetGraphicObject() const
+ const rtl::Reference<GraphicObject> GetGraphicObject() const
{
- return maGraphicObject;
+ return m_rGraphicObject;
}
};
@@ -199,15 +199,15 @@ protected:
typedef ::std::vector< Bitmap* > BitmapList_impl;
XPropertyListType meType;
- String maName; // not persistent
- String maPath;
+ OUString maName; // not persistent
+ OUString maPath;
XPropertyEntryList_impl maList;
bool mbListDirty;
bool mbEmbedInDocument;
- XPropertyList(XPropertyListType t, const String& rPath);
+ XPropertyList(XPropertyListType t, const OUString& rPath);
virtual Bitmap CreateBitmapForUI(long nIndex) = 0;
@@ -222,14 +222,14 @@ public:
XPropertyEntry* Remove(long nIndex);
XPropertyEntry* Get(long nIndex) const;
- long GetIndex(const String& rName) const;
+ long GetIndex(const OUString& rName) const;
Bitmap GetUiBitmap(long nIndex) const;
- const String& GetName() const { return maName; }
- void SetName(const String& rString);
+ const OUString& GetName() const { return maName; }
+ void SetName(const OUString& rString);
- const String& GetPath() const { return maPath; }
- void SetPath(const String& rString) { maPath = rString; }
+ const OUString& GetPath() const { return maPath; }
+ void SetPath(const OUString& rString) { maPath = rString; }
bool IsDirty() const { return mbListDirty; }
void SetDirty(bool bDirty = true) { mbListDirty = bDirty; }
@@ -244,22 +244,20 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
createInstance() = 0;
bool Load();
- bool LoadFrom(const ::com::sun::star::uno::Reference<
- ::com::sun::star::embed::XStorage > &xStorage,
- const OUString &rURL);
+ bool LoadFrom(const ::css::uno::Reference<::css::embed::XStorage > &xStorage,
+ const OUString &rURL);
bool Save();
- bool SaveTo (const ::com::sun::star::uno::Reference<
- ::com::sun::star::embed::XStorage > &xStorage,
- const OUString &rURL,
- OUString *pOptName);
+ bool SaveTo (const ::css::uno::Reference<::css::embed::XStorage > &xStorage,
+ const OUString &rURL,
+ OUString *pOptName);
virtual bool Create() = 0;
// Factory method for sub-classes
static XPropertyListRef CreatePropertyList(XPropertyListType t,
- const String& rPath);
+ const OUString& rPath);
// as above but initializes name as expected
static XPropertyListRef CreatePropertyListFromURL(XPropertyListType t,
- const OUString & rUrl);
+ const OUString & rUrl);
// helper accessors
inline XDashListRef AsDashList();
@@ -280,7 +278,7 @@ protected:
virtual Bitmap CreateBitmapForUI(long nIndex);
public:
- explicit XColorList(const String& rPath)
+ explicit XColorList(const OUString& rPath)
: XPropertyList(XCOLOR_LIST, rPath) {}
using XPropertyList::Replace;
@@ -306,7 +304,7 @@ protected:
virtual Bitmap CreateBitmapForUI(long nIndex);
public:
- explicit XLineEndList(const String& rPath);
+ explicit XLineEndList(const OUString& rPath);
virtual ~XLineEndList();
using XPropertyList::Remove;
@@ -325,15 +323,15 @@ class SVX_DLLPUBLIC XDashList : public XPropertyList
{
private:
Bitmap maBitmapSolidLine;
- String maStringSolidLine;
- String maStringNoLine;
+ OUString maStringSolidLine;
+ OUString maStringNoLine;
protected:
Bitmap ImpCreateBitmapForXDash(const XDash* pDash);
virtual Bitmap CreateBitmapForUI(long nIndex);
public:
- explicit XDashList(const String& rPath);
+ explicit XDashList(const OUString& rPath);
virtual ~XDashList();
using XPropertyList::Replace;
@@ -352,8 +350,8 @@ public:
// Special calls to get the translated strings for the UI entry for no
// line style (XLINE_NONE) and solid line style (XLINE_SOLID) for dialogs
- String GetStringForUiSolidLine() const;
- String GetStringForUiNoLine() const;
+ OUString GetStringForUiSolidLine() const;
+ OUString GetStringForUiNoLine() const;
};
// -------------------
@@ -366,7 +364,7 @@ protected:
virtual Bitmap CreateBitmapForUI(long nIndex);
public:
- explicit XHatchList(const String& rPath);
+ explicit XHatchList(const OUString& rPath);
virtual ~XHatchList();
using XPropertyList::Replace;
@@ -388,7 +386,7 @@ protected:
virtual Bitmap CreateBitmapForUI(long nIndex);
public:
- explicit XGradientList(const String& rPath);
+ explicit XGradientList(const OUString& rPath);
virtual ~XGradientList();
using XPropertyList::Replace;
@@ -411,7 +409,7 @@ protected:
virtual Bitmap CreateBitmapForUI(long nIndex);
public:
- explicit XBitmapList(const String& rPath)
+ explicit XBitmapList(const OUString& rPath)
: XPropertyList(XBITMAP_LIST, rPath) {}
using XPropertyList::Replace;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 88c8c61d132d..7673b86dad4c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -419,7 +419,7 @@ 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 ();
+ Graphic aGraphic = GraphicObject::Create( aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)) )->GetTransformedGraphic ();
return WriteImage( aGraphic );
} else {
@@ -617,7 +617,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/inc/filter.hxx b/sc/inc/filter.hxx
index 9c28498cfd88..7417713193ec 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -109,8 +109,8 @@ class ScFormatFilterPlugin {
sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest,
sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
- virtual FltError ScExportHTML( SvStream&, const String& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, bool bAll,
- const String& rStreamPath, String& rNonConvertibleChars ) = 0;
+ virtual FltError ScExportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, bool bAll,
+ const OUString& rStreamPath, OUString& rNonConvertibleChars ) = 0;
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest ) = 0;
virtual ScOrcusFilters* GetOrcusFilters() = 0;
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index adeb3d8b7491..7a91cf27e94b 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -758,7 +758,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa
aBitmap = aXOBitmap.GetBitmap();
rSdrObj.SetMergedItem(XFillStyleItem(XFILL_BITMAP));
- rSdrObj.SetMergedItem(XFillBitmapItem(EMPTY_STRING, Graphic(aBitmap)));
+ rSdrObj.SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aBitmap))));
}
}
}
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 5cbf833ca3b3..fff84cc9478c 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -125,7 +125,6 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] =
<< GetIndentStr())
#define OUT_SP_CSTR_ASS( s ) rStrm << ' ' << s << '='
-#define APPEND_SPACE( s ) s.AppendAscii(" ")
#define GLOBSTR(id) ScGlobal::GetRscString( id )
@@ -133,9 +132,9 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] =
//========================================================================
-FltError ScFormatFilterPluginImpl::ScExportHTML( SvStream& rStrm, const String& rBaseURL, ScDocument* pDoc,
- const ScRange& rRange, const CharSet /*eNach*/, bool bAll,
- const String& rStreamPath, String& rNonConvertibleChars )
+FltError ScFormatFilterPluginImpl::ScExportHTML( SvStream& rStrm, const OUString& rBaseURL, ScDocument* pDoc,
+ const ScRange& rRange, const CharSet /*eNach*/, bool bAll,
+ const OUString& rStreamPath, OUString& rNonConvertibleChars )
{
ScHTMLExport aEx( rStrm, rBaseURL, pDoc, rRange, bAll, rStreamPath );
FltError nErr = aEx.Write();
@@ -163,36 +162,48 @@ static OString lcl_getColGroupString(sal_Int32 nSpan, sal_Int32 nWidth)
}
-static void lcl_AddStamp( String& rStr, const String& rName,
- const ::com::sun::star::util::DateTime& rDateTime,
- const LocaleDataWrapper& rLoc )
+static void lcl_AddStamp( OUString& rStr, const OUString& rName,
+ const ::com::sun::star::util::DateTime& rDateTime,
+ const LocaleDataWrapper& rLoc )
{
Date aD(rDateTime.Day, rDateTime.Month, rDateTime.Year);
Time aT(rDateTime.Hours, rDateTime.Minutes, rDateTime.Seconds,
rDateTime.NanoSeconds);
DateTime aDateTime(aD,aT);
- String aStrDate = rLoc.getDate( aDateTime );
- String aStrTime = rLoc.getTime( aDateTime );
+ OUString aStrDate = rLoc.getDate( aDateTime );
+ OUString aStrTime = rLoc.getTime( aDateTime );
- rStr += GLOBSTR( STR_BY );
- APPEND_SPACE( rStr );
- if (rName.Len())
+ rStr += OUString(ScGlobal::GetRscString( STR_BY ));
+ rStr += " ";
+ if (!rName.isEmpty())
+ {
rStr += rName;
+ }
else
- rStr.AppendAscii( "???" );
- APPEND_SPACE( rStr );
- rStr += GLOBSTR( STR_ON );
- APPEND_SPACE( rStr );
- if (aStrDate.Len())
+ {
+ rStr += "???";
+ }
+ rStr += " ";
+ rStr += OUString(ScGlobal::GetRscString( STR_ON ));
+ rStr += " ";
+ if (!aStrDate.isEmpty())
+ {
rStr += aStrDate;
+ }
else
- rStr.AppendAscii( "???" );
- rStr.AppendAscii( ", " );
- if (aStrTime.Len())
+ {
+ rStr + "???";
+ }
+ rStr += ", ";
+ if (!aStrTime.isEmpty())
+ {
rStr += aStrTime;
+ }
else
- rStr.AppendAscii( "???" );
+ {
+ rStr + "???";
+ }
}
@@ -212,9 +223,9 @@ static OString lcl_makeHTMLColorTriplet(const Color& rColor)
//////////////////////////////////////////////////////////////////////////////
-ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument* pDocP,
+ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocument* pDocP,
const ScRange& rRangeP,
- sal_Bool bAllP, const String& rStreamPathP ) :
+ sal_Bool bAllP, const OUString& rStreamPathP ) :
ScExportBase( rStrmP, pDocP, rRangeP ),
aBaseURL( rBaseURL ),
aStreamPath( rStreamPathP ),
@@ -259,7 +270,7 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument
if( pItem )
{
aCId = ((const SfxStringItem *)pItem)->GetValue();
- OSL_ENSURE( aCId.Len(), "CID without length!" );
+ OSL_ENSURE( !aCId.isEmpty(), "CID without length!" );
}
}
}
@@ -356,8 +367,8 @@ void ScHTMLExport::WriteHeader()
if (!xDocProps->getPrintedBy().isEmpty())
{
OUT_COMMENT( GLOBSTR( STR_DOC_INFO ) );
- String aStrOut( GLOBSTR( STR_DOC_PRINTED ) );
- aStrOut.AppendAscii( ": " );
+ OUString aStrOut(ScGlobal::GetRscString( STR_DOC_PRINTED ) );
+ aStrOut += ": ";
lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(),
xDocProps->getPrintDate(), *ScGlobal::pLocaleData );
OUT_COMMENT( aStrOut );
@@ -566,8 +577,8 @@ void ScHTMLExport::WriteBody()
if ( bAll && GPOS_NONE != pBrushItem->GetGraphicPos() )
{
- const String* pLink = pBrushItem->GetGraphicLink();
- String aGrfNm;
+ const OUString* pLink = pBrushItem->GetGraphicLink();
+ OUString aGrfNm;
// embeddete Grafik -> via WriteGraphic schreiben
if( !pLink )
@@ -578,7 +589,7 @@ void ScHTMLExport::WriteBody()
// Grafik als (JPG-)File speichern
aGrfNm = aStreamPath;
sal_uInt16 nErr = XOutBitmap::WriteGraphic( *pGrf, aGrfNm,
- String("JPG"), XOUTBMP_USE_NATIVE_IF_POSSIBLE );
+ OUString("JPG"), XOUTBMP_USE_NATIVE_IF_POSSIBLE );
if( !nErr ) // fehlerhaft, da ist nichts auszugeben
{
aGrfNm = URIHelper::SmartRel2Abs(
@@ -841,7 +852,7 @@ void ScHTMLExport::WriteTables()
}
if ( bAll )
- OUT_COMMENT( String("**************************************************************************") );
+ OUT_COMMENT( OUString("**************************************************************************") );
}
}
@@ -1249,8 +1260,8 @@ bool ScHTMLExport::WriteFieldText( const EditTextObject* pData )
}
-sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
- const String& rTargetNm, sal_Bool bFileToFile )
+sal_Bool ScHTMLExport::CopyLocalFileToINet( OUString& rFileNm,
+ const OUString& rTargetNm, sal_Bool bFileToFile )
{
sal_Bool bRet = false;
INetURLObject aFileUrl, aTargetUrl;
@@ -1265,7 +1276,7 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
if( pFileNameMap )
{
// wurde die Datei schon verschoben
- std::map<String, String>::iterator it = pFileNameMap->find( rFileNm );
+ std::map<OUString, OUString>::iterator it = pFileNameMap->find( rFileNm );
if( it != pFileNameMap->end() )
{
rFileNm = it->second;
@@ -1274,13 +1285,13 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
}
else
{
- pFileNameMap.reset( new std::map<String, String>() );
+ pFileNameMap.reset( new std::map<OUString, OUString>() );
}
SvFileStream aTmp( aFileUrl.PathToFileName(), STREAM_READ );
- String aSrc = rFileNm;
- String aDest = aTargetUrl.GetPartBeforeLastName();
+ OUString aSrc = rFileNm;
+ OUString aDest = aTargetUrl.GetPartBeforeLastName();
aDest += String(aFileUrl.GetName());
if( bFileToFile )
@@ -1319,23 +1330,19 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
}
-void ScHTMLExport::MakeCIdURL( String& rURL )
+void ScHTMLExport::MakeCIdURL( OUString& rURL )
{
- if( !aCId.Len() )
+ if( aCId.isEmpty() )
return;
INetURLObject aURLObj( rURL );
if( INET_PROT_FILE != aURLObj.GetProtocol() )
return;
- String aLastName( aURLObj.GetLastName() );
- OSL_ENSURE( aLastName.Len(), "filename without length!" );
- aLastName.ToLowerAscii();
+ OUString aLastName( aURLObj.GetLastName().toAsciiLowerCase() );
+ OSL_ENSURE( !aLastName.isEmpty(), "filename without length!" );
- rURL.AssignAscii( "cid:" );
- rURL += aLastName;
- rURL.AppendAscii( "." );
- rURL += aCId;
+ rURL = "cid:" + aLastName + "." + aCId;
}
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index a2a5e704a262..9e6646b1de8e 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -151,7 +151,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
nXOutFlags |= XOUTBMP_MIRROR_HORZ;
if ( bVMirr )
nXOutFlags |= XOUTBMP_MIRROR_VERT;
- String aLinkName;
+ OUString aLinkName;
if ( pSGO->IsLinkedGraphic() )
aLinkName = pSGO->GetFileName();
WriteImage( aLinkName, pSGO->GetGraphic(), aOpt, nXOutFlags );
@@ -163,7 +163,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pObject)->GetGraphic();
if ( pGraphic )
{
- String aLinkName;
+ OUString aLinkName;
WriteImage( aLinkName, *pGraphic, aOpt );
pE->bWritten = sal_True;
}
@@ -173,7 +173,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
{
Graphic aGraph( SdrExchangeView::GetObjGraphic(
pDoc->GetDrawLayer(), pObject ) );
- String aLinkName;
+ OUString aLinkName;
WriteImage( aLinkName, aGraph, aOpt );
pE->bWritten = sal_True;
}
@@ -181,19 +181,19 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
}
-void ScHTMLExport::WriteImage( String& rLinkName, const Graphic& rGrf,
- const OString& rImgOptions, sal_uLong nXOutFlags )
+void ScHTMLExport::WriteImage( OUString& rLinkName, const Graphic& rGrf,
+ const OString& rImgOptions, sal_uLong nXOutFlags )
{
// Embedded graphic -> create an image file
- if( !rLinkName.Len() )
+ if( rLinkName.isEmpty() )
{
- if( aStreamPath.Len() > 0 )
+ if( !aStreamPath.isEmpty() )
{
// Save as a PNG
- String aGrfNm( aStreamPath );
+ OUString aGrfNm( aStreamPath );
nXOutFlags |= XOUTBMP_USE_NATIVE_IF_POSSIBLE;
sal_uInt16 nErr = XOutBitmap::WriteGraphic( rGrf, aGrfNm,
- String( "PNG" ), nXOutFlags );
+ OUString( "PNG" ), nXOutFlags );
// If it worked, create a URL for the IMG tag
if( !nErr )
@@ -225,12 +225,12 @@ void ScHTMLExport::WriteImage( String& rLinkName, const Graphic& rGrf,
// If a URL was set, output the IMG tag.
// <IMG SRC="..."[ rImgOptions]>
- if( rLinkName.Len() )
+ if( !rLinkName.isEmpty() )
{
rStrm << '<' << OOO_STRING_SVTOOLS_HTML_image << ' ' << OOO_STRING_SVTOOLS_HTML_O_src << "=\"";
HTMLOutFuncs::Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(
- aBaseURL,
- rLinkName ), eDestEnc ) << '\"';
+ aBaseURL,
+ rLinkName ), eDestEnc ) << '\"';
if ( !rImgOptions.isEmpty() )
rStrm << rImgOptions.getStr();
rStrm << '>' << sNewLine << GetIndentStr();
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index e89685c83aa9..cee64eb7ce45 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -305,8 +305,8 @@ public:
sal_uInt32 nDifOption = SC_DIFOPT_EXCEL );
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest,
sal_uInt32 nDifOption = SC_DIFOPT_EXCEL );
- virtual FltError ScExportHTML( SvStream&, const String& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, bool bAll,
- const String& rStreamPath, String& rNonConvertibleChars );
+ virtual FltError ScExportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, bool bAll,
+ const OUString& rStreamPath, OUString& rNonConvertibleChars );
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest );
virtual ScOrcusFilters* GetOrcusFilters();
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index 585f7a21a0b5..e9f09844333e 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -44,7 +44,7 @@ namespace editeng { class SvxBorderLine; }
struct ScHTMLStyle
{ // Defaults aus StyleSheet
Color aBackgroundColor;
- String aFontFamilyName;
+ OUString aFontFamilyName;
sal_uInt32 nFontHeight; // Item-Value
sal_uInt16 nFontSizeNumber; // HTML value 1-7
sal_uInt8 nDefaultScriptType; // Font values are valid for the default script type
@@ -96,12 +96,12 @@ class ScHTMLExport : public ScExportBase
boost::ptr_vector< ScHTMLGraphEntry > aGraphList;
ScHTMLStyle aHTMLStyle;
- String aBaseURL;
- String aStreamPath;
- String aCId; // Content-Id fuer Mail-Export
+ OUString aBaseURL;
+ OUString aStreamPath;
+ OUString aCId; // Content-Id fuer Mail-Export
OutputDevice* pAppWin; // fuer Pixelei
- boost::scoped_ptr< std::map<String, String> > pFileNameMap; // fuer CopyLocalFileToINet
- String aNonConvertibleChars; // collect nonconvertible characters
+ boost::scoped_ptr< std::map<OUString, OUString> > pFileNameMap; // fuer CopyLocalFileToINet
+ OUString aNonConvertibleChars; // collect nonconvertible characters
rtl_TextEncoding eDestEnc;
SCTAB nUsedTables;
short nIndent;
@@ -122,7 +122,7 @@ class ScHTMLExport : public ScExportBase
void WriteTables();
void WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
void WriteGraphEntry( ScHTMLGraphEntry* );
- void WriteImage( String& rLinkName,
+ void WriteImage( OUString& rLinkName,
const Graphic&, const OString& rImgOptions,
sal_uLong nXOutFlags = 0 );
// nXOutFlags fuer XOutBitmap::WriteGraphic
@@ -131,10 +131,10 @@ class ScHTMLExport : public ScExportBase
bool WriteFieldText( const EditTextObject* pData );
// kopiere ggfs. eine lokale Datei ins Internet
- sal_Bool CopyLocalFileToINet( String& rFileNm,
- const String& rTargetNm, sal_Bool bFileToFile = false );
- sal_Bool HasCId() { return aCId.Len() > 0; }
- void MakeCIdURL( String& rURL );
+ sal_Bool CopyLocalFileToINet( OUString& rFileNm,
+ const OUString& rTargetNm, sal_Bool bFileToFile = false );
+ sal_Bool HasCId() { return !aCId.isEmpty(); }
+ void MakeCIdURL( OUString& rURL );
void PrepareGraphics( ScDrawLayer*, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow,
@@ -154,11 +154,11 @@ class ScHTMLExport : public ScExportBase
const sal_Char* GetIndentStr() { return sIndent; }
public:
- ScHTMLExport( SvStream&, const String&, ScDocument*, const ScRange&,
- sal_Bool bAll, const String& aStreamPath );
+ ScHTMLExport( SvStream&, const OUString&, ScDocument*, const ScRange&,
+ sal_Bool bAll, const OUString& aStreamPath );
virtual ~ScHTMLExport();
sal_uLong Write();
- const String& GetNonConvertibleChars() const
+ const OUString& GetNonConvertibleChars() const
{ return aNonConvertibleChars; }
};
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 4b39da6209bc..5fead76a8333 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2381,7 +2381,7 @@ sal_Bool ScDocShell::ConvertTo( SfxMedium &rMed )
ScImportExport aImExport( &aDocument );
aImExport.SetStreamPath( rMed.GetName() );
bRet = aImExport.ExportStream( *pStream, rMed.GetBaseURL( true ), SOT_FORMATSTR_ID_HTML );
- if ( bRet && aImExport.GetNonConvertibleChars().Len() )
+ if ( bRet && !aImExport.GetNonConvertibleChars().isEmpty() )
SetError( *new StringErrorInfo(
SCWARN_EXPORT_NONCONVERTIBLE_CHARS,
aImExport.GetNonConvertibleChars(),
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index a2312058b573..b4e7774dfd93 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2230,8 +2230,8 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin {
virtual FltError ScExportExcel5( SfxMedium&, ScDocument*, ExportFormatExcel, CharSet ) RETURN_ERROR
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScAddress&, const CharSet, sal_uInt32 ) RETURN_ERROR
virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange&, const CharSet, sal_uInt32 ) RETURN_ERROR
- virtual FltError ScExportHTML( SvStream&, const String&, ScDocument*, const ScRange&, const CharSet, bool,
- const String&, String& ) RETURN_ERROR
+ virtual FltError ScExportHTML( SvStream&, const OUString&, ScDocument*, const ScRange&, const CharSet, bool,
+ const OUString&, OUString& ) RETURN_ERROR
virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange&, const CharSet ) RETURN_ERROR
virtual ScOrcusFilters* GetOrcusFilters() { return NULL; }
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index 6276575cd712..0e4ce6ea02bc 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() );
+ rtl::Reference<GraphicObject> rFilterObj = ( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, &rFilterObj ) )
{
SdrPageView* pPageView = pView->GetSdrPageView();
@@ -150,7 +150,7 @@ void ScGraphicShell::ExecuteFilter( SfxRequest& rReq )
aStr.Append( sal_Unicode(' ') );
aStr.Append( String( ScResId( SCSTR_UNDO_GRAFFILTER ) ) );
pView->BegUndo( aStr );
- pFilteredObj->SetGraphicObject( aFilterObj );
+ pFilteredObj->SetGraphicObject( rFilterObj );
pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
pView->EndUndo();
}
@@ -189,9 +189,9 @@ void ScGraphicShell::ExecuteExternalEdit( SfxRequest& )
if( pObj && pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
{
- GraphicObject aGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
+ rtl::Reference<GraphicObject> rGraphicObject = ( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
ScExternalToolEdit* aExternalToolEdit = new ScExternalToolEdit( pView, pObj );
- aExternalToolEdit->Edit( &aGraphicObject );
+ aExternalToolEdit->Edit( rGraphicObject );
}
}
diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx
index 2691b118bbf7..fef8300c3bda 100644
--- a/sc/source/ui/inc/impex.hxx
+++ b/sc/source/ui/inc/impex.hxx
@@ -52,7 +52,7 @@ class ScImportExport
ScDocument* pUndoDoc;
ScRange aRange;
String aStreamPath;
- String aNonConvertibleChars;
+ OUString aNonConvertibleChars;
sal_uLong nSizeLimit;
sal_Unicode cSep; // Separator
sal_Unicode cStr; // String Delimiter
@@ -147,7 +147,7 @@ public:
bool IsOverflowCell() const { return bOverflowCell; }
bool IsOverflow() const { return bOverflowRow || bOverflowCol || bOverflowCell; }
- const String& GetNonConvertibleChars() const { return aNonConvertibleChars; }
+ const OUString& GetNonConvertibleChars() const { return aNonConvertibleChars; }
bool IsApi() const { return mbApi; }
void SetApi( bool bApi ) { mbApi = bApi; }
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index e7fa2bb3b623..0173a71cac95 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> rObject = GraphicObject::Create( *pGraphic );
if( pOut->GetPDFWriter() &&
- (aObject.GetType() == GRAPHIC_BITMAP || aObject.GetType() == GRAPHIC_DEFAULT) )
+ (rObject->GetType() == GRAPHIC_BITMAP || rObject->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),
+ rObject->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) );
+ rObject->DrawTiled( pOut, rOrg, aGrfSize, Size(0,0) );
}
bDraw = false;
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 8fa0e3814310..8bc193a31dc0 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -456,7 +456,7 @@ sal_Bool ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& r
SfxItemSet aSet( pScDrawView->GetModel()->GetItemPool(),
XATTR_FILLSTYLE, XATTR_FILLBITMAP );
aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(String(), rGraphic));
+ aSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(rGraphic)));
pPickObj->SetMergedItemSetAndBroadcast(aSet);
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 6954913a18a3..9c17c1d7adc6 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 7a0ebb763f63..c1806afbc19f 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> rGraphicObject( GraphicObject::Create(rUniqueId ));
+ Graphic aMappedGraphic, aGraphic( rGraphicObject->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 );
+ rGraphicObject = GraphicObject::Create( aMappedGraphic );
}
}
- sal_uInt32 nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aRect, NULL, NULL );
+ sal_uInt32 nId = pGraphicProv->GetBlibID( aBuExPictureStream, rGraphicObject->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 abae1282329a..6b159d70ce7d 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 aed500bef3c6..b470bb109dda 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() );
+ rtl::Reference<GraphicObject> rFilterObj = ( (SdrGrafObj*) pObj )->GetGraphicObject();
if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, &rFilterObj ) )
{
SdrPageView* pPageView = mpView->GetSdrPageView();
@@ -159,7 +159,7 @@ void GraphicObjectBar::ExecuteFilter( SfxRequest& rReq )
aStr.Append( sal_Unicode(' ') );
aStr.Append( String( SdResId( STR_UNDO_GRAFFILTER ) ) );
mpView->BegUndo( aStr );
- pFilteredObj->SetGraphicObject( aFilterObj );
+ pFilteredObj->SetGraphicObject( rFilterObj );
::sd::View* const pView = mpView;
pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
pView->EndUndo();
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 835cc9302e66..2056d78a87f5 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> rGraphicObject( ( (SdrGrafObj*) pObj )->GetGraphicObject() );
{
- GraphicHelper::ExportGraphic( aGraphicObject.GetGraphic(), String("") );
+ GraphicHelper::ExportGraphic( rGraphicObject->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> rGraphicObject = ( (SdrGrafObj*) pObj )->GetGraphicObject() ;
SdExternalToolEdit* aExternalToolEdit = new SdExternalToolEdit( mpDrawView, pObj );
- aExternalToolEdit->Edit( &aGraphicObject );
+ aExternalToolEdit->Edit( rGraphicObject );
}
}
Cancel();
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index cdbe0aeb2a3d..b3c079385506 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 067b677a1f0c..49ee09da400c 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/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx
index dd46236c1365..499a1ce70da6 100644
--- a/sfx2/source/bastyp/frmhtmlw.cxx
+++ b/sfx2/source/bastyp/frmhtmlw.cxx
@@ -63,10 +63,10 @@ const sal_Char SfxFrameHTMLWriter::sNewLine[] = "\015\012";
void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm,
const sal_Char *pIndent,
- const String& rName,
- const String& rContent, sal_Bool bHTTPEquiv,
- rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars )
+ const OUString& rName,
+ const OUString& rContent, sal_Bool bHTTPEquiv,
+ rtl_TextEncoding eDestEnc,
+ OUString* pNonConvertableChars )
{
rStrm << sNewLine;
if( pIndent )
@@ -85,19 +85,19 @@ void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm,
HTMLOutFuncs::Out_String( rStrm, rContent, eDestEnc, pNonConvertableChars ) << "\">";
}
-void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
- const uno::Reference<document::XDocumentProperties> & i_xDocProps,
- const sal_Char *pIndent,
- rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars )
+void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL,
+ const uno::Reference<document::XDocumentProperties> & i_xDocProps,
+ const sal_Char *pIndent,
+ rtl_TextEncoding eDestEnc,
+ OUString* pNonConvertableChars )
{
const sal_Char *pCharSet =
rtl_getBestMimeCharsetFromTextEncoding( eDestEnc );
if( pCharSet )
{
- String aContentType = OUString(sHTML_MIME_text_html);
- aContentType.AppendAscii( pCharSet );
+ OUString aContentType = OUString(sHTML_MIME_text_html);
+ aContentType += OUString(pCharSet, strlen(pCharSet), RTL_TEXTENCODING_ASCII_US );
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_content_type, aContentType, sal_True,
eDestEnc, pNonConvertableChars );
}
@@ -109,8 +109,8 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
HTMLOutFuncs::Out_AsciiTag( rStrm, OOO_STRING_SVTOOLS_HTML_title );
if( i_xDocProps.is() )
{
- const String& rTitle = i_xDocProps->getTitle();
- if( rTitle.Len() )
+ const OUString& rTitle = i_xDocProps->getTitle();
+ if( !rTitle.isEmpty() )
HTMLOutFuncs::Out_String( rStrm, rTitle, eDestEnc, pNonConvertableChars );
}
HTMLOutFuncs::Out_AsciiTag( rStrm, OOO_STRING_SVTOOLS_HTML_title, sal_False );
@@ -118,8 +118,8 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
// Target-Frame
if( i_xDocProps.is() )
{
- const String& rTarget = i_xDocProps->getDefaultTarget();
- if( rTarget.Len() )
+ const OUString& rTarget = i_xDocProps->getDefaultTarget();
+ if( !rTarget.isEmpty() )
{
rStrm << sNewLine;
if( pIndent )
@@ -135,10 +135,10 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
}
// Who we are
- String sGenerator( SfxResId(STR_HTML_GENERATOR).toString() );
+ OUString sGenerator( SfxResId(STR_HTML_GENERATOR).toString() );
OUString os( "$_OS" );
::rtl::Bootstrap::expandMacros(os);
- sGenerator.SearchAndReplaceAscii( "%1", os );
+ sGenerator = sGenerator.replaceAll( OUString("%1"), os );
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_generator, sGenerator, sal_False, eDestEnc, pNonConvertableChars );
if( i_xDocProps.is() )
@@ -147,16 +147,13 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
if( (i_xDocProps->getAutoloadSecs() != 0) ||
!i_xDocProps->getAutoloadURL().isEmpty() )
{
- String sContent = OUString::number(
- i_xDocProps->getAutoloadSecs() );
+ OUString sContent = OUString::number( i_xDocProps->getAutoloadSecs() );
- const String &rReloadURL = i_xDocProps->getAutoloadURL();
- if( rReloadURL.Len() )
+ const OUString &rReloadURL = i_xDocProps->getAutoloadURL();
+ if( !rReloadURL.isEmpty() )
{
- sContent.AppendAscii( ";URL=" );
- sContent += String(
- URIHelper::simpleNormalizedMakeRelative(
- rBaseURL, rReloadURL));
+ sContent += ";URL=" ;
+ sContent += URIHelper::simpleNormalizedMakeRelative( rBaseURL, rReloadURL);
}
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_refresh, sContent, sal_True,
@@ -164,24 +161,25 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
}
// Author
- const String& rAuthor = i_xDocProps->getAuthor();
- if( rAuthor.Len() )
+ const OUString& rAuthor = i_xDocProps->getAuthor();
+ if( !rAuthor.isEmpty() )
+ {
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_author, rAuthor, sal_False,
eDestEnc, pNonConvertableChars );
-
+ }
// created
::util::DateTime uDT = i_xDocProps->getCreationDate();
Date aD(uDT.Day, uDT.Month, uDT.Year);
Time aT(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.NanoSeconds);
- String sOut = OUString::number(aD.GetDate());
- sOut += ';';
+ OUString sOut = OUString::number(aD.GetDate());
+ sOut += ";";
sOut += OUString::number(aT.GetTime());
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_created, sOut, sal_False,
eDestEnc, pNonConvertableChars );
// changedby
- const String& rChangedBy = i_xDocProps->getModifiedBy();
- if( rChangedBy.Len() )
+ const OUString& rChangedBy = i_xDocProps->getModifiedBy();
+ if( !rChangedBy.isEmpty() )
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changedby, rChangedBy, sal_False,
eDestEnc, pNonConvertableChars );
@@ -190,27 +188,26 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
Date aD2(uDT.Day, uDT.Month, uDT.Year);
Time aT2(uDT.Hours, uDT.Minutes, uDT.Seconds, uDT.NanoSeconds);
sOut = OUString::number(aD2.GetDate());
- sOut += ';';
+ sOut += ";";
sOut += OUString::number(aT2.GetTime());
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changed, sOut, sal_False,
eDestEnc, pNonConvertableChars );
// Subject
- const String& rTheme = i_xDocProps->getSubject();
- if( rTheme.Len() )
+ const OUString& rTheme = i_xDocProps->getSubject();
+ if( !rTheme.isEmpty() )
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_classification, rTheme, sal_False,
eDestEnc, pNonConvertableChars );
// Description
- const String& rComment = i_xDocProps->getDescription();
- if( rComment.Len() )
+ const OUString& rComment = i_xDocProps->getDescription();
+ if( !rComment.isEmpty() )
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_description, rComment, sal_False,
eDestEnc, pNonConvertableChars);
// Keywords
- String Keywords = ::comphelper::string::convertCommaSeparated(
- i_xDocProps->getKeywords());
- if( Keywords.Len() )
+ OUString Keywords = ::comphelper::string::convertCommaSeparated( i_xDocProps->getKeywords());
+ if( !Keywords.isEmpty() )
OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_keywords, Keywords, sal_False,
eDestEnc, pNonConvertableChars);
@@ -233,7 +230,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
uno::TypeClass_STRING);
OUString str;
aStr >>= str;
- String valstr(comphelper::string::stripEnd(str, ' '));
+ OUString valstr(comphelper::string::stripEnd(str, ' '));
OutMeta( rStrm, pIndent, name, valstr, sal_False,
eDestEnc, pNonConvertableChars );
}
@@ -246,9 +243,9 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
}
}
-void SfxFrameHTMLWriter::Out_FrameDescriptor(
- SvStream& rOut, const String& rBaseURL, const uno::Reference < beans::XPropertySet >& xSet,
- rtl_TextEncoding eDestEnc, String *pNonConvertableChars )
+void SfxFrameHTMLWriter::Out_FrameDescriptor( SvStream& rOut, const OUString& rBaseURL,
+ const uno::Reference < beans::XPropertySet >& xSet,
+ rtl_TextEncoding eDestEnc, OUString* pNonConvertableChars )
{
try
{
@@ -257,8 +254,8 @@ void SfxFrameHTMLWriter::Out_FrameDescriptor(
uno::Any aAny = xSet->getPropertyValue("FrameURL");
if ( (aAny >>= aStr) && !aStr.isEmpty() )
{
- String aURL = INetURLObject( aStr ).GetMainURL( INetURLObject::DECODE_TO_IURI );
- if( aURL.Len() )
+ OUString aURL = INetURLObject( aStr ).GetMainURL( INetURLObject::DECODE_TO_IURI );
+ if( !aURL.isEmpty() )
{
aURL = URIHelper::simpleNormalizedMakeRelative(
rBaseURL, aURL );
@@ -301,7 +298,7 @@ void SfxFrameHTMLWriter::Out_FrameDescriptor(
aAny = xSet->getPropertyValue("FrameIsScrollingMode");
if ( aAny >>= bVal )
{
- const sal_Char *pStr = bVal ? sHTML_SC_yes : sHTML_SC_no;
+ const sal_Char* pStr = bVal ? sHTML_SC_yes : sHTML_SC_no;
sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_scrolling)
.append(pStr);
}
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx
index 3f4a9df95fae..488bf0aa92d3 100644
--- a/slideshow/source/engine/shapes/shapeimporter.cxx
+++ b/slideshow/source/engine/shapes/shapeimporter.cxx
@@ -63,9 +63,8 @@ namespace internal {
namespace {
-bool importShapeGraphic(
- GraphicObject & o_rGraphic,
- uno::Reference<beans::XPropertySet> const& xPropSet )
+bool importShapeGraphic(rtl::Reference<GraphicObject> & o_rGraphic,
+ uno::Reference<beans::XPropertySet> const& xPropSet )
{
OUString aURL;
if( !getPropertyValue( aURL, xPropSet, "GraphicURL") ||
@@ -103,11 +102,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 +137,7 @@ bool importShapeGraphic(
return false;
}
- o_rGraphic = GraphicObject( aTmpGraphic );
+ o_rGraphic = GraphicObject::Create( aTmpGraphic );
}
return true;
}
@@ -329,18 +328,18 @@ ShapeSharedPtr ShapeImporter::createShape(
}
else if( shapeType == "com.sun.star.drawing.GraphicObjectShape" || shapeType == "com.sun.star.presentation.GraphicObjectShape" )
{
- GraphicObject aGraphicObject;
+ rtl::Reference<GraphicObject> rGraphicObject;
// 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( rGraphicObject, xPropSet ) )
return ShapeSharedPtr(); // error loading graphic -
// no placeholders in
// slideshow
- if( !aGraphicObject.IsAnimated() )
+ if( !rGraphicObject->IsAnimated() )
{
// no animation - simply utilize plain draw shape import
@@ -403,9 +402,9 @@ ShapeSharedPtr ShapeImporter::createShape(
// ---------------------------------------------
Graphic aGraphic(
- aGraphicObject.GetTransformedGraphic(
- aGraphicObject.GetPrefSize(),
- aGraphicObject.GetPrefMapMode(),
+ rGraphicObject->GetTransformedGraphic(
+ rGraphicObject->GetPrefSize(),
+ rGraphicObject->GetPrefMapMode(),
aGraphAttrs ) );
return DrawShape::create( xCurrShape,
diff --git a/svtools/source/graphic/GraphicManager.cxx b/svtools/source/graphic/GraphicManager.cxx
index 05cd565e133f..b096aa44045a 100644
--- a/svtools/source/graphic/GraphicManager.cxx
+++ b/svtools/source/graphic/GraphicManager.cxx
@@ -75,14 +75,21 @@ void GraphicManager::ReleaseFromCache( const GraphicObject& /*rGraphicObject*/ )
}
bool GraphicManager::IsInCache( OutputDevice* pOutDev, const Point& rPoint,
- const Size& rSize, const GraphicObject& rGraphicObject,
+ const Size& rSize, const rtl::Reference<GraphicObject>& rGraphicObject,
const GraphicAttr& rAttr ) const
{
return mpCache->IsInDisplayCache( pOutDev, rPoint, rSize, rGraphicObject, rAttr );
}
+bool GraphicManager::IsInCache( OutputDevice* pOutDev, const Point& rPoint,
+ const Size& rSize, const GraphicObject* pGraphicObject,
+ const GraphicAttr& rAttr ) const
+{
+ return mpCache->IsInDisplayCache( pOutDev, rPoint, rSize, pGraphicObject, rAttr );
+}
+
bool GraphicManager::DrawObj( OutputDevice* pOutDev, const Point& rPoint, const Size& rSize,
- GraphicObject& rGraphicObject, const GraphicAttr& rAttr,
+ GraphicObject* pGraphicObject, const GraphicAttr& rAttr,
const sal_uInt32 nFlags, bool& rCached )
{
Point aPoint( rPoint );
@@ -91,19 +98,19 @@ bool GraphicManager::DrawObj( OutputDevice* pOutDev, const Point& rPoint, const
rCached = false;
- if( ( rGraphicObject.GetType() == GRAPHIC_BITMAP ) ||
- ( rGraphicObject.GetType() == GRAPHIC_GDIMETAFILE ) )
+ if( ( pGraphicObject->GetType() == GRAPHIC_BITMAP ) ||
+ ( pGraphicObject->GetType() == GRAPHIC_GDIMETAFILE ) )
{
// create output and fill cache
- if( rGraphicObject.IsAnimated() ||
+ if( pGraphicObject->IsAnimated() ||
( pOutDev->GetOutDevType() == OUTDEV_PRINTER ) ||
( !( nFlags & GRFMGR_DRAW_NO_SUBSTITUTE ) &&
( ( nFlags & GRFMGR_DRAW_SUBSTITUTE ) || !( nFlags & GRFMGR_DRAW_CACHED ) ||
( pOutDev->GetConnectMetaFile() && !pOutDev->IsOutputEnabled() ) ) ) )
{
// simple output of transformed graphic
- const Graphic aGraphic( rGraphicObject.GetTransformedGraphic( &rAttr ) );
+ const Graphic aGraphic( pGraphicObject->GetTransformedGraphic( &rAttr ) );
if( aGraphic.IsSupportedGraphic() )
{
@@ -128,9 +135,9 @@ bool GraphicManager::DrawObj( OutputDevice* pOutDev, const Point& rPoint, const
if( !bRet )
{
// cached/direct drawing
- if( !mpCache->DrawDisplayCacheObj( pOutDev, aPoint, aSize, rGraphicObject, rAttr ) )
+ if( !mpCache->DrawDisplayCacheObj( pOutDev, aPoint, aSize, pGraphicObject, rAttr ) )
{
- bRet = Draw( pOutDev, aPoint, aSize, rGraphicObject, rAttr, nFlags, rCached );
+ bRet = Draw( pOutDev, aPoint, aSize, pGraphicObject, rAttr, nFlags, rCached );
}
else
{
@@ -142,19 +149,19 @@ bool GraphicManager::DrawObj( OutputDevice* pOutDev, const Point& rPoint, const
return bRet;
}
-void GraphicManager::RegisterObject( const GraphicObject& rGraphicObject, Graphic& rSubstituteGraphicObject,
+void GraphicManager::RegisterObject( const GraphicObject* pGraphicObject, Graphic& rSubstituteGraphicObject,
const OString* pID, const GraphicObject* pCopyGraphicObject )
{
- maObjectList.push_back( (GraphicObject*)&rGraphicObject );
- mpCache->AddGraphicObject( rGraphicObject, rSubstituteGraphicObject, pID, pCopyGraphicObject );
+ maObjectList.push_back( pGraphicObject );
+ mpCache->AddGraphicObject( pGraphicObject, rSubstituteGraphicObject, pID, pCopyGraphicObject );
}
-void GraphicManager::UnregisterObject( const GraphicObject& rGraphicObject )
+void GraphicManager::UnregisterObject( const GraphicObject* pGraphicObject )
{
- mpCache->ReleaseGraphicObject( rGraphicObject );
+ mpCache->ReleaseGraphicObject( pGraphicObject );
for( GraphicObjectList::iterator it = maObjectList.begin(); it != maObjectList.end(); ++it )
{
- if ( *it == &rGraphicObject )
+ if ( (*it) == pGraphicObject )
{
maObjectList.erase( it );
break;
@@ -162,23 +169,28 @@ void GraphicManager::UnregisterObject( const GraphicObject& rGraphicObject )
}
}
-void GraphicManager::GraphicObjectWasSwappedOut( const GraphicObject& rGraphicObject )
+void GraphicManager::GraphicObjectWasSwappedOut( const rtl::Reference<GraphicObject>& rGraphicObject )
{
mpCache->GraphicObjectWasSwappedOut( rGraphicObject );
}
-OString GraphicManager::GetUniqueID( const GraphicObject& rGraphicObject ) const
+OString GraphicManager::GetUniqueID( const rtl::Reference<GraphicObject>& rGraphicObject ) const
+{
+ return mpCache->GetUniqueID( rGraphicObject.get() );
+}
+
+OString GraphicManager::GetUniqueID( const GraphicObject* pGraphicObject ) const
{
- return mpCache->GetUniqueID( rGraphicObject );
+ return mpCache->GetUniqueID( pGraphicObject );
}
-bool GraphicManager::FillSwappedGraphicObject( const GraphicObject& rGraphicObject,
+bool GraphicManager::FillSwappedGraphicObject( const rtl::Reference<GraphicObject>& rGraphicObject,
Graphic& rSubstituteGraphicObject )
{
return( mpCache->FillSwappedGraphicObject( rGraphicObject, rSubstituteGraphicObject ) );
}
-void GraphicManager::GraphicObjectWasSwappedIn( const GraphicObject& rGraphicObject )
+void GraphicManager::GraphicObjectWasSwappedIn( const rtl::Reference<GraphicObject>& rGraphicObject )
{
mpCache->GraphicObjectWasSwappedIn( rGraphicObject );
}
@@ -745,11 +757,11 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib
}
bool GraphicManager::Draw( OutputDevice* pOutDev, const Point& rPoint,
- const Size& rSize, GraphicObject& rGraphicObject,
+ const Size& rSize, GraphicObject* pGraphicObject,
const GraphicAttr& rAttr,
const sal_uInt32 nFlags, bool& rCached )
{
- const Graphic& rGraphic = rGraphicObject.GetGraphic();
+ const Graphic& rGraphic = pGraphicObject->GetGraphic();
bool bRet = false;
if( rGraphic.IsSupportedGraphic() && !rGraphic.IsSwapOut() )
@@ -761,13 +773,13 @@ bool GraphicManager::Draw( OutputDevice* pOutDev, const Point& rPoint,
// #i46805# No point in caching a bitmap that is rendered
// via RectFill on the OutDev
if( !(pOutDev->GetDrawMode() & ( DRAWMODE_BLACKBITMAP | DRAWMODE_WHITEBITMAP )) &&
- mpCache->IsDisplayCacheable( pOutDev, rPoint, rSize, rGraphicObject, rAttr ) )
+ mpCache->IsDisplayCacheable( pOutDev, rPoint, rSize, pGraphicObject, rAttr ) )
{
BitmapEx aDstBmpEx;
if( ImplCreateOutput( pOutDev, rPoint, rSize, aSrcBmpEx, rAttr, nFlags, &aDstBmpEx ) )
{
- rCached = mpCache->CreateDisplayCacheObj( pOutDev, rPoint, rSize, rGraphicObject, rAttr, aDstBmpEx );
+ rCached = mpCache->CreateDisplayCacheObj( pOutDev, rPoint, rSize, pGraphicObject, rAttr, aDstBmpEx );
bRet = true;
}
}
@@ -781,7 +793,7 @@ bool GraphicManager::Draw( OutputDevice* pOutDev, const Point& rPoint,
{
const GDIMetaFile& rSrcMtf = rGraphic.GetGDIMetaFile();
- if( mpCache->IsDisplayCacheable( pOutDev, rPoint, rSize, rGraphicObject, rAttr ) )
+ if( mpCache->IsDisplayCacheable( pOutDev, rPoint, rSize, pGraphicObject, rAttr ) )
{
GDIMetaFile aDstMtf;
BitmapEx aContainedBmpEx;
@@ -796,13 +808,13 @@ bool GraphicManager::Draw( OutputDevice* pOutDev, const Point& rPoint,
if( ImplCreateOutput( pOutDev, rPoint, rSize, aContainedBmpEx, rAttr, nFlags, &aDstBmpEx ) )
{
- rCached = mpCache->CreateDisplayCacheObj( pOutDev, rPoint, rSize, rGraphicObject, rAttr, aDstBmpEx );
+ rCached = mpCache->CreateDisplayCacheObj( pOutDev, rPoint, rSize, pGraphicObject, rAttr, aDstBmpEx );
bRet = true;
}
}
else
{
- rCached = mpCache->CreateDisplayCacheObj( pOutDev, rPoint, rSize, rGraphicObject, rAttr, aDstMtf );
+ rCached = mpCache->CreateDisplayCacheObj( pOutDev, rPoint, rSize, pGraphicObject, rAttr, aDstMtf );
bRet = true;
}
}
@@ -810,7 +822,7 @@ bool GraphicManager::Draw( OutputDevice* pOutDev, const Point& rPoint,
if( !bRet )
{
- const Graphic aGraphic( rGraphicObject.GetTransformedGraphic( &rAttr ) );
+ const Graphic aGraphic( pGraphicObject->GetTransformedGraphic( &rAttr ) );
if( aGraphic.IsSupportedGraphic() )
{
diff --git a/svtools/source/graphic/GraphicObject.cxx b/svtools/source/graphic/GraphicObject.cxx
index e70dbbe9f62b..e8f9cccc8367 100644
--- a/svtools/source/graphic/GraphicObject.cxx
+++ b/svtools/source/graphic/GraphicObject.cxx
@@ -33,18 +33,19 @@
#include <vcl/virdev.hxx>
#include <svtools/GraphicObject.hxx>
#include <svtools/GraphicManager.hxx>
-
+#include <comphelper/servicedecl.hxx>
#include <vcl/pdfextoutdevdata.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
-using com::sun::star::uno::Reference;
-using com::sun::star::uno::XInterface;
-using com::sun::star::uno::UNO_QUERY;
-using com::sun::star::uno::Sequence;
-using com::sun::star::container::XNameContainer;
-using com::sun::star::beans::XPropertySet;
+using css::beans::XPropertySet;
+using css::container::XNameContainer;
+using css::uno::Reference;
+using css::uno::RuntimeException;
+using css::uno::Sequence;
+using css::uno::UNO_QUERY;
+using css::uno::XInterface;
struct GrfSimpleCacheObj
{
@@ -86,38 +87,59 @@ struct ImplTileInfo
};
-GraphicObject::GraphicObject( const GraphicManager* pMgr ) :
+GraphicObject::GraphicObject( void) :
mpLink ( NULL ),
mpUserData ( NULL )
{
ImplConstruct();
ImplAssignGraphicData();
- ImplSetGraphicManager( pMgr );
+ ImplSetGraphicManager( );
}
-GraphicObject::GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr ) :
+GraphicObject::GraphicObject( const Graphic& rGraphic ) :
maGraphic ( rGraphic ),
mpLink ( NULL ),
mpUserData ( NULL )
{
ImplConstruct();
ImplAssignGraphicData();
- ImplSetGraphicManager( pMgr );
+ ImplSetGraphicManager( );
}
-GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicManager* pMgr ) :
- SvDataCopyStream(),
+GraphicObject::GraphicObject( const GraphicObject& rGraphicObj) :
maGraphic ( rGraphicObj.GetGraphic() ),
maAttr ( rGraphicObj.maAttr ),
- mpLink ( rGraphicObj.mpLink ? ( new String( *rGraphicObj.mpLink ) ) : NULL ),
- mpUserData ( rGraphicObj.mpUserData ? ( new String( *rGraphicObj.mpUserData ) ) : NULL )
+ mpLink ( rGraphicObj.mpLink ? ( new OUString( *rGraphicObj.mpLink ) ) : NULL ),
+ mpUserData ( rGraphicObj.mpUserData ? ( new OUString( *rGraphicObj.mpUserData ) ) : NULL )
+{
+ ImplConstruct();
+ ImplAssignGraphicData();
+ ImplSetGraphicManager( NULL, &rGraphicObj );
+}
+
+GraphicObject::GraphicObject( const GraphicObject* pGraphicObj) :
+ maGraphic ( pGraphicObj->GetGraphic() ),
+ maAttr ( pGraphicObj->maAttr ),
+ mpLink ( pGraphicObj->mpLink ? ( new OUString( *(pGraphicObj->mpLink) ) ) : NULL ),
+ mpUserData ( pGraphicObj->mpUserData ? ( new OUString( *(pGraphicObj->mpUserData) ) ) : NULL )
+{
+ ImplConstruct();
+ ImplAssignGraphicData();
+ ImplSetGraphicManager( NULL, pGraphicObj );
+}
+
+GraphicObject::GraphicObject( const GraphicObject* pGraphicObj, const Graphic& rGraphic) :
+ maGraphic ( rGraphic ),
+ maAttr ( pGraphicObj->maAttr ),
+ mpLink ( pGraphicObj->mpLink ? ( new OUString( *(pGraphicObj->mpLink) ) ) : NULL ),
+ mpUserData ( pGraphicObj->mpUserData ? ( new OUString( *(pGraphicObj->mpUserData) ) ) : NULL )
{
ImplConstruct();
ImplAssignGraphicData();
- ImplSetGraphicManager( pMgr, NULL, &rGraphicObj );
+ ImplSetGraphicManager( NULL, pGraphicObj );
}
-GraphicObject::GraphicObject( const OString& rUniqueID, const GraphicManager* pMgr ) :
+GraphicObject::GraphicObject( const OString& rUniqueID ) :
mpLink ( NULL ),
mpUserData ( NULL )
{
@@ -126,15 +148,61 @@ GraphicObject::GraphicObject( const OString& rUniqueID, const GraphicManager* pM
// assign default properties
ImplAssignGraphicData();
- ImplSetGraphicManager( pMgr, &rUniqueID );
+ ImplSetGraphicManager(&rUniqueID );
// update properties
ImplAssignGraphicData();
}
+GraphicObject::GraphicObject( css::uno::Sequence< css::uno::Any > const & args,
+ css::uno::Reference< css::uno::XComponentContext > const & )
+ throw( RuntimeException ) :
+ mpLink ( NULL ),
+ mpUserData ( NULL )
+{
+ ImplConstruct();
+ ImplAssignGraphicData();
+
+ if ( args.getLength() == 1 )
+ {
+ OUString sId;
+ if ( !( args[ 0 ] >>= sId ) || sId.isEmpty() )
+ throw css::lang::IllegalArgumentException();
+
+ OString bsId ( OUStringToOString ( sId, RTL_TEXTENCODING_UTF8 ) );
+ ImplSetGraphicManager( &bsId );
+ }
+ else
+ ImplSetGraphicManager();
+}
+
+css::uno::Reference< css::graphic::XGraphic > SAL_CALL GraphicObject::getGraphic()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aSolarGuard;
+ return GetGraphic().GetXGraphic();
+}
+
+void SAL_CALL GraphicObject::setGraphic( const css::uno::Reference< css::graphic::XGraphic >& /*xGraphic*/ )
+ throw( RuntimeException )
+{
+ SolarMutexGuard aSolarGuard;
+ assert(false);
+// Graphic aGraphic( xGraphic );
+// SetGraphic( aGraphic );
+}
+
+OUString SAL_CALL GraphicObject::getUniqueID()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aSolarGuard;
+
+ return OStringToOUString(GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+}
+
GraphicObject::~GraphicObject()
{
- GraphicManager::GetGlobalManager()->UnregisterObject(*this);
+ GraphicManager::GetGlobalManager()->UnregisterObject(this);
delete mpSwapOutTimer;
delete mpSwapStreamHdl;
delete mpLink;
@@ -148,9 +216,9 @@ void GraphicObject::ImplConstruct()
mpSwapOutTimer = NULL;
mpSimpleCache = NULL;
mnAnimationLoopCount = 0;
- mbAutoSwapped = sal_False;
- mbIsInSwapIn = sal_False;
- mbIsInSwapOut = sal_False;
+ mbAutoSwapped = false;
+ mbIsInSwapIn = false;
+ mbIsInSwapOut = false;
}
void GraphicObject::ImplAssignGraphicData()
@@ -166,25 +234,26 @@ void GraphicObject::ImplAssignGraphicData()
mnAnimationLoopCount = ( mbAnimated ? maGraphic.GetAnimationLoopCount() : 0 );
}
-void GraphicObject::ImplSetGraphicManager( const GraphicManager* /* pMgr */, const OString* pID, const GraphicObject* pCopyObj )
+
+void GraphicObject::ImplSetGraphicManager(const OString* pID, const GraphicObject* pCopyObject )
{
- GraphicManager::GetGlobalManager()->RegisterObject(*this, maGraphic, pID, pCopyObj);
+ GraphicManager::GetGlobalManager()->RegisterObject(this, maGraphic, pID, pCopyObject);
}
void GraphicObject::ImplAutoSwapIn()
{
if( IsSwappedOut() )
{
- if( GraphicManager::GetGlobalManager()->FillSwappedGraphicObject( *this, maGraphic ) )
+ if( GraphicManager::GetGlobalManager()->FillSwappedGraphicObject( this, maGraphic ) )
{
- mbAutoSwapped = sal_False;
+ mbAutoSwapped = false;
}
else
{
- mbIsInSwapIn = sal_True;
+ mbIsInSwapIn = true;
if( maGraphic.SwapIn() )
- mbAutoSwapped = sal_False;
+ mbAutoSwapped = false;
else
{
SvStream* pStream = GetSwapStream();
@@ -227,20 +296,20 @@ void GraphicObject::ImplAutoSwapIn()
}
}
- mbIsInSwapIn = sal_False;
+ mbIsInSwapIn = false;
if( !mbAutoSwapped)
{
- GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedIn( *this );
+ GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedIn( this );
}
}
}
}
-sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr,
- PolyPolygon& rClipPolyPoly, sal_Bool& bRectClipRegion ) const
+bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr,
+ PolyPolygon& rClipPolyPoly, bool& bRectClipRegion ) const
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
if( GetType() != GRAPHIC_NONE )
{
@@ -254,11 +323,12 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size&
if( nRot10 )
{
aClipPoly.Rotate( rPt, nRot10 );
- bRectClipRegion = sal_False;
+ bRectClipRegion = false;
}
else
- bRectClipRegion = sal_True;
-
+ {
+ bRectClipRegion = true;
+ }
rClipPolyPoly = aClipPoly;
if( maGraphic.GetPrefMapMode() == MAP_PIXEL )
@@ -299,13 +369,14 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size&
rPt = aOriginPoly[ 0 ];
}
- bRet = sal_True;
+ bRet = true;
}
}
return bRet;
}
+/*
GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj )
{
if( &rGraphicObj != this )
@@ -322,36 +393,22 @@ GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj )
mpLink = rGraphicObj.mpLink ? new String( *rGraphicObj.mpLink ) : NULL;
mpUserData = rGraphicObj.mpUserData ? new String( *rGraphicObj.mpUserData ) : NULL;
ImplAssignGraphicData();
- mbAutoSwapped = sal_False;
+ mbAutoSwapped = false;
GraphicManager::GetGlobalManager()->RegisterObject( *this, maGraphic, NULL, &rGraphicObj );
}
return *this;
}
+*/
-sal_Bool GraphicObject::operator==( const GraphicObject& rGraphicObj ) const
+bool GraphicObject::operator==( const GraphicObject& rGraphicObj ) const
{
return( ( rGraphicObj.maGraphic == maGraphic ) &&
( rGraphicObj.maAttr == maAttr ) &&
( 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;
-}
-
OString GraphicObject::GetUniqueID() const
{
if ( !IsInSwapIn() && IsEPS() )
@@ -359,7 +416,7 @@ OString GraphicObject::GetUniqueID() const
OString aRet;
- aRet = GraphicManager::GetGlobalManager()->GetUniqueID( *this );
+ aRet = GraphicManager::GetGlobalManager()->GetUniqueID( this );
return aRet;
}
@@ -383,17 +440,17 @@ void GraphicObject::SetLink()
delete mpLink, mpLink = NULL;
}
-void GraphicObject::SetLink( const String& rLink )
+void GraphicObject::SetLink( const OUString& rLink )
{
- delete mpLink, mpLink = new String( rLink );
+ delete mpLink, mpLink = new OUString( rLink );
}
-String GraphicObject::GetLink() const
+OUString GraphicObject::GetLink() const
{
if( mpLink )
return *mpLink;
else
- return String();
+ return OUString();
}
void GraphicObject::SetUserData()
@@ -402,17 +459,17 @@ void GraphicObject::SetUserData()
delete mpUserData, mpUserData = NULL;
}
-void GraphicObject::SetUserData( const String& rUserData )
+void GraphicObject::SetUserData( const OUString& rUserData )
{
- delete mpUserData, mpUserData = new String( rUserData );
+ delete mpUserData, mpUserData = new OUString( rUserData );
}
-String GraphicObject::GetUserData() const
+OUString GraphicObject::GetUserData() const
{
if( mpUserData )
return *mpUserData;
else
- return String();
+ return OUString();
}
void GraphicObject::SetSwapStreamHdl()
@@ -457,26 +514,27 @@ void GraphicObject::GraphicManagerDestroyed()
{
}
-sal_Bool GraphicObject::IsCached( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+bool GraphicObject::IsCached( OutputDevice* pOut, const Point& rPoint, const Size& rSize,
const GraphicAttr* pAttr, sal_uLong nFlags ) const
{
- sal_Bool bRet;
+ bool bRet;
if( nFlags & GRFMGR_DRAW_CACHED )
{
- Point aPt( rPt );
- Size aSz( rSz );
+ Point aPoint( rPoint );
+ Size aSize( rSize );
if ( pAttr->IsCropped() )
{
PolyPolygon aClipPolyPoly;
- sal_Bool bRectClip;
- ImplGetCropParams( pOut, aPt, aSz, pAttr, aClipPolyPoly, bRectClip );
+ bool bRectClip;
+ ImplGetCropParams( pOut, aPoint, aSize, pAttr, aClipPolyPoly, bRectClip );
}
- bRet = GraphicManager::GetGlobalManager()->IsInCache( pOut, aPt, aSz, *this, ( pAttr ? *pAttr : GetAttr() ) );
+ bRet = GraphicManager::GetGlobalManager()->IsInCache( pOut, aPoint, aSize, this, ( pAttr ? *pAttr : GetAttr() ) );
}
else
- bRet = sal_False;
-
+ {
+ bRet = false;
+ }
return bRet;
}
@@ -522,8 +580,8 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
if( bCropped )
{
PolyPolygon aClipPolyPoly;
- sal_Bool bRectClip;
- const sal_Bool bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip );
+ bool bRectClip;
+ const bool bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip );
pOut->Push( PUSH_CLIPREGION );
@@ -543,7 +601,7 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
}
}
- bRet = GraphicManager::GetGlobalManager()->DrawObj( pOut, aPt, aSz, *this, aAttr, nFlags, bCached );
+ bRet = GraphicManager::GetGlobalManager()->DrawObj( pOut, aPt, aSz, this, aAttr, nFlags, bCached );
if( bCropped )
pOut->Pop();
@@ -564,7 +622,7 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
}
// #i105243#
-sal_Bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev,
+bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev,
const Point& rPt, const Size& rSz,
const GraphicAttr* pGrfAttr,
const sal_uLong nFlags )
@@ -572,7 +630,7 @@ sal_Bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev,
const GraphicAttr aGrfAttr( pGrfAttr ? *pGrfAttr : GetAttr() );
// Notify PDF writer about linked graphic (if any)
- sal_Bool bWritingPdfLinkedGraphic( sal_False );
+ bool bWritingPdfLinkedGraphic( false );
Point aPt( rPt );
Size aSz( rSz );
Rectangle aCropRect;
@@ -594,8 +652,8 @@ sal_Bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev,
if( aGrfAttr.IsCropped() )
{
PolyPolygon aClipPolyPoly;
- sal_Bool bRectClip;
- const sal_Bool bCrop = ImplGetCropParams( &rOutDev,
+ bool bRectClip;
+ const bool bCrop = ImplGetCropParams( &rOutDev,
aPt, aSz,
&aGrfAttr,
aClipPolyPoly,
@@ -610,7 +668,7 @@ sal_Bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev,
}
}
- sal_Bool bRet = Draw( &rOutDev, rPt, rSz, &aGrfAttr, nFlags );
+ bool bRet = Draw( &rOutDev, rPt, rSz, &aGrfAttr, nFlags );
// Notify PDF writer about linked graphic (if any)
if( bWritingPdfLinkedGraphic )
@@ -624,11 +682,11 @@ sal_Bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev,
return bRet;
}
-sal_Bool GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize,
+bool GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize,
const Size& rOffset, const GraphicAttr* pAttr, sal_uLong nFlags, int nTileCacheSize1D )
{
if( pOut == NULL || rSize.Width() == 0 || rSize.Height() == 0 )
- return sal_False;
+ return false;
const MapMode aOutMapMode( pOut->GetMapMode() );
const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() );
@@ -646,11 +704,11 @@ sal_Bool GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, c
return ImplDrawTiled( pOut, rArea, aOutTileSize, rOffset, pAttr, nFlags, nTileCacheSize1D );
}
-sal_Bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz,
long nExtraData, const GraphicAttr* pAttr, sal_uLong /*nFlags*/,
OutputDevice* pFirstFrameOutDev )
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
GetGraphic();
@@ -662,13 +720,13 @@ sal_Bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, co
{
Point aPt( rPt );
Size aSz( rSz );
- sal_Bool bCropped = aAttr.IsCropped();
+ bool bCropped = aAttr.IsCropped();
if( bCropped )
{
PolyPolygon aClipPolyPoly;
- sal_Bool bRectClip;
- const sal_Bool bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip );
+ bool bRectClip;
+ const bool bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip );
pOut->Push( PUSH_CLIPREGION );
@@ -695,7 +753,7 @@ sal_Bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, co
if( bCropped )
pOut->Pop();
- bRet = sal_True;
+ bRet = true;
}
else
bRet = Draw( pOut, rPt, rSz, &aAttr, GRFMGR_DRAW_STANDARD );
@@ -718,31 +776,6 @@ const Graphic& GraphicObject::GetGraphic() const
return maGraphic;
}
-void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj )
-{
- GraphicManager::GetGlobalManager()->UnregisterObject( *this );
-
- if( mpSwapOutTimer )
- mpSwapOutTimer->Stop();
-
- maGraphic = rGraphic;
- mbAutoSwapped = sal_False;
- ImplAssignGraphicData();
- delete mpLink, mpLink = NULL;
- delete mpSimpleCache, mpSimpleCache = NULL;
-
- GraphicManager::GetGlobalManager()->RegisterObject( *this, maGraphic, 0, pCopyObj);
-
- if( mpSwapOutTimer )
- mpSwapOutTimer->Start();
-}
-
-void GraphicObject::SetGraphic( const Graphic& rGraphic, const String& rLink )
-{
- SetGraphic( rGraphic );
- mpLink = new String( rLink );
-}
-
Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const
{
// #104550# Extracted from svx/source/svdraw/svdograf.cxx
@@ -894,7 +927,7 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo
// cropping affects this frame, apply it then
// do _not_ apply enlargement, this is done below
ImplTransformBitmap( aAnimBmp.aBmpEx, rAttr, Size(), Size(),
- aCropRectRel, rDestSize, sal_False );
+ aCropRectRel, rDestSize, false );
aAnim.Replace( aAnimBmp, nFrame );
}
@@ -939,7 +972,7 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo
else
{
ImplTransformBitmap( aBitmapEx, rAttr, aCropLeftTop, aCropRightBottom,
- aCropRect, rDestSize, sal_True );
+ aCropRect, rDestSize, true );
aTransGraphic = aBitmapEx;
}
@@ -1004,47 +1037,49 @@ Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const /
return aGraphic;
}
-sal_Bool GraphicObject::SwapOut()
+bool GraphicObject::SwapOut()
{
- sal_Bool bRet = ( !mbAutoSwapped ? maGraphic.SwapOut() : sal_False );
+ bool bRet = ( !mbAutoSwapped ? maGraphic.SwapOut() : false );
if( bRet )
{
- GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedOut( *this );
+ GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedOut( this );
}
return bRet;
}
-sal_Bool GraphicObject::SwapOut( SvStream* pOStm )
+bool GraphicObject::SwapOut( SvStream* pOStm )
{
- sal_Bool bRet = ( !mbAutoSwapped ? maGraphic.SwapOut( pOStm ) : sal_False );
+ bool bRet = ( !mbAutoSwapped ? maGraphic.SwapOut( pOStm ) : false );
if( bRet )
{
- GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedOut( *this );
+ GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedOut( this );
}
return bRet;
}
-sal_Bool GraphicObject::SwapIn()
+bool GraphicObject::SwapIn()
{
- sal_Bool bRet;
+ bool bRet;
if( mbAutoSwapped )
{
ImplAutoSwapIn();
- bRet = sal_True;
+ bRet = true;
+ }
+ else if( GraphicManager::GetGlobalManager()->FillSwappedGraphicObject( this, maGraphic ) )
+ {
+ bRet = true;
}
- else if( GraphicManager::GetGlobalManager()->FillSwappedGraphicObject( *this, maGraphic ) )
- bRet = sal_True;
else
{
bRet = maGraphic.SwapIn();
if( bRet)
{
- GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedIn( *this );
+ GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedIn( this );
}
}
@@ -1058,9 +1093,9 @@ void GraphicObject::SetSwapState()
{
if( !IsSwappedOut() )
{
- mbAutoSwapped = sal_True;
+ mbAutoSwapped = true;
- GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedOut( *this );
+ GraphicManager::GetGlobalManager()->GraphicObjectWasSwappedOut( this );
}
}
@@ -1068,7 +1103,7 @@ IMPL_LINK_NOARG(GraphicObject, ImplAutoSwapOutHdl)
{
if( !IsSwappedOut() )
{
- mbIsInSwapOut = sal_True;
+ mbIsInSwapOut = true;
SvStream* pStream = GetSwapStream();
@@ -1088,7 +1123,7 @@ IMPL_LINK_NOARG(GraphicObject, ImplAutoSwapOutHdl)
}
}
- mbIsInSwapOut = sal_False;
+ mbIsInSwapOut = false;
}
if( mpSwapOutTimer )
@@ -1097,12 +1132,13 @@ IMPL_LINK_NOARG(GraphicObject, ImplAutoSwapOutHdl)
return 0L;
}
+#if 0
SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj )
{
VersionCompat aCompat( rIStm, STREAM_READ );
Graphic aGraphic;
GraphicAttr aAttr;
- sal_Bool bLink;
+ sal_Bool bLink;
rIStm >> aGraphic >> aAttr >> bLink;
@@ -1125,7 +1161,7 @@ SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj )
SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj )
{
VersionCompat aCompat( rOStm, STREAM_WRITE, 1 );
- const sal_Bool bLink = rGraphicObj.HasLink();
+ const sal_Bool bLink = rGraphicObj.HasLink() ? sal_True : sal_False;
rOStm << rGraphicObj.GetGraphic() << rGraphicObj.GetAttr() << bLink;
@@ -1134,34 +1170,37 @@ SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj )
return rOStm;
}
+#endif
#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
-GraphicObject GraphicObject::CreateGraphicObjectFromURL( const OUString &rURL )
+rtl::Reference<GraphicObject> GraphicObject::CreateGraphicObjectFromURL( const OUString &rURL )
{
- const String aURL( rURL ), aPrefix( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX) );
- if( aURL.Search( aPrefix ) == 0 )
+ const OUString aURL( rURL );
+ const OUString aPrefix(UNO_NAME_GRAPHOBJ_URLPREFIX);
+ if( aURL.indexOf( aPrefix ) == 0 )
{
// graphic manager url
OString aUniqueID(OUStringToOString(rURL.copy(sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX) - 1), RTL_TEXTENCODING_UTF8));
- return GraphicObject( aUniqueID );
+ return GraphicObject::Create( aUniqueID );
}
else
{
Graphic aGraphic;
- if ( aURL.Len() )
+ if ( !aURL.isEmpty() )
{
SvStream* pStream = utl::UcbStreamHelper::CreateStream( aURL, STREAM_READ );
if( pStream )
+ {
GraphicConverter::Import( *pStream, aGraphic );
+ }
}
- return GraphicObject( aGraphic );
+ return GraphicObject::Create( aGraphic );
}
}
-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 );
@@ -1253,8 +1292,8 @@ bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent,
// #105229# Switch off mapping (converting to logic and back to
// pixel might cause roundoff errors)
- sal_Bool bOldMap( rVDev.IsMapModeEnabled() );
- rVDev.EnableMapMode( sal_False );
+ bool bOldMap( rVDev.IsMapModeEnabled() );
+ rVDev.EnableMapMode( false );
bool bRet( ImplRenderTileRecursive( rVDev, nExponent, nMSBFactor, nNumTilesX, nNumTilesY,
nNumTilesX, nNumTilesY, rTileSizePixel, pAttr, nFlags, aTileInfo ) );
@@ -1278,7 +1317,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
sal_uLong nFlags, ImplTileInfo& rTileInfo )
{
// gets loaded with our tile bitmap
- GraphicObject aTmpGraphic;
+ rtl::Reference<GraphicObject> aTmpGraphic = GraphicObject::Create(*this);
// stores a flag that renders the zero'th tile position
// (i.e. (0,0)+rCurrPos) only if we're at the bottom of the
@@ -1302,8 +1341,6 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
// check for recursion's end condition: LSB place reached?
if( nMSBFactor == 1 )
{
- aTmpGraphic = *this;
-
// set initial tile size -> orig size
aTileInfo.aTileSizePixel = rTileSizePixel;
aTileInfo.nTilesEmptyX = nNumOrigTilesX;
@@ -1317,7 +1354,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
// extract generated tile -> see comment on the first loop below
BitmapEx aTileBitmap( rVDev.GetBitmap( aTileInfo.aTileTopLeft, aTileInfo.aTileSizePixel ) );
- aTmpGraphic = GraphicObject( aTileBitmap );
+ aTmpGraphic = GraphicObject::Create( aTileBitmap );
// fill stripes left over from upstream levels:
//
@@ -1344,7 +1381,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
aCurrPos.Y() = aTileInfo.aTileTopLeft.Y();
for( nX=0; nX < aTileInfo.nTilesEmptyX; nX += nMSBFactor )
{
- if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ if( !aTmpGraphic->Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
return false;
aCurrPos.X() += aTileInfo.aTileSizePixel.Width();
@@ -1365,7 +1402,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
aCurrPos.Y() = aTileInfo.aNextTileTopLeft.Y();
for( nY=0; nY < aTileInfo.nTilesEmptyY; nY += nMSBFactor )
{
- if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ if( !aTmpGraphic->Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
return false;
aCurrPos.Y() += aTileInfo.aTileSizePixel.Height();
@@ -1425,7 +1462,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
{
if( bNoFirstTileDraw )
bNoFirstTileDraw = false; // don't draw first tile position
- else if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ else if( !aTmpGraphic->Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
return false;
aCurrPos.X() += aTileInfo.aTileSizePixel.Width();
@@ -1483,31 +1520,38 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c
// draw alpha content, if any
if( IsTransparent() )
{
- GraphicObject aAlphaGraphic;
+ rtl::Reference<GraphicObject> aAlphaGraphic;
if( GetGraphic().IsAlpha() )
- aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetAlpha().GetBitmap() );
+ {
+ aAlphaGraphic = GraphicObject::Create( GetGraphic().GetBitmapEx().GetAlpha().GetBitmap() );
+ }
else
- aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetMask() );
-
- if( aAlphaGraphic.ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX,
+ {
+ aAlphaGraphic = GraphicObject::Create( GetGraphic().GetBitmapEx().GetMask() );
+ }
+ if( aAlphaGraphic->ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX,
nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) )
{
// Combine bitmap and alpha/mask
if( GetGraphic().IsAlpha() )
+ {
aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(),
AlphaMask( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) ) );
+ }
else
+ {
aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(),
aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ).CreateMask( Color(COL_WHITE) ) );
+ }
}
}
// paint generated tile
- GraphicObject aTmpGraphic( aTileBitmap );
- bRet = aTmpGraphic.ImplDrawTiled( pOut, rArea,
- aTileBitmap.GetSizePixel(),
- rOffset, pAttr, nFlags, nTileCacheSize1D );
+ rtl::Reference<GraphicObject> aTmpGraphic = GraphicObject::Create(aTileBitmap);
+ bRet = aTmpGraphic->ImplDrawTiled( pOut, rArea,
+ aTileBitmap.GetSizePixel(),
+ rOffset, pAttr, nFlags, nTileCacheSize1D );
}
}
else
@@ -1572,7 +1616,7 @@ bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel,
bool bOldMap( rOut.IsMapModeEnabled() );
if( bDrawInPixel )
- rOut.EnableMapMode( sal_False );
+ rOut.EnableMapMode( false );
for( nY=0; nY < nNumTilesY; ++nY )
{
@@ -1609,7 +1653,7 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx,
const Size& rCropRightBottom,
const Rectangle& rCropRect,
const Size& rDstSize,
- sal_Bool bEnlarge ) const
+ bool bEnlarge ) const
{
// #107947# Extracted from svdograf.cxx
@@ -1681,4 +1725,13 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx,
}
}
+#if 0
+namespace unographic {
+ namespace sdecl = comphelper::service_decl;
+ sdecl::class_<GraphicObject, sdecl::with_args<true> > serviceBI;
+ extern sdecl::ServiceDecl const serviceDecl( serviceBI,
+ "com.sun.star.graphic.GraphicObject",
+ "com.sun.star.graphic.GraphicObject" );
+}
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx
index 10a29ff70dac..fb56a9d8913f 100644
--- a/svtools/source/graphic/graphicunofactory.cxx
+++ b/svtools/source/graphic/graphicunofactory.cxx
@@ -35,7 +35,7 @@ typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE;
class GObjectImpl : public GObjectAccess_BASE
{
::osl::Mutex m_aMutex;
- std::auto_ptr< GraphicObject > mpGObject;
+ rtl::Reference< GraphicObject > mrGraphicObject;
public:
GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException);
@@ -53,35 +53,37 @@ GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference
if ( !( args[ 0 ] >>= sId ) || sId.isEmpty() )
throw lang::IllegalArgumentException();
OString bsId(OUStringToOString(sId, RTL_TEXTENCODING_UTF8));
- mpGObject.reset( new GraphicObject( bsId ) );
+ mrGraphicObject = GraphicObject::Create( bsId );
}
else
- mpGObject.reset( new GraphicObject() );
+ {
+ mrGraphicObject = GraphicObject::Create();
+ }
}
uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() throw (uno::RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if ( !mpGObject.get() )
+ if ( !mrGraphicObject.is() )
throw uno::RuntimeException();
- return mpGObject->GetGraphic().GetXGraphic();
+ return mrGraphicObject->GetGraphic().GetXGraphic();
}
void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if ( !mpGObject.get() )
+ if ( !mrGraphicObject.is() )
throw uno::RuntimeException();
Graphic aGraphic( _graphic );
- mpGObject->SetGraphic( aGraphic );
+ mrGraphicObject = GraphicObject::Create( aGraphic );
}
OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
OUString sId;
- if ( mpGObject.get() )
- sId = OStringToOUString(mpGObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+ if ( mrGraphicObject.is() )
+ sId = OStringToOUString(mrGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
return sId;
}
diff --git a/svtools/source/graphic/grfattr.cxx b/svtools/source/graphic/grfattr.cxx
index e04fd33ec218..99bcee803e4c 100644
--- a/svtools/source/graphic/grfattr.cxx
+++ b/svtools/source/graphic/grfattr.cxx
@@ -38,7 +38,7 @@ GraphicAttr::GraphicAttr() :
mnRPercent ( 0 ),
mnGPercent ( 0 ),
mnBPercent ( 0 ),
- mbInvert ( sal_False ),
+ mbInvert ( false ),
mcTransparency ( 0 ),
meDrawMode ( GRAPHICDRAWMODE_STANDARD )
{
@@ -52,7 +52,7 @@ GraphicAttr::~GraphicAttr()
// ------------------------------------------------------------------------
-sal_Bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
+bool GraphicAttr::operator==( const GraphicAttr& rAttr ) const
{
return( ( mfGamma == rAttr.mfGamma ) &&
( mnMirrFlags == rAttr.mnMirrFlags ) &&
@@ -78,12 +78,13 @@ SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr )
VersionCompat aCompat( rIStm, STREAM_READ );
sal_uInt32 nTmp32;
sal_uInt16 nTmp16;
+ sal_Bool bInvert;
rIStm >> nTmp32 >> nTmp32 >> rAttr.mfGamma >> rAttr.mnMirrFlags >> rAttr.mnRotate10;
rIStm >> rAttr.mnContPercent >> rAttr.mnLumPercent >> rAttr.mnRPercent >> rAttr.mnGPercent >> rAttr.mnBPercent;
- rIStm >> rAttr.mbInvert >> rAttr.mcTransparency >> nTmp16;
+ rIStm >> bInvert >> rAttr.mcTransparency >> nTmp16;
rAttr.meDrawMode = (GraphicDrawMode) nTmp16;
-
+ rAttr.mbInvert = bInvert ? true : false;
if( aCompat.GetVersion() >= 2 )
{
//#fdo39428 SvStream no longer supports operator>>(long&)
@@ -107,7 +108,7 @@ SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr )
rOStm << nTmp32 << nTmp32 << rAttr.mfGamma << rAttr.mnMirrFlags << rAttr.mnRotate10;
rOStm << rAttr.mnContPercent << rAttr.mnLumPercent << rAttr.mnRPercent << rAttr.mnGPercent << rAttr.mnBPercent;
- rOStm << rAttr.mbInvert << rAttr.mcTransparency << (sal_uInt16) rAttr.meDrawMode;
+ rOStm << (sal_Bool)rAttr.mbInvert << rAttr.mcTransparency << (sal_uInt16) rAttr.meDrawMode;
//#fdo39428 SvStream no longer supports operator<<(long)
rOStm << sal::static_int_cast<sal_Int32>(rAttr.mnLeftCrop)
<< sal::static_int_cast<sal_Int32>(rAttr.mnTopCrop)
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index 40e190e593d3..039f8c323bb2 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -50,22 +50,22 @@ private:
public:
- GraphicID( const GraphicObject& rObj );
- ~GraphicID() {}
+ GraphicID( const GraphicObject* rObj );
+ ~GraphicID() {}
- sal_Bool operator==( const GraphicID& rID ) const
+ bool operator==( const GraphicID& rID ) const
{
return( rID.mnID1 == mnID1 && rID.mnID2 == mnID2 &&
rID.mnID3 == mnID3 && rID.mnID4 == mnID4 );
}
- OString GetIDString() const;
- sal_Bool IsEmpty() const { return( 0 == mnID4 ); }
+ OString GetIDString() const;
+ bool IsEmpty() const { return( 0 == mnID4 ); }
};
-GraphicID::GraphicID( const GraphicObject& rObj )
+GraphicID::GraphicID( const GraphicObject* rObj )
{
- const Graphic& rGraphic = rObj.GetGraphic();
+ const Graphic& rGraphic = rObj->GetGraphic();
mnID1 = ( (sal_uLong) rGraphic.GetType() ) << 28;
@@ -158,29 +158,30 @@ private:
// SvgData support
SvgDataPtr maSvgData;
- bool ImplInit( const GraphicObject& rObj );
- bool ImplMatches( const GraphicObject& rObj ) const { return( GraphicID( rObj ) == maID ); }
+ bool ImplInit( const GraphicObject* pObj );
+ bool ImplMatches( const rtl::Reference<GraphicObject>& rObj ) const { return( GraphicID( rObj.get() ) == maID ); }
void ImplFillSubstitute( Graphic& rSubstitute );
public:
- GraphicCacheEntry( const GraphicObject& rObj );
- ~GraphicCacheEntry();
+ GraphicCacheEntry( const GraphicObject* rObj );
+ ~GraphicCacheEntry();
const GraphicID& GetID() const { return maID; }
- void AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute );
- bool ReleaseGraphicObjectReference( const GraphicObject& rObj );
+ void AddGraphicObjectReference( const GraphicObject* rObj, Graphic& rSubstitute );
+ bool ReleaseGraphicObjectReference( const GraphicObject* pObj );
size_t GetGraphicObjectReferenceCount() { return maGraphicObjectList.size(); }
- bool HasGraphicObjectReference( const GraphicObject& rObj );
+ bool HasGraphicObjectReference( const rtl::Reference<GraphicObject>& rObj );
+ bool HasGraphicObjectReference( const GraphicObject* pObj );
void TryToSwapIn();
- void GraphicObjectWasSwappedOut( const GraphicObject& rObj );
- bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute );
- void GraphicObjectWasSwappedIn( const GraphicObject& rObj );
+ void GraphicObjectWasSwappedOut( const rtl::Reference<GraphicObject>& rObj );
+ bool FillSwappedGraphicObject( const rtl::Reference<GraphicObject>& rObj, Graphic& rSubstitute );
+ void GraphicObjectWasSwappedIn( const rtl::Reference<GraphicObject>& rObj );
};
-GraphicCacheEntry::GraphicCacheEntry( const GraphicObject& rObj ) :
+GraphicCacheEntry::GraphicCacheEntry( const GraphicObject* rObj ) :
maID ( rObj ),
mpBmpEx ( NULL ),
mpMtf ( NULL ),
@@ -188,7 +189,7 @@ GraphicCacheEntry::GraphicCacheEntry( const GraphicObject& rObj ) :
mbSwappedAll ( true )
{
mbSwappedAll = !ImplInit( rObj );
- maGraphicObjectList.push_back( (GraphicObject*)&rObj );
+ maGraphicObjectList.push_back( rObj );
}
GraphicCacheEntry::~GraphicCacheEntry()
@@ -203,13 +204,13 @@ GraphicCacheEntry::~GraphicCacheEntry()
delete mpAnimation;
}
-bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
+bool GraphicCacheEntry::ImplInit( const GraphicObject* pObj )
{
bool bRet = false;
- if( !rObj.IsSwappedOut() )
+ if( !pObj->IsSwappedOut() )
{
- const Graphic& rGraphic = rObj.GetGraphic();
+ const Graphic& rGraphic = pObj->GetGraphic();
if( mpBmpEx )
delete mpBmpEx, mpBmpEx = NULL;
@@ -222,31 +223,27 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
switch( rGraphic.GetType() )
{
- case( GRAPHIC_BITMAP ):
+ case( GRAPHIC_BITMAP ):
+ if(rGraphic.getSvgData().get())
{
- if(rGraphic.getSvgData().get())
- {
- maSvgData = rGraphic.getSvgData();
- }
- else if( rGraphic.IsAnimated() )
- {
- mpAnimation = new Animation( rGraphic.GetAnimation() );
- }
- else
- {
- mpBmpEx = new BitmapEx( rGraphic.GetBitmapEx() );
- }
+ maSvgData = rGraphic.getSvgData();
}
- break;
-
- case( GRAPHIC_GDIMETAFILE ):
+ else if( rGraphic.IsAnimated() )
{
- mpMtf = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+ mpAnimation = new Animation( rGraphic.GetAnimation() );
+ }
+ else
+ {
+ mpBmpEx = new BitmapEx( rGraphic.GetBitmapEx() );
}
break;
- default:
- DBG_ASSERT( GetID().IsEmpty(), "GraphicCacheEntry::ImplInit: Could not initialize graphic! (=>KA)" );
+ case( GRAPHIC_GDIMETAFILE ):
+ mpMtf = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+ break;
+
+ default:
+ DBG_ASSERT( GetID().IsEmpty(), "GraphicCacheEntry::ImplInit: Could not initialize graphic! (=>KA)" );
break;
}
@@ -315,23 +312,23 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute )
}
}
-void GraphicCacheEntry::AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute )
+void GraphicCacheEntry::AddGraphicObjectReference( const GraphicObject* pObj, Graphic& rSubstitute )
{
if( mbSwappedAll )
- mbSwappedAll = !ImplInit( rObj );
-
+ {
+ mbSwappedAll = !ImplInit( pObj );
+ }
ImplFillSubstitute( rSubstitute );
- maGraphicObjectList.push_back( (GraphicObject*) &rObj );
+ maGraphicObjectList.push_back( pObj);
}
-bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj )
+bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject* pObj )
{
- for(
- GraphicObjectList::iterator it = maGraphicObjectList.begin();
+ for( GraphicObjectList::iterator it = maGraphicObjectList.begin();
it != maGraphicObjectList.end();
- ++it
- ) {
- if( &rObj == *it )
+ ++it )
+ {
+ if( pObj == *it )
{
maGraphicObjectList.erase( it );
return true;
@@ -341,24 +338,43 @@ bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj
return false;
}
-bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj )
+bool GraphicCacheEntry::HasGraphicObjectReference( const rtl::Reference<GraphicObject>& rObj )
{
bool bRet = false;
for( size_t i = 0, n = maGraphicObjectList.size(); ( i < n ) && !bRet; ++i )
- if( &rObj == maGraphicObjectList[ i ] )
+ {
+ if( rObj.get() == maGraphicObjectList[ i ] )
+ {
bRet = true;
+ }
+ }
+ return bRet;
+}
+bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject* pObj )
+{
+ bool bRet = false;
+
+ for( size_t i = 0, n = maGraphicObjectList.size(); ( i < n ) && !bRet; ++i )
+ {
+ if( pObj == maGraphicObjectList[ i ] )
+ {
+ bRet = true;
+ }
+ }
return bRet;
}
void GraphicCacheEntry::TryToSwapIn()
{
if( mbSwappedAll && !maGraphicObjectList.empty() )
- maGraphicObjectList.front()->FireSwapInRequest();
+ {
+ (const_cast<GraphicObject*>(maGraphicObjectList.front()))->FireSwapInRequest();
+ }
}
-void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*/ )
+void GraphicCacheEntry::GraphicObjectWasSwappedOut( const rtl::Reference<GraphicObject>& /*rObj*/ )
{
mbSwappedAll = true;
@@ -377,11 +393,11 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*
}
}
-bool GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute )
+bool GraphicCacheEntry::FillSwappedGraphicObject( const rtl::Reference<GraphicObject>& rObj, Graphic& rSubstitute )
{
bool bRet = false;
- if( !mbSwappedAll && rObj.IsSwappedOut() )
+ if( !mbSwappedAll && rObj->IsSwappedOut() )
{
ImplFillSubstitute( rSubstitute );
bRet = true;
@@ -390,10 +406,10 @@ bool GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Gra
return bRet;
}
-void GraphicCacheEntry::GraphicObjectWasSwappedIn( const GraphicObject& rObj )
+void GraphicCacheEntry::GraphicObjectWasSwappedIn( const rtl::Reference<GraphicObject>& rObj )
{
if( mbSwappedAll )
- mbSwappedAll = !ImplInit( rObj );
+ mbSwappedAll = !ImplInit( rObj.get() );
}
class GraphicDisplayCacheEntry
@@ -406,86 +422,82 @@ private:
BitmapEx* mpBmpEx;
GraphicAttr maAttr;
Size maOutSizePix;
- sal_uLong mnCacheSize;
- sal_uLong mnOutDevDrawMode;
- sal_uInt16 mnOutDevBitCount;
+ size_t mnCacheSize;
+ sal_uLong mnOutDevDrawMode;
+ sal_uInt16 mnOutDevBitCount;
static bool IsCacheableAsBitmap( const GDIMetaFile& rMtf, OutputDevice* pOut, const Size& rSz );
public:
- static sal_uLong GetNeededSize( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr );
+ static size_t GetNeededSize( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const rtl::Reference<GraphicObject>& rObj, const GraphicAttr& rAttr );
public:
- GraphicDisplayCacheEntry( const GraphicCacheEntry* pRefCacheEntry,
- OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr,
- const BitmapEx& rBmpEx ) :
- mpRefCacheEntry( pRefCacheEntry ),
- mpMtf( NULL ), mpBmpEx( new BitmapEx( rBmpEx ) ),
- maAttr( rAttr ), maOutSizePix( pOut->LogicToPixel( rSz ) ),
- mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ),
- mnOutDevDrawMode( pOut->GetDrawMode() ),
- mnOutDevBitCount( pOut->GetBitCount() )
- {
- }
-
- GraphicDisplayCacheEntry( const GraphicCacheEntry* pRefCacheEntry,
- OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr,
- const GDIMetaFile& rMtf ) :
- mpRefCacheEntry( pRefCacheEntry ),
- mpMtf( new GDIMetaFile( rMtf ) ), mpBmpEx( NULL ),
- maAttr( rAttr ), maOutSizePix( pOut->LogicToPixel( rSz ) ),
- mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ),
- mnOutDevDrawMode( pOut->GetDrawMode() ),
- mnOutDevBitCount( pOut->GetBitCount() )
- {
- }
-
-
- ~GraphicDisplayCacheEntry();
-
- const GraphicAttr& GetAttr() const { return maAttr; }
- const Size& GetOutputSizePixel() const { return maOutSizePix; }
- sal_uLong GetCacheSize() const { return mnCacheSize; }
- const GraphicCacheEntry* GetReferencedCacheEntry() const { return mpRefCacheEntry; }
- sal_uLong GetOutDevDrawMode() const { return mnOutDevDrawMode; }
- sal_uInt16 GetOutDevBitCount() const { return mnOutDevBitCount; }
-
- void SetReleaseTime( const ::salhelper::TTimeValue& rReleaseTime ) { maReleaseTime = rReleaseTime; }
- const ::salhelper::TTimeValue& GetReleaseTime() const { return maReleaseTime; }
-
- sal_Bool Matches( OutputDevice* pOut, const Point& /*rPtPixel*/, const Size& rSzPixel,
- const GraphicCacheEntry* pCacheEntry, const GraphicAttr& rAttr ) const
- {
- // #i46805# Additional match
- // criteria: outdev draw mode and
- // bit count. One cannot reuse
- // this cache object, if it's
- // e.g. generated for
- // DRAWMODE_GRAYBITMAP.
- return( ( pCacheEntry == mpRefCacheEntry ) &&
- ( maAttr == rAttr ) &&
- ( ( maOutSizePix == rSzPixel ) || ( !maOutSizePix.Width() && !maOutSizePix.Height() ) ) &&
- ( pOut->GetBitCount() == mnOutDevBitCount ) &&
- ( pOut->GetDrawMode() == mnOutDevDrawMode ) );
- }
-
- void Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz ) const;
+ GraphicDisplayCacheEntry( const GraphicCacheEntry* pRefCacheEntry,
+ OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const rtl::Reference<GraphicObject>& rObj, const GraphicAttr& rAttr,
+ const BitmapEx& rBmpEx ) :
+ mpRefCacheEntry( pRefCacheEntry ),
+ mpMtf( NULL ), mpBmpEx( new BitmapEx( rBmpEx ) ),
+ maAttr( rAttr ), maOutSizePix( pOut->LogicToPixel( rSz ) ),
+ mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ),
+ mnOutDevDrawMode( pOut->GetDrawMode() ),
+ mnOutDevBitCount( pOut->GetBitCount() ) { }
+
+ GraphicDisplayCacheEntry( const GraphicCacheEntry* pRefCacheEntry,
+ OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const rtl::Reference<GraphicObject>& rObj, const GraphicAttr& rAttr,
+ const GDIMetaFile& rMtf ) :
+ mpRefCacheEntry( pRefCacheEntry ),
+ mpMtf( new GDIMetaFile( rMtf ) ), mpBmpEx( NULL ),
+ maAttr( rAttr ), maOutSizePix( pOut->LogicToPixel( rSz ) ),
+ mnCacheSize( GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) ),
+ mnOutDevDrawMode( pOut->GetDrawMode() ),
+ mnOutDevBitCount( pOut->GetBitCount() ) { }
+
+
+ ~GraphicDisplayCacheEntry();
+
+ const GraphicAttr& GetAttr() const { return maAttr; }
+ const Size& GetOutputSizePixel() const { return maOutSizePix; }
+ size_t GetCacheSize() const { return mnCacheSize; }
+ const GraphicCacheEntry* GetReferencedCacheEntry() const { return mpRefCacheEntry; }
+ sal_uLong GetOutDevDrawMode() const { return mnOutDevDrawMode; }
+ sal_uInt16 GetOutDevBitCount() const { return mnOutDevBitCount; }
+
+ void SetReleaseTime( const ::salhelper::TTimeValue& rReleaseTime ) { maReleaseTime = rReleaseTime; }
+ const ::salhelper::TTimeValue& GetReleaseTime() const { return maReleaseTime; }
+
+ bool Matches( OutputDevice* pOut, const Point& /*rPtPixel*/, const Size& rSzPixel,
+ const GraphicCacheEntry* pCacheEntry, const GraphicAttr& rAttr ) const
+ {
+ // #i46805# Additional match
+ // criteria: outdev draw mode and
+ // bit count. One cannot reuse
+ // this cache object, if it's
+ // e.g. generated for
+ // DRAWMODE_GRAYBITMAP.
+ return( ( pCacheEntry == mpRefCacheEntry ) &&
+ ( maAttr == rAttr ) &&
+ ( ( maOutSizePix == rSzPixel ) || ( !maOutSizePix.Width() && !maOutSizePix.Height() ) ) &&
+ ( pOut->GetBitCount() == mnOutDevBitCount ) &&
+ ( pOut->GetDrawMode() == mnOutDevDrawMode ) );
+ }
+
+ void Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz ) const;
};
// This whole function is based on checkMetadataBitmap() from grfmgr2.cxx, see that one for details.
// If you do changes here, change the original function too.
static void checkMetadataBitmap( const BitmapEx& rBmpEx,
- Point /*rSrcPoint*/,
- Size rSrcSize,
- const Point& rDestPoint,
- const Size& rDestSize,
- const Size& rRefSize,
- bool& o_rbNonBitmapActionEncountered )
+ Point /*rSrcPoint*/,
+ Size rSrcSize,
+ const Point& rDestPoint,
+ const Size& rDestSize,
+ const Size& rRefSize,
+ bool& o_rbNonBitmapActionEncountered )
{
if( rSrcSize == Size())
rSrcSize = rBmpEx.GetSizePixel();
@@ -513,7 +525,7 @@ static void checkMetadataBitmap( const BitmapEx& rBmpEx,
// ImplCreateOutput() would use the optimization of using the single bitmap.
// If you do changes here, change the original function too.
bool GraphicDisplayCacheEntry::IsCacheableAsBitmap( const GDIMetaFile& rMtf,
- OutputDevice* pOut, const Size& rSz )
+ OutputDevice* pOut, const Size& rSz )
{
const Size aNewSize( rMtf.GetPrefSize() );
GDIMetaFile rOutMtf = rMtf;
@@ -534,45 +546,45 @@ bool GraphicDisplayCacheEntry::IsCacheableAsBitmap( const GDIMetaFile& rMtf,
{
switch( pAct->GetType() )
{
- case META_FONT_ACTION:
- // FALLTHROUGH intended
- case META_NULL_ACTION:
- // FALLTHROUGH intended
-
- // OutDev state changes (which don't affect bitmap
- // output)
- case META_LINECOLOR_ACTION:
- // FALLTHROUGH intended
- case META_FILLCOLOR_ACTION:
- // FALLTHROUGH intended
- case META_TEXTCOLOR_ACTION:
- // FALLTHROUGH intended
- case META_TEXTFILLCOLOR_ACTION:
- // FALLTHROUGH intended
- case META_TEXTALIGN_ACTION:
- // FALLTHROUGH intended
- case META_TEXTLINECOLOR_ACTION:
- // FALLTHROUGH intended
- case META_TEXTLINE_ACTION:
- // FALLTHROUGH intended
- case META_PUSH_ACTION:
- // FALLTHROUGH intended
- case META_POP_ACTION:
- // FALLTHROUGH intended
- case META_LAYOUTMODE_ACTION:
- // FALLTHROUGH intended
- case META_TEXTLANGUAGE_ACTION:
- // FALLTHROUGH intended
- case META_COMMENT_ACTION:
- break;
+ case META_FONT_ACTION:
+ // FALLTHROUGH intended
+ case META_NULL_ACTION:
+ // FALLTHROUGH intended
+
+ // OutDev state changes (which don't affect bitmap
+ // output)
+ case META_LINECOLOR_ACTION:
+ // FALLTHROUGH intended
+ case META_FILLCOLOR_ACTION:
+ // FALLTHROUGH intended
+ case META_TEXTCOLOR_ACTION:
+ // FALLTHROUGH intended
+ case META_TEXTFILLCOLOR_ACTION:
+ // FALLTHROUGH intended
+ case META_TEXTALIGN_ACTION:
+ // FALLTHROUGH intended
+ case META_TEXTLINECOLOR_ACTION:
+ // FALLTHROUGH intended
+ case META_TEXTLINE_ACTION:
+ // FALLTHROUGH intended
+ case META_PUSH_ACTION:
+ // FALLTHROUGH intended
+ case META_POP_ACTION:
+ // FALLTHROUGH intended
+ case META_LAYOUTMODE_ACTION:
+ // FALLTHROUGH intended
+ case META_TEXTLANGUAGE_ACTION:
+ // FALLTHROUGH intended
+ case META_COMMENT_ACTION:
+ break;
- // bitmap output methods
- case META_BMP_ACTION:
- if( !nNumBitmaps && !bNonBitmapActionEncountered )
- {
- MetaBmpAction* pAction = (MetaBmpAction*)pAct;
+ // bitmap output methods
+ case META_BMP_ACTION:
+ if( !nNumBitmaps && !bNonBitmapActionEncountered )
+ {
+ MetaBmpAction* pAction = (MetaBmpAction*)pAct;
- checkMetadataBitmap(
+ checkMetadataBitmap(
BitmapEx( pAction->GetBitmap()),
Point(), Size(),
pOut->LogicToPixel( pAction->GetPoint(),
@@ -580,16 +592,16 @@ bool GraphicDisplayCacheEntry::IsCacheableAsBitmap( const GDIMetaFile& rMtf,
pAction->GetBitmap().GetSizePixel(),
rSizePix,
bNonBitmapActionEncountered );
- }
- ++nNumBitmaps;
- break;
+ }
+ ++nNumBitmaps;
+ break;
- case META_BMPSCALE_ACTION:
- if( !nNumBitmaps && !bNonBitmapActionEncountered )
- {
- MetaBmpScaleAction* pAction = (MetaBmpScaleAction*)pAct;
+ case META_BMPSCALE_ACTION:
+ if( !nNumBitmaps && !bNonBitmapActionEncountered )
+ {
+ MetaBmpScaleAction* pAction = (MetaBmpScaleAction*)pAct;
- checkMetadataBitmap(
+ checkMetadataBitmap(
BitmapEx( pAction->GetBitmap()),
Point(), Size(),
pOut->LogicToPixel( pAction->GetPoint(),
@@ -598,181 +610,186 @@ bool GraphicDisplayCacheEntry::IsCacheableAsBitmap( const GDIMetaFile& rMtf,
rPrefMapMode ),
rSizePix,
bNonBitmapActionEncountered );
- }
- ++nNumBitmaps;
- break;
-
- case META_BMPSCALEPART_ACTION:
- if( !nNumBitmaps && !bNonBitmapActionEncountered )
- {
- MetaBmpScalePartAction* pAction = (MetaBmpScalePartAction*)pAct;
-
- checkMetadataBitmap( BitmapEx( pAction->GetBitmap() ),
- pAction->GetSrcPoint(),
- pAction->GetSrcSize(),
- pOut->LogicToPixel( pAction->GetDestPoint(),
- rPrefMapMode ),
- pOut->LogicToPixel( pAction->GetDestSize(),
- rPrefMapMode ),
- rSizePix,
- bNonBitmapActionEncountered );
- }
- ++nNumBitmaps;
- break;
-
- case META_BMPEX_ACTION:
- if( !nNumBitmaps && !bNonBitmapActionEncountered )
- {
- MetaBmpExAction* pAction = (MetaBmpExAction*)pAct;
+ }
+ ++nNumBitmaps;
+ break;
- checkMetadataBitmap(
- pAction->GetBitmapEx(),
- Point(), Size(),
- pOut->LogicToPixel( pAction->GetPoint(),
- rPrefMapMode ),
- pAction->GetBitmapEx().GetSizePixel(),
- rSizePix,
- bNonBitmapActionEncountered );
- }
- ++nNumBitmaps;
- break;
+ case META_BMPSCALEPART_ACTION:
+ if( !nNumBitmaps && !bNonBitmapActionEncountered )
+ {
+ MetaBmpScalePartAction* pAction = (MetaBmpScalePartAction*)pAct;
+
+ checkMetadataBitmap( BitmapEx( pAction->GetBitmap() ),
+ pAction->GetSrcPoint(),
+ pAction->GetSrcSize(),
+ pOut->LogicToPixel( pAction->GetDestPoint(),
+ rPrefMapMode ),
+ pOut->LogicToPixel( pAction->GetDestSize(),
+ rPrefMapMode ),
+ rSizePix,
+ bNonBitmapActionEncountered );
+ }
+ ++nNumBitmaps;
+ break;
- case META_BMPEXSCALE_ACTION:
- if( !nNumBitmaps && !bNonBitmapActionEncountered )
- {
- MetaBmpExScaleAction* pAction = (MetaBmpExScaleAction*)pAct;
+ case META_BMPEX_ACTION:
+ if( !nNumBitmaps && !bNonBitmapActionEncountered )
+ {
+ MetaBmpExAction* pAction = (MetaBmpExAction*)pAct;
+
+ checkMetadataBitmap( pAction->GetBitmapEx(),
+ Point(), Size(),
+ pOut->LogicToPixel( pAction->GetPoint(),
+ rPrefMapMode ),
+ pAction->GetBitmapEx().GetSizePixel(),
+ rSizePix,
+ bNonBitmapActionEncountered );
+ }
+ ++nNumBitmaps;
+ break;
- checkMetadataBitmap(
- pAction->GetBitmapEx(),
- Point(), Size(),
- pOut->LogicToPixel( pAction->GetPoint(),
- rPrefMapMode ),
- pOut->LogicToPixel( pAction->GetSize(),
- rPrefMapMode ),
- rSizePix,
- bNonBitmapActionEncountered );
- }
- ++nNumBitmaps;
- break;
+ case META_BMPEXSCALE_ACTION:
+ if( !nNumBitmaps && !bNonBitmapActionEncountered )
+ {
+ MetaBmpExScaleAction* pAction = (MetaBmpExScaleAction*)pAct;
+
+ checkMetadataBitmap( pAction->GetBitmapEx(),
+ Point(), Size(),
+ pOut->LogicToPixel( pAction->GetPoint(),
+ rPrefMapMode ),
+ pOut->LogicToPixel( pAction->GetSize(),
+ rPrefMapMode ),
+ rSizePix,
+ bNonBitmapActionEncountered );
+ }
+ ++nNumBitmaps;
+ break;
- case META_BMPEXSCALEPART_ACTION:
- if( !nNumBitmaps && !bNonBitmapActionEncountered )
- {
- MetaBmpExScalePartAction* pAction = (MetaBmpExScalePartAction*)pAct;
-
- checkMetadataBitmap( pAction->GetBitmapEx(),
- pAction->GetSrcPoint(),
- pAction->GetSrcSize(),
- pOut->LogicToPixel( pAction->GetDestPoint(),
- rPrefMapMode ),
- pOut->LogicToPixel( pAction->GetDestSize(),
- rPrefMapMode ),
- rSizePix,
- bNonBitmapActionEncountered );
- }
- ++nNumBitmaps;
- break;
+ case META_BMPEXSCALEPART_ACTION:
+ if( !nNumBitmaps && !bNonBitmapActionEncountered )
+ {
+ MetaBmpExScalePartAction* pAction = (MetaBmpExScalePartAction*)pAct;
+
+ checkMetadataBitmap( pAction->GetBitmapEx(),
+ pAction->GetSrcPoint(),
+ pAction->GetSrcSize(),
+ pOut->LogicToPixel( pAction->GetDestPoint(),
+ rPrefMapMode ),
+ pOut->LogicToPixel( pAction->GetDestSize(),
+ rPrefMapMode ),
+ rSizePix,
+ bNonBitmapActionEncountered );
+ }
+ ++nNumBitmaps;
+ break;
- // these actions actually output something (that's
- // different from a bitmap)
- case META_RASTEROP_ACTION:
- if( ((MetaRasterOpAction*)pAct)->GetRasterOp() == ROP_OVERPAINT )
- break;
- // FALLTHROUGH intended
- case META_PIXEL_ACTION:
- // FALLTHROUGH intended
- case META_POINT_ACTION:
- // FALLTHROUGH intended
- case META_LINE_ACTION:
- // FALLTHROUGH intended
- case META_RECT_ACTION:
- // FALLTHROUGH intended
- case META_ROUNDRECT_ACTION:
- // FALLTHROUGH intended
- case META_ELLIPSE_ACTION:
- // FALLTHROUGH intended
- case META_ARC_ACTION:
- // FALLTHROUGH intended
- case META_PIE_ACTION:
- // FALLTHROUGH intended
- case META_CHORD_ACTION:
- // FALLTHROUGH intended
- case META_POLYLINE_ACTION:
- // FALLTHROUGH intended
- case META_POLYGON_ACTION:
- // FALLTHROUGH intended
- case META_POLYPOLYGON_ACTION:
- // FALLTHROUGH intended
-
- case META_TEXT_ACTION:
- // FALLTHROUGH intended
- case META_TEXTARRAY_ACTION:
- // FALLTHROUGH intended
- case META_STRETCHTEXT_ACTION:
- // FALLTHROUGH intended
- case META_TEXTRECT_ACTION:
- // FALLTHROUGH intended
-
- case META_MASK_ACTION:
- // FALLTHROUGH intended
- case META_MASKSCALE_ACTION:
- // FALLTHROUGH intended
- case META_MASKSCALEPART_ACTION:
- // FALLTHROUGH intended
-
- case META_GRADIENT_ACTION:
- // FALLTHROUGH intended
- case META_HATCH_ACTION:
- // FALLTHROUGH intended
- case META_WALLPAPER_ACTION:
- // FALLTHROUGH intended
-
- case META_TRANSPARENT_ACTION:
- // FALLTHROUGH intended
- case META_EPS_ACTION:
- // FALLTHROUGH intended
- case META_FLOATTRANSPARENT_ACTION:
- // FALLTHROUGH intended
- case META_GRADIENTEX_ACTION:
- // FALLTHROUGH intended
-
- // OutDev state changes that _do_ affect bitmap
- // output
- case META_CLIPREGION_ACTION:
- // FALLTHROUGH intended
- case META_ISECTRECTCLIPREGION_ACTION:
- // FALLTHROUGH intended
- case META_ISECTREGIONCLIPREGION_ACTION:
- // FALLTHROUGH intended
- case META_MOVECLIPREGION_ACTION:
- // FALLTHROUGH intended
-
- case META_MAPMODE_ACTION:
- // FALLTHROUGH intended
- case META_REFPOINT_ACTION:
- // FALLTHROUGH intended
- default:
- bNonBitmapActionEncountered = true;
+ // these actions actually output something (that's
+ // different from a bitmap)
+ case META_RASTEROP_ACTION:
+ if( ((MetaRasterOpAction*)pAct)->GetRasterOp() == ROP_OVERPAINT )
break;
+ // FALLTHROUGH intended
+ case META_PIXEL_ACTION:
+ // FALLTHROUGH intended
+ case META_POINT_ACTION:
+ // FALLTHROUGH intended
+ case META_LINE_ACTION:
+ // FALLTHROUGH intended
+ case META_RECT_ACTION:
+ // FALLTHROUGH intended
+ case META_ROUNDRECT_ACTION:
+ // FALLTHROUGH intended
+ case META_ELLIPSE_ACTION:
+ // FALLTHROUGH intended
+ case META_ARC_ACTION:
+ // FALLTHROUGH intended
+ case META_PIE_ACTION:
+ // FALLTHROUGH intended
+ case META_CHORD_ACTION:
+ // FALLTHROUGH intended
+ case META_POLYLINE_ACTION:
+ // FALLTHROUGH intended
+ case META_POLYGON_ACTION:
+ // FALLTHROUGH intended
+ case META_POLYPOLYGON_ACTION:
+ // FALLTHROUGH intended
+
+ case META_TEXT_ACTION:
+ // FALLTHROUGH intended
+ case META_TEXTARRAY_ACTION:
+ // FALLTHROUGH intended
+ case META_STRETCHTEXT_ACTION:
+ // FALLTHROUGH intended
+ case META_TEXTRECT_ACTION:
+ // FALLTHROUGH intended
+
+ case META_MASK_ACTION:
+ // FALLTHROUGH intended
+ case META_MASKSCALE_ACTION:
+ // FALLTHROUGH intended
+ case META_MASKSCALEPART_ACTION:
+ // FALLTHROUGH intended
+
+ case META_GRADIENT_ACTION:
+ // FALLTHROUGH intended
+ case META_HATCH_ACTION:
+ // FALLTHROUGH intended
+ case META_WALLPAPER_ACTION:
+ // FALLTHROUGH intended
+
+ case META_TRANSPARENT_ACTION:
+ // FALLTHROUGH intended
+ case META_EPS_ACTION:
+ // FALLTHROUGH intended
+ case META_FLOATTRANSPARENT_ACTION:
+ // FALLTHROUGH intended
+ case META_GRADIENTEX_ACTION:
+ // FALLTHROUGH intended
+
+ // OutDev state changes that _do_ affect bitmap
+ // output
+ case META_CLIPREGION_ACTION:
+ // FALLTHROUGH intended
+ case META_ISECTRECTCLIPREGION_ACTION:
+ // FALLTHROUGH intended
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ // FALLTHROUGH intended
+ case META_MOVECLIPREGION_ACTION:
+ // FALLTHROUGH intended
+
+ case META_MAPMODE_ACTION:
+ // FALLTHROUGH intended
+ case META_REFPOINT_ACTION:
+ // FALLTHROUGH intended
+ default:
+ bNonBitmapActionEncountered = true;
+ break;
}
}
}
return nNumBitmaps == 1 && !bNonBitmapActionEncountered;
}
-sal_uLong GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Point& /*rPt*/, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr )
+size_t GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Point& /*rPt*/, const Size& rSz,
+ const rtl::Reference<GraphicObject>& rObj,
+ const GraphicAttr& rAttr )
{
- const Graphic& rGraphic = rObj.GetGraphic();
+ const Graphic& rGraphic = rObj->GetGraphic();
const GraphicType eType = rGraphic.GetType();
bool canCacheAsBitmap = false;
if( GRAPHIC_BITMAP == eType )
+ {
canCacheAsBitmap = true;
+ }
else if( GRAPHIC_GDIMETAFILE == eType )
+ {
canCacheAsBitmap = IsCacheableAsBitmap( rGraphic.GetGDIMetaFile(), pOut, rSz );
+ }
else
+ {
return 0;
+ }
if( canCacheAsBitmap )
{
const Size aOutSizePix( pOut->LogicToPixel( rSz ) );
@@ -786,8 +803,10 @@ sal_uLong GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Poi
else if( nBitCount )
{
sal_uLong nNeededSize = aOutSizePix.Width() * aOutSizePix.Height() * nBitCount / 8;
- if( rObj.IsTransparent() || ( rAttr.GetRotation() % 3600 ) )
+ if( rObj->IsTransparent() || ( rAttr.GetRotation() % 3600 ) )
+ {
nNeededSize += nNeededSize / nBitCount;
+ }
return nNeededSize;
}
else
@@ -797,7 +816,9 @@ sal_uLong GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Poi
}
}
else
+ {
return rGraphic.GetSizeBytes();
+ }
}
GraphicDisplayCacheEntry::~GraphicDisplayCacheEntry()
@@ -826,11 +847,13 @@ void GraphicDisplayCacheEntry::Draw( OutputDevice* pOut, const Point& rPt, const
pOut->DrawBitmapEx( aRotBoundRect.TopLeft(), aRotBoundRect.GetSize(), *mpBmpEx );
}
else
+ {
pOut->DrawBitmapEx( rPt, rSz, *mpBmpEx );
+ }
}
}
-GraphicCache::GraphicCache( sal_uLong nDisplayCacheSize, sal_uLong nMaxObjDisplayCacheSize ) :
+GraphicCache::GraphicCache( size_t nDisplayCacheSize, size_t nMaxObjDisplayCacheSize ) :
mnReleaseTimeoutSeconds ( 0UL ),
mnMaxDisplaySize ( nDisplayCacheSize ),
mnMaxObjDisplaySize ( nMaxObjDisplayCacheSize ),
@@ -847,37 +870,26 @@ GraphicCache::~GraphicCache()
DBG_ASSERT( maDisplayCache.empty(), "GraphicCache::~GraphicCache(): there are some GraphicObjects in display cache" );
}
-void GraphicCache::AddGraphicObject(
- const GraphicObject& rObj,
- Graphic& rSubstitute,
- const OString* pID,
- const GraphicObject* pCopyObj
-)
+void GraphicCache::AddGraphicObject( const GraphicObject* pObj,
+ Graphic& rSubstitute,
+ const OString* pID,
+ const GraphicObject* pCopyObj)
{
- sal_Bool bInserted = sal_False;
-
- if( !rObj.IsSwappedOut()
- && ( pID
- || ( pCopyObj
- && ( pCopyObj->GetType() != GRAPHIC_NONE )
- )
- || ( rObj.GetType() != GRAPHIC_NONE )
- )
- )
+ bool bInserted = false;
+
+ if( !pObj->IsSwappedOut() &&
+ ( pID || ( pCopyObj && ( pCopyObj->GetType() != GRAPHIC_NONE ) ) ||
+ ( pObj->GetType() != GRAPHIC_NONE ) ) )
{
- if( pCopyObj
- && !maGraphicCache.empty()
- )
+ if( pCopyObj && !maGraphicCache.empty())
{
GraphicCacheEntryList::iterator it = maGraphicCache.begin();
- while( !bInserted
- && ( it != maGraphicCache.end() )
- )
+ while( !bInserted && ( it != maGraphicCache.end() ) )
{
- if( (*it)->HasGraphicObjectReference( *pCopyObj ) )
+ if( (*it)->HasGraphicObjectReference( pCopyObj ) )
{
- (*it)->AddGraphicObjectReference( rObj, rSubstitute );
- bInserted = sal_True;
+ (*it)->AddGraphicObjectReference( pObj, rSubstitute );
+ bInserted = true;
}
else
{
@@ -893,12 +905,10 @@ void GraphicCache::AddGraphicObject(
if( !pID )
{
- apID.reset( new GraphicID( rObj ) );
+ apID.reset( new GraphicID( pObj ) );
}
- while( !bInserted
- && ( it != maGraphicCache.end() )
- )
+ while(!bInserted && ( it != maGraphicCache.end() ) )
{
const GraphicID& rEntryID = (*it)->GetID();
@@ -913,22 +923,21 @@ void GraphicCache::AddGraphicObject(
// CacheEntry object; after this, quickly jump out of the outer iteration
for( GraphicCacheEntryList::iterator jt = maGraphicCache.begin();
!bInserted && jt != maGraphicCache.end();
- ++jt
- )
+ ++jt)
{
const GraphicID& rID = (*jt)->GetID();
if( rID.GetIDString() == *pID )
{
- (*jt)->AddGraphicObjectReference( rObj, rSubstitute );
- bInserted = sal_True;
+ (*jt)->AddGraphicObjectReference( pObj, rSubstitute );
+ bInserted = true;
}
}
if( !bInserted )
{
- maGraphicCache.push_back( new GraphicCacheEntry( rObj ) );
- bInserted = sal_True;
+ maGraphicCache.push_back( new GraphicCacheEntry( pObj ) );
+ bInserted = true;
}
}
}
@@ -936,29 +945,33 @@ void GraphicCache::AddGraphicObject(
{
if( rEntryID == *apID )
{
- (*it)->AddGraphicObjectReference( rObj, rSubstitute );
- bInserted = sal_True;
+ (*it)->AddGraphicObjectReference( pObj, rSubstitute );
+ bInserted = true;
}
}
if( !bInserted )
+ {
++it;
+ }
}
}
}
if( !bInserted )
- maGraphicCache.push_back( new GraphicCacheEntry( rObj ) );
+ {
+ maGraphicCache.push_back( new GraphicCacheEntry( pObj ) );
+ }
}
-void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj )
+void GraphicCache::ReleaseGraphicObject( const GraphicObject* pObj )
{
// Release cached object
bool bRemoved = false;
GraphicCacheEntryList::iterator it = maGraphicCache.begin();
while (!bRemoved && it != maGraphicCache.end())
{
- bRemoved = (*it)->ReleaseGraphicObjectReference( rObj );
+ bRemoved = (*it)->ReleaseGraphicObjectReference( pObj );
if( bRemoved )
{
@@ -977,7 +990,9 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj )
delete pDisplayEntry;
}
else
+ {
++it2;
+ }
}
// delete graphic cache entry
@@ -986,33 +1001,40 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj )
}
}
else
+ {
++it;
+ }
}
DBG_ASSERT( bRemoved, "GraphicCache::ReleaseGraphicObject(...): GraphicObject not found in cache" );
}
-void GraphicCache::GraphicObjectWasSwappedOut( const GraphicObject& rObj )
+void GraphicCache::GraphicObjectWasSwappedOut( const rtl::Reference<GraphicObject>& rObj )
{
// notify cache that rObj is swapped out (and can thus be pruned
// from the cache)
GraphicCacheEntry* pEntry = ImplGetCacheEntry( rObj );
if( pEntry )
+ {
pEntry->GraphicObjectWasSwappedOut( rObj );
+ }
}
-sal_Bool GraphicCache::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute )
+bool GraphicCache::FillSwappedGraphicObject( const rtl::Reference<GraphicObject>& rObj,
+ Graphic& rSubstitute )
{
GraphicCacheEntry* pEntry = ImplGetCacheEntry( rObj );
if( !pEntry )
- return sal_False;
+ {
+ return false;
+ }
return pEntry->FillSwappedGraphicObject( rObj, rSubstitute );
}
-void GraphicCache::GraphicObjectWasSwappedIn( const GraphicObject& rObj )
+void GraphicCache::GraphicObjectWasSwappedIn( const rtl::Reference<GraphicObject>& rObj )
{
GraphicCacheEntry* pEntry = ImplGetCacheEntry( rObj );
@@ -1020,25 +1042,29 @@ void GraphicCache::GraphicObjectWasSwappedIn( const GraphicObject& rObj )
{
if( pEntry->GetID().IsEmpty() )
{
- ReleaseGraphicObject( rObj );
- AddGraphicObject( rObj, (Graphic&) rObj.GetGraphic(), NULL, NULL );
+ ReleaseGraphicObject( rObj.get() );
+ AddGraphicObject( rObj.get(), (Graphic&) rObj->GetGraphic(), NULL, NULL );
}
else
+ {
pEntry->GraphicObjectWasSwappedIn( rObj );
+ }
}
}
-void GraphicCache::SetMaxDisplayCacheSize( sal_uLong nNewCacheSize )
+void GraphicCache::SetMaxDisplayCacheSize( size_t nNewCacheSize )
{
mnMaxDisplaySize = nNewCacheSize;
if( GetMaxDisplayCacheSize() < GetUsedDisplayCacheSize() )
+ {
ImplFreeDisplayCacheSpace( GetUsedDisplayCacheSize() - GetMaxDisplayCacheSize() );
+ }
}
-void GraphicCache::SetMaxObjDisplayCacheSize( sal_uLong nNewMaxObjSize, sal_Bool bDestroyGreaterCached )
+void GraphicCache::SetMaxObjDisplayCacheSize( size_t nNewMaxObjSize, bool bDestroyGreaterCached )
{
- const sal_Bool bDestroy = ( bDestroyGreaterCached && ( nNewMaxObjSize < mnMaxObjDisplaySize ) );
+ const bool bDestroy = ( bDestroyGreaterCached && ( nNewMaxObjSize < mnMaxObjDisplaySize ) );
mnMaxObjDisplaySize = std::min( nNewMaxObjSize, mnMaxDisplaySize );
@@ -1055,12 +1081,14 @@ void GraphicCache::SetMaxObjDisplayCacheSize( sal_uLong nNewMaxObjSize, sal_Bool
delete pCacheObj;
}
else
+ {
++it;
+ }
}
}
}
-void GraphicCache::SetCacheTimeout( sal_uLong nTimeoutSeconds )
+void GraphicCache::SetCacheTimeout( int nTimeoutSeconds )
{
if( mnReleaseTimeoutSeconds != nTimeoutSeconds )
{
@@ -1080,35 +1108,60 @@ void GraphicCache::SetCacheTimeout( sal_uLong nTimeoutSeconds )
}
}
-sal_Bool GraphicCache::IsDisplayCacheable( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr ) const
+bool GraphicCache::IsDisplayCacheable( OutputDevice* pOut, const Point& rPoint, const Size& rSize,
+ const rtl::Reference<GraphicObject>& rObj,
+ const GraphicAttr& rAttr ) const
{
- return( GraphicDisplayCacheEntry::GetNeededSize( pOut, rPt, rSz, rObj, rAttr ) <=
- GetMaxObjDisplayCacheSize() );
+ return( GraphicDisplayCacheEntry::GetNeededSize( pOut, rPoint, rSize, rObj, rAttr ) <= GetMaxObjDisplayCacheSize() );
}
-sal_Bool GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr ) const
+bool GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPoint, const Size& rSize,
+ const rtl::Reference<GraphicObject>& rObj,
+ const GraphicAttr& rAttr ) const
{
- const Point aPtPixel( pOut->LogicToPixel( rPt ) );
- const Size aSzPixel( pOut->LogicToPixel( rSz ) );
+ const Point aPointPixel( pOut->LogicToPixel( rPoint ) );
+ const Size aSizePixel( pOut->LogicToPixel( rSize ) );
const GraphicCacheEntry* pCacheEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj );
- sal_Bool bFound = sal_False;
+ bool bFound = false;
if( pCacheEntry )
{
for( GraphicDisplayCacheEntryList::const_iterator it = maDisplayCache.begin();
!bFound && ( it != maDisplayCache.end() ); ++it )
{
- if( (*it)->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) )
- bFound = sal_True;
+ if( (*it)->Matches( pOut, aPointPixel, aSizePixel, pCacheEntry, rAttr ) )
+ {
+ bFound = true;
+ }
}
}
+ return bFound;
+}
+
+bool GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPoint, const Size& rSize,
+ const GraphicObject* pObj,
+ const GraphicAttr& rAttr ) const
+{
+ const Point aPointPixel( pOut->LogicToPixel( rPoint ) );
+ const Size aSizePixel( pOut->LogicToPixel( rSize ) );
+ const GraphicCacheEntry* pCacheEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( pObj );
+ bool bFound = false;
+ if( pCacheEntry )
+ {
+ for( GraphicDisplayCacheEntryList::const_iterator it = maDisplayCache.begin();
+ !bFound && ( it != maDisplayCache.end() ); ++it )
+ {
+ if( (*it)->Matches( pOut, aPointPixel, aSizePixel, pCacheEntry, rAttr ) )
+ {
+ bFound = true;
+ }
+ }
+ }
return bFound;
}
-OString GraphicCache::GetUniqueID( const GraphicObject& rObj ) const
+OString GraphicCache::GetUniqueID( const rtl::Reference<GraphicObject>& rObj ) const
{
OString aRet;
GraphicCacheEntry* pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj );
@@ -1121,25 +1174,46 @@ OString GraphicCache::GetUniqueID( const GraphicObject& rObj ) const
pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj );
if( pEntry )
+ {
aRet = pEntry->GetID().GetIDString();
+ }
+ return aRet;
+}
+
+OString GraphicCache::GetUniqueID( const GraphicObject* pObj ) const
+{
+ OString aRet;
+ GraphicCacheEntry* pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( pObj );
+
+ // ensure that the entry is correctly initialized (it has to be read at least once)
+ if( pEntry && pEntry->GetID().IsEmpty() )
+ pEntry->TryToSwapIn();
+
+ // do another call to ImplGetCacheEntry in case of modified entry list
+ pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( pObj );
+ if( pEntry )
+ {
+ aRet = pEntry->GetID().GetIDString();
+ }
return aRet;
}
-sal_Bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr,
+bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPoint, const Size& rSize,
+ const rtl::Reference<GraphicObject>& rObj, const GraphicAttr& rAttr,
const BitmapEx& rBmpEx )
{
- const sal_uLong nNeededSize = GraphicDisplayCacheEntry::GetNeededSize( pOut, rPt, rSz, rObj, rAttr );
- sal_Bool bRet = sal_False;
+ const size_t nNeededSize = GraphicDisplayCacheEntry::GetNeededSize( pOut, rPoint, rSize, rObj, rAttr );
+ bool bRet = false;
if( nNeededSize <= GetMaxObjDisplayCacheSize() )
{
if( nNeededSize > GetFreeDisplayCacheSize() )
+ {
ImplFreeDisplayCacheSpace( nNeededSize - GetFreeDisplayCacheSize() );
-
+ }
GraphicDisplayCacheEntry* pNewEntry = new GraphicDisplayCacheEntry( ImplGetCacheEntry( rObj ),
- pOut, rPt, rSz, rObj, rAttr, rBmpEx );
+ pOut, rPoint, rSize, rObj, rAttr, rBmpEx );
if( GetCacheTimeout() )
{
@@ -1152,26 +1226,27 @@ sal_Bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& r
maDisplayCache.push_back( pNewEntry );
mnUsedDisplaySize += pNewEntry->GetCacheSize();
- bRet = sal_True;
+ bRet = true;
}
return bRet;
}
-sal_Bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr,
+bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPoint, const Size& rSize,
+ const rtl::Reference<GraphicObject>& rObj, const GraphicAttr& rAttr,
const GDIMetaFile& rMtf )
{
- const sal_uLong nNeededSize = GraphicDisplayCacheEntry::GetNeededSize( pOut, rPt, rSz, rObj, rAttr );
- sal_Bool bRet = sal_False;
+ const size_t nNeededSize = GraphicDisplayCacheEntry::GetNeededSize( pOut, rPoint, rSize, rObj, rAttr );
+ bool bRet = false;
if( nNeededSize <= GetMaxObjDisplayCacheSize() )
{
if( nNeededSize > GetFreeDisplayCacheSize() )
+ {
ImplFreeDisplayCacheSpace( nNeededSize - GetFreeDisplayCacheSize() );
-
+ }
GraphicDisplayCacheEntry* pNewEntry = new GraphicDisplayCacheEntry( ImplGetCacheEntry( rObj ),
- pOut, rPt, rSz, rObj, rAttr, rMtf );
+ pOut, rPoint, rSize, rObj, rAttr, rMtf );
if( GetCacheTimeout() )
{
@@ -1184,26 +1259,26 @@ sal_Bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& r
maDisplayCache.push_back( pNewEntry );
mnUsedDisplaySize += pNewEntry->GetCacheSize();
- bRet = sal_True;
+ bRet = true;
}
return bRet;
}
-sal_Bool GraphicCache::DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicObject& rObj, const GraphicAttr& rAttr )
+bool GraphicCache::DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPoint, const Size& rSize,
+ const GraphicObject* pObj, const GraphicAttr& rAttr )
{
- const Point aPtPixel( pOut->LogicToPixel( rPt ) );
- const Size aSzPixel( pOut->LogicToPixel( rSz ) );
- const GraphicCacheEntry* pCacheEntry = ImplGetCacheEntry( rObj );
+ const Point aPointPixel( pOut->LogicToPixel( rPoint ) );
+ const Size aSizePixel( pOut->LogicToPixel( rSize ) );
+ const GraphicCacheEntry* pCacheEntry = ImplGetCacheEntry( pObj );
GraphicDisplayCacheEntry* pDisplayCacheEntry = NULL;
GraphicDisplayCacheEntryList::iterator it = maDisplayCache.begin();
- sal_Bool bRet = sal_False;
+ bool bRet = false;
while( !bRet && it != maDisplayCache.end() )
{
pDisplayCacheEntry = *it;
- if( pDisplayCacheEntry->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) )
+ if( pDisplayCacheEntry->Matches( pOut, aPointPixel, aSizePixel, pCacheEntry, rAttr ) )
{
::salhelper::TTimeValue aReleaseTime;
@@ -1218,29 +1293,33 @@ sal_Bool GraphicCache::DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt
}
pDisplayCacheEntry->SetReleaseTime( aReleaseTime );
- bRet = sal_True;
+ bRet = true;
}
else
+ {
++it;
+ }
}
if( bRet )
- pDisplayCacheEntry->Draw( pOut, rPt, rSz );
-
+ {
+ pDisplayCacheEntry->Draw( pOut, rPoint, rSize );
+ }
return bRet;
}
-sal_Bool GraphicCache::ImplFreeDisplayCacheSpace( sal_uLong nSizeToFree )
+bool GraphicCache::ImplFreeDisplayCacheSpace( size_t nSizeToFree )
{
- sal_uLong nFreedSize = 0UL;
+ size_t nFreedSize = 0UL;
if( nSizeToFree )
{
GraphicDisplayCacheEntryList::iterator it = maDisplayCache.begin();
if( nSizeToFree > mnUsedDisplaySize )
+ {
nSizeToFree = mnUsedDisplaySize;
-
+ }
while( it != maDisplayCache.end() )
{
GraphicDisplayCacheEntry* pCacheObj = *it;
@@ -1251,23 +1330,42 @@ sal_Bool GraphicCache::ImplFreeDisplayCacheSpace( sal_uLong nSizeToFree )
delete pCacheObj;
if( nFreedSize >= nSizeToFree )
+ {
break;
+ }
}
}
return( nFreedSize >= nSizeToFree );
}
-GraphicCacheEntry* GraphicCache::ImplGetCacheEntry( const GraphicObject& rObj )
+GraphicCacheEntry* GraphicCache::ImplGetCacheEntry( const rtl::Reference<GraphicObject>& rObj )
{
GraphicCacheEntry* pRet = NULL;
- for(
- GraphicCacheEntryList::iterator it = maGraphicCache.begin();
+ for( GraphicCacheEntryList::iterator it = maGraphicCache.begin();
!pRet && it != maGraphicCache.end();
- ++it
- ) {
- if( (*it)->HasGraphicObjectReference( rObj ) ) {
+ ++it)
+ {
+ if( (*it)->HasGraphicObjectReference( rObj ) )
+ {
+ pRet = *it;
+ }
+ }
+
+ return pRet;
+}
+
+GraphicCacheEntry* GraphicCache::ImplGetCacheEntry( const GraphicObject* pObj )
+{
+ GraphicCacheEntry* pRet = NULL;
+
+ for( GraphicCacheEntryList::iterator it = maGraphicCache.begin();
+ !pRet && it != maGraphicCache.end();
+ ++it)
+ {
+ if( (*it)->HasGraphicObjectReference( pObj ) )
+ {
pRet = *it;
}
}
@@ -1279,7 +1377,7 @@ IMPL_LINK( GraphicCache, ReleaseTimeoutHdl, Timer*, pTimer )
{
pTimer->Stop();
- ::salhelper::TTimeValue aCurTime;
+ ::salhelper::TTimeValue aCurTime;
GraphicDisplayCacheEntryList::iterator it = maDisplayCache.begin();
osl_getSystemTime( &aCurTime );
@@ -1296,9 +1394,10 @@ IMPL_LINK( GraphicCache, ReleaseTimeoutHdl, Timer*, pTimer )
delete pDisplayEntry;
}
else
+ {
++it;
+ }
}
-
pTimer->Start();
return 0;
diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx
index ac5428729200..d5b9ee7387e0 100644
--- a/svtools/source/graphic/grfcache.hxx
+++ b/svtools/source/graphic/grfcache.hxx
@@ -20,6 +20,7 @@
#ifndef _GRFCACHE_HXX
#define _GRFCACHE_HXX
+#include <rtl/ref.hxx>
#include <vcl/graph.hxx>
#include <vcl/timer.hxx>
#include <list>
@@ -39,105 +40,93 @@ private:
typedef std::list< GraphicCacheEntry* > GraphicCacheEntryList;
typedef std::list< GraphicDisplayCacheEntry* > GraphicDisplayCacheEntryList;
- Timer maReleaseTimer;
- GraphicCacheEntryList maGraphicCache;
+ Timer maReleaseTimer;
+ GraphicCacheEntryList maGraphicCache;
GraphicDisplayCacheEntryList maDisplayCache;
- sal_uLong mnReleaseTimeoutSeconds;
- sal_uLong mnMaxDisplaySize;
- sal_uLong mnMaxObjDisplaySize;
- sal_uLong mnUsedDisplaySize;
+ int mnReleaseTimeoutSeconds;
+ size_t mnMaxDisplaySize;
+ size_t mnMaxObjDisplaySize;
+ size_t mnUsedDisplaySize;
- sal_Bool ImplFreeDisplayCacheSpace( sal_uLong nSizeToFree );
- GraphicCacheEntry* ImplGetCacheEntry( const GraphicObject& rObj );
+ bool ImplFreeDisplayCacheSpace( sal_uLong nSizeToFree );
+ GraphicCacheEntry* ImplGetCacheEntry( const rtl::Reference<GraphicObject>& rObj );
+ GraphicCacheEntry* ImplGetCacheEntry( const GraphicObject* pObj );
- DECL_LINK( ReleaseTimeoutHdl, Timer* pTimer );
+ DECL_LINK( ReleaseTimeoutHdl, Timer* pTimer );
public:
-
- GraphicCache(
- sal_uLong nDisplayCacheSize = 10000000UL,
- sal_uLong nMaxObjDisplayCacheSize = 2400000UL
- );
-
- ~GraphicCache();
+ GraphicCache( size_t nDisplayCacheSize = 10000000UL,
+ size_t nMaxObjDisplayCacheSize = 2400000UL );
+ ~GraphicCache();
public:
+ void AddGraphicObject( const GraphicObject* pObj,
+ Graphic& rSubstitute,
+ const OString* pID,
+ const GraphicObject* pCopyObj );
- void AddGraphicObject(
- const GraphicObject& rObj,
- Graphic& rSubstitute,
- const OString* pID,
- const GraphicObject* pCopyObj
- );
-
- void ReleaseGraphicObject( const GraphicObject& rObj );
+ void ReleaseGraphicObject( const GraphicObject* pObj );
- void GraphicObjectWasSwappedOut( const GraphicObject& rObj );
- sal_Bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute );
- void GraphicObjectWasSwappedIn( const GraphicObject& rObj );
+ void GraphicObjectWasSwappedOut( const rtl::Reference<GraphicObject>& rObj );
+ bool FillSwappedGraphicObject( const rtl::Reference<GraphicObject>& rObj, Graphic& rSubstitute );
+ void GraphicObjectWasSwappedIn( const rtl::Reference<GraphicObject>& rObj );
- OString GetUniqueID( const GraphicObject& rObj ) const;
+ OString GetUniqueID( const rtl::Reference<GraphicObject>& rObj ) const;
+ OString GetUniqueID( const GraphicObject* pObj ) const;
public:
- void SetMaxDisplayCacheSize( sal_uLong nNewCacheSize );
- sal_uLong GetMaxDisplayCacheSize() const { return mnMaxDisplaySize; };
-
- void SetMaxObjDisplayCacheSize(
- sal_uLong nNewMaxObjSize,
- sal_Bool bDestroyGreaterCached = sal_False
- );
-
- sal_uLong GetMaxObjDisplayCacheSize() const { return mnMaxObjDisplaySize; }
-
- sal_uLong GetUsedDisplayCacheSize() const { return mnUsedDisplaySize; }
- sal_uLong GetFreeDisplayCacheSize() const { return( mnMaxDisplaySize - mnUsedDisplaySize ); }
-
- void SetCacheTimeout( sal_uLong nTimeoutSeconds );
- sal_uLong GetCacheTimeout() const { return mnReleaseTimeoutSeconds; }
-
- sal_Bool IsDisplayCacheable(
- OutputDevice* pOut,
- const Point& rPt,
- const Size& rSz,
- const GraphicObject& rObj,
- const GraphicAttr& rAttr
- ) const;
-
- sal_Bool IsInDisplayCache(
- OutputDevice* pOut,
- const Point& rPt,
- const Size& rSz,
- const GraphicObject& rObj,
- const GraphicAttr& rAttr
- ) const;
-
- sal_Bool CreateDisplayCacheObj(
- OutputDevice* pOut,
- const Point& rPt,
- const Size& rSz,
- const GraphicObject& rObj,
- const GraphicAttr& rAttr,
- const BitmapEx& rBmpEx
- );
-
- sal_Bool CreateDisplayCacheObj(
- OutputDevice* pOut,
- const Point& rPt,
- const Size& rSz,
- const GraphicObject& rObj,
- const GraphicAttr& rAttr,
- const GDIMetaFile& rMtf
- );
-
- sal_Bool DrawDisplayCacheObj(
- OutputDevice* pOut,
- const Point& rPt,
- const Size& rSz,
- const GraphicObject& rObj,
- const GraphicAttr& rAttr
- );
+ void SetMaxDisplayCacheSize( sal_uLong nNewCacheSize );
+ size_t GetMaxDisplayCacheSize() const { return mnMaxDisplaySize; };
+
+ void SetMaxObjDisplayCacheSize( size_t nNewMaxObjSize,
+ bool bDestroyGreaterCached = false );
+
+ size_t GetMaxObjDisplayCacheSize() const { return mnMaxObjDisplaySize; }
+
+ size_t GetUsedDisplayCacheSize() const { return mnUsedDisplaySize; }
+ size_t GetFreeDisplayCacheSize() const { return( mnMaxDisplaySize - mnUsedDisplaySize ); }
+
+ void SetCacheTimeout( int nTimeoutSeconds );
+ int GetCacheTimeout() const { return mnReleaseTimeoutSeconds; }
+
+ bool IsDisplayCacheable( OutputDevice* pOut,
+ const Point& rPoint,
+ const Size& rSize,
+ const rtl::Reference<GraphicObject>& rObj,
+ const GraphicAttr& rAttr ) const;
+
+ bool IsInDisplayCache( OutputDevice* pOut,
+ const Point& rPoint,
+ const Size& rSize,
+ const rtl::Reference<GraphicObject>& rObj,
+ const GraphicAttr& rAttr ) const;
+ bool IsInDisplayCache( OutputDevice* pOut,
+ const Point& rPoint,
+ const Size& rSize,
+ const GraphicObject* pObj,
+ const GraphicAttr& rAttr ) const;
+
+ bool CreateDisplayCacheObj( OutputDevice* pOut,
+ const Point& rPoint,
+ const Size& rSize,
+ const rtl::Reference<GraphicObject>& rObj,
+ const GraphicAttr& rAttr,
+ const BitmapEx& rBmpEx );
+
+ bool CreateDisplayCacheObj( OutputDevice* pOut,
+ const Point& rPoint,
+ const Size& rSize,
+ const rtl::Reference<GraphicObject>& rObj,
+ const GraphicAttr& rAttr,
+ const GDIMetaFile& rMtf );
+
+ bool DrawDisplayCacheObj( OutputDevice* pOut,
+ const Point& rPoint,
+ const Size& rSize,
+ const GraphicObject* pObj,
+ const GraphicAttr& rAttr );
};
#endif // _GRFCACHE_HXX
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 3af1e89c170c..6512f27b9210 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -154,11 +154,11 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadGraphicObject( co
String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) );
OString aUniqueID(OUStringToOString(aTmpStr,
RTL_TEXTENCODING_UTF8));
- GraphicObject aGrafObj(aUniqueID);
+ rtl::Reference<GraphicObject> aGrafObj = GraphicObject::Create(aUniqueID);
// I don't call aGrafObj.GetXGraphic because it will call us back
// into implLoadMemory ( with "private:memorygraphic" test )
::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
- pUnoGraphic->init( aGrafObj.GetGraphic() );
+ pUnoGraphic->init( aGrafObj->GetGraphic() );
xRet = pUnoGraphic;
}
return xRet;
diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx
index c46d3937f73e..0d8afdc247c3 100644
--- a/svtools/source/graphic/renderer.cxx
+++ b/svtools/source/graphic/renderer.cxx
@@ -320,8 +320,8 @@ void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphi
if( pGraphic )
{
- GraphicObject aGraphicObject( *pGraphic );
- aGraphicObject.Draw( mpOutDev, maDestRect.TopLeft(), maDestRect.GetSize() );
+ rtl::Reference<GraphicObject> rGraphicObject = GraphicObject::Create( *pGraphic );
+ rGraphicObject->Draw( mpOutDev, maDestRect.TopLeft(), maDestRect.GetSize() );
}
}
}
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
index 37e6ba56402b..89e9e0f763e5 100644
--- a/svtools/source/svhtml/htmlout.cxx
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -393,7 +393,7 @@ static const sal_Char *lcl_svhtml_GetEntityForChar( sal_Unicode c,
static OString lcl_ConvertCharToHTML( sal_Unicode c,
HTMLOutContext& rContext,
- String *pNonConvertableChars )
+ OUString* pNonConvertableChars )
{
OStringBuffer aDest;
DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW != rContext.m_eDestEnc,
@@ -471,8 +471,12 @@ static OString lcl_ConvertCharToHTML( sal_Unicode c,
aDest.append('&').append('#').append(static_cast<sal_Int64>(c))
.append(';');
if( pNonConvertableChars &&
- STRING_NOTFOUND == pNonConvertableChars->Search( c ) )
- pNonConvertableChars->Append( c );
+ pNonConvertableChars->indexOf( c ) < 0 )
+ {
+ OUString sTmp(*pNonConvertableChars);
+ sTmp += OUString(c);
+ *pNonConvertableChars = sTmp;
+ }
}
}
return aDest.makeStringAndClear();
@@ -502,14 +506,14 @@ static OString lcl_FlushToAscii( HTMLOutContext& rContext )
return aDest.makeStringAndClear();
}
-OString HTMLOutFuncs::ConvertStringToHTML( const String& rSrc,
- rtl_TextEncoding eDestEnc, String *pNonConvertableChars )
+OString HTMLOutFuncs::ConvertStringToHTML( const OUString& rSrc,
+ rtl_TextEncoding eDestEnc, OUString* pNonConvertableChars )
{
HTMLOutContext aContext( eDestEnc );
OStringBuffer aDest;
- for( sal_uInt32 i=0UL, nLen = rSrc.Len(); i < nLen; i++ )
+ for( sal_uInt32 i=0UL, nLen = rSrc.getLength(); i < nLen; i++ )
aDest.append(lcl_ConvertCharToHTML(
- rSrc.GetChar( (xub_StrLen)i ), aContext, pNonConvertableChars));
+ rSrc[ i ], aContext, pNonConvertableChars));
aDest.append(lcl_FlushToAscii(aContext));
return aDest.makeStringAndClear();
}
@@ -525,7 +529,7 @@ SvStream& HTMLOutFuncs::Out_AsciiTag( SvStream& rStream, const sal_Char *pStr,
SvStream& HTMLOutFuncs::Out_Char( SvStream& rStream, sal_Unicode c,
HTMLOutContext& rContext,
- String *pNonConvertableChars )
+ OUString* pNonConvertableChars )
{
OString sOut = lcl_ConvertCharToHTML( c, rContext, pNonConvertableChars );
rStream << sOut.getStr();
@@ -534,7 +538,7 @@ SvStream& HTMLOutFuncs::Out_Char( SvStream& rStream, sal_Unicode c,
SvStream& HTMLOutFuncs::Out_String( SvStream& rStream, const OUString& rOUStr,
rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars )
+ OUString* pNonConvertableChars )
{
HTMLOutContext aContext( eDestEnc );
sal_Int32 nLen = rOUStr.getLength();
@@ -598,25 +602,26 @@ SvStream& HTMLOutFuncs::Out_Color( SvStream& rStream, const Color& rColor,
}
SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
- const String& rBaseURL,
+ const OUString& rBaseURL,
const ImageMap& rIMap,
- const String& rName,
+ const OUString& rName,
const HTMLOutEvent *pEventTable,
sal_Bool bOutStarBasic,
const sal_Char *pDelim,
const sal_Char *pIndentArea,
const sal_Char *pIndentMap,
rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars )
+ OUString* pNonConvertableChars )
{
if( RTL_TEXTENCODING_DONTKNOW == eDestEnc )
eDestEnc = osl_getThreadTextEncoding();
- const String& rOutName = rName.Len() ? rName : rIMap.GetName();
- DBG_ASSERT( rOutName.Len(), "Kein ImageMap-Name" );
- if( !rOutName.Len() )
+ const OUString& rOutName = !rName.isEmpty() ? rName : OUString(rIMap.GetName());
+ DBG_ASSERT( !rOutName.isEmpty(), "Kein ImageMap-Name" );
+ if( rOutName.isEmpty() )
+ {
return rStream;
-
+ }
OStringBuffer sOut;
sOut.append('<')
.append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_map))
@@ -781,15 +786,15 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
}
SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm,
- const String& rBaseURL,
- const String& rSource,
- const String& rLanguage,
+ const OUString& rBaseURL,
+ const OUString& rSource,
+ const OUString& rLanguage,
ScriptType eScriptType,
- const String& rSrc,
- const String *pSBLibrary,
- const String *pSBModule,
+ const OUString& rSrc,
+ const OUString *pSBLibrary,
+ const OUString *pSBModule,
rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars )
+ OUString* pNonConvertableChars )
{
if( RTL_TEXTENCODING_DONTKNOW == eDestEnc )
eDestEnc = osl_getThreadTextEncoding();
@@ -799,7 +804,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm,
sOut.append('<')
.append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_script));
- if( rLanguage.Len() )
+ if( !rLanguage.isEmpty() )
{
sOut.append(' ')
.append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_language))
@@ -809,7 +814,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm,
sOut.append('\"');
}
- if( rSrc.Len() )
+ if( !rSrc.isEmpty() )
{
sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_src).append("=\"");
rStrm << sOut.makeStringAndClear().getStr();
@@ -839,7 +844,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm,
rStrm << sOut.makeStringAndClear().getStr();
- if( rSource.Len() || pSBLibrary || pSBModule )
+ if( !rSource.isEmpty() || pSBLibrary || pSBModule )
{
rStrm << sNewLine;
@@ -870,7 +875,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm,
}
}
- if( rSource.Len() )
+ if( !rSource.isEmpty() )
{
// Wir schreiben das Modul mm ANSI-Zeichensatz, aber mit
// System-Zeilenumbruechen raus.
@@ -900,7 +905,7 @@ SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm,
const HTMLOutEvent *pEventTable,
sal_Bool bOutStarBasic,
rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars )
+ OUString* pNonConvertableChars )
{
sal_uInt16 i=0;
while( pEventTable[i].pBasicName || pEventTable[i].pJavaName )
@@ -933,7 +938,7 @@ SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm,
OString HTMLOutFuncs::CreateTableDataOptionsValNum(
sal_Bool bValue,
double fVal, sal_uLong nFormat, SvNumberFormatter& rFormatter,
- rtl_TextEncoding eDestEnc, String* pNonConvertableChars)
+ rtl_TextEncoding eDestEnc, OUString* pNonConvertableChars)
{
OStringBuffer aStrTD;
diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
index f347bf204ddb..3ae7a57633ac 100644
--- a/svx/inc/galbrws2.hxx
+++ b/svx/inc/galbrws2.hxx
@@ -147,14 +147,14 @@ private:
public:
- static String GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags );
+ static OUString GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags );
public:
GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery );
~GalleryBrowser2();
- void SelectTheme( const String& rThemeName );
+ void SelectTheme( const OUString& rThemeName );
GalleryBrowserMode GetMode() const { return meMode; }
void SetMode( GalleryBrowserMode eMode );
@@ -164,7 +164,7 @@ public:
void Travel( GalleryBrowserTravel eTravel );
INetURLObject GetURL() const;
- String GetFilterName() const;
+ OUString GetFilterName() const;
Graphic GetGraphic() const;
sal_Int8 AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt );
diff --git a/svx/inc/galobj.hxx b/svx/inc/galobj.hxx
index 8712b718cd54..cacf7be3e47d 100644
--- a/svx/inc/galobj.hxx
+++ b/svx/inc/galobj.hxx
@@ -60,12 +60,12 @@ protected:
BitmapEx aThumbBmp; // Allow transparence to survive
GDIMetaFile aThumbMtf;
INetURLObject aURL;
- String aUserName;
- String aTitle;
+ OUString aUserName;
+ OUString aTitle;
sal_Bool bIsValid;
sal_Bool bIsThumbBmp;
- virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
+ virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const;
virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
sal_Bool CreateThumb( const Graphic& rGraphic );
@@ -83,8 +83,8 @@ public:
sal_Bool IsValid() const { return bIsValid; }
sal_Bool IsThumbBitmap() const { return bIsThumbBmp; }
- const String GetTitle() const;
- void SetTitle( const String& rTitle );
+ const OUString GetTitle() const;
+ void SetTitle( const OUString& rTitle );
friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj );
friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj );
@@ -98,7 +98,7 @@ private:
GalSoundType eSoundType;
- virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
+ virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const;
virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
virtual sal_uInt16 GetVersion() const { return 6; }
@@ -124,7 +124,7 @@ private:
sal_Bool CreateThumb( const FmFormModel& rModel );
- virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
+ virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const;
virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
virtual sal_uInt16 GetVersion() const { return 5; }
@@ -145,7 +145,7 @@ private:
void Init( const Graphic& rGraphic, const INetURLObject& rURL );
- virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
+ virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const;
virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
virtual sal_uInt16 GetVersion() const { return 5; }
@@ -154,7 +154,7 @@ public:
SgaObjectBmp();
SgaObjectBmp( const INetURLObject& rURL );
- SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormat );
+ SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormat );
virtual ~SgaObjectBmp() {};
virtual SgaObjKind GetObjKind() const { return SGA_OBJ_BMP; }
@@ -169,7 +169,7 @@ private:
public:
SgaObjectAnim();
- SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
+ SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormatName );
virtual ~SgaObjectAnim() {};
@@ -185,7 +185,7 @@ private:
public:
SgaObjectINet();
- SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
+ SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormatName );
virtual ~SgaObjectINet() {};
diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index bcc79e91a9cc..32b2f7e1b3cd 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -77,11 +77,11 @@ 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>& rGraphicObject )
{
//Get the graphic from the GraphicObject
- m_pGraphicObject = pGraphicObject;
- const Graphic aGraphic = pGraphicObject->GetGraphic();
+ m_rGraphicObject = rGraphicObject;
+ const Graphic aGraphic = rGraphicObject->GetGraphic();
//get the Preferred File Extension for this graphic
OUString fExtension;
@@ -102,15 +102,15 @@ void ExternalToolEdit::Edit( GraphicObject* pGraphicObject )
GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
sal_uInt16 nFilter(rGraphicFilter.GetExportFormatNumber(fExtension));
- String aFilter(rGraphicFilter.GetExportFormatShortName(nFilter));
- String sPath(aTempFileName);
+ OUString aFilter(rGraphicFilter.GetExportFormatShortName(nFilter));
+ OUString sPath(aTempFileName);
// Write the Graphic to the file now
XOutBitmap::WriteGraphic(aGraphic, sPath, aFilter, XOUTBMP_USE_NATIVE_IF_POSSIBLE | XOUTBMP_DONT_EXPAND_FILENAME);
// There is a possiblity that sPath extnesion might have been changed if the
// provided extension is not writable
- m_aFileName = OUString(sPath);
+ m_aFileName = sPath;
//Create a thread
diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index 571fcbebba5f..4b7c38aae520 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -185,11 +185,9 @@ OUString GraphicHelper::ExportGraphic( const Graphic& rGraphic, const OUString&
{
nFilter = GRFILTER_FORMAT_DONTKNOW;
}
- OUString aFilter( rGraphicFilter.GetExportFormatShortName( nFilter ) );
+ OUString sFilter( rGraphicFilter.GetExportFormatShortName( nFilter ) );
- String aFilterString( aFilter );
- String aPathString( sPath );
- XOutBitmap::WriteGraphic( rGraphic, aPathString, aFilterString,
+ XOutBitmap::WriteGraphic( rGraphic, sPath, sFilter,
XOUTBMP_DONT_EXPAND_FILENAME |
XOUTBMP_DONT_ADD_EXTENSION |
XOUTBMP_USE_NATIVE_IF_POSSIBLE );
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index c6bc3971ec7f..6961c5d34120 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2191,13 +2191,13 @@ void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rC
{
if ( nColorCount || rObj.GetBrightness() != 1.0 )
{
- Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap());
+ Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetGraphicObject()->GetGraphic().GetBitmapEx().GetBitmap());
aBitmap.Adjust(
static_cast< short > ( GetLuminanceChange(
std::min(nColorIndex, nColorCount-1))));
- rObj.SetMergedItem(XFillBitmapItem(String(), Graphic(aBitmap)));
+ rObj.SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(aBitmap)));
}
break;
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 010b037e7df5..ca10436985ee 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -495,7 +495,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
if ( bFillBmpTile )
{
const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
- aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
+ aFillBmp = rBmpItm.GetGraphicObject()->GetGraphic().GetBitmapEx();
Size aLogicalSize = aFillBmp.GetPrefSize();
if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL )
aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM );
@@ -505,14 +505,14 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
aLogicalSize.Height() *= 5;
aFillBmp.SetPrefSize( aLogicalSize );
aFillBmp.SetPrefMapMode( MAP_100TH_MM );
- p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
+ p3DObj->SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aFillBmp))));
}
else
{
if ( aSnapRect != aBoundRect )
{
const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
- aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
+ aFillBmp = rBmpItm.GetGraphicObject()->GetGraphic().GetBitmapEx();
Size aBmpSize( aFillBmp.GetSizePixel() );
double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth();
double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight();
@@ -523,7 +523,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
(sal_Int32)( aBmpSize.Height() * fYScale ) );
Rectangle aCropRect( aPt, aSize );
aFillBmp.Crop( aCropRect );
- p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
+ p3DObj->SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aFillBmp))));
}
}
pScene->Insert3DObj( p3DObj );
@@ -546,7 +546,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con
if ( ( aLocalFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
{
- p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
+ p3DObj->SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(Graphic(aFillBmp))));
}
}
else if ( aLocalFillStyle == XFILL_NONE )
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index efc480ad4d1c..5320d685f0a6 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -41,7 +41,7 @@ using namespace com::sun::star::beans;
CompressGraphicsDialog::CompressGraphicsDialog( Window* pParent, SdrGrafObj* pGraphicObj, SfxBindings& rBindings ) :
ModalDialog ( pParent, "CompressGraphicDialog", "svx/ui/compressgraphicdialog.ui" ),
m_pGraphicObj ( pGraphicObj ),
- m_aGraphic ( pGraphicObj->GetGraphicObject().GetGraphic() ),
+ m_aGraphic ( pGraphicObj->GetGraphicObject()->GetGraphic() ),
m_aViewSize100mm ( pGraphicObj->GetLogicRect().GetSize() ),
m_rBindings ( rBindings ),
m_dResolution ( 96.0 )
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 76ba1b741635..2a5ab7eeddd7 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1366,7 +1366,7 @@ void BitmapLB::Fill( const XBitmapListRef &pList )
for(long i(0); i < nCount; i++)
{
pEntry = pList->GetBitmap(i);
- maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
+ maBitmapEx = pEntry->GetGraphicObject()->GetGraphic().GetBitmapEx();
formatBitmapExToSize(maBitmapEx, aSize);
InsertEntry(pEntry->GetName(), maBitmapEx);
}
@@ -1379,7 +1379,7 @@ void BitmapLB::Fill( const XBitmapListRef &pList )
void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry)
{
- maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx();
+ maBitmapEx = rEntry.GetGraphicObject()->GetGraphic().GetBitmapEx();
if(!maBitmapEx.IsEmpty())
{
@@ -1399,7 +1399,7 @@ void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry)
void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos)
{
RemoveEntry(nPos);
- maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx();
+ maBitmapEx = rEntry.GetGraphicObject()->GetGraphic().GetBitmapEx();
if(!maBitmapEx.IsEmpty())
{
@@ -1431,7 +1431,7 @@ void FillAttrLB::Fill( const XBitmapListRef &pList )
for(long i(0); i < nCount; i++)
{
pEntry = pList->GetBitmap( i );
- maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
+ maBitmapEx = pEntry->GetGraphicObject()->GetGraphic().GetBitmapEx();
formatBitmapExToSize(maBitmapEx, aSize);
ListBox::InsertEntry(pEntry->GetName(), maBitmapEx);
}
diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx
index 74ad3d111547..d06911db8344 100644
--- a/svx/source/dialog/grfflt.cxx
+++ b/svx/source/dialog/grfflt.cxx
@@ -33,9 +33,9 @@
// - SvxGraphicFilter -
// --------------------
-sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject )
+sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, rtl::Reference<GraphicObject>* pFilterObject )
{
- const Graphic& rGraphic = rFilterObject.GetGraphic();
+ const Graphic& rGraphic = (*pFilterObject)->GetGraphic();
sal_uIntPtr nRet = SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE;
if( rGraphic.GetType() == GRAPHIC_BITMAP )
@@ -273,7 +273,7 @@ sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObj
if( aGraphic.GetType() != GRAPHIC_NONE )
{
- rFilterObject.SetGraphic( aGraphic );
+ *pFilterObject = GraphicObject::Create(*pFilterObject, aGraphic );
nRet = SVX_GRAPHICFILTER_ERRCODE_NONE;
}
}
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index e2d816e3b91f..cbe54b5e485e 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -293,7 +293,7 @@ void GalleryBrowser1::ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec)
// -----------------------------------------------------------------------------
-void GalleryBrowser1::ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew )
+void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew )
{
DBG_ASSERT(!mpThemePropsDlgItemSet, "mpThemePropsDlgItemSet already set!");
mpThemePropsDlgItemSet = new SfxItemSet( SFX_APP()->GetPool() );
@@ -326,19 +326,17 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog
if( nRet == RET_OK )
{
- String aName( mpExchangeData->pTheme->GetName() );
+ OUString aName( mpExchangeData->pTheme->GetName() );
- if( mpExchangeData->aEditedTitle.Len() && aName != mpExchangeData->aEditedTitle )
+ if( !mpExchangeData->aEditedTitle.isEmpty() && aName != mpExchangeData->aEditedTitle )
{
- const String aOldName( aName );
- String aTitle( mpExchangeData->aEditedTitle );
+ const OUString aOldName( aName );
+ OUString aTitle( mpExchangeData->aEditedTitle );
sal_uInt16 nCount = 0;
while( mpGallery->HasTheme( aTitle ) && ( nCount++ < 16000 ) )
{
- aTitle = mpExchangeData->aEditedTitle;
- aTitle += ' ';
- aTitle += OUString::number( nCount );
+ aTitle = mpExchangeData->aEditedTitle + " " + OUString::number( nCount );
}
mpGallery->RenameTheme( aOldName, aTitle );
@@ -351,7 +349,7 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog
}
}
- String aThemeName( mpExchangeData->pTheme->GetName() );
+ OUString aThemeName( mpExchangeData->pTheme->GetName() );
mpGallery->ReleaseTheme( mpExchangeData->pTheme, *this );
if ( bCreateNew && ( nRet != RET_OK ) )
@@ -423,7 +421,7 @@ void GalleryBrowser1::ImplExecute( sal_uInt16 nId )
case( MN_RENAME ):
{
GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
- const String aOldName( pTheme->GetName() );
+ const OUString aOldName( pTheme->GetName() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialogdiet fail!");
@@ -432,18 +430,16 @@ void GalleryBrowser1::ImplExecute( sal_uInt16 nId )
if( aDlg->Execute() == RET_OK )
{
- const String aNewName( aDlg->GetTitle() );
+ const OUString aNewName( aDlg->GetTitle() );
- if( aNewName.Len() && ( aNewName != aOldName ) )
+ if( !aNewName.isEmpty() && ( aNewName != aOldName ) )
{
- String aName( aNewName );
+ OUString aName( aNewName );
sal_uInt16 nCount = 0;
while( mpGallery->HasTheme( aName ) && ( nCount++ < 16000 ) )
{
- aName = aNewName;
- aName += ' ';
- aName += OUString::number( nCount );
+ aName = aNewName + " " + OUString::number( nCount );
}
mpGallery->RenameTheme( aOldName, aName );
@@ -690,15 +686,13 @@ IMPL_LINK_NOARG(GalleryBrowser1, SelectThemeHdl)
IMPL_LINK_NOARG(GalleryBrowser1, ClickNewThemeHdl)
{
- String aNewTheme( GAL_RESSTR(RID_SVXSTR_GALLERY_NEWTHEME) );
- String aName( aNewTheme );
+ OUString aNewTheme( GAL_RESSTR(RID_SVXSTR_GALLERY_NEWTHEME) );
+ OUString aName( aNewTheme );
sal_uIntPtr nCount = 0;
while( mpGallery->HasTheme( aName ) && ( nCount++ < 16000 ) )
{
- aName = aNewTheme;
- aName += ' ';
- aName += OUString::number( nCount );
+ aName = aNewTheme + " " + OUString::number( nCount );
}
if( !mpGallery->HasTheme( aName ) && mpGallery->CreateTheme( aName ) )
diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx
index 8c667c1f8026..3bc0126026b3 100644
--- a/svx/source/gallery2/galbrws1.hxx
+++ b/svx/source/gallery2/galbrws1.hxx
@@ -103,7 +103,7 @@ private:
void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
void ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec);
void ImplExecute( sal_uInt16 nId );
- void ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew );
+ void ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew );
void ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog, bool bCreateNew );
// Control
@@ -131,9 +131,9 @@ public:
const ::boost::function<void(void)>& rThemeSlectionHandler);
~GalleryBrowser1();
- void SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); }
+ void SelectTheme( const OUString& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); }
void SelectTheme( sal_uIntPtr nThemePos ) { mpThemes->SelectEntryPos( (sal_uInt16) nThemePos ); SelectThemeHdl( NULL ); }
- String GetSelectedTheme() { return mpThemes->GetEntryCount() ? mpThemes->GetEntry( mpThemes->GetSelectEntryPos() ) : String(); }
+ OUString GetSelectedTheme() { return mpThemes->GetEntryCount() ? OUString(mpThemes->GetEntry( mpThemes->GetSelectEntryPos() )) : OUString(); }
void ShowContextMenu();
sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow );
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 7ac642535826..9730c90fbce1 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -62,9 +62,6 @@
#define TBX_ID_ICON 1
#define TBX_ID_LIST 2
-namespace css = ::com::sun::star;
-using rtl::OUString;
-
GalleryBrowserMode GalleryBrowser2::meInitMode = GALLERYBROWSERMODE_ICON;
struct DispatchInfo
@@ -750,7 +747,7 @@ sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow )
return bRet;
}
-void GalleryBrowser2::SelectTheme( const String& rThemeName )
+void GalleryBrowser2::SelectTheme( const OUString& rThemeName )
{
delete mpIconView, mpIconView = NULL;
delete mpListView, mpListView = NULL;
@@ -972,7 +969,7 @@ void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId )
void GalleryBrowser2::ImplUpdateInfoBar()
{
- String aInfoText;
+ OUString aInfoText;
if( mpCurTheme )
{
@@ -1211,7 +1208,7 @@ void GalleryBrowser2::Execute( sal_uInt16 nId )
if( pObj )
{
- const String aOldTitle( GetItemText( *mpCurTheme, *pObj, GALLERY_ITEM_TITLE ) );
+ const OUString aOldTitle( GetItemText( *mpCurTheme, *pObj, GALLERY_ITEM_TITLE ) );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if(pFact)
@@ -1220,13 +1217,14 @@ void GalleryBrowser2::Execute( sal_uInt16 nId )
DBG_ASSERT(aDlg, "Dialogdiet fail!");
if( aDlg->Execute() == RET_OK )
{
- String aNewTitle( aDlg->GetTitle() );
+ OUString aNewTitle( aDlg->GetTitle() );
- if( ( !aNewTitle.Len() && pObj->GetTitle().Len() ) || ( aNewTitle != aOldTitle ) )
+ if( ( aNewTitle.isEmpty() && !pObj->GetTitle().isEmpty() ) || ( aNewTitle != aOldTitle ) )
{
- if( !aNewTitle.Len() )
- aNewTitle = String( RTL_CONSTASCII_USTRINGPARAM( "__<empty>__" ) );
-
+ if( aNewTitle.isEmpty() )
+ {
+ aNewTitle = OUString( "__<empty>__" );
+ }
pObj->SetTitle( aNewTitle );
mpCurTheme->InsertObject( *pObj );
}
@@ -1274,29 +1272,29 @@ void GalleryBrowser2::Execute( sal_uInt16 nId )
}
}
-String GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags )
+OUString GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags )
{
- String aRet;
+ OUString aRet;
INetURLObject aURL(rObj.GetURL());
if( nItemTextFlags & GALLERY_ITEM_THEMENAME )
{
aRet += rTheme.GetName();
- aRet += String( RTL_CONSTASCII_USTRINGPARAM( " - " ) );
+ aRet += " - ";
}
if( nItemTextFlags & GALLERY_ITEM_TITLE )
{
- String aTitle( rObj.GetTitle() );
+ OUString aTitle( rObj.GetTitle() );
- if( !aTitle.Len() )
+ if( aTitle.isEmpty() )
+ {
aTitle = aURL.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_UNAMBIGUOUS );
-
- if( !aTitle.Len() )
+ }
+ if( aTitle.isEmpty() )
{
- aTitle = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
- aTitle = aTitle.GetToken( comphelper::string::getTokenCount(aTitle, '/') - 1, '/' );
+ aTitle = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ).getToken( comphelper::string::getTokenCount(aTitle, '/') - 1, '/' );
}
aRet += aTitle;
@@ -1304,15 +1302,18 @@ String GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject
if( nItemTextFlags & GALLERY_ITEM_PATH )
{
- const String aPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) );
+ const OUString aPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) );
- if( aPath.Len() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) )
- aRet += String( RTL_CONSTASCII_USTRINGPARAM( " (" ) );
-
- aRet += String(aURL.getFSysPath( INetURLObject::FSYS_DETECT ));
+ if( !aPath.isEmpty() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) )
+ {
+ aRet += " (" ;
+ }
+ aRet += aURL.getFSysPath( INetURLObject::FSYS_DETECT );
- if( aPath.Len() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) )
- aRet += ')';
+ if( !aPath.isEmpty() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) )
+ {
+ aRet += ")";
+ }
}
return aRet;
@@ -1328,9 +1329,9 @@ INetURLObject GalleryBrowser2::GetURL() const
return aURL;
}
-String GalleryBrowser2::GetFilterName() const
+OUString GalleryBrowser2::GetFilterName() const
{
- String aFilterName;
+ OUString aFilterName;
if( mpCurTheme && mnCurActionPos != 0xffffffff )
{
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index a96a34e02661..26e799161a0f 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -142,15 +142,19 @@ void GalleryPreview::Paint( const Rectangle& rRect )
{
Window::Paint( rRect );
- if( ImplGetGraphicCenterRect( aGraphicObj.GetGraphic(), aPreviewRect ) )
+ if( ImplGetGraphicCenterRect( m_rGraphicObj->GetGraphic(), aPreviewRect ) )
{
const Point aPos( aPreviewRect.TopLeft() );
const Size aSize( aPreviewRect.GetSize() );
- if( aGraphicObj.IsAnimated() )
- aGraphicObj.StartAnimation( this, aPos, aSize );
+ if( m_rGraphicObj->IsAnimated() )
+ {
+ m_rGraphicObj->StartAnimation( this, aPos, aSize );
+ }
else
- aGraphicObj.Draw( this, aPos, aSize );
+ {
+ m_rGraphicObj->Draw( this, aPos, aSize );
+ }
}
}
@@ -329,14 +333,14 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt )
const Size aSize(rRect.GetWidth(), rRect.GetHeight());
BitmapEx aBitmapEx;
Size aPreparedSize;
- String aItemTextTitle;
- String aItemTextPath;
+ OUString aItemTextTitle;
+ OUString aItemTextPath;
mpTheme->GetPreviewBitmapExAndStrings(nId - 1, aBitmapEx, aPreparedSize, aItemTextTitle, aItemTextPath);
bool bNeedToCreate(aBitmapEx.IsEmpty());
- if(!bNeedToCreate && !aItemTextTitle.Len())
+ if(!bNeedToCreate && aItemTextTitle.isEmpty())
{
bNeedToCreate = true;
}
@@ -629,19 +633,19 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa
const Size aSize(rRect.GetHeight(), rRect.GetHeight());
BitmapEx aBitmapEx;
Size aPreparedSize;
- String aItemTextTitle;
- String aItemTextPath;
+ OUString aItemTextTitle;
+ OUString aItemTextPath;
mpTheme->GetPreviewBitmapExAndStrings(mnCurRow, aBitmapEx, aPreparedSize, aItemTextTitle, aItemTextPath);
bool bNeedToCreate(aBitmapEx.IsEmpty());
- if(!bNeedToCreate && GALLERY_BRWBOX_TITLE == nColumnId && !aItemTextTitle.Len())
+ if(!bNeedToCreate && GALLERY_BRWBOX_TITLE == nColumnId && aItemTextTitle.isEmpty())
{
bNeedToCreate = true;
}
- if(!bNeedToCreate && GALLERY_BRWBOX_PATH == nColumnId && !aItemTextPath.Len())
+ if(!bNeedToCreate && GALLERY_BRWBOX_PATH == nColumnId && aItemTextPath.isEmpty())
{
bNeedToCreate = true;
}
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index 692a67027002..d2210060f203 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -102,7 +102,7 @@ IMPL_LINK( SgaUserDataFactory, MakeUserData, SdrObjFactory*, pObjFactory )
// ------------------------
sal_uInt16 GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic,
- String& rFilterName, sal_Bool bShowProgress )
+ OUString& rFilterName, sal_Bool bShowProgress )
{
sal_uInt16 nRet = SGA_IMPORT_NONE;
SfxMedium aMedium( rURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
@@ -217,27 +217,26 @@ sal_Bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageM
// - GetReducedString -
// --------------------
-String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen )
+OUString GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen )
{
- String aReduced( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) );
+ OUString aReduced( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) );
- aReduced = aReduced.GetToken( comphelper::string::getTokenCount(aReduced, '/') - 1, '/' );
+ aReduced = aReduced.getToken( comphelper::string::getTokenCount(aReduced, '/') - 1, '/' );
if( INET_PROT_PRIV_SOFFICE != rURL.GetProtocol() )
{
sal_Unicode aDelimiter;
- const String aPath( rURL.getFSysPath( INetURLObject::FSYS_DETECT, &aDelimiter ) );
- const String aName( aReduced );
+ const OUString aPath( rURL.getFSysPath( INetURLObject::FSYS_DETECT, &aDelimiter ) );
+ const OUString aName( aReduced );
- if( aPath.Len() > nMaxLen )
+ if( aPath.getLength() > (sal_Int32)nMaxLen )
{
- aReduced = aPath.Copy( 0, (sal_uInt16)( nMaxLen - aName.Len() - 4 ) );
- aReduced += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
- aReduced += aDelimiter;
- aReduced += aName;
+ aReduced = aPath.copy( 0, ( nMaxLen - aName.getLength() - 4 ) ) + OUString("...") + OUString(aDelimiter) + aName;
}
else
+ {
aReduced = aPath;
+ }
}
return aReduced;
@@ -245,14 +244,14 @@ String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen )
// -----------------------------------------------------------------------------
-String GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL )
+OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL )
{
- String aRet;
+ OUString aRet;
if( rSvDrawObjURL.GetProtocol() == INET_PROT_PRIV_SOFFICE &&
comphelper::string::getTokenCount(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE ), '/') == 3 )
{
- aRet = String(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE )).GetToken( 2, '/' );
+ aRet = rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE ).getToken( 2, '/' );
}
return aRet;
@@ -405,19 +404,19 @@ GalleryProgress::GalleryProgress( GraphicFilter* pFilter ) :
if( mxProgressBar.is() )
{
- String aProgressText;
+ OUString aProgressText;
if( mpFilter )
{
- aProgressText = GAL_RESSTR(RID_SVXSTR_GALLERY_FILTER);
+ aProgressText = OUString(GAL_RESSTR(RID_SVXSTR_GALLERY_FILTER));
// mpFilter->SetUpdatePercentHdl( LINK( this, GalleryProgress, Update ) ); // sj: progress wasn't working up from SO7 at all
// // so I am removing this. The gallery progress should
// // be changed to use the XStatusIndicator instead of XProgressMonitor
}
else
- aProgressText = String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) );
+ aProgressText = "Gallery";
- xMonitor->addText( String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ), aProgressText, sal_False ) ;
+ xMonitor->addText( OUString( "Gallery" ), aProgressText, sal_False ) ;
mxProgressBar->setRange( 0, GALLERY_PROGRESS_RANGE );
}
}
@@ -447,7 +446,7 @@ GalleryTransferable::GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObj
mpTheme( pTheme ),
meObjectKind( mpTheme->GetObjectKind( nObjectPos ) ),
mnObjectPos( nObjectPos ),
- mpGraphicObject( NULL ),
+ m_rGraphicObject( NULL ),
mpImageMap( NULL ),
mpURL( NULL )
{
@@ -473,17 +472,19 @@ void GalleryTransferable::InitData( bool bLazy )
{
if( !bLazy )
{
- if( !mpGraphicObject )
+ if( !m_rGraphicObject.is() )
{
Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
- mpGraphicObject = new GraphicObject( aGraphic );
+ {
+ m_rGraphicObject = GraphicObject::Create( aGraphic );
+ }
}
if( !mxModelStream.Is() )
{
- mxModelStream = new SotStorageStream( String() );
+ mxModelStream = new SotStorageStream( OUString() );
mxModelStream->SetBufferSize( 16348 );
if( !mpTheme->GetModelStream( mnObjectPos, mxModelStream ) )
@@ -508,12 +509,14 @@ void GalleryTransferable::InitData( bool bLazy )
delete mpURL, mpURL = NULL;
}
- if( ( SGA_OBJ_SOUND != meObjectKind ) && !mpGraphicObject )
+ if( ( SGA_OBJ_SOUND != meObjectKind ) && !m_rGraphicObject.is() )
{
Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
- mpGraphicObject = new GraphicObject( aGraphic );
+ {
+ m_rGraphicObject = GraphicObject::Create( aGraphic );
+ }
}
}
break;
@@ -540,11 +543,11 @@ void GalleryTransferable::AddSupportedFormats()
if( mpURL )
AddFormat( FORMAT_FILE );
- if( mpGraphicObject )
+ if( m_rGraphicObject.is() )
{
AddFormat( SOT_FORMATSTR_ID_SVXB );
- if( mpGraphicObject->GetType() == GRAPHIC_GDIMETAFILE )
+ if( m_rGraphicObject->GetType() == GRAPHIC_GDIMETAFILE )
{
AddFormat( FORMAT_GDIMETAFILE );
AddFormat( FORMAT_BITMAP );
@@ -580,17 +583,17 @@ sal_Bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor )
{
bRet = SetString( mpURL->GetMainURL( INetURLObject::NO_DECODE ), rFlavor );
}
- else if( ( SOT_FORMATSTR_ID_SVXB == nFormat ) && mpGraphicObject )
+ else if( ( SOT_FORMATSTR_ID_SVXB == nFormat ) && m_rGraphicObject.is() )
{
- bRet = SetGraphic( mpGraphicObject->GetGraphic(), rFlavor );
+ bRet = SetGraphic( m_rGraphicObject->GetGraphic(), rFlavor );
}
- else if( ( FORMAT_GDIMETAFILE == nFormat ) && mpGraphicObject )
+ else if( ( FORMAT_GDIMETAFILE == nFormat ) && m_rGraphicObject.is() )
{
- bRet = SetGDIMetaFile( mpGraphicObject->GetGraphic().GetGDIMetaFile(), rFlavor );
+ bRet = SetGDIMetaFile( m_rGraphicObject->GetGraphic().GetGDIMetaFile(), rFlavor );
}
- else if( ( FORMAT_BITMAP == nFormat ) && mpGraphicObject )
+ else if( ( FORMAT_BITMAP == nFormat ) && m_rGraphicObject.is() )
{
- bRet = SetBitmapEx( mpGraphicObject->GetGraphic().GetBitmapEx(), rFlavor );
+ bRet = SetBitmapEx( m_rGraphicObject->GetGraphic().GetBitmapEx(), rFlavor );
}
return bRet;
@@ -631,7 +634,7 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction )
void GalleryTransferable::ObjectReleased()
{
mxModelStream.Clear();
- delete mpGraphicObject, mpGraphicObject = NULL;
+ m_rGraphicObject = rtl::Reference<GraphicObject>();
delete mpImageMap, mpImageMap = NULL;
delete mpURL, mpURL = NULL;
}
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index 444c4fe56141..eca6c95e54d2 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -22,11 +22,12 @@
#include <sfx2/objsh.hxx>
#include <sfx2/docfac.hxx>
#include <comphelper/classids.hxx>
-#include <comphelper/string.hxx>
#include <unotools/pathoptions.hxx>
#include <tools/rcid.h>
#include <tools/vcompat.hxx>
#include <tools/helpers.hxx>
+#include <tools/string.hxx>
+#include <comphelper/string.hxx>
#include <vcl/virdev.hxx>
#include <svl/itempool.hxx>
#include <svx/fmmodel.hxx>
@@ -175,7 +176,7 @@ sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic )
// ------------------------------------------------------------------------
-void SgaObject::WriteData( SvStream& rOut, const String& rDestDir ) const
+void SgaObject::WriteData( SvStream& rOut, const OUString& rDestDir ) const
{
static const sal_uInt32 nInventor = COMPAT_FORMAT( 'S', 'G', 'A', '3' );
@@ -198,8 +199,8 @@ void SgaObject::WriteData( SvStream& rOut, const String& rDestDir ) const
else
rOut << aThumbMtf;
- String aURLWithoutDestDir = String(aURL.GetMainURL( INetURLObject::NO_DECODE ));
- aURLWithoutDestDir.SearchAndReplace(rDestDir, String());
+ OUString aURLWithoutDestDir(aURL.GetMainURL( INetURLObject::NO_DECODE ));
+ aURLWithoutDestDir = aURLWithoutDestDir.replaceAll(rDestDir, OUString());
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, aURLWithoutDestDir, RTL_TEXTENCODING_UTF8);
}
@@ -227,18 +228,18 @@ void SgaObject::ReadData(SvStream& rIn, sal_uInt16& rReadVersion )
// ------------------------------------------------------------------------
-const String SgaObject::GetTitle() const
+const OUString SgaObject::GetTitle() const
{
- String aReturnValue( aTitle );
+ OUString aReturnValue( aTitle );
if ( !getenv( "GALLERY_SHOW_PRIVATE_TITLE" ) )
{
if ( comphelper::string::getTokenCount(aReturnValue, ':') == 3 )
{
- String aPrivateInd ( aReturnValue.GetToken( 0, ':' ) );
- String aResourceName( aReturnValue.GetToken( 1, ':' ) );
- sal_Int32 nResId ( aReturnValue.GetToken( 2, ':' ).ToInt32() );
- if ( aPrivateInd.EqualsAscii( "private" ) &&
- aResourceName.Len() && ( nResId > 0 ) && ( nResId < 0x10000 ) )
+ OUString aPrivateInd ( aReturnValue.getToken( 0, ':' ) );
+ OUString aResourceName( aReturnValue.getToken( 1, ':' ) );
+ sal_Int32 nResId ( aReturnValue.getToken( 2, ':' ).toInt32() );
+ if ( aPrivateInd == "private" &&
+ !aResourceName.isEmpty() && ( nResId > 0 ) && ( nResId < 0x10000 ) )
{
OString aMgrName(OUStringToOString(aResourceName, RTL_TEXTENCODING_UTF8));
ResMgr* pResMgr = ResMgr::CreateResMgr( aMgrName.getStr(),
@@ -261,7 +262,7 @@ const String SgaObject::GetTitle() const
// ------------------------------------------------------------------------
-void SgaObject::SetTitle( const String& rTitle )
+void SgaObject::SetTitle( const OUString& rTitle )
{
aTitle = rTitle;
}
@@ -270,7 +271,7 @@ void SgaObject::SetTitle( const String& rTitle )
SvStream& operator<<( SvStream& rOut, const SgaObject& rObj )
{
- rObj.WriteData( rOut, String() );
+ rObj.WriteData( rOut, OUString() );
return rOut;
}
@@ -299,7 +300,7 @@ SgaObjectBmp::SgaObjectBmp()
SgaObjectBmp::SgaObjectBmp( const INetURLObject& rURL )
{
Graphic aGraphic;
- String aFilter;
+ OUString aFilter;
if ( SGA_IMPORT_NONE != GalleryGraphicImport( rURL, aGraphic, aFilter ) )
Init( aGraphic, rURL );
@@ -307,7 +308,7 @@ SgaObjectBmp::SgaObjectBmp( const INetURLObject& rURL )
// ------------------------------------------------------------------------
-SgaObjectBmp::SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& )
+SgaObjectBmp::SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& )
{
if( FileExists( rURL ) )
Init( rGraphic, rURL );
@@ -323,7 +324,7 @@ void SgaObjectBmp::Init( const Graphic& rGraphic, const INetURLObject& rURL )
// ------------------------------------------------------------------------
-void SgaObjectBmp::WriteData( SvStream& rOut, const String& rDestDir ) const
+void SgaObjectBmp::WriteData( SvStream& rOut, const OUString& rDestDir ) const
{
// Version setzen
SgaObject::WriteData( rOut, rDestDir );
@@ -410,7 +411,7 @@ BitmapEx SgaObjectSound::GetThumbBmp() const
// ------------------------------------------------------------------------
-void SgaObjectSound::WriteData( SvStream& rOut, const String& rDestDir ) const
+void SgaObjectSound::WriteData( SvStream& rOut, const OUString& rDestDir ) const
{
SgaObject::WriteData( rOut, rDestDir );
rOut << (sal_uInt16) eSoundType;
@@ -446,7 +447,7 @@ SgaObjectAnim::SgaObjectAnim()
SgaObjectAnim::SgaObjectAnim( const Graphic& rGraphic,
const INetURLObject& rURL,
- const String& )
+ const OUString& )
{
aURL = rURL;
bIsValid = CreateThumb( rGraphic );
@@ -462,7 +463,7 @@ SgaObjectINet::SgaObjectINet()
// ------------------------------------------------------------------------
-SgaObjectINet::SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName ) :
+SgaObjectINet::SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormatName ) :
SgaObjectAnim ( rGraphic, rURL, rFormatName )
{
}
@@ -491,7 +492,7 @@ SvxGalleryDrawModel::SvxGalleryDrawModel()
{
DBG_CTOR(SvxGalleryDrawModel,NULL);
- const String sFactoryURL(RTL_CONSTASCII_USTRINGPARAM("sdraw"));
+ const OUString sFactoryURL("sdraw");
mxDoc = SfxObjectShell::CreateObjectByFactoryName( sFactoryURL );
@@ -599,7 +600,7 @@ sal_Bool SgaObjectSvDraw::CreateThumb( const FmFormModel& rModel )
// ------------------------------------------------------------------------
-void SgaObjectSvDraw::WriteData( SvStream& rOut, const String& rDestDir ) const
+void SgaObjectSvDraw::WriteData( SvStream& rOut, const OUString& rDestDir ) const
{
SgaObject::WriteData( rOut, rDestDir );
write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, aTitle, RTL_TEXTENCODING_UTF8);
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index b44df0206c4f..3a170812a9a6 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -259,13 +259,13 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPt
INetURLObject aInfoFileURL( GetParent()->GetUserURL() );
INetURLObject aNewURL;
sal_uInt32 nNextNumber = 1999;
- sal_Char const* pExt = NULL;
+ OUString sExt;
sal_Bool bExists;
- aDir.Append( String( RTL_CONSTASCII_USTRINGPARAM( "dragdrop" ) ) );
+ aDir.Append( OUString("dragdrop" ) );
CreateDir( aDir );
- aInfoFileURL.Append( String( RTL_CONSTASCII_USTRINGPARAM( "sdddndx1" ) ) );
+ aInfoFileURL.Append( OUString( "sdddndx1" ) );
// read next possible number
if( FileExists( aInfoFileURL ) )
@@ -284,19 +284,19 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPt
{
switch( nFormat )
{
- case( CVT_BMP ): pExt = ".bmp"; break;
- case( CVT_GIF ): pExt = ".gif"; break;
- case( CVT_JPG ): pExt = ".jpg"; break;
- case( CVT_MET ): pExt = ".met"; break;
- case( CVT_PCT ): pExt = ".pct"; break;
- case( CVT_PNG ): pExt = ".png"; break;
- case( CVT_SVM ): pExt = ".svm"; break;
- case( CVT_TIF ): pExt = ".tif"; break;
- case( CVT_WMF ): pExt = ".wmf"; break;
- case( CVT_EMF ): pExt = ".emf"; break;
+ case( CVT_BMP ): sExt = ".bmp"; break;
+ case( CVT_GIF ): sExt = ".gif"; break;
+ case( CVT_JPG ): sExt = ".jpg"; break;
+ case( CVT_MET ): sExt = ".met"; break;
+ case( CVT_PCT ): sExt = ".pct"; break;
+ case( CVT_PNG ): sExt = ".png"; break;
+ case( CVT_SVM ): sExt = ".svm"; break;
+ case( CVT_TIF ): sExt = ".tif"; break;
+ case( CVT_WMF ): sExt = ".wmf"; break;
+ case( CVT_EMF ): sExt = ".emf"; break;
default:
- pExt = ".grf";
+ sExt = ".grf";
break;
}
}
@@ -306,25 +306,23 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPt
// get URL
if( SGA_OBJ_SVDRAW == eObjKind )
{
- String aFileName( RTL_CONSTASCII_USTRINGPARAM( "gallery/svdraw/dd" ) );
+ OUString aFileName( "gallery/svdraw/dd" );
aNewURL = INetURLObject( aFileName += OUString::number( ++nNextNumber % 99999999 ), INET_PROT_PRIV_SOFFICE );
bExists = sal_False;
for ( size_t i = 0, n = aObjectList.size(); i < n; ++i )
+ {
if ( aObjectList[ i ]->aURL == aNewURL )
{
bExists = sal_True;
break;
}
+ }
}
else
{
- String aFileName( RTL_CONSTASCII_USTRINGPARAM( "dd" ) );
-
- aFileName += OUString::number( ++nNextNumber % 999999 );
- aFileName += String( pExt, RTL_TEXTENCODING_ASCII_US );
-
+ OUString aFileName("dd" + OUString::number( ++nNextNumber % 999999 ) + sExt);
aNewURL = aDir;
aNewURL.Append( aFileName );
@@ -409,7 +407,7 @@ bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_uIntPtr nInsertPos )
GalleryObject aNewEntry;
// update title of new object if necessary
- if( !rObj.GetTitle().Len() )
+ if( rObj.GetTitle().isEmpty() )
{
SgaObject* pOldObj = ImplReadSgaObject( pFoundEntry );
@@ -419,9 +417,10 @@ bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_uIntPtr nInsertPos )
delete pOldObj;
}
}
- else if( rObj.GetTitle() == String( RTL_CONSTASCII_USTRINGPARAM( "__<empty>__" ) ) )
- ( (SgaObject&) rObj ).SetTitle( String() );
-
+ else if( rObj.GetTitle() == "__<empty>__" )
+ {
+ ( (SgaObject&) rObj ).SetTitle( OUString() );
+ }
ImplWriteSgaObject( rObj, nInsertPos, &aNewEntry );
pFoundEntry->nOffset = aNewEntry.nOffset;
}
@@ -444,7 +443,7 @@ SgaObject* GalleryTheme::AcquireObject( size_t nPos )
// ------------------------------------------------------------------------
-void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, String& rTitle, String& rPath) const
+void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const
{
const GalleryObject* pGalleryObject = nPos < aObjectList.size() ? aObjectList[ nPos ] : NULL;
@@ -463,7 +462,7 @@ void GalleryTheme::GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBit
// ------------------------------------------------------------------------
-void GalleryTheme::SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const String& rTitle, const String& rPath)
+void GalleryTheme::SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath)
{
GalleryObject* pGalleryObject = nPos < aObjectList.size() ? aObjectList[ nPos ] : NULL;
@@ -555,7 +554,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg
if( !IsReadOnly() )
{
Graphic aGraphic;
- String aFormat;
+ OUString aFormat;
GalleryObject* pEntry;
const size_t nCount = aObjectList.size();
@@ -617,7 +616,7 @@ void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProg
{
if ( aSvDrawStorageRef.Is() )
{
- const String aStmName( GetSvDrawStreamNameFromURL( pEntry->aURL ) );
+ const OUString aStmName( GetSvDrawStreamNameFromURL( pEntry->aURL ) );
SvStorageStreamRef pIStm = aSvDrawStorageRef->OpenSotStream( aStmName, STREAM_READ );
if( pIStm && !pIStm->GetError() )
@@ -739,7 +738,7 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, sa
if( pIStm )
{
- String aThemeName;
+ OUString aThemeName;
sal_uInt16 nVersion;
sal_Bool bThemeNameFromResource = sal_False;
@@ -835,7 +834,7 @@ sal_Bool GalleryTheme::GetGraphic( sal_uIntPtr nPos, Graphic& rGraphic, sal_Bool
case( SGA_OBJ_ANIM ):
case( SGA_OBJ_INET ):
{
- String aFilterDummy;
+ OUString aFilterDummy;
bRet = ( GalleryGraphicImport( aURL, rGraphic, aFilterDummy, bProgress ) != SGA_IMPORT_NONE );
}
break;
@@ -986,7 +985,7 @@ sal_Bool GalleryTheme::GetModel( sal_uIntPtr nPos, SdrModel& rModel, sal_Bool )
if( xStor.Is() )
{
- const String aStmName( GetSvDrawStreamNameFromURL( aURL ) );
+ const OUString aStmName( GetSvDrawStreamNameFromURL( aURL ) );
SvStorageStreamRef xIStm( xStor->OpenSotStream( aStmName, STREAM_READ ) );
if( xIStm.Is() && !xIStm->GetError() )
@@ -1011,7 +1010,7 @@ sal_Bool GalleryTheme::InsertModel( const FmFormModel& rModel, sal_uIntPtr nInse
if( xStor.Is() )
{
- const String aStmName( GetSvDrawStreamNameFromURL( aURL ) );
+ const OUString aStmName( GetSvDrawStreamNameFromURL( aURL ) );
SvStorageStreamRef xOStm( xStor->OpenSotStream( aStmName, STREAM_WRITE | STREAM_TRUNC ) );
if( xOStm.Is() && !xOStm->GetError() )
@@ -1062,7 +1061,7 @@ sal_Bool GalleryTheme::GetModelStream( sal_uIntPtr nPos, SotStorageStreamRef& rx
if( xStor.Is() )
{
- const String aStmName( GetSvDrawStreamNameFromURL( aURL ) );
+ const OUString aStmName( GetSvDrawStreamNameFromURL( aURL ) );
SvStorageStreamRef xIStm( xStor->OpenSotStream( aStmName, STREAM_READ ) );
if( xIStm.Is() && !xIStm->GetError() )
@@ -1111,7 +1110,7 @@ sal_Bool GalleryTheme::InsertModelStream( const SotStorageStreamRef& rxModelStre
if( xStor.Is() )
{
- const String aStmName( GetSvDrawStreamNameFromURL( aURL ) );
+ const OUString aStmName( GetSvDrawStreamNameFromURL( aURL ) );
SvStorageStreamRef xOStm( xStor->OpenSotStream( aStmName, STREAM_WRITE | STREAM_TRUNC ) );
if( xOStm.Is() && !xOStm->GetError() )
@@ -1158,7 +1157,7 @@ sal_Bool GalleryTheme::GetURL( sal_uIntPtr nPos, INetURLObject& rURL, sal_Bool )
sal_Bool GalleryTheme::InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsertPos )
{
Graphic aGraphic;
- String aFormat;
+ OUString aFormat;
SgaObject* pNewObj = NULL;
const sal_uInt16 nImportRet = GalleryGraphicImport( rURL, aGraphic, aFormat );
sal_Bool bRet = sal_False;
@@ -1373,7 +1372,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const
for( sal_uInt32 i = 0; i < nCount; i++ )
{
const GalleryObject* pObj = ImplGetGalleryObject( i );
- String aPath;
+ OUString aPath;
if( SGA_OBJ_SVDRAW == pObj->eObjKind )
{
@@ -1383,35 +1382,40 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const
else
{
aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
- bRel = ( ( aPath.Erase( sal::static_int_cast< xub_StrLen >( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) ) ) == String(aRelURL1.GetMainURL( INetURLObject::NO_DECODE ) ));
+ bRel = aPath.copy( 0, aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) == aRelURL1.GetMainURL( INetURLObject::NO_DECODE );
if( bRel && ( pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > ( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() + 1 ) ) )
{
- aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
- aPath = aPath.Erase( 0, sal::static_int_cast< xub_StrLen >( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) );
+ aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).copy(aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() );
}
else
{
aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
- bRel = ( ( aPath.Erase( sal::static_int_cast< xub_StrLen >( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) ) ) == String(aRelURL2.GetMainURL( INetURLObject::NO_DECODE ) ));
+ bRel = aPath.copy(0, aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength()) == aRelURL2.GetMainURL( INetURLObject::NO_DECODE );
- if( bRel && ( pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > ( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() + 1 ) ) )
+ if( bRel && ( pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > ( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() + 1 )))
{
- aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
- aPath = aPath.Erase( 0, sal::static_int_cast< xub_StrLen >( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) );
+ aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).copy(aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() );
}
else
+ {
aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
}
}
- if ( m_aDestDir.Len() > 0 )
+ if ( !m_aDestDir.isEmpty())
{
- if ( aPath.SearchAndReplace(m_aDestDir, String()) != STRING_NOTFOUND )
+ if ( aPath.indexOf(m_aDestDir) < 0 )
+ {
+ aPath = aPath.replaceAll(m_aDestDir, OUString());
bRel = m_bDestDirRelative;
+ }
else
+ {
SAL_WARN( "svx", "failed to replace destdir of '"
<< m_aDestDir << "' in '" << aPath << "'");
+ }
}
rOStm << bRel;
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 05e709db15ba..2ecd15e88d99 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;
- GraphicObject aEmptyGraphicObject;
+ rtl::Reference<GraphicObject> aEmptyGraphicObject = GraphicObject::Create();
GraphicAttr aEmptyGraphicAttr;
// SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
@@ -132,7 +132,7 @@ namespace sdr
aSmallerMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate)
* aSmallerMatrix;
- const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ const rtl::Reference<GraphicObject> rGraphicObject = GetGrafObject().GetGraphicObject(false);
const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
aSmallerMatrix,
drawinglayer::attribute::SdrLineFillShadowTextAttribute(),
@@ -150,7 +150,7 @@ namespace sdr
const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
- GraphicObject aEmptyGraphicObject;
+ rtl::Reference<GraphicObject> aEmptyGraphicObject = GraphicObject::Create();
GraphicAttr aEmptyGraphicAttr;
// SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
@@ -367,7 +367,7 @@ namespace sdr
aObjectRange.getMinX(), aObjectRange.getMinY()));
// get the current, unchenged graphic obect from SdrGrafObj
- const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ const rtl::Reference<GraphicObject> rGraphicObject = GetGrafObject().GetGraphicObject(false);
if(visualisationUsesPresObj())
{
@@ -418,14 +418,14 @@ namespace sdr
return false;
// draft when swapped out
- const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ const rtl::Reference<GraphicObject> rGraphicObject = GetGrafObject().GetGraphicObject(false);
static bool bAllowReplacements(true);
- if(rGraphicObject.IsSwappedOut() && bAllowReplacements)
+ if(rGraphicObject->IsSwappedOut() && bAllowReplacements)
return true;
// draft when no graphic
- if(GRAPHIC_NONE == rGraphicObject.GetType() || GRAPHIC_DEFAULT == rGraphicObject.GetType())
+ if(GRAPHIC_NONE == rGraphicObject->GetType() || GRAPHIC_DEFAULT == rGraphicObject->GetType())
return true;
return false;
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index fcfba853bdf4..9adbf2af2f0f 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -612,7 +612,7 @@ namespace drawinglayer
attribute::SdrFillGraphicAttribute createNewSdrFillGraphicAttribute(const SfxItemSet& rSet)
{
- Graphic aGraphic(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject().GetGraphic());
+ Graphic aGraphic(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject()->GetGraphic());
if(!(GRAPHIC_BITMAP == aGraphic.GetType() || GRAPHIC_GDIMETAFILE == aGraphic.GetType()))
{
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
index 44ed09dd7fd9..8e14ddd600b4 100644
--- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -127,12 +127,12 @@ namespace drawinglayer
SdrGrafPrimitive2D::SdrGrafPrimitive2D(
const basegfx::B2DHomMatrix& rTransform,
const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
- const GraphicObject& rGraphicObject,
+ const rtl::Reference<GraphicObject>& rGraphicObject,
const GraphicAttr& rGraphicAttr)
: BufferedDecompositionPrimitive2D(),
maTransform(rTransform),
maSdrLFSTAttribute(rSdrLFSTAttribute),
- maGraphicObject(rGraphicObject),
+ m_rGraphicObject(rGraphicObject),
maGraphicAttr(rGraphicAttr)
{
// reset some values from GraphicAttr which are part of transformation already
@@ -157,7 +157,7 @@ namespace drawinglayer
bool SdrGrafPrimitive2D::isTransparent() const
{
return ((0L != getGraphicAttr().GetTransparency())
- || (getGraphicObject().IsTransparent()));
+ || (getGraphicObject()->IsTransparent()));
}
// provide unique ID
diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
index 4e141844cc67..18f1c16e4109 100644
--- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
@@ -61,7 +61,7 @@ namespace drawinglayer
#endif
if(GRAPHIC_NONE != aGraphic.GetType())
{
- const GraphicObject aGraphicObject(aGraphic);
+ const rtl::Reference<GraphicObject> rGraphicObject = GraphicObject::Create(aGraphic);
const GraphicAttr aGraphicAttr;
drawinglayer::primitive2d::Primitive2DSequence xOLEContent;
@@ -98,7 +98,7 @@ namespace drawinglayer
const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive(
new drawinglayer::primitive2d::GraphicPrimitive2D(
aInnerObjectMatrix,
- aGraphicObject,
+ rGraphicObject,
aGraphicAttr));
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive);
}
@@ -109,7 +109,7 @@ namespace drawinglayer
const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive(
new drawinglayer::primitive2d::GraphicPrimitive2D(
getObjectTransform(),
- aGraphicObject,
+ rGraphicObject,
aGraphicAttr));
drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive);
}
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 288a85ad0112..4d029fac0ead 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -675,13 +675,16 @@ sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIn
const SvxBrushItem* pBrsh = aFmt.GetBrush();
const Graphic* pGrf = 0;
if ( pBrsh )
+ {
pGrf = pBrsh->GetGraphic();
+ }
else
+ {
return sal_False;
-
+ }
if ( pGrf )
{
- const String* pGrfName = pBrsh->GetGraphicLink();
+ const OUString* pGrfName = pBrsh->GetGraphicLink();
//String* pGrfName = (String*)(pBrsh->GetGraphicLink());
GrfBulDataRelation* pEntry = aGrfDataLst[nIndex];
if ( pGrfName )
@@ -689,12 +692,13 @@ sal_Bool GraphyicBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIn
//pEntry->sDescription = sEmpty;
pEntry->nGallaryIndex = (sal_uInt16)0xFFFF;
pEntry->bIsCustomized = sal_True;
- String aStrFromRES = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));
- String aReplace = OUString("%LIST_NUM");
- String sNUM = OUString::number( nIndex + 1 );
- aStrFromRES.SearchAndReplace(aReplace,sNUM);
+ OUString aStrFromRES = OUString(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));
+ OUString aReplace = OUString("%LIST_NUM");
+ OUString sNUM = OUString::number( nIndex + 1 );
+ aStrFromRES = aStrFromRES.replaceAll(aReplace, sNUM);
pEntry->sDescription = aStrFromRES;
- }else
+ }
+ else
{
return sal_False;
}
@@ -1080,13 +1084,15 @@ sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,s
else
return sal_False;
- String sEmpty;
+ OUString sEmpty;
if ( pGrf )
{
- const String* pGrfName = pBrsh->GetGraphicLink();
+ const OUString* pGrfName = pBrsh->GetGraphicLink();
GrfBulDataRelation* pEntry = (GrfBulDataRelation*) (pActualBullets[nIndex]->pBullets);
if ( pGrfName )
+ {
pEntry->sGrfName = *pGrfName;
+ }
GraphyicBulletsTypeMgr* mGrfTMgr = GraphyicBulletsTypeMgr::GetInstance();
if ( mGrfTMgr )
{
@@ -1099,9 +1105,9 @@ sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,s
{
pActualBullets[nIndex]->nIndexDefault = (sal_uInt16)0xFFFF;
sEmpty = String(SVX_RESSTR( RID_SVXSTR_NUMBULLET_CUSTOM_BULLET_DESCRIPTION));
- String aReplace = OUString("%LIST_NUM");
- String sNUM = OUString::number( nIndex + 1 );
- sEmpty.SearchAndReplace(aReplace,sNUM);
+ OUString aReplace = OUString("%LIST_NUM");
+ OUString sNUM = OUString::number( nIndex + 1 );
+ sEmpty = sEmpty.replaceAll(aReplace, sNUM);
//pEntry->pGrfObj = pGrf;
pEntry->pGrfObj = new Graphic(*pGrf);
pEntry->aSize = aFmt.GetGraphicSize();
@@ -1158,7 +1164,7 @@ sal_Bool MixBulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,s
else
return sal_False;
- const String* pGrfName = 0;
+ const OUString* pGrfName = 0;
if ( pGrf )
{
pGrfName = pBrsh->GetGraphicLink();
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 2255d58ad9a8..d55375180344 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -3693,14 +3693,14 @@ bool SdrDragCrop::EndSdrDrag(bool bCopy)
if( !pObj || (pObj->GetGraphicType() == GRAPHIC_NONE) || (pObj->GetGraphicType() == GRAPHIC_DEFAULT) )
return false;
- const GraphicObject& rGraphicObject = pObj->GetGraphicObject();
+ const rtl::Reference<GraphicObject> rGraphicObject = pObj->GetGraphicObject();
const MapMode aMapMode100thmm(MAP_100TH_MM);
- Size aGraphicSize(rGraphicObject.GetPrefSize());
+ Size aGraphicSize(rGraphicObject->GetPrefSize());
- if( MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit() )
+ if( MAP_PIXEL == rGraphicObject->GetPrefMapMode().GetMapUnit() )
aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm );
else
- aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm);
+ aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, rGraphicObject->GetPrefMapMode(), aMapMode100thmm);
if( aGraphicSize.A() == 0 || aGraphicSize.B() == 0 )
return false;
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 4caca9417a72..8164ac3bfc51 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -321,7 +321,7 @@ bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
}
case XFILL_BITMAP:
{
- Bitmap aBitmap(((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetGraphicObject().GetGraphic().GetBitmapEx().GetBitmap());
+ Bitmap aBitmap(((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetGraphicObject()->GetGraphic().GetBitmapEx().GetBitmap());
const Size aSize(aBitmap.GetSizePixel());
const sal_uInt32 nWidth = aSize.Width();
const sal_uInt32 nHeight = aSize.Height();
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index a6e27ff3380f..4be240fe4f25 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -599,7 +599,7 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale)
aClipSize);
pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
- pObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aClippedBitmap)));
+ pObj->SetMergedItem(XFillBitmapItem(String(), GraphicObject::Create(aClippedBitmap)));
pObj->SetMergedItem(XFillBmpTileItem(false));
pObj->SetMergedItem(XFillBmpStretchItem(true));
}
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 34f514901e57..d7328fdf7948 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2493,7 +2493,7 @@ void SdrCropViewHdl::CreateB2dIAObject()
const drawinglayer::primitive2d::Primitive2DReference aGraphic(
new drawinglayer::primitive2d::GraphicPrimitive2D(
aCroppedTransform,
- maGraphic));
+ GraphicObject::Create(maGraphic)));
// prepare outline polygon for whole graphic
const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index cefe73b1cf8b..6b8086734ee3 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -691,7 +691,7 @@ void SdrMarkView::SetMarkHandles()
{
// get crop scale
const basegfx::B2DVector aCropScaleFactor(
- pSdrGrafObj->GetGraphicObject().calculateCropScaling(
+ pSdrGrafObj->GetGraphicObject()->calculateCropScaling(
aScale.getX(),
aScale.getY(),
rCrop.GetLeft(),
@@ -708,7 +708,7 @@ void SdrMarkView::SetMarkHandles()
aHdl.AddHdl(
new SdrCropViewHdl(
aMatrix,
- pSdrGrafObj->GetGraphicObject().GetGraphic(),
+ pSdrGrafObj->GetGraphicObject()->GetGraphic(),
fCropLeft,
fCropTop,
fCropRight,
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 3de2a643bf50..80a1ef051dae 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -342,8 +342,8 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS
// bitmap and transparency like shadow
if(bBitmapFillUsed)
{
- GraphicObject aGraphicObject(((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetGraphicObject());
- const BitmapEx aBitmapEx(aGraphicObject.GetGraphic().GetBitmapEx());
+ rtl::Reference<GraphicObject> rGraphicObject = (((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetGraphicObject());
+ const BitmapEx aBitmapEx(rGraphicObject->GetGraphic().GetBitmapEx());
Bitmap aBitmap(aBitmapEx.GetBitmap());
if(!aBitmap.IsEmpty())
@@ -379,21 +379,21 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS
{
if(aBitmapEx.IsAlpha())
{
- aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha())));
+ rGraphicObject = GraphicObject::Create(rGraphicObject, Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetAlpha())));
}
else
{
- aGraphicObject.SetGraphic(Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask())));
+ rGraphicObject = GraphicObject::Create(rGraphicObject, Graphic(BitmapEx(aDestBitmap, aBitmapEx.GetMask())));
}
}
else
{
- aGraphicObject.SetGraphic(Graphic(aDestBitmap));
+ rGraphicObject = GraphicObject::Create(rGraphicObject, Graphic(aDestBitmap));
}
}
}
- aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), aGraphicObject));
+ aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), rGraphicObject));
aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
}
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 5f1ee9ad8331..de4ec1f59f2b 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -281,9 +281,9 @@ void SdrGrafObj::onGraphicChanged()
String aTitle;
String aDesc;
- if(pGraphic)
+ if(m_rGraphicObject.is())
{
- const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = m_rGraphicObject->GetGraphic().getSvgData();
if(rSvgDataPtr.get())
{
@@ -331,9 +331,9 @@ SdrGrafObj::SdrGrafObj()
pGraphicLink ( NULL ),
bMirrored ( false )
{
- pGraphic = new GraphicObject;
- mpReplacementGraphic = 0;
- pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ m_rGraphicObject = GraphicObject::Create();
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
+ m_rGraphicObject->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
onGraphicChanged();
// #i118485# Shear allowed and possible now
@@ -355,9 +355,9 @@ SdrGrafObj::SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect)
pGraphicLink ( NULL ),
bMirrored ( false )
{
- pGraphic = new GraphicObject( rGrf );
- mpReplacementGraphic = 0;
- pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ m_rGraphicObject = GraphicObject::Create( rGrf );
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
+ m_rGraphicObject->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
onGraphicChanged();
// #i118485# Shear allowed and possible now
@@ -379,9 +379,9 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf )
pGraphicLink ( NULL ),
bMirrored ( false )
{
- pGraphic = new GraphicObject( rGrf );
- mpReplacementGraphic = 0;
- pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ m_rGraphicObject = GraphicObject::Create( rGrf );
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
+ m_rGraphicObject->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
onGraphicChanged();
// #i118485# Shear allowed and possible now
@@ -400,55 +400,51 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf )
SdrGrafObj::~SdrGrafObj()
{
- delete pGraphic;
- delete mpReplacementGraphic;
ImpLinkAbmeldung();
}
-void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj )
+void SdrGrafObj::SetGraphicObject( const rtl::Reference<GraphicObject>& rGrfObj )
{
- *pGraphic = rGrfObj;
- delete mpReplacementGraphic;
- mpReplacementGraphic = 0;
- pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
- pGraphic->SetUserData();
+ m_rGraphicObject = rGrfObj;
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
+ m_rGraphicObject->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ m_rGraphicObject->SetUserData();
mbIsPreview = false;
SetChanged();
BroadcastObjectChange();
onGraphicChanged();
}
-const GraphicObject& SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const
+const rtl::Reference<GraphicObject> SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const
{
if(bForceSwapIn)
{
ForceSwapIn();
}
- return *pGraphic;
+ return m_rGraphicObject;
}
-const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const
+const rtl::Reference<GraphicObject> SdrGrafObj::GetReplacementGraphicObject() const
{
- if(!mpReplacementGraphic && pGraphic)
+ if(!m_rReplacementGraphic.is() && m_rGraphicObject.is())
{
- const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = m_rGraphicObject->GetGraphic().getSvgData();
if(rSvgDataPtr.get())
{
- const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
+ const_cast< SdrGrafObj* >(this)->m_rReplacementGraphic = GraphicObject::Create(rSvgDataPtr->getReplacement());
}
}
- return mpReplacementGraphic;
+ return m_rReplacementGraphic;
}
void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf )
{
- pGraphic->SetGraphic( rGrf );
- delete mpReplacementGraphic;
- mpReplacementGraphic = 0;
- pGraphic->SetUserData();
+ m_rGraphicObject = GraphicObject::Create(m_rGraphicObject, rGrf );
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
+ m_rGraphicObject->SetUserData();
mbIsPreview = false;
onGraphicChanged();
}
@@ -463,7 +459,7 @@ void SdrGrafObj::SetGraphic( const Graphic& rGrf )
const Graphic& SdrGrafObj::GetGraphic() const
{
ForceSwapIn();
- return pGraphic->GetGraphic();
+ return m_rGraphicObject->GetGraphic();
}
Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const
@@ -503,59 +499,59 @@ Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const
}
// Delegate to moved code in GraphicObject
- return GetGraphicObject().GetTransformedGraphic( aDestSize, aDestMap, aActAttr );
+ return GetGraphicObject()->GetTransformedGraphic( aDestSize, aDestMap, aActAttr );
}
GraphicType SdrGrafObj::GetGraphicType() const
{
- return pGraphic->GetType();
+ return m_rGraphicObject->GetType();
}
bool SdrGrafObj::IsAnimated() const
{
- return pGraphic->IsAnimated();
+ return m_rGraphicObject->IsAnimated();
}
bool SdrGrafObj::IsEPS() const
{
- return pGraphic->IsEPS();
+ return m_rGraphicObject->IsEPS();
}
bool SdrGrafObj::IsSwappedOut() const
{
- return mbIsPreview ? true : pGraphic->IsSwappedOut();
+ return mbIsPreview ? true : m_rGraphicObject->IsSwappedOut();
}
const MapMode& SdrGrafObj::GetGrafPrefMapMode() const
{
- return pGraphic->GetPrefMapMode();
+ return m_rGraphicObject->GetPrefMapMode();
}
const Size& SdrGrafObj::GetGrafPrefSize() const
{
- return pGraphic->GetPrefSize();
+ return m_rGraphicObject->GetPrefSize();
}
-void SdrGrafObj::SetGrafStreamURL( const String& rGraphicStreamURL )
+void SdrGrafObj::SetGrafStreamURL( const OUString& rGraphicStreamURL )
{
mbIsPreview = false;
- if( !rGraphicStreamURL.Len() )
+ if( rGraphicStreamURL.isEmpty() )
{
- pGraphic->SetUserData();
+ m_rGraphicObject->SetUserData();
}
else if( pModel->IsSwapGraphics() )
{
- pGraphic->SetUserData( rGraphicStreamURL );
+ m_rGraphicObject->SetUserData( rGraphicStreamURL );
// set state of graphic object to 'swapped out'
- if( pGraphic->GetType() == GRAPHIC_NONE )
- pGraphic->SetSwapState();
+ if( m_rGraphicObject->GetType() == GRAPHIC_NONE )
+ m_rGraphicObject->SetSwapState();
}
}
String SdrGrafObj::GetGrafStreamURL() const
{
- return pGraphic->GetUserData();
+ return m_rGraphicObject->GetUserData();
}
void SdrGrafObj::ForceSwapIn() const
@@ -563,33 +559,33 @@ void SdrGrafObj::ForceSwapIn() const
if( mbIsPreview )
{
// removing preview graphic
- const String aUserData( pGraphic->GetUserData() );
+ const OUString aUserData( m_rGraphicObject->GetUserData() );
Graphic aEmpty;
- pGraphic->SetGraphic( aEmpty );
- pGraphic->SetUserData( aUserData );
- pGraphic->SetSwapState();
+ m_rGraphicObject = GraphicObject::Create(m_rGraphicObject, aEmpty );
+ m_rGraphicObject->SetUserData( aUserData );
+ m_rGraphicObject->SetSwapState();
const_cast< SdrGrafObj* >( this )->mbIsPreview = false;
}
- if ( pGraphicLink && pGraphic->IsSwappedOut() )
+ if ( pGraphicLink && m_rGraphicObject->IsSwappedOut() )
ImpUpdateGraphicLink( false );
else
- pGraphic->FireSwapInRequest();
+ m_rGraphicObject->FireSwapInRequest();
- if( pGraphic->IsSwappedOut() ||
- ( pGraphic->GetType() == GRAPHIC_NONE ) ||
- ( pGraphic->GetType() == GRAPHIC_DEFAULT ) )
+ if( m_rGraphicObject->IsSwappedOut() ||
+ ( m_rGraphicObject->GetType() == GRAPHIC_NONE ) ||
+ ( m_rGraphicObject->GetType() == GRAPHIC_DEFAULT ) )
{
Graphic aDefaultGraphic;
aDefaultGraphic.SetDefaultType();
- pGraphic->SetGraphic( aDefaultGraphic );
+ m_rGraphicObject = GraphicObject::Create( m_rGraphicObject, aDefaultGraphic );
}
}
void SdrGrafObj::ForceSwapOut() const
{
- pGraphic->FireSwapOutRequest();
+ m_rGraphicObject->FireSwapOutRequest();
}
void SdrGrafObj::ImpLinkAnmeldung()
@@ -620,16 +616,16 @@ void SdrGrafObj::ImpLinkAbmeldung()
}
}
-void SdrGrafObj::SetGraphicLink(const OUString& rFileName, const String& rFilterName)
+void SdrGrafObj::SetGraphicLink(const OUString& rFileName, const OUString& rFilterName)
{
ImpLinkAbmeldung();
aFileName = rFileName;
aFilterName = rFilterName;
ImpLinkAnmeldung();
- pGraphic->SetUserData();
+ m_rGraphicObject->SetUserData();
// A linked graphic is per definition swapped out (has to be loaded)
- pGraphic->SetSwapState();
+ m_rGraphicObject->SetSwapState();
}
void SdrGrafObj::ReleaseGraphicLink()
@@ -656,7 +652,7 @@ const OUString& SdrGrafObj::GetFilterName() const
void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
- bool bNoPresGrf = ( pGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj;
+ bool bNoPresGrf = ( m_rGraphicObject->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj;
rInfo.bResizeFreeAllowed = aGeo.nDrehWink % 9000 == 0 ||
aGeo.nDrehWink % 18000 == 0 ||
@@ -715,10 +711,10 @@ void SdrGrafObj::ImpSetLinkedGraphic( const Graphic& rGraphic )
OUString SdrGrafObj::TakeObjNameSingul() const
{
- if (!pGraphic)
+ if (!m_rGraphicObject.is())
return OUString();
- const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = m_rGraphicObject->GetGraphic().getSvgData();
OUStringBuffer sName;
@@ -728,11 +724,11 @@ OUString SdrGrafObj::TakeObjNameSingul() const
}
else
{
- switch( pGraphic->GetType() )
+ switch( m_rGraphicObject->GetType() )
{
case GRAPHIC_BITMAP:
{
- const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+ const sal_uInt16 nId = ( ( m_rGraphicObject->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) :
( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) );
@@ -768,10 +764,10 @@ OUString SdrGrafObj::TakeObjNameSingul() const
OUString SdrGrafObj::TakeObjNamePlural() const
{
- if(!pGraphic)
+ if(!m_rGraphicObject.is())
return OUString();
- const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = m_rGraphicObject->GetGraphic().getSvgData();
OUStringBuffer sName;
@@ -781,11 +777,11 @@ OUString SdrGrafObj::TakeObjNamePlural() const
}
else
{
- switch( pGraphic->GetType() )
+ switch( m_rGraphicObject->GetType() )
{
case GRAPHIC_BITMAP:
{
- const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+ const sal_uInt16 nId = ( ( m_rGraphicObject->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) :
( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) );
@@ -847,7 +843,7 @@ SdrGrafObj& SdrGrafObj::operator=( const SdrGrafObj& rObj )
return *this;
SdrRectObj::operator=( rObj );
- pGraphic->SetGraphic( rObj.GetGraphic(), &rObj.GetGraphicObject() );
+ m_rGraphicObject = GraphicObject::Create(rObj.GetGraphicObject());
aFileName = rObj.aFileName;
aFilterName = rObj.aFilterName;
bMirrored = rObj.bMirrored;
@@ -962,8 +958,8 @@ void SdrGrafObj::SetPage( SdrPage* pNewPage )
if( bRemove )
{
// No SwapIn necessary here, because if something's not loaded, it can't be animated either.
- if( pGraphic->IsAnimated())
- pGraphic->StopAnimation();
+ if( m_rGraphicObject->IsAnimated())
+ m_rGraphicObject->StopAnimation();
if( pGraphicLink != NULL )
ImpLinkAbmeldung();
@@ -1001,10 +997,10 @@ void SdrGrafObj::SetModel( SdrModel* pNewModel )
if( bChg )
{
- if( pGraphic->HasUserData() )
+ if( m_rGraphicObject->HasUserData() )
{
ForceSwapIn();
- pGraphic->SetUserData();
+ m_rGraphicObject->SetUserData();
}
if( pGraphicLink != NULL )
@@ -1025,7 +1021,7 @@ void SdrGrafObj::StartAnimation( OutputDevice* /*pOutDev*/, const Point& /*rPoin
bool SdrGrafObj::HasGDIMetaFile() const
{
- return( pGraphic->GetType() == GRAPHIC_GDIMETAFILE );
+ return( m_rGraphicObject->GetType() == GRAPHIC_GDIMETAFILE );
}
bool SdrGrafObj::isEmbeddedSvg() const
@@ -1180,7 +1176,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier, bool bAddText ) cons
aSet.Put(XFillStyleItem(XFILL_BITMAP));
const BitmapEx aBitmapEx(GetTransformedGraphic().GetBitmapEx());
- aSet.Put(XFillBitmapItem(OUString(), Graphic(aBitmapEx)));
+ aSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(aBitmapEx)));
aSet.Put(XFillBmpTileItem(false));
pRetval->SetMergedItemSet(aSet);
@@ -1240,11 +1236,11 @@ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly )
{
Size aSize;
Size aMaxSize( rMaxRect.GetSize() );
- if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
- aSize = Application::GetDefaultDevice()->PixelToLogic( pGraphic->GetPrefSize(), MAP_100TH_MM );
+ if ( m_rGraphicObject->GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aSize = Application::GetDefaultDevice()->PixelToLogic( m_rGraphicObject->GetPrefSize(), MAP_100TH_MM );
else
- aSize = OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
- pGraphic->GetPrefMapMode(),
+ aSize = OutputDevice::LogicToLogic( m_rGraphicObject->GetPrefSize(),
+ m_rGraphicObject->GetPrefMapMode(),
MapMode( MAP_100TH_MM ) );
if( aSize.Height() != 0 && aSize.Width() != 0 )
@@ -1292,7 +1288,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
if( pO->IsInSwapOut() )
{
- if( pModel && !mbIsPreview && pModel->IsSwapGraphics() && pGraphic->GetSizeBytes() > 20480 )
+ if( pModel && !mbIsPreview && pModel->IsSwapGraphics() && m_rGraphicObject->GetSizeBytes() > 20480 )
{
// test if this object is visualized from someone
// ## test only if there are VOCs other than the preview renderer
@@ -1300,7 +1296,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
{
const sal_uIntPtr nSwapMode = pModel->GetSwapGraphicsMode();
- if( ( pGraphic->HasUserData() || pGraphicLink ) &&
+ if( ( m_rGraphicObject->HasUserData() || pGraphicLink ) &&
( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) )
{
pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
@@ -1308,7 +1304,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
else if( nSwapMode & SDR_SWAPGRAPHICSMODE_TEMP )
{
pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
- pGraphic->SetUserData();
+ m_rGraphicObject->SetUserData();
}
// #i102380#
@@ -1326,10 +1322,10 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
// can be loaded from the original document stream later
if( pModel != NULL )
{
- if( pGraphic->HasUserData() )
+ if( m_rGraphicObject->HasUserData() )
{
::comphelper::LifecycleProxy proxy;
- OUString aUserData = pGraphic->GetUserData();
+ OUString aUserData = m_rGraphicObject->GetUserData();
uno::Reference<io::XInputStream> const xStream(
pModel->GetDocumentStream(aUserData, proxy));
@@ -1364,10 +1360,10 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
aGraphic, aUserData, *pStream,
GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData))
{
- const String aNewUserData( pGraphic->GetUserData() );
+ const String aNewUserData( m_rGraphicObject->GetUserData() );
- pGraphic->SetGraphic( aGraphic );
- pGraphic->SetUserData( aNewUserData );
+ m_rGraphicObject = GraphicObject::Create(m_rGraphicObject, aGraphic );
+ m_rGraphicObject->SetUserData( aNewUserData );
// Graphic successfully swapped in.
pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
@@ -1409,11 +1405,11 @@ Reference< XInputStream > SdrGrafObj::getInputStream()
if( pModel )
{
// can be loaded from the original document stream later
- if( pGraphic->HasUserData() )
+ if( m_rGraphicObject->HasUserData() )
{
::comphelper::LifecycleProxy proxy;
xStream.set(
- pModel->GetDocumentStream(pGraphic->GetUserData(), proxy));
+ pModel->GetDocumentStream(m_rGraphicObject->GetUserData(), proxy));
// fdo#46340: this may look completely insane, and it is,
// but it also prevents a crash: the LifecycleProxy will go out
// of scope, but the xStream must be returned; the UcbStreamHelper
@@ -1423,7 +1419,7 @@ Reference< XInputStream > SdrGrafObj::getInputStream()
utl::UcbStreamHelper::CreateStream(xStream);
xStream.set(new utl::OInputStreamWrapper(pStream, true));
}
- else if( pGraphic && GetGraphic().IsLink() )
+ else if( m_rGraphicObject.is() && GetGraphic().IsLink() )
{
Graphic aGraphic( GetGraphic() );
GfxLink aLink( aGraphic.GetLink() );
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index b97bf73733af..511667cd41d0 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -674,8 +674,8 @@ class SdrOle2ObjImpl
{
public:
// TODO/LATER: do we really need this pointer?
- GraphicObject* pGraphicObject;
- String aPersistName; // name of object in persist
+ rtl::Reference<GraphicObject> m_rGraphicObject;
+ OUString aPersistName; // name of object in persist
SdrLightEmbeddedClient_Impl* pLightClient; // must be registered as client only using AddOwnLightClient() call
// New local var to avoid repeated loading if load of OLE2 fails
@@ -683,10 +683,10 @@ public:
bool mbConnected;
SdrEmbedObjectLink* mpObjectLink;
- String maLinkURL;
+ OUString maLinkURL;
SdrOle2ObjImpl()
- : pGraphicObject( NULL )
+ : m_rGraphicObject( NULL )
, pLightClient ( NULL )
// init to start situation, loading did not fail
, mbLoadingOLEObjectFailed( false )
@@ -780,7 +780,7 @@ void SdrOle2Obj::Init()
mpImpl = new SdrOle2ObjImpl;
pModifyListener = NULL;
pGraphic=NULL;
- mpImpl->pGraphicObject=NULL;
+ mpImpl->m_rGraphicObject = rtl::Reference<GraphicObject>();
mpImpl->pLightClient = 0;
xObjRef.Lock( sal_True );
@@ -798,8 +798,6 @@ SdrOle2Obj::~SdrOle2Obj()
delete pGraphic;
- delete mpImpl->pGraphicObject;
-
if(pModifyListener)
{
pModifyListener->invalidate();
@@ -843,14 +841,16 @@ void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf)
{
delete pGraphic;
pGraphic = NULL;
- delete mpImpl->pGraphicObject;
- mpImpl->pGraphicObject = NULL;
}
- if (pGrf!=NULL)
+ if (pGrf != NULL)
{
pGraphic = new Graphic(*pGrf);
- mpImpl->pGraphicObject = new GraphicObject( *pGraphic );
+ mpImpl->m_rGraphicObject = GraphicObject::Create( *pGraphic );
+ }
+ else
+ {
+ mpImpl->m_rGraphicObject = rtl::Reference<GraphicObject>();
}
SetChanged();
@@ -1042,7 +1042,7 @@ void SdrOle2Obj::Reconnect_Impl()
void SdrOle2Obj::Connect_Impl()
{
- if( pModel && mpImpl->aPersistName.Len() )
+ if( pModel && !mpImpl->aPersistName.isEmpty() )
{
try
{
@@ -1176,7 +1176,7 @@ void SdrOle2Obj::Disconnect()
void SdrOle2Obj::RemoveListeners_Impl()
{
- if( xObjRef.is() && mpImpl->aPersistName.Len() )
+ if( xObjRef.is() && !mpImpl->aPersistName.isEmpty() )
{
try
{
@@ -1207,7 +1207,7 @@ void SdrOle2Obj::Disconnect_Impl()
{
try
{
- if ( pModel && mpImpl->aPersistName.Len() )
+ if ( pModel && !mpImpl->aPersistName.isEmpty() )
{
if( pModel->IsInDestruction() )
{
@@ -1337,7 +1337,7 @@ SdrObject* SdrOle2Obj::createSdrGrafObjReplacement(bool bAddText, bool /* bUseHC
// bitmap fill
pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
- pClone->SetMergedItem(XFillBitmapItem(String(), GetEmptyOLEReplacementGraphic()));
+ pClone->SetMergedItem(XFillBitmapItem(OUString(), GraphicObject::Create(GetEmptyOLEReplacementGraphic())));
pClone->SetMergedItem(XFillBmpTileItem(false));
pClone->SetMergedItem(XFillBmpStretchItem(false));
@@ -1548,7 +1548,7 @@ void SdrOle2Obj::SetPersistName( const String& rPersistName )
void SdrOle2Obj::AbandonObject()
{
- mpImpl->aPersistName.Erase();
+ mpImpl->aPersistName = "";
mpImpl->mbLoadingOLEObjectFailed = false;
SetObjRef(0);
}
@@ -1649,11 +1649,10 @@ SdrOle2Obj& SdrOle2Obj::operator=(const SdrOle2Obj& rObj)
if( pGraphic )
{
delete pGraphic;
- delete mpImpl->pGraphicObject;
}
pGraphic = new Graphic( *rOle2Obj.pGraphic );
- mpImpl->pGraphicObject = new GraphicObject( *pGraphic );
+ mpImpl->m_rGraphicObject = GraphicObject::Create( *pGraphic );
}
if( pModel && rObj.GetModel() && !IsEmptyPresObj() )
@@ -1998,7 +1997,7 @@ sal_Bool SdrOle2Obj::Unload()
void SdrOle2Obj::GetObjRef_Impl()
{
- if ( !xObjRef.is() && mpImpl->aPersistName.Len() && pModel && pModel->GetPersist() )
+ if ( !xObjRef.is() && !mpImpl->aPersistName.isEmpty() && pModel && pModel->GetPersist() )
{
// Only try loading if it did not went wrong up to now
if(!mpImpl->mbLoadingOLEObjectFailed)
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index ededdfd1eff3..b3af2a35bfa5 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -669,8 +669,8 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XP
uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw()
{
OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
- const GraphicObject& rGraphicObject(((XBitmapEntry*)pEntry)->GetGraphicObject());
- aURL += OStringToOUString(rGraphicObject.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+ const rtl::Reference<GraphicObject> rGraphicObject = ((XBitmapEntry*)pEntry)->GetGraphicObject();
+ aURL += OStringToOUString(rGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
uno::Any aAny;
aAny <<= aURL;
@@ -683,10 +683,9 @@ XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno::
if(!(rAny >>= aURL))
return NULL;
- const GraphicObject aGrafObj(GraphicObject::CreateGraphicObjectFromURL(aURL));
- const String aName(rName);
+ const rtl::Reference<GraphicObject> rGrafObj = GraphicObject::CreateGraphicObjectFromURL(aURL);
- return new XBitmapEntry(aGrafObj, aName);
+ return new XBitmapEntry(rGrafObj, rName);
}
// XElementAccess
diff --git a/svx/source/unodraw/unobtabl.cxx b/svx/source/unodraw/unobtabl.cxx
index 398ebc9cc621..6d5dba233b15 100644
--- a/svx/source/unodraw/unobtabl.cxx
+++ b/svx/source/unodraw/unobtabl.cxx
@@ -69,7 +69,7 @@ bool SvxUnoBitmapTable::isValid( const NameOrIndex* pItem ) const
const XFillBitmapItem* pBitmapItem = dynamic_cast< const XFillBitmapItem* >( pItem );
if( pBitmapItem )
{
- const Graphic& rGraphic = pBitmapItem->GetGraphicObject().GetGraphic();
+ const Graphic& rGraphic = pBitmapItem->GetGraphicObject()->GetGraphic();
return rGraphic.GetSizeBytes() > 0;
}
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index d2ecf6b8516c..ba8e843f169e 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1513,7 +1513,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
String aTmpStr(aURL);
OString aUniqueID(OUStringToOString(aTmpStr, RTL_TEXTENCODING_UTF8));
- GraphicObject aGrafObj(aUniqueID);
+ rtl::Reference<GraphicObject> rGrafObj = GraphicObject::Create(aUniqueID);
// #101808# since loading a graphic can cause a reschedule of the office
// it is possible that our shape is removed while where in this
@@ -1521,7 +1521,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
if( mpObj.is() )
{
static_cast<SdrGrafObj*>(mpObj.get())->ReleaseGraphicLink();
- static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj );
+ static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( rGrafObj );
}
}
else if( !aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
@@ -1649,9 +1649,9 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
else
{
sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
- const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
+ const rtl::Reference<GraphicObject> rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(rGrafObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+ aURL += OStringToOUString(rGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
rValue <<= aURL;
if ( bSwapped )
static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
@@ -1661,12 +1661,12 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_REPLACEMENTGRAFURL:
{
- const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
+ const rtl::Reference<GraphicObject> rGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
- if(pGrafObj)
+ if(rGrafObj.is())
{
OUString aURL(UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(pGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
+ aURL += OStringToOUString(rGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
rValue <<= aURL;
}
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 768896d9da36..af19e73e7a39 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -147,8 +147,8 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
OUString aURL;
if( rValue >>= aURL )
{
- GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
- static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &aGrafObj.GetGraphic() );
+ rtl::Reference<GraphicObject> rGrafObj = GraphicObject::CreateGraphicObjectFromURL( aURL );
+ static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &rGrafObj->GetGraphic() );
return true;
}
break;
@@ -161,8 +161,8 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
if( pOle )
{
- GraphicObject aGrafObj( xGraphic );
- const Graphic aGraphic( aGrafObj.GetGraphic() );
+ rtl::Reference<GraphicObject> rGrafObj = GraphicObject::Create( xGraphic );
+ const Graphic aGraphic( rGrafObj->GetGraphic() );
pOle->SetGraphicToObj( aGraphic, OUString() );
}
return true;
@@ -334,14 +334,13 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
// if there isn't already a preview graphic set, check if we need to generate
// one if model says so
if( pGraphic == NULL && !pOle->IsEmptyPresObj() && mpModel->IsSaveOLEPreview() )
- pGraphic = pOle->GetGraphic();
+ pGraphic = pOle->GetGraphic(); /* FIXME: that sound wrong pGraphic is already = to pOle->GetGraphic() */
if( pGraphic )
{
- GraphicObject aObj( *pGraphic );
+ rtl::Reference<GraphicObject> rObj = GraphicObject::Create( *pGraphic );
aURL = OUString( UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(aObj.GetUniqueID(),
- RTL_TEXTENCODING_ASCII_US);
+ aURL += OStringToOUString(rObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
}
}
rValue <<= aURL;
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 99d5548b1c0a..355bfe0ae311 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -96,17 +96,17 @@ public:
SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId )
{
- GraphicObject aGrfObject( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) );
+ rtl::Reference<GraphicObject> rGrfObject = GraphicObject::Create( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) );
maTmp.EnableKillingFile();
- if( aGrfObject.GetType() != GRAPHIC_NONE )
+ if( rGrfObject->GetType() != GRAPHIC_NONE )
{
SvStream* pStm = ::utl::UcbStreamHelper::CreateStream( maTmp.GetURL(), STREAM_WRITE | STREAM_TRUNC );
if( pStm )
{
- Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
+ Graphic aGraphic( (Graphic&) rGrfObject->GetGraphic() );
const GfxLink aGfxLink( aGraphic.GetLink() );
sal_Bool bRet = sal_False;
@@ -120,14 +120,14 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const OUString& rGraphicId )
if( aGraphic.GetType() == GRAPHIC_BITMAP )
{
GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
- String aFormat;
+ OUString aFormat;
if( aGraphic.IsAnimated() )
- aFormat = String( "gif" );
+ aFormat = "gif";
else
- aFormat = String( "png" );
+ aFormat = "png";
- bRet = ( rFilter.ExportGraphic( aGraphic, String(), *pStm, rFilter.GetExportFormatNumberForShortName( aFormat ) ) == 0 );
+ bRet = ( rFilter.ExportGraphic( aGraphic, OUString(), *pStm, rFilter.GetExportFormatNumberForShortName( aFormat ) ) == 0 );
}
else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE )
{
@@ -210,7 +210,7 @@ private:
::utl::TempFile* mpTmp;
SvStream* mpOStm;
Reference< XOutputStream > mxStmWrapper;
- GraphicObject maGrfObj;
+ rtl::Reference<GraphicObject> m_rGrfObj;
sal_Bool mbClosed;
// not available
@@ -223,7 +223,7 @@ public:
virtual ~SvXMLGraphicOutputStream();
bool Exists() const { return mxStmWrapper.is(); }
- const GraphicObject& GetGraphicObject();
+ const rtl::Reference<GraphicObject> GetGraphicObject();
};
SvXMLGraphicOutputStream::SvXMLGraphicOutputStream() :
@@ -274,9 +274,9 @@ void SAL_CALL SvXMLGraphicOutputStream::closeOutput()
mbClosed = sal_True;
}
-const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
+const rtl::Reference<GraphicObject> SvXMLGraphicOutputStream::GetGraphicObject()
{
- if( mbClosed && ( maGrfObj.GetType() == GRAPHIC_NONE ) && mpOStm )
+ if( mbClosed && ( m_rGrfObj->GetType() == GRAPHIC_NONE ) && mpOStm )
{
Graphic aGraphic;
@@ -334,15 +334,15 @@ const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
}
}
- maGrfObj = aGraphic;
- if( maGrfObj.GetType() != GRAPHIC_NONE )
+ m_rGrfObj = GraphicObject::Create(aGraphic);
+ if( m_rGrfObj->GetType() != GRAPHIC_NONE )
{
delete mpOStm, mpOStm = NULL;
delete mpTmp, mpTmp = NULL;
}
}
- return maGrfObj;
+ return m_rGrfObj;
}
SvXMLGraphicHelper::SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode ) :
@@ -507,15 +507,15 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageNa
const OUString& rGraphicId,
bool bUseGfxLink )
{
- GraphicObject aGrfObject( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) );
+ rtl::Reference<GraphicObject> rGrfObject = GraphicObject::Create( OUStringToOString(rGraphicId, RTL_TEXTENCODING_ASCII_US) );
sal_Bool bRet = sal_False;
- if( aGrfObject.GetType() != GRAPHIC_NONE )
+ if( rGrfObject->GetType() != GRAPHIC_NONE )
{
SvxGraphicHelperStream_Impl aStream( ImplGetGraphicStream( rPictureStorageName, rPictureStreamName, sal_False ) );
if( aStream.xStream.is() )
{
- Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
+ Graphic aGraphic( (Graphic&) rGrfObject->GetGraphic() );
const GfxLink aGfxLink( aGraphic.GetLink() );
const OUString aMimeType( ImplGetGraphicMimeType( rPictureStreamName ) );
uno::Any aAny;
@@ -609,93 +609,101 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
if( GRAPHICHELPER_MODE_READ == meCreateMode )
{
- const GraphicObject aObj( ImplReadGraphic( aPictureStorageName, aPictureStreamName ) );
+ const rtl::Reference<GraphicObject> rObj = GraphicObject::Create(ImplReadGraphic( aPictureStorageName, aPictureStreamName ));
- if( aObj.GetType() != GRAPHIC_NONE )
+ if( rObj->GetType() != GRAPHIC_NONE )
{
- maGrfObjs.push_back( aObj );
+ maGrfObjs.push_back( rObj );
OUString aBaseURL( XML_GRAPHICOBJECT_URL_BASE );
rURLPair.second = aBaseURL;
- rURLPair.second += OStringToOUString(aObj.GetUniqueID(),
+ rURLPair.second += OStringToOUString(rObj->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US);
}
else
- rURLPair.second = String();
+ {
+ rURLPair.second = OUString();
+ }
}
else
{
- const String aGraphicObjectId( aPictureStreamName );
+ const OUString aGraphicObjectId( aPictureStreamName );
const OString aAsciiObjectID(OUStringToOString(aGraphicObjectId, RTL_TEXTENCODING_ASCII_US));
- const GraphicObject aGrfObject( aAsciiObjectID );
- if( aGrfObject.GetType() != GRAPHIC_NONE )
+ const rtl::Reference<GraphicObject> rGrfObject = GraphicObject::Create( aAsciiObjectID );
+ if( rGrfObject->GetType() != GRAPHIC_NONE )
{
- String aStreamName( aGraphicObjectId );
- Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
- const GfxLink aGfxLink( aGraphic.GetLink() );
- String aExtension;
- bool bUseGfxLink( true );
+ OUString aStreamName( aGraphicObjectId );
+ Graphic aGraphic( (Graphic&) rGrfObject->GetGraphic() );
+ const GfxLink aGfxLink( aGraphic.GetLink() );
+ OUString aExtension;
+ bool bUseGfxLink( true );
if( aGfxLink.GetDataSize() )
{
switch( aGfxLink.GetType() )
{
- case( GFX_LINK_TYPE_EPS_BUFFER ): aExtension = String( ".eps" ); break;
- case( GFX_LINK_TYPE_NATIVE_GIF ): aExtension = String( ".gif" ); break;
- case( GFX_LINK_TYPE_NATIVE_JPG ): aExtension = String( ".jpg" ); break;
- case( GFX_LINK_TYPE_NATIVE_PNG ): aExtension = String( ".png" ); break;
- case( GFX_LINK_TYPE_NATIVE_TIF ): aExtension = String( ".tif" ); break;
- case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = String( ".wmf" ); break;
- case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = String( ".met" ); break;
- case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = String( ".pct" ); break;
- case( GFX_LINK_TYPE_NATIVE_SVG ):
- // backward-compat kludge: since no released OOo
- // version to date can handle svg properly, wrap it up
- // into an svm. slight catch22 here, since strict ODF
- // conformance _recommends_ svg - then again, most old
- // ODF consumers are believed to be OOo
- if( SvtSaveOptions().GetODFDefaultVersion() <= SvtSaveOptions::ODFVER_012 )
- {
- bUseGfxLink = false;
- aExtension = String( ".svm" );
- }
- else
- aExtension = String( ".svg" );
- break;
+ case GFX_LINK_TYPE_EPS_BUFFER: aExtension = ".eps"; break;
+ case GFX_LINK_TYPE_NATIVE_GIF: aExtension = ".gif"; break;
+ case GFX_LINK_TYPE_NATIVE_JPG: aExtension = ".jpg"; break;
+ case GFX_LINK_TYPE_NATIVE_PNG: aExtension = ".png"; break;
+ case GFX_LINK_TYPE_NATIVE_TIF: aExtension = ".tif"; break;
+ case GFX_LINK_TYPE_NATIVE_WMF: aExtension = ".wmf"; break;
+ case GFX_LINK_TYPE_NATIVE_MET: aExtension = ".met"; break;
+ case GFX_LINK_TYPE_NATIVE_PCT: aExtension = ".pct"; break;
+ case GFX_LINK_TYPE_NATIVE_SVG:
+ // backward-compat kludge: since no released OOo
+ // version to date can handle svg properly, wrap it up
+ // into an svm. slight catch22 here, since strict ODF
+ // conformance _recommends_ svg - then again, most old
+ // ODF consumers are believed to be OOo
+ if( SvtSaveOptions().GetODFDefaultVersion() <= SvtSaveOptions::ODFVER_012 )
+ {
+ bUseGfxLink = false;
+ aExtension = ".svm";
+ }
+ else
+ aExtension = ".svg";
+ break;
- default:
- aExtension = String( ".grf" );
+ default:
+ aExtension = ".grf";
break;
}
}
else
{
- if( aGrfObject.GetType() == GRAPHIC_BITMAP )
+ if( rGrfObject->GetType() == GRAPHIC_BITMAP )
{
- if( aGrfObject.IsAnimated() )
- aExtension = String( ".gif" );
+ if( rGrfObject->IsAnimated() )
+ {
+ aExtension = ".gif";
+ }
else
- aExtension = String( ".png" );
+ {
+ aExtension = ".png";
+ }
}
- else if( aGrfObject.GetType() == GRAPHIC_GDIMETAFILE )
+ else if( rGrfObject->GetType() == GRAPHIC_GDIMETAFILE )
{
// SJ: first check if this metafile is just a eps file, then we will store the eps instead of svm
GDIMetaFile& rMtf( (GDIMetaFile&)aGraphic.GetGDIMetaFile() );
if ( ImplCheckForEPS( rMtf ) )
- aExtension = String( ".eps" );
+ {
+ aExtension = ".eps";
+ }
else
- aExtension = String( ".svm" );
+ {
+ aExtension = ".svm";
+ }
}
}
OUString aURLEntry;
- const String sPictures( "Pictures/" );
+ const OUString sPictures( "Pictures/" );
if ( !rRequestedFileName.isEmpty() )
{
- aURLEntry = sPictures;
- aURLEntry += rRequestedFileName;
- aURLEntry += aExtension;
+ aURLEntry = sPictures + rRequestedFileName + aExtension;
URLPairVector::const_iterator aIter( maGrfURLs.begin() ), aEnd( maGrfURLs.end() );
for ( ; aIter != aEnd; ++aIter )
@@ -704,24 +712,25 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const OUString& rURLStr, sal_uInt
break;
}
if ( aIter == aEnd )
+ {
aStreamName = rRequestedFileName;
+ }
}
aStreamName += aExtension;
- if( mbDirect && aStreamName.Len() )
+ if( mbDirect && !aStreamName.isEmpty() )
+ {
ImplWriteGraphic( aPictureStorageName, aStreamName, aGraphicObjectId, bUseGfxLink );
-
- rURLPair.second = sPictures;
- rURLPair.second += aStreamName;
+ }
+ rURLPair.second = sPictures + aStreamName;
}
#if OSL_DEBUG_LEVEL > 0
else
{
- OStringBuffer sMessage(
- RTL_CONSTASCII_STRINGPARAM("graphic object with ID '"));
+ OStringBuffer sMessage("graphic object with ID '");
sMessage.append(aAsciiObjectID).
- append(RTL_CONSTASCII_STRINGPARAM("' has an unknown type"));
+ append("' has an unknown type");
OSL_ENSURE( false, sMessage.getStr() );
}
#endif
@@ -868,9 +877,8 @@ OUString SAL_CALL SvXMLGraphicHelper::resolveOutputStream( const Reference< XOut
if( pOStm )
{
- const GraphicObject& rGrfObj = pOStm->GetGraphicObject();
- const OUString aId(OStringToOUString(
- rGrfObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US));
+ const rtl::Reference<GraphicObject> rGrfObj = pOStm->GetGraphicObject();
+ const OUString aId(OStringToOUString(rGrfObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US));
if( !aId.isEmpty() )
{
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index bad053361de9..680cfa3cceb4 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -114,15 +114,15 @@ Graphic XOutBitmap::MirrorGraphic( const Graphic& rGraphic, const sal_uIntPtr nM
return aRetGraphic;
}
-sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName,
- const String& rFilterName, const sal_uIntPtr nFlags,
- const Size* pMtfSize_100TH_MM )
+sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
+ const OUString& rFilterName, const sal_uIntPtr nFlags,
+ const Size* pMtfSize_100TH_MM )
{
if( rGraphic.GetType() != GRAPHIC_NONE )
{
INetURLObject aURL( rFileName );
Graphic aGraphic;
- String aExt;
+ OUString aExt;
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
sal_uInt16 nErr = GRFILTER_FILTERERROR, nFilter = GRFILTER_FORMAT_NOTFOUND;
sal_Bool bTransparent = rGraphic.IsTransparent(), bAnimated = rGraphic.IsAnimated();
@@ -132,13 +132,13 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName,
// calculate correct file name
if( !( nFlags & XOUTBMP_DONT_EXPAND_FILENAME ) )
{
- String aName( aURL.getBase() );
- aName += '_';
- aName += String(aURL.getExtension());
- aName += '_';
- String aStr( OUString::number( rGraphic.GetChecksum(), 16 ) );
- if ( aStr.GetChar(0) == '-' )
- aStr.SetChar(0,'m');
+ OUString aName( aURL.getBase() + "_" + aURL.getExtension() + "_" );
+
+ OUString aStr( OUString::number( rGraphic.GetChecksum(), 16 ) );
+ if ( aStr[0] == '-' )
+ {
+ aStr = "m" + aStr.copy(1);
+ }
aName += aStr;
aURL.setBase( aName );
}
@@ -148,7 +148,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName,
if(aSvgDataPtr.get()
&& aSvgDataPtr->getSvgDataArrayLength()
- && rFilterName.EqualsIgnoreCaseAscii("svg"))
+ && rFilterName.equalsIgnoreAsciiCase("svg"))
{
if(!(nFlags & XOUTBMP_DONT_ADD_EXTENSION))
{
@@ -191,7 +191,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName,
break;
}
- if( aExt.Len() )
+ if( !aExt.isEmpty() )
{
if( 0 == (nFlags & XOUTBMP_DONT_ADD_EXTENSION))
aURL.setExtension( aExt );
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index e3b50dd6ccf4..6851418953a2 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -242,8 +242,8 @@ String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uIn
{
case XATTR_FILLBITMAP:
{
- const GraphicObject& rGraphicObjectA(((XFillBitmapItem*)pCheckItem)->GetGraphicObject());
- const GraphicObject& rGraphicObjectB(((XBitmapEntry*)pEntry)->GetGraphicObject());
+ const rtl::Reference<GraphicObject> rGraphicObjectA = ((XFillBitmapItem*)pCheckItem)->GetGraphicObject();
+ const rtl::Reference<GraphicObject> rGraphicObjectB = ((XBitmapEntry*)pEntry)->GetGraphicObject();
bFound = (rGraphicObjectA == rGraphicObjectB);
break;
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 78e56e87eea2..25b976e9f2f1 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -50,7 +50,7 @@ using namespace ::com::sun::star;
XOBitmap::XOBitmap( const Bitmap& rBmp ) :
eType ( XBITMAP_IMPORT ),
- aGraphicObject ( rBmp ),
+ m_rGraphicObject ( GraphicObject::Create(rBmp) ),
pPixelArray ( NULL ),
bGraphicDirty ( sal_False )
{
@@ -66,7 +66,7 @@ XOBitmap::XOBitmap( const XOBitmap& rXBmp ) :
pPixelArray ( NULL )
{
eType = rXBmp.eType;
- aGraphicObject = rXBmp.aGraphicObject;
+ m_rGraphicObject = rXBmp.m_rGraphicObject;
aArraySize = rXBmp.aArraySize;
aPixelColor = rXBmp.aPixelColor;
aBckgrColor = rXBmp.aBckgrColor;
@@ -104,7 +104,7 @@ XOBitmap::~XOBitmap()
XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
{
eType = rXBmp.eType;
- aGraphicObject = rXBmp.aGraphicObject;
+ m_rGraphicObject = rXBmp.m_rGraphicObject;
aArraySize = rXBmp.aArraySize;
aPixelColor = rXBmp.aPixelColor;
aBckgrColor = rXBmp.aBckgrColor;
@@ -132,7 +132,7 @@ XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
{
if( eType != rXOBitmap.eType ||
- aGraphicObject != rXOBitmap.aGraphicObject ||
+ m_rGraphicObject != rXOBitmap.m_rGraphicObject ||
aArraySize != rXOBitmap.aArraySize ||
aPixelColor != rXOBitmap.aPixelColor ||
aBckgrColor != rXOBitmap.aBckgrColor ||
@@ -161,7 +161,7 @@ int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
Bitmap XOBitmap::GetBitmap() const
{
- return GetGraphicObject().GetGraphic().GetBitmap();
+ return GetGraphicObject()->GetGraphic().GetBitmap();
}
/*************************************************************************
@@ -170,12 +170,12 @@ Bitmap XOBitmap::GetBitmap() const
|*
*************************************************************************/
-const GraphicObject& XOBitmap::GetGraphicObject() const
+const rtl::Reference<GraphicObject> XOBitmap::GetGraphicObject() const
{
if( bGraphicDirty )
( (XOBitmap*) this )->Array2Bitmap();
- return aGraphicObject;
+ return m_rGraphicObject;
}
/*************************************************************************
@@ -253,7 +253,7 @@ void XOBitmap::Array2Bitmap()
}
}
- aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
+ m_rGraphicObject = GraphicObject::Create( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
bGraphicDirty = sal_False;
}
@@ -264,9 +264,9 @@ TYPEINIT1_AUTOFACTORY(XFillBitmapItem, NameOrIndex);
//////////////////////////////////////////////////////////////////////////////
-XFillBitmapItem::XFillBitmapItem(const XubString& rName, const GraphicObject& rGraphicObject)
+XFillBitmapItem::XFillBitmapItem(const XubString& rName, const rtl::Reference<GraphicObject>& rGraphicObject)
: NameOrIndex(XATTR_FILLBITMAP, rName),
- maGraphicObject(rGraphicObject)
+ m_rGraphicObject(rGraphicObject)
{
}
@@ -274,7 +274,7 @@ XFillBitmapItem::XFillBitmapItem(const XubString& rName, const GraphicObject& rG
XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem)
: NameOrIndex(rItem),
- maGraphicObject(rItem.maGraphicObject)
+ m_rGraphicObject(rItem.m_rGraphicObject)
{
}
@@ -359,7 +359,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
Bitmap aBmp;
ReadDIB(aBmp, rIn, true);
- maGraphicObject = Graphic(aBmp);
+ m_rGraphicObject = GraphicObject::Create(Graphic(aBmp));
}
else if(1 == nVer)
{
@@ -373,7 +373,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
Bitmap aBmp;
ReadDIB(aBmp, rIn, true);
- maGraphicObject = Graphic(aBmp);
+ m_rGraphicObject = GraphicObject::Create(Graphic(aBmp));
}
else if(XBITMAP_8X8 == iTmp)
{
@@ -392,7 +392,7 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
const Bitmap aBitmap(createHistorical8x8FromArray(aArray, aColorPix, aColorBack));
- maGraphicObject = Graphic(aBitmap);
+ m_rGraphicObject = GraphicObject::Create(Graphic(aBitmap));
}
}
else if(2 == nVer)
@@ -400,16 +400,16 @@ XFillBitmapItem::XFillBitmapItem(SvStream& rIn, sal_uInt16 nVer)
BitmapEx aBmpEx;
ReadDIBBitmapEx(aBmpEx, rIn);
- maGraphicObject = Graphic(aBmpEx);
+ m_rGraphicObject = GraphicObject::Create(Graphic(aBmpEx));
}
}
}
//////////////////////////////////////////////////////////////////////////////
-XFillBitmapItem::XFillBitmapItem(SfxItemPool* /*pPool*/, const GraphicObject& rGraphicObject)
+XFillBitmapItem::XFillBitmapItem(SfxItemPool* /*pPool*/, const rtl::Reference<GraphicObject>& rGraphicObject)
: NameOrIndex( XATTR_FILLBITMAP, -1),
- maGraphicObject(rGraphicObject)
+ m_rGraphicObject(rGraphicObject)
{
}
@@ -425,7 +425,7 @@ SfxPoolItem* XFillBitmapItem::Clone(SfxItemPool* /*pPool*/) const
int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
{
return (NameOrIndex::operator==(rItem)
- && maGraphicObject == ((const XFillBitmapItem&)rItem).maGraphicObject);
+ && m_rGraphicObject == ((const XFillBitmapItem&)rItem).m_rGraphicObject);
}
//////////////////////////////////////////////////////////////////////////////
@@ -443,7 +443,7 @@ SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) cons
if(!IsIndex())
{
- WriteDIBBitmapEx(maGraphicObject.GetGraphic().GetBitmapEx(), rOut);
+ WriteDIBBitmapEx(m_rGraphicObject->GetGraphic().GetBitmapEx(), rOut);
}
return rOut;
@@ -451,16 +451,16 @@ SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) cons
//////////////////////////////////////////////////////////////////////////////
-const GraphicObject& XFillBitmapItem::GetGraphicObject() const
+const rtl::Reference<GraphicObject> XFillBitmapItem::GetGraphicObject() const
{
- return maGraphicObject;
+ return m_rGraphicObject;
}
//////////////////////////////////////////////////////////////////////////////
-void XFillBitmapItem::SetGraphicObject(const GraphicObject& rGraphicObject)
+void XFillBitmapItem::SetGraphicObject(const rtl::Reference<GraphicObject>& rGraphicObject)
{
- maGraphicObject = rGraphicObject;
+ m_rGraphicObject = rGraphicObject;
}
//////////////////////////////////////////////////////////////////////////////
@@ -520,24 +520,28 @@ bool XFillBitmapItem::QueryValue(::com::sun::star::uno::Any& rVal, sal_uInt8 nMe
if( nMemberId == MID_GRAFURL ||
nMemberId == 0 )
{
- aURL = OUString(
- UNO_NAME_GRAPHOBJ_URLPREFIX);
- aURL += OStringToOUString(
- GetGraphicObject().GetUniqueID(),
- RTL_TEXTENCODING_ASCII_US);
+ aURL = OUString( UNO_NAME_GRAPHOBJ_URLPREFIX);
+ aURL += OStringToOUString( GetGraphicObject()->GetUniqueID(),
+ RTL_TEXTENCODING_ASCII_US);
}
if( nMemberId == MID_BITMAP ||
nMemberId == 0 )
{
- xBmp.set(VCLUnoHelper::CreateBitmap(GetGraphicObject().GetGraphic().GetBitmapEx()));
+ xBmp.set(VCLUnoHelper::CreateBitmap(GetGraphicObject()->GetGraphic().GetBitmapEx()));
}
if( nMemberId == MID_NAME )
+ {
rVal <<= aApiName;
+ }
else if( nMemberId == MID_GRAFURL )
+ {
rVal <<= aURL;
+ }
else if( nMemberId == MID_BITMAP )
+ {
rVal <<= xBmp;
+ }
else
{
// member-id 0 => complete item (e.g. for toolbars)
@@ -606,10 +610,10 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt
}
if( bSetURL )
{
- maGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL);
+ m_rGraphicObject = GraphicObject::CreateGraphicObjectFromURL(aURL);
// #121194# Prefer GraphicObject over bitmap object if both are provided
- if(bSetBitmap && GRAPHIC_NONE != maGraphicObject.GetType())
+ if(bSetBitmap && GRAPHIC_NONE != m_rGraphicObject->GetType())
{
bSetBitmap = false;
}
@@ -618,11 +622,11 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt
{
if(xBmp.is())
{
- maGraphicObject = Graphic(VCLUnoHelper::GetBitmap(xBmp));
+ m_rGraphicObject = GraphicObject::Create(VCLUnoHelper::GetBitmap(xBmp));
}
else if(xGraphic.is())
{
- maGraphicObject = Graphic(xGraphic);
+ m_rGraphicObject = GraphicObject::Create(xGraphic);
}
}
@@ -633,10 +637,10 @@ bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt
sal_Bool XFillBitmapItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
{
- const GraphicObject& aGraphicObjectA(((XFillBitmapItem*)p1)->GetGraphicObject());
- const GraphicObject& aGraphicObjectB(((XFillBitmapItem*)p2)->GetGraphicObject());
+ const rtl::Reference<GraphicObject> rGraphicObjectA = (((XFillBitmapItem*)p1)->GetGraphicObject());
+ const rtl::Reference<GraphicObject> rGraphicObjectB = (((XFillBitmapItem*)p2)->GetGraphicObject());
- return aGraphicObjectA == aGraphicObjectB;
+ return rGraphicObjectA == rGraphicObjectB;
}
//////////////////////////////////////////////////////////////////////////////
@@ -654,7 +658,7 @@ XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const
// if the given name is not valid, replace it!
if( aUniqueName != GetName() )
{
- return new XFillBitmapItem(aUniqueName, maGraphicObject);
+ return new XFillBitmapItem(aUniqueName, m_rGraphicObject);
}
}
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
index 5f1124eb15cb..7d239210150c 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -71,36 +71,36 @@ XOutdevItemPool::XOutdevItemPool(
mppLocalPoolDefaults[XATTR_LINESTYLE -XATTR_START] = new XLineStyleItem;
mppLocalPoolDefaults[XATTR_LINEDASH -XATTR_START] = new XLineDashItem(this,aNullDash);
mppLocalPoolDefaults[XATTR_LINEWIDTH -XATTR_START] = new XLineWidthItem;
- mppLocalPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr,aNullLineCol);
- mppLocalPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(this,aNullPol);
- mppLocalPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem (this,aNullPol);
+ mppLocalPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr, aNullLineCol);
+ mppLocalPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(this, aNullPol);
+ mppLocalPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem(this, aNullPol);
mppLocalPoolDefaults[XATTR_LINESTARTWIDTH -XATTR_START] = new XLineStartWidthItem;
mppLocalPoolDefaults[XATTR_LINEENDWIDTH -XATTR_START] = new XLineEndWidthItem;
mppLocalPoolDefaults[XATTR_LINESTARTCENTER -XATTR_START] = new XLineStartCenterItem;
mppLocalPoolDefaults[XATTR_LINEENDCENTER -XATTR_START] = new XLineEndCenterItem;
mppLocalPoolDefaults[XATTR_LINETRANSPARENCE -XATTR_START] = new XLineTransparenceItem;
- mppLocalPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem;
+ mppLocalPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem;
mppLocalPoolDefaults[XATTR_LINECAP -XATTR_START] = new XLineCapItem;
- mppLocalPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem;
- mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol);
- mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(aNullGrad);
- mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (this,aNullHatch);
- mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this, aNullGraphic);
- mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem;
- mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETX -XATTR_START] = new XFillBmpTileOffsetXItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETY -XATTR_START] = new XFillBmpTileOffsetYItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem;
- mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem;
- mppLocalPoolDefaults[XATTR_FILLFLOATTRANSPARENCE -XATTR_START] = new XFillFloatTransparenceItem( this, aNullGrad, sal_False );
- mppLocalPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol);
- mppLocalPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem;
+ mppLocalPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem;
+ mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem(aNullStr, aNullFillCol);
+ mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(aNullGrad);
+ mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem(this, aNullHatch);
+ mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem(this, GraphicObject::Create(aNullGraphic));
+ mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem;
+ mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETX-XATTR_START] = new XFillBmpTileOffsetXItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETY-XATTR_START] = new XFillBmpTileOffsetYItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem;
+ mppLocalPoolDefaults[XATTR_FILLFLOATTRANSPARENCE-XATTR_START] = new XFillFloatTransparenceItem( this, aNullGrad, sal_False );
+ mppLocalPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol);
+ mppLocalPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem;
mppLocalPoolDefaults[XATTR_FORMTXTSTYLE -XATTR_START] = new XFormTextStyleItem;
mppLocalPoolDefaults[XATTR_FORMTXTADJUST -XATTR_START] = new XFormTextAdjustItem;
mppLocalPoolDefaults[XATTR_FORMTXTDISTANCE -XATTR_START] = new XFormTextDistanceItem;
@@ -108,7 +108,7 @@ XOutdevItemPool::XOutdevItemPool(
mppLocalPoolDefaults[XATTR_FORMTXTMIRROR -XATTR_START] = new XFormTextMirrorItem;
mppLocalPoolDefaults[XATTR_FORMTXTOUTLINE -XATTR_START] = new XFormTextOutlineItem;
mppLocalPoolDefaults[XATTR_FORMTXTSHADOW -XATTR_START] = new XFormTextShadowItem;
- mppLocalPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol);
+ mppLocalPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr, aNullShadowCol);
mppLocalPoolDefaults[XATTR_FORMTXTSHDWXVAL -XATTR_START] = new XFormTextShadowXValItem;
mppLocalPoolDefaults[XATTR_FORMTXTSHDWYVAL -XATTR_START] = new XFormTextShadowYValItem;
mppLocalPoolDefaults[XATTR_FORMTXTHIDEFORM -XATTR_START] = new XFormTextHideFormItem;
diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx
index 961c501b3356..282b287ee328 100644
--- a/svx/source/xoutdev/xtabbtmp.cxx
+++ b/svx/source/xoutdev/xtabbtmp.cxx
@@ -49,40 +49,40 @@ uno::Reference< container::XNameContainer > XBitmapList::createInstance()
bool XBitmapList::Create()
{
- String aStr(SVX_RESSTR(RID_SVXSTR_BITMAP));
+ OUString aStr(SVX_RESSTR(RID_SVXSTR_BITMAP));
+ OUString aTmp;
sal_uInt16 aArray[64];
Bitmap aBitmap;
- const xub_StrLen nLen(aStr.Len() - 1);
memset(aArray, 0, sizeof(aArray));
// white/white bitmap
- aStr.AppendAscii(" 1");
+ aTmp = aStr + " 1";
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_WHITE), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aTmp));
// black/white bitmap
aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1;
aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1;
- aStr.SetChar(nLen, sal_Unicode('2'));
+ aTmp = aStr + " 2";
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aTmp));
// lightred/white bitmap
aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1;
aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1;
- aStr.SetChar(nLen, sal_Unicode('3'));
+ aTmp = aStr + " 3";
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTRED), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aTmp));
// lightblue/white bitmap
aArray[24] = 1; aArray[25] = 1; aArray[26] = 1;
aArray[29] = 1; aArray[30] = 1; aArray[31] = 1;
- aStr.SetChar(nLen, sal_Unicode('4'));
+ aTmp = aStr + " 4";
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTBLUE), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr));
+ Insert(new XBitmapEntry(GraphicObject::Create(Graphic(aBitmap)), aTmp));
- return sal_True;
+ return true;
}
Bitmap XBitmapList::CreateBitmapForUI( long /*nIndex*/ )
diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx
index 0da58d45486b..ec3f089b2880 100644
--- a/svx/source/xoutdev/xtabdash.cxx
+++ b/svx/source/xoutdev/xtabdash.cxx
@@ -33,7 +33,7 @@
using namespace com::sun::star;
-XDashList::XDashList(const String& rPath)
+XDashList::XDashList(const OUString& rPath)
: XPropertyList(XDASH_LIST, rPath)
, maBitmapSolidLine()
, maStringSolidLine()
@@ -68,16 +68,14 @@ uno::Reference< container::XNameContainer > XDashList::createInstance()
bool XDashList::Create()
{
- XubString aStr(SVX_RESSTR(RID_SVXSTR_LINESTYLE));
- xub_StrLen nLen;
-
- aStr.AppendAscii(" 1");
- nLen = aStr.Len() - 1;
- Insert(new XDashEntry(XDash(XDASH_RECT,1, 50,1, 50, 50),aStr));
- aStr.SetChar(nLen, sal_Unicode('2'));
- Insert(new XDashEntry(XDash(XDASH_RECT,1,500,1,500,500),aStr));
- aStr.SetChar(nLen, sal_Unicode('3'));
- Insert(new XDashEntry(XDash(XDASH_RECT,2, 50,3,250,120),aStr));
+ OUString aStr(SVX_RESSTR(RID_SVXSTR_LINESTYLE));
+ OUString aTmp;
+ aTmp = aStr + " 1";
+ Insert(new XDashEntry(XDash(XDASH_RECT,1, 50,1, 50, 50),aTmp));
+ aTmp = aStr + " 2";
+ Insert(new XDashEntry(XDash(XDASH_RECT,1,500,1,500,500),aTmp));
+ aTmp = aStr + " 3";
+ Insert(new XDashEntry(XDash(XDASH_RECT,2, 50,3,250,120),aTmp));
return true;
}
@@ -202,9 +200,9 @@ Bitmap XDashList::GetBitmapForUISolidLine() const
return maBitmapSolidLine;
}
-String XDashList::GetStringForUiSolidLine() const
+OUString XDashList::GetStringForUiSolidLine() const
{
- if(!maStringSolidLine.Len())
+ if(maStringSolidLine.isEmpty())
{
const_cast< XDashList* >(this)->maStringSolidLine = ResId(RID_SVXSTR_SOLID, DIALOG_MGR()).toString();
}
@@ -212,9 +210,9 @@ String XDashList::GetStringForUiSolidLine() const
return maStringSolidLine;
}
-String XDashList::GetStringForUiNoLine() const
+OUString XDashList::GetStringForUiNoLine() const
{
- if(!maStringNoLine.Len())
+ if(maStringNoLine.isEmpty())
{
// formally was RID_SVXSTR_INVISIBLE, but tomake equal
// everywhere, use RID_SVXSTR_NONE
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index 9853a0ecb410..c187b908908c 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -34,7 +34,7 @@
using namespace com::sun::star;
-XGradientList::XGradientList( const String& rPath )
+XGradientList::XGradientList( const OUString& rPath )
: XPropertyList( XGRADIENT_LIST, rPath )
{
}
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
index 111907284342..c32c1d0288a4 100644
--- a/svx/source/xoutdev/xtabhtch.cxx
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -34,7 +34,7 @@
using namespace ::com::sun::star;
using namespace ::rtl;
-XHatchList::XHatchList(const String& rPath)
+XHatchList::XHatchList(const OUString& rPath)
: XPropertyList( XHATCH_LIST, rPath )
{
}
diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx
index 5fd2d5e558e5..0333278c2f60 100644
--- a/svx/source/xoutdev/xtable.cxx
+++ b/svx/source/xoutdev/xtable.cxx
@@ -40,7 +40,7 @@ Color RGB_Color( ColorData nColorName )
//////////////////////////////////////////////////////////////////////////////
// class XColorEntry
-XColorEntry::XColorEntry(const Color& rColor, const String& rName)
+XColorEntry::XColorEntry(const Color& rColor, const OUString& rName)
: XPropertyEntry(rName),
aColor(rColor)
{
@@ -55,7 +55,7 @@ aColor(rOther.aColor)
//////////////////////////////////////////////////////////////////////////////
// class XLineEndEntry
-XLineEndEntry::XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName)
+XLineEndEntry::XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const OUString& rName)
: XPropertyEntry(rName),
aB2DPolyPolygon(rB2DPolyPolygon)
{
@@ -70,7 +70,7 @@ XLineEndEntry::XLineEndEntry(const XLineEndEntry& rOther)
//////////////////////////////////////////////////////////////////////////////
// class XDashEntry
-XDashEntry::XDashEntry(const XDash& rDash, const String& rName)
+XDashEntry::XDashEntry(const XDash& rDash, const OUString& rName)
: XPropertyEntry(rName),
aDash(rDash)
{
@@ -85,7 +85,7 @@ aDash(rOther.aDash)
//////////////////////////////////////////////////////////////////////////////
// class XHatchEntry
-XHatchEntry::XHatchEntry(const XHatch& rHatch, const String& rName)
+XHatchEntry::XHatchEntry(const XHatch& rHatch, const OUString& rName)
: XPropertyEntry(rName),
aHatch(rHatch)
{
@@ -100,7 +100,7 @@ XHatchEntry::XHatchEntry(const XHatchEntry& rOther)
//////////////////////////////////////////////////////////////////////////////
// class XGradientEntry
-XGradientEntry::XGradientEntry(const XGradient& rGradient, const String& rName)
+XGradientEntry::XGradientEntry(const XGradient& rGradient, const OUString& rName)
: XPropertyEntry(rName),
aGradient(rGradient)
{
@@ -115,28 +115,27 @@ XGradientEntry::XGradientEntry(const XGradientEntry& rOther)
//////////////////////////////////////////////////////////////////////////////
// class XBitmapEntry
-XBitmapEntry::XBitmapEntry(const GraphicObject& rGraphicObject, const String& rName)
+XBitmapEntry::XBitmapEntry(const rtl::Reference<GraphicObject>& rGraphicObject, const OUString& rName)
: XPropertyEntry(rName),
- maGraphicObject(rGraphicObject)
+ m_rGraphicObject(rGraphicObject)
{
}
XBitmapEntry::XBitmapEntry(const XBitmapEntry& rOther)
: XPropertyEntry(rOther),
- maGraphicObject(rOther.maGraphicObject)
+ m_rGraphicObject(rOther.m_rGraphicObject)
{
}
// static int count = 0;
-XPropertyList::XPropertyList(
- XPropertyListType type,
- const String& rPath
-) : meType ( type ),
- maName ( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ),
- maPath ( rPath ),
- mbListDirty ( true ),
- mbEmbedInDocument( false )
+XPropertyList::XPropertyList( XPropertyListType type,
+ const OUString& rPath)
+ : meType ( type )
+ , maName ( "standard" )
+ , maPath ( rPath )
+ , mbListDirty ( true )
+ , mbEmbedInDocument( false )
{
// fprintf (stderr, "Create type %d count %d\n", (int)meType, count++);
}
@@ -170,7 +169,7 @@ XPropertyEntry* XPropertyList::Get( long nIndex ) const
return ( (size_t)nIndex < maList.size() ) ? maList[ nIndex ] : NULL;
}
-long XPropertyList::GetIndex(const XubString& rName) const
+long XPropertyList::GetIndex(const OUString& rName) const
{
if( mbListDirty )
{
@@ -231,9 +230,9 @@ XPropertyEntry* XPropertyList::Remove( long nIndex )
return pEntry;
}
-void XPropertyList::SetName( const String& rString )
+void XPropertyList::SetName( const OUString& rString )
{
- if(rString.Len())
+ if(!rString.isEmpty())
{
maName = rString;
}
@@ -301,7 +300,7 @@ bool XPropertyList::SaveTo( const uno::Reference< embed::XStorage > &xStorage,
}
XPropertyListRef XPropertyList::CreatePropertyList( XPropertyListType t,
- const String& rPath )
+ const OUString& rPath )
{
XPropertyListRef pRet;
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx
index 1dae9c89c33e..4e782027f7ff 100644
--- a/svx/source/xoutdev/xtablend.cxx
+++ b/svx/source/xoutdev/xtablend.cxx
@@ -33,7 +33,7 @@
using namespace com::sun::star;
-XLineEndList::XLineEndList( const String& rPath )
+XLineEndList::XLineEndList( const OUString& rPath )
: XPropertyList( XLINE_END_LIST, rPath )
{
}
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 6f0bf4067b53..df29b0da88ed 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -20,7 +20,8 @@
#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,12 +116,12 @@
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, const rtl::Reference<GraphicObject>& rGrfObj, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*) = 0;
/** Transpose graphic (with undo)
*/
- virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj) = 0;
+ virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const rtl::Reference<GraphicObject>* pGrfObj) = 0;
/** Insert a DrawObject. The object must be already registered
in DrawModel.
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 854b86992bae..350e4ac42393 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, const rtl::Reference<GraphicObject>& rGrfObj, 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,
@@ -878,7 +878,7 @@ public:
const SetAttrMode nFlags,bool bExpandCharToPara=false);
virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&,
const SetAttrMode nFlags);
- virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj);
+ virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const rtl::Reference<GraphicObject>* prGrfObj);
virtual void TransliterateText(const SwPaM& rPaM, utl::TransliterationWrapper&);
virtual SwFlyFrmFmt* InsertOLE(const SwPaM &rRg, const String& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 6e4972193a7f..c1c03117ca62 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -21,6 +21,7 @@
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <rtl/ref.hxx>
#include <tools/string.hxx>
#include <vcl/font.hxx>
#include <editeng/swafopt.hxx>
@@ -604,7 +605,7 @@ public:
(and mark is not set or points to the same graphic). */
const Graphic* GetGraphic( sal_Bool bWait = sal_True ) const;
- const GraphicObject* GetGraphicObj() const;
+ const rtl::Reference<GraphicObject> GetGraphicObj() const;
sal_Bool IsGrfSwapOut( sal_Bool bOnlyLinked = sal_False ) const;
sal_uInt16 GetGraphicType() const;
@@ -627,8 +628,8 @@ public:
/// Re-read if graphic is not ok. Current graphic is replaced by the new one.
void ReRead( const String& rGrfName, const String& rFltName,
- const Graphic* pGraphic = 0,
- const GraphicObject* pGrafObj = 0 );
+ const Graphic* pGraphic = 0,
+ const rtl::Reference<GraphicObject>* prGrafObj = 0 );
/// Unique identification of object (for ImageMapDlg).
void *GetIMapInventor() const;
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 4acccc34125f..bfefa1205ebb 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <rtl/ref.hxx>
#include <svtools/embedhlp.hxx>
#include <bparr.hxx>
@@ -231,7 +232,7 @@ public:
sal_Bool bDelayed = sal_False ); ///< in ndgrf.cxx
SwGrfNode *MakeGrfNode( const SwNodeIndex & rWhere,
- const GraphicObject& rGrfObj,
+ const rtl::Reference<GraphicObject>& rGrfObj,
SwGrfFmtColl *pColl,
SwAttrSet* pAutoAttr = 0 ); ///< in ndgrf.cxx
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 65ff056293f8..933957c0002a 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> m_rGrfObj;
+ rtl::Reference<GraphicObject> m_rReplacementGraphic;
::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,
+ const rtl::Reference<GraphicObject>& rGrfObj,
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 m_rGrfObj->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, rtl::Reference<GraphicObject>* );
/** helper method to determine stream for the embedded graphic.
@@ -128,19 +128,18 @@ 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 m_rGrfObj->GetGraphic(); }
+ const rtl::Reference<GraphicObject> GetGrfObj() const { return m_rGrfObj; }
+ const rtl::Reference<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 DrawGraphicWithPDFHandling(OutputDevice& rOutDev, const Point& rPt, const Size& rSz, const GraphicAttr* pGrfAttr = NULL, const sal_uLong nFlags = GRFMGR_DRAW_STANDARD) { m_rGrfObj->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) { m_rGrfObj->StartAnimation(pOut, rPt, rSz, nExtraData, pAttr, nFlags, pFirstFrameOutDev); }
+ void StopGraphicAnimation(OutputDevice* pOut = NULL, long nExtraData = 0) { m_rGrfObj->StopAnimation(pOut, nExtraData); }
/// allow reaction on change of content of GraphicObject, so always call
/// when GraphicObject content changes
@@ -152,7 +151,7 @@ public:
sal_Bool IsTransparent() const;
- inline sal_Bool IsAnimated() const { return maGrfObj.IsAnimated(); }
+ inline sal_Bool IsAnimated() const { return m_rGrfObj->IsAnimated(); }
inline sal_Bool IsChgTwipSize() const { return bChgTwipSize; }
inline sal_Bool IsChgTwipSizeFromPixel() const { return bChgTwipSizeFromPixel; }
@@ -174,15 +173,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 rtl::Reference<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 ) { m_rGrfObj->SetUserData( r ); }
void SetNewStreamName( const String& r ) { aNewStrmName = r; }
/// Is this node selected by any shell?
sal_Bool IsSelected() const;
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 225933a00af9..1507aeddc166 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -75,8 +75,8 @@ public:
SwCharFmt* GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); }
void SetCharFmt( SwCharFmt* );
- virtual void SetCharFmtName(const String& rSet);
- virtual const String& GetCharFmtName()const;
+ virtual void SetCharFmtName(const OUString& rSet);
+ virtual OUString GetCharFmtName()const;
//For i120928,access the cp info of graphic within bullet
void SetGrfBulletCP(sal_Unicode cP){cGrfBulletCP = cP;}
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 4840727cb3a9..375639502dd3 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,
+SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg, const rtl::Reference<GraphicObject>& rGrfObj,
const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet,
SwFrmFmt* pFrmFmt )
@@ -1934,7 +1934,7 @@ void SwDoc::ResetModified()
void SwDoc::ReRead( SwPaM& rPam, const String& rGrfName,
const String& rFltName, const Graphic* pGraphic,
- const GraphicObject* pGrafObj )
+ const rtl::Reference<GraphicObject>* prGrafObj )
{
SwGrfNode *pGrfNd;
if( ( !rPam.HasMark()
@@ -1951,7 +1951,7 @@ void SwDoc::ReRead( SwPaM& rPam, const String& rGrfName,
GetMirrorGrf().GetValue() )
pGrfNd->SetAttr( SwMirrorGrf() );
- pGrfNd->ReRead( rGrfName, rFltName, pGraphic, pGrafObj, sal_True );
+ pGrfNd->ReRead( rGrfName, rFltName, pGraphic, prGrafObj, sal_True );
SetModified();
}
}
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index ee0565fc52a6..8a8b516815b0 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -529,7 +529,6 @@ sal_Bool SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& ,
}
#define CLEARCACHE( pNd ) {\
- (pNd)->ReleaseGraphicFromCache();\
SwFlyFrm* pFly = FindFlyFrm();\
if( pFly && pFly->GetFmt()->GetSurround().IsContour() )\
{\
@@ -570,7 +569,7 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
if( pVSh )
{
GraphicAttr aAttr;
- if( pNd->GetGrfObj().IsCached( pVSh->GetOut(), Point(),
+ if( pNd->GetGrfObj()->IsCached( pVSh->GetOut(), Point(),
Prt().SSize(), &pNd->GetGraphicAttr( aAttr, this ) ))
{
ViewShell *pSh = pVSh;
@@ -828,7 +827,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
}
bool bForceSwap = false, bContinue = true;
- const GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
+ const rtl::Reference<GraphicObject> rGrfObj = pGrfNd->GetGrfObj();
GraphicAttr aGrfAttr;
pGrfNd->GetGraphicAttr( aGrfAttr, this );
@@ -842,8 +841,8 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
}
// #i85717#, #i90395# - check, if asynchronous retrieval
// if input stream for the graphic is possible
- else if ( ( rGrfObj.GetType() == GRAPHIC_DEFAULT ||
- rGrfObj.GetType() == GRAPHIC_NONE ) &&
+ else if ( ( rGrfObj->GetType() == GRAPHIC_DEFAULT ||
+ rGrfObj->GetType() == GRAPHIC_NONE ) &&
pGrfNd->IsLinkedFile() &&
pGrfNd->IsAsyncRetrieveInputStreamPossible() )
{
@@ -862,7 +861,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, false );
bContinue = false;
}
- else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(),
+ else if( rGrfObj->IsCached( pOut, aAlignedGrfArea.Pos(),
aAlignedGrfArea.SSize(), &aGrfAttr ))
{
pGrfNd->DrawGraphicWithPDFHandling(*pOut,
@@ -874,11 +873,11 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( bContinue )
{
- const sal_Bool bSwapped = rGrfObj.IsSwappedOut();
+ const sal_Bool bSwapped = rGrfObj->IsSwappedOut();
const bool bSwappedIn = 0 != pGrfNd->SwapIn( bPrn );
- if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
+ if( bSwappedIn && rGrfObj->GetGraphic().IsSupportedGraphic())
{
- const bool bAnimate = rGrfObj.IsAnimated() &&
+ const bool bAnimate = rGrfObj->IsAnimated() &&
!pShell->IsPreView() &&
!pShell->GetAccessibilityOptions()->IsStopAnimatedGraphics() &&
// #i9684# Stop animation during printing/pdf export
@@ -906,7 +905,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
}
else
{
- const SvgDataPtr& rSvgDataPtr = rGrfObj.GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = rGrfObj->GetGraphic().getSvgData();
bool bDone(false);
if(rSvgDataPtr.get())
@@ -933,7 +932,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if(bNeedTransformedGraphic)
{
// #i122039# need to apply graphic transformation if GraphicAttr are used qwhich need this
- const Graphic aTransformedGraphic(rGrfObj.GetTransformedGraphic(&aSuppressGraphicAttr));
+ const Graphic aTransformedGraphic(rGrfObj->GetTransformedGraphic(&aSuppressGraphicAttr));
const basegfx::B2DRange aRange(rSvgDataPtr->getRange());
const basegfx::B2DHomMatrix aTransform(
basegfx::tools::createScaleTranslateB2DHomMatrix(
@@ -975,9 +974,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
sal_uInt16 nResId = 0;
if( bSwappedIn )
{
- if( GRAPHIC_NONE == rGrfObj.GetType() )
+ if( GRAPHIC_NONE == rGrfObj->GetType() )
nResId = STR_COMCORE_READERROR;
- else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
+ else if ( !rGrfObj->GetGraphic().IsSupportedGraphic() )
nResId = STR_COMCORE_CANT_SHOW;
}
((SwNoTxtFrm*)this)->nWeight = -1;
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 27b2cb9d1fcd..e2309010099f 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -307,17 +307,17 @@ void SwNumFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
CheckRegistration( pOld, pNew );
}
-void SwNumFmt::SetCharFmtName(const String& rSet)
+void SwNumFmt::SetCharFmtName(const OUString& rSet)
{
SvxNumberFormat::SetCharFmtName(rSet);
}
-const String& SwNumFmt::GetCharFmtName() const
+OUString SwNumFmt::GetCharFmtName() const
{
if((SwCharFmt*)GetRegisteredIn())
return ((SwCharFmt*)GetRegisteredIn())->GetName();
else
- return aEmptyStr;
+ return OUString();
}
void SwNumFmt::SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize,
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index ae8ed8a5cde5..057c4d4b00a1 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -137,7 +137,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
{
SwGrfNode* pSwGrfNode = dynamic_cast< SwGrfNode* >(pCntntNode);
OSL_ENSURE(pSwGrfNode, "Error, pSwGrfNode expected when node answers IsGrfNode() with true (!)");
- const GraphicObject& rGrfObj = pSwGrfNode->GetGrfObj();
+ const rtl::Reference<GraphicObject> rGrfObj = pSwGrfNode->GetGrfObj();
bDontNotify = pSwGrfNode->IsFrameInPaint();
@@ -148,7 +148,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
Graphic aGrf;
if( sfx2::LinkManager::GetGraphicFromAny( rMimeType, rValue, aGrf ) &&
( GRAPHIC_DEFAULT != aGrf.GetType() ||
- GRAPHIC_DEFAULT != rGrfObj.GetType() ) )
+ GRAPHIC_DEFAULT != rGrfObj->GetType() ) )
{
aGrfSz = ::GetGraphicSizeTwip( aGrf, 0 );
if( pSwGrfNode->IsChgTwipSizeFromPixel() )
@@ -175,7 +175,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
bGraphicPieceArrived = sal_False;
}
- pSwGrfNode->SetGraphic(aGrf, rGrfObj.GetLink());
+ pSwGrfNode->SetGraphic(aGrf, rGrfObj->GetLink());
bUpdate = true;
// In order for the Node to have the right transparency status
@@ -246,7 +246,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
if( pBLink != this &&
( !bSwapIn ||
- GRAPHIC_DEFAULT == pGrfNd->GetGrfObj().GetType()))
+ GRAPHIC_DEFAULT == pGrfNd->GetGrfObj()->GetType()))
{
pBLink->bIgnoreDataChanged = sal_False;
pBLink->DataChanged( rMimeType, rValue );
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index c49cb15fd4e3..1465277dda72 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -265,21 +265,28 @@ sal_Bool SwEditShell::IsGrfSwapOut( sal_Bool bOnlyLinked ) const
SwGrfNode *pGrfNode = _GetGrfNode();
return pGrfNode &&
(bOnlyLinked ? ( pGrfNode->IsLinkedFile() &&
- ( GRAPHIC_DEFAULT == pGrfNode->GetGrfObj().GetType()||
- pGrfNode->GetGrfObj().IsSwappedOut()))
- : pGrfNode->GetGrfObj().IsSwappedOut());
+ ( GRAPHIC_DEFAULT == pGrfNode->GetGrfObj()->GetType()||
+ pGrfNode->GetGrfObj()->IsSwappedOut()))
+ : pGrfNode->GetGrfObj()->IsSwappedOut());
}
-const GraphicObject* SwEditShell::GetGraphicObj() const
+const rtl::Reference<GraphicObject> SwEditShell::GetGraphicObj() const
{
SwGrfNode* pGrfNode = _GetGrfNode();
- return pGrfNode ? &(pGrfNode->GetGrfObj()) : 0L;
+ if(pGrfNode)
+ {
+ return pGrfNode->GetGrfObj();
+ }
+ else
+ {
+ return rtl::Reference<GraphicObject>();
+ }
}
sal_uInt16 SwEditShell::GetGraphicType() const
{
SwGrfNode *pGrfNode = _GetGrfNode();
- return static_cast<sal_uInt16>(pGrfNode ? pGrfNode->GetGrfObj().GetType() : GRAPHIC_NONE);
+ return static_cast<sal_uInt16>(pGrfNode ? pGrfNode->GetGrfObj()->GetType() : GRAPHIC_NONE);
}
// returns the size of a graphic in <rSz> if CurCrsr->GetPoint() points to a SwGrfNode and
@@ -301,7 +308,7 @@ sal_Bool SwEditShell::GetGrfSize(Size& rSz) const
/// Read again if graphic is not OK and replace old one
void SwEditShell::ReRead( const String& rGrfName, const String& rFltName,
- const Graphic* pGraphic, const GraphicObject* pGrfObj )
+ const Graphic* pGraphic, const rtl::Reference<GraphicObject>* pGrfObj )
{
StartAllAction();
mpDoc->ReRead( *GetCrsr(), rGrfName, rFltName, pGraphic, pGrfObj );
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index a38e0cd2d901..74aad5eaf4f4 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1480,7 +1480,7 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
if(GRAPHIC_NONE != rGraphic.GetType() && GRAPHIC_DEFAULT != rGraphic.GetType())
{
- aSet.Put(XFillBitmapItem(String(), rGraphic));
+ aSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(rGraphic)));
aSet.Put(XFillStyleItem(XFILL_BITMAP));
}
}
@@ -1563,7 +1563,7 @@ sal_Bool SwFEShell::Paste( const Graphic &rGrf )
SfxItemSet aSet(GetAttrPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(aEmptyStr, rGrf));
+ aSet.Put(XFillBitmapItem(OUString(), GraphicObject::Create(rGrf)));
pView->SetAttributes(aSet, false);
}
return bRet;
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index e874282930f8..207aff4719ec 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -62,33 +62,35 @@ SwGrfNode::SwGrfNode(
SwGrfFmtColl *pGrfColl,
SwAttrSet* pAutoAttr ) :
SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
- maGrfObj(),
- mpReplacementGraphic(0),
+ m_rGrfObj(GraphicObject::Create()),
+ m_rReplacementGraphic(),
// #i73788#
mbLinkedInputStreamReady( false ),
mbIsStreamReadOnly( sal_False )
{
- maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
+ m_rGrfObj->SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel = bLoadLowResGrf =
bFrameInPaint = bScaleImageMap = sal_False;
bGrafikArrived = sal_True;
- ReRead(rGrfName,rFltName, pGraphic, 0, sal_False);
+ ReRead(rGrfName, rFltName, pGraphic, 0, sal_False);
}
SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
- const GraphicObject& rGrfObj,
+ const rtl::Reference<GraphicObject>& rGrfObj,
SwGrfFmtColl *pGrfColl, SwAttrSet* pAutoAttr ) :
SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
- maGrfObj(rGrfObj),
- mpReplacementGraphic(0),
+ m_rGrfObj(rGrfObj),
+ m_rReplacementGraphic(),
// #i73788#
mbLinkedInputStreamReady( false ),
mbIsStreamReadOnly( sal_False )
{
- maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
- if( rGrfObj.HasUserData() && rGrfObj.IsSwappedOut() )
- maGrfObj.SetSwapState();
+ m_rGrfObj->SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
+ if( rGrfObj->HasUserData() && rGrfObj->IsSwappedOut() )
+ {
+ m_rGrfObj->SetSwapState();
+ }
bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel= bLoadLowResGrf =
bFrameInPaint = bScaleImageMap = sal_False;
bGrafikArrived = sal_True;
@@ -105,17 +107,17 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
SwGrfFmtColl *pGrfColl,
SwAttrSet* pAutoAttr ) :
SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr ),
- maGrfObj(),
- mpReplacementGraphic(0),
+ m_rGrfObj(GraphicObject::Create()),
+ m_rReplacementGraphic(),
// #i73788#
mbLinkedInputStreamReady( false ),
mbIsStreamReadOnly( sal_False )
{
- maGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
+ m_rGrfObj->SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
Graphic aGrf; aGrf.SetDefaultType();
- maGrfObj.SetGraphic( aGrf, rGrfName );
-
+ m_rGrfObj->SetLink(rGrfName);
+ m_rGrfObj = GraphicObject::Create(m_rGrfObj, aGrf);
bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel = bLoadLowResGrf =
bFrameInPaint = bScaleImageMap = sal_False;
bGrafikArrived = sal_True;
@@ -135,14 +137,13 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
sal_Bool SwGrfNode::ReRead(
const String& rGrfName, const String& rFltName,
- const Graphic* pGraphic, const GraphicObject* pGrfObj,
+ const Graphic* pGraphic, const rtl::Reference<GraphicObject>* prGrfObj,
sal_Bool bNewGrf )
{
sal_Bool bReadGrf = sal_False, bSetTwipSize = sal_True;
- delete mpReplacementGraphic;
- mpReplacementGraphic = 0;
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
- OSL_ENSURE( pGraphic || pGrfObj || rGrfName.Len(),
+ OSL_ENSURE( pGraphic || prGrfObj || rGrfName.Len(),
"GraphicNode without a name, Graphic or GraphicObject" );
// with name
@@ -182,16 +183,19 @@ sal_Bool SwGrfNode::ReRead(
if( pGraphic )
{
- maGrfObj.SetGraphic( *pGraphic, rGrfName );
+ m_rGrfObj = GraphicObject::Create(m_rGrfObj, *pGraphic);
+ m_rGrfObj->SetLink(rGrfName);
onGraphicChanged();
bReadGrf = sal_True;
}
- else if( pGrfObj )
+ else if( prGrfObj && prGrfObj->is() )
{
- maGrfObj = *pGrfObj;
- if( pGrfObj->HasUserData() && pGrfObj->IsSwappedOut() )
- maGrfObj.SetSwapState();
- maGrfObj.SetLink( rGrfName );
+ m_rGrfObj = *prGrfObj;
+ if( (*prGrfObj)->HasUserData() && (*prGrfObj)->IsSwappedOut() )
+ {
+ m_rGrfObj->SetSwapState();
+ }
+ m_rGrfObj->SetLink( rGrfName );
onGraphicChanged();
bReadGrf = sal_True;
}
@@ -200,7 +204,8 @@ sal_Bool SwGrfNode::ReRead(
// reset data of the old graphic so that the correct placeholder is
// shown in case the new link could not be loaded
Graphic aGrf; aGrf.SetDefaultType();
- maGrfObj.SetGraphic( aGrf, rGrfName );
+ m_rGrfObj = GraphicObject::Create(m_rGrfObj, aGrf);
+ m_rGrfObj->SetLink(rGrfName);
if( refLink.Is() )
{
@@ -226,25 +231,29 @@ sal_Bool SwGrfNode::ReRead(
if( HasStreamName() )
DelStreamName();
- maGrfObj.SetGraphic( *pGraphic );
+ m_rGrfObj = GraphicObject::Create( *pGraphic );
onGraphicChanged();
bReadGrf = sal_True;
}
- else if( pGrfObj && !rGrfName.Len() )
+ else if( prGrfObj && prGrfObj->is() && !rGrfName.Len() )
{
// Old stream must be deleted before the new one is set.
if( HasStreamName() )
DelStreamName();
- maGrfObj = *pGrfObj;
+ m_rGrfObj = *prGrfObj;
onGraphicChanged();
- if( pGrfObj->HasUserData() && pGrfObj->IsSwappedOut() )
- maGrfObj.SetSwapState();
+ if( (*prGrfObj)->HasUserData() && (*prGrfObj)->IsSwappedOut() )
+ {
+ m_rGrfObj->SetSwapState();
+ }
bReadGrf = sal_True;
}
// Was the graphic already loaded?
- else if( !bNewGrf && GRAPHIC_NONE != maGrfObj.GetType() )
+ else if( !bNewGrf && GRAPHIC_NONE != m_rGrfObj->GetType() )
+ {
return sal_True;
+ }
else
{
if( HasStreamName() )
@@ -257,16 +266,17 @@ sal_Bool SwGrfNode::ReRead(
{
if( pGraphic )
{
- maGrfObj.SetGraphic( *pGraphic, rGrfName );
+ m_rGrfObj = GraphicObject::Create( m_rGrfObj, *pGraphic);
+ m_rGrfObj->SetLink( rGrfName );
onGraphicChanged();
bReadGrf = sal_True;
// create connection without update, as we have the graphic
((SwBaseLink*)&refLink)->Connect();
}
- else if( pGrfObj )
+ else if( prGrfObj && prGrfObj->is() )
{
- maGrfObj = *pGrfObj;
- maGrfObj.SetLink( rGrfName );
+ m_rGrfObj = *prGrfObj;
+ m_rGrfObj->SetLink( rGrfName );
onGraphicChanged();
bReadGrf = sal_True;
// create connection without update, as we have the graphic
@@ -277,7 +287,8 @@ sal_Bool SwGrfNode::ReRead(
// reset data of the old graphic so that the correct placeholder is
// shown in case the new link could not be loaded
Graphic aGrf; aGrf.SetDefaultType();
- maGrfObj.SetGraphic( aGrf, rGrfName );
+ m_rGrfObj = GraphicObject::Create(m_rGrfObj, aGrf);
+ m_rGrfObj->SetLink( rGrfName );
onGraphicChanged();
// #i59688# - do not load linked graphic, if it isn't a new linked graphic.
if ( bNewGrf )
@@ -291,8 +302,9 @@ sal_Bool SwGrfNode::ReRead(
// Bug 39281: Do not delete Size immediately - Events on ImageMaps should have
// something to work with when swapping
if( bSetTwipSize )
- SetTwipSize( ::GetGraphicSizeTwip( maGrfObj.GetGraphic(), 0 ) );
-
+ {
+ SetTwipSize( ::GetGraphicSizeTwip( m_rGrfObj->GetGraphic(), 0 ) );
+ }
// create an updates for the frames
if( bReadGrf && bNewGrf )
{
@@ -305,8 +317,7 @@ sal_Bool SwGrfNode::ReRead(
SwGrfNode::~SwGrfNode()
{
- delete mpReplacementGraphic;
- mpReplacementGraphic = 0;
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
// #i73788#
mpThreadConsumer.reset();
@@ -386,23 +397,24 @@ void SwGrfNode::onGraphicChanged()
void SwGrfNode::SetGraphic(const Graphic& rGraphic, const String& rLink)
{
- maGrfObj.SetGraphic(rGraphic, rLink);
+ m_rGrfObj = GraphicObject::Create(m_rGrfObj,rGraphic);
+ m_rGrfObj->SetLink( rLink );
onGraphicChanged();
}
-const GraphicObject* SwGrfNode::GetReplacementGrfObj() const
+const rtl::Reference<GraphicObject> SwGrfNode::GetReplacementGrfObj() const
{
- if(!mpReplacementGraphic)
+ if(!m_rReplacementGraphic.is())
{
- const SvgDataPtr& rSvgDataPtr = GetGrfObj().GetGraphic().getSvgData();
+ const SvgDataPtr& rSvgDataPtr = GetGrfObj()->GetGraphic().getSvgData();
if(rSvgDataPtr.get())
{
- const_cast< SwGrfNode* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement());
+ const_cast< SwGrfNode* >(this)->m_rReplacementGraphic = GraphicObject::Create(rSvgDataPtr->getReplacement());
}
}
- return mpReplacementGraphic;
+ return m_rReplacementGraphic;
}
SwCntntNode *SwGrfNode::SplitCntntNode( const SwPosition & )
@@ -411,29 +423,33 @@ SwCntntNode *SwGrfNode::SplitCntntNode( const SwPosition & )
}
SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere,
- const String& rGrfName,
- const String& rFltName,
- const Graphic* pGraphic,
- SwGrfFmtColl* pGrfColl,
- SwAttrSet* pAutoAttr,
- sal_Bool bDelayed )
+ const String& rGrfName,
+ const String& rFltName,
+ const Graphic* pGraphic,
+ SwGrfFmtColl* pGrfColl,
+ SwAttrSet* pAutoAttr,
+ sal_Bool bDelayed )
{
OSL_ENSURE( pGrfColl, "MakeGrfNode: Formatpointer ist 0." );
SwGrfNode *pNode;
// create object delayed, only from a SW/G-reader
if( bDelayed )
+ {
pNode = new SwGrfNode( rWhere, rGrfName,
rFltName, pGrfColl, pAutoAttr );
+ }
else
+ {
pNode = new SwGrfNode( rWhere, rGrfName,
rFltName, pGraphic, pGrfColl, pAutoAttr );
+ }
return pNode;
}
SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere,
- const GraphicObject& rGrfObj,
- SwGrfFmtColl* pGrfColl,
- SwAttrSet* pAutoAttr )
+ const rtl::Reference<GraphicObject>& rGrfObj,
+ SwGrfFmtColl* pGrfColl,
+ SwAttrSet* pAutoAttr )
{
OSL_ENSURE( pGrfColl, "MakeGrfNode: Formatpointer ist 0." );
return new SwGrfNode( rWhere, rGrfObj, pGrfColl, pAutoAttr );
@@ -447,15 +463,14 @@ Size SwGrfNode::GetTwipSize() const
sal_Bool SwGrfNode::ImportGraphic( SvStream& rStrm )
{
Graphic aGraphic;
- const String aURL(maGrfObj.GetUserData());
+ const OUString aURL(m_rGrfObj->GetUserData());
if(!GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, rStrm))
{
- delete mpReplacementGraphic;
- mpReplacementGraphic = 0;
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
- maGrfObj.SetGraphic( aGraphic );
- maGrfObj.SetUserData( aURL );
+ m_rGrfObj = GraphicObject::Create(m_rGrfObj, aGraphic );
+ m_rGrfObj->SetUserData( aURL );
onGraphicChanged();
return sal_True;
}
@@ -471,7 +486,7 @@ sal_Bool SwGrfNode::ImportGraphic( SvStream& rStrm )
short SwGrfNode::SwapIn( sal_Bool bWaitForData )
{
if( bInSwapIn ) // not recursively!
- return !maGrfObj.IsSwappedOut();
+ return !m_rGrfObj->IsSwappedOut();
short nRet = 0;
bInSwapIn = sal_True;
@@ -479,36 +494,40 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData )
if( pLink )
{
- if( GRAPHIC_NONE == maGrfObj.GetType() ||
- GRAPHIC_DEFAULT == maGrfObj.GetType() )
+ if( GRAPHIC_NONE == m_rGrfObj->GetType() ||
+ GRAPHIC_DEFAULT == m_rGrfObj->GetType() )
{
// link was not loaded yet
if( pLink->SwapIn( bWaitForData ) )
nRet = -1;
- else if( GRAPHIC_DEFAULT == maGrfObj.GetType() )
+ else if( GRAPHIC_DEFAULT == m_rGrfObj->GetType() )
{
// no default bitmap anymore, thus re-paint
- delete mpReplacementGraphic;
- mpReplacementGraphic = 0;
+ m_rReplacementGraphic = rtl::Reference<GraphicObject>();
- maGrfObj.SetGraphic( Graphic() );
+ m_rGrfObj = GraphicObject::Create(m_rGrfObj, Graphic() );
onGraphicChanged();
SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
ModifyNotification( &aMsgHint, &aMsgHint );
}
}
- else if( maGrfObj.IsSwappedOut() ) {
+ else if( m_rGrfObj->IsSwappedOut() )
+ {
// link to download
nRet = pLink->SwapIn( bWaitForData ) ? 1 : 0;
}
else
+ {
nRet = 1;
+ }
}
- else if( maGrfObj.IsSwappedOut() )
+ else if( m_rGrfObj->IsSwappedOut() )
{
// graphic is in storage or in a temp file
if( !HasStreamName() )
- nRet = (short)maGrfObj.SwapIn();
+ {
+ nRet = (short)m_rGrfObj->SwapIn();
+ }
else
{
try
@@ -544,7 +563,7 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData )
if( nRet )
{
if( !nGrfSize.Width() && !nGrfSize.Height() )
- SetTwipSize( ::GetGraphicSizeTwip( maGrfObj.GetGraphic(), 0 ) );
+ SetTwipSize( ::GetGraphicSizeTwip( m_rGrfObj->GetGraphic(), 0 ) );
}
bInSwapIn = sal_False;
return nRet;
@@ -552,9 +571,9 @@ short SwGrfNode::SwapIn( sal_Bool bWaitForData )
short SwGrfNode::SwapOut()
{
- if( maGrfObj.GetType() != GRAPHIC_DEFAULT &&
- maGrfObj.GetType() != GRAPHIC_NONE &&
- !maGrfObj.IsSwappedOut() && !bInSwapIn )
+ if( m_rGrfObj->GetType() != GRAPHIC_DEFAULT &&
+ m_rGrfObj->GetType() != GRAPHIC_NONE &&
+ !m_rGrfObj->IsSwappedOut() && !bInSwapIn )
{
if( !refLink.Is() )
{
@@ -562,11 +581,11 @@ short SwGrfNode::SwapOut()
// The graphic will be written into a temp file if it is new, i.e.
// if there is no stream name in the storage yet
if( !HasStreamName() )
- if( !maGrfObj.SwapOut() )
+ if( !m_rGrfObj->SwapOut() )
return 0;
}
// written graphics and links are removed here
- return (short) maGrfObj.SwapOut( NULL );
+ return (short) m_rGrfObj->SwapOut( NULL );
}
return 1;
}
@@ -671,7 +690,7 @@ void SwGrfNode::InsertLink( const String& rGrfName, const String& rFltName )
(!bSync && rFltName.Len() ? &rFltName : 0) );
}
}
- maGrfObj.SetLink( rGrfName );
+ m_rGrfObj->SetLink( rGrfName );
}
void SwGrfNode::ReleaseLink()
@@ -686,7 +705,7 @@ void SwGrfNode::ReleaseLink()
}
getIDocumentLinksAdministration()->GetLinkManager().Remove( refLink );
refLink.Clear();
- maGrfObj.SetLink();
+ m_rGrfObj->SetLink();
}
}
@@ -790,7 +809,7 @@ void SwGrfNode::DelStreamName()
}
}
- maGrfObj.SetUserData();
+ m_rGrfObj->SetUserData();
}
}
@@ -844,9 +863,9 @@ SvStream* SwGrfNode::_GetStreamForEmbedGrf(
{
xub_StrLen nExtPos = _aStrmName.Search( '.' );
String aExtStr = _aStrmName.Copy( nExtPos );
- if ( GetGrfObj().GetType() != GRAPHIC_NONE )
+ if ( GetGrfObj()->GetType() != GRAPHIC_NONE )
{
- _aStrmName = OStringToOUString(GetGrfObj().GetUniqueID(),
+ _aStrmName = OStringToOUString(GetGrfObj()->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US);
_aStrmName += aExtStr;
}
@@ -874,7 +893,7 @@ void SwGrfNode::_GetStreamStorageNames( String& rStrmName,
rStorName.Erase();
rStrmName.Erase();
- String aUserData( maGrfObj.GetUserData() );
+ String aUserData( m_rGrfObj->GetUserData() );
if( !aUserData.Len() )
return;
@@ -925,7 +944,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
if ( pStrm )
{
- const OUString aURL(maGrfObj.GetUserData());
+ const OUString aURL(m_rGrfObj->GetUserData());
GraphicFilter::GetGraphicFilter().ImportGraphic(aTmpGrf, aURL, *pStrm);
delete pStrm;
}
@@ -938,9 +957,9 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
}
else
{
- if( maGrfObj.IsSwappedOut() )
+ if( m_rGrfObj->IsSwappedOut() )
const_cast<SwGrfNode*>(this)->SwapIn();
- aTmpGrf = maGrfObj.GetGraphic();
+ aTmpGrf = m_rGrfObj->GetGraphic();
}
const sfx2::LinkManager& rMgr = getIDocumentLinksAdministration()->GetLinkManager();
@@ -964,18 +983,20 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
return pGrfNd;
}
-IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj )
+IMPL_LINK( SwGrfNode, SwapGraphic, rtl::Reference<GraphicObject>*, prGrfObj )
{
SvStream* pRet;
// Keep graphic while in swap in. That's at least important
// when breaking links, because in this situation a reschedule call and
// a DataChanged call lead to a paint of the graphic.
- if( pGrfObj->IsInSwapOut() && (IsSelected() || bInSwapIn) )
+ if( (*prGrfObj)->IsInSwapOut() && (IsSelected() || bInSwapIn) )
+ {
pRet = GRFMGR_AUTOSWAPSTREAM_NONE;
+ }
else if( refLink.Is() )
{
- if( pGrfObj->IsInSwapIn() )
+ if( (*prGrfObj)->IsInSwapIn() )
{
// then make it by your self
if( !bInSwapIn )
@@ -1005,7 +1026,7 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj )
SvStream* pStrm = _GetStreamForEmbedGrf( refPics, aStrmName );
if ( pStrm )
{
- if( pGrfObj->IsInSwapOut() )
+ if( (*prGrfObj)->IsInSwapOut() )
{
pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
}
@@ -1029,27 +1050,8 @@ IMPL_LINK( SwGrfNode, SwapGraphic, GraphicObject*, pGrfObj )
}
/// delete all QuickDraw-Bitmaps in the specified document
-void DelAllGrfCacheEntries( SwDoc* pDoc )
+void DelAllGrfCacheEntries( SwDoc* /*pDoc*/ )
{
- if( pDoc )
- {
- // delete all Graphic-Links with this name from cache
- const sfx2::LinkManager& rLnkMgr = pDoc->GetLinkManager();
- const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks();
- SwGrfNode* pGrfNd;
- String sFileNm;
- for( sal_uInt16 n = rLnks.size(); n; )
- {
- ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
- if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() &&
- rLnkMgr.GetDisplayNames( pLnk, 0, &sFileNm ) &&
- pLnk->ISA( SwBaseLink ) && 0 != ( pGrfNd =
- ((SwBaseLink*)pLnk)->GetCntntNode()->GetGrfNode()) )
- {
- pGrfNd->ReleaseGraphicFromCache();
- }
- }
- }
}
/// returns the Graphic-Attr-Structure filled with our graphic attributes
@@ -1110,10 +1112,11 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
sal_Bool SwGrfNode::IsTransparent() const
{
- sal_Bool bRet = maGrfObj.IsTransparent();
+ sal_Bool bRet = m_rGrfObj->IsTransparent();
if( !bRet ) // ask the attribut
+ {
bRet = 0 != GetSwAttrSet().GetTransparencyGrf().GetValue();
-
+ }
return bRet;
}
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 1b25e583d8e1..827bb9bc96b6 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2945,11 +2945,9 @@ sal_Bool SwFlyFrmFmt::IsBackgroundTransparent() const
}
else
{
- const GraphicObject *pTmpGrf =
- static_cast<const GraphicObject*>(GetBackground().GetGraphicObject());
- if ( (pTmpGrf) &&
- (pTmpGrf->GetAttr().GetTransparency() != 0)
- )
+ const rtl::Reference<GraphicObject> rTmpGrf = GetBackground().GetGraphicObject();
+ if ( (rTmpGrf.is()) &&
+ (rTmpGrf->GetAttr().GetTransparency() != 0) )
{
bReturn = sal_True;
}
@@ -2975,7 +2973,7 @@ sal_Bool SwFlyFrmFmt::IsBackgroundBrushInherited() const
sal_Bool bReturn = sal_False;
if ( (GetBackground().GetColor() == COL_TRANSPARENT) &&
- !(GetBackground().GetGraphicObject()) )
+ !(GetBackground().GetGraphicObject().is()) )
{
bReturn = sal_True;
}
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index d92184988db4..5de66739782d 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2614,20 +2614,19 @@ sal_Bool SwFlyFrm::GetContour( PolyPolygon& rContour,
// OD 16.04.2003 #i13147# - determine <GraphicObject> instead of <Graphic>
// in order to avoid load of graphic, if <SwNoTxtNode> contains a graphic
// node and method is called for paint.
- const GraphicObject* pGrfObj = NULL;
- bool bGrfObjCreated = false;
+ rtl::Reference<GraphicObject> rGrfObj;
+
const SwGrfNode* pGrfNd = pNd->GetGrfNode();
if ( pGrfNd && _bForPaint )
{
- pGrfObj = &(pGrfNd->GetGrfObj());
+ rGrfObj = pGrfNd->GetGrfObj();
}
else
{
- pGrfObj = new GraphicObject( pNd->GetGraphic() );
- bGrfObjCreated = true;
+ rGrfObj = GraphicObject::Create( pNd->GetGraphic() );
}
- OSL_ENSURE( pGrfObj, "SwFlyFrm::GetContour() - No Graphic/GraphicObject found at <SwNoTxtNode>." );
- if ( pGrfObj && pGrfObj->GetType() != GRAPHIC_NONE )
+ OSL_ENSURE( rGrfObj.is(), "SwFlyFrm::GetContour() - No Graphic/GraphicObject found at <SwNoTxtNode>." );
+ if ( rGrfObj.is() && rGrfObj->GetType() != GRAPHIC_NONE )
{
if( !pNd->HasContour() )
{
@@ -2653,8 +2652,8 @@ sal_Bool SwFlyFrm::GetContour( PolyPolygon& rContour,
{
OutputDevice* pOutDev = Application::GetDefaultDevice();
const MapMode aDispMap( MAP_TWIP );
- const MapMode aGrfMap( pGrfObj->GetPrefMapMode() );
- const Size aGrfSize( pGrfObj->GetPrefSize() );
+ const MapMode aGrfMap( rGrfObj->GetPrefMapMode() );
+ const Size aGrfSize( rGrfObj->GetPrefSize() );
Size aOrgSize;
Point aNewPoint;
bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
@@ -2686,10 +2685,6 @@ sal_Bool SwFlyFrm::GetContour( PolyPolygon& rContour,
}
}
// OD 17.04.2003 #i13147# - destroy created <GraphicObject>.
- if ( bGrfObjCreated )
- {
- delete pGrfObj;
- }
rContour.Move( aOrig.Left(), aOrig.Top() );
if( !aClip.Width() )
aClip.Width( 1 );
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ca3fcd7ccb5e..edf071702f10 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1654,9 +1654,9 @@ static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
boolean (optional; default: false) indicating, if the background is already drawn.
*/
static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
- OutputDevice* _pOut,
- const SwRect& _rAlignedPaintRect,
- const GraphicObject& _rGraphicObj )
+ OutputDevice* _pOut,
+ const SwRect& _rAlignedPaintRect,
+ const rtl::Reference<GraphicObject>& _rGraphicObj )
{
/// determine color of background
/// If color of background brush is not "no fill"/"auto fill" or
@@ -1676,13 +1676,13 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
bDrawTransparent = true;
nTransparencyPercent = (aColor.GetTransparency()*100 + 0x7F)/0xFF;
}
- else if ( (_rGraphicObj.GetAttr().GetTransparency() != 0) &&
+ else if ( (_rGraphicObj->GetAttr().GetTransparency() != 0) &&
(_rBackgrdBrush.GetColor() == COL_TRANSPARENT) )
/// graphic is drawn transparent and background color is
/// "no fill"/"auto fill" --> draw transparent
{
bDrawTransparent = true;
- nTransparencyPercent = (_rGraphicObj.GetAttr().GetTransparency()*100 + 0x7F)/0xFF;
+ nTransparencyPercent = (_rGraphicObj->GetAttr().GetTransparency()*100 + 0x7F)/0xFF;
}
if ( bDrawTransparent )
@@ -1703,11 +1703,11 @@ static void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
}
static inline void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
- OutputDevice* _pOut,
- const SwRect& _rAlignedPaintRect,
- const GraphicObject& _rGraphicObj,
- bool _bNumberingGraphic,
- bool _bBackgrdAlreadyDrawn = false )
+ OutputDevice* _pOut,
+ const SwRect& _rAlignedPaintRect,
+ const rtl::Reference<GraphicObject>& _rGraphicObj,
+ bool _bNumberingGraphic,
+ bool _bBackgrdAlreadyDrawn = false )
{
/// draw background with background color, if
/// (1) graphic is not used as a numbering AND
@@ -1715,7 +1715,7 @@ static inline void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
/// (3) intrinsic graphic is transparent OR intrinsic graphic doesn't exists
if ( !_bNumberingGraphic &&
!_bBackgrdAlreadyDrawn &&
- ( _rGraphicObj.IsTransparent() || _rGraphicObj.GetType() == GRAPHIC_NONE )
+ ( _rGraphicObj->IsTransparent() || _rGraphicObj->GetType() == GRAPHIC_NONE )
)
{
lcl_implDrawGraphicBackgrd( _rBackgrdBrush, _pOut, _rAlignedPaintRect, _rGraphicObj );
@@ -1754,28 +1754,28 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut,
//Hier kein Link, wir wollen die Grafik synchron laden!
((SvxBrushItem&)rBrush).SetDoneLink( Link() );
- GraphicObject *pGrf = (GraphicObject*)rBrush.GetGraphicObject();
+ rtl::Reference<GraphicObject> rGraphicObject = rBrush.GetGraphicObject();
/// Outsourcing drawing of background with a background color.
- ::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, *pGrf, bGrfNum, bBackgrdAlreadyDrawn );
+ ::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, rGraphicObject, bGrfNum, bBackgrdAlreadyDrawn );
/// Because for drawing a graphic left-top-corner and size coordinations are
/// used, these coordinations have to be determined on pixel level.
::SwAlignGrfRect( &aAlignedGrfRect, *pOut );
- pGrf->DrawWithPDFHandling( *pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() );
+ rGraphicObject->DrawWithPDFHandling( *pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() );
if ( bNotInside )
pOut->Pop();
} // end of method <lcl_DrawGraphic>
void DrawGraphic( const SvxBrushItem *pBrush,
- const XFillStyleItem* pFillStyleItem,
- const XFillGradientItem* pFillGradientItem,
- OutputDevice *pOutDev,
- const SwRect &rOrg,
- const SwRect &rOut,
- const sal_uInt8 nGrfNum,
- const sal_Bool bConsiderBackgroundTransparency )
+ const XFillStyleItem* pFillStyleItem,
+ const XFillGradientItem* pFillGradientItem,
+ OutputDevice *pOutDev,
+ const SwRect &rOrg,
+ const SwRect &rOut,
+ const sal_uInt8 nGrfNum,
+ const sal_Bool bConsiderBackgroundTransparency )
/// Add 6th parameter to indicate that method should
/// consider background transparency, saved in the color of the brush item
{
@@ -1877,12 +1877,12 @@ void DrawGraphic( const SvxBrushItem *pBrush,
{
// draw background of tiled graphic before drawing tiled graphic in loop
// determine graphic object
- GraphicObject* pGraphicObj = const_cast< GraphicObject* >(pBrush->GetGraphicObject());
+ rtl::Reference<GraphicObject> rGraphicObj = pBrush->GetGraphicObject();
// calculate aligned paint rectangle
SwRect aAlignedPaintRect = rOut;
::SwAlignRect( aAlignedPaintRect, &rSh );
// draw background color for aligned paint rectangle
- lcl_DrawGraphicBackgrd( *pBrush, pOutDev, aAlignedPaintRect, *pGraphicObj, bGrfNum );
+ lcl_DrawGraphicBackgrd( *pBrush, pOutDev, aAlignedPaintRect, rGraphicObj, bGrfNum );
// set left-top-corner of background graphic to left-top-corner of the
// area, from which the background brush is determined.
@@ -1919,7 +1919,7 @@ void DrawGraphic( const SvxBrushItem *pBrush,
const Size aSize( aAlignedPaintRect.SSize() );
const double Abitmap( k1/k2 * static_cast<double>(aSize.Width())*aSize.Height() );
- pGraphicObj->DrawTiled( pOutDev,
+ rGraphicObj->DrawTiled( pOutDev,
aAlignedPaintRect.SVRect(),
aGrf.SSize(),
Size( aPaintOffset.X(), aPaintOffset.Y() ),
@@ -1962,10 +1962,10 @@ void DrawGraphic( const SvxBrushItem *pBrush,
(ePos != GPOS_TILED) && (ePos != GPOS_AREA)
)
{
- GraphicObject *pGrf = (GraphicObject*)pBrush->GetGraphicObject();
+ rtl::Reference<GraphicObject> rGrf = pBrush->GetGraphicObject();
if ( bConsiderBackgroundTransparency )
{
- GraphicAttr pGrfAttr = pGrf->GetAttr();
+ GraphicAttr pGrfAttr = rGrf->GetAttr();
if ( (pGrfAttr.GetTransparency() != 0) &&
( pBrush && (pBrush->GetColor() == COL_TRANSPARENT) )
)
@@ -1974,7 +1974,7 @@ void DrawGraphic( const SvxBrushItem *pBrush,
nGrfTransparency = pGrfAttr.GetTransparency();
}
}
- if ( pGrf->IsTransparent() )
+ if ( rGrf->IsTransparent() )
{
bGrfIsTransparent = true;
}
@@ -3717,10 +3717,9 @@ sal_Bool SwFlyFrm::IsBackgroundTransparent() const
}
else
{
- const GraphicObject *pTmpGrf =
- static_cast<const GraphicObject*>(pBackgrdBrush->GetGraphicObject());
- if ( (pTmpGrf) &&
- (pTmpGrf->GetAttr().GetTransparency() != 0)
+ const rtl::Reference<GraphicObject> rTmpGrf = pBackgrdBrush->GetGraphicObject();
+ if ( (rTmpGrf.is()) &&
+ (rTmpGrf->GetAttr().GetTransparency() != 0)
)
{
bBackgroundTransparent = sal_True;
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index f3a0da997631..2b88fd8fc17c 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -187,7 +187,7 @@ void SwExtraPainter::PaintExtra( SwTwips nY, long nAsc, long nMax, bool bRed )
{
// Line number is stronger than the divider
const OUString aTmp( HasNumber() ? rLineInf.GetNumType().GetNumStr( nLineNr )
- : rLineInf.GetDivider() );
+ : OUString(rLineInf.GetDivider()) );
// Get script type of line numbering:
pFnt->SetActual( SwScriptInfo::WhichFont( 0, &aTmp, 0 ) );
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index d0ec1efb18e2..6ee6e824c5d2 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1172,7 +1172,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
FN_UNO_GRAPHIC_FILTER == pEntry->nWID)
{
String sGrfName, sFltName;
- GraphicObject *pGrfObj = 0;
+ rtl::Reference<GraphicObject> rGrfObj;
pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, &sFltName );
OUString uTemp;
aValue >>= uTemp;
@@ -1183,9 +1183,9 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
if( sTmp.EqualsAscii( sPackageProtocol,
0, sizeof( sPackageProtocol )-1 ) )
{
- pGrfObj = new GraphicObject;
- pGrfObj->SetUserData( sTmp );
- pGrfObj->SetSwapState();
+ rGrfObj = GraphicObject::Create();
+ rGrfObj->SetUserData( sTmp );
+ rGrfObj->SetSwapState();
sGrfName.Erase();
}
else if( sTmp.EqualsAscii( sGraphicObjectProtocol,
@@ -1194,7 +1194,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
OString sId(OUStringToOString(
sTmp.Copy(sizeof(sGraphicObjectProtocol)-1),
RTL_TEXTENCODING_ASCII_US));
- pGrfObj = new GraphicObject( sId );
+ rGrfObj = GraphicObject::Create( sId );
sGrfName.Erase();
}
else
@@ -1215,14 +1215,12 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
if(!pGrfNode)
{
- delete pGrfObj;
throw uno::RuntimeException();
}
SwPaM aGrfPaM(*pGrfNode);
pFmt->GetDoc()->ReRead( aGrfPaM, sGrfName, sFltName, 0,
- pGrfObj );
+ &rGrfObj );
}
- delete pGrfObj;
}
else if( FN_UNO_GRAPHIC == pEntry->nWID )
{
@@ -1252,7 +1250,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
Graphic aGraphic;
if( bURL )
{
- GraphicObject *pGrfObj = 0;
+ rtl::Reference<GraphicObject> rGrfObj;
OUString aGrfUrl;
aValue >>= aGrfUrl;
@@ -1264,8 +1262,8 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
OString sId(OUStringToOString(
aGrfUrl.copy(sizeof(sGraphicObjectProtocol)-1),
RTL_TEXTENCODING_ASCII_US));
- pGrfObj = new GraphicObject( sId );
- aGraphic = pGrfObj->GetGraphic();
+ rGrfObj = GraphicObject::Create( sId );
+ aGraphic = rGrfObj->GetGraphic();
bApply = true;
}
}
@@ -1569,7 +1567,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
{
OUString sPrefix( RTL_CONSTASCII_USTRINGPARAM(sGraphicObjectProtocol) );
OUString sId(OStringToOUString(
- pGrfNode->GetGrfObj().GetUniqueID(),
+ pGrfNode->GetGrfObj()->GetUniqueID(),
RTL_TEXTENCODING_ASCII_US));
sGrfName = sPrefix + sId;
}
@@ -1588,12 +1586,12 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
if(!pGrfNode)
throw uno::RuntimeException();
- const GraphicObject* pGraphicObject = pGrfNode->GetReplacementGrfObj();
+ const rtl::Reference<GraphicObject> rGraphicObject = pGrfNode->GetReplacementGrfObj();
- if(pGraphicObject)
+ if(rGraphicObject.is())
{
OUString sPrefix( sGraphicObjectProtocol );
- (sGrfName = sPrefix) += OStringToOUString( pGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US );
+ (sGrfName = sPrefix) += OStringToOUString( rGraphicObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US );
}
}
@@ -2232,7 +2230,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
UnoActionContext aCont(pDoc);
const ::uno::Any* pGraphicURL;
String sGraphicURL;
- GraphicObject *pGrfObj = 0;
+ rtl::Reference<GraphicObject> rGrfObj;
if(pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL))
{
OUString uTemp;
@@ -2241,9 +2239,9 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
if( sGraphicURL.EqualsAscii( sPackageProtocol,
0, sizeof( sPackageProtocol )-1 ) )
{
- pGrfObj = new GraphicObject;
- pGrfObj->SetUserData( sGraphicURL );
- pGrfObj->SetSwapState();
+ rGrfObj = GraphicObject::Create();
+ rGrfObj->SetUserData( sGraphicURL );
+ rGrfObj->SetSwapState();
sGraphicURL.Erase();
}
else if( sGraphicURL.EqualsAscii( sGraphicObjectProtocol,
@@ -2252,7 +2250,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
OString sId(OUStringToOString(
sGraphicURL.Copy( sizeof(sGraphicObjectProtocol)-1 ),
RTL_TEXTENCODING_ASCII_US));
- pGrfObj = new GraphicObject( sId );
+ rGrfObj = GraphicObject::Create( sId );
sGraphicURL.Erase();
}
}
@@ -2275,11 +2273,10 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
}
pFmt =
- pGrfObj ? pDoc->Insert( aPam, *pGrfObj, &aFrmSet, &aGrSet,
+ rGrfObj.is() ? pDoc->Insert( aPam, rGrfObj, &aFrmSet, &aGrSet,
pParentFrmFmt )
: pDoc->Insert( aPam, sGraphicURL, sFltName, &aGraphic,
&aFrmSet, &aGrSet, pParentFrmFmt );
- delete pGrfObj;
if(pFmt)
{
SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFmt->GetCntnt().GetCntntIdx()
diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx
index 44fbb39269dc..d4dbbf844db7 100644
--- a/sw/source/filter/html/htmlbas.cxx
+++ b/sw/source/filter/html/htmlbas.cxx
@@ -273,7 +273,7 @@ void SwHTMLWriter::OutBasic()
for( sal_uInt16 i=0; i<pBasicMan->GetLibCount(); i++ )
{
StarBASIC *pBasic = pBasicMan->GetLib( i );
- const String& rLibName = pBasic->GetName();
+ const OUString& rLibName = pBasic->GetName();
SbxArray *pModules = pBasic->GetModules();
for( sal_uInt16 j=0; j<pModules->Count(); j++ )
@@ -300,7 +300,7 @@ void SwHTMLWriter::OutBasic()
<< "\">";
}
- const String& rModName = pModule->GetName();
+ const OUString& rModName = pModule->GetName();
Strm() << SwHTMLWriter::sNewLine; // nicht einruecken!
HTMLOutFuncs::OutScript( Strm(), GetBaseURL(), pModule->GetSource(),
sLang, eType, aEmptyStr,
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index d976e1a7a53e..c876fd82ec1b 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -81,10 +81,10 @@ const sal_uInt32 HTML_FRMOPTS_IMG_CONTROL_CSS1 =
static void lcl_html_outEvents( SvStream& rStrm,
- const uno::Reference< form::XFormComponent > rFormComp,
- sal_Bool bCfgStarBasic,
- rtl_TextEncoding eDestEnc,
- String *pNonConvertableChars )
+ const uno::Reference< form::XFormComponent > rFormComp,
+ sal_Bool bCfgStarBasic,
+ rtl_TextEncoding eDestEnc,
+ OUString* pNonConvertableChars )
{
uno::Reference< container::XChild > xChild( rFormComp, uno::UNO_QUERY );
uno::Reference< uno::XInterface > xParentIfc = xChild->getParent();
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 5df779fb17fe..3a525ab564e8 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -436,7 +436,7 @@ sal_uLong SwHTMLWriter::WriteStream()
for( i=0; i<MAXLEVEL; i++ )
aBulletGrfs[i].Erase();
- aNonConvertableCharacters.Erase();
+ aNonConvertableCharacters= "";
if( bShowProgress )
::EndProgress( pDoc->GetDocShell() );
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index 97d37a1271d5..c19d9d97d464 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -303,7 +303,7 @@ public:
SwHTMLTxtFtns *pFootEndNotes;
String aCSS1Selector; // der Selektor eines Styles
- String aNonConvertableCharacters;
+ OUString aNonConvertableCharacters;
String aBulletGrfs[MAXLEVEL]; // die Grafiken fuer Listen
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > *pxFormComps; // die aktuelle Form
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index cb2f88540e8a..1536ee8288e5 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -444,7 +444,7 @@ void RtfSdrExport::impl_writeGraphic()
xPropertySet->getPropertyValue("GraphicURL") >>= sGraphicURL;
OString aURLBS(OUStringToOString(sGraphicURL, RTL_TEXTENCODING_UTF8));
const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
- Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
+ Graphic aGraphic = GraphicObject::Create(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)))->GetTransformedGraphic();
// Export it to a stream.
SvMemoryStream aStream;
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 08c68a074be8..d9fbdfe5356c 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -674,7 +674,7 @@ namespace sw
SwGrfNode *pGrfNode = const_cast<SwGrfNode*>(rNd.GetGrfNode());
if (pGrfNode && (GRAPHIC_NONE != pGrfNode->GetGrf().GetType()))
{
- bool bWasSwappedOut = pGrfNode->GetGrfObj().IsSwappedOut();
+ bool bWasSwappedOut = pGrfNode->GetGrfObj()->IsSwappedOut();
pGrfNode->SwapIn();
aGrTwipSz = pGrfNode->GetTwipSize();
if (bWasSwappedOut)
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index ecd54e861087..bde8b853cd2d 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1344,8 +1344,8 @@ sal_Int32 SwBasicEscherEx::WriteGrfBullet(const Graphic& rGrf)
OpenContainer( ESCHER_SpContainer );
AddShape(ESCHER_ShpInst_PictureFrame, 0xa00,0x401);
EscherPropertyContainer aPropOpt;
- GraphicObject aGraphicObject( rGrf );
- OString aUniqueId = aGraphicObject.GetUniqueID();
+ rtl::Reference<GraphicObject> rGraphicObject = GraphicObject::Create( rGrf );
+ OString aUniqueId = rGraphicObject->GetUniqueID();
if ( !aUniqueId.isEmpty() )
{
const MapMode aMap100mm( MAP_100TH_MM );
@@ -1431,8 +1431,8 @@ sal_Int32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nSh
pGrfNd->SwapIn(true);
Graphic aGraphic(pGrfNd->GetGrf());
- GraphicObject aGraphicObject( aGraphic );
- OString aUniqueId = aGraphicObject.GetUniqueID();
+ rtl::Reference<GraphicObject> rGraphicObject = GraphicObject::Create( aGraphic );
+ OString aUniqueId = rGraphicObject->GetUniqueID();
if (!aUniqueId.isEmpty())
{
@@ -1639,12 +1639,13 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush,
{
bool bSetOpacity = false;
sal_uInt32 nOpaque = 0;
- if (const GraphicObject *pGraphicObject = rBrush.GetGraphicObject())
+ const rtl::Reference<GraphicObject> rGraphicObject = rBrush.GetGraphicObject();
+ if (rGraphicObject.is())
{
- OString aUniqueId = pGraphicObject->GetUniqueID();
+ OString aUniqueId = rGraphicObject->GetUniqueID();
if (!aUniqueId.isEmpty())
{
- const Graphic &rGraphic = pGraphicObject->GetGraphic();
+ const Graphic &rGraphic = rGraphicObject->GetGraphic();
Size aSize(rGraphic.GetPrefSize());
const MapMode aMap100mm(MAP_100TH_MM);
if (MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit())
@@ -1667,7 +1668,7 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush,
rPropOpt.AddOpt(ESCHER_Prop_fillBlip,nBlibId,sal_True);
}
- if (0 != (nOpaque = pGraphicObject->GetAttr().GetTransparency()))
+ if (0 != (nOpaque = rGraphicObject->GetAttr().GetTransparency()))
bSetOpacity = true;
rPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
@@ -2813,8 +2814,8 @@ void SwBasicEscherEx::WriteOLEPicture(EscherPropertyContainer &rPropOpt,
//nShapeFlags == 0xA00 + flips and ole active
AddShape(ESCHER_ShpInst_PictureFrame, nShapeFlags, nShapeId);
- GraphicObject aGraphicObject(rGraphic);
- OString aId = aGraphicObject.GetUniqueID();
+ rtl::Reference<GraphicObject> rGraphicObject = GraphicObject::Create(rGraphic);
+ OString aId = rGraphicObject->GetUniqueID();
if (!aId.isEmpty())
{
Rectangle aRect = rObj.GetLogicRect();
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index ce1b721f83a1..d1b3108209bc 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1804,18 +1804,18 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject* pSdrObj,
break;
case XFILL_BITMAP:
{
- GraphicObject aGrfObj(static_cast< XFillBitmapItem const & >(rOldSet.Get(XATTR_FILLBITMAP)).GetGraphicObject());
+ rtl::Reference<GraphicObject> rGrfObj = (static_cast< XFillBitmapItem const & >(rOldSet.Get(XATTR_FILLBITMAP)).GetGraphicObject());
const bool bTile(WW8ITEMVALUE(rOldSet, XATTR_FILLBMP_TILE, SfxBoolItem) ? true: false);
if(bBrushItemOk) //has trans
{
- GraphicAttr aAttr(aGrfObj.GetAttr());
+ GraphicAttr aAttr(rGrfObj->GetAttr());
aAttr.SetTransparency(nTrans);
- aGrfObj.SetAttr(aAttr);
+ rGrfObj->SetAttr(aAttr);
}
- aBrushItem.SetGraphicObject(aGrfObj);
+ aBrushItem.SetGraphicObject(rGrfObj);
aBrushItem.SetGraphicPos(bTile ? GPOS_TILED : GPOS_AREA);
bBrushItemOk = true;
}
diff --git a/sw/source/filter/xml/xmlbrsh.cxx b/sw/source/filter/xml/xmlbrsh.cxx
index f42aa8064dd7..a9c3bb81f50d 100644
--- a/sw/source/filter/xml/xmlbrsh.cxx
+++ b/sw/source/filter/xml/xmlbrsh.cxx
@@ -121,15 +121,14 @@ SvXMLImportContext *SwXMLBrushItemImportContext::CreateChildContext(
{
if( !xBase64Stream.is() && !pItem->GetGraphicLink() )
{
- const GraphicObject *pGrObj = pItem->GetGraphicObject();
- if( !pGrObj || GRAPHIC_NONE == pGrObj->GetType() )
+ const rtl::Reference<GraphicObject> rGrObj = pItem->GetGraphicObject();
+ if( !rGrObj.is() || GRAPHIC_NONE == rGrObj->GetType() )
{
- xBase64Stream =
- GetImport().GetStreamForGraphicObjectURLFromBase64();
+ xBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64();
if( xBase64Stream.is() )
pContext = new XMLBase64ImportContext( GetImport(), nPrefix,
- rLocalName, xAttrList,
- xBase64Stream );
+ rLocalName, xAttrList,
+ xBase64Stream );
}
}
}
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 33108c062559..e270e3ef74f7 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -169,11 +169,11 @@ void SwGrfShell::Execute(SfxRequest &rReq)
{
// When the graphic is selected to be opened via some external tool
// for advanced editing
- GraphicObject *pGraphicObject = (GraphicObject *) rSh.GetGraphicObj();
- if(0 != pGraphicObject)
+ rtl::Reference<GraphicObject> rGraphicObject = rSh.GetGraphicObj();
+ if(rGraphicObject.is())
{
SwExternalToolEdit* externalToolEdit = new SwExternalToolEdit( &rSh );
- externalToolEdit->Edit ( pGraphicObject );
+ externalToolEdit->Edit ( rGraphicObject );
}
}
break;
@@ -263,10 +263,10 @@ void SwGrfShell::Execute(SfxRequest &rReq)
else
{
// #119353# - robust
- const GraphicObject* pGrfObj = rSh.GetGraphicObj();
- if ( pGrfObj )
+ const rtl::Reference<GraphicObject> rGrfObj = rSh.GetGraphicObj();
+ if ( rGrfObj.is() )
{
- aSet.Put( SvxBrushItem( *pGrfObj, GPOS_LT,
+ aSet.Put( SvxBrushItem( rGrfObj, GPOS_LT,
SID_ATTR_GRAF_GRAPHIC ) );
}
}
@@ -548,14 +548,15 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq )
if( GRAPHIC_BITMAP == nGrfType )
{
// #119353# - robust
- const GraphicObject* pFilterObj( GetShell().GetGraphicObj() );
- if ( pFilterObj )
+ rtl::Reference<GraphicObject> rFilterObj = GetShell().GetGraphicObj();
+ if ( rFilterObj.is() )
{
- GraphicObject aFilterObj( *pFilterObj );
if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ))
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, &rFilterObj ))
+ {
GetShell().ReRead( aEmptyStr, aEmptyStr,
- &aFilterObj.GetGraphic() );
+ &rFilterObj->GetGraphic() );
+ }
}
}
break;
@@ -667,15 +668,19 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
if( !bParentCntProt )
{
// #119353# - robust
- const GraphicObject* pGrafObj = rSh.GetGraphicObj();
- if ( pGrafObj )
+ const rtl::Reference<GraphicObject> rGrafObj = rSh.GetGraphicObj();
+ if ( rGrafObj.is() )
{
- if( pGrafObj->IsAnimated() ||
- GRAPHIC_GDIMETAFILE == pGrafObj->GetType() )
+ if( rGrafObj->IsAnimated() ||
+ GRAPHIC_GDIMETAFILE == rGrafObj->GetType() )
+ {
bDisable = true;
+ }
else
+ {
rSet.Put( SfxUInt16Item( nWhich, ((SwTransparencyGrf&)
aCoreSet.Get(RES_GRFATR_TRANSPARENCY)).GetValue() ));
+ }
}
}
break;
diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx
index f55e3f22fdaf..6fc6e32adbb7 100644
--- a/sw/source/ui/shells/txtnum.cxx
+++ b/sw/source/ui/shells/txtnum.cxx
@@ -126,11 +126,13 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
{
const SvxBrushItem* pBrush = aFmt.GetBrush();
- const String* pLinkStr;
+ const OUString* pLinkStr;
if(pBrush &&
0 != (pLinkStr = pBrush->GetGraphicLink()) &&
- pLinkStr->Len())
+ !pLinkStr->isEmpty())
+ {
aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
+ }
aRule.SetLevel(i, aFmt, aRule.Get(i) != 0);
}
}
@@ -289,11 +291,13 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
{
const SvxBrushItem* pBrush = aFmt.GetBrush();
- const String* pLinkStr;
+ const OUString* pLinkStr;
if(pBrush &&
- 0 != (pLinkStr = pBrush->GetGraphicLink()) &&
- pLinkStr->Len())
+ 0 != (pLinkStr = pBrush->GetGraphicLink()) &&
+ !pLinkStr->isEmpty())
+ {
aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
+ }
aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0);
}
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index beff267d64a4..0fd06a3499f1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -705,7 +705,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
if (aURLBS.compareTo(aURLBegin, RTL_CONSTASCII_LENGTH(aURLBegin)) == 0)
{
- Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();
+ Graphic aGraphic = GraphicObject::Create(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)))->GetTransformedGraphic();
Size aSize(aGraphic.GetPrefSize());
MapMode aMap(MAP_100TH_MM);
if (aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL)