android: Update app-specific/MIME type icons
[LibreOffice.git] / sc / inc / viewopti.hxx
blob489a3e8c81da9e5d0175ff03b901052c39e60bd2
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 #pragma once
22 #include <svx/optgrid.hxx>
24 #include "scdllapi.h"
25 #include "optutil.hxx"
26 #include "global.hxx"
28 // View options
30 enum ScViewOption
32 VOPT_FORMULAS = 0,
33 VOPT_NULLVALS,
34 VOPT_SYNTAX,
35 VOPT_NOTES,
36 VOPT_FORMULAS_MARKS,
37 VOPT_VSCROLL,
38 VOPT_HSCROLL,
39 VOPT_TABCONTROLS,
40 VOPT_OUTLINER,
41 VOPT_HEADER,
42 VOPT_GRID,
43 VOPT_GRID_ONTOP,
44 VOPT_HELPLINES,
45 VOPT_ANCHOR,
46 VOPT_PAGEBREAKS,
47 VOPT_SUMMARY,
48 VOPT_THEMEDCURSOR,
51 enum ScVObjType
53 VOBJ_TYPE_OLE = 0,
54 VOBJ_TYPE_CHART,
55 VOBJ_TYPE_DRAW
58 #define MAX_OPT sal_uInt16(VOPT_THEMEDCURSOR)+1
59 #define MAX_TYPE sal_uInt16(VOBJ_TYPE_DRAW)+1
61 // SvxGrid options with standard operators
63 class ScGridOptions : public SvxOptionsGrid
65 public:
66 ScGridOptions() {}
67 ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {}
69 void SetDefaults();
70 bool operator== ( const ScGridOptions& rOpt ) const;
71 bool operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); }
74 // Options - View
76 class SC_DLLPUBLIC ScViewOptions
78 public:
79 ScViewOptions();
80 ScViewOptions( const ScViewOptions& rCpy );
81 ~ScViewOptions();
83 void SetDefaults();
85 void SetOption( ScViewOption eOpt, bool bNew ) { aOptArr[eOpt] = bNew; }
86 bool GetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; }
88 void SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; }
89 ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; }
91 void SetGridColor( const Color& rCol, const OUString& rName ) { aGridCol = rCol; aGridColName = rName;}
92 Color const & GetGridColor( OUString* pStrName = nullptr ) const;
94 const ScGridOptions& GetGridOptions() const { return aGridOpt; }
95 void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
96 std::unique_ptr<SvxGridItem> CreateGridItem() const;
98 const OUString& GetColorSchemeName() const { return sColorSchemeName; }
99 void SetColorSchemeName( const OUString& rName ) { sColorSchemeName = rName; }
101 const Color& GetDocColor() const { return aDocCol; }
102 void SetDocColor(const Color& rDocColor) { aDocCol = rDocColor; }
104 ScViewOptions& operator= ( const ScViewOptions& rCpy );
105 bool operator== ( const ScViewOptions& rOpt ) const;
106 bool operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); }
108 private:
109 bool aOptArr [MAX_OPT];
110 ScVObjMode aModeArr [MAX_TYPE];
111 Color aGridCol;
112 OUString aGridColName;
113 ScGridOptions aGridOpt;
114 // The name of the color scheme
115 OUString sColorSchemeName = "Default";
116 // The background color of the document
117 Color aDocCol;
120 // Item for the options dialog - View
122 class SC_DLLPUBLIC ScTpViewItem final : public SfxPoolItem
124 public:
125 ScTpViewItem( const ScViewOptions& rOpt );
126 virtual ~ScTpViewItem() override;
128 ScTpViewItem(ScTpViewItem const &) = default;
129 ScTpViewItem(ScTpViewItem &&) = default;
130 ScTpViewItem & operator =(ScTpViewItem const &) = delete; // due to SfxPoolItem
131 ScTpViewItem & operator =(ScTpViewItem &&) = delete; // due to SfxPoolItem
133 virtual bool operator==( const SfxPoolItem& ) const override;
134 virtual ScTpViewItem* Clone( SfxItemPool *pPool = nullptr ) const override;
136 const ScViewOptions& GetViewOptions() const { return theOptions; }
138 private:
139 ScViewOptions theOptions;
142 // CfgItem for View options
144 class ScViewCfg : public ScViewOptions
146 ScLinkConfigItem aLayoutItem;
147 ScLinkConfigItem aDisplayItem;
148 ScLinkConfigItem aGridItem;
150 DECL_LINK( LayoutCommitHdl, ScLinkConfigItem&, void );
151 DECL_LINK( DisplayCommitHdl, ScLinkConfigItem&, void );
152 DECL_LINK( GridCommitHdl, ScLinkConfigItem&, void );
154 static css::uno::Sequence<OUString> GetLayoutPropertyNames();
155 static css::uno::Sequence<OUString> GetDisplayPropertyNames();
156 static css::uno::Sequence<OUString> GetGridPropertyNames();
158 public:
159 ScViewCfg();
161 void SetOptions( const ScViewOptions& rNew );
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */