LibreOffice Module sw (master)  1
unotextmarkup.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <unotextmarkup.hxx>
21 
23 #include <o3tl/safeint.hxx>
24 #include <osl/diagnose.h>
25 #include <svl/listener.hxx>
26 #include <vcl/svapp.hxx>
27 #include <SwSmartTagMgr.hxx>
28 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
29 #include <com/sun/star/text/TextMarkupType.hpp>
30 #include <com/sun/star/text/TextMarkupDescriptor.hpp>
31 #include <com/sun/star/container/ElementExistException.hpp>
32 #include <com/sun/star/container/XStringKeyMap.hpp>
33 #include <ndtxt.hxx>
34 #include <SwGrammarMarkUp.hxx>
35 #include <TextCursorHelper.hxx>
36 
37 #include <IGrammarContact.hxx>
38 
39 #include <com/sun/star/lang/XUnoTunnel.hpp>
40 #include <com/sun/star/text/XTextRange.hpp>
41 
42 #include <pam.hxx>
43 
44 #include <unotextrange.hxx>
45 #include <modeltoviewhelper.hxx>
46 
47 using namespace ::com::sun::star;
48 
50  : public SvtListener
51 {
54 
55  Impl(SwTextNode* const pTextNode, const ModelToViewHelper& rMap)
56  : m_pTextNode(pTextNode)
57  , m_ConversionMap(rMap)
58  {
59  if(m_pTextNode)
60  StartListening(pTextNode->GetNotifier());
61  }
62 
63  virtual void Notify(const SfxHint& rHint) override;
64 };
65 
67  SwTextNode *const pTextNode, const ModelToViewHelper& rMap)
68  : m_pImpl(new Impl(pTextNode, rMap))
69 {
70 }
71 
73 {
74 }
75 
77 {
78  return m_pImpl->m_pTextNode;
79 }
80 
82 {
83  m_pImpl->m_pTextNode = nullptr;
84  m_pImpl->EndListeningAll();
85 }
86 
88 {
89  return m_pImpl->m_ConversionMap;
90 }
91 
92 uno::Reference< container::XStringKeyMap > SAL_CALL SwXTextMarkup::getMarkupInfoContainer()
93 {
94  return new SwXStringKeyMap;
95 }
96 
97 void SAL_CALL SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const OUString & aIdentifier, const uno::Reference< text::XTextRange> & xRange,
98  const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
99 {
100  SolarMutexGuard aGuard;
101 
102  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
103 
104  if(!xRangeTunnel.is()) return;
105 
106  if (auto pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel))
107  {
108  SwDoc& rDoc = pRange->GetDoc();
109 
110  SwUnoInternalPaM aPam(rDoc);
111 
112  ::sw::XTextRangeToSwPaM(aPam, xRange);
113 
114  SwPosition* startPos = aPam.Start();
115  SwPosition* endPos = aPam.End();
116 
117  commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
118  }
119  else if (auto pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel))
120  {
121  SwPaM & rPam(*pCursor->GetPaM());
122 
123  SwPosition* startPos = rPam.Start();
124  SwPosition* endPos = rPam.End();
125 
126  commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
127  }
128 }
129 
131  ::sal_Int32 nType,
132  const OUString & rIdentifier,
133  ::sal_Int32 nStart,
134  ::sal_Int32 nLength,
135  const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
136 {
137  SolarMutexGuard aGuard;
138 
139  // paragraph already dead or modified?
140  if (!m_pImpl->m_pTextNode || nLength <= 0)
141  return;
142 
143  if ( nType == text::TextMarkupType::SMARTTAG &&
144  !SwSmartTagMgr::Get().IsSmartTagTypeEnabled( rIdentifier ) )
145  return;
146 
147  // get appropriate list to use...
148  SwWrongList* pWList = nullptr;
149  bool bRepaint = false;
150  if ( nType == text::TextMarkupType::SPELLCHECK )
151  {
152  pWList = m_pImpl->m_pTextNode->GetWrong();
153  if ( !pWList )
154  {
155  pWList = new SwWrongList( WRONGLIST_SPELL );
156  m_pImpl->m_pTextNode->SetWrong( std::unique_ptr<SwWrongList>(pWList) );
157  }
158  }
159  else if ( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
160  {
161  IGrammarContact *pGrammarContact = getGrammarContact(*m_pImpl->m_pTextNode);
162  if( pGrammarContact )
163  {
164  pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true);
165  OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
166  }
167  else
168  {
169  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
170  if ( !pWList )
171  {
172  m_pImpl->m_pTextNode->SetGrammarCheck( std::make_unique<SwGrammarMarkUp>() );
173  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
174  }
175  }
176  bRepaint = pWList == m_pImpl->m_pTextNode->GetGrammarCheck();
177  if( pWList->GetBeginInv() < COMPLETE_STRING )
178  static_cast<SwGrammarMarkUp*>(pWList)->ClearGrammarList();
179  }
180  else if ( nType == text::TextMarkupType::SMARTTAG )
181  {
182  pWList = m_pImpl->m_pTextNode->GetSmartTags();
183  if ( !pWList )
184  {
185  pWList = new SwWrongList( WRONGLIST_SMARTTAG );
186  m_pImpl->m_pTextNode->SetSmartTags( std::unique_ptr<SwWrongList>(pWList) );
187  }
188  }
189  else
190  {
191  OSL_FAIL( "Unknown mark-up type" );
192  return;
193  }
194 
195  const ModelToViewHelper::ModelPosition aStartPos =
196  m_pImpl->m_ConversionMap.ConvertToModelPosition( nStart );
197  const ModelToViewHelper::ModelPosition aEndPos =
198  m_pImpl->m_ConversionMap.ConvertToModelPosition( nStart + nLength - 1);
199 
200  const bool bStartInField = aStartPos.mbIsField;
201  const bool bEndInField = aEndPos.mbIsField;
202  bool bCommit = false;
203 
204  if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
205  {
206  nStart = aStartPos.mnSubPos;
207  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
208  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
209 
210  SwWrongList* pSubList = pWList->SubList( nInsertPos );
211  if ( !pSubList )
212  {
213  if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
214  pSubList = new SwGrammarMarkUp();
215  else
216  pSubList = new SwWrongList( pWList->GetWrongListType() );
217  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
218  }
219 
220  pWList = pSubList;
221  bCommit = true;
222  }
223  else if ( !bStartInField && !bEndInField )
224  {
225  nStart = aStartPos.mnPos;
226  bCommit = true;
227  nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
228  }
229  else if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
230  {
231  bCommit = true;
232  nStart = aStartPos.mnPos;
233  sal_Int32 nEnd = aEndPos.mnPos;
234  if( bStartInField && nType != text::TextMarkupType::SENTENCE )
235  {
236  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
237  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
238  SwWrongList* pSubList = pWList->SubList( nInsertPos );
239  if ( !pSubList )
240  {
241  pSubList = new SwGrammarMarkUp();
242  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
243  }
244  const sal_Int32 nTmpStart =
245  m_pImpl->m_ConversionMap.ConvertToViewPosition(aStartPos.mnPos);
246  const sal_Int32 nTmpLen =
247  m_pImpl->m_ConversionMap.ConvertToViewPosition(aStartPos.mnPos + 1)
248  - nTmpStart - aStartPos.mnSubPos;
249  if( nTmpLen > 0 )
250  {
251  pSubList->Insert( rIdentifier, xMarkupInfoContainer, aStartPos.mnSubPos, nTmpLen );
252  }
253  ++nStart;
254  }
255  if( bEndInField && nType != text::TextMarkupType::SENTENCE )
256  {
257  const sal_Int32 nFieldPosModel = aEndPos.mnPos;
258  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
259  SwWrongList* pSubList = pWList->SubList( nInsertPos );
260  if ( !pSubList )
261  {
262  pSubList = new SwGrammarMarkUp();
263  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
264  }
265  const sal_Int32 nTmpLen = aEndPos.mnSubPos + 1;
266  pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, nTmpLen );
267  }
268  else
269  ++nEnd;
270  if( nEnd > nStart )
271  nLength = nEnd - nStart;
272  else
273  bCommit = false;
274  }
275 
276  if ( bCommit )
277  {
278  if( nType == text::TextMarkupType::SENTENCE )
279  static_cast<SwGrammarMarkUp*>(pWList)->setSentence( nStart );
280  else
281  pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength );
282  }
283 
284  if( bRepaint )
285  finishGrammarCheck(*m_pImpl->m_pTextNode);
286 }
287 
289  const ModelToViewHelper& rConversionMap,
290  SwGrammarMarkUp* pWList,
291  ::sal_Int32 nType,
292  const OUString & rIdentifier,
293  ::sal_Int32 nStart,
294  ::sal_Int32 nLength,
295  const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
296 {
297  OSL_ENSURE( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE, "Wrong mark-up type" );
298  const ModelToViewHelper::ModelPosition aStartPos =
299  rConversionMap.ConvertToModelPosition( nStart );
300  const ModelToViewHelper::ModelPosition aEndPos =
301  rConversionMap.ConvertToModelPosition( nStart + nLength - 1);
302 
303  const bool bStartInField = aStartPos.mbIsField;
304  const bool bEndInField = aEndPos.mbIsField;
305  bool bCommit = false;
306 
307  if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
308  {
309  nStart = aStartPos.mnSubPos;
310  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
311  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
312 
313  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
314  if ( !pSubList )
315  {
316  pSubList = new SwGrammarMarkUp();
317  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
318  }
319 
320  pWList = pSubList;
321  bCommit = true;
322  }
323  else if ( !bStartInField && !bEndInField )
324  {
325  nStart = aStartPos.mnPos;
326  bCommit = true;
327  nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
328  }
329  else
330  {
331  bCommit = true;
332  nStart = aStartPos.mnPos;
333  sal_Int32 nEnd = aEndPos.mnPos;
334  if( bStartInField && nType != text::TextMarkupType::SENTENCE )
335  {
336  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
337  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
338  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
339  if ( !pSubList )
340  {
341  pSubList = new SwGrammarMarkUp();
342  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
343  }
344  const sal_Int32 nTmpStart = rConversionMap.ConvertToViewPosition( aStartPos.mnPos );
345  const sal_Int32 nTmpLen = rConversionMap.ConvertToViewPosition( aStartPos.mnPos + 1 )
346  - nTmpStart - aStartPos.mnSubPos;
347  if( nTmpLen > 0 )
348  pSubList->Insert( rIdentifier, xMarkupInfoContainer, aStartPos.mnSubPos, nTmpLen );
349  ++nStart;
350  }
351  if( bEndInField && nType != text::TextMarkupType::SENTENCE )
352  {
353  const sal_Int32 nFieldPosModel = aEndPos.mnPos;
354  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
355  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
356  if ( !pSubList )
357  {
358  pSubList = new SwGrammarMarkUp();
359  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
360  }
361  const sal_Int32 nTmpLen = aEndPos.mnSubPos + 1;
362  pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, nTmpLen );
363  }
364  else
365  ++nEnd;
366  if( nEnd > nStart )
367  nLength = nEnd - nStart;
368  else
369  bCommit = false;
370  }
371 
372  if ( bCommit )
373  {
374  if( nType == text::TextMarkupType::SENTENCE )
375  pWList->setSentence( nStart+nLength );
376  else
377  pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength );
378  }
379 }
380 
382  const uno::Sequence< text::TextMarkupDescriptor > &rMarkups )
383 {
384  SolarMutexGuard aGuard;
385 
386  // paragraph already dead or modified?
387  if (!m_pImpl->m_pTextNode)
388  return;
389 
390  // for grammar checking there should be exactly one sentence markup
391  // and 0..n grammar markups.
392  // Different markups are not expected but may be applied anyway since
393  // that should be no problem...
394  // but it has to be implemented, at the moment only this function is for
395  // grammar markups and sentence markup only!
396  const text::TextMarkupDescriptor *pSentenceMarkUp = nullptr;
397  for( const text::TextMarkupDescriptor &rDesc : rMarkups )
398  {
399  if (rDesc.nType == text::TextMarkupType::SENTENCE)
400  {
401  if (pSentenceMarkUp != nullptr)
402  throw lang::IllegalArgumentException(); // there is already one sentence markup
403  pSentenceMarkUp = &rDesc;
404  }
405  else if( rDesc.nType != text::TextMarkupType::PROOFREADING )
406  return;
407  }
408 
409  if( pSentenceMarkUp == nullptr )
410  return;
411 
412  // get appropriate list to use...
413  SwGrammarMarkUp* pWList = nullptr;
414  bool bRepaint = false;
415  IGrammarContact *pGrammarContact = getGrammarContact(*m_pImpl->m_pTextNode);
416  if( pGrammarContact )
417  {
418  pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true);
419  OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
420  }
421  else
422  {
423  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
424  if ( !pWList )
425  {
426  m_pImpl->m_pTextNode->SetGrammarCheck( std::make_unique<SwGrammarMarkUp>() );
427  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
428  pWList->SetInvalid( 0, COMPLETE_STRING );
429  }
430  }
431  bRepaint = pWList == m_pImpl->m_pTextNode->GetGrammarCheck();
432 
433  bool bAcceptGrammarError = false;
434  if( pWList->GetBeginInv() < COMPLETE_STRING )
435  {
436  const ModelToViewHelper::ModelPosition aSentenceEnd =
437  m_pImpl->m_ConversionMap.ConvertToModelPosition(
438  pSentenceMarkUp->nOffset + pSentenceMarkUp->nLength );
439  bAcceptGrammarError = aSentenceEnd.mnPos > pWList->GetBeginInv();
440  pWList->ClearGrammarList( aSentenceEnd.mnPos );
441  }
442 
443  if( bAcceptGrammarError )
444  {
445  for( const text::TextMarkupDescriptor &rDesc : rMarkups )
446  {
447  lcl_commitGrammarMarkUp(m_pImpl->m_ConversionMap, pWList, rDesc.nType,
448  rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
449  }
450  }
451  else
452  {
453  bRepaint = false;
454  const text::TextMarkupDescriptor &rDesc = *pSentenceMarkUp;
455  lcl_commitGrammarMarkUp(m_pImpl->m_ConversionMap, pWList, rDesc.nType,
456  rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
457  }
458 
459  if( bRepaint )
460  finishGrammarCheck(*m_pImpl->m_pTextNode);
461 }
462 
464 {
466  if(rHint.GetId() == SfxHintId::Dying)
467  {
468  m_pTextNode = nullptr;
469  }
470 }
471 
473 {
474 }
475 
476 uno::Any SAL_CALL SwXStringKeyMap::getValue(const OUString & aKey)
477 {
478  std::map< OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
479  if ( aIter == maMap.end() )
480  throw container::NoSuchElementException();
481 
482  return (*aIter).second;
483 }
484 
485 sal_Bool SAL_CALL SwXStringKeyMap::hasValue(const OUString & aKey)
486 {
487  return maMap.find( aKey ) != maMap.end();
488 }
489 
490 void SAL_CALL SwXStringKeyMap::insertValue(const OUString & aKey, const uno::Any & aValue)
491 {
492  std::map< OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
493  if ( aIter != maMap.end() )
494  throw container::ElementExistException();
495 
496  maMap[ aKey ] = aValue;
497 }
498 
499 ::sal_Int32 SAL_CALL SwXStringKeyMap::getCount()
500 {
501  return maMap.size();
502 }
503 
504 OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
505 {
506  if ( o3tl::make_unsigned(nIndex) >= maMap.size() )
507  throw lang::IndexOutOfBoundsException();
508 
509  return OUString();
510 }
511 
512 uno::Any SAL_CALL SwXStringKeyMap::getValueByIndex(::sal_Int32 nIndex)
513 {
514  if ( o3tl::make_unsigned(nIndex) >= maMap.size() )
515  throw lang::IndexOutOfBoundsException();
516 
517  return uno::Any();
518 }
519 
520 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Marks a position in the document model.
Definition: pam.hxx:36
virtual css::uno::Any SAL_CALL getValue(const OUString &aKey) override
virtual SwGrammarMarkUp * getGrammarCheck(SwTextNode &rTextNode, bool bCreate)=0
getGrammarCheck checks if the given text node is blocked by the current cursor if not...
void Insert(const OUString &rType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag, sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere)
Definition: wrong.hxx:325
virtual sal_Bool SAL_CALL hasValue(const OUString &aKey) override
Definition: doc.hxx:187
virtual OUString SAL_CALL getKeyByIndex(::sal_Int32 nIndex) override
void InsertSubList(sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere, SwWrongList *pSubList)
Definition: wrong.cxx:522
SwTextNode * GetTextNode()
virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() override
This struct defines a position in the model string.
SfxHintId GetId() const
void ClearTextNode()
virtual ~SwXTextMarkup() override
IGrammarContact * getGrammarContact(const SwTextNode &rTextNode)
getGrammarContact() delivers the grammar contact of the document (for a given textnode) ...
Definition: docnew.cxx:806
SwWrongList * SubList(sal_uInt16 nIdx) const
Definition: wrong.hxx:342
SwIndex nContent
Definition: pam.hxx:39
sal_Int32 ConvertToViewPosition(sal_Int32 nModelPos) const
Converts a model position into a view position.
void finishGrammarCheck(SwTextNode &rTextNode)
finishGrammarCheck() calls the same function of the grammar contact of the document (for a given text...
virtual void SAL_CALL commitMultiTextMarkup(const css::uno::Sequence< css::text::TextMarkupDescriptor > &aMarkups) override
virtual css::uno::Any SAL_CALL getValueByIndex(::sal_Int32 nIndex) override
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
virtual void SAL_CALL insertValue(const OUString &aKey, const css::uno::Any &aValue) override
virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString &aIdentifier,::sal_Int32 nStart,::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > &xMarkupInfoContainer) override
static SwSmartTagMgr & Get()
SwXTextMarkup(SwTextNode *const rTextNode, const ModelToViewHelper &rConversionMap)
Implementation of the css::container::XStringKeyMap interface.
SwTextNode * m_pTextNode
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
unsigned char sal_Bool
Impl(SwTextNode *const pTextNode, const ModelToViewHelper &rMap)
::sw::UnoImplPtr< Impl > m_pImpl
bool StartListening(SvtBroadcaster &rBroadcaster)
const SwPosition * Start() const
Definition: pam.hxx:213
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1107
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:101
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
WrongListType GetWrongListType() const
Definition: wrong.hxx:287
sal_Int32 GetBeginInv() const
Definition: wrong.hxx:288
virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString &aIdentifier, const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::container::XStringKeyMap > &xMarkupInfoContainer) override
sal_uInt16 GetWrongPos(sal_Int32 nValue) const
Find the first position that is greater or equal to the given value.
Definition: wrong.cxx:190
sal_Int32 GetIndex() const
Definition: index.hxx:91
const SwPosition * End() const
Definition: pam.hxx:218
ModelPosition ConvertToModelPosition(sal_Int32 nViewPos) const
Converts a view position into a model position.
Organizer of the contact between SwTextNodes and grammar checker.
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:57
void ClearGrammarList(sal_Int32 nSentenceEnd=COMPLETE_STRING)
void setSentence(sal_Int32 nStart)
#define DBG_TESTSOLARMUTEX()
static void lcl_commitGrammarMarkUp(const ModelToViewHelper &rConversionMap, SwGrammarMarkUp *pWList,::sal_Int32 nType, const OUString &rIdentifier,::sal_Int32 nStart,::sal_Int32 nLength, const uno::Reference< container::XStringKeyMap > &xMarkupInfoContainer)
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
ModelToViewHelper const m_ConversionMap
void Insert(sal_uInt16 nWhere, std::vector< SwWrongArea >::iterator startPos, std::vector< SwWrongArea >::iterator const &endPos)
Definition: wrong.cxx:537
void SetInvalid(sal_Int32 nBegin, sal_Int32 nEnd)
Definition: wrong.cxx:253
virtual ::sal_Int32 SAL_CALL getCount() override
const ModelToViewHelper & GetConversionMap() const
virtual void Notify(const SfxHint &rHint) override