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