Commit 7ccde9c7 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat pivots - fix after testing

parent 78ecdc67
...@@ -102,7 +102,7 @@ int BopPop::serialize(std::wostream & _stream) ...@@ -102,7 +102,7 @@ int BopPop::serialize(std::wostream & _stream)
{ {
CP_XML_NODE(L"c:custSplit") CP_XML_NODE(L"c:custSplit")
{ {
for (int i = 0 ; i < custom->rggrbit.pie_indices.size(); i++) for (size_t i = 0 ; i < custom->rggrbit.pie_indices.size(); i++)
{ {
CP_XML_NODE(L"c:secondPiePt") CP_XML_NODE(L"c:secondPiePt")
{ {
......
...@@ -160,7 +160,7 @@ int CF12::serialize(std::wostream & stream) ...@@ -160,7 +160,7 @@ int CF12::serialize(std::wostream & stream)
CFGradient *gradient = dynamic_cast<CFGradient*>(rgbCT.get()); CFGradient *gradient = dynamic_cast<CFGradient*>(rgbCT.get());
CP_XML_NODE(L"colorScale") CP_XML_NODE(L"colorScale")
{ {
for (int i = 0; i < gradient->rgInterp.size(); i ++) for (size_t i = 0; i < gradient->rgInterp.size(); i ++)
{ {
CP_XML_NODE(L"cfvo") CP_XML_NODE(L"cfvo")
{ {
...@@ -181,7 +181,7 @@ int CF12::serialize(std::wostream & stream) ...@@ -181,7 +181,7 @@ int CF12::serialize(std::wostream & stream)
CP_XML_ATTR(L"val", cfvo.numValue); CP_XML_ATTR(L"val", cfvo.numValue);
} }
} }
for (int i = 0; i < gradient->rgCurve.size(); i ++) for (size_t i = 0; i < gradient->rgCurve.size(); i ++)
{ {
CP_XML_NODE(L"color") CP_XML_NODE(L"color")
{ {
......
...@@ -67,15 +67,35 @@ void DConRef::readFields(CFRecord& record) ...@@ -67,15 +67,35 @@ void DConRef::readFields(CFRecord& record)
//self-reference = %x0002 sheet-name //self-reference = %x0002 sheet-name
stFile = stFile_.value(); stFile = stFile_.value();
if (stFile.substr(0, 1) == L"\x0001")
while(true)
{
bool bDel = false;
int pos = stFile.find(L"\x0001");
if (pos >= 0)
{
bDel = true;
stFile = stFile.substr(pos + 1);
}
pos = stFile.find(L"\x0002");
if (pos >= 0)
{ {
bFilePath = true; bDel = true;
stFile = stFile.substr(1); stFile = stFile.substr(pos + 1);
}
pos = stFile.find(L"\x0003");
if (pos >= 0)
{
bDel = true;
stFile = stFile.substr(pos + 1);
}
if (!bDel)
break;
} }
else if (stFile.substr(0, 1) == L"\x0002") int pos = stFile.find(L"]");
if (pos >= 0)
{ {
bSheetName = true; stFile = stFile.substr(pos + 1);
stFile = stFile.substr(1);
} }
} }
......
...@@ -66,8 +66,7 @@ int MergeCells::serialize(std::wostream & stream) ...@@ -66,8 +66,7 @@ int MergeCells::serialize(std::wostream & stream)
{ {
CP_XML_WRITER(stream) CP_XML_WRITER(stream)
{ {
for (size_t i = 0 ; i < rgref.size(); i++)
for (int i = 0 ; i < rgref.size(); i++)
{ {
Ref8* ref = dynamic_cast<Ref8*>(rgref[i].get()); Ref8* ref = dynamic_cast<Ref8*>(rgref[i].get());
CP_XML_NODE(L"mergeCell") CP_XML_NODE(L"mergeCell")
......
...@@ -86,7 +86,7 @@ int MulRk::serialize(std::wostream & stream) ...@@ -86,7 +86,7 @@ int MulRk::serialize(std::wostream & stream)
{ {
int row = GetRow(); int row = GetRow();
for (int i = 0; i < cells.size(); i++) for (size_t i = 0; i < cells.size(); i++)
{ {
Cell * cell = dynamic_cast<Cell *>(cells[i].get()); Cell * cell = dynamic_cast<Cell *>(cells[i].get());
RkRec * rkrec = dynamic_cast<RkRec *>(rgrkrec[i].get()); RkRec * rkrec = dynamic_cast<RkRec *>(rgrkrec[i].get());
......
...@@ -103,7 +103,7 @@ int Palette::serialize(std::wostream & stream) ...@@ -103,7 +103,7 @@ int Palette::serialize(std::wostream & stream)
} }
} }
for(int i = 0; i < rgColor.size(); ++i) for(size_t i = 0; i < rgColor.size(); ++i)
{ {
LongRGB * rgb = dynamic_cast<LongRGB *>(rgColor[i].get()); LongRGB * rgb = dynamic_cast<LongRGB *>(rgColor[i].get());
CP_XML_NODE(L"rgbColor") CP_XML_NODE(L"rgbColor")
......
...@@ -67,7 +67,7 @@ int SIIndex::serialize(std::wostream & _stream, int idx, const CellRef & in_ref) ...@@ -67,7 +67,7 @@ int SIIndex::serialize(std::wostream & _stream, int idx, const CellRef & in_ref)
int res = 0; int res = 0;
CP_XML_WRITER(_stream) CP_XML_WRITER(_stream)
{ {
for (int i = 0 ; i < m_arData.size(); i++) for (size_t i = 0 ; i < m_arData.size(); i++)
{ {
Number * number = dynamic_cast<Number*> (m_arData[i].get()); Number * number = dynamic_cast<Number*> (m_arData[i].get());
BoolErr * boolErr = dynamic_cast<BoolErr*>(m_arData[i].get()); BoolErr * boolErr = dynamic_cast<BoolErr*>(m_arData[i].get());
...@@ -108,7 +108,7 @@ int SIIndex::serialize(std::wostream & _stream, ChartParsedFormula & in_ref) ...@@ -108,7 +108,7 @@ int SIIndex::serialize(std::wostream & _stream, ChartParsedFormula & in_ref)
int idx = 0; int idx = 0;
CP_XML_WRITER(_stream) CP_XML_WRITER(_stream)
{ {
for (int i = 0 ; i < m_arData.size(); i++) for (size_t i = 0 ; i < m_arData.size(); i++)
{ {
Number * number = dynamic_cast<Number*> (m_arData[i].get()); Number * number = dynamic_cast<Number*> (m_arData[i].get());
BoolErr * boolErr = dynamic_cast<BoolErr*>(m_arData[i].get()); BoolErr * boolErr = dynamic_cast<BoolErr*>(m_arData[i].get());
......
...@@ -83,7 +83,7 @@ int SST::serialize(std::wostream & stream) ...@@ -83,7 +83,7 @@ int SST::serialize(std::wostream & stream)
{ {
CP_XML_WRITER(stream) CP_XML_WRITER(stream)
{ {
for (size_t i=0; i < rgb.size(); i++) for (size_t i = 0; i < rgb.size(); i++)
{ {
XLUnicodeRichExtendedString *richText = dynamic_cast<XLUnicodeRichExtendedString *>(rgb[i].get()); XLUnicodeRichExtendedString *richText = dynamic_cast<XLUnicodeRichExtendedString *>(rgb[i].get());
......
...@@ -55,6 +55,11 @@ void SXDtr::readFields(CFRecord& record) ...@@ -55,6 +55,11 @@ void SXDtr::readFields(CFRecord& record)
std::wstring SXDtr::value() std::wstring SXDtr::value()
{ {
if (mon < 1 || mon > 12) mon = 1;
if (dom < 1 || dom > 31) dom = 1;
if (yr < 1) yr = 1; //???
std::wstringstream s; std::wstringstream s;
s << yr << L"-" << (mon < 10 ? L"0" : L"") << mon << L"-" << (dom < 10 ? L"0" : L"") << dom << L"T" s << yr << L"-" << (mon < 10 ? L"0" : L"") << mon << L"-" << (dom < 10 ? L"0" : L"") << dom << L"T"
<< (hr < 10 ? L"0" : L"") << hr << L":" << (min < 10 ? L"0" : L"") << min << L":" << (sec < 10 ? L"0" : L"") << sec; << (hr < 10 ? L"0" : L"") << hr << L":" << (min < 10 ? L"0" : L"") << min << L":" << (sec < 10 ? L"0" : L"") << sec;
......
...@@ -53,15 +53,17 @@ BaseObjectPtr SXTH::clone() ...@@ -53,15 +53,17 @@ BaseObjectPtr SXTH::clone()
void SXTH::readFields(CFRecord& record) void SXTH::readFields(CFRecord& record)
{ {
_UINT32 flags1; _UINT32 flags1;
unsigned short flags2; unsigned short flags2, reserved;
record >> frtHeaderOld >> flags1 >> sxaxis >> isxvd >> csxvdXl >> flags2; record >> frtHeaderOld >> flags1 >> sxaxis >> reserved >> isxvd >> csxvdXl >> flags2;
record >> stUnique >> stDisplay >> stDefault >> stAll >> stDimension; record >> stUnique >> stDisplay >> stDefault >> stAll >> stDimension;
record >> cisxvd; record >> cisxvd;
for (int i = 0; i < cisxvd; i++) for (int i = 0; i < cisxvd; i++)
{ {
if (record.getRdPtr() + 4 > record.getDataSize())
break;
_INT32 val; _INT32 val;
record >> val; record >> val;
rgisxvd.push_back(val); rgisxvd.push_back(val);
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of Style record in BIFF8
class Style: public BiffRecord class Style: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Style) BIFF_RECORD_DEFINE_TYPE_INFO(Style)
...@@ -50,7 +48,6 @@ public: ...@@ -50,7 +48,6 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeStyle; static const ElementType type = typeStyle;
......
...@@ -39,6 +39,7 @@ namespace XLS ...@@ -39,6 +39,7 @@ namespace XLS
Theme::Theme() Theme::Theme()
{ {
nThemeDataSize = 0;
} }
Theme::~Theme() Theme::~Theme()
...@@ -54,16 +55,18 @@ void Theme::readFields(CFRecord& record) ...@@ -54,16 +55,18 @@ void Theme::readFields(CFRecord& record)
{ {
record >> frtHeader >> dwThemeVersion; record >> frtHeader >> dwThemeVersion;
if(!dwThemeVersion) if (dwThemeVersion == 124226)
{ {
Log::info("\"Theme\" binary parsing is not implemented."); //default theme
/*
std::ofstream file1("D:\\temp.xlsx", std::ios_base::binary);
file1.write(record.getCurData<char>(), (record.getDataSize() - record.getRdPtr()));
*/
} }
else if (dwThemeVersion == 0)
{
nThemeDataSize = record.getDataSize() - record.getRdPtr();
pThemeData = boost::shared_array<char>(new char[nThemeDataSize]);
memcpy(pThemeData.get(), record.getCurData<char>(), nThemeDataSize);
record.skipNunBytes(nThemeDataSize);
}
} }
} // namespace XLS } // namespace XLS
......
...@@ -54,6 +54,9 @@ public: ...@@ -54,6 +54,9 @@ public:
//----------------------------- //-----------------------------
_UINT32 dwThemeVersion; _UINT32 dwThemeVersion;
FrtHeader frtHeader; FrtHeader frtHeader;
_UINT32 nThemeDataSize;
boost::shared_array<char> pThemeData;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -55,10 +55,11 @@ void XFExt::readFields(CFRecord& record) ...@@ -55,10 +55,11 @@ void XFExt::readFields(CFRecord& record)
record >> ixfe; record >> ixfe;
record.skipNunBytes(2); // reserved record.skipNunBytes(2); // reserved
record >> cexts; record >> cexts;
while(!record.isEOF()) while(!record.isEOF())
{ {
if(record.getRdPtr() + 8 < record.getDataSize()) if(record.getRdPtr() + 4 > record.getDataSize())
break;// 8 = миним размер структуры break;// миним размер структуры
ExtPropPtr element(new ExtProp); ExtPropPtr element(new ExtProp);
record >> *element; record >> *element;
rgExt.push_back(element); rgExt.push_back(element);
......
...@@ -107,6 +107,12 @@ static std::wstring PatternType [] = ...@@ -107,6 +107,12 @@ static std::wstring PatternType [] =
int FillInfo::serialize(std::wostream & stream) int FillInfo::serialize(std::wostream & stream)
{ {
CP_XML_WRITER(stream) CP_XML_WRITER(stream)
{
if (!ext.empty())
{
stream << ext;
}
else
{ {
CP_XML_NODE(L"fill") CP_XML_NODE(L"fill")
{ {
...@@ -170,6 +176,7 @@ int FillInfo::serialize(std::wostream & stream) ...@@ -170,6 +176,7 @@ int FillInfo::serialize(std::wostream & stream)
} }
} }
} }
}
return 0; return 0;
} }
......
...@@ -79,7 +79,7 @@ struct FillInfo ...@@ -79,7 +79,7 @@ struct FillInfo
FillInfoExt foreFillInfo_; FillInfoExt foreFillInfo_;
FillInfoExt backFillInfo_; FillInfoExt backFillInfo_;
std::wstring ext;
}; };
struct BorderInfo struct BorderInfo
......
...@@ -154,7 +154,7 @@ void CellXF::load(CFRecord& record) ...@@ -154,7 +154,7 @@ void CellXF::load(CFRecord& record)
void CellXF::RegisterFillBorder() void CellXF::RegisterFillBorder()
{ {
for (int i = 0; i < ext_props.size(); i++ ) for (size_t i = 0; i < ext_props.size(); i++ )
{ {
ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get()); ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get());
......
...@@ -100,7 +100,7 @@ void ChartParsedFormula::load(CFRecord& record) ...@@ -100,7 +100,7 @@ void ChartParsedFormula::load(CFRecord& record)
bool ChartParsedFormula::inRange(const CellRef & ref) bool ChartParsedFormula::inRange(const CellRef & ref)
{ {
for (int i = 0 ; i < cell_ranges.size(); i++) for (size_t i = 0 ; i < cell_ranges.size(); i++)
{ {
if (cell_ranges[i].inRange(ref)) if (cell_ranges[i].inRange(ref))
{ {
......
...@@ -46,6 +46,11 @@ BiffStructurePtr ExtProp::clone() ...@@ -46,6 +46,11 @@ BiffStructurePtr ExtProp::clone()
void ExtProp::load(CFRecord& record) void ExtProp::load(CFRecord& record)
{ {
record >> extType >> cb; record >> extType >> cb;
if ((int)(cb - 4) > (int)(record.getDataSize() - record.getRdPtr()))
{
return;
}
switch(extType) switch(extType)
{ {
case 0x0004: case 0x0004:
......
...@@ -78,7 +78,7 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record) ...@@ -78,7 +78,7 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
{ {
} }
for (int i = 0 ; i < child_records.size(); i++) for (size_t i = 0 ; i < child_records.size(); i++)
{ {
switch(child_records[i]->rh_own.recType) switch(child_records[i]->rh_own.recType)
{ {
...@@ -87,7 +87,7 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record) ...@@ -87,7 +87,7 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
OfficeArtDgContainer * dg = dynamic_cast<OfficeArtDgContainer *>(child_records[i].get()); OfficeArtDgContainer * dg = dynamic_cast<OfficeArtDgContainer *>(child_records[i].get());
if (dg) if (dg)
{ {
for (int i = 0 ; i < dg->child_records.size(); i++) for (size_t i = 0 ; i < dg->child_records.size(); i++)
{ {
child_records.push_back(dg->child_records[i]); child_records.push_back(dg->child_records[i]);
} }
......
...@@ -94,7 +94,7 @@ namespace ODRAW ...@@ -94,7 +94,7 @@ namespace ODRAW
//shift for all trailing zeros //shift for all trailing zeros
std::bitset<sizeof(int)*8> bits( mask ); std::bitset<sizeof(int)*8> bits( mask );
for ( unsigned int i = 0; i < bits.size(); i++ ) for ( size_t i = 0; i < bits.size(); i++ )
{ {
if ( !bits[i] ) if ( !bits[i] )
{ {
......
...@@ -73,7 +73,7 @@ void OfficeArtDggContainer::loadFields(XLS::CFRecord& record) ...@@ -73,7 +73,7 @@ void OfficeArtDggContainer::loadFields(XLS::CFRecord& record)
{ {
OfficeArtContainer::loadFields(record); OfficeArtContainer::loadFields(record);
for (int i = 0 ; i < child_records.size(); i++) for (size_t i = 0 ; i < child_records.size(); i++)
{ {
switch(child_records[i]->rh_own.recType) switch(child_records[i]->rh_own.recType)
{ {
...@@ -111,7 +111,7 @@ void OfficeArtSpgrContainer::loadFields(XLS::CFRecord& record) ...@@ -111,7 +111,7 @@ void OfficeArtSpgrContainer::loadFields(XLS::CFRecord& record)
{ {
OfficeArtContainer::loadFields(record); OfficeArtContainer::loadFields(record);
//for (int i = 0 ; i < child_records.size(); i++) //for (size_t i = 0 ; i < child_records.size(); i++)
//{ //{
// switch(child_records[i]->rh_own.recType) // switch(child_records[i]->rh_own.recType)
// { // {
...@@ -128,7 +128,7 @@ void OfficeArtSpContainer::loadFields(XLS::CFRecord& record) ...@@ -128,7 +128,7 @@ void OfficeArtSpContainer::loadFields(XLS::CFRecord& record)
{ {
OfficeArtContainer::loadFields(record); OfficeArtContainer::loadFields(record);
for (int i = 0 ; i < child_records.size(); i++) for (size_t i = 0 ; i < child_records.size(); i++)
{ {
switch(child_records[i]->rh_own.recType) switch(child_records[i]->rh_own.recType)
{ {
......
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
*/ */
#include "StyleXF.h" #include "StyleXF.h"
#include "xfProps.h"
#include "ExtProp.h" #include "ExtProp.h"
#include <Binary/CFRecord.h> #include <Binary/CFRecord.h>
namespace XLS namespace XLS
...@@ -139,14 +141,10 @@ void StyleXF::load(CFRecord& record) ...@@ -139,14 +141,10 @@ void StyleXF::load(CFRecord& record)
fill.icvFore = GETBITS(flags4, 0, 6); fill.icvFore = GETBITS(flags4, 0, 6);
fill.icvBack = GETBITS(flags4, 7, 13); fill.icvBack = GETBITS(flags4, 7, 13);
} }
} }
void StyleXF::Update(ExtProp* ext_prop)
void StyleXF::RegisterFillBorder()
{ {
for (int i = 0; i < ext_props.size(); i++ ) if (!ext_prop) return;
{
ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get());
switch(ext_prop->extType) switch(ext_prop->extType)
{ {
...@@ -201,23 +199,42 @@ void StyleXF::RegisterFillBorder() ...@@ -201,23 +199,42 @@ void StyleXF::RegisterFillBorder()
//case 0x000B: //diag color //case 0x000B: //diag color
//case 0x000C: //diag color //case 0x000C: //diag color
case 0x000D: case 0x000D:
{
font_color.enabled = true; font_color.enabled = true;
font_color.icv = ext_prop->extPropData.color.icv; font_color.icv = ext_prop->extPropData.color.icv;
font_color.xclrType = ext_prop->extPropData.color.xclrType; font_color.xclrType = ext_prop->extPropData.color.xclrType;
font_color.nTintShade = ext_prop->extPropData.color.nTintShade; font_color.nTintShade = ext_prop->extPropData.color.nTintShade;
font_color.xclrValue = ext_prop->extPropData.color.xclrValue; font_color.xclrValue = ext_prop->extPropData.color.xclrValue;
break; }break;
//case 0x0006: //case 0x0006:
// extPropData.gradient_fill.toXML(own_tag); // extPropData.gradient_fill.toXML(own_tag);
// break; // break;
case 0x000E: case 0x000E:
{
font_id = ext_prop->extPropData.font_scheme; font_id = ext_prop->extPropData.font_scheme;
break; }break;
case 0x000F: case 0x000F:
{
cIndent = ext_prop->extPropData.indent_level; cIndent = ext_prop->extPropData.indent_level;
break; }break;
} }
}
void StyleXF::Update(XFProps* xfProps)
{
if (!xfProps) return;
std::wstringstream strm;
xfProps->serialize_fill(strm);
fill.ext = strm.str();
}
void StyleXF::RegisterFillBorder()
{
for (size_t i = 0; i < ext_props.size(); i++ )
{
ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get());
Update (ext_prop);
} }
border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border); border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border);
fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill); fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill);
......
...@@ -36,8 +36,10 @@ ...@@ -36,8 +36,10 @@
namespace XLS namespace XLS
{ {
class XFProps;
class ExtProp;
class CFRecord; class CFRecord;
class GlobalWorkbookInfo; class GlobalWorkbookInfo;
typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr; typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr;
...@@ -50,13 +52,15 @@ public: ...@@ -50,13 +52,15 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
GlobalWorkbookInfoPtr m_GlobalWorkbookInfo; GlobalWorkbookInfoPtr m_GlobalWorkbookInfo;
static const ElementType type = typeStyleXF; static const ElementType type = typeStyleXF;
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
void Update(ExtProp* extProp); // xls style
void Update(XFProps* xfProps); //xlsx style
void RegisterFillBorder(); void RegisterFillBorder();
unsigned char alc; unsigned char alc;
......
...@@ -70,12 +70,13 @@ int XFPropColor::serialize(std::wostream & stream) ...@@ -70,12 +70,13 @@ int XFPropColor::serialize(std::wostream & stream)
{ {
case 0: CP_XML_ATTR(L"auto", 1); break; case 0: CP_XML_ATTR(L"auto", 1); break;
case 1: CP_XML_ATTR(L"indexed", icv); break; case 1: CP_XML_ATTR(L"indexed", icv); break;
case 2: CP_XML_ATTR(L"rgb", dwRgba.strRGB); break; case 2:
case 3: CP_XML_ATTR(L"theme", icv); break; case 3: CP_XML_ATTR(L"rgb", dwRgba.strRGB); break;
//CP_XML_ATTR(L"theme", icv); break;
} }
if (nTintShade != 0) if (nTintShade != 0)
{ {
CP_XML_ATTR(L"tint", nTintShade); CP_XML_ATTR(L"tint", nTintShade/ 32767.0);
} }
} }
} }
......
...@@ -110,73 +110,48 @@ void XFProps::load(CFRecord& record) ...@@ -110,73 +110,48 @@ void XFProps::load(CFRecord& record)
} }
} }
} }
int XFProps::serialize(std::wostream & stream, bool dxf)
int XFProps::serialize_fill(std::wostream & stream)
{ {
if (arXFPropFill.empty()) return 0;
CP_XML_WRITER(stream) CP_XML_WRITER(stream)
{ {
if (arXFPropFont.size() > 0) XFProp *pPatternType = NULL;
{
CP_XML_NODE(L"font")
{
for (int i = 0; i < arXFPropFont.size(); i++)
{
arXFPropFont[i].serialize(CP_XML_STREAM());
}
}
}
if (arXFPropNumFmt.size() > 0)
{
CP_XML_NODE(L"numFmt")
{
for (int i = 0; i < arXFPropNumFmt.size(); i++)
{
if (dxf)
{
arXFPropNumFmt[i].serialize_attr(CP_GET_XML_NODE());
}
else
{
arXFPropNumFmt[i].serialize(CP_XML_STREAM());
}
}
}
}
if (arXFPropFill.size() > 0)
{
XFProp pPatternType;
XFPropGradient *pGradient = NULL; XFPropGradient *pGradient = NULL;
for (int i = 0; i < arXFPropFill.size(); i++) for (size_t i = 0; i < arXFPropFill.size(); i++)
{ {
switch(arXFPropFill[i].xfPropType) switch(arXFPropFill[i].xfPropType)
{ {
case 0: pPatternType = arXFPropFill[i]; break; case 1:
case 0: pPatternType = &arXFPropFill[i]; break;
case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i].xfPropDataBlob.get()); break; case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i].xfPropDataBlob.get()); break;
} }
} }
CP_XML_NODE(L"fill") CP_XML_NODE(L"fill")
{ {
if (pGradient || arXFPropGradient.size()>0) if (pGradient || arXFPropGradient.size() > 0)
{ {
CP_XML_NODE(L"gradientFill") CP_XML_NODE(L"gradientFill")
{ {
if (pGradient) if (pGradient)
pGradient->serialize_attr(CP_GET_XML_NODE()); pGradient->serialize_attr(CP_GET_XML_NODE());
for (int i = 0 ; i < arXFPropGradient.size(); i++) for (size_t i = 0 ; i < arXFPropGradient.size(); i++)
{ {
if (arXFPropGradient[i].xfPropDataBlob == NULL) continue; if (arXFPropGradient[i].xfPropDataBlob == NULL) continue;
arXFPropGradient[i].xfPropDataBlob->serialize(CP_XML_STREAM()); arXFPropGradient[i].xfPropDataBlob->serialize(CP_XML_STREAM());
} }
} }
} }
else else if (pPatternType)
{ {
CP_XML_NODE(L"patternFill") CP_XML_NODE(L"patternFill")
{ {
pPatternType.serialize_attr(CP_GET_XML_NODE()); pPatternType->serialize_attr(CP_GET_XML_NODE());
for (int i = 0; i < arXFPropFill.size(); i++) for (size_t i = 0; i < arXFPropFill.size(); i++)
{ {
arXFPropFill[i].serialize(CP_XML_STREAM()); arXFPropFill[i].serialize(CP_XML_STREAM());
} }
...@@ -184,11 +159,48 @@ int XFProps::serialize(std::wostream & stream, bool dxf) ...@@ -184,11 +159,48 @@ int XFProps::serialize(std::wostream & stream, bool dxf)
} }
} }
} }
return 0;
}
int XFProps::serialize(std::wostream & strm, bool dxf)
{
CP_XML_WRITER(strm)
{
if (arXFPropFont.size() > 0)
{
CP_XML_NODE(L"font")
{
for (size_t i = 0; i < arXFPropFont.size(); i++)
{
arXFPropFont[i].serialize(CP_XML_STREAM());
}
}
}
if (arXFPropNumFmt.size() > 0)
{
CP_XML_NODE(L"numFmt")
{
for (size_t i = 0; i < arXFPropNumFmt.size(); i++)
{
if (dxf)
{
arXFPropNumFmt[i].serialize_attr(CP_GET_XML_NODE());
}
else
{
arXFPropNumFmt[i].serialize(CP_XML_STREAM());
}
}
}
}
serialize_fill(strm);
if (arXFPropAlignment.size() > 0) if (arXFPropAlignment.size() > 0)
{ {
CP_XML_NODE(L"alignment") CP_XML_NODE(L"alignment")
{ {
for (int i = 0; i < arXFPropAlignment.size(); i++) for (size_t i = 0; i < arXFPropAlignment.size(); i++)
{ {
arXFPropAlignment[i].serialize(CP_XML_STREAM()); arXFPropAlignment[i].serialize(CP_XML_STREAM());
} }
...@@ -205,7 +217,7 @@ int XFProps::serialize(std::wostream & stream, bool dxf) ...@@ -205,7 +217,7 @@ int XFProps::serialize(std::wostream & stream, bool dxf)
if (arXFPropBorder.bottom) arXFPropBorder.bottom->serialize(CP_XML_STREAM()); if (arXFPropBorder.bottom) arXFPropBorder.bottom->serialize(CP_XML_STREAM());
//---------------------------------------- //----------------------------------------
for (int i = 0; i < arXFPropBorder.other.size(); i++) for (size_t i = 0; i < arXFPropBorder.other.size(); i++)
{ {
arXFPropBorder.other[i].serialize(CP_XML_STREAM()); arXFPropBorder.other[i].serialize(CP_XML_STREAM());
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#pragma once #pragma once
#include "BiffStructure.h" #include "BiffStructure.h"
#include "../Biff_structures/XFProp.h" #include "XFProp.h"
namespace XLS namespace XLS
{ {
...@@ -47,7 +47,6 @@ public: ...@@ -47,7 +47,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
static const ElementType type = typeXFProps; static const ElementType type = typeXFProps;
unsigned short cprops; unsigned short cprops;
...@@ -55,6 +54,8 @@ public: ...@@ -55,6 +54,8 @@ public:
int serialize(std::wostream & stream){ return serialize(stream, false) ; } int serialize(std::wostream & stream){ return serialize(stream, false) ; }
int serialize(std::wostream & stream, bool dxf); int serialize(std::wostream & stream, bool dxf);
int serialize_fill(std::wostream & stream);
std::vector<XFProp> arXFPropFont; std::vector<XFProp> arXFPropFont;
std::vector<XFProp> arXFPropNumFmt; std::vector<XFProp> arXFPropNumFmt;
std::vector<XFProp> arXFPropFill; std::vector<XFProp> arXFPropFill;
......
...@@ -112,7 +112,7 @@ int XLUnicodeRichExtendedString::serialize (std::wostream & _stream) ...@@ -112,7 +112,7 @@ int XLUnicodeRichExtendedString::serialize (std::wostream & _stream)
CP_XML_WRITER(_stream) CP_XML_WRITER(_stream)
{ {
for (int i = 0 ; i < rgRun.size(); i++) for (size_t i = 0 ; i < rgRun.size(); i++)
{ {
CP_XML_NODE(L"r") CP_XML_NODE(L"r")
{ {
......
...@@ -187,7 +187,7 @@ int AUTOFILTER::serialize(std::wostream & stream) ...@@ -187,7 +187,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
{ {
CP_XML_ATTR(L"ref", ref); CP_XML_ATTR(L"ref", ref);
for (int i = 0 ; i < m_arFilters.size(); i++)//todooo сделать на оставшиеся - count_columns (hidden) for (size_t i = 0 ; i < m_arFilters.size(); i++)//todooo сделать на оставшиеся - count_columns (hidden)
{ {
AutoFilter * filter = dynamic_cast<AutoFilter*>(m_arFilters[i].get()); AutoFilter * filter = dynamic_cast<AutoFilter*>(m_arFilters[i].get());
CP_XML_NODE(L"filterColumn") CP_XML_NODE(L"filterColumn")
...@@ -214,12 +214,12 @@ int AUTOFILTER::serialize(std::wostream & stream) ...@@ -214,12 +214,12 @@ int AUTOFILTER::serialize(std::wostream & stream)
std::map<int, std::vector<BaseObjectPtr>>::iterator itF = m_mapFilters12.find(filter->iEntry); std::map<int, std::vector<BaseObjectPtr>>::iterator itF = m_mapFilters12.find(filter->iEntry);
if (itF != m_mapFilters12.end()) if (itF != m_mapFilters12.end())
{ {
for (int j = 0 ; j < itF->second.size(); j++) for (size_t j = 0 ; j < itF->second.size(); j++)
{ {
AutoFilter12* af12 = dynamic_cast<AutoFilter12*>(itF->second[j].get()); AutoFilter12* af12 = dynamic_cast<AutoFilter12*>(itF->second[j].get());
if (af12 == NULL) continue; if (af12 == NULL) continue;
for (int k = 0 ; k < af12->rgbAF12Criteries.size(); k++) for (size_t k = 0 ; k < af12->rgbAF12Criteries.size(); k++)
{ {
AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(af12->rgbAF12Criteries[k].get()); AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(af12->rgbAF12Criteries[k].get());
if (af12Criteria == NULL) continue; if (af12Criteria == NULL) continue;
......
...@@ -225,7 +225,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary) ...@@ -225,7 +225,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary)
{ {
CatSerRange * iv_CatSerRange = NULL; CatSerRange * iv_CatSerRange = NULL;
for (int i = 0 ; i < m_arAxes.size(); i++) for (size_t i = 0 ; i < m_arAxes.size(); i++)
{ {
IVAXIS * iv = dynamic_cast<IVAXIS*> (m_arAxes[i].get()); IVAXIS * iv = dynamic_cast<IVAXIS*> (m_arAxes[i].get());
if (iv) if (iv)
...@@ -237,7 +237,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary) ...@@ -237,7 +237,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary)
} }
CP_XML_WRITER(_stream) CP_XML_WRITER(_stream)
{ {
for (int i = 0 ; i < m_arAxes.size(); i++) for (size_t i = 0 ; i < m_arAxes.size(); i++)
{ {
IVAXIS * iv = dynamic_cast<IVAXIS*> (m_arAxes[i].get()); IVAXIS * iv = dynamic_cast<IVAXIS*> (m_arAxes[i].get());
DVAXIS * dv = dynamic_cast<DVAXIS*> (m_arAxes[i].get()); DVAXIS * dv = dynamic_cast<DVAXIS*> (m_arAxes[i].get());
...@@ -263,7 +263,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary) ...@@ -263,7 +263,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary)
CP_XML_NODE(node_ax_type) CP_XML_NODE(node_ax_type)
{ {
ATTACHEDLABEL *label = NULL; ATTACHEDLABEL *label = NULL;
for ( int h = 0 ; h < m_arATTACHEDLABEL.size(); h++) for ( size_t h = 0 ; h < m_arATTACHEDLABEL.size(); h++)
{ {
ATTACHEDLABEL *l_= dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[h].get() ); ATTACHEDLABEL *l_= dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[h].get() );
...@@ -309,7 +309,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary) ...@@ -309,7 +309,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary)
// } // }
//} //}
for (int j = 0 ; j < m_arAxesId.size(); j++) for (size_t j = 0 ; j < m_arAxesId.size(); j++)
{ {
if (m_arAxesId[j].first != m_arAxesId[i].first && m_arAxesId[j].second != 3) if (m_arAxesId[j].first != m_arAxesId[i].first && m_arAxesId[j].second != 3)
{ {
......
...@@ -104,7 +104,7 @@ void AXISPARENT::concatinate_second (BaseObjectPtr & addit) ...@@ -104,7 +104,7 @@ void AXISPARENT::concatinate_second (BaseObjectPtr & addit)
if (second == NULL) return; if (second == NULL) return;
for (int i = 0; i < second->m_arCRT.size(); i++) for (size_t i = 0; i < second->m_arCRT.size(); i++)
{ {
CRT* crt = dynamic_cast<CRT*>(second->m_arCRT[i].get()); CRT* crt = dynamic_cast<CRT*>(second->m_arCRT[i].get());
crt->m_indAXISPARENT = 1; crt->m_indAXISPARENT = 1;
......
...@@ -161,7 +161,7 @@ int AXS::serialize(std::wostream & _stream) ...@@ -161,7 +161,7 @@ int AXS::serialize(std::wostream & _stream)
CP_XML_WRITER(_stream) CP_XML_WRITER(_stream)
{ {
for (int i = 0 ; i < m_AxisLine_Format.size(); i++) for (size_t i = 0 ; i < m_AxisLine_Format.size(); i++)
{ {
std::wstring grid; std::wstring grid;
......
...@@ -283,7 +283,7 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc) ...@@ -283,7 +283,7 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc)
} }
BaseObjectPtr CHARTFORMATS::find_label( _UINT16 link_id, unsigned short ex) BaseObjectPtr CHARTFORMATS::find_label( _UINT16 link_id, unsigned short ex)
{ {
for (int i = 0 ; i < m_arATTACHEDLABEL.size(); i++) for (size_t i = 0 ; i < m_arATTACHEDLABEL.size(); i++)
{ {
ATTACHEDLABEL * label = dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[i].get()); ATTACHEDLABEL * label = dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[i].get());
ObjectLink * obj_link = dynamic_cast<ObjectLink *> (label->m_ObjectLink.get()); ObjectLink * obj_link = dynamic_cast<ObjectLink *> (label->m_ObjectLink.get());
...@@ -306,7 +306,7 @@ std::vector<std::pair<int, BaseObjectPtr>> CHARTFORMATS::find_labels( _UINT16 li ...@@ -306,7 +306,7 @@ std::vector<std::pair<int, BaseObjectPtr>> CHARTFORMATS::find_labels( _UINT16 li
{ {
std::vector<std::pair<int, BaseObjectPtr>> result; std::vector<std::pair<int, BaseObjectPtr>> result;
for (int i = 0 ; i < m_arATTACHEDLABEL.size(); i++) for (size_t i = 0 ; i < m_arATTACHEDLABEL.size(); i++)
{ {
ATTACHEDLABEL * label = dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[i].get()); ATTACHEDLABEL * label = dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[i].get());
ObjectLink * obj_link = dynamic_cast<ObjectLink *> (label->m_ObjectLink.get()); ObjectLink * obj_link = dynamic_cast<ObjectLink *> (label->m_ObjectLink.get());
......
...@@ -110,7 +110,7 @@ int CONDFMT12::serialize(std::wostream & stream) ...@@ -110,7 +110,7 @@ int CONDFMT12::serialize(std::wostream & stream)
CP_XML_ATTR(L"sqref", condFmt->mainCF.sqref.strValue); CP_XML_ATTR(L"sqref", condFmt->mainCF.sqref.strValue);
//condition_id //condition_id
//condition_pos //condition_pos
for (int i = 0; i < m_arCF12.size(); i++) for (size_t i = 0; i < m_arCF12.size(); i++)
{ {
if (m_arCF12[i] == NULL) continue; if (m_arCF12[i] == NULL) continue;
m_arCF12[i]->serialize(CP_XML_STREAM()); m_arCF12[i]->serialize(CP_XML_STREAM());
......
...@@ -120,7 +120,7 @@ const bool CONDFMTS::loadContent(BinProcessor& proc) ...@@ -120,7 +120,7 @@ const bool CONDFMTS::loadContent(BinProcessor& proc)
count--; count--;
} }
for (int i = 0 ; i < m_arCFEx.size(); i++) for (size_t i = 0 ; i < m_arCFEx.size(); i++)
{ {
if (!m_arCFEx[i]) continue; if (!m_arCFEx[i]) continue;
...@@ -129,7 +129,7 @@ const bool CONDFMTS::loadContent(BinProcessor& proc) ...@@ -129,7 +129,7 @@ const bool CONDFMTS::loadContent(BinProcessor& proc)
{ {
int ind_cf = cfEx->content.icf; int ind_cf = cfEx->content.icf;
for (int j = 0 ; j < m_arCONDFMT.size(); j++) for (size_t j = 0 ; j < m_arCONDFMT.size(); j++)
{ {
CONDFMT * CONDFMT_ = dynamic_cast<CONDFMT *>(m_arCONDFMT[j].get()); CONDFMT * CONDFMT_ = dynamic_cast<CONDFMT *>(m_arCONDFMT[j].get());
if (CONDFMT_/* && cfEx->fIsCF12 == 0*/) if (CONDFMT_/* && cfEx->fIsCF12 == 0*/)
...@@ -166,7 +166,7 @@ int CONDFMTS::serialize(std::wostream & stream) ...@@ -166,7 +166,7 @@ int CONDFMTS::serialize(std::wostream & stream)
{ {
if (m_arCONDFMT.empty()) return 0; if (m_arCONDFMT.empty()) return 0;
for (int i = 0 ; i < m_arCONDFMT.size(); i++) for (size_t i = 0 ; i < m_arCONDFMT.size(); i++)
{ {
if (!m_arCONDFMT[i]) continue; if (!m_arCONDFMT[i]) continue;
m_arCONDFMT[i]->serialize(stream); m_arCONDFMT[i]->serialize(stream);
......
...@@ -112,7 +112,7 @@ int CONDFMT::serialize(std::wostream & stream) ...@@ -112,7 +112,7 @@ int CONDFMT::serialize(std::wostream & stream)
CP_XML_ATTR(L"sqref", condFmt->sqref.strValue); CP_XML_ATTR(L"sqref", condFmt->sqref.strValue);
//condition_id //condition_id
//condition_pos //condition_pos
for (int i = 0; i < m_arCF.size(); i++) for (size_t i = 0; i < m_arCF.size(); i++)
{ {
if (m_arCF[i] == NULL) continue; if (m_arCF[i] == NULL) continue;
......
...@@ -181,7 +181,7 @@ int CUSTOMVIEW::serialize(std::wostream & stream) ...@@ -181,7 +181,7 @@ int CUSTOMVIEW::serialize(std::wostream & stream)
else else
CP_XML_ATTR(L"state", L"split"); CP_XML_ATTR(L"state", L"split");
} }
for (int i = 0; i < m_arSelection.size(); i++) for (size_t i = 0; i < m_arSelection.size(); i++)
{ {
if (m_arSelection[i] == NULL) continue; if (m_arSelection[i] == NULL) continue;
m_arSelection[i]->serialize(CP_XML_STREAM()); m_arSelection[i]->serialize(CP_XML_STREAM());
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
*/ */
#include "DREF.h" #include "DREF.h"
#include <Logic/Biff_records/DConName.h> #include "../Biff_records/DConName.h"
#include <Logic/Biff_records/DConBin.h> #include "../Biff_records/DConBin.h"
#include <Logic/Biff_records/DConRef.h> #include "../Biff_records/DConRef.h"
namespace XLS namespace XLS
{ {
......
...@@ -88,7 +88,7 @@ int DVAL::serialize(std::wostream & stream) ...@@ -88,7 +88,7 @@ int DVAL::serialize(std::wostream & stream)
DVal * dval = dynamic_cast<DVal*>(m_DVal.get()); DVal * dval = dynamic_cast<DVal*>(m_DVal.get());
for (int i = 0 ; i < m_arDv.size(); i++) for (size_t i = 0 ; i < m_arDv.size(); i++)
{ {
if (!m_arDv[i]) continue; if (!m_arDv[i]) continue;
......
...@@ -254,10 +254,9 @@ int FDB::serialize(std::wostream & strm, bool bSql) ...@@ -254,10 +254,9 @@ int FDB::serialize(std::wostream & strm, bool bSql)
{ {
CP_XML_ATTR(L"containsSemiMixedTypes", 1); CP_XML_ATTR(L"containsSemiMixedTypes", 1);
} }
else if ((bDate & bString) || (bEmpty & bInteger & bString)) else if ((bDate & bString) || ((bEmpty || !bNumber) & bInteger & bString))
{ {
if (bEmpty && bInteger) if (bInteger) bNumber = true;
bNumber = true;
CP_XML_ATTR(L"containsMixedTypes", 1); CP_XML_ATTR(L"containsMixedTypes", 1);
} }
else if (!bEmpty && !bString && !bBool) else if (!bEmpty && !bString && !bBool)
......
...@@ -31,18 +31,22 @@ ...@@ -31,18 +31,22 @@
*/ */
#include "FORMATTING.h" #include "FORMATTING.h"
#include <Logic/Biff_records/Font.h> #include "TABLESTYLES.h"
#include <Logic/Biff_records/Format.h> #include "XFS.h"
#include <Logic/Biff_records/DXF.h> #include "THEME.h"
#include <Logic/Biff_unions/STYLES.h> #include "STYLES.h"
#include <Logic/Biff_records/Palette.h>
#include <Logic/Biff_records/ClrtClient.h>
#include <Logic/Biff_records/TableStyles.h>
#include <Logic/Biff_records/Compat12.h>
#include <Logic/Biff_unions/TABLESTYLES.h>
#include <Logic/Biff_unions/XFS.h>
#include <Logic/Biff_unions/THEME.h>
#include "../Biff_records/XF.h"
#include "../Biff_records/Font.h"
#include "../Biff_records/Format.h"
#include "../Biff_records/DXF.h"
#include "../Biff_records/Palette.h"
#include "../Biff_records/ClrtClient.h"
#include "../Biff_records/TableStyles.h"
#include "../Biff_records/Compat12.h"
#include "../Biff_records/Style.h"
#include "../Biff_records/StyleExt.h"
namespace XLS namespace XLS
{ {
...@@ -141,9 +145,53 @@ const bool FORMATTING::loadContent(BinProcessor& proc) ...@@ -141,9 +145,53 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
elements_.pop_back(); elements_.pop_back();
} }
update_xfs();
return true; return true;
} }
void FORMATTING::update_xfs()
{
STYLES * st = dynamic_cast<STYLES*>(m_Styles.get());
XFS * xfs = dynamic_cast<XFS*>(m_XFS.get());
if (!xfs) return;
//for (size_t i = 0; (st) && (i < st->m_arStyles.size()); i++)
//{
// XLS::Style * style = dynamic_cast<Style*>(st->m_arStyles[i].first.get());
// XLS::StyleExt * styleExt = dynamic_cast<StyleExt*>(st->m_arStyles[i].second.get());
//
// if (styleExt && style)
// {
// if (styleExt->fBuiltIn && styleExt->xfProps.cprops > 0)
// {
// bool bFound = false;
// for (size_t i = 0; i < xfs->m_arCellStyles.size(); i++)
// {
// XF* xf = dynamic_cast<XF*>(xfs->m_arCellStyles[i].get());
// if (xf->ind_xf == style->ixfe)
// {
// xf->style.Update(&styleExt->xfProps);
// bFound = true;
// break;
// }
// }
// //for (size_t i = 0; !bFound && i < xfs->m_arCellXFs.size(); i++)
// //{
// // XF* xf = dynamic_cast<XF*>(xfs->m_arCellXFs[i].get());
// // if (xf->ind_xf == style->ixfe)
// // {
// // xf->cell.Update(&styleExt->xfProps);
// // bFound = true;
// // break;
// // }
// //}
// }
// }
//}
xfs->RegisterFillBorder();
}
void FORMATTING::concatinate(FORMATTING* ext) void FORMATTING::concatinate(FORMATTING* ext)
{ {
if (ext->m_XFS) if (ext->m_XFS)
...@@ -180,7 +228,7 @@ int FORMATTING::serialize1(std::wostream & stream) ...@@ -180,7 +228,7 @@ int FORMATTING::serialize1(std::wostream & stream)
CP_XML_NODE(L"numFmts") CP_XML_NODE(L"numFmts")
{ {
CP_XML_ATTR(L"count", m_arFormats.size()); CP_XML_ATTR(L"count", m_arFormats.size());
for (int i = 0 ; i < m_arFormats.size(); i++) for (size_t i = 0 ; i < m_arFormats.size(); i++)
{ {
m_arFormats[i]->serialize(CP_XML_STREAM()); m_arFormats[i]->serialize(CP_XML_STREAM());
} }
...@@ -191,7 +239,7 @@ int FORMATTING::serialize1(std::wostream & stream) ...@@ -191,7 +239,7 @@ int FORMATTING::serialize1(std::wostream & stream)
CP_XML_NODE(L"fonts") CP_XML_NODE(L"fonts")
{ {
CP_XML_ATTR(L"count", m_arFonts.size()); CP_XML_ATTR(L"count", m_arFonts.size());
for (int i = 0 ; i < m_arFonts.size(); i++) for (size_t i = 0 ; i < m_arFonts.size(); i++)
{ {
Font * font = dynamic_cast<Font*>(m_arFonts[i].get()); Font * font = dynamic_cast<Font*>(m_arFonts[i].get());
std::map<int, FillInfoExt>::iterator it = global_info->fonts_color_ext.find(i); std::map<int, FillInfoExt>::iterator it = global_info->fonts_color_ext.find(i);
...@@ -225,7 +273,7 @@ int FORMATTING::serialize2(std::wostream & stream) ...@@ -225,7 +273,7 @@ int FORMATTING::serialize2(std::wostream & stream)
{ {
CP_XML_ATTR(L"count", global_info->cellStyleDxfs_count); CP_XML_ATTR(L"count", global_info->cellStyleDxfs_count);
for (int i = 0 ; i < m_arDXF.size(); i++) for (size_t i = 0 ; i < m_arDXF.size(); i++)
{ {
m_arDXF[i]->serialize(CP_XML_STREAM()); m_arDXF[i]->serialize(CP_XML_STREAM());
} }
......
...@@ -53,6 +53,7 @@ public: ...@@ -53,6 +53,7 @@ public:
int serialize2(std::wostream & stream); int serialize2(std::wostream & stream);
void concatinate(FORMATTING* ext); void concatinate(FORMATTING* ext);
void update_xfs();
static const ElementType type = typeFORMATTING; static const ElementType type = typeFORMATTING;
......
...@@ -110,7 +110,7 @@ const bool FORMULA::loadContent(BinProcessor& proc) ...@@ -110,7 +110,7 @@ const bool FORMULA::loadContent(BinProcessor& proc)
if ((formula) && (formula->fShrFmla)) if ((formula) && (formula->fShrFmla))
{ {
for (int i = 0; i < shared_formulas_locations_ref_.size(); i++) for (size_t i = 0; i < shared_formulas_locations_ref_.size(); i++)
{ {
if (shared_formulas_locations_ref_[i].inRange(location)) m_sharedIndex = i; if (shared_formulas_locations_ref_[i].inRange(location)) m_sharedIndex = i;
} }
......
...@@ -151,7 +151,7 @@ int LBL::serialize(std::wostream & stream) ...@@ -151,7 +151,7 @@ int LBL::serialize(std::wostream & stream)
if ((lbl->itab == 0) && (res = value.find(L"#REF!")) >= 0) if ((lbl->itab == 0) && (res = value.find(L"#REF!")) >= 0)
{ {
for (int i = 0 ; i < lbl->rgce.rgce.sequence.size(); i++) for (size_t i = 0 ; i < lbl->rgce.rgce.sequence.size(); i++)
{ {
PtgRef3d* ptg = dynamic_cast<PtgRef3d*>(lbl->rgce.rgce.sequence[i].get()); PtgRef3d* ptg = dynamic_cast<PtgRef3d*>(lbl->rgce.rgce.sequence[i].get());
if (ptg) if (ptg)
......
...@@ -103,8 +103,6 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -103,8 +103,6 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
global_info_->idPivotCache = streamId->idStm; global_info_->idPivotCache = streamId->idStm;
global_info_->mapPivotCacheIndex.insert(std::make_pair(global_info_->idPivotCache, global_info_->mapPivotCacheIndex.size()));
PIVOTCACHE* pivot_cache = dynamic_cast<PIVOTCACHE*>(pFind->second.get()); PIVOTCACHE* pivot_cache = dynamic_cast<PIVOTCACHE*>(pFind->second.get());
if (!pivot_cache) return 0; if (!pivot_cache) return 0;
...@@ -113,6 +111,13 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -113,6 +111,13 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
if (!db || !db_ex)return 0; if (!db || !db_ex)return 0;
if (pivot_cache->m_arFDB.empty() && pivot_cache->m_arSXFORMULA.empty())
{
global_info_->mapPivotCacheStream.erase(pFind);
return 0;
}
global_info_->mapPivotCacheIndex.insert(std::make_pair(global_info_->idPivotCache, global_info_->mapPivotCacheIndex.size()));
bool bSql = false; bool bSql = false;
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
...@@ -122,7 +127,7 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -122,7 +127,7 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"); CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"); CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
if (pivot_cache->m_arDBB.empty() == false) if (!pivot_cache->m_arDBB.empty())
{ {
CP_XML_ATTR(L"r:id", L"rId1" ); CP_XML_ATTR(L"r:id", L"rId1" );
} }
...@@ -142,7 +147,7 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -142,7 +147,7 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
src->serialize(CP_XML_STREAM()); src->serialize(CP_XML_STREAM());
} }
if (pivot_cache->m_arFDB.empty() == false) if (!pivot_cache->m_arFDB.empty())
{ {
CP_XML_NODE(L"cacheFields") CP_XML_NODE(L"cacheFields")
{ {
...@@ -157,7 +162,7 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -157,7 +162,7 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
} }
} }
} }
if (pivot_cache->m_arSXFORMULA.empty() == false) if (!pivot_cache->m_arSXFORMULA.empty())
{ {
CP_XML_NODE(L"calculatedItems") CP_XML_NODE(L"calculatedItems")
{ {
......
...@@ -113,12 +113,16 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -113,12 +113,16 @@ int PIVOTVIEW::serialize(std::wostream & strm)
SXEx *view_ex = pivot_ex ? dynamic_cast<SXEx*>(pivot_ex->m_SXEx.get()) : NULL; SXEx *view_ex = pivot_ex ? dynamic_cast<SXEx*>(pivot_ex->m_SXEx.get()) : NULL;
SXViewEx9 *view_ex9 = pivot_ex ? dynamic_cast<SXViewEx9*>(frt9->m_SXViewEx9.get()) : NULL; SXViewEx9 *view_ex9 = pivot_ex ? dynamic_cast<SXViewEx9*>(frt9->m_SXViewEx9.get()) : NULL;
SXAddl_SXCView_SXDVer10Info *view_ex10 = addls ? dynamic_cast<SXAddl_SXCView_SXDVer10Info*>(addls->m_SXAddl_SXCView_SXDTableStyleClient.get()) : NULL; SXAddl_SXCView_SXDVer10Info *view_ex10 = addls ? dynamic_cast<SXAddl_SXCView_SXDVer10Info*>(addls->m_SXAddl_SXCView_SXDVer10Info.get()) : NULL;
SXAddl_SXCView_SXDVer12Info *view_ex12 = addls ? dynamic_cast<SXAddl_SXCView_SXDVer12Info*>(addls->m_SXAddl_SXCView_SXDTableStyleClient.get()) : NULL; SXAddl_SXCView_SXDVer12Info *view_ex12 = addls ? dynamic_cast<SXAddl_SXCView_SXDVer12Info*>(addls->m_SXAddl_SXCView_SXDVer12Info.get()) : NULL;
indexStream = global_info_->arPivotCacheStream[view->iCache]; indexStream = global_info_->arPivotCacheStream[view->iCache];
std::map<int, int>::iterator pFindIndex = global_info_->mapPivotCacheIndex.find(indexStream); std::map<int, int>::iterator pFindIndex = global_info_->mapPivotCacheIndex.find(indexStream);
if (pFindIndex == global_info_->mapPivotCacheIndex.end())
return 0;
indexCache = pFindIndex->second; indexCache = pFindIndex->second;
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
...@@ -190,6 +194,8 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -190,6 +194,8 @@ int PIVOTVIEW::serialize(std::wostream & strm)
CP_XML_ATTR(L"colPageCount", 1); CP_XML_ATTR(L"colPageCount", 1);
} }
} }
if (!core->m_arPIVOTVD.empty())
{
CP_XML_NODE(L"pivotFields") CP_XML_NODE(L"pivotFields")
{ {
CP_XML_ATTR(L"count", view->cDim);//Sxvd CP_XML_ATTR(L"count", view->cDim);//Sxvd
...@@ -198,7 +204,8 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -198,7 +204,8 @@ int PIVOTVIEW::serialize(std::wostream & strm)
core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM()); core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM());
} }
} }
if (core->m_arPIVOTIVD.size() >= 1) }
if (!core->m_arPIVOTIVD.empty())
{ {
CP_XML_NODE(L"rowFields") CP_XML_NODE(L"rowFields")
{ {
...@@ -208,7 +215,7 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -208,7 +215,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
ivd->serialize(CP_XML_STREAM()); ivd->serialize(CP_XML_STREAM());
} }
} }
if (core->m_arPIVOTLI.size() >= 1)//0 or 2 if (!core->m_arPIVOTLI.empty())//0 or 2
{ {
CP_XML_NODE(L"rowItems") CP_XML_NODE(L"rowItems")
{ {
...@@ -247,7 +254,7 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -247,7 +254,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
core->m_PIVOTPI->serialize(CP_XML_STREAM()); core->m_PIVOTPI->serialize(CP_XML_STREAM());
} }
} }
if (core->m_arSXDI.empty() == false) if (!core->m_arSXDI.empty())
{ {
CP_XML_NODE(L"dataFields") CP_XML_NODE(L"dataFields")
{ {
......
...@@ -86,7 +86,7 @@ int SORTDATA12::serialize(std::wostream & stream) ...@@ -86,7 +86,7 @@ int SORTDATA12::serialize(std::wostream & stream)
if (info->fCaseSensitive) CP_XML_ATTR(L"caseSensitive", 1); if (info->fCaseSensitive) CP_XML_ATTR(L"caseSensitive", 1);
if (info->fAltMethod) CP_XML_ATTR(L"sortMethod", L"stroke"); if (info->fAltMethod) CP_XML_ATTR(L"sortMethod", L"stroke");
for (int i = 0 ; i < info->sortCond12Array.size(); i++) for (size_t i = 0 ; i < info->sortCond12Array.size(); i++)
{ {
SortCond12 * sortCond = dynamic_cast<SortCond12 *>(info->sortCond12Array[i].get()); SortCond12 * sortCond = dynamic_cast<SortCond12 *>(info->sortCond12Array[i].get());
if (sortCond == NULL) continue; if (sortCond == NULL) continue;
......
...@@ -31,8 +31,9 @@ ...@@ -31,8 +31,9 @@
*/ */
#include "STYLES.h" #include "STYLES.h"
#include <Logic/Biff_records/Style.h>
#include <Logic/Biff_records/StyleExt.h> #include "../Biff_records/Style.h"
#include "../Biff_records/StyleExt.h"
namespace XLS namespace XLS
{ {
...@@ -84,6 +85,17 @@ const bool STYLES::loadContent(BinProcessor& proc) ...@@ -84,6 +85,17 @@ const bool STYLES::loadContent(BinProcessor& proc)
{ {
styles_count = proc.repeated<Parenthesis_STYLES_1>(0, 0); styles_count = proc.repeated<Parenthesis_STYLES_1>(0, 0);
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
{
Parenthesis_STYLES_1 * style_1 = dynamic_cast<Parenthesis_STYLES_1*>(it->get());
if (style_1)
{
m_arStyles.push_back(std::make_pair(style_1->m_Style, style_1->m_StyleEx));
}
}
elements_.clear();
if (styles_count > 0) return true; if (styles_count > 0) return true;
else return false; else return false;
} }
...@@ -98,16 +110,12 @@ int STYLES::serialize(std::wostream & stream) ...@@ -98,16 +110,12 @@ int STYLES::serialize(std::wostream & stream)
{ {
CP_XML_ATTR(L"count", styles_count); CP_XML_ATTR(L"count", styles_count);
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++) for (size_t i = 0; i < m_arStyles.size(); i++)
{
Parenthesis_STYLES_1 * style_1 = dynamic_cast<Parenthesis_STYLES_1*>(it->get());
if (style_1)
{ {
CP_XML_NODE(L"cellStyle") CP_XML_NODE(L"cellStyle")
{ {
XLS::Style * style = dynamic_cast<Style*> (style_1->m_Style.get()); XLS::Style * style = dynamic_cast<Style*> (m_arStyles[i].first.get());
XLS::StyleExt * styleExt = dynamic_cast<StyleExt*>(style_1->m_StyleEx.get()); XLS::StyleExt * styleExt = dynamic_cast<StyleExt*> (m_arStyles[i].second.get());
if (styleExt) if (styleExt)
{ {
...@@ -123,7 +131,7 @@ int STYLES::serialize(std::wostream & stream) ...@@ -123,7 +131,7 @@ int STYLES::serialize(std::wostream & stream)
} }
} }
// for (int i = 0; i < styleExt->xfProps.xfPropArray.size(); i++) // for (size_t i = 0; i < styleExt->xfProps.xfPropArray.size(); i++)
//{ //{
//} //}
} }
...@@ -151,7 +159,6 @@ int STYLES::serialize(std::wostream & stream) ...@@ -151,7 +159,6 @@ int STYLES::serialize(std::wostream & stream)
} }
} }
} }
}
else else
{ {
CP_XML_ATTR(L"count",1); CP_XML_ATTR(L"count",1);
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of STYLES union of records
class STYLES : public CompositeObject class STYLES : public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(STYLES) BASE_OBJECT_DEFINE_CLASS_NAME(STYLES)
...@@ -53,6 +51,8 @@ public: ...@@ -53,6 +51,8 @@ public:
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
std::vector<std::pair<BaseObjectPtr, BaseObjectPtr>> m_arStyles;
int styles_count; int styles_count;
}; };
......
...@@ -82,7 +82,7 @@ const bool SXOPER::loadContent(BinProcessor& proc) ...@@ -82,7 +82,7 @@ const bool SXOPER::loadContent(BinProcessor& proc)
bNumber = !bInteger; bNumber = !bInteger;
node = L"n"; node = L"n";
if (bInteger) if (bInteger)
value = std::to_wstring((int)num->num.data.value); value = std::to_wstring((_INT64)num->num.data.value);
else else
value = boost::lexical_cast<std::wstring>(num->num.data.value); value = boost::lexical_cast<std::wstring>(num->num.data.value);
} }
...@@ -97,9 +97,9 @@ const bool SXOPER::loadContent(BinProcessor& proc) ...@@ -97,9 +97,9 @@ const bool SXOPER::loadContent(BinProcessor& proc)
else if(proc.optional<SxErr>()) else if(proc.optional<SxErr>())
{ {
SxErr* err = dynamic_cast<SxErr*>(elements_.back().get()); SxErr* err = dynamic_cast<SxErr*>(elements_.back().get());
bNumber = true; //bNumber = true;
node = L"e"; node = L"e";
value = std::to_wstring(err->wbe); value = L"#VALUE!";//std::to_wstring(err->wbe);
} }
else if(proc.optional<SXString>()) else if(proc.optional<SXString>())
{ {
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
*/ */
#include "SXSRC.h" #include "SXSRC.h"
#include <Logic/Biff_unions/DREF.h> #include "DREF.h"
#include <Logic/Biff_unions/SXTBL.h> #include "SXTBL.h"
#include <Logic/Biff_unions/DBQUERY.h> #include "DBQUERY.h"
namespace XLS namespace XLS
{ {
......
...@@ -31,12 +31,16 @@ ...@@ -31,12 +31,16 @@
*/ */
#include "SXTBL.h" #include "SXTBL.h"
#include <Logic/Biff_records/SXTbl.h> #include "DREF.h"
#include <Logic/Biff_unions/DREF.h>
#include <Logic/Biff_records/SxTbpg.h>
#include <Logic/Biff_records/SXTBRGIITM.h>
#include <Logic/Biff_records/SXString.h>
#include "../Biff_records/SXTbl.h"
#include "../Biff_records/SxTbpg.h"
#include "../Biff_records/SXTBRGIITM.h"
#include "../Biff_records/SXString.h"
#include "../Biff_records/DConName.h"
#include "../Biff_records/DConBin.h"
#include "../Biff_records/DConRef.h"
namespace XLS namespace XLS
{ {
...@@ -124,11 +128,67 @@ const bool SXTBL::loadContent(BinProcessor& proc) ...@@ -124,11 +128,67 @@ const bool SXTBL::loadContent(BinProcessor& proc)
} }
return true; return true;
} }
int SXTBL::serialize(std::wostream & stream) int SXTBL::serialize(std::wostream & strm)
{ {
if (!m_SXTbl) return 0; if (!m_SXTbl) return 0;
SXTbl *tbl = dynamic_cast<SXTbl*>(m_SXTbl.get());
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"cacheSource")
{
CP_XML_ATTR(L"type", L"consolidation");
CP_XML_NODE(L"consolidation")
{
CP_XML_NODE(L"pages")
{
CP_XML_ATTR(L"count", m_arSXTBRGIITM.size());
for (size_t i = 0; i < m_arSXTBRGIITM.size(); i++)
{
SXTBRGIITM * item = dynamic_cast<SXTBRGIITM*>(m_arSXTBRGIITM[i].item.get());
CP_XML_NODE(L"page")
{
CP_XML_ATTR(L"count", item->cItems);
for (size_t j = 0; j < m_arSXTBRGIITM[i].strings.size(); j++)
{
SXString* str = dynamic_cast<SXString*>(m_arSXTBRGIITM[i].strings[i].get());
CP_XML_NODE(L"pageItem")
{
CP_XML_ATTR(L"name", str->segment.value());
}
}
}
}
}
CP_XML_NODE(L"rangeSets")
{
CP_XML_ATTR(L"count", m_arDREF.size());
for (size_t i = 0; i < m_arDREF.size(); i++)
{
DREF* dref = dynamic_cast<DREF*>(m_arDREF[i].get());
DConName* name = dynamic_cast<DConName*>(dref->m_DCon.get());
DConBin* bin = dynamic_cast<DConBin*>(dref->m_DCon.get());
DConRef* ref = dynamic_cast<DConRef*>(dref->m_DCon.get());
CP_XML_NODE(L"rangeSet")
{
CP_XML_ATTR(L"i1", i);
if (name)
{
CP_XML_ATTR(L"name", name->stName.value());
}
}
}
}
}
}
}
return 0; return 0;
} }
} // namespace XLS } // namespace XLS
......
...@@ -177,7 +177,7 @@ int WINDOW::serialize(std::wostream & stream) ...@@ -177,7 +177,7 @@ int WINDOW::serialize(std::wostream & stream)
CP_XML_ATTR(L"state", L"split"); CP_XML_ATTR(L"state", L"split");
} }
} }
for (int i = 0; i < m_arSelection.size(); i++) for (size_t i = 0; i < m_arSelection.size(); i++)
{ {
if (m_arSelection[i] == NULL) continue; if (m_arSelection[i] == NULL) continue;
m_arSelection[i]->serialize(CP_XML_STREAM()); m_arSelection[i]->serialize(CP_XML_STREAM());
......
...@@ -115,28 +115,45 @@ const bool XFS::loadContent(BinProcessor& proc) ...@@ -115,28 +115,45 @@ const bool XFS::loadContent(BinProcessor& proc)
count--; count--;
} }
} }
//------------------------------------------------------------------------------------ return true;
}
void XFS::RegisterFillBorder()
{
int first_xf_ext = 0; int first_xf_ext = 0;
for (_UINT16 i = 0 ; i < m_arCellStyles.size(); i++) for (size_t i = 0 ; i < m_arCellStyles.size(); i++)
{ {
XF *xfs = dynamic_cast<XF*>(m_arCellStyles[i].get()); XF *xfs = dynamic_cast<XF*>(m_arCellStyles[i].get());
for (size_t j = first_xf_ext ; j < m_arXFext.size(); j++)
{
XFExt *ext = dynamic_cast<XFExt*>(m_arXFext[j].get());
if (ext->ixfe > i)
break;
if (ext->ixfe == xfs->ind_xf)
{
xfs->style.ext_props = ext->rgExt;
first_xf_ext = j + 1;
break;
}
}
xfs->style.RegisterFillBorder(); xfs->style.RegisterFillBorder();
} }
first_xf_ext = 0; first_xf_ext = 0;
for (int i = 0 ; i < m_arCellXFs.size(); i++) for (size_t i = 0 ; i < m_arCellXFs.size(); i++)
{ {
XF *xfs = dynamic_cast<XF*>(m_arCellXFs[i].get()); XF *xfs = dynamic_cast<XF*>(m_arCellXFs[i].get());
if (m_arXFext.size() > 0 && xfs->cell.fHasXFExt) if (!m_arXFext.empty() && xfs->cell.fHasXFExt)
{ {
for (_UINT16 j = first_xf_ext ; j < m_arXFext.size(); j++) for (size_t j = first_xf_ext ; j < m_arXFext.size(); j++)
{ {
XFExt *ext = dynamic_cast<XFExt*>(m_arXFext[j].get()); XFExt *ext = dynamic_cast<XFExt*>(m_arXFext[j].get());
if (ext->ixfe > i)break; if (ext->ixfe > i)
break;
if (ext->ixfe == xfs->ind_xf) if (ext->ixfe == xfs->ind_xf)
{ {
...@@ -148,8 +165,6 @@ const bool XFS::loadContent(BinProcessor& proc) ...@@ -148,8 +165,6 @@ const bool XFS::loadContent(BinProcessor& proc)
} }
xfs->cell.RegisterFillBorder(); xfs->cell.RegisterFillBorder();
} }
return true;
} }
int XFS::serialize(std::wostream & stream) int XFS::serialize(std::wostream & stream)
{ {
...@@ -158,7 +173,7 @@ int XFS::serialize(std::wostream & stream) ...@@ -158,7 +173,7 @@ int XFS::serialize(std::wostream & stream)
CP_XML_NODE(L"cellStyleXfs") CP_XML_NODE(L"cellStyleXfs")
{ {
CP_XML_ATTR(L"count", m_arCellStyles.size()); CP_XML_ATTR(L"count", m_arCellStyles.size());
for (int i = 0; i < m_arCellStyles.size(); i++) for (size_t i = 0; i < m_arCellStyles.size(); i++)
{ {
m_arCellStyles[i]->serialize(CP_XML_STREAM()); m_arCellStyles[i]->serialize(CP_XML_STREAM());
} }
...@@ -166,7 +181,7 @@ int XFS::serialize(std::wostream & stream) ...@@ -166,7 +181,7 @@ int XFS::serialize(std::wostream & stream)
CP_XML_NODE(L"cellXfs") CP_XML_NODE(L"cellXfs")
{ {
CP_XML_ATTR(L"count", m_arCellXFs.size()); CP_XML_ATTR(L"count", m_arCellXFs.size());
for (int i = 0; i < m_arCellXFs.size(); i++) for (size_t i = 0; i < m_arCellXFs.size(); i++)
{ {
m_arCellXFs[i]->serialize(CP_XML_STREAM()); m_arCellXFs[i]->serialize(CP_XML_STREAM());
} }
......
...@@ -51,6 +51,8 @@ public: ...@@ -51,6 +51,8 @@ public:
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
void RegisterFillBorder();
static const ElementType type = typeXFS; static const ElementType type = typeXFS;
size_t cell_xf_current_id; size_t cell_xf_current_id;
......
...@@ -507,7 +507,7 @@ int ChartSheetSubstream::serialize_3D (std::wostream & _stream) ...@@ -507,7 +507,7 @@ int ChartSheetSubstream::serialize_3D (std::wostream & _stream)
BaseObjectPtr wallSpPr; BaseObjectPtr wallSpPr;
BaseObjectPtr floorSpPr; BaseObjectPtr floorSpPr;
for (int i = 0; i < chart_formats->m_arAXISPARENT.size(); i++) for (size_t i = 0; i < chart_formats->m_arAXISPARENT.size(); i++)
{ {
AXISPARENT* parent = dynamic_cast<AXISPARENT*> (chart_formats->m_arAXISPARENT[i].get()); AXISPARENT* parent = dynamic_cast<AXISPARENT*> (chart_formats->m_arAXISPARENT[i].get());
AxisParent* ax_parent = dynamic_cast<AxisParent*> (parent->m_AxisParent.get()); AxisParent* ax_parent = dynamic_cast<AxisParent*> (parent->m_AxisParent.get());
...@@ -871,7 +871,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) ...@@ -871,7 +871,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
AXES * axes = dynamic_cast<AXES*>(parent->m_AXES.get()); AXES * axes = dynamic_cast<AXES*>(parent->m_AXES.get());
if (axes) if (axes)
{ {
for (int a = 0 ; a < axes->m_arAxesId.size(); a++) for (size_t a = 0 ; a < axes->m_arAxesId.size(); a++)
{ {
CP_XML_NODE(L"c:axId") CP_XML_NODE(L"c:axId")
{ {
...@@ -883,7 +883,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) ...@@ -883,7 +883,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
} }
} }
for (int i = 0; i < chart_formats->m_arAXISPARENT.size(); i++) for (size_t i = 0; i < chart_formats->m_arAXISPARENT.size(); i++)
{ {
AXISPARENT* parent = dynamic_cast<AXISPARENT*> (chart_formats->m_arAXISPARENT[i].get()); AXISPARENT* parent = dynamic_cast<AXISPARENT*> (chart_formats->m_arAXISPARENT[i].get());
AxisParent* ax_parent = dynamic_cast<AxisParent*> (parent->m_AxisParent.get()); AxisParent* ax_parent = dynamic_cast<AxisParent*> (parent->m_AxisParent.get());
...@@ -942,7 +942,7 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt ...@@ -942,7 +942,7 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt
CP_XML_WRITER(_stream) CP_XML_WRITER(_stream)
{ {
for (int i = 0 ; i < series->m_arPtSS.size(); i++) for (size_t i = 0 ; i < series->m_arPtSS.size(); i++)
{ {
CP_XML_NODE(L"c:dPt") CP_XML_NODE(L"c:dPt")
{ {
...@@ -1088,7 +1088,7 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT * ...@@ -1088,7 +1088,7 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT *
CP_XML_NODE(L"c:showSerName") { CP_XML_ATTR (L"val" , 0); } CP_XML_NODE(L"c:showSerName") { CP_XML_ATTR (L"val" , 0); }
} }
//подписи к точкам (отдельные) //подписи к точкам (отдельные)
for (int i = 0; i < labels.size(); i++) for (size_t i = 0; i < labels.size(); i++)
{ {
CP_XML_NODE(L"c:dLbl") CP_XML_NODE(L"c:dLbl")
{ {
......
...@@ -491,7 +491,7 @@ void GlobalsSubstream::LoadHFPicture() ...@@ -491,7 +491,7 @@ void GlobalsSubstream::LoadHFPicture()
if (m_arHFPicture.empty()) return; if (m_arHFPicture.empty()) return;
int current_size_hf = 0, j = 0; int current_size_hf = 0, j = 0;
for ( int i = 0; i < m_arHFPicture.size(); i++) for ( size_t i = 0; i < m_arHFPicture.size(); i++)
{ {
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get()); HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get());
if ((hf) && (hf->recordDrawingGroup)) if ((hf) && (hf->recordDrawingGroup))
......
...@@ -63,7 +63,7 @@ PropertySet::PropertySet(XLS::CFStreamPtr stream, const unsigned int property_se ...@@ -63,7 +63,7 @@ PropertySet::PropertySet(XLS::CFStreamPtr stream, const unsigned int property_se
} }
code_page = 0; code_page = 0;
for(unsigned int i = 0; i < prop_offsets.size(); ++i) for(size_t i = 0; i < prop_offsets.size(); ++i)
{ {
if (stream->getStreamPointer() - property_set_offset > Size) if (stream->getStreamPointer() - property_set_offset > Size)
break; break;
......
...@@ -467,7 +467,7 @@ void WorksheetSubstream::LoadHFPicture() ...@@ -467,7 +467,7 @@ void WorksheetSubstream::LoadHFPicture()
if (m_arHFPicture.empty()) return; if (m_arHFPicture.empty()) return;
int current_size_hf = 0, j = 0; int current_size_hf = 0, j = 0;
for ( int i = 0; i < m_arHFPicture.size(); i++) for ( size_t i = 0; i < m_arHFPicture.size(); i++)
{ {
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get()); HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get());
if ((hf) && (hf->recordDrawingGroup)) if ((hf) && (hf->recordDrawingGroup))
......
...@@ -200,6 +200,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -200,6 +200,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
{ {
std::list<std::string> listStream = cfile.storage_->entries("_SX_DB_CUR"); std::list<std::string> listStream = cfile.storage_->entries("_SX_DB_CUR");
int last_index = 0;
for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++) for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
{ {
XLS::CFStreamCacheReader pivot_cache_reader(cfile.getNamedStream("_SX_DB_CUR/" + *it), xls_global_info); XLS::CFStreamCacheReader pivot_cache_reader(cfile.getNamedStream("_SX_DB_CUR/" + *it), xls_global_info);
...@@ -208,16 +209,25 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -208,16 +209,25 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
XLS::BinReaderProcessor proc(pivot_cache_reader , pivot_cache.get() , true); XLS::BinReaderProcessor proc(pivot_cache_reader , pivot_cache.get() , true);
proc.mandatory(*pivot_cache.get()); proc.mandatory(*pivot_cache.get());
int index = 0; int index = -1;
try try
{ {
index = atoi(it->c_str()); index = boost::lexical_cast<int>(it->c_str());
} }
catch(...) catch(...)
{ {
} }
if (index < 0)
{
//может быть шестнадцатеричное
index = XmlUtils::GetHex(*it);
}
if (index < 0)
index = last_index + 1;
xls_global_info->mapPivotCacheStream.insert(std::make_pair(index, pivot_cache)); xls_global_info->mapPivotCacheStream.insert(std::make_pair(index, pivot_cache));
last_index = index;
} }
} }
if (bMacros && cfile.storage_->isDirectory("_VBA_PROJECT_CUR")) if (bMacros && cfile.storage_->isDirectory("_VBA_PROJECT_CUR"))
...@@ -1947,7 +1957,6 @@ void XlsConverter::convert(XLS::PIVOTVIEW * pivot_view) ...@@ -1947,7 +1957,6 @@ void XlsConverter::convert(XLS::PIVOTVIEW * pivot_view)
pivot_view->serialize(strm); pivot_view->serialize(strm);
int index_view = xlsx_context->get_pivots_context().add_view(strm.str(), pivot_view->indexCache); int index_view = xlsx_context->get_pivots_context().add_view(strm.str(), pivot_view->indexCache);
if (index_view > 0) if (index_view > 0)
......
...@@ -65,6 +65,8 @@ xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl ...@@ -65,6 +65,8 @@ xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl
void xlsx_pivots_context::add_cache(std::wstring definitions, std::wstring records) void xlsx_pivots_context::add_cache(std::wstring definitions, std::wstring records)
{ {
if (definitions.empty()) return;
Impl::_pivot_cache c = {definitions, records}; Impl::_pivot_cache c = {definitions, records};
impl_->caches_.push_back(c); impl_->caches_.push_back(c);
} }
......
...@@ -50,6 +50,17 @@ namespace XmlUtils ...@@ -50,6 +50,17 @@ namespace XmlUtils
// common // common
AVSINLINE static int GetDigit (wchar_t c) AVSINLINE static int GetDigit (wchar_t c)
{
if (c >= '0' && c <= '9')
return (int)(c - '0');
if (c >= 'a' && c <= 'f')
return 10 + (int)(c - 'a');
if (c >= 'A' && c <= 'F')
return 10 + (int)(c - 'A');
return 0;
}
AVSINLINE static int GetDigit (char c)
{ {
if (c >= '0' && c <= '9') if (c >= '0' && c <= '9')
return (int)(c - '0'); return (int)(c - '0');
...@@ -77,6 +88,17 @@ namespace XmlUtils ...@@ -77,6 +88,17 @@ namespace XmlUtils
return nResult; return nResult;
} }
AVSINLINE static __int64 GetHex (const std::string& string)
{
__int64 nResult = 0;
size_t nLen = string.length();
for (size_t nIndex = 0; nIndex < nLen; ++nIndex )
{
nResult += GetDigit( string[nIndex] ) << ( 4 * ( nLen - 1 - nIndex ) );
}
return nResult;
}
AVSINLINE static int GetColorBGR (const std::wstring& string) AVSINLINE static int GetColorBGR (const std::wstring& string)
{ {
// variables // variables
......
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