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

(1.0.0.142): ASCOfficeOdfFile

презентации: гиперлинки, ...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53024 954022d7-b5bf-4e40-9824-e11837661b57
parent f15d849e
......@@ -1808,6 +1808,14 @@
RelativePath=".\src\odf\office_elements_type.h"
>
</File>
<File
RelativePath=".\src\odf\office_event_listeners.cpp"
>
</File>
<File
RelativePath=".\src\odf\office_event_listeners.h"
>
</File>
<File
RelativePath=".\src\odf\office_presentation.cpp"
>
......
......@@ -25,6 +25,7 @@ public:
void docx_serialize_table_style(std::wostream & strm);
std::wstring & extern_node(){return extern_node_;}
std::wstring & hlinkClick(){return hlinkClick_;}
const odf::style_instance * get_current_processed_style() const { return current_processed_style_; }
void start_process_style(const odf::style_instance * Instance);
......@@ -33,6 +34,7 @@ public:
private:
const odf::style_instance *current_processed_style_;
std::wstring extern_node_;
std::wstring hlinkClick_;
std::wstringstream list_style_;
std::wstringstream text_style_;
......
......@@ -121,6 +121,21 @@ void pptx_conversion_context::start_document()
}
//void pptx_conversion_context::start_hyperlink(const std::wstring & styleName)
//{
// pptx_text_context_.start_hyperlink();
// pptx_text_context_.start_span(styleName);//???
//}
//
//void pptx_conversion_context::end_hyperlink(std::wstring const & href)
//{
// //std::wstring content = pptx_text_context_.end_span2();//????
//
// //hId from href
//
// std::wstring hId = get_slide_context().hyperlinks_.add(href);
// pptx_text_context_.end_hyperlink(get_table_context().end_hyperlink(current_cell_address(), href, L""));
//}
void pptx_conversion_context::end_document()
{
......
......@@ -103,8 +103,9 @@ public:
mediaitems & get_mediaitems() { return pptx_slide_context_.get_mediaitems(); }
// void start_hyperlink(const std::wstring & styleName);
// void end_hyperlink(std::wstring const & href);
//void start_hyperlink(const std::wstring & styleName);//
//void end_hyperlink(std::wstring const & href);
void process_master_pages();
void process_layouts();
void process_styles();
......
......@@ -241,7 +241,7 @@ void pptx_slide_context::process_drawings()
{
process_shapes();
process_images();
//process_charts();
process_charts();
}
void pptx_slide_context::process_images()
{
......
......@@ -169,12 +169,14 @@ std::wstring pptx_text_context::Impl::end_span2()
}
void pptx_text_context::Impl::start_hyperlink()
{
dump_paragraph();//
dump_run();//
}
void pptx_text_context::Impl::end_hyperlink(std::wstring hId)
{
hyperlink_hId = hId;
dump_run();
hyperlink_hId = L"";
}
void pptx_text_context::Impl::ApplyTextProperties(std::wstring style,odf::text_format_properties_content & propertiesOut, odf::style_family::type Type)
{
......@@ -286,6 +288,8 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
text_properties_.apply_from(text_properties_span_);
get_styles_context().start();
get_styles_context().hlinkClick() = hyperlink_hId;
text_properties_.pptx_convert(pptx_context_);
strm << get_styles_context().text_style().str();
......@@ -306,6 +310,11 @@ std::wstring pptx_text_context::Impl::dump_paragraph()
write_pPr(CP_XML_STREAM());
CP_XML_STREAM() << run_.str();
//CP_XML_NODE(L"a:endParaRPr") //- /
//{
// CP_XML_ATTR(L"dirty", 0);
//}
}
}
run_.str(std::wstring());
......@@ -354,10 +363,17 @@ void pptx_text_context::Impl::start_drawing_content()
std::wstring pptx_text_context::Impl::end_drawing_content()
{
dump_paragraph();
std::wstring & str_paragraph = paragraph_.str();
std::wstringstream str_styles;
if (str_paragraph.length() > 0)
{
write_list_styles(str_styles);
str_styles << dump_paragraph();
str_styles << str_paragraph;
}
paragraphs_cout_ = 0;
......
......@@ -139,7 +139,7 @@ void common_writing_mode_attlist::add_attributes( const xml::attributes_wc_ptr &
//////////////////////////////////////////////////////////////////////////////////////////////////
bool common_draw_data_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
bool common_xlink_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
bool b = CP_APPLY_ATTR(L"xlink:href", xlink_href_);
CP_APPLY_ATTR(L"xlink:type", xlink_type_);
......
......@@ -21,6 +21,7 @@
#include "style_ref.h"
#include "linewidth.h"
#include "presentationclass.h"
#include "xlink.h"
#define _CP_APPLY_PROP(A, B) \
if (B) \
......@@ -170,11 +171,11 @@ private:
};
/// common-draw-data-attlist
class common_draw_data_attlist
class common_xlink_attlist
{
public:
bool add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_data_attlist & Other)
void apply_from(const common_xlink_attlist & Other)
{
_CP_APPLY_PROP(xlink_href_, Other.xlink_href_);
_CP_APPLY_PROP(xlink_type_, Other.xlink_type_);
......@@ -184,9 +185,9 @@ public:
public:
_CP_OPT(std::wstring) xlink_href_;
_CP_OPT(std::wstring) xlink_type_;
_CP_OPT(std::wstring) xlink_show_;
_CP_OPT(std::wstring) xlink_actuate_;
_CP_OPT(xlink_type) xlink_type_;
_CP_OPT(xlink_show) xlink_show_;
_CP_OPT(xlink_actuate) xlink_actuate_;
};
......
......@@ -197,12 +197,10 @@ void draw_a::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, co
}
void draw_a::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"office:name", office_name_, std::wstring(L""));
CP_APPLY_ATTR(L"xlink:href", xlink_href_, std::wstring(L""));
CP_APPLY_ATTR(L"xlink:type", xlink_type_);
CP_APPLY_ATTR(L"xlink:actuate", xlink_actuate_);
CP_APPLY_ATTR(L"office:target-frame-name", office_target_frame_name_);
CP_APPLY_ATTR(L"xlink:show", xlink_show_);
CP_APPLY_ATTR(L"text:style-name", text_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"text:visited-style-name", text_visited_style_name_, style_ref(L""));
......@@ -210,7 +208,8 @@ void draw_a::add_attributes( const xml::attributes_wc_ptr & Attributes )
void draw_a::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_drawing_context().add_hyperlink(xlink_href_,true);// .. -
Context.get_drawing_context().add_hyperlink(common_xlink_attlist_.xlink_href_.get_value_or(L""),true);
// .. -
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
......@@ -219,7 +218,7 @@ void draw_a::xlsx_convert(oox::xlsx_conversion_context & Context)
}
void draw_a::pptx_convert(oox::pptx_conversion_context & Context)
{
////// Context.get_slide_context().add_hyperlink(xlink_href_,true);// .. -
Context.get_slide_context().add_hyperlink(common_xlink_attlist_.xlink_href_.get_value_or(L""),true);// .. -
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
......@@ -228,7 +227,7 @@ void draw_a::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_a::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring rId = Context.add_hyperlink(xlink_href_, true);
std::wstring rId = Context.add_hyperlink(common_xlink_attlist_.xlink_href_.get_value_or(L""), true);// , ..
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
......
......@@ -53,19 +53,16 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
//common_draw_data_attlist common_draw_data_attlist_;
office_element_ptr_array content_;
friend class odf_document;
private:
common_xlink_attlist common_xlink_attlist_;
::std::wstring office_name_;
::std::wstring xlink_href_;
_CP_OPT(xlink_type) xlink_type_;
_CP_OPT(xlink_actuate) xlink_actuate_;
_CP_OPT(target_frame_name) office_target_frame_name_;
_CP_OPT(xlink_show) xlink_show_;
style_ref text_style_name_;
style_ref text_visited_style_name_;
......
......@@ -60,7 +60,7 @@ const wchar_t * draw_image::name = L"image";
void draw_image::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_image_attlist_.add_attributes(Attributes);
common_draw_data_attlist_.add_attributes(Attributes);
common_xlink_attlist_.add_attributes(Attributes);
}
void draw_image::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
......@@ -93,7 +93,7 @@ const wchar_t * draw_chart::name = L"chart";
void draw_chart::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_chart_attlist_.add_attributes(Attributes);
common_draw_data_attlist_.add_attributes(Attributes);
common_xlink_attlist_.add_attributes(Attributes);
}
void draw_chart::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
......@@ -237,7 +237,7 @@ const wchar_t * draw_object::name = L"object";
void draw_object::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_object_attlist_.add_attributes(Attributes);
common_draw_data_attlist_.add_attributes(Attributes);
common_xlink_attlist_.add_attributes(Attributes);
}
void draw_object::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
......
......@@ -46,7 +46,7 @@ private:
private:
draw_image_attlist draw_image_attlist_;
common_draw_data_attlist common_draw_data_attlist_;
common_xlink_attlist common_xlink_attlist_;
office_element_ptr office_binary_data_;
office_element_ptr_array content_;
......@@ -89,7 +89,7 @@ private:
private:
draw_chart_attlist draw_chart_attlist_;
common_draw_data_attlist common_draw_data_attlist_;
common_xlink_attlist common_xlink_attlist_;
//office_element_ptr title_;
office_element_ptr_array content_;
......@@ -276,7 +276,7 @@ private:
public:
draw_object_attlist draw_object_attlist_;
common_draw_data_attlist common_draw_data_attlist_;
common_xlink_attlist common_xlink_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_object);
......
......@@ -696,12 +696,13 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
const std::wstring styleName = styleRef ? styleRef->style_name() : L"";
std::vector<const odf::style_instance *> instances;
odf::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf::style_family::Graphic,Context.process_headers_footers_);
if (styleInst)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle);
odf::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf::style_family::Graphic,Context.process_headers_footers_);
if (styleInst)instances.push_back(styleInst);
instances.push_back(styleInst);
}
graphic_format_properties graphicProperties = calc_graphic_properties_content(instances);
const std::wstring pagePropertiesName = Context.get_page_properties();
......@@ -911,10 +912,10 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
void draw_image::docx_convert(oox::docx_conversion_context & Context)
{
if (!common_draw_data_attlist_.xlink_href_)
if (!common_xlink_attlist_.xlink_href_)
return;
std::wstring href = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
std::wstring href = common_xlink_attlist_.xlink_href_.get_value_or(L"");
int pos_replaicement= href.find(L"ObjectReplacements");
if (pos_replaicement >=0)
return;//
......@@ -947,8 +948,6 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
Context.set_stream_man(prev);
/////////////////////////////////////////////////////////////////////////////////////////////////////
const std::wstring hrefType = common_draw_data_attlist_.xlink_type_.get_value_or(L"");
oox::_docx_drawing drawing = oox::_docx_drawing();
drawing.type = oox::mediaitems::typeImage;
......@@ -1137,8 +1136,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
{
try
{
std::wstring href = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring hrefType = common_draw_data_attlist_.xlink_type_.get_value_or(L"");
std::wstring href = common_xlink_attlist_.xlink_href_.get_value_or(L"");
odf::odf_document * odf = Context.root();
const std::wstring folder = odf->get_folder();
......
......@@ -97,12 +97,16 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
//////////////////////////////////////////////
std::vector<const odf::style_instance *> instances;
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle);
odf::style_instance* styleInst =
Context.root()->odf_context().styleContainer().style_by_name(styleName, odf::style_family::Graphic,false/*process_headers_footers_*/);
if (styleInst)instances.push_back(styleInst);
if (styleInst)
{
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);
}
graphic_format_properties properties = calc_graphic_properties_content(instances);
////////////////////////////////////////////////////////////////////
......@@ -110,7 +114,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_property(odf::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
Context.get_slide_context().set_property(odf::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
Context.get_slide_context().set_property(odf::_property(L"border_width_right",Compute_BorderWidth(properties, sideRight)));
Context.get_slide_context().set_property(odf::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
Context.get_slide_context().set_property(odf::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
if (properties.fo_clip_)
......@@ -137,7 +141,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
{
const std::wstring href = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring href = common_xlink_attlist_.xlink_href_.get_value_or(L"");
Context.get_slide_context().start_image(href);
//////////////////////////////////// ...
......@@ -162,7 +166,7 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_chart::pptx_convert(oox::pptx_conversion_context & Context)
{
const std::wstring href = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring href = common_xlink_attlist_.xlink_href_.get_value_or(L"");
Context.get_slide_context().start_chart(href);
//BOOST_FOREACH(office_element_ptr const & elm, content_)
......@@ -203,8 +207,7 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
{
try {
const std::wstring href = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring hrefType = common_draw_data_attlist_.xlink_type_.get_value_or(L"");
const std::wstring href = common_xlink_attlist_.xlink_href_.get_value_or(L"");
odf::odf_document::Impl * odfImpl = Context.root()->get_impl();
const std::wstring folder = odfImpl->get_folder();
......@@ -236,7 +239,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
if (chartBuild.object_type_ == 1)//
{
const std::wstring href_draw = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring href_draw = common_xlink_attlist_.xlink_href_.get_value_or(L"");
chartBuild.pptx_convert(Context);
Context.get_slide_context().start_chart(href_draw); // , ...
......
......@@ -99,12 +99,15 @@ void draw_frame::xlsx_convert(oox::xlsx_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_*/);
if (styleInst)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle);
odf::style_instance* styleInst =
Context.root()->odf_context().styleContainer().style_by_name(styleName, odf::style_family::Graphic,false/*process_headers_footers_*/);
if (styleInst)instances.push_back(styleInst);
instances.push_back(styleInst);
}
graphic_format_properties properties = calc_graphic_properties_content(instances);
////////////////////////////////////////////////////////////////////
......@@ -139,7 +142,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
{
const std::wstring href = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring href = common_xlink_attlist_.xlink_href_.get_value_or(L"");
Context.get_drawing_context().start_image(href);
//////////////////////////////////// ...
Context.get_text_context().start_drawing_content();//... -
......@@ -163,7 +166,7 @@ void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
}
void draw_chart::xlsx_convert(oox::xlsx_conversion_context & Context)
{
const std::wstring href = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring href = common_xlink_attlist_.xlink_href_.get_value_or(L"");
Context.get_drawing_context().start_chart(href);
//BOOST_FOREACH(office_element_ptr const & elm, content_)
......@@ -208,8 +211,7 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
{
try {
const std::wstring href = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring hrefType = common_draw_data_attlist_.xlink_type_.get_value_or(L"");
const std::wstring href = common_xlink_attlist_.xlink_href_.get_value_or(L"");
odf::odf_document::Impl * odfImpl = Context.root()->get_impl();
const std::wstring folder = odfImpl->get_folder();
......@@ -241,7 +243,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
if (chartBuild.object_type_ == 1)//
{
const std::wstring href_draw = common_draw_data_attlist_.xlink_href_.get_value_or(L"");
const std::wstring href_draw = common_xlink_attlist_.xlink_href_.get_value_or(L"");
chartBuild.xlsx_convert(Context);
Context.get_drawing_context().start_chart(href_draw); // , ...
......
#include "precompiled_cpodf.h"
#include "draw_page.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <cpdoccore/formulasconvert.h>
#include <boost/lexical_cast.hpp>
#include "serialize_elements.h"
#include "odfcontext.h"
#include <cpdoccore/odf/odf_document.h>
#include "calcs_styles.h"
#include "search_table_cell.h"
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
namespace odf {
void draw_page::pptx_convert(oox::pptx_conversion_context & Context)
{
const std::wstring pageStyleName = draw_page_attr_.draw_style_name_.get_value_or(L"");
const std::wstring pageName = draw_page_attr_.draw_name_.get_value_or(L"");
const std::wstring layoutName = draw_page_attr_.page_layout_name_.get_value_or(L"");
const std::wstring masterName = draw_page_attr_.master_page_name_.get_value_or(L"");
_CP_LOG(info) << L"[info][xlsx] process page(slide) \"" << pageName /*L"" */<< L"\"" << std::endl;
Context.start_page(pageName, pageStyleName, layoutName,masterName);
BOOST_FOREACH(const office_element_ptr& elm, content_)
{
elm->pptx_convert(Context);
}
Context.end_page();
}
}
}
\ No newline at end of file
......@@ -234,7 +234,7 @@ void draw_polygon_attlist::add_attributes( const xml::attributes_wc_ptr & Attrib
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
}
// draw:path
// draw:polygon
const wchar_t * draw_polygon::ns = L"draw";
const wchar_t * draw_polygon::name = L"polygon";
......@@ -426,6 +426,61 @@ void draw_caption::add_attributes( const xml::attributes_wc_ptr & Attributes )
sub_type_ = 1;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// draw-connector-attlist
void draw_connector_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"svg:d", svg_d_);
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
CP_APPLY_ATTR(L"draw:type",draw_type_);
}
// draw:connector
const wchar_t * draw_connector::ns = L"draw";
const wchar_t * draw_connector::name = L"connector";
void draw_connector::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_connector_attlist_.add_attributes(Attributes);
draw_shape::add_attributes(Attributes);
sub_type_ = 6;
}
void draw_connector::reset_svg_path()
{
if (draw_connector_attlist_.svg_d_)
{
std::vector<svg_path::_polyline> o_Polyline_pt;
std::vector<svg_path::_polyline> o_Polyline_cm;
bool res = svg_path::parseSvgD(o_Polyline_cm,draw_connector_attlist_.svg_d_.get(),false);
BOOST_FOREACH(svg_path::_polyline & poly, o_Polyline_cm)
{
for (long i=0;i<poly.points.size();i++)
{
if (poly.points[i].x)
{
poly.points[i].x = length(poly.points[i].x.get()/1000.,length::pt).get_value_unit(length::emu);
}
if (poly.points[i].y)
{
poly.points[i].y = length(poly.points[i].y.get()/1000.,length::pt).get_value_unit(length::emu);
}
}
o_Polyline_pt.push_back(poly);
}
if (o_Polyline_pt.size()>0)
{
// xml-oox ... drawing .. ..
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline_pt);
additional_.push_back(odf::_property(L"custom_path",output_.str()));
}
}
}
///////////////////////////////////////
}
}
\ No newline at end of file
......@@ -46,7 +46,7 @@ public:
void common_docx_convert(oox::docx_conversion_context & Context) ;
void common_pptx_convert(oox::pptx_conversion_context & Context) ;
common_draw_data_attlist common_draw_data_attlist_;
common_xlink_attlist common_xlink_attlist_;
common_presentation_attlist common_presentation_attlist_;
union_common_draw_attlists common_draw_attlists_;
......@@ -430,5 +430,38 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(draw_caption);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class draw_connector_attlist
{
public:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(std::wstring) svg_d_;
_CP_OPT(std::wstring) svg_viewbox_;
_CP_OPT(std::wstring) draw_type_;
};
/////////////////////////////////////////////////////////////////////////
class draw_connector : public draw_shape
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const ElementType type = typeDrawConnector;
static const xml::NodeType xml_type = xml::typeElement;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
draw_connector_attlist draw_connector_attlist_;
void reset_svg_path();
};
CP_REGISTER_OFFICE_ELEMENT2(draw_connector);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
\ No newline at end of file
......@@ -105,6 +105,16 @@ void draw_path::docx_convert(oox::docx_conversion_context & Context)
reset_svg_path();
draw_shape::docx_convert(Context);
}
void draw_connector::docx_convert(oox::docx_conversion_context & Context)
{
if (Context.get_drawing_context().get_current_level() >0 )return;
common_docx_convert(Context);
//...
reset_svg_path();
draw_shape::docx_convert(Context);
}
void draw_polygon::docx_convert(oox::docx_conversion_context & Context)
{
if (Context.get_drawing_context().get_current_level() >0 )return;
......
......@@ -77,13 +77,15 @@ 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)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle);
odf::style_instance* styleInst =
Context.root()->odf_context().styleContainer().style_by_name(styleName, odf::style_family::Graphic,false/*Context.process_headers_footers_*/);
if (styleInst)instances.push_back(styleInst);
instances.push_back(styleInst);
}
graphic_format_properties properties = calc_graphic_properties_content(instances);
////////////////////////////////////////////////////////////////////////////////////
......@@ -109,7 +111,7 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_rect::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().start_shape(2);
Context.get_slide_context().start_shape(sub_type_);
common_pptx_convert(Context);
......@@ -117,7 +119,7 @@ void draw_rect::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_ellipse::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().start_shape(3);
Context.get_slide_context().start_shape(sub_type_);
common_pptx_convert(Context);
......@@ -125,7 +127,7 @@ void draw_ellipse::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_circle::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().start_shape(4);
Context.get_slide_context().start_shape(sub_type_);
common_pptx_convert(Context);
......@@ -133,7 +135,7 @@ void draw_circle::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_line::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().start_shape(5);
Context.get_slide_context().start_shape(sub_type_);
reset_svg_attributes();
......@@ -147,7 +149,7 @@ void draw_path::pptx_convert(oox::pptx_conversion_context & Context)
{
reset_svg_path();
///////////////////////////////////////////////////////////////////////
Context.get_slide_context().start_shape(6);
Context.get_slide_context().start_shape(sub_type_);
common_pptx_convert(Context);
......@@ -157,7 +159,7 @@ void draw_polygon::pptx_convert(oox::pptx_conversion_context & Context)
{
reset_polygon_path();
///////////////////////////////////////////////////////////////////////
Context.get_slide_context().start_shape(8);
Context.get_slide_context().start_shape(sub_type_);
common_pptx_convert(Context);
......@@ -165,7 +167,7 @@ void draw_polygon::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_custom_shape::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().start_shape(7);
Context.get_slide_context().start_shape(sub_type_);
common_pptx_convert(Context);
......@@ -175,13 +177,29 @@ void draw_caption::pptx_convert(oox::pptx_conversion_context & Context)
{
//const std::wstring style = common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
Context.get_slide_context().start_shape(1);//rect - .. - TextBox
Context.get_slide_context().start_shape(sub_type_);//rect - .. - TextBox
common_pptx_convert(Context);
Context.get_slide_context().end_shape();
}
void draw_connector::pptx_convert(oox::pptx_conversion_context & Context)
{
reset_svg_path();
///////////////////////////////////////////////////////////////////////
int type=sub_type_;
//if (draw_connector_attlist_.draw_type_)
//{
// if (*draw_connector_attlist_.draw_type_ == L"curve") type = 6;
// if (*draw_connector_attlist_.draw_type_ == L"line") type = 5;
//}
Context.get_slide_context().start_shape(type);
common_pptx_convert(Context);
Context.get_slide_context().end_shape();
}
void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context)
{
find_draw_type_oox();
......
......@@ -78,12 +78,15 @@ void draw_shape::common_xlsx_convert(oox::xlsx_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)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle);
odf::style_instance* styleInst =
Context.root()->odf_context().styleContainer().style_by_name(styleName, odf::style_family::Graphic,false/*Context.process_headers_footers_*/);
if (styleInst)instances.push_back(styleInst);
instances.push_back(styleInst);
}
graphic_format_properties properties = calc_graphic_properties_content(instances);
////////////////////////////////////////////////////////////////////////////////////
......@@ -153,6 +156,17 @@ void draw_path::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_drawing_context().end_shape();
}
void draw_connector::xlsx_convert(oox::xlsx_conversion_context & Context)
{
reset_svg_path();
///////////////////////////////////////////////////////////////////////
Context.get_drawing_context().start_shape(6);
common_xlsx_convert(Context);
Context.get_drawing_context().end_shape();
}
void draw_polygon::xlsx_convert(oox::xlsx_conversion_context & Context)
{
reset_polygon_path();
......
......@@ -91,7 +91,7 @@ void svg_font_face_name::add_text(const std::wstring & Text)
void common_svg_font_face_xlink_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"xlink:href", xlink_href_);
common_xlink_attlist_.add_attributes(Attributes);
}
// svg:definition-src
......
#ifndef _CPDOCCORE_ODF_FONT_FACE_H_
#define _CPDOCCORE_ODF_FONT_FACE_H_
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
......@@ -16,6 +15,9 @@
#include "fontfamilygeneric.h"
#include "fontpitch.h"
#include "common_attlists.h"
namespace cpdoccore {
namespace odf {
......@@ -25,9 +27,7 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
optional<std::wstring>::Type xlink_href_;
// xlink:type
// xlink:actuate
common_xlink_attlist common_xlink_attlist_;
};
/// \class svg_font_face_uri
......@@ -239,5 +239,4 @@ CP_REGISTER_OFFICE_ELEMENT2(office_font_face_decls);
}
}
#endif
......@@ -23,6 +23,7 @@
#include "office_annotation.h"
#include "office_settings.h"
#include "office_scripts.h"
#include "office_event_listeners.h"
#include "styles.h"
#include "style_regions.h"
......
......@@ -164,13 +164,15 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
//////////////////////////////////////////////////////////////////
/// Îáðàáàòûâàåì ñòèëü draw
std::vector<const odf::style_instance *> instances;
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
office_annotation_attr_.draw_style_name_.get_value_or(style_ref(L"")).style_name(), odf::style_family::Graphic,false/*Context.process_headers_footers_*/);
if (styleInst)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf::style_family::Graphic);
if (defaultStyle)instances.push_back(defaultStyle);
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
office_annotation_attr_.draw_style_name_.get_value_or(style_ref(L"")).style_name(), odf::style_family::Graphic,false/*Context.process_headers_footers_*/);
if (styleInst)instances.push_back(styleInst);
instances.push_back(styleInst);
}
graphic_format_properties graphicProperties = calc_graphic_properties_content(instances);
graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());
......
#ifndef CPDOCCORE_OFFICE_CHART_H_
#define CPDOCCORE_OFFICE_CHART_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
......@@ -658,5 +654,3 @@ CP_REGISTER_OFFICE_ELEMENT2(chart_stock_range_line);
}
}
#endif
......@@ -41,7 +41,6 @@ enum ElementType
typeDcCreator,
typeDcDate,
typeTextH,
typeTextP,
......@@ -57,7 +56,6 @@ enum ElementType
typeTextNumberedParagraph,
typeDrawA,
typeTextTableOfContent,
......@@ -189,22 +187,26 @@ enum ElementType
typeDrawHandle,
typeDrawEquation,
typeDrawPage,
typeStyleGraphicPropertis,
typeStyleDrawGradientPropertis,
typeOfficeSpreadsheet,
typeOfficeAnnotation,
typeStyleRegionLeft,
typeStyleRegionCenter,
typeStyleRegionRight,
typeOfficeScripts,
typeOfficeScript,
typeOfficePresentation,
typeOfficeChart,
typeOfficeEventListeners,
typePresentationEventListener,
typeScriptEventListener,
typeTableCalculationSettings,
typeTableNullDate,
typeOfficePresentation,
typeDrawPage,
typeNumberNumberStyle,
typeNumberDataStyle,
typeNumberText,
......@@ -229,7 +231,6 @@ enum ElementType
typeNumberAmPm,
typeTableShapes,
typeOfficeChart,
typeChartChart,
typeChartTitle,
typeChartSubtitle,
......@@ -252,6 +253,8 @@ enum ElementType
typeChartRegressionCurve,
typeChartEquation,
typeStyleRegionCenter,
typeStyleRegionRight,
typeStyleChartProperties
};
......
#include "precompiled_cpodf.h"
#include "office_event_listeners.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
namespace cpdoccore {
namespace odf {
// office:event_listeners
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_event_listeners::ns = L"office";
const wchar_t * office_event_listeners::name = L"event-listeners";
void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
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")
CP_CREATE_ELEMENT(presentation_event_listeners_);
else
CP_NOT_APPLICABLE_ELM();
}
// presentation:event-listener-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void presentation_event_listener_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"script:event_name", script_event_name_);
CP_APPLY_ATTR(L"presentation:action", presentation_action_);
//...
}
// presentation:event-listener
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_event_listener::ns = L"presentation";
const wchar_t * presentation_event_listener::name = L"event-listener";
void presentation_event_listener::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
presentation_event_listener_attlist_.add_attributes(Attributes);
}
void presentation_event_listener::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
if CP_CHECK_NAME(L"presentation", L"sound")
CP_CREATE_ELEMENT(presentation_sound_);
else
CP_NOT_APPLICABLE_ELM();
}
// script:event-listener
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * script_event_listener::ns = L"script";
const wchar_t * script_event_listener::name = L"event-listener";
void script_event_listener::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void script_event_listener::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
}
}
#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 {
/// \brief office:event-listeners
class office_event_listeners : public office_element_impl<office_event_listeners>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeEventListeners;
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);
private:
office_element_ptr_array presentation_event_listeners_;
office_element_ptr_array script_event_listeners_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// presentation-event-listener-attlist
class presentation_event_listener_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) script_event_name_;
_CP_OPT(std::wstring) presentation_action_;
//presentation:verb
//presentation:start-scale
//presentation:speed
//presentation:direction
//presentation:effect
};
/// \brief presentation:event-listeners_
class presentation_event_listener : public office_element_impl<presentation_event_listener>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationEventListener;
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);
private:
//office_element_ptr_array content_;
office_element_ptr presentation_sound_;
presentation_event_listener_attlist presentation_event_listener_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_event_listener);
/// \brief script:event-listeners_
class script_event_listener : public office_element_impl<presentation_event_listener>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeScriptEventListener;
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);
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(script_event_listener);
}
}
\ 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"
namespace cpdoccore {
namespace odf {
/// \class office_presentation
/// \brief office:presentation
class office_presentation : public office_element_impl<office_presentation>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficePresentation;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
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 add_text(const std::wstring & Text);
public:
// TODO: office-text-content-prelude:
// TODO: office-forms
// TODO: text-tracked-changes
// TODO: text-decls
// TODO: table-decls
office_element_ptr_array content_;
// TODO: text-page-sequence
// TODO: office-text-content-epilogue:
// TODO: table-functions
};
CP_REGISTER_OFFICE_ELEMENT2(office_presentation);
}
}
#include "precompiled_cpodf.h"
#include "office_settings.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include "serialize_elements.h"
namespace cpdoccore {
namespace odf {
// office:scripts
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_settings::ns = L"office";
const wchar_t * office_settings::name = L"settings";
void office_settings::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void office_settings::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
// config_item_set
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * settings_config_item_set::ns = L"config";
const wchar_t * settings_config_item_set::name = L"config-item-set";
void settings_config_item_set::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void settings_config_item_set::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
// config_item
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * settings_config_item::ns = L"config";
const wchar_t * settings_config_item::name = L"config-item";
void settings_config_item::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void settings_config_item::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
// config_item_map_indexed
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * settings_config_item_map_indexed::ns = L"config";
const wchar_t * settings_config_item_map_indexed::name = L"config-item-map-indexed";
void settings_config_item_map_indexed::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void settings_config_item_map_indexed::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
// config_item_map_named
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * settings_config_item_map_named::ns = L"config";
const wchar_t * settings_config_item_map_named::name = L"config-item-map-named";
void settings_config_item_map_named::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void settings_config_item_map_named::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
// config_item_map_entry
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * settings_config_item_map_entry::ns = L"config";
const wchar_t * settings_config_item_map_entry::name = L"config-item-map-entry";
void settings_config_item_map_entry::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
}
void settings_config_item_map_entry::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
}
}
#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"
namespace cpdoccore {
namespace odf {
/// \class office_settings
/// \brief office:settings
class office_settings : public office_element_impl<office_settings>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeSettings;
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 add_text(const std::wstring & Text){}
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_settings);
/// \class config_item_set
/// \brief config:config-item-set
class settings_config_item_set : public office_element_impl<settings_config_item_set>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeSettingsConfigItemSet;
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 add_text(const std::wstring & Text){}
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_set);
/// \class config_item
/// \brief config:config-item
class settings_config_item : public office_element_impl<settings_config_item>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeSettingsConfigItem;
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 add_text(const std::wstring & Text){}
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(settings_config_item);
/// \class config_item_map_indexed
/// \brief config:config-item_map_indexed
class settings_config_item_map_indexed : public office_element_impl<settings_config_item_map_indexed>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeSettingsConfigItemMapIndexed;
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 add_text(const std::wstring & Text){}
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_indexed);
/// \class config_item_map_named
/// \brief config:config-item_map_named
class settings_config_item_map_named : public office_element_impl<settings_config_item_map_named>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeSettingsConfigItemMapNamed;
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 add_text(const std::wstring & Text){}
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_named);
/// \class config_item
/// \brief config:config-item
class settings_config_item_map_entry : public office_element_impl<settings_config_item_map_entry>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeSettingsConfigItemMapEntry;
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 add_text(const std::wstring & Text){}
private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(settings_config_item_map_entry);
}
}
\ No newline at end of file
......@@ -406,12 +406,10 @@ const wchar_t * a::name = L"a";
void a::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"office:name", office_name_, std::wstring(L""));
CP_APPLY_ATTR(L"xlink:href", xlink_href_, std::wstring(L""));
CP_APPLY_ATTR(L"xlink:type", xlink_type_);
CP_APPLY_ATTR(L"xlink:actuate", xlink_actuate_);
CP_APPLY_ATTR(L"office:target-frame-name", office_target_frame_name_);
CP_APPLY_ATTR(L"xlink:show", xlink_show_);
CP_APPLY_ATTR(L"text:style-name", text_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"text:visited-style-name", text_visited_style_name_, style_ref(L""));
}
......@@ -438,7 +436,7 @@ void a::docx_convert(oox::docx_conversion_context & Context)
std::wostream & _Wostream = Context.output_stream();
std::wstring rId;
rId = Context.add_hyperlink(xlink_href_, false);
rId = Context.add_hyperlink(common_xlink_attlist_.xlink_href_.get_value_or(L""), false);
_Wostream << L"<w:hyperlink r:id=\"" << rId << L"\">";
......@@ -499,21 +497,19 @@ void a::xlsx_convert(oox::xlsx_conversion_context & Context)
{
elm->xlsx_convert(Context);
}
Context.end_hyperlink(xlink_href_);
Context.end_hyperlink(common_xlink_attlist_.xlink_href_.get_value_or(L""));
}
void a::pptx_convert(oox::pptx_conversion_context & Context)
{
if (style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_.style_name(), style_family::Text,false))
Context.get_text_context().get_styles_context().start_process_style(styleInst);
// Context.start_hyperlink(text_style_name_.style_name());
Context.get_text_context().start_hyperlink();
BOOST_FOREACH(const office_element_ptr & elm, paragraph_content_)
{
elm->pptx_convert(Context);
}
// Context.end_hyperlink(xlink_href_);
Context.get_text_context().get_styles_context().end_process_style();
std::wstring hId = Context.get_slide_context().add_hyperlink(common_xlink_attlist_.xlink_href_.get_value_or(L""),false);
Context.get_text_context().end_hyperlink(hId);
}
// text:note
//////////////////////////////////////////////////////////////////////////////////////////////////
......
#ifndef _CPDOCCORE_ODF_PARAGRAPH_ELEMENTS_H_
#define _CPDOCCORE_ODF_PARAGRAPH_ELEMENTS_H_
#pragma once
#include <iosfwd>
#include <vector>
......@@ -9,11 +8,12 @@
#include "paragraph_content.h"
#include "office_elements_create.h"
#include "style_ref.h"
#include "xlink.h"
#include "targetframename.h"
#include "noteclass.h"
#include "../docx/docx_conversion_context.h"
#include "common_attlists.h"
namespace cpdoccore {
namespace odf {
......@@ -418,18 +418,14 @@ private:
virtual void add_text(const std::wstring & Text);
private:
common_xlink_attlist common_xlink_attlist_;
::std::wstring office_name_;
::std::wstring xlink_href_;
_CP_OPT(xlink_type) xlink_type_;
_CP_OPT(xlink_actuate) xlink_actuate_;
_CP_OPT(target_frame_name) office_target_frame_name_;
_CP_OPT(xlink_show) xlink_show_;
style_ref text_style_name_;
style_ref text_visited_style_name_;
// office-event-listeners ?
office_element_ptr_array paragraph_content_;
};
......@@ -763,5 +759,3 @@ CP_REGISTER_OFFICE_ELEMENT2(sheet_name);
} // namespace text
} // namespace odf
} // namespace cpdoccore
#endif // #ifndef _CPDOCCORE_ODF_PARAGRAPH_ELEMENTS_H_
#ifndef _CPDOCCORE_ODF_SERIALIZE_ELEMENTS_H_
#define _CPDOCCORE_ODF_SERIALIZE_ELEMENTS_H_
#pragma once
#include "office_elements.h"
#include <boost/foreach.hpp>
......@@ -45,5 +44,3 @@ inline ::std::wostream & serialize_elements_text(::std::wostream & _Wostream, co
}
}
#endif
......@@ -116,10 +116,10 @@ void style_background_image::add_attributes( const xml::attributes_wc_ptr & Attr
CP_APPLY_ATTR(L"filter:name", filter_name_);
CP_APPLY_ATTR(L"draw:opacity", draw_opacity_);
common_draw_data_attlist tmp;
common_xlink_attlist tmp;
if (tmp.add_attributes(Attributes))
{
common_draw_data_attlist_ = _CP_OPT(common_draw_data_attlist)(tmp);
common_xlink_attlist_ = _CP_OPT(common_xlink_attlist)(tmp);
}
}
......
......@@ -140,7 +140,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text);
_CP_OPT(common_draw_data_attlist) common_draw_data_attlist_;
_CP_OPT(common_xlink_attlist) common_xlink_attlist_;
};
......@@ -172,7 +172,7 @@ private:
_CP_OPT(std::wstring) filter_name_;
_CP_OPT(percent) draw_opacity_;
_CP_OPT(common_draw_data_attlist) common_draw_data_attlist_;
_CP_OPT(common_xlink_attlist) common_xlink_attlist_;
office_element_ptr office_binary_data_;
};
......
......@@ -511,14 +511,6 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
// _rPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\" />";
//}
//if (hyperlink_hId.length()>0)
//{
// CP_XML_NODE(L"a:hlinkClick ")
// {
// CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
// CP_XML_ATTR(L"r:id", hyperlink_hId);
// }
//}
if (fo_color_)
{
CP_XML_NODE(L"a:solidFill")
......@@ -526,6 +518,14 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
CP_XML_NODE(L"a:srgbClr"){CP_XML_ATTR(L"val",fo_color_->get_hex_value());}
}
}
if (styles_context_.hlinkClick().length()>0)
{
CP_XML_NODE(L"a:hlinkClick")
{
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:id",styles_context_.hlinkClick());
}
}
}
}
}
......
......@@ -76,7 +76,8 @@ void table_table_source_attlist::add_attributes( const xml::attributes_wc_ptr &
void table_linked_source_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"xlink:href", xlink_href_);
common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"table:filter-name", table_filter_name_);
CP_APPLY_ATTR(L"table:filter-options", table_filter_options_);
CP_APPLY_ATTR(L"table:refresh-delay", table_refresh_delay_);
......
#ifndef _CPDOCCORE_ODF_TABLE_H_
#define _CPDOCCORE_ODF_TABLE_H_
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
......@@ -98,9 +97,8 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
// xlink:type
// xlink:actuate
_CP_OPT(std::wstring) xlink_href_;
common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) table_filter_name_;
_CP_OPT(std::wstring) table_filter_options_;
_CP_OPT(std::wstring) table_refresh_delay_;
......@@ -695,5 +693,3 @@ CP_REGISTER_OFFICE_ELEMENT2(table_shapes);
}
}
#endif
......@@ -217,7 +217,7 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
table_table_source* table_source = dynamic_cast<table_table_source*>( table_table_source_.get() );
if ( table_source)
{
if (table_source->table_linked_source_attlist_.xlink_href_)return;
if (table_source->table_linked_source_attlist_.common_xlink_attlist_.xlink_href_)return;
}
}
......
#ifndef _CPDOCCORE_ODF_TEXT_CONTENT_H_
#define _CPDOCCORE_ODF_TEXT_CONTENT_H_
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
......@@ -50,5 +49,3 @@ class text_content_impl : public office_element_impl<ElementT>
}
}
}
#endif // #ifndef _CPDOCCORE_ODF_TEXT_CONTENT_H_
......@@ -634,7 +634,8 @@ void text_section::docx_convert(oox::docx_conversion_context & Context)
void text_section_source_attr::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"xlink:href", xlink_href_);
common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"text:section-name", text_section_name_);
CP_APPLY_ATTR(L"text:filter-name", text_filter_name_);
}
......
#ifndef _CPDOCCORE_ODF_TEXT_ELEMENTS_H_
#define _CPDOCCORE_ODF_TEXT_ELEMENTS_H_
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
......@@ -9,6 +8,7 @@
#include "style_ref.h"
#include "office_elements_create.h"
#include "textdisplay.h"
#include "common_attlists.h"
namespace cpdoccore {
namespace odf {
......@@ -251,9 +251,8 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
_CP_OPT(std::wstring) xlink_href_;
// xlink:type
// xlink:show
common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) text_section_name_;
_CP_OPT(std::wstring) text_filter_name_;
......@@ -374,5 +373,3 @@ CP_REGISTER_OFFICE_ELEMENT2(text_index_title);
}
}
}
#endif // #ifndef _CPDOCCORE_ODF_TEXT_ELEMENTS_H_
#ifndef _CPDOCCORE_ODF_TEXTDISPLAY_H_
#define _CPDOCCORE_ODF_TEXTDISPLAY_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
......@@ -46,5 +41,3 @@ std::wostream & operator << (std::wostream & _Wostream, const text_display & _Va
APPLY_PARSE_XML_ATTRIBUTES(odf::text_display);
}
#endif
#ifndef _CPDOCCORE_ODF_XLINK_H_
#define _CPDOCCORE_ODF_XLINK_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
......@@ -89,5 +84,3 @@ APPLY_PARSE_XML_ATTRIBUTES(odf::xlink_show);
} // namespace cpdoccore
#endif // #ifndef _CPDOCCORE_ODF_XLINK_H_
\ No newline at end of file
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