Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / cui / source / inc / autocdlg.hxx
blobabaf70c7f121bed369a0e9a4fbcf97f69a39d9c2
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 _OFA_AUTOCDLG_HXX
20 #define _OFA_AUTOCDLG_HXX
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"
31 class CharClass;
32 class CollatorWrapper;
33 class SmartTagMgr;
35 namespace editeng { class SortedAutoCompleteStrings; }
37 // class OfaAutoCorrDlg --------------------------------------------------
39 class OfaAutoCorrDlg : public SfxTabDialog
41 FixedText aLanguageFT;
42 SvxLanguageBox aLanguageLB;
44 DECL_LINK(SelectLanguageHdl, ListBox*);
45 public:
47 OfaAutoCorrDlg(Window* pParent, const SfxItemSet *pSet );
49 void EnableLanguage(sal_Bool bEnable)
50 { aLanguageFT.Enable(bEnable);
51 aLanguageLB.Enable(bEnable);}
55 #ifdef _OFA_AUTOCDLG_CXX
56 #include <vcl/group.hxx>
57 #include <vcl/button.hxx>
58 #include <vcl/lstbox.hxx>
59 #include <svtools/svtabbx.hxx>
60 #include <svx/simptabl.hxx>
62 // class OfaACorrCheckListBox ------------------------------------------
64 class OfaACorrCheckListBox : public SvxSimpleTable
66 using SvxSimpleTable::SetTabs;
67 using SvTreeListBox::GetCheckButtonState;
68 using SvTreeListBox::SetCheckButtonState;
70 protected:
71 virtual void SetTabs();
72 virtual void HBarClick();
73 virtual void KeyInput( const KeyEvent& rKEvt );
75 public:
76 OfaACorrCheckListBox(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER)
77 : SvxSimpleTable(rParent, nBits)
81 inline void *GetUserData(sal_uLong nPos) { return GetEntry(nPos)->GetUserData(); }
82 inline void SetUserData(sal_uLong nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); }
83 inline sal_uLong GetSelectEntryPos() { return GetModel()->GetAbsPos(FirstSelected()); }
85 sal_Bool IsChecked(sal_uLong nPos, sal_uInt16 nCol = 0);
86 void CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked);
87 SvButtonState GetCheckButtonState( SvTreeListEntry*, sal_uInt16 nCol ) const;
88 void SetCheckButtonState( SvTreeListEntry*, sal_uInt16 nCol, SvButtonState );
91 // class OfaAutocorrOptionsPage ------------------------------------------
94 class OfaAutocorrOptionsPage : public SfxTabPage
96 using TabPage::ActivatePage;
98 private:
99 SvxCheckListBox aCheckLB;
101 String sInput;
102 String sDoubleCaps;
103 String sStartCap;
104 String sBoldUnderline;
105 String sURL;
106 String sNoDblSpaces;
107 String sDash;
108 String sNonBrkSpace;
109 String sFirst;
110 String sAccidentalCaps;
112 public:
113 OfaAutocorrOptionsPage( Window* pParent, const SfxItemSet& rSet );
114 ~OfaAutocorrOptionsPage();
116 static SfxTabPage* Create( Window* pParent,
117 const SfxItemSet& rAttrSet);
119 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
120 virtual void Reset( const SfxItemSet& rSet );
121 virtual void ActivatePage( const SfxItemSet& );
125 // class OfaSwAutoFmtOptionsPage ----------------------------------------------------
127 class OfaSwAutoFmtOptionsPage : public SfxTabPage
129 using TabPage::ActivatePage;
131 SvxSimpleTableContainer m_aCheckLBContainer;
132 OfaACorrCheckListBox aCheckLB;
133 PushButton aEditPB;
134 FixedText aHeader1Expl;
135 FixedText aHeader2Expl;
137 String sHeader1;
138 String sHeader2;
140 String sDeleteEmptyPara;
141 String sUseReplaceTbl;
142 String sCptlSttWord;
143 String sCptlSttSent;
144 String sUserStyle;
145 String sBullet;
146 String sByInputBullet;
147 String sBoldUnder;
148 String sNoDblSpaces;
149 String sCorrectCapsLock;
150 String sDetectURL;
151 String sDash;
152 String sNonBrkSpace;
153 String sOrdinal;
154 String sRightMargin;
155 String sNum;
156 String sBorder;
157 String sTable;
158 String sReplaceTemplates;
159 String sDelSpaceAtSttEnd;
160 String sDelSpaceBetweenLines;
162 String sMargin;
163 String sBulletChar;
164 String sByInputBulletChar;
166 Font aBulletFont;
167 Font aByInputBulletFont;
168 sal_uInt16 nPercent;
170 SvLBoxButtonData* pCheckButtonData;
172 DECL_LINK(SelectHdl, OfaACorrCheckListBox*);
173 DECL_LINK(EditHdl, void *);
174 SvTreeListEntry* CreateEntry(String& rTxt, sal_uInt16 nCol);
177 OfaSwAutoFmtOptionsPage( Window* pParent,
178 const SfxItemSet& rSet );
179 ~OfaSwAutoFmtOptionsPage();
181 public:
182 static SfxTabPage* Create( Window* pParent,
183 const SfxItemSet& rAttrSet);
184 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
185 virtual void Reset( const SfxItemSet& rSet );
186 virtual void ActivatePage( const SfxItemSet& );
189 // class AutoCorrEdit ----------------------------------------------------
191 class AutoCorrEdit : public Edit
193 Link aActionLink;
194 sal_Bool bSpaces;
196 public:
197 AutoCorrEdit(Window* pParent, const ResId& rResId) :
198 Edit(pParent, rResId), bSpaces(sal_False){}
200 void SetActionHdl( const Link& rLink )
201 { aActionLink = rLink;}
203 void SetSpaces(sal_Bool bSet)
204 {bSpaces = bSet;}
206 virtual void KeyInput( const KeyEvent& rKEvent );
209 // class OfaAutocorrReplacePage ------------------------------------------
212 struct DoubleString
214 String sShort;
215 String sLong;
216 void* pUserData; ///< CheckBox -> form. Text Bool -> selection text
219 typedef std::vector<DoubleString> DoubleStringArray;
220 typedef std::map<LanguageType, DoubleStringArray> DoubleStringTable;
222 struct StringChangeList
224 DoubleStringArray aNewEntries;
225 DoubleStringArray aDeletedEntries;
228 typedef std::map<LanguageType, StringChangeList> StringChangeTable;
230 class OfaAutocorrReplacePage : public SfxTabPage
232 using TabPage::ActivatePage;
233 using TabPage::DeactivatePage;
235 private:
237 StringChangeTable aChangesTable;
239 CheckBox aTextOnlyCB;
240 FixedText aShortFT;
241 AutoCorrEdit aShortED;
242 FixedText aReplaceFT;
243 AutoCorrEdit aReplaceED;
244 SvTabListBox aReplaceTLB;
245 PushButton aNewReplacePB;
246 PushButton aDeleteReplacePB;
248 String sModify;
249 String sNew;
251 std::set<rtl::OUString> aFormatText;
252 DoubleStringTable aDoubleStringTable;
253 CollatorWrapper* pCompareClass;
254 CharClass* pCharClass;
255 LanguageType eLang;
257 sal_Bool bHasSelectionText;
258 sal_Bool bFirstSelect:1;
259 sal_Bool bReplaceEditChanged:1;
260 sal_Bool bSWriter:1;
262 DECL_LINK(SelectHdl, SvTabListBox*);
263 DECL_LINK(NewDelHdl, PushButton*);
264 DECL_LINK(ModifyHdl, Edit*);
266 void RefillReplaceBox( sal_Bool bFromReset,
267 LanguageType eOldLanguage,
268 LanguageType eNewLanguage);
270 public:
271 OfaAutocorrReplacePage( Window* pParent, const SfxItemSet& rSet );
272 ~OfaAutocorrReplacePage();
274 static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
276 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
277 virtual void Reset( const SfxItemSet& rSet );
278 virtual void ActivatePage( const SfxItemSet& );
279 virtual int DeactivatePage( SfxItemSet* pSet = 0 );
281 void SetLanguage(LanguageType eSet);
282 void DeleteEntry(String sShort, String sLong);
283 void NewEntry(String sShort, String sLong);
286 // class OfaAutocorrExceptPage ---------------------------------------------
288 struct StringsArrays
290 std::vector<rtl::OUString> aAbbrevStrings;
291 std::vector<rtl::OUString> aDoubleCapsStrings;
293 StringsArrays() { }
295 typedef std::map<LanguageType, StringsArrays> StringsTable;
297 class OfaAutocorrExceptPage : public SfxTabPage
299 using TabPage::ActivatePage;
300 using TabPage::DeactivatePage;
302 private:
303 FixedLine aAbbrevFL;
304 AutoCorrEdit aAbbrevED;
305 ListBox aAbbrevLB;
306 PushButton aNewAbbrevPB;
307 PushButton aDelAbbrevPB;
308 CheckBox aAutoAbbrevCB;
310 FixedLine aDoubleCapsFL;
311 AutoCorrEdit aDoubleCapsED;
312 ListBox aDoubleCapsLB;
313 PushButton aNewDoublePB;
314 PushButton aDelDoublePB;
315 CheckBox aAutoCapsCB;
317 StringsTable aStringsTable;
318 CollatorWrapper* pCompareClass;
319 LanguageType eLang;
321 DECL_LINK(NewDelHdl, PushButton*);
322 DECL_LINK(SelectHdl, ListBox*);
323 DECL_LINK(ModifyHdl, Edit*);
324 /// Box filled with new language
325 void RefillReplaceBoxes(sal_Bool bFromReset,
326 LanguageType eOldLanguage,
327 LanguageType eNewLanguage);
328 public:
329 OfaAutocorrExceptPage( Window* pParent, const SfxItemSet& rSet );
330 ~OfaAutocorrExceptPage();
332 static SfxTabPage* Create( Window* pParent,
333 const SfxItemSet& rAttrSet);
335 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
336 virtual void Reset( const SfxItemSet& rSet );
337 virtual void ActivatePage( const SfxItemSet& );
338 virtual int DeactivatePage( SfxItemSet* pSet = 0 );
339 void SetLanguage(LanguageType eSet);
343 // class OfaQuoteTabPage -------------------------------------------------
345 class OfaQuoteTabPage : public SfxTabPage
347 using TabPage::ActivatePage;
349 private:
350 /// For anything but writer
351 SvxCheckListBox aCheckLB;
353 /// Just for writer
354 SvxSimpleTableContainer m_aSwCheckLBContainer;
355 OfaACorrCheckListBox aSwCheckLB;
356 String sHeader1;
357 String sHeader2;
359 String sNonBrkSpace;
360 String sOrdinal;
362 SvLBoxButtonData* pCheckButtonData;
364 FixedLine aSingleFL;
365 CheckBox aSingleTypoCB;
366 FixedText aSglStartQuoteFT;
367 PushButton aSglStartQuotePB;
368 FixedText aSglStartExFT;
369 FixedText aSglEndQuoteFT;
370 PushButton aSglEndQuotePB;
371 FixedText aSglEndExFT;
372 PushButton aSglStandardPB;
374 FixedLine aDoubleFL;
375 CheckBox aTypoCB;
376 FixedText aStartQuoteFT;
377 PushButton aStartQuotePB;
378 FixedText aDblStartExFT;
379 FixedText aEndQuoteFT;
380 PushButton aEndQuotePB;
381 FixedText aDblEndExFT;
382 PushButton aDblStandardPB;
384 String sStartQuoteDlg;
385 String sEndQuoteDlg;
387 String sStandard;
390 sal_UCS4 cSglStartQuote;
391 sal_UCS4 cSglEndQuote;
393 sal_UCS4 cStartQuote;
394 sal_UCS4 cEndQuote;
396 DECL_LINK( QuoteHdl, PushButton* );
397 DECL_LINK( StdQuoteHdl, PushButton* );
399 String ChangeStringExt_Impl( sal_UCS4 );
401 SvTreeListEntry* CreateEntry(String& rTxt, sal_uInt16 nCol);
403 OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet );
404 public:
405 ~OfaQuoteTabPage();
407 static SfxTabPage* Create( Window* pParent,
408 const SfxItemSet& rAttrSet);
410 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
411 virtual void Reset( const SfxItemSet& rSet );
412 virtual void ActivatePage( const SfxItemSet& );
415 // class OfaAutoCompleteTabPage ---------------------------------------------
417 class OfaAutoCompleteTabPage : public SfxTabPage
419 using TabPage::ActivatePage;
421 class AutoCompleteMultiListBox : public MultiListBox
423 OfaAutoCompleteTabPage& rPage;
424 public:
425 AutoCompleteMultiListBox( OfaAutoCompleteTabPage& rPg,
426 const ResId& rResId )
427 : MultiListBox( &rPg, rResId ), rPage( rPg ) {}
429 virtual long PreNotify( NotifyEvent& rNEvt );
432 CheckBox aCBActiv; ///<Enable word completion
433 CheckBox aCBAppendSpace;///<Append space
434 CheckBox aCBAsTip; ///<Show as tip
436 CheckBox aCBCollect;///<Collect words
437 CheckBox aCBRemoveList;///<...save the list for later use...
439 FixedText aFTExpandKey;
440 ListBox aDCBExpandKey;
441 FixedText aFTMinWordlen;
442 NumericField aNFMinWordlen;
443 FixedText aFTMaxEntries;
444 NumericField aNFMaxEntries;
445 AutoCompleteMultiListBox aLBEntries;
446 PushButton aPBEntries;
447 editeng::SortedAutoCompleteStrings* m_pAutoCompleteList;
448 sal_uInt16 nAutoCmpltListCnt;
450 DECL_LINK( CheckHdl, CheckBox* );
452 OfaAutoCompleteTabPage( Window* pParent,
453 const SfxItemSet& rSet );
454 public:
455 virtual ~OfaAutoCompleteTabPage();
457 static SfxTabPage* Create( Window* pParent,
458 const SfxItemSet& rAttrSet);
460 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
461 virtual void Reset( const SfxItemSet& rSet );
462 virtual void ActivatePage( const SfxItemSet& );
464 void CopyToClipboard() const;
465 DECL_LINK(DeleteHdl, void *);
468 // class OfaSmartTagOptionsTabPage ---------------------------------------------
470 /** Smart tag options tab page
472 This tab page is used to enable/disable smart tag types
474 class OfaSmartTagOptionsTabPage : public SfxTabPage
476 using TabPage::ActivatePage;
478 private:
480 // controls
481 CheckBox m_aMainCB;
482 SvxCheckListBox m_aSmartTagTypesLB;
483 PushButton m_aPropertiesPB;
484 FixedText m_aTitleFT;
486 /// construction via Create()
487 OfaSmartTagOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
489 /** Inserts items into m_aSmartTagTypesLB
491 Reads out the smart tag types supported by the SmartTagMgr and
492 inserts the associated strings into the list box.
494 void FillListBox( const SmartTagMgr& rSmartTagMgr );
496 /** Clears the m_aSmartTagTypesLB
498 void ClearListBox();
500 /** Handler for the check box
502 Enables/disables all controls in the tab page (except from the
503 check box.
505 DECL_LINK(CheckHdl, void *);
507 /** Handler for the push button
509 Calls the displayPropertyPage function of the smart tag recognizer
510 associated with the currently selected smart tag type.
512 DECL_LINK(ClickHdl, void *);
514 /** Handler for the list box
516 Enables/disables the properties push button if selection in the
517 smart tag types list box changes.
519 DECL_LINK(SelectHdl, void *);
521 public:
523 virtual ~OfaSmartTagOptionsTabPage();
525 static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
527 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
528 virtual void Reset( const SfxItemSet& rSet );
529 virtual void ActivatePage( const SfxItemSet& );
532 #endif // _OFA_AUTOCDLG_CXX
534 #endif //
536 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */