xref: /aoo41x/main/sfx2/source/menu/thessubmenu.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2008 by Sun Microsystems, Inc.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * $RCSfile: thessubmenu.hxx,v $
10  * $Revision: 1.0 $
11  *
12  * This file is part of OpenOffice.org.
13  *
14  * OpenOffice.org is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License version 3
16  * only, as published by the Free Software Foundation.
17  *
18  * OpenOffice.org is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU Lesser General Public License version 3 for more details
22  * (a copy is included in the LICENSE file that accompanied this code).
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * version 3 along with OpenOffice.org.  If not, see
26  * <http://www.openoffice.org/license.html>
27  * for a copy of the LGPLv3 License.
28  *
29  ************************************************************************/
30 
31 
32 #ifndef _THESSUBMENU_HXX_
33 #define _THESSUBMENU_HXX_
34 
35 #include <com/sun/star/linguistic2/XThesaurus.hpp>
36 #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
37 
38 #include <vcl/menu.hxx>
39 #include <sfx2/mnuitem.hxx>
40 
41 class SfxBindings;
42 class PopupMenu;
43 class Menu;
44 
45 namespace css = ::com::sun::star;
46 
47 ////////////////////////////////////////////////////////////
48 
49 class SfxThesSubMenuControl : public SfxMenuControl
50 {
51 	PopupMenu*			pMenu;
52 	Menu&				rParent;
53 
54 private:
55 	virtual void    StateChanged( sal_uInt16, SfxItemState, const SfxPoolItem* pState );
56 	DECL_LINK( MenuSelect, Menu * );
57 
58 public:
59     SfxThesSubMenuControl(sal_uInt16, Menu&, SfxBindings&);
60 	~SfxThesSubMenuControl();
61 
62     virtual PopupMenu*  GetPopup() const;
63 
64     SFX_DECL_MENU_CONTROL();
65 };
66 
67 ////////////////////////////////////////////////////////////
68 
69 class SfxThesSubMenuHelper
70 {
71     css::uno::Reference< css::linguistic2::XLinguServiceManager >   m_xLngMgr;
72     css::uno::Reference< css::linguistic2::XThesaurus >             m_xThesarus;
73 
74 private:
75 
76     // don't use copy c-tor and assignment operator
77     SfxThesSubMenuHelper( const SfxThesSubMenuHelper & );
78     SfxThesSubMenuHelper & operator = ( const SfxThesSubMenuHelper & );
79 
80 public:
81     SfxThesSubMenuHelper();
82     ~SfxThesSubMenuHelper();
83 
84     static ::rtl::OUString     GetText( const String &rLookUpString, xub_StrLen nDelimPos );
85 
86     // returns the Locale to be used for the selected text when the thesaurus is to be called
87     static void GetLocale( css::lang::Locale /*out */ &rLocale, const String &rLookUpString, xub_StrLen nDelimPos );
88 
89     // returns true if the locale is upported by the theasaurus
90     bool    IsSupportedLocale( const css::lang::Locale & rLocale ) const;
91 
92     // get the first nMax Synonym entries, even if different meanings need to be evaluated
93     bool    GetMeanings( std::vector< ::rtl::OUString > & rSynonyms, const ::rtl::OUString & rWord, const css::lang::Locale & rLocale, sal_Int16 nMaxSynonms );
94 
95     String  GetThesImplName( const css::lang::Locale &rLocale ) const;
96 };
97 
98 ////////////////////////////////////////////////////////////
99 
100 
101 #endif
102 
103 
104