LCOV - code coverage report
Current view: top level - sw/source/ui/inc - usrpref.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 48 92 52.2 %
Date: 2012-08-25 Functions: 18 30 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 15 42 35.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _USRPREF_HXX
      29                 :            : #define _USRPREF_HXX
      30                 :            : 
      31                 :            : 
      32                 :            : 
      33                 :            : #include <unotools/configitem.hxx>
      34                 :            : #include <fldupde.hxx>
      35                 :            : #include "viewopt.hxx"
      36                 :            : #include <tools/fldunit.hxx>
      37                 :            : 
      38                 :            : class SwMasterUsrPref;
      39                 :            : 
      40                 :            : class SwContentViewConfig : public utl::ConfigItem
      41                 :            : {
      42                 :            :     SwMasterUsrPref&        rParent;
      43                 :            :     sal_Bool                    bWeb;
      44                 :            : 
      45                 :            :     com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
      46                 :            :     public:
      47                 :            :         SwContentViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
      48                 :            :         ~SwContentViewConfig();
      49                 :            : 
      50                 :            :     // utl::ConfigItem
      51                 :            :     virtual void    Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
      52                 :            :     virtual void    Commit();
      53                 :            : 
      54                 :            :     void                    Load();
      55                 :          0 :     void                    SetModified(){ConfigItem::SetModified();}
      56                 :            : };
      57                 :            : 
      58                 :            : class SwLayoutViewConfig : public utl::ConfigItem
      59                 :            : {
      60                 :            :     SwMasterUsrPref&    rParent;
      61                 :            :     sal_Bool                bWeb;
      62                 :            : 
      63                 :            :     com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
      64                 :            :     public:
      65                 :            :         SwLayoutViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
      66                 :            :         ~SwLayoutViewConfig();
      67                 :            : 
      68                 :            :     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
      69                 :            :     virtual void            Commit();
      70                 :            :     void                    Load();
      71                 :        148 :     void                    SetModified(){ConfigItem::SetModified();}
      72                 :            : };
      73                 :            : 
      74                 :            : class SwGridConfig : public utl::ConfigItem
      75                 :            : {
      76                 :            :     SwMasterUsrPref&    rParent;
      77                 :            :     sal_Bool                bWeb;
      78                 :            : 
      79                 :            :     com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
      80                 :            :     public:
      81                 :            :         SwGridConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
      82                 :            :         ~SwGridConfig();
      83                 :            : 
      84                 :            :     virtual void Commit();
      85                 :            :     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
      86                 :            :     void                    Load();
      87                 :          0 :     void                    SetModified(){ConfigItem::SetModified();}
      88                 :            : };
      89                 :            : 
      90                 :            : class SwCursorConfig : public utl::ConfigItem
      91                 :            : {
      92                 :            :     SwMasterUsrPref&    rParent;
      93                 :            : 
      94                 :            :     com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
      95                 :            :     public:
      96                 :            :         SwCursorConfig(SwMasterUsrPref& rParent);
      97                 :            :         ~SwCursorConfig();
      98                 :            : 
      99                 :            :     virtual void Commit();
     100                 :            :     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
     101                 :            :     void                    Load();
     102                 :          0 :     void                    SetModified(){ConfigItem::SetModified();}
     103                 :            : };
     104                 :            : 
     105                 :            : class SwWebColorConfig : public utl::ConfigItem
     106                 :            : {
     107                 :            :     SwMasterUsrPref&        rParent;
     108                 :            :     com::sun::star::uno::Sequence<rtl::OUString> aPropNames;
     109                 :            : 
     110                 :            :     public:
     111                 :            :         SwWebColorConfig(SwMasterUsrPref& rParent);
     112                 :            :         ~SwWebColorConfig();
     113                 :            : 
     114                 :            :     virtual void Commit();
     115                 :            :     virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
     116                 :            :     void                    Load();
     117                 :          0 :     void                    SetModified(){ConfigItem::SetModified();}
     118                 :            : };
     119                 :            : 
     120                 :            : class SwMasterUsrPref : public SwViewOption
     121                 :            : {
     122                 :            :     friend class SwContentViewConfig;
     123                 :            :     friend class SwLayoutViewConfig;
     124                 :            :     friend class SwGridConfig;
     125                 :            :     friend class SwCursorConfig;
     126                 :            :     friend class SwWebColorConfig;
     127                 :            : 
     128                 :            :     SwFldUpdateFlags eFldUpdateFlags;    //udpate of fields and charts
     129                 :            :     sal_Int32   nLinkUpdateMode;
     130                 :            :     FieldUnit   eUserMetric;
     131                 :            :     FieldUnit   eHScrollMetric;
     132                 :            :     sal_Bool    bIsHScrollMetricSet;
     133                 :            :     FieldUnit   eVScrollMetric;
     134                 :            :     sal_Bool    bIsVScrollMetricSet;
     135                 :            : 
     136                 :            :     sal_Int32   nDefTab;            //default tab stop distance
     137                 :            : 
     138                 :            :     sal_Bool    bIsSquaredPageMode; //default page mode for text grid
     139                 :            :     sal_Bool    bIsAlignMathObjectsToBaseline;
     140                 :            : 
     141                 :            :     SwContentViewConfig aContentConfig;
     142                 :            :     SwLayoutViewConfig  aLayoutConfig;
     143                 :            :     SwGridConfig        aGridConfig;
     144                 :            :     SwCursorConfig      aCursorConfig;
     145                 :            :     SwWebColorConfig*   pWebColorConfig;
     146                 :            : 
     147                 :            :     sal_Bool bApplyCharUnit; // apply_char_unit
     148                 :            : public:
     149                 :            :     SwMasterUsrPref(sal_Bool bWeb);
     150                 :            :     ~SwMasterUsrPref();
     151                 :            : 
     152                 :            :     void SetUsrPref(const SwViewOption &rCopy);
     153                 :            : 
     154                 :            :     void Commit()
     155                 :            :         {
     156                 :            :             aContentConfig.Commit();
     157                 :            :             aLayoutConfig.Commit();
     158                 :            :             aGridConfig.Commit();
     159                 :            :             aCursorConfig.Commit();
     160                 :            :             if(pWebColorConfig)
     161                 :            :                 pWebColorConfig->Commit();
     162                 :            :         }
     163                 :          0 :     void SetModified()
     164                 :            :         {
     165                 :          0 :             aContentConfig.SetModified();
     166                 :          0 :             aLayoutConfig.SetModified();
     167                 :          0 :             aGridConfig.SetModified();
     168                 :          0 :             aCursorConfig.SetModified();
     169         [ #  # ]:          0 :             if(pWebColorConfig)
     170                 :          0 :                 pWebColorConfig->SetModified();
     171                 :          0 :         }
     172                 :            : 
     173                 :        146 :     void SetUpdateLinkMode(sal_Int32 nSet, sal_Bool bNoModify = sal_False)
     174                 :            :         {
     175                 :        146 :             nLinkUpdateMode = nSet;
     176         [ -  + ]:        146 :             if(!bNoModify)
     177                 :          0 :                 aContentConfig.SetModified();
     178                 :        146 :         }
     179                 :        610 :     sal_Int32 GetUpdateLinkMode() const {return nLinkUpdateMode; }
     180                 :            : 
     181                 :        146 :     void SetUpdateFields(sal_Bool bSet, sal_Bool bNoModify = sal_False)
     182                 :            :         {
     183 [ +  - ][ +  + ]:        146 :             if(bSet && eFldUpdateFlags == AUTOUPD_OFF)
     184                 :            :             {
     185                 :         73 :                 eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
     186         [ -  + ]:         73 :                 if(!bNoModify)
     187                 :          0 :                     aContentConfig.SetModified();
     188                 :            :              }
     189         [ -  + ]:         73 :             else if(!bSet)
     190                 :            :             {
     191                 :          0 :                 eFldUpdateFlags = AUTOUPD_OFF;
     192         [ #  # ]:          0 :                 if(!bNoModify)
     193                 :          0 :                     aContentConfig.SetModified();
     194                 :            :             }
     195                 :        146 :         };
     196                 :          0 :     sal_Bool IsUpdateFields()const {return eFldUpdateFlags != AUTOUPD_OFF; }
     197                 :            : 
     198                 :       3996 :     SwFldUpdateFlags   GetFldUpdateFlags()const {return eFldUpdateFlags;}
     199                 :          0 :     void        SetFldUpdateFlags(SwFldUpdateFlags eSet, sal_Bool bNoModify = sal_False)
     200                 :            :         {
     201                 :          0 :             eFldUpdateFlags = eSet;
     202         [ #  # ]:          0 :             if(!bNoModify)
     203                 :          0 :                 aContentConfig.SetModified();
     204                 :          0 :         }
     205                 :            : 
     206                 :        146 :     void SetUpdateCharts(sal_Bool bSet, sal_Bool bNoModify = sal_False)
     207                 :            :         {
     208         [ +  - ]:        146 :             if(bSet)
     209                 :            :             {
     210                 :        146 :                 eFldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
     211         [ -  + ]:        146 :                 if(!bNoModify)
     212                 :          0 :                     aContentConfig.SetModified();
     213                 :            :              }
     214         [ #  # ]:          0 :              else if(eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
     215                 :            :              {
     216                 :          0 :                 eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
     217         [ #  # ]:          0 :                 if(!bNoModify)
     218                 :          0 :                     aContentConfig.SetModified();
     219                 :            :              }
     220                 :        146 :         };
     221                 :          0 :     sal_Bool IsUpdateCharts()const {return eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; }
     222                 :            : 
     223                 :        124 :     FieldUnit   GetMetric() const { return eUserMetric;}
     224                 :         20 :     void        SetMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
     225                 :            :                 {
     226                 :         20 :                     eUserMetric = eSet;
     227         [ -  + ]:         20 :                     if(!bNoModify)
     228                 :          0 :                         aLayoutConfig.SetModified();
     229                 :         20 :                 }
     230                 :            : 
     231                 :          0 :     sal_Bool    IsHScrollMetric()const {return bIsHScrollMetricSet;}
     232         [ -  + ]:       1318 :     FieldUnit   GetHScrollMetric() const { return bIsHScrollMetricSet ? eHScrollMetric : eUserMetric;}
     233                 :          0 :     void        SetHScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
     234                 :            :                 {
     235                 :          0 :                     eHScrollMetric = eSet; bIsHScrollMetricSet = sal_True;
     236         [ #  # ]:          0 :                     if(!bNoModify)
     237                 :          0 :                         aLayoutConfig.SetModified();
     238                 :          0 :                 }
     239                 :            : 
     240                 :          0 :     sal_Bool    IsVScrollMetric()const {return bIsVScrollMetricSet;}
     241         [ -  + ]:       1318 :     FieldUnit   GetVScrollMetric() const { return bIsVScrollMetricSet ? eVScrollMetric : eUserMetric;}
     242                 :          0 :     void        SetVScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
     243                 :            :                 {
     244                 :          0 :                     eVScrollMetric = eSet; bIsVScrollMetricSet = sal_True;
     245         [ #  # ]:          0 :                     if(!bNoModify)
     246                 :          0 :                         aLayoutConfig.SetModified();
     247                 :          0 :                 }
     248                 :            : 
     249                 :         40 :     sal_Bool    IsApplyCharUnit() const
     250                 :            :     {
     251                 :         40 :         return bApplyCharUnit;
     252                 :            :     }
     253                 :         73 :     void   SetApplyCharUnit(sal_Bool bSet, sal_Bool bNoModify = sal_False)
     254                 :            :     {
     255                 :         73 :         bApplyCharUnit = bSet;
     256         [ +  - ]:         73 :         if(!bNoModify)
     257                 :         73 :             aLayoutConfig.SetModified();
     258                 :         73 :     }
     259                 :            : 
     260                 :       1560 :     sal_Int32   GetDefTab() const { return nDefTab;}
     261                 :         73 :     void        SetDefTab( sal_Int32  nSet, sal_Bool bNoModify = sal_False )
     262                 :            :                 {
     263                 :         73 :                     nDefTab = nSet;
     264         [ -  + ]:         73 :                     if(!bNoModify)
     265                 :          0 :                         aLayoutConfig.SetModified();
     266                 :         73 :                 }
     267                 :            : 
     268                 :            :     //default page mode for text grid
     269                 :       1520 :     sal_Bool    IsSquaredPageMode() const {return bIsSquaredPageMode;}
     270                 :         73 :     void        SetDefaultPageMode( sal_Bool bVal, sal_Bool bNoModify = sal_False )
     271                 :            :                 {
     272                 :         73 :                     bIsSquaredPageMode = bVal;
     273         [ -  + ]:         73 :                     if(!bNoModify)
     274                 :          0 :                         aLayoutConfig.SetModified();
     275                 :         73 :                 }
     276                 :            : 
     277                 :       1526 :     sal_Bool    IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; }
     278                 :         75 :     void        SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False )
     279                 :            :                 {
     280                 :         75 :                     bIsAlignMathObjectsToBaseline = bVal;
     281         [ +  - ]:         75 :                     if(!bNoModify)
     282                 :         75 :                         aLayoutConfig.SetModified();
     283                 :         75 :                 }
     284                 :            : };
     285                 :            : 
     286                 :            : #endif
     287                 :            : 
     288                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10