void draw_a::docx_convert(oox::docx_conversion_context & Context) { std::wstring rId = Context.add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""), true);//гиперлинк с объекта, а не с текста .. for (size_t i = 0; i < content_.size(); i++) { content_[i]->docx_convert(Context); } }
void office_annotation::docx_convert(oox::docx_conversion_context & Context) { 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.start_comment(); oox::StreamsManPtr prev = Context.get_stream_man(); std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame()); Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) )); bool runState = Context.get_run_state(); Context.set_run_state(false); bool pState = Context.get_paragraph_state(); Context.set_paragraph_state(false); for (size_t i = 0; i < content_.size(); i++) { content_[i]->docx_convert(Context); } Context.set_run_state(runState); Context.set_paragraph_state(pState); Context.get_comments_context().start_comment(temp_stream.str(), author,date);//content, date, author Context.dump_hyperlinks(Context.get_comments_context().get_rels(), oox::hyperlinks::comment_place); Context.set_stream_man(prev); Context.end_comment(); }
void chart_build::docx_convert(oox::docx_conversion_context & Context) { if (object_type_ == 1) { Context.start_chart(L""); oox::oox_chart_context & chart_context = Context.current_chart(); oox_convert(chart_context); chart_context.set_cache_only(true); Context.end_chart(); } else if (object_type_ == 2 && office_text_) { office_text_->docx_convert(Context); } else if (object_type_ == 3 && office_math_) { oox::docx_conversion_context::StreamsManPtr prev = Context.get_stream_man(); std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame()); Context.set_stream_man( boost::shared_ptr<oox::streams_man>( new oox::streams_man(temp_stream) )); bool runState = Context.get_run_state(); Context.set_run_state(false); bool pState = Context.get_paragraph_state(); Context.set_paragraph_state(false); style_text_properties textProperty; textProperty.content().style_font_name_ = L"Cambria Math"; textProperty.content().fo_font_size_ = odf_types::length(baseFontHeight_, odf_types::length::pt); Context.push_text_properties(&textProperty); office_math_->docx_convert(Context); Context.pop_text_properties(); Context.get_drawing_context().get_text_stream_frame() = temp_stream.str(); Context.set_stream_man (prev); Context.set_run_state (runState); Context.set_paragraph_state (pState); } }