LCOV - code coverage report
Current view: top level - sc/inc - docoptio.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 65 66 98.5 %
Date: 2015-06-13 12:38:46 Functions: 30 31 96.8 %
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             : 
      20             : #ifndef INCLUDED_SC_INC_DOCOPTIO_HXX
      21             : #define INCLUDED_SC_INC_DOCOPTIO_HXX
      22             : 
      23             : #include <unotools/configitem.hxx>
      24             : #include <svl/poolitem.hxx>
      25             : #include <svl/itemprop.hxx>
      26             : #include "scdllapi.h"
      27             : #include "scmod.hxx"
      28             : #include "optutil.hxx"
      29             : 
      30             : #include <formula/grammar.hxx>
      31             : 
      32             : class SC_DLLPUBLIC ScDocOptions
      33             : {
      34             :     double     fIterEps;                // epsilon value dazu
      35             :     sal_uInt16 nIterCount;              ///< number
      36             :     sal_uInt16 nPrecStandardFormat;     ///< precision for standard format
      37             :     sal_uInt16 nDay;                    ///< Null date:
      38             :     sal_uInt16 nMonth;
      39             :     sal_uInt16 nYear;
      40             :     sal_uInt16 nYear2000;               ///< earlier 19YY is assumed, 20YY otherwise (if only YY of year is given)
      41             :     sal_uInt16 nTabDistance;            ///< distance of standard tabs
      42             :     bool       bIsIgnoreCase;           ///< ignore case for comparisons?
      43             :     bool       bIsIter;                 ///< iterations for circular refs
      44             :     bool       bCalcAsShown;            ///< calculate as shown (wrt precision)
      45             :     bool       bMatchWholeCell;         ///< search criteria must match the whole cell
      46             :     bool       bDoAutoSpell;            ///< auto-spelling
      47             :     bool       bLookUpColRowNames;      ///< determine column-/row titles automagically
      48             :     bool       bFormulaRegexEnabled;    ///< regular expressions in formulas enabled
      49             : public:
      50             :                 ScDocOptions();
      51             :                 ScDocOptions( const ScDocOptions& rCpy );
      52             :                 ~ScDocOptions();
      53             : 
      54          76 :     bool   IsLookUpColRowNames() const       { return bLookUpColRowNames; }
      55         502 :     void   SetLookUpColRowNames( bool bVal ) { bLookUpColRowNames = bVal; }
      56        5538 :     bool   IsAutoSpell() const              { return bDoAutoSpell; }
      57         615 :     void   SetAutoSpell( bool bVal )        { bDoAutoSpell = bVal; }
      58        1234 :     bool   IsMatchWholeCell() const         { return bMatchWholeCell; }
      59         252 :     void   SetMatchWholeCell( bool bVal )   { bMatchWholeCell = bVal; }
      60        1621 :     bool   IsIgnoreCase() const             { return bIsIgnoreCase; }
      61         481 :     void   SetIgnoreCase( bool bVal )       { bIsIgnoreCase = bVal; }
      62         128 :     bool   IsIter() const                   { return bIsIter; }
      63         613 :     void   SetIter( bool bVal )             { bIsIter = bVal; }
      64         127 :     sal_uInt16 GetIterCount() const         { return nIterCount; }
      65         565 :     void   SetIterCount( sal_uInt16 nCount) { nIterCount = nCount; }
      66         127 :     double GetIterEps() const               { return fIterEps; }
      67         613 :     void   SetIterEps( double fEps )        { fIterEps = fEps; }
      68             : 
      69        3963 :     void   GetDate( sal_uInt16& rD, sal_uInt16& rM, sal_uInt16& rY ) const
      70        3963 :                                         { rD = nDay; rM = nMonth; rY = nYear;}
      71         650 :     void   SetDate (sal_uInt16 nD, sal_uInt16 nM, sal_uInt16 nY)
      72         650 :                                         { nDay = nD; nMonth = nM; nYear = nY; }
      73         592 :     sal_uInt16 GetTabDistance() const { return nTabDistance;}
      74         223 :     void   SetTabDistance( sal_uInt16 nTabDist ) {nTabDistance = nTabDist;}
      75             : 
      76             :     void        ResetDocOptions();
      77             : 
      78             :     inline const ScDocOptions&  operator=( const ScDocOptions& rOpt );
      79             :     inline bool                 operator==( const ScDocOptions& rOpt ) const;
      80             :     inline bool                 operator!=( const ScDocOptions& rOpt ) const;
      81             : 
      82        2979 :     sal_uInt16  GetStdPrecision() const         { return nPrecStandardFormat; }
      83         234 :     void        SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
      84             : 
      85       25737 :     bool    IsCalcAsShown() const           { return bCalcAsShown; }
      86         476 :     void    SetCalcAsShown( bool bVal )     { bCalcAsShown = bVal; }
      87             : 
      88         806 :     void    SetYear2000( sal_uInt16 nVal )  { nYear2000 = nVal; }
      89        2909 :     sal_uInt16  GetYear2000() const         { return nYear2000; }
      90             : 
      91         481 :     void    SetFormulaRegexEnabled( bool bVal ) { bFormulaRegexEnabled = bVal; }
      92         130 :     bool    IsFormulaRegexEnabled() const       { return bFormulaRegexEnabled; }
      93             : 
      94             : };
      95             : 
      96        5418 : inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
      97             : {
      98        5418 :     bIsIgnoreCase       = rCpy.bIsIgnoreCase;
      99        5418 :     bIsIter             = rCpy.bIsIter;
     100        5418 :     nIterCount          = rCpy.nIterCount;
     101        5418 :     fIterEps            = rCpy.fIterEps;
     102        5418 :     nPrecStandardFormat = rCpy.nPrecStandardFormat;
     103        5418 :     nDay                = rCpy.nDay;
     104        5418 :     nMonth              = rCpy.nMonth;
     105        5418 :     nYear               = rCpy.nYear;
     106        5418 :     nYear2000           = rCpy.nYear2000;
     107        5418 :     nTabDistance        = rCpy.nTabDistance;
     108        5418 :     bCalcAsShown        = rCpy.bCalcAsShown;
     109        5418 :     bMatchWholeCell     = rCpy.bMatchWholeCell;
     110        5418 :     bDoAutoSpell        = rCpy.bDoAutoSpell;
     111        5418 :     bLookUpColRowNames  = rCpy.bLookUpColRowNames;
     112        5418 :     bFormulaRegexEnabled= rCpy.bFormulaRegexEnabled;
     113             : 
     114        5418 :     return *this;
     115             : }
     116             : 
     117        3846 : inline bool ScDocOptions::operator==( const ScDocOptions& rOpt ) const
     118             : {
     119             :     return (
     120        3846 :                 rOpt.bIsIgnoreCase          == bIsIgnoreCase
     121        3681 :             &&  rOpt.bIsIter                == bIsIter
     122        3672 :             &&  rOpt.nIterCount             == nIterCount
     123        3663 :             &&  rOpt.fIterEps               == fIterEps
     124        3533 :             &&  rOpt.nPrecStandardFormat    == nPrecStandardFormat
     125        3527 :             &&  rOpt.nDay                   == nDay
     126        3447 :             &&  rOpt.nMonth                 == nMonth
     127        3447 :             &&  rOpt.nYear                  == nYear
     128        3447 :             &&  rOpt.nYear2000              == nYear2000
     129        3447 :             &&  rOpt.nTabDistance           == nTabDistance
     130        3441 :             &&  rOpt.bCalcAsShown           == bCalcAsShown
     131        3433 :             &&  rOpt.bMatchWholeCell        == bMatchWholeCell
     132        3427 :             &&  rOpt.bDoAutoSpell           == bDoAutoSpell
     133        3421 :             &&  rOpt.bLookUpColRowNames     == bLookUpColRowNames
     134        7078 :             &&  rOpt.bFormulaRegexEnabled   == bFormulaRegexEnabled
     135        3846 :             );
     136             : }
     137             : 
     138        3846 : inline bool ScDocOptions::operator!=( const ScDocOptions& rOpt ) const
     139             : {
     140        3846 :     return !(operator==(rOpt));
     141             : }
     142             : 
     143             : // Item for preferences dialog - calculation
     144             : 
     145             : class SC_DLLPUBLIC ScTpCalcItem : public SfxPoolItem
     146             : {
     147             : public:
     148             :                 TYPEINFO_OVERRIDE();
     149             :                 ScTpCalcItem( sal_uInt16 nWhich,
     150             :                               const ScDocOptions& rOpt );
     151             :                 ScTpCalcItem( const ScTpCalcItem& rItem );
     152             :                 virtual ~ScTpCalcItem();
     153             : 
     154             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
     155             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     156             : 
     157           0 :     const ScDocOptions& GetDocOptions() const { return theOptions; }
     158             : 
     159             : private:
     160             :     ScDocOptions theOptions;
     161             : };
     162             : 
     163             : //  Config Item containing document options
     164             : 
     165          16 : class ScDocCfg : public ScDocOptions
     166             : {
     167             :     ScLinkConfigItem    aCalcItem;
     168             :     ScLinkConfigItem    aLayoutItem;
     169             : 
     170             :     DECL_LINK( CalcCommitHdl, void* );
     171             :     DECL_LINK( LayoutCommitHdl, void* );
     172             : 
     173             :     static com::sun::star::uno::Sequence<OUString> GetCalcPropertyNames();
     174             :     static com::sun::star::uno::Sequence<OUString> GetLayoutPropertyNames();
     175             : 
     176             : public:
     177             :             ScDocCfg();
     178             : 
     179             :     void    SetOptions( const ScDocOptions& rNew );
     180             : };
     181             : 
     182             : #endif
     183             : 
     184             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11