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"
49 // tdf#96854 - move/copy sheet dialog: last used option for action (true: copy, false: move)
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
70 ScGridOptions( const SvxOptionsGrid
& rOpt
) : SvxOptionsGrid( rOpt
) {}
73 bool operator== ( const ScGridOptions
& rOpt
) const;
74 bool operator!= ( const ScGridOptions
& rOpt
) const { return !(operator==(rOpt
)); }
77 class SC_DLLPUBLIC ScViewRenderingOptions
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;
91 // The name of the color scheme
92 OUString sColorSchemeName
;
93 // The background color of the document
99 class SC_DLLPUBLIC ScViewOptions
103 ScViewOptions( const ScViewOptions
& rCpy
);
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
)); }
126 bool aOptArr
[MAX_OPT
];
127 ScVObjMode aModeArr
[MAX_TYPE
];
129 OUString aGridColName
;
130 ScGridOptions aGridOpt
;
133 // Item for the options dialog - View
135 class SC_DLLPUBLIC ScTpViewItem final
: public SfxPoolItem
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
; }
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();
174 void SetOptions( const ScViewOptions
& rNew
);
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */