1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SC_XEVIEW_HXX 25 #define SC_XEVIEW_HXX 26 27 #include "xerecord.hxx" 28 #include "xlview.hxx" 29 #include "xeroot.hxx" 30 31 // Workbook view settings records ============================================= 32 33 /** Represents the WINDOW1 record containing global workbook view settings. */ 34 class XclExpWindow1 : public XclExpRecord 35 { 36 public: 37 explicit XclExpWindow1( const XclExpRoot& rRoot ); 38 39 virtual void SaveXml( XclExpXmlStream& rStrm ); 40 41 private: 42 /** Writes the contents of the WINDOW1 record. */ 43 virtual void WriteBody( XclExpStream& rStrm ); 44 45 private: 46 sal_uInt16 mnFlags; /// Option flags. 47 sal_uInt16 mnTabBarSize; /// Size of tabbar relative to window width (per mill). 48 }; 49 50 // Sheet view settings records ================================================ 51 52 /** Represents a WINDOW2 record with general view settings for a sheet. */ 53 class XclExpWindow2 : public XclExpRecord 54 { 55 public: 56 explicit XclExpWindow2( const XclExpRoot& rRoot, 57 const XclTabViewData& rData, sal_uInt32 nGridColorId ); 58 59 private: 60 /** Writes the contents of the WINDOW2 record. */ 61 virtual void WriteBody( XclExpStream& rStrm ); 62 63 private: 64 Color maGridColor; /// Grid color (<=BIFF5). 65 sal_uInt32 mnGridColorId; /// Color ID of grid color (>=BIFF8). 66 sal_uInt16 mnFlags; /// Option flags. 67 XclAddress maFirstXclPos; /// First visible cell. 68 sal_uInt16 mnNormalZoom; /// Zoom factor for normal view. 69 sal_uInt16 mnPageZoom; /// Zoom factor for pagebreak preview. 70 }; 71 72 // ---------------------------------------------------------------------------- 73 74 /** Represents an SCL record for the zoom factor of the current view of a sheet. */ 75 class XclExpScl : public XclExpRecord 76 { 77 public: 78 explicit XclExpScl( sal_uInt16 nZoom ); 79 80 private: 81 /** Tries to shorten numerator and denominator by the passed value. */ 82 void Shorten( sal_uInt16 nFactor ); 83 /** Writes the contents of the SCL record. */ 84 virtual void WriteBody( XclExpStream& rStrm ); 85 86 private: 87 sal_uInt16 mnNum; /// Numerator of the zoom factor. 88 sal_uInt16 mnDenom; /// Denominator of the zoom factor. 89 }; 90 91 // ---------------------------------------------------------------------------- 92 93 /** Represents a PANE record containing settings for split/frozen windows. */ 94 class XclExpPane : public XclExpRecord 95 { 96 public: 97 explicit XclExpPane( const XclTabViewData& rData ); 98 99 virtual void SaveXml( XclExpXmlStream& rStrm ); 100 101 private: 102 /** Writes the contents of the PANE record. */ 103 virtual void WriteBody( XclExpStream& rStrm ); 104 105 private: 106 sal_uInt16 mnSplitX; /// Split X position, or frozen column. 107 sal_uInt16 mnSplitY; /// Split Y position, or frozen row. 108 XclAddress maSecondXclPos; /// First visible cell in additional panes. 109 sal_uInt8 mnActivePane; /// Active pane (with cell cursor). 110 }; 111 112 // ---------------------------------------------------------------------------- 113 114 /** Represents a SELECTION record with selection data for a pane. */ 115 class XclExpSelection : public XclExpRecord 116 { 117 public: 118 explicit XclExpSelection( const XclTabViewData& rData, sal_uInt8 nPane ); 119 120 virtual void SaveXml( XclExpXmlStream& rStrm ); 121 private: 122 /** Writes the contents of the SELECTION record. */ 123 virtual void WriteBody( XclExpStream& rStrm ); 124 125 private: 126 XclSelectionData maSelData; /// Selection data. 127 sal_uInt8 mnPane; /// Pane identifier of this selection. 128 }; 129 130 class XclExpTabBgColor : public XclExpRecord 131 { 132 public: 133 explicit XclExpTabBgColor( const XclTabViewData& rTabViewData ); 134 135 /* virtual void SaveXml( XclExpXmlStream& rStrm ); TODO Fix XML Saving Stream */ 136 private: 137 /** Writes the contents of the SHEETEXT record. */ 138 virtual void WriteBody( XclExpStream& rStrm ); 139 140 private: 141 const XclTabViewData& mrTabViewData; /// view settings data of current sheet. 142 }; 143 144 // View settings ============================================================== 145 146 /** Contains all view settings records for a single sheet. */ 147 class XclExpTabViewSettings : public XclExpRecordBase, protected XclExpRoot 148 { 149 public: 150 /** Creates all records containing the view settings of the specified sheet. */ 151 explicit XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nScTab ); 152 153 /** Writes all view settings records to the stream. */ 154 virtual void Save( XclExpStream& rStrm ); 155 virtual void SaveXml( XclExpXmlStream& rStrm ); 156 157 private: 158 /** Creates selection data for the specified pane. */ 159 void CreateSelectionData( sal_uInt8 nPane, 160 const ScAddress& rCursor, const ScRangeList& rSelection ); 161 162 void WriteWindow2( XclExpStream& rStrm ) const; 163 void WriteScl( XclExpStream& rStrm ) const; 164 void WritePane( XclExpStream& rStrm ) const; 165 void WriteSelection( XclExpStream& rStrm, sal_uInt8 nPane ) const; 166 void WriteTabBgColor( XclExpStream& rStrm ) const; 167 168 private: 169 XclTabViewData maData; /// All view settings for a sheet. 170 sal_uInt32 mnGridColorId; /// Color identifier for grid color. 171 }; 172 173 // ============================================================================ 174 175 #endif 176 177