xref: /AOO41X/main/cui/source/inc/optdict.hxx (revision 277251aa7ecd29029fba9e68f043c890fa833362)
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 
43cdf0e10cSrcweir #include <svx/simptabl.hxx>
44cdf0e10cSrcweir #include <svx/langbox.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir namespace com{namespace sun{namespace star{
47cdf0e10cSrcweir namespace linguistic2{
48cdf0e10cSrcweir     class XDictionary;
49cdf0e10cSrcweir     class XSpellChecker1;
50cdf0e10cSrcweir     class XSpellChecker;
51cdf0e10cSrcweir }}}}
52cdf0e10cSrcweir 
53cdf0e10cSrcweir // forward ---------------------------------------------------------------
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir // class SvxNewDictionaryDialog ------------------------------------------
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class SvxNewDictionaryDialog : public ModalDialog
59cdf0e10cSrcweir {
60cdf0e10cSrcweir private:
61cdf0e10cSrcweir     FixedLine           aNewDictBox;
62cdf0e10cSrcweir     FixedText           aNameText;
63cdf0e10cSrcweir     Edit                aNameEdit;
64cdf0e10cSrcweir     FixedText           aLanguageText;
65cdf0e10cSrcweir     SvxLanguageBox      aLanguageLB;
66cdf0e10cSrcweir     CheckBox            aExceptBtn;
67cdf0e10cSrcweir     OKButton            aOKBtn;
68cdf0e10cSrcweir     CancelButton        aCancelBtn;
69cdf0e10cSrcweir     HelpButton          aHelpBtn;
70cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
71cdf0e10cSrcweir         ::com::sun::star::linguistic2::XSpellChecker1 >     xSpell;
72cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
73cdf0e10cSrcweir         ::com::sun::star::linguistic2::XDictionary >    xNewDic;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir #ifdef _SVX_OPTDICT_CXX
76cdf0e10cSrcweir     DECL_LINK( OKHdl_Impl, Button * );
77cdf0e10cSrcweir     DECL_LINK( ModifyHdl_Impl, Edit * );
78cdf0e10cSrcweir #endif
79cdf0e10cSrcweir 
80cdf0e10cSrcweir public:
81cdf0e10cSrcweir     SvxNewDictionaryDialog( Window* pParent,
82cdf0e10cSrcweir             ::com::sun::star::uno::Reference<
83cdf0e10cSrcweir                 ::com::sun::star::linguistic2::XSpellChecker1 >  &xSpl );
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
86cdf0e10cSrcweir         ::com::sun::star::linguistic2::XDictionary >
GetNewDictionary()87cdf0e10cSrcweir                 GetNewDictionary() { return xNewDic; }
88cdf0e10cSrcweir };
89cdf0e10cSrcweir 
90cdf0e10cSrcweir // class SvxDictEdit ----------------------------------------------------
91cdf0e10cSrcweir 
92cdf0e10cSrcweir class SvxDictEdit : public Edit
93cdf0e10cSrcweir {
94cdf0e10cSrcweir     Link    aActionLink;
95cdf0e10cSrcweir     sal_Bool    bSpaces;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     public:
SvxDictEdit(Window * pParent,const ResId & rResId)98cdf0e10cSrcweir                     SvxDictEdit(Window* pParent, const ResId& rResId) :
99cdf0e10cSrcweir                         Edit(pParent, rResId), bSpaces(sal_False){}
100cdf0e10cSrcweir 
SetActionHdl(const Link & rLink)101cdf0e10cSrcweir     void            SetActionHdl( const Link& rLink )
102cdf0e10cSrcweir                                 { aActionLink = rLink;}
103cdf0e10cSrcweir 
SetSpaces(sal_Bool bSet)104cdf0e10cSrcweir     void            SetSpaces(sal_Bool bSet)
105cdf0e10cSrcweir                                 {bSpaces = bSet;}
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     virtual void    KeyInput( const KeyEvent& rKEvent );
108cdf0e10cSrcweir };
109cdf0e10cSrcweir 
110cdf0e10cSrcweir // class SvxEditDictionaryDialog -----------------------------------------
111cdf0e10cSrcweir 
112cdf0e10cSrcweir class SvxEditDictionaryDialog : public ModalDialog
113cdf0e10cSrcweir {
114cdf0e10cSrcweir private:
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     FixedText               aBookFT;
117cdf0e10cSrcweir     ListBox                 aAllDictsLB;
118cdf0e10cSrcweir     FixedText               aLangFT;
119cdf0e10cSrcweir     SvxLanguageBox          aLangLB;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     FixedText               aWordFT;
122cdf0e10cSrcweir     SvxDictEdit             aWordED;
123cdf0e10cSrcweir     FixedText               aReplaceFT;
124cdf0e10cSrcweir     SvxDictEdit             aReplaceED;
125cdf0e10cSrcweir     SvTabListBox            aWordsLB;
126cdf0e10cSrcweir     PushButton              aNewReplacePB;
127cdf0e10cSrcweir     PushButton              aDeletePB;
128*277251aaSmseidel     GroupBox                aEditDictsBox;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     HelpButton              aHelpBtn;
131cdf0e10cSrcweir     CancelButton            aCloseBtn;
132cdf0e10cSrcweir     String                  sModify;
133cdf0e10cSrcweir     String                  sNew;
134cdf0e10cSrcweir     DecorationView          aDecoView;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     ::com::sun::star::uno::Sequence<
137cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
138cdf0e10cSrcweir             ::com::sun::star::linguistic2::XDictionary >  > aDics;  //! snapshot copy to work on
139cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
140cdf0e10cSrcweir         ::com::sun::star::linguistic2::XSpellChecker1 >     xSpell;
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     short               nOld;
143cdf0e10cSrcweir     long                nWidth;
144cdf0e10cSrcweir     sal_Bool            bFirstSelect;
145cdf0e10cSrcweir     sal_Bool            bDoNothing;
146cdf0e10cSrcweir     sal_Bool                bDicIsReadonly;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir #ifdef _SVX_OPTDICT_CXX
149cdf0e10cSrcweir     DECL_LINK( SelectBookHdl_Impl, ListBox * );
150cdf0e10cSrcweir     DECL_LINK( SelectLangHdl_Impl, ListBox * );
151cdf0e10cSrcweir     DECL_LINK(SelectHdl, SvTabListBox*);
152cdf0e10cSrcweir     DECL_LINK(NewDelHdl, PushButton*);
153cdf0e10cSrcweir     DECL_LINK(ModifyHdl, Edit*);
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     void            ShowWords_Impl( sal_uInt16 nId );
157cdf0e10cSrcweir     void            SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
IsDicReadonly_Impl() const158cdf0e10cSrcweir     sal_Bool            IsDicReadonly_Impl() const { return bDicIsReadonly; }
159cdf0e10cSrcweir     void            SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
160cdf0e10cSrcweir                             ::com::sun::star::linguistic2::XDictionary >  &xDic );
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     void            RemoveDictEntry(SvLBoxEntry* pEntry);
163cdf0e10cSrcweir     sal_uInt16          GetLBInsertPos(const String &rDicWord);
164cdf0e10cSrcweir 
165cdf0e10cSrcweir #endif
166cdf0e10cSrcweir 
167cdf0e10cSrcweir protected:
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     virtual void    Paint( const Rectangle& rRect );
170cdf0e10cSrcweir 
171cdf0e10cSrcweir public:
172cdf0e10cSrcweir     SvxEditDictionaryDialog( Window* pParent,
173cdf0e10cSrcweir             const String& rName,
174cdf0e10cSrcweir             ::com::sun::star::uno::Reference<
175cdf0e10cSrcweir                 ::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
176cdf0e10cSrcweir     ~SvxEditDictionaryDialog();
177cdf0e10cSrcweir 
GetSelectedDict()178cdf0e10cSrcweir     sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();}
179cdf0e10cSrcweir };
180cdf0e10cSrcweir 
181cdf0e10cSrcweir #endif
182