Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / cui / source / inc / autocdlg.hxx
blob2357677ef65f831847d4b3cab75f765ac873f8a2
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 #pragma once
21 #include <sfx2/tabdlg.hxx>
22 #include <svx/langbox.hxx>
23 #include <unotools/collatorwrapper.hxx>
25 #include <map>
26 #include <set>
27 #include <utility>
29 class CharClass;
30 class SmartTagMgr;
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);
42 public:
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
54 private:
55 OUString m_sInput;
56 OUString m_sDoubleCaps;
57 OUString m_sStartCap;
58 OUString m_sBoldUnderline;
59 OUString m_sURL;
60 OUString m_sDOI;
61 OUString m_sNoDblSpaces;
62 OUString m_sDash;
63 OUString m_sAccidentalCaps;
65 std::unique_ptr<weld::TreeView> m_xCheckLB;
67 void InsertEntry(const OUString& rTxt);
69 public:
70 OfaAutocorrOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
71 virtual ~OfaAutocorrOptionsPage() override;
73 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
74 const SfxItemSet* rAttrSet);
76 virtual bool FillItemSet( SfxItemSet* rSet ) override;
77 virtual void Reset( const SfxItemSet* rSet ) override;
78 virtual void ActivatePage( const SfxItemSet& ) override;
82 // class OfaSwAutoFmtOptionsPage ----------------------------------------------------
84 class OfaSwAutoFmtOptionsPage : public SfxTabPage
86 OUString sDeleteEmptyPara;
87 OUString sUseReplaceTbl;
88 OUString sCapitalStartWord;
89 OUString sCapitalStartSentence;
90 OUString sUserStyle;
91 OUString sBullet;
92 OUString sBoldUnder;
93 OUString sNoDblSpaces;
94 OUString sCorrectCapsLock;
95 OUString sDetectURL;
96 OUString sDetectDOI;
97 OUString sDash;
98 OUString sRightMargin;
99 OUString sNum;
100 OUString sBorder;
101 OUString sTable;
102 OUString sReplaceTemplates;
103 OUString sDelSpaceAtSttEnd;
104 OUString sDelSpaceBetweenLines;
106 OUString sMargin;
107 OUString sBulletChar;
108 OUString sByInputBulletChar;
110 vcl::Font aBulletFont;
111 vcl::Font aByInputBulletFont;
112 sal_uInt16 nPercent;
114 std::unique_ptr<weld::TreeView> m_xCheckLB;
115 std::unique_ptr<weld::Button> m_xEditPB;
117 DECL_LINK(SelectHdl, weld::TreeView&, void);
118 DECL_LINK(EditHdl, weld::Button&, void);
119 DECL_LINK(DoubleClickEditHdl, weld::TreeView&, bool);
121 void CreateEntry(const OUString& rTxt, sal_uInt16 nCol);
123 public:
124 OfaSwAutoFmtOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
125 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
126 const SfxItemSet* rAttrSet);
127 virtual ~OfaSwAutoFmtOptionsPage() override;
129 virtual bool FillItemSet( SfxItemSet* rSet ) override;
130 virtual void Reset( const SfxItemSet* rSet ) override;
131 virtual void ActivatePage( const SfxItemSet& ) override;
134 // class OfaAutocorrReplacePage ------------------------------------------
136 struct DoubleString
138 OUString sShort;
139 OUString sLong;
140 void* pUserData; ///< CheckBox -> form. Text Bool -> selection text
141 DoubleString(OUString aShort, OUString aLong)
142 : sShort(std::move(aShort))
143 , sLong(std::move(aLong))
144 , pUserData(nullptr)
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 private:
163 StringChangeTable aChangesTable;
165 OUString sModify;
166 OUString sNew;
168 std::set<OUString> aFormatText;
169 std::map<LanguageType, DoubleStringArray>
170 aDoubleStringTable;
171 CollatorWrapper maCompareClass;
172 std::unique_ptr<CharClass> pCharClass;
173 LanguageType eLang;
175 bool bHasSelectionText;
176 bool bFirstSelect:1;
177 bool bReplaceEditChanged:1;
178 bool bSWriter:1;
180 std::vector<int> m_aReplaceFixedWidths;
181 std::unique_ptr<weld::CheckButton> m_xTextOnlyCB;
182 std::unique_ptr<weld::Entry> m_xShortED;
183 std::unique_ptr<weld::Entry> m_xReplaceED;
184 std::unique_ptr<weld::TreeView> m_xReplaceTLB;
185 std::unique_ptr<weld::Button> m_xNewReplacePB;
186 std::unique_ptr<weld::Button> m_xReplacePB;
187 std::unique_ptr<weld::Button> m_xDeleteReplacePB;
188 std::unique_ptr<weld::Container> m_xButtonBox;
190 DECL_LINK(SelectHdl, weld::TreeView&, void);
191 DECL_LINK(NewDelButtonHdl, weld::Button&, void);
192 DECL_LINK(NewDelActionHdl, weld::Entry&, bool);
193 DECL_LINK(EntrySizeAllocHdl, const Size&, void);
194 DECL_LINK(ModifyHdl, weld::Entry&, void);
195 bool NewDelHdl(const weld::Widget*);
197 void RefillReplaceBox( bool bFromReset,
198 LanguageType eOldLanguage,
199 LanguageType eNewLanguage);
201 public:
202 OfaAutocorrReplacePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
203 virtual ~OfaAutocorrReplacePage() override;
205 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
207 virtual bool FillItemSet( SfxItemSet* rSet ) override;
208 virtual void Reset( const SfxItemSet* rSet ) override;
209 virtual void ActivatePage( const SfxItemSet& ) override;
210 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
212 void SetLanguage(LanguageType eSet);
213 void DeleteEntry(const OUString& sShort, const OUString& sLong);
214 void NewEntry(const OUString& sShort, const OUString& sLong, bool bKeepSourceFormatting);
217 // class OfaAutocorrExceptPage ---------------------------------------------
219 struct StringsArrays
221 std::vector<OUString> aAbbrevStrings;
222 std::vector<OUString> aDoubleCapsStrings;
224 StringsArrays() { }
226 typedef std::map<LanguageType, StringsArrays> StringsTable;
228 class OfaAutocorrExceptPage : public SfxTabPage
230 private:
231 StringsTable aStringsTable;
232 CollatorWrapper maCompareClass;
233 LanguageType eLang;
235 std::unique_ptr<weld::Entry> m_xAbbrevED;
236 std::unique_ptr<weld::TreeView> m_xAbbrevLB;
237 std::unique_ptr<weld::Button> m_xNewAbbrevPB;
238 std::unique_ptr<weld::Button> m_xDelAbbrevPB;
239 std::unique_ptr<weld::CheckButton> m_xAutoAbbrevCB;
241 std::unique_ptr<weld::Entry> m_xDoubleCapsED;
242 std::unique_ptr<weld::TreeView> m_xDoubleCapsLB;
243 std::unique_ptr<weld::Button> m_xNewDoublePB;
244 std::unique_ptr<weld::Button> m_xDelDoublePB;
245 std::unique_ptr<weld::CheckButton> m_xAutoCapsCB;
247 DECL_LINK(NewDelButtonHdl, weld::Button&, void);
248 DECL_LINK(NewDelActionHdl, weld::Entry&, bool);
249 DECL_LINK(SelectHdl, weld::TreeView&, void);
250 DECL_LINK(ModifyHdl, weld::Entry&, void);
251 bool NewDelHdl(const weld::Widget*);
252 /// Box filled with new language
253 void RefillReplaceBoxes(bool bFromReset,
254 LanguageType eOldLanguage,
255 LanguageType eNewLanguage);
256 public:
257 OfaAutocorrExceptPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
258 virtual ~OfaAutocorrExceptPage() override;
260 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
261 const SfxItemSet* rAttrSet);
263 virtual bool FillItemSet( SfxItemSet* rSet ) override;
264 virtual void Reset( const SfxItemSet* rSet ) override;
265 virtual void ActivatePage( const SfxItemSet& ) override;
266 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
267 void SetLanguage(LanguageType eSet);
271 // class OfaQuoteTabPage -------------------------------------------------
273 class OfaQuoteTabPage : public SfxTabPage
275 private:
276 OUString sNonBrkSpace;
277 OUString sOrdinal;
278 OUString sTransliterateRTL;
279 OUString sAngleQuotes;
281 sal_UCS4 cSglStartQuote;
282 sal_UCS4 cSglEndQuote;
284 sal_UCS4 cStartQuote;
285 sal_UCS4 cEndQuote;
287 std::unique_ptr<weld::CheckButton> m_xSingleTypoCB;
288 std::unique_ptr<weld::Button> m_xSglStartQuotePB;
289 std::unique_ptr<weld::Label> m_xSglStartExFT;
290 std::unique_ptr<weld::Button> m_xSglEndQuotePB;
291 std::unique_ptr<weld::Label> m_xSglEndExFT;
292 std::unique_ptr<weld::Button> m_xSglStandardPB;
293 std::unique_ptr<weld::CheckButton> m_xDoubleTypoCB;
294 std::unique_ptr<weld::Button> m_xDblStartQuotePB;
295 std::unique_ptr<weld::Label> m_xDblStartExFT;
296 std::unique_ptr<weld::Button> m_xDblEndQuotePB;
297 std::unique_ptr<weld::Label> m_xDblEndExFT;
298 std::unique_ptr<weld::Button> m_xDblStandardPB;
299 OUString m_sStandard;
300 /// For anything but writer
301 std::unique_ptr<weld::TreeView> m_xCheckLB;
302 /// Just for writer
303 std::unique_ptr<weld::TreeView> m_xSwCheckLB;
306 DECL_LINK(QuoteHdl, weld::Button&, void);
307 DECL_LINK(StdQuoteHdl, weld::Button&, void);
309 OUString ChangeStringExt_Impl( sal_UCS4 );
311 static void CreateEntry(weld::TreeView& rLstBox, const OUString& rTxt,
312 sal_uInt16 nCol, sal_uInt16 nTextCol);
314 public:
315 OfaQuoteTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
316 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController,
317 const SfxItemSet* rAttrSet);
318 virtual ~OfaQuoteTabPage() override;
320 virtual bool FillItemSet( SfxItemSet* rSet ) override;
321 virtual void Reset( const SfxItemSet* rSet ) override;
322 virtual void ActivatePage( const SfxItemSet& ) override;
325 // class OfaAutoCompleteTabPage ---------------------------------------------
327 class OfaAutoCompleteTabPage : public SfxTabPage
329 private:
330 editeng::SortedAutoCompleteStrings* m_pAutoCompleteList;
331 sal_uInt16 m_nAutoCmpltListCnt;
333 std::unique_ptr<weld::CheckButton> m_xCBActiv; ///<Enable word completion
334 std::unique_ptr<weld::CheckButton> m_xCBAppendSpace;///<Append space
335 std::unique_ptr<weld::CheckButton> m_xCBAsTip; ///<Show as tip
337 std::unique_ptr<weld::CheckButton> m_xCBCollect;///<Collect words
338 std::unique_ptr<weld::CheckButton> m_xCBRemoveList;///<...save the list for later use...
340 std::unique_ptr<weld::ComboBox> m_xDCBExpandKey;
341 std::unique_ptr<weld::SpinButton> m_xNFMinWordlen;
342 std::unique_ptr<weld::SpinButton> m_xNFMaxEntries;
343 std::unique_ptr<weld::TreeView> m_xLBEntries;
344 std::unique_ptr<weld::Button> m_xPBEntries;
346 DECL_LINK(CheckHdl, weld::Toggleable&, void);
347 DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
349 public:
350 OfaAutoCompleteTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
351 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController,
352 const SfxItemSet* rAttrSet);
353 virtual ~OfaAutoCompleteTabPage() override;
355 virtual bool FillItemSet( SfxItemSet* rSet ) override;
356 virtual void Reset( const SfxItemSet* rSet ) override;
357 virtual void ActivatePage( const SfxItemSet& ) override;
359 void CopyToClipboard() const;
360 DECL_LINK(DeleteHdl, weld::Button&, void);
363 // class OfaSmartTagOptionsTabPage ---------------------------------------------
365 /** Smart tag options tab page
367 This tab page is used to enable/disable smart tag types
369 class OfaSmartTagOptionsTabPage : public SfxTabPage
371 private:
373 // controls
374 std::unique_ptr<weld::CheckButton> m_xMainCB;
375 std::unique_ptr<weld::TreeView> m_xSmartTagTypesLB;
376 std::unique_ptr<weld::Button> m_xPropertiesPB;
378 /** Inserts items into m_aSmartTagTypesLB
380 Reads out the smart tag types supported by the SmartTagMgr and
381 inserts the associated strings into the list box.
383 void FillListBox( const SmartTagMgr& rSmartTagMgr );
385 /** Clears the m_aSmartTagTypesLB
387 void ClearListBox();
389 /** Handler for the check box
391 Enables/disables all controls in the tab page (except from the
392 check box.
394 DECL_LINK(CheckHdl, weld::Toggleable&, void);
396 /** Handler for the push button
398 Calls the displayPropertyPage function of the smart tag recognizer
399 associated with the currently selected smart tag type.
401 DECL_LINK(ClickHdl, weld::Button&, void);
403 /** Handler for the list box
405 Enables/disables the properties push button if selection in the
406 smart tag types list box changes.
408 DECL_LINK(SelectHdl, weld::TreeView&, void);
410 public:
411 /// construction via Create()
412 OfaSmartTagOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
413 virtual ~OfaSmartTagOptionsTabPage() override;
415 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
417 virtual bool FillItemSet( SfxItemSet* rSet ) override;
418 virtual void Reset( const SfxItemSet* rSet ) override;
419 virtual void ActivatePage( const SfxItemSet& ) override;
422 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */