xref: /trunk/main/sc/source/filter/inc/xlview.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_XLVIEW_HXX
25 #define SC_XLVIEW_HXX
26 
27 #include <map>
28 #include <tools/color.hxx>
29 #include "ftools.hxx"
30 #include "xladdress.hxx"
31 
32 // Constants and enumerations =================================================
33 
34 const sal_uInt16 EXC_ZOOM_MIN               = 10;
35 const sal_uInt16 EXC_ZOOM_MAX               = 400;
36 
37 // (0x001D) SELECTION ---------------------------------------------------------
38 
39 const sal_uInt16 EXC_ID_SELECTION           = 0x001D;
40 
41 // (0x003D) WINDOW1 -----------------------------------------------------------
42 
43 const sal_uInt16 EXC_ID_WINDOW1             = 0x003D;
44 
45 const sal_uInt16 EXC_WIN1_HIDDEN            = 0x0001;
46 const sal_uInt16 EXC_WIN1_MINIMIZED         = 0x0002;
47 const sal_uInt16 EXC_WIN1_HOR_SCROLLBAR     = 0x0008;
48 const sal_uInt16 EXC_WIN1_VER_SCROLLBAR     = 0x0010;
49 const sal_uInt16 EXC_WIN1_TABBAR            = 0x0020;
50 
51 // (0x003E, 0x023E) WINDOW2 ---------------------------------------------------
52 
53 const sal_uInt16 EXC_ID2_WINDOW2            = 0x003E;
54 const sal_uInt16 EXC_ID_WINDOW2             = 0x023E;
55 
56 const sal_uInt16 EXC_WIN2_SHOWFORMULAS      = 0x0001;
57 const sal_uInt16 EXC_WIN2_SHOWGRID          = 0x0002;
58 const sal_uInt16 EXC_WIN2_SHOWHEADINGS      = 0x0004;
59 const sal_uInt16 EXC_WIN2_FROZEN            = 0x0008;
60 const sal_uInt16 EXC_WIN2_SHOWZEROS         = 0x0010;
61 const sal_uInt16 EXC_WIN2_DEFGRIDCOLOR      = 0x0020;
62 const sal_uInt16 EXC_WIN2_MIRRORED          = 0x0040;
63 const sal_uInt16 EXC_WIN2_SHOWOUTLINE       = 0x0080;
64 const sal_uInt16 EXC_WIN2_FROZENNOSPLIT     = 0x0100;
65 const sal_uInt16 EXC_WIN2_SELECTED          = 0x0200;
66 const sal_uInt16 EXC_WIN2_DISPLAYED         = 0x0400;
67 const sal_uInt16 EXC_WIN2_PAGEBREAKMODE     = 0x0800;
68 
69 const sal_uInt16 EXC_WIN2_NORMALZOOM_DEF    = 100;      /// Default zoom for normal view.
70 const sal_uInt16 EXC_WIN2_PAGEZOOM_DEF      = 60;       /// Default zoom for pagebreak preview.
71 
72 // (0x0041) PANE --------------------------------------------------------------
73 
74 const sal_uInt16 EXC_ID_PANE                = 0x0041;
75 
76 const sal_uInt8 EXC_PANE_BOTTOMRIGHT        = 0;        /// Bottom-right pane.
77 const sal_uInt8 EXC_PANE_TOPRIGHT           = 1;        /// Right, or top-right pane.
78 const sal_uInt8 EXC_PANE_BOTTOMLEFT         = 2;        /// Bottom, or bottom-left pane.
79 const sal_uInt8 EXC_PANE_TOPLEFT            = 3;        /// Single, top, left, or top-left pane.
80 
81 // (0x00A0) SCL ---------------------------------------------------------------
82 
83 const sal_uInt16 EXC_ID_SCL                 = 0x00A0;
84 
85 // (0x0862) SHEETEXT ----------------------------------------------------------
86 
87 const sal_uInt16 EXC_ID_SHEETEXT            = 0x0862; 	/// header id for sheetext
88 const sal_uInt8 EXC_SHEETEXT_TABCOLOR       = 0x7F; 	/// mask for tab color
89 const sal_uInt16 EXC_COLOR_NOTABBG          = 0x7F;     /// Excel ignores Tab color when set to this value...
90 // Structs ====================================================================
91 
92 /** Contains all view settings for the entire document. */
93 struct XclDocViewData
94 {
95     sal_uInt16          mnWinX;             /// X position of the document window (twips).
96     sal_uInt16          mnWinY;             /// Y position of the document window (twips).
97     sal_uInt16          mnWinWidth;         /// Width of the document window (twips).
98     sal_uInt16          mnWinHeight;        /// Height of the document window (twips).
99     sal_uInt16          mnFlags;            /// Additional flags.
100     sal_uInt16          mnDisplXclTab;      /// Displayed (active) sheet.
101     sal_uInt16          mnFirstVisXclTab;   /// First visible sheet.
102     sal_uInt16          mnXclSelectCnt;     /// Number of selected sheets.
103     sal_uInt16          mnTabBarWidth;      /// Width of sheet tabbar (1/1000 of window width).
104 
105     explicit            XclDocViewData();
106 };
107 
108 // ----------------------------------------------------------------------------
109 
110 /** Contains all settings for a selection in a single pane of a sheet. */
111 struct XclSelectionData
112 {
113     XclAddress          maXclCursor;        /// Cell cursor position.
114     XclRangeList        maXclSelection;     /// Selected cell ranges.
115     sal_uInt16          mnCursorIdx;        /// Index of cursor in selection list.
116 
XclSelectionDataXclSelectionData117     inline explicit     XclSelectionData() : mnCursorIdx( 0 ) {}
118 };
119 
120 typedef ScfRef< XclSelectionData > XclSelectionDataRef;
121 
122 // ----------------------------------------------------------------------------
123 
124 /** Contains all view settings for a single sheet. */
125 struct XclTabViewData
126 {
127     typedef ::std::map< sal_uInt8, XclSelectionDataRef > XclSelectionMap;
128 
129     XclSelectionMap     maSelMap;           /// Selections of all panes.
130     Color               maGridColor;        /// Grid color.
131     XclAddress          maFirstXclPos;      /// First visible cell.
132     XclAddress          maSecondXclPos;     /// First visible cell in additional panes.
133     sal_uInt16          mnSplitX;           /// Split X position, or number of frozen columns.
134     sal_uInt16          mnSplitY;           /// Split Y position, or number of frozen rows.
135     sal_uInt16          mnNormalZoom;       /// Zoom factor for normal view.
136     sal_uInt16          mnPageZoom;         /// Zoom factor for pagebreak preview.
137     sal_uInt16          mnCurrentZoom;      /// Zoom factor for current view.
138     sal_uInt8           mnActivePane;       /// Active pane (with cell cursor).
139     bool                mbSelected;         /// true = Sheet is selected.
140     bool                mbDisplayed;        /// true = Sheet is displayed (active).
141     bool                mbMirrored;         /// true = Mirrored (right-to-left) sheet.
142     bool                mbFrozenPanes;      /// true = Frozen panes; false = split window.
143     bool                mbPageMode;         /// true = Pagebreak preview; false = Normal view.
144     bool                mbDefGridColor;     /// true = Default grid color.
145     bool                mbShowFormulas;     /// true = Show formulas instead of results.
146     bool                mbShowGrid;         /// true = Show cell grid.
147     bool                mbShowHeadings;     /// true = Show column/row headings.
148     bool                mbShowZeros;        /// true = Show zero value zells.
149     bool                mbShowOutline;      /// true = Show outlines.
150     Color               maTabBgColor;       /// Tab Color default = (COL_AUTO )
IsDefaultTabBgColorXclTabViewData151     bool                IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? sal_True : sal_False; };
152     sal_uInt32          mnTabBgColorId;         /// pallette color id
153 
154     explicit            XclTabViewData();
155                         ~XclTabViewData();
156 
157     /** Sets Excel default view settings. */
158     void                SetDefaults();
159 
160     /** Returns true, if the window is split in any direction. */
161     bool                IsSplit() const;
162     /** Returns true, if the specified pane (EXC_PANE_*) is available. */
163     bool                HasPane( sal_uInt8 nPaneId ) const;
164 
165     /** Returns the selection data, if available, otherwise 0. */
166     const XclSelectionData* GetSelectionData( sal_uInt8 nPane ) const;
167     /** Returns read/write access to the selection data of the specified pane. */
168     XclSelectionData&   CreateSelectionData( sal_uInt8 nPane );
169 };
170 
171 // ============================================================================
172 
173 #endif
174 
175