On 11/23/12 6:56 PM, Robert Barbey wrote:
> Here it is: https://issues.apache.org/ooo/show_bug.cgi?id=121391

Hi Robert,

I took the time and looked in the patch. And I talked with Oliver about
it and we have some questions/comments

1. the new method "commitTextMarkupRange" seems to be for convenience
only or from our pov obsolete.
Instead of calling the new method commitTextMarkupRange(.., xRange, ..)
the existing method commitTextMarkup(.., xRange.getStart(),
xRange.getEnd() - xRange.getStart(), ..) can be called.

2. Can you explain in more detail why you need the XTextRange object in
the recognize function instead of just of simply the text, start and end?
We assume you need it to identify your already prepared text ranges and
check if they are related to the current text, correct? You do a much
more complicate analysis of the text via the server and you use the
SmartTag API to visualize the results and provide the related actions.

Anyway the name "recognizeAll" seems to be not really appropriate. The
normal "recognize" method is called for text portions depending on their
locale. This make sense to use the break iterator. You have done this
already and simply want recognize or better commit the result only for
the whole text (paragraph).
"recognizeAllLocales" would be probably a better name.

But when you implement a SmartTag you have to implement both function
and you get called for both. That seems to be not optimal and I am
thinking if it would be better to

A. put the new method in a separate optional interface and check if the
this interface is implmented or not and make the call of this method
depending on the availability of this interface.

B. change the existing (not published) API and replace the first
argument "string" to "XTextRange". I have to double check the
implementation and my test SmartTag but it seems that aText contains
always the complete text of the paragraph.

But let us discuss it in more detail, I will do some real check and you
explain for what exactly you need the range object.

Juergen






> 
> Thanks again,
> Robert
> 
> 
> I just double-checked, I did attach a file (puh!) and it must have been 
> removed by mailing list policies.
> 
> But I will follow Oliver's suggestion and file a bug first.
> 
> Thanks for your help,
> Robert
> 
> 
> On 23.11.2012, at 18:12, "Jürgen Schmidt" 
> <jogischm...@gmail.com<mailto:jogischm...@gmail.com>> wrote:
> 
> On 11/23/12 5:45 PM, Robert Barbey wrote:
> Hi everyone,
> 
> for a Writer extension, we're traversing a document using the Java text 
> iteration API. The text is extracted and sent to a server backend for 
> linguistic analysis. This server returns a report containing corrections for 
> the current document which the extension needs to map back into the document. 
> All of this is based on XTextRange objects.
> 
> In order to highlight these corrections within document, we are using smart 
> tags. But with the existing XSmartTagRecognizer interface it's not possible 
> to determine reliably the absolute position of  the text that is to be 
> processed in the recognize method of the interface. To be able to do that we 
> would need an XTextRange object as argument. This, of course, would require a 
> change of the XTextMarkup interface so that it also supports committing 
> markup for XTextRanges.
> 
> In the attached file, you find a patch that adds this functionality. It would 
> be really great if you could review these changes and provide feedback for 
> improvements or if you think that we have missed something essential. WE 
> think that this addition could be beneficial to other extensions as well.
> 
> Thank you very much and have a nice weekend.
> 
> Best,
> Robert
> 
> Hi Robert,
> 
> I am looking forward to see your patch ;-)
> 
> The good news is that XTextMarkup is an unpublished interface yet and I
> don't expect to many SmartTag extensions yet. We will see...
> 
> Normally API changes are not easy to make, especially with already
> published API's.
> 
> Juergen
> 
> 

Reply via email to