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 <svx/langbox.hxx>
24 #include <vcl/metric.hxx>
29 class CollatorWrapper
;
32 namespace editeng
{ class SortedAutoCompleteStrings
; }
34 // class OfaAutoCorrDlg --------------------------------------------------
36 class OfaAutoCorrDlg
: public SfxTabDialogController
38 std::unique_ptr
<weld::Widget
> m_xLanguageBox
;
39 std::unique_ptr
<SvxLanguageBox
> m_xLanguageLB
;
41 DECL_LINK(SelectLanguageHdl
, weld::ComboBox
&, void);
44 OfaAutoCorrDlg(weld::Window
* pParent
, const SfxItemSet
*pSet
);
45 virtual ~OfaAutoCorrDlg() override
;
47 void EnableLanguage(bool bEnable
);
50 // class OfaAutocorrOptionsPage ------------------------------------------
52 class OfaAutocorrOptionsPage
: public SfxTabPage
56 OUString m_sDoubleCaps
;
58 OUString m_sBoldUnderline
;
60 OUString m_sNoDblSpaces
;
62 OUString m_sAccidentalCaps
;
64 std::unique_ptr
<weld::TreeView
> m_xCheckLB
;
66 void InsertEntry(const OUString
& rTxt
);
69 OfaAutocorrOptionsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
70 virtual ~OfaAutocorrOptionsPage() override
;
72 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
73 const SfxItemSet
* rAttrSet
);
75 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
76 virtual void Reset( const SfxItemSet
* rSet
) override
;
77 virtual void ActivatePage( const SfxItemSet
& ) override
;
81 // class OfaSwAutoFmtOptionsPage ----------------------------------------------------
83 class OfaSwAutoFmtOptionsPage
: public SfxTabPage
85 OUString sDeleteEmptyPara
;
86 OUString sUseReplaceTbl
;
87 OUString sCapitalStartWord
;
88 OUString sCapitalStartSentence
;
92 OUString sNoDblSpaces
;
93 OUString sCorrectCapsLock
;
96 OUString sRightMargin
;
100 OUString sReplaceTemplates
;
101 OUString sDelSpaceAtSttEnd
;
102 OUString sDelSpaceBetweenLines
;
105 OUString sBulletChar
;
106 OUString sByInputBulletChar
;
108 vcl::Font aBulletFont
;
109 vcl::Font aByInputBulletFont
;
112 std::unique_ptr
<weld::TreeView
> m_xCheckLB
;
113 std::unique_ptr
<weld::Button
> m_xEditPB
;
115 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
116 DECL_LINK(EditHdl
, weld::Button
&, void);
117 DECL_LINK(DoubleClickEditHdl
, weld::TreeView
&, bool);
119 void CreateEntry(const OUString
& rTxt
, sal_uInt16 nCol
);
122 OfaSwAutoFmtOptionsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
123 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
124 const SfxItemSet
* rAttrSet
);
125 virtual ~OfaSwAutoFmtOptionsPage() override
;
127 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
128 virtual void Reset( const SfxItemSet
* rSet
) override
;
129 virtual void ActivatePage( const SfxItemSet
& ) override
;
132 // class OfaAutocorrReplacePage ------------------------------------------
138 void* pUserData
; ///< CheckBox -> form. Text Bool -> selection text
141 typedef std::vector
<DoubleString
> DoubleStringArray
;
143 struct StringChangeList
145 DoubleStringArray aNewEntries
;
146 DoubleStringArray aDeletedEntries
;
149 typedef std::map
<LanguageType
, StringChangeList
> StringChangeTable
;
151 class OfaAutocorrReplacePage
: public SfxTabPage
155 StringChangeTable aChangesTable
;
160 std::set
<OUString
> aFormatText
;
161 std::map
<LanguageType
, DoubleStringArray
>
163 std::unique_ptr
<CollatorWrapper
> pCompareClass
;
164 std::unique_ptr
<CharClass
> pCharClass
;
167 bool bHasSelectionText
;
169 bool bReplaceEditChanged
:1;
172 std::vector
<int> m_aReplaceFixedWidths
;
173 std::unique_ptr
<weld::CheckButton
> m_xTextOnlyCB
;
174 std::unique_ptr
<weld::Entry
> m_xShortED
;
175 std::unique_ptr
<weld::Entry
> m_xReplaceED
;
176 std::unique_ptr
<weld::TreeView
> m_xReplaceTLB
;
177 std::unique_ptr
<weld::Button
> m_xNewReplacePB
;
178 std::unique_ptr
<weld::Button
> m_xReplacePB
;
179 std::unique_ptr
<weld::Button
> m_xDeleteReplacePB
;
180 std::unique_ptr
<weld::Container
> m_xButtonBox
;
182 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
183 DECL_LINK(NewDelButtonHdl
, weld::Button
&, void);
184 DECL_LINK(NewDelActionHdl
, weld::Entry
&, bool);
185 DECL_LINK(EntrySizeAllocHdl
, const Size
&, void);
186 DECL_LINK(ModifyHdl
, weld::Entry
&, void);
187 bool NewDelHdl(const weld::Widget
*);
189 void RefillReplaceBox( bool bFromReset
,
190 LanguageType eOldLanguage
,
191 LanguageType eNewLanguage
);
194 OfaAutocorrReplacePage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
195 virtual ~OfaAutocorrReplacePage() override
;
197 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
199 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
200 virtual void Reset( const SfxItemSet
* rSet
) override
;
201 virtual void ActivatePage( const SfxItemSet
& ) override
;
202 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
204 void SetLanguage(LanguageType eSet
);
205 void DeleteEntry(const OUString
& sShort
, const OUString
& sLong
);
206 void NewEntry(const OUString
& sShort
, const OUString
& sLong
, bool bKeepSourceFormatting
);
209 // class OfaAutocorrExceptPage ---------------------------------------------
213 std::vector
<OUString
> aAbbrevStrings
;
214 std::vector
<OUString
> aDoubleCapsStrings
;
218 typedef std::map
<LanguageType
, StringsArrays
> StringsTable
;
220 class OfaAutocorrExceptPage
: public SfxTabPage
223 StringsTable aStringsTable
;
224 std::unique_ptr
<CollatorWrapper
> pCompareClass
;
227 std::unique_ptr
<weld::Entry
> m_xAbbrevED
;
228 std::unique_ptr
<weld::TreeView
> m_xAbbrevLB
;
229 std::unique_ptr
<weld::Button
> m_xNewAbbrevPB
;
230 std::unique_ptr
<weld::Button
> m_xDelAbbrevPB
;
231 std::unique_ptr
<weld::CheckButton
> m_xAutoAbbrevCB
;
233 std::unique_ptr
<weld::Entry
> m_xDoubleCapsED
;
234 std::unique_ptr
<weld::TreeView
> m_xDoubleCapsLB
;
235 std::unique_ptr
<weld::Button
> m_xNewDoublePB
;
236 std::unique_ptr
<weld::Button
> m_xDelDoublePB
;
237 std::unique_ptr
<weld::CheckButton
> m_xAutoCapsCB
;
239 DECL_LINK(NewDelButtonHdl
, weld::Button
&, void);
240 DECL_LINK(NewDelActionHdl
, weld::Entry
&, bool);
241 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
242 DECL_LINK(ModifyHdl
, weld::Entry
&, void);
243 void NewDelHdl(const weld::Widget
*);
244 /// Box filled with new language
245 void RefillReplaceBoxes(bool bFromReset
,
246 LanguageType eOldLanguage
,
247 LanguageType eNewLanguage
);
249 OfaAutocorrExceptPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
250 virtual ~OfaAutocorrExceptPage() override
;
252 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
253 const SfxItemSet
* rAttrSet
);
255 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
256 virtual void Reset( const SfxItemSet
* rSet
) override
;
257 virtual void ActivatePage( const SfxItemSet
& ) override
;
258 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
259 void SetLanguage(LanguageType eSet
);
263 // class OfaQuoteTabPage -------------------------------------------------
265 class OfaQuoteTabPage
: public SfxTabPage
268 OUString sNonBrkSpace
;
271 sal_UCS4 cSglStartQuote
;
272 sal_UCS4 cSglEndQuote
;
274 sal_UCS4 cStartQuote
;
277 std::unique_ptr
<weld::CheckButton
> m_xSingleTypoCB
;
278 std::unique_ptr
<weld::Button
> m_xSglStartQuotePB
;
279 std::unique_ptr
<weld::Label
> m_xSglStartExFT
;
280 std::unique_ptr
<weld::Button
> m_xSglEndQuotePB
;
281 std::unique_ptr
<weld::Label
> m_xSglEndExFT
;
282 std::unique_ptr
<weld::Button
> m_xSglStandardPB
;
283 std::unique_ptr
<weld::CheckButton
> m_xDoubleTypoCB
;
284 std::unique_ptr
<weld::Button
> m_xDblStartQuotePB
;
285 std::unique_ptr
<weld::Label
> m_xDblStartExFT
;
286 std::unique_ptr
<weld::Button
> m_xDblEndQuotePB
;
287 std::unique_ptr
<weld::Label
> m_xDblEndExFT
;
288 std::unique_ptr
<weld::Button
> m_xDblStandardPB
;
289 OUString m_sStandard
;
290 /// For anything but writer
291 std::unique_ptr
<weld::TreeView
> m_xCheckLB
;
293 std::unique_ptr
<weld::TreeView
> m_xSwCheckLB
;
296 DECL_LINK(QuoteHdl
, weld::Button
&, void);
297 DECL_LINK(StdQuoteHdl
, weld::Button
&, void);
299 OUString
ChangeStringExt_Impl( sal_UCS4
);
301 static void CreateEntry(weld::TreeView
& rLstBox
, const OUString
& rTxt
,
302 sal_uInt16 nCol
, sal_uInt16 nTextCol
);
305 OfaQuoteTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
306 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
,
307 const SfxItemSet
* rAttrSet
);
308 virtual ~OfaQuoteTabPage() override
;
310 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
311 virtual void Reset( const SfxItemSet
* rSet
) override
;
312 virtual void ActivatePage( const SfxItemSet
& ) override
;
315 // class OfaAutoCompleteTabPage ---------------------------------------------
317 class OfaAutoCompleteTabPage
: public SfxTabPage
320 editeng::SortedAutoCompleteStrings
* m_pAutoCompleteList
;
321 sal_uInt16 m_nAutoCmpltListCnt
;
323 std::unique_ptr
<weld::CheckButton
> m_xCBActiv
; ///<Enable word completion
324 std::unique_ptr
<weld::CheckButton
> m_xCBAppendSpace
;///<Append space
325 std::unique_ptr
<weld::CheckButton
> m_xCBAsTip
; ///<Show as tip
327 std::unique_ptr
<weld::CheckButton
> m_xCBCollect
;///<Collect words
328 std::unique_ptr
<weld::CheckButton
> m_xCBRemoveList
;///<...save the list for later use...
330 std::unique_ptr
<weld::ComboBox
> m_xDCBExpandKey
;
331 std::unique_ptr
<weld::SpinButton
> m_xNFMinWordlen
;
332 std::unique_ptr
<weld::SpinButton
> m_xNFMaxEntries
;
333 std::unique_ptr
<weld::TreeView
> m_xLBEntries
;
334 std::unique_ptr
<weld::Button
> m_xPBEntries
;
336 DECL_LINK(CheckHdl
, weld::ToggleButton
&, void);
337 DECL_LINK(KeyReleaseHdl
, const KeyEvent
&, bool);
340 OfaAutoCompleteTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
341 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
,
342 const SfxItemSet
* rAttrSet
);
343 virtual ~OfaAutoCompleteTabPage() override
;
345 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
346 virtual void Reset( const SfxItemSet
* rSet
) override
;
347 virtual void ActivatePage( const SfxItemSet
& ) override
;
349 void CopyToClipboard() const;
350 DECL_LINK(DeleteHdl
, weld::Button
&, void);
353 // class OfaSmartTagOptionsTabPage ---------------------------------------------
355 /** Smart tag options tab page
357 This tab page is used to enable/disable smart tag types
359 class OfaSmartTagOptionsTabPage
: public SfxTabPage
364 std::unique_ptr
<weld::CheckButton
> m_xMainCB
;
365 std::unique_ptr
<weld::TreeView
> m_xSmartTagTypesLB
;
366 std::unique_ptr
<weld::Button
> m_xPropertiesPB
;
368 /** Inserts items into m_aSmartTagTypesLB
370 Reads out the smart tag types supported by the SmartTagMgr and
371 inserts the associated strings into the list box.
373 void FillListBox( const SmartTagMgr
& rSmartTagMgr
);
375 /** Clears the m_aSmartTagTypesLB
379 /** Handler for the check box
381 Enables/disables all controls in the tab page (except from the
384 DECL_LINK(CheckHdl
, weld::ToggleButton
&, void);
386 /** Handler for the push button
388 Calls the displayPropertyPage function of the smart tag recognizer
389 associated with the currently selected smart tag type.
391 DECL_LINK(ClickHdl
, weld::Button
&, void);
393 /** Handler for the list box
395 Enables/disables the properties push button if selection in the
396 smart tag types list box changes.
398 DECL_LINK(SelectHdl
, weld::TreeView
&, void);
401 /// construction via Create()
402 OfaSmartTagOptionsTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
403 virtual ~OfaSmartTagOptionsTabPage() override
;
405 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rAttrSet
);
407 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
408 virtual void Reset( const SfxItemSet
* rSet
) override
;
409 virtual void ActivatePage( const SfxItemSet
& ) override
;
414 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */