summaryrefslogtreecommitdiff
path: root/starmath/inc
diff options
context:
space:
mode:
authormatteocam <matteo.campanelli@gmail.com>2014-02-25 14:37:55 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-03-15 22:45:51 +0000
commit93e6291c29d547c0c29c6e43b2ca4b36a3e8506f (patch)
tree50d3560576046dd111e5a9aad5d37afa1add69a9 /starmath/inc
parentedc8ee009943e7fc9a68730b0efb303b019a62d4 (diff)
fdo#53472 Created Dynamic Integral Node classes. Integrals size made dependent on body.
Change-Id: I0348155f2429cf7dd3cbe7d71f333879ec6de980 Reviewed-on: https://gerrit.libreoffice.org/8569 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'starmath/inc')
-rw-r--r--starmath/inc/node.hxx82
-rw-r--r--starmath/inc/parse.hxx3
-rw-r--r--starmath/inc/visitors.hxx14
3 files changed, 97 insertions, 2 deletions
diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx
index c15ab259afbe..ab27af014df9 100644
--- a/starmath/inc/node.hxx
+++ b/starmath/inc/node.hxx
@@ -73,7 +73,7 @@ enum SmNodeType
/*10*/ NBINDIAGONAL, NSUBSUP, NMATRIX, NPLACE, NTEXT,
/*15*/ NSPECIAL, NGLYPH_SPECIAL, NMATH, NBLANK, NERROR,
/*20*/ NLINE, NEXPRESSION, NPOLYLINE, NROOT, NROOTSYMBOL,
-/*25*/ NRECTANGLE, NVERTICAL_BRACE, NMATHIDENT
+/*25*/ NRECTANGLE, NVERTICAL_BRACE, NMATHIDENT, NDYNINT, NDYNINTSYMBOL
};
@@ -618,6 +618,30 @@ public:
void Accept(SmVisitor* pVisitor);
};
+////////////////////////////////////////////////////////////////////////////////
+
+/** Dynamic Integral symbol node
+ *
+ * Node for drawing dynamicall sized integral symbols.
+ *
+ * TODO: It might be created a parent class SmDynamicSizedNode
+ (for both dynamic integrals, roots and other dynamic symbols)
+
+ */
+class SmDynIntegralSymbolNode : public SmMathSymbolNode
+{
+
+
+public:
+ SmDynIntegralSymbolNode(const SmToken &rNodeToken)
+ : SmMathSymbolNode(NDYNINTSYMBOL, rNodeToken)
+ {}
+
+ virtual void AdaptToY(const OutputDevice &rDev, sal_uLong nHeight);
+
+ void Accept(SmVisitor* pVisitor);
+};
+
@@ -806,6 +830,40 @@ public:
};
+////////////////////////////////////////////////////////////////////////////////
+
+/** Dynamic Integral node
+ *
+ * Used to create Dynamically sized integrals
+ *
+ * Children:<BR>
+ * 0: Symbol (instance of DynIntegralSymbolNode)<BR>
+ * 1: Body<BR>
+ */
+class SmDynIntegralNode : public SmStructureNode
+{
+protected:
+ void GetHeightVerOffset(const SmRect &rRect,
+ long &rHeight, long &rVerOffset) const;
+
+public:
+ SmDynIntegralNode(const SmToken &rNodeToken)
+ : SmStructureNode(NDYNINT, rNodeToken)
+ {
+ SetNumSubNodes(2);
+ }
+
+ virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
+ void CreateTextFromNode(OUString &rText);
+ void Accept(SmVisitor* pVisitor);
+
+ SmDynIntegralSymbolNode* Symbol();
+ const SmDynIntegralSymbolNode* Symbol() const;
+ SmNode* Body();
+ const SmNode* Body() const;
+};
+
+
/** Binary horizontial node
@@ -1293,6 +1351,28 @@ inline const SmNode* SmRootNode::Body() const
return const_cast< SmRootNode* >( this )->Body();
}
+
+
+inline SmDynIntegralSymbolNode* SmDynIntegralNode::Symbol()
+{
+ OSL_ASSERT( GetNumSubNodes() > 0 && GetSubNode( 0 )->GetType() == NDYNINTSYMBOL );
+ return static_cast< SmDynIntegralSymbolNode* >( GetSubNode( 0 ));
+}
+inline const SmDynIntegralSymbolNode* SmDynIntegralNode::Symbol() const
+{
+ return const_cast< SmDynIntegralNode* >( this )->Symbol();
+}
+inline SmNode* SmDynIntegralNode::Body()
+{
+ OSL_ASSERT( GetNumSubNodes() > 1 );
+ return GetSubNode( 1 );
+}
+inline const SmNode* SmDynIntegralNode::Body() const
+{
+ return const_cast< SmDynIntegralNode* >( this )->Body();
+}
+
+
inline SmMathSymbolNode* SmBinHorNode::Symbol()
{
OSL_ASSERT( GetNumSubNodes() > 1 && GetSubNode( 1 )->GetType() == NMATH );
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 41071f26759c..d967be7a69c3 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -102,7 +102,8 @@ enum SmTokenType
/*215*/ TSETR, TSETC, TWIDEVEC, TWIDETILDE, TWIDEHAT,
/*220*/ TWIDESLASH, TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, TNOSPACE,
/*225*/ TUNKNOWN, TDEBUG, TPRECEDES, TSUCCEEDS, TPRECEDESEQUAL,
-/*230*/ TSUCCEEDSEQUAL, TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS
+/*230*/ TSUCCEEDSEQUAL, TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS,
+/*235*/ TINTD
};
diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx
index 630b311411b7..7c4dcf7b6d50 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -42,6 +42,8 @@ public:
virtual void Visit( SmLineNode* pNode ) = 0;
virtual void Visit( SmExpressionNode* pNode ) = 0;
virtual void Visit( SmPolyLineNode* pNode ) = 0;
+ virtual void Visit( SmDynIntegralNode* pNode ) = 0;
+ virtual void Visit( SmDynIntegralSymbolNode* pNode ) = 0;
virtual void Visit( SmRootNode* pNode ) = 0;
virtual void Visit( SmRootSymbolNode* pNode ) = 0;
virtual void Visit( SmRectangleNode* pNode ) = 0;
@@ -81,6 +83,8 @@ public:
void Visit( SmPolyLineNode* pNode );
void Visit( SmRootNode* pNode );
void Visit( SmRootSymbolNode* pNode );
+ void Visit( SmDynIntegralNode* pNode );
+ void Visit( SmDynIntegralSymbolNode* pNode );
void Visit( SmRectangleNode* pNode );
void Visit( SmVerticalBraceNode* pNode );
private:
@@ -124,6 +128,8 @@ public:
void Visit( SmPolyLineNode* pNode );
void Visit( SmRootNode* pNode );
void Visit( SmRootSymbolNode* pNode );
+ void Visit( SmDynIntegralNode* pNode );
+ void Visit( SmDynIntegralSymbolNode* pNode );
void Visit( SmRectangleNode* pNode );
void Visit( SmVerticalBraceNode* pNode );
protected:
@@ -227,6 +233,8 @@ public:
void Visit( SmPolyLineNode* pNode );
void Visit( SmRootNode* pNode );
void Visit( SmRootSymbolNode* pNode );
+ void Visit( SmDynIntegralNode* pNode );
+ void Visit( SmDynIntegralSymbolNode* pNode );
void Visit( SmRectangleNode* pNode );
void Visit( SmVerticalBraceNode* pNode );
private:
@@ -344,6 +352,8 @@ public:
void Visit( SmPolyLineNode* pNode );
void Visit( SmRootNode* pNode );
void Visit( SmRootSymbolNode* pNode );
+ void Visit( SmDynIntegralNode* pNode );
+ void Visit( SmDynIntegralSymbolNode* pNode );
void Visit( SmRectangleNode* pNode );
void Visit( SmVerticalBraceNode* pNode );
SmCaretPosGraph* takeGraph()
@@ -393,6 +403,8 @@ public:
void Visit( SmPolyLineNode* pNode );
void Visit( SmRootNode* pNode );
void Visit( SmRootSymbolNode* pNode );
+ void Visit( SmDynIntegralNode* pNode );
+ void Visit( SmDynIntegralSymbolNode* pNode );
void Visit( SmRectangleNode* pNode );
void Visit( SmVerticalBraceNode* pNode );
/** Clone a pNode */
@@ -465,6 +477,8 @@ public:
void Visit( SmPolyLineNode* pNode );
void Visit( SmRootNode* pNode );
void Visit( SmRootSymbolNode* pNode );
+ void Visit( SmDynIntegralNode* pNode );
+ void Visit( SmDynIntegralSymbolNode* pNode );
void Visit( SmRectangleNode* pNode );
void Visit( SmVerticalBraceNode* pNode );
private: