sfx2/source/doc/objserv.cxx |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit 1e007e8f1703851b01c68884e87c906f6bae5a5e
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Oct 18 17:08:36 2022 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Nov 4 08:41:06 2022 +0100

    sw: fix merge mail to direct export as pdf
    
    In order to export directly to PDF, the document
    must remove the hidden sections (if format condition),
    the data source should stay on current selected
    record finally restore the hidden sections.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: Idf8e2a26d5c9cbe61ddac6c35cc2e1df1175da27
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141520
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 9398787eb3bf..91493e2eb616 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -967,12 +967,26 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                         uno::Reference< uno::XInterface >(), 
sal_uInt32(ERRCODE_IO_ABORT));
                 }
 
+                const SfxBoolItem *pItem = nId != SID_DIRECTEXPORTDOCASPDF ? 
nullptr :
+                    dynamic_cast<const SfxBoolItem*>( 
GetSlotState(SID_MAIL_PREPAREEXPORT) );
+                if (pItem && pItem->GetValue())
+                {
+                    SfxRequest aRequest(SID_MAIL_PREPAREEXPORT, 
SfxCallMode::SYNCHRON, GetPool());
+                    aRequest.AppendItem(SfxBoolItem(FN_PARAM_1, true));
+                    ExecuteSlot(aRequest);
+                }
+
                 aHelper.GUIStoreModel( GetModel(),
                                        OUString::createFromAscii( 
pSlot->GetUnoName() ),
                                        aDispatchArgs,
                                        bPreselectPassword,
                                        GetDocumentSignatureState() );
 
+                if (pItem && pItem->GetValue())
+                {
+                    SfxRequest aRequest(SID_MAIL_EXPORT_FINISHED, 
SfxCallMode::SYNCHRON, GetPool());
+                    ExecuteSlot(aRequest);
+                }
 
                 // merge aDispatchArgs to the request
                 SfxAllItemSet aResultParams( GetPool() );

Reply via email to