Commit 2577365e authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatWriter - small refactoring + fix users file

parent 00df0261
...@@ -588,7 +588,7 @@ namespace NSPresentationEditor ...@@ -588,7 +588,7 @@ namespace NSPresentationEditor
#else #else
std::wstring ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false) std::wstring ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false)
{ {
if (pPPTShape->m_eType == PPTShapes::sptCRect) if (pPPTShape->m_eType == PPTShapes::sptCRect || pPPTShape->m_eType == PPTShapes::sptCFrame)
{ {
if (bIsNamespace) if (bIsNamespace)
{ {
...@@ -604,7 +604,14 @@ namespace NSPresentationEditor ...@@ -604,7 +604,14 @@ namespace NSPresentationEditor
} }
return _T("<a:prstGeom prst=\"line\"><a:avLst/></a:prstGeom>"); return _T("<a:prstGeom prst=\"line\"><a:avLst/></a:prstGeom>");
} }
else if (pPPTShape->m_eType == PPTShapes::sptCEllipse)
{
if (bIsNamespace)
{
return _T("<a:prstGeom xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" prst=\"line\"><a:avLst/></a:prstGeom>");
}
return _T("<a:prstGeom prst=\"ellipse\"><a:avLst/></a:prstGeom>");
}
std::wstring strXmlPPTX = bIsNamespace ? _T("<a:custGeom xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">") : _T("<a:custGeom>"); std::wstring strXmlPPTX = bIsNamespace ? _T("<a:custGeom xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">") : _T("<a:custGeom>");
CFormulaConverter pFormulaConverter; CFormulaConverter pFormulaConverter;
......
...@@ -44,13 +44,13 @@ int OOXGraphicReader::Parse( ReaderParameter oParam , RtfShapePtr & pOutput) ...@@ -44,13 +44,13 @@ int OOXGraphicReader::Parse( ReaderParameter oParam , RtfShapePtr & pOutput)
{ {
if (m_ooxGraphic->element.getType() == OOX::et_p_ShapeTree) if (m_ooxGraphic->element.getType() == OOX::et_p_ShapeTree)
{ {
OOXShapeReader shapeReader(m_ooxGraphic->element.GetElem().operator->()); OOXShapeGroupReader groupReader(dynamic_cast<PPTX::Logic::SpTree*>(m_ooxGraphic->element.GetElem().operator->()));
return (shapeReader.Parse(oParam, pOutput) ? 1 : 0); return (groupReader.Parse(oParam, pOutput) ? 1 : 0);
} }
else else
{ {
OOXShapeGroupReader groupReader(dynamic_cast<PPTX::Logic::SpTree*>(m_ooxGraphic->element.GetElem().operator->())); OOXShapeReader shapeReader(m_ooxGraphic->element.GetElem().operator->());
return (groupReader.Parse(oParam, pOutput) ? 1 : 0); return (shapeReader.Parse(oParam, pOutput) ? 1 : 0);
} }
} }
if (m_ooxGraphic->olePic.IsInit()) if (m_ooxGraphic->olePic.IsInit())
......
...@@ -49,6 +49,15 @@ public: ...@@ -49,6 +49,15 @@ public:
pOutput->m_eAnchorTypeShape = RtfShape::st_anchor; pOutput->m_eAnchorTypeShape = RtfShape::st_anchor;
if ( m_ooxAnchor->m_oDocPr.IsInit() )
{
pOutput->m_nID = m_ooxAnchor->m_oDocPr->id + 1025;
pOutput->m_sName = m_ooxAnchor->m_oDocPr->name;
if (m_ooxAnchor->m_oDocPr->descr.IsInit())
pOutput->m_sDescription = m_ooxAnchor->m_oDocPr->descr.get();
}
pOutput->m_bAllowOverlap = m_ooxAnchor->m_oAllowOverlap.IsInit() ? m_ooxAnchor->m_oAllowOverlap->ToBool() : false; pOutput->m_bAllowOverlap = m_ooxAnchor->m_oAllowOverlap.IsInit() ? m_ooxAnchor->m_oAllowOverlap->ToBool() : false;
pOutput->m_nZOrderRelative = m_ooxAnchor->m_oBehindDoc.IsInit() ? m_ooxAnchor->m_oBehindDoc->ToBool() : false; pOutput->m_nZOrderRelative = m_ooxAnchor->m_oBehindDoc.IsInit() ? m_ooxAnchor->m_oBehindDoc->ToBool() : false;
pOutput->m_bHidden = m_ooxAnchor->m_oHidden.IsInit() ? m_ooxAnchor->m_oHidden->ToBool() : false; pOutput->m_bHidden = m_ooxAnchor->m_oHidden.IsInit() ? m_ooxAnchor->m_oHidden->ToBool() : false;
......
...@@ -78,6 +78,15 @@ public: ...@@ -78,6 +78,15 @@ public:
} }
} }
if ( m_ooxInline->m_oDocPr.IsInit() )
{
pOutput->m_nID = m_ooxInline->m_oDocPr->id + 1025;
pOutput->m_sName = m_ooxInline->m_oDocPr->name;
if (m_ooxInline->m_oDocPr->descr.IsInit())
pOutput->m_sDescription = m_ooxInline->m_oDocPr->descr.get();
}
OOXGraphicReader oGraphicReader(&m_ooxInline->m_oGraphic); OOXGraphicReader oGraphicReader(&m_ooxInline->m_oGraphic);
int result = oGraphicReader.Parse( oParam, pOutput); int result = oGraphicReader.Parse( oParam, pOutput);
......
...@@ -749,33 +749,45 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::L ...@@ -749,33 +749,45 @@ bool OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::L
if( PROP_DEF != nCropedWidthGoal ) if( PROP_DEF != nCropedWidthGoal )
{ {
//делаем crop //делаем crop
if (oox_bitmap_fill->srcRect->l.IsInit())
{
double nCropLeft = XmlUtils::GetInteger( oox_bitmap_fill->srcRect->l.get()) / 100. ; double nCropLeft = XmlUtils::GetInteger( oox_bitmap_fill->srcRect->l.get()) / 100. ;
//pOutput->m_oPicture->m_nCropL = nCropLeft * pOutput->m_oPicture->m_nWidthGoal * pOutput->m_oPicture->m_nScaleX / 100; //pOutput->m_oPicture->m_nCropL = nCropLeft * pOutput->m_oPicture->m_nWidthGoal * pOutput->m_oPicture->m_nScaleX / 100;
pOutput->m_oPicture->m_nCropL = (int)(nCropLeft * pOutput->m_oPicture->m_nWidthGoal); pOutput->m_oPicture->m_nCropL = (int)(nCropLeft * pOutput->m_oPicture->m_nWidthGoal);
pOutput->m_nCropFromLeft = (int)(nCropLeft* 65536); pOutput->m_nCropFromLeft = (int)(nCropLeft* 65536);
nCropedWidthGoal -= pOutput->m_oPicture->m_nCropL; nCropedWidthGoal -= pOutput->m_oPicture->m_nCropL;
}
if (oox_bitmap_fill->srcRect->r.IsInit())
{
double nCropRight = XmlUtils::GetInteger( oox_bitmap_fill->srcRect->r.get()) / 100. ; double nCropRight = XmlUtils::GetInteger( oox_bitmap_fill->srcRect->r.get()) / 100. ;
//pOutput->m_oPicture->m_nCropR = nCropRight * pOutput->m_oPicture->m_nWidthGoal * pOutput->m_oPicture->m_nScaleX / 100; //pOutput->m_oPicture->m_nCropR = nCropRight * pOutput->m_oPicture->m_nWidthGoal * pOutput->m_oPicture->m_nScaleX / 100;
pOutput->m_oPicture->m_nCropR = (int)(nCropRight * pOutput->m_oPicture->m_nWidthGoal); pOutput->m_oPicture->m_nCropR = (int)(nCropRight * pOutput->m_oPicture->m_nWidthGoal);
pOutput->m_nCropFromRight = (int)(nCropRight * 65536); pOutput->m_nCropFromRight = (int)(nCropRight * 65536);
nCropedWidthGoal -= pOutput->m_oPicture->m_nCropR; nCropedWidthGoal -= pOutput->m_oPicture->m_nCropR;
} }
}
int nCropedHeightGoal = pOutput->m_oPicture->m_nHeightGoal; int nCropedHeightGoal = pOutput->m_oPicture->m_nHeightGoal;
if( PROP_DEF != nCropedHeightGoal ) if( PROP_DEF != nCropedHeightGoal )
{
if (oox_bitmap_fill->srcRect->t.IsInit())
{ {
double nCropTop = XmlUtils::GetInteger( oox_bitmap_fill->srcRect->t.get()) / 100. ; double nCropTop = XmlUtils::GetInteger( oox_bitmap_fill->srcRect->t.get()) / 100. ;
//pOutput->m_oPicture->m_nCropT = nCropTop * pOutput->m_oPicture->m_nHeightGoal * pOutput->m_oPicture->m_dScaleY / 100; //pOutput->m_oPicture->m_nCropT = nCropTop * pOutput->m_oPicture->m_nHeightGoal * pOutput->m_oPicture->m_dScaleY / 100;
pOutput->m_oPicture->m_nCropT = (int)(nCropTop * pOutput->m_oPicture->m_nHeightGoal); pOutput->m_oPicture->m_nCropT = (int)(nCropTop * pOutput->m_oPicture->m_nHeightGoal);
pOutput->m_nCropFromTop = (int)(nCropTop * 65536); pOutput->m_nCropFromTop = (int)(nCropTop * 65536);
nCropedHeightGoal -= pOutput->m_oPicture->m_nCropT; nCropedHeightGoal -= pOutput->m_oPicture->m_nCropT;
}
if (oox_bitmap_fill->srcRect->b.IsInit())
{
double nCropBottom = XmlUtils::GetInteger( oox_bitmap_fill->srcRect->b.get()) / 100. ; double nCropBottom = XmlUtils::GetInteger( oox_bitmap_fill->srcRect->b.get()) / 100. ;
//pOutput->m_oPicture->m_nCropT = nCropTop * pOutput->m_oPicture->m_nHeightGoal * pOutput->m_oPicture->m_dScaleY / 100; //pOutput->m_oPicture->m_nCropT = nCropTop * pOutput->m_oPicture->m_nHeightGoal * pOutput->m_oPicture->m_dScaleY / 100;
pOutput->m_oPicture->m_nCropB = (int)(nCropBottom * pOutput->m_oPicture->m_nHeightGoal); pOutput->m_oPicture->m_nCropB = (int)(nCropBottom * pOutput->m_oPicture->m_nHeightGoal);
pOutput->m_nCropFromBottom = (int)(nCropBottom * 65536); pOutput->m_nCropFromBottom = (int)(nCropBottom * 65536);
nCropedHeightGoal -= pOutput->m_oPicture->m_nCropB; nCropedHeightGoal -= pOutput->m_oPicture->m_nCropB;
} }
}
//устанавливаем scale //устанавливаем scale
if( PROP_DEF != pOutput->m_nLeft && PROP_DEF != pOutput->m_nRight && PROP_DEF != nCropedWidthGoal && 0 != nCropedWidthGoal ) if( PROP_DEF != pOutput->m_nLeft && PROP_DEF != pOutput->m_nRight && PROP_DEF != nCropedWidthGoal && 0 != nCropedWidthGoal )
{ {
...@@ -916,7 +928,7 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::L ...@@ -916,7 +928,7 @@ void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::L
} }
if (oox_line_prop->w.IsInit()) if (oox_line_prop->w.IsInit())
{ {
pOutput->m_nLineWidth = oox_line_prop->w.get() * 12700; pOutput->m_nLineWidth = oox_line_prop->w.get() / 12700;
} }
if (oox_line_prop->headEnd.IsInit()) if (oox_line_prop->headEnd.IsInit())
{ {
...@@ -1006,21 +1018,49 @@ void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX:: ...@@ -1006,21 +1018,49 @@ void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::
// //Parse(theme->m_oThemeElements.m_oFmtScheme.m_oEffectStyleLst.m_arrEffectStyle[fmt_index].m_oSp3D.GetPointer(), &color); // //Parse(theme->m_oThemeElements.m_oFmtScheme.m_oEffectStyleLst.m_arrEffectStyle[fmt_index].m_oSp3D.GetPointer(), &color);
//} //}
} }
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::Xfrm *xfrm)
bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
{ {
if (!m_vmlElement && !m_arrElement && !m_ooxShape) return false; if (!xfrm) return;
if (m_vmlElement || m_arrElement) return ParseVml(oParam , pOutput); double rot = xfrm->rot.IsInit() ? xfrm->rot.get() / 60000. : 0;
if (rot > 0.01)
pOutput->m_nRotation = rot * 65535;
if (xfrm->flipH.get_value_or(false)) pOutput->m_bFlipH = 1;
if (xfrm->flipV.get_value_or(false)) pOutput->m_bFlipV = 1;
if (pOutput->m_bInGroup)
{
if (xfrm->offX.IsInit() && xfrm->offY.IsInit())
{
pOutput->m_nRelLeft = (int)xfrm->offX.get();
pOutput->m_nRelTop = (int)xfrm->offY.get();
}
else
{
pOutput->m_nRelLeft = 0;
pOutput->m_nRelTop = 0;
}
if (xfrm->extX.IsInit() && xfrm->extY.IsInit())
{
pOutput->m_nRelRight = (int)pOutput->m_nRelLeft + xfrm->offX.get();
pOutput->m_nRelBottom = (int)pOutput->m_nRelTop + xfrm->offY.get();
}
else
{
pOutput->m_nRelRight = 0;
pOutput->m_nRelBottom = 0;
}
pOutput->m_nRelRotation = pOutput->m_nRotation;
}
}
bool OOXShapeReader::ParseShape( ReaderParameter oParam, RtfShapePtr& pOutput)
{
PPTX::Logic::Shape * ooxShape = dynamic_cast<PPTX::Logic::Shape*> (m_ooxShape); PPTX::Logic::Shape * ooxShape = dynamic_cast<PPTX::Logic::Shape*> (m_ooxShape);
//PPTX::Logic::CxnSp* cxnShape = dynamic_cast<PPTX::Logic::CxnSp*> (m_ooxShape);
//PPTX::Logic::Pic * ooxPic = dynamic_cast<PPTX::Logic::Pic*> (m_ooxShape);
if (ooxShape == NULL) return false; if (!ooxShape) return false;
if (ooxShape->oTextBoxBodyPr.IsInit()) if (ooxShape->oTextBoxBodyPr.IsInit())
{ {
...@@ -1051,7 +1091,9 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput) ...@@ -1051,7 +1091,9 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
if (ooxShape->spPr.Geometry.getType() == OOX::et_a_prstGeom) if (ooxShape->spPr.Geometry.getType() == OOX::et_a_prstGeom)
{ {
PPTX::Logic::PrstGeom& geometry = ooxShape->spPr.Geometry.as<PPTX::Logic::PrstGeom>(); PPTX::Logic::PrstGeom& geometry = ooxShape->spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::EShapeType type = (SimpleTypes::EShapeType)geometry.prst.GetBYTECode();
SimpleTypes::CShapeType<> prst_type(geometry.prst.get());
SimpleTypes::EShapeType type = prst_type.GetValue();
pOutput->m_nShapeType = OOX::PrstGeom2VmlShapeType(type); pOutput->m_nShapeType = OOX::PrstGeom2VmlShapeType(type);
if (pOutput->m_nShapeType == SimpleTypes::Vml::sptNotPrimitive) if (pOutput->m_nShapeType == SimpleTypes::Vml::sptNotPrimitive)
...@@ -1087,40 +1129,9 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput) ...@@ -1087,40 +1129,9 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
pOutput->m_nGeoRight = 100000; pOutput->m_nGeoRight = 100000;
pOutput->m_nGeoBottom = 100000; pOutput->m_nGeoBottom = 100000;
} }
if (ooxShape->spPr.xfrm.IsInit())
{
double rot = ooxShape->spPr.xfrm->rot.get() / 60000.;
if (rot > 0.01)
pOutput->m_nRotation = rot * 65535;
if (ooxShape->spPr.xfrm->flipH.get_value_or(false)) pOutput->m_bFlipH = 1; Parse(oParam, pOutput, ooxShape->spPr.xfrm.GetPointer());
if (ooxShape->spPr.xfrm->flipV.get_value_or(false)) pOutput->m_bFlipV = 1;
if (pOutput->m_bInGroup)
{
if (ooxShape->spPr.xfrm->offX.IsInit() && ooxShape->spPr.xfrm->offY.IsInit())
{
pOutput->m_nRelLeft = (int)ooxShape->spPr.xfrm->offX.get();
pOutput->m_nRelTop = (int)ooxShape->spPr.xfrm->offY.get();
}
else
{
pOutput->m_nRelLeft = 0;
pOutput->m_nRelTop = 0;
}
if (ooxShape->spPr.xfrm->extX.IsInit() && ooxShape->spPr.xfrm->extY.IsInit())
{
pOutput->m_nRelRight = (int)pOutput->m_nRelLeft + ooxShape->spPr.xfrm->offX.get();
pOutput->m_nRelBottom = (int)pOutput->m_nRelTop + ooxShape->spPr.xfrm->offY.get();
}
else
{
pOutput->m_nRelRight = 0;
pOutput->m_nRelBottom = 0;
}
pOutput->m_nRelRotation = pOutput->m_nRotation;
}
}
PPTX::Logic::ShapeStyle* oox_sp_style = ooxShape->style.GetPointer(); PPTX::Logic::ShapeStyle* oox_sp_style = ooxShape->style.GetPointer();
bool use_fill_from_style = false; bool use_fill_from_style = false;
...@@ -1133,7 +1144,7 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput) ...@@ -1133,7 +1144,7 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
case PPTX::Logic::UniFill::pattFill: case PPTX::Logic::UniFill::pattFill:
case PPTX::Logic::UniFill::solidFill: case PPTX::Logic::UniFill::solidFill:
Parse(oParam, pOutput, &ooxShape->spPr.Fill); Parse(oParam, pOutput, &ooxShape->spPr.Fill);
break;
case PPTX::Logic::UniFill::noFill: case PPTX::Logic::UniFill::noFill:
pOutput->m_bFilled = false; break; pOutput->m_bFilled = false; break;
default: default:
...@@ -1187,6 +1198,55 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput) ...@@ -1187,6 +1198,55 @@ bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
return true; return true;
} }
bool OOXShapeReader::ParsePic( ReaderParameter oParam, RtfShapePtr& pOutput)
{
PPTX::Logic::Pic * ooxPic = dynamic_cast<PPTX::Logic::Pic*>(m_ooxShape);
if (!ooxPic) return false;
std::wstring strXml;
pOutput->m_nShapeType = SimpleTypes::Vml::sptPictureFrame;
Parse(oParam, pOutput, ooxPic->spPr.xfrm.GetPointer());
PPTX::Logic::ShapeStyle* oox_sp_style = ooxPic->style.GetPointer();
pOutput->m_bFilled = true;
Parse(oParam, pOutput, &ooxPic->blipFill);
if ((oox_sp_style) && (oox_sp_style->lnRef.idx.IsInit()))
{
Parse(oParam, pOutput, &oox_sp_style->lnRef, 2);
}
if (ooxPic->spPr.ln.IsInit())
{
Parse(oParam, pOutput, ooxPic->spPr.ln.GetPointer());
}
return true;
}
bool OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput)
{
if (!m_vmlElement && !m_arrElement && !m_ooxShape) return false;
if (OOX::CHdrFtr *pHdrFtr = dynamic_cast<OOX::CHdrFtr *>(oParam.oReader->m_currentContainer))
pOutput->m_nHeader = 1;//shape in header/footer
else
pOutput->m_nHeader = 0;
if (m_vmlElement || m_arrElement) return ParseVml(oParam , pOutput);
PPTX::Logic::Shape * ooxShape = dynamic_cast<PPTX::Logic::Shape*> (m_ooxShape);
// PPTX::Logic::CxnSp * cxnShape = dynamic_cast<PPTX::Logic::CxnSp*> (m_ooxShape);
PPTX::Logic::Pic * ooxPic = dynamic_cast<PPTX::Logic::Pic*> (m_ooxShape);
if (ooxShape) return ParseShape(oParam, pOutput);
if (ooxPic) return ParsePic(oParam, pOutput);
//if (cxnShape) return ParseConnector(oParam, pOutput);
return false;
}
void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::UniFill *oox_fill, std::wstring *change_sheme_color) void OOXShapeReader::Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::UniFill *oox_fill, std::wstring *change_sheme_color)
{ {
if (!oox_fill) return; if (!oox_fill) return;
...@@ -1401,12 +1461,6 @@ bool OOXShapeReader::ParseVml( ReaderParameter oParam , RtfShapePtr& pOutput) ...@@ -1401,12 +1461,6 @@ bool OOXShapeReader::ParseVml( ReaderParameter oParam , RtfShapePtr& pOutput)
} }
//--------------------- //---------------------
if (OOX::CHdrFtr *pHdrFtr = dynamic_cast<OOX::CHdrFtr *>(oParam.oReader->m_currentContainer))
{
pOutput->m_nHeader = 1;//shape in header/footer
}
return ParseVmlChild(oParam, pOutput); return ParseVmlChild(oParam, pOutput);
} }
bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput) bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
...@@ -1499,11 +1553,6 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput) ...@@ -1499,11 +1553,6 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapePtr& pOutput)
} }
if (m_ooxGroup) if (m_ooxGroup)
{ {
//if( m_ooxGroup->m_sId.IsInit())
//{
// pOutput->m_nID = oParam.oReader->m_oOOXIdGenerator.GetId( m_ooxGroup->m_oId.get());
//}
pOutput->m_nZOrderRelative = 0; pOutput->m_nZOrderRelative = 0;
pOutput->m_nWrapType = 3; //def pOutput->m_nWrapType = 3; //def
......
...@@ -67,6 +67,12 @@ public: ...@@ -67,6 +67,12 @@ public:
static bool Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::BlipFill *oox_bitmap_fill); static bool Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::BlipFill *oox_bitmap_fill);
private: private:
bool ParseShape( ReaderParameter oParam , RtfShapePtr& oOutput);
bool ParsePic( ReaderParameter oParam , RtfShapePtr& oOutput);
void Parse(ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::Logic::Xfrm *xfrm);
void Parse(ReaderParameter oParam, PPTX::Logic::ColorBase *oox_color, unsigned int & nColor, _CP_OPT(double) &opacity); void Parse(ReaderParameter oParam, PPTX::Logic::ColorBase *oox_color, unsigned int & nColor, _CP_OPT(double) &opacity);
void Parse(ReaderParameter oParam, PPTX::Logic::SolidFill *oox_solid_fill, unsigned int & nColor, _CP_OPT(double) &opacity); void Parse(ReaderParameter oParam, PPTX::Logic::SolidFill *oox_solid_fill, unsigned int & nColor, _CP_OPT(double) &opacity);
......
...@@ -256,8 +256,6 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter) ...@@ -256,8 +256,6 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
sResult += L"{\\shp"; sResult += L"{\\shp";
sResult += L"{\\*\\shpinst"; sResult += L"{\\*\\shpinst";
RENDER_RTF_INT( m_nID , sResult, L"shplid" );
if (!m_bInGroup) if (!m_bInGroup)
{ {
m_bAllowOverlap = 1; m_bAllowOverlap = 1;
...@@ -265,8 +263,8 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter) ...@@ -265,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 = PROP_DEF; m_nZOrder = 0;//PROP_DEF;
m_nZOrderRelative = PROP_DEF; m_nZOrderRelative = 0;//PROP_DEF;
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;
...@@ -278,26 +276,29 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter) ...@@ -278,26 +276,29 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT ( m_nHeader , sResult, L"shpfhdr" ); RENDER_RTF_INT ( m_nHeader , sResult, L"shpfhdr" );
//sResult += L"\\shpbxcolumn"; sResult += L"\\shpbxcolumn";
sResult += L"\\shpbxignore"; sResult += L"\\shpbxignore";
//sResult += L"\\shpbypara"; sResult += L"\\shpbypara";
sResult += L"\\shpbyignore"; sResult += L"\\shpbyignore";
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" );
//sResult += L"\\shpfblwtxt0";
sResult += L"\\shplockanchor";
RENDER_RTF_INT ( m_nZOrder , sResult, L"shpz" ); //if (st_none == m_eAnchorTypeShape)
{
RENDER_RTF_INT ( m_nZOrder, sResult, L"shpz" );
}
sResult += L"\\shplockanchor";
sResult += L"{\\sp{\\sn fUseShapeAnchor}{\\sv 0}}"; //sResult += L"{\\sp{\\sn fUseShapeAnchor}{\\sv 0}}";
sResult += L"{\\sp{\\sn fPseudoInline}{\\sv 1}}"; //sResult += L"{\\sp{\\sn fPseudoInline}{\\sv 1}}";
RENDER_RTF_INT( m_nID, sResult, L"shplid" );
} }
sResult += RenderToRtfShapeProperty( oRenderParameter ); sResult += RenderToRtfShapeProperty( oRenderParameter );
sResult += L"{\\sp{\\sn fLockPosition}{\\sv 1}}"; //sResult += L"{\\sp{\\sn fLockPosition}{\\sv 1}}";
sResult += L"{\\sp{\\sn fLockRotation}{\\sv 1}}"; //sResult += L"{\\sp{\\sn fLockRotation}{\\sv 1}}";
//picture //picture
if( 0 != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 3 || m_nFillType == 9) if( 0 != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 3 || m_nFillType == 9)
...@@ -421,11 +422,14 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter ...@@ -421,11 +422,14 @@ 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"posh", sResult, m_nPositionH);
RENDER_RTF_SHAPE_PROP(L"posrelh", sResult, m_nPositionHRelative); RENDER_RTF_SHAPE_PROP(L"posrelh", sResult, m_nPositionHRelative);
RENDER_RTF_SHAPE_PROP(L"posv", sResult, m_nPositionV); RENDER_RTF_SHAPE_PROP(L"posv", sResult, m_nPositionV);
RENDER_RTF_SHAPE_PROP(L"posrelv", sResult, m_nPositionVRelative); 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);
...@@ -438,6 +442,17 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter ...@@ -438,6 +442,17 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
RENDER_RTF_SHAPE_PROP(L"sizerelv", sResult, m_nPctHeightRelative); RENDER_RTF_SHAPE_PROP(L"sizerelv", sResult, m_nPctHeightRelative);
RENDER_RTF_SHAPE_PROP(L"colStart", sResult, m_nColStart); RENDER_RTF_SHAPE_PROP(L"colStart", sResult, m_nColStart);
RENDER_RTF_SHAPE_PROP(L"colSpan", sResult, m_nColSpan); RENDER_RTF_SHAPE_PROP(L"colSpan", sResult, m_nColSpan);
if (m_sName.empty() == false)
{
sResult += L"{\\sp{\\sn wzName}{\\sv ";
sResult += m_sName + L"}}";
}
if (m_sDescription.empty() == false)
{
sResult += L"{\\sp{\\sn wzDescription}{\\sv ";
sResult += m_sDescription + L"}}";
}
//Rehydration //Rehydration
//RENDER_RTF_SHAPE_PROP(L"metroBlob", sResult, m_sMetroBlob); //RENDER_RTF_SHAPE_PROP(L"metroBlob", sResult, m_sMetroBlob);
...@@ -449,7 +464,7 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter ...@@ -449,7 +464,7 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
RENDER_RTF_SHAPE_PROP(L"shapeType", sResult, m_nShapeType); RENDER_RTF_SHAPE_PROP(L"shapeType", sResult, m_nShapeType);
RENDER_RTF_SHAPE_PROP(L"fBehindDocument",sResult, m_nZOrderRelative); RENDER_RTF_SHAPE_PROP(L"fBehindDocument",sResult, m_nZOrderRelative);
RENDER_RTF_SHAPE_PROP(L"fHidden", sResult, m_bHidden); RENDER_RTF_SHAPE_PROP(L"fHidden", sResult, m_bHidden);
RENDER_RTF_SHAPE_PROP(L"fBackground", sResult, m_bBackground); //RENDER_RTF_SHAPE_PROP(L"fBackground", sResult, m_bBackground);
//Text //Text
//sResult += L"{\\sp{\\sn fLockText}{\\sv 0}}"; //sResult += L"{\\sp{\\sn fLockText}{\\sv 0}}";
...@@ -586,7 +601,7 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter ...@@ -586,7 +601,7 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
int nCodePage = -1; int nCodePage = -1;
if( !m_sGtextFont.empty() ) if( m_sGtextFont.empty() == false)
{ {
sResult += L"{\\sp{\\sn gtextFont}{\\sv "; sResult += L"{\\sp{\\sn gtextFont}{\\sv ";
sResult += m_sGtextFont + L"}}"; sResult += m_sGtextFont + L"}}";
...@@ -1487,8 +1502,8 @@ std::wstring RtfShape::GroupRenderToRtf(RenderParameter oRenderParameter) ...@@ -1487,8 +1502,8 @@ std::wstring RtfShape::GroupRenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT( m_nWrapSideType , sResult, L"shpwrk" ); RENDER_RTF_INT( m_nWrapSideType , sResult, L"shpwrk" );
RENDER_RTF_BOOL( m_bLockAnchor , sResult, L"shplockanchor" ); RENDER_RTF_BOOL( m_bLockAnchor , sResult, L"shplockanchor" );
//sResult += L"{\\sp{\\sn fUseShapeAnchor}{\\sv 0}}"; sResult += L"{\\sp{\\sn fUseShapeAnchor}{\\sv 0}}";
//sResult += L"{\\sp{\\sn fPseudoInline}{\\sv 1}}"; sResult += L"{\\sp{\\sn fPseudoInline}{\\sv 1}}";
} }
......
<?xml version="1.0" encoding="windows-1251"?> <?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="8,00"
Name="RtfFormatTest" Name="RtfFormatTest"
ProjectGUID="{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}" ProjectGUID="{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
RootNamespace="RtfFormatTest" RootNamespace="RtfFormatTest"
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\Common\OfficeDrawing;&quot;..\..\DesktopEditor\freetype-2.5.2\include&quot;;..\..\..\..\..\Common\OfficeDrawing\Shapes" AdditionalIncludeDirectories="../../DesktopEditor/xml/libxml2/include;../../DesktopEditor/xml/build/vs2005"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="false" MinimalRebuild="false"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
......
...@@ -2106,21 +2106,6 @@ namespace BinXlsxRW { ...@@ -2106,21 +2106,6 @@ namespace BinXlsxRW {
res = c_oSerConstants::ReadUnknown; res = c_oSerConstants::ReadUnknown;
return res; return res;
} }
int ReadVbaProject(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
smart_ptr<OOX::VbaProject> oFileVbaProject(new OOX::VbaProject());
oFileVbaProject->fromPPTY(&m_oBufferedStream);
smart_ptr<OOX::File> oFile = oFileVbaProject.smart_dynamic_cast<OOX::File>();
const OOX::RId oRId = m_oWorkbook.Add(oFile);
m_oWorkbook.m_bMacroEnabled = true;
return res;
}
}; };
class BinaryCommentReader : public Binary_CommonReader<BinaryCommentReader> class BinaryCommentReader : public Binary_CommonReader<BinaryCommentReader>
{ {
......
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