mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-02 07:21:47 +08:00
Compare commits
6 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| a038e1562f | |||
| 9c7a03fdc5 | |||
| 9272b27a69 | |||
| ef57330a79 | |||
| d35619eeae | |||
| b38c552cc5 |
@ -44,7 +44,7 @@ namespace cpdoccore {
|
||||
namespace odf_writer {
|
||||
|
||||
|
||||
_mediaitems::item::item( std::wstring const & _oox_ref,
|
||||
_mediaitems::item::item(std::wstring const & _oox_ref,
|
||||
Type _type,
|
||||
std::wstring const & _odf_ref
|
||||
)
|
||||
@ -58,23 +58,31 @@ _mediaitems::item::item( std::wstring const & _oox_ref,
|
||||
|
||||
void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref)
|
||||
{
|
||||
std::wstring output_sub_path;//
|
||||
std::wstring output_sub_path;
|
||||
std::wstring output_fileName;
|
||||
int number=0;
|
||||
|
||||
if (type == typeImage)
|
||||
{
|
||||
output_sub_path = L"Pictures/";
|
||||
number= count_image+1;
|
||||
number = count_image + 1;
|
||||
}
|
||||
else
|
||||
else if (type == typeMedia)
|
||||
{
|
||||
output_sub_path = L"Media/";
|
||||
number= count_media+1;
|
||||
number = count_media + 1;
|
||||
}
|
||||
|
||||
|
||||
output_fileName = utils::media::create_file_name(oox_ref, type, number);//guid???
|
||||
else if (type == typeOleObject)
|
||||
{
|
||||
output_sub_path = L"";
|
||||
number = count_object + 1;
|
||||
}
|
||||
else if (type == typeObjectReplacement)
|
||||
{
|
||||
output_sub_path = L"ObjectReplacements/";
|
||||
number = count_image_object + 1;
|
||||
}
|
||||
output_fileName = utils::media::create_file_name(oox_ref, type, number); //guid???
|
||||
|
||||
std::wstring input_path = oox_ref;
|
||||
|
||||
@ -92,16 +100,25 @@ void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wst
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (output_path .length() < 1)
|
||||
if (output_path.length() < 1)
|
||||
{
|
||||
output_path = ( output_sub_path + output_fileName) ;
|
||||
if ( type == typeImage)
|
||||
{
|
||||
count_image++;
|
||||
}
|
||||
else
|
||||
else if ( type == typeMedia)
|
||||
{
|
||||
count_media++;
|
||||
|
||||
}
|
||||
else if ( type == typeOleObject)
|
||||
{
|
||||
count_object++;
|
||||
}
|
||||
else if ( type == typeObjectReplacement)
|
||||
{
|
||||
count_image_object++;
|
||||
}
|
||||
|
||||
items_.push_back( item(input_path, type, xml::utils::replace_text_to_xml(output_path)) );
|
||||
}
|
||||
|
||||
@ -42,13 +42,14 @@ class rels;
|
||||
class _mediaitems
|
||||
{
|
||||
public:
|
||||
enum Type { typeUnknown = 0, typeImage, typeMedia};
|
||||
//oleObject ???
|
||||
enum Type { typeUnknown = 0, typeImage, typeMedia, typeOleObject, typeObjectReplacement};
|
||||
|
||||
_mediaitems()
|
||||
{
|
||||
count_image =0;
|
||||
count_media =0;
|
||||
count_image = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_image_object = 0;
|
||||
}
|
||||
|
||||
struct item
|
||||
@ -66,6 +67,8 @@ public:
|
||||
|
||||
size_t count_image;
|
||||
size_t count_media;
|
||||
size_t count_object;
|
||||
size_t count_image_object;
|
||||
|
||||
void add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref);
|
||||
|
||||
|
||||
@ -29,12 +29,8 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "mediaitems_utils.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_writer{
|
||||
namespace utils {
|
||||
@ -45,9 +41,11 @@ std::wstring get_rel_type(_mediaitems::Type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case _mediaitems::typeImage:
|
||||
return L"";
|
||||
default:
|
||||
case _mediaitems::typeOleObject:
|
||||
return L"application/vnd.sun.star.oleobject";
|
||||
case _mediaitems::typeMedia:
|
||||
case _mediaitems::typeImage:
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
@ -58,6 +56,9 @@ std::wstring get_default_file_name(_mediaitems::Type type)
|
||||
{
|
||||
case _mediaitems::typeImage:
|
||||
return L"image";
|
||||
case _mediaitems::typeOleObject:
|
||||
case _mediaitems::typeObjectReplacement:
|
||||
return L"Object ";
|
||||
default:
|
||||
return L"media";
|
||||
}
|
||||
@ -66,11 +67,15 @@ std::wstring get_default_file_name(_mediaitems::Type type)
|
||||
std::wstring create_file_name(const std::wstring & uri, _mediaitems::Type type, size_t Num)
|
||||
{
|
||||
std::wstring sExt;
|
||||
int n = uri.rfind(L".");
|
||||
if (n>=0) sExt = uri.substr(n);
|
||||
//todooo проверить
|
||||
|
||||
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
|
||||
if (type == _mediaitems::typeOleObject &&
|
||||
type == _mediaitems::typeObjectReplacement)
|
||||
{
|
||||
int n = uri.rfind(L".");
|
||||
if (n >= 0) sExt = uri.substr(n);
|
||||
}
|
||||
|
||||
return get_default_file_name(type) + std::to_wstring(Num) + sExt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -77,8 +77,7 @@ namespace odf_writer
|
||||
{
|
||||
return boost::make_shared<simple_element>(FileName, Content, utf8);
|
||||
}
|
||||
|
||||
////////////
|
||||
//-------------------------------------------------------------------------------
|
||||
content_simple_ptr content_simple::create()
|
||||
{
|
||||
return boost::make_shared<content_simple>();
|
||||
@ -87,7 +86,7 @@ namespace odf_writer
|
||||
{
|
||||
return boost::make_shared<content_content>();
|
||||
}
|
||||
///////////////
|
||||
//-------------------------------------------------------------------------------
|
||||
void manifect_file::add_rels(rels & r)
|
||||
{
|
||||
std::vector<relationship> & rels = r.relationships();
|
||||
@ -174,23 +173,21 @@ namespace odf_writer
|
||||
simple_element elm(L"meta.xml", resStream.str());
|
||||
elm.write(RootPath);
|
||||
}
|
||||
///////////////////////////
|
||||
|
||||
media::media(_mediaitems & mediaitems) : mediaitems_(mediaitems)
|
||||
//-------------------------------------------------------------------------------
|
||||
media::media(_mediaitems & mediaitems, const std::wstring internal_folder, int type) : mediaitems_(mediaitems), type_(type), folder_(internal_folder)
|
||||
{
|
||||
}
|
||||
|
||||
void media::write(const std::wstring & RootPath)
|
||||
{
|
||||
if (mediaitems_.count_media < 1)return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Media";
|
||||
std::wstring path = RootPath + (folder_.empty() ? L"" : FILE_SEPARATOR_STR) + folder_;
|
||||
NSDirectory::CreateDirectory(path);
|
||||
|
||||
std::vector< _mediaitems::item > & items = mediaitems_.items();
|
||||
|
||||
for (size_t i = 0; i < items.size(); i++)
|
||||
{
|
||||
if (items[i].type == _mediaitems::typeMedia)
|
||||
if (items[i].type == type_)
|
||||
{
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
|
||||
|
||||
@ -198,49 +195,31 @@ namespace odf_writer
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
pictures::pictures(_mediaitems & mediaitems) : mediaitems_(mediaitems)
|
||||
{
|
||||
}
|
||||
|
||||
void pictures::write(const std::wstring & RootPath)//folder by content.xml
|
||||
{
|
||||
if (mediaitems_.count_image < 1 )return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Pictures";
|
||||
NSDirectory::CreateDirectory(path);
|
||||
|
||||
std::vector< _mediaitems::item > & items = mediaitems_.items();
|
||||
for (size_t i = 0; i < items.size(); i++)
|
||||
{
|
||||
if (items[i].type == _mediaitems::typeImage && items[i].oox_ref.length()>0)
|
||||
{
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].odf_ref;
|
||||
|
||||
try
|
||||
{
|
||||
NSFile::CFileBinary::Copy(items[i].oox_ref, file_name_out);
|
||||
}catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
void object_files::set_content(content_content_ptr & _content)
|
||||
{
|
||||
content_.set_content(_content);
|
||||
meta_ = element_ptr(new meta_file());
|
||||
}
|
||||
void object_files::set_media(_mediaitems & mediaitems)
|
||||
void object_files::set_mediaitems(_mediaitems & mediaitems)
|
||||
{
|
||||
media_ = element_ptr( new media(mediaitems) );
|
||||
}
|
||||
void object_files::set_pictures(_mediaitems & mediaitems)
|
||||
{
|
||||
pictures_ = element_ptr( new pictures(mediaitems) );
|
||||
if (mediaitems.count_image > 0)
|
||||
{
|
||||
pictures_ = element_ptr( new media(mediaitems, L"Picture", 1) );
|
||||
}
|
||||
if (mediaitems.count_media > 0)
|
||||
{
|
||||
media_ = element_ptr( new media(mediaitems, L"Media", 2) );
|
||||
}
|
||||
if (mediaitems.count_object > 0)
|
||||
{
|
||||
oleObjects_ = element_ptr( new media(mediaitems, L"", 3) );
|
||||
}
|
||||
if (mediaitems.count_object > 0)
|
||||
{
|
||||
imageObjects_ = element_ptr( new media(mediaitems, L"ObjectReplacements", 4) );
|
||||
}
|
||||
}
|
||||
void object_files::set_styles(content_simple_ptr & _content)
|
||||
{
|
||||
@ -258,8 +237,10 @@ namespace odf_writer
|
||||
|
||||
if (meta_) meta_->write(RootPath);
|
||||
|
||||
if (media_) media_->write(RootPath);
|
||||
if (pictures_) pictures_->write(RootPath);
|
||||
if (media_) media_->write(RootPath);
|
||||
if (pictures_) pictures_->write(RootPath);
|
||||
if (oleObjects_) oleObjects_->write(RootPath);
|
||||
if (imageObjects_) imageObjects_->write(RootPath);
|
||||
}
|
||||
|
||||
void odf_document::add_object(element_ptr _object, bool root)
|
||||
|
||||
@ -174,21 +174,13 @@ namespace odf_writer
|
||||
class media : public element
|
||||
{
|
||||
public:
|
||||
media(_mediaitems & mediaitems);
|
||||
media(_mediaitems & mediaitems, const std::wstring internal_folder, int type);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
_mediaitems & mediaitems_;
|
||||
|
||||
};
|
||||
class pictures : public element
|
||||
{
|
||||
public:
|
||||
pictures(_mediaitems & mediaitems);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
_mediaitems & mediaitems_;
|
||||
_mediaitems& mediaitems_;
|
||||
int type_;
|
||||
std::wstring folder_;
|
||||
|
||||
};
|
||||
class object_files : public element
|
||||
@ -201,8 +193,7 @@ namespace odf_writer
|
||||
void set_styles (content_simple_ptr & _styles);
|
||||
void set_settings (content_simple_ptr & _settings);
|
||||
|
||||
void set_media (_mediaitems & mediaitems);
|
||||
void set_pictures (_mediaitems & mediaitems);
|
||||
void set_mediaitems (_mediaitems & mediaitems);
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
@ -212,16 +203,18 @@ namespace odf_writer
|
||||
styles_file styles_;
|
||||
|
||||
element_ptr meta_;
|
||||
|
||||
element_ptr media_;
|
||||
element_ptr pictures_;
|
||||
};
|
||||
|
||||
element_ptr oleObjects_;
|
||||
element_ptr imageObjects_;
|
||||
};
|
||||
class odf_document : public element
|
||||
{
|
||||
public:
|
||||
odf_document(std::wstring type);
|
||||
|
||||
void add_object(element_ptr _object,bool root=false);
|
||||
void add_object(element_ptr _object,bool root = false);
|
||||
|
||||
void set_rels(rels & r);
|
||||
|
||||
|
||||
@ -150,13 +150,12 @@ void odf_conversion_context::end_document()
|
||||
{
|
||||
object_files->set_content (content_root_);
|
||||
object_files->set_styles (content_style_);
|
||||
object_files->set_media (object.mediaitems);
|
||||
object_files->set_pictures (object.mediaitems);
|
||||
object_files->set_mediaitems(object.mediaitems);
|
||||
object_files->set_settings (content_settings_);
|
||||
|
||||
if (!isRoot)object_files->local_path = object.name + L"/";
|
||||
|
||||
object.mediaitems.dump_rels(rels_,object_files->local_path);
|
||||
object.mediaitems.dump_rels(rels_, object_files->local_path);
|
||||
|
||||
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"styles.xml"));
|
||||
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"content.xml"));
|
||||
@ -311,6 +310,24 @@ std::wstring odf_conversion_context::add_media(const std::wstring & file_name)
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
std::wstring odf_conversion_context::add_imageobject(const std::wstring & file_name)
|
||||
{
|
||||
if (file_name.empty()) return L"";
|
||||
|
||||
std::wstring odf_ref_name ;
|
||||
mediaitems()->add_or_find(file_name,_mediaitems::typeObjectReplacement, odf_ref_name);
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
std::wstring odf_conversion_context::add_oleobject(const std::wstring & file_name)
|
||||
{
|
||||
if (file_name.empty()) return L"";
|
||||
|
||||
std::wstring odf_ref_name ;
|
||||
mediaitems()->add_or_find(file_name,_mediaitems::typeOleObject, odf_ref_name);
|
||||
|
||||
return odf_ref_name;
|
||||
}
|
||||
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
|
||||
{
|
||||
if (!temporary_.elm) return;
|
||||
|
||||
@ -96,8 +96,10 @@ public:
|
||||
virtual void start_text_context() = 0;
|
||||
virtual void end_text_context() = 0;
|
||||
|
||||
std::wstring add_image(const std::wstring & image_file_name);
|
||||
std::wstring add_media(const std::wstring & file_name);
|
||||
std::wstring add_image (const std::wstring & image_file_name);
|
||||
std::wstring add_media (const std::wstring & file_name);
|
||||
std::wstring add_oleobject (const std::wstring & ole_file_name);
|
||||
std::wstring add_imageobject(const std::wstring & ole_file_name);
|
||||
|
||||
virtual odf_style_context * styles_context();
|
||||
|
||||
|
||||
@ -222,6 +222,7 @@ struct odf_drawing_state
|
||||
_CP_OPT(presentation_class) presentation_class_;
|
||||
_CP_OPT(std::wstring) presentation_placeholder_;
|
||||
|
||||
std::wstring program_;
|
||||
std::wstring replacement_;
|
||||
std::wstring path_;
|
||||
std::wstring view_box_;
|
||||
@ -2655,6 +2656,10 @@ void odf_drawing_context::start_object_ole(std::wstring ref)
|
||||
{
|
||||
start_frame();
|
||||
|
||||
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
|
||||
impl_->current_graphic_properties->draw_stroke_ = line_style(line_style::None);
|
||||
impl_->current_graphic_properties->draw_ole_draw_aspect_ = 1;
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
office_element_ptr object_elm;
|
||||
create_element(L"draw", L"object-ole", object_elm, impl_->odf_context_);
|
||||
|
||||
@ -2682,6 +2687,11 @@ void odf_drawing_context::set_image_replacement(std::wstring ref)
|
||||
impl_->current_drawing_state_.replacement_ = ref;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_program(std::wstring program)
|
||||
{
|
||||
impl_->current_drawing_state_.program_ = program;
|
||||
}
|
||||
|
||||
bool odf_drawing_context::is_exist_content()
|
||||
{
|
||||
return (impl_->drawing_list_.empty() ? false : true);
|
||||
|
||||
@ -153,6 +153,8 @@ public:
|
||||
void add_image_replacement();
|
||||
void set_image_replacement(std::wstring ref);
|
||||
|
||||
void set_program(std::wstring program);
|
||||
|
||||
bool isLineShape();
|
||||
void corrected_line_fill();
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ namespace utils
|
||||
|
||||
void calculate_size_font_symbols(_font_metrix & metrix, CApplicationFonts *appFonts)
|
||||
{
|
||||
double appr_px = _graphics_utils_::calculate_size_symbol_asc(metrix.font_name,metrix.font_size,metrix.italic,metrix.bold, appFonts);
|
||||
double appr_px = _graphics_utils_::calculate_size_symbol_asc(metrix.font_name, metrix.font_size, metrix.italic, metrix.bold, appFonts);
|
||||
|
||||
if (appr_px <0.01)
|
||||
{
|
||||
@ -357,12 +357,15 @@ void ods_conversion_context::end_cell()
|
||||
}
|
||||
void ods_conversion_context::calculate_font_metrix(std::wstring name, double size, bool italic, bool bold)
|
||||
{
|
||||
if (font_metrix_.IsCalc)return;
|
||||
if (font_metrix_.IsCalc) return;
|
||||
|
||||
font_metrix_.font_size = size;
|
||||
font_metrix_.italic = italic;
|
||||
font_metrix_.bold = bold;
|
||||
font_metrix_.font_name = name;
|
||||
if (size < 1)
|
||||
size = 12;
|
||||
|
||||
font_metrix_.font_size = size;
|
||||
font_metrix_.italic = italic;
|
||||
font_metrix_.bold = bold;
|
||||
font_metrix_.font_name = name;
|
||||
|
||||
////////////////////////////////////////////
|
||||
utils::calculate_size_font_symbols(font_metrix_, applicationFonts_);
|
||||
|
||||
@ -69,7 +69,7 @@ public:
|
||||
void add_column(int start_column, int repeated, int level = 0, bool _default = false);
|
||||
void end_columns();
|
||||
|
||||
void calculate_font_metrix(std::wstring name, double size, bool italic, bool bold);
|
||||
void calculate_font_metrix(std::wstring name, double size, bool italic, bool bold);
|
||||
|
||||
void start_rows();
|
||||
void start_row(int _start_row, int repeated, int level = 0, bool _default = false);
|
||||
|
||||
@ -62,7 +62,9 @@ void graphic_format_properties::apply_from(const graphic_format_properties & Oth
|
||||
_CP_APPLY_PROP2(draw_auto_grow_width_);
|
||||
_CP_APPLY_PROP2(draw_fit_to_size_);
|
||||
_CP_APPLY_PROP2(draw_fit_to_contour_);
|
||||
|
||||
_CP_APPLY_PROP2(draw_wrap_influence_on_position_);
|
||||
_CP_APPLY_PROP2(draw_ole_draw_aspect_);
|
||||
|
||||
_CP_APPLY_PROP2(svg_stroke_color_);
|
||||
_CP_APPLY_PROP2(svg_stroke_width_);
|
||||
_CP_APPLY_PROP2(svg_stroke_opacity_);
|
||||
@ -86,7 +88,6 @@ void graphic_format_properties::apply_from(const graphic_format_properties & Oth
|
||||
_CP_APPLY_PROP2(style_overflow_behavior_);
|
||||
_CP_APPLY_PROP2(style_mirror_);
|
||||
_CP_APPLY_PROP2(fo_clip_);
|
||||
_CP_APPLY_PROP2(draw_wrap_influence_on_position_);
|
||||
|
||||
common_draw_fill_attlist_.apply_from(Other.common_draw_fill_attlist_);
|
||||
common_draw_rel_size_attlist_.apply_from(Other.common_draw_rel_size_attlist_);
|
||||
@ -123,6 +124,7 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
|
||||
CP_XML_ATTR_OPT(L"draw:auto-grow-width", draw_auto_grow_width_);
|
||||
CP_XML_ATTR_OPT(L"draw:fit-to-size", draw_fit_to_size_);
|
||||
CP_XML_ATTR_OPT(L"draw:fit-to-contour", draw_fit_to_contour_);
|
||||
CP_XML_ATTR_OPT(L"draw:ole-draw-aspect", draw_ole_draw_aspect_);
|
||||
|
||||
CP_XML_ATTR_OPT(L"draw:stroke", draw_stroke_);
|
||||
CP_XML_ATTR_OPT(L"draw:stroke-dash", draw_stroke_dash_);
|
||||
|
||||
@ -103,7 +103,8 @@ public:
|
||||
_CP_OPT(odf_types::color) draw_shadow_color_;
|
||||
_CP_OPT(odf_types::length) draw_shadow_offset_y_;
|
||||
_CP_OPT(odf_types::length) draw_shadow_offset_x_;
|
||||
|
||||
_CP_OPT(unsigned int) draw_ole_draw_aspect_;
|
||||
|
||||
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
|
||||
odf_types::common_draw_rel_size_attlist common_draw_rel_size_attlist_;
|
||||
|
||||
@ -143,8 +144,8 @@ public:
|
||||
_CP_OPT(std::wstring) style_mirror_;
|
||||
|
||||
_CP_OPT(std::wstring) fo_clip_;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
office_element_ptr style_background_image_;
|
||||
//-------------------------------------------------------------------------------------
|
||||
office_element_ptr style_background_image_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -203,25 +203,25 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
std::wstring odf_ref_image;
|
||||
bool bEmbedded = true;
|
||||
std::wstring pathImage;
|
||||
if (oox_picture->blipFill.blip.IsInit())
|
||||
{
|
||||
bool bEmbedded = true;
|
||||
if (oox_picture->blipFill.blip->embed.IsInit())
|
||||
{
|
||||
std::wstring sID = oox_picture->blipFill.blip->embed->get();
|
||||
pathImage = find_link_by_id(sID, 1);
|
||||
|
||||
odf_ref_image = odf_context()->add_image(pathImage);
|
||||
}
|
||||
else if (oox_picture->blipFill.blip->link.IsInit())
|
||||
{
|
||||
odf_ref_image = oox_picture->blipFill.blip->link->get();
|
||||
pathImage = oox_picture->blipFill.blip->link->get();
|
||||
bEmbedded = false;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
std::wstring odf_ref_image;
|
||||
|
||||
if (oox_picture->nvPicPr.nvPr.media.is_init())
|
||||
{
|
||||
if (oox_picture->nvPicPr.nvPr.media.is<PPTX::Logic::MediaFile>())
|
||||
@ -238,7 +238,7 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
PPTX::Logic::Ext & ext = oox_picture->nvPicPr.nvPr.extLst[i];
|
||||
if (pathMedia.empty() && ext.link.IsInit())
|
||||
{
|
||||
pathMedia= find_link_by_id(ext.link->get(), 3);
|
||||
pathMedia = find_link_by_id(ext.link->get(), 3);
|
||||
//например файлики mp3
|
||||
}
|
||||
if (ext.st.IsInit()) start = *ext.st;
|
||||
@ -255,6 +255,7 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
|
||||
OoxConverter::convert(&oox_picture->spPr, oox_picture->style.GetPointer());
|
||||
|
||||
odf_ref_image = bEmbedded ? odf_context()->add_image(pathImage) : pathImage;
|
||||
odf_context()->drawing_context()->set_image_replacement(odf_ref_image);
|
||||
|
||||
odf_context()->drawing_context()->end_media();
|
||||
@ -265,15 +266,32 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
}
|
||||
if (oox_picture->oleObject.IsInit())
|
||||
{
|
||||
//nullable_limit<Limit::OLEDrawAspectType>m_oDrawAspect;
|
||||
//nullable<OOX::RId> m_oId;
|
||||
//nullable_string m_sObjectId;
|
||||
//nullable_string m_sProgId;
|
||||
//nullable_string m_sShapeId;
|
||||
//nullable_limit<Limit::OLEType> m_oType;
|
||||
//nullable_limit<Limit::OLEUpdateMode> m_oUpdateMode;
|
||||
std::wstring pathOle;
|
||||
|
||||
if (oox_picture->oleObject->m_oId.IsInit())
|
||||
{
|
||||
pathOle = find_link_by_id(oox_picture->oleObject->m_oId->get(), 4);
|
||||
}
|
||||
std::wstring odf_ref_ole = odf_context()->add_oleobject(pathOle);
|
||||
|
||||
if (!odf_ref_ole.empty())
|
||||
{
|
||||
odf_context()->drawing_context()->start_object_ole(odf_ref_ole);
|
||||
|
||||
if (oox_picture->oleObject->m_sProgId.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->set_program(*oox_picture->oleObject->m_sProgId);
|
||||
}
|
||||
odf_ref_image = bEmbedded ? odf_context()->add_imageobject(pathImage) : pathImage;
|
||||
odf_context()->drawing_context()->set_image_replacement(odf_ref_image);
|
||||
|
||||
odf_context()->drawing_context()->end_object_ole();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
odf_ref_image = bEmbedded ? odf_context()->add_image(pathImage) : pathImage;
|
||||
|
||||
odf_context()->drawing_context()->start_image(odf_ref_image);
|
||||
{
|
||||
double Width = 0, Height = 0;
|
||||
|
||||
@ -328,6 +328,13 @@ std::wstring OoxConverter::find_link_by (smart_ptr<OOX::File> & oFile, int type)
|
||||
if (pMedia)
|
||||
ref = pMedia->filename().GetPath();
|
||||
}
|
||||
if (type == 4)
|
||||
{
|
||||
OOX::OleObject* pOleObject = dynamic_cast<OOX::OleObject*>(oFile.operator->());
|
||||
|
||||
if (pOleObject)
|
||||
ref = pOleObject->filename().GetPath();
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
||||
@ -3150,7 +3150,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
int id = oox_num_lvl->m_oLvlPicBulletId->m_oVal->GetValue();
|
||||
OOX::CNumbering * lists_styles = docx_document->GetNumbering();
|
||||
|
||||
for (size_t i = 0; (lists_styles) && (i< lists_styles->m_arrNumPicBullet.size()); i++)
|
||||
for (size_t i = 0; (lists_styles) && (i < lists_styles->m_arrNumPicBullet.size()); i++)
|
||||
{
|
||||
if ((lists_styles->m_arrNumPicBullet[i]) && (lists_styles->m_arrNumPicBullet[i]->m_oNumPicBulletId.GetValue() == id))
|
||||
{
|
||||
|
||||
@ -295,17 +295,20 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
{
|
||||
OOX::Spreadsheet::CDrawing* pDrawing = (OOX::Spreadsheet::CDrawing*)oFile.operator->();
|
||||
|
||||
convert(pDrawing);
|
||||
convert(pDrawing, oox_sheet);
|
||||
}
|
||||
}
|
||||
////сортировки
|
||||
|
||||
convert(oox_sheet->m_oOleObjects.GetPointer(), oox_sheet);
|
||||
|
||||
//сортировки
|
||||
//convert(oox_sheet->m_oSortState.GetPointer());
|
||||
|
||||
//автофильтры
|
||||
convert(oox_sheet->m_oAutofilter.GetPointer());
|
||||
|
||||
//условное форматирование
|
||||
if (oox_sheet->m_arrConditionalFormatting.size() >0)
|
||||
if (!oox_sheet->m_arrConditionalFormatting.empty() )
|
||||
{
|
||||
ods_context->start_conditional_formats();
|
||||
for (size_t fmt =0; fmt < oox_sheet->m_arrConditionalFormatting.size(); fmt++)
|
||||
@ -1232,7 +1235,7 @@ void XlsxConverter::convert_styles()
|
||||
|
||||
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf_writer::style_text_properties * text_properties)
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CFont *font, odf_writer::style_text_properties *text_properties)
|
||||
{
|
||||
if (font == NULL)return;
|
||||
if (text_properties == NULL)return;
|
||||
@ -1271,7 +1274,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf_writer::style_te
|
||||
}
|
||||
}
|
||||
}
|
||||
if (font->m_oItalic.IsInit() && (font->m_oItalic->m_oVal.ToBool() ==true))font_italic = true;
|
||||
if (font->m_oItalic.IsInit() && (font->m_oItalic->m_oVal.ToBool() ==true)) font_italic = true;
|
||||
|
||||
if (font_italic) text_properties->content_.fo_font_style_ = odf_types::font_style(odf_types::font_style::Italic);
|
||||
else text_properties->content_.fo_font_style_ = odf_types::font_style(odf_types::font_style::Normal);
|
||||
@ -1322,7 +1325,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf_writer::style_te
|
||||
if ((font->m_oStrike.IsInit()) && (font->m_oStrike->m_oVal.ToBool()))
|
||||
text_properties->content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::Single);
|
||||
|
||||
ods_context->calculate_font_metrix(font_name,font_size,font_italic,font_bold);
|
||||
ods_context->calculate_font_metrix(font_name, font_size, font_italic, font_bold);
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(double oox_size, _CP_OPT(odf_types::length) & odf_size)
|
||||
@ -1818,7 +1821,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
|
||||
{
|
||||
if (!oox_anchor) return;
|
||||
|
||||
if (oox_anchor->m_bShapeOle) return;
|
||||
//////////////////
|
||||
if (oox_anchor->m_oFrom.IsInit() || oox_anchor->m_oTo.IsInit())
|
||||
{
|
||||
@ -1859,22 +1861,107 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCellAnchor *oox_anchor)
|
||||
odf_context()->drawing_context()->end_drawing();
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing, OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
{
|
||||
if (!oox_drawing)return;
|
||||
|
||||
OOX::IFileContainer* old_container = xlsx_current_container;
|
||||
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_drawing);
|
||||
|
||||
for (size_t dr = 0 ; dr < oox_drawing->m_arrItems.size(); dr++)
|
||||
for (size_t i = 0; i < oox_drawing->m_arrItems.size(); i++)
|
||||
{
|
||||
OOX::Spreadsheet::CCellAnchor * oox_anchor = oox_drawing->m_arrItems[i];
|
||||
|
||||
if (oox_anchor->m_bShapeOle) continue;
|
||||
|
||||
if (oox_sheet->m_oOleObjects.IsInit() && oox_anchor->m_nId.IsInit())
|
||||
{
|
||||
std::map<int, OOX::Spreadsheet::COleObject*>::const_iterator pFind = oox_sheet->m_oOleObjects->m_mapOleObjects.find(oox_anchor->m_nId.get());
|
||||
if (pFind != oox_sheet->m_oOleObjects->m_mapOleObjects.end())
|
||||
{
|
||||
//??? перенести даные привязки
|
||||
oox_anchor->m_bShapeOle = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ods_context->start_drawings();
|
||||
convert(oox_drawing->m_arrItems[dr]);
|
||||
convert(oox_anchor);
|
||||
ods_context->end_drawings();
|
||||
}
|
||||
|
||||
xlsx_current_container = old_container;
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::COleObjects *oox_objects, OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
{
|
||||
if (!oox_objects) return;
|
||||
|
||||
for (std::map<int, OOX::Spreadsheet::COleObject*>::const_iterator it = oox_objects->m_mapOleObjects.begin(); it != oox_objects->m_mapOleObjects.end(); ++it)
|
||||
{
|
||||
OOX::Spreadsheet::COleObject* object = it->second;
|
||||
ods_context->start_drawings();
|
||||
|
||||
bool bAnchor = false;
|
||||
std::wstring odf_ref_object, odf_ref_image;
|
||||
if (object->m_oObjectPr.IsInit())
|
||||
{
|
||||
if (object->m_oObjectPr->m_oAnchor.IsInit())
|
||||
{
|
||||
bAnchor = true;
|
||||
oox_table_position from = {}, to = {};
|
||||
|
||||
convert(object->m_oObjectPr->m_oAnchor->m_oFrom.GetPointer(), &from);
|
||||
convert(object->m_oObjectPr->m_oAnchor->m_oTo.GetPointer(), &to);
|
||||
|
||||
double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
|
||||
ods_context->current_table().convert_position(from, x1, y1);
|
||||
ods_context->current_table().convert_position(to, x2, y2);
|
||||
|
||||
ods_context->drawing_context()->set_drawings_rect(x1, y1, x2 - x1, y2 - y1);
|
||||
}
|
||||
}
|
||||
if (object->m_oRid.IsInit())
|
||||
{
|
||||
std::wstring pathOle;
|
||||
|
||||
std::wstring sID = object->m_oRid->GetValue();
|
||||
pathOle = find_link_by_id(sID, 4);
|
||||
|
||||
odf_ref_object = odf_context()->add_oleobject(pathOle);
|
||||
}
|
||||
if ((object->m_oObjectPr.IsInit()) && (object->m_oObjectPr->m_oRid.IsInit()))
|
||||
{
|
||||
std::wstring pathImage;
|
||||
|
||||
std::wstring sID = object->m_oObjectPr->m_oRid->GetValue();
|
||||
pathImage = find_link_by_id(sID, 1);
|
||||
|
||||
odf_ref_image = odf_context()->add_imageobject(pathImage);
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
if (!bAnchor || odf_ref_image.empty())
|
||||
{
|
||||
//from vml drawing or oox drawing
|
||||
//m_oShapeId;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ods_context->drawing_context()->start_drawing();
|
||||
|
||||
ods_context->drawing_context()->start_object_ole(odf_ref_object);
|
||||
|
||||
ods_context->drawing_context()->set_image_replacement(odf_ref_image);
|
||||
|
||||
if (object->m_oProgId.IsInit())
|
||||
{
|
||||
ods_context->drawing_context()->set_program(*object->m_oProgId);
|
||||
}
|
||||
|
||||
ods_context->drawing_context()->end_object_ole();
|
||||
ods_context->drawing_context()->end_drawing();
|
||||
|
||||
ods_context->end_drawings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_position * pos)
|
||||
|
||||
@ -47,7 +47,6 @@ namespace OOX
|
||||
class WritingElement;
|
||||
|
||||
class CWorksheet;
|
||||
class CDrawing;
|
||||
class CTable;
|
||||
class CCol;
|
||||
class CRow;
|
||||
@ -69,8 +68,9 @@ namespace OOX
|
||||
class CDxf;
|
||||
class CCellStyle;
|
||||
class CNumFmt;
|
||||
class CCellAnchor;
|
||||
class COleObjects;
|
||||
class CDrawing;
|
||||
class CCellAnchor;
|
||||
class CFromTo;
|
||||
class CCommentItem;
|
||||
class CDefinedName;
|
||||
@ -182,18 +182,19 @@ namespace Oox2Odf
|
||||
void convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::color) & odf_color);
|
||||
void convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf_types::background_color) & odf_bckgrd_color);
|
||||
void convert(OOX::Spreadsheet::CBorderProp *borderProp, std::wstring & odf_border_prop);
|
||||
void convert(OOX::Spreadsheet::CAligment *aligment, odf_writer::style_paragraph_properties * paragraph_properties,
|
||||
odf_writer::style_table_cell_properties * cell_properties);
|
||||
void convert(OOX::Spreadsheet::CAligment *aligment, odf_writer::style_paragraph_properties *paragraph_properties,
|
||||
odf_writer::style_table_cell_properties *cell_properties);
|
||||
|
||||
void convert(OOX::Spreadsheet::CXfs *cell_style, int oox_id, bool automatic=true, bool root = false);
|
||||
void convert(OOX::Spreadsheet::CXfs *cell_style, int oox_id, bool automatic = true, bool root = false);
|
||||
void convert(OOX::Spreadsheet::CCellStyle *cell_style);
|
||||
void convert(OOX::Spreadsheet::CNumFmt *numFmt);
|
||||
void convert(OOX::Spreadsheet::CDxf *dxFmt, int oox_id);
|
||||
|
||||
void convert(OOX::Spreadsheet::CCellAnchor *oox_anchor);
|
||||
void convert(OOX::Spreadsheet::CDrawing *oox_drawing);
|
||||
void convert(OOX::Spreadsheet::CDrawing *oox_drawing, OOX::Spreadsheet::CWorksheet *oox_sheet);
|
||||
void convert(OOX::Spreadsheet::COleObjects *oox_objects, OOX::Spreadsheet::CWorksheet *oox_sheet);
|
||||
|
||||
void convert(OOX::Spreadsheet::CFromTo *oox_from_to, oox_table_position * pos);
|
||||
void convert(OOX::Spreadsheet::CFromTo *oox_from_to, oox_table_position *pos);
|
||||
|
||||
void convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt);
|
||||
void convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_cond_rule);
|
||||
|
||||
@ -99,7 +99,7 @@ namespace PPTX
|
||||
ext.fromXML(oReader);
|
||||
if (ext.spid.IsInit())
|
||||
{
|
||||
oleSpid = ext.spid;
|
||||
vmlSpid = ext.spid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ namespace PPTX
|
||||
ext.fromXML(oNode);
|
||||
if (ext.spid.IsInit())
|
||||
{
|
||||
oleSpid = ext.spid;
|
||||
vmlSpid = ext.spid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ namespace PPTX
|
||||
nullable<Hyperlink> hlinkHover;
|
||||
|
||||
//std::vector<Ext> extLst;
|
||||
nullable_string oleSpid;
|
||||
nullable_string vmlSpid;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -112,7 +112,7 @@ namespace PPTX
|
||||
void GraphicFrame::ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), oleSpid )
|
||||
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), vmlSpid )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
void GraphicFrame::fromXML2(XmlUtils::CXmlLiteReader& oReader)
|
||||
@ -293,7 +293,7 @@ namespace PPTX
|
||||
}
|
||||
else if (L"legacyDrawing" == strName)
|
||||
{
|
||||
oNode.ReadAttributeBase(L"spid", oleSpid);
|
||||
oNode.ReadAttributeBase(L"spid", vmlSpid);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@ -377,7 +377,7 @@ namespace PPTX
|
||||
|
||||
bool GraphicFrame::IsEmpty() const
|
||||
{
|
||||
return !olePic.is_init() && !smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !oleSpid.is_init() && !element.is_init();
|
||||
return !olePic.is_init() && !smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !vmlSpid.is_init() && !element.is_init();
|
||||
}
|
||||
|
||||
void GraphicFrame::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
@ -394,12 +394,12 @@ namespace PPTX
|
||||
std::wstring xml_object_vml;
|
||||
smart_ptr<OOX::IFileContainer> xml_object_rels;
|
||||
|
||||
if (oleSpid.is_init())
|
||||
if (vmlSpid.is_init())
|
||||
{
|
||||
xml_object_vml = GetVmlXmlBySpid(xml_object_rels);
|
||||
}
|
||||
|
||||
if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !oleSpid.is_init())
|
||||
if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !vmlSpid.is_init())
|
||||
{
|
||||
smartArt->LoadDrawing(pWriter);
|
||||
|
||||
@ -482,7 +482,7 @@ namespace PPTX
|
||||
pWriter->StartRecord(SPTREE_TYPE_GRFRAME);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteString2(0, oleSpid);
|
||||
pWriter->WriteString2(0, vmlSpid);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecord1(0, nvGraphicFramePr);
|
||||
@ -523,7 +523,7 @@ namespace PPTX
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
oleSpid = pReader->GetString2();
|
||||
vmlSpid = pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -640,17 +640,17 @@ namespace PPTX
|
||||
std::wstring xml;
|
||||
if(parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(vmlSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::Slide>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideLayout>() && parentFileAs<PPTX::SlideLayout>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
xml = parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(vmlSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::SlideLayout>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
else if(parentFileIs<PPTX::SlideMaster>() && parentFileAs<PPTX::SlideMaster>().Vml.IsInit())
|
||||
{
|
||||
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
|
||||
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(vmlSpid.get_value_or(L""));
|
||||
rels = parentFileAs<PPTX::SlideMaster>().Vml.smart_dynamic_cast<OOX::IFileContainer>();
|
||||
}
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ namespace PPTX
|
||||
|
||||
nullable<Xfrm> xfrm;
|
||||
|
||||
nullable_string oleSpid;
|
||||
nullable_string vmlSpid;
|
||||
nullable<Pic> olePic;
|
||||
|
||||
nullable<Table> table;
|
||||
|
||||
@ -97,7 +97,7 @@ CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode m
|
||||
Open(file_path, mode);
|
||||
}
|
||||
|
||||
void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot)
|
||||
void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOut, bool bWithRoot)
|
||||
{
|
||||
POLE::Stream *stream = new POLE::Stream(storage_, streamName);
|
||||
if (!stream) return;
|
||||
@ -105,7 +105,7 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
|
||||
stream->seek(0);
|
||||
int size_stream = stream->size();
|
||||
|
||||
if (withRoot == false)
|
||||
if (bWithRoot == false)
|
||||
{
|
||||
int pos = streamName.find("/");
|
||||
if (pos >= 0)
|
||||
@ -132,9 +132,9 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
|
||||
delete stream;
|
||||
}
|
||||
|
||||
void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot)
|
||||
void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool bWithRoot, bool bSortFiles)
|
||||
{
|
||||
std::list<std::string> entries, entries_sort;
|
||||
std::list<std::string> entries, entries_files, entries_dir;
|
||||
entries = storage_->entries( path );
|
||||
|
||||
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
@ -144,27 +144,29 @@ void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOu
|
||||
|
||||
if( storage_->isDirectory( fullname ) )
|
||||
{
|
||||
entries_sort.push_back(name);
|
||||
entries_dir.push_back(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
entries_sort.push_front(name);
|
||||
entries_files.push_front(name);
|
||||
}
|
||||
}
|
||||
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
|
||||
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
|
||||
for( std::list<std::string>::iterator it = entries_dir.begin(); it != entries_dir.end(); it++ )
|
||||
{
|
||||
std::string name = *it;
|
||||
std::string fullname = path + name;
|
||||
std::string fullname = path + *it;
|
||||
|
||||
if( storage_->isDirectory( fullname ) )
|
||||
{
|
||||
copy( indent + 1, fullname + "/", storageOut, withRoot );
|
||||
}
|
||||
else
|
||||
{
|
||||
copy_stream(fullname, storageOut, withRoot);
|
||||
}
|
||||
copy( indent + 1, fullname + "/", storageOut, bWithRoot, bSortFiles );
|
||||
}
|
||||
if (bSortFiles)
|
||||
{
|
||||
entries_files.sort();
|
||||
//todooo ??? со спецсимволами выше
|
||||
}
|
||||
for( std::list<std::string>::iterator it = entries_files.begin(); it != entries_files.end(); it++ )
|
||||
{
|
||||
std::string fullname = path + *it;
|
||||
|
||||
copy_stream(fullname, storageOut, bWithRoot);
|
||||
}
|
||||
}
|
||||
CFStreamPtr CompoundFile::getWorkbookStream()
|
||||
|
||||
@ -58,14 +58,14 @@ public:
|
||||
|
||||
bool isError();
|
||||
|
||||
void copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot = true);
|
||||
void copy( int indent, std::string path, POLE::Storage * storageOut, bool bWithRoot = true, bool bSortFiles = false);
|
||||
|
||||
CFStreamPtr getWorkbookStream ();
|
||||
CFStreamPtr getNamedStream (const std::string& name);
|
||||
|
||||
POLE::Storage *storage_;
|
||||
private:
|
||||
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot = true);
|
||||
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool bWithRoot = true);
|
||||
|
||||
POLE::Stream* openStream (const std::string & stream_name); // Opens a stream in the storage (shall be called not more than once per stream)
|
||||
POLE::Stream* createStream (const std::string & stream_name); // Creates a new stream in the storage
|
||||
@ -73,7 +73,6 @@ private:
|
||||
CFStreamPtr createNamedStream (const std::string& name);
|
||||
void closeNamedStream (const std::string& name);
|
||||
|
||||
private:
|
||||
std::map<std::string, CFStreamPtr> streams;
|
||||
ReadWriteMode rwMode;
|
||||
};
|
||||
|
||||
@ -72,7 +72,9 @@ void Style::readFields(CFRecord& record)
|
||||
user = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
record >> user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,8 +41,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of StyleExt record in BIFF8
|
||||
class StyleExt: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(StyleExt)
|
||||
@ -53,10 +51,9 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeStyleExt;
|
||||
static const ElementType type = typeStyleExt;
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
|
||||
@ -93,10 +93,14 @@ void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
|
||||
std::wstring link = global_info->arXti[ixti].link;
|
||||
std::wstring name;
|
||||
|
||||
if (global_info->arXti[ixti].pNames && nameindex > 0)
|
||||
if ((global_info->arXti[ixti].pNames) && (nameindex > 0 && nameindex <= global_info->arXti[ixti].pNames->size()))
|
||||
{
|
||||
name = global_info->arXti[ixti].pNames->at(nameindex - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = global_info->arDefineNames[nameindex - 1];
|
||||
}
|
||||
if (!link.empty() && !name.empty())
|
||||
{
|
||||
ptg_stack.push(link + L"!" + name);
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
|
||||
#include "../Biff_records/Style.h"
|
||||
#include "../Biff_records/StyleExt.h"
|
||||
#include "../../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -137,7 +138,13 @@ int STYLES::serialize(std::wostream & stream)
|
||||
}
|
||||
else if (style)
|
||||
{
|
||||
CP_XML_ATTR(L"name", style->user.value());
|
||||
std::wstring name = style->user.value();
|
||||
|
||||
XmlUtils::replace_all(name, L"\x01", L"_x0001_");
|
||||
XmlUtils::replace_all(name, L"\x0d", L"_x000d_");
|
||||
XmlUtils::replace_all(name, L"\x0a", L"_x000a_");
|
||||
|
||||
CP_XML_ATTR(L"name", name);
|
||||
|
||||
if (style->fBuiltIn)
|
||||
{
|
||||
|
||||
@ -101,9 +101,10 @@ const bool XFS::loadContent(BinProcessor& proc)
|
||||
|
||||
if(proc.optional<XFCRC>())
|
||||
{
|
||||
elements_.pop_back(); // Crc не нужен
|
||||
m_XFCRC = elements_.back(); elements_.pop_back();
|
||||
XFCRC* crc = dynamic_cast<XFCRC*>(m_XFCRC.get());
|
||||
|
||||
count = proc.repeated<XFExt>(16, 4050);
|
||||
count = proc.repeated<XFExt>(0/*16*/, 4050); // 074_JKH.OPEN.INFO.PRICE.VO_зПТПДУЛЙЕ ПЛТХЗБ юЕМСВЙОУЛПК ПВМ ...
|
||||
while (count > 0)
|
||||
{
|
||||
if (elements_.empty()) break;
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of XFS union of records
|
||||
class XFS: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(XFS)
|
||||
@ -62,6 +60,7 @@ public:
|
||||
std::vector<BaseObjectPtr> m_arCellStyles;
|
||||
std::vector<BaseObjectPtr> m_arXFext;
|
||||
|
||||
BaseObjectPtr m_XFCRC;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -1933,71 +1933,68 @@ void XlsConverter::convert(XLS::TxO * text_obj)
|
||||
|
||||
void XlsConverter::convert(XLS::Obj * obj)
|
||||
{
|
||||
if (obj == NULL) return;
|
||||
if ( obj == NULL ) return;
|
||||
|
||||
//controls & objects
|
||||
if (!obj->pictFlags.fExist || !obj->pictFmla.fExist || obj->cmo.ot != 8) return;
|
||||
|
||||
std::wstring link_cell, fill_range, fmla, info;
|
||||
if (obj->pictFmla.fmla.bFmlaExist)
|
||||
if ( obj->cmo.ot == 8 && obj->pictFmla.fExist && obj->pictFlags.fExist)
|
||||
{
|
||||
fmla = obj->pictFmla.fmla.fmla.getAssembledFormula();
|
||||
if (obj->pictFmla.fmla.bInfoExist)
|
||||
info = obj->pictFmla.fmla.embedInfo.strClass.value();
|
||||
}
|
||||
if (obj->pictFmla.key.fmlaLinkedCell.bFmlaExist)
|
||||
{
|
||||
link_cell = obj->pictFmla.key.fmlaLinkedCell.fmla.getAssembledFormula();
|
||||
|
||||
}
|
||||
if (obj->pictFmla.key.fmlaListFillRange.bFmlaExist)
|
||||
{
|
||||
fill_range = obj->pictFmla.key.fmlaListFillRange.fmla.getAssembledFormula();
|
||||
}
|
||||
|
||||
if (obj->pictFlags.fCtl && obj->pictFlags.fPrstm)//Controls Storage
|
||||
{
|
||||
xlsx_context->get_mediaitems().create_activeX_path(xlsx_path);
|
||||
|
||||
int id = ++xlsx_context->get_mediaitems().count_activeX;
|
||||
std::wstring file_name = xlsx_context->get_mediaitems().activeX_path() + L"activeX" + std::to_wstring(id) + L".bin";
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
if ( file.CreateFileW(file_name) )
|
||||
{
|
||||
file.WriteFile(xls_global_info->controls_data.first.get() + obj->pictFmla.lPosInCtlStm, obj->pictFmla.cbBufInCtlStm);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
else if (!obj->pictFlags.fPrstm)
|
||||
{
|
||||
std::string object_stream;
|
||||
if (obj->pictFlags.fDde) object_stream = "LNK";
|
||||
else object_stream = "MBD";
|
||||
|
||||
object_stream += XmlUtils::IntToString(obj->pictFmla.lPosInCtlStm, "%08X") + "/";
|
||||
if (xls_file->storage_->isDirectory(object_stream))
|
||||
std::wstring info;
|
||||
if (obj->pictFmla.fmla.bFmlaExist)
|
||||
{
|
||||
xlsx_context->get_mediaitems().create_embeddings_path(xlsx_path);
|
||||
|
||||
int id = ++xlsx_context->get_mediaitems().count_embeddings;
|
||||
std::wstring file_name = L"oleObject" + std::to_wstring(id) + L".bin";
|
||||
|
||||
POLE::Storage *storageOle = new POLE::Storage((xlsx_context->get_mediaitems().embeddings_path() + file_name).c_str());
|
||||
|
||||
if ((storageOle) && (storageOle->open(true, true)))
|
||||
{
|
||||
xls_file->copy(0, object_stream, storageOle, false);
|
||||
|
||||
storageOle->close();
|
||||
delete storageOle;
|
||||
}
|
||||
std::wstring objectId = L"objId" + std::to_wstring(id);
|
||||
|
||||
xlsx_context->current_sheet().sheet_rels().add(oox::relationship(
|
||||
objectId, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject", L"../embeddings/" + file_name));
|
||||
|
||||
xlsx_context->get_drawing_context().set_ole_object(objectId, info);
|
||||
if (obj->pictFmla.fmla.bInfoExist)
|
||||
info = obj->pictFmla.fmla.embedInfo.strClass.value();
|
||||
}
|
||||
if (obj->pictFlags.fCtl && obj->pictFlags.fPrstm)//Controls Storage
|
||||
{
|
||||
xlsx_context->get_mediaitems().create_activeX_path(xlsx_path);
|
||||
|
||||
int id = ++xlsx_context->get_mediaitems().count_activeX;
|
||||
std::wstring file_name = xlsx_context->get_mediaitems().activeX_path() + L"activeX" + std::to_wstring(id) + L".bin";
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
if ( file.CreateFileW(file_name) )
|
||||
{
|
||||
file.WriteFile(xls_global_info->controls_data.first.get() + obj->pictFmla.lPosInCtlStm, obj->pictFmla.cbBufInCtlStm);
|
||||
file.CloseFile();
|
||||
}
|
||||
}
|
||||
else if (!obj->pictFlags.fPrstm)
|
||||
{
|
||||
std::string object_stream;
|
||||
if (obj->pictFlags.fDde) object_stream = "LNK";
|
||||
else object_stream = "MBD";
|
||||
|
||||
object_stream += XmlUtils::IntToString(obj->pictFmla.lPosInCtlStm, "%08X") + "/";
|
||||
if (xls_file->storage_->isDirectory(object_stream))
|
||||
{
|
||||
xlsx_context->get_mediaitems().create_embeddings_path(xlsx_path);
|
||||
|
||||
std::wstring target;
|
||||
std::wstring objectId = xlsx_context->get_mediaitems().add_embedding(target, info);
|
||||
|
||||
POLE::Storage *storageOle = new POLE::Storage((xlsx_context->get_mediaitems().embeddings_path() + target).c_str());
|
||||
|
||||
if ((storageOle) && (storageOle->open(true, true)))
|
||||
{
|
||||
xls_file->copy(0, object_stream, storageOle, false, true);
|
||||
|
||||
storageOle->close();
|
||||
delete storageOle;
|
||||
}
|
||||
xlsx_context->current_sheet().sheet_rels().add(oox::relationship(
|
||||
objectId, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject", L"../embeddings/" + target));
|
||||
|
||||
xlsx_context->get_drawing_context().set_ole_object(objectId, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj->list.fExist)
|
||||
{
|
||||
}
|
||||
if (obj->macro.fExist && obj->macro.fmla.bFmlaExist)
|
||||
{
|
||||
std::wstring macro = obj->macro.fmla.fmla.getAssembledFormula();
|
||||
xlsx_context->get_drawing_context().set_macro(macro);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@
|
||||
#include "mediaitems_utils.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/Base/Base.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
|
||||
namespace oox {
|
||||
@ -115,6 +117,26 @@ std::wstring external_items::add_chart(std::wstring & oox_target)
|
||||
|
||||
return rId;
|
||||
}
|
||||
std::wstring external_items::add_embedding(std::wstring & oox_target, const std::wstring & info)
|
||||
{
|
||||
const bool isMediaInternal = true;
|
||||
|
||||
count_embeddings++;
|
||||
|
||||
std::wstring rId = std::wstring(L"objId") + std::to_wstring(count_embeddings);
|
||||
|
||||
std::wstring lowerInfo = XmlUtils::GetLower(info);
|
||||
|
||||
std::wstring extension = L".bin";
|
||||
|
||||
if (std::wstring::npos != lowerInfo.find(L"excel")) extension = L".xls";
|
||||
if (std::wstring::npos != lowerInfo.find(L"word")) extension = L".doc";
|
||||
|
||||
oox_target = std::wstring(L"oleObject") + std::to_wstring(count_embeddings) + extension;
|
||||
|
||||
items_.push_back( item(oox_target, typeOleObject, isMediaInternal, -1, rId) );
|
||||
return rId;
|
||||
}
|
||||
std::wstring external_items::find_image(int _id, std::wstring & oox_target, bool & isInternal)
|
||||
{
|
||||
for (int i=0 ; i <items_.size(); i ++)
|
||||
|
||||
@ -41,7 +41,7 @@ class rels;
|
||||
class external_items
|
||||
{
|
||||
public:
|
||||
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeTable, typeHyperlink, typeComment, typeMedia, typeGroup, typeExternalLink, typeOleObject};
|
||||
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeTable, typeHyperlink, typeComment, typeMedia, typeGroup, typeExternalLink, typeOleObject, typeActiveX};
|
||||
|
||||
external_items()
|
||||
{
|
||||
@ -81,8 +81,9 @@ public:
|
||||
size_t count_embeddings;
|
||||
|
||||
//std::wstring add_or_find(const std::wstring & href, Type type, bool & isInternal);//возможны ссылки на один и тот же объект
|
||||
std::wstring add_image (const std::wstring & file_name, int bin_id);
|
||||
std::wstring add_chart (std::wstring & oox_target);
|
||||
std::wstring add_image (const std::wstring & file_name, int bin_id);
|
||||
std::wstring add_chart (std::wstring & oox_target);
|
||||
std::wstring add_embedding (std::wstring & oox_target, const std::wstring & info);
|
||||
|
||||
std::wstring find_image (int id, std::wstring & oox_target, bool & isExternal);
|
||||
std::wstring find_image ( const std::wstring & oox_target, bool & isExternal);
|
||||
|
||||
@ -61,6 +61,8 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
if (L"wav" == extension) return L"audio/wav";
|
||||
if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
if (L"xls" == extension) return L"application/vnd.ms-excel";
|
||||
if (L"doc" == extension) return L"application/vnd.ms-word";
|
||||
|
||||
return L"";
|
||||
}
|
||||
@ -92,13 +94,24 @@ void content_types_file::set_media(external_items & _Mediaitems)
|
||||
{
|
||||
BOOST_FOREACH( external_items::item & item, _Mediaitems.items() )
|
||||
{
|
||||
if ((item.type == external_items::typeImage || item.type == external_items::typeMedia) && item.mediaInternal)
|
||||
if (!item.mediaInternal) continue;
|
||||
|
||||
std::wstring extension;
|
||||
int n = item.uri.rfind(L".");
|
||||
if (n > 0) extension = item.uri.substr(n + 1);
|
||||
|
||||
if (item.type == external_items::typeImage || item.type == external_items::typeMedia)
|
||||
{
|
||||
int n = item.uri.rfind(L".");
|
||||
if (n > 0)
|
||||
{
|
||||
add_or_find_default(item.uri.substr(n+1, item.uri.length() - n));
|
||||
}
|
||||
add_or_find_default(extension);
|
||||
}
|
||||
else if (item.type == external_items::typeOleObject)
|
||||
{
|
||||
std::wstring link = L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
|
||||
if (extension == L"xls" || extension == L"doc")
|
||||
add_or_find_default(extension);
|
||||
else
|
||||
content_type_.add_override(L"/xl/embeddings/" + item.uri, link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ namespace OOX
|
||||
m_mTable.insert( std::make_pair( _T("sldm"), _T("application/vnd.ms-powerpoint.slide.macroEnabled.12")));
|
||||
m_mTable.insert( std::make_pair( _T("sldx"), _T("application/vnd.openxmlformats-officedocument.presentationml.slide")));
|
||||
m_mTable.insert( std::make_pair( _T("doc"), _T("application/msword")));
|
||||
m_mTable.insert( std::make_pair( _T("docm"), _T("aapplication/vnd.ms-word.document.macroEnabled.12")));
|
||||
m_mTable.insert( std::make_pair( _T("docm"), _T("application/vnd.ms-word.document.macroEnabled.12")));
|
||||
m_mTable.insert( std::make_pair( _T("docx"), _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document")));
|
||||
m_mTable.insert( std::make_pair( _T("vml"), _T("application/vnd.openxmlformats-officedocument.vmlDrawing")));
|
||||
}
|
||||
|
||||
@ -90,11 +90,7 @@ namespace OOX
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Attributes
|
||||
nullable<std::wstring> m_sSpId;
|
||||
|
||||
// Childs
|
||||
};
|
||||
class CDataModelExt : public WritingElement
|
||||
{
|
||||
|
||||
@ -155,18 +155,17 @@ namespace OOX
|
||||
if (shape.IsInit())
|
||||
{
|
||||
m_nId = shape->nvSpPr.cNvPr.id;
|
||||
if (shape->nvSpPr.cNvPr.oleSpid.IsInit())
|
||||
if (shape->nvSpPr.cNvPr.vmlSpid.IsInit())
|
||||
{
|
||||
//ссылка на объект
|
||||
m_bShapeOle = true;
|
||||
m_sSpId = shape->nvSpPr.cNvPr.oleSpid.get();
|
||||
//ссылка на объект или шейп в vmlDrawing
|
||||
m_sVmlSpId = shape->nvSpPr.cNvPr.vmlSpid.get();
|
||||
}
|
||||
}
|
||||
smart_ptr<PPTX::Logic::GraphicFrame> frame = m_oElement->GetElem().smart_dynamic_cast<PPTX::Logic::GraphicFrame>();
|
||||
if ((frame.IsInit()) && (frame->oleSpid.IsInit()))
|
||||
if ((frame.IsInit()) && (frame->vmlSpid.IsInit()))
|
||||
{
|
||||
//ссылка на объект или шейп в vmlDrawing
|
||||
m_sSpId = frame->oleSpid.get();
|
||||
m_sVmlSpId = frame->vmlSpid.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -221,7 +220,7 @@ namespace OOX
|
||||
nullable<SimpleTypes::COnOff<>> m_oAlternateContent;
|
||||
|
||||
//для удобства
|
||||
nullable<std::wstring> m_sSpId;
|
||||
nullable<std::wstring> m_sVmlSpId;
|
||||
nullable<int> m_nId;
|
||||
};
|
||||
} //Spreadsheet
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -219,7 +219,7 @@ public:
|
||||
|
||||
HCRYPTPROV hCryptProv = NULL;
|
||||
|
||||
bResult = CryptAcquireCertificatePrivateKey(m_context, 0, NULL, &hCryptProv, &dwKeySpec, NULL);
|
||||
bResult = (NULL != m_context) ? CryptAcquireCertificatePrivateKey(m_context, 0, NULL, &hCryptProv, &dwKeySpec, NULL) : FALSE;
|
||||
|
||||
if (!bResult)
|
||||
bResult = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
||||
|
||||
@ -821,7 +821,7 @@ void ECMAEncryptor::UpdateDataIntegrity(unsigned char* data, int size)
|
||||
cryptData.encryptedHmacKey = std::string((char*)pEncHmacKey.ptr, pEncHmacKey.size);
|
||||
cryptData.encryptedHmacValue = std::string((char*)pEncHmacValue.ptr, pEncHmacValue.size);
|
||||
}
|
||||
|
||||
#define PADDING_SIZE 16 // 8
|
||||
int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*& data_out_ptr)
|
||||
{
|
||||
data_out_ptr = NULL;
|
||||
@ -831,10 +831,10 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
|
||||
_buf empty (NULL, 0, false);
|
||||
|
||||
int size_out = size;
|
||||
if (size_out % 8 != 0)
|
||||
size_out = (size_out / 8 + 1) * 8;
|
||||
if (size_out % PADDING_SIZE != 0)
|
||||
size_out = (size_out / PADDING_SIZE + 1) * PADDING_SIZE;
|
||||
|
||||
data_out_ptr = new unsigned char[size_out + 8]; // real size + padding + size for realsize
|
||||
data_out_ptr = new unsigned char[size_out + PADDING_SIZE]; // real size + padding + size for realsize
|
||||
|
||||
_UINT64 nSize = size;
|
||||
memcpy(data_out_ptr, (unsigned char*)&nSize, 8);
|
||||
@ -886,8 +886,8 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
|
||||
|
||||
EncryptCipher(pDecryptedKey, iv, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
|
||||
if (sz % 8 != 0)
|
||||
sz = (sz / 8 + 1) * 8;
|
||||
if (sz % PADDING_SIZE != 0)
|
||||
sz = (sz / PADDING_SIZE + 1) * PADDING_SIZE;
|
||||
|
||||
memcpy(data_out, pOut.ptr, sz);
|
||||
|
||||
|
||||
@ -3136,8 +3136,8 @@ namespace BinXlsxRW
|
||||
|
||||
if (pCellAnchor)
|
||||
{
|
||||
pCellAnchor->m_sSpId.Init();
|
||||
pCellAnchor->m_sSpId->append(it->first);
|
||||
pCellAnchor->m_sVmlSpId.Init();
|
||||
pCellAnchor->m_sVmlSpId->append(it->first);
|
||||
|
||||
int nCurPos = m_oBcw.WriteItemStart(c_oSerWorksheetsTypes::Drawing);
|
||||
WriteDrawing(oWorksheet, pDrawing, pCellAnchor, pVmlDrawing, NULL);
|
||||
@ -3157,7 +3157,7 @@ namespace BinXlsxRW
|
||||
if (!pCellAnchor) return;
|
||||
|
||||
if (pCellAnchor->m_oElement.IsInit() == false &&
|
||||
pCellAnchor->m_sSpId.IsInit() == false) return;
|
||||
pCellAnchor->m_sVmlSpId.IsInit() == false) return;
|
||||
//Type
|
||||
int nCurPos;
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_DrawingType::Type);
|
||||
@ -3191,9 +3191,9 @@ namespace BinXlsxRW
|
||||
WriteExt(pCellAnchor->m_oExt.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if (pCellAnchor->m_sSpId.IsInit() && pVmlDrawing)
|
||||
if (pCellAnchor->m_sVmlSpId.IsInit() && pVmlDrawing)
|
||||
{
|
||||
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pFind = pVmlDrawing->m_mapShapes.find(pCellAnchor->m_sSpId.get2());
|
||||
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pFind = pVmlDrawing->m_mapShapes.find(pCellAnchor->m_sVmlSpId.get2());
|
||||
|
||||
if (pFind != pVmlDrawing->m_mapShapes.end() && !pFind->second.bUsed)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user