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 <svx/langbox.hxx>
25 #include <tools/debug.hxx>
26 #include <vcl/metric.hxx>
31 class CollatorWrapper
;
34 namespace editeng
{ class SortedAutoCompleteStrings
; }
36 // class OfaAutoCorrDlg --------------------------------------------------
38 class OfaAutoCorrDlg
: public SfxTabDialogController
40 std::unique_ptr
<weld::Widget
> m_xLanguageBox
;
41 std::unique_ptr
<LanguageBox
> m_xLanguageLB
;
43 DECL_LINK(SelectLanguageHdl
, weld::ComboBox
&, void);
46 OfaAutoCorrDlg(weld::Window
* pParent
, const SfxItemSet
*pSet
);
47 virtual ~OfaAutoCorrDlg() override
;
49 void EnableLanguage(bool bEnable
);
52 // class OfaAutocorrOptionsPage ------------------------------------------
54 class OfaAutocorrOptionsPage
: public SfxTabPage
56 using TabPage::ActivatePage
;
60 OUString m_sDoubleCaps
;
62 OUString m_sBoldUnderline
;
64 OUString m_sNoDblSpaces
;
66 OUString m_sAccidentalCaps
;
68 std::unique_ptr
<weld::TreeView
> m_xCheckLB
;
70 void InsertEntry(const OUString
& rTxt
);
73 OfaAutocorrOptionsPage(TabPageParent pParent
, const SfxItemSet
& rSet
);
74 virtual ~OfaAutocorrOptionsPage() override
;
76 static VclPtr
<SfxTabPage
> Create( TabPageParent pParent
,
77 const SfxItemSet
* rAttrSet
);
79 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
80 virtual void Reset( const SfxItemSet
* rSet
) override
;
81 virtual void ActivatePage( const SfxItemSet
& ) override
;
85 // class OfaSwAutoFmtOptionsPage ----------------------------------------------------
87 class OfaSwAutoFmtOptionsPage
: public SfxTabPage
89 friend class VclPtr
<OfaSwAutoFmtOptionsPage
>;
90 using TabPage::ActivatePage
;
92 OUString sDeleteEmptyPara
;
93 OUString sUseReplaceTbl
;
94 OUString sCapitalStartWord
;
95 OUString sCapitalStartSentence
;
99 OUString sNoDblSpaces
;
100 OUString sCorrectCapsLock
;
103 OUString sRightMargin
;
107 OUString sReplaceTemplates
;
108 OUString sDelSpaceAtSttEnd
;
109 OUString sDelSpaceBetweenLines
;
112 OUString sBulletChar
;
113 OUString sByInputBulletChar
;
115 vcl::Font aBulletFont
;
116 vcl::Font aByInputBulletFont
;
119 std::unique_ptr
<weld::TreeView
> m_xCheckLB
;
120 std::unique_ptr
<weld::Button
> m_xEditPB
;
122 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
123 DECL_LINK(EditHdl
, weld::Button
&, void);
124 DECL_LINK(DoubleClickEditHdl
, weld::TreeView
&, void);
126 void CreateEntry(const OUString
& rTxt
, sal_uInt16 nCol
);
128 OfaSwAutoFmtOptionsPage(TabPageParent pParent
, const SfxItemSet
& rSet
);
129 virtual ~OfaSwAutoFmtOptionsPage() override
;
130 virtual void dispose() override
;
133 static VclPtr
<SfxTabPage
> Create( TabPageParent pParent
,
134 const SfxItemSet
* rAttrSet
);
135 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
136 virtual void Reset( const SfxItemSet
* rSet
) override
;
137 virtual void ActivatePage( const SfxItemSet
& ) override
;
140 // class OfaAutocorrReplacePage ------------------------------------------
146 void* pUserData
; ///< CheckBox -> form. Text Bool -> selection text
149 typedef std::vector
<DoubleString
> DoubleStringArray
;
151 struct StringChangeList
153 DoubleStringArray aNewEntries
;
154 DoubleStringArray aDeletedEntries
;
157 typedef std::map
<LanguageType
, StringChangeList
> StringChangeTable
;
159 class OfaAutocorrReplacePage
: public SfxTabPage
161 using TabPage::ActivatePage
;
162 using TabPage::DeactivatePage
;
166 StringChangeTable aChangesTable
;
171 std::set
<OUString
> aFormatText
;
172 std::map
<LanguageType
, DoubleStringArray
>
174 std::unique_ptr
<CollatorWrapper
> pCompareClass
;
175 std::unique_ptr
<CharClass
> pCharClass
;
178 bool bHasSelectionText
;
180 bool bReplaceEditChanged
:1;
183 std::vector
<int> m_aReplaceFixedWidths
;
184 std::unique_ptr
<weld::CheckButton
> m_xTextOnlyCB
;
185 std::unique_ptr
<weld::Entry
> m_xShortED
;
186 std::unique_ptr
<weld::Entry
> m_xReplaceED
;
187 std::unique_ptr
<weld::TreeView
> m_xReplaceTLB
;
188 std::unique_ptr
<weld::Button
> m_xNewReplacePB
;
189 std::unique_ptr
<weld::Button
> m_xReplacePB
;
190 std::unique_ptr
<weld::Button
> m_xDeleteReplacePB
;
192 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
193 DECL_LINK(NewDelButtonHdl
, weld::Button
&, void);
194 DECL_LINK(NewDelActionHdl
, weld::Entry
&, bool);
195 DECL_LINK(EntrySizeAllocHdl
, const Size
&, void);
196 DECL_LINK(ModifyHdl
, weld::Entry
&, void);
197 bool NewDelHdl(const weld::Widget
*);
199 void RefillReplaceBox( bool bFromReset
,
200 LanguageType eOldLanguage
,
201 LanguageType eNewLanguage
);
204 OfaAutocorrReplacePage(TabPageParent pParent
, const SfxItemSet
& rSet
);
205 virtual ~OfaAutocorrReplacePage() override
;
206 virtual void dispose() override
;
208 static VclPtr
<SfxTabPage
> Create( TabPageParent pParent
, const SfxItemSet
* rAttrSet
);
210 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
211 virtual void Reset( const SfxItemSet
* rSet
) override
;
212 virtual void ActivatePage( const SfxItemSet
& ) override
;
213 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
215 void SetLanguage(LanguageType eSet
);
216 void DeleteEntry(const OUString
& sShort
, const OUString
& sLong
);
217 void NewEntry(const OUString
& sShort
, const OUString
& sLong
, bool bKeepSourceFormatting
);
220 // class OfaAutocorrExceptPage ---------------------------------------------
224 std::vector
<OUString
> aAbbrevStrings
;
225 std::vector
<OUString
> aDoubleCapsStrings
;
229 typedef std::map
<LanguageType
, StringsArrays
> StringsTable
;
231 class OfaAutocorrExceptPage
: public SfxTabPage
233 using TabPage::ActivatePage
;
234 using TabPage::DeactivatePage
;
237 StringsTable aStringsTable
;
238 std::unique_ptr
<CollatorWrapper
> pCompareClass
;
241 std::unique_ptr
<weld::Entry
> m_xAbbrevED
;
242 std::unique_ptr
<weld::TreeView
> m_xAbbrevLB
;
243 std::unique_ptr
<weld::Button
> m_xNewAbbrevPB
;
244 std::unique_ptr
<weld::Button
> m_xDelAbbrevPB
;
245 std::unique_ptr
<weld::CheckButton
> m_xAutoAbbrevCB
;
247 std::unique_ptr
<weld::Entry
> m_xDoubleCapsED
;
248 std::unique_ptr
<weld::TreeView
> m_xDoubleCapsLB
;
249 std::unique_ptr
<weld::Button
> m_xNewDoublePB
;
250 std::unique_ptr
<weld::Button
> m_xDelDoublePB
;
251 std::unique_ptr
<weld::CheckButton
> m_xAutoCapsCB
;
253 DECL_LINK(NewDelButtonHdl
, weld::Button
&, void);
254 DECL_LINK(NewDelActionHdl
, weld::Entry
&, bool);
255 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
256 DECL_LINK(ModifyHdl
, weld::Entry
&, void);
257 void NewDelHdl(const weld::Widget
*);
258 /// Box filled with new language
259 void RefillReplaceBoxes(bool bFromReset
,
260 LanguageType eOldLanguage
,
261 LanguageType eNewLanguage
);
263 OfaAutocorrExceptPage(TabPageParent pParent
, const SfxItemSet
& rSet
);
264 virtual ~OfaAutocorrExceptPage() override
;
265 virtual void dispose() override
;
267 static VclPtr
<SfxTabPage
> Create( TabPageParent pParent
,
268 const SfxItemSet
* rAttrSet
);
270 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
271 virtual void Reset( const SfxItemSet
* rSet
) override
;
272 virtual void ActivatePage( const SfxItemSet
& ) override
;
273 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
274 void SetLanguage(LanguageType eSet
);
278 // class OfaQuoteTabPage -------------------------------------------------
280 class OfaQuoteTabPage
: public SfxTabPage
282 friend class VclPtr
<OfaQuoteTabPage
>;
283 using TabPage::ActivatePage
;
286 OUString sNonBrkSpace
;
289 sal_UCS4 cSglStartQuote
;
290 sal_UCS4 cSglEndQuote
;
292 sal_UCS4 cStartQuote
;
295 std::unique_ptr
<weld::CheckButton
> m_xSingleTypoCB
;
296 std::unique_ptr
<weld::Button
> m_xSglStartQuotePB
;
297 std::unique_ptr
<weld::Label
> m_xSglStartExFT
;
298 std::unique_ptr
<weld::Button
> m_xSglEndQuotePB
;
299 std::unique_ptr
<weld::Label
> m_xSglEndExFT
;
300 std::unique_ptr
<weld::Button
> m_xSglStandardPB
;
301 std::unique_ptr
<weld::CheckButton
> m_xDoubleTypoCB
;
302 std::unique_ptr
<weld::Button
> m_xDblStartQuotePB
;
303 std::unique_ptr
<weld::Label
> m_xDblStartExFT
;
304 std::unique_ptr
<weld::Button
> m_xDblEndQuotePB
;
305 std::unique_ptr
<weld::Label
> m_xDblEndExFT
;
306 std::unique_ptr
<weld::Button
> m_xDblStandardPB
;
307 std::unique_ptr
<weld::Label
> m_xStandard
;
308 /// For anything but writer
309 std::unique_ptr
<weld::TreeView
> m_xCheckLB
;
311 std::unique_ptr
<weld::TreeView
> m_xSwCheckLB
;
314 DECL_LINK(QuoteHdl
, weld::Button
&, void);
315 DECL_LINK(StdQuoteHdl
, weld::Button
&, void);
317 OUString
ChangeStringExt_Impl( sal_UCS4
);
319 static void CreateEntry(weld::TreeView
& rLstBox
, const OUString
& rTxt
,
320 sal_uInt16 nCol
, sal_uInt16 nTextCol
);
322 OfaQuoteTabPage(TabPageParent pParent
, const SfxItemSet
& rSet
);
324 virtual ~OfaQuoteTabPage() override
;
326 static VclPtr
<SfxTabPage
> Create(TabPageParent pParent
,
327 const SfxItemSet
* rAttrSet
);
329 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
330 virtual void Reset( const SfxItemSet
* rSet
) override
;
331 virtual void ActivatePage( const SfxItemSet
& ) override
;
334 // class OfaAutoCompleteTabPage ---------------------------------------------
336 class OfaAutoCompleteTabPage
: public SfxTabPage
338 friend class VclPtr
<OfaAutoCompleteTabPage
>;
340 using TabPage::ActivatePage
;
341 editeng::SortedAutoCompleteStrings
* m_pAutoCompleteList
;
342 sal_uInt16 m_nAutoCmpltListCnt
;
344 std::unique_ptr
<weld::CheckButton
> m_xCBActiv
; ///<Enable word completion
345 std::unique_ptr
<weld::CheckButton
> m_xCBAppendSpace
;///<Append space
346 std::unique_ptr
<weld::CheckButton
> m_xCBAsTip
; ///<Show as tip
348 std::unique_ptr
<weld::CheckButton
> m_xCBCollect
;///<Collect words
349 std::unique_ptr
<weld::CheckButton
> m_xCBRemoveList
;///<...save the list for later use...
351 std::unique_ptr
<weld::ComboBox
> m_xDCBExpandKey
;
352 std::unique_ptr
<weld::SpinButton
> m_xNFMinWordlen
;
353 std::unique_ptr
<weld::SpinButton
> m_xNFMaxEntries
;
354 std::unique_ptr
<weld::TreeView
> m_xLBEntries
;
355 std::unique_ptr
<weld::Button
> m_xPBEntries
;
357 DECL_LINK(CheckHdl
, weld::ToggleButton
&, void);
358 DECL_LINK(KeyReleaseHdl
, const KeyEvent
&, bool);
360 OfaAutoCompleteTabPage(TabPageParent pParent
, const SfxItemSet
& rSet
);
362 virtual ~OfaAutoCompleteTabPage() override
;
363 static VclPtr
<SfxTabPage
> Create(TabPageParent pParent
,
364 const SfxItemSet
* rAttrSet
);
366 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
367 virtual void Reset( const SfxItemSet
* rSet
) override
;
368 virtual void ActivatePage( const SfxItemSet
& ) override
;
370 void CopyToClipboard() const;
371 DECL_LINK(DeleteHdl
, weld::Button
&, void);
374 // class OfaSmartTagOptionsTabPage ---------------------------------------------
376 /** Smart tag options tab page
378 This tab page is used to enable/disable smart tag types
380 class OfaSmartTagOptionsTabPage
: public SfxTabPage
382 using TabPage::ActivatePage
;
387 std::unique_ptr
<weld::CheckButton
> m_xMainCB
;
388 std::unique_ptr
<weld::TreeView
> m_xSmartTagTypesLB
;
389 std::unique_ptr
<weld::Button
> m_xPropertiesPB
;
391 /** Inserts items into m_aSmartTagTypesLB
393 Reads out the smart tag types supported by the SmartTagMgr and
394 inserts the associated strings into the list box.
396 void FillListBox( const SmartTagMgr
& rSmartTagMgr
);
398 /** Clears the m_aSmartTagTypesLB
402 /** Handler for the check box
404 Enables/disables all controls in the tab page (except from the
407 DECL_LINK(CheckHdl
, weld::ToggleButton
&, void);
409 /** Handler for the push button
411 Calls the displayPropertyPage function of the smart tag recognizer
412 associated with the currently selected smart tag type.
414 DECL_LINK(ClickHdl
, weld::Button
&, void);
416 /** Handler for the list box
418 Enables/disables the properties push button if selection in the
419 smart tag types list box changes.
421 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
424 /// construction via Create()
425 OfaSmartTagOptionsTabPage(TabPageParent pParent
, const SfxItemSet
& rSet
);
426 virtual ~OfaSmartTagOptionsTabPage() override
;
428 static VclPtr
<SfxTabPage
> Create( TabPageParent pParent
, const SfxItemSet
* rAttrSet
);
430 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
431 virtual void Reset( const SfxItemSet
* rSet
) override
;
432 virtual void ActivatePage( const SfxItemSet
& ) override
;
437 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */