38#include <unordered_map>
49 GC_TYPE_SUBSUBSECTION,
93 const wxString &initString = {});
96 std::unique_ptr<Cell> Copy()
const;
99 std::unique_ptr<GroupCell> CopyList()
const;
110 const wxString &GetAnswer(
size_t answer)
const;
111 const wxString &GetAnswer(
const wxString &question)
const;
116 void SetAutoAnswer(
bool autoAnswer);
129 void SetAnswer(
const wxString &question,
const wxString &answer);
161 const wxString
GetToolTip(wxPoint point)
const override;
171 Range GetCellsInOutput()
const;
173 Range GetCellsInOutputRect(
const wxRect &rect, wxPoint one, wxPoint two)
const;
177 bool SetEditableContent(
const wxString &text);
179 void AppendOutput(std::unique_ptr<Cell> &&cell);
203 wxString
ToTeX(
const wxString &imgDir,
const wxString &filename, std::size_t *imgCounter)
const;
205 wxString
ToRTF()
const override;
207 wxString ToTeXCodeCell(
const wxString &imgDir,
const wxString &filename, std::size_t *imgCounter)
const;
209 static wxString ToTeXImage(
const Cell *tmp,
const wxString &imgDir,
const wxString &filename, std::size_t *imgCounter);
217 static wxString
ToTeXAnimation(
const Cell *tmp,
const wxString &imgDir,
const wxString &filename, std::size_t *imgCounter);
219 wxString
ToTeX()
const override;
221 wxString
ToXML()
const override;
223 void Hide(
bool hide)
override;
227 wxRect HideRect()
const;
268 void SetInput(std::unique_ptr<Cell> &&input);
270 void SetOutput(std::unique_ptr<Cell> &&output);
272 void AppendInput(std::unique_ptr<Cell> &&cell);
282 static wxString TexEscapeOutputCell(wxString Input);
320 if (fontsize.IsValid())
321 m_mathFontSize = fontsize;
327 bool Recalculate()
const;
328 bool Reposition()
const;
333 wxPoint CalculateInputPosition()
const;
337 wxRect
GetRect(
bool all =
false)
const override;
380 bool HideTree(std::unique_ptr<GroupCell> &&tree);
439 bool IsMainInput(
const Cell *active)
const;
441 bool IsHeading()
const;
450 void Number(
int §ion,
int &subsection,
int &subsubsection,
int &heading5,
int &heading6,
int &image)
const;
463 void Draw(wxDC *dc, wxDC *antialiassingDC)
override;
494 typedef std::unordered_map <wxString, int, wxStringHash> CmdsAndVariables;
499#if wxUSE_ACCESSIBILITY
500 wxAccStatus GetName (
int childId, wxString *name)
const override;
501 wxAccStatus GetDescription(
int childId, wxString *description)
const override;
502 wxAccStatus GetLocation (wxRect &rect,
int elementId)
override;
503 wxAccStatus GetRole (
int childId, wxAccRole *role)
const override;
509 void UpdateOutputPositions()
const;
511 void UpdateYPositionList()
const;
517 wxCoord GetInputIndent()
const;
518 void UpdateCellsInGroup();
571 mutable int16_t m_numberedAnswersCount = 0;
584 bool m_inEvaluationQueue : 1 =
false;
585 bool m_lastInEvaluationQueue : 1 =
false;
586 bool m_updateConfusableCharWarnings : 1 =
true;
600 static wxString m_lookalikeChars;
The definition of the base class of all cells the worksheet consists of.
This file contains the definition of the class EditorCell.
std::ostream & operator<<(std::ostream &out, const GroupType grouptype)
Allow Standard c++ streams to print out our enum values as text.
Definition: GroupCell.cpp:2341
GroupType
All types a GroupCell can be of.
Definition: GroupCell.h:43
A Type-Safe Fixed-Point Font Size.
Definition: FontAttribs.h:99
A class that carries information about the type of a cell.
Definition: Cell.h:93
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:148
Cell * GetNext() const
Get the next cell in the list.
Definition: Cell.h:803
Cell * GetPrevious() const
Returns a pointer to the previous cell in the current cell list.
Definition: Cell.h:800
Cell * last() const
Get the last cell in this list of cells.
Definition: Cell.cpp:1376
AFontSize m_fontSize
The unscaled font size.
Definition: Cell.h:1183
Configuration * m_configuration
A pointer to the configuration responsible for this worksheet.
Definition: Cell.h:1138
DocumentCellPointers * GetDocumentCellPointers() const
The document-model half of the cell-pointer registry this cell uses.
Definition: Cell.cpp:71
virtual void SetCurrentPoint(wxPoint point) const
Pass 2: Arrangement.
Definition: Cell.cpp:514
ViewCellPointers * GetViewCellPointers() const
The transient view-state half of the cell-pointer registry this cell uses.
Definition: Cell.cpp:75
bool NeedsRecalculation() const
True, if something that affects the cell size has changed.
Definition: Cell.h:549
Cell * first() const
Get the first cell in this list of cells.
Definition: Cell.cpp:1367
The configuration storage for the current worksheet.
Definition: Configuration.h:98
The document-model half of the cell-pointer registry.
Definition: CellPointers.h:50
This class defines what the user sees as input cell.
Definition: EditorCell.h:62
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:88
wxCoord GetMaxDrop() const override
Returns the maximum distance between center and bottom of this line.
Definition: GroupCell.cpp:960
bool ContainsSavedAnswers() const
Does this GroupCell know the answer to any of maxima's questions?
Definition: GroupCell.h:113
void Draw(wxDC *dc, wxDC *antialiassingDC) override
Draw this GroupCell.
Definition: GroupCell.cpp:881
bool Contains(GroupCell *cell) const
Does this tree contain the cell "cell"?
Definition: GroupCell.cpp:2141
void Hide(bool hide) override
Hide this cell. See IsHidden() for details.
Definition: GroupCell.cpp:1849
GroupCell * m_hiddenTreeParent
store linkage to the parent of the fold
Definition: GroupCell.h:536
std::vector< std::pair< wxString, wxString > > m_knownAnswers
A list of answers provided by the user.
Definition: GroupCell.h:497
bool IsFoldable() const
folding and unfolding
Definition: GroupCell.cpp:204
void BreakLines() const
Break this cell into lines.
Definition: GroupCell.cpp:1813
Cell * DisplayedOutput() const
The cell list to lay out and draw as this group's output.
Definition: GroupCell.cpp:641
virtual bool FirstLineOnlyEditor() const override
True, if this GroupCell is folded and its editor shows only its first line.
Definition: GroupCell.cpp:1843
bool RevealHidden()
Unfold all that is needed to make the current cell seen.
Definition: GroupCell.cpp:1913
void CellUnderPointer(GroupCell *cell)
Marks the cell that is under the mouse pointer.
Definition: GroupCell.cpp:956
void Number(int §ion, int &subsection, int &subsubsection, int &heading5, int &heading6, int &image) const
Return this cell's section- or image number.
Definition: GroupCell.cpp:2061
GroupType m_groupType
Which type this cell is of?
Definition: GroupCell.h:578
wxPoint CalculateLabelPosition() const
Where this group cell's label (the "(%i1)", or a section's number) goes.
Definition: GroupCell.cpp:712
void OutputHeightChanged()
Reset the data when the output size changes.
Definition: GroupCell.cpp:467
wxCoord BracketColumnLeft() const
The left edge of the gutter column the cell bracket is drawn in.
Definition: GroupCell.cpp:706
bool NeedsRecalculation(AFontSize fontSize) const override
True, if something that affects the cell size has changed.
Definition: GroupCell.cpp:660
wxRect GetBracketRect() const
The on-screen rectangle occupied by this cell's bracket.
Definition: GroupCell.cpp:968
wxRect m_outputRect
Bounding rectangle of this group's output (results) area, in worksheet coordinates.
Definition: GroupCell.h:528
GroupCell * GetHiddenTree() const
Get the tree of cells that got hidden by folding this cell.
Definition: GroupCell.h:372
std::unique_ptr< GroupCell > UnhideTree()
Unfold the current cell.
Definition: GroupCell.cpp:1899
static bool IsOutputLabel(const Cell &cell)
Is this output cell one of the labels that start a line, like "(%o1)"?
Definition: GroupCell.cpp:759
wxString ToTeX() const override
Convert this cell to its LaTeX representation.
Definition: GroupCell.cpp:1179
bool m_autoAnswer
Does this GroupCell automatically fill in the answer to questions?
Definition: GroupCell.h:583
size_t GetInnerCellCount() const override
The number of inner cells - for use by the iterators.
Definition: GroupCell.h:131
wxString ToRTF() const override
Returns the cell's representation as RTF.
Definition: GroupCell.cpp:1183
void DrawBracket(wxDC *dc, wxDC *antialiassingDC)
Draw the bracket of this cell.
Definition: GroupCell.cpp:976
void RemoveOutput()
Remove all output cells attached to this one.
Definition: GroupCell.cpp:305
Cell * GetLabel() const
Returns the list of cells the output consists of, starting with the label.
Definition: GroupCell.h:293
void MarkNeedsRecalculate()
Mark this group as needing a recalculation.
Definition: GroupCell.cpp:241
const wxString GetToolTip(wxPoint point) const override
Returns the tooltip for the element at the position point.
Definition: GroupCell.cpp:1765
Range GetInnerCellsInRect(const wxRect &rect) const override
Select the cells inside this cell described by the rectangle rect.
Definition: GroupCell.cpp:1707
std::unique_ptr< Cell > m_inputLabel
The input label of this cell. Is followed by the input of the cell.
Definition: GroupCell.h:542
std::unique_ptr< Cell > Copy(GroupCell *group) const override
Create a copy of this cell.
int m_inputWidth
Width and height of this group's input area (input label plus editor), computed by RecalculateInput()...
Definition: GroupCell.h:565
wxRect GetRect(bool all=false) const override
Get the smallest rectangle this cell fits in.
Definition: GroupCell.cpp:944
GroupCell * SectioningUnitGetEndOf() const
Get the end of this section/subsection/...
void UpdateConfusableCharWarnings()
GroupCells warn if they contain both greek and latin lookalike chars.
Definition: GroupCell.cpp:364
const CellTypeInfo & GetInfo() override
Returns the information about this cell's type.
void RecalculateInput() const
Recalculate the height of the input part of the cell.
Definition: GroupCell.cpp:494
void SetHiddenTreeParent(GroupCell *parent, GroupCell *last=nullptr)
Set the parent cell of hidden cells.
Definition: GroupCell.cpp:1926
void InputHeightChanged()
Reset the data when the input size changes.
Definition: GroupCell.cpp:446
bool m_cellsAppended
Output cells were appended since the last layout, so a recalculation is needed (see NeedsRecalculatio...
Definition: GroupCell.h:591
void ResetInputLabel()
Reset the input label of the current cell.
Definition: GroupCell.cpp:188
static std::vector< OutputLineWidths > MeasureOutputLines(Cell *displayed)
The width of every line of output, so a line can be placed before it is walked.
Definition: GroupCell.cpp:765
wxCoord ContentColumnRight() const
The x just past the right edge of the content column. See the definition.
Definition: GroupCell.cpp:701
void Recalculate(const AFontSize fontsize) const override
Recalculates the size of this GroupCell and all cells inside it if needed.
Definition: GroupCell.h:319
bool Empty() const
Is this list of cells empty?
Definition: GroupCell.cpp:180
wxRect GetOutputRect() const
Determine which rectangle is occupied by this GroupCell.
Definition: GroupCell.h:303
bool SectioningCanMoveIn() const
Can this chapter/section/... converted to a 'smaller' cell, e.g. section->subsection,...
Definition: GroupCell.h:443
wxCoord GetCenterList() const override
Returns the maximum distance between top and center of this line.
Definition: GroupCell.cpp:964
void OnSize()
Called on MathCtrl resize.
Definition: GroupCell.cpp:482
static wxString ToTeXAnimation(const Cell *tmp, const wxString &imgDir, const wxString &filename, std::size_t *imgCounter)
Write an animation's frames as images and emit an \animategraphics for it.
Definition: GroupCell.cpp:1541
GroupCell * Fold()
Fold this cell.
Definition: GroupCell.cpp:1934
void SetAnswer(const wxString &question, const wxString &answer)
Add a new answer to the cell.
Definition: GroupCell.cpp:248
void InEvaluationQueue(bool inQueue)
Is this cell part of the evaluation Queue?
Definition: GroupCell.h:480
int16_t m_cellsInGroup
The number of cells the current group contains (-1, if no GroupCell)
Definition: GroupCell.h:570
GroupCell * UnfoldAll(std::vector< GroupCell * > *affected=nullptr)
Unfold all cells.
Definition: GroupCell.cpp:1999
bool SectioningCanMoveOut() const
Can this chapter/section/... converted to a 'larger' cell, e.g. subsection->section,...
Definition: GroupCell.h:445
void UpdateYPosition() const
Recalculate the cell's y position using the position and height of the last one.
GroupCell * GetHiddenTreeParent() const
The cell this cell is hidden inside, if it is part of a folded subtree.
Definition: GroupCell.h:400
Cell * GetOutput() const
Returns the list of cells the output consists of, starting after the label.
Definition: GroupCell.h:299
bool HideTree(std::unique_ptr< GroupCell > &&tree)
Fold the current cell.
Definition: GroupCell.cpp:1879
int m_labelWidth_cached
Cache of the last width computed by GetInputIndent(); reused as the input indent while the input labe...
Definition: GroupCell.h:562
std::unique_ptr< GroupCell > m_hiddenTree
here hidden (folded) tree of GCs is stored
Definition: GroupCell.h:535
void LastInEvaluationQueue(bool last)
Is this cell the last cell in the evaluation Queue?
Definition: GroupCell.h:483
wxString ToString() const override
A textual representation of this cell.
Definition: GroupCell.cpp:1151
void SetCurrentPoint(wxPoint point) const override
Pass 2 (Arrange): Sets the GroupCell position and triggers child layout.
Definition: GroupCell.cpp:865
bool AutoAnswer() const
Does this GroupCell save the answer to a question?
Definition: GroupCell.h:115
GroupCell * GetLastWorkingGroup() const
Which GroupCell was the last maxima was working on?
Definition: GroupCell.cpp:260
GroupCell * GetPrevious() const
Get the previous GroupCell in the list.
Definition: GroupCell.h:276
std::unique_ptr< Cell > m_layoutSuppressedNotice
Cached placeholder shown instead of the output while layout is suppressed.
Definition: GroupCell.h:556
bool AddEnding() override
Add a semicolon to a code cell, if needed.
Definition: GroupCell.cpp:940
GroupCell * GetNext() const
Get the next GroupCell in the list.
Definition: GroupCell.h:280
bool m_layoutSuppressed
Laying out this group's output exceeded the configured deadline.
Definition: GroupCell.h:598
Cell * GetInnerCell(size_t index) const override
Retrieve an inner cell with given index which must be less than GetInnerCellCount.
Definition: GroupCell.h:132
wxString ToXML() const override
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: GroupCell.cpp:1582
void RecalculateOutput() const
Recalculate the height of the output part of the cell.
Definition: GroupCell.cpp:572
void ResetInputLabelList()
Call ResetInputLabel() on all cells in the list of cells this GroupCell starts with.
Definition: GroupCell.cpp:195
GroupCell * Unfold()
Unfold this cell.
Definition: GroupCell.cpp:1971
GroupCell * FoldAll(std::vector< GroupCell * > *affected=nullptr)
Fold all cells.
Definition: GroupCell.cpp:1982
std::unique_ptr< Cell > m_output
The maxima output this cell contains.
Definition: GroupCell.h:544
bool IsLesserGCType(GroupType comparedTo) const
Document structure: Can this cell type be part of the contents of comparedTo?
Definition: GroupCell.cpp:2014
bool m_suppressTooltipMarker
Suppress the yellow ToolTip marker?
Definition: GroupCell.h:588
The view/interaction half of the cell-pointer registry.
Definition: CellPointers.h:187
The widths of one line of output, split at the label that starts it.
Definition: GroupCell.h:243