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

паттерная заливка

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55815 954022d7-b5bf-4e40-9824-e11837661b57
parent b081cbe3
#include "precompiled_cpodf.h" #include "precompiled_cpodf.h"
#include "pptx_drawing.h" #include "pptx_drawing.h"
#include <cpdoccore/xml/simple_xml_writer.h> #include <cpdoccore/xml/simple_xml_writer.h>
#include "../odf/custom_shape_types_convert.h" #include "../odf/datatypes/custom_shape_types_convert.h"
namespace cpdoccore { namespace cpdoccore {
......
...@@ -5,7 +5,22 @@ ...@@ -5,7 +5,22 @@
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
std::wostream & operator << (std::wostream & _Wostream, const hatch_style & _Val)
{
switch(_Val.get_type())
{
case hatch_style::single:
_Wostream << L"single";
break;
case hatch_style::doublee:
_Wostream << L"double";
break;
case hatch_style::triple:
_Wostream << L"triple";
break;
}
return _Wostream;
}
hatch_style hatch_style::parse(const std::wstring & Str) hatch_style hatch_style::parse(const std::wstring & Str)
{ {
std::wstring tmp = Str; std::wstring tmp = Str;
......
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
void set_textarea_vertical_align(int align); void set_textarea_vertical_align(int align);
void set_textarea_padding(double left,double top,double right,double bottom);//in cm void set_textarea_padding(double left,double top,double right,double bottom);//in cm
void set_textarea_writing_mode(int mode); void set_textarea_writing_mode(int mode);
//////////////////////////////////////////////////////////////////////////////////////
void start_gradient_style(); void start_gradient_style();
void set_gradient_type(int type); void set_gradient_type(int type);
void set_gradient_start(std::wstring hexColor, _CP_OPT(double) & intensiv); void set_gradient_start(std::wstring hexColor, _CP_OPT(double) & intensiv);
...@@ -102,6 +102,13 @@ public: ...@@ -102,6 +102,13 @@ public:
void set_opacity(_CP_OPT(double) & start, _CP_OPT(double) & end);// void set_opacity(_CP_OPT(double) & start, _CP_OPT(double) & end);//
void set_gradient_angle(double angle); void set_gradient_angle(double angle);
void end_gradient_style(); void end_gradient_style();
////////////////////////////////////////////////////////////////////////////////////////
void start_hatch_style();
void set_hatch_line_color(std::wstring hexColor);
void set_hatch_area_color(std::wstring hexColor);
void set_hatch_type(int type);
void end_hatch_style();
private: private:
void start_frame(); void start_frame();
......
...@@ -264,11 +264,27 @@ void draw_gradient::serialize(std::wostream & strm) ...@@ -264,11 +264,27 @@ void draw_gradient::serialize(std::wostream & strm)
const wchar_t * draw_hatch::ns = L"draw"; const wchar_t * draw_hatch::ns = L"draw";
const wchar_t * draw_hatch::name = L"hatch"; const wchar_t * draw_hatch::name = L"hatch";
void draw_hatch::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name) void draw_hatch::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void draw_hatch::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"draw:color", draw_color_);
CP_XML_ATTR_OPT(L"draw:rotation", draw_rotation_);
CP_XML_ATTR_OPT(L"draw:distance", draw_distance_);
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_);
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_opacity::ns = L"draw"; const wchar_t * draw_opacity::ns = L"draw";
const wchar_t * draw_opacity::name = L"opacity"; const wchar_t * draw_opacity::name = L"opacity";
......
...@@ -181,7 +181,7 @@ public: ...@@ -181,7 +181,7 @@ public:
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name); virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child) 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();} {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){} virtual void serialize(std::wostream & strm);
}; };
CP_REGISTER_OFFICE_ELEMENT2(draw_hatch); CP_REGISTER_OFFICE_ELEMENT2(draw_hatch);
......
...@@ -288,54 +288,72 @@ void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill) ...@@ -288,54 +288,72 @@ void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill)
if (!oox_grad_fill)return; if (!oox_grad_fill)return;
odf_context()->drawing_context().start_gradient_style(); odf_context()->drawing_context().start_gradient_style();
if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypeLinear)
{
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());
}
if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypePath)
{ {
if (oox_grad_fill->m_oPath->m_oPath.IsInit()) if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypeLinear)
{
odf_context()->drawing_context().set_gradient_type((int)oox_grad_fill->m_oPath->m_oPath->GetValue() + 2);
}
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(), odf_context()->drawing_context().set_gradient_type(1);
oox_grad_fill->m_oPath->m_oFillToRect->m_oT.GetValue(), if (oox_grad_fill->m_oLin->m_oAng.IsInit())
oox_grad_fill->m_oPath->m_oFillToRect->m_oR.GetValue(), odf_context()->drawing_context().set_gradient_angle(oox_grad_fill->m_oLin->m_oAng->GetAngle());
oox_grad_fill->m_oPath->m_oFillToRect->m_oB.GetValue());
} }
} if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypePath)
if (oox_grad_fill->m_oGsLst.IsInit() && oox_grad_fill->m_oGsLst->m_arrGs.GetSize()>1) {
{ if (oox_grad_fill->m_oPath->m_oPath.IsInit())
std::wstring hexColorStart, hexColorEnd; {
_CP_OPT(double) opacityStart, opacityEnd; odf_context()->drawing_context().set_gradient_type((int)oox_grad_fill->m_oPath->m_oPath->GetValue() + 2);
}
convert((OOX::Drawing::CColor*)(&oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.GetSize()-1]),hexColorStart, opacityStart); if (oox_grad_fill->m_oPath->m_oFillToRect.IsInit())
convert((OOX::Drawing::CColor*)(&oox_grad_fill->m_oGsLst->m_arrGs[0]),hexColorEnd, opacityEnd); {
odf_context()->drawing_context().set_gradient_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());
}
}
if (oox_grad_fill->m_oGsLst.IsInit() && oox_grad_fill->m_oGsLst->m_arrGs.GetSize()>1)
{
std::wstring hexColorStart, hexColorEnd;
_CP_OPT(double) opacityStart, 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_gradient_start(hexColorStart, opacityStart); odf_context()->drawing_context().set_opacity(opacityStart, opacityEnd);
odf_context()->drawing_context().set_gradient_end(hexColorEnd, opacityEnd); }
odf_context()->drawing_context().set_opacity(opacityStart, opacityEnd);
} }
odf_context()->drawing_context().end_gradient_style(); odf_context()->drawing_context().end_gradient_style();
} }
void OoxConverter::convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fill) void OoxConverter::convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fill)
{ {
if (!oox_pattern_fill)return; if (!oox_pattern_fill)return;
//odf_context()->drawing_context().start_pattern_fill(); odf_context()->drawing_context().start_hatch_style();
{
if (oox_pattern_fill->m_oPrst.IsInit())
{
odf_context()->drawing_context().set_hatch_type(oox_pattern_fill->m_oPrst->GetValue());
}
if (oox_pattern_fill->m_oFgClr.IsInit())
{
std::wstring hexColor;
_CP_OPT(double) opacity;
convert((OOX::Drawing::CColor*)oox_pattern_fill->m_oFgClr.GetPointer(),hexColor, opacity);
odf_context()->drawing_context().set_hatch_line_color(hexColor);
}
if (oox_pattern_fill->m_oBgClr.IsInit())
{
std::wstring hexColor;
_CP_OPT(double) opacity;
convert((OOX::Drawing::CColor*)oox_pattern_fill->m_oBgClr.GetPointer(),hexColor, opacity);
//odf_context()->drawing_context().end_pattern_fill(); odf_context()->drawing_context().set_hatch_area_color(hexColor);
}
}
odf_context()->drawing_context().end_hatch_style();
} }
void OoxConverter::convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill,std::wstring & hexColor , _CP_OPT(double) &opacity) void OoxConverter::convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill,std::wstring & hexColor , _CP_OPT(double) &opacity)
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//2 //2
//0 //0
//26 //27
#define INTVER 1,2,0,26 #define INTVER 1,2,0,27
#define STRVER "1,2,0,26\0" #define STRVER "1,2,0,27\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