LibreOffice Module sc (master)  1
viewopti.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #pragma once
21 
22 #include <svx/optgrid.hxx>
23 
24 #include "scdllapi.h"
25 #include "optutil.hxx"
26 #include "global.hxx"
27 
28 // View options
29 
31 {
48 };
49 
51 {
55 };
56 
57 #define MAX_OPT sal_uInt16(VOPT_CLIPMARKS)+1
58 #define MAX_TYPE sal_uInt16(VOBJ_TYPE_DRAW)+1
59 
60 #define SC_STD_GRIDCOLOR COL_LIGHTGRAY
61 
62 // SvxGrid options with standard operators
63 
65 {
66 public:
68  ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {}
69 
70  void SetDefaults();
71  bool operator== ( const ScGridOptions& rOpt ) const;
72  bool operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); }
73 };
74 
75 // Options - View
76 
78 {
79 public:
80  ScViewOptions();
81  ScViewOptions( const ScViewOptions& rCpy );
82  ~ScViewOptions();
83 
84  void SetDefaults();
85 
86  void SetOption( ScViewOption eOpt, bool bNew ) { aOptArr[eOpt] = bNew; }
87  bool GetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; }
88 
89  void SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; }
90  ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; }
91 
92  void SetGridColor( const Color& rCol, const OUString& rName ) { aGridCol = rCol; aGridColName = rName;}
93  Color const & GetGridColor( OUString* pStrName = nullptr ) const;
94 
95  const ScGridOptions& GetGridOptions() const { return aGridOpt; }
96  void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
97  std::unique_ptr<SvxGridItem> CreateGridItem() const;
98 
99  ScViewOptions& operator= ( const ScViewOptions& rCpy );
100  bool operator== ( const ScViewOptions& rOpt ) const;
101  bool operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); }
102 
103 private:
104  bool aOptArr [MAX_OPT];
105  ScVObjMode aModeArr [MAX_TYPE];
107  OUString aGridColName;
109 };
110 
111 // Item for the options dialog - View
112 
114 {
115 public:
116  ScTpViewItem( const ScViewOptions& rOpt );
117  virtual ~ScTpViewItem() override;
118 
119  ScTpViewItem(ScTpViewItem const &) = default;
120  ScTpViewItem(ScTpViewItem &&) = default;
121  ScTpViewItem & operator =(ScTpViewItem const &) = delete; // due to SfxPoolItem
122  ScTpViewItem & operator =(ScTpViewItem &&) = delete; // due to SfxPoolItem
123 
124  virtual bool operator==( const SfxPoolItem& ) const override;
125  virtual ScTpViewItem* Clone( SfxItemPool *pPool = nullptr ) const override;
126 
127  const ScViewOptions& GetViewOptions() const { return theOptions; }
128 
129 private:
131 };
132 
133 // CfgItem for View options
134 
135 class ScViewCfg : public ScViewOptions
136 {
140 
141  DECL_LINK( LayoutCommitHdl, ScLinkConfigItem&, void );
142  DECL_LINK( DisplayCommitHdl, ScLinkConfigItem&, void );
143  DECL_LINK( GridCommitHdl, ScLinkConfigItem&, void );
144 
145  static css::uno::Sequence<OUString> GetLayoutPropertyNames();
146  static css::uno::Sequence<OUString> GetDisplayPropertyNames();
147  static css::uno::Sequence<OUString> GetGridPropertyNames();
148 
149 public:
150  ScViewCfg();
151 
152  void SetOptions( const ScViewOptions& rNew );
153 };
154 
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:518
void SetOption(ScViewOption eOpt, bool bNew)
Definition: viewopti.hxx:86
ScGridOptions(const SvxOptionsGrid &rOpt)
Definition: viewopti.hxx:68
ScLinkConfigItem aDisplayItem
Definition: viewopti.hxx:138
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
Definition: xestring.hxx:250
ScViewOption
Definition: viewopti.hxx:30
virtual bool operator==(const SfxPoolItem &) const =0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
bool operator==(const ScGridOptions &rOpt) const
Definition: viewopti.cxx:60
ScViewOptions theOptions
Definition: viewopti.hxx:130
SfxPoolItem & operator=(const SfxPoolItem &)=delete
void SetDefaults()
Definition: viewopti.cxx:35
void SetObjMode(ScVObjType eObj, ScVObjMode eMode)
Definition: viewopti.hxx:89
static css::uno::Sequence< OUString > GetGridPropertyNames()
Definition: viewopti.cxx:255
ScVObjType
Definition: viewopti.hxx:50
Color aGridCol
Definition: viewopti.hxx:106
bool operator!=(const ScGridOptions &rOpt) const
Definition: viewopti.hxx:72
void SetOptions(const ScViewOptions &rNew)
Definition: viewopti.cxx:594
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:87
void SetGridOptions(const ScGridOptions &rNew)
Definition: viewopti.hxx:96
const ScGridOptions & GetGridOptions() const
Definition: viewopti.hxx:95
ScGridOptions aGridOpt
Definition: viewopti.hxx:108
ScLinkConfigItem aGridItem
Definition: viewopti.hxx:139
#define MAX_OPT
Definition: viewopti.hxx:57
static css::uno::Sequence< OUString > GetLayoutPropertyNames()
Definition: viewopti.cxx:227
OUString aGridColName
Definition: viewopti.hxx:107
const ScViewOptions & GetViewOptions() const
Definition: viewopti.hxx:127
DECL_LINK(LayoutCommitHdl, ScLinkConfigItem &, void)
static css::uno::Sequence< OUString > GetDisplayPropertyNames()
Definition: viewopti.cxx:242
ScVObjMode
Definition: global.hxx:376
void SetGridColor(const Color &rCol, const OUString &rName)
Definition: viewopti.hxx:92
#define MAX_TYPE
Definition: viewopti.hxx:58
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
ScVObjMode GetObjMode(ScVObjType eObj) const
Definition: viewopti.hxx:90
ScLinkConfigItem aLayoutItem
Definition: viewopti.hxx:137