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

(-)sfx2/source/dialog/mailmodel.cxx (+111 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 514-519 SfxMailModel::SaveResult SfxMailModel::S Link Here
514
                        }
524
                        }
515
                    }
525
                    }
516
526
527
//check if this is the pdf otput filter (i#64555)
528
                    if( bSendAsPDF )
529
                    {
530
                        try
531
                        {
532
                            uno::Sequence < beans::PropertyValue > aProps;
533
                            ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFilterCFG =						  
534
                                  uno::Reference< container::XNameAccess >(
535
                                      xSMGR->createInstance(
536
                                          ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY );
537
538
                            if ( !xFilterCFG.is() )
539
                                return eRet;
540
				
541
                            uno::Any aAny = xFilterCFG->getByName( aFilterName );
542
543
                            if ( aAny >>= aProps )
544
                            {
545
                                sal_Int32 nPropertyCount = aProps.getLength();
546
                                for( sal_Int32 nProperty=0; nProperty < nPropertyCount; ++nProperty )
547
                                    if( aProps[nProperty].Name.equals( ::rtl::OUString::createFromAscii("UIComponent")) )
548
                                    {
549
                                        ::rtl::OUString aServiceName;
550
                                        aProps[nProperty].Value >>= aServiceName;
551
                                        if( aServiceName.getLength() )
552
                                        {
553
                                            uno::Reference< ui::dialogs::XExecutableDialog > xFilterDialog(
554
                                                xSMGR->createInstance( aServiceName ), uno::UNO_QUERY );
555
                                            uno::Reference< beans::XPropertyAccess > xFilterProperties(
556
                                                xFilterDialog, uno::UNO_QUERY );
557
558
                                            if( xFilterDialog.is() && xFilterProperties.is() )
559
                                            {
560
                                                uno::Reference< document::XExporter > xExporter( xFilterDialog, uno::UNO_QUERY );
561
                                                if( xExporter.is() )
562
                                                    xExporter->setSourceDocument(
563
                                                        uno::Reference< lang::XComponent >( xModel, uno::UNO_QUERY ) );
564
565
                                                uno::Sequence< beans::PropertyValue > aPropsForDialog(1);
566
                                                //add an internal property, used to tell the dialog we called it from send mail attachement as pdf
567
                                                //used in filter/source/pdf/impdialog.cxx
568
                                                uno::Sequence< beans::PropertyValue > aFilterDataValue(1);
569
                                                aFilterDataValue[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_DialogCalledFromSendMail" ));
570
                                                aFilterDataValue[0].Value = css::uno::makeAny( sal_True );
571
                                                //add to the filterdata property, the only one the PDF export filter dialog will care for
572
                                                aPropsForDialog[0].Name =  ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ));
573
                                                aPropsForDialog[0].Value = css::uno::makeAny( aFilterDataValue );
574
                                                //when executing the dialog will merge the persistent FilterData properties
575
                                                xFilterProperties->setPropertyValues( aPropsForDialog );
576
577
                                                if( xFilterDialog->execute() )
578
                                                {
579
                                                    //get the filter data
580
                                                    uno::Sequence< beans::PropertyValue > aPropsFromDialog = xFilterProperties->getPropertyValues();
581
                                                    //add them to the args
582
                                                    for ( sal_Int32 nInd = 0; nInd < aPropsFromDialog.getLength(); nInd++ )
583
                                                    {
584
                                                        if( aPropsFromDialog[ nInd ].Name.equals( ::rtl::OUString::createFromAscii( "FilterData" ) ) )
585
                                                        {
586
                                                            //found the filterdata, add to the storing argument
587
                                                            aArgs.realloc( ++nNumArgs );
588
                                                            aArgs[nNumArgs-1].Name = aPropsFromDialog[ nInd ].Name;
589
                                                            aArgs[nNumArgs-1].Value = aPropsFromDialog[ nInd ].Value;
590
                                                            break;
591
                                                        }
592
                                                    }
593
                                                }
594
                                                else
595
                                                {   //cancel from dialog, then do not send
596
                                                    // If the model is not modified, it could be modified by the dispatch calls.
597
                                                    // Therefore set back to modified = false. This should not hurt if we call
598
                                                    // on a non-modified model.
599
                                                    if ( !bModified )
600
                                                    {
601
                                                        try
602
                                                        {
603
                                                            xModifiable->setModified( sal_False );
604
                                                        }
605
                                                        catch( com::sun::star::beans::PropertyVetoException& )
606
                                                        {
607
                                                        }
608
                                                    }
609
                                                    eRet = SAVE_CANCELLED;
610
                                                    return eRet;
611
                                                }
612
                                            }
613
                                            break;
614
                                        }
615
                                    }
616
                            }
617
                        }
618
                        catch( css::uno::RuntimeException& )
619
                        {
620
                            throw;
621
                        }
622
                        catch( uno::Exception& )
623
                        {                                                    
624
625
                        }
626
                    }
627
					
517
                    xStorable->storeToURL( aFileURL, aArgs );
628
                    xStorable->storeToURL( aFileURL, aArgs );
518
                    rFileNamePath = aFileURL;
629
                    rFileNamePath = aFileURL;
519
                    eRet = SAVE_SUCCESSFULL;
630
                    eRet = SAVE_SUCCESSFULL;
(-)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: send as e-mail or write to file?
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 (+7 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, used when sending
47
//the doc though e-mail as PDF attached file
48
String STR_PDF_EXPORT_SEND
49
{
50
		Text[ en-US ] = "~Send";
51
};
52
46
//strings used in encryption UI
53
//strings used in encryption UI
47
String STR_PDF_EXPORT_USPWD
54
String STR_PDF_EXPORT_USPWD
48
{
55
{

Return to issue 64555