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 : DECL_LINK(OKHdl_Impl, void *);
68 : DECL_LINK(ModifyHdl_Impl, void *);
69 :
70 : public:
71 : SvxNewDictionaryDialog( Window* pParent,
72 : ::com::sun::star::uno::Reference<
73 : ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl );
74 :
75 : ::com::sun::star::uno::Reference<
76 : ::com::sun::star::linguistic2::XDictionary >
77 0 : GetNewDictionary() { return xNewDic; }
78 : };
79 :
80 : // class SvxDictEdit ----------------------------------------------------
81 :
82 0 : class SvxDictEdit : public Edit
83 : {
84 : Link aActionLink;
85 : sal_Bool bSpaces;
86 :
87 : public:
88 0 : SvxDictEdit(Window* pParent, const ResId& rResId) :
89 0 : Edit(pParent, rResId), bSpaces(sal_False){}
90 :
91 0 : void SetActionHdl( const Link& rLink )
92 0 : { aActionLink = rLink;}
93 :
94 0 : void SetSpaces(sal_Bool bSet)
95 0 : {bSpaces = bSet;}
96 :
97 : virtual void KeyInput( const KeyEvent& rKEvent );
98 : };
99 :
100 : // class SvxEditDictionaryDialog -----------------------------------------
101 :
102 : class SvxEditDictionaryDialog : public ModalDialog
103 : {
104 : private:
105 :
106 : FixedText aBookFT;
107 : ListBox aAllDictsLB;
108 : FixedText aLangFT;
109 : SvxLanguageBox aLangLB;
110 :
111 : FixedText aWordFT;
112 : SvxDictEdit aWordED;
113 : FixedText aReplaceFT;
114 : SvxDictEdit aReplaceED;
115 : SvTabListBox aWordsLB;
116 : PushButton aNewReplacePB;
117 : PushButton aDeletePB;
118 : FixedLine aEditDictsBox;
119 :
120 : HelpButton aHelpBtn;
121 : CancelButton aCloseBtn;
122 : String sModify;
123 : String sNew;
124 : DecorationView aDecoView;
125 :
126 : ::com::sun::star::uno::Sequence<
127 : ::com::sun::star::uno::Reference<
128 : ::com::sun::star::linguistic2::XDictionary > > aDics; //! snapshot copy to work on
129 : ::com::sun::star::uno::Reference<
130 : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
131 :
132 : short nOld;
133 : long nWidth;
134 : sal_Bool bFirstSelect;
135 : sal_Bool bDoNothing;
136 : sal_Bool bDicIsReadonly;
137 :
138 : DECL_LINK(SelectBookHdl_Impl, void *);
139 : DECL_LINK(SelectLangHdl_Impl, void *);
140 : DECL_LINK(SelectHdl, SvTabListBox*);
141 : DECL_LINK(NewDelHdl, PushButton*);
142 : DECL_LINK(ModifyHdl, Edit*);
143 :
144 :
145 : void ShowWords_Impl( sal_uInt16 nId );
146 : void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
147 0 : sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
148 : void SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
149 : ::com::sun::star::linguistic2::XDictionary > &xDic );
150 :
151 : void RemoveDictEntry(SvTreeListEntry* pEntry);
152 : sal_uInt16 GetLBInsertPos(const String &rDicWord);
153 :
154 : protected:
155 :
156 : virtual void Paint( const Rectangle& rRect );
157 :
158 : public:
159 : SvxEditDictionaryDialog( Window* pParent,
160 : const String& rName,
161 : ::com::sun::star::uno::Reference<
162 : ::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
163 : ~SvxEditDictionaryDialog();
164 :
165 : sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();}
166 : };
167 :
168 : #endif
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|