LibreOffice Module starmath (master) 1
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
SmTextNode Class Reference

Text node. More...

#include <node.hxx>

Inheritance diagram for SmTextNode:
[legend]
Collaboration diagram for SmTextNode:
[legend]

Public Member Functions

 SmTextNode (const SmToken &rNodeToken, sal_uInt16 nFontDescP)
 
sal_uInt16 GetFontDesc () const
 Returns the font type being used (text, variable, symbol, ...). More...
 
void SetText (const OUString &rText)
 Sets the node text to rText. More...
 
const OUString & GetText () const
 Gets the node text. More...
 
OUString & GetText ()
 
void ChangeText (const OUString &rText)
 Change the text of this node, including the underlying token to rText. More...
 
void AdjustFontDesc ()
 Try to guess the correct FontDesc, used during visual editing. More...
 
sal_Int32 GetSelectionStart () const
 Index within GetText() where the selection starts. More...
 
sal_Int32 GetSelectionEnd () const
 Index within GetText() where the selection ends. More...
 
void SetSelectionStart (sal_Int32 index)
 Sets the index within GetText() where the selection starts to index. More...
 
void SetSelectionEnd (sal_Int32 index)
 Sets the index within GetText() where the selection ends to index. More...
 
virtual void Prepare (const SmFormat &rFormat, const SmDocShell &rDocShell, int nDepth) override
 Prepare preliminary settings about font and text (e.g. More...
 
virtual void Arrange (OutputDevice &rDev, const SmFormat &rFormat) override
 Prepares the SmRect to render. More...
 
virtual void GetAccessibleText (OUStringBuffer &rText) const override
 Appends to rText the node text. More...
 
void Accept (SmVisitor *pVisitor) override
 Accept a visitor. More...
 
- Public Member Functions inherited from SmVisibleNode
virtual bool IsVisible () const override
 Checks node visibility. More...
 
virtual size_t GetNumSubNodes () const override
 Gets the number of subnodes. More...
 
virtual SmNodeGetSubNode (size_t nIndex) override
 Gets the subnode of index nIndex. More...
 
virtual SmNodeGetSubNode (size_t nIndex)=0
 Gets the subnode of index nIndex. More...
 
const SmNodeGetSubNode (size_t nIndex) const
 Gets the subnode of index nIndex. More...
 
- Public Member Functions inherited from SmNode
 SmNode (const SmNode &)=delete
 
SmNodeoperator= (const SmNode &)=delete
 
virtual ~SmNode ()
 
virtual bool IsVisible () const =0
 Checks node visibility. More...
 
virtual size_t GetNumSubNodes () const =0
 Gets the number of subnodes. More...
 
virtual SmNodeGetSubNode (size_t nIndex)=0
 Gets the subnode of index nIndex. More...
 
const SmNodeGetSubNode (size_t nIndex) const
 
virtual const SmNodeGetLeftMost () const
 (this assumes the one with index 0 is always the leftmost subnode for the current node). More...
 
FontChangeMaskFlags ()
 Gets the FontChangeMask flags. More...
 
FontAttributeAttributes ()
 Gets the font attributes. More...
 
bool IsPhantom () const
 Checks if it is a visible node rendered invisible. More...
 
void SetPhantom (bool bIsPhantom)
 Sets the render visibility of a visible node to bIsPhantom. More...
 
void SetColor (const Color &rColor)
 Sets the font color. More...
 
void SetAttribute (FontAttribute nAttrib)
 Sets the font attribute nAttrib. More...
 
void ClearAttribute (FontAttribute nAttrib)
 Clears the font attribute nAttrib. More...
 
const SmFaceGetFont () const
 Gets the font. More...
 
SmFaceGetFont ()
 
void SetFont (const SmFace &rFace)
 Sets the font to rFace. More...
 
void SetFontSize (const Fraction &rRelSize, FontSizeType nType)
 Sets the font size to rRelSize with type nType. More...
 
void SetSize (const Fraction &rScale)
 Sets the font size to rRelSize with type FontSizeType::ABSOLUT. More...
 
virtual void Prepare (const SmFormat &rFormat, const SmDocShell &rDocShell, int nDepth)
 Prepare preliminary settings about font and text (e.g. More...
 
void PrepareAttributes ()
 Prepare preliminary font attributes Called on Prepare(...). More...
 
void SetRectHorAlign (RectHorAlign eHorAlign, bool bApplyToSubTree=true)
 Sets the alignment of the text. More...
 
RectHorAlign GetRectHorAlign () const
 Gets the alignment of the text. More...
 
const SmRectGetRect () const
 Parses itself to SmRect. More...
 
void Move (const Point &rVector)
 Moves the rectangle by rVector. More...
 
void MoveTo (const Point &rPoint)
 Moves the rectangle to rPoint, being the top left corner the origin. More...
 
virtual void Arrange (OutputDevice &rDev, const SmFormat &rFormat)=0
 Prepares the SmRect to render. More...
 
virtual void GetAccessibleText (OUStringBuffer &rText) const =0
 Appends to rText the node text. More...
 
sal_Int32 GetAccessibleIndex () const
 Gets the node accessible index. More...
 
void SetAccessibleIndex (sal_Int32 nAccIndex)
 Sets the node accessible index to nAccIndex. More...
 
const SmNodeFindNodeWithAccessibleIndex (sal_Int32 nAccIndex) const
 Finds the node with accessible index nAccIndex. More...
 
sal_uInt16 GetRow () const
 Gets the line in the text where the node is located. More...
 
sal_uInt16 GetColumn () const
 Gets the column of the line in the text where the node is located. More...
 
SmScaleMode GetScaleMode () const
 Gets the scale mode. More...
 
void SetScaleMode (SmScaleMode eMode)
 Sets the scale mode to eMode. More...
 
virtual void AdaptToX (OutputDevice &rDev, sal_uLong nWidth)
 
virtual void AdaptToY (OutputDevice &rDev, sal_uLong nHeight)
 
SmNodeType GetType () const
 Gets the node type. More...
 
const SmTokenGetToken () const
 Gets the token. More...
 
SmTokenGetToken ()
 
const ESelectionGetSelection () const
 Gets node position in input text. More...
 
void SetSelection (ESelection aESelection)
 Gets node position in input text. More...
 
const SmNodeFindTokenAt (sal_uInt16 nRow, sal_uInt16 nCol) const
 Finds the node from the position in the text. More...
 
const SmNodeFindRectClosestTo (const Point &rPoint) const
 Finds the closest rectangle in the screen. More...
 
virtual void Accept (SmVisitor *pVisitor)=0
 Accept a visitor. More...
 
bool IsSelected () const
 Checks if the node is selected. More...
 
void SetSelected (bool Selected)
 Sets the node to Selected. More...
 
const SmStructureNodeGetParent () const
 Gets the parent node of this node. More...
 
SmStructureNodeGetParent ()
 
void SetParent (SmStructureNode *parent)
 Sets the parent node. More...
 
void SetToken (SmToken const &token)
 Sets the token for this node. More...
 
- Public Member Functions inherited from SmRect
 SmRect ()
 
 SmRect (const OutputDevice &rDev, const SmFormat *pFormat, const OUString &rText, sal_uInt16 nBorderWidth)
 
 SmRect (tools::Long nWidth, tools::Long nHeight)
 
sal_uInt16 GetBorderWidth () const
 
void SetItalicSpaces (tools::Long nLeftSpace, tools::Long nRightSpace)
 
void SetWidth (sal_uLong nWidth)
 
void SetLeft (tools::Long nLeft)
 
void SetRight (tools::Long nRight)
 
void SetBottom (tools::Long nBottom)
 
void SetTop (tools::Long nTop)
 
const PointGetTopLeft () const
 
tools::Long GetTop () const
 
tools::Long GetLeft () const
 
tools::Long GetBottom () const
 
tools::Long GetRight () const
 
tools::Long GetCenterY () const
 
tools::Long GetWidth () const
 
tools::Long GetHeight () const
 
tools::Long GetItalicLeftSpace () const
 
tools::Long GetItalicRightSpace () const
 
tools::Long GetHiAttrFence () const
 
tools::Long GetLoAttrFence () const
 
tools::Long GetItalicLeft () const
 
tools::Long GetItalicCenterX () const
 
tools::Long GetItalicRight () const
 
tools::Long GetItalicWidth () const
 
bool HasBaseline () const
 
tools::Long GetBaseline () const
 
tools::Long GetBaselineOffset () const
 
tools::Long GetAlignT () const
 
tools::Long GetAlignM () const
 
tools::Long GetAlignB () const
 
const SizeGetSize () const
 
Size GetItalicSize () const
 
void Move (const Point &rPosition)
 
void MoveTo (const Point &rPosition)
 
bool IsEmpty () const
 
bool HasAlignInfo () const
 
Point AlignTo (const SmRect &rRect, RectPos ePos, RectHorAlign eHor, RectVerAlign eVer) const
 
SmRectExtendBy (const SmRect &rRect, RectCopyMBL eCopyMode)
 
void ExtendBy (const SmRect &rRect, RectCopyMBL eCopyMode, tools::Long nNewAlignM)
 
SmRectExtendBy (const SmRect &rRect, RectCopyMBL eCopyMode, bool bKeepVerAlignParams)
 
tools::Long OrientedDist (const Point &rPoint) const
 
bool IsInsideRect (const Point &rPoint) const
 
bool IsInsideItalicRect (const Point &rPoint) const
 
tools::Rectangle AsRectangle () const
 
SmRect AsGlyphRect () const
 

Static Public Member Functions

static sal_Unicode ConvertSymbolToUnicode (sal_Unicode nIn)
 Converts the character from StarMath's private area symbols to a matching Unicode character, if necessary. More...
 

Protected Member Functions

 SmTextNode (SmNodeType eNodeType, const SmToken &rNodeToken, sal_uInt16 nFontDescP)
 
- Protected Member Functions inherited from SmVisibleNode
 SmVisibleNode (SmNodeType eNodeType, const SmToken &rNodeToken)
 
- Protected Member Functions inherited from SmNode
 SmNode (SmNodeType eNodeType, SmToken aNodeToken)
 

Private Attributes

OUString maText
 
sal_uInt16 mnFontDesc
 
sal_Int32 mnSelectionStart
 Index within text where the selection starts. More...
 
sal_Int32 mnSelectionEnd
 Index within text where the selection ends. More...
 

Detailed Description

Text node.

Remarks
This class also serves as baseclass for all nodes that contains text.

Definition at line 746 of file node.hxx.

Constructor & Destructor Documentation

◆ SmTextNode() [1/2]

SmTextNode::SmTextNode ( SmNodeType  eNodeType,
const SmToken rNodeToken,
sal_uInt16  nFontDescP 
)
protected

Definition at line 1820 of file node.cxx.

◆ SmTextNode() [2/2]

SmTextNode::SmTextNode ( const SmToken rNodeToken,
sal_uInt16  nFontDescP 
)

Definition at line 1828 of file node.cxx.

References Text.

Member Function Documentation

◆ Accept()

void SmTextNode::Accept ( SmVisitor pVisitor)
overridevirtual

Accept a visitor.

Calls the method for this class on the visitor.

Parameters
pVisitor
Returns

Implements SmNode.

Reimplemented in SmSpecialNode, SmGlyphSpecialNode, SmMathSymbolNode, SmRootSymbolNode, SmPlaceNode, and SmErrorNode.

Definition at line 2415 of file node.cxx.

References SmVisitor::Visit().

◆ AdjustFontDesc()

void SmTextNode::AdjustFontDesc ( )

Try to guess the correct FontDesc, used during visual editing.

Returns

Definition at line 1887 of file node.cxx.

References eType, FNT_FUNCTION, FNT_NUMBER, FNT_TEXT, FNT_VARIABLE, Function, SmNode::GetToken(), maText, mnFontDesc, and TTEXT.

Referenced by ChangeText(), and SmCursor::InsertText().

◆ Arrange()

void SmTextNode::Arrange ( OutputDevice rDev,
const SmFormat rFormat 
)
overridevirtual

◆ ChangeText()

void SmTextNode::ChangeText ( const OUString &  rText)

Change the text of this node, including the underlying token to rText.

Parameters
rText
Returns

Definition at line 1836 of file node.cxx.

References AdjustFontDesc(), SmToken::aText, SmNode::GetToken(), and maText.

Referenced by SmCursor::FindPositionInLineList(), SmCursor::PatchLineList(), SmCursor::TakeSelectedNodesFromList(), and SmCloningVisitor::Visit().

◆ ConvertSymbolToUnicode()

sal_Unicode SmTextNode::ConvertSymbolToUnicode ( sal_Unicode  nIn)
static

Converts the character from StarMath's private area symbols to a matching Unicode character, if necessary.

To be used when converting GetText() to a normal text.

Parameters
nIn
Returns
unicode char

Definition at line 1899 of file node.cxx.

Referenced by MathType::HandleMath(), SmOoxmlExport::HandleText(), SmRtfExport::HandleText(), MathType::HandleText(), and mathSymbolToString().

◆ GetAccessibleText()

void SmTextNode::GetAccessibleText ( OUStringBuffer &  rText) const
overridevirtual

Appends to rText the node text.

Parameters
rText
Returns

Implements SmNode.

Definition at line 1882 of file node.cxx.

References maText.

◆ GetFontDesc()

sal_uInt16 SmTextNode::GetFontDesc ( ) const
inline

Returns the font type being used (text, variable, symbol, ...).

Returns
font type

Definition at line 769 of file node.hxx.

References mnFontDesc.

Referenced by Arrange(), SmCursor::CloneLineToClipboard(), SmCursor::Copy(), SmCursor::FindPositionInLineList(), Prepare(), SmMathSymbolNode::Prepare(), SmCursor::TakeSelectedNodesFromList(), and SmCloningVisitor::Visit().

◆ GetSelectionEnd()

sal_Int32 SmTextNode::GetSelectionEnd ( ) const
inline

Index within GetText() where the selection ends.

Remarks
Only valid of SmNode::IsSelected() is true.
Returns
index.

Definition at line 810 of file node.hxx.

References mnSelectionEnd.

Referenced by SmCursor::CloneLineToClipboard(), SmCursor::Copy(), SmCursor::TakeSelectedNodesFromList(), and SmSelectionRectanglesVisitor::Visit().

◆ GetSelectionStart()

sal_Int32 SmTextNode::GetSelectionStart ( ) const
inline

Index within GetText() where the selection starts.

Remarks
Only valid of SmNode::IsSelected() is true.
Returns
index.

Definition at line 803 of file node.hxx.

References mnSelectionStart.

Referenced by SmCursor::CloneLineToClipboard(), SmCursor::Copy(), SmCursor::TakeSelectedNodesFromList(), and SmSelectionRectanglesVisitor::Visit().

◆ GetText() [1/2]

OUString & SmTextNode::GetText ( )
inline

Definition at line 783 of file node.hxx.

References maText.

◆ GetText() [2/2]

const OUString & SmTextNode::GetText ( ) const
inline

◆ Prepare()

void SmTextNode::Prepare ( const SmFormat rFormat,
const SmDocShell rDocShell,
int  nDepth 
)
overridevirtual

Prepare preliminary settings about font and text (e.g.

maFace, meRectHorAlign, mnFlags, mnAttributes, etc.)

Parameters
rFormat
rDocShell
nDepth
Returns

Reimplemented from SmNode.

Reimplemented in SmSpecialNode, SmMathSymbolNode, SmPlaceNode, and SmErrorNode.

Definition at line 1842 of file node.cxx.

References SmToken::aText, SmNode::Attributes(), Bold, eType, SmNode::GetFont(), SmFormat::GetFont(), GetFontDesc(), SmNode::GetToken(), IsBold(), IsItalic(), Italic, Left, maText, SmNode::Prepare(), SmNode::SetRectHorAlign(), and TTEXT.

Referenced by SmCursor::InsertText().

◆ SetSelectionEnd()

void SmTextNode::SetSelectionEnd ( sal_Int32  index)
inline

Sets the index within GetText() where the selection ends to index.

Parameters
index
Returns

Definition at line 824 of file node.hxx.

References index, and mnSelectionEnd.

Referenced by SmSetSelectionVisitor::Visit().

◆ SetSelectionStart()

void SmTextNode::SetSelectionStart ( sal_Int32  index)
inline

Sets the index within GetText() where the selection starts to index.

Parameters
index
Returns

Definition at line 817 of file node.hxx.

References index, and mnSelectionStart.

Referenced by SmSetSelectionVisitor::Visit().

◆ SetText()

void SmTextNode::SetText ( const OUString &  rText)
inline

Sets the node text to rText.

Parameters
rText
Returns

Definition at line 776 of file node.hxx.

References maText.

Referenced by SmCursor::InsertText(), SmSpecialNode::Prepare(), SmErrorNode::SmErrorNode(), and SmMathSymbolNode::SmMathSymbolNode().

Member Data Documentation

◆ maText

OUString SmTextNode::maText
private

Definition at line 748 of file node.hxx.

Referenced by AdjustFontDesc(), Arrange(), ChangeText(), GetAccessibleText(), GetText(), Prepare(), and SetText().

◆ mnFontDesc

sal_uInt16 SmTextNode::mnFontDesc
private

Definition at line 749 of file node.hxx.

Referenced by AdjustFontDesc(), and GetFontDesc().

◆ mnSelectionEnd

sal_Int32 SmTextNode::mnSelectionEnd
private

Index within text where the selection ends.

Remarks
Only valid if SmNode::IsSelected() is true

Definition at line 757 of file node.hxx.

Referenced by GetSelectionEnd(), and SetSelectionEnd().

◆ mnSelectionStart

sal_Int32 SmTextNode::mnSelectionStart
private

Index within text where the selection starts.

Remarks
Only valid if SmNode::IsSelected() is true

Definition at line 753 of file node.hxx.

Referenced by GetSelectionStart(), and SetSelectionStart().


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