1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SC_VIEWOPTI_HXX 29 #define SC_VIEWOPTI_HXX 30 31 #include <svx/optgrid.hxx> 32 33 #ifndef _SVX_SVXIDS_HRC //autogen 34 #include <svx/svxids.hrc> 35 #endif 36 #include "scdllapi.h" 37 #include "optutil.hxx" 38 #include "global.hxx" 39 40 //================================================================== 41 // View-Optionen 42 //================================================================== 43 44 enum ScViewOption 45 { 46 VOPT_FORMULAS = 0, 47 VOPT_NULLVALS, 48 VOPT_SYNTAX, 49 VOPT_NOTES, 50 VOPT_VSCROLL, 51 VOPT_HSCROLL, 52 VOPT_TABCONTROLS, 53 VOPT_OUTLINER, 54 VOPT_HEADER, 55 VOPT_GRID, 56 VOPT_HELPLINES, 57 VOPT_ANCHOR, 58 VOPT_PAGEBREAKS, 59 VOPT_SOLIDHANDLES, 60 VOPT_CLIPMARKS, 61 VOPT_BIGHANDLES 62 }; 63 64 enum ScVObjType 65 { 66 VOBJ_TYPE_OLE = 0, 67 VOBJ_TYPE_CHART, 68 VOBJ_TYPE_DRAW 69 }; 70 71 #define MAX_OPT (sal_uInt16)VOPT_BIGHANDLES+1 72 #define MAX_TYPE (sal_uInt16)VOBJ_TYPE_DRAW+1 73 74 #define SC_STD_GRIDCOLOR COL_LIGHTGRAY 75 76 //================================================================== 77 // SvxGrid-Optionen mit Standard-Operatoren 78 //================================================================== 79 80 class ScGridOptions : public SvxOptionsGrid 81 { 82 public: 83 ScGridOptions() : SvxOptionsGrid() {} 84 ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {} 85 86 void SetDefaults(); 87 const ScGridOptions& operator= ( const ScGridOptions& rCpy ); 88 int operator== ( const ScGridOptions& rOpt ) const; 89 int operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); } 90 }; 91 92 //================================================================== 93 // Einstellungen - Ansicht 94 //================================================================== 95 96 class SC_DLLPUBLIC ScViewOptions 97 { 98 public: 99 ScViewOptions(); 100 ScViewOptions( const ScViewOptions& rCpy ); 101 ~ScViewOptions(); 102 103 void SetDefaults(); 104 105 void SetOption( ScViewOption eOpt, sal_Bool bNew = sal_True ) { aOptArr[eOpt] = bNew; } 106 sal_Bool GetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; } 107 108 void SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; } 109 ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; } 110 111 void SetGridColor( const Color& rCol, const String& rName ) { aGridCol = rCol; aGridColName = rName;} 112 Color GetGridColor( String* pStrName = NULL ) const; 113 114 const ScGridOptions& GetGridOptions() const { return aGridOpt; } 115 void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; } 116 SvxGridItem* CreateGridItem( sal_uInt16 nId = SID_ATTR_GRID_OPTIONS ) const; 117 118 const ScViewOptions& operator= ( const ScViewOptions& rCpy ); 119 int operator== ( const ScViewOptions& rOpt ) const; 120 int operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); } 121 122 private: 123 sal_Bool aOptArr [MAX_OPT]; 124 ScVObjMode aModeArr [MAX_TYPE]; 125 Color aGridCol; 126 String aGridColName; 127 ScGridOptions aGridOpt; 128 }; 129 130 //================================================================== 131 // Item fuer Einstellungsdialog - Ansicht 132 //================================================================== 133 134 class SC_DLLPUBLIC ScTpViewItem : public SfxPoolItem 135 { 136 public: 137 TYPEINFO(); 138 //UNUSED2008-05 ScTpViewItem( sal_uInt16 nWhich ); 139 ScTpViewItem( sal_uInt16 nWhich, const ScViewOptions& rOpt ); 140 ScTpViewItem( const ScTpViewItem& rItem ); 141 ~ScTpViewItem(); 142 143 virtual String GetValueText() const; 144 virtual int operator==( const SfxPoolItem& ) const; 145 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 146 147 const ScViewOptions& GetViewOptions() const { return theOptions; } 148 149 private: 150 ScViewOptions theOptions; 151 }; 152 153 154 //================================================================== 155 // CfgItem fuer View-Optionen 156 //================================================================== 157 158 class ScViewCfg : public ScViewOptions 159 { 160 ScLinkConfigItem aLayoutItem; 161 ScLinkConfigItem aDisplayItem; 162 ScLinkConfigItem aGridItem; 163 164 DECL_LINK( LayoutCommitHdl, void* ); 165 DECL_LINK( DisplayCommitHdl, void* ); 166 DECL_LINK( GridCommitHdl, void* ); 167 168 com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames(); 169 com::sun::star::uno::Sequence<rtl::OUString> GetDisplayPropertyNames(); 170 com::sun::star::uno::Sequence<rtl::OUString> GetGridPropertyNames(); 171 172 public: 173 ScViewCfg(); 174 175 void SetOptions( const ScViewOptions& rNew ); 176 }; 177 178 179 #endif 180