10#include <rtl/math.hxx>
240 , mbCaretVisible( caretVisible )
461 +
Point( nBorderwidth, nBorderwidth ) ),
534 for(
auto pChild : *pNode )
540 pChild->Accept(
this );
547 : maStartPos(startPos)
561 SAL_WARN_IF(
mbSelecting,
"starmath",
"Caret positions needed to set mbSelecting about, shouldn't be possible!");
568 pChild->Accept(
this );
611 bool ChangedState =
false;
623 pChild->Accept(
this );
624 ChangedState = ( WasSelecting !=
mbSelecting ) || ChangedState;
673 for(
auto pChild : *pNode )
677 pChild->Accept(
this );
701 if( i1 != -1 && i2 != -1 ) {
702 start = std::min(i1, i2);
703 end = std::max(i1, i2);
760 : mpRightMost(nullptr)
775 pChild->Accept(
this );
786 for(
auto pChild : *pNode )
790 pChild->Accept(
this );
802 bool bIsFirst =
true;
803 for(
auto pChild : *pNode )
810 pChild->Accept(
this );
862 left->SetRight( bodyLeft );
872 right->SetLeft( bodyRight );
942 left->SetRight( bodyLeft );
946 pBody->Accept(
this );
951 bodyRight->SetRight(
right );
986 for (
size_t j = 0; j < pNode->
GetNumCols(); ++j)
991 if( j != 0 || ( pNode->
GetNumRows() - 1U ) / 2 ==
i )
1029 for(
int i = 1;
i <=
size;
i++ ){
1074 left->SetRight( numLeft );
1087 pDenom->Accept(
this );
1108 *pScript = pNode->
Script();
1123 left->SetRight( bodyLeft );
1132 pScript->Accept(
this );
1168 left->SetRight( leftA );
1192 for(
auto pChild : *pNode )
1196 pChild->Accept(
this );
1202 for(
auto pChild : *pNode )
1206 pChild->Accept(
this );
1212 for(
auto pChild : *pNode )
1216 pChild->Accept(
this );
1223 for(
auto pChild : *pNode )
1227 pChild->Accept(
this );
1273 for(
auto pChild : *pNode )
1280 pChild->Accept(
this );
1289 for(
auto pChild : *pNode )
1293 pChild->Accept(
this );
1335 left->SetRight( bodyLeft );
1342 pBody->Accept(
this );
1345 right->SetLeft( bodyRight );
1441 *pBody = pNode->
Body();
1453 left->SetRight( bodyLeft );
1460 pBody->Accept(
this );
1463 right->SetLeft( bodyRight );
1539 for (
size_t i = 0;
i < nSize; ++
i)
1542 if(
nullptr != ( pKid = pSource->
GetSubNode(
i ) ) )
1804 rDevice.
DrawRect( aSelectionArea );
1816 SAL_WARN_IF(!pTree,
"starmath",
"pTree can't be null!");
1836 pChild->Accept(
this );
1879 for(
auto pChild : *pNode )
1896 for(
auto pChild : *pNode )
1908 pChild->Accept(
this );
1924 *pBody = pNode->
Body(),
1933 pLeftBrace->
Accept(
this );
1935 pBody->Accept(
this );
1939 pRightBrace->Accept(
this );
1946 for(
auto pChild : *pNode )
1951 pChild->Accept(
this );
2074 Append( ::rtl::math::doubleToUString(
2076 rtl_math_StringFormat_Automatic,
2077 rtl_math_DecimalPlaces_Max,
'.',
true ) );
2102 Append(OUString::number(nr));
2104 Append(OUString::number(ng));
2106 Append(OUString::number(nb));
2118 Append(OUString::number(nr));
2120 Append(OUString::number(ng));
2122 Append(OUString::number(nb));
2124 Append(OUString::number(nc));
2130 Append(OUString::number(nc,16));
2153 for(
auto it = pNode->
rbegin(); it != pNode->
rend(); ++it )
2159 pChild->Accept(
this );
2164 for(
auto pChild : *pNode )
2169 pChild->Accept(
this );
2179 *pOper = pNode->
Symbol(),
2186 pOper->Accept(
this );
2188 pRight->Accept(
this );
2302 for (
size_t j = 0; j < pNode->
GetNumCols( ); ++j)
2307 pSubNode->
Accept(
this );
2502 Append(OUStringChar(cChar));
2505 Append(OUStringChar(cChar));
2550 Append(OUStringChar(cChar));
2560 sal_uInt16 nWide = nNum / 4;
2561 sal_uInt16 nNarrow = nNum % 4;
2562 for (sal_uInt16
i = 0;
i < nWide;
i++)
2564 for (sal_uInt16
i = 0;
i < nNarrow;
i++)
2575 for(
auto pChild : *pNode )
2580 pChild->Accept(
this );
2587 if (!bracketsNeeded)
2597 if (bracketsNeeded) {
2600 for(
auto pChild : *pNode )
2604 pChild->Accept(
this );
2607 if (bracketsNeeded) {
2639 *pScript = pNode->
Script();
void SetWidth(double nWidth)
void DrawPolyLine(const tools::Polygon &rPoly)
void SetFont(const vcl::Font &rNewFont)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void DrawStretchText(const Point &rStartPt, sal_Int32 nWidth, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1)
constexpr tools::Long Y() const
void Move(tools::Long nHorzMove, tools::Long nVertMove)
tools::Long AdjustY(tools::Long nVertMove)
constexpr tools::Long X() const
const SmNode * Body() const
Gets the body data ( the nodes affected by the attribute ).
const SmNode * Attribute() const
Gets the attribute data.
bool IsAscending() const
Checks if it is of ascending type.
void SetAscending(bool bVal)
Sets if the wideslash is ascending to bVal.
const SmNode * Symbol() const
Returns the node containing the data of the binary operator.
const SmNode * LeftOperand() const
Returns the node containing the data of the left operand.
const SmNode * RightOperand() const
Returns the node containing the data of the right operand.
sal_uInt16 GetBlankNum() const
void SetBlankNum(sal_uInt16 nNumber)
Node for brace construction.
const SmMathSymbolNode * OpeningBrace() const
Returns the node containing the data of the opening brace.
const SmNode * Body() const
Returns the node containing the data of what is between braces.
const SmMathSymbolNode * ClosingBrace() const
Returns the node containing the data of the closing brace.
virtual void ProcessUnderline(Point from, Point to) override
SmCaretDrawingVisitor(OutputDevice &rDevice, SmCaretPos position, Point offset, bool caretVisible)
Given position and device this constructor will draw the caret.
virtual void ProcessCaretLine(Point from, Point to) override
A line that represents a caret.
Point maOffset
Offset to draw from.
virtual void ProcessCaretLine(Point from, Point to)=0
SmCaretLinesVisitor(OutputDevice &rDevice, SmCaretPos position, Point offset)
void Visit(SmTextNode *pNode) override
void DefaultVisit(SmNode *pNode) override
Default method for drawing pNodes.
virtual void ProcessUnderline(Point from, Point to)=0
VclPtr< OutputDevice > mpDev
void DefaultVisit(SmNode *pNode) override
Default method for computing lines for pNodes.
void Visit(SmTextNode *pNode) override
SmCaretPosGraphBuildingVisitor(SmNode *pRootNode)
Builds a caret position graph for pRootNode.
void Visit(SmTableNode *pNode) override
Build SmCaretPosGraph for SmTableNode This method covers cases where SmTableNode is used in a binom o...
SmCaretPosGraphEntry * mpRightMost
std::unique_ptr< SmCaretPosGraph > mpGraph
virtual ~SmCaretPosGraphBuildingVisitor()
A graph over all caret positions.
virtual void ProcessUnderline(Point from, Point to) override
SmCaretRectanglesVisitor(OutputDevice &rDevice, SmCaretPos position)
virtual void ProcessCaretLine(Point from, Point to) override
void CloneKids(SmStructureNode *pSource, SmStructureNode *pTarget)
Clone children of pSource and give them to pTarget.
SmNode * Clone(SmNode *pNode)
Clone a pNode.
void Visit(SmTableNode *pNode) override
static void CloneNodeAttr(SmNode const *pSource, SmNode *pTarget)
Clone attributes on a pNode.
static SmNode * FindTopMostNodeInLine(SmNode *pSNode, bool MoveUpIfSelected=false)
Finds the topmost node in a visual line.
virtual void DefaultVisit(SmNode *pNode)=0
Method invoked by Visit methods by default.
void Visit(SmTableNode *pNode) override
OutputDevice & mrDev
OutputDevice to draw on.
Point maPosition
Position to draw on the mrDev.
void Visit(SmTableNode *pNode) override
void DrawTextNode(SmTextNode *pNode)
Draw an SmTextNode or a subclass of this.
void DrawChildren(SmStructureNode *pNode)
Draw the children of a pNode This the default method, use by most pNodes.
void DrawSpecialNode(SmSpecialNode *pNode)
Draw an SmSpecialNode or a subclass of this
Error node, for parsing errors.
tools::Long GetBorderWidth() const
void SetSizeParameter(const Fraction &rValue, FontSizeType nType)
Sets font size to rValue in nType mode.
const Fraction & GetSizeParameter() const
Returns the font size.
FontSizeType GetSizeType() const
Returns the font size type.
Glyph node for custom operators.
void SetRowCol(sal_uInt16 nMatrixRows, sal_uInt16 nMatrixCols)
Sets the dimensions of the matrix.
sal_uInt16 GetNumRows() const
Gets the number of rows of the matrix.
sal_uInt16 GetNumCols() const
Gets the number of columns of the matrix.
OUStringBuffer maCmdText
Output text generated from the pNodes.
void LineToText(SmNode *pNode)
Extract text from a pNode that constitutes a line.
SmNodeToTextVisitor(SmNode *pNode, OUString &rText)
void Separate()
Append a blank for separation, if needed.
void Append(std::u16string_view rText)
Appends rText to the OUStringBuffer ( maCmdText ).
void Visit(SmTableNode *pNode) override
void SetSelection(ESelection aESelection)
Gets node position in input text.
SmScaleMode GetScaleMode() const
Gets the scale mode.
virtual void Accept(SmVisitor *pVisitor)=0
Accept a visitor.
virtual size_t GetNumSubNodes() const =0
Gets the number of subnodes.
const SmToken & GetToken() const
Gets the token.
virtual SmNode * GetSubNode(size_t nIndex)=0
Gets the subnode of index nIndex.
bool IsSelected() const
Checks if the node is selected.
void SetScaleMode(SmScaleMode eMode)
Sets the scale mode to eMode.
const SmStructureNode * GetParent() const
Gets the parent node of this node.
const ESelection & GetSelection() const
Gets node position in input text.
SmNodeType GetType() const
Gets the node type.
const SmFace & GetFont() const
Gets the font.
bool IsPhantom() const
Checks if it is a visible node rendered invisible.
void SetSelected(bool Selected)
Sets the node to Selected.
tools::Long GetWidth() const
Gets the width of the rect.
tools::Polygon & GetPolygon()
Gets the polygon to draw the node.
const Point & GetTopLeft() const
tools::Long GetBaselineOffset() const
tools::Long GetHeight() const
tools::Long GetTop() const
sal_uInt16 GetBorderWidth() const
tools::Long GetWidth() const
tools::Long GetLeft() const
tools::Long GetRight() const
tools::Rectangle AsRectangle() const
sal_uLong GetBodyWidth() const
Gets the body width.
SmSelectionDrawingVisitor(OutputDevice &rDevice, SmNode *pTree, const Point &rOffset)
Draws a selection on rDevice for the selection on pTree.
const tools::Rectangle & GetSelection()
void DefaultVisit(SmNode *pNode) override
Default visiting method.
SmSelectionRectanglesVisitor(OutputDevice &rDevice, SmNode *pTree)
void VisitChildren(SmNode *pNode)
Visit the children of a given pNode.
OutputDevice & mrDev
Reference to drawing device.
void ExtendSelectionArea(const tools::Rectangle &rArea)
Extend the area that must be selected
void Visit(SmTextNode *pNode) override
static void SetSelectedOnAll(SmNode *pSubTree, bool IsSelected=true)
Set IsSelected on all pNodes of pSubTree.
bool mbSelecting
The current state of this visitor This property changes when the visitor meets either maStartPos or m...
SmSetSelectionVisitor(SmCaretPos startPos, SmCaretPos endPos, SmNode *pNode)
void VisitCompositionNode(SmStructureNode *pNode)
void DefaultVisit(SmNode *pNode) override
Visit a selectable pNode Can be used to handle pNodes that can be selected, that doesn't have more Sm...
void Visit(SmBinHorNode *pNode) override
SmCaretPos maStartPos
Caret position where the selection starts.
SmCaretPos maEndPos
Caret position where the selection ends.
Special node for user defined characters.
Abstract baseclass for all composite node.
SmNodeArray::reverse_iterator rend()
Gets the first subnode.
virtual size_t GetNumSubNodes() const override
Gets the number of subnodes.
void SetSubNodes(std::unique_ptr< SmNode > pFirst, std::unique_ptr< SmNode > pSecond, std::unique_ptr< SmNode > pThird=nullptr)
Sets subnodes, used for operators.
virtual SmNode * GetSubNode(size_t nIndex) override
Gets the subnode of index nIndex.
SmNodeArray::reverse_iterator rbegin()
Gets the last subnode.
Super- and subscript node.
void SetUseLimits(bool bVal)
Sets if it is going to be used for a limit to bVal.
const SmNode * GetBody() const
Returns the node with the data of what has to be superindex or subindex.
const SmNode * GetSubSup(SmSubSup eSubSup) const
Gets the node with the data of what has to be superindex or subindex.
bool IsUseLimits() const
Checks if it is going to be used for a limit.
void ChangeText(const OUString &rText)
Change the text of this node, including the underlying token to rText.
const OUString & GetText() const
Gets the node text.
sal_Int32 GetSelectionStart() const
Index within GetText() where the selection starts.
void SetSelectionEnd(sal_Int32 index)
Sets the index within GetText() where the selection ends to index.
void SetSelectionStart(sal_Int32 index)
Sets the index within GetText() where the selection starts to index.
sal_uInt16 GetFontDesc() const
Returns the font type being used (text, variable, symbol, ...).
sal_Int32 GetSelectionEnd() const
Index within GetText() where the selection ends.
void SetFont(const vcl::Font &rNewFont)
void SetLineColor(const Color &rColor)
void SetFillColor(const Color &rColor)
Node for vertical brace construction.
const SmNode * Script() const
Returns the node containing the data of what is in the brace.
const SmNode * Body() const
Returns the node containing the data of what the brace is pointing for.
const Color & GetColor() const
void SetAlignment(TextAlign)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define SAL_WARN_IF(condition, area, stream)
SmColorTokenTableEntry Identify_Color_Parser(sal_uInt32 cColor)
Identifies color from color code cColor.
std::vector< SmNode * > SmNodeArray
SmSubSup
Enum used to index sub-/supscripts in the 'maSubNodes' array in 'SmSubSupNode'.
An entry in SmCaretPosGraph.
void SetRight(SmCaretPosGraphEntry *right)
Representation of caret position with an equation.
bool IsValid() const
True, if this is a valid caret position.
int nIndex
Index (invariant: non-negative) within the selected node.
SmNode * pSelectedNode
Selected node.
sal_Unicode const MS_DOTSDOWN
sal_Unicode const MS_TILDE
sal_Unicode const MS_DOWNARROW
sal_Unicode const MS_INFINITY
sal_Unicode const MS_RIGHTARROW
sal_Unicode const MS_LEFTARROW
sal_Unicode const MS_SETN
sal_Unicode const MS_LAPLACE
sal_Unicode const MS_LAMBDABAR
sal_Unicode const MS_CIRC
sal_Unicode const MS_SETQ
sal_Unicode const MS_SETR
sal_Unicode const MS_ALEPH
sal_Unicode const MS_DRARROW
sal_Unicode const MS_NONE
Note: not listed here does not(!) mean "not used" (see alpha ... gamma for example)
sal_Unicode const MS_DLARROW
sal_Unicode const MS_NABLA
sal_Unicode const MS_DOTSUP
sal_Unicode const MS_DOTSLOW
sal_Unicode const MS_SETC
sal_Unicode const MS_SETZ
sal_Unicode const MS_FORALL
sal_Unicode const MS_NOTEXISTS
sal_Unicode const MS_PARTIAL
sal_Unicode const MS_UPARROW
sal_Unicode const MS_DOTSVERT
sal_Unicode const MS_DOTSAXIS
sal_Unicode const MS_HBAR
sal_Unicode const MS_EMPTYSET
sal_Unicode const MS_BACKEPSILON
sal_Unicode const MS_DLRARROW
sal_Unicode const MS_EXISTS
sal_Unicode const MS_VERTLINE
sal_Unicode const MS_ORTHO