Commit 4e193650 authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

RtfFormatWriter - поправлена конвертация стилей математических формул

parent d9b5b56b
......@@ -19,23 +19,6 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement *
switch(ooxTypeElement)
{
case OOX::et_w_rPr:
{
OOX::Logic::CRunProperty *ooxRPr = dynamic_cast<OOX::Logic::CRunProperty *>(ooxMath);
if (ooxRPr)
{
RtfCharProperty oCurrentProp;
oCurrentProp.SetDefaultOOX();
OOXrPrReader orPrReader(ooxRPr);
orPrReader.Parse( oParam, oCurrentProp );
RtfCharPtr oChar = RtfCharPtr(new RtfChar);
oChar->m_oProperty = oCurrentProp;
rtfMath->m_oVal.AddItem( oChar );
}
}break;
case OOX::et_m_r:
{
RtfCharProperty oCurrentProp;
......@@ -720,9 +703,20 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement *
OOX::Logic::CCtrlPr *ooxSubMath = dynamic_cast<OOX::Logic::CCtrlPr *>(ooxMath);
if (ooxSubMath)
{
RtfMathPtr oSubMath;
if (ParseElement(oParam, ooxSubMath->m_oRPr.GetPointer(), oSubMath))
rtfMath->AddItem(oSubMath);
OOX::Logic::CRunProperty *ooxRPr = dynamic_cast<OOX::Logic::CRunProperty *>(ooxSubMath->m_oRPr.GetPointer());
if (ooxRPr)
{
RtfCharProperty oCurrentProp;
oCurrentProp.SetDefaultOOX();
OOXrPrReader orPrReader(ooxRPr);
orPrReader.Parse( oParam, oCurrentProp );
RtfCharPtr oChar = RtfCharPtr(new RtfChar);
oChar->m_oProperty = oCurrentProp;
rtfMath->AddItem( oChar );
}
}
}break;
default:
......
......@@ -328,12 +328,20 @@ public:
sText = renderRtfText( m_sChars, oRenderParameter.poDocument, &m_oProperty );
else
sText = m_sChars;
if( _T("") != sText )
CString sTextProp = m_oProperty.RenderToRtf( oRenderParameter ) ;
if( !sText.IsEmpty() || !sTextProp.IsEmpty())
{
result.Append(_T("{"));
result.Append( m_oProperty.RenderToRtf( oRenderParameter ) );
result.Append( _T(" ") + sText );
result.Append(_T("}"));
if (oRenderParameter.nType != RENDER_TO_RTF_PARAM_NESTED)
result.Append( _T("{"));
result.Append( sTextProp );
result.Append( _T(" "));
result.Append( sText );
if (oRenderParameter.nType != RENDER_TO_RTF_PARAM_NESTED)
result.Append( _T("}"));
}
}
return result;
......
......@@ -64,18 +64,11 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter)
sResult.AppendFormat(_T("{\\%ls"), m_sRtfName.GetBuffer());
RenderParameter oNewParameter = oRenderParameter;
//oNewParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
//sResult.Append( m_oProperty.RenderToRtf( oNewParameter ) );
if (m_sRtfName == L"mctrlPr")
{
m_bIsVal = m_bIsVal;
}
//if( _T("mr") == m_sRtfName )
//{
// oNewParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
// sResult.Append( _T(" ") );
// for( int i = 0; i < m_oVal.size(); i++ )
// sResult.Append( _T(" ") + m_oVal[i]->RenderToRtf( oNewParameter ) );
//}
//else
//if (this->m_bIsVal)
CString sVal;
if (m_bIsVal)
......@@ -120,12 +113,6 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter)
RenderParameter oNewParam = oRenderParameter;
//oNewParam.nType = RENDER_TO_OOX_PARAM_TEXT;
//sProp = m_oProperty.RenderToOOX( oNewParam );
//oNewParam.nType = RENDER_TO_OOX_PARAM_PLAIN;
//sVal = m_oVal.RenderToOOX( oNewParam );
if (m_bIsVal || m_bIsBool)
{
oNewParam.nType = RENDER_TO_OOX_PARAM_PLAIN;
......
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