LCOV - code coverage report
Current view: top level - sw/inc - modcfg.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 23 122 18.9 %
Date: 2015-06-13 12:38:46 Functions: 18 71 25.4 %
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 INCLUDED_SW_INC_MODCFG_HXX
      20             : #define INCLUDED_SW_INC_MODCFG_HXX
      21             : 
      22             : #include <boost/ptr_container/ptr_vector.hpp>
      23             : #include <tools/wintypes.hxx>
      24             : #include <vcl/field.hxx>
      25             : #include <unotools/configitem.hxx>
      26             : #include "swdllapi.h"
      27             : #include "authratr.hxx"
      28             : #include <SwCapObjType.hxx>
      29             : #include "tblenum.hxx"
      30             : #include "itabenum.hxx"
      31             : #include <tools/globname.hxx>
      32             : #include <editeng/svxenum.hxx>
      33             : #include <o3tl/typed_flags_set.hxx>
      34             : 
      35             : class SwModuleOptions;
      36             : class InsCaptionOpt;
      37             : 
      38             : // text format for the sending of messages ------------------------------
      39             : enum class MailTextFormats
      40             : {
      41             :     NONE      = 0x00,
      42             :     ASCII     = 0x01,
      43             :     HTML      = 0x02,
      44             :     RTF       = 0x04,
      45             :     OFFICE    = 0x08
      46             : };
      47             : namespace o3tl
      48             : {
      49             :     template<> struct typed_flags<MailTextFormats> : is_typed_flags<MailTextFormats, 0x0f> {};
      50             : }
      51             : 
      52             : 
      53          85 : class InsCaptionOptArr
      54             : {
      55             : private:
      56             :     typedef boost::ptr_vector<InsCaptionOpt> InsCapOptArr;
      57             :     InsCapOptArr m_aInsCapOptArr;
      58             : public:
      59             :     InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0);
      60             :     void Insert(InsCaptionOpt* pObj);
      61             : };
      62             : 
      63             : class SwRevisionConfig : public utl::ConfigItem
      64             : {
      65             :     friend class SwModuleOptions;
      66             : 
      67             :     AuthorCharAttr  aInsertAttr;    //Revision/TextDisplay/Insert/Attribute  // Redlining: Author-Zeichenattribute
      68             :                                     //Revision/TextDisplay/Insert/Color
      69             :     AuthorCharAttr  aDeletedAttr;   //Revision/TextDisplay/Delete/Attribute
      70             :                                     //Revision/TextDisplay/Delete/Color
      71             :     AuthorCharAttr  aFormatAttr;    //Revision/TextDisplay/ChangeAttribute/Attribute
      72             :                                     //Revision/TextDisplay/ChangeAttribute/Color
      73             :     sal_uInt16          nMarkAlign;     //Revision/LinesChanged/Mark
      74             :     Color           aMarkColor;     //Revision/LinesChanged/Color
      75             : 
      76             :     static const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
      77             : 
      78             :     virtual void            ImplCommit() SAL_OVERRIDE;
      79             : 
      80             : public:
      81             :     SwRevisionConfig();
      82             :     virtual ~SwRevisionConfig();
      83             : 
      84             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
      85             :     void                    Load();
      86           0 :     void                    SetModified(){ConfigItem::SetModified();}
      87             : };
      88             : 
      89             : class SwCompareConfig : public utl::ConfigItem
      90             : {
      91             :     friend class SwModuleOptions;
      92             : 
      93             :     sal_uInt16      eCmpMode;           //Compare/CompareDocuments;
      94             :     bool            bUseRsid;       //Compare/Settings/Use RSID
      95             :     /// Compare/Settings/Store RSID
      96             :     bool            m_bStoreRsid;
      97             :     bool            bIgnorePieces;  //Compare/Settings/Ignore pieces of length
      98             :     sal_uInt16      nPieceLen;          //Compare/Settings/Ignore pieces of length
      99             : 
     100             :     static const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
     101             : 
     102             :     virtual void    ImplCommit() SAL_OVERRIDE;
     103             : 
     104             : public:
     105             :     SwCompareConfig();
     106             :     virtual ~SwCompareConfig();
     107             : 
     108           0 :     virtual void    Notify( const ::com::sun::star::uno::Sequence< OUString >& ) SAL_OVERRIDE { };
     109             :     void            Load();
     110           2 :     void            SetModified() {ConfigItem::SetModified(); }
     111             : };
     112             : 
     113             : class SwInsertConfig : public utl::ConfigItem
     114             : {
     115             :     friend class SwModuleOptions;
     116             : 
     117             :     InsCaptionOptArr*   pCapOptions;
     118             :     InsCaptionOpt*      pOLEMiscOpt;
     119             : 
     120             :     SvGlobalName        aGlobalNames[5];
     121             : 
     122             :     bool            bInsWithCaption;       //Insert/Caption/Automatic
     123             :     bool            bCaptionOrderNumberingFirst; //#i61007# caption order starting with numbering
     124             : 
     125             :     SwInsertTableOptions    aInsTableOpts;
     126             :     bool            bIsWeb;
     127             : 
     128             :     const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
     129             : 
     130             :     virtual void    ImplCommit() SAL_OVERRIDE;
     131             : 
     132             : public:
     133             :     SwInsertConfig(bool bWeb);
     134             :     virtual ~SwInsertConfig();
     135             : 
     136             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
     137             :     void                    Load();
     138           0 :     void                    SetModified(){ConfigItem::SetModified();}
     139             : };
     140             : 
     141             : class SwTableConfig : public utl::ConfigItem
     142             : {
     143             :     friend class SwModuleOptions;
     144             : 
     145             :     sal_uInt16      nTableHMove;          //int Table/Shift/Row
     146             :     sal_uInt16      nTableVMove;          //int Table/Shift/Column
     147             :     sal_uInt16      nTableHInsert;        //int Table/Insert/Row
     148             :     sal_uInt16      nTableVInsert;        //int Table/Insert/Column
     149             :     TableChgMode  eTableChgMode;        //int Table/Change/Effect
     150             : 
     151             :     bool    bInsTableFormatNum;       // Table/Input/NumberRecognition        // Automatic recognition of numbers.
     152             :     bool    bInsTableChangeNumFormat; // Table/Input/NumberFormatRecognition  // Automatic recognition of number formats.
     153             :     bool    bInsTableAlignNum;        // Table/Input/Alignment                // Align numbers.
     154             : 
     155             :     static const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
     156             : 
     157             :     virtual void    ImplCommit() SAL_OVERRIDE;
     158             : 
     159             : public:
     160             :     SwTableConfig(bool bWeb);
     161             :     virtual ~SwTableConfig();
     162             : 
     163             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
     164             :     void                    Load();
     165           0 :     void                    SetModified(){ConfigItem::SetModified();}
     166             : };
     167             : 
     168             : class SwMiscConfig : public utl::ConfigItem
     169             : {
     170             :     friend class SwModuleOptions;
     171             : 
     172             :     OUString    sWordDelimiter;             // Statistics/WordNumber/Delimiter
     173             :     bool        bDefaultFontsInCurrDocOnly; // DefaultFont/Document
     174             :     bool        bShowIndexPreview;          // Index/ShowPreview
     175             :     bool        bGrfToGalleryAsLnk;         // Misc/GraphicToGalleryAsLink
     176             :     bool        bNumAlignSize;              // Numbering/Graphic/KeepRatio
     177             :     bool        bSinglePrintJob;            // FormLetter/PrintOutput/SinglePrintJobs
     178             :     bool        bIsNameFromColumn;          // FormLetter/FileOutput/FileName/Generation
     179             :     bool        bAskForMailMergeInPrint;    // Ask if documents containing fields should be 'mailmerged'
     180             :     MailTextFormats nMailingFormats;            // FormLetter/MailingOutput/Formats
     181             :     OUString    sNameFromColumn;            // FormLetter/FileOutput/FileName/FromDatabaseField (string!)
     182             :     OUString    sMailingPath;               // FormLetter/FileOutput/Path
     183             :     OUString    sMailName;                  // FormLetter/FileOutput/FileName/FromManualSetting (string!)
     184             : 
     185             :     static const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
     186             : 
     187             :     virtual void    ImplCommit() SAL_OVERRIDE;
     188             : 
     189             : public:
     190             :     SwMiscConfig();
     191             :     virtual ~SwMiscConfig();
     192             : 
     193             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
     194             :     void                    Load();
     195           2 :     void                    SetModified(){ConfigItem::SetModified();}
     196             : };
     197             : 
     198          26 : class SW_DLLPUBLIC SwModuleOptions
     199             : {
     200             :     SwRevisionConfig                aRevisionConfig;
     201             :     SwInsertConfig                  aInsertConfig;
     202             :     SwInsertConfig                  aWebInsertConfig;
     203             : 
     204             :     SwTableConfig                   aTableConfig;
     205             :     SwTableConfig                   aWebTableConfig;
     206             : 
     207             :     SwMiscConfig                    aMiscConfig;
     208             : 
     209             :     SwCompareConfig                 aCompareConfig;
     210             : 
     211             :     //fiscus: don't show tips of text fields - it's not part of the configuration!
     212             :     bool        bHideFieldTips : 1;
     213             : 
     214             : public:
     215             :     SwModuleOptions();
     216             : 
     217        1098 :     TableChgMode  GetTableMode() const { return aTableConfig.eTableChgMode;}
     218           0 :     void        SetTableMode( TableChgMode  eSet ) { aTableConfig.eTableChgMode = eSet;
     219           0 :                                                 aTableConfig.SetModified();}
     220             : 
     221           0 :     sal_uInt16      GetTableHMove() const { return aTableConfig.nTableHMove;}
     222           0 :     void        SetTableHMove( sal_uInt16 nSet ) {    aTableConfig.nTableHMove = nSet;
     223           0 :                                                 aTableConfig.SetModified();}
     224             : 
     225           0 :     sal_uInt16      GetTableVMove() const { return aTableConfig.nTableVMove;}
     226           0 :     void        SetTableVMove( sal_uInt16 nSet ) {    aTableConfig.nTableVMove = nSet;
     227           0 :                                                 aTableConfig.SetModified();}
     228             : 
     229           0 :     sal_uInt16      GetTableHInsert() const {return aTableConfig.nTableHInsert;}
     230           0 :     void        SetTableHInsert( sal_uInt16 nSet ) {  aTableConfig.nTableHInsert = nSet;
     231           0 :                                                 aTableConfig.SetModified();}
     232             : 
     233           0 :     sal_uInt16      GetTableVInsert() const {return aTableConfig.nTableVInsert;}
     234           0 :     void        SetTableVInsert( sal_uInt16 nSet ) {  aTableConfig.nTableVInsert = nSet;
     235           0 :                                                 aTableConfig.SetModified();}
     236             : 
     237         496 :     const AuthorCharAttr    &GetInsertAuthorAttr() const { return aRevisionConfig.aInsertAttr; }
     238           0 :     void        SetInsertAuthorAttr( AuthorCharAttr &rAttr ) {  aRevisionConfig.aInsertAttr = rAttr;
     239           0 :                                                                 aRevisionConfig.SetModified();}
     240             : 
     241        1128 :     const AuthorCharAttr    &GetDeletedAuthorAttr() const { return aRevisionConfig.aDeletedAttr; }
     242           0 :     void        SetDeletedAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aDeletedAttr = rAttr;
     243           0 :                                                                 aRevisionConfig.SetModified();}
     244             : 
     245         518 :     const AuthorCharAttr    &GetFormatAuthorAttr() const { return aRevisionConfig.aFormatAttr; }
     246           0 :     void        SetFormatAuthorAttr( AuthorCharAttr &rAttr ) {  aRevisionConfig.aFormatAttr = rAttr;
     247           0 :                                                                 aRevisionConfig.SetModified();}
     248             : 
     249    26869084 :     sal_uInt16          GetMarkAlignMode()  const               { return aRevisionConfig.nMarkAlign; }
     250           0 :     void            SetMarkAlignMode(sal_uInt16 nMode)          { aRevisionConfig.nMarkAlign = nMode;
     251           0 :                                                               aRevisionConfig.SetModified();}
     252             : 
     253        1038 :     const Color&    GetMarkAlignColor() const               { return aRevisionConfig.aMarkColor; }
     254           0 :     void            SetMarkAlignColor(const Color &rColor)  { aRevisionConfig.aMarkColor = rColor;
     255           0 :                                                               aRevisionConfig.SetModified();}
     256             : 
     257           0 :     bool        IsInsWithCaption(bool bHTML) const
     258           0 :                         { return !bHTML && aInsertConfig.bInsWithCaption; }
     259           0 :     void        SetInsWithCaption( bool bHTML, bool b )
     260           0 :                     {   if(!bHTML)
     261           0 :                             aInsertConfig.bInsWithCaption = b;
     262           0 :                         aInsertConfig.SetModified();}
     263             : 
     264           0 :     bool    IsCaptionOrderNumberingFirst() const { return aInsertConfig.bCaptionOrderNumberingFirst; }
     265           0 :     void        SetCaptionOrderNumberingFirst( bool bSet )
     266             :                 {
     267           0 :                     if(aInsertConfig.bCaptionOrderNumberingFirst != bSet)
     268             :                     {
     269           0 :                         aInsertConfig.bCaptionOrderNumberingFirst = bSet;
     270           0 :                         aInsertConfig.SetModified();
     271             :                     }
     272           0 :                 }
     273             : 
     274           0 :     bool        IsInsTableFormatNum(bool bHTML) const
     275           0 :                     { return bHTML ? aWebTableConfig.bInsTableFormatNum : aTableConfig.bInsTableFormatNum; }
     276           0 :     void        SetInsTableFormatNum( bool bHTML, bool b )
     277           0 :                     { bHTML ? (aWebTableConfig.bInsTableFormatNum = b) : (aTableConfig.bInsTableFormatNum = b);
     278           0 :                       bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     279             : 
     280           0 :     bool        IsInsTableChangeNumFormat(bool bHTML) const
     281           0 :                     { return bHTML ? aWebTableConfig.bInsTableChangeNumFormat : aTableConfig.bInsTableChangeNumFormat; }
     282           0 :     void        SetInsTableChangeNumFormat( bool bHTML, bool b )
     283           0 :                     { bHTML ? (aWebTableConfig.bInsTableChangeNumFormat = b) : (aTableConfig.bInsTableChangeNumFormat = b);
     284           0 :                       bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     285             : 
     286          95 :     bool        IsInsTableAlignNum(bool bHTML) const
     287          95 :                     { return bHTML ? aWebTableConfig.bInsTableAlignNum : aTableConfig.bInsTableAlignNum; }
     288           0 :     void        SetInsTableAlignNum( bool bHTML, bool b )
     289           0 :                     { bHTML ? (aWebTableConfig.bInsTableAlignNum = b) : (aTableConfig.bInsTableAlignNum = b);
     290           0 :                         bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     291             : 
     292           0 :     SwInsertTableOptions GetInsTableFlags(bool bHTML) const
     293           0 :                     { return bHTML ? aWebInsertConfig.aInsTableOpts : aInsertConfig.aInsTableOpts;}
     294           0 :     void        SetInsTableFlags( bool bHTML, const SwInsertTableOptions& rOpts ) {
     295           0 :                     bHTML ? (aWebInsertConfig.aInsTableOpts = rOpts) : (aInsertConfig.aInsTableOpts = rOpts);
     296           0 :                     bHTML ? aWebInsertConfig.SetModified() : aInsertConfig.SetModified();}
     297             : 
     298             :     const InsCaptionOpt* GetCapOption(bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId);
     299             :     bool        SetCapOption(bool bHTML, const InsCaptionOpt* pOpt);
     300             : 
     301           0 :     bool        IsGrfToGalleryAsLnk() const     { return aMiscConfig.bGrfToGalleryAsLnk; }
     302           0 :     void        SetGrfToGalleryAsLnk( bool b )  { aMiscConfig.bGrfToGalleryAsLnk = b;
     303           0 :                                                   aMiscConfig.SetModified();}
     304             : 
     305           0 :     MailTextFormats GetMailingFormats() const               { return aMiscConfig.nMailingFormats;}
     306           0 :     void           SetMailingFormats( MailTextFormats nSet ) { aMiscConfig.nMailingFormats = nSet;
     307           0 :                                                             aMiscConfig.SetModified();}
     308             : 
     309             :     bool        IsSinglePrintJob() const        { return aMiscConfig.bSinglePrintJob; }
     310           0 :     void        SetSinglePrintJob( bool b )     { aMiscConfig.bSinglePrintJob = b;
     311           0 :                                                   aMiscConfig.SetModified();}
     312             : 
     313             :     bool        IsNumAlignSize() const          { return aMiscConfig.bNumAlignSize; }
     314             :     void        SetNumAlignSize( bool b )       { aMiscConfig.bNumAlignSize = b;
     315             :                                                   aMiscConfig.SetModified();}
     316             : 
     317           0 :     bool        IsNameFromColumn() const        { return aMiscConfig.bIsNameFromColumn; }
     318           0 :     void        SetIsNameFromColumn( bool bSet )
     319             :                         {
     320           0 :                             aMiscConfig.SetModified();
     321           0 :                             aMiscConfig.bIsNameFromColumn = bSet;
     322           0 :                         }
     323             : 
     324           0 :     bool        IsAskForMailMerge() const       { return aMiscConfig.bAskForMailMergeInPrint;}
     325             :     void        SetAskForMailMerge(bool bSet)
     326             :                     {
     327             :                         aMiscConfig.SetModified();
     328             :                         aMiscConfig.bAskForMailMergeInPrint = bSet;
     329             :                     }
     330             : 
     331           0 :     OUString    GetNameFromColumn() const       { return aMiscConfig.sNameFromColumn; }
     332           0 :     void        SetNameFromColumn( const OUString& rSet )       { aMiscConfig.sNameFromColumn = rSet;
     333           0 :                                                                   aMiscConfig.SetModified();}
     334             : 
     335           0 :     OUString    GetMailingPath() const          { return aMiscConfig.sMailingPath; }
     336           0 :     void        SetMailingPath(const OUString& sPath) { aMiscConfig.sMailingPath = sPath;
     337           0 :                                                       aMiscConfig.SetModified();}
     338             : 
     339             :     OUString    GetMailName() const             { return aMiscConfig.sMailName; }
     340             :     void        SetMailName(const OUString& sName){ aMiscConfig.sMailName = sName;
     341             :                                                   aMiscConfig.SetModified();}
     342             : 
     343           5 :     OUString    GetWordDelimiter() const        { return aMiscConfig.sWordDelimiter; }
     344           2 :     void        SetWordDelimiter(const OUString& sDelim)  { aMiscConfig.sWordDelimiter = sDelim;
     345           2 :                                                           aMiscConfig.SetModified();}
     346             : 
     347             :     //convert word delimiter from or to user interface
     348             :     static OUString ConvertWordDelimiter(const OUString& rDelim, bool bFromUI);
     349             : 
     350           0 :     bool    IsShowIndexPreview() const {return  aMiscConfig.bShowIndexPreview;}
     351           0 :     void        SetShowIndexPreview(bool bSet)
     352           0 :                     {aMiscConfig.bShowIndexPreview = bSet;
     353           0 :                     aMiscConfig.SetModified();}
     354             : 
     355           0 :     bool    IsDefaultFontInCurrDocOnly() const { return aMiscConfig.bDefaultFontsInCurrDocOnly;}
     356           0 :     void        SetDefaultFontInCurrDocOnly(bool bSet)
     357             :                     {
     358           0 :                         aMiscConfig.bDefaultFontsInCurrDocOnly = bSet;
     359           0 :                         aMiscConfig.SetModified();
     360           0 :                     }
     361             : 
     362           5 :     bool    IsHideFieldTips() const {return bHideFieldTips;}
     363           2 :     void        SetHideFieldTips(bool bSet) {bHideFieldTips = bSet;}
     364             : 
     365           0 :     SvxCompareMode  GetCompareMode() const { return (SvxCompareMode)aCompareConfig.eCmpMode; }
     366           0 :     void            SetCompareMode( SvxCompareMode eMode ) { aCompareConfig.eCmpMode = eMode;
     367           0 :                                                              aCompareConfig.SetModified(); }
     368             : 
     369           0 :     bool    IsUseRsid() const { return aCompareConfig.bUseRsid; }
     370           0 :     void        SetUseRsid( bool b ) { aCompareConfig.bUseRsid = b;
     371           0 :                                                             aCompareConfig.SetModified(); }
     372             : 
     373           0 :     bool    IsIgnorePieces() const { return aCompareConfig.bIgnorePieces; }
     374           0 :     void        SetIgnorePieces( bool b ) { aCompareConfig.bIgnorePieces = b;
     375           0 :                                                 aCompareConfig.SetModified(); }
     376             : 
     377           0 :     sal_uInt16  GetPieceLen() const { return aCompareConfig.nPieceLen; }
     378           0 :     void        SetPieceLen( sal_uInt16 nLen ) { aCompareConfig.nPieceLen = nLen;
     379           0 :                                                  aCompareConfig.SetModified(); }
     380             : 
     381        2614 :     bool IsStoreRsid() const
     382             :     {
     383        2614 :         return aCompareConfig.m_bStoreRsid;
     384             :     }
     385           2 :     void SetStoreRsid(bool bStoreRsid)
     386             :     {
     387           2 :         aCompareConfig.m_bStoreRsid = bStoreRsid;
     388           2 :         aCompareConfig.SetModified();
     389           2 :     }
     390             : 
     391             : };
     392             : #endif
     393             : 
     394             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11