wrap more stuff in VclPtr

Change-Id: I2f0d8a4fe426d8ee1ac55a05ae8dd0b44f9aab2b
This commit is contained in:
Noel Grandin 2015-03-20 14:59:22 +02:00 committed by Michael Meeks
parent e0eecf8ad5
commit 58a43332b3
22 changed files with 90 additions and 90 deletions

View File

@ -82,6 +82,8 @@ bool containsWindowSubclass(const Type* pType0);
bool containsWindowSubclass(const QualType& qType) { bool containsWindowSubclass(const QualType& qType) {
if (startsWith(qType.getAsString(), "VclPtr")) if (startsWith(qType.getAsString(), "VclPtr"))
return false; return false;
if (startsWith(qType.getAsString(), "const VclPtr"))
return false;
if (startsWith(qType.getAsString(), "class VclPtr")) if (startsWith(qType.getAsString(), "class VclPtr"))
return false; return false;
if (startsWith(qType.getAsString(), "const class VclPtr")) if (startsWith(qType.getAsString(), "const class VclPtr"))

View File

@ -1396,7 +1396,7 @@ void FontCollectionEntry::ImplInit( const OUString& rName )
FontCollection::~FontCollection() FontCollection::~FontCollection()
{ {
delete pVDev; pVDev.disposeAndClear();
xPPTBreakIter = NULL; xPPTBreakIter = NULL;
} }

View File

@ -141,7 +141,7 @@ SdTransferable::~SdTransferable()
delete mpBookmark; delete mpBookmark;
delete mpImageMap; delete mpImageMap;
delete mpVDev; mpVDev.disposeAndClear();
delete mpObjDesc; delete mpObjDesc;
//call explicitly at end of dtor to be covered by above SolarMutex //call explicitly at end of dtor to be covered by above SolarMutex

View File

@ -126,7 +126,7 @@ protected:
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE; virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE;
private: private:
::std::unique_ptr<VirtualDevice> mpPreviewDevice; ScopedVclPtr<VirtualDevice> mpPreviewDevice;
::std::unique_ptr<DrawView> mpView; ::std::unique_ptr<DrawView> mpView;
DrawDocShell* mpDocShellOfView; DrawDocShell* mpDocShellOfView;
const Color maFrameColor; const Color maFrameColor;

View File

@ -75,7 +75,7 @@ private:
VclPtr<sd::Window> mpTargetWindow; VclPtr<sd::Window> mpTargetWindow;
class LayerContainer; class LayerContainer;
::boost::scoped_ptr<LayerContainer> mpLayers; ::boost::scoped_ptr<LayerContainer> mpLayers;
::boost::scoped_ptr<VirtualDevice> mpBackBuffer; ScopedVclPtr<VirtualDevice> mpBackBuffer;
MapMode maSavedMapMode; MapMode maSavedMapMode;
void RepaintRectangle (const Rectangle& rRepaintRectangle); void RepaintRectangle (const Rectangle& rRepaintRectangle);

View File

@ -160,7 +160,7 @@ Bitmap PageObjectPainter::CreateMarkedPreview (
const BitmapEx& rOverlay, const BitmapEx& rOverlay,
const OutputDevice* pReferenceDevice) const const OutputDevice* pReferenceDevice) const
{ {
::boost::scoped_ptr<VirtualDevice> pDevice; ScopedVclPtr<VirtualDevice> pDevice;
if (pReferenceDevice != NULL) if (pReferenceDevice != NULL)
pDevice.reset(new VirtualDevice(*pReferenceDevice)); pDevice.reset(new VirtualDevice(*pReferenceDevice));
else else

View File

@ -256,7 +256,7 @@ namespace {
{ {
public: public:
PrintInfo ( PrintInfo (
const Printer* pPrinter, Printer* pPrinter,
const bool bPrintMarkedOnly) const bool bPrintMarkedOnly)
: mpPrinter(pPrinter), : mpPrinter(pPrinter),
mnDrawMode(DRAWMODE_DEFAULT), mnDrawMode(DRAWMODE_DEFAULT),
@ -269,7 +269,7 @@ namespace {
mbPrintMarkedOnly(bPrintMarkedOnly) mbPrintMarkedOnly(bPrintMarkedOnly)
{} {}
const Printer* mpPrinter; const VclPtr<Printer> mpPrinter;
sal_uLong mnDrawMode; sal_uLong mnDrawMode;
OUString msTimeDate; OUString msTimeDate;
OUString msPageString; OUString msPageString;
@ -1338,7 +1338,7 @@ private:
SfxObjectShellRef mxObjectShell; // destroying mpPrintView SfxObjectShellRef mxObjectShell; // destroying mpPrintView
ViewShellBase& mrBase; ViewShellBase& mrBase;
bool mbIsDisposed; bool mbIsDisposed;
Printer* mpPrinter; VclPtr<Printer> mpPrinter;
Size maPrinterPageSizePixel; Size maPrinterPageSizePixel;
::boost::scoped_ptr<PrintOptions> mpOptions; ::boost::scoped_ptr<PrintOptions> mpOptions;
::std::vector< ::boost::shared_ptr< ::sd::PrinterPage> > maPrinterPages; ::std::vector< ::boost::shared_ptr< ::sd::PrinterPage> > maPrinterPages;
@ -1423,7 +1423,7 @@ private:
PrintInfo aInfo (mpPrinter, mpOptions->IsPrintMarkedOnly()); PrintInfo aInfo (mpPrinter, mpOptions->IsPrintMarkedOnly());
if (aInfo.mpPrinter!=NULL && pShell!=NULL) if (aInfo.mpPrinter!=nullptr && pShell!=NULL)
{ {
MapMode aMap (aInfo.mpPrinter->GetMapMode()); MapMode aMap (aInfo.mpPrinter->GetMapMode());
@ -1880,7 +1880,7 @@ private:
const PageKind ePageKind, const PageKind ePageKind,
PrintInfo& rInfo) PrintInfo& rInfo)
{ {
OSL_ASSERT(rInfo.mpPrinter != NULL); OSL_ASSERT(rInfo.mpPrinter != nullptr);
// Fill in page kind specific data. // Fill in page kind specific data.
SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc(); SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc();

View File

@ -91,7 +91,7 @@ DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell*
DrawView::~DrawView() DrawView::~DrawView()
{ {
delete mpVDev; mpVDev.disposeAndClear();
} }
/** /**
@ -459,8 +459,7 @@ void DrawView::CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sd
{ {
if( mpVDev ) if( mpVDev )
{ {
delete mpVDev; mpVDev.disposeAndClear();
mpVDev = NULL;
} }
bool bStandardPaint = true; bool bStandardPaint = true;

View File

@ -607,11 +607,11 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
{ {
if ( !sPrinterName.isEmpty() ) if ( !sPrinterName.isEmpty() )
{ {
SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); VclPtr<SfxPrinter> pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
if (pNewPrinter->IsKnown()) if (pNewPrinter->IsKnown())
pDocSh->SetPrinter ( pNewPrinter ); pDocSh->SetPrinter ( pNewPrinter );
else else
delete pNewPrinter; pNewPrinter.disposeAndClear();
} }
} }
else else

View File

@ -21,6 +21,7 @@
#define INCLUDED_SW_SOURCE_CORE_INC_FNTCACHE_HXX #define INCLUDED_SW_SOURCE_CORE_INC_FNTCACHE_HXX
#include <vcl/font.hxx> #include <vcl/font.hxx>
#include <vcl/vclptr.hxx>
#include <tools/mempool.hxx> #include <tools/mempool.hxx>
#include "swtypes.hxx" #include "swtypes.hxx"
#include "swcache.hxx" #include "swcache.hxx"

View File

@ -338,7 +338,7 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const
class SwMinMaxArgs class SwMinMaxArgs
{ {
public: public:
OutputDevice* pOut; VclPtr<OutputDevice> pOut;
SwViewShell const * pSh; SwViewShell const * pSh;
sal_uLong &rMin; sal_uLong &rMin;
sal_uLong &rMax; sal_uLong &rMax;

View File

@ -67,7 +67,7 @@ Color *pWaveCol = 0;
long SwFntObj::nPixWidth; long SwFntObj::nPixWidth;
MapMode* SwFntObj::pPixMap = NULL; MapMode* SwFntObj::pPixMap = NULL;
OutputDevice* SwFntObj::pPixOut = NULL; VclPtr<OutputDevice> SwFntObj::pPixOut;
namespace namespace
{ {
@ -1401,7 +1401,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if ( pPrinter ) if ( pPrinter )
{ {
// pTmpFont has already been set as current font for rInf.GetOut() // pTmpFont has already been set as current font for rInf.GetOut()
if ( pPrinter != rInf.GetpOut() || pTmpFont != pPrtFont ) if ( pPrinter.get() != rInf.GetpOut() || pTmpFont != pPrtFont )
{ {
if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) ) if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) )
pPrinter->SetFont( *pPrtFont ); pPrinter->SetFont( *pPrtFont );
@ -1886,7 +1886,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
// This is the part used e.g., for cursor travelling // This is the part used e.g., for cursor travelling
// See condition for DrawText or DrawTextArray (bDirectPrint) // See condition for DrawText or DrawTextArray (bDirectPrint)
if ( pPrinter && pPrinter != rInf.GetpOut() ) if ( pPrinter && pPrinter.get() != rInf.GetpOut() )
{ {
if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) ) if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) )
pPrinter->SetFont(*pPrtFont); pPrinter->SetFont(*pPrtFont);
@ -2247,7 +2247,7 @@ SwFntAccess::SwFntAccess( const void* &rMagic,
( !pFntObj->pPrinter || pFntObj->pPrinter == pOut ) ) ) ( !pFntObj->pPrinter || pFntObj->pPrinter == pOut ) ) )
pFntObj = pFntCache->Next( pFntObj ); pFntObj = pFntCache->Next( pFntObj );
if( pFntObj && pFntObj->pPrinter != pOut ) if( pFntObj && pFntObj->pPrinter.get() != pOut )
{ {
// found one without printer, let's see if there is one with // found one without printer, let's see if there is one with
// the same printer as well // the same printer as well
@ -2272,7 +2272,7 @@ SwFntAccess::SwFntAccess( const void* &rMagic,
else // Font has been found, so we lock it. else // Font has been found, so we lock it.
{ {
pFntObj->Lock(); pFntObj->Lock();
if (pFntObj->pPrinter != pOut) // if no printer is known by now if (pFntObj->pPrinter.get() != pOut) // if no printer is known by now
{ {
OSL_ENSURE( !pFntObj->pPrinter, "SwFntAccess: Printer Changed" ); OSL_ENSURE( !pFntObj->pPrinter, "SwFntAccess: Printer Changed" );
pFntObj->CreatePrtFont( *pOut ); pFntObj->CreatePrtFont( *pOut );

View File

@ -322,7 +322,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
pRegion->Compress(); pRegion->Compress();
VirtualDevice *pVout = 0; VclPtr<VirtualDevice> pVout;
while ( !pRegion->empty() ) while ( !pRegion->empty() )
{ {
SwRect aRect( pRegion->back() ); SwRect aRect( pRegion->back() );
@ -375,7 +375,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
aMapMode.SetOrigin( aOrigin ); aMapMode.SetOrigin( aOrigin );
pVout->SetMapMode( aMapMode ); pVout->SetMapMode( aMapMode );
mpOut = pVout; mpOut = pVout.get();
if ( bPaintsFromSystem ) if ( bPaintsFromSystem )
PaintDesktop( aRect ); PaintDesktop( aRect );
pCurrentLayout->Paint( aRect ); pCurrentLayout->Paint( aRect );
@ -411,7 +411,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
lcl_PaintTransparentFormControls(*this, aRect); // i#107365 lcl_PaintTransparentFormControls(*this, aRect); // i#107365
} }
delete pVout; pVout.disposeAndClear();
delete pRegion; delete pRegion;
Imp()->DelRegion(); Imp()->DelRegion();
} }
@ -464,7 +464,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() ) if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() )
{ {
//Refresh with virtual device to avoid flickering. //Refresh with virtual device to avoid flickering.
VirtualDevice *pVout = new VirtualDevice( *mpOut ); VclPtr<VirtualDevice> pVout = new VirtualDevice( *mpOut );
pVout->SetMapMode( mpOut->GetMapMode() ); pVout->SetMapMode( mpOut->GetMapMode() );
Size aSize( VisArea().SSize() ); Size aSize( VisArea().SSize() );
aSize.Width() += 20; aSize.Width() += 20;
@ -483,7 +483,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
DLPrePaint2(aRepaintRegion); DLPrePaint2(aRepaintRegion);
OutputDevice *pOld = mpOut; OutputDevice *pOld = mpOut;
mpOut = pVout; mpOut = pVout.get();
Paint( VisArea().SVRect() ); Paint( VisArea().SVRect() );
mpOut = pOld; mpOut = pOld;
mpOut->DrawOutDev( VisArea().Pos(), aSize, mpOut->DrawOutDev( VisArea().Pos(), aSize,
@ -500,7 +500,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
GetWin()->EnablePaint( true ); GetWin()->EnablePaint( true );
GetWin()->Invalidate( INVALIDATE_CHILDREN ); GetWin()->Invalidate( INVALIDATE_CHILDREN );
} }
delete pVout; pVout.disposeAndClear();
} }
else else
{ {
@ -1207,7 +1207,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect
//create virtual device and set. //create virtual device and set.
const Size aPixSz = GetWin()->PixelToLogic(Size(1,1)); const Size aPixSz = GetWin()->PixelToLogic(Size(1,1));
VirtualDevice *pVout = new VirtualDevice( *GetWin() ); VclPtr<VirtualDevice> pVout = new VirtualDevice( *GetWin() );
pVout->SetLineColor( GetWin()->GetLineColor() ); pVout->SetLineColor( GetWin()->GetLineColor() );
pVout->SetFillColor( GetWin()->GetFillColor() ); pVout->SetFillColor( GetWin()->GetFillColor() );
MapMode aMapMode( GetWin()->GetMapMode() ); MapMode aMapMode( GetWin()->GetMapMode() );
@ -1239,7 +1239,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect
aMapMode.SetOrigin( aPt ); aMapMode.SetOrigin( aPt );
pVout->SetMapMode( aMapMode ); pVout->SetMapMode( aMapMode );
OutputDevice *pOld = mpOut; OutputDevice *pOld = mpOut;
mpOut = pVout; mpOut = pVout.get();
{ {
// #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the // #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the
@ -1384,14 +1384,14 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect
--mnLockPaint; --mnLockPaint;
} }
} }
delete pVout; pVout.disposeAndClear();
GetWin()->Update(); GetWin()->Update();
if ( !Imp()->bStopSmooth ) if ( !Imp()->bStopSmooth )
--mnLockPaint; --mnLockPaint;
SetFirstVisPageInvalid(); SetFirstVisPageInvalid();
return true; return true;
} }
delete pVout; pVout.disposeAndClear();
} }
#endif #endif

View File

@ -72,7 +72,7 @@ class SwDropCapsPict : public Control
long mnLineH; long mnLineH;
long mnTextH; long mnTextH;
sal_uInt16 mnDistance; sal_uInt16 mnDistance;
Printer* mpPrinter; VclPtr<Printer> mpPrinter;
bool mbDelPrinter; bool mbDelPrinter;
/// The _ScriptInfo structure holds information on where we change from one /// The _ScriptInfo structure holds information on where we change from one
/// script to another. /// script to another.
@ -209,7 +209,7 @@ SwDropCapsPict::~SwDropCapsPict()
void SwDropCapsPict::dispose() void SwDropCapsPict::dispose()
{ {
if( mbDelPrinter ) if( mbDelPrinter )
delete mpPrinter; mpPrinter.disposeAndClear();
mpPage.clear(); mpPage.clear();
Control::dispose(); Control::dispose();
} }

View File

@ -636,9 +636,7 @@ void SwStdFontTabPage::dispose()
{ {
delete pFontList; delete pFontList;
if (bDeletePrinter) if (bDeletePrinter)
{ pPrt.disposeAndClear();
delete pPrt;
}
pLabelFT.clear(); pLabelFT.clear();
pStandardBox.clear(); pStandardBox.clear();
pStandardHeightLB.clear(); pStandardHeightLB.clear();
@ -833,7 +831,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
if (bDeletePrinter) if (bDeletePrinter)
{ {
delete pPrt; pPrt.disposeAndClear();
} }
if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_PRINTER, false, &pItem)) if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_PRINTER, false, &pItem))

View File

@ -312,7 +312,7 @@ SwMailMergeOutputPage::~SwMailMergeOutputPage()
void SwMailMergeOutputPage::dispose() void SwMailMergeOutputPage::dispose()
{ {
delete m_pTempPrinter; m_pTempPrinter.disposeAndClear();
m_pSaveStartDocRB.clear(); m_pSaveStartDocRB.clear();
m_pSaveMergedDocRB.clear(); m_pSaveMergedDocRB.clear();
m_pPrintRB.clear(); m_pPrintRB.clear();
@ -848,7 +848,7 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox)
if( (m_pTempPrinter->GetName() != pInfo->GetPrinterName()) || if( (m_pTempPrinter->GetName() != pInfo->GetPrinterName()) ||
(m_pTempPrinter->GetDriverName() != pInfo->GetDriver()) ) (m_pTempPrinter->GetDriverName() != pInfo->GetDriver()) )
{ {
delete m_pTempPrinter; m_pTempPrinter.disposeAndClear();
m_pTempPrinter = new Printer( *pInfo ); m_pTempPrinter = new Printer( *pInfo );
} }
} }

View File

@ -67,7 +67,7 @@ SwLabPrtPage::~SwLabPrtPage()
void SwLabPrtPage::dispose() void SwLabPrtPage::dispose()
{ {
delete pPrinter; pPrinter.disposeAndClear();
m_pPageButton.clear(); m_pPageButton.clear();
m_pSingleButton.clear(); m_pSingleButton.clear();
m_pSingleGrid.clear(); m_pSingleGrid.clear();

View File

@ -931,7 +931,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
{ {
const Size aSize(PixelToLogic(GetOutputSizePixel())); const Size aSize(PixelToLogic(GetOutputSizePixel()));
boost::scoped_ptr<VirtualDevice> pVDev(new VirtualDevice(*this)); ScopedVclPtr<VirtualDevice> pVDev(new VirtualDevice(*this));
pVDev->SetMapMode(GetMapMode()); pVDev->SetMapMode(GetMapMode());
pVDev->SetOutputSize( aSize ); pVDev->SetOutputSize( aSize );

View File

@ -61,7 +61,7 @@ protected:
private: private:
SwTableAutoFmt aCurData; SwTableAutoFmt aCurData;
VirtualDevice aVD; ScopedVclPtr<VirtualDevice> aVD;
SvtScriptedTextHelper aScriptedText; SvtScriptedTextHelper aScriptedText;
svx::frame::Array maArray; /// Implementation to draw the frame borders. svx::frame::Array maArray; /// Implementation to draw the frame borders.
bool bFitWidth; bool bFitWidth;
@ -517,8 +517,8 @@ IMPL_LINK_NOARG_INLINE_END(SwAutoFormatDlg, OkHdl)
AutoFmtPreview::AutoFmtPreview(vcl::Window* pParent, WinBits nStyle) : AutoFmtPreview::AutoFmtPreview(vcl::Window* pParent, WinBits nStyle) :
Window ( pParent, nStyle ), Window ( pParent, nStyle ),
aCurData ( OUString() ), aCurData ( OUString() ),
aVD ( *this ), aVD ( new VirtualDevice(*this) ),
aScriptedText ( aVD ), aScriptedText ( *aVD.get() ),
bFitWidth ( false ), bFitWidth ( false ),
mbRTL ( false ), mbRTL ( false ),
aStrJan ( SW_RES( STR_JAN ) ), aStrJan ( SW_RES( STR_JAN ) ),
@ -796,11 +796,11 @@ void AutoFmtPreview::DrawBackground()
{ {
SvxBrushItem aBrushItem( aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() ); SvxBrushItem aBrushItem( aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() );
aVD.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); aVD->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
aVD.SetLineColor(); aVD->SetLineColor();
aVD.SetFillColor( aBrushItem.GetColor() ); aVD->SetFillColor( aBrushItem.GetColor() );
aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) ); aVD->DrawRect( maArray.GetCellRect( nCol, nRow ) );
aVD.Pop(); aVD->Pop();
} }
} }
} }
@ -816,7 +816,7 @@ void AutoFmtPreview::PaintCells()
// 3) border // 3) border
if ( aCurData.IsFrame() ) if ( aCurData.IsFrame() )
maArray.DrawArray( aVD ); maArray.DrawArray( *aVD.get() );
} }
void AutoFmtPreview::Init() void AutoFmtPreview::Init()
@ -885,9 +885,9 @@ void AutoFmtPreview::NotifyChange( const SwTableAutoFmt& rNewData )
void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ ) void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ )
{ {
sal_uInt32 nOldDrawMode = aVD.GetDrawMode(); sal_uInt32 nOldDrawMode = aVD->GetDrawMode();
if( GetSettings().GetStyleSettings().GetHighContrastMode() ) if( GetSettings().GetStyleSettings().GetHighContrastMode() )
aVD.SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); aVD->SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
Bitmap thePreview; Bitmap thePreview;
Point aCenterPos; Point aCenterPos;
@ -895,36 +895,36 @@ void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ )
Color oldColor; Color oldColor;
vcl::Font aFont; vcl::Font aFont;
aFont = aVD.GetFont(); aFont = aVD->GetFont();
aFont.SetTransparent( true ); aFont.SetTransparent( true );
aVD.SetFont ( aFont ); aVD->SetFont ( aFont );
aVD.SetLineColor (); aVD->SetLineColor ();
const Color& rWinColor = GetSettings().GetStyleSettings().GetWindowColor(); const Color& rWinColor = GetSettings().GetStyleSettings().GetWindowColor();
aVD.SetBackground ( Wallpaper(rWinColor) ); aVD->SetBackground ( Wallpaper(rWinColor) );
aVD.SetFillColor ( rWinColor ); aVD->SetFillColor ( rWinColor );
aVD.SetOutputSizePixel ( aPrvSize ); aVD->SetOutputSizePixel ( aPrvSize );
// Draw cells on virtual device // Draw cells on virtual device
// and save the result // and save the result
PaintCells(); PaintCells();
thePreview = aVD.GetBitmap( Point(0,0), aPrvSize ); thePreview = aVD->GetBitmap( Point(0,0), aPrvSize );
// Draw the Frame and center the preview: // Draw the Frame and center the preview:
// (virtual Device for window output) // (virtual Device for window output)
aVD.SetOutputSizePixel( theWndSize ); aVD->SetOutputSizePixel( theWndSize );
oldColor = aVD.GetLineColor(); oldColor = aVD->GetLineColor();
aVD.SetLineColor(); aVD->SetLineColor();
aVD.DrawRect( Rectangle( Point(0,0), theWndSize ) ); aVD->DrawRect( Rectangle( Point(0,0), theWndSize ) );
SetLineColor( oldColor ); SetLineColor( oldColor );
aCenterPos = Point( (theWndSize.Width() - aPrvSize.Width() ) / 2, aCenterPos = Point( (theWndSize.Width() - aPrvSize.Width() ) / 2,
(theWndSize.Height() - aPrvSize.Height()) / 2 ); (theWndSize.Height() - aPrvSize.Height()) / 2 );
aVD.DrawBitmap( aCenterPos, thePreview ); aVD->DrawBitmap( aCenterPos, thePreview );
// Output in the preview window: // Output in the preview window:
DrawBitmap( Point(0,0), aVD.GetBitmap( Point(0,0), theWndSize ) ); DrawBitmap( Point(0,0), aVD->GetBitmap( Point(0,0), theWndSize ) );
aVD.SetDrawMode( nOldDrawMode ); aVD->SetDrawMode( nOldDrawMode );
} }
void AutoFmtPreview::Paint( const Rectangle& rRect ) void AutoFmtPreview::Paint( const Rectangle& rRect )

View File

@ -48,7 +48,7 @@ protected:
bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it) bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it)
Timer maFadeTimer; //< Timer for high/'low'light fading Timer maFadeTimer; //< Timer for high/'low'light fading
int mnFadeRate; //< From 0 to 100. 0 means not highlighted. int mnFadeRate; //< From 0 to 100. 0 means not highlighted.
VirtualDevice maVirDev; //< VirtualDevice of this window. Just for convenience. ScopedVclPtr<VirtualDevice> maVirDev; //< VirtualDevice of this window. Just for convenience.
/** /**
* Callback function to handle a mouse button down event. * Callback function to handle a mouse button down event.

View File

@ -41,7 +41,7 @@ SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEd
, mpSwWin(pWin) , mpSwWin(pWin)
, mbIsHighlighted(false) , mbIsHighlighted(false)
, mnFadeRate(0) , mnFadeRate(0)
, maVirDev( *this ) , maVirDev( new VirtualDevice(*this) )
{ {
// Set fading timeout: 5 x 40ms = 200ms // Set fading timeout: 5 x 40ms = 200ms
maFadeTimer.SetTimeout(40); maFadeTimer.SetTimeout(40);
@ -75,25 +75,25 @@ void SwCommentRuler::DrawCommentControl()
bool bIsCollapsed = ! mpViewShell->GetPostItMgr()->ShowNotes(); bool bIsCollapsed = ! mpViewShell->GetPostItMgr()->ShowNotes();
Rectangle aControlRect = GetCommentControlRegion(); Rectangle aControlRect = GetCommentControlRegion();
maVirDev.SetOutputSizePixel( aControlRect.GetSize() ); maVirDev->SetOutputSizePixel( aControlRect.GetSize() );
// Paint comment control background // Paint comment control background
// TODO Check if these are best colors to be used // TODO Check if these are best colors to be used
Color aBgColor = GetFadedColor( rStyleSettings.GetDarkShadowColor(), rStyleSettings.GetWorkspaceColor() ); Color aBgColor = GetFadedColor( rStyleSettings.GetDarkShadowColor(), rStyleSettings.GetWorkspaceColor() );
maVirDev.SetFillColor( aBgColor ); maVirDev->SetFillColor( aBgColor );
if ( mbIsHighlighted || !bIsCollapsed ) if ( mbIsHighlighted || !bIsCollapsed )
{ {
// Draw borders // Draw borders
maVirDev.SetLineColor( rStyleSettings.GetShadowColor() ); maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
} }
else else
{ {
// No borders // No borders
maVirDev.SetLineColor(); maVirDev->SetLineColor();
} }
maVirDev.DrawRect( Rectangle( Point(), aControlRect.GetSize() ) ); maVirDev->DrawRect( Rectangle( Point(), aControlRect.GetSize() ) );
// Label and arrow tip // Label and arrow tip
OUString aLabel( SW_RESSTR ( STR_COMMENTS_LABEL ) ); OUString aLabel( SW_RESSTR ( STR_COMMENTS_LABEL ) );
@ -142,9 +142,9 @@ void SwCommentRuler::DrawCommentControl()
// Draw label // Draw label
Color aTextColor = GetFadedColor( rStyleSettings.GetButtonTextColor(), rStyleSettings.GetDarkShadowColor() ); Color aTextColor = GetFadedColor( rStyleSettings.GetButtonTextColor(), rStyleSettings.GetDarkShadowColor() );
maVirDev.SetTextColor( aTextColor ); maVirDev->SetTextColor( aTextColor );
// FIXME Expected font size? // FIXME Expected font size?
maVirDev.DrawText( aLabelPos, aLabel ); maVirDev->DrawText( aLabelPos, aLabel );
// Draw arrow // Draw arrow
// FIXME consistence of button colors. http://opengrok.libreoffice.org/xref/core/vcl/source/control/button.cxx#785 // FIXME consistence of button colors. http://opengrok.libreoffice.org/xref/core/vcl/source/control/button.cxx#785
@ -152,26 +152,26 @@ void SwCommentRuler::DrawCommentControl()
ImplDrawArrow ( aArrowPos.X(), aArrowPos.Y(), aArrowColor, bArrowToRight ); ImplDrawArrow ( aArrowPos.X(), aArrowPos.Y(), aArrowColor, bArrowToRight );
// Blit comment control // Blit comment control
DrawOutDev( aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), maVirDev ); DrawOutDev( aControlRect.TopLeft(), aControlRect.GetSize(), Point(), aControlRect.GetSize(), *maVirDev.get() );
} }
void SwCommentRuler::ImplDrawArrow(long nX, long nY, const Color& rColor, bool bPointRight) void SwCommentRuler::ImplDrawArrow(long nX, long nY, const Color& rColor, bool bPointRight)
{ {
maVirDev.SetLineColor(); maVirDev->SetLineColor();
maVirDev.SetFillColor( rColor ); maVirDev->SetFillColor( rColor );
if ( bPointRight ) if ( bPointRight )
{ {
maVirDev.DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) ); maVirDev->DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) );
maVirDev.DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) ); maVirDev->DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) );
maVirDev.DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) ); maVirDev->DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) );
maVirDev.DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) ); maVirDev->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) );
} }
else else
{ {
maVirDev.DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) ); maVirDev->DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) );
maVirDev.DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) ); maVirDev->DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) );
maVirDev.DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) ); maVirDev->DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) );
maVirDev.DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) ); maVirDev->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) );
} }
} }

View File

@ -388,7 +388,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true ); SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
if ( OUString ( pPrinter->GetName()) != sPrinterName ) if ( OUString ( pPrinter->GetName()) != sPrinterName )
{ {
SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); VclPtr<SfxPrinter> pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
if( pNewPrinter->IsKnown() ) if( pNewPrinter->IsKnown() )
{ {
// set printer only once; in _postSetValues // set printer only once; in _postSetValues
@ -396,7 +396,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
} }
else else
{ {
delete pNewPrinter; pNewPrinter.disposeAndClear();
} }
} }
} }
@ -428,7 +428,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet );
// set printer only once; in _postSetValues // set printer only once; in _postSetValues
delete mpPrinter; mpPrinter.disposeAndClear();
mpPrinter = pPrinter; mpPrinter = pPrinter;
} }
} }
@ -826,7 +826,7 @@ void SwXDocumentSettings::_postSetValues ()
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
{ {
// set printer only once, namely here! // set printer only once, namely here!
if( mpPrinter != NULL ) if( mpPrinter != nullptr )
{ {
// #i86352# the printer is also used as container for options by sfx // #i86352# the printer is also used as container for options by sfx
// when setting a printer it should have decent default options // when setting a printer it should have decent default options