1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: modcfg.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <tools/string.hxx>
34 #include <vcl/wintypes.hxx>
35 #include <vcl/field.hxx>
36 #include <svtools/svarray.hxx>
37 #include <unotools/configitem.hxx>
39 #include "authratr.hxx"
40 #include <SwCapObjType.hxx>
41 #include "tblenum.hxx"
42 #include "itabenum.hxx"
43 #include <tools/globname.hxx>
44 class SwModuleOptions
;
46 //-----------------------------------------------------------------------------
48 typedef InsCaptionOpt
* InsCaptionOptPtr
;
49 SV_DECL_PTRARR_SORT_DEL(InsCapOptArr
, InsCaptionOptPtr
, 0, 5)
51 class InsCaptionOptArr
: public InsCapOptArr
53 friend class SwModuleOptions
;
54 friend class SwInsertConfig
;
56 InsCaptionOpt
* Find(const SwCapObjType eType
, const SvGlobalName
*pOleId
= 0) const;
59 /* -----------------------------10.10.00 16:14--------------------------------
61 ---------------------------------------------------------------------------*/
62 class SwRevisionConfig
: public utl::ConfigItem
64 friend class SwModuleOptions
;
66 AuthorCharAttr aInsertAttr
; //Revision/TextDisplay/Insert/Attribute // Redlining: Author-Zeichenattribute
67 //Revision/TextDisplay/Insert/Color
68 AuthorCharAttr aDeletedAttr
; //Revision/TextDisplay/Delete/Attribute
69 //Revision/TextDisplay/Delete/Color
70 AuthorCharAttr aFormatAttr
; //Revision/TextDisplay/ChangeAttribute/Attribute
71 //Revision/TextDisplay/ChangeAttribute/Color
72 USHORT nMarkAlign
; //Revision/LinesChanged/Mark
73 Color aMarkColor
; //Revision/LinesChanged/Color
75 const com::sun::star::uno::Sequence
<rtl::OUString
>& GetPropertyNames();
80 virtual void Commit();
82 void SetModified(){ConfigItem::SetModified();}
84 /* -----------------------------11.10.00 09:00--------------------------------
86 ---------------------------------------------------------------------------*/
87 class SwInsertConfig
: public utl::ConfigItem
89 friend class SwModuleOptions
;
91 InsCaptionOptArr
* pCapOptions
;
92 InsCaptionOpt
* pOLEMiscOpt
;
94 SvGlobalName aGlobalNames
[5];
96 sal_Bool bInsWithCaption
; //Insert/Caption/Automatic // Objekte beschriftet einfuegen
97 sal_Bool bCaptionOrderNumberingFirst
; //#i61007# caption order starting with numbering
98 // sal_uInt16 nInsTblFlags; //Insert/Table/Header // Flags fuer Tabellen einfuegen
99 //Insert/Table/RepeatHeader
101 //Insert/Table/Border
102 SwInsertTableOptions aInsTblOpts
;
105 const com::sun::star::uno::Sequence
<rtl::OUString
>& GetPropertyNames();
107 SwInsertConfig(sal_Bool bWeb
);
110 virtual void Commit();
112 void SetModified(){ConfigItem::SetModified();}
114 /* -----------------------------11.10.00 09:00--------------------------------
116 ---------------------------------------------------------------------------*/
117 class SwTableConfig
: public utl::ConfigItem
119 friend class SwModuleOptions
;
121 USHORT nTblHMove
; //int Table/Shift/Row
122 USHORT nTblVMove
; //int Table/Shift/Column
123 USHORT nTblHInsert
; //int Table/Insert/Row
124 USHORT nTblVInsert
; //int Table/Insert/Column
125 TblChgMode eTblChgMode
; //int Table/Change/Effect
127 sal_Bool bInsTblFormatNum
; // Table/Input/NumberRecognition // Automatische Zahlenerkennung
128 sal_Bool bInsTblChangeNumFormat
; // Table/Input/NumberFormatRecognition // Automatische Zahlenformaterkennung
129 sal_Bool bInsTblAlignNum
; // Table/Input/Alignment // Zahlen ausrichten
131 const com::sun::star::uno::Sequence
<rtl::OUString
>& GetPropertyNames();
133 SwTableConfig(sal_Bool bWeb
);
136 virtual void Commit();
138 void SetModified(){ConfigItem::SetModified();}
140 /* -----------------------------18.01.01 16:57--------------------------------
142 ---------------------------------------------------------------------------*/
143 class SwMiscConfig
: public utl::ConfigItem
145 friend class SwModuleOptions
;
147 String sWordDelimiter
; // Statistics/WordNumber/Delimiter
148 BOOL bDefaultFontsInCurrDocOnly
; // DefaultFont/Document
149 BOOL bShowIndexPreview
; // Index/ShowPreview
150 BOOL bGrfToGalleryAsLnk
; // Misc/GraphicToGalleryAsLink
151 BOOL bNumAlignSize
; // Numbering/Graphic/KeepRatio
152 BOOL bSinglePrintJob
; // FormLetter/PrintOutput/SinglePrintJobs
153 BOOL bIsNameFromColumn
; // FormLetter/FileOutput/FileName/Generation
154 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
<rtl::OUString
>& GetPropertyNames();
165 virtual void Commit();
167 void SetModified(){ConfigItem::SetModified();}
170 /* ---------------------------------------------------------------------------
172 ---------------------------------------------------------------------------*/
173 class SW_DLLPUBLIC SwModuleOptions
175 SwRevisionConfig aRevisionConfig
;
176 SwInsertConfig aInsertConfig
;
177 SwInsertConfig aWebInsertConfig
;
179 SwTableConfig aTableConfig
;
180 SwTableConfig aWebTableConfig
;
182 SwMiscConfig aMiscConfig
;
184 //fiscus: don't show tips of text fields - it's not part of the configuration!
185 BOOL bHideFieldTips
: 1;
190 TblChgMode
GetTblMode() const { return aTableConfig
.eTblChgMode
;}
191 void SetTblMode( TblChgMode eSet
) { aTableConfig
.eTblChgMode
= eSet
;
192 aTableConfig
.SetModified();}
194 USHORT
GetTblHMove() const { return aTableConfig
.nTblHMove
;}
195 void SetTblHMove( USHORT nSet
) { aTableConfig
.nTblHMove
= nSet
;
196 aTableConfig
.SetModified();}
198 USHORT
GetTblVMove() const { return aTableConfig
.nTblVMove
;}
199 void SetTblVMove( USHORT nSet
) { aTableConfig
.nTblVMove
= nSet
;
200 aTableConfig
.SetModified();}
202 USHORT
GetTblHInsert() const {return aTableConfig
.nTblHInsert
;}
203 void SetTblHInsert( USHORT nSet
) { aTableConfig
.nTblHInsert
= nSet
;
204 aTableConfig
.SetModified();}
206 USHORT
GetTblVInsert() const {return aTableConfig
.nTblVInsert
;}
207 void SetTblVInsert( USHORT 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 USHORT
GetMarkAlignMode() const { return aRevisionConfig
.nMarkAlign
; }
223 void SetMarkAlignMode(USHORT 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 BOOL
IsInsWithCaption(BOOL bHTML
) const
231 { return bHTML
? FALSE
: aInsertConfig
.bInsWithCaption
; }
232 void SetInsWithCaption( BOOL bHTML
, 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 BOOL
IsInsTblFormatNum(BOOL bHTML
) const
248 { return bHTML
? aWebTableConfig
.bInsTblFormatNum
: aTableConfig
.bInsTblFormatNum
; }
249 void SetInsTblFormatNum( BOOL bHTML
, BOOL b
)
250 { bHTML
? (aWebTableConfig
.bInsTblFormatNum
= b
) : (aTableConfig
.bInsTblFormatNum
= b
);
251 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
253 BOOL
IsInsTblChangeNumFormat(BOOL bHTML
) const
254 { return bHTML
? aWebTableConfig
.bInsTblChangeNumFormat
: aTableConfig
.bInsTblChangeNumFormat
; }
255 void SetInsTblChangeNumFormat( BOOL bHTML
, BOOL b
)
256 { bHTML
? (aWebTableConfig
.bInsTblChangeNumFormat
= b
) : (aTableConfig
.bInsTblChangeNumFormat
= b
);
257 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
260 BOOL
IsInsTblAlignNum(BOOL bHTML
) const
261 { return bHTML
? aWebTableConfig
.bInsTblAlignNum
: aTableConfig
.bInsTblAlignNum
; }
262 void SetInsTblAlignNum( BOOL bHTML
, BOOL b
)
263 { bHTML
? (aWebTableConfig
.bInsTblAlignNum
= b
) : (aTableConfig
.bInsTblAlignNum
= b
);
264 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();;}
266 SwInsertTableOptions
GetInsTblFlags(BOOL bHTML
) const
267 { return bHTML
? aWebInsertConfig
.aInsTblOpts
: aInsertConfig
.aInsTblOpts
;}
268 void SetInsTblFlags( BOOL bHTML
, const SwInsertTableOptions
& rOpts
) {
269 bHTML
? (aWebInsertConfig
.aInsTblOpts
= rOpts
) : (aInsertConfig
.aInsTblOpts
= rOpts
);
270 bHTML
? aWebInsertConfig
.SetModified() : aInsertConfig
.SetModified();}
272 const InsCaptionOpt
* GetCapOption(BOOL bHTML
, const SwCapObjType eType
, const SvGlobalName
*pOleId
);
273 BOOL
SetCapOption(BOOL bHTML
, const InsCaptionOpt
* pOpt
);
276 BOOL
IsGrfToGalleryAsLnk() const { return aMiscConfig
.bGrfToGalleryAsLnk
; }
277 void SetGrfToGalleryAsLnk( 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 BOOL
IsSinglePrintJob() const { return aMiscConfig
.bSinglePrintJob
; }
285 void SetSinglePrintJob( BOOL b
) { aMiscConfig
.bSinglePrintJob
= b
;
286 aMiscConfig
.SetModified();}
288 BOOL
IsNumAlignSize() const { return aMiscConfig
.bNumAlignSize
; }
289 void SetNumAlignSize( BOOL b
) { aMiscConfig
.bNumAlignSize
= b
;
290 aMiscConfig
.SetModified();}
292 BOOL
IsNameFromColumn() const { return aMiscConfig
.bIsNameFromColumn
; }
293 void SetIsNameFromColumn( BOOL bSet
)
295 aMiscConfig
.SetModified();
296 aMiscConfig
.bIsNameFromColumn
= bSet
;
299 BOOL
IsAskForMailMerge() const { return aMiscConfig
.bAskForMailMergeInPrint
;}
300 void SetAskForMailMerge(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
, BOOL bFromUI
);
326 BOOL
IsShowIndexPreview() const {return aMiscConfig
.bShowIndexPreview
;}
327 void SetShowIndexPreview(BOOL bSet
)
328 {aMiscConfig
.bShowIndexPreview
= bSet
;
329 aMiscConfig
.SetModified();}
331 BOOL
IsDefaultFontInCurrDocOnly() const { return aMiscConfig
.bDefaultFontsInCurrDocOnly
;}
332 void SetDefaultFontInCurrDocOnly(BOOL bSet
)
334 aMiscConfig
.bDefaultFontsInCurrDocOnly
= bSet
;
335 aMiscConfig
.SetModified();
338 BOOL
IsHideFieldTips() const {return bHideFieldTips
;}
339 void SetHideFieldTips(BOOL bSet
) {bHideFieldTips
= bSet
;}