LCOV - code coverage report
Current view: top level - sw/source/core/uibase/inc - usrpref.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 49 92 53.3 %
Date: 2014-04-11 Functions: 18 30 60.0 %
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_SOURCE_UI_INC_USRPREF_HXX
      20             : #define INCLUDED_SW_SOURCE_UI_INC_USRPREF_HXX
      21             : 
      22             : #include <unotools/configitem.hxx>
      23             : #include <fldupde.hxx>
      24             : #include "viewopt.hxx"
      25             : #include <tools/fldunit.hxx>
      26             : 
      27             : class SwMasterUsrPref;
      28             : 
      29             : class SwContentViewConfig : public utl::ConfigItem
      30             : {
      31             :     SwMasterUsrPref&        rParent;
      32             :     sal_Bool                    bWeb;
      33             : 
      34             :     com::sun::star::uno::Sequence<OUString> GetPropertyNames();
      35             :     public:
      36             :         SwContentViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
      37             :         virtual ~SwContentViewConfig();
      38             : 
      39             :     // utl::ConfigItem
      40             :     virtual void    Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames ) SAL_OVERRIDE;
      41             :     virtual void    Commit() SAL_OVERRIDE;
      42             : 
      43             :     void                    Load();
      44           0 :     void                    SetModified(){ConfigItem::SetModified();}
      45             : };
      46             : 
      47             : class SwLayoutViewConfig : public utl::ConfigItem
      48             : {
      49             :     SwMasterUsrPref&    rParent;
      50             :     sal_Bool                bWeb;
      51             : 
      52             :     com::sun::star::uno::Sequence<OUString> GetPropertyNames();
      53             :     public:
      54             :         SwLayoutViewConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
      55             :         virtual ~SwLayoutViewConfig();
      56             : 
      57             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
      58             :     virtual void            Commit() SAL_OVERRIDE;
      59             :     void                    Load();
      60          77 :     void                    SetModified(){ConfigItem::SetModified();}
      61             : };
      62             : 
      63             : class SwGridConfig : public utl::ConfigItem
      64             : {
      65             :     SwMasterUsrPref&    rParent;
      66             : 
      67             :     com::sun::star::uno::Sequence<OUString> GetPropertyNames();
      68             :     public:
      69             :         SwGridConfig(sal_Bool bWeb, SwMasterUsrPref& rParent);
      70             :         virtual ~SwGridConfig();
      71             : 
      72             :     virtual void Commit() SAL_OVERRIDE;
      73             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
      74             :     void                    Load();
      75           0 :     void                    SetModified(){ConfigItem::SetModified();}
      76             : };
      77             : 
      78             : class SwCursorConfig : public utl::ConfigItem
      79             : {
      80             :     SwMasterUsrPref&    rParent;
      81             : 
      82             :     com::sun::star::uno::Sequence<OUString> GetPropertyNames();
      83             :     public:
      84             :         SwCursorConfig(SwMasterUsrPref& rParent);
      85             :         virtual ~SwCursorConfig();
      86             : 
      87             :     virtual void Commit() SAL_OVERRIDE;
      88             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
      89             :     void                    Load();
      90           0 :     void                    SetModified(){ConfigItem::SetModified();}
      91             : };
      92             : 
      93             : class SwWebColorConfig : public utl::ConfigItem
      94             : {
      95             :     SwMasterUsrPref&        rParent;
      96             :     com::sun::star::uno::Sequence<OUString> aPropNames;
      97             : 
      98             :     public:
      99             :         SwWebColorConfig(SwMasterUsrPref& rParent);
     100             :         virtual ~SwWebColorConfig();
     101             : 
     102             :     virtual void Commit() SAL_OVERRIDE;
     103             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
     104             :     void                    Load();
     105           0 :     void                    SetModified(){ConfigItem::SetModified();}
     106             : };
     107             : 
     108             : class SwMasterUsrPref : public SwViewOption
     109             : {
     110             :     friend class SwContentViewConfig;
     111             :     friend class SwLayoutViewConfig;
     112             :     friend class SwGridConfig;
     113             :     friend class SwCursorConfig;
     114             :     friend class SwWebColorConfig;
     115             : 
     116             :     SwFldUpdateFlags eFldUpdateFlags;    //udpate of fields and charts
     117             :     sal_Int32   nLinkUpdateMode;
     118             :     FieldUnit   eUserMetric;
     119             :     FieldUnit   eHScrollMetric;
     120             :     sal_Bool    bIsHScrollMetricSet;
     121             :     FieldUnit   eVScrollMetric;
     122             :     sal_Bool    bIsVScrollMetricSet;
     123             : 
     124             :     sal_Int32   nDefTab;            //default tab stop distance
     125             : 
     126             :     sal_Bool    bIsSquaredPageMode; //default page mode for text grid
     127             :     sal_Bool    bIsAlignMathObjectsToBaseline;
     128             : 
     129             :     SwContentViewConfig aContentConfig;
     130             :     SwLayoutViewConfig  aLayoutConfig;
     131             :     SwGridConfig        aGridConfig;
     132             :     SwCursorConfig      aCursorConfig;
     133             :     SwWebColorConfig*   pWebColorConfig;
     134             : 
     135             :     sal_Bool bApplyCharUnit; // apply_char_unit
     136             : public:
     137             :     SwMasterUsrPref(sal_Bool bWeb);
     138             :     ~SwMasterUsrPref();
     139             : 
     140             :     void SetUsrPref(const SwViewOption &rCopy);
     141             : 
     142             :     void Commit()
     143             :         {
     144             :             aContentConfig.Commit();
     145             :             aLayoutConfig.Commit();
     146             :             aGridConfig.Commit();
     147             :             aCursorConfig.Commit();
     148             :             if(pWebColorConfig)
     149             :                 pWebColorConfig->Commit();
     150             :         }
     151           0 :     void SetModified()
     152             :         {
     153           0 :             aContentConfig.SetModified();
     154           0 :             aLayoutConfig.SetModified();
     155           0 :             aGridConfig.SetModified();
     156           0 :             aCursorConfig.SetModified();
     157           0 :             if(pWebColorConfig)
     158           0 :                 pWebColorConfig->SetModified();
     159           0 :         }
     160             : 
     161          72 :     void SetUpdateLinkMode(sal_Int32 nSet, sal_Bool bNoModify = sal_False)
     162             :         {
     163          72 :             nLinkUpdateMode = nSet;
     164          72 :             if(!bNoModify)
     165           0 :                 aContentConfig.SetModified();
     166          72 :         }
     167        1268 :     sal_Int32 GetUpdateLinkMode() const {return nLinkUpdateMode; }
     168             : 
     169          72 :     void SetUpdateFields(sal_Bool bSet, sal_Bool bNoModify = sal_False)
     170             :         {
     171          72 :             if(bSet && eFldUpdateFlags == AUTOUPD_OFF)
     172             :             {
     173          36 :                 eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
     174          72 :                 if(!bNoModify)
     175           0 :                     aContentConfig.SetModified();
     176             :              }
     177          36 :             else if(!bSet)
     178             :             {
     179           0 :                 eFldUpdateFlags = AUTOUPD_OFF;
     180           0 :                 if(!bNoModify)
     181           0 :                     aContentConfig.SetModified();
     182             :             }
     183          72 :         };
     184           0 :     sal_Bool IsUpdateFields()const {return eFldUpdateFlags != AUTOUPD_OFF; }
     185             : 
     186         301 :     SwFldUpdateFlags   GetFldUpdateFlags()const {return eFldUpdateFlags;}
     187           0 :     void        SetFldUpdateFlags(SwFldUpdateFlags eSet, sal_Bool bNoModify = sal_False)
     188             :         {
     189           0 :             eFldUpdateFlags = eSet;
     190           0 :             if(!bNoModify)
     191           0 :                 aContentConfig.SetModified();
     192           0 :         }
     193             : 
     194          72 :     void SetUpdateCharts(sal_Bool bSet, sal_Bool bNoModify = sal_False)
     195             :         {
     196          72 :             if(bSet)
     197             :             {
     198          72 :                 eFldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
     199          72 :                 if(!bNoModify)
     200           0 :                     aContentConfig.SetModified();
     201             :              }
     202           0 :              else if(eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
     203             :              {
     204           0 :                 eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
     205           0 :                 if(!bNoModify)
     206           0 :                     aContentConfig.SetModified();
     207             :              }
     208          72 :         };
     209           0 :     sal_Bool IsUpdateCharts()const {return eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; }
     210             : 
     211         108 :     FieldUnit   GetMetric() const { return eUserMetric;}
     212          12 :     void        SetMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
     213             :                 {
     214          12 :                     eUserMetric = eSet;
     215          12 :                     if(!bNoModify)
     216           4 :                         aLayoutConfig.SetModified();
     217          12 :                 }
     218             : 
     219           0 :     sal_Bool    IsHScrollMetric()const {return bIsHScrollMetricSet;}
     220        1732 :     FieldUnit   GetHScrollMetric() const { return bIsHScrollMetricSet ? eHScrollMetric : eUserMetric;}
     221           0 :     void        SetHScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
     222             :                 {
     223           0 :                     eHScrollMetric = eSet; bIsHScrollMetricSet = sal_True;
     224           0 :                     if(!bNoModify)
     225           0 :                         aLayoutConfig.SetModified();
     226           0 :                 }
     227             : 
     228           0 :     sal_Bool    IsVScrollMetric()const {return bIsVScrollMetricSet;}
     229        1732 :     FieldUnit   GetVScrollMetric() const { return bIsVScrollMetricSet ? eVScrollMetric : eUserMetric;}
     230           0 :     void        SetVScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
     231             :                 {
     232           0 :                     eVScrollMetric = eSet; bIsVScrollMetricSet = sal_True;
     233           0 :                     if(!bNoModify)
     234           0 :                         aLayoutConfig.SetModified();
     235           0 :                 }
     236             : 
     237          18 :     sal_Bool    IsApplyCharUnit() const
     238             :     {
     239          18 :         return bApplyCharUnit;
     240             :     }
     241          36 :     void   SetApplyCharUnit(sal_Bool bSet, sal_Bool bNoModify = sal_False)
     242             :     {
     243          36 :         bApplyCharUnit = bSet;
     244          36 :         if(!bNoModify)
     245          36 :             aLayoutConfig.SetModified();
     246          36 :     }
     247             : 
     248        1770 :     sal_Int32   GetDefTab() const { return nDefTab;}
     249          36 :     void        SetDefTab( sal_Int32  nSet, sal_Bool bNoModify = sal_False )
     250             :                 {
     251          36 :                     nDefTab = nSet;
     252          36 :                     if(!bNoModify)
     253           0 :                         aLayoutConfig.SetModified();
     254          36 :                 }
     255             : 
     256             :     //default page mode for text grid
     257        1752 :     sal_Bool    IsSquaredPageMode() const {return bIsSquaredPageMode;}
     258          36 :     void        SetDefaultPageMode( sal_Bool bVal, sal_Bool bNoModify = sal_False )
     259             :                 {
     260          36 :                     bIsSquaredPageMode = bVal;
     261          36 :                     if(!bNoModify)
     262           0 :                         aLayoutConfig.SetModified();
     263          36 :                 }
     264             : 
     265        1755 :     sal_Bool    IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; }
     266          37 :     void        SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False )
     267             :                 {
     268          37 :                     bIsAlignMathObjectsToBaseline = bVal;
     269          37 :                     if(!bNoModify)
     270          37 :                         aLayoutConfig.SetModified();
     271          37 :                 }
     272             : };
     273             : 
     274             : #endif
     275             : 
     276             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10