Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _SVX_OPTDICT_HXX
20 : #define _SVX_OPTDICT_HXX
21 :
22 : #include <vcl/dialog.hxx>
23 : #include <vcl/fixed.hxx>
24 : #include <vcl/lstbox.hxx>
25 : #include <vcl/button.hxx>
26 : #include <vcl/group.hxx>
27 : #include <vcl/combobox.hxx>
28 : #include <vcl/timer.hxx>
29 : #include <vcl/edit.hxx>
30 : #include <vcl/decoview.hxx>
31 : #include <com/sun/star/util/Language.hpp>
32 : #include <com/sun/star/uno/Reference.hxx>
33 : #include <com/sun/star/uno/Sequence.hxx>
34 :
35 :
36 : #include <svx/simptabl.hxx>
37 : #include <svx/langbox.hxx>
38 :
39 : namespace com{namespace sun{namespace star{
40 : namespace linguistic2{
41 : class XDictionary;
42 : class XSpellChecker1;
43 : }}}}
44 :
45 : // forward ---------------------------------------------------------------
46 :
47 :
48 : // class SvxNewDictionaryDialog ------------------------------------------
49 :
50 0 : class SvxNewDictionaryDialog : public ModalDialog
51 : {
52 : private:
53 : FixedLine aNewDictBox;
54 : FixedText aNameText;
55 : Edit aNameEdit;
56 : FixedText aLanguageText;
57 : SvxLanguageBox aLanguageLB;
58 : CheckBox aExceptBtn;
59 : OKButton aOKBtn;
60 : CancelButton aCancelBtn;
61 : HelpButton aHelpBtn;
62 : ::com::sun::star::uno::Reference<
63 : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
64 : ::com::sun::star::uno::Reference<
65 : ::com::sun::star::linguistic2::XDictionary > xNewDic;
66 :
67 : #ifdef _SVX_OPTDICT_CXX
68 : DECL_LINK(OKHdl_Impl, void *);
69 : DECL_LINK(ModifyHdl_Impl, void *);
70 : #endif
71 :
72 : public:
73 : SvxNewDictionaryDialog( Window* pParent,
74 : ::com::sun::star::uno::Reference<
75 : ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl );
76 :
77 : ::com::sun::star::uno::Reference<
78 : ::com::sun::star::linguistic2::XDictionary >
79 0 : GetNewDictionary() { return xNewDic; }
80 : };
81 :
82 : // class SvxDictEdit ----------------------------------------------------
83 :
84 0 : class SvxDictEdit : public Edit
85 : {
86 : Link aActionLink;
87 : sal_Bool bSpaces;
88 :
89 : public:
90 0 : SvxDictEdit(Window* pParent, const ResId& rResId) :
91 0 : Edit(pParent, rResId), bSpaces(sal_False){}
92 :
93 0 : void SetActionHdl( const Link& rLink )
94 0 : { aActionLink = rLink;}
95 :
96 0 : void SetSpaces(sal_Bool bSet)
97 0 : {bSpaces = bSet;}
98 :
99 : virtual void KeyInput( const KeyEvent& rKEvent );
100 : };
101 :
102 : // class SvxEditDictionaryDialog -----------------------------------------
103 :
104 : class SvxEditDictionaryDialog : public ModalDialog
105 : {
106 : private:
107 :
108 : FixedText aBookFT;
109 : ListBox aAllDictsLB;
110 : FixedText aLangFT;
111 : SvxLanguageBox aLangLB;
112 :
113 : FixedText aWordFT;
114 : SvxDictEdit aWordED;
115 : FixedText aReplaceFT;
116 : SvxDictEdit aReplaceED;
117 : SvTabListBox aWordsLB;
118 : PushButton aNewReplacePB;
119 : PushButton aDeletePB;
120 : FixedLine aEditDictsBox;
121 :
122 : HelpButton aHelpBtn;
123 : CancelButton aCloseBtn;
124 : String sModify;
125 : String sNew;
126 : DecorationView aDecoView;
127 :
128 : ::com::sun::star::uno::Sequence<
129 : ::com::sun::star::uno::Reference<
130 : ::com::sun::star::linguistic2::XDictionary > > aDics; //! snapshot copy to work on
131 : ::com::sun::star::uno::Reference<
132 : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
133 :
134 : short nOld;
135 : long nWidth;
136 : sal_Bool bFirstSelect;
137 : sal_Bool bDoNothing;
138 : sal_Bool bDicIsReadonly;
139 :
140 : #ifdef _SVX_OPTDICT_CXX
141 : DECL_LINK(SelectBookHdl_Impl, void *);
142 : DECL_LINK(SelectLangHdl_Impl, void *);
143 : DECL_LINK(SelectHdl, SvTabListBox*);
144 : DECL_LINK(NewDelHdl, PushButton*);
145 : DECL_LINK(ModifyHdl, Edit*);
146 :
147 :
148 : void ShowWords_Impl( sal_uInt16 nId );
149 : void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
150 0 : sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
151 : void SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
152 : ::com::sun::star::linguistic2::XDictionary > &xDic );
153 :
154 : void RemoveDictEntry(SvTreeListEntry* pEntry);
155 : sal_uInt16 GetLBInsertPos(const String &rDicWord);
156 :
157 : #endif
158 :
159 : protected:
160 :
161 : virtual void Paint( const Rectangle& rRect );
162 :
163 : public:
164 : SvxEditDictionaryDialog( Window* pParent,
165 : const String& rName,
166 : ::com::sun::star::uno::Reference<
167 : ::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
168 : ~SvxEditDictionaryDialog();
169 :
170 : sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();}
171 : };
172 :
173 :
174 : #endif
175 :
176 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|