blob: 10cebdd4216444e514b5c7b199861d2141cd90dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <listenerquery.hxx>
#include <listenerqueryids.hxx>
#include <address.hxx>
namespace sc {
RefQueryFormulaGroup::RefQueryFormulaGroup() :
SvtListener::QueryBase(SC_LISTENER_QUERY_FORMULA_GROUP_POS),
maSkipRange(ScAddress::INITIALIZE_INVALID) {}
RefQueryFormulaGroup::~RefQueryFormulaGroup() {}
void RefQueryFormulaGroup::setSkipRange( const ScRange& rRange )
{
maSkipRange = rRange;
}
void RefQueryFormulaGroup::add( const ScAddress& rPos )
{
if (!rPos.IsValid())
return;
if (maSkipRange.IsValid() && maSkipRange.Contains(rPos))
// This is within the skip range. Skip it.
return;
TabsType::iterator itTab = maTabs.find(rPos.Tab());
if (itTab == maTabs.end())
{
std::pair<TabsType::iterator,bool> r =
maTabs.emplace(rPos.Tab(), ColsType());
if (!r.second)
// Insertion failed.
return;
itTab = r.first;
}
ColsType& rCols = itTab->second;
ColsType::iterator itCol = rCols.find(rPos.Col());
if (itCol == rCols.end())
{
std::pair<ColsType::iterator,bool> r =
rCols.emplace(rPos.Col(), ColType());
if (!r.second)
// Insertion failed.
return;
itCol = r.first;
}
ColType& rCol = itCol->second;
rCol.push_back(rPos.Row());
}
const RefQueryFormulaGroup::TabsType& RefQueryFormulaGroup::getAllPositions() const
{
return maTabs;
}
QueryRange::QueryRange() :
SvtListener::QueryBase(SC_LISTENER_QUERY_FORMULA_GROUP_RANGE)
{}
QueryRange::~QueryRange()
{
}
void QueryRange::add( const ScRange& rRange )
{
maRanges.Join(rRange);
}
void QueryRange::swapRanges( ScRangeList& rRanges )
{
maRanges.swap(rRanges);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|