Hi Guy,

guyatnabble wrote:
> Hi,
>
> I have found out that this will happen if you uncheck the "Check grammar as
> you type" check box in the options-writing aids  dialog.
>
> Is this a bug (or am I missing something and this is the expected behavior?)
> ?
>   
I would still expect that it is a problem on your side because there are
already at least three existing proofreaders without problems. Namely
CoGrOO <http://extensions.services.openoffice.org/project/cogroo> and
LanguageTool.
On the other hand those are probably implementing the sentence end
detection on their own.

Actually I wanted to paste your code into an existing grammar checking
extension last Friday and see what happens. But other things came up.
If you like to check see more what happens and in what order calls are
made you get the 'linguistic' project and compile the file
gciterator.cxx with debug info. In that file all the calls to the
proofreader are done.

Hope this helps for now.

BTW: which Office version do you use?
Please update to OOo 3.1.1 if you are not using it already because of
issue 103936.


Regards,
Thomas


>
> guyatnabble wrote:
> > 
> > Hi,
> > 
> > I am trying to implement a Grammar Checker (C++)  and I have implemented
> > XProofreader in my test module.
> > 
> > I have 2 issues: 
> > 1. After doProofreading() returns (grammar) errors its gets called always
> > with the same StartOfSentencePos and SuggestedBehindEndOfSentencePosition
> > parameters (pointing to the first sentence in the paragraph) even when I
> > click "Ignore Once" (I would have expect to be called with index of next
> > sentence).
> > When doProofreading() does not return a (grammar) error, next call will
> > provide, correctly, the indexes pointing to the next sentence.
> > 
> > 2. I supply correction for  2 (grammar) errors but see in the UI only the
> > first.
> > 
> > BTW, is there a documentation which explain the flow of the calls and
> > parameters in details?
> > 
> > Below is my doProofreading() function.
> > 
> > Thanks and Best Regards
> > Guy
> > 
> > linguistic2::ProofreadingResult SAL_CALL 
> >     GrammarChecker::doProofreading(const OUString & aDocumentIdentifier,
> >                                                                const 
> > OUString & aText,
> >                                                                const 
> > lang::Locale & aLocale,
> >                                                                sal_Int32 
> > nStartOfSentencePos,
> >                                                                sal_Int32 
> > nSuggestedBehindEndOfSentencePosition,
> >                                                                const 
> > uno::Sequence<beans::PropertyValue> &  aProperties) 
> >                                                                             
> >                 throw (uno::RuntimeException, 
> > lang::IllegalArgumentException) 
> > {
> >     linguistic2::ProofreadingResult result;
> >     result.aDocumentIdentifier = aDocumentIdentifier;
> >     result.xFlatParagraph = 0;
> >     result.aText = aText;
> >     result.aLocale = aLocale;
> >     result.nStartOfSentencePosition = nStartOfSentencePos;
> >     result.nBehindEndOfSentencePosition =
> > nSuggestedBehindEndOfSentencePosition;
> >     result.xProofreader = this;
> >     OString text = ::rtl::OUStringToOString(aText, RTL_TEXTENCODING_UTF8);
> >     sal_Int32 paraLen = text.getLength();
> >     if (paraLen <= 100) 
> >             return result;
> > 
> >     // DUMMY ERRORS (for the sake of the test)
> >     uno::Sequence<linguistic2::SingleProofreadingError> spErrors(2);
> >     spErrors[0].nErrorStart = result.nStartOfSentencePosition;
> >     spErrors[0].nErrorLength = 3;
> >     spErrors[0].nErrorType = text::TextMarkupType::PROOFREADING;
> >     OUString comment (RTL_CONSTASCII_USTRINGPARAM("A grammer error") );
> >     OUString commentLong (RTL_CONSTASCII_USTRINGPARAM("A grammer error long
> > long") );
> >     spErrors[0].aShortComment = comment;
> >     spErrors[0].aFullComment = commentLong;
> >     uno::Sequence<OUString> suggSeq(1);
> >     OString ostr = OString("Sugg");
> >     suggSeq[0] = OStringToOUString(ostr, RTL_TEXTENCODING_UTF8);
> >     spErrors[0].aSuggestions = suggSeq;
> >     spErrors[1].nErrorStart = result.nStartOfSentencePosition + 10;
> >     spErrors[1].nErrorLength = 10;
> >     spErrors[1].nErrorType = text::TextMarkupType::PROOFREADING;
> >     OUString comment2 (RTL_CONSTASCII_USTRINGPARAM("Found a grammer error2 
> > ")
> > );
> >     OUString commentLong2 (RTL_CONSTASCII_USTRINGPARAM("Found a grammer 
> > error
> > long long 2") );
> >     spErrors[1].aShortComment = comment2;
> >     spErrors[1].aFullComment = commentLong2;
> >     uno::Sequence<OUString> suggSeq2(1);
> >     OString ostr2 = OString("Sugg2");
> >     suggSeq2[0] = OStringToOUString(ostr2, RTL_TEXTENCODING_UTF8);
> >     spErrors[1].aSuggestions = suggSeq2;
> > 
> >     result.aErrors = spErrors;
> >     result.nStartOfNextSentencePosition =
> > nSuggestedBehindEndOfSentencePosition;
> >     return result;
> > }
> > 
> > 
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lingucomponent.openoffice.org
For additional commands, e-mail: dev-h...@lingucomponent.openoffice.org

Reply via email to