Commit f3c66cab authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter

parent 11e6fc3e
<?xml version="1.0" encoding="windows-1251"?> <?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8.00"
Name="OdfFileReaderTest" Name="OdfFileReaderTest"
ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}" ProjectGUID="{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
RootNamespace="ASCOfficeOdfFileTest" RootNamespace="ASCOfficeOdfFileTest"
......
...@@ -136,7 +136,8 @@ void xlsx_text_context::Impl::serialize_shared_strings(std::wostream & strm) ...@@ -136,7 +136,8 @@ void xlsx_text_context::Impl::serialize_shared_strings(std::wostream & strm)
xlsx_text_context::Impl::Impl(odf_reader::styles_container & styles): paragraphs_cout_(0),styles_(styles), xlsx_text_context::Impl::Impl(odf_reader::styles_container & styles): paragraphs_cout_(0),styles_(styles),
in_comment(false),in_draw(false),in_paragraph(false),in_span(false),in_cell_content(false) in_comment(false),in_draw(false),in_paragraph(false),in_span(false),in_cell_content(false)
{ {
text_properties_cell_ = NULL; local_styles_ptr_ = NULL;
text_properties_cell_ = NULL;
} }
void xlsx_text_context::Impl::add_text(const std::wstring & text) void xlsx_text_context::Impl::add_text(const std::wstring & text)
......
...@@ -403,9 +403,11 @@ int draw_enhanced_geometry::parsing(_CP_OPT(std::wstring) val) ...@@ -403,9 +403,11 @@ int draw_enhanced_geometry::parsing(_CP_OPT(std::wstring) val)
void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE) void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
{ {
CP_XML_ATTR_OPT(L"draw:type", draw_type_); CP_XML_ATTR_OPT(L"draw:type", draw_type_);
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_); CP_XML_ATTR_OPT(L"drawooo:sub-view-size", draw_sub_view_size_);
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_);
CP_XML_ATTR_OPT(L"draw:modifiers", draw_modifiers_); CP_XML_ATTR_OPT(L"draw:modifiers", draw_modifiers_);
CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_); CP_XML_ATTR_OPT(L"drawooo:enhanced-path", draw_enhanced_path_);
//CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_);
CP_XML_ATTR_OPT(L"draw:glue-points", draw_glue_points_); CP_XML_ATTR_OPT(L"draw:glue-points", draw_glue_points_);
CP_XML_ATTR_OPT(L"draw:mirror-vertical", draw_mirror_vertical_); CP_XML_ATTR_OPT(L"draw:mirror-vertical", draw_mirror_vertical_);
CP_XML_ATTR_OPT(L"draw:mirror-horizontal", draw_mirror_horizontal_); CP_XML_ATTR_OPT(L"draw:mirror-horizontal", draw_mirror_horizontal_);
......
...@@ -316,19 +316,21 @@ CP_REGISTER_OFFICE_ELEMENT2(draw_handle); ...@@ -316,19 +316,21 @@ CP_REGISTER_OFFICE_ELEMENT2(draw_handle);
class draw_enhanced_geometry_attlist class draw_enhanced_geometry_attlist
{ {
public: public:
_CP_OPT(std::wstring) draw_type_; _CP_OPT(std::wstring) draw_type_;
_CP_OPT(std::wstring) draw_modifiers_; _CP_OPT(std::wstring) draw_modifiers_;
_CP_OPT(std::wstring) draw_enhanced_path_; _CP_OPT(std::wstring) draw_enhanced_path_;
_CP_OPT(std::wstring) draw_text_areas_; _CP_OPT(std::wstring) draw_text_areas_;
_CP_OPT(std::wstring) draw_glue_points_; _CP_OPT(std::wstring) draw_glue_points_;
_CP_OPT(odf_types::Bool) draw_mirror_vertical_; _CP_OPT(std::wstring) draw_sub_view_size_;
_CP_OPT(odf_types::Bool) draw_mirror_horizontal_;
_CP_OPT(odf_types::Bool) draw_mirror_vertical_;
_CP_OPT(odf_types::Bool) draw_mirror_horizontal_;
_CP_OPT(odf_types::Bool) draw_text_path_; _CP_OPT(odf_types::Bool) draw_text_path_;
_CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_; _CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_;
_CP_OPT(std::wstring) draw_text_path_mode_; _CP_OPT(std::wstring) draw_text_path_mode_;
_CP_OPT(std::wstring) draw_text_path_scale_; _CP_OPT(std::wstring) draw_text_path_scale_;
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
}; };
......
...@@ -139,6 +139,7 @@ public: ...@@ -139,6 +139,7 @@ public:
void start_object(std::wstring name); void start_object(std::wstring name);
void end_object(); void end_object();
bool isLineShape();
void corrected_line_fill(); void corrected_line_fill();
office_element_ptr & get_root_element(); office_element_ptr & get_root_element();
...@@ -149,8 +150,12 @@ public: ...@@ -149,8 +150,12 @@ public:
bool is_exist_content(); bool is_exist_content();
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
void set_path (std::wstring path_string); void set_path (std::wstring path_string);
void add_path_element (std::wstring command, const std::wstring & elm); void add_path_element (std::wstring command, std::wstring elm);
void add_modifier (std::wstring modifier); void add_modifier (std::wstring modifier);
void add_formula (std::wstring name, std::wstring fmla);
void set_textarea (std::wstring l, std::wstring t, std::wstring r, std::wstring b);
void add_handle (std::wstring x, std::wstring y, std::wstring refX, std::wstring refY,
std::wstring minX, std::wstring maxX, std::wstring minY, std::wstring maxY);
void set_viewBox (double W, double H); void set_viewBox (double W, double H);
......
...@@ -238,11 +238,11 @@ void ods_conversion_context::end_row() ...@@ -238,11 +238,11 @@ void ods_conversion_context::end_row()
////////////////////// //////////////////////
void ods_conversion_context::start_comment(int col, int row, std::wstring & author) void ods_conversion_context::start_comment(int col, int row, std::wstring & author)
{ {
current_table().start_comment(col,row,author); current_table().start_comment(col, row, author);
start_text_context(); start_text_context();
//////////////// ////////////////
office_element_ptr paragr_elm; office_element_ptr paragr_elm;
create_element(L"text", L"p",paragr_elm,this); create_element(L"text", L"p", paragr_elm, this);
current_text_context_->start_paragraph(paragr_elm); current_text_context_->start_paragraph(paragr_elm);
} }
...@@ -309,7 +309,7 @@ void ods_conversion_context::add_merge_cells(const std::wstring & ref) ...@@ -309,7 +309,7 @@ void ods_conversion_context::add_merge_cells(const std::wstring & ref)
void ods_conversion_context::start_cell(std::wstring & ref, int xfd_style) void ods_conversion_context::start_cell(std::wstring & ref, int xfd_style)
{ {
int col=0, row=0; int col = 0, row = 0;
utils::parsing_ref ( ref, col,row); utils::parsing_ref ( ref, col,row);
if (col > current_table().current_column()+1) if (col > current_table().current_column()+1)
...@@ -389,11 +389,31 @@ void ods_conversion_context::start_rows() ...@@ -389,11 +389,31 @@ void ods_conversion_context::start_rows()
void ods_conversion_context::end_rows() void ods_conversion_context::end_rows()
{ {
//add default last row //add default last row
int repeat = (std::max)(current_table().dimension_row,64) - current_table().current_row(); int repeated = (std::max)(current_table().dimension_row, 64) - current_table().current_row();
if (repeat < 0) repeat = 1; if (repeated < 0) repeated = 1;
while(true)
{
//делим на 3 - до, с комметом, после;
int comment_idx = current_table().is_row_comment(current_table().current_row() + 1, repeated);
if (comment_idx < 0) break;
int rows = current_table().comments_[comment_idx].row - current_table().current_row() - 1;
start_row(current_table().current_row() + 1, rows, 0, true);
end_row();
start_row(current_table().current_row() + 1, 1, 0, true);
end_row();
repeated -= (1 + rows);
}
start_row(current_table().current_row()+1,repeat,0,true); if (repeated > 0)
end_row(); {
start_row(current_table().current_row() + 1, repeated, 0, true);
end_row();
}
} }
void ods_conversion_context::add_column(int start_column, int repeated, int level, bool _default) void ods_conversion_context::add_column(int start_column, int repeated, int level, bool _default)
......
...@@ -136,8 +136,8 @@ ods_table_state::ods_table_state(odf_conversion_context * Context, office_elemen ...@@ -136,8 +136,8 @@ ods_table_state::ods_table_state(odf_conversion_context * Context, office_elemen
{ {
office_table_ = elm; office_table_ = elm;
current_table_row_ =0; current_table_row_ = 0;
current_table_column_ =0; current_table_column_ = 0;
current_level_.push_back(office_table_); current_level_.push_back(office_table_);
...@@ -395,7 +395,7 @@ bool ods_table_state::is_cell_hyperlink() ...@@ -395,7 +395,7 @@ bool ods_table_state::is_cell_hyperlink()
bool ods_table_state::is_cell_comment() bool ods_table_state::is_cell_comment()
{ {
if (cells_size_ <1)return false; if (cells_size_ <1)return false;
return cells_.back().comment_idx >=0 ? true : false; return cells_.back().comment_idx >= 0 ? true : false;
} }
int ods_table_state::is_cell_hyperlink(int col, int row) int ods_table_state::is_cell_hyperlink(int col, int row)
...@@ -413,7 +413,18 @@ int ods_table_state::is_cell_comment(int col, int row, short repeate_col) ...@@ -413,7 +413,18 @@ int ods_table_state::is_cell_comment(int col, int row, short repeate_col)
{ {
for (size_t i = 0; i < comments_.size(); i++) for (size_t i = 0; i < comments_.size(); i++)
{ {
if ((comments_[i].col < col+repeate_col && comments_[i].col >= col) && comments_[i].row == row) if ((comments_[i].col < col + repeate_col && comments_[i].col >= col) && comments_[i].row == row)
{
return i;
}
}
return -1;
}
int ods_table_state::is_row_comment(int row, int repeate_row)
{
for (size_t i = 0; i < comments_.size(); i++)
{
if (comments_[i].row < row + repeate_row && comments_[i].row >= row)
{ {
return i; return i;
} }
...@@ -489,10 +500,10 @@ void ods_table_state::start_cell(office_element_ptr & elm, office_element_ptr & ...@@ -489,10 +500,10 @@ void ods_table_state::start_cell(office_element_ptr & elm, office_element_ptr &
state.empty = true; state.empty = true;
state.elm = elm; state.repeated = 1; state.style_name = style_name; state.style_elm = style_elm; state.elm = elm; state.repeated = 1; state.style_name = style_name; state.style_elm = style_elm;
state.row=current_table_row_; state.col =current_table_column_+1; state.row = current_table_row_; state.col =current_table_column_ + 1;
state.hyperlink_idx = is_cell_hyperlink(state.col, state.row); state.hyperlink_idx = is_cell_hyperlink(state.col, state.row);
state.comment_idx = is_cell_comment(state.col, state.row); state.comment_idx = is_cell_comment(state.col, state.row);
current_table_column_ += state.repeated; current_table_column_ += state.repeated;
cells_.push_back(state); cells_.push_back(state);
...@@ -1016,8 +1027,8 @@ void ods_table_state::end_cell() ...@@ -1016,8 +1027,8 @@ void ods_table_state::end_cell()
void ods_table_state::add_default_cell( short repeated) void ods_table_state::add_default_cell( short repeated)
{ {
int comment_idx = is_cell_comment(current_table_column_+1 , current_table_row_, repeated); int comment_idx = is_cell_comment(current_table_column_ + 1 , current_table_row_, repeated);
if (comment_idx >=0 && repeated >1) if (comment_idx >= 0 && repeated > 1)
{ {
//делим на 3 - до, с комметом, после; //делим на 3 - до, с комметом, после;
int c = current_table_column_; int c = current_table_column_;
......
...@@ -300,6 +300,7 @@ public: ...@@ -300,6 +300,7 @@ public:
int is_cell_hyperlink (int col, int row); int is_cell_hyperlink (int col, int row);
bool is_cell_comment (); bool is_cell_comment ();
int is_cell_comment (int col, int row, short repeate_col = 1); int is_cell_comment (int col, int row, short repeate_col = 1);
int is_row_comment (int row, int repeate_row = 1);
ods_hyperlink_state & current_hyperlink(); ods_hyperlink_state & current_hyperlink();
...@@ -316,7 +317,8 @@ public: ...@@ -316,7 +317,8 @@ public:
odf_drawing_context * drawing_context(){return &drawing_context_;} odf_drawing_context * drawing_context(){return &drawing_context_;}
std::wstring office_table_name_; std::wstring office_table_name_;
std::vector<ods_comment_state> comments_;
private: private:
odf_conversion_context * context_; odf_conversion_context * context_;
...@@ -342,9 +344,7 @@ private: ...@@ -342,9 +344,7 @@ private:
std::list<ods_cell_state> cells_; std::list<ods_cell_state> cells_;
long cells_size_; long cells_size_;
std::vector<ods_hyperlink_state> hyperlinks_; std::vector<ods_hyperlink_state> hyperlinks_;
std::vector<ods_comment_state> comments_;
std::vector<ods_shared_formula_state> shared_formulas_; std::vector<ods_shared_formula_state> shared_formulas_;
odf_drawing_context drawing_context_; odf_drawing_context drawing_context_;
......
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
namespace cpdoccore namespace cpdoccore
{ {
oox_shape::oox_shape()
{
odf_type_name = L"ooxml-non-primitive";
view_box = L"0 0 0 0";
}
oox_shape_ptr oox_shape::create(int ooxPrstGeomType) oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
{ {
switch (ooxPrstGeomType) switch (ooxPrstGeomType)
...@@ -127,7 +133,7 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType) ...@@ -127,7 +133,7 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
default: default:
if (ooxPrstGeomType > 2000) return boost::make_shared<oox_shape_textPlain>(); if (ooxPrstGeomType > 2000) return boost::make_shared<oox_shape_textPlain>();
else return boost::make_shared<oox_shape>(); else return oox_shape_ptr();
} }
} }
......
...@@ -48,6 +48,8 @@ namespace cpdoccore ...@@ -48,6 +48,8 @@ namespace cpdoccore
public: public:
static oox_shape_ptr create(int ooxPrstGeomType); static oox_shape_ptr create(int ooxPrstGeomType);
oox_shape();
struct _equation struct _equation
{ {
std::wstring name; std::wstring name;
...@@ -66,20 +68,20 @@ namespace cpdoccore ...@@ -66,20 +68,20 @@ namespace cpdoccore
void add(std::wstring name,std::wstring frmla) void add(std::wstring name,std::wstring frmla)
{ {
_equation q = {name,frmla}; _equation q = {name, frmla};
equations.push_back(q); equations.push_back(q);
} }
std::vector<_equation> equations; std::vector<_equation> equations;
std::vector<_handle> handles; std::vector<_handle> handles;
std::wstring enhanced_path; std::wstring enhanced_path;
std::wstring modifiers; std::wstring modifiers;
std::wstring text_areas; std::wstring text_areas;
std::wstring view_box; std::wstring view_box;
_CP_OPT(std::wstring) sub_view_size;
std::wstring odf_type_name; _CP_OPT(std::wstring) glue_points;
_CP_OPT(std::wstring) glue_points; std::wstring odf_type_name;
}; };
}; };
\ No newline at end of file
...@@ -372,7 +372,17 @@ void OoxConverter::convert(PPTX::Logic::CxnSp *oox_connect) ...@@ -372,7 +372,17 @@ void OoxConverter::convert(PPTX::Logic::CxnSp *oox_connect)
odf_context()->drawing_context()->start_drawing(); odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeLine); int type = SimpleTypes::shapetypeLine;
if ( oox_connect->spPr.Geometry.is<PPTX::Logic::PrstGeom>() )
{
const PPTX::Logic::PrstGeom& prstGeom = oox_connect->spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> preset;
preset.FromString(prstGeom.prst.get());
type = preset.GetValue();
}
odf_context()->drawing_context()->start_shape(type);
convert(&oox_connect->spPr, oox_connect->style.GetPointer()); convert(&oox_connect->spPr, oox_connect->style.GetPointer());
convert(&oox_connect->nvCxnSpPr); convert(&oox_connect->nvCxnSpPr);
...@@ -462,7 +472,7 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* ...@@ -462,7 +472,7 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
convert(prstGeom); convert(prstGeom);
convert(custGeom); convert(custGeom);
bool bLine = prstGeom ? (prstGeom->prst.get() == L"line") : false; bool bLine = odf_context()->drawing_context()->isLineShape();
if (!bLine) if (!bLine)
{ {
...@@ -526,19 +536,52 @@ void OoxConverter::convert(PPTX::Logic::PrstGeom *oox_geom) ...@@ -526,19 +536,52 @@ void OoxConverter::convert(PPTX::Logic::PrstGeom *oox_geom)
for (size_t i = 0; i < oox_geom->avLst.size(); i++) for (size_t i = 0; i < oox_geom->avLst.size(); i++)
{ {
if (oox_geom->avLst[i].fmla.IsInit()) odf_context()->drawing_context()->add_modifier(oox_geom->avLst[i].fmla.get_value_or(L"0"));
odf_context()->drawing_context()->add_modifier(oox_geom->avLst[i].fmla.get());
} }
} }
void OoxConverter::convert(PPTX::Logic::CustGeom *oox_cust_geom) void OoxConverter::convert(PPTX::Logic::CustGeom *oox_cust_geom)
{ {
if (!oox_cust_geom) return; if (!oox_cust_geom) return;
for (size_t i = 0; i < oox_cust_geom->gdLst.size(); i++)
{
odf_context()->drawing_context()->add_formula(oox_cust_geom->gdLst[i].name.get_value_or(L""), oox_cust_geom->gdLst[i].fmla.get_value_or(L""));
}
for (size_t i = 0; i < oox_cust_geom->pathLst.size(); i++) for (size_t i = 0; i < oox_cust_geom->pathLst.size(); i++)
{ {
convert(&oox_cust_geom->pathLst[i]); convert(&oox_cust_geom->pathLst[i]);
} }
for (size_t i = 0; i < oox_cust_geom->avLst.size(); i++)
{
odf_context()->drawing_context()->add_modifier(oox_cust_geom->avLst[i].fmla.get_value_or(L"0"));
}
for (size_t i = 0; i < oox_cust_geom->ahLst.size(); i++)
{
convert(oox_cust_geom->ahLst[i].ah.operator->());
}
if (oox_cust_geom->rect.IsInit())
{
odf_context()->drawing_context()->set_textarea (oox_cust_geom->rect->l.get_value_or(L"0"),
oox_cust_geom->rect->t.get_value_or(L"0"),
oox_cust_geom->rect->r.get_value_or(L"0"),
oox_cust_geom->rect->b.get_value_or(L"0"));
}
}
void OoxConverter::convert(PPTX::Logic::AhXY *oox_handle)
{
if (!oox_handle) return;
odf_context()->drawing_context()->add_handle(oox_handle->x, oox_handle->y,
oox_handle->gdRefX.get_value_or(L""), oox_handle->gdRefY.get_value_or(L""),
oox_handle->minX.get_value_or(L""), oox_handle->maxX.get_value_or(L""),
oox_handle->minX.get_value_or(L""), oox_handle->maxY.get_value_or(L""));
} }
void OoxConverter::convert(PPTX::Logic::AhPolar *oox_handle)
{
if (!oox_handle) return;
}
void OoxConverter::convert(PPTX::Logic::EffectLst *oox_effect_list) void OoxConverter::convert(PPTX::Logic::EffectLst *oox_effect_list)
{ {
if (!oox_effect_list) return; if (!oox_effect_list) return;
...@@ -616,44 +659,20 @@ void OoxConverter::convert(PPTX::Logic::PathBase *oox_path) ...@@ -616,44 +659,20 @@ void OoxConverter::convert(PPTX::Logic::PathBase *oox_path)
{ {
if (!oox_path) return; if (!oox_path) return;
PPTX::Logic::MoveTo* moveTo = dynamic_cast<PPTX::Logic::MoveTo*> (oox_path); PPTX::Logic::MoveTo* moveTo = dynamic_cast<PPTX::Logic::MoveTo*> (oox_path);
PPTX::Logic::LineTo* lineTo = dynamic_cast<PPTX::Logic::LineTo*> (oox_path); PPTX::Logic::LineTo* lineTo = dynamic_cast<PPTX::Logic::LineTo*> (oox_path);
PPTX::Logic::CubicBezTo* cubicBezTo = dynamic_cast<PPTX::Logic::CubicBezTo*> (oox_path); PPTX::Logic::CubicBezTo* cubicBezTo = dynamic_cast<PPTX::Logic::CubicBezTo*>(oox_path);
PPTX::Logic::Close* close = dynamic_cast<PPTX::Logic::Close*> (oox_path); PPTX::Logic::Close* close = dynamic_cast<PPTX::Logic::Close*> (oox_path);
PPTX::Logic::ArcTo* arcTo = dynamic_cast<PPTX::Logic::ArcTo*> (oox_path); PPTX::Logic::ArcTo* arcTo = dynamic_cast<PPTX::Logic::ArcTo*> (oox_path);
PPTX::Logic::QuadBezTo* quadBezTo = dynamic_cast<PPTX::Logic::QuadBezTo*> (oox_path); PPTX::Logic::QuadBezTo* quadBezTo = dynamic_cast<PPTX::Logic::QuadBezTo*> (oox_path);
if (moveTo) if (moveTo) convert(moveTo);
{ if (lineTo) convert(lineTo);
std::wstring path_elm = moveTo->x + L" " + moveTo->y; if (cubicBezTo) convert(cubicBezTo);
odf_context()->drawing_context()->add_path_element(std::wstring(L"M"), path_elm); if (quadBezTo) convert(quadBezTo);
} if (arcTo) convert(arcTo);
if (lineTo) if (close) convert(close);
{
std::wstring path_elm = lineTo->x + L" " + lineTo->y;
odf_context()->drawing_context()->add_path_element(std::wstring(L"L"), path_elm);
}
if (cubicBezTo)
{
std::wstring path_elm = cubicBezTo->x[0] + L" " + cubicBezTo->y[0] + L" " +
cubicBezTo->x[1] + L" " + cubicBezTo->y[1] + L" " +
cubicBezTo->x[2] + L" " + cubicBezTo->y[2];
odf_context()->drawing_context()->add_path_element(std::wstring(L"C"), path_elm);
}
if (quadBezTo)
{
std::wstring path_elm = quadBezTo->x[0] + L" " + quadBezTo->y[0] + L" " +
quadBezTo->x[1] + L" " + quadBezTo->y[1];
odf_context()->drawing_context()->add_path_element(std::wstring(L"S"), path_elm);
}
if (arcTo)
{
}
if (close)
{
std::wstring path_elm ;
odf_context()->drawing_context()->add_path_element(std::wstring(L"Z"), path_elm);
}
} }
...@@ -810,7 +829,7 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB) ...@@ -810,7 +829,7 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB)
} }
void OoxConverter::convert(PPTX::Logic::UniColor * color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD nARGB) void OoxConverter::convert(PPTX::Logic::UniColor * color, DWORD & nARGB)
{ {
if (!color) return; if (!color) return;
...@@ -818,6 +837,13 @@ void OoxConverter::convert(PPTX::Logic::UniColor * color, std::wstring & hexStri ...@@ -818,6 +837,13 @@ void OoxConverter::convert(PPTX::Logic::UniColor * color, std::wstring & hexStri
smart_ptr<PPTX::Theme> theme(oox_theme()); theme.AddRef(); smart_ptr<PPTX::Theme> theme(oox_theme()); theme.AddRef();
nARGB = color->GetRGBColor(theme, clrMap, nARGB); nARGB = color->GetRGBColor(theme, clrMap, nARGB);
}
void OoxConverter::convert(PPTX::Logic::UniColor * color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD nARGB)
{
if (!color) return;
convert(color, nARGB);
hexString = XmlUtils::IntToString(nARGB & 0x00FFFFFF, L"#%06X"); hexString = XmlUtils::IntToString(nARGB & 0x00FFFFFF, L"#%06X");
...@@ -896,7 +922,7 @@ void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB, PPTX::Log ...@@ -896,7 +922,7 @@ void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB, PPTX::Log
{ {
if (oox_line_prop->headEnd->len.IsInit() || oox_line_prop->headEnd->type.IsInit() || oox_line_prop->headEnd->w.IsInit()) if (oox_line_prop->headEnd->len.IsInit() || oox_line_prop->headEnd->type.IsInit() || oox_line_prop->headEnd->w.IsInit())
{ {
int type = 0, w=1, len =1;//medium arrow int type = 0, w = 1, len = 1;//medium arrow
if (oox_line_prop->headEnd->len.IsInit()) len = oox_line_prop->headEnd->len->GetBYTECode(); if (oox_line_prop->headEnd->len.IsInit()) len = oox_line_prop->headEnd->len->GetBYTECode();
if (oox_line_prop->headEnd->type.IsInit()) type = oox_line_prop->headEnd->type->GetBYTECode(); if (oox_line_prop->headEnd->type.IsInit()) type = oox_line_prop->headEnd->type->GetBYTECode();
if (oox_line_prop->headEnd->w.IsInit()) w = oox_line_prop->headEnd->w->GetBYTECode(); if (oox_line_prop->headEnd->w.IsInit()) w = oox_line_prop->headEnd->w->GetBYTECode();
...@@ -908,7 +934,7 @@ void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB, PPTX::Log ...@@ -908,7 +934,7 @@ void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB, PPTX::Log
{ {
if (oox_line_prop->tailEnd->len.IsInit() || oox_line_prop->tailEnd->type.IsInit() || oox_line_prop->tailEnd->w.IsInit()) if (oox_line_prop->tailEnd->len.IsInit() || oox_line_prop->tailEnd->type.IsInit() || oox_line_prop->tailEnd->w.IsInit())
{ {
int type =0, w=1, len =1;//medium arrow int type = 0, w = 1, len = 1;//medium arrow
if (oox_line_prop->tailEnd->len.IsInit()) len = oox_line_prop->tailEnd->len->GetBYTECode(); if (oox_line_prop->tailEnd->len.IsInit()) len = oox_line_prop->tailEnd->len->GetBYTECode();
if (oox_line_prop->tailEnd->type.IsInit()) type = oox_line_prop->tailEnd->type->GetBYTECode(); if (oox_line_prop->tailEnd->type.IsInit()) type = oox_line_prop->tailEnd->type->GetBYTECode();
if (oox_line_prop->tailEnd->w.IsInit()) w = oox_line_prop->tailEnd->w->GetBYTECode(); if (oox_line_prop->tailEnd->w.IsInit()) w = oox_line_prop->tailEnd->w->GetBYTECode();
...@@ -1487,10 +1513,9 @@ void OoxConverter::convert(PPTX::Logic::ArcTo *oox_geom_path) ...@@ -1487,10 +1513,9 @@ void OoxConverter::convert(PPTX::Logic::ArcTo *oox_geom_path)
{ {
if (!oox_geom_path) return; if (!oox_geom_path) return;
//std::wstring path_elm = std::to_wstring ((int)pt2emu(oox_geom_path->m_oPt.m_oX.GetValue())) + std::wstring path_elm = oox_geom_path->hR + L" " + oox_geom_path->wR + L" " + oox_geom_path->swAng + L" " + oox_geom_path->stAng;
// std::wstring(L" ")+ std::to_wstring ((int)pt2emu(oox_geom_path->m_oPt.m_oY.GetValue()));
// odf_context()->drawing_context()->add_path_element(std::wstring(L"G"), path_elm);
//odf_context()->drawing_context()->add_path_element(std::wstring(L"A"), path_elm);
} }
void OoxConverter::convert(PPTX::Logic::QuadBezTo *oox_geom_path) void OoxConverter::convert(PPTX::Logic::QuadBezTo *oox_geom_path)
{ {
...@@ -1521,14 +1546,19 @@ void OoxConverter::convert(PPTX::Logic::Close *oox_geom_path) ...@@ -1521,14 +1546,19 @@ void OoxConverter::convert(PPTX::Logic::Close *oox_geom_path)
void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type) void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type)
{ {
if (!style_ref) return; if (!style_ref) return;
DWORD nARGB = 0;
convert(&style_ref->Color, nARGB);
if (style_ref->idx.IsInit() == false) if (style_ref->idx.IsInit() == false)
{ {
std::wstring hexColor; std::wstring hexColor = XmlUtils::IntToString(nARGB & 0x00FFFFFF, L"#%06X");
_CP_OPT(double) opacity; _CP_OPT(double) opacity;
convert(&style_ref->Color, hexColor, opacity); if ((nARGB >> 24) != 0xff)
{
opacity = ((nARGB >> 24) /255.) * 100.;
}
if (type != 3) //?? todooo if (type != 3) //?? todooo
{ {
...@@ -1568,14 +1598,14 @@ void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type) ...@@ -1568,14 +1598,14 @@ void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type)
} }
} }
convert(fill, style_ref->Color.GetARGB()); convert(fill, nARGB);
} }
else if (type == 2) else if (type == 2)
{ {
index -= 1; index -= 1;
if ((index >= 0) || (index < theme->themeElements.fmtScheme.lnStyleLst.size())) if ((index >= 0) || (index < theme->themeElements.fmtScheme.lnStyleLst.size()))
{ {
convert(&theme->themeElements.fmtScheme.lnStyleLst[index], style_ref->Color.GetARGB()); convert(&theme->themeElements.fmtScheme.lnStyleLst[index], nARGB);
} }
} }
else if (type == 3) else if (type == 3)
......
...@@ -181,6 +181,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -181,6 +181,14 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
{ {
convert(dynamic_cast<PPTX::Logic::CustGeom*>(oox_unknown)); convert(dynamic_cast<PPTX::Logic::CustGeom*>(oox_unknown));
}break; }break;
case OOX::et_a_ahXY:
{
convert(dynamic_cast<PPTX::Logic::AhXY*>(oox_unknown));
}break;
case OOX::et_a_ahPolar:
{
convert(dynamic_cast<PPTX::Logic::AhPolar*>(oox_unknown));
}break;
case OOX::et_a_lnTo: case OOX::et_a_lnTo:
{ {
convert(dynamic_cast<PPTX::Logic::LineTo*>(oox_unknown)); convert(dynamic_cast<PPTX::Logic::LineTo*>(oox_unknown));
......
...@@ -322,6 +322,8 @@ namespace PPTX ...@@ -322,6 +322,8 @@ namespace PPTX
class InnerShdw; class InnerShdw;
class OuterShdw; class OuterShdw;
class PrstShdw; class PrstShdw;
class AhXY;
class AhPolar;
} }
} }
...@@ -390,6 +392,7 @@ public: ...@@ -390,6 +392,7 @@ public:
void convert(PPTX::Logic::PathBase *oox_path); void convert(PPTX::Logic::PathBase *oox_path);
void convert(PPTX::Logic::BodyPr *oox_bodyPr); void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0); void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::UniColor *color, DWORD & nARGB);
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0); void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
void convert(PPTX::Logic::NvSpPr *oox_nvSpPr); void convert(PPTX::Logic::NvSpPr *oox_nvSpPr);
void convert(PPTX::Logic::CNvPr *oox_cnvPr); void convert(PPTX::Logic::CNvPr *oox_cnvPr);
...@@ -417,6 +420,8 @@ public: ...@@ -417,6 +420,8 @@ public:
void convert(PPTX::Logic::QuadBezTo *oox_geom_path); void convert(PPTX::Logic::QuadBezTo *oox_geom_path);
void convert(PPTX::Logic::CubicBezTo *oox_geom_path); void convert(PPTX::Logic::CubicBezTo *oox_geom_path);
void convert(PPTX::Logic::Close *oox_geom_path); void convert(PPTX::Logic::Close *oox_geom_path);
void convert(PPTX::Logic::AhXY *oox_handle);
void convert(PPTX::Logic::AhPolar *oox_handle);
void convert(PPTX::Logic::EffectStyle *oox_effect); void convert(PPTX::Logic::EffectStyle *oox_effect);
void convert(PPTX::Logic::EffectLst *oox_effect_list); void convert(PPTX::Logic::EffectLst *oox_effect_list);
void convert(PPTX::Logic::InnerShdw *oox_effect); void convert(PPTX::Logic::InnerShdw *oox_effect);
......
<?xml version="1.0" encoding="windows-1251"?> <?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8.00"
Name="Oox2OdfConverter" Name="Oox2OdfConverter"
ProjectGUID="{BEE01B53-244A-44E6-8947-ED9342D9247E}" ProjectGUID="{BEE01B53-244A-44E6-8947-ED9342D9247E}"
RootNamespace="Oox2OdfConverter" RootNamespace="Oox2OdfConverter"
......
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