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 INCLUDED_SC_SOURCE_FILTER_INC_XEVIEW_HXX
21 : #define INCLUDED_SC_SOURCE_FILTER_INC_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 144 : class XclExpWindow1 : public XclExpRecord
31 : {
32 : public:
33 : explicit XclExpWindow1( const XclExpRoot& rRoot );
34 :
35 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
36 :
37 : private:
38 : /** Writes the contents of the WINDOW1 record. */
39 : virtual void WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
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 29 : 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 ) SAL_OVERRIDE;
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 : /** Represents an SCL record for the zoom factor of the current view of a sheet. */
69 0 : class XclExpScl : public XclExpRecord
70 : {
71 : public:
72 : explicit XclExpScl( sal_uInt16 nZoom );
73 :
74 : private:
75 : /** Tries to shorten numerator and denominator by the passed value. */
76 : void Shorten( sal_uInt16 nFactor );
77 : /** Writes the contents of the SCL record. */
78 : virtual void WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
79 :
80 : private:
81 : sal_uInt16 mnNum; /// Numerator of the zoom factor.
82 : sal_uInt16 mnDenom; /// Denominator of the zoom factor.
83 : };
84 :
85 : /** Represents a PANE record containing settings for split/frozen windows. */
86 0 : class XclExpPane : public XclExpRecord
87 : {
88 : public:
89 : explicit XclExpPane( const XclTabViewData& rData );
90 :
91 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
92 :
93 : private:
94 : /** Writes the contents of the PANE record. */
95 : virtual void WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
96 :
97 : private:
98 : sal_uInt16 mnSplitX; /// Split X position, or frozen column.
99 : sal_uInt32 mnSplitY; /// Split Y position, or frozen row.
100 : XclAddress maSecondXclPos; /// First visible cell in additional panes.
101 : sal_uInt8 mnActivePane; /// Active pane (with cell cursor).
102 : bool mbFrozenPanes; /// true = "frozen" panes; false = "split" window.
103 : };
104 :
105 : /** Represents a SELECTION record with selection data for a pane. */
106 129 : class XclExpSelection : public XclExpRecord
107 : {
108 : public:
109 : explicit XclExpSelection( const XclTabViewData& rData, sal_uInt8 nPane );
110 :
111 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
112 : private:
113 : /** Writes the contents of the SELECTION record. */
114 : virtual void WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
115 :
116 : private:
117 : XclSelectionData maSelData; /// Selection data.
118 : sal_uInt8 mnPane; /// Pane identifier of this selection.
119 : };
120 :
121 2 : class XclExpTabBgColor : public XclExpRecord
122 : {
123 : public:
124 : explicit XclExpTabBgColor( const XclTabViewData& rTabViewData );
125 :
126 : /* virtual void SaveXml( XclExpXmlStream& rStrm ); TODO Fix XML Saving Stream */
127 : private:
128 : /** Writes the contents of the SHEETEXT record. */
129 : virtual void WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
130 :
131 : private:
132 : const XclTabViewData& mrTabViewData; /// view settings data of current sheet.
133 : };
134 :
135 : // View settings ==============================================================
136 :
137 : /** Contains all view settings records for a single sheet. */
138 258 : class XclExpTabViewSettings : public XclExpRecordBase, protected XclExpRoot
139 : {
140 : public:
141 : /** Creates all records containing the view settings of the specified sheet. */
142 : explicit XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nScTab );
143 :
144 : /** Writes all view settings records to the stream. */
145 : virtual void Save( XclExpStream& rStrm ) SAL_OVERRIDE;
146 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
147 :
148 : private:
149 : /** Creates selection data for the specified pane. */
150 : void CreateSelectionData( sal_uInt8 nPane,
151 : const ScAddress& rCursor, const ScRangeList& rSelection );
152 :
153 : void WriteWindow2( XclExpStream& rStrm ) const;
154 : void WriteScl( XclExpStream& rStrm ) const;
155 : void WritePane( XclExpStream& rStrm ) const;
156 : void WriteSelection( XclExpStream& rStrm, sal_uInt8 nPane ) const;
157 : void WriteTabBgColor( XclExpStream& rStrm ) const;
158 :
159 : private:
160 : XclTabViewData maData; /// All view settings for a sheet.
161 : sal_uInt32 mnGridColorId; /// Color identifier for grid color.
162 : };
163 :
164 : #endif
165 :
166 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|