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 INCLUDED_CUI_SOURCE_INC_OPTDICT_HXX
20 : #define INCLUDED_CUI_SOURCE_INC_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 <svtools/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 : Edit* pNameEdit;
54 : SvxLanguageBox* pLanguageLB;
55 : CheckBox* pExceptBtn;
56 : OKButton* pOKBtn;
57 : ::com::sun::star::uno::Reference<
58 : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
59 : ::com::sun::star::uno::Reference<
60 : ::com::sun::star::linguistic2::XDictionary > xNewDic;
61 :
62 : DECL_LINK(OKHdl_Impl, void *);
63 : DECL_LINK(ModifyHdl_Impl, void *);
64 :
65 : public:
66 : SvxNewDictionaryDialog( vcl::Window* pParent,
67 : ::com::sun::star::uno::Reference<
68 : ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl );
69 :
70 : ::com::sun::star::uno::Reference<
71 : ::com::sun::star::linguistic2::XDictionary >
72 0 : GetNewDictionary() { return xNewDic; }
73 : };
74 :
75 : // class SvxDictEdit ----------------------------------------------------
76 :
77 0 : class SvxDictEdit : public Edit
78 : {
79 : Link aActionLink;
80 : bool bSpaces;
81 :
82 : public:
83 : SvxDictEdit(vcl::Window* pParent, const ResId& rResId) :
84 : Edit(pParent, rResId), bSpaces(false){}
85 0 : SvxDictEdit(vcl::Window* pParent, WinBits aWB) :
86 0 : Edit(pParent, aWB), bSpaces(false){}
87 :
88 0 : void SetActionHdl( const Link& rLink )
89 0 : { aActionLink = rLink;}
90 :
91 0 : void SetSpaces(bool bSet)
92 0 : {bSpaces = bSet;}
93 :
94 : virtual void KeyInput( const KeyEvent& rKEvent ) SAL_OVERRIDE;
95 : };
96 :
97 : // class SvxEditDictionaryDialog -----------------------------------------
98 :
99 : class SvxEditDictionaryDialog : public ModalDialog
100 : {
101 : private:
102 :
103 : ListBox* pAllDictsLB;
104 : FixedText* pLangFT;
105 : SvxLanguageBox* pLangLB;
106 :
107 : SvxDictEdit* pWordED;
108 : FixedText* pReplaceFT;
109 : SvxDictEdit* pReplaceED;
110 : SvTabListBox* pWordsLB;
111 : PushButton* pNewReplacePB;
112 : PushButton* pDeletePB;
113 :
114 : OUString sModify;
115 : OUString sNew;
116 : DecorationView aDecoView;
117 :
118 : ::com::sun::star::uno::Sequence<
119 : ::com::sun::star::uno::Reference<
120 : ::com::sun::star::linguistic2::XDictionary > > aDics; //! snapshot copy to work on
121 : ::com::sun::star::uno::Reference<
122 : ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
123 :
124 : short nOld;
125 : long nWidth;
126 : bool bFirstSelect;
127 : bool bDoNothing;
128 : bool bDicIsReadonly;
129 :
130 : DECL_LINK(SelectBookHdl_Impl, void *);
131 : DECL_LINK(SelectLangHdl_Impl, void *);
132 : DECL_LINK(SelectHdl, SvTabListBox*);
133 : DECL_LINK(NewDelHdl, PushButton*);
134 : DECL_LINK(ModifyHdl, Edit*);
135 :
136 :
137 : void ShowWords_Impl( sal_uInt16 nId );
138 : void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
139 0 : bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
140 : void SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
141 : ::com::sun::star::linguistic2::XDictionary > &xDic );
142 :
143 : void RemoveDictEntry(SvTreeListEntry* pEntry);
144 : sal_uLong GetLBInsertPos(const OUString &rDicWord);
145 :
146 : protected:
147 :
148 : // virtual void Paint( const Rectangle& rRect );
149 :
150 : public:
151 : SvxEditDictionaryDialog( vcl::Window* pParent,
152 : const OUString& rName,
153 : ::com::sun::star::uno::Reference<
154 : ::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
155 : virtual ~SvxEditDictionaryDialog();
156 :
157 : sal_uInt16 GetSelectedDict() {return pAllDictsLB->GetSelectEntryPos();}
158 : };
159 :
160 : #endif
161 :
162 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|