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

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55634 954022d7-b5bf-4e40-9824-e11837661b57
parent 0609a37f
...@@ -898,8 +898,8 @@ void common_anim_smil_attlist::apply_from(const common_anim_smil_attlist & Other ...@@ -898,8 +898,8 @@ void common_anim_smil_attlist::apply_from(const common_anim_smil_attlist & Other
void union_common_draw_attlists::serialize(CP_ATTR_NODE) void union_common_draw_attlists::serialize(CP_ATTR_NODE)
{ {
shape_with_text_and_styles_.serialize(CP_GET_XML_NODE()); shape_with_text_and_styles_.serialize(CP_GET_XML_NODE());
position_.serialize(CP_GET_XML_NODE());
rel_size_.serialize(CP_GET_XML_NODE()); rel_size_.serialize(CP_GET_XML_NODE());
position_.serialize(CP_GET_XML_NODE());
} }
} }
......
...@@ -886,6 +886,14 @@ ...@@ -886,6 +886,14 @@
<Filter <Filter
Name="elements" Name="elements"
> >
<File
RelativePath=".\OdfFormat\draw_base.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\draw_base.h"
>
</File>
<File <File
RelativePath=".\OdfFormat\draw_frame.cpp" RelativePath=".\OdfFormat\draw_frame.cpp"
> >
...@@ -1151,6 +1159,38 @@ ...@@ -1151,6 +1159,38 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="odf_shapes_defines"
>
<File
RelativePath=".\OdfFormat\oox_shape_defines.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\oox_shape_defines.h"
>
</File>
<File
RelativePath=".\OdfFormat\shapes\oox_shapeMathMultiply.h"
>
</File>
<File
RelativePath=".\OdfFormat\shapes\oox_shapeSnipRoundRects.h"
>
</File>
<File
RelativePath=".\OdfFormat\shapes\oox_shapeStars.h"
>
</File>
<File
RelativePath=".\OdfFormat\shapes\oox_shapeSun.h"
>
</File>
<File
RelativePath=".\Oox2OdfConverter\shape_types_mapping.h"
>
</File>
</Filter>
<File <File
RelativePath=".\OdfFormat\abstract_xml.cpp" RelativePath=".\OdfFormat\abstract_xml.cpp"
> >
......
#include "..\oox_shape_defines.h"
namespace cpdoccore
{
class oox_shape_mathMultiply : public oox_shape
{
public:
oox_shape_mathMultiply()
{
modifiers = L"23520";
enhanced_path = L"M ?f40 ?f41 L ?f42 ?f43 ?f11 ?f46 ?f47 ?f43 ?f48 ?f41 ?f51 ?f8 ?f48 ?f53 ?f47 ?f54 ?f11 ?f55 ?f42 ?f54 ?f40 ?f53 ?f52 ?f8 Z N";
text_areas = L"?f36 ?f49 ?f35 ?f48";
glue_points = L"?f36 ?f37 ?f56 ?f37 ?f56 ?f57 ?f36 ?f57";
view_box = L"0 0 21600 21600";
add(L"f0", L"10800000");
add(L"f1", L"5400000");
add(L"f2", L"left");
add(L"f3", L"right");
add(L"f4", L"top");
add(L"f5", L"bottom");
add(L"f6", L"?f5 - ?f4");
add(L"f7", L"?f6 / 2");
add(L"f8", L"?f4 + ?f7");
add(L"f9", L"?f3 - ?f2");
add(L"f10", L"?f9 / 2");
add(L"f11", L"?f2 + ?f10");
add(L"f12", L"min(?f9, ?f6)");
add(L"f13", L"5419351 / 1725033");
add(L"f14", L"$0");
add(L"f15", L"?f12 * ?f14 / 100000");
add(L"f16", L"0 - ?f9");
add(L"f17", L"0 - ?f6");
add(L"f18", L"atan2(?f16, ?f17)");
add(L"f19", L"0 - ?f18");
add(L"f20", L"?f19 * ?f0 / ?f13");
add(L"f21", L"?f20 - ?f1");
add(L"f22", L"?f21 + ?f1");
add(L"f23", L"?f22 * ?f13 / ?f0");
add(L"f24", L"0 - ?f23");
add(L"f25", L"cos(?f24)");
add(L"f26", L"0 - ?f25");
add(L"f27", L"?f26");
add(L"f28", L"sin(?f24)");
add(L"f29", L"0 - ?f28");
add(L"f30", L"?f29");
add(L"f31", L"tan(?f24)");
add(L"f32", L"1 / ?f31");
add(L"f33", L"sqrt(?f9 * ?f9 + ?f6 * ?f6 + 0 * 0)");
add(L"f34", L"?f33 * 51965 / 100000");
add(L"f35", L"?f33 - ?f34");
add(L"f36", L"?f30 * ?f35 / 2");
add(L"f37", L"?f27 * ?f35 / 2");
add(L"f38", L"?f27 * ?f15 / 2");
add(L"f39", L"?f30 * ?f15 / 2");
add(L"f40", L"?f36 - ?f38");
add(L"f41", L"?f37 + ?f39");
add(L"f42", L"?f36 + ?f38");
add(L"f43", L"?f37 - ?f39");
add(L"f44", L"?f11 - ?f42");
add(L"f45", L"?f44 * ?f32");
add(L"f46", L"?f45 + ?f43");
add(L"f47", L"?f3 - ?f42");
add(L"f48", L"?f3 - ?f40");
add(L"f49", L"?f8 - ?f41");
add(L"f50", L"?f49 / ?f32");
add(L"f51", L"?f48 - ?f50");
add(L"f52", L"?f40 + ?f50");
add(L"f53", L"?f5 - ?f41");
add(L"f54", L"?f5 - ?f43");
add(L"f55", L"?f5 - ?f46");
add(L"f56", L"?f3 - ?f36");
add(L"f57", L"?f5 - ?f37");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"0 ?f2";
h.y_maximum= L"51965";
h.y_minimum= L"0";
handles.push_back(h);
}
};
}
\ No newline at end of file
This diff is collapsed.
#include "..\oox_shape_defines.h"
namespace cpdoccore
{
class oox_shape_sun : public oox_shape
{
public:
oox_shape_sun()
{
modifiers = L"23520";
enhanced_path = L"M ?f3 ?f8 L ?f41 ?f57 ?f41 ?f53 Z M ?f31 ?f32 L ?f42 ?f52 ?f43 ?f51 Z M ?f11 ?f4 L ?f44 ?f50 ?f40 ?f50 Z M ?f33 ?f32 L ?f39 ?f51 ?f38 ?f52 Z M ?f2 ?f8 L ?f37 ?f53 ?f37 ?f57 Z M ?f33 ?f34 L ?f38 ?f56 ?f39 ?f55 Z M ?f11 ?f5 L ?f40 ?f54 ?f44 ?f54 Z M ?f31 ?f34 L ?f43 ?f55 ?f42 ?f56 Z M ?f45 ?f8 A ?f97 ?f98 ?f99 ?f100 ?f45 ?f8 ?f94 ?f96 W ?f101 ?f102 ?f103 ?f104 ?f45 ?f8 ?f94 ?f96 Z N";
text_areas = L"?f36 ?f49 ?f35 ?f48";
glue_points = L"?f36 ?f37 ?f56 ?f37 ?f56 ?f57 ?f36 ?f57";
view_box = L"0 0 21600 21600";
add(L"f0", L"10800000");
add(L"f1", L"5400000");
add(L"f2", L"left");
add(L"f3", L"right");
add(L"f4", L"top");
add(L"f5", L"bottom");
add(L"f6", L"?f5 - ?f4");
add(L"f7", L"?f6 / 2");
add(L"f8", L"?f4 + ?f7");
add(L"f9", L"?f3 - ?f2");
add(L"f10", L"?f9 / 2");
add(L"f11", L"?f2 + ?f10");
add(L"f12", L"5419351 / 1725033");
add(L"f13", L"$0");
add(L"f14", L"50000 - ?f13");
add(L"f15", L"?f14 * 30274 / 32768");
add(L"f16", L"?f14 * 12540 / 32768");
add(L"f17", L"50000 - ?f15");
add(L"f18", L"50000 - ?f16");
add(L"f19", L"?f14 * 23170 / 32768");
add(L"f20", L"50000 + ?f19");
add(L"f21", L"50000 - ?f19");
add(L"f22", L"?f17 * 3 / 4");
add(L"f23", L"?f18 * 3 / 4");
add(L"f24", L"?f22 + 3662");
add(L"f25", L"?f23 + 3662");
add(L"f26", L"?f23 + 12500");
add(L"f27", L"100000 - ?f22");
add(L"f28", L"100000 - ?f24");
add(L"f29", L"100000 - ?f25");
add(L"f30", L"100000 - ?f26");
add(L"f31", L"?f9 * 18436 / 21600");
add(L"f32", L"?f6 * 3163 / 21600");
add(L"f33", L"?f9 * 3163 / 21600");
add(L"f34", L"?f6 * 18436 / 21600");
add(L"f35", L"?f9 * ?f20 / 100000");
add(L"f36", L"?f9 * ?f21 / 100000");
add(L"f37", L"?f9 * ?f22 / 100000");
add(L"f38", L"?f9 * ?f24 / 100000");
add(L"f39", L"?f9 * ?f25 / 100000");
add(L"f40", L"?f9 * ?f26 / 100000");
add(L"f41", L"?f9 * ?f27 / 100000");
add(L"f42", L"?f9 * ?f28 / 100000");
add(L"f43", L"?f9 * ?f29 / 100000");
add(L"f44", L"?f9 * ?f30 / 100000");
add(L"f45", L"?f9 * ?f13 / 100000");
add(L"f46", L"?f9 * ?f14 / 100000");
add(L"f47", L"?f6 * ?f14 / 100000");
add(L"f48", L"?f6 * ?f20 / 100000");
add(L"f49", L"?f6 * ?f21 / 100000");
add(L"f50", L"?f6 * ?f22 / 100000");
add(L"f51", L"?f6 * ?f24 / 100000");
add(L"f52", L"?f6 * ?f25 / 100000");
add(L"f53", L"?f6 * ?f26 / 100000");
add(L"f54", L"?f6 * ?f27 / 100000");
add(L"f55", L"?f6 * ?f28 / 100000");
add(L"f56", L"?f6 * ?f29 / 100000");
add(L"f57", L"?f6 * ?f30 / 100000");
add(L"f58", L"21550000 - 21600000");
add(L"f59", L"if(?f58, 21600000, 21550000)");
add(L"f60", L"-21550000 - ?f59");
add(L"f61", L"if(?f60, -21550000, ?f59)");
add(L"f62", L"?f0 + ?f61");
add(L"f63", L"?f0 + ?f1");
add(L"f64", L"?f63 * ?f12 / ?f0");
add(L"f65", L"0 - ?f64");
add(L"f66", L"cos(?f65)");
add(L"f67", L"0 - ?f66");
add(L"f68", L"?f67 * ?f46");
add(L"f69", L"sin(?f65)");
add(L"f70", L"0 - ?f69");
add(L"f71", L"?f70 * ?f47");
add(L"f72", L"sqrt(?f68 * ?f68 + ?f71 * ?f71 + 0 * 0)");
add(L"f73", L"?f46 * ?f47 / ?f72");
add(L"f74", L"?f70 * ?f73");
add(L"f75", L"?f45 - ?f74");
add(L"f76", L"?f67 * ?f73");
add(L"f77", L"?f8 - ?f76");
add(L"f78", L"?f75 - ?f46");
add(L"f79", L"?f77 - ?f47");
add(L"f80", L"?f75 + ?f46");
add(L"f81", L"?f77 + ?f47");
add(L"f82", L"?f62 + ?f1");
add(L"f83", L"?f82 * ?f12 / ?f0");
add(L"f84", L"0 - ?f83");
add(L"f85", L"cos(?f84)");
add(L"f86", L"0 - ?f85");
add(L"f87", L"?f86 * ?f46");
add(L"f88", L"sin(?f84)");
add(L"f89", L"0 - ?f88");
add(L"f90", L"?f89 * ?f47");
add(L"f91", L"sqrt(?f87 * ?f87 + ?f90 * ?f90 + 0 * 0)");
add(L"f92", L"?f46 * ?f47 / ?f91");
add(L"f93", L"?f89 * ?f92");
add(L"f94", L"?f75 + ?f93");
add(L"f95", L"?f86 * ?f92");
add(L"f96", L"?f77 + ?f95");
add(L"f97", L"if(?f61, ?f45, ?f78)");
add(L"f98", L"if(?f61, ?f8, ?f79)");
add(L"f99", L"if(?f61, ?f45, ?f80)");
add(L"f100", L"if(?f61, ?f8, ?f81)");
add(L"f101", L"if(?f61, ?f78, ?f94)");
add(L"f102", L"if(?f61, ?f79, ?f96)");
add(L"f103", L"if(?f61, ?f80, ?f94)");
add(L"f104", L"if(?f61, ?f81, ?f96)");
}
};
}
\ No newline at end of file
#include "precompiled_cpodf.h"
#include "draw_base.h"
#include <ostream>
#include <sstream>
#include <string>
#include <boost/foreach.hpp>
#include <boost_string.h>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include "odf_conversion_context.h"
namespace cpdoccore {
namespace odf {
using xml::xml_char_wc;
const wchar_t * draw_base::ns = L"draw";
const wchar_t * draw_base::name = L"base";
/////////////////////////////////////////////////////////////////////////////////////////////////////////
void draw_base::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void draw_base::add_child_element( office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void draw_base::serialize(std::wostream & _Wostream)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->serialize(_Wostream);
}
}
void draw_base::serialize_attlist(CP_ATTR_NODE)
{
common_draw_attlists_.serialize(CP_GET_XML_NODE());
common_presentation_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
\ No newline at end of file
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "common_attlists.h"
namespace cpdoccore {
namespace odf {
class draw_base : public office_element_impl<draw_base>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawBase;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
virtual void serialize_attlist(CP_ATTR_NODE);
common_presentation_attlist common_presentation_attlist_;
union_common_draw_attlists common_draw_attlists_;
office_element_ptr_array content_;
};
}
}
\ No newline at end of file
...@@ -155,21 +155,17 @@ const wchar_t * draw_frame::name = L"frame"; ...@@ -155,21 +155,17 @@ const wchar_t * draw_frame::name = L"frame";
void draw_frame::serialize(std::wostream & _Wostream) void draw_frame::serialize(std::wostream & _Wostream)
{ {
// idx_in_owner = -1;
CP_XML_WRITER(_Wostream) CP_XML_WRITER(_Wostream)
{ {
CP_XML_NODE_SIMPLE() CP_XML_NODE_SIMPLE()
{ {
draw_base::serialize_attlist(CP_GET_XML_NODE());
draw_frame_attlist_.serialize(CP_GET_XML_NODE()); draw_frame_attlist_.serialize(CP_GET_XML_NODE());
common_draw_attlists_.serialize(CP_GET_XML_NODE());
common_presentation_attlist_.serialize(CP_GET_XML_NODE());
if (office_event_listeners_)office_event_listeners_->serialize(CP_XML_STREAM()); if (office_event_listeners_)office_event_listeners_->serialize(CP_XML_STREAM());
BOOST_FOREACH(const office_element_ptr & elm, content_) draw_base::serialize(CP_XML_STREAM());
{
elm->serialize(CP_XML_STREAM());
}
} }
} }
} }
...@@ -186,7 +182,7 @@ void draw_frame::create_child_element( const ::std::wstring & Ns, const ::std:: ...@@ -186,7 +182,7 @@ void draw_frame::create_child_element( const ::std::wstring & Ns, const ::std::
CP_CHECK_NAME(L"table", L"table") CP_CHECK_NAME(L"table", L"table")
) )
{ {
CP_CREATE_ELEMENT(content_); draw_base::create_child_element(Ns,Name);
} }
else if CP_CHECK_NAME(L"office", L"event-listeners") else if CP_CHECK_NAME(L"office", L"event-listeners")
{ {
...@@ -216,7 +212,7 @@ void draw_frame::add_child_element(office_element_ptr & child_element) ...@@ -216,7 +212,7 @@ void draw_frame::add_child_element(office_element_ptr & child_element)
if (type == typeDrawImage || type == typeDrawTextBox || type == typeDrawObject || type == typeDrawObjectOle || type == typeTableTable) if (type == typeDrawImage || type == typeDrawTextBox || type == typeDrawObject || type == typeDrawObjectOle || type == typeTableTable)
{ {
content_.push_back(child_element); draw_base::add_child_element(child_element);
} }
else if (type == typeOfficeEventListeners) else if (type == typeOfficeEventListeners)
{ {
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include "common_attlists.h" #include "common_attlists.h"
//#include "../docx/xlsxconversioncontext.h"
#include "draw_base.h"
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
...@@ -89,8 +90,8 @@ public: ...@@ -89,8 +90,8 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(draw_chart); CP_REGISTER_OFFICE_ELEMENT2(draw_chart);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
class draw_frame : public office_element_impl<draw_frame> class draw_frame : public draw_base
{ { // draw-text-box, draw-image, draw-object, draw-object-ole, draw-applet, draw-floating-frame, draw-plugin
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
...@@ -104,25 +105,16 @@ public: ...@@ -104,25 +105,16 @@ public:
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
int idx_in_owner ; int idx_in_owner ;
common_presentation_attlist common_presentation_attlist_;
union_common_draw_attlists common_draw_attlists_;
presentation_shape_attlist presentation_shape_attlist_;
presentation_shape_attlist presentation_shape_attlist_;
draw_frame_attlist draw_frame_attlist_; draw_frame_attlist draw_frame_attlist_;
// draw-text-box, draw-image, draw-object, draw-object-ole, draw-applet, draw-floating-frame, draw-plugin
office_element_ptr_array content_;
office_element_ptr office_event_listeners_; // content - office_element_ptr office_event_listeners_; // content -
office_element_ptr draw_glue_point_; office_element_ptr draw_glue_point_;
office_element_ptr draw_image_map_; office_element_ptr draw_image_map_;
//office_element_ptr draw_chart_map_; //office_element_ptr draw_chart_map_;
office_element_ptr draw_contour_; // draw-contour-polygon or draw-contour-path office_element_ptr draw_contour_; // draw-contour-polygon or draw-contour-path
friend class draw_image;
friend class draw_chart;
}; };
CP_REGISTER_OFFICE_ELEMENT2(draw_frame); CP_REGISTER_OFFICE_ELEMENT2(draw_frame);
......
...@@ -32,26 +32,13 @@ const wchar_t * draw_shape::ns = L"draw"; ...@@ -32,26 +32,13 @@ const wchar_t * draw_shape::ns = L"draw";
const wchar_t * draw_shape::name = L"shape"; const wchar_t * draw_shape::name = L"shape";
///////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////
void draw_shape::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void draw_shape::add_child_element( office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void draw_shape::serialize(std::wostream & _Wostream) void draw_shape::serialize(std::wostream & _Wostream)
{ {
BOOST_FOREACH(const office_element_ptr & elm, content_) draw_base::serialize(_Wostream);
{
elm->serialize(_Wostream);
}
} }
void draw_shape::serialize_attlist(CP_ATTR_NODE) void draw_shape::serialize_attlist(CP_ATTR_NODE)
{ {
common_draw_attlists_.serialize(CP_GET_XML_NODE()); draw_base::serialize_attlist(CP_GET_XML_NODE());
common_presentation_attlist_.serialize(CP_GET_XML_NODE());
common_xlink_attlist_.serialize(CP_GET_XML_NODE()); common_xlink_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"draw:id", draw_id_); CP_XML_ATTR_OPT(L"draw:id", draw_id_);
...@@ -157,36 +144,6 @@ void draw_line::serialize(std::wostream & _Wostream) ...@@ -157,36 +144,6 @@ void draw_line::serialize(std::wostream & _Wostream)
} }
} }
} }
void draw_line::reset_svg_attributes()
{
double x1=draw_line_attlist_.svg_x1_.get_value_or(length(0)).get_value_unit(length::pt);
double y1=draw_line_attlist_.svg_y1_.get_value_or(length(0)).get_value_unit(length::pt);
double x2=draw_line_attlist_.svg_x2_.get_value_or(length(0)).get_value_unit(length::pt);
double y2=draw_line_attlist_.svg_y2_.get_value_or(length(0)).get_value_unit(length::pt);
if (x1 > x2)
{
common_draw_attlists_.position_.svg_x_ = draw_line_attlist_.svg_x2_;
common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_ = length(x1-x2, length::pt);
additional_.push_back(_property(L"flipH",true));
}else
{
common_draw_attlists_.position_.svg_x_ = draw_line_attlist_.svg_x1_;
common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_ = length(x2-x1, length::pt);
}
if (y1 > y2)
{
common_draw_attlists_.position_.svg_y_ = draw_line_attlist_.svg_y2_;
common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_ = length(y1-y2, length::pt);
additional_.push_back(_property(L"flipV",true));
}else
{
common_draw_attlists_.position_.svg_y_ = draw_line_attlist_.svg_y1_;
common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_ = length(y2-y1, length::pt);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
// draw:custom_shape // draw:custom_shape
const wchar_t * draw_custom_shape::ns = L"draw"; const wchar_t * draw_custom_shape::ns = L"draw";
...@@ -397,8 +354,10 @@ int draw_enhanced_geometry::parsing(_CP_OPT(std::wstring) val) ...@@ -397,8 +354,10 @@ 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"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"draw:enhanced-path", draw_enhanced_path_);
CP_XML_ATTR_OPT(L"draw:glue-points", draw_glue_points_);
} }
// draw:enhanced_geometry // draw:enhanced_geometry
const wchar_t * draw_enhanced_geometry::ns = L"draw"; const wchar_t * draw_enhanced_geometry::ns = L"draw";
...@@ -410,17 +369,19 @@ void draw_enhanced_geometry::serialize(std::wostream & _Wostream) ...@@ -410,17 +369,19 @@ void draw_enhanced_geometry::serialize(std::wostream & _Wostream)
{ {
CP_XML_NODE_SIMPLE() CP_XML_NODE_SIMPLE()
{ {
draw_enhanced_geometry_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_); CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
draw_enhanced_geometry_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(office_element_ptr & elm, draw_handle_) BOOST_FOREACH(office_element_ptr & elm, draw_equation_)
{ {
elm->serialize(CP_XML_STREAM()); elm->serialize(CP_XML_STREAM());
} }
BOOST_FOREACH(office_element_ptr & elm, draw_equation_)
BOOST_FOREACH(office_element_ptr & elm, draw_handle_)
{ {
elm->serialize(CP_XML_STREAM()); elm->serialize(CP_XML_STREAM());
} }
} }
} }
} }
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include "draw_base.h"
#include "common_attlists.h" #include "common_attlists.h"
...@@ -17,7 +19,7 @@ namespace cpdoccore ...@@ -17,7 +19,7 @@ namespace cpdoccore
namespace odf { namespace odf {
class draw_shape : public office_element_impl<draw_shape> class draw_shape : public draw_base
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
...@@ -26,25 +28,17 @@ public: ...@@ -26,25 +28,17 @@ public:
static const ElementType type = typeDrawShape; static const ElementType type = typeDrawShape;
static const xml::NodeType xml_type = xml::typeElement; static const xml::NodeType xml_type = xml::typeElement;
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
virtual void serialize_attlist(CP_ATTR_NODE); virtual void serialize_attlist(CP_ATTR_NODE);
common_xlink_attlist common_xlink_attlist_; common_xlink_attlist common_xlink_attlist_;
common_presentation_attlist common_presentation_attlist_;
union_common_draw_attlists common_draw_attlists_;
_CP_OPT(std::wstring) draw_id_;// _CP_OPT(std::wstring) draw_id_;//
office_element_ptr_array content_;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
int sub_type_; int sub_type_;
std::vector<odf::_property> additional_;
}; };
...@@ -140,7 +134,6 @@ public: ...@@ -140,7 +134,6 @@ public:
draw_line_attlist draw_line_attlist_; draw_line_attlist draw_line_attlist_;
void reset_svg_attributes();
}; };
CP_REGISTER_OFFICE_ELEMENT2(draw_line); CP_REGISTER_OFFICE_ELEMENT2(draw_line);
...@@ -300,6 +293,8 @@ public: ...@@ -300,6 +293,8 @@ 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_glue_points_;
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
}; };
......
...@@ -33,7 +33,7 @@ public: ...@@ -33,7 +33,7 @@ public:
void start_frame(); void start_frame();
void end_frame(); void end_frame();
void start_shape(int type, std::wstring & sub_type); void start_shape(int type);
void end_shape(); void end_shape();
void start_image(std::wstring & path); void start_image(std::wstring & path);
...@@ -44,19 +44,19 @@ public: ...@@ -44,19 +44,19 @@ public:
office_element_ptr & get_current_element(); office_element_ptr & get_current_element();
void set_rect(double x_pt, double y_pt, double width_pt, double height_pt);
bool is_exist_content(); bool is_exist_content();
//////////////////////////////////////////////////////////////////////////////////////
//void start_path(int W, int H);
//void end_path();
void add_path_element(std::wstring command, std::wstring & elm); void add_path_element(std::wstring command, std::wstring & elm);
void add_modifier(std::wstring modifier);
void set_viewBox(double W, double H); void set_viewBox(double W, double H);
void finalize(office_element_ptr & root_elm); void finalize(office_element_ptr & root_elm);
/////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
void set_rect(double x_pt, double y_pt, double width_pt, double height_pt);
void set_name(std::wstring name); void set_name(std::wstring name);
void set_z_order(int id); void set_z_order(int id);
...@@ -71,8 +71,6 @@ public: ...@@ -71,8 +71,6 @@ public:
private: private:
office_element_ptr create_shape(int type);
class Impl; class Impl;
_CP_PTR(Impl) impl_; _CP_PTR(Impl) impl_;
......
...@@ -181,6 +181,7 @@ enum ElementType ...@@ -181,6 +181,7 @@ enum ElementType
typeDrawObjectOle, typeDrawObjectOle,
typeDrawChart, typeDrawChart,
typeDrawBase,
typeDrawShape, typeDrawShape,
typeDrawRect, typeDrawRect,
......
#include "precompiled_cpodf.h"
#include "Shapes\oox_shapeMathMultiply.h"
#include "Shapes\oox_shapeSnipRoundRects.h"
#include "Shapes\oox_shapeSun.h"
#include "Shapes\oox_shapeStars.h"
#include "..\..\..\Common\DocxFormat\Source\Common\SimpleTypes_Drawing.h"
namespace cpdoccore
{
oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
{
switch (ooxPrstGeomType)
{
case SimpleTypes::shapetypeMathMultiply: return boost::make_shared<oox_shape_mathMultiply>();
case SimpleTypes::shapetypeSun: return boost::make_shared<oox_shape_sun>();
case SimpleTypes::shapetypeRound1Rect: return boost::make_shared<oox_shape_round1Rect>();
case SimpleTypes::shapetypeRound2DiagRect: return boost::make_shared<oox_shape_round2DiagRect>();
case SimpleTypes::shapetypeRound2SameRect: return boost::make_shared<oox_shape_round2SameRect>();
case SimpleTypes::shapetypeSnip1Rect: return boost::make_shared<oox_shape_snip1Rect>();
case SimpleTypes::shapetypeSnip2DiagRect: return boost::make_shared<oox_shape_snip2DiagRect>();
case SimpleTypes::shapetypeSnip2SameRect: return boost::make_shared<oox_shape_snip2SameRect>();
case SimpleTypes::shapetypeSnipRoundRect: return boost::make_shared<oox_shape_snipRoundRect>();
case SimpleTypes::shapetypeStar7: return boost::make_shared<oox_shape_star7>();
case SimpleTypes::shapetypeStar10: return boost::make_shared<oox_shape_star10>();
case SimpleTypes::shapetypeStar16: return boost::make_shared<oox_shape_star16>();
case SimpleTypes::shapetypeStar32: return boost::make_shared<oox_shape_star32>();
default:
return boost::make_shared<oox_shape>();
}
}
}
\ No newline at end of file
#pragma once
#include <vector>
#include <string>
#include <cpdoccore/CPSharedPtr.h>
#include <cpdoccore/CPOptional.h>
namespace cpdoccore
{
class oox_shape;
typedef _CP_PTR(oox_shape) oox_shape_ptr;
class oox_shape
{
public:
static oox_shape_ptr create(int ooxPrstGeomType);
struct _equation
{
std::wstring name;
std::wstring formula;
};
struct _handle
{
_CP_OPT(std::wstring) position;
_CP_OPT(std::wstring) y_minimum;
_CP_OPT(std::wstring) y_maximum;
_CP_OPT(std::wstring) x_minimum;
_CP_OPT(std::wstring) x_maximum;
};
void add(std::wstring name,std::wstring frmla)
{
_equation q = {name,frmla};
equations.push_back(q);
}
std::vector<_equation> equations;
std::vector<_handle> handles;
std::wstring enhanced_path;
std::wstring modifiers;
std::wstring text_areas;
std::wstring view_box;
_CP_OPT(std::wstring) glue_points;
};
};
\ No newline at end of file
...@@ -53,6 +53,7 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar ...@@ -53,6 +53,7 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
CP_XML_ATTR_OPT(L"style:flow-with-text", style_flow_with_text_); CP_XML_ATTR_OPT(L"style:flow-with-text", style_flow_with_text_);
CP_XML_ATTR_OPT(L"style:overflow-behavior", style_overflow_behavior_); CP_XML_ATTR_OPT(L"style:overflow-behavior", style_overflow_behavior_);
CP_XML_ATTR_OPT(L"style:mirror", style_mirror_); CP_XML_ATTR_OPT(L"style:mirror", style_mirror_);
CP_XML_ATTR_OPT(L"draw:fit-to-size", draw_fit_to_size_);
common_draw_rel_size_attlist_.serialize(CP_GET_XML_NODE()); common_draw_rel_size_attlist_.serialize(CP_GET_XML_NODE());
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE()); common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE());
......
...@@ -94,7 +94,9 @@ public: ...@@ -94,7 +94,9 @@ public:
_CP_OPT(Bool) style_editable_; _CP_OPT(Bool) style_editable_;
_CP_OPT(style_wrap) style_wrap_; _CP_OPT(Bool) draw_fit_to_size_;
_CP_OPT(style_wrap) style_wrap_;
_CP_OPT(unsigned int) style_wrap_dynamic_treshold_; _CP_OPT(unsigned int) style_wrap_dynamic_treshold_;
......
...@@ -194,10 +194,6 @@ ...@@ -194,10 +194,6 @@
RelativePath=".\Oox2OdfConverter\DocxConverter.h" RelativePath=".\Oox2OdfConverter\DocxConverter.h"
> >
</File> </File>
<File
RelativePath=".\Oox2OdfConverter\shape_types_mapping.h"
>
</File>
<File <File
RelativePath=".\Oox2OdfConverter\stdafx.h" RelativePath=".\Oox2OdfConverter\stdafx.h"
> >
......
...@@ -181,8 +181,13 @@ void OoxConverter::convert/*_PrstGeom*/(OOX::Drawing::CPresetGeometry2D *oox_prs ...@@ -181,8 +181,13 @@ void OoxConverter::convert/*_PrstGeom*/(OOX::Drawing::CPresetGeometry2D *oox_prs
{ {
if (!oox_prst_geom)return; if (!oox_prst_geom)return;
// if (oox_prst_geom->m_oAvLst.IsInit())
{
for (long i=0; i<oox_prst_geom->m_oAvLst->m_arrGd.GetSize(); i++)
{
odf_context()->drawing_context().add_modifier(string2std_string(oox_prst_geom->m_oAvLst->m_arrGd[i].m_oFmla.GetValue()));
}
}
} }
void OoxConverter::convert(OOX::Drawing::CPath2D *oox_geom_path) void OoxConverter::convert(OOX::Drawing::CPath2D *oox_geom_path)
{ {
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include "stdAfx.h" #include "stdAfx.h"
#include "XlsxConverter.h" #include "XlsxConverter.h"
#include "shape_types_mapping.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
...@@ -1029,46 +1028,40 @@ void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape) ...@@ -1029,46 +1028,40 @@ void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape)
if (!oox_shape)return; if (!oox_shape)return;
if (!oox_shape->m_oSpPr.IsInit()) return; if (!oox_shape->m_oSpPr.IsInit()) return;
std::wstring sub_type;
int type = -1; int type = -1;
if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypeCustom) if (oox_shape->m_oSpPr->m_oCustGeom.IsInit())
{ {
type = 7;//6??? type = 1000;//6???
} }
else if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypePreset) if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
{ {
if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit()) OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
{ type =(geometry->m_oPrst.GetValue());
OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
int oox_shape = (int)(geometry->m_oPrst.GetValue());
type = Shape_Types_Mapping[oox_shape].second;
sub_type = Shape_Types_Mapping[oox_shape].first;
}
} }
else
return;
convert_SpPr(oox_shape->m_oSpPr.GetPointer());//, if (type < 0)return;
/////////////////////////////////////////////////////////////////////////////////
ods_context->drawing_context().start_shape(type);
{
convert_SpPr(oox_shape->m_oSpPr.GetPointer());
if (oox_shape->m_oNvSpPr.IsInit()) if (oox_shape->m_oNvSpPr.IsInit())
{
if (oox_shape->m_oNvSpPr->m_oCNvPr.IsInit())
{ {
convert_CNvPr(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer()); if (oox_shape->m_oNvSpPr->m_oCNvPr.IsInit())
} {
convert_CNvPr(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer());
}
if (oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit()) if (oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit())
{ {
}
} }
}
if (oox_shape->m_oShapeStyle.IsInit()) if (oox_shape->m_oShapeStyle.IsInit())
{ {
} }
ods_context->drawing_context().start_shape(type,sub_type );
{
} }
ods_context->drawing_context().end_shape(); ods_context->drawing_context().end_shape();
} }
...@@ -1079,44 +1072,42 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConnShape* oox_shape) ...@@ -1079,44 +1072,42 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConnShape* oox_shape)
if (!oox_shape)return; if (!oox_shape)return;
if (!oox_shape->m_oSpPr.IsInit()) return; if (!oox_shape->m_oSpPr.IsInit()) return;
std::wstring sub_type;
int type = -1; int type = -1;
if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypeCustom) if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypeCustom)
{ {
type = 7;//6??? type = 1000;//?????
} }
else if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypePreset) else if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypePreset)
{ {
if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit()) if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
{ {
OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer(); OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
int oox_shape = (int)(geometry->m_oPrst.GetValue()); type = (int)(geometry->m_oPrst.GetValue());
type = Shape_Types_Mapping[oox_shape].second;
sub_type = Shape_Types_Mapping[oox_shape].first;
} }
} }
else if (type < 0)return;
return; //////////////////////////////////////////////////////////////////////////////
ods_context->drawing_context().start_shape(type);
convert_SpPr(oox_shape->m_oSpPr.GetPointer());//, {
convert_SpPr(oox_shape->m_oSpPr.GetPointer());
if (oox_shape->m_oNvConnSpPr.IsInit()) if (oox_shape->m_oNvConnSpPr.IsInit())
{
if (oox_shape->m_oNvConnSpPr->m_oCNvPr.IsInit())
{ {
convert_CNvPr(oox_shape->m_oNvConnSpPr->m_oCNvPr.GetPointer()); if (oox_shape->m_oNvConnSpPr->m_oCNvPr.IsInit())
} {
convert_CNvPr(oox_shape->m_oNvConnSpPr->m_oCNvPr.GetPointer());
}
if (oox_shape->m_oNvConnSpPr->m_oCNvConnSpPr.IsInit()) if (oox_shape->m_oNvConnSpPr->m_oCNvConnSpPr.IsInit())
{
}
}
if (oox_shape->m_oShapeStyle.IsInit())
{ {
} }
} //avLst
if (oox_shape->m_oShapeStyle.IsInit())
{
}
ods_context->drawing_context().start_shape(type,sub_type );
{
} }
ods_context->drawing_context().end_shape(); ods_context->drawing_context().end_shape();
} }
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//2 //2
//0 //0
//15 //16
#define INTVER 1,2,0,15 #define INTVER 1,2,0,16
#define STRVER "1,2,0,15\0" #define STRVER "1,2,0,16\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