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 #ifndef SC_SCEXTOPT_HXX 28 #define SC_SCEXTOPT_HXX 29 30 #include <memory> 31 #include <tools/gen.hxx> 32 #include <tools/color.hxx> 33 #include "global.hxx" 34 #include "rangelst.hxx" 35 36 // ============================================================================ 37 38 /** Extended settings for the document, used in import/export filters. */ 39 struct ScExtDocSettings 40 { 41 String maGlobCodeName; /// Global codename (VBA module name). 42 double mfTabBarWidth; /// Width of the tabbar, relative to frame window width (0.0 ... 1.0). 43 sal_uInt32 mnLinkCnt; /// Recursive counter for loading external documents. 44 SCTAB mnDisplTab; /// Index of displayed sheet. 45 46 explicit ScExtDocSettings(); 47 }; 48 49 // ============================================================================ 50 51 /** Enumerates possible positions of panes in split sheets. */ 52 enum ScExtPanePos 53 { 54 SCEXT_PANE_TOPLEFT, /// Single, top, left, or top-left pane. 55 SCEXT_PANE_TOPRIGHT, /// Right, or top-right pane. 56 SCEXT_PANE_BOTTOMLEFT, /// Bottom, or bottom-left pane. 57 SCEXT_PANE_BOTTOMRIGHT /// Bottom-right pane. 58 }; 59 60 // ---------------------------------------------------------------------------- 61 62 /** Extended settings for a sheet, used in import/export filters. */ 63 struct ScExtTabSettings 64 { 65 ScRange maUsedArea; /// Used area in the sheet (columns/rows only). 66 ScRangeList maSelection; /// Selected cell ranges (columns/rows only). 67 ScAddress maCursor; /// The cursor position (column/row only). 68 ScAddress maFirstVis; /// Top-left visible cell (column/row only). 69 ScAddress maSecondVis; /// Top-left visible cell in add. panes (column/row only). 70 ScAddress maFreezePos; /// Position of frozen panes (column/row only). 71 Point maSplitPos; /// Position of split. 72 ScExtPanePos meActivePane; /// Active (focused) pane. 73 Color maGridColor; /// Grid color. 74 long mnNormalZoom; /// Zoom in percent for normal view. 75 long mnPageZoom; /// Zoom in percent for pagebreak preview. 76 bool mbSelected; /// true = Sheet is selected. 77 bool mbFrozenPanes; /// true = Frozen panes; false = Normal splits. 78 bool mbPageMode; /// true = Pagebreak mode; false = Normal view mode. 79 80 explicit ScExtTabSettings(); 81 }; 82 83 // ============================================================================ 84 85 struct ScExtDocOptionsImpl; 86 87 /** Extended options held by an ScDocument containing additional settings for filters. 88 89 This object is owned by a Calc document. It contains global document settings 90 (struct ScExtDocSettings), settings for all sheets in the document 91 (struct ScExtTabSettings), and a list of codenames used for VBA import/export. 92 */ 93 class SC_DLLPUBLIC ScExtDocOptions 94 { 95 public: 96 explicit ScExtDocOptions(); 97 ScExtDocOptions( const ScExtDocOptions& rSrc ); 98 ~ScExtDocOptions(); 99 100 ScExtDocOptions& operator=( const ScExtDocOptions& rSrc ); 101 102 /** Returns true, if the data needs to be copied to the view data after import. */ 103 bool IsChanged() const; 104 /** If set to true, the data will be copied to the view data after import. */ 105 void SetChanged( bool bChanged ); 106 107 /** Returns read access to the global document settings. */ 108 const ScExtDocSettings& GetDocSettings() const; 109 /** Returns read/write access to the global document settings. */ 110 ScExtDocSettings& GetDocSettings(); 111 112 /** Returns read access to the settings of a sheet, if extant; otherwise 0. */ 113 const ScExtTabSettings* GetTabSettings( SCTAB nTab ) const; 114 /** Returns read/write access to the settings of a sheet, may create a new struct. */ 115 ScExtTabSettings& GetOrCreateTabSettings( SCTAB nTab ); 116 117 /** Returns the number of sheet codenames. */ 118 SCTAB GetCodeNameCount() const; 119 /** Returns the specified codename (empty string = no codename). */ 120 const String& GetCodeName( SCTAB nTab ) const; 121 /** Appends a codename for a sheet. */ 122 void SetCodeName( SCTAB nTab, const String& rCodeName ); 123 124 private: 125 ::std::auto_ptr< ScExtDocOptionsImpl > mxImpl; 126 }; 127 128 // ============================================================================ 129 130 #endif 131 132