LCOV - code coverage report
Current view: top level - sc/inc - viewopti.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 11 14 78.6 %
Date: 2015-06-13 12:38:46 Functions: 11 14 78.6 %
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_VIEWOPTI_HXX
      21             : #define INCLUDED_SC_INC_VIEWOPTI_HXX
      22             : 
      23             : #include <svx/optgrid.hxx>
      24             : 
      25             : #include <svx/svxids.hrc>
      26             : #include "scdllapi.h"
      27             : #include "optutil.hxx"
      28             : #include "global.hxx"
      29             : 
      30             : // View options
      31             : 
      32             : enum ScViewOption
      33             : {
      34             :     VOPT_FORMULAS = 0,
      35             :     VOPT_NULLVALS,
      36             :     VOPT_SYNTAX,
      37             :     VOPT_NOTES,
      38             :     VOPT_VSCROLL,
      39             :     VOPT_HSCROLL,
      40             :     VOPT_TABCONTROLS,
      41             :     VOPT_OUTLINER,
      42             :     VOPT_HEADER,
      43             :     VOPT_GRID,
      44             :     VOPT_GRID_ONTOP,
      45             :     VOPT_HELPLINES,
      46             :     VOPT_ANCHOR,
      47             :     VOPT_PAGEBREAKS,
      48             :     VOPT_CLIPMARKS
      49             : };
      50             : 
      51             : enum ScVObjType
      52             : {
      53             :     VOBJ_TYPE_OLE = 0,
      54             :     VOBJ_TYPE_CHART,
      55             :     VOBJ_TYPE_DRAW
      56             : };
      57             : 
      58             : #define MAX_OPT             (sal_uInt16)VOPT_CLIPMARKS+1
      59             : #define MAX_TYPE            (sal_uInt16)VOBJ_TYPE_DRAW+1
      60             : 
      61             : #define SC_STD_GRIDCOLOR    COL_LIGHTGRAY
      62             : 
      63             : // SvxGrid options with standard operators
      64             : 
      65       14635 : class ScGridOptions : public SvxOptionsGrid
      66             : {
      67             : public:
      68       11022 :                 ScGridOptions() : SvxOptionsGrid() {}
      69           0 :                 ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {}
      70             : 
      71             :     void                    SetDefaults();
      72             :     const ScGridOptions&    operator=  ( const ScGridOptions& rCpy );
      73             :     bool                    operator== ( const ScGridOptions& rOpt ) const;
      74           0 :     bool                    operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); }
      75             : };
      76             : 
      77             : // Options - View
      78             : 
      79             : class SC_DLLPUBLIC ScViewOptions
      80             : {
      81             : public:
      82             :                 ScViewOptions();
      83             :                 ScViewOptions( const ScViewOptions& rCpy );
      84             :                 ~ScViewOptions();
      85             : 
      86             :     void                    SetDefaults();
      87             : 
      88        7517 :     void                    SetOption( ScViewOption eOpt, bool bNew = true )    { aOptArr[eOpt] = bNew; }
      89       63337 :     bool                    GetOption( ScViewOption eOpt ) const                { return aOptArr[eOpt]; }
      90             : 
      91         594 :     void                    SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; }
      92       20501 :     ScVObjMode              GetObjMode( ScVObjType eObj ) const             { return aModeArr[eObj]; }
      93             : 
      94         596 :     void                    SetGridColor( const Color& rCol, const OUString& rName ) { aGridCol = rCol; aGridColName = rName;}
      95             :     Color                   GetGridColor( OUString* pStrName = NULL ) const;
      96             : 
      97        4882 :     const ScGridOptions&    GetGridOptions() const                      { return aGridOpt; }
      98        3682 :     void                    SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
      99             :     SvxGridItem*            CreateGridItem( sal_uInt16 nId = SID_ATTR_GRID_OPTIONS ) const;
     100             : 
     101             :     const ScViewOptions&    operator=  ( const ScViewOptions& rCpy );
     102             :     bool                    operator== ( const ScViewOptions& rOpt ) const;
     103          16 :     bool                    operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); }
     104             : 
     105             : private:
     106             :     bool            aOptArr     [MAX_OPT];
     107             :     ScVObjMode      aModeArr    [MAX_TYPE];
     108             :     Color           aGridCol;
     109             :     OUString        aGridColName;
     110             :     ScGridOptions   aGridOpt;
     111             : };
     112             : 
     113             : // Item for the options dialoge - View
     114             : 
     115             : class SC_DLLPUBLIC ScTpViewItem : public SfxPoolItem
     116             : {
     117             : public:
     118             :                 TYPEINFO_OVERRIDE();
     119             :                 ScTpViewItem( sal_uInt16 nWhich, const ScViewOptions& rOpt );
     120             :                 ScTpViewItem( const ScTpViewItem&  rItem );
     121             :                 virtual ~ScTpViewItem();
     122             : 
     123             :     virtual bool            operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
     124             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
     125             : 
     126           0 :     const ScViewOptions&    GetViewOptions() const { return theOptions; }
     127             : 
     128             : private:
     129             :     ScViewOptions   theOptions;
     130             : };
     131             : 
     132             : // CfgItem for View options
     133             : 
     134          16 : class ScViewCfg : public ScViewOptions
     135             : {
     136             :     ScLinkConfigItem    aLayoutItem;
     137             :     ScLinkConfigItem    aDisplayItem;
     138             :     ScLinkConfigItem    aGridItem;
     139             : 
     140             :     DECL_LINK( LayoutCommitHdl, void* );
     141             :     DECL_LINK( DisplayCommitHdl, void* );
     142             :     DECL_LINK( GridCommitHdl, void* );
     143             : 
     144             :     static com::sun::star::uno::Sequence<OUString> GetLayoutPropertyNames();
     145             :     static com::sun::star::uno::Sequence<OUString> GetDisplayPropertyNames();
     146             :     static com::sun::star::uno::Sequence<OUString> GetGridPropertyNames();
     147             : 
     148             : public:
     149             :             ScViewCfg();
     150             : 
     151             :     void            SetOptions( const ScViewOptions& rNew );
     152             : };
     153             : 
     154             : #endif
     155             : 
     156             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11