Commit 54b78e8e authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - convert math elements in sheets & slides

parent a50fdbe6
......@@ -75,7 +75,7 @@ docx_conversion_context::docx_conversion_context(odf_reader::odf_document * OdfD
delayed_converting_ (false),
process_headers_footers_(false),
process_comment_ (false),
process_math_formula_ (false),
math_context_ (false),
odf_document_ (OdfDocument)
{
streams_man_ = streams_man::create(temp_stream_);
......@@ -187,15 +187,17 @@ void docx_conversion_context::finish_run()
}
void docx_conversion_context::start_math_formula()
{
process_math_formula_ = true;
output_stream() << L"<m:oMath>";
math_context_.start();
}
void docx_conversion_context::end_math_formula()
{
output_stream() << L"</m:oMath>";
process_math_formula_ = false;
std::wstring math_content = math_context_.end();
if (!math_content.empty())
{
output_stream() << L"<m:oMath>" << math_content << L"</m:oMath>";
}
}
void docx_conversion_context::start_chart(std::wstring name)
......
......@@ -56,22 +56,21 @@ namespace cpdoccore {
class style_ref;
class length_or_percent;
}
namespace odf_reader
{
class style_instance;
class odf_document;
class style_text_properties;
class draw_frame;
class draw_shape;
typedef boost::shared_ptr<style_text_properties> style_text_properties_ptr;
class office_element;
class style_columns;
namespace text{
class note_citation;
}
}
namespace odf_reader
{
class style_instance;
class odf_document;
class style_text_properties;
class draw_frame;
class draw_shape;
class office_element;
class style_columns;
namespace text
{
class note_citation;
}
}
namespace oox {
......@@ -571,7 +570,8 @@ public:
void push_text_properties(const odf_reader::style_text_properties * TextProperties);
void pop_text_properties();
odf_reader::style_text_properties_ptr current_text_properties();
odf_reader::style_text_properties_ptr current_text_properties();
void set_page_break_after(bool val);
bool get_page_break_after();
......@@ -606,9 +606,9 @@ public:
std::wstring find_list_rename(const std::wstring & ListStyleName) const;
drawing_context & get_drawing_context() { return drawing_context_; }
comments_context & get_comments_context() {return comments_context_;}
drawing_context & get_drawing_context() { return drawing_context_; }
comments_context & get_comments_context() { return comments_context_; }
math_context & get_math_context() { return math_context_; }
void docx_convert_delayed();
void add_delayed_element(odf_reader::office_element * Elm);
......@@ -646,8 +646,7 @@ public:
void start_math_formula();
void end_math_formula();
bool process_math_formula_;
void set_process_headers_footers(bool Val) { process_headers_footers_ = Val; }
headers_footers & get_headers_footers() { return headers_footers_; }
header_footer_context & get_header_footer_context() { return header_footer_context_; }
......@@ -682,7 +681,8 @@ private:
hyperlinks hyperlinks_;
mediaitems mediaitems_;
styles_context styles_context_;
styles_context styles_context_;
math_context math_context_;
std::wstring automatic_parent_style_;
......
......@@ -49,7 +49,7 @@ struct _rect
struct drawing_object_description
{
oox::RelsType type_;
oox::RelsType type_;
std::wstring name_;
_CP_OPT(_rect) svg_rect_;
......
......@@ -39,6 +39,7 @@
#include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/odfcontext.h"
#include "../odf/style_text_properties.h"
namespace cpdoccore {
......@@ -78,11 +79,6 @@ std::wstringstream & styles_context::text_style()
return text_style_;
}
std::wstringstream & styles_context::math_text_style()
{
return math_text_style_;
}
std::wstringstream & styles_context::paragraph_nodes()
{
return paragraph_nodes_;
......@@ -135,5 +131,32 @@ void styles_context::docx_serialize_table_style(std::wostream & strm)
}
}
}
namespace oox
{
math_context::math_context(bool graphic) : base_font_size_(12)
{
graphRPR_ = graphic;
if (graphRPR_) nsRPr_ = L"a:rPr";
else nsRPr_ = L"w:rPr";
}
void math_context::start()
{
text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties());
text_properties_->content().style_font_name_ = L"Cambria Math";
text_properties_->content().fo_font_size_ = odf_types::length(base_font_size_, odf_types::length::pt);
}
std::wstring math_context::end()
{
std::wstring math = math_stream_.str();
math_stream_.str( std::wstring() );
math_stream_.clear();
return math;
}
}
}
\ No newline at end of file
......@@ -40,8 +40,11 @@
namespace cpdoccore {
namespace odf_reader{
class style_instance;
namespace odf_reader
{
class style_instance;
class style_text_properties;
typedef boost::shared_ptr<style_text_properties> style_text_properties_ptr;
};
class styles_context : boost::noncopyable
......@@ -54,7 +57,6 @@ public:
std::wstringstream & paragraph_attr();
std::wstringstream & table_style();
std::wstringstream & list_style();
std::wstringstream & math_text_style();
void docx_serialize_text_style(std::wostream & strm, std::wstring parenStyleId);
void docx_serialize_table_style(std::wostream & strm);
......@@ -65,7 +67,8 @@ public:
std::wstring & hlinkClick(){return hlinkClick_;}
const odf_reader::style_instance * get_current_processed_style() const { return current_processed_style_; }
void start_process_style(const odf_reader::style_instance * Instance);
void start_process_style(const odf_reader::style_instance * Instance);
void end_process_style();
private:
......@@ -79,12 +82,32 @@ private:
std::wstringstream paragraph_nodes_;
std::wstringstream paragraph_attr_;
std::wstringstream table_style_;
std::wstringstream math_text_style_;
};
namespace oox {
class math_context : boost::noncopyable
{
public:
math_context(bool graphic = false);
void start();
std::wstring end();
std::wostream & output_stream() { return math_stream_; }
std::wstringstream & math_style_stream() { return math_style_stream_; }
int base_font_size_;
odf_reader::style_text_properties_ptr text_properties_;
std::wstring nsRPr_;
bool graphRPR_;
private:
std::wstringstream math_stream_;
std::wstringstream math_style_stream_;
};
}
}
......
......@@ -68,6 +68,7 @@ pptx_conversion_context::pptx_conversion_context( odf_reader::odf_document * odf
,pptx_table_context_(*this)
,pptx_comments_context_(comments_context_handle_)
,pptx_slide_context_(*this/*, pptx_text_context_*/)
,math_context_(true)
,last_idx_placeHolder(1)
,last_uniq_big_id(1)
{
......
......@@ -113,10 +113,11 @@ public:
pptx_xml_theme & current_theme();
pptx_xml_presentation & current_presentation();//собственно она одна
oox_chart_context & current_chart();
pptx_text_context & get_text_context() { return pptx_text_context_; }
oox_chart_context & current_chart();
math_context & get_math_context() { return math_context_; }
pptx_text_context & get_text_context() { return pptx_text_context_; }
pptx_table_context & get_table_context(){return pptx_table_context_;}
pptx_table_context & get_table_context() { return pptx_table_context_; }
mediaitems & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
......@@ -146,6 +147,7 @@ private:
pptx_text_context pptx_text_context_;
pptx_table_context pptx_table_context_;
pptx_comments_context pptx_comments_context_;
math_context math_context_;
std::vector<oox_chart_context_ptr> charts_;
......
......@@ -565,7 +565,7 @@ void pptx_slide_context::process_shapes()
if (iPlaceHolderIdx) drawing.place_holder_idx_ = *iPlaceHolderIdx;
}
drawing.sub_type = pic.type_;
drawing.sub_type = pic.shape_type_;
impl_->add_drawing(drawing, isMediaInternal, rId, ref, typeShape);
}
......
......@@ -33,7 +33,6 @@
#include "xlsx_drawings.h"
#include "xlsx_drawing.h"
#include <boost/foreach.hpp>
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
......@@ -51,26 +50,26 @@ public:
xlsx_drawings_.push_back(d);
bool present = false;
BOOST_FOREACH(_rel const & r, xlsx_drawing_rels_)
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (r.rid == rid && r.ref == ref)
if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
present = true;
}
if (!present)
{
xlsx_drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
}
BOOST_FOREACH(_hlink_desc h, d.hlinks)
for (int i = 0 ; i < d.hlinks.size(); i++)
{
xlsx_drawing_rels_.push_back(_rel(false, h.hId, h.hRef, typeHyperlink));
xlsx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
}
}
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type)
{
bool present = false;
BOOST_FOREACH(_rel const & r, xlsx_drawing_rels_)
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (r.rid == rid && r.ref == ref)
if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
present = true;
}
if (!present)
......@@ -85,9 +84,9 @@ public:
{
if (inGroup)
{
BOOST_FOREACH(_xlsx_drawing & d, xlsx_drawings_)
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
{
xlsx_serialize(strm, d);
xlsx_serialize(strm, xlsx_drawings_[i]);
}
}
else
......@@ -100,9 +99,9 @@ public:
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
BOOST_FOREACH(_xlsx_drawing & d, xlsx_drawings_)
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
{
xlsx_serialize(CP_XML_STREAM(), d);
xlsx_serialize(CP_XML_STREAM(), xlsx_drawings_[i]);
}
}
}
......@@ -116,34 +115,34 @@ public:
void dump_rels(rels & Rels)
{
BOOST_FOREACH(_rel const & r, xlsx_drawing_rels_)
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (r.type == typeChart)
if (xlsx_drawing_rels_[i].type == typeChart)
{
Rels.add(relationship(
r.rid,
utils::media::get_rel_type(r.type),
(r.is_internal ? std::wstring(L"../") + r.ref : r.ref),
(r.is_internal ? L"" : L"External")
xlsx_drawing_rels_[i].rid,
utils::media::get_rel_type(xlsx_drawing_rels_[i].type),
(xlsx_drawing_rels_[i].is_internal ? std::wstring(L"../") + xlsx_drawing_rels_[i].ref : xlsx_drawing_rels_[i].ref),
(xlsx_drawing_rels_[i].is_internal ? L"" : L"External")
)
);
}
else if (r.type == typeImage)
else if (xlsx_drawing_rels_[i].type == typeImage)
{
Rels.add(relationship(
r.rid,
utils::media::get_rel_type(r.type),
r.is_internal ? std::wstring(L"../") + r.ref : r.ref,
(r.is_internal ? L"" : L"External")
xlsx_drawing_rels_[i].rid,
utils::media::get_rel_type(xlsx_drawing_rels_[i].type),
xlsx_drawing_rels_[i].is_internal ? std::wstring(L"../") + xlsx_drawing_rels_[i].ref : xlsx_drawing_rels_[i].ref,
(xlsx_drawing_rels_[i].is_internal ? L"" : L"External")
)
);
}
else if (r.type == typeHyperlink)
else if (xlsx_drawing_rels_[i].type == typeHyperlink)
{
Rels.add(relationship(
r.rid,
xlsx_drawing_rels_[i].rid,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
r.ref,
xlsx_drawing_rels_[i].ref,
L"External")
);
}
......
......@@ -66,6 +66,7 @@ xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfD
num_format_context_ (odf_document_->odf_context()),
xlsx_text_context_ (odf_document_->odf_context().styleContainer()),
xlsx_table_context_ (this, xlsx_text_context_),
math_context_ (true),
xlsx_style_ (this),
maxDigitSize_ (std::pair<float,float>(-1.0, -1.0) ),
......@@ -100,13 +101,10 @@ void xlsx_conversion_context::start_chart(std::wstring name)
//добавляем новую форму для диаграммы
//в ней будет информационная часть - и она пишется каждый раз в свою xml (их - по числу диаграмм)
//этот контекст нужно передавать в файл
}
void xlsx_conversion_context::end_chart()
{
//current_chart().set_drawing_link(current_sheet().get_drawing_link());
//излишняя инфа
}
void xlsx_conversion_context::start_document()
......@@ -117,7 +115,7 @@ void xlsx_conversion_context::start_document()
instances.push_back(odfContext.styleContainer().style_default_by_type(odf_types::style_family::TableCell));
instances.push_back(odfContext.styleContainer().style_by_name(L"Default",odf_types::style_family::TableCell,false));
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
odf_reader::text_format_properties_content textFormatProperties = calc_text_properties_content(instances);
odf_reader::paragraph_format_properties parFormatProperties = calc_paragraph_properties_content(instances);
odf_reader::style_table_cell_properties_attlist cellFormatProperties = calc_table_cell_properties(instances);
......
......@@ -83,7 +83,7 @@ public:
void start_chart(std::wstring name);
void end_chart();
void start_body();
void end_body();
......@@ -164,6 +164,7 @@ public:
xlsx_xml_worksheet & current_sheet();
oox_chart_context & current_chart();
math_context & get_math_context() { return math_context_; }
num_format_context & get_num_format_context() { return num_format_context_; }
size_t get_default_cell_style() const { return default_style_; }
xlsx_defined_names & get_xlsx_defined_names() { return xlsx_defined_names_; }
......@@ -197,6 +198,7 @@ private:
xlsx_defined_names xlsx_defined_names_;
xlsx_table_context xlsx_table_context_;
xlsx_text_context xlsx_text_context_;
math_context math_context_;
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
xlsx_comments_context_handle xlsx_comments_context_handle_;
......
......@@ -43,6 +43,11 @@
#include "office_binary_data.h"
#include "math_elements.h"
#include "math_elementaries.h"
#include "math_token_elements.h"
#include "math_table_elements.h"
#include "math_limit_elements.h"
#include "math_layout_elements.h"]
#include "text_elements.h"
#include "list.h"
......
......@@ -96,7 +96,7 @@ chart::class_type static get_series_class_type(std::wstring const & str)
}
class chart_build
class object_odf_context
{
public:
struct _cell
......@@ -106,20 +106,20 @@ public:
std::wstring val;
};
chart_build(std::wstring ref) :
width_pt_(0),
height_pt_(0),
in_axis_(false),
current_table_column_(0),
current_table_row_(0),
columns_spanned_num_(0),
//target_table_(0/*targetTable*/),
columns_count_(0),
object_type_(0),
office_text_(NULL),
office_math_(NULL),
baseRef_(ref),
baseFontHeight_(12)
object_odf_context(std::wstring ref)
:
width_pt_ (0),
height_pt_ (0),
in_axis_ (false),
current_table_column_ (0),
current_table_row_ (0),
columns_spanned_num_ (0),
columns_count_ (0),
object_type_ (0),
office_text_ (NULL),
office_math_ (NULL),
baseRef_ (ref),
baseFontHeight_ (12)
{
}
......@@ -150,23 +150,23 @@ public:
void xlsx_convert (oox::xlsx_conversion_context & Context);
void docx_convert (oox::docx_conversion_context & Context);
void oox_convert (oox::oox_chart_context & chart);
void pptx_convert (oox::pptx_conversion_context & Context);
void oox_convert (oox::oox_chart_context & chart);
double width_pt_;
double height_pt_;
double width_pt_;
double height_pt_;
int object_type_;
office_text *office_text_;
office_math *office_math_;
int object_type_;
office_text *office_text_;
office_math *office_math_;
int baseFontHeight_;
std::wstring baseRef_;
int baseFontHeight_;
std::wstring baseRef_;
//---------------------------------------------------------------
std::wstring str_class_;
chart::class_type class_;
std::wstring style_name_;
std::wstring name_;
std::wstring str_class_;
chart::class_type class_;
std::wstring style_name_;
std::wstring name_;
bool in_axis_;
std::vector<chart::axis> axises_;
......@@ -192,7 +192,7 @@ public:
std::vector<_property> chart_graphic_properties_;
oox::_oox_fill chart_fill_;
std::vector<_cell> cash_values;
std::vector<_cell> cash_values;
//---------------------------------------
std::wstring target_table_;
......@@ -213,61 +213,62 @@ public:
};
// Класс для обхода всех элеменов office:object для построения диаграммы
class process_build_chart : public base_visitor,
public const_visitor<office_document_content>,
public visitor<office_document_content>,
public visitor<office_body>,
public visitor<office_chart>,
public visitor<office_text>,
public visitor<office_math>,
public const_visitor<chart_chart>,
public const_visitor<chart_title>,
public const_visitor<chart_subtitle>,
public const_visitor<chart_footer>,
public const_visitor<chart_legend>,
public const_visitor<chart_plot_area>,
public const_visitor<chart_axis>,
public const_visitor<chart_categories>,
public const_visitor<chart_grid>,
public const_visitor<chart_series>,
public const_visitor<chart_domain>,
public const_visitor<chart_data_point>,
public const_visitor<chart_mean_value>,
public const_visitor<chart_regression_curve>,
public const_visitor<chart_equation>,
public const_visitor<chart_error_indicator>,
public const_visitor<chart_wall>,
public const_visitor<chart_floor>,
public const_visitor<table_table>,
public const_visitor<table_table_row_group>,
public const_visitor<table_rows_no_group>,
public const_visitor<table_table_header_rows>,
public const_visitor<table_table_rows>,
public const_visitor<table_table_row>,
public visitor<table_table_rows>,
public visitor<table_table_header_rows>,
public const_visitor<table_table_cell>,
public const_visitor<table_covered_table_cell>,
public const_visitor<table_table_column_group>,
public visitor<table_table_header_columns>,
public visitor<table_table_columns>,
public const_visitor<table_table_column>,
public const_visitor<table_columns_no_group>
class process_build_object
: public base_visitor,
public const_visitor<office_document_content>,
public visitor<office_document_content>,
public visitor<office_body>,
public visitor<office_chart>,
public visitor<office_text>,
public visitor<office_math>,
public const_visitor<chart_chart>,
public const_visitor<chart_title>,
public const_visitor<chart_subtitle>,
public const_visitor<chart_footer>,
public const_visitor<chart_legend>,
public const_visitor<chart_plot_area>,
public const_visitor<chart_axis>,
public const_visitor<chart_categories>,
public const_visitor<chart_grid>,
public const_visitor<chart_series>,
public const_visitor<chart_domain>,
public const_visitor<chart_data_point>,
public const_visitor<chart_mean_value>,
public const_visitor<chart_regression_curve>,
public const_visitor<chart_equation>,
public const_visitor<chart_error_indicator>,
public const_visitor<chart_wall>,
public const_visitor<chart_floor>,
public const_visitor<table_table>,
public const_visitor<table_table_row_group>,
public const_visitor<table_rows_no_group>,
public const_visitor<table_table_header_rows>,
public const_visitor<table_table_rows>,
public const_visitor<table_table_row>,
public visitor<table_table_rows>,
public visitor<table_table_header_rows>,
public const_visitor<table_table_cell>,
public const_visitor<table_covered_table_cell>,
public const_visitor<table_table_column_group>,
public visitor<table_table_header_columns>,
public visitor<table_table_columns>,
public const_visitor<table_table_column>,
public const_visitor<table_columns_no_group>
{
public:
process_build_chart(chart_build & chartBuild, odf_read_context & context);
process_build_object(object_odf_context & object_context, odf_read_context & context);
private:
void ApplyChartProperties(std::wstring style,std::vector<_property> & propertiesOut);
......@@ -331,7 +332,7 @@ public:
private:
bool stop_;
chart_build & chart_build_;
object_odf_context & object_odf_context_;
styles_container & styles_;
......
......@@ -1421,14 +1421,14 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
//функциональная часть
office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
draw_frame *frame = NULL;
chart_build objectBuild(href);
object_odf_context objectBuild(href);
//if (!contentSubDoc)//Diagramma.odt - кривые ссылки на объекты
// return;
if (contentSubDoc)
{
process_build_chart process_build_object_(objectBuild, objectSubDoc.odf_context());
process_build_object process_build_object_(objectBuild, objectSubDoc.odf_context());
contentSubDoc->accept(process_build_object_);
objectBuild.docx_convert(Context);
......@@ -1491,6 +1491,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
if (in_frame)
{
drawing.additional.push_back(_property(L"fit-to-size", true));
drawing.additional.push_back(_property(L"text-content", std::wstring(L"<w:p><m:oMathPara><m:oMathParaPr/>") +
content + std::wstring(L"</m:oMathPara></w:p>")));
Context.set_run_state(false);
......
......@@ -291,7 +291,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
//пример RemanejamentoOrcamentario.ods
///////////////////////////////////////////////////////////////////////////
//функциональная часть
const office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
if (!contentSubDoc)
{
//здесь другой формат xml (не Open Office)
......@@ -301,9 +301,9 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
}
chart_build objectBuild(href);
object_odf_context objectBuild(href);
process_build_chart process_build_object_(objectBuild, objectSubDoc.odf_context());
process_build_object process_build_object_(objectBuild, objectSubDoc.odf_context());
contentSubDoc->accept(process_build_object_);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -336,6 +336,28 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
}
Context.get_slide_context().end_shape();
}
else if (objectBuild.object_type_ == 3) //мат формулы
{
Context.get_slide_context().start_shape(2);
objectBuild.pptx_convert(Context);
std::wstring math_content = Context.get_math_context().end();
if (!math_content.empty())
{
std::wstring text_content = L"<a:p><a14:m xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\">";
text_content += L"<m:oMathPara xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\">";
text_content += L"<m:oMathParaPr/>";
text_content += L"<m:oMath xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\">";
text_content += math_content;
text_content += L"</m:oMath></m:oMathPara></a14:m></a:p>";
Context.get_slide_context().set_property(_property(L"fit-to-size", true));
Context.get_slide_context().set_property(_property(L"text-content", text_content));
}
Context.get_slide_context().end_shape();
}
else
{
//временно - замещающая картинка(если она конечно присутствует)
......
......@@ -253,7 +253,7 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
{
try {
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
const std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
odf_reader::odf_document * odf_reader = Context.root();
......@@ -268,18 +268,18 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
//в отдельных embd объектах чаще всего диаграммы... но МОГУТ быть и обычные объекты подтипа frame!!! пример RemanejamentoOrcamentario.ods
///////////////////////////////////////////////////////////////////////////
//функциональная часть
const office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
chart_build objectBuild(href);
office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
object_odf_context objectBuild(href);
if (contentSubDoc)
{
process_build_chart process_build_object_(objectBuild, objectSubDoc.odf_context());
process_build_object process_build_object_(objectBuild, objectSubDoc.odf_context());
contentSubDoc->accept(process_build_object_);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//отображательная часть
if (objectBuild.object_type_ == 1)//диаграмма
if (objectBuild.object_type_ == 1) //диаграмма
{
const std::wstring href_draw = common_xlink_attlist_.href_.get_value_or(L"");
objectBuild.xlsx_convert(Context);
......@@ -287,7 +287,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_drawing_context().start_chart(href_draw); // в рисовательной части только место объекта, рамочки ... и релсы
Context.get_drawing_context().end_chart();
}
else if (objectBuild.object_type_ == 2)//текст (odt text)
else if (objectBuild.object_type_ == 2) //текст (odt text)
{
Context.get_drawing_context().start_shape(2);
Context.get_text_context().start_drawing_content();
......@@ -297,15 +297,37 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
objectBuild.xlsx_convert(Context);
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
std::wstring text_content = Context.get_text_context().end_drawing_content();
Context.get_text_context().set_local_styles_container(NULL);//вытираем вручную ...
if (text_content_.length()>0)
if (!text_content.empty())
{
Context.get_drawing_context().set_property(_property(L"text-content",text_content_));
Context.get_drawing_context().set_property(_property(L"text-content", text_content));
}
Context.get_drawing_context().end_shape();
}
else if (objectBuild.object_type_ == 3) //мат формулы
{
Context.get_drawing_context().start_shape(2);
objectBuild.xlsx_convert(Context);
std::wstring math_content = Context.get_math_context().end();
if (!math_content.empty())
{
std::wstring text_content = L"<a:p><a14:m xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\">";
text_content += L"<m:oMathPara xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\">";
text_content += L"<m:oMathParaPr/>";
text_content += L"<m:oMath xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\">";
text_content += math_content;
text_content += L"</m:oMath></m:oMathPara></a14:m></a:p>";
Context.get_drawing_context().set_property(_property(L"fit-to-size", true));
Context.get_drawing_context().set_property(_property(L"text-content", text_content));
}
Context.get_drawing_context().end_shape();
}
else
{
//временно - замещающая картинка(если она конечно присутствует)
......
......@@ -66,7 +66,7 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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 docx_convert(oox::docx_conversion_context & Context) ;
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) {}
......@@ -378,7 +378,7 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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){}
draw_equation_attlist draw_equation_attlist_;
};
......@@ -421,7 +421,7 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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){}
draw_handle_attlist draw_handle_attlist_;
......@@ -451,7 +451,7 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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 xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void docx_convert(oox::docx_conversion_context & Context);
......
......@@ -53,12 +53,12 @@ void math_mstack::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mstack::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mstack::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mstack::docx_convert(oox::docx_conversion_context & Context)
void math_mstack::oox_convert(oox::math_context & Context)
{//0* elements
}
......@@ -72,12 +72,12 @@ void math_msrow::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_msrow::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_msrow::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_msrow::docx_convert(oox::docx_conversion_context & Context)
void math_msrow::oox_convert(oox::math_context & Context)
{
}
......@@ -91,12 +91,12 @@ void math_msline::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_msline::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_msline::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_msline::docx_convert(oox::docx_conversion_context & Context)
void math_msline::oox_convert(oox::math_context & Context)
{
}
......@@ -110,12 +110,12 @@ void math_msgroup::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_msgroup::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_msgroup::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_msgroup::docx_convert(oox::docx_conversion_context & Context)
void math_msgroup::oox_convert(oox::math_context & Context)
{//0* elements
}
......@@ -129,12 +129,12 @@ void math_mlongdiv::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mlongdiv::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mlongdiv::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mlongdiv::docx_convert(oox::docx_conversion_context & Context)
void math_mlongdiv::oox_convert(oox::math_context & Context)
{//3* elements
}
......@@ -148,12 +148,12 @@ void math_mscarry::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mscarry::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mscarry::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mscarry::docx_convert(oox::docx_conversion_context & Context)
void math_mscarry::oox_convert(oox::math_context & Context)
{
}
......@@ -167,12 +167,12 @@ void math_mscarries::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mscarries::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mscarries::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mscarries::docx_convert(oox::docx_conversion_context & Context)
void math_mscarries::oox_convert(oox::math_context & Context)
{//0* elements
}
......
......@@ -31,17 +31,12 @@
*/
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
#include "math_elements.h"
namespace cpdoccore {
namespace odf_reader {
class math_mstack : public office_element_impl<math_mstack>
class math_mstack : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -49,15 +44,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMStack;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -67,7 +58,7 @@ CP_REGISTER_OFFICE_ELEMENT3(math_mstack);
//--------------------------------------------------------------------
class math_msrow : public office_element_impl<math_msrow>
class math_msrow : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -75,15 +66,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSRow;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -93,7 +80,7 @@ CP_REGISTER_OFFICE_ELEMENT3(math_msrow);
//--------------------------------------------------------------------
class math_msline : public office_element_impl<math_msline>
class math_msline : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -103,15 +90,13 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_msline);
......@@ -119,7 +104,7 @@ CP_REGISTER_OFFICE_ELEMENT3(math_msline);
//--------------------------------------------------------------------
class math_mlongdiv : public office_element_impl<math_mlongdiv>
class math_mlongdiv : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -127,15 +112,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSLongDiv;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -145,7 +126,7 @@ CP_REGISTER_OFFICE_ELEMENT3(math_mlongdiv);
//--------------------------------------------------------------------
class math_mscarries : public office_element_impl<math_mscarries>
class math_mscarries : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -153,15 +134,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSCarries;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -170,7 +147,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_mscarries);
CP_REGISTER_OFFICE_ELEMENT3(math_mscarries);
//--------------------------------------------------------------------
class math_msgroup : public office_element_impl<math_msgroup>
class math_msgroup : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -178,15 +155,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSGroup;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -196,7 +169,7 @@ CP_REGISTER_OFFICE_ELEMENT3(math_msgroup);
//--------------------------------------------------------------------
class math_mscarry : public office_element_impl<math_mscarry>
class math_mscarry : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -204,15 +177,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSCarry;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......
......@@ -44,6 +44,9 @@ namespace cpdoccore {
namespace odf_reader {
//---------------------------------------------------------------
const wchar_t * office_math_element::ns = L"math";
const wchar_t * office_math_element::name = L"math-element";
//---------------------------------------------------------------
const wchar_t * office_math::ns = L"math";
const wchar_t * office_math::name = L"math";
......@@ -55,7 +58,7 @@ void office_math::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void office_math::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void office_math::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME1(L"semantics")
{
......@@ -64,10 +67,13 @@ void office_math::add_child_element( xml::sax * Reader, const ::std::wstring & N
}
void office_math::docx_convert(oox::docx_conversion_context & Context)
void office_math::oox_convert(oox::math_context & Context)
{
if (semantics_)
semantics_->docx_convert(Context);
{
office_math_element* math_element = dynamic_cast<office_math_element*>(semantics_.get());
math_element->oox_convert(Context);
}
}
//----------------------------------------------------------------------------------------------------
......@@ -79,7 +85,7 @@ void math_semantics::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void math_semantics::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_semantics::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME1(L"annotation")
{
......@@ -91,16 +97,13 @@ void math_semantics::add_child_element( xml::sax * Reader, const ::std::wstring
}
void math_semantics::docx_convert(oox::docx_conversion_context & Context)
void math_semantics::oox_convert(oox::math_context & Context)
{
Context.start_math_formula();
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (int i = 0 ; i < content_.size(); i++)
{
elm->docx_convert(Context);
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);
}
Context.end_math_formula();
}
//----------------------------------------------------------------------------------------------------
......@@ -118,7 +121,7 @@ void math_annotation::add_attributes( const xml::attributes_wc_ptr & Attributes
}
void math_annotation::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_annotation::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
......@@ -129,7 +132,7 @@ void math_annotation::add_text(const std::wstring & Text)
text_ = Text;
}
void math_annotation::docx_convert(oox::docx_conversion_context & Context)
void math_annotation::oox_convert(oox::math_context & Context)
{
}
......@@ -149,7 +152,7 @@ void math_annotation_xml::add_attributes( const xml::attributes_wc_ptr & Attribu
}
void math_annotation_xml::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_annotation_xml::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
......@@ -160,7 +163,7 @@ void math_annotation_xml::add_text(const std::wstring & Text)
text_ = Text;
}
void math_annotation_xml::docx_convert(oox::docx_conversion_context & Context)
void math_annotation_xml::oox_convert(oox::math_context & Context)
{
}
......
......@@ -31,12 +31,6 @@
*/
#pragma once
#include "math_elementaries.h"
#include "math_token_elements.h"
#include "math_table_elements.h"
#include "math_limit_elements.h"
#include "math_layout_elements.h"
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
......@@ -47,6 +41,29 @@
namespace cpdoccore {
namespace odf_reader {
class office_math_element : public office_element_impl<office_math_element>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const ElementType type = typeMathElement;
static const xml::NodeType xml_type = xml::typeElement;
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ){}
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
virtual void docx_convert (oox::docx_conversion_context & Context) {}
virtual void xlsx_convert (oox::xlsx_conversion_context & Context) {}
virtual void pptx_convert (oox::pptx_conversion_context & Context) {}
virtual void oox_convert (oox::math_context & Context) = 0;
CPDOCCORE_DEFINE_VISITABLE();
friend class odf_document;
};
//-------------------------------------------------------------------------------------------------------------------
class office_math : public office_element_impl<office_math>
{
public:
......@@ -55,15 +72,18 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMath;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert (oox::docx_conversion_context & Context){}
virtual void xlsx_convert (oox::xlsx_conversion_context & Context){}
virtual void pptx_convert (oox::pptx_conversion_context & Context){}
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
void oox_convert (oox::math_context & Context);
CPDOCCORE_DEFINE_VISITABLE();
friend class odf_document;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr semantics_;
};
......@@ -72,7 +92,7 @@ CP_REGISTER_OFFICE_ELEMENT2(office_math);
CP_REGISTER_OFFICE_ELEMENT3(office_math);
//--------------------------------------------------------------------
class math_semantics : public office_element_impl<math_semantics>
class math_semantics : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -80,17 +100,13 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMathSemantics;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
office_element_ptr_array content_;
office_element_ptr annotation_;
};
......@@ -98,7 +114,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_semantics);
CP_REGISTER_OFFICE_ELEMENT3(math_semantics);
//-------------------------------------------------------------------------------------------
class math_annotation : public office_element_impl<math_annotation>
class math_annotation : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -106,27 +122,22 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMathAnnotation;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
_CP_OPT(std::wstring) encoding_;
};
CP_REGISTER_OFFICE_ELEMENT2(math_annotation);
CP_REGISTER_OFFICE_ELEMENT3(math_annotation);
//--------------------------------------------------------------------
class math_annotation_xml : public office_element_impl<math_annotation_xml>
class math_annotation_xml : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -134,20 +145,15 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMathAnnotationXml;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
office_element_ptr_array content_;
_CP_OPT(std::wstring) text_;
_CP_OPT(std::wstring) encoding_;
};
......
......@@ -31,12 +31,7 @@
*/
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
#include "math_elements.h"
#include "datatypes/common_attlists.h"
#include "datatypes/fontstyle.h"
......@@ -49,7 +44,7 @@ namespace cpdoccore {
namespace odf_reader {
class math_mrow : public office_element_impl<math_mrow>
class math_mrow : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -58,15 +53,11 @@ public:
static const ElementType type = typeMRow;
math_mrow();
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
bool next_element_to_prev_;
......@@ -75,7 +66,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(math_mrow);
CP_REGISTER_OFFICE_ELEMENT3(math_mrow);
//--------------------------------------------------------------------------------------
class math_mfrac : public office_element_impl<math_mfrac>
class math_mfrac : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -83,15 +74,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMFrac;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_; //2 elements
......@@ -104,7 +91,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(math_mfrac);
CP_REGISTER_OFFICE_ELEMENT3(math_mfrac);
//--------------------------------------------------------------------------------------
class math_msqrt : public office_element_impl<math_msqrt>
class math_msqrt : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -112,15 +99,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSqrt;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -128,7 +111,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_msqrt);
CP_REGISTER_OFFICE_ELEMENT3(math_msqrt);
//--------------------------------------------------------------------------------------
class math_mroot : public office_element_impl<math_mroot>
class math_mroot : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -136,15 +119,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMRoot;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -152,7 +131,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_mroot);
CP_REGISTER_OFFICE_ELEMENT3(math_mroot);
//--------------------------------------------------------------------------------------
class math_mstyle : public office_element_impl<math_mstyle>
class math_mstyle : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -160,15 +139,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMStyle;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
......@@ -181,7 +156,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_mstyle);
CP_REGISTER_OFFICE_ELEMENT3(math_mstyle);
//--------------------------------------------------------------------------------------
class math_menclose : public office_element_impl<math_menclose>
class math_menclose : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -189,15 +164,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMEnClose;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -205,7 +176,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_menclose);
CP_REGISTER_OFFICE_ELEMENT3(math_menclose);
//--------------------------------------------------------------------------------------
class math_mfenced : public office_element_impl<math_mfenced>
class math_mfenced : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -213,15 +184,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMFenced;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -229,7 +196,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_mfenced);
CP_REGISTER_OFFICE_ELEMENT3(math_mfenced);
//--------------------------------------------------------------------------------------
class math_mpadded : public office_element_impl<math_mpadded>
class math_mpadded : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -237,15 +204,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMPadded;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......
......@@ -54,14 +54,14 @@ void math_msub::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_msub::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_msub::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
//<msub> base subscript </msub>
CP_CREATE_ELEMENT(content_);
}
void math_msub::docx_convert(oox::docx_conversion_context & Context)
void math_msub::oox_convert(oox::math_context & Context)
{//2 elements
if (content_.size() != 2)
{
......@@ -69,14 +69,18 @@ void math_msub::docx_convert(oox::docx_conversion_context & Context)
}
std::wostream & strm = Context.output_stream();
office_math_element* math_element = NULL;
strm << L"<m:sSub>";
strm << L"<m:e>";
content_[0]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[0].get());
math_element->oox_convert(Context);
strm << L"</m:e>";
strm << L"<m:sub>";
content_[1]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[1].get());
math_element->oox_convert(Context);
strm << L"</m:sub>";
strm << L"</m:sSub>";
......@@ -90,12 +94,12 @@ void math_msup::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_msup::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_msup::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_msup::docx_convert(oox::docx_conversion_context & Context)
void math_msup::oox_convert(oox::math_context & Context)
{//2 elements
if (content_.size() != 2)
{
......@@ -103,14 +107,18 @@ void math_msup::docx_convert(oox::docx_conversion_context & Context)
}
std::wostream & strm = Context.output_stream();
office_math_element* math_element = NULL;
strm << L"<m:sSup>";
strm << L"<m:e>";
content_[0]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[0].get());
math_element->oox_convert(Context);
strm << L"</m:e>";
strm << L"<m:sup>";
content_[1]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[1].get());
math_element->oox_convert(Context);
strm << L"</m:sup>";
strm << L"</m:sSup>";
......@@ -125,27 +133,32 @@ void math_msubsup::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_msubsup::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_msubsup::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_msubsup::docx_convert(oox::docx_conversion_context & Context)
void math_msubsup::oox_convert(oox::math_context & Context)
{//3 elements
std::wostream & strm = Context.output_stream();
office_math_element* math_element = NULL;
strm << L"<m:sSubSup>";
strm << L"<m:e>";
content_[0]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[0].get());
math_element->oox_convert(Context);
strm << L"</m:e>";
strm << L"<m:sub>";
content_[1]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[1].get());
math_element->oox_convert(Context);
strm << L"</m:sub>";
strm << L"<m:sup>";
content_[2]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[2].get());
math_element->oox_convert(Context);
strm << L"</m:sup>";
strm << L"</m:sSubSup>";
......@@ -159,12 +172,12 @@ void math_none::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_none::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_none::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_none::docx_convert(oox::docx_conversion_context & Context)
void math_none::oox_convert(oox::math_context & Context)
{
}
......@@ -178,12 +191,12 @@ void math_mprescripts::add_attributes( const xml::attributes_wc_ptr & Attributes
}
void math_mprescripts::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mprescripts::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mprescripts::docx_convert(oox::docx_conversion_context & Context)
void math_mprescripts::oox_convert(oox::math_context & Context)
{
}
......@@ -196,12 +209,12 @@ void math_mmultiscripts::add_attributes( const xml::attributes_wc_ptr & Attribut
}
void math_mmultiscripts::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mmultiscripts::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mmultiscripts::docx_convert(oox::docx_conversion_context & Context)
void math_mmultiscripts::oox_convert(oox::math_context & Context)
{//1* elements
}
......@@ -214,12 +227,12 @@ void math_munderover::add_attributes( const xml::attributes_wc_ptr & Attributes
}
void math_munderover::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_munderover::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_munderover::docx_convert(oox::docx_conversion_context & Context)
void math_munderover::oox_convert(oox::math_context & Context)
{//3 elements (+1)
if (content_.size() < 4)
{
......@@ -233,6 +246,8 @@ void math_munderover::docx_convert(oox::docx_conversion_context & Context)
std::wostream & strm = Context.output_stream();
office_math_element* math_element = NULL;
if (sBase.size() < 3)
{
strm << L"<m:nary>";
......@@ -246,19 +261,22 @@ void math_munderover::docx_convert(oox::docx_conversion_context & Context)
strm << L"</m:naryPr>";
strm << L"<m:sub>";
{
content_[2]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[2].get());
math_element->oox_convert(Context);
}
strm << L"</m:sub>";
strm << L"<m:sup>";
{
content_[1]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[1].get());
math_element->oox_convert(Context);
}
strm << L"</m:sup>";
strm << L"<m:e>";
{
content_[3]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[3].get());
math_element->oox_convert(Context);
}
strm << L"</m:e>";
strm << L"</m:nary>";
......@@ -271,19 +289,23 @@ void math_munderover::docx_convert(oox::docx_conversion_context & Context)
strm << L"<m:limLow>";
strm << L"<m:limLowPr/>";
strm << L"<m:e>";
content_[0]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[0].get());
math_element->oox_convert(Context);
strm << L"</m:e>";
strm << L"<m:lim>";
content_[1]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[1].get());
math_element->oox_convert(Context);
strm << L"</m:lim>";
strm << L"</m:limLow>";
strm << L"</m:e>";
strm << L"<m:lim>";
content_[2]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[2].get());
math_element->oox_convert(Context);
strm << L"</m:lim>";
strm << L"</m:limUpp>";
content_[3]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[3].get());
math_element->oox_convert(Context);
}
}
//---------------------------------------------------------------
......@@ -295,22 +317,26 @@ void math_mover::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mover::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mover::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mover::docx_convert(oox::docx_conversion_context & Context)
void math_mover::oox_convert(oox::math_context & Context)
{//2 elements
std::wostream & strm = Context.output_stream();
office_math_element* math_element = NULL;
strm << L"<m:limUpp>";
strm << L"<m:limUppPr/>";
strm << L"<m:e>";
content_[0]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[0].get());
math_element->oox_convert(Context);
strm << L"</m:e>";
strm << L"<m:lim>";
content_[1]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[1].get());
math_element->oox_convert(Context);
strm << L"</m:lim>";
strm << L"</m:limUpp>";
}
......@@ -323,22 +349,25 @@ void math_munder::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_munder::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_munder::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_munder::docx_convert(oox::docx_conversion_context & Context)
void math_munder::oox_convert(oox::math_context & Context)
{//2 elements
std::wostream & strm = Context.output_stream();
office_math_element* math_element = NULL;
strm << L"<m:limLow>";
strm << L"<m:limLowPr/>";
strm << L"<m:e>";
content_[0]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[0].get());
math_element->oox_convert(Context);
strm << L"</m:e>";
strm << L"<m:lim>";
content_[1]->docx_convert(Context);
math_element = dynamic_cast<office_math_element*>(content_[1].get());
math_element->oox_convert(Context);
strm << L"</m:lim>";
strm << L"</m:limLow>";
}
......
......@@ -54,19 +54,20 @@ void math_mtable::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mtable::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mtable::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mtable::docx_convert(oox::docx_conversion_context & Context)
void math_mtable::oox_convert(oox::math_context & Context)
{//0* elements
std::wostream & strm = Context.output_stream();
strm << L"<m:m>";
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (int i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);
}
strm << L"</m:m>";
}
......@@ -81,19 +82,20 @@ void math_mtr::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mtr::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mtr::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mtr::docx_convert(oox::docx_conversion_context & Context)
void math_mtr::oox_convert(oox::math_context & Context)
{//0* elements
std::wostream & strm = Context.output_stream();
strm << L"<m:mr>";
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (int i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);
}
strm << L"</m:mr>";
}
......@@ -108,12 +110,12 @@ void math_mlabeledtr::add_attributes( const xml::attributes_wc_ptr & Attributes
}
void math_mlabeledtr::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mlabeledtr::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mlabeledtr::docx_convert(oox::docx_conversion_context & Context)
void math_mlabeledtr::oox_convert(oox::math_context & Context)
{
}
......@@ -128,19 +130,20 @@ void math_mtd::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mtd::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mtd::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_mtd::docx_convert(oox::docx_conversion_context & Context)
void math_mtd::oox_convert(oox::math_context & Context)
{
std::wostream & strm = Context.output_stream();
strm << L"<m:e>";
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (int i = 0; i < content_.size(); i++)
{
elm->docx_convert(Context);
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);
}
strm << L"</m:e>";
}
......@@ -155,12 +158,12 @@ void math_maligngroup::add_attributes( const xml::attributes_wc_ptr & Attributes
}
void math_maligngroup::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_maligngroup::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_maligngroup::docx_convert(oox::docx_conversion_context & Context)
void math_maligngroup::oox_convert(oox::math_context & Context)
{
}
......@@ -175,12 +178,12 @@ void math_malignmark::add_attributes( const xml::attributes_wc_ptr & Attributes
}
void math_malignmark::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_malignmark::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void math_malignmark::docx_convert(oox::docx_conversion_context & Context)
void math_malignmark::oox_convert(oox::math_context & Context)
{
}
......
......@@ -31,17 +31,12 @@
*/
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
#include "math_elements.h"
namespace cpdoccore {
namespace odf_reader {
class math_mtable : public office_element_impl<math_mtable>
class math_mtable : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -49,15 +44,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMTable;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -66,7 +57,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_mtable);
CP_REGISTER_OFFICE_ELEMENT3(math_mtable);
//--------------------------------------------------------------------
class math_malignmark : public office_element_impl<math_malignmark>
class math_malignmark : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -74,15 +65,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMAlignMark;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -91,7 +78,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_malignmark);
CP_REGISTER_OFFICE_ELEMENT3(math_malignmark);
//--------------------------------------------------------------------
class math_maligngroup : public office_element_impl<math_maligngroup>
class math_maligngroup : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -99,15 +86,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMAlignGroup;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -116,7 +99,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_maligngroup);
CP_REGISTER_OFFICE_ELEMENT3(math_maligngroup);
//--------------------------------------------------------------------
class math_mtd : public office_element_impl<math_mtd>
class math_mtd : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -124,15 +107,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMTd;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -141,7 +120,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_mtd);
CP_REGISTER_OFFICE_ELEMENT3(math_mtd);
//--------------------------------------------------------------------
class math_mlabeledtr : public office_element_impl<math_mlabeledtr>
class math_mlabeledtr : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -149,15 +128,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMLabelEdTr;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......@@ -166,7 +141,7 @@ CP_REGISTER_OFFICE_ELEMENT2(math_mlabeledtr);
CP_REGISTER_OFFICE_ELEMENT3(math_mlabeledtr);
//--------------------------------------------------------------------
class math_mtr : public office_element_impl<math_mtr>
class math_mtr : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -174,15 +149,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMTr;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
office_element_ptr_array content_;
};
......
......@@ -57,7 +57,7 @@ void math_mi::add_attributes( const xml::attributes_wc_ptr & Attributes )
common_attlist_.add_attributes(Attributes);
}
void math_mi::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mi::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
......@@ -67,26 +67,21 @@ void math_mi::add_text(const std::wstring & Text)
text_ = Text;
}
std::wostream & math_mi::text_to_stream(::std::wostream & _strm) const
std::wostream & math_mi::text_to_stream(std::wostream & _strm) const
{
if (text_)
_strm << *text_;
return _strm;
}
void math_mi::docx_convert(oox::docx_conversion_context & Context)
void math_mi::oox_convert(oox::math_context & Context)
{
if (!text_) return;
CP_XML_WRITER(Context.output_stream())
{
CP_XML_NODE(L"m:r")
{
Context.get_styles_context().start();
Context.current_text_properties()->docx_convert(Context);
{
if (common_attlist_.mathvariant_)
{
std::wstring m_sty_val;
......@@ -119,11 +114,8 @@ void math_mi::docx_convert(oox::docx_conversion_context & Context)
}
}
CP_XML_NODE(L"w:rPr")
{
CP_XML_STREAM() << Context.get_styles_context().text_style().str();
}
Context.text_properties_->content().oox_convert(CP_XML_STREAM(), Context.graphRPR_);
CP_XML_NODE(L"m:t")
{
//CP_XML_ATTR(L"xml:space", L"preserve");
......@@ -143,7 +135,7 @@ void math_mo::add_attributes( const xml::attributes_wc_ptr & Attributes )
CP_APPLY_ATTR(L"fence", fence_);
}
void math_mo::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mo::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
......@@ -153,14 +145,14 @@ void math_mo::add_text(const std::wstring & Text)
text_ = Text;
}
std::wostream & math_mo::text_to_stream(::std::wostream & _strm) const
std::wostream & math_mo::text_to_stream(std::wostream & _strm) const
{
if (text_)
_strm << *text_;
return _strm;
}
void math_mo::docx_convert(oox::docx_conversion_context & Context)
void math_mo::oox_convert(oox::math_context & Context)
{
if (!text_) return;
......@@ -169,13 +161,9 @@ void math_mo::docx_convert(oox::docx_conversion_context & Context)
CP_XML_NODE(L"m:r")
{
// + доп стили текста ... todoooo
Context.get_styles_context().start();
Context.current_text_properties()->docx_convert(Context);
CP_XML_NODE(L"w:rPr")
{
CP_XML_STREAM() << Context.get_styles_context().text_style().str();
}
Context.text_properties_->content().oox_convert(CP_XML_STREAM(), Context.graphRPR_);
CP_XML_NODE(L"m:t")
{
//CP_XML_ATTR(L"xml:space", L"preserve");
......@@ -194,7 +182,7 @@ void math_mn::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mn::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mn::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
......@@ -205,7 +193,7 @@ void math_mn::add_text(const std::wstring & Text)
}
void math_mn::docx_convert(oox::docx_conversion_context & Context)
void math_mn::oox_convert(oox::math_context & Context)
{
if (!text_) return;
......@@ -214,13 +202,9 @@ void math_mn::docx_convert(oox::docx_conversion_context & Context)
CP_XML_NODE(L"m:r")
{
// + доп стили текста ... todoooo
Context.get_styles_context().start();
Context.current_text_properties()->docx_convert(Context);
CP_XML_NODE(L"w:rPr")
{
CP_XML_STREAM() << Context.get_styles_context().text_style().str();
}
Context.text_properties_->content().oox_convert(CP_XML_STREAM(), Context.graphRPR_);
CP_XML_NODE(L"m:t")
{
//CP_XML_ATTR(L"xml:space", L"preserve");
......@@ -239,7 +223,7 @@ void math_ms::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_ms::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_ms::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
......@@ -250,7 +234,7 @@ void math_ms::add_text(const std::wstring & Text)
}
void math_ms::docx_convert(oox::docx_conversion_context & Context)
void math_ms::oox_convert(oox::math_context & Context)
{
}
......@@ -263,7 +247,7 @@ void math_mspace::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mspace::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mspace::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
......@@ -274,7 +258,7 @@ void math_mspace::add_text(const std::wstring & Text)
}
void math_mspace::docx_convert(oox::docx_conversion_context & Context)
void math_mspace::oox_convert(oox::math_context & Context)
{
}
......@@ -288,7 +272,7 @@ void math_mtext::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mtext::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mtext::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
......@@ -299,7 +283,7 @@ void math_mtext::add_text(const std::wstring & Text)
}
void math_mtext::docx_convert(oox::docx_conversion_context & Context)
void math_mtext::oox_convert(oox::math_context & Context)
{
}
......@@ -313,7 +297,7 @@ void math_mglyph::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void math_mglyph::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
void math_mglyph::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
......@@ -324,7 +308,7 @@ void math_mglyph::add_text(const std::wstring & Text)
}
void math_mglyph::docx_convert(oox::docx_conversion_context & Context)
void math_mglyph::oox_convert(oox::math_context & Context)
{
}
......
......@@ -31,19 +31,14 @@
*/
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
#include "math_elements.h"
#include "datatypes/common_attlists.h"
namespace cpdoccore {
namespace odf_reader {
class math_mi : public office_element_impl<math_mi>
class math_mi : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -51,16 +46,12 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMI;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
virtual std::wostream & text_to_stream(::std::wostream & _Wostream) const;
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
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);
odf_types::common_math_style_attlist common_attlist_;
......@@ -72,7 +63,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(math_mi);
CP_REGISTER_OFFICE_ELEMENT3(math_mi);
//--------------------------------------------------------------------
class math_mo : public office_element_impl<math_mo>
class math_mo : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -80,19 +71,15 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMO;
CPDOCCORE_DEFINE_VISITABLE();
virtual void oox_convert(oox::math_context & Context);
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual std::wostream & text_to_stream(::std::wostream & _Wostream) const;
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
_CP_OPT(bool) fence_;
_CP_OPT(bool) stretchy_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
odf_types::common_math_style_attlist common_attlist_;
......@@ -104,7 +91,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(math_mo);
CP_REGISTER_OFFICE_ELEMENT3(math_mo);
//--------------------------------------------------------------------
class math_mn : public office_element_impl<math_mn>
class math_mn : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -112,15 +99,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMN;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
odf_types::common_math_style_attlist common_attlist_;
......@@ -132,7 +115,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(math_mn);
CP_REGISTER_OFFICE_ELEMENT3(math_mn);
//--------------------------------------------------------------------
class math_mtext : public office_element_impl<math_mtext>
class math_mtext : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -140,15 +123,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMText;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
odf_types::common_math_style_attlist common_attlist_;
......@@ -160,7 +139,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(math_mtext);
CP_REGISTER_OFFICE_ELEMENT3(math_mtext);
//--------------------------------------------------------------------
class math_mspace : public office_element_impl<math_mspace>
class math_mspace : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -168,15 +147,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMSpace;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
odf_types::common_math_style_attlist common_attlist_;
......@@ -188,7 +163,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(math_mspace);
CP_REGISTER_OFFICE_ELEMENT3(math_mspace);
//--------------------------------------------------------------------
class math_ms : public office_element_impl<math_ms>
class math_ms : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -196,15 +171,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMS;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
odf_types::common_math_style_attlist common_attlist_;
......@@ -216,7 +187,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(math_ms);
CP_REGISTER_OFFICE_ELEMENT3(math_ms);
//--------------------------------------------------------------------
class math_mglyph : public office_element_impl<math_mglyph>
class math_mglyph : public office_math_element
{
public:
static const wchar_t * ns;
......@@ -224,15 +195,11 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeMGlyph;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context){}
virtual void oox_convert(oox::math_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
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);
odf_types::common_math_style_attlist common_attlist_;
......
......@@ -64,6 +64,11 @@
#include "templates.h"
#include "math_elements.h"
#include "math_elementaries.h"
#include "math_token_elements.h"
#include "math_table_elements.h"
#include "math_limit_elements.h"
#include "math_layout_elements.h"
#include "paragraph_elements.h"
#include "text_elements.h"
......
......@@ -56,9 +56,9 @@ namespace odf_reader {
class document_context;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
typedef weak_ptr<office_element>::Type office_element_weak_ptr;
typedef ::std::vector<office_element_ptr> office_element_ptr_array;
typedef shared_ptr<office_element>::Type office_element_ptr;
typedef weak_ptr<office_element>::Type office_element_weak_ptr;
typedef std::vector<office_element_ptr> office_element_ptr_array;
class office_element : public xml::element<wchar_t>,
public common::read_doc_element,
......@@ -81,13 +81,13 @@ public:
void setContext(document_context * Context) { context_ = Context; }
public:
virtual ::std::wostream & text_to_stream(::std::wostream & _Wostream) const
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const
{
_CP_LOG << L"[warning] use base text_to_stream\n";
return _Wostream;
}
virtual ::std::wostream & xml_to_stream(::std::wostream & _Wostream) const
virtual std::wostream & xml_to_stream(std::wostream & _Wostream) const
{
_CP_LOG << L"[warning] use base xml_to_stream\n";
return _Wostream;
......
......@@ -71,7 +71,7 @@ public:
bool register_element(const std::wstring &ns, const std::wstring & name, CreateFuncImpl f);
// Создать элемент по имени
office_element_ptr create(const ::std::wstring & ns, const ::std::wstring & name, document_context * Context = NULL, bool isRoot = false) const;
office_element_ptr create(const std::wstring & ns, const std::wstring & name, document_context * Context = NULL, bool isRoot = false) const;
private:
typedef std::map<std::wstring, CreateFuncImpl> MapType;
......@@ -134,16 +134,16 @@ template<class T> int RegisterElement<T>::class_registered_1_ = 0; //without nam
// Создать элемент и в случае успеха прочитать его содержимое из SAX, поместить в shared_ptr
bool create_element_and_read(xml::sax * Reader,
const ::std::wstring & Ns,
const ::std::wstring & Name,
const std::wstring & Ns,
const std::wstring & Name,
office_element_ptr & _Element,
document_context * Context,
bool isRoot = false);
// Создать элемент и в случае успеха прочитать его содержимое из SAX, поместить в array
bool create_element_and_read(xml::sax * Reader,
const ::std::wstring & Ns,
const ::std::wstring & Name,
const std::wstring & Ns,
const std::wstring & Name,
office_element_ptr_array & _Elements,
document_context * Context,
bool isRoot = false);
......
......@@ -204,6 +204,7 @@ enum ElementType
typeOfficeDocumentMeta,
typeOfficeDocumentSettings,
typeMathElement,
typeMath,
typeMathSemantics,
typeMathAnnotation,
......
......@@ -76,19 +76,21 @@ class text_format_properties_content : public oox::conversion_element
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
void pptx_convert_as_list(oox::pptx_conversion_context & Context);
void docx_convert (oox::docx_conversion_context & Context);
void pptx_convert (oox::pptx_conversion_context & Context);
void pptx_convert_as_list (oox::pptx_conversion_context & Context);
void oox_convert (std::wostream & stream, bool graphic);
void apply_from(const text_format_properties_content & Other);
void apply_to(std::vector<_property> & properties);
void set_r_style(const std::wstring & rStyle) { r_style_ = rStyle; }
int process_font_size(const optional<odf_types::font_size>::Type & FontSize, const style_instance * currnetStyle, bool Complex = false, double Mul = 1.0);
void apply_from (const text_format_properties_content & Other);
void apply_to (std::vector<_property> & properties);
void set_r_style (const std::wstring & rStyle) { r_style_ = rStyle; }
int process_font_size (const _CP_OPT(odf_types::font_size) & FontSize, const style_instance * currnetStyle, bool Complex = false, double Mul = 1.0);
private:
static double process_font_size_impl(const _CP_OPT(odf_types::font_size) & FontSize, const style_instance * currnetStyle, bool Complex = false, double Mul = 1.0);
static int process_font_weight(const optional<odf_types::font_weight>::Type & FontWeight);
static int process_font_style(const optional<odf_types::font_style>::Type & FontStyle);
static double process_font_size_impl (const _CP_OPT(odf_types::font_size) & FontSize, const style_instance * currnetStyle, bool Complex = false, double Mul = 1.0);
static int process_font_weight (const _CP_OPT(odf_types::font_weight) & FontWeight);
static int process_font_style (const _CP_OPT(odf_types::font_style) & FontStyle);
public:
_CP_OPT(std::wstring) r_style_;
......@@ -314,21 +316,20 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
void docx_convert (oox::docx_conversion_context & Context);
void pptx_convert (oox::pptx_conversion_context & Context);
const text_format_properties_content & content() const { return text_format_properties_content_; } ;
text_format_properties_content & content() { return text_format_properties_content_; } ;
const text_format_properties_content & content() const { return text_format_properties_content_; } ;
text_format_properties_content & content() { return text_format_properties_content_; } ;
public:
style_text_properties(){};
style_text_properties(const std::wstring & rStyle){ text_format_properties_content_.set_r_style(rStyle); };
style_text_properties(const std::wstring & rStyle) { text_format_properties_content_.set_r_style(rStyle); };
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
private:
text_format_properties_content text_format_properties_content_;
text_format_properties_content text_format_properties_content_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_text_properties);
......
......@@ -1940,6 +1940,10 @@
RelativePath="..\.\PPTXFormat\Logic\Runs\Fld.h"
>
</File>
<File
RelativePath="..\PPTXFormat\Logic\Runs\MathParaWrapper.cpp"
>
</File>
<File
RelativePath="..\.\PPTXFormat\Logic\Runs\Run.h"
>
......
......@@ -222,7 +222,7 @@ void CSvmFile::PlayMetaFile()
m_oStream.Skip(need_skip);
#ifdef _DEBUG
if (/*100 <= actionType &&*/ actionType <= META_LAST_ACTION && /*need_skip > 0 &&*/ !m_pOutput)
if (100 <= actionType && actionType <= META_LAST_ACTION && need_skip > 0 && !m_pOutput)
{
std::wstring name = actionNames[actionType - 99].actionName;
......
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