LCOV - code coverage report
Current view: top level - sw/inc - modcfg.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 16 116 13.8 %
Date: 2014-04-11 Functions: 15 69 21.7 %
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             : class SwModuleOptions;
      34             : 
      35             : class InsCaptionOpt;
      36             : 
      37          55 : class InsCaptionOptArr
      38             : {
      39             : private:
      40             :     typedef boost::ptr_vector<InsCaptionOpt> InsCapOptArr;
      41             :     InsCapOptArr m_aInsCapOptArr;
      42             : public:
      43             :     InsCaptionOpt* Find(const SwCapObjType eType, const SvGlobalName *pOleId = 0);
      44             :     void Insert(InsCaptionOpt* pObj);
      45             : };
      46             : 
      47             : class SwRevisionConfig : public utl::ConfigItem
      48             : {
      49             :     friend class SwModuleOptions;
      50             : 
      51             :     AuthorCharAttr  aInsertAttr;    //Revision/TextDisplay/Insert/Attribute  // Redlining: Author-Zeichenattribute
      52             :                                     //Revision/TextDisplay/Insert/Color
      53             :     AuthorCharAttr  aDeletedAttr;   //Revision/TextDisplay/Delete/Attribute
      54             :                                     //Revision/TextDisplay/Delete/Color
      55             :     AuthorCharAttr  aFormatAttr;    //Revision/TextDisplay/ChangeAttribute/Attribute
      56             :                                     //Revision/TextDisplay/ChangeAttribute/Color
      57             :     sal_uInt16          nMarkAlign;     //Revision/LinesChanged/Mark
      58             :     Color           aMarkColor;     //Revision/LinesChanged/Color
      59             : 
      60             :     const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
      61             :     public:
      62             :         SwRevisionConfig();
      63             :         virtual ~SwRevisionConfig();
      64             : 
      65             :     virtual void            Commit() SAL_OVERRIDE;
      66             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
      67             :     void                    Load();
      68           0 :     void                    SetModified(){ConfigItem::SetModified();}
      69             : };
      70             : 
      71             : class SwCompareConfig : public utl::ConfigItem
      72             : {
      73             :     friend class SwModuleOptions;
      74             : 
      75             :     sal_uInt16      eCmpMode;           //Compare/CompareDocuments;
      76             :     sal_Bool        bUseRsid;           //Compare/Settings/Use RSID
      77             :     sal_Bool        bIgnorePieces;      //Compare/Settings/Ignore pieces of length
      78             :     sal_uInt16      nPieceLen;          //Compare/Settings/Ignore pieces of length
      79             : 
      80             :     const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
      81             :     public:
      82             :         SwCompareConfig();
      83             :         virtual ~SwCompareConfig();
      84             : 
      85             :     virtual void    Commit() SAL_OVERRIDE;
      86           0 :     virtual void    Notify( const ::com::sun::star::uno::Sequence< OUString >& ) SAL_OVERRIDE { };
      87             :     void            Load();
      88           0 :     void            SetModified() {ConfigItem::SetModified(); }
      89             : };
      90             : 
      91             : class SwInsertConfig : public utl::ConfigItem
      92             : {
      93             :     friend class SwModuleOptions;
      94             : 
      95             :     InsCaptionOptArr*   pCapOptions;
      96             :     InsCaptionOpt*      pOLEMiscOpt;
      97             : 
      98             :     SvGlobalName        aGlobalNames[5];
      99             : 
     100             :     sal_Bool            bInsWithCaption;       //Insert/Caption/Automatic
     101             :     sal_Bool            bCaptionOrderNumberingFirst; //#i61007# caption order starting with numbering
     102             : 
     103             :     SwInsertTableOptions    aInsTblOpts;
     104             :     sal_Bool            bIsWeb;
     105             : 
     106             :     const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
     107             :     public:
     108             :         SwInsertConfig(sal_Bool bWeb);
     109             :         virtual ~SwInsertConfig();
     110             : 
     111             :     virtual void            Commit() SAL_OVERRIDE;
     112             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
     113             :     void                    Load();
     114           0 :     void                    SetModified(){ConfigItem::SetModified();}
     115             : };
     116             : 
     117             : class SwTableConfig : public utl::ConfigItem
     118             : {
     119             :     friend class SwModuleOptions;
     120             : 
     121             :     sal_uInt16      nTblHMove;          //int Table/Shift/Row
     122             :     sal_uInt16      nTblVMove;          //int Table/Shift/Column
     123             :     sal_uInt16      nTblHInsert;        //int Table/Insert/Row
     124             :     sal_uInt16      nTblVInsert;        //int Table/Insert/Column
     125             :     TblChgMode  eTblChgMode;        //int Table/Change/Effect
     126             : 
     127             :     sal_Bool    bInsTblFormatNum;       // Table/Input/NumberRecognition        // Automatic recognition of numbers.
     128             :     sal_Bool    bInsTblChangeNumFormat; // Table/Input/NumberFormatRecognition  // Automatic recognition of number formats.
     129             :     sal_Bool    bInsTblAlignNum;        // Table/Input/Alignment                // Align numbers.
     130             : 
     131             :     const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
     132             :     public:
     133             :         SwTableConfig(sal_Bool bWeb);
     134             :         virtual ~SwTableConfig();
     135             : 
     136             :     virtual void            Commit() SAL_OVERRIDE;
     137             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
     138             :     void                    Load();
     139           0 :     void                    SetModified(){ConfigItem::SetModified();}
     140             : };
     141             : 
     142             : class SwMiscConfig : public utl::ConfigItem
     143             : {
     144             :     friend class SwModuleOptions;
     145             : 
     146             :     OUString    sWordDelimiter;             // Statistics/WordNumber/Delimiter
     147             :     sal_Bool        bDefaultFontsInCurrDocOnly; // DefaultFont/Document
     148             :     sal_Bool        bShowIndexPreview;          // Index/ShowPreview
     149             :     sal_Bool        bGrfToGalleryAsLnk;         // Misc/GraphicToGalleryAsLink
     150             :     sal_Bool        bNumAlignSize;              // Numbering/Graphic/KeepRatio
     151             :     sal_Bool        bSinglePrintJob;            // FormLetter/PrintOutput/SinglePrintJobs
     152             :     sal_Bool        bIsNameFromColumn;          // FormLetter/FileOutput/FileName/Generation
     153             :     sal_Bool        bAskForMailMergeInPrint;    // Ask if documents containing fields should be 'mailmerged'
     154             :     sal_Int16   nMailingFormats;            // FormLetter/MailingOutput/Formats
     155             :     OUString    sNameFromColumn;            // FormLetter/FileOutput/FileName/FromDatabaseField (string!)
     156             :     OUString    sMailingPath;               // FormLetter/FileOutput/Path
     157             :     OUString    sMailName;                  // FormLetter/FileOutput/FileName/FromManualSetting (string!)
     158             : 
     159             :     const com::sun::star::uno::Sequence<OUString>& GetPropertyNames();
     160             :     public:
     161             :         SwMiscConfig();
     162             :         virtual ~SwMiscConfig();
     163             : 
     164             :     virtual void            Commit() SAL_OVERRIDE;
     165             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
     166             :     void                    Load();
     167           5 :     void                    SetModified(){ConfigItem::SetModified();}
     168             : };
     169             : 
     170          18 : 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             :     SwCompareConfig                 aCompareConfig;
     182             : 
     183             :     //fiscus: don't show tips of text fields - it's not part of the configuration!
     184             :     sal_Bool        bHideFieldTips : 1;
     185             : 
     186             : public:
     187             :     SwModuleOptions();
     188             : 
     189         714 :     TblChgMode  GetTblMode() const { return aTableConfig.eTblChgMode;}
     190           0 :     void        SetTblMode( TblChgMode  eSet ) { aTableConfig.eTblChgMode = eSet;
     191           0 :                                                 aTableConfig.SetModified();}
     192             : 
     193           0 :     sal_uInt16      GetTblHMove() const { return aTableConfig.nTblHMove;}
     194           0 :     void        SetTblHMove( sal_uInt16 nSet ) {    aTableConfig.nTblHMove = nSet;
     195           0 :                                                 aTableConfig.SetModified();}
     196             : 
     197           0 :     sal_uInt16      GetTblVMove() const { return aTableConfig.nTblVMove;}
     198           0 :     void        SetTblVMove( sal_uInt16 nSet ) {    aTableConfig.nTblVMove = nSet;
     199           0 :                                                 aTableConfig.SetModified();}
     200             : 
     201           0 :     sal_uInt16      GetTblHInsert() const {return aTableConfig.nTblHInsert;}
     202           0 :     void        SetTblHInsert( sal_uInt16 nSet ) {  aTableConfig.nTblHInsert = nSet;
     203           0 :                                                 aTableConfig.SetModified();}
     204             : 
     205           0 :     sal_uInt16      GetTblVInsert() const {return aTableConfig.nTblVInsert;}
     206           0 :     void        SetTblVInsert( sal_uInt16 nSet ) {  aTableConfig.nTblVInsert = nSet;
     207           0 :                                                 aTableConfig.SetModified();}
     208             : 
     209         186 :     const AuthorCharAttr    &GetInsertAuthorAttr() const { return aRevisionConfig.aInsertAttr; }
     210           0 :     void        SetInsertAuthorAttr( AuthorCharAttr &rAttr ) {  aRevisionConfig.aInsertAttr = rAttr;
     211           0 :                                                                 aRevisionConfig.SetModified();}
     212             : 
     213         713 :     const AuthorCharAttr    &GetDeletedAuthorAttr() const { return aRevisionConfig.aDeletedAttr; }
     214           0 :     void        SetDeletedAuthorAttr( AuthorCharAttr &rAttr ) { aRevisionConfig.aDeletedAttr = rAttr;
     215           0 :                                                                 aRevisionConfig.SetModified();}
     216             : 
     217         506 :     const AuthorCharAttr    &GetFormatAuthorAttr() const { return aRevisionConfig.aFormatAttr; }
     218           0 :     void        SetFormatAuthorAttr( AuthorCharAttr &rAttr ) {  aRevisionConfig.aFormatAttr = rAttr;
     219           0 :                                                                 aRevisionConfig.SetModified();}
     220             : 
     221       60925 :     sal_uInt16          GetMarkAlignMode()  const               { return aRevisionConfig.nMarkAlign; }
     222           0 :     void            SetMarkAlignMode(sal_uInt16 nMode)          { aRevisionConfig.nMarkAlign = nMode;
     223           0 :                                                               aRevisionConfig.SetModified();}
     224             : 
     225         177 :     const Color&    GetMarkAlignColor() const               { return aRevisionConfig.aMarkColor; }
     226           0 :     void            SetMarkAlignColor(const Color &rColor)  { aRevisionConfig.aMarkColor = rColor;
     227           0 :                                                               aRevisionConfig.SetModified();}
     228             : 
     229           0 :     sal_Bool        IsInsWithCaption(sal_Bool bHTML) const
     230           0 :                         { return bHTML ? sal_False : aInsertConfig.bInsWithCaption; }
     231           0 :     void        SetInsWithCaption( sal_Bool bHTML, sal_Bool b )
     232           0 :                     {   if(!bHTML)
     233           0 :                             aInsertConfig.bInsWithCaption = b;
     234           0 :                         aInsertConfig.SetModified();}
     235             : 
     236           0 :     sal_Bool    IsCaptionOrderNumberingFirst() const { return aInsertConfig.bCaptionOrderNumberingFirst; }
     237           0 :     void        SetCaptionOrderNumberingFirst( sal_Bool bSet )
     238             :                 {
     239           0 :                     if(aInsertConfig.bCaptionOrderNumberingFirst != bSet)
     240             :                     {
     241           0 :                         aInsertConfig.bCaptionOrderNumberingFirst = bSet;
     242           0 :                         aInsertConfig.SetModified();
     243             :                     }
     244           0 :                 }
     245             : 
     246           0 :     sal_Bool        IsInsTblFormatNum(sal_Bool bHTML) const
     247           0 :                     { return bHTML ? aWebTableConfig.bInsTblFormatNum : aTableConfig.bInsTblFormatNum; }
     248           0 :     void        SetInsTblFormatNum( sal_Bool bHTML, sal_Bool b )
     249           0 :                     { bHTML ? (aWebTableConfig.bInsTblFormatNum = b) : (aTableConfig.bInsTblFormatNum = b);
     250           0 :                       bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     251             : 
     252           0 :     sal_Bool        IsInsTblChangeNumFormat(sal_Bool bHTML) const
     253           0 :                     { return bHTML ? aWebTableConfig.bInsTblChangeNumFormat : aTableConfig.bInsTblChangeNumFormat; }
     254           0 :     void        SetInsTblChangeNumFormat( sal_Bool bHTML, sal_Bool b )
     255           0 :                     { bHTML ? (aWebTableConfig.bInsTblChangeNumFormat = b) : (aTableConfig.bInsTblChangeNumFormat = b);
     256           0 :                       bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     257             : 
     258          77 :     sal_Bool        IsInsTblAlignNum(sal_Bool bHTML) const
     259          77 :                     { return bHTML ? aWebTableConfig.bInsTblAlignNum : aTableConfig.bInsTblAlignNum; }
     260           0 :     void        SetInsTblAlignNum( sal_Bool bHTML, sal_Bool b )
     261           0 :                     { bHTML ? (aWebTableConfig.bInsTblAlignNum = b) : (aTableConfig.bInsTblAlignNum = b);
     262           0 :                         bHTML ? aWebTableConfig.SetModified() : aTableConfig.SetModified();}
     263             : 
     264           0 :     SwInsertTableOptions GetInsTblFlags(sal_Bool bHTML) const
     265           0 :                     { return bHTML ? aWebInsertConfig.aInsTblOpts : aInsertConfig.aInsTblOpts;}
     266           0 :     void        SetInsTblFlags( sal_Bool bHTML, const SwInsertTableOptions& rOpts ) {
     267           0 :                     bHTML ? (aWebInsertConfig.aInsTblOpts = rOpts) : (aInsertConfig.aInsTblOpts = rOpts);
     268           0 :                     bHTML ? aWebInsertConfig.SetModified() : aInsertConfig.SetModified();}
     269             : 
     270             :     const InsCaptionOpt* GetCapOption(sal_Bool bHTML, const SwCapObjType eType, const SvGlobalName *pOleId);
     271             :     sal_Bool        SetCapOption(sal_Bool bHTML, const InsCaptionOpt* pOpt);
     272             : 
     273           0 :     sal_Bool        IsGrfToGalleryAsLnk() const     { return aMiscConfig.bGrfToGalleryAsLnk; }
     274           0 :     void        SetGrfToGalleryAsLnk( sal_Bool b )  { aMiscConfig.bGrfToGalleryAsLnk = b;
     275           0 :                                                   aMiscConfig.SetModified();}
     276             : 
     277           0 :     sal_Int16   GetMailingFormats() const       { return aMiscConfig.nMailingFormats;}
     278           0 :     void        SetMailingFormats( sal_Int16 nSet ) { aMiscConfig.nMailingFormats = nSet;
     279           0 :                                                   aMiscConfig.SetModified();}
     280             : 
     281             :     sal_Bool        IsSinglePrintJob() const        { return aMiscConfig.bSinglePrintJob; }
     282           0 :     void        SetSinglePrintJob( sal_Bool b )     { aMiscConfig.bSinglePrintJob = b;
     283           0 :                                                   aMiscConfig.SetModified();}
     284             : 
     285             :     sal_Bool        IsNumAlignSize() const          { return aMiscConfig.bNumAlignSize; }
     286             :     void        SetNumAlignSize( sal_Bool b )       { aMiscConfig.bNumAlignSize = b;
     287             :                                                   aMiscConfig.SetModified();}
     288             : 
     289           0 :     sal_Bool        IsNameFromColumn() const        { return aMiscConfig.bIsNameFromColumn; }
     290           0 :     void        SetIsNameFromColumn( sal_Bool bSet )
     291             :                         {
     292           0 :                             aMiscConfig.SetModified();
     293           0 :                             aMiscConfig.bIsNameFromColumn = bSet;
     294           0 :                         }
     295             : 
     296           0 :     sal_Bool        IsAskForMailMerge() const       { return aMiscConfig.bAskForMailMergeInPrint;}
     297             :     void        SetAskForMailMerge(sal_Bool bSet)
     298             :                     {
     299             :                         aMiscConfig.SetModified();
     300             :                         aMiscConfig.bAskForMailMergeInPrint = bSet;
     301             :                     }
     302             : 
     303           0 :     OUString    GetNameFromColumn() const       { return aMiscConfig.sNameFromColumn; }
     304           0 :     void        SetNameFromColumn( const OUString& rSet )       { aMiscConfig.sNameFromColumn = rSet;
     305           0 :                                                                   aMiscConfig.SetModified();}
     306             : 
     307           0 :     OUString    GetMailingPath() const          { return aMiscConfig.sMailingPath; }
     308           0 :     void        SetMailingPath(const OUString& sPath) { aMiscConfig.sMailingPath = sPath;
     309           0 :                                                       aMiscConfig.SetModified();}
     310             : 
     311             :     OUString    GetMailName() const             { return aMiscConfig.sMailName; }
     312             :     void        SetMailName(const OUString& sName){ aMiscConfig.sMailName = sName;
     313             :                                                   aMiscConfig.SetModified();}
     314             : 
     315          12 :     OUString    GetWordDelimiter() const        { return aMiscConfig.sWordDelimiter; }
     316           5 :     void        SetWordDelimiter(const OUString& sDelim)  { aMiscConfig.sWordDelimiter = sDelim;
     317           5 :                                                           aMiscConfig.SetModified();}
     318             : 
     319             :     //convert word delimiter from or to user interface
     320             :     static OUString ConvertWordDelimiter(const OUString& rDelim, sal_Bool bFromUI);
     321             : 
     322           0 :     sal_Bool    IsShowIndexPreview() const {return  aMiscConfig.bShowIndexPreview;}
     323           0 :     void        SetShowIndexPreview(sal_Bool bSet)
     324           0 :                     {aMiscConfig.bShowIndexPreview = bSet;
     325           0 :                     aMiscConfig.SetModified();}
     326             : 
     327           0 :     sal_Bool    IsDefaultFontInCurrDocOnly() const { return aMiscConfig.bDefaultFontsInCurrDocOnly;}
     328           0 :     void        SetDefaultFontInCurrDocOnly(sal_Bool bSet)
     329             :                     {
     330           0 :                         aMiscConfig.bDefaultFontsInCurrDocOnly = bSet;
     331           0 :                         aMiscConfig.SetModified();
     332           0 :                     }
     333             : 
     334          10 :     sal_Bool    IsHideFieldTips() const {return bHideFieldTips;}
     335           4 :     void        SetHideFieldTips(sal_Bool bSet) {bHideFieldTips = bSet;}
     336             : 
     337           0 :     SvxCompareMode  GetCompareMode() const { return (SvxCompareMode)aCompareConfig.eCmpMode; }
     338           0 :     void            SetCompareMode( SvxCompareMode eMode ) { aCompareConfig.eCmpMode = eMode;
     339           0 :                                                              aCompareConfig.SetModified(); }
     340             : 
     341           0 :     sal_Bool    IsUseRsid() const { return aCompareConfig.bUseRsid; }
     342           0 :     void        SetUseRsid( sal_Bool b ) { aCompareConfig.bUseRsid = b;
     343           0 :                                                             aCompareConfig.SetModified(); }
     344             : 
     345           0 :     sal_Bool    IsIgnorePieces() const { return aCompareConfig.bIgnorePieces; }
     346           0 :     void        SetIgnorePieces( sal_Bool b ) { aCompareConfig.bIgnorePieces = b;
     347           0 :                                                 aCompareConfig.SetModified(); }
     348             : 
     349           0 :     sal_uInt16  GetPieceLen() const { return aCompareConfig.nPieceLen; }
     350           0 :     void        SetPieceLen( sal_uInt16 nLen ) { aCompareConfig.nPieceLen = nLen;
     351           0 :                                                  aCompareConfig.SetModified(); }
     352             : 
     353             : };
     354             : #endif
     355             : 
     356             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10