xref: /trunk/main/cui/source/inc/optdict.hxx (revision eb7d016d957f8118e424d3d724adeed5c339145b)
1c4eee24dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c4eee24dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c4eee24dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c4eee24dSAndrew Rist  * distributed with this work for additional information
6c4eee24dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c4eee24dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c4eee24dSAndrew Rist  * "License"); you may not use this file except in compliance
9c4eee24dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11c4eee24dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13c4eee24dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c4eee24dSAndrew Rist  * software distributed under the License is distributed on an
15c4eee24dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c4eee24dSAndrew Rist  * KIND, either express or implied.  See the License for the
17c4eee24dSAndrew Rist  * specific language governing permissions and limitations
18c4eee24dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20c4eee24dSAndrew Rist  *************************************************************/
21c4eee24dSAndrew Rist 
22cdf0e10cSrcweir #ifndef _SVX_OPTDICT_HXX
23cdf0e10cSrcweir #define _SVX_OPTDICT_HXX
24cdf0e10cSrcweir 
25cdf0e10cSrcweir // include ---------------------------------------------------------------
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/dialog.hxx>
28cdf0e10cSrcweir #include <vcl/fixed.hxx>
29cdf0e10cSrcweir #include <vcl/lstbox.hxx>
30cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX //autogen
31cdf0e10cSrcweir #include <vcl/button.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include <vcl/group.hxx>
34cdf0e10cSrcweir #include <vcl/combobox.hxx>
35cdf0e10cSrcweir #include <vcl/timer.hxx>
36cdf0e10cSrcweir #include <vcl/edit.hxx>
37cdf0e10cSrcweir #include <vcl/decoview.hxx>
38cdf0e10cSrcweir #include <com/sun/star/util/Language.hpp>
39cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
40cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <svx/simptabl.hxx>
43cdf0e10cSrcweir #include <svx/langbox.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace com{namespace sun{namespace star{
46cdf0e10cSrcweir namespace linguistic2{
47cdf0e10cSrcweir     class XDictionary;
48cdf0e10cSrcweir     class XSpellChecker1;
49cdf0e10cSrcweir     class XSpellChecker;
50cdf0e10cSrcweir }}}}
51cdf0e10cSrcweir 
52cdf0e10cSrcweir // forward ---------------------------------------------------------------
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 
55cdf0e10cSrcweir // class SvxNewDictionaryDialog ------------------------------------------
56cdf0e10cSrcweir 
57cdf0e10cSrcweir class SvxNewDictionaryDialog : public ModalDialog
58cdf0e10cSrcweir {
59cdf0e10cSrcweir private:
60cdf0e10cSrcweir     FixedLine           aNewDictBox;
61cdf0e10cSrcweir     FixedText           aNameText;
62cdf0e10cSrcweir     Edit                aNameEdit;
63cdf0e10cSrcweir     FixedText           aLanguageText;
64cdf0e10cSrcweir     SvxLanguageBox      aLanguageLB;
65cdf0e10cSrcweir     CheckBox            aExceptBtn;
66cdf0e10cSrcweir     OKButton            aOKBtn;
67cdf0e10cSrcweir     CancelButton        aCancelBtn;
68cdf0e10cSrcweir     HelpButton          aHelpBtn;
69cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
70cdf0e10cSrcweir         ::com::sun::star::linguistic2::XSpellChecker1 >     xSpell;
71cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
72cdf0e10cSrcweir         ::com::sun::star::linguistic2::XDictionary >    xNewDic;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir #ifdef _SVX_OPTDICT_CXX
75cdf0e10cSrcweir     DECL_LINK( OKHdl_Impl, Button * );
76cdf0e10cSrcweir     DECL_LINK( ModifyHdl_Impl, Edit * );
77cdf0e10cSrcweir #endif
78cdf0e10cSrcweir 
79cdf0e10cSrcweir public:
80cdf0e10cSrcweir     SvxNewDictionaryDialog( Window* pParent,
81cdf0e10cSrcweir             ::com::sun::star::uno::Reference<
82cdf0e10cSrcweir                 ::com::sun::star::linguistic2::XSpellChecker1 >  &xSpl );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
85cdf0e10cSrcweir         ::com::sun::star::linguistic2::XDictionary >
GetNewDictionary()86cdf0e10cSrcweir                 GetNewDictionary() { return xNewDic; }
87cdf0e10cSrcweir };
88cdf0e10cSrcweir 
89cdf0e10cSrcweir // class SvxDictEdit ----------------------------------------------------
90cdf0e10cSrcweir 
91cdf0e10cSrcweir class SvxDictEdit : public Edit
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     Link    aActionLink;
94cdf0e10cSrcweir     sal_Bool    bSpaces;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     public:
SvxDictEdit(Window * pParent,const ResId & rResId)97cdf0e10cSrcweir                     SvxDictEdit(Window* pParent, const ResId& rResId) :
98cdf0e10cSrcweir                         Edit(pParent, rResId), bSpaces(sal_False){}
99cdf0e10cSrcweir 
SetActionHdl(const Link & rLink)100cdf0e10cSrcweir     void            SetActionHdl( const Link& rLink )
101cdf0e10cSrcweir                                 { aActionLink = rLink;}
102cdf0e10cSrcweir 
SetSpaces(sal_Bool bSet)103cdf0e10cSrcweir     void            SetSpaces(sal_Bool bSet)
104cdf0e10cSrcweir                                 {bSpaces = bSet;}
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     virtual void    KeyInput( const KeyEvent& rKEvent );
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir // class SvxEditDictionaryDialog -----------------------------------------
110cdf0e10cSrcweir 
111cdf0e10cSrcweir class SvxEditDictionaryDialog : public ModalDialog
112cdf0e10cSrcweir {
113cdf0e10cSrcweir private:
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     FixedText               aBookFT;
116cdf0e10cSrcweir     ListBox                 aAllDictsLB;
117cdf0e10cSrcweir     FixedText               aLangFT;
118cdf0e10cSrcweir     SvxLanguageBox          aLangLB;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     FixedText               aWordFT;
121cdf0e10cSrcweir     SvxDictEdit             aWordED;
122cdf0e10cSrcweir     FixedText               aReplaceFT;
123cdf0e10cSrcweir     SvxDictEdit             aReplaceED;
124cdf0e10cSrcweir     SvTabListBox            aWordsLB;
125cdf0e10cSrcweir     PushButton              aNewReplacePB;
126cdf0e10cSrcweir     PushButton              aDeletePB;
127*eb7d016dSmseidel     GroupBox                aEditDictsBox;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     HelpButton              aHelpBtn;
130cdf0e10cSrcweir     CancelButton            aCloseBtn;
131cdf0e10cSrcweir     String                  sModify;
132cdf0e10cSrcweir     String                  sNew;
133cdf0e10cSrcweir     DecorationView          aDecoView;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     ::com::sun::star::uno::Sequence<
136cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
137cdf0e10cSrcweir             ::com::sun::star::linguistic2::XDictionary >  > aDics; //! snapshot copy to work on
138cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
139cdf0e10cSrcweir         ::com::sun::star::linguistic2::XSpellChecker1 >     xSpell;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     short               nOld;
142cdf0e10cSrcweir     long                nWidth;
143cdf0e10cSrcweir     sal_Bool            bFirstSelect;
144cdf0e10cSrcweir     sal_Bool            bDoNothing;
145cdf0e10cSrcweir     sal_Bool                bDicIsReadonly;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir #ifdef _SVX_OPTDICT_CXX
148cdf0e10cSrcweir     DECL_LINK( SelectBookHdl_Impl, ListBox * );
149cdf0e10cSrcweir     DECL_LINK( SelectLangHdl_Impl, ListBox * );
150cdf0e10cSrcweir     DECL_LINK(SelectHdl, SvTabListBox*);
151cdf0e10cSrcweir     DECL_LINK(NewDelHdl, PushButton*);
152cdf0e10cSrcweir     DECL_LINK(ModifyHdl, Edit*);
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     void            ShowWords_Impl( sal_uInt16 nId );
156cdf0e10cSrcweir     void            SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
IsDicReadonly_Impl() const157cdf0e10cSrcweir     sal_Bool            IsDicReadonly_Impl() const { return bDicIsReadonly; }
158cdf0e10cSrcweir     void            SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
159cdf0e10cSrcweir                             ::com::sun::star::linguistic2::XDictionary >  &xDic );
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     void            RemoveDictEntry(SvLBoxEntry* pEntry);
162cdf0e10cSrcweir     sal_uInt16          GetLBInsertPos(const String &rDicWord);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir #endif
165cdf0e10cSrcweir 
166cdf0e10cSrcweir protected:
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
169cdf0e10cSrcweir 
170cdf0e10cSrcweir public:
171cdf0e10cSrcweir     SvxEditDictionaryDialog( Window* pParent,
172cdf0e10cSrcweir             const String& rName,
173cdf0e10cSrcweir             ::com::sun::star::uno::Reference<
174cdf0e10cSrcweir                 ::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
175cdf0e10cSrcweir     ~SvxEditDictionaryDialog();
176cdf0e10cSrcweir 
GetSelectedDict()177cdf0e10cSrcweir     sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();}
178cdf0e10cSrcweir };
179cdf0e10cSrcweir 
180cdf0e10cSrcweir #endif
181*eb7d016dSmseidel 
182*eb7d016dSmseidel /* vim: set noet sw=4 ts=4: */
183