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

XlsFile2 bug 24442, поправлены метрики

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63982 954022d7-b5bf-4e40-9824-e11837661b57
parent 55756769
...@@ -56,9 +56,12 @@ void Row::writeFields(CFRecord& record) ...@@ -56,9 +56,12 @@ void Row::writeFields(CFRecord& record)
void Row::readFields(CFRecord& record) void Row::readFields(CFRecord& record)
{ {
record >> rw >> colMic >> colMac >> miyRw; record >> rw >> colMic >> colMac >> miyRw;
record.skipNunBytes(4); // reserved / unused record.skipNunBytes(4); // reserved / unused
unsigned short flags; unsigned short flags;
record >> flags; record >> flags;
iOutLevel = GETBITS(flags, 0, 2); iOutLevel = GETBITS(flags, 0, 2);
fCollapsed = GETBIT(flags, 4); fCollapsed = GETBIT(flags, 4);
fDyZero = GETBIT(flags, 5); fDyZero = GETBIT(flags, 5);
...@@ -66,22 +69,12 @@ void Row::readFields(CFRecord& record) ...@@ -66,22 +69,12 @@ void Row::readFields(CFRecord& record)
fGhostDirty = GETBIT(flags, 7); fGhostDirty = GETBIT(flags, 7);
record >> flags; record >> flags;
ixfe_val = GETBITS(flags, 0, 11); ixfe_val = GETBITS(flags, 0, 11);
fExAsc = GETBIT(flags, 12); fExAsc = GETBIT(flags, 12);
fExDes = GETBIT(flags, 13); fExDes = GETBIT(flags, 13);
fPhonetic = GETBIT(flags, 14); fPhonetic = GETBIT(flags, 14);
} }
int Row::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"row")
{
}
}
return 0;
}
} // namespace XLS } // namespace XLS
...@@ -22,8 +22,6 @@ public: ...@@ -22,8 +22,6 @@ public:
static const ElementType type = typeRow; static const ElementType type = typeRow;
int serialize(std::wostream & stream);
//----------------------------- //-----------------------------
Rw rw; Rw rw;
BackwardOnlyParam<unsigned short> colMic; BackwardOnlyParam<unsigned short> colMic;
...@@ -41,26 +39,6 @@ public: ...@@ -41,26 +39,6 @@ public:
BIFF_BOOL fExDes; BIFF_BOOL fExDes;
BIFF_BOOL fPhonetic; BIFF_BOOL fPhonetic;
BackwardOnlyParam<unsigned int> in_block_position; BackwardOnlyParam<unsigned int> in_block_position;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(rw)
//BO_ATTRIB_MARKUP_ATTRIB(colMic)
//BO_ATTRIB_MARKUP_ATTRIB(colMac)
//BO_ATTRIB_MARKUP_ATTRIB(miyRw)
//BO_ATTRIB_MARKUP_ATTRIB(iOutLevel)
//BO_ATTRIB_MARKUP_ATTRIB(fCollapsed)
//BO_ATTRIB_MARKUP_ATTRIB(fDyZero)
//BO_ATTRIB_MARKUP_ATTRIB(fUnsynced)
//BO_ATTRIB_MARKUP_ATTRIB(fGhostDirty)
//BO_ATTRIB_MARKUP_ATTRIB(ixfe_val)
//BO_ATTRIB_MARKUP_ATTRIB(fExAsc)
//BO_ATTRIB_MARKUP_ATTRIB(fExDes)
//BO_ATTRIB_MARKUP_ATTRIB(fPhonetic)
//BO_ATTRIB_MARKUP_ATTRIB(in_block_position)
//BO_ATTRIB_MARKUP_END
}; };
} // namespace XLS } // namespace XLS
......
...@@ -86,24 +86,38 @@ void OfficeArtClientAnchorSheet::loadFields(XLS::CFRecord& record) ...@@ -86,24 +86,38 @@ void OfficeArtClientAnchorSheet::loadFields(XLS::CFRecord& record)
fMove = GETBIT(flags, 0); fMove = GETBIT(flags, 0);
fSize = GETBIT(flags, 1); fSize = GETBIT(flags, 1);
//----------------------------------------------------------------------------------------------------
double kfCol = 17640 / 256.;
double kfRow = ( 360000 * 2.54 / 72) / 256. ;
double kfRow = (global_info->defaultRowHeight * 360000 * 2.54 / 72); if (global_info->customColumnsWidth.find(colL) != global_info->customColumnsWidth.end())
double kfColumn = ( 360000 * 2.54 / 72) / 256.; {
_dxL = dxL * kfCol * global_info->customColumnsWidth[colL];
if (colL < global_info->customColumnsWidth.size()) }
_dxL = dxL * kfColumn * global_info->customColumnsWidth[colL];
else else
_dxL = dxL * kfColumn * global_info->defaultColumnWidth; _dxL = dxL * kfCol * global_info->defaultColumnWidth;
if (colR < global_info->customColumnsWidth.size()) if (global_info->customColumnsWidth.find(colR) != global_info->customColumnsWidth.end())
_dxR = dxR * kfColumn * global_info->customColumnsWidth[colR]; {
_dxR = dxR * kfCol * global_info->customColumnsWidth[colR];
}
else else
_dxR = dxR * kfColumn * global_info->defaultColumnWidth; _dxR = dxR * kfCol * global_info->defaultColumnWidth;
_dyT = dyT * kfRow / 256. ; //---------------------------------------------------------------------------------------------------
_dyB = dyB * kfRow / 256 ; //744; if (global_info->customRowsHeight.find(rwT) != global_info->customRowsHeight.end())
{
_dyT = dyT * kfRow * global_info->customRowsHeight[rwT];
}
else
_dyT = dyT * kfRow * global_info->defaultRowHeight;
if (global_info->customRowsHeight.find(rwB) != global_info->customRowsHeight.end())
{
_dyB = dyB * kfRow * global_info->customRowsHeight[rwB];
}
else
_dyB = dyB * kfRow * global_info->defaultRowHeight;
} }
......
...@@ -19,7 +19,6 @@ class CELL_GROUP : public CompositeObject ...@@ -19,7 +19,6 @@ class CELL_GROUP : public CompositeObject
public: public:
CELL_GROUP(std::vector<CellRef>& shared_formulas_locations_ref) : CELL_GROUP(std::vector<CellRef>& shared_formulas_locations_ref) :
shared_formulas_locations_ref_(shared_formulas_locations_ref) shared_formulas_locations_ref_(shared_formulas_locations_ref)
, m_count_rows (0)
{ {
} }
...@@ -30,6 +29,8 @@ public: ...@@ -30,6 +29,8 @@ public:
const bool loadContent(BinProcessor& proc) const bool loadContent(BinProcessor& proc)
{ {
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
int count, count_row = 0; int count, count_row = 0;
if(proc.mandatory<Row>() == true) if(proc.mandatory<Row>() == true)
...@@ -38,10 +39,17 @@ public: ...@@ -38,10 +39,17 @@ public:
while(count > 0) while(count > 0)
{ {
Row* row = dynamic_cast<Row*>(elements_.back().get());
if (row)
{
if (row->miyRw.value())
{
global_info->customRowsHeight.insert(std::pair<int, double>(row->rw,row->miyRw / 20.));
}
}
m_rows.insert(m_rows.begin(), elements_.back()); m_rows.insert(m_rows.begin(), elements_.back());
elements_.pop_back(); elements_.pop_back();
count--; count--;
m_count_rows++;
} }
} }
...@@ -62,7 +70,6 @@ public: ...@@ -62,7 +70,6 @@ public:
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
static const ElementType type = typeCELL_GROUP; static const ElementType type = typeCELL_GROUP;
int m_count_rows;
std::list<BaseObjectPtr> m_rows; std::list<BaseObjectPtr> m_rows;
std::list<BaseObjectPtr> m_DBCells; std::list<BaseObjectPtr> m_DBCells;
...@@ -79,63 +86,6 @@ int CELL_GROUP::serialize(std::wostream & stream) ...@@ -79,63 +86,6 @@ int CELL_GROUP::serialize(std::wostream & stream)
int current_row_number = 0; int current_row_number = 0;
//for (std::list<XLS::BaseObjectPtr>::iterator it_row = m_rows.begin(); it_row != m_rows.end(); it_row++)
//{
// Row * row = dynamic_cast<Row *>(it_row->get());
//
// if (row == NULL) continue;
// CP_XML_NODE(L"row")
// {
// current_row = *row->rw.value();
//
// CP_XML_ATTR(L"r", current_row + 1);
//
// bool xf_set = true;
// if ((row->fGhostDirty.value()) && ( *row->fGhostDirty.value()== false)) xf_set = false;
//
// if (row->ixfe_val.value() && xf_set)
// {
// CP_XML_ATTR(L"s", row->ixfe_val - cellStyleXfs_count);
// CP_XML_ATTR(L"customFormat", true);
// }
// if (row->miyRw.value())
// {
// 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)
// {
// if (it_cell == elements_.end())
// {
// current_cell_start = it_cell;
// break;
// }
// CELL * cell = dynamic_cast<CELL *>(it_cell->get());
// if (cell == NULL) continue;
// if (cell->RowNumber >current_row)
// {
// current_cell_start = it_cell;
// break;
// }
// cell->serialize(CP_XML_STREAM());
// it_cell++;
// }
// }
//}
while(current_row_number == 0) while(current_row_number == 0)
{ {
CP_XML_NODE(L"row") CP_XML_NODE(L"row")
...@@ -151,16 +101,23 @@ int CELL_GROUP::serialize(std::wostream & stream) ...@@ -151,16 +101,23 @@ int CELL_GROUP::serialize(std::wostream & stream)
} }
CELL * cell = dynamic_cast<CELL *>(it_cell->get()); CELL * cell = dynamic_cast<CELL *>(it_cell->get());
if (cell == NULL) continue; if (cell == NULL)
{
it_cell++;
continue;
}
if (current_row_number < 1) // if (current_row_number < 1) //
{ {
current_row_number = cell->RowNumber + 1; // current_row_number = cell->RowNumber + 1; //
bool skip_cells = false; bool skip_cells = false;
if (current_row != m_rows.end()) if (current_row != m_rows.end())
{ {
Row * row = dynamic_cast<Row *>(current_row->get()); Row * row = dynamic_cast<Row *>(current_row->get());
int row_n = row->rw;
if (row->rw + 1 < current_row_number) if (row->rw + 1 < current_row_number)
{ {
current_row_number = row->rw + 1; current_row_number = row->rw + 1;
...@@ -178,9 +135,9 @@ int CELL_GROUP::serialize(std::wostream & stream) ...@@ -178,9 +135,9 @@ int CELL_GROUP::serialize(std::wostream & stream)
CP_XML_ATTR(L"s", row->ixfe_val - cellStyleXfs_count); CP_XML_ATTR(L"s", row->ixfe_val - cellStyleXfs_count);
CP_XML_ATTR(L"customFormat", true); CP_XML_ATTR(L"customFormat", true);
} }
if (row->miyRw.value()) if (row->miyRw.value())// 255 twips(1/20 pt)
{ {
CP_XML_ATTR(L"ht", row->miyRw / 20.); CP_XML_ATTR(L"ht", row->miyRw / 16.);
CP_XML_ATTR(L"customHeight", true); CP_XML_ATTR(L"customHeight", true);
} }
if ((row->iOutLevel.value()) && (row->iOutLevel > 0)) if ((row->iOutLevel.value()) && (row->iOutLevel > 0))
...@@ -192,7 +149,10 @@ int CELL_GROUP::serialize(std::wostream & stream) ...@@ -192,7 +149,10 @@ int CELL_GROUP::serialize(std::wostream & stream)
CP_XML_ATTR(L"collapsed", row->fCollapsed); CP_XML_ATTR(L"collapsed", row->fCollapsed);
} }
} }
current_row ++; if (row->rw + 1 <= current_row_number)
{
current_row++;
}
} }
else else
{ {
...@@ -200,7 +160,7 @@ int CELL_GROUP::serialize(std::wostream & stream) ...@@ -200,7 +160,7 @@ int CELL_GROUP::serialize(std::wostream & stream)
} }
if (skip_cells) if (skip_cells)
{ {
current_row = 0; current_row_number = 0;
break; break;
} }
} }
......
...@@ -39,7 +39,6 @@ const bool COLUMNS::loadContent(BinProcessor& proc) ...@@ -39,7 +39,6 @@ const bool COLUMNS::loadContent(BinProcessor& proc)
m_DefColWidth = elements_.back(); m_DefColWidth = elements_.back();
elements_.pop_back(); elements_.pop_back();
} }
bool col_ok = proc.repeated<ColInfo>(0, 255); bool col_ok = proc.repeated<ColInfo>(0, 255);
int last_add = 0; int last_add = 0;
...@@ -48,19 +47,11 @@ const bool COLUMNS::loadContent(BinProcessor& proc) ...@@ -48,19 +47,11 @@ const bool COLUMNS::loadContent(BinProcessor& proc)
{ {
ColInfo* column_info = dynamic_cast<ColInfo*>(it->get()); ColInfo* column_info = dynamic_cast<ColInfo*>(it->get());
for (int i = last_add ; i < column_info->colFirst; i++)
{
global_info->customColumnsWidth.push_back(global_info->defaultColumnWidth);
}
for (int i = column_info->colFirst; i <= column_info->colLast; i++) for (int i = column_info->colFirst; i <= column_info->colLast; i++)
{ {
if (column_info->coldx.value()) if (column_info->coldx.value())
{ {
global_info->customColumnsWidth.push_back(column_info->coldx / 256.); global_info->customColumnsWidth.insert(std::pair<int, double>(i,column_info->coldx / 256.));
}
else
{
global_info->customColumnsWidth.push_back(global_info->defaultColumnWidth);
} }
} }
......
...@@ -99,7 +99,10 @@ int GLOBALS::serialize(std::wostream & stream) ...@@ -99,7 +99,10 @@ int GLOBALS::serialize(std::wostream & stream)
if (def_row) if (def_row)
{ {
if(!def_row->fDyZero.value() || ((def_row->fDyZero.value()) && (!def_row->fDyZero))) if(!def_row->fDyZero.value() || ((def_row->fDyZero.value()) && (!def_row->fDyZero)))
{
CP_XML_ATTR(L"defaultRowHeight", def_row->miyRw / 20.); CP_XML_ATTR(L"defaultRowHeight", def_row->miyRw / 20.);
CP_XML_ATTR(L"customHeight", true);
}
else else
{ {
CP_XML_ATTR(L"zeroHeight", true); CP_XML_ATTR(L"zeroHeight", true);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <boost/smart_ptr/shared_array.hpp> #include <boost/smart_ptr/shared_array.hpp>
#include <vector> #include <vector>
#include <map>
#include "../Crypt/Decryptor.h" #include "../Crypt/Decryptor.h"
#include "Biff_structures/BorderFillInfo.h" #include "Biff_structures/BorderFillInfo.h"
...@@ -42,8 +43,8 @@ public: ...@@ -42,8 +43,8 @@ public:
std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data; std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data;
std::vector<double> customColumnsWidth; std::map<int, double> customColumnsWidth;
std::vector<double> customRowHeight; std::map<int, double> customRowsHeight;
double defaultColumnWidth; double defaultColumnWidth;
double defaultRowHeight; double defaultRowHeight;
......
...@@ -73,6 +73,9 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc) ...@@ -73,6 +73,9 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
{ {
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo(); GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
global_info->defaultColumnWidth = 8;
global_info->defaultRowHeight = 14.4;
int count = 0; int count = 0;
if(!proc.mandatory<BOF>()) if(!proc.mandatory<BOF>())
...@@ -198,6 +201,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc) ...@@ -198,6 +201,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
proc.mandatory<EOF_T>(); proc.mandatory<EOF_T>();
global_info->customColumnsWidth.clear(); global_info->customColumnsWidth.clear();
global_info->customRowsHeight.clear();
return true; return true;
} }
......
...@@ -405,6 +405,7 @@ void XlsConverter::convert(ODRAW::OfficeArtBStoreContainer* art_bstore) ...@@ -405,6 +405,7 @@ void XlsConverter::convert(ODRAW::OfficeArtBStoreContainer* art_bstore)
BITMAPINFOHEADER * header = (BITMAPINFOHEADER *)art_bstore->rgfb[i]->pict_data; BITMAPINFOHEADER * header = (BITMAPINFOHEADER *)art_bstore->rgfb[i]->pict_data;
CBgraFrame frame; CBgraFrame frame;
int offset = art_bstore->rgfb[i]->data_size - header->biSizeImage;
frame.put_Data((BYTE*)art_bstore->rgfb[i]->pict_data + header->biSize); frame.put_Data((BYTE*)art_bstore->rgfb[i]->pict_data + header->biSize);
frame.put_Height(header->biHeight); frame.put_Height(header->biHeight);
......
...@@ -193,7 +193,7 @@ void xlsx_drawing_context::serialize_pic(std::wstring rId) ...@@ -193,7 +193,7 @@ void xlsx_drawing_context::serialize_pic(std::wstring rId)
CP_XML_ATTR(L"name", drawing_state.back().name); CP_XML_ATTR(L"name", drawing_state.back().name);
if (!drawing_state.back().description.empty()) if (!drawing_state.back().description.empty())
{ {
CP_XML_ATTR(L"desc", drawing_state.back().description); CP_XML_ATTR(L"descr", drawing_state.back().description);
} }
if (!drawing_state.back().hyperlink.empty()) if (!drawing_state.back().hyperlink.empty())
...@@ -305,22 +305,22 @@ void xlsx_drawing_context::set_image(std::wstring & str) ...@@ -305,22 +305,22 @@ void xlsx_drawing_context::set_image(std::wstring & str)
void xlsx_drawing_context::set_crop_top (long val) void xlsx_drawing_context::set_crop_top (long val)
{ {
if (drawing_state.size() < 1 )return; if (drawing_state.size() < 1 )return;
drawing_state.back().image_crop[1] = val; drawing_state.back().image_crop[1] = val * 1.5;
} }
void xlsx_drawing_context::set_crop_bottom(long val) void xlsx_drawing_context::set_crop_bottom(long val)
{ {
if (drawing_state.size() < 1 )return; if (drawing_state.size() < 1 )return;
drawing_state.back().image_crop[3] = val; drawing_state.back().image_crop[3] = val* 1.5;
} }
void xlsx_drawing_context::set_crop_left (long val) void xlsx_drawing_context::set_crop_left (long val)
{ {
if (drawing_state.size() < 1 )return; if (drawing_state.size() < 1 )return;
drawing_state.back().image_crop[0]= val; drawing_state.back().image_crop[0]= val* 1.5;
} }
void xlsx_drawing_context::set_crop_right (long val) void xlsx_drawing_context::set_crop_right (long val)
{ {
if (drawing_state.size() < 1 )return; if (drawing_state.size() < 1 )return;
drawing_state.back().image_crop[2] = val; drawing_state.back().image_crop[2] = val* 1.5;
} }
void xlsx_drawing_context::set_hyperlink(std::wstring & str) void xlsx_drawing_context::set_hyperlink(std::wstring & str)
{ {
......
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