List Info

Thread: API design question




API design question
user name
2006-02-22 07:34:50
Paolo Mantovani wrote:

> Hi Mathias,
> 
> Alle 22:25, luned́ 20 febbraio 2006, Mathias Bauer ha
scritto:
> [...]
>> It doesn't make any sense to record a S&R
action that does not
>> automatically replace all occurences or no
occurence and asks the user
>> for every single case.
>>
>> A macro that e.g. only replaces the 3rd and the 5th
occurence can't be
>> applied to other documents in a useful way. 
> 
> I agree, but actually the user *can* record such
actions, even if it doesn't 
> make sense.

So the question remains wether these macros are a good
candidate for
investing time in making them "better". 

>> So what you need is "Replace
>> All" and "Start Replacing and ask me
each time". AFAIK the latter is
>> possible only by dispatching because it's bound to
a dialog while the
>> S&R API of the "core" document
explicitly is designed to avoid dialog
>> interruptions.
> 
> I'm not sure to understand you:
> If you record a S&R (in Calc) with the
macro-recorder you will see 
> that each time that you will press one of the 4 buttons
available on the S&R 
> dialog:
> 	Find
> 	Find all
> 	Replace
> 	Replace all
> 
> a dispatch ".uno:ExecuteSearch" will be
recorded.

Yes, that's what happens, but I'm not very fond of it.
Sorry, I was not
clear enough when I described how I think S&R can be
automated.

I think that recording specific S&R actions in general
is useless. The
only S&R actions that are applicable in a general way
are "Replace all",
"Start searching and ask me wether the found text
should be replaced
until no more occurences are found or I stop it" and
"Search and replace
the next occurence of this text". So recording a
single "Replace" is
useful, but having a *combined* macro that contains several
"ExecuteSearch" steps where some of them
replaced the text and some
didn't is useless: you can't apply it to any other text
than the one you
recorded it for (except some very rare cases).

> My problem is actually only the case
SearchItem.Command=2 (replace first)
> because I've not a direct API "traslation"
for this command.

Yes, I understood, sorry for not answering to this directly:
I don't
know how to accomplish that. Perhaps Oliver Specht has an
idea, I will
ask him.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project
Lead
Please reply to the list only, nospamforMBAgmx.de is
a spam sink.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )