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 30 enum ScViewOption 31 { 32 VOPT_FORMULAS = 0, 33 VOPT_NULLVALS, 34 VOPT_SYNTAX, 35 VOPT_NOTES, 36 VOPT_VSCROLL, 37 VOPT_HSCROLL, 38 VOPT_TABCONTROLS, 39 VOPT_OUTLINER, 40 VOPT_HEADER, 41 VOPT_GRID, 42 VOPT_GRID_ONTOP, 43 VOPT_HELPLINES, 44 VOPT_ANCHOR, 45 VOPT_PAGEBREAKS, 46 VOPT_SUMMARY, 47 VOPT_THEMEDCURSOR, 48 VOPT_CLIPMARKS, 49 }; 50 51 enum ScVObjType 52 { 53 VOBJ_TYPE_OLE = 0, 54 VOBJ_TYPE_CHART, 55 VOBJ_TYPE_DRAW 56 }; 57 58 #define MAX_OPT sal_uInt16(VOPT_CLIPMARKS)+1 59 #define MAX_TYPE sal_uInt16(VOBJ_TYPE_DRAW)+1 60 61 #define SC_STD_GRIDCOLOR COL_LIGHTGRAY 62 63 // SvxGrid options with standard operators 64 65 class ScGridOptions : public SvxOptionsGrid 66 { 67 public: ScGridOptions()68 ScGridOptions() : SvxOptionsGrid() {} ScGridOptions(const SvxOptionsGrid & rOpt)69 ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {} 70 71 void SetDefaults(); 72 bool operator== ( const ScGridOptions& rOpt ) const; operator !=(const ScGridOptions & rOpt) const73 bool operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); } 74 }; 75 76 // Options - View 77 78 class SC_DLLPUBLIC ScViewOptions 79 { 80 public: 81 ScViewOptions(); 82 ScViewOptions( const ScViewOptions& rCpy ); 83 ~ScViewOptions(); 84 85 void SetDefaults(); 86 SetOption(ScViewOption eOpt,bool bNew)87 void SetOption( ScViewOption eOpt, bool bNew ) { aOptArr[eOpt] = bNew; } GetOption(ScViewOption eOpt) const88 bool GetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; } 89 SetObjMode(ScVObjType eObj,ScVObjMode eMode)90 void SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; } GetObjMode(ScVObjType eObj) const91 ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; } 92 SetGridColor(const Color & rCol,const OUString & rName)93 void SetGridColor( const Color& rCol, const OUString& rName ) { aGridCol = rCol; aGridColName = rName;} 94 Color const & GetGridColor( OUString* pStrName = nullptr ) const; 95 GetGridOptions() const96 const ScGridOptions& GetGridOptions() const { return aGridOpt; } SetGridOptions(const ScGridOptions & rNew)97 void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; } 98 std::unique_ptr<SvxGridItem> CreateGridItem() const; 99 100 ScViewOptions& operator= ( const ScViewOptions& rCpy ); 101 bool operator== ( const ScViewOptions& rOpt ) const; operator !=(const ScViewOptions & rOpt) const102 bool operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); } 103 104 private: 105 bool aOptArr [MAX_OPT]; 106 ScVObjMode aModeArr [MAX_TYPE]; 107 Color aGridCol; 108 OUString aGridColName; 109 ScGridOptions aGridOpt; 110 }; 111 112 // Item for the options dialog - View 113 114 class SC_DLLPUBLIC ScTpViewItem final : public SfxPoolItem 115 { 116 public: 117 ScTpViewItem( const ScViewOptions& rOpt ); 118 virtual ~ScTpViewItem() override; 119 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 124 125 virtual bool operator==( const SfxPoolItem& ) const override; 126 virtual ScTpViewItem* Clone( SfxItemPool *pPool = nullptr ) const override; 127 GetViewOptions() const128 const ScViewOptions& GetViewOptions() const { return theOptions; } 129 130 private: 131 ScViewOptions theOptions; 132 }; 133 134 // CfgItem for View options 135 136 class ScViewCfg : public ScViewOptions 137 { 138 ScLinkConfigItem aLayoutItem; 139 ScLinkConfigItem aDisplayItem; 140 ScLinkConfigItem aGridItem; 141 142 DECL_LINK( LayoutCommitHdl, ScLinkConfigItem&, void ); 143 DECL_LINK( DisplayCommitHdl, ScLinkConfigItem&, void ); 144 DECL_LINK( GridCommitHdl, ScLinkConfigItem&, void ); 145 146 static css::uno::Sequence<OUString> GetLayoutPropertyNames(); 147 static css::uno::Sequence<OUString> GetDisplayPropertyNames(); 148 static css::uno::Sequence<OUString> GetGridPropertyNames(); 149 150 public: 151 ScViewCfg(); 152 153 void SetOptions( const ScViewOptions& rNew ); 154 }; 155 156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 157