summaryrefslogtreecommitdiff
path: root/svtools/source/control
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/control')
-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
18 files changed, 374 insertions, 298 deletions
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()
{
}