bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / inc / autocdlg.hxx
blob4302e0a323f69244cc80d2eabcc570ae3d2a501d
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_AUTOCDLG_HXX
20 #define INCLUDED_CUI_SOURCE_INC_AUTOCDLG_HXX
22 #include <sfx2/tabdlg.hxx>
23 #include <svtools/langtab.hxx>
24 #include <svtools/simptabl.hxx>
25 #include <svtools/svtabbx.hxx>
26 #include <svtools/treelistentry.hxx>
27 #include <svx/checklbx.hxx>
28 #include <svx/langbox.hxx>
29 #include <vcl/button.hxx>
30 #include <vcl/fixed.hxx>
31 #include <vcl/field.hxx>
32 #include <vcl/group.hxx>
33 #include <vcl/lstbox.hxx>
34 #include <vcl/metric.hxx>
36 class CharClass;
37 class CollatorWrapper;
38 class SmartTagMgr;
40 namespace editeng { class SortedAutoCompleteStrings; }
42 // class OfaAutoCorrDlg --------------------------------------------------
44 class OfaAutoCorrDlg : public SfxTabDialog
46 VclPtr<VclContainer> m_pLanguageBox;
47 VclPtr<SvxLanguageBox> m_pLanguageLB;
49 sal_uInt16 m_nReplacePageId;
50 sal_uInt16 m_nExceptionsPageId;
52 DECL_LINK(SelectLanguageHdl, ListBox*);
53 public:
55 OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet *pSet);
56 virtual ~OfaAutoCorrDlg();
57 virtual void dispose() SAL_OVERRIDE;
59 void EnableLanguage(bool bEnable);
62 // class OfaACorrCheckListBox ------------------------------------------
64 class OfaACorrCheckListBox : public SvSimpleTable
66 using SvSimpleTable::SetTabs;
67 using SvTreeListBox::GetCheckButtonState;
68 using SvTreeListBox::SetCheckButtonState;
70 protected:
71 virtual void SetTabs() SAL_OVERRIDE;
72 virtual void HBarClick() SAL_OVERRIDE;
73 virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
75 public:
76 OfaACorrCheckListBox(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER)
77 : SvSimpleTable(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 bool IsChecked(sal_uLong nPos, sal_uInt16 nCol = 0);
86 void CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, bool bChecked);
87 static SvButtonState GetCheckButtonState( SvTreeListEntry*, sal_uInt16 nCol );
88 void SetCheckButtonState( SvTreeListEntry*, sal_uInt16 nCol, SvButtonState );
91 // class OfaAutocorrOptionsPage ------------------------------------------
94 class OfaAutocorrOptionsPage : public SfxTabPage
96 using TabPage::ActivatePage;
98 private:
99 VclPtr<SvxCheckListBox> m_pCheckLB;
101 OUString m_sInput;
102 OUString m_sDoubleCaps;
103 OUString m_sStartCap;
104 OUString m_sBoldUnderline;
105 OUString m_sURL;
106 OUString m_sNoDblSpaces;
107 OUString m_sDash;
108 OUString m_sAccidentalCaps;
110 public:
111 OfaAutocorrOptionsPage(vcl::Window* pParent, const SfxItemSet& rSet);
112 virtual ~OfaAutocorrOptionsPage();
113 virtual void dispose() SAL_OVERRIDE;
115 static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
116 const SfxItemSet* rAttrSet);
118 virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
119 virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
120 virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
124 // class OfaSwAutoFmtOptionsPage ----------------------------------------------------
126 class OfaSwAutoFmtOptionsPage : public SfxTabPage
128 friend class VclPtr<OfaSwAutoFmtOptionsPage>;
129 using TabPage::ActivatePage;
131 VclPtr<OfaACorrCheckListBox> m_pCheckLB;
132 VclPtr<PushButton> m_pEditPB;
134 OUString sDeleteEmptyPara;
135 OUString sUseReplaceTbl;
136 OUString sCptlSttWord;
137 OUString sCptlSttSent;
138 OUString sUserStyle;
139 OUString sBullet;
140 OUString sBoldUnder;
141 OUString sNoDblSpaces;
142 OUString sCorrectCapsLock;
143 OUString sDetectURL;
144 OUString sDash;
145 OUString sRightMargin;
146 OUString sNum;
147 OUString sBorder;
148 OUString sTable;
149 OUString sReplaceTemplates;
150 OUString sDelSpaceAtSttEnd;
151 OUString sDelSpaceBetweenLines;
153 OUString sMargin;
154 OUString sBulletChar;
155 OUString sByInputBulletChar;
157 vcl::Font aBulletFont;
158 vcl::Font aByInputBulletFont;
159 sal_uInt16 nPercent;
161 SvLBoxButtonData* pCheckButtonData;
163 DECL_LINK(SelectHdl, OfaACorrCheckListBox*);
164 DECL_LINK(EditHdl, void *);
165 SvTreeListEntry* CreateEntry(OUString& rTxt, sal_uInt16 nCol);
168 OfaSwAutoFmtOptionsPage( vcl::Window* pParent,
169 const SfxItemSet& rSet );
170 virtual ~OfaSwAutoFmtOptionsPage();
171 virtual void dispose() SAL_OVERRIDE;
173 public:
174 static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
175 const SfxItemSet* rAttrSet);
176 virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
177 virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
178 virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
181 // class AutoCorrEdit ----------------------------------------------------
183 class AutoCorrEdit : public Edit
185 Link<> aActionLink;
186 VclPtr<SvTabListBox> m_xReplaceTLB;
187 sal_Int32 m_nCol;
188 bool bSpaces;
190 void dispose() override;
192 public:
193 AutoCorrEdit(vcl::Window* pParent, const ResId& rResId)
194 : Edit(pParent, rResId)
195 , m_nCol(0)
196 , bSpaces(false)
200 AutoCorrEdit(vcl::Window* pParent)
201 : Edit(pParent)
202 , m_nCol(0)
203 , bSpaces(false)
207 virtual ~AutoCorrEdit();
209 void SetActionHdl( const Link<>& rLink )
210 { aActionLink = rLink;}
212 void ConnectColumn(const VclPtr<SvTabListBox>& rTable, sal_Int32 nCol);
214 void SetSpaces(bool bSet)
215 {bSpaces = bSet;}
217 virtual void KeyInput( const KeyEvent& rKEvent ) SAL_OVERRIDE;
218 virtual void Resize() SAL_OVERRIDE;
221 // class OfaAutocorrReplacePage ------------------------------------------
224 struct DoubleString
226 OUString sShort;
227 OUString sLong;
228 void* pUserData; ///< CheckBox -> form. Text Bool -> selection text
231 typedef std::vector<DoubleString> DoubleStringArray;
232 typedef std::map<LanguageType, DoubleStringArray> DoubleStringTable;
234 struct StringChangeList
236 DoubleStringArray aNewEntries;
237 DoubleStringArray aDeletedEntries;
240 typedef std::map<LanguageType, StringChangeList> StringChangeTable;
242 class OfaAutocorrReplacePage : public SfxTabPage
244 using TabPage::ActivatePage;
245 using TabPage::DeactivatePage;
247 private:
249 StringChangeTable aChangesTable;
251 VclPtr<CheckBox> m_pTextOnlyCB;
252 VclPtr<AutoCorrEdit> m_pShortED;
253 VclPtr<AutoCorrEdit> m_pReplaceED;
254 VclPtr<SvTabListBox> m_pReplaceTLB;
255 VclPtr<PushButton> m_pNewReplacePB;
256 VclPtr<PushButton> m_pDeleteReplacePB;
258 OUString sModify;
259 OUString sNew;
261 std::set<OUString> aFormatText;
262 DoubleStringTable aDoubleStringTable;
263 CollatorWrapper* pCompareClass;
264 CharClass* pCharClass;
265 LanguageType eLang;
267 bool bHasSelectionText;
268 bool bFirstSelect:1;
269 bool bReplaceEditChanged:1;
270 bool bSWriter:1;
272 DECL_LINK(SelectHdl, SvTabListBox*);
273 DECL_LINK(NewDelHdl, PushButton*);
274 DECL_LINK(ModifyHdl, Edit*);
276 void RefillReplaceBox( bool bFromReset,
277 LanguageType eOldLanguage,
278 LanguageType eNewLanguage);
280 public:
281 OfaAutocorrReplacePage( vcl::Window* pParent, const SfxItemSet& rSet );
282 virtual ~OfaAutocorrReplacePage();
283 virtual void dispose() SAL_OVERRIDE;
285 static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
287 virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
288 virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
289 virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
290 virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
292 void SetLanguage(LanguageType eSet);
293 void DeleteEntry(const OUString& sShort, const OUString& sLong);
294 void NewEntry(const OUString& sShort, const OUString& sLong, bool bKeepSourceFormatting);
297 // class OfaAutocorrExceptPage ---------------------------------------------
299 struct StringsArrays
301 std::vector<OUString> aAbbrevStrings;
302 std::vector<OUString> aDoubleCapsStrings;
304 StringsArrays() { }
306 typedef std::map<LanguageType, StringsArrays> StringsTable;
308 class OfaAutocorrExceptPage : public SfxTabPage
310 using TabPage::ActivatePage;
311 using TabPage::DeactivatePage;
313 private:
314 VclPtr<AutoCorrEdit> m_pAbbrevED;
315 VclPtr<ListBox> m_pAbbrevLB;
316 VclPtr<PushButton> m_pNewAbbrevPB;
317 VclPtr<PushButton> m_pDelAbbrevPB;
318 VclPtr<CheckBox> m_pAutoAbbrevCB;
320 VclPtr<AutoCorrEdit> m_pDoubleCapsED;
321 VclPtr<ListBox> m_pDoubleCapsLB;
322 VclPtr<PushButton> m_pNewDoublePB;
323 VclPtr<PushButton> m_pDelDoublePB;
324 VclPtr<CheckBox> m_pAutoCapsCB;
326 StringsTable aStringsTable;
327 CollatorWrapper* pCompareClass;
328 LanguageType eLang;
330 DECL_LINK(NewDelHdl, void*);
331 DECL_LINK(SelectHdl, ListBox*);
332 DECL_LINK(ModifyHdl, Edit*);
333 /// Box filled with new language
334 void RefillReplaceBoxes(bool bFromReset,
335 LanguageType eOldLanguage,
336 LanguageType eNewLanguage);
337 public:
338 OfaAutocorrExceptPage( vcl::Window* pParent, const SfxItemSet& rSet );
339 virtual ~OfaAutocorrExceptPage();
340 virtual void dispose() SAL_OVERRIDE;
342 static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
343 const SfxItemSet* rAttrSet);
345 virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
346 virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
347 virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
348 virtual sfxpg DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
349 void SetLanguage(LanguageType eSet);
353 // class OfaQuoteTabPage -------------------------------------------------
355 class OfaQuoteTabPage : public SfxTabPage
357 friend class VclPtr<OfaQuoteTabPage>;
358 using TabPage::ActivatePage;
360 private:
361 /// For anything but writer
362 VclPtr<SvxCheckListBox> m_pCheckLB;
364 /// Just for writer
365 VclPtr<OfaACorrCheckListBox> m_pSwCheckLB;
367 OUString sNonBrkSpace;
368 OUString sOrdinal;
370 SvLBoxButtonData* pCheckButtonData;
372 VclPtr<CheckBox> m_pSingleTypoCB;
373 VclPtr<PushButton> m_pSglStartQuotePB;
374 VclPtr<FixedText> m_pSglStartExFT;
375 VclPtr<PushButton> m_pSglEndQuotePB;
376 VclPtr<FixedText> m_pSglEndExFT;
377 VclPtr<PushButton> m_pSglStandardPB;
379 VclPtr<CheckBox> m_pDoubleTypoCB;
380 VclPtr<PushButton> m_pDblStartQuotePB;
381 VclPtr<FixedText> m_pDblStartExFT;
382 VclPtr<PushButton> m_pDblEndQuotePB;
383 VclPtr<FixedText> m_pDblEndExFT;
384 VclPtr<PushButton> m_pDblStandardPB;
386 OUString m_sStartQuoteDlg;
387 OUString m_sEndQuoteDlg;
389 OUString m_sStandard;
392 sal_UCS4 cSglStartQuote;
393 sal_UCS4 cSglEndQuote;
395 sal_UCS4 cStartQuote;
396 sal_UCS4 cEndQuote;
398 DECL_LINK( QuoteHdl, PushButton* );
399 DECL_LINK( StdQuoteHdl, PushButton* );
401 OUString ChangeStringExt_Impl( sal_UCS4 );
403 SvTreeListEntry* CreateEntry(OUString& rTxt, sal_uInt16 nCol);
405 OfaQuoteTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
406 public:
407 virtual ~OfaQuoteTabPage();
408 virtual void dispose() SAL_OVERRIDE;
410 static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
411 const SfxItemSet* rAttrSet);
413 virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
414 virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
415 virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
418 // class OfaAutoCompleteTabPage ---------------------------------------------
420 class OfaAutoCompleteTabPage : public SfxTabPage
422 friend class VclPtr<OfaAutoCompleteTabPage>;
423 public:
424 class AutoCompleteMultiListBox : public MultiListBox
426 VclPtr<OfaAutoCompleteTabPage> m_pPage;
427 public:
428 AutoCompleteMultiListBox(vcl::Window *pParent, WinBits nBits)
429 : MultiListBox(pParent, nBits)
430 , m_pPage(NULL)
433 virtual ~AutoCompleteMultiListBox();
434 virtual void dispose() SAL_OVERRIDE;
435 void SetPage(OfaAutoCompleteTabPage *pPage) { m_pPage = pPage; }
436 virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
439 private:
440 using TabPage::ActivatePage;
441 VclPtr<CheckBox> m_pCBActiv; ///<Enable word completion
442 VclPtr<CheckBox> m_pCBAppendSpace;///<Append space
443 VclPtr<CheckBox> m_pCBAsTip; ///<Show as tip
445 VclPtr<CheckBox> m_pCBCollect;///<Collect words
446 VclPtr<CheckBox> m_pCBRemoveList;///<...save the list for later use...
448 VclPtr<ListBox> m_pDCBExpandKey;
449 VclPtr<NumericField> m_pNFMinWordlen;
450 VclPtr<NumericField> m_pNFMaxEntries;
451 VclPtr<AutoCompleteMultiListBox> m_pLBEntries;
452 VclPtr<PushButton> m_pPBEntries;
453 editeng::SortedAutoCompleteStrings* m_pAutoCompleteList;
454 sal_uInt16 m_nAutoCmpltListCnt;
456 DECL_LINK( CheckHdl, CheckBox* );
458 OfaAutoCompleteTabPage( vcl::Window* pParent,
459 const SfxItemSet& rSet );
460 public:
461 virtual ~OfaAutoCompleteTabPage();
462 virtual void dispose() SAL_OVERRIDE;
463 static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
464 const SfxItemSet* rAttrSet);
466 virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
467 virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
468 virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
470 void CopyToClipboard() const;
471 DECL_LINK(DeleteHdl, void *);
474 // class OfaSmartTagOptionsTabPage ---------------------------------------------
476 /** Smart tag options tab page
478 This tab page is used to enable/disable smart tag types
480 class OfaSmartTagOptionsTabPage : public SfxTabPage
482 using TabPage::ActivatePage;
484 private:
486 // controls
487 VclPtr<CheckBox> m_pMainCB;
488 VclPtr<SvxCheckListBox> m_pSmartTagTypesLB;
489 VclPtr<PushButton> m_pPropertiesPB;
491 /** Inserts items into m_aSmartTagTypesLB
493 Reads out the smart tag types supported by the SmartTagMgr and
494 inserts the associated strings into the list box.
496 void FillListBox( const SmartTagMgr& rSmartTagMgr );
498 /** Clears the m_aSmartTagTypesLB
500 void ClearListBox();
502 /** Handler for the check box
504 Enables/disables all controls in the tab page (except from the
505 check box.
507 DECL_LINK(CheckHdl, void *);
509 /** Handler for the push button
511 Calls the displayPropertyPage function of the smart tag recognizer
512 associated with the currently selected smart tag type.
514 DECL_LINK(ClickHdl, void *);
516 /** Handler for the list box
518 Enables/disables the properties push button if selection in the
519 smart tag types list box changes.
521 DECL_LINK(SelectHdl, void *);
523 public:
524 /// construction via Create()
525 OfaSmartTagOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
526 virtual ~OfaSmartTagOptionsTabPage();
527 virtual void dispose() SAL_OVERRIDE;
529 static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
531 virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
532 virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
533 virtual void ActivatePage( const SfxItemSet& ) SAL_OVERRIDE;
536 #endif
538 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */