Branch libreoffice-24-8-3
[LibreOffice.git] / sc / inc / viewopti.hxx
blob5850df5ed375c8344f955d61238d010ab3ceb622
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_NOTEAUTHOR,
37 VOPT_FORMULAS_MARKS,
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_SUMMARY,
49 // tdf#96854 - move/copy sheet dialog: last used option for action (true: copy, false: move)
50 VOPT_COPY_SHEET,
51 VOPT_THEMEDCURSOR,
54 enum ScVObjType
56 VOBJ_TYPE_OLE = 0,
57 VOBJ_TYPE_CHART,
58 VOBJ_TYPE_DRAW
61 #define MAX_OPT sal_uInt16(VOPT_THEMEDCURSOR)+1
62 #define MAX_TYPE sal_uInt16(VOBJ_TYPE_DRAW)+1
64 // SvxGrid options with standard operators
66 class ScGridOptions : public SvxOptionsGrid
68 public:
69 ScGridOptions() {}
70 ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {}
72 void SetDefaults();
73 bool operator== ( const ScGridOptions& rOpt ) const;
74 bool operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); }
77 class SC_DLLPUBLIC ScViewRenderingOptions
79 public:
80 ScViewRenderingOptions();
82 const OUString& GetColorSchemeName() const { return sColorSchemeName; }
83 void SetColorSchemeName( const OUString& rName ) { sColorSchemeName = rName; }
85 const Color& GetDocColor() const { return aDocCol; }
86 void SetDocColor(const Color& rDocColor) { aDocCol = rDocColor; }
88 bool operator==(const ScViewRenderingOptions& rOther) const;
90 private:
91 // The name of the color scheme
92 OUString sColorSchemeName;
93 // The background color of the document
94 Color aDocCol;
97 // Options - View
99 class SC_DLLPUBLIC ScViewOptions
101 public:
102 ScViewOptions();
103 ScViewOptions( const ScViewOptions& rCpy );
104 ~ScViewOptions();
106 void SetDefaults();
108 void SetOption( ScViewOption eOpt, bool bNew ) { aOptArr[eOpt] = bNew; }
109 bool GetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; }
111 void SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; }
112 ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; }
114 void SetGridColor( const Color& rCol, const OUString& rName ) { aGridCol = rCol; aGridColName = rName;}
115 Color const & GetGridColor( OUString* pStrName = nullptr ) const;
117 const ScGridOptions& GetGridOptions() const { return aGridOpt; }
118 void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
119 std::unique_ptr<SvxGridItem> CreateGridItem() const;
121 ScViewOptions& operator= ( const ScViewOptions& rCpy );
122 bool operator== ( const ScViewOptions& rOpt ) const;
123 bool operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); }
125 private:
126 bool aOptArr [MAX_OPT];
127 ScVObjMode aModeArr [MAX_TYPE];
128 Color aGridCol;
129 OUString aGridColName;
130 ScGridOptions aGridOpt;
133 // Item for the options dialog - View
135 class SC_DLLPUBLIC ScTpViewItem final : public SfxPoolItem
137 public:
138 ScTpViewItem( const ScViewOptions& rOpt );
139 virtual ~ScTpViewItem() override;
141 ScTpViewItem(ScTpViewItem const &) = default;
142 ScTpViewItem(ScTpViewItem &&) = default;
143 ScTpViewItem & operator =(ScTpViewItem const &) = delete; // due to SfxPoolItem
144 ScTpViewItem & operator =(ScTpViewItem &&) = delete; // due to SfxPoolItem
146 virtual bool operator==( const SfxPoolItem& ) const override;
147 virtual ScTpViewItem* Clone( SfxItemPool *pPool = nullptr ) const override;
149 const ScViewOptions& GetViewOptions() const { return theOptions; }
151 private:
152 ScViewOptions theOptions;
155 // CfgItem for View options
157 class ScViewCfg : public ScViewOptions
159 ScLinkConfigItem aLayoutItem;
160 ScLinkConfigItem aDisplayItem;
161 ScLinkConfigItem aGridItem;
163 DECL_LINK( LayoutCommitHdl, ScLinkConfigItem&, void );
164 DECL_LINK( DisplayCommitHdl, ScLinkConfigItem&, void );
165 DECL_LINK( GridCommitHdl, ScLinkConfigItem&, void );
167 static css::uno::Sequence<OUString> GetLayoutPropertyNames();
168 static css::uno::Sequence<OUString> GetDisplayPropertyNames();
169 static css::uno::Sequence<OUString> GetGridPropertyNames();
171 public:
172 ScViewCfg();
174 void SetOptions( const ScViewOptions& rNew );
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */