Hey guys.  Thanks for your helpful input. :-)

On Thu, 2008-05-22 at 11:09 +0200, Mathias Bauer wrote:
> Hi Mikhail and Kohei,
> 
> Mikhail Voitenko wrote:
> 
> > 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.
> 
> So the password to use always would be in the SfxMedium passed in
> ConvertTo(), right?
> 
> So what about the password that Calc seems to store in its internal data?
> 
> First I would like to see why this is necessary. Perhaps this is done
> currently only because it is not passed to the Medium? In that case it
> could be removed from the Calc internal model data and instead stored in
> the Medium/MediaDescriptor as we do it for our own format.

Indeed that sounds cleaner.  I'll look into changing my implementation
for doing that.  The reason I stored the password in Calc's model is
because I didn't know of any other way to preserve the password between
import and export at that time.

> In case Calc also needs to know the password for other purposes
> internally I assume that the new password must be taken over by Calc
> also.

There is no need for Calc to know the document password during run-time.
The only time Calc might need access to it is when (in a hypothetical
scenario) the user tries to change the current document password while
editing the document.  But since the SfxObjectShell::GetMedium() method
is public and ScDocShell inherits it, Calc can still access the
SfxMedium instance to update the password (right?).  So there is still
no need to store the password directly in Calc's model.

Note here that OOo currently doesn't support changing the encryption
password so we don't have this need at the moment.  But this is
something that's been requested by one of our customers, so I wanted to
bring it up just to think ahead.  (Right now if the user wants to change
the password, s/he would need to do SaveAs, type new password, then
overwrite the existing document, which is a little ugly workaround.)

> The right place for that would be the SaveCompleted() call at the
> ScDocShell.

Thanks.  I'll take a look at that method.

Best,
Kohei

-- 
Kohei Yoshida - OpenOffice.org Engineer - Novell, Inc.
<[EMAIL PROTECTED]>


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

Reply via email to