LibreOffice Module sw (master)  1
olmenu.hxx
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 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_OLMENU_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_OLMENU_HXX
21 
22 #include <com/sun/star/linguistic2/XDictionary.hpp>
23 #include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
24 #include <com/sun/star/linguistic2/ProofreadingResult.hpp>
25 #include <com/sun/star/uno/Sequence.h>
26 
27 #include <rtl/ustring.hxx>
28 #include <vcl/builder.hxx>
29 #include <vcl/menu.hxx>
30 
31 #include <map>
32 #include <vector>
33 
34 #include <swdllapi.h>
35 
37 #define MN_IGNORE_SELECTION 201
38 #define MN_SHORT_COMMENT 208
39 #define MN_EXPLANATION_LINK 209
40 
41 // id range for dictionaries sub menu
42 #define MN_DICTIONARIES_START 300
43 #define MN_DICTIONARIES_END (MN_DICTIONARIES_START + 99)
44 
45 // id range for suggestions from spell and grammar checker
46 #define MN_SUGGESTION_START 500
47 #define MN_SUGGESTION_END (MN_SUGGESTION_START + MN_MAX_NUM_LANG)
48 
49 // id range for auto correction sub menu entries
50 #define MN_AUTOCORR_START 700
51 #define MN_AUTOCORR_END (MN_AUTOCORR_START + MN_MAX_NUM_LANG)
52 
53 // max number of language entries sub menus
54 #define MN_MAX_NUM_LANG 99
55 
56 #define MN_NONE_OFFSET (MN_MAX_NUM_LANG + 1)
57 #define MN_RESET_OFFSET (MN_MAX_NUM_LANG + 2)
58 #define MN_MORE_OFFSET (MN_MAX_NUM_LANG + 3)
59 
60 // id range for 'set language for selection' sub menu entries
61 #define MN_SET_LANGUAGE_SELECTION_START 900
62 #define MN_SET_LANGUAGE_SELECTION_END (MN_SET_LANGUAGE_SELECTION_START + MN_MAX_NUM_LANG)
63 #define MN_SET_SELECTION_NONE (MN_SET_LANGUAGE_SELECTION_START + MN_NONE_OFFSET)
64 #define MN_SET_SELECTION_RESET (MN_SET_LANGUAGE_SELECTION_START + MN_RESET_OFFSET)
65 #define MN_SET_SELECTION_MORE (MN_SET_LANGUAGE_SELECTION_START + MN_MORE_OFFSET)
66 
67 // id range for 'set language for paragraph' sub menu entries
68 #define MN_SET_LANGUAGE_PARAGRAPH_START 1100
69 #define MN_SET_LANGUAGE_PARAGRAPH_END (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MAX_NUM_LANG)
70 #define MN_SET_PARA_NONE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_NONE_OFFSET)
71 #define MN_SET_PARA_RESET (MN_SET_LANGUAGE_PARAGRAPH_START + MN_RESET_OFFSET)
72 #define MN_SET_PARA_MORE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MORE_OFFSET)
73 
74 class SwWrtShell;
75 
77 {
80  sal_uInt16 const m_nIgnoreWordId;
81  sal_uInt16 const m_nAddMenuId;
82  sal_uInt16 const m_nAddId;
83  sal_uInt16 const m_nSpellDialogId;
84  sal_uInt16 const m_nCorrectMenuId;
85  sal_uInt16 const m_nCorrectDialogId;
86  sal_uInt16 const m_nLangSelectionMenuId;
87  sal_uInt16 const m_nLangParaMenuId;
88  sal_uInt16 const m_nRedlineAcceptId;
89  sal_uInt16 const m_nRedlineRejectId;
90  sal_uInt16 const m_nRedlineNextId;
91  sal_uInt16 const m_nRedlinePrevId;
93  css::uno::Sequence< css::uno::Reference< css::linguistic2::XDictionary > > m_aDics;
94  css::uno::Reference< css::linguistic2::XSpellAlternatives > m_xSpellAlt;
95 
96  css::linguistic2::ProofreadingResult m_xGrammarResult;
97  sal_Int32 m_nGrammarError;
98 
99  css::uno::Sequence< OUString > m_aSuggestions;
101 
103 
104  std::map< sal_Int16, OUString > m_aLangTable_Text;
105  std::map< sal_Int16, OUString > m_aLangTable_Paragraph;
106 
108  bool const m_bGrammarResults; // show grammar results? Or show spellcheck results?
109 
110  static void fillLangPopupMenu( PopupMenu *pPopupMenu, sal_uInt16 nLangStart,
111  const css::uno::Sequence< OUString >& aSeq, SwWrtShell* pWrtSh,
112  std::map< sal_Int16, OUString > &rLangTable );
113 
115  void checkRedline();
116 
117 public:
118  SwSpellPopup( SwWrtShell *pWrtSh,
119  const css::uno::Reference< css::linguistic2::XSpellAlternatives > &xAlt,
120  const OUString & rParaText );
121 
122  SwSpellPopup( SwWrtShell *pWrtSh,
123  const css::linguistic2::ProofreadingResult &rResult,
124  sal_Int32 nErrorInResult,
125  const css::uno::Sequence< OUString > &rSuggestions,
126  const OUString & rParaText );
127 
128  ~SwSpellPopup();
129 
131  {
132  return *m_xPopupMenu.get();
133  }
134 
135  void Execute( const tools::Rectangle& rPopupPos, vcl::Window* pWin );
136  void Execute( sal_uInt16 nId );
137 
138 };
139 
140 #endif
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 const m_nLangParaMenuId
Definition: olmenu.hxx:87
sal_uInt16 const m_nIgnoreWordId
Definition: olmenu.hxx:80
LanguageType m_nCheckedLanguage
Definition: olmenu.hxx:102
sal_uInt16 const m_nRedlineNextId
Definition: olmenu.hxx:90
sal_uInt16 const m_nCorrectMenuId
Definition: olmenu.hxx:84
sal_uInt16 const m_nAddId
Definition: olmenu.hxx:82
sal_uInt16 const m_nRedlineRejectId
Definition: olmenu.hxx:89
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
OUString m_sExplanationLink
Definition: olmenu.hxx:100
css::uno::Reference< css::linguistic2::XSpellAlternatives > m_xSpellAlt
Definition: olmenu.hxx:94
PopupMenu & GetMenu()
Definition: olmenu.hxx:130
SwWrtShell * m_pSh
Definition: olmenu.hxx:92
std::map< sal_Int16, OUString > m_aLangTable_Text
Definition: olmenu.hxx:104
css::linguistic2::ProofreadingResult m_xGrammarResult
Definition: olmenu.hxx:96
sal_uInt16 const m_nLangSelectionMenuId
Definition: olmenu.hxx:86
bool const m_bGrammarResults
Definition: olmenu.hxx:108
std::map< sal_Int16, OUString > m_aLangTable_Paragraph
Definition: olmenu.hxx:105
OUString m_aDicNameSingle
Definition: olmenu.hxx:107
VclPtr< PopupMenu > m_xPopupMenu
Definition: olmenu.hxx:79
sal_uInt16 const m_nRedlineAcceptId
Definition: olmenu.hxx:88
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
css::uno::Sequence< css::uno::Reference< css::linguistic2::XDictionary > > m_aDics
Definition: olmenu.hxx:93
sal_Int32 m_nGrammarError
Definition: olmenu.hxx:97
css::uno::Sequence< OUString > m_aSuggestions
Definition: olmenu.hxx:99
sal_uInt16 const m_nAddMenuId
Definition: olmenu.hxx:81
VclBuilder m_aBuilder
Definition: olmenu.hxx:78
sal_uInt16 const m_nCorrectDialogId
Definition: olmenu.hxx:85
PopupMenu * get() const
sal_uInt16 const m_nSpellDialogId
Definition: olmenu.hxx:83
sal_uInt16 const m_nRedlinePrevId
Definition: olmenu.hxx:91