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  SwXTextRange* pRange = nullptr;
109  OTextCursorHelper* pCursor = nullptr;
110 
111  if(xRangeTunnel.is())
112  {
113  pRange = reinterpret_cast<SwXTextRange*>( sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething(SwXTextRange::getUnoTunnelId())));
114  pCursor = reinterpret_cast<OTextCursorHelper*>( sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething(OTextCursorHelper::getUnoTunnelId())));
115  }
116 
117  if (pRange)
118  {
119  SwDoc& rDoc = pRange->GetDoc();
120 
121  SwUnoInternalPaM aPam(rDoc);
122 
123  ::sw::XTextRangeToSwPaM(aPam, xRange);
124 
125  SwPosition* startPos = aPam.Start();
126  SwPosition* endPos = aPam.End();
127 
128  commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
129  }
130  else if (pCursor)
131  {
132  SwPaM & rPam(*pCursor->GetPaM());
133 
134  SwPosition* startPos = rPam.Start();
135  SwPosition* endPos = rPam.End();
136 
137  commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
138  }
139 }
140 
142  ::sal_Int32 nType,
143  const OUString & rIdentifier,
144  ::sal_Int32 nStart,
145  ::sal_Int32 nLength,
146  const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
147 {
148  SolarMutexGuard aGuard;
149 
150  // paragraph already dead or modified?
151  if (!m_pImpl->m_pTextNode || nLength <= 0)
152  return;
153 
154  if ( nType == text::TextMarkupType::SMARTTAG &&
155  !SwSmartTagMgr::Get().IsSmartTagTypeEnabled( rIdentifier ) )
156  return;
157 
158  // get appropriate list to use...
159  SwWrongList* pWList = nullptr;
160  bool bRepaint = false;
161  if ( nType == text::TextMarkupType::SPELLCHECK )
162  {
163  pWList = m_pImpl->m_pTextNode->GetWrong();
164  if ( !pWList )
165  {
166  pWList = new SwWrongList( WRONGLIST_SPELL );
167  m_pImpl->m_pTextNode->SetWrong( pWList );
168  }
169  }
170  else if ( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
171  {
172  IGrammarContact *pGrammarContact = getGrammarContact(*m_pImpl->m_pTextNode);
173  if( pGrammarContact )
174  {
175  pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true);
176  OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
177  }
178  else
179  {
180  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
181  if ( !pWList )
182  {
183  m_pImpl->m_pTextNode->SetGrammarCheck( new SwGrammarMarkUp() );
184  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
185  }
186  }
187  bRepaint = pWList == m_pImpl->m_pTextNode->GetGrammarCheck();
188  if( pWList->GetBeginInv() < COMPLETE_STRING )
189  static_cast<SwGrammarMarkUp*>(pWList)->ClearGrammarList();
190  }
191  else if ( nType == text::TextMarkupType::SMARTTAG )
192  {
193  pWList = m_pImpl->m_pTextNode->GetSmartTags();
194  if ( !pWList )
195  {
196  pWList = new SwWrongList( WRONGLIST_SMARTTAG );
197  m_pImpl->m_pTextNode->SetSmartTags( pWList );
198  }
199  }
200  else
201  {
202  OSL_FAIL( "Unknown mark-up type" );
203  return;
204  }
205 
206  const ModelToViewHelper::ModelPosition aStartPos =
207  m_pImpl->m_ConversionMap.ConvertToModelPosition( nStart );
208  const ModelToViewHelper::ModelPosition aEndPos =
209  m_pImpl->m_ConversionMap.ConvertToModelPosition( nStart + nLength - 1);
210 
211  const bool bStartInField = aStartPos.mbIsField;
212  const bool bEndInField = aEndPos.mbIsField;
213  bool bCommit = false;
214 
215  if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
216  {
217  nStart = aStartPos.mnSubPos;
218  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
219  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
220 
221  SwWrongList* pSubList = pWList->SubList( nInsertPos );
222  if ( !pSubList )
223  {
224  if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
225  pSubList = new SwGrammarMarkUp();
226  else
227  pSubList = new SwWrongList( pWList->GetWrongListType() );
228  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
229  }
230 
231  pWList = pSubList;
232  bCommit = true;
233  }
234  else if ( !bStartInField && !bEndInField )
235  {
236  nStart = aStartPos.mnPos;
237  bCommit = true;
238  nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
239  }
240  else if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
241  {
242  bCommit = true;
243  nStart = aStartPos.mnPos;
244  sal_Int32 nEnd = aEndPos.mnPos;
245  if( bStartInField && nType != text::TextMarkupType::SENTENCE )
246  {
247  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
248  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
249  SwWrongList* pSubList = pWList->SubList( nInsertPos );
250  if ( !pSubList )
251  {
252  pSubList = new SwGrammarMarkUp();
253  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
254  }
255  const sal_Int32 nTmpStart =
256  m_pImpl->m_ConversionMap.ConvertToViewPosition(aStartPos.mnPos);
257  const sal_Int32 nTmpLen =
258  m_pImpl->m_ConversionMap.ConvertToViewPosition(aStartPos.mnPos + 1)
259  - nTmpStart - aStartPos.mnSubPos;
260  if( nTmpLen > 0 )
261  {
262  pSubList->Insert( rIdentifier, xMarkupInfoContainer, aStartPos.mnSubPos, nTmpLen );
263  }
264  ++nStart;
265  }
266  if( bEndInField && nType != text::TextMarkupType::SENTENCE )
267  {
268  const sal_Int32 nFieldPosModel = aEndPos.mnPos;
269  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
270  SwWrongList* pSubList = pWList->SubList( nInsertPos );
271  if ( !pSubList )
272  {
273  pSubList = new SwGrammarMarkUp();
274  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
275  }
276  const sal_Int32 nTmpLen = aEndPos.mnSubPos + 1;
277  pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, nTmpLen );
278  }
279  else
280  ++nEnd;
281  if( nEnd > nStart )
282  nLength = nEnd - nStart;
283  else
284  bCommit = false;
285  }
286 
287  if ( bCommit )
288  {
289  if( nType == text::TextMarkupType::SENTENCE )
290  static_cast<SwGrammarMarkUp*>(pWList)->setSentence( nStart );
291  else
292  pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength );
293  }
294 
295  if( bRepaint )
296  finishGrammarCheck(*m_pImpl->m_pTextNode);
297 }
298 
300  const ModelToViewHelper& rConversionMap,
301  SwGrammarMarkUp* pWList,
302  ::sal_Int32 nType,
303  const OUString & rIdentifier,
304  ::sal_Int32 nStart,
305  ::sal_Int32 nLength,
306  const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
307 {
308  OSL_ENSURE( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE, "Wrong mark-up type" );
309  const ModelToViewHelper::ModelPosition aStartPos =
310  rConversionMap.ConvertToModelPosition( nStart );
311  const ModelToViewHelper::ModelPosition aEndPos =
312  rConversionMap.ConvertToModelPosition( nStart + nLength - 1);
313 
314  const bool bStartInField = aStartPos.mbIsField;
315  const bool bEndInField = aEndPos.mbIsField;
316  bool bCommit = false;
317 
318  if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
319  {
320  nStart = aStartPos.mnSubPos;
321  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
322  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
323 
324  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
325  if ( !pSubList )
326  {
327  pSubList = new SwGrammarMarkUp();
328  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
329  }
330 
331  pWList = pSubList;
332  bCommit = true;
333  }
334  else if ( !bStartInField && !bEndInField )
335  {
336  nStart = aStartPos.mnPos;
337  bCommit = true;
338  nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
339  }
340  else
341  {
342  bCommit = true;
343  nStart = aStartPos.mnPos;
344  sal_Int32 nEnd = aEndPos.mnPos;
345  if( bStartInField && nType != text::TextMarkupType::SENTENCE )
346  {
347  const sal_Int32 nFieldPosModel = aStartPos.mnPos;
348  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
349  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
350  if ( !pSubList )
351  {
352  pSubList = new SwGrammarMarkUp();
353  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
354  }
355  const sal_Int32 nTmpStart = rConversionMap.ConvertToViewPosition( aStartPos.mnPos );
356  const sal_Int32 nTmpLen = rConversionMap.ConvertToViewPosition( aStartPos.mnPos + 1 )
357  - nTmpStart - aStartPos.mnSubPos;
358  if( nTmpLen > 0 )
359  pSubList->Insert( rIdentifier, xMarkupInfoContainer, aStartPos.mnSubPos, nTmpLen );
360  ++nStart;
361  }
362  if( bEndInField && nType != text::TextMarkupType::SENTENCE )
363  {
364  const sal_Int32 nFieldPosModel = aEndPos.mnPos;
365  const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
366  SwGrammarMarkUp* pSubList = static_cast<SwGrammarMarkUp*>(pWList->SubList( nInsertPos ));
367  if ( !pSubList )
368  {
369  pSubList = new SwGrammarMarkUp();
370  pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
371  }
372  const sal_Int32 nTmpLen = aEndPos.mnSubPos + 1;
373  pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, nTmpLen );
374  }
375  else
376  ++nEnd;
377  if( nEnd > nStart )
378  nLength = nEnd - nStart;
379  else
380  bCommit = false;
381  }
382 
383  if ( bCommit )
384  {
385  if( nType == text::TextMarkupType::SENTENCE )
386  pWList->setSentence( nStart+nLength );
387  else
388  pWList->Insert( rIdentifier, xMarkupInfoContainer, nStart, nLength );
389  }
390 }
391 
393  const uno::Sequence< text::TextMarkupDescriptor > &rMarkups )
394 {
395  SolarMutexGuard aGuard;
396 
397  // paragraph already dead or modified?
398  if (!m_pImpl->m_pTextNode)
399  return;
400 
401  // for grammar checking there should be exactly one sentence markup
402  // and 0..n grammar markups.
403  // Different markups are not expected but may be applied anyway since
404  // that should be no problem...
405  // but it has to be implemented, at the moment only this function is for
406  // grammar markups and sentence markup only!
407  const text::TextMarkupDescriptor *pSentenceMarkUp = nullptr;
408  for( const text::TextMarkupDescriptor &rDesc : rMarkups )
409  {
410  if (rDesc.nType == text::TextMarkupType::SENTENCE)
411  {
412  if (pSentenceMarkUp != nullptr)
413  throw lang::IllegalArgumentException(); // there is already one sentence markup
414  pSentenceMarkUp = &rDesc;
415  }
416  else if( rDesc.nType != text::TextMarkupType::PROOFREADING )
417  return;
418  }
419 
420  if( pSentenceMarkUp == nullptr )
421  return;
422 
423  // get appropriate list to use...
424  SwGrammarMarkUp* pWList = nullptr;
425  bool bRepaint = false;
426  IGrammarContact *pGrammarContact = getGrammarContact(*m_pImpl->m_pTextNode);
427  if( pGrammarContact )
428  {
429  pWList = pGrammarContact->getGrammarCheck(*m_pImpl->m_pTextNode, true);
430  OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
431  }
432  else
433  {
434  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
435  if ( !pWList )
436  {
437  m_pImpl->m_pTextNode->SetGrammarCheck( new SwGrammarMarkUp() );
438  pWList = m_pImpl->m_pTextNode->GetGrammarCheck();
439  pWList->SetInvalid( 0, COMPLETE_STRING );
440  }
441  }
442  bRepaint = pWList == m_pImpl->m_pTextNode->GetGrammarCheck();
443 
444  bool bAcceptGrammarError = false;
445  if( pWList->GetBeginInv() < COMPLETE_STRING )
446  {
447  const ModelToViewHelper::ModelPosition aSentenceEnd =
448  m_pImpl->m_ConversionMap.ConvertToModelPosition(
449  pSentenceMarkUp->nOffset + pSentenceMarkUp->nLength );
450  bAcceptGrammarError = aSentenceEnd.mnPos > pWList->GetBeginInv();
451  pWList->ClearGrammarList( aSentenceEnd.mnPos );
452  }
453 
454  if( bAcceptGrammarError )
455  {
456  for( const text::TextMarkupDescriptor &rDesc : rMarkups )
457  {
458  lcl_commitGrammarMarkUp(m_pImpl->m_ConversionMap, pWList, rDesc.nType,
459  rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
460  }
461  }
462  else
463  {
464  bRepaint = false;
465  const text::TextMarkupDescriptor &rDesc = *pSentenceMarkUp;
466  lcl_commitGrammarMarkUp(m_pImpl->m_ConversionMap, pWList, rDesc.nType,
467  rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
468  }
469 
470  if( bRepaint )
471  finishGrammarCheck(*m_pImpl->m_pTextNode);
472 }
473 
475 {
477  if(rHint.GetId() == SfxHintId::Dying)
478  {
479  m_pTextNode = nullptr;
480  }
481 }
482 
484 {
485 }
486 
487 uno::Any SAL_CALL SwXStringKeyMap::getValue(const OUString & aKey)
488 {
489  std::map< OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
490  if ( aIter == maMap.end() )
491  throw container::NoSuchElementException();
492 
493  return (*aIter).second;
494 }
495 
496 sal_Bool SAL_CALL SwXStringKeyMap::hasValue(const OUString & aKey)
497 {
498  return maMap.find( aKey ) != maMap.end();
499 }
500 
501 void SAL_CALL SwXStringKeyMap::insertValue(const OUString & aKey, const uno::Any & aValue)
502 {
503  std::map< OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
504  if ( aIter != maMap.end() )
505  throw container::ElementExistException();
506 
507  maMap[ aKey ] = aValue;
508 }
509 
510 ::sal_Int32 SAL_CALL SwXStringKeyMap::getCount()
511 {
512  return maMap.size();
513 }
514 
515 OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex)
516 {
517  if ( o3tl::make_unsigned(nIndex) >= maMap.size() )
518  throw lang::IndexOutOfBoundsException();
519 
520  return OUString();
521 }
522 
523 uno::Any SAL_CALL SwXStringKeyMap::getValueByIndex(::sal_Int32 nIndex)
524 {
525  if ( o3tl::make_unsigned(nIndex) >= maMap.size() )
526  throw lang::IndexOutOfBoundsException();
527 
528  return uno::Any();
529 }
530 
531 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Marks a position in the document model.
Definition: pam.hxx:35
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:329
virtual sal_Bool SAL_CALL hasValue(const OUString &aKey) override
Definition: doc.hxx:185
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:775
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:732
SwWrongList * SubList(sal_uInt16 nIdx) const
Definition: wrong.hxx:346
SwIndex nContent
Definition: pam.hxx:38
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...
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange)
Definition: unoobj2.cxx:951
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:136
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:212
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:93
virtual const SwPaM * GetPaM() const =0
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unoobj2.cxx:793
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
WrongListType GetWrongListType() const
Definition: wrong.hxx:291
sal_Int32 GetBeginInv() const
Definition: wrong.hxx:292
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:95
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
const SwPosition * End() const
Definition: pam.hxx:217
ModelPosition ConvertToModelPosition(sal_Int32 nViewPos) const
Converts a view position into a model position.
Organizer of the contact between SwTextNodes and grammar checker.
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
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
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