Commit 055a0257 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - ...

parent 1e2e5996
...@@ -70,7 +70,7 @@ const bool BiffRecord::read(CFStreamCacheReader& reader, BaseObject* parent, con ...@@ -70,7 +70,7 @@ const bool BiffRecord::read(CFStreamCacheReader& reader, BaseObject* parent, con
size_t rdPtr = record->getRdPtr(); size_t rdPtr = record->getRdPtr();
size_t typeId = getTypeId(); size_t typeId = getTypeId();
if(record->getDataSize() != record->getRdPtr() && getTypeId() != rt_ANY_TYPE && getTypeId() != rt_MsoDrawing) if(record->getDataSize() != record->getRdPtr() && getTypeId() != rt_ANY_TYPE/* && getTypeId() != rt_MsoDrawing*/)
{ {
Log::warning(STR::int2str(record->getDataSize() - record->getRdPtr(), 10) + " unsigned chars were not processed while reading from " + record->getTypeString()); Log::warning(STR::int2str(record->getDataSize() - record->getRdPtr(), 10) + " unsigned chars were not processed while reading from " + record->getTypeString());
} }
......
...@@ -40,8 +40,7 @@ namespace ODRAW ...@@ -40,8 +40,7 @@ namespace ODRAW
{ {
OfficeArtClientAnchorSheet::OfficeArtClientAnchorSheet() OfficeArtClientAnchorSheet::OfficeArtClientAnchorSheet() : OfficeArtRecord(0x00, ClientAnchor)
: OfficeArtRecord(0x00, ClientAnchor)
{ {
_x = _y = _cx = _cy = 0; _x = _y = _cx = _cy = 0;
} }
......
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
namespace ODRAW namespace ODRAW
{ {
OfficeArtDgContainer::OfficeArtDgContainer(const OfficeArtClientAnchorType anchor_type) OfficeArtDgContainer::OfficeArtDgContainer(const OfficeArtClientAnchorType anchor_type) : OfficeArtContainer(0x0F, DgContainer, anchor_type)
: OfficeArtContainer(0x0F, DgContainer, anchor_type)
{ {
} }
...@@ -73,6 +72,14 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record) ...@@ -73,6 +72,14 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
{ {
try try
{ {
OfficeArtRecordHeader rh_test;
record >> rh_test;
record.RollRdPtrBack(8);//sizeof(OfficeArtRecordHeader)
if ((rh_test.recType & 0xF000) != 0xF000)
{
return;
}
OfficeArtContainer::loadFields(record); OfficeArtContainer::loadFields(record);
}catch(...) }catch(...)
{ {
......
...@@ -41,8 +41,7 @@ namespace XLS ...@@ -41,8 +41,7 @@ namespace XLS
{ {
PtgArea3d::PtgArea3d(const CellRef& cell_base_ref_init) PtgArea3d::PtgArea3d(const CellRef& cell_base_ref_init) : cell_base_ref(cell_base_ref_init)
: cell_base_ref(cell_base_ref_init)
{ {
} }
...@@ -138,7 +137,12 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f ...@@ -138,7 +137,12 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
if (!link.empty() && !range_ref.empty()) if (!link.empty() && !range_ref.empty())
link += L"!"; link += L"!";
ptg_stack.push(link + range_ref); // full_ref ??? if (full_ref && link.empty()) //4673306.xls defined name "Категория"
{
link = L"#REF!";
}
ptg_stack.push(link + range_ref);
} }
} }
......
...@@ -42,9 +42,7 @@ PtgErr::PtgErr() ...@@ -42,9 +42,7 @@ PtgErr::PtgErr()
} }
PtgErr::PtgErr(const std::wstring str) PtgErr::PtgErr(const std::wstring str) : err(str), OperandPtg(fixed_id)
: err(str),
OperandPtg(fixed_id)
{ {
} }
......
...@@ -41,8 +41,7 @@ namespace XLS ...@@ -41,8 +41,7 @@ namespace XLS
{ {
PtgRef3d::PtgRef3d(const CellRef& cell_base_ref_init) PtgRef3d::PtgRef3d(const CellRef& cell_base_ref_init) : cell_base_ref(cell_base_ref_init)
: cell_base_ref(cell_base_ref_init)
{ {
} }
...@@ -133,7 +132,11 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu ...@@ -133,7 +132,11 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
if (!link.empty() && !cell_ref.empty()) if (!link.empty() && !cell_ref.empty())
link += L"!"; link += L"!";
ptg_stack.push(link + cell_ref); // full_ref ??? if (full_ref && link.empty()) //Stock symbols comparison1.xls defined name "check_phrase"
{
link = L"#REF!";
}
ptg_stack.push(link + cell_ref);
} }
} }
......
...@@ -77,7 +77,7 @@ const bool COLUMNS::loadContent(BinProcessor& proc) ...@@ -77,7 +77,7 @@ const bool COLUMNS::loadContent(BinProcessor& proc)
for (int i = column_info->colFirst; i <= column_info->colLast; i++) for (int i = column_info->colFirst; i <= column_info->colLast; i++)
{ {
global_info_->sheets_info.back().customColumnsWidth.insert(std::make_pair(i, column_info->coldx / 256.)); global_info_->sheets_info[global_info_->current_sheet - 1].customColumnsWidth.insert(std::make_pair(i, column_info->coldx / 256.));
//else if (def_ok) //else if (def_ok)
//{ //{
// global_info_->sheets_info.back().customColumnsWidth.insert(std::make_pair(i, global_info_->sheets_info.back().defaultColumnWidth)); // global_info_->sheets_info.back().customColumnsWidth.insert(std::make_pair(i, global_info_->sheets_info.back().defaultColumnWidth));
......
...@@ -96,21 +96,21 @@ const bool METADATA::loadContent(BinProcessor& proc) ...@@ -96,21 +96,21 @@ const bool METADATA::loadContent(BinProcessor& proc)
int count2 = proc.repeated<MDXSTR>(0, 0); int count2 = proc.repeated<MDXSTR>(0, 0);
while(!elements_.empty()) while(!elements_.empty())
{ {
m_arMDXSTR.insert(m_arMDTINFO.begin(), elements_.back()); m_arMDXSTR.insert(m_arMDXSTR.begin(), elements_.back());
elements_.pop_back(); elements_.pop_back();
} }
int count3 = proc.repeated<Parenthesis_METADATA_1>(0, 0); int count3 = proc.repeated<Parenthesis_METADATA_1>(0, 0);
while(!elements_.empty()) while(!elements_.empty())
{ {
m_arMDTSET.insert(m_arMDTINFO.begin(), elements_.back()); m_arMDTSET.insert(m_arMDTSET.begin(), elements_.back());
elements_.pop_back(); elements_.pop_back();
} }
int count4 = proc.repeated<MDBLOCK>(0, 0); int count4 = proc.repeated<MDBLOCK>(0, 0);
while(!elements_.empty()) while(!elements_.empty())
{ {
m_arMDBLOCK.insert(m_arMDTINFO.begin(), elements_.back()); m_arMDBLOCK.insert(m_arMDBLOCK.begin(), elements_.back());
elements_.pop_back(); elements_.pop_back();
} }
if (count1 > 0 || count2 > 0 || count3 > 0 || count4 > 0) if (count1 > 0 || count2 > 0 || count3 > 0 || count4 > 0)
......
...@@ -68,7 +68,7 @@ const bool XFS::loadContent(BinProcessor& proc) ...@@ -68,7 +68,7 @@ const bool XFS::loadContent(BinProcessor& proc)
int cellXfs_count = 0; int cellXfs_count = 0;
XF xf(cell_xf_current_id, style_xf_current_id); XF xf(cell_xf_current_id, style_xf_current_id);
int count = proc.repeated(xf ,16, 0); int count = proc.repeated(xf , 0/*16*/, 0); // "Stock symbols comparison1.xls" (второй FORMATING)
int ind = 0; int ind = 0;
while (count > 0 && elements_.size() > 0) while (count > 0 && elements_.size() > 0)
......
...@@ -127,6 +127,7 @@ CHARTSHEETCONTENT = [WriteProtect] [SheetExt] [WebPub] *HFPicture PAGESETUP Prin ...@@ -127,6 +127,7 @@ CHARTSHEETCONTENT = [WriteProtect] [SheetExt] [WebPub] *HFPicture PAGESETUP Prin
const bool ChartSheetSubstream::loadContent(BinProcessor& proc) const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
{ {
global_info_ = proc.getGlobalWorkbookInfo(); global_info_ = proc.getGlobalWorkbookInfo();
global_info_->current_sheet = ws_index_ + 1;
int count = 0 ; int count = 0 ;
......
...@@ -98,8 +98,7 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc) ...@@ -98,8 +98,7 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
return false; return false;
} }
global_info_ = proc.getGlobalWorkbookInfo(); global_info_ = proc.getGlobalWorkbookInfo();
global_info_->current_sheet = ws_index_ + 1;
global_info_->current_sheet = global_info_->sheets_info.size();
proc.optional<Uncalced>(); proc.optional<Uncalced>();
proc.mandatory<Index>(); proc.mandatory<Index>();
......
...@@ -104,8 +104,7 @@ WORKSHEET = BOF WORKSHEETCONTENT ...@@ -104,8 +104,7 @@ WORKSHEET = BOF WORKSHEETCONTENT
const bool WorksheetSubstream::loadContent(BinProcessor& proc) const bool WorksheetSubstream::loadContent(BinProcessor& proc)
{ {
global_info_ = proc.getGlobalWorkbookInfo(); global_info_ = proc.getGlobalWorkbookInfo();
global_info_->current_sheet = ws_index_ + 1;
global_info_->current_sheet = global_info_->sheets_info.size();
global_info_->cmt_rules = 0; global_info_->cmt_rules = 0;
......
...@@ -1992,9 +1992,9 @@ void XlsConverter::convert_transform(std::vector<ODRAW::OfficeArtFOPTEPtr> & pro ...@@ -1992,9 +1992,9 @@ void XlsConverter::convert_transform(std::vector<ODRAW::OfficeArtFOPTEPtr> & pro
case 0x0004: case 0x0004:
{ {
double d = props[i]->op / 65536.; double d = props[i]->op / 65536.;
d *= 60000; //60 000 per 1 gr - 19.5.5 oox if (d < 0) d += 360;
xlsx_context->get_drawing_context().set_rotation((int)d); xlsx_context->get_drawing_context().set_rotation(d);
}break; }break;
} }
} }
......
...@@ -550,10 +550,10 @@ void xlsx_drawing_context::end_group() ...@@ -550,10 +550,10 @@ void xlsx_drawing_context::end_group()
{ {
if (current_level < 1) return; if (current_level < 1) return;
serialize_group();
std::vector<_drawing_state_ptr>* cur_states = NULL; std::vector<_drawing_state_ptr>* cur_states = NULL;
for (size_t i = 0; i < current_drawing_states->size(); i++) for (size_t i = 0; i < current_drawing_states->size(); i++)
{
if (!current_drawing_states->empty())
{ {
int level = current_level; int level = current_level;
cur_states = current_drawing_states; cur_states = current_drawing_states;
...@@ -576,6 +576,8 @@ void xlsx_drawing_context::end_group() ...@@ -576,6 +576,8 @@ void xlsx_drawing_context::end_group()
cur_states = cur_states->front()->parent_drawing_states; cur_states = cur_states->front()->parent_drawing_states;
} }
} }
}
serialize_group();
current_drawing_states = current_drawing_states->front()->parent_drawing_states; current_drawing_states = current_drawing_states->front()->parent_drawing_states;
...@@ -770,6 +772,29 @@ void xlsx_drawing_context::end_drawing() ...@@ -770,6 +772,29 @@ void xlsx_drawing_context::end_drawing()
if (current_drawing_states->back()->type == external_items::typeGroup) return; if (current_drawing_states->back()->type == external_items::typeGroup) return;
//std::vector<_drawing_state_ptr>* cur_states = current_drawing_states;;
//
//int level = current_level;
//while (level > 0)
//{
// _drawing_state_ptr & drawing_state = cur_states->front();
// double kf_x = (double)drawing_state->child_anchor.cx / drawing_state->group_anchor.cx;
// double kf_y = (double)drawing_state->child_anchor.cy / drawing_state->group_anchor.cy;
// current_drawing_states->back()->child_anchor.cx *= kf_x;
// current_drawing_states->back()->child_anchor.cy *= kf_y;
//
// current_drawing_states->back()->child_anchor.x = drawing_state->group_anchor.x +
// (long)(kf_x * (current_drawing_states->back()->child_anchor.x - drawing_state->group_anchor.x));
// current_drawing_states->back()->child_anchor.y = drawing_state->group_anchor.y +
// (long)(kf_y * (current_drawing_states->back()->child_anchor.y - drawing_state->group_anchor.y));
// level--;
// cur_states = cur_states->front()->parent_drawing_states;
//}
end_drawing(current_drawing_states->back()); end_drawing(current_drawing_states->back());
if ( current_drawing_states->back()->type == external_items::typeComment || if ( current_drawing_states->back()->type == external_items::typeComment ||
...@@ -794,6 +819,13 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state) ...@@ -794,6 +819,13 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
if (drawing_state->id < 0) if (drawing_state->id < 0)
drawing_state->id = count_object + 0x20000; drawing_state->id = count_object + 0x20000;
if ( current_level > 0 && drawing_state->rotation > 0 && ((int)drawing_state->rotation % 90 == 0))
{
int v = drawing_state->child_anchor.cx;
drawing_state->child_anchor.cx = drawing_state->child_anchor.cy;
drawing_state->child_anchor.cy = v;
}
if ( drawing_state->type == external_items::typeImage || if ( drawing_state->type == external_items::typeImage ||
( drawing_state->type == external_items::typeShape && drawing_state->shape_id == msosptPictureFrame )) ( drawing_state->type == external_items::typeShape && drawing_state->shape_id == msosptPictureFrame ))
{ {
...@@ -993,10 +1025,6 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat ...@@ -993,10 +1025,6 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat
{ {
CP_XML_ATTR(L"stroked", L"f"); CP_XML_ATTR(L"stroked", L"f");
} }
if (drawing_state->line.fill.type == fillNone)
{
CP_XML_ATTR(L"stroked", L"f");
}
if (drawing_state->fill.type == fillNone) if (drawing_state->fill.type == fillNone)
{ {
CP_XML_ATTR(L"filled", L"f"); CP_XML_ATTR(L"filled", L"f");
...@@ -1009,10 +1037,10 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat ...@@ -1009,10 +1037,10 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat
CP_XML_ATTR(L"on", L"t"); CP_XML_ATTR(L"on", L"t");
} }
CP_XML_NODE(L"v:wrap") //CP_XML_NODE(L"v:wrap")
{ //{
CP_XML_ATTR(L"v:type", L"none"); // CP_XML_ATTR(L"v:type", L"none");
} //}
CP_XML_NODE(L"v:fill") CP_XML_NODE(L"v:fill")
{ {
...@@ -1074,6 +1102,17 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat ...@@ -1074,6 +1102,17 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat
CP_XML_STREAM() << drawing_state->text.vml_content; CP_XML_STREAM() << drawing_state->text.vml_content;
} }
} }
if (drawing_state->type_control == 0x000b)
{
CP_XML_NODE(L"v:textbox")
{
CP_XML_ATTR(L"o:singleclick", L"f");
CP_XML_NODE(L"div")
{
CP_XML_ATTR(L"style", L"text-align:left");
}
}
}
CP_XML_NODE(L"x:ClientData") CP_XML_NODE(L"x:ClientData")
{ {
switch(drawing_state->type_control) switch(drawing_state->type_control)
...@@ -1118,8 +1157,12 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat ...@@ -1118,8 +1157,12 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat
} }
} }
CP_XML_NODE(L"x:AutoFill") {CP_XML_CONTENT("False");} CP_XML_NODE(L"x:AutoFill") {CP_XML_CONTENT("False");}
//if (drawing_state->type_control != 0x000b)
{
CP_XML_NODE(L"x:Row") {CP_XML_CONTENT(drawing_state->object.row);} CP_XML_NODE(L"x:Row") {CP_XML_CONTENT(drawing_state->object.row);}
CP_XML_NODE(L"x:Column") {CP_XML_CONTENT(drawing_state->object.col);} CP_XML_NODE(L"x:Column") {CP_XML_CONTENT(drawing_state->object.col);}
}
if (drawing_state->object.bVisible) CP_XML_NODE(L"x:Visible"); if (drawing_state->object.bVisible) CP_XML_NODE(L"x:Visible");
...@@ -1507,11 +1550,11 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state) ...@@ -1507,11 +1550,11 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
CP_XML_NODE(L"xdr:cNvSpPr") CP_XML_NODE(L"xdr:cNvSpPr")
{ {
if (drawing_state->bTextBox)CP_XML_ATTR(L"txBox", 1); if (drawing_state->bTextBox)CP_XML_ATTR(L"txBox", 1);
CP_XML_NODE(L"a:spLocks") //CP_XML_NODE(L"a:spLocks")
{ //{
CP_XML_ATTR(L"noGrp", 1); // CP_XML_ATTR(L"noGrp", 1);
CP_XML_ATTR(L"noChangeArrowheads", 1); // CP_XML_ATTR(L"noChangeArrowheads", 1);
} //}
} }
} }
...@@ -1938,7 +1981,7 @@ void xlsx_drawing_context::serialize_xfrm(std::wostream & stream, _drawing_state ...@@ -1938,7 +1981,7 @@ void xlsx_drawing_context::serialize_xfrm(std::wostream & stream, _drawing_state
if (drawing_state->flipV) CP_XML_ATTR(L"flipV", true); if (drawing_state->flipV) CP_XML_ATTR(L"flipV", true);
if (drawing_state->flipH) CP_XML_ATTR(L"flipH", true); if (drawing_state->flipH) CP_XML_ATTR(L"flipH", true);
if (drawing_state->rotation != 0) CP_XML_ATTR(L"rot", drawing_state->rotation); if (drawing_state->rotation != 0) CP_XML_ATTR(L"rot", (int)(drawing_state->rotation * 60000));
CP_XML_NODE(L"a:off") CP_XML_NODE(L"a:off")
{ {
...@@ -2655,8 +2698,16 @@ void xlsx_drawing_context::set_rotation (double val) ...@@ -2655,8 +2698,16 @@ void xlsx_drawing_context::set_rotation (double val)
{ {
if (current_drawing_states == NULL) return; if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return; if (current_drawing_states->empty()) return;
if (val < 0.001) return;
current_drawing_states->back()->rotation = val; current_drawing_states->back()->rotation = val;
if (((int)current_drawing_states->back()->rotation % 90) == 0 && current_level > 0)
{
int v = current_drawing_states->back()->child_anchor.cx;
current_drawing_states->back()->child_anchor.cx = current_drawing_states->back()->child_anchor.cy;
current_drawing_states->back()->child_anchor.cy = v;
}
} }
void xlsx_drawing_context::set_line_color (int nColor, const std::wstring & sColor) void xlsx_drawing_context::set_line_color (int nColor, const std::wstring & sColor)
{ {
......
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