wxMaxima
Loading...
Searching...
No Matches
OutputNavigation.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2026 Gunter Königsmann <wxMaxima@physikbuch.de>
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//
20// SPDX-License-Identifier: GPL-2.0+
21
54#ifndef OUTPUTNAVIGATION_H
55#define OUTPUTNAVIGATION_H
56
57#include "cells/MatrixBlock.h"
58#include <vector>
59
60class Cell;
61class GroupCell;
62class MatrCell;
63
64namespace OutputNavigation {
65
72struct Item
73{
74 Cell *first = nullptr;
75 Cell *last = nullptr;
76 MatrCell *matrix = nullptr;
77 MatrixEntry entry;
78
79 bool IsMatrixEntry() const { return matrix != nullptr; }
80 bool operator==(const Item &other) const;
81};
82
84Item Run(Cell *first, Cell *last);
86Item Entry(MatrCell *matrix, MatrixEntry entry);
87
89std::vector<Item> Results(const GroupCell *group);
90
95std::vector<Item> Children(const Item &item);
96
106{
107 bool found = false;
108 std::vector<Item> path;
109 std::vector<Item> siblings;
110 std::size_t index = 0;
111};
112Location Locate(const GroupCell *group, const Item &item);
113
123{
124 bool found = false;
125 std::vector<Item> path;
126 std::vector<Item> siblings;
127 std::size_t firstIndex = 0;
128 std::size_t lastIndex = 0;
129};
130RunLocation LocateRun(const GroupCell *group, const Cell *first, const Cell *last);
131
132} // namespace OutputNavigation
133
134#endif // OUTPUTNAVIGATION_H
std::vector< Item > Results(const GroupCell *group)
The top level: the results of this cell's output, as items.
Definition: OutputNavigation.cpp:246
Item Entry(MatrCell *matrix, MatrixEntry entry)
The item one entry of a matrix forms.
Definition: OutputNavigation.cpp:237
std::vector< Item > Children(const Item &item)
The parts of an item, in reading order; empty if it has none.
Definition: OutputNavigation.cpp:255
Item Run(Cell *first, Cell *last)
The item a run of cells forms.
Definition: OutputNavigation.cpp:230
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:148
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
A Cell that displays a matrix.
Definition: MatrCell.h:95
One entry of a matrix, by its zero-based row and column.
Definition: MatrixBlock.h:30
One node of the tree: a run of sibling cells, or one entry of a matrix.
Definition: OutputNavigation.h:73
Where an item sits in the tree.
Definition: OutputNavigation.h:106
Where a run of several siblings sits: the level holding both of its ends.
Definition: OutputNavigation.h:123
std::vector< Item > path
The path to the parent; empty at the top level.
Definition: OutputNavigation.h:125