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