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

(1.2.0.136): ASCOfficeOdfFileW


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57997 954022d7-b5bf-4e40-9824-e11837661b57
parent 767d74f0
......@@ -14,7 +14,222 @@
// shapetypeNonIsoscelesTrapezoid,
// shapetypePie,
// shapetypePieWedge,
// shapetypePlaque,
//+ shapetypePlaque,
// shapetypePlaqueTabs,
// shapetypeSquareTabs,
// shapetypeTeardrop,
#include "..\oox_shape_defines.h"
namespace cpdoccore
{
class oox_shape_Plaque : public oox_shape
{
public:
oox_shape_Plaque()
{
odf_type_name =L"ooxml-Plaque";
modifiers = L"16667";
enhanced_path = L"M ?f3 ?f12 A ?f57 ?f58 ?f59 ?f60 ?f3 ?f12 ?f54 ?f56 W ?f61 ?f62 ?f63 ?f64 ?f3 ?f12 ?f54 ?f56 L ?f13 ?f5 A ?f100 ?f101 ?f102 ?f103 ?f13 ?f5 ?f97 ?f99 W ?f104 ?f105 ?f106 ?f107 ?f13 ?f5 ?f97 ?f99 L ?f4 ?f14 A ?f143 ?f144 ?f145 ?f146 ?f4 ?f14 ?f140 ?f142 W ?f147 ?f148 ?f149 ?f150 ?f4 ?f14 ?f140 ?f142 L ?f12 ?f6 A ?f186 ?f187 ?f188 ?f189 ?f12 ?f6 ?f183 ?f185 W ?f190 ?f191 ?f192 ?f193 ?f12 ?f6 ?f183 ?f185 Z N";
text_areas = L"?f15 ?f15 ?f16 ?f17";
glue_points = L"?f36 ?f37 ?f56 ?f37 ?f56 ?f57 ?f36 ?f57";
view_box = L"0 0 21600 21600";
add(L"f0", L"16200000");
add(L"f1", L"10800000");
add(L"f2", L"5400000");
add(L"f3", L"left");
add(L"f4", L"right");
add(L"f5", L"top");
add(L"f6", L"bottom");
add(L"f7", L"?f6 - ?f5");
add(L"f8", L"?f4 - ?f3");
add(L"f9", L"min(?f8, ?f7)");
add(L"f10", L"5419351 / 1725033");
add(L"f11", L"$0");
add(L"f12", L"?f9 * ?f11 / 100000");
add(L"f13", L"?f4 - ?f12");
add(L"f14", L"?f6 - ?f12");
add(L"f15", L"?f12 * 70711 / 100000");
add(L"f16", L"?f4 - ?f15");
add(L"f17", L"?f6 - ?f15");
add(L"f18", L"21550000 - -5400000");
add(L"f19", L"if(?f18, -5400000, 21550000)");
add(L"f20", L"-21550000 - ?f19");
add(L"f21", L"if(?f20, -21550000, ?f19)");
add(L"f22", L"?f2 + ?f21");
add(L"f23", L"?f2 + ?f2");
add(L"f24", L"?f23 * ?f10 / ?f1");
add(L"f25", L"0 - ?f24");
add(L"f26", L"cos(?f25)");
add(L"f27", L"0 - ?f26");
add(L"f28", L"?f27 * ?f12");
add(L"f29", L"sin(?f25)");
add(L"f30", L"0 - ?f29");
add(L"f31", L"?f30 * ?f12");
add(L"f32", L"sqrt(?f28 * ?f28 + ?f31 * ?f31 + 0 * 0)");
add(L"f33", L"?f12 * ?f12 / ?f32");
add(L"f34", L"?f30 * ?f33");
add(L"f35", L"?f3 - ?f34");
add(L"f36", L"?f27 * ?f33");
add(L"f37", L"?f12 - ?f36");
add(L"f38", L"?f35 - ?f12");
add(L"f39", L"?f37 - ?f12");
add(L"f40", L"?f35 + ?f12");
add(L"f41", L"?f37 + ?f12");
add(L"f42", L"?f22 + ?f2");
add(L"f43", L"?f42 * ?f10 / ?f1");
add(L"f44", L"0 - ?f43");
add(L"f45", L"cos(?f44)");
add(L"f46", L"0 - ?f45");
add(L"f47", L"?f46 * ?f12");
add(L"f48", L"sin(?f44)");
add(L"f49", L"0 - ?f48");
add(L"f50", L"?f49 * ?f12");
add(L"f51", L"sqrt(?f47 * ?f47 + ?f50 * ?f50 + 0 * 0)");
add(L"f52", L"?f12 * ?f12 / ?f51");
add(L"f53", L"?f49 * ?f52");
add(L"f54", L"?f35 + ?f53");
add(L"f55", L"?f46 * ?f52");
add(L"f56", L"?f37 + ?f55");
add(L"f57", L"if(?f21, ?f3, ?f38)");
add(L"f58", L"if(?f21, ?f12, ?f39)");
add(L"f59", L"if(?f21, ?f3, ?f40)");
add(L"f60", L"if(?f21, ?f12, ?f41)");
add(L"f61", L"if(?f21, ?f38, ?f54)");
add(L"f62", L"if(?f21, ?f39, ?f56)");
add(L"f63", L"if(?f21, ?f40, ?f54)");
add(L"f64", L"if(?f21, ?f41, ?f56)");
add(L"f65", L"?f1 + ?f21");
add(L"f66", L"?f1 + ?f2");
add(L"f67", L"?f66 * ?f10 / ?f1");
add(L"f68", L"0 - ?f67");
add(L"f69", L"cos(?f68)");
add(L"f70", L"0 - ?f69");
add(L"f71", L"?f70 * ?f12");
add(L"f72", L"sin(?f68)");
add(L"f73", L"0 - ?f72");
add(L"f74", L"?f73 * ?f12");
add(L"f75", L"sqrt(?f71 * ?f71 + ?f74 * ?f74 + 0 * 0)");
add(L"f76", L"?f12 * ?f12 / ?f75");
add(L"f77", L"?f73 * ?f76");
add(L"f78", L"?f13 - ?f77");
add(L"f79", L"?f70 * ?f76");
add(L"f80", L"?f5 - ?f79");
add(L"f81", L"?f78 - ?f12");
add(L"f82", L"?f80 - ?f12");
add(L"f83", L"?f78 + ?f12");
add(L"f84", L"?f80 + ?f12");
add(L"f85", L"?f65 + ?f2");
add(L"f86", L"?f85 * ?f10 / ?f1");
add(L"f87", L"0 - ?f86");
add(L"f88", L"cos(?f87)");
add(L"f89", L"0 - ?f88");
add(L"f90", L"?f89 * ?f12");
add(L"f91", L"sin(?f87)");
add(L"f92", L"0 - ?f91");
add(L"f93", L"?f92 * ?f12");
add(L"f94", L"sqrt(?f90 * ?f90 + ?f93 * ?f93 + 0 * 0)");
add(L"f95", L"?f12 * ?f12 / ?f94");
add(L"f96", L"?f92 * ?f95");
add(L"f97", L"?f78 + ?f96");
add(L"f98", L"?f89 * ?f95");
add(L"f99", L"?f80 + ?f98");
add(L"f100", L"if(?f21, ?f13, ?f81)");
add(L"f101", L"if(?f21, ?f5, ?f82)");
add(L"f102", L"if(?f21, ?f13, ?f83)");
add(L"f103", L"if(?f21, ?f5, ?f84)");
add(L"f104", L"if(?f21, ?f81, ?f97)");
add(L"f105", L"if(?f21, ?f82, ?f99)");
add(L"f106", L"if(?f21, ?f83, ?f97)");
add(L"f107", L"if(?f21, ?f84, ?f99)");
add(L"f108", L"?f0 + ?f21");
add(L"f109", L"?f0 + ?f2");
add(L"f110", L"?f109 * ?f10 / ?f1");
add(L"f111", L"0 - ?f110");
add(L"f112", L"cos(?f111)");
add(L"f113", L"0 - ?f112");
add(L"f114", L"?f113 * ?f12");
add(L"f115", L"sin(?f111)");
add(L"f116", L"0 - ?f115");
add(L"f117", L"?f116 * ?f12");
add(L"f118", L"sqrt(?f114 * ?f114 + ?f117 * ?f117 + 0 * 0)");
add(L"f119", L"?f12 * ?f12 / ?f118");
add(L"f120", L"?f116 * ?f119");
add(L"f121", L"?f4 - ?f120");
add(L"f122", L"?f113 * ?f119");
add(L"f123", L"?f14 - ?f122");
add(L"f124", L"?f121 - ?f12");
add(L"f125", L"?f123 - ?f12");
add(L"f126", L"?f121 + ?f12");
add(L"f127", L"?f123 + ?f12");
add(L"f128", L"?f108 + ?f2");
add(L"f129", L"?f128 * ?f10 / ?f1");
add(L"f130", L"0 - ?f129");
add(L"f131", L"cos(?f130)");
add(L"f132", L"0 - ?f131");
add(L"f133", L"?f132 * ?f12");
add(L"f134", L"sin(?f130)");
add(L"f135", L"0 - ?f134");
add(L"f136", L"?f135 * ?f12");
add(L"f137", L"sqrt(?f133 * ?f133 + ?f136 * ?f136 + 0 * 0)");
add(L"f138", L"?f12 * ?f12 / ?f137");
add(L"f139", L"?f135 * ?f138");
add(L"f140", L"?f121 + ?f139");
add(L"f141", L"?f132 * ?f138");
add(L"f142", L"?f123 + ?f141");
add(L"f143", L"if(?f21, ?f4, ?f124)");
add(L"f144", L"if(?f21, ?f14, ?f125)");
add(L"f145", L"if(?f21, ?f4, ?f126)");
add(L"f146", L"if(?f21, ?f14, ?f127)");
add(L"f147", L"if(?f21, ?f124, ?f140)");
add(L"f148", L"if(?f21, ?f125, ?f142)");
add(L"f149", L"if(?f21, ?f126, ?f140)");
add(L"f150", L"if(?f21, ?f127, ?f142)");
add(L"f151", L"0 + ?f21");
add(L"f152", L"0 + ?f2");
add(L"f153", L"?f152 * ?f10 / ?f1");
add(L"f154", L"0 - ?f153");
add(L"f155", L"cos(?f154)");
add(L"f156", L"0 - ?f155");
add(L"f157", L"?f156 * ?f12");
add(L"f158", L"sin(?f154)");
add(L"f159", L"0 - ?f158");
add(L"f160", L"?f159 * ?f12");
add(L"f161", L"sqrt(?f157 * ?f157 + ?f160 * ?f160 + 0 * 0)");
add(L"f162", L"?f12 * ?f12 / ?f161");
add(L"f163", L"?f159 * ?f162");
add(L"f164", L"?f12 - ?f163");
add(L"f165", L"?f156 * ?f162");
add(L"f166", L"?f6 - ?f165");
add(L"f167", L"?f164 - ?f12");
add(L"f168", L"?f166 - ?f12");
add(L"f169", L"?f164 + ?f12");
add(L"f170", L"?f166 + ?f12");
add(L"f171", L"?f151 + ?f2");
add(L"f172", L"?f171 * ?f10 / ?f1");
add(L"f173", L"0 - ?f172");
add(L"f174", L"cos(?f173)");
add(L"f175", L"0 - ?f174");
add(L"f176", L"?f175 * ?f12");
add(L"f177", L"sin(?f173)");
add(L"f178", L"0 - ?f177");
add(L"f179", L"?f178 * ?f12");
add(L"f180", L"sqrt(?f176 * ?f176 + ?f179 * ?f179 + 0 * 0)");
add(L"f181", L"?f12 * ?f12 / ?f180");
add(L"f182", L"?f178 * ?f181");
add(L"f183", L"?f164 + ?f182");
add(L"f184", L"?f175 * ?f181");
add(L"f185", L"?f166 + ?f184");
add(L"f186", L"if(?f21, ?f12, ?f167)");
add(L"f187", L"if(?f21, ?f6, ?f168)");
add(L"f188", L"if(?f21, ?f12, ?f169)");
add(L"f189", L"if(?f21, ?f6, ?f170)");
add(L"f190", L"if(?f21, ?f167, ?f183)");
add(L"f191", L"if(?f21, ?f168, ?f185)");
add(L"f192", L"if(?f21, ?f169, ?f183)");
add(L"f193", L"if(?f21, ?f170, ?f185)");
/////////////////////////////////////////////////////////
}
};
}
\ No newline at end of file
......@@ -1300,10 +1300,17 @@ void odf_drawing_context::set_position(double x_pt, double y_pt)
}
void odf_drawing_context::get_size( double & width_pt, double & height_pt)
{
if (!impl_->current_drawing_state_.svg_width_ || !impl_->current_drawing_state_.svg_height_) return;
if (impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_)
{
width_pt = impl_->current_drawing_state_.svg_width_->get_value_unit(length::pt);
height_pt = impl_->current_drawing_state_.svg_height_->get_value_unit(length::pt);
}
else if (impl_->anchor_settings_.svg_width_ && impl_->anchor_settings_.svg_height_)
{
width_pt = impl_->anchor_settings_.svg_width_->get_value_unit(length::pt);
height_pt = impl_->anchor_settings_.svg_height_->get_value_unit(length::pt);
}
width_pt = impl_->current_drawing_state_.svg_width_->get_value_unit(length::pt);
height_pt = impl_->current_drawing_state_.svg_height_->get_value_unit(length::pt);
}
void odf_drawing_context::set_size( double width_pt, double height_pt)
{
......@@ -1764,6 +1771,7 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
//end_area_properties();
}
}
//-------------------------------------------------------------------------------------------------------------------------------------
void odf_drawing_context::start_gradient_style()
{
odf::office_element_ptr gradient_element;
......@@ -1781,25 +1789,16 @@ void odf_drawing_context::start_gradient_style()
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
}
void odf_drawing_context::end_gradient_style()
void odf_drawing_context::set_gradient_type(gradient_style style)
{
}
void odf_drawing_context::set_gradient_type(int type)
{
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state()->get_office_element().get());
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
if (!gradient) return;
switch(type)
{
case 1: gradient->draw_style_ = gradient_style(gradient_style::linear); break;
case 2: gradient->draw_style_ = gradient_style(gradient_style::radial); break;
case 3: gradient->draw_style_ = gradient_style(gradient_style::rectangular); break;
case 4: gradient->draw_style_ = gradient_style(gradient_style::square); break;
}
gradient->draw_style_ = style;
}
void odf_drawing_context::set_gradient_start(std::wstring hexColor, _CP_OPT(double) & intensiv)
{
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state()->get_office_element().get());
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
if (!gradient) return;
gradient->draw_start_color_ = color(std::wstring(L"#") + hexColor);
......@@ -1807,75 +1806,85 @@ void odf_drawing_context::set_gradient_start(std::wstring hexColor, _CP_OPT(doub
}
void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(double) & intensiv)
{
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state()->get_office_element().get());
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
if (!gradient) return;
gradient->draw_end_color_ = color(std::wstring(L"#") + hexColor);
gradient->draw_end_intensity_ = 100.;
}
void odf_drawing_context::set_gradient_center(double x, double y)
void odf_drawing_context::set_gradient_angle(double angle)
{
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state()->get_office_element().get());
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
if (!gradient) return;
gradient->draw_cy_ = percent(x);
gradient->draw_cx_ = percent(y);
gradient->draw_angle_ = (270-angle)*10;//(int)((360 - angle)/180. * 3.14159265358979323846);
}
void odf_drawing_context::set_gradient_rect(double l, double t, double r,double b)
{
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state()->get_office_element().get());
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
if (!gradient) return;
gradient->draw_cy_ = percent((b-t)/2. + 50.);
gradient->draw_cx_ = percent((r-l)/2. + 50.);
}
void odf_drawing_context::set_opacity(_CP_OPT(double) & start, _CP_OPT(double) & end)
void odf_drawing_context::end_gradient_style()
{
if (!start && !end)return;
if (!start) start = 100;
if (!end) end = 100;
}
//-------------------------------------------------------------------------------------------------------------------------------------
void odf_drawing_context::start_opacity_style()
{
odf::office_element_ptr opacity_element;
odf::create_element(L"draw",L"opacity", opacity_element, impl_->odf_context_);
impl_->styles_context_->add_style(opacity_element,false,true, style_family::Opacity);
if (*start == *end)
{
set_opacity(*start);
}
else
{
odf::office_element_ptr opacity_element;
draw_opacity * opacity = dynamic_cast<draw_opacity *>(opacity_element.get());
if (!opacity) return;
odf::create_element(L"draw",L"opacity", opacity_element, impl_->odf_context_);
impl_->styles_context_->add_style(opacity_element,false,true, style_family::Opacity);
opacity->draw_name_ = impl_->styles_context_->find_free_name(style_family::Opacity);
opacity->draw_display_name_ = std::wstring(L"User") + opacity->draw_name_.get() ;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_opacity_name_ = opacity->draw_name_;
}
void odf_drawing_context::set_opacity_start(double val)
{
draw_opacity * opacity = dynamic_cast<draw_opacity *>(impl_->styles_context_->last_state(style_family::Opacity)->get_office_element().get());
if (!opacity) return;
draw_opacity * opacity = dynamic_cast<draw_opacity *>(opacity_element.get());
if (!opacity) return;
opacity->draw_start_ = val;
}
void odf_drawing_context::set_opacity_angle(double angle)
{
draw_opacity * opacity = dynamic_cast<draw_opacity *>(impl_->styles_context_->last_state(style_family::Opacity)->get_office_element().get());
if (!opacity) return;
opacity->draw_name_ = impl_->styles_context_->find_free_name(style_family::Opacity);
opacity->draw_display_name_ = std::wstring(L"User") + opacity->draw_name_.get() ;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_opacity_name_ = opacity->draw_name_;
///////////////////////////////////////////////////////////////////////////////////////////////////
opacity->draw_start_ = *start;
opacity->draw_end_ = *end;
opacity->draw_angle_ = (270-angle)*10;//(int)((360 - angle)/180. * 3.14159265358979323846);
}
void odf_drawing_context::set_opacity_type(gradient_style style)
{
draw_opacity * opacity = dynamic_cast<draw_opacity *>(impl_->styles_context_->last_state(style_family::Opacity)->get_office_element().get());
if (!opacity) return;
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state()->get_office_element().get());
if (gradient)
{
opacity->draw_style_ = gradient->draw_style_;
}
else
{
opacity->draw_style_ = gradient_style(gradient_style::linear);
}
}
opacity->draw_style_ = style;
}
void odf_drawing_context::set_gradient_angle(double angle)
void odf_drawing_context::set_opacity_rect(double l, double t, double r,double b)
{
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state()->get_office_element().get());
if (!gradient) return;
draw_opacity * opacity = dynamic_cast<draw_opacity *>(impl_->styles_context_->last_state(style_family::Opacity)->get_office_element().get());
if (!opacity) return;
opacity->draw_cy_ = percent((b-t)/2. + 50.);
opacity->draw_cx_ = percent((r-l)/2. + 50.);
}
void odf_drawing_context::set_opacity_end (double val)
{
draw_opacity * opacity = dynamic_cast<draw_opacity *>(impl_->styles_context_->last_state(style_family::Opacity)->get_office_element().get());
if (!opacity) return;
gradient->draw_angle_ = (int)((360 - angle)/180. * 3.14159265358979323846);
opacity->draw_end_ = val;
}
void odf_drawing_context::end_opacity_style()
{
}
//-------------------------------------------------------------------------------------------------------------------------------------
void odf_drawing_context::start_hatch_style()
{
odf::office_element_ptr hatch_element;
......
......@@ -10,6 +10,7 @@
#include "anchortype.h"
#include "stylewrap.h"
#include "gradientstyle.h"
namespace cpdoccore {
namespace odf
......@@ -145,15 +146,21 @@ public:
void set_textarea_font(_CP_OPT(std::wstring) & latin, _CP_OPT(std::wstring) & cs, _CP_OPT(std::wstring) & ea);
//////////////////////////////////////////////////////////////////////////////////////
void start_gradient_style();
void set_gradient_type(int type);
void set_gradient_type(gradient_style style);
void set_gradient_start(std::wstring hexColor, _CP_OPT(double) & intensiv);
void set_gradient_end (std::wstring hexColor, _CP_OPT(double) & intensiv);
void set_gradient_rect(double l, double t, double r,double b);
void set_gradient_center(double x, double y);
void set_opacity(_CP_OPT(double) & start, _CP_OPT(double) & end);//
void set_gradient_angle(double angle);
void end_gradient_style();
////////////////////////////////////////////////////////////////////////////////////////
void start_opacity_style();
void set_opacity_type(gradient_style style);
void set_opacity_start(double val);
void set_opacity_end (double val);
void set_opacity_rect(double l, double t, double r,double b);
void set_opacity_angle(double angle);
void end_opacity_style();
//////////////////////////////////////////////////////////////////////////////////////
void start_hatch_style();
void set_hatch_line_color(std::wstring hexColor);
void set_hatch_area_color(std::wstring hexColor);
......
......@@ -40,6 +40,7 @@ public:
style_list_level_label_alignment * get_list_level_alignment_properties();
style_text_properties * get_text_properties();
void set_bullet_image_size(double size);
void set_bullet_image (std::wstring ref);
void set_bullet_char (std::wstring val);
void set_start_number (int val);
......
......@@ -27,7 +27,8 @@ void calc_paragraph_properties_content(std::vector<style_paragraph_properties*>
}
odf_style_context::odf_style_context()
{
{
memset(style_family_counts_,0,sizeof(style_family_counts_));
}
void odf_style_context::set_odf_context(odf_conversion_context * Context)
......@@ -69,6 +70,8 @@ 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_family_counts_[(int)family]++;
}
void odf_style_context::add_style(office_element_ptr elm, bool automatic, bool root, style_family::type family)
......@@ -316,16 +319,17 @@ std::wstring odf_style_context::get_name_family(style_family::type family)
std::wstring odf_style_context::find_free_name(style_family::type family)
{
std::wstring name = get_name_family(family);
int count =1;
for (int i=0;i<style_state_list_.size(); i++)
{
if ((style_state_list_[i]->odf_style_) && (style_state_list_[i]->get_family_type() == family))
{
count++;
}
}
name = name + boost::lexical_cast<std::wstring>(count);
int count = style_family_counts_[(int)family];
// ..
//for (int i=0;i<style_state_list_.size(); i++)
//{
// if ((style_state_list_[i]->odf_style_) && (style_state_list_[i]->get_family_type() == family))
// {
// count++;
// }
//}
name = name + boost::lexical_cast<std::wstring>(count+1);
return name;
}
office_element_ptr & odf_style_context::add_or_find(std::wstring name, style_family::type family, bool automatic , bool root, int oox_id)
......
......@@ -80,6 +80,8 @@ private:
std::wstring get_name_family(style_family::type family);
odf_conversion_context * odf_context_;
int style_family_counts_[26];//
};
......
......@@ -187,18 +187,22 @@ void odt_conversion_context::start_drawings()
drawing_context_.push_back(new_drawing_context_);
}
void odt_conversion_context::end_drawings()
void odt_conversion_context::end_drawings(bool delete_only)
{
if (drawing_context_.size() < 1) return;
office_element_ptr & elm = drawing_context()->get_root_element();
if (elm && text_context()->current_level_.size() > 0)
{
text_context()->current_level_.back().elm->add_child_element(elm);
if (!delete_only)text_context()->current_level_.back().elm->add_child_element(elm);
drawing_context()->clear();
drawing_context_.pop_back();
}
else// if (delete_only)
{
drawing_context()->clear();
drawing_context_.pop_back();
}
drawing_context()->clear();
drawing_context_.pop_back();
}
void odt_conversion_context::start_paragraph(bool styled)
{
......
......@@ -47,7 +47,7 @@ public:
odf_table_context * table_context();
void start_drawings();
void end_drawings();
void end_drawings(bool delete_only = false);
virtual void start_image(std::wstring & image_file_name);
void add_text_content (std::wstring & text);
......
......@@ -38,6 +38,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::shapetypePlaque: return boost::make_shared<oox_shape_Plaque>();
//case (2001 + SimpleTypes::textshapetypeTextArchDown):
//case (2001 + SimpleTypes::textshapetypeTextArchDownPour):
//case (2001 + SimpleTypes::textshapetypeTextArchUp):
......@@ -71,7 +73,7 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
//case (2001 + SimpleTypes::textshapetypeTextRingInside):
//case (2001 + SimpleTypes::textshapetypeTextRingOutside):
//case (2001 + SimpleTypes::textshapetypeTextSlantDown):
//case (2001 + SimpleTypes::textshapetypeTextSlantUp):
case (2001 + SimpleTypes::textshapetypeTextSlantUp): return boost::make_shared<oox_shape_textSlantUp>();
//case (2001 + SimpleTypes::textshapetypeTextStop):
//case (2001 + SimpleTypes::textshapetypeTextTriangle):
//case (2001 + SimpleTypes::textshapetypeTextTriangleInverted):
......
......@@ -331,15 +331,18 @@ void draw_opacity::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"draw:start",draw_start_);
CP_XML_ATTR_OPT(L"draw:start", draw_start_);
CP_XML_ATTR_OPT(L"draw:end", draw_end_);
CP_XML_ATTR_OPT(L"draw:cx", draw_cx_);
CP_XML_ATTR_OPT(L"draw:cy", draw_cy_);
CP_XML_ATTR_OPT(L"draw:border", draw_border_);
CP_XML_ATTR_OPT(L"draw:angle", draw_angle_);
CP_XML_ATTR_OPT(L"draw:style", draw_style_);
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"draw:name", draw_name_);
CP_XML_ATTR_OPT(L"draw:display_name", draw_display_name_);
}
}
}
......
......@@ -202,6 +202,9 @@ public:
_CP_OPT(gradient_style) draw_style_;//linear, radial, ..
_CP_OPT(int) draw_angle_;
_CP_OPT(percent) draw_cy_;//%
_CP_OPT(percent) draw_cx_;
_CP_OPT(percent) draw_start_;
_CP_OPT(percent) draw_end_;
......
......@@ -507,12 +507,6 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
odf_context()->drawing_context()->set_position(vml_common->m_oCoordSize->GetX(), vml_common->m_oCoordSize->GetY());
}
if (vml_common->m_oInsetMode.GetValue() == SimpleTypes::insetmodeCustom)
{
//odf_context()->drawing_context()->set_textarea_padding(vml_common->m_oInset.GetLeft(0), vml_common->m_oInset.GetTop(0),
// vml_common->m_oInset.GetRight(0), vml_common->m_oInset.GetBottom(0));
}
}
void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
{
......
......@@ -773,19 +773,20 @@ void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill,
odf_context()->drawing_context()->start_gradient_style();
{
if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypeLinear)
odf::gradient_style grad_style = odf::gradient_style::linear;
if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypeLinear && oox_grad_fill->m_oLin->m_oAng.IsInit())
{
odf_context()->drawing_context()->set_gradient_type(1);
if (oox_grad_fill->m_oLin->m_oAng.IsInit())
odf_context()->drawing_context()->set_gradient_angle(oox_grad_fill->m_oLin->m_oAng->GetAngle());
odf_context()->drawing_context()->set_gradient_angle(oox_grad_fill->m_oLin->m_oAng->GetAngle());
}
if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypePath)
if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypePath && oox_grad_fill->m_oPath->m_oPath.IsInit())
{
if (oox_grad_fill->m_oPath->m_oPath.IsInit())
switch(oox_grad_fill->m_oPath->m_oPath->GetValue())
{
odf_context()->drawing_context()->set_gradient_type((int)oox_grad_fill->m_oPath->m_oPath->GetValue() + 2);
}
case SimpleTypes::pathshadetypeCircle: grad_style = odf::gradient_style::radial; break;
case SimpleTypes::pathshadetypeRect: grad_style = odf::gradient_style::rectangular; break;
case SimpleTypes::pathshadetypeShape: grad_style = odf::gradient_style::square; break;
}
if (oox_grad_fill->m_oPath->m_oFillToRect.IsInit())
{
odf_context()->drawing_context()->set_gradient_rect( oox_grad_fill->m_oPath->m_oFillToRect->m_oL.GetValue(),
......@@ -794,6 +795,8 @@ void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill,
oox_grad_fill->m_oPath->m_oFillToRect->m_oB.GetValue());
}
}
odf_context()->drawing_context()->set_gradient_type(grad_style);
if (oox_grad_fill->m_oGsLst.IsInit() && oox_grad_fill->m_oGsLst->m_arrGs.GetSize()>1)
{
std::wstring hexColorStart, hexColorEnd;
......@@ -804,13 +807,42 @@ void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill,
oox_grad_fill->m_oGsLst->m_arrGs[0].m_oShemeClr.m_oVal.FromString(*change_sheme_color);
oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.GetSize()-1].m_oShemeClr.m_oVal.FromString(*change_sheme_color);
}
convert((OOX::Drawing::CColor*)(&oox_grad_fill->m_oGsLst->m_arrGs[0]),hexColorStart, opacityStart);
convert((OOX::Drawing::CColor*)(&oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.GetSize()-1]),hexColorEnd, opacityEnd);
convert((OOX::Drawing::CColor*)(&oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.GetSize()-1]),hexColorStart, opacityStart);
convert((OOX::Drawing::CColor*)(&oox_grad_fill->m_oGsLst->m_arrGs[0]),hexColorEnd, opacityEnd);
odf_context()->drawing_context()->set_gradient_start(hexColorStart, opacityStart);
odf_context()->drawing_context()->set_gradient_end(hexColorEnd, opacityEnd);
odf_context()->drawing_context()->set_opacity(opacityStart, opacityEnd);
odf_context()->drawing_context()->set_gradient_end (hexColorEnd, opacityEnd);
if (opacityStart || opacityEnd)
{
if (!opacityStart) opacityStart = 100;
if (!opacityEnd) opacityEnd = 100;
if (*opacityStart == *opacityEnd)
{
odf_context()->drawing_context()->set_opacity(*opacityStart);
}
else
{
odf_context()->drawing_context()->start_opacity_style();
odf_context()->drawing_context()->set_opacity_type (grad_style);
odf_context()->drawing_context()->set_opacity_start (*opacityStart);
odf_context()->drawing_context()->set_opacity_end (*opacityEnd);
if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypeLinear && oox_grad_fill->m_oLin->m_oAng.IsInit())
{
odf_context()->drawing_context()->set_opacity_angle(oox_grad_fill->m_oLin->m_oAng->GetAngle());
}
if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypePath && oox_grad_fill->m_oPath->m_oFillToRect.IsInit())
{
odf_context()->drawing_context()->set_opacity_rect (oox_grad_fill->m_oPath->m_oFillToRect->m_oL.GetValue(),
oox_grad_fill->m_oPath->m_oFillToRect->m_oT.GetValue(),
oox_grad_fill->m_oPath->m_oFillToRect->m_oR.GetValue(),
oox_grad_fill->m_oPath->m_oFillToRect->m_oB.GetValue());
}
odf_context()->drawing_context()->end_opacity_style();
}
}
}
}
odf_context()->drawing_context()->end_gradient_style();
......
......@@ -49,6 +49,7 @@ namespace OOX
class CPresetTextShape;
class CShape;
class CLockedCanvas;
//class CObject;
class CPicture;
class CChart;
class CGraphic;
......
......@@ -240,6 +240,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Logic::CPicture* pPic = static_cast<OOX::Logic::CPicture*>(oox_unknown);
convert(pPic);
}break;
case OOX::et_w_object:
{
OOX::Logic::CObject* pObj = static_cast<OOX::Logic::CObject*>(oox_unknown);
convert(pObj);
}break;
case OOX::et_pic_pic:
{
OOX::Drawing::CPicture* pPic = static_cast<OOX::Drawing::CPicture*>(oox_unknown);
......@@ -1723,6 +1728,62 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
odt_context->end_drawings();
}
void DocxConverter::convert(OOX::Logic::CObject* oox_obj)
{
if (oox_obj == NULL) return;
odt_context->start_drawings();
if (odt_context->table_context()->empty())
odf_context()->drawing_context()->set_anchor(odf::anchor_type::AsChar);//default
else
{
odf_context()->drawing_context()->set_anchor(odf::anchor_type::Paragraph);
odf_context()->drawing_context()->set_object_background(true);
}
if (oox_obj->m_oShape.IsInit())
OoxConverter::convert(oox_obj->m_oShape->m_oStyle.GetPointer());
odf_context()->drawing_context()->start_drawing();
bool bSet = false;
if (oox_obj->m_oShape.IsInit())
{
OOX::Vml::SptType sptType = static_cast<OOX::Vml::SptType>(oox_obj->m_oShape->m_oSpt.GetValue());
if (sptType != OOX::Vml::SptType::sptNotPrimitive)
{
odf_context()->drawing_context()->set_name(std::wstring (L"Custom") + boost::lexical_cast<std::wstring>(sptType));
odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType));
bSet = true;
}
else if (oox_obj->m_oShape->m_oConnectorType.GetValue() != SimpleTypes::connectortypeNone)
{
odf_context()->drawing_context()->set_name(L"Connector");
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeStraightConnector1);
odf_context()->drawing_context()->set_line_width(1.);
bSet = true;
}
else if (oox_obj->m_oShape->m_oPath.IsInit())
{
odf_context()->drawing_context()->set_name(L"Path");
odf_context()->drawing_context()->start_shape(1001);
odf_context()->drawing_context()->set_line_width(1.);
bSet = true;
}
}
if (!bSet)
{
odf_context()->drawing_context()->set_name(L"Rect");
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect);
}
OoxConverter::convert(oox_obj->m_oShape.GetPointer());
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
odt_context->end_drawings();
}
///////////////////////////////////////////////
void DocxConverter::convert(OOX::Logic::CDrawing *oox_drawing)
{
......@@ -2432,6 +2493,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
//nullable<ComplexTypes::Word::CLvlLegacy > m_oLegacy;
//nullable<ComplexTypes::Word::CString_ > m_oPStyle;
double size_bullet_number_marker = 0;
if (oox_num_lvl->m_oLvlJc.IsInit())
{
}
......@@ -2475,7 +2537,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
}
if (oox_num_lvl->m_oRPr.IsInit())//
{
odf::odf_style_context* styles_context = /*odt_context->styles_context();*/odf_context()->page_layout_context()->get_local_styles_context();
odf::odf_style_context* styles_context = odf_context()->page_layout_context()->get_local_styles_context();
odf::style_text_properties *text_props = odt_context->styles_context()->lists_styles().get_text_properties();
convert(oox_num_lvl->m_oRPr.GetPointer(), text_props);
......@@ -2490,6 +2552,24 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
odf::style_text_properties * text_props_2 = style_state->get_text_properties();
if (text_props_2)text_props_2->apply_from(text_props);
}
if ((text_props) && (text_props->content().fo_font_size_))
{
size_bullet_number_marker = text_props->content().fo_font_size_->get_length().get_value();
}
}
if (size_bullet_number_marker < 0.01 && (type_list == 2 || type_list == 3))
{
//
odf::odf_style_state_ptr state;
if ((odf_context()->styles_context()->find_odf_default_style_state(odf::style_family::Paragraph, state)) && (state))
{
odf::style_text_properties *text_props = state->get_text_properties();
if ((text_props) && (text_props->content().fo_font_size_))
{
size_bullet_number_marker = text_props->content().fo_font_size_->get_length().get_value();
}
}
}
//nullable<ComplexTypes::Word::CDecimalNumber > m_oStart;
if (oox_num_lvl->m_oSuffix.IsInit())
......@@ -2521,6 +2601,9 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
}
}
if (type_list == 2 || type_list == 3)
odt_context->styles_context()->lists_styles().set_bullet_image_size(size_bullet_number_marker);
if (oox_num_lvl->m_oLvlRestart.IsInit() && oox_num_lvl->m_oLvlRestart->m_oVal.IsInit() && type_list == 1)
{
odt_context->styles_context()->lists_styles().set_start_number(oox_num_lvl->m_oLvlRestart->m_oVal->GetValue());
......
......@@ -29,6 +29,7 @@ namespace OOX
class CGroupShape;
class CShape;
class CPicture;
class CObject;
class CPBdr;
class CHyperlink;
class CFldChar;
......@@ -141,6 +142,7 @@ namespace Oox2Odf
void convert(OOX::Logic::CShape *oox_shape);
void convert(OOX::Logic::CPicture *oox_picture);
void convert(OOX::Logic::CLockedCanvas *oox_canvas);
void convert(OOX::Logic::CObject *oox_obj);
void convert(OOX::Drawing::CAnchor *oox_anchor);
void convert(OOX::Drawing::CInline *oox_inline);
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//135
#define INTVER 1,2,0,135
#define STRVER "1,2,0,135\0"
//136
#define INTVER 1,2,0,136
#define STRVER "1,2,0,136\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