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 <boost/ptr_container/ptr_vector.hpp>
23 #include <tools/wintypes.hxx>
24 #include <vcl/field.hxx>
25 #include <unotools/configitem.hxx>
27 #include "authratr.hxx"
28 #include <SwCapObjType.hxx>
29 #include "tblenum.hxx"
30 #include "itabenum.hxx"
31 #include <tools/globname.hxx>
32 #include <editeng/svxenum.hxx>
33 #include <o3tl/typed_flags_set.hxx>
35 class SwModuleOptions
;
38 // text format for the sending of messages ------------------------------
39 enum class MailTextFormats
49 template<> struct typed_flags
<MailTextFormats
> : is_typed_flags
<MailTextFormats
, 0x0f> {};
53 class InsCaptionOptArr
56 typedef boost::ptr_vector
<InsCaptionOpt
> InsCapOptArr
;
57 InsCapOptArr m_aInsCapOptArr
;
59 InsCaptionOpt
* Find(const SwCapObjType eType
, const SvGlobalName
*pOleId
= 0);
60 void Insert(InsCaptionOpt
* pObj
);
63 class SwRevisionConfig
: public utl::ConfigItem
65 friend class SwModuleOptions
;
67 AuthorCharAttr aInsertAttr
; //Revision/TextDisplay/Insert/Attribute // Redlining: Author-Zeichenattribute
68 //Revision/TextDisplay/Insert/Color
69 AuthorCharAttr aDeletedAttr
; //Revision/TextDisplay/Delete/Attribute
70 //Revision/TextDisplay/Delete/Color
71 AuthorCharAttr aFormatAttr
; //Revision/TextDisplay/ChangeAttribute/Attribute
72 //Revision/TextDisplay/ChangeAttribute/Color
73 sal_uInt16 nMarkAlign
; //Revision/LinesChanged/Mark
74 Color aMarkColor
; //Revision/LinesChanged/Color
76 static const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
78 virtual void ImplCommit() SAL_OVERRIDE
;
82 virtual ~SwRevisionConfig();
84 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
) SAL_OVERRIDE
;
86 void SetModified(){ConfigItem::SetModified();}
89 class SwCompareConfig
: public utl::ConfigItem
91 friend class SwModuleOptions
;
93 sal_uInt16 eCmpMode
; //Compare/CompareDocuments;
94 bool bUseRsid
; //Compare/Settings/Use RSID
95 /// Compare/Settings/Store RSID
97 bool bIgnorePieces
; //Compare/Settings/Ignore pieces of length
98 sal_uInt16 nPieceLen
; //Compare/Settings/Ignore pieces of length
100 static const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
102 virtual void ImplCommit() SAL_OVERRIDE
;
106 virtual ~SwCompareConfig();
108 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& ) SAL_OVERRIDE
{ };
110 void SetModified() {ConfigItem::SetModified(); }
113 class SwInsertConfig
: public utl::ConfigItem
115 friend class SwModuleOptions
;
117 InsCaptionOptArr
* pCapOptions
;
118 InsCaptionOpt
* pOLEMiscOpt
;
120 SvGlobalName aGlobalNames
[5];
122 bool bInsWithCaption
; //Insert/Caption/Automatic
123 bool bCaptionOrderNumberingFirst
; //#i61007# caption order starting with numbering
125 SwInsertTableOptions aInsTableOpts
;
128 const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
130 virtual void ImplCommit() SAL_OVERRIDE
;
133 SwInsertConfig(bool bWeb
);
134 virtual ~SwInsertConfig();
136 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
) SAL_OVERRIDE
;
138 void SetModified(){ConfigItem::SetModified();}
141 class SwTableConfig
: public utl::ConfigItem
143 friend class SwModuleOptions
;
145 sal_uInt16 nTableHMove
; //int Table/Shift/Row
146 sal_uInt16 nTableVMove
; //int Table/Shift/Column
147 sal_uInt16 nTableHInsert
; //int Table/Insert/Row
148 sal_uInt16 nTableVInsert
; //int Table/Insert/Column
149 TableChgMode eTableChgMode
; //int Table/Change/Effect
151 bool bInsTableFormatNum
; // Table/Input/NumberRecognition // Automatic recognition of numbers.
152 bool bInsTableChangeNumFormat
; // Table/Input/NumberFormatRecognition // Automatic recognition of number formats.
153 bool bInsTableAlignNum
; // Table/Input/Alignment // Align numbers.
155 static const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
157 virtual void ImplCommit() SAL_OVERRIDE
;
160 SwTableConfig(bool bWeb
);
161 virtual ~SwTableConfig();
163 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
) SAL_OVERRIDE
;
165 void SetModified(){ConfigItem::SetModified();}
168 class SwMiscConfig
: public utl::ConfigItem
170 friend class SwModuleOptions
;
172 OUString sWordDelimiter
; // Statistics/WordNumber/Delimiter
173 bool bDefaultFontsInCurrDocOnly
; // DefaultFont/Document
174 bool bShowIndexPreview
; // Index/ShowPreview
175 bool bGrfToGalleryAsLnk
; // Misc/GraphicToGalleryAsLink
176 bool bNumAlignSize
; // Numbering/Graphic/KeepRatio
177 bool bSinglePrintJob
; // FormLetter/PrintOutput/SinglePrintJobs
178 bool bIsNameFromColumn
; // FormLetter/FileOutput/FileName/Generation
179 bool bAskForMailMergeInPrint
; // Ask if documents containing fields should be 'mailmerged'
180 MailTextFormats nMailingFormats
; // FormLetter/MailingOutput/Formats
181 OUString sNameFromColumn
; // FormLetter/FileOutput/FileName/FromDatabaseField (string!)
182 OUString sMailingPath
; // FormLetter/FileOutput/Path
183 OUString sMailName
; // FormLetter/FileOutput/FileName/FromManualSetting (string!)
185 static const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
187 virtual void ImplCommit() SAL_OVERRIDE
;
191 virtual ~SwMiscConfig();
193 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
) SAL_OVERRIDE
;
195 void SetModified(){ConfigItem::SetModified();}
198 class SW_DLLPUBLIC SwModuleOptions
200 SwRevisionConfig aRevisionConfig
;
201 SwInsertConfig aInsertConfig
;
202 SwInsertConfig aWebInsertConfig
;
204 SwTableConfig aTableConfig
;
205 SwTableConfig aWebTableConfig
;
207 SwMiscConfig aMiscConfig
;
209 SwCompareConfig aCompareConfig
;
211 //fiscus: don't show tips of text fields - it's not part of the configuration!
212 bool bHideFieldTips
: 1;
217 TableChgMode
GetTableMode() const { return aTableConfig
.eTableChgMode
;}
218 void SetTableMode( TableChgMode eSet
) { aTableConfig
.eTableChgMode
= eSet
;
219 aTableConfig
.SetModified();}
221 sal_uInt16
GetTableHMove() const { return aTableConfig
.nTableHMove
;}
222 void SetTableHMove( sal_uInt16 nSet
) { aTableConfig
.nTableHMove
= nSet
;
223 aTableConfig
.SetModified();}
225 sal_uInt16
GetTableVMove() const { return aTableConfig
.nTableVMove
;}
226 void SetTableVMove( sal_uInt16 nSet
) { aTableConfig
.nTableVMove
= nSet
;
227 aTableConfig
.SetModified();}
229 sal_uInt16
GetTableHInsert() const {return aTableConfig
.nTableHInsert
;}
230 void SetTableHInsert( sal_uInt16 nSet
) { aTableConfig
.nTableHInsert
= nSet
;
231 aTableConfig
.SetModified();}
233 sal_uInt16
GetTableVInsert() const {return aTableConfig
.nTableVInsert
;}
234 void SetTableVInsert( sal_uInt16 nSet
) { aTableConfig
.nTableVInsert
= nSet
;
235 aTableConfig
.SetModified();}
237 const AuthorCharAttr
&GetInsertAuthorAttr() const { return aRevisionConfig
.aInsertAttr
; }
238 void SetInsertAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aInsertAttr
= rAttr
;
239 aRevisionConfig
.SetModified();}
241 const AuthorCharAttr
&GetDeletedAuthorAttr() const { return aRevisionConfig
.aDeletedAttr
; }
242 void SetDeletedAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aDeletedAttr
= rAttr
;
243 aRevisionConfig
.SetModified();}
245 const AuthorCharAttr
&GetFormatAuthorAttr() const { return aRevisionConfig
.aFormatAttr
; }
246 void SetFormatAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aFormatAttr
= rAttr
;
247 aRevisionConfig
.SetModified();}
249 sal_uInt16
GetMarkAlignMode() const { return aRevisionConfig
.nMarkAlign
; }
250 void SetMarkAlignMode(sal_uInt16 nMode
) { aRevisionConfig
.nMarkAlign
= nMode
;
251 aRevisionConfig
.SetModified();}
253 const Color
& GetMarkAlignColor() const { return aRevisionConfig
.aMarkColor
; }
254 void SetMarkAlignColor(const Color
&rColor
) { aRevisionConfig
.aMarkColor
= rColor
;
255 aRevisionConfig
.SetModified();}
257 bool IsInsWithCaption(bool bHTML
) const
258 { return !bHTML
&& aInsertConfig
.bInsWithCaption
; }
259 void SetInsWithCaption( bool bHTML
, bool b
)
261 aInsertConfig
.bInsWithCaption
= b
;
262 aInsertConfig
.SetModified();}
264 bool IsCaptionOrderNumberingFirst() const { return aInsertConfig
.bCaptionOrderNumberingFirst
; }
265 void SetCaptionOrderNumberingFirst( bool bSet
)
267 if(aInsertConfig
.bCaptionOrderNumberingFirst
!= bSet
)
269 aInsertConfig
.bCaptionOrderNumberingFirst
= bSet
;
270 aInsertConfig
.SetModified();
274 bool IsInsTableFormatNum(bool bHTML
) const
275 { return bHTML
? aWebTableConfig
.bInsTableFormatNum
: aTableConfig
.bInsTableFormatNum
; }
276 void SetInsTableFormatNum( bool bHTML
, bool b
)
277 { bHTML
? (aWebTableConfig
.bInsTableFormatNum
= b
) : (aTableConfig
.bInsTableFormatNum
= b
);
278 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
280 bool IsInsTableChangeNumFormat(bool bHTML
) const
281 { return bHTML
? aWebTableConfig
.bInsTableChangeNumFormat
: aTableConfig
.bInsTableChangeNumFormat
; }
282 void SetInsTableChangeNumFormat( bool bHTML
, bool b
)
283 { bHTML
? (aWebTableConfig
.bInsTableChangeNumFormat
= b
) : (aTableConfig
.bInsTableChangeNumFormat
= b
);
284 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
286 bool IsInsTableAlignNum(bool bHTML
) const
287 { return bHTML
? aWebTableConfig
.bInsTableAlignNum
: aTableConfig
.bInsTableAlignNum
; }
288 void SetInsTableAlignNum( bool bHTML
, bool b
)
289 { bHTML
? (aWebTableConfig
.bInsTableAlignNum
= b
) : (aTableConfig
.bInsTableAlignNum
= b
);
290 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
292 SwInsertTableOptions
GetInsTableFlags(bool bHTML
) const
293 { return bHTML
? aWebInsertConfig
.aInsTableOpts
: aInsertConfig
.aInsTableOpts
;}
294 void SetInsTableFlags( bool bHTML
, const SwInsertTableOptions
& rOpts
) {
295 bHTML
? (aWebInsertConfig
.aInsTableOpts
= rOpts
) : (aInsertConfig
.aInsTableOpts
= rOpts
);
296 bHTML
? aWebInsertConfig
.SetModified() : aInsertConfig
.SetModified();}
298 const InsCaptionOpt
* GetCapOption(bool bHTML
, const SwCapObjType eType
, const SvGlobalName
*pOleId
);
299 bool SetCapOption(bool bHTML
, const InsCaptionOpt
* pOpt
);
301 bool IsGrfToGalleryAsLnk() const { return aMiscConfig
.bGrfToGalleryAsLnk
; }
302 void SetGrfToGalleryAsLnk( bool b
) { aMiscConfig
.bGrfToGalleryAsLnk
= b
;
303 aMiscConfig
.SetModified();}
305 MailTextFormats
GetMailingFormats() const { return aMiscConfig
.nMailingFormats
;}
306 void SetMailingFormats( MailTextFormats nSet
) { aMiscConfig
.nMailingFormats
= nSet
;
307 aMiscConfig
.SetModified();}
309 bool IsSinglePrintJob() const { return aMiscConfig
.bSinglePrintJob
; }
310 void SetSinglePrintJob( bool b
) { aMiscConfig
.bSinglePrintJob
= b
;
311 aMiscConfig
.SetModified();}
313 bool IsNumAlignSize() const { return aMiscConfig
.bNumAlignSize
; }
314 void SetNumAlignSize( bool b
) { aMiscConfig
.bNumAlignSize
= b
;
315 aMiscConfig
.SetModified();}
317 bool IsNameFromColumn() const { return aMiscConfig
.bIsNameFromColumn
; }
318 void SetIsNameFromColumn( bool bSet
)
320 aMiscConfig
.SetModified();
321 aMiscConfig
.bIsNameFromColumn
= bSet
;
324 bool IsAskForMailMerge() const { return aMiscConfig
.bAskForMailMergeInPrint
;}
325 void SetAskForMailMerge(bool bSet
)
327 aMiscConfig
.SetModified();
328 aMiscConfig
.bAskForMailMergeInPrint
= bSet
;
331 OUString
GetNameFromColumn() const { return aMiscConfig
.sNameFromColumn
; }
332 void SetNameFromColumn( const OUString
& rSet
) { aMiscConfig
.sNameFromColumn
= rSet
;
333 aMiscConfig
.SetModified();}
335 OUString
GetMailingPath() const { return aMiscConfig
.sMailingPath
; }
336 void SetMailingPath(const OUString
& sPath
) { aMiscConfig
.sMailingPath
= sPath
;
337 aMiscConfig
.SetModified();}
339 OUString
GetMailName() const { return aMiscConfig
.sMailName
; }
340 void SetMailName(const OUString
& sName
){ aMiscConfig
.sMailName
= sName
;
341 aMiscConfig
.SetModified();}
343 OUString
GetWordDelimiter() const { return aMiscConfig
.sWordDelimiter
; }
344 void SetWordDelimiter(const OUString
& sDelim
) { aMiscConfig
.sWordDelimiter
= sDelim
;
345 aMiscConfig
.SetModified();}
347 //convert word delimiter from or to user interface
348 static OUString
ConvertWordDelimiter(const OUString
& rDelim
, bool bFromUI
);
350 bool IsShowIndexPreview() const {return aMiscConfig
.bShowIndexPreview
;}
351 void SetShowIndexPreview(bool bSet
)
352 {aMiscConfig
.bShowIndexPreview
= bSet
;
353 aMiscConfig
.SetModified();}
355 bool IsDefaultFontInCurrDocOnly() const { return aMiscConfig
.bDefaultFontsInCurrDocOnly
;}
356 void SetDefaultFontInCurrDocOnly(bool bSet
)
358 aMiscConfig
.bDefaultFontsInCurrDocOnly
= bSet
;
359 aMiscConfig
.SetModified();
362 bool IsHideFieldTips() const {return bHideFieldTips
;}
363 void SetHideFieldTips(bool bSet
) {bHideFieldTips
= bSet
;}
365 SvxCompareMode
GetCompareMode() const { return (SvxCompareMode
)aCompareConfig
.eCmpMode
; }
366 void SetCompareMode( SvxCompareMode eMode
) { aCompareConfig
.eCmpMode
= eMode
;
367 aCompareConfig
.SetModified(); }
369 bool IsUseRsid() const { return aCompareConfig
.bUseRsid
; }
370 void SetUseRsid( bool b
) { aCompareConfig
.bUseRsid
= b
;
371 aCompareConfig
.SetModified(); }
373 bool IsIgnorePieces() const { return aCompareConfig
.bIgnorePieces
; }
374 void SetIgnorePieces( bool b
) { aCompareConfig
.bIgnorePieces
= b
;
375 aCompareConfig
.SetModified(); }
377 sal_uInt16
GetPieceLen() const { return aCompareConfig
.nPieceLen
; }
378 void SetPieceLen( sal_uInt16 nLen
) { aCompareConfig
.nPieceLen
= nLen
;
379 aCompareConfig
.SetModified(); }
381 bool IsStoreRsid() const
383 return aCompareConfig
.m_bStoreRsid
;
385 void SetStoreRsid(bool bStoreRsid
)
387 aCompareConfig
.m_bStoreRsid
= bStoreRsid
;
388 aCompareConfig
.SetModified();
394 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */