diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-20 14:59:22 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 13:01:47 +0100 |
commit | 58a43332b3a86db3756e6ad18e31189969c85364 (patch) | |
tree | ab71067a374e6b88d5792a4a22ee58d32ffad74b | |
parent | e0eecf8ad57aa207d1db7fc63d9ad8f8d54866e4 (diff) |
wrap more stuff in VclPtr
Change-Id: I2f0d8a4fe426d8ee1ac55a05ae8dd0b44f9aab2b
22 files changed, 90 insertions, 90 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index 092770db5051..2c171d0a6e82 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -82,6 +82,8 @@ bool containsWindowSubclass(const Type* pType0); bool containsWindowSubclass(const QualType& qType) { if (startsWith(qType.getAsString(), "VclPtr")) return false; + if (startsWith(qType.getAsString(), "const VclPtr")) + return false; if (startsWith(qType.getAsString(), "class VclPtr")) return false; if (startsWith(qType.getAsString(), "const class VclPtr")) diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 4bce7232fc2a..b1fc50f631e9 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -1396,7 +1396,7 @@ void FontCollectionEntry::ImplInit( const OUString& rName ) FontCollection::~FontCollection() { - delete pVDev; + pVDev.disposeAndClear(); xPPTBreakIter = NULL; } diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 32b0278d8686..7ae66ff8e5f2 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -141,7 +141,7 @@ SdTransferable::~SdTransferable() delete mpBookmark; delete mpImageMap; - delete mpVDev; + mpVDev.disposeAndClear(); delete mpObjDesc; //call explicitly at end of dtor to be covered by above SolarMutex diff --git a/sd/source/ui/inc/PreviewRenderer.hxx b/sd/source/ui/inc/PreviewRenderer.hxx index 515918491b3c..0333ee0a20c3 100644 --- a/sd/source/ui/inc/PreviewRenderer.hxx +++ b/sd/source/ui/inc/PreviewRenderer.hxx @@ -126,7 +126,7 @@ protected: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE; private: - ::std::unique_ptr<VirtualDevice> mpPreviewDevice; + ScopedVclPtr<VirtualDevice> mpPreviewDevice; ::std::unique_ptr<DrawView> mpView; DrawDocShell* mpDocShellOfView; const Color maFrameColor; diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx index 90156c5b9e82..7dde1cb964f4 100644 --- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx +++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx @@ -75,7 +75,7 @@ private: VclPtr<sd::Window> mpTargetWindow; class LayerContainer; ::boost::scoped_ptr<LayerContainer> mpLayers; - ::boost::scoped_ptr<VirtualDevice> mpBackBuffer; + ScopedVclPtr<VirtualDevice> mpBackBuffer; MapMode maSavedMapMode; void RepaintRectangle (const Rectangle& rRepaintRectangle); diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx index bb1d48e73b9b..1ac2ac0f143e 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx @@ -160,7 +160,7 @@ Bitmap PageObjectPainter::CreateMarkedPreview ( const BitmapEx& rOverlay, const OutputDevice* pReferenceDevice) const { - ::boost::scoped_ptr<VirtualDevice> pDevice; + ScopedVclPtr<VirtualDevice> pDevice; if (pReferenceDevice != NULL) pDevice.reset(new VirtualDevice(*pReferenceDevice)); else diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index ba7826b19d39..59ed7a161fd5 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -256,7 +256,7 @@ namespace { { public: PrintInfo ( - const Printer* pPrinter, + Printer* pPrinter, const bool bPrintMarkedOnly) : mpPrinter(pPrinter), mnDrawMode(DRAWMODE_DEFAULT), @@ -269,7 +269,7 @@ namespace { mbPrintMarkedOnly(bPrintMarkedOnly) {} - const Printer* mpPrinter; + const VclPtr<Printer> mpPrinter; sal_uLong mnDrawMode; OUString msTimeDate; OUString msPageString; @@ -1338,7 +1338,7 @@ private: SfxObjectShellRef mxObjectShell; // destroying mpPrintView ViewShellBase& mrBase; bool mbIsDisposed; - Printer* mpPrinter; + VclPtr<Printer> mpPrinter; Size maPrinterPageSizePixel; ::boost::scoped_ptr<PrintOptions> mpOptions; ::std::vector< ::boost::shared_ptr< ::sd::PrinterPage> > maPrinterPages; @@ -1423,7 +1423,7 @@ private: PrintInfo aInfo (mpPrinter, mpOptions->IsPrintMarkedOnly()); - if (aInfo.mpPrinter!=NULL && pShell!=NULL) + if (aInfo.mpPrinter!=nullptr && pShell!=NULL) { MapMode aMap (aInfo.mpPrinter->GetMapMode()); @@ -1880,7 +1880,7 @@ private: const PageKind ePageKind, PrintInfo& rInfo) { - OSL_ASSERT(rInfo.mpPrinter != NULL); + OSL_ASSERT(rInfo.mpPrinter != nullptr); // Fill in page kind specific data. SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc(); diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index a5ebc69bb11c..5d901ce20148 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -91,7 +91,7 @@ DrawView::DrawView( DrawDocShell* pDocSh, OutputDevice* pOutDev, DrawViewShell* DrawView::~DrawView() { - delete mpVDev; + mpVDev.disposeAndClear(); } /** @@ -459,8 +459,7 @@ void DrawView::CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sd { if( mpVDev ) { - delete mpVDev; - mpVDev = NULL; + mpVDev.disposeAndClear(); } bool bStandardPaint = true; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index b2c6933b4b40..7956ce2d438d 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -607,11 +607,11 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* { if ( !sPrinterName.isEmpty() ) { - SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); + VclPtr<SfxPrinter> pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); if (pNewPrinter->IsKnown()) pDocSh->SetPrinter ( pNewPrinter ); else - delete pNewPrinter; + pNewPrinter.disposeAndClear(); } } else diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index 5cf565c08654..6755965d0f91 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_SOURCE_CORE_INC_FNTCACHE_HXX #include <vcl/font.hxx> +#include <vcl/vclptr.hxx> #include <tools/mempool.hxx> #include "swtypes.hxx" #include "swcache.hxx" diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index 42cd02ac84f2..b85e351b0a82 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -338,7 +338,7 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const class SwMinMaxArgs { public: - OutputDevice* pOut; + VclPtr<OutputDevice> pOut; SwViewShell const * pSh; sal_uLong &rMin; sal_uLong &rMax; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 77894fa20d62..e4726abcb48d 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -67,7 +67,7 @@ Color *pWaveCol = 0; long SwFntObj::nPixWidth; MapMode* SwFntObj::pPixMap = NULL; -OutputDevice* SwFntObj::pPixOut = NULL; +VclPtr<OutputDevice> SwFntObj::pPixOut; namespace { @@ -1401,7 +1401,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) if ( pPrinter ) { // 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() ) ) pPrinter->SetFont( *pPrtFont ); @@ -1886,7 +1886,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf ) // This is the part used e.g., for cursor travelling // See condition for DrawText or DrawTextArray (bDirectPrint) - if ( pPrinter && pPrinter != rInf.GetpOut() ) + if ( pPrinter && pPrinter.get() != rInf.GetpOut() ) { if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) ) pPrinter->SetFont(*pPrtFont); @@ -2247,7 +2247,7 @@ SwFntAccess::SwFntAccess( const void* &rMagic, ( !pFntObj->pPrinter || pFntObj->pPrinter == pOut ) ) ) 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 // the same printer as well @@ -2272,7 +2272,7 @@ SwFntAccess::SwFntAccess( const void* &rMagic, else // Font has been found, so we lock it. { 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" ); pFntObj->CreatePrtFont( *pOut ); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 0d2893c16057..c7efe3c331eb 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -322,7 +322,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) pRegion->Compress(); - VirtualDevice *pVout = 0; + VclPtr<VirtualDevice> pVout; while ( !pRegion->empty() ) { SwRect aRect( pRegion->back() ); @@ -375,7 +375,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) aMapMode.SetOrigin( aOrigin ); pVout->SetMapMode( aMapMode ); - mpOut = pVout; + mpOut = pVout.get(); if ( bPaintsFromSystem ) PaintDesktop( aRect ); pCurrentLayout->Paint( aRect ); @@ -411,7 +411,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd ) lcl_PaintTransparentFormControls(*this, aRect); // i#107365 } - delete pVout; + pVout.disposeAndClear(); delete pRegion; Imp()->DelRegion(); } @@ -464,7 +464,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() ) { //Refresh with virtual device to avoid flickering. - VirtualDevice *pVout = new VirtualDevice( *mpOut ); + VclPtr<VirtualDevice> pVout = new VirtualDevice( *mpOut ); pVout->SetMapMode( mpOut->GetMapMode() ); Size aSize( VisArea().SSize() ); aSize.Width() += 20; @@ -483,7 +483,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) DLPrePaint2(aRepaintRegion); OutputDevice *pOld = mpOut; - mpOut = pVout; + mpOut = pVout.get(); Paint( VisArea().SVRect() ); mpOut = pOld; mpOut->DrawOutDev( VisArea().Pos(), aSize, @@ -500,7 +500,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) GetWin()->EnablePaint( true ); GetWin()->Invalidate( INVALIDATE_CHILDREN ); } - delete pVout; + pVout.disposeAndClear(); } else { @@ -1207,7 +1207,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect //create virtual device and set. const Size aPixSz = GetWin()->PixelToLogic(Size(1,1)); - VirtualDevice *pVout = new VirtualDevice( *GetWin() ); + VclPtr<VirtualDevice> pVout = new VirtualDevice( *GetWin() ); pVout->SetLineColor( GetWin()->GetLineColor() ); pVout->SetFillColor( GetWin()->GetFillColor() ); MapMode aMapMode( GetWin()->GetMapMode() ); @@ -1239,7 +1239,7 @@ bool SwViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect aMapMode.SetOrigin( aPt ); pVout->SetMapMode( aMapMode ); OutputDevice *pOld = mpOut; - mpOut = pVout; + mpOut = pVout.get(); { // #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; } } - delete pVout; + pVout.disposeAndClear(); GetWin()->Update(); if ( !Imp()->bStopSmooth ) --mnLockPaint; SetFirstVisPageInvalid(); return true; } - delete pVout; + pVout.disposeAndClear(); } #endif diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index d5157f7aa07e..d0ba0a42944a 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -72,7 +72,7 @@ class SwDropCapsPict : public Control long mnLineH; long mnTextH; sal_uInt16 mnDistance; - Printer* mpPrinter; + VclPtr<Printer> mpPrinter; bool mbDelPrinter; /// The _ScriptInfo structure holds information on where we change from one /// script to another. @@ -209,7 +209,7 @@ SwDropCapsPict::~SwDropCapsPict() void SwDropCapsPict::dispose() { if( mbDelPrinter ) - delete mpPrinter; + mpPrinter.disposeAndClear(); mpPage.clear(); Control::dispose(); } diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index ee6a85be58e1..236fa93e81e4 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -636,9 +636,7 @@ void SwStdFontTabPage::dispose() { delete pFontList; if (bDeletePrinter) - { - delete pPrt; - } + pPrt.disposeAndClear(); pLabelFT.clear(); pStandardBox.clear(); pStandardHeightLB.clear(); @@ -833,7 +831,7 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet) if (bDeletePrinter) { - delete pPrt; + pPrt.disposeAndClear(); } if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_PRINTER, false, &pItem)) diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 7a95d497a707..82f7116e43a9 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -312,7 +312,7 @@ SwMailMergeOutputPage::~SwMailMergeOutputPage() void SwMailMergeOutputPage::dispose() { - delete m_pTempPrinter; + m_pTempPrinter.disposeAndClear(); m_pSaveStartDocRB.clear(); m_pSaveMergedDocRB.clear(); m_pPrintRB.clear(); @@ -848,7 +848,7 @@ IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox) if( (m_pTempPrinter->GetName() != pInfo->GetPrinterName()) || (m_pTempPrinter->GetDriverName() != pInfo->GetDriver()) ) { - delete m_pTempPrinter; + m_pTempPrinter.disposeAndClear(); m_pTempPrinter = new Printer( *pInfo ); } } diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index de7d3cf3c029..77be9df13fc2 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -67,7 +67,7 @@ SwLabPrtPage::~SwLabPrtPage() void SwLabPrtPage::dispose() { - delete pPrinter; + pPrinter.disposeAndClear(); m_pPageButton.clear(); m_pSingleButton.clear(); m_pSingleGrid.clear(); diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index f0e5c1f94e47..08583bf9f9bd 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -931,7 +931,7 @@ void NumberingPreview::Paint( const Rectangle& /*rRect*/ ) { const Size aSize(PixelToLogic(GetOutputSizePixel())); - boost::scoped_ptr<VirtualDevice> pVDev(new VirtualDevice(*this)); + ScopedVclPtr<VirtualDevice> pVDev(new VirtualDevice(*this)); pVDev->SetMapMode(GetMapMode()); pVDev->SetOutputSize( aSize ); diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index c9da2107798d..977d25f6743d 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -61,7 +61,7 @@ protected: private: SwTableAutoFmt aCurData; - VirtualDevice aVD; + ScopedVclPtr<VirtualDevice> aVD; SvtScriptedTextHelper aScriptedText; svx::frame::Array maArray; /// Implementation to draw the frame borders. bool bFitWidth; @@ -517,8 +517,8 @@ IMPL_LINK_NOARG_INLINE_END(SwAutoFormatDlg, OkHdl) AutoFmtPreview::AutoFmtPreview(vcl::Window* pParent, WinBits nStyle) : Window ( pParent, nStyle ), aCurData ( OUString() ), - aVD ( *this ), - aScriptedText ( aVD ), + aVD ( new VirtualDevice(*this) ), + aScriptedText ( *aVD.get() ), bFitWidth ( false ), mbRTL ( false ), aStrJan ( SW_RES( STR_JAN ) ), @@ -796,11 +796,11 @@ void AutoFmtPreview::DrawBackground() { SvxBrushItem aBrushItem( aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() ); - aVD.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); - aVD.SetLineColor(); - aVD.SetFillColor( aBrushItem.GetColor() ); - aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) ); - aVD.Pop(); + aVD->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); + aVD->SetLineColor(); + aVD->SetFillColor( aBrushItem.GetColor() ); + aVD->DrawRect( maArray.GetCellRect( nCol, nRow ) ); + aVD->Pop(); } } } @@ -816,7 +816,7 @@ void AutoFmtPreview::PaintCells() // 3) border if ( aCurData.IsFrame() ) - maArray.DrawArray( aVD ); + maArray.DrawArray( *aVD.get() ); } void AutoFmtPreview::Init() @@ -885,9 +885,9 @@ void AutoFmtPreview::NotifyChange( const SwTableAutoFmt& rNewData ) void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ ) { - sal_uInt32 nOldDrawMode = aVD.GetDrawMode(); + sal_uInt32 nOldDrawMode = aVD->GetDrawMode(); 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; Point aCenterPos; @@ -895,36 +895,36 @@ void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ ) Color oldColor; vcl::Font aFont; - aFont = aVD.GetFont(); + aFont = aVD->GetFont(); aFont.SetTransparent( true ); - aVD.SetFont ( aFont ); - aVD.SetLineColor (); + aVD->SetFont ( aFont ); + aVD->SetLineColor (); const Color& rWinColor = GetSettings().GetStyleSettings().GetWindowColor(); - aVD.SetBackground ( Wallpaper(rWinColor) ); - aVD.SetFillColor ( rWinColor ); - aVD.SetOutputSizePixel ( aPrvSize ); + aVD->SetBackground ( Wallpaper(rWinColor) ); + aVD->SetFillColor ( rWinColor ); + aVD->SetOutputSizePixel ( aPrvSize ); // Draw cells on virtual device // and save the result PaintCells(); - thePreview = aVD.GetBitmap( Point(0,0), aPrvSize ); + thePreview = aVD->GetBitmap( Point(0,0), aPrvSize ); // Draw the Frame and center the preview: // (virtual Device for window output) - aVD.SetOutputSizePixel( theWndSize ); - oldColor = aVD.GetLineColor(); - aVD.SetLineColor(); - aVD.DrawRect( Rectangle( Point(0,0), theWndSize ) ); + aVD->SetOutputSizePixel( theWndSize ); + oldColor = aVD->GetLineColor(); + aVD->SetLineColor(); + aVD->DrawRect( Rectangle( Point(0,0), theWndSize ) ); SetLineColor( oldColor ); aCenterPos = Point( (theWndSize.Width() - aPrvSize.Width() ) / 2, (theWndSize.Height() - aPrvSize.Height()) / 2 ); - aVD.DrawBitmap( aCenterPos, thePreview ); + aVD->DrawBitmap( aCenterPos, thePreview ); // 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 ) diff --git a/sw/source/uibase/inc/swruler.hxx b/sw/source/uibase/inc/swruler.hxx index 6d2469015bdd..7e57c2abe0ae 100644 --- a/sw/source/uibase/inc/swruler.hxx +++ b/sw/source/uibase/inc/swruler.hxx @@ -48,7 +48,7 @@ protected: bool mbIsHighlighted; //< If comment control is highlighted (mouse is over it) Timer maFadeTimer; //< Timer for high/'low'light fading 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. diff --git a/sw/source/uibase/misc/swruler.cxx b/sw/source/uibase/misc/swruler.cxx index 5440c228d1b4..1d95bd2bc9ac 100644 --- a/sw/source/uibase/misc/swruler.cxx +++ b/sw/source/uibase/misc/swruler.cxx @@ -41,7 +41,7 @@ SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEd , mpSwWin(pWin) , mbIsHighlighted(false) , mnFadeRate(0) -, maVirDev( *this ) +, maVirDev( new VirtualDevice(*this) ) { // Set fading timeout: 5 x 40ms = 200ms maFadeTimer.SetTimeout(40); @@ -75,25 +75,25 @@ void SwCommentRuler::DrawCommentControl() bool bIsCollapsed = ! mpViewShell->GetPostItMgr()->ShowNotes(); Rectangle aControlRect = GetCommentControlRegion(); - maVirDev.SetOutputSizePixel( aControlRect.GetSize() ); + maVirDev->SetOutputSizePixel( aControlRect.GetSize() ); // Paint comment control background // TODO Check if these are best colors to be used Color aBgColor = GetFadedColor( rStyleSettings.GetDarkShadowColor(), rStyleSettings.GetWorkspaceColor() ); - maVirDev.SetFillColor( aBgColor ); + maVirDev->SetFillColor( aBgColor ); if ( mbIsHighlighted || !bIsCollapsed ) { // Draw borders - maVirDev.SetLineColor( rStyleSettings.GetShadowColor() ); + maVirDev->SetLineColor( rStyleSettings.GetShadowColor() ); } else { // No borders - maVirDev.SetLineColor(); + maVirDev->SetLineColor(); } - maVirDev.DrawRect( Rectangle( Point(), aControlRect.GetSize() ) ); + maVirDev->DrawRect( Rectangle( Point(), aControlRect.GetSize() ) ); // Label and arrow tip OUString aLabel( SW_RESSTR ( STR_COMMENTS_LABEL ) ); @@ -142,9 +142,9 @@ void SwCommentRuler::DrawCommentControl() // Draw label Color aTextColor = GetFadedColor( rStyleSettings.GetButtonTextColor(), rStyleSettings.GetDarkShadowColor() ); - maVirDev.SetTextColor( aTextColor ); + maVirDev->SetTextColor( aTextColor ); // FIXME Expected font size? - maVirDev.DrawText( aLabelPos, aLabel ); + maVirDev->DrawText( aLabelPos, aLabel ); // Draw arrow // 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 ); // 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) { - maVirDev.SetLineColor(); - maVirDev.SetFillColor( rColor ); + maVirDev->SetLineColor(); + maVirDev->SetFillColor( rColor ); if ( bPointRight ) { - 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+2, nY+2, nX+2, nY+4 ) ); - maVirDev.DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) ); + 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+2, nY+2, nX+2, nY+4 ) ); + maVirDev->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) ); } else { - 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+2, nY+1, nX+2, nY+5 ) ); - maVirDev.DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) ); + 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+2, nY+1, nX+2, nY+5 ) ); + maVirDev->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) ); } } diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 990c20a25f98..ce19d650523b 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -388,7 +388,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true ); 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() ) { // set printer only once; in _postSetValues @@ -396,7 +396,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf } else { - delete pNewPrinter; + pNewPrinter.disposeAndClear(); } } } @@ -428,7 +428,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); // set printer only once; in _postSetValues - delete mpPrinter; + mpPrinter.disposeAndClear(); mpPrinter = pPrinter; } } @@ -826,7 +826,7 @@ void SwXDocumentSettings::_postSetValues () throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) { // set printer only once, namely here! - if( mpPrinter != NULL ) + if( mpPrinter != nullptr ) { // #i86352# the printer is also used as container for options by sfx // when setting a printer it should have decent default options |