LibreOffice Module sw (master)  1
olmenu.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 <SwRewriter.hxx>
21 #include <cmdid.h>
22 #include <strings.hrc>
23 #include <doc.hxx>
24 #include <docsh.hxx>
25 #include <edtwin.hxx>
26 #include <helpids.h>
27 #include <hintids.hxx>
28 #include <langhelper.hxx>
29 #include <ndtxt.hxx>
30 #include <bitmaps.hlst>
31 #include <olmenu.hxx>
32 #include <swabstdlg.hxx>
33 #include <swmodule.hxx>
34 #include <swtypes.hxx>
35 #include <swundo.hxx>
36 #include <uitool.hxx>
37 #include <unomid.h>
38 #include <view.hxx>
39 #include <viewopt.hxx>
40 #include <wrtsh.hxx>
41 #include <wview.hxx>
42 #include <textsh.hxx>
43 
44 #include <comphelper/lok.hxx>
47 #include <cppuhelper/exc_hlp.hxx>
48 #include <editeng/acorrcfg.hxx>
49 #include <editeng/svxacorr.hxx>
50 #include <editeng/langitem.hxx>
51 #include <editeng/splwrap.hxx>
52 #include <editeng/brushitem.hxx>
53 #include <editeng/unolingu.hxx>
54 #include <editeng/editview.hxx>
55 #include <i18nlangtag/mslangid.hxx>
57 #include <linguistic/lngprops.hxx>
58 #include <linguistic/misc.hxx>
59 #include <osl/file.hxx>
60 #include <rtl/string.hxx>
62 #include <vcl/graphicfilter.hxx>
63 #include <vcl/svapp.hxx>
64 #include <vcl/weld.hxx>
65 #include <sfx2/dispatch.hxx>
66 #include <sfx2/request.hxx>
67 #include <sfx2/sfxdlg.hxx>
68 #include <sfx2/viewfrm.hxx>
69 #include <svl/itemset.hxx>
70 #include <svl/languageoptions.hxx>
71 #include <svl/stritem.hxx>
72 #include <svtools/langtab.hxx>
73 #include <svx/dlgutil.hxx>
74 #include <svx/svxids.hrc>
75 #include <unotools/lingucfg.hxx>
76 #include <unotools/linguprops.hxx>
77 #include <vcl/layout.hxx>
78 #include <vcl/settings.hxx>
79 #include <sal/macros.h>
80 
81 #include <map>
82 
83 #include <com/sun/star/document/XDocumentLanguages.hpp>
84 #include <com/sun/star/frame/XFrame.hpp>
85 #include <com/sun/star/frame/XStorable.hpp>
86 #include <com/sun/star/i18n/ScriptType.hpp>
87 #include <com/sun/star/lang/XServiceInfo.hpp>
88 #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
89 #include <com/sun/star/uno/Any.hxx>
90 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
91 #include <com/sun/star/system/SystemShellExecute.hpp>
92 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
93 
94 using namespace ::com::sun::star;
95 
105 // check if nScriptType includes the script type associated to nLang
107 {
108  return bool(nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
109 }
110 
112  PopupMenu *pPopupMenu,
113  sal_uInt16 nLangItemIdStart,
114  const uno::Sequence< OUString >& aSeq,
115  SwWrtShell* pWrtSh,
116  std::map< sal_Int16, OUString > &rLangTable )
117 {
118  if (!pPopupMenu)
119  return;
120 
121  // set of languages to be displayed in the sub menus
122  std::set< OUString > aLangItems;
123 
124  OUString aCurLang( aSeq[0] );
125  SvtScriptType nScriptType = static_cast<SvtScriptType>(aSeq[1].toInt32());
126  OUString aKeyboardLang( aSeq[2] );
127  OUString aGuessedTextLang( aSeq[3] );
128 
129  if (!aCurLang.isEmpty() &&
131  aLangItems.insert( aCurLang );
132 
133  //2--System
134  const AllSettings& rAllSettings = Application::GetSettings();
135  LanguageType rSystemLanguage = rAllSettings.GetLanguageTag().getLanguageType();
136  if (rSystemLanguage != LANGUAGE_DONTKNOW)
137  {
138  if (lcl_checkScriptType( nScriptType, rSystemLanguage ))
139  aLangItems.insert( SvtLanguageTable::GetLanguageString(rSystemLanguage) );
140  }
141 
142  //3--UI
143  LanguageType rUILanguage = rAllSettings.GetUILanguageTag().getLanguageType();
144  if (rUILanguage != LANGUAGE_DONTKNOW)
145  {
146  if (lcl_checkScriptType(nScriptType, rUILanguage ))
147  aLangItems.insert( SvtLanguageTable::GetLanguageString(rUILanguage) );
148  }
149 
150  //4--guessed language
151  if (!aGuessedTextLang.isEmpty())
152  {
153  if (lcl_checkScriptType(nScriptType, SvtLanguageTable::GetLanguageType(aGuessedTextLang)))
154  aLangItems.insert( aGuessedTextLang );
155  }
156 
157  //5--keyboard language
158  if (!aKeyboardLang.isEmpty())
159  {
160  if (lcl_checkScriptType(nScriptType, SvtLanguageTable::GetLanguageType(aKeyboardLang)))
161  aLangItems.insert( aKeyboardLang );
162  }
163 
164  //6--all languages used in current document
165  uno::Reference< css::frame::XModel > xModel;
166  uno::Reference< css::frame::XController > xController = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController();
167  if ( xController.is() )
168  xModel = xController->getModel();
169  uno::Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, uno::UNO_QUERY );
170  /*the description of nScriptType flags
171  LATIN : 0x0001
172  ASIAN : 0x0002
173  COMPLEX: 0x0004
174  */
175  const sal_Int16 nMaxCount = 7;
176  if (xDocumentLanguages.is())
177  {
178  const uno::Sequence< lang::Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount ) );
179  for (const lang::Locale& rLocale : rLocales)
180  {
181  if (aLangItems.size() == size_t(nMaxCount))
182  break;
183  if (lcl_checkScriptType( nScriptType, SvtLanguageTable::GetLanguageType( rLocale.Language )))
184  aLangItems.insert( rLocale.Language );
185  }
186  }
187 
188  sal_uInt16 nItemId = nLangItemIdStart;
189  for (const OUString& aEntryText : aLangItems)
190  {
191  if (aEntryText != SvtLanguageTable::GetLanguageString( LANGUAGE_NONE ) &&
192  aEntryText != "*" && // multiple languages in current selection
193  !aEntryText.isEmpty()) // 'no language found' from language guessing
194  {
195  OSL_ENSURE( nLangItemIdStart <= nItemId && nItemId <= nLangItemIdStart + MN_MAX_NUM_LANG,
196  "nItemId outside of expected range!" );
197  pPopupMenu->InsertItem( nItemId, aEntryText, MenuItemBits::RADIOCHECK );
198  if (aEntryText == aCurLang)
199  {
200  //make a check mark for the current language
201  pPopupMenu->CheckItem( nItemId );
202  }
203  rLangTable[ nItemId ] = aEntryText;
204  ++nItemId;
205  }
206  }
207 
208  pPopupMenu->InsertItem( nLangItemIdStart + MN_NONE_OFFSET, SwResId( STR_LANGSTATUS_NONE ), MenuItemBits::RADIOCHECK );
210  pPopupMenu->CheckItem( nLangItemIdStart + MN_NONE_OFFSET );
211 
212  pPopupMenu->InsertItem( nLangItemIdStart + MN_RESET_OFFSET, SwResId( STR_RESET_TO_DEFAULT_LANGUAGE ) );
213  pPopupMenu->InsertItem( nLangItemIdStart + MN_MORE_OFFSET, SwResId( STR_LANGSTATUS_MORE ) );
214 }
215 
217  SwWrtShell* pWrtSh,
218  const uno::Reference< linguistic2::XSpellAlternatives > &xAlt,
219  const OUString &rParaText)
220  : m_aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/swriter/ui/spellmenu.ui", "")
221  , m_xPopupMenu(m_aBuilder.get_menu("menu"))
222  , m_nIgnoreWordId(m_xPopupMenu->GetItemId("ignoreall"))
223  , m_nAddMenuId(m_xPopupMenu->GetItemId("addmenu"))
224  , m_nAddId(m_xPopupMenu->GetItemId("add"))
225  , m_nSpellDialogId(m_xPopupMenu->GetItemId("spelldialog"))
226  , m_nCorrectMenuId(m_xPopupMenu->GetItemId("correctmenu"))
227  , m_nCorrectDialogId(m_xPopupMenu->GetItemId("correctdialog"))
228  , m_nLangSelectionMenuId(m_xPopupMenu->GetItemId("langselection"))
229  , m_nLangParaMenuId(m_xPopupMenu->GetItemId("langpara"))
230  , m_nRedlineAcceptId(m_xPopupMenu->GetItemId("accept"))
231  , m_nRedlineRejectId(m_xPopupMenu->GetItemId("reject"))
232  , m_nRedlineNextId(m_xPopupMenu->GetItemId("next"))
233  , m_nRedlinePrevId(m_xPopupMenu->GetItemId("prev"))
234  , m_pSh( pWrtSh )
235  , m_xSpellAlt(xAlt)
236  , m_nGrammarError(0)
237  , m_bGrammarResults(false)
238 {
239  OSL_ENSURE(m_xSpellAlt.is(), "no spelling alternatives available");
240 
241  m_xPopupMenu->SetMenuFlags(MenuFlags::NoAutoMnemonics);
242  bool bUseImagesInMenus = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus();
243 
245  if (m_xSpellAlt.is())
246  {
247  m_nCheckedLanguage = LanguageTag( m_xSpellAlt->getLocale() ).getLanguageType();
248  m_aSuggestions = m_xSpellAlt->getAlternatives();
249  }
250  sal_Int16 nStringCount = static_cast< sal_Int16 >( m_aSuggestions.getLength() );
251 
252  SvtLinguConfig aCfg;
253 
255  pMenu->SetMenuFlags(MenuFlags::NoAutoMnemonics);
256  bool bEnable = false;
257  if( nStringCount )
258  {
259  Image aImage;
260  OUString aSuggestionImageUrl;
261 
262  if (bUseImagesInMenus)
263  {
264  uno::Reference< container::XNamed > xNamed( m_xSpellAlt, uno::UNO_QUERY );
265  if (xNamed.is())
266  {
267  aSuggestionImageUrl = aCfg.GetSpellAndGrammarContextSuggestionImage( xNamed->getName() );
268  aImage = Image( aSuggestionImageUrl );
269  }
270  }
271 
272  m_xPopupMenu->InsertSeparator(OString(), 0);
273  bEnable = true;
274  sal_uInt16 nAutoCorrItemId = MN_AUTOCORR_START;
275  sal_uInt16 nItemId = MN_SUGGESTION_START;
276  for (sal_uInt16 i = 0; i < nStringCount; ++i)
277  {
278  const OUString aEntry = m_aSuggestions[ i ];
279  m_xPopupMenu->InsertItem(nItemId, aEntry, MenuItemBits::NONE, OString(), i);
281  if (!aSuggestionImageUrl.isEmpty())
282  m_xPopupMenu->SetItemImage(nItemId, aImage);
283 
284  pMenu->InsertItem( nAutoCorrItemId, aEntry );
285  pMenu->SetHelpId( nAutoCorrItemId, HID_LINGU_AUTOCORR);
286 
287  ++nAutoCorrItemId;
288  ++nItemId;
289  }
290  }
291 
292  uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
293  OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
294 
295  OUString aIgnoreSelection( SwResId( STR_IGNORE_SELECTION ) );
297  vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:SpellingAndGrammarDialog", aModuleName));
299  vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:AutoCorrectDlg", aModuleName));
301  {
304  }
305  sal_uInt16 nItemPos = m_xPopupMenu->GetItemPos(m_nIgnoreWordId);
306  m_xPopupMenu->InsertItem(MN_IGNORE_SELECTION, aIgnoreSelection, MenuItemBits::NONE, OString(), nItemPos);
308 
310 
311  uno::Reference< linguistic2::XLanguageGuessing > xLG = SW_MOD()->GetLanguageGuesser();
312  LanguageType nGuessLangWord = LANGUAGE_NONE;
313  LanguageType nGuessLangPara = LANGUAGE_NONE;
314  if (m_xSpellAlt.is() && xLG.is())
315  {
316  nGuessLangWord = EditView::CheckLanguage( m_xSpellAlt->getWord(), ::GetSpellChecker(), xLG, false );
317  nGuessLangPara = EditView::CheckLanguage( rParaText, ::GetSpellChecker(), xLG, true );
318  }
319  if (nGuessLangWord != LANGUAGE_NONE || nGuessLangPara != LANGUAGE_NONE)
320  {
321  // make sure LANGUAGE_NONE gets not used as menu entry
322  if (nGuessLangWord == LANGUAGE_NONE)
323  nGuessLangWord = nGuessLangPara;
324  if (nGuessLangPara == LANGUAGE_NONE)
325  nGuessLangPara = nGuessLangWord;
326  }
327 
329  pMenu->SetMenuFlags(MenuFlags::NoAutoMnemonics);
330  uno::Reference< linguistic2::XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
331  sal_uInt16 nItemId = MN_DICTIONARIES_START;
332  if (xDicList.is())
333  {
334  // add the default positive dictionary to dic-list (if not already done).
335  // This is to ensure that there is at least one dictionary to which
336  // words could be added.
337  uno::Reference< linguistic2::XDictionary > xDic( LinguMgr::GetStandardDic() );
338  if (xDic.is())
339  xDic->setActive( true );
340 
341  m_aDics = xDicList->getDictionaries();
342 
343  for( const uno::Reference< linguistic2::XDictionary >& rDic : std::as_const(m_aDics) )
344  {
345  uno::Reference< linguistic2::XDictionary > xDicTmp = rDic;
346  if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp)
347  continue;
348 
349  uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY );
350  LanguageType nActLanguage = LanguageTag( xDicTmp->getLocale() ).getLanguageType();
351  if( xDicTmp->isActive()
352  && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE
353  && (m_nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage )
354  && (!xStor.is() || !xStor->isReadonly()) )
355  {
356  // the extra 1 is because of the (possible) external
357  // linguistic entry above
358  pMenu->InsertItem( nItemId, xDicTmp->getName() );
359  m_aDicNameSingle = xDicTmp->getName();
360 
361  if (bUseImagesInMenus)
362  {
363  uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY );
364  if (xSvcInfo.is())
365  {
366  OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage(
367  xSvcInfo->getImplementationName() ) );
368  if (!aDictionaryImageUrl.isEmpty())
369  {
370  Image aImage( aDictionaryImageUrl );
371  pMenu->SetItemImage( nItemId, aImage );
372  }
373  }
374  }
375 
376  ++nItemId;
377  }
378  }
379  }
382 
383  //ADD NEW LANGUAGE MENU ITEM
384 
385  OUString aScriptTypesInUse( OUString::number( static_cast<int>(pWrtSh->GetScriptType()) ) );
386 
387  // get keyboard language
388  OUString aKeyboardLang;
389  SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
390  LanguageType nLang = rEditWin.GetInputLanguage();
391  if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
392  aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang );
393 
394  // get the language that is in use
395  OUString aCurrentLang("*");
396  nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh );
397  if (nLang != LANGUAGE_DONTKNOW)
398  aCurrentLang = SvtLanguageTable::GetLanguageString( nLang );
399 
400  // build sequence for status value
401  uno::Sequence< OUString > aSeq( 4 );
402  aSeq[0] = aCurrentLang;
403  aSeq[1] = aScriptTypesInUse;
404  aSeq[2] = aKeyboardLang;
405  aSeq[3] = SvtLanguageTable::GetLanguageString(nGuessLangWord);
406 
410 
414 
415  if (bUseImagesInMenus)
417  vcl::CommandInfoProvider::GetImageForCommand(".uno:SpellingAndGrammarDialog", xFrame));
418 
419  checkRedline();
420  m_xPopupMenu->RemoveDisabledEntries( true, true );
421 }
422 
424  SwWrtShell *pWrtSh,
425  const linguistic2::ProofreadingResult &rResult,
426  sal_Int32 nErrorInResult,
427  const uno::Sequence< OUString > &rSuggestions,
428  const OUString &rParaText )
429  : m_aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/swriter/ui/spellmenu.ui", "")
430  , m_xPopupMenu(m_aBuilder.get_menu("menu"))
431  , m_nIgnoreWordId(m_xPopupMenu->GetItemId("ignoreall"))
432  , m_nAddMenuId(m_xPopupMenu->GetItemId("addmenu"))
433  , m_nAddId(m_xPopupMenu->GetItemId("add"))
434  , m_nSpellDialogId(m_xPopupMenu->GetItemId("spelldialog"))
435  , m_nCorrectMenuId(m_xPopupMenu->GetItemId("correctmenu"))
436  , m_nCorrectDialogId(m_xPopupMenu->GetItemId("correctdialog"))
437  , m_nLangSelectionMenuId(m_xPopupMenu->GetItemId("langselection"))
438  , m_nLangParaMenuId(m_xPopupMenu->GetItemId("langpara"))
439  , m_nRedlineAcceptId(m_xPopupMenu->GetItemId("accept"))
440  , m_nRedlineRejectId(m_xPopupMenu->GetItemId("reject"))
441  , m_nRedlineNextId(m_xPopupMenu->GetItemId("next"))
442  , m_nRedlinePrevId(m_xPopupMenu->GetItemId("prev"))
443  , m_pSh(pWrtSh)
444  , m_xGrammarResult(rResult)
445  , m_aSuggestions(rSuggestions)
446  , m_sExplanationLink()
447  , m_bGrammarResults(true)
448 {
449  m_nCheckedLanguage = LanguageTag::convertToLanguageType( rResult.aLocale );
450  m_nGrammarError = nErrorInResult;
451  bool bUseImagesInMenus = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus();
452 
453  sal_uInt16 nPos = 0;
454  OUString aMessageText( rResult.aErrors[ nErrorInResult ].aShortComment );
455  m_xPopupMenu->InsertSeparator(OString(), nPos++);
456  m_xPopupMenu->InsertItem(MN_SHORT_COMMENT, aMessageText, MenuItemBits::NOSELECT, OString(), nPos++);
457  if (bUseImagesInMenus)
458  m_xPopupMenu->SetItemImage(MN_SHORT_COMMENT, Image(StockImage::Yes, BMP_INFO_16));
459 
460  // Add an item to show detailed infos if the FullCommentURL property is defined
461  const beans::PropertyValues aProperties = rResult.aErrors[ nErrorInResult ].aProperties;
462  for ( const auto& rProp : aProperties )
463  {
464  if ( rProp.Name == "FullCommentURL" )
465  {
466  uno::Any aValue = rProp.Value;
467  aValue >>= m_sExplanationLink;
468 
469  if ( !m_sExplanationLink.isEmpty( ) )
470  break;
471  }
472  }
473 
474  if ( !m_sExplanationLink.isEmpty( ) )
475  {
476  m_xPopupMenu->InsertItem(MN_EXPLANATION_LINK, SwResId(STR_EXPLANATION_LINK), MenuItemBits::TEXT | MenuItemBits::HELP, OString(), nPos++);
477  }
478 
479  m_xPopupMenu->SetMenuFlags(MenuFlags::NoAutoMnemonics);
480 
481  m_xPopupMenu->InsertSeparator(OString(), nPos++);
482  if ( m_aSuggestions.hasElements() ) // suggestions available...
483  {
484  Image aImage;
485  OUString aSuggestionImageUrl;
486 
487  if (bUseImagesInMenus)
488  {
489  uno::Reference< lang::XServiceInfo > xInfo( rResult.xProofreader, uno::UNO_QUERY );
490  if (xInfo.is())
491  {
492  aSuggestionImageUrl = SvtLinguConfig().GetSpellAndGrammarContextSuggestionImage( xInfo->getImplementationName() );
493  aImage = Image( aSuggestionImageUrl );
494  }
495  }
496 
497  sal_uInt16 nItemId = MN_SUGGESTION_START;
498  for (const OUString& aEntry : std::as_const(m_aSuggestions))
499  {
500  m_xPopupMenu->InsertItem(nItemId, aEntry, MenuItemBits::NONE, OString(), nPos++);
502  if (!aSuggestionImageUrl.isEmpty())
503  m_xPopupMenu->SetItemImage(nItemId, aImage);
504 
505  ++nItemId;
506  }
507  m_xPopupMenu->InsertSeparator(OString(), nPos++);
508  }
509 
510  uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
511  OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
512 
513  OUString aIgnoreSelection( SwResId( STR_IGNORE_SELECTION ) );
515  vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:SpellingAndGrammarDialog", aModuleName));
516  sal_uInt16 nItemPos = m_xPopupMenu->GetItemPos(m_nIgnoreWordId);
517  m_xPopupMenu->InsertItem(MN_IGNORE_SELECTION, aIgnoreSelection, MenuItemBits::NONE, OString(), nItemPos);
519 
522 
523  uno::Reference< linguistic2::XLanguageGuessing > xLG = SW_MOD()->GetLanguageGuesser();
524  LanguageType nGuessLangWord = LANGUAGE_NONE;
525  LanguageType nGuessLangPara = LANGUAGE_NONE;
526  if (xLG.is())
527  {
528  nGuessLangPara = EditView::CheckLanguage( rParaText, ::GetSpellChecker(), xLG, true );
529  }
530  if (nGuessLangWord != LANGUAGE_NONE || nGuessLangPara != LANGUAGE_NONE)
531  {
532  // make sure LANGUAGE_NONE gets not used as menu entry
533  if (nGuessLangWord == LANGUAGE_NONE)
534  nGuessLangWord = nGuessLangPara;
535  if (nGuessLangPara == LANGUAGE_NONE)
536  nGuessLangPara = nGuessLangWord;
537  }
538 
541 
542  //ADD NEW LANGUAGE MENU ITEM
543 
544  OUString aScriptTypesInUse( OUString::number( static_cast<int>(pWrtSh->GetScriptType()) ) );
545 
546  // get keyboard language
547  OUString aKeyboardLang;
548  SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
549  LanguageType nLang = rEditWin.GetInputLanguage();
550  if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
551  aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang );
552 
553  // get the language that is in use
554  OUString aCurrentLang("*");
555  nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh );
556  if (nLang != LANGUAGE_DONTKNOW)
557  aCurrentLang = SvtLanguageTable::GetLanguageString( nLang );
558 
559  // build sequence for status value
560  uno::Sequence< OUString > aSeq( 4 );
561  aSeq[0] = aCurrentLang;
562  aSeq[1] = aScriptTypesInUse;
563  aSeq[2] = aKeyboardLang;
564  aSeq[3] = SvtLanguageTable::GetLanguageString(nGuessLangWord);
565 
569 
573 
574  if (bUseImagesInMenus)
576  vcl::CommandInfoProvider::GetImageForCommand(".uno:SpellingAndGrammarDialog", xFrame));
577 
578  checkRedline();
579  m_xPopupMenu->RemoveDisabledEntries(true, true);
580 }
581 
583 
585 {
586  // Let SwView::GetState() already has the logic on when to disable the
587  // accept/reject and the next/prev change items, let it do the decision.
588 
589  // Build an item set that contains a void item for each menu entry. The
590  // WhichId of each item is set, so SwView may clear it.
591  static const sal_uInt16 pRedlineIds[] = {
596  };
597  SwDoc *pDoc = m_pSh->GetDoc();
599  for (sal_uInt16 nWhich : pRedlineIds)
600  {
601  aSet.Put(SfxVoidItem(nWhich));
602  }
603  m_pSh->GetView().GetState(aSet);
604 
605  // Enable/disable items based on if the which id of the void items are
606  // cleared or not.
607  for (sal_uInt16 nWhich : pRedlineIds)
608  {
609  sal_uInt16 nId(0);
610  if (nWhich == FN_REDLINE_ACCEPT_DIRECT)
611  nId = m_nRedlineAcceptId;
612  else if (nWhich == FN_REDLINE_REJECT_DIRECT)
613  nId = m_nRedlineRejectId;
614  else if (nWhich == FN_REDLINE_NEXT_CHANGE)
615  nId = m_nRedlineNextId;
616  else if (nWhich == FN_REDLINE_PREV_CHANGE)
617  nId = m_nRedlinePrevId;
618  m_xPopupMenu->EnableItem(nId, aSet.Get(nWhich).Which() != 0);
619  }
620 }
621 
622 void SwSpellPopup::Execute( const tools::Rectangle& rWordPos, vcl::Window* pWin )
623 {
624  sal_uInt16 nRet = m_xPopupMenu->Execute(pWin, pWin->LogicToPixel(rWordPos));
625  Execute( nRet );
626 }
627 
628 void SwSpellPopup::Execute( sal_uInt16 nId )
629 {
630  if (nId == USHRT_MAX)
631  return;
632 
633  if (/*m_bGrammarResults && */nId == MN_SHORT_COMMENT)
634  return; // nothing to do since it is the error message (short comment)
635 
636  if ((MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ||
637  (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END))
638  {
639  sal_Int32 nAltIdx = (MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ?
641  OSL_ENSURE(nAltIdx < m_aSuggestions.getLength(), "index out of range");
642  if (nAltIdx < m_aSuggestions.getLength() && (m_bGrammarResults || m_xSpellAlt.is()))
643  {
644  bool bOldIns = m_pSh->IsInsMode();
645  m_pSh->SetInsMode();
646 
647  OUString aTmp( m_aSuggestions[ nAltIdx ] );
648  OUString aOrig( m_bGrammarResults ? OUString() : m_xSpellAlt->getWord() );
649 
650  // if original word has a trailing . (likely the end of a sentence)
651  // and the replacement text hasn't, then add it to the replacement
652  if (!aTmp.isEmpty() && !aOrig.isEmpty() &&
653  aOrig.endsWith(".") && /* !IsAlphaNumeric ??*/
654  !aTmp.endsWith("."))
655  {
656  aTmp += ".";
657  }
658 
659  SwRewriter aRewriter;
660 
661  aRewriter.AddRule(UndoArg1, m_pSh->GetCursorDescr());
662  aRewriter.AddRule(UndoArg2, SwResId(STR_YIELDS));
663 
664  OUString aTmpStr = SwResId(STR_START_QUOTE) +
665  aTmp + SwResId(STR_END_QUOTE);
666  aRewriter.AddRule(UndoArg3, aTmpStr);
667 
668  m_pSh->StartUndo(SwUndoId::UI_REPLACE, &aRewriter);
669  m_pSh->StartAction();
670  m_pSh->DelLeft();
671 
672  m_pSh->Insert( aTmp );
673 
674  /* #102505# EndAction/EndUndo moved down since insertion
675  of temporary auto correction is now undoable two and
676  must reside in the same undo group.*/
677 
678  // record only if it's NOT already present in autocorrection
680 
681  OUString aOrigWord( m_bGrammarResults ? OUString() : m_xSpellAlt->getWord() ) ;
682  OUString aNewWord( m_aSuggestions[ nAltIdx ] );
683  SvxPrepareAutoCorrect( aOrigWord, aNewWord );
684 
685  if (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END)
686  pACorr->PutText( aOrigWord, aNewWord, m_nCheckedLanguage );
687 
688  /* #102505# EndAction/EndUndo moved down since insertion
689  of temporary auto correction is now undoable two and
690  must reside in the same undo group.*/
691  m_pSh->EndAction();
692  m_pSh->EndUndo();
693 
694  m_pSh->SetInsMode( bOldIns );
695  }
696  }
697  else if (nId == m_nSpellDialogId)
698  {
699  if (m_bGrammarResults)
700  {
701  SvtLinguConfig().SetProperty( UPN_IS_GRAMMAR_INTERACTIVE, uno::makeAny( true ));
702  }
703  m_pSh->Left(CRSR_SKIP_CHARS, false, 1, false );
704  {
705  uno::Reference<linguistic2::XSearchableDictionaryList> xDictionaryList( LinguMgr::GetDictionaryList() );
706  SvxDicListChgClamp aClamp( xDictionaryList );
708  Execute( FN_SPELL_GRAMMAR_DIALOG, SfxCallMode::ASYNCHRON );
709  }
710  }
711  else if (nId == m_nCorrectDialogId)
712  {
713  m_pSh->GetView().GetViewFrame()->GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON );
714  }
715  else if (nId == MN_IGNORE_SELECTION)
716  {
717  SwPaM *pPaM = m_pSh->GetCursor();
718  if (pPaM)
720  }
721  else if (nId == m_nIgnoreWordId)
722  {
723  uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList();
724  if (m_bGrammarResults) {
725  try
726  {
727  m_xGrammarResult.xProofreader->ignoreRule(
728  m_xGrammarResult.aErrors[ m_nGrammarError ].aRuleIdentifier,
729  m_xGrammarResult.aLocale );
730  // refresh the layout of the actual paragraph (faster)
731  SwPaM *pPaM = m_pSh->GetCursor();
732  if (pPaM)
734  // refresh the layout of all paragraphs (workaround to launch a dictionary event)
735  xDictionary->setActive(false);
736  xDictionary->setActive(true);
737  }
738  catch( const uno::Exception& )
739  {
740  }
741  } else {
742  OUString sWord(m_xSpellAlt->getWord());
744  sWord, false, OUString() );
745  if (linguistic::DictionaryError::NONE != nAddRes && !xDictionary->getEntry(sWord).is())
746  {
747  SvxDicError(m_pSh->GetView().GetFrameWeld(), nAddRes);
748  }
749  }
750  }
751  else if ((MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) || nId == m_nAddId)
752  {
753  OUString sWord( m_xSpellAlt->getWord() );
754  OUString aDicName;
755 
756  if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END)
757  {
759  aDicName = pMenu->GetItemText(nId);
760  }
761  else
762  aDicName = m_aDicNameSingle;
763 
764  uno::Reference< linguistic2::XDictionary > xDic;
765  uno::Reference< linguistic2::XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
766  if (xDicList.is())
767  xDic = xDicList->getDictionaryByName( aDicName );
768 
769  if (xDic.is())
770  {
771  linguistic::DictionaryError nAddRes = linguistic::AddEntryToDic(xDic, sWord, false, OUString());
772  // save modified user-dictionary if it is persistent
773  uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY );
774  if (xSavDic.is())
775  xSavDic->store();
776 
777  if (linguistic::DictionaryError::NONE != nAddRes && !xDic->getEntry(sWord).is())
778  {
779  SvxDicError(m_pSh->GetView().GetFrameWeld(), nAddRes);
780  }
781  }
782  }
783  else if ( nId == MN_EXPLANATION_LINK && !m_sExplanationLink.isEmpty() )
784  {
785  try
786  {
787  uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute(
788  css::system::SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) );
789  xSystemShellExecute->execute( m_sExplanationLink, OUString(),
790  css::system::SystemShellExecuteFlags::URIS_ONLY );
791  }
792  catch (const uno::Exception&)
793  {
795  OUString msg( ::comphelper::anyToString( exc ) );
796  const SolarMutexGuard guard;
797  std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pSh->GetView().GetFrameWeld(),
798  VclMessageType::Warning, VclButtonsType::Ok, msg));
799  xBox->set_title("Explanations");
800  xBox->run();
801  }
802  }
803  else if (nId == m_nRedlineAcceptId || nId == m_nRedlineRejectId
804  || nId == m_nRedlineNextId || nId == m_nRedlinePrevId)
805  {
806  if (nId == m_nRedlineAcceptId)
808  else if (nId == m_nRedlineRejectId)
810  else if (nId == m_nRedlineNextId)
812  else if (nId == m_nRedlinePrevId)
814  // Let SwView::Execute() handle the redline actions.
815  SfxRequest aReq(m_pSh->GetView().GetViewFrame(), nId);
816  m_pSh->GetView().Execute(aReq);
817  }
818  else
819  {
820  // Set language for selection or for paragraph...
821 
822  SfxItemSet aCoreSet( m_pSh->GetView().GetPool(),
825  RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE>{} );
826  OUString aNewLangText;
827 
829  {
830  //Set language for current selection
831  aNewLangText = m_aLangTable_Text[nId];
832  SwLangHelper::SetLanguage( *m_pSh, aNewLangText, true, aCoreSet );
833  }
834  else if (nId == MN_SET_SELECTION_NONE)
835  {
836  //Set Language_None for current selection
837  SwLangHelper::SetLanguage_None( *m_pSh, true, aCoreSet );
838  }
839  else if (nId == MN_SET_SELECTION_RESET)
840  {
841  //reset languages for current selection
843  }
844  else if (nId == MN_SET_SELECTION_MORE)
845  {
846  //Open Format/Character Dialog
847  sw_CharDialog( *m_pSh, true, SID_ATTR_CHAR_FONT, nullptr, nullptr );
848  }
850  {
851  //Set language for current paragraph
852  aNewLangText = m_aLangTable_Paragraph[nId];
853  m_pSh->Push(); // save cursor
855  SwLangHelper::SetLanguage( *m_pSh, aNewLangText, true, aCoreSet );
856  m_pSh->Pop(SwCursorShell::PopMode::DeleteCurrent); // restore cursor
857  }
858  else if (nId == MN_SET_PARA_NONE)
859  {
860  //Set Language_None for current paragraph
861  m_pSh->Push(); // save cursor
863  SwLangHelper::SetLanguage_None( *m_pSh, true, aCoreSet );
864  m_pSh->Pop(SwCursorShell::PopMode::DeleteCurrent); // restore cursor
865  }
866  else if (nId == MN_SET_PARA_RESET)
867  {
868  //reset languages for current paragraph
869  m_pSh->Push(); // save cursor
872  m_pSh->Pop(SwCursorShell::PopMode::DeleteCurrent); // restore cursor
873  }
874  else if (nId == MN_SET_PARA_MORE)
875  {
876  m_pSh->Push(); // save cursor
878  //Open Format/Character Dialog
879  sw_CharDialog( *m_pSh, true, SID_ATTR_CHAR_FONT, nullptr, nullptr );
880  m_pSh->Pop(SwCursorShell::PopMode::DeleteCurrent); // restore cursor
881  }
882  }
883 
884  m_pSh->EnterStdMode();
885 }
886 
887 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
#define MN_SUGGESTION_START
Definition: olmenu.hxx:46
#define LANGUAGE_NONE
PopupMenu * GetPopupMenu(sal_uInt16 nItemId) const
void SetItemImage(sal_uInt16 nItemId, const Image &rImage)
static SvxAutoCorrCfg & Get()
#define MN_SET_PARA_MORE
Definition: olmenu.hxx:72
#define RES_CHRATR_CJK_LANGUAGE
Definition: hintids.hxx:93
bool IsInsMode() const
Definition: wrtsh.hxx:165
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:184
sal_uInt16 const m_nLangParaMenuId
Definition: olmenu.hxx:87
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:79
const LanguageTag & GetUILanguageTag() const
#define HID_LINGU_AUTOCORR
Definition: helpids.h:62
OUString GetPopupLabelForCommand(const OUString &rsCommandName, const OUString &rsModuleName)
void SetHelpId(sal_uInt16 nItemId, const OString &rHelpId)
LanguageType getLanguageType(bool bResolveSystem=true) const
SfxDispatcher * GetDispatcher()
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
sal_uInt16 const m_nIgnoreWordId
Definition: olmenu.hxx:80
LanguageType m_nCheckedLanguage
Definition: olmenu.hxx:102
Reference< XFrame > xFrame
#define MN_DICTIONARIES_END
Definition: olmenu.hxx:43
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1726
Definition: doc.hxx:185
sal_Int16 nId
static css::uno::Reference< css::linguistic2::XDictionary > GetStandardDic()
sal_uInt16 const m_nRedlineNextId
Definition: olmenu.hxx:90
#define MN_DICTIONARIES_START
Definition: olmenu.hxx:42
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:233
#define HID_LINGU_IGNORE_SELECTION
Definition: helpids.h:64
sal_uInt16 const m_nCorrectMenuId
Definition: olmenu.hxx:84
void EnterStdMode()
Definition: select.cxx:555
sal_uInt16 GetItemPos(sal_uInt16 nItemId) const
SwEditWin & GetEditWin()
Definition: view.hxx:403
sal_uInt16 Execute(vcl::Window *pWindow, const Point &rPopupPos)
sal_uInt16 const m_nAddId
Definition: olmenu.hxx:82
#define MN_SHORT_COMMENT
Definition: olmenu.hxx:38
OUString GetCursorDescr() const
Returns textual description of the current selection.
Definition: crsrsh.cxx:3602
sal_uInt16 const m_nRedlineRejectId
Definition: olmenu.hxx:89
void HideItem(sal_uInt16 nItemId)
#define MN_MAX_NUM_LANG
Definition: olmenu.hxx:54
static LanguageType nLang
Definition: srtdlg.cxx:60
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
OUString m_sExplanationLink
Definition: olmenu.hxx:100
const SwView & GetView() const
Definition: wrtsh.hxx:428
Reference< XController > xController
Any SAL_CALL getCaughtException()
#define MN_EXPLANATION_LINK
Definition: olmenu.hxx:39
SfxFrame & GetFrame() const
static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDictionaryList()
void SetMenuFlags(MenuFlags nFlags)
#define MN_IGNORE_SELECTION
Don't change these values. You may break context menu modifying extensions!
Definition: olmenu.hxx:37
css::uno::Reference< css::linguistic2::XSpellAlternatives > m_xSpellAlt
Definition: olmenu.hxx:94
OUString GetSpellAndGrammarContextDictionaryImage(const OUString &rServiceImplName) const
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
void InsertSeparator(const OString &rIdent=OString(), sal_uInt16 nPos=MENU_APPEND)
static SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList()
void Insert(SwField const &, SwPaM *pAnnotationRange=nullptr)
Definition: wrtsh2.cxx:71
#define MN_SET_SELECTION_MORE
Definition: olmenu.hxx:65
SwWrtShell * m_pSh
Definition: olmenu.hxx:92
std::map< sal_Int16, OUString > m_aLangTable_Text
Definition: olmenu.hxx:104
SfxItemPool & GetPool() const
const LanguageTag & GetLanguageTag() const
#define UPN_IS_GRAMMAR_INTERACTIVE
short SvxDicError(weld::Window *pParent, linguistic::DictionaryError nError)
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
Image GetImageForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)
#define FN_REDLINE_ACCEPT_DIRECT
Definition: cmdid.h:136
SvtScriptType
void sw_CharDialog(SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot, const SfxItemSet *pArgs, SfxRequest *pReq)
Definition: textsh1.cxx:136
SvtScriptType GetScriptType() const
returns the script type of the selection
Definition: edattr.cxx:666
#define SW_MOD()
Definition: swmodule.hxx:256
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
#define MN_MORE_OFFSET
Definition: olmenu.hxx:58
#define MN_SET_LANGUAGE_SELECTION_START
Definition: olmenu.hxx:61
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:228
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
#define MN_SET_SELECTION_NONE
Definition: olmenu.hxx:63
css::linguistic2::ProofreadingResult m_xGrammarResult
Definition: olmenu.hxx:96
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2221
SvxAutoCorrect * GetAutoCorrect()
int i
void ResetLanguages(SwWrtShell &rWrtSh, OutlinerView const *pOLV=nullptr)
Definition: langhelper.cxx:365
sal_uInt16 const m_nLangSelectionMenuId
Definition: olmenu.hxx:86
#define FN_REDLINE_PREV_CHANGE
Definition: cmdid.h:141
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:222
bool const m_bGrammarResults
Definition: olmenu.hxx:108
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:29
Object Value
std::map< sal_Int16, OUString > m_aLangTable_Paragraph
Definition: olmenu.hxx:105
static bool lcl_checkScriptType(SvtScriptType nScriptType, LanguageType nLang)
Definition: olmenu.cxx:106
OUString m_aDicNameSingle
Definition: olmenu.hxx:107
#define LANGUAGE_DONTKNOW
void SetLanguage_None(SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:305
void SelectCurrentPara(SwWrtShell &rWrtSh)
Definition: langhelper.cxx:573
#define MN_SET_PARA_RESET
Definition: olmenu.hxx:71
void SvxPrepareAutoCorrect(OUString &rOldText, const OUString &rNewText)
VclPtr< PopupMenu > m_xPopupMenu
Definition: olmenu.hxx:79
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
sal_uInt16 const m_nRedlineAcceptId
Definition: olmenu.hxx:88
bool DelLeft()
Definition: delete.cxx:129
css::uno::Sequence< css::uno::Reference< css::linguistic2::XDictionary > > m_aDics
Definition: olmenu.hxx:93
OUString GetItemText(sal_uInt16 nItemId) const
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
void EnableItem(sal_uInt16 nItemId, bool bEnable=true)
void CheckItem(sal_uInt16 nItemId, bool bCheck=true)
Point LogicToPixel(const Point &rLogicPt) const
void StartAction()
Definition: crsrsh.cxx:211
OUString GetSpellAndGrammarContextSuggestionImage(const OUString &rServiceImplName) const
#define MN_SET_SELECTION_RESET
Definition: olmenu.hxx:64
#define MN_AUTOCORR_START
Definition: olmenu.hxx:50
void InsertItem(sal_uInt16 nItemId, const OUString &rStr, MenuItemBits nItemBits=MenuItemBits::NONE, const OString &rIdent=OString(), sal_uInt16 nPos=MENU_APPEND)
void SetInsMode(bool bOn=true)
Definition: select.cxx:674
bool PutText(const OUString &rShort, const OUString &rLong, LanguageType eLang)
#define MN_SUGGESTION_END
Definition: olmenu.hxx:47
sal_Int32 m_nGrammarError
Definition: olmenu.hxx:97
#define FN_SPELL_GRAMMAR_DIALOG
Definition: cmdid.h:585
weld::Window * GetFrameWeld() const
bool Left(sal_uInt16 nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:102
SwSpellPopup(SwWrtShell *pWrtSh, const css::uno::Reference< css::linguistic2::XSpellAlternatives > &xAlt, const OUString &rParaText)
#define MN_AUTOCORR_END
Definition: olmenu.hxx:51
bool GetUseImagesInMenus() const
DictionaryError AddEntryToDic(uno::Reference< XDictionary > const &rxDic, const OUString &rWord, bool bIsNeg, const OUString &rRplcTxt, bool bStripDot)
#define MN_SET_LANGUAGE_SELECTION_END
Definition: olmenu.hxx:62
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:98
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
#define FN_REDLINE_NEXT_CHANGE
Definition: cmdid.h:140
#define MN_SET_LANGUAGE_PARAGRAPH_END
Definition: olmenu.hxx:69
static void fillLangPopupMenu(PopupMenu *pPopupMenu, sal_uInt16 nLangStart, const css::uno::Sequence< OUString > &aSeq, SwWrtShell *pWrtSh, std::map< sal_Int16, OUString > &rLangTable)
Definition: olmenu.cxx:111
css::uno::Sequence< OUString > m_aSuggestions
Definition: olmenu.hxx:99
#define HID_LINGU_REPLACE
Definition: helpids.h:63
#define MN_SET_LANGUAGE_PARAGRAPH_START
Definition: olmenu.hxx:68
uno::Reference< linguistic2::XSpellChecker1 > GetSpellChecker()
Definition: swtypes.cxx:45
static void IgnoreGrammarErrorAt(SwPaM &rErrorPosition)
Definition: edlingu.cxx:1675
sal_uInt16 const m_nAddMenuId
Definition: olmenu.hxx:81
bool SetProperty(const OUString &rPropertyName, const css::uno::Any &rValue)
void Execute(SfxRequest &)
Definition: view2.cxx:546
Reference< XComponentContext > getProcessComponentContext()
LanguageType GetCurrentLanguage(SfxItemSet const &aSet, SvtScriptType nScriptType)
Definition: langhelper.cxx:481
static LanguageType CheckLanguage(const OUString &rText, const css::uno::Reference< css::linguistic2::XSpellChecker1 > &xSpell, const css::uno::Reference< css::linguistic2::XLanguageGuessing > &xLangGuess, bool bIsParaText)
void SetLanguage(SwWrtShell &rWrtSh, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:223
sal_uInt16 const m_nCorrectDialogId
Definition: olmenu.hxx:85
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
static OUString GetLanguageString(const LanguageType eType)
#define MN_SET_PARA_NONE
Definition: olmenu.hxx:70
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:63
sal_uInt16 const m_nSpellDialogId
Definition: olmenu.hxx:83
Reference< XModel > xModel
#define MN_NONE_OFFSET
Definition: olmenu.hxx:56
void checkRedline()
Checks if any of the redline menu items should be hidden.
Definition: olmenu.cxx:584
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
void RemoveDisabledEntries(bool bCheckPopups=true, bool bRemoveEmptyPopups=false)
sal_uInt16 const m_nRedlinePrevId
Definition: olmenu.hxx:91
LanguageType GetInputLanguage() const
void Execute(const tools::Rectangle &rPopupPos, vcl::Window *pWin)
Definition: olmenu.cxx:622
sal_Int32 nPos
#define FN_REDLINE_REJECT_DIRECT
Definition: cmdid.h:137
#define MN_RESET_OFFSET
Definition: olmenu.hxx:57
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1309
static LanguageType GetLanguageType(const OUString &rStr)
OUString anyToString(uno::Any const &value)
void GetState(SfxItemSet &)
Definition: viewstat.cxx:71
void SetItemText(sal_uInt16 nItemId, const OUString &rStr)