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