diff --git a/OdfFile/Reader/Converter/docx_conversion_context.cpp b/OdfFile/Reader/Converter/docx_conversion_context.cpp index 31b427811f..87e1f39c96 100644 --- a/OdfFile/Reader/Converter/docx_conversion_context.cpp +++ b/OdfFile/Reader/Converter/docx_conversion_context.cpp @@ -1737,7 +1737,7 @@ bool docx_conversion_context::in_automatic_style() return in_automatic_style_; } -void docx_conversion_context::push_text_properties(const odf_reader::style_text_properties * TextProperties) +void docx_conversion_context::push_text_properties(const odf_reader::style_text_properties* TextProperties) { state_.text_properties_stack_.push_back(TextProperties); } @@ -1746,7 +1746,21 @@ void docx_conversion_context::pop_text_properties() { state_.text_properties_stack_.pop_back(); } +odf_reader::style_paragraph_properties_ptr docx_conversion_context::current_paragraph_properties() +{ + odf_reader::style_paragraph_properties_ptr cur; + if (paragraph_style_stack_.empty()) return cur; + if (odf_reader::style_instance* styleInst = + root()->odf_context().styleContainer().style_by_name(paragraph_style_stack_.back(), odf_types::style_family::Paragraph, process_headers_footers_)) + { + odf_reader::paragraph_format_properties properties = odf_reader::calc_paragraph_properties_content(styleInst); + + cur = boost::make_shared(); + cur->content_.apply_from(properties); + } + return cur; +} odf_reader::style_text_properties_ptr docx_conversion_context::current_text_properties() { odf_reader::style_text_properties_ptr cur = boost::make_shared(); @@ -1758,12 +1772,10 @@ odf_reader::style_text_properties_ptr docx_conversion_context::current_text_prop } return cur; } - void docx_conversion_context::set_page_break_after(int val) { page_break_after_ = val; } - int docx_conversion_context::get_page_break_after() { return page_break_after_ ; @@ -1780,13 +1792,10 @@ void docx_conversion_context::set_page_break_before(int val) { page_break_before_ = val; } - int docx_conversion_context::get_page_break_before() { return page_break_before_; } - - void docx_conversion_context::add_page_properties(const std::wstring & StyleName) { section_context::_section & s = section_context_.get_last(); @@ -2211,7 +2220,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_ { odf_reader::list_style_container & list_styles = root()->odf_context().listStyleContainer(); - if (list_style_stack_.empty() && list_styles.outline_style() && !get_table_context().in_table()) + if (/*outline_level < 9 && */list_style_stack_.empty() && list_styles.outline_style() && !get_table_context().in_table()) { output_stream() << L""; output_stream() << L""; diff --git a/OdfFile/Reader/Converter/docx_conversion_context.h b/OdfFile/Reader/Converter/docx_conversion_context.h index 22117bfc3d..b89fe6feac 100644 --- a/OdfFile/Reader/Converter/docx_conversion_context.h +++ b/OdfFile/Reader/Converter/docx_conversion_context.h @@ -866,6 +866,7 @@ public: void pop_text_properties (); odf_reader::style_text_properties_ptr current_text_properties(); + odf_reader::style_paragraph_properties_ptr current_paragraph_properties(); void set_page_break_after(int val); int get_page_break_after(); diff --git a/OdfFile/Reader/Converter/oox_conversion_context.h b/OdfFile/Reader/Converter/oox_conversion_context.h index 95fd49a41f..43feb78d14 100644 --- a/OdfFile/Reader/Converter/oox_conversion_context.h +++ b/OdfFile/Reader/Converter/oox_conversion_context.h @@ -51,12 +51,16 @@ namespace oox{ namespace odf_reader { class style_instance; - class style_text_properties; class fonts_container; + class form_element; + + class style_text_properties; typedef boost::shared_ptr style_text_properties_ptr; - + + class style_paragraph_properties; + typedef boost::shared_ptr style_paragraph_properties_ptr; + class office_element; - class form_element; typedef boost::shared_ptr office_element_ptr; }; diff --git a/OdfFile/Reader/Format/chart_build_oox.cpp b/OdfFile/Reader/Format/chart_build_oox.cpp index 82eaa078a4..e3dd9abb48 100644 --- a/OdfFile/Reader/Format/chart_build_oox.cpp +++ b/OdfFile/Reader/Format/chart_build_oox.cpp @@ -260,6 +260,30 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context) else if (object_type_ == 3 && office_math_) { bool in_draw_frame = Context.get_drawing_state_content(); + + Context.get_math_context().base_font_size_ = baseFontHeight_; + Context.get_math_context().base_font_name_ = baseFontName_; + Context.get_math_context().base_font_italic_ = baseFontItalic_; + Context.get_math_context().base_font_bold_ = baseFontBold_; + Context.get_math_context().base_alignment_ = in_draw_frame ? 0 : baseAlignment_; + + if (!in_draw_frame && Context.get_paragraph_state()) + { + style_paragraph_properties_ptr props = Context.current_paragraph_properties(); + if (props && props->content_.fo_text_align_) + { + switch (props->content_.fo_text_align_->get_type()) + { + case text_align::Left: Context.get_math_context().base_alignment_ = 0; break; + case text_align::Right: Context.get_math_context().base_alignment_ = 2; break; + case text_align::Center: Context.get_math_context().base_alignment_ = 1; break; + case text_align::Justify: Context.get_math_context().base_alignment_ = 0; break; + case text_align::Start: Context.get_math_context().base_alignment_ = Context.get_rtl() ? 2 : 0; break; + case text_align::End: Context.get_math_context().base_alignment_ = Context.get_rtl() ? 0 : 2; break; + } + } + } + oox::StreamsManPtr prev = Context.get_stream_man(); std::wstringstream temp_stream(Context.get_drawing_context().get_text_stream_frame()); @@ -267,12 +291,6 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context) Context.reset_context_state(); - Context.get_math_context().base_font_size_ = baseFontHeight_; - Context.get_math_context().base_font_name_ = baseFontName_; - Context.get_math_context().base_alignment_ = in_draw_frame ? 0 : baseAlignment_; - Context.get_math_context().base_font_italic_ = baseFontItalic_; - Context.get_math_context().base_font_bold_ = baseFontBold_; - Context.start_math_formula(); office_math_->oox_convert(Context.get_math_context(), 2); Context.end_math_formula(); diff --git a/OdfFile/Reader/Format/style_text_properties.h b/OdfFile/Reader/Format/style_text_properties.h index 59e1b2ef7d..c04ae395df 100644 --- a/OdfFile/Reader/Format/style_text_properties.h +++ b/OdfFile/Reader/Format/style_text_properties.h @@ -175,7 +175,6 @@ typedef boost::shared_ptr text_format_properties_ptr; class style_text_properties; typedef shared_ptr::Type style_text_properties_ptr; - // style:text-properties class style_text_properties : public office_element_impl { diff --git a/OdfFile/Reader/Format/styles.cpp b/OdfFile/Reader/Format/styles.cpp index f5d8242ed4..7eb213e61e 100644 --- a/OdfFile/Reader/Format/styles.cpp +++ b/OdfFile/Reader/Format/styles.cpp @@ -639,7 +639,7 @@ void style::add_attributes( const xml::attributes_wc_ptr & Attributes ) { if (sTest->empty()) { - style_default_outline_level_ = 9; + //style_default_outline_level_ = 9; } else style_default_outline_level_= XmlUtils::GetInteger(*sTest);