wxMaxima
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
TextCell Class Reference

#include <TextCell.h>

Inheritance diagram for TextCell:
Inheritance graph
[legend]
Collaboration diagram for TextCell:
Collaboration graph
[legend]

Classes

struct  SizeEntry
 

Public Member Functions

 TextCell (GroupCell *group, Configuration **config, const wxString &text={}, TextStyle style=TS_FUNCTION)
 
 TextCell (GroupCell *group, const TextCell &cell)
 
virtual const CellTypeInfoGetInfo () override
 Returns the information about this cell's type.
 
std::unique_ptr< CellCopy (GroupCell *group) const override
 
AFontSize GetScaledTextSize () const
 
virtual void SetStyle (TextStyle style) override
 Sets the TextStyle of this cell.
 
void SetValue (const wxString &text) override
 Set the text contained in this cell.
 
virtual void Recalculate (AFontSize fontsize) override
 
void Draw (wxPoint point) override
 
void SetFont (AFontSize fontsize)
 
void DontEscapeOpeningParenthesis ()
 
wxString ToMatlab () const override
 Convert this cell to its Matlab representation.
 
wxString ToMathML () const override
 Convert this cell to a representation fit for saving in a .wxmx file.
 
wxString ToOMML () const override
 
wxString ToRTF () const override
 
virtual wxString ToString () const override
 Returns the cell's representation as a string.
 
wxString ToTeX () const override
 Convert this cell to its LaTeX representation.
 
wxString ToXML () const override
 Convert this cell to a representation fit for saving in a .wxmx file.
 
bool IsOperator () const override
 Is this cell an operator?
 
const wxString & GetValue () const override
 
wxString GetGreekStringTeX () const
 
wxString GetSymbolTeX () const
 
wxString GetGreekStringUnicode () const
 
wxString GetSymbolUnicode (bool keepPercent) const
 
bool IsShortNum () const override
 
void SetType (CellType type) override
 Sets the text style according to the type.
 
void SetAltCopyText (const wxString &text) override
 
void SetPromptTooltip (bool use)
 
- Public Member Functions inherited from Cell
 Cell (GroupCell *group, Configuration **config)
 
int Scale_Px (double px) const
 
AFontSize Scale_Px (AFontSize size) const
 
virtual const wxString & GetToolTip (wxPoint point) const
 
virtual ~Cell ()
 Delete this list of cells.
 
int CellsInListRecursive () const
 How many cells does this cell contain? More...
 
wxRect CropToUpdateRegion (wxRect rect) const
 The part of the rectangle rect that is in the region that is currently drawn.
 
bool InUpdateRegion () const
 Is this cell inside the region that is currently drawn?
 
bool SoftLineBreak (bool breakLine=true)
 Do we want this cell to start with a linebreak?
 
bool BreakLineHere () const
 Are we allowed to break a line here?
 
bool HasHardLineBreak () const
 Does this cell begin with a manual linebreak?
 
virtual bool BreakUp ()
 
bool ContainsRect (const wxRect &sm, bool all=true) const
 
bool ContainsPoint (wxPoint point) const
 
virtual void ClearCache ()
 
void ClearCacheList ()
 
void SetConfigurationList (Configuration **config)
 
virtual void SetConfiguration (Configuration **config)
 
ConfigurationGetConfiguration ()
 
void Draw ()
 
void DrawList (wxPoint point)
 
void DrawList ()
 
virtual void DrawBoundingBox (wxDC &WXUNUSED(dc), bool all=false)
 
bool DrawThisCell (wxPoint point)
 
bool DrawThisCell ()
 
void ForceBreakLine (bool force=true)
 
int GetHeight () const
 
int GetWidth () const
 
int GetCenter () const
 
bool HasValidSize () const
 Is the size valid and not pending a recalculation?
 
bool HasStaleSize () const
 Is the size valid, whether a recalculation is pending or not?
 
bool HasValidPosition () const
 Is the position valid?
 
int GetDrop () const
 
CellType GetType () const
 
int GetMaxDrop () const
 
int GetCenterList () const
 
int GetHeightList () const
 
int GetFullWidth () const
 How many pixels is this list of cells wide, if we don't break it into lines?
 
int GetLineWidth () const
 
int GetCurrentX () const
 
int GetCurrentY () const
 
virtual wxRect GetRect (bool all=false) const
 
virtual wxString GetDiffPart () const
 
void RecalculateList (AFontSize fontsize)
 
void FontsChangedList ()
 Tell a whole list of cells that their fonts have changed.
 
void ClearNeedsToRecalculateWidths ()
 
void ResetData ()
 Mark all cached size information as "to be calculated". More...
 
void ResetDataList ()
 
void ResetSize ()
 Mark the cached height and width information as "to be calculated".
 
void ResetCellListSizes ()
 Mark the line and cell list widths and heights as "to be calculated".
 
void ResetCellListSizesList ()
 Mark the line and cell list widths and heights as "to be calculated".
 
void SetZeroSize ()
 
void ResetSizeList ()
 Mark the cached height information of the whole list of cells as "to be calculated".
 
void SetBigSkip (bool skip)
 
bool HasBigSkip () const
 
TextStyle GetStyle () const
 
void SetPen (double lineWidth=1.0) const
 Sets the drawing pen to the cell's default foreground color.
 
void SetBrush () const
 Sets the fill brush to the cell's default foreground color.
 
wxColour GetForegroundColor () const
 
void SetHighlight (bool highlight)
 Mark this cell as highlighted (e.G. being in a maxima box)
 
bool GetHighlight () const
 Is this cell highlighted (e.G. inside a maxima box)
 
virtual void SetExponentFlag ()
 
virtual void SetValue (const wxString &WXUNUSED(text))
 
Cellfirst () const
 Get the first cell in this list of cells.
 
Celllast () const
 Get the last cell in this list of cells.
 
Range GetCellsInRect (const wxRect &rect) const
 
Range GetListCellsInRect (const wxRect &rect) const
 
virtual Range GetInnerCellsInRect (const wxRect &rect) const
 Select the cells inside this cell described by the rectangle rect.
 
bool IsCompound () const
 Do we have an operator in this line - draw () in frac...
 
GroupCellGetGroup () const
 Returns the group cell this cell belongs to.
 
virtual wxString ListToString () const
 Returns the list's representation as a string.
 
wxString VariablesAndFunctionsList () const
 
virtual wxString ListToMatlab () const
 Convert this list to its LaTeX representation.
 
virtual wxString ListToTeX () const
 Convert this list to its LaTeX representation.
 
virtual wxString ListToXML () const
 Convert this list to a representation fit for saving in a .wxmx file.
 
virtual wxString ListToMathML (bool startofline=false) const
 Convert this list to a MathML representation.
 
virtual wxString ListToOMML (bool startofline=false) const
 Convert this list to an OMML representation.
 
virtual wxString ListToRTF (bool startofline=false) const
 Convert this list to an RTF representation.
 
virtual void Unbreak ()
 
virtual void UnbreakList ()
 
CellGetPrevious () const
 
CellGetNext () const
 Get the next cell in the list.
 
CellGetNextToDraw () const
 
virtual void SetNextToDraw (Cell *next)
 
template<typename T , typename Del , typename std::enable_if< std::is_base_of< Cell, T >::value, bool >::type = true>
void SetNextToDraw (const std::unique_ptr< T, Del > &ptr)
 
bool IsComment () const
 
bool IsHidden () const
 
virtual void Hide (bool hide=true)
 
bool IsEditable (bool input=false) const
 
virtual bool CanPopOut () const
 Can this cell be popped out interactively in gnuplot?
 
virtual wxString GnuplotSource () const
 
virtual void ProcessEvent (wxKeyEvent &WXUNUSED(event))
 Processes a key event.
 
virtual bool AddEnding ()
 
virtual void SelectPointText (wxPoint point)
 
virtual void SelectRectText (wxPoint one, wxPoint two)
 
virtual void PasteFromClipboard (bool primary=false)
 
virtual bool CopyToClipboard () const
 
virtual bool CutToClipboard ()
 
virtual void SelectAll ()
 
virtual bool CanCopy () const
 
virtual wxPoint PositionToPoint (int WXUNUSED(pos)=-1)
 
virtual bool IsDirty () const
 
virtual void SwitchCaretDisplay ()
 
virtual void SetFocus (bool WXUNUSED(focus))
 
void SetForeground ()
 Sets the foreground color.
 
virtual bool IsActive () const
 
bool IsMath () const
 Is this cell possibly output of maxima?
 
virtual int GetImageBorderWidth () const
 0 for ordinary cells, 1 for slide shows and diagrams displayed with a 1-pixel border
 
void CopyCommonData (const Cell &cell)
 Copy common data (used when copying a cell)
 
std::unique_ptr< CellCopyList (GroupCell *group) const
 Return a copy of the list of cells beginning with this one.
 
void ClearToolTip ()
 Remove this cell's tooltip.
 
void SetToolTip (wxString &&toolTip)
 Set the tooltip to a given temporary string - the cell will move from it.
 
void SetToolTip (const wxString *tooltip)
 
void AddToolTip (const wxString &tip)
 Add another tooltip to this cell.
 
virtual void SetCurrentPoint (wxPoint point)
 Tells this cell where it is placed on the worksheet.
 
void SetCurrentPoint (int x, int y)
 Tells this cell where it is placed on the worksheet.
 
wxPoint GetCurrentPoint () const
 Where is this cell placed on the worksheet?
 
bool IsBrokenIntoLines () const
 
bool GetSuppressMultiplicationDot () const
 
void SetSuppressMultiplicationDot (bool val)
 
bool GetHidableMultSign () const
 Whether this is a hidable multiplication sign.
 
void SetHidableMultSign (bool val)
 
const wxString & GetLocalToolTip () const
 
- Public Member Functions inherited from Observed
bool IsNull () const
 
bool HasControlBlock () const
 
bool HasOneCellPtr () const
 

Protected Types

enum  TextIndex : int8_t {
  noText, cellText, userLabelText, numberStart,
  ellipsis, numberEnd
}
 

Protected Member Functions

virtual wxString GetXMLFlags () const
 Returns the XML flags this cell needs in wxMathML.
 
virtual void UpdateDisplayedText ()
 The text we actually display depends on many factors, unfortunately. More...
 
void UpdateToolTip ()
 Update the tooltip for this cell.
 
const wxString & GetAltCopyText () const override
 Get the text set using SetAltCopyText - may be empty.
 
void FontsChanged () override
 To be called if the font has changed.
 
virtual bool NeedsRecalculation (AFontSize fontSize) const override
 True, if something that affects the cell size has changed.
 
wxSize CalculateTextSize (wxDC *dc, const wxString &text, TextCell::TextIndex const index)
 
void InitBitFields ()
 
- Protected Member Functions inherited from Cell
void BreakUpAndMark ()
 Break up the internal cells of this cell, and mark it as broken up.
 
std::unique_ptr< CellMakeVisiblyInvalidCell () const
 
virtual int GetInnerCellCount () const
 The number of inner cells - for use by the iterators.
 
virtual CellGetInnerCell (int index) const
 
WorksheetGetWorksheet () const
 
CellPointersGetCellPointers () const
 
void InvalidateMaxDrop ()
 

Protected Attributes

wxString m_altCopyText
 
wxString m_text
 The text we keep inside this cell.
 
wxString m_displayedText
 The text we display: We might want to convert some characters or do similar things.
 
std::vector< SizeEntrym_sizeCache
 
bool m_dontEscapeOpeningParenthesis: 1
 Is an ending "(" of a function name the opening parenthesis of the function?
 
bool m_promptTooltip: 1
 Default to a special tooltip for prompts?
 
bool m_keepPercent_last: 1
 The last known value of CheckKeepPercent.
 
- Protected Attributes inherited from Cell
wxPoint m_currentPoint {-1, -1}
 
CellPtr< GroupCellm_group
 
CellPtr< Cellm_nextToDraw
 
Configuration ** m_configuration
 
const wxString * m_toolTip
 
int m_height = -1
 The height of this cell.
 
int m_width = -1
 The width of this cell; is recalculated by RecalculateHeight.
 
int m_center = -1
 
AFontSize m_fontSize_Scaled = {}
 The font size is smaller in super- and subscripts.
 
CellType m_type = MC_TYPE_DEFAULT
 
TextStyle m_textStyle = TS_DEFAULT
 

Static Protected Attributes

static wxRegEx m_unescapeRegEx
 
static wxRegEx m_roundingErrorRegEx1
 
static wxRegEx m_roundingErrorRegEx2
 
static wxRegEx m_roundingErrorRegEx3
 
static wxRegEx m_roundingErrorRegEx4
 

Additional Inherited Members

- Static Public Member Functions inherited from Cell
static wxString OMML2RTF (wxXmlNode *node)
 Converts an OMML tag to the corresponding RTF snippet.
 
static wxString OMML2RTF (wxString ommltext)
 Converts OMML math to RTF math.
 
static wxString RTFescape (wxString, bool MarkDown=false)
 Escape a string for RTF.
 
static wxString XMLescape (wxString)
 Escape a string for XML.
 
static std::unique_ptr< CellCopyList (GroupCell *group, const Cell *cell)
 Return a copy of the given list of cells.
 
static std::unique_ptr< CellMakeVisiblyInvalidCell (GroupCell *group, Configuration **config)
 
- Static Public Member Functions inherited from Observed
static size_t GetLiveInstanceCount ()
 
static size_t GetLiveControlBlockInstanceCount ()
 

Detailed Description

A Text cell

Everything on the worksheet that is composed of characters with the exception of input cells: Input cells are handled by EditorCell instead.

Member Function Documentation

◆ Copy()

std::unique_ptr<Cell> TextCell::Copy ( GroupCell group) const
overridevirtual

Create a copy of this cell

This method is purely virtual, which means every child class has to define its own Copy() method.

Implements Cell.

◆ DontEscapeOpeningParenthesis()

void TextCell::DontEscapeOpeningParenthesis ( )
inline

Calling this function signals that the "(" this cell ends in isn't part of the function name

The "(" is the opening parenthesis of a function instead.

◆ Draw()

void TextCell::Draw ( wxPoint  point)
overridevirtual

Draw this cell

Parameters
pointThe x and y position this cell is drawn at: All top-level cells get their position during recalculation. But for the cells within them the position needs a second step after determining the dimension of the contents of the top-level cell.

Example: The position of the denominator of a fraction can only be determined after the height of denominator and numerator are known.

Draw this cell to dc

To make this work each derived class must draw the content of the cell and then call MathCall::Draw(...).

Reimplemented from Cell.

◆ Recalculate()

void TextCell::Recalculate ( AFontSize  fontsize)
overridevirtual

Recalculate the size of the cell and the difference between top and center

Must set: m_height, m_width, m_center.

Parameters
fontsizeIn exponents, super- and subscripts the font size is reduced. This cell therefore needs to know which font size it has to be drawn at.

Hidden cells (multiplication * is not displayed)

Reimplemented from Cell.

Reimplemented in LabelCell, DigitCell, and LongNumberCell.

◆ SetAltCopyText()

void TextCell::SetAltCopyText ( const wxString &  text)
inlineoverridevirtual

What should end up if placing this cell on the clipboard?

AltCopyTexts for example make sense for subCells: a_n looks like a[n], even if both are lookalikes and the cell therefore needs to know what to put on the clipboard if this cell were copied. They also make sense in many other places we may never have thought about. But since we seriously want to save memory space on the ubiuitous TextCells it might be scary to apply this principle to them, at least if you know that text you copy from the internet to a terminal might contain additional commands with TextSize=0...

Reimplemented from Cell.

◆ ToOMML()

wxString TextCell::ToOMML ( ) const
overridevirtual

Returns the cell's representation as OMML

If this method returns wxEmptyString this might mean that this cell is better handled in RTF; The OOML can later be translated to the respective RTF maths commands using OMML2RTF.

Don't know why OMML was implemented in a world that already knows MathML, though.

Reimplemented from Cell.

◆ ToRTF()

wxString TextCell::ToRTF ( ) const
overridevirtual

Returns the cell's representation as RTF.

If this method returns wxEmptyString this might mean that this cell is better handled in OMML.

Reimplemented from Cell.

◆ UpdateDisplayedText()

void TextCell::UpdateDisplayedText ( )
protectedvirtual

The text we actually display depends on many factors, unfortunately.

Change asterisk to a multiplication dot, if applicable

Reimplemented in LabelCell, and LongNumberCell.


The documentation for this class was generated from the following files: