Commit 21d6a851 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

XlsFormat - японские картинки из автофигур

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68307 954022d7-b5bf-4e40-9824-e11837661b57
parent bd3ae6a7
......@@ -40,11 +40,11 @@ namespace NSGuidesVML
class CBaseShape
{
public:
std::vector<long> m_arAdjustments;
std::vector<double> m_arGuides;
std::vector<long> m_arAdjustments;
std::vector<double> m_arGuides;
LONG m_eJoin;
bool m_bConcentricFill;
LONG m_eJoin;
bool m_bConcentricFill;
std::vector<SimpleTypes::CPoint> m_arConnectors;
std::vector<LONG> m_arConnectorAngles;
......@@ -67,65 +67,54 @@ public:
{
}
//virtual bool LoadFromXML(const std::wstring& xml) = 0;
//virtual bool LoadFromXML(XmlUtils::CXmlNode& xmlNode) = 0;
//virtual bool LoadAdjustValuesList(const std::wstring& xml) = 0;
//virtual bool LoadGuidesList(const std::wstring& xml) = 0;
//virtual bool LoadAdjustHandlesList(const std::wstring& xml) = 0;
//virtual bool LoadConnectorsList(const std::wstring& xml) = 0;
virtual bool LoadTextRect(const std::wstring& xml) = 0;
virtual bool LoadPathList(const std::wstring& xml) = 0;
//virtual bool SetAdjustment(long index, long value) = 0;
//virtual void ReCalculate() = 0;
//virtual void AddGuide(const std::wstring& strGuide) {}
static CBaseShape* CreateByType(int ShapeType);
bool SetType(int ShapeType);
//virtual bool SetProperties(CBaseShape* Shape)
//{
// if( Shape == NULL)
// return false;
virtual bool SetProperties(CBaseShape* Shape)
{
if( Shape == NULL)
return false;
// m_oPath = Shape->m_oPath;
// m_strPath = Shape->m_strPath;
// m_strRect = Shape->m_strRect;
//
// m_arAdjustments.clear();
// for(int i = 0; i < Shape->m_arAdjustments.size(); i++)
// m_arAdjustments.push_back(Shape->m_arAdjustments[i]);
m_oPath = Shape->m_oPath;
m_strPath = Shape->m_strPath;
m_strRect = Shape->m_strRect;
m_arAdjustments.clear();
for(int i = 0; i < Shape->m_arAdjustments.size(); i++)
m_arAdjustments.push_back(Shape->m_arAdjustments[i]);
// Guides.clear();
// for(int i = 0; i < Shape->Guides.size(); i++)
// Guides.push_back(Shape->Guides[i]);
m_arGuides.clear();
for(int i = 0; i < Shape->m_arGuides.size(); i++)
m_arGuides.push_back(Shape->m_arGuides[i]);
// m_eJoin = Shape->m_eJoin;
// m_bConcentricFill = Shape->m_bConcentricFill;
m_eJoin = Shape->m_eJoin;
m_bConcentricFill = Shape->m_bConcentricFill;
// m_arConnectors.clear();
// for(int i = 0; i < Shape->m_arConnectors.size(); i++)
// m_arConnectors.push_back(Shape->m_arConnectors[i]);
m_arConnectors.clear();
for(int i = 0; i < Shape->m_arConnectors.size(); i++)
m_arConnectors.push_back(Shape->m_arConnectors[i]);
// m_arConnectorAngles.clear();
// for(int i = 0; i < Shape->m_arConnectorAngles.size(); i++)
// m_arConnectorAngles.push_back(Shape->m_arConnectorAngles[i]);
m_arConnectorAngles.clear();
for(int i = 0; i < Shape->m_arConnectorAngles.size(); i++)
m_arConnectorAngles.push_back(Shape->m_arConnectorAngles[i]);
// m_arTextRects.clear();
// for(int i = 0; i < Shape->m_arTextRects.size(); i++)
// m_arTextRects.push_back(Shape->m_arTextRects[i]);
m_arTextRects.clear();
for(int i = 0; i < Shape->m_arTextRects.size(); i++)
m_arTextRects.push_back(Shape->m_arTextRects[i]);
// m_arHandles.clear();
// for(int i = 0; i < Shape->m_arHandles.size(); i++)
// m_arHandles.push_back(Shape->m_arHandles[i]);
m_arHandles.clear();
for(int i = 0; i < Shape->m_arHandles.size(); i++)
m_arHandles.push_back(Shape->m_arHandles[i]);
// m_strRect = Shape->m_strRect;
// m_strTransformXml = Shape->m_strTransformXml;
// return true;
//}
m_strRect = Shape->m_strRect;
m_strTransformXml = Shape->m_strTransformXml;
return true;
}
//virtual bool SetToDublicate(CBaseShape* Shape)
//{
......
......@@ -169,11 +169,8 @@ namespace NSCustomVML
std::vector<CGuide> m_arGuides;
std::vector<LONG>* m_pAdjustValues;
bool m_bIsVerticesPresent;
bool m_bIsPathPresent;
//CBrush m_oBrush;
//CPen m_oPen;
bool m_bIsVerticesPresent;
bool m_bIsPathPresent;
CCustomVML() : m_arVertices(), m_arSegments(), m_arGuides(), m_pAdjustValues(NULL)
{
......@@ -206,9 +203,6 @@ namespace NSCustomVML
m_bIsPathPresent = oSrc.m_bIsPathPresent;
m_bIsVerticesPresent = oSrc.m_bIsVerticesPresent;
//m_oBrush = oSrc.m_oBrush;
//m_oPen = oSrc.m_oPen;
return *this;
}
......@@ -403,9 +397,7 @@ namespace NSCustomVML
}
}
}
oManager.CalculateResults();
pShape->LoadPathList(strPath);
}
};
......
......@@ -27,288 +27,6 @@ public:
{
}
//virtual bool LoadFromXML(const std::wstring& xml)
//{
// XmlUtils::CXmlNode oNodePict;
// if (oNodePict.FromXmlString(xml))
// {
// if (_T("shape") == oNodePict.GetName())
// {
// std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
// if (id != _T(""))
// {
// SetShapeType((PPTShapes::oox::MSOSPT)Strings::ToInteger(id));
// }
// else
// {
// XmlUtils::CXmlNode oNodeTemplate;
// if (oNodePict.GetNode(_T("template"), oNodeTemplate))
// {
// std::wstring strAdj = oNodeTemplate.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeTemplate.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeTemplate.GetAttributeOrValue(_T("path"));
// LoadPathList(strPath);
// }
// }
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodePict.GetNode(_T("path"), oNodeGuides))
// {
// std::wstring strPath = oNodeGuides.GetAttributeOrValue(_T("val"));
// LoadPathList(strPath);
// }
// /*XmlUtils::CXmlNode oNodeShapeType;
// if (oNodePict.GetNode(_T("v:shapetype"), oNodeShapeType))
// {
// std::wstring strAdj = oNodeShapeType.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeShapeType.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeShapeType.GetAttributeOrValue(_T("path"));
// LoadAdjustValuesList(strPath);
// }
// else
// {
// XmlUtils::CXmlNode oNodeShape;
// if (oNodePict.GetNode(_T("v:shape"), oNodeShape))
// {
// std::wstring strAdj = oNodeShape.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeShape.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeShape.GetAttributeOrValue(_T("path"));
// LoadPathList(strPath);
// }
// }*/
// return true;
// }
// }
// return false;
//}
//virtual bool LoadFromXML(XmlUtils::CXmlNode& oNodePict)
//{
// std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
// bool isPathList = false;
// if (id != _T(""))
// {
// SetShapeType((oox::MSOSPT)XmlUtils::GetInteger(id));
// }
// else
// {
// XmlUtils::CXmlNode oNodeTemplate;
// if (oNodePict.GetNode(_T("template"), oNodeTemplate))
// {
// std::wstring strAdj = oNodeTemplate.GetAttributeOrValue(_T("adj"));
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeTemplate.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// std::wstring strPath = oNodeTemplate.GetAttributeOrValue(_T("path"));
// if (strPath != _T(""))
// {
// LoadPathList(strPath);
// isPathList = true;
// }
// }
// }
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodePict.GetNode(_T("path"), oNodeGuides))
// {
// std::wstring strPath = oNodeGuides.GetAttributeOrValue(_T("val"));
// if (strPath != _T(""))
// {
// LoadPathList(strPath);
// isPathList = true;
// }
// }
// if (!isPathList)
// ReCalculate();
// return true;
//}
//virtual bool LoadFromXMLShapeType(XmlUtils::CXmlNode& oNodeShapeType) // vml object
//{ // vmlDrawing - value ..
// std::wstring sId = oNodeShapeType.GetAttribute(_T("o:spt"));
// bool bIsNeedRecalc = true;
// if (sId != _T(""))
// {
// int id = XmlUtils::GetInteger(sId);
// if (id > 0)
// {
// SetShapeType((oox::MSOSPT)id);
// //ReCalculate();
// m_eType = (oox::MSOSPT)id;
// }
// }
// //else
// {
// std::wstring strAdj = oNodeShapeType.GetAttribute(_T("adj"));
// if (strAdj != _T(""))
// LoadAdjustValuesList(strAdj);
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeShapeType.GetNode(_T("v:formulas"), oNodeGuides))
// {
// LoadGuidesList(oNodeGuides.GetXml());
// }
// XmlUtils::CXmlNode oNodePath;
// if (oNodeShapeType.GetNode(_T("v:path"), oNodePath))
// {
// std::wstring strTextR = oNodePath.GetAttribute(_T("textboxrect"));
// if (strTextR != _T(""))
// LoadTextRect(strTextR);
// }
// XmlUtils::CXmlNode oNodeAHs;
// if (oNodeShapeType.GetNode(_T("v:handles"), oNodeAHs))
// {
// LoadAHList(oNodeAHs);
// }
// std::wstring strPath = oNodeShapeType.GetAttribute(_T("path"));
// if (strPath != _T(""))
// {
// LoadPathList(strPath);
// }
// }
// std::wstring strFilled = oNodeShapeType.GetAttribute(_T("filled"));
// std::wstring strStroked = oNodeShapeType.GetAttribute(_T("stroked"));
// if (strFilled != _T(""))
// {
// if (strFilled == _T("false") || strFilled == _T("f"))
// m_bIsFilled = false;
// else
// m_bIsFilled = true;
// }
//
// if (strStroked != _T(""))
// {
// if (strStroked == _T("false") || strStroked == _T("f"))
// m_bIsStroked = false;
// else
// m_bIsStroked = true;
// }
// ReCalculate();
// return true;
//}
//virtual bool LoadAdjustValuesList(const std::wstring& xml)
//{
// std::wstring strXml = xml;
// if (0 == strXml.Find((TCHAR)','))
// strXml = (_T("defaultAdj") + strXml);
// LONG lLastIndex = strXml.GetLength() - 1;
// if (lLastIndex >= 0 && lLastIndex == strXml.ReverseFind((TCHAR)','))
// {
// strXml = strXml + _T("defaultAdj");
// }
// strXml.Replace(_T(",,"), _T(",defaultAdj,"));
// std::vector<std::wstring> arAdj;
// NSStringUtils::ParseString(_T(","), strXml, &arAdj);
//
// std::vector<long> oOldAdj;
// int nOldLen = m_arAdjustments.size();
// for (int ii = 0; ii < nOldLen; ++ii)
// oOldAdj.push_back(m_arAdjustments[ii]);
// m_arAdjustments.clear();
// for (int nIndex = 0; nIndex < arAdj.size(); ++nIndex)
// {
// if (_T("defaultAdj") == arAdj[nIndex])
// {
// if (nIndex >= nOldLen)
// m_arAdjustments.push_back(0);
// else
// m_arAdjustments.push_back(oOldAdj[nIndex]);
// }
// else
// {
// m_arAdjustments.push_back((LONG)XmlUtils::GetInteger(arAdj[nIndex]));
// }
// }
// int newLen = m_arAdjustments.size();
// for (int i = newLen; i < nOldLen; ++i)
// m_arAdjustments.push_back(oOldAdj[i]);
// return true;
//}
//virtual bool LoadGuidesList(const std::wstring& xml)
//{
// // std::wstring sFormulasTemp;
// // sFormulasTemp.Format(_T("<root xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">%ls</root>"),xml);
//
//
// std::wstring sBegin(_T("<root xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">"));
//
// std::wstring sEnd(_T("</root>"));
// std::wstring sFormulasTemp = sBegin + xml+ sEnd;
//
// XmlUtils::CXmlNode oNodeRoot;
// if (oNodeRoot.FromXmlString(sFormulasTemp) == false) return false;
// XmlUtils::CXmlNode oNodeGuides;
// if (oNodeRoot.GetNode(_T("v:formulas"),oNodeGuides) == false) return false;
// if ((_T("v:formulas") == oNodeGuides.GetName()))
// {
// m_oManager.Clear();
// XmlUtils::CXmlNodes oList;
// if (oNodeGuides.GetNodes(_T("v:f"), oList))
// {
// int lCount = oList.GetCount();
// for (int nIndex = 0; nIndex < lCount; ++nIndex)
// {
// XmlUtils::CXmlNode oNodeFormula;
// oList.GetAt(nIndex, oNodeFormula);
// m_oManager.AddFormula(oNodeFormula.GetAttributeOrValue(_T("eqn")));
// }
// }
// m_oManager.Clear(&m_arAdjustments);
// m_oManager.CalculateResults();
// return true;
// }
// return false;
//}
virtual void AddGuide(const std::wstring& strGuide)
{
m_oManager.AddFormula(strGuide);
......@@ -373,8 +91,7 @@ public:
{
m_strPath = xml;
//if (!m_bIsShapeType)
// m_oPath.FromXML(xml, m_oManager);
m_oPath.FromXML(xml, m_oManager);
return true;
}
......@@ -388,18 +105,6 @@ public:
return FALSE;
}
//virtual std::wstring ToXML(CGeomShapeInfo& GeomInfo, CMetricInfo& MetricInfo, double StartTime, double EndTime, CBrush& Brush, CPen& Pen)
//{
// if ((_T("") != m_strPathLimoX) || _T("") != m_strPathLimoY)
// {
// m_strPath = (GeomInfo.m_dWidth >= GeomInfo.m_dHeight) ? m_strPathLimoX : m_strPathLimoY;
// ReCalculate();
// m_oPath.SetCoordsize(21600, 21600);
// }
//
// return m_oPath.ToXml(GeomInfo, StartTime, EndTime, Pen, Brush, MetricInfo, NSBaseShape::ppt);
//}
virtual void ReCalculate()
{
m_oManager.Clear(&m_arAdjustments);
......@@ -427,7 +132,7 @@ public:
//m_arStringTextRects.clear();
//m_arStringTextRects.insert(m_arStringTextRects.end(), ((CCustomShape*)Shape)->m_arStringTextRects.begin(), ((CCustomShape*)Shape)->m_arStringTextRects.end());
return true;// CBaseShape::SetProperties(Shape);
return CBaseShape::SetProperties(Shape);
}
bool SetShapeType(oox::MSOSPT type)
......
......@@ -19,7 +19,7 @@ namespace NSGuidesVML
static wchar_t* g_guide_string1 = L"<a:gd name=\"gd";
static int g_guide_string1_len = __wstrlen(g_guide_string1);
static wchar_t* g_guide_string2 = L"\" />";
static wchar_t* g_guide_string2 = L"\"></a:gd>";
static int g_guide_string2_len = __wstrlen(g_guide_string2);
static wchar_t* g_guide_string_val = L"\" fmla=\"val ";
......@@ -196,8 +196,8 @@ namespace NSGuidesVML
{
m_lIndexDst = 0;
m_lIndexSrc = -1;
m_lWidth = 0;
m_lHeight = 0;
m_lWidth = ShapeSizeVML;
m_lHeight = ShapeSizeVML;
m_lMaxAdjUse = -1;
}
......@@ -236,7 +236,7 @@ namespace NSGuidesVML
m_oAdjRes.WriteINT(i);
m_oAdjRes.WriteString(_T("\" fmla=\"val "));
m_oAdjRes.WriteINT(arAdj[i]);
m_oAdjRes.WriteString(_T("\" />"));
m_oAdjRes.WriteString(_T("\"></a:gd>"));
}
for (int i = nAdjCount; i <= m_lMaxAdjUse; ++i)
{
......@@ -244,7 +244,7 @@ namespace NSGuidesVML
m_oAdjRes.WriteINT(i);
m_oAdjRes.WriteString(_T("\" fmla=\"val "));
m_oAdjRes.WriteINT(0);
m_oAdjRes.WriteString(_T("\" />"));
m_oAdjRes.WriteString(_T("\"></a:gd>"));
}
}
void ConvertFormula(const std::vector<CFormula>& arFormulas)
......@@ -377,11 +377,13 @@ namespace NSGuidesVML
{
m_arParts.clear();
std::vector<std::wstring> oArray;
NSStringUtils::ParseString(_T("e"), strPath, oArray);
NSStringUtils::ParseString(L"e", strPath, oArray);
int nSizeArr = oArray.size();
for (int nIndex = 0; nIndex < nSizeArr; ++nIndex)
{
if (oArray[nIndex].empty()) continue;
if (nIndex < oPath.m_arParts.size() )
{
const CPartPath& oPart = oPath.m_arParts[nIndex];
......@@ -396,15 +398,15 @@ namespace NSGuidesVML
FromXML(oArray[nIndex], bFill, bStroke);
LONG nCountSlices = m_arSlicesPath.size();
m_oPathRes.StartNode(_T("a:path"));
m_oPathRes.StartNode(L"a:path");
m_oPathRes.StartAttributes();
m_oPathRes.WriteAttribute(_T("w"), m_lWidth);
m_oPathRes.WriteAttribute(_T("h"), m_lHeight);
m_oPathRes.WriteAttribute(L"w", m_lWidth);
m_oPathRes.WriteAttribute(L"h", m_lHeight);
if (!bStroke)
m_oPathRes.WriteAttribute(_T("stroke"), (std::wstring)_T("false"));
if (!bFill)
m_oPathRes.WriteAttribute(_T("fill"), (std::wstring)_T("none"));
m_oPathRes.WriteAttribute(L"fill" , std::wstring(bFill ? L"norm" : L"none"));
m_oPathRes.WriteAttribute(L"stroke" , bStroke ? 1 : 0);
m_oPathRes.WriteAttribute(L"extrusionOk", 0);
m_oPathRes.EndAttributes();
for (int i = 0; i < nCountSlices; ++i)
......@@ -718,11 +720,11 @@ namespace NSGuidesVML
GetValue(m_lIndexDst-2, ptFormula, true, m_oTextRect);
m_oTextRect.WriteString(_T("\" b=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oTextRect);
m_oTextRect.WriteString(_T("\" />"));
m_oTextRect.WriteString(_T("\"/>"));
}
private:
void GetValue(const LONG& lParam, const ParamType& eParamType, const bool& bExtShape, CXmlWriter& oWriter)
void GetValue(const LONG& lParam, const ParamType& eParamType, const bool& bExtShape, CXmlWriter& oWriter)
{
oWriter.m_oWriter.AddSize(15);
switch (eParamType)
......@@ -759,7 +761,7 @@ namespace NSGuidesVML
break;
}
}
std::wstring GetValue2(const LONG& lParam, const ParamType& eParamType, const bool& bExtShape)
std::wstring GetValue2(const LONG& lParam, const ParamType& eParamType, const bool& bExtShape)
{
std::wstring strValue;
switch (eParamType)
......@@ -790,7 +792,7 @@ namespace NSGuidesVML
}
//---------------------------------------
void ConvertVal(const LONG& lParam1, const ParamType& eType1, const bool& bExtShape1, CXmlWriter& oWriter)
void ConvertVal(const LONG& lParam1, const ParamType& eType1, const bool& bExtShape1, CXmlWriter& oWriter)
{
GUIDE_PARAM_1(val)
}
......@@ -1052,17 +1054,17 @@ namespace NSGuidesVML
if ('#' == strParam[0])
{
lRes = (LONG)NSGuidesVML::GetInteger(strParam.substr(1));
strFrmla = GetValue2(lRes, ptAdjust, false) + strSize;
strFrmla = GetValue2(lRes, ptAdjust, false) + L" " + strSize;
}
else if ('&' == strParam[0])
{
lRes = (LONG)NSGuidesVML::GetInteger(strParam.substr(1));
strFrmla = GetValue2(lRes, ptFormula, true) + strSize;
strFrmla = GetValue2(lRes, ptFormula, true) + L" " + strSize;
}
else if ('@' == strParam[0])
{
lRes = (LONG)NSGuidesVML::GetInteger(strParam.substr(1));
strFrmla = GetValue2(lRes, ptFormula, false) + strSize;
strFrmla = GetValue2(lRes, ptFormula, false) + L" " + strSize;
}
else if (!NSStringUtils::IsNumber(strParam))
{
......@@ -1089,7 +1091,7 @@ namespace NSGuidesVML
m_oGuidsRes.WriteString(strBase);
m_oGuidsRes.WriteString(_T(" "));
m_oGuidsRes.WriteString(strFrmla);
m_oGuidsRes.WriteString(_T("\" />"));
m_oGuidsRes.WriteString(_T("\"></a:gd>"));
m_lIndexDst++;
......@@ -1156,7 +1158,7 @@ namespace NSGuidesVML
GetValue(nIndex-5, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" swAng=\""));
GetValue(nIndex-4, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
m_lIndexSrc++;
ConvertVal(pPoint.x, pPointType.x, false, m_oGuidsRes);
......@@ -1194,7 +1196,7 @@ namespace NSGuidesVML
GetValue(nIndex-5, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" swAng=\""));
GetValue(nIndex-4, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
m_lIndexSrc++;
ConvertVal(pPoint.x, pPointType.x, false, m_oGuidsRes);
......@@ -1222,7 +1224,7 @@ namespace NSGuidesVML
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:moveTo>"));
m_oPathRes.WriteString(_T("\"/></a:moveTo>"));
}
}
......@@ -1244,7 +1246,7 @@ namespace NSGuidesVML
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:moveTo>"));
m_oPathRes.WriteString(_T("\"/></a:moveTo>"));
}
}
......@@ -1266,7 +1268,7 @@ namespace NSGuidesVML
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:lnTo>"));
m_oPathRes.WriteString(_T("\"/></a:lnTo>"));
}
}
......@@ -1288,7 +1290,7 @@ namespace NSGuidesVML
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:lnTo>"));
m_oPathRes.WriteString(_T("\"/></a:lnTo>"));
}
}
......@@ -1512,7 +1514,7 @@ namespace NSGuidesVML
GetValue(nIndex-5, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(nIndex, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:moveTo><a:arcTo wR=\""));
m_oPathRes.WriteString(_T("\"/></a:moveTo><a:arcTo wR=\""));
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" hR=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
......@@ -1520,7 +1522,7 @@ namespace NSGuidesVML
GetValue(nIndex1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" swAng=\""));
GetValue(nIndex2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
else
{
......@@ -1528,7 +1530,7 @@ namespace NSGuidesVML
GetValue(nIndex-5, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(nIndex, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:lnTo><a:arcTo wR=\""));
m_oPathRes.WriteString(_T("\"/></a:lnTo><a:arcTo wR=\""));
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" hR=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
......@@ -1536,14 +1538,14 @@ namespace NSGuidesVML
GetValue(nIndex1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" swAng=\""));
GetValue(nIndex2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
//
/*
LONG nIndex3 = m_arIndexDst[m_lIndexSrc-14];
strPathRes += _T("<a:moveTo><a:pt x=\"0\" y=\"0\" /></a:moveTo><a:lnTo><a:pt x=\"") + GetValue(nIndex3-1, ptFormula, true) + _T("\" y=\"") + GetValue(nIndex3, ptFormula, true) +
+ _T("\" /></a:lnTo>");
+ _T("\"/></a:lnTo>");
*/
//
......@@ -1764,7 +1766,7 @@ namespace NSGuidesVML
GetValue(nIndex-5, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(nIndex, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:moveTo><a:arcTo wR=\""));
m_oPathRes.WriteString(_T("\"/></a:moveTo><a:arcTo wR=\""));
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" hR=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
......@@ -1772,7 +1774,7 @@ namespace NSGuidesVML
GetValue(nIndex1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" swAng=\""));
GetValue(nIndex2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
else
{
......@@ -1780,7 +1782,7 @@ namespace NSGuidesVML
GetValue(nIndex-5, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(nIndex, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:lnTo><a:arcTo wR=\""));
m_oPathRes.WriteString(_T("\"/></a:lnTo><a:arcTo wR=\""));
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" hR=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
......@@ -1788,7 +1790,7 @@ namespace NSGuidesVML
GetValue(nIndex1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" swAng=\""));
GetValue(nIndex2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
//
......@@ -1816,7 +1818,7 @@ namespace NSGuidesVML
GetValue(pCurPoint.x, pCurPointType.x, false, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(pCurPoint.y, pCurPointType.y, false, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
m_oPathRes.WriteString(_T("</a:quadBezTo>"));
}
......@@ -1831,7 +1833,7 @@ namespace NSGuidesVML
GetValue(pCurPoint.x, pCurPointType.x, false, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(pCurPoint.y, pCurPointType.y, false, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:lnTo>"));
m_oPathRes.WriteString(_T("\"/></a:lnTo>"));
}
}
......@@ -1861,7 +1863,7 @@ namespace NSGuidesVML
GetValue(pCurPoint.x, pCurPointType.x, false, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(pCurPoint.y, pCurPointType.y, false, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
m_oPathRes.WriteString(_T("</a:cubicBezTo>"));
}
......@@ -1873,7 +1875,7 @@ namespace NSGuidesVML
GetValue(pCurPoint.x, pCurPointType.x, false, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(pCurPoint.y, pCurPointType.y, false, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:lnTo>"));
m_oPathRes.WriteString(_T("\"/></a:lnTo>"));
}
}
......@@ -1910,7 +1912,7 @@ namespace NSGuidesVML
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
m_oPathRes.WriteString(_T("</a:cubicBezTo>"));
}
......@@ -1930,7 +1932,7 @@ namespace NSGuidesVML
GetValue(m_lIndexDst-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(m_lIndexDst-1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:lnTo>"));
m_oPathRes.WriteString(_T("\"/></a:lnTo>"));
}
}
......@@ -2034,7 +2036,7 @@ namespace NSGuidesVML
GetValue(nIndex-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(nIndex, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:moveTo><a:arcTo wR=\""));
m_oPathRes.WriteString(_T("\"/></a:moveTo><a:arcTo wR=\""));
GetValue(nIndex2-1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" hR=\""));
GetValue(nIndex2, ptFormula, true, m_oPathRes);
......@@ -2042,7 +2044,7 @@ namespace NSGuidesVML
GetValue(nIndex1-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" swAng=\""));
GetValue(nIndex1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
else
{
......@@ -2050,7 +2052,7 @@ namespace NSGuidesVML
GetValue(nIndex-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" y=\""));
GetValue(nIndex, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" /></a:lnTo><a:arcTo wR=\""));
m_oPathRes.WriteString(_T("\"/></a:lnTo><a:arcTo wR=\""));
GetValue(nIndex2-1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" hR=\""));
GetValue(nIndex2, ptFormula, true, m_oPathRes);
......@@ -2058,7 +2060,7 @@ namespace NSGuidesVML
GetValue(nIndex1-2, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" swAng=\""));
GetValue(nIndex1, ptFormula, true, m_oPathRes);
m_oPathRes.WriteString(_T("\" />"));
m_oPathRes.WriteString(_T("\"/>"));
}
//
......
......@@ -338,8 +338,7 @@ private:
void Clear()
{
m_pAdjustments = NULL;
m_lShapeWidth = ShapeSizeVML;
m_lShapeHeight = ShapeSizeVML;
m_arFormulas.clear();
m_arResults.clear();
......
......@@ -382,74 +382,6 @@ namespace NSGuidesVML
{
InternalClear();
}
//virtual void Draw(IRenderer* pRenderer)
//{
// if (NULL == pRenderer)
// return;
// pRenderer->put_Width((float)m_dWidthMM);
// pRenderer->put_Height((float)m_dHeightMM);
// // pen/brush.
// // pen brush shape
// pRenderer->SetCommandParams(m_dAngle, m_oBounds.left, m_oBounds.top, m_oBounds.GetWidth(), m_oBounds.GetHeight(), m_lFlags);
// pRenderer->BeginCommand(c_nPathType);
// CDoublePoint pointCur; pointCur.dX = 0; pointCur.dY = 0;
// for (int nIndex = 0; nIndex < m_arParts.size(); ++nIndex)
// {
// m_arParts[nIndex].Draw(pRenderer, pointCur);
// }
// LONG lType = 0;
// if (m_bStroke)
// {
// lType = 1;
// }
// if (m_bFill)
// {
// lType += c_nWindingFillMode;
// }
// pRenderer->DrawPath(lType);
// pRenderer->SetCommandParams(0, -1, -1, -1, -1, 0);
// pRenderer->PathCommandEnd();
// pRenderer->EndCommand(c_nPathType);
//}
//void ConvertVector(IRenderer* pRenderer)
//{
// pRenderer->SetCommandParams(m_dAngle, m_oBounds.left, m_oBounds.top, m_oBounds.GetWidth(), m_oBounds.GetHeight(), m_lFlags);
// pRenderer->BeginCommand(c_nPathType);
// CDoublePoint pointCur; pointCur.dX = 0; pointCur.dY = 0;
// for (int nIndex = 0; nIndex < m_arParts.size(); ++nIndex)
// {
// m_arParts[nIndex].Draw(pRenderer, pointCur);
// }
// LONG lType = 0;
// if (m_bStroke)
// {
// lType = 1;
// }
// if (m_bFill)
// {
// lType += c_nWindingFillMode;
// }
// pRenderer->DrawPath(lType);
// pRenderer->SetCommandParams(0, -1, -1, -1, -1, 0);
// pRenderer->EndCommand(c_nPathType);
//}
public:
class CPart
......
......@@ -376,10 +376,6 @@ namespace NSGuidesVML
bIsX = !bIsX;
}
void ApplyLimo(CGeomShapeInfo& pGeomInfo, double& lX, double& lY)
{
if ((0 == pGeomInfo.m_dLimoX) || (0 == pGeomInfo.m_dLimoY))
......@@ -502,39 +498,12 @@ namespace NSGuidesVML
public:
CPartPath() : m_arSlices()
{
m_bFill = true;
m_bStroke = true;
width = 43200;
height = 43200;
}
#if defined(PPTX_DEF)
void FromXML(XmlUtils::CXmlNode& PathNode, NSGuidesOOXML::CFormulaManager& pManager)
{
m_bFill = PathNode.GetAttribute(_T("fill"), _T("norm")) != _T("none");
std::wstring stroke = PathNode.GetAttribute(_T("stroke"), _T("true"));
m_bStroke = (stroke == _T("true")) || (stroke == _T("1"));
width = (long)XmlUtils::GetInteger(PathNode.GetAttribute(_T("w"), _T("0")));
height = (long)XmlUtils::GetInteger(PathNode.GetAttribute(_T("h"), _T("0")));
if(width == 0) width = (long)pManager.GetWidth();
if(height == 0) height = (long)pManager.GetHeight();
XmlUtils::CXmlNodes list;
PathNode.GetNodes(_T("*"), list);
for(long i = 0; i < list.GetCount(); i++)
{
CSlice slice;
XmlUtils::CXmlNode node;
list.GetAt(i, node);
slice.FromXML(node, pManager, pManager.GetWidth()/width, pManager.GetHeight()/height);
m_arSlices.push_back(slice);
}
//CSlice EndSlice;
//EndSlice.m_eRuler = rtEnd;
//m_arSlices.push_back(EndSlice);
m_bFill = true;
m_bStroke = true;
width = ShapeSizeVML;
height = ShapeSizeVML; //43200?
}
#endif
#if defined(PPT_DEF)
void FromXML(std::wstring strPath, NSGuidesVML::CFormulasManager& pManager)
{
NSStringUtils::CheckPathOn_Fill_Stroke(strPath, m_bFill, m_bStroke);
......@@ -585,7 +554,6 @@ namespace NSGuidesVML
}
}
}
#endif
CPartPath& operator =(const CPartPath& oSrc)
{
......@@ -608,33 +576,21 @@ namespace NSGuidesVML
{
public:
std::vector<CPartPath> m_arParts;
void FromXML(std::wstring strPath, NSGuidesVML::CFormulasManager& pManager)
{
m_arParts.clear();
std::vector<std::wstring> oArray;
//std::wstring ToXml(CGeomShapeInfo& pGeomInfo, double dStartTime, double dEndTime, CPen& pPen, CBrush& pFore, CMetricInfo& pInfo, NSBaseShape::ClassType ClassType)
//{
// std::wstring strResult = _T("");
// for (int nIndex = 0; nIndex < m_arParts.size(); ++nIndex)
// {
// strResult += m_arParts[nIndex].ToXml(pGeomInfo, dStartTime, dEndTime, pPen, pFore, pInfo, ClassType);
// }
// return strResult;
//}
//void ToRenderer(IRenderer* pRenderer, CGeomShapeInfo& pGeomInfo, double dStartTime,
// double dEndTime, CPen& pPen, CBrush& pFore, CMetricInfo& pInfo, NSBaseShape::ClassType ClassType)
//{
// CGraphicPath oPath;
// oPath.Pen = pPen;
// oPath.Brush = pFore;
// int nSize = m_arParts.size();
// for (int nIndex = 0; nIndex < nSize; ++nIndex)
// {
// oPath.Clear();
// m_arParts[nIndex].ToRenderer(&oPath, pGeomInfo, dStartTime, dEndTime, pPen, pFore, pInfo, ClassType);
// oPath.Draw(pRenderer);
// }
//}
NSStringUtils::ParseString(_T("e"), strPath, oArray);
for (int nIndex = 0; nIndex < oArray.size(); ++nIndex)
{
CPartPath oPath;
m_arParts.push_back(oPath);
m_arParts.back().FromXML(oArray[nIndex], pManager);
}
}
CPath& operator =(const CPath& oSrc)
{
......
......@@ -10,7 +10,6 @@
#include "../../../../Common/DocxFormat/Source/Base/Base.h"
#include "../../../../DesktopEditor/graphics/GraphicsPath.h"
const double ShapeSize = 43200.0;
const int ShapeSizeVML = 21600;
const double RadKoef = M_PI/10800000.0;
......@@ -66,20 +65,27 @@ namespace NSStringUtils
boost::algorithm::split(pArrayResults, strSource, boost::algorithm::is_any_of(strDelimeters), boost::algorithm::token_compress_on);
while (pArrayResults.size() > 0)
{
if (pArrayResults[pArrayResults.size() - 1].empty())
pArrayResults.erase(pArrayResults.begin() + pArrayResults.size() - 1);
else
break;
}
}
static void ParseString(std::vector<char>& pArrayDelimeters, std::wstring strSource,
std::vector<std::wstring> & pArrayResults, bool bIsCleared = true)
{
std::wstring strDelimeters = _T("");
for (int nIndex = 0; nIndex < pArrayDelimeters.size(); ++nIndex)
strDelimeters += pArrayDelimeters[nIndex];
return ParseString(strDelimeters, strSource, pArrayResults, bIsCleared);
}
//static void ParseString(std::vector<char>& pArrayDelimeters, std::wstring strSource,
// std::vector<std::wstring> & pArrayResults, bool bIsCleared = true)
//{
// std::wstring strDelimeters = _T("");
// for (int nIndex = 0; nIndex < pArrayDelimeters.size(); ++nIndex)
// strDelimeters += pArrayDelimeters[nIndex];
// return ParseString(strDelimeters, strSource, pArrayResults, bIsCleared);
//}
static void ParsePath(std::wstring strSource, std::vector<std::wstring> pArrayResults, bool bIsCleared = true)
{
std::wstring strPath = strSource;
//strPath.Replace(_T(" "), _T(","));
for (int nIndex = 0; nIndex < strPath.length(); ++nIndex)
......
......@@ -176,6 +176,8 @@ namespace NSGuidesVML
std::wstring GetData()
{
if (m_lSizeCur < 1 || !m_pData) return L"";
std::wstring str(m_pData, (int)m_lSizeCur);
return str;
}
......
......@@ -26,7 +26,7 @@ public:
AddGuide(_T("sum @4 @10 0"));
AddGuide(_T("sum @11 #1 width"));
AddGuide(_T("sum @7 @10 0"));
AddGuide(_T("sum @12 width #0 "));
AddGuide(_T("sum @12 width #0"));
AddGuide(_T("sum @5 0 #0"));
AddGuide(_T("prod @15 1 2"));
AddGuide(_T("mid @4 @7"));
......@@ -36,7 +36,7 @@ public:
AddGuide(_T("val width"));
AddGuide(_T("val height"));
AddGuide(_T("prod height 2 1"));
AddGuide(_T("sum @17 0 @4 "));
AddGuide(_T("sum @17 0 @4"));
AddGuide(_T("ellipse @24 @4 height"));
AddGuide(_T("sum height 0 @25"));
AddGuide(_T("sum @8 128 0"));
......
......@@ -17,44 +17,44 @@ public:
AddGuide(_T("val #2"));
AddGuide(_T("sum #0 width #1"));
AddGuide(_T("prod @3 1 2"));
AddGuide(_T("sum #1 #1 width "));
AddGuide(_T("sum #1 #1 width"));
AddGuide(_T("sum @5 #1 #0"));
AddGuide(_T("prod @6 1 2"));
AddGuide(_T("mid width #0"));
AddGuide(_T("ellipse #2 height @4"));
AddGuide(_T("sum @4 @9 0 "));
AddGuide(_T("sum @4 @9 0"));
AddGuide(_T("sum @10 #1 width"));
AddGuide(_T("sum @7 @9 0 "));
AddGuide(_T("sum @11 width #0 "));
AddGuide(_T("sum @5 0 #0 "));
AddGuide(_T("prod @14 1 2 "));
AddGuide(_T("mid @4 @7 "));
AddGuide(_T("sum #0 #1 width "));
AddGuide(_T("prod @17 1 2 "));
AddGuide(_T("sum @16 0 @18 "));
AddGuide(_T("val width "));
AddGuide(_T("val height "));
AddGuide(_T("sum @7 @9 0"));
AddGuide(_T("sum @11 width #0"));
AddGuide(_T("sum @5 0 #0"));
AddGuide(_T("prod @14 1 2"));
AddGuide(_T("mid @4 @7"));
AddGuide(_T("sum #0 #1 width"));
AddGuide(_T("prod @17 1 2"));
AddGuide(_T("sum @16 0 @18"));
AddGuide(_T("val width"));
AddGuide(_T("val height"));
AddGuide(_T("sum 0 0 height"));
AddGuide(_T("sum @16 0 @4 "));
AddGuide(_T("ellipse @23 @4 height "));
AddGuide(_T("sum @8 128 0 "));
AddGuide(_T("prod @5 1 2 "));
AddGuide(_T("sum @5 0 128 "));
AddGuide(_T("sum #0 @16 @11 "));
AddGuide(_T("sum width 0 #0 "));
AddGuide(_T("prod @29 1 2 "));
AddGuide(_T("prod height height 1 "));
AddGuide(_T("prod #2 #2 1 "));
AddGuide(_T("sum @31 0 @32 "));
AddGuide(_T("sqrt @33 "));
AddGuide(_T("sum @34 height 0 "));
AddGuide(_T("sum @16 0 @4"));
AddGuide(_T("ellipse @23 @4 height"));
AddGuide(_T("sum @8 128 0"));
AddGuide(_T("prod @5 1 2"));
AddGuide(_T("sum @5 0 128"));
AddGuide(_T("sum #0 @16 @11"));
AddGuide(_T("sum width 0 #0"));
AddGuide(_T("prod @29 1 2"));
AddGuide(_T("prod height height 1"));
AddGuide(_T("prod #2 #2 1"));
AddGuide(_T("sum @31 0 @32"));
AddGuide(_T("sqrt @33"));
AddGuide(_T("sum @34 height 0"));
AddGuide(_T("prod width height @35"));
AddGuide(_T("sum @36 64 0 "));
AddGuide(_T("prod #0 1 2 "));
AddGuide(_T("ellipse @30 @38 height "));
AddGuide(_T("sum @39 0 64 "));
AddGuide(_T("sum @36 64 0"));
AddGuide(_T("prod #0 1 2"));
AddGuide(_T("ellipse @30 @38 height"));
AddGuide(_T("sum @39 0 64"));
AddGuide(_T("prod @4 1 2"));
AddGuide(_T("sum #1 0 @41 "));
AddGuide(_T("sum #1 0 @41"));
AddGuide(_T("prod height 4390 32768"));
AddGuide(_T("prod height 28378 32768"));
......
......@@ -25,7 +25,7 @@ public:
AddGuide(_T("sum 10800 0 @9"));
AddGuide(_T("sum @9 10800 0"));
AddGuide(_T("prod #0 9598 32768"));
AddGuide(_T(" sum 21600 0 @12"));
AddGuide(_T("sum 21600 0 @12"));
AddGuide(_T("ellipse @13 21600 10800"));
AddGuide(_T("sum 10800 0 @14"));
AddGuide(_T("sum @14 10800 0"));
......
......@@ -19,8 +19,8 @@ public:
m_arAdjustments.push_back(-5898240);
m_arAdjustments.push_back(0);
m_arAdjustments.push_back(0);
m_arAdjustments.push_back((LONG)ShapeSize);
m_arAdjustments.push_back((LONG)ShapeSize);
m_arAdjustments.push_back(43200/*ShapeSizeVML*/);//43200??
m_arAdjustments.push_back(43200/*ShapeSizeVML*/);//??43200
LoadConnectorsList(_T("0,0;21600,21600;0,21600"));
......
......@@ -850,7 +850,7 @@ void XlsConverter::convert(ODRAW::OfficeArtRecord * art)
{
ODRAW::OfficeArtClientAnchorSheet * ch = dynamic_cast<ODRAW::OfficeArtClientAnchorSheet *>(art);
xlsx_context->get_drawing_context().set_child_anchor(ch->_x, ch->_y, ch->_cx, ch->_cy);
//xlsx_context->get_drawing_context().set_child_anchor(ch->_x, ch->_y, ch->_cx, ch->_cy);
art->serialize(strm);
xlsx_context->get_drawing_context().set_sheet_anchor(strm.str());
......
......@@ -528,7 +528,6 @@ void xlsx_drawing_context::serialize_pic(_drawing_state_ptr & drawing_state, std
CP_XML_NODE(L"a:hlinkClick")
{
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"r:id", drawing_state->hyperlink);
}
......@@ -602,7 +601,6 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
CP_XML_NODE(L"c:chart")
{
CP_XML_ATTR(L"xmlns:c", L"http://schemas.openxmlformats.org/drawingml/2006/chart");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:id", rId);
}
}
......@@ -676,6 +674,11 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
CP_XML_NODE(L"xdr:cNvSpPr")
{
if (drawing_state->bTextBox)CP_XML_ATTR(L"txBox", 1);
CP_XML_NODE(L"a:spLocks")
{
CP_XML_ATTR(L"noGrp", 1);
CP_XML_ATTR(L"noChangeArrowheads", 1);
}
}
}
......@@ -710,12 +713,17 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & drawing_state)
{
std::wstring strResult;
CCustomShape * shape = CCustomShape::CreateByType(drawing_state->shape_id);
if (shape == NULL) return L"";
std::wstring strResult;
std::wstringstream strm;
shape->m_oCustomVML.SetAdjusts(&shape->m_arAdjustments);
shape->m_oCustomVML.m_bIsVerticesPresent = drawing_state->custom_verticles.empty() ? false : true;
for (int i = 0 ; i < drawing_state->custom_verticles.size(); i++)
{
Aggplus::POINT p;
......@@ -725,6 +733,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
shape->m_oCustomVML.m_arVertices.push_back(p);
}
for (int i = 0 ; i < drawing_state->custom_guides.size(); i++)
{//todooo / !!
NSCustomVML::CGuide guid;
......@@ -739,8 +748,19 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
shape->m_oCustomVML.addGuide(guid);
}
for (int i = 0 ; i < drawing_state->custom_segments.size(); i++)
{
if (0 == drawing_state->custom_segments[i].m_nCount)
{
if ((NSGuidesVML::rtEnd != drawing_state->custom_segments[i].m_eRuler) &&
(NSGuidesVML::rtNoFill != drawing_state->custom_segments[i].m_eRuler) &&
(NSGuidesVML::rtNoStroke != drawing_state->custom_segments[i].m_eRuler) &&
(NSGuidesVML::rtClose != drawing_state->custom_segments[i].m_eRuler))
{
continue;
}
}
shape->m_oCustomVML.addSegment(drawing_state->custom_segments[i].m_eRuler , drawing_state->custom_segments[i].m_nCount);
}
......@@ -751,11 +771,19 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
shape->m_oCustomVML.addAdjust(i, *drawing_state->custom_adjustValues[i]);
}
}
shape->m_oCustomVML.SetPath((NSGuidesVML::RulesType)drawing_state->custom_path);
if (drawing_state->custom_path >=0)
shape->m_oCustomVML.SetPath((NSGuidesVML::RulesType)drawing_state->custom_path);
shape->m_oCustomVML.ToCustomShape(shape, shape->m_oManager);
shape->ReCalculate();
//-------------------------------------------------------------------------------------
if (drawing_state->custom_rect.cx > 0 && drawing_state->custom_rect.cy > 0)
{
//shape->m_oManager.m_lShapeWidth = drawing_state->custom_rect.cx;
//shape->m_oManager.m_lShapeHeight = drawing_state->custom_rect.cy;
shape->m_oPath.SetCoordsize(drawing_state->custom_rect.cx, drawing_state->custom_rect.cy);
}
NSGuidesVML::CFormParam pParamCoef;
pParamCoef.m_eType = NSGuidesVML::ptValue;
......@@ -764,16 +792,6 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
NSGuidesVML::CFormulaConverter pFormulaConverter;
if (drawing_state->custom_rect.cx > 0 && drawing_state->custom_rect.cy > 0)
{
pFormulaConverter.m_lWidth = drawing_state->custom_rect.cx;
pFormulaConverter.m_lHeight = drawing_state->custom_rect.cy;
}
else
{
pFormulaConverter.m_lWidth = 21600;
pFormulaConverter.m_lHeight = 21600;
}
//coeff
pFormulaConverter.ConvertCoef(pParamCoef);
......@@ -806,36 +824,35 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
{
pFormulaConverter.ConvertHandle(shape->m_arHandles, shape->m_arAdjustments, shape->m_eType);
}
//adj----------------------------
if (pFormulaConverter.m_oAdjRes.GetSize() == 0)
strResult += _T("<a:avLst/>");
else
strResult += _T("<a:avLst>") + pFormulaConverter.m_oAdjRes.GetXmlString() + _T("</a:avLst>");
//guids--------------------------
if (pFormulaConverter.m_oGuidsRes.GetSize() == 0)
strResult += _T("<a:gdLst>") + pFormulaConverter.m_oCoef.GetXmlString() + _T("</a:gdLst>");
else
strResult += _T("<a:gdLst>") + pFormulaConverter.m_oCoef.GetXmlString() + pFormulaConverter.m_oGuidsRes.GetXmlString() + _T("</a:gdLst>");
//handles---------------------------
if (pFormulaConverter.m_oHandleRes.GetSize() == 0)
strResult += _T("<a:ahLst/>");
else
strResult += _T("<a:ahLst>") + pFormulaConverter.m_oHandleRes.GetXmlString() + _T("</a:ahLst>");
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:avLst")
{
CP_XML_STREAM() << pFormulaConverter.m_oAdjRes.GetXmlString();
}
CP_XML_NODE(L"a:gdLst")
{
CP_XML_STREAM() << pFormulaConverter.m_oCoef.GetXmlString();
CP_XML_STREAM() << pFormulaConverter.m_oGuidsRes.GetXmlString();
}
CP_XML_NODE(L"a:ahLst")
{
CP_XML_STREAM() << pFormulaConverter.m_oHandleRes.GetXmlString();
}
//connectors-------------------------
CP_XML_NODE(L"a:cxnLst");
//connectors-------------------------
strResult += _T("<a:cxnLst/>");
//textRect---------------------------
if (pFormulaConverter.m_oTextRect.GetSize() != 0)
strResult += pFormulaConverter.m_oTextRect.GetXmlString();
//path------------------------------
strResult += _T("<a:pathLst>");
strResult += pFormulaConverter.m_oPathRes.GetXmlString();
strResult += _T("</a:pathLst>");
////textRect---------------------------
//if (pFormulaConverter.m_oTextRect.GetSize() != 0)
strm << pFormulaConverter.m_oTextRect.GetXmlString();
CP_XML_NODE(L"a:pathLst")
{
CP_XML_STREAM() << pFormulaConverter.m_oPathRes.GetXmlString();
}
}
strResult = strm.str();
}
delete shape;
......@@ -1259,7 +1276,6 @@ void xlsx_drawing_context::serialize_bitmap_fill(std::wostream & stream, _drawin
{
CP_XML_NODE(L"a:blip")
{
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:embed", rId);
}
......@@ -1802,6 +1818,7 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:mc" , L"http://schemas.openxmlformats.org/markup-compatibility/2006");
for (int i = 0 ; i < drawing_states.size(); i++)
{
......
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