sd: keep a non-owning pointer to the OverridingShell
[LibreOffice.git] / cui / source / inc / autocdlg.hxx
blob2677b8535ebef4fd0aab2570c94dcb30531e51d7
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 sBulletsAfterSpace;
101 OUString sBorder;
102 OUString sTable;
103 OUString sReplaceTemplates;
104 OUString sDelSpaceAtSttEnd;
105 OUString sDelSpaceBetweenLines;
107 OUString sMargin;
108 OUString sBulletChar;
109 OUString sByInputBulletChar;
111 vcl::Font aBulletFont;
112 vcl::Font aByInputBulletFont;
113 sal_uInt16 nPercent;
115 std::unique_ptr<weld::TreeView> m_xCheckLB;
116 std::unique_ptr<weld::Button> m_xEditPB;
118 DECL_LINK(SelectHdl, weld::TreeView&, void);
119 DECL_LINK(EditHdl, weld::Button&, void);
120 DECL_LINK(DoubleClickEditHdl, weld::TreeView&, bool);
122 void CreateEntry(const OUString& rTxt, sal_uInt16 nCol);
124 public:
125 OfaSwAutoFmtOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
126 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
127 const SfxItemSet* rAttrSet);
128 virtual ~OfaSwAutoFmtOptionsPage() override;
130 virtual bool FillItemSet( SfxItemSet* rSet ) override;
131 virtual void Reset( const SfxItemSet* rSet ) override;
132 virtual void ActivatePage( const SfxItemSet& ) override;
135 // class OfaAutocorrReplacePage ------------------------------------------
137 struct DoubleString
139 OUString sShort;
140 OUString sLong;
141 void* pUserData; ///< CheckBox -> form. Text Bool -> selection text
142 DoubleString(OUString aShort, OUString aLong)
143 : sShort(std::move(aShort))
144 , sLong(std::move(aLong))
145 , pUserData(nullptr)
150 typedef std::vector<DoubleString> DoubleStringArray;
152 struct StringChangeList
154 DoubleStringArray aNewEntries;
155 DoubleStringArray aDeletedEntries;
158 typedef std::map<LanguageType, StringChangeList> StringChangeTable;
160 class OfaAutocorrReplacePage : public SfxTabPage
162 private:
164 StringChangeTable aChangesTable;
166 OUString sModify;
167 OUString sNew;
169 std::set<OUString> aFormatText;
170 std::map<LanguageType, DoubleStringArray>
171 aDoubleStringTable;
172 CollatorWrapper maCompareClass;
173 std::unique_ptr<CharClass> pCharClass;
174 LanguageType eLang;
176 bool bHasSelectionText;
177 bool bFirstSelect:1;
178 bool bReplaceEditChanged:1;
179 bool bSWriter:1;
181 std::vector<int> m_aReplaceFixedWidths;
182 std::unique_ptr<weld::CheckButton> m_xTextOnlyCB;
183 std::unique_ptr<weld::Entry> m_xShortED;
184 std::unique_ptr<weld::Entry> m_xReplaceED;
185 std::unique_ptr<weld::TreeView> m_xReplaceTLB;
186 std::unique_ptr<weld::Button> m_xNewReplacePB;
187 std::unique_ptr<weld::Button> m_xReplacePB;
188 std::unique_ptr<weld::Button> m_xDeleteReplacePB;
189 std::unique_ptr<weld::Container> m_xButtonBox;
191 DECL_LINK(SelectHdl, weld::TreeView&, void);
192 DECL_LINK(NewDelButtonHdl, weld::Button&, void);
193 DECL_LINK(NewDelActionHdl, weld::Entry&, bool);
194 DECL_LINK(EntrySizeAllocHdl, const Size&, void);
195 DECL_LINK(ModifyHdl, weld::Entry&, void);
196 bool NewDelHdl(const weld::Widget*);
198 void RefillReplaceBox( bool bFromReset,
199 LanguageType eOldLanguage,
200 LanguageType eNewLanguage);
202 public:
203 OfaAutocorrReplacePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
204 virtual ~OfaAutocorrReplacePage() override;
206 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
208 virtual bool FillItemSet( SfxItemSet* rSet ) override;
209 virtual void Reset( const SfxItemSet* rSet ) override;
210 virtual void ActivatePage( const SfxItemSet& ) override;
211 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
213 void SetLanguage(LanguageType eSet);
214 void DeleteEntry(const OUString& sShort, const OUString& sLong);
215 void NewEntry(const OUString& sShort, const OUString& sLong, bool bKeepSourceFormatting);
218 // class OfaAutocorrExceptPage ---------------------------------------------
220 struct StringsArrays
222 std::vector<OUString> aAbbrevStrings;
223 std::vector<OUString> aDoubleCapsStrings;
225 StringsArrays() { }
227 typedef std::map<LanguageType, StringsArrays> StringsTable;
229 class OfaAutocorrExceptPage : public SfxTabPage
231 private:
232 StringsTable aStringsTable;
233 CollatorWrapper maCompareClass;
234 LanguageType eLang;
236 std::unique_ptr<weld::Entry> m_xAbbrevED;
237 std::unique_ptr<weld::TreeView> m_xAbbrevLB;
238 std::unique_ptr<weld::Button> m_xNewAbbrevPB;
239 std::unique_ptr<weld::Button> m_xDelAbbrevPB;
240 std::unique_ptr<weld::CheckButton> m_xAutoAbbrevCB;
242 std::unique_ptr<weld::Entry> m_xDoubleCapsED;
243 std::unique_ptr<weld::TreeView> m_xDoubleCapsLB;
244 std::unique_ptr<weld::Button> m_xNewDoublePB;
245 std::unique_ptr<weld::Button> m_xDelDoublePB;
246 std::unique_ptr<weld::CheckButton> m_xAutoCapsCB;
248 DECL_LINK(NewDelButtonHdl, weld::Button&, void);
249 DECL_LINK(NewDelActionHdl, weld::Entry&, bool);
250 DECL_LINK(SelectHdl, weld::TreeView&, void);
251 DECL_LINK(ModifyHdl, weld::Entry&, void);
252 bool NewDelHdl(const weld::Widget*);
253 /// Box filled with new language
254 void RefillReplaceBoxes(bool bFromReset,
255 LanguageType eOldLanguage,
256 LanguageType eNewLanguage);
257 public:
258 OfaAutocorrExceptPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
259 virtual ~OfaAutocorrExceptPage() override;
261 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
262 const SfxItemSet* rAttrSet);
264 virtual bool FillItemSet( SfxItemSet* rSet ) override;
265 virtual void Reset( const SfxItemSet* rSet ) override;
266 virtual void ActivatePage( const SfxItemSet& ) override;
267 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
268 void SetLanguage(LanguageType eSet);
272 // class OfaQuoteTabPage -------------------------------------------------
274 class OfaQuoteTabPage : public SfxTabPage
276 private:
277 OUString sNonBrkSpace;
278 OUString sOrdinal;
279 OUString sTransliterateRTL;
280 OUString sAngleQuotes;
282 sal_UCS4 cSglStartQuote;
283 sal_UCS4 cSglEndQuote;
285 sal_UCS4 cStartQuote;
286 sal_UCS4 cEndQuote;
288 std::unique_ptr<weld::CheckButton> m_xSingleTypoCB;
289 std::unique_ptr<weld::Button> m_xSglStartQuotePB;
290 std::unique_ptr<weld::Label> m_xSglStartExFT;
291 std::unique_ptr<weld::Button> m_xSglEndQuotePB;
292 std::unique_ptr<weld::Label> m_xSglEndExFT;
293 std::unique_ptr<weld::Button> m_xSglStandardPB;
294 std::unique_ptr<weld::CheckButton> m_xDoubleTypoCB;
295 std::unique_ptr<weld::Button> m_xDblStartQuotePB;
296 std::unique_ptr<weld::Label> m_xDblStartExFT;
297 std::unique_ptr<weld::Button> m_xDblEndQuotePB;
298 std::unique_ptr<weld::Label> m_xDblEndExFT;
299 std::unique_ptr<weld::Button> m_xDblStandardPB;
300 OUString m_sStandard;
301 /// For anything but writer
302 std::unique_ptr<weld::TreeView> m_xCheckLB;
303 /// Just for writer
304 std::unique_ptr<weld::TreeView> m_xSwCheckLB;
307 DECL_LINK(QuoteHdl, weld::Button&, void);
308 DECL_LINK(StdQuoteHdl, weld::Button&, void);
310 OUString ChangeStringExt_Impl( sal_UCS4 );
312 static void CreateEntry(weld::TreeView& rLstBox, const OUString& rTxt,
313 sal_uInt16 nCol, sal_uInt16 nTextCol);
315 public:
316 OfaQuoteTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
317 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController,
318 const SfxItemSet* rAttrSet);
319 virtual ~OfaQuoteTabPage() override;
321 virtual bool FillItemSet( SfxItemSet* rSet ) override;
322 virtual void Reset( const SfxItemSet* rSet ) override;
323 virtual void ActivatePage( const SfxItemSet& ) override;
326 // class OfaAutoCompleteTabPage ---------------------------------------------
328 class OfaAutoCompleteTabPage : public SfxTabPage
330 private:
331 editeng::SortedAutoCompleteStrings* m_pAutoCompleteList;
332 sal_uInt16 m_nAutoCmpltListCnt;
334 std::unique_ptr<weld::CheckButton> m_xCBActiv; ///<Enable word completion
335 std::unique_ptr<weld::CheckButton> m_xCBAppendSpace;///<Append space
336 std::unique_ptr<weld::CheckButton> m_xCBAsTip; ///<Show as tip
338 std::unique_ptr<weld::CheckButton> m_xCBCollect;///<Collect words
339 std::unique_ptr<weld::CheckButton> m_xCBRemoveList;///<...save the list for later use...
341 std::unique_ptr<weld::ComboBox> m_xDCBExpandKey;
342 std::unique_ptr<weld::SpinButton> m_xNFMinWordlen;
343 std::unique_ptr<weld::SpinButton> m_xNFMaxEntries;
344 std::unique_ptr<weld::TreeView> m_xLBEntries;
345 std::unique_ptr<weld::Button> m_xPBEntries;
347 DECL_LINK(CheckHdl, weld::Toggleable&, void);
348 DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
350 public:
351 OfaAutoCompleteTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
352 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController,
353 const SfxItemSet* rAttrSet);
354 virtual ~OfaAutoCompleteTabPage() override;
356 virtual bool FillItemSet( SfxItemSet* rSet ) override;
357 virtual void Reset( const SfxItemSet* rSet ) override;
358 virtual void ActivatePage( const SfxItemSet& ) override;
360 void CopyToClipboard() const;
361 DECL_LINK(DeleteHdl, weld::Button&, void);
364 // class OfaSmartTagOptionsTabPage ---------------------------------------------
366 /** Smart tag options tab page
368 This tab page is used to enable/disable smart tag types
370 class OfaSmartTagOptionsTabPage : public SfxTabPage
372 private:
374 // controls
375 std::unique_ptr<weld::CheckButton> m_xMainCB;
376 std::unique_ptr<weld::TreeView> m_xSmartTagTypesLB;
377 std::unique_ptr<weld::Button> m_xPropertiesPB;
379 /** Inserts items into m_aSmartTagTypesLB
381 Reads out the smart tag types supported by the SmartTagMgr and
382 inserts the associated strings into the list box.
384 void FillListBox( const SmartTagMgr& rSmartTagMgr );
386 /** Clears the m_aSmartTagTypesLB
388 void ClearListBox();
390 /** Handler for the check box
392 Enables/disables all controls in the tab page (except from the
393 check box.
395 DECL_LINK(CheckHdl, weld::Toggleable&, void);
397 /** Handler for the push button
399 Calls the displayPropertyPage function of the smart tag recognizer
400 associated with the currently selected smart tag type.
402 DECL_LINK(ClickHdl, weld::Button&, void);
404 /** Handler for the list box
406 Enables/disables the properties push button if selection in the
407 smart tag types list box changes.
409 DECL_LINK(SelectHdl, weld::TreeView&, void);
411 public:
412 /// construction via Create()
413 OfaSmartTagOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
414 virtual ~OfaSmartTagOptionsTabPage() override;
416 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
418 virtual bool FillItemSet( SfxItemSet* rSet ) override;
419 virtual void Reset( const SfxItemSet* rSet ) override;
420 virtual void ActivatePage( const SfxItemSet& ) override;
423 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */