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