Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / filter / inc / xlview.hxx
blob281edf900e46691ccce3783688cce074aa2fafc8
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_XLVIEW_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XLVIEW_HXX
23 #include <tools/color.hxx>
24 #include "xladdress.hxx"
25 #include <map>
26 #include <memory>
28 // Constants and enumerations =================================================
30 const sal_uInt16 EXC_ZOOM_MIN = 10;
31 const sal_uInt16 EXC_ZOOM_MAX = 400;
33 // (0x001D) SELECTION ---------------------------------------------------------
35 const sal_uInt16 EXC_ID_SELECTION = 0x001D;
37 // (0x003D) WINDOW1 -----------------------------------------------------------
39 const sal_uInt16 EXC_ID_WINDOW1 = 0x003D;
41 const sal_uInt16 EXC_WIN1_HIDDEN = 0x0001;
42 const sal_uInt16 EXC_WIN1_MINIMIZED = 0x0002;
43 const sal_uInt16 EXC_WIN1_HOR_SCROLLBAR = 0x0008;
44 const sal_uInt16 EXC_WIN1_VER_SCROLLBAR = 0x0010;
45 const sal_uInt16 EXC_WIN1_TABBAR = 0x0020;
47 // (0x003E, 0x023E) WINDOW2 ---------------------------------------------------
49 const sal_uInt16 EXC_ID2_WINDOW2 = 0x003E;
50 const sal_uInt16 EXC_ID_WINDOW2 = 0x023E;
52 const sal_uInt16 EXC_WIN2_SHOWFORMULAS = 0x0001;
53 const sal_uInt16 EXC_WIN2_SHOWGRID = 0x0002;
54 const sal_uInt16 EXC_WIN2_SHOWHEADINGS = 0x0004;
55 const sal_uInt16 EXC_WIN2_FROZEN = 0x0008;
56 const sal_uInt16 EXC_WIN2_SHOWZEROS = 0x0010;
57 const sal_uInt16 EXC_WIN2_DEFGRIDCOLOR = 0x0020;
58 const sal_uInt16 EXC_WIN2_MIRRORED = 0x0040;
59 const sal_uInt16 EXC_WIN2_SHOWOUTLINE = 0x0080;
60 const sal_uInt16 EXC_WIN2_FROZENNOSPLIT = 0x0100;
61 const sal_uInt16 EXC_WIN2_SELECTED = 0x0200;
62 const sal_uInt16 EXC_WIN2_DISPLAYED = 0x0400;
63 const sal_uInt16 EXC_WIN2_PAGEBREAKMODE = 0x0800;
65 const sal_uInt16 EXC_WIN2_NORMALZOOM_DEF = 100; /// Default zoom for normal view.
66 const sal_uInt16 EXC_WIN2_PAGEZOOM_DEF = 60; /// Default zoom for pagebreak preview.
68 // (0x0041) PANE --------------------------------------------------------------
70 const sal_uInt16 EXC_ID_PANE = 0x0041;
72 const sal_uInt8 EXC_PANE_BOTTOMRIGHT = 0; /// Bottom-right pane.
73 const sal_uInt8 EXC_PANE_TOPRIGHT = 1; /// Right, or top-right pane.
74 const sal_uInt8 EXC_PANE_BOTTOMLEFT = 2; /// Bottom, or bottom-left pane.
75 const sal_uInt8 EXC_PANE_TOPLEFT = 3; /// Single, top, left, or top-left pane.
77 // (0x00A0) SCL ---------------------------------------------------------------
79 const sal_uInt16 EXC_ID_SCL = 0x00A0;
81 // (0x0862) SHEETEXT ----------------------------------------------------------
83 const sal_uInt16 EXC_ID_SHEETEXT = 0x0862; /// header id for sheetext
84 const sal_uInt8 EXC_SHEETEXT_TABCOLOR = 0x7F; /// mask for tab color
85 const sal_uInt16 EXC_COLOR_NOTABBG = 0x7F; /// Excel ignores Tab color when set to this value...
86 // Structs ====================================================================
88 /** Contains all view settings for the entire document. */
89 struct XclDocViewData
91 sal_uInt16 mnWinX; /// X position of the document window (twips).
92 sal_uInt16 mnWinY; /// Y position of the document window (twips).
93 sal_uInt16 mnWinWidth; /// Width of the document window (twips).
94 sal_uInt16 mnWinHeight; /// Height of the document window (twips).
95 sal_uInt16 mnFlags; /// Additional flags.
96 sal_uInt16 mnDisplXclTab; /// Displayed (active) sheet.
97 sal_uInt16 mnFirstVisXclTab; /// First visible sheet.
98 sal_uInt16 mnXclSelectCnt; /// Number of selected sheets.
99 sal_uInt16 mnTabBarWidth; /// Width of sheet tabbar (1/1000 of window width).
101 explicit XclDocViewData();
104 /** Contains all settings for a selection in a single pane of a sheet. */
105 struct XclSelectionData
107 XclAddress maXclCursor; /// Cell cursor position.
108 XclRangeList maXclSelection; /// Selected cell ranges.
109 sal_uInt16 mnCursorIdx; /// Index of cursor in selection list.
111 explicit XclSelectionData() : mnCursorIdx( 0 ) {}
114 typedef std::shared_ptr< XclSelectionData > XclSelectionDataRef;
116 /** Contains all view settings for a single sheet. */
117 struct XclTabViewData
119 typedef ::std::map< sal_uInt8, XclSelectionDataRef > XclSelectionMap;
121 XclSelectionMap maSelMap; /// Selections of all panes.
122 Color maGridColor; /// Grid color.
123 XclAddress maFirstXclPos; /// First visible cell.
124 XclAddress maSecondXclPos; /// First visible cell in additional panes.
125 sal_uInt16 mnSplitX; /// Split X position, or number of frozen columns.
126 sal_uInt32 mnSplitY; /// Split Y position, or number of frozen rows.
127 sal_uInt16 mnNormalZoom; /// Zoom factor for normal view.
128 sal_uInt16 mnPageZoom; /// Zoom factor for pagebreak preview.
129 sal_uInt16 mnCurrentZoom; /// Zoom factor for current view.
130 sal_uInt8 mnActivePane; /// Active pane (with cell cursor).
131 bool mbSelected; /// true = Sheet is selected.
132 bool mbDisplayed; /// true = Sheet is displayed (active).
133 bool mbMirrored; /// true = Mirrored (right-to-left) sheet.
134 bool mbFrozenPanes; /// true = Frozen panes; false = split window.
135 bool mbPageMode; /// true = Pagebreak preview; false = Normal view.
136 bool mbDefGridColor; /// true = Default grid color.
137 bool mbShowFormulas; /// true = Show formulas instead of results.
138 bool mbShowGrid; /// true = Show cell grid.
139 bool mbShowHeadings; /// true = Show column/row headings.
140 bool mbShowZeros; /// true = Show zero value zells.
141 bool mbShowOutline; /// true = Show outlines.
142 Color maTabBgColor; /// Tab Color default = (COL_AUTO )
143 bool IsDefaultTabBgColor() const { return maTabBgColor == COL_AUTO; };
144 sal_uInt32 mnTabBgColorId; /// palette color id
146 explicit XclTabViewData();
147 ~XclTabViewData();
149 /** Sets Excel default view settings. */
150 void SetDefaults();
152 /** Returns true, if the window is split in any direction. */
153 bool IsSplit() const;
154 /** Returns true, if the specified pane (EXC_PANE_*) is available. */
155 bool HasPane( sal_uInt8 nPaneId ) const;
157 /** Returns the selection data, if available, otherwise 0. */
158 const XclSelectionData* GetSelectionData( sal_uInt8 nPane ) const;
159 /** Returns read/write access to the selection data of the specified pane. */
160 XclSelectionData& CreateSelectionData( sal_uInt8 nPane );
163 #endif
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */