Commit e78fc0be authored by ElenaSubbotina's avatar ElenaSubbotina

x2t - fix users files

parent d9986d09
......@@ -1681,7 +1681,10 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
if (!elem) return;
std::wstring strNameNode = oNodeShape.GetName();
bool bIsNeedCoordSizes = true;
bool bTextBox = false;
bool bPicture = false;
std::wstring strStyleAdvenced = L"";
......@@ -1911,9 +1914,38 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
oShapeElem.m_pShape->getBaseShape()->m_oPath.SetCoordsize(21600, 21600);
}
if (pPPTShape->m_eType == PPTShapes::sptCTextBox)
{
bTextBox = true;
}
else if (pPPTShape->m_eType == PPTShapes::sptCFrame)
{
bPicture= true;
}
std::wstring strXmlPPTX;
PPTX::Logic::Shape* pShape = new PPTX::Logic::Shape();
PPTX::Logic::Shape* pShape = NULL; //todoooo + CxnSp
PPTX::Logic::Pic* pPicture = NULL;
PPTX::Logic::SpPr* pSpPr = NULL;
PPTX::Logic::CNvPr* pCNvPr = NULL;
if (bPicture)
{
pPicture = new PPTX::Logic::Pic();
elem->InitElem(pPicture);
pSpPr = &pPicture->spPr;
pCNvPr = &pPicture->nvPicPr.cNvPr;
strXmlPPTX = oShapeElem.ConvertPPTShapeToPPTX(true);
}
else
{
pShape = new PPTX::Logic::Shape();
elem->InitElem(pShape);
pSpPr = &pShape->spPr;
pCNvPr = &pShape->nvSpPr.cNvPr;
if (!pShape->oTextBoxBodyPr.IsInit())
pShape->oTextBoxBodyPr = new PPTX::Logic::BodyPr();
......@@ -2508,10 +2540,6 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
strXmlPPTX = oShapeElem.ConvertPPTShapeToPPTX(true);
}
XmlUtils::CXmlNode oNodeG;
oNodeG.FromXmlString(strXmlPPTX);
pShape->spPr.Geometry = oNodeG;
XmlUtils::CXmlNode oNodeTextBox;
std::wstring sTextboxStyle;
......@@ -2646,10 +2674,18 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
}
}
}
if (bTextBox)
{
pShape->nvSpPr.cNvSpPr.txBox = true;
}
}
//-------------------------------------------------------------------------------------------------------------------
XmlUtils::CXmlNode oNodeG;
oNodeG.FromXmlString(strXmlPPTX);
pSpPr->Geometry = oNodeG;
std::wstring strStyle = oNodeShape.GetAttribute(L"style");
if (L"" != strStyleAdvenced)
strStyle += strStyleAdvenced;
std::wstring strStyle = oNodeShape.GetAttribute(L"style") + strStyleAdvenced;
PPTX::CCSS oCSSParser;
oCSSParser.LoadFromString2(strStyle);
......@@ -2657,9 +2693,8 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
CSpTreeElemProps oProps;
oProps.IsTop = bIsTop;
std::wstring strMainPos = GetDrawingMainProps(oNodeShape, oCSSParser, oProps);
/////////////////////////////////////////text options
if (oCSSParser.m_mapSettings.size() > 0)
//-------------------------------------------------------------------------------------------------------------------
if (pShape && oCSSParser.m_mapSettings.size() > 0)
{
std::map<std::wstring, std::wstring>::iterator pPair = oCSSParser.m_mapSettings.find(L"v-text-anchor");
......@@ -2694,16 +2729,16 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
if (m_oxfrm_override.IsInit())
{
pShape->spPr.xfrm = m_oxfrm_override;
pSpPr->xfrm = m_oxfrm_override;
}
else
{
//oProps.X выставлять не надо, они учтены в pMainProps
pShape->spPr.xfrm = new PPTX::Logic::Xfrm();
pShape->spPr.xfrm->offX = 0;
pShape->spPr.xfrm->offY = 0;
pShape->spPr.xfrm->extX = oProps.Width;
pShape->spPr.xfrm->extY = oProps.Height;
pSpPr->xfrm = new PPTX::Logic::Xfrm();
pSpPr->xfrm->offX = 0;
pSpPr->xfrm->offY = 0;
pSpPr->xfrm->extX = oProps.Width;
pSpPr->xfrm->extY = oProps.Height;
}
std::map<std::wstring, std::wstring>::iterator pPair;
......@@ -2712,20 +2747,20 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
if (oCSSParser.m_mapSettings.end() != pPair)
{
if (pPair->second == L"x")
pShape->spPr.xfrm->flipH = true;
pSpPr->xfrm->flipH = true;
else if (pPair->second == L"y")
pShape->spPr.xfrm->flipV = true;
pSpPr->xfrm->flipV = true;
else if ((pPair->second == L"xy") || (pPair->second == L"yx") || (pPair->second == L"x y") || (pPair->second == L"y x"))
{
pShape->spPr.xfrm->flipH = true;
pShape->spPr.xfrm->flipV = true;
pSpPr->xfrm->flipH = true;
pSpPr->xfrm->flipV = true;
}
}
pPair = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pPair)
{
pShape->spPr.xfrm->rot = NS_DWC_Common::getRotateAngle(pPair->second, pShape->spPr.xfrm->flipH, pShape->spPr.xfrm->flipV);
pSpPr->xfrm->rot = NS_DWC_Common::getRotateAngle(pPair->second, pSpPr->xfrm->flipH, pSpPr->xfrm->flipV);
}
}
else
......@@ -2736,11 +2771,11 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
m_pBinaryWriter->m_lCxCurShape = 0;
m_pBinaryWriter->m_lCyCurShape = 0;
pShape->spPr.xfrm = new PPTX::Logic::Xfrm();
pShape->spPr.xfrm->offX = oProps.X;
pShape->spPr.xfrm->offY = oProps.Y;
pShape->spPr.xfrm->extX = oProps.Width;
pShape->spPr.xfrm->extY = oProps.Height;
pSpPr->xfrm = new PPTX::Logic::Xfrm();
pSpPr->xfrm->offX = oProps.X;
pSpPr->xfrm->offY = oProps.Y;
pSpPr->xfrm->extX = oProps.Width;
pSpPr->xfrm->extY = oProps.Height;
std::map<std::wstring, std::wstring>::iterator pPair;
......@@ -2748,40 +2783,42 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
if (oCSSParser.m_mapSettings.end() != pPair)
{
if (pPair->second == L"x")
pShape->spPr.xfrm->flipH = true;
pSpPr->xfrm->flipH = true;
else if (pPair->second == L"y")
pShape->spPr.xfrm->flipV = true;
pSpPr->xfrm->flipV = true;
else if ((pPair->second == L"xy") || (pPair->second == L"yx") || (pPair->second == L"x y") || (pPair->second == L"y x"))
{
pShape->spPr.xfrm->flipH = true;
pShape->spPr.xfrm->flipV = true;
pSpPr->xfrm->flipH = true;
pSpPr->xfrm->flipV = true;
}
}
pPair = oCSSParser.m_mapSettings.find(L"rotation");
if (oCSSParser.m_mapSettings.end() != pPair)
{
pShape->spPr.xfrm->rot = NS_DWC_Common::getRotateAngle(pPair->second, pShape->spPr.xfrm->flipH, pShape->spPr.xfrm->flipV);
pSpPr->xfrm->rot = NS_DWC_Common::getRotateAngle(pPair->second, pSpPr->xfrm->flipH, pSpPr->xfrm->flipV);
}
}
if (!bIsTop)
{
pShape->nvSpPr.cNvPr.id = m_lNextId;
pCNvPr->id = m_lNextId;
m_lNextId++;
}
else
{
pShape->nvSpPr.cNvPr.id = -1;
pCNvPr->id = -1;
}
pShape->signatureLine = pPPTShape->m_oSignatureLine;
elem->InitElem(pShape);
if (pShape)
{
pShape->signatureLine = pPPTShape->m_oSignatureLine;
}
if (!pPPTShape->IsWordArt())
CheckPenShape(elem, oNodeShape, pPPTShape->m_eType, pPPTShape);
CheckPenShape(elem, oNodeShape, pPPTShape);
CheckBrushShape(elem, oNodeShape, pPPTShape->m_eType, pPPTShape);
CheckBrushShape(elem, oNodeShape, pPPTShape);
}
}
......@@ -2904,7 +2941,8 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
pTree->grpSpPr.xfrm->chOffX = lCoordOriginX;
pTree->grpSpPr.xfrm->chOffY = lCoordOriginY;
pTree->grpSpPr.xfrm->chExtX = lCoordSizeW;
pTree->grpSpPr.xfrm->chExtY = lCoordSizeH; }
pTree->grpSpPr.xfrm->chExtY = lCoordSizeH;
}
else
{
pTree->grpSpPr.xfrm = new PPTX::Logic::Xfrm();
......@@ -3484,8 +3522,16 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
{
oWriter.WriteString(L"<wp:wrapNone/>");
}
bool bHidden = false;
pPair = oCssStyles.m_mapSettings.find(L"visibility");
if (oCssStyles.m_mapSettings.end() != pPair)
{
if (L"hidden" == pPair->second)
bHidden = true;
}
std::wstring strId = L"<wp:docPr id=\"" + std::to_wstring(m_lNextId) + L"\" name=\"\"/>";
std::wstring strId = L"<wp:docPr id=\"" + std::to_wstring(m_lNextId) + L"\" name=\"\"" + (bHidden ? L" hidden=\"true\"" : L"") + L"/>";
m_lNextId++;
oWriter.WriteString(strId);
......@@ -3728,11 +3774,19 @@ void CDrawingConverter::SendMainProps(const std::wstring& strMainProps, std::wst
**pMainProps = strMainProps;
}
void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape)
void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape)
{
if (!oElem)return;
if (!oElem) return;
PPTX::Logic::Shape* pShape = dynamic_cast<PPTX::Logic::Shape*> (oElem->GetElem().operator ->());
PPTX::Logic::Pic* pPicture = dynamic_cast<PPTX::Logic::Pic*> (oElem->GetElem().operator ->());
PPTX::Logic::SpPr *pSpPr = NULL;
PPTX::Logic::Shape* pShape = (PPTX::Logic::Shape*)dynamic_cast<PPTX::Logic::Shape*>(oElem->GetElem().operator ->());
if (pShape) pSpPr = &pShape->spPr;
if (pPicture) pSpPr = &pPicture->spPr;
if (!pSpPr) return;
int R = 255;
int G = 255;
......@@ -3749,8 +3803,8 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(color.R, color.G, color.B);
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::solidFill;
pShape->spPr.Fill.Fill = pSolid;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->Fill.Fill = pSolid;
}
else if (!pPPTShape->IsWordArt())
{
......@@ -3760,8 +3814,8 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(R, G, B);
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::solidFill;
pShape->spPr.Fill.Fill = pSolid;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->Fill.Fill = pSolid;
}
nullable_string sFilled;
......@@ -3773,8 +3827,8 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
PPTX::Logic::NoFill* pNoFill = new PPTX::Logic::NoFill();
pNoFill->m_namespace = L"a";
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::noFill;
pShape->spPr.Fill.Fill = pNoFill;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::noFill;
pSpPr->Fill.Fill = pNoFill;
}
}
else if (!pPPTShape->m_bIsFilled)
......@@ -3782,8 +3836,8 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
PPTX::Logic::NoFill* pNoFill = new PPTX::Logic::NoFill();
pNoFill->m_namespace = L"a";
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::noFill;
pShape->spPr.Fill.Fill = pNoFill;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::noFill;
pSpPr->Fill.Fill = pNoFill;
}
nullable_string sOpacity;
......@@ -3792,13 +3846,13 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
{
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
if (pShape->spPr.Fill.is<PPTX::Logic::SolidFill>())
if (pSpPr->Fill.is<PPTX::Logic::SolidFill>())
{
PPTX::Logic::ColorModifier oMod;
oMod.name = L"alpha";
int nA = (int)(lAlpha * 100000.0 / 255.0);
oMod.val = nA;
pShape->spPr.Fill.as<PPTX::Logic::SolidFill>().Color.Color->Modifiers.push_back(oMod);
pSpPr->Fill.as<PPTX::Logic::SolidFill>().Color.Color->Modifiers.push_back(oMod);
}
}
......@@ -3822,8 +3876,8 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(color.R, color.G, color.B);
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::solidFill;
pShape->spPr.Fill.Fill = pSolid;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->Fill.Fill = pSolid;
if (!sFillColor.is_init())
sFillColor = sColor;
......@@ -3844,8 +3898,8 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
pBlipFill->tile = new PPTX::Logic::Tile();
}
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::blipFill;
pShape->spPr.Fill.Fill = pBlipFill;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
pSpPr->Fill.Fill = pBlipFill;
}
nullable_string sRotate;
oNodeFill.ReadAttributeBase(L"rotate", sRotate);
......@@ -3926,23 +3980,23 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
if (*sRotate == L"r") pGradFill->lin->ang = 180 * 60000;
}
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::gradFill;
pShape->spPr.Fill.Fill = pGradFill;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::gradFill;
pSpPr->Fill.Fill = pGradFill;
}
if (sOpacity.is_init())
{
BYTE lAlpha = NS_DWC_Common::getOpacityFromString(*sOpacity);
if (pShape->spPr.Fill.is<PPTX::Logic::SolidFill>())
if (pSpPr->Fill.is<PPTX::Logic::SolidFill>())
{
PPTX::Logic::ColorModifier oMod;
oMod.name = L"alpha";
int nA = (int)(lAlpha * 100000.0 / 255.0);
oMod.val = nA;
pShape->spPr.Fill.as<PPTX::Logic::SolidFill>().Color.Color->Modifiers.push_back(oMod);
pSpPr->Fill.as<PPTX::Logic::SolidFill>().Color.Color->Modifiers.push_back(oMod);
}
else if (pShape->spPr.Fill.is<PPTX::Logic::BlipFill>())
else if (pSpPr->Fill.is<PPTX::Logic::BlipFill>())
{
PPTX::Logic::AlphaModFix* pAlphaMod = new PPTX::Logic::AlphaModFix();
int nA = (int)(lAlpha * 100000.0 / 255.0);
......@@ -3951,7 +4005,7 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
PPTX::Logic::UniEffect oEff;
oEff.InitPointer(pAlphaMod);
pShape->spPr.Fill.as<PPTX::Logic::BlipFill>().blip->Effects.push_back(oEff);
pSpPr->Fill.as<PPTX::Logic::BlipFill>().blip->Effects.push_back(oEff);
}
}
}
......@@ -3989,9 +4043,6 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
}
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::blipFill;
pShape->spPr.Fill.Fill = pBlipFill;
std::wstring strCropT = oNodeFillID.GetAttribute(L"croptop");
std::wstring strCropL = oNodeFillID.GetAttribute(L"cropleft");
std::wstring strCropR = oNodeFillID.GetAttribute(L"cropright");
......@@ -4027,20 +4078,32 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
else
pBlipFill->srcRect->b = str0;
}
if (pShape)
{
pSpPr->Fill.m_type = PPTX::Logic::UniFill::blipFill;
pSpPr->Fill.Fill = pBlipFill;
}
if (pPicture)
{
pSpPr->Fill.m_type = PPTX::Logic::UniFill::notInit;
pPicture->blipFill = *pBlipFill;
}
}
}
}
// default params
if (!pShape->spPr.Fill.Fill.is_init())
if (!pSpPr->Fill.Fill.is_init())
{
if (pPPTShape->IsWordArt())
{
PPTX::Logic::NoFill* pNoFill = new PPTX::Logic::NoFill();
pNoFill->m_namespace = L"a";
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::noFill;
pShape->spPr.Fill.Fill = pNoFill;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::noFill;
pSpPr->Fill.Fill = pNoFill;
}
else
{
......@@ -4049,8 +4112,8 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(0xFF, 0xFF, 0xFF);
pShape->spPr.Fill.m_type = PPTX::Logic::UniFill::solidFill;
pShape->spPr.Fill.Fill = pSolid;
pSpPr->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->Fill.Fill = pSolid;
if (sOpacity.is_init())
{
......@@ -4064,11 +4127,19 @@ void CDrawingConverter::CheckBrushShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils
}
}
}
void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape)
void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape)
{
if (!oElem)return;
PPTX::Logic::Shape* pShape = (PPTX::Logic::Shape*)dynamic_cast<PPTX::Logic::Shape*>(oElem->GetElem().operator ->());
PPTX::Logic::Shape* pShape = dynamic_cast<PPTX::Logic::Shape*> (oElem->GetElem().operator ->());
PPTX::Logic::Pic* pPicture = dynamic_cast<PPTX::Logic::Pic*> (oElem->GetElem().operator ->());
PPTX::Logic::SpPr *pSpPr = NULL;
if (pShape) pSpPr = &pShape->spPr;
if (pPicture) pSpPr = &pPicture->spPr;
if (!pSpPr) return;
// attributes
nullable_string sStrokeColor;
......@@ -4077,24 +4148,24 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
{
NSPresentationEditor::CColor color = NS_DWC_Common::getColorFromString(*sStrokeColor);
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
pSolid->m_namespace = L"a";
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(color.R, color.G, color.B);
pShape->spPr.ln->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pShape->spPr.ln->Fill.Fill = pSolid;
pSpPr->ln->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->ln->Fill.Fill = pSolid;
}
nullable_string sStrokeWeight;
oNode.ReadAttributeBase(L"strokeweight", sStrokeWeight);
if (sStrokeWeight.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
if (sStrokeWeight->length() > 0 && sStrokeWeight->at(0) == wchar_t('.'))
{
......@@ -4104,7 +4175,7 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
SimpleTypes::CPoint oPoint;
int size = (int)(g_emu_koef * oPoint.FromString(*sStrokeWeight));
pShape->spPr.ln->w = size;
pSpPr->ln->w = size;
pPPTShape->m_bIsStroked = true;
}
......@@ -4114,20 +4185,20 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
{
if (*sStroked == L"false" || *sStroked == L"f")
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
pShape->spPr.ln->Fill.m_type = PPTX::Logic::UniFill::noFill;
pShape->spPr.ln->Fill.Fill = new PPTX::Logic::NoFill();
pSpPr->ln->Fill.m_type = PPTX::Logic::UniFill::noFill;
pSpPr->ln->Fill.Fill = new PPTX::Logic::NoFill();
}
}
else if (!pPPTShape->m_bIsStroked)
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
pShape->spPr.ln->Fill.m_type = PPTX::Logic::UniFill::noFill;
pShape->spPr.ln->Fill.Fill = new PPTX::Logic::NoFill();
pSpPr->ln->Fill.m_type = PPTX::Logic::UniFill::noFill;
pSpPr->ln->Fill.Fill = new PPTX::Logic::NoFill();
}
XmlUtils::CXmlNode oNodeStroke = oNode.ReadNode(L"v:stroke");
......@@ -4139,229 +4210,181 @@ void CDrawingConverter::CheckPenShape(PPTX::Logic::SpTreeElem* oElem, XmlUtils::
{
NSPresentationEditor::CColor color = NS_DWC_Common::getColorFromString(*sStrokeColor);
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
pSolid->m_namespace = L"a";
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(color.R, color.G, color.B);
pShape->spPr.ln->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pShape->spPr.ln->Fill.Fill = pSolid;
pSpPr->ln->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->ln->Fill.Fill = pSolid;
}
nullable_string sStrokeDashStyle;
oNodeStroke.ReadAttributeBase(L"dashstyle", sStrokeDashStyle);
if (sStrokeDashStyle.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
pShape->spPr.ln->prstDash = new PPTX::Logic::PrstDash();
if (*sStrokeDashStyle == L"solid")
pShape->spPr.ln->prstDash->val = L"solid";
else if (*sStrokeDashStyle == L"shortdash")
pShape->spPr.ln->prstDash->val = L"sysDash";
else if (*sStrokeDashStyle == L"shortdot")
pShape->spPr.ln->prstDash->val = L"sysDot";
else if (*sStrokeDashStyle == L"shortdashdot")
pShape->spPr.ln->prstDash->val = L"sysDashDot";
else if (*sStrokeDashStyle == L"shortdashdotdot")
pShape->spPr.ln->prstDash->val = L"sysDashDotDot";
else if (*sStrokeDashStyle == L"dot")
pShape->spPr.ln->prstDash->val = L"dot";
else if (*sStrokeDashStyle == L"dash")
pShape->spPr.ln->prstDash->val = L"dash";
else if (*sStrokeDashStyle == L"longdash")
pShape->spPr.ln->prstDash->val = L"lgDash";
else if (*sStrokeDashStyle == L"dashdot")
pShape->spPr.ln->prstDash->val = L"dashDot";
else if (*sStrokeDashStyle == L"longdashdot")
pShape->spPr.ln->prstDash->val = L"lgDashDot";
else if (*sStrokeDashStyle == L"longdashdotdot")
pShape->spPr.ln->prstDash->val = L"lgDashDotDot";
else
pShape->spPr.ln->prstDash->val = L"solid";
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
pSpPr->ln->prstDash = new PPTX::Logic::PrstDash();
if (*sStrokeDashStyle == L"solid") pSpPr->ln->prstDash->val = L"solid";
else if (*sStrokeDashStyle == L"shortdash") pSpPr->ln->prstDash->val = L"sysDash";
else if (*sStrokeDashStyle == L"shortdot") pSpPr->ln->prstDash->val = L"sysDot";
else if (*sStrokeDashStyle == L"shortdashdot") pSpPr->ln->prstDash->val = L"sysDashDot";
else if (*sStrokeDashStyle == L"shortdashdotdot")pSpPr->ln->prstDash->val = L"sysDashDotDot";
else if (*sStrokeDashStyle == L"dot") pSpPr->ln->prstDash->val = L"dot";
else if (*sStrokeDashStyle == L"dash") pSpPr->ln->prstDash->val = L"dash";
else if (*sStrokeDashStyle == L"longdash") pSpPr->ln->prstDash->val = L"lgDash";
else if (*sStrokeDashStyle == L"dashdot") pSpPr->ln->prstDash->val = L"dashDot";
else if (*sStrokeDashStyle == L"longdashdot") pSpPr->ln->prstDash->val = L"lgDashDot";
else if (*sStrokeDashStyle == L"longdashdotdot")pSpPr->ln->prstDash->val = L"lgDashDotDot";
else pSpPr->ln->prstDash->val = L"solid";
}
nullable_string sEndArraw;
oNodeStroke.ReadAttributeBase(L"endarrow", sEndArraw);
if (sEndArraw.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
pShape->spPr.ln->tailEnd = new PPTX::Logic::LineEnd();
if (*sEndArraw == L"none")
pShape->spPr.ln->tailEnd->type = L"none";
else if (*sEndArraw == L"block")
pShape->spPr.ln->tailEnd->type = L"triangle";
else if (*sEndArraw == L"classic")
pShape->spPr.ln->tailEnd->type = L"stealth";
else if (*sEndArraw == L"diamond")
pShape->spPr.ln->tailEnd->type = L"diamond";
else if (*sEndArraw == L"oval")
pShape->spPr.ln->tailEnd->type = L"oval";
else if (*sEndArraw == L"open")
pShape->spPr.ln->tailEnd->type = L"arrow";
else
pShape->spPr.ln->tailEnd->type = L"none";
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
pSpPr->ln->tailEnd = new PPTX::Logic::LineEnd();
if (*sEndArraw == L"none") pSpPr->ln->tailEnd->type = L"none";
else if (*sEndArraw == L"block") pSpPr->ln->tailEnd->type = L"triangle";
else if (*sEndArraw == L"classic") pSpPr->ln->tailEnd->type = L"stealth";
else if (*sEndArraw == L"diamond") pSpPr->ln->tailEnd->type = L"diamond";
else if (*sEndArraw == L"oval") pSpPr->ln->tailEnd->type = L"oval";
else if (*sEndArraw == L"open") pSpPr->ln->tailEnd->type = L"arrow";
else pSpPr->ln->tailEnd->type = L"none";
}
nullable_string sEndArrawLen;
oNodeStroke.ReadAttributeBase(L"endarrowlength", sEndArrawLen);
if (sEndArrawLen.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
if (!pShape->spPr.ln->tailEnd.is_init())
pShape->spPr.ln->tailEnd = new PPTX::Logic::LineEnd();
if (!pSpPr->ln->tailEnd.is_init())
pSpPr->ln->tailEnd = new PPTX::Logic::LineEnd();
if (*sEndArrawLen == L"short")
pShape->spPr.ln->tailEnd->len = L"sm";
else if (*sEndArrawLen == L"medium")
pShape->spPr.ln->tailEnd->len = L"med";
else if (*sEndArrawLen == L"long")
pShape->spPr.ln->tailEnd->len = L"lg";
else
pShape->spPr.ln->tailEnd->len = L"med";
if (*sEndArrawLen == L"short") pSpPr->ln->tailEnd->len = L"sm";
else if (*sEndArrawLen == L"medium") pSpPr->ln->tailEnd->len = L"med";
else if (*sEndArrawLen == L"long") pSpPr->ln->tailEnd->len = L"lg";
else pSpPr->ln->tailEnd->len = L"med";
}
nullable_string sEndArrawWidth;
oNodeStroke.ReadAttributeBase(L"endarrowwidth", sEndArrawWidth);
if (sEndArrawWidth.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
if (!pShape->spPr.ln->tailEnd.is_init())
pShape->spPr.ln->tailEnd = new PPTX::Logic::LineEnd();
if (!pSpPr->ln->tailEnd.is_init())
pSpPr->ln->tailEnd = new PPTX::Logic::LineEnd();
if (*sEndArrawWidth == L"narrow")
pShape->spPr.ln->tailEnd->w = L"sm";
else if (*sEndArrawWidth == L"medium")
pShape->spPr.ln->tailEnd->w = L"med";
else if (*sEndArrawWidth == L"wide")
pShape->spPr.ln->tailEnd->w = L"lg";
else
pShape->spPr.ln->tailEnd->w = L"med";
if (*sEndArrawWidth == L"narrow") pSpPr->ln->tailEnd->w = L"sm";
else if (*sEndArrawWidth == L"medium") pSpPr->ln->tailEnd->w = L"med";
else if (*sEndArrawWidth == L"wide") pSpPr->ln->tailEnd->w = L"lg";
else pSpPr->ln->tailEnd->w = L"med";
}
nullable_string sStartArraw;
oNodeStroke.ReadAttributeBase(L"startarrow", sStartArraw);
if (sStartArraw.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
pShape->spPr.ln->headEnd = new PPTX::Logic::LineEnd();
if (*sStartArraw == L"none")
pShape->spPr.ln->headEnd->type = L"none";
else if (*sStartArraw == L"block")
pShape->spPr.ln->headEnd->type = L"triangle";
else if (*sStartArraw == L"classic")
pShape->spPr.ln->headEnd->type = L"stealth";
else if (*sStartArraw == L"diamond")
pShape->spPr.ln->headEnd->type = L"diamond";
else if (*sStartArraw == L"oval")
pShape->spPr.ln->headEnd->type = L"oval";
else if (*sStartArraw == L"open")
pShape->spPr.ln->headEnd->type = L"arrow";
else
pShape->spPr.ln->headEnd->type = L"none";
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
pSpPr->ln->headEnd = new PPTX::Logic::LineEnd();
if (*sStartArraw == L"none") pSpPr->ln->headEnd->type = L"none";
else if (*sStartArraw == L"block") pSpPr->ln->headEnd->type = L"triangle";
else if (*sStartArraw == L"classic")pSpPr->ln->headEnd->type = L"stealth";
else if (*sStartArraw == L"diamond")pSpPr->ln->headEnd->type = L"diamond";
else if (*sStartArraw == L"oval") pSpPr->ln->headEnd->type = L"oval";
else if (*sStartArraw == L"open") pSpPr->ln->headEnd->type = L"arrow";
else pSpPr->ln->headEnd->type = L"none";
}
nullable_string sStartArrawLen;
oNodeStroke.ReadAttributeBase(L"startarrowlength", sStartArrawLen);
if (sStartArrawLen.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
if (!pShape->spPr.ln->headEnd.is_init())
pShape->spPr.ln->headEnd = new PPTX::Logic::LineEnd();
if (!pSpPr->ln->headEnd.is_init())
pSpPr->ln->headEnd = new PPTX::Logic::LineEnd();
if (*sStartArrawLen == L"short")
pShape->spPr.ln->headEnd->len = L"sm";
else if (*sStartArrawLen == L"medium")
pShape->spPr.ln->headEnd->len = L"med";
else if (*sStartArrawLen == L"long")
pShape->spPr.ln->headEnd->len = L"lg";
else
pShape->spPr.ln->headEnd->len = L"med";
if (*sStartArrawLen == L"short") pSpPr->ln->headEnd->len = L"sm";
else if (*sStartArrawLen == L"medium") pSpPr->ln->headEnd->len = L"med";
else if (*sStartArrawLen == L"long") pSpPr->ln->headEnd->len = L"lg";
else pSpPr->ln->headEnd->len = L"med";
}
nullable_string sStartArrawWidth;
oNodeStroke.ReadAttributeBase(L"startarrowwidth", sStartArrawWidth);
if (sStartArrawWidth.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
if (!pShape->spPr.ln->headEnd.is_init())
pShape->spPr.ln->headEnd = new PPTX::Logic::LineEnd();
if (!pSpPr->ln->headEnd.is_init())
pSpPr->ln->headEnd = new PPTX::Logic::LineEnd();
if (*sStartArrawWidth == L"narrow")
pShape->spPr.ln->headEnd->w = L"sm";
else if (*sStartArrawWidth == L"medium")
pShape->spPr.ln->headEnd->w = L"med";
else if (*sStartArrawWidth == L"wide")
pShape->spPr.ln->headEnd->w = L"lg";
else
pShape->spPr.ln->headEnd->w = L"med";
if (*sStartArrawWidth == L"narrow") pSpPr->ln->headEnd->w = L"sm";
else if (*sStartArrawWidth == L"medium") pSpPr->ln->headEnd->w = L"med";
else if (*sStartArrawWidth == L"wide") pSpPr->ln->headEnd->w = L"lg";
else pSpPr->ln->headEnd->w = L"med";
}
nullable_string sEndCap;
oNodeStroke.ReadAttributeBase(L"endcap", sEndCap);
if (sEndCap.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
if (*sEndCap == L"flat")
pShape->spPr.ln->cap = L"flat";
else if (*sEndCap == L"round")
pShape->spPr.ln->cap = L"rnd";
else if (*sEndCap == L"square")
pShape->spPr.ln->cap = L"sq";
if (*sEndCap == L"flat") pSpPr->ln->cap = L"flat";
else if (*sEndCap == L"round") pSpPr->ln->cap = L"rnd";
else if (*sEndCap == L"square") pSpPr->ln->cap = L"sq";
}
nullable_string sLineJoin;
oNodeStroke.ReadAttributeBase(L"joinstyle", sLineJoin);
if (sLineJoin.is_init())
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
if (*sLineJoin == L"bevel")
pShape->spPr.ln->Join.type = PPTX::Logic::JoinBevel;
else if (*sLineJoin == L"miter")
pShape->spPr.ln->Join.type = PPTX::Logic::JoinMiter;
else if (*sLineJoin == L"round")
pShape->spPr.ln->Join.type = PPTX::Logic::JoinRound;
if (*sLineJoin == L"bevel") pSpPr->ln->Join.type = PPTX::Logic::JoinBevel;
else if (*sLineJoin == L"miter") pSpPr->ln->Join.type = PPTX::Logic::JoinMiter;
else if (*sLineJoin == L"round") pSpPr->ln->Join.type = PPTX::Logic::JoinRound;
}
}
// default params
if (eType != PPTShapes::sptCFrame)
if (pShape) // not Picture
{
if (!pShape->spPr.ln.is_init())
pShape->spPr.ln = new PPTX::Logic::Ln();
if (!pSpPr->ln.is_init())
pSpPr->ln = new PPTX::Logic::Ln();
if (!pShape->spPr.ln->Fill.Fill.is_init())
if (!pSpPr->ln->Fill.Fill.is_init())
{
PPTX::Logic::SolidFill* pSolid = new PPTX::Logic::SolidFill();
pSolid->m_namespace = L"a";
pSolid->Color.Color = new PPTX::Logic::SrgbClr();
pSolid->Color.Color->SetRGB(0, 0, 0);
pShape->spPr.ln->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pShape->spPr.ln->Fill.Fill = pSolid;
pSpPr->ln->Fill.m_type = PPTX::Logic::UniFill::solidFill;
pSpPr->ln->Fill.Fill = pSolid;
}
}
}
......
......@@ -276,8 +276,8 @@ namespace NSBinPptxRW
std::wstring GetVMLShapeXml (CPPTShape* pPPTShape);
std::wstring GetVMLShapeXml (PPTX::Logic::SpTreeElem& oElem);
void CheckBrushShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void CheckPenShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void CheckBrushShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape);
void CheckPenShape (PPTX::Logic::SpTreeElem* oElem, XmlUtils::CXmlNode& oNode, CPPTShape* pPPTShape);
void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
void LoadCoordPos (XmlUtils::CXmlNode& oNode, ::CShapePtr pShape);
......
......@@ -591,7 +591,7 @@ namespace NSPresentationEditor
#else
std::wstring ConvertPPTtoPPTX(CPPTShape* pPPTShape, const NSGuidesVML::CFormParam& pCoef, bool bIsNamespace = false)
{
if (pPPTShape->m_eType == PPTShapes::sptCRect || pPPTShape->m_eType == PPTShapes::sptCFrame)
if (pPPTShape->m_eType == PPTShapes::sptCRect || pPPTShape->m_eType == PPTShapes::sptCFrame || pPPTShape->m_eType == PPTShapes::sptCTextBox)
{
if (bIsNamespace)
{
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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