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
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
52using namespace ::com::sun::star;
53
54namespace 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;
72
73 // get the language that is in use
74 OUString aCurrentLang("*");
75 SfxItemSet aSet(pOLV->GetAttribs());
76 nLang = SwLangHelper::GetCurrentLanguage( aSet,nScriptType );
79
80 // build sequence for status value
81 uno::Sequence< OUString > aSeq{ aCurrentLang,
82 aScriptTypesInUse,
83 aKeyboardLang,
85 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& rViewFrame = 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(), u"");
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(), u"");
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(), u"");
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 if (SwWrtShell* pWrtShell = rView.GetWrtShellPtr())
181 {
182 const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
183 EEControlBits nCntrl = pEditEngine->GetControlWord();
184 // turn off
185 nCntrl &= ~EEControlBits::ONLINESPELLING;
186 pEditEngine->SetControlWord(nCntrl);
187
188 //turn back on
189 if (pVOpt->IsOnlineSpell())
190 nCntrl |= EEControlBits::ONLINESPELLING;
191 else
192 nCntrl &= ~EEControlBits::ONLINESPELLING;
193 pEditEngine->SetControlWord(nCntrl);
194
195 pEditEngine->CompleteOnlineSpelling();
196 rEditView.Invalidate();
197 }
198 }
199
200 if (!bForSelection)
201 {
202 // need to release view and restore selection...
204 rSh.LockView( false );
205 rSh.EndAction();
206 }
207 }
208 }
209
210 // invalidate slot to get the new language displayed
211 rViewFrame.GetBindings().Invalidate( rReq.GetSlot() );
212
213 rReq.Done();
214 return bRestoreSelection;
215 }
216
217 void SetLanguage( SwWrtShell &rWrtSh, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
218 {
219 SetLanguage( rWrtSh, nullptr , ESelection(), rLangText, bIsForSelection, rCoreSet );
220 }
221
222 void SetLanguage( SwWrtShell &rWrtSh, OutlinerView const * pOLV, const ESelection& rSelection, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
223 {
226 return;
227
228 EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : nullptr;
229 OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
230
231 //get ScriptType
232 sal_uInt16 nLangWhichId = 0;
233 bool bIsSingleScriptType = true;
235 {
236 case SvtScriptType::LATIN : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE) : sal_uInt16(RES_CHRATR_LANGUAGE); break;
237 case SvtScriptType::ASIAN : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CJK) : sal_uInt16(RES_CHRATR_CJK_LANGUAGE); break;
238 case SvtScriptType::COMPLEX : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CTL) : sal_uInt16(RES_CHRATR_CTL_LANGUAGE); break;
239 default:
240 bIsSingleScriptType = false;
241 OSL_FAIL("unexpected case" );
242 }
243 if (!bIsSingleScriptType)
244 return;
245
246 // change language for selection or paragraph
247 // (for paragraph is handled by previously having set the selection to the
248 // whole paragraph)
249 if (bIsForSelection)
250 {
251 // apply language to current selection
252 if (pEditEngine)
253 {
254 rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
255 pEditEngine->QuickSetAttribs(rCoreSet, rSelection);
256 }
257 else
258 {
259 rWrtSh.GetCurAttr( rCoreSet );
260 rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
261 rWrtSh.SetAttrSet( rCoreSet );
262 }
263 }
264 else // change language for all text
265 {
266 // set document default language
267 switch (nLangWhichId)
268 {
269 case EE_CHAR_LANGUAGE : nLangWhichId = RES_CHRATR_LANGUAGE; break;
270 case EE_CHAR_LANGUAGE_CJK : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
271 case EE_CHAR_LANGUAGE_CTL : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
272 }
273 //Set the default document language
274 rWrtSh.SetDefault( SvxLanguageItem( nLang, nLangWhichId ) );
275
276 //Resolves: fdo#35282 Clear the language from all Text Styles, and
277 //fallback to default document language
278 const SwTextFormatColls *pColls = rWrtSh.GetDoc()->GetTextFormatColls();
279 for(size_t i = 0, nCount = pColls->size(); i < nCount; ++i)
280 {
281 SwTextFormatColl &rTextColl = *(*pColls)[ i ];
282 rTextColl.ResetFormatAttr(nLangWhichId);
283 }
284 //Resolves: fdo#35282 Clear the language from all Character Styles,
285 //and fallback to default document language
286 const SwCharFormats *pCharFormats = rWrtSh.GetDoc()->GetCharFormats();
287 for(size_t i = 0, nCount = pCharFormats->size(); i < nCount; ++i)
288 {
289 SwCharFormat &rCharFormat = *(*pCharFormats)[ i ];
290 rCharFormat.ResetFormatAttr(nLangWhichId);
291 }
292
293 // #i102191: hard set respective language attribute in text document
294 // (for all text in the document - which should be selected by now...)
295 rWrtSh.SetAttrItem( SvxLanguageItem( nLang, nLangWhichId ) );
296 }
297 }
298
299 void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet )
300 {
301 SetLanguage_None( rWrtSh,nullptr,ESelection(),bIsForSelection,rCoreSet );
302 }
303
304 void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView const * pOLV, const ESelection& rSelection, bool bIsForSelection, SfxItemSet &rCoreSet )
305 {
306 // EditEngine IDs
307 const sal_uInt16 aLangWhichId_EE[3] =
308 {
312 };
313
314 // Writer IDs
315 const sal_uInt16 aLangWhichId_Writer[3] =
316 {
320 };
321
322 if (bIsForSelection)
323 {
324 // change language for selection or paragraph
325 // (for paragraph is handled by previously having set the selection to the
326 // whole paragraph)
327
328 EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : nullptr;
329 OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
330 if (pEditEngine)
331 {
332 for (sal_uInt16 i : aLangWhichId_EE)
333 rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, i ));
334 pEditEngine->QuickSetAttribs(rCoreSet, rSelection);
335 }
336 else
337 {
338 rWrtSh.GetCurAttr( rCoreSet );
339 for (sal_uInt16 i : aLangWhichId_Writer)
340 rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, i ));
341 rWrtSh.SetAttrSet( rCoreSet );
342 }
343 }
344 else // change language for all text
345 {
347 for (sal_uInt16 i : aLangWhichId_Writer)
348 {
350 aAttribs.insert( i );
351 }
352
353 // set all language attributes to default
354 // (for all text in the document - which should be selected by now...)
355 rWrtSh.ResetAttr( aAttribs );
356 }
357 }
358
359 void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView const * pOLV )
360 {
361 // reset language for current selection.
362 // The selection should already have been expanded to the whole paragraph or
363 // to all text in the document if those are the ranges where to reset
364 // the language attributes
365
366 if (pOLV)
367 {
368 EditView &rEditView = pOLV->GetEditView();
369 rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE );
370 rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CJK );
371 rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CTL );
372 }
373 else
374 {
375 rWrtSh.ResetAttr(
377 }
378 }
379
385 LanguageType GetLanguage( SwWrtShell &rSh, sal_uInt16 nLangWhichId )
386 {
387 SfxItemSet aSet( rSh.GetAttrPool(), nLangWhichId, nLangWhichId );
388 rSh.GetCurAttr( aSet );
389
390 return GetLanguage(aSet,nLangWhichId);
391 }
392
393 LanguageType GetLanguage( SfxItemSet const & aSet, sal_uInt16 nLangWhichId )
394 {
395
397
398 const SfxPoolItem *pItem = nullptr;
399 SfxItemState nState = aSet.GetItemState( nLangWhichId, true, &pItem );
400 if (nState > SfxItemState::DEFAULT && pItem)
401 {
402 // the item is set and can be used
403 nLang = dynamic_cast<const SvxLanguageItem&>(*pItem).GetLanguage();
404 }
405 else if (nState == SfxItemState::DEFAULT)
406 {
407 // since the attribute is not set: retrieve the default value
408 nLang = dynamic_cast<const SvxLanguageItem&>(aSet.GetPool()->GetDefaultItem( nLangWhichId )).GetLanguage();
409 }
410 else if (nState == SfxItemState::DONTCARE)
411 {
412 // there is more than one language...
414 }
415 OSL_ENSURE( nLang != LANGUAGE_SYSTEM, "failed to get the language?" );
416
417 return nLang;
418 }
419
425 {
426 //set language attribute to use according to the script type
427 sal_uInt16 nLangWhichId = 0;
428 bool bIsSingleScriptType = true;
429 switch (rSh.GetScriptType())
430 {
431 case SvtScriptType::LATIN : nLangWhichId = RES_CHRATR_LANGUAGE; break;
432 case SvtScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
433 case SvtScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
434 default: bIsSingleScriptType = false; break;
435 }
436
437 // get language according to the script type(s) in use
438 LanguageType nCurrentLang = LANGUAGE_SYSTEM;
439 if (bIsSingleScriptType)
440 nCurrentLang = GetLanguage( rSh, nLangWhichId );
441 else
442 {
443 // check if all script types are set to LANGUAGE_NONE and return
444 // that if this is the case. Otherwise, having multiple script types
445 // in use always means there are several languages in use...
446 const sal_uInt16 aScriptTypes[3] =
447 {
451 };
452 nCurrentLang = LANGUAGE_NONE;
453 for (sal_uInt16 aScriptType : aScriptTypes)
454 {
455 LanguageType nTmpLang = GetLanguage( rSh, aScriptType );
456 if (nTmpLang != LANGUAGE_NONE)
457 {
458 nCurrentLang = LANGUAGE_DONTKNOW;
459 break;
460 }
461 }
462 }
463 OSL_ENSURE( nCurrentLang != LANGUAGE_SYSTEM, "failed to get the language?" );
464
465 return nCurrentLang;
466 }
467
473 {
474 //set language attribute to use according to the script type
475 sal_uInt16 nLangWhichId = 0;
476 bool bIsSingleScriptType = true;
477 switch (nScriptType)
478 {
479 case SvtScriptType::LATIN : nLangWhichId = EE_CHAR_LANGUAGE; break;
480 case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
481 case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
482 default: bIsSingleScriptType = false;
483 }
484
485 // get language according to the script type(s) in use
486 LanguageType nCurrentLang = LANGUAGE_SYSTEM;
487 if (bIsSingleScriptType)
488 nCurrentLang = GetLanguage( aSet, nLangWhichId );
489 else
490 {
491 // check if all script types are set to LANGUAGE_NONE and return
492 // that if this is the case. Otherwise, having multiple script types
493 // in use always means there are several languages in use...
494 const sal_uInt16 aScriptTypes[3] =
495 {
499 };
500 nCurrentLang = LANGUAGE_NONE;
501 for (sal_uInt16 aScriptType : aScriptTypes)
502 {
503 LanguageType nTmpLang = GetLanguage( aSet, aScriptType );
504 if (nTmpLang != LANGUAGE_NONE)
505 {
506 nCurrentLang = LANGUAGE_DONTKNOW;
507 break;
508 }
509 }
510 }
511 OSL_ENSURE( nCurrentLang != LANGUAGE_SYSTEM, "failed to get the language?" );
512
513 return nCurrentLang;
514 }
515
517 {
518 // string for guessing language
519 OUString aText;
520 SwPaM *pCursor = rSh.GetCursor();
521 SwTextNode *pNode = pCursor->GetPointNode().GetTextNode();
522 if (pNode)
523 {
524 aText = pNode->GetText();
525 if (!aText.isEmpty())
526 {
527 sal_Int32 nEnd = pCursor->GetPoint()->GetContentIndex();
528 // at most 100 chars to the left...
529 const sal_Int32 nStt = nEnd > 100 ? nEnd - 100 : 0;
530 // ... and 100 to the right of the cursor position
531 nEnd = aText.getLength() - nEnd > 100 ? nEnd + 100 : aText.getLength();
532 aText = aText.copy( nStt, nEnd - nStt );
533 }
534 }
535 return aText;
536 }
537
538 OUString GetTextForLanguageGuessing(EditEngine const * rEditEngine, const ESelection& rDocSelection)
539 {
540 // string for guessing language
541
542 // get the full text of the paragraph that the end of selection is in
543 OUString aText = rEditEngine->GetText(rDocSelection.nEndPos);
544 if (!aText.isEmpty())
545 {
546 sal_Int32 nStt = 0;
547 sal_Int32 nEnd = rDocSelection.nEndPos;
548 // at most 100 chars to the left...
549 nStt = nEnd > 100 ? nEnd - 100 : 0;
550 // ... and 100 to the right of the cursor position
551 nEnd = aText.getLength() - nEnd > 100 ? nEnd + 100 : aText.getLength();
552 aText = aText.copy( nStt, nEnd - nStt );
553 }
554
555 return aText;
556 }
557
558 void SelectPara( EditView &rEditView, const ESelection &rCurSel )
559 {
560 ESelection aParaSel( rCurSel.nStartPara, 0, rCurSel.nStartPara, EE_TEXTPOS_ALL );
561 rEditView.SetSelection( aParaSel );
562 }
563
565 {
566 // select current para
567 if (!rWrtSh.IsSttPara())
569 if (!rWrtSh.HasMark())
570 rWrtSh.SetMark();
571 rWrtSh.SwapPam();
572 if (!rWrtSh.IsEndPara())
573 rWrtSh.MovePara( GoCurrPara, fnParaEnd );
574 }
575}
576
577/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetValue() const
OUString GetText(LineEnd eEnd=LINEEND_LF) const
EEControlBits GetControlWord() const
void CompleteOnlineSpelling()
void SetControlWord(EEControlBits nWord)
void QuickSetAttribs(const SfxItemSet &rSet, const ESelection &rSel)
void RemoveAttribs(bool bRemoveParaAttribs=false, sal_uInt16 nWhich=0)
void SetSelection(const ESelection &rNewSel)
LanguageType GetInputLanguage() const
EditEngine * GetEditEngine() const
void Invalidate()
SvtScriptType GetSelectedScriptType() const
ESelection GetSelection() const
SfxItemSet GetAttribs()
EditView & GetEditView() const
static SfxAbstractDialogFactory * Create()
void Invalidate(sal_uInt16 nId)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
const T * GetArg(sal_uInt16 nSlotId) const
void Done(bool bRemove=false)
void SetStringList(const css::uno::Sequence< OUString > &rList)
SfxBindings & GetBindings()
weld::Window * GetFrameWeld() const
SfxViewFrame & GetViewFrame() const
static OUString GetLanguageString(const LanguageType eType)
static LanguageType GetLanguageType(std::u16string_view rStr)
LanguageType GetLanguage() const
Represents the style of a text portion.
Definition: charfmt.hxx:27
size_t size() const
Definition: charformats.hxx:71
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:594
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2279
void StartAction()
Definition: crsrsh.cxx:226
void SwapPam()
Definition: crsrsh.cxx:990
bool MovePara(SwWhichPara, SwMoveFnCollection const &)
Definition: crsrsh.cxx:710
bool IsEndPara() const
Definition: crsrsh.cxx:1128
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
bool IsSttPara() const
Definition: crsrsh.cxx:1109
bool HasMark() const
Definition: crsrsh.hxx:902
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
void SetMark()
Definition: crsrsh.hxx:900
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:751
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:789
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:98
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:129
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in document.
Definition: edatmisc.cxx:84
SvtScriptType GetScriptType() const
returns the script type of the selection
Definition: edattr.cxx:662
void ResetAttr(const o3tl::sorted_vector< sal_uInt16 > &attrs=o3tl::sorted_vector< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:618
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:903
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
SwNode & GetPointNode() const
Definition: pam.hxx:283
const SwPosition * GetPoint() const
Definition: pam.hxx:261
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: fmtcol.cxx:432
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
const OUString & GetText() const
Definition: ndtxt.hxx:244
size_t size() const
Definition: docary.hxx:87
bool IsOnlineSpell() const
Definition: viewopt.hxx:539
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
void LockView(bool b)
Definition: viewsh.hxx:473
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:625
Definition: view.hxx:146
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:422
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void SelAll()
Definition: select.cxx:124
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2041
std::pair< const_iterator, bool > insert(Value &&x)
int nCount
float u
#define EE_TEXTPOS_ALL
EEControlBits
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
sal_Int32 nState
OUString const aScriptType
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
#define LANGUAGE_SYSTEM
#define LANGUAGE_NONE
#define LANGUAGE_DONTKNOW
SvtScriptType
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
LanguageType GetCurrentLanguage(SfxItemSet const &aSet, SvtScriptType nScriptType)
Definition: langhelper.cxx:472
void SelectPara(EditView &rEditView, const ESelection &rCurSel)
Definition: langhelper.cxx:558
void SetLanguage_None(SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:299
void ResetLanguages(SwWrtShell &rWrtSh, OutlinerView const *pOLV=nullptr)
Definition: langhelper.cxx:359
void SelectCurrentPara(SwWrtShell &rWrtSh)
Definition: langhelper.cxx:564
void GetLanguageStatus(OutlinerView *pOLV, SfxItemSet &rSet)
Definition: langhelper.cxx:57
bool SetLanguageStatus(OutlinerView *pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh)
Definition: langhelper.cxx:93
void SetLanguage(SwWrtShell &rWrtSh, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:217
OUString GetTextForLanguageGuessing(EditEngine const *rEditEngine, const ESelection &rDocSelection)
Definition: langhelper.cxx:538
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:393
int i
bool GoCurrPara(SwPaM &rPam, SwMoveFnCollection const &aPosPara)
Definition: pam.cxx:1225
SwMoveFnCollection const & fnParaStart
Definition: paminit.cxx:48
SwMoveFnCollection const & fnParaEnd
Definition: paminit.cxx:49
SfxItemState
static SfxItemSet & rSet
static LanguageType nLang
Definition: srtdlg.cxx:51
sal_Int32 nStartPara
sal_Int32 nEndPos
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84