LCOV - code coverage report
Current view: top level - libreoffice/sc/inc - docoptio.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 49 51 96.1 %
Date: 2012-12-17 Functions: 29 31 93.5 %
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 SC_DOCOPTIO_HXX
      21             : #define SC_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             :     sal_Bool   bIsIgnoreCase;           // ignore case for comparisons?
      43             :     sal_Bool   bIsIter;                 // iterations for circular refs
      44             :     sal_Bool   bCalcAsShown;            // calculate as shown (wrt precision)
      45             :     sal_Bool   bMatchWholeCell;         // search criteria must match the whole cell
      46             :     sal_Bool   bDoAutoSpell;            // auto-spelling
      47             :     sal_Bool   bLookUpColRowNames;      // determine column-/row titles automagically
      48             :     sal_Bool   bFormulaRegexEnabled;    // regular expressions in formulas enabled
      49             : public:
      50             :                 ScDocOptions();
      51             :                 ScDocOptions( const ScDocOptions& rCpy );
      52             :                 ~ScDocOptions();
      53             : 
      54          22 :     sal_Bool   IsLookUpColRowNames() const  { return bLookUpColRowNames; }
      55         182 :     void   SetLookUpColRowNames( sal_Bool bVal ) { bLookUpColRowNames = bVal; }
      56          39 :     sal_Bool   IsAutoSpell() const          { return bDoAutoSpell; }
      57         172 :     void   SetAutoSpell( sal_Bool bVal )    { bDoAutoSpell = bVal; }
      58        1006 :     sal_Bool   IsMatchWholeCell() const     { return bMatchWholeCell; }
      59          98 :     void   SetMatchWholeCell( sal_Bool bVal ){ bMatchWholeCell = bVal; }
      60          24 :     sal_Bool   IsIgnoreCase() const         { return bIsIgnoreCase; }
      61         164 :     void   SetIgnoreCase( sal_Bool bVal )   { bIsIgnoreCase = bVal; }
      62           6 :     sal_Bool   IsIter() const               { return bIsIter; }
      63         278 :     void   SetIter( sal_Bool bVal )         { bIsIter = bVal; }
      64           6 :     sal_uInt16 GetIterCount() const         { return nIterCount; }
      65         248 :     void   SetIterCount( sal_uInt16 nCount) { nIterCount = nCount; }
      66           6 :     double GetIterEps() const           { return fIterEps; }
      67         278 :     void   SetIterEps( double fEps )    { fIterEps = fEps; }
      68             : 
      69        1090 :     void   GetDate( sal_uInt16& rD, sal_uInt16& rM, sal_uInt16& rY ) const
      70        1090 :                                         { rD = nDay; rM = nMonth; rY = nYear;}
      71         164 :     void   SetDate (sal_uInt16 nD, sal_uInt16 nM, sal_uInt16 nY)
      72         164 :                                         { nDay = nD; nMonth = nM; nYear = nY; }
      73         110 :     sal_uInt16 GetTabDistance() const { return nTabDistance;}
      74          98 :     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        1058 :     sal_uInt16  GetStdPrecision() const { return nPrecStandardFormat; }
      83         100 :     void        SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
      84             : 
      85       13676 :     sal_Bool    IsCalcAsShown() const       { return bCalcAsShown; }
      86         158 :     void    SetCalcAsShown( sal_Bool bVal ) { bCalcAsShown = bVal; }
      87             : 
      88         238 :     void    SetYear2000( sal_uInt16 nVal )  { nYear2000 = nVal; }
      89        1058 :     sal_uInt16  GetYear2000() const         { return nYear2000; }
      90             : 
      91         164 :     void    SetFormulaRegexEnabled( sal_Bool bVal ) { bFormulaRegexEnabled = bVal; }
      92          52 :     sal_Bool    IsFormulaRegexEnabled() const       { return bFormulaRegexEnabled; }
      93             : 
      94             : };
      95             : 
      96        1976 : inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
      97             : {
      98        1976 :     bIsIgnoreCase       = rCpy.bIsIgnoreCase;
      99        1976 :     bIsIter             = rCpy.bIsIter;
     100        1976 :     nIterCount          = rCpy.nIterCount;
     101        1976 :     fIterEps            = rCpy.fIterEps;
     102        1976 :     nPrecStandardFormat = rCpy.nPrecStandardFormat;
     103        1976 :     nDay                = rCpy.nDay;
     104        1976 :     nMonth              = rCpy.nMonth;
     105        1976 :     nYear               = rCpy.nYear;
     106        1976 :     nYear2000           = rCpy.nYear2000;
     107        1976 :     nTabDistance        = rCpy.nTabDistance;
     108        1976 :     bCalcAsShown        = rCpy.bCalcAsShown;
     109        1976 :     bMatchWholeCell     = rCpy.bMatchWholeCell;
     110        1976 :     bDoAutoSpell        = rCpy.bDoAutoSpell;
     111        1976 :     bLookUpColRowNames  = rCpy.bLookUpColRowNames;
     112        1976 :     bFormulaRegexEnabled= rCpy.bFormulaRegexEnabled;
     113             : 
     114        1976 :     return *this;
     115             : }
     116             : 
     117        1294 : inline bool ScDocOptions::operator==( const ScDocOptions& rOpt ) const
     118             : {
     119             :     return (
     120             :                 rOpt.bIsIgnoreCase          == bIsIgnoreCase
     121             :             &&  rOpt.bIsIter                == bIsIter
     122             :             &&  rOpt.nIterCount             == nIterCount
     123             :             &&  rOpt.fIterEps               == fIterEps
     124             :             &&  rOpt.nPrecStandardFormat    == nPrecStandardFormat
     125             :             &&  rOpt.nDay                   == nDay
     126             :             &&  rOpt.nMonth                 == nMonth
     127             :             &&  rOpt.nYear                  == nYear
     128             :             &&  rOpt.nYear2000              == nYear2000
     129             :             &&  rOpt.nTabDistance           == nTabDistance
     130             :             &&  rOpt.bCalcAsShown           == bCalcAsShown
     131             :             &&  rOpt.bMatchWholeCell        == bMatchWholeCell
     132             :             &&  rOpt.bDoAutoSpell           == bDoAutoSpell
     133             :             &&  rOpt.bLookUpColRowNames     == bLookUpColRowNames
     134             :             &&  rOpt.bFormulaRegexEnabled   == bFormulaRegexEnabled
     135        1294 :             );
     136             : }
     137             : 
     138        1294 : inline bool ScDocOptions::operator!=( const ScDocOptions& rOpt ) const
     139             : {
     140        1294 :     return !(operator==(rOpt));
     141             : }
     142             : 
     143             : //==================================================================
     144             : // Item for preferences dialog - calculation
     145             : //==================================================================
     146             : 
     147             : class SC_DLLPUBLIC ScTpCalcItem : public SfxPoolItem
     148             : {
     149             : public:
     150             :                 TYPEINFO();
     151             :                 ScTpCalcItem( sal_uInt16 nWhich,
     152             :                               const ScDocOptions& rOpt );
     153             :                 ScTpCalcItem( const ScTpCalcItem& rItem );
     154             :                 ~ScTpCalcItem();
     155             : 
     156             :     virtual String          GetValueText() const;
     157             :     virtual int             operator==( const SfxPoolItem& ) const;
     158             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
     159             : 
     160           0 :     const ScDocOptions& GetDocOptions() const { return theOptions; }
     161             : 
     162             : private:
     163             :     ScDocOptions theOptions;
     164             : };
     165             : 
     166             : //==================================================================
     167             : //  Config Item containing document options
     168             : //==================================================================
     169             : 
     170           0 : class ScDocCfg : public ScDocOptions
     171             : {
     172             :     ScLinkConfigItem    aCalcItem;
     173             :     ScLinkConfigItem    aLayoutItem;
     174             : 
     175             :     DECL_LINK( CalcCommitHdl, void* );
     176             :     DECL_LINK( LayoutCommitHdl, void* );
     177             : 
     178             :     com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames();
     179             :     com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames();
     180             : 
     181             : public:
     182             :             ScDocCfg();
     183             : 
     184             :     void    SetOptions( const ScDocOptions& rNew );
     185             : };
     186             : 
     187             : 
     188             : #endif
     189             : 
     190             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10