summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/roadmap.hxx1
-rw-r--r--svtools/inc/table/tablecontrol.hxx1
-rw-r--r--svtools/inc/vclxaccessibleheaderbar.hxx2
-rw-r--r--svtools/inc/vclxaccessibleheaderbaritem.hxx3
-rw-r--r--svtools/source/brwbox/brwbox1.cxx79
-rw-r--r--svtools/source/brwbox/brwbox2.cxx74
-rw-r--r--svtools/source/brwbox/brwhead.cxx12
-rw-r--r--svtools/source/brwbox/datwin.cxx20
-rw-r--r--svtools/source/brwbox/datwin.hxx13
-rw-r--r--svtools/source/brwbox/ebbcontrols.cxx10
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx21
-rw-r--r--svtools/source/contnr/DocumentInfoPreview.cxx42
-rw-r--r--svtools/source/contnr/fileview.cxx54
-rw-r--r--svtools/source/contnr/imivctl.hxx19
-rw-r--r--svtools/source/contnr/imivctl1.cxx173
-rw-r--r--svtools/source/contnr/ivctrl.cxx23
-rw-r--r--svtools/source/contnr/simptabl.cxx110
-rw-r--r--svtools/source/contnr/svimpbox.cxx191
-rw-r--r--svtools/source/contnr/svtabbx.cxx14
-rw-r--r--svtools/source/contnr/treelistbox.cxx85
-rw-r--r--svtools/source/control/calendar.cxx75
-rw-r--r--svtools/source/control/ctrlbox.cxx71
-rw-r--r--svtools/source/control/ctrltool.cxx2
-rw-r--r--svtools/source/control/filectrl.cxx54
-rw-r--r--svtools/source/control/fmtfield.cxx10
-rw-r--r--svtools/source/control/headbar.cxx19
-rw-r--r--svtools/source/control/hyperlabel.cxx6
-rw-r--r--svtools/source/control/inettbc.cxx14
-rw-r--r--svtools/source/control/roadmap.cxx34
-rw-r--r--svtools/source/control/ruler.cxx109
-rw-r--r--svtools/source/control/scrwin.cxx89
-rw-r--r--svtools/source/control/tabbar.cxx64
-rw-r--r--svtools/source/control/toolbarmenu.cxx22
-rw-r--r--svtools/source/control/toolbarmenuimp.hxx2
-rw-r--r--svtools/source/control/valueacc.cxx2
-rw-r--r--svtools/source/control/valueimp.hxx2
-rw-r--r--svtools/source/control/valueset.cxx94
-rw-r--r--svtools/source/control/vclxaccessibleheaderbar.cxx3
-rw-r--r--svtools/source/dialogs/PlaceEditDialog.cxx12
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx42
-rw-r--r--svtools/source/dialogs/colrdlg.cxx1
-rw-r--r--svtools/source/dialogs/prnsetup.cxx37
-rw-r--r--svtools/source/dialogs/restartdialog.cxx15
-rw-r--r--svtools/source/dialogs/roadmapwizard.cxx19
-rw-r--r--svtools/source/dialogs/wizardmachine.cxx34
-rw-r--r--svtools/source/dialogs/wizdlg.cxx15
-rw-r--r--svtools/source/edit/editsyntaxhighlighter.cxx4
-rw-r--r--svtools/source/edit/svmedit2.cxx6
-rw-r--r--svtools/source/filter/GraphicExportOptionsDialog.cxx12
-rw-r--r--svtools/source/filter/exportdialog.cxx39
-rw-r--r--svtools/source/filter/exportdialog.hxx73
-rw-r--r--svtools/source/graphic/grfmgr2.cxx16
-rw-r--r--svtools/source/graphic/provider.cxx16
-rw-r--r--svtools/source/hatchwindow/hatchwindow.cxx4
-rw-r--r--svtools/source/inc/hatchwindow.hxx2
-rw-r--r--svtools/source/inc/renderer.hxx2
-rw-r--r--svtools/source/inc/svimpbox.hxx12
-rw-r--r--svtools/source/inc/unoiface.hxx9
-rw-r--r--svtools/source/java/javainteractionhandler.cxx28
-rw-r--r--svtools/source/misc/dialogcontrolling.cxx4
-rw-r--r--svtools/source/misc/ehdl.cxx10
-rw-r--r--svtools/source/misc/sampletext.cxx14
-rw-r--r--svtools/source/table/gridtablerenderer.cxx8
-rw-r--r--svtools/source/table/tablecontrol.cxx6
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx31
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx9
-rw-r--r--svtools/source/table/tabledatawindow.cxx6
-rw-r--r--svtools/source/table/tabledatawindow.hxx1
-rw-r--r--svtools/source/toolpanel/drawerlayouter.cxx14
-rw-r--r--svtools/source/toolpanel/paneltabbar.cxx84
-rw-r--r--svtools/source/toolpanel/paneltabbarpeer.cxx4
-rw-r--r--svtools/source/toolpanel/paneltabbarpeer.hxx2
-rw-r--r--svtools/source/toolpanel/tablayouter.cxx4
-rw-r--r--svtools/source/toolpanel/toolpaneldeck.cxx27
-rw-r--r--svtools/source/toolpanel/toolpaneldeckpeer.cxx4
-rw-r--r--svtools/source/toolpanel/toolpaneldeckpeer.hxx2
-rw-r--r--svtools/source/toolpanel/toolpaneldrawer.cxx26
-rw-r--r--svtools/source/toolpanel/toolpaneldrawer.hxx7
-rw-r--r--svtools/source/toolpanel/toolpaneldrawerpeer.cxx2
-rw-r--r--svtools/source/uno/addrtempuno.cxx10
-rw-r--r--svtools/source/uno/generictoolboxcontroller.cxx6
-rw-r--r--svtools/source/uno/genericunodialog.cxx5
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx10
-rw-r--r--svtools/source/uno/statusbarcontroller.cxx2
-rw-r--r--svtools/source/uno/svtxgridcontrol.cxx58
-rw-r--r--svtools/source/uno/svtxgridcontrol.hxx2
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx2
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx11
-rw-r--r--svtools/source/uno/treecontrolpeer.hxx4
-rw-r--r--svtools/source/uno/unoiface.cxx221
-rw-r--r--svtools/source/uno/wizard/unowizard.cxx28
-rw-r--r--svtools/source/uno/wizard/wizardshell.cxx16
-rw-r--r--svtools/source/uno/wizard/wizardshell.hxx5
93 files changed, 1506 insertions, 1156 deletions
diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx
index c12e7449a725..b4b75782e17c 100644
--- a/svtools/inc/roadmap.hxx
+++ b/svtools/inc/roadmap.hxx
@@ -58,6 +58,7 @@ namespace svt
public:
ORoadmap( vcl::Window* _pParent, WinBits _nWinStyle = 0 );
virtual ~ORoadmap( );
+ virtual void dispose() SAL_OVERRIDE;
void SetRoadmapBitmap( const BitmapEx& maBitmap, bool _bInvalidate = true );
diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx
index e4b7cbf26cea..22242efc5304 100644
--- a/svtools/inc/table/tablecontrol.hxx
+++ b/svtools/inc/table/tablecontrol.hxx
@@ -64,6 +64,7 @@ namespace svt { namespace table
public:
TableControl( vcl::Window* _pParent, WinBits _nStyle );
virtual ~TableControl();
+ virtual void dispose() SAL_OVERRIDE;
/// sets a new table model
void SetModel( PTableModel _pModel );
diff --git a/svtools/inc/vclxaccessibleheaderbar.hxx b/svtools/inc/vclxaccessibleheaderbar.hxx
index ff750f9b6aee..4fcfd9e99536 100644
--- a/svtools/inc/vclxaccessibleheaderbar.hxx
+++ b/svtools/inc/vclxaccessibleheaderbar.hxx
@@ -36,7 +36,7 @@ class VCLXAccessibleHeaderBar : public VCLXAccessibleComponent
{
public:
- HeaderBar* m_pHeadBar;
+ VclPtr<HeaderBar> m_pHeadBar;
virtual ~VCLXAccessibleHeaderBar();
virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
diff --git a/svtools/inc/vclxaccessibleheaderbaritem.hxx b/svtools/inc/vclxaccessibleheaderbaritem.hxx
index 301036cb04b5..727c2e7a8177 100644
--- a/svtools/inc/vclxaccessibleheaderbaritem.hxx
+++ b/svtools/inc/vclxaccessibleheaderbaritem.hxx
@@ -25,6 +25,7 @@
#include <cppuhelper/implbase2.hxx>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
@@ -53,7 +54,7 @@ class VCLXAccessibleHeaderBarItem : public AccessibleExtendedComponentHelper_
{
private:
VCLExternalSolarLock* m_pExternalLock;
- HeaderBar* m_pHeadBar;
+ VclPtr<HeaderBar> m_pHeadBar;
sal_Int32 m_nIndexInParent;
protected:
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 4f87dfd563d5..04664e5e4b4a 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -36,7 +36,7 @@
#define SCROLL_FLAGS (SCROLL_CLIP | SCROLL_NOCHILDREN)
-#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin))
+#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin.get()))
using namespace com::sun::star::accessibility::AccessibleEventId;
using namespace com::sun::star::accessibility::AccessibleTableModelChangeType;
@@ -58,8 +58,6 @@ namespace
}
}
-
-
void BrowseBox::ConstructImpl( BrowserMode nMode )
{
OSL_TRACE( "BrowseBox: %p->ConstructImpl", this );
@@ -68,7 +66,7 @@ void BrowseBox::ConstructImpl( BrowserMode nMode )
pDataWin = 0;
pVScroll = 0;
- pDataWin = new BrowserDataWin( this );
+ pDataWin = VclPtr<BrowserDataWin>::Create( this ).get();
pCols = new BrowserColumns;
m_pImpl.reset( new ::svt::BrowseBoxImpl() );
@@ -101,9 +99,9 @@ void BrowseBox::ConstructImpl( BrowserMode nMode )
nControlAreaWidth = USHRT_MAX;
uRow.nSel = BROWSER_ENDOFSELECTION;
- aHScroll.SetLineSize(1);
- aHScroll.SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
- aHScroll.SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
+ aHScroll->SetLineSize(1);
+ aHScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
+ aHScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
pDataWin->Show();
SetMode( nMode );
@@ -119,7 +117,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode )
:Control( pParent, nBits | WB_3DLOOK )
,DragSourceHelper( this )
,DropTargetHelper( this )
- ,aHScroll( this, WinBits( WB_HSCROLL ) )
+ ,aHScroll( VclPtr<ScrollBar>::Create(this, WinBits( WB_HSCROLL )) )
{
ConstructImpl( nMode );
}
@@ -130,7 +128,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode
:Control( pParent, rId )
,DragSourceHelper( this )
,DropTargetHelper( this )
- ,aHScroll( this, WinBits(WB_HSCROLL) )
+ ,aHScroll( VclPtr<ScrollBar>::Create(this, WinBits(WB_HSCROLL)) )
{
ConstructImpl(nMode);
}
@@ -138,6 +136,11 @@ BrowseBox::BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode
BrowseBox::~BrowseBox()
{
+ disposeOnce();
+}
+
+void BrowseBox::dispose()
+{
OSL_TRACE( "BrowseBox: %p~", this );
if ( m_pImpl->m_pAccessible )
@@ -148,10 +151,11 @@ BrowseBox::~BrowseBox()
}
Hide();
- delete getDataWindow()->pHeaderBar;
- delete getDataWindow()->pCornerWin;
- delete pDataWin;
- delete pVScroll;
+ getDataWindow()->pHeaderBar.disposeAndClear();
+ getDataWindow()->pCornerWin.disposeAndClear();
+ pDataWin.disposeAndClear();
+ pVScroll.disposeAndClear();
+ aHScroll.disposeAndClear();
// free columns-space
for ( size_t i = 0, n = pCols->size(); i < n; ++i )
@@ -161,6 +165,7 @@ BrowseBox::~BrowseBox()
delete pColSel;
if ( bMultiSelection )
delete uRow.pSel;
+ Control::dispose();
}
@@ -589,7 +594,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
nMaxWidth -= getDataWindow()->bAutoSizeLastCol
? GetFieldRect(nItemId).Left()
: GetFrozenWidth();
- if ( static_cast<BrowserDataWin*>(pDataWin )->bAutoSizeLastCol || nWidth > (sal_uLong)nMaxWidth )
+ if ( static_cast<BrowserDataWin*>( pDataWin.get() )->bAutoSizeLastCol || nWidth > (sal_uLong)nMaxWidth )
{
nWidth = nMaxWidth > 16 ? nMaxWidth : nOldWidth;
nWidth = QueryColumnResize( nItemId, nWidth );
@@ -645,7 +650,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
getDataWindow()->Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS );
Rectangle aInvRect( nX, 0, nX + std::max( nWidth, (sal_uLong)nOldWidth ), USHRT_MAX );
Control::Invalidate( aInvRect, INVALIDATE_NOCHILDREN );
- static_cast<BrowserDataWin*>( pDataWin )->Invalidate( aInvRect );
+ static_cast<BrowserDataWin*>( pDataWin.get() )->Invalidate( aInvRect );
}
else
{
@@ -774,7 +779,6 @@ void BrowseBox::RemoveColumn( sal_uInt16 nItemId )
void BrowseBox::RemoveColumns()
{
-
size_t nOldCount = pCols->size();
// remove all columns
@@ -917,7 +921,7 @@ long BrowseBox::ScrollColumns( long nCols )
{
// update internal value and scrollbar
++nFirstCol;
- aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+ aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
if ( !bScrollable )
{
@@ -963,7 +967,7 @@ long BrowseBox::ScrollColumns( long nCols )
else if ( nCols == -1 )
{
--nFirstCol;
- aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+ aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
if ( !bScrollable )
{
@@ -1003,7 +1007,7 @@ long BrowseBox::ScrollColumns( long nCols )
}
nFirstCol = nFirstCol + (sal_uInt16)nCols;
- aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+ aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
}
// adjust external headerbar, if necessary
@@ -1141,7 +1145,7 @@ void BrowseBox::Clear()
// nFirstCol may not be reset, else the scrolling code will become confused.
// nFirstCol may only be changed when adding or deleting columns
// nFirstCol = 0; -> wrong!
- aHScroll.SetThumbPos( 0 );
+ aHScroll->SetThumbPos( 0 );
pVScroll->SetThumbPos( 0 );
Invalidate();
@@ -2213,9 +2217,9 @@ Rectangle BrowseBox::GetControlArea() const
{
return Rectangle(
- Point( 0, GetOutputSizePixel().Height() - aHScroll.GetSizePixel().Height() ),
- Size( GetOutputSizePixel().Width() - aHScroll.GetSizePixel().Width(),
- aHScroll.GetSizePixel().Height() ) );
+ Point( 0, GetOutputSizePixel().Height() - aHScroll->GetSizePixel().Height() ),
+ Size( GetOutputSizePixel().Width() - aHScroll->GetSizePixel().Width(),
+ aHScroll->GetSizePixel().Height() ) );
}
@@ -2238,7 +2242,7 @@ void BrowseBox::SetMode( BrowserMode nMode )
getDataWindow()->bNoVScroll = false;
if ( getDataWindow()->bNoHScroll )
- aHScroll.Hide();
+ aHScroll->Hide();
nControlAreaWidth = USHRT_MAX;
@@ -2249,7 +2253,7 @@ void BrowseBox::SetMode( BrowserMode nMode )
MultiSelection *pOldRowSel = bMultiSelection ? uRow.pSel : 0;
MultiSelection *pOldColSel = pColSel;
- delete pVScroll;
+ pVScroll.disposeAndClear();
bThumbDragging = ( nMode & BrowserMode::THUMBDRAGGING ) == BrowserMode::THUMBDRAGGING;
bMultiSelection = ( nMode & BrowserMode::MULTISELECTION ) == BrowserMode::MULTISELECTION;
@@ -2276,10 +2280,11 @@ void BrowseBox::SetMode( BrowserMode nMode )
WinBits nVScrollWinBits =
WB_VSCROLL | ( ( nMode & BrowserMode::THUMBDRAGGING ) ? WB_DRAG : 0 );
- pVScroll = ( nMode & BrowserMode::TRACKING_TIPS ) == BrowserMode::TRACKING_TIPS
- ? new BrowserScrollBar( this, nVScrollWinBits,
- static_cast<BrowserDataWin*>( pDataWin ) )
- : new ScrollBar( this, nVScrollWinBits );
+ pVScroll = VclPtr<ScrollBar>(
+ ( nMode & BrowserMode::TRACKING_TIPS ) == BrowserMode::TRACKING_TIPS
+ ? VclPtr<BrowserScrollBar>::Create( this, nVScrollWinBits,
+ static_cast<BrowserDataWin*>( pDataWin.get() ) )
+ : VclPtr<ScrollBar>::Create( this, nVScrollWinBits ));
pVScroll->SetLineSize( 1 );
pVScroll->SetPageSize(1);
pVScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
@@ -2299,11 +2304,9 @@ void BrowseBox::SetMode( BrowserMode nMode )
}
else
{
- DELETEZ(getDataWindow()->pHeaderBar);
+ getDataWindow()->pHeaderBar.disposeAndClear();
}
-
-
if ( bColumnCursor )
{
pColSel = pOldColSel ? pOldColSel : new MultiSelection;
@@ -2391,18 +2394,18 @@ long BrowseBox::GetDataRowHeight() const
-BrowserHeader* BrowseBox::CreateHeaderBar( BrowseBox* pParent )
+VclPtr<BrowserHeader> BrowseBox::CreateHeaderBar( BrowseBox* pParent )
{
- BrowserHeader* pNewBar = new BrowserHeader( pParent );
+ VclPtr<BrowserHeader> pNewBar = VclPtr<BrowserHeader>::Create( pParent );
pNewBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
return pNewBar;
}
void BrowseBox::SetHeaderBar( BrowserHeader* pHeaderBar )
{
- delete static_cast<BrowserDataWin*>(pDataWin)->pHeaderBar;
- static_cast<BrowserDataWin*>( pDataWin )->pHeaderBar = pHeaderBar;
- static_cast<BrowserDataWin*>( pDataWin )->pHeaderBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
+ static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar.disposeAndClear();
+ static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar = pHeaderBar;
+ static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
}
long BrowseBox::GetTitleHeight() const
@@ -2410,7 +2413,7 @@ long BrowseBox::GetTitleHeight() const
long nHeight;
// ask the header bar for the text height (if possible), as the header bar's font is adjusted with
// our (and the header's) zoom factor
- HeaderBar* pHeaderBar = static_cast<BrowserDataWin*>( pDataWin )->pHeaderBar;
+ HeaderBar* pHeaderBar = static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar;
if ( pHeaderBar )
nHeight = pHeaderBar->GetTextHeight();
else
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 2b2afb754054..e371f5c993fe 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -30,7 +30,7 @@
using namespace ::com::sun::star::datatransfer;
-#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin))
+#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin.get()))
@@ -43,7 +43,7 @@ void BrowseBox::StartDrag( sal_Int8 /* _nAction */, const Point& /* _rPosPixel *
sal_Int8 BrowseBox::AcceptDrop( const AcceptDropEvent& _rEvt )
{
- BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin);
+ BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin.get());
AcceptDropEvent aTransformed( _rEvt );
aTransformed.maPosPixel = pDataWindow->ScreenToOutputPixel( OutputToScreenPixel( _rEvt.maPosPixel ) );
return pDataWindow->AcceptDrop( aTransformed );
@@ -53,7 +53,7 @@ sal_Int8 BrowseBox::AcceptDrop( const AcceptDropEvent& _rEvt )
sal_Int8 BrowseBox::ExecuteDrop( const ExecuteDropEvent& _rEvt )
{
- BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin);
+ BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin.get());
ExecuteDropEvent aTransformed( _rEvt );
aTransformed.maPosPixel = pDataWindow->ScreenToOutputPixel( OutputToScreenPixel( _rEvt.maPosPixel ) );
return pDataWindow->ExecuteDrop( aTransformed );
@@ -79,8 +79,8 @@ sal_Int8 BrowseBox::ExecuteDrop( const BrowserExecuteDropEvent& )
void* BrowseBox::implGetDataFlavors() const
{
- if (static_cast<BrowserDataWin*>(pDataWin)->bCallingDropCallback)
- return &static_cast<BrowserDataWin*>(pDataWin)->GetDataFlavorExVector();
+ if (static_cast<BrowserDataWin*>(pDataWin.get())->bCallingDropCallback)
+ return &static_cast<BrowserDataWin*>(pDataWin.get())->GetDataFlavorExVector();
return &GetDataFlavorExVector();
}
@@ -88,8 +88,8 @@ void* BrowseBox::implGetDataFlavors() const
bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat )
{
- if ( static_cast< BrowserDataWin* >( pDataWin )->bCallingDropCallback )
- return static_cast< BrowserDataWin* >( pDataWin )->IsDropFormatSupported( _nFormat );
+ if ( static_cast< BrowserDataWin* >( pDataWin.get() )->bCallingDropCallback )
+ return static_cast< BrowserDataWin* >( pDataWin.get() )->IsDropFormatSupported( _nFormat );
return DropTargetHelper::IsDropFormatSupported( _nFormat );
}
@@ -105,8 +105,8 @@ bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat ) const
bool BrowseBox::IsDropFormatSupported( const DataFlavor& _rFlavor )
{
- if ( static_cast< BrowserDataWin* >( pDataWin )->bCallingDropCallback )
- return static_cast< BrowserDataWin* >( pDataWin )->IsDropFormatSupported( _rFlavor );
+ if ( static_cast< BrowserDataWin* >( pDataWin.get() )->bCallingDropCallback )
+ return static_cast< BrowserDataWin* >( pDataWin.get() )->IsDropFormatSupported( _rFlavor );
return DropTargetHelper::IsDropFormatSupported( _rFlavor );
}
@@ -139,7 +139,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar;
if ( pHeaderBar )
pHeaderBar->EnableRTL( IsRTLEnabled() );
- aHScroll.EnableRTL( IsRTLEnabled() );
+ aHScroll->EnableRTL( IsRTLEnabled() );
if( pVScroll )
pVScroll->EnableRTL( IsRTLEnabled() );
Resize();
@@ -189,7 +189,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
// do we have a handle column?
bool bHandleCol = !pCols->empty() && (0 == (*pCols)[ 0 ]->GetId());
// do we have a header bar?
- bool bHeaderBar = (NULL != static_cast<BrowserDataWin&>(GetDataWindow()).pHeaderBar);
+ bool bHeaderBar = (NULL != static_cast<BrowserDataWin&>(GetDataWindow()).pHeaderBar.get());
if ( nTitleLines
&& ( !bHeaderBar
@@ -407,9 +407,9 @@ void BrowseBox::DrawCursor()
{
// on these platforms, the StarView focus works correctly
if ( bReallyHide )
- static_cast<Control*>(pDataWin)->HideFocus();
+ static_cast<Control*>(pDataWin.get())->HideFocus();
else
- static_cast<Control*>(pDataWin)->ShowFocus( aCursor );
+ static_cast<Control*>(pDataWin.get())->ShowFocus( aCursor );
}
else
{
@@ -561,13 +561,13 @@ void BrowseBox::Resize()
// did we need a horizontal scroll bar or is there a Control Area?
if ( !getDataWindow()->bNoHScroll &&
( ( pCols->size() - FrozenColCount() ) > 1 ) )
- aHScroll.Show();
+ aHScroll->Show();
else
- aHScroll.Hide();
+ aHScroll->Hide();
// calculate the size of the data window
long nDataHeight = GetOutputSizePixel().Height() - GetTitleHeight();
- if ( aHScroll.IsVisible() || ( nControlAreaWidth != USHRT_MAX ) )
+ if ( aHScroll->IsVisible() || ( nControlAreaWidth != USHRT_MAX ) )
nDataHeight -= nSBSize;
long nDataWidth = GetOutputSizePixel().Width();
@@ -623,13 +623,13 @@ void BrowseBox::Paint( const Rectangle& rRect )
BrowserColumn *pFirstCol = (*pCols)[ 0 ];
bool bHandleCol = pFirstCol && pFirstCol->GetId() == 0;
- bool bHeaderBar = getDataWindow()->pHeaderBar != NULL;
+ bool bHeaderBar = getDataWindow()->pHeaderBar.get() != NULL;
// draw delimitational lines
if ( !getDataWindow()->bNoHScroll )
- DrawLine( Point( 0, aHScroll.GetPosPixel().Y() ),
+ DrawLine( Point( 0, aHScroll->GetPosPixel().Y() ),
Point( GetOutputSizePixel().Width(),
- aHScroll.GetPosPixel().Y() ) );
+ aHScroll->GetPosPixel().Y() ) );
if ( nTitleLines )
{
@@ -1119,7 +1119,7 @@ void BrowseBox::UpdateScrollbars()
return;
// protect against recursion
- BrowserDataWin *pBDW = static_cast<BrowserDataWin*>( pDataWin );
+ BrowserDataWin *pBDW = static_cast<BrowserDataWin*>( pDataWin.get() );
if ( pBDW->bInUpdateScrollbars )
{
pBDW->bHadRecursion = true;
@@ -1169,15 +1169,15 @@ void BrowseBox::UpdateScrollbars()
: !getDataWindow()->bNoHScroll;
if ( !bNeedsHScroll )
{
- if ( aHScroll.IsVisible() )
+ if ( aHScroll->IsVisible() )
{
- aHScroll.Hide();
+ aHScroll->Hide();
}
aDataWinSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight();
if ( nControlAreaWidth != USHRT_MAX )
aDataWinSize.Height() -= nCornerSize;
}
- else if ( !aHScroll.IsVisible() )
+ else if ( !aHScroll->IsVisible() )
{
Size aNewSize( aDataWinSize );
aNewSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight() - nCornerSize;
@@ -1189,7 +1189,7 @@ void BrowseBox::UpdateScrollbars()
? 0
: nControlAreaWidth;
- aHScroll.SetPosSizePixel(
+ aHScroll->SetPosSizePixel(
Point( nHScrX, GetOutputSizePixel().Height() - nCornerSize ),
Size( aDataWinSize.Width() - nHScrX, nCornerSize ) );
@@ -1202,10 +1202,10 @@ void BrowseBox::UpdateScrollbars()
: (short)( nLastCol - nFirstCol );
short nRange = std::max( nScrollCols, (short)0 );
- aHScroll.SetVisibleSize( nVisibleHSize );
- aHScroll.SetRange( Range( 0, nRange ));
- if ( bNeedsHScroll && !aHScroll.IsVisible() )
- aHScroll.Show();
+ aHScroll->SetVisibleSize( nVisibleHSize );
+ aHScroll->SetRange( Range( 0, nRange ));
+ if ( bNeedsHScroll && !aHScroll->IsVisible() )
+ aHScroll->Show();
// adjust position and height of vertical scrollbar
pVScroll->SetPageSize( nMaxRows );
@@ -1237,12 +1237,12 @@ void BrowseBox::UpdateScrollbars()
// needs corner-window?
// (do that AFTER positioning BOTH scrollbars)
sal_uLong nActualCorderWidth = 0;
- if (aHScroll.IsVisible() && pVScroll && pVScroll->IsVisible() )
+ if (aHScroll->IsVisible() && pVScroll && pVScroll->IsVisible() )
{
// if we have both scrollbars, the corner window fills the point of intersection of these two
nActualCorderWidth = nCornerSize;
}
- else if ( !aHScroll.IsVisible() && ( nControlAreaWidth != USHRT_MAX ) )
+ else if ( !aHScroll->IsVisible() && ( nControlAreaWidth != USHRT_MAX ) )
{
// if we have no horizontal scrollbar, but a control area, we need the corner window to
// fill the space between the control are and the right border
@@ -1251,14 +1251,14 @@ void BrowseBox::UpdateScrollbars()
if ( nActualCorderWidth )
{
if ( !getDataWindow()->pCornerWin )
- getDataWindow()->pCornerWin = new ScrollBarBox( this, 0 );
+ getDataWindow()->pCornerWin = VclPtr<ScrollBarBox>::Create( this, 0 );
getDataWindow()->pCornerWin->SetPosSizePixel(
- Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll.GetPosPixel().Y() ),
+ Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll->GetPosPixel().Y() ),
Size( nActualCorderWidth, nCornerSize ) );
getDataWindow()->pCornerWin->Show();
}
else
- DELETEZ( getDataWindow()->pCornerWin );
+ getDataWindow()->pCornerWin.disposeAndClear();
// scroll headerbar, if necessary
if ( getDataWindow()->pHeaderBar )
@@ -1371,8 +1371,8 @@ IMPL_LINK(BrowseBox,ScrollHdl,ScrollBar*,pBar)
return 0;
}
- if ( pBar == &aHScroll )
- ScrollColumns( aHScroll.GetDelta() );
+ if ( pBar == aHScroll.get() )
+ ScrollColumns( aHScroll->GetDelta() );
if ( pBar == pVScroll )
ScrollRows( pVScroll->GetDelta() );
@@ -1539,7 +1539,7 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt )
bResizing = false;
}
else
- MouseButtonUp( BrowserMouseEvent( static_cast<BrowserDataWin*>(pDataWin),
+ MouseButtonUp( BrowserMouseEvent( static_cast<BrowserDataWin*>(pDataWin.get()),
MouseEvent( Point( rEvt.GetPosPixel().X(),
rEvt.GetPosPixel().Y() - pDataWin->GetPosPixel().Y() ),
rEvt.GetClicks(), rEvt.GetMode(), rEvt.GetButtons(),
@@ -2050,7 +2050,7 @@ Rectangle BrowseBox::calcTableRect(bool _bOnScreen)
long nY = aRowBar.Top() - aRect.Top();
Size aSize(aRect.GetSize());
- return Rectangle(aRowBar.TopRight(), Size(aSize.A() - nX, aSize.B() - nY - aHScroll.GetSizePixel().Height()) );
+ return Rectangle(aRowBar.TopRight(), Size(aSize.A() - nX, aSize.B() - nY - aHScroll->GetSizePixel().Height()) );
}
Rectangle BrowseBox::GetFieldRectPixelAbs( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen )
diff --git a/svtools/source/brwbox/brwhead.cxx b/svtools/source/brwbox/brwhead.cxx
index e3758a98c177..0c723a31e32a 100644
--- a/svtools/source/brwbox/brwhead.cxx
+++ b/svtools/source/brwbox/brwhead.cxx
@@ -36,6 +36,18 @@ BrowserHeader::BrowserHeader( BrowseBox* pParent, WinBits nWinBits )
}
+BrowserHeader::~BrowserHeader()
+{
+ disposeOnce();
+}
+
+void BrowserHeader::dispose()
+{
+ _pBrowseBox.clear();
+ HeaderBar::dispose();
+}
+
+
void BrowserHeader::Command( const CommandEvent& rCEvt )
{
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index e56ef6b70de6..41635c240e57 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -227,11 +227,20 @@ BrowserDataWin::BrowserDataWin( BrowseBox* pParent )
BrowserDataWin::~BrowserDataWin()
{
+ disposeOnce();
+}
+
+void BrowserDataWin::dispose()
+{
bInDtor = true;
for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i )
delete aInvalidRegion[ i ];
aInvalidRegion.clear();
+ pHeaderBar.clear();
+ pEventWin.clear();
+ pCornerWin.clear();
+ Control::dispose();
}
@@ -408,7 +417,7 @@ void BrowserDataWin::Command( const CommandEvent& rEvt )
if ( ( (rEvt.GetCommand() == COMMAND_WHEEL) ||
(rEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
(rEvt.GetCommand() == COMMAND_AUTOSCROLL) ) &&
- ( HandleScrollCommand( rEvt, &pBox->aHScroll, pBox->pVScroll ) ) )
+ ( HandleScrollCommand( rEvt, pBox->aHScroll.get(), pBox->pVScroll ) ) )
return;
Point aEventPos( rEvt.GetMousePosPixel() );
@@ -721,7 +730,16 @@ void BrowserDataWin::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags )
Window::Invalidate( rRect, nFlags );
}
+BrowserScrollBar::~BrowserScrollBar()
+{
+ disposeOnce();
+}
+void BrowserScrollBar::dispose()
+{
+ _pDataWin.clear();
+ ScrollBar::dispose();
+}
void BrowserScrollBar::Tracking( const TrackingEvent& rTEvt )
{
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index 4195d0a2ccf6..ed739fbf1b76 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -103,9 +103,9 @@ class BrowserDataWin
,public DropTargetHelper
{
public:
- BrowserHeader* pHeaderBar; // only for BrowserMode::HEADERBAR_NEW
- vcl::Window* pEventWin; // Window of forwarded events
- ScrollBarBox* pCornerWin; // Window in the corner btw the ScrollBars
+ VclPtr<BrowserHeader> pHeaderBar; // only for BrowserMode::HEADERBAR_NEW
+ VclPtr<vcl::Window> pEventWin; // Window of forwarded events
+ VclPtr<ScrollBarBox> pCornerWin; // Window in the corner btw the ScrollBars
bool bInDtor;
AutoTimer aMouseTimer; // recalls MouseMove on dragging out
MouseEvent aRepeatEvt; // a MouseEvent to repeat
@@ -137,7 +137,8 @@ public:
public:
BrowserDataWin( BrowseBox* pParent );
- virtual ~BrowserDataWin();
+ virtual ~BrowserDataWin();
+ virtual void dispose() SAL_OVERRIDE;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
@@ -196,7 +197,7 @@ class BrowserScrollBar: public ScrollBar
{
sal_uLong _nTip;
sal_uLong _nLastPos;
- BrowserDataWin* _pDataWin;
+ VclPtr<BrowserDataWin> _pDataWin;
public:
BrowserScrollBar( vcl::Window* pParent, WinBits nStyle,
@@ -206,6 +207,8 @@ public:
_nLastPos( ULONG_MAX ),
_pDataWin( pDataWin )
{}
+ virtual ~BrowserScrollBar();
+ virtual void dispose() SAL_OVERRIDE;
//ScrollBar( vcl::Window* pParent, const ResId& rResId );
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index c4bedd3c27bf..111f6c878aae 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -238,7 +238,7 @@ namespace svt
EnableChildTransparentMode();
- pBox = new TriStateBox(this,WB_CENTER|WB_VCENTER);
+ pBox = VclPtr<TriStateBox>::Create(this,WB_CENTER|WB_VCENTER);
pBox->SetLegacyNoTextAlign( true );
pBox->EnableChildTransparentMode();
pBox->SetPaintTransparent( true );
@@ -249,7 +249,13 @@ namespace svt
CheckBoxControl::~CheckBoxControl()
{
- delete pBox;
+ disposeOnce();
+ }
+
+ void CheckBoxControl::dispose()
+ {
+ pBox.disposeAndClear();
+ Control::dispose();
}
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 7c13d24fa146..c95369f2521c 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -127,7 +127,7 @@ namespace svt
ImplInitSettings(true, true, true);
- pCheckBoxPaint = new CheckBoxControl(&GetDataWindow());
+ pCheckBoxPaint = VclPtr<CheckBoxControl>::Create(&GetDataWindow());
pCheckBoxPaint->SetPaintTransparent( true );
pCheckBoxPaint->SetBackground();
}
@@ -183,6 +183,11 @@ namespace svt
EditBrowseBox::~EditBrowseBox()
{
+ disposeOnce();
+ }
+
+ void EditBrowseBox::dispose()
+ {
if (nStartEvent)
Application::RemoveUserEvent(nStartEvent);
if (nEndEvent)
@@ -190,8 +195,10 @@ namespace svt
if (nCellModifiedEvent)
Application::RemoveUserEvent(nCellModifiedEvent);
- delete pCheckBoxPaint;
-
+ pCheckBoxPaint.disposeAndClear();
+ m_pFocusWhileRequest.clear();
+ pHeader.clear();
+ BrowseBox::dispose();
}
@@ -203,7 +210,7 @@ namespace svt
}
- BrowserHeader* EditBrowseBox::CreateHeaderBar(BrowseBox* pParent)
+ VclPtr<BrowserHeader> EditBrowseBox::CreateHeaderBar(BrowseBox* pParent)
{
pHeader = imp_CreateHeaderBar(pParent);
if (!IsUpdateMode())
@@ -212,9 +219,9 @@ namespace svt
}
- BrowserHeader* EditBrowseBox::imp_CreateHeaderBar(BrowseBox* pParent)
+ VclPtr<BrowserHeader> EditBrowseBox::imp_CreateHeaderBar(BrowseBox* pParent)
{
- return new EditBrowserHeader(pParent);
+ return VclPtr<EditBrowserHeader>::Create(pParent);
}
@@ -251,7 +258,7 @@ namespace svt
if (IsEditing())
{
EnableAndShow();
- if (!aController->GetWindow().HasFocus() && (m_pFocusWhileRequest == Application::GetFocusWindow()))
+ if (!aController->GetWindow().HasFocus() && (m_pFocusWhileRequest.get() == Application::GetFocusWindow()))
aController->GetWindow().GrabFocus();
}
return 0;
diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx
index b5adc8962ec4..8efa8de2847f 100644
--- a/svtools/source/contnr/DocumentInfoPreview.cxx
+++ b/svtools/source/contnr/DocumentInfoPreview.cxx
@@ -44,16 +44,26 @@
namespace svtools {
ODocumentInfoPreview::ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits):
- Window(pParent, WB_DIALOGCONTROL), m_pEditWin(this, nBits),
+ Window(pParent, WB_DIALOGCONTROL),
+ m_pEditWin( VclPtr<ExtMultiLineEdit>::Create(this, nBits) ),
m_xInfoTable(new SvtDocInfoTable_Impl),
m_aLanguageTag(SvtPathOptions().GetLanguageTag()) // detect application language
{
- m_pEditWin.SetLeftMargin(10);
- m_pEditWin.Show();
- m_pEditWin.EnableCursor(false);
+ m_pEditWin->SetLeftMargin(10);
+ m_pEditWin->Show();
+ m_pEditWin->EnableCursor(false);
}
-ODocumentInfoPreview::~ODocumentInfoPreview() {}
+ODocumentInfoPreview::~ODocumentInfoPreview()
+{
+ disposeOnce();
+}
+
+void ODocumentInfoPreview::dispose()
+{
+ m_pEditWin.disposeAndClear();
+ Window::dispose();
+}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeODocumentInfoPreview(vcl::Window *pParent, VclBuilder::stringmap&)
{
@@ -61,11 +71,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeODocumentInfoPreview(v
}
void ODocumentInfoPreview::Resize() {
- m_pEditWin.SetPosSizePixel(Point(0, 0), GetOutputSize());
+ m_pEditWin->SetPosSizePixel(Point(0, 0), GetOutputSize());
}
void ODocumentInfoPreview::clear() {
- m_pEditWin.SetText(OUString());
+ m_pEditWin->SetText(OUString());
}
void ODocumentInfoPreview::fill(
@@ -74,7 +84,7 @@ void ODocumentInfoPreview::fill(
{
assert(xDocProps.is());
- m_pEditWin.SetAutoScroll(false);
+ m_pEditWin->SetAutoScroll(false);
insertNonempty(DI_TITLE, xDocProps->getTitle());
insertNonempty(DI_FROM, xDocProps->getAuthor());
@@ -126,22 +136,22 @@ void ODocumentInfoPreview::fill(
}
}
- m_pEditWin.SetSelection(Selection(0, 0));
- m_pEditWin.SetAutoScroll(true);
+ m_pEditWin->SetSelection(Selection(0, 0));
+ m_pEditWin->SetAutoScroll(true);
}
void ODocumentInfoPreview::insertEntry(
OUString const & title, OUString const & value)
{
- if (!m_pEditWin.GetText().isEmpty()) {
- m_pEditWin.InsertText(OUString("\n\n"));
+ if (!m_pEditWin->GetText().isEmpty()) {
+ m_pEditWin->InsertText(OUString("\n\n"));
}
OUString caption(title + ":\n");
- m_pEditWin.InsertText(caption);
- m_pEditWin.SetAttrib(
- TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin.GetParagraphCount() - 2,
+ m_pEditWin->InsertText(caption);
+ m_pEditWin->SetAttrib(
+ TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin->GetParagraphCount() - 2,
0, caption.getLength() - 1);
- m_pEditWin.InsertText(value);
+ m_pEditWin->InsertText(value);
}
void ODocumentInfoPreview::insertNonempty(long id, OUString const & value)
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 70471b08ea5d..15ae1fe660ae 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -182,7 +182,7 @@ private:
Reference< XCommandEnvironment > mxCmdEnv;
::osl::Mutex maMutex;
- HeaderBar* mpHeaderBar;
+ VclPtr<HeaderBar> mpHeaderBar;
SvtFileView_Impl* mpParent;
Timer maResetQuickSearch;
OUString maQuickSearchText;
@@ -206,7 +206,8 @@ protected:
public:
ViewTabListBox_Impl( vcl::Window* pParentWin, SvtFileView_Impl* pParent, FileViewFlags nFlags );
- virtual ~ViewTabListBox_Impl();
+ virtual ~ViewTabListBox_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
@@ -419,7 +420,7 @@ class SvtFileView_Impl :public ::svt::IEnumerationResultHandler
,public ITimeoutHandler
{
protected:
- SvtFileView* mpAntiImpl;
+ VclPtr<SvtFileView> mpAntiImpl;
Link m_aSelectHandler;
::rtl::Reference< ::svt::FileViewContentEnumerator >
@@ -437,7 +438,7 @@ public:
::std::vector< SortingData_Impl* > maContent;
::osl::Mutex maMutex;
- ViewTabListBox_Impl* mpView;
+ VclPtr<ViewTabListBox_Impl> mpView;
NameTranslator_Impl* mpNameTrans;
sal_uInt16 mnSortColumn;
bool mbAscending : 1;
@@ -596,7 +597,7 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
mbShowHeader ( !(nFlags & FileViewFlags::SHOW_NONE) )
{
Size aBoxSize = pParentWin->GetSizePixel();
- mpHeaderBar = new HeaderBar( pParentWin, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ mpHeaderBar = VclPtr<HeaderBar>::Create( pParentWin, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), mpHeaderBar->CalcWindowSizePixel() );
HeaderBarItemBits nBits = ( HeaderBarItemBits::LEFT | HeaderBarItemBits::VCENTER | HeaderBarItemBits::CLICKABLE );
@@ -648,9 +649,15 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
ViewTabListBox_Impl::~ViewTabListBox_Impl()
{
+ disposeOnce();
+}
+
+void ViewTabListBox_Impl::dispose()
+{
maResetQuickSearch.Stop();
- delete mpHeaderBar;
+ mpHeaderBar.disposeAndClear();
+ SvHeaderTabListBox::dispose();
}
@@ -886,16 +893,16 @@ void ViewTabListBox_Impl::DeleteEntries()
if ( eResult != svtools::QUERYDELETE_ALL )
{
INetURLObject aObj( aURL );
- svtools::QueryDeleteDlg_Impl aDlg( NULL, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) );
+ ScopedVclPtrInstance< svtools::QueryDeleteDlg_Impl > aDlg(nullptr, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) );
if ( sDialogPosition.getLength() )
- aDlg.SetWindowState( sDialogPosition );
+ aDlg->SetWindowState( sDialogPosition );
if ( GetSelectionCount() > 1 )
- aDlg.EnableAllButton();
+ aDlg->EnableAllButton();
- eResult = aDlg.Execute();
+ eResult = aDlg->Execute();
- sDialogPosition = aDlg.GetWindowState( );
+ sDialogPosition = aDlg->GetWindowState( );
}
if ( ( eResult == svtools::QUERYDELETE_ALL ) ||
@@ -1103,10 +1110,16 @@ SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits,
SvtFileView::~SvtFileView()
{
+ disposeOnce();
+}
+
+void SvtFileView::dispose()
+{
// use temp pointer to prevent access of deleted member (GetFocus())
SvtFileView_Impl* pTemp = mpImp;
mpImp = NULL;
delete pTemp;
+ Control::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvtFileView(vcl::Window *pParent,
@@ -1582,7 +1595,7 @@ SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommand
{
maAllFilter = "*.*";
- mpView = new ViewTabListBox_Impl( mpAntiImpl, this, nFlags );
+ mpView = VclPtr<ViewTabListBox_Impl>::Create( mpAntiImpl, this, nFlags );
mpView->EnableCellFocus();
}
@@ -1590,11 +1603,7 @@ SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommand
SvtFileView_Impl::~SvtFileView_Impl()
{
Clear();
-
- // use temp pointer to prevent access of deleted member (GetFocus())
- ViewTabListBox_Impl* pTemp = mpView;
- mpView = NULL;
- delete pTemp;
+ mpView.disposeAndClear();
}
@@ -2335,6 +2344,17 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& r
set_secondary_text(get_secondary_text().replaceFirst("%s", rName));
}
+QueryDeleteDlg_Impl::~QueryDeleteDlg_Impl()
+{
+ disposeOnce();
+}
+
+void QueryDeleteDlg_Impl::dispose()
+{
+ m_pAllButton.clear();
+ MessageDialog::dispose();
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index b1dcdf86ede6..6b79474b158b 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -24,6 +24,7 @@
#include <vcl/scrbar.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
+#include <vcl/vclptr.hxx>
#include <vcl/seleng.hxx>
#include <tools/debug.hxx>
#include "svtaccessiblefactory.hxx"
@@ -160,9 +161,9 @@ class SvxIconChoiceCtrl_Impl
bool bChooseWithCursor;
EntryList_Impl aEntries;
- ScrollBar aVerSBar;
- ScrollBar aHorSBar;
- ScrollBarBox aScrBarBox;
+ VclPtr<ScrollBar> aVerSBar;
+ VclPtr<ScrollBar> aHorSBar;
+ VclPtr<ScrollBarBox> aScrBarBox;
Rectangle aCurSelectionRect;
std::vector<Rectangle*> aSelectedRectList;
Idle aEditIdle; // for editing in place
@@ -178,14 +179,14 @@ class SvxIconChoiceCtrl_Impl
Point aDDLastRectPos;
Point aDDPaintOffs;
Point aDDStartPos;
- SvtIconChoiceCtrl* pView;
+ VclPtr<SvtIconChoiceCtrl> pView;
IcnCursor_Impl* pImpCursor;
IcnGridMap_Impl* pGridMap;
long nMaxVirtWidth; // max. width aVirtOutputSize for ALIGN_TOP
long nMaxVirtHeight; // max. height aVirtOutputSize for ALIGN_LEFT
SvxIconChoiceCtrlEntryList_impl* pZOrderList;
SvxIconChoiceCtrlColumnInfoMap* pColumns;
- IcnViewEdit_Impl* pEdit;
+ VclPtr<IcnViewEdit_Impl> pEdit;
WinBits nWinBits;
long nMaxBoundHeight; // height of highest BoundRects
sal_uInt16 nFlags;
@@ -199,10 +200,10 @@ class SvxIconChoiceCtrl_Impl
SvxIconChoiceCtrlEntry* pPrevDropTarget;
SvxIconChoiceCtrlEntry* pHdlEntry;
SvxIconChoiceCtrlEntry* pDDRefEntry;
- VirtualDevice* pDDDev;
- VirtualDevice* pDDBufDev;
- VirtualDevice* pDDTempDev;
- VirtualDevice* pEntryPaintDev;
+ VclPtr<VirtualDevice> pDDDev;
+ VclPtr<VirtualDevice> pDDBufDev;
+ VclPtr<VirtualDevice> pDDTempDev;
+ VclPtr<VirtualDevice> pEntryPaintDev;
SvxIconChoiceCtrlEntry* pAnchor; // for selection
LocalFocus aFocus; // Data for focusrect
::svt::AccessibleFactoryAccess aAccFactory;
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index ce0e0f1bb285..f978dcd2fbbe 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -77,7 +77,8 @@ public:
const OUString& rData,
const Link& rNotifyEditEnd );
- virtual ~IcnViewEdit_Impl();
+ virtual ~IcnViewEdit_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
bool EditingCanceled() const { return bCanceled; }
@@ -90,9 +91,9 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
WinBits nWinStyle
) :
aEntries( this ),
- aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ),
- aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ),
- aScrBarBox( pCurView ),
+ aVerSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_VSCROLL) ),
+ aHorSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_HSCROLL) ),
+ aScrBarBox( VclPtr<ScrollBarBox>::Create(pCurView) ),
aImageSize( 32, 32 ),
pColumns( 0 )
{
@@ -127,14 +128,14 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
pImpCursor = new IcnCursor_Impl( this );
pGridMap = new IcnGridMap_Impl( this );
- aVerSBar.SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) );
- aHorSBar.SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) );
+ aVerSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) );
+ aHorSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) );
Link aEndScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, EndScrollHdl ) );
- aVerSBar.SetEndScrollHdl( aEndScrollHdl );
- aHorSBar.SetEndScrollHdl( aEndScrollHdl );
+ aVerSBar->SetEndScrollHdl( aEndScrollHdl );
+ aHorSBar->SetEndScrollHdl( aEndScrollHdl );
- nHorSBarHeight = aHorSBar.GetSizePixel().Height();
- nVerSBarWidth = aVerSBar.GetSizePixel().Width();
+ nHorSBarHeight = aHorSBar->GetSizePixel().Height();
+ nVerSBarWidth = aVerSBar->GetSizePixel().Width();
aEditIdle.SetPriority( SchedulerPriority::LOWEST );
aEditIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,EditTimeoutHdl));
@@ -156,19 +157,22 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl()
{
pCurEditedEntry = 0;
- DELETEZ(pEdit);
+ pEdit.disposeAndClear();
Clear();
StopEditTimer();
CancelUserEvents();
delete pZOrderList;
delete pImpCursor;
delete pGridMap;
- delete pDDDev;
- delete pDDBufDev;
- delete pDDTempDev;
- delete pEntryPaintDev;
+ pDDDev.disposeAndClear();
+ pDDBufDev.disposeAndClear();
+ pDDTempDev.disposeAndClear();
+ pEntryPaintDev.disposeAndClear();
ClearSelectedRectList();
ClearColumnList();
+ aVerSBar.disposeAndClear();
+ aHorSBar.disposeAndClear();
+ aScrBarBox.disposeAndClear();
}
void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor )
@@ -257,10 +261,10 @@ IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, EndScrollHdl)
void SvxIconChoiceCtrl_Impl::FontModified()
{
StopEditTimer();
- DELETEZ(pDDDev);
- DELETEZ(pDDBufDev);
- DELETEZ(pDDTempDev);
- DELETEZ(pEntryPaintDev);
+ pDDDev.disposeAndClear();
+ pDDBufDev.disposeAndClear();
+ pDDTempDev.disposeAndClear();
+ pEntryPaintDev.disposeAndClear();
SetDefaultTextSize();
ShowCursor( false );
ShowCursor( true );
@@ -499,11 +503,11 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect )
Range aRange;
aVirtOutputSize.Width() += nWidthOffs;
aRange.Max() = aVirtOutputSize.Width();
- aHorSBar.SetRange( aRange );
+ aHorSBar->SetRange( aRange );
aVirtOutputSize.Height() += nHeightOffs;
aRange.Max() = aVirtOutputSize.Height();
- aVerSBar.SetRange( aRange );
+ aVerSBar->SetRange( aRange );
pImpCursor->Clear();
pGridMap->OutputSizeChanged();
@@ -749,9 +753,9 @@ void SvxIconChoiceCtrl_Impl::RepaintEntries( SvxIconViewFlags nEntryFlagsMask )
void SvxIconChoiceCtrl_Impl::InitScrollBarBox()
{
- aScrBarBox.SetSizePixel( Size(nVerSBarWidth-1, nHorSBarHeight-1) );
+ aScrBarBox->SetSizePixel( Size(nVerSBarWidth-1, nHorSBarHeight-1) );
Size aSize( pView->GetOutputSizePixel() );
- aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1));
+ aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1));
}
bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt)
@@ -1251,8 +1255,8 @@ void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeig
Point aPos( 0, nRealHeight );
aPos.Y() -= nHorSBarHeight;
- if( aHorSBar.GetPosPixel() != aPos )
- aHorSBar.SetPosPixel( aPos );
+ if( aHorSBar->GetPosPixel() != aPos )
+ aHorSBar->SetPosPixel( aPos );
// vertical scrollbar
aPos.X() = nRealWidth; aPos.Y() = 0;
@@ -1260,8 +1264,8 @@ void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeig
aPos.X()++;
aPos.Y()--;
- if( aVerSBar.GetPosPixel() != aPos )
- aVerSBar.SetPosPixel( aPos );
+ if( aVerSBar->GetPosPixel() != aPos )
+ aVerSBar->SetPosPixel( aPos );
}
void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
@@ -1340,27 +1344,27 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
}
// size vertical scrollbar
- long nThumb = aVerSBar.GetThumbPos();
+ long nThumb = aVerSBar->GetThumbPos();
Size aSize( nVerSBarWidth, nRealHeight );
aSize.Height() += 2;
- if( aSize != aVerSBar.GetSizePixel() )
- aVerSBar.SetSizePixel( aSize );
- aVerSBar.SetVisibleSize( nVisibleHeight );
- aVerSBar.SetPageSize( GetScrollBarPageSize( nVisibleHeight ));
+ if( aSize != aVerSBar->GetSizePixel() )
+ aVerSBar->SetSizePixel( aSize );
+ aVerSBar->SetVisibleSize( nVisibleHeight );
+ aVerSBar->SetPageSize( GetScrollBarPageSize( nVisibleHeight ));
if( nResult & 0x0001 )
{
- aVerSBar.SetThumbPos( nThumb );
- aVerSBar.Show();
+ aVerSBar->SetThumbPos( nThumb );
+ aVerSBar->Show();
}
else
{
- aVerSBar.SetThumbPos( 0 );
- aVerSBar.Hide();
+ aVerSBar->SetThumbPos( 0 );
+ aVerSBar->Hide();
}
// size horizontal scrollbar
- nThumb = aHorSBar.GetThumbPos();
+ nThumb = aHorSBar->GetThumbPos();
aSize.Width() = nRealWidth;
aSize.Height() = nHorSBarHeight;
aSize.Width()++;
@@ -1369,19 +1373,19 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
aSize.Width()++;
nRealWidth++;
}
- if( aSize != aHorSBar.GetSizePixel() )
- aHorSBar.SetSizePixel( aSize );
- aHorSBar.SetVisibleSize( nVisibleWidth );
- aHorSBar.SetPageSize( GetScrollBarPageSize(nVisibleWidth ));
+ if( aSize != aHorSBar->GetSizePixel() )
+ aHorSBar->SetSizePixel( aSize );
+ aHorSBar->SetVisibleSize( nVisibleWidth );
+ aHorSBar->SetPageSize( GetScrollBarPageSize(nVisibleWidth ));
if( nResult & 0x0002 )
{
- aHorSBar.SetThumbPos( nThumb );
- aHorSBar.Show();
+ aHorSBar->SetThumbPos( nThumb );
+ aHorSBar->Show();
}
else
{
- aHorSBar.SetThumbPos( 0 );
- aHorSBar.Hide();
+ aHorSBar->SetThumbPos( 0 );
+ aHorSBar->Hide();
}
aOutputSize.Width() = nRealWidth;
@@ -1390,9 +1394,9 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
aOutputSize.Height() = nRealHeight;
if( (nResult & (0x0001|0x0002)) == (0x0001|0x0002) )
- aScrBarBox.Show();
+ aScrBarBox->Show();
else
- aScrBarBox.Hide();
+ aScrBarBox->Hide();
}
void SvxIconChoiceCtrl_Impl::Resize()
@@ -1420,7 +1424,7 @@ void SvxIconChoiceCtrl_Impl::Resize()
bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
{
- if( !pZOrderList || !aHorSBar.IsVisible() )
+ if( !pZOrderList || !aHorSBar->IsVisible() )
return false;
const MapMode& rMapMode = pView->GetMapMode();
Point aOrigin( rMapMode.GetOrigin() );
@@ -1438,18 +1442,18 @@ bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
if( nRight > nMostRight )
nMostRight = nRight;
}
- aHorSBar.Hide();
+ aHorSBar->Hide();
aOutputSize.Height() += nHorSBarHeight;
aVirtOutputSize.Width() = nMostRight;
- aHorSBar.SetThumbPos( 0 );
+ aHorSBar->SetThumbPos( 0 );
Range aRange;
aRange.Max() = nMostRight - 1;
- aHorSBar.SetRange( aRange );
- if( aVerSBar.IsVisible() )
+ aHorSBar->SetRange( aRange );
+ if( aVerSBar->IsVisible() )
{
- Size aSize( aVerSBar.GetSizePixel());
+ Size aSize( aVerSBar->GetSizePixel());
aSize.Height() += nHorSBarHeight;
- aVerSBar.SetSizePixel( aSize );
+ aVerSBar->SetSizePixel( aSize );
}
return true;
}
@@ -1458,7 +1462,7 @@ bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar()
{
- if( !pZOrderList || !aVerSBar.IsVisible() )
+ if( !pZOrderList || !aVerSBar->IsVisible() )
return false;
const MapMode& rMapMode = pView->GetMapMode();
Point aOrigin( rMapMode.GetOrigin() );
@@ -1476,18 +1480,18 @@ bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar()
if( nBottom > nDeepest )
nDeepest = nBottom;
}
- aVerSBar.Hide();
+ aVerSBar->Hide();
aOutputSize.Width() += nVerSBarWidth;
aVirtOutputSize.Height() = nDeepest;
- aVerSBar.SetThumbPos( 0 );
+ aVerSBar->SetThumbPos( 0 );
Range aRange;
aRange.Max() = nDeepest - 1;
- aVerSBar.SetRange( aRange );
- if( aHorSBar.IsVisible() )
+ aVerSBar->SetRange( aRange );
+ if( aHorSBar->IsVisible() )
{
- Size aSize( aHorSBar.GetSizePixel());
+ Size aSize( aHorSBar->GetSizePixel());
aSize.Width() += nVerSBarWidth;
- aHorSBar.SetSizePixel( aSize );
+ aHorSBar->SetSizePixel( aSize );
}
return true;
}
@@ -1501,10 +1505,10 @@ void SvxIconChoiceCtrl_Impl::CheckScrollBars()
CheckVerScrollBar();
if( CheckHorScrollBar() )
CheckVerScrollBar();
- if( aVerSBar.IsVisible() && aHorSBar.IsVisible() )
- aScrBarBox.Show();
+ if( aVerSBar->IsVisible() && aHorSBar->IsVisible() )
+ aScrBarBox->Show();
else
- aScrBarBox.Hide();
+ aScrBarBox->Hide();
}
@@ -1680,7 +1684,7 @@ void SvxIconChoiceCtrl_Impl::PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* pEntr
{
if( !pEntryPaintDev )
{
- pEntryPaintDev = new VirtualDevice( *pView );
+ pEntryPaintDev = VclPtr<VirtualDevice>::Create( *pView );
pEntryPaintDev->SetFont( pView->GetFont() );
pEntryPaintDev->SetLineColor();
//pEntryPaintDev->SetBackground( pView->GetBackground() );
@@ -1779,7 +1783,7 @@ void SvxIconChoiceCtrl_Impl::PaintEntry( SvxIconChoiceCtrlEntry* pEntry, const P
}
bool bResetClipRegion = false;
- if( !pView->IsClipRegion() && (aVerSBar.IsVisible() || aHorSBar.IsVisible()) )
+ if( !pView->IsClipRegion() && (aVerSBar->IsVisible() || aHorSBar->IsVisible()) )
{
Rectangle aOutputArea( GetOutputRect() );
if( aOutputArea.IsOver(aTextRect) || aOutputArea.IsOver(aBmpRect) )
@@ -2080,8 +2084,8 @@ long SvxIconChoiceCtrl_Impl::CalcBoundingHeight( SvxIconChoiceCtrlEntry* pEntry
if( nHeight > nMaxBoundHeight )
{
const_cast<SvxIconChoiceCtrl_Impl*>(this)->nMaxBoundHeight = nHeight;
- const_cast<SvxIconChoiceCtrl_Impl*>(this)->aHorSBar.SetLineSize( GetScrollBarLineSize() );
- const_cast<SvxIconChoiceCtrl_Impl*>(this)->aVerSBar.SetLineSize( GetScrollBarLineSize() );
+ const_cast<SvxIconChoiceCtrl_Impl*>(this)->aHorSBar->SetLineSize( GetScrollBarLineSize() );
+ const_cast<SvxIconChoiceCtrl_Impl*>(this)->aVerSBar->SetLineSize( GetScrollBarLineSize() );
}
return nHeight;
}
@@ -2421,16 +2425,16 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const Rectangle& rRect, bool bScrBar,
else
pView->Invalidate(INVALIDATE_NOCHILDREN);
- if( aHorSBar.IsVisible() || aVerSBar.IsVisible() )
+ if( aHorSBar->IsVisible() || aVerSBar->IsVisible() )
{
if( !bScrBar )
{
aOrigin *= -1;
// correct thumbs
- if(aHorSBar.IsVisible() && aHorSBar.GetThumbPos() != aOrigin.X())
- aHorSBar.SetThumbPos( aOrigin.X() );
- if(aVerSBar.IsVisible() && aVerSBar.GetThumbPos() != aOrigin.Y())
- aVerSBar.SetThumbPos( aOrigin.Y() );
+ if(aHorSBar->IsVisible() && aHorSBar->GetThumbPos() != aOrigin.X())
+ aHorSBar->SetThumbPos( aOrigin.X() );
+ if(aVerSBar->IsVisible() && aVerSBar->GetThumbPos() != aOrigin.Y())
+ aVerSBar->SetThumbPos( aOrigin.Y() );
}
}
@@ -3123,7 +3127,7 @@ void SvxIconChoiceCtrl_Impl::EditEntry( SvxIconChoiceCtrlEntry* pEntry )
return;
StopEntryEditing( true );
- DELETEZ(pEdit);
+ pEdit.disposeAndClear();
SetNoSelection();
pCurEditedEntry = pEntry;
@@ -3134,7 +3138,8 @@ void SvxIconChoiceCtrl_Impl::EditEntry( SvxIconChoiceCtrlEntry* pEntry )
aPos = pView->GetPixelPos( aPos );
aRect.SetPos( aPos );
pView->HideFocus();
- pEdit = new IcnViewEdit_Impl(
+ pEdit = VclPtr<IcnViewEdit_Impl>::Create(
+
pView,
aRect.TopLeft(),
aRect.GetSize(),
@@ -3275,11 +3280,17 @@ IcnViewEdit_Impl::IcnViewEdit_Impl( SvtIconChoiceCtrl* pParent, const Point& rPo
IcnViewEdit_Impl::~IcnViewEdit_Impl()
{
+ disposeOnce();
+}
+
+void IcnViewEdit_Impl::dispose()
+{
if( !bAlreadyInCallback )
{
Application::RemoveAccel( &aAccReturn );
Application::RemoveAccel( &aAccEscape );
}
+ MultiLineEdit::dispose();
}
void IcnViewEdit_Impl::CallCallBackHdl_Impl()
@@ -3392,16 +3403,16 @@ void SvxIconChoiceCtrl_Impl::InitSettings()
if( nScrBarSize != nHorSBarHeight || nScrBarSize != nVerSBarWidth )
{
nHorSBarHeight = nScrBarSize;
- Size aSize( aHorSBar.GetSizePixel() );
+ Size aSize( aHorSBar->GetSizePixel() );
aSize.Height() = nScrBarSize;
- aHorSBar.Hide();
- aHorSBar.SetSizePixel( aSize );
+ aHorSBar->Hide();
+ aHorSBar->SetSizePixel( aSize );
nVerSBarWidth = nScrBarSize;
- aSize = aVerSBar.GetSizePixel();
+ aSize = aVerSBar->GetSizePixel();
aSize.Width() = nScrBarSize;
- aVerSBar.Hide();
- aVerSBar.SetSizePixel( aSize );
+ aVerSBar->Hide();
+ aVerSBar->SetSizePixel( aSize );
Size aOSize( pView->Control::GetOutputSizePixel() );
PositionScrollBars( aOSize.Width(), aOSize.Height() );
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index 38f2d5ad82d2..6ed9becbdb4b 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -88,8 +88,18 @@ SvtIconChoiceCtrl::SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle )
SvtIconChoiceCtrl::~SvtIconChoiceCtrl()
{
- _pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
- delete _pImp;
+ disposeOnce();
+}
+
+void SvtIconChoiceCtrl::dispose()
+{
+ if (_pImp)
+ {
+ _pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
+ delete _pImp;
+ _pImp = NULL;
+ }
+ Control::dispose();
}
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const OUString& rText, const Image& rImage, sal_uLong nPos, const Point* pPos, SvxIconViewFlags nFlags )
@@ -206,7 +216,8 @@ void SvtIconChoiceCtrl::GetFocus()
void SvtIconChoiceCtrl::LoseFocus()
{
- _pImp->LoseFocus();
+ if (_pImp)
+ _pImp->LoseFocus();
Control::LoseFocus();
}
@@ -257,12 +268,12 @@ void SvtIconChoiceCtrl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIc
sal_uLong SvtIconChoiceCtrl::GetEntryCount() const
{
- return _pImp->GetEntryCount();
+ return _pImp ? _pImp->GetEntryCount() : 0;
}
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( sal_uLong nPos ) const
{
- return _pImp->GetEntry( nPos );
+ return _pImp ? _pImp->GetEntry( nPos ) : NULL;
}
void SvtIconChoiceCtrl::CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics )
@@ -272,7 +283,7 @@ void SvtIconChoiceCtrl::CreateAutoMnemonics( MnemonicGenerator& _rUsedMnemonics
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetSelectedEntry( sal_uLong& rPos ) const
{
- return _pImp->GetFirstSelectedEntry( rPos );
+ return _pImp ? _pImp->GetFirstSelectedEntry( rPos ) : NULL;
}
void SvtIconChoiceCtrl::ClickIcon()
diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx
index 36e0bb5479e6..f1504b35b233 100644
--- a/svtools/source/contnr/simptabl.cxx
+++ b/svtools/source/contnr/simptabl.cxx
@@ -31,6 +31,17 @@ SvSimpleTableContainer::SvSimpleTableContainer(vcl::Window* pParent, WinBits nBi
{
}
+SvSimpleTableContainer::~SvSimpleTableContainer()
+{
+ disposeOnce();
+}
+
+void SvSimpleTableContainer::dispose()
+{
+ m_pTable.clear();
+ Control::dispose();
+}
+
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvSimpleTableContainer(vcl::Window *pParent,
VclBuilder::stringmap &)
{
@@ -81,7 +92,7 @@ void SvSimpleTableContainer::GetFocus()
SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits):
SvHeaderTabListBox(&rParent, nBits | WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP),
m_rParentTableContainer(rParent),
- aHeaderBar(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP),
+ aHeaderBar(VclPtr<HeaderBar>::Create(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP)),
nHeaderItemId(1),
bPaintFlag(true),
aCollator(*(IntlWrapper( Application::GetSettings().GetLanguageTag() ).getCaseCollator()))
@@ -92,39 +103,46 @@ SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits):
nSortCol = 0xFFFF;
nOldPos = 0;
- aHeaderBar.SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl));
- aHeaderBar.SetDragHdl(LINK( this, SvSimpleTable, DragHdl));
- aHeaderBar.SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl));
- aHeaderBar.SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick));
- aHeaderBar.SetDoubleClickHdl(LINK( this, SvSimpleTable, HeaderBarDblClick));
+ aHeaderBar->SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl));
+ aHeaderBar->SetDragHdl(LINK( this, SvSimpleTable, DragHdl));
+ aHeaderBar->SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl));
+ aHeaderBar->SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick));
+ aHeaderBar->SetDoubleClickHdl(LINK( this, SvSimpleTable, HeaderBarDblClick));
EnableCellFocus();
DisableTransientChildren();
- InitHeaderBar( &aHeaderBar );
+ InitHeaderBar( aHeaderBar );
UpdateViewSize();
- aHeaderBar.Show();
+ aHeaderBar->Show();
SvHeaderTabListBox::Show();
}
SvSimpleTable::~SvSimpleTable()
{
+ disposeOnce();
+}
+
+void SvSimpleTable::dispose()
+{
m_rParentTableContainer.SetTable(NULL);
+ aHeaderBar.disposeAndClear();
+ SvHeaderTabListBox::dispose();
}
void SvSimpleTable::UpdateViewSize()
{
Size theWinSize=m_rParentTableContainer.GetOutputSizePixel();
- Size HbSize=aHeaderBar.GetSizePixel();
+ Size HbSize=aHeaderBar->GetSizePixel();
HbSize.Width()=theWinSize.Width();
theWinSize.Height()-=HbSize.Height();
Point thePos(0,0);
- aHeaderBar.SetPosPixel(thePos);
- aHeaderBar.SetSizePixel(HbSize);
+ aHeaderBar->SetPosPixel(thePos);
+ aHeaderBar->SetSizePixel(HbSize);
thePos.Y()+=HbSize.Height();
SvHeaderTabListBox::SetPosPixel(thePos);
@@ -137,9 +155,9 @@ void SvSimpleTable::NotifyScrolled()
long nOffset=-GetXOffset();
if(nOldPos!=nOffset)
{
- aHeaderBar.SetOffset(nOffset);
- aHeaderBar.Invalidate();
- aHeaderBar.Update();
+ aHeaderBar->SetOffset(nOffset);
+ aHeaderBar->Invalidate();
+ aHeaderBar->Update();
nOldPos=nOffset;
}
SvHeaderTabListBox::NotifyScrolled();
@@ -152,18 +170,18 @@ void SvSimpleTable::SetTabs()
sal_uInt16 nPrivTabCount = TabCount();
if ( nPrivTabCount )
{
- if ( nPrivTabCount > aHeaderBar.GetItemCount() )
- nPrivTabCount = aHeaderBar.GetItemCount();
+ if ( nPrivTabCount > aHeaderBar->GetItemCount() )
+ nPrivTabCount = aHeaderBar->GetItemCount();
sal_uInt16 i, nPos = 0;
for ( i = 1; i < nPrivTabCount; ++i )
{
sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
- aHeaderBar.SetItemSize( i, nNewSize );
+ aHeaderBar->SetItemSize( i, nNewSize );
nPos = (sal_uInt16)GetTab(i);
}
- aHeaderBar.SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry
+ aHeaderBar->SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry
}
}
@@ -181,19 +199,19 @@ void SvSimpleTable::Paint( const Rectangle& rRect )
long nOffset=-GetXOffset();
nOldPos=nOffset;
- aHeaderBar.SetOffset(nOffset);
- aHeaderBar.Invalidate();
+ aHeaderBar->SetOffset(nOffset);
+ aHeaderBar->Invalidate();
if(nPrivTabCount && bPaintFlag)
{
- if(nPrivTabCount>aHeaderBar.GetItemCount())
- nPrivTabCount=aHeaderBar.GetItemCount();
+ if(nPrivTabCount>aHeaderBar->GetItemCount())
+ nPrivTabCount=aHeaderBar->GetItemCount();
sal_uInt16 nPos = 0;
for(sal_uInt16 i=1;i<nPrivTabCount;i++)
{
sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
- aHeaderBar.SetItemSize( i, nNewSize );
+ aHeaderBar->SetItemSize( i, nNewSize );
nPos= static_cast< sal_uInt16 >( GetTab(i) );
}
}
@@ -206,7 +224,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
sal_Int32 nEnd = rText.indexOf( '\t' );
if( nEnd == -1 )
{
- aHeaderBar.InsertItem(nHeaderItemId++, rText, 0, nBits, nCol);
+ aHeaderBar->InsertItem(nHeaderItemId++, rText, 0, nBits, nCol);
}
else
{
@@ -214,7 +232,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
do
{
OUString aString = rText.getToken(0, '\t', nIndex);
- aHeaderBar.InsertItem(nHeaderItemId++, aString, 0, nBits, nCol);
+ aHeaderBar->InsertItem(nHeaderItemId++, aString, 0, nBits, nCol);
}
while ( nIndex >= 0 );
}
@@ -223,7 +241,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
void SvSimpleTable::ClearHeader()
{
- aHeaderBar.Clear();
+ aHeaderBar->Clear();
}
void SvSimpleTable::ShowTable()
@@ -258,25 +276,25 @@ bool SvSimpleTable::IsEnabled() const
sal_uInt16 SvSimpleTable::GetSelectedCol()
{
- return (aHeaderBar.GetCurItemId()-1);
+ return (aHeaderBar->GetCurItemId()-1);
}
void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir)
{
if(nSortCol!=0xFFFF)
- aHeaderBar.SetItemBits(nSortCol+1,HeaderBarItemBits::STDSTYLE);
+ aHeaderBar->SetItemBits(nSortCol+1,HeaderBarItemBits::STDSTYLE);
if (nCol != 0xFFFF)
{
if(bDir || nSortCol != nCol)
{
- aHeaderBar.SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::DOWNARROW);
+ aHeaderBar->SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::DOWNARROW);
GetModel()->SetSortMode(SortAscending);
bDir = true;
}
else
{
- aHeaderBar.SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::UPARROW);
+ aHeaderBar->SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::UPARROW);
GetModel()->SetSortMode(SortDescending);
}
@@ -302,9 +320,9 @@ void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir)
void SvSimpleTable::HBarClick()
{
- sal_uInt16 nId=aHeaderBar.GetCurItemId();
+ sal_uInt16 nId=aHeaderBar->GetCurItemId();
- if (aHeaderBar.GetItemBits(nId) & HeaderBarItemBits::CLICKABLE)
+ if (aHeaderBar->GetItemBits(nId) & HeaderBarItemBits::CLICKABLE)
{
if(nId==nSortCol+1)
{
@@ -326,24 +344,24 @@ void SvSimpleTable::HBarDblClick()
void SvSimpleTable::HBarStartDrag()
{
- if(!aHeaderBar.IsItemMode())
+ if(!aHeaderBar->IsItemMode())
{
Rectangle aSizeRect(Point(0,0),
SvHeaderTabListBox::GetOutputSizePixel());
- aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
- aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+ aSizeRect.Left()=-GetXOffset()+aHeaderBar->GetDragPos();
+ aSizeRect.Right()=-GetXOffset()+aHeaderBar->GetDragPos();
ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
}
}
void SvSimpleTable::HBarDrag()
{
HideTracking();
- if(!aHeaderBar.IsItemMode())
+ if(!aHeaderBar->IsItemMode())
{
Rectangle aSizeRect(Point(0,0),
SvHeaderTabListBox::GetOutputSizePixel());
- aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
- aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+ aSizeRect.Left()=-GetXOffset()+aHeaderBar->GetDragPos();
+ aSizeRect.Right()=-GetXOffset()+aHeaderBar->GetDragPos();
ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
}
}
@@ -354,14 +372,14 @@ void SvSimpleTable::HBarEndDrag()
if(nPrivTabCount)
{
- if(nPrivTabCount>aHeaderBar.GetItemCount())
- nPrivTabCount=aHeaderBar.GetItemCount();
+ if(nPrivTabCount>aHeaderBar->GetItemCount())
+ nPrivTabCount=aHeaderBar->GetItemCount();
sal_uInt16 nPos=0;
sal_uInt16 nNewSize=0;
for(sal_uInt16 i=1;i<nPrivTabCount;i++)
{
- nNewSize = static_cast< sal_uInt16 >( aHeaderBar.GetItemSize(i) ) + nPos;
+ nNewSize = static_cast< sal_uInt16 >( aHeaderBar->GetItemSize(i) ) + nPos;
SetTab( i, nNewSize, MAP_PIXEL );
nPos = nNewSize;
}
@@ -381,7 +399,7 @@ void SvSimpleTable::Command( const CommandEvent& rCEvt )
IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarStartDrag();
}
@@ -390,7 +408,7 @@ IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr)
IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarDrag();
}
@@ -399,7 +417,7 @@ IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr)
IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarEndDrag();
}
@@ -408,7 +426,7 @@ IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr)
IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarClick();
}
@@ -417,7 +435,7 @@ IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr)
IMPL_LINK( SvSimpleTable, HeaderBarDblClick, HeaderBar*, pCtr)
{
- if(pCtr==&aHeaderBar)
+ if(pCtr==aHeaderBar.get())
{
HBarDblClick();
}
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 1b0f9e801948..78b68095bf59 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -47,9 +47,9 @@ Image* SvImpLBox::s_pDefExpanded = NULL;
sal_Int32 SvImpLBox::s_nImageRefCount = 0;
SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinStyle)
- : aVerSBar(pLBView, WB_DRAG | WB_VSCROLL)
- , aHorSBar(pLBView, WB_DRAG | WB_HSCROLL)
- , aScrBarBox(pLBView)
+ : aVerSBar(VclPtr<ScrollBar>::Create(pLBView, WB_DRAG | WB_VSCROLL))
+ , aHorSBar(VclPtr<ScrollBar>::Create(pLBView, WB_DRAG | WB_HSCROLL))
+ , aScrBarBox(VclPtr<ScrollBarBox>::Create(pLBView))
, aOutputSize(0, 0)
, aSelEng(pLBView, (FunctionSet*)0)
, aFctSet(this, &aSelEng, pLBView)
@@ -67,18 +67,18 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinS
SetSelectionMode( SINGLE_SELECTION );
SetDragDropMode( DragDropMode::NONE );
- aVerSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) );
- aHorSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) );
- aHorSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
- aVerSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
- aVerSBar.SetRange( Range(0,0) );
- aVerSBar.Hide();
- aHorSBar.SetRange( Range(0,0) );
- aHorSBar.SetPageSize( 24 ); // pixels
- aHorSBar.SetLineSize( 8 ); // pixels
+ aVerSBar->SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) );
+ aHorSBar->SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) );
+ aHorSBar->SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
+ aVerSBar->SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
+ aVerSBar->SetRange( Range(0,0) );
+ aVerSBar->Hide();
+ aHorSBar->SetRange( Range(0,0) );
+ aHorSBar->SetPageSize( 24 ); // pixels
+ aHorSBar->SetLineSize( 8 ); // pixels
- nHorSBarHeight = (short)aHorSBar.GetSizePixel().Height();
- nVerSBarWidth = (short)aVerSBar.GetSizePixel().Width();
+ nHorSBarHeight = (short)aHorSBar->GetSizePixel().Height();
+ nVerSBarWidth = (short)aVerSBar->GetSizePixel().Width();
pStartEntry = 0;
pCursor = 0;
@@ -124,6 +124,9 @@ SvImpLBox::~SvImpLBox()
DELETEZ(s_pDefCollapsed);
DELETEZ(s_pDefExpanded);
}
+ aVerSBar.disposeAndClear();
+ aHorSBar.disposeAndClear();
+ aScrBarBox.disposeAndClear();
}
void SvImpLBox::UpdateStringSorter()
@@ -268,25 +271,25 @@ void SvImpLBox::Clear()
pView->HideFocus();
pCursor = 0;
}
- aVerSBar.Hide();
- aVerSBar.SetThumbPos( 0 );
+ aVerSBar->Hide();
+ aVerSBar->SetThumbPos( 0 );
Range aRange( 0, 0 );
- aVerSBar.SetRange( aRange );
+ aVerSBar->SetRange( aRange );
aOutputSize = pView->Control::GetOutputSizePixel();
nFlags &= ~(F_VER_SBARSIZE_WITH_HBAR | F_HOR_SBARSIZE_WITH_VBAR );
- aHorSBar.Hide();
- aHorSBar.SetThumbPos( 0 );
+ aHorSBar->Hide();
+ aHorSBar->SetThumbPos( 0 );
MapMode aMapMode( pView->GetMapMode());
aMapMode.SetOrigin( Point(0,0) );
pView->Control::SetMapMode( aMapMode );
- aHorSBar.SetRange( aRange );
- aHorSBar.SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight));
+ aHorSBar->SetRange( aRange );
+ aHorSBar->SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight));
pView->SetClipRegion();
if( GetUpdateMode() )
pView->Invalidate( GetVisibleArea() );
nFlags |= F_FILLING;
- if( !aHorSBar.IsVisible() && !aVerSBar.IsVisible() )
- aScrBarBox.Hide();
+ if( !aHorSBar->IsVisible() && !aVerSBar->IsVisible() )
+ aScrBarBox->Hide();
aContextBmpWidthVector.clear();
@@ -301,7 +304,7 @@ IMPL_LINK_NOARG_INLINE_START(SvImpLBox, EndScrollHdl)
{
if( nFlags & F_ENDSCROLL_SET_VIS_SIZE )
{
- aVerSBar.SetVisibleSize( nNextVerVisSize );
+ aVerSBar->SetVisibleSize( nNextVerVisSize );
nFlags &= ~F_ENDSCROLL_SET_VIS_SIZE;
}
EndScroll();
@@ -470,16 +473,16 @@ void SvImpLBox::PageUp( sal_uInt16 nDelta )
void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
{
- if( !aVerSBar.IsVisible() )
+ if( !aVerSBar->IsVisible() )
return;
long nDelta;
if( bPageUp )
- nDelta = aVerSBar.GetPageSize();
+ nDelta = aVerSBar->GetPageSize();
else
nDelta = 1;
- long nThumbPos = aVerSBar.GetThumbPos();
+ long nThumbPos = aVerSBar->GetThumbPos();
if( nThumbPos < nDelta )
nDelta = nThumbPos;
@@ -491,7 +494,7 @@ void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
if( bNotifyScroll )
BeginScroll();
- aVerSBar.SetThumbPos( nThumbPos - nDelta );
+ aVerSBar->SetThumbPos( nThumbPos - nDelta );
if( bPageUp )
PageUp( (short)nDelta );
else
@@ -504,18 +507,18 @@ void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
void SvImpLBox::KeyDown( bool bPageDown, bool bNotifyScroll )
{
- if( !aVerSBar.IsVisible() )
+ if( !aVerSBar->IsVisible() )
return;
long nDelta;
if( bPageDown )
- nDelta = aVerSBar.GetPageSize();
+ nDelta = aVerSBar->GetPageSize();
else
nDelta = 1;
- long nThumbPos = aVerSBar.GetThumbPos();
- long nVisibleSize = aVerSBar.GetVisibleSize();
- long nRange = aVerSBar.GetRange().Len();
+ long nThumbPos = aVerSBar->GetThumbPos();
+ long nVisibleSize = aVerSBar->GetVisibleSize();
+ long nRange = aVerSBar->GetRange().Len();
long nTmp = nThumbPos+nVisibleSize;
while( (nDelta > 0) && (nTmp+nDelta) >= nRange )
@@ -528,7 +531,7 @@ void SvImpLBox::KeyDown( bool bPageDown, bool bNotifyScroll )
if( bNotifyScroll )
BeginScroll();
- aVerSBar.SetThumbPos( nThumbPos+nDelta );
+ aVerSBar->SetThumbPos( nThumbPos+nDelta );
if( bPageDown )
PageDown( (short)nDelta );
else
@@ -709,7 +712,7 @@ void SvImpLBox::UpdateAll(
{
if( bUpdateVerScrollBar )
FindMostRight(0);
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
SyncVerThumb();
FillView();
ShowVerSBar();
@@ -748,7 +751,7 @@ void SvImpLBox::KeyLeftRight( long nDelta )
ShowCursor( false );
// neuen Origin berechnen
- long nPos = aHorSBar.GetThumbPos();
+ long nPos = aHorSBar->GetThumbPos();
Point aOrigin( -nPos, 0 );
MapMode aMapMode( pView->GetMapMode() );
@@ -899,7 +902,7 @@ void SvImpLBox::Paint( const Rectangle& rRect )
{
ShowCursor( false );
pStartEntry = pView->First();
- aVerSBar.SetThumbPos( 0 );
+ aVerSBar->SetThumbPos( 0 );
StopUserEvent();
ShowCursor( true );
nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpLBox,MyUserEvent), reinterpret_cast<void*>(1));
@@ -1003,7 +1006,7 @@ void SvImpLBox::MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop )
pStartEntry = pEntry;
ShowCursor( false );
FillView();
- aVerSBar.SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) );
+ aVerSBar->SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) );
ShowCursor( true );
pView->Invalidate();
}
@@ -1030,7 +1033,7 @@ void SvImpLBox::ScrollToAbsPos( long nPos )
{
pStartEntry = pEntry;
ShowCursor( false );
- aVerSBar.SetThumbPos( nPos );
+ aVerSBar->SetThumbPos( nPos );
ShowCursor( true );
if (GetUpdateMode())
pView->Invalidate();
@@ -1168,12 +1171,12 @@ void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask )
aVerSize.Height() += 2 * nOverlap;
Point aVerPos( rSize.Width() - aVerSize.Width() + nOverlap, -nOverlap );
- aVerSBar.SetPosSizePixel( aVerPos, aVerSize );
+ aVerSBar->SetPosSizePixel( aVerPos, aVerSize );
aHorSize.Width() += 2 * nOverlap;
Point aHorPos( -nOverlap, rSize.Height() - aHorSize.Height() + nOverlap );
- aHorSBar.SetPosSizePixel( aHorPos, aHorSize );
+ aHorSBar->SetPosSizePixel( aHorPos, aHorSize );
if( nMask & 0x0001 )
rSize.Width() = aVerPos.X();
@@ -1181,9 +1184,9 @@ void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask )
rSize.Height() = aHorPos.Y();
if( (nMask & (0x0001|0x0002)) == (0x0001|0x0002) )
- aScrBarBox.Show();
+ aScrBarBox->Show();
else
- aScrBarBox.Hide();
+ aScrBarBox->Hide();
}
// nResult: Bit0 == VerSBar Bit1 == HorSBar
@@ -1259,12 +1262,12 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
// vertical scrollbar
long nTemp = (long)nVisibleCount;
nTemp--;
- if( nTemp != aVerSBar.GetVisibleSize() )
+ if( nTemp != aVerSBar->GetVisibleSize() )
{
if( !bInVScrollHdl )
{
- aVerSBar.SetPageSize( nTemp - 1 );
- aVerSBar.SetVisibleSize( nTemp );
+ aVerSBar->SetPageSize( nTemp - 1 );
+ aVerSBar->SetVisibleSize( nTemp );
}
else
{
@@ -1274,14 +1277,14 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
}
// horizontal scrollbar
- nTemp = aHorSBar.GetThumbPos();
- aHorSBar.SetVisibleSize( aOSize.Width() );
- long nNewThumbPos = aHorSBar.GetThumbPos();
- Range aRange( aHorSBar.GetRange() );
+ nTemp = aHorSBar->GetThumbPos();
+ aHorSBar->SetVisibleSize( aOSize.Width() );
+ long nNewThumbPos = aHorSBar->GetThumbPos();
+ Range aRange( aHorSBar->GetRange() );
if( aRange.Max() < nMostRight+25 )
{
aRange.Max() = nMostRight+25;
- aHorSBar.SetRange( aRange );
+ aHorSBar->SetRange( aRange );
}
if( nTemp != nNewThumbPos )
@@ -1297,15 +1300,15 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
}
if( nResult & 0x0001 )
- aVerSBar.Show();
+ aVerSBar->Show();
else
- aVerSBar.Hide();
+ aVerSBar->Hide();
if( nResult & 0x0002 )
- aHorSBar.Show();
+ aHorSBar->Show();
else
{
- aHorSBar.Hide();
+ aHorSBar->Hide();
}
rSize = aOSize;
return nResult;
@@ -1313,9 +1316,9 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
void SvImpLBox::InitScrollBarBox()
{
- aScrBarBox.SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) );
+ aScrBarBox->SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) );
Size aSize( pView->Control::GetOutputSizePixel() );
- aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight));
+ aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight));
}
void SvImpLBox::Resize()
@@ -1333,10 +1336,10 @@ void SvImpLBox::Resize()
}
// HACK, as in floating and docked windows the scrollbars might not be drawn
// correctly/not be drawn at all after resizing!
- if( aHorSBar.IsVisible())
- aHorSBar.Invalidate();
- if( aVerSBar.IsVisible())
- aVerSBar.Invalidate();
+ if( aHorSBar->IsVisible())
+ aHorSBar->Invalidate();
+ if( aVerSBar->IsVisible())
+ aVerSBar->Invalidate();
nFlags &= (~(F_IN_RESIZE | F_PAINTED));
}
@@ -1345,7 +1348,7 @@ void SvImpLBox::FillView()
if( !pStartEntry )
{
sal_uInt16 nVisibleViewCount = (sal_uInt16)(pView->GetVisibleCount());
- sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar.GetThumbPos();
+ sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar->GetThumbPos();
if( nTempThumb >= nVisibleViewCount )
nTempThumb = nVisibleViewCount - 1;
pStartEntry = pView->GetEntryAtVisPos(nTempThumb);
@@ -1374,7 +1377,7 @@ void SvImpLBox::FillView()
}
if( bFound )
{
- aVerSBar.SetThumbPos( nThumb );
+ aVerSBar->SetThumbPos( nThumb );
ShowCursor( true ); // recalculate focus rectangle
pView->Invalidate();
}
@@ -1393,17 +1396,17 @@ void SvImpLBox::ShowVerSBar()
nVis = pView->GetVisibleCount();
if( bVerBar || (nVisibleCount && nVis > (sal_uLong)(nVisibleCount-1)) )
{
- if( !aVerSBar.IsVisible() )
+ if( !aVerSBar->IsVisible() )
{
pView->nFocusWidth = -1;
AdjustScrollBars( aOutputSize );
if( GetUpdateMode() )
- aVerSBar.Update();
+ aVerSBar->Update();
}
}
else
{
- if( aVerSBar.IsVisible() )
+ if( aVerSBar->IsVisible() )
{
pView->nFocusWidth = -1;
AdjustScrollBars( aOutputSize );
@@ -1416,20 +1419,20 @@ void SvImpLBox::ShowVerSBar()
nMaxRight = nMaxRight + aPos.X() - 1;
if( nMaxRight < nMostRight )
{
- if( !aHorSBar.IsVisible() )
+ if( !aHorSBar->IsVisible() )
{
pView->nFocusWidth = -1;
AdjustScrollBars( aOutputSize );
if( GetUpdateMode() )
- aHorSBar.Update();
+ aHorSBar->Update();
}
else
{
- Range aRange( aHorSBar.GetRange() );
+ Range aRange( aHorSBar->GetRange() );
if( aRange.Max() < nMostRight+25 )
{
aRange.Max() = nMostRight+25;
- aHorSBar.SetRange( aRange );
+ aHorSBar->SetRange( aRange );
}
else
{
@@ -1440,7 +1443,7 @@ void SvImpLBox::ShowVerSBar()
}
else
{
- if( aHorSBar.IsVisible() )
+ if( aHorSBar->IsVisible() )
{
pView->nFocusWidth = -1;
AdjustScrollBars( aOutputSize );
@@ -1454,10 +1457,10 @@ void SvImpLBox::SyncVerThumb()
if( pStartEntry )
{
long nEntryPos = pView->GetVisiblePos( pStartEntry );
- aVerSBar.SetThumbPos( nEntryPos );
+ aVerSBar->SetThumbPos( nEntryPos );
}
else
- aVerSBar.SetThumbPos( 0 );
+ aVerSBar->SetThumbPos( 0 );
}
bool SvImpLBox::IsEntryInView( SvTreeListEntry* pEntry ) const
@@ -1522,7 +1525,7 @@ void SvImpLBox::EntryExpanded( SvTreeListEntry* pEntry )
InvalidateEntriesFrom( nY );
FindMostRight( pEntry, 0 );
}
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
// if we expanded before the thumb, the thumb's position has to be
// corrected
SyncVerThumb();
@@ -1545,10 +1548,10 @@ void SvImpLBox::EntryCollapsed( SvTreeListEntry* pEntry )
if( pStartEntry )
{
- long nOldThumbPos = aVerSBar.GetThumbPos();
+ long nOldThumbPos = aVerSBar->GetThumbPos();
sal_uLong nVisList = pView->GetVisibleCount();
- aVerSBar.SetRange( Range(0, nVisList-1) );
- long nNewThumbPos = aVerSBar.GetThumbPos();
+ aVerSBar->SetRange( Range(0, nVisList-1) );
+ long nNewThumbPos = aVerSBar->GetThumbPos();
if( nNewThumbPos != nOldThumbPos )
{
pStartEntry = pView->First();
@@ -1708,7 +1711,7 @@ void SvImpLBox::RemovingEntry( SvTreeListEntry* pEntry )
// drawn correctly (in this case they're deleted)
if( pStartEntry && (pStartEntry != pOldStartEntry || pEntry == (SvTreeListEntry*)pView->GetModel()->Last()) )
{
- aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry ));
+ aVerSBar->SetThumbPos( pView->GetVisiblePos( pStartEntry ));
pView->Invalidate( GetVisibleArea() );
}
else
@@ -1735,11 +1738,11 @@ void SvImpLBox::EntryRemoved()
{
if( nFlags & F_REMOVED_RECALC_MOST_RIGHT )
FindMostRight(0);
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
FillView();
if( pStartEntry )
// if something above the thumb was deleted
- aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry) );
+ aVerSBar->SetThumbPos( pView->GetVisiblePos( pStartEntry) );
ShowVerSBar();
if( pCursor && pView->HasFocus() && !pView->IsSelected(pCursor) )
@@ -1804,7 +1807,7 @@ void SvImpLBox::EntryMoved( SvTreeListEntry* pEntry )
// #i97346#
pStartEntry = pView->First();
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1));
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1));
sal_uInt16 nFirstPos = (sal_uInt16)pTree->GetAbsPos( pStartEntry );
sal_uInt16 nNewPos = (sal_uInt16)pTree->GetAbsPos( pEntry );
FindMostRight(0);
@@ -1876,7 +1879,7 @@ void SvImpLBox::EntryInserted( SvTreeListEntry* pEntry )
pView->Invalidate();
SetMostRight( pEntry );
- aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1));
+ aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1));
SyncVerThumb(); // if something was inserted before the thumb
ShowVerSBar();
ShowCursor( true );
@@ -2153,7 +2156,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
bool bKeyUsed = true;
- sal_uInt16 nDelta = (sal_uInt16)aVerSBar.GetPageSize();
+ sal_uInt16 nDelta = (sal_uInt16)aVerSBar->GetPageSize();
sal_uInt16 aCode = rKeyCode.GetCode();
bool bShift = rKeyCode.IsShift();
@@ -2251,12 +2254,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
}
else if( nWindowStyle & WB_HSCROLL )
{
- long nThumb = aHorSBar.GetThumbPos();
- nThumb += aHorSBar.GetLineSize();
- long nOldThumb = aHorSBar.GetThumbPos();
- aHorSBar.SetThumbPos( nThumb );
+ long nThumb = aHorSBar->GetThumbPos();
+ nThumb += aHorSBar->GetLineSize();
+ long nOldThumb = aHorSBar->GetThumbPos();
+ aHorSBar->SetThumbPos( nThumb );
nThumb = nOldThumb;
- nThumb -= aHorSBar.GetThumbPos();
+ nThumb -= aHorSBar->GetThumbPos();
nThumb *= -1;
if( nThumb )
{
@@ -2282,12 +2285,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
}
else if ( nWindowStyle & WB_HSCROLL )
{
- long nThumb = aHorSBar.GetThumbPos();
- nThumb -= aHorSBar.GetLineSize();
- long nOldThumb = aHorSBar.GetThumbPos();
- aHorSBar.SetThumbPos( nThumb );
+ long nThumb = aHorSBar->GetThumbPos();
+ nThumb -= aHorSBar->GetLineSize();
+ long nOldThumb = aHorSBar->GetThumbPos();
+ aHorSBar->SetThumbPos( nThumb );
nThumb = nOldThumb;
- nThumb -= aHorSBar.GetThumbPos();
+ nThumb -= aHorSBar->GetThumbPos();
if( nThumb )
{
KeyLeftRight( -nThumb );
@@ -2979,7 +2982,7 @@ void SvImpLBox::Command( const CommandEvent& rCEvt )
// scroll mouse event?
if( ( ( nCommand == COMMAND_WHEEL ) || ( nCommand == COMMAND_STARTAUTOSCROLL ) || ( nCommand == COMMAND_AUTOSCROLL ) )
- && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) )
+ && pView->HandleScrollCommand( rCEvt, aHorSBar.get(), aVerSBar.get() ) )
return;
if( bContextMenuHandling && nCommand == COMMAND_CONTEXTMENU )
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index 67f18c210efa..e44f25c2c566 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -110,12 +110,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvTabListBox(vcl::Wind
SvTabListBox::~SvTabListBox()
{
+ disposeOnce();
+}
+
+void SvTabListBox::dispose()
+{
// delete array
delete [] pTabList;
#ifdef DBG_UTIL
pTabList = 0;
nTabCount = 0;
#endif
+ SvTreeListBox::dispose();
}
void SvTabListBox::SetTabs(const long* pTabs, MapUnit eMapUnit)
@@ -497,7 +503,7 @@ namespace svt
{
struct SvHeaderTabListBoxImpl
{
- HeaderBar* m_pHeaderBar;
+ VclPtr<HeaderBar> m_pHeaderBar;
AccessibleFactoryAccess m_aFactoryAccess;
SvHeaderTabListBoxImpl() : m_pHeaderBar( NULL ) { }
@@ -520,7 +526,13 @@ SvHeaderTabListBox::SvHeaderTabListBox( vcl::Window* pParent, WinBits nWinStyle
SvHeaderTabListBox::~SvHeaderTabListBox()
{
+ disposeOnce();
+}
+
+void SvHeaderTabListBox::dispose()
+{
delete m_pImpl;
+ SvTabListBox::dispose();
}
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 3f7ab3f7fa00..ab4028684ee9 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -131,9 +131,9 @@ SvInplaceEdit2::SvInplaceEdit2
{
if( bMulti )
- pEdit = new MyMultiEdit_Impl( pParent, this );
+ pEdit = VclPtr<MyMultiEdit_Impl>::Create( pParent, this );
else
- pEdit = new MyEdit_Impl( pParent, this );
+ pEdit = VclPtr<MyEdit_Impl>::Create( pParent, this );
vcl::Font aFont( pParent->GetFont() );
aFont.SetTransparent( false );
@@ -166,7 +166,7 @@ SvInplaceEdit2::~SvInplaceEdit2()
Application::RemoveAccel( &aAccReturn );
Application::RemoveAccel( &aAccEscape );
}
- delete pEdit;
+ pEdit.disposeAndClear();
}
OUString SvInplaceEdit2::GetSavedValue() const
@@ -1539,29 +1539,49 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry )
SvTreeListBox::~SvTreeListBox()
{
+ disposeOnce();
+}
- pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
- delete pImp;
- delete mpImpl->m_pLink;
- ClearTabList();
-
- delete pEdCtrl;
- pEdCtrl = 0;
- pModel->RemoveView( this );
- if ( pModel->GetRefCount() == 0 )
+void SvTreeListBox::dispose()
+{
+ if( pImp )
{
- pModel->Clear();
- delete pModel;
- pModel = NULL;
+ pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
+ delete pImp;
+ pImp = NULL;
}
+ if( mpImpl )
+ {
+ delete mpImpl->m_pLink;
+ mpImpl->m_pLink = NULL;
+
+ ClearTabList();
- SvTreeListBox::RemoveBoxFromDDList_Impl( *this );
+ delete pEdCtrl;
+ pEdCtrl = NULL;
- if( this == pDDSource )
- pDDSource = 0;
- if( this == pDDTarget )
- pDDTarget = 0;
- delete mpImpl;
+ if( pModel )
+ {
+ pModel->RemoveView( this );
+ if ( pModel->GetRefCount() == 0 )
+ {
+ pModel->Clear();
+ delete pModel;
+ pModel = NULL;
+ }
+ }
+
+ SvTreeListBox::RemoveBoxFromDDList_Impl( *this );
+
+ if( this == pDDSource )
+ pDDSource = 0;
+ if( this == pDDTarget )
+ pDDTarget = 0;
+ delete mpImpl;
+ mpImpl = NULL;
+ }
+
+ Control::dispose();
}
void SvTreeListBox::SetExtendedWinBits( ExtendedWinBits _nBits )
@@ -2197,12 +2217,11 @@ void SvTreeListBox::GetFocus()
void SvTreeListBox::LoseFocus()
{
- //If there is no item in the tree, delete visual focus.
- if( !First())
- {
+ // If there is no item in the tree, delete visual focus.
+ if ( !First() )
Invalidate();
- }
- pImp->LoseFocus();
+ if ( pImp )
+ pImp->LoseFocus();
Control::LoseFocus();
}
@@ -2234,17 +2253,17 @@ void SvTreeListBox::ShowTargetEmphasis( SvTreeListEntry* pEntry, bool /*bShow*/
void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
{
- if( !nDeltaEntries || !pImp->aVerSBar.IsVisible() )
+ if( !nDeltaEntries || !pImp->aVerSBar->IsVisible() )
return;
- long nThumb = pImp->aVerSBar.GetThumbPos();
- long nMax = pImp->aVerSBar.GetRange().Max();
+ long nThumb = pImp->aVerSBar->GetThumbPos();
+ long nMax = pImp->aVerSBar->GetRange().Max();
if( nDeltaEntries < 0 )
{
// move window up
nDeltaEntries *= -1;
- long nVis = pImp->aVerSBar.GetVisibleSize();
+ long nVis = pImp->aVerSBar->GetVisibleSize();
long nTemp = nThumb + nVis;
if( nDeltaEntries > (nMax - nTemp) )
nDeltaEntries = (short)(nMax - nTemp);
@@ -3495,6 +3514,8 @@ void SvTreeListBox::NotifyScrolled()
void SvTreeListBox::Invalidate( sal_uInt16 nInvalidateFlags )
{
+ if (!pImp)
+ return;
if( nFocusWidth == -1 )
// to make sure that the control doesn't show the wrong focus rectangle
// after painting
@@ -3666,12 +3687,12 @@ void SvTreeListBox::EndSelection()
ScrollBar *SvTreeListBox::GetVScroll()
{
- return &((SvTreeListBox*)this)->pImp->aVerSBar;
+ return pImp->aVerSBar.get();
}
ScrollBar *SvTreeListBox::GetHScroll()
{
- return &((SvTreeListBox*)this)->pImp->aHorSBar;
+ return pImp->aHorSBar.get();
}
void SvTreeListBox::EnableAsyncDrag( bool b )
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index 1d02dc34ab09..89566f37844f 100644
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -257,6 +257,11 @@ Calendar::Calendar( vcl::Window* pParent, WinBits nWinStyle ) :
Calendar::~Calendar()
{
+ disposeOnce();
+}
+
+void Calendar::dispose()
+{
delete mpStandardColor;
delete mpSaturdayColor;
delete mpSundayColor;
@@ -264,6 +269,7 @@ Calendar::~Calendar()
delete mpSelectTable;
delete mpOldSelectTable;
delete mpRestoreSelectTable;
+ Control::dispose();
}
@@ -2183,14 +2189,15 @@ Size Calendar::CalcWindowSizePixel( long nCalcMonthPerLine,
class ImplCFieldFloatWin : public FloatingWindow
{
private:
- Calendar* mpCalendar;
- PushButton* mpTodayBtn;
- PushButton* mpNoneBtn;
- FixedLine* mpFixedLine;
+ VclPtr<Calendar> mpCalendar;
+ VclPtr<PushButton> mpTodayBtn;
+ VclPtr<PushButton> mpNoneBtn;
+ VclPtr<FixedLine> mpFixedLine;
public:
ImplCFieldFloatWin( vcl::Window* pParent );
- virtual ~ImplCFieldFloatWin();
+ virtual ~ImplCFieldFloatWin();
+ virtual void dispose() SAL_OVERRIDE;
void SetCalendar( Calendar* pCalendar )
{ mpCalendar = pCalendar; }
@@ -2217,9 +2224,16 @@ ImplCFieldFloatWin::ImplCFieldFloatWin( vcl::Window* pParent ) :
ImplCFieldFloatWin::~ImplCFieldFloatWin()
{
- delete mpTodayBtn;
- delete mpNoneBtn;
- delete mpFixedLine;
+ disposeOnce();
+}
+
+void ImplCFieldFloatWin::dispose()
+{
+ mpTodayBtn.disposeAndClear();
+ mpNoneBtn.disposeAndClear();
+ mpFixedLine.disposeAndClear();
+ mpCalendar.clear();
+ FloatingWindow::dispose();
}
@@ -2230,7 +2244,7 @@ PushButton* ImplCFieldFloatWin::EnableTodayBtn( bool bEnable )
{
if ( !mpTodayBtn )
{
- mpTodayBtn = new PushButton( this, WB_NOPOINTERFOCUS );
+ mpTodayBtn = VclPtr<PushButton>::Create( this, WB_NOPOINTERFOCUS );
OUString aTodayText(SVT_RESSTR(STR_SVT_CALENDAR_TODAY));
mpTodayBtn->SetText( aTodayText );
Size aSize;
@@ -2244,11 +2258,7 @@ PushButton* ImplCFieldFloatWin::EnableTodayBtn( bool bEnable )
}
else
{
- if ( mpTodayBtn )
- {
- delete mpTodayBtn;
- mpTodayBtn = NULL;
- }
+ mpTodayBtn.disposeAndClear();
}
return mpTodayBtn;
@@ -2262,7 +2272,7 @@ PushButton* ImplCFieldFloatWin::EnableNoneBtn( bool bEnable )
{
if ( !mpNoneBtn )
{
- mpNoneBtn = new PushButton( this, WB_NOPOINTERFOCUS );
+ mpNoneBtn = VclPtr<PushButton>::Create( this, WB_NOPOINTERFOCUS );
OUString aNoneText(SVT_RESSTR(STR_SVT_CALENDAR_NONE));
mpNoneBtn->SetText( aNoneText );
Size aSize;
@@ -2276,11 +2286,7 @@ PushButton* ImplCFieldFloatWin::EnableNoneBtn( bool bEnable )
}
else
{
- if ( mpNoneBtn )
- {
- delete mpNoneBtn;
- mpNoneBtn = NULL;
- }
+ mpNoneBtn.disposeAndClear();
}
return mpNoneBtn;
@@ -2333,7 +2339,7 @@ void ImplCFieldFloatWin::ArrangeButtons()
{
if ( !mpFixedLine )
{
- mpFixedLine = new FixedLine( this );
+ mpFixedLine = VclPtr<FixedLine>::Create( this );
mpFixedLine->Show();
}
long nLineWidth = aOutSize.Width()-(CALFIELD_BORDERLINE_X*2);
@@ -2344,11 +2350,7 @@ void ImplCFieldFloatWin::ArrangeButtons()
}
else
{
- if ( mpFixedLine )
- {
- delete mpFixedLine;
- mpFixedLine = NULL;
- }
+ mpFixedLine.disposeAndClear();
}
}
@@ -2381,11 +2383,16 @@ CalendarField::CalendarField(vcl::Window* pParent, WinBits nWinStyle)
CalendarField::~CalendarField()
{
- if ( mpFloatWin )
- {
- delete mpCalendar;
- delete mpFloatWin;
- }
+ disposeOnce();
+}
+
+void CalendarField::dispose()
+{
+ mpCalendar.disposeAndClear();
+ mpFloatWin.disposeAndClear();
+ mpTodayBtn.clear();
+ mpNoneBtn.clear();
+ DateField::dispose();
}
@@ -2510,9 +2517,9 @@ bool CalendarField::ShowDropDown( bool bShow )
-Calendar* CalendarField::CreateCalendar( vcl::Window* pParent )
+VclPtr<Calendar> CalendarField::CreateCalendar( vcl::Window* pParent )
{
- return new Calendar( pParent, mnCalendarStyle | WB_TABSTOP );
+ return VclPtr<Calendar>::Create( pParent, mnCalendarStyle | WB_TABSTOP );
}
@@ -2521,7 +2528,7 @@ Calendar* CalendarField::GetCalendar()
{
if ( !mpFloatWin )
{
- mpFloatWin = new ImplCFieldFloatWin( this );
+ mpFloatWin = VclPtr<ImplCFieldFloatWin>::Create( this );
mpFloatWin->SetPopupModeEndHdl( LINK( this, CalendarField, ImplPopupModeEndHdl ) );
mpCalendar = CreateCalendar( mpFloatWin );
mpCalendar->SetPosPixel( Point() );
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index c9d035f1cfa7..8e397e4de9cc 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -118,8 +118,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorListBox(vcl::Wind
ColorListBox::~ColorListBox()
{
- ImplDestroyColorEntries();
- delete pColorList;
+ disposeOnce();
+}
+
+void ColorListBox::dispose()
+{
+ if ( pColorList )
+ {
+ ImplDestroyColorEntries();
+ delete pColorList;
+ pColorList = NULL;
+ }
+ ListBox::dispose();
}
sal_Int32 ColorListBox::InsertEntry( const OUString& rStr, sal_Int32 nPos )
@@ -660,8 +670,8 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance,
}
// Linien malen
- aSize = aVirDev.PixelToLogic( aSize );
- long nPix = aVirDev.PixelToLogic( Size( 0, 1 ) ).Height();
+ aSize = aVirDev->PixelToLogic( aSize );
+ long nPix = aVirDev->PixelToLogic( Size( 0, 1 ) ).Height();
sal_uInt32 n1 = nLine1;
sal_uInt32 n2 = nLine2;
long nDist = nDistance;
@@ -680,24 +690,24 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance,
// negative width should not be drawn
if ( aSize.Width() > 0 )
{
- Size aVirSize = aVirDev.LogicToPixel( aSize );
- if ( aVirDev.GetOutputSizePixel() != aVirSize )
- aVirDev.SetOutputSizePixel( aVirSize );
- aVirDev.SetFillColor( aColorDist );
- aVirDev.DrawRect( Rectangle( Point(), aSize ) );
+ Size aVirSize = aVirDev->LogicToPixel( aSize );
+ if ( aVirDev->GetOutputSizePixel() != aVirSize )
+ aVirDev->SetOutputSizePixel( aVirSize );
+ aVirDev->SetFillColor( aColorDist );
+ aVirDev->DrawRect( Rectangle( Point(), aSize ) );
- aVirDev.SetFillColor( aColor1 );
+ aVirDev->SetFillColor( aColor1 );
double y1 = double( n1 ) / 2;
- svtools::DrawLine( aVirDev, basegfx::B2DPoint( 0, y1 ), basegfx::B2DPoint( aSize.Width( ), y1 ), n1, nStyle );
+ svtools::DrawLine( *aVirDev.get(), basegfx::B2DPoint( 0, y1 ), basegfx::B2DPoint( aSize.Width( ), y1 ), n1, nStyle );
if ( n2 )
{
double y2 = n1 + nDist + double( n2 ) / 2;
- aVirDev.SetFillColor( aColor2 );
- svtools::DrawLine( aVirDev, basegfx::B2DPoint( 0, y2 ), basegfx::B2DPoint( aSize.Width(), y2 ), n2, table::BorderLineStyle::SOLID );
+ aVirDev->SetFillColor( aColor2 );
+ svtools::DrawLine( *aVirDev.get(), basegfx::B2DPoint( 0, y2 ), basegfx::B2DPoint( aSize.Width(), y2 ), n2, table::BorderLineStyle::SOLID );
}
- rBmp = aVirDev.GetBitmap( Point(), Size( aSize.Width(), n1+nDist+n2 ) );
+ rBmp = aVirDev->GetBitmap( Point(), Size( aSize.Width(), n1+nDist+n2 ) );
}
}
@@ -709,8 +719,8 @@ void LineListBox::ImplInit()
eUnit = FUNIT_POINT;
eSourceUnit = FUNIT_POINT;
- aVirDev.SetLineColor();
- aVirDev.SetMapMode( MapMode( MAP_TWIP ) );
+ aVirDev->SetLineColor();
+ aVirDev->SetMapMode( MapMode( MAP_TWIP ) );
UpdatePaintLineColor();
}
@@ -719,6 +729,7 @@ LineListBox::LineListBox( vcl::Window* pParent, WinBits nWinStyle ) :
ListBox( pParent, nWinStyle ),
m_nWidth( 5 ),
m_sNone( ),
+ aVirDev( new VirtualDevice ),
aColor( COL_BLACK ),
maPaintCol( COL_BLACK )
{
@@ -739,6 +750,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineListBox(vcl::Windo
LineListBox::~LineListBox()
{
+ disposeOnce();
+}
+
+void LineListBox::dispose()
+{
for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) {
if ( (*pLineList)[ i ] ) {
delete (*pLineList)[ i ];
@@ -746,6 +762,7 @@ LineListBox::~LineListBox()
}
pLineList->clear();
delete pLineList;
+ ListBox::dispose();
}
sal_Int32 LineListBox::GetStylePos( sal_Int32 nListPos, long nWidth )
@@ -936,8 +953,17 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontNameBox(vcl::Windo
FontNameBox::~FontNameBox()
{
- SaveMRUEntries (maFontMRUEntriesFile);
- ImplDestroyFontList();
+ disposeOnce();
+}
+
+void FontNameBox::dispose()
+{
+ if (mpFontList)
+ {
+ SaveMRUEntries (maFontMRUEntriesFile);
+ ImplDestroyFontList();
+ }
+ ComboBox::dispose();
}
void FontNameBox::SaveMRUEntries( const OUString& aFontMRUEntriesFile, sal_Unicode cSep ) const
@@ -999,6 +1025,7 @@ void FontNameBox::InitFontMRUEntriesFile()
void FontNameBox::ImplDestroyFontList()
{
delete mpFontList;
+ mpFontList = NULL;
}
void FontNameBox::Fill( const FontList* pList )
@@ -1312,10 +1339,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontStyleBox(vcl::Wind
return pListBox;
}
-FontStyleBox::~FontStyleBox()
-{
-}
-
void FontStyleBox::Select()
{
// keep text over fill operation
@@ -1512,10 +1535,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontSizeBox(vcl::Windo
return pListBox;
}
-FontSizeBox::~FontSizeBox()
-{
-}
-
void FontSizeBox::ImplInit()
{
EnableAutocomplete( false );
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index b9f987ae975f..b8d32ec1cc23 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -74,7 +74,7 @@ class ImplFontListFontInfo : public vcl::FontInfo
friend class FontList;
private:
- OutputDevice* mpDevice;
+ VclPtr<OutputDevice> mpDevice;
ImplFontListFontInfo* mpNext;
public:
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index 7326b3d4aa50..33b5423eb952 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -36,17 +36,17 @@ using namespace ::com::sun::star::ui;
FileControl::FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode nFlags ) :
Window( pParent, nStyle|WB_DIALOGCONTROL ),
- maEdit( this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP ),
- maButton( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ),
+ maEdit( VclPtr<Edit>::Create(this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP) ),
+ maButton( VclPtr<PushButton>::Create( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ) ),
maButtonText( SVT_RESSTR(STR_FILECTRL_BUTTONTEXT) ),
mnFlags( nFlags ),
mnInternalFlags( FileControlMode_Internal::ORIGINALBUTTONTEXT )
{
- maButton.SetClickHdl( LINK( this, FileControl, ButtonHdl ) );
+ maButton->SetClickHdl( LINK( this, FileControl, ButtonHdl ) );
mbOpenDlg = true;
- maButton.Show();
- maEdit.Show();
+ maButton->Show();
+ maEdit->Show();
SetCompoundControl( true );
@@ -59,17 +59,17 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
{
if ( !( nStyle & WB_NOTABSTOP ) )
{
- maEdit.SetStyle( (maEdit.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
- maButton.SetStyle( (maButton.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
+ maEdit->SetStyle( (maEdit->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
+ maButton->SetStyle( (maButton->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
}
else
{
- maEdit.SetStyle( (maEdit.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
- maButton.SetStyle( (maButton.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
+ maEdit->SetStyle( (maEdit->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
+ maButton->SetStyle( (maButton->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
}
const WinBits nAlignmentStyle = ( WB_TOP | WB_VCENTER | WB_BOTTOM );
- maEdit.SetStyle( ( maEdit.GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
+ maEdit->SetStyle( ( maEdit->GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
if ( !(nStyle & WB_NOGROUP) )
nStyle |= WB_GROUP;
@@ -86,13 +86,19 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
FileControl::~FileControl()
{
+ disposeOnce();
}
-
+void FileControl::dispose()
+{
+ maEdit.disposeAndClear();
+ maButton.disposeAndClear();
+ Window::dispose();
+}
void FileControl::SetText( const OUString& rStr )
{
- maEdit.SetText( rStr );
+ maEdit->SetText( rStr );
if ( mnFlags & FileControlMode::RESIZEBUTTONBYPATHLEN )
Resize();
}
@@ -101,7 +107,7 @@ void FileControl::SetText( const OUString& rStr )
OUString FileControl::GetText() const
{
- return maEdit.GetText();
+ return maEdit->GetText();
}
@@ -110,8 +116,8 @@ void FileControl::StateChanged( StateChangedType nType )
{
if ( nType == StateChangedType::ENABLE )
{
- maEdit.Enable( IsEnabled() );
- maButton.Enable( IsEnabled() );
+ maEdit->Enable( IsEnabled() );
+ maButton->Enable( IsEnabled() );
}
else if ( nType == StateChangedType::ZOOM )
{
@@ -155,25 +161,25 @@ void FileControl::Resize()
mnInternalFlags |= FileControlMode_Internal::INRESIZE;//InResize = sal_True
Size aOutSz = GetOutputSizePixel();
- long nButtonTextWidth = maButton.GetTextWidth( maButtonText );
+ long nButtonTextWidth = maButton->GetTextWidth( maButtonText );
if ( !(mnInternalFlags & FileControlMode_Internal::ORIGINALBUTTONTEXT) ||
( nButtonTextWidth < aOutSz.Width()/3 &&
( !( mnFlags & FileControlMode::RESIZEBUTTONBYPATHLEN ) ||
- ( maEdit.GetTextWidth( maEdit.GetText() )
+ ( maEdit->GetTextWidth( maEdit->GetText() )
<= aOutSz.Width() - nButtonTextWidth - ButtonBorder ) ) ) )
{
- maButton.SetText( maButtonText );
+ maButton->SetText( maButtonText );
}
else
{
OUString aSmallText( "..." );
- maButton.SetText( aSmallText );
- nButtonTextWidth = maButton.GetTextWidth( aSmallText );
+ maButton->SetText( aSmallText );
+ nButtonTextWidth = maButton->GetTextWidth( aSmallText );
}
long nButtonWidth = nButtonTextWidth+ButtonBorder;
- maEdit.setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() );
- maButton.setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() );
+ maEdit->setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() );
+ maButton->setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() );
mnInternalFlags &= ~FileControlMode_Internal::INRESIZE; //InResize = sal_False
}
@@ -191,7 +197,7 @@ IMPL_LINK_NOARG(FileControl, ButtonHdl)
void FileControl::GetFocus()
{
- maEdit.GrabFocus();
+ maEdit->GrabFocus();
}
@@ -237,7 +243,7 @@ void FileControl::ImplBrowseFile( )
if ( aObj.GetProtocol() == INetProtocol::File )
aNewText = aObj.PathToFileName();
SetText( aNewText );
- maEdit.GetModifyHdl().Call( &maEdit );
+ maEdit->GetModifyHdl().Call( &maEdit );
}
}
}
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index b332942119e2..a6202529274b 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -334,10 +334,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFormattedField(vcl::Wi
return new FormattedField(pParent, nWinBits);
}
-FormattedField::~FormattedField()
-{
-}
-
void FormattedField::SetText(const OUString& rStr)
{
@@ -1026,7 +1022,13 @@ void FormattedField::UseInputStringForFormatting( bool bUseInputStr /* = true */
DoubleNumericField::~DoubleNumericField()
{
+ disposeOnce();
+}
+
+void DoubleNumericField::dispose()
+{
delete m_pNumberValidator;
+ FormattedField::dispose();
}
void DoubleNumericField::FormatChanged(FORMAT_CHANGE_TYPE nWhat)
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx
index 79393103dc4f..311003eeb5f2 100644
--- a/svtools/source/control/headbar.cxx
+++ b/svtools/source/control/headbar.cxx
@@ -114,15 +114,20 @@ HeaderBar::HeaderBar( vcl::Window* pParent, WinBits nWinStyle ) :
HeaderBar::~HeaderBar()
{
- // Alle Items loeschen
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
- delete (*mpItemList)[ i ];
- }
- mpItemList->clear();
- delete mpItemList;
+ disposeOnce();
}
-
+void HeaderBar::dispose()
+{
+ if (mpItemList)
+ {
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
+ delete (*mpItemList)[ i ];
+ delete mpItemList;
+ mpItemList = NULL;
+ }
+ Window::dispose();
+}
void HeaderBar::ImplInitSettings( bool bFont,
bool bForeground, bool bBackground )
diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx
index e54d7e1bdddf..fa826230e2ec 100644
--- a/svtools/source/control/hyperlabel.cxx
+++ b/svtools/source/control/hyperlabel.cxx
@@ -155,7 +155,13 @@ namespace svt
HyperLabel::~HyperLabel( )
{
+ disposeOnce();
+ }
+
+ void HyperLabel::dispose()
+ {
delete m_pImpl;
+ FixedText::dispose();
}
void HyperLabel::SetInteractive( bool _bInteractive )
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index f75c82c98d9a..370a1f97eaab 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -91,13 +91,13 @@ class SvtMatchContext_Impl: public salhelper::Thread
{
static ::osl::Mutex* pDirMutex;
- std::vector<OUString> aPickList;
- std::vector<OUString> aCompletions;
- std::vector<OUString> aURLs;
+ std::vector<OUString> aPickList;
+ std::vector<OUString> aCompletions;
+ std::vector<OUString> aURLs;
svtools::AsynchronLink aLink;
OUString aBaseURL;
OUString aText;
- SvtURLBox* pBox;
+ VclPtr<SvtURLBox> pBox;
bool bOnlyDirectories;
bool bNoSelection;
@@ -906,6 +906,11 @@ void SvtURLBox::Init(bool bSetDefaultHelpID)
SvtURLBox::~SvtURLBox()
{
+ disposeOnce();
+}
+
+void SvtURLBox::dispose()
+{
if( pCtx.is() )
{
pCtx->Stop();
@@ -913,6 +918,7 @@ SvtURLBox::~SvtURLBox()
}
delete pImp;
+ ComboBox::dispose();
}
void SvtURLBox::UpdatePickList( )
diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx
index dcd6d6b497c6..3d15ae367178 100644
--- a/svtools/source/control/roadmap.cxx
+++ b/svtools/source/control/roadmap.cxx
@@ -45,20 +45,18 @@ namespace svt
{
public:
IDLabel( vcl::Window* _pParent, WinBits _nWinStyle = 0 );
- virtual ~IDLabel( );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
};
class RoadmapItem : public RoadmapTypes
{
private:
- IDLabel* mpID;
- HyperLabel* mpDescription;
+ VclPtr<IDLabel> mpID;
+ VclPtr<HyperLabel> mpDescription;
const Size m_aItemPlayground;
public:
RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground );
- ~RoadmapItem( );
void SetID( sal_Int16 _ID );
sal_Int16 GetID() const;
@@ -204,6 +202,11 @@ namespace svt
ORoadmap::~ORoadmap( )
{
+ disposeOnce();
+ }
+
+ void ORoadmap::dispose()
+ {
HL_Vector aItemsCopy = m_pImpl->getHyperLabels();
m_pImpl->getHyperLabels().clear();
for ( HL_Vector::iterator i = aItemsCopy.begin(); i != aItemsCopy.end(); ++i )
@@ -214,6 +217,7 @@ namespace svt
delete m_pImpl->InCompleteHyperLabel;
delete m_pImpl;
m_pImpl = NULL;
+ Control::dispose();
}
@@ -677,10 +681,10 @@ namespace svt
RoadmapItem::RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground )
:m_aItemPlayground( _rItemPlayground )
{
- mpID = new IDLabel( &_rParent, WB_WORDBREAK );
+ mpID = VclPtr<IDLabel>::Create( &_rParent, WB_WORDBREAK );
mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
mpID->Show();
- mpDescription = new HyperLabel( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
+ mpDescription = VclPtr<HyperLabel>::Create( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
mpDescription->Show();
}
@@ -823,19 +827,6 @@ namespace svt
}
- RoadmapItem::~RoadmapItem( )
- {
- {
- boost::scoped_ptr<Control> xTakeOnership(mpID);
- mpID = NULL;
- }
- {
- boost::scoped_ptr<Control> xTakeOnership(mpDescription);
- mpDescription = NULL;
- }
- }
-
-
void RoadmapItem::SetClickHdl( const Link& rLink )
{
if ( mpDescription )
@@ -850,11 +841,6 @@ namespace svt
}
- IDLabel::~IDLabel( )
- {
- }
-
-
void IDLabel::DataChanged( const DataChangedEvent& rDCEvt )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index d65875ce26f9..c675606ee557 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -289,7 +289,7 @@ void Ruler::ImplInit( WinBits nWinBits )
Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) :
Window( pParent, nWinStyle & WB_3DLOOK ),
- maVirDev( *this ),
+ maVirDev( VclPtr<VirtualDevice>::Create(*this) ),
maMapMode( MAP_100TH_MM ),
mpSaveData(new ImplRulerData),
mpData(NULL),
@@ -325,12 +325,23 @@ Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) :
Ruler::~Ruler()
{
+ disposeOnce();
+}
+
+void Ruler::dispose()
+{
if ( mnUpdateEvtId )
Application::RemoveUserEvent( mnUpdateEvtId );
delete mpSaveData;
+ mpSaveData = NULL;
delete mpDragData;
+ mpDragData = NULL;
if( pAccContext )
+ {
pAccContext->release();
+ pAccContext = NULL;
+ }
+ Window::dispose();
}
void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 )
@@ -350,9 +361,9 @@ void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 )
}
if ( mnWinStyle & WB_HORZ )
- maVirDev.DrawLine( Point( nX1, nY1 ), Point( nX2, nY2 ) );
+ maVirDev->DrawLine( Point( nX1, nY1 ), Point( nX2, nY2 ) );
else
- maVirDev.DrawLine( Point( nY1, nX1 ), Point( nY2, nX2 ) );
+ maVirDev->DrawLine( Point( nY1, nX1 ), Point( nY2, nX2 ) );
}
void Ruler::ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 )
@@ -372,15 +383,15 @@ void Ruler::ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 )
}
if ( mnWinStyle & WB_HORZ )
- maVirDev.DrawRect( Rectangle( nX1, nY1, nX2, nY2 ) );
+ maVirDev->DrawRect( Rectangle( nX1, nY1, nX2, nY2 ) );
else
- maVirDev.DrawRect( Rectangle( nY1, nX1, nY2, nX2 ) );
+ maVirDev->DrawRect( Rectangle( nY1, nX1, nY2, nX2 ) );
}
void Ruler::ImplVDrawText( long nX, long nY, const OUString& rText, long nMin, long nMax )
{
Rectangle aRect;
- maVirDev.GetTextBoundRect( aRect, rText );
+ maVirDev->GetTextBoundRect( aRect, rText );
long nShiftX = ( aRect.GetWidth() / 2 ) + aRect.Left();
long nShiftY = ( aRect.GetHeight() / 2 ) + aRect.Top();
@@ -388,9 +399,9 @@ void Ruler::ImplVDrawText( long nX, long nY, const OUString& rText, long nMin, l
if ( (nX > -RULER_CLIP) && (nX < mnVirWidth + RULER_CLIP) && ( nX < nMax - nShiftX ) && ( nX > nMin + nShiftX ) )
{
if ( mnWinStyle & WB_HORZ )
- maVirDev.DrawText( Point( nX - nShiftX, nY - nShiftY ), rText );
+ maVirDev->DrawText( Point( nX - nShiftX, nY - nShiftY ), rText );
else
- maVirDev.DrawText( Point( nY - nShiftX, nX - nShiftY ), rText );
+ maVirDev->DrawText( Point( nY - nShiftX, nX - nShiftY ), rText );
}
}
@@ -478,7 +489,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
double nAcceptanceDelta = 0.0001;
- Size aPixSize = maVirDev.LogicToPixel( Size( nTick4, nTick4 ), maMapMode );
+ Size aPixSize = maVirDev->LogicToPixel( Size( nTick4, nTick4 ), maMapMode );
if ( mnUnitIndex == RULER_UNIT_CHAR )
{
@@ -510,11 +521,11 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
aFont.SetOrientation( 2700 );
else
aFont.SetOrientation( 900 );
- maVirDev.SetFont( aFont );
+ maVirDev->SetFont( aFont );
nTickWidth = aPixSize.Height();
}
- long nMaxWidth = maVirDev.PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width();
+ long nMaxWidth = maVirDev->PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width();
if ( nMaxWidth < 0 )
nMaxWidth = -nMaxWidth;
@@ -558,7 +569,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
}
nTick4 = nOrgTick4 * nMulti;
- aPixSize = maVirDev.LogicToPixel( Size( nTick4, nTick4 ), maMapMode );
+ aPixSize = maVirDev->LogicToPixel( Size( nTick4, nTick4 ), maMapMode );
if ( mnWinStyle & WB_HORZ )
nTickWidth = aPixSize.Width();
else
@@ -568,7 +579,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
}
else
{
- maVirDev.SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
+ maVirDev->SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
}
if ( !bNoTicks )
@@ -585,11 +596,11 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
Size nTickGapSize;
- nTickGapSize = maVirDev.LogicToPixel( Size( nTickCount, nTickCount ), maMapMode );
+ nTickGapSize = maVirDev->LogicToPixel( Size( nTickCount, nTickCount ), maMapMode );
long nTickGap1 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
- nTickGapSize = maVirDev.LogicToPixel( Size( nTick2, nTick2 ), maMapMode );
+ nTickGapSize = maVirDev->LogicToPixel( Size( nTick2, nTick2 ), maMapMode );
long nTickGap2 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
- nTickGapSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
+ nTickGapSize = maVirDev->LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
long nTickGap3 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height();
while ( ((nStart - n) >= nMin) || ((nStart + n) <= nMax) )
@@ -609,7 +620,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nTop, long nB
}
else
{
- aPixSize = maVirDev.LogicToPixel( Size( nTick, nTick ), maMapMode );
+ aPixSize = maVirDev->LogicToPixel( Size( nTick, nTick ), maMapMode );
if ( mnWinStyle & WB_HORZ )
n = aPixSize.Width();
@@ -709,20 +720,20 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
{
if ( (n2-n1) > 3 )
{
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( rStyleSettings.GetFaceColor() );
+ maVirDev->SetLineColor();
+ maVirDev->SetFillColor( rStyleSettings.GetFaceColor() );
ImplVDrawRect( n1, nVirTop, n2, nVirBottom );
- maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetLightColor() );
ImplVDrawLine( n1 + 1, nVirTop, n1 + 1, nVirBottom );
ImplVDrawLine( n1, nVirTop, n2, nVirTop );
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
ImplVDrawLine( n1, nVirTop, n1, nVirBottom );
ImplVDrawLine( n1, nVirBottom, n2, nVirBottom );
ImplVDrawLine( n2 - 1, nVirTop, n2 - 1, nVirBottom );
- maVirDev.SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
ImplVDrawLine( n2, nVirTop, n2, nVirBottom );
if ( mpData->pBorders[i].nStyle & RULER_BORDER_VARIABLE )
@@ -735,7 +746,7 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
long nTemp4 = nTemp2 + RULER_VAR_SIZE - 1;
long nTempY = nTemp2;
- maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetLightColor() );
while ( nTempY <= nTemp4 )
{
ImplVDrawLine( nTemp1, nTempY, nTemp3, nTempY );
@@ -743,7 +754,7 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
}
nTempY = nTemp2 + 1;
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
while ( nTempY <= nTemp4 )
{
ImplVDrawLine( nTemp1, nTempY, nTemp3, nTempY );
@@ -756,10 +767,10 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
{
if ( n2-n1 > RULER_VAR_SIZE+10 )
{
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
ImplVDrawLine( n1 + 4, nVirTop + 3, n1 + 4, nVirBottom - 3 );
ImplVDrawLine( n2 - 5, nVirTop + 3, n2 - 5, nVirBottom - 3 );
- maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetLightColor() );
ImplVDrawLine( n1 + 5, nVirTop + 3, n1 + 5, nVirBottom - 3 );
ImplVDrawLine( n2 - 4, nVirTop + 3, n2 - 4, nVirBottom - 3 );
}
@@ -768,7 +779,7 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
else
{
n = n1 + ((n2 - n1) / 2);
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
if ( mpData->pBorders[i].nStyle & RULER_BORDER_SNAP )
ImplVDrawLine( n, nVirTop, n, nVirBottom );
@@ -778,8 +789,8 @@ void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom
{
ImplVDrawLine( n - 1, nVirTop, n - 1, nVirBottom );
ImplVDrawLine( n + 1, nVirTop, n + 1, nVirBottom );
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ maVirDev->SetLineColor();
+ maVirDev->SetFillColor( rStyleSettings.GetWindowColor() );
ImplVDrawRect( n, nVirTop, n, nVirBottom );
}
}
@@ -794,9 +805,9 @@ void Ruler::ImplDrawIndent( const Polygon& rPoly, sal_uInt16 nStyle, bool bIsHit
if ( nStyle & RULER_STYLE_INVISIBLE )
return;
- maVirDev.SetLineColor( rStyleSettings.GetDarkShadowColor() );
- maVirDev.SetFillColor( bIsHit ? rStyleSettings.GetDarkShadowColor() : rStyleSettings.GetWorkspaceColor() );
- maVirDev.DrawPolygon( rPoly );
+ maVirDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ maVirDev->SetFillColor( bIsHit ? rStyleSettings.GetDarkShadowColor() : rStyleSettings.GetWorkspaceColor() );
+ maVirDev->DrawPolygon( rPoly );
}
void Ruler::ImplDrawIndents( long nMin, long nMax, long nVirTop, long nVirBottom )
@@ -823,7 +834,7 @@ void Ruler::ImplDrawIndents( long nMin, long nMax, long nVirTop, long nVirBottom
if (nIndentStyle == RULER_INDENT_BORDER)
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
ImplVDrawLine( n, nVirTop + 1, n, nVirBottom - 1 );
}
else if ( nIndentStyle == RULER_INDENT_BOTTOM )
@@ -1027,7 +1038,7 @@ void Ruler::ImplDrawTabs( long nMin, long nMax, long nVirTop, long nVirBottom )
aPosition += +mpData->nNullVirOff;
long nTopBottom = (GetStyle() & WB_RIGHT_ALIGNED) ? nVirTop : nVirBottom;
if (nMin <= aPosition && aPosition <= nMax)
- ImplDrawTab( &maVirDev, Point( aPosition, nTopBottom ), mpData->pTabs[i].nStyle );
+ ImplDrawTab( maVirDev.get(), Point( aPosition, nTopBottom ), mpData->pTabs[i].nStyle );
}
}
@@ -1082,16 +1093,16 @@ void Ruler::ImplInitSettings( bool bFont, bool bForeground, bool bBackground )
SetBackground( aColor );
}
- maVirDev.SetSettings( GetSettings() );
- maVirDev.SetBackground( GetBackground() );
+ maVirDev->SetSettings( GetSettings() );
+ maVirDev->SetBackground( GetBackground() );
vcl::Font aFont = GetFont();
if ( mnWinStyle & WB_VERT )
aFont.SetOrientation( 900 );
- maVirDev.SetFont( aFont );
- maVirDev.SetTextColor( GetTextColor() );
- maVirDev.SetTextFillColor( GetTextFillColor() );
+ maVirDev->SetFont( aFont );
+ maVirDev->SetTextColor( GetTextColor() );
+ maVirDev->SetTextFillColor( GetTextFillColor() );
}
void Ruler::ImplCalc()
@@ -1189,10 +1200,10 @@ void Ruler::ImplFormat()
aVirDevSize.Height() = mnVirWidth;
aVirDevSize.Width() = mnVirHeight;
}
- if ( aVirDevSize != maVirDev.GetOutputSizePixel() )
- maVirDev.SetOutputSizePixel( aVirDevSize, true );
+ if ( aVirDevSize != maVirDev->GetOutputSizePixel() )
+ maVirDev->SetOutputSizePixel( aVirDevSize, true );
else
- maVirDev.Erase();
+ maVirDev->Erase();
// calculate margins
if ( !(mpData->nMargin1Style & RULER_STYLE_INVISIBLE) )
@@ -1233,7 +1244,7 @@ void Ruler::ImplFormat()
}
// top/bottom border
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
ImplVDrawLine( nVirLeft, nVirTop + 1, nM1, nVirTop + 1 ); //top left line
ImplVDrawLine( nM2, nVirTop + 1, nP2 - 1, nVirTop + 1 ); //top right line
@@ -1241,18 +1252,18 @@ void Ruler::ImplFormat()
nVirBottom--;
// draw margin1, margin2 and in-between
- maVirDev.SetLineColor();
- maVirDev.SetFillColor( rStyleSettings.GetDialogColor() );
+ maVirDev->SetLineColor();
+ maVirDev->SetFillColor( rStyleSettings.GetDialogColor() );
if ( nM1 > nVirLeft )
ImplVDrawRect( nP1, nVirTop+1, nM1, nVirBottom ); //left gray rectangle
if ( nM2 < nP2 )
ImplVDrawRect( nM2, nVirTop+1, nP2, nVirBottom ); //right gray rectangle
if ( nM2-nM1 > 0 )
{
- maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ maVirDev->SetFillColor( rStyleSettings.GetWindowColor() );
ImplVDrawRect( nM1 + 1, nVirTop, nM2 - 1, nVirBottom ); //center rectangle
}
- maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev->SetLineColor( rStyleSettings.GetShadowColor() );
if ( nM1 > nVirLeft )
{
ImplVDrawLine( nM1, nVirTop + 1, nM1, nVirBottom ); //right line of the left rectangle
@@ -1363,7 +1374,7 @@ void Ruler::ImplDraw()
{
// output the ruler to the virtual device
Point aOffPos;
- Size aVirDevSize = maVirDev.GetOutputSizePixel();
+ Size aVirDevSize = maVirDev->GetOutputSizePixel();
if ( mnWinStyle & WB_HORZ )
{
@@ -1378,7 +1389,7 @@ void Ruler::ImplDraw()
aOffPos.X() = RULER_OFF;
aOffPos.Y() = mnVirOff;
}
- DrawOutDev( aOffPos, aVirDevSize, Point(), aVirDevSize, maVirDev );
+ DrawOutDev( aOffPos, aVirDevSize, Point(), aVirDevSize, *maVirDev.get() );
// redraw positionlines
ImplInvertLines( true );
diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx
index 44dbf55d8dea..9bac31091e9a 100644
--- a/svtools/source/control/scrwin.cxx
+++ b/svtools/source/control/scrwin.cxx
@@ -30,10 +30,10 @@ void ScrollableWindow::ImpInitialize( ScrollableWindowFlags nFlags )
bScrolling = false;
// set the handlers for the scrollbars
- aVScroll.SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
- aHScroll.SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
- aVScroll.SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
- aHScroll.SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
+ aVScroll->SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
+ aHScroll->SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
+ aVScroll->SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
+ aHScroll->SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
nColumnPixW = nLinePixH = GetSettings().GetStyleSettings().GetScrollBarSize();
}
@@ -43,14 +43,27 @@ void ScrollableWindow::ImpInitialize( ScrollableWindowFlags nFlags )
ScrollableWindow::ScrollableWindow( vcl::Window* pParent, WinBits nBits,
ScrollableWindowFlags nFlags ) :
Window( pParent, WinBits(nBits|WB_CLIPCHILDREN) ),
- aVScroll( this, WinBits(WB_VSCROLL | WB_DRAG) ),
- aHScroll( this, WinBits(WB_HSCROLL | WB_DRAG) ),
- aCornerWin( this )
+ aVScroll( VclPtr<ScrollBar>::Create(this, WinBits(WB_VSCROLL | WB_DRAG)) ),
+ aHScroll( VclPtr<ScrollBar>::Create(this, WinBits(WB_HSCROLL | WB_DRAG)) ),
+ aCornerWin( VclPtr<ScrollBarBox>::Create(this) )
{
ImpInitialize( nFlags );
}
+ScrollableWindow::~ScrollableWindow()
+{
+ disposeOnce();
+}
+
+void ScrollableWindow::dispose()
+{
+ aVScroll.disposeAndClear();
+ aHScroll.disposeAndClear();
+ aCornerWin.disposeAndClear();
+ Window::dispose();
+}
+
void ScrollableWindow::Command( const CommandEvent& rCEvt )
{
@@ -60,12 +73,12 @@ void ScrollableWindow::Command( const CommandEvent& rCEvt )
{
ScrollBar* pHScrBar;
ScrollBar* pVScrBar;
- if ( aHScroll.IsVisible() )
- pHScrBar = &aHScroll;
+ if ( aHScroll->IsVisible() )
+ pHScrBar = aHScroll.get();
else
pHScrBar = NULL;
- if ( aVScroll.IsVisible() )
- pVScrBar = &aVScroll;
+ if ( aVScroll->IsVisible() )
+ pVScrBar = aVScroll.get();
else
pVScrBar = NULL;
if ( HandleScrollCommand( rCEvt, pHScrBar, pVScrBar ) )
@@ -96,9 +109,9 @@ Size ScrollableWindow::GetOutputSizePixel() const
Size aSz( Window::GetOutputSizePixel() );
long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize();
- if ( aHScroll.IsVisible() )
+ if ( aHScroll->IsVisible() )
aSz.Height() -= nTmp;
- if ( aVScroll.IsVisible() )
+ if ( aVScroll->IsVisible() )
aSz.Width() -= nTmp;
return aSz;
}
@@ -112,12 +125,12 @@ IMPL_LINK( ScrollableWindow, EndScrollHdl, ScrollBar *, pScroll )
bScrolling = true;
// get the delta in logic coordinates
- Size aDelta( PixelToLogic( Size( aHScroll.GetDelta(), aVScroll.GetDelta() ) ) );
+ Size aDelta( PixelToLogic( Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) );
// scroll the window, if this is not already done
if ( !bHandleDragging )
{
- if ( pScroll == &aHScroll )
+ if ( pScroll == aHScroll.get() )
Scroll( aDelta.Width(), 0 );
else
Scroll( 0, aDelta.Height() );
@@ -140,8 +153,8 @@ IMPL_LINK( ScrollableWindow, ScrollHdl, ScrollBar *, pScroll )
{
// get the delta in logic coordinates
Size aDelta( PixelToLogic(
- Size( aHScroll.GetDelta(), aVScroll.GetDelta() ) ) );
- if ( pScroll == &aHScroll )
+ Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) );
+ if ( pScroll == aHScroll.get() )
Scroll( aDelta.Width(), 0 );
else
Scroll( 0, aDelta.Height() );
@@ -219,9 +232,9 @@ void ScrollableWindow::Resize()
? (aOutPixSz.Height()-aTotPixSz.Height()) / 2
: 0 ) );
}
- if ( bHVisible && !aHScroll.IsVisible() )
+ if ( bHVisible && !aHScroll->IsVisible() )
aPixOffset.X() = 0;
- if ( bVVisible && !aVScroll.IsVisible() )
+ if ( bVVisible && !aVScroll->IsVisible() )
aPixOffset.Y() = 0;
// select the shifted map-mode
@@ -235,41 +248,41 @@ void ScrollableWindow::Resize()
}
// show or hide scrollbars
- aVScroll.Show( bVVisible );
- aHScroll.Show( bHVisible );
+ aVScroll->Show( bVVisible );
+ aHScroll->Show( bHVisible );
// disable painting in the corner between the scrollbars
if ( bVVisible && bHVisible )
{
- aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()),
+ aCornerWin->SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()),
Size(nScrSize, nScrSize) );
- aCornerWin.Show();
+ aCornerWin->Show();
}
else
- aCornerWin.Hide();
+ aCornerWin->Hide();
// resize scrollbars and set their ranges
if ( bHVisible )
{
- aHScroll.SetPosSizePixel(
+ aHScroll->SetPosSizePixel(
Point( 0, aOutPixSz.Height() ),
Size( aOutPixSz.Width(), nScrSize ) );
- aHScroll.SetRange( Range( 0, aTotPixSz.Width() ) );
- aHScroll.SetPageSize( aOutPixSz.Width() );
- aHScroll.SetVisibleSize( aOutPixSz.Width() );
- aHScroll.SetLineSize( nColumnPixW );
- aHScroll.SetThumbPos( -aPixOffset.X() );
+ aHScroll->SetRange( Range( 0, aTotPixSz.Width() ) );
+ aHScroll->SetPageSize( aOutPixSz.Width() );
+ aHScroll->SetVisibleSize( aOutPixSz.Width() );
+ aHScroll->SetLineSize( nColumnPixW );
+ aHScroll->SetThumbPos( -aPixOffset.X() );
}
if ( bVVisible )
{
- aVScroll.SetPosSizePixel(
+ aVScroll->SetPosSizePixel(
Point( aOutPixSz.Width(), 0 ),
Size( nScrSize,aOutPixSz.Height() ) );
- aVScroll.SetRange( Range( 0, aTotPixSz.Height() ) );
- aVScroll.SetPageSize( aOutPixSz.Height() );
- aVScroll.SetVisibleSize( aOutPixSz.Height() );
- aVScroll.SetLineSize( nLinePixH );
- aVScroll.SetThumbPos( -aPixOffset.Y() );
+ aVScroll->SetRange( Range( 0, aTotPixSz.Height() ) );
+ aVScroll->SetPageSize( aOutPixSz.Height() );
+ aVScroll->SetVisibleSize( aOutPixSz.Height() );
+ aVScroll->SetLineSize( nLinePixH );
+ aVScroll->SetThumbPos( -aPixOffset.Y() );
}
}
@@ -366,9 +379,9 @@ void ScrollableWindow::Scroll( long nDeltaX, long nDeltaY, sal_uInt16 )
if ( !bScrolling )
{
if ( nDeltaX )
- aHScroll.SetThumbPos( -aPixOffset.X() );
+ aHScroll->SetThumbPos( -aPixOffset.X() );
if ( nDeltaY )
- aVScroll.SetThumbPos( -aPixOffset.Y() );
+ aVScroll->SetThumbPos( -aPixOffset.Y() );
}
}
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 45807d372c26..10cb8c3b8467 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -159,6 +159,7 @@ public:
private:
void ImplTrack( const Point& rScreenPos );
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
@@ -176,6 +177,11 @@ ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle )
SetSizePixel(Size(7 * nScaleFactor, 0));
}
+void ImplTabSizer::dispose()
+{
+ vcl::Window::dispose();
+}
+
void ImplTabSizer::ImplTrack( const Point& rScreenPos )
{
TabBar* pParent = GetParent();
@@ -328,25 +334,17 @@ IMPL_LINK_NOARG(TabBarEdit, ImplEndTimerHdl)
struct TabBar_Impl
{
- std::unique_ptr<ImplTabSizer> mpSizer;
- std::unique_ptr<ImplTabButton> mpFirstButton;
- std::unique_ptr<ImplTabButton> mpPrevButton;
- std::unique_ptr<ImplTabButton> mpNextButton;
- std::unique_ptr<ImplTabButton> mpLastButton;
- std::unique_ptr<TabBarEdit> mpEdit;
- ImplTabBarList mpItemList;
+ ScopedVclPtr<ImplTabSizer> mpSizer;
+ ScopedVclPtr<ImplTabButton> mpFirstButton;
+ ScopedVclPtr<ImplTabButton> mpPrevButton;
+ ScopedVclPtr<ImplTabButton> mpNextButton;
+ ScopedVclPtr<ImplTabButton> mpLastButton;
+ ScopedVclPtr<TabBarEdit> mpEdit;
+ ImplTabBarList mpItemList;
svt::AccessibleFactoryAccess maAccessibleFactory;
- TabBar_Impl()
- : mpSizer()
- , mpFirstButton()
- , mpPrevButton()
- , mpNextButton()
- , mpLastButton()
- , mpEdit()
- , mpItemList()
- {}
+ TabBar_Impl() {}
~TabBar_Impl()
{
@@ -372,7 +370,14 @@ TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) :
TabBar::~TabBar()
{
+ disposeOnce();
+}
+
+void TabBar::dispose()
+{
EndEditMode( true );
+ mpImpl.reset();
+ Window::dispose();
}
const sal_uInt16 TabBar::APPEND = ::std::numeric_limits<sal_uInt16>::max();
@@ -650,14 +655,12 @@ void TabBar::ImplInitControls()
{
if (!mpImpl->mpSizer)
{
- mpImpl->mpSizer.reset(new ImplTabSizer( this, mnWinStyle & (WB_DRAG | WB_3DLOOK)));
+ mpImpl->mpSizer.reset(VclPtr<ImplTabSizer>::Create( this, mnWinStyle & (WB_DRAG | WB_3DLOOK)));
}
mpImpl->mpSizer->Show();
}
else
- {
- mpImpl->mpSizer.reset();
- }
+ mpImpl->mpSizer.disposeAndClear();
Link aLink = LINK( this, TabBar, ImplClickHdl );
@@ -665,7 +668,7 @@ void TabBar::ImplInitControls()
{
if (!mpImpl->mpPrevButton)
{
- mpImpl->mpPrevButton.reset(new ImplTabButton(this, WB_REPEAT));
+ mpImpl->mpPrevButton.reset(VclPtr<ImplTabButton>::Create(this, WB_REPEAT));
mpImpl->mpPrevButton->SetClickHdl(aLink);
}
mpImpl->mpPrevButton->SetSymbol(mbMirrored ? SymbolType::NEXT : SymbolType::PREV);
@@ -673,7 +676,7 @@ void TabBar::ImplInitControls()
if (!mpImpl->mpNextButton)
{
- mpImpl->mpNextButton.reset(new ImplTabButton(this, WB_REPEAT));
+ mpImpl->mpNextButton.reset(VclPtr<ImplTabButton>::Create(this, WB_REPEAT));
mpImpl->mpNextButton->SetClickHdl(aLink);
}
mpImpl->mpNextButton->SetSymbol(mbMirrored ? SymbolType::PREV : SymbolType::NEXT);
@@ -681,15 +684,15 @@ void TabBar::ImplInitControls()
}
else
{
- mpImpl->mpPrevButton.reset();
- mpImpl->mpNextButton.reset();
+ mpImpl->mpPrevButton.disposeAndClear();
+ mpImpl->mpNextButton.disposeAndClear();
}
if ( mnWinStyle & WB_SCROLL )
{
if (!mpImpl->mpFirstButton)
{
- mpImpl->mpFirstButton.reset(new ImplTabButton(this));
+ mpImpl->mpFirstButton.reset(VclPtr<ImplTabButton>::Create(this));
mpImpl->mpFirstButton->SetClickHdl(aLink);
}
mpImpl->mpFirstButton->SetSymbol(mbMirrored ? SymbolType::LAST : SymbolType::FIRST);
@@ -697,7 +700,7 @@ void TabBar::ImplInitControls()
if (!mpImpl->mpLastButton)
{
- mpImpl->mpLastButton.reset(new ImplTabButton(this));
+ mpImpl->mpLastButton.reset(VclPtr<ImplTabButton>::Create(this));
mpImpl->mpLastButton->SetClickHdl(aLink);
}
mpImpl->mpLastButton->SetSymbol(mbMirrored ? SymbolType::FIRST : SymbolType::LAST);
@@ -705,8 +708,8 @@ void TabBar::ImplInitControls()
}
else
{
- mpImpl->mpFirstButton.reset();
- mpImpl->mpLastButton.reset();
+ mpImpl->mpFirstButton.disposeAndClear();
+ mpImpl->mpLastButton.disposeAndClear();
}
mbHasInsertTab = (mnWinStyle & WB_INSERTTAB);
@@ -2176,7 +2179,7 @@ bool TabBar::StartEditMode( sal_uInt16 nPageId )
ImplFormat();
Update();
- mpImpl->mpEdit.reset(new TabBarEdit(this, WB_CENTER));
+ mpImpl->mpEdit.reset(VclPtr<TabBarEdit>::Create(this, WB_CENTER));
Rectangle aRect = GetPageRect( mnEditId );
long nX = aRect.Left();
long nWidth = aRect.GetWidth();
@@ -2262,7 +2265,8 @@ void TabBar::EndEditMode( bool bCancel )
else
{
// close edit and call end hdl
- mpImpl->mpEdit.reset();
+ mpImpl->mpEdit.disposeAndClear();
+
EndRenaming();
mnEditId = 0;
}
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 1896c2b28b71..af6805cb22e9 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -129,7 +129,7 @@ ToolbarMenuEntry::~ToolbarMenuEntry()
xComponent->dispose();
mxAccContext.clear();
}
- delete mpControl;
+ mpControl.disposeAndClear();
}
@@ -292,7 +292,7 @@ Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( Control* pControl
for( int nEntry = 0; nEntry < nEntryCount; nEntry++ )
{
ToolbarMenuEntry* pEntry = maEntryVector[nEntry];
- if( pEntry && (pEntry->mpControl == pControl) )
+ if( pEntry && (pEntry->mpControl.get() == pControl) )
{
return pEntry->getAccessibleChild( childIndex );
}
@@ -393,7 +393,7 @@ void ToolbarMenu_Impl::notifyHighlightedEntry()
{
sal_Int32 nChildIndex = 0;
// todo: if other controls than ValueSet are allowed, addapt this code
- ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl );
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl.get() );
if( pValueSet )
nChildIndex = static_cast< sal_Int32 >( pValueSet->GetItemPos( pValueSet->GetSelectItemId() ) );
@@ -459,6 +459,11 @@ void ToolbarMenu::implInit(const Reference< XFrame >& rFrame)
ToolbarMenu::~ToolbarMenu()
{
+ disposeOnce();
+}
+
+void ToolbarMenu::dispose()
+{
vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
if ( pWindow )
static_cast<SystemWindow*>(pWindow)->GetTaskPaneList()->RemoveWindow( this );
@@ -478,6 +483,7 @@ ToolbarMenu::~ToolbarMenu()
}
delete mpImpl;
+ DockingWindow::dispose();
}
@@ -815,9 +821,9 @@ void ToolbarMenu::appendSeparator()
/** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */
-ValueSet* ToolbarMenu::createEmptyValueSetControl()
+VclPtr<ValueSet> ToolbarMenu::createEmptyValueSetControl()
{
- ValueSet* pSet = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
+ VclPtr<ValueSet> pSet = VclPtr<ValueSet>::Create( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT );
pSet->EnableFullItemMode( false );
pSet->SetColor( GetControlBackground() );
pSet->SetHighlightHdl( LINK( this, ToolbarMenu, HighlightHdl ) );
@@ -868,7 +874,7 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight )
{
if( !bHighlight )
{
- ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl );
+ ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl.get() );
if( pValueSet )
{
pValueSet->SetNoSelection();
@@ -1571,7 +1577,7 @@ public:
virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
- ToolbarMenu* mpMenu;
+ VclPtr<ToolbarMenu> mpMenu;
};
@@ -1588,7 +1594,7 @@ ToolbarMenuStatusListener::ToolbarMenuStatusListener(
void SAL_CALL ToolbarMenuStatusListener::dispose() throw (::com::sun::star::uno::RuntimeException, std::exception)
{
- mpMenu = 0;
+ mpMenu.clear();
svt::FrameStatusListener::dispose();
}
diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx
index b54ad29c264a..0a688a37c717 100644
--- a/svtools/source/control/toolbarmenuimp.hxx
+++ b/svtools/source/control/toolbarmenuimp.hxx
@@ -76,7 +76,7 @@ public:
OUString maText;
Image maImage;
- Control* mpControl;
+ VclPtr<Control> mpControl;
Rectangle maRect;
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > mxAccContext;
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 341b2b47fbb9..c6aa67b65e20 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -755,7 +755,7 @@ void ValueSetAcc::ThrowIfDisposed()
}
else
{
- DBG_ASSERT (mpParent!=NULL, "ValueSetAcc not disposed but mpParent == NULL");
+ DBG_ASSERT (mpParent!=nullptr, "ValueSetAcc not disposed but mpParent == NULL");
}
}
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index 732079e78d18..567613d7de92 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -148,7 +148,7 @@ public:
private:
::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners;
- ValueSet* mpParent;
+ VclPtr<ValueSet> mpParent;
bool mbIsTransientChildrenDisabled;
/// The current FOCUSED state.
bool mbIsFocused;
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 67d28733fb80..ca07369dc0c3 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -89,14 +89,14 @@ void ValueSet::ImplInit()
mbHasVisibleItems = false;
// #106446#, #106601# force mirroring of virtual device
- maVirDev.EnableRTL( GetParent()->IsRTLEnabled() );
+ maVirDev->EnableRTL( GetParent()->IsRTLEnabled() );
ImplInitSettings( true, true, true );
}
ValueSet::ValueSet( vcl::Window* pParent, WinBits nWinStyle, bool bDisableTransientChildren ) :
Control( pParent, nWinStyle ),
- maVirDev( *this ),
+ maVirDev( VclPtr<VirtualDevice>::Create(*this) ),
maColor( COL_TRANSPARENT )
{
ImplInit();
@@ -116,7 +116,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeValueSet(vcl::Window *
ValueSet::ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTransientChildren ) :
Control( pParent, rResId ),
- maVirDev( *this ),
+ maVirDev( VclPtr<VirtualDevice>::Create(*this) ),
maColor( COL_TRANSPARENT )
{
ImplInit();
@@ -125,11 +125,18 @@ ValueSet::ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTran
ValueSet::~ValueSet()
{
+ disposeOnce();
+}
+
+void ValueSet::dispose()
+{
Reference<XComponent> xComponent(GetAccessible(false), UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
ImplDeleteItems();
+ mxScrollBar.disposeAndClear();
+ Control::dispose();
}
void ValueSet::ImplDeleteItems()
@@ -199,7 +206,7 @@ void ValueSet::ImplInitScrollBar()
{
if ( !mxScrollBar.get() )
{
- mxScrollBar.reset(new ScrollBar( this, WB_VSCROLL | WB_DRAG ));
+ mxScrollBar.reset(VclPtr<ScrollBar>::Create( this, WB_VSCROLL | WB_DRAG ));
mxScrollBar->SetScrollHdl( LINK( this, ValueSet, ImplScrollHdl ) );
}
else
@@ -232,7 +239,7 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
}
else
{
- DecorationView aView( &maVirDev );
+ DecorationView aView( maVirDev.get() );
aRect = aView.DrawFrame( aRect, mnFrameStyle );
}
}
@@ -246,11 +253,11 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
if ( pItem == mpNoneItem.get() )
{
- maVirDev.SetFont( GetFont() );
- maVirDev.SetTextColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor() );
- maVirDev.SetTextFillColor();
- maVirDev.SetFillColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuColor() : rStyleSettings.GetWindowColor() );
- maVirDev.DrawRect( aRect );
+ maVirDev->SetFont( GetFont() );
+ maVirDev->SetTextColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor() );
+ maVirDev->SetTextFillColor();
+ maVirDev->SetFillColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuColor() : rStyleSettings.GetWindowColor() );
+ maVirDev->DrawRect( aRect );
Point aTxtPos( aRect.Left() + 2, aRect.Top() );
long nTxtWidth = GetTextWidth( pItem->maText );
if ( nStyle & WB_RADIOSEL )
@@ -260,33 +267,33 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
}
if ( (aTxtPos.X()+nTxtWidth) > aRect.Right() )
{
- maVirDev.SetClipRegion( vcl::Region( aRect ) );
- maVirDev.DrawText( aTxtPos, pItem->maText );
- maVirDev.SetClipRegion();
+ maVirDev->SetClipRegion( vcl::Region( aRect ) );
+ maVirDev->DrawText( aTxtPos, pItem->maText );
+ maVirDev->SetClipRegion();
}
else
- maVirDev.DrawText( aTxtPos, pItem->maText );
+ maVirDev->DrawText( aTxtPos, pItem->maText );
}
else if ( pItem->meType == VALUESETITEM_COLOR )
{
- maVirDev.SetFillColor( pItem->maColor );
- maVirDev.DrawRect( aRect );
+ maVirDev->SetFillColor( pItem->maColor );
+ maVirDev->DrawRect( aRect );
}
else
{
if ( IsColor() )
- maVirDev.SetFillColor( maColor );
+ maVirDev->SetFillColor( maColor );
else if ( nStyle & WB_MENUSTYLEVALUESET )
- maVirDev.SetFillColor( rStyleSettings.GetMenuColor() );
+ maVirDev->SetFillColor( rStyleSettings.GetMenuColor() );
else if ( IsEnabled() )
- maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ maVirDev->SetFillColor( rStyleSettings.GetWindowColor() );
else
- maVirDev.SetFillColor( rStyleSettings.GetFaceColor() );
- maVirDev.DrawRect( aRect );
+ maVirDev->SetFillColor( rStyleSettings.GetFaceColor() );
+ maVirDev->DrawRect( aRect );
if ( pItem->meType == VALUESETITEM_USERDRAW )
{
- UserDrawEvent aUDEvt( &maVirDev, aRect, pItem->mnId );
+ UserDrawEvent aUDEvt( maVirDev.get(), aRect, pItem->mnId );
UserDraw( aUDEvt );
}
else
@@ -304,12 +311,12 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
if ( aImageSize.Width() > aRectSize.Width() ||
aImageSize.Height() > aRectSize.Height() )
{
- maVirDev.SetClipRegion( vcl::Region( aRect ) );
- maVirDev.DrawImage( aPos, pItem->maImage, nImageStyle);
- maVirDev.SetClipRegion();
+ maVirDev->SetClipRegion( vcl::Region( aRect ) );
+ maVirDev->DrawImage( aPos, pItem->maImage, nImageStyle);
+ maVirDev->SetClipRegion();
}
else
- maVirDev.DrawImage( aPos, pItem->maImage, nImageStyle );
+ maVirDev->DrawImage( aPos, pItem->maImage, nImageStyle );
}
}
@@ -324,7 +331,7 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
if(!aBlendFrame.IsEmpty())
{
- maVirDev.DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
+ maVirDev->DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
}
}
}
@@ -344,18 +351,15 @@ void ValueSet::Format()
long nOff;
long nNoneHeight;
long nNoneSpace;
- std::unique_ptr<ScrollBar> xDeletedScrollBar;
+ VclPtr<ScrollBar> xDeletedScrollBar;
// consider the scrolling
if ( nStyle & WB_VSCROLL )
ImplInitScrollBar();
else
{
- if ( mxScrollBar.get() )
- {
- // delete ScrollBar not until later, to prevent recursive calls
- xDeletedScrollBar.swap(mxScrollBar);
- }
+ xDeletedScrollBar = mxScrollBar;
+ mxScrollBar.clear();
}
// calculate item offset
@@ -486,9 +490,9 @@ void ValueSet::Format()
}
// Init VirDev
- maVirDev.SetSettings( GetSettings() );
- maVirDev.SetBackground( GetBackground() );
- maVirDev.SetOutputSizePixel( aWinSize, true );
+ maVirDev->SetSettings( GetSettings() );
+ maVirDev->SetBackground( GetBackground() );
+ maVirDev->SetOutputSizePixel( aWinSize, true );
// nothing is changed in case of too small items
if ( (mnItemWidth <= 0) ||
@@ -561,7 +565,7 @@ void ValueSet::Format()
}
// calculate and draw items
- maVirDev.SetLineColor();
+ maVirDev->SetLineColor();
long x = nStartX;
long y = nStartY;
@@ -668,6 +672,8 @@ void ValueSet::Format()
// waiting for the next since the formatting is finished
mbFormat = false;
+
+ xDeletedScrollBar.disposeAndClear();
}
void ValueSet::ImplDrawItemText(const OUString& rText)
@@ -901,7 +907,7 @@ void ValueSet::ImplHideSelect( sal_uInt16 nItemId )
HideFocus();
const Point aPos = aRect.TopLeft();
const Size aSize = aRect.GetSize();
- DrawOutDev( aPos, aSize, aPos, aSize, maVirDev );
+ DrawOutDev( aPos, aSize, aPos, aSize, *maVirDev.get() );
}
void ValueSet::ImplHighlightItem( sal_uInt16 nItemId, bool bIsSelection )
@@ -931,7 +937,7 @@ void ValueSet::ImplDraw()
HideFocus();
Point aDefPos;
- Size aSize = maVirDev.GetOutputSizePixel();
+ Size aSize = maVirDev->GetOutputSizePixel();
if ( mxScrollBar.get() && mxScrollBar->IsVisible() )
{
@@ -940,17 +946,17 @@ void ValueSet::ImplDraw()
Point aTempPos( 0, aScrPos.Y() );
Size aTempSize( aSize.Width(), aScrPos.Y() );
- DrawOutDev( aDefPos, aTempSize, aDefPos, aTempSize, maVirDev );
+ DrawOutDev( aDefPos, aTempSize, aDefPos, aTempSize, *maVirDev.get() );
aTempSize.Width() = aScrPos.X() - 1;
aTempSize.Height() = aScrSize.Height();
- DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, maVirDev );
+ DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, *maVirDev.get() );
aTempPos.Y() = aScrPos.Y() + aScrSize.Height();
aTempSize.Width() = aSize.Width();
aTempSize.Height() = aSize.Height() - aTempPos.Y();
- DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, maVirDev );
+ DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, *maVirDev.get() );
}
else
- DrawOutDev( aDefPos, aSize, aDefPos, aSize, maVirDev );
+ DrawOutDev( aDefPos, aSize, aDefPos, aSize, *maVirDev.get() );
// draw parting line to the Namefield
if ( GetStyle() & WB_NAMEFIELD )
@@ -1416,7 +1422,7 @@ void ValueSet::Paint( const Rectangle& )
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
SetLineColor();
SetFillColor( rStyleSettings.GetFaceColor() );
- long nOffY = maVirDev.GetOutputSizePixel().Height();
+ long nOffY = maVirDev->GetOutputSizePixel().Height();
Size aWinSize = GetOutputSizePixel();
DrawRect( Rectangle( Point( 0, nOffY ), Point( aWinSize.Width(), aWinSize.Height() ) ) );
}
diff --git a/svtools/source/control/vclxaccessibleheaderbar.cxx b/svtools/source/control/vclxaccessibleheaderbar.cxx
index 19a1e55540a8..7c928370ff4a 100644
--- a/svtools/source/control/vclxaccessibleheaderbar.cxx
+++ b/svtools/source/control/vclxaccessibleheaderbar.cxx
@@ -56,11 +56,10 @@ VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar( VCLXWindow* pVCLWindow )
:VCLXAccessibleComponent( pVCLWindow )
,m_pHeadBar(NULL)
{
- m_pHeadBar = static_cast< HeaderBar* >( GetWindow() );
+ m_pHeadBar = GetAs< HeaderBar >();
}
-
VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar()
{
}
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
index f6a76fa1ab79..7d4267bdf530 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -81,6 +81,18 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla
PlaceEditDialog::~PlaceEditDialog()
{
+ disposeOnce();
+}
+
+void PlaceEditDialog::dispose()
+{
+ m_pEDServerName.clear();
+ m_pLBServerType.clear();
+ m_pEDUsername.clear();
+ m_pBTOk.clear();
+ m_pBTCancel.clear();
+ m_pBTDelete.clear();
+ ModalDialog::dispose();
}
OUString PlaceEditDialog::GetServerUrl()
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 419b2b9efcc3..40a61577d89e 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -449,8 +449,8 @@ void AssignmentPersistentData::ImplCommit()
struct AddressBookSourceDialogData
{
- FixedText* pFieldLabels[FIELD_PAIRS_VISIBLE * 2];
- ListBox* pFields[FIELD_PAIRS_VISIBLE * 2];
+ VclPtr<FixedText> pFieldLabels[FIELD_PAIRS_VISIBLE * 2];
+ VclPtr<ListBox> pFields[FIELD_PAIRS_VISIBLE * 2];
/// when working transient, we need the data source
Reference< XDataSource >
@@ -733,7 +733,17 @@ void AssignmentPersistentData::ImplCommit()
AddressBookSourceDialog::~AddressBookSourceDialog()
{
+ disposeOnce();
+ }
+
+ void AddressBookSourceDialog::dispose()
+ {
delete m_pImpl;
+ m_pDatasource.clear();
+ m_pAdministrateDatasources.clear();
+ m_pTable.clear();
+ m_pFieldScroller.clear();
+ ModalDialog::dispose();
}
@@ -931,34 +941,34 @@ void AssignmentPersistentData::ImplCommit()
std::vector<OUString>::iterator aInitialSelection = m_pImpl->aFieldAssignments.begin() + m_pImpl->nFieldScrollPos;
- ListBox** pListbox = m_pImpl->pFields;
OUString sSaveSelection;
- for (sal_Int32 i=0; i<FIELD_CONTROLS_VISIBLE; ++i, ++pListbox, ++aInitialSelection)
+ for (sal_Int32 i=0; i<FIELD_CONTROLS_VISIBLE; ++i, ++aInitialSelection)
{
- sSaveSelection = (*pListbox)->GetSelectEntry();
+ VclPtr<ListBox>& pListbox = m_pImpl->pFields[i];
+ sSaveSelection = pListbox->GetSelectEntry();
- (*pListbox)->Clear();
+ pListbox->Clear();
// the one entry for "no selection"
- (*pListbox)->InsertEntry(m_sNoFieldSelection, 0);
+ pListbox->InsertEntry(m_sNoFieldSelection, 0);
// as it's entry data, set the index of the list box in our array
- (*pListbox)->SetEntryData(0, reinterpret_cast<void*>(i));
+ pListbox->SetEntryData(0, reinterpret_cast<void*>(i));
// the field names
for (pColumnNames = aColumnNames.getConstArray(); pColumnNames != pEnd; ++pColumnNames)
- (*pListbox)->InsertEntry(*pColumnNames);
+ pListbox->InsertEntry(*pColumnNames);
if (!aInitialSelection->isEmpty() && (aColumnNameSet.end() != aColumnNameSet.find(*aInitialSelection)))
// we can select the entry as specified in our field assignment array
- (*pListbox)->SelectEntry(*aInitialSelection);
+ pListbox->SelectEntry(*aInitialSelection);
else
// try to restore the selection
if (aColumnNameSet.end() != aColumnNameSet.find(sSaveSelection))
// the old selection is a valid column name
- (*pListbox)->SelectEntry(sSaveSelection);
+ pListbox->SelectEntry(sSaveSelection);
else
// select the <none> entry
- (*pListbox)->SelectEntryPos(0);
+ pListbox->SelectEntryPos(0);
}
// adjust m_pImpl->aFieldAssignments
@@ -999,14 +1009,14 @@ void AssignmentPersistentData::ImplCommit()
// loop through our field control rows and do some adjustments
// for the new texts
- FixedText** pLeftLabelControl = m_pImpl->pFieldLabels;
- FixedText** pRightLabelControl = pLeftLabelControl + 1;
+ VclPtr<FixedText>* pLeftLabelControl = m_pImpl->pFieldLabels;
+ VclPtr<FixedText>* pRightLabelControl = pLeftLabelControl + 1;
StringArray::const_iterator pLeftColumnLabel = m_pImpl->aFieldLabels.begin() + 2 * _nPos;
StringArray::const_iterator pRightColumnLabel = pLeftColumnLabel + 1;
// for the focus movement and the selection scroll
- ListBox** pLeftListControl = m_pImpl->pFields;
- ListBox** pRightListControl = pLeftListControl + 1;
+ VclPtr<ListBox>* pLeftListControl = m_pImpl->pFields;
+ VclPtr<ListBox>* pRightListControl = pLeftListControl + 1;
// for the focus movement
sal_Int32 nOldFocusRow = -1;
diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx
index 232aaf42e9b8..96ad7da2c80b 100644
--- a/svtools/source/dialogs/colrdlg.cxx
+++ b/svtools/source/dialogs/colrdlg.cxx
@@ -29,6 +29,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <svtools/colrdlg.hxx>
+#include <vcl/window.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx
index 72cff7fc2657..90b44eb856f3 100644
--- a/svtools/source/dialogs/prnsetup.cxx
+++ b/svtools/source/dialogs/prnsetup.cxx
@@ -53,8 +53,9 @@ void ImplFreePrnDlgListBox( ListBox* pBox, bool bClear )
Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn,
- Printer* pPrinter, Printer* pTempPrinter )
+ Printer* pPrinter, Printer* pTempPrinterIn )
{
+ VclPtr<Printer> pTempPrinter( pTempPrinterIn );
if ( pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
{
const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), true );
@@ -64,17 +65,17 @@ Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn,
{
if ( (pPrinter->GetName() == pInfo->GetPrinterName()) &&
(pPrinter->GetDriverName() == pInfo->GetDriver()) )
- pTempPrinter = new Printer( pPrinter->GetJobSetup() );
+ pTempPrinter = VclPtr<Printer>::Create( pPrinter->GetJobSetup() );
else
- pTempPrinter = new Printer( *pInfo );
+ pTempPrinter = VclPtr<Printer>::Create( *pInfo );
}
else
{
if ( (pTempPrinter->GetName() != pInfo->GetPrinterName()) ||
(pTempPrinter->GetDriverName() != pInfo->GetDriver()) )
{
- delete pTempPrinter;
- pTempPrinter = new Printer( *pInfo );
+ pTempPrinter.disposeAndClear();
+ pTempPrinter = VclPtr<Printer>::Create( *pInfo );
}
}
@@ -91,8 +92,9 @@ Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn,
-Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinter )
+Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinterIn )
{
+ VclPtr<Printer> pTempPrinter( pTempPrinterIn );
OUString aPrnName;
if ( pTempPrinter )
aPrnName = pTempPrinter->GetName();
@@ -101,8 +103,7 @@ Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinter )
if ( ! Printer::GetQueueInfo( aPrnName, false ) )
{
- if ( pTempPrinter )
- delete pTempPrinter;
+ pTempPrinter.disposeAndClear();
pTempPrinter = new Printer;
}
@@ -245,11 +246,23 @@ PrinterSetupDialog::PrinterSetupDialog(vcl::Window* pParent)
PrinterSetupDialog::~PrinterSetupDialog()
{
- ImplFreePrnDlgListBox(m_pLbName, false);
- delete mpTempPrinter;
+ disposeOnce();
}
-
+void PrinterSetupDialog::dispose()
+{
+ ImplFreePrnDlgListBox(m_pLbName, false);
+ m_pLbName.clear();
+ m_pBtnProperties.clear();
+ m_pBtnOptions.clear();
+ m_pFiStatus.clear();
+ m_pFiType.clear();
+ m_pFiLocation.clear();
+ m_pFiComment.clear();
+ mpTempPrinter.disposeAndClear();
+ mpPrinter.clear();
+ ModalDialog::dispose();
+}
void PrinterSetupDialog::SetOptionsHdl( const Link& rLink )
{
@@ -293,7 +306,7 @@ IMPL_LINK_NOARG(PrinterSetupDialog, ImplStatusHdl)
IMPL_LINK_NOARG(PrinterSetupDialog, ImplPropertiesHdl)
{
if ( !mpTempPrinter )
- mpTempPrinter = new Printer( mpPrinter->GetJobSetup() );
+ mpTempPrinter = VclPtr<Printer>::Create( mpPrinter->GetJobSetup() );
mpTempPrinter->Setup( this );
return 0;
diff --git a/svtools/source/dialogs/restartdialog.cxx b/svtools/source/dialogs/restartdialog.cxx
index d116d9b1bfc2..1e99d16c3d36 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -47,14 +47,21 @@ public:
btnYes_->SetClickHdl(LINK(this, RestartDialog, hdlYes));
btnNo_->SetClickHdl(LINK(this, RestartDialog, hdlNo));
}
-
+ virtual ~RestartDialog() { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
+ {
+ reason_.clear();
+ btnYes_.clear();
+ btnNo_.clear();
+ ModalDialog::dispose();
+ }
private:
DECL_LINK(hdlYes, void *);
DECL_LINK(hdlNo, void *);
- vcl::Window * reason_;
- PushButton * btnYes_;
- PushButton * btnNo_;
+ VclPtr<vcl::Window> reason_;
+ VclPtr<PushButton> btnYes_;
+ VclPtr<PushButton> btnNo_;
};
IMPL_LINK_NOARG(RestartDialog, hdlYes) {
diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx
index aa9fb5c0843d..71d751fdf455 100644
--- a/svtools/source/dialogs/roadmapwizard.cxx
+++ b/svtools/source/dialogs/roadmapwizard.cxx
@@ -55,7 +55,7 @@ namespace svt
struct RoadmapWizardImpl : public RoadmapWizardTypes
{
- ORoadmap* pRoadmap;
+ ScopedVclPtr<ORoadmap> pRoadmap;
Paths aPaths;
PathId nActivePath;
StateDescriptions aStateDescriptors;
@@ -69,11 +69,6 @@ namespace svt
{
}
- ~RoadmapWizardImpl()
- {
- delete pRoadmap;
- }
-
/// returns the index of the current state in given path, or -1
static sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, const WizardPath& _rPath );
/// returns the index of the current state in the path with the given id, or -1
@@ -137,7 +132,7 @@ namespace svt
SetLeftAlignedButtonCount( 1 );
SetEmptyViewMargin();
- m_pImpl->pRoadmap = new ORoadmap( this, WB_TABSTOP );
+ m_pImpl->pRoadmap.reset( VclPtr<ORoadmap>::Create( this, WB_TABSTOP ) );
m_pImpl->pRoadmap->SetText( SVT_RESSTR( STR_WIZDLG_ROADMAP_TITLE ) );
m_pImpl->pRoadmap->SetPosPixel( Point( 0, 0 ) );
m_pImpl->pRoadmap->SetItemSelectHdl( LINK( this, RoadmapWizard, OnRoadmapItemSelected ) );
@@ -154,7 +149,13 @@ namespace svt
RoadmapWizard::~RoadmapWizard()
{
+ disposeOnce();
+ }
+
+ void RoadmapWizard::dispose()
+ {
delete m_pImpl;
+ OWizardMachine::dispose();
}
@@ -531,9 +532,9 @@ namespace svt
}
- TabPage* RoadmapWizard::createPage( WizardState _nState )
+ VclPtr<TabPage> RoadmapWizard::createPage( WizardState _nState )
{
- TabPage* pPage( NULL );
+ VclPtr<TabPage> pPage;
StateDescriptions::const_iterator pos = m_pImpl->aStateDescriptors.find( _nState );
OSL_ENSURE( pos != m_pImpl->aStateDescriptors.end(),
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index 6cc223397b54..8864376ed343 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -49,7 +49,13 @@ namespace svt
OWizardPage::~OWizardPage()
{
+ disposeOnce();
+ }
+
+ void OWizardPage::dispose()
+ {
delete m_pImpl;
+ TabPage::dispose();
}
void OWizardPage::initializePage()
@@ -133,7 +139,7 @@ namespace svt
// the help button
if (_nButtonFlags & WZB_HELP)
{
- m_pHelp= new HelpButton(this, WB_TABSTOP);
+ m_pHelp= VclPtr<HelpButton>::Create(this, WB_TABSTOP);
m_pHelp->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pHelp->Show();
AddButton( m_pHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X);
@@ -142,7 +148,7 @@ namespace svt
// the previous button
if (_nButtonFlags & WZB_PREVIOUS)
{
- m_pPrevPage = new PushButton(this, WB_TABSTOP);
+ m_pPrevPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
m_pPrevPage->SetHelpId( HID_WIZARD_PREVIOUS );
m_pPrevPage->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pPrevPage->SetText(SVT_RESSTR(STR_WIZDLG_PREVIOUS));
@@ -159,7 +165,7 @@ namespace svt
// the next button
if (_nButtonFlags & WZB_NEXT)
{
- m_pNextPage = new PushButton(this, WB_TABSTOP);
+ m_pNextPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
m_pNextPage->SetHelpId( HID_WIZARD_NEXT );
m_pNextPage->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pNextPage->SetText(OUString(SVT_RESSTR(STR_WIZDLG_NEXT)));
@@ -173,7 +179,7 @@ namespace svt
// the finish button
if (_nButtonFlags & WZB_FINISH)
{
- m_pFinish = new OKButton(this, WB_TABSTOP);
+ m_pFinish = VclPtr<OKButton>::Create(this, WB_TABSTOP);
m_pFinish->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pFinish->SetText(SVT_RESSTR(STR_WIZDLG_FINISH));
m_pFinish->Show();
@@ -185,7 +191,7 @@ namespace svt
// the cancel button
if (_nButtonFlags & WZB_CANCEL)
{
- m_pCancel = new CancelButton(this, WB_TABSTOP);
+ m_pCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP);
m_pCancel->SetSizePixel( LogicToPixel( Size( 50, 14 ), MAP_APPFONT ) );
m_pCancel->Show();
@@ -196,16 +202,22 @@ namespace svt
OWizardMachine::~OWizardMachine()
{
- delete m_pFinish;
- delete m_pCancel;
- delete m_pNextPage;
- delete m_pPrevPage;
- delete m_pHelp;
+ disposeOnce();
+ }
+
+ void OWizardMachine::dispose()
+ {
+ m_pFinish.disposeAndClear();
+ m_pCancel.disposeAndClear();
+ m_pNextPage.disposeAndClear();
+ m_pPrevPage.disposeAndClear();
+ m_pHelp.disposeAndClear();
for (WizardState i=0; i<m_pImpl->nFirstUnknownPage; ++i)
- delete GetPage(i);
+ GetPage(i)->disposeOnce();
delete m_pImpl;
+ WizardDialog::dispose();
}
diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx
index 5c42e0c6f93e..0d0acc4e5242 100644
--- a/svtools/source/dialogs/wizdlg.cxx
+++ b/svtools/source/dialogs/wizdlg.cxx
@@ -34,7 +34,7 @@
struct ImplWizPageData
{
ImplWizPageData* mpNext;
- TabPage* mpPage;
+ VclPtr<TabPage> mpPage;
};
@@ -42,7 +42,7 @@ struct ImplWizPageData
struct ImplWizButtonData
{
ImplWizButtonData* mpNext;
- Button* mpButton;
+ VclPtr<Button> mpButton;
long mnOffset;
};
@@ -363,6 +363,11 @@ WizardDialog::WizardDialog( vcl::Window* pParent, const OUString& rID, const OUS
WizardDialog::~WizardDialog()
{
+ disposeOnce();
+}
+
+void WizardDialog::dispose()
+{
maWizardLayoutIdle.Stop();
// Remove all buttons
@@ -372,6 +377,12 @@ WizardDialog::~WizardDialog()
// Remove all pages
while ( mpFirstPage )
RemovePage( mpFirstPage->mpPage );
+
+ mpCurTabPage.clear();
+ mpPrevBtn.clear();
+ mpNextBtn.clear();
+ mpViewWindow.clear();
+ ModalDialog::dispose();
}
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx
index 8b8bbb6228fa..3d2c97701204 100644
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ b/svtools/source/edit/editsyntaxhighlighter.cxx
@@ -36,10 +36,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeMultiLineEditSyntaxHig
return new MultiLineEditSyntaxHighlight(pParent);
}
-MultiLineEditSyntaxHighlight::~MultiLineEditSyntaxHighlight()
-{
-}
-
void MultiLineEditSyntaxHighlight::SetText(const OUString& rNewText)
{
MultiLineEdit::SetText(rNewText);
diff --git a/svtools/source/edit/svmedit2.cxx b/svtools/source/edit/svmedit2.cxx
index 9bb4c5f85478..4024cccdc9d5 100644
--- a/svtools/source/edit/svmedit2.cxx
+++ b/svtools/source/edit/svmedit2.cxx
@@ -22,13 +22,7 @@
#include <vcl/xtextedt.hxx>
ExtMultiLineEdit::ExtMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle ) :
-
MultiLineEdit( pParent, nWinStyle )
-
-{
-}
-
-ExtMultiLineEdit::~ExtMultiLineEdit()
{
}
diff --git a/svtools/source/filter/GraphicExportOptionsDialog.cxx b/svtools/source/filter/GraphicExportOptionsDialog.cxx
index 20e2ed7fc28d..8277304d537c 100644
--- a/svtools/source/filter/GraphicExportOptionsDialog.cxx
+++ b/svtools/source/filter/GraphicExportOptionsDialog.cxx
@@ -44,7 +44,17 @@ GraphicExportOptionsDialog::GraphicExportOptionsDialog(vcl::Window* pWindow, con
}
GraphicExportOptionsDialog::~GraphicExportOptionsDialog()
-{}
+{
+ disposeOnce();
+}
+
+void GraphicExportOptionsDialog::dispose()
+{
+ mpWidth.clear();
+ mpHeight.clear();
+ mpResolution.clear();
+ ModalDialog::dispose();
+}
void GraphicExportOptionsDialog::initialize()
{
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index ce1f4ff454e3..9d16cc0758e7 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -979,8 +979,47 @@ void ExportDialog::updateControls()
ExportDialog::~ExportDialog()
{
+ disposeOnce();
+}
+
+void ExportDialog::dispose()
+{
delete mpFilterOptionsItem;
delete mpOptionsItem;
+ mpMfSizeX.clear();
+ mpLbSizeX.clear();
+ mpMfSizeY.clear();
+ mpFtResolution.clear();
+ mpNfResolution.clear();
+ mpLbResolution.clear();
+ mpColorDepth.clear();
+ mpLbColorDepth.clear();
+ mpJPGQuality.clear();
+ mpPNGCompression.clear();
+ mpSbCompression.clear();
+ mpNfCompression.clear();
+ mpMode.clear();
+ mpCbInterlaced.clear();
+ mpBMPCompression.clear();
+ mpCbRLEEncoding.clear();
+ mpDrawingObjects.clear();
+ mpCbSaveTransparency.clear();
+ mpEncoding.clear();
+ mpRbBinary.clear();
+ mpRbText.clear();
+ mpEPSGrid.clear();
+ mpCbEPSPreviewTIFF.clear();
+ mpCbEPSPreviewEPSI.clear();
+ mpRbEPSLevel1.clear();
+ mpRbEPSLevel2.clear();
+ mpRbEPSColorFormat1.clear();
+ mpRbEPSColorFormat2.clear();
+ mpRbEPSCompressionLZW.clear();
+ mpRbEPSCompressionNone.clear();
+ mpInfo.clear();
+ mpFtEstimatedSize.clear();
+ mpBtnOK.clear();
+ ModalDialog::dispose();
}
diff --git a/svtools/source/filter/exportdialog.hxx b/svtools/source/filter/exportdialog.hxx
index 3cc1cd6968b4..4df7cdc0f5a3 100644
--- a/svtools/source/filter/exportdialog.hxx
+++ b/svtools/source/filter/exportdialog.hxx
@@ -53,49 +53,49 @@ private:
const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >&
mxSourceDocument;
- NumericField* mpMfSizeX;
- ListBox* mpLbSizeX;
- NumericField* mpMfSizeY;
- FixedText* mpFtResolution;
- NumericField* mpNfResolution;
- ListBox* mpLbResolution;
+ VclPtr<NumericField> mpMfSizeX;
+ VclPtr<ListBox> mpLbSizeX;
+ VclPtr<NumericField> mpMfSizeY;
+ VclPtr<FixedText> mpFtResolution;
+ VclPtr<NumericField> mpNfResolution;
+ VclPtr<ListBox> mpLbResolution;
- VclContainer* mpColorDepth;
- ListBox* mpLbColorDepth;
+ VclPtr<VclContainer> mpColorDepth;
+ VclPtr<ListBox> mpLbColorDepth;
- VclContainer* mpJPGQuality;
- VclContainer* mpPNGCompression;
+ VclPtr<VclContainer> mpJPGQuality;
+ VclPtr<VclContainer> mpPNGCompression;
- ScrollBar* mpSbCompression;
- NumericField* mpNfCompression;
+ VclPtr<ScrollBar> mpSbCompression;
+ VclPtr<NumericField> mpNfCompression;
- VclContainer* mpMode;
- CheckBox* mpCbInterlaced;
+ VclPtr<VclContainer> mpMode;
+ VclPtr<CheckBox> mpCbInterlaced;
- VclContainer* mpBMPCompression;
- CheckBox* mpCbRLEEncoding;
+ VclPtr<VclContainer> mpBMPCompression;
+ VclPtr<CheckBox> mpCbRLEEncoding;
- VclContainer* mpDrawingObjects;
- CheckBox* mpCbSaveTransparency;
+ VclPtr<VclContainer> mpDrawingObjects;
+ VclPtr<CheckBox> mpCbSaveTransparency;
- VclContainer* mpEncoding;
- RadioButton* mpRbBinary;
- RadioButton* mpRbText;
+ VclPtr<VclContainer> mpEncoding;
+ VclPtr<RadioButton> mpRbBinary;
+ VclPtr<RadioButton> mpRbText;
- VclContainer* mpEPSGrid;
- CheckBox* mpCbEPSPreviewTIFF;
- CheckBox* mpCbEPSPreviewEPSI;
- RadioButton* mpRbEPSLevel1;
- RadioButton* mpRbEPSLevel2;
- RadioButton* mpRbEPSColorFormat1;
- RadioButton* mpRbEPSColorFormat2;
- RadioButton* mpRbEPSCompressionLZW;
- RadioButton* mpRbEPSCompressionNone;
+ VclPtr<VclContainer> mpEPSGrid;
+ VclPtr<CheckBox> mpCbEPSPreviewTIFF;
+ VclPtr<CheckBox> mpCbEPSPreviewEPSI;
+ VclPtr<RadioButton> mpRbEPSLevel1;
+ VclPtr<RadioButton> mpRbEPSLevel2;
+ VclPtr<RadioButton> mpRbEPSColorFormat1;
+ VclPtr<RadioButton> mpRbEPSColorFormat2;
+ VclPtr<RadioButton> mpRbEPSCompressionLZW;
+ VclPtr<RadioButton> mpRbEPSCompressionNone;
- VclContainer* mpInfo;
- FixedText* mpFtEstimatedSize;
+ VclPtr<VclContainer> mpInfo;
+ VclPtr<FixedText> mpFtEstimatedSize;
- OKButton* mpBtnOK;
+ VclPtr<OKButton> mpBtnOK;
OUString msEstimatedSizePix1;
OUString msEstimatedSizePix2;
@@ -127,9 +127,9 @@ private:
com::sun::star::awt::Size
maSize; // for vector graphics it always contains the logical size in 1/100mm
- bool mbIsPixelFormat;
- bool mbExportSelection;
- bool mbPreserveAspectRatio;
+ bool mbIsPixelFormat;
+ bool mbExportSelection;
+ bool mbPreserveAspectRatio;
sal_Int32 mnInitialResolutionUnit;
@@ -179,6 +179,7 @@ public:
const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument,
bool bExportSelection, bool bIsExportVectorFormat );
virtual ~ExportDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 06f0397c5b4e..46b48091fb9f 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -1894,19 +1894,19 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c
// First combine very small bitmaps into a larger tile
- VirtualDevice aVDev;
+ ScopedVclPtrInstance< VirtualDevice > aVDev;
const int nNumTilesInCacheX( (nTileCacheSize1D + rSizePixel.Width()-1) / rSizePixel.Width() );
const int nNumTilesInCacheY( (nTileCacheSize1D + rSizePixel.Height()-1) / rSizePixel.Height() );
- aVDev.SetOutputSizePixel( Size( nNumTilesInCacheX*rSizePixel.Width(),
+ aVDev->SetOutputSizePixel( Size( nNumTilesInCacheX*rSizePixel.Width(),
nNumTilesInCacheY*rSizePixel.Height() ) );
- aVDev.SetMapMode( aMapMode );
+ aVDev->SetMapMode( aMapMode );
// draw bitmap content
- if( ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX,
+ if( ImplRenderTempTile( *aVDev.get(), SubdivisionExponent, nNumTilesInCacheX,
nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) )
{
- BitmapEx aTileBitmap( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) );
+ BitmapEx aTileBitmap( aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ) );
// draw alpha content, if any
if( IsTransparent() )
@@ -1918,16 +1918,16 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c
else
aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetMask() );
- if( aAlphaGraphic.ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX,
+ if( aAlphaGraphic.ImplRenderTempTile( *aVDev.get(), SubdivisionExponent, nNumTilesInCacheX,
nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) )
{
// Combine bitmap and alpha/mask
if( GetGraphic().IsAlpha() )
aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(),
- AlphaMask( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) ) );
+ AlphaMask( aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ) ) );
else
aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(),
- aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ).CreateMask( Color(COL_WHITE) ) );
+ aVDev->GetBitmap( Point(0,0), aVDev->GetOutputSize() ).CreateMask( Color(COL_WHITE) ) );
}
}
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 1229ba122c4c..9e7283ca42b4 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -634,7 +634,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
}
else if ( ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) && nImageResolution )
{
- VirtualDevice aDummyVDev;
+ ScopedVclPtrInstance< VirtualDevice > aDummyVDev;
GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() );
Size aMtfSize( OutputDevice::LogicToLogic( aMtf.GetPrefSize(), aMtf.GetPrefMapMode(), MAP_100TH_MM ) );
if ( aMtfSize.Width() && aMtfSize.Height() )
@@ -642,8 +642,8 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
MapMode aNewMapMode( MAP_100TH_MM );
aNewMapMode.SetScaleX( static_cast< double >( aLogicalSize.Width ) / static_cast< double >( aMtfSize.Width() ) );
aNewMapMode.SetScaleY( static_cast< double >( aLogicalSize.Height ) / static_cast< double >( aMtfSize.Height() ) );
- aDummyVDev.EnableOutput( false );
- aDummyVDev.SetMapMode( aNewMapMode );
+ aDummyVDev->EnableOutput( false );
+ aDummyVDev->SetMapMode( aNewMapMode );
for( size_t i = 0, nObjCount = aMtf.GetActionSize(); i < nObjCount; i++ )
{
@@ -653,18 +653,18 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
// only optimizing common bitmap actions:
case( META_MAPMODE_ACTION ):
{
- const_cast< MetaAction* >( pAction )->Execute( &aDummyVDev );
+ const_cast< MetaAction* >( pAction )->Execute( aDummyVDev.get() );
break;
}
case( META_PUSH_ACTION ):
{
const MetaPushAction* pA = static_cast<const MetaPushAction*>(pAction);
- aDummyVDev.Push( pA->GetFlags() );
+ aDummyVDev->Push( pA->GetFlags() );
break;
}
case( META_POP_ACTION ):
{
- aDummyVDev.Pop();
+ aDummyVDev->Pop();
break;
}
case( META_BMPSCALE_ACTION ):
@@ -688,8 +688,8 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal
aSize = pScaleAction->GetSize();
}
::Graphic aGraphic( aBmpEx );
- const Size aSize100thmm( aDummyVDev.LogicToPixel( aSize ) );
- Size aSize100thmm2( aDummyVDev.PixelToLogic( aSize100thmm, MAP_100TH_MM ) );
+ const Size aSize100thmm( aDummyVDev->LogicToPixel( aSize ) );
+ Size aSize100thmm2( aDummyVDev->PixelToLogic( aSize100thmm, MAP_100TH_MM ) );
ImplApplyBitmapResolution( aGraphic, nImageResolution,
aGraphic.GetSizePixel(), awt::Size( aSize100thmm2.Width(), aSize100thmm2.Height() ) );
diff --git a/svtools/source/hatchwindow/hatchwindow.cxx b/svtools/source/hatchwindow/hatchwindow.cxx
index dc1828d08642..3ca665552db0 100644
--- a/svtools/source/hatchwindow/hatchwindow.cxx
+++ b/svtools/source/hatchwindow/hatchwindow.cxx
@@ -55,7 +55,7 @@ void VCLXHatchWindow::initializeWindow( const uno::Reference< awt::XWindowPeer >
if ( !pParent )
throw lang::IllegalArgumentException(); // TODO
- pHatchWindow = new SvResizeWindow( pParent, this );
+ pHatchWindow = VclPtr<SvResizeWindow>::Create( pParent, this );
pHatchWindow->setPosSizePixel( aBounds.X, aBounds.Y, aBounds.Width, aBounds.Height );
aHatchBorderSize = aSize;
pHatchWindow->SetHatchBorderPixel( Size( aSize.Width, aSize.Height ) );
@@ -188,7 +188,7 @@ void SAL_CALL VCLXHatchWindow::setController( const uno::Reference< embed::XHatc
void SAL_CALL VCLXHatchWindow::dispose()
throw (uno::RuntimeException, std::exception)
{
- pHatchWindow = 0;
+ pHatchWindow.clear();
VCLXWindow::dispose();
}
diff --git a/svtools/source/inc/hatchwindow.hxx b/svtools/source/inc/hatchwindow.hxx
index b08e13ee0e14..1fb06de64531 100644
--- a/svtools/source/inc/hatchwindow.hxx
+++ b/svtools/source/inc/hatchwindow.hxx
@@ -31,7 +31,7 @@ class VCLXHatchWindow : public ::com::sun::star::embed::XHatchWindow,
{
::com::sun::star::uno::Reference< ::com::sun::star::embed::XHatchWindowController > m_xController;
::com::sun::star::awt::Size aHatchBorderSize;
- SvResizeWindow* pHatchWindow;
+ VclPtr<SvResizeWindow> pHatchWindow;
public:
VCLXHatchWindow();
diff --git a/svtools/source/inc/renderer.hxx b/svtools/source/inc/renderer.hxx
index b50088d2e737..ca3417b640f4 100644
--- a/svtools/source/inc/renderer.hxx
+++ b/svtools/source/inc/renderer.hxx
@@ -70,7 +70,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxDevice;
- OutputDevice* mpOutDev;
+ VclPtr<OutputDevice> mpOutDev;
Rectangle maDestRect;
::com::sun::star::uno::Any maRenderData;
};
diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx
index b2802168ba29..4f0c79f5e3db 100644
--- a/svtools/source/inc/svimpbox.hxx
+++ b/svtools/source/inc/svimpbox.hxx
@@ -47,7 +47,7 @@ class ImpLBSelEng : public FunctionSet
{
SvImpLBox* pImp;
SelectionEngine* pSelEng;
- SvTreeListBox* pView;
+ VclPtr<SvTreeListBox> pView;
public:
ImpLBSelEng( SvImpLBox* pImp, SelectionEngine* pSelEng,
@@ -86,7 +86,7 @@ class SvImpLBox
friend class ImpLBSelEng;
friend class SvTreeListBox;
private:
- SvTreeListBox* pView;
+ VclPtr<SvTreeListBox> pView;
SvTreeList* pTree;
SvTreeListEntry* pCursor;
SvTreeListEntry* pStartEntry;
@@ -96,9 +96,9 @@ private:
SvTreeListEntry* pActiveEntry;
SvLBoxTab* pActiveTab;
- ScrollBar aVerSBar;
- ScrollBar aHorSBar;
- ScrollBarBox aScrBarBox;
+ VclPtr<ScrollBar> aVerSBar;
+ VclPtr<ScrollBar> aHorSBar;
+ VclPtr<ScrollBarBox> aScrBarBox;
::svt::AccessibleFactoryAccess
m_aFactoryAccess;
@@ -329,7 +329,7 @@ public:
void SetUpdateMode( bool bMode );
bool GetUpdateMode() const { return bUpdateMode; }
Rectangle GetClipRegionRect() const;
- bool HasHorScrollBar() const { return aHorSBar.IsVisible(); }
+ bool HasHorScrollBar() const { return aHorSBar->IsVisible(); }
void ShowFocusRect( const SvTreeListEntry* pEntry );
void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx
index 1bb9e736fddb..a96624ebc5dc 100644
--- a/svtools/source/inc/unoiface.hxx
+++ b/svtools/source/inc/unoiface.hxx
@@ -124,7 +124,7 @@ public:
VCLXFileControl();
virtual ~VCLXFileControl();
- void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
+ virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -176,8 +176,6 @@ protected:
sal_Int32 nKeyToSetDelayed;
- FormattedField* GetFormattedField() const { return static_cast<FormattedField*>(GetWindow()); }
-
public:
SVTXFormattedField();
virtual ~SVTXFormattedField();
@@ -210,7 +208,7 @@ protected:
void NotifyTextListeners();
::com::sun::star::uno::Any convertEffectiveValue(const ::com::sun::star::uno::Any& rValue);
- virtual void SetWindow(vcl::Window* _pWindow) SAL_OVERRIDE;
+ virtual void SetWindow( const VclPtr< vcl::Window > &_pWindow) SAL_OVERRIDE;
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) SAL_OVERRIDE { return ImplGetPropertyIds( aIds ); }
@@ -250,8 +248,7 @@ private:
static RMItemData GetRMItemData( const ::com::sun::star::container::ContainerEvent& _rEvent );
protected:
- ::svt::ORoadmap* GetRoadmap() const;
- void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
virtual ~SVTXRoadmap();
diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx
index 15e797d18dfe..e380fb1972cf 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -122,9 +122,9 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
// No suitable JRE found
SolarMutexGuard aSolarGuard;
m_bJavaNotFound_Handled = true;
- MessageDialog aWarningBox(NULL, SvtResId(STR_WARNING_JAVANOTFOUND), VCL_MESSAGE_WARNING);
- aWarningBox.SetText(SvtResId(STR_WARNING_JAVANOTFOUND_TITLE));
- nResult = aWarningBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_JAVANOTFOUND), VCL_MESSAGE_WARNING);
+ aWarningBox->SetText(SvtResId(STR_WARNING_JAVANOTFOUND_TITLE));
+ nResult = aWarningBox->Execute();
}
else
{
@@ -139,12 +139,12 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
SolarMutexGuard aSolarGuard;
m_bInvalidSettings_Handled = true;
#ifdef MACOSX
- MessageDialog aWarningBox(NULL, SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC), VCL_MESSAGE_WARNING);
+ ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_INVALIDJAVASETTINGS_MAC), VCL_MESSAGE_WARNING);
#else
- MessageDialog aWarningBox(NULL, SvtResId(STR_WARNING_INVALIDJAVASETTINGS), VCL_MESSAGE_WARNING);
+ ScopedVclPtrInstance< MessageDialog > aWarningBox(nullptr, SvtResId(STR_WARNING_INVALIDJAVASETTINGS), VCL_MESSAGE_WARNING);
#endif
- aWarningBox.SetText(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE));
- nResult = aWarningBox.Execute();
+ aWarningBox->SetText(SvtResId(STR_WARNING_INVALIDJAVASETTINGS_TITLE));
+ nResult = aWarningBox->Execute();
}
else
{
@@ -158,9 +158,9 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
SolarMutexGuard aSolarGuard;
m_bJavaDisabled_Handled = true;
// Java disabled. Give user a chance to enable Java inside Office.
- MessageDialog aQueryBox(NULL, "JavaDisabledDialog",
- "svt/ui/javadisableddialog.ui");
- nResult = aQueryBox.Execute();
+ ScopedVclPtrInstance<MessageDialog> aQueryBox(nullptr , "JavaDisabledDialog",
+ "svt/ui/javadisableddialog.ui");
+ nResult = aQueryBox->Execute();
if ( nResult == RET_YES )
{
jfw_setEnabled(sal_True);
@@ -182,12 +182,12 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
SolarMutexGuard aSolarGuard;
m_bVMCreationFailure_Handled = true;
#ifdef MACOSX
- MessageDialog aErrorBox(NULL, SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC));
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SvtResId(STR_ERROR_JVMCREATIONFAILED_MAC));
#else
- MessageDialog aErrorBox(NULL, SvtResId(STR_ERROR_JVMCREATIONFAILED));
+ ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, SvtResId(STR_ERROR_JVMCREATIONFAILED));
#endif
- aErrorBox.SetText(SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE));
- nResult = aErrorBox.Execute();
+ aErrorBox->SetText(SvtResId(STR_ERROR_JVMCREATIONFAILED_TITLE));
+ nResult = aErrorBox->Execute();
}
else
{
diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx
index 987e841d01ce..b381c43d4bd7 100644
--- a/svtools/source/misc/dialogcontrolling.cxx
+++ b/svtools/source/misc/dialogcontrolling.cxx
@@ -50,7 +50,7 @@ namespace svt
struct DialogController_Data
{
vcl::Window& rInstigator;
- ::std::vector< vcl::Window* > aConcernedWindows;
+ ::std::vector< VclPtr<vcl::Window> > aConcernedWindows;
PWindowEventFilter pEventFilter;
PWindowOperator pOperator;
@@ -111,7 +111,7 @@ namespace svt
void DialogController::impl_updateAll( const VclWindowEvent& _rTriggerEvent )
{
- for ( ::std::vector< vcl::Window* >::iterator loop = m_pImpl->aConcernedWindows.begin();
+ for ( auto loop = m_pImpl->aConcernedWindows.begin();
loop != m_pImpl->aConcernedWindows.end();
++loop
)
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 05d8b3a75bb6..fa8cf14fed01 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -89,23 +89,23 @@ static sal_uInt16 aWndFunc(
aErr = aErr.replaceAll("$(ACTION)", aAction);
aErr = aErr.replaceAll("$(ERROR)", rErr);
- boost::scoped_ptr<MessBox> pBox;
+ VclPtr<MessBox> pBox;
switch ( nFlags & 0xf000 )
{
case ERRCODE_MSG_ERROR:
- pBox.reset(new ErrorBox(pWin, eBits, aErr));
+ pBox.reset(VclPtr<ErrorBox>::Create(pWin, eBits, aErr));
break;
case ERRCODE_MSG_WARNING:
- pBox.reset(new WarningBox(pWin, eBits, aErr));
+ pBox.reset(VclPtr<WarningBox>::Create(pWin, eBits, aErr));
break;
case ERRCODE_MSG_INFO:
- pBox.reset(new InfoBox(pWin, aErr));
+ pBox.reset(VclPtr<InfoBox>::Create(pWin, aErr));
break;
case ERRCODE_MSG_QUERY:
- pBox.reset(new QueryBox(pWin, eBits, aErr));
+ pBox.reset(VclPtr<QueryBox>::Create(pWin, eBits, aErr));
break;
default:
diff --git a/svtools/source/misc/sampletext.cxx b/svtools/source/misc/sampletext.cxx
index 40f5d7d45121..63d8c9a9346f 100644
--- a/svtools/source/misc/sampletext.cxx
+++ b/svtools/source/misc/sampletext.cxx
@@ -1623,12 +1623,12 @@ OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const vcl::Font &r
{
OUString sRet(makeRepresentativeTextForLanguage(rFont.GetLanguage()));
- VirtualDevice aDevice;
- if (sRet.isEmpty() || (-1 != aDevice.HasGlyphs(rFont, sRet)))
+ ScopedVclPtrInstance< VirtualDevice > aDevice;
+ if (sRet.isEmpty() || (-1 != aDevice->HasGlyphs(rFont, sRet)))
{
- aDevice.SetFont(rFont);
+ aDevice->SetFont(rFont);
vcl::FontCapabilities aFontCapabilities;
- if (aDevice.GetFontCapabilities(aFontCapabilities))
+ if (aDevice->GetFontCapabilities(aFontCapabilities))
{
#if OSL_DEBUG_LEVEL > 2
lcl_dump_unicode_coverage(aFontCapabilities.maUnicodeRange);
@@ -1655,7 +1655,7 @@ OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const vcl::Font &r
UScriptCode eScript = getScript(aFontCapabilities);
if (nScriptType == com::sun::star::i18n::ScriptType::ASIAN)
- eScript = attemptToDisambiguateHan(eScript, aDevice);
+ eScript = attemptToDisambiguateHan(eScript, *aDevice.get());
sRet = makeRepresentativeTextForScript(eScript);
}
@@ -1665,10 +1665,10 @@ OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const vcl::Font &r
if (nScriptType == com::sun::star::i18n::ScriptType::COMPLEX)
{
sRet = makeRepresentativeTextForScript(USCRIPT_HEBREW);
- if (-1 != aDevice.HasGlyphs(rFont, sRet))
+ if (-1 != aDevice->HasGlyphs(rFont, sRet))
{
sRet = makeMinimalTextForScript(USCRIPT_HEBREW);
- if (-1 != aDevice.HasGlyphs(rFont, sRet))
+ if (-1 != aDevice->HasGlyphs(rFont, sRet))
sRet = makeRepresentativeTextForScript(USCRIPT_ARABIC);
}
}
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index e350a2237c12..d4b98433de3b 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -86,17 +86,17 @@ namespace svt { namespace table
Point const aBitmapPos( 0, 0 );
Size const aBitmapSize( nSortIndicatorWidth, nSortIndicatorHeight );
- VirtualDevice aDevice( i_device, 0, 0 );
- aDevice.SetOutputSizePixel( aBitmapSize );
+ ScopedVclPtrInstance< VirtualDevice > aDevice( i_device, 0, 0 );
+ aDevice->SetOutputSizePixel( aBitmapSize );
- DecorationView aDecoView( &aDevice );
+ DecorationView aDecoView( aDevice.get() );
aDecoView.DrawSymbol(
Rectangle( aBitmapPos, aBitmapSize ),
i_sortAscending ? SymbolType::SPIN_UP : SymbolType::SPIN_DOWN,
i_style.GetActiveColor()
);
- rBitmap = aDevice.GetBitmapEx( aBitmapPos, aBitmapSize );
+ rBitmap = aDevice->GetBitmapEx( aBitmapPos, aBitmapSize );
m_lastHeaderHeight = i_headerHeight;
m_lastArrowColor = i_style.GetActiveColor();
}
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 7ed486a90b48..5c887c36d83d 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -64,11 +64,17 @@ namespace svt { namespace table
TableControl::~TableControl()
{
+ disposeOnce();
+ }
+
+ void TableControl::dispose()
+ {
CallEventListeners( VCLEVENT_OBJECT_DYING );
m_pImpl->setModel( PTableModel() );
m_pImpl->disposeAccessible();
m_pImpl.reset();
+ Control::dispose();
}
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 2d2bf0166586..1565914154b6 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -242,7 +242,7 @@ namespace svt { namespace table
,m_nLeftColumn ( 0 )
,m_nTopRow ( 0 )
,m_nCursorHidden ( 1 )
- ,m_pDataWindow ( new TableDataWindow( *this ) )
+ ,m_pDataWindow ( VclPtr<TableDataWindow>::Create( *this ) )
,m_pVScroll ( NULL )
,m_pHScroll ( NULL )
,m_pScrollCorner ( NULL )
@@ -261,10 +261,10 @@ namespace svt { namespace table
TableControl_Impl::~TableControl_Impl()
{
-
- DELETEZ( m_pVScroll );
- DELETEZ( m_pHScroll );
- DELETEZ( m_pScrollCorner );
+ m_pVScroll.disposeAndClear();
+ m_pHScroll.disposeAndClear();
+ m_pScrollCorner.disposeAndClear();
+ m_pDataWindow.disposeAndClear();
DELETEZ( m_pTableFunctionSet );
DELETEZ( m_pSelEngine );
}
@@ -632,24 +632,25 @@ namespace svt { namespace table
}
- bool lcl_updateScrollbar( vcl::Window& _rParent, ScrollBar*& _rpBar,
+ bool lcl_updateScrollbar( vcl::Window& _rParent, VclPtr<ScrollBar>& _rpBar,
bool const i_needBar, long _nVisibleUnits,
long _nPosition, long _nLineSize, long _nRange,
bool _bHorizontal, const Link& _rScrollHandler )
{
// do we currently have the scrollbar?
- bool bHaveBar = _rpBar != NULL;
+ bool bHaveBar = _rpBar != nullptr;
// do we need to correct the scrollbar visibility?
if ( bHaveBar && !i_needBar )
{
if ( _rpBar->IsTracking() )
_rpBar->EndTracking();
- DELETEZ( _rpBar );
+ _rpBar.disposeAndClear();
}
else if ( !bHaveBar && i_needBar )
{
- _rpBar = new ScrollBar(
+ _rpBar = VclPtr<ScrollBar>::Create(
+
&_rParent,
WB_DRAG | ( _bHorizontal ? WB_HSCROLL : WB_VSCROLL )
);
@@ -1162,15 +1163,15 @@ namespace svt { namespace table
}
// the corner window connecting the two scrollbars in the lower right corner
- bool bHaveScrollCorner = NULL != m_pScrollCorner;
- bool bNeedScrollCorner = ( NULL != m_pHScroll ) && ( NULL != m_pVScroll );
+ bool bHaveScrollCorner = nullptr != m_pScrollCorner;
+ bool bNeedScrollCorner = ( nullptr != m_pHScroll ) && ( nullptr != m_pVScroll );
if ( bHaveScrollCorner && !bNeedScrollCorner )
{
- DELETEZ( m_pScrollCorner );
+ m_pScrollCorner.disposeAndClear();
}
else if ( !bHaveScrollCorner && bNeedScrollCorner )
{
- m_pScrollCorner = new ScrollBarBox( &m_rAntiImpl );
+ m_pScrollCorner = VclPtr<ScrollBarBox>::Create( &m_rAntiImpl );
m_pScrollCorner->SetSizePixel( Size( nScrollbarMetrics, nScrollbarMetrics ) );
m_pScrollCorner->SetPosPixel( Point( i_dataCellPlayground.Right() + 1, i_dataCellPlayground.Bottom() + 1 ) );
m_pScrollCorner->Show();
@@ -2111,7 +2112,7 @@ namespace svt { namespace table
}
// update the position at the vertical scrollbar
- if ( m_pVScroll != NULL )
+ if ( m_pVScroll != nullptr )
m_pVScroll->SetThumbPos( m_nTopRow );
}
@@ -2189,7 +2190,7 @@ namespace svt { namespace table
}
// update the position at the horizontal scrollbar
- if ( m_pHScroll != NULL )
+ if ( m_pHScroll != nullptr )
m_pHScroll->SetThumbPos( m_nLeftColumn );
}
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 5fef6fdd4062..4a587c8e3af8 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -122,13 +122,12 @@ namespace svt { namespace table
The window's upper left corner is at position (0,0), relative to the
table control, which is the direct parent of the data window.
*/
- ::boost::scoped_ptr< TableDataWindow >
- m_pDataWindow;
+ VclPtr<TableDataWindow> m_pDataWindow;
/// the vertical scrollbar, if any
- ScrollBar* m_pVScroll;
+ VclPtr<ScrollBar> m_pVScroll;
/// the horizontal scrollbar, if any
- ScrollBar* m_pHScroll;
- ScrollBarBox* m_pScrollCorner;
+ VclPtr<ScrollBar> m_pHScroll;
+ VclPtr<ScrollBarBox> m_pScrollCorner;
//selection engine - for determining selection range, e.g. single, multiple
SelectionEngine* m_pSelEngine;
//vector which contains the selected rows
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index cddaf452732c..2b819033d610 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -51,7 +51,13 @@ namespace svt { namespace table
TableDataWindow::~TableDataWindow()
{
+ disposeOnce();
+ }
+
+ void TableDataWindow::dispose()
+ {
impl_hideTipWindow();
+ Window::dispose();
}
void TableDataWindow::Paint( const Rectangle& rUpdateRect )
diff --git a/svtools/source/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx
index 13e1f1fcb0a7..d5ce17192b11 100644
--- a/svtools/source/table/tabledatawindow.hxx
+++ b/svtools/source/table/tabledatawindow.hxx
@@ -49,6 +49,7 @@ namespace svt { namespace table
public:
TableDataWindow( TableControl_Impl& _rTableControl );
virtual ~TableDataWindow();
+ virtual void dispose() SAL_OVERRIDE;
inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
inline const Link& GetSelectHdl() const { return m_aSelectHdl; }
diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx
index b2e692c1bd55..c044105d38e1 100644
--- a/svtools/source/toolpanel/drawerlayouter.cxx
+++ b/svtools/source/toolpanel/drawerlayouter.cxx
@@ -132,7 +132,7 @@ namespace svt
{
ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL );
- const PToolPanelDrawer pDrawer( m_aDrawers[ i_nChildIndex ] );
+ VclPtr<ToolPanelDrawer> pDrawer( m_aDrawers[ i_nChildIndex ] );
Reference< XAccessible > xItemAccessible = pDrawer->GetAccessible( false );
if ( !xItemAccessible.is() )
@@ -151,7 +151,7 @@ namespace svt
{
OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" );
- PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ) );
+ VclPtrInstance<ToolPanelDrawer> pDrawer( m_rParentWindow, i_pPanel->GetDisplayName() );
pDrawer->SetHelpId( i_pPanel->GetHelpID() );
// proper Z-Order
if ( i_nPosition == 0 )
@@ -160,8 +160,8 @@ namespace svt
}
else
{
- const PToolPanelDrawer pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] );
- pDrawer->SetZOrder( pFirstDrawer.get(), WINDOW_ZORDER_BEHIND );
+ ToolPanelDrawer* pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] );
+ pDrawer->SetZOrder( pFirstDrawer, WINDOW_ZORDER_BEHIND );
}
pDrawer->Show();
@@ -213,10 +213,7 @@ namespace svt
size_t DrawerDeckLayouter::impl_getPanelPositionFromWindow( const vcl::Window* i_pDrawerWindow ) const
{
- for ( ::std::vector< PToolPanelDrawer >::const_iterator drawerPos = m_aDrawers.begin();
- drawerPos != m_aDrawers.end();
- ++drawerPos
- )
+ for ( auto drawerPos = m_aDrawers.begin(); drawerPos != m_aDrawers.end(); ++drawerPos )
{
if ( drawerPos->get() == i_pDrawerWindow )
return drawerPos - m_aDrawers.begin();
@@ -229,7 +226,6 @@ namespace svt
{
OSL_PRECOND( i_nPosition < m_aDrawers.size(), "DrawerDeckLayouter::impl_removeDrawer: invalid panel position!" );
m_aDrawers[ i_nPosition ]->RemoveEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) );
- OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "DrawerDeckLayouter::impl_removeDrawer: somebody else is still holding a reference!" );
m_aDrawers.erase( m_aDrawers.begin() + i_nPosition );
}
diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx
index ef19414cc407..58b59e903cfa 100644
--- a/svtools/source/toolpanel/paneltabbar.cxx
+++ b/svtools/source/toolpanel/paneltabbar.cxx
@@ -378,8 +378,8 @@ namespace svt
void UpdateScrollButtons()
{
- m_aScrollBack.Enable( m_nScrollPosition > 0 );
- m_aScrollForward.Enable( m_nScrollPosition < m_aItems.size() - 1 );
+ m_aScrollBack->Enable( m_nScrollPosition > 0 );
+ m_aScrollForward->Enable( m_nScrollPosition < m_aItems.size() - 1 );
}
void Relayout();
@@ -415,7 +415,7 @@ namespace svt
TabAlignment m_eTabAlignment;
IToolPanelDeck& m_rPanelDeck;
- VirtualDevice m_aRenderDevice;
+ ScopedVclPtr<VirtualDevice> m_aRenderDevice;
PTabBarRenderer m_pRenderer;
::boost::optional< size_t > m_aHoveredItem;
@@ -425,8 +425,8 @@ namespace svt
ItemDescriptors m_aItems;
bool m_bItemsDirty;
- PushButton m_aScrollBack;
- PushButton m_aScrollForward;
+ VclPtr<PushButton> m_aScrollBack;
+ VclPtr<PushButton> m_aScrollForward;
size_t m_nScrollPosition;
};
@@ -499,45 +499,45 @@ namespace svt
,m_aNormalizer()
,m_eTabAlignment( i_eAlignment )
,m_rPanelDeck( i_rPanelDeck )
- ,m_aRenderDevice( i_rTabBar )
+ ,m_aRenderDevice( VclPtr<VirtualDevice>::Create(i_rTabBar) )
,m_pRenderer()
,m_aHoveredItem()
,m_aFocusedItem()
,m_bMouseButtonDown( false )
,m_aItems()
,m_bItemsDirty( true )
- ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON )
- ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON )
+ ,m_aScrollBack( VclPtr<PushButton>::Create(&i_rTabBar, WB_BEVELBUTTON) )
+ ,m_aScrollForward( VclPtr<PushButton>::Create(&i_rTabBar, WB_BEVELBUTTON) )
,m_nScrollPosition( 0 )
{
#ifdef WNT
- if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) )
+ if ( m_aRenderDevice->IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) )
// this mode requires the NWF framework to be able to render those items onto a virtual
// device. For some frameworks (some GTK themes, in particular), this is known to fail.
// So, be on the safe side for the moment.
- m_pRenderer.reset( new NWFTabItemRenderer( m_aRenderDevice ) );
+ m_pRenderer.reset( new NWFTabItemRenderer( *m_aRenderDevice.get() ) );
else
#endif
- if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
- m_pRenderer.reset( new NWFToolboxItemRenderer( m_aRenderDevice ) );
+ if ( m_aRenderDevice->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
+ m_pRenderer.reset( new NWFToolboxItemRenderer( *m_aRenderDevice.get() ) );
else
- m_pRenderer.reset( new VCLItemRenderer( m_aRenderDevice ) );
+ m_pRenderer.reset( new VCLItemRenderer( *m_aRenderDevice.get() ) );
- m_aRenderDevice.SetLineColor();
+ m_aRenderDevice->SetLineColor();
m_rPanelDeck.AddListener( *this );
- m_aScrollBack.SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT );
- m_aScrollBack.Show();
- m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
- m_aScrollBack.SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() );
- m_aScrollBack.SetAccessibleName( m_aScrollBack.GetAccessibleDescription() );
-
- m_aScrollForward.SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT );
- m_aScrollForward.Show();
- m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
- m_aScrollForward.SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() );
- m_aScrollForward.SetAccessibleName( m_aScrollForward.GetAccessibleDescription() );
+ m_aScrollBack->SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT );
+ m_aScrollBack->Show();
+ m_aScrollBack->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
+ m_aScrollBack->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() );
+ m_aScrollBack->SetAccessibleName( m_aScrollBack->GetAccessibleDescription() );
+
+ m_aScrollForward->SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT );
+ m_aScrollForward->Show();
+ m_aScrollForward->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) );
+ m_aScrollForward->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() );
+ m_aScrollForward->SetAccessibleName( m_aScrollForward->GetAccessibleDescription() );
}
@@ -710,7 +710,7 @@ namespace svt
void PanelTabBar_Impl::CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const
{
- BitmapEx aBitmap( m_aRenderDevice.GetBitmapEx(
+ BitmapEx aBitmap( m_aRenderDevice->GetBitmapEx(
i_rLogicalRect.TopLeft(),
Size(
i_rLogicalRect.GetSize().Width(),
@@ -833,31 +833,31 @@ namespace svt
const Size aLogicalOutputSize( m_aNormalizer.getReferenceSize() );
// forward actual output size to our render device
- m_aRenderDevice.SetOutputSizePixel( aLogicalOutputSize );
+ m_aRenderDevice->SetOutputSizePixel( aLogicalOutputSize );
// re-calculate the size of the scroll buttons and of the items
m_aGeometry.relayout( aLogicalOutputSize, m_aItems );
if ( m_aGeometry.getButtonBackRect().IsEmpty() )
{
- m_aScrollBack.Hide();
+ m_aScrollBack->Hide();
}
else
{
const Rectangle aButtonBack( m_aNormalizer.getTransformed( m_aGeometry.getButtonBackRect(), m_eTabAlignment ) );
- m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() );
- m_aScrollBack.Show();
+ m_aScrollBack->SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() );
+ m_aScrollBack->Show();
}
if ( m_aGeometry.getButtonForwardRect().IsEmpty() )
{
- m_aScrollForward.Hide();
+ m_aScrollForward->Hide();
}
else
{
const Rectangle aButtonForward( m_aNormalizer.getTransformed( m_aGeometry.getButtonForwardRect(), m_eTabAlignment ) );
- m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() );
- m_aScrollForward.Show();
+ m_aScrollForward->SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() );
+ m_aScrollForward->Show();
}
UpdateScrollButtons();
@@ -921,13 +921,13 @@ namespace svt
IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton )
{
- if ( i_pButton == &m_aScrollBack )
+ if ( i_pButton == m_aScrollBack.get() )
{
OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" );
--m_nScrollPosition;
m_rTabBar.Invalidate();
}
- else if ( i_pButton == &m_aScrollForward )
+ else if ( i_pButton == m_aScrollForward.get() )
{
OSL_ENSURE( m_nScrollPosition < m_aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" );
++m_nScrollPosition;
@@ -996,11 +996,15 @@ namespace svt
DBG_CHECK( *m_pImpl );
}
-
PanelTabBar::~PanelTabBar()
{
+ disposeOnce();
}
+ void PanelTabBar::dispose()
+ {
+ Control::dispose();
+ }
TabItemContent PanelTabBar::GetTabItemContent() const
{
@@ -1046,10 +1050,10 @@ namespace svt
// background
const Rectangle aNormalizedPaintArea( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) );
- m_pImpl->m_aRenderDevice.Push( PushFlags::CLIPREGION );
- m_pImpl->m_aRenderDevice.SetClipRegion(vcl::Region(aNormalizedPaintArea));
+ m_pImpl->m_aRenderDevice->Push( PushFlags::CLIPREGION );
+ m_pImpl->m_aRenderDevice->SetClipRegion(vcl::Region(aNormalizedPaintArea));
m_pImpl->m_pRenderer->renderBackground();
- m_pImpl->m_aRenderDevice.Pop();
+ m_pImpl->m_aRenderDevice->Pop();
m_pImpl->CopyFromRenderDevice( aNormalizedPaintArea );
// ensure the items really paint into their own playground only
@@ -1314,7 +1318,7 @@ namespace svt
PushButton& PanelTabBar::GetScrollButton( const bool i_bForward )
{
- return i_bForward ? m_pImpl->m_aScrollForward : m_pImpl->m_aScrollBack;
+ return i_bForward ? *m_pImpl->m_aScrollForward.get() : *m_pImpl->m_aScrollBack.get();
}
diff --git a/svtools/source/toolpanel/paneltabbarpeer.cxx b/svtools/source/toolpanel/paneltabbarpeer.cxx
index 3a0c473732b1..4fd01f993999 100644
--- a/svtools/source/toolpanel/paneltabbarpeer.cxx
+++ b/svtools/source/toolpanel/paneltabbarpeer.cxx
@@ -64,7 +64,7 @@ namespace svt
Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext()
{
SolarMutexGuard aSolarGuard;
- if ( m_pTabBar == NULL )
+ if ( m_pTabBar == nullptr )
throw DisposedException( OUString(), *this );
@@ -80,7 +80,7 @@ namespace svt
{
{
SolarMutexGuard aSolarGuard;
- m_pTabBar = NULL;
+ m_pTabBar.clear();
}
VCLXWindow::dispose();
}
diff --git a/svtools/source/toolpanel/paneltabbarpeer.hxx b/svtools/source/toolpanel/paneltabbarpeer.hxx
index 2c9601010208..9e0bc6709524 100644
--- a/svtools/source/toolpanel/paneltabbarpeer.hxx
+++ b/svtools/source/toolpanel/paneltabbarpeer.hxx
@@ -49,7 +49,7 @@ namespace svt
private:
AccessibleFactoryAccess m_aAccessibleFactory;
- PanelTabBar* m_pTabBar;
+ VclPtr<PanelTabBar> m_pTabBar;
};
diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx
index 39a0874d824a..5c83f285bc99 100644
--- a/svtools/source/toolpanel/tablayouter.cxx
+++ b/svtools/source/toolpanel/tablayouter.cxx
@@ -41,14 +41,14 @@ namespace svt
{
TabAlignment eAlignment;
IToolPanelDeck& rPanels;
- ::std::unique_ptr< PanelTabBar > pTabBar;
+ VclPtr< PanelTabBar > pTabBar;
AccessibleFactoryAccess aAccessibleFactory;
TabDeckLayouter_Data( vcl::Window& i_rParent, IToolPanelDeck& i_rPanels,
const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
:eAlignment( i_eAlignment )
,rPanels( i_rPanels )
- ,pTabBar( new PanelTabBar( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
+ ,pTabBar( VclPtr<PanelTabBar>::Create( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
{
pTabBar->Show();
}
diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx
index af00abb8c204..8544ab104b0c 100644
--- a/svtools/source/toolpanel/toolpaneldeck.cxx
+++ b/svtools/source/toolpanel/toolpaneldeck.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <tools/diagnose_ex.h>
+#include <vcl/vclptr.hxx>
#include <boost/optional.hpp>
@@ -68,15 +69,15 @@ namespace svt
public:
ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck )
:m_rDeck( i_rDeck )
- ,m_aPanelAnchor( &i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL )
+ ,m_aPanelAnchor( VclPtr<vcl::Window>::Create(&i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL) )
,m_aPanels()
,m_pDummyPanel( new DummyPanel )
,m_pLayouter()
,m_bInDtor( false )
{
m_aPanels.AddListener( *this );
- m_aPanelAnchor.Show();
- m_aPanelAnchor.SetAccessibleRole( AccessibleRole::PANEL );
+ m_aPanelAnchor->Show();
+ m_aPanelAnchor->SetAccessibleRole( AccessibleRole::PANEL );
}
virtual ~ToolPanelDeck_Impl()
@@ -87,7 +88,7 @@ namespace svt
PDeckLayouter GetLayouter() const { return m_pLayouter; }
void SetLayouter( const PDeckLayouter& i_pNewLayouter );
- vcl::Window& GetPanelWindowAnchor() { return m_aPanelAnchor; }
+ vcl::Window& GetPanelWindowAnchor() { return *m_aPanelAnchor.get(); }
bool IsDead() const { return m_bInDtor; }
@@ -130,7 +131,7 @@ namespace svt
private:
ToolPanelDeck& m_rDeck;
- vcl::Window m_aPanelAnchor;
+ VclPtr<vcl::Window> m_aPanelAnchor;
ToolPanelCollection m_aPanels;
PToolPanel m_pDummyPanel;
PanelDeckListeners m_aListeners;
@@ -210,11 +211,11 @@ namespace svt
{
aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground );
}
- m_aPanelAnchor.SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() );
+ m_aPanelAnchor->SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() );
// position the active panel
const PToolPanel pActive( GetActiveOrDummyPanel_Impl() );
- pActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
+ pActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() );
}
@@ -261,7 +262,7 @@ namespace svt
case ACTION_TOGGLE_FOCUS:
{
PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() );
- if ( !m_aPanelAnchor.HasChildPathFocus() )
+ if ( !m_aPanelAnchor->HasChildPathFocus() )
pActivePanel->GrabFocus();
else
GetLayouter()->SetFocusToPanelSelector();
@@ -313,11 +314,11 @@ namespace svt
// position and show the new panel
const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) );
- pNewActive->Activate( m_aPanelAnchor );
+ pNewActive->Activate( *m_aPanelAnchor.get() );
pNewActive->GrabFocus();
// resize the panel (cannot guarantee it has ever been resized before
- pNewActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
+ pNewActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() );
// multiplex to our own listeners
m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive );
@@ -353,6 +354,11 @@ namespace svt
ToolPanelDeck::~ToolPanelDeck()
{
+ disposeOnce();
+ }
+
+ void ToolPanelDeck::dispose()
+ {
m_pImpl->NotifyDying();
GetLayouter()->Destroy();
@@ -362,6 +368,7 @@ namespace svt
PToolPanel pPanel( GetPanel( i ) );
pPanel->Dispose();
}
+ Control::dispose();
}
diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.cxx b/svtools/source/toolpanel/toolpaneldeckpeer.cxx
index 333fa43c10d0..76f15af12ca3 100644
--- a/svtools/source/toolpanel/toolpaneldeckpeer.cxx
+++ b/svtools/source/toolpanel/toolpaneldeckpeer.cxx
@@ -64,7 +64,7 @@ namespace svt
Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext()
{
SolarMutexGuard aSolarGuard;
- if ( m_pDeck == NULL )
+ if ( m_pDeck == nullptr )
throw DisposedException( OUString(), *this );
vcl::Window* pAccessibleParent( m_pDeck->GetAccessibleParentWindow() );
@@ -78,7 +78,7 @@ namespace svt
{
{
SolarMutexGuard aSolarGuard;
- m_pDeck = NULL;
+ m_pDeck.clear();
}
VCLXWindow::dispose();
}
diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.hxx b/svtools/source/toolpanel/toolpaneldeckpeer.hxx
index daa177000128..2ced30f50c4b 100644
--- a/svtools/source/toolpanel/toolpaneldeckpeer.hxx
+++ b/svtools/source/toolpanel/toolpaneldeckpeer.hxx
@@ -49,7 +49,7 @@ namespace svt
private:
AccessibleFactoryAccess m_aAccessibleFactory;
- ToolPanelDeck* m_pDeck;
+ VclPtr<ToolPanelDeck> m_pDeck;
};
diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx
index d74545593d1c..60b9d06cd2c0 100644
--- a/svtools/source/toolpanel/toolpaneldrawer.cxx
+++ b/svtools/source/toolpanel/toolpaneldrawer.cxx
@@ -56,11 +56,6 @@ namespace svt
}
- DrawerVisualization::~DrawerVisualization()
- {
- }
-
-
void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox )
{
Window::Paint( i_rBoundingBox );
@@ -73,8 +68,8 @@ namespace svt
ToolPanelDrawer::ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle )
:Window( &i_rParent, WB_TABSTOP )
- ,m_pPaintDevice( new VirtualDevice( *this ) )
- ,m_aVisualization( *this )
+ ,m_pPaintDevice( VclPtr<VirtualDevice>::Create( *this ) )
+ ,m_aVisualization( VclPtr<DrawerVisualization>::Create(*this) )
,m_bFocused( false )
,m_bExpanded( false )
{
@@ -88,15 +83,20 @@ namespace svt
SetAccessibleName( i_rTitle );
SetAccessibleDescription( i_rTitle );
- m_aVisualization.SetAccessibleName( i_rTitle );
- m_aVisualization.SetAccessibleDescription( i_rTitle );
+ m_aVisualization->SetAccessibleName( i_rTitle );
+ m_aVisualization->SetAccessibleDescription( i_rTitle );
}
-
ToolPanelDrawer::~ToolPanelDrawer()
{
+ disposeOnce();
}
+ void ToolPanelDrawer::dispose()
+ {
+ m_aVisualization.disposeAndClear();
+ vcl::Window::dispose();
+ }
long ToolPanelDrawer::GetPreferredHeightPixel() const
{
@@ -123,7 +123,7 @@ namespace svt
aFocusBox.Left() += 2;
impl_paintFocusIndicator( aFocusBox );
- m_aVisualization.DrawOutDev(
+ m_aVisualization->DrawOutDev(
Point(), GetOutputSizePixel(),
Point(), GetOutputSizePixel(),
*m_pPaintDevice
@@ -239,7 +239,7 @@ namespace svt
void ToolPanelDrawer::Resize()
{
Window::Resize();
- m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() );
+ m_aVisualization->SetPosSizePixel( Point(), GetOutputSizePixel() );
}
@@ -261,7 +261,7 @@ namespace svt
if ( !( i_rEvent.GetFlags() & AllSettingsFlags::STYLE ) )
break;
SetSettings( Application::GetSettings() );
- m_pPaintDevice.reset( new VirtualDevice( *this ) );
+ m_pPaintDevice.reset( VclPtr<VirtualDevice>::Create( *this ) );
// fall through.
diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx
index 3a815345e2b6..b13a12e34629 100644
--- a/svtools/source/toolpanel/toolpaneldrawer.hxx
+++ b/svtools/source/toolpanel/toolpaneldrawer.hxx
@@ -22,6 +22,7 @@
#include <vcl/window.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/vclptr.hxx>
namespace svt
@@ -45,7 +46,6 @@ namespace svt
{
public:
DrawerVisualization( ToolPanelDrawer& i_rParent );
- virtual ~DrawerVisualization();
protected:
// Window overridables
@@ -64,6 +64,7 @@ namespace svt
public:
ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle );
virtual ~ToolPanelDrawer();
+ virtual void dispose() SAL_OVERRIDE;
long GetPreferredHeightPixel() const;
void SetExpanded( const bool i_bExpanded );
@@ -96,8 +97,8 @@ namespace svt
using Window::Paint;
private:
- ::std::unique_ptr< VirtualDevice > m_pPaintDevice;
- DrawerVisualization m_aVisualization;
+ ScopedVclPtr< VirtualDevice > m_pPaintDevice;
+ VclPtr<DrawerVisualization> m_aVisualization;
bool m_bFocused;
bool m_bExpanded;
};
diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
index 5f7af7987e0f..8e83866a6b9a 100644
--- a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
+++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx
@@ -97,7 +97,7 @@ namespace svt
i_rStateSet.AddState( AccessibleStateType::EXPANDABLE );
i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
- const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) );
+ VclPtr< ToolPanelDrawer > pDrawer = GetAsDynamic< ToolPanelDrawer > ();
ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" );
if ( pDrawer->IsExpanded() )
i_rStateSet.AddState( AccessibleStateType::EXPANDED );
diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx
index 1a9a8645ba50..d21a3baefa6f 100644
--- a/svtools/source/uno/addrtempuno.cxx
+++ b/svtools/source/uno/addrtempuno.cxx
@@ -71,7 +71,7 @@ namespace {
protected:
// OGenericUnoDialog overridables
- virtual Dialog* createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) SAL_OVERRIDE;
virtual void implInitialize(const com::sun::star::uno::Any& _rValue) SAL_OVERRIDE;
@@ -134,7 +134,7 @@ namespace {
if ( _nExecutionResult )
if ( m_pDialog )
- static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases );
+ static_cast< AddressBookSourceDialog* >( m_pDialog.get() )->getFieldMapping( m_aAliases );
}
void SAL_CALL OAddressBookSourceDialogUno::initialize(const Sequence< Any >& rArguments) throw(Exception, RuntimeException, std::exception)
@@ -212,12 +212,12 @@ namespace {
}
- Dialog* OAddressBookSourceDialogUno::createDialog(vcl::Window* _pParent)
+ VclPtr<Dialog> OAddressBookSourceDialogUno::createDialog(vcl::Window* _pParent)
{
if ( m_xDataSource.is() && !m_sTable.isEmpty() )
- return new AddressBookSourceDialog(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases );
+ return VclPtr<AddressBookSourceDialog>::Create(_pParent, m_aContext, m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases );
else
- return new AddressBookSourceDialog( _pParent, m_aContext );
+ return VclPtr<AddressBookSourceDialog>::Create( _pParent, m_aContext );
}
}
diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx
index 1c78816e63af..04e6203477a4 100644
--- a/svtools/source/uno/generictoolboxcontroller.cxx
+++ b/svtools/source/uno/generictoolboxcontroller.cxx
@@ -74,11 +74,9 @@ void SAL_CALL GenericToolboxController::dispose()
throw ( RuntimeException, std::exception )
{
SolarMutexGuard aSolarMutexGuard;
-
- svt::ToolboxController::dispose();
-
- m_pToolbox = 0;
+ m_pToolbox.clear();
m_nID = 0;
+ svt::ToolboxController::dispose();
}
void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ )
diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx
index b0186d2c8dc0..4b7f82f3d753 100644
--- a/svtools/source/uno/genericunodialog.cxx
+++ b/svtools/source/uno/genericunodialog.cxx
@@ -178,7 +178,7 @@ bool OGenericUnoDialog::impl_ensureDialog_lck()
// the title
OUString sTitle = m_sTitle;
- Dialog* pDialog = createDialog( pParent );
+ VclPtr<Dialog> pDialog = createDialog( pParent );
OSL_ENSURE( pDialog, "OGenericUnoDialog::impl_ensureDialog_lck: createDialog returned nonsense!" );
if ( !pDialog )
return false;
@@ -313,8 +313,7 @@ void SAL_CALL OGenericUnoDialog::initialize( const Sequence< Any >& aArguments )
void OGenericUnoDialog::destroyDialog()
{
- delete m_pDialog;
- m_pDialog = NULL;
+ m_pDialog.disposeAndClear();
}
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index aa6277a81c07..82f61e3b9e49 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -47,8 +47,8 @@ public:
DECL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, vcl::Window* );
private:
- vcl::Window* mpPopupWindow;
- ToolBox* mpToolBox;
+ VclPtr<vcl::Window> mpPopupWindow;
+ VclPtr<ToolBox> mpToolBox;
};
PopupWindowControllerImpl::PopupWindowControllerImpl()
@@ -99,7 +99,7 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve
mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, (void*)mpPopupWindow );
mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 );
- svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow );
+ svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow.get() );
if( pToolbarMenu )
pToolbarMenu->highlightFirstEntry();
break;
@@ -126,7 +126,7 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve
IMPL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, vcl::Window*, pWindow )
{
(void)*pThis;
- delete pWindow;
+ pWindow->disposeOnce();
return 0;
}
@@ -216,7 +216,7 @@ void SAL_CALL PopupWindowController::doubleClick() throw (RuntimeException, std:
Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() throw (RuntimeException, std::exception)
{
- ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ VclPtr< ToolBox > pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if( pToolBox )
{
vcl::Window* pItemWindow = pToolBox->GetItemWindow( pToolBox->GetDownItemId() );
diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx
index 766b02128e9f..88f10265e99e 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -517,7 +517,7 @@ void StatusbarController::bindListener()
if ( m_xParentWindow.is() )
{
- StatusBar* pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ));
+ VclPtr< StatusBar > pStatusBar = dynamic_cast< StatusBar* >( VCLUnoHelper::GetWindow( m_xParentWindow ).get() );
if ( pStatusBar && pStatusBar->GetType() == WINDOW_STATUSBAR )
aRect = pStatusBar->GetItemRect( m_nID );
}
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 6fec3022a7fb..b1fb0a2e0cbd 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -89,7 +89,7 @@ SVTXGridControl::~SVTXGridControl()
}
-void SVTXGridControl::SetWindow( vcl::Window* pWindow )
+void SVTXGridControl::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
SVTXGridControl_Base::SetWindow( pWindow );
impl_checkTableModelInit();
@@ -114,8 +114,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y)
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getRowAtPoint: no control (anymore)!", -1 );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getRowAtPoint: no control (anymore)!", -1 );
TableCell const tableCell = pTable->getTableControlInterface().hitTest( Point( x, y ) );
return ( tableCell.nRow >= 0 ) ? tableCell.nRow : -1;
@@ -126,8 +126,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getColumnAtPoint: no control (anymore)!", -1 );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getColumnAtPoint: no control (anymore)!", -1 );
TableCell const tableCell = pTable->getTableControlInterface().hitTest( Point( x, y ) );
return ( tableCell.nColumn >= 0 ) ? tableCell.nColumn : -1;
@@ -138,8 +138,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentColumn( ) throw (RuntimeException
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentColumn: no control (anymore)!", -1 );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getCurrentColumn: no control (anymore)!", -1 );
sal_Int32 const nColumn = pTable->GetCurrentColumn();
return ( nColumn >= 0 ) ? nColumn : -1;
@@ -150,8 +150,8 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentRow( ) throw (RuntimeException, s
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!", -1 );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getCurrentRow: no control (anymore)!", -1 );
sal_Int32 const nRow = pTable->GetCurrentRow();
return ( nRow >= 0 ) ? nRow : -1;
@@ -162,8 +162,8 @@ void SAL_CALL SVTXGridControl::goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!" );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::getCurrentRow: no control (anymore)!" );
impl_checkColumnIndex_throw( *pTable, i_columnIndex );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
@@ -188,8 +188,8 @@ void SVTXGridControl::setProperty( const OUString& PropertyName, const Any& aVal
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::setProperty: no control (anymore)!" );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::setProperty: no control (anymore)!" );
switch( GetPropertyId( PropertyName ) )
{
@@ -438,7 +438,7 @@ void SVTXGridControl::impl_checkTableModelInit()
{
if ( !m_bTableModelInitCompleted && m_xTableModel->hasColumnModel() && m_xTableModel->hasDataModel() )
{
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
if ( pTable )
{
pTable->SetModel( PTableModel( m_xTableModel ) );
@@ -472,8 +472,8 @@ Any SVTXGridControl::getProperty( const OUString& PropertyName ) throw(RuntimeEx
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getProperty: no control (anymore)!", Any() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN( pTable, "SVTXGridControl::getProperty: no control (anymore)!", Any() );
Any aPropertyValue;
@@ -625,7 +625,7 @@ void SAL_CALL SVTXGridControl::dataChanged( const GridDataEvent& i_event ) throw
// if the data model is sortable, a dataChanged event is also fired in case the sort order changed.
// So, just in case, invalidate the column header area, too.
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::dataChanged: no control (anymore)!" );
pTable->getTableControlInterface().invalidate( TableAreaColumnHeaders );
}
@@ -636,7 +636,7 @@ void SAL_CALL SVTXGridControl::rowHeadingChanged( const GridDataEvent& i_event )
SolarMutexGuard aGuard;
OSL_UNUSED( i_event );
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::rowHeadingChanged: no control (anymore)!" );
// TODO: we could do better than this - invalidate the header area only
@@ -686,7 +686,7 @@ void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (Runtim
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectRow: no control (anymore)!" );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
@@ -699,7 +699,7 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (RuntimeException, std::exc
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectAllRows: no control (anymore)!" );
pTable->SelectAllRows( true );
@@ -710,7 +710,7 @@ void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (Runt
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectRow: no control (anymore)!" );
impl_checkRowIndex_throw( *pTable, i_rowIndex );
@@ -723,7 +723,7 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (RuntimeException, std::e
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectAllRows: no control (anymore)!" );
pTable->SelectAllRows( false );
@@ -734,7 +734,7 @@ Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelectedRows() throw (Runti
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelectedRows: no control (anymore)!", Sequence< sal_Int32 >() );
sal_Int32 selectionCount = pTable->GetSelectedRowCount();
@@ -749,7 +749,7 @@ sal_Bool SAL_CALL SVTXGridControl::hasSelectedRows() throw (RuntimeException, st
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::hasSelectedRows: no control (anymore)!", sal_True );
return pTable->GetSelectedRowCount() > 0;
@@ -760,7 +760,7 @@ sal_Bool SAL_CALL SVTXGridControl::isRowSelected( ::sal_Int32 index ) throw (Run
{
SolarMutexGuard aGuard;
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN( pTable, "SVTXGridControl::isRowSelected: no control (anymore)!", sal_False );
return pTable->IsRowSelected( index );
@@ -782,7 +782,7 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
Reference< XWindow > xKeepAlive( this );
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ProcessWindowEvent: no control (anymore)!" );
bool handled = false;
@@ -870,7 +870,7 @@ void SVTXGridControl::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno:
void SVTXGridControl::ImplCallItemListeners()
{
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::ImplCallItemListeners: no control (anymore)!" );
if ( m_aSelectionListeners.getLength() )
@@ -891,8 +891,8 @@ void SVTXGridControl::impl_updateColumnsFromModel_nothrow()
{
Reference< XGridColumnModel > const xColumnModel( m_xTableModel->getColumnModel() );
ENSURE_OR_RETURN_VOID( xColumnModel.is(), "no model!" );
- TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
- ENSURE_OR_RETURN_VOID( pTable != NULL, "no table!" );
+ VclPtr< TableControl > pTable = GetAsDynamic< TableControl >();
+ ENSURE_OR_RETURN_VOID( pTable, "no table!" );
try
{
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index f533a19eaead..eae8f131b22c 100644
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -106,7 +106,7 @@ public:
protected:
// VCLXWindow
- virtual void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
+ virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
private:
void impl_updateColumnsFromModel_nothrow();
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index d8bdc68bb902..86ed9a7ccdf4 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -785,7 +785,7 @@ bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox )
if( (m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) )
return m_nToolBoxId;
- ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) );
+ ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
if( (m_nToolBoxId == SAL_MAX_UINT16) && pToolBox )
{
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 00efbd5d4ac2..e1d132694a13 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -86,6 +86,7 @@ class UnoTreeListBoxImpl : public SvTreeListBox
public:
UnoTreeListBoxImpl( TreeControlPeer* pPeer, vcl::Window* pParent, WinBits nWinStyle );
virtual ~UnoTreeListBoxImpl();
+ virtual void dispose() SAL_OVERRIDE;
sal_uInt32 insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,sal_uLong nPos=TREELIST_APPEND );
@@ -206,7 +207,7 @@ UnoTreeListEntry* TreeControlPeer::getEntry( const Reference< XTreeNode >& xNode
vcl::Window* TreeControlPeer::createVclControl( vcl::Window* pParent, sal_Int64 nWinStyle )
{
- mpTreeImpl = new UnoTreeListBoxImpl( this, pParent, nWinStyle );
+ mpTreeImpl = VclPtr<UnoTreeListBoxImpl>::Create( this, pParent, nWinStyle );
return mpTreeImpl;
}
@@ -222,7 +223,7 @@ void TreeControlPeer::disposeControl()
-void TreeControlPeer::SetWindow( vcl::Window* pWindow )
+void TreeControlPeer::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
VCLXWindow::SetWindow( pWindow );
}
@@ -1490,8 +1491,14 @@ UnoTreeListBoxImpl::UnoTreeListBoxImpl( TreeControlPeer* pPeer, vcl::Window* pPa
UnoTreeListBoxImpl::~UnoTreeListBoxImpl()
{
+ disposeOnce();
+}
+
+void UnoTreeListBoxImpl::dispose()
+{
if( mxPeer.is() )
mxPeer->disposeControl();
+ SvTreeListBox::dispose();
}
diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx
index 870a34fcbc7c..d1cb56441348 100644
--- a/svtools/source/uno/treecontrolpeer.hxx
+++ b/svtools/source/uno/treecontrolpeer.hxx
@@ -58,7 +58,7 @@ public:
vcl::Window* createVclControl( vcl::Window* pParent, sal_Int64 nWinStyle );
// VCLXWindow
- virtual void SetWindow( vcl::Window* pWindow ) SAL_OVERRIDE;
+ virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) SAL_OVERRIDE;
// ::com::sun::star::view::XSelectionSupplier
virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -159,7 +159,7 @@ private:
TreeExpansionListenerMultiplexer maTreeExpansionListeners;
TreeEditListenerMultiplexer maTreeEditListeners;
bool mbIsRootDisplayed;
- UnoTreeListBoxImpl* mpTreeImpl;
+ VclPtr<UnoTreeListBoxImpl> mpTreeImpl;
sal_Int32 mnEditLock;
OUString msDefaultCollapsedGraphicURL;
OUString msDefaultExpandedGraphicURL;
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 1bda41b744fc..32746ba9d765 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -68,7 +68,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
{
if ( pParent )
{
- pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB);
+ pWindow = VclPtr<MultiLineEdit>::Create( pParent, nWinBits|WB_IGNORETAB);
static_cast< MultiLineEdit* >( pWindow )->DisableSelectionOnFocus();
*ppNewComp = new VCLXMultiLineEdit;
}
@@ -82,7 +82,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
{
if ( pParent )
{
- pWindow = new FileControl( pParent, nWinBits );
+ pWindow = VclPtr<FileControl>::Create( pParent, nWinBits );
*ppNewComp = new VCLXFileControl;
}
else
@@ -93,22 +93,22 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
}
else if (aServiceName.equalsIgnoreAsciiCase("FormattedField") )
{
- pWindow = new FormattedField( pParent, nWinBits );
+ pWindow = VclPtr<FormattedField>::Create( pParent, nWinBits );
*ppNewComp = new SVTXFormattedField;
}
else if (aServiceName.equalsIgnoreAsciiCase("NumericField") )
{
- pWindow = new DoubleNumericField( pParent, nWinBits );
+ pWindow = VclPtr<DoubleNumericField>::Create( pParent, nWinBits );
*ppNewComp = new SVTXNumericField;
}
else if (aServiceName.equalsIgnoreAsciiCase("LongCurrencyField") )
{
- pWindow = new DoubleCurrencyField( pParent, nWinBits );
+ pWindow = VclPtr<DoubleCurrencyField>::Create( pParent, nWinBits );
*ppNewComp = new SVTXCurrencyField;
}
else if (aServiceName.equalsIgnoreAsciiCase("datefield") )
{
- pWindow = new CalendarField( pParent, nWinBits);
+ pWindow = VclPtr<CalendarField>::Create( pParent, nWinBits);
static_cast<CalendarField*>(pWindow)->EnableToday();
static_cast<CalendarField*>(pWindow)->EnableNone();
static_cast<CalendarField*>(pWindow)->EnableEmptyFieldValue( true );
@@ -125,7 +125,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
{
if ( pParent )
{
- pWindow = new ProgressBar( pParent, nWinBits );
+ pWindow = VclPtr<ProgressBar>::Create( pParent, nWinBits );
*ppNewComp = new VCLXProgressBar;
}
else
@@ -144,7 +144,7 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const ::
{
if ( pParent )
{
- pWindow = new FixedHyperlink( pParent, nWinBits );
+ pWindow = VclPtr<FixedHyperlink>::Create( pParent, nWinBits );
*ppNewComp = new VCLXFixedHyperlink;
}
else
@@ -216,7 +216,7 @@ void VCLXMultiLineEdit::setText( const OUString& aText ) throw(::com::sun::star:
{
SolarMutexGuard aGuard;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
pEdit->SetText( aText );
@@ -233,7 +233,7 @@ void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel
{
SolarMutexGuard aGuard;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
setSelection( rSel );
@@ -246,7 +246,7 @@ OUString VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeExcept
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aText = pEdit->GetText( meLineEndType );
return aText;
@@ -257,7 +257,7 @@ OUString VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::Runti
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit)
aText = pMultiLineEdit->GetSelected( meLineEndType );
return aText;
@@ -268,7 +268,7 @@ void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aS
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
pMultiLineEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
@@ -280,7 +280,7 @@ void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aS
SolarMutexGuard aGuard;
::com::sun::star::awt::Selection aSel;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
aSel.Min = pMultiLineEdit->GetSelection().Min();
@@ -293,7 +293,7 @@ sal_Bool VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeExc
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
return ( pMultiLineEdit && !pMultiLineEdit->IsReadOnly() && pMultiLineEdit->IsEnabled() ) ? sal_True : sal_False;
}
@@ -301,7 +301,7 @@ void VCLXMultiLineEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
pMultiLineEdit->SetReadOnly( !bEditable );
}
@@ -310,7 +310,7 @@ void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
pMultiLineEdit->SetMaxTextLen( nLen );
}
@@ -319,7 +319,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
return pMultiLineEdit ? (sal_Int16)pMultiLineEdit->GetMaxTextLen() : (sal_Int16)0;
}
@@ -328,7 +328,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
OUString aText;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aText = pEdit->GetTextLines( meLineEndType );
return aText;
@@ -339,7 +339,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcMinimumSize());
return aSz;
@@ -355,7 +355,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz = rNewSize;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcAdjustedSize( VCLSize(rNewSize )));
return aSz;
@@ -366,7 +366,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
aSz = AWTSize(pEdit->CalcBlockSize( nCols, nLines ));
return aSz;
@@ -377,7 +377,7 @@ void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines
SolarMutexGuard aGuard;
nCols = nLines = 0;
- MultiLineEdit* pEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >();
if ( pEdit )
{
sal_uInt16 nC, nL;
@@ -413,7 +413,7 @@ void VCLXMultiLineEdit::setProperty( const OUString& PropertyName, const ::com::
{
SolarMutexGuard aGuard;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -470,7 +470,7 @@ void VCLXMultiLineEdit::setProperty( const OUString& PropertyName, const ::com::
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- MultiLineEdit* pMultiLineEdit = static_cast<MultiLineEdit*>(GetWindow());
+ VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >();
if ( pMultiLineEdit )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -543,7 +543,7 @@ VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
VCLXFileControl::~VCLXFileControl()
{
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
pControl->GetEdit().SetModifyHdl( Link() );
}
@@ -568,7 +568,7 @@ void SAL_CALL VCLXFileControl::setProperty( const OUString& PropertyName, const
{
SolarMutexGuard aGuard;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -591,13 +591,13 @@ void SAL_CALL VCLXFileControl::setProperty( const OUString& PropertyName, const
}
}
-void VCLXFileControl::SetWindow( vcl::Window* pWindow )
+void VCLXFileControl::SetWindow( const VclPtr< vcl::Window > &pWindow )
{
- FileControl* pPrevFileControl = dynamic_cast<FileControl*>( GetWindow() );
+ VclPtr< FileControl > pPrevFileControl = GetAsDynamic< FileControl >();
if ( pPrevFileControl )
pPrevFileControl->GetEdit().SetModifyHdl( Link() );
- FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow );
+ FileControl* pNewFileControl = dynamic_cast<FileControl*>( pWindow.get() );
if ( pNewFileControl )
pNewFileControl->GetEdit().SetModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
@@ -633,7 +633,7 @@ void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel,
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
{
pFileControl->GetEdit().SetSelection( Selection( rSel.Min, rSel.Max ) );
@@ -657,7 +657,7 @@ OUString VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::Runtime
SolarMutexGuard aGuard;
OUString aText;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl)
aText = pFileControl->GetEdit().GetSelected();
return aText;
@@ -668,7 +668,7 @@ void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSel
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetSelection( Selection( aSelection.Min, aSelection.Max ) );
}
@@ -678,7 +678,7 @@ void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSel
SolarMutexGuard aGuard;
::com::sun::star::awt::Selection aSel;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
{
aSel.Min = pFileControl->GetEdit().GetSelection().Min();
@@ -691,7 +691,7 @@ sal_Bool VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
return ( pFileControl && !pFileControl->GetEdit().IsReadOnly() && pFileControl->GetEdit().IsEnabled() ) ? sal_True : sal_False;
}
@@ -699,7 +699,7 @@ void VCLXFileControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetReadOnly( !bEditable );
}
@@ -708,7 +708,7 @@ void VCLXFileControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::un
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
if ( pFileControl )
pFileControl->GetEdit().SetMaxTextLen( nLen );
}
@@ -717,7 +717,7 @@ sal_Int16 VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeE
{
SolarMutexGuard aGuard;
- FileControl* pFileControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pFileControl = GetAs< FileControl >();
return pFileControl ? pFileControl->GetEdit().GetMaxTextLen() : 0;
}
@@ -736,7 +736,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
Size aTmpSize = pControl->GetEdit().CalcMinimumSize();
@@ -758,7 +758,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz =rNewSize;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
::com::sun::star::awt::Size aMinSz = getMinimumSize();
@@ -773,7 +773,7 @@ IMPL_LINK_NOARG(VCLXFileControl, ModifyHdl)
SolarMutexGuard aGuard;
::com::sun::star::awt::Size aSz;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
{
aSz = AWTSize(pControl->GetEdit().CalcSize( nCols ));
@@ -788,7 +788,7 @@ void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines )
nCols = 0;
nLines = 1;
- FileControl* pControl = static_cast<FileControl*>(GetWindow());
+ VclPtr< FileControl > pControl = GetAs< FileControl >();
if ( pControl )
nCols = pControl->GetEdit().GetMaxVisChars();
}
@@ -825,11 +825,11 @@ SVTXFormattedField::~SVTXFormattedField()
}
-void SVTXFormattedField::SetWindow( vcl::Window* _pWindow )
+void SVTXFormattedField::SetWindow( const VclPtr< vcl::Window > &_pWindow )
{
VCLXSpinField::SetWindow(_pWindow);
- if (GetFormattedField())
- GetFormattedField()->SetAutoColor(true);
+ if (GetAs< FormattedField >())
+ GetAs< FormattedField >()->SetAutoColor(true);
}
@@ -837,7 +837,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -964,7 +964,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
::com::sun::star::uno::Any aReturn;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1034,7 +1034,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
{
::com::sun::star::uno::Any aReturn;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return aReturn;
@@ -1092,7 +1092,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const ::com:
void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1121,7 +1121,7 @@ void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
::com::sun::star::uno::Any SVTXFormattedField::GetMinValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || !pField->HasMinValue())
return ::com::sun::star::uno::Any();
@@ -1133,7 +1133,7 @@ void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1161,7 +1161,7 @@ void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
::com::sun::star::uno::Any SVTXFormattedField::GetMaxValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || !pField->HasMaxValue())
return ::com::sun::star::uno::Any();
@@ -1173,7 +1173,7 @@ void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1206,7 +1206,7 @@ void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValu
::com::sun::star::uno::Any SVTXFormattedField::GetDefaultValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField || pField->IsEmptyFieldEnabled())
return ::com::sun::star::uno::Any();
@@ -1221,7 +1221,7 @@ void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValu
bool SVTXFormattedField::GetTreatAsNumber()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
return pField->TreatingAsNumber();
@@ -1231,7 +1231,7 @@ bool SVTXFormattedField::GetTreatAsNumber()
void SVTXFormattedField::SetTreatAsNumber(bool bSet)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
pField->TreatAsNumber(bSet);
}
@@ -1239,7 +1239,7 @@ void SVTXFormattedField::SetTreatAsNumber(bool bSet)
::com::sun::star::uno::Any SVTXFormattedField::GetValue()
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return ::com::sun::star::uno::Any();
@@ -1261,7 +1261,7 @@ void SVTXFormattedField::SetTreatAsNumber(bool bSet)
void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (!pField)
return;
@@ -1297,7 +1297,7 @@ void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
SvNumberFormatsSupplierObj* pNew = NULL;
if (!xSupplier.is())
@@ -1339,14 +1339,14 @@ void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Referen
sal_Int32 SVTXFormattedField::getFormatKey() const
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetFormatKey() : 0;
}
void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
{
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if (pField)
{
if (pField->GetFormatter())
@@ -1401,19 +1401,12 @@ void SVTXFormattedField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
// class SVTXRoadmap
-
using namespace svt;
-::svt::ORoadmap* SVTXRoadmap::GetRoadmap() const
-{
- return static_cast<svt::ORoadmap*>(GetWindow());
-}
-
SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this )
{
}
-
SVTXRoadmap::~SVTXRoadmap()
{
}
@@ -1425,7 +1418,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
case VCLEVENT_ROADMAP_ITEMSELECTED:
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_Int16 CurItemID = pField->GetCurrentRoadmapItemID();
@@ -1447,7 +1440,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRoadmapItem;
@@ -1521,7 +1514,7 @@ RMItemData SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::Contai
void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
RMItemData CurItemData = GetRMItemData( _rEvent );
@@ -1534,7 +1527,7 @@ void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerE
void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_Int32 DelIndex = 0;
@@ -1546,7 +1539,7 @@ void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEv
void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
RMItemData CurItemData = GetRMItemData( _rEvent );
@@ -1563,7 +1556,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
{
SolarMutexGuard aGuard;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1620,7 +1613,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
::com::sun::star::uno::Any aReturn;
- ::svt::ORoadmap* pField = GetRoadmap();
+ ::svt::ORoadmap* pField = GetAs< svt::ORoadmap >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -1646,7 +1639,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const ::com::sun::s
void SVTXRoadmap::ImplSetNewImage()
{
OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" );
- ::svt::ORoadmap* pButton = static_cast< ::svt::ORoadmap* >( GetWindow() );
+ VclPtr< ::svt::ORoadmap > pButton = GetAs< ::svt::ORoadmap >();
pButton->SetRoadmapBitmap( GetImage().GetBitmapEx() );
}
@@ -1692,7 +1685,7 @@ void SVTXNumericField::setValue( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetValue( Value );
}
@@ -1701,7 +1694,7 @@ double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1709,7 +1702,7 @@ void SVTXNumericField::setMin( double Value ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMinValue( Value );
}
@@ -1718,7 +1711,7 @@ double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1726,7 +1719,7 @@ void SVTXNumericField::setMax( double Value ) throw(::com::sun::star::uno::Runti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMaxValue( Value );
}
@@ -1735,7 +1728,7 @@ double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException,
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1743,7 +1736,7 @@ void SVTXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinFirst( Value );
}
@@ -1752,7 +1745,7 @@ double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1760,7 +1753,7 @@ void SVTXNumericField::setLast( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinLast( Value );
}
@@ -1769,7 +1762,7 @@ double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1777,7 +1770,7 @@ void SVTXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinSize( Value );
}
@@ -1786,7 +1779,7 @@ double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeExcep
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1794,7 +1787,7 @@ void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::sta
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetDecimalDigits( Value );
}
@@ -1803,7 +1796,7 @@ sal_Int16 SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetDecimalDigits() : 0;
}
@@ -1811,7 +1804,7 @@ void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::sta
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetStrictFormat( bStrict );
}
@@ -1820,7 +1813,7 @@ sal_Bool SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::Runtime
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->IsStrictFormat() : sal_False;
}
@@ -1858,7 +1851,7 @@ void SVTXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetValue( Value );
}
@@ -1867,7 +1860,7 @@ double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetValue() : 0;
}
@@ -1875,7 +1868,7 @@ void SVTXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMinValue( Value );
}
@@ -1884,7 +1877,7 @@ double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMinValue() : 0;
}
@@ -1892,7 +1885,7 @@ void SVTXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::Runt
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetMaxValue( Value );
}
@@ -1901,7 +1894,7 @@ double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetMaxValue() : 0;
}
@@ -1909,7 +1902,7 @@ void SVTXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::Ru
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinFirst( Value );
}
@@ -1918,7 +1911,7 @@ double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinFirst() : 0;
}
@@ -1926,7 +1919,7 @@ void SVTXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinLast( Value );
}
@@ -1935,7 +1928,7 @@ double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinLast() : 0;
}
@@ -1943,7 +1936,7 @@ void SVTXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno:
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetSpinSize( Value );
}
@@ -1952,7 +1945,7 @@ double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeExce
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetSpinSize() : 0;
}
@@ -1960,7 +1953,7 @@ void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::st
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetDecimalDigits( Value );
}
@@ -1969,7 +1962,7 @@ sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::Run
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->GetDecimalDigits() : 0;
}
@@ -1977,7 +1970,7 @@ void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::st
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
if ( pField )
pField->SetStrictFormat( bStrict );
}
@@ -1986,7 +1979,7 @@ sal_Bool SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::Runtim
{
SolarMutexGuard aGuard;
- FormattedField* pField = GetFormattedField();
+ FormattedField* pField = GetAs< FormattedField >();
return pField ? pField->IsStrictFormat() : sal_False;
}
@@ -1994,7 +1987,7 @@ void SVTXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
{
SolarMutexGuard aGuard;
- DoubleCurrencyField* pField = static_cast<DoubleCurrencyField*>(GetFormattedField());
+ VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2029,7 +2022,7 @@ void SVTXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
::com::sun::star::uno::Any aReturn;
- DoubleCurrencyField* pField = static_cast<DoubleCurrencyField*>(GetFormattedField());
+ VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
if ( pField )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2079,7 +2072,7 @@ VCLXProgressBar::~VCLXProgressBar()
void VCLXProgressBar::ImplUpdateValue()
{
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_Int32 nVal;
@@ -2210,7 +2203,7 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const ::com::su
{
SolarMutexGuard aGuard;
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2269,7 +2262,7 @@ void VCLXProgressBar::setProperty( const OUString& PropertyName, const ::com::su
SolarMutexGuard aGuard;
::com::sun::star::uno::Any aProp;
- ProgressBar* pProgressBar = static_cast<ProgressBar*>(GetWindow());
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
if ( pProgressBar )
{
sal_uInt16 nPropType = GetPropertyId( PropertyName );
@@ -2327,7 +2320,7 @@ void SAL_CALL SVTXDateField::setProperty( const OUString& PropertyName, const ::
VCLXDateField::setProperty( PropertyName, Value );
// some properties need to be forwarded to the sub edit, too
- Edit* pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow() )->GetSubEdit() : NULL;
+ VclPtr< Edit > pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow().get() )->GetSubEdit() : NULL;
if ( !pSubEdit )
return;
diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx
index b0998a583420..3980085246df 100644
--- a/svtools/source/uno/wizard/unowizard.cxx
+++ b/svtools/source/uno/wizard/unowizard.cxx
@@ -136,7 +136,7 @@ namespace {
virtual ~Wizard();
protected:
- virtual Dialog* createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
+ virtual VclPtr<Dialog> createDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
virtual void destroyDialog() SAL_OVERRIDE;
private:
@@ -268,12 +268,12 @@ namespace {
}
- Dialog* Wizard::createDialog( vcl::Window* i_pParent )
+ VclPtr<Dialog> Wizard::createDialog( vcl::Window* i_pParent )
{
- WizardShell* pDialog( new WizardShell( i_pParent, m_xController, m_aWizardSteps ) );
+ VclPtrInstance<WizardShell> pDialog( i_pParent, m_xController, m_aWizardSteps );
pDialog->SetHelpId( lcl_getHelpId( m_sHelpURL ) );
pDialog->setTitleBase( m_sTitle );
- return pDialog;
+ return pDialog.get();
}
@@ -359,7 +359,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" );
pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable );
@@ -371,7 +371,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" );
pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) );
@@ -383,7 +383,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" );
return pWizardImpl->travelNext();
@@ -395,7 +395,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" );
return pWizardImpl->travelPrevious();
@@ -407,7 +407,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" );
if ( !pWizardImpl->knowsPage( i_PageID ) )
@@ -425,7 +425,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" );
pWizardImpl->updateTravelUI();
@@ -437,7 +437,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" );
return pWizardImpl->advanceTo( i_PageId );
@@ -449,7 +449,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" );
return pWizardImpl->goBackTo( i_PageId );
@@ -461,7 +461,7 @@ namespace {
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() );
return pWizardImpl->getCurrentWizardPage();
@@ -476,7 +476,7 @@ namespace {
if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) )
throw NoSuchElementException( OUString(), *this );
- WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog );
+ WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog.get() );
ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" );
pWizardImpl->activatePath( i_PathIndex, i_Final );
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
index d10db321ee60..b3504d9d5f55 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -90,11 +90,6 @@ namespace svt { namespace uno
}
- WizardShell::~WizardShell()
- {
- }
-
-
short WizardShell::Execute()
{
ActivatePage();
@@ -187,17 +182,17 @@ namespace svt { namespace uno
}
- TabPage* WizardShell::createPage( WizardState i_nState )
+ VclPtr<TabPage> WizardShell::createPage( WizardState i_nState )
{
ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", NULL );
::boost::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) );
- TabPage* pPage = pController->getTabPage();
- OSL_ENSURE( pPage != NULL, "WizardShell::createPage: illegal tab page!" );
- if ( pPage == NULL )
+ VclPtr<TabPage> pPage = pController->getTabPage();
+ OSL_ENSURE( pPage, "WizardShell::createPage: illegal tab page!" );
+ if ( !pPage )
{
// fallback for ill-behaved clients: empty page
- pPage = new TabPage( this, 0 );
+ pPage = VclPtr<TabPage>::Create( this, 0 );
pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MAP_APPFONT ) );
}
@@ -205,7 +200,6 @@ namespace svt { namespace uno
return pPage;
}
-
IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const
{
return impl_getController( i_pCurrentPage ).get();
diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
index 4d2e3e8f0315..68650dd067cf 100644
--- a/svtools/source/uno/wizard/wizardshell.hxx
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -48,13 +48,12 @@ namespace svt { namespace uno
const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths
);
- virtual ~WizardShell();
// Dialog overridables
virtual short Execute() SAL_OVERRIDE;
// OWizardMachine overridables
- virtual TabPage* createPage( WizardState i_nState ) SAL_OVERRIDE;
+ virtual VclPtr<TabPage> createPage( WizardState i_nState ) SAL_OVERRIDE;
virtual void enterState( WizardState i_nState ) SAL_OVERRIDE;
virtual bool leaveState( WizardState i_nState ) SAL_OVERRIDE;
virtual OUString getStateDisplayName( WizardState i_nState ) const SAL_OVERRIDE;
@@ -118,7 +117,7 @@ namespace svt { namespace uno
using WizardShell_Base::activatePath;
private:
- typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap;
+ typedef ::std::map< VclPtr<TabPage>, PWizardPageController > Page2ControllerMap;
const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
const sal_Int16 m_nFirstPageID;