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