LibreOffice Module sc (master) 1
listenerquery.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10#include <listenerquery.hxx>
11#include <listenerqueryids.hxx>
12#include <address.hxx>
13
14namespace sc {
15
18 maSkipRange(ScAddress::INITIALIZE_INVALID) {}
19
21
23{
24 maSkipRange = rRange;
25}
26
28{
29 if (!rPos.IsValid())
30 return;
31
33 // This is within the skip range. Skip it.
34 return;
35
36 TabsType::iterator itTab = maTabs.find(rPos.Tab());
37 if (itTab == maTabs.end())
38 {
39 std::pair<TabsType::iterator,bool> r =
40 maTabs.emplace(rPos.Tab(), ColsType());
41 if (!r.second)
42 // Insertion failed.
43 return;
44
45 itTab = r.first;
46 }
47
48 ColsType& rCols = itTab->second;
49 ColsType::iterator itCol = rCols.find(rPos.Col());
50 if (itCol == rCols.end())
51 {
52 std::pair<ColsType::iterator,bool> r =
53 rCols.emplace(rPos.Col(), ColType());
54 if (!r.second)
55 // Insertion failed.
56 return;
57
58 itCol = r.first;
59 }
60
61 ColType& rCol = itCol->second;
62 rCol.push_back(rPos.Row());
63}
64
66{
67 return maTabs;
68}
69
72{}
73
75{
76}
77
78void QueryRange::add( const ScRange& rRange )
79{
80 maRanges.Join(rRange);
81}
82
84{
85 maRanges.swap(rRanges);
86}
87
88}
89
90/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCTAB Tab() const
Definition: address.hxx:283
bool IsValid() const
Definition: address.hxx:305
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
void swap(ScRangeList &r)
Definition: rangelst.cxx:1144
void Join(const ScRange &, bool bIsInList=false)
Definition: rangelst.cxx:152
bool Contains(const ScAddress &) const
is Address& fully in Range?
Definition: address.hxx:718
bool IsValid() const
Definition: address.hxx:544
void add(const ScRange &rRange)
void swapRanges(ScRangeList &rRanges)
virtual ~QueryRange() override
ScRangeList maRanges
void add(const ScAddress &rPos)
const TabsType & getAllPositions() const
Row positions in each column may contain duplicates.
std::unordered_map< SCTAB, ColsType > TabsType
std::unordered_map< SCCOL, ColType > ColsType
void setSkipRange(const ScRange &rRange)
std::vector< SCROW > ColType
virtual ~RefQueryFormulaGroup() override
#define SC_LISTENER_QUERY_FORMULA_GROUP_RANGE
#define SC_LISTENER_QUERY_FORMULA_GROUP_POS
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15