Commit a2b2dd1a authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

XlsFormat - условное форматирование и стили условного форматирования

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68075 954022d7-b5bf-4e40-9824-e11837661b57
parent 6f0f09cd
......@@ -2,7 +2,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
Blank::Blank()
{
......@@ -28,6 +27,8 @@ void Blank::writeFields(CFRecord& record)
void Blank::readFields(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
record >> cell;
}
......@@ -47,10 +48,10 @@ int Blank::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"r", ref);
int st = (int)cell.ixfe - cellStyleXfs_count;
if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count))
int st = (int)cell.ixfe - global_info_->cellStyleXfs_count;
if ((cell.ixfe.value()) && (cell.ixfe > global_info_->cellStyleXfs_count))
{
CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count);
CP_XML_ATTR(L"s", cell.ixfe - global_info_->cellStyleXfs_count);
}
}
}
......
......@@ -29,8 +29,9 @@ public:
const CellRef getLocation() const;
//-----------------------------
CellOffsetResender resender;
Cell cell;
GlobalWorkbookInfoPtr global_info_;
CellOffsetResender resender;
Cell cell;
};
......
......@@ -2,7 +2,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
BoolErr::BoolErr()
{
......@@ -29,6 +28,8 @@ void BoolErr::writeFields(CFRecord& record)
void BoolErr::readFields(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
record >> cell >> bes;
}
......@@ -50,7 +51,7 @@ int BoolErr::serialize(std::wostream & stream)
if (cell.ixfe.value())
{
CP_XML_ATTR(L"s", *cell.ixfe.value() - cellStyleXfs_count);
CP_XML_ATTR(L"s", *cell.ixfe.value() - global_info_->cellStyleXfs_count);
}
}
}
......
......@@ -30,9 +30,10 @@ public:
const CellRef getLocation() const;
//-----------------------------
CellOffsetResender resender;
Cell cell;
Bes bes;
GlobalWorkbookInfoPtr global_info_;
CellOffsetResender resender;
Cell cell;
Bes bes;
};
......
......@@ -8,6 +8,8 @@ CF::CF(const CellRef& cell_base_ref)
: rgce1(cell_base_ref),
rgce2(cell_base_ref)
{
dxfId_ = 0;
ipriority_ = 0;
}
......@@ -25,11 +27,15 @@ BaseObjectPtr CF::clone()
void CF::writeFields(CFRecord& record)
{
record << ct << cp;
record.registerDelayedDataReceiver(NULL, sizeof(unsigned short)/*cce*/);
record.registerDelayedDataReceiver(NULL, sizeof(unsigned short)/*cce*/);
record << rgbdxf;
rgce1.store(record);
rgce2.store(record);
record.registerDelayedDataSource(rgce1.getCCE(), rt_CF);
record.registerDelayedDataSource(rgce2.getCCE(), rt_CF);
}
......@@ -37,13 +43,68 @@ void CF::writeFields(CFRecord& record)
void CF::readFields(CFRecord& record)
{
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
unsigned short cce1;
unsigned short cce2;
record >> ct >> cp >> cce1 >> cce2;
record >> rgbdxf;
rgce1.load(record, cce1);
rgce2.load(record, cce2);
ipriority_ = ++record.getGlobalWorkbookInfo()->cmt_rules;
rgbdxf.serialize(record.getGlobalWorkbookInfo()->users_Dxfs_stream);
dxfId_ = global_info->cellStyleDxfs_count++;
}
int CF::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"cfRule")
{
switch(ct)
{
case 1: CP_XML_ATTR(L"type", L"cellIs"); break;
case 2: CP_XML_ATTR(L"type", L"expression"); break;
case 6: CP_XML_ATTR(L"type", L"iconSet"); break;
}
if (ct == (unsigned char)1)
{
switch(cp)
{
case 1: CP_XML_ATTR(L"operator", L"between"); break;
case 2: CP_XML_ATTR(L"operator", L"notBetween"); break;
case 3: CP_XML_ATTR(L"operator", L"equal"); break;
case 4: CP_XML_ATTR(L"operator", L"notEqual"); break;
case 5: CP_XML_ATTR(L"operator", L"greaterThan"); break;
case 6: CP_XML_ATTR(L"operator", L"lessThan"); break;
case 7: CP_XML_ATTR(L"operator", L"greaterThanOrEqual");break;
case 8: CP_XML_ATTR(L"operator", L"lessThanOrEqual"); break;
}
}
CP_XML_ATTR(L"priority", ipriority_);
CP_XML_ATTR(L"stopIfTrue", 1);
CP_XML_ATTR(L"dxfId", dxfId_);
std::wstring s1 = rgce1.getAssembledFormula();
std::wstring s2 = rgce1.getAssembledFormula();
CP_XML_NODE(L"formula")
{
if (!s1.empty())
CP_XML_STREAM() << s1;
else if(!s2.empty())
CP_XML_STREAM() << s2;
}
}
}
return 0;
}
} // namespace XLS
......@@ -24,20 +24,18 @@ public:
static const ElementType type = typeCF;
int serialize(std::wostream & stream);
//-----------------------------
BIFF_BYTE ct;
BIFF_BYTE cp;
DXFN rgbdxf;
CFParsedFormulaNoCCE rgce1;
CFParsedFormulaNoCCE rgce2;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(ct)
//BO_ATTRIB_MARKUP_ATTRIB(cp)
//BO_ATTRIB_MARKUP_COMPLEX(rgbdxf)
//BO_ATTRIB_MARKUP_COMPLEX(rgce1)
//BO_ATTRIB_MARKUP_COMPLEX(rgce2)
//BO_ATTRIB_MARKUP_END
int dxfId_;
int ipriority_;
};
......
......@@ -10,6 +10,8 @@ CF12::CF12(const CellRef& cell_base_ref)
rgce2(cell_base_ref),
fmlaActive(cell_base_ref)
{
dxfId_ = 0;
ipriority_ = 0;
}
......@@ -34,13 +36,17 @@ void CF12::writeFields(CFRecord& record)
void CF12::readFields(CFRecord& record)
{
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
record >> frtRefHeader;
record >> ct >> cp;
unsigned short cce1;
unsigned short cce2;
record >> cce1 >> cce2;
record >> dxf;
rgce1.load(record, cce1);
rgce2.load(record, cce2);
fmlaActive.load(record);
......@@ -50,9 +56,12 @@ void CF12::readFields(CFRecord& record)
fStopIfTrue = GETBIT(flags, 1);
record >> ipriority >> icfTemplate;
unsigned char cbTemplateParm;
record >> cbTemplateParm;
record >> rgbTemplateParms;
switch(ct)
{
case 0x03:
......@@ -78,7 +87,56 @@ void CF12::readFields(CFRecord& record)
rgbCT->load(record);
break;
}
ipriority_ = ++record.getGlobalWorkbookInfo()->cmt_rules;
dxf.serialize(record.getGlobalWorkbookInfo()->users_Dxfs_stream);
dxfId_ = global_info->cellStyleDxfs_count++;
}
int CF12::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"cfRule")
{
switch(ct)
{
case 1: CP_XML_ATTR(L"type", L"cellIs"); break;
case 2: CP_XML_ATTR(L"type", L"expression"); break;
case 6: CP_XML_ATTR(L"type", L"iconSet"); break;
}
if (ct == (unsigned char)1)
{
switch(cp)
{
case 1: CP_XML_ATTR(L"operator", L"between"); break;
case 2: CP_XML_ATTR(L"operator", L"notBetween"); break;
case 3: CP_XML_ATTR(L"operator", L"equal"); break;
case 4: CP_XML_ATTR(L"operator", L"notEqual"); break;
case 5: CP_XML_ATTR(L"operator", L"greaterThan"); break;
case 6: CP_XML_ATTR(L"operator", L"lessThan"); break;
case 7: CP_XML_ATTR(L"operator", L"greaterThanOrEqual");break;
case 8: CP_XML_ATTR(L"operator", L"lessThanOrEqual"); break;
}
}
CP_XML_ATTR(L"priority", ipriority_);
CP_XML_ATTR(L"stopIfTrue", fStopIfTrue);
CP_XML_ATTR(L"dxfId", dxfId_);
std::wstring s1 = rgce1.getAssembledFormula();
std::wstring s2 = rgce1.getAssembledFormula();
CP_XML_NODE(L"formula")
{
if (!s1.empty())
CP_XML_STREAM() << s1;
else if(!s2.empty())
CP_XML_STREAM() << s2;
}
}
}
return 0;
}
} // namespace XLS
......
......@@ -7,6 +7,7 @@
#include <Logic/Biff_structures/CFParsedFormula.h>
#include <Logic/Biff_structures/CFExTemplateParams.h>
namespace XLS
{
......@@ -27,20 +28,30 @@ public:
static const ElementType type = typeCF12;
//-----------------------------
FrtRefHeader frtRefHeader;
BIFF_BYTE ct;
BIFF_BYTE cp;
DXFN12 dxf;
CFParsedFormulaNoCCE rgce1;
CFParsedFormulaNoCCE rgce2;
CFParsedFormula fmlaActive;
BIFF_WORD ipriority;
BIFF_WORD icfTemplate;
CFExTemplateParams rgbTemplateParms;
BiffStructurePtr rgbCT;
int serialize(std::wostream & stream);
FrtRefHeader frtRefHeader;
BIFF_BYTE ct;
BIFF_BYTE cp;
DXFN12 dxf;
CFParsedFormulaNoCCE rgce1;
CFParsedFormulaNoCCE rgce2;
CFParsedFormula fmlaActive;
BIFF_WORD ipriority;
BIFF_WORD icfTemplate;
CFExTemplateParams rgbTemplateParms;
BiffStructurePtr rgbCT;
//-----------------------------
bool fStopIfTrue;
int ipriority_;
int dxfId_;
};
typedef boost::shared_ptr<CF12> CF12Ptr;
......
......@@ -26,20 +26,11 @@ public:
const CellRef getLocation() const;
//-----------------------------
BIFF_WORD ccf;
bool fToughRecalc;
BIFF_WORD nID;
SqRefU sqref;
BIFF_BSTR refBound;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(ccf)
//BO_ATTRIB_MARKUP_ATTRIB(fToughRecalc)
//BO_ATTRIB_MARKUP_ATTRIB(nID)
//BO_ATTRIB_MARKUP_ATTRIB(refBound)
//BO_ATTRIB_MARKUP_COMPLEX(sqref)
//BO_ATTRIB_MARKUP_END
BIFF_WORD ccf;
bool fToughRecalc;
BIFF_WORD nID;
SqRefU sqref;
BIFF_BSTR refBound;
};
typedef boost::shared_ptr<CondFmt> CondFmtPtr;
......
......@@ -24,11 +24,10 @@ public:
static const ElementType type = typeCondFmt12;
const CellRef getLocation() const;
//-----------------------------
FrtRefHeaderU frtRefHeaderU;
CondFmtStructure mainCF;
FrtRefHeaderU frtRefHeaderU;
CondFmtStructure mainCF;
};
......
......@@ -32,8 +32,22 @@ void DXF::readFields(CFRecord& record)
{
record >> frtRefHeaderU;
unsigned short flags;
record >> flags >> xfprops;
fNewBorder = GETBIT(flags, 1);
xfprops.fNewBorder = GETBIT(flags, 1);
}
int DXF::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"dxf")
{
xfprops.serialize(CP_XML_STREAM());
}
}
return 0;
}
} // namespace XLS
......
......@@ -24,11 +24,11 @@ public:
static const ElementType type = typeDXF;
//-----------------------------
FrtRefHeaderU frtRefHeaderU;
XFProps xfprops;
int serialize(std::wostream & stream);
FrtRefHeaderU frtRefHeaderU;
XFProps xfprops;
bool fNewBorder;
};
} // namespace XLS
......
......@@ -409,10 +409,11 @@ int Font::serialize_properties(std::wostream & stream, bool rPr)
{
switch(uls)
{
case 1: CP_XML_ATTR(L"val", "single");break;
case 2: CP_XML_ATTR(L"val", "double");break;
case 33: CP_XML_ATTR(L"val", "singleAccounting");break;
case 34: CP_XML_ATTR(L"val", "doubleAccounting");break;
case 0: CP_XML_ATTR(L"val", L"none");break;
case 1: CP_XML_ATTR(L"val", L"single");break;
case 2: CP_XML_ATTR(L"val", L"double");break;
case 33: CP_XML_ATTR(L"val", L"singleAccounting");break;
case 34: CP_XML_ATTR(L"val", L"doubleAccounting");break;
}
}
}
......
......@@ -3,7 +3,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
Label::Label()
{
......@@ -24,18 +23,20 @@ BaseObjectPtr Label::clone()
void Label::writeFields(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
record << cell << st;
}
void Label::readFields(CFRecord& record)
{
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo();
global_info_ = record.getGlobalWorkbookInfo();
record >> cell >> st;
isst_ = pGlobalWorkbookInfoPtr->startAddedSharedStrings + pGlobalWorkbookInfoPtr->arAddedSharedStrings.size() ;
pGlobalWorkbookInfoPtr->arAddedSharedStrings.push_back(st.value());
isst_ = global_info_->startAddedSharedStrings + global_info_->arAddedSharedStrings.size() ;
global_info_->arAddedSharedStrings.push_back(st.value());
}
int Label::serialize(std::wostream & stream)
......@@ -49,10 +50,10 @@ int Label::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"r", ref);
int st = (int)cell.ixfe - cellStyleXfs_count;
if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count))
int st = (int)cell.ixfe - global_info_->cellStyleXfs_count;
if ((cell.ixfe.value()) && (cell.ixfe > global_info_->cellStyleXfs_count))
{
CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count);
CP_XML_ATTR(L"s", cell.ixfe - global_info_->cellStyleXfs_count);
}
CP_XML_ATTR(L"t", L"s");
......
......@@ -30,7 +30,8 @@ public:
XLUnicodeString st;
//-----------------------------
int isst_;
GlobalWorkbookInfoPtr global_info_;
int isst_;
};
} // namespace XLS
......
......@@ -2,7 +2,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
LabelSst::LabelSst()
{
......@@ -29,6 +28,8 @@ void LabelSst::writeFields(CFRecord& record)
void LabelSst::readFields(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
record >> cell >> isst;
}
......@@ -48,10 +49,10 @@ int LabelSst::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"r", ref);
int st = (int)cell.ixfe - cellStyleXfs_count;
if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count))
int st = (int)cell.ixfe - global_info_->cellStyleXfs_count;
if ((cell.ixfe.value()) && (cell.ixfe > global_info_->cellStyleXfs_count))
{
CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count);
CP_XML_ATTR(L"s", cell.ixfe - global_info_->cellStyleXfs_count);
}
CP_XML_ATTR(L"t", L"s");
......
......@@ -27,9 +27,11 @@ public:
const CellRef getLocation() const;
//-----------------------------
CellOffsetResender resender;
Cell cell;
BIFF_DWORD isst;
GlobalWorkbookInfoPtr global_info_;
CellOffsetResender resender;
Cell cell;
BIFF_DWORD isst;
};
......
......@@ -6,8 +6,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
std::wstring getColAddress(int col)
{
static const size_t r = (L'Z' - L'A' + 1);
......@@ -64,6 +62,8 @@ void MulBlank::writeFields(CFRecord& record)
void MulBlank::readFields(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
// A little hack to extract colLast before it is used
record.skipNunBytes(record.getDataSize() - sizeof(unsigned short));
record >> colLast;
......@@ -98,26 +98,26 @@ int MulBlank::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"r", ref);
if(( (i-colFirst) < rgixfe.rgixfe.size()) && (rgixfe.rgixfe[i-colFirst] > cellStyleXfs_count))
if(( (i-colFirst) < rgixfe.rgixfe.size()) && (rgixfe.rgixfe[i-colFirst] > global_info_->cellStyleXfs_count))
{
int st = (int)rgixfe.rgixfe[i-colFirst] - cellStyleXfs_count;
CP_XML_ATTR(L"s", rgixfe.rgixfe[i-colFirst] - cellStyleXfs_count);
int st = (int)rgixfe.rgixfe[i-colFirst] - global_info_->cellStyleXfs_count;
CP_XML_ATTR(L"s", rgixfe.rgixfe[i-colFirst] - global_info_->cellStyleXfs_count);
}
else if ((rgixfe.common_ixfe > 0) && (rgixfe.common_ixfe > cellStyleXfs_count))
else if ((rgixfe.common_ixfe > 0) && (rgixfe.common_ixfe > global_info_->cellStyleXfs_count))
{
int st = (int)rgixfe.common_ixfe - cellStyleXfs_count;
CP_XML_ATTR(L"s", rgixfe.common_ixfe - cellStyleXfs_count);
int st = (int)rgixfe.common_ixfe - global_info_->cellStyleXfs_count;
CP_XML_ATTR(L"s", rgixfe.common_ixfe - global_info_->cellStyleXfs_count);
}
}
//if(( (i-colFirst) < rgixfe.rgixfe.size()) && (rgixfe.rgixfe[i-colFirst] > cellStyleXfs_count))
//if(( (i-colFirst) < rgixfe.rgixfe.size()) && (rgixfe.rgixfe[i-colFirst] > global_info_->cellStyleXfs_count))
//{
// CP_XML_NODE(L"c")
// {
// CP_XML_ATTR(L"r", ref);
//
// int st = (int)rgixfe.rgixfe[i-colFirst] - cellStyleXfs_count;
// CP_XML_ATTR(L"s", rgixfe.rgixfe[i-colFirst] - cellStyleXfs_count);
// int st = (int)rgixfe.rgixfe[i-colFirst] - global_info_->cellStyleXfs_count;
// CP_XML_ATTR(L"s", rgixfe.rgixfe[i-colFirst] - global_info_->cellStyleXfs_count);
// }
//}
}
......
......@@ -44,10 +44,11 @@ public:
int serialize(std::wostream & stream);
//-----------------------------
Rw rw;
Col colFirst;
IXFCellMulBlankSpecial rgixfe;
Col colLast;
GlobalWorkbookInfoPtr global_info_;
Rw rw;
Col colFirst;
IXFCellMulBlankSpecial rgixfe;
Col colLast;
};
......
......@@ -2,7 +2,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
MulRk::MulRk()
{
......@@ -30,6 +29,8 @@ void MulRk::writeFields(CFRecord& record)
void MulRk::readFields(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
Col colFirst;
Col colLast;
// A little hack to extract colLast before it is used
......@@ -70,9 +71,9 @@ int MulRk::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"r", ref);
if ((cell->ixfe.value()) && (cell->ixfe > cellStyleXfs_count))
if ((cell->ixfe.value()) && (cell->ixfe > global_info_->cellStyleXfs_count))
{
CP_XML_ATTR(L"s", cell->ixfe - cellStyleXfs_count);
CP_XML_ATTR(L"s", cell->ixfe - global_info_->cellStyleXfs_count);
}
CP_XML_NODE(L"v")
{
......
......@@ -26,9 +26,10 @@ public:
int serialize(std::wostream & stream);
//-----------------------------
Rw rw;
BiffStructurePtrVector rgrkrec;
BiffStructurePtrVector cells;
GlobalWorkbookInfoPtr global_info_;
Rw rw;
BiffStructurePtrVector rgrkrec;
BiffStructurePtrVector cells;
};
......
......@@ -3,7 +3,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
Number::Number()
{
......@@ -30,6 +29,8 @@ void Number::writeFields(CFRecord& record)
void Number::readFields(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
record >> cell >> num;
_INT32 val = 0;
......@@ -55,9 +56,9 @@ int Number::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"r", ref);
if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count))
if ((cell.ixfe.value()) && (cell.ixfe > global_info_->cellStyleXfs_count))
{
CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count);
CP_XML_ATTR(L"s", cell.ixfe - global_info_->cellStyleXfs_count);
}
if (num.value())
{
......
......@@ -29,9 +29,10 @@ public:
const CellRef getLocation() const;
//-----------------------------
CellOffsetResender resender;
Cell cell;
BIFF_DOUBLE num;
GlobalWorkbookInfoPtr global_info_;
CellOffsetResender resender;
Cell cell;
BIFF_DOUBLE num;
};
......
......@@ -2,7 +2,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
RK::RK()
{
......@@ -30,6 +29,8 @@ void RK::writeFields(CFRecord& record)
void RK::readFields(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
Rw rw;
Col col;
record >> rw >> col >> rkrec;
......@@ -52,9 +53,9 @@ int RK::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"r", ref);
if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count))
if ((cell.ixfe.value()) && (cell.ixfe > global_info_->cellStyleXfs_count))
{
CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count);
CP_XML_ATTR(L"s", cell.ixfe - global_info_->cellStyleXfs_count);
}
CP_XML_NODE(L"v")
{
......
......@@ -29,8 +29,9 @@ public:
const CellRef getLocation() const;
//-----------------------------
RkRec rkrec;
Cell cell;
GlobalWorkbookInfoPtr global_info_;
RkRec rkrec;
Cell cell;
};
......
......@@ -33,9 +33,10 @@ void StyleExt::readFields(CFRecord& record)
#pragma message("############################ frtHeader skipped here")
unsigned char flags;
record >> flags;
fBuiltIn = GETBIT(flags, 0);
fHidden = GETBIT(flags, 1);
fCustom = GETBIT(flags, 2);
fBuiltIn = GETBIT(flags, 0);
fHidden = GETBIT(flags, 1);
fCustom = GETBIT(flags, 2);
record >> iCategory>> builtInData >> stName >> xfProps;
}
......
......@@ -28,9 +28,10 @@ public:
int serialize(std::wostream & stream);
//-----------------------------
bool fBuiltIn;
bool fHidden;
bool fCustom;
bool fBuiltIn;
bool fHidden;
bool fCustom;
BIFF_BYTE iCategory;
BuiltInStyle builtInData;
LPWideString stName;
......
......@@ -21,12 +21,11 @@ public:
const CellRef getLocation() const;
private:
unsigned short ccf;
bool fToughRecalc;
unsigned short nID;
Ref8U refBound;
SqRefU sqref;
unsigned short ccf;
bool fToughRecalc;
unsigned short nID;
Ref8U refBound;
SqRefU sqref;
};
} // namespace XLS
......
#include "DXFALC.h"
#include "DXFN.h"
#include <Binary/CFRecord.h>
namespace XLS
{
BiffStructurePtr DXFALC::clone()
{
return BiffStructurePtr(new DXFALC(*this));
}
//void DXFALC::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"alc", alc);
// xml_tag->setAttribute(L"fWrap", fWrap);
// xml_tag->setAttribute(L"alcv", alcv);
// xml_tag->setAttribute(L"fJustLast", fJustLast);
// xml_tag->setAttribute(L"trot", trot);
// xml_tag->setAttribute(L"cIndent", cIndent);
// xml_tag->setAttribute(L"fShrinkToFit", fShrinkToFit);
// xml_tag->setAttribute(L"fMergeCell", fMergeCell);
// xml_tag->setAttribute(L"iReadingOrder", iReadingOrder);
//
// xml_tag->setAttribute(L"iIndent", iIndent);
//}
//
//
//void DXFALC::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// alc = getStructAttribute(xml_tag, L"alc");
// fWrap = getStructAttribute(xml_tag, L"fWrap");
// alcv = getStructAttribute(xml_tag, L"alcv");
// fJustLast = getStructAttribute(xml_tag, L"fJustLast");
// trot = getStructAttribute(xml_tag, L"trot");
// cIndent = getStructAttribute(xml_tag, L"cIndent");
// fShrinkToFit = getStructAttribute(xml_tag, L"fShrinkToFit");
// fMergeCell = getStructAttribute(xml_tag, L"fMergeCell");
// iReadingOrder = getStructAttribute(xml_tag, L"iReadingOrder");
//
// iIndent = getStructAttribute(xml_tag, L"iIndent");
//}
//
//
void DXFALC::store(CFRecord& record)
{
_UINT32 flags = 0;
......@@ -57,6 +22,7 @@ void DXFALC::store(CFRecord& record)
SETBIT(flags, 20, fShrinkToFit);
SETBIT(flags, 21, fMergeCell);
SETBITS(flags, 22, 23, iReadingOrder);
record << flags;
record << iIndent;
}
......@@ -67,19 +33,84 @@ void DXFALC::load(CFRecord& record)
_UINT32 flags;
record >> flags;
alc = static_cast<unsigned char>(GETBITS(flags, 0, 2));
fWrap = GETBIT(flags, 3);
alcv = static_cast<unsigned char>(GETBITS(flags, 4, 6));
fJustLast = GETBIT(flags, 7);
trot = static_cast<unsigned char>(GETBITS(flags, 8, 15));
cIndent = static_cast<unsigned char>(GETBITS(flags, 16, 19));
fShrinkToFit = GETBIT(flags, 20);
fMergeCell = GETBIT(flags, 21);
iReadingOrder = static_cast<unsigned char>(GETBITS(flags, 22, 23));
alc = static_cast<unsigned char>(GETBITS(flags, 0, 2));
fWrap = GETBIT(flags, 3);
alcv = static_cast<unsigned char>(GETBITS(flags, 4, 6));
fJustLast = GETBIT(flags, 7);
trot = static_cast<unsigned char>(GETBITS(flags, 8, 15));
cIndent = static_cast<unsigned char>(GETBITS(flags, 16, 19));
fShrinkToFit = GETBIT(flags, 20);
fMergeCell = GETBIT(flags, 21);
iReadingOrder = static_cast<unsigned char>(GETBITS(flags, 22, 23));
record >> iIndent;
}
int DXFALC::serialize(std::wostream & stream)
{
if (parent->iReadingOrderNinch && parent->alchNinch && parent->alcvNinch && parent->wrapNinch &&
parent->trotNinch && parent->kintoNinch && parent->cIndentNinch && parent->fShrinkNinch &&
parent->fMergeCellNinch ) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"alignment")
{
if (!parent->iReadingOrderNinch)
{
CP_XML_ATTR(L"readingOrder", iReadingOrder);
}
if (!parent->alchNinch && alc != 0xFF)
{
switch(alc)
{
case 0: CP_XML_ATTR(L"horizontal", L"general"); break;
case 1: CP_XML_ATTR(L"horizontal", L"left"); break;
case 2: CP_XML_ATTR(L"horizontal", L"center"); break;
case 3: CP_XML_ATTR(L"horizontal", L"right"); break;
case 4: CP_XML_ATTR(L"horizontal", L"fill"); break;
case 5: CP_XML_ATTR(L"horizontal", L"justify"); break;
case 6: CP_XML_ATTR(L"horizontal", L"centerContinuous");break;
case 7: CP_XML_ATTR(L"horizontal", L"distributed"); break;
}
}
if (!parent->alcvNinch)
{
switch(alcv)
{
case 0: CP_XML_ATTR(L"vertical", L"top"); break;
case 1: CP_XML_ATTR(L"vertical", L"center"); break;
case 2: CP_XML_ATTR(L"vertical", L"bottom"); break;
case 3: CP_XML_ATTR(L"vertical", L"justify"); break;
case 4: CP_XML_ATTR(L"vertical", L"distributed");break;
}
}
if (!parent->trotNinch)
{
CP_XML_ATTR(L"textRotation", trot);
}
if (!parent->wrapNinch)
{
CP_XML_ATTR(L"wrapText", fWrap);
}
if (!parent->cIndentNinch)
{
CP_XML_ATTR(L"indent", cIndent);
CP_XML_ATTR(L"relativeIndent", iIndent);
}
if (!parent->kintoNinch)
{
CP_XML_ATTR(L"justifyLastLine", fJustLast);
}
if (!parent->fShrinkNinch)
{
CP_XML_ATTR(L"shrinkToFit", fShrinkToFit);
}
}
}
return 0;
}
} // namespace XLS
......@@ -6,6 +6,7 @@ namespace XLS
{
class CFRecord;
class DXFN;
class DXFALC : public BiffStructure
{
......@@ -18,6 +19,8 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
int serialize(std::wostream & stream);
unsigned char alc;
bool fWrap;
unsigned char alcv;
......@@ -29,6 +32,8 @@ public:
unsigned char iReadingOrder;
_UINT32 iIndent;
//------------------------------------------------
DXFN *parent;
};
} // namespace XLS
......
#include "DXFBdr.h"
#include "DXFN.h"
#include <Binary/CFRecord.h>
namespace XLS
{
BiffStructurePtr DXFBdr::clone()
{
return BiffStructurePtr(new DXFBdr(*this));
}
//void DXFBdr::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"dgLeft", dgLeft);
// xml_tag->setAttribute(L"dgRight", dgRight);
// xml_tag->setAttribute(L"dgTop", dgTop);
// xml_tag->setAttribute(L"dgBottom", dgBottom);
// xml_tag->setAttribute(L"icvLeft", icvLeft);
// xml_tag->setAttribute(L"icvRight", icvRight);
// xml_tag->setAttribute(L"bitDiagDown", bitDiagDown);
// xml_tag->setAttribute(L"bitDiagUp", bitDiagUp);
//
// xml_tag->setAttribute(L"icvTop", icvTop);
// xml_tag->setAttribute(L"icvBottom", icvBottom);
// xml_tag->setAttribute(L"icvDiag", icvDiag);
// xml_tag->setAttribute(L"dgDiag", dgDiag);
//}
//
//
//void DXFBdr::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// dgLeft = getStructAttribute(xml_tag, L"dgLeft");
// dgRight = getStructAttribute(xml_tag, L"dgRight");
// dgTop = getStructAttribute(xml_tag, L"dgTop");
// dgBottom = getStructAttribute(xml_tag, L"dgBottom");
// icvLeft = getStructAttribute(xml_tag, L"icvLeft");
// icvRight = getStructAttribute(xml_tag, L"icvRight");
// bitDiagDown = getStructAttribute(xml_tag, L"bitDiagDown");
// bitDiagUp = getStructAttribute(xml_tag, L"bitDiagUp");
//
// icvTop = getStructAttribute(xml_tag, L"icvTop");
// icvBottom = getStructAttribute(xml_tag, L"icvBottom");
// icvDiag = getStructAttribute(xml_tag, L"icvDiag");
// dgDiag = getStructAttribute(xml_tag, L"dgDiag");
//}
//
//
void DXFBdr::store(CFRecord& record)
{
_UINT32 flags = 0;
......@@ -60,6 +23,7 @@ void DXFBdr::store(CFRecord& record)
SETBITS(flags, 23, 29, icvRight);
SETBIT(flags, 30, bitDiagDown);
SETBIT(flags, 31, bitDiagUp);
record << flags;
_UINT32 flags2 = 0;
......@@ -68,6 +32,7 @@ void DXFBdr::store(CFRecord& record)
SETBITS(flags2, 7, 13, icvBottom);
SETBITS(flags2, 14, 20, icvDiag);
SETBITS(flags2, 21, 24, dgDiag);
record << flags2;
}
......@@ -77,22 +42,85 @@ void DXFBdr::load(CFRecord& record)
_UINT32 flags;
record >> flags;
dgLeft = static_cast<unsigned char>(GETBITS(flags, 0, 3));
dgRight = static_cast<unsigned char>(GETBITS(flags, 4, 7));
dgTop = static_cast<unsigned char>(GETBITS(flags, 8, 11));
dgBottom = static_cast<unsigned char>(GETBITS(flags, 12, 15));
icvLeft = static_cast<unsigned char>(GETBITS(flags, 16, 22));
icvRight = static_cast<unsigned char>(GETBITS(flags, 23, 29));
dgLeft = static_cast<unsigned char>(GETBITS(flags, 0, 3));
dgRight = static_cast<unsigned char>(GETBITS(flags, 4, 7));
dgTop = static_cast<unsigned char>(GETBITS(flags, 8, 11));
dgBottom = static_cast<unsigned char>(GETBITS(flags, 12, 15));
icvLeft = static_cast<unsigned char>(GETBITS(flags, 16, 22));
icvRight = static_cast<unsigned char>(GETBITS(flags, 23, 29));
bitDiagDown = GETBIT(flags, 30);
bitDiagUp = GETBIT(flags, 31);
bitDiagUp = GETBIT(flags, 31);
record >> flags;
icvTop = static_cast<unsigned char>(GETBITS(flags, 0, 6));
icvBottom = static_cast<unsigned char>(GETBITS(flags, 7, 13));
icvDiag = static_cast<unsigned char>(GETBITS(flags, 14, 20));
dgDiag = static_cast<unsigned char>(GETBITS(flags, 21, 24));
icvTop = static_cast<unsigned char>(GETBITS(flags, 0, 6));
icvBottom = static_cast<unsigned char>(GETBITS(flags, 7, 13));
icvDiag = static_cast<unsigned char>(GETBITS(flags, 14, 20));
dgDiag = static_cast<unsigned char>(GETBITS(flags, 21, 24));
}
void serialize_one(std::wostream & stream, const std::wstring & name, unsigned char type, unsigned char color)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(name)
{
switch(type)
{
case 0: CP_XML_ATTR(L"style", L"none"); break;
case 1: CP_XML_ATTR(L"style", L"thin"); break;
case 2: CP_XML_ATTR(L"style", L"medium"); break;
case 3: CP_XML_ATTR(L"style", L"dashed"); break;
case 4: CP_XML_ATTR(L"style", L"dotted"); break;
case 5: CP_XML_ATTR(L"style", L"thick"); break;
case 6: CP_XML_ATTR(L"style", L"double"); break;
case 7: CP_XML_ATTR(L"style", L"hair"); break;
case 8: CP_XML_ATTR(L"style", L"mediumDashed"); break;
case 9: CP_XML_ATTR(L"style", L"dashDot"); break;
case 10: CP_XML_ATTR(L"style", L"mediumDashDot"); break;
case 11: CP_XML_ATTR(L"style", L"dashDotDot"); break;
case 12: CP_XML_ATTR(L"style", L"mediumDashDotDot");break;
case 13: CP_XML_ATTR(L"style", L"slantDashDot"); break;
}
if (type != 0)
{
CP_XML_NODE(L"color")
{
CP_XML_ATTR(L"indexed", color);
}
}
}
}
}
int DXFBdr::serialize(std::wostream & stream)
{
if (parent->glTopNinch && parent->glBottomNinch && parent->glLeftNinch && parent->glRightNinch &&
parent->glDiagDownNinch && parent->glDiagUpNinch) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"border")
{
if (!parent->glTopNinch)
serialize_one(CP_XML_STREAM(), L"top", dgTop, icvTop);
if (!parent->glBottomNinch)
serialize_one(CP_XML_STREAM(), L"bottom", dgBottom, icvBottom);
if (!parent->glLeftNinch)
serialize_one(CP_XML_STREAM(), L"left", dgLeft, icvLeft);
if (!parent->glRightNinch)
serialize_one(CP_XML_STREAM(), L"right", dgRight, icvRight);
if (!parent->glDiagDownNinch || !parent->glDiagUpNinch)
serialize_one(CP_XML_STREAM(), L"diagonal", dgDiag, icvDiag);
}
}
return 0;
}
......
......@@ -7,6 +7,7 @@ namespace XLS
class CFRecord;
class DXFN;
class DXFBdr : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(DXFBdr)
......@@ -18,12 +19,15 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
int serialize(std::wostream & stream);
unsigned char dgLeft;
unsigned char dgRight;
unsigned char dgTop;
unsigned char dgBottom;
unsigned char icvLeft;
unsigned char icvRight;
bool bitDiagDown;
bool bitDiagUp;
......@@ -32,6 +36,10 @@ public:
unsigned char icvDiag;
unsigned char dgDiag;
//------------------------------------------------
DXFN *parent;
};
} // namespace XLS
......
#include "DXFFntD.h"
#include "DXFN.h"
#include <Binary/CFRecord.h>
namespace XLS
......@@ -11,43 +11,6 @@ BiffStructurePtr DXFFntD::clone()
return BiffStructurePtr(new DXFFntD(*this));
}
//void DXFFntD::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"stFontName", stFontName);
// stxp.toXML(xml_tag);
// xml_tag->setAttribute(L"icvFore", icvFore);
// xml_tag->setAttribute(L"ftsItalic", Boolean<unsigned char>(tsNinch.ftsItalic));
// xml_tag->setAttribute(L"ftsStrikeout", Boolean<unsigned char>(tsNinch.ftsStrikeout));
// xml_tag->setAttribute(L"fSssNinch", fSssNinch);
// xml_tag->setAttribute(L"fUlsNinch", fUlsNinch);
// xml_tag->setAttribute(L"fBlsNinch", fBlsNinch);
// xml_tag->setAttribute(L"ich", ich);
// xml_tag->setAttribute(L"cch", cch);
// xml_tag->setAttribute(L"iFnt", iFnt);
//}
//
//
//void DXFFntD::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// stFontName = static_cast<std::wstring >(getStructAttribute(xml_tag, L"stFontName"));
// stxp.fromXML(xml_tag);
// icvFore = getStructAttribute(xml_tag, L"icvFore");
// Boolean<unsigned char> tsNinch_ftsItalic;
// tsNinch_ftsItalic.fromXML(xml_tag, L"ftsItalic");
// tsNinch.ftsItalic = tsNinch_ftsItalic;
// Boolean<unsigned char> tsNinch_ftsStrikeout;
// tsNinch_ftsStrikeout.fromXML(xml_tag, L"ftsStrikeout");
// tsNinch.ftsStrikeout = tsNinch_ftsStrikeout;
// fSssNinch.fromXML(xml_tag, L"fSssNinch");
// fUlsNinch.fromXML(xml_tag, L"fUlsNinch");
// fBlsNinch.fromXML(xml_tag, L"fBlsNinch");
// ich = getStructAttribute(xml_tag, L"ich");
// cch = getStructAttribute(xml_tag, L"cch");
// iFnt = getStructAttribute(xml_tag, L"iFnt");
//}
//
//
void DXFFntD::store(CFRecord& record)
{
unsigned char cchFont = stFontName.getSize();
......@@ -91,6 +54,103 @@ void DXFFntD::load(CFRecord& record)
record >> ich >> cch >> iFnt;
}
int DXFFntD::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"font")
{
if (!stFontName.value().empty())
{
CP_XML_NODE(L"name")
{
CP_XML_ATTR(L"val", stFontName.value());
}
}
if (stxp.twpHeight != 0)
{
CP_XML_NODE(L"sz")
{
CP_XML_ATTR(L"val", stxp.twpHeight/20);
}
}
if (icvFore < 0x7fff)
{
CP_XML_NODE(L"color")
{
CP_XML_ATTR(L"indexed", icvFore);
}
}
CP_XML_NODE(L"charset")
{
CP_XML_ATTR(L"val", stxp.bCharSet);
}
//CP_XML_NODE(L"condense")
//{
// CP_XML_ATTR(L"val", 1);
//}
//CP_XML_NODE(L"extend")
//{
// CP_XML_ATTR(L"val", stxp.fExtend);
//}
CP_XML_NODE(L"family")
{
CP_XML_ATTR(L"val", stxp.bFamily);
}
if (tsNinch.ftsItalic == 0)
{
CP_XML_NODE(L"i")
{
CP_XML_ATTR(L"val", stxp.ts.ftsItalic);
}
}
if (fBlsNinch == 0)
{
CP_XML_NODE(L"b")
{
CP_XML_ATTR(L"val", stxp.bls == 700 ? 1 : 0);
}
}
if (tsNinch.ftsStrikeout == 0)
{
CP_XML_NODE(L"strike")
{
CP_XML_ATTR(L"val", stxp.ts.ftsStrikeout);
}
}
if (fUlsNinch == 0)
{
CP_XML_NODE(L"u")
{
switch(stxp.uls)
{
case 0: CP_XML_ATTR(L"val", L"none"); break;
case 1: CP_XML_ATTR(L"val", L"single"); break;
case 2: CP_XML_ATTR(L"val", L"double"); break;
case 33: CP_XML_ATTR(L"val", L"singleAccounting");break;
case 34: CP_XML_ATTR(L"val", L"doubleAccounting");break;
}
}
}
if (fSssNinch == 0)
{
CP_XML_NODE(L"vertAlign")
{
switch(stxp.sss)
{
case 0: CP_XML_ATTR(L"val", L"baseline"); break;
case 1: CP_XML_ATTR(L"val", L"superscript");break;
case 2: CP_XML_ATTR(L"val", L"subscript"); break;
}
}
}
}
}
return 0;
}
} // namespace XLS
......@@ -7,8 +7,8 @@
namespace XLS
{
class CFRecord;
class DXFN;
class DXFFntD : public BiffStructure
{
......@@ -21,19 +21,25 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
int serialize(std::wostream & stream);
XLUnicodeStringNoCch stFontName;
Stxp stxp;
_INT32 icvFore;
Ts tsNinch;
Ts tsNinch;
_UINT32 fSssNinch;
_UINT32 fUlsNinch;
_UINT32 fBlsNinch;
_INT32 ich;
_INT32 cch;
_INT32 ich;
_INT32 cch;
_UINT16 iFnt;
//------------------------------------------------
DXFN *parent;
};
} // namespace XLS
......
......@@ -11,130 +11,6 @@ BiffStructurePtr DXFN::clone()
return BiffStructurePtr(new DXFN(*this));
}
//void DXFN::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"alchNinch", alchNinch);
// xml_tag->setAttribute(L"alcvNinch", alcvNinch);
// xml_tag->setAttribute(L"wrapNinch", wrapNinch);
// xml_tag->setAttribute(L"trotNinch", trotNinch);
// xml_tag->setAttribute(L"kintoNinch", kintoNinch);
// xml_tag->setAttribute(L"cIndentNinch", cIndentNinch);
// xml_tag->setAttribute(L"fShrinkNinch", fShrinkNinch);
// xml_tag->setAttribute(L"fMergeCellNinch", fMergeCellNinch);
// xml_tag->setAttribute(L"lockedNinch", lockedNinch);
// xml_tag->setAttribute(L"hiddenNinch", hiddenNinch);
// xml_tag->setAttribute(L"glLeftNinch", glLeftNinch);
// xml_tag->setAttribute(L"glRightNinch", glRightNinch);
// xml_tag->setAttribute(L"glTopNinch", glTopNinch);
// xml_tag->setAttribute(L"glBottomNinch", glBottomNinch);
// xml_tag->setAttribute(L"glDiagDownNinch", glDiagDownNinch);
// xml_tag->setAttribute(L"glDiagUpNinch", glDiagUpNinch);
// xml_tag->setAttribute(L"flsNinch", flsNinch);
// xml_tag->setAttribute(L"icvFNinch", icvFNinch);
// xml_tag->setAttribute(L"icvBNinch", icvBNinch);
// xml_tag->setAttribute(L"ifmtNinch", ifmtNinch);
// xml_tag->setAttribute(L"fIfntNinch", fIfntNinch);
// xml_tag->setAttribute(L"ibitAtrNum", ibitAtrNum);
// xml_tag->setAttribute(L"ibitAtrFnt", ibitAtrFnt);
// xml_tag->setAttribute(L"ibitAtrAlc", ibitAtrAlc);
// xml_tag->setAttribute(L"ibitAtrBdr", ibitAtrBdr);
// xml_tag->setAttribute(L"ibitAtrPat", ibitAtrPat);
// xml_tag->setAttribute(L"ibitAtrProt", ibitAtrProt);
// xml_tag->setAttribute(L"iReadingOrderNinch", iReadingOrderNinch);
// xml_tag->setAttribute(L"fIfmtUser", fIfmtUser);
// xml_tag->setAttribute(L"fNewBorder", fNewBorder);
// xml_tag->setAttribute(L"fZeroInited", fZeroInited);
//
// if(ibitAtrNum)
// {
// dxfnum.toXML(xml_tag);
// }
// if(ibitAtrFnt)
// {
// dxffntd.toXML(xml_tag);
// }
// if(ibitAtrAlc)
// {
// dxfalc.toXML(xml_tag);
// }
// if(ibitAtrBdr)
// {
// dxfbdr.toXML(xml_tag);
// }
// if(ibitAtrPat)
// {
// dxfpat.toXML(xml_tag);
// }
// if(ibitAtrProt)
// {
// dxfprot.toXML(xml_tag);
// }
//}
//
//
//void DXFN::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// alchNinch = getStructAttribute(xml_tag, L"alchNinch");
// alcvNinch = getStructAttribute(xml_tag, L"alcvNinch");
// wrapNinch = getStructAttribute(xml_tag, L"wrapNinch");
// trotNinch = getStructAttribute(xml_tag, L"trotNinch");
// kintoNinch = getStructAttribute(xml_tag, L"kintoNinch");
// cIndentNinch = getStructAttribute(xml_tag, L"cIndentNinch");
// fShrinkNinch = getStructAttribute(xml_tag, L"fShrinkNinch");
// fMergeCellNinch = getStructAttribute(xml_tag, L"fMergeCellNinch");
// lockedNinch = getStructAttribute(xml_tag, L"lockedNinch");
// hiddenNinch = getStructAttribute(xml_tag, L"hiddenNinch");
// glLeftNinch = getStructAttribute(xml_tag, L"glLeftNinch");
// glRightNinch = getStructAttribute(xml_tag, L"glRightNinch");
// glTopNinch = getStructAttribute(xml_tag, L"glTopNinch");
// glBottomNinch = getStructAttribute(xml_tag, L"glBottomNinch");
// glDiagDownNinch = getStructAttribute(xml_tag, L"glDiagDownNinch");
// glDiagUpNinch = getStructAttribute(xml_tag, L"glDiagUpNinch");
// flsNinch = getStructAttribute(xml_tag, L"flsNinch");
// icvFNinch = getStructAttribute(xml_tag, L"icvFNinch");
// icvBNinch = getStructAttribute(xml_tag, L"icvBNinch");
// ifmtNinch = getStructAttribute(xml_tag, L"ifmtNinch");
// fIfntNinch = getStructAttribute(xml_tag, L"fIfntNinch");
// ibitAtrNum = getStructAttribute(xml_tag, L"ibitAtrNum");
// ibitAtrFnt = getStructAttribute(xml_tag, L"ibitAtrFnt");
// ibitAtrAlc = getStructAttribute(xml_tag, L"ibitAtrAlc");
// ibitAtrBdr = getStructAttribute(xml_tag, L"ibitAtrBdr");
// ibitAtrPat = getStructAttribute(xml_tag, L"ibitAtrPat");
// ibitAtrProt = getStructAttribute(xml_tag, L"ibitAtrProt");
// iReadingOrderNinch = getStructAttribute(xml_tag, L"iReadingOrderNinch");
// fIfmtUser = getStructAttribute(xml_tag, L"fIfmtUser");
// fNewBorder = getStructAttribute(xml_tag, L"fNewBorder");
// fZeroInited = getStructAttribute(xml_tag, L"fZeroInited");
//
// if(ibitAtrNum)
// {
// dxfnum.setIsUserDefined(fIfmtUser);
// dxfnum.fromXML(xml_tag);
// }
// if(ibitAtrFnt)
// {
// dxffntd.fromXML(xml_tag);
// }
// if(ibitAtrAlc)
// {
// dxfalc.fromXML(xml_tag);
// }
// if(ibitAtrBdr)
// {
// dxfbdr.fromXML(xml_tag);
// }
// if(ibitAtrPat)
// {
// dxfpat.fromXML(xml_tag);
// }
// if(ibitAtrProt)
// {
// dxfprot.fromXML(xml_tag);
// }
//}
//
//
void DXFN::store(CFRecord& record)
{
_UINT32 flags = 0;
......@@ -204,41 +80,51 @@ void DXFN::store(CFRecord& record)
void DXFN::load(CFRecord& record)
{
dxfnum.parent = dxffntd.parent = dxfalc.parent = dxfbdr.parent = dxfpat.parent = dxfprot.parent = this;
//---------------------------------------------------
_UINT32 flags;
record >> flags;
alchNinch = GETBIT(flags, 0);
alcvNinch = GETBIT(flags, 1);
wrapNinch = GETBIT(flags, 2);
trotNinch = GETBIT(flags, 3);
kintoNinch = GETBIT(flags, 4);
cIndentNinch = GETBIT(flags, 5);
fShrinkNinch = GETBIT(flags, 6);
alchNinch = GETBIT(flags, 0);
alcvNinch = GETBIT(flags, 1);
wrapNinch = GETBIT(flags, 2);
trotNinch = GETBIT(flags, 3);
kintoNinch = GETBIT(flags, 4);
cIndentNinch = GETBIT(flags, 5);
fShrinkNinch = GETBIT(flags, 6);
fMergeCellNinch = GETBIT(flags, 7);
lockedNinch = GETBIT(flags, 8);
hiddenNinch = GETBIT(flags, 9);
glLeftNinch = GETBIT(flags, 10);
glRightNinch = GETBIT(flags, 11);
glTopNinch = GETBIT(flags, 12);
glBottomNinch = GETBIT(flags, 13);
lockedNinch = GETBIT(flags, 8);
hiddenNinch = GETBIT(flags, 9);
glLeftNinch = GETBIT(flags, 10);
glRightNinch = GETBIT(flags, 11);
glTopNinch = GETBIT(flags, 12);
glBottomNinch = GETBIT(flags, 13);
glDiagDownNinch = GETBIT(flags, 14);
glDiagUpNinch = GETBIT(flags, 15);
flsNinch = GETBIT(flags, 16);
icvFNinch = GETBIT(flags, 17);
icvBNinch = GETBIT(flags, 18);
ifmtNinch = GETBIT(flags, 19);
fIfntNinch = GETBIT(flags, 20);
ibitAtrNum = GETBIT(flags, 25);
ibitAtrFnt = GETBIT(flags, 26);
ibitAtrAlc = GETBIT(flags, 27);
ibitAtrBdr = GETBIT(flags, 28);
ibitAtrPat = GETBIT(flags, 29);
ibitAtrProt = GETBIT(flags, 30);
glDiagUpNinch = GETBIT(flags, 15);
flsNinch = GETBIT(flags, 16);
icvFNinch = GETBIT(flags, 17);
icvBNinch = GETBIT(flags, 18);
ifmtNinch = GETBIT(flags, 19);
fIfntNinch = GETBIT(flags, 20);
ibitAtrNum = GETBIT(flags, 25);
ibitAtrFnt = GETBIT(flags, 26);
ibitAtrAlc = GETBIT(flags, 27);
ibitAtrBdr = GETBIT(flags, 28);
ibitAtrPat = GETBIT(flags, 29);
ibitAtrProt = GETBIT(flags, 30);
iReadingOrderNinch = GETBIT(flags, 31);
unsigned short flags2;
record >> flags2;
fIfmtUser = GETBIT(flags2, 0);
fNewBorder = GETBIT(flags2, 2);
fIfmtUser = GETBIT(flags2, 0);
fNewBorder = GETBIT(flags2, 2);
fZeroInited = GETBIT(flags2, 15);
if(ibitAtrNum)
......@@ -268,6 +154,41 @@ void DXFN::load(CFRecord& record)
}
}
int DXFN::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"dxf")
{
if(ibitAtrFnt)
{
dxffntd.serialize(CP_XML_STREAM());
}
if(ibitAtrNum)
{
dxfnum.serialize(CP_XML_STREAM());
}
if(ibitAtrPat)
{
dxfpat.serialize(CP_XML_STREAM());
}
if(ibitAtrAlc)
{
dxfalc.serialize(CP_XML_STREAM());
}
if(ibitAtrBdr)
{
dxfbdr.serialize(CP_XML_STREAM());
}
if(ibitAtrProt)
{
dxfprot.serialize(CP_XML_STREAM());
}
}
}
return 0;
}
} // namespace XLS
#pragma once
#include "BiffStructure.h"
#include "DXFNum.h"
#include "DXFFntD.h"
#include "DXFALC.h"
......@@ -8,6 +9,8 @@
#include "DXFPat.h"
#include "DXFProt.h"
#include <simple_xml_writer.h>
namespace XLS
{
......@@ -24,43 +27,51 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
int serialize(std::wostream & stream);
bool alchNinch;
bool alcvNinch;
bool wrapNinch;
bool trotNinch;
bool kintoNinch;
bool cIndentNinch;
bool fShrinkNinch;
bool fMergeCellNinch;
bool lockedNinch;
bool hiddenNinch;
bool glLeftNinch;
bool glRightNinch;
bool glTopNinch;
bool glBottomNinch;
bool glDiagDownNinch;
bool glDiagUpNinch;
bool flsNinch;
bool icvFNinch;
bool icvBNinch;
bool ifmtNinch;
bool fIfntNinch;
bool ibitAtrNum;
bool ibitAtrFnt;
bool ibitAtrAlc;
bool ibitAtrBdr;
bool ibitAtrPat;
bool ibitAtrProt;
bool iReadingOrderNinch;
bool fIfmtUser;
bool fNewBorder;
bool fZeroInited;
DXFNum dxfnum;
DXFNum dxfnum;
DXFFntD dxffntd;
DXFALC dxfalc;
DXFBdr dxfbdr;
DXFPat dxfpat;
DXFALC dxfalc;
DXFBdr dxfbdr;
DXFPat dxfpat;
DXFProt dxfprot;
};
......
......@@ -11,35 +11,6 @@ BiffStructurePtr DXFN12::clone()
return BiffStructurePtr(new DXFN12(*this));
}
//void DXFN12::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// if(cbDxf)
// {
// dxfn->toXML(xml_tag);
// if(xfext)
// {
// xfext->toXML(xml_tag);
// }
// }
//}
//void DXFN12::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// DXFNPtr dxfn_temp(new DXFN);
// if(dxfn_temp->fromXML(xml_tag))
// {
// std::swap(dxfn, dxfn_temp);
// XFExtNoFRTPtr xfext_temp(new XFExtNoFRT);
// if(xfext_temp->fromXML(xml_tag))
// {
// std::swap(xfext, xfext_temp);
// }
// }
//}
void DXFN12::store(CFRecord& record)
{
if(dxfn)
......@@ -64,11 +35,14 @@ void DXFN12::store(CFRecord& record)
void DXFN12::load(CFRecord& record)
{
record >> cbDxf;
if(cbDxf)
{
const size_t end_of_struct_pos = record.getRdPtr() + cbDxf;
dxfn = DXFNPtr(new DXFN);
record >> *dxfn;
if(record.getRdPtr() < end_of_struct_pos)
{
xfext = XFExtNoFRTPtr(new XFExtNoFRT);
......@@ -81,6 +55,26 @@ void DXFN12::load(CFRecord& record)
}
}
int DXFN12::serialize(std::wostream & stream)
{
if (dxfn && !xfext)
{
dxfn->serialize(stream);
}
else
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"dxf")
{
if (xfext)
{
}
}
}
}
return 0;
}
} // namespace XLS
......@@ -20,6 +20,8 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
int serialize(std::wostream & stream);
_UINT32 cbDxf;
DXFNPtr dxfn;
XFExtNoFRTPtr xfext;
......
#include "DXFNum.h"
#include "DXFN.h"
#include <Binary/CFRecord.h>
//#include <Exception/StructureParameterNotSet.h>
namespace XLS
{
......@@ -25,32 +25,6 @@ BiffStructurePtr DXFNum::clone()
}
//void DXFNum::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// if(is_user_defined_)
// {
// user_defined.toXML(xml_tag);
// }
// else
// {
// xml_tag->setAttribute(L"ifmt", fmt_id.ifmt);
// }
//}
//void DXFNum::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// if(is_user_defined_)
// {
// user_defined.fromXML(xml_tag);
// }
// else
// {
// fmt_id.ifmt = getStructAttribute(xml_tag, L"ifmt");
// }
//}
void DXFNum::store(CFRecord& record)
{
if(is_user_defined_)
......@@ -77,5 +51,24 @@ void DXFNum::load(CFRecord& record)
}
int DXFNum::serialize(std::wostream & stream)
{
if (parent->ifmtNinch && parent->fIfmtUser) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"numFmt")
{
if (!parent->ifmtNinch)
CP_XML_ATTR(L"numFmtId", fmt_id.ifmt);
if (!parent->fIfmtUser)
CP_XML_ATTR(L"formatCode", user_defined.fmt.value());
}
}
return 0;
}
} // namespace XLS
......@@ -6,8 +6,8 @@
namespace XLS
{
class CFRecord;
class DXFN;
class DXFNum : public BiffStructure
{
......@@ -20,13 +20,19 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
void setIsUserDefined(const bool is_user_defined);
const bool getIsUserDefined() const;
int serialize(std::wostream & stream);
void setIsUserDefined(const bool is_user_defined);
const bool getIsUserDefined() const;
_CP_OPT(bool) is_user_defined_;
DXFNumIFmt fmt_id;
DXFNumUsr user_defined;
//------------------------------------------------
DXFN *parent;
};
} // namespace XLS
......
#include "DXFPat.h"
#include "DXFN.h"
#include <Binary/CFRecord.h>
namespace XLS
{
......@@ -11,23 +12,6 @@ BiffStructurePtr DXFPat::clone()
return BiffStructurePtr(new DXFPat(*this));
}
//void DXFPat::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"fls", fls);
// xml_tag->setAttribute(L"icvForeground", icvForeground);
// xml_tag->setAttribute(L"icvBackground", icvBackground);
//}
//
//
//void DXFPat::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// fls = getStructAttribute(xml_tag, L"fls");
// icvForeground = getStructAttribute(xml_tag, L"icvForeground");
// icvBackground = getStructAttribute(xml_tag, L"icvBackground");
//}
void DXFPat::store(CFRecord& record)
{
unsigned short flags = 0;
......@@ -44,12 +28,69 @@ void DXFPat::load(CFRecord& record)
{
unsigned short flags;
record >> flags;
fls = GETBITS(flags, 10, 15);
record >> flags;
icvForeground = GETBITS(flags, 0, 6);
icvBackground = GETBITS(flags, 7, 13);
}
int DXFPat::serialize(std::wostream & stream)
{
if (parent->flsNinch && parent->icvBNinch && parent->icvFNinch) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"fill")
{
CP_XML_NODE(L"patternFill")
{
if (!parent->flsNinch)
{
switch(fls)
{
case 2: CP_XML_ATTR(L"patternType", L"pct50"); break; //50% gray
case 3: CP_XML_ATTR(L"patternType", L"pct75"); break; //75% gray
case 4: CP_XML_ATTR(L"patternType", L"pct25"); break; //25% gray
case 5: CP_XML_ATTR(L"patternType", L"horzStripe"); break; //Horizontal stripe
case 6: CP_XML_ATTR(L"patternType", L"vertStripe"); break; //Vertical stripe
case 7: CP_XML_ATTR(L"patternType", L"reverseDiagStripe"); break; //Reverse diagonal stripe
case 8: CP_XML_ATTR(L"patternType", L"diagStripe"); break; //Diagonal stripe
case 9: CP_XML_ATTR(L"patternType", L"diagCross"); break; //Diagonal crosshatch
case 10: CP_XML_ATTR(L"patternType", L"trellis"); break; //Thick Diagonal crosshatch
case 11: CP_XML_ATTR(L"patternType", L"thinHorzStripe"); break; //Thin horizontal stripe
case 12: CP_XML_ATTR(L"patternType", L"thinVertStripe"); break; //Thin vertical stripe
case 13: CP_XML_ATTR(L"patternType", L"thinReverseDiagStripe"); break; //Thin reverse diagonal stripe
case 14: CP_XML_ATTR(L"patternType", L"thinDiagStripe"); break; //Thin diagonal stripe
case 15: CP_XML_ATTR(L"patternType", L"thinHorzCross"); break; //Thin horizontal crosshatch
case 16: CP_XML_ATTR(L"patternType", L"thinDiagCross"); break; //Thin diagonal crosshatch
case 17: CP_XML_ATTR(L"patternType", L"gray125"); break; //12.5% gray
case 18: CP_XML_ATTR(L"patternType", L"gray0625"); break; //6.25% gray
}
}
if (!parent->icvBNinch)
{
CP_XML_NODE(L"bgColor")
{
CP_XML_ATTR(L"indexed", icvBackground);
}
}
if (!parent->icvFNinch)
{
CP_XML_NODE(L"fgColor")
{
CP_XML_ATTR(L"indexed", icvForeground);
}
}
}
}
}
return 0;
}
} // namespace XLS
......@@ -5,8 +5,8 @@
namespace XLS
{
class CFRecord;
class DXFN;
class DXFPat : public BiffStructure
{
......@@ -19,9 +19,14 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
int serialize(std::wostream & stream);
FillPattern fls;
unsigned char icvForeground;
unsigned char icvBackground;
//------------------------------------------------
DXFN *parent;
};
} // namespace XLS
......
#include "DXFProt.h"
#include "DXFN.h"
#include <Binary/CFRecord.h>
namespace XLS
{
BiffStructurePtr DXFProt::clone()
{
return BiffStructurePtr(new DXFProt(*this));
}
//void DXFProt::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"fLocked", fLocked);
// xml_tag->setAttribute(L"fHidden", fHidden);
//}
//
//
//void DXFProt::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// fLocked = getStructAttribute(xml_tag, L"fLocked");
// fHidden = getStructAttribute(xml_tag, L"fHidden");
//}
void DXFProt::store(CFRecord& record)
{
unsigned short flags = 0;
......@@ -40,10 +24,28 @@ void DXFProt::load(CFRecord& record)
{
unsigned short flags;
record >> flags;
fLocked = GETBIT(flags, 0);
fHidden = GETBIT(flags, 1);
}
int DXFProt::serialize(std::wostream & stream)
{
if (parent->lockedNinch && parent->hiddenNinch) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"protect")
{
if (!parent->lockedNinch)
CP_XML_ATTR(L"locked", fLocked);
if (!parent->hiddenNinch )
CP_XML_ATTR(L"hidden", fHidden);
}
}
return 0;
}
} // namespace XLS
......@@ -4,8 +4,8 @@
namespace XLS
{
class CFRecord;
class DXFN;
class DXFProt : public BiffStructure
{
......@@ -18,8 +18,12 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
int serialize(std::wostream & stream);
bool fLocked;
bool fHidden;
//------------------------------------------------
DXFN *parent;
};
} // namespace XLS
......
......@@ -4,7 +4,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
BiffStructurePtr RkRec::clone()
{
......@@ -19,6 +18,8 @@ void RkRec::store(CFRecord& record)
void RkRec::load(CFRecord& record)
{
global_info_ = record.getGlobalWorkbookInfo();
record >> ixfe >> RK_;
}
......
......@@ -21,8 +21,9 @@ public:
const unsigned short get_ixfe() const;
unsigned short ixfe;
RkNumber RK_;
GlobalWorkbookInfoPtr global_info_;
unsigned short ixfe;
RkNumber RK_;
};
typedef boost::shared_ptr<RkRec> RkRecPtr;
......
......@@ -23,6 +23,7 @@ public:
Ts ts;
short bls;
short sss;
unsigned char uls;
unsigned char bFamily;
unsigned char bCharSet;
......
......@@ -6,6 +6,7 @@
#include "XFPropGradientStop.h"
#include "XFPropBorder.h"
#include "BiffString.h"
#include <Logic/Biff_structures/BitMarkedStructs.h>
namespace XLS
......@@ -110,6 +111,154 @@ void XFProp::load(CFRecord& record)
}
record >> *xfPropDataBlob;
}
static void serialize_color_prop(std::wostream & stream, const std::wstring & name, BiffStructurePtr & val)
{
if (name.empty()) return;
XFPropColor * color = dynamic_cast<XFPropColor*>(val.get());
if (!color) return;
color->node_name = name;
color->serialize(stream);
}
static void serialize_val_prop(std::wostream & stream, const std::wstring & name, BiffStructurePtr & val)
{
if (val == NULL) return;
if (name.empty()) return;
CP_XML_WRITER(stream)
{
CP_XML_NODE(name)
{
BIFF_DWORD * dword = dynamic_cast<BIFF_DWORD*>(val.get());
if (dword) CP_XML_ATTR(L"val", dword->value());
BIFF_WORD * word = dynamic_cast<BIFF_WORD*>(val.get());
if (word) CP_XML_ATTR(L"val", word->value());
BIFF_BYTE * byte_ = dynamic_cast<BIFF_BYTE*>(val.get());
if (byte_) CP_XML_ATTR(L"val", byte_->value());
LPWideString * str_ = dynamic_cast<LPWideString*>(val.get());
if (str_) CP_XML_ATTR(L"val", str_->value());
}
}
}
static void serialize_border_prop(std::wostream & stream, const std::wstring & name, BiffStructurePtr & val)
{
if (name.empty()) return;
XFPropBorder * border = dynamic_cast<XFPropBorder*>(val.get());
if (!border) return;
CP_XML_WRITER(stream)
{
CP_XML_NODE(name)
{
switch(border->dgBorder)
{
case 0: CP_XML_ATTR(L"style", L"none"); break;
case 1: CP_XML_ATTR(L"style", L"thin"); break;
case 2: CP_XML_ATTR(L"style", L"medium"); break;
case 3: CP_XML_ATTR(L"style", L"dashed"); break;
case 4: CP_XML_ATTR(L"style", L"dotted"); break;
case 5: CP_XML_ATTR(L"style", L"thick"); break;
case 6: CP_XML_ATTR(L"style", L"double"); break;
case 7: CP_XML_ATTR(L"style", L"hair"); break;
case 8: CP_XML_ATTR(L"style", L"mediumDashed"); break;
case 9: CP_XML_ATTR(L"style", L"dashDot"); break;
case 10: CP_XML_ATTR(L"style", L"mediumDashDot"); break;
case 11: CP_XML_ATTR(L"style", L"dashDotDot"); break;
case 12: CP_XML_ATTR(L"style", L"mediumDashDotDot");break;
case 13: CP_XML_ATTR(L"style", L"slantDashDot"); break;
}
if (border->dgBorder != 0)
{
border->color.serialize(CP_XML_STREAM());
}
}
}
}
void XFProp::serialize_attr(CP_ATTR_NODE)
{
if (xfPropType == 0)
{
BIFF_BYTE * byte_ = dynamic_cast<BIFF_BYTE*>(xfPropDataBlob.get());
if (!byte_) return;
switch(*byte_)
{
case 2: CP_XML_ATTR(L"patternType", L"pct50"); break; //50% gray
case 3: CP_XML_ATTR(L"patternType", L"pct75"); break; //75% gray
case 4: CP_XML_ATTR(L"patternType", L"pct25"); break; //25% gray
case 5: CP_XML_ATTR(L"patternType", L"horzStripe"); break; //Horizontal stripe
case 6: CP_XML_ATTR(L"patternType", L"vertStripe"); break; //Vertical stripe
case 7: CP_XML_ATTR(L"patternType", L"reverseDiagStripe"); break; //Reverse diagonal stripe
case 8: CP_XML_ATTR(L"patternType", L"diagStripe"); break; //Diagonal stripe
case 9: CP_XML_ATTR(L"patternType", L"diagCross"); break; //Diagonal crosshatch
case 10: CP_XML_ATTR(L"patternType", L"trellis"); break; //Thick Diagonal crosshatch
case 11: CP_XML_ATTR(L"patternType", L"thinHorzStripe"); break; //Thin horizontal stripe
case 12: CP_XML_ATTR(L"patternType", L"thinVertStripe"); break; //Thin vertical stripe
case 13: CP_XML_ATTR(L"patternType", L"thinReverseDiagStripe"); break; //Thin reverse diagonal stripe
case 14: CP_XML_ATTR(L"patternType", L"thinDiagStripe"); break; //Thin diagonal stripe
case 15: CP_XML_ATTR(L"patternType", L"thinHorzCross"); break; //Thin horizontal crosshatch
case 16: CP_XML_ATTR(L"patternType", L"thinDiagCross"); break; //Thin diagonal crosshatch
case 17: CP_XML_ATTR(L"patternType", L"gray125"); break; //12.5% gray
case 18: CP_XML_ATTR(L"patternType", L"gray0625"); break; //6.25% gray
}
}
if (xfPropType == 3)
{
XFPropGradient * grad_ = dynamic_cast<XFPropGradient*>(xfPropDataBlob.get());
if (grad_) grad_->serialize_attr(CP_GET_XML_NODE());
}
}
int XFProp::serialize(std::wostream & stream)
{
switch(xfPropType)
{
case 0x0001: serialize_color_prop(stream, L"fgColor", xfPropDataBlob); break;
case 0x0002: serialize_color_prop(stream, L"bgColor", xfPropDataBlob); break;
case 0x0005: serialize_color_prop(stream, L"color", xfPropDataBlob); break;
case 0x0006: serialize_border_prop(stream, L"top", xfPropDataBlob); break;
case 0x0007: serialize_border_prop(stream, L"bottom", xfPropDataBlob); break;
case 0x0008: serialize_border_prop(stream, L"left", xfPropDataBlob); break;
case 0x0009: serialize_border_prop(stream, L"right", xfPropDataBlob); break;
case 0x000A: serialize_border_prop(stream, L"diagonal", xfPropDataBlob); break;
case 0x000B: serialize_border_prop(stream, L"vertical", xfPropDataBlob); break;
case 0x000C: serialize_border_prop(stream, L"horizontal",xfPropDataBlob); break;
case 0x000D: serialize_val_prop (stream, L"diagonalDown", xfPropDataBlob); break;
case 0x000E: serialize_val_prop (stream, L"diagonalUp", xfPropDataBlob); break;
case 0x000F: serialize_val_prop (stream, L"horizontal", xfPropDataBlob); break;
case 0x0010: serialize_val_prop (stream, L"vertical", xfPropDataBlob); break;
case 0x0011: serialize_val_prop (stream, L"textRotation", xfPropDataBlob); break;
case 0x0013: serialize_val_prop (stream, L"readingOrder", xfPropDataBlob); break;
case 0x0014: serialize_val_prop (stream, L"wrapText", xfPropDataBlob); break;
case 0x0015: serialize_val_prop (stream, L"justifyLastLine", xfPropDataBlob); break;
case 0x0016: serialize_val_prop (stream, L"shrinkToFit", xfPropDataBlob); break;
case 0x0018: serialize_val_prop (stream, L"name", xfPropDataBlob); break;
case 0x0019: serialize_val_prop (stream, L"b", xfPropDataBlob); break;
case 0x001A: serialize_val_prop (stream, L"u", xfPropDataBlob); break;
case 0x001B: serialize_val_prop (stream, L"vertAlign", xfPropDataBlob); break;
case 0x001C: serialize_val_prop (stream, L"i", xfPropDataBlob); break;
case 0x001D: serialize_val_prop (stream, L"strike", xfPropDataBlob); break;
case 0x001E: serialize_val_prop (stream, L"outline", xfPropDataBlob); break;
case 0x001F: serialize_val_prop (stream, L"shadow", xfPropDataBlob); break;
case 0x0020: serialize_val_prop (stream, L"condense", xfPropDataBlob); break;
case 0x0021: serialize_val_prop (stream, L"extend", xfPropDataBlob); break;
case 0x0022: serialize_val_prop (stream, L"charset", xfPropDataBlob); break;
case 0x0023: serialize_val_prop (stream, L"family", xfPropDataBlob); break;
case 0x0024: serialize_val_prop (stream, L"sz", xfPropDataBlob); break;
case 0x0025: serialize_val_prop (stream, L"scheme", xfPropDataBlob); break;
case 0x0026: serialize_val_prop (stream, L"formatCode", xfPropDataBlob); break;
case 0x0029: serialize_val_prop (stream, L"numFmtId", xfPropDataBlob); break;
case 0x002A: serialize_val_prop (stream, L"relativeIndent", xfPropDataBlob); break;
case 0x002B: serialize_val_prop (stream, L"locked", xfPropDataBlob); break;
case 0x002C: serialize_val_prop (stream, L"hidden", xfPropDataBlob); break;
}
return 0;
}
} // namespace XLS
......@@ -4,6 +4,8 @@
#include <Logic/Biff_structures/FullColorExt.h>
#include <Logic/Biff_structures/XFExtGradient.h>
#include <simple_xml_writer.h>
namespace XLS
{
......@@ -20,9 +22,12 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
unsigned short xfPropType;
unsigned short cb;
BiffStructurePtr xfPropDataBlob;
int serialize(std::wostream & stream);
void serialize_attr(CP_ATTR_NODE);
unsigned short xfPropType;
unsigned short cb;
BiffStructurePtr xfPropDataBlob;
};
} // namespace XLS
......@@ -19,10 +19,8 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
private:
XFPropColor color;
unsigned short dgBorder;
XFPropColor color;
unsigned short dgBorder;
};
//#pragma pack() // restore
} // namespace XLS
......@@ -2,6 +2,8 @@
#include "XFPropColor.h"
#include <Binary/CFRecord.h>
#include <simple_xml_writer.h>
namespace XLS
{
......@@ -22,12 +24,40 @@ void XFPropColor::store(CFRecord& record)
void XFPropColor::load(CFRecord& record)
{
node_name = L"color";
unsigned char flags;
record >> flags;
fValidRGBA = GETBIT(flags, 0);
xclrType = GETBITS(flags, 1, 7);
fValidRGBA = GETBIT(flags, 0);
xclrType = GETBITS(flags, 1, 7);
record >> icv >> nTintShade >> dwRgba;
}
int XFPropColor::serialize(std::wostream & stream)
{
if (xclrType > 3 )return 0;//not set
CP_XML_WRITER(stream)
{
CP_XML_NODE(node_name)
{
switch(xclrType)
{
case 0: CP_XML_ATTR(L"auto", 1); break;
case 1: CP_XML_ATTR(L"indexed", icv); break;
case 2: CP_XML_ATTR(L"rgb", dwRgba.strRGB); break;
case 3: CP_XML_ATTR(L"theme", icv); break;
}
if (nTintShade != 0)
{
CP_XML_ATTR(L"tint", nTintShade);
}
}
}
return 0;
}
} // namespace XLS
......@@ -19,11 +19,17 @@ public:
static const ElementType type = typeXFPropColor;
bool fValidRGBA;
unsigned char xclrType;
unsigned char icv;
short nTintShade;
LongRGBA dwRgba;
int serialize(std::wostream & stream);
bool fValidRGBA;
unsigned char xclrType;
unsigned char icv;
short nTintShade;
LongRGBA dwRgba;
//-------------------------------------------
std::wstring node_name;
};
} // namespace XLS
......@@ -22,11 +22,33 @@ void XFPropGradient::store(CFRecord& record)
void XFPropGradient::load(CFRecord& record)
{
_UINT32 temp;
record >> temp >> numDegree >> numFillToLeft >> numFillToRight >>
numFillToTop >> numFillToBottom;
record >> temp >> numDegree >> numFillToLeft >> numFillToRight >> numFillToTop >> numFillToBottom;
type1 = temp;
}
void XFPropGradient::serialize_attr(CP_ATTR_NODE)
{
//<xsl:if test="$gradient/@type = 'true'"> <!-- Default is 'linear' -->
// <xsl:attribute name="type">path</xsl:attribute>
// </xsl:if>
// <xsl:if test="$gradient/@numDegree != 0"> <!-- Default is 0 -->
// <xsl:attribute name="degree"><xsl:value-of select="$gradient/@numDegree"/></xsl:attribute>
// </xsl:if>
// <xsl:if test="$gradient/@numFillToLeft != 0"> <!-- Default is 0 -->
// <xsl:attribute name="left"><xsl:value-of select="$gradient/@numFillToLeft"/></xsl:attribute>
// </xsl:if>
// <xsl:if test="$gradient/@numFillToRight != 0"> <!-- Default is 0 -->
// <xsl:attribute name="right"><xsl:value-of select="$gradient/@numFillToRight"/></xsl:attribute>
// </xsl:if>
// <xsl:if test="$gradient/@numFillToTop != 0"> <!-- Default is 0 -->
// <xsl:attribute name="top"><xsl:value-of select="$gradient/@numFillToTop"/></xsl:attribute>
// </xsl:if>
// <xsl:if test="$gradient/@numFillToBottom != 0"> <!-- Default is 0 -->
// <xsl:attribute name="bottom"><xsl:value-of select="$gradient/@numFillToBottom"/></xsl:attribute>
// </xsl:if>
}
} // namespace XLS
......@@ -3,6 +3,8 @@
#include "BiffStructure.h"
#include "Boolean.h"
#include <simple_xml_writer.h>
namespace XLS
{
......@@ -13,11 +15,14 @@ class XFPropGradient : public BiffStructure
BASE_STRUCTURE_DEFINE_CLASS_NAME(XFPropGradient)
public:
BiffStructurePtr clone();
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
static const ElementType type = typeXFPropGradient;
void serialize_attr(CP_ATTR_NODE);
bool type1;
double numDegree;
......
......@@ -2,6 +2,8 @@
#include "XFPropGradientStop.h"
#include <Binary/CFRecord.h>
#include <simple_xml_writer.h>
namespace XLS
{
......@@ -27,4 +29,19 @@ void XFPropGradientStop::load(CFRecord& record)
}
int XFPropGradientStop::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"stop")
{
CP_XML_ATTR(L"position", numPosition);
color.serialize(CP_XML_STREAM());
}
}
return 0;
}
} // namespace XLS
......@@ -19,7 +19,9 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
double numPosition;
int serialize(std::wostream & stream);
double numPosition;
XFPropColor color;
};
......
......@@ -25,13 +25,109 @@ void XFProps::load(CFRecord& record)
{
record.skipNunBytes(2); // reserved
record >> cprops;
for(int i = 0; i < cprops; ++i)
{
XFProp prop;
record >> prop;
xfPropArray.push_back(prop);
if (prop.xfPropType >= 0 && prop.xfPropType <= 3) arXFPropFill.push_back(prop);
else if (prop.xfPropType == 4) arXFPropGradient.push_back(prop);
else if (prop.xfPropType >= 6 && prop.xfPropType <= 14) arXFPropBorder.push_back(prop);
else if (prop.xfPropType >= 15 && prop.xfPropType <= 22 || prop.xfPropType == 42) arXFPropAlignment.push_back(prop);
else if (prop.xfPropType >= 24 && prop.xfPropType <= 37 || prop.xfPropType == 5) arXFPropFont.push_back(prop);
else if (prop.xfPropType >= 38 && prop.xfPropType <= 41) arXFPropNumFmt.push_back(prop);
else if (prop.xfPropType >= 43 && prop.xfPropType <= 44) arXFPropProtection.push_back(prop);
}
}
int XFProps::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
if (arXFPropFont.size() > 0)
{
CP_XML_NODE(L"font")
{
for (int i = 0; i < arXFPropFont.size(); i++)
{
arXFPropFont[i].serialize(CP_XML_STREAM());
}
}
}
if (arXFPropNumFmt.size() > 0)
{
CP_XML_NODE(L"numFmt")
{
for (int i = 0; i < arXFPropNumFmt.size(); i++)
{
arXFPropNumFmt[i].serialize(CP_XML_STREAM());
}
}
}
if (arXFPropFill.size() > 0)
{
XFProp pPatternType;
XFPropGradient *pGradient = NULL;
for (int i = 0; i < arXFPropFill.size(); i++)
{
switch(arXFPropFill[i].xfPropType)
{
case 0: pPatternType = arXFPropFill[i]; break;
case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i].xfPropDataBlob.get()); break;
}
}
CP_XML_NODE(L"fill")
{
if (pGradient || arXFPropGradient.size()>0)
{
CP_XML_NODE(L"gradientFill")
{
if (pGradient)
pGradient->serialize_attr(CP_GET_XML_NODE());
for (int i = 0 ; i < arXFPropGradient.size(); i++)
{
if (arXFPropGradient[i].xfPropDataBlob == NULL) continue;
arXFPropGradient[i].xfPropDataBlob->serialize(CP_XML_STREAM());
}
}
}
else
{
CP_XML_NODE(L"patternFill")
{
pPatternType.serialize_attr(CP_GET_XML_NODE());
for (int i = 0; i < arXFPropFill.size(); i++)
{
arXFPropFill[i].serialize(CP_XML_STREAM());
}
}
}
}
}
if (arXFPropAlignment.size() > 0)
{
CP_XML_NODE(L"alignment")
{
for (int i = 0; i < arXFPropAlignment.size(); i++)
{
arXFPropAlignment[i].serialize(CP_XML_STREAM());
}
}
}
if (arXFPropBorder.size() > 0)
{
CP_XML_NODE(L"border")
{
for (int i = 0; i < arXFPropBorder.size(); i++)
{
arXFPropBorder[i].serialize(CP_XML_STREAM());
}
}
}
}
return 0;
}
} // namespace XLS
......@@ -19,8 +19,20 @@ public:
static const ElementType type = typeXFProps;
unsigned short cprops;
std::vector<XFProp> xfPropArray;
unsigned short cprops;
int serialize(std::wostream & stream);
std::vector<XFProp> arXFPropFont;
std::vector<XFProp> arXFPropNumFmt;
std::vector<XFProp> arXFPropFill;
std::vector<XFProp> arXFPropAlignment;
std::vector<XFProp> arXFPropBorder;
std::vector<XFProp> arXFPropProtection;
std::vector<XFProp> arXFPropGradient;
//-----------------------------------------------------
bool fNewBorder;
};
} // namespace XLS
......@@ -10,7 +10,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
// This class is made a deriver of CompositeObject intentionally.
// This is an optimization step - to form a CELLTABLE that is divided into smaller groups
class CELL_GROUP : public CompositeObject
......@@ -29,7 +28,7 @@ public:
const bool loadContent(BinProcessor& proc)
{
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
global_info_ = proc.getGlobalWorkbookInfo();
int count, count_row = 0;
......@@ -44,7 +43,7 @@ public:
{
if (row->miyRw.value())
{
global_info->customRowsHeight.insert(std::pair<int, double>(row->rw,row->miyRw / 20.));
global_info_->customRowsHeight.insert(std::pair<int, double>(row->rw,row->miyRw / 20.));
}
}
m_rows.insert(m_rows.begin(), elements_.back());
......@@ -77,6 +76,8 @@ public:
private:
std::vector<CellRangeRef>& shared_formulas_locations_ref_;
GlobalWorkbookInfoPtr global_info_;
};
......@@ -170,9 +171,9 @@ int CELL_GROUP::serialize(std::wostream & stream)
if (row->ixfe_val && xf_set)
{
if (row->ixfe_val > cellStyleXfs_count)
if (row->ixfe_val > global_info_->cellStyleXfs_count)
{
CP_XML_ATTR(L"s", row->ixfe_val - cellStyleXfs_count);
CP_XML_ATTR(L"s", row->ixfe_val - global_info_->cellStyleXfs_count);
}
else
{
......@@ -251,9 +252,9 @@ int CELL_GROUP::serialize(std::wostream & stream)
if (row->ixfe_val.value() && xf_set)
{
if (row->ixfe_val > cellStyleXfs_count)
if (row->ixfe_val > global_info_->cellStyleXfs_count)
{
CP_XML_ATTR(L"s", row->ixfe_val - cellStyleXfs_count);
CP_XML_ATTR(L"s", row->ixfe_val - global_info_->cellStyleXfs_count);
}
else
{
......
......@@ -6,7 +6,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
COLUMNS::COLUMNS()
{
......@@ -27,7 +26,7 @@ BaseObjectPtr COLUMNS::clone()
// COLUMNS = DefColWidth *255ColInfo
const bool COLUMNS::loadContent(BinProcessor& proc)
{
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
global_info_ = proc.getGlobalWorkbookInfo();
bool def_ok = proc.optional<DefColWidth>();
// OpenOffice Calc stored files workaround (DefColWidth is mandatory according to [MS-XLS])
......@@ -49,7 +48,7 @@ const bool COLUMNS::loadContent(BinProcessor& proc)
{
if (column_info->coldx.value())
{
global_info->customColumnsWidth.insert(std::pair<int, double>(i,column_info->coldx / 256.));
global_info_->customColumnsWidth.insert(std::pair<int, double>(i,column_info->coldx / 256.));
}
}
......@@ -84,9 +83,9 @@ int COLUMNS::serialize(std::wostream & stream)
if (column_info->colLast.value())
CP_XML_ATTR(L"max", column_info->colLast + 1);
if ((column_info->ixfe.value()) && (column_info->ixfe > cellStyleXfs_count))
if ((column_info->ixfe.value()) && (column_info->ixfe > global_info_->cellStyleXfs_count))
{
CP_XML_ATTR(L"style", column_info->ixfe - cellStyleXfs_count);
CP_XML_ATTR(L"style", column_info->ixfe - global_info_->cellStyleXfs_count);
}
if (column_info->fBestFit)
......
......@@ -23,6 +23,8 @@ public:
static const ElementType type = typeCOLUMNS;
BaseObjectPtr m_DefColWidth;
GlobalWorkbookInfoPtr global_info_;
};
} // namespace XLS
......
......@@ -19,6 +19,11 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeCONDFMT;
int serialize(std::wostream & stream);
BaseObjectPtr m_CondFmt;
std::vector<BaseObjectPtr> m_arCF;
};
} // namespace XLS
......
......@@ -19,6 +19,11 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeCONDFMT12;
int serialize(std::wostream & stream);
BaseObjectPtr m_CondFmt12;
std::vector<BaseObjectPtr> m_arCF12;
};
} // namespace XLS
......
......@@ -31,6 +31,8 @@ const bool CONDFMT12::loadContent(BinProcessor& proc)
{
return false;
}
m_CondFmt12 = elements_.back();
elements_.pop_back();
/* The above is equal to:
if(!proc.mandatory<CondFmt12>())
......@@ -52,12 +54,38 @@ const bool CONDFMT12::loadContent(BinProcessor& proc)
}
}
while(!elements_.empty())
{
m_arCF12.push_back(elements_.front());
elements_.pop_front();
}
/* The above is equal to:
proc.repeated<CF12>(1, 0);
*/
return true;
}
int CONDFMT12::serialize(std::wostream & stream)
{
if (!m_CondFmt12) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"conditionalFormatting")
{
CondFmt12 * condFmt = dynamic_cast<CondFmt12*>(m_CondFmt12.get());
CP_XML_ATTR(L"sqref", condFmt->mainCF.sqref.sqref);
//condition_id
//condition_pos
for (int i = 0; i < m_arCF12.size(); i++)
{
if (m_arCF12[i] == NULL) continue;
m_arCF12[i]->serialize(CP_XML_STREAM());
}
}
}
return 0;
}
} // namespace XLS
......@@ -66,10 +66,40 @@ BaseObjectPtr CONDFMTS::clone()
// CONDFMTS = *(CONDFMT / CONDFMT12) *(CFEx [CF12])
const bool CONDFMTS::loadContent(BinProcessor& proc)
{
bool res1 = proc.repeated<Parenthesis_CONDFMTS_1>(0, 0);
bool res2 = proc.repeated<Parenthesis_CONDFMTS_2>(0, 0);
return res1 || res2;
bool res = false;
int count = proc.repeated<Parenthesis_CONDFMTS_1>(0, 0);
if (count > 0) res = true;
while(count > 0)
{
m_arCONDFMT.insert(m_arCONDFMT.begin(), elements_.back());
elements_.pop_back();
count--;
}
count = proc.repeated<Parenthesis_CONDFMTS_2>(0, 0);
if (count > 0) res = true;
while(count > 0)
{
m_arCFEx.insert(m_arCFEx.begin(), elements_.back());
elements_.pop_back();
count--;
}
return res;
}
int CONDFMTS::serialize(std::wostream & stream)
{
if (m_arCONDFMT.empty()) return 0;
for (int i = 0 ; i < m_arCONDFMT.size(); i++)
{
if (!m_arCONDFMT[i]) continue;
m_arCONDFMT[i]->serialize(stream);
}
return 0;
}
} // namespace XLS
......@@ -19,6 +19,11 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeCONDFMTS;
int serialize(std::wostream & stream);
std::vector<BaseObjectPtr> m_arCONDFMT; //CONDFMT or CONDFMT12
std::vector<BaseObjectPtr> m_arCFEx;
};
} // namespace XLS
......
......@@ -31,6 +31,8 @@ const bool CONDFMT::loadContent(BinProcessor& proc)
{
return false;
}
m_CondFmt = elements_.back();
elements_.pop_back();
/* The above is equal to:
if(!proc.mandatory<CondFmt>())
......@@ -40,13 +42,24 @@ const bool CONDFMT::loadContent(BinProcessor& proc)
*/
{
CF cf1(cond_fmt.getLocation());
proc.optional(cf1);
if (proc.optional(cf1))
{
m_arCF.push_back( elements_.back());
elements_.pop_back();
}
CF cf2(cond_fmt.getLocation());
if(proc.optional(cf2))
{
m_arCF.push_back( elements_.back());
elements_.pop_back();
CF cf3(cond_fmt.getLocation());
proc.optional(cf3);
if (proc.optional(cf3))
{
m_arCF.push_back( elements_.back());
elements_.pop_back();
}
}
}
/* The above is equal to:
......@@ -54,6 +67,28 @@ const bool CONDFMT::loadContent(BinProcessor& proc)
*/
return true;
}
int CONDFMT::serialize(std::wostream & stream)
{
if (!m_CondFmt) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"conditionalFormatting")
{
CondFmt * condFmt = dynamic_cast<CondFmt*>(m_CondFmt.get());
CP_XML_ATTR(L"sqref", condFmt->sqref.sqref);
//condition_id
//condition_pos
for (int i = 0; i < m_arCF.size(); i++)
{
if (m_arCF[i] == NULL) continue;
m_arCF[i]->serialize(CP_XML_STREAM());
}
}
}
return 0;
}
} // namespace XLS
......@@ -68,8 +68,15 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
m_XFS = elements_.back();
elements_.pop_back();
}
proc.repeated<DXF>(0, 0);
count = proc.repeated<DXF>(0, 0);
while(count > 0)
{
m_arDXF.insert(m_arDXF.begin(), elements_.back());
elements_.pop_back();
count--;
}
global_info->cellStyleDxfs_count = m_arDXF.size(); // +
//----------------------------------------------------------------------------------------------------
if (proc.optional<STYLES>())
{
......@@ -146,6 +153,22 @@ int FORMATTING::serialize2(std::wostream & stream)
{
m_Styles->serialize(stream);
}
if (m_arDXF.size() > 0)
{
CP_XML_NODE(L"dxfs")
{
CP_XML_ATTR(L"count", global_info->cellStyleDxfs_count);
for (int i = 0 ; i < m_arDXF.size(); i++)
{
m_arDXF[i]->serialize(CP_XML_STREAM());
}
CP_XML_STREAM() << global_info->users_Dxfs_stream.str();
}
}
// tableStyles
if (m_Palette)
{
CP_XML_NODE(L"colors")
......
......@@ -29,6 +29,7 @@ public:
std::vector<BaseObjectPtr> m_arFonts;
BaseObjectPtr m_Palette;
BaseObjectPtr m_ClrtClient;
std::vector<BaseObjectPtr> m_arDXF;
GlobalWorkbookInfoPtr global_info;
......
......@@ -35,7 +35,8 @@ public:
std::vector<CellRangeRef>& shared_formulas_locations_ref_;
int m_sharedIndex;
int m_sharedIndex;
GlobalWorkbookInfoPtr m_global_info;
};
} // namespace XLS
......
......@@ -14,8 +14,6 @@
namespace XLS
{
extern int cellStyleXfs_count;
FORMULA::FORMULA(std::vector<CellRangeRef>& shared_formulas_locations_ref) : shared_formulas_locations_ref_(shared_formulas_locations_ref)
{
m_sharedIndex = -1;
......@@ -36,6 +34,8 @@ BaseObjectPtr FORMULA::clone()
// FORMULA = [Uncalced] Formula [Array / Table / ShrFmla / SUB] [String *Continue]
const bool FORMULA::loadContent(BinProcessor& proc)
{
m_global_info = proc.getGlobalWorkbookInfo();
proc.optional<Uncalced>();
Formula *formula = NULL;
......@@ -114,9 +114,9 @@ int FORMULA::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"r", ref);
if ((formula->cell.ixfe.value()) && (formula->cell.ixfe > cellStyleXfs_count))
if ((formula->cell.ixfe.value()) && (formula->cell.ixfe > m_global_info->cellStyleXfs_count))
{
CP_XML_ATTR(L"s", formula->cell.ixfe - cellStyleXfs_count);
CP_XML_ATTR(L"s", formula->cell.ixfe - m_global_info->cellStyleXfs_count);
}
switch (formula->val.getType())
{
......
......@@ -86,9 +86,9 @@ int STYLES::serialize(std::wostream & stream)
}
}
for (int i = 0; i < styleExt->xfProps.xfPropArray.size(); i++)
{
}
// for (int i = 0; i < styleExt->xfProps.xfPropArray.size(); i++)
//{
//}
}
else
{
......
......@@ -9,7 +9,6 @@
namespace XLS
{
int cellStyleXfs_count = 0;
XFS::XFS()
: cell_xf_current_id(0), style_xf_current_id(0)
......@@ -33,7 +32,7 @@ const bool XFS::loadContent(BinProcessor& proc)
{
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
cellStyleXfs_count = 0;
global_info->cellStyleXfs_count = 0;
XF xf(cell_xf_current_id, style_xf_current_id);
int count = proc.repeated(xf ,16, 0);
......@@ -46,7 +45,7 @@ const bool XFS::loadContent(BinProcessor& proc)
if (xfs->fStyle)
{
m_arCellStyles.push_back(elements_.front());
cellStyleXfs_count++;
global_info->cellStyleXfs_count++;
}
else
{
......@@ -120,9 +119,9 @@ const bool XFS::loadContent(BinProcessor& proc)
{
XF *xfs = dynamic_cast<XF*>(m_arCellXFs[i].get());
if (m_arXFext.size() > cellStyleXfs_count + i)
if (m_arXFext.size() > global_info->cellStyleXfs_count + i)
{
XFExt*ext = dynamic_cast<XFExt*>(m_arXFext[i + cellStyleXfs_count].get());
XFExt*ext = dynamic_cast<XFExt*>(m_arXFext[i + global_info->cellStyleXfs_count].get());
if (ext)
{
xfs->cell.ext_props = ext->rgExt;
......
......@@ -20,6 +20,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
startAddedSharedStrings = 0;
current_sheet = 0;
cmt_rules = 0;
}
......
......@@ -72,9 +72,15 @@ public:
double defaultColumnWidth;
double defaultRowHeight;
int cmt_rules;
int Version;
int cellStyleXfs_count;
int cellStyleDxfs_count;
std::wstringstream users_Dxfs_stream;
XlsConverter *xls_converter;
};
......
......@@ -75,6 +75,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
global_info->defaultColumnWidth = 8;
global_info->defaultRowHeight = 14.4;
global_info->cmt_rules = 0;
int count = 0;
......
......@@ -329,6 +329,11 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
sheet->m_SORTANDFILTER->serialize(xlsx_context->current_sheet().sheetSortAndFilters());
}
if (sheet->m_CONDFMTS)
{
sheet->m_CONDFMTS->serialize(xlsx_context->current_sheet().conditionalFormatting());
}
convert((XLS::OBJECTS*)sheet->m_OBJECTS.get());
......
......@@ -26,6 +26,7 @@ public:
std::wstringstream pageProperties_;
std::wstringstream sortAndFilters_;
std::wstringstream customViews_;
std::wstringstream conditionalFormatting_;
rels hyperlinks_rels_;
......@@ -112,6 +113,11 @@ std::wostream & xlsx_xml_worksheet::customViews()
{
return impl_->customViews_;
}
std::wostream & xlsx_xml_worksheet::conditionalFormatting()
{
return impl_->conditionalFormatting_;
}
//-----------------------------------------------------------------
rels & xlsx_xml_worksheet::hyperlinks_rels()
{
......@@ -148,9 +154,11 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->hyperlinks_.str();
CP_XML_STREAM() << impl_->sortAndFilters_.str();
CP_XML_STREAM() << impl_->customViews_.str();
CP_XML_STREAM() << impl_->conditionalFormatting_.str();
CP_XML_STREAM() << impl_->pageProperties_.str();
CP_XML_STREAM() << impl_->drawing_.str();
......
......@@ -35,6 +35,7 @@ public:
std::wostream & sheetSortAndFilters();
std::wostream & pageProperties();
std::wostream & customViews();
std::wostream & conditionalFormatting();
rels & hyperlinks_rels();
......
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