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