Commit 83c0ba9d authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - table parts

parent a2443dad
...@@ -46,7 +46,7 @@ static inline void trim(std::wstring &s) ...@@ -46,7 +46,7 @@ static inline void trim(std::wstring &s)
if (s[i] != 0) break; if (s[i] != 0) break;
else new_size--; else new_size--;
} }
if (new_size < s.length()) if (new_size < (int)s.length())
s.erase(new_size); s.erase(new_size);
} }
...@@ -93,13 +93,13 @@ void AutoFilter::readFields(CFRecord& record) ...@@ -93,13 +93,13 @@ void AutoFilter::readFields(CFRecord& record)
record >> doper2; record >> doper2;
} }
if ((doper1.vt == BIFF_BYTE(0)) && (doper2.vt == BIFF_BYTE(0))) if (doper1.vt == 0 && doper2.vt == 0)
{ {
m_bAutoFilter12 = true; m_bAutoFilter12 = true;
return; return;
} }
if (doper1.vt == BIFF_BYTE(0x06)) if (doper1.vt == 0x06)
{ {
XLUnicodeStringNoCch s; XLUnicodeStringNoCch s;
s.setSize(doper1.vtValueStr.cch); s.setSize(doper1.vtValueStr.cch);
...@@ -109,7 +109,7 @@ void AutoFilter::readFields(CFRecord& record) ...@@ -109,7 +109,7 @@ void AutoFilter::readFields(CFRecord& record)
trim(str1); trim(str1);
} }
if (doper2.vt == BIFF_BYTE(0x06)) if (doper2.vt == 0x06)
{ {
XLUnicodeStringNoCch s; XLUnicodeStringNoCch s;
s.setSize(doper2.vtValueStr.cch); s.setSize(doper2.vtValueStr.cch);
......
...@@ -58,14 +58,6 @@ void AutoFilter12::readFields(CFRecord& record) ...@@ -58,14 +58,6 @@ void AutoFilter12::readFields(CFRecord& record)
record >> frtRefHeader >> iEntry >> fHideArrow >> ft >> cft >> cCriteria >> cDateGroupings >> flags >> unused2 >> idList; record >> frtRefHeader >> iEntry >> fHideArrow >> ft >> cft >> cCriteria >> cDateGroupings >> flags >> unused2 >> idList;
_UINT16 _iEntry = iEntry;
_UINT32 _fHideArrow = fHideArrow;
_UINT32 _ft = ft;
_UINT32 _cft = cft;
_UINT32 _cCriteria = cCriteria;
_UINT32 _cDateGroupings = cDateGroupings;
_UINT32 _idList = idList;
// TODO доделать // TODO доделать
record.skipNunBytes(record.getDataSize() - record.getRdPtr()); record.skipNunBytes(record.getDataSize() - record.getRdPtr());
...@@ -82,11 +74,12 @@ void AutoFilter12::readFields(CFRecord& record) ...@@ -82,11 +74,12 @@ void AutoFilter12::readFields(CFRecord& record)
record >> frtRefHeaderContinue; record >> frtRefHeaderContinue;
if (frtRefHeaderContinue.rt == 0x087F) if (frtRefHeaderContinue.rt == 0x087F)
{ {
if ( (ft == BIFF_DWORD(0)) && (cCriteria > 0) ) if ( ft == 0 && cCriteria > 0)
{ {
AF12CriteriaPtr item(new AF12Criteria); AF12CriteriaPtr item(new AF12Criteria);
item->load(record); item->load(record);
rgbAF12Criteries.push_back(item);
arAF12Criteries.push_back(item);
} }
} }
} }
......
...@@ -32,17 +32,16 @@ ...@@ -32,17 +32,16 @@
#pragma once #pragma once
#include "BiffRecordContinued.h" #include "BiffRecordContinued.h"
#include <Logic/Biff_structures/FrtRefHeader.h>
#include <Logic/Biff_structures/BiffString.h> #include "../Biff_structures/FrtRefHeader.h"
#include <Logic/Biff_structures/FrtRefHeader.h> #include "../Biff_structures/BiffString.h"
#include <Logic/Biff_structures/AFDOper.h> #include "../Biff_structures/FrtRefHeader.h"
#include <Logic/Biff_structures/AF12Criteria.h> #include "../Biff_structures/AFDOper.h"
#include "../Biff_structures/AF12Criteria.h"
namespace XLS namespace XLS
{ {
// Logical representation of AutoFilter12 record in BIFF8
class AutoFilter12: public BiffRecordContinued class AutoFilter12: public BiffRecordContinued
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(AutoFilter12) BIFF_RECORD_DEFINE_TYPE_INFO(AutoFilter12)
...@@ -53,21 +52,21 @@ public: ...@@ -53,21 +52,21 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeAutoFilter12; static const ElementType type = typeAutoFilter12;
FrtRefHeader frtRefHeader; FrtRefHeader frtRefHeader;
_UINT16 iEntry; _UINT16 iEntry;
BIFF_DWORD fHideArrow; _UINT32 fHideArrow;
BIFF_DWORD ft; _UINT32 ft;
BIFF_DWORD cft; _UINT32 cft;
BIFF_DWORD cCriteria; _UINT32 cCriteria;
BIFF_DWORD cDateGroupings; _UINT32 cDateGroupings;
BIFF_DWORD idList; _UINT32 idList;
BiffStructurePtrVector rgbAF12Criteries; BiffStructurePtrVector arAF12Criteries;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of BookBool record in BIFF8
class BookBool: public BiffRecord class BookBool: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(BookBool) BIFF_RECORD_DEFINE_TYPE_INFO(BookBool)
...@@ -47,20 +45,18 @@ public: ...@@ -47,20 +45,18 @@ public:
~BookBool(); ~BookBool();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeBookBool; static const ElementType type = typeBookBool;
//-----------------------------
bool fNoSaveSup; bool fNoSaveSup;
bool fHasEnvelope; bool fHasEnvelope;
bool fEnvelopeVisible; bool fEnvelopeVisible;
bool fEnvelopeInitDone; bool fEnvelopeInitDone;
bool fHideBorderUnselLists; bool fHideBorderUnselLists;
BIFF_BSTR grUpdateLinks; std::wstring grUpdateLinks;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -56,6 +56,7 @@ void BopPop::readFields(CFRecord& record) ...@@ -56,6 +56,7 @@ void BopPop::readFields(CFRecord& record)
{ {
unsigned short flags; unsigned short flags;
record >> pst >> fAutoSplit >> split >> iSplitPos >> pcSplitPercent >> pcPie2Size >> pcGap >> numSplitValue >> flags; record >> pst >> fAutoSplit >> split >> iSplitPos >> pcSplitPercent >> pcPie2Size >> pcGap >> numSplitValue >> flags;
fHasShadow = GETBIT(flags, 0); fHasShadow = GETBIT(flags, 0);
} }
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of BopPop record in BIFF8
class BopPop: public BiffRecord class BopPop: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(BopPop) BIFF_RECORD_DEFINE_TYPE_INFO(BopPop)
...@@ -47,7 +45,6 @@ public: ...@@ -47,7 +45,6 @@ public:
~BopPop(); ~BopPop();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
...@@ -57,7 +54,7 @@ public: ...@@ -57,7 +54,7 @@ public:
//----------------------------- //-----------------------------
unsigned char pst; unsigned char pst;
unsigned char fAutoSplit; bool fAutoSplit;
_UINT16 split; _UINT16 split;
_INT16 iSplitPos; _INT16 iSplitPos;
_INT16 pcSplitPercent; _INT16 pcSplitPercent;
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of CalcMode record in BIFF8
class CalcMode: public BiffRecord class CalcMode: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(CalcMode) BIFF_RECORD_DEFINE_TYPE_INFO(CalcMode)
...@@ -53,8 +51,7 @@ public: ...@@ -53,8 +51,7 @@ public:
static const ElementType type = typeCalcMode; static const ElementType type = typeCalcMode;
//----------------------------- std::wstring fAutoRecalc;
BIFF_BSTR fAutoRecalc;
}; };
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of CalcRefMode record in BIFF8
class CalcRefMode: public BiffRecord class CalcRefMode: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(CalcRefMode) BIFF_RECORD_DEFINE_TYPE_INFO(CalcRefMode)
...@@ -47,14 +45,12 @@ public: ...@@ -47,14 +45,12 @@ public:
~CalcRefMode(); ~CalcRefMode();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeCalcRefMode; static const ElementType type = typeCalcRefMode;
//----------------------------- std::wstring fRefA1;
BIFF_BSTR fRefA1;
}; };
......
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of CondFmt record in BIFF8
class CondFmt: public BiffRecord class CondFmt: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(CondFmt) BIFF_RECORD_DEFINE_TYPE_INFO(CondFmt)
...@@ -48,20 +45,18 @@ public: ...@@ -48,20 +45,18 @@ public:
~CondFmt(); ~CondFmt();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeCondFmt; static const ElementType type = typeCondFmt;
const CellRef getLocation() const; const CellRef getLocation() const;
//----------------------------- _UINT16 ccf;
_UINT16 ccf; bool fToughRecalc;
bool fToughRecalc; _UINT16 nID;
_UINT16 nID; SqRefU sqref;
SqRefU sqref; std::wstring refBound;
BIFF_BSTR refBound;
}; };
typedef boost::shared_ptr<CondFmt> CondFmtPtr; typedef boost::shared_ptr<CondFmt> CondFmtPtr;
......
...@@ -35,9 +35,6 @@ ...@@ -35,9 +35,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of CrtLayout12 record in BIFF8
class CrtLayout12: public BiffRecord class CrtLayout12: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(CrtLayout12) BIFF_RECORD_DEFINE_TYPE_INFO(CrtLayout12)
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
*/ */
#include "Feat.h" #include "Feat.h"
#include <Logic/Biff_structures/FrtHeader.h> #include "../Biff_structures/FrtHeader.h"
namespace XLS namespace XLS
{ {
...@@ -54,20 +54,21 @@ BaseObjectPtr Feat::clone() ...@@ -54,20 +54,21 @@ BaseObjectPtr Feat::clone()
void Feat::readFields(CFRecord& record) void Feat::readFields(CFRecord& record)
{ {
FrtHeader frtHeader(rt_Feat); FrtHeader frtHeader(rt_Feat);
record >> frtHeader;
record >> isf; record >> frtHeader >> isf;
record.skipNunBytes(5); // reserved record.skipNunBytes(5); // reserved
record >> cref >> cbFeatData; record >> cref >> cbFeatData;
record.skipNunBytes(2); // reserved record.skipNunBytes(2); // reserved
std::wstring sqref_str;
for (int i = 0; i < cref ; ++i) for (int i = 0; i < cref ; ++i)
{ {
Ref8U reff; Ref8U reff;
record >> reff; record >> reff;
refs.push_back(BiffStructurePtr(new Ref8U(reff))); refs.push_back(BiffStructurePtr(new Ref8U(reff)));
sqref_str += std::wstring (reff.toString().c_str()) + ((i == cref - 1) ? L"" : L" ");
sqref += reff.toString() + ((i == cref - 1) ? L"" : L" ");
} }
sqref = sqref_str;
switch(isf) switch(isf)
{ {
......
...@@ -32,16 +32,14 @@ ...@@ -32,16 +32,14 @@
#pragma once #pragma once
#include "BiffRecordContinued.h" #include "BiffRecordContinued.h"
#include <Logic/Biff_structures/CellRangeRef.h> #include "../Biff_structures/CellRangeRef.h"
#include <Logic/Biff_structures/FeatProtection.h> #include "../Biff_structures/FeatProtection.h"
#include <Logic/Biff_structures/FeatFormulaErr2.h> #include "../Biff_structures/FeatFormulaErr2.h"
#include <Logic/Biff_structures/FeatSmartTag.h> #include "../Biff_structures/FeatSmartTag.h"
namespace XLS namespace XLS
{ {
// Logical representation of Feat record in BIFF8
class Feat: public BiffRecordContinued class Feat: public BiffRecordContinued
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Feat) BIFF_RECORD_DEFINE_TYPE_INFO(Feat)
...@@ -51,22 +49,20 @@ public: ...@@ -51,22 +49,20 @@ public:
~Feat(); ~Feat();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeFeat; static const ElementType type = typeFeat;
//----------------------------- SharedFeatureType isf;
SharedFeatureType isf; _UINT16 cref;
_UINT16 cref; _UINT32 cbFeatData;
_UINT32 cbFeatData;
BiffStructurePtrVector refs; BiffStructurePtrVector refs;
BIFF_BSTR sqref; std::wstring sqref;
FeatProtection protection; FeatProtection protection;
FeatFormulaErr2 formula_err; FeatFormulaErr2 formula_err;
FeatSmartTag smart_tag; FeatSmartTag smart_tag;
}; };
......
...@@ -50,21 +50,17 @@ public: ...@@ -50,21 +50,17 @@ public:
~Feature11(); ~Feature11();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeFeature11; static const ElementType type = typeFeature11;
public:
FrtRefHeaderU frtRefHeaderU; FrtRefHeaderU frtRefHeaderU;
_UINT16 isf; _UINT16 isf;
_UINT16 cref2; _UINT16 cref2;
_UINT32 cbFeatData; _UINT32 cbFeatData;
BiffStructurePtrVector refs2; BiffStructurePtrVector refs2;
BIFF_BSTR sqref; std::wstring sqref;
TableFeatureType rgbFeat; TableFeatureType rgbFeat;
}; };
......
...@@ -32,13 +32,11 @@ ...@@ -32,13 +32,11 @@
#pragma once #pragma once
#include "BiffRecord.h" #include "BiffRecord.h"
#include <Logic/Biff_structures/BiffString.h> #include "../Biff_structures/BiffString.h"
namespace XLS namespace XLS
{ {
// Logical representation of FileSharing record in BIFF8
class FileSharing: public BiffRecord class FileSharing: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(FileSharing) BIFF_RECORD_DEFINE_TYPE_INFO(FileSharing)
...@@ -48,16 +46,14 @@ public: ...@@ -48,16 +46,14 @@ public:
~FileSharing(); ~FileSharing();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeFileSharing; static const ElementType type = typeFileSharing;
//-----------------------------
Boolean<unsigned short> fReadOnlyRec; Boolean<unsigned short> fReadOnlyRec;
unsigned short wResPassNum; unsigned short wResPassNum;
BIFF_BSTR wResPass; std::wstring wResPass;
_UINT16 iNoResPass; _UINT16 iNoResPass;
XLUnicodeString stUNUsername; XLUnicodeString stUNUsername;
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of HLinkTooltip record in BIFF8
class HLinkTooltip: public BiffRecord class HLinkTooltip: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(HLinkTooltip) BIFF_RECORD_DEFINE_TYPE_INFO(HLinkTooltip)
...@@ -47,15 +45,13 @@ public: ...@@ -47,15 +45,13 @@ public:
~HLinkTooltip(); ~HLinkTooltip();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeHLinkTooltip; static const ElementType type = typeHLinkTooltip;
//----------------------------- std::wstring wzTooltip;
BIFF_BSTR wzTooltip; BackwardOnlyParam<std::wstring > ref_;
BackwardOnlyParam<std::wstring > ref_;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -80,12 +80,9 @@ int LabelSst::serialize(std::wostream & stream) ...@@ -80,12 +80,9 @@ int LabelSst::serialize(std::wostream & stream)
CP_XML_ATTR(L"t", L"s"); CP_XML_ATTR(L"t", L"s");
if (isst.value()) CP_XML_NODE(L"v")
{ {
CP_XML_NODE(L"v") CP_XML_STREAM() << isst;
{
CP_XML_STREAM() << isst;
}
} }
} }
} }
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
CellOffsetResender resender; CellOffsetResender resender;
Cell cell; Cell cell;
BIFF_DWORD isst; _UINT32 isst;
}; };
......
...@@ -44,8 +44,7 @@ const wchar_t* const AutoFilterDefineNames[] = ...@@ -44,8 +44,7 @@ const wchar_t* const AutoFilterDefineNames[] =
}; };
Lbl::Lbl() Lbl::Lbl() : rgce(false), fGrp(0)
: rgce(false), fGrp(0)
{ {
} }
...@@ -167,10 +166,6 @@ void Lbl::readFields(CFRecord& record) ...@@ -167,10 +166,6 @@ void Lbl::readFields(CFRecord& record)
} }
} }
const XLUnicodeStringNoCch Lbl::getName() const
{
return Name_bin;
}
} // namespace XLS } // namespace XLS
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of Lbl record in BIFF8
class Lbl: public BiffRecord class Lbl: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Lbl) BIFF_RECORD_DEFINE_TYPE_INFO(Lbl)
...@@ -51,15 +49,10 @@ public: ...@@ -51,15 +49,10 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeLbl; static const ElementType type = typeLbl;
const XLUnicodeStringNoCch getName() const;
//-----------------------------
bool fHidden; bool fHidden;
bool fFunc; bool fFunc;
bool fOB; bool fOB;
...@@ -70,11 +63,11 @@ public: ...@@ -70,11 +63,11 @@ public:
bool fPublished; bool fPublished;
bool fWorkbookParam; bool fWorkbookParam;
unsigned char chKey; unsigned char chKey;
_UINT16 itab; _UINT16 itab;
XLUnicodeStringNoCch Name_bin; XLUnicodeStringNoCch Name_bin;
BIFF_BSTR Name; std::wstring Name;
NameParsedFormula rgce; NameParsedFormula rgce;
}; };
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#include "List12.h" #include "List12.h"
#include "../Biff_structures/List12BlockLevel.h"
#include "../Biff_structures/List12TableStyleClientInfo.h"
#include "../Biff_structures/List12DisplayName.h"
namespace XLS namespace XLS
{ {
...@@ -56,20 +60,20 @@ void List12::readFields(CFRecord& record) ...@@ -56,20 +60,20 @@ void List12::readFields(CFRecord& record)
record >> lsd; record >> lsd;
record >> idList; record >> idList;
unsigned short _lsd = lsd;
switch (lsd) switch (lsd)
{ {
case 0: case 0:
record >> rgbList12BlockLevel; rgbList12 = BiffStructurePtr(new List12BlockLevel);
break; break;
case 1: case 1:
record >> rgbList12TableStyleClientInfo; rgbList12 = BiffStructurePtr(new List12TableStyleClientInfo);
break; break;
case 2: case 2:
record >> rgbList12DisplayName; rgbList12 = BiffStructurePtr(new List12DisplayName);
break; break;
} }
if (rgbList12)
rgbList12->load(record);
} }
} // namespace XLS } // namespace XLS
......
...@@ -32,16 +32,12 @@ ...@@ -32,16 +32,12 @@
#pragma once #pragma once
#include "BiffRecord.h" #include "BiffRecord.h"
#include <Logic/Biff_structures/FrtHeader.h> #include "../Biff_structures/FrtHeader.h"
#include <Logic/Biff_structures/List12BlockLevel.h>
#include <Logic/Biff_structures/List12TableStyleClientInfo.h>
#include <Logic/Biff_structures/List12DisplayName.h>
namespace XLS namespace XLS
{ {
// Logical representation of List12 record in BIFF8
class List12: public BiffRecord class List12: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(List12) BIFF_RECORD_DEFINE_TYPE_INFO(List12)
...@@ -51,19 +47,16 @@ public: ...@@ -51,19 +47,16 @@ public:
~List12(); ~List12();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeList12; static const ElementType type = typeList12;
FrtHeader frtHeader; FrtHeader frtHeader;
_UINT16 lsd; _UINT16 lsd;
_UINT32 idList; _UINT32 idList;
List12BlockLevel rgbList12BlockLevel; BiffStructurePtr rgbList12;
List12TableStyleClientInfo rgbList12TableStyleClientInfo;
List12DisplayName rgbList12DisplayName;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of Pane record in BIFF8
class Pane: public BiffRecord class Pane: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Pane) BIFF_RECORD_DEFINE_TYPE_INFO(Pane)
...@@ -49,20 +47,18 @@ public: ...@@ -49,20 +47,18 @@ public:
~Pane(); ~Pane();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typePane; static const ElementType type = typePane;
//-----------------------------
_UINT16 x; _UINT16 x;
_UINT16 y; _UINT16 y;
_UINT16 rwTop; _UINT16 rwTop;
_UINT16 colLeft; _UINT16 colLeft;
PaneType pnnAcct; PaneType pnnAcct;
BIFF_BSTR topLeftCell; std::wstring topLeftCell;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -84,14 +84,14 @@ int Selection::serialize(std::wostream & stream) ...@@ -84,14 +84,14 @@ int Selection::serialize(std::wostream & stream)
// default: CP_XML_ATTR(L"pane", L"topLeft"); // default: CP_XML_ATTR(L"pane", L"topLeft");
} }
if (*activeCell.value() != L"A1") if (activeCell != L"A1")
CP_XML_ATTR(L"activeCell", *activeCell.value()); CP_XML_ATTR(L"activeCell", activeCell);
if (irefAct != 0) if (irefAct != 0)
CP_XML_ATTR(L"activeCellId", irefAct); CP_XML_ATTR(L"activeCellId", irefAct);
if (*sqref.value() != L"A1") if (sqref != L"A1")
CP_XML_ATTR(L"sqref", *sqref.value()); CP_XML_ATTR(L"sqref", sqref);
} }
} }
return 0; return 0;
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of Selection record in BIFF8
class Selection: public BiffRecord class Selection: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Selection) BIFF_RECORD_DEFINE_TYPE_INFO(Selection)
...@@ -49,7 +47,6 @@ public: ...@@ -49,7 +47,6 @@ public:
~Selection(); ~Selection();
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
...@@ -57,15 +54,14 @@ public: ...@@ -57,15 +54,14 @@ public:
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
//-----------------------------
PaneType pnn; PaneType pnn;
R_RwU rwAct; R_RwU rwAct;
ColU colAct; ColU colAct;
_INT16 irefAct; _INT16 irefAct;
BIFF_BSTR sqref; std::wstring sqref;
BIFF_BSTR activeCell; std::wstring activeCell;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of SerAuxErrBar record in BIFF8
class SerAuxErrBar: public BiffRecord class SerAuxErrBar: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(SerAuxErrBar) BIFF_RECORD_DEFINE_TYPE_INFO(SerAuxErrBar)
......
...@@ -58,8 +58,8 @@ public: ...@@ -58,8 +58,8 @@ public:
bool fAltMethod; bool fAltMethod;
unsigned char sfp; unsigned char sfp;
BIFF_DWORD cconditions; _UINT32 cconditions;
BIFF_DWORD idParent; _UINT32 idParent;
BiffStructurePtrVector sortCond12Array; BiffStructurePtrVector sortCond12Array;
FrtHeader frtHeader; FrtHeader frtHeader;
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of Table record in BIFF8
class Table: public BiffRecord class Table: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Table) BIFF_RECORD_DEFINE_TYPE_INFO(Table)
...@@ -54,7 +52,6 @@ public: ...@@ -54,7 +52,6 @@ public:
static const ElementType type = typeTable; static const ElementType type = typeTable;
//-----------------------------
Ref ref_; Ref ref_;
bool fAlwaysCalc; bool fAlwaysCalc;
...@@ -63,8 +60,8 @@ public: ...@@ -63,8 +60,8 @@ public:
bool fDeleted1; bool fDeleted1;
bool fDeleted2; bool fDeleted2;
BIFF_BSTR r1; std::wstring r1;
BIFF_BSTR r2; std::wstring r2;
}; };
......
...@@ -58,10 +58,10 @@ public: ...@@ -58,10 +58,10 @@ public:
_UINT16 tabId; _UINT16 tabId;
std::wstring guid; std::wstring guid;
BIFF_DWORD x; _UINT32 x;
BIFF_DWORD y; _UINT32 y;
BIFF_DWORD dx; _UINT32 dx;
BIFF_DWORD dy; _UINT32 dy;
_UINT16 wTabRatio; _UINT16 wTabRatio;
......
...@@ -46,7 +46,6 @@ UserSViewBegin::~UserSViewBegin() ...@@ -46,7 +46,6 @@ UserSViewBegin::~UserSViewBegin()
{ {
} }
BaseObjectPtr UserSViewBegin::clone() BaseObjectPtr UserSViewBegin::clone()
{ {
return BaseObjectPtr(new UserSViewBegin(*this)); return BaseObjectPtr(new UserSViewBegin(*this));
......
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
//----------------------------- //-----------------------------
std::wstring guid; std::wstring guid;
TabId iTabid; TabId iTabid;
BIFF_DWORD wScale; _UINT32 wScale;
Icv icvHdr; Icv icvHdr;
PaneType pnnSel; PaneType pnnSel;
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of Window2 record in BIFF8
class Window2: public BiffRecord class Window2: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Window2) BIFF_RECORD_DEFINE_TYPE_INFO(Window2)
...@@ -53,7 +51,6 @@ public: ...@@ -53,7 +51,6 @@ public:
static const ElementType type = typeWindow2; static const ElementType type = typeWindow2;
//-----------------------------
bool fDspFmlaRt; bool fDspFmlaRt;
bool fDspGridRt; bool fDspGridRt;
bool fDspRwColRt; bool fDspRwColRt;
...@@ -76,7 +73,7 @@ public: ...@@ -76,7 +73,7 @@ public:
_UINT16 wScaleSLV; _UINT16 wScaleSLV;
_UINT16 wScaleNormal; _UINT16 wScaleNormal;
BIFF_BSTR topLeftCell; std::wstring topLeftCell;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -56,7 +56,7 @@ void AF12Criteria::load(CFRecord& record) ...@@ -56,7 +56,7 @@ void AF12Criteria::load(CFRecord& record)
doper.m_bAutoFilter = false; doper.m_bAutoFilter = false;
record >> doper; record >> doper;
if (doper.vt == BIFF_BYTE(0x06)) if (doper.vt == 0x06)
{ {
unsigned char _cch = doper.vtValueStr.cch; unsigned char _cch = doper.vtValueStr.cch;
......
...@@ -54,7 +54,6 @@ public: ...@@ -54,7 +54,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
static const ElementType type = typeAFDOper; static const ElementType type = typeAFDOper;
unsigned char vt; unsigned char vt;
......
...@@ -52,7 +52,6 @@ public: ...@@ -52,7 +52,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned char cch; unsigned char cch;
unsigned char fCompare; unsigned char fCompare;
......
...@@ -78,9 +78,7 @@ typedef unsigned char FillPattern; ...@@ -78,9 +78,7 @@ typedef unsigned char FillPattern;
typedef BiffAttributeSimple<unsigned char> BIFF_BYTE; typedef BiffAttributeSimple<unsigned char> BIFF_BYTE;
typedef BiffAttributeSimple<_UINT16> BIFF_WORD; typedef BiffAttributeSimple<_UINT16> BIFF_WORD;
typedef BiffAttributeSimple<_UINT32> BIFF_DWORD; typedef BiffAttributeSimple<_UINT32> BIFF_DWORD;
typedef BiffAttributeSimple<_INT32> BIFF_LONG;
typedef BiffAttributeSimple<double> BIFF_DOUBLE; typedef BiffAttributeSimple<double> BIFF_DOUBLE;
typedef BiffAttributeSimple<std::wstring> BIFF_BSTR;
struct PtgAttrSpaceType : public BiffStructure_NoVtbl struct PtgAttrSpaceType : public BiffStructure_NoVtbl
......
...@@ -50,7 +50,6 @@ public: ...@@ -50,7 +50,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned short icf; unsigned short icf;
unsigned char cp; unsigned char cp;
unsigned char icfTemplate; unsigned char icfTemplate;
......
...@@ -47,10 +47,10 @@ void ControlInfo::load(CFRecord& record) ...@@ -47,10 +47,10 @@ void ControlInfo::load(CFRecord& record)
unsigned short flags; unsigned short flags;
record >> flags; record >> flags;
fDefault = GETBIT(flags, 0); fDefault = GETBIT(flags, 0);
fHelp = GETBIT(flags, 1); fHelp = GETBIT(flags, 1);
fCancel = GETBIT(flags, 2); fCancel = GETBIT(flags, 2);
fDismiss = GETBIT(flags, 3); fDismiss = GETBIT(flags, 3);
record >> accel1; record >> accel1;
record.skipNunBytes(2); // reserved2 record.skipNunBytes(2); // reserved2
......
...@@ -46,11 +46,12 @@ public: ...@@ -46,11 +46,12 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned char fDefault; bool fDefault;
unsigned char fHelp; bool fHelp;
unsigned char fCancel; bool fCancel;
unsigned char fDismiss; bool fDismiss;
_UINT16 accel1;
_UINT16 accel1;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -53,11 +53,10 @@ class DXFN : public BiffStructure ...@@ -53,11 +53,10 @@ class DXFN : public BiffStructure
public: public:
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeDXFN; static const ElementType type = typeDXFN;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
bool alchNinch; bool alchNinch;
......
...@@ -44,6 +44,7 @@ BiffStructurePtr DXFN12List::clone() ...@@ -44,6 +44,7 @@ BiffStructurePtr DXFN12List::clone()
DXFN12List::DXFN12List() DXFN12List::DXFN12List()
{ {
size = -1;
} }
...@@ -53,8 +54,20 @@ DXFN12List::~DXFN12List() ...@@ -53,8 +54,20 @@ DXFN12List::~DXFN12List()
void DXFN12List::load(CFRecord& record) void DXFN12List::load(CFRecord& record)
{ {
record >> dxfn; size_t pos_record = record.getRdPtr();
record >> xfext;
if (size < 0) size = record.getDataSize() - pos_record;
if (size > 0)
{
record >> dxfn;
size -= (record.getRdPtr() - pos_record);
}
if (size > 0)
{
record >> xfext;
size -= (record.getRdPtr() - pos_record);
}
} }
......
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
*/ */
#pragma once #pragma once
#include <Logic/Biff_records/BiffRecord.h> #include "../Biff_records/BiffRecord.h"
#include <Logic/Biff_structures/BiffString.h> #include "../Biff_structures/BiffString.h"
#include <Logic/Biff_structures/DXFN.h> #include "../Biff_structures/DXFN.h"
#include <Logic/Biff_structures/XFExtNoFRT.h> #include "../Biff_structures/XFExtNoFRT.h"
namespace XLS namespace XLS
{ {
...@@ -52,9 +52,9 @@ public: ...@@ -52,9 +52,9 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
int size;
DXFN dxfn; DXFN dxfn;
XFExtNoFRT xfext; XFExtNoFRT xfext;
}; };
typedef boost::shared_ptr<DXFN12List> DXFN12ListPtr; typedef boost::shared_ptr<DXFN12List> DXFN12ListPtr;
......
...@@ -36,16 +36,12 @@ ...@@ -36,16 +36,12 @@
namespace XLS namespace XLS
{ {
BiffStructurePtr Feat11FieldDataItem::clone() BiffStructurePtr Feat11FieldDataItem::clone()
{ {
return BiffStructurePtr(new Feat11FieldDataItem(*this)); return BiffStructurePtr(new Feat11FieldDataItem(*this));
} }
void Feat11FieldDataItem::load(CFRecord& record) void Feat11FieldDataItem::load(CFRecord& record)
{ {
record >> idField; record >> idField;
record >> lfdt; record >> lfdt;
record >> lfxidt; record >> lfxidt;
...@@ -56,15 +52,15 @@ void Feat11FieldDataItem::load(CFRecord& record) ...@@ -56,15 +52,15 @@ void Feat11FieldDataItem::load(CFRecord& record)
_UINT32 flags; _UINT32 flags;
record >> flags; record >> flags;
fAutoFilter = static_cast<unsigned char>(GETBIT(flags, 0)); fAutoFilter = GETBIT(flags, 0);
fAutoFilterHidden = static_cast<unsigned char>(GETBIT(flags, 1)); fAutoFilterHidden = GETBIT(flags, 1);
fLoadXmapi = static_cast<unsigned char>(GETBIT(flags, 2)); fLoadXmapi = GETBIT(flags, 2);
fLoadFmla = static_cast<unsigned char>(GETBIT(flags, 3)); fLoadFmla = GETBIT(flags, 3);
fLoadTotalFmla = static_cast<unsigned char>(GETBIT(flags, 7)); fLoadTotalFmla = GETBIT(flags, 7);
fLoadTotalArray = static_cast<unsigned char>(GETBIT(flags, 8)); fLoadTotalArray = GETBIT(flags, 8);
fSaveStyleName = static_cast<unsigned char>(GETBIT(flags, 9)); fSaveStyleName = GETBIT(flags, 9);
fLoadTotalStr = static_cast<unsigned char>(GETBIT(flags, 10)); fLoadTotalStr = GETBIT(flags, 10);
fAutoCreateCalcCol = static_cast<unsigned char>(GETBIT(flags, 11)); fAutoCreateCalcCol = GETBIT(flags, 11);
record >> cbFmtInsertRow; record >> cbFmtInsertRow;
record >> istnInsertRow; record >> istnInsertRow;
...@@ -75,12 +71,69 @@ void Feat11FieldDataItem::load(CFRecord& record) ...@@ -75,12 +71,69 @@ void Feat11FieldDataItem::load(CFRecord& record)
return;//125 Planilhas de Excel.xls return;//125 Planilhas de Excel.xls
if (cbFmtAgg > 0) if (cbFmtAgg > 0)
{
dxfFmtAgg.size = cbFmtAgg;
record >> dxfFmtAgg; record >> dxfFmtAgg;
}
if (cbFmtInsertRow > 0) if (cbFmtInsertRow > 0)
{
dxfFmtInsertRow.size = cbFmtInsertRow;
record >> dxfFmtInsertRow; record >> dxfFmtInsertRow;
if (fAutoFilter == BIFF_BYTE(1)) }
if (fAutoFilter)
record >> AutoFilter; record >> AutoFilter;
} }
//---------------------------------------------------------------------------------------------------------
BiffStructurePtr Feat11RgSharepointIdDel::clone()
{
return BiffStructurePtr(new Feat11RgSharepointIdDel(*this));
}
void Feat11RgSharepointIdDel::load(CFRecord& record)
{
record >> cId;
for (_UINT16 i = 0; i < cId; i++)
{
_UINT32 val;
record >> val;
rgId.push_back(val);
}
}
//---------------------------------------------------------------------------------------------------------
BiffStructurePtr Feat11RgSharepointIdChange::clone()
{
return BiffStructurePtr(new Feat11RgSharepointIdChange(*this));
}
void Feat11RgSharepointIdChange::load(CFRecord& record)
{
record >> cId;
for (_UINT16 i = 0; i < cId; i++)
{
_UINT32 val;
record >> val;
rgId.push_back(val);
}
}
//---------------------------------------------------------------------------------------------------------
BiffStructurePtr Feat11RgInvalidCells::clone()
{
return BiffStructurePtr(new Feat11RgInvalidCells(*this));
}
void Feat11RgInvalidCells::load(CFRecord& record)
{
record >> cCellInvalid;
for (_UINT16 i = 0; i < cCellInvalid; i++)
{
Feat11CellStruct val;
record >> val.idxRow >> val.idxField;
rgCellInvalid.push_back(val);
}
}
} // namespace XLS } // namespace XLS
...@@ -31,10 +31,9 @@ ...@@ -31,10 +31,9 @@
*/ */
#pragma once #pragma once
#include "BiffStructure.h" #include "BiffString.h"
#include <Logic/Biff_structures/BiffString.h> #include "DXFN12List.h"
#include <Logic/Biff_structures/DXFN12List.h> #include "Feat11FdaAutoFilter.h"
#include <Logic/Biff_structures/Feat11FdaAutoFilter.h>
namespace XLS namespace XLS
{ {
...@@ -51,7 +50,6 @@ public: ...@@ -51,7 +50,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
_UINT32 idField; _UINT32 idField;
_UINT32 lfdt; _UINT32 lfdt;
_UINT32 lfxidt; _UINT32 lfxidt;
...@@ -59,15 +57,15 @@ public: ...@@ -59,15 +57,15 @@ public:
_UINT32 cbFmtAgg; _UINT32 cbFmtAgg;
_UINT32 istnAgg; _UINT32 istnAgg;
unsigned char fAutoFilter; bool fAutoFilter;
unsigned char fAutoFilterHidden; bool fAutoFilterHidden;
unsigned char fLoadXmapi; bool fLoadXmapi;
unsigned char fLoadFmla; bool fLoadFmla;
unsigned char fLoadTotalFmla; bool fLoadTotalFmla;
unsigned char fLoadTotalArray; bool fLoadTotalArray;
unsigned char fSaveStyleName; bool fSaveStyleName;
unsigned char fLoadTotalStr; bool fLoadTotalStr;
unsigned char fAutoCreateCalcCol; bool fAutoCreateCalcCol;
_UINT32 cbFmtInsertRow; _UINT32 cbFmtInsertRow;
_UINT32 istnInsertRow; _UINT32 istnInsertRow;
...@@ -82,6 +80,60 @@ public: ...@@ -82,6 +80,60 @@ public:
}; };
typedef boost::shared_ptr<Feat11FieldDataItem> Feat11FieldDataItemPtr; typedef boost::shared_ptr<Feat11FieldDataItem> Feat11FieldDataItemPtr;
//--------------------------------------------------------------------------------------------------
class Feat11RgSharepointIdDel : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(Feat11RgSharepointIdDel)
public:
BiffStructurePtr clone();
static const ElementType type = typeFeat11RgSharepointIdDel;
virtual void load(CFRecord& record);
_UINT16 cId;
std::vector<_UINT32> rgId;
};
typedef boost::shared_ptr<Feat11RgSharepointIdDel> Feat11RgSharepointIdDelPtr;
//--------------------------------------------------------------------------------------------------
class Feat11RgSharepointIdChange : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(Feat11RgSharepointIdChange)
public:
BiffStructurePtr clone();
static const ElementType type = typeFeat11RgSharepointIdChange;
virtual void load(CFRecord& record);
_UINT16 cId;
std::vector<_UINT32> rgId;
};
typedef boost::shared_ptr<Feat11RgSharepointIdChange> Feat11RgSharepointIdChangePtr;
//--------------------------------------------------------------------------------------------------
struct Feat11CellStruct
{
_UINT32 idxRow = 0;
_UINT32 idxField = 0;
};
class Feat11RgInvalidCells : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(Feat11RgInvalidCells)
public:
BiffStructurePtr clone();
static const ElementType type = typeFeat11RgInvalidCells;
virtual void load(CFRecord& record);
_UINT16 cCellInvalid;
std::vector<Feat11CellStruct> rgCellInvalid;
};
typedef boost::shared_ptr<Feat11RgInvalidCells> Feat11RgInvalidCellsPtr;
} // namespace XLS } // namespace XLS
...@@ -44,6 +44,15 @@ BiffStructurePtr List12BlockLevel::clone() ...@@ -44,6 +44,15 @@ BiffStructurePtr List12BlockLevel::clone()
List12BlockLevel::List12BlockLevel() List12BlockLevel::List12BlockLevel()
{ {
cbdxfHeader = 0xffffffff;
istnHeader = 0xffffffff;
cbdxfData = 0xffffffff;
istnData = 0xffffffff;
cbdxfAgg = 0xffffffff;
istnAgg = 0xffffffff;
cbdxfBorder = 0xffffffff;
cbdxfHeaderBorder = 0xffffffff;
cbdxfAggBorder = 0xffffffff;
} }
...@@ -64,17 +73,35 @@ void List12BlockLevel::load(CFRecord& record) ...@@ -64,17 +73,35 @@ void List12BlockLevel::load(CFRecord& record)
record >> cbdxfAggBorder; record >> cbdxfAggBorder;
if (cbdxfHeader) if (cbdxfHeader)
{
dxfHeader.size = cbdxfHeader;
record >> dxfHeader; record >> dxfHeader;
}
if (cbdxfData) if (cbdxfData)
{
dxfData.size = cbdxfData;
record >> dxfData; record >> dxfData;
}
if (cbdxfAgg) if (cbdxfAgg)
{
dxfAgg.size = cbdxfAgg;
record >> dxfAgg; record >> dxfAgg;
}
if (cbdxfBorder) if (cbdxfBorder)
{
dxfBorder.size = cbdxfBorder;
record >> dxfBorder; record >> dxfBorder;
}
if (cbdxfHeaderBorder) if (cbdxfHeaderBorder)
{
dxfHeaderBorder.size = cbdxfHeaderBorder;
record >> dxfHeaderBorder; record >> dxfHeaderBorder;
}
if (cbdxfAggBorder) if (cbdxfAggBorder)
{
dxfAggBorder.size = cbdxfAggBorder;
record >> dxfAggBorder; record >> dxfAggBorder;
}
if (istnHeader != -1) if (istnHeader != -1)
record >> stHeader; record >> stHeader;
if (istnData != -1) if (istnData != -1)
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
*/ */
#pragma once #pragma once
#include <Logic/Biff_records/BiffRecord.h> #include "../Biff_records/BiffRecord.h"
#include <Logic/Biff_structures/BiffString.h> #include "BiffString.h"
#include <Logic/Biff_structures/DXFN12List.h> #include "DXFN12List.h"
namespace XLS namespace XLS
{ {
...@@ -51,7 +51,6 @@ public: ...@@ -51,7 +51,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
_UINT32 cbdxfHeader; _UINT32 cbdxfHeader;
_UINT32 istnHeader; _UINT32 istnHeader;
_UINT32 cbdxfData; _UINT32 cbdxfData;
......
...@@ -57,11 +57,11 @@ void List12TableStyleClientInfo::load(CFRecord& record) ...@@ -57,11 +57,11 @@ void List12TableStyleClientInfo::load(CFRecord& record)
unsigned short flags; unsigned short flags;
record >> flags; record >> flags;
fFirstColumn = static_cast<unsigned char>(GETBITS(flags, 0, 1)); nFirstColumn = GETBITS(flags, 0, 1);
fLastColumn = static_cast<unsigned char>(GETBITS(flags, 1, 2)); nLastColumn = GETBITS(flags, 1, 2);
fRowStripes = static_cast<unsigned char>(GETBITS(flags, 3, 4)); nRowStripes = GETBITS(flags, 3, 4);
fColumnStripes = static_cast<unsigned char>(GETBITS(flags, 5, 6)); nColumnStripes = GETBITS(flags, 5, 6);
fDefaultStyle = static_cast<unsigned char>(GETBITS(flags, 9, 10)); nDefaultStyle = GETBITS(flags, 9, 10);
record >> stListStyleName; record >> stListStyleName;
} }
......
...@@ -47,16 +47,16 @@ public: ...@@ -47,16 +47,16 @@ public:
List12TableStyleClientInfo(); List12TableStyleClientInfo();
~List12TableStyleClientInfo(); ~List12TableStyleClientInfo();
static const ElementType type = typeList12TableStyleClientInfo; static const ElementType type = typeList12TableStyleClientInfo;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned char nFirstColumn;
unsigned char nLastColumn;
unsigned char nRowStripes;
unsigned char nColumnStripes;
unsigned char nDefaultStyle;
unsigned char fFirstColumn;
unsigned char fLastColumn;
unsigned char fRowStripes;
unsigned char fColumnStripes;
unsigned char fDefaultStyle;
XLUnicodeString stListStyleName; XLUnicodeString stListStyleName;
}; };
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "TableFeatureType.h" #include "TableFeatureType.h"
#include <Binary/CFRecord.h> #include <Binary/CFRecord.h>
#include "../Biff_structures/Feat11FieldDataItem.h"
namespace XLS namespace XLS
{ {
...@@ -53,7 +54,13 @@ TableFeatureType::~TableFeatureType() ...@@ -53,7 +54,13 @@ TableFeatureType::~TableFeatureType()
void TableFeatureType::load(CFRecord& record) void TableFeatureType::load(CFRecord& record)
{ {
record >> lt; // SourceType record >> lt;
//LTRANGE 0x00000000 Range
//LTSHAREPOINT 0x00000001 Read/write Web-based data provider list
//LTXML 0x00000002 XML Mapper data
//LTEXTERNALDATA 0x00000003 External data source (query table)<180>
record >> idList; // Unique ID record >> idList; // Unique ID
record >> crwHeader; // 0 - Table has no header row, 1 - Table has a header row record >> crwHeader; // 0 - Table has no header row, 1 - Table has a header row
record >> crwTotals; // 0 - Table has no total row, 1 - Table has a total row record >> crwTotals; // 0 - Table has no total row, 1 - Table has a total row
...@@ -61,39 +68,31 @@ void TableFeatureType::load(CFRecord& record) ...@@ -61,39 +68,31 @@ void TableFeatureType::load(CFRecord& record)
record >> cbFSData; // 64 record >> cbFSData; // 64
record >> rupBuild; // Build number of the application record >> rupBuild; // Build number of the application
_UINT32 _lt = lt;
_UINT32 _idList = idList;
_UINT32 _crwHeader = crwHeader;
_UINT32 _crwTotals = crwTotals;
_UINT32 _idFieldNext = idFieldNext;
_UINT32 _cbFSData = cbFSData;
_UINT32 _rupBuild = rupBuild;
record.skipNunBytes(2); // unused1 record.skipNunBytes(2); // unused1
_UINT16 flags; _UINT16 flags;
record >> flags; record >> flags;
fAutoFilter = static_cast<unsigned char>(GETBIT(flags, 1)); fAutoFilter = GETBIT(flags, 1);
fPersistAutoFilter = static_cast<unsigned char>(GETBIT(flags, 2)); fPersistAutoFilter = GETBIT(flags, 2);
fShowInsertRow = static_cast<unsigned char>(GETBIT(flags, 3)); fShowInsertRow = GETBIT(flags, 3);
fInsertRowInsCells = static_cast<unsigned char>(GETBIT(flags, 4)); fInsertRowInsCells = GETBIT(flags, 4);
fLoadPldwIdDeleted = static_cast<unsigned char>(GETBIT(flags, 5)); fLoadPldwIdDeleted = GETBIT(flags, 5);
fShownTotalRow = static_cast<unsigned char>(GETBIT(flags, 6)); fShownTotalRow = GETBIT(flags, 6);
fNeedsCommit = static_cast<unsigned char>(GETBIT(flags, 8)); fNeedsCommit = GETBIT(flags, 8);
fSingleCell = static_cast<unsigned char>(GETBIT(flags, 9)); fSingleCell = GETBIT(flags, 9);
fApplyAutoFilter = static_cast<unsigned char>(GETBIT(flags, 11)); fApplyAutoFilter = GETBIT(flags, 11);
fForceInsertToBeVis = static_cast<unsigned char>(GETBIT(flags, 12)); fForceInsertToBeVis = GETBIT(flags, 12);
fCompressedXml = static_cast<unsigned char>(GETBIT(flags, 13)); fCompressedXml = GETBIT(flags, 13);
fLoadCSPName = static_cast<unsigned char>(GETBIT(flags, 14)); fLoadCSPName = GETBIT(flags, 14);
fLoadPldwIdChanged = static_cast<unsigned char>(GETBIT(flags, 15)); fLoadPldwIdChanged = GETBIT(flags, 15);
record >> flags; record >> flags;
verXL = static_cast<unsigned char>(GETBITS(flags, 0, 4)); verXL = GETBITS(flags, 0, 4);
fLoadEntryId = static_cast<unsigned char>(GETBIT(flags, 4)); fLoadEntryId = GETBIT(flags, 4);
fLoadPllstclInvalid = static_cast<unsigned char>(GETBIT(flags, 5)); fLoadPllstclInvalid = GETBIT(flags, 5);
fGoodRupBld = static_cast<unsigned char>(GETBIT(flags, 6)); fGoodRupBld = GETBIT(flags, 6);
fPublished = static_cast<unsigned char>(GETBIT(flags, 8)); fPublished = GETBIT(flags, 8);
if (lt != 1) if (lt != 1)
{ {
...@@ -106,24 +105,39 @@ void TableFeatureType::load(CFRecord& record) ...@@ -106,24 +105,39 @@ void TableFeatureType::load(CFRecord& record)
record.skipNunBytes(16); // rgbHashParam record.skipNunBytes(16); // rgbHashParam
record >> rgbName; record >> rgbName;
record >> cFieldData; record >> cFieldData; //from 1 to 100
int r = cFieldData;
if (fLoadCSPName) if (fLoadCSPName)
record >> cSPName; record >> cSPName;
if (fLoadEntryId == BIFF_BYTE(1)) if (fLoadEntryId)
record >> entryId; record >> entryId;
for (size_t i = 0; i < cFieldData; i++) for (_UINT16 i = 0; i < cFieldData; i++)
{ {
if (record.getRdPtr() >= record.getDataSize()) if (record.getRdPtr() >= record.getDataSize())
return; return;
Feat11FieldDataItemPtr item(new Feat11FieldDataItem); BiffStructurePtr item(new Feat11FieldDataItem);
item->load(record); item->load(record);
fieldData.push_back(item);
arFieldData.push_back(item);
}
if (fLoadPldwIdDeleted)
{
idDeleted = BiffStructurePtr (new Feat11RgSharepointIdDel);
idDeleted->load(record);
}
if (fLoadPldwIdChanged)
{
idChanged = BiffStructurePtr (new Feat11RgSharepointIdChange);
idChanged->load(record);
}
if (fLoadPllstclInvalid)
{
cellInvalid = BiffStructurePtr(new Feat11RgInvalidCells);
cellInvalid->load(record);
} }
} }
......
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
*/ */
#pragma once #pragma once
#include <Logic/Biff_records/BiffRecord.h> #include "../Biff_records/BiffRecord.h"
#include <Logic/Biff_structures/BiffString.h> #include "../Biff_structures/BiffString.h"
#include <Logic/Biff_structures/Feat11FieldDataItem.h>
namespace XLS namespace XLS
{ {
...@@ -48,11 +46,10 @@ public: ...@@ -48,11 +46,10 @@ public:
TableFeatureType(); TableFeatureType();
~TableFeatureType(); ~TableFeatureType();
static const ElementType type = typeTableFeatureType; static const ElementType type = typeTableFeatureType;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
_UINT32 lt; // SourceType _UINT32 lt; // SourceType
_UINT32 idList; _UINT32 idList;
_UINT32 crwHeader; _UINT32 crwHeader;
...@@ -61,36 +58,40 @@ public: ...@@ -61,36 +58,40 @@ public:
_UINT32 cbFSData; _UINT32 cbFSData;
_UINT16 rupBuild; _UINT16 rupBuild;
unsigned char fAutoFilter; bool fAutoFilter;
unsigned char fPersistAutoFilter; bool fPersistAutoFilter;
unsigned char fShowInsertRow; bool fShowInsertRow;
unsigned char fInsertRowInsCells; bool fInsertRowInsCells;
unsigned char fLoadPldwIdDeleted; bool fLoadPldwIdDeleted;
unsigned char fShownTotalRow; bool fShownTotalRow;
unsigned char fNeedsCommit; bool fNeedsCommit;
unsigned char fSingleCell; bool fSingleCell;
unsigned char fApplyAutoFilter; bool fApplyAutoFilter;
unsigned char fForceInsertToBeVis; bool fForceInsertToBeVis;
unsigned char fCompressedXml; bool fCompressedXml;
unsigned char fLoadCSPName; bool fLoadCSPName;
unsigned char fLoadPldwIdChanged; bool fLoadPldwIdChanged;
unsigned char verXL; bool fLoadEntryId;
unsigned char fLoadEntryId; bool fLoadPllstclInvalid;
unsigned char fLoadPllstclInvalid; bool fGoodRupBld;
unsigned char fGoodRupBld; bool fPublished;
unsigned char fPublished;
_UINT32 lPosStmCache; unsigned char verXL;
_UINT32 cbStmCache; _UINT32 lPosStmCache;
_UINT32 cchStmCache; _UINT32 cbStmCache;
_UINT32 lem; // LEMMode _UINT32 cchStmCache;
_UINT32 lem; // LEMMode
XLUnicodeString rgbName; XLUnicodeString rgbName;
_UINT16 cFieldData; _UINT16 cFieldData;
XLUnicodeString cSPName; XLUnicodeString cSPName;
XLUnicodeString entryId; XLUnicodeString entryId;
BiffStructurePtrVector fieldData; BiffStructurePtrVector arFieldData;
BiffStructurePtr idDeleted;
BiffStructurePtr idChanged;
BiffStructurePtr cellInvalid;
}; };
typedef boost::shared_ptr<TableFeatureType> TableFeatureTypePtr; typedef boost::shared_ptr<TableFeatureType> TableFeatureTypePtr;
......
...@@ -47,12 +47,10 @@ public: ...@@ -47,12 +47,10 @@ public:
XFExtNoFRT(CFRecord& record); XFExtNoFRT(CFRecord& record);
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeXFExtNoFRT; static const ElementType type = typeXFExtNoFRT;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
private:
std::vector<ExtProp> rgExt; std::vector<ExtProp> rgExt;
}; };
......
...@@ -220,9 +220,9 @@ int AUTOFILTER::serialize(std::wostream & stream) ...@@ -220,9 +220,9 @@ int AUTOFILTER::serialize(std::wostream & stream)
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 (size_t k = 0 ; k < af12->rgbAF12Criteries.size(); k++) for (size_t k = 0 ; k < af12->arAF12Criteries.size(); k++)
{ {
AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(af12->rgbAF12Criteries[k].get()); AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(af12->arAF12Criteries[k].get());
if (af12Criteria == NULL) continue; if (af12Criteria == NULL) continue;
CP_XML_NODE(L"filter") CP_XML_NODE(L"filter")
......
...@@ -42,6 +42,9 @@ ...@@ -42,6 +42,9 @@
#include "../Biff_structures/DConnConnectionWeb.h" #include "../Biff_structures/DConnConnectionWeb.h"
#include "../Biff_structures/DConnConnectionOleDb.h" #include "../Biff_structures/DConnConnectionOleDb.h"
#include "../Biff_structures/ConnGrbitDbtWeb.h"
#include "../Biff_structures/ConnGrbitDbtOledb.h"
#include "../Biff_structures/ConnGrbitDbtAdo.h"
namespace XLS namespace XLS
{ {
...@@ -231,6 +234,10 @@ int DBQUERY::serialize_connection(std::wstring & name) ...@@ -231,6 +234,10 @@ int DBQUERY::serialize_connection(std::wstring & name)
DConnConnectionOleDb *oleDb = dcon ? dynamic_cast<DConnConnectionOleDb*>(dcon->connection.get()) : NULL; DConnConnectionOleDb *oleDb = dcon ? dynamic_cast<DConnConnectionOleDb*>(dcon->connection.get()) : NULL;
XLUnicodeStringSegmented*adoDb = dcon ? dynamic_cast<XLUnicodeStringSegmented*>(dcon->connection.get()) : NULL; XLUnicodeStringSegmented*adoDb = dcon ? dynamic_cast<XLUnicodeStringSegmented*>(dcon->connection.get()) : NULL;
ConnGrbitDbtWeb *webGrDb = dcon ? dynamic_cast<ConnGrbitDbtWeb*>(dcon->grbitDbt.get()) : NULL;
ConnGrbitDbtOledb *oleGrDb = dcon ? dynamic_cast<ConnGrbitDbtOledb*>(dcon->grbitDbt.get()) : NULL;
ConnGrbitDbtAdo *adoGrDb = dcon ? dynamic_cast<ConnGrbitDbtAdo*>(dcon->grbitDbt.get()) : NULL;
CP_XML_WRITER(global_info->connections_stream) CP_XML_WRITER(global_info->connections_stream)
{ {
CP_XML_NODE(L"connection") CP_XML_NODE(L"connection")
...@@ -330,15 +337,28 @@ int DBQUERY::serialize_connection(std::wstring & name) ...@@ -330,15 +337,28 @@ int DBQUERY::serialize_connection(std::wstring & name)
CP_XML_ATTR(L"connection", connection); CP_XML_ATTR(L"connection", connection);
CP_XML_ATTR(L"command", command); CP_XML_ATTR(L"command", command);
if (commandType > 0)
CP_XML_ATTR(L"commandType", commandType); if (oleGrDb && commandType > 0)
{
//1. Query specifies a cube name
//2. Query specifies a SQL statement
//3. Query specifies a table name
//4. Query specifies that default information has been given, and it is up to the provider
//5. Query is against a web based List Data Provider.
CP_XML_ATTR(L"commandType", oleGrDb->dbost);
}
} }
if (oleDb) if (oleDb)
{ {
CP_XML_NODE(L"olapPr") CP_XML_NODE(L"olapPr")
{ {
CP_XML_ATTR(L"sendLocale", 1); if (oleGrDb)
CP_XML_ATTR(L"rowDrillCount", oleDb->nDrillthroughRows); {
if (oleGrDb->fLocalConn)
CP_XML_ATTR(L"local", oleGrDb->fLocalConn);
}
if (oleDb->nDrillthroughRows > 0)
CP_XML_ATTR(L"rowDrillCount", oleDb->nDrillthroughRows);
} }
} }
} }
......
...@@ -48,6 +48,14 @@ public: ...@@ -48,6 +48,14 @@ public:
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeFEAT; static const ElementType type = typeFEAT;
struct _data
{
BaseObjectPtr m_Feat;
std::vector<BaseObjectPtr> m_arContinueFrt;
};
BaseObjectPtr m_FeatHdr;
std::vector<_data> m_arFEAT;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
*/ */
#include "FEAT11.h" #include "FEAT11.h"
#include <Logic/Biff_records/FeatHdr11.h> #include "../Biff_records/FeatHdr11.h"
#include <Logic/Biff_records/Feature11.h> #include "../Biff_records/Feature11.h"
#include <Logic/Biff_records/Feature12.h> #include "../Biff_records/Feature12.h"
#include <Logic/Biff_records/ContinueFrt11.h> #include "../Biff_records/ContinueFrt11.h"
#include <Logic/Biff_records/List12.h> #include "../Biff_records/List12.h"
#include <Logic/Biff_records/AutoFilter12.h> #include "../Biff_records/AutoFilter12.h"
#include <Logic/Biff_records/ContinueFrt12.h> #include "../Biff_records/ContinueFrt12.h"
#include <Logic/Biff_records/List12.h> #include "../Biff_records/List12.h"
#include <Logic/Biff_unions/SORTDATA12.h> #include "../Biff_unions/SORTDATA12.h"
namespace XLS namespace XLS
{ {
...@@ -112,34 +112,47 @@ const bool FEAT11::loadContent(BinProcessor& proc) ...@@ -112,34 +112,47 @@ const bool FEAT11::loadContent(BinProcessor& proc)
while(!elements_.empty()) while(!elements_.empty())
{ {
if (elements_.front()->get_type() == typeFeature11 || switch(elements_.front()->get_type())
elements_.front()->get_type() == typeFeature12 )
{ {
_data new_data; case typeFeature11:
new_data.m_Feature = elements_.front(); case typeFeature12:
{
m_arFEAT.push_back(new_data); _data new_data;
} new_data.m_Feature = elements_.front();
if (elements_.front()->get_type() == typeList12) m_arFEAT.push_back(new_data);
{ }break;
if (m_arFEAT.back().m_AutoFilter12) case typeList12:
m_arFEAT.back().m_arList12_second.push_back(elements_.front()); {
else if (m_arFEAT.back().m_AutoFilter12)
m_arFEAT.back().m_arList12.push_back(elements_.front()); m_arFEAT.back().m_arList12_second.push_back(elements_.front());
} else
if (elements_.front()->get_type() == typeAutoFilter12) m_arFEAT.back().m_arList12.push_back(elements_.front());
{ }break;
m_arFEAT.back().m_AutoFilter12 = elements_.front(); case typeAutoFilter12:
} {
if (elements_.front()->get_type() == typeSORTDATA12) m_arFEAT.back().m_AutoFilter12 = elements_.front();
{ }break;
m_arFEAT.back().m_SORTDATA12 = elements_.front(); case typeSORTDATA12:
{
m_arFEAT.back().m_SORTDATA12 = elements_.front();
}break;
} }
elements_.pop_front(); elements_.pop_front();
} }
return true; return true;
} }
int FEAT11::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"table")
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
}
}
return 0;
}
} // namespace XLS } // namespace XLS
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of FEAT11 union of records
class FEAT11: public CompositeObject class FEAT11: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(FEAT11) BASE_OBJECT_DEFINE_CLASS_NAME(FEAT11)
...@@ -49,6 +47,7 @@ public: ...@@ -49,6 +47,7 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & stream);
static const ElementType type = typeFEAT11; static const ElementType type = typeFEAT11;
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
*/ */
#include "FEAT.h" #include "FEAT.h"
#include <Logic/Biff_records/FeatHdr.h> #include "../Biff_records/FeatHdr.h"
#include <Logic/Biff_records/Feat.h> #include "../Biff_records/Feat.h"
#include <Logic/Biff_records/ContinueFrt.h> #include "../Biff_records/ContinueFrt.h"
namespace XLS namespace XLS
{ {
...@@ -64,7 +64,9 @@ public: ...@@ -64,7 +64,9 @@ public:
{ {
return false; return false;
} }
proc.repeated<ContinueFrt>(0, 0);
int count = proc.repeated<ContinueFrt>(0, 0);
return true; return true;
}; };
}; };
...@@ -85,8 +87,27 @@ const bool FEAT::loadContent(BinProcessor& proc) ...@@ -85,8 +87,27 @@ const bool FEAT::loadContent(BinProcessor& proc)
{ {
return false; return false;
} }
proc.repeated<Parenthesis_FEAT_1>(0, 0); m_FeatHdr = elements_.back();
elements_.pop_back();
int count = proc.repeated<Parenthesis_FEAT_1>(0, 0);
while(!elements_.empty())
{
if (elements_.front()->get_type() == typeFeat)
{
_data new_data;
new_data.m_Feat = elements_.front();
m_arFEAT.push_back(new_data);
}
else
{
m_arFEAT.back().m_arContinueFrt.push_back(elements_.front());
}
elements_.pop_front();
}
return true; return true;
} }
......
...@@ -77,7 +77,7 @@ const bool LBL::loadContent(BinProcessor& proc) ...@@ -77,7 +77,7 @@ const bool LBL::loadContent(BinProcessor& proc)
std::wstring name; std::wstring name;
if (lbl->fBuiltin) name = lbl->Name.value().get_value_or(L""); if (lbl->fBuiltin) name = lbl->Name;
if (name.empty()) name = lbl->Name_bin.value(); if (name.empty()) name = lbl->Name_bin.value();
NameCmt namecmt(name); NameCmt namecmt(name);
...@@ -139,7 +139,7 @@ int LBL::serialize(std::wostream & stream) ...@@ -139,7 +139,7 @@ int LBL::serialize(std::wostream & stream)
CP_XML_NODE(L"definedName") CP_XML_NODE(L"definedName")
{ {
std::wstring name; std::wstring name;
if (lbl->fBuiltin) name = lbl->Name.value().get_value_or(L""); if (lbl->fBuiltin) name = lbl->Name;
if (name.empty()) name = lbl->Name_bin.value(); if (name.empty()) name = lbl->Name_bin.value();
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of TABLESTYLES union of records
class TABLESTYLES: public CompositeObject class TABLESTYLES: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(TABLESTYLES) BASE_OBJECT_DEFINE_CLASS_NAME(TABLESTYLES)
...@@ -49,7 +47,7 @@ public: ...@@ -49,7 +47,7 @@ public:
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeTABLESTYLES; static const ElementType type = typeTABLESTYLES;
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
......
...@@ -31,9 +31,10 @@ ...@@ -31,9 +31,10 @@
*/ */
#include "TABLESTYLES.h" #include "TABLESTYLES.h"
#include <Logic/Biff_records/TableStyles.h>
#include <Logic/Biff_records/TableStyle.h> #include "../Biff_records/TableStyles.h"
#include <Logic/Biff_records/TableStyleElement.h> #include "../Biff_records/TableStyle.h"
#include "../Biff_records/TableStyleElement.h"
namespace XLS namespace XLS
{ {
...@@ -103,7 +104,7 @@ const bool TABLESTYLES::loadContent(BinProcessor& proc) ...@@ -103,7 +104,7 @@ const bool TABLESTYLES::loadContent(BinProcessor& proc)
if (m_arTableStyles.size() > 0) if (m_arTableStyles.size() > 0)
m_arTableStyles.back().elements_.push_back(elements_.front()); m_arTableStyles.back().elements_.push_back(elements_.front());
} }
elements_.pop_back(); elements_.pop_front();
} }
return true; return true;
} }
...@@ -127,6 +128,62 @@ int TABLESTYLES::serialize(std::wostream & stream) ...@@ -127,6 +128,62 @@ int TABLESTYLES::serialize(std::wostream & stream)
CP_XML_ATTR(L"defaultTableStyle", styles->rgchDefTableStyle.value()); CP_XML_ATTR(L"defaultTableStyle", styles->rgchDefTableStyle.value());
} }
for (size_t i = 0; i < m_arTableStyles.size(); i++)
{
TableStyle* style = dynamic_cast<TableStyle*>(m_arTableStyles[i].style_.get());
if (!style) continue;
CP_XML_NODE(L"tableStyle")
{
CP_XML_ATTR(L"count", m_arTableStyles[i].elements_.size());
CP_XML_ATTR(L"name", style->rgchName.value());
CP_XML_ATTR(L"pivot", style->fIsPivot);
for (size_t j = 0; j < m_arTableStyles[i].elements_.size(); j++)
{
TableStyleElement* elem = dynamic_cast<TableStyleElement*>(m_arTableStyles[i].elements_[j].get());
if (!elem) continue;
CP_XML_NODE(L"tableStyleElement")
{
CP_XML_ATTR(L"dxfId", elem->index);
switch(elem->tseType)
{
case 0x00000000: CP_XML_ATTR(L"type", L"wholeTable"); break;
case 0x00000001: CP_XML_ATTR(L"type", L"headerRow"); break;
case 0x00000002: CP_XML_ATTR(L"type", L"totalRow"); break;
case 0x00000003: CP_XML_ATTR(L"type", L"firstColumn"); break;
case 0x00000004: CP_XML_ATTR(L"type", L"lastColumn"); break;
case 0x00000005: CP_XML_ATTR(L"type", L"firstRowStripe"); break;
case 0x00000006: CP_XML_ATTR(L"type", L"secondRowStripe"); break;
case 0x00000007: CP_XML_ATTR(L"type", L"firstColumnStripe"); break;
case 0x00000008: CP_XML_ATTR(L"type", L"secondColumnStripe"); break;
case 0x00000009: CP_XML_ATTR(L"type", L"firstHeaderCell"); break;
case 0x0000000a: CP_XML_ATTR(L"type", L"lastHeaderCell"); break;
case 0x0000000b: CP_XML_ATTR(L"type", L"firstTotalCell"); break;
case 0x0000000c: CP_XML_ATTR(L"type", L"lastTotalCell"); break;
case 0x0000000d: CP_XML_ATTR(L"type", L"firstSubtotalColumn"); break;//??
case 0x0000000e: CP_XML_ATTR(L"type", L"firstSubtotalColumn"); break;//even
case 0x0000000f: CP_XML_ATTR(L"type", L"lastSubtotalColumn"); break;//odd
case 0x00000010: CP_XML_ATTR(L"type", L"firstSubtotalRow"); break;//??
case 0x00000011: CP_XML_ATTR(L"type", L"firstSubtotalRow"); break;//even
case 0x00000012: CP_XML_ATTR(L"type", L"lastSubtotalRow"); break;//odd
case 0x00000013: CP_XML_ATTR(L"type", L"blankRow"); break;
case 0x00000014: CP_XML_ATTR(L"type", L"firstColumnSubheading");break;
case 0x00000015: CP_XML_ATTR(L"type", L"firstColumnSubheading");break;
case 0x00000016: CP_XML_ATTR(L"type", L"lastColumnSubheading"); break;
case 0x00000017: CP_XML_ATTR(L"type", L"firstRowSubheading"); break;
case 0x00000018: CP_XML_ATTR(L"type", L"firstRowSubheading"); break;
case 0x00000019: CP_XML_ATTR(L"type", L"lastRowSubheading"); break;
case 0x0000001a: CP_XML_ATTR(L"type", L"pageFieldLabels"); break;
case 0x0000001b: CP_XML_ATTR(L"type", L"pageFieldValues"); break;
}
}
}
}
}
} }
} }
return 0; return 0;
......
...@@ -129,9 +129,9 @@ int WINDOW::serialize(std::wostream & stream) ...@@ -129,9 +129,9 @@ int WINDOW::serialize(std::wostream & stream)
{ {
CP_XML_ATTR(L"view", L"pageLayout"); CP_XML_ATTR(L"view", L"pageLayout");
} }
if ((window2->topLeftCell.value()) && (*window2->topLeftCell.value() != L"A1")) if (window2->topLeftCell != L"A1")
{ {
CP_XML_ATTR(L"topLeftCell", *window2->topLeftCell.value()); CP_XML_ATTR(L"topLeftCell", window2->topLeftCell);
} }
if ( window2->icvHdr != (_UINT16)64) if ( window2->icvHdr != (_UINT16)64)
{ {
...@@ -159,8 +159,8 @@ int WINDOW::serialize(std::wostream & stream) ...@@ -159,8 +159,8 @@ int WINDOW::serialize(std::wostream & stream)
if (pane->x != (_INT32)0) CP_XML_ATTR(L"xSplit", pane->x); if (pane->x != (_INT32)0) CP_XML_ATTR(L"xSplit", pane->x);
if (pane->y != (_INT32)0) CP_XML_ATTR(L"ySplit", pane->y); if (pane->y != (_INT32)0) CP_XML_ATTR(L"ySplit", pane->y);
if ((pane->topLeftCell.value()) && (*pane->topLeftCell.value() != L"A1")) if (pane->topLeftCell != L"A1")
CP_XML_ATTR(L"topLeftCell", *pane->topLeftCell.value()); CP_XML_ATTR(L"topLeftCell", pane->topLeftCell);
switch(pane->pnnAcct) switch(pane->pnnAcct)
{ {
case PaneType::REVTPNNBOTRIGHT: CP_XML_ATTR(L"activePane", L"bottomRight"); break; case PaneType::REVTPNNBOTRIGHT: CP_XML_ATTR(L"activePane", L"bottomRight"); break;
......
...@@ -87,6 +87,8 @@ int CommonSubstream::serialize_format(std::wostream & strm) ...@@ -87,6 +87,8 @@ int CommonSubstream::serialize_format(std::wostream & strm)
SheetExt *sheet_ext = dynamic_cast<SheetExt*>(m_SheetExt.get()); SheetExt *sheet_ext = dynamic_cast<SheetExt*>(m_SheetExt.get());
CodeName *code_name = dynamic_cast<CodeName*>(m_CodeName.get()); CodeName *code_name = dynamic_cast<CodeName*>(m_CodeName.get());
if (!code_name || !sheet_ext) return 0;
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"sheetPr") CP_XML_NODE(L"sheetPr")
......
...@@ -692,7 +692,7 @@ void GlobalsSubstream::UpdateDefineNames() ...@@ -692,7 +692,7 @@ void GlobalsSubstream::UpdateDefineNames()
std::wstring name; std::wstring name;
std::wstring comment; std::wstring comment;
if (lbl->fBuiltin) name = lbl->Name.value().get_value_or(L""); if (lbl->fBuiltin) name = lbl->Name;
if (name.empty()) name = lbl->Name_bin.value(); if (name.empty()) name = lbl->Name_bin.value();
NameCmt *namecmt = dynamic_cast<NameCmt*>(LBL_->m_NameCmt.get()); NameCmt *namecmt = dynamic_cast<NameCmt*>(LBL_->m_NameCmt.get());
......
...@@ -593,6 +593,9 @@ enum ElementType ...@@ -593,6 +593,9 @@ enum ElementType
typeFactoidData, typeFactoidData,
typeFeat11FdaAutoFilter, typeFeat11FdaAutoFilter,
typeFeat11FieldDataItem, typeFeat11FieldDataItem,
typeFeat11RgSharepointIdDel,
typeFeat11RgSharepointIdChange,
typeFeat11RgInvalidCells,
typeFeatFormulaErr2, typeFeatFormulaErr2,
typeFeatProtection, typeFeatProtection,
typeFeatSmartTag, typeFeatSmartTag,
......
...@@ -63,6 +63,8 @@ ...@@ -63,6 +63,8 @@
#include "../XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.h" #include "../XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.h"
#include "../XlsFormat/Logic/Biff_unions/SUPBOOK.h" #include "../XlsFormat/Logic/Biff_unions/SUPBOOK.h"
#include "../XlsFormat/Logic/Biff_unions/QUERYTABLE.h" #include "../XlsFormat/Logic/Biff_unions/QUERYTABLE.h"
#include "../XlsFormat/Logic/Biff_unions/FEAT.h"
#include "../XlsFormat/Logic/Biff_unions/FEAT11.h"
#include "../XlsFormat/Logic/Biff_records/BkHim.h" #include "../XlsFormat/Logic/Biff_records/BkHim.h"
#include "../XlsFormat/Logic/Biff_records/HLink.h" #include "../XlsFormat/Logic/Biff_records/HLink.h"
...@@ -73,6 +75,9 @@ ...@@ -73,6 +75,9 @@
#include "../XlsFormat/Logic/Biff_records/IMDATA.h" #include "../XlsFormat/Logic/Biff_records/IMDATA.h"
#include "../XlsFormat/Logic/Biff_records/Note.h" #include "../XlsFormat/Logic/Biff_records/Note.h"
#include "../XlsFormat/Logic/Biff_records/WsBool.h" #include "../XlsFormat/Logic/Biff_records/WsBool.h"
#include "../XlsFormat/Logic/Biff_records/FeatHdr11.h"
#include "../XlsFormat/Logic/Biff_records/Feature11.h"
#include "../XlsFormat/Logic/Biff_records/Feature12.h"
#include "../XlsFormat/Logic/Biff_structures/URLMoniker.h" #include "../XlsFormat/Logic/Biff_structures/URLMoniker.h"
#include "../XlsFormat/Logic/Biff_structures/FileMoniker.h" #include "../XlsFormat/Logic/Biff_structures/FileMoniker.h"
...@@ -448,21 +453,21 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook) ...@@ -448,21 +453,21 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
for (size_t i = 0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++) for (size_t i = 0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
{ {
xlsx_context->start_table(); xlsx_context->start_sheet();
convert(dynamic_cast<XLS::WorksheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get())); convert(dynamic_cast<XLS::WorksheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
xlsx_context->end_table(); xlsx_context->end_sheet();
} }
for (size_t i = 0 ; i < woorkbook->m_arChartSheetSubstream.size(); i++) for (size_t i = 0 ; i < woorkbook->m_arChartSheetSubstream.size(); i++)
{ {
xlsx_context->start_table(); xlsx_context->start_sheet();
convert_chart_sheet(dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arChartSheetSubstream[i].get())); convert_chart_sheet(dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arChartSheetSubstream[i].get()));
xlsx_context->end_table(); xlsx_context->end_sheet();
} }
for (size_t i = 0 ; i < woorkbook->m_arMacroSheetSubstream.size(); i++) for (size_t i = 0 ; i < woorkbook->m_arMacroSheetSubstream.size(); i++)
{ {
xlsx_context->start_table(); xlsx_context->start_sheet();
convert(dynamic_cast<XLS::MacroSheetSubstream*>(woorkbook->m_arMacroSheetSubstream[i].get())); convert(dynamic_cast<XLS::MacroSheetSubstream*>(woorkbook->m_arMacroSheetSubstream[i].get()));
xlsx_context->end_table(); xlsx_context->end_sheet();
} }
for (std::list<XLS::BaseObjectPtr>::iterator it = woorkbook->elements_.begin(); it != woorkbook->elements_.end(); it++) for (std::list<XLS::BaseObjectPtr>::iterator it = woorkbook->elements_.begin(); it != woorkbook->elements_.end(); it++)
...@@ -535,6 +540,16 @@ void XlsConverter::convert_common (XLS::CommonSubstream* sheet) ...@@ -535,6 +540,16 @@ void XlsConverter::convert_common (XLS::CommonSubstream* sheet)
{ {
convert((ODRAW::OfficeArtDgContainer*)sheet->m_arHFPictureDrawing[i].get()); convert((ODRAW::OfficeArtDgContainer*)sheet->m_arHFPictureDrawing[i].get());
} }
//for (size_t i = 0 ; i < sheet->m_arFEAT.size(); i++)
//{
// convert(dynamic_cast<XLS::FEAT*>(sheet->m_arFEAT.get()));
//}
for (size_t i = 0 ; i < sheet->m_arFEAT11.size(); i++)
{
convert(dynamic_cast<XLS::FEAT11*>(sheet->m_arFEAT11[i].get()));
}
} }
void XlsConverter::convert (XLS::WorksheetSubstream* sheet) void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
...@@ -545,10 +560,10 @@ void XlsConverter::convert (XLS::WorksheetSubstream* sheet) ...@@ -545,10 +560,10 @@ void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
if (name.empty()) if (name.empty())
name = L"Sheet_" + std::to_wstring(sheet->ws_index_ + 1); name = L"Sheet_" + std::to_wstring(sheet->ws_index_ + 1);
xlsx_context->set_table_type(1); xlsx_context->set_sheet_type(1);
xlsx_context->set_table_name(name) ; xlsx_context->set_sheet_name(name) ;
xlsx_context->set_table_id(sheet->ws_index_ + 1); xlsx_context->set_sheet_id(sheet->ws_index_ + 1);
xlsx_context->set_table_state(xls_global_info->sheets_info[sheet->ws_index_].state); xlsx_context->set_sheet_state(xls_global_info->sheets_info[sheet->ws_index_].state);
if (sheet->m_GLOBALS) if (sheet->m_GLOBALS)
{ {
...@@ -562,7 +577,7 @@ void XlsConverter::convert (XLS::WorksheetSubstream* sheet) ...@@ -562,7 +577,7 @@ void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
globals->m_DxGCol = sheet->m_DxGCol; globals->m_DxGCol = sheet->m_DxGCol;
if (globals->is_dialog) if (globals->is_dialog)
xlsx_context->set_table_type(2); xlsx_context->set_sheet_type(2);
} }
convert_common(dynamic_cast<XLS::CommonSubstream*>(sheet)); convert_common(dynamic_cast<XLS::CommonSubstream*>(sheet));
...@@ -630,10 +645,10 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet) ...@@ -630,10 +645,10 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet)
if (name.empty()) if (name.empty())
name = L"MacroSheet_" + std::to_wstring(sheet->ws_index_ + 1); name = L"MacroSheet_" + std::to_wstring(sheet->ws_index_ + 1);
xlsx_context->set_table_type(4); xlsx_context->set_sheet_type(4);
xlsx_context->set_table_name(name) ; xlsx_context->set_sheet_name(name) ;
xlsx_context->set_table_id(sheet->ws_index_ + 1); xlsx_context->set_sheet_id(sheet->ws_index_ + 1);
xlsx_context->set_table_state(xls_global_info->sheets_info[sheet->ws_index_].state); xlsx_context->set_sheet_state(xls_global_info->sheets_info[sheet->ws_index_].state);
if (sheet->m_GLOBALS) if (sheet->m_GLOBALS)
{ {
...@@ -647,7 +662,7 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet) ...@@ -647,7 +662,7 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet)
globals->m_DxGCol = sheet->m_DxGCol; globals->m_DxGCol = sheet->m_DxGCol;
if (globals->is_dialog) if (globals->is_dialog)
xlsx_context->set_table_type(2); xlsx_context->set_sheet_type(2);
} }
convert_common(dynamic_cast<XLS::CommonSubstream*>(sheet)); convert_common(dynamic_cast<XLS::CommonSubstream*>(sheet));
...@@ -728,10 +743,10 @@ void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream* chartsheet) ...@@ -728,10 +743,10 @@ void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream* chartsheet)
if (name.empty()) if (name.empty())
name = L"ChartSheet_" + std::to_wstring(chartsheet->ws_index_ + 1); name = L"ChartSheet_" + std::to_wstring(chartsheet->ws_index_ + 1);
xlsx_context->set_table_type(3); xlsx_context->set_sheet_type(3);
xlsx_context->set_table_name(name) ; xlsx_context->set_sheet_name(name) ;
xlsx_context->set_table_id(chartsheet->ws_index_ + 1); xlsx_context->set_sheet_id(chartsheet->ws_index_ + 1);
xlsx_context->set_table_state(xls_global_info->sheets_info[chartsheet->ws_index_].state); xlsx_context->set_sheet_state(xls_global_info->sheets_info[chartsheet->ws_index_].state);
convert_common(dynamic_cast<XLS::CommonSubstream*>(chartsheet)); convert_common(dynamic_cast<XLS::CommonSubstream*>(chartsheet));
...@@ -976,11 +991,41 @@ void XlsConverter::convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int star ...@@ -976,11 +991,41 @@ void XlsConverter::convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int star
WriteMediaFile(art_bstore->rgfb[i]->pict_data, art_bstore->rgfb[i]->pict_size, art_bstore->rgfb[i]->pict_type, bin_id); WriteMediaFile(art_bstore->rgfb[i]->pict_data, art_bstore->rgfb[i]->pict_size, art_bstore->rgfb[i]->pict_type, bin_id);
} }
} }
void XlsConverter::convert(XLS::FEAT11 * shared_feature)
{
if (!shared_feature) return;
xlsx_context->start_table();
std::wstringstream strm;
shared_feature->serialize(strm);
xlsx_context->get_tables_context().add_table(strm.str());
xlsx_context->end_table();
//XLS::FeatHdr11 * feature = dynamic_cast<XLS::FeatHdr11*>(shared_feature->m_FeatHdr11.get());
//for (size_t i = 0; i < shared_feature->m_arFEAT.size(); i++)
//{
// XLS::Feature11 * feature11 = dynamic_cast<XLS::Feature11*>(shared_feature->m_arFEAT[i].m_Feature.get());
// XLS::Feature12 * feature12 = dynamic_cast<XLS::Feature12*>(shared_feature->m_arFEAT[i].m_Feature.get());
//
// if (feature11)
// {
// }
// else if (feature12)
// {
// }
//}
}
void XlsConverter::convert(XLS::HLINK * HLINK_) void XlsConverter::convert(XLS::HLINK * HLINK_)
{ {
if (!HLINK_) return;
XLS::HLink * hLink = dynamic_cast<XLS::HLink*>(HLINK_->m_HLink.get()); XLS::HLink * hLink = dynamic_cast<XLS::HLink*>(HLINK_->m_HLink.get());
if (!hLink) return;
std::wstring target; std::wstring target;
bool bExternal = false; bool bExternal = false;
...@@ -999,7 +1044,7 @@ void XlsConverter::convert(XLS::HLINK * HLINK_) ...@@ -999,7 +1044,7 @@ void XlsConverter::convert(XLS::HLINK * HLINK_)
if (display.empty()) display = target; if (display.empty()) display = target;
xlsx_context->get_table_context().add_hyperlink( hLink->ref8.toString(), target, display, bExternal); xlsx_context->get_sheet_context().add_hyperlink( hLink->ref8.toString(), target, display, bExternal);
} }
void XlsConverter::convert(XLS::LBL * def_name) void XlsConverter::convert(XLS::LBL * def_name)
......
...@@ -79,6 +79,7 @@ namespace XLS ...@@ -79,6 +79,7 @@ namespace XLS
class PIVOTCACHEDEFINITION; class PIVOTCACHEDEFINITION;
class SUPBOOK; class SUPBOOK;
class QUERYTABLE; class QUERYTABLE;
class FEAT11;
class Note; class Note;
class TxO; class TxO;
...@@ -135,6 +136,7 @@ public: ...@@ -135,6 +136,7 @@ public:
void convert(XLS::PIVOTCACHEDEFINITION * pivot_cached); void convert(XLS::PIVOTCACHEDEFINITION * pivot_cached);
void convert(XLS::SUPBOOK * external); void convert(XLS::SUPBOOK * external);
void convert(XLS::QUERYTABLE * query_table); void convert(XLS::QUERYTABLE * query_table);
void convert(XLS::FEAT11 * shared_feature);
void convert(ODRAW::OfficeArtRecord * art); void convert(ODRAW::OfficeArtRecord * art);
void convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int start_id = 0); void convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int start_id = 0);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "external_items.h" #include "external_items.h"
#include <utils.h> #include <utils.h>
#include "simple_xml_writer.h" #include <simple_xml_writer.h>
#include "oox_rels.h" #include "oox_rels.h"
#include "mediaitems_utils.h" #include "mediaitems_utils.h"
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#include "simple_xml_writer.h" #include <simple_xml_writer.h>
#include "oox_content_type.h" #include "oox_content_type.h"
#include "namespaces.h" #include "namespaces.h"
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "namespaces.h" #include "namespaces.h"
#include "mediaitems_utils.h" #include "mediaitems_utils.h"
#include "simple_xml_writer.h"
#include <simple_xml_writer.h>
namespace oox { namespace oox {
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include <vector> #include <vector>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <simple_xml_writer.h> #include <simple_xml_writer.h>
......
...@@ -32,12 +32,9 @@ ...@@ -32,12 +32,9 @@
#include "xlsx_comments_context.h" #include "xlsx_comments_context.h"
#include <boost/foreach.hpp>
#include <iostream> #include <iostream>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
namespace oox { namespace oox {
class xlsx_comments; class xlsx_comments;
......
...@@ -33,20 +33,17 @@ ...@@ -33,20 +33,17 @@
#include "xlsx_conversion_context.h" #include "xlsx_conversion_context.h"
#include <iostream> #include <iostream>
#include <simple_xml_writer.h>
#include "simple_xml_writer.h"
#include "xlsx_package.h" #include "xlsx_package.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
namespace oox { namespace oox {
xlsx_conversion_context::xlsx_conversion_context( package::xlsx_document * outputDocument) : output_document_(outputDocument), xlsx_conversion_context::xlsx_conversion_context( package::xlsx_document * outputDocument) : output_document_(outputDocument),
next_vml_file_id_ ( 1 ), next_vml_file_id_ ( 1 ),
table_context_ ( *this ), sheet_context_ ( *this ),
xlsx_drawing_context_handle_ ( next_vml_file_id_, get_mediaitems()) xlsx_drawing_context_handle_ ( next_vml_file_id_, get_mediaitems())
{ {
} }
...@@ -56,7 +53,7 @@ xlsx_conversion_context::~xlsx_conversion_context() ...@@ -56,7 +53,7 @@ xlsx_conversion_context::~xlsx_conversion_context()
xlsx_comments_context & xlsx_conversion_context::get_comments_context() xlsx_comments_context & xlsx_conversion_context::get_comments_context()
{ {
return get_table_context().get_comments_context(); return get_sheet_context().get_comments_context();
} }
xlsx_comments_context_handle & xlsx_conversion_context::get_comments_context_handle() xlsx_comments_context_handle & xlsx_conversion_context::get_comments_context_handle()
...@@ -66,7 +63,7 @@ xlsx_comments_context_handle & xlsx_conversion_context::get_comments_context_han ...@@ -66,7 +63,7 @@ xlsx_comments_context_handle & xlsx_conversion_context::get_comments_context_han
xlsx_drawing_context & xlsx_conversion_context::get_drawing_context() xlsx_drawing_context & xlsx_conversion_context::get_drawing_context()
{ {
return get_table_context().get_drawing_context(); return get_sheet_context().get_drawing_context();
} }
void xlsx_conversion_context::start_document() void xlsx_conversion_context::start_document()
...@@ -118,38 +115,58 @@ oox_activeX_context & xlsx_conversion_context::current_activeX() ...@@ -118,38 +115,58 @@ oox_activeX_context & xlsx_conversion_context::current_activeX()
throw std::runtime_error("internal error"); throw std::runtime_error("internal error");
} }
} }
bool xlsx_conversion_context::start_table() bool xlsx_conversion_context::start_sheet()
{ {
sheets_.push_back(xlsx_xml_worksheet::create()); sheets_.push_back(xlsx_xml_worksheet::create());
get_table_context().start_table(); get_sheet_context().start_table();
return true; return true;
} }
void xlsx_conversion_context::set_table_type(int type) void xlsx_conversion_context::set_sheet_type(int type)
{ {
if (sheets_.empty()) return; if (sheets_.empty()) return;
sheets_.back()->type = type; sheets_.back()->type = type;
if (type == 3) if (type == 3)
{ {
get_table_context().set_chart_view(); get_sheet_context().set_chart_view();
} }
}
void xlsx_conversion_context::start_table()
{
}
void xlsx_conversion_context::end_table()
{
int index = tables_context_.get_count();
std::wstring rid = L"tpId" + std::to_wstring(index);
current_sheet().sheet_rels().add(oox::relationship(rid,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
L"../tables/table" + std::to_wstring(index) +L".xml"));
CP_XML_WRITER(current_sheet().tableParts())
{
CP_XML_NODE(L"tablePart")
{
CP_XML_ATTR(L"r:id", rid);
}
}
} }
void xlsx_conversion_context::set_table_name(const std::wstring & name) void xlsx_conversion_context::set_sheet_name(const std::wstring & name)
{ {
if (name.empty()) return; if (name.empty()) return;
sheets_.back()->name = name; sheets_.back()->name = name;
} }
void xlsx_conversion_context::set_table_state(const std::wstring & state) void xlsx_conversion_context::set_sheet_state(const std::wstring & state)
{ {
if (state.empty()) return; if (state.empty()) return;
sheets_.back()->state = state; sheets_.back()->state = state;
} }
void xlsx_conversion_context::set_table_id(int id) void xlsx_conversion_context::set_sheet_id(int id)
{ {
if (id < 0) return; if (id < 0) return;
sheets_.back()->id = id; sheets_.back()->id = id;
...@@ -186,17 +203,17 @@ void xlsx_conversion_context::end_external() ...@@ -186,17 +203,17 @@ void xlsx_conversion_context::end_external()
} }
void xlsx_conversion_context::end_table() void xlsx_conversion_context::end_sheet()
{ {
get_table_context().serialize_ole_objects (current_sheet().ole_objects()); get_sheet_context().serialize_ole_objects (current_sheet().ole_objects());
get_table_context().serialize_controls (current_sheet().activeXs()); get_sheet_context().serialize_controls (current_sheet().activeXs());
get_table_context().dump_rels_drawing(current_sheet().sheet_rels()); get_sheet_context().dump_rels_drawing(current_sheet().sheet_rels());
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks()); get_sheet_context().serialize_hyperlinks(current_sheet().hyperlinks());
get_table_context().dump_rels_hyperlinks(current_sheet().sheet_rels()); get_sheet_context().dump_rels_hyperlinks(current_sheet().sheet_rels());
get_table_context().end_table(); get_sheet_context().end_table();
} }
xlsx_drawing_context_handle & xlsx_conversion_context::get_drawing_context_handle() xlsx_drawing_context_handle & xlsx_conversion_context::get_drawing_context_handle()
...@@ -439,7 +456,19 @@ void xlsx_conversion_context::end_document() ...@@ -439,7 +456,19 @@ void xlsx_conversion_context::end_document()
} }
} }
int table_parts_count = tables_context_.get_count();
if (table_parts_count > 0)
{
for (int i = 0; i < table_parts_count; i++)
{
package::table_part_content_ptr content = package::table_part_content::create();
tables_context_.dump_rels(i, content->get_rels());
tables_context_.write_to(i, content->content());
output_document_->get_xl_files().add_table_part(content);
}
}
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) ); output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );
output_document_->content_type().set_media(get_mediaitems()); output_document_->content_type().set_media(get_mediaitems());
......
...@@ -37,13 +37,14 @@ ...@@ -37,13 +37,14 @@
#include "common.h" #include "common.h"
#include "xlsx_textcontext.h" #include "xlsx_textcontext.h"
#include "xlsx_tablecontext.h" #include "xlsx_sheet_context.h"
#include "xlsx_drawing_context.h" #include "xlsx_drawing_context.h"
#include "xlsx_chart_context.h" #include "xlsx_chart_context.h"
#include "xlsx_comments_context.h" #include "xlsx_comments_context.h"
#include "xlsx_pivots_context.h" #include "xlsx_pivots_context.h"
#include "xlsx_external_context.h" #include "xlsx_external_context.h"
#include "xlsx_activeX_context.h" #include "xlsx_activeX_context.h"
#include "xlsx_tablecontext.h"
#include "xlsx_output_xml.h" #include "xlsx_output_xml.h"
...@@ -66,16 +67,19 @@ public: ...@@ -66,16 +67,19 @@ public:
void start_document(); void start_document();
void end_document(); void end_document();
bool start_table(); bool start_sheet();
void set_table_state(const std::wstring & state); void set_sheet_state(const std::wstring & state);
void set_table_type(int type); void set_sheet_type(int type);
void set_table_name(const std::wstring & name); void set_sheet_name(const std::wstring & name);
void set_table_id(int id); void set_sheet_id(int id);
void end_table(); void end_sheet();
void start_chart(); void start_chart();
void end_chart(){} void end_chart(){}
void start_table();
void end_table();
std::wstring start_activeX(); std::wstring start_activeX();
void end_activeX(){} void end_activeX(){}
...@@ -89,7 +93,7 @@ public: ...@@ -89,7 +93,7 @@ public:
std::wostream & workbook_format() { return xlsx_workbook_pr_; } std::wostream & workbook_format() { return xlsx_workbook_pr_; }
xlsx_text_context & get_text_context() { return text_context_; } xlsx_text_context & get_text_context() { return text_context_; }
xlsx_table_context & get_table_context() { return table_context_; } xlsx_sheet_context & get_sheet_context() { return sheet_context_; }
xlsx_xml_worksheet & current_sheet(); xlsx_xml_worksheet & current_sheet();
oox_chart_context & current_chart(); oox_chart_context & current_chart();
...@@ -101,6 +105,7 @@ public: ...@@ -101,6 +105,7 @@ public:
xlsx_drawing_context_handle & get_drawing_context_handle(); xlsx_drawing_context_handle & get_drawing_context_handle();
xlsx_comments_context & get_comments_context(); xlsx_comments_context & get_comments_context();
xlsx_comments_context_handle & get_comments_context_handle(); xlsx_comments_context_handle & get_comments_context_handle();
xlsx_tables_context & get_tables_context() {return tables_context_;}
external_items & get_mediaitems() { return mediaitems_; } external_items & get_mediaitems() { return mediaitems_; }
...@@ -114,9 +119,10 @@ private: ...@@ -114,9 +119,10 @@ private:
package::xlsx_document *output_document_; package::xlsx_document *output_document_;
external_items mediaitems_; external_items mediaitems_;
xlsx_table_context table_context_; xlsx_sheet_context sheet_context_;
xlsx_text_context text_context_; xlsx_text_context text_context_;
xlsx_pivots_context pivots_context_; xlsx_pivots_context pivots_context_;
xlsx_tables_context tables_context_;
std::vector<oox_chart_context_ptr> charts_; std::vector<oox_chart_context_ptr> charts_;
std::vector<oox_external_context_ptr> externals_; std::vector<oox_external_context_ptr> externals_;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "xlsx_output_xml.h" #include "xlsx_output_xml.h"
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include "simple_xml_writer.h" #include <simple_xml_writer.h>
namespace oox { namespace oox {
...@@ -64,6 +64,7 @@ public: ...@@ -64,6 +64,7 @@ public:
std::wstringstream picture_background_; std::wstringstream picture_background_;
std::wstringstream dataValidations_; std::wstringstream dataValidations_;
std::wstringstream protection_; std::wstringstream protection_;
std::wstringstream tableParts_;
rels rels_; rels rels_;
...@@ -171,7 +172,10 @@ std::wostream & xlsx_xml_worksheet::protection() ...@@ -171,7 +172,10 @@ std::wostream & xlsx_xml_worksheet::protection()
{ {
return impl_->protection_; return impl_->protection_;
} }
std::wostream & xlsx_xml_worksheet::tableParts()
{
return impl_->tableParts_;
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
rels & xlsx_xml_worksheet::sheet_rels() rels & xlsx_xml_worksheet::sheet_rels()
{ {
...@@ -269,6 +273,14 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm) ...@@ -269,6 +273,14 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
} }
} }
if (!impl_->tableParts_.str().empty())
{
CP_XML_NODE(L"tableParts")
{
CP_XML_STREAM() << impl_->tableParts_.str();
}
}
//CP_XML_NODE(L"rowBreaks){} //CP_XML_NODE(L"rowBreaks){}
//CP_XML_NODE(L"colBreaks){} //CP_XML_NODE(L"colBreaks){}
......
...@@ -72,6 +72,7 @@ public: ...@@ -72,6 +72,7 @@ public:
std::wostream & picture_background(); std::wostream & picture_background();
std::wostream & dataValidations(); std::wostream & dataValidations();
std::wostream & protection(); std::wostream & protection();
std::wostream & tableParts();
rels & sheet_rels();//hyperlink, background image, external, media ... rels & sheet_rels();//hyperlink, background image, external, media ...
......
...@@ -110,6 +110,15 @@ _CP_PTR(pivot_table_content) pivot_table_content::create() ...@@ -110,6 +110,15 @@ _CP_PTR(pivot_table_content) pivot_table_content::create()
return boost::make_shared<pivot_table_content>(); return boost::make_shared<pivot_table_content>();
} }
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
table_part_content::table_part_content() : rels_file_(rels_file::create(L""))
{
}
_CP_PTR(table_part_content) table_part_content::create()
{
return boost::make_shared<table_part_content>();
}
//--------------------------------------------------------------------------------------------
external_content::external_content() : rels_file_(rels_file::create(L"")) external_content::external_content() : rels_file_(rels_file::create(L""))
{ {
} }
...@@ -258,6 +267,10 @@ void xl_files::write(const std::wstring & RootPath) ...@@ -258,6 +267,10 @@ void xl_files::write(const std::wstring & RootPath)
pivot_table_files_.set_main_document(get_main_document()); pivot_table_files_.set_main_document(get_main_document());
pivot_table_files_.write(path); pivot_table_files_.write(path);
} }
{
table_part_files_.set_main_document(get_main_document());
table_part_files_.write(path);
}
{ {
sheets_files_.set_rels(&rels_files_); sheets_files_.set_rels(&rels_files_);
sheets_files_.set_main_document( this->get_main_document() ); sheets_files_.set_main_document( this->get_main_document() );
...@@ -437,6 +450,10 @@ void xl_files::add_control_props (simple_element_ptr element) ...@@ -437,6 +450,10 @@ void xl_files::add_control_props (simple_element_ptr element)
{ {
control_props_files_.add_control_props(element); control_props_files_.add_control_props(element);
} }
void xl_files::add_table_part(table_part_content_ptr table)
{
table_part_files_.add_table_part(table);
}
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache) void xl_pivot_cache_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
{ {
...@@ -528,6 +545,43 @@ void xl_pivot_table_files::write(const std::wstring & RootPath) ...@@ -528,6 +545,43 @@ void xl_pivot_table_files::write(const std::wstring & RootPath)
} }
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
void xl_table_part_files::add_table_part(table_part_content_ptr table)
{
table_parts_.push_back(table);
}
void xl_table_part_files::write(const std::wstring & RootPath)
{
if (table_parts_.empty()) return;
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"tables";
NSDirectory::CreateDirectory(path.c_str());
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml";
for (size_t i = 0; i < table_parts_.size(); i++)
{
if (!table_parts_[i]) continue;
const std::wstring fileName = std::wstring(L"table") + std::to_wstring(i + 1) + L".xml";
contentTypes.add_override(std::wstring(L"/xl/tables/") + fileName, kWSConType);
package::simple_element(fileName, table_parts_[i]->str()).write(path);
if (table_parts_[i]->get_rels().empty() == false)
{
rels_files relFiles;
table_parts_[i]->rels_file_->set_file_name(fileName + L".rels");
relFiles.add_rel_file(table_parts_[i]->rels_file_);
relFiles.write(path);
}
}
}
//----------------------------------------------------------------------------------------
void xl_charts_files::add_chart(chart_content_ptr chart) void xl_charts_files::add_chart(chart_content_ptr chart)
{ {
charts_.push_back(chart); charts_.push_back(chart);
......
...@@ -110,6 +110,24 @@ private: ...@@ -110,6 +110,24 @@ private:
}; };
typedef _CP_PTR(pivot_table_content) pivot_table_content_ptr; typedef _CP_PTR(pivot_table_content) pivot_table_content_ptr;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
class table_part_content : boost::noncopyable
{
public:
table_part_content();
static _CP_PTR(table_part_content) create();
std::wostream & content() { return content_; }
rels & get_rels() { return rels_file_->get_rels(); }
std::wstring str() { return content_.str(); }
friend class xl_table_part_files;
private:
std::wstringstream content_;
rels_file_ptr rels_file_;
};
typedef _CP_PTR(table_part_content) table_part_content_ptr;
//------------------------------------------------------------------------
class external_content : boost::noncopyable class external_content : boost::noncopyable
{ {
public: public:
...@@ -235,6 +253,16 @@ public: ...@@ -235,6 +253,16 @@ public:
std::vector<pivot_table_content_ptr> pivot_tables_; std::vector<pivot_table_content_ptr> pivot_tables_;
}; };
class xl_table_part_files : public element
{
public:
xl_table_part_files(){}
void add_table_part(table_part_content_ptr table);
virtual void write(const std::wstring & RootPath);
std::vector<table_part_content_ptr> table_parts_;
};
class xl_pivot_cache_files : public element class xl_pivot_cache_files : public element
{ {
public: public:
...@@ -323,6 +351,7 @@ public: ...@@ -323,6 +351,7 @@ public:
void add_pivot_table (pivot_table_content_ptr table); void add_pivot_table (pivot_table_content_ptr table);
void add_query_table (simple_element_ptr element); void add_query_table (simple_element_ptr element);
void add_control_props (simple_element_ptr element); void add_control_props (simple_element_ptr element);
void add_table_part (table_part_content_ptr table);
void add_vba_project (); void add_vba_project ();
void add_attachedToolbars(); void add_attachedToolbars();
private: private:
...@@ -335,6 +364,7 @@ private: ...@@ -335,6 +364,7 @@ private:
xl_activeX_files activeXs_files_; xl_activeX_files activeXs_files_;
xl_query_table_files query_tables_files_; xl_query_table_files query_tables_files_;
xl_control_props_files control_props_files_; xl_control_props_files control_props_files_;
xl_table_part_files table_part_files_;
element_ptr theme_; element_ptr theme_;
element_ptr workbook_; element_ptr workbook_;
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "xlsx_sheet_context.h"
#include "xlsx_textcontext.h"
#include "xlsx_conversion_context.h"
#include <sstream>
#include <simple_xml_writer.h>
namespace oox {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
table_state::table_state(xlsx_conversion_context & Context) : drawing_context_(Context), comments_context_(Context.get_comments_context_handle())
{
}
table_state_ptr & xlsx_sheet_context::state()
{
return tables_state_.back();
}
xlsx_sheet_context::xlsx_sheet_context(xlsx_conversion_context & Context) : context_(Context)
{
}
void xlsx_sheet_context::start_table()
{
tables_state_.push_back( table_state_ptr(new table_state(context_)));
}
void xlsx_sheet_context::set_chart_view()
{
CP_XML_WRITER(context_.current_sheet().sheetViews())
{
CP_XML_NODE(L"sheetViews")
{
CP_XML_NODE(L"sheetView")
{
CP_XML_ATTR(L"showGridLines", 0);
CP_XML_ATTR(L"workbookViewId", 0);
}
}
}
}
void xlsx_sheet_context::end_table()
{
if (!get_drawing_context().empty())
{
std::wstringstream strm;
get_drawing_context().serialize(strm);
const std::pair<std::wstring, std::wstring> drawingName =
context_.get_drawing_context_handle().add_drawing_xml(strm.str(), get_drawing_context().get_rels());
context_.current_sheet().set_drawing_link(drawingName.first, drawingName.second);
CP_XML_WRITER(context_.current_sheet().drawing())
{
CP_XML_NODE(L"drawing")
{
CP_XML_ATTR(L"r:id", drawingName.second);
}
}
}
if (!get_drawing_context().empty_vml_HF())
{
std::wstringstream strm;
get_drawing_context().serialize_vml_HF(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_HF_rels());
context_.current_sheet().set_vml_HF_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_drawing_context().empty_vml())
{
std::wstringstream strm;
get_drawing_context().serialize_vml(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_rels());
context_.current_sheet().set_vml_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_comments_context().empty())
{
std::wstringstream strm;
get_comments_context().write_comments(strm);
const std::pair<std::wstring, std::wstring> commentsName =
context_.get_comments_context_handle().add_comments_xml(strm.str(), context_.get_comments_context().get_comments());
context_.current_sheet().set_comments_link(commentsName.first, commentsName.second);
}
}
xlsx_drawing_context & xlsx_sheet_context::get_drawing_context()
{
return state()->drawing_context_;
}
xlsx_comments_context & xlsx_sheet_context::get_comments_context()
{
return state()->comments_context_;
}
std::wstring xlsx_sheet_context::add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal)
{
return state()->hyperlinks_.add( ref, target, display, bExternal);
}
void xlsx_sheet_context::dump_rels_hyperlinks(rels & Rels)
{
state()->hyperlinks_.dump_rels(Rels);
}
void xlsx_sheet_context::serialize_hyperlinks(std::wostream & _Wostream)
{
state()->hyperlinks_.serialize(_Wostream);
}
void xlsx_sheet_context::dump_rels_drawing(rels & Rels)
{
xlsx_drawings_rels_ptr drawing_rels = state()->drawing_context_.get_sheet_rels();
drawing_rels->dump_rels(Rels);
}
void xlsx_sheet_context::serialize_ole_objects(std::wostream & strm)
{
state()->drawing_context_.serialize_objects(strm);
}
void xlsx_sheet_context::serialize_controls(std::wostream & strm)
{
state()->drawing_context_.serialize_controls(strm);
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <list>
#include "xlsx_drawing_context.h"
#include "xlsx_comments_context.h"
#include "xlsx_hyperlinks.h"
namespace oox {
class xlsx_conversion_context;
class xlsx_text_context;
struct table_state
{
table_state(xlsx_conversion_context & Context);
xlsx_hyperlinks hyperlinks_;
xlsx_drawing_context drawing_context_;
xlsx_comments_context comments_context_;
};
typedef _CP_PTR(table_state) table_state_ptr;
class xlsx_sheet_context
{
public:
xlsx_sheet_context(xlsx_conversion_context & Context);
void start_table();
void set_chart_view();
void end_table();
xlsx_drawing_context & get_drawing_context();
xlsx_comments_context & get_comments_context();
//
table_state_ptr & state();
std::wstring add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal);
void serialize_hyperlinks(std::wostream & _Wostream);
void dump_rels_hyperlinks(rels & Rels);
void serialize_ole_objects(std::wostream & _Wostream);
void serialize_controls(std::wostream & _Wostream);
void dump_rels_drawing(rels & Rels);
private:
xlsx_conversion_context & context_;
std::list<table_state_ptr> tables_state_;
};
}
...@@ -31,137 +31,47 @@ ...@@ -31,137 +31,47 @@
*/ */
#include "xlsx_tablecontext.h" #include "xlsx_tablecontext.h"
#include "xlsx_textcontext.h"
#include "xlsx_conversion_context.h"
#include <boost/foreach.hpp> #include <boost/make_shared.hpp>
#include <sstream> #include <simple_xml_writer.h>
#include "simple_xml_writer.h"
namespace oox { namespace oox {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
table_state::table_state(xlsx_conversion_context & Context) : drawing_context_(Context), comments_context_(Context.get_comments_context_handle())
{
}
table_state_ptr & xlsx_table_context::state()
{
return tables_state_.back();
}
xlsx_table_context::xlsx_table_context(xlsx_conversion_context & Context) : context_(Context)
{
}
void xlsx_table_context::start_table() class xlsx_tables_context::Impl
{ {
tables_state_.push_back( table_state_ptr(new table_state(context_))); public:
} Impl() {}
std::vector<std::wstring> tables_;
};
void xlsx_table_context::set_chart_view() xlsx_tables_context::xlsx_tables_context() : impl_(new xlsx_tables_context::Impl())
{ {
CP_XML_WRITER(context_.current_sheet().sheetViews())
{
CP_XML_NODE(L"sheetViews")
{
CP_XML_NODE(L"sheetView")
{
CP_XML_ATTR(L"showGridLines", 0);
CP_XML_ATTR(L"workbookViewId", 0);
}
}
}
} }
void xlsx_table_context::end_table() void xlsx_tables_context::add_table(std::wstring table)
{ {
if (!get_drawing_context().empty()) if (table.empty()) return;
{
std::wstringstream strm;
get_drawing_context().serialize(strm);
const std::pair<std::wstring, std::wstring> drawingName =
context_.get_drawing_context_handle().add_drawing_xml(strm.str(), get_drawing_context().get_rels());
context_.current_sheet().set_drawing_link(drawingName.first, drawingName.second);
CP_XML_WRITER(context_.current_sheet().drawing())
{
CP_XML_NODE(L"drawing")
{
CP_XML_ATTR(L"r:id", drawingName.second);
}
}
}
if (!get_drawing_context().empty_vml_HF())
{
std::wstringstream strm;
get_drawing_context().serialize_vml_HF(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_HF_rels());
context_.current_sheet().set_vml_HF_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_drawing_context().empty_vml())
{
std::wstringstream strm;
get_drawing_context().serialize_vml(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_rels());
context_.current_sheet().set_vml_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_comments_context().empty())
{
std::wstringstream strm;
get_comments_context().write_comments(strm);
const std::pair<std::wstring, std::wstring> commentsName =
context_.get_comments_context_handle().add_comments_xml(strm.str(), context_.get_comments_context().get_comments());
context_.current_sheet().set_comments_link (commentsName.first, commentsName.second); impl_->tables_.push_back(table);
}
} }
void xlsx_tables_context::dump_rels(int index, rels & Rels)
xlsx_drawing_context & xlsx_table_context::get_drawing_context()
{ {
return state()->drawing_context_;
}
xlsx_comments_context & xlsx_table_context::get_comments_context()
{
return state()->comments_context_;
} }
void xlsx_tables_context::write_to(int index, std::wostream & strm)
std::wstring xlsx_table_context::add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal)
{ {
return state()->hyperlinks_.add( ref, target, display, bExternal); strm << impl_->tables_[index];
} }
void xlsx_table_context::dump_rels_hyperlinks(rels & Rels) int xlsx_tables_context::get_count()
{ {
state()->hyperlinks_.dump_rels(Rels); return (int)impl_->tables_.size();
} }
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{ xlsx_tables_context::~xlsx_tables_context()
state()->hyperlinks_.serialize(_Wostream);
}
void xlsx_table_context::dump_rels_drawing(rels & Rels)
{
xlsx_drawings_rels_ptr drawing_rels = state()->drawing_context_.get_sheet_rels();
drawing_rels->dump_rels(Rels);
}
void xlsx_table_context::serialize_ole_objects(std::wostream & strm)
{
state()->drawing_context_.serialize_objects(strm);
}
void xlsx_table_context::serialize_controls(std::wostream & strm)
{ {
state()->drawing_context_.serialize_controls(strm);
} }
} }
...@@ -31,56 +31,30 @@ ...@@ -31,56 +31,30 @@
*/ */
#pragma once #pragma once
#include <list> #include "oox_package.h"
#include "xlsx_drawing_context.h"
#include "xlsx_comments_context.h"
#include "xlsx_hyperlinks.h"
namespace oox { namespace oox {
class xlsx_conversion_context; class xlsx_tables_context;
class xlsx_text_context; typedef _CP_PTR(xlsx_tables_context) xlsx_tables_context_ptr;
struct table_state
{
table_state(xlsx_conversion_context & Context);
xlsx_hyperlinks hyperlinks_;
xlsx_drawing_context drawing_context_;
xlsx_comments_context comments_context_;
}; class xlsx_tables_context
typedef _CP_PTR(table_state) table_state_ptr;
class xlsx_table_context
{ {
public: public:
xlsx_table_context(xlsx_conversion_context & Context); xlsx_tables_context();
~xlsx_tables_context();
void start_table(); void add_table(std::wstring table);
void set_chart_view(); void write_to (int index, std::wostream & strm);
void end_table(); void dump_rels(int index, rels & Rels);
xlsx_drawing_context & get_drawing_context(); int get_count();
xlsx_comments_context & get_comments_context();
//
table_state_ptr & state();
std::wstring add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal);
void serialize_hyperlinks(std::wostream & _Wostream);
void dump_rels_hyperlinks(rels & Rels);
void serialize_ole_objects(std::wostream & _Wostream);
void serialize_controls(std::wostream & _Wostream);
void dump_rels_drawing(rels & Rels);
private: private:
xlsx_conversion_context & context_; class Impl;
_CP_PTR(Impl) impl_;
std::list<table_state_ptr> tables_state_;
}; };
} }
...@@ -36,9 +36,7 @@ ...@@ -36,9 +36,7 @@
#include <iostream> #include <iostream>
#include <list> #include <list>
#include <boost/foreach.hpp> #include <simple_xml_writer.h>
#include "simple_xml_writer.h"
#include "utils.h" #include "utils.h"
namespace oox { namespace oox {
......
...@@ -842,6 +842,7 @@ SOURCES += \ ...@@ -842,6 +842,7 @@ SOURCES += \
../XlsXlsxConverter/xlsx_textcontext.cpp \ ../XlsXlsxConverter/xlsx_textcontext.cpp \
../XlsXlsxConverter/xlsx_chart_context.cpp \ ../XlsXlsxConverter/xlsx_chart_context.cpp \
../XlsXlsxConverter/xlsx_pivots_context.cpp \ ../XlsXlsxConverter/xlsx_pivots_context.cpp \
../XlsXlsxConverter/xlsx_sheet_context.cpp \
../XlsXlsxConverter/xlsx_external_context.cpp \ ../XlsXlsxConverter/xlsx_external_context.cpp \
../XlsXlsxConverter/xlsx_activeX_context.cpp \ ../XlsXlsxConverter/xlsx_activeX_context.cpp \
../XlsXlsxConverter/xlsx_comments.cpp \ ../XlsXlsxConverter/xlsx_comments.cpp \
...@@ -1601,6 +1602,7 @@ HEADERS += \ ...@@ -1601,6 +1602,7 @@ HEADERS += \
../XlsXlsxConverter/xlsx_conversion_context.h \ ../XlsXlsxConverter/xlsx_conversion_context.h \
../XlsXlsxConverter/xlsx_drawing_context.h \ ../XlsXlsxConverter/xlsx_drawing_context.h \
../XlsXlsxConverter/xlsx_drawings.h \ ../XlsXlsxConverter/xlsx_drawings.h \
../XlsXlsxConverter/xlsx_sheet_context.cpp \
../XlsXlsxConverter/xlsx_pivots_context.cpp \ ../XlsXlsxConverter/xlsx_pivots_context.cpp \
../XlsXlsxConverter/xlsx_hyperlinks.h \ ../XlsXlsxConverter/xlsx_hyperlinks.h \
../XlsXlsxConverter/xlsx_output_xml.h \ ../XlsXlsxConverter/xlsx_output_xml.h \
......
...@@ -440,6 +440,14 @@ ...@@ -440,6 +440,14 @@
RelativePath="..\XlsXlsxConverter\xlsx_pivots_context.h" RelativePath="..\XlsXlsxConverter\xlsx_pivots_context.h"
> >
</File> </File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_sheet_context.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_sheet_context.h"
>
</File>
<File <File
RelativePath="..\XlsXlsxConverter\xlsx_tablecontext.cpp" RelativePath="..\XlsXlsxConverter\xlsx_tablecontext.cpp"
> >
......
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