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;
}

-- 
View this message in context: 
http://www.nabble.com/Proofreading%3A-implementations-issues-tp25911140p25911140.html
Sent from the openoffice - lingucomponent dev mailing list archive at 
Nabble.com.


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

Reply via email to