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

XlsFile2 - формулы, именованные диапазоны

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63719 954022d7-b5bf-4e40-9824-e11837661b57
parent 973b6d5c
......@@ -43,8 +43,19 @@ void BkHim::readFields(CFRecord& record)
unsigned int sz = record.getDataSize() - record.getRdPtr();
if (cf == 0x09)
{
//bitmap
}
else
{
//native
}
//imageBlob
if (record.checkFitReadSafe(lcb))
{
record.skipNunBytes(lcb);
}
}
......
......@@ -73,15 +73,15 @@ int Font::serialize(std::wostream & stream)
{
CP_XML_NODE(L"charset")
{
CP_XML_ATTR(L"val", *bCharSet.value());
CP_XML_ATTR(L"val", bCharSet);
}
}
if (icv.value())
if ((icv.value()) && (icv < 0x7fff) )
{
CP_XML_NODE(L"color")
{
CP_XML_ATTR(L"indexed", *icv.value());
CP_XML_ATTR(L"indexed", icv);
}
}
......@@ -93,11 +93,11 @@ int Font::serialize(std::wostream & stream)
}
}
if ((fExtend.value()) && (*fExtend.value()))
if ((fExtend.value()) && (fExtend))
{
CP_XML_NODE(L"extend")
{
CP_XML_ATTR(L"val", (int)(*fExtend.value()));
CP_XML_ATTR(L"val", fExtend);
}
}
......@@ -105,15 +105,15 @@ int Font::serialize(std::wostream & stream)
{
CP_XML_NODE(L"family")
{
CP_XML_ATTR(L"val", (int)(*bFamily.value()));
CP_XML_ATTR(L"val", bFamily);
}
}
if ((fItalic.value()) && (*fItalic.value()))
if ((fItalic.value()) && (fItalic))
{
CP_XML_NODE(L"i")
{
CP_XML_ATTR(L"val", (int)(*fItalic.value()));
CP_XML_ATTR(L"val", fItalic);
}
}
......@@ -125,11 +125,11 @@ int Font::serialize(std::wostream & stream)
}
}
if (fOutline.value())
if ((fOutline.value()) && (fOutline))
{
CP_XML_NODE(L"outline")
{
CP_XML_ATTR(L"val", (int)(*fOutline.value()));
CP_XML_ATTR(L"val", fOutline);
}
}
......@@ -141,19 +141,19 @@ int Font::serialize(std::wostream & stream)
// }
//}
if ((fShadow.value()) && (*fShadow.value()))
if ((fShadow.value()) && (fShadow))
{
CP_XML_NODE(L"shadow")
{
CP_XML_ATTR(L"val", (int)(*fShadow.value()));
CP_XML_ATTR(L"val", fShadow);
}
}
if ((fStrikeOut.value()) && (*fStrikeOut.value()))
if ((fStrikeOut.value()) && (fStrikeOut))
{
CP_XML_NODE(L"strike")
{
CP_XML_ATTR(L"val", (int)(*fStrikeOut.value()));
CP_XML_ATTR(L"val", fStrikeOut);
}
}
......@@ -161,7 +161,7 @@ int Font::serialize(std::wostream & stream)
{
CP_XML_NODE(L"sz")
{
CP_XML_ATTR(L"val", *dyHeight.value()/20);
CP_XML_ATTR(L"val", dyHeight/20);
}
}
......@@ -169,7 +169,7 @@ int Font::serialize(std::wostream & stream)
{
CP_XML_NODE(L"u")
{
switch(*uls.value())
switch(uls)
{
case 1: CP_XML_ATTR(L"val", "single");break;
case 2: CP_XML_ATTR(L"val", "double");break;
......
......@@ -43,23 +43,6 @@ public:
BIFF_BSTR Name;
NameParsedFormula rgce;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(fHidden)
//BO_ATTRIB_MARKUP_ATTRIB(fFunc)
//BO_ATTRIB_MARKUP_ATTRIB(fOB)
//BO_ATTRIB_MARKUP_ATTRIB(fProc)
//BO_ATTRIB_MARKUP_ATTRIB(fCalcExp)
//BO_ATTRIB_MARKUP_ATTRIB(fBuiltin)
//BO_ATTRIB_MARKUP_ATTRIB(fGrp)
//BO_ATTRIB_MARKUP_ATTRIB(fPublished)
//BO_ATTRIB_MARKUP_ATTRIB(fWorkbookParam)
//BO_ATTRIB_MARKUP_ATTRIB(chKey)
//BO_ATTRIB_MARKUP_ATTRIB(itab)
//BO_ATTRIB_MARKUP_ATTRIB(Name)
//BO_ATTRIB_MARKUP_COMPLEX(rgce)
//BO_ATTRIB_MARKUP_END
};
} // namespace XLS
......
......@@ -64,15 +64,20 @@ int MulRk::serialize(std::wostream & stream)
for (long i = 0; i < cells.size(); i++)
{
Cell * cell = dynamic_cast<Cell *>(cells[i].get());
RkRec * rkrec = dynamic_cast<RkRec *>(rgrkrec[i].get());
std::wstring ref = cell->getLocation().toString();// getColRowRef(i, row);
CP_XML_NODE(L"c")
{
CP_XML_ATTR(L"r", ref);
if (cell->ixfe.value())
if ((cell->ixfe.value()) && (cell->ixfe > cellStyleXfs_count))
{
CP_XML_ATTR(L"s", *(cell->ixfe.value()) - cellStyleXfs_count);
CP_XML_ATTR(L"s", cell->ixfe - cellStyleXfs_count);
}
CP_XML_NODE(L"v")
{
CP_XML_STREAM() << rkrec->RK_.value();
}
}
}
......
......@@ -50,7 +50,7 @@ void ExtPtgArea3D::load(CFRecord& record)
}
void ExtPtgArea3D::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void ExtPtgArea3D::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
#pragma message("####################### ExtPtgArea3D record is not implemented")
Log::info("ExtPtgArea3D record is not implemented.");
......
......@@ -16,14 +16,11 @@ public:
ExtPtgArea3D(const CellRef& cell_base_ref_init);
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
ExtSheetPair iTabs;
RgceAreaRel area;
const CellRef& cell_base_ref;
......
......@@ -44,7 +44,7 @@ void ExtPtgAreaErr3D::load(CFRecord& record)
}
void ExtPtgAreaErr3D::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void ExtPtgAreaErr3D::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
#pragma message("####################### ExtPtgAreaErr3D record is not implemented")
Log::info("ExtPtgAreaErr3D record is not implemented.");
......
......@@ -14,14 +14,11 @@ class ExtPtgAreaErr3D : public Ptg
public:
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
ExtSheetPair iTabs;
};
......
......@@ -40,7 +40,7 @@ void ExtPtgErr::load(CFRecord& record)
}
void ExtPtgErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void ExtPtgErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(err.toString());
}
......
......@@ -14,14 +14,11 @@ class ExtPtgErr : public Ptg
public:
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
BErr err;
};
......
......@@ -48,7 +48,7 @@ void ExtPtgRef3D::load(CFRecord& record)
}
void ExtPtgRef3D::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void ExtPtgRef3D::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
#pragma message("####################### ExtPtgRef3D record is not implemented")
Log::info("ExtPtgRef3D record is not implemented.");
......
......@@ -15,14 +15,11 @@ public:
ExtPtgRef3D(const CellRef& cell_base_ref_init);
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
ExtSheetPair iTabs;
RgceLocRel loc;
const CellRef& cell_base_ref;
......
......@@ -44,7 +44,7 @@ void ExtPtgRefErr3D::load(CFRecord& record)
}
void ExtPtgRefErr3D::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void ExtPtgRefErr3D::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
#pragma message("####################### ExtPtgRefErr3D record is not implemented")
Log::info("ExtPtgRefErr3D record is not implemented.");
......
......@@ -14,14 +14,11 @@ class ExtPtgRefErr3D : public Ptg
public:
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
ExtSheetPair iTabs;
};
......
......@@ -13,82 +13,41 @@ BiffStructurePtr FormulaValue::clone()
}
//void FormulaValue::toXML(BiffStructurePtr & parent, const std::wstring & attrib_name)
//{
// _variant_t result;
// if(0xffff != data.fExprO)
// {
// result = data.xnum;
// }
// else
// {
// switch(data.Byte1)
// {
// case 0x00: // String
// result = ""; // there must a String value follow this Formula record
// break;
// case 0x01: // Boolean
// result = data.Byte3 ? "true" : "false";
// break;
// case 0x02: // Error
// {
// BErr error;
// error.err = data.Byte3;
// result = error;
// break;
// }
// case 0x03: // Blank
// result = "";
// break;
// default:
// throw;// EXCEPT::RT::WrongBiffRecord("Unsupported type of FormulaValue.", "unknown");
// }
// }
// parent->setAttribute(attrib_name, result);
// parent->setAttribute(L"val_type", getType());
//}
//
//
//const bool FormulaValue::fromXML(BiffStructurePtr & parent, const std::wstring & attrib_name)
//{
// unsigned char val_type = getStructAttribute(parent, L"val_type");
//
// switch(val_type)
// {
// case 4:
// data.xnum = getStructAttribute(parent, attrib_name);
// break;
// case 0:
// case 3:
// data.Byte1 = val_type;
// data.fExprO = 0xffff;
// break;
// case 1:
// {
// data.Byte1 = 1;
// Boolean<unsigned char> bool_val;
// bool_val.fromXML(parent, attrib_name);
// data.Byte3 = static_cast<unsigned char>(bool_val);
// data.fExprO = 0xffff;
// break;
// }
// case 2:
// {
// std::wstring str_error = getStructAttribute(parent, attrib_name);
// data.Byte1 = 2;
// BErr error(str_error);
// data.Byte3 = error.err;
// data.fExprO = 0xffff;
// break;
// }
// default:
// throw;// EXCEPT::RT::WrongBiffRecord("Unsupported type of FormulaValue.", "unknown");
//
// }
// return true;
//}
//
std::wstring FormulaValue::getValue()
{
std::wstring result;
if(0xffff != data.fExprO)
{
result = STR::double2str(data.xnum);
}
else
{
switch(data.Byte1)
{
case 0x00: // String
result = L""; // there must a String value follow this Formula record
break;
case 0x01: // Boolean
result = data.Byte3 ? L"true" : L"false";
break;
case 0x02: // Error
{
BErr error;
error.err = data.Byte3;
result = error.toString();
break;
}
case 0x03: // Blank
result = L"";
break;
}
}
return result;
}
//
void FormulaValue::store(CFRecord& record)
{
record << data.xnum;
......@@ -101,7 +60,7 @@ void FormulaValue::load(CFRecord& record)
}
const unsigned char FormulaValue::getType() const
unsigned char FormulaValue::getType()
{
if(0xffff != data.fExprO)
{
......
......@@ -15,8 +15,9 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
const unsigned char getType() const;
unsigned char getType();
std::wstring getValue();
union
{
struct
......
......@@ -17,10 +17,8 @@ public:
virtual void load(CFRecord& record, const size_t cce);
virtual void store(CFRecord& record);
private:
virtual void load(CFRecord& record) {};
private:
bool is_part_of_a_revision_;
};
......
......@@ -23,7 +23,8 @@ class BOperatorPtg_T: public OperatorPtg
{
public:
BOperatorPtg_T() : OperatorPtg(fixedPtgId) {};
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
std::wstring operand2(ptg_stack.top());
ptg_stack.pop();
......@@ -40,7 +41,7 @@ class UOperatorPtg_T: public OperatorPtg
{
public:
UOperatorPtg_T() : OperatorPtg(fixedType) {};
void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.top() = T::getSymbols() + ptg_stack.top();
};
......@@ -301,7 +302,7 @@ public:
static const std::wstring symbols(L"%");
return symbols;
}
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.top() += getOperatorSymbols();
};
......
......@@ -40,7 +40,7 @@ const bool ParsedFormula::HasPtgTbl() const
}
const std::wstring ParsedFormula::getAssembledFormula(BiffStructurePtr & parent) const
const std::wstring ParsedFormula::getAssembledFormula() const
{
const PtgVector& ptgs = rgce.getPtgs();
if(ptgs.empty())
......@@ -51,7 +51,7 @@ const std::wstring ParsedFormula::getAssembledFormula(BiffStructurePtr & parent)
PtgQueue extra_data = rgcb.getPtgs();
for(PtgVectorIterator it = ptgs.begin(), itEnd = ptgs.end(); it != itEnd; ++it)
{
(*it)->assemble(ptg_stack, extra_data, parent);
(*it)->assemble(ptg_stack, extra_data);
}
if(1 != ptg_stack.size())
{
......@@ -61,15 +61,15 @@ const std::wstring ParsedFormula::getAssembledFormula(BiffStructurePtr & parent)
}
const bool ParsedFormula::parseStringFormula(const std::wstring formula, BiffStructurePtr & parent)
{
StringPtgParser parser;
if(parser.parseToPtgs(boost::algorithm::trim_copy(formula), rgce, rgcb, parent))
{
return true;
}
return false;
}
//const bool ParsedFormula::parseStringFormula(const std::wstring formula, const std::wstring & tag_name)
//{
// StringPtgParser parser;
// if(parser.parseToPtgs(boost::algorithm::trim_copy(formula), rgce, rgcb, tag_name))
// {
// return true;
// }
// return false;
//}
} // namespace XLS
......
......@@ -14,16 +14,13 @@ class ParsedFormula : public BiffStructure
public:
ParsedFormula(const CellRef& cell_base_ref);
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
//virtual void getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
void setCCE(const size_t cce_val); // mandatory to call before any use of "cce"
const size_t getCCE() const;
const bool HasPtgTbl() const;
const std::wstring getAssembledFormula(BiffStructurePtr & parent) const;
const std::wstring getAssembledFormula() const;
const bool parseStringFormula(const std::wstring formula, BiffStructurePtr & parent);
//const bool parseStringFormula(const std::wstring formula, const std::wstring & tag_name);
Rgce rgce;
RgbExtra rgcb;
......
......@@ -42,7 +42,7 @@ void Ptg::addFuncWrapper(AssemblerStack& ptg_stack, const std::wstring& func_nam
}
void Ptg::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void Ptg::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
}
......
......@@ -34,20 +34,19 @@ public:
virtual void storeFields(CFRecord& record) {};
virtual const unsigned short getPtgId() const;// = 0;
const size_t getOffsetInRecord() const;
const size_t getSizeOfStruct() const;
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
protected:
void addFuncWrapper(AssemblerStack& ptg_stack, const std::wstring& func_name);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
_CP_OPT(unsigned short) ptg_id;
_CP_OPT(size_t) offset_in_record;
_CP_OPT(size_t) size_of_struct;
protected:
void addFuncWrapper(AssemblerStack& ptg_stack, const std::wstring& func_name);
};
......
......@@ -44,7 +44,7 @@ void PtgArea::loadFields(CFRecord& record)
}
void PtgArea::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgArea::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
RgceArea range(area);
if(!ptg_stack.empty())
......
......@@ -17,14 +17,13 @@ public:
PtgArea(const std::wstring& word, const PtgDataType data_type);
BiffStructurePtr clone();
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x05;
private:
RgceArea area;
};
......
......@@ -55,7 +55,7 @@ void PtgArea3d::loadFields(CFRecord& record)
}
void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
RevExternPtr tab_ids;
if(!extra_data.empty() && (tab_ids = boost::dynamic_pointer_cast<RevExtern>(extra_data.front())))
......
......@@ -21,10 +21,9 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x1B;
private:
unsigned short ixti;
RgceAreaRel area_rel;
RgceArea area;
......
......@@ -35,7 +35,7 @@ void PtgAreaErr::loadFields(CFRecord& record)
}
void PtgAreaErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAreaErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
if(!ptg_stack.empty() && 0 == ptg_stack.top().find(L"#PtgElfRadical"))
{
......
......@@ -18,11 +18,10 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
virtual const unsigned short getPtgId() const { return id_fixed | (static_cast<unsigned char>(data_type) << 5);}
private:
static const unsigned short id_fixed = 0x0A;
unsigned char data_type;
};
......
......@@ -34,7 +34,7 @@ void PtgAreaErr3d::loadFields(CFRecord& record)
}
void PtgAreaErr3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAreaErr3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
RevExternPtr tab_ids;
if(!extra_data.empty() && (tab_ids = boost::dynamic_pointer_cast<RevExtern>(extra_data.front())))
......
......@@ -14,13 +14,11 @@ class PtgAreaErr3d: public OperandPtg
public:
BiffStructurePtr clone();
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned short ixti;
GlobalWorkbookInfoPtr global_info;
};
......
......@@ -46,7 +46,7 @@ void PtgAreaN::loadFields(CFRecord& record)
}
void PtgAreaN::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAreaN::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push((area + cell_base_ref).toString());
}
......
......@@ -16,15 +16,13 @@ public:
PtgAreaN(const std::wstring& word, const PtgDataType data_type, const CellRef cell_base_ref_init);
BiffStructurePtr clone();
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x0D;
private:
CellRef cell_base_ref;
RgceAreaRel area;
};
......
......@@ -36,7 +36,7 @@ void PtgArray::loadFields(CFRecord& record)
}
void PtgArray::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgArray::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
std::wstring array_string;
......
......@@ -18,7 +18,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x00;
};
......
......@@ -31,7 +31,7 @@ void PtgAttrBaxcel::loadFields(CFRecord& record)
}
void PtgAttrBaxcel::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAttrBaxcel::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_datat)
{
// volatile property is not seen in the textual form
}
......
......@@ -13,13 +13,11 @@ class PtgAttrBaxcel : public Ptg
public:
BiffStructurePtr clone();
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
bool bitSemi;
};
......
......@@ -44,7 +44,7 @@ void PtgAttrChoose::loadFields(CFRecord& record)
}
void PtgAttrChoose::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAttrChoose::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// All control tokens shall be skipped
}
......
......@@ -13,13 +13,11 @@ class PtgAttrChoose : public Ptg
public:
BiffStructurePtr clone();
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned short cOffset;
std::vector<unsigned short> rgOffset;
};
......
......@@ -30,7 +30,7 @@ void PtgAttrGoto::loadFields(CFRecord& record)
}
void PtgAttrGoto::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAttrGoto::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// All control tokens shall be skipped
}
......
......@@ -13,13 +13,11 @@ class PtgAttrGoto : public Ptg
public:
BiffStructurePtr clone();
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned short offset;
};
......
......@@ -30,7 +30,7 @@ void PtgAttrIf::loadFields(CFRecord& record)
}
void PtgAttrIf::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAttrIf::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// All control tokens shall be skipped
}
......
......@@ -13,13 +13,11 @@ class PtgAttrIf : public Ptg
public:
BiffStructurePtr clone();
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned short offset;
};
......
......@@ -24,7 +24,7 @@ void PtgAttrSemi::loadFields(CFRecord& record)
}
void PtgAttrSemi::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAttrSemi::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// volatile property is not seen in the textual form
}
......
......@@ -15,7 +15,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
};
......
......@@ -24,7 +24,7 @@ void PtgAttrSpace::loadFields(CFRecord& record)
}
void PtgAttrSpace::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAttrSpace::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// Display token, that shall be skipped
}
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
};
......
......@@ -24,7 +24,7 @@ void PtgAttrSpaceSemi::loadFields(CFRecord& record)
}
void PtgAttrSpaceSemi::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAttrSpaceSemi::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// Display token that shall be skipped
}
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
};
} // namespace XLS
......
......@@ -24,7 +24,7 @@ void PtgAttrSum::loadFields(CFRecord& record)
}
void PtgAttrSum::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgAttrSum::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
addFuncWrapper(ptg_stack, L"SUM");
}
......
......@@ -16,7 +16,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x1019;
};
......
......@@ -58,7 +58,7 @@ void PtgBool::loadFields(CFRecord& record)
}
void PtgBool::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgBool::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(boolean_ ? L"TRUE" : L"FALSE");
}
......
......@@ -20,7 +20,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x1D;
......
......@@ -31,7 +31,7 @@ void PtgElfCol::loadFields(CFRecord& record)
}
void PtgElfCol::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfCol::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(CellRangeRef(loc, CellRangeRef::stColumnBelow).toString());
}
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
RgceElfLoc loc;
......
......@@ -25,7 +25,7 @@ void PtgElfColS::loadFields(CFRecord& record)
}
void PtgElfColS::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfColS::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
PtgExtraElfPtr range;
Log::message("PtgElfColS found!!! PtgElfColS found!!! PtgElfColS found!!! PtgElfColS found!!!");
......
......@@ -16,7 +16,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
};
......
......@@ -25,7 +25,7 @@ void PtgElfColSV::loadFields(CFRecord& record)
}
void PtgElfColSV::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfColSV::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
PtgExtraElfPtr range;
Log::message("PtgElfColSV found!!! PtgElfColSV found!!! PtgElfColSV found!!! PtgElfColSV found!!!");
......
......@@ -16,7 +16,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
};
......
......@@ -31,7 +31,7 @@ void PtgElfColV::loadFields(CFRecord& record)
}
void PtgElfColV::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfColV::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(CellRangeRef(loc, CellRangeRef::stColumnBelow).toString());
}
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
RgceElfLoc loc;
......
......@@ -35,7 +35,7 @@ void PtgElfLel::loadFields(CFRecord& record)
}
void PtgElfLel::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfLel::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(L"#NAME?"); // The best decision I think
}
......
......@@ -18,7 +18,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
Ilel ilel;
......
......@@ -31,7 +31,7 @@ void PtgElfRadical::loadFields(CFRecord& record)
}
void PtgElfRadical::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfRadical::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// The significant tag follows (PtgArea or PtgAreaErr)
PtgParam param(PtgParam::ptELF_RADICAL, L"");
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
RgceElfLoc loc;
......
......@@ -35,7 +35,7 @@ void PtgElfRadicalLel::loadFields(CFRecord& record)
}
void PtgElfRadicalLel::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfRadicalLel::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// The significant tag follows (PtgArea or PtgAreaErr)
}
......
......@@ -18,7 +18,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
Ilel ilel;
......
......@@ -24,7 +24,7 @@ void PtgElfRadicalS::loadFields(CFRecord& record)
}
void PtgElfRadicalS::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfRadicalS::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// The significant tag follows (PtgArea or PtgAreaErr)
}
......
......@@ -16,7 +16,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
};
......
......@@ -31,7 +31,7 @@ void PtgElfRw::loadFields(CFRecord& record)
}
void PtgElfRw::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfRw::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(CellRangeRef(loc, CellRangeRef::stRow).toString());
}
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
RgceElfLoc loc;
......
......@@ -31,7 +31,7 @@ void PtgElfRwV::loadFields(CFRecord& record)
}
void PtgElfRwV::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgElfRwV::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(CellRangeRef(loc, CellRangeRef::stRow).toString());
}
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
RgceElfLoc loc;
......
......@@ -42,7 +42,7 @@ void PtgErr::loadFields(CFRecord& record)
}
void PtgErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(err.toString());
}
......
......@@ -20,7 +20,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x1C;
......
......@@ -46,7 +46,7 @@ void PtgExp::loadFields(CFRecord& record)
}
void PtgExp::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgExp::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// The reference coordinates shall be obtained from row/column values.
// No textual form need but the empty line.
......
......@@ -19,7 +19,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x01;
......
......@@ -30,13 +30,6 @@ BiffStructurePtr PtgExtraArray::clone()
}
//void PtgExtraArray::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"cols", cols);
// xml_tag->setAttribute(L"rows", rows);
// std::for_each(array_.begin(), array_.end(), boost::bind(&SerAr::toXML, _1, xml_tag));
//}
//
void PtgExtraArray::store(CFRecord& record)
{
......
......@@ -42,15 +42,16 @@ void PtgFunc::loadFields(CFRecord& record)
}
void PtgFunc::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgFunc::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
long num_params = iftab.getParamsNum();
std::wstring arguments;
if(num_params)
if(num_params && ptg_stack.size() > 0)
{
arguments += ptg_stack.top();
ptg_stack.pop();
for(long i = 0; i < num_params - 1; ++i)
for(long i = 0; i < num_params - 1 && ptg_stack.size() > 0; ++i)
{
arguments = ptg_stack.top() + L',' + arguments;
ptg_stack.pop();
......
......@@ -22,7 +22,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
const long getParametersNum() const;
......
......@@ -47,7 +47,7 @@ void PtgFuncVar::loadFields(CFRecord& record)
}
void PtgFuncVar::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgFuncVar::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
std::wstring arguments;
std::wstring func_name = tab.getFuncName();
......@@ -57,17 +57,20 @@ void PtgFuncVar::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffS
{
--nparams;
}
if(nparams)
int sz = ptg_stack.size();
if(nparams )
{
arguments += ptg_stack.top();
ptg_stack.pop();
for(unsigned char i = 0; i < nparams - 1; ++i)
for(unsigned char i = 0; i < nparams - 1 ; ++i)
{
arguments = ptg_stack.top() + L',' + arguments;
ptg_stack.pop();
}
}
if(0xFF == tab.getIndex()) // user-defined function
if(0xFF == tab.getIndex() && ptg_stack.size() > 0) // user-defined function
{
func_name = ptg_stack.top();
ptg_stack.pop();
......
......@@ -23,7 +23,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
void setParamsNum(const unsigned char num);
......
......@@ -42,7 +42,7 @@ void PtgInt::loadFields(CFRecord& record)
}
void PtgInt::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgInt::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(STR::int2wstr(integer));
}
......
......@@ -19,7 +19,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x1E;
......
......@@ -34,7 +34,7 @@ void PtgMemArea::loadFields(CFRecord& record)
}
void PtgMemArea::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgMemArea::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
PtgExtraMemPtr range;
if(extra_data.empty() || !(range = boost::dynamic_pointer_cast<PtgExtraMem>(extra_data.front())))
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned short cce;
......
......@@ -31,7 +31,7 @@ void PtgMemAreaN::loadFields(CFRecord& record)
}
void PtgMemAreaN::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgMemAreaN::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
PtgExtraMemPtr range;
if(extra_data.empty() || !(range = boost::dynamic_pointer_cast<PtgExtraMem>(extra_data.front())))
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned short cce;
......
......@@ -35,7 +35,7 @@ void PtgMemErr::loadFields(CFRecord& record)
}
void PtgMemErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgMemErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
//ptg_stack.push("#CACHE(" + STR::int2str(getOffsetInRecord() + getSizeOfStruct() + cce, 10) + ")!" + err.toString());
}
......
......@@ -18,7 +18,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
BErr err;
......
......@@ -30,7 +30,7 @@ void PtgMemFunc::loadFields(CFRecord& record)
}
void PtgMemFunc::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgMemFunc::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// no textual form
}
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned short cce;
......
......@@ -32,7 +32,7 @@ void PtgMemNoMem::loadFields(CFRecord& record)
}
void PtgMemNoMem::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgMemNoMem::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// I assume it doesn't generate an error.
}
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned short cce;
......
......@@ -45,7 +45,7 @@ void PtgMemNoMemN::load(CFRecord& record)
}
void PtgMemNoMemN::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgMemNoMemN::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// I assume it doesn't generate an error.
}
......
......@@ -18,7 +18,7 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned char type;
......
......@@ -18,7 +18,7 @@ BiffStructurePtr PtgMissArg::clone()
}
void PtgMissArg::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgMissArg::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(L"");
}
......
......@@ -12,7 +12,7 @@ public:
PtgMissArg();
BiffStructurePtr clone();
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x16;
};
......
......@@ -25,12 +25,6 @@ BiffStructurePtr PtgName::clone()
}
//void PtgName::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"nameindex", nameindex);
//}
void PtgName::storeFields(CFRecord& record)
{
record << nameindex;
......@@ -40,14 +34,17 @@ void PtgName::storeFields(CFRecord& record)
void PtgName::loadFields(CFRecord& record)
{
record >> nameindex;
global_info = record.getGlobalWorkbookInfo();
}
void PtgName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
RevNameTabidPtr tab_id;
if(!extra_data.empty() && (tab_id = boost::dynamic_pointer_cast<RevNameTabid>(extra_data.front())))
{
#pragma message("####################### PtgName struct for revisions is not checked")
Log::info("PtgName struct for revisions is not checked.");
ptg_stack.push(tab_id->toString());
......@@ -55,18 +52,21 @@ void PtgName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStru
return;
}
//std::wstring query = L"root/WorkbookStreamObject/GlobalsSubstream/LBL[position() = " +
// STR::int2wstr(nameindex, 10) + L"]/Lbl/@Name";
//MSXML2::IXMLDOMNodePtr node = parent->GetownerDocument()->selectSingleNode(query.c_str());
//if(node)
//{
// ptg_stack.push(static_cast<wchar_t*>(node->Gettext()));
//}
//else
//{
// ptg_stack.push(L"#UNDEFINED_NAME(" + STR::int2wstr(nameindex) + L")!");
//}
std::wstring ptg;
if ((global_info) && (nameindex <= global_info->defineNames.size()))
{
ptg = global_info->defineNames[nameindex-1];
}
if(!ptg.empty())
{
ptg_stack.push(ptg);
}
else
{
ptg_stack.push(L"#UNDEFINED_NAME(" + STR::int2wstr(nameindex) + L")!");
}
}
......
......@@ -20,12 +20,13 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x03;
private:
unsigned int nameindex;
private:
GlobalWorkbookInfoPtr global_info;
};
} // namespace XLS
......
......@@ -2,7 +2,6 @@
#include "PtgNameX.h"
#include "RevName.h"
#include <Binary/CFRecord.h>
//#include <Exception/WrongIntermediateXMLFormat.h>
namespace XLS
{;
......@@ -13,10 +12,10 @@ PtgNameX::PtgNameX()
}
PtgNameX::PtgNameX(const std::wstring& word, BiffStructurePtr & parent, const PtgDataType data_type)
PtgNameX::PtgNameX(const std::wstring& word, const PtgDataType data_type)
: OperandPtg(fixed_id | (static_cast<unsigned char>(data_type) << 5))
{
fromString(word, parent);
fromString(word);
}
......@@ -26,13 +25,6 @@ BiffStructurePtr PtgNameX::clone()
}
//void PtgNameX::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"ixti", ixti);
// xml_tag->setAttribute(L"nameindex", nameindex);
//}
void PtgNameX::storeFields(CFRecord& record)
{
record << ixti << nameindex;
......@@ -46,7 +38,7 @@ void PtgNameX::loadFields(CFRecord& record)
}
void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
RevNamePtr tab_id;
if(!extra_data.empty() && (tab_id = boost::dynamic_pointer_cast<RevName>(extra_data.front())))
......@@ -77,10 +69,12 @@ void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStr
}
void PtgNameX::fromString(const std::wstring& word, BiffStructurePtr & parent)
void PtgNameX::fromString(const std::wstring& word)
{
std::wstring query = L"root/WorkbookStreamObject/GlobalsSubstream/SUPBOOK";
//
//
// parent.get();
// MSXML2::IXMLDOMNodeListPtr nodes = parent->GetownerDocument()->selectNodes(query);
// MSXML2::IXMLDOMElementPtr supbook;
// size_t scounter = 0;
......@@ -114,7 +108,7 @@ void PtgNameX::fromString(const std::wstring& word, BiffStructurePtr & parent)
// }
// ++scounter;
// }
throw;// EXCEPT::LE::WrongIntermediateXMLFormat("Necessary 'ExternName' tag was not found.", __FUNCTION__);
// throw;// EXCEPT::LE::WrongIntermediateXMLFormat("Necessary 'ExternName' tag was not found.", __FUNCTION__);
}
......
......@@ -13,22 +13,21 @@ class PtgNameX: public OperandPtg
BASE_STRUCTURE_DEFINE_CLASS_NAME(PtgNameX)
public:
PtgNameX();
PtgNameX(const std::wstring& word, BiffStructurePtr & parent, const PtgDataType data_type_init);
PtgNameX(const std::wstring& word, const PtgDataType data_type_init);
BiffStructurePtr clone();
//virtual void setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag);
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x19;
private:
void fromString(const std::wstring& word, BiffStructurePtr & parent);
private:
void fromString(const std::wstring& word);
unsigned short ixti;
unsigned int nameindex;
private:
GlobalWorkbookInfoPtr global_info;
};
......
......@@ -42,7 +42,7 @@ void PtgNum::loadFields(CFRecord& record)
}
void PtgNum::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgNum::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(STR::double2str(value_));
}
......
......@@ -19,7 +19,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x1F;
......
......@@ -19,7 +19,7 @@ BiffStructurePtr PtgParen::clone()
}
void PtgParen::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgParen::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.top() = L'(' + ptg_stack.top() + L')';
}
......
......@@ -14,7 +14,7 @@ public:
PtgParen();
BiffStructurePtr clone();
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x15;
void incrementParametersNum();
......
......@@ -42,7 +42,7 @@ void PtgRef::loadFields(CFRecord& record)
record >> loc;
}
void PtgRef::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgRef::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(loc.toString());
}
......
......@@ -20,7 +20,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x04;
private:
......
......@@ -55,7 +55,7 @@ void PtgRef3d::loadFields(CFRecord& record)
}
void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
RevExternPtr tab_ids;
if(!extra_data.empty() && (tab_ids = boost::dynamic_pointer_cast<RevExtern>(extra_data.front())))
......
......@@ -22,7 +22,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x1A;
private:
......
......@@ -35,7 +35,7 @@ void PtgRefErr::loadFields(CFRecord& record)
}
void PtgRefErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgRefErr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(L"#REF!");
}
......
......@@ -18,7 +18,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x0A;
};
......
......@@ -46,7 +46,7 @@ void PtgRefErr3d::loadFields(CFRecord& record)
}
void PtgRefErr3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgRefErr3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
RevExternPtr tab_ids;
if(!extra_data.empty() && (tab_ids = boost::dynamic_pointer_cast<RevExtern>(extra_data.front())))
......
......@@ -20,7 +20,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x1C;
private:
......
......@@ -45,7 +45,7 @@ void PtgRefN::loadFields(CFRecord& record)
}
void PtgRefN::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgRefN::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push((loc + cell_base_ref).toString());
}
......
......@@ -19,7 +19,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x0C;
......
......@@ -43,7 +43,7 @@ void PtgStr::loadFields(CFRecord& record)
}
void PtgStr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgStr::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
ptg_stack.push(L"\"" + boost::algorithm::replace_all_copy(std::wstring(string_), L"\"", L"\"\"") + L"\"");
}
......
......@@ -20,7 +20,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x17;
......
......@@ -30,7 +30,7 @@ void PtgSxName::loadFields(CFRecord& record)
}
void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
#pragma message("####################### PtgSxName struct is not implemented")
Log::info("PtgSxName structure is not implemented.");
......
......@@ -17,7 +17,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
private:
unsigned int sxIndex;
......
......@@ -45,7 +45,7 @@ void PtgTbl::loadFields(CFRecord& record)
}
void PtgTbl::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent)
void PtgTbl::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data)
{
// The reference coordinates shall be obtained from row/column values.
// No textual form need but the empty line.
......
......@@ -19,7 +19,7 @@ public:
virtual void loadFields(CFRecord& record);
virtual void storeFields(CFRecord& record);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, BiffStructurePtr & parent);
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data);
static const unsigned short fixed_id = 0x02;
......
......@@ -37,349 +37,348 @@ namespace XLS
// The algorithm has been copied to EWSEditor. All code changes shall be synchronized.
const bool StringPtgParser::parseToPtgs(const std::wstring& assembled_formula, Rgce& rgce, RgbExtra& rgb, BiffStructurePtr & parent)
{
PtgPtr last_ptg;
bool operand_expected = true; // This would help distinguish unary and binary and determine if an argument to a function is missed.
std::wstring tag_name = parent->tagName_;
for(std::wstring::const_iterator it = assembled_formula.begin(), itEnd = assembled_formula.end(); it != itEnd;)
{
#pragma region Operators
if(SyntaxPtg::is_operators(it, itEnd) || SyntaxPtg::is_PtgIsect(it, itEnd))
{
OperatorPtgPtr found_operator;
if(SyntaxPtg::extract_PtgAdd(it, itEnd, operand_expected))
{
found_operator.reset(new PtgAdd);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgUplus(it, itEnd, operand_expected))
{
found_operator.reset(new PtgUplus);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgSub(it, itEnd, operand_expected))
{
found_operator.reset(new PtgSub);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgUminus(it, itEnd, operand_expected))
{
found_operator.reset(new PtgUminus);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgPercent(it, itEnd, operand_expected))
{
found_operator.reset(new PtgPercent);
operand_expected = false;
}
else if(SyntaxPtg::extract_PtgMul(it, itEnd))
{
found_operator.reset(new PtgMul);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgDiv(it, itEnd))
{
found_operator.reset(new PtgDiv);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgPower(it, itEnd))
{
found_operator.reset(new PtgPower);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgEq(it, itEnd)) // Sequence is important
{
found_operator.reset(new PtgEq);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgNe(it, itEnd)) // Sequence is important
{
found_operator.reset(new PtgNe);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgLe(it, itEnd)) // Sequence is important
{
found_operator.reset(new PtgLe);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgLt(it, itEnd)) // Sequence is important
{
found_operator.reset(new PtgLt);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgGe(it, itEnd)) // Sequence is important
{
found_operator.reset(new PtgGe);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgGt(it, itEnd)) // Sequence is important
{
found_operator.reset(new PtgGt);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgConcat(it, itEnd))
{
found_operator.reset(new PtgConcat);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgUnion(it, itEnd))
{
found_operator.reset(new PtgUnion);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgRange(it, itEnd))
{
found_operator.reset(new PtgRange);
operand_expected = true;
}
else if(SyntaxPtg::extract_PtgIsect(it, itEnd)) // Must be the last of operators
{
found_operator.reset(new PtgIsect);
operand_expected = true;
}
else
{
throw;// EXCEPT::RT::WrongFormulaString("Unknown operator format in formula.", assembled_formula);
}
OperatorPtgPtr operator_top;
while(ptg_stack.size() && (operator_top = boost::dynamic_pointer_cast<OperatorPtg>(ptg_stack.top())) &&
(found_operator->isRightAssociative() ? (operator_top->getOperatorPriority() < found_operator->getOperatorPriority()) :
(operator_top->getOperatorPriority() <= found_operator->getOperatorPriority())))
{
rgce.addPtg(ptg_stack.top());
ptg_stack.pop();
}
ptg_stack.push(found_operator);
last_ptg = found_operator;
}
#pragma endregion
#pragma region Parenthesis
else if(SyntaxPtg::extract_LeftParenthesis(it, itEnd))
{
PtgFuncPtr func;
// Check if the parenthesis is the left one of a function without parameters
operand_expected = (ptg_stack.size() && (func = boost::dynamic_pointer_cast<PtgFunc>(ptg_stack.top())) && !func->getParametersNum()) ? false : true;
ptg_stack.push(last_ptg = PtgPtr(new PtgParen));
}
else if(SyntaxPtg::extract_RightParenthesis(it, itEnd))
{
PtgParenPtr left_p;
if(ptg_stack.size() && (left_p = boost::dynamic_pointer_cast<PtgParen>(ptg_stack.top())) && operand_expected)
{
if(left_p->getParametersNum()) // This means there is at least one comma inside the parenthesis
{
rgce.addPtg(PtgPtr(new PtgMissArg));
}
else
{
left_p->decrementParametersNum();
}
}
else
{
while(ptg_stack.size() && !(left_p = boost::dynamic_pointer_cast<PtgParen>(ptg_stack.top())))
{
rgce.addPtg(ptg_stack.top());
ptg_stack.pop();
}
}
if(!ptg_stack.size() || !left_p)
{
throw;// EXCEPT::RT::WrongParenthesisSequence(assembled_formula);
}
ptg_stack.pop(); // pop PtgParen that is now stored in left_p
last_ptg = left_p;
PtgFuncVarPtr func_var;
if(ptg_stack.size() && boost::dynamic_pointer_cast<PtgFunc>(ptg_stack.top()))
{
last_ptg = ptg_stack.top();
ptg_stack.pop(); // pop PtgFunc
}
else if(ptg_stack.size() && (func_var = boost::dynamic_pointer_cast<PtgFuncVar>(ptg_stack.top())))
{
size_t num_parameters = left_p->getParametersNum() + 1;
if(num_parameters > 255)
{
throw;// EXCEPT::RT::WrongFormulaString("Too many parameters to a function", assembled_formula);
}
func_var->setParamsNum(static_cast<unsigned char>(num_parameters));
last_ptg = ptg_stack.top();
ptg_stack.pop(); // pop PtgFuncVar
}
else // If there is no function name before the left parenthesis
{
for (size_t i = 0; i < left_p->getParametersNum(); ++i)
{
rgce.addPtg(PtgPtr(new PtgUnion));
}
}
rgce.addPtg(last_ptg);
operand_expected = false;
}
#pragma endregion
#pragma region Comma and PtgUnion
else if(SyntaxPtg::extract_comma(it, itEnd))
{
PtgParenPtr left_p;
if(ptg_stack.size() && (left_p = boost::dynamic_pointer_cast<PtgParen>(ptg_stack.top())) && operand_expected)
{
rgce.addPtg(PtgPtr(new PtgMissArg));
}
else
{
while(ptg_stack.size() && !(left_p = boost::dynamic_pointer_cast<PtgParen>(ptg_stack.top())))
{
rgce.addPtg(ptg_stack.top());
ptg_stack.pop();
}
}
if(!ptg_stack.size() || !left_p)
{
throw;// EXCEPT::RT::WrongParenthesisSequence(assembled_formula);
}
left_p->incrementParametersNum(); // The count of parameters will be transferred to PtgFuncVar
last_ptg = left_p; // PtgParen. Mostly to differ unary and binary minuses and pluses
operand_expected = true;
}
#pragma endregion
#pragma region Operands
else
{
OperandPtgPtr found_operand;
std::wstring operand_str;
unsigned int number;
unsigned short ixti;
if(SyntaxPtg::extract_PtgBool(it, itEnd, operand_str))
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgBool(operand_str)));
}
else if(SyntaxPtg::extract_PtgStr(it, itEnd, operand_str))
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgStr(operand_str.c_str())));
}
else if(SyntaxPtg::extract_PtgRefErr(it, itEnd)) // Sequence is important (in pair with PtgErr)
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgRefErr(OperandPtg::pdt_REFERENCE))); // Checked with SIN(val) - OK
}
else if(SyntaxPtg::extract_PtgErr(it, itEnd, operand_str)) // Sequence is important (in pair with PtgRefErr)
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgErr(operand_str.c_str())));
}
else if(SyntaxPtg::extract_3D_part(it, itEnd, ixti, parent)) // Shall be placed strongly before extract_PtgName
{
if(SyntaxPtg::extract_PtgArea(it, itEnd, operand_str))
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgArea3d(ixti, operand_str, OperandPtg::pdt_VALUE, rgce.getLocation())));
}
else if(SyntaxPtg::extract_PtgRef(it, itEnd, operand_str))
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgRef3d(ixti, operand_str, OperandPtg::pdt_VALUE, rgce.getLocation())));
}
else if(SyntaxPtg::extract_PtgRefErr(it, itEnd))
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgRefErr3d(ixti, OperandPtg::pdt_VALUE)));
}
else
{
throw;// EXCEPT::RT::WrongFormulaString("Unknown format of 3D reference in formula.", assembled_formula);
}
}
else if(SyntaxPtg::extract_PtgName(it, itEnd, number, parent))// Shall be placed strongly before PtgArea and PtgRef
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgName(number, OperandPtg::pdt_VALUE)));
}
else if(SyntaxPtg::extract_PtgArea(it, itEnd, operand_str)) // Sequence is important (in pair with PtgRef)
{
if(L"SharedParsedFormula" == tag_name || L"CFParsedFormulaNoCCE" == tag_name)
{
found_operand = OperandPtgPtr(new PtgAreaN(operand_str, OperandPtg::pdt_VALUE, rgce.getLocation()));
}
else
{
found_operand = OperandPtgPtr(new PtgArea(operand_str, OperandPtg::pdt_VALUE));
}
rgce.addPtg(found_operand);
}
else if(SyntaxPtg::extract_PtgRef(it, itEnd, operand_str)) // Sequence is important (in pair with PtgArea)
{
if(L"SharedParsedFormula" == tag_name || L"CFParsedFormulaNoCCE" == tag_name)
{
found_operand = OperandPtgPtr(new PtgRefN(operand_str, OperandPtg::pdt_VALUE, rgce.getLocation()));
}
else
{
found_operand = OperandPtgPtr(new PtgRef(operand_str, OperandPtg::pdt_VALUE));
}
rgce.addPtg(found_operand);
}
else if(SyntaxPtg::extract_PtgInt(it, itEnd, operand_str)) // Shall be placed after PtgArea but before UndefinedName
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgInt(operand_str)));
}
else if(SyntaxPtg::extract_PtgNum(it, itEnd, operand_str)) // Shall be placed after PtgArea but before UndefinedName
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgNum(operand_str)));
}
else if(SyntaxPtg::extract_UndefinedName(it, itEnd)) // Shall be placed strongly after extract_PtgName
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgErr(L"#REF!")));
}
else if(SyntaxPtg::extract_PtgArray(it, itEnd, operand_str))
{
rgce.addPtg(found_operand = OperandPtgPtr(new PtgArray(OperandPtg::pdt_ARRAY)));
rgb.addPtg(PtgPtr(new PtgExtraArray(operand_str)));
}
else if(SyntaxPtg::extract_PtgFunc(it, itEnd, operand_str))
{
PtgPtr func;
if((func = PtgFunc::create(operand_str, OperandPtg::pdt_VALUE)) ||
(func = PtgFuncVar::create(operand_str, OperandPtg::pdt_VALUE)))
{
ptg_stack.push(func);
}
else
{
func = PtgFuncVar::create(L"USER_DEFINED_FUNCTION", OperandPtg::pdt_VALUE);
if(!func)
{
throw;// EXCEPT::LE::WhatIsTheFuck("Ftab_Cetab doesn't contain info about user-defined function (0xFF).", __FUNCTION__);
}
ptg_stack.push(func);
rgce.addPtg(PtgPtr(new PtgNameX(operand_str, parent, OperandPtg::pdt_VALUE)));
}
}
else
{
throw;// EXCEPT::RT::WrongFormulaString("Unknown operand format in formula.", assembled_formula);
}
last_ptg = found_operand;
operand_expected = false;
}
#pragma endregion
}
while(ptg_stack.size())
{
OperatorPtgPtr operator_ptg = boost::dynamic_pointer_cast<OperatorPtg>(ptg_stack.top());
if(operator_ptg)
{
rgce.addPtg(ptg_stack.top());
ptg_stack.pop();
}
else
{
return false;
}
}
return true;
}
//const bool StringPtgParser::parseToPtgs(const std::wstring& assembled_formula, Rgce& rgce, RgbExtra& rgb, const std::wstring & tag_name)
//{
// PtgPtr last_ptg;
// bool operand_expected = true; // This would help distinguish unary and binary and determine if an argument to a function is missed.
//
// for(std::wstring::const_iterator it = assembled_formula.begin(), itEnd = assembled_formula.end(); it != itEnd;)
// {
// #pragma region Operators
// if(SyntaxPtg::is_operators(it, itEnd) || SyntaxPtg::is_PtgIsect(it, itEnd))
// {
// OperatorPtgPtr found_operator;
// if(SyntaxPtg::extract_PtgAdd(it, itEnd, operand_expected))
// {
// found_operator.reset(new PtgAdd);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgUplus(it, itEnd, operand_expected))
// {
// found_operator.reset(new PtgUplus);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgSub(it, itEnd, operand_expected))
// {
// found_operator.reset(new PtgSub);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgUminus(it, itEnd, operand_expected))
// {
// found_operator.reset(new PtgUminus);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgPercent(it, itEnd, operand_expected))
// {
// found_operator.reset(new PtgPercent);
// operand_expected = false;
// }
// else if(SyntaxPtg::extract_PtgMul(it, itEnd))
// {
// found_operator.reset(new PtgMul);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgDiv(it, itEnd))
// {
// found_operator.reset(new PtgDiv);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgPower(it, itEnd))
// {
// found_operator.reset(new PtgPower);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgEq(it, itEnd)) // Sequence is important
// {
// found_operator.reset(new PtgEq);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgNe(it, itEnd)) // Sequence is important
// {
// found_operator.reset(new PtgNe);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgLe(it, itEnd)) // Sequence is important
// {
// found_operator.reset(new PtgLe);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgLt(it, itEnd)) // Sequence is important
// {
// found_operator.reset(new PtgLt);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgGe(it, itEnd)) // Sequence is important
// {
// found_operator.reset(new PtgGe);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgGt(it, itEnd)) // Sequence is important
// {
// found_operator.reset(new PtgGt);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgConcat(it, itEnd))
// {
// found_operator.reset(new PtgConcat);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgUnion(it, itEnd))
// {
// found_operator.reset(new PtgUnion);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgRange(it, itEnd))
// {
// found_operator.reset(new PtgRange);
// operand_expected = true;
// }
// else if(SyntaxPtg::extract_PtgIsect(it, itEnd)) // Must be the last of operators
// {
// found_operator.reset(new PtgIsect);
// operand_expected = true;
// }
// else
// {
// throw;// EXCEPT::RT::WrongFormulaString("Unknown operator format in formula.", assembled_formula);
// }
// OperatorPtgPtr operator_top;
// while(ptg_stack.size() && (operator_top = boost::dynamic_pointer_cast<OperatorPtg>(ptg_stack.top())) &&
// (found_operator->isRightAssociative() ? (operator_top->getOperatorPriority() < found_operator->getOperatorPriority()) :
// (operator_top->getOperatorPriority() <= found_operator->getOperatorPriority())))
// {
// rgce.addPtg(ptg_stack.top());
// ptg_stack.pop();
// }
// ptg_stack.push(found_operator);
// last_ptg = found_operator;
// }
// #pragma endregion
// #pragma region Parenthesis
// else if(SyntaxPtg::extract_LeftParenthesis(it, itEnd))
// {
// PtgFuncPtr func;
// // Check if the parenthesis is the left one of a function without parameters
// operand_expected = (ptg_stack.size() && (func = boost::dynamic_pointer_cast<PtgFunc>(ptg_stack.top())) && !func->getParametersNum()) ? false : true;
// ptg_stack.push(last_ptg = PtgPtr(new PtgParen));
// }
// else if(SyntaxPtg::extract_RightParenthesis(it, itEnd))
// {
// PtgParenPtr left_p;
// if(ptg_stack.size() && (left_p = boost::dynamic_pointer_cast<PtgParen>(ptg_stack.top())) && operand_expected)
// {
// if(left_p->getParametersNum()) // This means there is at least one comma inside the parenthesis
// {
// rgce.addPtg(PtgPtr(new PtgMissArg));
// }
// else
// {
// left_p->decrementParametersNum();
// }
// }
// else
// {
// while(ptg_stack.size() && !(left_p = boost::dynamic_pointer_cast<PtgParen>(ptg_stack.top())))
// {
// rgce.addPtg(ptg_stack.top());
// ptg_stack.pop();
// }
// }
// if(!ptg_stack.size() || !left_p)
// {
// throw;// EXCEPT::RT::WrongParenthesisSequence(assembled_formula);
// }
// ptg_stack.pop(); // pop PtgParen that is now stored in left_p
// last_ptg = left_p;
// PtgFuncVarPtr func_var;
// if(ptg_stack.size() && boost::dynamic_pointer_cast<PtgFunc>(ptg_stack.top()))
// {
// last_ptg = ptg_stack.top();
// ptg_stack.pop(); // pop PtgFunc
// }
// else if(ptg_stack.size() && (func_var = boost::dynamic_pointer_cast<PtgFuncVar>(ptg_stack.top())))
// {
// size_t num_parameters = left_p->getParametersNum() + 1;
// if(num_parameters > 255)
// {
// throw;// EXCEPT::RT::WrongFormulaString("Too many parameters to a function", assembled_formula);
// }
// func_var->setParamsNum(static_cast<unsigned char>(num_parameters));
// last_ptg = ptg_stack.top();
// ptg_stack.pop(); // pop PtgFuncVar
// }
// else // If there is no function name before the left parenthesis
// {
// for (size_t i = 0; i < left_p->getParametersNum(); ++i)
// {
// rgce.addPtg(PtgPtr(new PtgUnion));
// }
// }
// rgce.addPtg(last_ptg);
// operand_expected = false;
// }
// #pragma endregion
// #pragma region Comma and PtgUnion
// else if(SyntaxPtg::extract_comma(it, itEnd))
// {
// PtgParenPtr left_p;
// if(ptg_stack.size() && (left_p = boost::dynamic_pointer_cast<PtgParen>(ptg_stack.top())) && operand_expected)
// {
// rgce.addPtg(PtgPtr(new PtgMissArg));
// }
// else
// {
// while(ptg_stack.size() && !(left_p = boost::dynamic_pointer_cast<PtgParen>(ptg_stack.top())))
// {
// rgce.addPtg(ptg_stack.top());
// ptg_stack.pop();
// }
// }
// if(!ptg_stack.size() || !left_p)
// {
// throw;// EXCEPT::RT::WrongParenthesisSequence(assembled_formula);
// }
// left_p->incrementParametersNum(); // The count of parameters will be transferred to PtgFuncVar
// last_ptg = left_p; // PtgParen. Mostly to differ unary and binary minuses and pluses
// operand_expected = true;
// }
// #pragma endregion
// #pragma region Operands
// else
// {
// OperandPtgPtr found_operand;
// std::wstring operand_str;
// unsigned int number;
// unsigned short ixti;
//
// if(SyntaxPtg::extract_PtgBool(it, itEnd, operand_str))
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgBool(operand_str)));
// }
// else if(SyntaxPtg::extract_PtgStr(it, itEnd, operand_str))
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgStr(operand_str.c_str())));
// }
// else if(SyntaxPtg::extract_PtgRefErr(it, itEnd)) // Sequence is important (in pair with PtgErr)
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgRefErr(OperandPtg::pdt_REFERENCE))); // Checked with SIN(val) - OK
// }
// else if(SyntaxPtg::extract_PtgErr(it, itEnd, operand_str)) // Sequence is important (in pair with PtgRefErr)
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgErr(operand_str.c_str())));
// }
// else if(SyntaxPtg::extract_3D_part(it, itEnd, ixti)) // Shall be placed strongly before extract_PtgName
// {
// if(SyntaxPtg::extract_PtgArea(it, itEnd, operand_str))
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgArea3d(ixti, operand_str, OperandPtg::pdt_VALUE, rgce.getLocation())));
// }
// else if(SyntaxPtg::extract_PtgRef(it, itEnd, operand_str))
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgRef3d(ixti, operand_str, OperandPtg::pdt_VALUE, rgce.getLocation())));
// }
// else if(SyntaxPtg::extract_PtgRefErr(it, itEnd))
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgRefErr3d(ixti, OperandPtg::pdt_VALUE)));
// }
// else
// {
// throw;// EXCEPT::RT::WrongFormulaString("Unknown format of 3D reference in formula.", assembled_formula);
// }
// }
// else if(SyntaxPtg::extract_PtgName(it, itEnd, number))// Shall be placed strongly before PtgArea and PtgRef
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgName(number, OperandPtg::pdt_VALUE)));
// }
// else if(SyntaxPtg::extract_PtgArea(it, itEnd, operand_str)) // Sequence is important (in pair with PtgRef)
// {
// if(L"SharedParsedFormula" == tag_name || L"CFParsedFormulaNoCCE" == tag_name)
// {
// found_operand = OperandPtgPtr(new PtgAreaN(operand_str, OperandPtg::pdt_VALUE, rgce.getLocation()));
// }
// else
// {
// found_operand = OperandPtgPtr(new PtgArea(operand_str, OperandPtg::pdt_VALUE));
// }
// rgce.addPtg(found_operand);
// }
// else if(SyntaxPtg::extract_PtgRef(it, itEnd, operand_str)) // Sequence is important (in pair with PtgArea)
// {
// if(L"SharedParsedFormula" == tag_name || L"CFParsedFormulaNoCCE" == tag_name)
// {
// found_operand = OperandPtgPtr(new PtgRefN(operand_str, OperandPtg::pdt_VALUE, rgce.getLocation()));
// }
// else
// {
// found_operand = OperandPtgPtr(new PtgRef(operand_str, OperandPtg::pdt_VALUE));
// }
// rgce.addPtg(found_operand);
// }
// else if(SyntaxPtg::extract_PtgInt(it, itEnd, operand_str)) // Shall be placed after PtgArea but before UndefinedName
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgInt(operand_str)));
// }
// else if(SyntaxPtg::extract_PtgNum(it, itEnd, operand_str)) // Shall be placed after PtgArea but before UndefinedName
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgNum(operand_str)));
// }
//
// else if(SyntaxPtg::extract_UndefinedName(it, itEnd)) // Shall be placed strongly after extract_PtgName
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgErr(L"#REF!")));
// }
//
// else if(SyntaxPtg::extract_PtgArray(it, itEnd, operand_str))
// {
// rgce.addPtg(found_operand = OperandPtgPtr(new PtgArray(OperandPtg::pdt_ARRAY)));
// rgb.addPtg(PtgPtr(new PtgExtraArray(operand_str)));
// }
// else if(SyntaxPtg::extract_PtgFunc(it, itEnd, operand_str))
// {
// PtgPtr func;
// if((func = PtgFunc::create(operand_str, OperandPtg::pdt_VALUE)) ||
// (func = PtgFuncVar::create(operand_str, OperandPtg::pdt_VALUE)))
// {
// ptg_stack.push(func);
// }
// else
// {
// func = PtgFuncVar::create(L"USER_DEFINED_FUNCTION", OperandPtg::pdt_VALUE);
// if(!func)
// {
// throw;// EXCEPT::LE::WhatIsTheFuck("Ftab_Cetab doesn't contain info about user-defined function (0xFF).", __FUNCTION__);
// }
// ptg_stack.push(func);
// rgce.addPtg(PtgPtr(new PtgNameX(operand_str, OperandPtg::pdt_VALUE)));
// }
// }
// else
// {
// throw;// EXCEPT::RT::WrongFormulaString("Unknown operand format in formula.", assembled_formula);
// }
// last_ptg = found_operand;
// operand_expected = false;
// }
// #pragma endregion
// }
//
// while(ptg_stack.size())
// {
// OperatorPtgPtr operator_ptg = boost::dynamic_pointer_cast<OperatorPtg>(ptg_stack.top());
// if(operator_ptg)
// {
// rgce.addPtg(ptg_stack.top());
// ptg_stack.pop();
// }
// else
// {
// return false;
// }
// }
// return true;
//}
//
//
//
} // namespace XLS
......@@ -11,7 +11,7 @@ class RgbExtra;
class StringPtgParser
{
public:
const bool parseToPtgs(const std::wstring& assembled_formula, Rgce& rgce, RgbExtra& rgb, BiffStructurePtr & parent);
//const bool parseToPtgs(const std::wstring& assembled_formula, Rgce& rgce, RgbExtra& rgb, const std::wstring & tag_name);
private:
PtgStack ptg_stack;
......
......@@ -389,7 +389,7 @@ const bool SyntaxPtg::extract_PtgStr(std::wstring::const_iterator& first, std::w
// static
const bool SyntaxPtg::extract_PtgName(std::wstring::const_iterator& first, std::wstring::const_iterator last, unsigned int& out_num, BiffStructurePtr & parent)
const bool SyntaxPtg::extract_PtgName(std::wstring::const_iterator& first, std::wstring::const_iterator last, unsigned int& out_num)
{
static boost::wregex reg_name(L"^(\\w[\\w\\d.]*)([-+*/^&%<=>: ;),]|$)");
......@@ -481,7 +481,7 @@ const bool SyntaxPtg::extract_PtgRef(std::wstring::const_iterator& first, std::w
// static
const bool SyntaxPtg::extract_3D_part(std::wstring::const_iterator& first, std::wstring::const_iterator last, unsigned short& ixti, BiffStructurePtr & parent)
const bool SyntaxPtg::extract_3D_part(std::wstring::const_iterator& first, std::wstring::const_iterator last, unsigned short& ixti)
{
//static boost::wregex reg_sheets(L"^(\\w[\\w\\d.]*(:\\w[\\w\\d.]*)?)!");
//static boost::wregex reg_quoted(L"^'((''|[^]['\\/*?])*)'!");
......
......@@ -39,14 +39,14 @@ public:
static const bool extract_PtgNum(std::wstring::const_iterator& first, std::wstring::const_iterator last, std::wstring& out_str);
static const bool extract_PtgBool(std::wstring::const_iterator& first, std::wstring::const_iterator last, std::wstring& out_str);
static const bool extract_PtgStr(std::wstring::const_iterator& first, std::wstring::const_iterator last, std::wstring& out_str);
static const bool extract_PtgName(std::wstring::const_iterator& first, std::wstring::const_iterator last, unsigned int& out_num, BiffStructurePtr & parent);
static const bool extract_PtgName(std::wstring::const_iterator& first, std::wstring::const_iterator last, unsigned int& out_num);
static const bool extract_PtgRefErr(std::wstring::const_iterator& first, std::wstring::const_iterator last);
static const bool extract_PtgErr(std::wstring::const_iterator& first, std::wstring::const_iterator last, std::wstring& out_str);
static const bool extract_UndefinedName(std::wstring::const_iterator& first, std::wstring::const_iterator last);
static const bool extract_PtgArea(std::wstring::const_iterator& first, std::wstring::const_iterator last, std::wstring& out_str);
static const bool extract_PtgRef(std::wstring::const_iterator& first, std::wstring::const_iterator last, std::wstring& out_str);
static const bool extract_3D_part(std::wstring::const_iterator& first, std::wstring::const_iterator last, unsigned short& ixti, BiffStructurePtr & parent);
static const bool extract_3D_part(std::wstring::const_iterator& first, std::wstring::const_iterator last, unsigned short& ixti);
static const bool extract_PtgArray(std::wstring::const_iterator& first, std::wstring::const_iterator last, std::wstring& out_str);
......
......@@ -15,12 +15,9 @@ class XFPropColor : public BiffStructure
public:
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
private:
bool fValidRGBA;
unsigned char xclrType;
unsigned char icv;
......
......@@ -11,21 +11,6 @@ BiffStructurePtr XFPropGradientStop::clone()
return BiffStructurePtr(new XFPropGradientStop(*this));
}
//
//void XFPropGradientStop::toXML(BiffStructurePtr & parent)
//{
// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent);
// own_tag->setAttribute(L"numPosition", numPosition);
// color.toXML(own_tag);
//}
//
//const bool XFPropGradientStop::fromXML(BiffStructurePtr & parent)
//{
//#pragma message("####################### XFPropGradientStop record has no BiffStructure::fromXML() implemented")
// Log::error(" Error!!! XFPropGradientStop record has no BiffStructure::fromXML() implemented.");
// return false;
//}
void XFPropGradientStop::store(CFRecord& record)
{
......
......@@ -14,12 +14,9 @@ class XFPropGradientStop : public BiffStructure
public:
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
private:
double numPosition;
XFPropColor color;
};
......
......@@ -11,22 +11,6 @@ BiffStructurePtr XFProps::clone()
return BiffStructurePtr(new XFProps(*this));
}
//
//void XFProps::toXML(BiffStructurePtr & parent)
//{
// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent);
// for(size_t i = 0; i < xfPropArray.size(); ++i)
// {
// xfPropArray[i].toXML(own_tag);
// }
//}
//
//const bool XFProps::fromXML(BiffStructurePtr & parent)
//{
//#pragma message("####################### XFProps record has no BiffStructure::fromXML() implemented")
// Log::error(" Error!!! XFProps record has no BiffStructure::fromXML() implemented.");
// return false;
//}
void XFProps::store(CFRecord& record)
......
......@@ -14,8 +14,6 @@ class XFProps : public BiffStructure
public:
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
......
......@@ -11,23 +11,6 @@ BiffStructurePtr XORObfuscation::clone()
return BiffStructurePtr(new XORObfuscation(*this));
}
//
//void XORObfuscation::toXML(BiffStructurePtr & parent)
//{
// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent);
//
// own_tag->setAttribute(L"key", key);
// own_tag->setAttribute(L"verificationBytes", STR::int2hex_wstr(verificationBytes, sizeof(verificationBytes)).c_str());
//}
//
//
//const bool XORObfuscation::fromXML(BiffStructurePtr & parent)
//{
//#pragma message("####################### XORObfuscation record has no BiffStructure::fromXML() implemented")
// Log::error(" Error!!! XORObfuscation record has no BiffStructure::fromXML() implemented.");
// return false;
//}
void XORObfuscation::store(CFRecord& record)
{
......
......@@ -15,12 +15,9 @@ class XORObfuscation : public BiffStructure
public:
BiffStructurePtr clone();
//virtual void toXML(BiffStructurePtr & parent);
//virtual const bool fromXML(BiffStructurePtr & parent);
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
private:
unsigned short key;
unsigned short verificationBytes;
};
......
......@@ -97,7 +97,14 @@ int CELL_GROUP::serialize(std::wostream & stream)
CP_XML_ATTR(L"ht", row->miyRw / 20.);
CP_XML_ATTR(L"customHeight", true);
}
if ((row->iOutLevel.value()) && (row->iOutLevel > 0))
{
CP_XML_ATTR(L"outlineLevel", row->iOutLevel);
}
if ((row->fCollapsed.value()) && (row->fCollapsed))
{
CP_XML_ATTR(L"collapsed", row->fCollapsed);
}
std::list<XLS::BaseObjectPtr>::iterator it_cell = current_cell_start;
while(true)
{
......
......@@ -73,6 +73,19 @@ int COLUMNS::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"style", column_info->ixfe - cellStyleXfs_count);
}
if ((column_info->fBestFit.value()) && (column_info->fBestFit))
{
CP_XML_ATTR(L"bestFit", column_info->fBestFit);
}
if ((column_info->fHidden.value()) && (column_info->fHidden))
{
CP_XML_ATTR(L"hidden", column_info->fHidden);
}
if ((column_info->iOutLevel.value()) && (column_info->iOutLevel>0))
{
CP_XML_ATTR(L"outlineLevel", column_info->iOutLevel);
}
}
}
}
......
......@@ -9,6 +9,7 @@
#include <Logic/Biff_records/String.h>
#include <Logic/Biff_records/Continue.h>
#include <utils.h>
#include <simple_xml_writer.h>
namespace XLS
......@@ -107,23 +108,23 @@ int FORMULA::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"s", formula->cell.ixfe - cellStyleXfs_count);
}
CP_XML_NODE(L"f")
{
CP_XML_STREAM() << formula->formula.getAssembledFormula(BiffStructurePtr());
}
switch (formula->val.getType())
{
case 0: CP_XML_ATTR(L"t", L"str"); break;
case 1: CP_XML_ATTR(L"t", L"b"); break;
case 2: CP_XML_ATTR(L"t", L"e"); break;
case 4:
}
CP_XML_NODE(L"f")
{
CP_XML_STREAM() << xml::utils::replace_text_to_xml(formula->formula.getAssembledFormula());
}
std::wstring str_val = formula->val.getValue();
if (!str_val.empty())
{
CP_XML_NODE(L"v")
{
CP_XML_STREAM() << STR::double2str(formula->val.data.xnum);
CP_XML_STREAM() << str_val;
}
}break;
}
}
}
......
......@@ -5,6 +5,9 @@
#include <Logic/Biff_records/NameFnGrp12.h>
#include <Logic/Biff_records/NamePublish.h>
#include <utils.h>
#include <simple_xml_writer.h>
namespace XLS
{;
......@@ -28,18 +31,45 @@ BaseObjectPtr LBL::clone()
// LBL = Lbl [NameCmt] [NameFnGrp12] [NamePublish]
const bool LBL::loadContent(BinProcessor& proc)
{
Lbl lbl;
if(!proc.mandatory(lbl))
if(!proc.mandatory<Lbl>())
{
return false;
}
XLUnicodeStringNoCch name = lbl.getName();
proc.optional(NameCmt(name));
m_Lbl = elements_.back();
elements_.pop_back();
Lbl *lbl = dynamic_cast<Lbl*>(m_Lbl.get());
XLUnicodeStringNoCch name = lbl->getName();
if (proc.optional(NameCmt(name)))
{
}
proc.optional<NameFnGrp12>();
proc.optional<NamePublish>();
GlobalWorkbookInfoPtr global_info_ = proc.getGlobalWorkbookInfo();
global_info_->defineNames.push_back(name);
return true;
}
int LBL::serialize(std::wostream & stream)
{
Lbl *lbl = dynamic_cast<Lbl*>(m_Lbl.get());
if (lbl == NULL) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"definedName")
{
CP_XML_ATTR(L"name", lbl->Name_bin.value());
CP_XML_STREAM() << xml::utils::replace_text_to_xml(lbl->rgce.getAssembledFormula());
}
}
return 0;
}
} // namespace XLS
......@@ -18,7 +18,12 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & stream);
static const ElementType type = typeLBL;
BaseObjectPtr m_Lbl;
};
} // namespace XLS
......
......@@ -99,6 +99,7 @@ int PAGESETUP::serialize(std::wostream & stream)
{
Setup * setup = dynamic_cast<Setup*>(m_Setup.get());
bool headerFooter = false;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"pageMargins")
......@@ -106,10 +107,16 @@ int PAGESETUP::serialize(std::wostream & stream)
if (setup)
{
if (setup->numHdr.value())
{
CP_XML_ATTR(L"header", setup->numHdr);
headerFooter = true;
}
if (setup->numFtr.value())
{
CP_XML_ATTR(L"footer", setup->numFtr);
headerFooter = true;
}
}
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
{
......@@ -143,6 +150,13 @@ int PAGESETUP::serialize(std::wostream & stream)
}
}
}
if (headerFooter)
{
//CP_XML_NODE(L"headerFooter"){}
}
CP_XML_NODE(L"pageSetup")
{
}
......
......@@ -30,6 +30,8 @@ public:
unsigned int last_AXES_id;
const static unsigned int initial_AXES_id = 0;
std::vector<std::wstring> defineNames;
};
typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr;
......
......@@ -110,6 +110,8 @@ WORKBOOK = BOF WORKBOOKCONTENT
*/
const bool GlobalsSubstream::loadContent(BinProcessor& proc)
{
int count = 0;
if(!proc.mandatory<BOF>())
{
return false;
......@@ -169,12 +171,33 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
proc.optional<Country>();
proc.repeated<SUPBOOK>(0, 0);
proc.repeated<LBL>(0, 0);
count = proc.repeated<LBL>(0, 0);
while(count > 0)
{
m_LBL.insert(m_LBL.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.repeated<RTD>(0, 0);
proc.optional<RecalcId>();
proc.repeated<HFPicture>(0, 0); /////
proc.repeated(MSODRAWINGGROUP(false), 0, 0);
count = proc.repeated<HFPicture>(0, 0);
while(count > 0)
{
m_HFPicture.insert(m_HFPicture.begin(), elements_.back());
elements_.pop_back();
count--;
}
count = proc.repeated(MSODRAWINGGROUP(false), 0, 0);
while(count > 0)
{
m_MSODRAWINGGROUP.insert(m_MSODRAWINGGROUP.begin(), elements_.back());
elements_.pop_back();
count--;
}
if (proc.optional(SHAREDSTRINGS(code_page_)))
{
......
......@@ -30,6 +30,10 @@ public:
BaseObjectPtr m_Template;
BaseObjectPtr m_SHAREDSTRINGS;
std::vector<BaseObjectPtr> m_HFPicture;
std::vector<BaseObjectPtr> m_LBL;
std::vector<BaseObjectPtr> m_MSODRAWINGGROUP;
unsigned short code_page_;
};
......
......@@ -16,6 +16,7 @@
#include "../XlsFormat/Logic/Biff_unions/COLUMNS.h"
#include "../XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.h"
#include "../XlsFormat/Logic/Biff_unions/HLINK.h"
#include "../XlsFormat/Logic/Biff_unions/LBL.h"
#include <Logic/Biff_records/HLink.h>
......@@ -159,6 +160,11 @@ void XlsConverter::convert(XLS::BaseObject *xls_unknown)
XLS::HLINK * hlink = dynamic_cast<XLS::HLINK *>(xls_unknown);
convert(hlink);
}break;
case XLS::typeLBL:
{
XLS::LBL * lbl = dynamic_cast<XLS::LBL *>(xls_unknown);
convert(lbl);
}break;
case XLS::typeAnyObject:
default:
{
......@@ -249,6 +255,11 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
convert((XLS::THEME*)global->m_Theme.get());
convert((XLS::SHAREDSTRINGS*)global->m_SHAREDSTRINGS.get());
for (long i = 0 ; i < global->m_LBL.size(); i++)
{
convert(global->m_LBL[i].get());
}
}
typedef boost::unordered_map<XLS::FillInfo, int> mapFillInfo;
......@@ -339,9 +350,15 @@ void XlsConverter::convert(XLS::HLINK * HLINK_)
if (display.empty()) display = target;
xlsx_context->get_table_context().add_hyperlink( hLink->ref8.toString(), target, display);
}
void XlsConverter::convert(XLS::LBL * def_name)
{
if (def_name == NULL) return;
def_name->serialize(xlsx_context->defined_names());
}
void XlsConverter::convert(XLS::THEME* theme)
{
if (theme == NULL) return;
......
......@@ -32,6 +32,7 @@ namespace XLS
class THEME;
class SHAREDSTRINGS;
class HLINK;
class LBL;
}
......@@ -64,6 +65,7 @@ private:
void convert(XLS::THEME * theme);
void convert(XLS::SHAREDSTRINGS * sharedstrings);
void convert(XLS::HLINK * hlink);
void convert(XLS::LBL * def_name);
std::wstring GetTargetMoniker(XLS::BiffStructure *moniker);
......
......@@ -161,7 +161,10 @@ void xlsx_conversion_context::end_document()
CP_XML_STREAM() << workbook_content.str();
}
//get_xlsx_defined_names().xlsx_serialize(CP_XML_STREAM());
CP_XML_NODE(L"definedNames")
{
CP_XML_STREAM() << xlsx_defined_names_.str();
}
}
}
......
......@@ -65,17 +65,19 @@ public:
// void process_styles();
std::wostream & shared_strings() {return xlsx_shared_strings_;}
std::wostream & shared_strings() { return xlsx_shared_strings_; }
std::wostream & defined_names() { return xlsx_defined_names_; }
xlsx_text_context & get_text_context() { return xlsx_text_context_; }
xlsx_table_context & get_table_context() { return xlsx_table_context_; }
xlsx_xml_worksheet & current_sheet();
// const xlsx_table_context & get_table_context() const { return xlsx_table_context_; }
// xlsx_style_manager & get_style_manager() { return xlsx_style_; }
xlsx_xml_worksheet & current_sheet();
//
// oox_chart_context & current_chart();
// num_format_context & get_num_format_context() { return num_format_context_; }
// size_t get_default_cell_style() const { return default_style_; }
// xlsx_defined_names & get_xlsx_defined_names() { return xlsx_defined_names_; }
// xlsx_table_metrics & get_table_metrics();
// xlsx_drawing_context & get_drawing_context();
// xlsx_drawing_context_handle & get_drawing_context_handle();
......@@ -101,10 +103,11 @@ private:
//size_t default_style_;
mediaitems mediaitems_;
//xlsx_defined_names xlsx_defined_names_;
xlsx_table_context xlsx_table_context_;
xlsx_text_context xlsx_text_context_;
std::wstringstream xlsx_shared_strings_;
std::wstringstream xlsx_defined_names_;
//xlsx_drawing_context_handle xlsx_drawing_context_handle_;
//xlsx_comments_context_handle xlsx_comments_context_handle_;
......
......@@ -61,6 +61,8 @@ public:
}
void serialize(std::wostream & _Wostream) const
{
if (records_.size() < 1) return;
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"hyperlinks")
......
......@@ -141,7 +141,6 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
}
CP_XML_STREAM() << impl_->pageProperties_.str();
//CP_XML_NODE(L"headerFooter){}
//CP_XML_NODE(L"rowBreaks){}
......
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