Issue 64555

Summary: PDF-Options dialog doesn't appear by sending doc as pdf e-mail attachment
Product: General Reporter: h.ilter
Component: uiAssignee: h.ilter
Status: CLOSED FIXED QA Contact: issues@framework <issues>
Severity: Trivial    
Priority: P3 CC: issues, matthias.mueller-prove
Version: 680m163   
Target Milestone: OOo 2.2   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 70482, 73437    
Description Flags
patch to add the functionality, m197 based
updated and cleaned patch none

Description h.ilter 2006-04-20 13:04:11 UTC
- New doc
- File - Send - E-Mail as PDF
-> E-Mail client pops up without the PDF-Options dialog before.
Note: In PP2 the PDF-Options dialog appeared before the E-Mail client.
Comment 1 h.ilter 2006-06-07 11:16:08 UTC
*** Issue 66178 has been marked as a duplicate of this issue. ***
Comment 2 Mathias_Bauer 2006-07-10 09:05:13 UTC
changing target
Comment 3 h.ilter 2006-07-11 09:01:15 UTC
*** Issue 67124 has been marked as a duplicate of this issue. ***
Comment 4 minmax 2006-10-30 17:07:37 UTC
Is this moving anywhere?

This is a really important issue for use of in companies, since
sending part of the document is feature used many times a day.

Comment 5 Giuseppe Castagno (aka beppec56) 2006-12-18 19:52:03 UTC
I don't know if someone is working on this, anyway the patch I'm going to attach
can be used to add the functionality requested in this issue.

The PDF functionality is not detailed in the e-mail specification available here:

The only reference I found in the spec is in the following sentence (row 23):


When choosing File -> Send -> Document as PDF Attachment, the currently active
document is converted to PDF before it gets passed to the e-mail client.


I think that what this issue requests should be added there by expanding the
former phrase into:


When choosing File -> Send -> Document as PDF Attachment, the currently active
document is converted to PDF before it gets passed to the e-mail client.
The task is carried out by showing the PDF Options window and then sending the
PDF file when the user presses the “Send†pushbutton.
The  "Send"  pushbutton  is the "Export" one with the text changed during this
If  the "Cancel" pushbutton if pressed then the e-mail send process is
terminated without sending the attachment (no e-mail sent).

The PDF Options window is not brought up if the “File > Send > Document as PDF
Attachment†operation is called through scripting.


A call through scripting can have the form:

 rem get access to the document
 document   = ThisComponent.CurrentController.Frame
 dispatcher = createUnoService("")
 dispatcher.executeDispatch(document, ".uno:SendMailDocAsPDF", "", 0, Array())

A good idea would be to add the capability to set the PDF Options through
scripting (e.g. using somehow the Array() parameter above), but this requires a
deeper change in the code. I'm willing to give it a try if you think this could
be useful.

Of course the patch needs be verified, because I'm not sure I got correctly the
export filter functionality.
Comment 6 Giuseppe Castagno (aka beppec56) 2006-12-18 19:53:25 UTC
Created attachment 41526 [details]
patch to add the functionality, m197 based
Comment 7 andreas.schluens 2007-01-02 10:03:06 UTC
Comment 8 carsten.driesner 2007-01-09 14:56:55 UTC
cd->beppec56: Thanks for your patch. I checked it and I think you use an
implementation detail (SFX_CALLMODE_RECORD) to distinguish between called from
API and UI. I am not sure that it always works, but you shouldn't do it. The
dispatch API is defined to be used by the user interface and therefore the
implementation should use UI as necessary. Only the normal API is
not allowed to use UI. I can accept the other part, which implements the PDF
options dialog. I don't know if you want to provide a cleaned up patch or should
I adapt your code to not use the "scripting" detection?
Comment 9 Giuseppe Castagno (aka beppec56) 2007-01-09 16:16:30 UTC
beppec56->cd: I added the SFX_CALLMODE_RECORD test because without that test if
you have a script code as this:

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("")
dispatcher.executeDispatch(document, ".uno:SendMailDocAsPDF", "", 0, Array())

you will end up having the PDF option dialog popping up as a result of the
scripting call.
Is this correct?
If this is all right, I'll clean the code of the test and I'll rebase the patch
to m198 or m199 (m199 is building now from scratch).
Comment 10 Giuseppe Castagno (aka beppec56) 2007-01-10 15:15:44 UTC
beppec56->cd: I'm going to attach a modified patch:
- m199 based;
- cleaned up to not use the "scripting" detection;
- a little polishing at the few comments I wrote.

I tested it on a m199 build.
Comment 11 Giuseppe Castagno (aka beppec56) 2007-01-10 15:16:42 UTC
Created attachment 42063 [details]
updated and cleaned patch
Comment 12 carsten.driesner 2007-01-11 08:38:03 UTC
cd->beppec56: The dispatch API is defined to be used by UI code. Therefore you
shouldn't use something like SFX_CALLMODE_RECORD to prevent showing UI. 
We have a different solution to support scripting using the dispatch API. The
scripting code has to provide all necessary arguments to the command then the
implementation shouldn't show any UI. In our case this would need some more work
to do (extend the slot arguments in the sfx.sdi file) and adapt the
implementation to use them. This would be an "enhancement" and the correct
target would be 2.3.
Comment 13 minmax 2007-01-11 08:52:58 UTC
is it possible to have the script unfriendly patch in ooo asap and then wait for
script friendly patch to 2.3 ?

in our company it is really a problem now since workflow got much more
complicated due to this regression...
Comment 14 Giuseppe Castagno (aka beppec56) 2007-01-11 09:52:40 UTC
beppec56->cd: my suggestion is as follows:
- go on with this patch as it is (cleaned up version) and make it into 2.2.1, so
the send as PDF attachment+PDF Options functionality is again available;

- open another issue (I'll take care of it as soon as I can) about the scripting
friendly feature enhancement, adding the scripting enhancement functionality on
top of the patch I submitted here.

In case I should need more tech info about the way the scripting is managed
(code, where to act, things to have care of) is the
right ML?
Comment 15 carsten.driesner 2007-01-11 12:05:20 UTC
cd->beppec56: Sure, you can ask questions on the framework dev mailing list.
Please give me some time as I want to be sure that the real cause of this issue
is really related to the missing code.
Comment 16 carsten.driesner 2007-01-12 15:45:23 UTC
cd->beppec56,minimax: I checked the root cause and I think your patch is
currently the best and easiest way to fix this problem. There is one more
problem, if we want to add this patch to OOo 2.2 (minimax requested to do so).
You also changed the filter options dialog and introduce a new resource, which
is not allowed anymore for OOo 2.2 (feature/UI freeze). Do you accept to just
use only your mailmodel changes and use it for OOo 2.2. The better fix with the
text changes can be used for OOo 2.2.1?
Comment 17 Giuseppe Castagno (aka beppec56) 2007-01-12 16:03:17 UTC
beppec56->cd: for me it's OK to change the mailmodel for 2.2 target. Can you
take care of the changes to the patch?
Let me know...
Comment 18 carsten.driesner 2007-01-12 16:16:35 UTC
cd->beppec56: Great! Yes, I will do all the changes (target set OOo 2.2).
Could you write a new issue and attach the text part to it. Just set me as owner
(cd) and the target to OOo 2.2.1?
Comment 19 Giuseppe Castagno (aka beppec56) 2007-01-12 17:10:50 UTC
beppec56->cd: will do next week.
Comment 20 carsten.driesner 2007-01-15 15:27:33 UTC
cd: Fixed. Checked in a little adapted version.
Comment 21 minmax 2007-01-15 15:48:57 UTC
phantastic! thanks a lot!

so i can expect this in 2.2.1 ?

Comment 22 carsten.driesner 2007-01-15 16:28:39 UTC
cd->minimax: No, you will get the dialog for OOo 2.2. The whole solution from
beppec56 will be in OOo 2.2.1. We split the patch into two parts, because of
feature/ui freeze.
Comment 23 minmax 2007-01-15 17:24:22 UTC
even better, ... the company that i am helping with will upgrade as soon as it
comes out because of this single feature (or fix of regression more precisely :)
Comment 24 carsten.driesner 2007-01-17 12:05:12 UTC
cd->hi: Please verify.
Comment 25 h.ilter 2007-01-24 12:20:45 UTC
Verified with cws fwk60 = ok
Comment 26 h.ilter 2007-02-02 13:15:08 UTC
Still ok in 680m5 9114