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

more generic m:nary implementation

üst 3c923d98
......@@ -427,43 +427,15 @@ void SmOoxml::HandleRoot( const SmRootNode* pNode, int nLevel )
void SmOoxml::HandleOperator( const SmOperNode* pNode, int nLevel )
{
fprintf( stderr, "OPER %d\n", pNode->GetToken().eType );
switch( pNode->GetToken().eType )
{
case TINT:
HandleOperatorNary( pNode, nLevel, sal_Unicode( 0x222b ));
break;
case TIINT:
HandleOperatorNary( pNode, nLevel, sal_Unicode( 0x222c ));
break;
case TIIINT:
HandleOperatorNary( pNode, nLevel, sal_Unicode( 0x222d ));
break;
case TLINT:
HandleOperatorNary( pNode, nLevel, sal_Unicode( 0x222e ));
break;
case TLLINT:
HandleOperatorNary( pNode, nLevel, sal_Unicode( 0x222f ));
break;
case TLLLINT:
HandleOperatorNary( pNode, nLevel, sal_Unicode( 0x2230 ));
break;
default:
OSL_FAIL( "Operator not handled explicitly" );
HandleAllSubNodes( pNode, nLevel );
break;
}
}
void SmOoxml::HandleOperatorNary( const SmOperNode* pNode, int nLevel, sal_Unicode chr )
{
const SmSubSupNode* subsup = pNode->GetSubNode( 0 )->GetType() == NSUBSUP
? static_cast< const SmSubSupNode* >( pNode->GetSubNode( 0 )) : NULL;
const SmNode* operation = subsup != NULL ? subsup->GetBody() : pNode->GetSubNode( 0 );
OSL_ASSERT( operation->GetType() == NMATH && static_cast< const SmTextNode* >( operation )->GetText().Len() == 1 );
sal_Unicode chr = Convert( static_cast< const SmTextNode* >( operation )->GetText().GetChar( 0 ));
m_pSerializer->startElementNS( XML_m, XML_nary, FSEND );
m_pSerializer->startElementNS( XML_m, XML_naryPr, FSEND );
rtl::OString chrValue = rtl::OUStringToOString( rtl::OUString( chr ), RTL_TEXTENCODING_UTF8 );
m_pSerializer->singleElementNS( XML_m, XML_char, FSNS( XML_m, XML_val ), chrValue.getStr(), FSEND );
const SmSubSupNode* subsup = pNode->GetSubNode( 0 )->GetType() == NSUBSUP
? static_cast< const SmSubSupNode* >( pNode->GetSubNode( 0 )) : NULL;
// GetSubNode( 0 ) is otherwise generally ignored, as it should be just SmMathSymbolNode for the operation,
// and we have 'chr' already
if( subsup == NULL || subsup->GetSubSup( CSUB ) == NULL )
m_pSerializer->singleElementNS( XML_m, XML_subHide, FSNS( XML_m, XML_val ), "1", FSEND );
if( subsup == NULL || subsup->GetSubSup( CSUP ) == NULL )
......
......@@ -55,7 +55,6 @@ private:
void HandleRoot( const SmRootNode* pNode, int nLevel );
void HandleAttribute( const SmAttributNode* pNode, int nLevel );
void HandleOperator( const SmOperNode* pNode, int nLevel );
void HandleOperatorNary( const SmOperNode* pNode, int nLevel, sal_Unicode chr );
void HandleSubSupScript( const SmSubSupNode* pNode, int nLevel );
void HandleSubSupScriptInternal( const SmSubSupNode* pNode, int nLevel, int flags );
String str;
......
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