Commit ab76aff3 authored by ElenaSubbotina's avatar ElenaSubbotina

.

parent 5d524369
...@@ -153,7 +153,7 @@ namespace NS_DWC_Common ...@@ -153,7 +153,7 @@ namespace NS_DWC_Common
s.erase(nLen - 1); s.erase(nLen - 1);
int nVal = XmlUtils::GetInteger(s); int nVal = XmlUtils::GetInteger(s);
double dKoef = 100000.0 / 65536; double dKoef = 100000.0 / 65536;
nVal = (int)(dKoef * nVal); nVal = (int)(dKoef * nVal + 0.5);
s = std::to_wstring(nVal); s = std::to_wstring(nVal);
} }
} }
...@@ -1499,33 +1499,18 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p ...@@ -1499,33 +1499,18 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
if (bIsFound) if (bIsFound)
break; break;
} }
if(NULL != pElem) if(pElem && NULL != pOle && pOle->m_sProgId.IsInit() && (pOle->m_oId.IsInit() || pOle->m_OleObjectFile.IsInit()))
{
if(NULL != pOle && pOle->m_sProgId.IsInit() && (pOle->m_oId.IsInit() || pOle->m_OleObjectFile.IsInit()))
{
PPTX::Logic::Shape* pShape = dynamic_cast<PPTX::Logic::Shape*>(pElem->GetElem().operator ->());
if(NULL != pShape && pShape->spPr.Fill.Fill.IsInit())
{ {
bool bImageOle = false; PPTX::Logic::Pic* pPicture = dynamic_cast<PPTX::Logic::Pic*>(pElem->GetElem().operator ->());
if ((NULL != pPicture) && (pPicture->blipFill.blip.IsInit()))
if (pShape->spPr.Fill.m_type == PPTX::Logic::UniFill::blipFill) bImageOle = true;
PPTX::Logic::BlipFill oBlipFillNew;
if (!bImageOle)
oBlipFillNew.blip = new PPTX::Logic::Blip();
const PPTX::Logic::BlipFill& oBlipFill = bImageOle ? pShape->spPr.Fill.Fill.as<PPTX::Logic::BlipFill>() :
oBlipFillNew;
if(oBlipFill.blip.IsInit())
{ {
if (pOle->m_OleObjectFile.IsInit()) if (pOle->m_OleObjectFile.IsInit())
{ {
oBlipFill.blip->oleFilepathBin = pOle->m_OleObjectFile->filename().GetPath(); pPicture->blipFill.blip->oleFilepathBin = pOle->m_OleObjectFile->filename().GetPath();
} }
else if (pOle->m_oId.IsInit()) else if (pOle->m_oId.IsInit())
{ {
oBlipFill.blip->oleRid = pOle->m_oId.get().ToString(); pPicture->blipFill.blip->oleRid = pOle->m_oId.get().ToString();
} }
if(strName == L"object") if(strName == L"object")
{ {
...@@ -1537,21 +1522,10 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p ...@@ -1537,21 +1522,10 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
pOle->m_oDyaOrig = nDyaOrig; pOle->m_oDyaOrig = nDyaOrig;
} }
} }
pPicture->oleObject.reset(pOle);
PPTX::Logic::Pic *newElem = new PPTX::Logic::Pic();
newElem->blipFill = oBlipFill;
newElem->spPr = pShape->spPr;
newElem->style = pShape->style;
newElem->oleObject.reset(pOle);
newElem->spPr.Fill.Fill.reset();
pOle = NULL; pOle = NULL;
pElem->InitElem(newElem);
}
}
} }
if (pElem)
m_pBinaryWriter->WriteRecord1(1, *pElem); m_pBinaryWriter->WriteRecord1(1, *pElem);
} }
RELEASEOBJECT(pElem) RELEASEOBJECT(pElem)
...@@ -2570,10 +2544,10 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C ...@@ -2570,10 +2544,10 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
double dTextMarginRight = oTrimmer.GetParameter(2, 0.1); double dTextMarginRight = oTrimmer.GetParameter(2, 0.1);
double dTextMarginBottom = oTrimmer.GetParameter(3, 0.05); double dTextMarginBottom = oTrimmer.GetParameter(3, 0.05);
pShape->oTextBoxBodyPr->lIns = (int)(12700 * dTextMarginLeft); pShape->oTextBoxBodyPr->lIns = (int)(12700 * dTextMarginLeft + 0.5);
pShape->oTextBoxBodyPr->tIns = (int)(12700 * dTextMarginTop); pShape->oTextBoxBodyPr->tIns = (int)(12700 * dTextMarginTop + 0.5);
pShape->oTextBoxBodyPr->rIns = (int)(12700 * dTextMarginRight); pShape->oTextBoxBodyPr->rIns = (int)(12700 * dTextMarginRight + 0.5);
pShape->oTextBoxBodyPr->bIns = (int)(12700 * dTextMarginBottom); pShape->oTextBoxBodyPr->bIns = (int)(12700 * dTextMarginBottom + 0.5);
} }
if (!sTextboxStyle.empty()) if (!sTextboxStyle.empty())
...@@ -3164,7 +3138,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P ...@@ -3164,7 +3138,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (oCssStyles.m_mapSettings.end() != pPair) if (oCssStyles.m_mapSettings.end() != pPair)
{ {
left = (LONG)(dKoefSize * parserPoint.FromString(pPair->second)); left = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5);
} }
pPair = oCssStyles.m_mapSettings.find(L"margin-top"); pPair = oCssStyles.m_mapSettings.find(L"margin-top");
...@@ -3174,54 +3148,54 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P ...@@ -3174,54 +3148,54 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (oCssStyles.m_mapSettings.end() != pPair) if (oCssStyles.m_mapSettings.end() != pPair)
{ {
top = (LONG)(dKoefSize * parserPoint.FromString(pPair->second)); top = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5);
} }
} }
pPair = oCssStyles.m_mapSettings.find(L"width"); pPair = oCssStyles.m_mapSettings.find(L"width");
if (oCssStyles.m_mapSettings.end() != pPair) if (oCssStyles.m_mapSettings.end() != pPair)
{ {
width = (LONG)(dKoefSize * parserPoint.FromString(pPair->second)); width = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5);
} }
else else
{ {
pPair = oCssStyles.m_mapSettings.find(L"margin-right"); pPair = oCssStyles.m_mapSettings.find(L"margin-right");
if (oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.end()) if (oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.end())
width = (LONG)(dKoefSize * parserPoint.FromString(pPair->second)) - left; width = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5) - left;
} }
pPair = oCssStyles.m_mapSettings.find(L"height"); pPair = oCssStyles.m_mapSettings.find(L"height");
if (oCssStyles.m_mapSettings.end() != pPair) if (oCssStyles.m_mapSettings.end() != pPair)
{ {
height = (LONG)(dKoefSize * parserPoint.FromString(pPair->second)); height = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5);
} }
else else
{ {
pPair = oCssStyles.m_mapSettings.find(L"margin-bottom"); pPair = oCssStyles.m_mapSettings.find(L"margin-bottom");
if (oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.end()) if (oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.end())
height = (LONG)(dKoefSize * parserPoint.FromString(pPair->second)) - top; height = (LONG)(dKoefSize * parserPoint.FromString(pPair->second) + 0.5) - top;
} }
unsigned long margL = (unsigned long)(9 * dKoef); unsigned long margL = (unsigned long)(9 * dKoef + 0.5);
unsigned long margT = 0; unsigned long margT = 0;
unsigned long margR = (unsigned long)(9 * dKoef); unsigned long margR = (unsigned long)(9 * dKoef + 0.5);
unsigned long margB = 0; unsigned long margB = 0;
pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-left"); pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-left");
if (oCssStyles.m_mapSettings.end() != pPair) if (oCssStyles.m_mapSettings.end() != pPair)
margL = (unsigned long)(dKoef * parserPoint.FromString(pPair->second)); margL = (unsigned long)(dKoef * parserPoint.FromString(pPair->second) + 0.5);
pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-top"); pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-top");
if (oCssStyles.m_mapSettings.end() != pPair) if (oCssStyles.m_mapSettings.end() != pPair)
margT = (unsigned long)(dKoef * parserPoint.FromString(pPair->second)); margT = (unsigned long)(dKoef * parserPoint.FromString(pPair->second) + 0.5);
pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-right"); pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-right");
if (oCssStyles.m_mapSettings.end() != pPair) if (oCssStyles.m_mapSettings.end() != pPair)
margR = (unsigned long)(dKoef * parserPoint.FromString(pPair->second)); margR = (unsigned long)(dKoef * parserPoint.FromString(pPair->second) + 0.5);
pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-bottom"); pPair = oCssStyles.m_mapSettings.find(L"mso-wrap-distance-bottom");
if (oCssStyles.m_mapSettings.end() != pPair) if (oCssStyles.m_mapSettings.end() != pPair)
margB = (unsigned long)(dKoef * parserPoint.FromString(pPair->second)); margB = (unsigned long)(dKoef * parserPoint.FromString(pPair->second) + 0.5);
oProps.X = left; oProps.X = left;
oProps.Y = top; oProps.Y = top;
...@@ -5028,8 +5002,8 @@ void CDrawingConverter::ConvertMainPropsToVML(const std::wstring& bsMainProps, N ...@@ -5028,8 +5002,8 @@ void CDrawingConverter::ConvertMainPropsToVML(const std::wstring& bsMainProps, N
int nX = oNodeT.ReadAttributeInt(L"x"); int nX = oNodeT.ReadAttributeInt(L"x");
int nY = oNodeT.ReadAttributeInt(L"y"); int nY = oNodeT.ReadAttributeInt(L"y");
nX = (int)(dKoefX * nX); nX = (int)(dKoefX * nX + 0.5);
nY = (int)(dKoefY * nY); nY = (int)(dKoefY * nY + 0.5);
std::wstring strFP = std::to_wstring(nX) + L" " + std::to_wstring(nY); std::wstring strFP = std::to_wstring(nX) + L" " + std::to_wstring(nY);
strAttr += strFP; strAttr += strFP;
......
...@@ -123,18 +123,18 @@ namespace PPTX ...@@ -123,18 +123,18 @@ namespace PPTX
oWriter.StartNode(_T("w:ind")); oWriter.StartNode(_T("w:ind"));
oWriter.StartAttributes(); oWriter.StartAttributes();
if (oPar.pPr->marL.is_init()) if (oPar.pPr->marL.is_init())
oWriter.WriteAttribute(_T("w:left"), (int)((double)(*pPr->marL) / 635)); oWriter.WriteAttribute(_T("w:left"), (int)((double)(*pPr->marL) / 635.) + 0.5);
if (oPar.pPr->marR.is_init()) if (oPar.pPr->marR.is_init())
oWriter.WriteAttribute(_T("w:right"), (int)((double)(*pPr->marR) / 635)); oWriter.WriteAttribute(_T("w:right"), (int)((double)(*pPr->marR) / 635.) + 0.5);
if (oPar.pPr->indent.is_init()) if (oPar.pPr->indent.is_init())
oWriter.WriteAttribute(_T("w:firstLine"), (int)((double)(*pPr->indent) / 635)); oWriter.WriteAttribute(_T("w:firstLine"), (int)((double)(*pPr->indent) / 635.) + 0.5);
oWriter.EndAttributes(); oWriter.EndAttributes();
oWriter.EndNode(_T("w:ind")); oWriter.EndNode(_T("w:ind"));
} }
if (true) if (true)
{ {
oWriter.WriteString(_T("<w:spacing w:before=\"0\" w:after=\"0\" />")); oWriter.WriteString(_T("<w:spacing w:before=\"0\" w:after=\"0\"/>"));
} }
if (pPr->algn.is_init()) if (pPr->algn.is_init())
......
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