Hi Ivan,
The suggested by SaveAs-dialog document name is generated based on the
current document location. The location can be retrieved using the call
XStorable::getLocation() if there is any. It is set on loading and can
be change only by storing of the document to another location.
The call XModel::attachResources() changes the result of the
XModel::getURL(), but this API is really document location. It is set to
the correct value after the document is loaded, but as your experiment
has shown, this does not affect the document location. The
XModel::getURL() related implementation is very old and very confusing
one. It should be probably at least deprecated.
Thus the answer to your question is 'no'. As far as I know, it is not
possible currently to set the suggested document name without
implementing dispatch interceptor and all the functionality around it.
Regards,
Mikhail.
On 10/20/08 11:18, Jedlička Ivan [P4] wrote:
Hi,
the posibility to catch and consume the event, when a user chooses the SaveAs
action and to implement any other FilePicker I have allready considered, but
that time I don't know how to do it exactly.
But I still think, that the SaveAs dialog iniciated by user in current standard
implementation must get the information about the document location somewhere
from and my idea is to set the property of the document such way, the document
looks like loaded from a particular URL.
Really doesn't exist such way? The question is actually quite simple. From
where reads the current implemented SaveAs dialog the value of document
location?
Ivan
-----Original Message-----
From: Mikhail Voitenko [mailto:[EMAIL PROTECTED]
Sent: Friday, October 17, 2008 11:21 AM
To: [email protected]
Subject: Re: [api-dev] Suggest filename before saving document
Hi Ivan, Cor,
unfortunately, the suggested solution has a disadvantage that
a bunch of SaveAs UI action related features are lost, as for
example the document type dependent filter selection, error
handling and etc. It could of course be implemented as well,
but then it would be just a duplication of the sourcecode
implemented in sfx2. From other side there is currently no
way to preselect the suggested file name for a document.
It is already planned for OOo3.1 to implement possibility to
preselect the path that will be used in SaveAs dialog while
storing the document.
It looks to make sense to allow to preselect the file name as
well, I have just added this to the issue
http://qa.openoffice.org/issues/show_bug.cgi?id=94273
Another idea was to allow to specify it in template as well.
Thus, if it should be implemented for OOo3.0.x, an own
dispatch interceptor for SaveAs UI action should be
registered. This interceptor should implement functionality
similar to the one suggested by Cor. It could be improved to
be close to the intern implementation of SaveAs action, but
it is up to you to decide how much efforts do you want to
invest into the implementation. You can take a look to the
current implementation in sfx2/souce/doc/guisaveas.cxx method
SfxStoringHelper::GuiStoreModel() for details. This
implementation is mainly UNO API based, so it could probably help.
I would recommend to wait for OOo3.1 if it is possible, since
it will be a pretty easy task there.
Hope that helps.
Best regards,
Mikhail.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]