summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/atrfrm.cxx9
-rw-r--r--sw/source/core/layout/fly.cxx22
-rw-r--r--sw/source/core/layout/paintfrm.cxx49
3 files changed, 34 insertions, 46 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 7677accdfa81..4a32c47d7ac4 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2945,11 +2945,8 @@ 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> xTmpGrf = GetBackground().GetGraphicObject();
+ if ( xTmpGrf.is() && (xTmpGrf->GetAttr().GetTransparency() != 0) )
{
bReturn = sal_True;
}
@@ -2975,7 +2972,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..46a3570927db 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2614,20 +2614,18 @@ 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> xGrfObj;
const SwGrfNode* pGrfNd = pNd->GetGrfNode();
if ( pGrfNd && _bForPaint )
{
- pGrfObj = &(pGrfNd->GetGrfObj());
+ xGrfObj = pGrfNd->GetGrfObj();
}
else
{
- pGrfObj = new GraphicObject( pNd->GetGraphic() );
- bGrfObjCreated = true;
+ xGrfObj = GraphicObject::Create( pNd->GetGraphic() );
}
- OSL_ENSURE( pGrfObj, "SwFlyFrm::GetContour() - No Graphic/GraphicObject found at <SwNoTxtNode>." );
- if ( pGrfObj && pGrfObj->GetType() != GRAPHIC_NONE )
+ OSL_ENSURE( xGrfObj.is(), "SwFlyFrm::GetContour() - No Graphic/GraphicObject found at <SwNoTxtNode>." );
+ if ( xGrfObj.is() && xGrfObj->GetType() != GRAPHIC_NONE )
{
if( !pNd->HasContour() )
{
@@ -2653,8 +2651,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( xGrfObj->GetPrefMapMode() );
+ const Size aGrfSize( xGrfObj->GetPrefSize() );
Size aOrgSize;
Point aNewPoint;
bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
@@ -2685,11 +2683,7 @@ 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..fab3f7f32938 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,
+ rtl::Reference<GraphicObject> xGraphicObj )
{
/// 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 ( (xGraphicObj->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 = (xGraphicObj->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,
+ rtl::Reference<GraphicObject> xGraphicObj,
+ bool _bNumberingGraphic,
+ bool _bBackgrdAlreadyDrawn = false )
{
/// draw background with background color, if
/// (1) graphic is not used as a numbering AND
@@ -1715,10 +1715,10 @@ 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 )
+ ( xGraphicObj->IsTransparent() || xGraphicObj->GetType() == GRAPHIC_NONE )
)
{
- lcl_implDrawGraphicBackgrd( _rBackgrdBrush, _pOut, _rAlignedPaintRect, _rGraphicObj );
+ lcl_implDrawGraphicBackgrd( _rBackgrdBrush, _pOut, _rAlignedPaintRect, xGraphicObj );
}
}
@@ -1754,15 +1754,15 @@ 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> xGrf = rBrush.GetGraphicObject();
/// Outsourcing drawing of background with a background color.
- ::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, *pGrf, bGrfNum, bBackgrdAlreadyDrawn );
+ ::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, xGrf, 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() );
+ xGrf->DrawWithPDFHandling( *pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() );
if ( bNotInside )
pOut->Pop();
@@ -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> xGraphicObj = 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, xGraphicObj, 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,
+ xGraphicObj->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> xGrf = pBrush->GetGraphicObject();
if ( bConsiderBackgroundTransparency )
{
- GraphicAttr pGrfAttr = pGrf->GetAttr();
+ GraphicAttr pGrfAttr = xGrf->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 ( xGrf->IsTransparent() )
{
bGrfIsTransparent = true;
}
@@ -3717,11 +3717,8 @@ sal_Bool SwFlyFrm::IsBackgroundTransparent() const
}
else
{
- const GraphicObject *pTmpGrf =
- static_cast<const GraphicObject*>(pBackgrdBrush->GetGraphicObject());
- if ( (pTmpGrf) &&
- (pTmpGrf->GetAttr().GetTransparency() != 0)
- )
+ rtl::Reference<GraphicObject> xTmpGrf = pBackgrdBrush->GetGraphicObject();
+ if ( xTmpGrf->GetAttr().GetTransparency() != 0)
{
bBackgroundTransparent = sal_True;
}