diff options
Diffstat (limited to 'sw/source/ui/uno/unomailmerge.cxx')
-rw-r--r-- | sw/source/ui/uno/unomailmerge.cxx | 82 |
1 files changed, 37 insertions, 45 deletions
diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index 1c4a838ae1ca..e7fd53293082 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> #include <osl/mutex.hxx> #include <svl/itemprop.hxx> #include <svl/urihelper.hxx> @@ -54,9 +54,7 @@ #include <com/sun/star/sdbc/XRowSet.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/util/XCloseable.hpp> -#ifndef _COM_SUN_STAR_UTIL_CloseVetoException_HPP_ #include <com/sun/star/util/CloseVetoException.hpp> -#endif #include <com/sun/star/sdbcx/XRowLocate.hpp> #include <com/sun/star/frame/XStorable.hpp> #include "com/sun/star/mail/XSmtpService.hpp" @@ -70,9 +68,7 @@ #include <unomap.hxx> #include <swunohelper.hxx> #include <docsh.hxx> -#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED #include <IDocumentDeviceAccess.hxx> -#endif #include <view.hxx> #include <dbmgr.hxx> #include <unotxdoc.hxx> @@ -244,7 +240,6 @@ namespace DelayedFileDeletion& operator=( const DelayedFileDeletion& ); // never implemented }; - DBG_NAME( DelayedFileDeletion ) //------------------------------------------------------ DelayedFileDeletion::DelayedFileDeletion( const Reference< XModel >& _rxModel, const String& _rTemporaryFile ) : @@ -252,8 +247,6 @@ namespace ,m_sTemporaryFile( _rTemporaryFile ) ,m_nPendingDeleteAttempts( 0 ) { - DBG_CTOR( DelayedFileDeletion, NULL ); - osl_incrementInterlockedCount( &m_refCount ); try { @@ -264,12 +257,12 @@ namespace acquire(); } else { - DBG_ERROR( "DelayedFileDeletion::DelayedFileDeletion: model is no component!" ); + OSL_FAIL("DelayedFileDeletion::DelayedFileDeletion: model is no component!" ); } } catch( const Exception& ) { - DBG_ERROR( "DelayedFileDeletion::DelayedFileDeletion: could not register as event listener at the model!" ); + OSL_FAIL("DelayedFileDeletion::DelayedFileDeletion: could not register as event listener at the model!" ); } osl_decrementInterlockedCount( &m_refCount ); } @@ -302,7 +295,7 @@ namespace } catch( const Exception& ) { - DBG_ERROR( "DelayedFileDeletion::OnTryDeleteFile: caught a strange exception!" ); + OSL_FAIL("DelayedFileDeletion::OnTryDeleteFile: caught a strange exception!" ); bSuccess = sal_True; // can't do anything here ... } @@ -326,7 +319,7 @@ namespace } catch( const Exception & ) { - DBG_ERROR( "DelayedFileDeletion::implTakeOwnership: could not revoke the listener!" ); + OSL_FAIL("DelayedFileDeletion::implTakeOwnership: could not revoke the listener!" ); } m_aDeleteTimer.SetTimeout( 3000 ); // 3 seconds @@ -350,7 +343,7 @@ namespace //-------------------------------------------------------------------- void SAL_CALL DelayedFileDeletion::notifyClosing( const EventObject& ) throw (RuntimeException) { - DBG_ERROR( "DelayedFileDeletion::notifyClosing: how this?" ); + OSL_FAIL("DelayedFileDeletion::notifyClosing: how this?" ); // this should not happen: // Either, a foreign instance closes the document, then we should veto this, and take the ownership // Or, we ourself close the document, then we should not be a listener anymore @@ -359,7 +352,7 @@ namespace //------------------------------------------------------ void SAL_CALL DelayedFileDeletion::disposing( const EventObject& ) throw (RuntimeException) { - DBG_ERROR( "DelayedFileDeletion::disposing: how this?" ); + OSL_FAIL("DelayedFileDeletion::disposing: how this?" ); // this should not happen: // Either, a foreign instance closes the document, then we should veto this, and take the ownership // Or, we ourself close the document, then we should not be a listener anymore @@ -368,7 +361,6 @@ namespace //------------------------------------------------------ DelayedFileDeletion::~DelayedFileDeletion( ) { - DBG_DTOR( DelayedFileDeletion, NULL ); } } @@ -452,7 +444,7 @@ SwXMailMerge::~SwXMailMerge() //! because there is no automatism that will do that later. //! #120086# if ( eVetoed == CloseModelAndDocSh( xModel, xDocSh ) ) - DBG_WARNING( "owner ship transfered to vetoing object!" ); + OSL_FAIL("owner ship transfered to vetoing object!" ); xModel = 0; xDocSh = 0; // destroy doc shell @@ -463,7 +455,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( const uno::Sequence< beans::NamedValue >& rArguments ) throw (IllegalArgumentException, Exception, RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // // get property values to be used @@ -643,7 +635,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( { if (!aCurDataSourceName.getLength() || !aCurDataCommand.getLength() ) { - DBG_ERROR("PropertyValues missing or unset"); + OSL_FAIL("PropertyValues missing or unset"); throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Either the ResultSet or DataSourceName and DataCommand must be set." ) ), static_cast < cppu::OWeakObject * > ( this ), 0 ); } @@ -657,7 +649,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( C2U( "com.sun.star.sdb.RowSet" )); aRowSetDisposeHelper.reset( xInstance, SharedComponent::TakeOwnership ); Reference< XPropertySet > xRowSetPropSet( xInstance, UNO_QUERY ); - DBG_ASSERT( xRowSetPropSet.is(), "failed to get XPropertySet interface from RowSet" ); + OSL_ENSURE( xRowSetPropSet.is(), "failed to get XPropertySet interface from RowSet" ); if (xRowSetPropSet.is()) { if (xCurConnection.is()) @@ -675,7 +667,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( if( !xCurConnection.is() ) xCurConnection.set( xRowSetPropSet->getPropertyValue( C2U( "ActiveConnection" )), UNO_QUERY ); xCurResultSet = Reference< sdbc::XResultSet >( xRowSet, UNO_QUERY ); - DBG_ASSERT( xCurResultSet.is(), "failed to build ResultSet" ); + OSL_ENSURE( xCurResultSet.is(), "failed to build ResultSet" ); } } } @@ -704,7 +696,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( SwNewDBMgr* pMgr = rSh.GetNewDBMgr(); //force layout creation rSh.CalcLayout(); - DBG_ASSERT( pMgr, "database manager missing" ); + OSL_ENSURE( pMgr, "database manager missing" ); SwMergeDescriptor aMergeDesc( nMergeType, rSh, aDescriptor ); @@ -736,7 +728,6 @@ uno::Any SAL_CALL SwXMailMerge::execute( aCurFileNamePrefix = aURLObj.GetBase(); // filename without extension if (!aCurOutputURL.getLength()) { - //aCurOutputURL = aURLObj.GetURLPath(); aURLObj.removeSegment(); aCurOutputURL = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI ); } @@ -769,7 +760,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( aMergeDesc.aSaveToFilterData = aSaveFilterData; aMergeDesc.bCreateSingleFile = bSaveAsSingleFile; } - else /*if(MailMergeType::MAIL == nCurOutputType)*/ + else { pMgr->SetEMailColumn( sAddressFromColumn ); if(!sAddressFromColumn.getLength()) @@ -823,7 +814,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( pMgr->SetMergeSilent( sal_True ); // suppress dialogs, message boxes, etc. const SwXMailMerge *pOldSrc = pMgr->GetMailMergeEvtSrc(); - DBG_ASSERT( !pOldSrc || pOldSrc == this, "Ooops... different event source already set." ); + OSL_ENSURE( !pOldSrc || pOldSrc == this, "Ooops... different event source already set." ); pMgr->SetMailMergeEvtSrc( this ); // launch events for listeners SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh)); @@ -882,7 +873,7 @@ void SwXMailMerge::launchEvent( const PropertyChangeEvent &rEvt ) const uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXMailMerge::getPropertySetInfo( ) throw (RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; static Reference< XPropertySetInfo > aRef = pPropSet->getPropertySetInfo(); return aRef; } @@ -891,7 +882,7 @@ void SAL_CALL SwXMailMerge::setPropertyValue( const OUString& rPropertyName, const uno::Any& rValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName ); if (!pCur) @@ -936,7 +927,7 @@ void SAL_CALL SwXMailMerge::setPropertyValue( case WID_IN_SERVER_PASSWORD: pData = &sInServerPassword; break; case WID_OUT_SERVER_PASSWORD: pData = &sOutServerPassword; break; default : - DBG_ERROR("unknown WID"); + OSL_FAIL("unknown WID"); } Any aOld( pData, *pType ); @@ -1025,9 +1016,9 @@ void SAL_CALL SwXMailMerge::setPropertyValue( else if(pData == &sOutServerPassword) bOK = rValue >>= sInServerPassword; else { - DBG_ERROR( "invalid pointer" ); + OSL_FAIL("invalid pointer" ); } - DBG_ASSERT( bOK, "set value failed" ); + OSL_ENSURE( bOK, "set value failed" ); bChanged = sal_True; } if (!bOK) @@ -1046,7 +1037,7 @@ uno::Any SAL_CALL SwXMailMerge::getPropertyValue( const OUString& rPropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Any aRet; @@ -1089,7 +1080,7 @@ uno::Any SAL_CALL SwXMailMerge::getPropertyValue( case WID_IN_SERVER_PASSWORD: aRet <<= sInServerPassword; break; case WID_OUT_SERVER_PASSWORD: aRet <<= sOutServerPassword; break; default : - DBG_ERROR("unknown WID"); + OSL_FAIL("unknown WID"); } } @@ -1101,7 +1092,7 @@ void SAL_CALL SwXMailMerge::addPropertyChangeListener( const uno::Reference< beans::XPropertyChangeListener >& rListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (!bDisposing && rListener.is()) { const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName ); @@ -1117,7 +1108,7 @@ void SAL_CALL SwXMailMerge::removePropertyChangeListener( const uno::Reference< beans::XPropertyChangeListener >& rListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (!bDisposing && rListener.is()) { const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName ); @@ -1134,7 +1125,7 @@ void SAL_CALL SwXMailMerge::addVetoableChangeListener( throw (UnknownPropertyException, WrappedTargetException, RuntimeException) { // no vetoable property, thus no support for vetoable change listeners - DBG_WARNING( "not implemented"); + OSL_FAIL("not implemented"); } void SAL_CALL SwXMailMerge::removeVetoableChangeListener( @@ -1143,14 +1134,14 @@ void SAL_CALL SwXMailMerge::removeVetoableChangeListener( throw (UnknownPropertyException, WrappedTargetException, RuntimeException) { // no vetoable property, thus no support for vetoable change listeners - DBG_WARNING( "not implemented"); + OSL_FAIL("not implemented"); } void SAL_CALL SwXMailMerge::dispose() throw(RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (!bDisposing) { @@ -1167,7 +1158,7 @@ void SAL_CALL SwXMailMerge::addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (!bDisposing && rxListener.is()) aEvtListeners.addInterface( rxListener ); } @@ -1176,7 +1167,7 @@ void SAL_CALL SwXMailMerge::removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (!bDisposing && rxListener.is()) aEvtListeners.removeInterface( rxListener ); } @@ -1185,7 +1176,7 @@ void SAL_CALL SwXMailMerge::addMailMergeEventListener( const uno::Reference< XMailMergeListener >& rxListener ) throw (RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (!bDisposing && rxListener.is()) aMergeListeners.addInterface( rxListener ); } @@ -1194,7 +1185,7 @@ void SAL_CALL SwXMailMerge::removeMailMergeEventListener( const uno::Reference< XMailMergeListener >& rxListener ) throw (RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if (!bDisposing && rxListener.is()) aMergeListeners.removeInterface( rxListener ); } @@ -1202,14 +1193,14 @@ void SAL_CALL SwXMailMerge::removeMailMergeEventListener( OUString SAL_CALL SwXMailMerge::getImplementationName() throw(RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return SwXMailMerge_getImplementationName(); } sal_Bool SAL_CALL SwXMailMerge::supportsService( const OUString& rServiceName ) throw(RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return C2U( SN_MAIL_MERGE ) == rServiceName || C2U( SN_DATA_ACCESS_DESCRIPTOR ) == rServiceName; } @@ -1217,7 +1208,7 @@ sal_Bool SAL_CALL SwXMailMerge::supportsService( const OUString& rServiceName ) uno::Sequence< OUString > SAL_CALL SwXMailMerge::getSupportedServiceNames() throw(RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; return SwXMailMerge_getSupportedServiceNames(); } @@ -1243,11 +1234,12 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance( const uno::Reference< XMultiServiceFactory > & /*rSMgr*/) throw( uno::Exception ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; //the module may not be loaded - SwDLL::Init(); + SwGlobals::ensure(); uno::Reference< uno::XInterface > xRef = (cppu::OWeakObject *) new SwXMailMerge(); return xRef; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |