1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
37 class CollatorWrapper
;
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
*);
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
;
71 virtual void SetTabs() SAL_OVERRIDE
;
72 virtual void HBarClick() SAL_OVERRIDE
;
73 virtual void KeyInput( const KeyEvent
& rKEvt
) SAL_OVERRIDE
;
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
;
99 VclPtr
<SvxCheckListBox
> m_pCheckLB
;
102 OUString m_sDoubleCaps
;
103 OUString m_sStartCap
;
104 OUString m_sBoldUnderline
;
106 OUString m_sNoDblSpaces
;
108 OUString m_sAccidentalCaps
;
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
;
141 OUString sNoDblSpaces
;
142 OUString sCorrectCapsLock
;
145 OUString sRightMargin
;
149 OUString sReplaceTemplates
;
150 OUString sDelSpaceAtSttEnd
;
151 OUString sDelSpaceBetweenLines
;
154 OUString sBulletChar
;
155 OUString sByInputBulletChar
;
157 vcl::Font aBulletFont
;
158 vcl::Font aByInputBulletFont
;
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
;
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
186 VclPtr
<SvTabListBox
> m_xReplaceTLB
;
190 void dispose() override
;
193 AutoCorrEdit(vcl::Window
* pParent
, const ResId
& rResId
)
194 : Edit(pParent
, rResId
)
200 AutoCorrEdit(vcl::Window
* pParent
)
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
)
217 virtual void KeyInput( const KeyEvent
& rKEvent
) SAL_OVERRIDE
;
218 virtual void Resize() SAL_OVERRIDE
;
221 // class OfaAutocorrReplacePage ------------------------------------------
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
;
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
;
261 std::set
<OUString
> aFormatText
;
262 DoubleStringTable aDoubleStringTable
;
263 CollatorWrapper
* pCompareClass
;
264 CharClass
* pCharClass
;
267 bool bHasSelectionText
;
269 bool bReplaceEditChanged
: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
);
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 ---------------------------------------------
301 std::vector
<OUString
> aAbbrevStrings
;
302 std::vector
<OUString
> aDoubleCapsStrings
;
306 typedef std::map
<LanguageType
, StringsArrays
> StringsTable
;
308 class OfaAutocorrExceptPage
: public SfxTabPage
310 using TabPage::ActivatePage
;
311 using TabPage::DeactivatePage
;
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
;
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
);
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
;
361 /// For anything but writer
362 VclPtr
<SvxCheckListBox
> m_pCheckLB
;
365 VclPtr
<OfaACorrCheckListBox
> m_pSwCheckLB
;
367 OUString sNonBrkSpace
;
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
;
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
);
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
>;
424 class AutoCompleteMultiListBox
: public MultiListBox
426 VclPtr
<OfaAutoCompleteTabPage
> m_pPage
;
428 AutoCompleteMultiListBox(vcl::Window
*pParent
, WinBits nBits
)
429 : MultiListBox(pParent
, nBits
)
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
;
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
);
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
;
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
502 /** Handler for the check box
504 Enables/disables all controls in the tab page (except from the
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 *);
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
;
538 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */