Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "xlview.hxx"
30 : : #include "ftools.hxx"
31 : :
32 : : // Structs ====================================================================
33 : :
34 : 89 : XclDocViewData::XclDocViewData() :
35 : : mnWinX( 0 ),
36 : : mnWinY( 0 ),
37 : : mnWinWidth( 0 ),
38 : : mnWinHeight( 0 ),
39 : : mnFlags( EXC_WIN1_HOR_SCROLLBAR | EXC_WIN1_VER_SCROLLBAR | EXC_WIN1_TABBAR ),
40 : : mnDisplXclTab( 0 ),
41 : : mnFirstVisXclTab( 0 ),
42 : : mnXclSelectCnt( 1 ),
43 : 89 : mnTabBarWidth( 600 )
44 : : {
45 : 89 : }
46 : :
47 : : // ----------------------------------------------------------------------------
48 : :
49 : 89 : XclTabViewData::XclTabViewData() :
50 : : maFirstXclPos( ScAddress::UNINITIALIZED ),
51 : 89 : maSecondXclPos( ScAddress::UNINITIALIZED )
52 : : {
53 : 89 : SetDefaults();
54 : 89 : }
55 : :
56 : 89 : XclTabViewData::~XclTabViewData()
57 : : {
58 : 89 : }
59 : :
60 : 445 : void XclTabViewData::SetDefaults()
61 : : {
62 : 445 : maSelMap.clear();
63 : 445 : maGridColor.SetColor( COL_AUTO );
64 : 445 : maFirstXclPos.Set( 0, 0 );
65 : 445 : maSecondXclPos.Set( 0, 0 );
66 : 445 : mnSplitX = mnSplitY = 0;
67 : 445 : mnNormalZoom = EXC_WIN2_NORMALZOOM_DEF;
68 : 445 : mnPageZoom = EXC_WIN2_PAGEZOOM_DEF;
69 : 445 : mnCurrentZoom = 0; // default to mnNormalZoom or mnPageZoom
70 : 445 : mnActivePane = EXC_PANE_TOPLEFT;
71 : 445 : mbSelected = mbDisplayed = false;
72 : 445 : mbMirrored = false;
73 : 445 : mbFrozenPanes = false;
74 : 445 : mbPageMode = false;
75 : 445 : mbDefGridColor = true;
76 : 445 : mbShowFormulas = false;
77 : 445 : mbShowGrid = mbShowHeadings = mbShowZeros = mbShowOutline = true;
78 : 445 : maTabBgColor.SetColor( COL_AUTO );
79 : 445 : }
80 : :
81 : 0 : bool XclTabViewData::IsSplit() const
82 : : {
83 [ # # ][ # # ]: 0 : return (mnSplitX > 0) || (mnSplitY > 0);
84 : : }
85 : :
86 : 0 : bool XclTabViewData::HasPane( sal_uInt8 nPaneId ) const
87 : : {
88 [ # # # # : 0 : switch( nPaneId )
# ]
89 : : {
90 [ # # ][ # # ]: 0 : case EXC_PANE_BOTTOMRIGHT: return (mnSplitX > 0) && (mnSplitY > 0);
91 : 0 : case EXC_PANE_TOPRIGHT: return mnSplitX > 0;
92 : 0 : case EXC_PANE_BOTTOMLEFT: return mnSplitY > 0;
93 : 0 : case EXC_PANE_TOPLEFT: return true;
94 : : }
95 : : OSL_FAIL( "XclExpPane::HasPane - wrong pane ID" );
96 : 0 : return false;
97 : : }
98 : :
99 : 267 : const XclSelectionData* XclTabViewData::GetSelectionData( sal_uInt8 nPane ) const
100 : : {
101 [ + - ]: 267 : XclSelectionMap::const_iterator aIt = maSelMap.find( nPane );
102 [ + + ]: 267 : return (aIt == maSelMap.end()) ? 0 : aIt->second.get();
103 : : }
104 : :
105 : 267 : XclSelectionData& XclTabViewData::CreateSelectionData( sal_uInt8 nPane )
106 : : {
107 : 267 : XclSelectionDataRef& rxSelData = maSelMap[ nPane ];
108 [ + - ]: 267 : if( !rxSelData )
109 [ + - ]: 267 : rxSelData.reset( new XclSelectionData );
110 : 267 : return *rxSelData;
111 : : }
112 : :
113 : : // ============================================================================
114 : :
115 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|