diff options
Diffstat (limited to 'vcl/source/control/tabctrl.cxx')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 4a89c0f33ca5..ecb2c6022496 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -42,7 +42,7 @@ struct ImplTabItem { sal_uInt16 mnId; - TabPage* mpTabPage; + VclPtr<TabPage> mpTabPage; OUString maText; OUString maFormatText; OUString maHelpText; @@ -67,7 +67,7 @@ struct ImplTabCtrlData std::vector< Rectangle > maTabRectangles; Point maItemsOffset; // offset of the tabitems std::vector< ImplTabItem > maItemList; - ListBox* mpListBox; + VclPtr<ListBox> mpListBox; }; #define TAB_OFFSET 3 @@ -204,12 +204,8 @@ void TabControl::dispose() ImplFreeLayoutData(); // delete TabCtrl data - if ( mpTabCtrlData ) - { - delete mpTabCtrlData->mpListBox; - delete mpTabCtrlData; - mpTabCtrlData = NULL; - } + delete mpTabCtrlData; + mpTabCtrlData = NULL; Control::dispose(); } @@ -580,9 +576,9 @@ void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ) ImplTabItem* pOldItem = ImplGetItem( nOldId ); ImplTabItem* pItem = ImplGetItem( nId ); - TabPage* pOldPage = (pOldItem) ? pOldItem->mpTabPage : NULL; - TabPage* pPage = (pItem) ? pItem->mpTabPage : NULL; - vcl::Window* pCtrlParent = GetParent(); + TabPage* pOldPage = (pOldItem) ? pOldItem->mpTabPage.get() : NULL; + TabPage* pPage = (pItem) ? pItem->mpTabPage.get() : NULL; + vcl::Window* pCtrlParent = GetParent(); if ( IsReallyVisible() && IsUpdateMode() ) { @@ -1019,7 +1015,7 @@ IMPL_LINK( TabControl, ImplWindowEventListener, VclSimpleEvent*, pEvent ) void TabControl::MouseButtonDown( const MouseEvent& rMEvt ) { - if( mpTabCtrlData->mpListBox == NULL ) + if( mpTabCtrlData->mpListBox.get() == NULL ) { if( rMEvt.IsLeft() ) { @@ -1089,7 +1085,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) // in this case we're only interested in the top border of the tabpage because the tabitems are used // standalone (eg impress) bool bNoTabPage = false; - TabPage* pCurPage = pCurItem ? pCurItem->mpTabPage : NULL; + TabPage* pCurPage = pCurItem ? pCurItem->mpTabPage.get() : NULL; if( !pCurPage || !pCurPage->IsVisible() ) { bNoTabPage = true; @@ -1175,7 +1171,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) } } - if ( !mpTabCtrlData->maItemList.empty() && mpTabCtrlData->mpListBox == NULL ) + if ( !mpTabCtrlData->maItemList.empty() && mpTabCtrlData->mpListBox == nullptr ) { // Some native toolkits (GTK+) draw tabs right-to-left, with an // overlap between adjacent tabs @@ -1433,7 +1429,7 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt ) void TabControl::Command( const CommandEvent& rCEvt ) { - if( (mpTabCtrlData->mpListBox == NULL) && (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) ) + if( (mpTabCtrlData->mpListBox == nullptr) && (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) ) { Point aMenuPos; bool bMenu; @@ -1885,7 +1881,7 @@ void TabControl::SetTabPage( sal_uInt16 nPageId, TabPage* pTabPage ) { ImplTabItem* pItem = ImplGetItem( nPageId ); - if ( pItem && (pItem->mpTabPage != pTabPage) ) + if ( pItem && (pItem->mpTabPage.get() != pTabPage) ) { if ( pTabPage ) { |