LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - modcfg.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 116 4.3 %
Date: 2012-12-27 Functions: 5 69 7.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : #ifndef _MODOPT_HXX
      20             : #define _MODOPT_HXX
      21             : 
      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>
      27             : #include "swdllapi.h"
      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;
      35             : 
      36             : class InsCaptionOpt;
      37             : 
      38          10 : class InsCaptionOptArr
      39             : {
      40             : private:
      41             :     typedef boost::ptr_vector<InsCaptionOpt> InsCapOptArr;
      42             :     InsCapOptArr m_aInsCapOptArr;
      43             : public:
      44             :     InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0);
      45             :     void Insert(InsCaptionOpt* pObj);
      46             : };
      47             : 
      48             : class SwRevisionConfig : public utl::ConfigItem
      49             : {
      50             :     friend class SwModuleOptions;
      51             : 
      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
      60             : 
      61             :     const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
      62             :     public:
      63             :         SwRevisionConfig();
      64             :         ~SwRevisionConfig();
      65             : 
      66             :     virtual void            Commit();
      67             :     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
      68             :     void                    Load();
      69           0 :     void                    SetModified(){ConfigItem::SetModified();}
      70             : };
      71             : 
      72             : class SwCompareConfig : public utl::ConfigItem
      73             : {
      74             :     friend class SwModuleOptions;
      75             : 
      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
      80             : 
      81             :     const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
      82             :     public:
      83             :         SwCompareConfig();
      84             :         ~SwCompareConfig();
      85             : 
      86             :     virtual void    Commit();
      87           0 :     virtual void    Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ){ };
      88             :     void            Load();
      89           0 :     void            SetModified() {ConfigItem::SetModified(); }
      90             : };
      91             : 
      92             : class SwInsertConfig : public utl::ConfigItem
      93             : {
      94             :     friend class SwModuleOptions;
      95             : 
      96             :     InsCaptionOptArr*   pCapOptions;
      97             :     InsCaptionOpt*      pOLEMiscOpt;
      98             : 
      99             :     SvGlobalName        aGlobalNames[5];
     100             : 
     101             :     sal_Bool            bInsWithCaption;       //Insert/Caption/Automatic
     102             :     sal_Bool            bCaptionOrderNumberingFirst; //#i61007# caption order starting with numbering
     103             : 
     104             :     SwInsertTableOptions    aInsTblOpts;
     105             :     sal_Bool            bIsWeb;
     106             : 
     107             :     const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
     108             :     public:
     109             :         SwInsertConfig(sal_Bool bWeb);
     110             :         ~SwInsertConfig();
     111             : 
     112             :     virtual void            Commit();
     113             :     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
     114             :     void                    Load();
     115           0 :     void                    SetModified(){ConfigItem::SetModified();}
     116             : };
     117             : 
     118             : class SwTableConfig : public utl::ConfigItem
     119             : {
     120             :     friend class SwModuleOptions;
     121             : 
     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
     127             : 
     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.
     131             : 
     132             :     const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
     133             :     public:
     134             :         SwTableConfig(sal_Bool bWeb);
     135             :         ~SwTableConfig();
     136             : 
     137             :     virtual void            Commit();
     138             :     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
     139             :     void                    Load();
     140           0 :     void                    SetModified(){ConfigItem::SetModified();}
     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           0 :     void                    SetModified(){ConfigItem::SetModified();}
     169             : };
     170             : 
     171           0 : class SW_DLLPUBLIC SwModuleOptions
     172             : {
     173             :     SwRevisionConfig                aRevisionConfig;
     174             :     SwInsertConfig                  aInsertConfig;
     175             :     SwInsertConfig                  aWebInsertConfig;
     176             : 
     177             :     SwTableConfig                   aTableConfig;
     178             :     SwTableConfig                   aWebTableConfig;
     179             : 
     180             :     SwMiscConfig                    aMiscConfig;
     181             : 
     182             :     SwCompareConfig                                     aCompareConfig;
     183             : 
     184             :     //fiscus: don't show tips of text fields - it's not part of the configuration!
     185             :     sal_Bool        bHideFieldTips : 1;
     186             : 
     187             : public:
     188             :     SwModuleOptions();
     189             : 
     190          89 :     TblChgMode  GetTblMode() const { return aTableConfig.eTblChgMode;}
     191           0 :     void        SetTblMode( TblChgMode  eSet ) { aTableConfig.eTblChgMode = eSet;
     192           0 :                                                 aTableConfig.SetModified();}
     193             : 
     194           0 :     sal_uInt16      GetTblHMove() const { return aTableConfig.nTblHMove;}
     195           0 :     void        SetTblHMove( sal_uInt16 nSet ) {    aTableConfig.nTblHMove = nSet;
     196           0 :                                                 aTableConfig.SetModified();}
     197             : 
     198           0 :     sal_uInt16      GetTblVMove() const { return aTableConfig.nTblVMove;}
     199           0 :     void        SetTblVMove( sal_uInt16 nSet ) {    aTableConfig.nTblVMove = nSet;
     200           0 :                                                 aTableConfig.SetModified();}
     201             : 
     202           0 :     sal_uInt16      GetTblHInsert() const {return aTableConfig.nTblHInsert;}
     203           0 :     void        SetTblHInsert( sal_uInt16 nSet ) {  aTableConfig.nTblHInsert = nSet;
     204           0 :                                                 aTableConfig.SetModified();}
     205             : 
     206           0 :     sal_uInt16      GetTblVInsert() const {return aTableConfig.nTblVInsert;}
     207           0 :     void        SetTblVInsert( sal_uInt16 nSet ) {  aTableConfig.nTblVInsert = nSet;
     208           0 :                                                 aTableConfig.SetModified();}
     209             : 
     210           0 :     const AuthorCharAttr    &GetInsertAuthorAttr() const { return aRevisionConfig.aInsertAttr; }
     211           0 :     void        SetInsertAuthorAttr( AuthorCharAttr &rAttr ) {  aRevisionConfig.aInsertAttr = rAttr;
     212           0 :                                                                 aRevisionConfig.SetModified();}
     213             : 
     214           5 :     const AuthorCharAttr    &GetDeletedAuthorAttr() const { return aRevisionConfig.aDeletedAttr; }
     215           0 :     void        SetDeletedAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aDeletedAttr = rAttr;
     216           0 :                                                                 aRevisionConfig.SetModified();}
     217             : 
     218           0 :     const AuthorCharAttr    &GetFormatAuthorAttr() const { return aRevisionConfig.aFormatAttr; }
     219           0 :     void        SetFormatAuthorAttr( AuthorCharAttr &rAttr ) {  aRevisionConfig.aFormatAttr = rAttr;
     220           0 :                                                                 aRevisionConfig.SetModified();}
     221             : 
     222        3138 :     sal_uInt16          GetMarkAlignMode()  const               { return aRevisionConfig.nMarkAlign; }
     223           0 :     void            SetMarkAlignMode(sal_uInt16 nMode)          { aRevisionConfig.nMarkAlign = nMode;
     224           0 :                                                               aRevisionConfig.SetModified();}
     225             : 
     226           3 :     const Color&    GetMarkAlignColor() const               { return aRevisionConfig.aMarkColor; }
     227           0 :     void            SetMarkAlignColor(const Color &rColor)  { aRevisionConfig.aMarkColor = rColor;
     228           0 :                                                               aRevisionConfig.SetModified();}
     229             : 
     230           0 :     sal_Bool        IsInsWithCaption(sal_Bool bHTML) const
     231           0 :                         { return bHTML ? sal_False : aInsertConfig.bInsWithCaption; }
     232           0 :     void        SetInsWithCaption( sal_Bool bHTML, sal_Bool b )
     233           0 :                     {   if(!bHTML)
     234           0 :                             aInsertConfig.bInsWithCaption = b;
     235           0 :                         aInsertConfig.SetModified();}
     236             : 
     237           0 :     sal_Bool    IsCaptionOrderNumberingFirst() const { return aInsertConfig.bCaptionOrderNumberingFirst; }
     238           0 :     void        SetCaptionOrderNumberingFirst( sal_Bool bSet )
     239             :                 {
     240           0 :                     if(aInsertConfig.bCaptionOrderNumberingFirst != bSet)
     241             :                     {
     242           0 :                         aInsertConfig.bCaptionOrderNumberingFirst = bSet;
     243           0 :                         aInsertConfig.SetModified();
     244             :                     }
     245           0 :                 }
     246             : 
     247           0 :     sal_Bool        IsInsTblFormatNum(sal_Bool bHTML) const
     248           0 :                     { return bHTML ? aWebTableConfig.bInsTblFormatNum : aTableConfig.bInsTblFormatNum; }
     249           0 :     void        SetInsTblFormatNum( sal_Bool bHTML, sal_Bool b )
     250           0 :                     { bHTML ? (aWebTableConfig.bInsTblFormatNum = b) : (aTableConfig.bInsTblFormatNum = b);
     251           0 :                       bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     252             : 
     253           0 :     sal_Bool        IsInsTblChangeNumFormat(sal_Bool bHTML) const
     254           0 :                     { return bHTML ? aWebTableConfig.bInsTblChangeNumFormat : aTableConfig.bInsTblChangeNumFormat; }
     255           0 :     void        SetInsTblChangeNumFormat( sal_Bool bHTML, sal_Bool b )
     256           0 :                     { bHTML ? (aWebTableConfig.bInsTblChangeNumFormat = b) : (aTableConfig.bInsTblChangeNumFormat = b);
     257           0 :                       bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     258             : 
     259             : 
     260           0 :     sal_Bool        IsInsTblAlignNum(sal_Bool bHTML) const
     261           0 :                     { return bHTML ? aWebTableConfig.bInsTblAlignNum : aTableConfig.bInsTblAlignNum; }
     262           0 :     void        SetInsTblAlignNum( sal_Bool bHTML, sal_Bool b )
     263           0 :                     { bHTML ? (aWebTableConfig.bInsTblAlignNum = b) : (aTableConfig.bInsTblAlignNum = b);
     264           0 :                         bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     265             : 
     266           0 :     SwInsertTableOptions GetInsTblFlags(sal_Bool bHTML) const
     267           0 :                     { return bHTML ? aWebInsertConfig.aInsTblOpts : aInsertConfig.aInsTblOpts;}
     268           0 :     void        SetInsTblFlags( sal_Bool bHTML, const SwInsertTableOptions& rOpts ) {
     269           0 :                     bHTML ? (aWebInsertConfig.aInsTblOpts = rOpts) : (aInsertConfig.aInsTblOpts = rOpts);
     270           0 :                     bHTML ? aWebInsertConfig.SetModified() : aInsertConfig.SetModified();}
     271             : 
     272             :     const InsCaptionOpt* GetCapOption(sal_Bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId);
     273             :     sal_Bool        SetCapOption(sal_Bool bHTML, const InsCaptionOpt* pOpt);
     274             : 
     275             : 
     276           0 :     sal_Bool        IsGrfToGalleryAsLnk() const     { return aMiscConfig.bGrfToGalleryAsLnk; }
     277           0 :     void        SetGrfToGalleryAsLnk( sal_Bool b )  { aMiscConfig.bGrfToGalleryAsLnk = b;
     278           0 :                                                   aMiscConfig.SetModified();}
     279             : 
     280           0 :     sal_Int16   GetMailingFormats() const       { return aMiscConfig.nMailingFormats;}
     281           0 :     void        SetMailingFormats( sal_Int16 nSet ) { aMiscConfig.nMailingFormats = nSet;
     282           0 :                                                   aMiscConfig.SetModified();}
     283             : 
     284             :     sal_Bool        IsSinglePrintJob() const        { return aMiscConfig.bSinglePrintJob; }
     285           0 :     void        SetSinglePrintJob( sal_Bool b )     { aMiscConfig.bSinglePrintJob = b;
     286           0 :                                                   aMiscConfig.SetModified();}
     287             : 
     288             :     sal_Bool        IsNumAlignSize() const          { return aMiscConfig.bNumAlignSize; }
     289             :     void        SetNumAlignSize( sal_Bool b )       { aMiscConfig.bNumAlignSize = b;
     290             :                                                   aMiscConfig.SetModified();}
     291             : 
     292           0 :     sal_Bool        IsNameFromColumn() const        { return aMiscConfig.bIsNameFromColumn; }
     293           0 :     void        SetIsNameFromColumn( sal_Bool bSet )
     294             :                         {
     295           0 :                             aMiscConfig.SetModified();
     296           0 :                             aMiscConfig.bIsNameFromColumn = bSet;
     297           0 :                         }
     298             : 
     299           0 :     sal_Bool        IsAskForMailMerge() const       { return aMiscConfig.bAskForMailMergeInPrint;}
     300             :     void        SetAskForMailMerge(sal_Bool bSet)
     301             :                     {
     302             :                         aMiscConfig.SetModified();
     303             :                         aMiscConfig.bAskForMailMergeInPrint = bSet;
     304             :                     }
     305             : 
     306             : 
     307           0 :     const String&   GetNameFromColumn() const       { return aMiscConfig.sNameFromColumn; }
     308           0 :     void            SetNameFromColumn( const String& rSet )     { aMiscConfig.sNameFromColumn = rSet;
     309           0 :                                                                   aMiscConfig.SetModified();}
     310             : 
     311           0 :     String      GetMailingPath() const          { return aMiscConfig.sMailingPath; }
     312           0 :     void        SetMailingPath(const String& sPath) { aMiscConfig.sMailingPath = sPath;
     313           0 :                                                       aMiscConfig.SetModified();}
     314             : 
     315             :     String      GetMailName() const             { return aMiscConfig.sMailName; }
     316             :     void        SetMailName(const String& sName){ aMiscConfig.sMailName = sName;
     317             :                                                   aMiscConfig.SetModified();}
     318             : 
     319           0 :     const String    &GetWordDelimiter() const           { return aMiscConfig.sWordDelimiter; }
     320           0 :     void        SetWordDelimiter(const String& sDelim)  { aMiscConfig.sWordDelimiter = sDelim;
     321           0 :                                                           aMiscConfig.SetModified();}
     322             : 
     323             :     //convert word delimiter from or to user interface
     324             :     static String ConvertWordDelimiter(const String& rDelim, sal_Bool bFromUI);
     325             : 
     326           0 :     sal_Bool    IsShowIndexPreview() const {return  aMiscConfig.bShowIndexPreview;}
     327           0 :     void        SetShowIndexPreview(sal_Bool bSet)
     328           0 :                     {aMiscConfig.bShowIndexPreview = bSet;
     329           0 :                     aMiscConfig.SetModified();}
     330             : 
     331           0 :     sal_Bool    IsDefaultFontInCurrDocOnly() const { return aMiscConfig.bDefaultFontsInCurrDocOnly;}
     332           0 :     void        SetDefaultFontInCurrDocOnly(sal_Bool bSet)
     333             :                     {
     334           0 :                         aMiscConfig.bDefaultFontsInCurrDocOnly = bSet;
     335           0 :                         aMiscConfig.SetModified();
     336           0 :                     }
     337             : 
     338           0 :     sal_Bool    IsHideFieldTips() const {return bHideFieldTips;}
     339           0 :     void        SetHideFieldTips(sal_Bool bSet) {bHideFieldTips = bSet;}
     340             : 
     341           0 :     SvxCompareMode  GetCompareMode() const { return (SvxCompareMode)aCompareConfig.eCmpMode; }
     342           0 :     void            SetCompareMode( SvxCompareMode eMode ) { aCompareConfig.eCmpMode = eMode;
     343           0 :                                                              aCompareConfig.SetModified(); }
     344             : 
     345           0 :     sal_Bool    IsUseRsid() const { return aCompareConfig.bUseRsid; }
     346           0 :     void        SetUseRsid( sal_Bool b ) { aCompareConfig.bUseRsid = b;
     347           0 :                                                             aCompareConfig.SetModified(); }
     348             : 
     349           0 :     sal_Bool    IsIgnorePieces() const { return aCompareConfig.bIgnorePieces; }
     350           0 :     void        SetIgnorePieces( sal_Bool b ) { aCompareConfig.bIgnorePieces = b;
     351           0 :                                                 aCompareConfig.SetModified(); }
     352             : 
     353           0 :     sal_uInt16  GetPieceLen() const { return aCompareConfig.nPieceLen; }
     354           0 :     void        SetPieceLen( sal_uInt16 nLen ) { aCompareConfig.nPieceLen = nLen;
     355           0 :                                                  aCompareConfig.SetModified(); }
     356             : 
     357             : };
     358             : #endif
     359             : 
     360             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10