mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
(1.2.0.88): ASCOfficeOdfFileW
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57260 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
0e4df2c573
commit
0a783eaa09
@ -33,6 +33,7 @@ namespace odf
|
||||
current_row = 0;
|
||||
current_column = 0;
|
||||
count_header_row = 0;
|
||||
styled = false;
|
||||
}
|
||||
std::vector<odf_element_state> rows;
|
||||
std::vector<odf_column_state> columns;
|
||||
@ -45,7 +46,7 @@ namespace odf
|
||||
|
||||
__int32 count_header_row;
|
||||
|
||||
std::wstring base_style_name;
|
||||
bool styled;
|
||||
|
||||
};
|
||||
|
||||
@ -66,7 +67,6 @@ public:
|
||||
|
||||
odf_style_context * styles_context() {return odf_context_->styles_context();}
|
||||
|
||||
//std::wstring default_cell_style_name_ ; // <20><><EFBFBD><EFBFBD> :( <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
odf_conversion_context *odf_context_;
|
||||
|
||||
private:
|
||||
@ -85,15 +85,17 @@ odf_table_context::~odf_table_context()
|
||||
{
|
||||
}
|
||||
|
||||
void odf_table_context::set_table_base_style(std::wstring base_style_name)
|
||||
void odf_table_context::set_table_styled(bool val)
|
||||
{
|
||||
impl_->current_table().base_style_name = base_style_name;
|
||||
impl_->current_table().styled = val;
|
||||
}
|
||||
|
||||
bool odf_table_context::is_styled()
|
||||
{
|
||||
return impl_->current_table().base_style_name.length() >0 ? true : false;
|
||||
if (impl_->empty()) return false;
|
||||
return impl_->current_table().styled;
|
||||
}
|
||||
|
||||
void odf_table_context::start_table(office_element_ptr &elm, bool styled)
|
||||
{
|
||||
table_table * table = dynamic_cast<table_table *>(elm.get());
|
||||
|
||||
@ -23,9 +23,9 @@ public:
|
||||
|
||||
void set_styles_context(odf_style_context* styles_context);
|
||||
|
||||
void set_table_base_style(std::wstring base_style_name);
|
||||
void set_table_styled(bool val);
|
||||
bool is_styled();
|
||||
|
||||
bool is_styled() ;
|
||||
int current_column ();
|
||||
int current_row ();
|
||||
int count_column ();
|
||||
|
||||
@ -54,116 +54,158 @@ void odf_table_styles_context::end_style()
|
||||
|
||||
void odf_table_styles_context::add_band1Horz()
|
||||
{
|
||||
table_format_array_.back().band1Horz_.is=true;
|
||||
current = &table_format_array_.back().band1Horz_;
|
||||
}
|
||||
void odf_table_styles_context::add_band1Vert()
|
||||
{
|
||||
table_format_array_.back().band1Vert_.is=true;
|
||||
current = &table_format_array_.back().band1Vert_;
|
||||
}
|
||||
void odf_table_styles_context::add_band2Horz()
|
||||
{
|
||||
table_format_array_.back().band2Horz_.is=true;
|
||||
current = &table_format_array_.back().band2Horz_;
|
||||
}
|
||||
void odf_table_styles_context::add_band2Vert()
|
||||
{
|
||||
table_format_array_.back().band2Vert_.is=true;
|
||||
current = &table_format_array_.back().band2Vert_;
|
||||
}
|
||||
void odf_table_styles_context::add_firstCol()
|
||||
{
|
||||
table_format_array_.back().firstCol_.is=true;
|
||||
current = &table_format_array_.back().firstCol_;
|
||||
}
|
||||
void odf_table_styles_context::add_firstRow()
|
||||
{
|
||||
table_format_array_.back().firstRow_.is=true;
|
||||
current = &table_format_array_.back().firstRow_;
|
||||
}
|
||||
void odf_table_styles_context::add_lastCol()
|
||||
{
|
||||
current = &table_format_array_.back().band1Horz_;
|
||||
table_format_array_.back().lastCol_.is=true;
|
||||
current = &table_format_array_.back().lastCol_;
|
||||
}
|
||||
void odf_table_styles_context::add_lastRow()
|
||||
{
|
||||
table_format_array_.back().lastRow_.is=true;
|
||||
current = &table_format_array_.back().lastRow_;
|
||||
}
|
||||
void odf_table_styles_context::add_neCell()
|
||||
{
|
||||
table_format_array_.back().neCell_.is=true;
|
||||
current = &table_format_array_.back().neCell_;
|
||||
}
|
||||
void odf_table_styles_context::add_nwCell()
|
||||
{
|
||||
table_format_array_.back().nwCell_.is=true;
|
||||
current = &table_format_array_.back().nwCell_;
|
||||
}
|
||||
void odf_table_styles_context::add_seCell()
|
||||
{
|
||||
table_format_array_.back().seCell_.is=true;
|
||||
current = &table_format_array_.back().seCell_;
|
||||
}
|
||||
void odf_table_styles_context::add_swCell()
|
||||
{
|
||||
table_format_array_.back().swCell_.is=true;
|
||||
current = &table_format_array_.back().swCell_;
|
||||
}
|
||||
void odf_table_styles_context::add_wholeTable()
|
||||
{
|
||||
table_format_array_.back().wholeTable_.is=true;
|
||||
current = &table_format_array_.back().wholeTable_;
|
||||
}
|
||||
bool odf_table_styles_context::set_current_style(std::wstring name)
|
||||
bool odf_table_styles_context::start_table(std::wstring name)
|
||||
{
|
||||
for (long i=0; i < table_format_array_.size(); i++)
|
||||
{
|
||||
if (table_format_array_[i].style_name == name)
|
||||
{
|
||||
current_table_style_ = i;
|
||||
_use_style s = {};
|
||||
s.table_style_ = i;
|
||||
|
||||
current_used_.push_back(s);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void odf_table_styles_context::set_current_dimension(int col, int row)
|
||||
|
||||
void odf_table_styles_context::set_flags(int val)
|
||||
{
|
||||
current_table_col_count_ = col;
|
||||
current_table_row_count_ = row;
|
||||
if (current_used_.size() < 1) return;
|
||||
|
||||
current_used_.back().first_row = (val & 0x0020) != 0 ;
|
||||
current_used_.back().first_col = (val & 0x0080) != 0 ;
|
||||
current_used_.back().last_row = (val & 0x0040) != 0 ;
|
||||
current_used_.back().last_col = (val & 0x0100) != 0 ;
|
||||
current_used_.back().rows = (val & 0x0200) == 0 ;
|
||||
current_used_.back().cols = (val & 0x0400) == 0 ;
|
||||
}
|
||||
|
||||
void odf_table_styles_context::set_current_dimension(int col, int row)
|
||||
{
|
||||
if (current_used_.size() < 1) return;
|
||||
|
||||
current_used_.back().table_col_count_ = col;
|
||||
current_used_.back().table_row_count_ = row;
|
||||
}
|
||||
void odf_table_styles_context::end_table()
|
||||
{
|
||||
if (current_used_.size() > 0)
|
||||
current_used_.pop_back();
|
||||
}
|
||||
void odf_table_styles_context::get_table_cell_properties (int col, int row, style_table_cell_properties* cell_props)
|
||||
{
|
||||
if (current_table_style_ < 0) return;
|
||||
if (current_used_.size() < 1) return;
|
||||
if (cell_props == NULL) return;
|
||||
|
||||
table_format_state & state = table_format_array_[current_used_.back().table_style_];
|
||||
|
||||
int col_shift =0;
|
||||
int row_shift =0;
|
||||
|
||||
if (state.firstCol_.is && current_used_.back().first_col)col_shift = 1;
|
||||
if (state.firstRow_.is && current_used_.back().first_row)row_shift = 1;
|
||||
//------------------------------------------------------------------------------
|
||||
bool first_row = (row == 1)? true: false;
|
||||
bool first_col = (col == 1)? true: false;
|
||||
|
||||
bool odd_row = (row%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool odd_col = (col%2 != 0) ? true : false;
|
||||
bool odd_row = ((row+row_shift)%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool odd_col = ((col+col_shift)%2 != 0) ? true : false;
|
||||
|
||||
bool even_row = (row%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool even_col = (col%2 != 0) ? true : false;
|
||||
bool last_row = (row == current_used_.back().table_row_count_) ? true: false;
|
||||
bool last_col = (col == current_used_.back().table_col_count_) ? true: false;
|
||||
|
||||
bool last_row = (row == current_table_row_count_) ? true: false;
|
||||
bool last_col = (col == current_table_col_count_) ? true: false;
|
||||
|
||||
bool ne = (row == 1 && col == current_table_col_count_) ? true: false; //top right cell
|
||||
bool ne = (row == 1 && col == current_used_.back().table_col_count_) ? true: false; //top right cell
|
||||
bool nw = (row == 1 && col == 1) ? true: false; //top left cell.
|
||||
|
||||
bool se = (row == current_table_row_count_ && col == current_table_col_count_) ? true: false; //bottom right cell
|
||||
bool sw = (row == current_table_row_count_ && col == 1) ? true: false; //bottom left cell.
|
||||
|
||||
bool se = (row == current_used_.back().table_row_count_ && col == current_used_.back().table_col_count_) ? true: false; //bottom right cell
|
||||
bool sw = (row == current_used_.back().table_row_count_ && col == 1) ? true: false; //bottom left cell.
|
||||
//----------------------------------------------------------------------------------------------------------------------------------
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - main, odd, even first, last, ne, .... col, row
|
||||
|
||||
table_format_state & state = table_format_array_[current_table_style_];
|
||||
|
||||
cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.table_.table_cell_props.get()));
|
||||
|
||||
if (odd_col) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.band1Vert_.table_cell_props.get()));
|
||||
if (even_col) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.band2Vert_.table_cell_props.get()));
|
||||
|
||||
if (odd_row) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.band1Horz_.table_cell_props.get()));
|
||||
if (even_row) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.band2Horz_.table_cell_props.get()));
|
||||
|
||||
if (first_col) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.firstCol_.table_cell_props.get()));
|
||||
if (last_col) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.lastCol_.table_cell_props.get()));
|
||||
if (current_used_.back().cols)
|
||||
{
|
||||
if (odd_col) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.band1Vert_.table_cell_props.get()));
|
||||
else cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.band2Vert_.table_cell_props.get()));
|
||||
}
|
||||
if (current_used_.back().rows)
|
||||
{
|
||||
if (odd_row) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.band1Horz_.table_cell_props.get()));
|
||||
else cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.band2Horz_.table_cell_props.get()));
|
||||
}
|
||||
if (first_col && current_used_.back().first_col)cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.firstCol_.table_cell_props.get()));
|
||||
if (last_col && current_used_.back().last_col) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.lastCol_.table_cell_props.get()));
|
||||
|
||||
if (first_row) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.firstRow_.table_cell_props.get()));
|
||||
if (last_row) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.lastRow_.table_cell_props.get()));
|
||||
if (first_row && current_used_.back().first_row)cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.firstRow_.table_cell_props.get()));
|
||||
if (last_row && current_used_.back().last_row) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.lastRow_.table_cell_props.get()));
|
||||
|
||||
/////////////////////////
|
||||
if (ne) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.neCell_.table_cell_props.get()));
|
||||
if (nw) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.nwCell_.table_cell_props.get()));
|
||||
|
||||
@ -172,45 +214,52 @@ void odf_table_styles_context::get_table_cell_properties (int col, int row, styl
|
||||
}
|
||||
void odf_table_styles_context::get_text_properties (int col, int row, style_text_properties* text_props)
|
||||
{
|
||||
if (current_table_style_ < 0) return;
|
||||
if (current_used_.size() < 1) return;
|
||||
if (text_props == NULL) return;
|
||||
|
||||
table_format_state & state = table_format_array_[current_used_.back().table_style_];
|
||||
|
||||
int col_shift =0;
|
||||
int row_shift =0;
|
||||
|
||||
if (state.firstCol_.is && current_used_.back().first_col)col_shift = 1;
|
||||
if (state.firstRow_.is && current_used_.back().first_row)row_shift = 1;
|
||||
//------------------------------------------------------------------------------
|
||||
bool first_row = (row == 1)? true: false;
|
||||
bool first_col = (col == 1)? true: false;
|
||||
|
||||
bool odd_row = (row%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool odd_col = (col%2 != 0) ? true : false;
|
||||
bool odd_row = ((row+row_shift)%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool odd_col = ((col+col_shift)%2 != 0) ? true : false;
|
||||
|
||||
bool even_row = (row%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool even_col = (col%2 != 0) ? true : false;
|
||||
bool last_row = (row == current_used_.back().table_row_count_) ? true: false;
|
||||
bool last_col = (col == current_used_.back().table_col_count_) ? true: false;
|
||||
|
||||
bool last_row = (row == current_table_row_count_) ? true: false;
|
||||
bool last_col = (col == current_table_col_count_) ? true: false;
|
||||
|
||||
bool ne = (row == 1 && col == current_table_col_count_) ? true: false; //top right cell
|
||||
bool ne = (row == 1 && col == current_used_.back().table_col_count_) ? true: false; //top right cell
|
||||
bool nw = (row == 1 && col == 1) ? true: false; //top left cell.
|
||||
|
||||
bool se = (row == current_table_row_count_ && col == current_table_col_count_) ? true: false; //bottom right cell
|
||||
bool sw = (row == current_table_row_count_ && col == 1) ? true: false; //bottom left cell.
|
||||
|
||||
bool se = (row == current_used_.back().table_row_count_ && col == current_used_.back().table_col_count_) ? true: false; //bottom right cell
|
||||
bool sw = (row == current_used_.back().table_row_count_ && col == 1) ? true: false; //bottom left cell
|
||||
//----------------------------------------------------------------------------------------------------------------------------------
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - main, odd, even first, last, ne, ....
|
||||
|
||||
table_format_state & state = table_format_array_[current_table_style_];
|
||||
|
||||
text_props->apply_from(dynamic_cast<style_text_properties *>(state.table_.text_props.get()));
|
||||
|
||||
if (odd_col) text_props->apply_from(dynamic_cast<style_text_properties *>(state.band1Vert_.text_props.get()));
|
||||
if (even_col) text_props->apply_from(dynamic_cast<style_text_properties *>(state.band2Vert_.text_props.get()));
|
||||
if (current_used_.back().cols)
|
||||
{
|
||||
if (odd_col) text_props->apply_from(dynamic_cast<style_text_properties *>(state.band1Vert_.text_props.get()));
|
||||
else text_props->apply_from(dynamic_cast<style_text_properties *>(state.band2Vert_.text_props.get()));
|
||||
}
|
||||
|
||||
if (odd_row) text_props->apply_from(dynamic_cast<style_text_properties *>(state.band1Horz_.text_props.get()));
|
||||
if (even_row) text_props->apply_from(dynamic_cast<style_text_properties *>(state.band2Horz_.text_props.get()));
|
||||
if (current_used_.back().rows)
|
||||
{
|
||||
if (odd_row) text_props->apply_from(dynamic_cast<style_text_properties *>(state.band1Horz_.text_props.get()));
|
||||
else text_props->apply_from(dynamic_cast<style_text_properties *>(state.band2Horz_.text_props.get()));
|
||||
}
|
||||
|
||||
if (first_col) text_props->apply_from(dynamic_cast<style_text_properties *>(state.firstCol_.text_props.get()));
|
||||
if (last_col) text_props->apply_from(dynamic_cast<style_text_properties *>(state.lastCol_.text_props.get()));
|
||||
if (first_col && current_used_.back().first_col)text_props->apply_from(dynamic_cast<style_text_properties *>(state.firstCol_.text_props.get()));
|
||||
if (last_col && current_used_.back().last_col) text_props->apply_from(dynamic_cast<style_text_properties *>(state.lastCol_.text_props.get()));
|
||||
|
||||
if (first_row) text_props->apply_from(dynamic_cast<style_text_properties *>(state.firstRow_.text_props.get()));
|
||||
if (last_row) text_props->apply_from(dynamic_cast<style_text_properties *>(state.lastRow_.text_props.get()));
|
||||
if (first_row && current_used_.back().first_row)text_props->apply_from(dynamic_cast<style_text_properties *>(state.firstRow_.text_props.get()));
|
||||
if (last_row && current_used_.back().last_row) text_props->apply_from(dynamic_cast<style_text_properties *>(state.lastRow_.text_props.get()));
|
||||
|
||||
if (ne) text_props->apply_from(dynamic_cast<style_text_properties *>(state.neCell_.text_props.get()));
|
||||
if (nw) text_props->apply_from(dynamic_cast<style_text_properties *>(state.nwCell_.text_props.get()));
|
||||
@ -220,45 +269,51 @@ void odf_table_styles_context::get_text_properties (int col, int row, style_text
|
||||
}
|
||||
void odf_table_styles_context::get_paragraph_properties (int col, int row, style_paragraph_properties* para_props)
|
||||
{
|
||||
if (current_table_style_ < 0) return;
|
||||
if (current_used_.size() < 1) return;
|
||||
if (para_props == NULL) return;
|
||||
|
||||
table_format_state & state = table_format_array_[current_used_.back().table_style_];
|
||||
|
||||
int col_shift =0;
|
||||
int row_shift =0;
|
||||
|
||||
if (state.firstCol_.is && current_used_.back().first_col)col_shift = 1;
|
||||
if (state.firstRow_.is && current_used_.back().first_row)row_shift = 1;
|
||||
//------------------------------------------------------------------------------
|
||||
bool first_row = (row == 1)? true: false;
|
||||
bool first_col = (col == 1)? true: false;
|
||||
|
||||
bool odd_row = (row%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool odd_col = (col%2 != 0) ? true : false;
|
||||
bool odd_row = ((row+row_shift)%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool odd_col = ((col+col_shift)%2 != 0) ? true : false;
|
||||
|
||||
bool even_row = (row%2 != 0) ? true : false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool even_col = (col%2 != 0) ? true : false;
|
||||
bool last_row = (row == current_used_.back().table_row_count_) ? true: false;
|
||||
bool last_col = (col == current_used_.back().table_col_count_) ? true: false;
|
||||
|
||||
bool last_row = (row == current_table_row_count_) ? true: false;
|
||||
bool last_col = (col == current_table_col_count_) ? true: false;
|
||||
|
||||
bool ne = (row == 1 && col == current_table_col_count_) ? true: false; //top right cell
|
||||
bool ne = (row == 1 && col == current_used_.back().table_col_count_) ? true: false; //top right cell
|
||||
bool nw = (row == 1 && col == 1) ? true: false; //top left cell.
|
||||
|
||||
bool se = (row == current_table_row_count_ && col == current_table_col_count_) ? true: false; //bottom right cell
|
||||
bool sw = (row == current_table_row_count_ && col == 1) ? true: false; //bottom left cell.
|
||||
|
||||
bool se = (row == current_used_.back().table_row_count_ && col == current_used_.back().table_col_count_) ? true: false; //bottom right cell
|
||||
bool sw = (row == current_used_.back().table_row_count_ && col == 1) ? true: false; //bottom left cell.
|
||||
//----------------------------------------------------------------------------------------------------------------------------------
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - main, odd, even first, last, ne, ....
|
||||
|
||||
table_format_state & state = table_format_array_[current_table_style_];
|
||||
|
||||
para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.table_.paragraph_props.get()));
|
||||
|
||||
if (odd_col) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.band1Vert_.paragraph_props.get()));
|
||||
if (even_col) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.band2Vert_.paragraph_props.get()));
|
||||
if (current_used_.back().cols)
|
||||
{
|
||||
if (odd_col) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.band1Vert_.paragraph_props.get()));
|
||||
else para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.band2Vert_.paragraph_props.get()));
|
||||
}
|
||||
|
||||
if (odd_row) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.band1Horz_.paragraph_props.get()));
|
||||
if (even_row) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.band2Horz_.paragraph_props.get()));
|
||||
if (current_used_.back().cols)
|
||||
{
|
||||
if (odd_row) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.band1Horz_.paragraph_props.get()));
|
||||
else para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.band2Horz_.paragraph_props.get()));
|
||||
}
|
||||
|
||||
if (first_col) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.firstCol_.paragraph_props.get()));
|
||||
if (last_col) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.lastCol_.paragraph_props.get()));
|
||||
if (first_col && current_used_.back().first_col)para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.firstCol_.paragraph_props.get()));
|
||||
if (last_col && current_used_.back().last_col) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.lastCol_.paragraph_props.get()));
|
||||
|
||||
if (first_row) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.firstRow_.paragraph_props.get()));
|
||||
if (last_row) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.lastRow_.paragraph_props.get()));
|
||||
if (first_row && current_used_.back().first_row)para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.firstRow_.paragraph_props.get()));
|
||||
if (last_row && current_used_.back().last_row) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.lastRow_.paragraph_props.get()));
|
||||
|
||||
if (ne) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.neCell_.paragraph_props.get()));
|
||||
if (nw) para_props->apply_from(dynamic_cast<style_paragraph_properties *>(state.nwCell_.paragraph_props.get()));
|
||||
|
||||
@ -21,9 +21,12 @@ class style_paragraph_properties;
|
||||
|
||||
struct _style_properties
|
||||
{
|
||||
_style_properties(){is = false;}
|
||||
office_element_ptr text_props;
|
||||
office_element_ptr paragraph_props;
|
||||
office_element_ptr table_cell_props;
|
||||
|
||||
bool is;
|
||||
};
|
||||
struct table_format_state
|
||||
{
|
||||
@ -49,7 +52,7 @@ struct table_format_state
|
||||
class odf_table_styles_context
|
||||
{
|
||||
public:
|
||||
odf_table_styles_context(){current = NULL; context_ = NULL; current_table_style_ = -1;}
|
||||
odf_table_styles_context(){current = NULL; context_ = NULL; }
|
||||
|
||||
void set_odf_context(odf_conversion_context * Context)
|
||||
{
|
||||
@ -84,12 +87,14 @@ public:
|
||||
//-----------------------------------------------
|
||||
// output
|
||||
//-----------------------------------------------
|
||||
bool set_current_style(std::wstring name);
|
||||
void set_current_dimension(int col, int row);
|
||||
bool start_table(std::wstring style_name);
|
||||
void set_current_dimension(int col, int row);
|
||||
void set_flags(int val);
|
||||
|
||||
void get_table_cell_properties (int col, int row, style_table_cell_properties *props);
|
||||
void get_text_properties (int col, int row, style_text_properties *props);
|
||||
void get_paragraph_properties (int col, int row, style_paragraph_properties *props);
|
||||
void get_table_cell_properties (int col, int row, style_table_cell_properties *props);
|
||||
void get_text_properties (int col, int row, style_text_properties *props);
|
||||
void get_paragraph_properties (int col, int row, style_paragraph_properties *props);
|
||||
void end_table();
|
||||
|
||||
private:
|
||||
|
||||
@ -99,9 +104,21 @@ private:
|
||||
|
||||
odf_conversion_context *context_;
|
||||
|
||||
int current_table_style_;
|
||||
int current_table_col_count_;
|
||||
int current_table_row_count_;
|
||||
struct _use_style
|
||||
{
|
||||
int table_style_;
|
||||
int table_col_count_;
|
||||
int table_row_count_;
|
||||
|
||||
bool cols;
|
||||
bool rows;
|
||||
bool first_row;
|
||||
bool last_row;
|
||||
bool first_col;
|
||||
bool last_col;
|
||||
};
|
||||
|
||||
std::vector<_use_style> current_used_;
|
||||
|
||||
//////////////////
|
||||
|
||||
|
||||
@ -254,10 +254,10 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
|
||||
odt_context->styles_context()->create_style(L"",odf::style_family::Paragraph, true, false, -1);
|
||||
paragraph_properties = odt_context->styles_context()->last_state().get_paragraph_properties();
|
||||
}
|
||||
m_bKeepNextParagraph = false;
|
||||
|
||||
convert(oox_paragraph->m_oParagraphProperty, paragraph_properties);
|
||||
}else m_bKeepNextParagraph = false;
|
||||
}else m_bKeepNextParagraph = false; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_bKeepNextParagraph !!! todooo
|
||||
//<2F><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> !!!
|
||||
|
||||
if (bStartNewParagraph) odt_context->start_paragraph(styled);
|
||||
|
||||
@ -392,11 +392,11 @@ void DocxConverter::convert(OOX::Logic::CInstrText *oox_instr)
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf::style_paragraph_properties * paragraph_properties)
|
||||
{
|
||||
m_bKeepNextParagraph = false;
|
||||
|
||||
if (!oox_paragraph_pr) return;
|
||||
if (!paragraph_properties) return;
|
||||
|
||||
m_bKeepNextParagraph = false;
|
||||
|
||||
if (oox_paragraph_pr->m_oPStyle.IsInit() && oox_paragraph_pr->m_oPStyle->m_sVal.IsInit())
|
||||
{
|
||||
std::wstring style_name = string2std_string(*oox_paragraph_pr->m_oPStyle->m_sVal);
|
||||
@ -1292,7 +1292,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
|
||||
ucA = color->Get_A();
|
||||
result = true;
|
||||
}
|
||||
if(theme_color)
|
||||
if(theme_color && result == false)
|
||||
{
|
||||
OOX::CTheme * docx_theme= docx_document->GetTheme();
|
||||
int theme_ind = theme_color->GetValue();
|
||||
@ -1323,10 +1323,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
|
||||
case SimpleTypes::themecolorHyperlink:
|
||||
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oHlink.tryGetRgb(ucR, ucG, ucB, ucA); break;
|
||||
}
|
||||
}
|
||||
if (result == true)
|
||||
{
|
||||
if (theme_tint)
|
||||
if (result == true && theme_tint)
|
||||
{
|
||||
OOX::Drawing::CHslColor col;
|
||||
col.SetRGBA(ucR, ucG, ucB);
|
||||
@ -1336,6 +1333,9 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
|
||||
col.SetHSL(dH, dS,dL);
|
||||
col.GetRGBA(ucR, ucG, ucB,ucA);
|
||||
}
|
||||
}
|
||||
if (result == true)
|
||||
{
|
||||
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
|
||||
if (oRgbColor)
|
||||
{
|
||||
@ -1434,11 +1434,23 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style)
|
||||
convert(oox_style->m_oTblPr->m_oTblBorders.GetPointer(), table_cell_properties);
|
||||
}
|
||||
}
|
||||
if (oox_style->m_oRunPr.IsInit())
|
||||
{
|
||||
odf::style_text_properties * text_properties = odt_context->styles_context()->table_styles().get_text_properties();
|
||||
convert(oox_style->m_oRunPr.GetPointer(), text_properties);
|
||||
}
|
||||
if (oox_style->m_oParPr.IsInit())
|
||||
{
|
||||
odf::style_paragraph_properties * paragraph_properties = odt_context->styles_context()->table_styles().get_paragraph_properties();
|
||||
convert(oox_style->m_oParPr.GetPointer(), paragraph_properties);
|
||||
}
|
||||
|
||||
if (oox_style->m_oTcPr.IsInit())
|
||||
{
|
||||
odf::style_table_cell_properties * table_cell_properties = odt_context->styles_context()->table_styles().get_table_cell_properties();
|
||||
convert(oox_style->m_oTcPr.GetPointer(), table_cell_properties);
|
||||
} //if (oox_style->m_oTrPr.IsInit())
|
||||
}
|
||||
//if (oox_style->m_oTrPr.IsInit())
|
||||
//{
|
||||
// odf::style_table_row_properties * table_row_properties = odt_context->styles_context()->table_styles().get_table_row_properties();
|
||||
// convert(oox_style->m_oTrPr.GetPointer(), table_row_properties);
|
||||
@ -1600,19 +1612,31 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
{
|
||||
if (oox_table == NULL) return;
|
||||
|
||||
if (m_bKeepNextParagraph)
|
||||
{
|
||||
odt_context->end_paragraph();
|
||||
m_bKeepNextParagraph = false;
|
||||
}
|
||||
|
||||
|
||||
convert(oox_table->m_oTableProperties);
|
||||
odt_context->start_table(true);
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (oox_table->m_oTableProperties && (oox_table->m_oTableProperties->m_oTblStyle.IsInit() && oox_table->m_oTableProperties->m_oTblStyle->m_sVal.IsInit()))
|
||||
{
|
||||
std::wstring base_style_name = string2std_string(*oox_table->m_oTableProperties->m_oTblStyle->m_sVal);
|
||||
|
||||
bool res = odt_context->styles_context()->table_styles().set_current_style(base_style_name);
|
||||
if (res) odt_context->table_context()->set_table_base_style(base_style_name );
|
||||
bool res = odt_context->styles_context()->table_styles().start_table(base_style_name);
|
||||
if (res)
|
||||
{
|
||||
odt_context->table_context()->set_table_styled(res);
|
||||
if (oox_table->m_oTableProperties->m_oTblLook.IsInit() && oox_table->m_oTableProperties->m_oTblLook->m_oVal.IsInit())
|
||||
odt_context->styles_context()->table_styles().set_flags(oox_table->m_oTableProperties->m_oTblLook->m_oVal->GetValue());
|
||||
}
|
||||
}
|
||||
|
||||
int count_rows = oox_table->m_arrItems.GetSize();
|
||||
int count_rows = oox_table->m_nCountRow;
|
||||
int count_columns = 0;
|
||||
if (oox_table->m_oTblGrid.IsInit())count_columns = oox_table->m_oTblGrid->m_arrGridCol.GetSize();
|
||||
|
||||
@ -1636,6 +1660,9 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
}
|
||||
|
||||
odt_context->end_table();
|
||||
|
||||
if (odt_context->table_context()->is_styled())
|
||||
odt_context->styles_context()->table_styles().end_table();
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CTblGrid *oox_table_grid)
|
||||
{
|
||||
@ -1706,7 +1733,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
|
||||
}
|
||||
}
|
||||
|
||||
odt_context->start_table_cell( oox_table_cell->m_nNumCol,covered, convert(oox_table_cell->m_oTableCellProperties));
|
||||
odt_context->start_table_cell( oox_table_cell->m_nNumCol,covered, convert(oox_table_cell->m_oTableCellProperties, oox_table_cell->m_nNumCol+1));
|
||||
|
||||
if (oox_table_cell->m_oTableCellProperties)
|
||||
{
|
||||
@ -1872,9 +1899,13 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
|
||||
//nullable<ComplexTypes::Word::CVerticalJc > m_oVAlign;
|
||||
return true;
|
||||
}
|
||||
bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr)
|
||||
bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, int col)
|
||||
{
|
||||
bool is_base_styled = odt_context->table_context()->is_styled();
|
||||
|
||||
if (col < 0) col=odt_context->table_context()->current_column()+1;
|
||||
int row=odt_context->table_context()->current_row();
|
||||
|
||||
odf::style_table_cell_properties * parent_cell_properties = NULL;
|
||||
|
||||
odf::odf_style_state * state = odt_context->styles_context()->last_state(odf::style_family::Table); // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@ -1893,7 +1924,7 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr)
|
||||
odf::style_text_properties * text_properties = odt_context->styles_context()->last_state().get_text_properties();
|
||||
odf::style_paragraph_properties * paragraph_properties = odt_context->styles_context()->last_state().get_paragraph_properties();
|
||||
|
||||
int col=odt_context->table_context()->current_column()+1;
|
||||
if (col < 0) col=odt_context->table_context()->current_column()+1;
|
||||
int row=odt_context->table_context()->current_row();
|
||||
|
||||
odt_context->styles_context()->table_styles().get_table_cell_properties (col, row, cell_properties);
|
||||
|
||||
@ -149,7 +149,7 @@ namespace Oox2Odf
|
||||
void convert(OOX::Logic::CTr *oox_table_row);
|
||||
void convert(OOX::Logic::CTc *oox_table_cell);
|
||||
|
||||
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr);
|
||||
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, int col = -1);
|
||||
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, odf::style_table_cell_properties *table_cell_properties/*,odf::style_table_cell_properties * table_cell_properties = NULL*/);
|
||||
bool convert(OOX::Logic::CTableProperty *oox_table_pr);
|
||||
bool convert(OOX::Logic::CTableProperty *oox_table_pr, odf::style_table_properties *table_properties);
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
//1
|
||||
//2
|
||||
//0
|
||||
//88
|
||||
#define INTVER 1,2,0,88
|
||||
#define STRVER "1,2,0,88\0"
|
||||
//89
|
||||
#define INTVER 1,2,0,89
|
||||
#define STRVER "1,2,0,89\0"
|
||||
|
||||
Reference in New Issue
Block a user