1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _MODOPT_HXX 24 #define _MODOPT_HXX 25 26 #include <tools/string.hxx> 27 #include <tools/wintypes.hxx> 28 #include <vcl/field.hxx> 29 #include <svl/svarray.hxx> 30 #include <unotools/configitem.hxx> 31 #include "swdllapi.h" 32 #include "authratr.hxx" 33 #include <SwCapObjType.hxx> 34 #include "tblenum.hxx" 35 #include "itabenum.hxx" 36 #include <tools/globname.hxx> 37 class SwModuleOptions; 38 39 //----------------------------------------------------------------------------- 40 class InsCaptionOpt; 41 typedef InsCaptionOpt* InsCaptionOptPtr; 42 SV_DECL_PTRARR_SORT_DEL(InsCapOptArr, InsCaptionOptPtr, 0, 5) 43 44 class InsCaptionOptArr : public InsCapOptArr 45 { 46 friend class SwModuleOptions; 47 friend class SwInsertConfig; 48 protected: 49 InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0) const; 50 }; 51 52 /* -----------------------------10.10.00 16:14-------------------------------- 53 54 ---------------------------------------------------------------------------*/ 55 class SwRevisionConfig : public utl::ConfigItem 56 { 57 friend class SwModuleOptions; 58 59 AuthorCharAttr aInsertAttr; //Revision/TextDisplay/Insert/Attribute // Redlining: Author-Zeichenattribute 60 //Revision/TextDisplay/Insert/Color 61 AuthorCharAttr aDeletedAttr; //Revision/TextDisplay/Delete/Attribute 62 //Revision/TextDisplay/Delete/Color 63 AuthorCharAttr aFormatAttr; //Revision/TextDisplay/ChangeAttribute/Attribute 64 //Revision/TextDisplay/ChangeAttribute/Color 65 sal_uInt16 nMarkAlign; //Revision/LinesChanged/Mark 66 Color aMarkColor; //Revision/LinesChanged/Color 67 68 const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames(); 69 public: 70 SwRevisionConfig(); 71 ~SwRevisionConfig(); 72 73 virtual void Commit(); 74 virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 75 void Load(); SetModified()76 void SetModified(){ConfigItem::SetModified();} 77 }; 78 /* -----------------------------11.10.00 09:00-------------------------------- 79 80 ---------------------------------------------------------------------------*/ 81 class SwInsertConfig : public utl::ConfigItem 82 { 83 friend class SwModuleOptions; 84 85 InsCaptionOptArr* pCapOptions; 86 InsCaptionOpt* pOLEMiscOpt; 87 88 SvGlobalName aGlobalNames[5]; 89 90 sal_Bool bInsWithCaption; //Insert/Caption/Automatic // Objekte beschriftet einfuegen 91 sal_Bool bCaptionOrderNumberingFirst; //#i61007# caption order starting with numbering 92 // sal_uInt16 nInsTblFlags; //Insert/Table/Header // Flags fuer Tabellen einfuegen 93 //Insert/Table/RepeatHeader 94 //Insert/Table/Split 95 //Insert/Table/Border 96 SwInsertTableOptions aInsTblOpts; 97 sal_Bool bIsWeb; 98 99 const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames(); 100 public: 101 SwInsertConfig(sal_Bool bWeb); 102 ~SwInsertConfig(); 103 104 virtual void Commit(); 105 virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 106 void Load(); SetModified()107 void SetModified(){ConfigItem::SetModified();} 108 }; 109 /* -----------------------------11.10.00 09:00-------------------------------- 110 111 ---------------------------------------------------------------------------*/ 112 class SwTableConfig : public utl::ConfigItem 113 { 114 friend class SwModuleOptions; 115 116 sal_uInt16 nTblHMove; //int Table/Shift/Row 117 sal_uInt16 nTblVMove; //int Table/Shift/Column 118 sal_uInt16 nTblHInsert; //int Table/Insert/Row 119 sal_uInt16 nTblVInsert; //int Table/Insert/Column 120 TblChgMode eTblChgMode; //int Table/Change/Effect 121 122 sal_Bool bInsTblFormatNum; // Table/Input/NumberRecognition // Automatische Zahlenerkennung 123 sal_Bool bInsTblChangeNumFormat; // Table/Input/NumberFormatRecognition // Automatische Zahlenformaterkennung 124 sal_Bool bInsTblAlignNum; // Table/Input/Alignment // Zahlen ausrichten 125 126 const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames(); 127 public: 128 SwTableConfig(sal_Bool bWeb); 129 ~SwTableConfig(); 130 131 virtual void Commit(); 132 virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 133 void Load(); SetModified()134 void SetModified(){ConfigItem::SetModified();} 135 }; 136 /* -----------------------------18.01.01 16:57-------------------------------- 137 138 ---------------------------------------------------------------------------*/ 139 class SwMiscConfig : public utl::ConfigItem 140 { 141 friend class SwModuleOptions; 142 143 String sWordDelimiter; // Statistics/WordNumber/Delimiter 144 sal_Bool bDefaultFontsInCurrDocOnly; // DefaultFont/Document 145 sal_Bool bShowIndexPreview ; // Index/ShowPreview 146 sal_Bool bGrfToGalleryAsLnk; // Misc/GraphicToGalleryAsLink 147 sal_Bool bNumAlignSize; // Numbering/Graphic/KeepRatio 148 sal_Bool bSinglePrintJob; // FormLetter/PrintOutput/SinglePrintJobs 149 sal_Bool bIsNameFromColumn; // FormLetter/FileOutput/FileName/Generation 150 sal_Bool bAskForMailMergeInPrint; // Ask if documents containing fields should be 'mailmerged' 151 sal_Int16 nMailingFormats; // FormLetter/MailingOutput/Formats 152 String sNameFromColumn; // FormLetter/FileOutput/FileName/FromDatabaseField (string!) 153 String sMailingPath; // FormLetter/FileOutput/Path 154 String sMailName; // FormLetter/FileOutput/FileName/FromManualSetting (string!) 155 156 const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames(); 157 public: 158 SwMiscConfig(); 159 ~SwMiscConfig(); 160 161 virtual void Commit(); 162 virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 163 void Load(); SetModified()164 void SetModified(){ConfigItem::SetModified();} 165 }; 166 167 /* --------------------------------------------------------------------------- 168 169 ---------------------------------------------------------------------------*/ 170 class SW_DLLPUBLIC SwModuleOptions 171 { 172 SwRevisionConfig aRevisionConfig; 173 SwInsertConfig aInsertConfig; 174 SwInsertConfig aWebInsertConfig; 175 176 SwTableConfig aTableConfig; 177 SwTableConfig aWebTableConfig; 178 179 SwMiscConfig aMiscConfig; 180 181 //fiscus: don't show tips of text fields - it's not part of the configuration! 182 sal_Bool bHideFieldTips : 1; 183 184 public: 185 SwModuleOptions(); 186 GetTblMode() const187 TblChgMode GetTblMode() const { return aTableConfig.eTblChgMode;} SetTblMode(TblChgMode eSet)188 void SetTblMode( TblChgMode eSet ) { aTableConfig.eTblChgMode = eSet; 189 aTableConfig.SetModified();} 190 GetTblHMove() const191 sal_uInt16 GetTblHMove() const { return aTableConfig.nTblHMove;} SetTblHMove(sal_uInt16 nSet)192 void SetTblHMove( sal_uInt16 nSet ) { aTableConfig.nTblHMove = nSet; 193 aTableConfig.SetModified();} 194 GetTblVMove() const195 sal_uInt16 GetTblVMove() const { return aTableConfig.nTblVMove;} SetTblVMove(sal_uInt16 nSet)196 void SetTblVMove( sal_uInt16 nSet ) { aTableConfig.nTblVMove = nSet; 197 aTableConfig.SetModified();} 198 GetTblHInsert() const199 sal_uInt16 GetTblHInsert() const {return aTableConfig.nTblHInsert;} SetTblHInsert(sal_uInt16 nSet)200 void SetTblHInsert( sal_uInt16 nSet ) { aTableConfig.nTblHInsert = nSet; 201 aTableConfig.SetModified();} 202 GetTblVInsert() const203 sal_uInt16 GetTblVInsert() const {return aTableConfig.nTblVInsert;} SetTblVInsert(sal_uInt16 nSet)204 void SetTblVInsert( sal_uInt16 nSet ) { aTableConfig.nTblVInsert = nSet; 205 aTableConfig.SetModified();} 206 GetInsertAuthorAttr() const207 const AuthorCharAttr &GetInsertAuthorAttr() const { return aRevisionConfig.aInsertAttr; } SetInsertAuthorAttr(AuthorCharAttr & rAttr)208 void SetInsertAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aInsertAttr = rAttr; 209 aRevisionConfig.SetModified();} 210 GetDeletedAuthorAttr() const211 const AuthorCharAttr &GetDeletedAuthorAttr() const { return aRevisionConfig.aDeletedAttr; } SetDeletedAuthorAttr(AuthorCharAttr & rAttr)212 void SetDeletedAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aDeletedAttr = rAttr; 213 aRevisionConfig.SetModified();} 214 GetFormatAuthorAttr() const215 const AuthorCharAttr &GetFormatAuthorAttr() const { return aRevisionConfig.aFormatAttr; } SetFormatAuthorAttr(AuthorCharAttr & rAttr)216 void SetFormatAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aFormatAttr = rAttr; 217 aRevisionConfig.SetModified();} 218 GetMarkAlignMode() const219 sal_uInt16 GetMarkAlignMode() const { return aRevisionConfig.nMarkAlign; } SetMarkAlignMode(sal_uInt16 nMode)220 void SetMarkAlignMode(sal_uInt16 nMode) { aRevisionConfig.nMarkAlign = nMode; 221 aRevisionConfig.SetModified();} 222 GetMarkAlignColor() const223 const Color& GetMarkAlignColor() const { return aRevisionConfig.aMarkColor; } SetMarkAlignColor(const Color & rColor)224 void SetMarkAlignColor(const Color &rColor) { aRevisionConfig.aMarkColor = rColor; 225 aRevisionConfig.SetModified();} 226 IsInsWithCaption(sal_Bool bHTML) const227 sal_Bool IsInsWithCaption(sal_Bool bHTML) const 228 { return bHTML ? sal_False : aInsertConfig.bInsWithCaption; } SetInsWithCaption(sal_Bool bHTML,sal_Bool b)229 void SetInsWithCaption( sal_Bool bHTML, sal_Bool b ) 230 { if(!bHTML) 231 aInsertConfig.bInsWithCaption = b; 232 aInsertConfig.SetModified();} 233 IsCaptionOrderNumberingFirst() const234 sal_Bool IsCaptionOrderNumberingFirst() const { return aInsertConfig.bCaptionOrderNumberingFirst; } SetCaptionOrderNumberingFirst(sal_Bool bSet)235 void SetCaptionOrderNumberingFirst( sal_Bool bSet ) 236 { 237 if(aInsertConfig.bCaptionOrderNumberingFirst != bSet) 238 { 239 aInsertConfig.bCaptionOrderNumberingFirst = bSet; 240 aInsertConfig.SetModified(); 241 } 242 } 243 IsInsTblFormatNum(sal_Bool bHTML) const244 sal_Bool IsInsTblFormatNum(sal_Bool bHTML) const 245 { return bHTML ? aWebTableConfig.bInsTblFormatNum : aTableConfig.bInsTblFormatNum; } SetInsTblFormatNum(sal_Bool bHTML,sal_Bool b)246 void SetInsTblFormatNum( sal_Bool bHTML, sal_Bool b ) 247 { bHTML ? (aWebTableConfig.bInsTblFormatNum = b) : (aTableConfig.bInsTblFormatNum = b); 248 bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();} 249 IsInsTblChangeNumFormat(sal_Bool bHTML) const250 sal_Bool IsInsTblChangeNumFormat(sal_Bool bHTML) const 251 { return bHTML ? aWebTableConfig.bInsTblChangeNumFormat : aTableConfig.bInsTblChangeNumFormat; } SetInsTblChangeNumFormat(sal_Bool bHTML,sal_Bool b)252 void SetInsTblChangeNumFormat( sal_Bool bHTML, sal_Bool b ) 253 { bHTML ? (aWebTableConfig.bInsTblChangeNumFormat = b) : (aTableConfig.bInsTblChangeNumFormat = b); 254 bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();} 255 256 IsInsTblAlignNum(sal_Bool bHTML) const257 sal_Bool IsInsTblAlignNum(sal_Bool bHTML) const 258 { return bHTML ? aWebTableConfig.bInsTblAlignNum : aTableConfig.bInsTblAlignNum; } SetInsTblAlignNum(sal_Bool bHTML,sal_Bool b)259 void SetInsTblAlignNum( sal_Bool bHTML, sal_Bool b ) 260 { bHTML ? (aWebTableConfig.bInsTblAlignNum = b) : (aTableConfig.bInsTblAlignNum = b); 261 bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();;} 262 GetInsTblFlags(sal_Bool bHTML) const263 SwInsertTableOptions GetInsTblFlags(sal_Bool bHTML) const 264 { return bHTML ? aWebInsertConfig.aInsTblOpts : aInsertConfig.aInsTblOpts;} SetInsTblFlags(sal_Bool bHTML,const SwInsertTableOptions & rOpts)265 void SetInsTblFlags( sal_Bool bHTML, const SwInsertTableOptions& rOpts ) { 266 bHTML ? (aWebInsertConfig.aInsTblOpts = rOpts) : (aInsertConfig.aInsTblOpts = rOpts); 267 bHTML ? aWebInsertConfig.SetModified() : aInsertConfig.SetModified();} 268 269 const InsCaptionOpt* GetCapOption(sal_Bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId); 270 sal_Bool SetCapOption(sal_Bool bHTML, const InsCaptionOpt* pOpt); 271 272 IsGrfToGalleryAsLnk() const273 sal_Bool IsGrfToGalleryAsLnk() const { return aMiscConfig.bGrfToGalleryAsLnk; } SetGrfToGalleryAsLnk(sal_Bool b)274 void SetGrfToGalleryAsLnk( sal_Bool b ) { aMiscConfig.bGrfToGalleryAsLnk = b; 275 aMiscConfig.SetModified();} 276 GetMailingFormats() const277 sal_Int16 GetMailingFormats() const { return aMiscConfig.nMailingFormats;} SetMailingFormats(sal_Int16 nSet)278 void SetMailingFormats( sal_Int16 nSet ) { aMiscConfig.nMailingFormats = nSet; 279 aMiscConfig.SetModified();} 280 IsSinglePrintJob() const281 sal_Bool IsSinglePrintJob() const { return aMiscConfig.bSinglePrintJob; } SetSinglePrintJob(sal_Bool b)282 void SetSinglePrintJob( sal_Bool b ) { aMiscConfig.bSinglePrintJob = b; 283 aMiscConfig.SetModified();} 284 IsNumAlignSize() const285 sal_Bool IsNumAlignSize() const { return aMiscConfig.bNumAlignSize; } SetNumAlignSize(sal_Bool b)286 void SetNumAlignSize( sal_Bool b ) { aMiscConfig.bNumAlignSize = b; 287 aMiscConfig.SetModified();} 288 IsNameFromColumn() const289 sal_Bool IsNameFromColumn() const { return aMiscConfig.bIsNameFromColumn; } SetIsNameFromColumn(sal_Bool bSet)290 void SetIsNameFromColumn( sal_Bool bSet ) 291 { 292 aMiscConfig.SetModified(); 293 aMiscConfig.bIsNameFromColumn = bSet; 294 } 295 IsAskForMailMerge() const296 sal_Bool IsAskForMailMerge() const { return aMiscConfig.bAskForMailMergeInPrint;} SetAskForMailMerge(sal_Bool bSet)297 void SetAskForMailMerge(sal_Bool bSet) 298 { 299 aMiscConfig.SetModified(); 300 aMiscConfig.bAskForMailMergeInPrint = bSet; 301 } 302 303 GetNameFromColumn() const304 const String& GetNameFromColumn() const { return aMiscConfig.sNameFromColumn; } SetNameFromColumn(const String & rSet)305 void SetNameFromColumn( const String& rSet ) { aMiscConfig.sNameFromColumn = rSet; 306 aMiscConfig.SetModified();} 307 GetMailingPath() const308 String GetMailingPath() const { return aMiscConfig.sMailingPath; } SetMailingPath(const String & sPath)309 void SetMailingPath(const String& sPath) { aMiscConfig.sMailingPath = sPath; 310 aMiscConfig.SetModified();} 311 GetMailName() const312 String GetMailName() const { return aMiscConfig.sMailName; } SetMailName(const String & sName)313 void SetMailName(const String& sName){ aMiscConfig.sMailName = sName; 314 aMiscConfig.SetModified();} 315 GetWordDelimiter() const316 const String &GetWordDelimiter() const { return aMiscConfig.sWordDelimiter; } SetWordDelimiter(const String & sDelim)317 void SetWordDelimiter(const String& sDelim) { aMiscConfig.sWordDelimiter = sDelim; 318 aMiscConfig.SetModified();} 319 320 //convert word delimiter from or to user interface 321 static String ConvertWordDelimiter(const String& rDelim, sal_Bool bFromUI); 322 IsShowIndexPreview() const323 sal_Bool IsShowIndexPreview() const {return aMiscConfig.bShowIndexPreview;} SetShowIndexPreview(sal_Bool bSet)324 void SetShowIndexPreview(sal_Bool bSet) 325 {aMiscConfig.bShowIndexPreview = bSet; 326 aMiscConfig.SetModified();} 327 IsDefaultFontInCurrDocOnly() const328 sal_Bool IsDefaultFontInCurrDocOnly() const { return aMiscConfig.bDefaultFontsInCurrDocOnly;} SetDefaultFontInCurrDocOnly(sal_Bool bSet)329 void SetDefaultFontInCurrDocOnly(sal_Bool bSet) 330 { 331 aMiscConfig.bDefaultFontsInCurrDocOnly = bSet; 332 aMiscConfig.SetModified(); 333 } 334 IsHideFieldTips() const335 sal_Bool IsHideFieldTips() const {return bHideFieldTips;} SetHideFieldTips(sal_Bool bSet)336 void SetHideFieldTips(sal_Bool bSet) {bHideFieldTips = bSet;} 337 }; 338 #endif 339 340