Hi,

i already solved it. Now i have another doubt. I would like to replace the
selected text of the document with another text. How can i do that? I saw
some examples about replace all the ocurrence of a string with another
string, but what i want is just replace the selected string in the document
with another string.
Does anyone knows how i do that?

regards,
Joel Filipe Antunes Cordeiro
[EMAIL PROTECTED]
[EMAIL PROTECTED]


On Tue, Sep 30, 2008 at 6:36 PM, Ariel Constenla-Haile <
[EMAIL PROTECTED]> wrote:

> Hi Joel,
>
> Joel Cordeiro escribió:
>
>> Hi,
>>
>> does anyone could help me about how to get the selected text in the actual
>> TextDocument (Writer)? How does we cast the returned object in the method
>> getCurrentSelection() ? Or there is another way?
>>
>
>
> basically, you have to check if the object returned by
> getCurrentSelection() is not null/void/empty (depending on your
> programming language), and if not, then query for the selection's
> com.sun.star.lang.XServiceInfo. According to the service supported by
> the selection, you can know what is selected.
>
>
>  If possible, a simple example would be really nice..
>>
>
> http://www.ArielConstenlaHaile.com.ar/ooo/temp/WriterSelectionDetector.zip
> is an example of a selection change listener, but you can adapt it
> easyly (see the file
> WriterSelectionDetector/src/org/openoffice/sdk/java/text/WriterSelectionListener.java,
>
> it has some comments explaining the different types of selections).
>
> Besides, you'll find the documentation in
>
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/TextView
>
>
> Regards
> Ariel.
>
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>
> [EMAIL PROTECTED]
> http://www.ArielConstenlaHaile.com.ar/ooo/
>
>
>
> "Aus der Kriegsschule des Lebens
>                - Was mich nicht umbringt,
>        macht mich härter."
>                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to