37#include <unordered_map>
48 GC_TYPE_SUBSUBSECTION,
79 std::unique_ptr<Cell> Copy()
const;
82 std::unique_ptr<GroupCell> CopyList()
const;
90 const wxString &GetAnswer(
size_t answer)
const;
91 const wxString &GetAnswer(
const wxString &question)
const;
96 void SetAutoAnswer(
bool autoAnswer);
97 void MarkNeedsRecalculate(){m_cellsAppended =
true;}
99 void SetAnswer(
const wxString &question,
const wxString &answer);
123 const wxString
GetToolTip(wxPoint point)
const override;
133 Range GetCellsInOutput()
const;
135 Range GetCellsInOutputRect(
const wxRect &rect, wxPoint one, wxPoint two)
const;
139 bool SetEditableContent(
const wxString &text);
141 void AppendOutput(std::unique_ptr<Cell> &&cell);
165 wxString
ToTeX(
const wxString &imgDir,
const wxString &filename, std::size_t *imgCounter)
const;
167 wxString
ToRTF()
const override;
169 wxString ToTeXCodeCell(
const wxString &imgDir,
const wxString &filename, std::size_t *imgCounter)
const;
171 static wxString ToTeXImage(
const Cell *tmp,
const wxString &imgDir,
const wxString &filename, std::size_t *imgCounter);
173 wxString
ToTeX()
const override;
175 wxString
ToXML()
const override;
177 void Hide(
bool hide)
override;
181 wxRect HideRect()
const;
184 void SetInput(std::unique_ptr<Cell> &&input);
186 void SetOutput(std::unique_ptr<Cell> &&output);
188 void AppendInput(std::unique_ptr<Cell> &&cell);
198 static wxString TexEscapeOutputCell(wxString Input);
229 wxPoint CalculateInputPosition();
233 wxRect
GetRect(
bool all =
false)
const override;
267 bool HideTree(std::unique_ptr<GroupCell> &&tree);
314 bool IsMainInput(
const Cell *active)
const;
316 bool IsHeading()
const;
325 void Number(
int §ion,
int &subsection,
int &subsubsection,
int &heading5,
int &heading6,
int &image)
const;
338 void Draw(wxPoint point, wxDC *dc, wxDC *antialiassingDC)
override;
366 typedef std::unordered_map <wxString, wxString, wxStringHash> StringHash;
367 typedef std::unordered_map <wxString, int, wxStringHash> CmdsAndVariables;
372#if wxUSE_ACCESSIBILITY
373 wxAccStatus GetDescription(
int childId, wxString *description)
const override;
374 wxAccStatus GetLocation (wxRect &rect,
int elementId)
override;
380 void UpdateOutputPositions();
382 void UpdateYPositionList();
388 wxCoord GetInputIndent();
390 void UpdateCellsInGroup();
394 wxRect m_outputRect{-1, -1, 0, 0};
414 int m_labelWidth_cached = 0;
415 int m_inputWidth, m_inputHeight;
421 mutable int16_t m_numberedAnswersCount = 0;
432 void InitBitFields_GroupCell()
436 m_inEvaluationQueue =
false;
437 m_lastInEvaluationQueue =
false;
438 m_updateConfusableCharWarnings =
true;
440 m_cellsAppended =
false;
445 bool m_inEvaluationQueue : 1 ;
446 bool m_lastInEvaluationQueue : 1 ;
447 bool m_updateConfusableCharWarnings : 1 ;
450 bool m_cellsAppended : 1;
452 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:1877
GroupType
All types a GroupCell can be of.
Definition: GroupCell.h:42
A Type-Safe Fixed-Point Font Size.
Definition: FontAttribs.h:98
The storage for pointers to cells.
Definition: CellPointers.h:45
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:142
Cell * GetNext() const
Get the next cell in the list.
Definition: Cell.h:694
Cell * GetPrevious() const
Returns a pointer to the previous cell in the current cell list.
Definition: Cell.h:691
Cell * last() const
Get the last cell in this list of cells.
Definition: Cell.cpp:1058
Cell * first() const
Get the first cell in this list of cells.
Definition: Cell.cpp:1049
The configuration storage for the current worksheet.
Definition: Configuration.h:85
This class defines what the user sees as input cell.
Definition: EditorCell.h:59
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:74
bool ContainsSavedAnswers() const
Does this GroupCell know the answer to any of maxima's questions?
Definition: GroupCell.h:93
bool Contains(GroupCell *cell) const
Does this tree contain the cell "cell"?
Definition: GroupCell.cpp:1748
void Hide(bool hide) override
Hide this cell. See IsHidden() for details.
Definition: GroupCell.cpp:1467
GroupCell * m_hiddenTreeParent
store linkage to the parent of the fold
Definition: GroupCell.h:401
bool IsFoldable() const
folding and unfolding
Definition: GroupCell.cpp:244
StringHash m_knownAnswers
A list of answers provided by the user.
Definition: GroupCell.h:370
bool RevealHidden()
Unfold all that is needed to make the current cell seen.
Definition: GroupCell.cpp:1528
void CellUnderPointer(GroupCell *cell)
Marks the cell that is under the mouse pointer.
Definition: GroupCell.cpp:760
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:1668
void Recalculate(AFontSize WXUNUSED(fontsize)) override
Recalculates the size of this GroupCell and all cells inside it if needed.
Definition: GroupCell.h:227
GroupType m_groupType
Which type this cell is of?
Definition: GroupCell.h:428
bool NeedsRecalculation(AFontSize fontSize) const override
True, if something that affects the cell size has changed.
Definition: GroupCell.cpp:590
void Draw(wxPoint point, wxDC *dc, wxDC *antialiassingDC) override
Draw this GroupCell.
Definition: GroupCell.cpp:667
GroupCell * GetHiddenTree() const
Get the tree of cells that got hidden by folding this cell.
Definition: GroupCell.h:259
std::unique_ptr< GroupCell > UnhideTree()
Unfold the current cell.
Definition: GroupCell.cpp:1514
wxString ToTeX() const override
Convert this cell to its LaTeX representation.
Definition: GroupCell.cpp:957
bool m_autoAnswer
Does this GroupCell automatically fill in the answer to questions?
Definition: GroupCell.h:444
size_t GetInnerCellCount() const override
The number of inner cells - for use by the iterators.
Definition: GroupCell.h:101
wxString ToRTF() const override
Returns the cell's representation as RTF.
Definition: GroupCell.cpp:961
void DrawBracket(wxDC *dc, wxDC *antialiassingDC)
Draw the bracket of this cell.
Definition: GroupCell.cpp:764
void RemoveOutput()
Remove all output cells attached to this one.
Definition: GroupCell.cpp:332
Cell * GetLabel() const
Returns the list of cells the output consists of, starting with the label.
Definition: GroupCell.h:209
void RecalculateOutput()
Recalculate the height of the output part of the cell.
Definition: GroupCell.cpp:536
void RecalculateInput()
Recalculate the height of the input part of the cell.
Definition: GroupCell.cpp:491
Range GetInnerCellsInRect(const wxRect &rect) const override
Select the cells inside this cell described by the rectangle rect.
Definition: GroupCell.cpp:1326
std::unique_ptr< Cell > m_inputLabel
The input label of this cell. Is followed by the input of the cell.
Definition: GroupCell.h:407
std::unique_ptr< Cell > Copy(GroupCell *group) const override
Create a copy of this cell.
wxRect GetRect(bool all=false) const override
Get the smallest rectangle this cell fits in.
Definition: GroupCell.cpp:748
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:380
const CellTypeInfo & GetInfo() override
Returns the information about this cell's type.
void InputHeightChanged()
Reset the data when the input size changes.
Definition: GroupCell.cpp:463
void ResetInputLabel()
Reset the input label of the current cell.
Definition: GroupCell.cpp:228
const wxString GetToolTip(wxPoint point) const override
Returns the tooltip for the element at the position point.
Definition: GroupCell.cpp:1384
virtual bool FirstLineOnlyEditor() override
True, if this GroupCell is folded and its editor shows only its first line.
Definition: GroupCell.cpp:1461
bool Empty() const
Is this list of cells empty?
Definition: GroupCell.cpp:220
wxRect GetOutputRect() const
Determine which rectangle is occupied by this GroupCell.
Definition: GroupCell.h:219
bool SectioningCanMoveIn() const
Can this chapter/section/... converted to a 'smaller' cell, e.g. section->subsection,...
Definition: GroupCell.h:318
void OnSize()
Called on MathCtrl resize.
Definition: GroupCell.cpp:479
GroupCell * Fold()
Fold this cell.
Definition: GroupCell.cpp:1546
void SetAnswer(const wxString &question, const wxString &answer)
Add a new answer to the cell.
Definition: GroupCell.cpp:278
void InEvaluationQueue(bool inQueue)
Is this cell part of the evaluation Queue?
Definition: GroupCell.h:355
int16_t m_cellsInGroup
The number of cells the current group contains (-1, if no GroupCell)
Definition: GroupCell.h:420
bool SectioningCanMoveOut() const
Can this chapter/section/... converted to a 'larger' cell, e.g. subsection->section,...
Definition: GroupCell.h:320
GroupCell * UnfoldAll()
Unfold all cells.
Definition: GroupCell.cpp:1608
Cell * GetOutput() const
Returns the list of cells the output consists of, starting after the label.
Definition: GroupCell.h:215
bool HideTree(std::unique_ptr< GroupCell > &&tree)
Fold the current cell.
Definition: GroupCell.cpp:1494
std::unique_ptr< GroupCell > m_hiddenTree
here hidden (folded) tree of GCs is stored
Definition: GroupCell.h:400
void LastInEvaluationQueue(bool last)
Is this cell the last cell in the evaluation Queue?
Definition: GroupCell.h:358
wxString ToString() const override
A textual representation of this cell.
Definition: GroupCell.cpp:929
bool AutoAnswer() const
Does this GroupCell save the answer to a question?
Definition: GroupCell.h:95
GroupCell * GetLastWorkingGroup() const
Which GroupCell was the last maxima was working on?
Definition: GroupCell.cpp:283
void UpdateYPosition()
Recalculate the cell's y position using the position and height of the last one.
Definition: GroupCell.cpp:599
GroupCell * GetPrevious() const
Get the previous GroupCell in the list.
Definition: GroupCell.h:192
void BreakLines()
Break this cell into lines.
Definition: GroupCell.cpp:1431
bool AddEnding() override
Add a semicolon to a code cell, if needed.
Definition: GroupCell.cpp:744
GroupCell * GetNext() const
Get the next GroupCell in the list.
Definition: GroupCell.h:196
Cell * GetInnerCell(size_t index) const override
Retrieve an inner cell with given index which must be less than GetInnerCellCount.
Definition: GroupCell.h:103
wxString ToXML() const override
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: GroupCell.cpp:1202
void ResetInputLabelList()
Call ResetInputLabel() on all cells in the list of cells this GroupCell starts with.
Definition: GroupCell.cpp:235
GroupCell * Unfold()
Unfold this cell.
Definition: GroupCell.cpp:1583
std::unique_ptr< Cell > m_output
The maxima output this cell contains.
Definition: GroupCell.h:409
bool IsLesserGCType(GroupType comparedTo) const
Document structure: Can this cell type be part of the contents of comparedTo?
Definition: GroupCell.cpp:1621
bool m_suppressTooltipMarker
Suppress the yellow ToolTip marker?
Definition: GroupCell.h:449
void SetHiddenTreeParent(GroupCell *parent)
Set the parent cell of hidden cells.
Definition: GroupCell.cpp:1541
GroupCell * FoldAll()
Fold all cells.
Definition: GroupCell.cpp:1593