xref: /AOO41X/main/sc/inc/viewopti.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_VIEWOPTI_HXX
25 #define SC_VIEWOPTI_HXX
26 
27 #include <svx/optgrid.hxx>
28 
29 #ifndef _SVX_SVXIDS_HRC //autogen
30 #include <svx/svxids.hrc>
31 #endif
32 #include "scdllapi.h"
33 #include "optutil.hxx"
34 #include "global.hxx"
35 
36 //==================================================================
37 // View-Optionen
38 //==================================================================
39 
40 enum ScViewOption
41 {
42     VOPT_FORMULAS = 0,
43     VOPT_NULLVALS,
44     VOPT_SYNTAX,
45     VOPT_NOTES,
46     VOPT_VSCROLL,
47     VOPT_HSCROLL,
48     VOPT_TABCONTROLS,
49     VOPT_OUTLINER,
50     VOPT_HEADER,
51     VOPT_GRID,
52     VOPT_HELPLINES,
53     VOPT_ANCHOR,
54     VOPT_PAGEBREAKS,
55     VOPT_SOLIDHANDLES,
56     VOPT_CLIPMARKS,
57     VOPT_BIGHANDLES
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_BIGHANDLES+1
68 #define MAX_TYPE            (sal_uInt16)VOBJ_TYPE_DRAW+1
69 
70 #define SC_STD_GRIDCOLOR    COL_LIGHTGRAY
71 
72 //==================================================================
73 // SvxGrid-Optionen mit Standard-Operatoren
74 //==================================================================
75 
76 class ScGridOptions : public SvxOptionsGrid
77 {
78 public:
ScGridOptions()79                 ScGridOptions() : SvxOptionsGrid() {}
ScGridOptions(const SvxOptionsGrid & rOpt)80                 ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {}
81 
82     void                    SetDefaults();
83     const ScGridOptions&    operator=  ( const ScGridOptions& rCpy );
84     int                     operator== ( const ScGridOptions& rOpt ) const;
operator !=(const ScGridOptions & rOpt) const85     int                     operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); }
86 };
87 
88 //==================================================================
89 // Einstellungen - Ansicht
90 //==================================================================
91 
92 class SC_DLLPUBLIC ScViewOptions
93 {
94 public:
95                 ScViewOptions();
96                 ScViewOptions( const ScViewOptions& rCpy );
97                 ~ScViewOptions();
98 
99     void                    SetDefaults();
100 
SetOption(ScViewOption eOpt,sal_Bool bNew=sal_True)101     void                    SetOption( ScViewOption eOpt, sal_Bool bNew = sal_True )    { aOptArr[eOpt] = bNew; }
GetOption(ScViewOption eOpt) const102     sal_Bool                    GetOption( ScViewOption eOpt ) const                { return aOptArr[eOpt]; }
103 
SetObjMode(ScVObjType eObj,ScVObjMode eMode)104     void                    SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; }
GetObjMode(ScVObjType eObj) const105     ScVObjMode              GetObjMode( ScVObjType eObj ) const             { return aModeArr[eObj]; }
106 
SetGridColor(const Color & rCol,const String & rName)107     void                    SetGridColor( const Color& rCol, const String& rName ) { aGridCol = rCol; aGridColName = rName;}
108     Color                   GetGridColor( String* pStrName = NULL ) const;
109 
GetGridOptions() const110     const ScGridOptions&    GetGridOptions() const                      { return aGridOpt; }
SetGridOptions(const ScGridOptions & rNew)111     void                    SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
112     SvxGridItem*            CreateGridItem( sal_uInt16 nId = SID_ATTR_GRID_OPTIONS ) const;
113 
114     const ScViewOptions&    operator=  ( const ScViewOptions& rCpy );
115     int                     operator== ( const ScViewOptions& rOpt ) const;
operator !=(const ScViewOptions & rOpt) const116     int                     operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); }
117 
118 private:
119     sal_Bool            aOptArr     [MAX_OPT];
120     ScVObjMode      aModeArr    [MAX_TYPE];
121     Color           aGridCol;
122     String          aGridColName;
123     ScGridOptions   aGridOpt;
124 };
125 
126 //==================================================================
127 // Item fuer Einstellungsdialog - Ansicht
128 //==================================================================
129 
130 class SC_DLLPUBLIC ScTpViewItem : public SfxPoolItem
131 {
132 public:
133                 TYPEINFO();
134 //UNUSED2008-05  ScTpViewItem( sal_uInt16 nWhich );
135                 ScTpViewItem( sal_uInt16 nWhich, const ScViewOptions& rOpt );
136                 ScTpViewItem( const ScTpViewItem&  rItem );
137                 ~ScTpViewItem();
138 
139     virtual String          GetValueText() const;
140     virtual int             operator==( const SfxPoolItem& ) const;
141     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
142 
GetViewOptions() const143     const ScViewOptions&    GetViewOptions() const { return theOptions; }
144 
145 private:
146     ScViewOptions   theOptions;
147 };
148 
149 
150 //==================================================================
151 // CfgItem fuer View-Optionen
152 //==================================================================
153 
154 class ScViewCfg : public ScViewOptions
155 {
156     ScLinkConfigItem    aLayoutItem;
157     ScLinkConfigItem    aDisplayItem;
158     ScLinkConfigItem    aGridItem;
159 
160     DECL_LINK( LayoutCommitHdl, void* );
161     DECL_LINK( DisplayCommitHdl, void* );
162     DECL_LINK( GridCommitHdl, void* );
163 
164     com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames();
165     com::sun::star::uno::Sequence<rtl::OUString> GetDisplayPropertyNames();
166     com::sun::star::uno::Sequence<rtl::OUString> GetGridPropertyNames();
167 
168 public:
169             ScViewCfg();
170 
171     void            SetOptions( const ScViewOptions& rNew );
172 };
173 
174 
175 #endif
176