bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / inc / optdict.hxx
blob398a1998ac812429686eb2bd73b23a47917936a7
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 INCLUDED_CUI_SOURCE_INC_OPTDICT_HXX
20 #define INCLUDED_CUI_SOURCE_INC_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 <svtools/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 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;
62 DECL_LINK(OKHdl_Impl, void *);
63 DECL_LINK(ModifyHdl_Impl, void *);
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;
72 ::com::sun::star::uno::Reference<
73 ::com::sun::star::linguistic2::XDictionary >
74 GetNewDictionary() { return xNewDic; }
77 // class SvxDictEdit ----------------------------------------------------
79 class SvxDictEdit : public Edit
81 Link<> aActionLink;
82 bool bSpaces;
84 public:
85 SvxDictEdit(vcl::Window* pParent, const ResId& rResId) :
86 Edit(pParent, rResId), bSpaces(false){}
87 SvxDictEdit(vcl::Window* pParent, WinBits aWB) :
88 Edit(pParent, aWB), bSpaces(false){}
90 void SetActionHdl( const Link<>& rLink )
91 { aActionLink = rLink;}
93 void SetSpaces(bool bSet)
94 {bSpaces = bSet;}
96 virtual void KeyInput( const KeyEvent& rKEvent ) SAL_OVERRIDE;
99 // class SvxEditDictionaryDialog -----------------------------------------
101 class SvxEditDictionaryDialog : public ModalDialog
103 private:
105 VclPtr<ListBox> pAllDictsLB;
106 VclPtr<FixedText> pLangFT;
107 VclPtr<SvxLanguageBox> pLangLB;
109 VclPtr<SvxDictEdit> pWordED;
110 VclPtr<FixedText> pReplaceFT;
111 VclPtr<SvxDictEdit> pReplaceED;
112 VclPtr<SvTabListBox> pWordsLB;
113 VclPtr<PushButton> pNewReplacePB;
114 VclPtr<PushButton> pDeletePB;
116 OUString sModify;
117 OUString sNew;
118 DecorationView aDecoView;
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;
126 short nOld;
127 long nWidth;
128 bool bFirstSelect;
129 bool bDoNothing;
130 bool bDicIsReadonly;
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*);
139 void ShowWords_Impl( sal_uInt16 nId );
140 void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage );
141 bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
142 void SetDicReadonly_Impl( ::com::sun::star::uno::Reference<
143 ::com::sun::star::linguistic2::XDictionary > &xDic );
145 void RemoveDictEntry(SvTreeListEntry* pEntry);
146 sal_uLong GetLBInsertPos(const OUString &rDicWord);
148 protected:
150 // virtual void Paint( const Rectangle& rRect );
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;
160 sal_uInt16 GetSelectedDict() {return pAllDictsLB->GetSelectEntryPos();}
163 #endif
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */