Commit 1e04770e authored by Alexey.Musinov's avatar Alexey.Musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop

* 'develop' of https://github.com/ONLYOFFICE/core:
  .
  DocFormatReader - fix users file
  Revert "DocFormatReader - users file fix"
  DocFormatReader - users file fix OdfFormatReader - fix alphabetic text index
  DocFormatReaer - users file fix OdfFormatReader - fix alphabetic text index
  Removed version number
parents 6666ba02 6d75b03c
......@@ -87,19 +87,19 @@ namespace DocFileFormat
case sprmOldTDefTable:
case sprmTDefTable:
{ //table definition
{
//table definition
SprmTDefTable tDef( iter->Arguments, iter->argumentsSize );
//Workaround for retrieving the indent of the table:
//In some files there is a indent but no sprmTWidthIndent is set.
//For this cases we can calculate the indent of the table by getting the
//first boundary of the TDef and adding the padding of the cells
tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
//add the gabHalf
tblIndent += gabHalf;
//If there follows a real sprmTWidthIndent, this value will be overwritten
tblIndent = (std::max)((int)tblIndent,0);
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
}
break;
......
......@@ -845,6 +845,7 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
CP_XML_WRITER(strm)
{
//Tutor_Charlotte_Tutor_the_Entire_World_.odt
if (get_section_context().dump_.empty() == false && (!ParentId.empty() || get_section_context().get().is_dump_ || in_header_)
&& !get_table_context().in_table() && !in_drawing)
{//две подряд секции или если стиль определен и в заголовки нельзя пихать !!!
......
......@@ -865,13 +865,17 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
if (attlists_.rel_size_.style_rel_width_)
{
int type = attlists_.rel_size_.style_rel_width_->get_type();
drawing.pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
int type = attlists_.rel_size_.style_rel_width_->get_type();
if (type == odf_types::percent_or_scale::Percent)
drawing.pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
}
if (attlists_.rel_size_.style_rel_height_ )
{
int type = attlists_.rel_size_.style_rel_height_->get_type();
drawing.pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
int type = attlists_.rel_size_.style_rel_height_->get_type();
if (type == odf_types::percent_or_scale::Percent)
drawing.pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
}
}
......
......@@ -115,13 +115,13 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (style_rel_width_)
{
int w_w = (int)(0.5 + 50.0 * style_rel_width_->get_value());
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\"/>";
}
else if (style_width_)
{
int w_w = (int)(0.5 + 20.0 * style_width_->get_value_unit(length::pt));
if (w_w > 31680)w_w = 31680;
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\"/>";
}
else
{
......@@ -137,7 +137,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (table_align_)
{
std::wstring w_val = L"left";
if (table_align_->get_type() == table_align::Margins)
if (table_align_->get_type() == table_align::Margins || table_align_->get_type() == table_align::Left)
{
if (common_horizontal_margin_attlist_.fo_margin_left_ && common_horizontal_margin_attlist_.fo_margin_right_)
{
......@@ -147,19 +147,15 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (w_val != L"center" && common_horizontal_margin_attlist_.fo_margin_left_ )
{
odf_types::length indent = common_horizontal_margin_attlist_.fo_margin_left_->get_length();
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20<< "\" w:type=\"dxa\" />";
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\" />";
}
}
else
else //if (table_align_->get_type() == table_align::Center)
w_val = boost::lexical_cast<std::wstring>(*table_align_);
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
}
if (table_align_ && table_align_->get_type() == table_align::Center)
{
// TODO ()
}
_tblPr << "<w:tblLayout w:type=\"fixed\" />";
if (common_background_color_attlist_.fo_background_color_)
......
......@@ -187,7 +187,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
Context.end_automatic_style();
Context.push_text_properties(styleContent->get_style_text_properties());
return 1;
return 1;
}
}
else
......@@ -975,9 +975,39 @@ void text_table_index::add_child_element( xml::sax * Reader, const std::wstring
const wchar_t * text_illustration_index::ns = L"text";
const wchar_t * text_illustration_index::name = L"illustration-index";
void text_illustration_index::afterCreate()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
{
lastPar->set_next_section(true);
}
}
}
void text_illustration_index::afterReadContent()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
{
lastPar->set_next_end_section(true);
}
}
}
void text_illustration_index::docx_convert(oox::docx_conversion_context & Context)
{
if (text_index_body_)
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);
}
......@@ -1005,8 +1035,77 @@ void text_illustration_index::add_child_element( xml::sax * Reader, const std::w
{
CP_CREATE_ELEMENT(text_index_body_);
}
// TODO text-illustration-index-source
// todooo text-illustration-index-source
}
// text:alphabetical-index
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_alphabetical_index::ns = L"text";
const wchar_t * text_alphabetical_index::name = L"alphabetical-index";
void text_alphabetical_index::afterCreate()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
{
lastPar->set_next_section(true);
}
}
}
void text_alphabetical_index::afterReadContent()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
{
lastPar->set_next_end_section(true);
}
}
}
void text_alphabetical_index::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);
}
void text_alphabetical_index::pptx_convert(oox::pptx_conversion_context & Context)
{
if (text_index_body_)
text_index_body_->pptx_convert(Context);
}
std::wostream & text_alphabetical_index::text_to_stream(std::wostream & _Wostream) const
{
CP_SERIALIZE_TEXT(text_index_body_);
return _Wostream;
}
void text_alphabetical_index::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_section_attr_.add_attributes( Attributes );
}
void text_alphabetical_index::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"index-body")
{
CP_CREATE_ELEMENT(text_index_body_);
}
// todooo text-alphabetical-index-source
}
//--------------------------------------------------------------------------------------------------------
// text:tracked-changes
const wchar_t * text_tracked_changes::ns = L"text";
......
......@@ -360,6 +360,9 @@ public:
static const ElementType type = typeTextIllustrationIndex;
CPDOCCORE_DEFINE_VISITABLE();
virtual void afterCreate();
virtual void afterReadContent();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
......@@ -377,6 +380,36 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(text_illustration_index);
//---------------------------------------------------------------------------------------------------
class text_alphabetical_index : public text_content_impl<text_alphabetical_index>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextAlphabeticalIndex;
CPDOCCORE_DEFINE_VISITABLE();
virtual void afterCreate();
virtual void afterReadContent();
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
text_section_attr text_section_attr_;
office_element_ptr text_alphabetical_index_source_;
office_element_ptr text_index_body_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_alphabetical_index);
//---------------------------------------------------------------------------------------------------
class text_index_body : public text_content_impl<text_index_body>
......
[![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.ru.html) ![Release](https://img.shields.io/badge/Release-v4.1.2-blue.svg?style=flat) ![x2tconverter](https://img.shields.io/badge/x2tconverter-v2.0.2.376-blue.svg?style=flat) ![Platforms Windows | OS X | Linux](https://img.shields.io/badge/Platforms-Windows%20%7C%20OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat)
[![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.ru.html) ![x2tconverter](https://img.shields.io/badge/x2tconverter-v2.0.2.376-blue.svg?style=flat) ![Platforms Windows | OS X | Linux](https://img.shields.io/badge/Platforms-Windows%20%7C%20OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat)
## Core
Server core components which are a part of [ONLYOFFICE Document Server][2]. Enable the conversion between the most popular office document formats: DOC, DOCX, ODT, RTF, TXT, PDF, HTML, EPUB, XPS, DjVu, XLS, XLSX, ODS, CSV, PPT, PPTX, ODP.
......
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