View | Details | Raw Unified | Return to issue 64555
Collapse All | Expand All

(-)sfx2/inc/mailmodelapi.hxx (+5 lines)
Lines 99-104 private: Link Here
99
	String				maSubject;
99
	String				maSubject;
100
	MailPriority		mePriority;
100
	MailPriority		mePriority;
101
101
102
	sal_Bool			mbIsApiCall; //true if instantiated while serving an API call
103
102
	sal_Bool			mbLoadDone;
104
	sal_Bool			mbLoadDone;
103
105
104
	void				ClearList( AddressList_Impl* pList );
106
	void				ClearList( AddressList_Impl* pList );
Lines 147-152 public: Link Here
147
	
149
	
148
	sal_Int32			GetCount() const;
150
	sal_Int32			GetCount() const;
149
	sal_Bool			IsEmpty() const;
151
	sal_Bool			IsEmpty() const;
152
153
	void				SetIsApiCall( sal_Bool bIsApiCall )			{ mbIsApiCall = bIsApiCall; };
154
	sal_Bool			IsApiCall()									{ return mbIsApiCall; };
150
};
155
};
151
156
152
BOOL CreateFromAddress_Impl( String& rFrom );
157
BOOL CreateFromAddress_Impl( String& rFrom );
(-)sfx2/source/dialog/mailmodel.cxx (+113 lines)
Lines 37-42 Link Here
37
#include "precompiled_sfx2.hxx"
37
#include "precompiled_sfx2.hxx"
38
// includes --------------------------------------------------------------
38
// includes --------------------------------------------------------------
39
39
40
#ifndef  _COM_SUN_STAR_UI_DIALOGS_XEXECUTABLEDIALOG_HPP_
41
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
42
#endif
43
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
44
#include <com/sun/star/beans/XPropertyAccess.hpp>
45
#endif
46
#ifndef _COM_SUN_STAR_DOCUMENT_XEXPORTER_HPP_
47
#include <com/sun/star/document/XExporter.hpp>
48
#endif
49
40
#ifndef  _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
50
#ifndef  _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
41
#include <com/sun/star/beans/PropertyValue.hpp>
51
#include <com/sun/star/beans/PropertyValue.hpp>
42
#endif
52
#endif
Lines 232-237 SfxMailModel::SaveResult SfxMailModel::S Link Here
232
    rtl::OUString& rFileNamePath )
242
    rtl::OUString& rFileNamePath )
233
{
243
{
234
	SaveResult  eRet( SAVE_ERROR );
244
	SaveResult  eRet( SAVE_ERROR );
245
    bool        bSendAsPDF = (rType.compareTo(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf_Portable_Document_Format" ))) == 0);
235
246
236
    css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR  = ::comphelper::getProcessServiceFactory();
247
    css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR  = ::comphelper::getProcessServiceFactory();
237
    if (!xSMGR.is())
248
    if (!xSMGR.is())
Lines 510-515 SfxMailModel::SaveResult SfxMailModel::S Link Here
510
                        }
521
                        }
511
                    }
522
                    }
512
523
524
//check if not running a script and this is the pdf otput filter
525
                    if( !IsApiCall() && bSendAsPDF )
526
                    {
527
                        try
528
                        {
529
                            uno::Sequence < beans::PropertyValue > aProps;
530
                            ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFilterCFG =						  
531
                                  uno::Reference< container::XNameAccess >(
532
                                      xSMGR->createInstance(
533
                                          ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY );
534
535
                            if ( !xFilterCFG.is() )
536
                                return eRet;
537
				
538
                            uno::Any aAny = xFilterCFG->getByName( aFilterName );
539
540
                            if ( aAny >>= aProps )
541
                            {
542
                                sal_Int32 nPropertyCount = aProps.getLength();
543
                                for( sal_Int32 nProperty=0; nProperty < nPropertyCount; ++nProperty )
544
                                    if( aProps[nProperty].Name.equals( ::rtl::OUString::createFromAscii("UIComponent")) )
545
                                    {
546
                                        ::rtl::OUString aServiceName;
547
                                        aProps[nProperty].Value >>= aServiceName;
548
                                        if( aServiceName.getLength() )
549
                                        {
550
                                            uno::Reference< ui::dialogs::XExecutableDialog > xFilterDialog(
551
                                                xSMGR->createInstance( aServiceName ), uno::UNO_QUERY );
552
                                            uno::Reference< beans::XPropertyAccess > xFilterProperties(
553
                                                xFilterDialog, uno::UNO_QUERY );
554
555
                                            if( xFilterDialog.is() && xFilterProperties.is() )
556
                                            {
557
                                                uno::Reference< document::XExporter > xExporter( xFilterDialog, uno::UNO_QUERY );
558
                                                if( xExporter.is() )
559
                                                    xExporter->setSourceDocument(
560
                                                        uno::Reference< lang::XComponent >( xModel, uno::UNO_QUERY ) );
561
562
                                                uno::Sequence< beans::PropertyValue > aPropsForDialog(1);
563
                                                //add an internal property, used to tell the dialog we called it from send mail attachement as pdf
564
                                                //used in filter/source/pdf/impdialog.cxx
565
                                                uno::Sequence< beans::PropertyValue > aFilterDataValue(1);
566
                                                aFilterDataValue[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_DialogCalledFromSendMail" ));
567
                                                aFilterDataValue[0].Value = css::uno::makeAny( sal_True );
568
                                                //add to the filterdata property, the only one the PDF export filter dialog will care for
569
                                                aPropsForDialog[0].Name =  ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ));
570
                                                aPropsForDialog[0].Value = css::uno::makeAny( aFilterDataValue );
571
                                                //when executing the dialog will merge the persistent FilterData properties
572
                                                xFilterProperties->setPropertyValues( aPropsForDialog );
573
574
                                                if( xFilterDialog->execute() )
575
                                                {
576
                                                    //get the filter data
577
                                                    uno::Sequence< beans::PropertyValue > aPropsFromDialog = xFilterProperties->getPropertyValues();
578
                                                    //add them to the args
579
                                                    for ( sal_Int32 nInd = 0; nInd < aPropsFromDialog.getLength(); nInd++ )
580
                                                    {
581
                                                        if( aPropsFromDialog[ nInd ].Name.equals( ::rtl::OUString::createFromAscii( "FilterData" ) ) )
582
                                                        {
583
                                                            //found the filterdata, add to the storing argument
584
                                                            aArgs.realloc( ++nNumArgs );
585
                                                            aArgs[nNumArgs-1].Name = aPropsFromDialog[ nInd ].Name;
586
                                                            aArgs[nNumArgs-1].Value = aPropsFromDialog[ nInd ].Value;
587
                                                            break;
588
                                                        }
589
                                                    }
590
                                                }
591
                                                else
592
                                                {   //cancel from dialog, then do not send
593
                                                    // If the model is not modified, it could be modified by the dispatch calls.
594
                                                    // Therefore set back to modified = false. This should not hurt if we call
595
                                                    // on a non-modified model.
596
                                                    if ( !bModified )
597
                                                    {
598
                                                        try
599
                                                        {
600
                                                            xModifiable->setModified( sal_False );
601
                                                        }
602
                                                        catch( com::sun::star::beans::PropertyVetoException& )
603
                                                        {
604
                                                        }
605
                                                    }
606
                                                    eRet = SAVE_CANCELLED;
607
                                                    return eRet;
608
                                                }
609
                                            }
610
                                            break;
611
                                        }
612
                                    }
613
                            }
614
                        }
615
                        catch( css::uno::RuntimeException& )
616
                        {
617
                            throw;
618
                        }
619
                        catch( uno::Exception& )
620
                        {                                                    
621
622
                        }
623
                    }
624
					
513
                    xStorable->storeToURL( aFileURL, aArgs );
625
                    xStorable->storeToURL( aFileURL, aArgs );
514
                    rFileNamePath = aFileURL;
626
                    rFileNamePath = aFileURL;
515
                    eRet = SAVE_SUCCESSFULL;
627
                    eRet = SAVE_SUCCESSFULL;
Lines 589-594 SfxMailModel::SfxMailModel() : Link Here
589
	mpCcList	( NULL ),
701
	mpCcList	( NULL ),
590
	mpBccList	( NULL ),
702
	mpBccList	( NULL ),
591
	mePriority	( PRIO_NORMAL ),
703
	mePriority	( PRIO_NORMAL ),
704
	mbIsApiCall	( sal_False ),
592
	mbLoadDone	( sal_True )
705
	mbLoadDone	( sal_True )
593
{
706
{
594
}
707
}
(-)sfx2/source/view/viewsh.cxx (+5 lines)
Lines 279-285 void SfxViewShell::ExecMisc_Impl( SfxReq Link Here
279
					eResult = aModel.SaveAndSend( xFrame, rtl::OUString() );
279
					eResult = aModel.SaveAndSend( xFrame, rtl::OUString() );
280
				else
280
				else
281
				if ( nId == SID_MAIL_SENDDOCASPDF )
281
				if ( nId == SID_MAIL_SENDDOCASPDF )
282
                {
283
                    //mode record == from menu or user else if from API, seems that SFX_CALLMODE_RECORD is not set if called from API
284
                    //don't know if it is a bug or 'by design'
285
                    aModel.SetIsApiCall( !( SFX_CALLMODE_RECORD  == ( rReq.GetCallMode() & SFX_CALLMODE_RECORD ) ) );
282
                    eResult = aModel.SaveAndSend( xFrame, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf_Portable_Document_Format" )));
286
                    eResult = aModel.SaveAndSend( xFrame, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf_Portable_Document_Format" )));
287
                }
283
                else
288
                else
284
				if ( nId == SID_MAIL_SENDDOCASMS )
289
				if ( nId == SID_MAIL_SENDDOCASMS )
285
                {
290
                {
(-)filter/source/pdf/impdialog.cxx (-1 / +7 lines)
Lines 243-250 ImpPDFTabDialog::ImpPDFTabDialog( Window Link Here
243
//last queued is the first to be displayed (or so it seems..)
243
//last queued is the first to be displayed (or so it seems..)
244
    AddTabPage( RID_PDF_TAB_GENER, ImpPDFTabGeneralPage::Create, 0 );
244
    AddTabPage( RID_PDF_TAB_GENER, ImpPDFTabGeneralPage::Create, 0 );
245
245
246
//get the internal boolean property value (from sfx2/source/dialog/mailmodel.cxx) to select the right text for the Ok button
247
	sal_Bool bUseSendText = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "_DialogCalledFromSendMail" ) ), sal_False );
248
246
//change test on the Ok button: get the relevant string from resources, update it on the button
249
//change test on the Ok button: get the relevant string from resources, update it on the button
247
    GetOKButton().SetText( OUString( String( ResId( STR_PDF_EXPORT, &rResMgr ) ) ) );
250
//according to the exported pdf file destination
251
    GetOKButton().SetText( ( bUseSendText ) ? OUString( String( ResId( STR_PDF_EXPORT_SEND, &rResMgr ) ) )
252
                           : OUString( String( ResId( STR_PDF_EXPORT, &rResMgr ) ) ) );
253
    
248
//remove the reset button, not needed in this tabbed dialog
254
//remove the reset button, not needed in this tabbed dialog
249
    RemoveResetButton();
255
    RemoveResetButton();
250
/////////////////
256
/////////////////
(-)filter/source/pdf/impdialog.hrc (+1 lines)
Lines 51-56 Link Here
51
#define STR_PDF_EXPORT_CB_PERM		 (RID_PDF_DIALOG_START + 8)
51
#define STR_PDF_EXPORT_CB_PERM		 (RID_PDF_DIALOG_START + 8)
52
#define STR_PDF_EXPORT_OSPWD         (RID_PDF_DIALOG_START + 9)
52
#define STR_PDF_EXPORT_OSPWD         (RID_PDF_DIALOG_START + 9)
53
#define STR_PDF_EXPORT_ODPWD         (RID_PDF_DIALOG_START + 10)
53
#define STR_PDF_EXPORT_ODPWD         (RID_PDF_DIALOG_START + 10)
54
#define STR_PDF_EXPORT_SEND          (RID_PDF_DIALOG_START + 11)
54
55
55
//ATTENTION: maximum allowed value is( RID_PDF_DIALOG_START +   19)
56
//ATTENTION: maximum allowed value is( RID_PDF_DIALOG_START +   19)
56
57
(-)filter/source/pdf/impdialog.src (+6 lines)
Lines 43-48 String STR_PDF_EXPORT Link Here
43
		Text[ en-US ] = "E~xport";
43
		Text[ en-US ] = "E~xport";
44
};
44
};
45
45
46
//string for TabDialog standard buttons
47
String STR_PDF_EXPORT_SEND
48
{
49
		Text[ en-US ] = "~Send";
50
};
51
46
//strings used in encryption UI
52
//strings used in encryption UI
47
String STR_PDF_EXPORT_USPWD
53
String STR_PDF_EXPORT_USPWD
48
{
54
{

Return to issue 64555