xref: /AOO41X/main/cui/source/inc/optdict.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_OPTDICT_HXX
28 #define _SVX_OPTDICT_HXX
29 
30 // include ---------------------------------------------------------------
31 
32 #include <vcl/dialog.hxx>
33 #include <vcl/fixed.hxx>
34 #include <vcl/lstbox.hxx>
35 #ifndef _SV_BUTTON_HXX //autogen
36 #include <vcl/button.hxx>
37 #endif
38 #include <vcl/group.hxx>
39 #include <vcl/combobox.hxx>
40 #include <vcl/timer.hxx>
41 #include <vcl/edit.hxx>
42 #include <vcl/decoview.hxx>
43 #include <com/sun/star/util/Language.hpp>
44 #include <com/sun/star/uno/Reference.hxx>
45 #include <com/sun/star/uno/Sequence.hxx>
46 
47 
48 #include <svx/simptabl.hxx>
49 #include <svx/langbox.hxx>
50 
51 namespace com{namespace sun{namespace star{
52 namespace linguistic2{
53 	class XDictionary;
54 	class XSpellChecker1;
55 	class XSpellChecker;
56 }}}}
57 
58 // forward ---------------------------------------------------------------
59 
60 
61 // class SvxNewDictionaryDialog ------------------------------------------
62 
63 class SvxNewDictionaryDialog : public ModalDialog
64 {
65 private:
66 	FixedLine            aNewDictBox;
67 	FixedText			aNameText;
68 	Edit				aNameEdit;
69 	FixedText			aLanguageText;
70 	SvxLanguageBox		aLanguageLB;
71 	CheckBox			aExceptBtn;
72 	OKButton			aOKBtn;
73 	CancelButton		aCancelBtn;
74 	HelpButton			aHelpBtn;
75 	::com::sun::star::uno::Reference<
76 		::com::sun::star::linguistic2::XSpellChecker1 > 	xSpell;
77 	::com::sun::star::uno::Reference<
78         ::com::sun::star::linguistic2::XDictionary >    xNewDic;
79 
80 #ifdef _SVX_OPTDICT_CXX
81 	DECL_LINK( OKHdl_Impl, Button * );
82 	DECL_LINK( ModifyHdl_Impl, Edit * );
83 #endif
84 
85 public:
86 	SvxNewDictionaryDialog( Window* pParent,
87 			::com::sun::star::uno::Reference<
88 				::com::sun::star::linguistic2::XSpellChecker1 >  &xSpl );
89 
90 	::com::sun::star::uno::Reference<
91         ::com::sun::star::linguistic2::XDictionary >
92 				GetNewDictionary() { return xNewDic; }
93 };
94 
95 // class SvxDictEdit ----------------------------------------------------
96 
97 class SvxDictEdit : public Edit
98 {
99 	Link 	aActionLink;
100 	sal_Bool 	bSpaces;
101 
102 	public:
103 					SvxDictEdit(Window* pParent, const ResId& rResId) :
104 						Edit(pParent, rResId), bSpaces(sal_False){}
105 
106 	void 			SetActionHdl( const Link& rLink )
107 								{ aActionLink = rLink;}
108 
109 	void 			SetSpaces(sal_Bool bSet)
110 								{bSpaces = bSet;}
111 
112 	virtual void	KeyInput( const KeyEvent& rKEvent );
113 };
114 
115 // class SvxEditDictionaryDialog -----------------------------------------
116 
117 class SvxEditDictionaryDialog : public ModalDialog
118 {
119 private:
120 
121 	FixedText				aBookFT;
122 	ListBox					aAllDictsLB;
123 	FixedText				aLangFT;
124 	SvxLanguageBox			aLangLB;
125 
126 	FixedText				aWordFT;
127 	SvxDictEdit				aWordED;
128 	FixedText				aReplaceFT;
129 	SvxDictEdit				aReplaceED;
130 	SvTabListBox 			aWordsLB;
131 	PushButton 				aNewReplacePB;
132 	PushButton 				aDeletePB;
133     FixedLine                aEditDictsBox;
134 
135 	HelpButton				aHelpBtn;
136 	CancelButton			aCloseBtn;
137 	String					sModify;
138 	String					sNew;
139 	DecorationView			aDecoView;
140 
141 	::com::sun::star::uno::Sequence<
142 		::com::sun::star::uno::Reference<
143 			::com::sun::star::linguistic2::XDictionary >  >	aDics;	//! snapshot copy to work on
144 	::com::sun::star::uno::Reference<
145 		::com::sun::star::linguistic2::XSpellChecker1 >		xSpell;
146 
147 	short				nOld;
148 	long				nWidth;
149 	sal_Bool			bFirstSelect;
150 	sal_Bool			bDoNothing;
151 	sal_Bool				bDicIsReadonly;
152 
153 #ifdef _SVX_OPTDICT_CXX
154 	DECL_LINK( SelectBookHdl_Impl, ListBox * );
155 	DECL_LINK( SelectLangHdl_Impl, ListBox * );
156 	DECL_LINK(SelectHdl, SvTabListBox*);
157 	DECL_LINK(NewDelHdl, PushButton*);
158 	DECL_LINK(ModifyHdl, Edit*);
159 
160 
161 	void			ShowWords_Impl( sal_uInt16 nId );
162 	void			SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
163 	sal_Bool			IsDicReadonly_Impl() const { return bDicIsReadonly; }
164 	void			SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
165                             ::com::sun::star::linguistic2::XDictionary >  &xDic );
166 
167 	void			RemoveDictEntry(SvLBoxEntry* pEntry);
168 	sal_uInt16			GetLBInsertPos(const String &rDicWord);
169 
170 #endif
171 
172 protected:
173 
174 	virtual void	Paint( const Rectangle& rRect );
175 
176 public:
177 	SvxEditDictionaryDialog( Window* pParent,
178 			const String& rName,
179 			::com::sun::star::uno::Reference<
180 				::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
181 	~SvxEditDictionaryDialog();
182 
183 	sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();}
184 };
185 
186 
187 #endif
188 
189