diff options
Diffstat (limited to 'dbaccess/source/ui/querydesign/TableWindow.cxx')
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindow.cxx | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx index 35888462af34..e0c1e5bf0ea3 100644 --- a/dbaccess/source/ui/querydesign/TableWindow.cxx +++ b/dbaccess/source/ui/querydesign/TableWindow.cxx @@ -69,8 +69,8 @@ namespace DatabaseObject = css::sdb::application::DatabaseObject; OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_type& pTabWinData ) : ::comphelper::OContainerListener(m_aMutex) ,Window( pParent, WB_3DLOOK|WB_MOVEABLE ) - ,m_aTypeImage( this ) - ,m_aTitle( this ) + ,m_aTypeImage( VclPtr<FixedImage>::Create(this) ) + ,m_aTitle( VclPtr<OTableWindowTitle>::Create(this) ) ,m_pListBox(NULL) ,m_pAccessible(NULL) ,m_pData( pTabWinData ) @@ -99,17 +99,23 @@ OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_ OTableWindow::~OTableWindow() { + disposeOnce(); +} +void OTableWindow::dispose() +{ if (m_pListBox) { OSL_ENSURE(m_pListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!"); - boost::scoped_ptr<vcl::Window> aTemp(m_pListBox); - m_pListBox = NULL; } + m_pListBox.disposeAndClear(); if ( m_pContainerListener.is() ) m_pContainerListener->dispose(); m_pAccessible = NULL; + m_aTypeImage.disposeAndClear(); + m_aTitle.disposeAndClear(); + vcl::Window::dispose(); } const OJoinTableView* OTableWindow::getTableView() const @@ -155,9 +161,9 @@ void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) SetSizePixel( rNewSize ); } -OTableWindowListBox* OTableWindow::CreateListBox() +VclPtr<OTableWindowListBox> OTableWindow::CreateListBox() { - return new OTableWindowListBox(this); + return VclPtr<OTableWindowListBox>::Create(this); } bool OTableWindow::FillListBox() @@ -263,8 +269,8 @@ void OTableWindow::impl_updateImage() return; } - m_aTypeImage.SetModeImage( aImage ); - m_aTypeImage.Show(); + m_aTypeImage->SetModeImage( aImage ); + m_aTypeImage->Show(); } bool OTableWindow::Init() @@ -273,13 +279,13 @@ bool OTableWindow::Init() if ( !m_pListBox ) { m_pListBox = CreateListBox(); - OSL_ENSURE( m_pListBox != NULL, "OTableWindow::Init() : CreateListBox returned NULL !" ); + OSL_ENSURE( m_pListBox != nullptr, "OTableWindow::Init() : CreateListBox returned NULL !" ); m_pListBox->SetSelectionMode( MULTIPLE_SELECTION ); } // Set the title - m_aTitle.SetText( m_pData->GetWinName() ); - m_aTitle.Show(); + m_aTitle->SetText( m_pData->GetWinName() ); + m_aTitle->Show(); m_pListBox->Show(); @@ -456,15 +462,15 @@ void OTableWindow::Resize() long nPositionY = n5Pos; // position the image which indicates the type - m_aTypeImage.SetPosPixel( Point( nPositionX, nPositionY ) ); - Size aImageSize( m_aTypeImage.GetImage().GetSizePixel() ); - m_aTypeImage.SetSizePixel( aImageSize ); + m_aTypeImage->SetPosPixel( Point( nPositionX, nPositionY ) ); + Size aImageSize( m_aTypeImage->GetImage().GetSizePixel() ); + m_aTypeImage->SetSizePixel( aImageSize ); if ( nTitleHeight < aImageSize.Height() ) nTitleHeight = aImageSize.Height(); nPositionX += aImageSize.Width() + CalcZoom( 2 ); - m_aTitle.SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) ); + m_aTitle->SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) ); long nTitleToList = CalcZoom( 3 ); @@ -478,10 +484,10 @@ void OTableWindow::Resize() void OTableWindow::SetBoldTitle( bool bBold ) { - vcl::Font aFont = m_aTitle.GetFont(); + vcl::Font aFont = m_aTitle->GetFont(); aFont.SetWeight( bBold?WEIGHT_BOLD:WEIGHT_NORMAL ); - m_aTitle.SetFont( aFont ); - m_aTitle.Invalidate(); + m_aTitle->SetFont( aFont ); + m_aTitle->Invalidate(); } void OTableWindow::GetFocus() @@ -559,7 +565,7 @@ void OTableWindow::StateChanged( StateChangedType nType ) aFont.Merge( GetControlFont() ); SetZoomedPointFont( aFont ); - m_aTitle.SetZoom(GetZoom()); + m_aTitle->SetZoom(GetZoom()); m_pListBox->SetZoom(GetZoom()); Resize(); Invalidate(); @@ -591,7 +597,7 @@ void OTableWindow::Command(const CommandEvent& rEvt) if ( pCurrent ) ptWhere = m_pListBox->GetEntryPosition(pCurrent); else - ptWhere = m_aTitle.GetPosPixel(); + ptWhere = m_aTitle->GetPosPixel(); } PopupMenu aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE)); @@ -746,7 +752,7 @@ bool OTableWindow::PreNotify(NotifyEvent& rNEvt) OUString OTableWindow::getTitle() const { - return m_aTitle.GetText(); + return m_aTitle->GetText(); } void OTableWindow::_elementInserted( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception) |