mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
fix surface conversion
This commit is contained in:
@ -57,7 +57,7 @@ public:
|
||||
int serialize(std::wostream & _stream);
|
||||
|
||||
//-----------------------------
|
||||
bool fFillSurface = false;
|
||||
bool fFillSurface = true;
|
||||
bool f3DPhongShade = false;
|
||||
};
|
||||
|
||||
|
||||
@ -5851,6 +5851,64 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\"");
|
||||
writer.WriteString(sNodeName);
|
||||
writer.WriteString(L">");
|
||||
}
|
||||
XLS::BaseObjectPtr CT_SurfaceSer::GetXLSFormat(const _UINT32 chartIndex)const
|
||||
{
|
||||
auto seriesFormat = new XLS::SERIESFORMAT;
|
||||
{
|
||||
auto ai1 = new XLS::BRAI;
|
||||
seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai1));
|
||||
}
|
||||
auto series = new XLS::Series;
|
||||
series->sdtX = 1;
|
||||
if(m_val != nullptr && m_val->m_numRef != nullptr)
|
||||
{
|
||||
if(m_val->m_numRef->m_numCache != nullptr)
|
||||
{
|
||||
series->cValx = m_val->m_numRef->m_numCache->m_pt.size();
|
||||
series->cValy = m_val->m_numRef->m_numCache->m_pt.size();
|
||||
}
|
||||
{
|
||||
auto ai2 = new XLS::BRAI;
|
||||
ai2->id = 1;
|
||||
if(m_val->m_numRef->m_f.IsInit())
|
||||
{
|
||||
ai2->rt = 2;
|
||||
ai2->formula.parseStringFormula(m_val->m_numRef->m_f.get(), L"");
|
||||
}
|
||||
seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai2));
|
||||
auto ai3 = new XLS::BRAI;
|
||||
ai3->id = 2;
|
||||
auto ai4 = new XLS::BRAI;
|
||||
ai4->id = 3;
|
||||
seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai3));
|
||||
seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai4));
|
||||
}
|
||||
}
|
||||
auto SeriesStyle = new XLS::SS;
|
||||
seriesFormat->m_arPtSS.push_back(XLS::BaseObjectPtr(SeriesStyle));
|
||||
{
|
||||
auto dataFormat = new XLS::DataFormat;
|
||||
SeriesStyle->m_DataFormat = XLS::BaseObjectPtr(dataFormat);
|
||||
if(m_order.IsInit())
|
||||
dataFormat->iss = m_order.get();
|
||||
if(m_idx.IsInit())
|
||||
dataFormat->yi = m_idx.get();
|
||||
|
||||
}
|
||||
if(m_spPr.IsInit())
|
||||
{
|
||||
if(m_spPr->ln.IsInit())
|
||||
SeriesStyle->m_LineFormat = m_spPr->ln->toXLS();
|
||||
if(m_spPr->Fill.is_init())
|
||||
SeriesStyle->m_AreaFormat = m_spPr->Fill.toXLS();
|
||||
}
|
||||
seriesFormat->m_Series = XLS::BaseObjectPtr(series);
|
||||
auto ser2Crt = new XLS::SerToCrt;
|
||||
ser2Crt->id = chartIndex;
|
||||
seriesFormat->m_SerToCrt = XLS::BaseObjectPtr(ser2Crt);
|
||||
|
||||
return XLS::BaseObjectPtr(seriesFormat);
|
||||
}
|
||||
EElementType CT_SurfaceSer::getType() { return et_ct_surfaceser; }
|
||||
|
||||
CT_BandFmt::CT_BandFmt()
|
||||
@ -5974,6 +6032,24 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\"");
|
||||
writer.WriteString(sNodeName);
|
||||
writer.WriteString(L">");
|
||||
}
|
||||
XLS::BaseObjectPtr CT_SurfaceChart::toXLS(const unsigned short chartIndex, XLS::BaseObjectPtr ChartFormats)
|
||||
{
|
||||
auto ChartFormatsPtr = static_cast<XLS::CHARTFORMATS*>(ChartFormats.get());
|
||||
for(auto ser : m_ser)
|
||||
{
|
||||
if(ser != nullptr)
|
||||
{
|
||||
ChartFormatsPtr->m_arSERIESFORMAT.push_back(ser->GetXLSFormat(chartIndex));
|
||||
}
|
||||
}
|
||||
auto ptr = new XLS::CRT;
|
||||
auto chartFormat = new XLS::ChartFormat;
|
||||
chartFormat->icrt = chartIndex;
|
||||
ptr->m_ChartFormat = XLS::BaseObjectPtr(chartFormat);
|
||||
auto chartType = new XLS::Surf;
|
||||
ptr->m_ChartType = XLS::BaseObjectPtr(chartType);
|
||||
return XLS::BaseObjectPtr(ptr);
|
||||
}
|
||||
EElementType CT_SurfaceChart::getType() { return et_ct_surfacechart; }
|
||||
|
||||
ST_SplitType CSplitType::FromString(const std::wstring &sValue)
|
||||
@ -9526,19 +9602,6 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\"");
|
||||
writer.WriteString(sNodeName);
|
||||
writer.WriteString(L">");
|
||||
}
|
||||
XLS::BaseObjectPtr CT_Surface::toXLS(const unsigned short chartIndex, XLS::BaseObjectPtr ChartFormats)
|
||||
{
|
||||
auto ChartFormatsPtr = static_cast<XLS::CHARTFORMATS*>(ChartFormats.get());
|
||||
|
||||
auto ptr = new XLS::CRT;
|
||||
auto chartFormat = new XLS::ChartFormat;
|
||||
chartFormat->icrt = chartIndex;
|
||||
ptr->m_ChartFormat = XLS::BaseObjectPtr(chartFormat);
|
||||
auto chartType = new XLS::Surf;
|
||||
ptr->m_ChartType = XLS::BaseObjectPtr(chartType);
|
||||
|
||||
return XLS::BaseObjectPtr(ptr);
|
||||
}
|
||||
EElementType CT_Surface::getType() { return et_ct_surface; }
|
||||
|
||||
CT_View3D::CT_View3D()
|
||||
|
||||
@ -1457,6 +1457,7 @@ namespace OOX
|
||||
{}
|
||||
void fromXML(XmlUtils::CXmlLiteReader& oReader);
|
||||
void toXML(const std::wstring& sNodeName, NSStringUtils::CStringBuilder& writer) const;
|
||||
XLS::BaseObjectPtr GetXLSFormat(const _UINT32 chartIndex)const;
|
||||
EElementType getType();
|
||||
};
|
||||
class CT_Surface3DChart
|
||||
@ -1489,6 +1490,7 @@ namespace OOX
|
||||
|
||||
void fromXML(XmlUtils::CXmlLiteReader& oReader);
|
||||
void toXML(const std::wstring& sNodeName, NSStringUtils::CStringBuilder& writer) const;
|
||||
XLS::BaseObjectPtr toXLS(const unsigned short chartIndex, XLS::BaseObjectPtr ChartFormatsPtr);
|
||||
EElementType getType();
|
||||
};
|
||||
class CT_custSplit
|
||||
@ -1959,7 +1961,6 @@ namespace OOX
|
||||
~CT_Surface();
|
||||
void fromXML(XmlUtils::CXmlLiteReader& oReader);
|
||||
void toXML(const std::wstring& sNodeName, NSStringUtils::CStringBuilder& writer) const;
|
||||
XLS::BaseObjectPtr toXLS(const unsigned short chartIndex, XLS::BaseObjectPtr ChartFormatsPtr);
|
||||
EElementType getType();
|
||||
};
|
||||
class CT_View3D
|
||||
|
||||
@ -301,101 +301,102 @@ namespace OOX
|
||||
if(ChartFile->m_oChartSpace.m_spPr.IsInit())
|
||||
{
|
||||
ChartFormatsPtr->m_FRAME = ChartFile->m_oChartSpace.m_spPr->toXLSFrame();
|
||||
if(ChartFile->m_oChartSpace.m_chart != nullptr && ChartFile->m_oChartSpace.m_chart->m_plotArea != nullptr)
|
||||
}
|
||||
if(ChartFile->m_oChartSpace.m_chart != nullptr && ChartFile->m_oChartSpace.m_chart->m_plotArea != nullptr)
|
||||
{
|
||||
auto AxisParentUnion = new XLS::AXISPARENT;
|
||||
ChartFormatsPtr->m_arAXISPARENT.push_back(XLS::BaseObjectPtr(AxisParentUnion));
|
||||
|
||||
for(auto chartIndex = 0; chartIndex < ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.size(); chartIndex ++)
|
||||
{
|
||||
auto AxisParentUnion = new XLS::AXISPARENT;
|
||||
ChartFormatsPtr->m_arAXISPARENT.push_back(XLS::BaseObjectPtr(AxisParentUnion));
|
||||
|
||||
for(auto chartIndex = 0; chartIndex < ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.size(); chartIndex ++)
|
||||
if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5BARCHART)
|
||||
{
|
||||
if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5BARCHART)
|
||||
auto barChart = static_cast<CT_BarChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
if(ChartFormatsPtr->m_arAXISPARENT.size() < 2)
|
||||
{
|
||||
auto barChart = static_cast<CT_BarChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
if(ChartFormatsPtr->m_arAXISPARENT.size() < 2)
|
||||
auto axes = new XLS::AXES;
|
||||
AxisParentUnion->m_AXES = XLS::BaseObjectPtr(axes);
|
||||
if(barChart->m_axId.size() > 0)
|
||||
{
|
||||
auto axes = new XLS::AXES;
|
||||
AxisParentUnion->m_AXES = XLS::BaseObjectPtr(axes);
|
||||
if(barChart->m_axId.size() > 0)
|
||||
auto vaxId = barChart->m_axId.at(0);
|
||||
if(!ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.empty())
|
||||
{
|
||||
auto vaxId = barChart->m_axId.at(0);
|
||||
if(!ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.empty())
|
||||
auto ivAx = static_cast<CT_CatAx*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(0));
|
||||
if(ivAx->m_axId.IsInit() && ivAx->m_axId.get() == vaxId)
|
||||
{
|
||||
auto ivAx = static_cast<CT_CatAx*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(0));
|
||||
if(ivAx->m_axId.IsInit() && ivAx->m_axId.get() == vaxId)
|
||||
{
|
||||
axes->m_arAxes.push_back(ivAx->toXLS());
|
||||
}
|
||||
axes->m_arAxes.push_back(ivAx->toXLS());
|
||||
}
|
||||
}
|
||||
if(barChart->m_axId.size() > 1)
|
||||
{
|
||||
auto vaxId = barChart->m_axId.at(1);
|
||||
if(!ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.empty())
|
||||
{
|
||||
auto dvAx = static_cast<CT_ValAx*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(1));
|
||||
if(dvAx->m_axId.IsInit() && dvAx->m_axId.get() == vaxId)
|
||||
{
|
||||
axes->m_arAxes.push_back(dvAx->toXLS());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
AxisParentUnion->m_arCRT.push_back(barChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5PIECHART)
|
||||
{
|
||||
auto PieChart = static_cast<CT_PieChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(PieChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5LINECHART)
|
||||
{
|
||||
auto LineChart = static_cast<CT_LineChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(LineChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5AREACHART)
|
||||
{
|
||||
auto AreaChart = static_cast<CT_AreaChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(AreaChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5SURFACECHART)
|
||||
{
|
||||
auto SurfaceChart = static_cast<CT_Surface*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(SurfaceChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5SCATTERCHART)
|
||||
{
|
||||
auto ScatterChart = static_cast<CT_ScatterChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(ScatterChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
if(barChart->m_axId.size() > 1)
|
||||
{
|
||||
auto vaxId = barChart->m_axId.at(1);
|
||||
if(!ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.empty())
|
||||
{
|
||||
auto dvAx = static_cast<CT_ValAx*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(1));
|
||||
if(dvAx->m_axId.IsInit() && dvAx->m_axId.get() == vaxId)
|
||||
{
|
||||
axes->m_arAxes.push_back(dvAx->toXLS());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
AxisParentUnion->m_arCRT.push_back(barChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5PIECHART)
|
||||
{
|
||||
auto PieChart = static_cast<CT_PieChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(PieChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5LINECHART)
|
||||
{
|
||||
auto LineChart = static_cast<CT_LineChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(LineChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5AREACHART)
|
||||
{
|
||||
auto AreaChart = static_cast<CT_AreaChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(AreaChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5SURFACECHART)
|
||||
{
|
||||
auto SurfaceChart = static_cast<CT_SurfaceChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(SurfaceChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5SCATTERCHART)
|
||||
{
|
||||
auto ScatterChart = static_cast<CT_ScatterChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
|
||||
AxisParentUnion->m_arCRT.push_back(ScatterChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
|
||||
}
|
||||
}
|
||||
if(ChartFile->m_oChartSpace.m_chart->m_title != nullptr && ChartFile->m_oChartSpace.m_chart->m_title->m_tx != nullptr)
|
||||
{
|
||||
auto labelUnion = new XLS::ATTACHEDLABEL;
|
||||
auto textRecord = new XLS::Text;
|
||||
textRecord->wBkgMode = 1;
|
||||
textRecord->at = 2;
|
||||
textRecord->vat = 1;
|
||||
auto textPos = new XLS::Pos;
|
||||
textPos->mdBotRt = 2;
|
||||
textPos->mdTopLt = 2;
|
||||
labelUnion->m_Pos = XLS::BaseObjectPtr(textPos);
|
||||
auto objLink = new XLS::ObjectLink;
|
||||
objLink->wLinkObj = 1;
|
||||
auto seriesText = new XLS::SeriesText;
|
||||
seriesText->stText = ChartFile->m_oChartSpace.m_chart->m_title->m_tx->m_oRich->GetText();
|
||||
auto aiUnion = new XLS::AI;
|
||||
auto brai = new XLS::BRAI;
|
||||
brai->rt = 1;
|
||||
aiUnion->m_BRAI = XLS::BaseObjectPtr(brai);
|
||||
aiUnion->m_SeriesText = XLS::BaseObjectPtr(seriesText);
|
||||
labelUnion->m_AI = XLS::BaseObjectPtr(aiUnion);
|
||||
labelUnion->m_ObjectLink = XLS::BaseObjectPtr(objLink);
|
||||
labelUnion->m_TextProperties = XLS::BaseObjectPtr(textRecord);
|
||||
ChartFormatsPtr->m_arATTACHEDLABEL.push_back(XLS::BaseObjectPtr(labelUnion));
|
||||
}
|
||||
}
|
||||
if(ChartFile->m_oChartSpace.m_chart->m_title != nullptr && ChartFile->m_oChartSpace.m_chart->m_title->m_tx != nullptr)
|
||||
{
|
||||
auto labelUnion = new XLS::ATTACHEDLABEL;
|
||||
auto textRecord = new XLS::Text;
|
||||
textRecord->wBkgMode = 1;
|
||||
textRecord->at = 2;
|
||||
textRecord->vat = 1;
|
||||
auto textPos = new XLS::Pos;
|
||||
textPos->mdBotRt = 2;
|
||||
textPos->mdTopLt = 2;
|
||||
labelUnion->m_Pos = XLS::BaseObjectPtr(textPos);
|
||||
auto objLink = new XLS::ObjectLink;
|
||||
objLink->wLinkObj = 1;
|
||||
auto seriesText = new XLS::SeriesText;
|
||||
seriesText->stText = ChartFile->m_oChartSpace.m_chart->m_title->m_tx->m_oRich->GetText();
|
||||
auto aiUnion = new XLS::AI;
|
||||
auto brai = new XLS::BRAI;
|
||||
brai->rt = 1;
|
||||
aiUnion->m_BRAI = XLS::BaseObjectPtr(brai);
|
||||
aiUnion->m_SeriesText = XLS::BaseObjectPtr(seriesText);
|
||||
labelUnion->m_AI = XLS::BaseObjectPtr(aiUnion);
|
||||
labelUnion->m_ObjectLink = XLS::BaseObjectPtr(objLink);
|
||||
labelUnion->m_TextProperties = XLS::BaseObjectPtr(textRecord);
|
||||
ChartFormatsPtr->m_arATTACHEDLABEL.push_back(XLS::BaseObjectPtr(labelUnion));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user