Kaydet (Commit) 4ded3c11 authored tarafından Luboš Luňák's avatar Luboš Luňák

implement root support for ooxml math export

üst c070a4d8
...@@ -764,7 +764,7 @@ public: ...@@ -764,7 +764,7 @@ public:
* 0: Argument (optional)<BR> * 0: Argument (optional)<BR>
* 1: Symbol (instance of SmRootSymbolNode)<BR> * 1: Symbol (instance of SmRootSymbolNode)<BR>
* 2: Body<BR> * 2: Body<BR>
* Where argument is optinal and may be NULL. * Where argument is optional and may be NULL.
*/ */
class SmRootNode : public SmStructureNode class SmRootNode : public SmStructureNode
{ {
...@@ -783,6 +783,13 @@ public: ...@@ -783,6 +783,13 @@ public:
virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat);
void CreateTextFromNode(String &rText); void CreateTextFromNode(String &rText);
void Accept(SmVisitor* pVisitor); void Accept(SmVisitor* pVisitor);
SmNode* Argument();
const SmNode* Argument() const;
SmRootSymbolNode* Symbol();
const SmRootSymbolNode* Symbol() const;
SmNode* Body();
const SmNode* Body() const;
}; };
...@@ -1221,6 +1228,36 @@ public: ...@@ -1221,6 +1228,36 @@ public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
inline SmNode* SmRootNode::Argument()
{
OSL_ASSERT( GetNumSubNodes() > 0 );
return GetSubNode( 0 );
}
inline const SmNode* SmRootNode::Argument() const
{
return const_cast< SmRootNode* >( this )->Argument();
}
inline SmRootSymbolNode* SmRootNode::Symbol()
{
OSL_ASSERT( GetSubNode( 0 )->GetType() == NROOTSYMBOL );
return static_cast< SmRootSymbolNode* >( GetSubNode( 1 ));
}
inline const SmRootSymbolNode* SmRootNode::Symbol() const
{
return const_cast< SmRootNode* >( this )->Symbol();
}
inline SmNode* SmRootNode::Body()
{
OSL_ASSERT( GetNumSubNodes() > 2 );
return GetSubNode( 2 );
}
inline const SmNode* SmRootNode::Body() const
{
return const_cast< SmRootNode* >( this )->Body();
}
#endif #endif
......
...@@ -120,10 +120,10 @@ void SmOoxml::HandleNode(SmNode *pNode,int nLevel) ...@@ -120,10 +120,10 @@ void SmOoxml::HandleNode(SmNode *pNode,int nLevel)
case NBINVER: case NBINVER:
HandleFractions(pNode,nLevel); HandleFractions(pNode,nLevel);
break; break;
#if 0
case NROOT: case NROOT:
HandleRoot(pNode,nLevel); HandleRoot( static_cast< SmRootNode* >( pNode ),nLevel);
break; break;
#if 0
case NSPECIAL: case NSPECIAL:
{ {
SmTextNode *pText=(SmTextNode *)pNode; SmTextNode *pText=(SmTextNode *)pNode;
...@@ -458,4 +458,26 @@ void SmOoxml::HandleBinaryOperation(SmNode *pNode,int nLevel) ...@@ -458,4 +458,26 @@ void SmOoxml::HandleBinaryOperation(SmNode *pNode,int nLevel)
} }
} }
void SmOoxml::HandleRoot(SmRootNode *pNode,int nLevel)
{
m_pSerializer->startElementNS( XML_m, XML_rad, FSEND );
if( SmNode* argument = pNode->Argument())
{
m_pSerializer->startElementNS( XML_m, XML_deg, FSEND );
HandleAllSubNodes( argument, nLevel );
m_pSerializer->endElementNS( XML_m, XML_deg );
}
else
{
m_pSerializer->startElementNS( XML_m, XML_radPr, FSEND );
m_pSerializer->singleElementNS( XML_m, XML_degHide, FSNS( XML_m, XML_val ), "1", FSEND );
m_pSerializer->endElementNS( XML_m, XML_radPr );
m_pSerializer->singleElementNS( XML_m, XML_deg, FSEND ); // empty but present
}
m_pSerializer->startElementNS( XML_m, XML_e, FSEND );
HandleAllSubNodes( pNode->Body(), nLevel );
m_pSerializer->endElementNS( XML_m, XML_e );
m_pSerializer->endElementNS( XML_m, XML_rad );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -51,6 +51,7 @@ private: ...@@ -51,6 +51,7 @@ private:
void HandleMath(SmNode *pNode,int nLevel); void HandleMath(SmNode *pNode,int nLevel);
void HandleFractions( SmNode *pNode,int nLevel, const char* type = NULL ); void HandleFractions( SmNode *pNode,int nLevel, const char* type = NULL );
void HandleBinaryOperation(SmNode *pNode,int nLevel); void HandleBinaryOperation(SmNode *pNode,int nLevel);
void HandleRoot(SmRootNode *pNode,int nLevel);
String str; String str;
SmNode *pTree; SmNode *pTree;
::sax_fastparser::FSHelperPtr m_pSerializer; ::sax_fastparser::FSHelperPtr m_pSerializer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment