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 _OFA_AUTOCDLG_HXX
20 : #define _OFA_AUTOCDLG_HXX
21 :
22 : #include <svtools/langtab.hxx>
23 : #include <sfx2/tabdlg.hxx>
24 : #include <svx/checklbx.hxx>
25 : #include <vcl/fixed.hxx>
26 : #include <vcl/field.hxx>
27 : #include <vcl/metric.hxx>
28 : #include <svx/langbox.hxx>
29 : #include "svtools/treelistentry.hxx"
30 :
31 : #include <vcl/group.hxx>
32 : #include <vcl/button.hxx>
33 : #include <vcl/lstbox.hxx>
34 : #include <svtools/svtabbx.hxx>
35 : #include <svx/simptabl.hxx>
36 :
37 : class CharClass;
38 : class CollatorWrapper;
39 : class SmartTagMgr;
40 :
41 : namespace editeng { class SortedAutoCompleteStrings; }
42 :
43 : // class OfaAutoCorrDlg --------------------------------------------------
44 :
45 0 : class OfaAutoCorrDlg : public SfxTabDialog
46 : {
47 : VclContainer* m_pLanguageBox;
48 : SvxLanguageBox* m_pLanguageLB;
49 :
50 : sal_uInt16 m_nReplacePageId;
51 : sal_uInt16 m_nExceptionsPageId;
52 :
53 : DECL_LINK(SelectLanguageHdl, ListBox*);
54 : public:
55 :
56 : OfaAutoCorrDlg(Window* pParent, const SfxItemSet *pSet);
57 :
58 : void EnableLanguage(bool bEnable);
59 : };
60 :
61 : // class OfaACorrCheckListBox ------------------------------------------
62 :
63 0 : class OfaACorrCheckListBox : public SvxSimpleTable
64 : {
65 : using SvxSimpleTable::SetTabs;
66 : using SvTreeListBox::GetCheckButtonState;
67 : using SvTreeListBox::SetCheckButtonState;
68 :
69 : protected:
70 : virtual void SetTabs();
71 : virtual void HBarClick();
72 : virtual void KeyInput( const KeyEvent& rKEvt );
73 :
74 : public:
75 0 : OfaACorrCheckListBox(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER)
76 0 : : SvxSimpleTable(rParent, nBits)
77 : {
78 0 : }
79 :
80 0 : inline void *GetUserData(sal_uLong nPos) { return GetEntry(nPos)->GetUserData(); }
81 0 : inline void SetUserData(sal_uLong nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); }
82 0 : inline sal_uLong GetSelectEntryPos() { return GetModel()->GetAbsPos(FirstSelected()); }
83 :
84 : sal_Bool IsChecked(sal_uLong nPos, sal_uInt16 nCol = 0);
85 : void CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked);
86 : SvButtonState GetCheckButtonState( SvTreeListEntry*, sal_uInt16 nCol ) const;
87 : void SetCheckButtonState( SvTreeListEntry*, sal_uInt16 nCol, SvButtonState );
88 : };
89 :
90 : // class OfaAutocorrOptionsPage ------------------------------------------
91 :
92 :
93 : class OfaAutocorrOptionsPage : public SfxTabPage
94 : {
95 : using TabPage::ActivatePage;
96 :
97 : private:
98 : SvxCheckListBox aCheckLB;
99 :
100 : String sInput;
101 : String sDoubleCaps;
102 : String sStartCap;
103 : String sBoldUnderline;
104 : String sURL;
105 : String sNoDblSpaces;
106 : String sDash;
107 : String sNonBrkSpace;
108 : String sFirst;
109 : String sAccidentalCaps;
110 :
111 : public:
112 : OfaAutocorrOptionsPage( Window* pParent, const SfxItemSet& rSet );
113 : ~OfaAutocorrOptionsPage();
114 :
115 : static SfxTabPage* Create( Window* pParent,
116 : const SfxItemSet& rAttrSet);
117 :
118 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
119 : virtual void Reset( const SfxItemSet& rSet );
120 : virtual void ActivatePage( const SfxItemSet& );
121 :
122 : };
123 :
124 : // class OfaSwAutoFmtOptionsPage ----------------------------------------------------
125 :
126 : class OfaSwAutoFmtOptionsPage : public SfxTabPage
127 : {
128 : using TabPage::ActivatePage;
129 :
130 : SvxSimpleTableContainer m_aCheckLBContainer;
131 : OfaACorrCheckListBox aCheckLB;
132 : PushButton aEditPB;
133 : FixedText aHeader1Expl;
134 : FixedText aHeader2Expl;
135 :
136 : String sHeader1;
137 : String sHeader2;
138 :
139 : String sDeleteEmptyPara;
140 : String sUseReplaceTbl;
141 : String sCptlSttWord;
142 : String sCptlSttSent;
143 : String sUserStyle;
144 : String sBullet;
145 : String sByInputBullet;
146 : String sBoldUnder;
147 : String sNoDblSpaces;
148 : String sCorrectCapsLock;
149 : String sDetectURL;
150 : String sDash;
151 : String sNonBrkSpace;
152 : String sOrdinal;
153 : String sRightMargin;
154 : String sNum;
155 : String sBorder;
156 : String sTable;
157 : String sReplaceTemplates;
158 : String sDelSpaceAtSttEnd;
159 : String sDelSpaceBetweenLines;
160 :
161 : String sMargin;
162 : String sBulletChar;
163 : String sByInputBulletChar;
164 :
165 : Font aBulletFont;
166 : Font aByInputBulletFont;
167 : sal_uInt16 nPercent;
168 :
169 : SvLBoxButtonData* pCheckButtonData;
170 :
171 : DECL_LINK(SelectHdl, OfaACorrCheckListBox*);
172 : DECL_LINK(EditHdl, void *);
173 : SvTreeListEntry* CreateEntry(String& rTxt, sal_uInt16 nCol);
174 :
175 :
176 : OfaSwAutoFmtOptionsPage( Window* pParent,
177 : const SfxItemSet& rSet );
178 : ~OfaSwAutoFmtOptionsPage();
179 :
180 : public:
181 : static SfxTabPage* Create( Window* pParent,
182 : const SfxItemSet& rAttrSet);
183 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
184 : virtual void Reset( const SfxItemSet& rSet );
185 : virtual void ActivatePage( const SfxItemSet& );
186 : };
187 :
188 : // class AutoCorrEdit ----------------------------------------------------
189 :
190 0 : class AutoCorrEdit : public Edit
191 : {
192 : Link aActionLink;
193 : sal_Bool bSpaces;
194 :
195 : public:
196 : AutoCorrEdit(Window* pParent, const ResId& rResId) :
197 : Edit(pParent, rResId), bSpaces(sal_False){}
198 0 : AutoCorrEdit(Window* pParent) :
199 0 : Edit(pParent), bSpaces(sal_False){}
200 :
201 0 : void SetActionHdl( const Link& rLink )
202 0 : { aActionLink = rLink;}
203 :
204 0 : void SetSpaces(sal_Bool bSet)
205 0 : {bSpaces = bSet;}
206 :
207 : virtual void KeyInput( const KeyEvent& rKEvent );
208 : };
209 :
210 : // class OfaAutocorrReplacePage ------------------------------------------
211 :
212 :
213 0 : struct DoubleString
214 : {
215 : String sShort;
216 : String sLong;
217 : void* pUserData; ///< CheckBox -> form. Text Bool -> selection text
218 : };
219 :
220 : typedef std::vector<DoubleString> DoubleStringArray;
221 : typedef std::map<LanguageType, DoubleStringArray> DoubleStringTable;
222 :
223 0 : struct StringChangeList
224 : {
225 : DoubleStringArray aNewEntries;
226 : DoubleStringArray aDeletedEntries;
227 : };
228 :
229 : typedef std::map<LanguageType, StringChangeList> StringChangeTable;
230 :
231 : class OfaAutocorrReplacePage : public SfxTabPage
232 : {
233 : using TabPage::ActivatePage;
234 : using TabPage::DeactivatePage;
235 :
236 : private:
237 :
238 : StringChangeTable aChangesTable;
239 :
240 : CheckBox* m_pTextOnlyCB;
241 : AutoCorrEdit* m_pShortED;
242 : AutoCorrEdit* m_pReplaceED;
243 : SvTabListBox* m_pReplaceTLB;
244 : PushButton* m_pNewReplacePB;
245 : PushButton* m_pDeleteReplacePB;
246 :
247 : OUString sModify;
248 : OUString sNew;
249 :
250 : std::set<OUString> aFormatText;
251 : DoubleStringTable aDoubleStringTable;
252 : CollatorWrapper* pCompareClass;
253 : CharClass* pCharClass;
254 : LanguageType eLang;
255 :
256 : sal_Bool bHasSelectionText;
257 : sal_Bool bFirstSelect:1;
258 : sal_Bool bReplaceEditChanged:1;
259 : sal_Bool bSWriter:1;
260 :
261 : DECL_LINK(SelectHdl, SvTabListBox*);
262 : DECL_LINK(NewDelHdl, PushButton*);
263 : DECL_LINK(ModifyHdl, Edit*);
264 :
265 : void RefillReplaceBox( sal_Bool bFromReset,
266 : LanguageType eOldLanguage,
267 : LanguageType eNewLanguage);
268 :
269 : public:
270 : OfaAutocorrReplacePage( Window* pParent, const SfxItemSet& rSet );
271 : ~OfaAutocorrReplacePage();
272 :
273 : static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
274 :
275 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
276 : virtual void Reset( const SfxItemSet& rSet );
277 : virtual void ActivatePage( const SfxItemSet& );
278 : virtual int DeactivatePage( SfxItemSet* pSet = 0 );
279 : virtual void Resize();
280 :
281 : void SetLanguage(LanguageType eSet);
282 : void DeleteEntry(String sShort, String sLong);
283 : void NewEntry(String sShort, String sLong);
284 : };
285 :
286 : // class OfaAutocorrExceptPage ---------------------------------------------
287 :
288 0 : struct StringsArrays
289 : {
290 : std::vector<OUString> aAbbrevStrings;
291 : std::vector<OUString> aDoubleCapsStrings;
292 :
293 0 : StringsArrays() { }
294 : };
295 : typedef std::map<LanguageType, StringsArrays> StringsTable;
296 :
297 : class OfaAutocorrExceptPage : public SfxTabPage
298 : {
299 : using TabPage::ActivatePage;
300 : using TabPage::DeactivatePage;
301 :
302 : private:
303 : AutoCorrEdit* m_pAbbrevED;
304 : ListBox* m_pAbbrevLB;
305 : PushButton* m_pNewAbbrevPB;
306 : PushButton* m_pDelAbbrevPB;
307 : CheckBox* m_pAutoAbbrevCB;
308 :
309 : AutoCorrEdit* m_pDoubleCapsED;
310 : ListBox* m_pDoubleCapsLB;
311 : PushButton* m_pNewDoublePB;
312 : PushButton* m_pDelDoublePB;
313 : CheckBox* m_pAutoCapsCB;
314 :
315 : StringsTable aStringsTable;
316 : CollatorWrapper* pCompareClass;
317 : LanguageType eLang;
318 :
319 : DECL_LINK(NewDelHdl, PushButton*);
320 : DECL_LINK(SelectHdl, ListBox*);
321 : DECL_LINK(ModifyHdl, Edit*);
322 : /// Box filled with new language
323 : void RefillReplaceBoxes(sal_Bool bFromReset,
324 : LanguageType eOldLanguage,
325 : LanguageType eNewLanguage);
326 : public:
327 : OfaAutocorrExceptPage( Window* pParent, const SfxItemSet& rSet );
328 : ~OfaAutocorrExceptPage();
329 :
330 : static SfxTabPage* Create( Window* pParent,
331 : const SfxItemSet& rAttrSet);
332 :
333 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
334 : virtual void Reset( const SfxItemSet& rSet );
335 : virtual void ActivatePage( const SfxItemSet& );
336 : virtual int DeactivatePage( SfxItemSet* pSet = 0 );
337 : void SetLanguage(LanguageType eSet);
338 :
339 : };
340 :
341 : // class OfaQuoteTabPage -------------------------------------------------
342 :
343 : class OfaQuoteTabPage : public SfxTabPage
344 : {
345 : using TabPage::ActivatePage;
346 :
347 : private:
348 : /// For anything but writer
349 : SvxCheckListBox aCheckLB;
350 :
351 : /// Just for writer
352 : SvxSimpleTableContainer m_aSwCheckLBContainer;
353 : OfaACorrCheckListBox aSwCheckLB;
354 : String sHeader1;
355 : String sHeader2;
356 :
357 : String sNonBrkSpace;
358 : String sOrdinal;
359 :
360 : SvLBoxButtonData* pCheckButtonData;
361 :
362 : FixedLine aSingleFL;
363 : CheckBox aSingleTypoCB;
364 : FixedText aSglStartQuoteFT;
365 : PushButton aSglStartQuotePB;
366 : FixedText aSglStartExFT;
367 : FixedText aSglEndQuoteFT;
368 : PushButton aSglEndQuotePB;
369 : FixedText aSglEndExFT;
370 : PushButton aSglStandardPB;
371 :
372 : FixedLine aDoubleFL;
373 : CheckBox aTypoCB;
374 : FixedText aStartQuoteFT;
375 : PushButton aStartQuotePB;
376 : FixedText aDblStartExFT;
377 : FixedText aEndQuoteFT;
378 : PushButton aEndQuotePB;
379 : FixedText aDblEndExFT;
380 : PushButton aDblStandardPB;
381 :
382 : String sStartQuoteDlg;
383 : String sEndQuoteDlg;
384 :
385 : String sStandard;
386 :
387 :
388 : sal_UCS4 cSglStartQuote;
389 : sal_UCS4 cSglEndQuote;
390 :
391 : sal_UCS4 cStartQuote;
392 : sal_UCS4 cEndQuote;
393 :
394 : DECL_LINK( QuoteHdl, PushButton* );
395 : DECL_LINK( StdQuoteHdl, PushButton* );
396 :
397 : String ChangeStringExt_Impl( sal_UCS4 );
398 :
399 : SvTreeListEntry* CreateEntry(String& rTxt, sal_uInt16 nCol);
400 :
401 : OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet );
402 : public:
403 : ~OfaQuoteTabPage();
404 :
405 : static SfxTabPage* Create( Window* pParent,
406 : const SfxItemSet& rAttrSet);
407 :
408 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
409 : virtual void Reset( const SfxItemSet& rSet );
410 : virtual void ActivatePage( const SfxItemSet& );
411 : };
412 :
413 : // class OfaAutoCompleteTabPage ---------------------------------------------
414 :
415 : class OfaAutoCompleteTabPage : public SfxTabPage
416 : {
417 : using TabPage::ActivatePage;
418 :
419 0 : class AutoCompleteMultiListBox : public MultiListBox
420 : {
421 : OfaAutoCompleteTabPage& rPage;
422 : public:
423 0 : AutoCompleteMultiListBox( OfaAutoCompleteTabPage& rPg,
424 : const ResId& rResId )
425 0 : : MultiListBox( &rPg, rResId ), rPage( rPg ) {}
426 :
427 : virtual long PreNotify( NotifyEvent& rNEvt );
428 : };
429 :
430 : CheckBox aCBActiv; ///<Enable word completion
431 : CheckBox aCBAppendSpace;///<Append space
432 : CheckBox aCBAsTip; ///<Show as tip
433 :
434 : CheckBox aCBCollect;///<Collect words
435 : CheckBox aCBRemoveList;///<...save the list for later use...
436 :
437 : FixedText aFTExpandKey;
438 : ListBox aDCBExpandKey;
439 : FixedText aFTMinWordlen;
440 : NumericField aNFMinWordlen;
441 : FixedText aFTMaxEntries;
442 : NumericField aNFMaxEntries;
443 : AutoCompleteMultiListBox aLBEntries;
444 : PushButton aPBEntries;
445 : editeng::SortedAutoCompleteStrings* m_pAutoCompleteList;
446 : sal_uInt16 nAutoCmpltListCnt;
447 :
448 : DECL_LINK( CheckHdl, CheckBox* );
449 :
450 : OfaAutoCompleteTabPage( Window* pParent,
451 : const SfxItemSet& rSet );
452 : public:
453 : virtual ~OfaAutoCompleteTabPage();
454 :
455 : static SfxTabPage* Create( Window* pParent,
456 : const SfxItemSet& rAttrSet);
457 :
458 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
459 : virtual void Reset( const SfxItemSet& rSet );
460 : virtual void ActivatePage( const SfxItemSet& );
461 :
462 : void CopyToClipboard() const;
463 : DECL_LINK(DeleteHdl, void *);
464 : };
465 :
466 : // class OfaSmartTagOptionsTabPage ---------------------------------------------
467 :
468 : /** Smart tag options tab page
469 :
470 : This tab page is used to enable/disable smart tag types
471 : */
472 : class OfaSmartTagOptionsTabPage : public SfxTabPage
473 : {
474 : using TabPage::ActivatePage;
475 :
476 : private:
477 :
478 : // controls
479 : CheckBox m_aMainCB;
480 : SvxCheckListBox m_aSmartTagTypesLB;
481 : PushButton m_aPropertiesPB;
482 : FixedText m_aTitleFT;
483 :
484 : /// construction via Create()
485 : OfaSmartTagOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
486 :
487 : /** Inserts items into m_aSmartTagTypesLB
488 :
489 : Reads out the smart tag types supported by the SmartTagMgr and
490 : inserts the associated strings into the list box.
491 : */
492 : void FillListBox( const SmartTagMgr& rSmartTagMgr );
493 :
494 : /** Clears the m_aSmartTagTypesLB
495 : */
496 : void ClearListBox();
497 :
498 : /** Handler for the check box
499 :
500 : Enables/disables all controls in the tab page (except from the
501 : check box.
502 : */
503 : DECL_LINK(CheckHdl, void *);
504 :
505 : /** Handler for the push button
506 :
507 : Calls the displayPropertyPage function of the smart tag recognizer
508 : associated with the currently selected smart tag type.
509 : */
510 : DECL_LINK(ClickHdl, void *);
511 :
512 : /** Handler for the list box
513 :
514 : Enables/disables the properties push button if selection in the
515 : smart tag types list box changes.
516 : */
517 : DECL_LINK(SelectHdl, void *);
518 :
519 : public:
520 :
521 : virtual ~OfaSmartTagOptionsTabPage();
522 :
523 : static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
524 :
525 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
526 : virtual void Reset( const SfxItemSet& rSet );
527 : virtual void ActivatePage( const SfxItemSet& );
528 : };
529 :
530 : #endif
531 :
532 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|