Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef SC_XEVIEW_HXX
21 : #define SC_XEVIEW_HXX
22 :
23 : #include "xerecord.hxx"
24 : #include "xlview.hxx"
25 : #include "xeroot.hxx"
26 :
27 : // Workbook view settings records =============================================
28 :
29 : /** Represents the WINDOW1 record containing global workbook view settings. */
30 4 : class XclExpWindow1 : public XclExpRecord
31 : {
32 : public:
33 : explicit XclExpWindow1( const XclExpRoot& rRoot );
34 :
35 : virtual void SaveXml( XclExpXmlStream& rStrm );
36 :
37 : private:
38 : /** Writes the contents of the WINDOW1 record. */
39 : virtual void WriteBody( XclExpStream& rStrm );
40 :
41 : private:
42 : sal_uInt16 mnFlags; /// Option flags.
43 : sal_uInt16 mnTabBarSize; /// Size of tabbar relative to window width (per mill).
44 : };
45 :
46 : // Sheet view settings records ================================================
47 :
48 : /** Represents a WINDOW2 record with general view settings for a sheet. */
49 0 : class XclExpWindow2 : public XclExpRecord
50 : {
51 : public:
52 : explicit XclExpWindow2( const XclExpRoot& rRoot,
53 : const XclTabViewData& rData, sal_uInt32 nGridColorId );
54 :
55 : private:
56 : /** Writes the contents of the WINDOW2 record. */
57 : virtual void WriteBody( XclExpStream& rStrm );
58 :
59 : private:
60 : Color maGridColor; /// Grid color (<=BIFF5).
61 : sal_uInt32 mnGridColorId; /// Color ID of grid color (>=BIFF8).
62 : sal_uInt16 mnFlags; /// Option flags.
63 : XclAddress maFirstXclPos; /// First visible cell.
64 : sal_uInt16 mnNormalZoom; /// Zoom factor for normal view.
65 : sal_uInt16 mnPageZoom; /// Zoom factor for pagebreak preview.
66 : };
67 :
68 : // ----------------------------------------------------------------------------
69 :
70 : /** Represents an SCL record for the zoom factor of the current view of a sheet. */
71 0 : class XclExpScl : public XclExpRecord
72 : {
73 : public:
74 : explicit XclExpScl( sal_uInt16 nZoom );
75 :
76 : private:
77 : /** Tries to shorten numerator and denominator by the passed value. */
78 : void Shorten( sal_uInt16 nFactor );
79 : /** Writes the contents of the SCL record. */
80 : virtual void WriteBody( XclExpStream& rStrm );
81 :
82 : private:
83 : sal_uInt16 mnNum; /// Numerator of the zoom factor.
84 : sal_uInt16 mnDenom; /// Denominator of the zoom factor.
85 : };
86 :
87 : // ----------------------------------------------------------------------------
88 :
89 : /** Represents a PANE record containing settings for split/frozen windows. */
90 0 : class XclExpPane : public XclExpRecord
91 : {
92 : public:
93 : explicit XclExpPane( const XclTabViewData& rData );
94 :
95 : virtual void SaveXml( XclExpXmlStream& rStrm );
96 :
97 : private:
98 : /** Writes the contents of the PANE record. */
99 : virtual void WriteBody( XclExpStream& rStrm );
100 :
101 : private:
102 : sal_uInt16 mnSplitX; /// Split X position, or frozen column.
103 : sal_uInt32 mnSplitY; /// Split Y position, or frozen row.
104 : XclAddress maSecondXclPos; /// First visible cell in additional panes.
105 : sal_uInt8 mnActivePane; /// Active pane (with cell cursor).
106 : };
107 :
108 : // ----------------------------------------------------------------------------
109 :
110 : /** Represents a SELECTION record with selection data for a pane. */
111 2 : class XclExpSelection : public XclExpRecord
112 : {
113 : public:
114 : explicit XclExpSelection( const XclTabViewData& rData, sal_uInt8 nPane );
115 :
116 : virtual void SaveXml( XclExpXmlStream& rStrm );
117 : private:
118 : /** Writes the contents of the SELECTION record. */
119 : virtual void WriteBody( XclExpStream& rStrm );
120 :
121 : private:
122 : XclSelectionData maSelData; /// Selection data.
123 : sal_uInt8 mnPane; /// Pane identifier of this selection.
124 : };
125 :
126 0 : class XclExpTabBgColor : public XclExpRecord
127 : {
128 : public:
129 : explicit XclExpTabBgColor( const XclTabViewData& rTabViewData );
130 :
131 : /* virtual void SaveXml( XclExpXmlStream& rStrm ); TODO Fix XML Saving Stream */
132 : private:
133 : /** Writes the contents of the SHEETEXT record. */
134 : virtual void WriteBody( XclExpStream& rStrm );
135 :
136 : private:
137 : const XclTabViewData& mrTabViewData; /// view settings data of current sheet.
138 : };
139 :
140 : // View settings ==============================================================
141 :
142 : /** Contains all view settings records for a single sheet. */
143 4 : class XclExpTabViewSettings : public XclExpRecordBase, protected XclExpRoot
144 : {
145 : public:
146 : /** Creates all records containing the view settings of the specified sheet. */
147 : explicit XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nScTab );
148 :
149 : /** Writes all view settings records to the stream. */
150 : virtual void Save( XclExpStream& rStrm );
151 : virtual void SaveXml( XclExpXmlStream& rStrm );
152 :
153 : private:
154 : /** Creates selection data for the specified pane. */
155 : void CreateSelectionData( sal_uInt8 nPane,
156 : const ScAddress& rCursor, const ScRangeList& rSelection );
157 :
158 : void WriteWindow2( XclExpStream& rStrm ) const;
159 : void WriteScl( XclExpStream& rStrm ) const;
160 : void WritePane( XclExpStream& rStrm ) const;
161 : void WriteSelection( XclExpStream& rStrm, sal_uInt8 nPane ) const;
162 : void WriteTabBgColor( XclExpStream& rStrm ) const;
163 :
164 : private:
165 : XclTabViewData maData; /// All view settings for a sheet.
166 : sal_uInt32 mnGridColorId; /// Color identifier for grid color.
167 : };
168 :
169 : // ============================================================================
170 :
171 : #endif
172 :
173 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|