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

(1.0.0.143): ASCOfficeOdfFile

22516
presentation: + master pages, гиперлинки с объектов, ....

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53065 954022d7-b5bf-4e40-9824-e11837661b57
parent 96945b07
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="D:\WORK\VersionControl.exe $(ProjectDir)\version.h" CommandLine="D:\WORK\VersionControl.exe $(ProjectDir)\version.h"
ExcludedFromBuild="true" ExcludedFromBuild="false"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
Description="Performing registration" Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; &quot;../../Redist&quot;" CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; &quot;../../Redist&quot;&#x0D;&#x0A;"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//0 //0
//0 //0
//142 //144
#define INTVER 1,0,0,142 #define INTVER 1,0,0,144
#define STRVER "1,0,0,142\0" #define STRVER "1,0,0,144\0"
...@@ -5,8 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpxml", "cpxml.vcproj", "{4 ...@@ -5,8 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpxml", "cpxml.vcproj", "{4
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpodf", "cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpodf", "cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1} {41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpcommon", "cpcommon.vcproj", "{609ED938-3CA8-4BED-B363-25096D4C4812}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpcommon", "cpcommon.vcproj", "{609ED938-3CA8-4BED-B363-25096D4C4812}"
...@@ -16,14 +16,21 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpcommon", "cpcommon.vcproj ...@@ -16,14 +16,21 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpcommon", "cpcommon.vcproj
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFile", "ASCOfficeOdfFile\ASCOfficeOdfFile.vcproj", "{64B09C98-22DC-494E-A882-9E2D7D18557C}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFile", "ASCOfficeOdfFile\ASCOfficeOdfFile.vcproj", "{64B09C98-22DC-494E-A882-9E2D7D18557C}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1} {41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileTest", "examples\ASCOfficeOdfFileTest\ASCOfficeOdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429} {50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812} {609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A} {94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{64B09C98-22DC-494E-A882-9E2D7D18557C} = {64B09C98-22DC-494E-A882-9E2D7D18557C}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileTest", "examples\ASCOfficeOdfFileTest\ASCOfficeOdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpformulasconvert", "formulasconvert\formulasconvert.vcproj", "{94954A67-A853-43B1-A727-6EF2774C5A6A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpformulasconvert", "formulasconvert\formulasconvert.vcproj", "{94954A67-A853-43B1-A727-6EF2774C5A6A}"
EndProject EndProject
Global Global
......
...@@ -481,6 +481,14 @@ ...@@ -481,6 +481,14 @@
RelativePath=".\src\odf\direction.h" RelativePath=".\src\odf\direction.h"
> >
</File> </File>
<File
RelativePath=".\src\odf\drawfill.cpp"
>
</File>
<File
RelativePath=".\src\odf\drawfill.h"
>
</File>
<File <File
RelativePath=".\src\odf\dropcaplength.cpp" RelativePath=".\src\odf\dropcaplength.cpp"
> >
...@@ -1052,6 +1060,14 @@ ...@@ -1052,6 +1060,14 @@
RelativePath=".\src\docx\headers_footers.h" RelativePath=".\src\docx\headers_footers.h"
> >
</File> </File>
<File
RelativePath=".\src\docx\hyperlinks.cpp"
>
</File>
<File
RelativePath=".\src\docx\hyperlinks.h"
>
</File>
<File <File
RelativePath=".\src\docx\namespaces.cpp" RelativePath=".\src\docx\namespaces.cpp"
> >
...@@ -1378,14 +1394,6 @@ ...@@ -1378,14 +1394,6 @@
RelativePath=".\src\conversionelement.h" RelativePath=".\src\conversionelement.h"
> >
</File> </File>
<File
RelativePath=".\src\docx\hyperlinks.cpp"
>
</File>
<File
RelativePath=".\src\docx\hyperlinks.h"
>
</File>
<File <File
RelativePath=".\src\docx\measuredigits.cpp" RelativePath=".\src\docx\measuredigits.cpp"
> >
...@@ -1427,11 +1435,11 @@ ...@@ -1427,11 +1435,11 @@
> >
</File> </File>
<File <File
RelativePath=".\src\docx\oox_layout.cpp" RelativePath=".\src\docx\oox_drawing_fills.cpp"
> >
</File> </File>
<File <File
RelativePath=".\src\docx\oox_layout.h" RelativePath=".\src\docx\oox_drawing_fills.h"
> >
</File> </File>
<File <File
...@@ -1501,6 +1509,14 @@ ...@@ -1501,6 +1509,14 @@
RelativePath=".\src\docx\oox_data_labels.h" RelativePath=".\src\docx\oox_data_labels.h"
> >
</File> </File>
<File
RelativePath=".\src\docx\oox_layout.cpp"
>
</File>
<File
RelativePath=".\src\docx\oox_layout.h"
>
</File>
<File <File
RelativePath=".\src\docx\oox_plot_area.cpp" RelativePath=".\src\docx\oox_plot_area.cpp"
> >
......
...@@ -43,7 +43,23 @@ namespace package ...@@ -43,7 +43,23 @@ namespace package
class docx_document; class docx_document;
} }
class streams_man
{
public:
streams_man(std::wostream & strm) : stream_(strm)
{
}
std::wostream & get() { return stream_; }
static boost::shared_ptr<streams_man> create(std::wostream & strm)
{
return boost::shared_ptr<streams_man>( new streams_man(strm) );
}
private:
std::wostream & stream_;
};
class styles_map class styles_map
{ {
public: public:
......
#ifndef _CPDOCCORE_DOCX_PACKAGE_H_ #pragma once
#define _CPDOCCORE_DOCX_PACKAGE_H_
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -143,5 +142,3 @@ private: ...@@ -143,5 +142,3 @@ private:
} }
} }
} }
#endif
#ifndef _CPDOCCORE_DOCS_HYPERLINKS_H_ #pragma once
#define _CPDOCCORE_DOCS_HYPERLINKS_H_
#include <vector> #include <vector>
#include <string> #include <string>
...@@ -34,5 +33,3 @@ private: ...@@ -34,5 +33,3 @@ private:
} }
} }
#endif
...@@ -24,13 +24,7 @@ void oox_chart_shape::oox_serialize(std::wostream & _Wostream) ...@@ -24,13 +24,7 @@ void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
{ {
std::wstring fillType = L"a:solidFill"; std::wstring fillType = L"a:solidFill";
if (odf::GetProperty(content_,L"fill",strVal)) if (odf::GetProperty(content_,L"fill",strVal))fillType = *strVal;
{
if ((strVal) && (strVal.get() == L"none")) fillType = L"a:noFill";
if ((strVal) && (strVal.get() == L"hatch")) fillType = L"a:pattFill";
if ((strVal) && (strVal.get() == L"gradient")) fillType = L"a:gradFill";
if ((strVal) && (strVal.get() == L"bitmap")) fillType = L"a:imageFill";
}
odf::GetProperty(content_,L"fill-color",strVal); odf::GetProperty(content_,L"fill-color",strVal);
if (strVal && fillType != L"a:noFill") if (strVal && fillType != L"a:noFill")
......
...@@ -46,23 +46,7 @@ private: ...@@ -46,23 +46,7 @@ private:
namespace oox { namespace oox {
class streams_man
{
public:
streams_man(std::wostream & strm) : stream_(strm)
{
}
std::wostream & get() { return stream_; }
static boost::shared_ptr<streams_man> create(std::wostream & strm)
{
return boost::shared_ptr<streams_man>( new streams_man(strm) );
}
private:
std::wostream & stream_;
};
} }
} }
...@@ -284,13 +284,8 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val) ...@@ -284,13 +284,8 @@ void oox_serialize_shape(std::wostream & strm, _oox_drawing const & val)
{ {
std::wstring fillType; std::wstring fillType;
if (odf::GetProperty(val.additional,L"fill",strVal)) if (odf::GetProperty(val.additional,L"fill",strVal))fillType = *strVal;
{
if ((strVal) && (strVal.get() == L"none")) fillType = L"a:noFill";
if ((strVal) && (strVal.get() == L"hatch")) fillType = L"a:pattFill";
if ((strVal) && (strVal.get() == L"gradient")) fillType = L"a:gradFill";
if ((strVal) && (strVal.get() == L"bitmap")) fillType = L"a:imageFill";
}
if (val.sub_type ==6)fillType = L"a:noFill";// ods ... !! if (val.sub_type ==6)fillType = L"a:noFill";// ods ... !!
odf::GetProperty(val.additional,L"fill-color",strVal); odf::GetProperty(val.additional,L"fill-color",strVal);
......
#pragma once
#include <string>
#include <cpdoccore/CPOptional.h>
namespace cpdoccore {
namespace oox {
struct
}
}
\ No newline at end of file
...@@ -85,7 +85,10 @@ void pptx_conversion_context::process_master_pages() ...@@ -85,7 +85,10 @@ void pptx_conversion_context::process_master_pages()
odf::style_master_page * master = odf::style_master_page * master =
root()->odf_context().pageLayoutContainer().master_page_by_name(masters.content[master_index].master_name); root()->odf_context().pageLayoutContainer().master_page_by_name(masters.content[master_index].master_name);
master->pptx_convert(*this); if (master)
{
master->pptx_convert(*this);
}
end_master(); end_master();
} }
...@@ -421,8 +424,8 @@ void pptx_conversion_context::end_layout() ...@@ -421,8 +424,8 @@ void pptx_conversion_context::end_layout()
void pptx_conversion_context::end_master() void pptx_conversion_context::end_master()
{ {
//get_slide_context().pptx_serializ(current_master().slideMasterData()); get_slide_context().serialize(current_master().slideMasterData());
// get_slide_context().dump_rels(current_master().slideMasterRels());//hyperlinks, mediaitems, ... get_slide_context().dump_rels(current_master().slideMasterRels());//hyperlinks, mediaitems, ...
get_slide_context().end_slide(); get_slide_context().end_slide();
} }
......
...@@ -54,7 +54,7 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing const & val) ...@@ -54,7 +54,7 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing const & val)
CP_XML_ATTR(L"id", val.id); CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name); CP_XML_ATTR(L"name", val.name);
//oox_serialize_hlink(CP_XML_STREAM(),val.hlinks); oox_serialize_hlink(CP_XML_STREAM(),val.hlinks);
} }
CP_XML_NODE(L"p:cNvPicPr") CP_XML_NODE(L"p:cNvPicPr")
...@@ -96,30 +96,27 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing const & val) ...@@ -96,30 +96,27 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing const & val)
void pptx_serialize_shape(std::wostream & strm, _pptx_drawing const & val) void pptx_serialize_shape(std::wostream & strm, _pptx_drawing const & val)
{ {
std::wstring shapeType; //std::wstring shapeType;
//
if (val.sub_type<9 && val.sub_type>=0) //if (val.sub_type<9 && val.sub_type>=0)
{ //{
shapeType = _ooxShapeType[val.sub_type]; // shapeType = _ooxShapeType[val.sub_type];
} //}
if (val.sub_type == 7)//custom //if (val.sub_type == 7)//custom
{ //{
_CP_OPT(int) iVal; // _CP_OPT(int) iVal;
odf::GetProperty(val.additional,L"draw-type-index",iVal); // odf::GetProperty(val.additional,L"draw-type-index",iVal);
if (iVal)shapeType = _OO_OOX_custom_shapes[*iVal].oox; // if (iVal)shapeType = _OO_OOX_custom_shapes[*iVal].oox;
} //}
else if (val.sub_type<9 && val.sub_type>=0) //else if (val.sub_type<9 && val.sub_type>=0)
{ //{
shapeType = _ooxShapeType[val.sub_type]; // shapeType = _ooxShapeType[val.sub_type];
} //}
//if ((val.place_holder_type_.length()>0) &&
// !(val.place_holder_type_== L"body" || val.place_holder_type_== L"title" || val.place_holder_type_== L"subTitle"))return;
if (shapeType.length()<1)
shapeType =L"rect";// ( ???)
/// ...
_CP_OPT(std::wstring) strTextContent;
odf::GetProperty(val.additional,L"text-content",strTextContent);
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"p:sp") CP_XML_NODE(L"p:sp")
...@@ -145,18 +142,14 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing const & val) ...@@ -145,18 +142,14 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing const & val)
{ {
if (val.place_holder_type_.length()>0)CP_XML_NODE(L"p:ph"){ CP_XML_ATTR(L"type",val.place_holder_type_);} if (val.place_holder_type_.length()>0)CP_XML_NODE(L"p:ph"){ CP_XML_ATTR(L"type",val.place_holder_type_);}
} }
} // p:nv_Pr }
CP_XML_NODE(L"p:spPr") CP_XML_NODE(L"p:spPr")
{ {
oox_serialize_xfrm(CP_XML_STREAM(),val); oox_serialize_xfrm(CP_XML_STREAM(),val);
if (!strTextContent)// oox_serialize_shape(CP_XML_STREAM(),val);
{ oox_serialize_ln(CP_XML_STREAM(),val.additional);
oox_serialize_shape(CP_XML_STREAM(),val); }
oox_serialize_ln(CP_XML_STREAM(),val.additional);
}
} // p:spPr
pptx_serialize_text(CP_XML_STREAM(),val.additional); pptx_serialize_text(CP_XML_STREAM(),val.additional);
} }
......
...@@ -180,9 +180,6 @@ void pptx_xml_slideMaster::add_layout(int id, const std::wstring & rId) ...@@ -180,9 +180,6 @@ void pptx_xml_slideMaster::add_layout(int id, const std::wstring & rId)
std::wstring(L"../slideLayouts/slideLayout") + boost::lexical_cast<std::wstring>(id) + L".xml")); std::wstring(L"../slideLayouts/slideLayout") + boost::lexical_cast<std::wstring>(id) + L".xml"));
} }
static std::wstring strSlideMasterEmpty = L"<p:spTree><p:nvGrpSpPr><p:cNvPr name=\"\" id=\"1\"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr>\
<a:xfrm><a:off y=\"0\" x=\"0\"/><a:ext cy=\"0\" cx=\"0\"/><a:chOff y=\"0\" x=\"0\"/><a:chExt cy=\"0\" cx=\"0\"/></a:xfrm></p:grpSpPr></p:spTree>";
void pptx_xml_slideMaster::write_to(std::wostream & strm) void pptx_xml_slideMaster::write_to(std::wostream & strm)
{ {
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
...@@ -203,14 +200,10 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm) ...@@ -203,14 +200,10 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
CP_XML_NODE(L"a:effectLst"); CP_XML_NODE(L"a:effectLst");
} }
} }
if (slideMasterData_.str().length()>0) CP_XML_NODE(L"p:spTree")
{ {
CP_XML_STREAM() << slideMasterData_.str(); CP_XML_STREAM() << slideMasterData_.str();
} }
else
{
CP_XML_STREAM() << strSlideMasterEmpty;
}
} }
CP_XML_NODE(L"p:clrMap") CP_XML_NODE(L"p:clrMap")
{ {
......
...@@ -301,7 +301,7 @@ std::wstring pptx_text_context::Impl::dump_paragraph() ...@@ -301,7 +301,7 @@ std::wstring pptx_text_context::Impl::dump_paragraph()
std::wstring & str_run = run_.str(); std::wstring & str_run = run_.str();
if (str_run.length() > 0) if (str_run.length() > 0 || styles_paragraph_.length() > 0)
{ {
CP_XML_WRITER(paragraph_) CP_XML_WRITER(paragraph_)
{ {
...@@ -325,7 +325,8 @@ std::wstring pptx_text_context::Impl::dump_paragraph() ...@@ -325,7 +325,8 @@ std::wstring pptx_text_context::Impl::dump_paragraph()
void pptx_text_context::Impl::dump_run() void pptx_text_context::Impl::dump_run()
{ {
const std::wstring content = xml::utils::replace_text_to_xml(text_.str()); const std::wstring content = xml::utils::replace_text_to_xml(text_.str());
if (content.length()<1) return ;
if (content.length()<1 && styles_span_.length()<1) return ;
CP_XML_WRITER(run_) CP_XML_WRITER(run_)
{ {
......
#ifndef _CPDOCCORE_XLSX_COLOR_H_INCLUDED_
#define _CPDOCCORE_XLSX_COLOR_H_INCLUDED_
#pragma once #pragma once
#include <iosfwd> #include <iosfwd>
...@@ -30,5 +29,3 @@ struct xlsx_color ...@@ -30,5 +29,3 @@ struct xlsx_color
} }
} }
#endif
\ No newline at end of file
...@@ -106,7 +106,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing const & val) ...@@ -106,7 +106,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing const & val)
} }
oox_serialize_clipping(CP_XML_STREAM(),val); oox_serialize_clipping(CP_XML_STREAM(),val);
} // xdr:blipFill }
CP_XML_NODE(L"xdr:spPr") CP_XML_NODE(L"xdr:spPr")
{ {
......
#ifndef _CPDOCCORE_XLSX_FILL_H_INCLUDED_ #pragma once
#define _CPDOCCORE_XLSX_FILL_H_INCLUDED_
#include <string> #include <string>
#include <cpdoccore/CPOptional.h> #include <cpdoccore/CPOptional.h>
...@@ -32,8 +30,8 @@ struct xlsx_gradientFill ...@@ -32,8 +30,8 @@ struct xlsx_gradientFill
struct xlsx_fill struct xlsx_fill
{ {
_CP_OPT(xlsx_patternFill) patternFill; _CP_OPT(xlsx_patternFill) patternFill;
_CP_OPT(xlsx_gradientFill) gradientFill; _CP_OPT(xlsx_gradientFill) gradientFill;
std::size_t index; std::size_t index;
bool bDefault; bool bDefault;
...@@ -46,5 +44,3 @@ struct xlsx_fill ...@@ -46,5 +44,3 @@ struct xlsx_fill
} }
} }
#endif
#include "precompiled_cpodf.h" #include "precompiled_cpodf.h"
#include "xlsx_fill.h" #include "xlsx_fill.h"
#include "xlsx_fills.h" #include "xlsx_fills.h"
#include "../odf/style_table_properties.h" #include "../odf/style_table_properties.h"
#include <cpdoccore/xml/simple_xml_writer.h> #include <cpdoccore/xml/simple_xml_writer.h>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
......
#ifndef _CPDOCCORE_XLSX_FILLS_H_INCLUDED_ #pragma once
#define _CPDOCCORE_XLSX_FILLS_H_INCLUDED_
#include <string> #include <string>
#include <cpdoccore/CPOptional.h> #include <cpdoccore/CPOptional.h>
...@@ -46,5 +45,3 @@ private: ...@@ -46,5 +45,3 @@ private:
} }
} }
#endif
#ifndef _CPDOCCORE_XSLSSTYLES_H_INCLUDED_ #pragma once
#define _CPDOCCORE_XSLSSTYLES_H_INCLUDED_
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
...@@ -49,5 +48,3 @@ private: ...@@ -49,5 +48,3 @@ private:
} }
} }
#endif
#ifndef _CPDOCCORE_ODF_STYLEDIRECTION_H_
#define _CPDOCCORE_ODF_STYLEDIRECTION_H_
#ifdef _MSC_VER
#pragma once #pragma once
#endif
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
...@@ -45,5 +40,3 @@ std::wostream & operator << (std::wostream & _Wostream, const direction & _Val); ...@@ -45,5 +40,3 @@ std::wostream & operator << (std::wostream & _Wostream, const direction & _Val);
APPLY_PARSE_XML_ATTRIBUTES(odf::direction); APPLY_PARSE_XML_ATTRIBUTES(odf::direction);
} }
#endif
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
// draw-text-box, draw-image, draw-object, draw-object-ole, draw-applet, draw-floating-frame, draw-plugin // 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_array content_;
office_element_ptr office_event_listeners_; 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_;
......
...@@ -58,8 +58,6 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -58,8 +58,6 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L""); const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
const std::wstring styleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_. const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_. common_draw_text_style_name_attlist_.
draw_text_style_name_.get_value_or(style_ref(L"")).style_name(); draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
...@@ -97,15 +95,28 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -97,15 +95,28 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
////////////////////////////////////////////// //////////////////////////////////////////////
std::vector<const odf::style_instance *> instances; std::vector<const odf::style_instance *> instances;
odf::style_instance* styleInst = const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
Context.root()->odf_context().styleContainer().style_by_name(styleName, odf::style_family::Graphic,false/*process_headers_footers_*/); const std::wstring baseStyleName = common_draw_attlist_.common_draw_style_name_attlist_.presentation_style_name_.get_value_or(style_ref(L"")).style_name();
if (styleInst) odf::style_instance* grStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf::style_family::Graphic,false/*process_headers_footers_*/);
odf::style_instance* baseStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(baseStyleName, odf::style_family::Presentation,false/*process_headers_footers_*/);
if (baseStyleInst)//
{ {
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Presentation);
if (defaultStyle)instances.push_back(defaultStyle);
instances.push_back(baseStyleInst);
}
else if (grStyleInst)//
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic); style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle); if (defaultStyle)instances.push_back(defaultStyle);
instances.push_back(styleInst);
instances.push_back(grStyleInst);
} }
graphic_format_properties properties = calc_graphic_properties_content(instances); graphic_format_properties properties = calc_graphic_properties_content(instances);
...@@ -126,6 +137,8 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -126,6 +137,8 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
{ {
Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms()); Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms());
} }
if (office_event_listeners_)office_event_listeners_->pptx_convert(Context);
//////////////////////////////////////////////// ////////////////////////////////////////////////
int i=0; int i=0;
int size = content_.size(); int size = content_.size();
......
...@@ -37,8 +37,6 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context) ...@@ -37,8 +37,6 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L""); const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
const std::wstring styleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_. const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name(); common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
...@@ -77,14 +75,29 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context) ...@@ -77,14 +75,29 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
} }
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
std::vector<const odf::style_instance *> instances; std::vector<const odf::style_instance *> instances;
odf::style_instance* styleInst =
Context.root()->odf_context().styleContainer().style_by_name(styleName, odf::style_family::Graphic,false/*Context.process_headers_footers_*/); const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
if (styleInst) const std::wstring baseStyleName = common_draw_attlist_.common_draw_style_name_attlist_.presentation_style_name_.get_value_or(style_ref(L"")).style_name();
odf::style_instance* grStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf::style_family::Graphic,false/*process_headers_footers_*/);
odf::style_instance* baseStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(baseStyleName, odf::style_family::Presentation,false/*process_headers_footers_*/);
if (baseStyleInst)//
{ {
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Presentation);
if (defaultStyle)instances.push_back(defaultStyle);
instances.push_back(baseStyleInst);
}
else if (grStyleInst)//
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic); style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle); if (defaultStyle)instances.push_back(defaultStyle);
instances.push_back(styleInst); instances.push_back(grStyleInst);
} }
graphic_format_properties properties = calc_graphic_properties_content(instances); graphic_format_properties properties = calc_graphic_properties_content(instances);
......
#ifndef _CPDOCCORE_ODF_NOTE_H_ #pragma once
#define _CPDOCCORE_ODF_NOTE_H_
#include <cpdoccore/CPOptional.h> #include <cpdoccore/CPOptional.h>
#include "office_elements.h" #include "office_elements.h"
...@@ -75,4 +74,3 @@ CP_REGISTER_OFFICE_ELEMENT2(note_body); ...@@ -75,4 +74,3 @@ CP_REGISTER_OFFICE_ELEMENT2(note_body);
} }
} }
#endif
...@@ -105,6 +105,7 @@ enum ElementType ...@@ -105,6 +105,7 @@ enum ElementType
typeStylePresentationPageLayout, typeStylePresentationPageLayout,
typeStylePresentationPlaceholder, typeStylePresentationPlaceholder,
typeStyleDrawingPageProperties,
typeStyleColumns, typeStyleColumns,
typeStyleColumn, typeStyleColumn,
......
...@@ -23,11 +23,20 @@ void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attr ...@@ -23,11 +23,20 @@ void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attr
void office_event_listeners::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name) void office_event_listeners::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{ {
if CP_CHECK_NAME(L"presentation", L"event-listener") if CP_CHECK_NAME(L"presentation", L"event-listener")
CP_CREATE_ELEMENT(presentation_event_listeners_); CP_CREATE_ELEMENT(presentation_event_listeners_);
else if CP_CHECK_NAME(L"script", L"event-listener")
CP_CREATE_ELEMENT(script_event_listeners_);
else else
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void office_event_listeners::pptx_convert(oox::pptx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr & elm, presentation_event_listeners_)
{
elm->pptx_convert(Context);
}
}
// presentation:event-listener-attlist // presentation:event-listener-attlist
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -57,6 +66,15 @@ void presentation_event_listener::add_child_element( xml::sax * Reader, const :: ...@@ -57,6 +66,15 @@ void presentation_event_listener::add_child_element( xml::sax * Reader, const ::
else else
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void presentation_event_listener::pptx_convert(oox::pptx_conversion_context & Context)
{
common_xlink_attlist & xlink = presentation_event_listener_attlist_.common_xlink_attlist_;
if (xlink.xlink_href_)
{
Context.get_slide_context().add_hyperlink(*xlink.xlink_href_,true);
}
}
// script:event-listener // script:event-listener
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -21,6 +21,8 @@ public: ...@@ -21,6 +21,8 @@ public:
static const xml::NodeType xml_type = xml::typeElement; static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeEventListeners; static const ElementType type = typeOfficeEventListeners;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
...@@ -63,6 +65,8 @@ public: ...@@ -63,6 +65,8 @@ public:
static const xml::NodeType xml_type = xml::typeElement; static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationEventListener; static const ElementType type = typePresentationEventListener;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......
...@@ -69,7 +69,7 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties) ...@@ -69,7 +69,7 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties)
{ {
if (draw_fill_color_) properties.push_back(_property(L"fill-color", draw_fill_color_->get_hex_value() )); if (draw_fill_color_) properties.push_back(_property(L"fill-color", draw_fill_color_->get_hex_value() ));
if (svg_stroke_color_) properties.push_back(_property(L"stroke-color", svg_stroke_color_->get_hex_value() )); if (svg_stroke_color_) properties.push_back(_property(L"stroke-color", svg_stroke_color_->get_hex_value() ));
if (draw_fill_) properties.push_back(_property(L"fill", draw_fill_.get())); if (draw_fill_) properties.push_back(_property(L"fill", draw_fill_->get_type_ms()));
if (draw_stroke_) properties.push_back(_property(L"stroke", draw_stroke_->get_type() )); if (draw_stroke_) properties.push_back(_property(L"stroke", draw_stroke_->get_type() ));
if (draw_stroke_dash_) properties.push_back(_property(L"stroke-dash", draw_stroke_dash_.get())); if (draw_stroke_dash_) properties.push_back(_property(L"stroke-dash", draw_stroke_dash_.get()));
if (svg_stroke_width_) properties.push_back(_property(L"stroke-width", svg_stroke_width_->get_length().get_value_unit(odf::length::pt) )); if (svg_stroke_width_) properties.push_back(_property(L"stroke-width", svg_stroke_width_->get_length().get_value_unit(odf::length::pt) ));
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "linestyle.h" #include "linestyle.h"
#include "markerstyle.h" #include "markerstyle.h"
#include "verticalalign.h" #include "verticalalign.h"
#include "drawfill.h"
namespace cpdoccore { namespace cpdoccore {
...@@ -49,7 +50,7 @@ public: ...@@ -49,7 +50,7 @@ public:
_CP_OPT(length_or_percent) svg_stroke_width_; _CP_OPT(length_or_percent) svg_stroke_width_;
_CP_OPT(length_or_percent) draw_opacity_; _CP_OPT(length_or_percent) draw_opacity_;
_CP_OPT(std::wstring) draw_stroke_dash_; _CP_OPT(std::wstring) draw_stroke_dash_;
_CP_OPT(std::wstring) draw_fill_; _CP_OPT(draw_fill) draw_fill_;
_CP_OPT(length_or_percent) svg_stroke_opacity_; _CP_OPT(length_or_percent) svg_stroke_opacity_;
_CP_OPT(color) svg_stroke_color_; _CP_OPT(color) svg_stroke_color_;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <iostream> #include <iostream>
#include <cpdoccore/xml/simple_xml_writer.h> #include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
...@@ -32,7 +33,6 @@ void presentation_placeholder::add_child_element( xml::sax * Reader, const ::std ...@@ -32,7 +33,6 @@ void presentation_placeholder::add_child_element( xml::sax * Reader, const ::std
void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Context) void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Context)
{ {
double cx = svg_width_.get_value_or(length(0)).get_value_unit(length::pt); double cx = svg_width_.get_value_or(length(0)).get_value_unit(length::pt);
double cy = svg_height_.get_value_or(length(0)).get_value_unit(length::pt); double cy = svg_height_.get_value_or(length(0)).get_value_unit(length::pt);
...@@ -54,5 +54,29 @@ void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Conte ...@@ -54,5 +54,29 @@ void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Conte
Context.get_slide_context().end_shape(); Context.get_slide_context().end_shape();
} }
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_drawing_page_properties::ns = L"style";
const wchar_t * style_drawing_page_properties::name = L"drawing-page-properties";
void style_drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
drawing_page_properties_.add_attributes(Attributes);
}
void style_drawing_page_properties::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:fill", draw_fill_);
CP_APPLY_ATTR(L"draw:fill-image-name", draw_fill_image_name_);
}
void drawing_page_properties::apply_from(const drawing_page_properties & Other)
{
_CP_APPLY_PROP2(draw_fill_);
_CP_APPLY_PROP2(draw_fill_image_name_);
}
} }
} }
#pragma once #pragma once
#include <cpdoccore/xml/attributes.h> #include "common_attlists.h"
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h> #include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h> #include <cpdoccore/xml/nodetype.h>
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include "length.h"
#include "presentationclass.h" #include "presentationclass.h"
#include "drawfill.h"
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
/// \class presentation_placeholder
/// presentation:placeholder // presentation:placeholder
class presentation_placeholder : public office_element_impl<presentation_placeholder> class presentation_placeholder : public office_element_impl<presentation_placeholder>
{ {
public: public:
...@@ -43,5 +43,63 @@ public: ...@@ -43,5 +43,63 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(presentation_placeholder); CP_REGISTER_OFFICE_ELEMENT2(presentation_placeholder);
//////////////////////////////////////////////
class drawing_page_properties
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const drawing_page_properties & Other);
////////////
_CP_OPT(draw_fill) draw_fill_;
_CP_OPT(std::wstring) draw_fill_image_name_;
//draw:fill-hatch-name
//draw:fill-gradient-name
//draw:fill-color
//_CP_OPT(std::wstring) presentation_transition_type_;
//presentation:transition-style
//presentation:transition-speed
//presentation:display-footer
//presentation:display-page-number
//presentation:display-date-time
//presentation:display-header
//presentation:background-objects-visible
//presentation:background-visible
//style:repeat
//presentation:page-duration
//presentation:visibility.
//presentation:sound.
//draw:background-size
};
//style:drawing-page-properties
class style_drawing_page_properties : public office_element_impl<style_drawing_page_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleDrawingPageProperties;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
//virtual void pptx_convert(oox::pptx_conversion_context & Context);
const drawing_page_properties & content() const { return drawing_page_properties_; }
public:
drawing_page_properties drawing_page_properties_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_drawing_page_properties);
} }
} }
...@@ -157,9 +157,14 @@ namespace svg_path ...@@ -157,9 +157,14 @@ namespace svg_path
const int nLen(rSvgDStatement.length()); const int nLen(rSvgDStatement.length());
int nPos(0); int nPos(0);
bool bIsClosed(false); bool bIsClosed(false);
double nLastX( 0.0 );
double nLastX( 0.0 );
double nLastY( 0.0 ); double nLastY( 0.0 );
_polyline aCurrPoly;
double nLastControlX( 0.0 );
double nLastControlY( 0.0 );
_polyline aCurrPoly;
// skip initial whitespace // skip initial whitespace
skipSpaces(nPos, rSvgDStatement, nLen); skipSpaces(nPos, rSvgDStatement, nLen);
...@@ -260,7 +265,7 @@ namespace svg_path ...@@ -260,7 +265,7 @@ namespace svg_path
} }
case 'H' : case 'H' :
{ {
aCurrPoly.command=L"lnTo"; aCurrPoly.command=L"a:lnTo";
nPos++; nPos++;
skipSpaces(nPos, rSvgDStatement, nLen); skipSpaces(nPos, rSvgDStatement, nLen);
...@@ -293,7 +298,7 @@ namespace svg_path ...@@ -293,7 +298,7 @@ namespace svg_path
} }
case 'V' : case 'V' :
{ {
aCurrPoly.command =L"v"; aCurrPoly.command =L"a:v";
nPos++; nPos++;
skipSpaces(nPos, rSvgDStatement, nLen); skipSpaces(nPos, rSvgDStatement, nLen);
...@@ -326,7 +331,7 @@ namespace svg_path ...@@ -326,7 +331,7 @@ namespace svg_path
} }
case 'S' : case 'S' :
{ {
aCurrPoly.command=L"cubicBezTo"; aCurrPoly.command=L"a:cubicBezTo";
nPos++; nPos++;
skipSpaces(nPos, rSvgDStatement, nLen); skipSpaces(nPos, rSvgDStatement, nLen);
...@@ -334,6 +339,7 @@ namespace svg_path ...@@ -334,6 +339,7 @@ namespace svg_path
{ {
double nX, nY; double nX, nY;
double nX2, nY2; double nX2, nY2;
double nX1, nY1;
if(!importDoubleAndSpaces(nX2, nPos, rSvgDStatement, nLen)) return false; if(!importDoubleAndSpaces(nX2, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nY2, nPos, rSvgDStatement, nLen)) return false; if(!importDoubleAndSpaces(nY2, nPos, rSvgDStatement, nLen)) return false;
...@@ -348,30 +354,12 @@ namespace svg_path ...@@ -348,30 +354,12 @@ namespace svg_path
nY += nLastY; nY += nLastY;
} }
//// ensure existance of start point // use mirrored previous control point
//if(aCurrPoly.points.size()<1) nX1 =((2.0 * nLastX) - nLastControlX);
//{ nY1 =((2.0 * nLastY) - nLastControlY);
// aCurrPoly.points.push_back(_point(nLastX, nLastY));
//} // append curved edge
aCurrPoly.points.push_back(_point(nX1, nY1));
// get first control point. It's the reflection of the PrevControlPoint
// of the last point. If not existent, use current point (see SVG)
//_point aPrevControl=_point(nLastX, nLastY);
// const int nIndex(aCurrPoly.points.size() - 1);
//if(aCurrPoly.areControlPointsUsed() && aCurrPoly.isPrevControlPointUsed(nIndex))
//{
// const _point aPrevPoint(aCurrPoly.points[nIndex]);
// const _point aPrevControlPoint(aCurrPoly.points[nIndex]);//getPrevControlPoint(nIndex));
// // use mirrored previous control point
// aPrevControl.x=((2.0 * aPrevPoint.x) - aPrevControlPoint.x);
// aPrevControl.y=((2.0 * aPrevPoint.y) - aPrevControlPoint.y);
//}
// append curved edge
//aCurrPoly.appendBezierSegment();
//aCurrPoly.points.push_back(aPrevControl);
aCurrPoly.points.push_back(_point(nX2, nY2)); aCurrPoly.points.push_back(_point(nX2, nY2));
aCurrPoly.points.push_back(_point(nX, nY)); aCurrPoly.points.push_back(_point(nX, nY));
...@@ -381,7 +369,11 @@ namespace svg_path ...@@ -381,7 +369,11 @@ namespace svg_path
// set last position // set last position
nLastX = nX; nLastX = nX;
nLastY = nY; nLastY = nY;
}
//keep control point
nLastControlX = nX2;
nLastControlY = nY2;
}
break; break;
} }
...@@ -419,12 +411,6 @@ namespace svg_path ...@@ -419,12 +411,6 @@ namespace svg_path
nY += nLastY; nY += nLastY;
} }
//// ensure existance of start point
//if(aCurrPoly.points.size()<1)
//{
// aCurrPoly.points.push_back(_point(nLastX, nLastY));
//}
// append curved edge // append curved edge
aCurrPoly.points.push_back(_point(nX1, nY1)); aCurrPoly.points.push_back(_point(nX1, nY1));
aCurrPoly.points.push_back(_point(nX2, nY2)); aCurrPoly.points.push_back(_point(nX2, nY2));
...@@ -436,6 +422,10 @@ namespace svg_path ...@@ -436,6 +422,10 @@ namespace svg_path
// set last position // set last position
nLastX = nX; nLastX = nX;
nLastY = nY; nLastY = nY;
//keep control point
nLastControlX = nX2;
nLastControlY = nY2;
} }
break; break;
} }
......
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