Commit c2c384d8 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov
parent 4d3c7799
......@@ -33,33 +33,51 @@ BaseObjectPtr FORMATTING::clone()
//FORMATTING = 1*510Font 8*218Format XFS *DXF STYLES [TABLESTYLES] [Palette] [ClrtClient]
const bool FORMATTING::loadContent(BinProcessor& proc)
{
//todooo - 2
int count = 0;
proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally at least one Font is mandatory)
count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally at least one Font is mandatory)
while(count > 0)
{
m_Fonts.insert(m_Fonts.begin(), elements_.back());
elements_.pop_back();
count--;
}
//---------------------------------------------------------------------------------------------------
count = proc.repeated<Format>(0, 218); // Originally: proc.repeated<Format>(8, 218);
while(count > 0)
{
m_Formats.insert(m_Formats.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally Font follows by Format)
//----------------------------------------------------------------------------------------------------
count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally Font follows by Format)
while(count > 0)
{
m_Fonts.insert(m_Fonts.begin(), elements_.back());
elements_.pop_back();
count--;
}
//----------------------------------------------------------------------------------------------------
if (proc.mandatory<XFS>())
{
m_XFS = elements_.back();
elements_.pop_back();
}
proc.repeated<DXF>(0, 0);
//----------------------------------------------------------------------------------------------------
if (proc.optional<STYLES>())
{
m_Styles = elements_.back();
elements_.pop_back();
}
//----------------------------------------------------------------------------------------------------
proc.optional<TABLESTYLES>();
proc.optional<Palette>();
if (proc.optional<Palette>())
{
m_Palette = elements_.back();
elements_.pop_back();
}
proc.optional<ClrtClient>();
return true;
......
......@@ -23,6 +23,8 @@ public:
BaseObjectPtr m_Styles;
BaseObjectPtr m_XFS;
std::vector<BaseObjectPtr> m_Formats;
std::vector<BaseObjectPtr> m_Fonts;
BaseObjectPtr m_Palette;
};
} // namespace XLS
......
......@@ -42,9 +42,8 @@ const int BinProcessor::repeated(BaseObject& object, const int fromN, const int
if(!optional(*object.clone()))
{
break;
}
}else count++;
at_least_one_read = true;
if (count == 0) count = -1;
}
return count;
}
......
......@@ -45,20 +45,6 @@ BaseObjectPtr WorkbookStreamObject::clone()
const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
{
/*try
{
while(1)
{
proc.mandatory<AnyObject>();
}
}
catch(EXCEPT::RT::EndOfStreamReached&)
{
}
return true;*/
bool to_continue = true;
unsigned __int16 substream_type;
......@@ -83,6 +69,8 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
if(proc.mandatory(GlobalsSubstream(code_page_)))
{
GlobalsSubstream_found = true;
m_GlobalsSubstream = elements_.back();
elements_.pop_back();
}
}
break;
......@@ -97,6 +85,8 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
if(proc.mandatory(WorksheetSubstream(ws_index++)))
{
WorksheetSubstream_found = true;
m_WorksheetSubstream.push_back(elements_.back());
elements_.pop_back();
}
}
break;
......@@ -111,6 +101,8 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
if(proc.mandatory<ChartSheetSubstream>())
{
WorksheetSubstream_found = true;
m_ChartSheetSubstream.push_back(elements_.back());
elements_.pop_back();
}
}
break;
......@@ -125,6 +117,8 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
if(proc.mandatory<MacroSheetSubstream>())
{
WorksheetSubstream_found = true;
m_MacroSheetSubstream.push_back(elements_.back());
elements_.pop_back();
}
}
break;
......
......@@ -7,6 +7,17 @@
namespace XLS
{;
class GlobalsSubstream;
class WorksheetSubstream;
class ChartSheetSubstream;
class MacroSheetSubstream;
typedef boost::shared_ptr<GlobalsSubstream> GlobalsSubstreamPtr;
typedef boost::shared_ptr<WorksheetSubstream> WorksheetSubstreamPtr;
typedef boost::shared_ptr<ChartSheetSubstream> ChartSheetSubstreamPtr;
typedef boost::shared_ptr<BaseObject> MacroSheetSubstreamPtr;
// Logical representation of Workbook stream
class WorkbookStreamObject: public CompositeObject
{
......@@ -27,6 +38,11 @@ public:
static const ElementType type = typeWorkbookStreamObject;
BaseObjectPtr m_GlobalsSubstream;
std::vector<BaseObjectPtr> m_WorksheetSubstream;
std::vector<BaseObjectPtr> m_ChartSheetSubstream;
std::vector<BaseObjectPtr> m_MacroSheetSubstream;
unsigned __int16 code_page_;
};
......
......@@ -185,7 +185,7 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
void XlsConverter::convert(XLS::GlobalsSubstream* elem)
{
for (std::list<XLS::BaseObjectPtr>::iterator it = woorkbook->elements_.begin(); it != woorkbook->elements_.end(); it++)
for (std::list<XLS::BaseObjectPtr>::iterator it = elem->elements_.begin(); it != elem->elements_.end(); it++)
{
convert(it->get());
}
......
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