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