|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
|||||
|
||||||
001 /************************************************************************* 002 * 003 * OpenOffice.org - a multi-platform office productivity suite 004 * 005 * $RCSfile: unomailmerge.cxx,v $ 006 * 007 * $Revision: 1.23 $ 008 * 009 * last change: $Author: hr $ $Date: 2007/09/27 12:42:59 $ 010 * 011 * The Contents of this file are made available subject to 012 * the terms of GNU Lesser General Public License Version 2.1. 013 * 014 * 015 * GNU Lesser General Public License Version 2.1 016 * ============================================= 017 * Copyright 2005 by Sun Microsystems, Inc. 018 * 901 San Antonio Road, Palo Alto, CA 94303, USA 019 * 020 * This library is free software; you can redistribute it and/or 021 * modify it under the terms of the GNU Lesser General Public 022 * License version 2.1, as published by the Free Software Foundation. 023 * 024 * This library is distributed in the hope that it will be useful, 025 * but WITHOUT ANY WARRANTY; without even the implied warranty of 026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 027 * Lesser General Public License for more details. 028 * 029 * You should have received a copy of the GNU Lesser General Public 030 * License along with this library; if not, write to the Free Software 031 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 032 * MA 02111-1307 USA 033 * 034 ************************************************************************/ 035 036 // MARKER(update_precomp.py): autogen include statement, do not remove 037 #include "precompiled_sw.hxx" 038 039 040 #ifndef _SV_SVAPP_HXX 041 #include <vcl/svapp.hxx> 042 #endif 043 #ifndef _VOS_MUTEX_HXX_ 044 #include <vos/mutex.hxx> 045 #endif 046 #ifndef _OSL_MUTEX_HXX_ 047 #include <osl/mutex.hxx> 048 #endif 049 #ifndef _SFX_ITEMPROP_HXX 050 #include <svtools/itemprop.hxx> 051 #endif 052 #ifndef SVTOOLS_URIHELPER_HXX 053 #include <svtools/urihelper.hxx> 054 #endif 055 #ifndef _SVX_DATACCESSDESCRIPTOR_HXX_ 056 #include <svx/dataaccessdescriptor.hxx> 057 #endif 058 #ifndef _SHL_HXX 059 #include <tools/shl.hxx> // GetAppData 060 #endif 061 #ifndef _TOOLS_TEMPFILE_HXX 062 #include <tools/tempfile.hxx> 063 #endif 064 #ifndef _SFXAPP_HXX 065 #include <sfx2/app.hxx> 066 #endif 067 #ifndef _SFXDOCFILE_HXX 068 #include <sfx2/docfile.hxx> 069 #endif 070 #ifndef _SFX_DOCFILT_HACK_HXX 071 #include <sfx2/docfilt.hxx> 072 #endif 073 #ifndef _COMPHELPER_PROCESSFACTORY_HXX_ 074 #include <comphelper/processfactory.hxx> 075 #endif 076 #ifndef _SV_TIMER_HXX 077 #include <vcl/timer.hxx> 078 #endif 079 080 #ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_ 081 #include <com/sun/star/sdb/CommandType.hpp> 082 #endif 083 #ifndef _COM_SUN_STAR_TEXT_MAILMERGETYPE_HPP_ 084 #include <com/sun/star/text/MailMergeType.hpp> 085 #endif 086 #ifndef _COM_SUN_STAR_TEXT_MAILMERGEEVENT_HPP_ 087 #include <com/sun/star/text/MailMergeEvent.hpp> 088 #endif 089 #ifndef _COM_SUN_STAR_TEXT_XMAILMERGELISTENER_HPP_ 090 #include <com/sun/star/text/XMailMergeListener.hpp> 091 #endif 092 #ifndef _COM_SUN_STAR_TEXT_XMAILMERGEBROADCASTER_HPP_ 093 #include <com/sun/star/text/XMailMergeBroadcaster.hpp> 094 #endif 095 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ 096 #include <com/sun/star/beans/PropertyAttribute.hpp> 097 #endif 098 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ 099 #include <com/sun/star/lang/XUnoTunnel.hpp> 100 #endif 101 #ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_ 102 #include <com/sun/star/sdbc/XResultSet.hpp> 103 #endif 104 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ 105 #include <com/sun/star/sdbc/XConnection.hpp> 106 #endif 107 #ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_ 108 #include <com/sun/star/sdbc/XRowSet.hpp> 109 #endif 110 #ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_ 111 #include <com/sun/star/frame/XComponentLoader.hpp> 112 #endif 113 #ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_ 114 #include <com/sun/star/util/XCloseable.hpp> 115 #endif 116 #ifndef _COM_SUN_STAR_UTIL_CloseVetoException_HPP_ 117 #include <com/sun/star/util/CloseVetoException.hpp> 118 #endif 119 #ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_ 120 #include <com/sun/star/sdbcx/XRowLocate.hpp> 121 #endif 122 #ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_ 123 #include <com/sun/star/frame/XStorable.hpp> 124 #endif 125 #ifndef _COM_SUN_STAR_MAIL_XSMTPSERVICE_HPP_ 126 #include "com/sun/star/mail/XSmtpService.hpp" 127 #endif 128 #include <sfx2/viewfrm.hxx> 129 #ifndef _SFXEVENT_HXX 130 #include <sfx2/event.hxx> 131 #endif 132 #ifndef _SWEVENT_HXX 133 #include <swevent.hxx> 134 #endif 135 #ifndef _UNOMAILMERGE_HXX_ 136 #include <unomailmerge.hxx> 137 #endif 138 #ifndef SW_SWDLL_HXX 139 #include <swdll.hxx> 140 #endif 141 #ifndef _SWMODULE_HXX 142 #include <swmodule.hxx> 143 #endif 144 #ifndef _UNOPRNMS_HXX 145 #include <unoprnms.hxx> 146 #endif 147 #ifndef _UNOMAP_HXX 148 #include <unomap.hxx> 149 #endif 150 #ifndef _SWUNOHELPER_HXX 151 #include <swunohelper.hxx> 152 #endif 153 #ifndef _SWDOCSH_HXX 154 #include <docsh.hxx> 155 #endif 156 #ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED 157 #include <IDocumentDeviceAccess.hxx> 158 #endif 159 #ifndef _SWVIEW_HXX 160 #include <view.hxx> 161 #endif 162 #ifndef _SWDBMGR_HXX 163 #include <dbmgr.hxx> 164 #endif 165 #ifndef _UNOTXDOC_HXX 166 #include <unotxdoc.hxx> 167 #endif 168 #ifndef _PRTOPT_HXX 169 #include <prtopt.hxx> 170 #endif 171 #ifndef _WRTSH_HXX 172 #include <wrtsh.hxx> 173 #endif 174 #ifndef _SHELLIO_HXX 175 #include <shellio.hxx> 176 #endif 177 #ifndef _MMCONFIGITEM_HXX 178 #include <mmconfigitem.hxx> 179 #endif 180 #ifndef _MAILMERGEHELPER_HXX 181 #include <mailmergehelper.hxx> 182 #endif 183 #include <memory> 184 185 #include <unomid.h> 186 187 188 #define SN_MAIL_MERGE "com.sun.star.text.MailMerge" 189 #define SN_DATA_ACCESS_DESCRIPTOR "com.sun.star.sdb.DataAccessDescriptor" 190 191 using namespace ::com::sun::star; 192 using namespace ::com::sun::star::frame; 193 using namespace ::com::sun::star::uno; 194 using namespace ::com::sun::star::lang; 195 using namespace ::com::sun::star::beans; 196 using namespace ::com::sun::star::text; 197 using ::rtl::OUString; 198 using namespace SWUnoHelper; 199 200 //////////////////////////////////////////////////////////// 201 202 typedef ::utl::SharedUNOComponent< XInterface > SharedComponent; 203 204 //////////////////////////////////////////////////////////// 205 206 osl::Mutex & GetMailMergeMutex() 207 { 208 static osl::Mutex aMutex; 209 return aMutex; 210 } 211 212 //////////////////////////////////////////////////////////// 213 214 enum CloseResult 215 { 216 eSuccess, // successfully closed 217 eVetoed, // vetoed, ownership transfered to the vetoing instance 218 eFailed // failed for some unknown reason 219 }; 220 static CloseResult CloseModelAndDocSh( 221 Reference< frame::XModel > &rxModel, 222 SfxObjectShellRef &rxDocSh ) 223 { 224 CloseResult eResult = eSuccess; 225 226 rxDocSh = 0; 227 228 //! models/documents should never be disposed (they may still be 229 //! used for printing which is called asynchronously for example) 230 //! instead call close 231 Reference< util::XCloseable > xClose( rxModel, UNO_QUERY ); 232 if (xClose.is()) 233 { 234 try 235 { 236 //! 'sal_True' -> transfer ownership to vetoing object if vetoed! 237 //! I.e. now that object is responsible for closing the model and doc shell. 238 xClose->close( sal_True ); 239 } 240 catch (util::CloseVetoException &) 241 { 242 //! here we have the problem that the temporary file that is 243 //! currently being printed will never be deleted. :-( 244 eResult = eVetoed; 245 } 246 catch ( const uno::RuntimeException& ) 247 { 248 eResult = eFailed; 249 } 250 } 251 return eResult; 252 } 253 254 //////////////////////////////////////////////////////////// 255 256 static BOOL LoadFromURL_impl( 257 Reference< frame::XModel > &rxModel, 258 SfxObjectShellRef &rxDocSh, 259 const String &rURL, 260 BOOL bClose ) 261 throw (RuntimeException) 262 { 263 // try to open the document readonly and hidden 264 Reference< frame::XModel > xTmpModel; 265 Sequence < PropertyValue > aArgs( 1 ); 266 aArgs[0].Name = C2U("Hidden"); 267 sal_Bool bVal = sal_True; 268 aArgs[0].Value <<= bVal; 269 try 270 { 271 Reference < XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()-> 272 createInstance( C2U("com.sun.star.frame.Desktop") ), UNO_QUERY ); 273 xTmpModel = Reference < XModel >( xDesktop->loadComponentFromURL( 274 rURL, C2U("_blank"), 0, aArgs ), UNO_QUERY ); 275 } 276 catch( Exception & ) 277 { 278 return FALSE; 279 } 280 281 // try to get the DocShell 282 SwDocShell *pTmpDocShell = 0; 283 Reference < XUnoTunnel > xTunnel( xTmpModel, UNO_QUERY ); 284 if (xTunnel.is()) 285 { 286 SwXTextDocument* pTextDoc = reinterpret_cast<SwXTextDocument *>( 287 xTunnel->getSomething( SwXTextDocument::getUnoTunnelId() )); 288 pTmpDocShell = pTextDoc ? pTextDoc->GetDocShell() : 0; 289 } 290 291 BOOL bRes = FALSE; 292 if (xTmpModel.is() && pTmpDocShell) // everything available? 293 { 294 if (bClose) 295 CloseModelAndDocSh( rxModel, rxDocSh ); 296 // set new stuff 297 rxModel = xTmpModel; 298 rxDocSh = pTmpDocShell; 299 bRes = TRUE; 300 } 301 else 302 { 303 SfxObjectShellRef xTmpDocSh = pTmpDocShell; 304 CloseModelAndDocSh( xTmpModel, xTmpDocSh ); 305 } 306 307 return bRes; 308 } 309 310 //========================================================== 311 namespace 312 { 313 class DelayedFileDeletion : public ::cppu::WeakImplHelper1< util::XCloseListener > 314 { 315 protected: 316 ::osl::Mutex m_aMutex; 317 Reference< util::XCloseable > m_xDocument; 318 Timer m_aDeleteTimer; 319 String m_sTemporaryFile; 320 sal_Int32 m_nPendingDeleteAttempts; 321 322 public: 323 DelayedFileDeletion( const Reference< XModel >& _rxModel, 324 const String& _rTemporaryFile ); 325 326 protected: 327 ~DelayedFileDeletion( ); 328 329 // XCloseListener 330 virtual void SAL_CALL queryClosing( const EventObject& _rSource, sal_Bool _bGetsOwnership ) throw (util::CloseVetoException, RuntimeException); 331 virtual void SAL_CALL notifyClosing( const EventObject& _rSource ) throw (RuntimeException); 332 333 // XEventListener 334 virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException); 335 336 private: 337 void implTakeOwnership( ); 338 DECL_LINK( OnTryDeleteFile, void* ); 339 340 private: 341 DelayedFileDeletion( const DelayedFileDeletion& ); // never implemented 342 DelayedFileDeletion& operator=( const DelayedFileDeletion& ); // never implemented 343 }; 344 345 DBG_NAME( DelayedFileDeletion ) 346 //------------------------------------------------------ 347 DelayedFileDeletion::DelayedFileDeletion( const Reference< XModel >& _rxModel, const String& _rTemporaryFile ) 348 : 349 m_xDocument( _rxModel, UNO_QUERY ) 350 ,m_sTemporaryFile( _rTemporaryFile ) 351 ,m_nPendingDeleteAttempts( 0 ) 352 { 353 DBG_CTOR( DelayedFileDeletion, NULL ); 354 355 osl_incrementInterlockedCount( &m_refCount ); 356 try 357 { 358 if ( m_xDocument.is() ) 359 { 360 m_xDocument->addCloseListener( this ); 361 // successfully added -> keep ourself alive 362 acquire(); 363 } 364 else 365 DBG_ERROR( "DelayedFileDeletion::DelayedFileDeletion: model is no component!" ); 366 } 367 catch( const Exception& ) 368 { 369 DBG_ERROR( "DelayedFileDeletion::DelayedFileDeletion: could not register as event listener at the model!" ); 370 } 371 osl_decrementInterlockedCount( &m_refCount ); 372 } 373 374 //-------------------------------------------------------------------- 375 IMPL_LINK( DelayedFileDeletion, OnTryDeleteFile, void*, EMPTYARG ) 376 { 377 ::osl::ClearableMutexGuard aGuard( m_aMutex ); 378 379 sal_Bool bSuccess = sal_False; 380 try 381 { 382 sal_Bool bDeliverOwnership = ( 0 == m_nPendingDeleteAttempts ); 383 // if this is our last attemt, then anybody which vetoes this has to take the consequences 384 // (means take the ownership) 385 m_xDocument->close( bDeliverOwnership ); 386 bSuccess = sal_True; 387 } 388 catch( const util::CloseVetoException& ) 389 { 390 // somebody vetoed -> next try 391 if ( m_nPendingDeleteAttempts ) 392 { 393 // next attempt 394 --m_nPendingDeleteAttempts; 395 m_aDeleteTimer.Start(); 396 } 397 else 398 bSuccess = sal_True; // can't do anything here ... 399 } 400 catch( const Exception& ) 401 { 402 DBG_ERROR( "DelayedFileDeletion::OnTryDeleteFile: caught a strange exception!" ); 403 bSuccess = sal_True; 404 // can't do anything here ... 405 } 406 407 if ( bSuccess ) 408 { 409 SWUnoHelper::UCB_DeleteFile( m_sTemporaryFile ); 410 aGuard.clear(); 411 release(); // this should be our last reference, we should be dead after this 412 } 413 return 0L; 414 } 415 416 //-------------------------------------------------------------------- 417 void DelayedFileDeletion::implTakeOwnership( ) 418 { 419 // revoke ourself as listener 420 try 421 { 422 m_xDocument->removeCloseListener( this ); 423 } 424 catch( const Exception & ) 425 { 426 DBG_ERROR( "DelayedFileDeletion::implTakeOwnership: could not revoke the listener!" ); 427 } 428 429 m_aDeleteTimer.SetTimeout( 3000 ); // 3 seconds 430 m_aDeleteTimer.SetTimeoutHdl( LINK( this, DelayedFileDeletion, OnTryDeleteFile ) ); 431 m_nPendingDeleteAttempts = 3; // try 3 times at most 432 m_aDeleteTimer.Start( ); 433 } 434 435 //-------------------------------------------------------------------- 436 void SAL_CALL DelayedFileDeletion::queryClosing( const EventObject& , sal_Bool _bGetsOwnership ) throw (util::CloseVetoException, RuntimeException) 437 { 438 ::osl::MutexGuard aGuard( m_aMutex ); 439 if ( _bGetsOwnership ) 440 implTakeOwnership( ); 441 442 // always veto: We want to take the ownership ourself, as this is the only chance to delete 443 // the temporary file which the model is based on 444 throw util::CloseVetoException( ); 445 } 446 447 //-------------------------------------------------------------------- 448 void SAL_CALL DelayedFileDeletion::notifyClosing( const EventObject& ) throw (RuntimeException) 449 { 450 DBG_ERROR( "DelayedFileDeletion::notifyClosing: how this?" ); 451 // this should not happen: 452 // Either, a foreign instance closes the document, then we should veto this, and take the ownership 453 // Or, we ourself close the document, then we should not be a listener anymore 454 } 455 456 //------------------------------------------------------ 457 void SAL_CALL DelayedFileDeletion::disposing( const EventObject& ) throw (RuntimeException) 458 { 459 DBG_ERROR( "DelayedFileDeletion::disposing: how this?" ); 460 // this should not happen: 461 // Either, a foreign instance closes the document, then we should veto this, and take the ownership 462 // Or, we ourself close the document, then we should not be a listener anymore 463 } 464 465 //------------------------------------------------------ 466 DelayedFileDeletion::~DelayedFileDeletion( ) 467 { 468 DBG_DTOR( DelayedFileDeletion, NULL ); 469 } 470 } 471 472 //////////////////////////////////////////////////////////// 473 474 static BOOL DeleteTmpFile_Impl( 475 Reference< frame::XModel > &rxModel, 476 SfxObjectShellRef &rxDocSh, 477 const String &rTmpFileURL ) 478 { 479 BOOL bRes = FALSE; 480 if (rTmpFileURL.Len()) 481 { 482 BOOL bDelete = TRUE; 483 if ( eVetoed == CloseModelAndDocSh( rxModel, rxDocSh ) ) 484 { 485 // somebody vetoed the closing, and took the ownership of the document 486 // -> ensure that the temporary file is deleted later on 487 Reference< XEventListener > xEnsureDelete( new DelayedFileDeletion( rxModel, rTmpFileURL ) ); 488 // note: as soon as #106931# is fixed, the whole DelayedFileDeletion is to be superseeded by 489 // a better solution 490 bDelete = FALSE; 491 } 492 493 rxModel = 0; 494 rxDocSh = 0; // destroy doc shell 495 496 if ( bDelete ) 497 { 498 if ( !SWUnoHelper::UCB_DeleteFile( rTmpFileURL ) ) 499 { 500 Reference< XEventListener > xEnsureDelete( new DelayedFileDeletion( rxModel, rTmpFileURL ) ); 501 // same not as above: as soon as #106931#, ... 502 } 503 } 504 else 505 bRes = TRUE; // file will be deleted delayed 506 } 507 return bRes; 508 } 509 510 //////////////////////////////////////////////////////////// 511 512 SwXMailMerge::SwXMailMerge() : 513 aEvtListeners ( GetMailMergeMutex() ), 514 aMergeListeners ( GetMailMergeMutex() ), 515 aPropListeners ( GetMailMergeMutex() ), 516 pMap( aSwMapProvider.GetPropertyMap( PROPERTY_MAP_MAILMERGE ) ), 517 bSendAsHTML(sal_False), 518 bSendAsAttachment(sal_False), 519 bSaveAsSingleFile(sal_False) 520 521 { 522 // create empty document 523 // like in: SwModule::InsertEnv (appenv.cxx) 524 SwDocShell *pDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD ); 525 xDocSh = pDocShell; 526 xDocSh->DoInitNew( 0 ); 527 SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); 528 SwView *pView = (SwView*) pFrame->GetViewShell(); 529 pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird. 530 531 xModel = pDocShell->GetModel(); 532 533 nDataCommandType = sdb::CommandType::TABLE; 534 nOutputType = MailMergeType::PRINTER; 535 bEscapeProcessing = sal_True; //!! allow to process properties like "Filter", "Order", ... 536 bSinglePrintJobs = sal_False; 537 bFileNameFromColumn = sal_False; 538 539 bDisposing = sal_False; 540 } 541 542 SwXMailMerge::~SwXMailMerge() 543 { 544 if (aTmpFileName.Len()) 545 DeleteTmpFile_Impl( xModel, xDocSh, aTmpFileName ); 546 else // there was no temporary file in use 547 { 548 //! we still need to close the model and doc shell manually 549 //! because there is no automatism that will do that later. 550 //! #120086# 551 if ( eVetoed == CloseModelAndDocSh( xModel, xDocSh ) ) 552 DBG_WARNING( "owner ship transfered to vetoing object!" ) 553 554 xModel = 0; 555 xDocSh = 0; // destroy doc shell 556 } 557 } 558 559 uno::Any SAL_CALL SwXMailMerge::execute( 560 const uno::Sequence< beans::NamedValue >& rArguments ) 561 throw (IllegalArgumentException, Exception, RuntimeException) 562 { 563 vos::OGuard aGuard( Application::GetSolarMutex() ); 564 565 // 566 // get property values to be used 567 // (use values from the service as default and override them with 568 // the values that are provided as arguments) 569 // 570 uno::Sequence< uno::Any > aCurSelection = aSelection; 571 uno::Reference< sdbc::XResultSet > xCurResultSet = xResultSet; 572 uno::Reference< sdbc::XConnection > xCurConnection = xConnection; 573 uno::Reference< frame::XModel > xCurModel = xModel; 574 OUString aCurDataSourceName = aDataSourceName; 575 OUString aCurDataCommand = aDataCommand; 576 OUString aCurFilter = aFilter; 577 OUString aCurDocumentURL = aDocumentURL; 578 OUString aCurOutputURL = aOutputURL; 579 OUString aCurFileNamePrefix = aFileNamePrefix; 580 sal_Int32 nCurDataCommandType = nDataCommandType; 581 sal_Int16 nCurOutputType = nOutputType; 582 sal_Bool bCurEscapeProcessing = bEscapeProcessing; 583 sal_Bool bCurSinglePrintJobs = bSinglePrintJobs; 584 sal_Bool bCurFileNameFromColumn = bFileNameFromColumn; 585 // 586 SfxObjectShellRef xCurDocSh = xDocSh; // the document 587 // 588 const beans::NamedValue *pArguments = rArguments.getConstArray(); 589 sal_Int32 nArgs = rArguments.getLength(); 590 for (sal_Int32 i = 0; i < nArgs; ++i) 591 { 592 const OUString &rName = pArguments[i].Name; 593 const Any &rValue = pArguments[i].Value; 594 595 BOOL bOK = TRUE; 596 if (rName.equalsAscii( GetPropName( UNO_NAME_SELECTION ) )) 597 bOK = rValue >>= aCurSelection; 598 else if (rName.equalsAscii( GetPropName( UNO_NAME_RESULT_SET ) )) 599 bOK = rValue >>= xCurResultSet; 600 else if (rName.equalsAscii( GetPropName( UNO_NAME_CONNECTION ) )) 601 bOK = rValue >>= xCurConnection; 602 else if (rName.equalsAscii( GetPropName( UNO_NAME_MODEL ) )) 603 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rName, static_cast < cppu::OWeakObject * > ( this ) ); 604 else if (rName.equalsAscii( GetPropName( UNO_NAME_DATA_SOURCE_NAME ) )) 605 bOK = rValue >>= aCurDataSourceName; 606 else if (rName.equalsAscii( GetPropName( UNO_NAME_DAD_COMMAND ) )) 607 bOK = rValue >>= aCurDataCommand; 608 else if (rName.equalsAscii( GetPropName( UNO_NAME_FILTER ) )) 609 bOK = rValue >>= aCurFilter; 610 else if (rName.equalsAscii( GetPropName( UNO_NAME_DOCUMENT_URL ) )) 611 { 612 bOK = rValue >>= aCurDocumentURL; 613 if (aCurDocumentURL.getLength() 614 && !LoadFromURL_impl( xCurModel, xCurDocSh, aCurDocumentURL, FALSE )) 615 throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Failed to create document from URL: " ) ) + aCurDocumentURL, static_cast < cppu::OWeakObject * > ( this ) ); 616 } 617 else if (rName.equalsAscii( GetPropName( UNO_NAME_OUTPUT_URL ) )) 618 { 619 bOK = rValue >>= aCurOutputURL; 620 if (aCurOutputURL.getLength()) 621 { 622 if (!UCB_IsDirectory(aCurOutputURL)) 623 throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "URL does not point to a directory: " ) ) + aCurOutputURL, static_cast < cppu::OWeakObject * > ( this ), 0 ); 624 if (UCB_IsReadOnlyFileName(aCurOutputURL)) 625 throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "URL is read-only: " ) ) + aCurOutputURL, static_cast < cppu::OWeakObject * > ( this ), 0 ); 626 } 627 } 628 else if (rName.equalsAscii( GetPropName( UNO_NAME_FILE_NAME_PREFIX ) )) 629 bOK = rValue >>= aCurFileNamePrefix; 630 else if (rName.equalsAscii( GetPropName( UNO_NAME_DAD_COMMAND_TYPE ) )) 631 bOK = rValue >>= nCurDataCommandType; 632 else if (rName.equalsAscii( GetPropName( UNO_NAME_OUTPUT_TYPE ) )) 633 bOK = rValue >>= nCurOutputType; 634 else if (rName.equalsAscii( GetPropName( UNO_NAME_ESCAPE_PROCESSING ) )) 635 bOK = rValue >>= bCurEscapeProcessing; 636 else if (rName.equalsAscii( GetPropName( UNO_NAME_SINGLE_PRINT_JOBS ) )) 637 bOK = rValue >>= bCurSinglePrintJobs; 638 else if (rName.equalsAscii( GetPropName( UNO_NAME_FILE_NAME_FROM_COLUMN ) )) 639 bOK = rValue >>= bCurFileNameFromColumn; 640 else if (rName.equalsAscii( GetPropName( UNO_NAME_SUBJECT ) )) 641 bOK = rValue >>= sSubject; 642 else if (rName.equalsAscii( GetPropName( UNO_NAME_ADDRESS_FROM_COLUMN ) )) 643 bOK = rValue >>= sAddressFromColumn; 644 else if (rName.equalsAscii( GetPropName( UNO_NAME_SEND_AS_HTML ) )) 645 bOK = rValue >>= bSendAsHTML; 646 else if (rName.equalsAscii( GetPropName( UNO_NAME_MAIL_BODY ) )) 647 bOK = rValue >>= sMailBody; 648 else if (rName.equalsAscii( GetPropName( UNO_NAME_ATTACHMENT_NAME ) )) 649 bOK = rValue >>= sAttachmentName; 650 else if (rName.equalsAscii( GetPropName( UNO_NAME_ATTACHMENT_FILTER ) )) 651 bOK = rValue >>= sAttachmentFilter; 652 else if (rName.equalsAscii( GetPropName( UNO_NAME_COPIES_TO ) )) 653 bOK = rValue >>= aCopiesTo; 654 else if (rName.equalsAscii( GetPropName( UNO_NAME_BLIND_COPIES_TO ) )) 655 bOK = rValue >>= aBlindCopiesTo; 656 else if (rName.equalsAscii( GetPropName( UNO_NAME_SEND_AS_ATTACHMENT ) )) 657 bOK = rValue >>= bSendAsAttachment; 658 else if (rName.equalsAscii( GetPropName( UNO_NAME_PRINT_OPTIONS ) )) 659 bOK = rValue >>= aPrintSettings; 660 else if (rName.equalsAscii( GetPropName( UNO_NAME_SAVE_AS_SINGLE_FILE ) )) 661 bOK = rValue >>= bSaveAsSingleFile; 662 else if (rName.equalsAscii( GetPropName( UNO_NAME_SAVE_FILTER ) )) 663 bOK = rValue >>= sSaveFilter; 664 else if (rName.equalsAscii( GetPropName( UNO_NAME_SAVE_FILTER_OPTIONS ) )) 665 bOK = rValue >>= sSaveFilterOptions; 666 else if (rName.equalsAscii( GetPropName( UNO_NAME_SAVE_FILTER_DATA ) ))