linguistic/source/gciterator.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit f0d0436e9f360575bda2c1e4f1ed4d3f6fa0b40f
Author:     Fred Kruse <fred.kr...@gmx.de>
AuthorDate: Mon Mar 2 21:12:50 2020 +0100
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Fri Mar 6 11:12:52 2020 +0100

    add information to xProofrader in gciterator.cxx
    
    the in formation gives the reason for the initiataed proof. This helps to
    get the location of the checked paragraph inside the test. This is needed
    for running text level rules e.g. in LanguagTool
    
    Change-Id: I559a07a74932134c6dbb04fb9f6137e623e02d5b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89854
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index c0e56632df4b..2c95c33a690f 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -120,6 +120,10 @@ static const sal_Unicode aWhiteSpaces[] =
     0xfffb    /* INTERLINEAR ANNOTATION TERMINATOR */
 };
 
+//  Information about reason for proofreading (ProofInfo)
+   static const sal_Int32 PROOFINFO_GET_PROOFRESULT = 1;
+   static const sal_Int32 PROOFINFO_MARK_PARAGRAPH = 2;
+
 static const int nWhiteSpaces = SAL_N_ELEMENTS( aWhiteSpaces );
 
 static bool lcl_IsWhiteSpace( sal_Unicode cChar )
@@ -545,13 +549,15 @@ uno::Reference< linguistic2::XProofreader > 
GrammarCheckingIterator::GetGrammarC
 }
 
 static uno::Sequence<beans::PropertyValue>
-lcl_makeProperties(uno::Reference<text::XFlatParagraph> const& xFlatPara)
+lcl_makeProperties(uno::Reference<text::XFlatParagraph> const& xFlatPara, 
sal_Int32 nProofInfo)
 {
     uno::Reference<beans::XPropertySet> const xProps(
             xFlatPara, uno::UNO_QUERY_THROW);
+    css::uno::Any a (nProofInfo);
     return comphelper::InitPropertySequence({
         { "FieldPositions", xProps->getPropertyValue("FieldPositions") },
-        { "FootnotePositions", xProps->getPropertyValue("FootnotePositions") }
+        { "FootnotePositions", xProps->getPropertyValue("FootnotePositions") },
+        { "ProofInfo", a }
     });
 }
 
@@ -619,7 +625,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
                             {
                                 aGuard.clear();
                                 uno::Sequence<beans::PropertyValue> const 
aProps(
-                                    lcl_makeProperties(xFlatPara));
+                                    lcl_makeProperties(xFlatPara, 
PROOFINFO_MARK_PARAGRAPH));
                                 aRes = xGC->doProofreading(aCurDocId, aCurTxt, 
aCurLocale,
                                                            nStartPos, 
nSuggestedEnd, aProps);
 
@@ -772,7 +778,7 @@ linguistic2::ProofreadingResult SAL_CALL 
GrammarCheckingIterator::checkSentenceA
             if (xGC.is())
             {
                 uno::Sequence<beans::PropertyValue> const aProps(
-                        lcl_makeProperties(xFlatPara));
+                        lcl_makeProperties(xFlatPara, 
PROOFINFO_GET_PROOFRESULT));
                 aTmpRes = xGC->doProofreading( aDocId, rText,
                     aCurLocale, nStartPos, nSuggestedEndOfSentencePos, aProps 
);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to