Update ooo320-m1
[ooovba.git] / svx / source / cui / optdict.hxx
blob3846a7cf2429cf377fe39ee7dc3fe57bae7dde16
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: optdict.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
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.
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).
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.
29 ************************************************************************/
30 #ifndef _SVX_OPTDICT_HXX
31 #define _SVX_OPTDICT_HXX
33 // include ---------------------------------------------------------------
35 #include <vcl/dialog.hxx>
36 #include <vcl/fixed.hxx>
37 #include <vcl/lstbox.hxx>
38 #ifndef _SV_BUTTON_HXX //autogen
39 #include <vcl/button.hxx>
40 #endif
41 #include <vcl/group.hxx>
42 #include <vcl/combobox.hxx>
43 #include <vcl/timer.hxx>
44 #include <vcl/edit.hxx>
45 #include <vcl/decoview.hxx>
46 #include <com/sun/star/util/Language.hpp>
47 #include <com/sun/star/uno/Reference.hxx>
48 #include <com/sun/star/uno/Sequence.hxx>
51 #include <svx/simptabl.hxx>
52 #include <svx/langbox.hxx>
54 namespace com{namespace sun{namespace star{
55 namespace linguistic2{
56 class XDictionary;
57 class XSpellChecker1;
58 class XSpellChecker;
59 }}}}
61 // forward ---------------------------------------------------------------
64 // class SvxNewDictionaryDialog ------------------------------------------
66 class SvxNewDictionaryDialog : public ModalDialog
68 private:
69 FixedText aNameText;
70 Edit aNameEdit;
71 FixedText aLanguageText;
72 SvxLanguageBox aLanguageLB;
73 CheckBox aExceptBtn;
74 FixedLine aNewDictBox;
75 OKButton aOKBtn;
76 CancelButton aCancelBtn;
77 HelpButton aHelpBtn;
78 ::com::sun::star::uno::Reference<
79 ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
80 ::com::sun::star::uno::Reference<
81 ::com::sun::star::linguistic2::XDictionary > xNewDic;
83 #ifdef _SVX_OPTDICT_CXX
84 DECL_LINK( OKHdl_Impl, Button * );
85 DECL_LINK( ModifyHdl_Impl, Edit * );
86 #endif
88 public:
89 SvxNewDictionaryDialog( Window* pParent,
90 ::com::sun::star::uno::Reference<
91 ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl );
93 ::com::sun::star::uno::Reference<
94 ::com::sun::star::linguistic2::XDictionary >
95 GetNewDictionary() { return xNewDic; }
98 // class SvxDictEdit ----------------------------------------------------
100 class SvxDictEdit : public Edit
102 Link aActionLink;
103 sal_Bool bSpaces;
105 public:
106 SvxDictEdit(Window* pParent, const ResId& rResId) :
107 Edit(pParent, rResId), bSpaces(sal_False){}
109 void SetActionHdl( const Link& rLink )
110 { aActionLink = rLink;}
112 void SetSpaces(sal_Bool bSet)
113 {bSpaces = bSet;}
115 virtual void KeyInput( const KeyEvent& rKEvent );
118 // class SvxEditDictionaryDialog -----------------------------------------
120 class SvxEditDictionaryDialog : public ModalDialog
122 private:
124 FixedText aBookFT;
125 ListBox aAllDictsLB;
126 FixedText aLangFT;
127 SvxLanguageBox aLangLB;
129 FixedText aWordFT;
130 SvxDictEdit aWordED;
131 FixedText aReplaceFT;
132 SvxDictEdit aReplaceED;
133 SvTabListBox aWordsLB;
134 PushButton aNewReplacePB;
135 PushButton aDeletePB;
136 FixedLine aEditDictsBox;
138 CancelButton aCloseBtn;
139 HelpButton aHelpBtn;
140 String sModify;
141 String sNew;
142 DecorationView aDecoView;
144 ::com::sun::star::uno::Sequence<
145 ::com::sun::star::uno::Reference<
146 ::com::sun::star::linguistic2::XDictionary > > aDics; //! snapshot copy to work on
147 ::com::sun::star::uno::Reference<
148 ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
150 short nOld;
151 long nWidth;
152 sal_Bool bFirstSelect;
153 sal_Bool bDoNothing;
154 BOOL bDicIsReadonly;
156 #ifdef _SVX_OPTDICT_CXX
157 DECL_LINK( SelectBookHdl_Impl, ListBox * );
158 DECL_LINK( SelectLangHdl_Impl, ListBox * );
159 DECL_LINK(SelectHdl, SvTabListBox*);
160 DECL_LINK(NewDelHdl, PushButton*);
161 DECL_LINK(ModifyHdl, Edit*);
164 void ShowWords_Impl( sal_uInt16 nId );
165 void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
166 sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
167 void SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
168 ::com::sun::star::linguistic2::XDictionary > &xDic );
170 void RemoveDictEntry(SvLBoxEntry* pEntry);
171 USHORT GetLBInsertPos(const String &rDicWord);
173 #endif
175 protected:
177 virtual void Paint( const Rectangle& rRect );
179 public:
180 SvxEditDictionaryDialog( Window* pParent,
181 const String& rName,
182 ::com::sun::star::uno::Reference<
183 ::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
184 ~SvxEditDictionaryDialog();
186 sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();}
190 #endif