xref: /trunk/main/sw/inc/modcfg.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 #ifndef _MODOPT_HXX
28 #define _MODOPT_HXX
29 
30 #include <tools/string.hxx>
31 #include <tools/wintypes.hxx>
32 #include <vcl/field.hxx>
33 #include <svl/svarray.hxx>
34 #include <unotools/configitem.hxx>
35 #include "swdllapi.h"
36 #include "authratr.hxx"
37 #include <SwCapObjType.hxx>
38 #include "tblenum.hxx"
39 #include "itabenum.hxx"
40 #include <tools/globname.hxx>
41 class SwModuleOptions;
42 
43 //-----------------------------------------------------------------------------
44 class InsCaptionOpt;
45 typedef InsCaptionOpt* InsCaptionOptPtr;
46 SV_DECL_PTRARR_SORT_DEL(InsCapOptArr, InsCaptionOptPtr, 0, 5)
47 
48 class InsCaptionOptArr : public InsCapOptArr
49 {
50     friend class SwModuleOptions;
51     friend class SwInsertConfig;
52 protected:
53     InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0) const;
54 };
55 
56 /* -----------------------------10.10.00 16:14--------------------------------
57 
58  ---------------------------------------------------------------------------*/
59 class SwRevisionConfig : public utl::ConfigItem
60 {
61     friend class SwModuleOptions;
62 
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     sal_uInt16          nMarkAlign;     //Revision/LinesChanged/Mark
70     Color           aMarkColor;     //Revision/LinesChanged/Color
71 
72     const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
73     public:
74         SwRevisionConfig();
75         ~SwRevisionConfig();
76 
77     virtual void            Commit();
78     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
79     void                    Load();
80     void                    SetModified(){ConfigItem::SetModified();}
81 };
82 /* -----------------------------11.10.00 09:00--------------------------------
83 
84  ---------------------------------------------------------------------------*/
85 class SwInsertConfig : public utl::ConfigItem
86 {
87     friend class SwModuleOptions;
88 
89     InsCaptionOptArr*   pCapOptions;
90     InsCaptionOpt*      pOLEMiscOpt;
91 
92     SvGlobalName        aGlobalNames[5];
93 
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
98                                                 //Insert/Table/Split
99                                                 //Insert/Table/Border
100     SwInsertTableOptions    aInsTblOpts;
101     sal_Bool            bIsWeb;
102 
103     const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
104     public:
105         SwInsertConfig(sal_Bool bWeb);
106         ~SwInsertConfig();
107 
108     virtual void            Commit();
109     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
110     void                    Load();
111     void                    SetModified(){ConfigItem::SetModified();}
112 };
113 /* -----------------------------11.10.00 09:00--------------------------------
114 
115  ---------------------------------------------------------------------------*/
116 class SwTableConfig : public utl::ConfigItem
117 {
118     friend class SwModuleOptions;
119 
120     sal_uInt16      nTblHMove;          //int Table/Shift/Row
121     sal_uInt16      nTblVMove;          //int Table/Shift/Column
122     sal_uInt16      nTblHInsert;        //int Table/Insert/Row
123     sal_uInt16      nTblVInsert;        //int Table/Insert/Column
124     TblChgMode  eTblChgMode;        //int Table/Change/Effect
125 
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
129 
130     const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
131     public:
132         SwTableConfig(sal_Bool bWeb);
133         ~SwTableConfig();
134 
135     virtual void            Commit();
136     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
137     void                    Load();
138     void                    SetModified(){ConfigItem::SetModified();}
139 };
140 /* -----------------------------18.01.01 16:57--------------------------------
141 
142  ---------------------------------------------------------------------------*/
143 class SwMiscConfig : public utl::ConfigItem
144 {
145     friend class SwModuleOptions;
146 
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!)
159 
160     const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
161     public:
162         SwMiscConfig();
163         ~SwMiscConfig();
164 
165     virtual void            Commit();
166     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
167     void                    Load();
168     void                    SetModified(){ConfigItem::SetModified();}
169 };
170 
171 /* ---------------------------------------------------------------------------
172 
173  ---------------------------------------------------------------------------*/
174 class SW_DLLPUBLIC SwModuleOptions
175 {
176     SwRevisionConfig                aRevisionConfig;
177     SwInsertConfig                  aInsertConfig;
178     SwInsertConfig                  aWebInsertConfig;
179 
180     SwTableConfig                   aTableConfig;
181     SwTableConfig                   aWebTableConfig;
182 
183     SwMiscConfig                    aMiscConfig;
184 
185     //fiscus: don't show tips of text fields - it's not part of the configuration!
186     sal_Bool        bHideFieldTips : 1;
187 
188 public:
189     SwModuleOptions();
190 
191     TblChgMode  GetTblMode() const { return aTableConfig.eTblChgMode;}
192     void        SetTblMode( TblChgMode  eSet ) { aTableConfig.eTblChgMode = eSet;
193                                                 aTableConfig.SetModified();}
194 
195     sal_uInt16      GetTblHMove() const { return aTableConfig.nTblHMove;}
196     void        SetTblHMove( sal_uInt16 nSet ) {    aTableConfig.nTblHMove = nSet;
197                                                 aTableConfig.SetModified();}
198 
199     sal_uInt16      GetTblVMove() const { return aTableConfig.nTblVMove;}
200     void        SetTblVMove( sal_uInt16 nSet ) {    aTableConfig.nTblVMove = nSet;
201                                                 aTableConfig.SetModified();}
202 
203     sal_uInt16      GetTblHInsert() const {return aTableConfig.nTblHInsert;}
204     void        SetTblHInsert( sal_uInt16 nSet ) {  aTableConfig.nTblHInsert = nSet;
205                                                 aTableConfig.SetModified();}
206 
207     sal_uInt16      GetTblVInsert() const {return aTableConfig.nTblVInsert;}
208     void        SetTblVInsert( sal_uInt16 nSet ) {  aTableConfig.nTblVInsert = nSet;
209                                                 aTableConfig.SetModified();}
210 
211     const AuthorCharAttr    &GetInsertAuthorAttr() const { return aRevisionConfig.aInsertAttr; }
212     void        SetInsertAuthorAttr( AuthorCharAttr &rAttr ) {  aRevisionConfig.aInsertAttr = rAttr;
213                                                                 aRevisionConfig.SetModified();}
214 
215     const AuthorCharAttr    &GetDeletedAuthorAttr() const { return aRevisionConfig.aDeletedAttr; }
216     void        SetDeletedAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aDeletedAttr = rAttr;
217                                                                 aRevisionConfig.SetModified();}
218 
219     const AuthorCharAttr    &GetFormatAuthorAttr() const { return aRevisionConfig.aFormatAttr; }
220     void        SetFormatAuthorAttr( AuthorCharAttr &rAttr ) {  aRevisionConfig.aFormatAttr = rAttr;
221                                                                 aRevisionConfig.SetModified();}
222 
223     sal_uInt16          GetMarkAlignMode()  const               { return aRevisionConfig.nMarkAlign; }
224     void            SetMarkAlignMode(sal_uInt16 nMode)          { aRevisionConfig.nMarkAlign = nMode;
225                                                               aRevisionConfig.SetModified();}
226 
227     const Color&    GetMarkAlignColor() const               { return aRevisionConfig.aMarkColor; }
228     void            SetMarkAlignColor(const Color &rColor)  { aRevisionConfig.aMarkColor = rColor;
229                                                               aRevisionConfig.SetModified();}
230 
231     sal_Bool        IsInsWithCaption(sal_Bool bHTML) const
232                         { return bHTML ? sal_False : aInsertConfig.bInsWithCaption; }
233     void        SetInsWithCaption( sal_Bool bHTML, sal_Bool b )
234                     {   if(!bHTML)
235                             aInsertConfig.bInsWithCaption = b;
236                         aInsertConfig.SetModified();}
237 
238     sal_Bool    IsCaptionOrderNumberingFirst() const { return aInsertConfig.bCaptionOrderNumberingFirst; }
239     void        SetCaptionOrderNumberingFirst( sal_Bool bSet )
240                 {
241                     if(aInsertConfig.bCaptionOrderNumberingFirst != bSet)
242                     {
243                         aInsertConfig.bCaptionOrderNumberingFirst = bSet;
244                         aInsertConfig.SetModified();
245                     }
246                 }
247 
248     sal_Bool        IsInsTblFormatNum(sal_Bool bHTML) const
249                     { return bHTML ? aWebTableConfig.bInsTblFormatNum : aTableConfig.bInsTblFormatNum; }
250     void        SetInsTblFormatNum( sal_Bool bHTML, sal_Bool b )
251                     { bHTML ? (aWebTableConfig.bInsTblFormatNum = b) : (aTableConfig.bInsTblFormatNum = b);
252                       bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
253 
254     sal_Bool        IsInsTblChangeNumFormat(sal_Bool bHTML) const
255                     { return bHTML ? aWebTableConfig.bInsTblChangeNumFormat : aTableConfig.bInsTblChangeNumFormat; }
256     void        SetInsTblChangeNumFormat( sal_Bool bHTML, sal_Bool b )
257                     { bHTML ? (aWebTableConfig.bInsTblChangeNumFormat = b) : (aTableConfig.bInsTblChangeNumFormat = b);
258                       bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
259 
260 
261     sal_Bool        IsInsTblAlignNum(sal_Bool bHTML) const
262                     { return bHTML ? aWebTableConfig.bInsTblAlignNum : aTableConfig.bInsTblAlignNum; }
263     void        SetInsTblAlignNum( sal_Bool bHTML, sal_Bool b )
264                     { bHTML ? (aWebTableConfig.bInsTblAlignNum = b) : (aTableConfig.bInsTblAlignNum = b);
265                         bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();;}
266 
267     SwInsertTableOptions GetInsTblFlags(sal_Bool bHTML) const
268                     { return bHTML ? aWebInsertConfig.aInsTblOpts : aInsertConfig.aInsTblOpts;}
269     void        SetInsTblFlags( sal_Bool bHTML, const SwInsertTableOptions& rOpts ) {
270                     bHTML ? (aWebInsertConfig.aInsTblOpts = rOpts) : (aInsertConfig.aInsTblOpts = rOpts);
271                     bHTML ? aWebInsertConfig.SetModified() : aInsertConfig.SetModified();}
272 
273     const InsCaptionOpt* GetCapOption(sal_Bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId);
274     sal_Bool        SetCapOption(sal_Bool bHTML, const InsCaptionOpt* pOpt);
275 
276 
277     sal_Bool        IsGrfToGalleryAsLnk() const     { return aMiscConfig.bGrfToGalleryAsLnk; }
278     void        SetGrfToGalleryAsLnk( sal_Bool b )  { aMiscConfig.bGrfToGalleryAsLnk = b;
279                                                   aMiscConfig.SetModified();}
280 
281     sal_Int16   GetMailingFormats() const       { return aMiscConfig.nMailingFormats;}
282     void        SetMailingFormats( sal_Int16 nSet ) { aMiscConfig.nMailingFormats = nSet;
283                                                   aMiscConfig.SetModified();}
284 
285     sal_Bool        IsSinglePrintJob() const        { return aMiscConfig.bSinglePrintJob; }
286     void        SetSinglePrintJob( sal_Bool b )     { aMiscConfig.bSinglePrintJob = b;
287                                                   aMiscConfig.SetModified();}
288 
289     sal_Bool        IsNumAlignSize() const          { return aMiscConfig.bNumAlignSize; }
290     void        SetNumAlignSize( sal_Bool b )       { aMiscConfig.bNumAlignSize = b;
291                                                   aMiscConfig.SetModified();}
292 
293     sal_Bool        IsNameFromColumn() const        { return aMiscConfig.bIsNameFromColumn; }
294     void        SetIsNameFromColumn( sal_Bool bSet )
295                         {
296                             aMiscConfig.SetModified();
297                             aMiscConfig.bIsNameFromColumn = bSet;
298                         }
299 
300     sal_Bool        IsAskForMailMerge() const       { return aMiscConfig.bAskForMailMergeInPrint;}
301     void        SetAskForMailMerge(sal_Bool bSet)
302                     {
303                         aMiscConfig.SetModified();
304                         aMiscConfig.bAskForMailMergeInPrint = bSet;
305                     }
306 
307 
308     const String&   GetNameFromColumn() const       { return aMiscConfig.sNameFromColumn; }
309     void            SetNameFromColumn( const String& rSet )     { aMiscConfig.sNameFromColumn = rSet;
310                                                                 aMiscConfig.SetModified();}
311 
312     String      GetMailingPath() const          { return aMiscConfig.sMailingPath; }
313     void        SetMailingPath(const String& sPath) { aMiscConfig.sMailingPath = sPath;
314                                                       aMiscConfig.SetModified();}
315 
316     String      GetMailName() const             { return aMiscConfig.sMailName; }
317     void        SetMailName(const String& sName){ aMiscConfig.sMailName = sName;
318                                                   aMiscConfig.SetModified();}
319 
320     const String    &GetWordDelimiter() const           { return aMiscConfig.sWordDelimiter; }
321     void        SetWordDelimiter(const String& sDelim)  { aMiscConfig.sWordDelimiter = sDelim;
322                                                           aMiscConfig.SetModified();}
323 
324     //convert word delimiter from or to user interface
325     static String ConvertWordDelimiter(const String& rDelim, sal_Bool bFromUI);
326 
327     sal_Bool        IsShowIndexPreview() const {return  aMiscConfig.bShowIndexPreview;}
328     void        SetShowIndexPreview(sal_Bool bSet)
329                     {aMiscConfig.bShowIndexPreview = bSet;
330                     aMiscConfig.SetModified();}
331 
332     sal_Bool        IsDefaultFontInCurrDocOnly() const { return aMiscConfig.bDefaultFontsInCurrDocOnly;}
333     void        SetDefaultFontInCurrDocOnly(sal_Bool bSet)
334                     {
335                         aMiscConfig.bDefaultFontsInCurrDocOnly = bSet;
336                         aMiscConfig.SetModified();
337                     }
338 
339     sal_Bool        IsHideFieldTips() const {return bHideFieldTips;}
340     void        SetHideFieldTips(sal_Bool bSet) {bHideFieldTips = bSet;}
341 };
342 #endif
343 
344