Commit 73dd12fe authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - ускорена конвертация таблиц огромных размеров. Ограничение...

OdfFormatReader - ускорена конвертация таблиц огромных размеров. Ограничение на количество столбцов(16384).
parent 1e54f505
......@@ -60,7 +60,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
_CP_OPT(std::wstring) strStrokeColor;
_CP_OPT(int) iStroke;
_CP_OPT(double) dStrokeWidth;
_CP_OPT(std::wstring) strStrokeOpacity;
_CP_OPT(double) dStrokeOpacity;
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(prop, L"wordArt", bWordArt);
......@@ -68,7 +68,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
odf_reader::GetProperty(prop, L"stroke-color" , strStrokeColor);
odf_reader::GetProperty(prop, L"stroke" , iStroke);
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth);
odf_reader::GetProperty(prop, L"stroke-opacity" , strStrokeOpacity);
odf_reader::GetProperty(prop, L"stroke-opacity" , dStrokeOpacity);
if ((!strStrokeColor && !iStroke && !dStrokeWidth) && !always_draw)return;
......@@ -78,7 +78,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
{
std::wstring color, dash_style, fill = L"a:solidFill" ;
if (strStrokeColor) color = strStrokeColor.get();
if (strStrokeColor) color = *strStrokeColor;
if (iStroke)
{
......@@ -86,7 +86,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
else dash_style = _ooxDashStyle[iStroke.get()];
}
if ((dStrokeWidth) && (dStrokeWidth.get()>= 0) && fill != L"a:noFill")
if ((dStrokeWidth) && (*dStrokeWidth >= 0) && fill != L"a:noFill")
{
int val = dStrokeWidth.get() * 12700; //in emu (1 pt = 12700)
if (val < 10) val = 12700;
......@@ -99,14 +99,14 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
{
if (fill != L"a:noFill")
{
if (color.length()<1 && always_draw) color = L"000000";
else if (color.length()<1) color = L"ffffff";
if (color.length() < 1 && always_draw) color = L"000000";
else if (color.length() <1 ) color = L"ffffff";
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val",color);
if (strStrokeOpacity)CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val",strStrokeOpacity.get());}
if (dStrokeOpacity) CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val", *dStrokeOpacity);}
}
}
......@@ -115,7 +115,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
{
_CP_OPT(std::wstring) strVal;
if (dash_style.length() >0 && dash_style != L"solid")
if (dash_style.length() > 0 && dash_style != L"solid")
{
CP_XML_NODE(L"a:prstDash"){CP_XML_ATTR(L"val", dash_style);}
}
......
......@@ -269,6 +269,10 @@ void xlsx_conversion_context::end_table()
{
unsigned int cMin = get_table_context().columns_count() + 1;
unsigned int cMax = (std::max)((unsigned int)1024, get_table_context().columns_count() + 100);
if (cMin < 16384)
{
if (cMax > 16384) cMax = 16384;
CP_XML_WRITER(current_sheet().cols())
{
CP_XML_NODE(L"col")
......@@ -283,6 +287,7 @@ void xlsx_conversion_context::end_table()
}
}
}
}
current_sheet().cols() << L"</cols>";
get_table_context().serialize_table_format(current_sheet().sheetFormat());
......
This diff is collapsed.
......@@ -16,7 +16,7 @@
namespace cpdoccore {
namespace odf_reader {
// table-table-attlist
// table:table-attlist
class table_table_attlist
{
public:
......@@ -35,13 +35,13 @@ public:
bool table_use_first_row_styles_; // default false;
bool table_use_banding_rows_styles_; //defualt false;
bool table_use_first_column_styles_;//defualt false;
bool table_use_first_column_styles_; //defualt false;
bool table_use_banding_columns_styles_; //defualt false;
friend class table_table;
};
// table-table-row-attlist
// table:table-row-attlist
class table_table_row_attlist
{
public:
......@@ -55,7 +55,7 @@ public:
};
// table-table-cell-attlist
// table:table-cell-attlist
class table_table_cell_attlist
{
public:
......@@ -74,7 +74,7 @@ public:
};
// table-table-cell-attlist-extra
// table:table-cell-attlist-extra
class table_table_cell_attlist_extra
{
public:
......@@ -101,7 +101,7 @@ public:
};
// table-linked-source-attlist
// table:linked-source-attlist
class table_linked_source_attlist
{
public:
......@@ -116,9 +116,7 @@ public:
};
/// \class table_table_source
/// \brief table:table-source
/// table-table-source
// table:table-source
class table_table_source : public office_element_impl<table_table_source>
{
public:
......@@ -135,13 +133,11 @@ public:
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_source);
// table-columns
// table:columns
class table_columns
{
public:
......@@ -157,7 +153,7 @@ public:
};
// table-columns-no-group
// table:columns-no-group
class table_columns_no_group: public office_element
{
public:
......@@ -188,12 +184,11 @@ public:
bool was_header_;
office_element_ptr table_table_header_columns_;
table_columns table_columns_2_;
};
// table-columns-and-groups
// table:columns-and-groups
class table_columns_and_groups
{
public:
......@@ -212,7 +207,7 @@ public:
};
// table-table-column-attlist
// table:table-column-attlist
class table_table_column_attlist
{
public:
......@@ -226,9 +221,7 @@ public:
};
// \class table_table_column
// table:table-column
// table-table-column
class table_table_column : public office_element_impl<table_table_column>
{
public:
......@@ -254,9 +247,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_column);
// \class table_table_columns
// table:table-columns
// table-table-columns
class table_table_columns : public office_element_impl<table_table_columns>
{
public:
......@@ -281,9 +272,8 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_columns);
// \class table_table_header_columns
// table:table-header-columns
// table-table-header-columns
class table_table_header_columns : public office_element_impl<table_table_header_columns>
{
public:
......@@ -309,7 +299,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_columns);
// table-table-column-group-attlist
// table:table-column-group-attlist
class table_table_column_group_attlist
{
public:
......@@ -320,9 +310,7 @@ private:
};
// \class table_table_column_group
// table:table-column-group
// table-table-column-group
class table_table_column_group : public office_element_impl<table_table_column_group>
{
public:
......@@ -348,14 +336,11 @@ private:
public:
table_table_column_group_attlist table_table_column_group_attlist_;
table_columns_and_groups table_columns_and_groups_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_column_group);
/// \class table_table_row
/// \brief table:table-row
/// table-table-row
// table:table-row
class table_table_row : public office_element_impl<table_table_row>
{
public:
......@@ -379,14 +364,13 @@ private:
public:
table_table_row_attlist table_table_row_attlist_;
office_element_ptr_array content_; // table-table-cell, table-covered-table-cell
office_element_ptr_array content_; // table-table-cell or table-covered-table-cell
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_row);
// \class table_table_cell_content
// table-table-cell-content
// table:table-cell-content
class table_table_cell_content
{
public:
......@@ -399,13 +383,11 @@ public:
private:
// TODO table-cell-range-source
// TODO office-annotation
// TODO table-detective
office_element_ptr_array text_content_; // text-content
};
// \class table_table_cell
// table-table-cell
// table:table-cell
class table_table_cell : public office_element_impl<table_table_cell>
{
......@@ -417,7 +399,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
table_table_cell() { }
table_table_cell() : last_cell_(false) { }
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
......@@ -432,6 +414,8 @@ private:
virtual void add_text(const std::wstring & Text);
public:
bool last_cell_;
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_;
table_table_cell_content table_table_cell_content_;
......@@ -440,8 +424,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell);
// \class table_covered_table_cell
// table-covered-table-cell
// table:covered-table-cell
class table_covered_table_cell : public office_element_impl<table_covered_table_cell>
{
......@@ -453,7 +435,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
table_covered_table_cell() {empty_ = true; }
table_covered_table_cell() : last_cell_(false), empty_(true) {}
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
......@@ -467,8 +449,11 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text);
public:
bool last_cell_;
bool empty_;
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_content table_table_cell_content_;
......@@ -476,8 +461,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_covered_table_cell);
// \class table_table_rows
// table-table-rows
// table:table-rows
class table_table_rows : public office_element_impl<table_table_rows>
{
......@@ -510,8 +493,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_rows);
// \class table_table_header_rows
// table-table-header-rows
// table:table-header-rows
class table_table_header_rows : public office_element_impl<table_table_header_rows>
{
......@@ -542,8 +523,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows);
// \class table_rows
// table-rows
// table:rows
class table_rows
{
public:
......@@ -560,7 +540,7 @@ public:
};
// table-rows-no-group
// table:rows-no-group
class table_rows_no_group : public office_element
{
public:
......@@ -588,16 +568,15 @@ public:
void pptx_convert(oox::pptx_conversion_context & Context) ;
public:
table_rows table_rows_1_;
bool was_header_;
office_element_ptr table_table_header_rows_;
table_rows table_rows_1_;
office_element_ptr table_table_header_rows_;
table_rows table_rows_2_;
};
// table-rows-and-groups
// table:rows-and-groups
class table_rows_and_groups
{
public:
......@@ -619,7 +598,7 @@ public:
};
// table-table-row-group-attlist
// table:table-row-group-attlist
class table_table_row_group_attlist
{
public:
......@@ -629,9 +608,6 @@ public:
};
//
// \class table_table_row_group
// table-table-row-group
// table:table-row-group
class table_table_row_group : public office_element_impl<table_table_row_group>
{
......@@ -647,9 +623,7 @@ public:
{
}
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
virtual std::wostream & text_to_stream(::std::wostream & _Wostream) const;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -663,9 +637,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group);
/// \class table_table
/// \brief table:table
/// table-table
// table:table
class table_table : public office_element_impl<table_table>
{
public:
......@@ -686,21 +658,19 @@ private:
public:
table_table_attlist table_table_attlist_;
office_element_ptr table_table_source_;//table-table-source
office_element_ptr table_table_source_; //table-table-source
//office-dde-source
//table-scenario
//office-forms
office_element_ptr table_shapes_;
table_columns_and_groups table_columns_and_groups_;//table-columns-and-groups
table_columns_and_groups table_columns_and_groups_; //table-columns-and-groups
table_rows_and_groups table_rows_and_groups_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table);
/// \class table_shapes
/// \brief table:shapes
/// table-shapes
// table:shapes
class table_shapes : public office_element_impl<table_shapes>
{
public:
......@@ -719,7 +689,6 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
private:
office_element_ptr_array content_;
};
......
This diff is collapsed.
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