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( const XclImpRoot
& rRoot
)
29 ScRangeListTabs::~ScRangeListTabs()
33 void ScRangeListTabs::Append( const ScAddress
& aSRD
, SCTAB nTab
)
36 ScDocument
& rDoc
= GetRoot().GetDoc();
41 if (a
.Col() > rDoc
.MaxCol())
42 a
.SetCol(rDoc
.MaxCol());
44 if (a
.Row() > rDoc
.MaxRow())
45 a
.SetRow(rDoc
.MaxRow());
47 if( nTab
== SCTAB_MAX
)
52 if (nTab
< 0 || MAXTAB
< nTab
)
55 TabRangeType::iterator itr
= m_TabRanges
.find(nTab
);
56 if (itr
== m_TabRanges
.end())
58 // No entry for this table yet. Insert a new one.
59 std::pair
<TabRangeType::iterator
, bool> r
=
60 m_TabRanges
.insert(std::make_pair(nTab
, RangeListType()));
68 itr
->second
.push_back(ScRange(a
.Col(),a
.Row(),a
.Tab()));
71 void ScRangeListTabs::Append( const ScRange
& aCRD
, SCTAB nTab
)
74 ScDocument
& rDoc
= GetRoot().GetDoc();
77 if (a
.aStart
.Tab() != a
.aEnd
.Tab())
80 if (a
.aStart
.Tab() > MAXTAB
)
81 a
.aStart
.SetTab(MAXTAB
);
82 else if (a
.aStart
.Tab() < 0)
85 if (a
.aStart
.Col() > rDoc
.MaxCol())
86 a
.aStart
.SetCol(rDoc
.MaxCol());
87 else if (a
.aStart
.Col() < 0)
90 if (a
.aStart
.Row() > rDoc
.MaxRow())
91 a
.aStart
.SetRow(rDoc
.MaxRow());
92 else if (a
.aStart
.Row() < 0)
95 if (a
.aEnd
.Col() > rDoc
.MaxCol())
96 a
.aEnd
.SetCol(rDoc
.MaxCol());
97 else if (a
.aEnd
.Col() < 0)
100 if (a
.aEnd
.Row() > rDoc
.MaxRow())
101 a
.aEnd
.SetRow(rDoc
.MaxRow());
102 else if (a
.aEnd
.Row() < 0)
105 if( nTab
== SCTAB_MAX
)
109 nTab
= a
.aStart
.Tab();
111 if (nTab
< 0 || MAXTAB
< nTab
)
114 TabRangeType::iterator itr
= m_TabRanges
.find(nTab
);
115 if (itr
== m_TabRanges
.end())
117 // No entry for this table yet. Insert a new one.
118 std::pair
<TabRangeType::iterator
, bool> r
=
119 m_TabRanges
.insert(std::make_pair(nTab
, RangeListType()));
127 itr
->second
.push_back(a
);
130 const ScRange
* ScRangeListTabs::First( SCTAB n
)
132 OSL_ENSURE( ValidTab(n
), "-ScRangeListTabs::First(): Good bye!" );
134 TabRangeType::iterator itr
= m_TabRanges
.find(n
);
135 if (itr
== m_TabRanges
.end())
136 // No range list exists for this table.
139 const RangeListType
& rList
= itr
->second
;
140 maItrCur
= rList
.begin();
141 maItrCurEnd
= rList
.end();
142 return rList
.empty() ? nullptr : &(*maItrCur
);
145 const ScRange
* ScRangeListTabs::Next ()
148 if (maItrCur
== maItrCurEnd
)
154 ConverterBase::ConverterBase( svl::SharedStringPool
& rSPool
) :
160 ConverterBase::~ConverterBase()
164 void ConverterBase::Reset()
170 ExcelConverterBase::ExcelConverterBase( svl::SharedStringPool
& rSPool
) :
171 ConverterBase(rSPool
)
175 ExcelConverterBase::~ExcelConverterBase()
179 void ExcelConverterBase::Reset( const ScAddress
& rEingPos
)
181 ConverterBase::Reset();
185 void ExcelConverterBase::Reset()
187 ConverterBase::Reset();
188 aEingPos
.Set( 0, 0, 0 );
191 LotusConverterBase::LotusConverterBase( SvStream
&rStr
, svl::SharedStringPool
& rSPool
) :
192 ConverterBase(rSPool
),
198 LotusConverterBase::~LotusConverterBase()
202 void LotusConverterBase::Reset( const ScAddress
& rEingPos
)
204 ConverterBase::Reset();
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */