Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / viewopti.hxx
blob8bc3d380b28ad1940e5ab70c926a2b6789978984
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_VIEWOPTI_HXX
21 #define INCLUDED_SC_INC_VIEWOPTI_HXX
23 #include <svx/optgrid.hxx>
25 #include <svx/svxids.hrc>
26 #include "scdllapi.h"
27 #include "optutil.hxx"
28 #include "global.hxx"
30 // View options
32 enum ScViewOption
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
51 enum ScVObjType
53 VOBJ_TYPE_OLE = 0,
54 VOBJ_TYPE_CHART,
55 VOBJ_TYPE_DRAW
58 #define MAX_OPT sal_uInt16(VOPT_CLIPMARKS)+1
59 #define MAX_TYPE sal_uInt16(VOBJ_TYPE_DRAW)+1
61 #define SC_STD_GRIDCOLOR COL_LIGHTGRAY
63 // SvxGrid options with standard operators
65 class ScGridOptions : public SvxOptionsGrid
67 public:
68 ScGridOptions() : SvxOptionsGrid() {}
69 ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {}
71 void SetDefaults();
72 ScGridOptions& operator= ( const ScGridOptions& rCpy );
73 bool operator== ( const ScGridOptions& rOpt ) const;
74 bool operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); }
77 // Options - View
79 class SC_DLLPUBLIC ScViewOptions
81 public:
82 ScViewOptions();
83 ScViewOptions( const ScViewOptions& rCpy );
84 ~ScViewOptions();
86 void SetDefaults();
88 void SetOption( ScViewOption eOpt, bool bNew ) { aOptArr[eOpt] = bNew; }
89 bool GetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; }
91 void SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; }
92 ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; }
94 void SetGridColor( const Color& rCol, const OUString& rName ) { aGridCol = rCol; aGridColName = rName;}
95 Color const & GetGridColor( OUString* pStrName = nullptr ) const;
97 const ScGridOptions& GetGridOptions() const { return aGridOpt; }
98 void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
99 SvxGridItem* CreateGridItem() const;
101 ScViewOptions& operator= ( const ScViewOptions& rCpy );
102 bool operator== ( const ScViewOptions& rOpt ) const;
103 bool operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); }
105 private:
106 bool aOptArr [MAX_OPT];
107 ScVObjMode aModeArr [MAX_TYPE];
108 Color aGridCol;
109 OUString aGridColName;
110 ScGridOptions aGridOpt;
113 // Item for the options dialog - View
115 class SC_DLLPUBLIC ScTpViewItem : public SfxPoolItem
117 public:
118 ScTpViewItem( const ScViewOptions& rOpt );
119 virtual ~ScTpViewItem() override;
121 virtual bool operator==( const SfxPoolItem& ) const override;
122 virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
124 const ScViewOptions& GetViewOptions() const { return theOptions; }
126 private:
127 ScViewOptions theOptions;
130 // CfgItem for View options
132 class ScViewCfg : public ScViewOptions
134 ScLinkConfigItem aLayoutItem;
135 ScLinkConfigItem aDisplayItem;
136 ScLinkConfigItem aGridItem;
138 DECL_LINK( LayoutCommitHdl, ScLinkConfigItem&, void );
139 DECL_LINK( DisplayCommitHdl, ScLinkConfigItem&, void );
140 DECL_LINK( GridCommitHdl, ScLinkConfigItem&, void );
142 static css::uno::Sequence<OUString> GetLayoutPropertyNames();
143 static css::uno::Sequence<OUString> GetDisplayPropertyNames();
144 static css::uno::Sequence<OUString> GetGridPropertyNames();
146 public:
147 ScViewCfg();
149 void SetOptions( const ScViewOptions& rNew );
152 #endif
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */