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