Commit 857b79ee authored by ElenaSubbotina's avatar ElenaSubbotina

x2t - fix smart art

parent ecba12b2
......@@ -183,8 +183,6 @@ namespace DocFileFormat
void WordprocessingDocument::SaveDocument()
{
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ;
//OOX::CPath pathWord = CString(m_strOutputPath) + FILE_SEPARATOR_STR + L"word" );
//FileSystem::Directory::CreateDirectory( pathWord.GetPath() );
NSDirectory::CreateDirectory( pathWord );
WritePackage();
......@@ -204,8 +202,6 @@ namespace DocFileFormat
if (!ImagesList.empty())
{
std::wstring pathMedia = pathWord + FILE_SEPARATOR_STR + L"media";
//OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + L"media";
//FileSystem::Directory::CreateDirectory( pathMedia.GetPath() );
NSDirectory::CreateDirectory(pathMedia);
......@@ -237,8 +233,6 @@ namespace DocFileFormat
if (!OleObjectsList.empty())
{
std::wstring pathObjects = pathWord + FILE_SEPARATOR_STR + L"embeddings" ;
//OOX::CPath pathObjects = pathWord + FILE_SEPARATOR_STR + L"embeddings" ;
//FileSystem::Directory::CreateDirectory( pathObjects.GetPath());
NSDirectory::CreateDirectory( pathObjects );
int i = 1;
......
......@@ -43,11 +43,11 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_MSC_VER=1800"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
......@@ -402,6 +402,58 @@
/>
</FileConfiguration>
</File>
<Filter
Name="oox"
>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\ChartFromToBinary.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\ChartWriter.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Common\Common.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\CommonWriter.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\CSVReader.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Writer\CSVWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\DocxSerializer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
......
......@@ -1023,10 +1023,8 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
if (!oMainNode.GetNodes(L"*", oNodes))
return NULL;
//ULONG lCurrentPosition = m_pBinaryWriter->GetPosition();
m_pBinaryWriter->StartRecord(0);
m_pBinaryWriter->ClearShapeCurSizes();
m_pBinaryWriter->ClearCurShapePositionAndSizes();
LONG lCount = oNodes.GetCount();
for (LONG i = 0; i < lCount; ++i)
......@@ -1051,10 +1049,14 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
if (oNodeAnchorInline.IsValid())
{
XmlUtils::CXmlNode oNodeExt;
m_pBinaryWriter->m_lXCurShape = 0;
m_pBinaryWriter->m_lYCurShape = 0;
if (oNodeAnchorInline.GetNode(L"wp:extent", oNodeExt))
{
m_pBinaryWriter->m_lWidthCurShape = oNodeExt.ReadAttributeInt(L"cx");
m_pBinaryWriter->m_lHeightCurShape = oNodeExt.ReadAttributeInt(L"cy");
m_pBinaryWriter->m_lCxCurShape = oNodeExt.ReadAttributeInt(L"cx");
m_pBinaryWriter->m_lCyCurShape = oNodeExt.ReadAttributeInt(L"cy");
}
SendMainProps(oNodeAnchorInline.GetXml(), pMainProps);
......@@ -1083,11 +1085,12 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
else if (L"wpc:wpc" == oNodeContent.GetName())
{
PPTX::Logic::SpTree* pTree = new PPTX::Logic::SpTree();
pTree->grpSpPr.xfrm = new PPTX::Logic::Xfrm();
pTree->grpSpPr.xfrm->offX = 0;
pTree->grpSpPr.xfrm->offY = 0;
pTree->grpSpPr.xfrm->extX = m_pBinaryWriter->m_lWidthCurShape;
pTree->grpSpPr.xfrm->extY = m_pBinaryWriter->m_lHeightCurShape;
pTree->grpSpPr.xfrm->offX = m_pBinaryWriter->m_lXCurShape;
pTree->grpSpPr.xfrm->offY = m_pBinaryWriter->m_lYCurShape;
pTree->grpSpPr.xfrm->extX = m_pBinaryWriter->m_lCxCurShape;
pTree->grpSpPr.xfrm->extY = m_pBinaryWriter->m_lCyCurShape;
pTree->fromXML(oNodeContent);
oElem.InitElem(pTree);
......@@ -1104,7 +1107,7 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
if (!oElem.is_init())
{
std::wstring strXFRM = L"<a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"" +
std::to_wstring(m_pBinaryWriter->m_lWidthCurShape) + L"\" cy=\"" + std::to_wstring(m_pBinaryWriter->m_lHeightCurShape) + L"\"/></a:xfrm>";
std::to_wstring(m_pBinaryWriter->m_lCxCurShape) + L"\" cy=\"" + std::to_wstring(m_pBinaryWriter->m_lCyCurShape) + L"\"/></a:xfrm>";
std::wstring strUnsupported = L"<wps:wsp \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
......@@ -1366,9 +1369,6 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
pDiagramData = dynamic_cast<OOX::CDiagramData*>(oFileData.operator->());
if (pDiagramData)
{
m_strCurrentRelsPath = pDiagramData->m_strFilename;
SetCurrentRelsPath();
for (int i = 0; (pDiagramData->m_oExtLst.IsInit()) && i < pDiagramData->m_oExtLst->m_arrExt.size(); i++)
{
if (pDiagramData->m_oExtLst->m_arrExt[i]->m_oDataModelExt.IsInit())
......@@ -1379,9 +1379,9 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
}
}
}
if (id_drawing.is_init())
{
oFileDrawing = (*m_pBinaryWriter->m_pCommonRels)->Find(*id_drawing);
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
}
if (!pDiagramDrawing)
......@@ -1401,7 +1401,7 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
if (pDiagramDrawing)
{
result->InitElem(pDiagramDrawing->m_oShapeTree.operator->());
result->InitElem(new PPTX::Logic::SpTree(*pDiagramDrawing->m_oShapeTree));
}
else
{//BG-FSC1.docx
......@@ -1414,33 +1414,26 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
{
_pElem.grpSpPr.xfrm = new PPTX::Logic::Xfrm();
_pElem.grpSpPr.xfrm->offX = (int)0;
_pElem.grpSpPr.xfrm->offY = (int)0;
_pElem.grpSpPr.xfrm->extX = m_pBinaryWriter->m_lWidthCurShape;
_pElem.grpSpPr.xfrm->extY = m_pBinaryWriter->m_lHeightCurShape;
_pElem.grpSpPr.xfrm->offX = m_pBinaryWriter->m_lXCurShape;
_pElem.grpSpPr.xfrm->offY = m_pBinaryWriter->m_lYCurShape;
_pElem.grpSpPr.xfrm->extX = m_pBinaryWriter->m_lCxCurShape;
_pElem.grpSpPr.xfrm->extY = m_pBinaryWriter->m_lCyCurShape;
_pElem.grpSpPr.xfrm->chOffX = (int)0;
_pElem.grpSpPr.xfrm->chOffY = (int)0;
_pElem.grpSpPr.xfrm->chExtX = m_pBinaryWriter->m_lWidthCurShape;
_pElem.grpSpPr.xfrm->chExtY = m_pBinaryWriter->m_lHeightCurShape;
_pElem.grpSpPr.xfrm->chExtX = m_pBinaryWriter->m_lCxCurShape;
_pElem.grpSpPr.xfrm->chExtY = m_pBinaryWriter->m_lCyCurShape;
}
else
{
if (!_pElem.grpSpPr.xfrm->offX.is_init())
_pElem.grpSpPr.xfrm->offX = (int)0;
if (!_pElem.grpSpPr.xfrm->offY.is_init())
_pElem.grpSpPr.xfrm->offY = (int)0;
if (!_pElem.grpSpPr.xfrm->extX.is_init())
_pElem.grpSpPr.xfrm->extX = m_pBinaryWriter->m_lWidthCurShape;
if (!_pElem.grpSpPr.xfrm->extY.is_init())
_pElem.grpSpPr.xfrm->extY = m_pBinaryWriter->m_lHeightCurShape;
if (!_pElem.grpSpPr.xfrm->chOffX.is_init())
_pElem.grpSpPr.xfrm->chOffX = (int)0;
if (!_pElem.grpSpPr.xfrm->chOffY.is_init())
_pElem.grpSpPr.xfrm->chOffY = (int)0;
if (!_pElem.grpSpPr.xfrm->chExtX.is_init())
_pElem.grpSpPr.xfrm->chExtX = m_pBinaryWriter->m_lWidthCurShape;
if (!_pElem.grpSpPr.xfrm->chExtY.is_init())
_pElem.grpSpPr.xfrm->chExtY = m_pBinaryWriter->m_lHeightCurShape;
if (!_pElem.grpSpPr.xfrm->offX.is_init()) _pElem.grpSpPr.xfrm->offX = m_pBinaryWriter->m_lXCurShape;
if (!_pElem.grpSpPr.xfrm->offY.is_init()) _pElem.grpSpPr.xfrm->offY = m_pBinaryWriter->m_lYCurShape;
if (!_pElem.grpSpPr.xfrm->extX.is_init()) _pElem.grpSpPr.xfrm->extX = m_pBinaryWriter->m_lCxCurShape;
if (!_pElem.grpSpPr.xfrm->extY.is_init()) _pElem.grpSpPr.xfrm->extY = m_pBinaryWriter->m_lCyCurShape;
if (!_pElem.grpSpPr.xfrm->chOffX.is_init()) _pElem.grpSpPr.xfrm->chOffX = (int)0;
if (!_pElem.grpSpPr.xfrm->chOffY.is_init()) _pElem.grpSpPr.xfrm->chOffY = (int)0;
if (!_pElem.grpSpPr.xfrm->chExtX.is_init()) _pElem.grpSpPr.xfrm->chExtX = m_pBinaryWriter->m_lCxCurShape;
if (!_pElem.grpSpPr.xfrm->chExtY.is_init()) _pElem.grpSpPr.xfrm->chExtY = m_pBinaryWriter->m_lCyCurShape;
}
}
......@@ -2482,8 +2475,11 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
}
else
{
m_pBinaryWriter->m_lWidthCurShape = 0;
m_pBinaryWriter->m_lHeightCurShape = 0;
m_pBinaryWriter->m_lXCurShape = 0;
m_pBinaryWriter->m_lYCurShape = 0;
m_pBinaryWriter->m_lCxCurShape = 0;
m_pBinaryWriter->m_lCyCurShape = 0;
pShape->spPr.xfrm = new PPTX::Logic::Xfrm();
pShape->spPr.xfrm->offX = oProps.X;
......@@ -2894,8 +2890,11 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
oProps.Width = width;
oProps.Height = height;
m_pBinaryWriter->m_lWidthCurShape = width;
m_pBinaryWriter->m_lHeightCurShape = height;
m_pBinaryWriter->m_lXCurShape = left;
m_pBinaryWriter->m_lYCurShape = top;
m_pBinaryWriter->m_lCxCurShape = width;
m_pBinaryWriter->m_lCyCurShape = height;
if (bIsInline)
{
......
......@@ -423,22 +423,33 @@ namespace NSBinPptxRW
m_lPosition += lSize;
m_pStreamCur = m_pStreamData + m_lPosition;
}
double CBinaryFileWriter::GetWidthMM()
double CBinaryFileWriter::GetShapeHeight()
{
if (m_lWidthCurShape == 0)
if (m_lCyCurShape == 0)
return -1;
return (double)m_lWidthCurShape / 36000;
return (double)m_lCyCurShape / 36000; //mm
}
double CBinaryFileWriter::GetHeightMM()
double CBinaryFileWriter::GetShapeWidth()
{
if (m_lHeightCurShape == 0)
if (m_lCyCurShape == 0)
return -1;
return (double)m_lHeightCurShape / 36000;
return (double)m_lCxCurShape / 36000;
}
void CBinaryFileWriter::ClearShapeCurSizes()
double CBinaryFileWriter::GetShapeY()
{
m_lWidthCurShape = 0;
m_lHeightCurShape = 0;
return (double)m_lYCurShape / 36000;
}
double CBinaryFileWriter::GetShapeX()
{
return (double)m_lXCurShape / 36000; //mm
}
void CBinaryFileWriter::ClearCurShapePositionAndSizes()
{
m_lXCurShape = 0;
m_lYCurShape = 0;
m_lCxCurShape = 0;
m_lCyCurShape = 0;
}
void CBinaryFileWriter::Clear()
{
......@@ -451,8 +462,11 @@ namespace NSBinPptxRW
m_lStackPosition = 0;
memset(m_arStack, 0, MAX_STACK_SIZE * sizeof(_UINT32));
m_lWidthCurShape = 0;
m_lHeightCurShape = 0;
m_lCxCurShape = 0;
m_lCyCurShape = 0;
m_lXCurShape = 0;
m_lYCurShape = 0;
}
void CBinaryFileWriter::SetMainDocument(BinDocxRW::CDocxSerializer* pMainDoc)
......
......@@ -253,21 +253,24 @@ namespace NSBinPptxRW
std::vector<CSeekTableEntry> m_arMainTables;
public:
_INT32 m_lWidthCurShape;
_INT32 m_lHeightCurShape;
_INT32 m_lCxCurShape; //emu
_INT32 m_lCyCurShape;
_INT32 m_lXCurShape;
_INT32 m_lYCurShape;
public:
BYTE* GetBuffer();
_UINT32 GetPosition();
void SetPosition(const _UINT32& lPosition);
void Skip(const _UINT32& lSize);
double GetWidthMM();
double GetHeightMM();
void ClearShapeCurSizes();
double GetShapeWidth();
double GetShapeHeight();
double GetShapeX();
double GetShapeY();
void ClearCurShapePositionAndSizes();
// -------------------- stream simple types -----------------------
public:
void Clear();
void SetMainDocument(BinDocxRW::CDocxSerializer* pMainDoc);
......@@ -305,7 +308,6 @@ namespace NSBinPptxRW
void WriteDouble64 (const double& dValue);
// --------------------------------------------------------
public:
CBinaryFileWriter();
~CBinaryFileWriter();
......@@ -317,8 +319,6 @@ namespace NSBinPptxRW
void WriteMainPart();
public:
void WriteString1 (int type, const std::wstring& val);
void WriteString2 (int type, const NSCommon::nullable_string& val);
void WriteString (const std::wstring& val);
......
......@@ -125,16 +125,17 @@ namespace PPTX
pWriter->EndRecord();
double dX = 0;
double dY = 0;
double dW = pWriter->GetWidthMM();
double dH = pWriter->GetHeightMM();
double dX = pWriter->GetShapeX(); //mm
double dY = pWriter->GetShapeY();
double dW = pWriter->GetShapeWidth(); //mm
double dH = pWriter->GetShapeHeight();
FileContainer* pRels = NULL;
if (pWriter->m_pCommonRels->is_init())
pRels = pWriter->m_pCommonRels->operator ->();
std::wstring olePath;
if(!oleFilepathBin.empty())
{
......
......@@ -65,7 +65,7 @@ namespace PPTX
void GraphicFrame::fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes))
if (node.GetNodes(L"*", oNodes))
{
int count = oNodes.GetCount();
for (int i = 0; i < count; ++i)
......@@ -73,75 +73,78 @@ namespace PPTX
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
std::wstring strNamespace = XmlUtils::GetNamespace(oNode.GetName());
if (_T("xfrm") == strName)
if (L"xfrm" == strName && strNamespace != L"xdr")
xfrm = oNode;
else if (_T("nvGraphicFramePr") == strName)
else if (L"nvGraphicFramePr" == strName)
nvGraphicFramePr = oNode;
if (_T("graphic") == strName)
if (L"graphic" == strName)
{
XmlUtils::CXmlNode oNodeData;
if (oNode.GetNode(_T("a:graphicData"), oNodeData))
if (oNode.GetNode(L"a:graphicData", oNodeData))
{
XmlUtils::CXmlNode oNode1 = oNodeData.ReadNodeNoNS(_T("tbl"));
XmlUtils::CXmlNode oNode1 = oNodeData.ReadNodeNoNS(L"tbl");
if (oNode1.IsValid())
{
table = oNode1;
return;
}
XmlUtils::CXmlNode oNode2 = oNodeData.ReadNodeNoNS(_T("oleObj"));
XmlUtils::CXmlNode oNode2 = oNodeData.ReadNodeNoNS(L"oleObj");
if (oNode2.IsValid())
{
oNode2.ReadAttributeBase(L"spid", spid);
pic = oNode2.ReadNode(_T("p:pic"));
pic = oNode2.ReadNode(L"p:pic");
if (pic.is_init())
{
pic->fromXMLOle(oNode2);
xfrm.Merge(pic->spPr.xfrm);
if (xfrm.IsInit())
xfrm->Merge(pic->spPr.xfrm);
}
}
XmlUtils::CXmlNode oNode3 = oNodeData.ReadNodeNoNS(_T("AlternateContent"));
XmlUtils::CXmlNode oNode3 = oNodeData.ReadNodeNoNS(L"AlternateContent");
if (oNode3.IsValid())
{
XmlUtils::CXmlNode oNodeC;
if (oNode3.GetNode(_T("mc:Choice"), oNodeC))
if (oNode3.GetNode(L"mc:Choice", oNodeC))
{
XmlUtils::CXmlNode oNodeO;
if (oNodeC.GetNode(_T("p:oleObj"), oNodeO))
if (oNodeC.GetNode(L"p:oleObj", oNodeO))
{
oNodeO.ReadAttributeBase(L"spid", spid);
}
}
XmlUtils::CXmlNode oNodeFallback;
if (oNode3.GetNode(_T("mc:Fallback"), oNodeFallback))
if (oNode3.GetNode(L"mc:Fallback", oNodeFallback))
{
XmlUtils::CXmlNode oNodeO;
if (oNodeFallback.GetNode(_T("p:oleObj"), oNodeO))
if (oNodeFallback.GetNode(L"p:oleObj", oNodeO))
{
pic = oNodeO.ReadNode(_T("p:pic"));
pic = oNodeO.ReadNode(L"p:pic");
if (pic.is_init())
{
pic->fromXMLOle(oNode2);
xfrm.Merge(pic->spPr.xfrm);
if (xfrm.IsInit())
xfrm->Merge(pic->spPr.xfrm);
}
}
}
}
XmlUtils::CXmlNode oNode4 = oNodeData.ReadNode(_T("dgm:relIds"));
XmlUtils::CXmlNode oNode4 = oNodeData.ReadNode(L"dgm:relIds");
if (oNode4.IsValid())
{
smartArt = oNode4;
}
XmlUtils::CXmlNode oNode5 = oNodeData.ReadNode(_T("c:chart"));
XmlUtils::CXmlNode oNode5 = oNodeData.ReadNode(L"c:chart");
if (oNode5.IsValid())
{
chartRec = oNode5;
}
XmlUtils::CXmlNode oNode6 = oNodeData.ReadNode(_T("com:legacyDrawing"));
XmlUtils::CXmlNode oNode6 = oNodeData.ReadNode(L"com:legacyDrawing");
if (oNode6.IsValid())
{
oNode6.ReadAttributeBase(L"spid", spid);
......@@ -156,50 +159,53 @@ namespace PPTX
void GraphicFrame::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring strNS = _T("");
std::wstring strNS = L"";
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX && pWriter->m_lGroupIndex >= 0)
{
pWriter->StartNode(_T("wpg:graphicFrame"));
strNS = _T("wpg");
pWriter->StartNode(L"wpg:graphicFrame");
strNS = L"wpg";
}
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX && pWriter->m_lGroupIndex >= 0)
{
pWriter->StartNode(_T("xdr:graphicFrame"));
strNS = _T("xdr");
pWriter->StartNode(L"xdr:graphicFrame");
strNS = L"xdr";
}
else
{
pWriter->StartNode(_T("p:graphicFrame"));
pWriter->StartNode(L"p:graphicFrame");
}
pWriter->EndAttributes();
nvGraphicFramePr.toXmlWriter(pWriter);
if (strNS == _T(""))
xfrm.toXmlWriter(pWriter);
if (xfrm.IsInit())
{
if (strNS.empty())
xfrm->toXmlWriter(pWriter);
else
xfrm.toXmlWriter2(strNS, pWriter);
xfrm->toXmlWriter2(strNS, pWriter);
}
if (table.is_init())
{
pWriter->WriteString(_T("<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/table\">"));
table->toXmlWriter(pWriter);
pWriter->WriteString(_T("</a:graphicData></a:graphic>"));
pWriter->WriteString (L"<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/table\">");
table->toXmlWriter (pWriter);
pWriter->WriteString (L"</a:graphicData></a:graphic>");
}
else if (chartRec.is_init())
{
pWriter->WriteString(_T("<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\">"));
pWriter->WriteString(L"<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\">");
chartRec->toXmlWriter(pWriter);
pWriter->WriteString(_T("</a:graphicData></a:graphic>"));
pWriter->WriteString(L"</a:graphicData></a:graphic>");
}
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX && pWriter->m_lGroupIndex >= 0)
pWriter->EndNode(_T("wpg:graphicFrame"));
pWriter->EndNode(L"wpg:graphicFrame");
else if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX && pWriter->m_lGroupIndex >= 0)
pWriter->EndNode(_T("xdr:graphicFrame"));
pWriter->EndNode(L"xdr:graphicFrame");
else
pWriter->EndNode(_T("p:graphicFrame"));
pWriter->EndNode(L"p:graphicFrame");
}
void GraphicFrame::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......@@ -219,6 +225,7 @@ namespace PPTX
{
xml_object_vml = GetVmlXmlBySpid(xml_object_rels);
}
if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !spid.is_init())
{
smartArt->LoadDrawing(pWriter);
......@@ -228,14 +235,20 @@ namespace PPTX
smartArt->m_diag->nvGrpSpPr.nvPr = nvGraphicFramePr.nvPr;
bool bIsInitCoords = false;
if (smartArt->m_diag->grpSpPr.xfrm.is_init())
if (smartArt->m_diag->grpSpPr.xfrm.IsInit())
{
bIsInitCoords = true;
else
}
else if (xfrm.IsInit())
{
smartArt->m_diag->grpSpPr.xfrm = new PPTX::Logic::Xfrm();
}
PPTX::Logic::Xfrm* dst = smartArt->m_diag->grpSpPr.xfrm.GetPointer();
const PPTX::Logic::Xfrm* src = &xfrm;
PPTX::Logic::Xfrm* src = xfrm.GetPointer();
if (dst && src)
{
dst->offX = src->offX;
dst->offY = src->offY;
dst->extX = src->extX;
......@@ -252,7 +265,7 @@ namespace PPTX
dst->flipH = src->flipH;
dst->flipV = src->flipV;
dst->rot = src->rot;
}
//удалим индекс плейсхолдера если он есть(p:nvPr) - он будет лишний так как будет имплементация объекта
if (smartArt->m_diag->nvGrpSpPr.nvPr.ph.IsInit())
{
......@@ -269,7 +282,7 @@ namespace PPTX
if (!table.is_init() && !chartRec.is_init() && xml_object_vml.empty() == false)
{
std::wstring temp = _T("<v:object>");
std::wstring temp = L"<v:object>";
temp += xml_object_vml;
temp += L"</v:object>";
......@@ -282,7 +295,7 @@ namespace PPTX
std::wstring *main_props = NULL;
oDrawingConverter.SetRelsPath(xml_object_rels);
oDrawingConverter.SetAdditionalParam(_T("xfrm_override"), (BYTE*)&xfrm, sizeof(xfrm));
oDrawingConverter.SetAdditionalParam(L"xfrm_override", (BYTE*)&xfrm, sizeof(xfrm));
HRESULT hRes = oDrawingConverter.AddObject(temp, &main_props);
if (hRes == S_OK && oDrawingConverter.m_pBinaryWriter->GetPosition() > 10)
......@@ -299,7 +312,7 @@ namespace PPTX
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord1(0, nvGraphicFramePr);
pWriter->WriteRecord1(1, xfrm);
pWriter->WriteRecord2(1, xfrm);
pWriter->WriteRecord2(2, table);
if (chartRec.is_init())
......@@ -350,8 +363,9 @@ namespace PPTX
}
case 1:
{
xfrm.fromPPTY(pReader);
xfrm.m_ns = _T("p");
xfrm = new Logic::Xfrm();
xfrm->fromPPTY(pReader);
xfrm->m_ns = L"p";
break;
}
case 2:
......@@ -375,10 +389,13 @@ namespace PPTX
void GraphicFrame::GetRect(Aggplus::RECT& pRect)const
{
pRect.left = xfrm.offX.get();
pRect.top = xfrm.offY.get();
pRect.right = pRect.left + xfrm.extX.get();
pRect.bottom = pRect.top + xfrm.extY.get();
if (xfrm.IsInit() == false) return;
pRect.left = xfrm->offX.get();
pRect.top = xfrm->offY.get();
pRect.right = pRect.left + xfrm->extX.get();
pRect.bottom = pRect.top + xfrm->extY.get();
if(parentIs<Logic::SpTree>())
parentAs<Logic::SpTree>().NormalizeRect(pRect);
......@@ -407,13 +424,15 @@ namespace PPTX
// );
//}
//return node;
return _T("");
return L"";
}
void GraphicFrame::FillParentPointersForChilds()
{
xfrm.SetParentPointer(this);
nvGraphicFramePr.SetParentPointer(this);
if (xfrm.IsInit())
xfrm->SetParentPointer(this);
if(table.IsInit())
table->SetParentPointer(this);
if (smartArt.is_init())
......@@ -439,20 +458,20 @@ namespace PPTX
std::wstring GraphicFrame::GetVmlXmlBySpid(std::wstring & rels)const
{
std::wstring xml;
rels = _T("");
rels = L"";
if(parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
{
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(spid.get_value_or(_T("")));
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(spid.get_value_or(L""));
rels = parentFileAs<PPTX::Slide>().Vml->GetReadPath().GetPath();
}
else if(parentFileIs<PPTX::SlideLayout>() && parentFileAs<PPTX::SlideLayout>().Vml.IsInit())
{
xml= parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(spid.get_value_or(_T("")));
xml= parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(spid.get_value_or(L""));
rels = parentFileAs<PPTX::SlideLayout>().Vml->GetReadPath().GetPath();
}
else if(parentFileIs<PPTX::SlideMaster>() && parentFileAs<PPTX::SlideMaster>().Vml.IsInit())
{
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(spid.get_value_or(_T("")));
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(spid.get_value_or(L""));
rels = parentFileAs<PPTX::SlideMaster>().Vml->GetReadPath().GetPath();
}
......
......@@ -54,7 +54,6 @@ namespace PPTX
explicit GraphicFrame(XmlUtils::CXmlNode& node);
const GraphicFrame& operator =(XmlUtils::CXmlNode& node);
public:
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
virtual void GetRect(Aggplus::RECT& pRect)const;
......@@ -64,10 +63,10 @@ namespace PPTX
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
public:
NvGraphicFramePr nvGraphicFramePr;
Xfrm xfrm;
nullable<Xfrm> xfrm;
nullable_string spid;
nullable<Table> table;
nullable<SmartArt> smartArt;
......
......@@ -116,7 +116,7 @@ namespace PPTX
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
}
if (pDiagramDrawing)
if ((pDiagramDrawing) && (pDiagramDrawing->m_oShapeTree.IsInit()))
{
m_diag = pDiagramDrawing->m_oShapeTree;
m_oCommonRels = smart_ptr<PPTX::CCommonRels>(dynamic_cast<PPTX::CCommonRels*>(pDiagramDrawing));
......
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="XlsXlsxConverter"
ProjectGUID="{CBEDD0D1-10A8-45C1-AF81-8492F40964CA}"
RootNamespace="XlsXlsxConverter"
......
......@@ -257,7 +257,6 @@ HEADERS += docxformatlib.h \
../Source/XlsxFormat/Workbook.h \
../Source/XlsxFormat/WritingElement.h \
../Source/XlsxFormat/Xlsx.h \
../Source/XML/StringWriter.h \
../Source/XML/Utils.h \
../Source/XML/XmlSimple.h \
../Source/DocxFormat/Drawing/DrawingShapeElements.h \
......
......@@ -216,7 +216,7 @@ namespace OOX
XmlUtils::CXmlNode oNode;
if ( oNode.FromXmlFile2( oRelsPath.GetPath() ) && _T("Relationships") == oNode.GetName() )
if ( oNode.FromXmlFile( oRelsPath.GetPath() ) && _T("Relationships") == oNode.GetName() )
{
XmlUtils::CXmlNodes oNodes;
if ( oNode.GetNodes( _T("Relationship"), oNodes ) )
......
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