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