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
}
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_);
if (office_value_)
{
......@@ -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:boolean-value", office_boolean_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
std::wstring ref;
std::wstring format;
bool label;
//std::vector<double> data_double;
std::vector<std::wstring> data_str;
};
......@@ -73,6 +74,13 @@ namespace odf
office_element_ptr elm;
};
struct _cell_cash
{
int col;
int row;
bool label;
std::wstring val;
};
class odf_chart_context::Impl
{
public:
......@@ -109,6 +117,7 @@ public:
chart_series *get_current_series();
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()
{
......@@ -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_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().
//chart:treat-empty-cells="leave-gap"
......@@ -1213,19 +1222,6 @@ static formulasconvert::oox2odf_converter formulas_converter;
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);
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)
}
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);
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)
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);
impl_->data_cell_ranges_.push_back(odfFormula);
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;
......@@ -1295,7 +1267,7 @@ void odf_chart_context::set_series_pie_explosion(int val)
// odf_cash_state state = {ref, format,/*data_double,*/data_str};
// 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;
......@@ -1303,7 +1275,8 @@ void odf_chart_context::set_cash(std::wstring format, std::vector<std::wstring>
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);
}
......@@ -1314,30 +1287,69 @@ void odf_chart_context::set_local_table (bool 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)
{
if (i.row==j.row)
if (i.row == j.row)
return (i.col<j.col);
else
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_label;
std::wstring table_name = L"local-table";
int max_columns=0;
for (long i=0; i < cash_.size(); i++)
{
......@@ -1372,10 +1384,16 @@ void odf_chart_context::Impl::create_local_table()
c.col = (col2==col1) ? col1 : col1+j;
c.row = (row2==row1) ? row1 : row1+j;
c.val = cash_[i].data_str[j];
c.label = cash_[i].label;
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_label.begin(), cells_cash_label.end(),sort_cells);
/////////////////////////
//create tables
......@@ -1384,7 +1402,6 @@ void odf_chart_context::Impl::create_local_table()
create_element(L"table", L"table",table_elm, odf_context_);
ods_table_state * table_state = new ods_table_state(odf_context_, table_elm);
if (table_state)
{
current_level_[0].elm->add_child_element(table_elm);
......@@ -1394,50 +1411,10 @@ void odf_chart_context::Impl::create_local_table()
table_state->set_table_name(table_name);
int curr_row = 0;
int max_columns=0;
int curr_cell = 0;
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_header_elm;
create_element(L"table", L"table-header-columns",cols_header_elm, odf_context_);
table_elm->add_child_element(cols_header_elm);
office_element_ptr cols_elm;
create_element(L"table", L"table-columns",cols_elm, odf_context_);
......@@ -1447,10 +1424,18 @@ void odf_chart_context::Impl::create_local_table()
create_element(L"table", L"table-column",col_elm, odf_context_);
for (long i=0; i < max_columns; i++)
{
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;
......
......@@ -112,7 +112,7 @@ public:
void set_local_table(bool Val);
//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();
......
......@@ -182,7 +182,56 @@ void odf_text_context::end_span()
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)
{
parent_paragraph_style_ = style_name;
......
......@@ -39,6 +39,8 @@ public:
public:
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 add_text_content(const std::wstring & text);
......@@ -52,6 +54,9 @@ public:
void start_span(bool styled = false);
void end_span();
void add_textline_break();
void add_page_break();
std::vector<office_element_ptr> current_level_;//
std::vector<odf_text_state> text_elements_list_;//, , ...
......
......@@ -196,6 +196,17 @@ void ods_table_state::end_group()
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)
{
current_level_.back()->add_child_element(elm);
......@@ -601,7 +612,7 @@ void ods_table_state::set_cell_formula(std::wstring & formula)
//test external link
{
boost::wregex re(L"(\[\\d+\])");
boost::wregex re(L"([\[]\\d+\[\]])+");
boost::wsmatch result;
bool b = boost::regex_search(formula, result, re);
......
......@@ -194,6 +194,9 @@ public:
__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 set_row_hidden(bool Val);
void set_row_optimal_height(bool val);
......
......@@ -7,8 +7,6 @@
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
namespace odf {
......@@ -59,7 +57,10 @@ bool is_text_content(const std::wstring & ns, const std::wstring & name)
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)
{
if (is_text_content(Ns, Name))
......@@ -80,6 +81,8 @@ void office_text::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
office_text_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(office_element_ptr & elm, content_)
{
elm->serialize(CP_XML_STREAM());
......
......@@ -4,13 +4,26 @@
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include "Bool.h"
namespace cpdoccore {
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
class office_text : public office_element_impl<office_text>
{
......@@ -30,6 +43,8 @@ public:
// virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
// virtual void add_text(const std::wstring & Text);
office_text_attlist office_text_attlist_;
private:
bool text_global_;
// TODO: office-text-content-prelude:
......
......@@ -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-mode", style_text_overline_mode_);
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 @@
#include "office_elements.h"
#include "office_elements_create.h"
#include "bool.h"
#include "style_ref.h"
#include "common_attlists.h"
#include "fontvariant.h"
#include "texttransform.h"
#include "color.h"
......@@ -261,6 +261,8 @@ public:
// style:text-overline-style
_CP_OPT(std::wstring) style_text_overline_style_;
common_border_attlist common_border_attlist_;
};
class style_text_properties;
......
......@@ -787,7 +787,7 @@ void table_rows_and_groups::add_child_element(office_element_ptr & 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);
elm->add_child_element(child_element);
......
......@@ -25,6 +25,8 @@ namespace Oox2Odf
}
Converter::Converter(const std::wstring & path, std::wstring type)
{
impl_ = NULL;
if (type == L"text") impl_ = new DocxConverter(path);
if (type == L"spreadsheet") impl_ = new XlsxConverter(path);
}
......@@ -40,6 +42,7 @@ namespace Oox2Odf
}
void Converter::write(const std::wstring & path) const
{
if (!impl_)return;
return impl_->write(path);
}
......
......@@ -18,6 +18,9 @@ namespace cpdoccore
class length_or_percent;
class style_paragraph_properties;
class style_text_properties;
class color;
class length;
class text_align;
}
}
namespace OOX
......@@ -318,7 +321,7 @@ public:
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_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);
......
......@@ -835,6 +835,8 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Marker* marker, CAtlArray<OOX::S
odf_context()->chart_context()->start_data_point_series(1);
convert(dPt[i]->m_oSpPr.GetPointer());
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();
current_point = set_point+1;
......@@ -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));
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));
......@@ -1008,7 +1010,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_NumData *num_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;
std::vector<std::wstring> data;
......@@ -1021,6 +1023,6 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_StrData *str_data)
}
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
......@@ -56,29 +56,29 @@ OOX::CTheme* DocxConverter::oox_theme()
CString DocxConverter::find_link_by_id (CString sId, int type)
{
CString ref;
//if (type==1)
//{
// if (docx_current_drawing)
// {
// smart_ptr<OOX::File> oFile = docx_current_drawing->Find(sId);
// if (oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
// {
// OOX::Image* pImage = (OOX::Image*)oFile.operator->();
// ref = pImage->filename().GetPath();
// }
// }
// if (ref.GetLength() < 1 && oox_current_chart)
// {
// smart_ptr<OOX::File> oFile = oox_current_chart->Find(sId);
// if (oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
// {
// OOX::Image* pImage = (OOX::Image*)oFile.operator->();
// ref = pImage->filename().GetPath();
// }
// }
//}
if (type==1)
{
if (docx_document->GetDocument())
{
smart_ptr<OOX::File> oFile = docx_document->GetDocument()->Find(sId);
if (oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
ref = pImage->filename().GetPath();
}
}
if (ref.GetLength() < 1 && oox_current_chart)
{
smart_ptr<OOX::File> oFile = oox_current_chart->Find(sId);
if (oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
ref = pImage->filename().GetPath();
}
}
}
return ref;
}
......@@ -138,11 +138,6 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Logic::CRunProperty* pRProp= static_cast<OOX::Logic::CRunProperty*>(oox_unknown);
convert(pRProp);
}break;
case OOX::et_w_t:
{
OOX::Logic::CText* pText= static_cast<OOX::Logic::CText*>(oox_unknown);
convert(pText);
}break;
case OOX::et_mc_alternateContent:
{
OOX::Logic::CAlternateContent* pAltCont= static_cast<OOX::Logic::CAlternateContent*>(oox_unknown);
......@@ -173,35 +168,438 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
{
if (oox_paragraph == NULL) return;
bool styled = false;
odt_context->start_paragraph();
for ( int nIndex = 0; nIndex < oox_paragraph->m_arrItems.GetSize(); nIndex++ )
{
// Paragraph - -
switch(oox_paragraph->m_arrItems[nIndex]->getType())
{
case OOX::et_w_pPr:
{
styled = true;
OOX::Logic::CParagraphProperty* pPProp= static_cast<OOX::Logic::CParagraphProperty*>(oox_paragraph->m_arrItems[nIndex]);
odt_context->styles_context()->create_style(L"",odf::style_family::Paragraph, true, false, -1);
odf::style_paragraph_properties * paragraph_properties = odt_context->styles_context()->last_state().get_paragraph_properties();
//odf::style_text_properties * text_properties = odt_context->styles_context()->last_state().get_text_properties();
convert(pPProp, paragraph_properties/*, text_properties*/);
odt_context->text_context()->add_text_style(odt_context->styles_context()->last_state().get_office_element(),odt_context->styles_context()->last_state().get_name());
}break;
default:
convert(oox_paragraph->m_arrItems[nIndex]);
break;
}
}
odt_context->end_paragraph();
}
void DocxConverter::convert(OOX::Logic::CRun *oox_run)
void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 math 17.3.2.25
{
if (oox_run == NULL) return;
odt_context->start_run();
bool styled = false;
for(int i = 0; i < oox_run->m_arrItems.GetSize(); ++i)
{
// Run - -
switch(oox_run->m_arrItems[i]->getType())
{
case OOX::et_w_rPr:
{
styled = true;
OOX::Logic::CRunProperty* pRProp= static_cast<OOX::Logic::CRunProperty*>(oox_run->m_arrItems[i]);
odt_context->styles_context()->create_style(L"",odf::style_family::Text, true, false, -1);
odf::style_text_properties * text_properties = odt_context->styles_context()->last_state().get_text_properties();
convert(pRProp, text_properties);
odt_context->text_context()->add_text_style(odt_context->styles_context()->last_state().get_office_element(),odt_context->styles_context()->last_state().get_name());
}break;
case OOX::et_w_lastRenderedPageBreak:
{
odt_context->add_page_break();
}break;
case OOX::et_w_br:
{
odt_context->add_textline_break();
}break;
case OOX::et_w_t:
{
OOX::Logic::CText* pText= static_cast<OOX::Logic::CText*>(oox_run->m_arrItems[i]);
convert(pText);
}break;
case OOX::et_w_sym:
{
OOX::Logic::CSym* pSym= static_cast<OOX::Logic::CSym*>(oox_run->m_arrItems[i]);
convert(pSym);
}break;
case OOX::et_w_tab:
{
OOX::Logic::CTab* pTab= static_cast<OOX::Logic::CTab*>(oox_run->m_arrItems[i]);
convert(pTab);
}break;
case OOX::et_w_delText:
{
}break;
case OOX::et_w_separator:
case OOX::et_w_continuationSeparator:
{
}break;
//annotationRef
//endnoteRef
//endnoteReference
//footnoteRef
//footnoteReference
//commentReference
//separator
//contentPart
//cr
//dayLong, dayShort, monthLong, monthShort, yearLong, yearShort
//delText
//noBreakHyphen
//pgNum
//ptab
//ruby
//softHyphen
//delInstrText
//fldChar
//instrText
default:
convert(oox_run->m_arrItems[i]);
}
}
if (styled)
{
odt_context->text_context()->add_text_style(odt_context->styles_context()->last_state().get_office_element(),odt_context->styles_context()->last_state().get_name());
//
}
odt_context->end_run();
}
void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_prop)
void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf::style_paragraph_properties * paragraph_properties)
{
if (oox_paragraph_prop == NULL) return;
if (!oox_paragraph_pr) return;
if (!paragraph_properties) return;
if (oox_paragraph_pr->m_oSpacing.IsInit())
{
if (oox_paragraph_pr->m_oSpacing->m_oLine.IsInit())
{
_CP_OPT(odf::length) length;
convert(static_cast<SimpleTypes::CUniversalMeasure *>(oox_paragraph_pr->m_oSpacing->m_oLine.GetPointer()), length);
if (length) paragraph_properties->content().fo_line_height_ = odf::line_width(*length);
}
if (oox_paragraph_pr->m_oSpacing->m_oAfter.IsInit())
{
_CP_OPT(odf::length) length;
convert(static_cast<SimpleTypes::CUniversalMeasure *>(oox_paragraph_pr->m_oSpacing->m_oAfter.GetPointer()), length);
paragraph_properties->content().fo_margin_bottom_ = length;
}
if (oox_paragraph_pr->m_oSpacing->m_oBefore.IsInit())
{
_CP_OPT(odf::length) length;
convert(static_cast<SimpleTypes::CUniversalMeasure *>(oox_paragraph_pr->m_oSpacing->m_oBefore.GetPointer()), length);
paragraph_properties->content().fo_margin_top_ = length;
}
//nullable<SimpleTypes::COnOff<> > m_oAfterAutospacing;
//nullable<SimpleTypes::CDecimalNumber<> > m_oAfterLines;
//nullable<SimpleTypes::COnOff<> > m_oBeforeAutospacing;
//nullable<SimpleTypes::CDecimalNumber<> > m_oBeforeLines;
//nullable<SimpleTypes::CLineSpacingRule<> > m_oLineRule;
}
convert(oox_paragraph_pr->m_oJc.GetPointer(), paragraph_properties->content().fo_text_align_);
if (oox_paragraph_pr->m_oTextAlignment.IsInit() && oox_paragraph_pr->m_oTextAlignment->m_oVal.IsInit())
{
switch(oox_paragraph_pr->m_oTextAlignment->m_oVal->GetValue())
{
//case SimpleTypes::textalignAuto :
//case SimpleTypes::textalignBaseLine :
//case SimpleTypes::textalignBottom :
//case SimpleTypes::textalignCenter :
//case SimpleTypes::textalignTop :
}
}
//if (oox_paragraph_pr->m_oMarL.IsInit())
//{
// paragraph_properties->content().fo_margin_left_ = odf::length_or_percent(odf::length(oox_paragraph_pr->m_oMarL->ToCm(),odf::length::cm));
//}
//if (oox_paragraph_pr->m_oMarR.IsInit())
//{
// paragraph_properties->content().fo_margin_right_ = odf::length_or_percent(odf::length(oox_paragraph_pr->m_oMarR->ToCm(),odf::length::cm));
//}
//if (oox_paragraph_pr->m_oIndent.IsInit())
//{
// paragraph_properties->content().fo_text_indent_ = odf::length_or_percent(odf::length(oox_paragraph_pr->m_oIndent->ToCm(),odf::length::cm));
//}
//if (oox_paragraph_pr->m_oRtl.IsInit())
//{
//}
//m_oWordWrap
convert(oox_paragraph_pr->m_oPBdr.GetPointer(), paragraph_properties);
if (oox_paragraph_pr->m_oRPr.IsInit())// !!!
{
odf::style_text_properties * text_properties = odf_context()->text_context()->get_text_properties();
if (text_properties)
convert(oox_paragraph_pr->m_oRPr.GetPointer(), text_properties);
// family !!!
//convert(oox_paragraph_pr->m_oDefRunProperty.GetPointer());
//odf_context()->text_context()->set_parent_span_style(odf_context()->styles_context()->last_state().get_name());
}
//m_oSectPr
}
void DocxConverter::convert(OOX::Logic::CPBdr *oox_border, odf::style_paragraph_properties * paragraph_properties)
{
if (oox_border == NULL) return;
if (paragraph_properties == NULL) return;
std::wstring odf_border;
if (oox_border->m_oBottom.IsInit())
{
convert(oox_border->m_oBottom.GetPointer(), odf_border);
if (paragraph_properties && odf_border.length() >0 ) paragraph_properties->content().fo_border_bottom_ = odf_border;
}
if (oox_border->m_oTop.IsInit())
{
convert(oox_border->m_oTop.GetPointer(), odf_border);
if (paragraph_properties && odf_border.length() >0 ) paragraph_properties->content().fo_border_top_ = odf_border;
}
if (oox_border->m_oLeft.IsInit())
{
convert(oox_border->m_oLeft.GetPointer(), odf_border);
if (paragraph_properties && odf_border.length() >0 ) paragraph_properties->content().fo_border_left_ = odf_border;
}
if (oox_border->m_oRight.IsInit())
{
convert(oox_border->m_oRight.GetPointer(), odf_border);
if (paragraph_properties && odf_border.length() >0 ) paragraph_properties->content().fo_border_right_ = odf_border;
}
//if (oox_border->m_oTL2BR.IsInit())
//{
// convert(oox_border->m_oTL2BR.GetPointer(), odf_border);
// if (paragraph_properties && odf_border.length() >0 ) paragraph_properties->content().style_diagonal_tl_br_ = odf_border;
//}
}
void DocxConverter::convert(ComplexTypes::Word::CBorder *borderProp, std::wstring & odf_border_prop)
{
if (!borderProp)return;
std::wstring border_style;
std::wstring border_color;
//nullable<SimpleTypes::COnOff<> > m_oFrame;
//nullable<SimpleTypes::COnOff<> > m_oShadow;
//nullable<SimpleTypes::CPointMeasure<> > m_oSpace;
//nullable<SimpleTypes::CUcharHexNumber<> > m_oThemeShade;
if (borderProp->m_oSz.IsInit()) border_style = boost::lexical_cast<std::wstring>(borderProp->m_oSz->ToPoints()) + L"pt";
else border_style = L"1pt";
if (borderProp->m_oVal.IsInit())//266 styles oO
{
switch(borderProp->m_oVal->GetValue())
{
case SimpleTypes::bordervalueDotDash:
border_style += L" dashed";
break;
case SimpleTypes::bordervalueDashed:
border_style += L" dashed";
break;
case SimpleTypes::bordervalueDotted:
border_style += L" dotted";
break;
case SimpleTypes::bordervalueDouble:
border_style += L" double";
break;
case SimpleTypes::bordervalueSingle:
border_style += L" solid";
break;
case SimpleTypes::bordervalueNone:
border_style == L" none";
return;
break;
}
}else border_style += L" solid";
///////////////////////////////////////////////////////////////////
_CP_OPT(odf::color) color;
convert(borderProp->m_oColor.GetPointer(), borderProp->m_oThemeColor.GetPointer(), borderProp->m_oThemeTint.GetPointer(),borderProp->m_oThemeShade.GetPointer(), color);
if (color) border_color = color->get_hex_value();
else border_color = L"000000";
odf_border_prop = border_style + L" #" + border_color;
}
void DocxConverter::convert(ComplexTypes::Word::CJc * oox_jc, _CP_OPT(odf::text_align) & align)
{
if (oox_jc == NULL) return;
if (oox_jc->m_oVal.IsInit() == false) return;
switch(oox_jc->m_oVal->GetValue())
{
case SimpleTypes::jcBoth : align = odf::text_align(odf::text_align::Justify);break;
case SimpleTypes::jcCenter : align = odf::text_align(odf::text_align::Center); break;
case SimpleTypes::jcThaiDistribute :
case SimpleTypes::jcDistribute : align = odf::text_align(odf::text_align::Justify);break;
case SimpleTypes::jcEnd : align = odf::text_align(odf::text_align::End); break;
case SimpleTypes::jcHighKashida : break;
case SimpleTypes::jcLowKashida : break;
case SimpleTypes::jcMediumKashida : break;
case SimpleTypes::jcNumTab : break;
case SimpleTypes::jcStart : align = odf::text_align(odf::text_align::Start); break;
case SimpleTypes::jcLeft : align = odf::text_align(odf::text_align::Left); break;
case SimpleTypes::jcRight : align = odf::text_align(odf::text_align::Right); break;
}
}
void DocxConverter::convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf::length) & odf_size)
{
if (oox_size == NULL)return;
odf_size = odf::length(oox_size->ToPoints(), odf::length::pt);
}
void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_prop)
void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf::style_text_properties * text_properties)
{
if (oox_run_prop == NULL) return;
if (oox_run_pr == NULL) return;
if (text_properties == NULL)return;
if (oox_run_pr->m_oBold.IsInit())
{
if (oox_run_pr->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);
}
convert(oox_run_pr->m_oColor.GetPointer(),text_properties->content().fo_color_);
text_properties->content().style_text_underline_type_= odf::line_type(odf::line_type::None);
if (oox_run_pr->m_oU.IsInit())
{
text_properties->content().style_text_underline_style_ = odf::line_style(odf::line_style::Solid);
text_properties->content().style_text_underline_type_= odf::line_type(odf::line_type::Single);
if (oox_run_pr->m_oU->m_oVal.IsInit())
{
SimpleTypes::EUnderline type = oox_run_pr->m_oU->m_oVal->GetValue();
text_properties->content().style_text_underline_type_= odf::line_type(odf::line_type::Single);
switch(type)
{
case SimpleTypes::underlineDouble :
text_properties->content().style_text_underline_type_= odf::line_type(odf::line_type::Double);break;
case SimpleTypes::underlineNone :
text_properties->content().style_text_underline_type_= odf::line_type(odf::line_type::None);break;
case SimpleTypes::underlineDash :
case SimpleTypes::underlineDashedHeavy :
text_properties->content().style_text_underline_style_= odf::line_style(odf::line_style::Dash);break;
case SimpleTypes::underlineDashLong :
case SimpleTypes::underlineDashLongHeavy :
text_properties->content().style_text_underline_style_= odf::line_style(odf::line_style::LongDash);break;
case SimpleTypes::underlineDotDash :
case SimpleTypes::underlineDashDotHeavy :
text_properties->content().style_text_underline_style_= odf::line_style(odf::line_style::DotDash);break;
case SimpleTypes::underlineDotted :
case SimpleTypes::underlineDottedHeavy :
text_properties->content().style_text_underline_style_= odf::line_style(odf::line_style::Dotted);break;
case SimpleTypes::underlineDotDotDash :
case SimpleTypes::underlineDashDotDotHeavy :
text_properties->content().style_text_underline_style_= odf::line_style(odf::line_style::DotDotDash);break;
case SimpleTypes::underlineThick :
case SimpleTypes::underlineWave :
case SimpleTypes::underlineWavyDouble :
case SimpleTypes::underlineWavyHeavy :
text_properties->content().style_text_underline_style_= odf::line_style(odf::line_style::Wave);break;
}
}
text_properties->content().style_text_underline_color_ = odf::underline_color(odf::underline_color::FontColor);
}
if (oox_run_pr->m_oItalic.IsInit())
{
if (oox_run_pr->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 (oox_run_pr->m_oSz.IsInit() && oox_run_pr->m_oSz->m_oVal.IsInit())
{
OoxConverter::convert(oox_run_pr->m_oSz->m_oVal->ToPoints(), text_properties->content().fo_font_size_);
}
if (oox_run_pr->m_oCaps.IsInit() && oox_run_pr->m_oCaps->m_oVal.ToBool())
text_properties->content().fo_text_transform_ = odf::text_transform(odf::text_transform::Uppercase);
if (oox_run_pr->m_oSmallCaps.IsInit() && oox_run_pr->m_oSmallCaps->m_oVal.ToBool())
text_properties->content().fo_font_variant_ = odf::font_variant(odf::font_variant::SmallCaps);
if (oox_run_pr->m_oRFonts.IsInit())
{
if (oox_run_pr->m_oRFonts->m_sAscii.IsInit())
text_properties->content().fo_font_family_ = string2std_string(oox_run_pr->m_oRFonts->m_sAscii.get());
if (oox_run_pr->m_oRFonts->m_sCs.IsInit())
text_properties->content().style_font_family_complex_ = string2std_string(oox_run_pr->m_oRFonts->m_sCs.get());
if (oox_run_pr->m_oRFonts->m_sEastAsia.IsInit())
text_properties->content().style_font_family_asian_= string2std_string(oox_run_pr->m_oRFonts->m_sEastAsia.get());
//nullable<CString > m_sAscii;
//nullable<SimpleTypes::CTheme<>> m_oAsciiTheme;
//nullable<SimpleTypes::CTheme<>> m_oCsTheme;
//nullable<CString > m_sEastAsia;
//nullable<SimpleTypes::CTheme<>> m_oEastAsiaTheme;
//nullable<CString > m_sHAnsi;
//nullable<SimpleTypes::CTheme<>> m_oHAnsiTheme;
//nullable<SimpleTypes::CHint<> > m_oHint;
}
if (oox_run_pr->m_oVertAlign.IsInit() && oox_run_pr->m_oVertAlign->m_oVal.IsInit())
{
switch(oox_run_pr->m_oVertAlign->m_oVal->GetValue())
{
case SimpleTypes::verticalalignrunSuperscript:
//text_properties->content().style_text_position_ = odf::text_position(odf::text_position::Super); break;
text_properties->content().style_text_position_ = odf::text_position(+33.); break;
case SimpleTypes::verticalalignrunSubscript:
//text_properties->content().style_text_position_ = odf::text_position(odf::text_position::Sub); break;
text_properties->content().style_text_position_ = odf::text_position(-33.); break;// 58% -
}
}
if (oox_run_pr->m_oW.IsInit() && oox_run_pr->m_oW->m_oVal.IsInit())
{
text_properties->content().style_text_scale_ = odf::percent(oox_run_pr->m_oW->m_oVal->GetValue());
}
if (oox_run_pr->m_oStrike.IsInit())
text_properties->content().style_text_line_through_type_ = odf::line_type(odf::line_type::Single);
if (oox_run_pr->m_oBdr.IsInit())
{
std::wstring odf_border;
convert(oox_run_pr->m_oBdr.GetPointer(), odf_border);
if (odf_border.length() > 0)
text_properties->content().common_border_attlist_.fo_border_ = odf_border;
}
if (oox_run_pr->m_oHighlight.IsInit() && oox_run_pr->m_oHighlight->m_oVal.IsInit())
{
BYTE ucR = oox_run_pr->m_oHighlight->m_oVal->Get_R();
BYTE ucB = oox_run_pr->m_oHighlight->m_oVal->Get_B();
BYTE ucG = oox_run_pr->m_oHighlight->m_oVal->Get_G();
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
if (oRgbColor)
{
text_properties->content().fo_background_color_ = odf::color(std::wstring(L"#") + string2std_string(oRgbColor->ToString().Right(6)));
delete oRgbColor;
}
}
if (oox_run_pr->m_oShd.IsInit())
{
_CP_OPT(odf::color) odf_color;
convert(oox_run_pr->m_oShd->m_oFill.GetPointer(), oox_run_pr->m_oShd->m_oThemeFill.GetPointer(),
oox_run_pr->m_oShd->m_oThemeFillTint.GetPointer(), oox_run_pr->m_oShd->m_oThemeShade.GetPointer(), odf_color);
if (odf_color)
text_properties->content().fo_background_color_ = *odf_color;
}
}
void DocxConverter::convert(OOX::Logic::CText *oox_text)
{
if (oox_text == NULL) return;
......@@ -431,13 +829,18 @@ void DocxConverter::convert(OOX::Logic::CShape *oox_shape)
OoxConverter::convert(oox_shape->m_oCNvPr.GetPointer());
//
OoxConverter::convert(oox_shape->m_oCNvSpPr.GetPointer());
OoxConverter::convert(oox_shape->m_oCNvConnSpPr.GetPointer());
if (oox_shape->m_oCNvConnSpPr.IsInit())
{
OoxConverter::convert(oox_shape->m_oCNvConnSpPr.GetPointer());
// .. :)
odf_context()->drawing_context()->start_area_properies();
odf_context()->drawing_context()->set_no_fill();
odf_context()->drawing_context()->end_area_properies();
}
if (oox_shape->m_oTxBody.IsInit() && oox_shape->m_oTxBody->m_oTxtbxContent.IsInit())
{
odt_context->start_text_context();
odt_context->text_context()->set_single_object(true, NULL, NULL);
for (long i=0 ; i < oox_shape->m_oTxBody->m_oTxtbxContent->m_arrItems.GetSize();i++)
{
convert(oox_shape->m_oTxBody->m_oTxtbxContent->m_arrItems[i]);
......@@ -451,4 +854,82 @@ void DocxConverter::convert(OOX::Logic::CShape *oox_shape)
odt_context->drawing_context()->end_drawing();
}
void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
SimpleTypes::CThemeColor<> *theme_color,
SimpleTypes::CUcharHexNumber<> *theme_tint,
SimpleTypes::CUcharHexNumber<> *theme_shade, _CP_OPT(odf::color) & odf_color)
{
odf_color = boost::none;
unsigned char ucA=0, ucR=0, ucG=0, ucB=0;
bool result = false;
if(color)//easy, faster,realy !!
{
ucR = color->Get_R();
ucB = color->Get_B();
ucG = color->Get_G();
ucA = color->Get_A();
result = true;
}
if(theme_color)
{
OOX::CTheme * docx_theme= docx_document->GetTheme();
int theme_ind = theme_color->GetValue();
switch(theme_ind)
{
case SimpleTypes::themecolorLight1:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oLt1.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorLight2:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oLt2.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorDark1:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oDk1.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorDark2:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oDk2.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorAccent1:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oAccent1.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorAccent2:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oAccent2.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorAccent3:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oAccent3.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorAccent4:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oAccent4.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorAccent5:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oAccent5.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorAccent6:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oAccent6.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorFollowedHyperlink:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oFolHlink.tryGetRgb(ucR, ucG, ucB, ucA); break;
case SimpleTypes::themecolorHyperlink:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oHlink.tryGetRgb(ucR, ucG, ucB, ucA); break;
}
}
if (result == true)
{
if ((theme_tint) && (theme_tint->GetValue() > 0))
{
ucR = theme_tint->GetValue() * 0xff + (1. - theme_tint->GetValue()) * ucR;
ucG = theme_tint->GetValue() * 0xff + (1. - theme_tint->GetValue()) * ucG;
ucB = theme_tint->GetValue() * 0xff + (1. - theme_tint->GetValue()) * ucB;
}
if ((theme_tint) && (theme_tint->GetValue() < 0))
{
ucR = -theme_tint->GetValue() * 0x00 + (1. + theme_tint->GetValue()) * ucR;
ucG = -theme_tint->GetValue() * 0x00 + (1. + theme_tint->GetValue()) * ucG;
ucB = -theme_tint->GetValue() * 0x00 + (1. + theme_tint->GetValue()) * ucB;
}
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
if (oRgbColor)
{
odf_color = odf::color(std::wstring(L"#") + string2std_string(oRgbColor->ToString().Right(6)));
delete oRgbColor;
}
}
}
void DocxConverter::convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf::color) & odf_color)
{
if (!color)return;
convert(color->m_oVal.GetPointer(), color->m_oThemeColor.GetPointer(),color->m_oThemeTint.GetPointer(),color->m_oThemeShade.GetPointer(), odf_color);
}
}
\ No newline at end of file
......@@ -2,6 +2,12 @@
#include "Converter.h"
#include <boost/foreach.hpp>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>
#include <Common/SimpleTypes_Word.h>
namespace OOX
{
class CDocx;
......@@ -18,9 +24,20 @@ namespace OOX
class CDrawing;
class CGroupShape;
class CShape;
class CPBdr;
}
}
}
namespace ComplexTypes
{
namespace Word
{
class CColor;
class CJc;
class CBorder;
class CShading;
}
}
namespace cpdoccore
{
namespace odf
......@@ -34,6 +51,7 @@ namespace cpdoccore
class odt_conversion_context;
}
}
using namespace cpdoccore;
namespace Oox2Odf
......@@ -64,8 +82,8 @@ namespace Oox2Odf
void convert(OOX::Logic::CParagraph *oox_paragraph);
void convert(OOX::Logic::CRun *oox_run);
void convert(OOX::Logic::CParagraphProperty *oox_paragraph_prop);
void convert(OOX::Logic::CRunProperty *oox_run_prop);
void convert(OOX::Logic::CParagraphProperty *oox_paragraph_prop, odf::style_paragraph_properties *paragraph_properties);
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::CAlternateContent *oox_alt_content);
void convert(OOX::Logic::CDrawing *oox_drawing);
......@@ -76,6 +94,15 @@ namespace Oox2Odf
void convert(OOX::Logic::CShape *oox_shape);
void convert(OOX::Drawing::CChart *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
}
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);
}
else if (rot == 0xff)//
cell_properties->style_table_cell_properties_attlist_.style_direction_ = odf::direction(odf::direction::Ttb);
}
if(aligment->m_oHorizontal.IsInit())
{
switch(aligment->m_oHorizontal->GetValue())
......
......@@ -88,10 +88,8 @@ namespace odf
}
class odf_conversion_context;
class ods_conversion_context;
class color;
class background_color;
class font_size;
class length;
}
}
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//82
#define INTVER 1,2,0,82
#define STRVER "1,2,0,82\0"
//85
#define INTVER 1,2,0,85
#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