diff options
author | matteocam <matteo.campanelli@gmail.com> | 2014-02-25 14:37:55 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-03-15 22:45:51 +0000 |
commit | 93e6291c29d547c0c29c6e43b2ca4b36a3e8506f (patch) | |
tree | 50d3560576046dd111e5a9aad5d37afa1add69a9 /starmath/inc/node.hxx | |
parent | edc8ee009943e7fc9a68730b0efb303b019a62d4 (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/node.hxx')
-rw-r--r-- | starmath/inc/node.hxx | 82 |
1 files changed, 81 insertions, 1 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 ); |