Commit cc86bdb0 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatWriter - fix tables, styles, math

parent fade21b8
......@@ -105,9 +105,13 @@ public:
oOutputColor.SetTint( ooxColor.m_oThemeTint->GetValue() );
res = true;
}
if ((ooxColor.m_oVal.IsInit()) && (ooxColor.m_oVal->GetValue() == SimpleTypes::hexcolorRGB))
if (ooxColor.m_oVal.IsInit())
{
if (ooxColor.m_oVal->GetValue() == SimpleTypes::hexcolorRGB)
oOutputColor.SetRGB(ooxColor.m_oVal->Get_R(), ooxColor.m_oVal->Get_G(), ooxColor.m_oVal->Get_B());
if (ooxColor.m_oVal->GetValue() == SimpleTypes::hexcolorAuto)
oOutputColor.m_bAuto = true;
res = true;
}
return res;
......
......@@ -165,6 +165,43 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement *
rtfMath->AddItem(oSubMath);
}
}break;
case OOX::et_m_box:
{
OOX::Logic::CBox *ooxSubMath = dynamic_cast<OOX::Logic::CBox *>(ooxMath);
if (ooxSubMath)
{
RtfMathPtr oSubMath;
if (ParseElement(oParam, ooxSubMath->m_oBoxPr.GetPointer(), oSubMath))
rtfMath->AddItem(oSubMath);
oSubMath.reset();
if (ParseElement(oParam, ooxSubMath->m_oElement.GetPointer(), oSubMath))
rtfMath->AddItem(oSubMath);
}
}break;
case OOX::et_m_boxPr:
{
OOX::Logic::CBoxPr *ooxSubMath = dynamic_cast<OOX::Logic::CBoxPr *>(ooxMath);
if (ooxSubMath)
{
RtfMathPtr oSubMath;
if (ParseElement(oParam, ooxSubMath->m_oCtrlPr.GetPointer(), oSubMath))
rtfMath->AddItem(oSubMath);
oSubMath.reset();
if (ParseElement(oParam, ooxSubMath->m_oAln.GetPointer(), oSubMath))
rtfMath->AddItem(oSubMath);
oSubMath.reset();
if (ParseElement(oParam, ooxSubMath->m_oBrk.GetPointer(), oSubMath))
rtfMath->AddItem(oSubMath);
oSubMath.reset();
if (ParseElement(oParam, ooxSubMath->m_oDiff.GetPointer(), oSubMath))
rtfMath->AddItem(oSubMath);
//m_oNoBreak; m_oOpEmu;
}
}break;
case OOX::et_m_dPr:
{
OOX::Logic::CDelimiterPr *ooxSubMath = dynamic_cast<OOX::Logic::CDelimiterPr *>(ooxMath);
......
......@@ -864,6 +864,17 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP
}
}
}
// ------------ test
//if( m_ooxParaProps->m_oPStyle.IsInit() && m_ooxParaProps->m_oPStyle->m_sVal.IsInit())
//{
// CString sStyleName = m_ooxParaProps->m_oPStyle->m_sVal.get2();
// RtfStylePtr oCurStyle;
// if( true == oParam.oRtf->m_oStyleTable.GetStyle(sStyleName, oCurStyle) )
// {
// oOutputProperty.m_nStyle = oCurStyle->m_nID;
// }
//}
// ------------ test
if( m_ooxParaProps->m_oSuppressAutoHyphens.IsInit() )
{
if (m_ooxParaProps->m_oSuppressAutoHyphens->m_oVal.ToBool())
......@@ -965,6 +976,11 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP
oOutputProperty.m_nSpaceBetween = m_ooxParaProps->m_oSpacing->m_oLine->ToTwips();
oOutputProperty.m_nSpaceMultiLine = 0;
}
else //auto
{
oOutputProperty.m_nSpaceBetween = m_ooxParaProps->m_oSpacing->m_oLine->ToTwips();
oOutputProperty.m_nSpaceMultiLine = 1;
}
}
}
else
......
......@@ -122,8 +122,8 @@ public:
CcnfStyle style;
opPrReader.Parse( oParam, oNewParStyle->m_oParProp, style );
oNewParStyle->m_oParProp.m_nListId = PROP_DEF; //экспериментально вроде нельзя иметь numbering в параграф стиле
oNewParStyle->m_oParProp.m_nListLevel = PROP_DEF;
//oNewParStyle->m_oParProp.m_nListId = PROP_DEF; //экспериментально вроде нельзя иметь numbering в параграф стиле
//oNewParStyle->m_oParProp.m_nListLevel = PROP_DEF;
}
if (m_ooxStyle->m_oTblPr.IsInit() && RtfStyle::stTable == eStyleType )
......
......@@ -74,9 +74,9 @@ public:
case SimpleTypes::mergeRestart : oOutputProperty.m_bMergeFirst = 1; break;
}
}
if( m_ooxTableCellProps->m_oVMerge.IsInit() && m_ooxTableCellProps->m_oVMerge->m_oVal.IsInit() )
if( m_ooxTableCellProps->m_oVMerge.IsInit())
{
if(m_ooxTableCellProps->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart)
if ((m_ooxTableCellProps->m_oVMerge->m_oVal.IsInit()) && (m_ooxTableCellProps->m_oVMerge->m_oVal->GetValue() == SimpleTypes::mergeRestart))
oOutputProperty.m_bMergeFirstVertical = 1;
else
oOutputProperty.m_bMergeVertical = 1;
......
......@@ -1676,9 +1676,9 @@ CString RtfFrame::RenderToOOX(RenderParameter oRenderParameter)
CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
//RENDER_RTF_INT( m_nStyle, sResult, _T("s") );
RENDER_RTF_BOOL( m_bAutoHyphenation , sResult, _T("hyphpar") );
RENDER_RTF_BOOL( m_bInTable , sResult, _T("intbl") );
RENDER_RTF_INT ( m_nStyle , sResult, _T("s") ); //test
RENDER_RTF_BOOL ( m_bAutoHyphenation , sResult, _T("hyphpar") );
RENDER_RTF_BOOL ( m_bInTable , sResult, _T("intbl") );
if( PROP_DEF != m_nItap && 1 != m_nItap )
sResult.AppendFormat( _T("\\itap%d"),m_nItap );
......
......@@ -283,15 +283,15 @@ CString RtfWriter::CreateRtfStart()
sResult += m_oDocument.m_oProperty.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oFontTable.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oColorTable.RenderToRtf( oRenderParameter );
//CString sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter );
//if( false == sDefCharProp.IsEmpty() )
// sResult += _T("{\\*\\defchp ") + sDefCharProp + _T("}");
//CString sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter );
//if( false == sDefParProp.IsEmpty() )
// sResult += _T("{\\*\\defpap ") + sDefParProp+ _T("}");
//sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter ) );
//---------- test
CString sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter );
if( false == sDefCharProp.IsEmpty() )
sResult += _T("{\\*\\defchp ") + sDefCharProp + _T("}");
CString sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter );
if( false == sDefParProp.IsEmpty() )
sResult += _T("{\\*\\defpap ") + sDefParProp+ _T("}");
sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter );
//---------- test
sResult += m_oDocument.m_oListTabel.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oListOverrideTabel.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oInformation.RenderToRtf( oRenderParameter );
......
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