xref: /aoo42x/main/sfx2/source/menu/thessubmenu.hxx (revision 353d8f4d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #ifndef _THESSUBMENU_HXX_
26 #define _THESSUBMENU_HXX_
27 
28 #include <com/sun/star/linguistic2/XThesaurus.hpp>
29 #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
30 
31 #include <vcl/menu.hxx>
32 #include <sfx2/mnuitem.hxx>
33 
34 class SfxBindings;
35 class PopupMenu;
36 class Menu;
37 
38 namespace css = ::com::sun::star;
39 
40 ////////////////////////////////////////////////////////////
41 
42 class SfxThesSubMenuControl : public SfxMenuControl
43 {
44 	PopupMenu*			pMenu;
45 	Menu&				rParent;
46 
47 private:
48 	virtual void    StateChanged( sal_uInt16, SfxItemState, const SfxPoolItem* pState );
49 	DECL_LINK( MenuSelect, Menu * );
50 
51 public:
52     SfxThesSubMenuControl(sal_uInt16, Menu&, SfxBindings&);
53 	~SfxThesSubMenuControl();
54 
55     virtual PopupMenu*  GetPopup() const;
56 
57     SFX_DECL_MENU_CONTROL();
58 };
59 
60 ////////////////////////////////////////////////////////////
61 
62 class SfxThesSubMenuHelper
63 {
64     css::uno::Reference< css::linguistic2::XLinguServiceManager >   m_xLngMgr;
65     css::uno::Reference< css::linguistic2::XThesaurus >             m_xThesarus;
66 
67 private:
68 
69     // don't use copy c-tor and assignment operator
70     SfxThesSubMenuHelper( const SfxThesSubMenuHelper & );
71     SfxThesSubMenuHelper & operator = ( const SfxThesSubMenuHelper & );
72 
73 public:
74     SfxThesSubMenuHelper();
75     ~SfxThesSubMenuHelper();
76 
77     static ::rtl::OUString     GetText( const String &rLookUpString, xub_StrLen nDelimPos );
78 
79     // returns the Locale to be used for the selected text when the thesaurus is to be called
80     static void GetLocale( css::lang::Locale /*out */ &rLocale, const String &rLookUpString, xub_StrLen nDelimPos );
81 
82     // returns true if the locale is upported by the theasaurus
83     bool    IsSupportedLocale( const css::lang::Locale & rLocale ) const;
84 
85     // get the first nMax Synonym entries, even if different meanings need to be evaluated
86     bool    GetMeanings( std::vector< ::rtl::OUString > & rSynonyms, const ::rtl::OUString & rWord, const css::lang::Locale & rLocale, sal_Int16 nMaxSynonms );
87 
88     String  GetThesImplName( const css::lang::Locale &rLocale ) const;
89 };
90 
91 ////////////////////////////////////////////////////////////
92 
93 
94 #endif
95 
96 
97