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

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55004 954022d7-b5bf-4e40-9824-e11837661b57
parent 362c87c0
......@@ -46,9 +46,6 @@ void odf_conversion_context::end_document()
///////////////////çàâåðøàþùàÿ îáðàáîòêà
process_styles();
//////////////////////////////////////////////////////////////////////
package::content_content_ptr content_root_ = package::content_content::create();
......@@ -56,7 +53,11 @@ void odf_conversion_context::end_document()
{
elm->serialize(content_root_->content());
}
//////////////////////////////////////////////////////////////////////////////////////////
BOOST_FOREACH(const office_element_ptr & elm, content_styles_)
{
elm->serialize(content_root_->styles());
}
//////////////////////////////////////////////////////////////////////////////////////////
package::content_simple_ptr content_style_ = package::content_simple::create();
BOOST_FOREACH(const office_element_ptr & elm, styles_)
{// ìàñòåð-ïåéäæû, çàäàííûå çàëèâêè (ãðàäèåíòû, áèòìàïû), äåôîëòíûå ñòèëè, êîëîíòèòóëû, ðàçìåòêè, çàìåòêè,...
......@@ -86,15 +87,22 @@ void odf_conversion_context::add_rel(relationship const & r)
void odf_conversion_context::process_styles()
{
create_element(L"office", L"styles", styles_, this,true);
create_element(L"office", L"font-face-decls", styles_, this,true);
create_element(L"office", L"styles", styles_, this,true);//îáùèå ñòèëè
style_context_.process_office(styles_.back());
create_element(L"office", L"automatic-styles", styles_, this,true);
style_context_.process_automatic(styles_.back());
style_context_.process_automatic_styles(styles_.back());
create_element(L"office", L"master-styles", styles_, this,true);
style_context_.process_master(styles_.back());
///////////////////////////////
create_element(L"office", L"font-face-decls", content_styles_, this,true);
create_element(L"office", L"automatic-styles", content_styles_, this,true);
style_context_.process_automatic(content_styles_.back());
}
......
......@@ -122,6 +122,7 @@ public:
office_element_ptr & getCurrentElement();
std::vector<office_element_ptr> content_;
std::vector<office_element_ptr> content_styles_;
std::vector<office_element_ptr> styles_;
void add_rel(relationship const & r);
......
......@@ -17,57 +17,122 @@ odf_style_context::odf_style_context(odf_conversion_context & Context/*, xlsx_te
{
}
odf_style_state & odf_style_context::state()
odf_style_state & odf_style_context::last_state()
{
return style_state_list_.back();
}
const odf_style_state & odf_style_context::state() const
const odf_style_state & odf_style_context::last_state() const
{
return style_state_list_.back();
}
void odf_style_context::create_style(std::wstring name,const style_family family, bool automatic,int oox_id)
void odf_style_context::create_style(std::wstring oox_name,const style_family family, bool automatic,bool root,int oox_id)
{
if (oox_id < 0) oox_id = style_state_list_.size();
std::wstring odf_name = oox_name;
if (odf_name.length() <1)odf_name = find_free_name(family);
office_element_ptr elm;
create_element(L"style", L"style", elm, &context_);
style_state_list_.push_back( odf_style_state(context_, elm, family) );
///////////////////////////////////////
state().set_name(name);
state().set_automatic(automatic);
last_state().set_name(odf_name);
last_state().set_automatic(automatic);
last_state().set_root(root);
state().style_oox_id_ = oox_id;
last_state().style_oox_id_ = oox_id;
last_state().style_oox_name_ = oox_name;
}
void odf_style_context::process_automatic_styles(office_element_ptr root )
{//
for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
{
if (it->automatic_== true && it->root_== true && it->odf_style_)
root->add_child_element(it->odf_style_);
}
}
void odf_style_context::process_automatic(office_element_ptr root )
{
{//
for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
{
if (it->automatic_== true && it->odf_style_)
if (/*it->automatic_== true && */it->root_== false && it->odf_style_)
root->add_child_element(it->odf_style_);
}
}
void odf_style_context::process_master(office_element_ptr root )
{
for (std::list<odf_style_state>::iterator it = master_state_list_.begin(); it != master_state_list_.end(); it++)
{
root->add_child_element(it->odf_style_);
}
}
void odf_style_context::process_office(office_element_ptr root )
{
for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
{
if (it->automatic_== false && it->master_ == false && it->odf_style_)
if (it->automatic_== false && it->root_ == true && it->odf_style_)
root->add_child_element(it->odf_style_);
}
}
void odf_style_context::process_master(office_element_ptr root )
std::wstring & odf_style_context::find_odf_style_name(int oox_id_style, const style_family family)
{
for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
{
if (it->master_ == true && it->odf_style_)
root->add_child_element(it->odf_style_);
if (it->odf_style_)
{
if (it->style_family_ == family)
{
if (oox_id_style >=0 && it->style_oox_id_ == oox_id_style) return it->get_name();
}
}
}
return std::wstring();
}
std::wstring odf_style_context::get_name_family(const style_family & family)
{
switch(family.get_type())
{
case style_family::None: return L"none";
case style_family::Paragraph: return L"P";
case style_family::Text: return L"T";
case style_family::Section: return L"sct";
case style_family::Table: return L"ta";
case style_family::TableColumn: return L"co";
case style_family::TableRow: return L"ro";
case style_family::TableCell: return L"ce";
case style_family::TablePage: return L"tbl";//??
case style_family::Chart: return L"ch";
case style_family::Default: return L"def";
case style_family::DrawingPage: return L"dp";
case style_family::Graphic: return L"gr";
case style_family::Presentation:return L"pr";
case style_family::Control: return L"ctrl";//??
case style_family::Ruby: return L"rb";//??
}
return L"none";
}
std::wstring odf_style_context::find_free_name(const style_family & family)
{
std::wstring name = get_name_family(family);
int count =1;
for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
{
if ((it->odf_style_) && (it->style_family_ == family))
{
count++;
}
}
name = name + boost::lexical_cast<std::wstring>(count);
return name;
}
office_element_ptr & odf_style_context::add_or_find(std::wstring name, const style_family family, bool automatic , int oox_id)
office_element_ptr & odf_style_context::add_or_find(std::wstring name, const style_family family, bool automatic , bool root, int oox_id)
{
for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
{
......@@ -75,15 +140,16 @@ office_element_ptr & odf_style_context::add_or_find(std::wstring name, const sty
{
if (it->style_family_ == family)
{
if (oox_id >=0 && it->style_oox_id_ == oox_id) return it->get_office_element();
if (name.length() >=0 && it->odf_style_->get_name() == name) return it->get_office_element();
if (oox_id >=0 && it->style_oox_id_ == oox_id) return it->get_office_element();
if ((name.length() >=0 && it->odf_style_->get_name() == name) && it->root_ == root) return it->get_office_element();
// ( root - )
}
}
}
create_style(name,family, true,oox_id);
create_style(name,family, automatic, root,oox_id);
return state().get_office_element();
return last_state().get_office_element();
}
......
......@@ -21,14 +21,18 @@ class odf_style_context
public:
odf_style_context(odf_conversion_context & Context/*, ods_text_context & textCotnext*/);
void create_style(std::wstring name, const style_family style_family, bool automatic = false, int oox_id = -1);
void create_style(std::wstring name, const style_family style_family, bool automatic = false, bool root = false, int oox_id = -1);
office_element_ptr & add_or_find(std::wstring name, const style_family family, bool automatic = false, int id = -1);
office_element_ptr & add_or_find(std::wstring name, const style_family family, bool automatic = false, bool root = false, int id = -1);
void process_automatic_styles(office_element_ptr root );
void process_automatic(office_element_ptr root );
void process_master(office_element_ptr root );
void process_office(office_element_ptr root );
std::wstring & find_odf_style_name(int oox_id_style, const style_family family);
//void start_cell(const std::wstring & formula,
// size_t columnsSpanned,
......@@ -76,8 +80,8 @@ public:
// void table_column_last_width(double w);
// double table_column_last_width() const;
odf_style_state & state();
const odf_style_state & state() const;
odf_style_state & last_state();
const odf_style_state & last_state() const;
// void start_hyperlink();
//std::wstring end_hyperlink(std::wstring const & ref, std::wstring const & href, std::wstring const & display);
......@@ -88,7 +92,13 @@ public:
private:
odf_conversion_context & context_;
std::list<odf_style_state> style_state_list_;// content_
std::list<odf_style_state> style_state_list_;
std::list<odf_style_state> master_state_list_;
std::wstring get_name_family(const style_family & family);
std::wstring find_free_name(const style_family & family);
};
......
......@@ -51,6 +51,10 @@ void odf_style_state::set_automatic(bool val)
{
automatic_ = val;
}
void odf_style_state::set_root(bool val)// styles, content
{
root_ = val;
}
void odf_style_state::convert()
{
......
......@@ -29,7 +29,9 @@ public:
odf_style_state(odf_conversion_context & Context, office_element_ptr & elm, const style_family style_family );
void set_name(std::wstring);
void set_automatic(bool val);
void set_root(bool val);
std::wstring & get_name();
......@@ -40,14 +42,15 @@ public:
void add_child(office_element_ptr & child);
private:
int style_oox_id_;
int style_oox_id_;
std::wstring style_oox_name_;
bool automatic_;
bool master_;
bool root_;
style_family style_family_;
office_element_ptr odf_style_;//
office_element_ptr odf_style_;
odf_conversion_context & context_;
friend class odf_style_context;
......
......@@ -36,6 +36,13 @@ void ods_conversion_context::end_sheet()
ods_table_context_.end_table();
}
void ods_conversion_context::add_column(int repeated, const std::wstring & style_name)
{
office_element_ptr element_column;
create_element(L"table", L"table-column",element_column,this);
ods_table_context_.add_column(element_column,repeated,style_name);
}
}
......
......@@ -18,6 +18,8 @@ public:
void start_sheet(std::wstring & name);
void end_sheet();
void add_column(int repeated, const std::wstring & StyleName);
ods_table_context ods_table_context_;
office_spreadsheet* current_spreadsheet_;
......
......@@ -52,5 +52,12 @@ void ods_table_context::end_table()
{
state().convert();
}
void ods_table_context::add_column(office_element_ptr & elm_column, int repeated, const std::wstring & style_name)
{
state().add_column(elm_column, repeated,style_name);
}
}
}
\ No newline at end of file
......@@ -50,11 +50,11 @@ public:
// bool is_empty_row() const;
// void end_row();
// void start_column(unsigned int repeated, const std::wstring & defaultCellStyleName);
void add_column(office_element_ptr & elm, int repeated, const std::wstring & StyleName);
// size_t depth() const { return table_state_stack_.size(); }
// unsigned int columns_count();
unsigned int columns_count();
// void serialize_merge_cells(std::wostream & _Wostream);
......
......@@ -10,16 +10,18 @@
namespace cpdoccore {
namespace odf {
ods_table_state::ods_table_state(ods_conversion_context & Context, office_element_ptr & elm): context_(Context)
{
office_table_ = (table_table*)dynamic_cast<table_table*>(elm.get());
ods_table_state::ods_table_state(ods_conversion_context & Context, office_element_ptr & elm): context_(Context)
{
office_table_ = elm;
}
void ods_table_state::set_name(std::wstring name)
{
table_table* table = (table_table*)dynamic_cast<table_table*>(office_table_.get());
if (table == NULL)return;
tableName_ = name;
office_table_->table_table_attlist_.table_name_ = name;
table->table_table_attlist_.table_name_ = name;
}
void ods_table_state::convert()
......@@ -36,10 +38,29 @@ void ods_table_state::set_table_style(office_element_ptr & elm)
if (!office_table_style_)return;
office_table_->table_table_attlist_.table_style_name_ = office_table_style_->style_name_;
table_table* table = (table_table*)dynamic_cast<table_table*>(office_table_.get());
if (table == NULL)return;
table->table_table_attlist_.table_style_name_ = office_table_style_->style_name_;
// ()
}
void ods_table_state::add_column(office_element_ptr & elm, int repeated, const std::wstring & StyleName)
{
office_table_->add_child_element(elm);
ods_column_state state = {elm, repeated,StyleName};
columns_count_ += repeated;
columns_.push_back(state);
}
unsigned int ods_table_state::columns_count() const
{
return columns_count_;
}
}
}
......@@ -20,6 +20,13 @@ class ods_conversion_context;
class table_table;
class style;
struct ods_column_state
{
office_element_ptr elm;
int repeated;
std::wstring style_name;
};
class ods_table_state
{
public:
......@@ -28,9 +35,8 @@ public:
void set_name(std::wstring);
void set_table_style(office_element_ptr & style);
// std::wstring current_style() const { return table_style_; }
// void start_column(unsigned int repeated, const std::wstring & defaultCellStyleName);
void add_column(office_element_ptr & elm, int repeated, const std::wstring & style_name);
// void start_row(const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
// void non_empty_row();
// bool is_empty_row() const;
......@@ -50,12 +56,12 @@ public:
// void set_current_cell_style_id(unsigned int xfId);
// int get_current_cell_style_id();
// int current_column() const;
// int current_row() const;
//int current_column() const;
//int current_row() const;
// unsigned int current_columns_spaned() const;
// unsigned int current_rows_spanned(unsigned int Column) const;
// unsigned int columns_count() const;
unsigned int columns_count() const;
//
// xlsx_table_metrics & get_table_metrics() { return xlsx_table_metrics_; }
// xlsx_drawing_context & get_drawing_context() { return xlsx_drawing_context_; }
......@@ -83,7 +89,8 @@ public:
private:
ods_conversion_context & context_;
table_table* office_table_;
office_element_ptr office_table_;
style* office_table_style_;
//std::wstring table_style_;
......@@ -92,13 +99,13 @@ private:
// std::vector<std::wstring> column_default_cell_style_name_;
// std::wstring row_default_cell_style_name_;
// std::wstring cell_style_;
// int current_table_column_;
// int current_table_row_;
//int current_table_column_;
//int current_table_row_;
// unsigned int columns_spanned_num_;
// std::wstring columns_spanned_style_;
// std::vector<xlsx_row_spanned> rows_spanned_;
// std::vector<unsigned int> columns_;
// unsigned int columns_count_;
std::vector<ods_column_state> columns_;
unsigned int columns_count_;
// xlsx_merge_cells merge_cells_;
// xlsx_table_metrics xlsx_table_metrics_;
// xlsx_drawing_context xlsx_drawing_context_;
......
......@@ -92,6 +92,55 @@ void XlsxConverter::convert_sheets()
}
void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
{
//
if(oox_sheet->m_oCols.IsInit())
{
for (long col = 0 ; col < oox_sheet->m_oCols->m_arrItems.GetSize();col++)
{
convert(oox_sheet->m_oCols->m_arrItems[col]);
}
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CCol *oox_column)
{
//nullable<SimpleTypes::COnOff<>> m_oBestFit;
//nullable<SimpleTypes::COnOff<>> m_oCollapsed;
//nullable<SimpleTypes::COnOff<>> m_oCustomWidth;
//nullable<SimpleTypes::COnOff<>> m_oHidden;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMax;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMin;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oOutlineLevel;
//nullable<SimpleTypes::COnOff<>> m_oPhonetic;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oStyle;
//nullable<SimpleTypes::CDouble> m_oWidth;
int repeated = (oox_column->m_oMax.IsInit() ? oox_column->m_oMax->GetValue() : 0) -
(oox_column->m_oMin.IsInit() ? oox_column->m_oMin->GetValue() : 0);
int oox_style_id = -1;
ods_context->styles_context().create_style(L"",odf::style_family::TableColumn, true, false, oox_style_id);
odf::style* style = dynamic_cast<odf::style*>(ods_context->styles_context().last_state().get_office_element().get());
if (!style)return;
odf::style_table_column_properties * column_properties = style->style_content_.get_style_table_column_properties();
if (column_properties == NULL)return; //error ????
double width = oox_column->m_oWidth.IsInit() ? oox_column->m_oWidth->GetValue() : 0;
if (oox_column->m_oStyle.IsInit())
{
//m_oCustomWidth
}
if (width < 1 || (oox_column->m_oBestFit.IsInit() && oox_column->m_oBestFit->GetValue()==true))
column_properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
else
{
column_properties->style_table_column_properties_attlist_.style_column_width_ = odf::length(width,odf::length::cm);
// !!!
}
ods_context->add_column(repeated, style->style_name_);
}
void XlsxConverter::convert_styles()
......@@ -103,52 +152,84 @@ void XlsxConverter::convert_styles()
if (!xlsx_styles->m_oCellStyleXfs.IsInit())return;
for (long i=0;i< xlsx_styles->m_oCellStyleXfs->m_oCount->GetValue(); i++)
for (long i=0;i< xlsx_styles->m_oCellStyleXfs->m_oCount->GetValue(); i++)//in styles record
{
convert(xlsx_styles->m_oCellStyleXfs->m_arrItems[i] , i);
convert(xlsx_styles->m_oCellStyleXfs->m_arrItems[i] , i, false, true);
}
for (long i=0;i< xlsx_styles->m_oCellXfs->m_oCount->GetValue(); i++)
{
convert(xlsx_styles->m_oCellXfs->m_arrItems[i],i);
convert(xlsx_styles->m_oCellXfs->m_arrItems[i],i, true,false);
}
for (long i=0;i< xlsx_styles->m_oCellStyles->m_oCount->GetValue(); i++)//styles.xml
{
//std::wstring style_name = string2std_string(xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oName.get2());
//ods_context->styles_context().start_style(style_name ,odf::style_family::TableCell);
//int id_xfd = xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oXfId->GetValue();
//xlsx_styles->m_oCellXfs->m_arrItems[id_xfd];//
//odf::office_element_ptr & elm = ods_context->styles_context().find_by_id(, odf::style_family::TableCell);
//ods_context->styles_.back()->add_child(elm);
//ods_context->styles_context().start_style(xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oName,odf::style_family::TableCell);
//generate style:style
//ods_context->styles_context().current_style().set_cell_style_id();
//// - , text_properies, ... - //style:table-cell-properties, style:paragraph-properties , ...
//ods_context->styles_context().current_style().set_hidden(xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oHidden->ToBool())
//ods_context->styles_context().current_style().set_level(xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oILevel->GetValue())
//
// 1 .. , , ...
//
convert(xlsx_styles->m_oCellStyles->m_arrItems[i],i);
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf::office_element_ptr & odf_style_)
{
if (font == NULL)return;
odf::style* style = dynamic_cast<odf::style*>(odf_style_.get());
if (!style)return;
odf::style_text_properties * text_properties = style->style_content_.get_style_text_properties();// -
if (text_properties == NULL)return;
if (font->m_oBold.IsInit())
{
if (font->m_oBold->m_oVal.ToBool() ==true)
text_properties->content().fo_font_weight_ = odf::font_weight(odf::font_weight::WBold);
else
text_properties->content().fo_font_weight_ = odf::font_weight(odf::font_weight::WNormal);
}
if (font->m_oColor.IsInit())
{
convert(font->m_oColor.GetPointer(),text_properties->content().fo_color_);
}
if (font->m_oUnderline.IsInit())
{
//convert_element ????
}
if (font->m_oItalic.IsInit())
{
if (font->m_oItalic->m_oVal.ToBool() ==true)
text_properties->content().fo_font_style_ = odf::font_style(odf::font_style::Italic);
else
text_properties->content().fo_font_style_ = odf::font_style(odf::font_style::Normal);
}
if (font->m_oSz.IsInit())
{
convert(font->m_oSz->m_oVal->GetValue(), text_properties->content().fo_font_size_);
}
if (font->m_oFamily.IsInit())
{
}
if (font->m_oRFont.IsInit())
{
text_properties->content().style_font_name_ = string2std_string(font->m_oRFont->m_sVal.get());
}
/////
//...
/////
}
void XlsxConverter::convert(double oox_font_size, _CP_OPT(odf::font_size) & odf_font_size)
{
_CP_OPT(odf::length) odf_length;
convert(oox_font_size, odf_length);
if (odf_length)
odf_font_size = odf::font_size(odf_length.get());
}
void XlsxConverter::convert(double oox_size, _CP_OPT(odf::length) & odf_size)
{
odf_size = odf::length(oox_size, odf::length::pt);
}
void XlsxConverter::convert(OOX::Spreadsheet::CFill * fill, odf::office_element_ptr & odf_style_)
{
......@@ -208,6 +289,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf::color)
}
if(color->m_oThemeColor.IsInit())
{
OOX::CTheme * xlsx_theme= xlsx_document->GetTheme();
int theme_ind = color->m_oThemeColor->GetValue();
}
if(color->m_oIndexed.IsInit())
{
......@@ -234,33 +319,58 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf::color)
}
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CCellStyle * cell_style, int oox_id)
{
if (cell_style == NULL)return;
bool automatic = false;
bool root = true;
std::wstring style_name = L"";
if (cell_style->m_oName.IsInit())style_name = string2std_string(cell_style->m_oName.get());
ods_context->styles_context().create_style(style_name,odf::style_family::TableCell, automatic, root, oox_id);
odf::style* style = dynamic_cast<odf::style*>(ods_context->styles_context().last_state().get_office_element().get());
if (!style)return;
int parent_id = cell_style->m_oXfId.IsInit() ? cell_style->m_oXfId->GetValue() : -1;
odf::office_element_ptr XlsxConverter::convert(OOX::Spreadsheet::CXfs * cell_style, int oox_id)
if (parent_id >=0)
style->style_parent_style_name_ = ods_context->styles_context().find_odf_style_name(parent_id, odf::style_family::TableCell);
//m_oBuiltinId, m_oCustomBuiltin, m_oHidden, m_oILevel; ???????
}
void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool automatic, bool root)
{
OOX::Spreadsheet::CStyles * xlsx_styles = xlsx_document->GetStyles();
int id_parent = cell_style->m_oXfId.IsInit() ? cell_style->m_oXfId->GetValue() : -1; //parent
int fill_id = cell_style->m_oFillId.IsInit() ? cell_style->m_oFillId->GetValue() : -1;
int numFmt_id = cell_style->m_oNumFmtId.IsInit() ? cell_style->m_oNumFmtId->GetValue() : -1;
int font_id = cell_style->m_oFontId.IsInit() ? cell_style->m_oFontId->GetValue() : -1;
int border_id = cell_style->m_oBorderId.IsInit() ? cell_style->m_oBorderId->GetValue() : -1;
int id_parent = xfc_style->m_oXfId.IsInit() ? xfc_style->m_oXfId->GetValue() : -1; //parent
int fill_id = xfc_style->m_oFillId.IsInit() ? xfc_style->m_oFillId->GetValue() : -1;
int numFmt_id = xfc_style->m_oNumFmtId.IsInit() ? xfc_style->m_oNumFmtId->GetValue(): -1;
int font_id = xfc_style->m_oFontId.IsInit() ? xfc_style->m_oFontId->GetValue() : -1;
int border_id = xfc_style->m_oBorderId.IsInit() ? xfc_style->m_oBorderId->GetValue(): -1;
std::wstring cell_style_name_new = L"ce" + boost::lexical_cast<std::wstring>(oox_id+1);//
odf::office_element_ptr elm_style = ods_context->styles_context().add_or_find(cell_style_name_new ,odf::style_family::TableCell, true, oox_id);
// c - () - oox
ods_context->styles_context().create_style(L"",odf::style_family::TableCell, automatic, root, oox_id);
odf::office_element_ptr & elm_style = ods_context->styles_context().last_state().get_office_element();
if (xlsx_styles->m_oFonts.IsInit()) convert(xlsx_styles->m_oFonts->m_arrItems[font_id], elm_style); // applyFont
if (xlsx_styles->m_oFills.IsInit()) convert(xlsx_styles->m_oFills->m_arrItems[fill_id], elm_style); // applyFill
if (xlsx_styles->m_oNumFmts.IsInit()) convert(xlsx_styles->m_oNumFmts->m_arrItems[numFmt_id], elm_style);
if (xlsx_styles->m_oBorders.IsInit()) convert(xlsx_styles->m_oBorders->m_arrItems[border_id], elm_style);
odf::style* style = dynamic_cast<odf::style*>(elm_style.get());
if (!style)return elm_style;
if (!style)return;
if (id_parent >=0)
{
style->style_parent_style_name_ = ods_context->styles_context().find_odf_style_name(id_parent, odf::style_family::TableCell);
}
odf::style_table_cell_properties * cell_properties = style->style_content_.get_style_table_cell_properties();
return elm_style;
}
} // namespace Docx2Odt
\ No newline at end of file
......@@ -25,6 +25,8 @@ namespace odf
class ods_conversion_context;
class color;
class background_color;
class font_size;
class length;
}
}
......@@ -51,6 +53,7 @@ namespace Oox2Odf
void convert_styles();
void convert(OOX::Spreadsheet::CWorksheet *oox_sheet);
void convert(OOX::Spreadsheet::CCol *oox_column);
void convert(OOX::Spreadsheet::CFill * fill, odf::office_element_ptr & odf_style_);
void convert(OOX::Spreadsheet::CFont * font, odf::office_element_ptr & odf_style_);
......@@ -59,7 +62,11 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf::color) & odf_color);
void convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf::background_color) & odf_bckgrd_color);
void convert(double oox_font_size, _CP_OPT(odf::font_size) & odf_font_size);
void convert(double oox_size, _CP_OPT(odf::length) & odf_size);
odf::office_element_ptr convert(OOX::Spreadsheet::CXfs * cell_style, int oox_id);
void convert(OOX::Spreadsheet::CXfs * cell_style, int oox_id, bool automatic=true, bool root = false);
void convert(OOX::Spreadsheet::CCellStyle * cell_style, int oox_id);
};
}
\ No newline at end of file
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