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 : :
29 : : #ifndef SC_VIEWOPTI_HXX
30 : : #define SC_VIEWOPTI_HXX
31 : :
32 : : #include <svx/optgrid.hxx>
33 : :
34 : : #include <svx/svxids.hrc>
35 : : #include "scdllapi.h"
36 : : #include "optutil.hxx"
37 : : #include "global.hxx"
38 : :
39 : : // View options
40 : :
41 : : enum ScViewOption
42 : : {
43 : : VOPT_FORMULAS = 0,
44 : : VOPT_NULLVALS,
45 : : VOPT_SYNTAX,
46 : : VOPT_NOTES,
47 : : VOPT_VSCROLL,
48 : : VOPT_HSCROLL,
49 : : VOPT_TABCONTROLS,
50 : : VOPT_OUTLINER,
51 : : VOPT_HEADER,
52 : : VOPT_GRID,
53 : : VOPT_GRID_ONTOP,
54 : : VOPT_HELPLINES,
55 : : VOPT_ANCHOR,
56 : : VOPT_PAGEBREAKS,
57 : : VOPT_CLIPMARKS
58 : : };
59 : :
60 : : enum ScVObjType
61 : : {
62 : : VOBJ_TYPE_OLE = 0,
63 : : VOBJ_TYPE_CHART,
64 : : VOBJ_TYPE_DRAW
65 : : };
66 : :
67 : : #define MAX_OPT (sal_uInt16)VOPT_CLIPMARKS+1
68 : : #define MAX_TYPE (sal_uInt16)VOBJ_TYPE_DRAW+1
69 : :
70 : : #define SC_STD_GRIDCOLOR COL_LIGHTGRAY
71 : :
72 : : // SvxGrid options with standard operators
73 : :
74 : 9612 : class ScGridOptions : public SvxOptionsGrid
75 : : {
76 : : public:
77 : 7264 : ScGridOptions() : SvxOptionsGrid() {}
78 : 0 : ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {}
79 : :
80 : : void SetDefaults();
81 : : const ScGridOptions& operator= ( const ScGridOptions& rCpy );
82 : : bool operator== ( const ScGridOptions& rOpt ) const;
83 : 0 : bool operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); }
84 : : };
85 : :
86 : : // Options - View
87 : :
88 : : class SC_DLLPUBLIC ScViewOptions
89 : : {
90 : : public:
91 : : ScViewOptions();
92 : : ScViewOptions( const ScViewOptions& rCpy );
93 : : ~ScViewOptions();
94 : :
95 : : void SetDefaults();
96 : :
97 : 5034 : void SetOption( ScViewOption eOpt, sal_Bool bNew = sal_True ) { aOptArr[eOpt] = bNew; }
98 : 29192 : sal_Bool GetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; }
99 : :
100 : 300 : void SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; }
101 : 8987 : ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; }
102 : :
103 : 380 : void SetGridColor( const Color& rCol, const String& rName ) { aGridCol = rCol; aGridColName = rName;}
104 : : Color GetGridColor( String* pStrName = NULL ) const;
105 : :
106 : 3327 : const ScGridOptions& GetGridOptions() const { return aGridOpt; }
107 : 2555 : void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
108 : : SvxGridItem* CreateGridItem( sal_uInt16 nId = SID_ATTR_GRID_OPTIONS ) const;
109 : :
110 : : const ScViewOptions& operator= ( const ScViewOptions& rCpy );
111 : : int operator== ( const ScViewOptions& rOpt ) const;
112 : 2 : int operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); }
113 : :
114 : : private:
115 : : sal_Bool aOptArr [MAX_OPT];
116 : : ScVObjMode aModeArr [MAX_TYPE];
117 : : Color aGridCol;
118 : : String aGridColName;
119 : : ScGridOptions aGridOpt;
120 : : };
121 : :
122 : : // Item for the options dialoge - View
123 : :
124 : : class SC_DLLPUBLIC ScTpViewItem : public SfxPoolItem
125 : : {
126 : : public:
127 : : TYPEINFO();
128 : : ScTpViewItem( sal_uInt16 nWhich, const ScViewOptions& rOpt );
129 : : ScTpViewItem( const ScTpViewItem& rItem );
130 : : ~ScTpViewItem();
131 : :
132 : : virtual String GetValueText() const;
133 : : virtual int operator==( const SfxPoolItem& ) const;
134 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
135 : :
136 : 0 : const ScViewOptions& GetViewOptions() const { return theOptions; }
137 : :
138 : : private:
139 : : ScViewOptions theOptions;
140 : : };
141 : :
142 : :
143 : : // CfgItem for View options
144 : :
145 [ + - ][ + - ]: 18 : class ScViewCfg : public ScViewOptions
[ + - ]
146 : : {
147 : : ScLinkConfigItem aLayoutItem;
148 : : ScLinkConfigItem aDisplayItem;
149 : : ScLinkConfigItem aGridItem;
150 : :
151 : : DECL_LINK( LayoutCommitHdl, void* );
152 : : DECL_LINK( DisplayCommitHdl, void* );
153 : : DECL_LINK( GridCommitHdl, void* );
154 : :
155 : : com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames();
156 : : com::sun::star::uno::Sequence<rtl::OUString> GetDisplayPropertyNames();
157 : : com::sun::star::uno::Sequence<rtl::OUString> GetGridPropertyNames();
158 : :
159 : : public:
160 : : ScViewCfg();
161 : :
162 : : void SetOptions( const ScViewOptions& rNew );
163 : : };
164 : :
165 : :
166 : : #endif
167 : :
168 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|