Commit 857b79ee authored by ElenaSubbotina's avatar ElenaSubbotina

x2t - fix smart art

parent ecba12b2
......@@ -183,9 +183,7 @@ 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 );
NSDirectory::CreateDirectory( pathWord );
WritePackage();
......@@ -204,9 +202,7 @@ 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);
int i = 1;
......@@ -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,15 +1049,19 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
if (oNodeAnchorInline.IsValid())
{
XmlUtils::CXmlNode oNodeExt;
if (oNodeAnchorInline.GetNode(L"wp:extent", 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);
XmlUtils::CXmlNode oNodeGraphic = oNodeAnchorInline.ReadNodeNoNS(L"graphic");
XmlUtils::CXmlNode oNodeGraphic = oNodeAnchorInline.ReadNodeNoNS(L"graphic");
XmlUtils::CXmlNode oNodeGraphicData = oNodeGraphic.ReadNodeNoNS(L"graphicData");
if (oNodeGraphicData.IsValid())
......@@ -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;
......@@ -2889,13 +2885,16 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (oCssStyles.m_mapSettings.end() != pPair)
margB = (unsigned long)(dKoef * parserPoint.FromString(pPair->second));
oProps.X = left;
oProps.Y = top;
oProps.Width = width;
oProps.Height = height;
oProps.X = left;
oProps.Y = top;
oProps.Width = width;
oProps.Height = height;
m_pBinaryWriter->m_lXCurShape = left;
m_pBinaryWriter->m_lYCurShape = top;
m_pBinaryWriter->m_lWidthCurShape = width;
m_pBinaryWriter->m_lHeightCurShape = height;
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)
......
......@@ -233,8 +233,8 @@ namespace NSBinPptxRW
CSeekTableEntry();
};
CCommonWriter* m_pCommon;
std::wstring m_strMainFolder;
CCommonWriter* m_pCommon;
std::wstring m_strMainFolder;
NSCommon::smart_ptr<PPTX::CCommonRels> * m_pCommonRels;
BinDocxRW::CDocxSerializer * m_pMainDocument;
......@@ -253,22 +253,25 @@ namespace NSBinPptxRW
std::vector<CSeekTableEntry> m_arMainTables;
public:
_INT32 m_lWidthCurShape;
_INT32 m_lHeightCurShape;
_INT32 m_lCxCurShape; //emu
_INT32 m_lCyCurShape;
public:
BYTE* GetBuffer();
_INT32 m_lXCurShape;
_INT32 m_lYCurShape;
BYTE* GetBuffer();
_UINT32 GetPosition();
void SetPosition(const _UINT32& lPosition);
void Skip(const _UINT32& lSize);
void SetPosition(const _UINT32& lPosition);
void Skip(const _UINT32& lSize);
double GetWidthMM();
double GetHeightMM();
void ClearShapeCurSizes();
double GetShapeWidth();
double GetShapeHeight();
double GetShapeX();
double GetShapeY();
// -------------------- stream simple types -----------------------
public:
void Clear();
void ClearCurShapePositionAndSizes();
void Clear();
void SetMainDocument(BinDocxRW::CDocxSerializer* pMainDoc);
......@@ -305,7 +308,6 @@ namespace NSBinPptxRW
void WriteDouble64 (const double& dValue);
// --------------------------------------------------------
public:
CBinaryFileWriter();
~CBinaryFileWriter();
......@@ -316,8 +318,6 @@ namespace NSBinPptxRW
void WriteReserved(size_t lCount);
void WriteMainPart();
public:
void WriteString1 (int type, const std::wstring& val);
void WriteString2 (int type, const NSCommon::nullable_string& val);
......@@ -400,14 +400,14 @@ namespace NSBinPptxRW
bool GetSafearray(BYTE **ppArray, size_t& szCount);
private:
_INT32 _WriteString(const WCHAR* sBuffer, _UINT32 lCount);
void _WriteStringWithLength(const WCHAR* sBuffer, _UINT32 lCount, bool bByte);
_INT32 _WriteString(const WCHAR* sBuffer, _UINT32 lCount);
void _WriteStringWithLength(const WCHAR* sBuffer, _UINT32 lCount, bool bByte);
};
class CSlideMasterInfo
{
public:
_INT32 m_lThemeIndex;
std::vector<LONG> m_arLayouts;
_INT32 m_lThemeIndex;
std::vector<LONG> m_arLayouts;
public:
CSlideMasterInfo();
......
......@@ -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())
{
......
......@@ -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,17 +63,17 @@ 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;
nullable<ChartRec> chartRec;
nullable<Pic> pic;
std::wstring GetVmlXmlBySpid(std::wstring & rels) const;
std::wstring GetVmlXmlBySpid(std::wstring & rels) const;
protected:
virtual void FillParentPointersForChilds();
};
......
......@@ -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