Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_XLVIEW_HXX
30 : : #define SC_XLVIEW_HXX
31 : :
32 : : #include <map>
33 : : #include <tools/color.hxx>
34 : : #include "ftools.hxx"
35 : : #include "xladdress.hxx"
36 : : #include <boost/shared_ptr.hpp>
37 : :
38 : : // Constants and enumerations =================================================
39 : :
40 : : const sal_uInt16 EXC_ZOOM_MIN = 10;
41 : : const sal_uInt16 EXC_ZOOM_MAX = 400;
42 : :
43 : : // (0x001D) SELECTION ---------------------------------------------------------
44 : :
45 : : const sal_uInt16 EXC_ID_SELECTION = 0x001D;
46 : :
47 : : // (0x003D) WINDOW1 -----------------------------------------------------------
48 : :
49 : : const sal_uInt16 EXC_ID_WINDOW1 = 0x003D;
50 : :
51 : : const sal_uInt16 EXC_WIN1_HIDDEN = 0x0001;
52 : : const sal_uInt16 EXC_WIN1_MINIMIZED = 0x0002;
53 : : const sal_uInt16 EXC_WIN1_HOR_SCROLLBAR = 0x0008;
54 : : const sal_uInt16 EXC_WIN1_VER_SCROLLBAR = 0x0010;
55 : : const sal_uInt16 EXC_WIN1_TABBAR = 0x0020;
56 : :
57 : : // (0x003E, 0x023E) WINDOW2 ---------------------------------------------------
58 : :
59 : : const sal_uInt16 EXC_ID2_WINDOW2 = 0x003E;
60 : : const sal_uInt16 EXC_ID_WINDOW2 = 0x023E;
61 : :
62 : : const sal_uInt16 EXC_WIN2_SHOWFORMULAS = 0x0001;
63 : : const sal_uInt16 EXC_WIN2_SHOWGRID = 0x0002;
64 : : const sal_uInt16 EXC_WIN2_SHOWHEADINGS = 0x0004;
65 : : const sal_uInt16 EXC_WIN2_FROZEN = 0x0008;
66 : : const sal_uInt16 EXC_WIN2_SHOWZEROS = 0x0010;
67 : : const sal_uInt16 EXC_WIN2_DEFGRIDCOLOR = 0x0020;
68 : : const sal_uInt16 EXC_WIN2_MIRRORED = 0x0040;
69 : : const sal_uInt16 EXC_WIN2_SHOWOUTLINE = 0x0080;
70 : : const sal_uInt16 EXC_WIN2_FROZENNOSPLIT = 0x0100;
71 : : const sal_uInt16 EXC_WIN2_SELECTED = 0x0200;
72 : : const sal_uInt16 EXC_WIN2_DISPLAYED = 0x0400;
73 : : const sal_uInt16 EXC_WIN2_PAGEBREAKMODE = 0x0800;
74 : :
75 : : const sal_uInt16 EXC_WIN2_NORMALZOOM_DEF = 100; /// Default zoom for normal view.
76 : : const sal_uInt16 EXC_WIN2_PAGEZOOM_DEF = 60; /// Default zoom for pagebreak preview.
77 : :
78 : : // (0x0041) PANE --------------------------------------------------------------
79 : :
80 : : const sal_uInt16 EXC_ID_PANE = 0x0041;
81 : :
82 : : const sal_uInt8 EXC_PANE_BOTTOMRIGHT = 0; /// Bottom-right pane.
83 : : const sal_uInt8 EXC_PANE_TOPRIGHT = 1; /// Right, or top-right pane.
84 : : const sal_uInt8 EXC_PANE_BOTTOMLEFT = 2; /// Bottom, or bottom-left pane.
85 : : const sal_uInt8 EXC_PANE_TOPLEFT = 3; /// Single, top, left, or top-left pane.
86 : :
87 : : // (0x00A0) SCL ---------------------------------------------------------------
88 : :
89 : : const sal_uInt16 EXC_ID_SCL = 0x00A0;
90 : :
91 : : // (0x0862) SHEETEXT ----------------------------------------------------------
92 : :
93 : : const sal_uInt16 EXC_ID_SHEETEXT = 0x0862; /// header id for sheetext
94 : : const sal_uInt8 EXC_SHEETEXT_TABCOLOR = 0x7F; /// mask for tab color
95 : : const sal_uInt16 EXC_COLOR_NOTABBG = 0x7F; /// Excel ignores Tab color when set to this value...
96 : : // Structs ====================================================================
97 : :
98 : : /** Contains all view settings for the entire document. */
99 : : struct XclDocViewData
100 : : {
101 : : sal_uInt16 mnWinX; /// X position of the document window (twips).
102 : : sal_uInt16 mnWinY; /// Y position of the document window (twips).
103 : : sal_uInt16 mnWinWidth; /// Width of the document window (twips).
104 : : sal_uInt16 mnWinHeight; /// Height of the document window (twips).
105 : : sal_uInt16 mnFlags; /// Additional flags.
106 : : sal_uInt16 mnDisplXclTab; /// Displayed (active) sheet.
107 : : sal_uInt16 mnFirstVisXclTab; /// First visible sheet.
108 : : sal_uInt16 mnXclSelectCnt; /// Number of selected sheets.
109 : : sal_uInt16 mnTabBarWidth; /// Width of sheet tabbar (1/1000 of window width).
110 : :
111 : : explicit XclDocViewData();
112 : : };
113 : :
114 : : // ----------------------------------------------------------------------------
115 : :
116 : : /** Contains all settings for a selection in a single pane of a sheet. */
117 : 165 : struct XclSelectionData
118 : : {
119 : : XclAddress maXclCursor; /// Cell cursor position.
120 : : XclRangeList maXclSelection; /// Selected cell ranges.
121 : : sal_uInt16 mnCursorIdx; /// Index of cursor in selection list.
122 : :
123 : 165 : inline explicit XclSelectionData() : mnCursorIdx( 0 ) {}
124 : : };
125 : :
126 : : typedef boost::shared_ptr< XclSelectionData > XclSelectionDataRef;
127 : :
128 : : // ----------------------------------------------------------------------------
129 : :
130 : : /** Contains all view settings for a single sheet. */
131 : : struct XclTabViewData
132 : : {
133 : : typedef ::std::map< sal_uInt8, XclSelectionDataRef > XclSelectionMap;
134 : :
135 : : XclSelectionMap maSelMap; /// Selections of all panes.
136 : : Color maGridColor; /// Grid color.
137 : : XclAddress maFirstXclPos; /// First visible cell.
138 : : XclAddress maSecondXclPos; /// First visible cell in additional panes.
139 : : sal_uInt16 mnSplitX; /// Split X position, or number of frozen columns.
140 : : sal_uInt32 mnSplitY; /// Split Y position, or number of frozen rows.
141 : : sal_uInt16 mnNormalZoom; /// Zoom factor for normal view.
142 : : sal_uInt16 mnPageZoom; /// Zoom factor for pagebreak preview.
143 : : sal_uInt16 mnCurrentZoom; /// Zoom factor for current view.
144 : : sal_uInt8 mnActivePane; /// Active pane (with cell cursor).
145 : : bool mbSelected; /// true = Sheet is selected.
146 : : bool mbDisplayed; /// true = Sheet is displayed (active).
147 : : bool mbMirrored; /// true = Mirrored (right-to-left) sheet.
148 : : bool mbFrozenPanes; /// true = Frozen panes; false = split window.
149 : : bool mbPageMode; /// true = Pagebreak preview; false = Normal view.
150 : : bool mbDefGridColor; /// true = Default grid color.
151 : : bool mbShowFormulas; /// true = Show formulas instead of results.
152 : : bool mbShowGrid; /// true = Show cell grid.
153 : : bool mbShowHeadings; /// true = Show column/row headings.
154 : : bool mbShowZeros; /// true = Show zero value zells.
155 : : bool mbShowOutline; /// true = Show outlines.
156 : : Color maTabBgColor; /// Tab Color default = (COL_AUTO )
157 : 165 : bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? sal_True : false; };
158 : : sal_uInt32 mnTabBgColorId; /// pallette color id
159 : :
160 : : explicit XclTabViewData();
161 : : ~XclTabViewData();
162 : :
163 : : /** Sets Excel default view settings. */
164 : : void SetDefaults();
165 : :
166 : : /** Returns true, if the window is split in any direction. */
167 : : bool IsSplit() const;
168 : : /** Returns true, if the specified pane (EXC_PANE_*) is available. */
169 : : bool HasPane( sal_uInt8 nPaneId ) const;
170 : :
171 : : /** Returns the selection data, if available, otherwise 0. */
172 : : const XclSelectionData* GetSelectionData( sal_uInt8 nPane ) const;
173 : : /** Returns read/write access to the selection data of the specified pane. */
174 : : XclSelectionData& CreateSelectionData( sal_uInt8 nPane );
175 : : };
176 : :
177 : : // ============================================================================
178 : :
179 : : #endif
180 : :
181 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|