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