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 @@
<Tool
Name="VCPreBuildEventTool"
CommandLine="D:\WORK\VersionControl.exe $(ProjectDir)\version.h"
ExcludedFromBuild="true"
ExcludedFromBuild="false"
/>
<Tool
Name="VCCustomBuildTool"
......@@ -215,7 +215,7 @@
<Tool
Name="VCPostBuildEventTool"
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
......
......@@ -2,6 +2,6 @@
//1
//0
//0
//142
#define INTVER 1,0,0,142
#define STRVER "1,0,0,142\0"
//144
#define INTVER 1,0,0,144
#define STRVER "1,0,0,144\0"
......@@ -5,8 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpxml", "cpxml.vcproj", "{4
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpodf", "cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}"
ProjectSection(ProjectDependencies) = postProject
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
EndProjectSection
EndProject
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
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFile", "ASCOfficeOdfFile\ASCOfficeOdfFile.vcproj", "{64B09C98-22DC-494E-A882-9E2D7D18557C}"
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}
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}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{64B09C98-22DC-494E-A882-9E2D7D18557C} = {64B09C98-22DC-494E-A882-9E2D7D18557C}
EndProjectSection
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}"
EndProject
Global
......
......@@ -481,6 +481,14 @@
RelativePath=".\src\odf\direction.h"
>
</File>
<File
RelativePath=".\src\odf\drawfill.cpp"
>
</File>
<File
RelativePath=".\src\odf\drawfill.h"
>
</File>
<File
RelativePath=".\src\odf\dropcaplength.cpp"
>
......@@ -1052,6 +1060,14 @@
RelativePath=".\src\docx\headers_footers.h"
>
</File>
<File
RelativePath=".\src\docx\hyperlinks.cpp"
>
</File>
<File
RelativePath=".\src\docx\hyperlinks.h"
>
</File>
<File
RelativePath=".\src\docx\namespaces.cpp"
>
......@@ -1378,14 +1394,6 @@
RelativePath=".\src\conversionelement.h"
>
</File>
<File
RelativePath=".\src\docx\hyperlinks.cpp"
>
</File>
<File
RelativePath=".\src\docx\hyperlinks.h"
>
</File>
<File
RelativePath=".\src\docx\measuredigits.cpp"
>
......@@ -1427,11 +1435,11 @@
>
</File>
<File
RelativePath=".\src\docx\oox_layout.cpp"
RelativePath=".\src\docx\oox_drawing_fills.cpp"
>
</File>
<File
RelativePath=".\src\docx\oox_layout.h"
RelativePath=".\src\docx\oox_drawing_fills.h"
>
</File>
<File
......@@ -1501,6 +1509,14 @@
RelativePath=".\src\docx\oox_data_labels.h"
>
</File>
<File
RelativePath=".\src\docx\oox_layout.cpp"
>
</File>
<File
RelativePath=".\src\docx\oox_layout.h"
>
</File>
<File
RelativePath=".\src\docx\oox_plot_area.cpp"
>
......
......@@ -43,7 +43,23 @@ namespace package
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
{
public:
......
#ifndef _CPDOCCORE_DOCX_PACKAGE_H_
#define _CPDOCCORE_DOCX_PACKAGE_H_
#pragma once
#include <string>
#include <vector>
......@@ -143,5 +142,3 @@ private:
}
}
}
#endif
#ifndef _CPDOCCORE_DOCS_HYPERLINKS_H_
#define _CPDOCCORE_DOCS_HYPERLINKS_H_
#pragma once
#include <vector>
#include <string>
......@@ -34,5 +33,3 @@ private:
}
}
#endif
......@@ -24,13 +24,7 @@ void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
{
std::wstring fillType = L"a:solidFill";
if (odf::GetProperty(content_,L"fill",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 (odf::GetProperty(content_,L"fill",strVal))fillType = *strVal;
odf::GetProperty(content_,L"fill-color",strVal);
if (strVal && fillType != L"a:noFill")
......
......@@ -46,23 +46,7 @@ private:
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)
{
std::wstring fillType;
if (odf::GetProperty(val.additional,L"fill",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 (odf::GetProperty(val.additional,L"fill",strVal))fillType = *strVal;
if (val.sub_type ==6)fillType = L"a:noFill";// ods ... !!
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()
odf::style_master_page * master =
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();
}
......@@ -421,8 +424,8 @@ void pptx_conversion_context::end_layout()
void pptx_conversion_context::end_master()
{
//get_slide_context().pptx_serializ(current_master().slideMasterData());
// get_slide_context().dump_rels(current_master().slideMasterRels());//hyperlinks, mediaitems, ...
get_slide_context().serialize(current_master().slideMasterData());
get_slide_context().dump_rels(current_master().slideMasterRels());//hyperlinks, mediaitems, ...
get_slide_context().end_slide();
}
......
......@@ -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"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")
......@@ -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)
{
std::wstring shapeType;
if (val.sub_type<9 && val.sub_type>=0)
{
shapeType = _ooxShapeType[val.sub_type];
}
if (val.sub_type == 7)//custom
{
_CP_OPT(int) iVal;
odf::GetProperty(val.additional,L"draw-type-index",iVal);
if (iVal)shapeType = _OO_OOX_custom_shapes[*iVal].oox;
}
else if (val.sub_type<9 && val.sub_type>=0)
{
shapeType = _ooxShapeType[val.sub_type];
}
//std::wstring shapeType;
//
//if (val.sub_type<9 && val.sub_type>=0)
//{
// shapeType = _ooxShapeType[val.sub_type];
//}
//if (val.sub_type == 7)//custom
//{
// _CP_OPT(int) iVal;
// odf::GetProperty(val.additional,L"draw-type-index",iVal);
// if (iVal)shapeType = _OO_OOX_custom_shapes[*iVal].oox;
//}
//else if (val.sub_type<9 && val.sub_type>=0)
//{
// 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_NODE(L"p:sp")
......@@ -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_);}
}
} // p:nv_Pr
}
CP_XML_NODE(L"p:spPr")
{
oox_serialize_xfrm(CP_XML_STREAM(),val);
if (!strTextContent)//
{
oox_serialize_shape(CP_XML_STREAM(),val);
oox_serialize_ln(CP_XML_STREAM(),val.additional);
}
} // p:spPr
oox_serialize_shape(CP_XML_STREAM(),val);
oox_serialize_ln(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)
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)
{
CP_XML_WRITER(strm)
......@@ -203,14 +200,10 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
CP_XML_NODE(L"a:effectLst");
}
}
if (slideMasterData_.str().length()>0)
CP_XML_NODE(L"p:spTree")
{
CP_XML_STREAM() << slideMasterData_.str();
}
else
{
CP_XML_STREAM() << strSlideMasterEmpty;
}
}
CP_XML_NODE(L"p:clrMap")
{
......
......@@ -301,7 +301,7 @@ std::wstring pptx_text_context::Impl::dump_paragraph()
std::wstring & str_run = run_.str();
if (str_run.length() > 0)
if (str_run.length() > 0 || styles_paragraph_.length() > 0)
{
CP_XML_WRITER(paragraph_)
{
......@@ -325,7 +325,8 @@ std::wstring pptx_text_context::Impl::dump_paragraph()
void pptx_text_context::Impl::dump_run()
{
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_)
{
......
#ifndef _CPDOCCORE_XLSX_COLOR_H_INCLUDED_
#define _CPDOCCORE_XLSX_COLOR_H_INCLUDED_
#pragma once
#include <iosfwd>
......@@ -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)
}
oox_serialize_clipping(CP_XML_STREAM(),val);
} // xdr:blipFill
}
CP_XML_NODE(L"xdr:spPr")
{
......
#ifndef _CPDOCCORE_XLSX_FILL_H_INCLUDED_
#define _CPDOCCORE_XLSX_FILL_H_INCLUDED_
#pragma once
#include <string>
#include <cpdoccore/CPOptional.h>
......@@ -32,8 +30,8 @@ struct xlsx_gradientFill
struct xlsx_fill
{
_CP_OPT(xlsx_patternFill) patternFill;
_CP_OPT(xlsx_gradientFill) gradientFill;
_CP_OPT(xlsx_patternFill) patternFill;
_CP_OPT(xlsx_gradientFill) gradientFill;
std::size_t index;
bool bDefault;
......@@ -46,5 +44,3 @@ struct xlsx_fill
}
}
#endif
#include "precompiled_cpodf.h"
#include "xlsx_fill.h"
#include "xlsx_fills.h"
#include "../odf/style_table_properties.h"
#include <cpdoccore/xml/simple_xml_writer.h>
#include <boost/foreach.hpp>
......
#ifndef _CPDOCCORE_XLSX_FILLS_H_INCLUDED_
#define _CPDOCCORE_XLSX_FILLS_H_INCLUDED_
#pragma once
#include <string>
#include <cpdoccore/CPOptional.h>
......@@ -46,5 +45,3 @@ private:
}
}
#endif
#ifndef _CPDOCCORE_XSLSSTYLES_H_INCLUDED_
#define _CPDOCCORE_XSLSSTYLES_H_INCLUDED_
#pragma once
#include <iosfwd>
#include <string>
......@@ -49,5 +48,3 @@ private:
}
}
#endif
#ifndef _CPDOCCORE_ODF_STYLEDIRECTION_H_
#define _CPDOCCORE_ODF_STYLEDIRECTION_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
......@@ -45,5 +40,3 @@ std::wostream & operator << (std::wostream & _Wostream, const direction & _Val);
APPLY_PARSE_XML_ATTRIBUTES(odf::direction);
}
#endif
......@@ -143,7 +143,7 @@ public:
// 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_;
office_element_ptr office_event_listeners_; // content -
office_element_ptr draw_glue_point_;
office_element_ptr draw_image_map_;
//office_element_ptr draw_chart_map_;
......
......@@ -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 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_.
common_draw_text_style_name_attlist_.
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)
//////////////////////////////////////////////
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/*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();
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);
if (defaultStyle)instances.push_back(defaultStyle);
instances.push_back(styleInst);
instances.push_back(grStyleInst);
}
graphic_format_properties properties = calc_graphic_properties_content(instances);
......@@ -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());
}
if (office_event_listeners_)office_event_listeners_->pptx_convert(Context);
////////////////////////////////////////////////
int i=0;
int size = content_.size();
......
......@@ -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 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_.
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)
}
/////////////////////////////////////////////////////////////////////////////////
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_*/);
if (styleInst)
const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
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);
if (defaultStyle)instances.push_back(defaultStyle);
instances.push_back(styleInst);
instances.push_back(grStyleInst);
}
graphic_format_properties properties = calc_graphic_properties_content(instances);
......
#ifndef _CPDOCCORE_ODF_NOTE_H_
#define _CPDOCCORE_ODF_NOTE_H_
#pragma once
#include <cpdoccore/CPOptional.h>
#include "office_elements.h"
......@@ -75,4 +74,3 @@ CP_REGISTER_OFFICE_ELEMENT2(note_body);
}
}
#endif
......@@ -105,6 +105,7 @@ enum ElementType
typeStylePresentationPageLayout,
typeStylePresentationPlaceholder,
typeStyleDrawingPageProperties,
typeStyleColumns,
typeStyleColumn,
......
......@@ -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)
{
if CP_CHECK_NAME(L"presentation", L"event-listener")
if CP_CHECK_NAME(L"presentation", L"event-listener")
CP_CREATE_ELEMENT(presentation_event_listeners_);
else if CP_CHECK_NAME(L"script", L"event-listener")
CP_CREATE_ELEMENT(script_event_listeners_);
else
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
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -57,6 +66,15 @@ void presentation_event_listener::add_child_element( xml::sax * Reader, const ::
else
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
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -21,6 +21,8 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeEventListeners;
CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -63,6 +65,8 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationEventListener;
CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......
......@@ -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 (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_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) ));
......
......@@ -23,6 +23,7 @@
#include "linestyle.h"
#include "markerstyle.h"
#include "verticalalign.h"
#include "drawfill.h"
namespace cpdoccore {
......@@ -49,7 +50,7 @@ public:
_CP_OPT(length_or_percent) svg_stroke_width_;
_CP_OPT(length_or_percent) draw_opacity_;
_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(color) svg_stroke_color_;
......
......@@ -3,6 +3,7 @@
#include <iostream>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
namespace odf {
......@@ -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)
{
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);
......@@ -54,5 +54,29 @@ void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Conte
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
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/CPOptional.h>
#include "common_attlists.h"
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "length.h"
#include "presentationclass.h"
#include "drawfill.h"
namespace cpdoccore {
namespace odf {
/// \class presentation_placeholder
/// presentation:placeholder
// presentation:placeholder
class presentation_placeholder : public office_element_impl<presentation_placeholder>
{
public:
......@@ -43,5 +43,63 @@ public:
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
const int nLen(rSvgDStatement.length());
int nPos(0);
bool bIsClosed(false);
double nLastX( 0.0 );
double nLastX( 0.0 );
double nLastY( 0.0 );
_polyline aCurrPoly;
double nLastControlX( 0.0 );
double nLastControlY( 0.0 );
_polyline aCurrPoly;
// skip initial whitespace
skipSpaces(nPos, rSvgDStatement, nLen);
......@@ -260,7 +265,7 @@ namespace svg_path
}
case 'H' :
{
aCurrPoly.command=L"lnTo";
aCurrPoly.command=L"a:lnTo";
nPos++;
skipSpaces(nPos, rSvgDStatement, nLen);
......@@ -293,7 +298,7 @@ namespace svg_path
}
case 'V' :
{
aCurrPoly.command =L"v";
aCurrPoly.command =L"a:v";
nPos++;
skipSpaces(nPos, rSvgDStatement, nLen);
......@@ -326,7 +331,7 @@ namespace svg_path
}
case 'S' :
{
aCurrPoly.command=L"cubicBezTo";
aCurrPoly.command=L"a:cubicBezTo";
nPos++;
skipSpaces(nPos, rSvgDStatement, nLen);
......@@ -334,6 +339,7 @@ namespace svg_path
{
double nX, nY;
double nX2, nY2;
double nX1, nY1;
if(!importDoubleAndSpaces(nX2, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nY2, nPos, rSvgDStatement, nLen)) return false;
......@@ -348,30 +354,12 @@ namespace svg_path
nY += nLastY;
}
//// ensure existance of start point
//if(aCurrPoly.points.size()<1)
//{
// aCurrPoly.points.push_back(_point(nLastX, nLastY));
//}
// 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);
// use mirrored previous control point
nX1 =((2.0 * nLastX) - nLastControlX);
nY1 =((2.0 * nLastY) - nLastControlY);
// append curved edge
aCurrPoly.points.push_back(_point(nX1, nY1));
aCurrPoly.points.push_back(_point(nX2, nY2));
aCurrPoly.points.push_back(_point(nX, nY));
......@@ -381,7 +369,11 @@ namespace svg_path
// set last position
nLastX = nX;
nLastY = nY;
}
//keep control point
nLastControlX = nX2;
nLastControlY = nY2;
}
break;
}
......@@ -419,12 +411,6 @@ namespace svg_path
nY += nLastY;
}
//// ensure existance of start point
//if(aCurrPoly.points.size()<1)
//{
// aCurrPoly.points.push_back(_point(nLastX, nLastY));
//}
// append curved edge
aCurrPoly.points.push_back(_point(nX1, nY1));
aCurrPoly.points.push_back(_point(nX2, nY2));
......@@ -436,6 +422,10 @@ namespace svg_path
// set last position
nLastX = nX;
nLastY = nY;
//keep control point
nLastControlX = nX2;
nLastControlY = nY2;
}
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