Tag: cws_dev300_odbmacros3 User: fs Date: 2008-07-23 10:04:24+0000 Modified: dba/dbaccess/source/ui/dlg/dbwizsetup.cxx
Log: slight refactoring during #i76128# File Changes: Directory: /dba/dbaccess/source/ui/dlg/ ======================================= File [changed]: dbwizsetup.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/dbwizsetup.cxx?r1=1.34&r2=1.34.4.1 Delta lines: +22 -66 --------------------- --- dbwizsetup.cxx 2008-05-05 15:57:33+0000 1.34 +++ dbwizsetup.cxx 2008-07-23 10:04:21+0000 1.34.4.1 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dbwizsetup.cxx,v $ - * $Revision: 1.34 $ + * $Revision: 1.34.4.1 $ * * This file is part of OpenOffice.org. * @@ -912,76 +912,32 @@ //------------------------------------------------------------------------- sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { - Reference< XInteractionHandler > xHandler(getORB()->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY); + Reference< XInteractionHandler > xHandler( getORB()->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); try { if (callSaveAsDialog() == sal_True) { m_pImpl->saveChanges(*m_pOutSet); Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource(); -#if OSL_DEBUG_LEVEL > 0 - SFX_ITEMSET_GET(*m_pOutSet, pDocUrl, SfxStringItem, DSID_DOCUMENT_URL, sal_True); - (void)pDocUrl; -#endif - Reference<XStorable> xStore(getDataSourceOrModel(xDatasource),UNO_QUERY); - Reference<XComponent> xComponent(xStore,UNO_QUERY); - ::rtl::OUString sPath = m_pImpl->getDocumentUrl(*m_pOutSet); - if ( xStore.is() ) - { + Reference< XModel > xModel( getDataSourceOrModel( xDatasource ), UNO_QUERY_THROW ); + Reference< XStorable > xStore( xModel, UNO_QUERY_THROW ); + if ( m_pGeneralPage->GetDatabaseCreationMode() == OGeneralPage::eCreateNew ) CreateDatabase(); - Reference< XModel > xModel(xStore, UNO_QUERY); - Sequence<PropertyValue> aArgs = xModel->getArgs(); + ::comphelper::NamedValueCollection aArgs( xModel->getArgs() ); + aArgs.put( "Overwrite", sal_Bool( sal_True ) ); + aArgs.put( "InteractionHandler", xHandler ); - sal_Bool bOverwrite = sal_True; - sal_Bool bAddOverwrite = sal_True; - sal_Bool bAddInteractionHandler = sal_True; - PropertyValue* pIter = aArgs.getArray(); - PropertyValue* pEnd = pIter + aArgs.getLength(); - for(;pIter != pEnd;++pIter) - { - if ( pIter->Name.equalsAscii("Overwrite") ) - { - pIter->Value <<= bOverwrite; - bAddOverwrite = sal_False; - } - if ( pIter->Name.equalsAscii("InteractionHandler") ) - { - pIter->Value <<= xHandler; - bAddInteractionHandler = sal_False; - } + ::rtl::OUString sPath = m_pImpl->getDocumentUrl( *m_pOutSet ); + xStore->storeAsURL( sPath, aArgs.getPropertyValues() ); - } - if ( bAddOverwrite ) - { - sal_Int32 nLen = aArgs.getLength(); - aArgs.realloc(nLen+1); - aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Overwrite")); - aArgs[nLen].Value <<= bOverwrite; - } - if ( bAddInteractionHandler ) - { - sal_Int32 nLen = aArgs.getLength(); - aArgs.realloc(nLen+1); - aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")); - aArgs[nLen].Value <<= xHandler; - } - xStore->storeAsURL(sPath,aArgs); + if ( !pFinalPage || pFinalPage->IsDatabaseDocumentToBeRegistered() ) + RegisterDataSourceByLocation( sPath ); - if (pFinalPage != NULL) - { - if (pFinalPage->IsDatabaseDocumentToBeRegistered()) - RegisterDataSourceByLocation(sPath); - } - else - { - RegisterDataSourceByLocation(sPath); - } return sal_True; } } - } catch (Exception& e) { InteractiveIOException aRequest; @@ -1315,10 +1271,10 @@ skipUntil(PAGE_DBSETUPWIZARD_FINAL); } if (getCurrentState() == PAGE_DBSETUPWIZARD_FINAL) - return SaveDatabaseDocument() ? OWizardMachine::onFinish(_nResult) : sal_False; + return SaveDatabaseDocument() ? OWizardMachine::onFinish( _nResult ) : sal_False; else { - enableButtons( WZB_FINISH, sal_False); + enableButtons( WZB_FINISH, sal_False ); return sal_False; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
