This commit is contained in:
Kamil Kerimov
2024-12-07 01:35:12 +05:00
parent c6effb6de2
commit e8aa709d4e
3 changed files with 65 additions and 0 deletions

View File

@ -3805,6 +3805,7 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style, OOX::CStyles *styles)
std::map<SimpleTypes::EStyleType, size_t>::iterator pFindParaDefault = styles->m_mapStyleDefaults.find(SimpleTypes::styletypeParagraph);
std::map<SimpleTypes::EStyleType, size_t>::iterator pFindRunDefault = styles->m_mapStyleDefaults.find(SimpleTypes::styletypeCharacter);
std::map<SimpleTypes::EStyleType, size_t>::iterator pFindTableDefault = styles->m_mapStyleDefaults.find(SimpleTypes::styletypeTable);
if (def_style->m_oParPr.IsInit() || pFindParaDefault != styles->m_mapStyleDefaults.end())
{
@ -3887,6 +3888,22 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style, OOX::CStyles *styles)
}
}
if (pFindTableDefault != styles->m_mapStyleDefaults.end())
{
OOX::CStyle* style = styles->m_arrStyle[pFindTableDefault->second];
if (style->m_oTblPr.IsInit() && style->m_oTblPr->m_oTblCellMar.IsInit())
{
_CP_OPT(odf_types::length) left, right, top, bottom;
convert(style->m_oTblPr->m_oTblCellMar->m_oStart.GetPointer(), left);
convert(style->m_oTblPr->m_oTblCellMar->m_oEnd.GetPointer(), right);
convert(style->m_oTblPr->m_oTblCellMar->m_oTop.GetPointer(), top);
convert(style->m_oTblPr->m_oTblCellMar->m_oBottom.GetPointer(), bottom);
odt_context->table_context()->set_default_cell_paddings(left, right, top, bottom);
}
}
///////////////////////////////////////////////////////////////////////////
odt_context->styles_context()->create_default_style(odf_types::style_family::Table);
@ -5350,6 +5367,21 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
}
cell_properties->apply_from(parent_cell_properties);
{
// Default table style from styles.xml
_CP_OPT(odf_types::length) left, right, top, bottom;
odt_context->table_context()->get_default_cell_paddings(left, right, top, bottom);
if (!cell_properties->content_.common_padding_attlist_.fo_padding_left_)
cell_properties->content_.common_padding_attlist_.fo_padding_left_ = left;
if (!cell_properties->content_.common_padding_attlist_.fo_padding_right_)
cell_properties->content_.common_padding_attlist_.fo_padding_right_ = right;
if (!cell_properties->content_.common_padding_attlist_.fo_padding_top_)
cell_properties->content_.common_padding_attlist_.fo_padding_top_ = top;
if (!cell_properties->content_.common_padding_attlist_.fo_padding_bottom_)
cell_properties->content_.common_padding_attlist_.fo_padding_bottom_ = bottom;
}
//check for inside cell or not
_CP_OPT(std::wstring) border_inside_v = odt_context->table_context()->get_table_inside_v();

View File

@ -133,6 +133,11 @@ public:
_CP_OPT(double) default_column_width;
bool optimal_column_width;
_CP_OPT(odf_types::length) default_cell_padding_left;
_CP_OPT(odf_types::length) default_cell_padding_right;
_CP_OPT(odf_types::length) default_cell_padding_top;
_CP_OPT(odf_types::length) default_cell_padding_bottom;
std::wstring default_cell_properties; // для предустановки ..
private:
@ -447,6 +452,23 @@ std::wstring odf_table_context::get_column_cell_properties()
return default_cell_props;
}
void odf_table_context::set_default_cell_paddings(_CP_OPT(odf_types::length) left, _CP_OPT(odf_types::length) right, _CP_OPT(odf_types::length) top, _CP_OPT(odf_types::length) bottom)
{
impl_->default_cell_padding_left = left;
impl_->default_cell_padding_right = right;
impl_->default_cell_padding_top = top;
impl_->default_cell_padding_bottom = bottom;
}
void odf_table_context::get_default_cell_paddings(_CP_OPT(odf_types::length)& left, _CP_OPT(odf_types::length)& right, _CP_OPT(odf_types::length)& top, _CP_OPT(odf_types::length)& bottom)
{
left = impl_->default_cell_padding_left;
right = impl_->default_cell_padding_right;
top = impl_->default_cell_padding_top;
bottom = impl_->default_cell_padding_bottom;
}
void odf_table_context::set_default_row_height(double height)
{
impl_->default_row_height = height;

View File

@ -83,6 +83,17 @@ public:
void set_default_cell_properties(const std::wstring &style_name);
std::wstring get_default_cell_properties();
std::wstring get_column_cell_properties();
void set_default_cell_paddings(
_CP_OPT(odf_types::length) left,
_CP_OPT(odf_types::length) right,
_CP_OPT(odf_types::length) top,
_CP_OPT(odf_types::length) bottom);
void get_default_cell_paddings(
_CP_OPT(odf_types::length)& left,
_CP_OPT(odf_types::length)& right,
_CP_OPT(odf_types::length)& top,
_CP_OPT(odf_types::length)& bottom);
_CP_OPT(double) get_table_width();
_CP_OPT(double) get_table_height();