fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / excel / frmbase.cxx
blob08b0b4e168470be95613e5d7b86055a44d4c1364
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 "formel.hxx"
22 _ScRangeListTabs::_ScRangeListTabs()
26 _ScRangeListTabs::~_ScRangeListTabs()
30 void _ScRangeListTabs::Append( const ScAddress& aSRD, SCTAB nTab, const bool b )
32 ScAddress a = aSRD;
34 if( b )
36 if (a.Tab() > MAXTAB)
37 a.SetTab(MAXTAB);
39 if (a.Col() > MAXCOL)
40 a.SetCol(MAXCOL);
42 if (a.Row() > MAXROW)
43 a.SetRow(MAXROW);
45 else
47 OSL_ENSURE( ValidTab(a.Tab()), "-_ScRangeListTabs::Append(): A lie has no crash!" );
50 if( nTab == SCTAB_MAX)
51 return;
52 if( nTab < 0)
53 nTab = a.Tab();
55 if (nTab < 0 || MAXTAB < nTab)
56 return;
58 TabRangeType::iterator itr = maTabRanges.find(nTab);
59 if (itr == maTabRanges.end())
61 // No entry for this table yet. Insert a new one.
62 std::pair<TabRangeType::iterator, bool> r =
63 maTabRanges.insert(nTab, new RangeListType);
65 if (!r.second)
66 // Insertion failed.
67 return;
69 itr = r.first;
71 itr->second->push_back(ScRange(a.Col(),a.Row(),a.Tab()));
74 void _ScRangeListTabs::Append( const ScRange& aCRD, SCTAB nTab, bool b )
76 ScRange a = aCRD;
78 if( b )
80 // ignore 3D ranges
81 if (a.aStart.Tab() != a.aEnd.Tab())
82 return;
84 if (a.aStart.Tab() > MAXTAB)
85 a.aStart.SetTab(MAXTAB);
86 else if (a.aStart.Tab() < 0)
87 a.aStart.SetTab(0);
89 if (a.aStart.Col() > MAXCOL)
90 a.aStart.SetCol(MAXCOL);
91 else if (a.aStart.Col() < 0)
92 a.aStart.SetCol(0);
94 if (a.aStart.Row() > MAXROW)
95 a.aStart.SetRow(MAXROW);
96 else if (a.aStart.Row() < 0)
97 a.aStart.SetRow(0);
99 if (a.aEnd.Col() > MAXCOL)
100 a.aEnd.SetCol(MAXCOL);
101 else if (a.aEnd.Col() < 0)
102 a.aEnd.SetCol(0);
104 if (a.aEnd.Row() > MAXROW)
105 a.aEnd.SetRow(MAXROW);
106 else if (a.aEnd.Row() < 0)
107 a.aEnd.SetRow(0);
109 #if 0 // no members 'Ref1' or 'Ref2' in 'ScRange'
110 else
112 OSL_ENSURE( ValidTab(a.Ref1.nTab),
113 "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" );
114 OSL_ENSURE( a.Ref1.nTab == a.Ref2.nTab,
115 "+_ScRangeListTabs::Append(): 3D-Ranges werden in SC nicht unterstuetzt!" );
117 #endif
119 if( nTab == SCTAB_MAX)
120 return;
122 if( nTab < -1)
123 nTab = a.aStart.Tab();
125 if (nTab < 0 || MAXTAB < nTab)
126 return;
128 TabRangeType::iterator itr = maTabRanges.find(nTab);
129 if (itr == maTabRanges.end())
131 // No entry for this table yet. Insert a new one.
132 std::pair<TabRangeType::iterator, bool> r =
133 maTabRanges.insert(nTab, new RangeListType);
135 if (!r.second)
136 // Insertion failed.
137 return;
139 itr = r.first;
141 itr->second->push_back(a);
144 const ScRange* _ScRangeListTabs::First( SCTAB n )
146 OSL_ENSURE( ValidTab(n), "-_ScRangeListTabs::First(): Good bye!" );
148 TabRangeType::iterator itr = maTabRanges.find(n);
149 if (itr == maTabRanges.end())
150 // No range list exists for this table.
151 return NULL;
153 const RangeListType& rList = *itr->second;
154 maItrCur = rList.begin();
155 maItrCurEnd = rList.end();
156 return rList.empty() ? NULL : &(*maItrCur);
159 const ScRange* _ScRangeListTabs::Next ()
161 ++maItrCur;
162 if (maItrCur == maItrCurEnd)
163 return NULL;
165 return &(*maItrCur);
168 ConverterBase::ConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer ) :
169 aPool(rSPool),
170 aEingPos( 0, 0, 0 ),
171 eStatus( ConvOK ),
172 nBufferSize( nNewBuffer )
174 OSL_ENSURE( nNewBuffer > 0, "ConverterBase::ConverterBase - nNewBuffer == 0!" );
175 pBuffer = new sal_Char[ nNewBuffer ];
178 ConverterBase::~ConverterBase()
180 delete[] pBuffer;
183 void ConverterBase::Reset()
185 eStatus = ConvOK;
186 aPool.Reset();
187 aStack.Reset();
190 ExcelConverterBase::ExcelConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer ) :
191 ConverterBase(rSPool, nNewBuffer)
195 ExcelConverterBase::~ExcelConverterBase()
199 void ExcelConverterBase::Reset( const ScAddress& rEingPos )
201 ConverterBase::Reset();
202 aEingPos = rEingPos;
205 void ExcelConverterBase::Reset()
207 ConverterBase::Reset();
208 aEingPos.Set( 0, 0, 0 );
211 LotusConverterBase::LotusConverterBase( SvStream &rStr, svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffers ) :
212 ConverterBase(rSPool, nNewBuffers),
213 aIn( rStr ),
214 nBytesLeft( 0 )
218 LotusConverterBase::~LotusConverterBase()
222 void LotusConverterBase::Reset( const ScAddress& rEingPos )
224 ConverterBase::Reset();
225 nBytesLeft = 0;
226 aEingPos = rEingPos;
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */