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

OdfFile

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63363 954022d7-b5bf-4e40-9824-e11837661b57
parent 3a2c6d75
......@@ -207,8 +207,22 @@ void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf_reader::_p
{
CP_XML_NODE(L"a:bodyPr")
{
_CP_OPT(int) iAlign;
_CP_OPT(double)dPaddingLeft, dPaddingRight, dPaddingTop, dPaddingBottom;
odf_reader::GetProperty(prop,L"text-padding-left" , dPaddingLeft);
odf_reader::GetProperty(prop,L"text-padding-right" , dPaddingRight);
odf_reader::GetProperty(prop,L"text-padding-top" , dPaddingTop);
odf_reader::GetProperty(prop,L"text-padding-bottom" , dPaddingBottom);
if (dPaddingLeft) CP_XML_ATTR(L"lIns", (int)(*dPaddingLeft));
if (dPaddingRight) CP_XML_ATTR(L"rIns", (int)(*dPaddingRight));
if (dPaddingTop) CP_XML_ATTR(L"tIns", (int)(*dPaddingTop));
if (dPaddingBottom) CP_XML_ATTR(L"bIns", (int)(*dPaddingBottom));
_CP_OPT(int) iWrap;
odf_reader::GetProperty(prop,L"text-wrap" , iWrap);
if ((iWrap) && (*iWrap == 0))CP_XML_ATTR(L"wrap", L"none");
_CP_OPT(int) iAlign;
odf_reader::GetProperty(prop,L"textarea-vertical_align",iAlign);
if (iAlign)
{
......
......@@ -39,6 +39,7 @@ pptx_conversion_context::pptx_conversion_context(cpdoccore::oox::package::pptx_d
,pptx_comments_context_(comments_context_handle_)
,pptx_slide_context_(*this/*, pptx_text_context_*/)
,last_idx_placeHolder(1)
,last_uniq_big_id(1)
{
applicationFonts_ = new CApplicationFonts();
}
......@@ -183,7 +184,7 @@ void pptx_conversion_context::start_document()
void pptx_conversion_context::end_document()
{
unsigned int count = 0;
unsigned int count = 1;
BOOST_FOREACH(const pptx_xml_slideMaster_ptr& slideM, slideMasters_)
{
......@@ -198,7 +199,7 @@ void pptx_conversion_context::end_document()
{
CP_XML_NODE(L"p:sldMasterId")
{
CP_XML_ATTR(L"id", 0x80000000 + count);
CP_XML_ATTR(L"id", 0x80000000 + last_uniq_big_id++);
CP_XML_ATTR(L"r:id", slideM->rId());
}
}
......@@ -470,7 +471,7 @@ bool pptx_conversion_context::start_master(int master_index)
for (long i=0;i<masters.content[master_index].layouts.size();i++)
{
current_master().add_layout(masters.content[master_index].layouts[i].Id, masters.content[master_index].layouts[i].rId);
current_master().add_layout(masters.content[master_index].layouts[i].Id, masters.content[master_index].layouts[i].rId, 0x80000000 + last_uniq_big_id++);
}
......
......@@ -102,6 +102,7 @@ public:
int last_idx_placeHolder;
private:
int last_uniq_big_id;
void create_new_slide(std::wstring const & name);
void create_new_slideLayout(int id);
......
......@@ -194,9 +194,9 @@ void pptx_xml_slideMaster::add_theme(int id, const std::wstring & tId)
std::wstring(L"../theme/theme") + boost::lexical_cast<std::wstring>(id) + L".xml"));
}
void pptx_xml_slideMaster::add_layout(int id, const std::wstring & rId)
void pptx_xml_slideMaster::add_layout(int id, const std::wstring & rId, const unsigned int & uniqId)
{
layoutsId_.push_back(rId);
layoutsId_.push_back(std::pair<std::wstring, unsigned int>(rId, uniqId));
rels_.add(relationship( rId,L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout",
std::wstring(L"../slideLayouts/slideLayout") + boost::lexical_cast<std::wstring>(id) + L".xml"));
......@@ -236,18 +236,16 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
CP_XML_ATTR(L"bg2",L"lt2");
CP_XML_ATTR(L"bg1",L"lt1");
}
long count=0;
CP_XML_NODE(L"p:sldLayoutIdLst")
{
BOOST_FOREACH(const std::wstring & q, layoutsId_)
for (int i = 0; i < layoutsId_.size(); i++)
{
CP_XML_NODE(L"p:sldLayoutId")
{
CP_XML_ATTR(L"r:id",q);
CP_XML_ATTR(L"id",0x80000000 + (++count) + (id_-1)*20); // ..
CP_XML_ATTR(L"r:id", layoutsId_[i].first);
CP_XML_ATTR(L"id", layoutsId_[i].second);
}
}
count++;
}
CP_XML_STREAM() << slideMasterDataExtra_.str();
CP_XML_NODE(L"p:txStyles")
......
......@@ -112,7 +112,7 @@ public:
std::wostream & Background();
rels & Rels();
void add_layout(int id, const std::wstring & rId);
void add_layout(int id, const std::wstring & rId, const unsigned int & uniqId);
void add_theme(int id, const std::wstring & tId);
void write_to(std::wostream & strm);
......@@ -124,7 +124,7 @@ private:
std::wstringstream slideMasterDataExtra_;
std::wstringstream slideMasterBackground_;
std::vector<std::wstring> layoutsId_;
std::vector<std::pair<std::wstring, unsigned int>> layoutsId_;
std::wstring rId_;
int id_;
......
......@@ -153,6 +153,14 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_placeHolder_idx(idx_in_owner);
}
if (!textStyleName.empty())
{
odf_reader::style_instance* textStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(textStyleName, odf_types::style_family::Paragraph, Context.process_masters_);
paragraph_format_properties paragraph_properties = calc_paragraph_properties_content(textStyleInst);
}
if (office_event_listeners_)office_event_listeners_->pptx_convert(Context);
Context.get_text_context().start_base_style(baseStyleName ,odf_types::style_family::Presentation);
......
......@@ -111,6 +111,13 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().set_property(p);
}
if (!textStyleName.empty())
{
odf_reader::style_instance* textStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(textStyleName, odf_types::style_family::Paragraph, Context.process_masters_);
paragraph_format_properties paragraph_properties = calc_paragraph_properties_content(textStyleInst);
}
///////////////////////////////////////////////////////////////////////////////////////
oox::_oox_fill fill;
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
......
......@@ -39,6 +39,7 @@ void graphic_format_properties::add_attributes( const xml::attributes_wc_ptr & A
CP_APPLY_ATTR(L"fo:max-width", fo_max_width_);
CP_APPLY_ATTR(L"fo:max-height", fo_max_height_);
CP_APPLY_ATTR(L"fo:clip", fo_clip_);
CP_APPLY_ATTR(L"fo:wrap-option", fo_wrap_option_);
CP_APPLY_ATTR(L"style:print-content", style_print_content_);
CP_APPLY_ATTR(L"style:protect", style_protect_);
......@@ -89,6 +90,25 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties)
if (draw_auto_grow_width_) properties.push_back(_property(L"auto-grow-width", *draw_auto_grow_width_));
if (draw_fit_to_size_) properties.push_back(_property(L"fit-to-size", *draw_fit_to_size_));
if (draw_fit_to_contour_) properties.push_back(_property(L"fit-to-contour", *draw_fit_to_contour_));
if (common_padding_attlist_.fo_padding_)
{
properties.push_back(_property(L"text-padding-left", common_padding_attlist_.fo_padding_->get_value_unit(length::emu)));
properties.push_back(_property(L"text-padding-right", common_padding_attlist_.fo_padding_->get_value_unit(length::emu)));
properties.push_back(_property(L"text-padding-top", common_padding_attlist_.fo_padding_->get_value_unit(length::emu)));
properties.push_back(_property(L"text-padding-bottom", common_padding_attlist_.fo_padding_->get_value_unit(length::emu)));
}else
{
if (common_padding_attlist_.fo_padding_left_)
properties.push_back(_property(L"text-padding-left", common_padding_attlist_.fo_padding_left_->get_value_unit(length::emu)));
if (common_padding_attlist_.fo_padding_right_)
properties.push_back(_property(L"text-padding-right", common_padding_attlist_.fo_padding_right_->get_value_unit(length::emu)));
if (common_padding_attlist_.fo_padding_top_)
properties.push_back(_property(L"text-padding-top", common_padding_attlist_.fo_padding_top_->get_value_unit(length::emu)));
if (common_padding_attlist_.fo_padding_bottom_)
properties.push_back(_property(L"text-padding-bottom", common_padding_attlist_.fo_padding_bottom_->get_value_unit(length::emu)));
}
if (fo_wrap_option_) properties.push_back(_property(L"text-wrap", (int)fo_wrap_option_->get_type()));
}
void graphic_format_properties::apply_from(const graphic_format_properties & Other)
{
......@@ -111,6 +131,7 @@ void graphic_format_properties::apply_from(const graphic_format_properties & Oth
_CP_APPLY_PROP2(fo_min_height_);
_CP_APPLY_PROP2(fo_max_width_);
_CP_APPLY_PROP2(fo_max_height_);
_CP_APPLY_PROP2(fo_wrap_option_);
_CP_APPLY_PROP2(style_print_content_);
_CP_APPLY_PROP2(style_protect_);
......
......@@ -26,6 +26,7 @@
#include "datatypes/markerstyle.h"
#include "datatypes/verticalalign.h"
#include "datatypes/gradientstyle.h"
#include "datatypes/wrapoption.h"
namespace cpdoccore {
......@@ -99,6 +100,7 @@ public:
_CP_OPT(std::wstring) style_mirror_;
_CP_OPT(std::wstring) fo_clip_;
_CP_OPT(odf_types::wrap_option) fo_wrap_option_;
office_element_ptr style_background_image_;
......
......@@ -284,56 +284,22 @@ public:
_CP_OPT( odf_types::border_widths ) style_border_line_width_left_; // +
_CP_OPT( odf_types::border_widths ) style_border_line_width_right_; // +
// 15.5.27
// fo:padding
_CP_OPT(odf_types::length) fo_padding_; // +
// fo:padding-top
_CP_OPT(odf_types::length) fo_padding_top_; // +
// fo:padding-bottom
_CP_OPT(odf_types::length) fo_padding_bottom_; // +
// fo:padding-left
_CP_OPT(odf_types::length) fo_padding_left_; // +
// fo:padding-right
_CP_OPT(odf_types::length) fo_padding_right_; // +
// 15.5.28 style:shadow
_CP_OPT(odf_types::shadow_type) style_shadow_;
// 15.5.29 fo:keep-with-next
_CP_OPT(odf_types::keep_together) fo_keep_with_next_; // +
// 15.5.30 text:number-lines
_CP_OPT(odf_types::keep_together) fo_keep_with_next_;
_CP_OPT(bool) text_number_lines_;
// 15.5.31 text:line-number
_CP_OPT(unsigned int) text_line_number_;
// 15.5.32 style:text-autospace
_CP_OPT(odf_types::text_autospace) style_text_autospace_;
// 15.5.33 style:punctuation-wrap
_CP_OPT(odf_types::punctuation_wrap) style_punctuation_wrap_;
// 15.5.34 style:line-break
_CP_OPT(odf_types::line_break) style_line_break_;
// 15.5.35 style:vertical-align
_CP_OPT(odf_types::vertical_align) style_vertical_align_; // +
// 15.5.36 style:writing-mode
_CP_OPT(odf_types::vertical_align) style_vertical_align_;
_CP_OPT(odf_types::writing_mode) style_writing_mode_;
// 15.5.37 style:writing-mode-automatic
_CP_OPT(bool) style_writing_mode_automatic_;
// 15.5.38 style:snap-to-layout-grid
_CP_OPT(bool) style_snap_to_layout_grid_;
// 15.5.39 style:page-number
_CP_OPT(unsigned int) style_page_number_;
// 15.5.40 style:background-transparency
......
......@@ -359,6 +359,7 @@ void text_format_properties_content::pptx_convert_as_list(oox::pptx_conversion_c
{
CP_XML_NODE(L"a:buFont")
{
removeCharsFromString(w_font, _T("'"));
CP_XML_ATTR(L"typeface", w_font);
if ((style_font_charset_))
{
......
......@@ -148,54 +148,54 @@ void paragraph_format_properties::serialize(std::wostream & _Wostream ,const wch
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"fo:line-height", fo_line_height_);
CP_XML_ATTR_OPT(L"style:line-height-at-least", style_line_height_at_least_);
CP_XML_ATTR_OPT(L"style:line-spacing", style_line_spacing_);
CP_XML_ATTR_OPT(L"fo:line-height" , fo_line_height_);
CP_XML_ATTR_OPT(L"style:line-height-at-least" , style_line_height_at_least_);
CP_XML_ATTR_OPT(L"style:line-spacing" , style_line_spacing_);
CP_XML_ATTR_OPT(L"style:font-independent-line-spacing", style_font_independent_line_spacing_);
CP_XML_ATTR_OPT(L"fo:text-align", fo_text_align_);
CP_XML_ATTR_OPT(L"fo:text-align-last", fo_text_align_last_);
CP_XML_ATTR_OPT(L"style:justify-single-word", style_justify_single_word_);
CP_XML_ATTR_OPT(L"fo:keep-together", fo_keep_together_);
CP_XML_ATTR_OPT(L"fo:widows", fo_widows_);
CP_XML_ATTR_OPT(L"fo:orphans", fo_orphans_);
CP_XML_ATTR_OPT(L"style:tab-stop-distance", style_tab_stop_distance_);
CP_XML_ATTR_OPT(L"fo:hyphenation-keep", fo_hyphenation_keep_);
CP_XML_ATTR_OPT(L"fo:hyphenation-ladder-count", fo_hyphenation_ladder_count_);
CP_XML_ATTR_OPT(L"style:register-true", style_register_true_);
CP_XML_ATTR_OPT(L"fo:margin-left", fo_margin_left_);
CP_XML_ATTR_OPT(L"fo:margin-right", fo_margin_right_);
CP_XML_ATTR_OPT(L"fo:text-indent", fo_text_indent_);
CP_XML_ATTR_OPT(L"style:auto-text-indent", style_auto_text_indent_);
CP_XML_ATTR_OPT(L"fo:margin-top", fo_margin_top_);
CP_XML_ATTR_OPT(L"fo:margin-bottom", fo_margin_bottom_);
CP_XML_ATTR_OPT(L"fo:margin", fo_margin_);
CP_XML_ATTR_OPT(L"fo:break-before", fo_break_before_);
CP_XML_ATTR_OPT(L"fo:break-after", fo_break_after_);
CP_XML_ATTR_OPT(L"fo:background-color", fo_background_color_);
CP_XML_ATTR_OPT(L"style:border-line-width", style_border_line_width_);
CP_XML_ATTR_OPT(L"style:border-line-width-top", style_border_line_width_top_);
CP_XML_ATTR_OPT(L"style:border-line-width-bottom", style_border_line_width_bottom_);
CP_XML_ATTR_OPT(L"style:border-line-width-left", style_border_line_width_left_);
CP_XML_ATTR_OPT(L"style:border-line-width-right", style_border_line_width_right_);
CP_XML_ATTR_OPT(L"fo:padding", fo_padding_);
CP_XML_ATTR_OPT(L"fo:padding-top", fo_padding_top_);
CP_XML_ATTR_OPT(L"fo:padding-bottom", fo_padding_bottom_);
CP_XML_ATTR_OPT(L"fo:padding-left", fo_padding_left_);
CP_XML_ATTR_OPT(L"fo:padding-right", fo_padding_right_);
CP_XML_ATTR_OPT(L"style:shadow", style_shadow_);
CP_XML_ATTR_OPT(L"fo:keep-with-next", fo_keep_with_next_);
CP_XML_ATTR_OPT(L"text:number-lines", text_number_lines_);
CP_XML_ATTR_OPT(L"text:line-number", text_line_number_);
CP_XML_ATTR_OPT(L"style:text-autospace", style_text_autospace_);
CP_XML_ATTR_OPT(L"style:punctuation-wrap", style_punctuation_wrap_);
CP_XML_ATTR_OPT(L"style:line-break", style_line_break_);
CP_XML_ATTR_OPT(L"style:vertical-align", style_vertical_align_);
CP_XML_ATTR_OPT(L"style:writing-mode", style_writing_mode_);
CP_XML_ATTR_OPT(L"style:writing-mode-automatic", style_writing_mode_automatic_);
CP_XML_ATTR_OPT(L"style:snap-to-layout-grid", style_snap_to_layout_grid_);
CP_XML_ATTR_OPT(L"style:contextual-spacing", style_contextual_spacing_);
CP_XML_ATTR_OPT(L"fo:text-align" , fo_text_align_);
CP_XML_ATTR_OPT(L"fo:text-align-last" , fo_text_align_last_);
CP_XML_ATTR_OPT(L"style:justify-single-word" , style_justify_single_word_);
CP_XML_ATTR_OPT(L"fo:keep-together" , fo_keep_together_);
CP_XML_ATTR_OPT(L"fo:widows" , fo_widows_);
CP_XML_ATTR_OPT(L"fo:orphans" , fo_orphans_);
CP_XML_ATTR_OPT(L"style:tab-stop-distance" , style_tab_stop_distance_);
CP_XML_ATTR_OPT(L"fo:hyphenation-keep" , fo_hyphenation_keep_);
CP_XML_ATTR_OPT(L"fo:hyphenation-ladder-count" , fo_hyphenation_ladder_count_);
CP_XML_ATTR_OPT(L"style:register-true" , style_register_true_);
CP_XML_ATTR_OPT(L"fo:margin-left" , fo_margin_left_);
CP_XML_ATTR_OPT(L"fo:margin-right" , fo_margin_right_);
CP_XML_ATTR_OPT(L"fo:text-indent" , fo_text_indent_);
CP_XML_ATTR_OPT(L"style:auto-text-indent" , style_auto_text_indent_);
CP_XML_ATTR_OPT(L"fo:margin-top" , fo_margin_top_);
CP_XML_ATTR_OPT(L"fo:margin-bottom" , fo_margin_bottom_);
CP_XML_ATTR_OPT(L"fo:margin" , fo_margin_);
CP_XML_ATTR_OPT(L"fo:break-before" , fo_break_before_);
CP_XML_ATTR_OPT(L"fo:break-after" , fo_break_after_);
CP_XML_ATTR_OPT(L"fo:background-color" , fo_background_color_);
CP_XML_ATTR_OPT(L"style:border-line-width" , style_border_line_width_);
CP_XML_ATTR_OPT(L"style:border-line-width-top" , style_border_line_width_top_);
CP_XML_ATTR_OPT(L"style:border-line-width-bottom" , style_border_line_width_bottom_);
CP_XML_ATTR_OPT(L"style:border-line-width-left" , style_border_line_width_left_);
CP_XML_ATTR_OPT(L"style:border-line-width-right" , style_border_line_width_right_);
CP_XML_ATTR_OPT(L"fo:padding" , fo_padding_);
CP_XML_ATTR_OPT(L"fo:padding-top" , fo_padding_top_);
CP_XML_ATTR_OPT(L"fo:padding-bottom" , fo_padding_bottom_);
CP_XML_ATTR_OPT(L"fo:padding-left" , fo_padding_left_);
CP_XML_ATTR_OPT(L"fo:padding-right" , fo_padding_right_);
CP_XML_ATTR_OPT(L"style:shadow" , style_shadow_);
CP_XML_ATTR_OPT(L"fo:keep-with-next" , fo_keep_with_next_);
CP_XML_ATTR_OPT(L"text:number-lines" , text_number_lines_);
CP_XML_ATTR_OPT(L"text:line-number" , text_line_number_);
CP_XML_ATTR_OPT(L"style:text-autospace" , style_text_autospace_);
CP_XML_ATTR_OPT(L"style:punctuation-wrap" , style_punctuation_wrap_);
CP_XML_ATTR_OPT(L"style:line-break" , style_line_break_);
CP_XML_ATTR_OPT(L"style:vertical-align" , style_vertical_align_);
CP_XML_ATTR_OPT(L"style:writing-mode" , style_writing_mode_);
CP_XML_ATTR_OPT(L"style:writing-mode-automatic" , style_writing_mode_automatic_);
CP_XML_ATTR_OPT(L"style:snap-to-layout-grid" , style_snap_to_layout_grid_);
CP_XML_ATTR_OPT(L"style:contextual-spacing" , style_contextual_spacing_);
CP_XML_ATTR_OPT(L"style:background-transparency", style_background_transparency_);
CP_XML_ATTR_OPT(L"style:join_border", style_join_border_);
CP_XML_ATTR_OPT(L"style:join_border" , style_join_border_);
common_border_attlist_.serialize(CP_GET_XML_NODE());
//_CP_OPT(std::wstring) style_page_number_str_;
......
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