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

XlsFile2

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64193 954022d7-b5bf-4e40-9824-e11837661b57
parent 4412b31a
......@@ -64,15 +64,20 @@ void SST::readFields(CFRecord& record)
long unique = cstUnique;
std::list<CFRecordPtr>& recs = continue_records[rt_Continue];
int count = 0 ;
while(!record.isEOF() || !recs.empty())
{
XLUnicodeRichExtendedStringPtr element(new XLUnicodeRichExtendedString(recs));
element->set_code_page(code_page_);
if(record.isEOF()) // If the break is at the XLUnicodeRichExtendedString boundary
{
element->appendNextContinue(record, false);
}
record >> *element;
rgb.push_back(element);
count++;
}
}
......
......@@ -66,10 +66,19 @@ void BiffString::load(CFRecord& record)
}
void BiffString::load(CFRecord& record, const size_t cch, const bool is_wide)
void BiffString::load(CFRecord& record, const size_t cch1, const bool is_wide1)
{
bool is_wide = is_wide1;
size_t cch = cch1;
size_t raw_length = cch << (is_wide ? 1 : 0);
record.checkFitRead(raw_length);
//record.checkFitRead(raw_length);
if (record.getDataSize() - record.getRdPtr() < raw_length)
{
raw_length = record.getDataSize() - record.getRdPtr();
cch = is_wide ? raw_length/2 : raw_length ;
}
if(is_wide)
{
......
......@@ -23,7 +23,11 @@ void ExtRst::load(CFRecord& record)
record.skipNunBytes(2); // reserved
record >> cb;
size_t data_start = record.getRdPtr();
record >> phs >> rphssub;
record >> phs;
rphssub.sz = cb;
record >> rphssub;
for(unsigned short i = 0; i < rphssub.getRunsNumber(); ++i)
{
PhRuns run;
......
......@@ -35,7 +35,9 @@ void RPHSSub::store(CFRecord& record)
void RPHSSub::load(CFRecord& record)
{
unsigned short cch;
record >> crun >> cch >> st;
record >> crun >> cch;
record >> st;
}
......
......@@ -24,6 +24,8 @@ public:
unsigned short crun;
LPWideString st;
int sz;
};
} // namespace XLS
......
......@@ -19,7 +19,8 @@ XLUnicodeRichExtendedString XLUnicodeRichExtendedString::operator=(const XLUnico
XLUnicodeRichExtendedString::XLUnicodeRichExtendedString(std::list<CFRecordPtr>& cont_recs)
: cont_recs_(cont_recs),
fHighByte(true)
fHighByte(true),
code_page_(0)
{
}
......@@ -45,6 +46,7 @@ const bool XLUnicodeRichExtendedString::appendNextContinue(CFRecord& record, con
XLUnicodeRichExtendedString::~XLUnicodeRichExtendedString()
{
code_page_ = 0;
}
......@@ -187,6 +189,9 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
{
pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo();
if (code_page_== 0)
code_page_ = pGlobalWorkbookInfoPtr ->CodePage;
unsigned short cch;
unsigned char flags;
record >> cch >> flags;
......@@ -202,6 +207,15 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
if(fExtSt)
{
record >> cbExtRst;
if (cbExtRst < 0)
{
fExtSt = false;
fRichSt = true;
record.RollRdPtrBack(4);
record >> cRun;
}
}
if(!record.checkFitReadSafe(static_cast<size_t>(cch) << (fHighByte ? 1 : 0)))
......@@ -211,7 +225,8 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
std::wstring str_full(str_);
do
{
appendNextContinue(record, true); // fHighByte changes here
if (appendNextContinue(record, true) == false) // fHighByte changes here
break; //dicionario de kanji.xls
num_symbols = (std::min)(cch - str_full.length(), (record.getDataSize() - record.getRdPtr()) >> (fHighByte ? 1 : 0));
loadSymbols(record, num_symbols, fHighByte); // cch has changed, fHighByte has changed
str_full += str_;
......@@ -232,7 +247,7 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
rgRun.push_back(format);
}
if(fExtSt)
if(fExtSt && cbExtRst > 0)
{
record >> extRst;
}
......
......@@ -25,6 +25,8 @@ public:
int serialize (std::wostream & _stream);
int serialize_rPr (std::wostream & _stream, int iFmt);
void set_code_page(short cp) {code_page_ = cp;}
virtual void load (CFRecord& record);
virtual void store (CFRecord& record);
......@@ -50,6 +52,8 @@ public:
ExtRst extRst;
std::list<CFRecordPtr>& cont_recs_;
bool mark_set_start;
unsigned short code_page_ ;
};
typedef boost::shared_ptr<XLUnicodeRichExtendedString> XLUnicodeRichExtendedStringPtr;
......
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