Tag: cws_src680_dba201a User: fs Date: 05/05/10 06:12:14 Modified: /dba/dbaccess/source/ui/dlg/ generalpage.cxx, generalpage.hxx
Log: #i45899# make the data source type listbox a pointer, to be able to clean it up in the dtor File Changes: Directory: /dba/dbaccess/source/ui/dlg/ ======================================= File [changed]: generalpage.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/generalpage.cxx?r1=1.41&r2=1.41.72.1 Delta lines: +32 -27 --------------------- --- generalpage.cxx 21 Jan 2005 17:15:41 -0000 1.41 +++ generalpage.cxx 10 May 2005 13:12:06 -0000 1.41.72.1 @@ -2,9 +2,9 @@ * * $RCSfile: generalpage.cxx,v $ * - * $Revision: 1.41 $ + * $Revision: 1.41.72.1 $ * - * last change: $Author: kz $ $Date: 2005/01/21 17:15:41 $ + * last change: $Author: fs $ $Date: 2005/05/10 13:12:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -124,7 +124,7 @@ ,m_aTypePostLabel (this, ResId(FT_DATASOURCETYPE_POST)) ,m_aSpecialMessage (this, ResId(FT_SPECIAL_MESSAGE)) ,m_aDatasourceTypeLabel (this, ResId(FT_DATATYPE)) - ,m_aDatasourceType (this, ResId(LB_DATATYPE)) + ,m_pDatasourceType ( new ListBox(this, ResId(LB_DATATYPE))) ,m_aFT_DatasourceTypeHeader (this, ResId(FT_DATASOURCEHEADER)) ,m_aRB_CreateDatabase (this, ResId(RB_CREATEDBDATABASE)) ,m_aRB_GetExistingDatabase (this, ResId(RB_GETEXISTINGDATABASE)) @@ -151,17 +151,22 @@ DBG_ASSERT(m_pCollection, "OGeneralPage::OGeneralPage : really need a DSN type collection !"); // do some knittings - m_aDatasourceType.SetSelectHdl(LINK(this, OGeneralPage, OnDatasourceTypeSelected)); + m_pDatasourceType->SetSelectHdl(LINK(this, OGeneralPage, OnDatasourceTypeSelected)); m_aRB_CreateDatabase.SetClickHdl(LINK(this, OGeneralPage, OnSetupModeSelected)); m_aRB_GetExistingDatabase.SetClickHdl(LINK(this, OGeneralPage, OnSetupModeSelected)); m_aRB_CreateDatabase.Check(); } + //------------------------------------------------------------------------- + OGeneralPage::~OGeneralPage() + { + m_pDatasourceType = ::std::auto_ptr< ListBox >(); + } //------------------------------------------------------------------------- void OGeneralPage::initializeTypeList() { - m_aDatasourceType.Clear(); + m_pDatasourceType->Clear(); Reference< XDriverAccess > xDriverManager; @@ -199,7 +204,7 @@ continue; } String sDisplayName = aTypeLoop.getDisplayName(); - if ( m_aDatasourceType.GetEntryPos( sDisplayName ) == LISTBOX_ENTRY_NOTFOUND ) + if ( m_pDatasourceType->GetEntryPos( sDisplayName ) == LISTBOX_ENTRY_NOTFOUND ) { sDisplayName = VerifyDisplayName(eType, sDisplayName); if (sDisplayName.Len() > 0) @@ -260,8 +265,8 @@ void OGeneralPage::GetFocus() { OGenericAdministrationPage::GetFocus(); - if (m_aDatasourceType.IsEnabled()) - m_aDatasourceType.GrabFocus(); + if (m_pDatasourceType.get() && m_pDatasourceType->IsEnabled()) + m_pDatasourceType->GrabFocus(); } //------------------------------------------------------------------------- @@ -310,7 +315,7 @@ void OGeneralPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue) { initializeHistory(); -// if (m_aDatasourceType.GetEntryCount() > 0) +// if (m_pDatasourceType->GetEntryCount() > 0) // return; initializeTypeList(); @@ -323,12 +328,12 @@ m_aTypePostLabel.Hide(); m_aSpecialMessage.Hide(); m_aDatasourceTypeLabel.SetPosPixel( MovePoint( m_aRB_GetExistingDatabase.GetPosPixel(), 10, 14 ) ); - m_aDatasourceType.SetPosPixel( MovePoint( m_aRB_GetExistingDatabase.GetPosPixel(), 90, 12) ); + m_pDatasourceType->SetPosPixel( MovePoint( m_aRB_GetExistingDatabase.GetPosPixel(), 90, 12) ); m_aFTDataSourceAppendix.SetPosPixel( MovePoint(m_aRB_GetExistingDatabase.GetPosPixel(), 162, 14) ); SetControlFontWeight(&m_aFTHeaderText); SetText(::rtl::OUString::createFromAscii("")); m_aDatasourceTypeLabel.Enable(bValid && m_aRB_GetExistingDatabase.IsChecked()); - m_aDatasourceType.Enable(bValid && m_aRB_GetExistingDatabase.IsChecked()); + m_pDatasourceType->Enable(bValid && m_aRB_GetExistingDatabase.IsChecked()); m_aFTDataSourceAppendix.Enable(bValid && m_aRB_GetExistingDatabase.IsChecked()); m_bEntryCreationMode = IsDatabaseToBeCreated(); } @@ -342,7 +347,7 @@ m_aTypePreLabel.Enable(bValid); m_aTypePostLabel.Enable(bValid); m_aDatasourceTypeLabel.Enable(bValid); - m_aDatasourceType.Enable(bValid); + m_pDatasourceType->Enable(bValid); } // if the selection is invalid, disable evrything String sName,sConnectURL; @@ -373,7 +378,7 @@ } sDisplayName = VerifyDisplayName(m_eCurrentSelection, sDisplayName); // select the correct datasource type - if (LISTBOX_ENTRY_NOTFOUND == m_aDatasourceType.GetEntryPos(sDisplayName)) + if (LISTBOX_ENTRY_NOTFOUND == m_pDatasourceType->GetEntryPos(sDisplayName)) { // the type is not available on this platform (we omitted it in initializeTypeList) if (sDisplayName.Len()) { // this indicates it's really a type which is known in general, but not supported on the current platform @@ -387,7 +392,7 @@ } if (m_aRB_CreateDatabase.IsChecked() && m_DBWizardMode) sDisplayName = m_pCollection->getTypeDisplayName(DST_DBASE); - m_aDatasourceType.SelectEntry(sDisplayName); + m_pDatasourceType->SelectEntry(sDisplayName); // notify our listener that our type selection has changed (if so) if ( eOldSelection != m_eCurrentSelection ) @@ -424,8 +429,8 @@ void OGeneralPage::insertDatasourceTypeEntryData(DATASOURCE_TYPE _eType, String sDisplayName) { // insert a (temporary) entry - sal_uInt16 nPos = m_aDatasourceType.InsertEntry(sDisplayName); - m_aDatasourceType.SetEntryData(nPos, reinterpret_cast<void*>(_eType)); + sal_uInt16 nPos = m_pDatasourceType->InsertEntry(sDisplayName); + m_pDatasourceType->SetEntryData(nPos, reinterpret_cast<void*>(_eType)); } @@ -441,7 +446,7 @@ // ----------------------------------------------------------------------- void OGeneralPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList) { - _rControlList.push_back(new OSaveValueWrapper<ListBox>(&m_aDatasourceType)); + _rControlList.push_back(new OSaveValueWrapper<ListBox>(m_pDatasourceType.get())); } //------------------------------------------------------------------------- @@ -482,12 +487,12 @@ } else { - USHORT nEntry = m_aDatasourceType.GetSelectEntryPos(); - DATASOURCE_TYPE eSelectedType = static_cast<DATASOURCE_TYPE>(reinterpret_cast<sal_Int32>(m_aDatasourceType.GetEntryData(nEntry))); + USHORT nEntry = m_pDatasourceType->GetSelectEntryPos(); + DATASOURCE_TYPE eSelectedType = static_cast<DATASOURCE_TYPE>(reinterpret_cast<sal_Int32>(m_pDatasourceType->GetEntryData(nEntry))); if (m_DBWizardMode) { sal_Bool bCurCreationMode = IsDatabaseToBeCreated(); - if (( m_aDatasourceType.GetSavedValue() != nEntry) || (bCurCreationMode != m_bEntryCreationMode)) + if (( m_pDatasourceType->GetSavedValue() != nEntry) || (bCurCreationMode != m_bEntryCreationMode)) { _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix(eSelectedType))); bChangedSomething = sal_True; @@ -497,7 +502,7 @@ } else { - if ( m_aDatasourceType.GetSavedValue() != nEntry) + if ( m_pDatasourceType->GetSavedValue() != nEntry) { _rCoreAttrs.Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getDatasourcePrefix(eSelectedType))); bChangedSomething = sal_True; @@ -528,17 +533,17 @@ String sDisplayName; sal_Bool bEnable = m_aRB_GetExistingDatabase.IsChecked(); m_aDatasourceTypeLabel.Enable(bEnable); - m_aDatasourceType.Enable(bEnable); + m_pDatasourceType->Enable(bEnable); m_aFTDataSourceAppendix.Enable(bEnable); if (!bEnable) sDisplayName = m_pCollection->getTypeDisplayName(DST_DBASE); else sDisplayName = m_pCollection->getTypeDisplayName(m_eCurrentSelection); - USHORT n = m_aDatasourceType.GetEntryPos(sDisplayName); - if ((n < m_aDatasourceType.GetEntryCount()) && (n >= 0)) - m_aDatasourceType.SelectEntry(sDisplayName); + USHORT n = m_pDatasourceType->GetEntryPos(sDisplayName); + if ((n < m_pDatasourceType->GetEntryCount()) && (n >= 0)) + m_pDatasourceType->SelectEntry(sDisplayName); else - m_aDatasourceType.SelectEntry(m_sMySQLEntry); + m_pDatasourceType->SelectEntry(m_sMySQLEntry); if ( m_aCreationModeHandler.IsSet() ) m_aCreationModeHandler.Call(this); return 1L; File [changed]: generalpage.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/generalpage.hxx?r1=1.13&r2=1.13.104.1 Delta lines: +8 -3 ------------------- --- generalpage.hxx 29 Oct 2004 13:16:53 -0000 1.13 +++ generalpage.hxx 10 May 2005 13:12:08 -0000 1.13.104.1 @@ -2,9 +2,9 @@ * * $RCSfile: generalpage.hxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.13.104.1 $ * - * last change: $Author: rt $ $Date: 2004/10/29 13:16:53 $ + * last change: $Author: fs $ $Date: 2005/05/10 13:12:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,6 +74,9 @@ #ifndef _SV_EDIT_HXX #include <vcl/edit.hxx> #endif + +#include <memory> + //......................................................................... namespace dbaui { @@ -86,6 +89,7 @@ { OGeneralPage(Window* pParent, const SfxItemSet& _rItems, sal_Bool _bDBWizardMode = sal_False); // OGeneralPage(Window* pParent, const SfxItemSet& _rItems, sal_Bool _bDBWizardMode = false); + ~OGeneralPage(); private: // dialog controls @@ -96,7 +100,8 @@ RadioButton m_aRB_GetExistingDatabase; FixedText m_aTypePreLabel; FixedText m_aDatasourceTypeLabel; - ListBox m_aDatasourceType; + ::std::auto_ptr< ListBox > + m_pDatasourceType; FixedText m_aFTDataSourceAppendix; FixedText m_aTypePostLabel; FixedText m_aSpecialMessage; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
