Commit c9476890 authored by ElenaSubbotina's avatar ElenaSubbotina

Merge remote-tracking branch 'origin/release/v5.0.0' into develop

parents 16bdbafa f575947c
...@@ -1427,7 +1427,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertImage() ...@@ -1427,7 +1427,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertImage()
m_oWriter.WriteString(std::wstring(L"<a:xfrm")); m_oWriter.WriteString(std::wstring(L"<a:xfrm"));
if (0 != m_pImageElement->m_dRotate) if (0 != m_pImageElement->m_dRotate)
{ {
m_oWriter.WriteString(L" rot=\"" + std::to_wstring(m_pImageElement->m_dRotate * 60000) + L"\""); m_oWriter.WriteString(L" rot=\"" + std::to_wstring((int)(m_pImageElement->m_dRotate * 60000)) + L"\"");
} }
if (m_pImageElement->m_bFlipH) if (m_pImageElement->m_bFlipH)
{ {
......
...@@ -996,8 +996,8 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide) ...@@ -996,8 +996,8 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
//даты и номера могут быть и не только в колонтитулах //даты и номера могут быть и не только в колонтитулах
//todooo ... возможно нужно все перенести плейсхолдеры без ID a-la как в AddLayout //todooo ... возможно нужно все перенести плейсхолдеры без ID a-la как в AddLayout
AddLayoutSlidePlaceholder(pSlide, MasterSlideNumber , pLayout); //AddLayoutSlidePlaceholder(pSlide, MasterSlideNumber , pLayout);
AddLayoutSlidePlaceholder(pSlide, MasterDate , pLayout); //AddLayoutSlidePlaceholder(pSlide, MasterDate , pLayout);
//-------------элементы колонтитулов //-------------элементы колонтитулов
std::multimap<int, int>::iterator it; std::multimap<int, int>::iterator it;
......
...@@ -100,9 +100,15 @@ int _tmain(int argc, _TCHAR* argv[]) ...@@ -100,9 +100,15 @@ int _tmain(int argc, _TCHAR* argv[])
{ {
if (argc < 2) return 1; if (argc < 2) return 1;
HRESULT hr = convert_single(argv[1]); HRESULT hr = -1;
if (NSFile::CFileBinary::Exists(argv[1]))
//HRESULT hr = convert_directory(argv[1]); {
hr = convert_single(argv[1]);
}
else if (NSDirectory::Exists(argv[1]))
{
hr = convert_directory(argv[1]);
}
return hr; return hr;
} }
\ No newline at end of file
...@@ -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")
{ {
......
...@@ -54,14 +54,17 @@ BaseObjectPtr Chart3d::clone() ...@@ -54,14 +54,17 @@ BaseObjectPtr Chart3d::clone()
void Chart3d::readFields(CFRecord& record) void Chart3d::readFields(CFRecord& record)
{ {
unsigned short flags; unsigned short flags;
unsigned short pcHeight_raw; record >> anRot >> anElev >> pcDist >> pcHeightPie >> pcDepth >> pcGap >> flags;
record >> anRot >> anElev >> pcDist >> pcHeight_raw >> pcDepth >> pcGap >> flags;
fPerspective = GETBIT(flags, 0); fPerspective = GETBIT(flags, 0);
fCluster = GETBIT(flags, 1); fCluster = GETBIT(flags, 1);
f3DScaling = GETBIT(flags, 2); f3DScaling = GETBIT(flags, 2);
fNotPieChart = GETBIT(flags, 4); fNotPieChart = GETBIT(flags, 4);
fWalls2D = GETBIT(flags, 5); fWalls2D = GETBIT(flags, 5);
pcHeight = fNotPieChart ? static_cast<short>(pcHeight_raw) : pcHeight_raw;
if (fNotPieChart)
{
pcHeight3D = static_cast<short>(pcHeightPie);
}
} }
} // namespace XLS } // namespace XLS
......
...@@ -48,7 +48,6 @@ public: ...@@ -48,7 +48,6 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeChart3d; static const ElementType type = typeChart3d;
...@@ -57,7 +56,8 @@ public: ...@@ -57,7 +56,8 @@ public:
_INT16 anRot; _INT16 anRot;
_INT16 anElev; _INT16 anElev;
_INT16 pcDist; _INT16 pcDist;
_UINT32 pcHeight; _UINT16 pcHeightPie;
short pcHeight3D;
_INT16 pcDepth; _INT16 pcDepth;
_UINT16 pcGap; _UINT16 pcGap;
......
...@@ -31,14 +31,15 @@ ...@@ -31,14 +31,15 @@
*/ */
#include "DConRef.h" #include "DConRef.h"
#include "../../../../../Common/DocxFormat/Source/XML/Utils.h"
namespace XLS namespace XLS
{ {
DConRef::DConRef() DConRef::DConRef()
{ {
index_external = -1;
bFilePath = false; bFilePath = false;
bSheetName = false;
} }
...@@ -54,6 +55,8 @@ BaseObjectPtr DConRef::clone() ...@@ -54,6 +55,8 @@ BaseObjectPtr DConRef::clone()
void DConRef::readFields(CFRecord& record) void DConRef::readFields(CFRecord& record)
{ {
global_info_ = record.getGlobalWorkbookInfo();
record >> ref >> cchFile; record >> ref >> cchFile;
if (cchFile > 1) if (cchFile > 1)
...@@ -67,15 +70,47 @@ void DConRef::readFields(CFRecord& record) ...@@ -67,15 +70,47 @@ 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")
std::wstring sTmp = stFile;
while(true)
{
int pos = sTmp.find(L"\x0001");
if (pos >= 0)
{ {
bFilePath = true; bFilePath = true;
stFile = stFile.substr(1);
path.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
}
pos = sTmp.find(L"\x0002");
if (pos >= 0)
{
path.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
}
pos = sTmp.find(L"\x0003");
if (pos >= 0)
{
bFilePath = true;
path.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1);
continue;
} }
else if (stFile.substr(0, 1) == L"\x0002") break;
}
int pos = sTmp.find(L"]");
if (pos >= 0)
{
file_name = sTmp.substr(1, pos - 1);
sheet_name = sTmp.substr(pos + 1);
}
else
{ {
bSheetName = true; sheet_name = sTmp;
stFile = stFile.substr(1);
} }
} }
...@@ -83,5 +118,61 @@ void DConRef::readFields(CFRecord& record) ...@@ -83,5 +118,61 @@ void DConRef::readFields(CFRecord& record)
record.skipNunBytes(unused); record.skipNunBytes(unused);
} }
void DConRef::check_external()
{
bool bFound = false;
for (size_t i = 0; !bFilePath && i < global_info_->sheets_names.size(); i++)
{
if (global_info_->sheets_names[i] == sheet_name)
{
bFound = true;
break;
}
}
if (!bFound && (!path.empty() || !file_name.empty()) && bFilePath)
{//external sheet
std::wstring full_path;
if (!path.empty())
{
full_path = get_external_path();
}
std::unordered_map<std::wstring, std::wstring>::iterator pFind = global_info_->mapPivotCacheExternal.find(file_name);
if (pFind == global_info_->mapPivotCacheExternal.end())
{
index_external = global_info_->mapPivotCacheExternal.size() ;
global_info_->mapPivotCacheExternal.insert(std::make_pair(file_name, full_path));
}
else
{
if (pFind->second.empty() && !full_path.empty())
{
pFind->second = full_path;
}
index_external = std::distance( global_info_->mapPivotCacheExternal.begin(), pFind) ;
}
}
}
std::wstring DConRef::get_external_path()
{
if (path.empty() && file_name.empty()) return L"";
std::wstring result = L"file:///";
for (size_t i = 0; i < path.size(); i++)
{
result += L"\\" + path[i];
}
if (!file_name.empty())
result += L"\\" + file_name;
return result;
}
} // namespace XLS } // namespace XLS
...@@ -57,9 +57,18 @@ public: ...@@ -57,9 +57,18 @@ public:
unsigned short cchFile; unsigned short cchFile;
std::wstring stFile; std::wstring stFile;
bool bFilePath; std::vector<std::wstring> path;
bool bSheetName; std::wstring file_name;
std::wstring sheet_name;
int index_external;
void check_external();
private:
GlobalWorkbookInfoPtr global_info_;
std::wstring get_external_path();
bool bFilePath;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -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());
......
...@@ -72,6 +72,20 @@ int SXDI::serialize(std::wostream & strm) ...@@ -72,6 +72,20 @@ int SXDI::serialize(std::wostream & strm)
CP_XML_ATTR(L"baseField", df); CP_XML_ATTR(L"baseField", df);
CP_XML_ATTR(L"baseItem", isxvi); CP_XML_ATTR(L"baseItem", isxvi);
CP_XML_ATTR(L"numFmtId", ifmt); CP_XML_ATTR(L"numFmtId", ifmt);
switch(iiftab)
{
case 0x0000: CP_XML_ATTR(L"subtotal", L"sum"); break;
case 0x0001: CP_XML_ATTR(L"subtotal", L"count"); break;
case 0x0002: CP_XML_ATTR(L"subtotal", L"average"); break;
case 0x0003: CP_XML_ATTR(L"subtotal", L"max"); break;
case 0x0004: CP_XML_ATTR(L"subtotal", L"min"); break;
case 0x0005: CP_XML_ATTR(L"subtotal", L"product"); break;
case 0x0006: CP_XML_ATTR(L"subtotal", L"countNums");break;
case 0x0007: CP_XML_ATTR(L"subtotal", L"stdDev"); break;
case 0x0008: CP_XML_ATTR(L"subtotal", L"stdDevp"); break;
case 0x0009: CP_XML_ATTR(L"subtotal", L"var"); break;
case 0x000a: CP_XML_ATTR(L"subtotal", L"varp"); break;
}
} }
} }
return 0; return 0;
......
...@@ -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")
{ {
......
...@@ -116,7 +116,7 @@ const bool AUTOFILTER::loadContent(BinProcessor& proc) ...@@ -116,7 +116,7 @@ const bool AUTOFILTER::loadContent(BinProcessor& proc)
std::vector<BaseObjectPtr> ar; std::vector<BaseObjectPtr> ar;
ar.push_back(elements_.back()); ar.push_back(elements_.back());
m_mapFilters12.insert(std::pair<int, std::vector<BaseObjectPtr>>(ind, ar)); m_mapFilters12.insert(std::make_pair(ind, ar));
} }
} }
} }
...@@ -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;
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
{ {
if (row->miyRw > 0 && std::abs(row->miyRw/20. - sheet_info.defaultRowHeight) > 0.001) if (row->miyRw > 0 && std::abs(row->miyRw/20. - sheet_info.defaultRowHeight) > 0.001)
{ {
sheet_info.customRowsHeight.insert(std::pair<int, double>(row->rw, row->miyRw / 20.)); sheet_info.customRowsHeight.insert(std::make_pair(row->rw, row->miyRw / 20.));
} }
} }
m_rows.push_back(elements_.front()); m_rows.push_back(elements_.front());
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
{ {
std::list<BaseObjectPtr> c; std::list<BaseObjectPtr> c;
c.push_back(elements_.front()); c.push_back(elements_.front());
m_cells.insert(std::pair<int, std::list<BaseObjectPtr>>(cell->RowNumber, c)); m_cells.insert(std::make_pair(cell->RowNumber, c));
} }
else else
{ {
......
...@@ -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());
......
...@@ -77,10 +77,10 @@ const bool COLUMNS::loadContent(BinProcessor& proc) ...@@ -77,10 +77,10 @@ const bool COLUMNS::loadContent(BinProcessor& proc)
for (int i = column_info->colFirst; i <= column_info->colLast; i++) for (int i = column_info->colFirst; i <= column_info->colLast; i++)
{ {
global_info_->sheet_size_info.back().customColumnsWidth.insert(std::pair<int, double>(i, column_info->coldx / 256.)); global_info_->sheet_size_info.back().customColumnsWidth.insert(std::make_pair(i, column_info->coldx / 256.));
//else if (def_ok) //else if (def_ok)
//{ //{
// global_info_->sheet_size_info.back().customColumnsWidth.insert(std::pair<int, double>(i, global_info_->sheet_size_info.back().defaultColumnWidth)); // global_info_->sheet_size_info.back().customColumnsWidth.insert(std::make_pair(i, global_info_->sheet_size_info.back().defaultColumnWidth));
//} //}
} }
......
...@@ -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
{ {
...@@ -116,11 +116,18 @@ int DREF::serialize(std::wostream & strm) ...@@ -116,11 +116,18 @@ int DREF::serialize(std::wostream & strm)
} }
else if(ref) else if(ref)
{ {
ref->check_external();
CP_XML_ATTR(L"type", L"worksheet"); CP_XML_ATTR(L"type", L"worksheet");
CP_XML_NODE(L"worksheetSource") CP_XML_NODE(L"worksheetSource")
{ {
CP_XML_ATTR(L"ref", ref->ref.toString()); CP_XML_ATTR(L"ref", ref->ref.toString());
CP_XML_ATTR(L"sheet", ref->stFile); CP_XML_ATTR(L"sheet", ref->sheet_name);
if (ref->index_external >= 0)
{
CP_XML_ATTR(L"r:id", L"extId" + std::to_wstring(ref->index_external + 1));
}
} }
} }
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
*/ */
#pragma once #pragma once
#include <Logic/CompositeObject.h> #include "../CompositeObject.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;
......
...@@ -175,7 +175,7 @@ const bool FDB::loadContent(BinProcessor& proc) ...@@ -175,7 +175,7 @@ const bool FDB::loadContent(BinProcessor& proc)
return true; return true;
} }
int FDB::serialize(std::wostream & strm, bool bSql) int FDB::serialize(std::wostream & strm, bool bSql, bool bDBB)
{ {
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get()); SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get()); SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get());
...@@ -227,7 +227,7 @@ int FDB::serialize(std::wostream & strm, bool bSql) ...@@ -227,7 +227,7 @@ int FDB::serialize(std::wostream & strm, bool bSql)
Formula->serialize_attr(CP_GET_XML_NODE()); Formula->serialize_attr(CP_GET_XML_NODE());
} }
if (m_arSRCSXOPER.empty() == false) if (!m_arSRCSXOPER.empty() && (bDBB || (!bDBB && bSql)) )
{ {
CP_XML_NODE(L"sharedItems") CP_XML_NODE(L"sharedItems")
{ {
...@@ -250,19 +250,26 @@ int FDB::serialize(std::wostream & strm, bool bSql) ...@@ -250,19 +250,26 @@ int FDB::serialize(std::wostream & strm, bool bSql)
// } // }
//} //}
if ((bDate & bNumber) || (bNumber & bString)) if ((bDate & bNumber)/* || (bNumber & bString & !bEmpty & !bInteger)*/)
{ {
CP_XML_ATTR(L"containsSemiMixedTypes", 1); CP_XML_ATTR(L"containsSemiMixedTypes", 1);
} }
else if ((bDate & bString) || (bEmpty & bInteger & bString)) else if ((bString && bDate) ||
(bString && (bNumber || bInteger)) ||
(!bString && bDate && bEmpty && (bNumber || bInteger)))
{ {
if (bEmpty && bInteger)
bNumber = true;
CP_XML_ATTR(L"containsMixedTypes", 1); CP_XML_ATTR(L"containsMixedTypes", 1);
if (bString && !bNumber && bInteger) bNumber = true;
else if (bString && bNumber && bInteger) bInteger = false;
} }
else if (!bEmpty && !bString && !bBool) else if (!bEmpty && !bString && !bBool)
{ {
CP_XML_ATTR(L"containsSemiMixedTypes", 0); CP_XML_ATTR(L"containsSemiMixedTypes", 0);
if (bDate)
{
CP_XML_ATTR(L"containsMixedTypes", 1);
}
} }
if (bDate && ! (bNumber || bInteger || bString || bEmpty )) if (bDate && ! (bNumber || bInteger || bString || bEmpty ))
{ {
...@@ -343,5 +350,25 @@ int FDB::serialize(std::wostream & strm, bool bSql) ...@@ -343,5 +350,25 @@ int FDB::serialize(std::wostream & strm, bool bSql)
return 0; return 0;
} }
int FDB::serialize_record(std::wostream & strm)
{
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get());
if (!fdb || !fdb_type) return 0;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"r")
{
for (size_t i = 0; i < m_arSRCSXOPER.size(); i++)
{
SXOPER* oper = dynamic_cast<SXOPER*>(m_arSRCSXOPER[i].get());
oper->serialize_record(CP_XML_STREAM());
}
}
}
}
} // namespace XLS } // namespace XLS
...@@ -47,7 +47,8 @@ public: ...@@ -47,7 +47,8 @@ public:
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm, bool bSql); int serialize(std::wostream & strm, bool bSql, bool bDBB);
int serialize_record(std::wostream & strm);
static const ElementType type = typeFDB; static const ElementType type = typeFDB;
......
...@@ -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;
} }
......
...@@ -122,7 +122,7 @@ const bool LBL::loadContent(BinProcessor& proc) ...@@ -122,7 +122,7 @@ const bool LBL::loadContent(BinProcessor& proc)
ar[ind_sheet] = value; ar[ind_sheet] = value;
//ar.push_back(value); //ar.push_back(value);
global_info_->mapDefineNames.insert(std::pair<std::wstring, std::vector<std::wstring>>(name, ar)); global_info_->mapDefineNames.insert(std::make_pair(name, ar));
} }
isSerialize = true; isSerialize = true;
} }
...@@ -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,7 +111,15 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -113,7 +111,15 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
if (!db || !db_ex)return 0; if (!db || !db_ex)return 0;
bool bSql = false; 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()));
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
bool bSql = src ? src->bSql : false;
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
...@@ -122,27 +128,25 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -122,27 +128,25 @@ 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() && bSql)
{ {
CP_XML_ATTR(L"r:id", L"rId1" ); CP_XML_ATTR(L"saveData", 0);
} }
else else
{ {
CP_XML_ATTR(L"saveData", 0); CP_XML_ATTR(L"r:id", L"rId1" );
} }
CP_XML_ATTR(L"enableRefresh", 1); CP_XML_ATTR(L"enableRefresh", 1);
CP_XML_ATTR(L"refreshedBy", db->rgb.value()); CP_XML_ATTR(L"refreshedBy", db->rgb.value());
CP_XML_ATTR(L"refreshedDate", db_ex->numDate.data.value); CP_XML_ATTR(L"refreshedDate", db_ex->numDate.data.value);
CP_XML_ATTR(L"recordCount", db->crdbdb); CP_XML_ATTR(L"recordCount", db->crdbdb);
//upgradeOnRefresh="1"
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
if (src) if (src)
{ {
bSql = src->bSql;
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")
{ {
...@@ -153,11 +157,11 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm) ...@@ -153,11 +157,11 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
FDB *field = dynamic_cast<FDB *>(pivot_cache->m_arFDB[i].get()); FDB *field = dynamic_cast<FDB *>(pivot_cache->m_arFDB[i].get());
if (!field) continue; if (!field) continue;
field->serialize(CP_XML_STREAM(), bSql); field->serialize(CP_XML_STREAM(), bSql, !pivot_cache->m_arDBB.empty());
} }
} }
} }
if (pivot_cache->m_arSXFORMULA.empty() == false) if (!pivot_cache->m_arSXFORMULA.empty())
{ {
CP_XML_NODE(L"calculatedItems") CP_XML_NODE(L"calculatedItems")
{ {
...@@ -186,7 +190,10 @@ int PIVOTCACHEDEFINITION::serialize_records(std::wostream & strm) ...@@ -186,7 +190,10 @@ int PIVOTCACHEDEFINITION::serialize_records(std::wostream & strm)
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;
if (pivot_cache->m_arDBB.empty()) return 0; SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
bool bSql = src ? src->bSql : false;
if (pivot_cache->m_arDBB.empty() && bSql) return 0;
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
...@@ -195,13 +202,24 @@ int PIVOTCACHEDEFINITION::serialize_records(std::wostream & strm) ...@@ -195,13 +202,24 @@ int PIVOTCACHEDEFINITION::serialize_records(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())
{
CP_XML_ATTR(L"count", pivot_cache->m_arDBB.size()); CP_XML_ATTR(L"count", pivot_cache->m_arDBB.size());
for (size_t i = 0; i < pivot_cache->m_arDBB.size(); i++) for (size_t i = 0; i < pivot_cache->m_arDBB.size(); i++)
{ {
pivot_cache->m_arDBB[i]->serialize(CP_XML_STREAM()); pivot_cache->m_arDBB[i]->serialize(CP_XML_STREAM());
} }
} }
else
{
CP_XML_ATTR(L"count", pivot_cache->m_arFDB.size());
for (size_t i = 0; i < pivot_cache->m_arFDB.size(); i++)
{
FDB* fdb = dynamic_cast<FDB*>(pivot_cache->m_arFDB[i].get());
fdb->serialize_record(CP_XML_STREAM());
}
}
}
} }
return 0; return 0;
} }
......
...@@ -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)
...@@ -162,7 +166,7 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -162,7 +166,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
CP_XML_ATTR(L"compact", view_ex12->fCompactData); CP_XML_ATTR(L"compact", view_ex12->fCompactData);
CP_XML_ATTR(L"compactData", view_ex12->fCompactData); CP_XML_ATTR(L"compactData", view_ex12->fCompactData);
CP_XML_ATTR(L"gridDropZones", view_ex12->fNewDropZones); CP_XML_ATTR(L"gridDropZones", !view_ex12->fNewDropZones);
CP_XML_ATTR(L"showDrill", !view_ex12->fHideDrillIndicators); CP_XML_ATTR(L"showDrill", !view_ex12->fHideDrillIndicators);
CP_XML_ATTR(L"printDrill", view_ex12->fPrintDrillIndicators); CP_XML_ATTR(L"printDrill", view_ex12->fPrintDrillIndicators);
} }
...@@ -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,43 +204,49 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -198,43 +204,49 @@ 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) }
int index_ivd = 0;
int index_tli = 0;
if (view->cDimRw > 0 && index_ivd < core->m_arPIVOTIVD.size())
{ {
CP_XML_NODE(L"rowFields") CP_XML_NODE(L"rowFields")
{ {
CP_XML_ATTR(L"count", view->cDimRw); CP_XML_ATTR(L"count", view->cDimRw);
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[0].get()); PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[index_ivd].get());
ivd->serialize(CP_XML_STREAM()); ivd->serialize(CP_XML_STREAM());
index_ivd++;
} }
} }
if (core->m_arPIVOTLI.size() >= 1)//0 or 2 if (view->cRw > 0 && index_tli < core->m_arPIVOTLI.size())
{ {
CP_XML_NODE(L"rowItems") CP_XML_NODE(L"rowItems")
{ {
CP_XML_ATTR(L"count", view->cRw); CP_XML_ATTR(L"count", view->cRw);
PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[0].get()); PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[index_tli].get());
line->serialize(CP_XML_STREAM()); line->serialize(CP_XML_STREAM());
index_tli++;
} }
} }
if (core->m_arPIVOTIVD.size() == 2)//0 or 2 if (view->cDimCol > 0 && index_ivd < core->m_arPIVOTIVD.size())
{ {
CP_XML_NODE(L"colFields") CP_XML_NODE(L"colFields")
{ {
CP_XML_ATTR(L"count", view->cDimCol); CP_XML_ATTR(L"count", view->cDimCol);
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[1].get()); PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[index_ivd].get());
ivd->serialize(CP_XML_STREAM()); ivd->serialize(CP_XML_STREAM());
} }
} }
if (core->m_arPIVOTLI.size() == 2)//0 or 2 if (view->cCol > 0 && index_tli < core->m_arPIVOTLI.size())
{ {
CP_XML_NODE(L"colItems") CP_XML_NODE(L"colItems")
{ {
CP_XML_ATTR(L"count", view->cCol); CP_XML_ATTR(L"count", view->cCol);
PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[1].get()); PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[index_tli].get());
line->serialize(CP_XML_STREAM()); line->serialize(CP_XML_STREAM());
} }
} }
...@@ -247,7 +259,7 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -247,7 +259,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,18 @@ const bool SXOPER::loadContent(BinProcessor& proc) ...@@ -97,9 +97,18 @@ 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; bString = true;
node = L"e"; node = L"e";
value = std::to_wstring(err->wbe); switch(err->wbe)
{
case 0x00: value = L"NULL!"; break;
case 0x07: value = L"#DIV/0!"; break;
case 0x0F: value = L"#VALUE!"; break;
case 0x17: value = L"#REF!"; break;
case 0x1D: value = L"#NAME?"; break;
case 0x24: value = L"#NUM!"; break;
case 0x2A: value = L"#N/A"; break;
}
} }
else if(proc.optional<SXString>()) else if(proc.optional<SXString>())
{ {
...@@ -146,5 +155,20 @@ int SXOPER::serialize(std::wostream & strm) ...@@ -146,5 +155,20 @@ int SXOPER::serialize(std::wostream & strm)
return 0; return 0;
} }
int SXOPER::serialize_record(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(node)
{
if (!value.empty() || bString)
{
CP_XML_ATTR(L"v", value);
}
}
}
return 0;
}
} // namespace XLS } // namespace XLS
...@@ -48,6 +48,7 @@ public: ...@@ -48,6 +48,7 @@ public:
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm); int serialize(std::wostream & strm);
int serialize_record(std::wostream & strm);
static const ElementType type = typeSXOPER; static const ElementType type = typeSXOPER;
......
...@@ -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,99 @@ const bool SXTBL::loadContent(BinProcessor& proc) ...@@ -124,11 +128,99 @@ 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[j].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());
}
if (bin)
{
switch(bin->nBuiltin)
{
case 0x0000: CP_XML_ATTR(L"name", L"_xlnm.Consolidate_Area"); break;
case 0x0001: CP_XML_ATTR(L"name", L"_xlnm.Auto_Open"); break;
case 0x0002: CP_XML_ATTR(L"name", L"_xlnm.Auto_Close"); break;
case 0x0003: CP_XML_ATTR(L"name", L"_xlnm.Extract"); break;
case 0x0004: CP_XML_ATTR(L"name", L"_xlnm.Database"); break;
case 0x0005: CP_XML_ATTR(L"name", L"_xlnm.Criteria"); break;
case 0x0006: CP_XML_ATTR(L"name", L"_xlnm.Print_Area"); break;
case 0x0007: CP_XML_ATTR(L"name", L"_xlnm.Print_Titles"); break;
case 0x0008: CP_XML_ATTR(L"name", L"_xlnm.Recorder"); break;
case 0x0009: CP_XML_ATTR(L"name", L"_xlnm.Data_Form"); break;
case 0x000a: CP_XML_ATTR(L"name", L"_xlnm.Auto_Activate"); break;
case 0x000b: CP_XML_ATTR(L"name", L"_xlnm.Auto_Deactivate"); break;
case 0x000c: CP_XML_ATTR(L"name", L"_xlnm.Sheet_Title"); break;
case 0x000d: CP_XML_ATTR(L"name", L"_xlnm._FilterDatabase"); break; //??
}
}
if (ref)
{
ref->check_external();
CP_XML_ATTR(L"ref", ref->ref.toString());
CP_XML_ATTR(L"sheet", ref->sheet_name);
if (ref->index_external >= 0)
{
CP_XML_ATTR(L"r:id", L"extId" + std::to_wstring(ref->index_external + 1));
}
}
}
}
}
}
}
}
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;
......
...@@ -324,6 +324,13 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts) ...@@ -324,6 +324,13 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts)
int iCrt = -1; int iCrt = -1;
if (charts->m_arSERIESFORMAT.empty() && !parent0->m_arCRT.empty())
{
std::vector<int> ser;
m_mapTypeChart.insert(std::make_pair(0, ser));
return;
}
for (size_t i = 0 ; i < charts->m_arSERIESFORMAT.size(); i++) for (size_t i = 0 ; i < charts->m_arSERIESFORMAT.size(); i++)
{ {
SERIESFORMAT * series = dynamic_cast<SERIESFORMAT *>(charts->m_arSERIESFORMAT[i].get()); SERIESFORMAT * series = dynamic_cast<SERIESFORMAT *>(charts->m_arSERIESFORMAT[i].get());
...@@ -334,7 +341,7 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts) ...@@ -334,7 +341,7 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts)
if ( serCrt == NULL) if ( serCrt == NULL)
{ {
//для доп линий может и не существовать - брать предыдущий - и объеденить!!! //для доп линий может и не существовать - брать предыдущий - и объеденить!!!
std::map<int,std::vector<int>>::iterator it = m_mapTypeChart.find(iCrt); std::unordered_map<int,std::vector<int>>::iterator it = m_mapTypeChart.find(iCrt);
if (it != m_mapTypeChart.end()) if (it != m_mapTypeChart.end())
{ {
SERIESFORMAT * series_prev = dynamic_cast<SERIESFORMAT *>(charts->m_arSERIESFORMAT[it->second.back()].get()); SERIESFORMAT * series_prev = dynamic_cast<SERIESFORMAT *>(charts->m_arSERIESFORMAT[it->second.back()].get());
...@@ -359,12 +366,12 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts) ...@@ -359,12 +366,12 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts)
CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[iCrt].get()); CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[iCrt].get());
std::map<int,std::vector<int>>::iterator it = m_mapTypeChart.find(iCrt); std::unordered_map<int,std::vector<int>>::iterator it = m_mapTypeChart.find(iCrt);
if (it == m_mapTypeChart.end()) if (it == m_mapTypeChart.end())
{ {
std::vector<int> ser; std::vector<int> ser;
ser.push_back(i); ser.push_back(i);
m_mapTypeChart.insert(std::pair<int, std::vector<int>>(iCrt, ser)); m_mapTypeChart.insert(std::make_pair(iCrt, ser));
} }
else else
{ {
...@@ -507,7 +514,7 @@ int ChartSheetSubstream::serialize_3D (std::wostream & _stream) ...@@ -507,7 +514,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());
...@@ -545,11 +552,11 @@ int ChartSheetSubstream::serialize_3D (std::wostream & _stream) ...@@ -545,11 +552,11 @@ int ChartSheetSubstream::serialize_3D (std::wostream & _stream)
CP_XML_ATTR (L"val" , chart3D->anElev); CP_XML_ATTR (L"val" , chart3D->anElev);
} }
} }
if (chart3D->pcHeight != 100) if (chart3D->pcHeight3D != 100 && chart3D->pcHeight3D >= 5 && chart3D->pcHeight3D <= 500)
{ {
CP_XML_NODE(L"c:hPercent") CP_XML_NODE(L"c:hPercent")
{ {
CP_XML_ATTR (L"val" , chart3D->pcHeight); CP_XML_ATTR (L"val" , chart3D->pcHeight3D);
} }
} }
if (chart3D->anRot != 0) if (chart3D->anRot != 0)
...@@ -662,7 +669,7 @@ int ChartSheetSubstream::serialize_legend (std::wostream & _stream, const std::w ...@@ -662,7 +669,7 @@ int ChartSheetSubstream::serialize_legend (std::wostream & _stream, const std::w
//} //}
//todooo разобраться с разными типами в одном чарте .. считать количество серий?? //todooo разобраться с разными типами в одном чарте .. считать количество серий??
std::map< int, std::vector<int>>::iterator it = m_mapTypeChart.begin(); std::unordered_map< int, std::vector<int>>::iterator it = m_mapTypeChart.begin();
if (it != m_mapTypeChart.end()) if (it != m_mapTypeChart.end())
{ {
CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[it->first].get()); CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[it->first].get());
...@@ -746,7 +753,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) ...@@ -746,7 +753,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
PlotAreaPos->serialize(CP_XML_STREAM()); PlotAreaPos->serialize(CP_XML_STREAM());
} }
for (std::map<int, std::vector<int>>::iterator it = m_mapTypeChart.begin(); it != m_mapTypeChart.end(); it++) for (std::unordered_map<int, std::vector<int>>::iterator it = m_mapTypeChart.begin(); it != m_mapTypeChart.end(); it++)
{ {
CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[it->first].get()); CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[it->first].get());
...@@ -871,7 +878,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) ...@@ -871,7 +878,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 +890,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) ...@@ -883,7 +890,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 +949,7 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt ...@@ -942,7 +949,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")
{ {
...@@ -962,7 +969,7 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt ...@@ -962,7 +969,7 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt
CP_XML_ATTR(L"val", series_data_format->xi); CP_XML_ATTR(L"val", series_data_format->xi);
if (format->fVaried) if (format->fVaried)
present_idx.insert(std::pair<int, bool>(series_data_format->xi, true)); present_idx.insert(std::make_pair(series_data_format->xi, true));
} }
series_ss->serialize (CP_XML_STREAM(), crt->m_iChartType, series_data_format->xi); series_ss->serialize (CP_XML_STREAM(), crt->m_iChartType, series_data_format->xi);
series_ss->serialize2 (CP_XML_STREAM(), crt->m_iChartType); series_ss->serialize2 (CP_XML_STREAM(), crt->m_iChartType);
...@@ -1088,7 +1095,7 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT * ...@@ -1088,7 +1095,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")
{ {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#pragma once #pragma once
#include <Logic/CompositeObject.h> #include <Logic/CompositeObject.h>
#include <unordered_map>
namespace XLS namespace XLS
{; {;
...@@ -86,7 +87,7 @@ private: ...@@ -86,7 +87,7 @@ private:
void recalc(CHARTFORMATS* charts); void recalc(CHARTFORMATS* charts);
void recalc(SERIESDATA* data); void recalc(SERIESDATA* data);
std::map<int, std::vector<int>> m_mapTypeChart;//тут нужен несортированый .. пока оставим этот std::unordered_map<int, std::vector<int>> m_mapTypeChart;
GlobalWorkbookInfoPtr pGlobalWorkbookInfo; GlobalWorkbookInfoPtr pGlobalWorkbookInfo;
}; };
......
...@@ -165,12 +165,12 @@ const size_t GlobalWorkbookInfo::RegisterFillId(const FillInfo& fill) ...@@ -165,12 +165,12 @@ const size_t GlobalWorkbookInfo::RegisterFillId(const FillInfo& fill)
void GlobalWorkbookInfo::RegisterFontColorId (int id, const FillInfoExt & font_color) void GlobalWorkbookInfo::RegisterFontColorId (int id, const FillInfoExt & font_color)
{ {
fonts_color_ext.insert(std::pair<int, FillInfoExt>(id, font_color)); fonts_color_ext.insert(std::make_pair(id, font_color));
} }
void GlobalWorkbookInfo::RegisterPaletteColor(int id, const std::wstring & rgb) void GlobalWorkbookInfo::RegisterPaletteColor(int id, const std::wstring & rgb)
{ {
colors_palette.insert(std::pair<int, std::wstring>(id, rgb)); colors_palette.insert(std::make_pair(id, rgb));
} }
unsigned int GlobalWorkbookInfo::GenerateAXESId() unsigned int GlobalWorkbookInfo::GenerateAXESId()
......
...@@ -116,7 +116,8 @@ public: ...@@ -116,7 +116,8 @@ public:
std::vector<_sx_name> arPivotSxNames; std::vector<_sx_name> arPivotSxNames;
std::vector<std::wstring> arPivotCacheSxNames; std::vector<std::wstring> arPivotCacheSxNames;
std::vector<std::wstring> arPivotCacheReferences;
std::unordered_map<std::wstring, std::wstring> mapPivotCacheExternal;
std::map<std::wstring, std::vector<std::wstring>> mapDefineNames; std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
std::vector<std::wstring> arDefineNames; std::vector<std::wstring> arDefineNames;
......
...@@ -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)
...@@ -1968,4 +1977,9 @@ void XlsConverter::convert(XLS::PIVOTCACHEDEFINITION * pivot_cached) ...@@ -1968,4 +1977,9 @@ void XlsConverter::convert(XLS::PIVOTCACHEDEFINITION * pivot_cached)
pivot_cached->serialize_records(strmR); pivot_cached->serialize_records(strmR);
xlsx_context->get_pivots_context().add_cache(strmD.str(), strmR.str()); xlsx_context->get_pivots_context().add_cache(strmD.str(), strmR.str());
if (!xls_global_info->mapPivotCacheExternal.empty())
{
xlsx_context->get_pivots_context().add_cache_external(xls_global_info->mapPivotCacheExternal);
}
} }
\ No newline at end of file
...@@ -43,8 +43,12 @@ class xlsx_pivots_context::Impl ...@@ -43,8 +43,12 @@ class xlsx_pivots_context::Impl
public: public:
struct _pivot_cache struct _pivot_cache
{ {
std::wstring definitionsData_; _pivot_cache(const std::wstring & def, const std::wstring & rec) : definitions_(def), records_(rec) {}
std::wstring recordsData_;
std::wstring definitions_;
std::wstring records_;
std::unordered_map<std::wstring, std::wstring> externals_;
}; };
struct _pivot_view struct _pivot_view
{ {
...@@ -65,9 +69,15 @@ xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl ...@@ -65,9 +69,15 @@ 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)
{ {
Impl::_pivot_cache c = {definitions, records}; if (definitions.empty()) return;
Impl::_pivot_cache c(definitions, records);
impl_->caches_.push_back(c); impl_->caches_.push_back(c);
} }
void xlsx_pivots_context::add_cache_external(std::unordered_map<std::wstring, std::wstring> &externals)
{
impl_->caches_.back().externals_ = externals;
}
int xlsx_pivots_context::get_cache_count() int xlsx_pivots_context::get_cache_count()
{ {
...@@ -79,12 +89,20 @@ bool xlsx_pivots_context::is_connections() ...@@ -79,12 +89,20 @@ bool xlsx_pivots_context::is_connections()
} }
void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels) void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
{ {
if (impl_->caches_[index].recordsData_.empty() == false) if (impl_->caches_[index].records_.empty() == false)
{ {
Rels.add(relationship(L"rId1", Rels.add(relationship(L"rId1",
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
L"pivotCacheRecords" + std::to_wstring(index + 1) + L".xml", L"")); L"pivotCacheRecords" + std::to_wstring(index + 1) + L".xml", L""));
} }
int i = 0;
for (std::unordered_map<std::wstring, std::wstring>::iterator it = impl_->caches_[index].externals_.begin();
it != impl_->caches_[index].externals_.end(); it++, i++)
{
Rels.add(relationship(L"extId" + std::to_wstring(i + 1),
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
it->second, L"External"));
}
} }
void xlsx_pivots_context::dump_rels_view(int index, rels & Rels) void xlsx_pivots_context::dump_rels_view(int index, rels & Rels)
{ {
...@@ -97,7 +115,7 @@ void xlsx_pivots_context::dump_rels_view(int index, rels & Rels) ...@@ -97,7 +115,7 @@ void xlsx_pivots_context::dump_rels_view(int index, rels & Rels)
} }
void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm) void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm)
{ {
strm << impl_->caches_[index].definitionsData_; strm << impl_->caches_[index].definitions_;
} }
void xlsx_pivots_context::write_connections_to(std::wostream & strm) void xlsx_pivots_context::write_connections_to(std::wostream & strm)
{ {
...@@ -114,7 +132,7 @@ void xlsx_pivots_context::write_connections_to(std::wostream & strm) ...@@ -114,7 +132,7 @@ void xlsx_pivots_context::write_connections_to(std::wostream & strm)
void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm) void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm)
{ {
strm << impl_->caches_[index].recordsData_; strm << impl_->caches_[index].records_;
} }
void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm) void xlsx_pivots_context::write_table_view_to(int index, std::wostream & strm)
{ {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#pragma once #pragma once
#include "oox_package.h" #include "oox_package.h"
#include <unordered_map>
namespace oox { namespace oox {
...@@ -47,6 +48,8 @@ public: ...@@ -47,6 +48,8 @@ public:
int get_view_count(); int get_view_count();
void add_cache(std::wstring definitions, std::wstring records); void add_cache(std::wstring definitions, std::wstring records);
void add_cache_external(std::unordered_map<std::wstring, std::wstring> &externals);
int get_cache_count(); int get_cache_count();
void write_cache_definitions_to (int index, std::wostream & strm); void write_cache_definitions_to (int index, std::wostream & strm);
......
...@@ -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