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