Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / cui / source / inc / optdict.hxx
bloba8507a6cc2c944833a6a7428204bf64f7111caab
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _SVX_OPTDICT_HXX
20 #define _SVX_OPTDICT_HXX
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>
36 #include <svx/simptabl.hxx>
37 #include <svx/langbox.hxx>
39 namespace com{namespace sun{namespace star{
40 namespace linguistic2{
41 class XDictionary;
42 class XSpellChecker1;
43 }}}}
45 // forward ---------------------------------------------------------------
48 // class SvxNewDictionaryDialog ------------------------------------------
50 class SvxNewDictionaryDialog : public ModalDialog
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;
67 #ifdef _SVX_OPTDICT_CXX
68 DECL_LINK(OKHdl_Impl, void *);
69 DECL_LINK(ModifyHdl_Impl, void *);
70 #endif
72 public:
73 SvxNewDictionaryDialog( Window* pParent,
74 ::com::sun::star::uno::Reference<
75 ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl );
77 ::com::sun::star::uno::Reference<
78 ::com::sun::star::linguistic2::XDictionary >
79 GetNewDictionary() { return xNewDic; }
82 // class SvxDictEdit ----------------------------------------------------
84 class SvxDictEdit : public Edit
86 Link aActionLink;
87 sal_Bool bSpaces;
89 public:
90 SvxDictEdit(Window* pParent, const ResId& rResId) :
91 Edit(pParent, rResId), bSpaces(sal_False){}
93 void SetActionHdl( const Link& rLink )
94 { aActionLink = rLink;}
96 void SetSpaces(sal_Bool bSet)
97 {bSpaces = bSet;}
99 virtual void KeyInput( const KeyEvent& rKEvent );
102 // class SvxEditDictionaryDialog -----------------------------------------
104 class SvxEditDictionaryDialog : public ModalDialog
106 private:
108 FixedText aBookFT;
109 ListBox aAllDictsLB;
110 FixedText aLangFT;
111 SvxLanguageBox aLangLB;
113 FixedText aWordFT;
114 SvxDictEdit aWordED;
115 FixedText aReplaceFT;
116 SvxDictEdit aReplaceED;
117 SvTabListBox aWordsLB;
118 PushButton aNewReplacePB;
119 PushButton aDeletePB;
120 FixedLine aEditDictsBox;
122 HelpButton aHelpBtn;
123 CancelButton aCloseBtn;
124 String sModify;
125 String sNew;
126 DecorationView aDecoView;
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;
134 short nOld;
135 long nWidth;
136 sal_Bool bFirstSelect;
137 sal_Bool bDoNothing;
138 sal_Bool bDicIsReadonly;
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*);
148 void ShowWords_Impl( sal_uInt16 nId );
149 void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
150 sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
151 void SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
152 ::com::sun::star::linguistic2::XDictionary > &xDic );
154 void RemoveDictEntry(SvTreeListEntry* pEntry);
155 sal_uInt16 GetLBInsertPos(const String &rDicWord);
157 #endif
159 protected:
161 virtual void Paint( const Rectangle& rRect );
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();
170 sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();}
174 #endif
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */