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

(1.0.0.151): ASCOfficeOdfFile

поправлены стили текста и параграфов в презентациях

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53162 954022d7-b5bf-4e40-9824-e11837661b57
parent b942e79d
......@@ -182,7 +182,7 @@ void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf::_property
{
_CP_OPT(int) iAlign;
odf::GetProperty(prop,L"textalign-vertiacal",iAlign);
odf::GetProperty(prop,L"textalign-vertical",iAlign);
if (iAlign)
{
switch (iAlign.get())
......@@ -200,7 +200,7 @@ void oox_serialize_bodyPr(std::wostream & strm, const std::vector<odf::_property
CP_XML_ATTR(L"anchor", L"just");break;
}
}
else CP_XML_ATTR(L"anchor", L"dist");break;
//else CP_XML_ATTR(L"anchor", L"dist");break;
}
}
......
......@@ -8,6 +8,7 @@
#include <cpdoccore/xml/attributes.h>
#include "oox_conversion_context.h"
#include "../odf/stylefamily.h"
namespace cpdoccore {
namespace odf
......@@ -40,8 +41,11 @@ public:
void start_comment_content();
std::wstring end_comment_content();
void start_drawing_content();
std::wstring end_drawing_content();
void start_base_style(const std::wstring baseStyleName, const odf::style_family::type baseStyleType);
void end_base_style();
void start_object();
std::wstring end_object();
void start_hyperlink();
void end_hyperlink(std::wstring hId);
......
......@@ -74,8 +74,8 @@ private:
std::wstringstream output_;
xlsx_shared_strings xlsx_shared_strings_;
std::wstring styles_paragraph_;// ... , ,, -
std::wstring styles_span_;
std::wstring paragraph_style_name_;// ... , ,, -
std::wstring span_style_name_;
};
......@@ -107,7 +107,7 @@ void xlsx_text_context::Impl::start_paragraph(const std::wstring & styleName)
{
if (paragraphs_cout_++ > 0)
{
if (styles_paragraph_ != styleName)
if (paragraph_style_name_ != styleName)
{
dump_text();
}
......@@ -118,7 +118,7 @@ void xlsx_text_context::Impl::start_paragraph(const std::wstring & styleName)
{
text_.str(std::wstring());
}
styles_paragraph_ = styleName;
paragraph_style_name_ = styleName;
in_paragraph = true;
}
......@@ -127,7 +127,7 @@ void xlsx_text_context::Impl::end_paragraph()
if (!in_comment && !in_draw)
{
dump_text();
styles_paragraph_ = L"";
paragraph_style_name_ = L"";
}
in_paragraph = false;
}
......@@ -140,12 +140,12 @@ void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//
}
else
{
if (styles_span_ !=styleName || in_span)
if (span_style_name_ !=styleName || in_span)
{
dump_text();
}
}
styles_span_ = styleName;
span_style_name_ = styleName;
in_span=true;
}
......@@ -155,7 +155,7 @@ void xlsx_text_context::Impl::end_span() //odf
if (!in_comment && !in_draw)
{
dump_text();
styles_span_=L"";
span_style_name_=L"";
}
in_span=false;
}
......@@ -163,7 +163,7 @@ void xlsx_text_context::Impl::end_span() //odf
std::wstring xlsx_text_context::Impl::end_span2()
{
const std::wstring content = dump_text();
styles_span_ = L"";
span_style_name_ = L"";
in_span = false;
return content;
......@@ -203,13 +203,13 @@ void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style,odf::text_f
void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
{
if (styles_paragraph_.length()<1 && styles_span_.length()<1 && !(hyperlink_hId.length()>0 && in_draw) )return;
if (paragraph_style_name_.length()<1 && span_style_name_.length()<1 && !(hyperlink_hId.length()>0 && in_draw) )return;
odf::text_format_properties_content text_properties_paragraph_;
ApplyTextProperties (styles_paragraph_, text_properties_paragraph_,odf::style_family::Paragraph);
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_,odf::style_family::Paragraph);
odf::text_format_properties_content text_properties_span_;
ApplyTextProperties(styles_span_, text_properties_span_,odf::style_family::Text);
ApplyTextProperties(span_style_name_, text_properties_span_,odf::style_family::Text);
odf::text_format_properties_content text_properties_;
......@@ -319,8 +319,8 @@ void xlsx_text_context::Impl::start_cell_content()
text_.str(std::wstring()); //
styles_paragraph_ = L"";
styles_span_ = L"";
paragraph_style_name_ = L"";
span_style_name_ = L"";
in_cell_content = true;
}
......@@ -332,8 +332,8 @@ void xlsx_text_context::Impl::start_comment_content()
output_.str(std::wstring());
text_.str(std::wstring());
styles_paragraph_ = L"";
styles_span_ = L"";
paragraph_style_name_ = L"";
span_style_name_ = L"";
in_comment = true;
}
......@@ -344,8 +344,8 @@ void xlsx_text_context::Impl::start_drawing_content()
output_.str(std::wstring());
text_.str(std::wstring());
styles_paragraph_ = L"";
styles_span_ = L"";
paragraph_style_name_ = L"";
span_style_name_ = L"";
in_draw = true;
}
......@@ -360,8 +360,8 @@ std::wstring xlsx_text_context::Impl::end_comment_content()
output_.str(std::wstring());
text_.str(std::wstring());
styles_paragraph_ = L"";
styles_span_=L"";
paragraph_style_name_ = L"";
span_style_name_=L"";
in_comment = false;
return comment;
......@@ -377,8 +377,8 @@ std::wstring xlsx_text_context::Impl::end_drawing_content()
output_.str(std::wstring());
text_.str(std::wstring());
styles_paragraph_ = L"";
styles_span_=L"";
paragraph_style_name_ = L"";
span_style_name_=L"";
in_draw = false;
return draw;
......
......@@ -143,6 +143,8 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
}
if (office_event_listeners_)office_event_listeners_->pptx_convert(Context);
Context.get_text_context().start_base_style(baseStyleName ,odf::style_family::Presentation);
////////////////////////////////////////////////
int i=0;
int size = content_.size();
......@@ -153,6 +155,8 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
elm->pptx_convert(Context);
i++;
}
Context.get_text_context().end_base_style();
//Context.get_slide_context().end_drawing();
}
......@@ -162,7 +166,7 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().start_image(href);
//////////////////////////////////// ...
Context.get_text_context().start_drawing_content();//... -
Context.get_text_context().start_object();
int i=0;
int size = content_.size();
......@@ -172,7 +176,7 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
content_[i]->pptx_convert(Context);
i++;
}
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
std::wstring text_content_ = Context.get_text_context().end_object();
if (text_content_.length()>0)
{
......@@ -203,7 +207,7 @@ void draw_chart::pptx_convert(oox::pptx_conversion_context & Context)
void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().start_shape(2);//rect
Context.get_text_context().start_drawing_content();
Context.get_text_context().start_object();
int i=0;
int size = content_.size();
......@@ -213,7 +217,7 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
content_[i]->pptx_convert(Context);
i++;
}
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
std::wstring text_content_ = Context.get_text_context().end_object();
if (text_content_.length()>0)
{
......@@ -265,14 +269,14 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
if (chartBuild.object_type_ == 2)//
{
Context.get_slide_context().start_shape(2);
Context.get_text_context().start_drawing_content();
Context.get_text_context().start_object();
// ... !!
Context.get_text_context().set_local_styles_container(&objectSubDoc.odf_context().styleContainer());
chartBuild.office_text_->pptx_convert(Context);
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
std::wstring text_content_ = Context.get_text_context().end_object();
Context.get_text_context().set_local_styles_container(NULL);// ...
if (text_content_.length()>0)
......
......@@ -470,31 +470,30 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
CP_XML_ATTR(L"lang", w_val);
}
if (style_font_name_ || style_font_name_asian_ || style_font_name_complex_)
if (fo_color_)
{
CP_XML_NODE(L"a:solidFill")
{
CP_XML_NODE(L"a:srgbClr"){CP_XML_ATTR(L"val",fo_color_->get_hex_value());}
}
}
if (style_font_name_ || style_font_name_asian_ || style_font_name_complex_ || fo_font_family_)
{
std::wstring w_eastAsia;
std::wstring w_hAnsi;
std::wstring w_cs;
std::wstring w_ascii = w_hAnsi = (style_font_name_ ? *style_font_name_: L"");
std::wstring w_font = (fo_font_family_ ? *fo_font_family_: L"");
std::wstring w_ascii = (style_font_name_ ? *style_font_name_: w_font);
if (w_ascii.length()>0) CP_XML_NODE(L"a:latin"){CP_XML_ATTR(L"typeface",w_ascii);}
if (style_font_name_asian_)
w_eastAsia = *style_font_name_asian_;
{
std::wstring w_eastAsia = *style_font_name_asian_;
CP_XML_NODE(L"a:ea"){CP_XML_ATTR(L"typeface",w_eastAsia);}
}
if (style_font_name_complex_)
w_cs = *style_font_name_complex_;
fonts_container & fonts = Context.root()->odf_context().fontContainer();
font_instance * font = fonts.font_by_style_name(w_ascii);
if (font == NULL)font = fonts.font_by_style_name(w_hAnsi);
if (font)CP_XML_NODE(L"a:latin"){CP_XML_ATTR(L"typeface",font->name());}
font = fonts.font_by_style_name(w_eastAsia);
if (font) CP_XML_NODE(L"a:ea"){CP_XML_ATTR(L"typeface",font->name());}
font = fonts.font_by_style_name(w_cs);
if (font) CP_XML_NODE(L"a:cs"){CP_XML_ATTR(L"typeface",font->name());}
{
std::wstring w_cs = *style_font_name_complex_;
CP_XML_NODE(L"a:cs"){CP_XML_ATTR(L"typeface",w_cs);}
}
}
//else if (style_use_window_font_color_ && *style_use_window_font_color_)
......@@ -513,13 +512,7 @@ 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 (fo_color_)
{
CP_XML_NODE(L"a:solidFill")
{
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")
......
#ifndef _CPDOCCORE_ODF_STYLEFAMILY_H_
#define _CPDOCCORE_ODF_STYLEFAMILY_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
......@@ -58,5 +53,3 @@ std::wostream & operator << (std::wostream & _Wostream, const style_family & _Va
APPLY_PARSE_XML_ATTRIBUTES(odf::style_family);
}
#endif
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