/src/libreoffice/sw/inc/modcfg.hxx
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | #ifndef INCLUDED_SW_INC_MODCFG_HXX |
20 | | #define INCLUDED_SW_INC_MODCFG_HXX |
21 | | |
22 | | #include <unotools/configitem.hxx> |
23 | | #include "swdllapi.h" |
24 | | #include "authratr.hxx" |
25 | | #include "SwCapObjType.hxx" |
26 | | #include "tblenum.hxx" |
27 | | #include "itabenum.hxx" |
28 | | #include <caption.hxx> |
29 | | #include <tools/globname.hxx> |
30 | | #include <o3tl/typed_flags_set.hxx> |
31 | | |
32 | | #include <vector> |
33 | | #include <memory> |
34 | | |
35 | | // text format for the sending of messages ------------------------------ |
36 | | enum class MailTextFormats |
37 | | { |
38 | | NONE = 0x00, |
39 | | HTML = 0x01, |
40 | | RTF = 0x02, |
41 | | OFFICE = 0x04 |
42 | | }; |
43 | | namespace o3tl |
44 | | { |
45 | | template<> struct typed_flags<MailTextFormats> : is_typed_flags<MailTextFormats, 0x07> {}; |
46 | | } |
47 | | |
48 | | |
49 | | class InsCaptionOptArr |
50 | | { |
51 | | private: |
52 | | typedef std::vector<std::unique_ptr<InsCaptionOpt>> InsCapOptArr; |
53 | | InsCapOptArr m_InsCapOptArr; |
54 | | public: |
55 | | InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = nullptr); |
56 | | void Insert(InsCaptionOpt* pObj); |
57 | | }; |
58 | | |
59 | | class SAL_DLLPUBLIC_RTTI SwRevisionConfig final : public utl::ConfigItem |
60 | | { |
61 | | friend class SwModuleOptions; |
62 | | |
63 | | AuthorCharAttr m_aInsertAttr; //Revision/TextDisplay/Insert/Attribute // Redlining: author character attributes |
64 | | //Revision/TextDisplay/Insert/Color |
65 | | AuthorCharAttr m_aDeletedAttr; //Revision/TextDisplay/Delete/Attribute |
66 | | //Revision/TextDisplay/Delete/Color |
67 | | AuthorCharAttr m_aFormatAttr; //Revision/TextDisplay/ChangeAttribute/Attribute |
68 | | //Revision/TextDisplay/ChangeAttribute/Color |
69 | | sal_uInt16 m_nMarkAlign; //Revision/LinesChanged/Mark |
70 | | Color m_aMarkColor; //Revision/LinesChanged/Color |
71 | | |
72 | | static const css::uno::Sequence<OUString>& GetPropertyNames(); |
73 | | |
74 | | virtual void ImplCommit() override; |
75 | | |
76 | | public: |
77 | | SwRevisionConfig(); |
78 | | virtual ~SwRevisionConfig() override; |
79 | | |
80 | | virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; |
81 | | void Load(); |
82 | | using ConfigItem::SetModified; |
83 | | }; |
84 | | |
85 | | enum class SwCompareMode |
86 | | { |
87 | | Auto = 0, |
88 | | ByWord, |
89 | | ByChar |
90 | | }; |
91 | | |
92 | | class SAL_DLLPUBLIC_RTTI SwCompareConfig final : public utl::ConfigItem |
93 | | { |
94 | | friend class SwModuleOptions; |
95 | | |
96 | | SwCompareMode m_eCmpMode; //Compare/CompareDocuments; |
97 | | bool m_bUseRsid; //Compare/Settings/Use RSID |
98 | | /// Compare/Settings/Store RSID |
99 | | bool m_bStoreRsid; |
100 | | bool m_bIgnorePieces; //Compare/Settings/Ignore pieces of length |
101 | | sal_uInt16 m_nPieceLen; //Compare/Settings/Ignore pieces of length |
102 | | |
103 | | static const css::uno::Sequence<OUString>& GetPropertyNames(); |
104 | | |
105 | | virtual void ImplCommit() override; |
106 | | |
107 | | public: |
108 | | SwCompareConfig(); |
109 | | virtual ~SwCompareConfig() override; |
110 | | |
111 | | virtual void Notify( const css::uno::Sequence< OUString >& ) override; |
112 | | void Load(); |
113 | | using ConfigItem::SetModified; |
114 | | }; |
115 | | |
116 | | class SAL_DLLPUBLIC_RTTI SwInsertConfig final : public utl::ConfigItem |
117 | | { |
118 | | friend class SwModuleOptions; |
119 | | |
120 | | std::unique_ptr<InsCaptionOptArr> m_pCapOptions; |
121 | | std::unique_ptr<InsCaptionOpt> m_pOLEMiscOpt; |
122 | | |
123 | | SvGlobalName m_aGlobalNames[5]; |
124 | | |
125 | | bool m_bInsWithCaption; //Insert/Caption/Automatic |
126 | | bool m_bCaptionOrderNumberingFirst; //#i61007# caption order starting with numbering |
127 | | |
128 | | SwInsertTableOptions m_aInsTableOpts; |
129 | | bool m_bIsWeb; |
130 | | |
131 | | const css::uno::Sequence<OUString>& GetPropertyNames() const; |
132 | | |
133 | | virtual void ImplCommit() override; |
134 | | |
135 | | public: |
136 | | SwInsertConfig(bool bWeb); |
137 | | virtual ~SwInsertConfig() override; |
138 | | |
139 | | virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; |
140 | | void Load(); |
141 | | using ConfigItem::SetModified; |
142 | | }; |
143 | | |
144 | | class SAL_DLLPUBLIC_RTTI SwTableConfig final : public utl::ConfigItem |
145 | | { |
146 | | friend class SwModuleOptions; |
147 | | |
148 | | sal_uInt16 m_nTableHMove; //int Table/Shift/Row |
149 | | sal_uInt16 m_nTableVMove; //int Table/Shift/Column |
150 | | sal_uInt16 m_nTableHInsert; //int Table/Insert/Row |
151 | | sal_uInt16 m_nTableVInsert; //int Table/Insert/Column |
152 | | TableChgMode m_eTableChgMode; //int Table/Change/Effect |
153 | | |
154 | | bool m_bInsTableFormatNum; // Table/Input/NumberRecognition // Automatic recognition of numbers. |
155 | | bool m_bInsTableChangeNumFormat; // Table/Input/NumberFormatRecognition // Automatic recognition of number formats. |
156 | | bool m_bInsTableAlignNum; // Table/Input/Alignment // Align numbers. |
157 | | bool m_bSplitVerticalByDefault; // Table/Input/SplitVerticalByDefault // Split vertical by default. |
158 | | |
159 | | static const css::uno::Sequence<OUString>& GetPropertyNames(); |
160 | | |
161 | | virtual void ImplCommit() override; |
162 | | |
163 | | public: |
164 | | SwTableConfig(bool bWeb); |
165 | | virtual ~SwTableConfig() override; |
166 | | |
167 | | virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; |
168 | | void Load(); |
169 | | using ConfigItem::SetModified; |
170 | | }; |
171 | | |
172 | | class SAL_DLLPUBLIC_RTTI SwMiscConfig final : public utl::ConfigItem |
173 | | { |
174 | | friend class SwModuleOptions; |
175 | | |
176 | | OUString m_sWordDelimiter; // Statistics/WordNumber/Delimiter |
177 | | bool m_bDefaultFontsInCurrDocOnly; // DefaultFont/Document |
178 | | bool m_bShowIndexPreview; // Index/ShowPreview |
179 | | bool m_bGrfToGalleryAsLnk; // Misc/GraphicToGalleryAsLink |
180 | | bool m_bNumAlignSize; // Numbering/Graphic/KeepRatio |
181 | | bool m_bIsNameFromColumn; // FormLetter/FileOutput/FileName/Generation |
182 | | bool m_bIsPasswordFromColumn; // FormLetter/FileOutput/FilePassword/Generation |
183 | | bool m_bAskForMailMergeInPrint; // Ask if documents containing fields should be 'mailmerged' |
184 | | MailTextFormats m_nMailingFormats; // FormLetter/MailingOutput/Formats |
185 | | OUString m_sNameFromColumn; // FormLetter/FileOutput/FileName/FromDatabaseField (string!) |
186 | | OUString m_sPasswordFromColumn; // FormLetter/FileOutput/FilePassword/FromDatabaseField (string!) |
187 | | OUString m_sMailingPath; // FormLetter/FileOutput/Path |
188 | | OUString m_sMailName; // FormLetter/FileOutput/FileName/FromManualSetting (string!) |
189 | | |
190 | | static const css::uno::Sequence<OUString>& GetPropertyNames(); |
191 | | |
192 | | virtual void ImplCommit() override; |
193 | | |
194 | | public: |
195 | | SwMiscConfig(); |
196 | | virtual ~SwMiscConfig() override; |
197 | | |
198 | | virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override; |
199 | | void Load(); |
200 | | using ConfigItem::SetModified; |
201 | | }; |
202 | | |
203 | | class SW_DLLPUBLIC SwModuleOptions |
204 | | { |
205 | | SwRevisionConfig m_aRevisionConfig; |
206 | | SwInsertConfig m_aInsertConfig; |
207 | | SwInsertConfig m_aWebInsertConfig; |
208 | | |
209 | | SwTableConfig m_aTableConfig; |
210 | | SwTableConfig m_aWebTableConfig; |
211 | | |
212 | | SwMiscConfig m_aMiscConfig; |
213 | | |
214 | | SwCompareConfig m_aCompareConfig; |
215 | | |
216 | | //fiscus: don't show tips of text fields - it's not part of the configuration! |
217 | | bool m_bHideFieldTips : 1; |
218 | | |
219 | | public: |
220 | | SwModuleOptions(); |
221 | | |
222 | 74.0k | TableChgMode GetTableMode() const { return m_aTableConfig.m_eTableChgMode;} |
223 | 0 | void SetTableMode( TableChgMode eSet ) { m_aTableConfig.m_eTableChgMode = eSet; |
224 | 0 | m_aTableConfig.SetModified();} |
225 | | |
226 | 0 | sal_uInt16 GetTableHMove() const { return m_aTableConfig.m_nTableHMove;} |
227 | 0 | void SetTableHMove( sal_uInt16 nSet ) { m_aTableConfig.m_nTableHMove = nSet; |
228 | 0 | m_aTableConfig.SetModified();} |
229 | | |
230 | 0 | sal_uInt16 GetTableVMove() const { return m_aTableConfig.m_nTableVMove;} |
231 | 0 | void SetTableVMove( sal_uInt16 nSet ) { m_aTableConfig.m_nTableVMove = nSet; |
232 | 0 | m_aTableConfig.SetModified();} |
233 | | |
234 | 0 | sal_uInt16 GetTableHInsert() const {return m_aTableConfig.m_nTableHInsert;} |
235 | 0 | void SetTableHInsert( sal_uInt16 nSet ) { m_aTableConfig.m_nTableHInsert = nSet; |
236 | 0 | m_aTableConfig.SetModified();} |
237 | | |
238 | 0 | sal_uInt16 GetTableVInsert() const {return m_aTableConfig.m_nTableVInsert;} |
239 | 0 | void SetTableVInsert( sal_uInt16 nSet ) { m_aTableConfig.m_nTableVInsert = nSet; |
240 | 0 | m_aTableConfig.SetModified();} |
241 | | |
242 | 50 | const AuthorCharAttr &GetInsertAuthorAttr() const { return m_aRevisionConfig.m_aInsertAttr; } |
243 | 0 | void SetInsertAuthorAttr( AuthorCharAttr const &rAttr ) { m_aRevisionConfig.m_aInsertAttr = rAttr; |
244 | 0 | m_aRevisionConfig.SetModified();} |
245 | | |
246 | 0 | const AuthorCharAttr &GetDeletedAuthorAttr() const { return m_aRevisionConfig.m_aDeletedAttr; } |
247 | 0 | void SetDeletedAuthorAttr( AuthorCharAttr const &rAttr ) { m_aRevisionConfig.m_aDeletedAttr = rAttr; |
248 | 0 | m_aRevisionConfig.SetModified();} |
249 | | |
250 | 0 | const AuthorCharAttr &GetFormatAuthorAttr() const { return m_aRevisionConfig.m_aFormatAttr; } |
251 | 0 | void SetFormatAuthorAttr( AuthorCharAttr const &rAttr ) { m_aRevisionConfig.m_aFormatAttr = rAttr; |
252 | 0 | m_aRevisionConfig.SetModified();} |
253 | | |
254 | 266k | sal_uInt16 GetMarkAlignMode() const { return m_aRevisionConfig.m_nMarkAlign; } |
255 | 0 | void SetMarkAlignMode(sal_uInt16 nMode) { m_aRevisionConfig.m_nMarkAlign = nMode; |
256 | 0 | m_aRevisionConfig.SetModified();} |
257 | | |
258 | 0 | const Color& GetMarkAlignColor() const { return m_aRevisionConfig.m_aMarkColor; } |
259 | 0 | void SetMarkAlignColor(const Color &rColor) { m_aRevisionConfig.m_aMarkColor = rColor; |
260 | 0 | m_aRevisionConfig.SetModified();} |
261 | | |
262 | | bool IsInsWithCaption(bool bHTML) const |
263 | 0 | { return !bHTML && m_aInsertConfig.m_bInsWithCaption; } |
264 | | void SetInsWithCaption( bool bHTML, bool b ) |
265 | 0 | { if(!bHTML) |
266 | 0 | m_aInsertConfig.m_bInsWithCaption = b; |
267 | 0 | m_aInsertConfig.SetModified();} |
268 | | |
269 | 0 | bool IsCaptionOrderNumberingFirst() const { return m_aInsertConfig.m_bCaptionOrderNumberingFirst; } |
270 | | void SetCaptionOrderNumberingFirst( bool bSet ) |
271 | 0 | { |
272 | 0 | if(m_aInsertConfig.m_bCaptionOrderNumberingFirst != bSet) |
273 | 0 | { |
274 | 0 | m_aInsertConfig.m_bCaptionOrderNumberingFirst = bSet; |
275 | 0 | m_aInsertConfig.SetModified(); |
276 | 0 | } |
277 | 0 | } |
278 | | |
279 | | bool IsInsTableFormatNum(bool bHTML) const |
280 | 0 | { return bHTML ? m_aWebTableConfig.m_bInsTableFormatNum : m_aTableConfig.m_bInsTableFormatNum; } |
281 | | void SetInsTableFormatNum( bool bHTML, bool b ) |
282 | 0 | { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; |
283 | 0 | config.m_bInsTableFormatNum = b; |
284 | 0 | config.SetModified();} |
285 | | |
286 | | bool IsInsTableChangeNumFormat(bool bHTML) const |
287 | 0 | { return bHTML ? m_aWebTableConfig.m_bInsTableChangeNumFormat : m_aTableConfig.m_bInsTableChangeNumFormat; } |
288 | | void SetInsTableChangeNumFormat( bool bHTML, bool b ) |
289 | 0 | { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; |
290 | 0 | config.m_bInsTableChangeNumFormat = b; |
291 | 0 | config.SetModified();} |
292 | | |
293 | | bool IsInsTableAlignNum(bool bHTML) const |
294 | 66.5k | { return bHTML ? m_aWebTableConfig.m_bInsTableAlignNum : m_aTableConfig.m_bInsTableAlignNum; } |
295 | | void SetInsTableAlignNum( bool bHTML, bool b ) |
296 | 0 | { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; |
297 | 0 | config.m_bInsTableAlignNum = b; |
298 | 0 | config.SetModified();} |
299 | | |
300 | | const SwInsertTableOptions& GetInsTableFlags(bool bHTML) const |
301 | 0 | { return bHTML ? m_aWebInsertConfig.m_aInsTableOpts : m_aInsertConfig.m_aInsTableOpts;} |
302 | 0 | void SetInsTableFlags( bool bHTML, const SwInsertTableOptions& rOpts ) { |
303 | 0 | auto & config = bHTML ? m_aWebInsertConfig : m_aInsertConfig; |
304 | 0 | config.m_aInsTableOpts = rOpts; |
305 | 0 | config.SetModified();} |
306 | | |
307 | | bool IsSplitVerticalByDefault(bool bHTML) const |
308 | 0 | { return bHTML ? m_aWebTableConfig.m_bSplitVerticalByDefault : m_aTableConfig.m_bSplitVerticalByDefault; } |
309 | | void SetSplitVerticalByDefault(bool bHTML, bool b) |
310 | 0 | { auto & config = bHTML ? m_aWebTableConfig : m_aTableConfig; |
311 | 0 | config.m_bSplitVerticalByDefault = b; |
312 | 0 | config.SetModified();} |
313 | | |
314 | | const InsCaptionOpt* GetCapOption(bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId); |
315 | | bool SetCapOption(bool bHTML, const InsCaptionOpt* pOpt); |
316 | | |
317 | 0 | bool IsGrfToGalleryAsLnk() const { return m_aMiscConfig.m_bGrfToGalleryAsLnk; } |
318 | 0 | void SetGrfToGalleryAsLnk( bool b ) { m_aMiscConfig.m_bGrfToGalleryAsLnk = b; |
319 | 0 | m_aMiscConfig.SetModified();} |
320 | | |
321 | 0 | MailTextFormats GetMailingFormats() const { return m_aMiscConfig.m_nMailingFormats;} |
322 | 0 | void SetMailingFormats( MailTextFormats nSet ) { m_aMiscConfig.m_nMailingFormats = nSet; |
323 | 0 | m_aMiscConfig.SetModified();} |
324 | | |
325 | 0 | bool IsNameFromColumn() const { return m_aMiscConfig.m_bIsNameFromColumn; } |
326 | | void SetIsNameFromColumn( bool bSet ) |
327 | 0 | { |
328 | 0 | m_aMiscConfig.SetModified(); |
329 | 0 | m_aMiscConfig.m_bIsNameFromColumn = bSet; |
330 | 0 | } |
331 | | |
332 | 0 | bool IsAskForMailMerge() const { return m_aMiscConfig.m_bAskForMailMergeInPrint;} |
333 | | |
334 | 0 | const OUString& GetNameFromColumn() const { return m_aMiscConfig.m_sNameFromColumn; } |
335 | 0 | void SetNameFromColumn( const OUString& rSet ) { m_aMiscConfig.m_sNameFromColumn = rSet; |
336 | 0 | m_aMiscConfig.SetModified();} |
337 | | |
338 | 0 | bool IsFileEncryptedFromColumn() const { return m_aMiscConfig.m_bIsPasswordFromColumn;} |
339 | | void SetIsFileEncryptedFromColumn( bool bSet ) |
340 | 0 | { |
341 | 0 | m_aMiscConfig.SetModified(); |
342 | 0 | m_aMiscConfig.m_bIsPasswordFromColumn = bSet; |
343 | 0 | } |
344 | | |
345 | 0 | const OUString& GetPasswordFromColumn() const { return m_aMiscConfig.m_sPasswordFromColumn; } |
346 | 0 | void SetPasswordFromColumn( const OUString& rSet ) { m_aMiscConfig.m_sPasswordFromColumn = rSet; |
347 | 0 | m_aMiscConfig.SetModified();} |
348 | | |
349 | 0 | const OUString& GetMailingPath() const { return m_aMiscConfig.m_sMailingPath; } |
350 | 0 | void SetMailingPath(const OUString& sPath) { m_aMiscConfig.m_sMailingPath = sPath; |
351 | 0 | m_aMiscConfig.SetModified();} |
352 | | |
353 | 0 | const OUString& GetWordDelimiter() const { return m_aMiscConfig.m_sWordDelimiter; } |
354 | 0 | void SetWordDelimiter(const OUString& sDelim) { m_aMiscConfig.m_sWordDelimiter = sDelim; |
355 | 0 | m_aMiscConfig.SetModified();} |
356 | | |
357 | | //convert word delimiter from or to user interface |
358 | | static OUString ConvertWordDelimiter(std::u16string_view aDelim, bool bFromUI); |
359 | | |
360 | 0 | bool IsShowIndexPreview() const {return m_aMiscConfig.m_bShowIndexPreview;} |
361 | | void SetShowIndexPreview(bool bSet) |
362 | 0 | {m_aMiscConfig.m_bShowIndexPreview = bSet; |
363 | 0 | m_aMiscConfig.SetModified();} |
364 | | |
365 | | void SetDefaultFontInCurrDocOnly(bool bSet) |
366 | 0 | { |
367 | 0 | m_aMiscConfig.m_bDefaultFontsInCurrDocOnly = bSet; |
368 | 0 | m_aMiscConfig.SetModified(); |
369 | 0 | } |
370 | | |
371 | 0 | bool IsHideFieldTips() const {return m_bHideFieldTips;} |
372 | 0 | void SetHideFieldTips(bool bSet) {m_bHideFieldTips = bSet;} |
373 | | |
374 | 0 | SwCompareMode GetCompareMode() const { return m_aCompareConfig.m_eCmpMode; } |
375 | 0 | void SetCompareMode( SwCompareMode eMode ) { m_aCompareConfig.m_eCmpMode = eMode; |
376 | 0 | m_aCompareConfig.SetModified(); } |
377 | | |
378 | 0 | bool IsUseRsid() const { return m_aCompareConfig.m_bUseRsid; } |
379 | 0 | void SetUseRsid( bool b ) { m_aCompareConfig.m_bUseRsid = b; |
380 | 0 | m_aCompareConfig.SetModified(); } |
381 | | |
382 | 0 | bool IsIgnorePieces() const { return m_aCompareConfig.m_bIgnorePieces; } |
383 | | |
384 | 0 | sal_uInt16 GetPieceLen() const { return m_aCompareConfig.m_nPieceLen; } |
385 | | |
386 | | bool IsStoreRsid() const |
387 | 191 | { |
388 | 191 | return m_aCompareConfig.m_bStoreRsid; |
389 | 191 | } |
390 | | void SetStoreRsid(bool bStoreRsid) |
391 | 0 | { |
392 | 0 | m_aCompareConfig.m_bStoreRsid = bStoreRsid; |
393 | 0 | m_aCompareConfig.SetModified(); |
394 | 0 | } |
395 | | |
396 | | }; |
397 | | #endif |
398 | | |
399 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |