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 .
22 #include <boost/ptr_container/ptr_vector.hpp>
23 #include <tools/string.hxx>
24 #include <tools/wintypes.hxx>
25 #include <vcl/field.hxx>
26 #include <unotools/configitem.hxx>
28 #include "authratr.hxx"
29 #include <SwCapObjType.hxx>
30 #include "tblenum.hxx"
31 #include "itabenum.hxx"
32 #include <tools/globname.hxx>
33 #include <editeng/svxenum.hxx>
34 class SwModuleOptions
;
38 class InsCaptionOptArr
41 typedef boost::ptr_vector
<InsCaptionOpt
> InsCapOptArr
;
42 InsCapOptArr m_aInsCapOptArr
;
44 InsCaptionOpt
* Find(const SwCapObjType eType
, const SvGlobalName
*pOleId
= 0);
45 void Insert(InsCaptionOpt
* pObj
);
48 class SwRevisionConfig
: public utl::ConfigItem
50 friend class SwModuleOptions
;
52 AuthorCharAttr aInsertAttr
; //Revision/TextDisplay/Insert/Attribute // Redlining: Author-Zeichenattribute
53 //Revision/TextDisplay/Insert/Color
54 AuthorCharAttr aDeletedAttr
; //Revision/TextDisplay/Delete/Attribute
55 //Revision/TextDisplay/Delete/Color
56 AuthorCharAttr aFormatAttr
; //Revision/TextDisplay/ChangeAttribute/Attribute
57 //Revision/TextDisplay/ChangeAttribute/Color
58 sal_uInt16 nMarkAlign
; //Revision/LinesChanged/Mark
59 Color aMarkColor
; //Revision/LinesChanged/Color
61 const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
66 virtual void Commit();
67 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
69 void SetModified(){ConfigItem::SetModified();}
72 class SwCompareConfig
: public utl::ConfigItem
74 friend class SwModuleOptions
;
76 sal_uInt16 eCmpMode
; //Compare/CompareDocuments;
77 sal_Bool bUseRsid
; //Compare/Settings/Use RSID
78 sal_Bool bIgnorePieces
; //Compare/Settings/Ignore pieces of length
79 sal_uInt16 nPieceLen
; //Compare/Settings/Ignore pieces of length
81 const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
86 virtual void Commit();
87 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& ){ };
89 void SetModified() {ConfigItem::SetModified(); }
92 class SwInsertConfig
: public utl::ConfigItem
94 friend class SwModuleOptions
;
96 InsCaptionOptArr
* pCapOptions
;
97 InsCaptionOpt
* pOLEMiscOpt
;
99 SvGlobalName aGlobalNames
[5];
101 sal_Bool bInsWithCaption
; //Insert/Caption/Automatic
102 sal_Bool bCaptionOrderNumberingFirst
; //#i61007# caption order starting with numbering
104 SwInsertTableOptions aInsTblOpts
;
107 const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
109 SwInsertConfig(sal_Bool bWeb
);
112 virtual void Commit();
113 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
115 void SetModified(){ConfigItem::SetModified();}
118 class SwTableConfig
: public utl::ConfigItem
120 friend class SwModuleOptions
;
122 sal_uInt16 nTblHMove
; //int Table/Shift/Row
123 sal_uInt16 nTblVMove
; //int Table/Shift/Column
124 sal_uInt16 nTblHInsert
; //int Table/Insert/Row
125 sal_uInt16 nTblVInsert
; //int Table/Insert/Column
126 TblChgMode eTblChgMode
; //int Table/Change/Effect
128 sal_Bool bInsTblFormatNum
; // Table/Input/NumberRecognition // Automatic recognition of numbers.
129 sal_Bool bInsTblChangeNumFormat
; // Table/Input/NumberFormatRecognition // Automatic recognition of number formats.
130 sal_Bool bInsTblAlignNum
; // Table/Input/Alignment // Align numbers.
132 const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
134 SwTableConfig(sal_Bool bWeb
);
137 virtual void Commit();
138 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
140 void SetModified(){ConfigItem::SetModified();}
143 class SwMiscConfig
: public utl::ConfigItem
145 friend class SwModuleOptions
;
147 String sWordDelimiter
; // Statistics/WordNumber/Delimiter
148 sal_Bool bDefaultFontsInCurrDocOnly
; // DefaultFont/Document
149 sal_Bool bShowIndexPreview
; // Index/ShowPreview
150 sal_Bool bGrfToGalleryAsLnk
; // Misc/GraphicToGalleryAsLink
151 sal_Bool bNumAlignSize
; // Numbering/Graphic/KeepRatio
152 sal_Bool bSinglePrintJob
; // FormLetter/PrintOutput/SinglePrintJobs
153 sal_Bool bIsNameFromColumn
; // FormLetter/FileOutput/FileName/Generation
154 sal_Bool bAskForMailMergeInPrint
; // Ask if documents containing fields should be 'mailmerged'
155 sal_Int16 nMailingFormats
; // FormLetter/MailingOutput/Formats
156 String sNameFromColumn
; // FormLetter/FileOutput/FileName/FromDatabaseField (string!)
157 String sMailingPath
; // FormLetter/FileOutput/Path
158 String sMailName
; // FormLetter/FileOutput/FileName/FromManualSetting (string!)
160 const com::sun::star::uno::Sequence
<OUString
>& GetPropertyNames();
165 virtual void Commit();
166 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
168 void SetModified(){ConfigItem::SetModified();}
171 class SW_DLLPUBLIC SwModuleOptions
173 SwRevisionConfig aRevisionConfig
;
174 SwInsertConfig aInsertConfig
;
175 SwInsertConfig aWebInsertConfig
;
177 SwTableConfig aTableConfig
;
178 SwTableConfig aWebTableConfig
;
180 SwMiscConfig aMiscConfig
;
182 SwCompareConfig aCompareConfig
;
184 //fiscus: don't show tips of text fields - it's not part of the configuration!
185 sal_Bool bHideFieldTips
: 1;
190 TblChgMode
GetTblMode() const { return aTableConfig
.eTblChgMode
;}
191 void SetTblMode( TblChgMode eSet
) { aTableConfig
.eTblChgMode
= eSet
;
192 aTableConfig
.SetModified();}
194 sal_uInt16
GetTblHMove() const { return aTableConfig
.nTblHMove
;}
195 void SetTblHMove( sal_uInt16 nSet
) { aTableConfig
.nTblHMove
= nSet
;
196 aTableConfig
.SetModified();}
198 sal_uInt16
GetTblVMove() const { return aTableConfig
.nTblVMove
;}
199 void SetTblVMove( sal_uInt16 nSet
) { aTableConfig
.nTblVMove
= nSet
;
200 aTableConfig
.SetModified();}
202 sal_uInt16
GetTblHInsert() const {return aTableConfig
.nTblHInsert
;}
203 void SetTblHInsert( sal_uInt16 nSet
) { aTableConfig
.nTblHInsert
= nSet
;
204 aTableConfig
.SetModified();}
206 sal_uInt16
GetTblVInsert() const {return aTableConfig
.nTblVInsert
;}
207 void SetTblVInsert( sal_uInt16 nSet
) { aTableConfig
.nTblVInsert
= nSet
;
208 aTableConfig
.SetModified();}
210 const AuthorCharAttr
&GetInsertAuthorAttr() const { return aRevisionConfig
.aInsertAttr
; }
211 void SetInsertAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aInsertAttr
= rAttr
;
212 aRevisionConfig
.SetModified();}
214 const AuthorCharAttr
&GetDeletedAuthorAttr() const { return aRevisionConfig
.aDeletedAttr
; }
215 void SetDeletedAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aDeletedAttr
= rAttr
;
216 aRevisionConfig
.SetModified();}
218 const AuthorCharAttr
&GetFormatAuthorAttr() const { return aRevisionConfig
.aFormatAttr
; }
219 void SetFormatAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aFormatAttr
= rAttr
;
220 aRevisionConfig
.SetModified();}
222 sal_uInt16
GetMarkAlignMode() const { return aRevisionConfig
.nMarkAlign
; }
223 void SetMarkAlignMode(sal_uInt16 nMode
) { aRevisionConfig
.nMarkAlign
= nMode
;
224 aRevisionConfig
.SetModified();}
226 const Color
& GetMarkAlignColor() const { return aRevisionConfig
.aMarkColor
; }
227 void SetMarkAlignColor(const Color
&rColor
) { aRevisionConfig
.aMarkColor
= rColor
;
228 aRevisionConfig
.SetModified();}
230 sal_Bool
IsInsWithCaption(sal_Bool bHTML
) const
231 { return bHTML
? sal_False
: aInsertConfig
.bInsWithCaption
; }
232 void SetInsWithCaption( sal_Bool bHTML
, sal_Bool b
)
234 aInsertConfig
.bInsWithCaption
= b
;
235 aInsertConfig
.SetModified();}
237 sal_Bool
IsCaptionOrderNumberingFirst() const { return aInsertConfig
.bCaptionOrderNumberingFirst
; }
238 void SetCaptionOrderNumberingFirst( sal_Bool bSet
)
240 if(aInsertConfig
.bCaptionOrderNumberingFirst
!= bSet
)
242 aInsertConfig
.bCaptionOrderNumberingFirst
= bSet
;
243 aInsertConfig
.SetModified();
247 sal_Bool
IsInsTblFormatNum(sal_Bool bHTML
) const
248 { return bHTML
? aWebTableConfig
.bInsTblFormatNum
: aTableConfig
.bInsTblFormatNum
; }
249 void SetInsTblFormatNum( sal_Bool bHTML
, sal_Bool b
)
250 { bHTML
? (aWebTableConfig
.bInsTblFormatNum
= b
) : (aTableConfig
.bInsTblFormatNum
= b
);
251 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
253 sal_Bool
IsInsTblChangeNumFormat(sal_Bool bHTML
) const
254 { return bHTML
? aWebTableConfig
.bInsTblChangeNumFormat
: aTableConfig
.bInsTblChangeNumFormat
; }
255 void SetInsTblChangeNumFormat( sal_Bool bHTML
, sal_Bool b
)
256 { bHTML
? (aWebTableConfig
.bInsTblChangeNumFormat
= b
) : (aTableConfig
.bInsTblChangeNumFormat
= b
);
257 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
260 sal_Bool
IsInsTblAlignNum(sal_Bool bHTML
) const
261 { return bHTML
? aWebTableConfig
.bInsTblAlignNum
: aTableConfig
.bInsTblAlignNum
; }
262 void SetInsTblAlignNum( sal_Bool bHTML
, sal_Bool b
)
263 { bHTML
? (aWebTableConfig
.bInsTblAlignNum
= b
) : (aTableConfig
.bInsTblAlignNum
= b
);
264 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
266 SwInsertTableOptions
GetInsTblFlags(sal_Bool bHTML
) const
267 { return bHTML
? aWebInsertConfig
.aInsTblOpts
: aInsertConfig
.aInsTblOpts
;}
268 void SetInsTblFlags( sal_Bool bHTML
, const SwInsertTableOptions
& rOpts
) {
269 bHTML
? (aWebInsertConfig
.aInsTblOpts
= rOpts
) : (aInsertConfig
.aInsTblOpts
= rOpts
);
270 bHTML
? aWebInsertConfig
.SetModified() : aInsertConfig
.SetModified();}
272 const InsCaptionOpt
* GetCapOption(sal_Bool bHTML
, const SwCapObjType eType
, const SvGlobalName
*pOleId
);
273 sal_Bool
SetCapOption(sal_Bool bHTML
, const InsCaptionOpt
* pOpt
);
276 sal_Bool
IsGrfToGalleryAsLnk() const { return aMiscConfig
.bGrfToGalleryAsLnk
; }
277 void SetGrfToGalleryAsLnk( sal_Bool b
) { aMiscConfig
.bGrfToGalleryAsLnk
= b
;
278 aMiscConfig
.SetModified();}
280 sal_Int16
GetMailingFormats() const { return aMiscConfig
.nMailingFormats
;}
281 void SetMailingFormats( sal_Int16 nSet
) { aMiscConfig
.nMailingFormats
= nSet
;
282 aMiscConfig
.SetModified();}
284 sal_Bool
IsSinglePrintJob() const { return aMiscConfig
.bSinglePrintJob
; }
285 void SetSinglePrintJob( sal_Bool b
) { aMiscConfig
.bSinglePrintJob
= b
;
286 aMiscConfig
.SetModified();}
288 sal_Bool
IsNumAlignSize() const { return aMiscConfig
.bNumAlignSize
; }
289 void SetNumAlignSize( sal_Bool b
) { aMiscConfig
.bNumAlignSize
= b
;
290 aMiscConfig
.SetModified();}
292 sal_Bool
IsNameFromColumn() const { return aMiscConfig
.bIsNameFromColumn
; }
293 void SetIsNameFromColumn( sal_Bool bSet
)
295 aMiscConfig
.SetModified();
296 aMiscConfig
.bIsNameFromColumn
= bSet
;
299 sal_Bool
IsAskForMailMerge() const { return aMiscConfig
.bAskForMailMergeInPrint
;}
300 void SetAskForMailMerge(sal_Bool bSet
)
302 aMiscConfig
.SetModified();
303 aMiscConfig
.bAskForMailMergeInPrint
= bSet
;
307 const String
& GetNameFromColumn() const { return aMiscConfig
.sNameFromColumn
; }
308 void SetNameFromColumn( const String
& rSet
) { aMiscConfig
.sNameFromColumn
= rSet
;
309 aMiscConfig
.SetModified();}
311 String
GetMailingPath() const { return aMiscConfig
.sMailingPath
; }
312 void SetMailingPath(const String
& sPath
) { aMiscConfig
.sMailingPath
= sPath
;
313 aMiscConfig
.SetModified();}
315 String
GetMailName() const { return aMiscConfig
.sMailName
; }
316 void SetMailName(const String
& sName
){ aMiscConfig
.sMailName
= sName
;
317 aMiscConfig
.SetModified();}
319 const String
&GetWordDelimiter() const { return aMiscConfig
.sWordDelimiter
; }
320 void SetWordDelimiter(const String
& sDelim
) { aMiscConfig
.sWordDelimiter
= sDelim
;
321 aMiscConfig
.SetModified();}
323 //convert word delimiter from or to user interface
324 static String
ConvertWordDelimiter(const String
& rDelim
, sal_Bool bFromUI
);
326 sal_Bool
IsShowIndexPreview() const {return aMiscConfig
.bShowIndexPreview
;}
327 void SetShowIndexPreview(sal_Bool bSet
)
328 {aMiscConfig
.bShowIndexPreview
= bSet
;
329 aMiscConfig
.SetModified();}
331 sal_Bool
IsDefaultFontInCurrDocOnly() const { return aMiscConfig
.bDefaultFontsInCurrDocOnly
;}
332 void SetDefaultFontInCurrDocOnly(sal_Bool bSet
)
334 aMiscConfig
.bDefaultFontsInCurrDocOnly
= bSet
;
335 aMiscConfig
.SetModified();
338 sal_Bool
IsHideFieldTips() const {return bHideFieldTips
;}
339 void SetHideFieldTips(sal_Bool bSet
) {bHideFieldTips
= bSet
;}
341 SvxCompareMode
GetCompareMode() const { return (SvxCompareMode
)aCompareConfig
.eCmpMode
; }
342 void SetCompareMode( SvxCompareMode eMode
) { aCompareConfig
.eCmpMode
= eMode
;
343 aCompareConfig
.SetModified(); }
345 sal_Bool
IsUseRsid() const { return aCompareConfig
.bUseRsid
; }
346 void SetUseRsid( sal_Bool b
) { aCompareConfig
.bUseRsid
= b
;
347 aCompareConfig
.SetModified(); }
349 sal_Bool
IsIgnorePieces() const { return aCompareConfig
.bIgnorePieces
; }
350 void SetIgnorePieces( sal_Bool b
) { aCompareConfig
.bIgnorePieces
= b
;
351 aCompareConfig
.SetModified(); }
353 sal_uInt16
GetPieceLen() const { return aCompareConfig
.nPieceLen
; }
354 void SetPieceLen( sal_uInt16 nLen
) { aCompareConfig
.nPieceLen
= nLen
;
355 aCompareConfig
.SetModified(); }
360 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */