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_THEMEDCURSOR)+1
59 #define MAX_TYPE sal_uInt16(VOBJ_TYPE_DRAW)+1
61 // SvxGrid options with standard operators
63 class ScGridOptions
: public SvxOptionsGrid
67 ScGridOptions( const SvxOptionsGrid
& rOpt
) : SvxOptionsGrid( rOpt
) {}
70 bool operator== ( const ScGridOptions
& rOpt
) const;
71 bool operator!= ( const ScGridOptions
& rOpt
) const { return !(operator==(rOpt
)); }
76 class SC_DLLPUBLIC ScViewOptions
80 ScViewOptions( const ScViewOptions
& rCpy
);
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
)); }
109 bool aOptArr
[MAX_OPT
];
110 ScVObjMode aModeArr
[MAX_TYPE
];
112 OUString aGridColName
;
113 ScGridOptions aGridOpt
;
114 // The name of the color scheme
115 OUString sColorSchemeName
= "Default";
116 // The background color of the document
120 // Item for the options dialog - View
122 class SC_DLLPUBLIC ScTpViewItem final
: public SfxPoolItem
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
; }
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();
161 void SetOptions( const ScViewOptions
& rNew
);
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */