android: Update app-specific/MIME type icons
[LibreOffice.git] / sc / inc / broadcast.hxx
blobb095f819acb7b73f37d6f24bc9146786a7f18bf9
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"
14 #include <map>
15 #include <variant>
16 #include <ostream>
18 class ScFormulaCell;
19 class SvtListener;
21 namespace sc
23 class FormulaGroupAreaListener;
25 struct BroadcasterState
27 enum class CellListenerType
29 FormulaCell,
30 Generic,
33 enum class AreaListenerType
35 FormulaCell,
36 FormulaGroup,
37 Generic,
40 struct CellListener
42 using DataType = std::variant<const ScFormulaCell*, const SvtListener*>;
44 CellListenerType eType;
45 DataType pData;
47 CellListener(const ScFormulaCell* p);
48 CellListener(const SvtListener* p);
51 struct AreaListener
53 using DataType = std::variant<const ScFormulaCell*, const sc::FormulaGroupAreaListener*,
54 const SvtListener*>;
56 AreaListenerType eType;
57 DataType pData;
59 AreaListener(const ScFormulaCell* p);
60 AreaListener(const sc::FormulaGroupAreaListener* p);
61 AreaListener(const SvtListener* p);
64 std::map<ScAddress, std::vector<CellListener>> aCellListenerStore;
65 std::map<ScRange, std::vector<AreaListener>> aAreaListenerStore;
67 /**
68 * Check if a formula cell listens on a single cell.
70 bool hasFormulaCellListener(const ScAddress& rBroadcasterPos,
71 const ScAddress& rFormulaPos) const;
73 /**
74 * Check if a formula cell listens on a single range.
76 bool hasFormulaCellListener(const ScRange& rBroadcasterRange,
77 const ScAddress& rFormulaPos) const;
79 /**
80 * Dump all broadcaster state in YAML format.
82 void dump(std::ostream& rStrm, const ScDocument* pDoc = nullptr) const;
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */