Пример #1
0
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances)
{
    graphic_format_properties result;

 	for (size_t i = 0; i < styleInstances.size(); i++)
	{
		graphic_format_properties f = calc_graphic_properties_content(styleInstances[i]);
        result.apply_from(&f);
    }
    return result;
}
Пример #2
0
void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
{
    const double x = 8 * office_annotation_attr_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
    const double y = 8 * office_annotation_attr_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
 /////////////////////////////////
	std::wstring date;
	std::wstring author;
 	std::pair<int,int> id_idx;
	
	if (dc_date_)
	{
		date = xml::utils::replace_text_to_xml(dynamic_cast<dc_date * >(dc_date_.get())->content_);
	}
	if (dc_creator_)
	{
		author = xml::utils::replace_text_to_xml(dynamic_cast<dc_creator * >(dc_creator_.get())->content_);
	}
	id_idx = Context.add_author_comments(author);

	Context.get_comments_context().start_comment(x, y,id_idx.first,id_idx.second);//author & idx (uniq number for author
	
	Context.get_text_context().start_comment_content();
	for (size_t i = 0; i < content_.size(); i++)//текст + текстовый стиль
    {
        content_[i]->pptx_convert(Context);
    }

	Context.get_comments_context().add_date(date);
	Context.get_comments_context().add_content(Context.get_text_context().end_comment_content());
	
//////////////////////////////////////////////////////////////////
    /// Обрабатываем стиль draw
	std::vector<const odf_reader::style_instance *> instances;
	style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
				office_annotation_attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
	if (styleInst)
	{
		style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
		if (defaultStyle)instances.push_back(defaultStyle);

		instances.push_back(styleInst);
	}
	graphic_format_properties graphicProperties = calc_graphic_properties_content(instances);	

	graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());

	const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");

	Context.get_comments_context().end_comment();
}
Пример #3
0
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance)
{
    std::vector<const graphic_format_properties*> graphicProps;
    while (styleInstance)
    {
        if (const style_content * content = styleInstance->content())
            if (const graphic_format_properties * graphicProp = content->get_graphic_properties())
			{
                graphicProps.insert(graphicProps.begin(), graphicProp);
			}
		
        styleInstance = styleInstance->parent();
	}
    return calc_graphic_properties_content(graphicProps);
}
Пример #4
0
void process_build_chart::ApplyGraphicProperties(std::wstring style, std::vector<_property> & propertiesOut, oox::_oox_fill & fill)
{
	style_instance* styleInst = styles_.style_by_name(style, odf_types::style_family::Chart, false/*Context.process_headers_footers_*/);
    if(styleInst)
	{
		graphic_format_properties properties = calc_graphic_properties_content(styleInst);

		Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_ , draw_styles_ , fill);

		if (fill.bitmap)
		{
			fill.bitmap->xlink_href_ = chart_build_.baseRef_ + FILE_SEPARATOR_STR + fill.bitmap->xlink_href_;
		}
		properties.apply_to(propertiesOut);
    }
}	
Пример #5
0
void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
{
    const _CP_OPT(length) svg_widthVal = office_annotation_attr_.svg_width_;
    
    const double width_cm = svg_widthVal.get_value_or(length(0)).get_value_unit(length::cm);
    const double width_pt = svg_widthVal.get_value_or(length(0)).get_value_unit(length::pt);
    
    const _CP_OPT(length) svg_heightVal =office_annotation_attr_.svg_height_;

    const double height_cm = svg_heightVal.get_value_or(length(0)).get_value_unit(length::cm);
    const double height_pt = svg_heightVal.get_value_or(length(0)).get_value_unit(length::pt);

    const double x_pt = office_annotation_attr_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
    const double y_pt = office_annotation_attr_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
 /////////////////////////////////
	std::wstring date;
 	std::wstring author;
	if (dc_date_)
	{
		date = xml::utils::replace_text_to_xml(dynamic_cast<dc_date * >(dc_date_.get())->content_);
	}
	if (dc_creator_)
	{
		author = xml::utils::replace_text_to_xml(dynamic_cast<dc_creator * >(dc_creator_.get())->content_);
	}
////////////////////////////////////////
	Context.get_comments_context().start_comment(width_pt, height_pt, x_pt, y_pt);
	if (office_annotation_attr_.display_)
	{
		Context.get_comments_context().set_visibly(office_annotation_attr_.display_.get());
	}  

	Context.get_text_context().start_comment_content();
	for (size_t i = 0; i < content_.size(); i++)//текст + текстовый стиль
    {
        content_[i]->xlsx_convert(Context);
    }
	Context.get_comments_context().add_author(author);
	Context.get_comments_context().add_content(Context.get_text_context().end_comment_content());
	

//////////////////////////////////////////////////////////////////
    /// Обрабатываем стиль draw
	std::vector<const odf_reader::style_instance *> instances;
	style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
				office_annotation_attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic, false/*Context.process_headers_footers_*/);
	if (styleInst)
	{
		style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
		if (defaultStyle)instances.push_back(defaultStyle);

		instances.push_back(styleInst);
	}
	graphic_format_properties graphicProperties = calc_graphic_properties_content(instances);	

	graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());

	const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");

	int col = Context.current_table_column();	if (col < 0) col = 0;
	int row = Context.current_table_row();		if (row < 0) row = 0;

	std::wstring  ref = oox::getCellAddress(col, row); 

	Context.get_comments_context().end_comment(ref, col, row);
}