Commit 3f8c2c29 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormatReader - fix users file

parent 2c97e743
......@@ -32,7 +32,6 @@
#include "FixedPoint.h"
#include <Binary/CFRecord.h>
//#include <Exception/AttributeDataWrong.h>
namespace OSHARED
{
......@@ -40,8 +39,14 @@ namespace OSHARED
FixedPoint::FixedPoint()
{
Integral = 0;
Fractional = 0;
}
FixedPoint::FixedPoint(unsigned short cbElement_)
{
Integral = 0;
Fractional = 0;
}
FixedPoint::FixedPoint(const int raw_data)
{
......@@ -49,7 +54,6 @@ FixedPoint::FixedPoint(const int raw_data)
Integral = static_cast<unsigned char>(raw_data >> 16);
}
XLS::BiffStructurePtr FixedPoint::clone()
{
return XLS::BiffStructurePtr(new FixedPoint(*this));
......
......@@ -41,6 +41,7 @@ class CFRecord;
class FixedPoint : public XLS::BiffAttribute
{
public:
FixedPoint(unsigned short cbElement_); //fixed always!!
FixedPoint();
FixedPoint(const int raw_data);
XLS::BiffStructurePtr clone();
......
......@@ -56,8 +56,11 @@ public:
unsigned short nElems, nElemsAlloc;
unsigned short cbElem;
int pos1 = record.getRdPtr();
record >> nElems >> nElemsAlloc >> cbElem;
while(nElems--)
for (unsigned short i = 0; i < nElems; i++)
{
Type element(cbElem);
record >> element;
......
......@@ -223,18 +223,26 @@ OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record)
fopte = OfficeArtFOPTEPtr(new AdjustValue);
break;
case 0x0151:
fopte = OfficeArtFOPTEPtr(new pAdjustHandles);
break;
case 0x0156:
fopte = OfficeArtFOPTEPtr(new pGuides);
fopte = OfficeArtFOPTEPtr(new pConnectionSites);
break;
case 0x0152:
fopte = OfficeArtFOPTEPtr(new pConnectionSitesDir);
break;
case 0x0153:
case 0x0154:
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);
break;
case 0x0155:
fopte = OfficeArtFOPTEPtr(new pAdjustHandles);
break;
case 0x0156:
fopte = OfficeArtFOPTEPtr(new pGuides);
break;
case 0x0157:
fopte = OfficeArtFOPTEPtr(new pInscribe);
break;
case 0x0158:
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);
fopte = OfficeArtFOPTEPtr(new OfficeArtFOPTE);//cxk
break;
case 0x017f:
fopte = OfficeArtFOPTEPtr(new GeometryBooleanProperties);
......@@ -427,6 +435,14 @@ OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record)
return fopte;
}
FixedPoint::FixedPoint()
{
dVal = 0;
}
FixedPoint::FixedPoint(unsigned short cbElement_)
{
dVal = 0;
}
void FixedPoint::load(XLS::CFRecord& record)
{
OfficeArtFOPTE::load(record);
......@@ -642,17 +658,6 @@ void pihlShape::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
//---------------------------------------------------------------------------------------------
MSOPOINT::MSOPOINT()
......@@ -691,6 +696,44 @@ void MSOPOINT::load(XLS::CFRecord& record)
}
}
//---------------------------------------------------------------------------------------------
MSORECT::MSORECT()
{
cbElement = 8;
}
MSORECT::MSORECT(unsigned short cbElement_)
{
cbElement = 8;
if (cbElement_ == 0xfff0)
{
cbElement = 4;
}
}
XLS::BiffStructurePtr MSORECT::clone()
{
return XLS::BiffStructurePtr(new MSORECT(*this));
}
void MSORECT::load(XLS::CFRecord& record)
{
if (cbElement == 8)
{
record >> l >> t >> r >> b;
}
else
{
unsigned short l_, t_, r_, b_;
record >> l_ >> t_ >> r_ >> b_;
l = l_;
t = t_;
r = r_;
b = b_;
}
}
//---------------------------------------------------------------------------------------------
MSOPATHINFO::MSOPATHINFO()
{
cbElement = 4;
......@@ -926,17 +969,6 @@ void PVertices::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void PSegmentInfo::ReadComplexData(XLS::CFRecord& record)
......@@ -945,17 +977,6 @@ void PSegmentInfo::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void pGuides::ReadComplexData(XLS::CFRecord& record)
......@@ -964,17 +985,6 @@ void pGuides::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void pAdjustHandles::ReadComplexData(XLS::CFRecord& record)
{
......@@ -983,16 +993,26 @@ void pAdjustHandles::ReadComplexData(XLS::CFRecord& record)
int pos = record.getRdPtr();
record >> complex;
}
void pConnectionSites::ReadComplexData(XLS::CFRecord& record)
{
complex.op = op;
int pos = record.getRdPtr();
int pos2 = record.getRdPtr() - pos;
record >> complex;
}
void pConnectionSitesDir::ReadComplexData(XLS::CFRecord& record)
{
complex.op = op;
int pos = record.getRdPtr();
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
record >> complex;
}
void pInscribe::ReadComplexData(XLS::CFRecord& record)
{
complex.op = op;
int pos = record.getRdPtr();
record >> complex;
}
}
......@@ -88,7 +88,10 @@ class fillColor : public OfficeArtFOPTE
class FixedPoint : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(fillColor)
BASE_STRUCTURE_DEFINE_CLASS_NAME(FixedPoint)
FixedPoint();
FixedPoint(unsigned short cbElement_); //fixed always!!
virtual void load(XLS::CFRecord& record);
double dVal;
......@@ -574,6 +577,28 @@ class MSOPOINT : public XLS::BiffStructure
int cbElement;
};
class MSORECT : public XLS::BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(MSORECT)
MSORECT(unsigned short cbElement_);
MSORECT();
XLS::BiffStructurePtr clone();
virtual void load(XLS::CFRecord& record);
static const XLS::ElementType type = XLS::typeOfficeArtRecord;
_INT32 l;
_INT32 t;
_INT32 r;
_INT32 b;
int cbElement;
};
class MSOPATHINFO : public XLS::BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(MSOPATHINFO)
......@@ -710,6 +735,40 @@ class pAdjustHandles : public OfficeArtFOPTE
IMsoArray<ADJH> complex;
};
class pConnectionSites : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(pConnectionSites)
virtual void ReadComplexData(XLS::CFRecord& record);
IMsoArray<MSOPOINT> complex;
};
class pConnectionSitesDir : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(pConnectionSitesDir)
virtual void ReadComplexData(XLS::CFRecord& record);
IMsoArray<ODRAW::FixedPoint> complex;
};
class pInscribe : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(pInscribe)
virtual void ReadComplexData(XLS::CFRecord& record);
IMsoArray<MSORECT> complex;
};
//class cxk : public OfficeArtFOPTE
//{
// BASE_STRUCTURE_DEFINE_CLASS_NAME(cxk)
//
// virtual void ReadComplexData(XLS::CFRecord& record);
//
// IMsoArray<MSOCXK> complex;
//};
class lineOpacity : public OfficeArtFOPTE
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(lineOpacity)
......
......@@ -115,30 +115,30 @@ public:
m_strRect = Shape->m_strRect;
m_arAdjustments.clear();
for(int i = 0; i < Shape->m_arAdjustments.size(); i++)
for(size_t i = 0; i < Shape->m_arAdjustments.size(); i++)
m_arAdjustments.push_back(Shape->m_arAdjustments[i]);
m_arGuides.clear();
for(int i = 0; i < Shape->m_arGuides.size(); i++)
for(size_t 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_arConnectors.clear();
for(int i = 0; i < Shape->m_arConnectors.size(); i++)
for(size_t 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++)
for(size_t 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++)
for(size_t 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++)
for(size_t i = 0; i < Shape->m_arHandles.size(); i++)
m_arHandles.push_back(Shape->m_arHandles[i]);
......@@ -157,26 +157,26 @@ public:
// Shape->m_strRect = m_strRect;
//
// Shape->m_arAdjustments.clear();
// for(int i = 0; i < m_arAdjustments.size(); i++)
// for(size_t i = 0; i < m_arAdjustments.size(); i++)
// Shape->m_arAdjustments.push_back(m_arAdjustments[i]);
// Shape->Guides.clear();
// for(int i = 0; i < Guides.size(); i++)
// for(size_t i = 0; i < Guides.size(); i++)
// Shape->Guides.push_back(Guides[i]);
// Shape->m_eJoin = m_eJoin;
// Shape->m_bConcentricFill = m_bConcentricFill;
// Shape->m_arConnectors.clear();
// for(int i = 0; i < m_arConnectors.size(); i++)
// for(size_t i = 0; i < m_arConnectors.size(); i++)
// Shape->m_arConnectors.push_back(m_arConnectors[i]);
// Shape->m_arConnectorAngles.clear();
// for(int i = 0; i < m_arConnectorAngles.size(); i++)
// for(size_t i = 0; i < m_arConnectorAngles.size(); i++)
// Shape->m_arConnectorAngles.push_back(m_arConnectorAngles[i]);
// Shape->m_arTextRects.clear();
// for(int i = 0; i < m_arTextRects.size(); i++)
// for(size_t i = 0; i < m_arTextRects.size(); i++)
// Shape->m_arTextRects.push_back(m_arTextRects[i]);
// Shape->m_strRect = m_strRect;
......
......@@ -351,12 +351,12 @@ private:
m_lShapeHeight = oSrc.m_lShapeHeight;
m_arResults.clear();
for (int nIndex = 0; nIndex < oSrc.m_arResults.size(); ++nIndex)
for (size_t nIndex = 0; nIndex < oSrc.m_arResults.size(); ++nIndex)
{
m_arResults.push_back(oSrc.m_arResults[nIndex]);
}
m_arFormulas.clear();
for (int nIndex = 0; nIndex < oSrc.m_arFormulas.size(); ++nIndex)
for (size_t nIndex = 0; nIndex < oSrc.m_arFormulas.size(); ++nIndex)
{
m_arFormulas.push_back(oSrc.m_arFormulas[nIndex]);
}
......@@ -379,7 +379,7 @@ private:
//m_arFormulas.clear();
//m_arResults.clear();
for (int nIndex = 0; nIndex < m_arResults.size(); ++nIndex)
for (size_t nIndex = 0; nIndex < m_arResults.size(); ++nIndex)
{
m_arResults[nIndex] = 0xFFFFFFFF;
}
......@@ -399,7 +399,7 @@ private:
}
void CalculateResults()
{
for (int index = 0; index < m_arFormulas.size(); ++index)
for (size_t index = 0; index < m_arFormulas.size(); ++index)
{
LONG lResult = m_arFormulas[index].CalculateFormula(this);
}
......
......@@ -426,7 +426,7 @@ namespace NSCustomShapesConvert
{
m_eType = oSrc.m_eType;
this->m_arPoints.clear();
for (int nIndex = 0; nIndex < oSrc.m_arPoints.size(); ++nIndex)
for (size_t nIndex = 0; nIndex < oSrc.m_arPoints.size(); ++nIndex)
{
this->m_arPoints.push_back(oSrc.m_arPoints[nIndex]);
}
......@@ -771,7 +771,7 @@ namespace NSCustomShapesConvert
case rtAngleEllipseTo:
{
int nFigure = 0;
while ((nFigure + 3) <= this->m_arPoints.size())
while ((nFigure + 3) <= (int)this->m_arPoints.size())
{
double nLeft = this->m_arPoints[nFigure].dX - this->m_arPoints[nFigure + 1].dX / 2;
double nTop = this->m_arPoints[nFigure].dY - this->m_arPoints[nFigure + 1].dY / 2;
......@@ -790,7 +790,7 @@ namespace NSCustomShapesConvert
{
pRenderer->PathCommandStart();
int nFigure = 0;
while ((nFigure + 3) <= this->m_arPoints.size())
while ((nFigure + 3) <= (int)this->m_arPoints.size())
{
double nLeft = this->m_arPoints[nFigure].dX - this->m_arPoints[nFigure + 1].dX / 2;
double nTop = this->m_arPoints[nFigure].dY - this->m_arPoints[nFigure + 1].dY / 2;
......@@ -809,7 +809,7 @@ namespace NSCustomShapesConvert
{
pRenderer->PathCommandStart();
int nFigure = 0;
while ((nFigure + 4) <= this->m_arPoints.size())
while ((nFigure + 4) <= (int)this->m_arPoints.size())
{
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
......@@ -834,7 +834,7 @@ namespace NSCustomShapesConvert
case rtArcTo:
{
int nFigure = 0;
while ((nFigure + 4) <= this->m_arPoints.size())
while ((nFigure + 4) <= (int)this->m_arPoints.size())
{
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
......@@ -859,7 +859,7 @@ namespace NSCustomShapesConvert
case rtClockwiseArcTo:
{
int nFigure = 0;
while ((nFigure + 4) <= this->m_arPoints.size())
while ((nFigure + 4) <= (int)this->m_arPoints.size())
{
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
......@@ -885,7 +885,7 @@ namespace NSCustomShapesConvert
{
pRenderer->PathCommandStart();
int nFigure = 0;
while ((nFigure + 4) <= this->m_arPoints.size())
while ((nFigure + 4) <= (int)this->m_arPoints.size())
{
double nCentreX = (this->m_arPoints[nFigure].dX + this->m_arPoints[nFigure + 1].dX) / 2;
double nCentreY = (this->m_arPoints[nFigure].dY + this->m_arPoints[nFigure + 1].dY) / 2;
......
......@@ -332,7 +332,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
convert((XLS::GlobalsSubstream*)woorkbook->m_GlobalsSubstream.get());
int count_sheets = 0, count_chart_sheets = 0;
for (int i=0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
for (size_t i = 0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
{
if (woorkbook->m_arWorksheetSubstream[i]->get_type() == XLS::typeWorksheetSubstream)
{
......@@ -406,14 +406,14 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{
CP_XML_NODE(L"mergeCells")
{
for (int i = 0 ; i < sheet->m_arMergeCells.size(); i++)
for (size_t i = 0 ; i < sheet->m_arMergeCells.size(); i++)
{
sheet->m_arMergeCells[i]->serialize(CP_XML_STREAM());
}
}
}
}
for (int i = 0 ; i < sheet->m_arHLINK.size(); i++)
for (size_t i = 0 ; i < sheet->m_arHLINK.size(); i++)
{
convert((XLS::HLINK*)sheet->m_arHLINK[i].get());
}
......@@ -438,7 +438,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
if (!sheet->m_arNote.empty() && xls_global_info->Version < 0x0600)
{
xlsx_context->get_drawing_context().start_drawing(0);
for (int i = 0 ; i < sheet->m_arNote.size(); i++)
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
{
xlsx_context->get_drawing_context().start_drawing(0x0019);
convert(dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get()));
......@@ -452,7 +452,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties());
}
for (int i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
{
//convert(dynamic_cast<XLS::Note*>(sheet->sheet->m_arHFPictureDrawing[i].get(),
}
......@@ -463,7 +463,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{
CP_XML_NODE(L"customSheetViews")
{
for (int i = 0 ; i < sheet->m_arCUSTOMVIEW.size(); i++)
for (size_t i = 0 ; i < sheet->m_arCUSTOMVIEW.size(); i++)
{
sheet->m_arCUSTOMVIEW[i]->serialize(CP_XML_STREAM());
}
......@@ -476,7 +476,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
convert(dynamic_cast<XLS::BACKGROUND*>(sheet->m_BACKGROUND.get()));
}
for (int i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
{
convert((ODRAW::OfficeArtDgContainer*)sheet->m_arHFPictureDrawing[i].get());
}
......@@ -492,26 +492,26 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
convert((XLS::SHAREDSTRINGS*)global->m_SHAREDSTRINGS.get());
for (int i = 0 ; i < global->m_arLBL.size(); i++)
for (size_t i = 0 ; i < global->m_arLBL.size(); i++)
{
convert((XLS::LBL*)global->m_arLBL[i].get());
}
for (int i = 0 ; i < global->m_arMSODRAWINGGROUP.size(); i++)
for (size_t i = 0 ; i < global->m_arMSODRAWINGGROUP.size(); i++)
{
convert((XLS::MSODRAWINGGROUP*)global->m_arMSODRAWINGGROUP[i].get());
}
for (int i = 0 ; i < global->m_arHFPictureDrawing.size(); i++)
for (size_t i = 0 ; i < global->m_arHFPictureDrawing.size(); i++)
{
convert((ODRAW::OfficeArtDgContainer*)global->m_arHFPictureDrawing[i].get());
}
for (int i = 0 ; i < global->m_arWindow1.size(); i++)
for (size_t i = 0 ; i < global->m_arWindow1.size(); i++)
{
global->m_arWindow1[i]->serialize(xlsx_context->workbook_views());
}
for (int i = 0 ; i < global->m_arUserBView.size(); i++)
for (size_t i = 0 ; i < global->m_arUserBView.size(); i++)
{
global->m_arUserBView[i]->serialize(xlsx_context->custom_views());
}
......@@ -544,7 +544,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
}
CP_XML_ATTR(L"count", fills_out.size());
for (int i = 0 ;i < fills_out.size(); i++)
for (size_t i = 0 ;i < fills_out.size(); i++)
{
fills_out[i].serialize(CP_XML_STREAM());
}
......@@ -560,7 +560,7 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
}
CP_XML_ATTR(L"count", borders_out.size());
for (int i = 0 ;i < borders_out.size(); i++)
for (size_t i = 0 ;i < borders_out.size(); i++)
{
borders_out[i].serialize(CP_XML_STREAM());
}
......@@ -740,7 +740,7 @@ void XlsConverter::convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int star
if (art_bstore == NULL) return;
if (art_bstore->rgfb.size() < 1) return;
for (int i = 0 ; i < art_bstore->rgfb.size(); i++)
for (size_t i = 0 ; i < art_bstore->rgfb.size(); i++)
{
int bin_id = i + start_id + 1;
......@@ -896,7 +896,7 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
xlsx_context->get_drawing_context().set_line_old_version(obj->old_version.line);
xlsx_context->get_drawing_context().set_flag_old_version(obj->old_version.flag, obj->old_version.flag2);
for (int i = 0 ; i < obj->old_version.additional.size(); i++)
for (size_t i = 0 ; i < obj->old_version.additional.size(); i++)
{
convert(obj->old_version.additional[i].get());
}
......@@ -1020,7 +1020,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
{
text_obj->preserve_enabled = true;
for (int i = 0 ; i < sheet->m_arNote.size(); i++)
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
{
XLS::Note* note = dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get());
if ((note) && (note->note_sh.idObj == obj->cmo.id))
......@@ -1055,7 +1055,7 @@ void XlsConverter::convert(ODRAW::OfficeArtSpgrContainer * spgr)
if (spgr == NULL) return;
if (spgr->anchor_type_ != ODRAW::OfficeArtRecord::CA_HF) return; //todooo проверить что тока для header/footer это нужно
for (int i = 0; i < spgr->child_records.size(); i++)
for (size_t i = 0; i < spgr->child_records.size(); i++)
{
int type_object = 2;//rect
......@@ -1076,7 +1076,7 @@ void XlsConverter::convert(ODRAW::OfficeArtSpContainer *sp, bool anchor_only)
{
convert(sp->m_OfficeArtFSP.get());
for (int i = 0; i < sp->child_records.size(); i++)
for (size_t i = 0; i < sp->child_records.size(); i++)
{
convert(sp->child_records[i].get());
}
......@@ -1140,12 +1140,12 @@ void XlsConverter::convert(ODRAW::OfficeArtRecord * art)
{
ODRAW::OfficeArtDgContainer * dg = dynamic_cast<ODRAW::OfficeArtDgContainer *>(art);
for (int i = 0 ; i < dg->child_records.size(); i++) //a-la msodrawing for headers/footers
for (size_t i = 0 ; i < dg->child_records.size(); i++) //a-la msodrawing for headers/footers
{
convert(dg->child_records[i].get());
}
for (int i = 0; i < dg->m_OfficeArtSpContainer.size(); i++)
for (size_t i = 0; i < dg->m_OfficeArtSpContainer.size(); i++)
{
convert(dg->m_OfficeArtSpContainer[i].get());
}
......@@ -1167,7 +1167,7 @@ void XlsConverter::convert(ODRAW::OfficeArtFSP * fsp)
}
void XlsConverter::convert_fill_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
......@@ -1286,7 +1286,7 @@ void XlsConverter::convert_fill_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
{
ODRAW::fillShadeColors *shadeColors = (ODRAW::fillShadeColors *)(props[i].get());
for (int i = 0 ; (shadeColors) && (i < shadeColors->fillShadeColors_complex.data.size()); i++)
for (size_t i = 0 ; (shadeColors) && (i < shadeColors->fillShadeColors_complex.data.size()); i++)
{
ODRAW::OfficeArtCOLORREF & color = shadeColors->fillShadeColors_complex.data[i].color;
......@@ -1325,7 +1325,7 @@ void XlsConverter::convert_line_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
{
if (props.size() < 1) return;
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
......@@ -1403,6 +1403,18 @@ void XlsConverter::convert_line_style(std::vector<ODRAW::OfficeArtFOPTEPtr> & pr
}
}
}break;
case NSOfficeDrawing::lineMiterLimit:
{
xlsx_context->get_drawing_context().set_line_miter(props[i]->op);
}break;
case NSOfficeDrawing::lineJoinStyle:
{
xlsx_context->get_drawing_context().set_line_join(props[i]->op);
}break;
case NSOfficeDrawing::lineEndCapStyle:
{
xlsx_context->get_drawing_context().set_line_endcap(props[i]->op);
}break;
}
}
}
......@@ -1410,7 +1422,7 @@ void XlsConverter::convert_blip(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
if (props.size() < 1) return;
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
ODRAW::FixedPoint * fixed_point = static_cast<ODRAW::FixedPoint *>(props[i].get());
switch(props[i]->opid)
......@@ -1457,7 +1469,7 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
oox::_rect rect;
std::vector<_CP_OPT(int)> adjustValues(8);
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
......@@ -1489,6 +1501,24 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
adjustValues[props[i]->opid - 0x0147] = props[i]->op ;
}break;
case 0x0151:
{
ODRAW::pConnectionSites * a = (ODRAW::pConnectionSites *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_connection(a->complex.data);
}break;
case 0x0152:
{
ODRAW::pConnectionSitesDir * a = (ODRAW::pConnectionSitesDir *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_connectionDir(a->complex.data);
}break;
case 0x0153:
{
xlsx_context->get_drawing_context().set_custom_x_limo(props[i]->op);
}break;
case 0x0154:
{
xlsx_context->get_drawing_context().set_custom_y_limo(props[i]->op);
}break;
case 0x0155:
{
ODRAW::pAdjustHandles * a = (ODRAW::pAdjustHandles *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_adjustHandles(a->complex.data);
......@@ -1498,6 +1528,16 @@ void XlsConverter::convert_geometry(std::vector<ODRAW::OfficeArtFOPTEPtr> & prop
ODRAW::pGuides* s = (ODRAW::pGuides *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_guides(s->complex.data);
}break;
case 0x0157:
{
ODRAW::pInscribe * a = (ODRAW::pInscribe *)(props[i].get());
xlsx_context->get_drawing_context().set_custom_inscribe(a->complex.data);
}break;
//case 0x0158:
// {
// ODRAW::cxk * a = (ODRAW::cxk *)(props[i].get());
// xlsx_context->get_drawing_context().set_custom_cxk(a->complex.data);
// }break;
}
}
rect.cy -= rect.y;
......@@ -1510,7 +1550,7 @@ void XlsConverter::convert_geometry_text(std::vector<ODRAW::OfficeArtFOPTEPtr> &
{
if (props.size() < 1) return;
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
......@@ -1571,7 +1611,7 @@ void XlsConverter::convert_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
if (props.size() < 1) return;
RECT text_margin = {0x00016530, 0x0000b298, 0x00016530, 0x0000b298};
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
......@@ -1647,20 +1687,20 @@ void XlsConverter::convert_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
}
void XlsConverter::convert_shadow(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
}
}
void XlsConverter::convert_shape(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
}
}
void XlsConverter::convert_group_shape(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
......@@ -1726,7 +1766,7 @@ void XlsConverter::convert(XLS::Note* note)
void XlsConverter::convert_transform(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
{
for (int i = 0 ; i < props.size() ; i++)
for (size_t i = 0 ; i < props.size() ; i++)
{
switch(props[i]->opid)
{
......@@ -1774,7 +1814,7 @@ void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings)
}
}
for (int i = 0 ; i < xls_global_info->arAddedSharedStrings.size(); i++)
for (size_t i = 0 ; i < xls_global_info->arAddedSharedStrings.size(); i++)
{
CP_XML_NODE(L"si")
{
......
......@@ -622,7 +622,7 @@ void xlsx_drawing_context::serialize_group()
//serialize_line(CP_XML_STREAM(), drawing_state);
}
for (int i = 1; i < current_drawing_states->size(); i++)
for (size_t i = 1; i < current_drawing_states->size(); i++)
{
CP_XML_STREAM() << current_drawing_states->at(i)->shape;
//todooo current_drawing_states->at(i).shape.erase(); // память поэкономить
......@@ -1033,7 +1033,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
shape->m_oCustomVML.m_bIsVerticesPresent = drawing_state->custom_verticles.empty() ? false : true;
for (int i = 0 ; i < drawing_state->custom_verticles.size(); i++)
for (size_t i = 0 ; i < drawing_state->custom_verticles.size(); i++)
{
Aggplus::POINT p;
......@@ -1043,7 +1043,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++)
for (size_t i = 0 ; i < drawing_state->custom_guides.size(); i++)
{//todooo объеденить/срастить !!
NSCustomShapesConvert::CGuide guid;
......@@ -1058,7 +1058,7 @@ 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++)
for (size_t i = 0 ; i < drawing_state->custom_segments.size(); i++)
{
if (0 == drawing_state->custom_segments[i].m_nCount)
{
......@@ -1076,7 +1076,7 @@ std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & dra
//{//todooo - ранее этого не было ?????
// shape->m_oCustomVML.addHandle(i, *drawing_state->custom_adjustHandles[i]);
//}
for (int i = 0; i < drawing_state->custom_adjustValues.size(); i++)
for (size_t i = 0; i < drawing_state->custom_adjustValues.size(); i++)
{
if (drawing_state->custom_adjustValues[i])
{
......@@ -1301,7 +1301,7 @@ void xlsx_drawing_context::serialize_gradient_fill(std::wostream & stream, _draw
if ( !fill.colorsPosition.empty() )
{
for (int i = 0; i < fill.colorsPosition.size(); i++)
for (size_t i = 0; i < fill.colorsPosition.size(); i++)
{
CP_XML_NODE(L"a:gs")
{
......@@ -1600,6 +1600,13 @@ void xlsx_drawing_context::serialize_line(std::wostream & stream, _drawing_state
else
CP_XML_ATTR(L"w", 9525); //default
switch(line.endcap)
{
case 0: CP_XML_ATTR(L"cap", L"rnd"); break;
case 1: CP_XML_ATTR(L"cap", L"sq"); break;
case 2: CP_XML_ATTR(L"cap", L"flat"); break;
}
serialize_fill(CP_XML_STREAM(), line.fill);
CP_XML_NODE(L"a:prstDash")
......@@ -1613,6 +1620,18 @@ void xlsx_drawing_context::serialize_line(std::wostream & stream, _drawing_state
case lineDashDotDot:CP_XML_ATTR(L"val", L"lgDashDotDot"); break;
}
}
switch(line.join)
{
case 0: CP_XML_NODE(L"a:bevel"); break;
case 1:
CP_XML_NODE(L"a:miter")
{
if (line.miter > 0)
CP_XML_ATTR(L"lim", line.miter * 1000);
}break;
case 2: CP_XML_NODE(L"a:round"); break;
}
if (line.arrow.enabled)
{
serialize_arrow(CP_XML_STREAM(), L"a:headEnd", line.arrow.start, line.arrow.start_width, line.arrow.start_length);
......@@ -2019,7 +2038,27 @@ void xlsx_drawing_context::set_line_width (int val)
current_drawing_states->back()->line.width = val;
}
void xlsx_drawing_context::set_line_miter(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.miter = val;
}
void xlsx_drawing_context::set_line_join(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.join = val;
}
void xlsx_drawing_context::set_line_endcap(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.endcap = val;
}
void xlsx_drawing_context::set_line_arrow(bool val)
{
if (current_drawing_states == NULL) return;
......@@ -2032,7 +2071,8 @@ void xlsx_drawing_context::set_arrow_start (int val)
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.arrow.start = val;
current_drawing_states->back()->line.arrow.start = val;
current_drawing_states->back()->line.arrow.enabled = true;
}
void xlsx_drawing_context::set_arrow_end (int val)
{
......@@ -2040,6 +2080,7 @@ void xlsx_drawing_context::set_arrow_end (int val)
if (current_drawing_states->empty()) return;
current_drawing_states->back()->line.arrow.end = val;
current_drawing_states->back()->line.arrow.enabled = true;
}
void xlsx_drawing_context::set_arrow_start_width (int val)
{
......@@ -2375,6 +2416,41 @@ void xlsx_drawing_context::set_custom_path (int type_path)
current_drawing_states->back()->custom_path = type_path;
}
void xlsx_drawing_context::set_custom_connection(std::vector<ODRAW::MSOPOINT>& points)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_connection = points;
}
void xlsx_drawing_context::set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_connectionDir = points;
}
void xlsx_drawing_context::set_custom_inscribe(std::vector<ODRAW::MSORECT>& rects)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_inscribe = rects;
}
void xlsx_drawing_context::set_custom_x_limo(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_x_limo = val;
}
void xlsx_drawing_context::set_custom_y_limo(int val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->custom_y_limo = val;
}
//----------------------------------------------------------------------------------------------------------
bool xlsx_drawing_context::get_mode_vmlwrite ()
{//comment, shapes in header/footer, ....
......@@ -2435,7 +2511,7 @@ void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
CP_XML_ATTR(L"xmlns:o" , L"urn:schemas-microsoft-com:office:office");
CP_XML_ATTR(L"xmlns:x" , L"urn:schemas-microsoft-com:office:excel");
for (int i = 0 ; i < drawing_states_vml_HF.size(); i++)
for (size_t i = 0 ; i < drawing_states_vml_HF.size(); i++)
{
serialize_vml(CP_XML_STREAM(), drawing_states_vml_HF[i]);
}
......@@ -2471,7 +2547,7 @@ void xlsx_drawing_context::serialize_vml_comments(std::wostream & strm)
}
}
for (int i = 0 ; i < drawing_states_vml_comments.size(); i++)
for (size_t i = 0 ; i < drawing_states_vml_comments.size(); i++)
{
serialize_vml(CP_XML_STREAM(), drawing_states_vml_comments[i]);
}
......@@ -2490,7 +2566,7 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
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++)
for (size_t i = 0 ; i < drawing_states.size(); i++)
{
serialize(CP_XML_STREAM(), drawing_states[i]);
}
......
......@@ -137,10 +137,12 @@ public:
type_anchor(0),
vmlwrite_mode_(false)
{
id = -1;
rotation = 0;
parent_drawing_states = NULL;
custom_path = -1;
id = -1;
rotation = 0;
parent_drawing_states = NULL;
custom_path = -1;
custom_x_limo = 0x80000000;
custom_y_limo = 0x80000000;
}
external_items::Type type;
......@@ -179,10 +181,15 @@ public:
std::vector<ODRAW::MSOSG> custom_guides;
std::vector<ODRAW::MSOPOINT> custom_verticles;
std::vector<ODRAW::ADJH> custom_adjustHandles;
std::vector<ODRAW::MSOPOINT> custom_connection;
std::vector<ODRAW::FixedPoint> custom_connectionDir;
std::vector<ODRAW::MSORECT> custom_inscribe;
_rect custom_rect;
std::vector<_CP_OPT(int)> custom_adjustValues;
int custom_path;
int custom_x_limo;
int custom_y_limo;
//-----------------------------------------------
std::wstring hyperlink;
struct _text
......@@ -265,12 +272,15 @@ public:
};
struct _line
{
_line() { fill.color.SetRGB(0, 0, 0); width = 0; }
_line() : join(-1), endcap(-1), miter(0), width(0) { fill.color.SetRGB(0, 0, 0); }
std::wstring style;
int width;
_line_typeDash typeDash;
_fill fill;
_arrow arrow;
int miter;
int join;
int endcap;
}line;
struct _object
{
......@@ -357,6 +367,9 @@ public:
void set_arrow_end_width (int val);
void set_arrow_start_length (int val);
void set_arrow_end_length (int val);
void set_line_miter (int val);
void set_line_join (int val);
void set_line_endcap (int val);
void set_fill_old_version (_UINT32 val);
void set_line_old_version (_UINT32 val);
......@@ -399,6 +412,11 @@ public:
void set_custom_adjustHandles(std::vector<ODRAW::ADJH> & handles);
void set_custom_adjustValues(std::vector<_CP_OPT(int)> & values);
void set_custom_path (int type_path);
void set_custom_connection (std::vector<ODRAW::MSOPOINT> & points);
void set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points);
void set_custom_inscribe (std::vector<ODRAW::MSORECT> & rects);
void set_custom_x_limo (int val);
void set_custom_y_limo (int val);
//------------------------------------------------------------------------------
void serialize_group ();
void serialize_shape (_drawing_state_ptr & drawing_state);
......
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