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