1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: optdict.hxx,v $
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>
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
{
61 // forward ---------------------------------------------------------------
64 // class SvxNewDictionaryDialog ------------------------------------------
66 class SvxNewDictionaryDialog
: public ModalDialog
71 FixedText aLanguageText
;
72 SvxLanguageBox aLanguageLB
;
74 FixedLine aNewDictBox
;
76 CancelButton aCancelBtn
;
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
* );
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
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
)
115 virtual void KeyInput( const KeyEvent
& rKEvent
);
118 // class SvxEditDictionaryDialog -----------------------------------------
120 class SvxEditDictionaryDialog
: public ModalDialog
127 SvxLanguageBox aLangLB
;
131 FixedText aReplaceFT
;
132 SvxDictEdit aReplaceED
;
133 SvTabListBox aWordsLB
;
134 PushButton aNewReplacePB
;
135 PushButton aDeletePB
;
136 FixedLine aEditDictsBox
;
138 CancelButton aCloseBtn
;
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
;
152 sal_Bool bFirstSelect
;
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
);
177 virtual void Paint( const Rectangle
& rRect
);
180 SvxEditDictionaryDialog( Window
* pParent
,
182 ::com::sun::star::uno::Reference
<
183 ::com::sun::star::linguistic2::XSpellChecker1
> &xSpl
);
184 ~SvxEditDictionaryDialog();
186 sal_uInt16
GetSelectedDict() {return aAllDictsLB
.GetSelectEntryPos();}