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