1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_CUI_SOURCE_INC_HANGULHANJADLG_HXX
#define INCLUDED_CUI_SOURCE_INC_HANGULHANJADLG_HXX
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/combobox.hxx>
#include <vcl/fixed.hxx>
#include <vcl/scrbar.hxx>
#include <svx/checklbx.hxx>
#include <editeng/hangulhanja.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <editeng/unolingu.hxx>
#include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
#include <svtools/valueset.hxx>
#include <vector>
#include <memory>
namespace svx
{
class SuggestionSet : public ValueSet
{
public:
SuggestionSet( vcl::Window* pParent );
virtual ~SuggestionSet();
virtual void dispose() SAL_OVERRIDE;
virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
void ClearSet();
};
class SuggestionDisplay : public Control
{
public:
SuggestionDisplay( vcl::Window* pParent, WinBits nBits );
virtual ~SuggestionDisplay();
virtual void dispose() SAL_OVERRIDE;
void DisplayListBox( bool bDisplayListBox );
void SetSelectHdl( const Link<>& rLink );
void Clear();
void InsertEntry( const OUString& rStr );
void SelectEntryPos( sal_uInt16 nPos );
sal_uInt16 GetEntryCount() const;
OUString GetEntry( sal_uInt16 nPos ) const;
OUString GetSelectEntry() const;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
virtual void Activate() SAL_OVERRIDE;
virtual void Deactivate() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void LoseFocus() SAL_OVERRIDE;
virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
DECL_LINK( SelectSuggestionHdl, Control* );
void SetHelpIds();
private:
void implUpdateDisplay();
bool hasCurrentControl();
Control& implGetCurrentControl();
private:
bool m_bDisplayListBox;//otherwise ValueSet
VclPtr<SuggestionSet> m_aValueSet;
VclPtr<ListBox> m_aListBox;
Link<> m_aSelectLink;
bool m_bInSelectionUpdate;
};
class RubyRadioButton;
class HangulHanjaConversionDialog : public ModalDialog
{
private:
VclPtr<PushButton> m_pFind;
VclPtr<PushButton> m_pIgnore;
VclPtr<PushButton> m_pIgnoreAll;
VclPtr<PushButton> m_pReplace;
VclPtr<PushButton> m_pReplaceAll;
VclPtr<PushButton> m_pOptions;
VclPtr<SuggestionDisplay> m_pSuggestions;
VclPtr<RadioButton> m_pSimpleConversion;
VclPtr<RadioButton> m_pHangulBracketed;
VclPtr<RadioButton> m_pHanjaBracketed;
VclPtr<Edit> m_pWordInput;
VclPtr<FixedText> m_pOriginalWord;
VclPtr<RubyRadioButton> m_pHanjaAbove;
VclPtr<RubyRadioButton> m_pHanjaBelow;
VclPtr<RubyRadioButton> m_pHangulAbove;
VclPtr<RubyRadioButton> m_pHangulBelow;
VclPtr<CheckBox> m_pHangulOnly;
VclPtr<CheckBox> m_pHanjaOnly;
VclPtr<CheckBox> m_pReplaceByChar;
VclPtr<CheckBox> m_pIgnoreNonPrimary;
/** are we working for a document? This is normally true, but in case
the user uses the "find" functionality, we switch to working
with what the user entered, which then does not have any relation to
the document anymore. Some functionality must be disabled then */
bool m_bDocumentMode;
Link<> m_aOptionsChangedLink;
Link<> m_aClickByCharacterLink;
public:
HangulHanjaConversionDialog(
vcl::Window* _pParent,
editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection );
virtual ~HangulHanjaConversionDialog();
virtual void dispose() SAL_OVERRIDE;
public:
void SetOptionsChangedHdl( const Link<>& _rHdl );
void SetIgnoreHdl( const Link<Button*,void>& _rHdl );
void SetIgnoreAllHdl( const Link<Button*,void>& _rHdl );
void SetChangeHdl( const Link<Button*,void>& _rHdl );
void SetChangeAllHdl( const Link<Button*,void>& _rHdl );
void SetClickByCharacterHdl( const Link<>& _rHdl );
void SetConversionFormatChangedHdl( const Link<Button*,void>& _rHdl );
void SetFindHdl( const Link<Button*,void>& _rHdl );
OUString GetCurrentString( ) const;
void SetCurrentString(
const OUString& _rNewString,
const css::uno::Sequence< OUString >& _rSuggestions,
bool _bOriginatesFromDocument = true
);
void FocusSuggestion( );
/// retrieves the current suggestion
OUString GetCurrentSuggestion( ) const;
void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType );
editeng::HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const;
void SetByCharacter( bool _bByCharacter );
void SetConversionDirectionState( bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection );
/// should text which does not match the primary conversion direction be ignored?
bool GetUseBothDirections( ) const;
/** get current conversion direction to use
(return argument if GetUseBothDirections is true) */
editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection eDefaultDirection ) const;
/// enables or disables the checkboxes for ruby formatted replacements
void EnableRubySupport( bool bVal );
private:
DECL_LINK_TYPED( OnOption, Button*, void );
DECL_LINK( OnSuggestionModified, void* );
DECL_LINK( OnSuggestionSelected, void* );
DECL_LINK_TYPED( OnConversionDirectionClicked, Button*, void );
DECL_LINK_TYPED( ClickByCharacterHdl, Button*, void );
/// fill the suggestion list box with suggestions for the actual input
void FillSuggestions( const css::uno::Sequence< OUString >& _rSuggestions );
};
typedef ::std::vector< css::uno::Reference< css::linguistic2::XConversionDictionary > > HHDictList;
class HangulHanjaOptionsDialog : public ModalDialog
{
private:
VclPtr<SvxCheckListBox> m_pDictsLB;
VclPtr<CheckBox> m_pIgnorepostCB;
VclPtr<CheckBox> m_pShowrecentlyfirstCB;
VclPtr<CheckBox> m_pAutoreplaceuniqueCB;
VclPtr<PushButton> m_pNewPB;
VclPtr<PushButton> m_pEditPB;
VclPtr<PushButton> m_pDeletePB;
VclPtr<OKButton> m_pOkPB;
SvLBoxButtonData* m_pCheckButtonData;
HHDictList m_aDictList;
css::uno::Reference< css::linguistic2::XConversionDictionaryList > m_xConversionDictionaryList;
DECL_LINK_TYPED( OkHdl, Button*, void );
DECL_LINK( DictsLB_SelectHdl, void* );
DECL_LINK_TYPED( NewDictHdl, Button*, void );
DECL_LINK_TYPED( EditDictHdl, Button*, void );
DECL_LINK_TYPED( DeleteDictHdl, Button*, void );
void Init(); ///< reads settings from core and init controls
public:
HangulHanjaOptionsDialog( vcl::Window* _pParent );
virtual ~HangulHanjaOptionsDialog();
virtual void dispose() SAL_OVERRIDE;
void AddDict( const OUString& _rName, bool _bChecked );
};
class HangulHanjaNewDictDialog : public ModalDialog
{
private:
VclPtr<Edit> m_pDictNameED;
VclPtr<OKButton> m_pOkBtn;
bool m_bEntered;
DECL_LINK_TYPED( OKHdl, Button*, void );
DECL_LINK( ModifyHdl, void* );
public:
HangulHanjaNewDictDialog( vcl::Window* _pParent );
virtual ~HangulHanjaNewDictDialog();
virtual void dispose() SAL_OVERRIDE;
bool GetName( OUString& _rRetName ) const;
};
class SuggestionList;
class SuggestionEdit : public Edit
{
private:
VclPtr<SuggestionEdit> m_pPrev;
VclPtr<SuggestionEdit> m_pNext;
VclPtr<ScrollBar> m_pScrollBar;
bool ShouldScroll( bool _bUp ) const;
void DoJump( bool _bUp );
public:
SuggestionEdit( vcl::Window* pParent, WinBits nBits );
virtual ~SuggestionEdit();
virtual void dispose() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
void init( ScrollBar* pScrollBar, SuggestionEdit* pPrev, SuggestionEdit* pNext);
};
class HangulHanjaEditDictDialog : public ModalDialog
{
private:
const OUString m_aEditHintText;
HHDictList& m_rDictList;
sal_uInt32 m_nCurrentDict;
OUString m_aOriginal;
SuggestionList* m_pSuggestions;
VclPtr<ListBox> m_aBookLB;
VclPtr<ComboBox> m_aOriginalLB;
VclPtr<SuggestionEdit> m_aEdit1;
VclPtr<SuggestionEdit> m_aEdit2;
VclPtr<SuggestionEdit> m_aEdit3;
VclPtr<SuggestionEdit> m_aEdit4;
VclPtr<ScrollBar> m_aScrollSB;
VclPtr<PushButton> m_aNewPB;
VclPtr<PushButton> m_aDeletePB;
sal_uInt16 m_nTopPos;
bool m_bModifiedSuggestions;
bool m_bModifiedOriginal;
DECL_LINK( OriginalModifyHdl, void* );
DECL_LINK( ScrollHdl, void* );
DECL_LINK( EditModifyHdl1, Edit* );
DECL_LINK( EditModifyHdl2, Edit* );
DECL_LINK( EditModifyHdl3, Edit* );
DECL_LINK( EditModifyHdl4, Edit* );
DECL_LINK( BookLBSelectHdl, void* );
DECL_LINK_TYPED( NewPBPushHdl, Button*, void );
DECL_LINK_TYPED( DeletePBPushHdl, Button*, void );
void InitEditDictDialog( sal_uInt32 _nSelDict );
void UpdateOriginalLB();
void UpdateSuggestions();
void UpdateButtonStates();
void SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum );
void EditModify( Edit* _pEdit, sal_uInt8 _nEntryOffset );
bool DeleteEntryFromDictionary( const OUString& rEntry, const css::uno::Reference< css::linguistic2::XConversionDictionary >& xDict );
public:
HangulHanjaEditDictDialog( vcl::Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict );
virtual ~HangulHanjaEditDictDialog();
virtual void dispose() SAL_OVERRIDE;
void UpdateScrollbar();
};
}
#endif // SVX_HANGUL_HANJA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|