Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / filter / inc / xeview.hxx
blob8d320177d8d057313a6d6ea9e0c23e0de134d766
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XEVIEW_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XEVIEW_HXX
23 #include "xerecord.hxx"
24 #include "xlview.hxx"
25 #include "xeroot.hxx"
27 // Workbook view settings records =============================================
29 /** Represents the WINDOW1 record containing global workbook view settings. */
30 class XclExpWindow1 : public XclExpRecord
32 public:
33 explicit XclExpWindow1( const XclExpRoot& rRoot );
35 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
37 private:
38 /** Writes the contents of the WINDOW1 record. */
39 virtual void WriteBody( XclExpStream& rStrm ) override;
41 private:
42 sal_uInt16 mnFlags; /// Option flags.
43 sal_uInt16 mnTabBarSize; /// Size of tabbar relative to window width (per mill).
46 // Sheet view settings records ================================================
48 /** Represents a WINDOW2 record with general view settings for a sheet. */
49 class XclExpWindow2 : public XclExpRecord
51 public:
52 explicit XclExpWindow2( const XclExpRoot& rRoot,
53 const XclTabViewData& rData, sal_uInt32 nGridColorId );
55 private:
56 /** Writes the contents of the WINDOW2 record. */
57 virtual void WriteBody( XclExpStream& rStrm ) override;
59 private:
60 Color const maGridColor; /// Grid color (<=BIFF5).
61 sal_uInt32 mnGridColorId; /// Color ID of grid color (>=BIFF8).
62 sal_uInt16 mnFlags; /// Option flags.
63 XclAddress const maFirstXclPos; /// First visible cell.
64 sal_uInt16 mnNormalZoom; /// Zoom factor for normal view.
65 sal_uInt16 mnPageZoom; /// Zoom factor for pagebreak preview.
68 /** Represents an SCL record for the zoom factor of the current view of a sheet. */
69 class XclExpScl : public XclExpRecord
71 public:
72 explicit XclExpScl( sal_uInt16 nZoom );
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 ) override;
80 private:
81 sal_uInt16 mnNum; /// Numerator of the zoom factor.
82 sal_uInt16 mnDenom; /// Denominator of the zoom factor.
85 /** Represents a PANE record containing settings for split/frozen windows. */
86 class XclExpPane : public XclExpRecord
88 public:
89 explicit XclExpPane( const XclTabViewData& rData );
91 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
93 private:
94 /** Writes the contents of the PANE record. */
95 virtual void WriteBody( XclExpStream& rStrm ) override;
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 const mnActivePane; /// Active pane (with cell cursor).
102 bool const mbFrozenPanes; /// true = "frozen" panes; false = "split" window.
105 /** Represents a SELECTION record with selection data for a pane. */
106 class XclExpSelection : public XclExpRecord
108 public:
109 explicit XclExpSelection( const XclTabViewData& rData, sal_uInt8 nPane );
111 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
112 private:
113 /** Writes the contents of the SELECTION record. */
114 virtual void WriteBody( XclExpStream& rStrm ) override;
116 private:
117 XclSelectionData maSelData; /// Selection data.
118 sal_uInt8 mnPane; /// Pane identifier of this selection.
121 class XclExpTabBgColor : public XclExpRecord
123 public:
124 explicit XclExpTabBgColor( const XclTabViewData& rTabViewData );
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 ) override;
131 private:
132 const XclTabViewData& mrTabViewData; /// view settings data of current sheet.
135 // View settings ==============================================================
137 /** Contains all view settings records for a single sheet. */
138 class XclExpTabViewSettings : public XclExpRecordBase, protected XclExpRoot
140 public:
141 /** Creates all records containing the view settings of the specified sheet. */
142 explicit XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nScTab );
144 /** Writes all view settings records to the stream. */
145 virtual void Save( XclExpStream& rStrm ) override;
146 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
148 private:
149 /** Creates selection data for the specified pane. */
150 void CreateSelectionData( sal_uInt8 nPane,
151 const ScAddress& rCursor, const ScRangeList& rSelection );
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;
159 private:
160 XclTabViewData maData; /// All view settings for a sheet.
161 sal_uInt32 mnGridColorId; /// Color identifier for grid color.
162 bool mbHasTabSettings; /// It's false for embedded OLE spreadsheets.
165 #endif
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */