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

OdfFormatReader - поправлено вращение текста +...

OdfFormatReader - поправлено вращение текста + Уведомление_о_вручении.ods(множественные repeate строк и столбцов)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@65225 954022d7-b5bf-4e40-9824-e11837661b57
parent b176a74b
...@@ -92,14 +92,22 @@ xlsx_alignment OdfProperties2XlsxAlignment(const odf_reader::text_format_propert ...@@ -92,14 +92,22 @@ xlsx_alignment OdfProperties2XlsxAlignment(const odf_reader::text_format_propert
if (textProp && textProp->style_text_rotation_angle_) if (textProp && textProp->style_text_rotation_angle_)
{ {
alignment.textRotation = textProp->style_text_rotation_angle_.get(); int angle = textProp->style_text_rotation_angle_.get();
alignment.textRotation = angle;
} }
if (cellProp && cellProp->common_rotation_angle_attlist_.style_rotation_angle_) if (cellProp && cellProp->common_rotation_angle_attlist_.style_rotation_angle_)
{ {
alignment.textRotation = cellProp->common_rotation_angle_attlist_.style_rotation_angle_.get(); int angle = cellProp->common_rotation_angle_attlist_.style_rotation_angle_.get();
}
if (angle > 90)
angle = angle - 90;
if (angle < -90)
angle = 90 + angle;
alignment.textRotation = angle;
}
_CP_OPT(odf_types::vertical_align) v_align; _CP_OPT(odf_types::vertical_align) v_align;
......
...@@ -23,16 +23,6 @@ void xlsx_serialize(std::wostream & _Wostream, const xlsx_cell_style & cell_styl ...@@ -23,16 +23,6 @@ void xlsx_serialize(std::wostream & _Wostream, const xlsx_cell_style & cell_styl
} }
} }
//_Wostream << L"<cellStyle ";
//if (cell_style.name)
// _Wostream << L"name=\"" << cell_style.name.get() << L"\" ";
//if (cell_style.xfId)
// _Wostream << L"xfId=\"" << cell_style.xfId.get() << L"\" ";
//if (cell_style.builtinId)
// _Wostream << L"builtinId=\"" << cell_style.builtinId.get() << L"\" ";
//_Wostream << L"/>";
} }
} }
......
...@@ -43,15 +43,6 @@ void xlsx_cell_styles::xlsx_serialize(std::wostream & _Wostream) const ...@@ -43,15 +43,6 @@ void xlsx_cell_styles::xlsx_serialize(std::wostream & _Wostream) const
} }
} }
} }
//_Wostream << L"<cellStyles count=\"" << impl_->cell_styles_.size() << L"\">";
//
//BOOST_FOREACH(const xlsx_cell_style & s, impl_->cell_styles_)
//{
// ::cpdoccore::oox::xlsx_serialize(_Wostream, s);
//}
//_Wostream << L"</cellStyles>";
} }
......
...@@ -48,6 +48,7 @@ private: ...@@ -48,6 +48,7 @@ private:
private: private:
size_t next_index_; size_t next_index_;
void insert(xlsx_xf const & xf) void insert(xlsx_xf const & xf)
{ {
xf.index = next_index_++; xf.index = next_index_++;
...@@ -95,26 +96,11 @@ xlsx_style_manager::~xlsx_style_manager() ...@@ -95,26 +96,11 @@ xlsx_style_manager::~xlsx_style_manager()
xlsx_style_manager::Impl::Impl() : next_index_(0) xlsx_style_manager::Impl::Impl() : next_index_(0)
{ {
//{
// xlsx_xf xfRecord;
// xfRecord.xfId = 0;
// xfRecord.borderId = 0;
// xfRecord.numFmtId = 0;
// xfRecord.fillId = 0;
// xfRecord.fontId = 0;
// insert(xfRecord);
// //cellXfs_.insert(xfRecord);
// //cellXfs_.push_back(xfRecord); // default
//}
{
xlsx_xf xfRecord; xlsx_xf xfRecord;
xfRecord.applyNumberForm = true; xfRecord.applyNumberForm = true;
xfRecord.numFmtId = 0; xfRecord.numFmtId = 0;
cellStyleXfs_.insert(xfRecord); cellStyleXfs_.insert(xfRecord);
//cellStyleXfs_.push_back(xfRecord);
}
} }
size_t xlsx_style_manager::Impl::size() const size_t xlsx_style_manager::Impl::size() const
...@@ -126,6 +112,7 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c ...@@ -126,6 +112,7 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
const odf_reader::paragraph_format_properties * parProp, const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp, const odf_reader::style_table_cell_properties_attlist * cellProp,
const xlsx_cell_format * xlxsCellFormat, const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible ) const std::wstring &num_format, bool default_set, bool & is_visible )
{ {
bool is_visible_set = is_visible; bool is_visible_set = is_visible;
...@@ -175,18 +162,15 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c ...@@ -175,18 +162,15 @@ size_t xlsx_style_manager::Impl::xfId(const odf_reader::text_format_properties_c
xfRecord.xfId = 0; xfRecord.xfId = 0;
xfRecord.alignment = alignment; xfRecord.alignment = alignment;
//xlsx_xf_array::const_iterator i = std::find(cellXfs_.begin(), cellXfs_.end(), xfRecord);
xlsx_xf_array::const_iterator i = cellXfs_.find(xfRecord); xlsx_xf_array::const_iterator i = cellXfs_.find(xfRecord);
if (i != cellXfs_.end()) if (i != cellXfs_.end())
{ {
const std::size_t dbgId = i->index; const std::size_t dbgId = i->index;
//const unsigned int dbgId = i - cellXfs_.begin();
return dbgId; return dbgId;
} }
else else
{ {
insert(xfRecord); insert(xfRecord);
//cellXfs_.push_back(xfRecord);
} }
return id; return id;
......
...@@ -239,30 +239,31 @@ void style_table_column_properties::xlsx_convert(oox::xlsx_conversion_context & ...@@ -239,30 +239,31 @@ void style_table_column_properties::xlsx_convert(oox::xlsx_conversion_context &
void style_table_cell_properties_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes ) void style_table_cell_properties_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
CP_APPLY_ATTR(L"style:vertical-align", style_vertical_align_); CP_APPLY_ATTR(L"style:vertical-align" , style_vertical_align_);
CP_APPLY_ATTR(L"style:text-align-source", style_text_align_source_); CP_APPLY_ATTR(L"style:text-align-source" , style_text_align_source_);
CP_APPLY_ATTR(L"style:direction", style_direction_); CP_APPLY_ATTR(L"style:direction" , style_direction_);
CP_APPLY_ATTR(L"style:glyph-orientation-vertical", style_glyph_orientation_vertical_); CP_APPLY_ATTR(L"style:glyph-orientation-vertical" , style_glyph_orientation_vertical_);
common_shadow_attlist_.add_attributes(Attributes); common_shadow_attlist_.add_attributes(Attributes);
common_background_color_attlist_.add_attributes(Attributes); common_background_color_attlist_.add_attributes(Attributes);
common_border_attlist_.add_attributes(Attributes); common_border_attlist_.add_attributes(Attributes);
common_border_line_width_attlist_.add_attributes(Attributes); common_border_line_width_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"style:diagonal-tl-br", style_diagonal_tl_br_); CP_APPLY_ATTR(L"style:diagonal-tl-br" , style_diagonal_tl_br_);
CP_APPLY_ATTR(L"style:diagonal-tl-br-widths", style_diagonal_tl_br_widths_); CP_APPLY_ATTR(L"style:diagonal-tl-br-widths" , style_diagonal_tl_br_widths_);
CP_APPLY_ATTR(L"style:diagonal-bl-tr", style_diagonal_bl_tr_); CP_APPLY_ATTR(L"style:diagonal-bl-tr" , style_diagonal_bl_tr_);
CP_APPLY_ATTR(L"style:diagonal-bl-tr-widths", style_diagonal_bl_tr_widths_); CP_APPLY_ATTR(L"style:diagonal-bl-tr-widths" , style_diagonal_bl_tr_widths_);
common_padding_attlist_.add_attributes(Attributes); common_padding_attlist_.add_attributes(Attributes);
common_rotation_angle_attlist_.add_attributes(Attributes); common_rotation_angle_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"fo:wrap-option", fo_wrap_option_); CP_APPLY_ATTR(L"fo:wrap-option" , fo_wrap_option_);
CP_APPLY_ATTR(L"style:rotation-align", style_rotation_align_); CP_APPLY_ATTR(L"style:rotation-align" , style_rotation_align_);
CP_APPLY_ATTR(L"style:cell-protect", style_cell_protect_); CP_APPLY_ATTR(L"style:cell-protect" , style_cell_protect_);
CP_APPLY_ATTR(L"style:print-content", style_print_content_); CP_APPLY_ATTR(L"style:print-content" , style_print_content_);
CP_APPLY_ATTR(L"style:decimal-places", style_decimal_places_); CP_APPLY_ATTR(L"style:decimal-places" , style_decimal_places_);
CP_APPLY_ATTR(L"style:repeat-content", style_repeat_content_); CP_APPLY_ATTR(L"style:repeat-content" , style_repeat_content_);
CP_APPLY_ATTR(L"style:shrink-to-fit", style_shrink_to_fit_); CP_APPLY_ATTR(L"style:shrink-to-fit" , style_shrink_to_fit_);
} }
...@@ -364,6 +365,7 @@ void insert_cell_margin(oox::docx_conversion_context & Context, ...@@ -364,6 +365,7 @@ void insert_cell_margin(oox::docx_conversion_context & Context,
std::wostream & strm = Context.output_stream(); std::wostream & strm = Context.output_stream();
strm<< L"<w:" << Side << L" w:type=\"dxa\" w:w=\"" << (int)(0.5 + 20.0 * Length.get_value_unit(length::pt)) << L"\" />"; strm<< L"<w:" << Side << L" w:type=\"dxa\" w:w=\"" << (int)(0.5 + 20.0 * Length.get_value_unit(length::pt)) << L"\" />";
} }
void insert_cell_border(oox::docx_conversion_context & Context, void insert_cell_border(oox::docx_conversion_context & Context,
const std::wstring & Side, const std::wstring & Side,
const _CP_OPT(border_style) & BorderStyle, const _CP_OPT(border_style) & BorderStyle,
...@@ -642,31 +644,31 @@ void style_table_cell_properties::docx_convert(oox::docx_conversion_context & Co ...@@ -642,31 +644,31 @@ void style_table_cell_properties::docx_convert(oox::docx_conversion_context & Co
void style_table_cell_properties_attlist::apply_from(const style_table_cell_properties_attlist & Other) void style_table_cell_properties_attlist::apply_from(const style_table_cell_properties_attlist & Other)
{ {
_CP_APPLY_PROP(style_vertical_align_, Other.style_vertical_align_); _CP_APPLY_PROP(style_vertical_align_ , Other.style_vertical_align_);
_CP_APPLY_PROP(style_text_align_source_, Other.style_text_align_source_); _CP_APPLY_PROP(style_text_align_source_ , Other.style_text_align_source_);
_CP_APPLY_PROP(style_direction_, Other.style_direction_); _CP_APPLY_PROP(style_direction_ , Other.style_direction_);
_CP_APPLY_PROP(style_glyph_orientation_vertical_, Other.style_glyph_orientation_vertical_); _CP_APPLY_PROP(style_glyph_orientation_vertical_ , Other.style_glyph_orientation_vertical_);
common_shadow_attlist_.apply_from(Other.common_shadow_attlist_); common_shadow_attlist_.apply_from (Other.common_shadow_attlist_);
common_background_color_attlist_.apply_from(Other.common_background_color_attlist_); common_background_color_attlist_.apply_from (Other.common_background_color_attlist_);
common_border_attlist_.apply_from(Other.common_border_attlist_); common_border_attlist_.apply_from (Other.common_border_attlist_);
_CP_APPLY_PROP(style_diagonal_tl_br_, Other.style_diagonal_tl_br_); _CP_APPLY_PROP(style_diagonal_tl_br_ , Other.style_diagonal_tl_br_);
_CP_APPLY_PROP(style_diagonal_tl_br_widths_, Other.style_diagonal_tl_br_widths_); _CP_APPLY_PROP(style_diagonal_tl_br_widths_ , Other.style_diagonal_tl_br_widths_);
_CP_APPLY_PROP(style_diagonal_bl_tr_, Other.style_diagonal_bl_tr_); _CP_APPLY_PROP(style_diagonal_bl_tr_ , Other.style_diagonal_bl_tr_);
_CP_APPLY_PROP(style_diagonal_bl_tr_widths_, Other.style_diagonal_bl_tr_widths_); _CP_APPLY_PROP(style_diagonal_bl_tr_widths_ , Other.style_diagonal_bl_tr_widths_);
common_border_line_width_attlist_.apply_from(Other.common_border_line_width_attlist_); common_border_line_width_attlist_.apply_from(Other.common_border_line_width_attlist_);
common_padding_attlist_.apply_from(Other.common_padding_attlist_); common_padding_attlist_.apply_from (Other.common_padding_attlist_);
_CP_APPLY_PROP(fo_wrap_option_, Other.fo_wrap_option_); common_rotation_angle_attlist_.apply_from (Other.common_rotation_angle_attlist_);
common_rotation_angle_attlist_.apply_from(Other.common_rotation_angle_attlist_);
_CP_APPLY_PROP(fo_wrap_option_ , Other.fo_wrap_option_);
_CP_APPLY_PROP(style_rotation_align_, Other.style_rotation_align_); _CP_APPLY_PROP(style_rotation_align_ , Other.style_rotation_align_);
_CP_APPLY_PROP(style_cell_protect_, Other.style_cell_protect_); _CP_APPLY_PROP(style_cell_protect_ , Other.style_cell_protect_);
_CP_APPLY_PROP(style_print_content_, Other.style_print_content_); _CP_APPLY_PROP(style_print_content_ , Other.style_print_content_);
_CP_APPLY_PROP(style_decimal_places_, Other.style_decimal_places_); _CP_APPLY_PROP(style_decimal_places_ , Other.style_decimal_places_);
_CP_APPLY_PROP(style_repeat_content_, Other.style_repeat_content_); _CP_APPLY_PROP(style_repeat_content_ , Other.style_repeat_content_);
_CP_APPLY_PROP(style_shrink_to_fit_, Other.style_shrink_to_fit_); _CP_APPLY_PROP(style_shrink_to_fit_ , Other.style_shrink_to_fit_);
} }
} }
......
...@@ -174,13 +174,26 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -174,13 +174,26 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
elm->xlsx_convert(Context); elm->xlsx_convert(Context);
} }
} }
} }
} }
Context.end_table_row(); Context.end_table_row();
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)
break;//__.ods (1 )
}
if (content_.size() > 0 && table_table_row_attlist_.table_number_rows_repeated_ > 65400)
{
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))
{
break;//__.ods (2 )
}
}
} }
Context.get_table_metrics().add_rows(table_table_row_attlist_.table_number_rows_repeated_, !hidden ? row_height : 0.0); Context.get_table_metrics().add_rows(table_table_row_attlist_.table_number_rows_repeated_, !hidden ? row_height : 0.0);
...@@ -778,7 +791,8 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -778,7 +791,8 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
else else
{ {
empty_cell++; empty_cell++;
if ((empty_cell > 4 && table_table_cell_attlist_.table_number_columns_repeated_>299) || (cellStyle == NULL)) //__.ods - 13 cellStyle=NULL - !!!
if (empty_cell > 19 && (table_table_cell_attlist_.table_number_columns_repeated_>299 || cellStyle == NULL))
{// {//
skip_next_cell = true; skip_next_cell = true;
} }
......
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