Compare commits

..

7 Commits

Author SHA1 Message Date
b0a2104b21 Merge commit 'de51052f6ae59ac36665fb3f85804081a888c7c5' into develop 2018-09-18 20:03:33 +03:00
e4986f4202 . 2018-09-18 19:35:06 +03:00
de51052f6a [bug] Fix file corruption after pasting picture with error 2018-09-18 18:47:12 +03:00
bd1dc5a7b6 . 2018-09-17 17:28:46 +03:00
1ccbe323f4 . 2018-09-14 19:21:12 +03:00
2c8efcb183 Merge pull request #106 from ONLYOFFICE/feature/provideARCtoKernel
send use ARC parameter to downloader
2018-09-14 18:46:40 +03:00
9c2a717870 send use ARC parameter to downloader 2018-09-14 17:03:12 +03:00
12 changed files with 267 additions and 111 deletions

View File

@ -189,6 +189,8 @@ void paragraph::drop_cap_text_docx_convert(office_element_ptr first_text_element
if (str_start > store_str.length()) str_start = store_str.length(); // это если на буквы в буквице разные стили
str = store_str.substr(str_start, str_size);
if (textStyle==1) Context.pop_text_properties();
}
size_t paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)

View File

@ -407,6 +407,7 @@ void draw_enhanced_geometry_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:type", draw_type_);
CP_XML_ATTR_OPT(L"drawooo:sub-view-size", draw_sub_view_size_);
CP_XML_ATTR_OPT(L"draw:text-areas", draw_text_areas_);
CP_XML_ATTR_OPT(L"draw:text-rotate-angle", draw_text_rotate_angle_);
CP_XML_ATTR_OPT(L"draw:modifiers", draw_modifiers_);
CP_XML_ATTR_OPT(L"drawooo:enhanced-path", draw_enhanced_path_);
//CP_XML_ATTR_OPT(L"draw:enhanced-path", draw_enhanced_path_);
@ -430,7 +431,7 @@ void draw_enhanced_geometry::serialize(std::wostream & _Wostream)
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"svg:viewBox", svg_viewbox_);
draw_enhanced_geometry_attlist_.serialize(CP_GET_XML_NODE());
attlist_.serialize(CP_GET_XML_NODE());
for (size_t i = 0; i < draw_equation_.size(); i++)
{

View File

@ -331,6 +331,8 @@ public:
_CP_OPT(odf_types::Bool) draw_text_path_same_letter_heights_;
_CP_OPT(std::wstring) draw_text_path_mode_;
_CP_OPT(std::wstring) draw_text_path_scale_;
_CP_OPT(int) draw_text_rotate_angle_;
void serialize(CP_ATTR_NODE);
};
@ -350,7 +352,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
draw_enhanced_geometry_attlist draw_enhanced_geometry_attlist_;
draw_enhanced_geometry_attlist attlist_;
_CP_OPT(std::wstring) svg_viewbox_;

View File

@ -186,6 +186,7 @@ struct odf_drawing_state
presentation_placeholder_ = boost::none;
rotateAngle_ = boost::none;
text_rotateAngle_ = boost::none;
path_ = L"";
view_box_ = L"";
@ -218,6 +219,7 @@ struct odf_drawing_state
_CP_OPT(double) rotateAngle_;
_CP_OPT(unsigned int) fill_color_;
_CP_OPT(int) text_rotateAngle_;
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) presentation_placeholder_;
@ -232,6 +234,7 @@ struct odf_drawing_state
int oox_shape_preset_;
bool in_group_;
bool text_box_tableframe_;
};
class odf_drawing_context::Impl
@ -536,7 +539,7 @@ void odf_drawing_context::end_drawing()
if (impl_->current_drawing_state_.rotateAngle_)
rotate += *impl_->current_drawing_state_.rotateAngle_;
if (fabs(rotate)>0.001)impl_->current_drawing_state_.rotateAngle_ = rotate;
if (fabs(rotate) > 0.001)impl_->current_drawing_state_.rotateAngle_ = rotate;
}
double x = impl_->current_drawing_state_.svg_x_ ? impl_->current_drawing_state_.svg_x_->get_value() : 0;
double y = impl_->current_drawing_state_.svg_y_ ? impl_->current_drawing_state_.svg_y_->get_value() : 0;
@ -615,8 +618,8 @@ void odf_drawing_context::end_drawing()
draw_enhanced_geometry* enhan = dynamic_cast<draw_enhanced_geometry*>(custom->draw_enhanced_geometry_.get());
if(enhan)
{
if (impl_->current_drawing_state_.flipV_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_vertical_ = true;
if (impl_->current_drawing_state_.flipH_) enhan->draw_enhanced_geometry_attlist_.draw_mirror_horizontal_ = true;
if (impl_->current_drawing_state_.flipV_) enhan->attlist_.draw_mirror_vertical_ = true;
if (impl_->current_drawing_state_.flipH_) enhan->attlist_.draw_mirror_horizontal_ = true;
}
}else
{
@ -986,15 +989,17 @@ void odf_drawing_context::end_shape()
{
if (text_shape)
{
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_same_letter_heights_ = false;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_scale_ = L"path" ;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_mode_ = L"shape" ;
enhanced->draw_enhanced_geometry_attlist_.draw_text_path_ = true;
enhanced->attlist_.draw_text_path_same_letter_heights_ = false;
enhanced->attlist_.draw_text_path_scale_ = L"path" ;
enhanced->attlist_.draw_text_path_mode_ = L"shape" ;
enhanced->attlist_.draw_text_path_ = true;
enhanced->attlist_.draw_text_rotate_angle_ = impl_->current_drawing_state_.text_rotateAngle_;
}
if (!impl_->current_drawing_state_.path_.empty())
{
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ =impl_->current_drawing_state_.path_;
enhanced->attlist_.draw_enhanced_path_ =impl_->current_drawing_state_.path_;
}
if (!impl_->current_drawing_state_.view_box_.empty())
{
@ -1002,7 +1007,7 @@ void odf_drawing_context::end_shape()
}
if (!sub_type.empty())
{
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = sub_type;
enhanced->attlist_.draw_type_ = sub_type;
}
else
{
@ -1018,23 +1023,23 @@ void odf_drawing_context::end_shape()
else
enhanced->svg_viewbox_ = shape_define->view_box;
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name;
enhanced->draw_enhanced_geometry_attlist_.draw_text_areas_ = shape_define->text_areas;
enhanced->attlist_.draw_type_ = shape_define->odf_type_name;
enhanced->attlist_.draw_text_areas_ = shape_define->text_areas;
enhanced->draw_enhanced_geometry_attlist_.draw_glue_points_ = shape_define->glue_points;
enhanced->draw_enhanced_geometry_attlist_.draw_sub_view_size_ = shape_define->sub_view_size;
enhanced->attlist_.draw_glue_points_ = shape_define->glue_points;
enhanced->attlist_.draw_sub_view_size_ = shape_define->sub_view_size;
if (impl_->current_drawing_state_.oox_shape_ && !impl_->current_drawing_state_.oox_shape_->modifiers.empty())
{
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = impl_->current_drawing_state_.oox_shape_->modifiers;
enhanced->attlist_.draw_modifiers_ = impl_->current_drawing_state_.oox_shape_->modifiers;
}
else // обязательно нужны дефолтовые
enhanced->draw_enhanced_geometry_attlist_.draw_modifiers_ = shape_define->modifiers;
enhanced->attlist_.draw_modifiers_ = shape_define->modifiers;
if (!shape_define->enhanced_path.empty())
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
enhanced->attlist_.draw_enhanced_path_ = shape_define->enhanced_path;
else
enhanced->draw_enhanced_geometry_attlist_.draw_enhanced_path_ = impl_->current_drawing_state_.path_;
enhanced->attlist_.draw_enhanced_path_ = impl_->current_drawing_state_.path_;
for (size_t i = 0; i < shape_define->equations.size(); i++)
{
@ -1074,6 +1079,18 @@ void odf_drawing_context::end_shape()
}
end_element();
}
if (impl_->current_drawing_state_.flipV_)
{
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"vertical");
}
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");
}
end_element();
}
@ -1346,7 +1363,7 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
//impl_->current_graphic_properties->common_background_color_attlist_.fo_background_color_ = color(hexColor); - default transparent
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
@ -1599,26 +1616,10 @@ void odf_drawing_context::set_viewBox (double W, double H)
void odf_drawing_context::set_flip_H(bool bVal)
{
impl_->current_drawing_state_.flipH_ = bVal;
if (impl_->current_graphic_properties == NULL) return;
if (bVal == false)return;
//for image
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");
}
void odf_drawing_context::set_flip_V(bool bVal)
{
impl_->current_drawing_state_.flipV_ = bVal;
if (impl_->current_graphic_properties == NULL) return;
if (bVal == false)return;
//for image
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");
}
void odf_drawing_context::set_rotate(double dVal)
@ -1658,7 +1659,7 @@ void odf_drawing_context::set_object_background(bool Val)
if (Val)
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
//impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
}
}
void odf_drawing_context::set_object_foreground(bool Val)
@ -1673,7 +1674,7 @@ void odf_drawing_context::set_object_foreground(bool Val)
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Foreground);
}
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
//impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
}
}
@ -2278,6 +2279,33 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
if (mode == 1) return;//незачем
if (impl_->current_drawing_state_.elements_.empty())return;
if (impl_->current_drawing_state_.oox_shape_preset_ > 2000 && impl_->current_drawing_state_.oox_shape_preset_ < 3000)
{
switch(mode)
{
case 5://textverticaltypeWordArtVert:
case 6://textverticaltypeWordArtVertRtl:
case 3://SimpleTypes::textverticaltypeVert:
case 2://SimpleTypes::textverticaltypeMongolianVert:
case 0://SimpleTypes::textverticaltypeEaVert:
impl_->current_drawing_state_.rotateAngle_ = 90. / 180. * 3.14159265358979323846;
break;
case 4://SimpleTypes::textverticaltypeVert270:
impl_->current_drawing_state_.rotateAngle_ = 270. / 180. * 3.14159265358979323846;
break;
case 1://SimpleTypes::textverticaltypeHorz:
default:
break;
}
if (impl_->current_drawing_state_.flipH_ && impl_->current_drawing_state_.rotateAngle_ )
{
impl_->current_drawing_state_.rotateAngle_ = - *impl_->current_drawing_state_.rotateAngle_;
impl_->current_drawing_state_.flipH_ = false;
}
return;
}
if (!impl_->current_paragraph_properties)
{
style* style_ = dynamic_cast<style*>(impl_->current_drawing_state_.elements_[0].style_elm.get());
@ -2483,6 +2511,12 @@ void odf_drawing_context::start_text_box()
}
void odf_drawing_context::set_text_box_min_size(bool val)
{
if (impl_->current_graphic_properties)
{
impl_->current_graphic_properties->draw_auto_grow_height_ = true;
impl_->current_graphic_properties->draw_auto_grow_width_ = true;
}
if (impl_->current_drawing_state_.elements_.empty()) return;
draw_text_box* draw = dynamic_cast<draw_text_box*>(impl_->current_drawing_state_.elements_.back().elm.get());
@ -2647,7 +2681,13 @@ void odf_drawing_context::end_image()
end_shape();
return;
}
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");
}
end_element();
end_frame();
}
@ -2795,7 +2835,8 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
}
}
if (impl_->current_graphic_properties)
if ((impl_->current_graphic_properties) &&
!impl_->current_graphic_properties->draw_auto_grow_height_)
{
//автоувеличение при добавлении текста
impl_->current_graphic_properties->draw_auto_grow_height_ = false;
@ -2860,10 +2901,20 @@ void odf_drawing_context::start_gradient_style()
if (gradient->draw_start_color_) gradient->draw_start_intensity_ = 100.;
gradient->draw_border_ = 0;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
break;
case Line:
if (!impl_->current_graphic_properties->draw_stroke_)
impl_->current_graphic_properties->draw_stroke_ = line_style(line_style::Solid);//default
if (!impl_->current_graphic_properties->svg_stroke_width_)
impl_->current_graphic_properties->svg_stroke_width_ = length(length(1, length::pt).get_value_unit(length::cm), length::cm);//default
break;
}
}
void odf_drawing_context::set_gradient_type(gradient_style::type style)
{
@ -2882,6 +2933,11 @@ void odf_drawing_context::set_gradient_start(std::wstring hexColor, _CP_OPT(doub
gradient->draw_start_color_ = hexColor;
gradient->draw_start_intensity_ = 100.;
if (impl_->current_drawing_part_ == Line)
{
impl_->current_graphic_properties->svg_stroke_color_ = hexColor;
}
}
void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(double) & intensiv)
{

View File

@ -593,7 +593,7 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
if (oox_shape->txBody.IsInit()) bodyPr = oox_shape->txBody->bodyPr.GetPointer();
else bodyPr = oox_shape->oTextBoxBodyPr.GetPointer();
if (bodyPr && bodyPr->fromWordArt.get_value_or(false))
if ((bodyPr) && (bodyPr->prstTxWarp.IsInit()))
{
int wordart_type = convert(bodyPr->prstTxWarp.GetPointer());
if (wordart_type > 0) type = wordart_type;
@ -782,9 +782,16 @@ void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
int OoxConverter::convert(PPTX::Logic::PrstTxWarp *oox_text_preset)
{
if (oox_text_preset == NULL) return -1;
if (oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextNoShape) return 2000;
return 2001 + oox_text_preset->prst.GetBYTECode();
if (oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextNoShape ||
oox_text_preset->prst.GetBYTECode() == SimpleTypes::textshapetypeTextPlain) // в зависимости от других настроек
{
return 2000;
}
else
{
return 2001 + oox_text_preset->prst.GetBYTECode();
}
}
void OoxConverter::convert(PPTX::Logic::PrstGeom *oox_geom)
{
@ -1067,8 +1074,13 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB)
std::wstring hexColorStart, hexColorEnd;
_CP_OPT(double) opacityStart, opacityEnd;
convert(&oox_grad_fill->GsLst[0].color,hexColorEnd, opacityEnd, nARGB);
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size()-1].color,hexColorStart, opacityStart, nARGB);
convert(&oox_grad_fill->GsLst[0].color, hexColorEnd, opacityEnd, nARGB);
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size() - 1].color, hexColorStart, opacityStart, nARGB);
if (hexColorEnd == hexColorStart && opacityEnd == opacityStart && oox_grad_fill->GsLst.size() > 2)
{
convert(&oox_grad_fill->GsLst[oox_grad_fill->GsLst.size() / 2].color, hexColorStart, opacityStart, nARGB);
}
odf_context()->drawing_context()->set_gradient_start(hexColorStart, opacityStart);
odf_context()->drawing_context()->set_gradient_end (hexColorEnd, opacityEnd);
@ -1253,6 +1265,16 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
{
if (!oox_bodyPr) return;
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
{
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
{
if (oox_bodyPr->prstTxWarp->avLst[i].fmla.IsInit())
{
odf_context()->drawing_context()->add_modifier(oox_bodyPr->prstTxWarp->avLst[i].fmla.get());
}
}
}
if (oox_bodyPr->vert.IsInit())
{
odf_context()->drawing_context()->set_textarea_writing_mode (oox_bodyPr->vert->GetBYTECode());
@ -1287,7 +1309,7 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
switch(oox_bodyPr->Fit.type)
{
case PPTX::Logic::TextFit::FitSpAuto:
{//изменяемы размеры
{//изменяемы размеры шейпа под текст
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
}break;
case PPTX::Logic::TextFit::FitNo:
@ -1300,17 +1322,6 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
{
}
}
if ((oox_bodyPr->fromWordArt.IsInit() && (*oox_bodyPr->fromWordArt)) && oox_bodyPr->prstTxWarp.IsInit())
{
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
{
if (oox_bodyPr->prstTxWarp->avLst[i].fmla.IsInit())
{
odf_context()->drawing_context()->add_modifier(oox_bodyPr->prstTxWarp->avLst[i].fmla.get());
}
}
}
}
void OoxConverter::convert(PPTX::Logic::NvSpPr *oox_nvSpPr)
{

View File

@ -254,7 +254,7 @@ void DocxConverter::convert_document()
//----------------------------------------------------------------------------------------------------------
convert(docx_document->m_pDocument->m_oSectPr.GetPointer(), false, L"Standard");
convert(docx_document->m_pDocument->m_oSectPr.GetPointer(), false, L"Standard", true);
odt_context->text_context()->clear_params();
@ -1507,7 +1507,7 @@ void DocxConverter::apply_HF_from(OOX::Logic::CSectionProperty *props, OOX::Logi
}
}
}
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name)
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name, bool bAlways)
{
if (oox_section_pr == NULL) return;
current_section_properties = NULL;
@ -1684,7 +1684,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
//nullable<SimpleTypes::CDecimalNumber<> > m_oChapStyle;
}
if (continuous == false || oox_section_pr->m_oTitlePg.IsInit())
if (continuous == false || oox_section_pr->m_oTitlePg.IsInit() || bAlways)
{
OOX::Logic::CSectionProperty* s = last_section_properties ? last_section_properties : oox_section_pr;
@ -2244,43 +2244,94 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
text_properties->content_.fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WNormal);
}
odf_writer::odf_drawing_context *drawing_context = odf_context()->drawing_context();
bool set_word_art = drawing_context ? drawing_context->is_wordart() : false;
bool set_color = false;
if (oox_run_pr->m_oTextFill.getType() == OOX::et_a_gradFill || oox_run_pr->m_oTextOutline.IsInit())
NSCommon::smart_ptr<PPTX::Logic::GradFill> gradFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
NSCommon::smart_ptr<PPTX::Logic::SolidFill> solidFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
bool bFillText = (oox_run_pr->m_oTextFill.m_type != PPTX::Logic::UniFill::notInit) &&
(oox_run_pr->m_oTextFill.m_type != PPTX::Logic::UniFill::noFill);
bool bOutlineText = ((oox_run_pr->m_oTextOutline.is_init()) &&
(oox_run_pr->m_oTextOutline->Fill.m_type != PPTX::Logic::UniFill::notInit) &&
(oox_run_pr->m_oTextOutline->Fill.m_type != PPTX::Logic::UniFill::noFill));
bool bColorText = (oox_run_pr->m_oColor.IsInit() && (oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorRGB));
if (gradFill.is_init() || (bOutlineText && (bFillText || bColorText)))
{
odf_writer::odf_drawing_context *drawing_context = odf_context()->drawing_context();
if (drawing_context)
{
if (odf_context()->drawing_context()->change_text_box_2_wordart())
{
NSCommon::smart_ptr<PPTX::Logic::GradFill> gradFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
NSCommon::smart_ptr<PPTX::Logic::SolidFill> solidFill = oox_run_pr->m_oTextFill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
odf_context()->drawing_context()->start_area_properties(true);
if(gradFill.IsInit())
{
OoxConverter::convert(gradFill.operator->());
}
else if (solidFill.IsInit())
{
OoxConverter::convert(solidFill.operator->());
}
else
{
odf_context()->drawing_context()->set_no_fill();
}
odf_context()->drawing_context()->end_area_properties();
set_word_art = true;
}
if (oox_run_pr->m_oTextOutline.IsInit())
{
odf_context()->drawing_context()->start_line_properties(true);
OoxConverter::convert(oox_run_pr->m_oTextOutline.operator->());
odf_context()->drawing_context()->end_line_properties();
}
set_color = true;
if (drawing_context && set_word_art)
{
if (drawing_context->change_text_box_2_wordart())
{
drawing_context->start_area_properties(true);
if(gradFill.IsInit())
{
OoxConverter::convert(gradFill.operator->());
}
else if (solidFill.IsInit())
{
OoxConverter::convert(solidFill.operator->());
}
else if (bColorText)
{
_CP_OPT(odf_types::color) color;
convert(oox_run_pr->m_oColor.GetPointer(), color);
if (color)
drawing_context->set_solid_fill(color->get_hex_value());
}
else
{
drawing_context->set_no_fill();
}
drawing_context->end_area_properties();
if (oox_run_pr->m_oTextOutline.IsInit())
{
drawing_context->start_line_properties(true);
OoxConverter::convert(oox_run_pr->m_oTextOutline.operator->());
drawing_context->end_line_properties();
}
set_color = true;
}
else
{
set_word_art = false;
}
}
if (!set_word_art)
{
std::wstring hexString;
_CP_OPT(double) opacity;
if (bOutlineText)
{
text_properties->content_.style_text_outline_ = true;
gradFill = oox_run_pr->m_oTextOutline->Fill.Fill.smart_dynamic_cast<PPTX::Logic::GradFill>();
solidFill = oox_run_pr->m_oTextOutline->Fill.Fill.smart_dynamic_cast<PPTX::Logic::SolidFill>();
}
if (solidFill.is_init())
{
OoxConverter::convert(&solidFill->Color, hexString, opacity);
}
else if ((gradFill.is_init()) && (false == gradFill->GsLst.empty()))
{
OoxConverter::convert(&gradFill->GsLst[0].color, hexString, opacity);
}
if (!hexString.empty())
{
set_color = true;
text_properties->content_.fo_color_ = hexString;
}
else{} //обычный текст .. градиент по телу абзаца (
}
if (!set_color && oox_run_pr->m_oColor.IsInit())
@ -2288,7 +2339,7 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
if(oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorAuto)
text_properties->content_.fo_color_ = odf_types::color(L"#000000");
else
convert(oox_run_pr->m_oColor.GetPointer(),text_properties->content_.fo_color_);
convert(oox_run_pr->m_oColor.GetPointer(), text_properties->content_.fo_color_);
}
//text_properties->content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::None); //нельзя..если будет выше наследуемого то подчеркивания не будет
@ -2447,10 +2498,11 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st
if (oox_run_pr->m_oShd.IsInit())
{
_CP_OPT(odf_types::color) odf_color;
convert(oox_run_pr->m_oShd->m_oFill.GetPointer(), oox_run_pr->m_oShd->m_oThemeFill.GetPointer(),
oox_run_pr->m_oShd->m_oThemeFillTint.GetPointer(), oox_run_pr->m_oShd->m_oThemeShade.GetPointer(), odf_color);
convert(oox_run_pr->m_oShd.GetPointer(), odf_color);
if (odf_color)
text_properties->content_.fo_background_color_ = *odf_color;
{
text_properties->content_.fo_background_color_= *odf_color;
}
}
if (oox_run_pr->m_oOutline.IsInit())
text_properties->content_.style_text_outline_ = true; //контур

View File

@ -183,7 +183,7 @@ namespace Oox2Odf
void convert(OOX::Logic::CBackground *oox_background, int type);
void convert(OOX::Logic::CSdt *oox_sdt);
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name = L"");
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name = L"", bool bAlways = false);
void convert(OOX::Logic::CParagraph *oox_paragraph);
void convert(OOX::Logic::CRun *oox_run);
void convert(OOX::Logic::CParagraphProperty *oox_para_prop, odf_writer::style_paragraph_properties *paragraph_properties);

View File

@ -218,9 +218,11 @@ namespace NSBinPptxRW
}
std::wstring strExts = _T(".jpg");
int nIndexExt = (int)strInput.rfind(wchar_t('.'));
//use GetFileName to avoid defining '.' in the directory as extension
std::wstring strFileName = NSFile::GetFileName(strInput);
int nIndexExt = (int)strFileName.rfind(wchar_t('.'));
if (-1 != nIndexExt)
strExts = strInput.substr(nIndexExt);
strExts = strFileName.substr(nIndexExt);
int typeAdditional = 0;
std::wstring strAdditional;

View File

@ -64,6 +64,7 @@ namespace OOX
m_mTable.insert( std::make_pair( _T("emf"), _T("image/x-emf")));
m_mTable.insert( std::make_pair( _T("emz"), _T("image/x-emz")));
m_mTable.insert( std::make_pair( _T("wmf"), _T("image/x-wmf")));
m_mTable.insert( std::make_pair( _T("svg"), _T("image/svg+xml")));
m_mTable.insert( std::make_pair( _T("svm"), _T("image/svm")));
m_mTable.insert( std::make_pair( _T("wav"), _T("audio/wav")));
m_mTable.insert( std::make_pair( _T("wma"), _T("audio/x-wma")));

View File

@ -102,3 +102,16 @@ void CFileDownloader::CheckSuspend()
{
return m_pInternal->CheckSuspend();
}
#ifdef _MAC
bool CFileDownloader::m_bIsARCEnabled = false;
void CFileDownloader::SetARCEnabled(const bool& enabled)
{
m_bIsARCEnabled = enabled;
}
bool CFileDownloader::GetARCEnabled()
{
return m_bIsARCEnabled;
}
#endif

View File

@ -41,6 +41,10 @@ protected:
// создаем в зависимости от платформы
CFileDownloader_private* m_pInternal;
#ifdef _MAC
static bool m_bIsARCEnabled;
#endif
public:
CFileDownloader(std::wstring sFileUrl, bool bDelete = true);
virtual ~CFileDownloader();
@ -63,4 +67,9 @@ public:
int GetPriority();
void CheckSuspend();
#ifdef _MAC
static void SetARCEnabled(const bool& enabled);
static bool GetARCEnabled();
#endif
};

View File

@ -1,4 +1,5 @@
#include "FileDownloader_private.h"
#include "FileDownloader.h"
#if _IOS
#import <Foundation/Foundation.h>
@ -27,12 +28,12 @@ public :
}
virtual int DownloadFile()
{
{
if (m_sFilePath.empty())
{
{
m_sFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"DWD");
if (NSFile::CFileBinary::Exists(m_sFilePath))
NSFile::CFileBinary::Remove(m_sFilePath);
NSFile::CFileBinary::Remove(m_sFilePath);
}
NSString* stringURL = StringWToNSString(m_sFileUrl);
@ -50,9 +51,12 @@ public :
return 0;
#else
#ifndef _ASC_USE_ARC_
[stringURL release];
[url release];
[urlData release];
if (!CFileDownloader::GetARCEnabled())
{
[stringURL release];
[url release];
[urlData release];
}
#endif
#endif
return 0;
@ -62,8 +66,11 @@ public :
return 1;
#else
#ifndef _ASC_USE_ARC_
[stringURL release];
[url release];
if (!CFileDownloader::GetARCEnabled())
{
[stringURL release];
[url release];
}
#endif
#endif
return 1;