Branch libreoffice-24-8-3
[LibreOffice.git] / sc / inc / listenerquery.hxx
blob64d9b463a64fdc6dfb1d9528d3d2b16cdcc93aef
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/.
8 */
10 #pragma once
12 #include "address.hxx"
13 #include "rangelst.hxx"
14 #include <svl/listener.hxx>
16 #include <unordered_map>
17 #include <vector>
19 namespace sc
21 /**
22 * Used to collect positions of formula cells that belong to a formula
23 * group.
25 class RefQueryFormulaGroup final : public SvtListener::QueryBase
27 public:
28 typedef std::vector<SCROW> ColType;
29 typedef std::unordered_map<SCCOL, ColType> ColsType;
30 typedef std::unordered_map<SCTAB, ColsType> TabsType;
32 RefQueryFormulaGroup();
33 virtual ~RefQueryFormulaGroup() override;
35 void setSkipRange(const ScRange& rRange);
36 void add(const ScAddress& rPos);
38 /**
39 * Row positions in each column may contain duplicates. Caller must
40 * remove duplicates if necessary.
42 const TabsType& getAllPositions() const;
44 private:
45 ScRange maSkipRange;
46 TabsType maTabs;
49 class QueryRange final : public SvtListener::QueryBase
51 ScRangeList maRanges;
53 QueryRange(const QueryRange&) = delete;
54 QueryRange& operator=(const QueryRange&) = delete;
56 public:
57 QueryRange();
58 virtual ~QueryRange() override;
60 void add(const ScRange& rRange);
62 void swapRanges(ScRangeList& rRanges);
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */