Hi Kohei,

The suggested by Mathias solution will work. I am just curious why should it be handled in the filter. Isn't it better just to set the correct password to the target MediaDescriptor represented by ItemSet in the target SfxMedium and use it always from the target medium?

I mean that in case of Save scenario the password should be just transported to the medium from the current document and in case of SaveAs scenario the password would be set from the dialog. All this would be done in sfx2, where the information regarding the current action is available ( if I am not wrong, it should even be done already, although in case of Excel filter it might need some adjustments ). And the filter would use the password from the target MediaDescriptor. This solution would be definitely no hack and could be used as a final one. It is already done so for the OOo document format filters.

Best regards,
Mikhail.

Mathias Bauer wrote:
Mathias Bauer wrote:

Hello Kohei,

Kohei Yoshida wrote:

On Wed, 2008-05-21 at 15:45 +0200, Mikhail Voitenko wrote:
Hi Kohei,

The suggested solution is easy, but it is a hack.
Ah ok. :-P

There is no guarantee that it will work in future, since the item might be lost during the conversion to MediaDescriptor representation.
I see.  So I'll need to add more code to correctly convert this
information during the conversion, I guess.

At which moment of time ( which part of storing process ) do you need to get the information that it is SaveAs or Save action?
I need this information in Calc's Excel binary exporter code, which is
still implemented as a conventional non-UNO filter.  So, I need it after
the code path reaches past the ScDocShell::ConvertTo() call in the sc
module.

Whether the action is Save or SaveAs determines whether I should use the
password stored in the medium itself (the one the user typed in the
dialog), or the password stored in Calc's document model (the original
password used to decrypt the document in the first place).
I agree with Mikhail that for a future proof version we need to do a
little bit more.

If it's only for your current problem - it should be sufficient to do
something comparable in the SfxObjectShell::SaveTo_Impl() method where
you could add the item immediately before ConvertTo() is called. The
information whether "Save" or "SaveAs" (or "SaveTo") is used is
available here as the local variable "bCopyTo".

Ah, I'm sorry. It's not "bCopyTo", it's "pImp->bIsSaving". As this is a
hack I hesitate to export this in a methid "IsSaving". But for the time
being passing this explicitly to ConvertTo() could solve your problem.

Ciao,
Mathias


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to