1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 #include <tools/string.hxx>
31 #include <vcl/wintypes.hxx>
32 #include <vcl/field.hxx>
33 #include <svl/svarray.hxx>
34 #include <unotools/configitem.hxx>
36 #include "authratr.hxx"
37 #include <SwCapObjType.hxx>
38 #include "tblenum.hxx"
39 #include "itabenum.hxx"
40 #include <tools/globname.hxx>
41 class SwModuleOptions
;
43 //-----------------------------------------------------------------------------
45 typedef InsCaptionOpt
* InsCaptionOptPtr
;
46 SV_DECL_PTRARR_SORT_DEL(InsCapOptArr
, InsCaptionOptPtr
, 0, 5)
48 class InsCaptionOptArr
: public InsCapOptArr
50 friend class SwModuleOptions
;
51 friend class SwInsertConfig
;
53 InsCaptionOpt
* Find(const SwCapObjType eType
, const SvGlobalName
*pOleId
= 0) const;
56 /* -----------------------------10.10.00 16:14--------------------------------
58 ---------------------------------------------------------------------------*/
59 class SwRevisionConfig
: public utl::ConfigItem
61 friend class SwModuleOptions
;
63 AuthorCharAttr aInsertAttr
; //Revision/TextDisplay/Insert/Attribute // Redlining: Author-Zeichenattribute
64 //Revision/TextDisplay/Insert/Color
65 AuthorCharAttr aDeletedAttr
; //Revision/TextDisplay/Delete/Attribute
66 //Revision/TextDisplay/Delete/Color
67 AuthorCharAttr aFormatAttr
; //Revision/TextDisplay/ChangeAttribute/Attribute
68 //Revision/TextDisplay/ChangeAttribute/Color
69 USHORT nMarkAlign
; //Revision/LinesChanged/Mark
70 Color aMarkColor
; //Revision/LinesChanged/Color
72 const com::sun::star::uno::Sequence
<rtl::OUString
>& GetPropertyNames();
77 virtual void Commit();
78 virtual void Notify( const ::com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
80 void SetModified(){ConfigItem::SetModified();}
82 /* -----------------------------11.10.00 09:00--------------------------------
84 ---------------------------------------------------------------------------*/
85 class SwInsertConfig
: public utl::ConfigItem
87 friend class SwModuleOptions
;
89 InsCaptionOptArr
* pCapOptions
;
90 InsCaptionOpt
* pOLEMiscOpt
;
92 SvGlobalName aGlobalNames
[5];
94 sal_Bool bInsWithCaption
; //Insert/Caption/Automatic // Objekte beschriftet einfuegen
95 sal_Bool bCaptionOrderNumberingFirst
; //#i61007# caption order starting with numbering
96 // sal_uInt16 nInsTblFlags; //Insert/Table/Header // Flags fuer Tabellen einfuegen
97 //Insert/Table/RepeatHeader
100 SwInsertTableOptions aInsTblOpts
;
103 const com::sun::star::uno::Sequence
<rtl::OUString
>& GetPropertyNames();
105 SwInsertConfig(sal_Bool bWeb
);
108 virtual void Commit();
109 virtual void Notify( const ::com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
111 void SetModified(){ConfigItem::SetModified();}
113 /* -----------------------------11.10.00 09:00--------------------------------
115 ---------------------------------------------------------------------------*/
116 class SwTableConfig
: public utl::ConfigItem
118 friend class SwModuleOptions
;
120 USHORT nTblHMove
; //int Table/Shift/Row
121 USHORT nTblVMove
; //int Table/Shift/Column
122 USHORT nTblHInsert
; //int Table/Insert/Row
123 USHORT nTblVInsert
; //int Table/Insert/Column
124 TblChgMode eTblChgMode
; //int Table/Change/Effect
126 sal_Bool bInsTblFormatNum
; // Table/Input/NumberRecognition // Automatische Zahlenerkennung
127 sal_Bool bInsTblChangeNumFormat
; // Table/Input/NumberFormatRecognition // Automatische Zahlenformaterkennung
128 sal_Bool bInsTblAlignNum
; // Table/Input/Alignment // Zahlen ausrichten
130 const com::sun::star::uno::Sequence
<rtl::OUString
>& GetPropertyNames();
132 SwTableConfig(sal_Bool bWeb
);
135 virtual void Commit();
136 virtual void Notify( const ::com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
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();
166 virtual void Notify( const ::com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
168 void SetModified(){ConfigItem::SetModified();}
171 /* ---------------------------------------------------------------------------
173 ---------------------------------------------------------------------------*/
174 class SW_DLLPUBLIC SwModuleOptions
176 SwRevisionConfig aRevisionConfig
;
177 SwInsertConfig aInsertConfig
;
178 SwInsertConfig aWebInsertConfig
;
180 SwTableConfig aTableConfig
;
181 SwTableConfig aWebTableConfig
;
183 SwMiscConfig aMiscConfig
;
185 //fiscus: don't show tips of text fields - it's not part of the configuration!
186 BOOL bHideFieldTips
: 1;
191 TblChgMode
GetTblMode() const { return aTableConfig
.eTblChgMode
;}
192 void SetTblMode( TblChgMode eSet
) { aTableConfig
.eTblChgMode
= eSet
;
193 aTableConfig
.SetModified();}
195 USHORT
GetTblHMove() const { return aTableConfig
.nTblHMove
;}
196 void SetTblHMove( USHORT nSet
) { aTableConfig
.nTblHMove
= nSet
;
197 aTableConfig
.SetModified();}
199 USHORT
GetTblVMove() const { return aTableConfig
.nTblVMove
;}
200 void SetTblVMove( USHORT nSet
) { aTableConfig
.nTblVMove
= nSet
;
201 aTableConfig
.SetModified();}
203 USHORT
GetTblHInsert() const {return aTableConfig
.nTblHInsert
;}
204 void SetTblHInsert( USHORT nSet
) { aTableConfig
.nTblHInsert
= nSet
;
205 aTableConfig
.SetModified();}
207 USHORT
GetTblVInsert() const {return aTableConfig
.nTblVInsert
;}
208 void SetTblVInsert( USHORT nSet
) { aTableConfig
.nTblVInsert
= nSet
;
209 aTableConfig
.SetModified();}
211 const AuthorCharAttr
&GetInsertAuthorAttr() const { return aRevisionConfig
.aInsertAttr
; }
212 void SetInsertAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aInsertAttr
= rAttr
;
213 aRevisionConfig
.SetModified();}
215 const AuthorCharAttr
&GetDeletedAuthorAttr() const { return aRevisionConfig
.aDeletedAttr
; }
216 void SetDeletedAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aDeletedAttr
= rAttr
;
217 aRevisionConfig
.SetModified();}
219 const AuthorCharAttr
&GetFormatAuthorAttr() const { return aRevisionConfig
.aFormatAttr
; }
220 void SetFormatAuthorAttr( AuthorCharAttr
&rAttr
) { aRevisionConfig
.aFormatAttr
= rAttr
;
221 aRevisionConfig
.SetModified();}
223 USHORT
GetMarkAlignMode() const { return aRevisionConfig
.nMarkAlign
; }
224 void SetMarkAlignMode(USHORT nMode
) { aRevisionConfig
.nMarkAlign
= nMode
;
225 aRevisionConfig
.SetModified();}
227 const Color
& GetMarkAlignColor() const { return aRevisionConfig
.aMarkColor
; }
228 void SetMarkAlignColor(const Color
&rColor
) { aRevisionConfig
.aMarkColor
= rColor
;
229 aRevisionConfig
.SetModified();}
231 BOOL
IsInsWithCaption(BOOL bHTML
) const
232 { return bHTML
? FALSE
: aInsertConfig
.bInsWithCaption
; }
233 void SetInsWithCaption( BOOL bHTML
, BOOL b
)
235 aInsertConfig
.bInsWithCaption
= b
;
236 aInsertConfig
.SetModified();}
238 sal_Bool
IsCaptionOrderNumberingFirst() const { return aInsertConfig
.bCaptionOrderNumberingFirst
; }
239 void SetCaptionOrderNumberingFirst( sal_Bool bSet
)
241 if(aInsertConfig
.bCaptionOrderNumberingFirst
!= bSet
)
243 aInsertConfig
.bCaptionOrderNumberingFirst
= bSet
;
244 aInsertConfig
.SetModified();
248 BOOL
IsInsTblFormatNum(BOOL bHTML
) const
249 { return bHTML
? aWebTableConfig
.bInsTblFormatNum
: aTableConfig
.bInsTblFormatNum
; }
250 void SetInsTblFormatNum( BOOL bHTML
, BOOL b
)
251 { bHTML
? (aWebTableConfig
.bInsTblFormatNum
= b
) : (aTableConfig
.bInsTblFormatNum
= b
);
252 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
254 BOOL
IsInsTblChangeNumFormat(BOOL bHTML
) const
255 { return bHTML
? aWebTableConfig
.bInsTblChangeNumFormat
: aTableConfig
.bInsTblChangeNumFormat
; }
256 void SetInsTblChangeNumFormat( BOOL bHTML
, BOOL b
)
257 { bHTML
? (aWebTableConfig
.bInsTblChangeNumFormat
= b
) : (aTableConfig
.bInsTblChangeNumFormat
= b
);
258 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();}
261 BOOL
IsInsTblAlignNum(BOOL bHTML
) const
262 { return bHTML
? aWebTableConfig
.bInsTblAlignNum
: aTableConfig
.bInsTblAlignNum
; }
263 void SetInsTblAlignNum( BOOL bHTML
, BOOL b
)
264 { bHTML
? (aWebTableConfig
.bInsTblAlignNum
= b
) : (aTableConfig
.bInsTblAlignNum
= b
);
265 bHTML
? aWebTableConfig
.SetModified() : aTableConfig
.SetModified();;}
267 SwInsertTableOptions
GetInsTblFlags(BOOL bHTML
) const
268 { return bHTML
? aWebInsertConfig
.aInsTblOpts
: aInsertConfig
.aInsTblOpts
;}
269 void SetInsTblFlags( BOOL bHTML
, const SwInsertTableOptions
& rOpts
) {
270 bHTML
? (aWebInsertConfig
.aInsTblOpts
= rOpts
) : (aInsertConfig
.aInsTblOpts
= rOpts
);
271 bHTML
? aWebInsertConfig
.SetModified() : aInsertConfig
.SetModified();}
273 const InsCaptionOpt
* GetCapOption(BOOL bHTML
, const SwCapObjType eType
, const SvGlobalName
*pOleId
);
274 BOOL
SetCapOption(BOOL bHTML
, const InsCaptionOpt
* pOpt
);
277 BOOL
IsGrfToGalleryAsLnk() const { return aMiscConfig
.bGrfToGalleryAsLnk
; }
278 void SetGrfToGalleryAsLnk( BOOL b
) { aMiscConfig
.bGrfToGalleryAsLnk
= b
;
279 aMiscConfig
.SetModified();}
281 sal_Int16
GetMailingFormats() const { return aMiscConfig
.nMailingFormats
;}
282 void SetMailingFormats( sal_Int16 nSet
) { aMiscConfig
.nMailingFormats
= nSet
;
283 aMiscConfig
.SetModified();}
285 BOOL
IsSinglePrintJob() const { return aMiscConfig
.bSinglePrintJob
; }
286 void SetSinglePrintJob( BOOL b
) { aMiscConfig
.bSinglePrintJob
= b
;
287 aMiscConfig
.SetModified();}
289 BOOL
IsNumAlignSize() const { return aMiscConfig
.bNumAlignSize
; }
290 void SetNumAlignSize( BOOL b
) { aMiscConfig
.bNumAlignSize
= b
;
291 aMiscConfig
.SetModified();}
293 BOOL
IsNameFromColumn() const { return aMiscConfig
.bIsNameFromColumn
; }
294 void SetIsNameFromColumn( BOOL bSet
)
296 aMiscConfig
.SetModified();
297 aMiscConfig
.bIsNameFromColumn
= bSet
;
300 BOOL
IsAskForMailMerge() const { return aMiscConfig
.bAskForMailMergeInPrint
;}
301 void SetAskForMailMerge(BOOL bSet
)
303 aMiscConfig
.SetModified();
304 aMiscConfig
.bAskForMailMergeInPrint
= bSet
;
308 const String
& GetNameFromColumn() const { return aMiscConfig
.sNameFromColumn
; }
309 void SetNameFromColumn( const String
& rSet
) { aMiscConfig
.sNameFromColumn
= rSet
;
310 aMiscConfig
.SetModified();}
312 String
GetMailingPath() const { return aMiscConfig
.sMailingPath
; }
313 void SetMailingPath(const String
& sPath
) { aMiscConfig
.sMailingPath
= sPath
;
314 aMiscConfig
.SetModified();}
316 String
GetMailName() const { return aMiscConfig
.sMailName
; }
317 void SetMailName(const String
& sName
){ aMiscConfig
.sMailName
= sName
;
318 aMiscConfig
.SetModified();}
320 const String
&GetWordDelimiter() const { return aMiscConfig
.sWordDelimiter
; }
321 void SetWordDelimiter(const String
& sDelim
) { aMiscConfig
.sWordDelimiter
= sDelim
;
322 aMiscConfig
.SetModified();}
324 //convert word delimiter from or to user interface
325 static String
ConvertWordDelimiter(const String
& rDelim
, BOOL bFromUI
);
327 BOOL
IsShowIndexPreview() const {return aMiscConfig
.bShowIndexPreview
;}
328 void SetShowIndexPreview(BOOL bSet
)
329 {aMiscConfig
.bShowIndexPreview
= bSet
;
330 aMiscConfig
.SetModified();}
332 BOOL
IsDefaultFontInCurrDocOnly() const { return aMiscConfig
.bDefaultFontsInCurrDocOnly
;}
333 void SetDefaultFontInCurrDocOnly(BOOL bSet
)
335 aMiscConfig
.bDefaultFontsInCurrDocOnly
= bSet
;
336 aMiscConfig
.SetModified();
339 BOOL
IsHideFieldTips() const {return bHideFieldTips
;}
340 void SetHideFieldTips(BOOL bSet
) {bHideFieldTips
= bSet
;}