Commit ef53ac4c authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatReader - fix styles (change equals id & name)

parent f50dd716
...@@ -1003,7 +1003,7 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap ...@@ -1003,7 +1003,7 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
oNewProperty = oParam.oRtf->m_oDefaultCharProp; oNewProperty = oParam.oRtf->m_oDefaultCharProp;
//применяем внешний стиль //применяем внешний стиль
//oNewProperty.Merge( oOutputParagraph.m_oProperty.m_oCharProperty ); oNewProperty.Merge( oOutputParagraph.m_oProperty.m_oCharProperty );
oNewProperty.Merge( m_oCharProperty ); oNewProperty.Merge( m_oCharProperty );
if( NULL != poStyle && TYPE_RTF_PROPERTY_STYLE_CHAR == poStyle->GetType() ) if( NULL != poStyle && TYPE_RTF_PROPERTY_STYLE_CHAR == poStyle->GetType() )
......
...@@ -779,7 +779,7 @@ std::wstring RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter) ...@@ -779,7 +779,7 @@ std::wstring RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
if( true == poRtfDocument->m_oStyleTable.GetStyle( m_nCharStyle, oStyle ) ) if( true == poRtfDocument->m_oStyleTable.GetStyle( m_nCharStyle, oStyle ) )
{ {
sResult += L"<w:pStyle w:val=\""; sResult += L"<w:pStyle w:val=\"";
sResult += oStyle->m_sName; sResult += L"Style_" + std::to_wstring(m_nCharStyle); //oStyle->m_sName;
sResult += L"\"/>"; sResult += L"\"/>";
} }
} }
...@@ -1179,28 +1179,32 @@ std::wstring RtfStyle::RenderToOOXBegin(RenderParameter oRenderParameter) ...@@ -1179,28 +1179,32 @@ std::wstring RtfStyle::RenderToOOXBegin(RenderParameter oRenderParameter)
case stSection : sType = L"numbering"; break; case stSection : sType = L"numbering"; break;
case stTable : sType = L"table"; break; case stTable : sType = L"table"; break;
} }
sResult += L"<w:style w:type=\"" + sType + L"\" w:styleId=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\">"; //sResult += L"<w:style w:type=\"" + sType + L"\" w:styleId=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\">";
sResult += L"<w:name w:val=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\"/>"; sResult += L"<w:style w:type=\"" + sType + L"\" w:styleId=\"" + L"Style_" + std::to_wstring(m_nID) + L"\">";
sResult += L"<w:name w:val=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\"/>";
if( PROP_DEF != m_nBasedOn ) if( PROP_DEF != m_nBasedOn )
{ {
RtfStylePtr oBaseStyle; RtfStylePtr oBaseStyle;
if( true == poDocument->m_oStyleTable.GetStyle( m_nBasedOn, oBaseStyle ) ) if( true == poDocument->m_oStyleTable.GetStyle( m_nBasedOn, oBaseStyle ) )
sResult += L"<w:basedOn w:val=\"" + XmlUtils::EncodeXmlString( oBaseStyle->m_sName ) + L"\"/>"; {
sResult += L"<w:basedOn w:val=\"Style_" + std::to_wstring(m_nBasedOn) + L"\"/>";
//sResult += L"<w:basedOn w:val=\"" + XmlUtils::EncodeXmlString( oBaseStyle->m_sName ) + L"\"/>";
}
} }
//if( PROP_DEF != m_nNext ) //if( PROP_DEF != m_nNext )
// sResult += L"<w:next w:val=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\"/>", );//Todo // sResult += L"<w:next w:val=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\"/>", );//Todo
//if( PROP_DEF != m_nLink ) //if( PROP_DEF != m_nLink )
// sResult += L"<w:link w:val=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\"/>", );//Todo // sResult += L"<w:link w:val=\"" + XmlUtils::EncodeXmlString( m_sName ) + L"\"/>", );//Todo
if( PROP_DEF != m_bHidden ) sResult += L"<w:hidden/>"; if( 1 == m_bHidden ) sResult += L"<w:hidden/>";
if( PROP_DEF != m_bLocked ) sResult += L"<w:locked/>"; if( 1 == m_bLocked ) sResult += L"<w:locked/>";
if( PROP_DEF != m_bPersonal ) sResult += L"<w:personal w:val=\"true\" />"; if( 1 == m_bPersonal ) sResult += L"<w:personal w:val=\"true\" />";
if( PROP_DEF != m_bCompose ) sResult += L"<w:personalCompose w:val=\"true\" />"; //if( 1 == m_bCompose ) sResult += L"<w:personalCompose w:val=\"true\" />";
if( PROP_DEF != m_bReply ) sResult += L"<w:personalReply w:val=\"true\" />"; if( 1 == m_bReply ) sResult += L"<w:personalReply w:val=\"true\" />";
if( 1 == m_nSemiHidden ) sResult += L"<w:semiHidden/>"; if( 1 == m_nSemiHidden ) sResult += L"<w:semiHidden/>";
if( PROP_DEF != m_bQFormat ) sResult += L"<w:qformat/>"; if( 1 == m_bQFormat ) sResult += L"<w:qformat/>";
if( PROP_DEF != m_nPriority ) sResult += L"<w:uiPriority w:val=\"" + std::to_wstring(m_nPriority) + L"\"/>"; if( 1 == m_bUnhiddenWhenUse ) sResult += L"<w:unhideWhenUsed/>";
if( PROP_DEF != m_bUnhiddenWhenUse ) sResult += L"<w:unhideWhenUsed/>"; if( PROP_DEF != m_nPriority ) sResult += L"<w:uiPriority w:val=\"" + std::to_wstring(m_nPriority) + L"\"/>";
return sResult; return sResult;
} }
...@@ -1965,7 +1969,7 @@ std::wstring RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter) ...@@ -1965,7 +1969,7 @@ std::wstring RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
if( true == poRtfDocument->m_oStyleTable.GetStyle( m_nStyle, oCurStile ) ) if( true == poRtfDocument->m_oStyleTable.GetStyle( m_nStyle, oCurStile ) )
{ {
sResult += L"<w:pStyle w:val=\""; sResult += L"<w:pStyle w:val=\"";
sResult += oCurStile->m_sName; sResult += L"Style_" + std::to_wstring(m_nStyle);//oCurStile->m_sName;
sResult += L"\"/>" ; sResult += L"\"/>" ;
} }
} }
...@@ -2558,7 +2562,7 @@ std::wstring RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter) ...@@ -2558,7 +2562,7 @@ std::wstring RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
if( true == poDocument->m_oStyleTable.GetStyle( m_nStyle, oCurStyle) ) if( true == poDocument->m_oStyleTable.GetStyle( m_nStyle, oCurStyle) )
{ {
sResult += L"<w:tblStyle w:val=\""; sResult += L"<w:tblStyle w:val=\"";
sResult += oCurStyle->m_sName; sResult += L"Style_" + std::to_wstring(m_nStyle); //oCurStyle->m_sName;
sResult += L"\"/>"; sResult += L"\"/>";
} }
} }
......
...@@ -263,8 +263,8 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter) ...@@ -263,8 +263,8 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
m_nWrapType = 3; m_nWrapType = 3;
m_nWrapSideType = 0; m_nWrapSideType = 0;
m_bLockAnchor = 0; m_bLockAnchor = 0;
m_nZOrder = 0;//PROP_DEF; //m_nZOrder = PROP_DEF;
m_nZOrderRelative = 0;//PROP_DEF; m_nZOrderRelative = 0;
m_nLeft = m_nTop = 0; m_nLeft = m_nTop = 0;
m_nRelBottom = m_nRelRight = PROP_DEF; m_nRelBottom = m_nRelRight = PROP_DEF;
m_nPositionV = m_nPositionH = PROP_DEF; m_nPositionV = m_nPositionH = PROP_DEF;
...@@ -284,16 +284,15 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter) ...@@ -284,16 +284,15 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT ( m_nWrapType , sResult, L"shpwr" ); RENDER_RTF_INT ( m_nWrapType , sResult, L"shpwr" );
RENDER_RTF_INT ( m_nWrapSideType , sResult, L"shpwrk" ); RENDER_RTF_INT ( m_nWrapSideType , sResult, L"shpwrk" );
RENDER_RTF_INT( m_nZOrderRelative, sResult, L"shpfblwtxt");
//if (st_none == m_eAnchorTypeShape) RENDER_RTF_INT ( m_nZOrder, sResult, L"shpz" );
{
RENDER_RTF_INT ( m_nZOrder, sResult, L"shpz" );
}
sResult += L"\\shplockanchor"; sResult += L"\\shplockanchor";
//sResult += L"{\\sp{\\sn fUseShapeAnchor}{\\sv 0}}";
//sResult += L"{\\sp{\\sn fPseudoInline}{\\sv 1}}";
RENDER_RTF_INT( m_nID, sResult, L"shplid" ); RENDER_RTF_INT( m_nID, sResult, L"shplid" );
sResult += L"{\\sp{\\sn fUseShapeAnchor}{\\sv 0}}";
sResult += L"{\\sp{\\sn fPseudoInline}{\\sv 1}}";
} }
sResult += RenderToRtfShapeProperty( oRenderParameter ); sResult += RenderToRtfShapeProperty( oRenderParameter );
...@@ -422,13 +421,10 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter ...@@ -422,13 +421,10 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
std::wstring sResult; std::wstring sResult;
//Position absolute //Position absolute
//if( st_inline != m_eAnchorTypeShape) RENDER_RTF_SHAPE_PROP(L"posh", sResult, m_nPositionH);
{ RENDER_RTF_SHAPE_PROP(L"posrelh", sResult, m_nPositionHRelative);
RENDER_RTF_SHAPE_PROP(L"posh", sResult, m_nPositionH); RENDER_RTF_SHAPE_PROP(L"posv", sResult, m_nPositionV);
RENDER_RTF_SHAPE_PROP(L"posrelh", sResult, m_nPositionHRelative); RENDER_RTF_SHAPE_PROP(L"posrelv", sResult, m_nPositionVRelative);
RENDER_RTF_SHAPE_PROP(L"posv", sResult, m_nPositionV);
RENDER_RTF_SHAPE_PROP(L"posrelv", sResult, m_nPositionVRelative);
}
RENDER_RTF_SHAPE_PROP(L"fLayoutInCell", sResult, m_bLayoutInCell); RENDER_RTF_SHAPE_PROP(L"fLayoutInCell", sResult, m_bLayoutInCell);
RENDER_RTF_SHAPE_PROP(L"fAllowOverlap", sResult, m_bAllowOverlap); RENDER_RTF_SHAPE_PROP(L"fAllowOverlap", sResult, m_bAllowOverlap);
......
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