1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <osl/diagnose.h>
24 ScRangeListTabs::ScRangeListTabs()
28 ScRangeListTabs::~ScRangeListTabs()
32 void ScRangeListTabs::Append( const ScAddress
& aSRD
, SCTAB nTab
)
45 if( nTab
== SCTAB_MAX
)
50 if (nTab
< 0 || MAXTAB
< nTab
)
53 TabRangeType::iterator itr
= m_TabRanges
.find(nTab
);
54 if (itr
== m_TabRanges
.end())
56 // No entry for this table yet. Insert a new one.
57 std::pair
<TabRangeType::iterator
, bool> r
=
58 m_TabRanges
.insert(std::make_pair(nTab
, std::make_unique
<RangeListType
>()));
66 itr
->second
->push_back(ScRange(a
.Col(),a
.Row(),a
.Tab()));
69 void ScRangeListTabs::Append( const ScRange
& aCRD
, SCTAB nTab
)
74 if (a
.aStart
.Tab() != a
.aEnd
.Tab())
77 if (a
.aStart
.Tab() > MAXTAB
)
78 a
.aStart
.SetTab(MAXTAB
);
79 else if (a
.aStart
.Tab() < 0)
82 if (a
.aStart
.Col() > MAXCOL
)
83 a
.aStart
.SetCol(MAXCOL
);
84 else if (a
.aStart
.Col() < 0)
87 if (a
.aStart
.Row() > MAXROW
)
88 a
.aStart
.SetRow(MAXROW
);
89 else if (a
.aStart
.Row() < 0)
92 if (a
.aEnd
.Col() > MAXCOL
)
93 a
.aEnd
.SetCol(MAXCOL
);
94 else if (a
.aEnd
.Col() < 0)
97 if (a
.aEnd
.Row() > MAXROW
)
98 a
.aEnd
.SetRow(MAXROW
);
99 else if (a
.aEnd
.Row() < 0)
102 if( nTab
== SCTAB_MAX
)
106 nTab
= a
.aStart
.Tab();
108 if (nTab
< 0 || MAXTAB
< nTab
)
111 TabRangeType::iterator itr
= m_TabRanges
.find(nTab
);
112 if (itr
== m_TabRanges
.end())
114 // No entry for this table yet. Insert a new one.
115 std::pair
<TabRangeType::iterator
, bool> r
=
116 m_TabRanges
.insert(std::make_pair(nTab
, std::make_unique
<RangeListType
>()));
124 itr
->second
->push_back(a
);
127 const ScRange
* ScRangeListTabs::First( SCTAB n
)
129 OSL_ENSURE( ValidTab(n
), "-ScRangeListTabs::First(): Good bye!" );
131 TabRangeType::iterator itr
= m_TabRanges
.find(n
);
132 if (itr
== m_TabRanges
.end())
133 // No range list exists for this table.
136 const RangeListType
& rList
= *itr
->second
;
137 maItrCur
= rList
.begin();
138 maItrCurEnd
= rList
.end();
139 return rList
.empty() ? nullptr : &(*maItrCur
);
142 const ScRange
* ScRangeListTabs::Next ()
145 if (maItrCur
== maItrCurEnd
)
151 ConverterBase::ConverterBase( svl::SharedStringPool
& rSPool
) :
157 ConverterBase::~ConverterBase()
161 void ConverterBase::Reset()
167 ExcelConverterBase::ExcelConverterBase( svl::SharedStringPool
& rSPool
) :
168 ConverterBase(rSPool
)
172 ExcelConverterBase::~ExcelConverterBase()
176 void ExcelConverterBase::Reset( const ScAddress
& rEingPos
)
178 ConverterBase::Reset();
182 void ExcelConverterBase::Reset()
184 ConverterBase::Reset();
185 aEingPos
.Set( 0, 0, 0 );
188 LotusConverterBase::LotusConverterBase( SvStream
&rStr
, svl::SharedStringPool
& rSPool
) :
189 ConverterBase(rSPool
),
195 LotusConverterBase::~LotusConverterBase()
199 void LotusConverterBase::Reset( const ScAddress
& rEingPos
)
201 ConverterBase::Reset();
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */