1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include "xerecord.hxx"
26 // Workbook view settings records =============================================
28 /** Represents the WINDOW1 record containing global workbook view settings. */
29 class XclExpWindow1
: public XclExpRecord
32 explicit XclExpWindow1( const XclExpRoot
& rRoot
);
34 virtual void SaveXml( XclExpXmlStream
& rStrm
) override
;
37 /** Writes the contents of the WINDOW1 record. */
38 virtual void WriteBody( XclExpStream
& rStrm
) override
;
41 sal_uInt16 mnFlags
; /// Option flags.
42 sal_uInt16 mnTabBarSize
; /// Size of tabbar relative to window width (per mill).
45 // Sheet view settings records ================================================
47 /** Represents a WINDOW2 record with general view settings for a sheet. */
48 class XclExpWindow2
: public XclExpRecord
51 explicit XclExpWindow2( const XclExpRoot
& rRoot
,
52 const XclTabViewData
& rData
, sal_uInt32 nGridColorId
);
55 /** Writes the contents of the WINDOW2 record. */
56 virtual void WriteBody( XclExpStream
& rStrm
) override
;
59 Color maGridColor
; /// Grid color (<=BIFF5).
60 sal_uInt32 mnGridColorId
; /// Color ID of grid color (>=BIFF8).
61 sal_uInt16 mnFlags
; /// Option flags.
62 XclAddress maFirstXclPos
; /// First visible cell.
63 sal_uInt16 mnNormalZoom
; /// Zoom factor for normal view.
64 sal_uInt16 mnPageZoom
; /// Zoom factor for pagebreak preview.
67 /** Represents an SCL record for the zoom factor of the current view of a sheet. */
68 class XclExpScl
: public XclExpRecord
71 explicit XclExpScl( sal_uInt16 nZoom
);
74 /** Tries to shorten numerator and denominator by the passed value. */
75 void Shorten( sal_uInt16 nFactor
);
76 /** Writes the contents of the SCL record. */
77 virtual void WriteBody( XclExpStream
& rStrm
) override
;
80 sal_uInt16 mnNum
; /// Numerator of the zoom factor.
81 sal_uInt16 mnDenom
; /// Denominator of the zoom factor.
84 /** Represents a PANE record containing settings for split/frozen windows. */
85 class XclExpPane
: public XclExpRecord
88 explicit XclExpPane( const XclTabViewData
& rData
);
90 virtual void SaveXml( XclExpXmlStream
& rStrm
) override
;
93 /** Writes the contents of the PANE record. */
94 virtual void WriteBody( XclExpStream
& rStrm
) override
;
97 sal_uInt16 mnSplitX
; /// Split X position, or frozen column.
98 sal_uInt32 mnSplitY
; /// Split Y position, or frozen row.
99 XclAddress maSecondXclPos
; /// First visible cell in additional panes.
100 sal_uInt8 mnActivePane
; /// Active pane (with cell cursor).
101 bool mbFrozenPanes
; /// true = "frozen" panes; false = "split" window.
104 /** Represents a SELECTION record with selection data for a pane. */
105 class XclExpSelection
: public XclExpRecord
108 explicit XclExpSelection( const XclTabViewData
& rData
, sal_uInt8 nPane
);
110 virtual void SaveXml( XclExpXmlStream
& rStrm
) override
;
112 /** Writes the contents of the SELECTION record. */
113 virtual void WriteBody( XclExpStream
& rStrm
) override
;
116 XclSelectionData maSelData
; /// Selection data.
117 sal_uInt8 mnPane
; /// Pane identifier of this selection.
120 class XclExpTabBgColor
: public XclExpRecord
123 explicit XclExpTabBgColor( const XclTabViewData
& rTabViewData
);
125 /* virtual void SaveXml( XclExpXmlStream& rStrm ); TODO Fix XML Saving Stream */
127 /** Writes the contents of the SHEETEXT record. */
128 virtual void WriteBody( XclExpStream
& rStrm
) override
;
131 const XclTabViewData
& mrTabViewData
; /// view settings data of current sheet.
134 // View settings ==============================================================
136 /** Contains all view settings records for a single sheet. */
137 class XclExpTabViewSettings
: public XclExpRecordBase
, protected XclExpRoot
140 /** Creates all records containing the view settings of the specified sheet. */
141 explicit XclExpTabViewSettings( const XclExpRoot
& rRoot
, SCTAB nScTab
);
143 /** Writes all view settings records to the stream. */
144 virtual void Save( XclExpStream
& rStrm
) override
;
145 virtual void SaveXml( XclExpXmlStream
& rStrm
) override
;
148 /** Creates selection data for the specified pane. */
149 void CreateSelectionData( sal_uInt8 nPane
,
150 const ScAddress
& rCursor
, const ScRangeList
& rSelection
);
152 void WriteWindow2( XclExpStream
& rStrm
) const;
153 void WriteScl( XclExpStream
& rStrm
) const;
154 void WritePane( XclExpStream
& rStrm
) const;
155 void WriteSelection( XclExpStream
& rStrm
, sal_uInt8 nPane
) const;
156 void WriteTabBgColor( XclExpStream
& rStrm
) const;
159 XclTabViewData maData
; /// All view settings for a sheet.
160 sal_uInt32 mnGridColorId
; /// Color identifier for grid color.
161 bool mbHasTabSettings
; /// It's false for embedded OLE spreadsheets.
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */