LibreOffice Module sw (master)  1
langhelper.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 <string.h>
21 
22 #include <vcl/window.hxx>
23 
24 #include <wrtsh.hxx>
25 #include <doc.hxx>
26 #include <docary.hxx>
27 #include <charfmt.hxx>
28 
29 #include <sfx2/bindings.hxx>
30 #include <sfx2/request.hxx>
31 #include <sfx2/sfxdlg.hxx>
32 #include <sfx2/viewfrm.hxx>
33 #include <editeng/eeitem.hxx>
34 #include <editeng/editeng.hxx>
35 #include <editeng/editdata.hxx>
36 #include <editeng/outliner.hxx>
37 #include <editeng/editview.hxx>
38 #include <editeng/langitem.hxx>
39 
40 #include <svl/languageoptions.hxx>
41 #include <svtools/langtab.hxx>
42 #include <svl/slstitm.hxx>
43 #include <svl/stritem.hxx>
44 #include <svx/svxids.hrc>
45 
46 #include <ndtxt.hxx>
47 #include <pam.hxx>
48 #include <view.hxx>
49 #include <viewopt.hxx>
50 
51 #include <langhelper.hxx>
52 #include <memory>
53 
54 using namespace ::com::sun::star;
55 
56 namespace SwLangHelper
57 {
58 
60  {
61  ESelection aSelection = pOLV->GetSelection();
62  EditView& rEditView=pOLV->GetEditView();
63  EditEngine* pEditEngine=rEditView.GetEditEngine();
64 
65  // the value of used script types
66  const SvtScriptType nScriptType =pOLV->GetSelectedScriptType();
67  OUString aScriptTypesInUse( OUString::number( static_cast<int>(nScriptType) ) );//pEditEngine->GetScriptType(aSelection)
68 
69  // get keyboard language
70  OUString aKeyboardLang;
72 
73  vcl::Window* pWin = rEditView.GetWindow();
74  if(pWin)
75  nLang = pWin->GetInputLanguage();
76  if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
77  aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang );
78 
79  // get the language that is in use
80  OUString aCurrentLang("*");
81  SfxItemSet aSet(pOLV->GetAttribs());
82  nLang = SwLangHelper::GetCurrentLanguage( aSet,nScriptType );
83  if (nLang != LANGUAGE_DONTKNOW)
84  aCurrentLang = SvtLanguageTable::GetLanguageString( nLang );
85 
86  // build sequence for status value
87  uno::Sequence< OUString > aSeq( 4 );
88  aSeq[0] = aCurrentLang;
89  aSeq[1] = aScriptTypesInUse;
90  aSeq[2] = aKeyboardLang;
91  aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( pEditEngine, aSelection );
92 
93  // set sequence as status value
94  SfxStringListItem aItem( SID_LANGUAGE_STATUS );
95  aItem.SetStringList( aSeq );
96  rSet.Put( aItem );
97  }
98 
99  bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh )
100  {
101  bool bRestoreSelection = false;
102  SfxItemSet aEditAttr(pOLV->GetAttribs());
103  ESelection aSelection = pOLV->GetSelection();
104  EditView & rEditView = pOLV->GetEditView();
105  EditEngine * pEditEngine = rEditView.GetEditEngine();
106 
107  // get the language
108  OUString aNewLangText;
109 
110  const SfxStringItem* pItem = rReq.GetArg<SfxStringItem>(SID_LANGUAGE_STATUS);
111  if (pItem)
112  aNewLangText = pItem->GetValue();
113 
117  SfxViewFrame *pViewFrame = rView.GetViewFrame();
118 
119  if (aNewLangText == "*" )
120  {
121  // open the dialog "Tools/Options/Language Settings - Language"
123  ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( rView.GetFrameWeld(), SID_LANGUAGE_OPTIONS ));
124  pDlg->Execute();
125  }
126  else
127  {
128  // setting the new language...
129  if (!aNewLangText.isEmpty())
130  {
131  const OUString aSelectionLangPrefix("Current_");
132  const OUString aParagraphLangPrefix("Paragraph_");
133  const OUString aDocumentLangPrefix("Default_");
134 
135  sal_Int32 nPos = 0;
136  bool bForSelection = true;
137  bool bForParagraph = false;
138  if (-1 != (nPos = aNewLangText.indexOf( aSelectionLangPrefix )))
139  {
140  // ... for the current selection
141  aNewLangText = aNewLangText.replaceAt(nPos, aSelectionLangPrefix.getLength(), "");
142  bForSelection = true;
143  }
144  else if (-1 != (nPos = aNewLangText.indexOf( aParagraphLangPrefix )))
145  {
146  // ... for the current paragraph language
147  aNewLangText = aNewLangText.replaceAt(nPos, aParagraphLangPrefix.getLength(), "");
148  bForSelection = true;
149  bForParagraph = true;
150  }
151  else if (-1 != (nPos = aNewLangText.indexOf( aDocumentLangPrefix )))
152  {
153  // ... as default document language
154  aNewLangText = aNewLangText.replaceAt(nPos, aDocumentLangPrefix.getLength(), "");
155  bForSelection = false;
156  }
157 
158  if (bForParagraph)
159  {
160  bRestoreSelection = true;
161  SwLangHelper::SelectPara( rEditView, aSelection );
162  aSelection = pOLV->GetSelection();
163  }
164  if (!bForSelection) // document language to be changed...
165  {
166  rSh.StartAction();
167  rSh.LockView( true );
168  rSh.Push();
169 
170  // prepare to apply new language to all text in document
171  rSh.SelAll();
172  rSh.ExtendedSelectAll();
173  }
174 
175  if (aNewLangText == "LANGUAGE_NONE")
176  SwLangHelper::SetLanguage_None( rSh, pOLV, aSelection, bForSelection, aEditAttr );
177  else if (aNewLangText == "RESET_LANGUAGES")
178  SwLangHelper::ResetLanguages( rSh, pOLV );
179  else
180  SwLangHelper::SetLanguage( rSh, pOLV, aSelection, aNewLangText, bForSelection, aEditAttr );
181 
182  // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks
183  // when setting a new language attribute
184  if (bForSelection)
185  {
186  const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions();
187  EEControlBits nCntrl = pEditEngine->GetControlWord();
188  // turn off
189  nCntrl &= ~EEControlBits::ONLINESPELLING;
190  pEditEngine->SetControlWord(nCntrl);
191 
192  //turn back on
193  if (pVOpt->IsOnlineSpell())
194  nCntrl |= EEControlBits::ONLINESPELLING;
195  else
196  nCntrl &= ~EEControlBits::ONLINESPELLING;
197  pEditEngine->SetControlWord(nCntrl);
198 
199  pEditEngine->CompleteOnlineSpelling();
200  rEditView.Invalidate();
201  }
202 
203  if (!bForSelection)
204  {
205  // need to release view and restore selection...
207  rSh.LockView( false );
208  rSh.EndAction();
209  }
210  }
211  }
212 
213  // invalidate slot to get the new language displayed
214  pViewFrame->GetBindings().Invalidate( rReq.GetSlot() );
215 
216  rReq.Done();
217  return bRestoreSelection;
218  }
219 
220  void SetLanguage( SwWrtShell &rWrtSh, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
221  {
222  SetLanguage( rWrtSh, nullptr , ESelection(), rLangText, bIsForSelection, rCoreSet );
223  }
224 
225  void SetLanguage( SwWrtShell &rWrtSh, OutlinerView const * pOLV, const ESelection& rSelection, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
226  {
228  if (nLang != LANGUAGE_DONTKNOW)
229  {
230  EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : nullptr;
231  OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
232 
233  //get ScriptType
234  sal_uInt16 nLangWhichId = 0;
235  bool bIsSingleScriptType = true;
237  {
238  case SvtScriptType::LATIN : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE) : sal_uInt16(RES_CHRATR_LANGUAGE); break;
239  case SvtScriptType::ASIAN : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CJK) : sal_uInt16(RES_CHRATR_CJK_LANGUAGE); break;
240  case SvtScriptType::COMPLEX : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CTL) : sal_uInt16(RES_CHRATR_CTL_LANGUAGE); break;
241  default:
242  bIsSingleScriptType = false;
243  OSL_FAIL("unexpected case" );
244  }
245  if (bIsSingleScriptType)
246  {
247  // change language for selection or paragraph
248  // (for paragraph is handled by previously having set the selection to the
249  // whole paragraph)
250  if (bIsForSelection)
251  {
252  // apply language to current selection
253  if (pEditEngine)
254  {
255  rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
256  pEditEngine->QuickSetAttribs(rCoreSet, rSelection);
257  }
258  else
259  {
260  rWrtSh.GetCurAttr( rCoreSet );
261  rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
262  rWrtSh.SetAttrSet( rCoreSet );
263  }
264  }
265  else // change language for all text
266  {
267  // set document default language
268  switch (nLangWhichId)
269  {
270  case EE_CHAR_LANGUAGE : nLangWhichId = RES_CHRATR_LANGUAGE; break;
271  case EE_CHAR_LANGUAGE_CJK : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
272  case EE_CHAR_LANGUAGE_CTL : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
273  }
274  //Set the default document language
275  rWrtSh.SetDefault( SvxLanguageItem( nLang, nLangWhichId ) );
276 
277  //Resolves: fdo#35282 Clear the language from all Text Styles, and
278  //fallback to default document language
279  const SwTextFormatColls *pColls = rWrtSh.GetDoc()->GetTextFormatColls();
280  for(size_t i = 0, nCount = pColls->size(); i < nCount; ++i)
281  {
282  SwTextFormatColl &rTextColl = *(*pColls)[ i ];
283  rTextColl.ResetFormatAttr(nLangWhichId);
284  }
285  //Resolves: fdo#35282 Clear the language from all Character Styles,
286  //and fallback to default document language
287  const SwCharFormats *pCharFormats = rWrtSh.GetDoc()->GetCharFormats();
288  for(size_t i = 0, nCount = pCharFormats->size(); i < nCount; ++i)
289  {
290  SwCharFormat &rCharFormat = *(*pCharFormats)[ i ];
291  rCharFormat.ResetFormatAttr(nLangWhichId);
292  }
293 
294  // #i102191: hard set respective language attribute in text document
295  // (for all text in the document - which should be selected by now...)
296  rWrtSh.SetAttrItem( SvxLanguageItem( nLang, nLangWhichId ) );
297  }
298  }
299  }
300  }
301 
302  void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet )
303  {
304  SetLanguage_None( rWrtSh,nullptr,ESelection(),bIsForSelection,rCoreSet );
305  }
306 
307  void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView const * pOLV, const ESelection& rSelection, bool bIsForSelection, SfxItemSet &rCoreSet )
308  {
309  // EditEngine IDs
310  const sal_uInt16 aLangWhichId_EE[3] =
311  {
315  };
316 
317  // Writer IDs
318  const sal_uInt16 aLangWhichId_Writer[3] =
319  {
323  };
324 
325  if (bIsForSelection)
326  {
327  // change language for selection or paragraph
328  // (for paragraph is handled by previously having set the selection to the
329  // whole paragraph)
330 
331  EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : nullptr;
332  OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
333  if (pEditEngine)
334  {
335  for (sal_uInt16 i : aLangWhichId_EE)
336  rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, i ));
337  pEditEngine->QuickSetAttribs(rCoreSet, rSelection);
338  }
339  else
340  {
341  rWrtSh.GetCurAttr( rCoreSet );
342  for (sal_uInt16 i : aLangWhichId_Writer)
343  rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, i ));
344  rWrtSh.SetAttrSet( rCoreSet );
345  }
346  }
347  else // change language for all text
348  {
349  std::set<sal_uInt16> aAttribs;
350  for (sal_uInt16 i : aLangWhichId_Writer)
351  {
353  aAttribs.insert( i );
354  }
355 
356  // set all language attributes to default
357  // (for all text in the document - which should be selected by now...)
358  rWrtSh.ResetAttr( aAttribs );
359  }
360  }
361 
362  void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView const * pOLV )
363  {
364  // reset language for current selection.
365  // The selection should already have been expanded to the whole paragraph or
366  // to all text in the document if those are the ranges where to reset
367  // the language attributes
368 
369  if (pOLV)
370  {
371  EditView &rEditView = pOLV->GetEditView();
372  rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE );
373  rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CJK );
374  rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CTL );
375  }
376  else
377  {
378  std::set<sal_uInt16> aAttribs;
379  aAttribs.insert( RES_CHRATR_LANGUAGE );
380  aAttribs.insert( RES_CHRATR_CJK_LANGUAGE );
381  aAttribs.insert( RES_CHRATR_CTL_LANGUAGE );
382  rWrtSh.ResetAttr( aAttribs );
383  }
384  }
385 
391  LanguageType GetLanguage( SwWrtShell &rSh, sal_uInt16 nLangWhichId )
392  {
393  SfxItemSet aSet( rSh.GetAttrPool(), {{nLangWhichId, nLangWhichId}} );
394  rSh.GetCurAttr( aSet );
395 
396  return GetLanguage(aSet,nLangWhichId);
397  }
398 
399  LanguageType GetLanguage( SfxItemSet const & aSet, sal_uInt16 nLangWhichId )
400  {
401 
403 
404  const SfxPoolItem *pItem = nullptr;
405  SfxItemState nState = aSet.GetItemState( nLangWhichId, true, &pItem );
406  if (nState > SfxItemState::DEFAULT && pItem)
407  {
408  // the item is set and can be used
409  nLang = dynamic_cast<const SvxLanguageItem&>(*pItem).GetLanguage();
410  }
411  else if (nState == SfxItemState::DEFAULT)
412  {
413  // since the attribute is not set: retrieve the default value
414  nLang = dynamic_cast<const SvxLanguageItem&>(aSet.GetPool()->GetDefaultItem( nLangWhichId )).GetLanguage();
415  }
416  else if (nState == SfxItemState::DONTCARE)
417  {
418  // there is more than one language...
419  nLang = LANGUAGE_DONTKNOW;
420  }
421  OSL_ENSURE( nLang != LANGUAGE_SYSTEM, "failed to get the language?" );
422 
423  return nLang;
424  }
425 
431  {
432  //set language attribute to use according to the script type
433  sal_uInt16 nLangWhichId = 0;
434  bool bIsSingleScriptType = true;
435  switch (rSh.GetScriptType())
436  {
437  case SvtScriptType::LATIN : nLangWhichId = RES_CHRATR_LANGUAGE; break;
438  case SvtScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
439  case SvtScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
440  default: bIsSingleScriptType = false; break;
441  }
442 
443  // get language according to the script type(s) in use
444  LanguageType nCurrentLang = LANGUAGE_SYSTEM;
445  if (bIsSingleScriptType)
446  nCurrentLang = GetLanguage( rSh, nLangWhichId );
447  else
448  {
449  // check if all script types are set to LANGUAGE_NONE and return
450  // that if this is the case. Otherwise, having multiple script types
451  // in use always means there are several languages in use...
452  const sal_uInt16 aScriptTypes[3] =
453  {
457  };
458  nCurrentLang = LANGUAGE_NONE;
459  for (sal_uInt16 aScriptType : aScriptTypes)
460  {
461  LanguageType nTmpLang = GetLanguage( rSh, aScriptType );
462  if (nTmpLang != LANGUAGE_NONE)
463  {
464  nCurrentLang = LANGUAGE_DONTKNOW;
465  break;
466  }
467  }
468  }
469  OSL_ENSURE( nCurrentLang != LANGUAGE_SYSTEM, "failed to get the language?" );
470 
471  return nCurrentLang;
472  }
473 
479  {
480  //set language attribute to use according to the script type
481  sal_uInt16 nLangWhichId = 0;
482  bool bIsSingleScriptType = true;
483  switch (nScriptType)
484  {
485  case SvtScriptType::LATIN : nLangWhichId = EE_CHAR_LANGUAGE; break;
486  case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
487  case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
488  default: bIsSingleScriptType = false;
489  }
490 
491  // get language according to the script type(s) in use
492  LanguageType nCurrentLang = LANGUAGE_SYSTEM;
493  if (bIsSingleScriptType)
494  nCurrentLang = GetLanguage( aSet, nLangWhichId );
495  else
496  {
497  // check if all script types are set to LANGUAGE_NONE and return
498  // that if this is the case. Otherwise, having multiple script types
499  // in use always means there are several languages in use...
500  const sal_uInt16 aScriptTypes[3] =
501  {
505  };
506  nCurrentLang = LANGUAGE_NONE;
507  for (sal_uInt16 aScriptType : aScriptTypes)
508  {
509  LanguageType nTmpLang = GetLanguage( aSet, aScriptType );
510  if (nTmpLang != LANGUAGE_NONE)
511  {
512  nCurrentLang = LANGUAGE_DONTKNOW;
513  break;
514  }
515  }
516  }
517  OSL_ENSURE( nCurrentLang != LANGUAGE_SYSTEM, "failed to get the language?" );
518 
519  return nCurrentLang;
520  }
521 
522  OUString GetTextForLanguageGuessing( SwWrtShell const &rSh )
523  {
524  // string for guessing language
525  OUString aText;
526  SwPaM *pCursor = rSh.GetCursor();
527  SwTextNode *pNode = pCursor->GetNode().GetTextNode();
528  if (pNode)
529  {
530  aText = pNode->GetText();
531  if (!aText.isEmpty())
532  {
533  sal_Int32 nEnd = pCursor->GetPoint()->nContent.GetIndex();
534  // at most 100 chars to the left...
535  const sal_Int32 nStt = nEnd > 100 ? nEnd - 100 : 0;
536  // ... and 100 to the right of the cursor position
537  nEnd = aText.getLength() - nEnd > 100 ? nEnd + 100 : aText.getLength();
538  aText = aText.copy( nStt, nEnd - nStt );
539  }
540  }
541  return aText;
542  }
543 
544  OUString GetTextForLanguageGuessing(EditEngine const * rEditEngine, const ESelection& rDocSelection)
545  {
546  // string for guessing language
547 
548  // get the full text of the paragraph that the end of selection is in
549  OUString aText = rEditEngine->GetText(rDocSelection.nEndPos);
550  if (!aText.isEmpty())
551  {
552  sal_Int32 nStt = 0;
553  sal_Int32 nEnd = rDocSelection.nEndPos;
554  // at most 100 chars to the left...
555  nStt = nEnd > 100 ? nEnd - 100 : 0;
556  // ... and 100 to the right of the cursor position
557  nEnd = aText.getLength() - nEnd > 100 ? nEnd + 100 : aText.getLength();
558  aText = aText.copy( nStt, nEnd - nStt );
559  }
560 
561  return aText;
562  }
563 
564  void SelectPara( EditView &rEditView, const ESelection &rCurSel )
565  {
566  ESelection aParaSel( rCurSel.nStartPara, 0, rCurSel.nStartPara, EE_TEXTPOS_ALL );
567  rEditView.SetSelection( aParaSel );
568  }
569 
571  {
572  // select current para
573  if (!rWrtSh.IsSttPara())
574  rWrtSh.MovePara( GoCurrPara, fnParaStart );
575  if (!rWrtSh.HasMark())
576  rWrtSh.SetMark();
577  rWrtSh.SwapPam();
578  if (!rWrtSh.IsEndPara())
579  rWrtSh.MovePara( GoCurrPara, fnParaEnd );
580  #if OSL_DEBUG_LEVEL > 1
581  OUString aSelText;
582  rWrtSh.GetSelectedText( aSelText );
583  (void) aSelText;
584  #endif
585  }
586 }
587 
588 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in document.
Definition: edatmisc.cxx:84
SfxViewFrame * GetViewFrame() const
#define LANGUAGE_NONE
OUString GetText(LineEnd eEnd=LINEEND_LF) const
EEControlBits GetControlWord() const
SwMoveFnCollection const & fnParaEnd
Definition: paminit.cxx:47
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
sal_Int32 nStartPara
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
#define RES_CHRATR_CJK_LANGUAGE
Definition: hintids.hxx:186
#define EE_CHAR_LANGUAGE_CJK
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:188
static SfxAbstractDialogFactory * Create()
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:172
const OUString & GetText() const
Definition: ndtxt.hxx:210
void SelectPara(EditView &rEditView, const ESelection &rCurSel)
Definition: langhelper.cxx:564
bool GoCurrPara(SwPaM &rPam, SwMoveFnCollection const &aPosPara)
Definition: pam.cxx:961
#define EE_CHAR_LANGUAGE
bool IsSttPara() const
Definition: crsrsh.cxx:1086
void GetSelectedText(OUString &rBuf, ParaBreakType nHndlParaBreak=ParaBreakType::ToBlank)
Query text within selection.
Definition: edglss.cxx:248
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:399
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:151
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1708
SwMoveFnCollection const & fnParaStart
Definition: paminit.cxx:46
void Done(bool bRemove=false)
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:587
void Invalidate(sal_uInt16 nId)
virtual short Execute()=0
EEControlBits
static LanguageType nLang
Definition: srtdlg.cxx:60
void SwapPam()
Definition: crsrsh.cxx:967
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
SwIndex nContent
Definition: pam.hxx:38
void SetControlWord(EEControlBits nWord)
int nCount
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
static SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
sal_Int32 nEndPos
bool SetLanguageStatus(OutlinerView *pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh)
Definition: langhelper.cxx:99
EditView & GetEditView() const
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool MovePara(SwWhichPara, SwMoveFnCollection const &)
Definition: crsrsh.cxx:687
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:614
SvtScriptType
SvtScriptType GetScriptType() const
returns the script type of the selection
Definition: edattr.cxx:666
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:232
#define LANGUAGE_SYSTEM
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2229
EditEngine * GetEditEngine() const
SfxBindings & GetBindings()
bool HasMark() const
Definition: crsrsh.hxx:881
int i
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:112
void ResetLanguages(SwWrtShell &rWrtSh, OutlinerView const *pOLV=nullptr)
Definition: langhelper.cxx:362
const OUString & GetValue() const
const T * GetArg(sal_uInt16 nSlotId) const
SvtScriptType GetSelectedScriptType() const
size_t size() const
Definition: docary.hxx:91
void GetLanguageStatus(OutlinerView *pOLV, SfxItemSet &rSet)
Definition: langhelper.cxx:59
vcl::Window * GetWindow() const
#define LANGUAGE_DONTKNOW
void SetLanguage_None(SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:302
void SetMark()
Definition: crsrsh.hxx:879
void RemoveAttribs(bool bRemoveParaAttribs=false, sal_uInt16 nWhich=0)
void SelectCurrentPara(SwWrtShell &rWrtSh)
Definition: langhelper.cxx:570
bool IsOnlineSpell() const
Definition: viewopt.hxx:332
void CompleteOnlineSpelling()
void SelAll()
Definition: select.cxx:122
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
void SetStringList(const css::uno::Sequence< OUString > &rList)
void StartAction()
Definition: crsrsh.cxx:215
ESelection GetSelection() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
LanguageType GetLanguage() const
sal_uInt16 GetSlot() const
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:650
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:401
OUString const aScriptType
SfxItemState
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:734
weld::Window * GetFrameWeld() const
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:775
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:191
void LockView(bool b)
Definition: viewsh.hxx:465
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
sal_Int32 GetIndex() const
Definition: index.hxx:95
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
Sequence< sal_Int8 > aSeq
LanguageType GetCurrentLanguage(SfxItemSet const &aSet, SvtScriptType nScriptType)
Definition: langhelper.cxx:478
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: fmtcol.cxx:366
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:176
void SetLanguage(SwWrtShell &rWrtSh, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:220
static OUString GetLanguageString(const LanguageType eType)
void Invalidate()
void SetSelection(const ESelection &rNewSel)
SfxItemSet GetAttribs()
bool IsEndPara() const
Definition: crsrsh.cxx:1105
void ResetAttr(const std::set< sal_uInt16 > &attrs=std::set< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
LanguageType GetInputLanguage() const
OUString GetTextForLanguageGuessing(EditEngine const *rEditEngine, const ESelection &rDocSelection)
Definition: langhelper.cxx:544
#define EE_CHAR_LANGUAGE_CTL
#define EE_TEXTPOS_ALL
sal_Int32 nState
Definition: view.hxx:146
sal_uInt16 nPos
static LanguageType GetLanguageType(const OUString &rStr)
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo