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 144 : 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 144 : mnTabBarWidth( 600 )
35 : {
36 144 : }
37 :
38 268 : XclTabViewData::XclTabViewData() :
39 : maFirstXclPos( ScAddress::UNINITIALIZED ),
40 268 : maSecondXclPos( ScAddress::UNINITIALIZED )
41 : {
42 268 : SetDefaults();
43 268 : }
44 :
45 268 : XclTabViewData::~XclTabViewData()
46 : {
47 268 : }
48 :
49 828 : void XclTabViewData::SetDefaults()
50 : {
51 828 : maSelMap.clear();
52 828 : maGridColor.SetColor( COL_AUTO );
53 828 : maFirstXclPos.Set( 0, 0 );
54 828 : maSecondXclPos.Set( 0, 0 );
55 828 : mnSplitX = mnSplitY = 0;
56 828 : mnNormalZoom = EXC_WIN2_NORMALZOOM_DEF;
57 828 : mnPageZoom = EXC_WIN2_PAGEZOOM_DEF;
58 828 : mnCurrentZoom = 0; // default to mnNormalZoom or mnPageZoom
59 828 : mnActivePane = EXC_PANE_TOPLEFT;
60 828 : mbSelected = mbDisplayed = false;
61 828 : mbMirrored = false;
62 828 : mbFrozenPanes = false;
63 828 : mbPageMode = false;
64 828 : mbDefGridColor = true;
65 828 : mbShowFormulas = false;
66 828 : mbShowGrid = mbShowHeadings = mbShowZeros = mbShowOutline = true;
67 828 : maTabBgColor.SetColor( COL_AUTO );
68 828 : mnTabBgColorId = 0;
69 828 : }
70 :
71 124 : bool XclTabViewData::IsSplit() const
72 : {
73 124 : return (mnSplitX > 0) || (mnSplitY > 0);
74 : }
75 :
76 664 : bool XclTabViewData::HasPane( sal_uInt8 nPaneId ) const
77 : {
78 664 : switch( nPaneId )
79 : {
80 166 : case EXC_PANE_BOTTOMRIGHT: return (mnSplitX > 0) && (mnSplitY > 0);
81 166 : case EXC_PANE_TOPRIGHT: return mnSplitX > 0;
82 166 : case EXC_PANE_BOTTOMLEFT: return mnSplitY > 0;
83 166 : case EXC_PANE_TOPLEFT: return true;
84 : }
85 : OSL_FAIL( "XclExpPane::HasPane - wrong pane ID" );
86 0 : return false;
87 : }
88 :
89 540 : const XclSelectionData* XclTabViewData::GetSelectionData( sal_uInt8 nPane ) const
90 : {
91 540 : XclSelectionMap::const_iterator aIt = maSelMap.find( nPane );
92 540 : return (aIt == maSelMap.end()) ? 0 : aIt->second.get();
93 : }
94 :
95 486 : XclSelectionData& XclTabViewData::CreateSelectionData( sal_uInt8 nPane )
96 : {
97 486 : XclSelectionDataRef& rxSelData = maSelMap[ nPane ];
98 486 : if( !rxSelData )
99 482 : rxSelData.reset( new XclSelectionData );
100 486 : return *rxSelData;
101 : }
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|