mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Merge remote-tracking branch 'origin/hotfix/v8.3.1' into fix/bug71975
This commit is contained in:
@ -916,7 +916,11 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
|
||||
odf_context()->start_text_context();
|
||||
|
||||
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
|
||||
|
||||
convert(oox_shape->oTextBoxBodyPr.GetPointer());
|
||||
|
||||
if (oox_shape->style.IsInit())
|
||||
convert(&oox_shape->style->fontRef);
|
||||
|
||||
for (size_t i = 0; i < oox_shape->oTextBoxShape->m_arrItems.size(); i++)
|
||||
{
|
||||
docx_converter->convert(oox_shape->oTextBoxShape->m_arrItems[i]);
|
||||
|
||||
@ -484,6 +484,8 @@ public:
|
||||
|
||||
bool encrypt_document (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath);
|
||||
bool encrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, std::wstring &encrypt_info, int &size);
|
||||
|
||||
std::vector<double> current_font_size;
|
||||
|
||||
//.......................................................................................................................
|
||||
virtual OOX::IFileContainer *current_document() = 0;
|
||||
|
||||
@ -87,8 +87,6 @@
|
||||
|
||||
using namespace cpdoccore;
|
||||
|
||||
std::vector<double> current_font_size;
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
#include "../Format/math_layout_elements.h"
|
||||
#include "../Format/math_limit_elements.h"
|
||||
#include "../Format/math_token_elements.h"
|
||||
#include "../Format/style_text_properties.h"
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
@ -173,7 +174,30 @@ namespace Oox2Odf
|
||||
|
||||
brackets().resize(1);
|
||||
|
||||
bool bStart = odf_context()->start_math();
|
||||
int base_font_size = current_font_size.empty() ? 12 : current_font_size.back();
|
||||
std::wstring base_font_color;
|
||||
|
||||
if (odf_context()->is_child_text_context() && odf_context()->drawing_context())
|
||||
{
|
||||
if (odf_context()->drawing_context()->get_text_properties())
|
||||
{
|
||||
if (odf_context()->drawing_context()->get_text_properties()->fo_color_)
|
||||
{
|
||||
base_font_color = odf_context()->drawing_context()->get_text_properties()->fo_color_->get_hex_value();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (odf_context()->text_context()->get_text_properties())
|
||||
{
|
||||
if (odf_context()->text_context()->get_text_properties()->fo_color_)
|
||||
{
|
||||
base_font_color = odf_context()->drawing_context()->get_text_properties()->fo_color_->get_hex_value();
|
||||
}
|
||||
}
|
||||
}
|
||||
bool bStart = odf_context()->start_math(base_font_size, base_font_color);
|
||||
|
||||
for (size_t i = 0; i < oox_math->m_arrItems.size(); ++i)
|
||||
{
|
||||
@ -183,6 +207,7 @@ namespace Oox2Odf
|
||||
if (bStart)
|
||||
{
|
||||
StarMath::COOXml2Odf starMathConverter;
|
||||
starMathConverter.SetBaseAttribute(base_font_color,base_font_size);
|
||||
starMathConverter.StartConversion(oox_math);
|
||||
|
||||
std::wstring annotation_text = starMathConverter.GetAnnotation();
|
||||
@ -236,7 +261,30 @@ namespace Oox2Odf
|
||||
{
|
||||
if (!oox_math_para) return;
|
||||
|
||||
bool bStart = odf_context()->start_math();
|
||||
int base_font_size = current_font_size.empty() ? 12 : current_font_size.back();
|
||||
std::wstring base_font_color;
|
||||
|
||||
if (odf_context()->is_child_text_context() && odf_context()->drawing_context())
|
||||
{
|
||||
if (odf_context()->drawing_context()->get_text_properties())
|
||||
{
|
||||
if (odf_context()->drawing_context()->get_text_properties()->fo_color_)
|
||||
{
|
||||
base_font_color = odf_context()->drawing_context()->get_text_properties()->fo_color_->get_hex_value();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (odf_context()->text_context()->get_text_properties())
|
||||
{
|
||||
if (odf_context()->text_context()->get_text_properties()->fo_color_)
|
||||
{
|
||||
base_font_color = odf_context()->drawing_context()->get_text_properties()->fo_color_->get_hex_value();
|
||||
}
|
||||
}
|
||||
}
|
||||
bool bStart = odf_context()->start_math(base_font_size, base_font_color);
|
||||
|
||||
for (size_t i = 0; i < oox_math_para->m_arrItems.size(); ++i)
|
||||
{
|
||||
@ -245,6 +293,7 @@ namespace Oox2Odf
|
||||
if (bStart)
|
||||
{
|
||||
StarMath::COOXml2Odf starMathConverter;
|
||||
starMathConverter.SetBaseAttribute(base_font_color,base_font_size);
|
||||
starMathConverter.StartConversion(oox_math_para);
|
||||
|
||||
std::wstring annotation_text = starMathConverter.GetAnnotation();
|
||||
@ -1260,16 +1309,18 @@ namespace Oox2Odf
|
||||
odf_context()->settings_context()->start_view();
|
||||
if (oox_r_pr->m_oSz.IsInit() && oox_r_pr->m_oSz->m_oVal.IsInit())
|
||||
{
|
||||
odf_context()->math_context()->size = oox_r_pr->m_oSz->m_oVal->GetValue();
|
||||
odf_context()->math_context()->font_size = oox_r_pr->m_oSz->m_oVal->GetValue();
|
||||
}
|
||||
else
|
||||
|
||||
odf_context()->settings_context()->add_config_content_item(L"BaseFontHeight", L"short", std::to_wstring((int)odf_context()->math_context()->font_size));
|
||||
if (!odf_context()->math_context()->font_color.empty())
|
||||
{
|
||||
odf_context()->math_context()->size = 12;
|
||||
odf_context()->settings_context()->add_config_content_item(L"BaseFontColor", L"string", L"#" + odf_context()->math_context()->font_color);
|
||||
}
|
||||
odf_context()->settings_context()->add_config_content_item(L"BaseFontHeight", L"short", std::to_wstring(odf_context()->math_context()->size));
|
||||
|
||||
if (oox_r_pr->m_oRFonts.IsInit() && oox_r_pr->m_oRFonts->m_sAscii.IsInit())
|
||||
{
|
||||
odf_context()->math_context()->font = *oox_r_pr->m_oRFonts->m_sAscii;
|
||||
odf_context()->math_context()->font_name = *oox_r_pr->m_oRFonts->m_sAscii;
|
||||
|
||||
odf_context()->settings_context()->add_config_content_item(L"FontNameFunctions", L"string", *oox_r_pr->m_oRFonts->m_sAscii);
|
||||
odf_context()->settings_context()->add_config_content_item(L"FontNameNumbers", L"string", *oox_r_pr->m_oRFonts->m_sAscii);
|
||||
|
||||
@ -383,7 +383,7 @@ void odf_conversion_context::end_drawing_context()
|
||||
drawing_context_.pop_back();
|
||||
}
|
||||
|
||||
bool odf_conversion_context::start_math()
|
||||
bool odf_conversion_context::start_math(int base_font_size, const std::wstring& base_font_color)
|
||||
{
|
||||
if (false == math_context_.isEmpty()) return false;
|
||||
|
||||
@ -401,6 +401,8 @@ bool odf_conversion_context::start_math()
|
||||
math_context_.set_styles_context(odf_conversion_context::styles_context());
|
||||
math_context_.start_math(get_current_object_element());
|
||||
|
||||
math_context_.font_size = base_font_size;
|
||||
math_context_.font_color = base_font_color;
|
||||
return true;
|
||||
}
|
||||
void odf_conversion_context::end_math()
|
||||
@ -409,7 +411,7 @@ void odf_conversion_context::end_math()
|
||||
|
||||
end_object();
|
||||
|
||||
calculate_font_metrix(math_context_.font, math_context_.size, false, false, true); // смотреть по формуле - перевычислять только если есть изменения это шрифт и кегль
|
||||
calculate_font_metrix(math_context_.font_name, math_context_.font_size, false, false, true); // смотреть по формуле - перевычислять только если есть изменения это шрифт и кегль
|
||||
|
||||
double h = math_context_.lvl_max - math_context_.lvl_min;
|
||||
if (math_context_.lvl_min < 0) h += 1;
|
||||
|
||||
@ -121,6 +121,8 @@ public:
|
||||
virtual odf_text_context * text_context() = 0;
|
||||
virtual odf_controls_context * controls_context() = 0;
|
||||
|
||||
virtual bool is_child_text_context() = 0;
|
||||
|
||||
std::wstring add_image (const std::wstring & image_file_name, bool bExternal = false);
|
||||
std::wstring add_media (const std::wstring & file_name, bool bExternal = false);
|
||||
std::wstring add_oleobject (const std::wstring & ole_file_name, bool bExternal = false);
|
||||
@ -144,7 +146,7 @@ public:
|
||||
void start_chart();
|
||||
void end_chart();
|
||||
|
||||
virtual bool start_math();
|
||||
virtual bool start_math(int base_font_size, const std::wstring & base_font_color);
|
||||
virtual void end_math();
|
||||
|
||||
void start_spreadsheet();
|
||||
|
||||
@ -2652,10 +2652,14 @@ graphic_format_properties* odf_drawing_context::get_graphic_properties()
|
||||
{
|
||||
return impl_->current_graphic_properties;
|
||||
}
|
||||
text_format_properties* odf_drawing_context::get_text_properties()
|
||||
{
|
||||
return impl_->current_text_properties;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_textarea_vertical_align(int align)
|
||||
{
|
||||
if (!impl_->current_graphic_properties)return;
|
||||
if (!impl_->current_graphic_properties) return;
|
||||
switch(align)
|
||||
{
|
||||
case 0://SimpleTypes::textanchoringtypeB:
|
||||
@ -3321,19 +3325,23 @@ void odf_drawing_context::end_image()
|
||||
end_shape();
|
||||
return;
|
||||
}
|
||||
|
||||
if (impl_->current_drawing_state_.flipV_)
|
||||
{
|
||||
if (impl_->current_drawing_state_.rotateAngle_)
|
||||
*impl_->current_drawing_state_.rotateAngle_ -= 3.1415926535;
|
||||
else
|
||||
impl_->current_drawing_state_.rotateAngle_ = -3.1415926535;
|
||||
|
||||
impl_->current_drawing_state_.flipH_ = !impl_->current_drawing_state_.flipH_;
|
||||
}
|
||||
|
||||
if (impl_->current_drawing_state_.flipH_)
|
||||
{
|
||||
if (impl_->current_graphic_properties->style_mirror_)
|
||||
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" horizontal");
|
||||
else
|
||||
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"horizontal");
|
||||
}
|
||||
if (impl_->current_drawing_state_.flipV_)
|
||||
{
|
||||
if (impl_->current_graphic_properties->style_mirror_)
|
||||
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" vertical");
|
||||
else
|
||||
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"vertical");
|
||||
}
|
||||
end_element();
|
||||
end_frame();
|
||||
|
||||
@ -156,6 +156,7 @@ public:
|
||||
bool placeholder_replacing();
|
||||
|
||||
graphic_format_properties* get_graphic_properties();
|
||||
text_format_properties* get_text_properties();
|
||||
|
||||
void set_graphic_properties (style_graphic_properties *graphic_properties);
|
||||
void set_graphic_properties (graphic_format_properties* graphic_properties);
|
||||
|
||||
@ -124,8 +124,11 @@ namespace cpdoccore {
|
||||
double lvl_down_counter = 0;
|
||||
double lvl_max = 0;
|
||||
double lvl_min = 0;
|
||||
std::wstring font;
|
||||
double size = 0;
|
||||
|
||||
std::wstring font_name;
|
||||
double font_size = 0;
|
||||
std::wstring font_color;
|
||||
|
||||
std::set<wchar_t> mo;
|
||||
std::map<std::wstring, std::wstring> diak_symbols;
|
||||
|
||||
|
||||
@ -58,6 +58,11 @@ odp_conversion_context::odp_conversion_context(package::odf_document * outputDoc
|
||||
: odf_conversion_context (PresentationDocument, outputDocument), root_presentation_(NULL), slide_context_(*this), rId_(1)
|
||||
{
|
||||
}
|
||||
bool odp_conversion_context::is_child_text_context()
|
||||
{
|
||||
return (false == text_context_.empty());
|
||||
}
|
||||
|
||||
odf_text_context* odp_conversion_context::text_context()
|
||||
{
|
||||
if (false == text_context_.empty())
|
||||
|
||||
@ -73,6 +73,7 @@ public:
|
||||
odp_page_state & current_slide() { return slide_context_.state();}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
virtual bool is_child_text_context();
|
||||
|
||||
virtual odf_drawing_context * drawing_context();
|
||||
virtual odf_controls_context * controls_context();
|
||||
|
||||
@ -693,6 +693,10 @@ odf_text_context* ods_conversion_context::text_context()
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
bool ods_conversion_context::is_child_text_context()
|
||||
{
|
||||
return (false == text_context_.empty());
|
||||
}
|
||||
void ods_conversion_context::add_text(const std::wstring &text)
|
||||
{
|
||||
office_element_ptr paragr_elm;
|
||||
|
||||
@ -101,6 +101,7 @@ public:
|
||||
//-----------------------------------------------------------------------
|
||||
ods_table_state_ptr & current_table() { return table_context_.state();}
|
||||
//-----------------------------------------------------------------------
|
||||
virtual bool is_child_text_context();
|
||||
|
||||
virtual odf_drawing_context * drawing_context();
|
||||
virtual odf_text_context * text_context();
|
||||
|
||||
@ -210,16 +210,19 @@ odf_notes_context* odt_conversion_context::notes_context()
|
||||
|
||||
odf_text_context* odt_conversion_context::text_context()
|
||||
{
|
||||
if (text_context_.size() > 0)
|
||||
{
|
||||
return text_context_.back().get();
|
||||
}
|
||||
else
|
||||
if (text_context_.empty())
|
||||
{
|
||||
return main_text_context_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return text_context_.back().get();
|
||||
}
|
||||
}
|
||||
|
||||
bool odt_conversion_context::is_child_text_context()
|
||||
{
|
||||
return (false == text_context_.empty());
|
||||
}
|
||||
void odt_conversion_context::add_text_content(const std::wstring & text)
|
||||
{
|
||||
if (drop_cap_state_.enabled)
|
||||
@ -260,12 +263,12 @@ void odt_conversion_context::start_drawing_context()
|
||||
drawing_context()->set_footer_state(is_footer_);
|
||||
drawing_context()->set_header_state(is_header_);
|
||||
}
|
||||
bool odt_conversion_context::start_math()
|
||||
bool odt_conversion_context::start_math(int base_font_size, const std::wstring& base_font_color)
|
||||
{
|
||||
if (false == math_context()->isEmpty()) return false;
|
||||
|
||||
start_drawing_context();
|
||||
return odf_conversion_context::start_math();
|
||||
return odf_conversion_context::start_math(base_font_size, base_font_color);
|
||||
}
|
||||
void odt_conversion_context::end_math()
|
||||
{
|
||||
|
||||
@ -65,6 +65,8 @@ public:
|
||||
virtual void start_document();
|
||||
virtual void end_document();
|
||||
|
||||
virtual bool is_child_text_context();
|
||||
|
||||
virtual odf_drawing_context * drawing_context();
|
||||
virtual odf_text_context * text_context();
|
||||
virtual odf_controls_context * controls_context();
|
||||
@ -79,7 +81,7 @@ public:
|
||||
virtual void start_drawing_context();
|
||||
virtual void end_drawing_context();
|
||||
|
||||
virtual bool start_math();
|
||||
virtual bool start_math(int base_font_size, const std::wstring& base_font_color);
|
||||
virtual void end_math();
|
||||
|
||||
void add_text_content (const std::wstring & text);
|
||||
|
||||
Reference in New Issue
Block a user