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

fix reading when the next tag can be one of several

üst 5c897753
...@@ -73,7 +73,7 @@ OUString SmOoxmlImport::handleStream() ...@@ -73,7 +73,7 @@ OUString SmOoxmlImport::handleStream()
{ {
// strictly speaking, it is not OMathArg here, but currently supported // strictly speaking, it is not OMathArg here, but currently supported
// functionality is the same like OMathArg, in the future this may need improving // functionality is the same like OMathArg, in the future this may need improving
OUString item = readOMathArg( M_TOKEN( oMath )); OUString item = readOMathArg();
if( item.isEmpty()) if( item.isEmpty())
continue; continue;
if( !ret.isEmpty()) if( !ret.isEmpty())
...@@ -86,42 +86,30 @@ OUString SmOoxmlImport::handleStream() ...@@ -86,42 +86,30 @@ OUString SmOoxmlImport::handleStream()
} }
OUString SmOoxmlImport::readOMathArg( int endtoken ) OUString SmOoxmlImport::readOMathArg()
{ {
OUString ret; while( stream.currentToken() != CLOSING( stream.currentToken()))
while( !stream.atEnd())
{ {
XmlStream::Tag tag = stream.currentTag(); switch( stream.currentToken())
if( tag.token == CLOSING( endtoken ))
break;
if( !ret.isEmpty())
ret += STR( " " );
switch( tag.token )
{ {
case OPENING( M_TOKEN( acc )): case OPENING( M_TOKEN( acc )):
ret += handleAcc(); return handleAcc();
break;
case OPENING( M_TOKEN( bar )): case OPENING( M_TOKEN( bar )):
ret += handleBar(); return handleBar();
break;
case OPENING( M_TOKEN( borderBox )): case OPENING( M_TOKEN( borderBox )):
ret += handleBorderBox(); return handleBorderBox();
break;
case OPENING( M_TOKEN( d )): case OPENING( M_TOKEN( d )):
ret += handleD(); return handleD();
break;
case OPENING( M_TOKEN( f )): case OPENING( M_TOKEN( f )):
ret += handleF(); return handleF();
break;
case OPENING( M_TOKEN( r )): case OPENING( M_TOKEN( r )):
ret += handleR(); return handleR();
break;
default: default:
stream.handleUnexpectedTag(); stream.handleUnexpectedTag();
break; break;
} }
} }
return ret; return OUString();
} }
OUString SmOoxmlImport::handleAcc() OUString SmOoxmlImport::handleAcc()
...@@ -276,7 +264,7 @@ OUString SmOoxmlImport::handleD() ...@@ -276,7 +264,7 @@ OUString SmOoxmlImport::handleD()
OUString SmOoxmlImport::handleE() OUString SmOoxmlImport::handleE()
{ {
stream.ensureOpeningTag( M_TOKEN( e )); stream.ensureOpeningTag( M_TOKEN( e ));
OUString ret = readOMathArg( M_TOKEN( e )); OUString ret = readOMathArg();
stream.ensureClosingTag( M_TOKEN( e )); stream.ensureClosingTag( M_TOKEN( e ));
return ret; return ret;
} }
...@@ -301,10 +289,10 @@ OUString SmOoxmlImport::handleF() ...@@ -301,10 +289,10 @@ OUString SmOoxmlImport::handleF()
stream.ensureClosingTag( M_TOKEN( fPr )); stream.ensureClosingTag( M_TOKEN( fPr ));
} }
stream.ensureOpeningTag( M_TOKEN( num )); stream.ensureOpeningTag( M_TOKEN( num ));
OUString num = readOMathArg( M_TOKEN( num )); OUString num = readOMathArg();
stream.ensureClosingTag( M_TOKEN( num )); stream.ensureClosingTag( M_TOKEN( num ));
stream.ensureOpeningTag( M_TOKEN( den )); stream.ensureOpeningTag( M_TOKEN( den ));
OUString den = readOMathArg( M_TOKEN( den )); OUString den = readOMathArg();
stream.ensureClosingTag( M_TOKEN( den )); stream.ensureClosingTag( M_TOKEN( den ));
stream.ensureClosingTag( M_TOKEN( f )); stream.ensureClosingTag( M_TOKEN( f ));
if( operation == bar ) if( operation == bar )
......
...@@ -51,7 +51,7 @@ private: ...@@ -51,7 +51,7 @@ private:
rtl::OUString handleE(); rtl::OUString handleE();
rtl::OUString handleF(); rtl::OUString handleF();
rtl::OUString handleR(); rtl::OUString handleR();
rtl::OUString readOMathArg( int endtoken ); rtl::OUString readOMathArg();
oox::formulaimport::XmlStream& stream; oox::formulaimport::XmlStream& stream;
}; };
......
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