Commit b41b5edb authored by ElenaSubbotina's avatar ElenaSubbotina

DocxFormatRead - fix vml shape

parent 695c38c8
...@@ -55,7 +55,19 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type) ...@@ -55,7 +55,19 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
if (vml_shape_type == NULL) return; if (vml_shape_type == NULL) return;
//custom shape //custom shape
//save cash to other shape with this type
if (vml_shape_type->m_sId.IsInit())
{
std::wstring sId (vml_shape_type->m_sId.get());
if (odf_context()->drawing_context()->m_mapVmlShapeTypes.find( sId ) ==
odf_context()->drawing_context()->m_mapVmlShapeTypes.end())
{
odf_context()->drawing_context()->m_mapVmlShapeTypes.insert(odf_context()->drawing_context()->m_mapVmlShapeTypes.begin(),
std::pair<std::wstring, OOX::Vml::CShapeType*>(sId, vml_shape_type));
}
}
//m_oPreferRelative//типо можно менять размер //m_oPreferRelative//типо можно менять размер
for (unsigned int i=0 ; i < vml_shape_type->m_arrItems.size();i++) for (unsigned int i=0 ; i < vml_shape_type->m_arrItems.size();i++)
......
...@@ -2042,10 +2042,13 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic) ...@@ -2042,10 +2042,13 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
else // and oox_pic->m_oShapeRect else // and oox_pic->m_oShapeRect
{ {
bool bSet = false; bool bSet = false;
OOX::Vml::CShapeType* shape_type = NULL;
if (oox_pic->m_oShape.IsInit()) if (oox_pic->m_oShape.IsInit())
{ {
OOX::Vml::SptType sptType = oox_pic->m_oShapeType->m_oSpt.IsInit() ? static_cast<OOX::Vml::SptType>(oox_pic->m_oShapeType->m_oSpt->GetValue()) : OOX::Vml::sptNotPrimitive; OOX::Vml::SptType sptType = oox_pic->m_oShape->m_oSpt.IsInit() ? static_cast<OOX::Vml::SptType>(oox_pic->m_oShape->m_oSpt->GetValue()) : OOX::Vml::sptNotPrimitive;
if (sptType != OOX::Vml::SptType::sptNotPrimitive)
if (sptType != OOX::Vml::SptType::sptNotPrimitive)
{ {
odf_context()->drawing_context()->set_name(std::wstring (L"Custom") + boost::lexical_cast<std::wstring>(sptType)); odf_context()->drawing_context()->set_name(std::wstring (L"Custom") + boost::lexical_cast<std::wstring>(sptType));
odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType)); odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType));
...@@ -2065,12 +2068,43 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic) ...@@ -2065,12 +2068,43 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
odf_context()->drawing_context()->set_line_width(1.); odf_context()->drawing_context()->set_line_width(1.);
bSet = true; bSet = true;
} }
if (oox_pic->m_oShape->m_sType.IsInit())
{
std::wstring type( oox_pic->m_oShape->m_sType.get());
type = type.substr(1);//without #
std::map<std::wstring, OOX::Vml::CShapeType*>::iterator it = odf_context()->drawing_context()->m_mapVmlShapeTypes.find(type);
if ( it != odf_context()->drawing_context()->m_mapVmlShapeTypes.end())
{
shape_type = it->second;
sptType = shape_type->m_oSpt.IsInit() ? static_cast<OOX::Vml::SptType>(shape_type->m_oSpt->GetValue()) : OOX::Vml::sptNotPrimitive;
if (!bSet && sptType != OOX::Vml::SptType::sptNotPrimitive)
{
odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType));
bSet = true;
}
}
if (!bSet)
{
int pos = oox_pic->m_oShape->m_sType->Find(_T("#_x0000_t"));
if (pos >= 0)
{
sptType = (OOX::Vml::SptType)_wtoi(oox_pic->m_oShape->m_sType->Mid(pos + 9, oox_pic->m_oShape->m_sType->GetLength() - pos - 9).GetString());
odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType));
bSet = true;
}
}
}
} }
if (!bSet) if (!bSet)
{ {
odf_context()->drawing_context()->set_name(L"Rect"); odf_context()->drawing_context()->set_name(L"Rect");
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect); odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect);
} }
OoxConverter::convert(shape_type);
OoxConverter::convert(oox_pic->m_oShape.GetPointer()); OoxConverter::convert(oox_pic->m_oShape.GetPointer());
odf_context()->drawing_context()->end_shape(); odf_context()->drawing_context()->end_shape();
} }
......
...@@ -395,27 +395,28 @@ CString RtfSectionProperty::RenderToRtf(RenderParameter oRenderParameter) ...@@ -395,27 +395,28 @@ CString RtfSectionProperty::RenderToRtf(RenderParameter oRenderParameter)
if( RENDER_TO_OOX_PARAM_FIRST_SECTION != oRenderParameter.nType )//Пишем как свойства секции if( RENDER_TO_OOX_PARAM_FIRST_SECTION != oRenderParameter.nType )//Пишем как свойства секции
{ {
//Page Information //Page Information
RENDER_RTF_INT( m_nPageWidth, sResult, _T("pgwsxn") ) RENDER_RTF_INT( m_nPageWidth, sResult, _T("pgwsxn") )
RENDER_RTF_INT( m_nPageHeight, sResult, _T("pghsxn") ) RENDER_RTF_INT( m_nPageHeight, sResult, _T("pghsxn") )
RENDER_RTF_INT( m_nMarginLeft, sResult, _T("marglsxn") ) RENDER_RTF_INT( m_nMarginLeft, sResult, _T("marglsxn") )
RENDER_RTF_INT( m_nMarginRight, sResult, _T("margrsxn") ) RENDER_RTF_INT( m_nMarginRight, sResult, _T("margrsxn") )
RENDER_RTF_INT( m_nMarginTop, sResult, _T("margtsxn") ) RENDER_RTF_INT( m_nMarginTop, sResult, _T("margtsxn") )
RENDER_RTF_INT( m_nMarginBottom, sResult, _T("margbsxn") ) RENDER_RTF_INT( m_nMarginBottom, sResult, _T("margbsxn") )
RENDER_RTF_INT( m_nGutterMarginWidth, sResult, _T("guttersxn") ) RENDER_RTF_INT( m_nGutterMarginWidth, sResult, _T("guttersxn") )
RENDER_RTF_BOOL( m_bSwitchMargin, sResult, _T("margmirsxn") ) RENDER_RTF_BOOL( m_bSwitchMargin, sResult, _T("margmirsxn") )
RENDER_RTF_BOOL( m_bLandscapeFormat, sResult, _T("lndscpsxn") ) RENDER_RTF_BOOL( m_bLandscapeFormat, sResult, _T("lndscpsxn") )
} }
RENDER_RTF_BOOL( m_bTitlePage, sResult, _T("titlepg") ) RENDER_RTF_BOOL ( m_bTitlePage, sResult, _T("titlepg") )
RENDER_RTF_INT( m_nHeaderTop, sResult, _T("headery") ) RENDER_RTF_INT ( m_nHeaderTop, sResult, _T("headery") )
RENDER_RTF_INT( m_nFooterBottom, sResult, _T("footery") ) RENDER_RTF_INT ( m_nFooterBottom, sResult, _T("footery") )
//Page Numbers //Page Numbers
RENDER_RTF_INT( m_nPageNumberStart, sResult, _T("pgnstarts") ) RENDER_RTF_INT ( m_nPageNumberStart, sResult, _T("pgnstarts") )
RENDER_RTF_BOOL( m_bPageNumberContinuos, sResult, _T("pgncont") ) RENDER_RTF_BOOL ( m_bPageNumberContinuos, sResult, _T("pgncont") )
RENDER_RTF_BOOL( m_bPageNumberRestart, sResult, _T("pgnrestart") ) RENDER_RTF_BOOL ( m_bPageNumberRestart, sResult, _T("pgnrestart") )
RENDER_RTF_INT( m_nPageNumberX, sResult, _T("pgnx") ) RENDER_RTF_INT ( m_nPageNumberX, sResult, _T("pgnx") )
RENDER_RTF_INT( m_nPageNumberY, sResult, _T("pgny") ) RENDER_RTF_INT ( m_nPageNumberY, sResult, _T("pgny") )
switch( m_ePageNumberFormat ) switch( m_ePageNumberFormat )
{ {
case pnf_pgndec: sResult += _T("\\pgndec" ); break; case pnf_pgndec: sResult += _T("\\pgndec" ); break;
...@@ -456,9 +457,9 @@ CString RtfSectionProperty::RenderToRtf(RenderParameter oRenderParameter) ...@@ -456,9 +457,9 @@ CString RtfSectionProperty::RenderToRtf(RenderParameter oRenderParameter)
sResult += _T("\\pgbrdrb"); sResult += _T("\\pgbrdrb");
sResult += m_oBorderBottom.RenderToRtf( oRenderParameter ); sResult += m_oBorderBottom.RenderToRtf( oRenderParameter );
} }
RENDER_RTF_INT( m_nBorderArt, sResult, _T("brdrart") ) RENDER_RTF_INT( m_nBorderArt, sResult, _T("brdrart") )
RENDER_RTF_INT( m_nBorderMeasure, sResult, _T("pgbrdropt") ) RENDER_RTF_INT( m_nBorderMeasure, sResult, _T("pgbrdropt") )
RENDER_RTF_INT( m_nBorderAlign, sResult, _T("pgbrdrsnap") ) RENDER_RTF_INT( m_nBorderAlign, sResult, _T("pgbrdrsnap") )
//footer - header //footer - header
if( 0 != m_oHeaderRight ) if( 0 != m_oHeaderRight )
......
...@@ -2970,9 +2970,15 @@ namespace SimpleTypes ...@@ -2970,9 +2970,15 @@ namespace SimpleTypes
return 0; return 0;
int nPos = sValue.Find( _T(",") ); int nPos = sValue.Find( _T(",") );
if ( -1 == nPos ) if ( -1 == nPos )
return 0; {
//only x coord
sValue.Replace(_T("@"), _T(""));
m_nX = sValue.IsEmpty() ? 0 : _wtoi(sValue );
}
else
{
CString strX = sValue.Mid( 0, nPos ); CString strX = sValue.Mid( 0, nPos );
CString strY = sValue.Mid( nPos + 1, nLen - nPos - 1 ) ; CString strY = sValue.Mid( nPos + 1, nLen - nPos - 1 ) ;
...@@ -2981,6 +2987,7 @@ namespace SimpleTypes ...@@ -2981,6 +2987,7 @@ namespace SimpleTypes
m_nX = strX.IsEmpty() ? 0 : _wtoi(strX ); m_nX = strX.IsEmpty() ? 0 : _wtoi(strX );
m_nY = strY.IsEmpty() ? 0 : _wtoi(strY ); m_nY = strY.IsEmpty() ? 0 : _wtoi(strY );
}
return 0; return 0;
} }
......
...@@ -98,7 +98,7 @@ namespace OOX ...@@ -98,7 +98,7 @@ namespace OOX
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrNoShade; SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrNoShade;
SimpleTypes::CDouble m_oHrPct; SimpleTypes::CDouble m_oHrPct;
SimpleTypes::CHrAlign<SimpleTypes::hralignLeft> m_oHrAlign; SimpleTypes::CHrAlign<SimpleTypes::hralignLeft> m_oHrAlign;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oAllowInCell; SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oAllowInCell;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oAllowOverlap; SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oAllowOverlap;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserDrawn; SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserDrawn;
nullable<SimpleTypes::CColorType<>> m_oBorderTopColor; nullable<SimpleTypes::CColorType<>> m_oBorderTopColor;
...@@ -2897,7 +2897,7 @@ namespace OOX ...@@ -2897,7 +2897,7 @@ namespace OOX
SimpleTypes::CDouble m_oHrPct; SimpleTypes::CDouble m_oHrPct;
SimpleTypes::CHrAlign<SimpleTypes::hralignLeft> m_oHrAlign; SimpleTypes::CHrAlign<SimpleTypes::hralignLeft> m_oHrAlign;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oAllowInCell; SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oAllowInCell;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oAllowOverlap; SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oAllowOverlap;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserDrawn; SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserDrawn;
nullable<SimpleTypes::CColorType<>> m_oBorderTopColor; nullable<SimpleTypes::CColorType<>> m_oBorderTopColor;
nullable<SimpleTypes::CColorType<>> m_oBorderLeftColor; nullable<SimpleTypes::CColorType<>> m_oBorderLeftColor;
......
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