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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_scfilt.hxx"
26 #include "xlview.hxx"
27 #include "ftools.hxx"
28
29 // Structs ====================================================================
30
XclDocViewData()31 XclDocViewData::XclDocViewData() :
32 mnWinX( 0 ),
33 mnWinY( 0 ),
34 mnWinWidth( 0 ),
35 mnWinHeight( 0 ),
36 mnFlags( EXC_WIN1_HOR_SCROLLBAR | EXC_WIN1_VER_SCROLLBAR | EXC_WIN1_TABBAR ),
37 mnDisplXclTab( 0 ),
38 mnFirstVisXclTab( 0 ),
39 mnXclSelectCnt( 1 ),
40 mnTabBarWidth( 600 )
41 {
42 }
43
44 // ----------------------------------------------------------------------------
45
XclTabViewData()46 XclTabViewData::XclTabViewData() :
47 maFirstXclPos( ScAddress::UNINITIALIZED ),
48 maSecondXclPos( ScAddress::UNINITIALIZED )
49 {
50 SetDefaults();
51 }
52
~XclTabViewData()53 XclTabViewData::~XclTabViewData()
54 {
55 }
56
SetDefaults()57 void XclTabViewData::SetDefaults()
58 {
59 maSelMap.clear();
60 maGridColor.SetColor( COL_AUTO );
61 maFirstXclPos.Set( 0, 0 );
62 maSecondXclPos.Set( 0, 0 );
63 mnSplitX = mnSplitY = 0;
64 mnNormalZoom = EXC_WIN2_NORMALZOOM_DEF;
65 mnPageZoom = EXC_WIN2_PAGEZOOM_DEF;
66 mnCurrentZoom = 0; // default to mnNormalZoom or mnPageZoom
67 mnActivePane = EXC_PANE_TOPLEFT;
68 mbSelected = mbDisplayed = false;
69 mbMirrored = false;
70 mbFrozenPanes = false;
71 mbPageMode = false;
72 mbDefGridColor = true;
73 mbShowFormulas = false;
74 mbShowGrid = mbShowHeadings = mbShowZeros = mbShowOutline = true;
75 maTabBgColor.SetColor( COL_AUTO );
76 }
77
IsSplit() const78 bool XclTabViewData::IsSplit() const
79 {
80 return (mnSplitX > 0) || (mnSplitY > 0);
81 }
82
HasPane(sal_uInt8 nPaneId) const83 bool XclTabViewData::HasPane( sal_uInt8 nPaneId ) const
84 {
85 switch( nPaneId )
86 {
87 case EXC_PANE_BOTTOMRIGHT: return (mnSplitX > 0) && (mnSplitY > 0);
88 case EXC_PANE_TOPRIGHT: return mnSplitX > 0;
89 case EXC_PANE_BOTTOMLEFT: return mnSplitY > 0;
90 case EXC_PANE_TOPLEFT: return true;
91 }
92 DBG_ERRORFILE( "XclExpPane::HasPane - wrong pane ID" );
93 return false;
94 }
95
GetSelectionData(sal_uInt8 nPane) const96 const XclSelectionData* XclTabViewData::GetSelectionData( sal_uInt8 nPane ) const
97 {
98 XclSelectionMap::const_iterator aIt = maSelMap.find( nPane );
99 return (aIt == maSelMap.end()) ? 0 : aIt->second.get();
100 }
101
CreateSelectionData(sal_uInt8 nPane)102 XclSelectionData& XclTabViewData::CreateSelectionData( sal_uInt8 nPane )
103 {
104 XclSelectionDataRef& rxSelData = maSelMap[ nPane ];
105 if( !rxSelData )
106 rxSelData.reset( new XclSelectionData );
107 return *rxSelData;
108 }
109
110 // ============================================================================
111
112