wxMaxima
Loading...
Searching...
No Matches
Cell.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) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// Copyright (C) 2014-2018 Gunter Königsmann <wxMaxima@physikbuch.de>
5// Copyright (C) 2020 Kuba Ober <kuba@bertec.com>
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// SPDX-License-Identifier: GPL-2.0+
23
29#ifndef CELL_H
30#define CELL_H
31
32#include "../precomp.h"
33#include "CellPtr.h"
34#include "CellIterators.h"
35#include "Configuration.h"
36#include "StringUtils.h"
37#include "TextStyle.h"
38#include "CachedValue.h"
39#include <wx/defs.h>
40#if wxUSE_ACCESSIBILITY
41#include <wx/access.h>
42#endif // wxUSE_ACCESSIBILITY
43#include <algorithm>
44#include <map>
45#include <memory>
46#include <vector>
47#include <type_traits>
48class CellPointers;
49class EditorCell;
50class GroupCell;
51class TextCell;
52class Worksheet;
53class wxXmlNode;
54
55// Forward declarations
56template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type = true>
57inline auto OnInner(const C *cell);
58template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type = true>
59inline auto OnInner(C *cell);
60
63enum CellType : int8_t
64{
65 MC_TYPE_DEFAULT,
83};
85std::ostream& operator<<(std::ostream& out, const CellType celltype);
86
87#if wxUSE_ACCESSIBILITY
88class CellAccessible;
89#endif
90
93{
94public:
100 virtual const wxString &GetName() const = 0;
101};
102
140// 120 bytes
141class Cell: public Observed
142{
143#if wxUSE_ACCESSIBILITY
144 friend class CellAccessible;
145#endif
146 friend class CellList;
147
148 // This class can be derived from wxAccessible which has no copy constructor
149 void operator=(const Cell&) = delete;
151 Cell(GroupCell *group, const Cell&) = delete;
152
153 template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type>
154 friend inline auto OnInner(const C *cell);
155 template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type>
156 friend inline auto OnInner(C *cell);
157
158public:
159// Cell(GroupCell *group, Configuration *config);
160 Cell(GroupCell *group, Configuration *config);
161
167 virtual std::unique_ptr<Cell> Copy(GroupCell *group) const = 0;
168
170 virtual const CellTypeInfo &GetInfo() = 0;
171
176 wxCoord Scale_Px(double px) const {return m_configuration->Scale_Px(px);}
181 AFontSize Scale_Px(AFontSize size) const { return m_configuration->Scale_Px(size); }
182
183#if wxUSE_ACCESSIBILITY
184 // The methods whose implementation within Cell should be sufficient are
185 // not virtual. Should that prove not to be the case eventually, they can be
186 // made virtual with due caution.
188 wxAccStatus GetParent (Cell ** parent) const;
190 wxAccStatus GetChild(int childId, Cell **child) const;
192 wxAccStatus HitTest (const wxPoint &pt, int *childId, Cell **child);
193
195 virtual wxAccStatus GetDescription(int childId, wxString *description) const;
197 virtual wxAccStatus GetFocus (int *childId, Cell **child) const;
199 virtual wxAccStatus GetDefaultAction(int childId, wxString *actionName) const;
201 virtual wxAccStatus GetLocation (wxRect &rect, int elementId);
203 virtual wxAccStatus GetValue (int childId, wxString *strValue) const;
204 virtual wxAccStatus GetRole (int childId, wxAccRole *role) const;
205#endif
206
207
215 virtual const wxString GetToolTip(wxPoint point) const;
216
218 virtual ~Cell();
219
221 unsigned long CellsInListRecursive() const;
222
224 wxRect CropToUpdateRegion(wxRect rect) const;
225
227 bool InUpdateRegion() const;
228
230 void SoftLineBreak(bool breakLine = true) const { m_breakLine = breakLine; }
231
236 bool BreakUpCells() const;
237
239 bool UnBreakUpCells() const;
240
241 /* Break lines in this list of cells
242 */
243 void BreakLines_List() const;
244
246 int GetLineIndent() const;
247
249 bool BreakLineHere() const { return m_breakLine || m_forceBreakLine; }
250
252 bool HasHardLineBreak() const { return m_forceBreakLine; }
253
258 virtual bool BreakUp() const;
259
260protected:
266 void BreakUpAndMark() const;
267
268protected:
270 wxBitmap BitmapFromSVG(wxString svgData, wxSize size);
271public:
279 bool ContainsRect(const wxRect &sm, bool all = true) const;
280
285 bool ContainsPoint(wxPoint point) const { return GetRect().Contains(point); }
286
292 virtual void ClearCache()
293 {}
294
299 void ClearCacheList();
303 virtual void SetConfiguration(Configuration *config);
306
307
317 virtual void Draw(wxPoint point, wxDC *dc, wxDC *antialiassingDC);
318
323 void DrawList(wxPoint point, wxDC *dc, wxDC *adc);
324 void DrawList(wxDC *dc, wxDC *adc){DrawList(m_currentPoint, dc, adc);}
325
333 virtual void DrawBoundingBox(wxDC &WXUNUSED(dc), bool all = false);
334
339 bool DrawThisCell(wxPoint point);
343
350 void ForceBreakLine(bool force = true) const { m_forceBreakLine = m_breakLine = force; }
351
360 wxCoord GetHeight() const
361 {
362// if(!HasValidSize())
363// Recalculate(m_fontSize_Scaled);
364 return m_height;
365 }
366
375 int GetWidth() const
376 {
377// if(!HasValidSize())
378// Recalculate(m_fontSize_Scaled);
379 return m_width;
380 }
381
391 wxCoord GetCenter() const
392 {
393// if(!HasValidSize())
394// Recalculate(m_fontSize_Scaled);
395 return m_center;
396 }
397
399 bool HasValidSize() const;
401 bool HasStaleSize() const;
403 bool HasValidPosition() const;
404
418 wxCoord GetDrop() const
419 { return m_height - m_center; }
420
425 { return m_type; }
426
433 wxCoord GetMaxDrop() const;
434
441 wxCoord GetCenterList() const;
442
447 wxCoord GetHeightList() const;
448
450 wxCoord SumOfWidths() const;
451
457 wxCoord GetLineWidth() const;
458
463 wxCoord GetCurrentX() const
464 { return m_currentPoint.x; }
465
470 wxCoord GetCurrentY() const
471 { return m_currentPoint.y; }
472
479 virtual wxRect GetRect(bool wholeList = false) const;
480
482 virtual bool NeedsRecalculation(AFontSize fontSize) const;
483
485 void ScheduleRecalculation() const {m_cellCfgCnt_last = m_configuration->CellCfgCnt() - 1 ;}
487 bool ConfigChanged() const {return m_configuration->CellCfgCnt() != m_cellCfgCnt_last;}
494 virtual wxString GetDiffPart() const;
495
503 virtual void Recalculate(AFontSize fontsize) const;
504
509 void RecalculateList(AFontSize fontsize) const;
510
512 void FontsChangedList();
513
515 void ResetSize_Recursively() const;
516
518 void ResetSize_RecursivelyList() const;
519
521 void ResetSize() const;
522
524 void ResetSizeList() const;
525
527 void SetBigSkip(bool skip) { m_bigSkip = skip; }
529 bool HasBigSkip() const { return m_bigSkip; }
530
532 virtual void SetType(CellType type);
533
535 const TextStyle &GetTextStyle() const
536 { return m_textStyle; }
537
539 // cppcheck-suppress functionStatic
540 // cppcheck-suppress functionConst
541 void SetPen(wxDC *dc, double lineWidth = 1.0) const;
543 void SetBrush(wxDC *dc) const;
544 wxColour GetForegroundColor() const;
545
547 void SetHighlight(bool highlight) { m_highlight = highlight; }
549 bool GetHighlight() const { return m_highlight; }
550
555 virtual void SetIsExponent();
556
561 virtual void SetIsExponentList();
562
567 virtual void SetValue(const wxString &WXUNUSED(text)) {}
569 virtual const wxString &GetValue() const;
570 virtual const wxString GetDisplayedString() const {return GetValue();}
571
573 Cell *first() const;
574
576 Cell *last() const;
577
579 struct Range {
580 Cell *first, *last;
581 };
582
586 Range GetCellsInRect(const wxRect &rect) const;
587
591 Range GetListCellsInRect(const wxRect &rect) const;
592
594 virtual Range GetInnerCellsInRect(const wxRect &rect) const;
595
597 virtual bool IsOperator() const { return false; }
598
600 bool IsCompound() const;
601
603 virtual bool IsShortNum() const { return false; }
604
606 GroupCell *GetGroup() const;
607
610 {
611 public:
612 double x, y;
613 };
614
616 virtual wxString ListToString() const;
617
622 wxString VariablesAndFunctionsList() const;
624 virtual wxString ListToMatlab() const;
626 virtual wxString ListToTeX() const;
628 virtual wxString ListToXML() const;
629
631 virtual wxString ListToMathML(bool startofline = false) const;
632
634 virtual wxString ListToOMML(bool startofline = false) const;
635
637 virtual wxString ListToRTF(bool startofline = false) const;
638
640 virtual wxString ToString() const;
641
647 virtual wxString ToRTF() const
648 { return wxEmptyString; }
649
651 static wxString OMML2RTF(wxXmlNode *node);
652
654 static wxString OMML2RTF(wxString ommltext);
655
665 virtual wxString ToOMML() const;
667 virtual wxString ToMatlab() const;
669 virtual wxString ToTeX() const;
671 virtual wxString ToXML() const;
673 virtual wxString ToMathML() const;
674
676 static wxString RTFescape(wxString, bool MarkDown = false);
677
679 static wxString XMLescape(wxString);
680
681 // cppcheck-suppress functionStatic
682 // cppcheck-suppress functionConst
683
691 virtual void Unbreak() const;
692
700 virtual void UnbreakList() const;
701
703 Cell *GetPrevious() const { return m_previous; }
704
706 Cell *GetNext() const { return m_next.get(); }
713 Cell *GetNextToDraw() const { return m_nextToDraw; }
714
722 virtual void SetNextToDraw(Cell *next) const { m_nextToDraw = next; }
723 template <typename T, typename Del,
724 typename std::enable_if<std::is_base_of<Cell, T>::value, bool>::type = true>
732 void SetNextToDraw(const std::unique_ptr<T, Del> &ptr) { SetNextToDraw(ptr.get()); }
733
738 bool IsComment() const
739 {
740 return m_type == MC_TYPE_TEXT || m_type == MC_TYPE_SECTION ||
741 m_type == MC_TYPE_SUBSECTION || m_type == MC_TYPE_SUBSUBSECTION ||
742 m_type == MC_TYPE_HEADING5 || m_type == MC_TYPE_HEADING6 || m_type == MC_TYPE_TITLE;
743 }
744
754 bool IsHidden() const { return m_isHidden; }
755
757 virtual bool FirstLineOnlyEditor() const;
758
760 virtual void Hide(bool hide = true) { m_isHidden = hide; }
761
766 bool IsEditable(bool input = false) const
767 {
768 return (m_type == MC_TYPE_INPUT &&
769 m_previous && m_previous->m_type == MC_TYPE_MAIN_PROMPT)
770 || (!input && IsComment());
771 }
772
774 virtual bool CanPopOut() const { return false; }
775
780 virtual wxString GnuplotSource() const {return wxEmptyString;}
781
783 virtual void ProcessEvent(wxKeyEvent &WXUNUSED(event))
784 {}
785
790 virtual bool AddEnding()
791 { return false; }
792
794 virtual void SelectPointText(wxPoint point);
795
797 virtual void SelectRectText(wxPoint one, wxPoint two);
798
805 virtual void PasteFromClipboard(bool primary = false);
806
810 virtual bool CopyToClipboard() const
811 { return false; }
812
816 virtual bool CutToClipboard()
817 { return false; }
818
820 virtual void SelectAll()
821 {}
822
824 virtual bool CanCopy() const
825 { return false; }
826
828 virtual wxPoint PositionToPoint(size_t WXUNUSED(pos))
829 { return wxPoint(-1, -1); }
830
832 virtual wxPoint PositionToPoint()
833 { return wxPoint(-1, -1); }
834
836 virtual bool IsDirty() const
837 { return false; }
838
839 virtual void SwitchCaretDisplay()
840 {}
841
843 virtual void SetFocus(bool WXUNUSED(focus))
844 {}
845
847 void SetTextColor(wxDC *dc);
848
850 virtual bool IsActive() const
851 { return false; }
852
854 virtual void SetStyle(TextStyle style)
855 {
857 m_textStyle = style;
858 }
860 bool IsMath() const;
861
863 virtual int GetImageBorderWidth() const { return 0; }
864
866 void CopyCommonData(const Cell & cell);
867
869 std::unique_ptr<Cell> CopyList(GroupCell *group) const;
870
872 static std::unique_ptr<Cell> CopyList(GroupCell *group, const Cell *cell);
873
875 void ClearToolTip();
877 void SetToolTip(const wxString &tooltip) const ;
881 void SetToolTip(const wxString *toolTip) const;
883 void AddToolTip(const wxString &tip);
885 virtual void SetCurrentPoint(wxPoint point) { m_currentPoint = point; }
887 void SetCurrentPoint(int x, int y) { SetCurrentPoint({x, y}); }
889 wxPoint GetCurrentPoint() const {return m_currentPoint;}
890
897 bool IsBrokenIntoLines() const { return m_isBrokenIntoLines; }
898
907 bool GetSuppressMultiplicationDot() const { return m_suppressMultiplicationDot; }
908 void SetSuppressMultiplicationDot(bool val) { m_suppressMultiplicationDot = val; }
910 bool GetHidableMultSign() const { return m_isHidableMultSign; }
911 void SetHidableMultSign(bool val) { m_isHidableMultSign = val; }
912
923 virtual void SetAltCopyText(const wxString &text);
925 virtual const wxString &GetAltCopyText() const { return wxm::emptyString; }
926
927#if wxUSE_ACCESSIBILITY
928 CellAccessible *GetAccessible();
929#endif
930#if CELL_TEST
931 void MockBreakUp() { m_isBrokenIntoLines = 1; }
932#endif
933
934 static wxString wxColor2HtmlString(wxColor col);
935protected:
936 std::unique_ptr<Cell> MakeVisiblyInvalidCell() const;
937public:
938 static std::unique_ptr<Cell> MakeVisiblyInvalidCell(GroupCell *group, Configuration *config);
939
940protected:
941//** Bases and internal members (16 bytes)
942//**
943// VTable *__vtable;
944// Observed __observed;
945
946//** 8-byte objects (8 bytes)
947//**
961 mutable wxPoint m_currentPoint{-1, -1};
962
963protected:
964//** 8/4-byte objects (40 + 8* bytes)
965//**
966
967private:
969 mutable std::int_fast32_t m_cellCfgCnt_last = -1;
971 std::unique_ptr<Cell> m_next;
972
974 Cell *m_previous = {};
975
976#if wxUSE_ACCESSIBILITY
977 std::unique_ptr<CellAccessible> m_accessible;
978#endif
979
980public:
981 const wxString &GetLocalToolTip() const;
982protected:
988
991
994 mutable const wxString *m_toolTip /* initialized in the constructor */;
995
996//** 4-byte objects (28 bytes)
997//**
998protected:
1005 mutable wxCoord m_height = -1;
1009 mutable wxCoord m_width = -1;
1016 mutable wxCoord m_center = -1;
1017protected:
1018//** 2-byte objects (2 bytes)
1019//**
1022
1023//** 1-byte objects (2 bytes)
1024//**
1025 // The celltype of this object
1026 CellType m_type = MC_TYPE_DEFAULT;
1027 // The text style of this object
1028 TextStyle m_textStyle = TS_MATH;
1029
1030private:
1031//** Bitfield objects (2 bytes)
1032//**
1033 void InitBitFields_Cell()
1034 { // Keep the initialization order below same as the order
1035 // of bit fields in this class!
1036 m_ownsToolTip = false;
1037 m_bigSkip = false;
1038 m_isBrokenIntoLines = false;
1039 m_isHidden = false;
1040 m_isHidableMultSign = false;
1041 m_suppressMultiplicationDot = false;
1042 m_breakLine = false;
1043 m_forceBreakLine = false;
1044 m_highlight = false;
1045 }
1046
1047 // In the boolean bit fields below, InitBitFields_Cell is an indication that
1048 // the InitBitFields_Cell() method initializes a given field. It should be
1049 // only added once such initialization is in place. It makes it easier
1050 // to verify that all bit fields are initialized.
1051
1053 mutable bool m_ownsToolTip : 1 /* InitBitFields_Cell */;
1054 bool m_bigSkip : 1 /* InitBitFields_Cell */;
1055 mutable bool m_isBrokenIntoLines : 1 /* InitBitFields_Cell */;
1056 bool m_isHidden : 1 /* InitBitFields_Cell */;
1057 bool m_isHidableMultSign : 1 /* InitBitFields_Cell */;
1058 bool m_suppressMultiplicationDot : 1 /* InitBitFields_Cell */;
1060 mutable bool m_breakLine : 1 /* InitBitFields_Cell */;
1061 mutable bool m_forceBreakLine : 1 /* InitBitFields_Cell */;
1062 bool m_highlight : 1 /* InitBitFields_Cell */;
1063
1064protected:
1065 friend class InnerCellIterator;
1067 virtual size_t GetInnerCellCount() const;
1070 virtual Cell *GetInnerCell(size_t index) const;
1071
1072 inline Worksheet *GetWorksheet() const;
1073
1075 virtual void FontsChanged() const
1077
1078 CellPointers *GetCellPointers() const;
1079
1080private:
1081 void RecalcCenterListAndMaxDropCache();
1082};
1083
1084// The static cast here requires Cell to be defined
1085template <typename T>
1086template <typename PtrT, typename std::enable_if<std::is_pointer<PtrT>::value, bool>::type>
1087inline PtrT CellPtr<T>::CastAs() const noexcept { return dynamic_cast<PtrT>(static_cast<Cell*>(base_get())); }
1088
1089#if wxUSE_ACCESSIBILITY
1090class CellAccessible final : public wxAccessible
1091{
1092public:
1093 explicit CellAccessible(Cell *const forCell) : m_cell(forCell) {}
1094
1096 wxAccStatus GetParent (wxAccessible **parent) override;
1098 wxAccStatus GetChildCount (int *childCount) override;
1100 wxAccStatus GetChild (int childId, wxAccessible **child) override;
1102 wxAccStatus HitTest (const wxPoint &pt,
1103 int *childId, wxAccessible **child) override;
1105 wxAccStatus GetDescription(int childId, wxString *description) override;
1107 wxAccStatus GetDefaultAction(int childId, wxString *actionName) override;
1109 wxAccStatus GetFocus (int *childId, wxAccessible **child) override;
1111 wxAccStatus GetLocation (wxRect &rect, int elementId) override;
1113 wxAccStatus GetValue (int childId, wxString *strValue) override;
1114 wxAccStatus GetRole (int childId, wxAccRole *role) override;
1115private:
1116 Cell *const m_cell;
1117};
1118#endif
1119
1121template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type = true>
1122inline auto OnList(const C *cell) { return CellListAdapter<const C>(cell); }
1123template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type = true>
1124inline auto OnList(C *cell) { return CellListAdapter<C>(cell); }
1125
1127template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type = true>
1128inline auto OnDrawList(const C *cell) { return CellDrawListAdapter<const C>(cell); }
1129template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type = true>
1130inline auto OnDrawList(C *cell) { return CellDrawListAdapter<C>(cell); }
1131
1133template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type>
1134inline auto OnInner(const C *cell) { return InnerCellAdapter(const_cast<Cell *>(cell)); }
1135template <typename C, typename std::enable_if<std::is_base_of<Cell, C>::value, bool>::type>
1136inline auto OnInner(C *cell) { return InnerCellAdapter(cell); }
1137
1138inline size_t InnerCellIterator::GetInnerCellCount(const Cell *cell) { return cell->GetInnerCellCount(); }
1139inline Cell *InnerCellIterator::GetInnerCell(const Cell *cell, size_t index) { return cell->GetInnerCell(index); }
1140
1141#endif // CELL_H
Declares "mostly read-only" wrappers around values that are expensive to compute and are thus cached.
Declares the various iterators useful with the Cell class.
Implementation of an observing weak Cell pointer.
auto OnList(const C *cell)
Returns an iterable the goes over the cell list, starting with given, possibly null,...
Definition: Cell.h:1122
std::ostream & operator<<(std::ostream &out, const CellType celltype)
Allow Standard c++ streams to print out our enum values as text.
Definition: Cell.cpp:1447
auto OnDrawList(const C *cell)
Returns an iterable that goes over the cell draw list, starting with given, possibly null,...
Definition: Cell.h:1128
CellType
The supported types of math cells.
Definition: Cell.h:64
@ MC_TYPE_WARNING
A warning output by maxima.
Definition: Cell.h:70
@ MC_TYPE_PROMPT
Maxima questions or lisp prompts.
Definition: Cell.h:67
@ MC_TYPE_SECTION
A section name.
Definition: Cell.h:78
@ MC_TYPE_ASCIIMATHS
Equations displayed in 2D.
Definition: Cell.h:73
@ MC_TYPE_LABEL
An output label generated by maxima.
Definition: Cell.h:68
@ MC_TYPE_GROUP
A group cells that bundles several individual cells together.
Definition: Cell.h:82
@ MC_TYPE_MAIN_PROMPT
Input labels.
Definition: Cell.h:66
@ MC_TYPE_SUBSECTION
A subsection name.
Definition: Cell.h:74
@ MC_TYPE_INPUT
A cell containing code.
Definition: Cell.h:69
@ MC_TYPE_HEADING5
A subsubsection name.
Definition: Cell.h:76
@ MC_TYPE_TITLE
The title of the document.
Definition: Cell.h:79
@ MC_TYPE_SLIDE
An animation created by the with_slider_* maxima commands.
Definition: Cell.h:81
@ MC_TYPE_SUBSUBSECTION
A subsubsection name.
Definition: Cell.h:75
@ MC_TYPE_HEADING6
A subsubsection name.
Definition: Cell.h:77
@ MC_TYPE_TEXT
Text that isn't passed to maxima.
Definition: Cell.h:72
@ MC_TYPE_IMAGE
An image.
Definition: Cell.h:80
@ MC_TYPE_ERROR
An error output by maxima.
Definition: Cell.h:71
auto OnInner(const C *cell)
Returns an iterable that goes over the inner cells of this cell.
Definition: Cell.h:1134
This file declares everything needed for the text style system used to style all the elements on the ...
TextStyle
All text styles known to wxMaxima.
Definition: TextStyle.h:231
A Type-Safe Fixed-Point Font Size.
Definition: FontAttribs.h:98
Definition: diagrams_c.h:5
Definition: CellIterators.h:120
Definition: CellIterators.h:70
Definition: CellList.h:151
The storage for pointers to cells.
Definition: CellPointers.h:45
A weak non-owning pointer that becomes null whenever the observed object is destroyed.
Definition: CellPtr.h:480
A class that carries information about the type of a cell.
Definition: Cell.h:93
virtual const wxString & GetName() const =0
The name of the cell type, e.g.
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:142
bool ConfigChanged() const
Has the configuration changed since the last recalculation of this cell?
Definition: Cell.h:487
virtual wxString ToMatlab() const
Convert this cell to its Matlab representation.
Definition: Cell.cpp:655
virtual const wxString GetToolTip(wxPoint point) const
Returns the ToolTip this cell provides at a given point.
Definition: Cell.cpp:49
bool InUpdateRegion() const
Is this cell inside the region that is currently drawn?
Definition: Cell.cpp:567
virtual void DrawBoundingBox(wxDC &WXUNUSED(dc), bool all=false)
Draw a rectangle that marks this cell or this list of cells as selected.
Definition: Cell.cpp:595
bool IsBrokenIntoLines() const
Whether this cell is broken into two or more lines.
Definition: Cell.h:897
void SetPen(wxDC *dc, double lineWidth=1.0) const
Sets the drawing pen to the cell's default foreground color.
Definition: Cell.cpp:1115
void CopyCommonData(const Cell &cell)
Copy common data (used when copying a cell)
Definition: Cell.cpp:172
virtual void PasteFromClipboard(bool primary=false)
Paste from the clipboard into this cell.
Definition: Cell.cpp:957
bool IsHidden() const
Whether this cell is not to be drawn.
Definition: Cell.h:754
Range GetCellsInRect(const wxRect &rect) const
Returns the first and last cells within the given rectangle, recursing into the inner cells.
Definition: Cell.cpp:992
virtual size_t GetInnerCellCount() const
The number of inner cells - for use by the iterators.
Definition: Cell.cpp:1438
void ResetSize_RecursivelyList() const
Mark all cached size information of this cell list as "to be calculated".
Definition: Cell.cpp:1046
virtual int GetImageBorderWidth() const
0 for ordinary cells, 1 for slide shows and diagrams displayed with a 1-pixel border
Definition: Cell.h:863
virtual wxString ToOMML() const
Returns the cell's representation as OMML.
Definition: Cell.cpp:870
void SetBigSkip(bool skip)
Tell this cell to cause an additional vertical space.
Definition: Cell.h:527
bool HasBigSkip() const
Does this cell come with an additional vertical space.
Definition: Cell.h:529
virtual void UnbreakList() const
Unbreak this line.
Definition: Cell.cpp:1099
wxRect CropToUpdateRegion(wxRect rect) const
The part of the rectangle rect that is in the region that is currently drawn.
Definition: Cell.cpp:228
void SoftLineBreak(bool breakLine=true) const
Do we want this cell to start with a linebreak?
Definition: Cell.h:230
Cell * GetNextToDraw() const
Get the next cell that needs to be drawn.
Definition: Cell.h:713
CellPtr< GroupCell > m_group
The GroupCell this list of cells belongs to.
Definition: Cell.h:984
virtual wxString ListToMatlab() const
Convert this list to its LaTeX representation.
Definition: Cell.cpp:657
virtual wxString ListToOMML(bool startofline=false) const
Convert this list to an OMML representation.
Definition: Cell.cpp:872
GroupCell * GetGroup() const
Returns the group cell this cell belongs to.
Definition: Cell.cpp:243
virtual bool IsActive() const
Is this editor cell focused?
Definition: Cell.h:850
Configuration * GetConfiguration()
Which configuration object is responsible for this cell?
Definition: Cell.h:305
virtual wxString ListToString() const
Returns this cell list's representation as a string.
Definition: Cell.cpp:625
void BreakUpAndMark() const
Break up the internal cells of this cell, and mark it as broken up.
Definition: Cell.cpp:1075
void ForceBreakLine(bool force=true) const
Insert (or remove) a forced linebreak at the beginning of this cell.
Definition: Cell.h:350
virtual wxRect GetRect(bool wholeList=false) const
Get the smallest rectangle this cell fits in.
Definition: Cell.cpp:558
wxCoord GetHeightList() const
Returns the total height of this line.
Definition: Cell.cpp:281
virtual void FontsChanged() const
To be called if the font has changed.
Definition: Cell.h:1075
wxCoord GetCenterList() const
Returns the maximum distance between top and center of this line.
Definition: Cell.cpp:259
virtual void SetCurrentPoint(wxPoint point)
Tells this cell where it is placed on the worksheet.
Definition: Cell.h:885
CellPtr< Cell > m_nextToDraw
The next cell in the draw list. This has been factored into Cell temporarily to reduce the change "no...
Definition: Cell.h:987
void ClearToolTip()
Remove this cell's tooltip.
Definition: Cell.cpp:343
wxCoord GetHeight() const
Get the height of this cell.
Definition: Cell.h:360
Cell * GetNext() const
Get the next cell in the list.
Definition: Cell.h:706
virtual void SelectAll()
Select all editable text of this cell.
Definition: Cell.h:820
bool HasValidPosition() const
Is the position valid?
Definition: Cell.cpp:454
virtual void Unbreak() const
Undo breaking this cell into multiple lines.
Definition: Cell.cpp:1088
int GetLineIndent() const
If this were the beginning of a line: How far do we need to indent it?
Definition: Cell.cpp:469
virtual void SetValue(const wxString &WXUNUSED(text))
Allows to change the text a TextCell contains.
Definition: Cell.h:567
wxCoord Scale_Px(double px) const
Scale font sizes and line widths according to the zoom factor.
Definition: Cell.h:176
bool ContainsPoint(wxPoint point) const
Is a given point inside this cell?
Definition: Cell.h:285
virtual bool IsShortNum() const
True if this cell represents a short number.
Definition: Cell.h:603
CellType GetType() const
Returns the type of this cell.
Definition: Cell.h:424
void SetTextColor(wxDC *dc)
Sets the text color.
Definition: Cell.cpp:1130
void DrawList(wxPoint point, wxDC *dc, wxDC *adc)
Draw this list of cells.
Definition: Cell.cpp:401
virtual bool CanCopy() const
Select Can we copy the editable text of this cell?
Definition: Cell.h:824
virtual wxString ListToMathML(bool startofline=false) const
Convert this list to a MathML representation.
Definition: Cell.cpp:705
virtual wxString ListToTeX() const
Convert this list to its LaTeX representation.
Definition: Cell.cpp:690
Cell * GetPrevious() const
Returns a pointer to the previous cell in the current cell list.
Definition: Cell.h:703
virtual const wxString & GetAltCopyText() const
Get the text set using SetAltCopyText - may be empty.
Definition: Cell.h:925
bool GetHidableMultSign() const
Whether this is a hidable multiplication sign.
Definition: Cell.h:910
bool HasHardLineBreak() const
Does this cell begin with a manual linebreak?
Definition: Cell.h:252
unsigned long CellsInListRecursive() const
How many cells does this cell contain?
Definition: Cell.cpp:216
virtual bool FirstLineOnlyEditor() const
True, if this GroupCell is folded and its editor shows only its first line.
Definition: Cell.cpp:157
virtual wxString ToString() const
Returns the cell's representation as a string.
Definition: Cell.cpp:609
void SetConfigurationList(Configuration *config)
Tell this cell list to use the configuration object config.
Definition: Cell.cpp:458
void AddToolTip(const wxString &tip)
Add another tooltip to this cell.
Definition: Cell.cpp:370
Cell * last() const
Get the last cell in this list of cells.
Definition: Cell.cpp:1064
virtual void ClearCache()
Clears memory from cached items automatically regenerated when the cell is drawn.
Definition: Cell.h:292
bool GetSuppressMultiplicationDot() const
Do we want to begin this cell with a center dot if it is part of a product?
Definition: Cell.h:907
virtual wxString ListToRTF(bool startofline=false) const
Convert this list to an RTF representation.
Definition: Cell.cpp:901
virtual void SetIsExponent()
Tell this cell to be an exponent.
Definition: Cell.cpp:395
bool GetHighlight() const
Is this cell highlighted (e.G. inside a maxima box)
Definition: Cell.h:549
static wxString RTFescape(wxString, bool MarkDown=false)
Escape a string for RTF.
Definition: Cell.cpp:836
bool HasStaleSize() const
Is the size valid, whether a recalculation is pending or not?
Definition: Cell.cpp:450
void SetHighlight(bool highlight)
Mark this cell as highlighted (e.G. being in a maxima box)
Definition: Cell.h:547
bool HasValidSize() const
Is the size valid and not pending a recalculation?
Definition: Cell.cpp:446
bool IsEditable(bool input=false) const
Is this cell editable?
Definition: Cell.h:766
wxCoord GetCurrentY() const
Get the y position of the top left of this cell.
Definition: Cell.h:470
virtual void SetIsExponentList()
Tell this list of cells to be an exponent.
Definition: Cell.cpp:389
virtual wxString ListToXML() const
Convert this list to a representation fit for saving in a .wxmx file.
Definition: Cell.cpp:959
bool BreakLineHere() const
Are we allowed to break a line here?
Definition: Cell.h:249
void ResetSizeList() const
Mark the cached height information of the whole list of cells as "to be calculated".
Definition: Cell.cpp:413
virtual wxString GetDiffPart() const
Get the part for diff tag support.
Definition: Cell.cpp:984
Range GetListCellsInRect(const wxRect &rect) const
Returns the first and last cells within the given rectangle, without recursing into the inner cells.
Definition: Cell.cpp:999
void RecalculateList(AFontSize fontsize) const
Recalculate both width and height of this list of cells.
Definition: Cell.cpp:408
wxCoord GetCenter() const
Get the distance between the top and the center of this cell.
Definition: Cell.h:391
wxPoint m_currentPoint
The point in the work sheet at which this cell begins.
Definition: Cell.h:961
virtual void Draw(wxPoint point, wxDC *dc, wxDC *antialiassingDC)
Draw this cell.
Definition: Cell.cpp:308
bool DrawThisCell()
Is this cell currently visible in the window?
Definition: Cell.h:342
void ClearCacheList()
Clears the cache of the whole list of cells starting with this one.
Definition: Cell.cpp:211
virtual void Hide(bool hide=true)
Hide this cell. See IsHidden() for details.
Definition: Cell.h:760
virtual void SelectPointText(wxPoint point)
Select the text at point.
Definition: Cell.cpp:953
void SetCurrentPoint(int x, int y)
Tells this cell where it is placed on the worksheet.
Definition: Cell.h:887
virtual wxString ToXML() const
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: Cell.cpp:701
virtual void SetAltCopyText(const wxString &text)
What should end up if placing this cell on the clipboard?
Definition: Cell.cpp:382
virtual void SelectRectText(wxPoint one, wxPoint two)
Select the text between the two points.
Definition: Cell.cpp:955
virtual wxString ToMathML() const
Convert this cell to a representation fit for saving in a .wxmx file.
Definition: Cell.cpp:703
bool ContainsRect(const wxRect &sm, bool all=true) const
Is a part of this cell inside a certain rectangle?
Definition: Cell.cpp:1024
wxCoord SumOfWidths() const
How many pixels is this list of cells wide, if we don't break it into lines?
Definition: Cell.cpp:283
wxString VariablesAndFunctionsList() const
Returns all variable and function names used inside this list of cells.
Definition: Cell.cpp:613
virtual ~Cell()
Delete this list of cells.
Definition: Cell.cpp:71
AFontSize Scale_Px(AFontSize size) const
Scale font sizes and line widths according to the zoom factor.
Definition: Cell.h:181
virtual bool NeedsRecalculation(AFontSize fontSize) const
True, if something that affects the cell size has changed.
Definition: Cell.cpp:251
virtual void SetStyle(TextStyle style)
Sets the TextStyle of this cell.
Definition: Cell.h:854
virtual const CellTypeInfo & GetInfo()=0
Returns the information about this cell's type.
virtual std::unique_ptr< Cell > Copy(GroupCell *group) const =0
Create a copy of this cell.
void ScheduleRecalculation() const
Cause this cell to be recalculated the next time.
Definition: Cell.h:485
wxCoord GetLineWidth() const
How many pixels is the current line of this list of cells wide?
Definition: Cell.cpp:291
wxCoord m_height
The height of this cell.
Definition: Cell.h:1005
void SetNextToDraw(const std::unique_ptr< T, Del > &ptr)
Tells this cell which one should be the next cell to be drawn.
Definition: Cell.h:732
virtual wxPoint PositionToPoint()
Locates the cursor in the editable text of this cell.
Definition: Cell.h:832
void SetToolTip(const wxString &tooltip) const
Set the tooltip to a given string.
Definition: Cell.cpp:350
virtual void SetConfiguration(Configuration *config)
Tell this cell to use the configuration object config.
Definition: Cell.cpp:463
virtual wxString GnuplotSource() const
Retrieve the gnuplot source data for this image.
Definition: Cell.h:780
wxCoord GetMaxDrop() const
Returns the maximum distance between center and bottom of this line.
Definition: Cell.cpp:270
static wxString XMLescape(wxString)
Escape a string for XML.
Definition: Cell.cpp:817
wxCoord m_center
The distance between the top and the insertion point of this cell.
Definition: Cell.h:1016
virtual Cell * GetInnerCell(size_t index) const
Retrieve an inner cell with given index which must be less than GetInnerCellCount.
Definition: Cell.cpp:1440
virtual const wxString & GetValue() const
Gets the text this text cell contains.
Definition: Cell.cpp:1128
Configuration * m_configuration
A pointer to the configuration responsible for this worksheet.
Definition: Cell.h:990
int GetWidth() const
Get the width of this cell.
Definition: Cell.h:375
virtual void SetNextToDraw(Cell *next) const
Tells this cell which one should be the next cell to be drawn.
Definition: Cell.h:722
virtual wxString ToTeX() const
Convert this cell to its LaTeX representation.
Definition: Cell.cpp:688
void ResetSize() const
Mark the cached height and width information as "to be calculated".
Definition: Cell.cpp:1051
wxPoint GetCurrentPoint() const
Where is this cell placed on the worksheet?
Definition: Cell.h:889
wxCoord m_width
The width of this cell; is recalculated by RecalculateHeight.
Definition: Cell.h:1009
virtual void SetFocus(bool WXUNUSED(focus))
Focus this editor cell.
Definition: Cell.h:843
virtual void ProcessEvent(wxKeyEvent &WXUNUSED(event))
Processes a key event.
Definition: Cell.h:783
wxCoord GetCurrentX() const
Get the x position of the top left of this cell.
Definition: Cell.h:463
bool IsComment() const
Determine if this cell contains text that isn't code.
Definition: Cell.h:738
bool BreakUpCells() const
Cell list: Convert 2d math objects bigger than the screen width into linear form.
Definition: Cell.cpp:525
static wxString OMML2RTF(wxXmlNode *node)
Converts an OMML tag to the corresponding RTF snippet.
Definition: Cell.cpp:766
bool UnBreakUpCells() const
Convert all maths objects in this call list into their 2D form.
Definition: Cell.cpp:542
virtual void SetType(CellType type)
Sets the text style according to the type.
Definition: Cell.cpp:79
AFontSize m_fontSize_Scaled
The font size is smaller in super- and subscripts.
Definition: Cell.h:1021
virtual Range GetInnerCellsInRect(const wxRect &rect) const
Select the cells inside this cell described by the rectangle rect.
Definition: Cell.cpp:1011
virtual bool BreakUp() const
Try to split this command into lines to make it fit on the screen.
Definition: Cell.cpp:1073
bool IsCompound() const
Do we have an operator in this line - draw () in frac...
Definition: Cell.cpp:602
wxBitmap BitmapFromSVG(wxString svgData, wxSize size)
Renders a bitmap from svgData at the requested size.
Definition: Cell.cpp:135
void ResetSize_Recursively() const
Mark all cached size information as "to be calculated".
Definition: Cell.cpp:1039
std::unique_ptr< Cell > CopyList(GroupCell *group) const
Return a copy of the list of cells beginning with this one.
Definition: Cell.cpp:191
virtual bool IsDirty() const
Is this cell marked as "from an old maxima run"?
Definition: Cell.h:836
friend auto OnInner(const C *cell)
Returns an iterable that goes over the inner cells of this cell.
Definition: Cell.h:1134
virtual bool CutToClipboard()
Cut this cell's editable contents to the clipboard.
Definition: Cell.h:816
virtual bool IsOperator() const
Is this cell an operator?
Definition: Cell.h:597
bool IsMath() const
Is this cell possibly output of maxima?
Definition: Cell.cpp:1159
virtual bool CanPopOut() const
Can this cell be popped out interactively in gnuplot?
Definition: Cell.h:774
wxCoord GetDrop() const
Get the distance between the center and the bottom of this cell.
Definition: Cell.h:418
virtual void Recalculate(AFontSize fontsize) const
Recalculate the size of the cell and the difference between top and center.
Definition: Cell.cpp:422
void FontsChangedList()
Tell a whole list of cells that their fonts have changed.
Definition: Cell.cpp:235
virtual bool AddEnding()
Add a semicolon to a code cell, if needed.
Definition: Cell.h:790
const wxString * m_toolTip
This tooltip is owned by us when m_ownsToolTip is true. Otherwise, it points to a "static" string.
Definition: Cell.h:994
virtual bool CopyToClipboard() const
Copy this cell's editable contents to the clipboard.
Definition: Cell.h:810
void SetBrush(wxDC *dc) const
Sets the fill brush to the cell's default foreground color.
Definition: Cell.cpp:1123
const TextStyle & GetTextStyle() const
Get the text style.
Definition: Cell.h:535
Cell * first() const
Get the first cell in this list of cells.
Definition: Cell.cpp:1055
virtual wxString ToRTF() const
Returns the cell's representation as RTF.
Definition: Cell.h:647
virtual wxPoint PositionToPoint(size_t WXUNUSED(pos))
Locates a char in the editable text of this cell.
Definition: Cell.h:828
The configuration storage for the current worksheet.
Definition: Configuration.h:84
std::int_fast32_t CellCfgCnt() const
A counter that increases every time we need to recalculate all worksheet cells.
Definition: Configuration.h:1078
wxCoord Scale_Px(double px) const
Scales a distance [in pixels] according to the zoom factor.
Definition: Configuration.cpp:1389
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
Definition: CellIterators.h:210
Iterates the inner cells of a cell.
Definition: CellIterators.h:138
Objects deriving from this class can be observed by the CellPtr.
Definition: CellPtr.h:88
A Text cell.
Definition: TextCell.h:38
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:95
A struct that allows to specify a region of a cell list.
Definition: Cell.h:579
For the bitmap export we sometimes want to know how big the result will be...
Definition: Cell.h:610