1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xeview.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include "xerecord.hxx"
38 // Workbook view settings records =============================================
40 /** Represents the WINDOW1 record containing global workbook view settings. */
41 class XclExpWindow1
: public XclExpRecord
44 explicit XclExpWindow1( const XclExpRoot
& rRoot
);
46 virtual void SaveXml( XclExpXmlStream
& rStrm
);
49 /** Writes the contents of the WINDOW1 record. */
50 virtual void WriteBody( XclExpStream
& rStrm
);
53 sal_uInt16 mnFlags
; /// Option flags.
54 sal_uInt16 mnTabBarSize
; /// Size of tabbar relative to window width (per mill).
57 // Sheet view settings records ================================================
59 /** Represents a WINDOW2 record with general view settings for a sheet. */
60 class XclExpWindow2
: public XclExpRecord
63 explicit XclExpWindow2( const XclExpRoot
& rRoot
,
64 const XclTabViewData
& rData
, sal_uInt32 nGridColorId
);
67 /** Writes the contents of the WINDOW2 record. */
68 virtual void WriteBody( XclExpStream
& rStrm
);
71 Color maGridColor
; /// Grid color (<=BIFF5).
72 sal_uInt32 mnGridColorId
; /// Color ID of grid color (>=BIFF8).
73 sal_uInt16 mnFlags
; /// Option flags.
74 XclAddress maFirstXclPos
; /// First visible cell.
75 sal_uInt16 mnNormalZoom
; /// Zoom factor for normal view.
76 sal_uInt16 mnPageZoom
; /// Zoom factor for pagebreak preview.
79 // ----------------------------------------------------------------------------
81 /** Represents an SCL record for the zoom factor of the current view of a sheet. */
82 class XclExpScl
: public XclExpRecord
85 explicit XclExpScl( sal_uInt16 nZoom
);
88 /** Tries to shorten numerator and denominator by the passed value. */
89 void Shorten( sal_uInt16 nFactor
);
90 /** Writes the contents of the SCL record. */
91 virtual void WriteBody( XclExpStream
& rStrm
);
94 sal_uInt16 mnNum
; /// Numerator of the zoom factor.
95 sal_uInt16 mnDenom
; /// Denominator of the zoom factor.
98 // ----------------------------------------------------------------------------
100 /** Represents a PANE record containing settings for split/frozen windows. */
101 class XclExpPane
: public XclExpRecord
104 explicit XclExpPane( const XclTabViewData
& rData
);
106 virtual void SaveXml( XclExpXmlStream
& rStrm
);
109 /** Writes the contents of the PANE record. */
110 virtual void WriteBody( XclExpStream
& rStrm
);
113 sal_uInt16 mnSplitX
; /// Split X position, or frozen column.
114 sal_uInt16 mnSplitY
; /// Split Y position, or frozen row.
115 XclAddress maSecondXclPos
; /// First visible cell in additional panes.
116 sal_uInt8 mnActivePane
; /// Active pane (with cell cursor).
119 // ----------------------------------------------------------------------------
121 /** Represents a SELECTION record with selection data for a pane. */
122 class XclExpSelection
: public XclExpRecord
125 explicit XclExpSelection( const XclTabViewData
& rData
, sal_uInt8 nPane
);
127 virtual void SaveXml( XclExpXmlStream
& rStrm
);
129 /** Writes the contents of the SELECTION record. */
130 virtual void WriteBody( XclExpStream
& rStrm
);
133 XclSelectionData maSelData
; /// Selection data.
134 sal_uInt8 mnPane
; /// Pane identifier of this selection.
137 class XclExpTabBgColor
: public XclExpRecord
140 explicit XclExpTabBgColor( const XclTabViewData
& rTabViewData
);
142 /* virtual void SaveXml( XclExpXmlStream& rStrm ); TODO Fix XML Saving Stream */
144 /** Writes the contents of the SHEETEXT record. */
145 virtual void WriteBody( XclExpStream
& rStrm
);
148 const XclTabViewData
& mrTabViewData
; /// view settings data of current sheet.
151 // View settings ==============================================================
153 /** Contains all view settings records for a single sheet. */
154 class XclExpTabViewSettings
: public XclExpRecordBase
, protected XclExpRoot
157 /** Creates all records containing the view settings of the specified sheet. */
158 explicit XclExpTabViewSettings( const XclExpRoot
& rRoot
, SCTAB nScTab
);
160 /** Writes all view settings records to the stream. */
161 virtual void Save( XclExpStream
& rStrm
);
162 virtual void SaveXml( XclExpXmlStream
& rStrm
);
165 /** Creates selection data for the specified pane. */
166 void CreateSelectionData( sal_uInt8 nPane
,
167 const ScAddress
& rCursor
, const ScRangeList
& rSelection
);
169 void WriteWindow2( XclExpStream
& rStrm
) const;
170 void WriteScl( XclExpStream
& rStrm
) const;
171 void WritePane( XclExpStream
& rStrm
) const;
172 void WriteSelection( XclExpStream
& rStrm
, sal_uInt8 nPane
) const;
173 void WriteTabBgColor( XclExpStream
& rStrm
) const;
176 XclTabViewData maData
; /// All view settings for a sheet.
177 sal_uInt32 mnGridColorId
; /// Color identifier for grid color.
180 // ============================================================================