summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-04-03 14:45:19 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-04-03 14:45:19 +0000
commit1b07da60d0baeddfe35cda653fb96852c1b5e6d9 (patch)
tree52e91ad679f021c9146b770e95fa163fd3dc91b2
parenta904c1e2062a6ff1f423a431359b0044ca5d7560 (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
-rw-r--r--framework/inc/classes/fwktabwindow.hxx1
-rw-r--r--framework/source/classes/fwktabwindow.cxx33
2 files changed, 32 insertions, 2 deletions
diff --git a/framework/inc/classes/fwktabwindow.hxx b/framework/inc/classes/fwktabwindow.hxx
index a0247dfb2c..166c9377ef 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 5515eae642..a294edf2bc 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;
+ }
}
// -----------------------------------------------------------------------