summaryrefslogtreecommitdiff
path: root/sw
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 /sw
parent677b93b3993e9a14416275e8bd2a64b12ad91c55 (diff)
wrap GraphicObject in a rtl::Referencefeature/go2
Change-Id: I07842c2920202f39cae054cba866f0d02d767e61
Diffstat (limited to 'sw')
-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
29 files changed, 304 insertions, 295 deletions
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);
}
}