summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/ilstbox.hxx105
-rw-r--r--vcl/inc/printdlg.hxx6
-rw-r--r--vcl/source/app/dbggui.cxx145
-rw-r--r--vcl/source/control/combobox.cxx46
-rw-r--r--vcl/source/control/ilstbox.cxx82
-rw-r--r--vcl/source/control/lstbox.cxx60
-rw-r--r--vcl/source/window/menubarwindow.cxx115
-rw-r--r--vcl/source/window/menubarwindow.hxx24
-rw-r--r--vcl/source/window/printdlg.cxx31
-rw-r--r--vcl/source/window/window.cxx15
-rw-r--r--vcl/unx/generic/app/i18n_status.cxx62
-rw-r--r--vcl/workben/svpclient.cxx70
12 files changed, 420 insertions, 341 deletions
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 2fec0559096c..82d33c00fe45 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -377,13 +377,15 @@ protected:
virtual void SelectEntry( ::vcl::StringEntryIdentifier _entry ) SAL_OVERRIDE;
};
+typedef rtl::Reference<ImplListBoxWindow> ImplListBoxWindowPtr;
+
class ImplListBox : public Control
{
private:
- ImplListBoxWindow maLBWindow;
- ScrollBar* mpHScrollBar;
- ScrollBar* mpVScrollBar;
- ScrollBarBox* mpScrollBarBox;
+ ImplListBoxWindowPtr maLBWindow;
+ ScrollBar* mpHScrollBar;
+ ScrollBar* mpVScrollBar;
+ ScrollBarBox* mpScrollBarBox;
/// bitfield
bool mbVScroll : 1; // VScroll an oder aus
@@ -400,6 +402,7 @@ protected:
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
void ImplResizeControls();
void ImplCheckScrollBars();
@@ -413,8 +416,8 @@ public:
ImplListBox( vcl::Window* pParent, WinBits nWinStyle );
virtual ~ImplListBox();
- const ImplEntryList* GetEntryList() const { return maLBWindow.GetEntryList(); }
- ImplListBoxWindow& GetMainWindow() { return maLBWindow; }
+ const ImplEntryList* GetEntryList() const { return maLBWindow->GetEntryList(); }
+ ImplListBoxWindowPtr GetMainWindow() { return maLBWindow; }
virtual void Resize() SAL_OVERRIDE;
virtual const Wallpaper& GetDisplayBackground() const SAL_OVERRIDE;
@@ -423,84 +426,84 @@ public:
sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr );
sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage );
void RemoveEntry( sal_Int32 nPos );
- void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow.GetEntryList()->SetEntryData( nPos, pNewData ); }
+ void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow->GetEntryList()->SetEntryData( nPos, pNewData ); }
void Clear();
void SetEntryFlags( sal_Int32 nPos, long nFlags );
void SelectEntry( sal_Int32 nPos, bool bSelect );
void SetNoSelection();
- void ResetCurrentPos() { maLBWindow.ResetCurrentPos(); }
- sal_Int32 GetCurrentPos() const { return maLBWindow.GetCurrentPos(); }
+ void ResetCurrentPos() { maLBWindow->ResetCurrentPos(); }
+ sal_Int32 GetCurrentPos() const { return maLBWindow->GetCurrentPos(); }
- bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow.ProcessKeyInput( rKEvt ); }
+ bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow->ProcessKeyInput( rKEvt ); }
bool HandleWheelAsCursorTravel( const CommandEvent& rCEvt );
- void SetSeparatorPos( sal_Int32 n ) { maLBWindow.SetSeparatorPos( n ); }
- sal_Int32 GetSeparatorPos() const { return maLBWindow.GetSeparatorPos(); }
+ void SetSeparatorPos( sal_Int32 n ) { maLBWindow->SetSeparatorPos( n ); }
+ sal_Int32 GetSeparatorPos() const { return maLBWindow->GetSeparatorPos(); }
- void SetTopEntry( sal_Int32 nTop ) { maLBWindow.SetTopEntry( nTop ); }
- sal_Int32 GetTopEntry() const { return maLBWindow.GetTopEntry(); }
- void ShowProminentEntry( sal_Int32 nPos ) { maLBWindow.ShowProminentEntry( nPos ); }
+ void SetTopEntry( sal_Int32 nTop ) { maLBWindow->SetTopEntry( nTop ); }
+ sal_Int32 GetTopEntry() const { return maLBWindow->GetTopEntry(); }
+ void ShowProminentEntry( sal_Int32 nPos ) { maLBWindow->ShowProminentEntry( nPos ); }
using Window::IsVisible;
- bool IsVisible( sal_Int32 nEntry ) const { return maLBWindow.IsVisible( nEntry ); }
+ bool IsVisible( sal_Int32 nEntry ) const { return maLBWindow->IsVisible( nEntry ); }
- void SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); }
- ProminentEntry GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); }
+ void SetProminentEntryType( ProminentEntry eType ) { maLBWindow->SetProminentEntryType( eType ); }
+ ProminentEntry GetProminentEntryType() const { return maLBWindow->GetProminentEntryType(); }
- long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); }
- void SetLeftIndent( sal_uInt16 n ) { maLBWindow.SetLeftIndent( n ); }
- void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); }
+ long GetLeftIndent() const { return maLBWindow->GetLeftIndent(); }
+ void SetLeftIndent( sal_uInt16 n ) { maLBWindow->SetLeftIndent( n ); }
+ void ScrollHorz( short nDiff ) { maLBWindow->ScrollHorz( nDiff ); }
- void SetTravelSelect( bool bTravelSelect ) { maLBWindow.SetTravelSelect( bTravelSelect ); }
- bool IsTravelSelect() const { return maLBWindow.IsTravelSelect(); }
- bool IsTrackingSelect() const { return maLBWindow.IsTrackingSelect(); }
+ void SetTravelSelect( bool bTravelSelect ) { maLBWindow->SetTravelSelect( bTravelSelect ); }
+ bool IsTravelSelect() const { return maLBWindow->IsTravelSelect(); }
+ bool IsTrackingSelect() const { return maLBWindow->IsTrackingSelect(); }
- void EnableMultiSelection( bool bMulti, bool bStackMode ) { maLBWindow.EnableMultiSelection( bMulti, bStackMode ); }
- bool IsMultiSelectionEnabled() const { return maLBWindow.IsMultiSelectionEnabled(); }
+ void EnableMultiSelection( bool bMulti, bool bStackMode ) { maLBWindow->EnableMultiSelection( bMulti, bStackMode ); }
+ bool IsMultiSelectionEnabled() const { return maLBWindow->IsMultiSelectionEnabled(); }
- void SetMultiSelectionSimpleMode( bool bSimple ) { maLBWindow.SetMultiSelectionSimpleMode( bSimple ); }
- bool IsMultiSelectionSimpleMode() const { return maLBWindow.IsMultiSelectionSimpleMode(); }
+ void SetMultiSelectionSimpleMode( bool bSimple ) { maLBWindow->SetMultiSelectionSimpleMode( bSimple ); }
+ bool IsMultiSelectionSimpleMode() const { return maLBWindow->IsMultiSelectionSimpleMode(); }
- void SetReadOnly( bool b ) { maLBWindow.SetReadOnly( b ); }
- bool IsReadOnly() const { return maLBWindow.IsReadOnly(); }
+ void SetReadOnly( bool b ) { maLBWindow->SetReadOnly( b ); }
+ bool IsReadOnly() const { return maLBWindow->IsReadOnly(); }
- Size CalcSize( sal_Int32 nMaxLines ) const { return maLBWindow.CalcSize( nMaxLines ); }
- long GetEntryHeight() const { return maLBWindow.GetEntryHeight(); }
- long GetMaxEntryWidth() const { return maLBWindow.GetMaxEntryWidth(); }
+ Size CalcSize( sal_Int32 nMaxLines ) const { return maLBWindow->CalcSize( nMaxLines ); }
+ long GetEntryHeight() const { return maLBWindow->GetEntryHeight(); }
+ long GetMaxEntryWidth() const { return maLBWindow->GetMaxEntryWidth(); }
void SetScrollHdl( const Link& rLink ) { maScrollHdl = rLink; }
const Link& GetScrollHdl() const { return maScrollHdl; }
- void SetSelectHdl( const Link& rLink ) { maLBWindow.SetSelectHdl( rLink ); }
- const Link& GetSelectHdl() const { return maLBWindow.GetSelectHdl(); }
- void SetCancelHdl( const Link& rLink ) { maLBWindow.SetCancelHdl( rLink ); }
- const Link& GetCancelHdl() const { return maLBWindow.GetCancelHdl(); }
- void SetDoubleClickHdl( const Link& rLink ) { maLBWindow.SetDoubleClickHdl( rLink ); }
- const Link& GetDoubleClickHdl() const { return maLBWindow.GetDoubleClickHdl(); }
+ void SetSelectHdl( const Link& rLink ) { maLBWindow->SetSelectHdl( rLink ); }
+ const Link& GetSelectHdl() const { return maLBWindow->GetSelectHdl(); }
+ void SetCancelHdl( const Link& rLink ) { maLBWindow->SetCancelHdl( rLink ); }
+ const Link& GetCancelHdl() const { return maLBWindow->GetCancelHdl(); }
+ void SetDoubleClickHdl( const Link& rLink ) { maLBWindow->SetDoubleClickHdl( rLink ); }
+ const Link& GetDoubleClickHdl() const { return maLBWindow->GetDoubleClickHdl(); }
boost::signals2::signal< void ( UserDrawEvent* ) > userDrawSignal;
- void SetFocusHdl( const Link& rLink ) { maLBWindow.SetFocusHdl( rLink ); }
- const Link& GetFocusHdl() const { return maLBWindow.GetFocusHdl(); }
- void SetListItemSelectHdl( const Link& rLink ) { maLBWindow.SetListItemSelectHdl( rLink ); }
- const Link& GetListItemSelectHdl() const { return maLBWindow.GetListItemSelectHdl(); }
- void SetSelectionChangedHdl( const Link& rLnk ) { maLBWindow.GetEntryList()->SetSelectionChangedHdl( rLnk ); }
- void SetCallSelectionChangedHdl( bool bCall ) { maLBWindow.GetEntryList()->SetCallSelectionChangedHdl( bCall ); }
- bool IsSelectionChanged() const { return maLBWindow.IsSelectionChanged(); }
- sal_uInt16 GetSelectModifier() const { return maLBWindow.GetSelectModifier(); }
+ void SetFocusHdl( const Link& rLink ) { maLBWindow->SetFocusHdl( rLink ); }
+ const Link& GetFocusHdl() const { return maLBWindow->GetFocusHdl(); }
+ void SetListItemSelectHdl( const Link& rLink ) { maLBWindow->SetListItemSelectHdl( rLink ); }
+ const Link& GetListItemSelectHdl() const { return maLBWindow->GetListItemSelectHdl(); }
+ void SetSelectionChangedHdl( const Link& rLnk ) { maLBWindow->GetEntryList()->SetSelectionChangedHdl( rLnk ); }
+ void SetCallSelectionChangedHdl( bool bCall ) { maLBWindow->GetEntryList()->SetCallSelectionChangedHdl( bCall ); }
+ bool IsSelectionChanged() const { return maLBWindow->IsSelectionChanged(); }
+ sal_uInt16 GetSelectModifier() const { return maLBWindow->GetSelectModifier(); }
void SetMRUEntries( const OUString& rEntries, sal_Unicode cSep );
OUString GetMRUEntries( sal_Unicode cSep ) const;
- void SetMaxMRUCount( sal_Int32 n ) { maLBWindow.GetEntryList()->SetMaxMRUCount( n ); }
- sal_Int32 GetMaxMRUCount() const { return maLBWindow.GetEntryList()->GetMaxMRUCount(); }
+ void SetMaxMRUCount( sal_Int32 n ) { maLBWindow->GetEntryList()->SetMaxMRUCount( n ); }
+ sal_Int32 GetMaxMRUCount() const { return maLBWindow->GetEntryList()->GetMaxMRUCount(); }
sal_uInt16 GetDisplayLineCount() const
- { return maLBWindow.GetDisplayLineCount(); }
+ { return maLBWindow->GetDisplayLineCount(); }
bool GetEdgeBlending() const { return mbEdgeBlending; }
void SetEdgeBlending(bool bNew);
/// pb: #106948# explicit mirroring for calc
- inline void EnableMirroring() { maLBWindow.EnableMirroring(); }
+ inline void EnableMirroring() { maLBWindow->EnableMirroring(); }
inline void SetDropTraget(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_xDNDListenerContainer){ mxDNDListenerContainer= i_xDNDListenerContainer; }
};
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index fef1da807543..52b1cbf5f0f2 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -56,8 +56,8 @@ namespace vcl
OUString maReplacementString;
OUString maToolTipString;
bool mbGreyscale;
- FixedLine maHorzDim;
- FixedLine maVertDim;
+ FixedLinePtr maHorzDim;
+ FixedLinePtr maVertDim;
void preparePreviewBitmap();
@@ -76,6 +76,8 @@ namespace vcl
sal_Int32 i_nDPIX, sal_Int32 i_nDPIY,
bool i_bGreyscale
);
+ private:
+ virtual void dispose() SAL_OVERRIDE;
};
class ShowNupOrderWindow : public vcl::Window
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index 1c643f241176..65c0dc822682 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -207,98 +207,102 @@ NULL
class DbgInfoDialog : public ModalDialog
{
private:
- ListBox maListBox;
- OKButton maOKButton;
+ ListBoxPtr maListBox;
+ OKButtonPtr maOKButton;
bool mbHelpText;
public:
DbgInfoDialog( vcl::Window* pParent, bool bHelpText = false );
void SetInfoText( const OUString& rStr );
+private:
+ virtual void dispose() SAL_OVERRIDE;
};
class DbgDialog : public ModalDialog
{
private:
- CheckBox maRes;
- CheckBox maDialog;
- CheckBox maBoldAppFont;
- GroupBox maBox3;
+ CheckBoxPtr maRes;
+ CheckBoxPtr maDialog;
+ CheckBoxPtr maBoldAppFont;
+ GroupBoxPtr maBox3;
- OKButton maOKButton;
- CancelButton maCancelButton;
- HelpButton maHelpButton;
+ OKButtonPtr maOKButton;
+ CancelButtonPtr maCancelButton;
+ HelpButtonPtr maHelpButton;
public:
DbgDialog();
DECL_LINK( ClickHdl, Button* );
void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
+private:
+ virtual void dispose() SAL_OVERRIDE;
};
DbgDialog::DbgDialog() :
ModalDialog( NULL, WB_STDMODAL | WB_SYSTEMWINDOW ),
- maRes( this ),
- maDialog( this ),
- maBoldAppFont( this ),
- maBox3( this ),
- maOKButton( this, WB_DEFBUTTON ),
- maCancelButton( this ),
- maHelpButton( this )
+ maRes(new CheckBox(this)),
+ maDialog(new CheckBox(this)),
+ maBoldAppFont(new CheckBox(this)),
+ maBox3(new GroupBox(this)),
+ maOKButton(new OKButton(this, WB_DEFBUTTON)),
+ maCancelButton(new CancelButton(this)),
+ maHelpButton(new HelpButton(this))
{
DbgData* pData = DbgGetData();
MapMode aAppMap( MAP_APPFONT );
Size aButtonSize = LogicToPixel( Size( 60, 12 ), aAppMap );
{
- maRes.Show();
- maRes.SetText("~Resourcen");
+ maRes->Show();
+ maRes->SetText("~Resourcen");
if ( pData->nTestFlags & DBG_TEST_RESOURCE )
- maRes.Check( true );
- maRes.SetPosSizePixel( LogicToPixel( Point( 75, 95 ), aAppMap ),
+ maRes->Check( true );
+ maRes->SetPosSizePixel( LogicToPixel( Point( 75, 95 ), aAppMap ),
aButtonSize );
}
{
- maDialog.Show();
- maDialog.SetText("~Dialog");
+ maDialog->Show();
+ maDialog->SetText("~Dialog");
if ( pData->nTestFlags & DBG_TEST_DIALOG )
- maDialog.Check( true );
- maDialog.SetPosSizePixel( LogicToPixel( Point( 140, 95 ), aAppMap ),
+ maDialog->Check( true );
+ maDialog->SetPosSizePixel( LogicToPixel( Point( 140, 95 ), aAppMap ),
aButtonSize );
}
{
- maBoldAppFont.Show();
- maBoldAppFont.SetText("~Bold AppFont");
+ maBoldAppFont->Show();
+ maBoldAppFont->SetText("~Bold AppFont");
if ( pData->nTestFlags & DBG_TEST_BOLDAPPFONT )
- maBoldAppFont.Check( true );
- maBoldAppFont.SetPosSizePixel( LogicToPixel( Point( 205, 95 ), aAppMap ),
+ maBoldAppFont->Check( true );
+ maBoldAppFont->SetPosSizePixel( LogicToPixel( Point( 205, 95 ), aAppMap ),
aButtonSize );
- maBoldAppFont.SaveValue();
+ maBoldAppFont->SaveValue();
}
{
- maBox3.Show();
- maBox3.SetText("Test Options");
- maBox3.SetPosSizePixel( LogicToPixel( Point( 5, 85 ), aAppMap ),
+ maBox3->Show();
+ maBox3->SetText("Test Options");
+ maBox3->SetPosSizePixel( LogicToPixel( Point( 5, 85 ), aAppMap ),
LogicToPixel( Size( 330, 30 ), aAppMap ) );
}
{
- maOKButton.Show();
- maOKButton.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
- maOKButton.SetPosSizePixel( LogicToPixel( Point( 10, 260 ), aAppMap ),
+ maOKButton->Show();
+ maOKButton->SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
+ maOKButton->SetPosSizePixel( LogicToPixel( Point( 10, 260 ), aAppMap ),
LogicToPixel( Size( 50, 15 ), aAppMap ) );
}
{
- maCancelButton.Show();
- maCancelButton.SetPosSizePixel( LogicToPixel( Point( 70, 260 ), aAppMap ),
+ maCancelButton->Show();
+ maCancelButton->SetPosSizePixel( LogicToPixel( Point( 70, 260 ), aAppMap ),
LogicToPixel( Size( 50, 15 ), aAppMap ) );
}
{
- maHelpButton.Show();
- maHelpButton.SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap ),
+ maHelpButton->Show();
+ maHelpButton->SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap ),
LogicToPixel( Size( 50, 15 ), aAppMap ) );
}
@@ -310,20 +314,20 @@ DbgDialog::DbgDialog() :
IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
{
- if ( pButton == &maOKButton )
+ if ( pButton == maOKButton.get() )
{
DbgData aData;
memcpy( &aData, DbgGetData(), sizeof( DbgData ) );
aData.nTestFlags = 0;
- if ( maRes.IsChecked() )
+ if ( maRes->IsChecked() )
aData.nTestFlags |= DBG_TEST_RESOURCE;
- if ( maDialog.IsChecked() )
+ if ( maDialog->IsChecked() )
aData.nTestFlags |= DBG_TEST_DIALOG;
- if ( maBoldAppFont.IsChecked() )
+ if ( maBoldAppFont->IsChecked() )
aData.nTestFlags |= DBG_TEST_BOLDAPPFONT;
// Daten speichern
@@ -333,12 +337,12 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
#define IMMEDIATE_FLAGS (DBG_TEST_RESOURCE | DBG_TEST_DIALOG | DBG_TEST_BOLDAPPFONT)
pData->nTestFlags &= ~IMMEDIATE_FLAGS;
pData->nTestFlags |= aData.nTestFlags & IMMEDIATE_FLAGS;
- if ( maBoldAppFont.IsValueChangedFromSaved() )
+ if ( maBoldAppFont->IsValueChangedFromSaved() )
{
AllSettings aSettings = Application::GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
vcl::Font aFont = aStyleSettings.GetAppFont();
- if ( maBoldAppFont.IsChecked() )
+ if ( maBoldAppFont->IsChecked() )
aFont.SetWeight( WEIGHT_BOLD );
else
aFont.SetWeight( WEIGHT_NORMAL );
@@ -377,10 +381,22 @@ void DbgDialog::RequestHelp( const HelpEvent& rHEvt )
}
}
+void DbgDialog::dispose()
+{
+ maRes.disposeAndClear();
+ maDialog.disposeAndClear();
+ maBoldAppFont.disposeAndClear();
+ maBox3.disposeAndClear();
+ maOKButton.disposeAndClear();
+ maCancelButton.disposeAndClear();
+ maHelpButton.disposeAndClear();
+ ModalDialog::dispose();
+}
+
DbgInfoDialog::DbgInfoDialog( vcl::Window* pParent, bool bHelpText ) :
ModalDialog( pParent, WB_STDMODAL ),
- maListBox( this, WB_BORDER | WB_AUTOHSCROLL ),
- maOKButton( this, WB_DEFBUTTON )
+ maListBox(new ListBox( this, WB_BORDER | WB_AUTOHSCROLL )),
+ maOKButton(new OKButton(this, WB_DEFBUTTON))
{
mbHelpText = bHelpText;
@@ -389,21 +405,21 @@ DbgInfoDialog::DbgInfoDialog( vcl::Window* pParent, bool bHelpText ) :
vcl::Font aFont = GetDefaultFont( DEFAULTFONT_FIXED, LANGUAGE_ENGLISH_US, 0 );
aFont.SetHeight( 8 );
aFont.SetPitch( PITCH_FIXED );
- maListBox.SetControlFont( aFont );
+ maListBox->SetControlFont( aFont );
}
- maListBox.SetPosSizePixel( Point( 5, 5 ), Size( 630, 380 ) );
- maListBox.Show();
+ maListBox->SetPosSizePixel( Point( 5, 5 ), Size( 630, 380 ) );
+ maListBox->Show();
- maOKButton.SetPosSizePixel( Point( 290, 390 ), Size( 60, 25 ) );
- maOKButton.Show();
+ maOKButton->SetPosSizePixel( Point( 290, 390 ), Size( 60, 25 ) );
+ maOKButton->Show();
SetOutputSizePixel( Size( 640, 420 ) );
}
void DbgInfoDialog::SetInfoText( const OUString& rStr )
{
- maListBox.SetUpdateMode( false );
- maListBox.Clear();
+ maListBox->SetUpdateMode( false );
+ maListBox->Clear();
OUString aStr = convertLineEnd(rStr, LINEEND_LF);
sal_Int32 nStrIndex = 0;
sal_Int32 nFoundIndex;
@@ -413,18 +429,18 @@ void DbgInfoDialog::SetInfoText( const OUString& rStr )
OUString aTextParagraph = aStr.copy( nStrIndex, nFoundIndex-nStrIndex );
if ( mbHelpText )
{
- long nMaxWidth = maListBox.GetOutputSizePixel().Width()-30;
+ long nMaxWidth = maListBox->GetOutputSizePixel().Width()-30;
sal_Int32 nLastIndex = 0;
sal_Int32 nIndex = aTextParagraph.indexOf( ' ' );
while ( nIndex != -1 )
{
- if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
+ if ( maListBox->GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
{
if ( !nLastIndex )
nLastIndex = nIndex+1;
OUString aTempStr = aTextParagraph.copy( 0, nLastIndex );
aTextParagraph = aTextParagraph.replaceAt( 0, nLastIndex, "" );
- maListBox.InsertEntry( aTempStr );
+ maListBox->InsertEntry( aTempStr );
nLastIndex = 0;
}
else
@@ -432,20 +448,27 @@ void DbgInfoDialog::SetInfoText( const OUString& rStr )
nIndex = aTextParagraph.indexOf( ' ', nLastIndex );
}
- if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
+ if ( maListBox->GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
{
if ( !nLastIndex )
nLastIndex = nIndex+1;
OUString aTempStr = aTextParagraph.copy( 0, nLastIndex );
aTextParagraph = aTextParagraph.replaceAt( 0, nLastIndex, "" );
- maListBox.InsertEntry( aTempStr );
+ maListBox->InsertEntry( aTempStr );
}
}
- maListBox.InsertEntry( aTextParagraph );
+ maListBox->InsertEntry( aTextParagraph );
nStrIndex = nFoundIndex+1;
}
while ( nFoundIndex != -1 );
- maListBox.SetUpdateMode( true );
+ maListBox->SetUpdateMode( true );
+}
+
+void DbgInfoDialog::dispose()
+{
+ maListBox.disposeAndClear();
+ maOKButton.disposeAndClear();
+ ModalDialog::dispose();
}
void DbgDialogTest( vcl::Window* pWindow )
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 16d1cccb7f5e..8a2e3c294eb1 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -188,7 +188,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
if ( mpFloatWin )
mpFloatWin->SetImplListBox( mpImplLB );
else
- mpImplLB->GetMainWindow().AllowGrabFocus( true );
+ mpImplLB->GetMainWindow()->AllowGrabFocus( true );
ImplCalcEditHeight();
@@ -253,7 +253,7 @@ void ComboBox::ImplClickButtonHandler( ImplBtn* )
ImplClearLayoutData();
if( mpImplLB )
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
}
IMPL_LINK_NOARG(ComboBox, ImplPopupModeEndHdl)
@@ -272,7 +272,7 @@ IMPL_LINK_NOARG(ComboBox, ImplPopupModeEndHdl)
ImplClearLayoutData();
if( mpImplLB )
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
mpBtn->SetPressed( false );
CallEventListeners( VCLEVENT_DROPDOWN_CLOSE );
@@ -581,20 +581,20 @@ void ComboBox::FillLayoutData() const
mpControlData->mpLayoutData = new vcl::ControlLayoutData();
AppendLayoutData( *mpSubEdit );
mpSubEdit->SetLayoutDataParent( this );
- Control& rMainWindow = mpImplLB->GetMainWindow();
+ ImplListBoxWindowPtr rMainWindow = mpImplLB->GetMainWindow();
if( mpFloatWin )
{
// dropdown mode
if( mpFloatWin->IsReallyVisible() )
{
- AppendLayoutData( rMainWindow );
- rMainWindow.SetLayoutDataParent( this );
+ AppendLayoutData( *(rMainWindow.get()) );
+ rMainWindow->SetLayoutDataParent( this );
}
}
else
{
- AppendLayoutData( rMainWindow );
- rMainWindow.SetLayoutDataParent( this );
+ AppendLayoutData( *(rMainWindow.get()) );
+ rMainWindow->SetLayoutDataParent( this );
}
}
@@ -647,7 +647,7 @@ void ComboBox::StateChanged( StateChangedType nType )
else if ( nType == StateChangedType::STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
- mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) ? true : false );
+ mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? true : false );
}
else if( nType == StateChangedType::MIRRORING )
{
@@ -765,7 +765,7 @@ bool ComboBox::Notify( NotifyEvent& rNEvt )
nDone = false; // don't eat this event, let the default handling happen (i.e. scroll the context)
}
}
- else if( ( rNEvt.GetType() == MouseNotifyEvent::MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == &mpImplLB->GetMainWindow() ) )
+ else if( ( rNEvt.GetType() == MouseNotifyEvent::MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == mpImplLB->GetMainWindow().get() ) )
{
mpSubEdit->GrabFocus();
}
@@ -1106,7 +1106,7 @@ void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines
long nCharWidth = GetTextWidth(OUString(static_cast<sal_Unicode>('x')));
if ( !IsDropDownBox() )
{
- Size aOutSz = mpImplLB->GetMainWindow().GetOutputSizePixel();
+ Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel();
rnCols = (nCharWidth > 0) ? (sal_uInt16)(aOutSz.Width()/nCharWidth) : 1;
rnLines = (sal_uInt16)(aOutSz.Height()/mpImplLB->GetEntryHeight());
}
@@ -1120,11 +1120,11 @@ void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines
void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
{
- mpImplLB->GetMainWindow().ImplInitSettings( true, true, true );
+ mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true );
Point aPos = pDev->LogicToPixel( rPos );
Size aSize = pDev->LogicToPixel( rSize );
- vcl::Font aFont = mpImplLB->GetMainWindow().GetDrawPixelFont( pDev );
+ vcl::Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
OutDevType eOutDevType = pDev->GetOutDevType();
pDev->Push();
@@ -1233,18 +1233,18 @@ void ComboBox::UserDraw( const UserDrawEvent& )
void ComboBox::SetUserItemSize( const Size& rSz )
{
- mpImplLB->GetMainWindow().SetUserItemSize( rSz );
+ mpImplLB->GetMainWindow()->SetUserItemSize( rSz );
}
void ComboBox::EnableUserDraw( bool bUserDraw )
{
- mpImplLB->GetMainWindow().EnableUserDraw( bUserDraw );
+ mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw );
}
void ComboBox::DrawEntry( const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos )
{
- DBG_ASSERT( rEvt.GetDevice() == &mpImplLB->GetMainWindow(), "DrawEntry?!" );
- mpImplLB->GetMainWindow().DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
+ DBG_ASSERT( rEvt.GetDevice() == mpImplLB->GetMainWindow().get(), "DrawEntry?!" );
+ mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
}
void ComboBox::SetSeparatorPos( sal_Int32 n )
@@ -1355,8 +1355,8 @@ void ComboBox::SetNoSelection()
Rectangle ComboBox::GetBoundingRectangle( sal_Int32 nItem ) const
{
- Rectangle aRect = mpImplLB->GetMainWindow().GetBoundingRectangle( nItem );
- Rectangle aOffset = mpImplLB->GetMainWindow().GetWindowExtentsRelative( (vcl::Window*)this );
+ Rectangle aRect = mpImplLB->GetMainWindow()->GetBoundingRectangle( nItem );
+ Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( (vcl::Window*)this );
aRect.Move( aOffset.TopLeft().X(), aOffset.TopLeft().Y() );
return aRect;
}
@@ -1382,16 +1382,16 @@ long ComboBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) const
{
// point must be either in main list window
// or in impl window (dropdown case)
- ImplListBoxWindow& rMain = mpImplLB->GetMainWindow();
+ ImplListBoxWindowPtr rMain = mpImplLB->GetMainWindow();
// convert coordinates to ImplListBoxWindow pixel coordinate space
Point aConvPoint = LogicToPixel( rPoint );
aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
- aConvPoint = rMain.AbsoluteScreenToOutputPixel( aConvPoint );
- aConvPoint = rMain.PixelToLogic( aConvPoint );
+ aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPoint );
+ aConvPoint = rMain->PixelToLogic( aConvPoint );
// try to find entry
- sal_Int32 nEntry = rMain.GetEntryPosForPoint( aConvPoint );
+ sal_Int32 nEntry = rMain->GetEntryPosForPoint( aConvPoint );
if( nEntry == LISTBOX_ENTRY_NOTFOUND )
nIndex = -1;
else
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e5d29ea4a98e..9a18684f22a7 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2135,9 +2135,9 @@ sal_uInt16 ImplListBoxWindow::ImplGetTextStyle() const
ImplListBox::ImplListBox( vcl::Window* pParent, WinBits nWinStyle ) :
Control( pParent, nWinStyle ),
- maLBWindow( this, nWinStyle&(~WB_BORDER) )
+ maLBWindow(new ImplListBoxWindow( this, nWinStyle&(~WB_BORDER) ))
{
- maLBWindow.userDrawSignal.connect( userDrawSignal );
+ maLBWindow->userDrawSignal.connect( userDrawSignal );
// for native widget rendering we must be able to detect this window type
SetType( WINDOW_LISTBOXWINDOW );
@@ -2155,10 +2155,10 @@ ImplListBox::ImplListBox( vcl::Window* pParent, WinBits nWinStyle ) :
mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL );
mbEdgeBlending = false;
- maLBWindow.SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) );
- maLBWindow.SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) );
- maLBWindow.SetEdgeBlending(GetEdgeBlending());
- maLBWindow.Show();
+ maLBWindow->SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) );
+ maLBWindow->SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) );
+ maLBWindow->SetEdgeBlending(GetEdgeBlending());
+ maLBWindow->Show();
}
ImplListBox::~ImplListBox()
@@ -2170,11 +2170,11 @@ ImplListBox::~ImplListBox()
void ImplListBox::Clear()
{
- maLBWindow.Clear();
+ maLBWindow->Clear();
if ( GetEntryList()->GetMRUCount() )
{
- maLBWindow.GetEntryList()->SetMRUCount( 0 );
- maLBWindow.SetSeparatorPos( LISTBOX_ENTRY_NOTFOUND );
+ maLBWindow->GetEntryList()->SetMRUCount( 0 );
+ maLBWindow->SetSeparatorPos( LISTBOX_ENTRY_NOTFOUND );
}
mpVScrollBar->SetThumbPos( 0 );
mpHScrollBar->SetThumbPos( 0 );
@@ -2184,7 +2184,7 @@ void ImplListBox::Clear()
sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
{
ImplEntryType* pNewEntry = new ImplEntryType( rStr );
- sal_Int32 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
+ sal_Int32 nNewPos = maLBWindow->InsertEntry( nPos, pNewEntry );
if (nNewPos == LISTBOX_ERROR)
{
delete pNewEntry;
@@ -2197,7 +2197,7 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage )
{
ImplEntryType* pNewEntry = new ImplEntryType( rStr, rImage );
- sal_Int32 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
+ sal_Int32 nNewPos = maLBWindow->InsertEntry( nPos, pNewEntry );
if (nNewPos == LISTBOX_ERROR)
{
delete pNewEntry;
@@ -2209,33 +2209,33 @@ sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr, const
void ImplListBox::RemoveEntry( sal_Int32 nPos )
{
- maLBWindow.RemoveEntry( nPos );
+ maLBWindow->RemoveEntry( nPos );
StateChanged( StateChangedType::DATA );
}
void ImplListBox::SetEntryFlags( sal_Int32 nPos, long nFlags )
{
- maLBWindow.SetEntryFlags( nPos, nFlags );
+ maLBWindow->SetEntryFlags( nPos, nFlags );
}
void ImplListBox::SelectEntry( sal_Int32 nPos, bool bSelect )
{
- maLBWindow.SelectEntry( nPos, bSelect );
+ maLBWindow->SelectEntry( nPos, bSelect );
}
void ImplListBox::SetNoSelection()
{
- maLBWindow.DeselectAll();
+ maLBWindow->DeselectAll();
}
void ImplListBox::GetFocus()
{
- maLBWindow.GrabFocus();
+ maLBWindow->GrabFocus();
}
vcl::Window* ImplListBox::GetPreferredKeyInputWindow()
{
- return &maLBWindow;
+ return maLBWindow.get();
}
void ImplListBox::Resize()
@@ -2359,7 +2359,7 @@ void ImplListBox::ImplCheckScrollBars()
void ImplListBox::ImplInitScrollBars()
{
- Size aOutSz = maLBWindow.GetOutputSizePixel();
+ Size aOutSz = maLBWindow->GetOutputSizePixel();
if ( mbVScroll )
{
@@ -2396,9 +2396,9 @@ void ImplListBox::ImplResizeControls()
// pb: #106948# explicit mirroring for calc
// Scrollbar on left or right side?
- bool bMirroring = maLBWindow.IsMirroring();
+ bool bMirroring = maLBWindow->IsMirroring();
Point aWinPos( bMirroring && mbVScroll ? nSBWidth : 0, 0 );
- maLBWindow.SetPosSizePixel( aWinPos, aInnerSz );
+ maLBWindow->SetPosSizePixel( aWinPos, aInnerSz );
// ScrollBarBox
if( mbVScroll && mbHScroll )
@@ -2450,7 +2450,7 @@ void ImplListBox::StateChanged( StateChangedType nType )
else if ( ( nType == StateChangedType::UPDATEMODE ) || ( nType == StateChangedType::DATA ) )
{
bool bUpdate = IsUpdateMode();
- maLBWindow.SetUpdateMode( bUpdate );
+ maLBWindow->SetUpdateMode( bUpdate );
if ( bUpdate && IsReallyVisible() )
ImplCheckScrollBars();
}
@@ -2459,30 +2459,30 @@ void ImplListBox::StateChanged( StateChangedType nType )
mpHScrollBar->Enable( IsEnabled() );
mpVScrollBar->Enable( IsEnabled() );
mpScrollBarBox->Enable( IsEnabled() );
- maLBWindow.Enable( IsEnabled() );
+ maLBWindow->Enable( IsEnabled() );
Invalidate();
}
else if ( nType == StateChangedType::ZOOM )
{
- maLBWindow.SetZoom( GetZoom() );
+ maLBWindow->SetZoom( GetZoom() );
Resize();
}
else if ( nType == StateChangedType::CONTROLFONT )
{
- maLBWindow.SetControlFont( GetControlFont() );
+ maLBWindow->SetControlFont( GetControlFont() );
}
else if ( nType == StateChangedType::CONTROLFOREGROUND )
{
- maLBWindow.SetControlForeground( GetControlForeground() );
+ maLBWindow->SetControlForeground( GetControlForeground() );
}
else if ( nType == StateChangedType::CONTROLBACKGROUND )
{
- maLBWindow.SetControlBackground( GetControlBackground() );
+ maLBWindow->SetControlBackground( GetControlBackground() );
}
else if( nType == StateChangedType::MIRRORING )
{
- maLBWindow.EnableRTL( IsRTLEnabled() );
+ maLBWindow->EnableRTL( IsRTLEnabled() );
mpHScrollBar->EnableRTL( IsRTLEnabled() );
mpVScrollBar->EnableRTL( IsRTLEnabled() );
ImplResizeControls();
@@ -2515,9 +2515,15 @@ bool ImplListBox::Notify( NotifyEvent& rNEvt )
return nDone || Window::Notify( rNEvt );
}
+void ImplListBox::dispose()
+{
+ maLBWindow.clear();
+ Control::dispose();
+}
+
const Wallpaper& ImplListBox::GetDisplayBackground() const
{
- return maLBWindow.GetDisplayBackground();
+ return maLBWindow->GetDisplayBackground();
}
bool ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
@@ -2542,7 +2548,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
// Remove old MRU entries
for ( sal_Int32 n = GetEntryList()->GetMRUCount();n; )
- maLBWindow.RemoveEntry( --n );
+ maLBWindow->RemoveEntry( --n );
sal_Int32 nMRUCount = 0;
sal_Int32 nIndex = 0;
@@ -2553,7 +2559,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND )
{
ImplEntryType* pNewEntry = new ImplEntryType( aEntry );
- maLBWindow.GetEntryList()->InsertEntry( nMRUCount++, pNewEntry, false );
+ maLBWindow->GetEntryList()->InsertEntry( nMRUCount++, pNewEntry, false );
bChanges = true;
}
}
@@ -2561,7 +2567,7 @@ void ImplListBox::SetMRUEntries( const OUString& rEntries, sal_Unicode cSep )
if ( bChanges )
{
- maLBWindow.GetEntryList()->SetMRUCount( nMRUCount );
+ maLBWindow->GetEntryList()->SetMRUCount( nMRUCount );
SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 );
StateChanged( StateChangedType::DATA );
}
@@ -2584,7 +2590,7 @@ void ImplListBox::SetEdgeBlending(bool bNew)
if(mbEdgeBlending != bNew)
{
mbEdgeBlending = bNew;
- maLBWindow.SetEdgeBlending(GetEdgeBlending());
+ maLBWindow->SetEdgeBlending(GetEdgeBlending());
}
}
@@ -2959,13 +2965,13 @@ void ImplListBoxFloatingWindow::setPosSizePixel( long nX, long nY, long nWidth,
// this the presence of the vertical Scrollbar has to be known.
mpImplLB->SetSizePixel( GetOutputSizePixel() );
((vcl::Window*)mpImplLB)->Resize();
- ((vcl::Window&)mpImplLB->GetMainWindow()).Resize();
+ ((vcl::Window*)mpImplLB->GetMainWindow().get())->Resize();
}
}
void ImplListBoxFloatingWindow::Resize()
{
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
FloatingWindow::Resize();
}
@@ -3085,12 +3091,12 @@ void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking )
mpImplLB->ShowProminentEntry( nPos );
if( bStartTracking )
- mpImplLB->GetMainWindow().EnableMouseMoveSelect( true );
+ mpImplLB->GetMainWindow()->EnableMouseMoveSelect( true );
- if ( mpImplLB->GetMainWindow().IsGrabFocusAllowed() )
- mpImplLB->GetMainWindow().GrabFocus();
+ if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() )
+ mpImplLB->GetMainWindow()->GrabFocus();
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
}
}
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 3669e1813f5f..ee856fc42257 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -39,7 +39,7 @@
void ListBox::EnableQuickSelection( const bool& b )
{
- mpImplLB->GetMainWindow().EnableQuickSelection(b);
+ mpImplLB->GetMainWindow()->EnableQuickSelection(b);
}
ListBox::ListBox(WindowType nType)
@@ -173,7 +173,7 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
mpImplLB->SetSelectionChangedHdl( LINK( this, ListBox, ImplSelectionChangedHdl ) );
}
else
- mpImplLB->GetMainWindow().AllowGrabFocus( true );
+ mpImplLB->GetMainWindow()->AllowGrabFocus( true );
SetCompoundControl( true );
}
@@ -311,7 +311,7 @@ void ListBox::ImplClickButtonHandler( Control* )
ImplClearLayoutData();
if( mpImplLB )
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
if( mpImplWin )
mpImplWin->ImplClearLayoutData();
}
@@ -341,7 +341,7 @@ IMPL_LINK_NOARG(ListBox, ImplPopupModeEndHdl)
ImplClearLayoutData();
if( mpImplLB )
- mpImplLB->GetMainWindow().ImplClearLayoutData();
+ mpImplLB->GetMainWindow()->ImplClearLayoutData();
if( mpImplWin )
mpImplWin->ImplClearLayoutData();
@@ -369,11 +369,11 @@ void ListBox::ToggleDropDown()
void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
{
- mpImplLB->GetMainWindow().ImplInitSettings( true, true, true );
+ mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true );
Point aPos = pDev->LogicToPixel( rPos );
Size aSize = pDev->LogicToPixel( rSize );
- vcl::Font aFont = mpImplLB->GetMainWindow().GetDrawPixelFont( pDev );
+ vcl::Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
OutDevType eOutDevType = pDev->GetOutDevType();
pDev->Push();
@@ -691,7 +691,7 @@ void ListBox::Resize()
void ListBox::FillLayoutData() const
{
mpControlData->mpLayoutData = new vcl::ControlLayoutData();
- const Control& rMainWin = mpImplLB->GetMainWindow();
+ const ImplListBoxWindowPtr rMainWin = mpImplLB->GetMainWindow();
if( mpFloatWin )
{
// Dropdown mode
@@ -699,14 +699,14 @@ void ListBox::FillLayoutData() const
mpImplWin->SetLayoutDataParent( this );
if( mpFloatWin->IsReallyVisible() )
{
- AppendLayoutData( rMainWin );
- rMainWin.SetLayoutDataParent( this );
+ AppendLayoutData( *(rMainWin.get()) );
+ rMainWin->SetLayoutDataParent( this );
}
}
else
{
- AppendLayoutData( rMainWin );
- rMainWin.SetLayoutDataParent( this );
+ AppendLayoutData( *(rMainWin.get()) );
+ rMainWin->SetLayoutDataParent( this );
}
}
@@ -721,16 +721,16 @@ long ListBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) const
{
// Point must be either in main list window
// or in impl window (dropdown case)
- ImplListBoxWindow& rMain = mpImplLB->GetMainWindow();
+ ImplListBoxWindowPtr rMain = mpImplLB->GetMainWindow();
// Convert coordinates to ImplListBoxWindow pixel coordinate space
Point aConvPoint = LogicToPixel( rPoint );
aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
- aConvPoint = rMain.AbsoluteScreenToOutputPixel( aConvPoint );
- aConvPoint = rMain.PixelToLogic( aConvPoint );
+ aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPoint );
+ aConvPoint = rMain->PixelToLogic( aConvPoint );
// Try to find entry
- sal_Int32 nEntry = rMain.GetEntryPosForPoint( aConvPoint );
+ sal_Int32 nEntry = rMain->GetEntryPosForPoint( aConvPoint );
if( nEntry == LISTBOX_ENTRY_NOTFOUND )
{
// Not found, maybe dropdown case
@@ -803,7 +803,7 @@ void ListBox::StateChanged( StateChangedType nType )
if ( mpImplWin )
{
mpImplWin->SetZoom( GetZoom() );
- mpImplWin->SetFont( mpImplLB->GetMainWindow().GetFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
mpImplWin->Invalidate();
}
Resize();
@@ -814,7 +814,7 @@ void ListBox::StateChanged( StateChangedType nType )
if ( mpImplWin )
{
mpImplWin->SetControlFont( GetControlFont() );
- mpImplWin->SetFont( mpImplLB->GetMainWindow().GetFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
mpImplWin->Invalidate();
}
Resize();
@@ -826,7 +826,7 @@ void ListBox::StateChanged( StateChangedType nType )
{
mpImplWin->SetControlForeground( GetControlForeground() );
mpImplWin->SetTextColor( GetControlForeground() );
- mpImplWin->SetFont( mpImplLB->GetMainWindow().GetFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
mpImplWin->Invalidate();
}
}
@@ -843,17 +843,17 @@ void ListBox::StateChanged( StateChangedType nType )
}
else
{
- mpImplWin->SetBackground( mpImplLB->GetMainWindow().GetControlBackground() );
- mpImplWin->SetControlBackground( mpImplLB->GetMainWindow().GetControlBackground() );
+ mpImplWin->SetBackground( mpImplLB->GetMainWindow()->GetControlBackground() );
+ mpImplWin->SetControlBackground( mpImplLB->GetMainWindow()->GetControlBackground() );
}
- mpImplWin->SetFont( mpImplLB->GetMainWindow().GetFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
mpImplWin->Invalidate();
}
}
else if ( nType == StateChangedType::STYLE )
{
SetStyle( ImplInitStyle( GetStyle() ) );
- mpImplLB->GetMainWindow().EnableSort( ( GetStyle() & WB_SORT ) ? true : false );
+ mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? true : false );
bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? true : false;
mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
}
@@ -1157,8 +1157,8 @@ bool ListBox::IsInDropDown() const
Rectangle ListBox::GetBoundingRectangle( sal_Int32 nItem ) const
{
- Rectangle aRect = mpImplLB->GetMainWindow().GetBoundingRectangle( nItem );
- Rectangle aOffset = mpImplLB->GetMainWindow().GetWindowExtentsRelative( (vcl::Window*)this );
+ Rectangle aRect = mpImplLB->GetMainWindow()->GetBoundingRectangle( nItem );
+ Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( (vcl::Window*)this );
aRect.Move( aOffset.TopLeft().X(), aOffset.TopLeft().Y() );
return aRect;
}
@@ -1180,7 +1180,7 @@ void ListBox::EnableMultiSelection( bool bMulti, bool bStackSelection )
// In a MultiSelection, we can't see us travelling without focus
if ( mpFloatWin )
- mpImplLB->GetMainWindow().AllowGrabFocus( bMulti );
+ mpImplLB->GetMainWindow()->AllowGrabFocus( bMulti );
}
bool ListBox::IsMultiSelectionEnabled() const
@@ -1348,7 +1348,7 @@ void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines
float nCharWidth = approximate_char_width();
if ( !IsDropDownBox() )
{
- Size aOutSz = mpImplLB->GetMainWindow().GetOutputSizePixel();
+ Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel();
rnCols = (sal_uInt16) (aOutSz.Width()/nCharWidth);
rnLines = (sal_uInt16) (aOutSz.Height()/mpImplLB->GetEntryHeight());
}
@@ -1371,22 +1371,22 @@ void ListBox::UserDraw( const UserDrawEvent& )
void ListBox::DrawEntry( const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos )
{
- if ( rEvt.GetDevice() == &mpImplLB->GetMainWindow() )
- mpImplLB->GetMainWindow().DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
+ if ( rEvt.GetDevice() == mpImplLB->GetMainWindow().get() )
+ mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
else if ( rEvt.GetDevice() == mpImplWin )
mpImplWin->DrawEntry( bDrawImage, bDrawText, bDrawTextAtImagePos );
}
void ListBox::SetUserItemSize( const Size& rSz )
{
- mpImplLB->GetMainWindow().SetUserItemSize( rSz );
+ mpImplLB->GetMainWindow()->SetUserItemSize( rSz );
if ( mpImplWin )
mpImplWin->SetUserItemSize( rSz );
}
void ListBox::EnableUserDraw( bool bUserDraw )
{
- mpImplLB->GetMainWindow().EnableUserDraw( bUserDraw );
+ mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw );
if ( mpImplWin )
mpImplWin->EnableUserDraw( bUserDraw );
}
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 553baa472ecb..126e8b9be0b9 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -117,9 +117,9 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
Window( pParent, 0 ),
- aCloseBtn(this),
- aFloatBtn( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ),
- aHideBtn( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )
+ aCloseBtn(new DecoToolBox(this)),
+ aFloatBtn(new PushButton( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )),
+ aHideBtn(new PushButton(this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ))
{
SetType( WINDOW_MENUBARWINDOW );
pMenu = NULL;
@@ -137,25 +137,25 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
if( pResMgr )
{
BitmapEx aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) );
- aCloseBtn.maImage = Image(aBitmap);
+ aCloseBtn->maImage = Image(aBitmap);
- aCloseBtn.SetOutStyle(TOOLBOX_STYLE_FLAT);
- aCloseBtn.SetBackground();
- aCloseBtn.SetPaintTransparent(true);
- aCloseBtn.SetParentClipMode(PARENTCLIPMODE_NOCLIP);
+ aCloseBtn->SetOutStyle(TOOLBOX_STYLE_FLAT);
+ aCloseBtn->SetBackground();
+ aCloseBtn->SetPaintTransparent(true);
+ aCloseBtn->SetParentClipMode(PARENTCLIPMODE_NOCLIP);
- aCloseBtn.InsertItem(IID_DOCUMENTCLOSE, aCloseBtn.maImage, ToolBoxItemBits::NONE);
- aCloseBtn.SetSelectHdl(LINK(this, MenuBarWindow, CloseHdl));
- aCloseBtn.AddEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
- aCloseBtn.SetQuickHelpText(IID_DOCUMENTCLOSE, ResId(SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr).toString());
+ aCloseBtn->InsertItem(IID_DOCUMENTCLOSE, aCloseBtn->maImage, ToolBoxItemBits::NONE);
+ aCloseBtn->SetSelectHdl(LINK(this, MenuBarWindow, CloseHdl));
+ aCloseBtn->AddEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
+ aCloseBtn->SetQuickHelpText(IID_DOCUMENTCLOSE, ResId(SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr).toString());
- aFloatBtn.SetClickHdl( LINK( this, MenuBarWindow, FloatHdl ) );
- aFloatBtn.SetSymbol( SymbolType::FLOAT );
- aFloatBtn.SetQuickHelpText( ResId(SV_HELPTEXT_RESTORE, *pResMgr).toString() );
+ aFloatBtn->SetClickHdl( LINK( this, MenuBarWindow, FloatHdl ) );
+ aFloatBtn->SetSymbol( SymbolType::FLOAT );
+ aFloatBtn->SetQuickHelpText( ResId(SV_HELPTEXT_RESTORE, *pResMgr).toString() );
- aHideBtn.SetClickHdl( LINK( this, MenuBarWindow, HideHdl ) );
- aHideBtn.SetSymbol( SymbolType::HIDE );
- aHideBtn.SetQuickHelpText( ResId(SV_HELPTEXT_MINIMIZE, *pResMgr).toString() );
+ aHideBtn->SetClickHdl( LINK( this, MenuBarWindow, HideHdl ) );
+ aHideBtn->SetSymbol( SymbolType::HIDE );
+ aHideBtn->SetQuickHelpText( ResId(SV_HELPTEXT_MINIMIZE, *pResMgr).toString() );
}
ImplInitStyleSettings();
@@ -165,7 +165,7 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) :
MenuBarWindow::~MenuBarWindow()
{
- aCloseBtn.RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
+ aCloseBtn->RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
RemoveEventListener(LINK(this, MenuBarWindow, ShowHideListener));
}
@@ -177,10 +177,10 @@ void MenuBarWindow::SetMenu( MenuBar* pMen )
ImplInitMenuWindow( this, true, true );
if ( pMen )
{
- aCloseBtn.ShowItem(IID_DOCUMENTCLOSE, pMen->HasCloseButton());
- aCloseBtn.Show(pMen->HasCloseButton() || !m_aAddButtons.empty());
- aFloatBtn.Show(pMen->HasFloatButton());
- aHideBtn.Show(pMen->HasHideButton());
+ aCloseBtn->ShowItem(IID_DOCUMENTCLOSE, pMen->HasCloseButton());
+ aCloseBtn->Show(pMen->HasCloseButton() || !m_aAddButtons.empty());
+ aFloatBtn->Show(pMen->HasFloatButton());
+ aHideBtn->Show(pMen->HasHideButton());
}
Invalidate();
@@ -201,16 +201,16 @@ void MenuBarWindow::SetHeight(long nHeight)
void MenuBarWindow::ShowButtons( bool bClose, bool bFloat, bool bHide )
{
- aCloseBtn.ShowItem(IID_DOCUMENTCLOSE, bClose);
- aCloseBtn.Show(bClose || !m_aAddButtons.empty());
- aFloatBtn.Show( bFloat );
- aHideBtn.Show( bHide );
+ aCloseBtn->ShowItem(IID_DOCUMENTCLOSE, bClose);
+ aCloseBtn->Show(bClose || !m_aAddButtons.empty());
+ aFloatBtn->Show( bFloat );
+ aHideBtn->Show( bHide );
Resize();
}
Size MenuBarWindow::MinCloseButtonSize()
{
- return aCloseBtn.getMinSize();
+ return aCloseBtn->getMinSize();
}
IMPL_LINK_NOARG(MenuBarWindow, CloseHdl)
@@ -218,7 +218,7 @@ IMPL_LINK_NOARG(MenuBarWindow, CloseHdl)
if( ! pMenu )
return 0;
- if( aCloseBtn.GetCurItemId() == IID_DOCUMENTCLOSE )
+ if( aCloseBtn->GetCurItemId() == IID_DOCUMENTCLOSE )
{
// #i106052# call close hdl asynchronously to ease handler implementation
// this avoids still being in the handler while the DecoToolBox already
@@ -227,12 +227,12 @@ IMPL_LINK_NOARG(MenuBarWindow, CloseHdl)
}
else
{
- std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(aCloseBtn.GetCurItemId());
+ std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(aCloseBtn->GetCurItemId());
if( it != m_aAddButtons.end() )
{
MenuBar::MenuBarButtonCallbackArg aArg;
aArg.nId = it->first;
- aArg.bHighlight = (aCloseBtn.GetHighlightItemId() == it->first);
+ aArg.bHighlight = (aCloseBtn->GetHighlightItemId() == it->first);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
return it->second.m_aSelectLink.Call( &aArg );
}
@@ -250,11 +250,11 @@ IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent*, pEvent )
aArg.bHighlight = (pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT);
aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu);
if( pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHT )
- aArg.nId = aCloseBtn.GetHighlightItemId();
+ aArg.nId = aCloseBtn->GetHighlightItemId();
else if( pEvent->GetId() == VCLEVENT_TOOLBOX_HIGHLIGHTOFF )
{
sal_uInt16 nPos = static_cast< sal_uInt16 >(reinterpret_cast<sal_IntPtr>(pEvent->GetData()));
- aArg.nId = aCloseBtn.GetItemId(nPos);
+ aArg.nId = aCloseBtn->GetItemId(nPos);
}
std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( aArg.nId );
if( it != m_aAddButtons.end() )
@@ -913,30 +913,30 @@ void MenuBarWindow::Resize()
long nX = aOutSz.Width()-3;
long nY = 2;
- if ( aCloseBtn.IsVisible() )
+ if ( aCloseBtn->IsVisible() )
{
- aCloseBtn.Hide();
- aCloseBtn.SetImages(n);
- Size aTbxSize( aCloseBtn.CalcWindowSizePixel() );
+ aCloseBtn->Hide();
+ aCloseBtn->SetImages(n);
+ Size aTbxSize( aCloseBtn->CalcWindowSizePixel() );
nX -= aTbxSize.Width();
long nTbxY = (aOutSz.Height() - aTbxSize.Height())/2;
- aCloseBtn.setPosSizePixel(nX, nTbxY, aTbxSize.Width(), aTbxSize.Height());
+ aCloseBtn->setPosSizePixel(nX, nTbxY, aTbxSize.Width(), aTbxSize.Height());
nX -= 3;
- aCloseBtn.Show();
+ aCloseBtn->Show();
}
- if ( aFloatBtn.IsVisible() )
+ if ( aFloatBtn->IsVisible() )
{
nX -= n;
- aFloatBtn.setPosSizePixel( nX, nY, n, n );
+ aFloatBtn->setPosSizePixel( nX, nY, n, n );
}
- if ( aHideBtn.IsVisible() )
+ if ( aHideBtn->IsVisible() )
{
nX -= n;
- aHideBtn.setPosSizePixel( nX, nY, n, n );
+ aHideBtn->setPosSizePixel( nX, nY, n, n );
}
- aFloatBtn.SetSymbol( SymbolType::FLOAT );
- aHideBtn.SetSymbol( SymbolType::HIDE );
+ aFloatBtn->SetSymbol( SymbolType::FLOAT );
+ aHideBtn->SetSymbol( SymbolType::HIDE );
Invalidate();
}
@@ -1057,6 +1057,15 @@ void MenuBarWindow::GetFocus()
}
}
+void MenuBarWindow::dispose()
+{
+ aCloseBtn.disposeAndClear();
+ aFloatBtn.disposeAndClear();
+ aHideBtn.disposeAndClear();
+ Window::dispose();
+}
+
+
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > MenuBarWindow::CreateAccessible()
{
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc;
@@ -1083,9 +1092,9 @@ sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link& i
AddButtonEntry& rNewEntry = m_aAddButtons[nId];
rNewEntry.m_nId = nId;
rNewEntry.m_aSelectLink = i_rLink;
- aCloseBtn.InsertItem(nId, i_rImage, ToolBoxItemBits::NONE, 0);
- aCloseBtn.calcMinSize();
- ShowButtons(aCloseBtn.IsItemVisible(IID_DOCUMENTCLOSE), aFloatBtn.IsVisible(), aHideBtn.IsVisible());
+ aCloseBtn->InsertItem(nId, i_rImage, ToolBoxItemBits::NONE, 0);
+ aCloseBtn->calcMinSize();
+ ShowButtons(aCloseBtn->IsItemVisible(IID_DOCUMENTCLOSE), aFloatBtn->IsVisible(), aHideBtn->IsVisible());
LayoutChanged();
if( pMenu->mpSalMenu )
@@ -1118,8 +1127,8 @@ Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( sal_uInt16 nId )
if( aRect.IsEmpty() )
{
- aRect = aCloseBtn.GetItemRect(nId);
- Point aOffset = aCloseBtn.OutputToScreenPixel(Point());
+ aRect = aCloseBtn->GetItemRect(nId);
+ Point aOffset = aCloseBtn->OutputToScreenPixel(Point());
aRect.Move( aOffset.X(), aOffset.Y() );
}
}
@@ -1128,10 +1137,10 @@ Rectangle MenuBarWindow::GetMenuBarButtonRectPixel( sal_uInt16 nId )
void MenuBarWindow::RemoveMenuBarButton( sal_uInt16 nId )
{
- sal_uInt16 nPos = aCloseBtn.GetItemPos(nId);
- aCloseBtn.RemoveItem(nPos);
+ sal_uInt16 nPos = aCloseBtn->GetItemPos(nId);
+ aCloseBtn->RemoveItem(nPos);
m_aAddButtons.erase( nId );
- aCloseBtn.calcMinSize();
+ aCloseBtn->calcMinSize();
LayoutChanged();
if( pMenu->mpSalMenu )
diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx
index 46c79accc0f5..b34784780ebc 100644
--- a/vcl/source/window/menubarwindow.hxx
+++ b/vcl/source/window/menubarwindow.hxx
@@ -52,6 +52,9 @@ public:
Image maImage;
};
+typedef VclReference<DecoToolBox> DecoToolBoxPtr;
+
+
/** Class that implements the actual window of the menu bar.
*/
class MenuBarWindow : public vcl::Window, public IMenuBarWindow
@@ -62,32 +65,32 @@ class MenuBarWindow : public vcl::Window, public IMenuBarWindow
private:
struct AddButtonEntry
{
- sal_uInt16 m_nId;
- Link m_aSelectLink;
- Link m_aHighlightLink;
+ sal_uInt16 m_nId;
+ Link m_aSelectLink;
+ Link m_aHighlightLink;
AddButtonEntry() : m_nId( 0 ) {}
};
Menu* pMenu;
PopupMenu* pActivePopup;
- sal_uInt16 nHighlightedItem;
- sal_uInt16 nRolloveredItem;
- sal_uLong nSaveFocusId;
+ sal_uInt16 nHighlightedItem;
+ sal_uInt16 nRolloveredItem;
+ sal_uLong nSaveFocusId;
bool mbAutoPopup;
bool bIgnoreFirstMove;
bool bStayActive;
- DecoToolBox aCloseBtn;
- PushButton aFloatBtn;
- PushButton aHideBtn;
+ DecoToolBoxPtr aCloseBtn;
+ PushButtonPtr aFloatBtn;
+ PushButtonPtr aHideBtn;
std::map< sal_uInt16, AddButtonEntry > m_aAddButtons;
void HighlightItem( sal_uInt16 nPos, bool bHighlight );
virtual void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus = true, bool bDefaultToDocument = true) SAL_OVERRIDE;
- sal_uInt16 ImplFindEntry( const Point& rMousePos ) const;
+ sal_uInt16 ImplFindEntry( const Point& rMousePos ) const;
void ImplCreatePopup( bool bPreSelectFirst );
virtual bool HandleKeyEvent(const KeyEvent& rKEvent, bool bFromMenu = true) SAL_OVERRIDE;
Rectangle ImplGetItemRect( sal_uInt16 nPos );
@@ -104,6 +107,7 @@ private:
void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
void LoseFocus() SAL_OVERRIDE;
void GetFocus() SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
public:
MenuBarWindow( vcl::Window* pParent );
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index c4ea5c7aac3c..0015caf7d886 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -67,17 +67,17 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( vcl::Window* i_pParent )
, maPageVDev( *this )
, maToolTipString(VclResId( SV_PRINT_PRINTPREVIEW_TXT).toString())
, mbGreyscale( false )
- , maHorzDim( this, WB_HORZ | WB_CENTER )
- , maVertDim( this, WB_VERT | WB_VCENTER )
+ , maHorzDim(new FixedLine(this, WB_HORZ | WB_CENTER))
+ , maVertDim(new FixedLine(this, WB_VERT | WB_VCENTER))
{
SetPaintTransparent( true );
SetBackground();
maPageVDev.SetBackground( Color( COL_WHITE ) );
- maHorzDim.Show();
- maVertDim.Show();
+ maHorzDim->Show();
+ maVertDim->Show();
- maHorzDim.SetText( OUString( "2.0in" ) );
- maVertDim.SetText( OUString( "2.0in" ) );
+ maHorzDim->SetText( OUString( "2.0in" ) );
+ maVertDim->SetText( OUString( "2.0in" ) );
}
PrintDialog::PrintPreviewWindow::~PrintPreviewWindow()
@@ -99,7 +99,7 @@ void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDC
void PrintDialog::PrintPreviewWindow::Resize()
{
Size aNewSize( GetSizePixel() );
- long nTextHeight = maHorzDim.GetTextHeight();
+ long nTextHeight = maHorzDim->GetTextHeight();
// leave small space for decoration
aNewSize.Width() -= nTextHeight + 2;
aNewSize.Height() -= nTextHeight + 2;
@@ -145,16 +145,16 @@ void PrintDialog::PrintPreviewWindow::Resize()
// position dimension lines
Point aRef( nTextHeight + (aNewSize.Width() - maPreviewSize.Width())/2,
nTextHeight + (aNewSize.Height() - maPreviewSize.Height())/2 );
- maHorzDim.SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ),
+ maHorzDim->SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ),
Size( maPreviewSize.Width(), nTextHeight ) );
- maVertDim.SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ),
+ maVertDim->SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ),
Size( nTextHeight, maPreviewSize.Height() ) );
}
void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
{
- long nTextHeight = maHorzDim.GetTextHeight();
+ long nTextHeight = maHorzDim->GetTextHeight();
Size aSize( GetSizePixel() );
Point aOffset( (aSize.Width() - maPreviewSize.Width() + nTextHeight) / 2 ,
(aSize.Height() - maPreviewSize.Height() + nTextHeight) / 2 );
@@ -241,19 +241,26 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
aBuf.append( i_rPaperName );
aBuf.append( ')' );
}
- maHorzDim.SetText( aBuf.makeStringAndClear() );
+ maHorzDim->SetText( aBuf.makeStringAndClear() );
aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits );
aBuf.append( aNumText )
.append( sal_Unicode( ' ' ) );
aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" );
- maVertDim.SetText( aBuf.makeStringAndClear() );
+ maVertDim->SetText( aBuf.makeStringAndClear() );
Resize();
preparePreviewBitmap();
Invalidate();
}
+void PrintDialog::PrintPreviewWindow::dispose()
+{
+ maHorzDim.disposeAndClear();
+ maVertDim.disposeAndClear();
+ Window::dispose();
+}
+
void PrintDialog::PrintPreviewWindow::preparePreviewBitmap()
{
GDIMetaFile aMtf( maMtf );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6fdb764bf2b5..156cc66ac8fa 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -131,14 +131,8 @@ namespace
}
#endif
-Window::~Window()
+void Window::dispose()
{
- vcl::LazyDeletor<vcl::Window>::Undelete( this );
-
- DBG_ASSERT( !mpWindowImpl->mbInDtor, "~Window - already in DTOR!" );
-
- dispose();
-
// remove Key and Mouse events issued by Application::PostKey/MouseEvent
Application::RemoveMouseAndKeyEvents( this );
@@ -568,6 +562,13 @@ Window::~Window()
delete mpWindowImpl; mpWindowImpl = NULL;
}
+Window::~Window()
+{
+ vcl::LazyDeletor<vcl::Window>::Undelete( this );
+
+ DBG_ASSERT( !mpWindowImpl->mbInDtor, "~Window - already in DTOR!" );
+}
+
} /* namespace vcl */
WindowImpl::WindowImpl( WindowType nType )
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index e957671c8ce3..85e9e50af667 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -77,7 +77,7 @@ namespace vcl {
class XIMStatusWindow : public StatusWindow
{
- FixedText m_aStatusText;
+ FixedTextPtr m_aStatusText;
SalFrame* m_pLastParent;
Size m_aWindowSize;
bool m_bAnchoredAtRight;
@@ -104,6 +104,7 @@ public:
virtual void setText( const OUString & ) SAL_OVERRIDE;
virtual void show( bool bShow, I18NStatus::ShowReason eReason ) SAL_OVERRIDE;
virtual void toggle( bool bOn ) SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
// override WorkWindow::DataChanged
virtual void DataChanged( const DataChangedEvent& rEvt ) SAL_OVERRIDE;
@@ -113,7 +114,7 @@ public:
XIMStatusWindow::XIMStatusWindow( bool bOn ) :
StatusWindow( WB_BORDER | WB_SYSTEMFLOATWIN | WB_TOOLTIPWIN ),
- m_aStatusText( this, 0 ),
+ m_aStatusText(new FixedText(this, 0)),
m_pLastParent( NULL ),
m_bAnchoredAtRight( false ),
m_bDelayedShow( false ),
@@ -136,10 +137,16 @@ void XIMStatusWindow::toggle( bool bOn )
show( bOn, I18NStatus::contextmap );
}
+void XIMStatusWindow::dispose()
+{
+ m_aStatusText.disposeAndClear();
+ StatusWindow::dispose();
+};
+
void XIMStatusWindow::layout()
{
- m_aWindowSize.Width() = m_aStatusText.GetTextWidth( m_aStatusText.GetText() )+8;
- Font aFont( m_aStatusText.GetFont() );
+ m_aWindowSize.Width() = m_aStatusText->GetTextWidth( m_aStatusText->GetText() )+8;
+ Font aFont( m_aStatusText->GetFont() );
m_aWindowSize.Height() = aFont.GetHeight()+10;
m_aWindowSize = LogicToPixel( m_aWindowSize );
@@ -147,9 +154,9 @@ void XIMStatusWindow::layout()
aControlSize.Width() -= 4;
aControlSize.Height() -= 4;
- m_aStatusText.SetPosSizePixel( Point( 1, 1 ), aControlSize );
- m_aStatusText.SetFont( aFont );
- m_aStatusText.Show( true );
+ m_aStatusText->SetPosSizePixel( Point( 1, 1 ), aControlSize );
+ m_aStatusText->SetFont( aFont );
+ m_aStatusText->Show( true );
if (m_bAnchoredAtRight && IsVisible())
{
@@ -181,7 +188,7 @@ bool XIMStatusWindow::checkLastParent() const
void XIMStatusWindow::DataChanged( const DataChangedEvent& )
{
- m_aStatusText.SetSettings( GetSettings() );
+ m_aStatusText->SetSettings( GetSettings() );
layout();
}
@@ -261,7 +268,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl)
if( m_bDelayedShow )
{
Size aControlSize( m_aWindowSize.Width()-4, m_aWindowSize.Height()-4 );
- m_aStatusText.SetPosSizePixel( Point( 1, 1 ), aControlSize );
+ m_aStatusText->SetPosSizePixel( Point( 1, 1 ), aControlSize );
Point aPoint = updatePosition();
pStatusFrame->SetPosSize( aPoint.X(), aPoint.Y(), m_aWindowSize.Width(), m_aWindowSize.Height(), SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y | SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
}
@@ -276,7 +283,7 @@ IMPL_LINK_NOARG(XIMStatusWindow, DelayedShowHdl)
void XIMStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason )
{
- if( bShow && m_aStatusText.GetText().isEmpty() )
+ if( bShow && m_aStatusText->GetText().isEmpty() )
bShow = false;
m_bDelayedShow = bShow;
@@ -287,15 +294,15 @@ void XIMStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason )
void XIMStatusWindow::setText( const OUString& rText )
{
- m_aStatusText.SetText( rText );
- m_aWindowSize.Width() = m_aStatusText.GetTextWidth( rText )+8;
+ m_aStatusText->SetText( rText );
+ m_aWindowSize.Width() = m_aStatusText->GetTextWidth( rText )+8;
}
namespace vcl {
class IIIMPStatusWindow : public StatusWindow
{
- MenuButton m_aStatusBtn;
+ MenuButtonPtr m_aStatusBtn;
PopupMenu m_aMenu;
SalFrame* m_pResetFocus;
bool m_bShow;
@@ -312,6 +319,7 @@ public:
virtual void setText( const OUString & ) SAL_OVERRIDE;
virtual void show( bool bShow, I18NStatus::ShowReason eReason ) SAL_OVERRIDE;
virtual void toggle( bool bOn ) SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
void layout();
// override Window focus handler
@@ -324,7 +332,7 @@ public:
IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
StatusWindow( WB_MOVEABLE ),
- m_aStatusBtn( this, WB_BORDER ),
+ m_aStatusBtn(new MenuButton(this, WB_BORDER)),
m_pResetFocus( pParent ),
m_bShow( true ),
m_bOn( bOn )
@@ -333,9 +341,9 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
layout();
- m_aStatusBtn.SetSelectHdl( LINK( this, IIIMPStatusWindow, SelectHdl ) );
- m_aStatusBtn.SetPopupMenu( &m_aMenu );
- m_aStatusBtn.Show( true );
+ m_aStatusBtn->SetSelectHdl( LINK( this, IIIMPStatusWindow, SelectHdl ) );
+ m_aStatusBtn->SetPopupMenu( &m_aMenu );
+ m_aStatusBtn->Show( true );
const ::std::vector< I18NStatus::ChoiceData >& rChoices( I18NStatus::get().getChoices() );
int i = 1;
@@ -369,11 +377,11 @@ IIIMPStatusWindow::~IIIMPStatusWindow()
void IIIMPStatusWindow::layout()
{
- Font aFont( m_aStatusBtn.GetFont() );
+ Font aFont( m_aStatusBtn->GetFont() );
Size aSize( 15*aFont.GetHeight(), aFont.GetHeight()+14 );
- aSize = m_aStatusBtn.LogicToPixel( aSize );
+ aSize = m_aStatusBtn->LogicToPixel( aSize );
- m_aStatusBtn.SetPosSizePixel( Point( 0, 0 ), aSize );
+ m_aStatusBtn->SetPosSizePixel( Point( 0, 0 ), aSize );
SetOutputSizePixel( aSize );
if( IsVisible() )
Invalidate();
@@ -381,13 +389,13 @@ void IIIMPStatusWindow::layout()
void IIIMPStatusWindow::DataChanged( const DataChangedEvent& )
{
- m_aStatusBtn.SetSettings( GetSettings() );
+ m_aStatusBtn->SetSettings( GetSettings() );
layout();
}
void IIIMPStatusWindow::setText( const OUString& rText )
{
- m_aStatusBtn.SetText( rText );
+ m_aStatusBtn->SetText( rText );
}
void IIIMPStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason )
@@ -411,6 +419,12 @@ void IIIMPStatusWindow::toggle( bool bOn )
}
}
+void IIIMPStatusWindow::dispose()
+{
+ m_aStatusBtn.disposeAndClear();
+ StatusWindow::dispose();
+}
+
void IIIMPStatusWindow::show()
{
if (m_bOn && m_bShow && !IsVisible())
@@ -454,10 +468,10 @@ void IIIMPStatusWindow::GetFocus()
IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn )
{
- if( pBtn == & m_aStatusBtn )
+ if( pBtn == m_aStatusBtn.get() )
{
const ::std::vector< I18NStatus::ChoiceData >& rChoices( I18NStatus::get().getChoices() );
- unsigned int nIndex = m_aStatusBtn.GetCurItemId()-1;
+ unsigned int nIndex = m_aStatusBtn->GetCurItemId()-1;
if( nIndex < rChoices.size() )
{
XSetICValues( static_cast<X11SalFrame*>(I18NStatus::get().getParent())->getInputContext()->GetContext(),
diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx
index 2ed9ac302368..b3ad5db2694f 100644
--- a/vcl/workben/svpclient.cxx
+++ b/vcl/workben/svpclient.cxx
@@ -92,10 +92,10 @@ SAL_IMPLEMENT_MAIN()
class MyWin : public WorkWindow
{
- PushButton m_aListButton;
- ListBox m_aSvpBitmaps;
- ImageControl m_aImage;
- PushButton m_aQuitButton;
+ PushButtonPtr m_aListButton;
+ ListBoxPtr m_aSvpBitmaps;
+ ImageControlPtr m_aImage;
+ PushButtonPtr m_aQuitButton;
public:
MyWin( vcl::Window* pParent, WinBits nWinStyle );
@@ -108,6 +108,7 @@ public:
virtual void Resize() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
+ virtual void dispose() SAL_OVERRIDE;
void parseList( const OString& rList );
OString processCommand( const OString& rCommand );
@@ -128,28 +129,28 @@ void Main()
MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
WorkWindow( pParent, nWinStyle ),
- m_aListButton( this, 0 ),
- m_aSvpBitmaps( this, WB_BORDER ),
- m_aImage( this, WB_BORDER ),
- m_aQuitButton( this, 0 )
+ m_aListButton(new PushButton(this, 0)),
+ m_aSvpBitmaps(new ListBox(this, WB_BORDER)),
+ m_aImage(new ImageControl(this, WB_BORDER)),
+ m_aQuitButton(new PushButton(this, 0))
{
- m_aListButton.SetPosSizePixel( Point( 10, 10 ), Size( 120, 25 ) );
- m_aListButton.SetText( OUString( "List Elements" ) );
- m_aListButton.SetClickHdl( LINK( this, MyWin, ListHdl ) );
- m_aListButton.Show();
-
- m_aSvpBitmaps.SetPosSizePixel( Point( 10, 40 ), Size( 150, 150 ) );
- m_aSvpBitmaps.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
- m_aSvpBitmaps.Show();
-
- m_aImage.SetPosSizePixel( Point( 170, 10 ), Size( 400, 400 ) );
- m_aImage.SetScaleMode( com::sun::star::awt::ImageScaleMode::NONE );
- m_aImage.Show();
-
- m_aQuitButton.SetPosSizePixel( Point( 10, 300 ), Size( 120,25 ) );
- m_aQuitButton.SetText( OUString( "Quit SVP server" ) );
- m_aQuitButton.SetClickHdl( LINK( this, MyWin, QuitHdl ) );
- m_aQuitButton.Show();
+ m_aListButton->SetPosSizePixel( Point( 10, 10 ), Size( 120, 25 ) );
+ m_aListButton->SetText( OUString( "List Elements" ) );
+ m_aListButton->SetClickHdl( LINK( this, MyWin, ListHdl ) );
+ m_aListButton->Show();
+
+ m_aSvpBitmaps->SetPosSizePixel( Point( 10, 40 ), Size( 150, 150 ) );
+ m_aSvpBitmaps->SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
+ m_aSvpBitmaps->Show();
+
+ m_aImage->SetPosSizePixel( Point( 170, 10 ), Size( 400, 400 ) );
+ m_aImage->SetScaleMode( com::sun::star::awt::ImageScaleMode::NONE );
+ m_aImage->Show();
+
+ m_aQuitButton->SetPosSizePixel( Point( 10, 300 ), Size( 120,25 ) );
+ m_aQuitButton->SetText( OUString( "Quit SVP server" ) );
+ m_aQuitButton->SetClickHdl( LINK( this, MyWin, QuitHdl ) );
+ m_aQuitButton->Show();
}
bool MyWin::Close()
@@ -160,11 +161,20 @@ bool MyWin::Close()
return bRet;
}
+void MyWin::dispose()
+{
+ m_aListButton.disposeAndClear();
+ m_aSvpBitmaps.disposeAndClear();
+ m_aImage.disposeAndClear();
+ m_aQuitButton.disposeAndClear();
+ WorkWindow::dispose();
+}
+
void MyWin::parseList( const OString& rList )
{
sal_Int32 nTokenPos = 0;
OUString aElementType;
- m_aSvpBitmaps.Clear();
+ m_aSvpBitmaps->Clear();
while( nTokenPos >= 0 )
{
OString aLine = rList.getToken( 0, '\n', nTokenPos );
@@ -179,7 +189,7 @@ void MyWin::parseList( const OString& rList )
aNewElement.append( aElementType );
aNewElement.appendAscii( ": " );
aNewElement.append( OStringToOUString( aLine, RTL_TEXTENCODING_ASCII_US ) );
- m_aSvpBitmaps.InsertEntry( aNewElement.makeStringAndClear() );
+ m_aSvpBitmaps->InsertEntry( aNewElement.makeStringAndClear() );
}
}
}
@@ -235,7 +245,7 @@ IMPL_LINK( MyWin, QuitHdl, Button*, )
IMPL_LINK( MyWin, SelectHdl, ListBox*, )
{
- OUString aEntry = m_aSvpBitmaps.GetSelectEntry();
+ OUString aEntry = m_aSvpBitmaps->GetSelectEntry();
sal_Int32 nPos = aEntry.indexOf( ": " );
if( nPos != -1 )
{
@@ -259,8 +269,8 @@ IMPL_LINK( MyWin, SelectHdl, ListBox*, )
Size aFixedSize( aBitmap.GetSizePixel() );
aFixedSize.Width() += 10;
aFixedSize.Height() += 10;
- m_aImage.SetSizePixel( aFixedSize );
- m_aImage.SetImage( Image( BitmapEx( aBitmap ) ) );
+ m_aImage->SetSizePixel( aFixedSize );
+ m_aImage->SetImage( Image( BitmapEx( aBitmap ) ) );
}
return 0;
}