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 ...@@ -60,7 +60,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
_CP_OPT(std::wstring) strStrokeColor; _CP_OPT(std::wstring) strStrokeColor;
_CP_OPT(int) iStroke; _CP_OPT(int) iStroke;
_CP_OPT(double) dStrokeWidth; _CP_OPT(double) dStrokeWidth;
_CP_OPT(std::wstring) strStrokeOpacity; _CP_OPT(double) dStrokeOpacity;
_CP_OPT(bool) bWordArt; _CP_OPT(bool) bWordArt;
odf_reader::GetProperty(prop, L"wordArt", 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 ...@@ -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-color" , strStrokeColor);
odf_reader::GetProperty(prop, L"stroke" , iStroke); odf_reader::GetProperty(prop, L"stroke" , iStroke);
odf_reader::GetProperty(prop, L"stroke-width" , dStrokeWidth); 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; if ((!strStrokeColor && !iStroke && !dStrokeWidth) && !always_draw)return;
...@@ -78,7 +78,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -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" ; std::wstring color, dash_style, fill = L"a:solidFill" ;
if (strStrokeColor) color = strStrokeColor.get(); if (strStrokeColor) color = *strStrokeColor;
if (iStroke) if (iStroke)
{ {
...@@ -86,7 +86,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -86,7 +86,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
else dash_style = _ooxDashStyle[iStroke.get()]; 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) int val = dStrokeWidth.get() * 12700; //in emu (1 pt = 12700)
if (val < 10) val = 12700; if (val < 10) val = 12700;
...@@ -99,14 +99,14 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -99,14 +99,14 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
{ {
if (fill != L"a:noFill") if (fill != L"a:noFill")
{ {
if (color.length()<1 && always_draw) color = L"000000"; if (color.length() < 1 && always_draw) color = L"000000";
else if (color.length()<1) color = L"ffffff"; else if (color.length() <1 ) color = L"ffffff";
CP_XML_NODE(L"a:srgbClr") CP_XML_NODE(L"a:srgbClr")
{ {
CP_XML_ATTR(L"val",color); 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 ...@@ -115,7 +115,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
{ {
_CP_OPT(std::wstring) strVal; _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);} CP_XML_NODE(L"a:prstDash"){CP_XML_ATTR(L"val", dash_style);}
} }
......
...@@ -269,6 +269,10 @@ void xlsx_conversion_context::end_table() ...@@ -269,6 +269,10 @@ void xlsx_conversion_context::end_table()
{ {
unsigned int cMin = get_table_context().columns_count() + 1; unsigned int cMin = get_table_context().columns_count() + 1;
unsigned int cMax = (std::max)((unsigned int)1024, get_table_context().columns_count() + 100); 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_WRITER(current_sheet().cols())
{ {
CP_XML_NODE(L"col") CP_XML_NODE(L"col")
...@@ -283,6 +287,7 @@ void xlsx_conversion_context::end_table() ...@@ -283,6 +287,7 @@ void xlsx_conversion_context::end_table()
} }
} }
} }
}
current_sheet().cols() << L"</cols>"; current_sheet().cols() << L"</cols>";
get_table_context().serialize_table_format(current_sheet().sheetFormat()); get_table_context().serialize_table_format(current_sheet().sheetFormat());
......
...@@ -17,10 +17,7 @@ namespace cpdoccore { ...@@ -17,10 +17,7 @@ namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
// // table:table-attlist
// table-table-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void table_table_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void table_table_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"table:name", table_name_); CP_APPLY_ATTR(L"table:name", table_name_);
...@@ -40,8 +37,8 @@ void table_table_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu ...@@ -40,8 +37,8 @@ void table_table_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu
CP_APPLY_ATTR(L"table:is-sub-table", table_is_sub_table_); CP_APPLY_ATTR(L"table:is-sub-table", table_is_sub_table_);
} }
// table-table-row-attlist
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-row-attlist
void table_table_row_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void table_table_row_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"table:number-rows-repeated", table_number_rows_repeated_, (unsigned int)1/*0*/); CP_APPLY_ATTR(L"table:number-rows-repeated", table_number_rows_repeated_, (unsigned int)1/*0*/);
...@@ -50,8 +47,8 @@ void table_table_row_attlist::add_attributes( const xml::attributes_wc_ptr & Att ...@@ -50,8 +47,8 @@ void table_table_row_attlist::add_attributes( const xml::attributes_wc_ptr & Att
CP_APPLY_ATTR(L"table:visibility", table_visibility_, table_visibility(table_visibility::Visible)); CP_APPLY_ATTR(L"table:visibility", table_visibility_, table_visibility(table_visibility::Visible));
} }
// table-table-cell-attlist
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-cell-attlist
void table_table_cell_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void table_table_cell_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"table:number-columns-repeated", table_number_columns_repeated_, (unsigned int)1/*0*/); CP_APPLY_ATTR(L"table:number-columns-repeated", table_number_columns_repeated_, (unsigned int)1/*0*/);
...@@ -63,8 +60,8 @@ void table_table_cell_attlist::add_attributes( const xml::attributes_wc_ptr & At ...@@ -63,8 +60,8 @@ void table_table_cell_attlist::add_attributes( const xml::attributes_wc_ptr & At
common_value_and_type_attlist_.add_attributes(Attributes); common_value_and_type_attlist_.add_attributes(Attributes);
} }
// table-table-cell-attlist-extra
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-cell-attlist-extra
void table_table_cell_attlist_extra::add_attributes( const xml::attributes_wc_ptr & Attributes ) void table_table_cell_attlist_extra::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"table:number-columns-spanned", table_number_columns_spanned_, (unsigned int)/*1*/1); CP_APPLY_ATTR(L"table:number-columns-spanned", table_number_columns_spanned_, (unsigned int)/*1*/1);
...@@ -91,8 +88,8 @@ void table_linked_source_attlist::add_attributes( const xml::attributes_wc_ptr & ...@@ -91,8 +88,8 @@ void table_linked_source_attlist::add_attributes( const xml::attributes_wc_ptr &
CP_APPLY_ATTR(L"table:refresh-delay", table_refresh_delay_); CP_APPLY_ATTR(L"table:refresh-delay", table_refresh_delay_);
} }
// table:table-source
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-source
const wchar_t * table_table_source::ns = L"table"; const wchar_t * table_table_source::ns = L"table";
const wchar_t * table_table_source::name = L"table-source"; const wchar_t * table_table_source::name = L"table-source";
...@@ -107,8 +104,8 @@ void table_table_source::add_child_element( xml::sax * Reader, const ::std::wstr ...@@ -107,8 +104,8 @@ void table_table_source::add_child_element( xml::sax * Reader, const ::std::wstr
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
// table:table
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table
const wchar_t * table_table::ns = L"table"; const wchar_t * table_table::ns = L"table";
const wchar_t * table_table::name = L"table"; const wchar_t * table_table::name = L"table";
...@@ -156,8 +153,8 @@ void table_table_column_attlist::add_attributes( const xml::attributes_wc_ptr & ...@@ -156,8 +153,8 @@ void table_table_column_attlist::add_attributes( const xml::attributes_wc_ptr &
CP_APPLY_ATTR(L"table:default-cell-style-name", table_default_cell_style_name_); CP_APPLY_ATTR(L"table:default-cell-style-name", table_default_cell_style_name_);
} }
// table:table-column
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-column
const wchar_t * table_table_column::ns = L"table"; const wchar_t * table_table_column::ns = L"table";
const wchar_t * table_table_column::name = L"table-column"; const wchar_t * table_table_column::name = L"table-column";
...@@ -171,8 +168,8 @@ void table_table_column::add_child_element( xml::sax * Reader, const ::std::wstr ...@@ -171,8 +168,8 @@ void table_table_column::add_child_element( xml::sax * Reader, const ::std::wstr
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
// table:table-columns
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-columns
const wchar_t * table_table_columns::ns = L"table"; const wchar_t * table_table_columns::ns = L"table";
const wchar_t * table_table_columns::name = L"table-columns"; const wchar_t * table_table_columns::name = L"table-columns";
...@@ -190,8 +187,8 @@ void table_table_columns::add_child_element( xml::sax * Reader, const ::std::wst ...@@ -190,8 +187,8 @@ void table_table_columns::add_child_element( xml::sax * Reader, const ::std::wst
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
// table:table-header-columns
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-header-columns
const wchar_t * table_table_header_columns::ns = L"table"; const wchar_t * table_table_header_columns::ns = L"table";
const wchar_t * table_table_header_columns::name = L"table-header-columns"; const wchar_t * table_table_header_columns::name = L"table-header-columns";
...@@ -209,8 +206,8 @@ void table_table_header_columns::add_child_element( xml::sax * Reader, const ::s ...@@ -209,8 +206,8 @@ void table_table_header_columns::add_child_element( xml::sax * Reader, const ::s
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
// table-columns
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:columns
void table_columns::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context) void table_columns::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context)
{ {
if CP_CHECK_NAME(L"table", L"table-columns") if CP_CHECK_NAME(L"table", L"table-columns")
...@@ -225,8 +222,8 @@ void table_columns::add_child_element( xml::sax * Reader, const ::std::wstring & ...@@ -225,8 +222,8 @@ void table_columns::add_child_element( xml::sax * Reader, const ::std::wstring &
not_applicable_element(L"table-columns", Reader, Ns, Name); not_applicable_element(L"table-columns", Reader, Ns, Name);
} }
// table-columns-no-group
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:columns-no-group
table_columns_no_group::table_columns_no_group() : was_header_(false) table_columns_no_group::table_columns_no_group() : was_header_(false)
{ {
}; };
...@@ -255,16 +252,15 @@ _CP_PTR(table_columns_no_group) table_columns_no_group::create() ...@@ -255,16 +252,15 @@ _CP_PTR(table_columns_no_group) table_columns_no_group::create()
return boost::make_shared<table_columns_no_group>(); return boost::make_shared<table_columns_no_group>();
} }
// table-table-column-group-attlist
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-column-group-attlist
void table_table_column_group_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void table_table_column_group_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"table:display", table_display_, true); CP_APPLY_ATTR(L"table:display", table_display_, true);
} }
// table:table-column-group
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-column-group
const wchar_t * table_table_column_group::ns = L"table"; const wchar_t * table_table_column_group::ns = L"table";
const wchar_t * table_table_column_group::name = L"table-column-group"; const wchar_t * table_table_column_group::name = L"table-column-group";
...@@ -278,14 +274,12 @@ void table_table_column_group::add_child_element( xml::sax * Reader, const ::std ...@@ -278,14 +274,12 @@ void table_table_column_group::add_child_element( xml::sax * Reader, const ::std
table_columns_and_groups_.add_child_element(Reader, Ns, Name, getContext()); table_columns_and_groups_.add_child_element(Reader, Ns, Name, getContext());
} }
// table-columns-and-groups
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:columns-and-groups
table_columns_and_groups::table_columns_and_groups() table_columns_and_groups::table_columns_and_groups()
{ {
} }
void table_columns_and_groups::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context) void table_columns_and_groups::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name, document_context * Context)
{ {
if (CP_CHECK_NAME(L"table", L"table-column-group")) if (CP_CHECK_NAME(L"table", L"table-column-group"))
...@@ -334,9 +328,8 @@ void table_table_cell_content::add_child_element( xml::sax * Reader, const ::std ...@@ -334,9 +328,8 @@ void table_table_cell_content::add_child_element( xml::sax * Reader, const ::std
CP_CREATE_ELEMENT_SIMPLE(text_content_); CP_CREATE_ELEMENT_SIMPLE(text_content_);
} }
// table:table-cell
// table-table-cell
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-cell
const wchar_t * table_table_cell::ns = L"table"; const wchar_t * table_table_cell::ns = L"table";
const wchar_t * table_table_cell::name = L"table-cell"; const wchar_t * table_table_cell::name = L"table-cell";
...@@ -385,10 +378,9 @@ void table_covered_table_cell::add_child_element( xml::sax * Reader, const ::std ...@@ -385,10 +378,9 @@ void table_covered_table_cell::add_child_element( xml::sax * Reader, const ::std
void table_covered_table_cell::add_text(const std::wstring & Text) void table_covered_table_cell::add_text(const std::wstring & Text)
{ {
} }
//////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-row // table:table-row
// table-table-row
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_table_row::ns = L"table"; const wchar_t * table_table_row::ns = L"table";
const wchar_t * table_table_row::name = L"table-row"; const wchar_t * table_table_row::name = L"table-row";
...@@ -414,7 +406,6 @@ void table_table_row::add_child_element( xml::sax * Reader, const ::std::wstring ...@@ -414,7 +406,6 @@ void table_table_row::add_child_element( xml::sax * Reader, const ::std::wstring
} }
// table:table-rows // table:table-rows
// table-table-rows
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_table_rows::ns = L"table"; const wchar_t * table_table_rows::ns = L"table";
const wchar_t * table_table_rows::name = L"table-rows"; const wchar_t * table_table_rows::name = L"table-rows";
...@@ -433,9 +424,8 @@ void table_table_rows::add_child_element( xml::sax * Reader, const ::std::wstrin ...@@ -433,9 +424,8 @@ void table_table_rows::add_child_element( xml::sax * Reader, const ::std::wstrin
CP_CREATE_ELEMENT(table_table_row_); CP_CREATE_ELEMENT(table_table_row_);
} }
// table:table-header-rows
// table-table-header-rows
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-header-rows
const wchar_t * table_table_header_rows::ns = L"table"; const wchar_t * table_table_header_rows::ns = L"table";
const wchar_t * table_table_header_rows::name = L"table-header-rows"; const wchar_t * table_table_header_rows::name = L"table-header-rows";
...@@ -462,9 +452,9 @@ void table_table_header_rows::add_text(const std::wstring & Text) ...@@ -462,9 +452,9 @@ void table_table_header_rows::add_text(const std::wstring & Text)
{ {
} }
// table-rows
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
::std::wostream & table_rows::text_to_stream(::std::wostream & _Wostream) const // table:rows
std::wostream & table_rows::text_to_stream(::std::wostream & _Wostream) const
{ {
if (table_table_rows_) if (table_table_rows_)
CP_SERIALIZE_TEXT(table_table_rows_); CP_SERIALIZE_TEXT(table_table_rows_);
...@@ -489,8 +479,8 @@ void table_rows::add_child_element( xml::sax * Reader, const ::std::wstring & Ns ...@@ -489,8 +479,8 @@ void table_rows::add_child_element( xml::sax * Reader, const ::std::wstring & Ns
} }
} }
// table-rows-no-group
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:rows-no-group
const wchar_t * table_rows_no_group::ns = L"table"; const wchar_t * table_rows_no_group::ns = L"table";
const wchar_t * table_rows_no_group::name = L"table-rows-no-group"; const wchar_t * table_rows_no_group::name = L"table-rows-no-group";
...@@ -560,9 +550,8 @@ void table_rows_and_groups::add_child_element( xml::sax * Reader, const ::std::w ...@@ -560,9 +550,8 @@ void table_rows_and_groups::add_child_element( xml::sax * Reader, const ::std::w
not_applicable_element(L"table-rows-and-groups", Reader, Ns, Name); not_applicable_element(L"table-rows-and-groups", Reader, Ns, Name);
} }
// table:table-row-group
// table-table-row-group
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:table-row-group
const wchar_t * table_table_row_group::ns = L"table"; const wchar_t * table_table_row_group::ns = L"table";
const wchar_t * table_table_row_group::name = L"table-row-group"; const wchar_t * table_table_row_group::name = L"table-row-group";
...@@ -581,19 +570,15 @@ void table_table_row_group::add_child_element( xml::sax * Reader, const ::std::w ...@@ -581,19 +570,15 @@ void table_table_row_group::add_child_element( xml::sax * Reader, const ::std::w
table_rows_and_groups_.add_child_element(Reader, Ns, Name, getContext()); table_rows_and_groups_.add_child_element(Reader, Ns, Name, getContext());
} }
// table-table-row-group-attlist
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table-table-row-group-attlist
void table_table_row_group_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void table_table_row_group_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"table:display", table_display_, true); CP_APPLY_ATTR(L"table:display", table_display_, true);
} }
///////////
// table:shapes
// table-shapes
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
// table:shapes
const wchar_t * table_shapes::ns = L"table"; const wchar_t * table_shapes::ns = L"table";
const wchar_t * table_shapes::name = L"shapes"; const wchar_t * table_shapes::name = L"shapes";
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
namespace cpdoccore { namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
// table-table-attlist // table:table-attlist
class table_table_attlist class table_table_attlist
{ {
public: public:
...@@ -35,13 +35,13 @@ public: ...@@ -35,13 +35,13 @@ public:
bool table_use_first_row_styles_; // default false; bool table_use_first_row_styles_; // default false;
bool table_use_banding_rows_styles_; //defualt 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; bool table_use_banding_columns_styles_; //defualt false;
friend class table_table; friend class table_table;
}; };
// table-table-row-attlist // table:table-row-attlist
class table_table_row_attlist class table_table_row_attlist
{ {
public: public:
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
}; };
// table-table-cell-attlist // table:table-cell-attlist
class table_table_cell_attlist class table_table_cell_attlist
{ {
public: public:
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
}; };
// table-table-cell-attlist-extra // table:table-cell-attlist-extra
class table_table_cell_attlist_extra class table_table_cell_attlist_extra
{ {
public: public:
...@@ -101,7 +101,7 @@ public: ...@@ -101,7 +101,7 @@ public:
}; };
// table-linked-source-attlist // table:linked-source-attlist
class table_linked_source_attlist class table_linked_source_attlist
{ {
public: public:
...@@ -116,9 +116,7 @@ public: ...@@ -116,9 +116,7 @@ public:
}; };
/// \class table_table_source // table:table-source
/// \brief table:table-source
/// table-table-source
class table_table_source : public office_element_impl<table_table_source> class table_table_source : public office_element_impl<table_table_source>
{ {
public: public:
...@@ -135,13 +133,11 @@ public: ...@@ -135,13 +133,11 @@ public:
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); 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); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_table_source); CP_REGISTER_OFFICE_ELEMENT2(table_table_source);
// table-columns // table:columns
class table_columns class table_columns
{ {
public: public:
...@@ -157,7 +153,7 @@ public: ...@@ -157,7 +153,7 @@ public:
}; };
// table-columns-no-group // table:columns-no-group
class table_columns_no_group: public office_element class table_columns_no_group: public office_element
{ {
public: public:
...@@ -188,12 +184,11 @@ public: ...@@ -188,12 +184,11 @@ public:
bool was_header_; bool was_header_;
office_element_ptr table_table_header_columns_; office_element_ptr table_table_header_columns_;
table_columns table_columns_2_; table_columns table_columns_2_;
}; };
// table-columns-and-groups // table:columns-and-groups
class table_columns_and_groups class table_columns_and_groups
{ {
public: public:
...@@ -212,7 +207,7 @@ public: ...@@ -212,7 +207,7 @@ public:
}; };
// table-table-column-attlist // table:table-column-attlist
class table_table_column_attlist class table_table_column_attlist
{ {
public: public:
...@@ -226,9 +221,7 @@ public: ...@@ -226,9 +221,7 @@ public:
}; };
// \class table_table_column
// table:table-column // table:table-column
// table-table-column
class table_table_column : public office_element_impl<table_table_column> class table_table_column : public office_element_impl<table_table_column>
{ {
public: public:
...@@ -254,9 +247,7 @@ public: ...@@ -254,9 +247,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_column); CP_REGISTER_OFFICE_ELEMENT2(table_table_column);
// \class table_table_columns
// table:table-columns // table:table-columns
// table-table-columns
class table_table_columns : public office_element_impl<table_table_columns> class table_table_columns : public office_element_impl<table_table_columns>
{ {
public: public:
...@@ -281,9 +272,8 @@ public: ...@@ -281,9 +272,8 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_columns); CP_REGISTER_OFFICE_ELEMENT2(table_table_columns);
// \class table_table_header_columns
// 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> class table_table_header_columns : public office_element_impl<table_table_header_columns>
{ {
public: public:
...@@ -309,7 +299,7 @@ public: ...@@ -309,7 +299,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_columns); CP_REGISTER_OFFICE_ELEMENT2(table_table_header_columns);
// table-table-column-group-attlist // table:table-column-group-attlist
class table_table_column_group_attlist class table_table_column_group_attlist
{ {
public: public:
...@@ -320,9 +310,7 @@ private: ...@@ -320,9 +310,7 @@ private:
}; };
// \class table_table_column_group
// 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> class table_table_column_group : public office_element_impl<table_table_column_group>
{ {
public: public:
...@@ -348,14 +336,11 @@ private: ...@@ -348,14 +336,11 @@ private:
public: public:
table_table_column_group_attlist table_table_column_group_attlist_; table_table_column_group_attlist table_table_column_group_attlist_;
table_columns_and_groups table_columns_and_groups_; table_columns_and_groups table_columns_and_groups_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_table_column_group); CP_REGISTER_OFFICE_ELEMENT2(table_table_column_group);
/// \class table_table_row // table:table-row
/// \brief table:table-row
/// table-table-row
class table_table_row : public office_element_impl<table_table_row> class table_table_row : public office_element_impl<table_table_row>
{ {
public: public:
...@@ -379,14 +364,13 @@ private: ...@@ -379,14 +364,13 @@ private:
public: public:
table_table_row_attlist table_table_row_attlist_; 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); 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 class table_table_cell_content
{ {
public: public:
...@@ -399,13 +383,11 @@ public: ...@@ -399,13 +383,11 @@ public:
private: private:
// TODO table-cell-range-source // TODO table-cell-range-source
// TODO office-annotation
// TODO table-detective // TODO table-detective
office_element_ptr_array text_content_; // text-content office_element_ptr_array text_content_; // text-content
}; };
// \class table_table_cell
// table-table-cell
// table:table-cell // table:table-cell
class table_table_cell : public office_element_impl<table_table_cell> class table_table_cell : public office_element_impl<table_table_cell>
{ {
...@@ -417,7 +399,7 @@ public: ...@@ -417,7 +399,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
table_table_cell() { } table_table_cell() : last_cell_(false) { }
virtual void docx_convert(oox::docx_conversion_context & Context) ; virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ; virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
...@@ -432,6 +414,8 @@ private: ...@@ -432,6 +414,8 @@ private:
virtual void add_text(const std::wstring & Text); virtual void add_text(const std::wstring & Text);
public: public:
bool last_cell_;
table_table_cell_attlist table_table_cell_attlist_; table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_; table_table_cell_attlist_extra table_table_cell_attlist_extra_;
table_table_cell_content table_table_cell_content_; table_table_cell_content table_table_cell_content_;
...@@ -440,8 +424,6 @@ public: ...@@ -440,8 +424,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell); CP_REGISTER_OFFICE_ELEMENT2(table_table_cell);
// \class table_covered_table_cell
// 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> class table_covered_table_cell : public office_element_impl<table_covered_table_cell>
{ {
...@@ -453,7 +435,7 @@ public: ...@@ -453,7 +435,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE(); 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 docx_convert(oox::docx_conversion_context & Context) ;
virtual void pptx_convert(oox::pptx_conversion_context & Context) ; virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
...@@ -467,8 +449,11 @@ private: ...@@ -467,8 +449,11 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text); virtual void add_text(const std::wstring & Text);
public: public:
bool last_cell_;
bool empty_; bool empty_;
table_table_cell_attlist table_table_cell_attlist_; table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_content table_table_cell_content_; table_table_cell_content table_table_cell_content_;
...@@ -476,8 +461,6 @@ public: ...@@ -476,8 +461,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_covered_table_cell); CP_REGISTER_OFFICE_ELEMENT2(table_covered_table_cell);
// \class table_table_rows
// table-table-rows
// table:table-rows // table:table-rows
class table_table_rows : public office_element_impl<table_table_rows> class table_table_rows : public office_element_impl<table_table_rows>
{ {
...@@ -510,8 +493,6 @@ public: ...@@ -510,8 +493,6 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_rows); CP_REGISTER_OFFICE_ELEMENT2(table_table_rows);
// \class table_table_header_rows
// 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> class table_table_header_rows : public office_element_impl<table_table_header_rows>
{ {
...@@ -542,8 +523,7 @@ public: ...@@ -542,8 +523,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows); CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows);
// \class table_rows // table:rows
// table-rows
class table_rows class table_rows
{ {
public: public:
...@@ -560,7 +540,7 @@ public: ...@@ -560,7 +540,7 @@ public:
}; };
// table-rows-no-group // table:rows-no-group
class table_rows_no_group : public office_element class table_rows_no_group : public office_element
{ {
public: public:
...@@ -588,16 +568,15 @@ public: ...@@ -588,16 +568,15 @@ public:
void pptx_convert(oox::pptx_conversion_context & Context) ; void pptx_convert(oox::pptx_conversion_context & Context) ;
public: public:
table_rows table_rows_1_;
bool was_header_; 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 table_rows_2_;
}; };
// table-rows-and-groups // table:rows-and-groups
class table_rows_and_groups class table_rows_and_groups
{ {
public: public:
...@@ -619,7 +598,7 @@ public: ...@@ -619,7 +598,7 @@ public:
}; };
// table-table-row-group-attlist // table:table-row-group-attlist
class table_table_row_group_attlist class table_table_row_group_attlist
{ {
public: public:
...@@ -629,9 +608,6 @@ public: ...@@ -629,9 +608,6 @@ public:
}; };
//
// \class table_table_row_group
// 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> class table_table_row_group : public office_element_impl<table_table_row_group>
{ {
...@@ -647,9 +623,7 @@ public: ...@@ -647,9 +623,7 @@ public:
{ {
} }
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ; virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
virtual std::wostream & text_to_stream(::std::wostream & _Wostream) const;
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const;
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
...@@ -663,9 +637,7 @@ public: ...@@ -663,9 +637,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group); CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group);
/// \class table_table // table:table
/// \brief table:table
/// table-table
class table_table : public office_element_impl<table_table> class table_table : public office_element_impl<table_table>
{ {
public: public:
...@@ -686,21 +658,19 @@ private: ...@@ -686,21 +658,19 @@ private:
public: public:
table_table_attlist table_table_attlist_; 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 //office-dde-source
//table-scenario //table-scenario
//office-forms //office-forms
office_element_ptr table_shapes_; 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_; table_rows_and_groups table_rows_and_groups_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_table); CP_REGISTER_OFFICE_ELEMENT2(table_table);
/// \class table_shapes // table:shapes
/// \brief table:shapes
/// table-shapes
class table_shapes : public office_element_impl<table_shapes> class table_shapes : public office_element_impl<table_shapes>
{ {
public: public:
...@@ -719,7 +689,6 @@ private: ...@@ -719,7 +689,6 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); 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); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
private:
office_element_ptr_array content_; office_element_ptr_array content_;
}; };
......
...@@ -35,9 +35,9 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex ...@@ -35,9 +35,9 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
Context.get_table_context().start_cell_content(); Context.get_table_context().start_cell_content();
Context.get_text_context().set_cell_text_properties(text_properties); Context.get_text_context().set_cell_text_properties(text_properties);
BOOST_FOREACH(office_element_ptr const & elm, text_content_) for (int i = 0 ; i < text_content_.size(); i++)
{ {
elm->xlsx_convert(Context); text_content_[i]->xlsx_convert(Context);
} }
const int sharedStrId = Context.get_table_context().end_cell_content(); const int sharedStrId = Context.get_table_context().end_cell_content();
...@@ -160,8 +160,18 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -160,8 +160,18 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
CP_XML_STREAM(); CP_XML_STREAM();
BOOST_FOREACH(const office_element_ptr & elm, content_) for (int i = 0 ; i < content_.size(); i++)
{
office_element_ptr & elm = content_[i];
if (i == content_.size() - 1) //mark last cell in row (for skip empty styled)
{ {
table_table_cell *cell = dynamic_cast<table_table_cell*> (elm.get());
table_covered_table_cell *covered_cell = dynamic_cast<table_covered_table_cell*>(elm.get());
if (cell) cell->last_cell_ = true;
else if (covered_cell) covered_cell->last_cell_ = true;
}
elm->xlsx_convert(Context); elm->xlsx_convert(Context);
} }
...@@ -173,10 +183,10 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -173,10 +183,10 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
if (Context.is_empty_row()) if (Context.is_empty_row())
{ {
skip_next_row = true; skip_next_row = true;
if (table_table_row_attlist_.table_number_rows_repeated_ > 65400) if (table_table_row_attlist_.table_number_rows_repeated_ > 0xff00)
break;//__.ods (1 ) break;//__.ods (1 )
} }
if (content_.size() > 0 && table_table_row_attlist_.table_number_rows_repeated_ > 65400) if (content_.size() > 0 && table_table_row_attlist_.table_number_rows_repeated_ > 0xff00)
{ {
table_table_cell * table_cell = dynamic_cast<table_table_cell *>(content_[0].get()); table_table_cell * table_cell = dynamic_cast<table_table_cell *>(content_[0].get());
if ((table_cell) && (table_cell->table_table_cell_attlist_.table_number_columns_repeated_ > 1000)) if ((table_cell) && (table_cell->table_table_cell_attlist_.table_number_columns_repeated_ > 1000))
...@@ -192,17 +202,17 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -192,17 +202,17 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
void table_table_rows::xlsx_convert(oox::xlsx_conversion_context & Context) void table_table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
BOOST_FOREACH(office_element_ptr const & elm, table_table_row_) for (int i = 0; i < table_table_row_.size(); i++)
{ {
elm->xlsx_convert(Context); table_table_row_[i]->xlsx_convert(Context);
} }
} }
void table_table_header_rows::xlsx_convert(oox::xlsx_conversion_context & Context) void table_table_header_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
BOOST_FOREACH(office_element_ptr const & elm, table_table_row_) for (int i = 0; i < table_table_row_.size(); i++)
{ {
elm->xlsx_convert(Context); table_table_row_[i]->xlsx_convert(Context);
} }
} }
...@@ -212,9 +222,9 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -212,9 +222,9 @@ void table_rows::xlsx_convert(oox::xlsx_conversion_context & Context)
table_table_rows_->xlsx_convert(Context); table_table_rows_->xlsx_convert(Context);
else else
{ {
BOOST_FOREACH(office_element_ptr const & elm, table_table_row_) for (int i = 0; i < table_table_row_.size(); i++)
{ {
elm->xlsx_convert(Context); table_table_row_[i]->xlsx_convert(Context);
} }
} }
} }
...@@ -231,14 +241,9 @@ void table_rows_no_group::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -231,14 +241,9 @@ void table_rows_no_group::xlsx_convert(oox::xlsx_conversion_context & Context)
void table_rows_and_groups::xlsx_convert(oox::xlsx_conversion_context & Context) void table_rows_and_groups::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
//BOOST_FOREACH(office_element_ptr const & elm, content_) for (int i = 0; i < content_.size(); i++)
int i=0;
int size = content_.size();
while(true)
{ {
if (i>=size)break;
content_[i]->xlsx_convert(Context); content_[i]->xlsx_convert(Context);
i++;
} }
} }
...@@ -285,9 +290,9 @@ void table_columns::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -285,9 +290,9 @@ void table_columns::xlsx_convert(oox::xlsx_conversion_context & Context)
if (table_table_columns_) if (table_table_columns_)
table_table_columns_->xlsx_convert(Context); table_table_columns_->xlsx_convert(Context);
BOOST_FOREACH(office_element_ptr const & elm, table_table_column_) for (int i = 0; i < table_table_column_.size(); i++)
{ {
elm->xlsx_convert(Context); table_table_column_[i]->xlsx_convert(Context);
} }
} }
...@@ -309,26 +314,19 @@ void table_columns_and_groups::xlsx_convert(oox::xlsx_conversion_context & Conte ...@@ -309,26 +314,19 @@ void table_columns_and_groups::xlsx_convert(oox::xlsx_conversion_context & Conte
else else
table_columns_no_group_.xlsx_convert(Context); table_columns_no_group_.xlsx_convert(Context);
*/ */
//BOOST_FOREACH(office_element_ptr const & elm, content_)
//{ for (int i = 0; i < content_.size(); i++)
// elm->xlsx_convert(Context); {
//} office_element_ptr & elm = content_[i];
int i=0;
int size = content_.size();
while(true)
{
if (i>=size)break;
office_element_ptr const & elm = content_[i];
elm->xlsx_convert(Context); elm->xlsx_convert(Context);
i++;
} }
} }
void table_table_header_columns::xlsx_convert(oox::xlsx_conversion_context & Context) void table_table_header_columns::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
BOOST_FOREACH(office_element_ptr const & elm, table_table_column_) for (int i = 0; i < table_table_column_.size(); i++)
{ {
elm->xlsx_convert(Context); table_table_column_[i]->xlsx_convert(Context);
} }
} }
...@@ -363,6 +361,9 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -363,6 +361,9 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
int cMin = 0, cMax = 0; int cMin = 0, cMax = 0;
Context.start_table_column(columnsRepeated, defaultCellStyleName, cMin, cMax); Context.start_table_column(columnsRepeated, defaultCellStyleName, cMin, cMax);
if ( cMin > 16384 ) return;
if ( cMax > 16384 ) cMax = 16384;
double pt_width = 0.0; double pt_width = 0.0;
double cm_width = 0.0; double cm_width = 0.0;
double in_width = 0.0; double in_width = 0.0;
...@@ -385,7 +386,7 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -385,7 +386,7 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
//CP_XML_ATTR(L"hidden", L"false"); //CP_XML_ATTR(L"hidden", L"false");
} }
CP_XML_ATTR(L"max", cMax); CP_XML_ATTR(L"max", cMax);
CP_XML_ATTR(L"min", (cMin+1)); CP_XML_ATTR(L"min", (cMin + 1));
if (table_table_column_attlist_.table_style_name_) if (table_table_column_attlist_.table_style_name_)
{ {
...@@ -547,20 +548,21 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -547,20 +548,21 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
const std::wstring formula = table_table_cell_attlist_.table_formula_.get_value_or(L""); const std::wstring formula = table_table_cell_attlist_.table_formula_.get_value_or(L"");
const std::wstring styleName = table_table_cell_attlist_.table_style_name_.get_value_or(style_ref(L"")).style_name(); const std::wstring styleName = table_table_cell_attlist_.table_style_name_.get_value_or(style_ref(L"")).style_name();
const common_value_and_type_attlist & attr = table_table_cell_attlist_.common_value_and_type_attlist_;
bool skip_next_cell = false; office_value_type::type odf_value_type = office_value_type::Custom;
size_t xfId_last_set = 0; oox::XlsxCellType::type t_val = oox::XlsxCellType::s;
bool is_style_visible = true; std::wstring number_val = L"";
int empty_cell = 0; _CP_OPT(bool) bool_val;
_CP_OPT(std::wstring) str_val;
for (unsigned int r = 0; r < table_table_cell_attlist_.table_number_columns_repeated_; ++r) std::wstring num_format = L"";
{
Context.start_table_cell ( formula,
table_table_cell_attlist_extra_.table_number_columns_spanned_ - 1,
table_table_cell_attlist_extra_.table_number_rows_spanned_ - 1
);
if (skip_next_cell)break; size_t xfId_last_set = 0;
int empty_cell_count = 0;
bool skip_next_cell = false;
bool is_style_visible = true;
bool is_data_visible = false;
// //
odf_read_context & odfContext = Context.root()->odf_context(); odf_read_context & odfContext = Context.root()->odf_context();
...@@ -611,40 +613,29 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -611,40 +613,29 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
paragraph_format_properties parFormatProperties = calc_paragraph_properties_content (instances); paragraph_format_properties parFormatProperties = calc_paragraph_properties_content (instances);
style_table_cell_properties_attlist cellFormatProperties = calc_table_cell_properties (instances); style_table_cell_properties_attlist cellFormatProperties = calc_table_cell_properties (instances);
using oox::XlsxCellType;
XlsxCellType::type t_val = XlsxCellType::s;
std::wstring number_val = L"";
_CP_OPT(bool) bool_val;
_CP_OPT(std::wstring) str_val;
office_value_type::type odf_value_type = office_value_type::Custom;
//if (table_table_cell_attlist_.common_value_and_type_attlist_)
{
const common_value_and_type_attlist & attr = table_table_cell_attlist_.common_value_and_type_attlist_;
if (attr.office_value_type_) if (attr.office_value_type_)
odf_value_type = attr.office_value_type_->get_type(); odf_value_type = attr.office_value_type_->get_type();
if ((odf_value_type == office_value_type::Float) || if ((odf_value_type == office_value_type::Float) ||
(odf_value_type == office_value_type::Custom && attr.office_value_)) (odf_value_type == office_value_type::Custom && attr.office_value_))
{ {
t_val = XlsxCellType::n; t_val = oox::XlsxCellType::n;
number_val = attr.office_value_.get_value_or(L""); number_val = attr.office_value_.get_value_or(L"");
} }
else if (odf_value_type == office_value_type::Percentage) else if (odf_value_type == office_value_type::Percentage)
{ {
t_val = XlsxCellType::n; t_val = oox::XlsxCellType::n;
number_val = attr.office_value_.get_value_or(L""); number_val = attr.office_value_.get_value_or(L"");
} }
else if (odf_value_type == office_value_type::Currency) else if (odf_value_type == office_value_type::Currency)
{ {
t_val = XlsxCellType::n; t_val = oox::XlsxCellType::n;
number_val = attr.office_value_.get_value_or(L""); number_val = attr.office_value_.get_value_or(L"");
} }
else if ((odf_value_type == office_value_type::Date) || else if ((odf_value_type == office_value_type::Date) ||
(odf_value_type == office_value_type::Custom && attr.office_date_value_)) (odf_value_type == office_value_type::Custom && attr.office_date_value_))
{ {
t_val = XlsxCellType::n; t_val = oox::XlsxCellType::n;
if (attr.office_date_value_) if (attr.office_date_value_)
{ {
int y, m, d; int y, m, d;
...@@ -657,7 +648,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -657,7 +648,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
else if ((odf_value_type == office_value_type::Time) || else if ((odf_value_type == office_value_type::Time) ||
(odf_value_type == office_value_type::Custom && attr.office_time_value_)) (odf_value_type == office_value_type::Custom && attr.office_time_value_))
{ {
t_val = XlsxCellType::n; t_val = oox::XlsxCellType::n;
if (attr.office_time_value_) if (attr.office_time_value_)
{ {
const std::wstring tv = attr.office_time_value_.get(); const std::wstring tv = attr.office_time_value_.get();
...@@ -672,20 +663,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -672,20 +663,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
else if ((odf_value_type == office_value_type::Boolean) || else if ((odf_value_type == office_value_type::Boolean) ||
(odf_value_type == office_value_type::Custom && attr.office_boolean_value_)) (odf_value_type == office_value_type::Custom && attr.office_boolean_value_))
{ {
t_val = XlsxCellType::b; t_val = oox::XlsxCellType::b;
if (attr.office_boolean_value_) if (attr.office_boolean_value_) bool_val = oox::parseBoolVal(attr.office_boolean_value_.get());
bool_val = oox::parseBoolVal(attr.office_boolean_value_.get());
} }
else if ((odf_value_type == office_value_type::String) || else if ((odf_value_type == office_value_type::String) ||
(odf_value_type == office_value_type::Custom && attr.office_string_value_)) (odf_value_type == office_value_type::Custom && attr.office_string_value_))
{ {
t_val = XlsxCellType::str; t_val = oox::XlsxCellType::str;
if (attr.office_string_value_) if (attr.office_string_value_) str_val = attr.office_string_value_.get();
str_val = attr.office_string_value_.get();
} }
}
std::wstring num_format = L"";
if (!data_style.empty()) if (!data_style.empty())
{ {
...@@ -709,16 +695,24 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -709,16 +695,24 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
const int sharedStringId = table_table_cell_content_.xlsx_convert(Context, &textFormatProperties); const int sharedStringId = table_table_cell_content_.xlsx_convert(Context, &textFormatProperties);
if (t_val == XlsxCellType::str && sharedStringId >=0) t_val = XlsxCellType::s;// , if (t_val == oox::XlsxCellType::str && sharedStringId >=0)
t_val = oox::XlsxCellType::s;// ,
Context.set_current_cell_style_id(xfId_last_set); if (sharedStringId >= 0 ||
!formula.empty() ||
( t_val == oox::XlsxCellType::n && !number_val.empty()) ||
( t_val == oox::XlsxCellType::b && bool_val) ||
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val)) is_data_visible = true;
bool is_data_visible = false; if (table_table_cell_attlist_.table_number_columns_repeated_ < 199 && last_cell_) last_cell_ = false;
for (unsigned int r = 0; r < table_table_cell_attlist_.table_number_columns_repeated_; ++r)
{
Context.start_table_cell ( formula, table_table_cell_attlist_extra_.table_number_columns_spanned_ - 1 ,
table_table_cell_attlist_extra_.table_number_rows_spanned_ - 1 );
Context.set_current_cell_style_id(xfId_last_set);
if (sharedStringId >= 0 || !formula.empty() || if (skip_next_cell)break;
(t_val == XlsxCellType::n && !number_val.empty()) ||
(t_val == XlsxCellType::b && bool_val) ||
((t_val == XlsxCellType::str || XlsxCellType::inlineStr) && str_val))is_data_visible = true;
// . // .
if ( is_data_visible || ((cellStyle || defaultColumnCellStyle) && is_style_visible)) if ( is_data_visible || ((cellStyle || defaultColumnCellStyle) && is_style_visible))
...@@ -748,57 +742,42 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -748,57 +742,42 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
CP_XML_ATTR(L"t", L"array"); CP_XML_ATTR(L"t", L"array");
CP_XML_ATTR(L"aca", false); CP_XML_ATTR(L"aca", false);
} }
//CP_XML_CONTENT(xml::utils::replace_lt_gt(xlsxFormula));
CP_XML_CONTENT(xlsxFormula); CP_XML_CONTENT(xlsxFormula);
} }
} }
} }
if (sharedStringId >= 0 && t_val == XlsxCellType::s) if (sharedStringId >= 0 && t_val == oox::XlsxCellType::s)
{ {
CP_XML_NODE(L"v") CP_XML_NODE(L"v") { CP_XML_CONTENT(sharedStringId); }
{
CP_XML_CONTENT(sharedStringId);
}
} }
else if ((t_val == XlsxCellType::str || t_val == XlsxCellType::inlineStr) && str_val) else if ((t_val == oox::XlsxCellType::str || t_val == oox::XlsxCellType::inlineStr) && str_val)
{ {
CP_XML_NODE(L"v") CP_XML_NODE(L"v") { CP_XML_CONTENT(str_val.get()); }
{
CP_XML_CONTENT(str_val.get());
} }
} else if (t_val == oox::XlsxCellType::n && !number_val.empty())
else if (t_val == XlsxCellType::n && !number_val.empty())
{ {
CP_XML_NODE(L"v") CP_XML_NODE(L"v") { CP_XML_CONTENT(number_val);}
{
CP_XML_CONTENT(number_val);
}
} }
else if (t_val == XlsxCellType::b && bool_val) else if (t_val == oox::XlsxCellType::b && bool_val)
{
CP_XML_NODE(L"v")
{ {
CP_XML_CONTENT((int)(bool_val.get())); CP_XML_NODE(L"v") { CP_XML_CONTENT((int)(bool_val.get())); }
} }
} }
} if ( is_data_visible || (cellStyle && is_style_visible && !last_cell_))
if ( is_data_visible || (cellStyle && is_style_visible))
{ {
Context.non_empty_row(); Context.non_empty_row();
empty_cell = 0 ; empty_cell_count = 0 ;
} }
else else
{ {
empty_cell++; empty_cell_count++;
//__.ods - 13 cellStyle=NULL - !!! //__.ods - 13 cellStyle=NULL - !!!
if (empty_cell > 19 && (table_table_cell_attlist_.table_number_columns_repeated_>299 || cellStyle == NULL)) if (empty_cell_count > 19 && (table_table_cell_attlist_.table_number_columns_repeated_> 299 || cellStyle == NULL))
{// {//
skip_next_cell = true; skip_next_cell = true;
} }
} }
} }
} }
else else
......
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