LibreOffice Module sc (master)  1
xlview.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <xlview.hxx>
21 #include <osl/diagnose.h>
22 
23 // Structs ====================================================================
24 
26  mnWinX( 0 ),
27  mnWinY( 0 ),
28  mnWinWidth( 0 ),
29  mnWinHeight( 0 ),
31  mnDisplXclTab( 0 ),
32  mnFirstVisXclTab( 0 ),
33  mnXclSelectCnt( 1 ),
34  mnTabBarWidth( 600 )
35 {
36 }
37 
39  maFirstXclPos( ScAddress::UNINITIALIZED ),
40  maSecondXclPos( ScAddress::UNINITIALIZED )
41 {
42  SetDefaults();
43 }
44 
46 {
47 }
48 
50 {
51  maSelMap.clear();
53  maFirstXclPos.Set( 0, 0 );
54  maSecondXclPos.Set( 0, 0 );
55  mnSplitX = mnSplitY = 0;
58  mnCurrentZoom = 0; // default to mnNormalZoom or mnPageZoom
60  mbSelected = mbDisplayed = false;
61  mbMirrored = false;
62  mbFrozenPanes = false;
63  mbPageMode = false;
64  mbDefGridColor = true;
65  mbShowFormulas = false;
68  mnTabBgColorId = 0;
69 }
70 
72 {
73  return (mnSplitX > 0) || (mnSplitY > 0);
74 }
75 
76 bool XclTabViewData::HasPane( sal_uInt8 nPaneId ) const
77 {
78  switch( nPaneId )
79  {
80  case EXC_PANE_BOTTOMRIGHT: return (mnSplitX > 0) && (mnSplitY > 0);
81  case EXC_PANE_TOPRIGHT: return mnSplitX > 0;
82  case EXC_PANE_BOTTOMLEFT: return mnSplitY > 0;
83  case EXC_PANE_TOPLEFT: return true;
84  }
85  OSL_FAIL( "XclExpPane::HasPane - wrong pane ID" );
86  return false;
87 }
88 
90 {
91  XclSelectionMap::const_iterator aIt = maSelMap.find( nPane );
92  return (aIt == maSelMap.end()) ? nullptr : aIt->second.get();
93 }
94 
96 {
97  XclSelectionDataRef& rxSelData = maSelMap[ nPane ];
98  if( !rxSelData )
99  rxSelData = std::make_shared<XclSelectionData>();
100  return *rxSelData;
101 }
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool mbPageMode
true = Frozen panes; false = split window.
Definition: xlview.hxx:135
XclAddress maFirstXclPos
Grid color.
Definition: xlview.hxx:123
XclDocViewData()
Width of sheet tabbar (1/1000 of window width).
Definition: xlview.cxx:25
sal_uInt32 mnSplitY
Split X position, or number of frozen columns.
Definition: xlview.hxx:126
const sal_uInt8 EXC_PANE_TOPRIGHT
Bottom-right pane.
Definition: xlview.hxx:73
bool IsSplit() const
Returns true, if the window is split in any direction.
Definition: xlview.cxx:71
bool mbShowOutline
true = Show zero value zells.
Definition: xlview.hxx:141
sal_uInt32 mnTabBgColorId
Definition: xlview.hxx:143
bool mbFrozenPanes
true = Mirrored (right-to-left) sheet.
Definition: xlview.hxx:134
FuncFlags mnFlags
Information about all parameters.
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
const sal_uInt16 EXC_WIN2_PAGEZOOM_DEF
Default zoom for normal view.
Definition: xlview.hxx:66
bool mbSelected
Active pane (with cell cursor).
Definition: xlview.hxx:131
const sal_uInt8 EXC_PANE_BOTTOMRIGHT
Definition: xlview.hxx:72
XclSelectionData & CreateSelectionData(sal_uInt8 nPane)
Returns read/write access to the selection data of the specified pane.
Definition: xlview.cxx:95
Contains all settings for a selection in a single pane of a sheet.
Definition: xlview.hxx:105
std::shared_ptr< XclSelectionData > XclSelectionDataRef
Definition: xlview.hxx:114
bool mbDefGridColor
true = Pagebreak preview; false = Normal view.
Definition: xlview.hxx:136
bool mbShowFormulas
true = Default grid color.
Definition: xlview.hxx:137
const sal_uInt16 EXC_WIN2_NORMALZOOM_DEF
Definition: xlview.hxx:65
const sal_uInt16 EXC_WIN1_TABBAR
Definition: xlview.hxx:45
Color maGridColor
Selections of all panes.
Definition: xlview.hxx:122
void SetDefaults()
Sets Excel default view settings.
Definition: xlview.cxx:49
const sal_uInt16 EXC_WIN1_VER_SCROLLBAR
Definition: xlview.hxx:44
XclTabViewData()
palette color id
Definition: xlview.cxx:38
bool mbShowGrid
true = Show formulas instead of results.
Definition: xlview.hxx:138
Color maTabBgColor
true = Show outlines.
Definition: xlview.hxx:142
void Set(sal_uInt16 nCol, sal_uInt32 nRow)
Definition: xladdress.hxx:39
bool mbDisplayed
true = Sheet is selected.
Definition: xlview.hxx:132
bool HasPane(sal_uInt8 nPaneId) const
Returns true, if the specified pane (EXC_PANE_*) is available.
Definition: xlview.cxx:76
sal_uInt16 mnPageZoom
Zoom factor for normal view.
Definition: xlview.hxx:128
const sal_uInt16 EXC_WIN1_HOR_SCROLLBAR
Definition: xlview.hxx:43
bool mbShowHeadings
true = Show cell grid.
Definition: xlview.hxx:139
const sal_uInt8 EXC_PANE_BOTTOMLEFT
Right, or top-right pane.
Definition: xlview.hxx:74
unsigned char sal_uInt8
const sal_uInt8 EXC_PANE_TOPLEFT
Bottom, or bottom-left pane.
Definition: xlview.hxx:75
sal_uInt8 mnActivePane
Zoom factor for current view.
Definition: xlview.hxx:130
sal_uInt16 mnSplitX
First visible cell in additional panes.
Definition: xlview.hxx:125
bool mbShowZeros
true = Show column/row headings.
Definition: xlview.hxx:140
const XclSelectionData * GetSelectionData(sal_uInt8 nPane) const
Returns the selection data, if available, otherwise 0.
Definition: xlview.cxx:89
sal_uInt16 mnCurrentZoom
Zoom factor for pagebreak preview.
Definition: xlview.hxx:129
sal_uInt16 mnNormalZoom
Split Y position, or number of frozen rows.
Definition: xlview.hxx:127
XclAddress maSecondXclPos
First visible cell.
Definition: xlview.hxx:124
XclSelectionMap maSelMap
Definition: xlview.hxx:121
bool mbMirrored
true = Sheet is displayed (active).
Definition: xlview.hxx:133