summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorFred Kruse <fred.kruse@gmx.de>2020-03-02 21:12:50 +0100
committerMichael Stahl <michael.stahl@cib.de>2020-03-06 11:12:52 +0100
commitf0d0436e9f360575bda2c1e4f1ed4d3f6fa0b40f (patch)
tree698f1c27fd93c3e4f33589518b7ac6d45b3cb5f9 /linguistic
parentde81e89b25c710173852b1bdebc1d6f96fcd2812 (diff)
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.stahl@cib.de>
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/gciterator.cxx14
1 files changed, 10 insertions, 4 deletions
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 );