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

(1.2.0.84): ASCOfficeOdfFileW

24896
конвертация документов - форматирование параграфов и текста. полностью
доделаны диаграммы, шейпы, картинки.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56846 954022d7-b5bf-4e40-9824-e11837661b57
parent 5f9c25a9
...@@ -307,6 +307,7 @@ void common_value_and_type_attlist::apply_from(const common_value_and_type_attli ...@@ -307,6 +307,7 @@ void common_value_and_type_attlist::apply_from(const common_value_and_type_attli
} }
void common_value_and_type_attlist::serialize(CP_ATTR_NODE) void common_value_and_type_attlist::serialize(CP_ATTR_NODE)
{ {
CP_XML_ATTR_OPT(L"office:value-type", office_value_type_);
CP_XML_ATTR_OPT(L"office:value", office_value_); CP_XML_ATTR_OPT(L"office:value", office_value_);
if (office_value_) if (office_value_)
{ {
...@@ -316,7 +317,6 @@ void common_value_and_type_attlist::serialize(CP_ATTR_NODE) ...@@ -316,7 +317,6 @@ void common_value_and_type_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"office:time-value", office_time_value_); CP_XML_ATTR_OPT(L"office:time-value", office_time_value_);
CP_XML_ATTR_OPT(L"office:boolean-value", office_boolean_value_); CP_XML_ATTR_OPT(L"office:boolean-value", office_boolean_value_);
CP_XML_ATTR_OPT(L"office:string-value", office_string_value_); CP_XML_ATTR_OPT(L"office:string-value", office_string_value_);
CP_XML_ATTR_OPT(L"office:value-type", office_value_type_);
} }
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -47,6 +47,7 @@ namespace odf ...@@ -47,6 +47,7 @@ namespace odf
std::wstring ref; std::wstring ref;
std::wstring format; std::wstring format;
bool label;
//std::vector<double> data_double; //std::vector<double> data_double;
std::vector<std::wstring> data_str; std::vector<std::wstring> data_str;
}; };
...@@ -73,6 +74,13 @@ namespace odf ...@@ -73,6 +74,13 @@ namespace odf
office_element_ptr elm; office_element_ptr elm;
}; };
struct _cell_cash
{
int col;
int row;
bool label;
std::wstring val;
};
class odf_chart_context::Impl class odf_chart_context::Impl
{ {
public: public:
...@@ -109,6 +117,7 @@ public: ...@@ -109,6 +117,7 @@ public:
chart_series *get_current_series(); chart_series *get_current_series();
void create_local_table(); void create_local_table();
void create_local_table_rows(ods_table_state * table_state,std::vector<_cell_cash> & cells, bool header );
}; };
chart_chart* odf_chart_context::Impl::get_current_chart() chart_chart* odf_chart_context::Impl::get_current_chart()
{ {
...@@ -362,7 +371,7 @@ void odf_chart_context::set_chart_3D(bool val) ...@@ -362,7 +371,7 @@ void odf_chart_context::set_chart_3D(bool val)
impl_->current_level_.back().chart_properties_->content().chart_three_dimensional_ = val; impl_->current_level_.back().chart_properties_->content().chart_three_dimensional_ = val;
impl_->current_level_.back().chart_properties_->content().chart_treat_empty_cells_ = boost::none; impl_->current_level_.back().chart_properties_->content().chart_treat_empty_cells_ = boost::none;
impl_->current_level_.back().chart_properties_->content().chart_series_source_ = chart_series_source(chart_series_source::rows); //impl_->current_level_.back().chart_properties_->content().chart_series_source_ = chart_series_source(chart_series_source::rows);
//impl_->current_level_.back().chart_properties_->content(). //impl_->current_level_.back().chart_properties_->content().
//chart:treat-empty-cells="leave-gap" //chart:treat-empty-cells="leave-gap"
...@@ -1213,19 +1222,6 @@ static formulasconvert::oox2odf_converter formulas_converter; ...@@ -1213,19 +1222,6 @@ static formulasconvert::oox2odf_converter formulas_converter;
void odf_chart_context::set_series_value_formula(std::wstring oox_formula) void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
{ {
//if (impl_->local_table_enabled_)
//{
// //rename table name -> local_table
// std::wstring table_name ;
// int res= oox_formula.find(L"!");
// if (res > 0)
// {
// table_name = oox_formula.substr(0,res);
// boost::algorithm::replace_all(oox_formula, table_name, L"local-table");
// }
//}
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula); std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get()); chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
...@@ -1238,18 +1234,6 @@ void odf_chart_context::set_series_value_formula(std::wstring oox_formula) ...@@ -1238,18 +1234,6 @@ void odf_chart_context::set_series_value_formula(std::wstring oox_formula)
} }
void odf_chart_context::set_series_label_formula(std::wstring oox_formula) void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
{ {
//if (impl_->local_table_enabled_)
//{
// //rename table name -> local_table
// std::wstring table_name ;
// int res= oox_formula.find(L"!");
// if (res > 0)
// {
// table_name = oox_formula.substr(0,res);
// boost::algorithm::replace_all(oox_formula, table_name, L"local-table");
// }
//}
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula); std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get()); chart_series *series = dynamic_cast<chart_series*>(impl_->current_chart_state_.elements_.back().elm.get());
...@@ -1261,25 +1245,13 @@ void odf_chart_context::set_series_label_formula(std::wstring oox_formula) ...@@ -1261,25 +1245,13 @@ void odf_chart_context::set_series_label_formula(std::wstring oox_formula)
void odf_chart_context::set_category_axis_formula(std::wstring oox_formula,int type) void odf_chart_context::set_category_axis_formula(std::wstring oox_formula,int type)
{ {
//if (impl_->local_table_enabled_)
//{
// //rename table name -> local_table
// std::wstring table_name ;
// int res= oox_formula.find(L"!");
// if (res > 0)
// {
// table_name = oox_formula.substr(0,res);
// boost::algorithm::replace_all(oox_formula, table_name, L"local-table");
// }
//}
std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula); std::wstring odfFormula = formulas_converter.convert_chart_distance(oox_formula);
impl_->data_cell_ranges_.push_back(odfFormula); impl_->data_cell_ranges_.push_back(odfFormula);
impl_->categories_.push_back(std::pair<std::wstring,int>(odfFormula,type)); impl_->categories_.push_back(std::pair<std::wstring,int>(odfFormula,type));
} }
void odf_chart_context::set_series_pie_explosion(int val) void odf_chart_context::set_series_pie_explosion(int val)//
{ {
if (!impl_->current_level_.back().chart_properties_)return; if (!impl_->current_level_.back().chart_properties_)return;
...@@ -1295,7 +1267,7 @@ void odf_chart_context::set_series_pie_explosion(int val) ...@@ -1295,7 +1267,7 @@ void odf_chart_context::set_series_pie_explosion(int val)
// odf_cash_state state = {ref, format,/*data_double,*/data_str}; // odf_cash_state state = {ref, format,/*data_double,*/data_str};
// impl_->cash_.push_back(state); // impl_->cash_.push_back(state);
//} //}
void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring> & data_str) void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring> & data_str,bool label)
{ {
if (data_str.size() <1 || impl_->data_cell_ranges_.size() < 1) return; if (data_str.size() <1 || impl_->data_cell_ranges_.size() < 1) return;
...@@ -1303,7 +1275,8 @@ void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring> ...@@ -1303,7 +1275,8 @@ void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring>
std::vector<double> data_double; std::vector<double> data_double;
odf_cash_state state = {ref, format/*,data_double*/,data_str}; odf_cash_state state = {ref, format/*,data_double*/,label,data_str};
impl_->cash_.push_back(state); impl_->cash_.push_back(state);
} }
...@@ -1314,30 +1287,69 @@ void odf_chart_context::set_local_table (bool Val) ...@@ -1314,30 +1287,69 @@ void odf_chart_context::set_local_table (bool Val)
impl_->local_table_enabled_ = Val; impl_->local_table_enabled_ = Val;
} }
void odf_chart_context::Impl::create_local_table() struct _sort_cells
{ {
if (local_table_enabled_ == false)return;
struct _cell_cash
{
int col;
int row;
std::wstring val;
};
struct _sort_cells
{
bool operator() (_cell_cash i, _cell_cash j) bool operator() (_cell_cash i, _cell_cash j)
{ {
if (i.row==j.row) if (i.row == j.row)
return (i.col<j.col); return (i.col<j.col);
else else
return (i.row<j.row); return (i.row<j.row);
} }
} sort_cells; } sort_cells;
void odf_chart_context::Impl::create_local_table_rows(ods_table_state * table_state,std::vector<_cell_cash> & cells, bool header )
{
int curr_row = 0;
int curr_cell = 0;
for (long i = 0; i< cells.size(); i++)
{
if (cells[i].row > curr_row+1)
{
office_element_ptr row_elm;
create_element(L"table", L"table-row",row_elm, odf_context_);
table_state->add_row(row_elm,cells[i].row - curr_row -2,office_element_ptr());
curr_row = cells[i].row-1;
}
if (cells[i].row == curr_row+1)
{
if (cells[i].label == header)
{
office_element_ptr row_elm;
create_element(L"table", L"table-row",row_elm, odf_context_);
table_state->add_row(row_elm,1 ,office_element_ptr());
}
curr_row++;
curr_cell=0;
}
if (cells[i].label == !header)continue;
if (curr_cell+1 < cells[i].col)
table_state->add_default_cell(cells[i].col - curr_cell-1);
office_element_ptr cell_elm;
create_element(L"table", L"table-cell",cell_elm, odf_context_);
table_state->start_cell(cell_elm,office_element_ptr());
table_state->set_cell_value(cells[i].val, true);
//add type
table_state->end_cell();
curr_cell = cells[i].col;
}
}
void odf_chart_context::Impl::create_local_table()
{
if (local_table_enabled_ == false)return;
std::vector<_cell_cash> cells_cash; std::vector<_cell_cash> cells_cash;
std::vector<_cell_cash> cells_cash_label;
std::wstring table_name = L"local-table"; std::wstring table_name = L"local-table";
int max_columns=0;
for (long i=0; i < cash_.size(); i++) for (long i=0; i < cash_.size(); i++)
{ {
...@@ -1372,10 +1384,16 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1372,10 +1384,16 @@ void odf_chart_context::Impl::create_local_table()
c.col = (col2==col1) ? col1 : col1+j; c.col = (col2==col1) ? col1 : col1+j;
c.row = (row2==row1) ? row1 : row1+j; c.row = (row2==row1) ? row1 : row1+j;
c.val = cash_[i].data_str[j]; c.val = cash_[i].data_str[j];
c.label = cash_[i].label;
cells_cash.push_back(c); cells_cash.push_back(c);
if (c.label) cells_cash_label.push_back(c);
if (c.col > max_columns) max_columns = c.col;
} }
} }
std::sort(cells_cash.begin(), cells_cash.end(),sort_cells); std::sort(cells_cash.begin(), cells_cash.end(),sort_cells);
std::sort(cells_cash_label.begin(), cells_cash_label.end(),sort_cells);
///////////////////////// /////////////////////////
//create tables //create tables
...@@ -1384,7 +1402,6 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1384,7 +1402,6 @@ void odf_chart_context::Impl::create_local_table()
create_element(L"table", L"table",table_elm, odf_context_); create_element(L"table", L"table",table_elm, odf_context_);
ods_table_state * table_state = new ods_table_state(odf_context_, table_elm); ods_table_state * table_state = new ods_table_state(odf_context_, table_elm);
if (table_state) if (table_state)
{ {
current_level_[0].elm->add_child_element(table_elm); current_level_[0].elm->add_child_element(table_elm);
...@@ -1394,50 +1411,10 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1394,50 +1411,10 @@ void odf_chart_context::Impl::create_local_table()
table_state->set_table_name(table_name); table_state->set_table_name(table_name);
int curr_row = 0; /////////////////////////////////////////////////
office_element_ptr cols_header_elm;
int max_columns=0; create_element(L"table", L"table-header-columns",cols_header_elm, odf_context_);
int curr_cell = 0; table_elm->add_child_element(cols_header_elm);
for (long i = 0; i< cells_cash.size(); i++)
{
if (cells_cash[i].row > curr_row+1)
{
office_element_ptr row_elm;
create_element(L"table", L"table-row",row_elm, odf_context_);
table_state->add_row(row_elm,cells_cash[i].row - curr_row -2,office_element_ptr());
curr_row = cells_cash[i].row-1;
}
if (cells_cash[i].row == curr_row+1)
{
office_element_ptr row_elm;
create_element(L"table", L"table-row",row_elm, odf_context_);
table_state->add_row(row_elm,1 ,office_element_ptr());
curr_row++;
curr_cell=1;
}
if (curr_cell < cells_cash[i].col)
table_state->add_default_cell(cells_cash[i].col - curr_cell);
office_element_ptr cell_elm;
create_element(L"table", L"table-cell",cell_elm, odf_context_);
table_state->start_cell(cell_elm,office_element_ptr());
table_state->set_cell_value(cells_cash[i].val, true);
//add type
table_state->end_cell();
curr_cell = cells_cash[i].col;
if (curr_cell > max_columns) max_columns = curr_cell;
}
//office_element_ptr hc_elm;
//create_element(L"table", L"table-header-columns",hc_elm, odf_context_);
//table_elm->add_child_element(hc_elm);
//office_element_ptr hr_elm;
//create_element(L"table", L"table-header-rows",hr_elm, odf_context_);
//table_elm->add_child_element(hr_elm);
office_element_ptr cols_elm; office_element_ptr cols_elm;
create_element(L"table", L"table-columns",cols_elm, odf_context_); create_element(L"table", L"table-columns",cols_elm, odf_context_);
...@@ -1447,10 +1424,18 @@ void odf_chart_context::Impl::create_local_table() ...@@ -1447,10 +1424,18 @@ void odf_chart_context::Impl::create_local_table()
create_element(L"table", L"table-column",col_elm, odf_context_); create_element(L"table", L"table-column",col_elm, odf_context_);
for (long i=0; i < max_columns; i++) for (long i=0; i < max_columns; i++)
{
cols_elm->add_child_element(col_elm); cols_elm->add_child_element(col_elm);
//table_state->add_column(col_elm,1,office_element_ptr());
if (cells_cash_label.size() > 0)
{
office_element_ptr row_headers_elm;
create_element(L"table", L"table-header-rows",row_headers_elm, odf_context_);
table_state->start_headers(row_headers_elm);
create_local_table_rows(table_state, cells_cash_label ,true);
table_state->end_headers();
} }
create_local_table_rows(table_state, cells_cash ,false);
} }
delete table_state; delete table_state;
......
...@@ -112,7 +112,7 @@ public: ...@@ -112,7 +112,7 @@ public:
void set_local_table(bool Val); void set_local_table(bool Val);
//void set_cash(std::wstring format, std::vector<double> &data); //void set_cash(std::wstring format, std::vector<double> &data);
void set_cash(std::wstring format, std::vector<std::wstring> &data); void set_cash(std::wstring format, std::vector<std::wstring> &data,bool label = false);
void end_chart(); void end_chart();
......
...@@ -182,7 +182,56 @@ void odf_text_context::end_span() ...@@ -182,7 +182,56 @@ void odf_text_context::end_span()
current_level_.pop_back(); current_level_.pop_back();
} }
void odf_text_context::add_textline_break()
{
office_element_ptr elm;
create_element(L"text", L"line-break", elm, odf_context_);
if (current_level_.size()>0)
current_level_.back()->add_child_element(elm);
}
void odf_text_context::add_text_style(office_element_ptr & style_elm, std::wstring style_name)
{
if (text_elements_list_.size() < 1 )return;
if (text_span* span = dynamic_cast<text_span*>(text_elements_list_.back().elm.get()))
{
span->text_style_name_ = style_ref(style_name);
text_elements_list_.back().style_elm = style_elm;
text_elements_list_.back().style_name = style_name;
}
if (text_p* p = dynamic_cast<text_p*>(text_elements_list_.back().elm.get()))
{
p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(style_name);
text_elements_list_.back().style_elm = style_elm;
text_elements_list_.back().style_name = style_name;
}
}
void odf_text_context::add_page_break()
{
office_element_ptr elm;
create_element(L"text", L"soft-page-break", elm, odf_context_);
bool in_span = false;
if (text_span* span = dynamic_cast<text_span*>(current_level_.back().get()))
{
in_span = true;
end_span(); // todoo -
}
if (current_level_.size()>0)
current_level_.back()->add_child_element(elm);
//end paragraph + style add after-break = page
//start paragraph - continues style
if (in_span)
{
start_span(false);
}
}
void odf_text_context::set_parent_paragraph_style(std::wstring & style_name) void odf_text_context::set_parent_paragraph_style(std::wstring & style_name)
{ {
parent_paragraph_style_ = style_name; parent_paragraph_style_ = style_name;
......
...@@ -39,6 +39,8 @@ public: ...@@ -39,6 +39,8 @@ public:
public: public:
void set_styles_context(odf_style_context* styles_context);// embedded void set_styles_context(odf_style_context* styles_context);// embedded
void add_text_style(office_element_ptr & style_elm, std::wstring style_name);
void set_single_object(bool val, style_paragraph_properties *para_props, style_text_properties *text_props); void set_single_object(bool val, style_paragraph_properties *para_props, style_text_properties *text_props);
void add_text_content(const std::wstring & text); void add_text_content(const std::wstring & text);
...@@ -52,6 +54,9 @@ public: ...@@ -52,6 +54,9 @@ public:
void start_span(bool styled = false); void start_span(bool styled = false);
void end_span(); void end_span();
void add_textline_break();
void add_page_break();
std::vector<office_element_ptr> current_level_;// std::vector<office_element_ptr> current_level_;//
std::vector<odf_text_state> text_elements_list_;//, , ... std::vector<odf_text_state> text_elements_list_;//, , ...
......
...@@ -196,6 +196,17 @@ void ods_table_state::end_group() ...@@ -196,6 +196,17 @@ void ods_table_state::end_group()
current_level_.pop_back(); current_level_.pop_back();
} }
void ods_table_state::start_headers(office_element_ptr & elm)
{
current_level_.back()->add_child_element(elm);
current_level_.push_back(elm);
}
void ods_table_state::end_headers()
{
current_level_.pop_back();
}
void ods_table_state::add_column(office_element_ptr & elm, __int16 repeated,office_element_ptr & style_elm) void ods_table_state::add_column(office_element_ptr & elm, __int16 repeated,office_element_ptr & style_elm)
{ {
current_level_.back()->add_child_element(elm); current_level_.back()->add_child_element(elm);
...@@ -601,7 +612,7 @@ void ods_table_state::set_cell_formula(std::wstring & formula) ...@@ -601,7 +612,7 @@ void ods_table_state::set_cell_formula(std::wstring & formula)
//test external link //test external link
{ {
boost::wregex re(L"(\[\\d+\])"); boost::wregex re(L"([\[]\\d+\[\]])+");
boost::wsmatch result; boost::wsmatch result;
bool b = boost::regex_search(formula, result, re); bool b = boost::regex_search(formula, result, re);
......
...@@ -194,6 +194,9 @@ public: ...@@ -194,6 +194,9 @@ public:
__int32 current_level() {return current_level_.size()-1;} __int32 current_level() {return current_level_.size()-1;}
void start_headers(office_element_ptr & elm);
void end_headers();
void add_row(office_element_ptr & elm, __int16 repeated ,office_element_ptr & style);//const std::wstring & StyleName, const std::wstring & defaultCellStyleName); void add_row(office_element_ptr & elm, __int16 repeated ,office_element_ptr & style);//const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
void set_row_hidden(bool Val); void set_row_hidden(bool Val);
void set_row_optimal_height(bool val); void set_row_optimal_height(bool val);
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <cpdoccore/xml/serialize.h> #include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h> #include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
...@@ -59,7 +57,10 @@ bool is_text_content(const std::wstring & ns, const std::wstring & name) ...@@ -59,7 +57,10 @@ bool is_text_content(const std::wstring & ns, const std::wstring & name)
return false; return false;
} }
} }
void office_text_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"text:use-soft-page-breaks", text_use_soft_page_breaks_);
}
void office_text::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name) void office_text::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{ {
if (is_text_content(Ns, Name)) if (is_text_content(Ns, Name))
...@@ -80,6 +81,8 @@ void office_text::serialize(std::wostream & _Wostream) ...@@ -80,6 +81,8 @@ void office_text::serialize(std::wostream & _Wostream)
{ {
CP_XML_NODE_SIMPLE() CP_XML_NODE_SIMPLE()
{ {
office_text_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(office_element_ptr & elm, content_) BOOST_FOREACH(office_element_ptr & elm, content_)
{ {
elm->serialize(CP_XML_STREAM()); elm->serialize(CP_XML_STREAM());
......
...@@ -4,13 +4,26 @@ ...@@ -4,13 +4,26 @@
#include <cpdoccore/CPOptional.h> #include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h> #include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h> #include <cpdoccore/xml/nodetype.h>
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include "Bool.h"
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
/// \class office_text //office_text_attlist
class office_text_attlist
{
public:
_CP_OPT(Bool) text_use_soft_page_breaks_;
void serialize(CP_ATTR_NODE);
};
/// \brief office:text /// \brief office:text
class office_text : public office_element_impl<office_text> class office_text : public office_element_impl<office_text>
{ {
...@@ -30,6 +43,8 @@ public: ...@@ -30,6 +43,8 @@ public:
// 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);
office_text_attlist office_text_attlist_;
private: private:
bool text_global_; bool text_global_;
// TODO: office-text-content-prelude: // TODO: office-text-content-prelude:
......
...@@ -299,6 +299,8 @@ void text_format_properties_content::serialize(std::wostream & _Wostream,const w ...@@ -299,6 +299,8 @@ void text_format_properties_content::serialize(std::wostream & _Wostream,const w
CP_XML_ATTR_OPT(L"style:text-overline-color", style_text_overline_color_); CP_XML_ATTR_OPT(L"style:text-overline-color", style_text_overline_color_);
CP_XML_ATTR_OPT(L"style:text-overline-mode", style_text_overline_mode_); CP_XML_ATTR_OPT(L"style:text-overline-mode", style_text_overline_mode_);
CP_XML_ATTR_OPT(L"style:text-overline-style", style_text_overline_style_); CP_XML_ATTR_OPT(L"style:text-overline-style", style_text_overline_style_);
common_border_attlist_.serialize(CP_GET_XML_NODE());
} }
} }
} }
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include "bool.h" #include "common_attlists.h"
#include "style_ref.h"
#include "fontvariant.h" #include "fontvariant.h"
#include "texttransform.h" #include "texttransform.h"
#include "color.h" #include "color.h"
...@@ -261,6 +261,8 @@ public: ...@@ -261,6 +261,8 @@ public:
// style:text-overline-style // style:text-overline-style
_CP_OPT(std::wstring) style_text_overline_style_; _CP_OPT(std::wstring) style_text_overline_style_;
common_border_attlist common_border_attlist_;
}; };
class style_text_properties; class style_text_properties;
......
...@@ -787,7 +787,7 @@ void table_rows_and_groups::add_child_element(office_element_ptr & child_element ...@@ -787,7 +787,7 @@ void table_rows_and_groups::add_child_element(office_element_ptr & child_element
{ {
content_.push_back(child_element); content_.push_back(child_element);
} }
else if (type == typeTableTableRows || type == typeTableTableRow) else if (type == typeTableTableRows || type == typeTableTableRow || type == typeTableTableHeaderRows)
{ {
_CP_PTR(table_rows_no_group) elm = table_rows_no_group::create(Context); _CP_PTR(table_rows_no_group) elm = table_rows_no_group::create(Context);
elm->add_child_element(child_element); elm->add_child_element(child_element);
......
...@@ -25,6 +25,8 @@ namespace Oox2Odf ...@@ -25,6 +25,8 @@ namespace Oox2Odf
} }
Converter::Converter(const std::wstring & path, std::wstring type) Converter::Converter(const std::wstring & path, std::wstring type)
{ {
impl_ = NULL;
if (type == L"text") impl_ = new DocxConverter(path); if (type == L"text") impl_ = new DocxConverter(path);
if (type == L"spreadsheet") impl_ = new XlsxConverter(path); if (type == L"spreadsheet") impl_ = new XlsxConverter(path);
} }
...@@ -40,6 +42,7 @@ namespace Oox2Odf ...@@ -40,6 +42,7 @@ namespace Oox2Odf
} }
void Converter::write(const std::wstring & path) const void Converter::write(const std::wstring & path) const
{ {
if (!impl_)return;
return impl_->write(path); return impl_->write(path);
} }
......
...@@ -18,6 +18,9 @@ namespace cpdoccore ...@@ -18,6 +18,9 @@ namespace cpdoccore
class length_or_percent; class length_or_percent;
class style_paragraph_properties; class style_paragraph_properties;
class style_text_properties; class style_text_properties;
class color;
class length;
class text_align;
} }
} }
namespace OOX namespace OOX
...@@ -318,7 +321,7 @@ public: ...@@ -318,7 +321,7 @@ public:
void convert(OOX::Spreadsheet::CT_Marker *marker, CAtlArray<OOX::Spreadsheet::CT_DPt*> & dPt); void convert(OOX::Spreadsheet::CT_Marker *marker, CAtlArray<OOX::Spreadsheet::CT_DPt*> & dPt);
void convert(OOX::Spreadsheet::CT_ExternalData *external_data); void convert(OOX::Spreadsheet::CT_ExternalData *external_data);
void convert(OOX::Spreadsheet::CT_NumData *num_data); void convert(OOX::Spreadsheet::CT_NumData *num_data);
void convert(OOX::Spreadsheet::CT_StrData *str_data); void convert(OOX::Spreadsheet::CT_StrData *str_data, bool label = false);
////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////
void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size); void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size);
......
...@@ -835,6 +835,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, CAtlArray<OOX::S ...@@ -835,6 +835,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, CAtlArray<OOX::S
odf_context()->chart_context()->start_data_point_series(1); odf_context()->chart_context()->start_data_point_series(1);
convert(dPt[i]->m_oSpPr.GetPointer()); convert(dPt[i]->m_oSpPr.GetPointer());
convert(dPt[i]->m_marker); convert(dPt[i]->m_marker);
if (dPt[i]->m_explosion && dPt[i]->m_explosion->m_val)
odf_context()->chart_context()->set_series_pie_explosion(*dPt[i]->m_explosion->m_val);
odf_context()->chart_context()->end_element(); odf_context()->chart_context()->end_element();
current_point = set_point+1; current_point = set_point+1;
...@@ -904,7 +906,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx) ...@@ -904,7 +906,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerTx* ser_tx)
{ {
if (ser_tx->m_strRef->m_f)odf_context()->chart_context()->set_series_label_formula(string2std_string(*ser_tx->m_strRef->m_f)); if (ser_tx->m_strRef->m_f)odf_context()->chart_context()->set_series_label_formula(string2std_string(*ser_tx->m_strRef->m_f));
convert(ser_tx->m_strRef->m_strCache); convert(ser_tx->m_strRef->m_strCache,true);
} }
//if (ser_tx->m_v)odf_context()->chart_context()->set_series_name(string2std_string(*ser_tx->m_v)); //if (ser_tx->m_v)odf_context()->chart_context()->set_series_name(string2std_string(*ser_tx->m_v));
...@@ -1008,7 +1010,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data) ...@@ -1008,7 +1010,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_data)
odf_context()->chart_context()->set_cash(format, data); odf_context()->chart_context()->set_cash(format, data);
} }
void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data) void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data, bool label)
{ {
if (str_data == NULL)return; if (str_data == NULL)return;
std::vector<std::wstring> data; std::vector<std::wstring> data;
...@@ -1021,6 +1023,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data) ...@@ -1021,6 +1023,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data)
} }
std::wstring format; std::wstring format;
odf_context()->chart_context()->set_cash(format, data); odf_context()->chart_context()->set_cash(format, data,label);
} }
} }
\ No newline at end of file
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
#include "Converter.h" #include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>
#include <Common/SimpleTypes_Word.h>
namespace OOX namespace OOX
{ {
class CDocx; class CDocx;
...@@ -18,9 +24,20 @@ namespace OOX ...@@ -18,9 +24,20 @@ namespace OOX
class CDrawing; class CDrawing;
class CGroupShape; class CGroupShape;
class CShape; class CShape;
class CPBdr;
} }
}
}
namespace ComplexTypes
{
namespace Word
{
class CColor;
class CJc;
class CBorder;
class CShading;
}
}
namespace cpdoccore namespace cpdoccore
{ {
namespace odf namespace odf
...@@ -34,6 +51,7 @@ namespace cpdoccore ...@@ -34,6 +51,7 @@ namespace cpdoccore
class odt_conversion_context; class odt_conversion_context;
} }
} }
using namespace cpdoccore; using namespace cpdoccore;
namespace Oox2Odf namespace Oox2Odf
...@@ -64,8 +82,8 @@ namespace Oox2Odf ...@@ -64,8 +82,8 @@ namespace Oox2Odf
void convert(OOX::Logic::CParagraph *oox_paragraph); void convert(OOX::Logic::CParagraph *oox_paragraph);
void convert(OOX::Logic::CRun *oox_run); void convert(OOX::Logic::CRun *oox_run);
void convert(OOX::Logic::CParagraphProperty *oox_paragraph_prop); void convert(OOX::Logic::CParagraphProperty *oox_paragraph_prop, odf::style_paragraph_properties *paragraph_properties);
void convert(OOX::Logic::CRunProperty *oox_run_prop); void convert(OOX::Logic::CRunProperty *oox_run_prop, odf::style_text_properties *text_properties);
void convert(OOX::Logic::CText *oox_text); void convert(OOX::Logic::CText *oox_text);
void convert(OOX::Logic::CAlternateContent *oox_alt_content); void convert(OOX::Logic::CAlternateContent *oox_alt_content);
void convert(OOX::Logic::CDrawing *oox_drawing); void convert(OOX::Logic::CDrawing *oox_drawing);
...@@ -76,6 +94,15 @@ namespace Oox2Odf ...@@ -76,6 +94,15 @@ namespace Oox2Odf
void convert(OOX::Logic::CShape *oox_shape); void convert(OOX::Logic::CShape *oox_shape);
void convert(OOX::Drawing::CChart *oox_chart); void convert(OOX::Drawing::CChart *oox_chart);
void convert(OOX::Drawing::CPicture *oox_chart); void convert(OOX::Drawing::CPicture *oox_chart);
void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf::color) & odf_color);
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf::length) & odf_size);
void convert(ComplexTypes::Word::CJc *oox_jc, _CP_OPT(odf::text_align) & align);
void convert(OOX::Logic::CPBdr *oox_border, odf::style_paragraph_properties * paragraph_properties);
void convert(ComplexTypes::Word::CBorder *borderProp, std::wstring & odf_border_prop);
void convert(ComplexTypes::Word::CShading *oox_shading, odf::style_text_properties * text_properties );
void convert(SimpleTypes::CHexColor<> *color, SimpleTypes::CThemeColor<> *theme_color,
SimpleTypes::CUcharHexNumber<>* theme_tint,
SimpleTypes::CUcharHexNumber<>* theme_shade, _CP_OPT(odf::color) & odf_color);
}; };
} }
\ No newline at end of file
...@@ -1045,9 +1045,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAligment *aligment, odf::style_pa ...@@ -1045,9 +1045,16 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAligment *aligment, odf::style_pa
} }
if (aligment->m_oTextRotation.IsInit()) if (aligment->m_oTextRotation.IsInit())
{ {
cell_properties->style_table_cell_properties_attlist_.common_rotation_angle_attlist_.style_rotation_angle_ = aligment->m_oTextRotation->GetValue(); int rot = aligment->m_oTextRotation->GetValue();
if (rot <=180 && rot >= 0 )
{
cell_properties->style_table_cell_properties_attlist_.common_rotation_angle_attlist_.style_rotation_angle_ = rot;
cell_properties->style_table_cell_properties_attlist_.style_rotation_align_= odf::rotation_align(odf::rotation_align::Bottom); cell_properties->style_table_cell_properties_attlist_.style_rotation_align_= odf::rotation_align(odf::rotation_align::Bottom);
} }
else if (rot == 0xff)//
cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf::direction(odf::direction::Ttb);
}
if(aligment->m_oHorizontal.IsInit()) if(aligment->m_oHorizontal.IsInit())
{ {
switch(aligment->m_oHorizontal->GetValue()) switch(aligment->m_oHorizontal->GetValue())
......
...@@ -88,10 +88,8 @@ namespace odf ...@@ -88,10 +88,8 @@ namespace odf
} }
class odf_conversion_context; class odf_conversion_context;
class ods_conversion_context; class ods_conversion_context;
class color;
class background_color; class background_color;
class font_size; class font_size;
class length;
} }
} }
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//2 //2
//0 //0
//82 //85
#define INTVER 1,2,0,82 #define INTVER 1,2,0,85
#define STRVER "1,2,0,82\0" #define STRVER "1,2,0,85\0"
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