mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
add chart drawing conversion
This commit is contained in:
@ -179,6 +179,36 @@ void MsoDrawing::prepareComment(const unsigned int CommentId)
|
||||
}
|
||||
}
|
||||
|
||||
void MsoDrawing::prepareChart(const unsigned int chartId, const unsigned int xPos, const unsigned int xOffset,
|
||||
const unsigned int yPos, const unsigned int yOffset)
|
||||
{
|
||||
|
||||
auto fdgPtr = new ODRAW::OfficeArtFDG;
|
||||
fdgPtr->rh_own.recInstance = chartId;
|
||||
fdgPtr->csp = 1;
|
||||
fdgPtr->spidCur = chartId;
|
||||
rgChildRec.m_OfficeArtFDG = ODRAW::OfficeArtRecordPtr(fdgPtr);
|
||||
|
||||
auto spgrContainer = new ODRAW::OfficeArtSpgrContainer(ODRAW::OfficeArtRecord::CA_Chart);
|
||||
rgChildRec.m_OfficeArtSpgrContainer = ODRAW::OfficeArtRecordPtr(spgrContainer);
|
||||
|
||||
auto SpContainer = new ODRAW::OfficeArtSpContainer(ODRAW::OfficeArtRecord::CA_Chart);
|
||||
spgrContainer->m_OfficeArtSpgrContainerFileBlock.push_back(ODRAW::OfficeArtContainerPtr(SpContainer));
|
||||
auto groupFSPGR = new ODRAW::OfficeArtFSPGR;
|
||||
groupFSPGR->xLeft = xPos;
|
||||
groupFSPGR->xRight = xOffset;
|
||||
groupFSPGR->yTop = yPos;
|
||||
groupFSPGR->yBottom = yOffset;
|
||||
SpContainer->m_OfficeArtFSPGR = ODRAW::OfficeArtRecordPtr(groupFSPGR);
|
||||
|
||||
auto fsprPtr = new ODRAW::OfficeArtFSP;
|
||||
SpContainer->m_OfficeArtFSP = ODRAW::OfficeArtRecordPtr(fsprPtr);
|
||||
fsprPtr->shape_id = 0;
|
||||
fsprPtr->spid = chartId;
|
||||
fsprPtr->fGroup = true;
|
||||
fsprPtr->fPatriarch = true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -62,6 +62,8 @@ public:
|
||||
virtual void useContinueRecords (CFRecord& record);
|
||||
|
||||
void prepareComment (const unsigned int CommentId);
|
||||
void prepareChart (const unsigned int chartId, const unsigned int xPos, const unsigned int xOffset,
|
||||
const unsigned int yPos, const unsigned int yOffset );
|
||||
|
||||
//-----------------------------
|
||||
ODRAW::OfficeArtDgContainer rgChildRec;
|
||||
|
||||
@ -31,8 +31,11 @@
|
||||
*/
|
||||
|
||||
#include "Drawing.h"
|
||||
#include "Pos.h"
|
||||
#include "../../../MsBinaryFile/XlsFile/Format/Binary/CFStreamCacheWriter.h"
|
||||
#include "../../../MsBinaryFile/XlsFile/Format/Logic/ChartSheetSubstream.h"
|
||||
#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_unions/OBJECTS.h"
|
||||
#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/MsoDrawing.h"
|
||||
#include "../../PPTXFormat/Logic/Shape.h"
|
||||
#include "../Chart/Chart.h"
|
||||
|
||||
@ -255,12 +258,29 @@ namespace OOX
|
||||
void CDrawing::toXLSChart(XLS::BaseObjectPtr chartStreamPtr)
|
||||
{
|
||||
auto ptr = static_cast<XLS::ChartSheetSubstream*>(chartStreamPtr.get());
|
||||
auto drawingObjectsPtr = new XLS::OBJECTS(true);
|
||||
ptr->m_OBJECTS = XLS::BaseObjectPtr(drawingObjectsPtr);
|
||||
auto drawingPtr = new XLS::MsoDrawing(true);
|
||||
drawingObjectsPtr->m_arrObject.emplace_back(XLS::BaseObjectPtr(drawingPtr), std::vector<XLS::BaseObjectPtr>());
|
||||
//test
|
||||
for(auto anchor : m_arrItems)
|
||||
{
|
||||
if(anchor->m_oElement.IsInit())
|
||||
{
|
||||
auto anchorElem = anchor->m_oElement->GetElem();
|
||||
auto graphicFrame = static_cast<PPTX::Logic::GraphicFrame*>(anchorElem.GetPointer());
|
||||
{
|
||||
auto xStart = 0 , xOff = 0, yStart = 0, yOff = 0;
|
||||
if(anchor->m_oPos.IsInit() && anchor->m_oPos->m_oX.IsInit())
|
||||
xStart = anchor->m_oPos->m_oX->GetValue();
|
||||
if(anchor->m_oPos.IsInit() && anchor->m_oPos->m_oY.IsInit())
|
||||
yStart = anchor->m_oPos->m_oY->GetValue();
|
||||
if(graphicFrame->xfrm.IsInit() && graphicFrame->xfrm->chOffX.IsInit())
|
||||
xOff = graphicFrame->xfrm->chOffX.get();
|
||||
if(graphicFrame->xfrm.IsInit() && graphicFrame->xfrm->chOffY.IsInit())
|
||||
yOff = graphicFrame->xfrm->chOffY.get();
|
||||
drawingPtr->prepareChart(1, xStart, xOff, yStart, yOff);
|
||||
}
|
||||
if(graphicFrame->chartRec.IsInit() && graphicFrame->chartRec->id_data.IsInit())
|
||||
{
|
||||
auto chartRid = graphicFrame->chartRec->id_data.get();
|
||||
|
||||
Reference in New Issue
Block a user