Bump version to 6.4.7.2.M8
[LibreOffice.git] / cui / source / inc / autocdlg.hxx
blob4a283c8229ad7276b0af115a529664ec72696e75
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 #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>
26 #include <set>
28 class CharClass;
29 class CollatorWrapper;
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_sNoDblSpaces;
61 OUString m_sDash;
62 OUString m_sAccidentalCaps;
64 std::unique_ptr<weld::TreeView> m_xCheckLB;
66 void InsertEntry(const OUString& rTxt);
68 public:
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;
89 OUString sUserStyle;
90 OUString sBullet;
91 OUString sBoldUnder;
92 OUString sNoDblSpaces;
93 OUString sCorrectCapsLock;
94 OUString sDetectURL;
95 OUString sDash;
96 OUString sRightMargin;
97 OUString sNum;
98 OUString sBorder;
99 OUString sTable;
100 OUString sReplaceTemplates;
101 OUString sDelSpaceAtSttEnd;
102 OUString sDelSpaceBetweenLines;
104 OUString sMargin;
105 OUString sBulletChar;
106 OUString sByInputBulletChar;
108 vcl::Font aBulletFont;
109 vcl::Font aByInputBulletFont;
110 sal_uInt16 nPercent;
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);
121 public:
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 ------------------------------------------
134 struct DoubleString
136 OUString sShort;
137 OUString sLong;
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
153 private:
155 StringChangeTable aChangesTable;
157 OUString sModify;
158 OUString sNew;
160 std::set<OUString> aFormatText;
161 std::map<LanguageType, DoubleStringArray>
162 aDoubleStringTable;
163 std::unique_ptr<CollatorWrapper> pCompareClass;
164 std::unique_ptr<CharClass> pCharClass;
165 LanguageType eLang;
167 bool bHasSelectionText;
168 bool bFirstSelect:1;
169 bool bReplaceEditChanged:1;
170 bool bSWriter: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);
193 public:
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 ---------------------------------------------
211 struct StringsArrays
213 std::vector<OUString> aAbbrevStrings;
214 std::vector<OUString> aDoubleCapsStrings;
216 StringsArrays() { }
218 typedef std::map<LanguageType, StringsArrays> StringsTable;
220 class OfaAutocorrExceptPage : public SfxTabPage
222 private:
223 StringsTable aStringsTable;
224 std::unique_ptr<CollatorWrapper> pCompareClass;
225 LanguageType eLang;
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);
248 public:
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
267 private:
268 OUString sNonBrkSpace;
269 OUString sOrdinal;
271 sal_UCS4 cSglStartQuote;
272 sal_UCS4 cSglEndQuote;
274 sal_UCS4 cStartQuote;
275 sal_UCS4 cEndQuote;
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;
292 /// Just for writer
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);
304 public:
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
319 private:
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);
339 public:
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
361 private:
363 // controls
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
377 void ClearListBox();
379 /** Handler for the check box
381 Enables/disables all controls in the tab page (except from the
382 check box.
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);
400 public:
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;
412 #endif
414 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */