diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-03 14:45:19 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-03 14:45:19 +0000 |
commit | 3480d21093541e4e6a05de277af669e495144ea9 (patch) | |
tree | c73230bc30332652e8195dec508187bf789e4d7d /framework | |
parent | d9bc87dc39665d4d24ecaef15db63bfb1d65cd38 (diff) |
CWS-TOOLING: integrate CWS fwk107_DEV300
2009-03-31 14:56:40 +0200 cd r270283 : #i100707# Correctly implement removeTab() method which destroys the embedded window
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/classes/fwktabwindow.hxx | 1 | ||||
-rw-r--r-- | framework/source/classes/fwktabwindow.cxx | 33 |
2 files changed, 32 insertions, 2 deletions
diff --git a/framework/inc/classes/fwktabwindow.hxx b/framework/inc/classes/fwktabwindow.hxx index c3acfb17f2da..ba6a2522c2c7 100644 --- a/framework/inc/classes/fwktabwindow.hxx +++ b/framework/inc/classes/fwktabwindow.hxx @@ -117,6 +117,7 @@ private: void ClearEntryList(); TabEntry* FindEntry( sal_Int32 nIndex ) const; + bool RemoveEntry( sal_Int32 nIndex ); DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * ); DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * ); diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx index cd9ff97dc652..a7c6882751ee 100644 --- a/framework/source/classes/fwktabwindow.cxx +++ b/framework/source/classes/fwktabwindow.cxx @@ -250,6 +250,28 @@ void FwkTabWindow::ClearEntryList() // ----------------------------------------------------------------------- +bool FwkTabWindow::RemoveEntry( sal_Int32 nIndex ) +{ + TabEntryList::iterator pIt; + for ( pIt = m_TabList.begin(); + pIt != m_TabList.end(); + ++pIt ) + { + if ( (*pIt)->m_nIndex == nIndex ) + break; + } + + // remove entry from vector + if ( pIt != m_TabList.end()) + { + m_TabList.erase(pIt); + return true; + } + else + return false; +} + +// ----------------------------------------------------------------------- TabEntry* FwkTabWindow::FindEntry( sal_Int32 nIndex ) const { TabEntry* pEntry = NULL; @@ -281,9 +303,10 @@ IMPL_LINK( FwkTabWindow, ActivatePageHdl, TabControl *, EMPTYARG ) if ( pEntry ) { pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_xEventHdl, m_xWinProvider ); + pEntry->m_pPage = pTabPage; + m_aTabCtrl.SetTabPage( nId, pTabPage ); pTabPage->Show(); pTabPage->ActivatePage(); - m_aTabCtrl.SetTabPage( nId, pTabPage ); } } else { pTabPage->ActivatePage(); @@ -371,7 +394,13 @@ void FwkTabWindow::ActivatePage( sal_Int32 nIndex ) void FwkTabWindow::RemovePage( sal_Int32 nIndex ) { - m_aTabCtrl.RemovePage( static_cast< USHORT >( nIndex ) ); + TabEntry* pEntry = FindEntry(nIndex); + if ( pEntry ) + { + m_aTabCtrl.RemovePage( static_cast< USHORT >( nIndex ) ); + if (RemoveEntry(nIndex)) + delete pEntry; + } } // ----------------------------------------------------------------------- |