1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <svx/optgrid.hxx>
25 #include "optutil.hxx"
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
69 ScGridOptions( const SvxOptionsGrid
& rOpt
) : SvxOptionsGrid( rOpt
) {}
72 bool operator== ( const ScGridOptions
& rOpt
) const;
73 bool operator!= ( const ScGridOptions
& rOpt
) const { return !(operator==(rOpt
)); }
78 class SC_DLLPUBLIC ScViewOptions
82 ScViewOptions( const ScViewOptions
& rCpy
);
87 void SetOption( ScViewOption eOpt
, bool bNew
) { aOptArr
[eOpt
] = bNew
; }
88 bool GetOption( ScViewOption eOpt
) const { return aOptArr
[eOpt
]; }
90 void SetObjMode( ScVObjType eObj
, ScVObjMode eMode
) { aModeArr
[eObj
] = eMode
; }
91 ScVObjMode
GetObjMode( ScVObjType eObj
) const { return aModeArr
[eObj
]; }
93 void SetGridColor( const Color
& rCol
, const OUString
& rName
) { aGridCol
= rCol
; aGridColName
= rName
;}
94 Color
const & GetGridColor( OUString
* pStrName
= nullptr ) const;
96 const ScGridOptions
& GetGridOptions() const { return aGridOpt
; }
97 void SetGridOptions( const ScGridOptions
& rNew
) { aGridOpt
= rNew
; }
98 std::unique_ptr
<SvxGridItem
> CreateGridItem() const;
100 ScViewOptions
& operator= ( const ScViewOptions
& rCpy
);
101 bool operator== ( const ScViewOptions
& rOpt
) const;
102 bool operator!= ( const ScViewOptions
& rOpt
) const { return !(operator==(rOpt
)); }
105 bool aOptArr
[MAX_OPT
];
106 ScVObjMode aModeArr
[MAX_TYPE
];
108 OUString aGridColName
;
109 ScGridOptions aGridOpt
;
112 // Item for the options dialog - View
114 class SC_DLLPUBLIC ScTpViewItem final
: public SfxPoolItem
117 ScTpViewItem( const ScViewOptions
& rOpt
);
118 virtual ~ScTpViewItem() override
;
120 ScTpViewItem(ScTpViewItem
const &) = default;
121 ScTpViewItem(ScTpViewItem
&&) = default;
122 ScTpViewItem
& operator =(ScTpViewItem
const &) = delete; // due to SfxPoolItem
123 ScTpViewItem
& operator =(ScTpViewItem
&&) = delete; // due to SfxPoolItem
125 virtual bool operator==( const SfxPoolItem
& ) const override
;
126 virtual ScTpViewItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
128 const ScViewOptions
& GetViewOptions() const { return theOptions
; }
131 ScViewOptions theOptions
;
134 // CfgItem for View options
136 class ScViewCfg
: public ScViewOptions
138 ScLinkConfigItem aLayoutItem
;
139 ScLinkConfigItem aDisplayItem
;
140 ScLinkConfigItem aGridItem
;
142 DECL_LINK( LayoutCommitHdl
, ScLinkConfigItem
&, void );
143 DECL_LINK( DisplayCommitHdl
, ScLinkConfigItem
&, void );
144 DECL_LINK( GridCommitHdl
, ScLinkConfigItem
&, void );
146 static css::uno::Sequence
<OUString
> GetLayoutPropertyNames();
147 static css::uno::Sequence
<OUString
> GetDisplayPropertyNames();
148 static css::uno::Sequence
<OUString
> GetGridPropertyNames();
153 void SetOptions( const ScViewOptions
& rNew
);
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */