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 
22 #include <o3tl/safeint.hxx>
23 #include <osl/diagnose.h>
24 #include <svl/listener.hxx>
25 #include <vcl/svapp.hxx>
26 #include <SwSmartTagMgr.hxx>
27 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
28 #include <com/sun/star/text/TextMarkupType.hpp>
29 #include <com/sun/star/text/TextMarkupDescriptor.hpp>
30 #include <com/sun/star/container/ElementExistException.hpp>
31 #include <com/sun/star/container/XStringKeyMap.hpp>
32 #include <ndtxt.hxx>
33 #include <SwGrammarMarkUp.hxx>
34 #include <TextCursorHelper.hxx>
35 
36 #include <IGrammarContact.hxx>
37 
38 #include <com/sun/star/lang/XUnoTunnel.hpp>
39 #include <com/sun/star/text/XTextRange.hpp>
40 
41 #include <pam.hxx>
42 
43 #include <unotextrange.hxx>
44 #include <modeltoviewhelper.hxx>
45 
46 using namespace ::com::sun::star;
47 
49  : public SvtListener
50 {
53 
54  Impl(SwTextNode* const pTextNode, const ModelToViewHelper& rMap)
55  : m_pTextNode(pTextNode)
56  , m_ConversionMap(rMap)
57  {
58  if(m_pTextNode)
59  StartListening(pTextNode->GetNotifier());
60  }
61 
62  virtual void Notify(const SfxHint& rHint) override;
63 };
64 
66  SwTextNode *const pTextNode, const ModelToViewHelper& rMap)
67  : m_pImpl(new Impl(pTextNode, rMap))
68 {
69 }
70 
72 {
73 }
74 
76 {
77  return m_pImpl->m_pTextNode;
78 }
79 
81 {
82  m_pImpl->m_pTextNode = nullptr;
83  m_pImpl->EndListeningAll();
84 }
85 
87 {
88  return m_pImpl->m_ConversionMap;
89 }
90 
91 uno::Reference< container::XStringKeyMap > SAL_CALL SwXTextMarkup::getMarkupInfoContainer()
92 {
93  SolarMutexGuard aGuard;
94 
95  uno::Reference< container::XStringKeyMap > xProp = new SwXStringKeyMap;
96  return xProp;
97 }
98 
99 void SAL_CALL SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const OUString & aIdentifier, const uno::Reference< text::XTextRange> & xRange,
100  const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
101 {
102  SolarMutexGuard aGuard;
103 
104  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
105 
106  if(!xRangeTunnel.is()) return;
107 
108  if (auto pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel))
109  {
110  SwDoc& rDoc = pRange->GetDoc();
111 
112  SwUnoInternalPaM aPam(rDoc);
113 
114  ::sw::XTextRangeToSwPaM(aPam, xRange);
115 
116  SwPosition* startPos = aPam.Start();
117  SwPosition* endPos = aPam.End();
118 
119  commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
120  }
121  else if (auto pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel))
122  {
123  SwPaM & rPam(*pCursor->GetPaM());
124 
125  SwPosition* startPos = rPam.Start();
126  SwPosition* endPos = rPam.End();
127 
128  commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
129  }
130 }
131 
133  ::sal_Int32 nType,
134  const OUString & rIdentifier,
135  ::sal_Int32 nStart,
136  ::sal_Int32 nLength,
137  const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
138 {
139  SolarMutexGuard aGuard;
140 
141  // paragraph already dead or modified?
142  if (!m_pImpl->m_pTextNode || nLength <= 0)
143  return;
144 
145  if ( nType == text::TextMarkupType::SMARTTAG &&
146  !SwSmartTagMgr::Get().IsSmartTagTypeEnabled( rIdentifier ) )
147  return;
148 
149  // get appropriate list to use...
150  SwWrongList* pWList = nullptr;
151  bool bRepaint = false;
152  if ( nType == text::TextMarkupType::SPELLCHECK )
153  {
154  pWList = m_pImpl->m_pTextNode->GetWrong();
155  if ( !pWList )
156  {
157  pWList = new SwWrongList( WRONGLIST_SPELL );
158  m_pImpl->m_pTextNode->SetWrong( std::unique_ptr<SwWrongList>(pWList) );
159  }
160  }
161  else if ( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
162  {
163  IGrammarContact *pGrammarContact = getGrammarContact(*m_pImpl->m_pTextNode);
164  if( pGrammarContact )
165  {
166  pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true);
167  OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
168  }
169  else
170  {
171  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
172  if ( !pWList )
173  {
174  m_pImpl->m_pTextNode->SetGrammarCheck( std::make_unique<SwGrammarMarkUp>() );
175  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
176  }
177  }
178  bRepaint = pWList == m_pImpl->m_pTextNode->GetGrammarCheck();
179  if( pWList->GetBeginInv() < COMPLETE_STRING )
180  static_cast<SwGrammarMarkUp*>(pWList)->ClearGrammarList();
181  }
182  else if ( nType == text::TextMarkupType::SMARTTAG )
183  {
184  pWList = m_pImpl->m_pTextNode->GetSmartTags();
185  if ( !pWList )
186  {
187  pWList = new SwWrongList( WRONGLIST_SMARTTAG );
188  m_pImpl->m_pTextNode->SetSmartTags( std::unique_ptr<SwWrongList>(pWList) );
189  }
190  }
191  else
192  {
193  OSL_FAIL( "Unknown mark-up type" );
194  return;
195  }
196 
197  const ModelToViewHelper::ModelPosition aStartPos =
198  m_pImpl->m_ConversionMap.ConvertToModelPosition( nStart );
199  const ModelToViewHelper::ModelPosition aEndPos =
200  m_pImpl->m_ConversionMap.ConvertToModelPosition( nStart + nLength - 1);
201 
202  const bool bStartInField = aStartPos.mbIsField;
203  const bool bEndInField = aEndPos.mbIsField;
204  bool bCommit = false;
205 
206  if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
207  {
208  nStart = aStartPos.mnSubPos;
209  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
210  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
211 
212  SwWrongList* pSubList = pWList->SubList( nInsertPos );
213  if ( !pSubList )
214  {
215  if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
216  pSubList = new SwGrammarMarkUp();
217  else
218  pSubList = new SwWrongList( pWList->GetWrongListType() );
219  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
220  }
221 
222  pWList = pSubList;
223  bCommit = true;
224  }
225  else if ( !bStartInField && !bEndInField )
226  {
227  nStart = aStartPos.mnPos;
228  bCommit = true;
229  nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
230  }
231  else if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
232  {
233  bCommit = true;
234  nStart = aStartPos.mnPos;
235  sal_Int32 nEnd = aEndPos.mnPos;
236  if( bStartInField && nType != text::TextMarkupType::SENTENCE )
237  {
238  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
239  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
240  SwWrongList* pSubList = pWList->SubList( nInsertPos );
241  if ( !pSubList )
242  {
243  pSubList = new SwGrammarMarkUp();
244  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
245  }
246  const sal_Int32 nTmpStart =
247  m_pImpl->m_ConversionMap.ConvertToViewPosition(aStartPos.mnPos);
248  const sal_Int32 nTmpLen =
249  m_pImpl->m_ConversionMap.ConvertToViewPosition(aStartPos.mnPos + 1)
250  - nTmpStart - aStartPos.mnSubPos;
251  if( nTmpLen > 0 )
252  {
253  pSubList->Insert( rIdentifier, xMarkupInfoContainer, aStartPos.mnSubPos, nTmpLen );
254  }
255  ++nStart;
256  }
257  if( bEndInField && nType != text::TextMarkupType::SENTENCE )
258  {
259  const sal_Int32 nFieldPosModel = aEndPos.mnPos;
260  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
261  SwWrongList* pSubList = pWList->SubList( nInsertPos );
262  if ( !pSubList )
263  {
264  pSubList = new SwGrammarMarkUp();
265  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
266  }
267  const sal_Int32 nTmpLen = aEndPos.mnSubPos + 1;
268  pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, nTmpLen );
269  }
270  else
271  ++nEnd;
272  if( nEnd > nStart )
273  nLength = nEnd - nStart;
274  else
275  bCommit = false;
276  }
277 
278  if ( bCommit )
279  {
280  if( nType == text::TextMarkupType::SENTENCE )
281  static_cast<SwGrammarMarkUp*>(pWList)->setSentence( nStart );
282  else
283  pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength );
284  }
285 
286  if( bRepaint )
287  finishGrammarCheck(*m_pImpl->m_pTextNode);
288 }
289 
291  const ModelToViewHelper& rConversionMap,
292  SwGrammarMarkUp* pWList,
293  ::sal_Int32 nType,
294  const OUString & rIdentifier,
295  ::sal_Int32 nStart,
296  ::sal_Int32 nLength,
297  const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
298 {
299  OSL_ENSURE( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE, "Wrong mark-up type" );
300  const ModelToViewHelper::ModelPosition aStartPos =
301  rConversionMap.ConvertToModelPosition( nStart );
302  const ModelToViewHelper::ModelPosition aEndPos =
303  rConversionMap.ConvertToModelPosition( nStart + nLength - 1);
304 
305  const bool bStartInField = aStartPos.mbIsField;
306  const bool bEndInField = aEndPos.mbIsField;
307  bool bCommit = false;
308 
309  if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
310  {
311  nStart = aStartPos.mnSubPos;
312  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
313  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
314 
315  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
316  if ( !pSubList )
317  {
318  pSubList = new SwGrammarMarkUp();
319  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
320  }
321 
322  pWList = pSubList;
323  bCommit = true;
324  }
325  else if ( !bStartInField && !bEndInField )
326  {
327  nStart = aStartPos.mnPos;
328  bCommit = true;
329  nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
330  }
331  else
332  {
333  bCommit = true;
334  nStart = aStartPos.mnPos;
335  sal_Int32 nEnd = aEndPos.mnPos;
336  if( bStartInField && nType != text::TextMarkupType::SENTENCE )
337  {
338  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
339  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
340  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
341  if ( !pSubList )
342  {
343  pSubList = new SwGrammarMarkUp();
344  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
345  }
346  const sal_Int32 nTmpStart = rConversionMap.ConvertToViewPosition( aStartPos.mnPos );
347  const sal_Int32 nTmpLen = rConversionMap.ConvertToViewPosition( aStartPos.mnPos + 1 )
348  - nTmpStart - aStartPos.mnSubPos;
349  if( nTmpLen > 0 )
350  pSubList->Insert( rIdentifier, xMarkupInfoContainer, aStartPos.mnSubPos, nTmpLen );
351  ++nStart;
352  }
353  if( bEndInField && nType != text::TextMarkupType::SENTENCE )
354  {
355  const sal_Int32 nFieldPosModel = aEndPos.mnPos;
356  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
357  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
358  if ( !pSubList )
359  {
360  pSubList = new SwGrammarMarkUp();
361  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
362  }
363  const sal_Int32 nTmpLen = aEndPos.mnSubPos + 1;
364  pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, nTmpLen );
365  }
366  else
367  ++nEnd;
368  if( nEnd > nStart )
369  nLength = nEnd - nStart;
370  else
371  bCommit = false;
372  }
373 
374  if ( bCommit )
375  {
376  if( nType == text::TextMarkupType::SENTENCE )
377  pWList->setSentence( nStart+nLength );
378  else
379  pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength );
380  }
381 }
382 
384  const uno::Sequence< text::TextMarkupDescriptor > &rMarkups )
385 {
386  SolarMutexGuard aGuard;
387 
388  // paragraph already dead or modified?
389  if (!m_pImpl->m_pTextNode)
390  return;
391 
392  // for grammar checking there should be exactly one sentence markup
393  // and 0..n grammar markups.
394  // Different markups are not expected but may be applied anyway since
395  // that should be no problem...
396  // but it has to be implemented, at the moment only this function is for
397  // grammar markups and sentence markup only!
398  const text::TextMarkupDescriptor *pSentenceMarkUp = nullptr;
399  for( const text::TextMarkupDescriptor &rDesc : rMarkups )
400  {
401  if (rDesc.nType == text::TextMarkupType::SENTENCE)
402  {
403  if (pSentenceMarkUp != nullptr)
404  throw lang::IllegalArgumentException(); // there is already one sentence markup
405  pSentenceMarkUp = &rDesc;
406  }
407  else if( rDesc.nType != text::TextMarkupType::PROOFREADING )
408  return;
409  }
410 
411  if( pSentenceMarkUp == nullptr )
412  return;
413 
414  // get appropriate list to use...
415  SwGrammarMarkUp* pWList = nullptr;
416  bool bRepaint = false;
417  IGrammarContact *pGrammarContact = getGrammarContact(*m_pImpl->m_pTextNode);
418  if( pGrammarContact )
419  {
420  pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true);
421  OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
422  }
423  else
424  {
425  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
426  if ( !pWList )
427  {
428  m_pImpl->m_pTextNode->SetGrammarCheck( std::make_unique<SwGrammarMarkUp>() );
429  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
430  pWList->SetInvalid( 0, COMPLETE_STRING );
431  }
432  }
433  bRepaint = pWList == m_pImpl->m_pTextNode->GetGrammarCheck();
434 
435  bool bAcceptGrammarError = false;
436  if( pWList->GetBeginInv() < COMPLETE_STRING )
437  {
438  const ModelToViewHelper::ModelPosition aSentenceEnd =
439  m_pImpl->m_ConversionMap.ConvertToModelPosition(
440  pSentenceMarkUp->nOffset + pSentenceMarkUp->nLength );
441  bAcceptGrammarError = aSentenceEnd.mnPos > pWList->GetBeginInv();
442  pWList->ClearGrammarList( aSentenceEnd.mnPos );
443  }
444 
445  if( bAcceptGrammarError )
446  {
447  for( const text::TextMarkupDescriptor &rDesc : rMarkups )
448  {
449  lcl_commitGrammarMarkUp(m_pImpl->m_ConversionMap, pWList, rDesc.nType,
450  rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
451  }
452  }
453  else
454  {
455  bRepaint = false;
456  const text::TextMarkupDescriptor &rDesc = *pSentenceMarkUp;
457  lcl_commitGrammarMarkUp(m_pImpl->m_ConversionMap, pWList, rDesc.nType,
458  rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
459  }
460 
461  if( bRepaint )
462  finishGrammarCheck(*m_pImpl->m_pTextNode);
463 }
464 
466 {
468  if(rHint.GetId() == SfxHintId::Dying)
469  {
470  m_pTextNode = nullptr;
471  }
472 }
473 
475 {
476 }
477 
478 uno::Any SAL_CALL SwXStringKeyMap::getValue(const OUString & aKey)
479 {
480  std::map< OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
481  if ( aIter == maMap.end() )
482  throw container::NoSuchElementException();
483 
484  return (*aIter).second;
485 }
486 
487 sal_Bool SAL_CALL SwXStringKeyMap::hasValue(const OUString & aKey)
488 {
489  return maMap.find( aKey ) != maMap.end();
490 }
491 
492 void SAL_CALL SwXStringKeyMap::insertValue(const OUString & aKey, const uno::Any & aValue)
493 {
494  std::map< OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
495  if ( aIter != maMap.end() )
496  throw container::ElementExistException();
497 
498  maMap[ aKey ] = aValue;
499 }
500 
501 ::sal_Int32 SAL_CALL SwXStringKeyMap::getCount()
502 {
503  return maMap.size();
504 }
505 
506 OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
507 {
508  if ( o3tl::make_unsigned(nIndex) >= maMap.size() )
509  throw lang::IndexOutOfBoundsException();
510 
511  return OUString();
512 }
513 
514 uno::Any SAL_CALL SwXStringKeyMap::getValueByIndex(::sal_Int32 nIndex)
515 {
516  if ( o3tl::make_unsigned(nIndex) >= maMap.size() )
517  throw lang::IndexOutOfBoundsException();
518 
519  return uno::Any();
520 }
521 
522 /* 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:326
virtual sal_Bool SAL_CALL hasValue(const OUString &aKey) override
Definition: doc.hxx:188
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:805
SwWrongList * SubList(sal_uInt16 nIdx) const
Definition: wrong.hxx:343
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:102
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
WrongListType GetWrongListType() const
Definition: wrong.hxx:288
sal_Int32 GetBeginInv() const
Definition: wrong.hxx:289
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:58
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