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

(1.2.0.111): ASCOfficeOdfFileW


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57594 954022d7-b5bf-4e40-9824-e11837661b57
parent b774679f
......@@ -1348,11 +1348,11 @@
>
</File>
<File
RelativePath=".\OdfFormat\shapes\oox_shapeCurvedArrows.h"
RelativePath=".\OdfFormat\Shapes\oox_shapeConnectors.h"
>
</File>
<File
RelativePath=".\OdfFormat\shapes\oox_shapeCurvedConnectors.h"
RelativePath=".\OdfFormat\shapes\oox_shapeCurvedArrows.h"
>
</File>
<File
......
......@@ -178,7 +178,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"" , 7}, // shapetypeStar6,
{ L"" , 7}, // shapetypeStar7,
{ L"star8" , 7}, // shapetypeStar8,
{ L"mso-spt32" , 7}, // shapetypeStraightConnector1,
{ L"mso-spt32" , 9}, // shapetypeStraightConnector1,
{ L"striped-right-arrow" , 7}, // shapetypeStripedRightArrow,
{ L"" , 7}, // shapetypeSun,
{ L"" , 7}, // shapetypeSwooshArrow,
......
......@@ -471,7 +471,7 @@ const wchar_t * draw_connector::name = L"connector";
void draw_connector::serialize(std::wostream & _Wostream)
{
sub_type_ = 5; // - , ( ) -
sub_type_ = 9; // - , ( ) -
reset_svg_path();
......
......@@ -516,7 +516,7 @@ void odf_drawing_context::Impl::create_draw_base(int type)
odf_element_state state={draw_elm, style_name, style_shape_elm, level};
current_drawing_state_.elements_.push_back(state);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
void odf_drawing_context::start_shape(int type)
......@@ -551,16 +551,40 @@ void odf_drawing_context::end_shape()
path->draw_path_attlist_.svg_viewbox_ = impl_->current_drawing_state_.view_box_;
}
////////////////////////////////////////////////////////////////////////////////////
draw_connector* connector = dynamic_cast<draw_connector*>(impl_->current_level_.back().get());
if (connector)
{
if (!connector->draw_connector_attlist_.draw_type_) connector->draw_connector_attlist_.draw_type_ = L"line";
if (impl_->current_drawing_state_.svg_x_)connector->draw_line_attlist_.svg_x1_ = impl_->current_drawing_state_.svg_x_;
else connector->draw_line_attlist_.svg_x1_ = length(0,length::cm);
if (impl_->current_drawing_state_.svg_y_)connector->draw_line_attlist_.svg_y1_ = impl_->current_drawing_state_.svg_y_;
else connector->draw_line_attlist_.svg_y1_ = length(0,length::cm);
connector->draw_line_attlist_.svg_x2_ = connector->draw_line_attlist_.svg_x1_;
connector->draw_line_attlist_.svg_y2_ = connector->draw_line_attlist_.svg_y1_;
if (impl_->current_drawing_state_.svg_width_)
connector->draw_line_attlist_.svg_x2_ = connector->draw_line_attlist_.svg_x2_.get() + impl_->current_drawing_state_.svg_width_.get();
if (impl_->current_drawing_state_.svg_height_)
connector->draw_line_attlist_.svg_y2_ = connector->draw_line_attlist_.svg_y2_.get() + impl_->current_drawing_state_.svg_height_.get();
}
////////////////////////////////////////////////////////////////////////////////////////////
draw_line* line = dynamic_cast<draw_line*>(impl_->current_level_.back().get());
if (line)
{
line->draw_line_attlist_.svg_x1_ = impl_->current_drawing_state_.svg_x_;
line->draw_line_attlist_.svg_y1_ = impl_->current_drawing_state_.svg_y_;
if (impl_->current_drawing_state_.svg_x_ && impl_->current_drawing_state_.svg_width_)
line->draw_line_attlist_.svg_x2_ = impl_->current_drawing_state_.svg_x_.get() + impl_->current_drawing_state_.svg_width_.get();
if (impl_->current_drawing_state_.svg_y_ && impl_->current_drawing_state_.svg_height_)
line->draw_line_attlist_.svg_y2_ = impl_->current_drawing_state_.svg_y_.get() + impl_->current_drawing_state_.svg_height_.get();
}
//////////////////////////////////////////////////////////////////////////////////////////////////
draw_custom_shape* custom = dynamic_cast<draw_custom_shape*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (custom)
......@@ -717,14 +741,14 @@ void odf_drawing_context::end_line_properies()
{
impl_->current_drawing_part_ = Unknown;
}
void odf_drawing_context::start_shadow_properies()
{
impl_->current_drawing_part_ = Shadow;
}
void odf_drawing_context::end_shadow_properies()
{
impl_->current_drawing_part_ = Unknown;
}
//void odf_drawing_context::start_shadow_properies()
//{
// impl_->current_drawing_part_ = Shadow;
//}
//void odf_drawing_context::end_shadow_properies()
//{
// impl_->current_drawing_part_ = Unknown;
//}
////////////////////////////////////////////////////////////////////
void odf_drawing_context::set_name(std::wstring name)
{
......@@ -733,6 +757,7 @@ void odf_drawing_context::set_name(std::wstring name)
void odf_drawing_context::set_opacity(double percent_)
{
if (!impl_->current_graphic_properties)return;
if (percent_ < 0.01) return;
switch(impl_->current_drawing_part_)
{
......@@ -862,8 +887,8 @@ void odf_drawing_context::set_drawings_rect(double x_pt, double y_pt, double wid
impl_->width = width_pt;
impl_->height = height_pt;
if (width_pt >= 0) impl_->anchor_settings_.svg_height_ = length(length(height_pt,length::pt).get_value_unit(length::cm),length::cm);
if (height_pt >= 0)impl_->anchor_settings_.svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm);
if (height_pt >= 0) impl_->anchor_settings_.svg_height_ = length(length(height_pt,length::pt).get_value_unit(length::cm),length::cm);
if (width_pt >= 0) impl_->anchor_settings_.svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_drawing_context::set_margin_left (double valPt)
{
......@@ -1119,20 +1144,86 @@ void odf_drawing_context::set_line_width(double pt)
impl_->current_graphic_properties->content().svg_stroke_width_ = length(length(pt,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_drawing_context::set_line_head(int type, int len, int width)
void odf_drawing_context::set_line_tail(int type, int len, int width)
{
if (!impl_->current_graphic_properties)return;
// ,
//impl_->current_graphic_properties->content().draw_marker_start_ = marker_style(marker_style::from_ms(type));
impl_->current_graphic_properties->content().draw_marker_start_ = add_marker_style(type);
switch(width)
{
case 0://lineendwidthLarge
impl_->current_graphic_properties->content().draw_marker_end_width_ = length(0.4,length::cm); break;
case 1://lineendwidthMedium
impl_->current_graphic_properties->content().draw_marker_end_width_ = length(0.3,length::cm); break;
case 2://lineendwidthSmall
impl_->current_graphic_properties->content().draw_marker_end_width_ = length(0.2,length::cm); break;
}
}
void odf_drawing_context::set_line_tail(int type, int len, int width)
void odf_drawing_context::set_line_head(int type, int len, int width)
{
if (!impl_->current_graphic_properties)return;
// ,
impl_->current_graphic_properties->content().draw_marker_end_ = add_marker_style(type);
switch(width)
{
case 0://lineendwidthLarge
impl_->current_graphic_properties->content().draw_marker_start_width_ = length(0.4,length::cm); break;
case 1://lineendwidthMedium
impl_->current_graphic_properties->content().draw_marker_start_width_ = length(0.3,length::cm); break;
case 2://lineendwidthSmall
impl_->current_graphic_properties->content().draw_marker_start_width_ = length(0.2,length::cm); break;
}
}
std::wstring odf_drawing_context::add_marker_style(int type)
{
if (type == 2) return L"";
std::wstring str_types [] = {L"ArrowMarker", L"DiamondMarker", L"None", L"OvalMarker", L"StealthMarker", L"TriangleMarker"};
style * style_=NULL;
if (impl_->styles_context_->find_odf_style(str_types[type],style_family::Marker,style_)) return str_types[type];
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
odf::office_element_ptr marker_element;
odf::create_element(L"draw",L"marker", marker_element, impl_->odf_context_);
impl_->styles_context_->add_style(marker_element,false,true, style_family::Marker);
impl_->styles_context_->last_state()->set_name(str_types[type]);
draw_marker * marker = dynamic_cast<draw_marker *>(marker_element.get());
if (!marker) return L"";
marker->draw_name_ = str_types[type];
marker->draw_display_name_ = str_types[type]; ;
switch(type)
{
case 1:
marker->svg_d_ = L"M0 564l564 567 567-567-567-564z";
marker->svg_viewBox_ = L"0 0 1131 1131";
break;
case 3:
marker->svg_d_ = L"M462 1118l-102-29-102-51-93-72-72-93-51-102-29-102-13-105 13-102 29-106 51-102 72-89 93-72 102-50 102-34 106-9 101 9 106 34 98 50 93 72 72 89 51 102 29 106 13 102-13 105-29 102-51 102-72 93-93 72-98 51-106 29-101 13z";
marker->svg_viewBox_ = L"0 0 1131 1131";
break;
case 4:
marker->svg_d_ = L"M1013 1491l118 89-567-1580-564 1580 114-85 136-68 148-46 161-17 161 13 153 46z";
marker->svg_viewBox_ = L"0 0 1131 1580";
break;
case 5:
marker->svg_d_ = L"M1321 3493h-1321l702-3493z";
marker->svg_viewBox_ = L"0 0 1321 3493";
break;
case 0:
default:
marker->svg_d_ =L"M0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z";
marker->svg_viewBox_ = L"0 0 1122 2243";
}
//impl_->current_graphic_properties->content().draw_marker_end_ = marker_style(marker_style::from_ms(type));
return str_types[type];
}
void odf_drawing_context::set_line_dash_preset(int style)
{
......
......@@ -122,10 +122,12 @@ public:
void set_line_head(int type, int len, int width);
void set_line_tail(int type, int len, int width);
std::wstring add_marker_style(int type);
void end_line_properies();
void start_shadow_properies();
void end_shadow_properies();
//void start_shadow_properies();
//void end_shadow_properies();
// ..
void set_shadow(int type, std::wstring hexColor, _CP_OPT(double) opacity, double dist_pt, double dist_pt_y = -1);
......
......@@ -68,7 +68,6 @@ void odf_style_context::create_style(std::wstring oox_name, style_family::type f
style_state_list_.back()->set_root(root);
style_state_list_.back()->style_oox_id_ = oox_id;
style_state_list_.back()->style_oox_name_ = oox_name;
}
void odf_style_context::add_style(office_element_ptr elm, bool automatic, bool root, style_family::type family)
......
......@@ -47,6 +47,8 @@ void odf_style_state::add_child(office_element_ptr & child)
void odf_style_state::set_name(std::wstring & name)
{
odf_style_name_ = name;
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_)return;
......@@ -64,8 +66,8 @@ void odf_style_state::set_display_name(std::wstring & name)
std::wstring odf_style_state::get_name()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_)
return L"";
if (!style_)return odf_style_name_;
return style_->style_name_;
}
......
......@@ -73,7 +73,8 @@ public:
//style_drawing_page_properties* get_drawing_page_properties();
private:
std::wstring style_oox_name_;
std::wstring odf_style_name_;
std::wstring oox_style_name_;
//
int style_oox_id_;
......
......@@ -29,6 +29,7 @@ odf_text_context::odf_text_context(odf_conversion_context *odf_context)
text_properties_ = NULL;
current_outline_ = 0;
in_field_ = false;
}
odf_text_context::~odf_text_context()
{
......@@ -202,6 +203,7 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
if (h)p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(parent_paragraph_style_);
}
if (paragraph_properties_)paragraph_properties_->content().fo_break_before_ = need_break_;
need_break_ = boost::none;
odf_element_state state={elm, style_name, style_elm,level};
text_elements_list_.push_back(state);
......@@ -219,7 +221,7 @@ void odf_text_context::end_paragraph()
current_level_.pop_back();
}
paragraph_properties_ = NULL;
need_break_ = boost::none;
//need_break_ = boost::none;
}
void odf_text_context::start_element(office_element_ptr & elm, office_element_ptr style_elm ,std::wstring style_name)
......@@ -298,6 +300,36 @@ void odf_text_context::end_span()
text_properties_ = NULL;
}
void odf_text_context::start_field(int type)
{
if (single_paragraph_ == true) return;
office_element_ptr elm;
if (type == 2)
{
create_element(L"text", L"page-number", elm, odf_context_);
text_page_number *page_numb = dynamic_cast<text_page_number*>(elm.get());
if (page_numb)
{
page_numb->text_select_page_ = L"current";
}
}
if (elm)
{
in_field_ = true;
start_element(elm);
}
}
void odf_text_context::end_field()
{
if (single_paragraph_ == true) return;
if (in_field_ == false) return;
end_element();
in_field_ = false;
}
void odf_text_context::set_outline_level(int level)
{
current_outline_ = level;
......@@ -332,49 +364,21 @@ void odf_text_context::add_tab()
if (current_level_.size()>0)
current_level_.back().elm->add_child_element(elm);
}
void odf_text_context::add_page_break()
{
//office_element_ptr elm;
//create_element(L"text", L"soft-page-break", elm, odf_context_);
//
//if (current_level_.size()>0)
//{
// text_p* para = NULL;
// //http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415190_253892949
// // !! span, ... !!
// if (para = dynamic_cast<text_p*>(current_level_.back().elm.get()))
// {
// end_paragraph();
// }
// current_level_.back().elm->add_child_element(elm);
// if (para)
// {
// bool styled = para->paragraph_.paragraph_attrs_.text_style_name_ ? true : false;
// start_paragraph(styled);
// }
//}
}
void odf_text_context::add_break(int type, int clear)
{
//brclearAll = 0,
//brclearLeft = 1,
//brclearNone = 2,
//brclearRight = 3
//brtypeColumn = 0,
//brtypePage = 1,
//brtypeTextWrapping = 2
if (type == 0)
if (type == 0)//brtypeColumn
{
need_break_= fo_break(fo_break::Column);
}
else if (type == 1)
else if (type == 1)//brtypePage
{
need_break_ = fo_break(fo_break::Page);
}
else
else //brtypeTextWrapping
{
office_element_ptr elm;
create_element(L"text", L"line-break", elm, odf_context_);
......
......@@ -51,14 +51,18 @@ public:
void start_element(office_element_ptr & elm, office_element_ptr style_elm = office_element_ptr(),std::wstring style_name = L"");
void end_element();
void start_span(bool styled = false);
void start_field(int type);
void end_field();
void start_span (bool styled = false);
void end_span();
void add_break(int type, int clear);
void add_page_break();
void add_tab();
int current_outline_;
bool in_field_;
std::vector<odf_element_state> current_level_;//
std::vector<odf_element_state> text_elements_list_;//, , ...
......
......@@ -294,6 +294,13 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
}
}
res1 = instr.find(L"PAGE");
if (res1 >=0)
{
current_field_.type = 2;
}
}
void odt_conversion_context::start_field()
{
......@@ -383,6 +390,7 @@ void odt_conversion_context::end_field()
if (current_field_.enabled && current_field_.started)
{
if (current_field_.type == 1) end_hyperlink();
else text_context()->end_field();
}
current_field_.enabled = false;
current_field_.started = false;
......@@ -429,16 +437,29 @@ void odt_conversion_context::start_run(bool styled)
if (is_hyperlink_ && text_context_.size() > 0) return;
text_context()->start_span(styled);
if (current_field_.started== false && current_field_.type >1 && current_field_.enabled ==true)// span -
{
text_context()->start_field(current_field_.type);
current_field_.started = true;
}
}
void odt_conversion_context::end_run()
{
if (is_hyperlink_ && text_context_.size() > 0) return;
if (current_field_.started== true && current_field_.type >1 && current_field_.enabled ==true)
{
end_field();
}
text_context()->end_span();
if (current_field_.started== false && current_field_.type >0 && current_field_.enabled ==true)
if (current_field_.started== false && current_field_.type == 1 && current_field_.enabled ==true)
{
if (current_field_.type == 1)start_hyperlink(current_field_.value);
// "" - ...
start_hyperlink(current_field_.value);
current_field_.started = true;
}
}
......
......@@ -10,6 +10,7 @@
#include "Shapes\oox_shapeCharts.h"
#include "Shapes\oox_shapePrimitives.h"
#include "Shapes\oox_shapeRibbons.h"
#include "Shapes\oox_shapeConnectors.h"
#include "..\..\..\Common\DocxFormat\Source\Common\SimpleTypes_Drawing.h"
......@@ -36,6 +37,8 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
case SimpleTypes::shapetypeStar16: return boost::make_shared<oox_shape_star16>();
case SimpleTypes::shapetypeStar32: return boost::make_shared<oox_shape_star32>();
//case SimpleTypes::shapetypeStraightConnector1: return boost::make_shared<oox_shape_straightConnector1>();
default:
return boost::make_shared<oox_shape>();
......
......@@ -384,11 +384,10 @@ void text_ruby::add_text(const std::wstring & Text)
//////////////////////////////////////////////////////////////////////////////////////////////////
//void common_field_fixed_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
//{
// CP_XML_ATTR_OPT(L"text:fixed", text_fixed_);
//}
void common_field_fixed_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"text:fixed", text_fixed_);
}
// text:title
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_title::ns = L"text";
......@@ -462,10 +461,12 @@ void text_page_number::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
// //text:select-page
// //common-field-num-format-attlist"/> ---- //style:num-format="1"/>
// //common-field-fixed-attlist"/>
// //text:page-adjust="1"
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"text:page-adjust",text_page_adjust_);
CP_XML_ATTR_OPT(L"text:select-page",text_select_page_);
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
......@@ -501,6 +502,8 @@ void text_page_count::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
......@@ -536,9 +539,8 @@ void text_date::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
// CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
// CP_XML_ATTR_OPT(L"text:fixed", text_fixed_);
// CP_XML_ATTR_OPT(L"text:date-value", text_date_value_);
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
......@@ -573,9 +575,9 @@ void text_time::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"text:fixed", text_fixed_);
CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
CP_XML_ATTR_OPT(L"text:time-value", text_time_value_);
BOOST_FOREACH(const office_element_ptr & elm, text_)
......@@ -615,6 +617,8 @@ void text_file_name::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
common_field_fixed_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, text_)
{
elm->serialize(CP_XML_STREAM());
......
......@@ -399,7 +399,7 @@ class common_field_fixed_attlist
{
public:
_CP_OPT(bool) text_fixed_;
_CP_OPT(Bool) text_fixed_;
void serialize(CP_ATTR_NODE);
......@@ -471,6 +471,11 @@ public:
virtual void serialize(std::wostream & _Wostream);
common_num_format_attlist common_num_format_attlist_;
common_field_fixed_attlist common_field_fixed_attlist_;
_CP_OPT(int) text_page_adjust_;
_CP_OPT(std::wstring) text_select_page_;
virtual void add_text(const std::wstring & Text);
......@@ -498,6 +503,8 @@ public:
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
private:
office_element_ptr_array text_;
};
......@@ -522,9 +529,9 @@ public:
virtual void add_text(const std::wstring & Text);
_CP_OPT(std::wstring) style_data_style_name_;
common_field_fixed_attlist common_field_fixed_attlist_;
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(std::wstring) text_date_value_;//with format
office_element_ptr_array text_;
......@@ -549,11 +556,11 @@ public:
virtual void serialize(std::wostream & _Wostream);
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
_CP_OPT(std::wstring) style_data_style_name_;
_CP_OPT(bool) text_fixed_;
_CP_OPT(std::wstring) text_time_value_;//with format
office_element_ptr_array text_;
......@@ -580,6 +587,8 @@ public:
virtual void add_text(const std::wstring & Text);
common_field_fixed_attlist common_field_fixed_attlist_;
private:
// TODO: attributes
office_element_ptr_array text_;
......
......@@ -33,6 +33,8 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
CP_XML_ATTR_OPT(L"draw:stroke-dash", draw_stroke_dash_);
CP_XML_ATTR_OPT(L"draw:marker-start", draw_marker_start_);
CP_XML_ATTR_OPT(L"draw:marker-end", draw_marker_end_);
CP_XML_ATTR_OPT(L"draw:marker-start-width", draw_marker_start_width_);
CP_XML_ATTR_OPT(L"draw:marker-end-width", draw_marker_end_width_);
CP_XML_ATTR_OPT(L"svg:stroke-color", svg_stroke_color_);
CP_XML_ATTR_OPT(L"svg:stroke-width", svg_stroke_width_);
CP_XML_ATTR_OPT(L"svg:stroke-opacity", svg_stroke_opacity_);
......
......@@ -53,6 +53,9 @@ public:
_CP_OPT(marker_style) draw_marker_end_;
_CP_OPT(marker_style) draw_marker_start_;
_CP_OPT(length) draw_marker_start_width_;
_CP_OPT(length) draw_marker_end_width_;
_CP_OPT(text_align) draw_textarea_horizontal_align_;
_CP_OPT(vertical_align) draw_textarea_vertical_align_;
......
......@@ -221,7 +221,6 @@ void default_style::serialize(std::wostream & strm)
const wchar_t * draw_fill_image::ns = L"draw";
const wchar_t * draw_fill_image::name = L"fill-image";
void draw_fill_image::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
......@@ -239,6 +238,28 @@ void draw_fill_image::serialize(std::wostream & strm)
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_marker::ns = L"draw";
const wchar_t * draw_marker::name = L"marker";
void draw_marker::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
void draw_marker::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
CP_XML_ATTR_OPT(L"draw:display_name",draw_display_name_);
CP_XML_ATTR_OPT(L"svg:d", svg_d_);
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewBox_);
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_gradient::ns = L"draw";
const wchar_t * draw_gradient::name = L"gradient";
......
......@@ -217,6 +217,7 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(draw_opacity);
/// \class style_draw_fill_image
class draw_fill_image : public office_element_impl<draw_fill_image>
{
......@@ -239,10 +240,34 @@ public:
virtual void add_child_element(office_element_ptr & child)
{std::wstringstream str; str <<L"Non add child in "; str << ns; str << L":"; str <<name; _CP_LOG(error) << str.str();}
virtual void serialize(std::wostream & strm);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_fill_image);
/// \class style_draw_marker
class draw_marker : public office_element_impl<draw_marker>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleDrawMarker;
CPDOCCORE_DEFINE_VISITABLE();
std::wstring get_style_name(){return draw_name_.get_value_or(L"");}
_CP_OPT(std::wstring) svg_viewBox_;
_CP_OPT(std::wstring) svg_d_;
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_display_name_;
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child)
{std::wstringstream str; str <<L"Non add child in "; str << ns; str << L":"; str <<name; _CP_LOG(error) << str.str();}
virtual void serialize(std::wostream & strm);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_fill_image);
CP_REGISTER_OFFICE_ELEMENT2(draw_marker);
/////////////////////////////////////////////////////////////////////////////////////////////////
class style;
typedef shared_ptr<style>::Type style_ptr;
......
......@@ -100,6 +100,7 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style)
break;
}
}
if (height_pt == 0) height_pt = -1;
odf_context()->drawing_context()->set_drawings_rect(-1, -1, width_pt, height_pt);
}
void OoxConverter::convert(OOX::Vml::CShape *vml_shape)
......@@ -143,9 +144,13 @@ void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
void OoxConverter::convert(OOX::Vml::CArc *vml_arc)
{
if (vml_arc == NULL) return;
convert(vml_arc->m_oStyle.GetPointer());
}
void OoxConverter::convert(OOX::Vml::CBackground *vml_background)
{
if (vml_background == NULL) return;
}
void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
......@@ -166,15 +171,38 @@ void OoxConverter::convert(OOX::Vml::COval *vml_oval)
{
if (vml_oval == NULL) return;
convert(vml_oval->m_oStyle.GetPointer());
}
void OoxConverter::convert(OOX::Vml::CPath *vml_path)
{
if (vml_path == NULL) return;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oArrowOk;
//nullable<CString> m_oConnectAngles;
//nullable<CString> m_oConnectLocs;
//SimpleTypes::CConnectType<SimpleTypes::connecttypeNone> m_oConnectType;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oExtrusionOk;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oFillOk;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oGradientShapeOk;
//nullable<CString> m_oId;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oInsetPenOk;
//SimpleTypes::Vml::CVml_Vector2D_Units m_oLimo;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oShadowOk;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oStrokeOk;
//nullable<SimpleTypes::Vml::CVml_Polygon2D> m_oTextBoxRect;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oTextPathOk;
//nullable<SimpleTypes::Vml::CVmlPath> m_oV;
if (vml_path->m_oV.IsInit())
{
}
}
void OoxConverter::convert(OOX::Vml::CPolyLine *vml_polyline)
{
if (vml_polyline == NULL) return;
convert(vml_polyline->m_oStyle.GetPointer());
}
void OoxConverter::convert(OOX::Vml::CRect *vml_rect)
{
......@@ -182,8 +210,6 @@ void OoxConverter::convert(OOX::Vml::CRect *vml_rect)
convert(vml_rect->m_oStyle.GetPointer());
}
void OoxConverter::convert(OOX::Vml::CRoundRect *vml_roundrect)
......@@ -196,6 +222,8 @@ void OoxConverter::convert(OOX::Vml::CRoundRect *vml_roundrect)
void OoxConverter::convert(OOX::Vml::CCurve *vml_curve)
{
if (vml_curve == NULL) return;
convert(vml_curve->m_oStyle.GetPointer());
}
void OoxConverter::convert(OOX::Vml::CShadow *vml_shadow)
{
......@@ -203,7 +231,7 @@ void OoxConverter::convert(OOX::Vml::CShadow *vml_shadow)
if (vml_shadow->m_oOn.GetValue() == false) return;
std::wstring hexColor = string2std_string(vml_shadow->m_oColor.ToString());
_CP_OPT(double) opacity = vml_shadow->m_oOpacity.GetValue();
_CP_OPT(double) opacity = 100 - 100 * vml_shadow->m_oOpacity.GetValue();
double offset_x = vml_shadow->m_oOffset.IsXinPoints() ? vml_shadow->m_oOffset.GetX() : -1;
double offset_y = vml_shadow->m_oOffset.IsYinPoints() ? vml_shadow->m_oOffset.GetY() : -1;
......@@ -231,7 +259,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
if (hexColor.length() < 1)hexColor = L"000000";
odf_context()->drawing_context()->set_solid_fill(hexColor);
odf_context()->drawing_context()->set_opacity(vml_stroke->m_oOpacity.GetValue());
odf_context()->drawing_context()->set_opacity(100 - vml_stroke->m_oOpacity.GetValue() * 100);
odf_context()->drawing_context()->set_line_width(vml_stroke->m_oWeight.GetValue());
switch(vml_stroke->m_oStartArrow.GetValue())
......@@ -294,6 +322,7 @@ void OoxConverter::convert(OOX::Vml::CTextbox *vml_textbox)
}
void OoxConverter::convert(OOX::Vml::CTextPath *vml_textpath)
{
if (vml_textpath == NULL) return;
}
void OoxConverter::convert(OOX::VmlWord::CWrap *vml_wrap)
......
......@@ -160,6 +160,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Logic::CSdt* pP= static_cast<OOX::Logic::CSdt*>(oox_unknown);
convert(pP);
}break;
case OOX::et_w_fldSimple:
{
OOX::Logic::CFldSimple* pFldS= static_cast<OOX::Logic::CFldSimple*>(oox_unknown);
convert(pFldS);
}break;
case OOX::et_w_r:
{
OOX::Logic::CRun* pRun= static_cast<OOX::Logic::CRun*>(oox_unknown);
......@@ -438,6 +443,22 @@ void DocxConverter::convert(OOX::Logic::CFldChar *oox_fld)
}
}
void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
{
if (oox_fld == NULL) return;
//SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oDirty;
//SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oFldLock;
odt_context->start_field();
if (oox_fld->m_sInstr.IsInit()) odt_context->set_field_instr(string2std_string(oox_fld->m_sInstr.get2()));
for (long i=0; i< oox_fld->m_arrItems.GetSize(); i++)
{
convert(oox_fld->m_arrItems[i]);
}
odt_context->end_field();
}
void DocxConverter::convert(OOX::Logic::CInstrText *oox_instr)
{
if (oox_instr == NULL) return;
......@@ -1307,6 +1328,8 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
odt_context->start_drawings();
odt_context->drawing_context()->set_anchor(odf::anchor_type::AsChar); //???
//odt_context->drawing_context()->set_overlap(true);
//odt_context->drawing_context()->set_wrap_style(odf::style_wrap::Dynamic);
if (oox_pic->m_oShapeGroup.IsInit())
{
......@@ -1383,8 +1406,26 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
odf_context()->drawing_context()->end_shape();
}
else // and oox_pic->m_oShapeRect
{
bool bSet = false;
if (oox_pic->m_oShape.IsInit())
{
OOX::Vml::SptType sptType = static_cast<OOX::Vml::SptType>(oox_pic->m_oShape->m_oSpt.GetValue());
if (sptType != OOX::Vml::SptType::sptNotPrimitive)
{
odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType));
bSet = true;
}
else if (oox_pic->m_oShape->m_oConnectorType.GetValue() != SimpleTypes::connectortypeNone)
{
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeStraightConnector1);
bSet = true;
}
}
if (!bSet)
{
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect);
}
OoxConverter::convert(oox_pic->m_oShape.GetPointer());
odf_context()->drawing_context()->end_shape();
}
......@@ -1445,9 +1486,6 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor)
else
odt_context->drawing_context()->set_horizontal_pos(SimpleTypes::alignhLeft);
}
//if (oox_anchor->m_oWrapNone.IsInit())
//{
//}
if (oox_anchor->m_oWrapSquare.IsInit())
{
if (oox_anchor->m_oWrapSquare->m_oWrapText.IsInit() && oox_anchor->m_oWrapSquare->m_oWrapText->GetValue() == SimpleTypes::wraptextLargest)
......@@ -1455,19 +1493,19 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor)
else
odt_context->drawing_context()->set_wrap_style(odf::style_wrap::Parallel);
}
if (oox_anchor->m_oWrapThrough.IsInit())//style:wrap="run-through" draw:wrap-influence-on-position style:wrap-contour
else if (oox_anchor->m_oWrapThrough.IsInit())//style:wrap="run-through" draw:wrap-influence-on-position style:wrap-contour
{
odt_context->drawing_context()->set_wrap_style(odf::style_wrap::RunThrough);
}
if (oox_anchor->m_oWrapTight.IsInit())
else if (oox_anchor->m_oWrapTight.IsInit())
{
odt_context->drawing_context()->set_wrap_style(odf::style_wrap::Parallel);
}
if (oox_anchor->m_oWrapTopAndBottom.IsInit())
else if (oox_anchor->m_oWrapTopAndBottom.IsInit())
{
odt_context->drawing_context()->set_wrap_style(odf::style_wrap::Parallel);
}
if (oox_anchor->m_oAllowOverlap.IsInit())
else if (oox_anchor->m_oAllowOverlap.IsInit())
{
odt_context->drawing_context()->set_overlap(oox_anchor->m_oAllowOverlap->ToBool());
}
......
......@@ -32,6 +32,7 @@ namespace OOX
class CPBdr;
class CHyperlink;
class CFldChar;
class CFldSimple;
class CInstrText;
class CCommentRangeStart;
class CCommentRangeEnd;
......@@ -117,6 +118,7 @@ namespace Oox2Odf
void convert(ComplexTypes::Word::CFramePr *oox_frame_pr, odf::style_paragraph_properties *paragraph_properties);
void convert(OOX::Logic::CRunProperty *oox_run_prop, odf::style_text_properties *text_properties);
void convert(ComplexTypes::Word::CShading *oox_shading, odf::style_text_properties *text_properties );
void convert(OOX::Logic::CFldSimple *oox_fld);
void convert(OOX::Logic::CFldChar *oox_fld);
void convert(OOX::Logic::CInstrText *oox_instr);
void convert(OOX::Logic::CText *oox_text);
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//109
#define INTVER 1,2,0,109
#define STRVER "1,2,0,109\0"
//111
#define INTVER 1,2,0,111
#define STRVER "1,2,0,111\0"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment