Kaydet (Commit) 54ec7849 authored tarafından Miklos Vajna's avatar Miklos Vajna

starmath: whitespace fixes in wordexportbase

Change-Id: Ie0756d882347912f4beb38dde25ff6d598766a7b
üst 19b99af0
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
SmWordExportBase::SmWordExportBase( const SmNode* pIn ) SmWordExportBase::SmWordExportBase(const SmNode* pIn)
: m_pTree( pIn ) : m_pTree(pIn)
{ {
} }
...@@ -21,41 +21,41 @@ SmWordExportBase::~SmWordExportBase() ...@@ -21,41 +21,41 @@ SmWordExportBase::~SmWordExportBase()
{ {
} }
void SmWordExportBase::HandleNode( const SmNode* pNode, int nLevel ) void SmWordExportBase::HandleNode(const SmNode* pNode, int nLevel)
{ {
SAL_INFO( "starmath.wordbase", "Node: " << nLevel << " " << int( pNode->GetType()) << " " << pNode->GetNumSubNodes()); SAL_INFO("starmath.wordbase", "Node: " << nLevel << " " << int(pNode->GetType()) << " " << pNode->GetNumSubNodes());
switch(pNode->GetType()) switch (pNode->GetType())
{ {
case NATTRIBUT: case NATTRIBUT:
HandleAttribute( static_cast< const SmAttributNode* >( pNode ), nLevel ); HandleAttribute(static_cast< const SmAttributNode* >(pNode), nLevel);
break; break;
case NTEXT: case NTEXT:
HandleText(pNode,nLevel); HandleText(pNode,nLevel);
break; break;
case NVERTICAL_BRACE: case NVERTICAL_BRACE:
HandleVerticalBrace( static_cast< const SmVerticalBraceNode* >( pNode ), nLevel ); HandleVerticalBrace(static_cast< const SmVerticalBraceNode* >(pNode), nLevel);
break; break;
case NBRACE: case NBRACE:
HandleBrace( static_cast< const SmBraceNode* >( pNode ), nLevel ); HandleBrace(static_cast< const SmBraceNode* >(pNode), nLevel);
break; break;
case NOPER: case NOPER:
HandleOperator( static_cast< const SmOperNode* >( pNode ), nLevel ); HandleOperator(static_cast< const SmOperNode* >(pNode), nLevel);
break; break;
case NUNHOR: case NUNHOR:
HandleUnaryOperation( static_cast< const SmUnHorNode* >( pNode ), nLevel ); HandleUnaryOperation(static_cast< const SmUnHorNode* >(pNode), nLevel);
break; break;
case NBINHOR: case NBINHOR:
HandleBinaryOperation( static_cast< const SmBinHorNode* >( pNode ), nLevel ); HandleBinaryOperation(static_cast< const SmBinHorNode* >(pNode), nLevel);
break; break;
case NBINVER: case NBINVER:
HandleFractions(pNode,nLevel); HandleFractions(pNode,nLevel);
break; break;
case NROOT: case NROOT:
HandleRoot( static_cast< const SmRootNode* >( pNode ), nLevel ); HandleRoot(static_cast< const SmRootNode* >(pNode), nLevel);
break; break;
case NSPECIAL: case NSPECIAL:
{ {
const SmTextNode* pText= static_cast< const SmTextNode* >( pNode ); const SmTextNode* pText= static_cast< const SmTextNode* >(pNode);
//if the token str and the result text are the same then this //if the token str and the result text are the same then this
//is to be seen as text, else assume it's a mathchar //is to be seen as text, else assume it's a mathchar
if (pText->GetText() == pText->GetToken().aText) if (pText->GetText() == pText->GetToken().aText)
...@@ -69,22 +69,22 @@ void SmWordExportBase::HandleNode( const SmNode* pNode, int nLevel ) ...@@ -69,22 +69,22 @@ void SmWordExportBase::HandleNode( const SmNode* pNode, int nLevel )
HandleMath(pNode,nLevel); HandleMath(pNode,nLevel);
break; break;
case NSUBSUP: case NSUBSUP:
HandleSubSupScript( static_cast< const SmSubSupNode* >( pNode ), nLevel ); HandleSubSupScript(static_cast< const SmSubSupNode* >(pNode), nLevel);
break; break;
case NEXPRESSION: case NEXPRESSION:
HandleAllSubNodes( pNode, nLevel ); HandleAllSubNodes(pNode, nLevel);
break; break;
case NTABLE: case NTABLE:
//Root Node, PILE equivalent, i.e. vertical stack //Root Node, PILE equivalent, i.e. vertical stack
HandleTable(pNode,nLevel); HandleTable(pNode,nLevel);
break; break;
case NMATRIX: case NMATRIX:
HandleMatrix( static_cast< const SmMatrixNode* >( pNode ), nLevel ); HandleMatrix(static_cast< const SmMatrixNode* >(pNode), nLevel);
break; break;
case NLINE: case NLINE:
{ {
// TODO // TODO
HandleAllSubNodes( pNode, nLevel ); HandleAllSubNodes(pNode, nLevel);
} }
break; break;
#if 0 #if 0
...@@ -99,13 +99,13 @@ void SmWordExportBase::HandleNode( const SmNode* pNode, int nLevel ) ...@@ -99,13 +99,13 @@ void SmWordExportBase::HandleNode( const SmNode* pNode, int nLevel )
HandleBlank(); HandleBlank();
break; break;
default: default:
HandleAllSubNodes( pNode, nLevel ); HandleAllSubNodes(pNode, nLevel);
break; break;
} }
} }
//Root Node, PILE equivalent, i.e. vertical stack //Root Node, PILE equivalent, i.e. vertical stack
void SmWordExportBase::HandleTable( const SmNode* pNode, int nLevel ) void SmWordExportBase::HandleTable(const SmNode* pNode, int nLevel)
{ {
//The root of the starmath is a table, if //The root of the starmath is a table, if
//we convert this them each iteration of //we convert this them each iteration of
...@@ -113,82 +113,82 @@ void SmWordExportBase::HandleTable( const SmNode* pNode, int nLevel ) ...@@ -113,82 +113,82 @@ void SmWordExportBase::HandleTable( const SmNode* pNode, int nLevel )
//add an extra unnecessary level to the //add an extra unnecessary level to the
//Word output stack which would grow //Word output stack which would grow
//without bound in a multi step conversion //without bound in a multi step conversion
if( nLevel || pNode->GetNumSubNodes() > 1 ) if (nLevel || pNode->GetNumSubNodes() > 1)
HandleVerticalStack( pNode, nLevel ); HandleVerticalStack(pNode, nLevel);
else else
HandleAllSubNodes( pNode, nLevel ); HandleAllSubNodes(pNode, nLevel);
} }
void SmWordExportBase::HandleAllSubNodes( const SmNode* pNode, int nLevel ) void SmWordExportBase::HandleAllSubNodes(const SmNode* pNode, int nLevel)
{ {
int size = pNode->GetNumSubNodes(); int size = pNode->GetNumSubNodes();
for( int i = 0; for (int i = 0;
i < size; i < size;
++i ) ++i)
{ {
// TODO remove when all types of nodes are handled properly // TODO remove when all types of nodes are handled properly
if( pNode->GetSubNode( i ) == NULL ) if (pNode->GetSubNode(i) == NULL)
{ {
SAL_WARN("starmath.wordbase", "Subnode is NULL, parent node not handled properly"); SAL_WARN("starmath.wordbase", "Subnode is NULL, parent node not handled properly");
continue; continue;
} }
HandleNode( pNode->GetSubNode( i ), nLevel + 1 ); HandleNode(pNode->GetSubNode(i), nLevel + 1);
} }
} }
void SmWordExportBase::HandleUnaryOperation( const SmUnHorNode* pNode, int nLevel ) void SmWordExportBase::HandleUnaryOperation(const SmUnHorNode* pNode, int nLevel)
{ {
// update HandleMath() when adding new items // update HandleMath() when adding new items
SAL_INFO( "starmath.wordbase", "Unary: " << int( pNode->GetToken().eType )); SAL_INFO("starmath.wordbase", "Unary: " << int(pNode->GetToken().eType));
// Avoid MSVC warning C4065: switch statement contains 'default' but no 'case' labels // Avoid MSVC warning C4065: switch statement contains 'default' but no 'case' labels
// switch( pNode->GetToken().eType ) // switch( pNode->GetToken().eType )
// { // {
// default: // default:
HandleAllSubNodes( pNode, nLevel ); HandleAllSubNodes(pNode, nLevel);
// break; // break;
// } // }
} }
void SmWordExportBase::HandleBinaryOperation( const SmBinHorNode* pNode, int nLevel ) void SmWordExportBase::HandleBinaryOperation(const SmBinHorNode* pNode, int nLevel)
{ {
SAL_INFO( "starmath.wordbase", "Binary: " << int( pNode->Symbol()->GetToken().eType )); SAL_INFO("starmath.wordbase", "Binary: " << int(pNode->Symbol()->GetToken().eType));
// update HandleMath() when adding new items // update HandleMath() when adding new items
switch( pNode->Symbol()->GetToken().eType ) switch (pNode->Symbol()->GetToken().eType)
{ {
case TDIVIDEBY: case TDIVIDEBY:
return HandleFractions( pNode, nLevel, "lin" ); return HandleFractions(pNode, nLevel, "lin");
default: default:
HandleAllSubNodes( pNode, nLevel ); HandleAllSubNodes(pNode, nLevel);
break; break;
} }
} }
void SmWordExportBase::HandleMath( const SmNode* pNode, int nLevel ) void SmWordExportBase::HandleMath(const SmNode* pNode, int nLevel)
{ {
SAL_INFO( "starmath.wordbase", "Math: " << int( pNode->GetToken().eType )); SAL_INFO("starmath.wordbase", "Math: " << int(pNode->GetToken().eType));
switch( pNode->GetToken().eType ) switch (pNode->GetToken().eType)
{ {
case TDIVIDEBY: case TDIVIDEBY:
case TACUTE: case TACUTE:
// these are handled elsewhere, e.g. when handling BINHOR // these are handled elsewhere, e.g. when handling BINHOR
OSL_ASSERT( false ); OSL_ASSERT(false);
default: default:
HandleText( pNode, nLevel ); HandleText(pNode, nLevel);
break; break;
} }
} }
void SmWordExportBase::HandleSubSupScript( const SmSubSupNode* pNode, int nLevel ) void SmWordExportBase::HandleSubSupScript(const SmSubSupNode* pNode, int nLevel)
{ {
// set flags to a bitfield of which sub/sup items exists // set flags to a bitfield of which sub/sup items exists
int flags = ( pNode->GetSubSup( CSUB ) != NULL ? ( 1 << CSUB ) : 0 ) int flags = (pNode->GetSubSup(CSUB) != NULL ? (1 << CSUB) : 0)
| ( pNode->GetSubSup( CSUP ) != NULL ? ( 1 << CSUP ) : 0 ) | (pNode->GetSubSup(CSUP) != NULL ? (1 << CSUP) : 0)
| ( pNode->GetSubSup( RSUB ) != NULL ? ( 1 << RSUB ) : 0 ) | (pNode->GetSubSup(RSUB) != NULL ? (1 << RSUB) : 0)
| ( pNode->GetSubSup( RSUP ) != NULL ? ( 1 << RSUP ) : 0 ) | (pNode->GetSubSup(RSUP) != NULL ? (1 << RSUP) : 0)
| ( pNode->GetSubSup( LSUB ) != NULL ? ( 1 << LSUB ) : 0 ) | (pNode->GetSubSup(LSUB) != NULL ? (1 << LSUB) : 0)
| ( pNode->GetSubSup( LSUP ) != NULL ? ( 1 << LSUP ) : 0 ); | (pNode->GetSubSup(LSUP) != NULL ? (1 << LSUP) : 0);
HandleSubSupScriptInternal( pNode, nLevel, flags ); HandleSubSupScriptInternal(pNode, nLevel, flags);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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