use insert function instead of for loop
[LibreOffice.git] / sc / source / filter / excel / xlview.cxx
blobb5768e2df13640968dff8c822594b3118cfba397
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <xlview.hxx>
21 #include <osl/diagnose.h>
23 // Structs ====================================================================
25 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 mnTabBarWidth( 600 )
38 XclTabViewData::XclTabViewData() :
39 maFirstXclPos( ScAddress::UNINITIALIZED ),
40 maSecondXclPos( ScAddress::UNINITIALIZED )
42 SetDefaults();
45 XclTabViewData::~XclTabViewData()
49 void XclTabViewData::SetDefaults()
51 maSelMap.clear();
52 maGridColor = COL_AUTO;
53 maFirstXclPos.Set( 0, 0 );
54 maSecondXclPos.Set( 0, 0 );
55 mnSplitX = mnSplitY = 0;
56 mnNormalZoom = EXC_WIN2_NORMALZOOM_DEF;
57 mnPageZoom = EXC_WIN2_PAGEZOOM_DEF;
58 mnCurrentZoom = 0; // default to mnNormalZoom or mnPageZoom
59 mnActivePane = EXC_PANE_TOPLEFT;
60 mbSelected = mbDisplayed = false;
61 mbMirrored = false;
62 mbFrozenPanes = false;
63 mbPageMode = false;
64 mbDefGridColor = true;
65 mbShowFormulas = false;
66 mbShowGrid = mbShowHeadings = mbShowZeros = mbShowOutline = true;
67 maTabBgColor = COL_AUTO;
68 mnTabBgColorId = 0;
71 bool XclTabViewData::IsSplit() const
73 return (mnSplitX > 0) || (mnSplitY > 0);
76 bool XclTabViewData::HasPane( sal_uInt8 nPaneId ) const
78 switch( nPaneId )
80 case EXC_PANE_BOTTOMRIGHT: return (mnSplitX > 0) && (mnSplitY > 0);
81 case EXC_PANE_TOPRIGHT: return mnSplitX > 0;
82 case EXC_PANE_BOTTOMLEFT: return mnSplitY > 0;
83 case EXC_PANE_TOPLEFT: return true;
85 OSL_FAIL( "XclExpPane::HasPane - wrong pane ID" );
86 return false;
89 const XclSelectionData* XclTabViewData::GetSelectionData( sal_uInt8 nPane ) const
91 XclSelectionMap::const_iterator aIt = maSelMap.find( nPane );
92 return (aIt == maSelMap.end()) ? nullptr : aIt->second.get();
95 XclSelectionData& XclTabViewData::CreateSelectionData( sal_uInt8 nPane )
97 XclSelectionDataRef& rxSelData = maSelMap[ nPane ];
98 if( !rxSelData )
99 rxSelData = std::make_shared<XclSelectionData>();
100 return *rxSelData;
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */