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_SW_INC_MODCFG_HXX
20 #define INCLUDED_SW_INC_MODCFG_HXX
22 #include <unotools/configitem.hxx>
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>
37 // text format for the sending of messages ------------------------------
38 enum class MailTextFormats
47 template<> struct typed_flags
<MailTextFormats
> : is_typed_flags
<MailTextFormats
, 0x07> {};
51 class InsCaptionOptArr
54 typedef std::vector
<std::unique_ptr
<InsCaptionOpt
>> InsCapOptArr
;
55 InsCapOptArr m_InsCapOptArr
;
57 InsCaptionOpt
* Find(const SwCapObjType eType
, const SvGlobalName
*pOleId
= nullptr);
58 void Insert(InsCaptionOpt
* pObj
);
61 class SAL_DLLPUBLIC_RTTI SwRevisionConfig final
: public utl::ConfigItem
63 friend class SwModuleOptions
;
65 AuthorCharAttr m_aInsertAttr
; //Revision/TextDisplay/Insert/Attribute // Redlining: author character attributes
66 //Revision/TextDisplay/Insert/Color
67 AuthorCharAttr m_aDeletedAttr
; //Revision/TextDisplay/Delete/Attribute
68 //Revision/TextDisplay/Delete/Color
69 AuthorCharAttr m_aFormatAttr
; //Revision/TextDisplay/ChangeAttribute/Attribute
70 //Revision/TextDisplay/ChangeAttribute/Color
71 sal_uInt16 m_nMarkAlign
; //Revision/LinesChanged/Mark
72 Color m_aMarkColor
; //Revision/LinesChanged/Color
74 static const css::uno::Sequence
<OUString
>& GetPropertyNames();
76 virtual void ImplCommit() override
;
80 virtual ~SwRevisionConfig() override
;
82 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
84 using ConfigItem::SetModified
;
87 enum class SwCompareMode
94 class SAL_DLLPUBLIC_RTTI SwCompareConfig final
: public utl::ConfigItem
96 friend class SwModuleOptions
;
98 SwCompareMode m_eCmpMode
; //Compare/CompareDocuments;
99 bool m_bUseRsid
; //Compare/Settings/Use RSID
100 /// Compare/Settings/Store RSID
102 bool m_bIgnorePieces
; //Compare/Settings/Ignore pieces of length
103 sal_uInt16 m_nPieceLen
; //Compare/Settings/Ignore pieces of length
105 static const css::uno::Sequence
<OUString
>& GetPropertyNames();
107 virtual void ImplCommit() override
;
111 virtual ~SwCompareConfig() override
;
113 virtual void Notify( const css::uno::Sequence
< OUString
>& ) override
{ };
115 using ConfigItem::SetModified
;
118 class SAL_DLLPUBLIC_RTTI SwInsertConfig final
: public utl::ConfigItem
120 friend class SwModuleOptions
;
122 std::unique_ptr
<InsCaptionOptArr
> m_pCapOptions
;
123 std::unique_ptr
<InsCaptionOpt
> m_pOLEMiscOpt
;
125 SvGlobalName m_aGlobalNames
[5];
127 bool m_bInsWithCaption
; //Insert/Caption/Automatic
128 bool m_bCaptionOrderNumberingFirst
; //#i61007# caption order starting with numbering
130 SwInsertTableOptions m_aInsTableOpts
;
133 const css::uno::Sequence
<OUString
>& GetPropertyNames() const;
135 virtual void ImplCommit() override
;
138 SwInsertConfig(bool bWeb
);
139 virtual ~SwInsertConfig() override
;
141 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
143 using ConfigItem::SetModified
;
146 class SAL_DLLPUBLIC_RTTI SwTableConfig final
: public utl::ConfigItem
148 friend class SwModuleOptions
;
150 sal_uInt16 m_nTableHMove
; //int Table/Shift/Row
151 sal_uInt16 m_nTableVMove
; //int Table/Shift/Column
152 sal_uInt16 m_nTableHInsert
; //int Table/Insert/Row
153 sal_uInt16 m_nTableVInsert
; //int Table/Insert/Column
154 TableChgMode m_eTableChgMode
; //int Table/Change/Effect
156 bool m_bInsTableFormatNum
; // Table/Input/NumberRecognition // Automatic recognition of numbers.
157 bool m_bInsTableChangeNumFormat
; // Table/Input/NumberFormatRecognition // Automatic recognition of number formats.
158 bool m_bInsTableAlignNum
; // Table/Input/Alignment // Align numbers.
159 bool m_bSplitVerticalByDefault
; // Table/Input/SplitVerticalByDefault // Split vertical by default.
161 static const css::uno::Sequence
<OUString
>& GetPropertyNames();
163 virtual void ImplCommit() override
;
166 SwTableConfig(bool bWeb
);
167 virtual ~SwTableConfig() override
;
169 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
171 using ConfigItem::SetModified
;
174 class SAL_DLLPUBLIC_RTTI SwMiscConfig final
: public utl::ConfigItem
176 friend class SwModuleOptions
;
178 OUString m_sWordDelimiter
; // Statistics/WordNumber/Delimiter
179 bool m_bDefaultFontsInCurrDocOnly
; // DefaultFont/Document
180 bool m_bShowIndexPreview
; // Index/ShowPreview
181 bool m_bGrfToGalleryAsLnk
; // Misc/GraphicToGalleryAsLink
182 bool m_bNumAlignSize
; // Numbering/Graphic/KeepRatio
183 bool m_bIsNameFromColumn
; // FormLetter/FileOutput/FileName/Generation
184 bool m_bIsPasswordFromColumn
; // FormLetter/FileOutput/FilePassword/Generation
185 bool m_bAskForMailMergeInPrint
; // Ask if documents containing fields should be 'mailmerged'
186 MailTextFormats m_nMailingFormats
; // FormLetter/MailingOutput/Formats
187 OUString m_sNameFromColumn
; // FormLetter/FileOutput/FileName/FromDatabaseField (string!)
188 OUString m_sPasswordFromColumn
; // FormLetter/FileOutput/FilePassword/FromDatabaseField (string!)
189 OUString m_sMailingPath
; // FormLetter/FileOutput/Path
190 OUString m_sMailName
; // FormLetter/FileOutput/FileName/FromManualSetting (string!)
192 static const css::uno::Sequence
<OUString
>& GetPropertyNames();
194 virtual void ImplCommit() override
;
198 virtual ~SwMiscConfig() override
;
200 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
202 using ConfigItem::SetModified
;
205 class SW_DLLPUBLIC SwModuleOptions
207 SwRevisionConfig m_aRevisionConfig
;
208 SwInsertConfig m_aInsertConfig
;
209 SwInsertConfig m_aWebInsertConfig
;
211 SwTableConfig m_aTableConfig
;
212 SwTableConfig m_aWebTableConfig
;
214 SwMiscConfig m_aMiscConfig
;
216 SwCompareConfig m_aCompareConfig
;
218 //fiscus: don't show tips of text fields - it's not part of the configuration!
219 bool m_bHideFieldTips
: 1;
224 TableChgMode
GetTableMode() const { return m_aTableConfig
.m_eTableChgMode
;}
225 void SetTableMode( TableChgMode eSet
) { m_aTableConfig
.m_eTableChgMode
= eSet
;
226 m_aTableConfig
.SetModified();}
228 sal_uInt16
GetTableHMove() const { return m_aTableConfig
.m_nTableHMove
;}
229 void SetTableHMove( sal_uInt16 nSet
) { m_aTableConfig
.m_nTableHMove
= nSet
;
230 m_aTableConfig
.SetModified();}
232 sal_uInt16
GetTableVMove() const { return m_aTableConfig
.m_nTableVMove
;}
233 void SetTableVMove( sal_uInt16 nSet
) { m_aTableConfig
.m_nTableVMove
= nSet
;
234 m_aTableConfig
.SetModified();}
236 sal_uInt16
GetTableHInsert() const {return m_aTableConfig
.m_nTableHInsert
;}
237 void SetTableHInsert( sal_uInt16 nSet
) { m_aTableConfig
.m_nTableHInsert
= nSet
;
238 m_aTableConfig
.SetModified();}
240 sal_uInt16
GetTableVInsert() const {return m_aTableConfig
.m_nTableVInsert
;}
241 void SetTableVInsert( sal_uInt16 nSet
) { m_aTableConfig
.m_nTableVInsert
= nSet
;
242 m_aTableConfig
.SetModified();}
244 const AuthorCharAttr
&GetInsertAuthorAttr() const { return m_aRevisionConfig
.m_aInsertAttr
; }
245 void SetInsertAuthorAttr( AuthorCharAttr
const &rAttr
) { m_aRevisionConfig
.m_aInsertAttr
= rAttr
;
246 m_aRevisionConfig
.SetModified();}
248 const AuthorCharAttr
&GetDeletedAuthorAttr() const { return m_aRevisionConfig
.m_aDeletedAttr
; }
249 void SetDeletedAuthorAttr( AuthorCharAttr
const &rAttr
) { m_aRevisionConfig
.m_aDeletedAttr
= rAttr
;
250 m_aRevisionConfig
.SetModified();}
252 const AuthorCharAttr
&GetFormatAuthorAttr() const { return m_aRevisionConfig
.m_aFormatAttr
; }
253 void SetFormatAuthorAttr( AuthorCharAttr
const &rAttr
) { m_aRevisionConfig
.m_aFormatAttr
= rAttr
;
254 m_aRevisionConfig
.SetModified();}
256 sal_uInt16
GetMarkAlignMode() const { return m_aRevisionConfig
.m_nMarkAlign
; }
257 void SetMarkAlignMode(sal_uInt16 nMode
) { m_aRevisionConfig
.m_nMarkAlign
= nMode
;
258 m_aRevisionConfig
.SetModified();}
260 const Color
& GetMarkAlignColor() const { return m_aRevisionConfig
.m_aMarkColor
; }
261 void SetMarkAlignColor(const Color
&rColor
) { m_aRevisionConfig
.m_aMarkColor
= rColor
;
262 m_aRevisionConfig
.SetModified();}
264 bool IsInsWithCaption(bool bHTML
) const
265 { return !bHTML
&& m_aInsertConfig
.m_bInsWithCaption
; }
266 void SetInsWithCaption( bool bHTML
, bool b
)
268 m_aInsertConfig
.m_bInsWithCaption
= b
;
269 m_aInsertConfig
.SetModified();}
271 bool IsCaptionOrderNumberingFirst() const { return m_aInsertConfig
.m_bCaptionOrderNumberingFirst
; }
272 void SetCaptionOrderNumberingFirst( bool bSet
)
274 if(m_aInsertConfig
.m_bCaptionOrderNumberingFirst
!= bSet
)
276 m_aInsertConfig
.m_bCaptionOrderNumberingFirst
= bSet
;
277 m_aInsertConfig
.SetModified();
281 bool IsInsTableFormatNum(bool bHTML
) const
282 { return bHTML
? m_aWebTableConfig
.m_bInsTableFormatNum
: m_aTableConfig
.m_bInsTableFormatNum
; }
283 void SetInsTableFormatNum( bool bHTML
, bool b
)
284 { auto & config
= bHTML
? m_aWebTableConfig
: m_aTableConfig
;
285 config
.m_bInsTableFormatNum
= b
;
286 config
.SetModified();}
288 bool IsInsTableChangeNumFormat(bool bHTML
) const
289 { return bHTML
? m_aWebTableConfig
.m_bInsTableChangeNumFormat
: m_aTableConfig
.m_bInsTableChangeNumFormat
; }
290 void SetInsTableChangeNumFormat( bool bHTML
, bool b
)
291 { auto & config
= bHTML
? m_aWebTableConfig
: m_aTableConfig
;
292 config
.m_bInsTableChangeNumFormat
= b
;
293 config
.SetModified();}
295 bool IsInsTableAlignNum(bool bHTML
) const
296 { return bHTML
? m_aWebTableConfig
.m_bInsTableAlignNum
: m_aTableConfig
.m_bInsTableAlignNum
; }
297 void SetInsTableAlignNum( bool bHTML
, bool b
)
298 { auto & config
= bHTML
? m_aWebTableConfig
: m_aTableConfig
;
299 config
.m_bInsTableAlignNum
= b
;
300 config
.SetModified();}
302 const SwInsertTableOptions
& GetInsTableFlags(bool bHTML
) const
303 { return bHTML
? m_aWebInsertConfig
.m_aInsTableOpts
: m_aInsertConfig
.m_aInsTableOpts
;}
304 void SetInsTableFlags( bool bHTML
, const SwInsertTableOptions
& rOpts
) {
305 auto & config
= bHTML
? m_aWebInsertConfig
: m_aInsertConfig
;
306 config
.m_aInsTableOpts
= rOpts
;
307 config
.SetModified();}
309 bool IsSplitVerticalByDefault(bool bHTML
) const
310 { return bHTML
? m_aWebTableConfig
.m_bSplitVerticalByDefault
: m_aTableConfig
.m_bSplitVerticalByDefault
; }
311 void SetSplitVerticalByDefault(bool bHTML
, bool b
)
312 { auto & config
= bHTML
? m_aWebTableConfig
: m_aTableConfig
;
313 config
.m_bSplitVerticalByDefault
= b
;
314 config
.SetModified();}
316 const InsCaptionOpt
* GetCapOption(bool bHTML
, const SwCapObjType eType
, const SvGlobalName
*pOleId
);
317 bool SetCapOption(bool bHTML
, const InsCaptionOpt
* pOpt
);
319 bool IsGrfToGalleryAsLnk() const { return m_aMiscConfig
.m_bGrfToGalleryAsLnk
; }
320 void SetGrfToGalleryAsLnk( bool b
) { m_aMiscConfig
.m_bGrfToGalleryAsLnk
= b
;
321 m_aMiscConfig
.SetModified();}
323 MailTextFormats
GetMailingFormats() const { return m_aMiscConfig
.m_nMailingFormats
;}
324 void SetMailingFormats( MailTextFormats nSet
) { m_aMiscConfig
.m_nMailingFormats
= nSet
;
325 m_aMiscConfig
.SetModified();}
327 bool IsNameFromColumn() const { return m_aMiscConfig
.m_bIsNameFromColumn
; }
328 void SetIsNameFromColumn( bool bSet
)
330 m_aMiscConfig
.SetModified();
331 m_aMiscConfig
.m_bIsNameFromColumn
= bSet
;
334 bool IsAskForMailMerge() const { return m_aMiscConfig
.m_bAskForMailMergeInPrint
;}
336 const OUString
& GetNameFromColumn() const { return m_aMiscConfig
.m_sNameFromColumn
; }
337 void SetNameFromColumn( const OUString
& rSet
) { m_aMiscConfig
.m_sNameFromColumn
= rSet
;
338 m_aMiscConfig
.SetModified();}
340 bool IsFileEncryptedFromColumn() const { return m_aMiscConfig
.m_bIsPasswordFromColumn
;}
341 void SetIsFileEncryptedFromColumn( bool bSet
)
343 m_aMiscConfig
.SetModified();
344 m_aMiscConfig
.m_bIsPasswordFromColumn
= bSet
;
347 const OUString
& GetPasswordFromColumn() const { return m_aMiscConfig
.m_sPasswordFromColumn
; }
348 void SetPasswordFromColumn( const OUString
& rSet
) { m_aMiscConfig
.m_sPasswordFromColumn
= rSet
;
349 m_aMiscConfig
.SetModified();}
351 const OUString
& GetMailingPath() const { return m_aMiscConfig
.m_sMailingPath
; }
352 void SetMailingPath(const OUString
& sPath
) { m_aMiscConfig
.m_sMailingPath
= sPath
;
353 m_aMiscConfig
.SetModified();}
355 const OUString
& GetWordDelimiter() const { return m_aMiscConfig
.m_sWordDelimiter
; }
356 void SetWordDelimiter(const OUString
& sDelim
) { m_aMiscConfig
.m_sWordDelimiter
= sDelim
;
357 m_aMiscConfig
.SetModified();}
359 //convert word delimiter from or to user interface
360 static OUString
ConvertWordDelimiter(std::u16string_view aDelim
, bool bFromUI
);
362 bool IsShowIndexPreview() const {return m_aMiscConfig
.m_bShowIndexPreview
;}
363 void SetShowIndexPreview(bool bSet
)
364 {m_aMiscConfig
.m_bShowIndexPreview
= bSet
;
365 m_aMiscConfig
.SetModified();}
367 void SetDefaultFontInCurrDocOnly(bool bSet
)
369 m_aMiscConfig
.m_bDefaultFontsInCurrDocOnly
= bSet
;
370 m_aMiscConfig
.SetModified();
373 bool IsHideFieldTips() const {return m_bHideFieldTips
;}
374 void SetHideFieldTips(bool bSet
) {m_bHideFieldTips
= bSet
;}
376 SwCompareMode
GetCompareMode() const { return m_aCompareConfig
.m_eCmpMode
; }
377 void SetCompareMode( SwCompareMode eMode
) { m_aCompareConfig
.m_eCmpMode
= eMode
;
378 m_aCompareConfig
.SetModified(); }
380 bool IsUseRsid() const { return m_aCompareConfig
.m_bUseRsid
; }
381 void SetUseRsid( bool b
) { m_aCompareConfig
.m_bUseRsid
= b
;
382 m_aCompareConfig
.SetModified(); }
384 bool IsIgnorePieces() const { return m_aCompareConfig
.m_bIgnorePieces
; }
386 sal_uInt16
GetPieceLen() const { return m_aCompareConfig
.m_nPieceLen
; }
388 bool IsStoreRsid() const
390 return m_aCompareConfig
.m_bStoreRsid
;
392 void SetStoreRsid(bool bStoreRsid
)
394 m_aCompareConfig
.m_bStoreRsid
= bStoreRsid
;
395 m_aCompareConfig
.SetModified();
401 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */