Tag: cws_src680_mozab05 User: windly Date: 05/01/16 23:54:40 Modified: /dba/dbaccess/source/ui/dlg/ dbwizsetup.cxx
Log: RESYNC: (1.3-1.7); FILE MERGED 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.3.6.2&r2=1.3.6.3 Delta lines: +116 -43 ---------------------- --- dbwizsetup.cxx 14 Jan 2005 10:39:06 -0000 1.3.6.2 +++ dbwizsetup.cxx 17 Jan 2005 07:54:37 -0000 1.3.6.3 @@ -171,9 +171,27 @@ #ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ #include <com/sun/star/sdb/CommandType.hpp> #endif +#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP_ +#include <com/sun/star/ucb/InteractiveIOException.hpp> +#endif +#ifndef _COM_SUN_STAR_IO_IOEXCEPTION_HPP_ +#include <com/sun/star/io/IOException.hpp> +#endif #ifndef SVTOOLS_FILENOTATION_HXX_ #include <svtools/filenotation.hxx> #endif +#ifndef _COMPHELPER_INTERACTION_HXX_ +#include <comphelper/interaction.hxx> +#endif + +#ifndef _COM_SUN_STAR_UCB_IOERRORCODE_HPP_ +#include <com/sun/star/ucb/IOErrorCode.hpp> +#endif +#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_ +#include <com/sun/star/task/XInteractionHandler.hpp> +#endif + + @@ -189,12 +207,14 @@ using namespace com::sun::star::sdbcx; using namespace com::sun::star::task; using namespace com::sun::star::lang; +using namespace com::sun::star::io; using namespace com::sun::star::util; using namespace com::sun::star::beans; using namespace com::sun::star::container; -using namespace ::com::sun::star::frame; -namespace css = com::sun::star; -namespace ucb = css::ucb; +using namespace com::sun::star::frame; +using namespace com::sun::star::ucb; +using namespace ::comphelper; +using namespace ::cppu; #define START_PAGE 0 #define CONNECTION_PAGE 1 @@ -891,6 +911,9 @@ //------------------------------------------------------------------------- sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { + Reference< XInteractionHandler > xHandler(getORB()->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY); + try + { if (callSaveAsDialog() == sal_True) { m_pImpl->saveChanges(*m_pOutSet); @@ -906,7 +929,43 @@ CreateDatabase(); } Reference< XModel > xModel(xStore, UNO_QUERY); - xStore->storeAsURL(sPath,xModel->getArgs()); + + Sequence<PropertyValue> aArgs = xModel->getArgs(); + + 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; + } + + } + 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); xComponent->dispose(); if (pFinalPage != NULL) { @@ -923,6 +982,19 @@ return sal_True; } } + } + catch (Exception& e) + { + InteractiveIOException aRequest; + aRequest.Code = IOErrorCode_GENERAL; + OInteractionRequest * pRequest = new OInteractionRequest (makeAny (aRequest)); + Reference < XInteractionRequest > xRequest(pRequest ); + OInteractionAbort* pAbort = new OInteractionAbort; + pRequest ->addContinuation (pAbort ); + if ( xHandler.is() ) + xHandler->handle( xRequest ); + e; // make compiler happy + } return sal_False; } @@ -943,7 +1015,7 @@ } if ( eType == DST_DBASE ) { - Reference< ucb::XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY); + Reference< XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY); INetURLObject aDBPathURL(m_sWorkPath); aDBPathURL.Append(m_aDocURL.getBase()); createUniqueFolderName(&aDBPathURL); @@ -956,6 +1028,7 @@ } m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, sUrl)); m_pImpl->saveChanges(*m_pOutSet); + } //------------------------------------------------------------------------- @@ -1025,15 +1098,15 @@ aWorkURL.setExtension(sExtension); createUniqueFileName(&aWorkURL); aFileDlg.SetDisplayDirectory( aWorkURL.GetMainURL( INetURLObject::NO_DECODE )); - aFileDlg.AddFilter(pFilter->GetFilterName(),pFilter->GetDefaultExtension()); - aFileDlg.SetCurrentFilter(pFilter->GetFilterName()); + aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension()); + aFileDlg.SetCurrentFilter(pFilter->GetUIName()); } Reference< XNameAccess > xDatabaseContext(getORB()->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY); if ( xDatabaseContext.is() ) { if ( aFileDlg.Execute() == ERRCODE_NONE ) { - m_aDocURL = aFileDlg.GetPath(); + m_aDocURL = INetURLObject(aFileDlg.GetPath()); if( m_aDocURL.GetProtocol() != INET_PROT_NOT_VALID ) { @@ -1052,7 +1125,7 @@ //------------------------------------------------------------------------- void ODbTypeWizDialogSetup::createUniqueFolderName(INetURLObject* pURL) { - Reference< ucb::XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY); + Reference< XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY); :: rtl::OUString sLastSegmentName = pURL->getName(); sal_Bool bFolderExists = sal_True; sal_Int32 i = 1; @@ -1072,7 +1145,7 @@ //------------------------------------------------------------------------- void ODbTypeWizDialogSetup::createUniqueFileName(INetURLObject* pURL) { - Reference< ucb::XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY); + Reference< XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" )), UNO_QUERY); :: rtl::OUString sFilename = pURL->getName(); ::rtl::OUString BaseName = pURL->getBase(); ::rtl::OUString sExtension = pURL->getExtension(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
