Compare commits

..

17 Commits

Author SHA1 Message Date
1e0f4d6fdb XlsFormat - developers controls (buttons, options, ....), fix vba stream 2017-10-19 17:39:00 +03:00
a038e1562f XlsFormat - control objects 2017-10-18 14:38:31 +03:00
9c7a03fdc5 OdfFormatWriter - add ole objects 2017-10-17 11:40:37 +03:00
9272b27a69 crypto fix padding size 2017-10-16 19:37:18 +03:00
ef57330a79 . 2017-10-16 19:20:28 +03:00
d35619eeae Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  x2t binary - fix convert ole without vml drawing
  OdsFormat - fix absolute anchor for ole
  XlsFormat - activeX, controls & ole embedded & links
  xml string as second command-line param(first - path to xml)
  .
  --all-fonts-path param
  Added empty files
  v8 (windows correct)
  Added docbuilder target
2017-10-16 17:53:40 +03:00
b38c552cc5 fixed serialize 2017-10-16 17:53:31 +03:00
1b91ee579c x2t binary - fix convert ole without vml drawing 2017-10-16 14:22:53 +03:00
337c92e522 OdsFormat - fix absolute anchor for ole 2017-10-16 12:22:30 +03:00
8fe1eb7525 XlsFormat - activeX, controls & ole embedded & links 2017-10-16 11:28:46 +03:00
1deb2a6905 Merge 2017-10-13 14:44:53 +03:00
3813be21c7 --all-fonts-path param 2017-10-09 15:11:30 +03:00
68c8c0cb29 Merge pull request #42 from ONLYOFFICE/feature/docbuilder
Feature/docbuilder
2017-10-06 11:57:57 +03:00
ab0c5703a5 Added empty files 2017-10-06 11:04:59 +03:00
e22b63347f v8 (windows correct) 2017-10-05 18:13:52 +03:00
438ba3aded v5.0.1 2017-10-05 14:46:28 +03:00
29b002ca80 Added docbuilder target 2017-10-04 14:56:03 +03:00
112 changed files with 4571 additions and 3584 deletions

View File

@ -576,11 +576,31 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_); // не объект
}
void xlsx_drawing_context::process_object(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx_table_metrics & table_metrics,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
{
std::wstring ref;
bool isMediaInternal = true;
if (drawing.type_anchor == 2) // absolute
{
//пересчет нужен для оле
xlsx_table_position from, to;
process_position_properties (obj, table_metrics, from, to);
drawing.from_.type = xlsx_drawing_position::from;
drawing.from_.position.col = from.col;
drawing.from_.position.colOff = static_cast<size_t>(odf_types::length(from.colOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.from_.position.row = from.row;
drawing.from_.position.rowOff = static_cast<size_t>(odf_types::length(from.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.to_.type = xlsx_drawing_position::to;
drawing.to_.position.col = to.col;
drawing.to_.position.colOff = static_cast<size_t>(odf_types::length(to.colOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
drawing.to_.position.row = to.row;
drawing.to_.position.rowOff = static_cast<size_t>(odf_types::length(to.rowOff, odf_types::length::pt).get_value_unit(odf_types::length::emu));
}
drawing.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectProgId = obj.descriptor_;
@ -602,7 +622,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
{
xlsx_drawings_ptr xlsx_drawings_child(xlsx_drawings::create(true));
process_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
process_group_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
std::wstringstream strm;
@ -620,9 +640,9 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
}
void xlsx_drawing_context::process_objects(xlsx_table_metrics & table_metrics)
{
process_objects(impl_->objects_, table_metrics, impl_->get_drawings());
process_group_objects(impl_->objects_, table_metrics, impl_->get_drawings());
}
void xlsx_drawing_context::process_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_)
{
for (size_t i = 0 ; i < objects.size(); i++)
{
@ -661,7 +681,7 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio
case typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
case typeMsObject:
case typeOleObject:
process_object ( obj, drawing, xlsx_drawings_); break;
process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
}
}
}

View File

@ -133,13 +133,13 @@ private:
class Impl;
_CP_PTR(Impl) impl_;
void process_objects (std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_);
void process_group (drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_group_objects (std::vector<drawing_object_description> objects, xlsx_table_metrics & table_metrics, xlsx_drawings_ptr xlsx_drawings_);
void process_image (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_chart (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_shape (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_object (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_object (drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_);
void process_common_properties (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_table_metrics & table_metrics);

View File

@ -65,7 +65,7 @@ public:
if (sheet_rel)
{
for (int i = 0 ; i < xlsx_sheet_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_sheet_rels_.size(); i++)
{
if (xlsx_sheet_rels_[i].rid == rid && xlsx_sheet_rels_[i].ref == ref)
present = true;
@ -75,7 +75,7 @@ public:
}
else
{
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
present = true;
@ -89,7 +89,7 @@ public:
{
if (inGroup)
{
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
{
xlsx_drawings_[i].serialize(strm);
}
@ -114,7 +114,7 @@ public:
}
void serialize_objects(std::wostream & strm)
{
for (int i = 0 ; i < xlsx_drawings_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawings_.size(); i++)
{
if (xlsx_drawings_[i].type != typeOleObject && xlsx_drawings_[i].type != typeMsObject) continue;
@ -129,7 +129,7 @@ public:
void dump_rels_drawing(rels & Rels)
{
for (int i = 0 ; i < xlsx_drawing_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_drawing_rels_.size(); i++)
{
if (xlsx_drawing_rels_[i].type == typeImage ||
xlsx_drawing_rels_[i].type == typeMedia ||
@ -146,7 +146,7 @@ public:
}
void dump_rels_sheet(rels & Rels)
{
for (int i = 0 ; i < xlsx_sheet_rels_.size(); i++)
for (size_t i = 0 ; i < xlsx_sheet_rels_.size(); i++)
{
Rels.add(relationship( xlsx_sheet_rels_[i].rid,
mediaitems::get_rel_type(xlsx_sheet_rels_[i].type),

View File

@ -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)) );
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -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();

View File

@ -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_);

View File

@ -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);

View File

@ -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_);

View File

@ -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_;
};

View File

@ -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;

View File

@ -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;
}

View File

@ -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))
{

View File

@ -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)

View File

@ -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);

View File

@ -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()
{

View File

@ -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>();
}

View File

@ -89,7 +89,7 @@ namespace PPTX
nullable<Xfrm> xfrm;
nullable_string oleSpid;
nullable_string vmlSpid;
nullable<Pic> olePic;
nullable<Table> table;

View File

@ -97,22 +97,22 @@ 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 streamNameOpen, std::string streamNameCreate, POLE::Storage * storageOut, bool bWithRoot)
{
POLE::Stream *stream = new POLE::Stream(storage_, streamName);
POLE::Stream *stream = new POLE::Stream(storage_, streamNameOpen);
if (!stream) return;
stream->seek(0);
int size_stream = stream->size();
if (withRoot == false)
if (bWithRoot == false)
{
int pos = streamName.find("/");
int pos = streamNameCreate.find("/");
if (pos >= 0)
streamName = streamName.substr(pos + 1);
streamNameCreate = streamNameCreate.substr(pos + 1);
}
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamNameCreate, true, size_stream);
if (!streamNew) return;
unsigned char* data_stream = new unsigned char[size_stream];
@ -132,10 +132,11 @@ 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;
entries = storage_->entries( path );
std::list<std::string> entries, entries_files, entries_dir;
entries = storage_->entries_with_prefix( path );
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
{
@ -144,27 +145,31 @@ 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 );
}
entries_files.sort();
for( std::list<std::string>::iterator it = entries_files.begin(); it != entries_files.end(); it++ )
{
std::string createName = path + *it;
std::string openName;
if (it->at(0) < 32) openName = path + it->substr(1);
else openName = path + *it;
copy_stream(openName, createName, storageOut, bWithRoot);
}
}
CFStreamPtr CompoundFile::getWorkbookStream()

View File

@ -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 streamNameOpen, std::string streamNameCreate, 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,10 +73,11 @@ private:
CFStreamPtr createNamedStream (const std::string& name);
void closeNamedStream (const std::string& name);
private:
std::map<std::string, CFStreamPtr> streams;
ReadWriteMode rwMode;
};
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
} // namespace XLS

View File

@ -32,14 +32,12 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/BiffString.h>
#include <Logic/Biff_structures/BorderFillInfo.h>
#include "../Biff_structures/BiffString.h"
#include "../Biff_structures/BorderFillInfo.h"
namespace XLS
{
// Logical representation of Font record in BIFF8
class Font: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Font)

View File

@ -67,8 +67,12 @@ void MsoDrawing::readFields()
rgChildRec.rh_own.recLen = stored_record->getDataSize();
rgChildRec.loadFields(*stored_record);
if (stored_record->getRdPtr() < stored_record->getDataSize())
{
int g = 0;
}
}
isReading = true;
}
@ -77,6 +81,11 @@ void MsoDrawing::readFields(CFRecord& record)
record >> rgChildRec;
isReading = true;
if (record.getRdPtr() < record.getDataSize())
{
int g = 0;
}
}

View File

@ -39,12 +39,10 @@ Note::Note()
{
}
Note::~Note()
{
}
BaseObjectPtr Note::clone()
{
return BaseObjectPtr(new Note(*this));

View File

@ -32,13 +32,11 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/NoteSh.h>
#include <Logic/Biff_structures/NoteRR.h>
#include "../Biff_structures/NoteSh.h"
#include "../Biff_structures/NoteRR.h"
namespace XLS
{
// Logical representation of Note record in BIFF8
class Note: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(Note)
@ -49,15 +47,12 @@ public:
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeNote;
static const ElementType type = typeNote;
NoteSh note_sh;
// NoteRR note_rr;
};
} // namespace XLS

View File

@ -57,9 +57,9 @@
#define OBJ_Label 0x000E
#define OBJ_DialogBox 0x000F
#define OBJ_SpinControl 0x0010
#define OBJ_Scrollbar 0x0011
#define OBJ_List 0x0012
#define OBJ_GroupBox 0x0013
#define OBJ_Scrollbar 0x0011
#define OBJ_DropdownList 0x0014
#define OBJ_Note 0x0019
@ -80,7 +80,6 @@ BaseObjectPtr Obj::clone()
void Obj::readFields(CFRecord& record)
{
record >> cmo;
size_t rdPtr = record.getRdPtr();
if (record.getGlobalWorkbookInfo()->Version >= 0x0600)
{
@ -88,62 +87,74 @@ void Obj::readFields(CFRecord& record)
{
record.skipNunBytes(6); // Skip FtGmo (obsolete)
}
if(OBJ_Picture == cmo.ot)
if( OBJ_Picture == cmo.ot)
{
record >> pictFormat;
record >> pictFlags;
}
if(0x0B == cmo.ot || 0x0C == cmo.ot)
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot)
{
record.skipNunBytes(16); // Skip FtCbls (obsolete)
}
if(0x0C == cmo.ot)
if( OBJ_RadioButton == cmo.ot)
{
record.skipNunBytes(10); // Skip FtRbo (obsolete)
}
if(0x10 == cmo.ot || 0x11 == cmo.ot || 0x12 == cmo.ot || 0x14 == cmo.ot)
if( OBJ_SpinControl == cmo.ot ||
OBJ_Scrollbar == cmo.ot ||
OBJ_List == cmo.ot ||
OBJ_DropdownList == cmo.ot)
{
record >> sbs;
}
if(0x19 == cmo.ot)
if( OBJ_Note == cmo.ot)
{
record >> nts;
}
//if(false) // TODO: Find out the condition
//{
// macro.load(record);
//}
if(0x0B == cmo.ot || 0x0C == cmo.ot || 0x10 == cmo.ot || 0x11 == cmo.ot || 0x12 == cmo.ot /*|| 0x14 == cmo.ot*/)
macro.load(record);
if( OBJ_Picture == cmo.ot)
{
pictFmla.load(record, pictFlags);
}
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot ||
OBJ_SpinControl == cmo.ot ||
OBJ_Scrollbar == cmo.ot ||
OBJ_List == cmo.ot /*|| OBJ_DropdownList == cmo.ot*/)
{
linkFmla.load(record);
}
if(0x0B == cmo.ot || 0x0C == cmo.ot)
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot)
{
checkBox.load(record);
}
if(0x0C == cmo.ot)
if( OBJ_RadioButton == cmo.ot)
{
radioButton.load(record);
}
if(0x0D == cmo.ot)
if( OBJ_EditBox == cmo.ot)
{
edit.load(record);
}
if(0x12 == cmo.ot || 0x14 == cmo.ot)
if( OBJ_List == cmo.ot ||
OBJ_DropdownList == cmo.ot)
{
list.load(record, cmo.ot);
}
if(0x13 == cmo.ot)
if( OBJ_GroupBox == cmo.ot)
{
gbo.load(record);
}
if(0x12 != cmo.ot && 0x14 != cmo.ot)
}
if( OBJ_List != cmo.ot && OBJ_DropdownList != cmo.ot)
{
record.skipNunBytes(4); // reserved
}
//------------------------------------------------------------------------------------------------------
if (continue_records.size() > 0)
{
std::list<CFRecordPtr>& recs = continue_records[rt_Continue];

View File

@ -32,27 +32,25 @@
#pragma once
#include "BiffRecordContinued.h"
#include "MsoDrawing.h"
#include <Logic/Biff_structures/FtCmo.h>
#include <Logic/Biff_structures/FtCf.h>
#include <Logic/Biff_structures/FtPioGrbit.h>
#include <Logic/Biff_structures/FtSbs.h>
#include <Logic/Biff_structures/FtNts.h>
#include <Logic/Biff_structures/FtMacro.h>
#include <Logic/Biff_structures/FtPictFmla.h>
#include <Logic/Biff_structures/ObjLinkFmla.h>
#include <Logic/Biff_structures/FtCblsData.h>
#include <Logic/Biff_structures/FtRboData.h>
#include <Logic/Biff_structures/FtEdoData.h>
#include <Logic/Biff_structures/FtLbsData.h>
#include <Logic/Biff_structures/FtGboData.h>
#include <Logic/Biff_records/MsoDrawing.h>
#include "../Biff_structures/FtCmo.h"
#include "../Biff_structures/FtCf.h"
#include "../Biff_structures/FtPioGrbit.h"
#include "../Biff_structures/FtSbs.h"
#include "../Biff_structures/FtNts.h"
#include "../Biff_structures/FtMacro.h"
#include "../Biff_structures/FtPictFmla.h"
#include "../Biff_structures/ObjLinkFmla.h"
#include "../Biff_structures/FtCblsData.h"
#include "../Biff_structures/FtRboData.h"
#include "../Biff_structures/FtEdoData.h"
#include "../Biff_structures/FtLbsData.h"
#include "../Biff_structures/FtGboData.h"
namespace XLS
{
// Logical representation of Obj record in BIFF8
class Obj : public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(Obj)
@ -65,11 +63,10 @@ public:
~Obj();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeObj;
static const ElementType type = typeObj;
//-----------------------------
FtCmo cmo;
@ -104,8 +101,6 @@ public:
_UINT16 flag;
_UINT16 flag2;
}old_version;
};
} // namespace XLS

View File

@ -39,12 +39,10 @@ Pls::Pls()
{
}
Pls::~Pls()
{
}
BaseObjectPtr Pls::clone()
{
return BaseObjectPtr(new Pls());
@ -71,9 +69,9 @@ void Pls::readFields(CFRecord& record)
}
int size = record.getDataSize() - 2;
const char* data = record.getData() + 2;
const BYTE* data = (BYTE*)record.getData() + 2;
boost::shared_array<char> buffer(new char[size]);
boost::shared_array<BYTE> buffer(new BYTE[size]);
memcpy(buffer.get(), data, size);
bin_data_id = -1;
@ -81,7 +79,7 @@ void Pls::readFields(CFRecord& record)
GlobalWorkbookInfo* globla_info = record.getGlobalWorkbookInfo().get();
if (globla_info)
{
globla_info->bin_data.push_back(std::pair<boost::shared_array<char>, size_t>(buffer, size));
globla_info->bin_data.push_back(std::pair<boost::shared_array<BYTE>, size_t>(buffer, size));
bin_data_id = globla_info->bin_data.size() - 1;
}

View File

@ -31,7 +31,7 @@
*/
#pragma once
#include <Logic/Biff_records/BiffRecordContinued.h>
#include "BiffRecordContinued.h"
#if !defined(_WIN32) && !defined(_WIN64)
@ -109,9 +109,7 @@
namespace XLS
{
// Logical representation of Pls record in BIFF8
class Pls : public BiffRecordContinued
class Pls : public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(Pls)
BASE_OBJECT_DEFINE_CLASS_NAME(Pls)

View File

@ -32,14 +32,12 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/RkRec.h>
#include <Logic/Biff_structures/Cell.h>
#include "../Biff_structures/RkRec.h"
#include "../Biff_structures/Cell.h"
namespace XLS
{
// Logical representation of RK record in BIFF8
class RK: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(RK)
@ -49,7 +47,6 @@ public:
~RK();
BaseObjectPtr clone();
void readFields(CFRecord& record);

View File

@ -72,7 +72,9 @@ void Style::readFields(CFRecord& record)
user = s;
}
else
{
record >> user;
}
}
}

View File

@ -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);

View File

@ -31,7 +31,7 @@
*/
#include "Sync.h"
#include <Logic/Biff_structures/CellRef.h>
#include "../Biff_structures/CellRef.h"
namespace XLS
{

View File

@ -56,11 +56,11 @@ BaseObjectPtr TxO::clone()
void TxO::readFields(CFRecord& record)
{
pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo();
global_info = record.getGlobalWorkbookInfo();
unsigned short flags;
if (pGlobalWorkbookInfoPtr->Version < 0x0600)
if (global_info->Version < 0x0600)
{
short mnLinkSize;
short mnButtonFlags;
@ -154,6 +154,71 @@ void TxO::readFields(CFRecord& record)
fSecretEdit = GETBIT(flags, 15);
}
int TxO::serialize_vml (std::wostream & _stream)
{
std::wstring str_ = rawText.value();
int str_size = str_.size();
int iFmt = 0;
CP_XML_WRITER(_stream)
{
for (size_t i = 0; i < TxOruns.rgTxoRuns.size(); i++)
{
Run *run = dynamic_cast<Run*>(TxOruns.rgTxoRuns[i].get());
if (run == NULL) continue;
int end_string = str_size;
if ( i < TxOruns.rgTxoRuns.size() - 1)
{
Run *run_next = dynamic_cast<Run*>(TxOruns.rgTxoRuns[i+1].get());
if (run_next)
end_string = run_next->formatRun.ich;
}
CP_XML_NODE(L"div")
{
//style='text-align:left'
CP_XML_NODE(L"font")
{
iFmt = run->formatRun.ifnt;
Font *font = NULL;
if ((global_info->m_arFonts) && (iFmt >=0 && iFmt < global_info->m_arFonts->size()))
{
font = dynamic_cast<Font *>(global_info->m_arFonts->at(iFmt).get());
}
if (font)
{
if (font->dyHeight > 0) CP_XML_ATTR(L"size", font->dyHeight);
if (font->bls == 700) CP_XML_ATTR(L"bold", true);
if (font->fItalic) CP_XML_ATTR(L"italic", true);
if (!font->fontName.value().empty())
{
CP_XML_ATTR(L"face", font->fontName.value());
}
if ( font->icv < 0x7fff )
{
}
else CP_XML_ATTR(L"color", L"auto");
}
if (run->formatRun.ich > str_.length())
{
//ошибка
run->formatRun.ich = 0;
}
std::wstring str_part = str_.substr( run->formatRun.ich, end_string - run->formatRun.ich);
CP_XML_STREAM() << xml::utils::replace_text_to_xml(str_part);
}
}
}
}
return 0;
}
int TxO::serialize (std::wostream & _stream)
{
@ -163,7 +228,7 @@ int TxO::serialize (std::wostream & _stream)
int Fmt = 0;
std::wstring namespace_ = L"a:";
oox::external_items::Type type = pGlobalWorkbookInfoPtr->xls_converter->xlsx_context->get_drawing_context().getType();
oox::external_items::Type type = global_info->xls_converter->xlsx_context->get_drawing_context().getType();
if (type == oox::external_items::typeComment)
namespace_.clear();
@ -215,13 +280,13 @@ int TxO::serialize (std::wostream & _stream)
}
int TxO::serialize_rPr (std::wostream & _stream, int iFmt, std::wstring namespace_)
{
if (!pGlobalWorkbookInfoPtr) return 0;
if (!pGlobalWorkbookInfoPtr->m_arFonts) return 0;
if (!global_info) return 0;
if (!global_info->m_arFonts) return 0;
int sz = pGlobalWorkbookInfoPtr->m_arFonts->size();
int sz = global_info->m_arFonts->size();
if (iFmt - 1 >= sz || iFmt < 1) return 0;
Font * font = dynamic_cast<Font*>(pGlobalWorkbookInfoPtr->m_arFonts->at(iFmt-1).get());
Font * font = dynamic_cast<Font*>(global_info->m_arFonts->at(iFmt-1).get());
if (!font) return 0;

View File

@ -32,17 +32,15 @@
#pragma once
#include "BiffRecordContinued.h"
#include <Logic/Biff_structures/ControlInfo.h>
#include <Logic/Biff_structures/FontIndex.h>
#include <Logic/Biff_structures/ObjFmla.h>
#include <Logic/Biff_structures/TxORuns.h>
#include <Logic/Biff_records/MsoDrawing.h>
#include "MsoDrawing.h"
#include "../Biff_structures/ControlInfo.h"
#include "../Biff_structures/FontIndex.h"
#include "../Biff_structures/ObjFmla.h"
#include "../Biff_structures/TxORuns.h"
namespace XLS
{
// Logical representation of TxO record in BIFF8
class TxO: public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(TxO)
@ -68,8 +66,9 @@ public:
int serialize (std::wostream & _stream);
int serialize_rPr (std::wostream & _stream, int iFmt, std::wstring namespace_= L"a:");
int serialize_vml (std::wostream & _stream);
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr;
GlobalWorkbookInfoPtr global_info;
unsigned char hAlignment;
unsigned char vAlignment;

View File

@ -37,16 +37,22 @@
namespace XLS
{
BiffStructurePtr FtCblsData::clone()
{
return BiffStructurePtr(new FtCblsData(*this));
}
void FtCblsData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000a && cb != 0x000c)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> fChecked >> accel;
record.skipNunBytes(2); // reserved

View File

@ -42,16 +42,20 @@ class FtCblsData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtCblsData)
public:
FtCblsData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtCblsData;
static const ElementType type = typeFtCblsData;
virtual void load(CFRecord& record);
unsigned short fChecked;
unsigned short accel;
bool fNo3d;
bool fExist;
};
} // namespace XLS

View File

@ -46,8 +46,7 @@ public:
virtual void load(CFRecord& record);
static const ElementType type = typeFtCmo;
static const ElementType type = typeFtCmo;
unsigned short ot;
unsigned short id;
@ -60,7 +59,6 @@ public:
bool fUIObj;
bool fRecalcObj;
bool fRecalcObjAlways;
};
} // namespace XLS

View File

@ -36,16 +36,22 @@
namespace XLS
{
BiffStructurePtr FtEdoData::clone()
{
return BiffStructurePtr(new FtEdoData(*this));
}
void FtEdoData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x0010 && cb != 0x0008)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> ivtEdit >> fMultiLine >> fVScroll >> id;
}

View File

@ -43,17 +43,21 @@ class FtEdoData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtEdoData)
public:
FtEdoData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtEdoData;
static const ElementType type = typeFtEdoData;
virtual void load(CFRecord& record);
unsigned short ivtEdit;
Boolean<unsigned short> fMultiLine;
unsigned short fVScroll;
unsigned short id;
bool fExist;
};
} // namespace XLS

View File

@ -36,7 +36,6 @@
namespace XLS
{
BiffStructurePtr FtGboData::clone()
{
return BiffStructurePtr(new FtGboData(*this));
@ -44,7 +43,15 @@ BiffStructurePtr FtGboData::clone()
void FtGboData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000F && cb != 0x0006)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> accel;
record.skipNunBytes(2); // reserved

View File

@ -43,15 +43,19 @@ class FtGboData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtGboData)
public:
FtGboData() : fExist(false)
{
}
BiffStructurePtr clone();
virtual void load(CFRecord& record);
static const ElementType type = typeFtGboData;
static const ElementType type = typeFtGboData;
unsigned short accel;
bool fNo3d;
bool fExist;
};
} // namespace XLS

View File

@ -36,12 +36,6 @@
namespace XLS
{
FtLbsData::FtLbsData()
: fmla(false)
{
}
BiffStructurePtr FtLbsData::clone()
{
return BiffStructurePtr(new FtLbsData(*this));
@ -49,19 +43,27 @@ BiffStructurePtr FtLbsData::clone()
void FtLbsData::load(CFRecord& record, const unsigned short ot)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x0013)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
fmla.load(record);
unsigned short flags;
record >> cLines >> iSel >> flags >> idEdit;
fUseCB = GETBIT(flags, 0);
fValidPlex = GETBIT(flags, 1);
fValidIds = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
fUseCB = GETBIT(flags, 0);
fValidPlex = GETBIT(flags, 1);
fValidIds = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
wListSelType = GETBITS(flags, 4, 5);
lct = GETBITS(flags, 8, 15);
lct = GETBITS(flags, 8, 15);
if(0x0014 == ot)
{

View File

@ -46,10 +46,12 @@ class FtLbsData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtLbsData)
public:
FtLbsData();
FtLbsData() : fmla(false), fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtLbsData;
static const ElementType type = typeFtLbsData;
virtual void load(CFRecord& record, const unsigned short ot);
@ -72,6 +74,7 @@ public:
std::vector<XLUnicodeString> rgLines;
std::vector<Boolean<unsigned char>> bsels;
bool fExist;
};
} // namespace XLS

View File

@ -36,9 +36,7 @@
namespace XLS
{
FtMacro::FtMacro()
: fmla(false)
FtMacro::FtMacro() : fmla(false), fExist(false)
{
}
@ -48,14 +46,18 @@ BiffStructurePtr FtMacro::clone()
}
void FtMacro::load(CFRecord& record)
{
record.skipNunBytes(2); // reserved
short ft;
record >> ft;
if (ft != 0x0004)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
fmla.load(record);
}
} // namespace XLS

View File

@ -50,8 +50,8 @@ public:
virtual void load(CFRecord& record);
ObjFmla fmla;
bool fExist;
};
} // namespace XLS

View File

@ -37,16 +37,22 @@
namespace XLS
{
BiffStructurePtr FtNts::clone()
{
return BiffStructurePtr(new FtNts(*this));
}
void FtNts::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000d && cb != 0x0016)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
_GUID_ guid_num;
record >> guid_num >> fSharedNote;

View File

@ -43,15 +43,19 @@ class FtNts : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtNts)
public:
FtNts() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtNts;
static const ElementType type = typeFtNts;
virtual void load(CFRecord& record);
std::wstring guid;
Boolean<unsigned short> fSharedNote;
bool fExist;
};
} // namespace XLS

View File

@ -36,18 +36,11 @@
namespace XLS
{
FtPictFmla::FtPictFmla()
: fmla(true)
{
}
BiffStructurePtr FtPictFmla::clone()
{
return BiffStructurePtr(new FtPictFmla(*this));
}
void FtPictFmla::load(CFRecord& record, int linkSize)
{
bool bLinked = false;
@ -74,11 +67,8 @@ void FtPictFmla::load(CFRecord& record, int linkSize)
record >> nNameIdx;
record.skipNunBytes(12);
//const ExtName* pExtName = GetOldRoot().pExtNameBuff->GetNameByIndex( nRefIdx, nNameIdx );
// if( pExtName && pExtName->IsOLE() )
// mnStorageId = pExtName->nStorageId;
}
else if( nToken == 2)//XclTokenArrayHelper::GetTokenId( EXC_TOKID_TBL, EXC_TOKCLASS_NONE ) )
else if( nToken == 2)
{
bEmbedded = true;
@ -103,7 +93,17 @@ void FtPictFmla::load(CFRecord& record, int linkSize)
void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags)
{
record.skipNunBytes(4); // reserved
short ft, size;
record >> ft; // must be
if (ft != 0x0009)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
record >> size;
if (size < 1) return;
fmla.load(record);
@ -111,12 +111,11 @@ void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags)
{
record >> lPosInCtlStm;
}
record >> lPosInCtlStm;
if(pictFlags.fPrstm)
{
record >> cbBufInCtlStm;
}
if(pictFlags.fPrstm)
if(pictFlags.fCtl)
{
key.load(record);
}

View File

@ -45,20 +45,25 @@ class FtPictFmla : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPictFmla)
public:
FtPictFmla();
BiffStructurePtr clone();
FtPictFmla() : fmla(true), cbBufInCtlStm(0xffffffff), lPosInCtlStm(0xffffffff), fExist(false)
{
}
BiffStructurePtr clone();
virtual void load(CFRecord& record){}
//biff5
virtual void load(CFRecord& record, int linkSize);
//biff8
virtual void load(CFRecord& record, FtPioGrbit& pictFlags);
static const ElementType type = typeFtPictFmla;
virtual void load(CFRecord& record){}
ObjFmla fmla;
_UINT32 lPosInCtlStm;
_UINT32 cbBufInCtlStm;
PictFmlaKey key;
PictFmlaKey key;
ObjFmla fmla;
bool fExist;
};
} // namespace XLS

View File

@ -44,28 +44,28 @@ BiffStructurePtr FtPioGrbit::clone()
void FtPioGrbit::load(CFRecord& record)
{
//record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft;
record >> cb;
record >> ft >> cb;
if (record.getDataSize() == record.getRdPtr())
if ( ft != 0x0008 || cb != 2)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
unsigned short flags;
record >> flags;
fAutoPict = GETBIT(flags, 0);
fDde = GETBIT(flags, 1);
fPrintCalc = GETBIT(flags, 2);
fIcon = GETBIT(flags, 3);
fCtl = GETBIT(flags, 4);
fPrstm = GETBIT(flags, 5);
fCamera = GETBIT(flags, 7);
fAutoPict = GETBIT(flags, 0);
fDde = GETBIT(flags, 1);
fPrintCalc = GETBIT(flags, 2);
fIcon = GETBIT(flags, 3);
fCtl = GETBIT(flags, 4);
fPrstm = GETBIT(flags, 5);
fCamera = GETBIT(flags, 7);
fDefaultSize = GETBIT(flags, 8);
fAutoLoad = GETBIT(flags, 9);
fAutoLoad = GETBIT(flags, 9);
}

View File

@ -42,13 +42,15 @@ class FtPioGrbit : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPioGrbit)
public:
FtPioGrbit() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtPioGrbit;
virtual void load(CFRecord& record);
bool fAutoPict;
bool fDde;
bool fPrintCalc;
@ -58,6 +60,8 @@ public:
bool fCamera;
bool fDefaultSize;
bool fAutoLoad;
bool fExist;
};
} // namespace XLS

View File

@ -45,7 +45,15 @@ BiffStructurePtr FtRboData::clone()
void FtRboData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000b && cb != 0x0006)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> idRadNext >> fFirstBtn;
}

View File

@ -43,15 +43,19 @@ class FtRboData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtRboData)
public:
FtRboData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtRboData;
static const ElementType type = typeFtRboData;
virtual void load(CFRecord& record);
unsigned short idRadNext;
Boolean<unsigned short> fFirstBtn;
bool fExist;
};
} // namespace XLS

View File

@ -36,7 +36,6 @@
namespace XLS
{
BiffStructurePtr FtSbs::clone()
{
return BiffStructurePtr(new FtSbs(*this));
@ -44,10 +43,15 @@ BiffStructurePtr FtSbs::clone()
void FtSbs::load(CFRecord& record)
{
//record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
record >> ft;
record >> cb;
if ( ft != 0x000c && cb != 0x0014)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record.skipNunBytes(4); // unused1
@ -55,10 +59,10 @@ void FtSbs::load(CFRecord& record)
record >> iVal >> iMin >> iMax >> dInc >> dPage >> fHoriz >> dxScroll >> flags;
fDraw = GETBIT(flags, 0);
fDraw = GETBIT(flags, 0);
fDrawSliderOnly = GETBIT(flags, 1);
fTrackElevator = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
fTrackElevator = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
}

View File

@ -43,16 +43,15 @@ class FtSbs : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtSbs)
public:
FtSbs() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtSbs;
static const ElementType type = typeFtSbs;
virtual void load(CFRecord& record);
unsigned short ft;
unsigned short cb;
short iVal;
short iMin;
short iMax;
@ -65,6 +64,8 @@ public:
bool fDrawSliderOnly;
bool fTrackElevator;
bool fNo3d;
bool fExist;
};
} // namespace XLS

View File

@ -37,7 +37,6 @@
namespace XLS
{
NoteSh::NoteSh()
{
x_ = y_ = 0;
@ -47,14 +46,12 @@ NoteSh::NoteSh()
fColHidden = false;
}
NoteSh::NoteSh(CFRecord& record)
{
x_ = y_ = 0;
load(record);
}
BiffStructurePtr NoteSh::clone()
{
return BiffStructurePtr(new NoteSh(*this));

View File

@ -52,7 +52,6 @@ public:
virtual void load(CFRecord& record);
Rw row;
Col col;
bool fShow;

View File

@ -126,7 +126,8 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
// m_OfficeArtSpgrContainerFileBlock = OfficeArtContainerPtr(art_container);
// child_records.erase(child_records.begin() + i,child_records.begin() + i + 1);
// }break;
default:
break;
}
}

View File

@ -49,6 +49,8 @@ void OfficeArtRecord::load(XLS::CFRecord& record)
record >> rh_own;
loadFields(record);
//Log::warning(STR::int2str(rh_own.recType, 16));
}

View File

@ -37,8 +37,7 @@ namespace XLS
{
ObjFmla::ObjFmla(const bool is_part_of_FtPictFmla)
: is_part_of_FtPictFmla_(is_part_of_FtPictFmla)
ObjFmla::ObjFmla(const bool is_part_of_FtPictFmla) : is_part_of_FtPictFmla_(is_part_of_FtPictFmla), bFmlaExist(false), bInfoExist(false)
{
}
@ -47,7 +46,6 @@ BiffStructurePtr ObjFmla::clone()
return BiffStructurePtr(new ObjFmla(*this));
}
void ObjFmla::load(CFRecord& record)
{
unsigned short cbFmla;
@ -56,15 +54,17 @@ void ObjFmla::load(CFRecord& record)
if(0 != cbFmla)
{
bFmlaExist = true;
fmla.load(record);
if(is_part_of_FtPictFmla_ && fmla.HasPtgTbl())
{
record >> embedInfo;
bInfoExist = true;
}
}
size_t data_size = record.getRdPtr() - start_ptr;
size_t padding_size = cbFmla - data_size;
if(0 != padding_size && (record.getRdPtr() + padding_size) <= record.getDataSize())

View File

@ -47,17 +47,18 @@ public:
ObjFmla(const bool is_part_of_FtPictFmla);
BiffStructurePtr clone();
static const ElementType type = typeObjFmla;
static const ElementType type = typeObjFmla;
virtual void load(CFRecord& record);
ObjectParsedFormula fmla;
bool is_part_of_FtPictFmla_;
bool fmla_found;
PictFmlaEmbedInfo embedInfo;
bool bFmlaExist;
bool bInfoExist;
PictFmlaEmbedInfo embedInfo;
private:
bool is_part_of_FtPictFmla_;
};
} // namespace XLS

View File

@ -35,13 +35,6 @@
namespace XLS
{
ObjLinkFmla::ObjLinkFmla()
: fmla(false)
{
}
BiffStructurePtr ObjLinkFmla::clone()
{
return BiffStructurePtr(new ObjLinkFmla(*this));
@ -49,8 +42,15 @@ BiffStructurePtr ObjLinkFmla::clone()
void ObjLinkFmla::load(CFRecord& record)
{
record.skipNunBytes(2); // reserved
unsigned short ft;
record >> ft;
if ( ft != 0x0014)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
fmla.load(record);
}

View File

@ -43,7 +43,9 @@ class ObjLinkFmla : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(ObjLinkFmla)
public:
ObjLinkFmla();
ObjLinkFmla(): fmla(false), fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeObjLinkFmla;
@ -51,6 +53,7 @@ public:
virtual void load(CFRecord& record);
ObjFmla fmla;
bool fExist;
};
} // namespace XLS

View File

@ -45,8 +45,6 @@ public:
ObjectParsedFormula();
BiffStructurePtr clone();
virtual void load(CFRecord& record);
};
} // namespace XLS

View File

@ -32,7 +32,7 @@
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/BiffString.h>
#include "BiffString.h"
namespace XLS
{
@ -49,7 +49,6 @@ public:
virtual void load(CFRecord& record);
XLUnicodeStringNoCch strClass;
};

View File

@ -36,9 +36,7 @@
namespace XLS
{
PictFmlaKey::PictFmlaKey()
: fmlaLinkedCell(false), fmlaListFillRange(false)
PictFmlaKey::PictFmlaKey() : fmlaLinkedCell(false), fmlaListFillRange(false)
{
}
@ -49,10 +47,16 @@ BiffStructurePtr PictFmlaKey::clone()
void PictFmlaKey::load(CFRecord& record)
{
_UINT32 cbKey;
record >> cbKey;
record.skipNunBytes(cbKey); // ActiveX license key is here
if (cbKey > 0)
{
char *buf = new char[cbKey];
memcpy(buf, record.getCurData<char>(), cbKey);
keyBuf = std::string(buf, cbKey);
record.skipNunBytes(cbKey);
delete []buf;
}
fmlaLinkedCell.load(record);
fmlaListFillRange.load(record);

View File

@ -47,13 +47,15 @@ public:
PictFmlaKey();
BiffStructurePtr clone();
static const ElementType type = typePictFmlaKey;
static const ElementType type = typePictFmlaKey;
virtual void load(CFRecord& record);
_UINT32 cbKey;
std::string keyBuf; // ActiveX license key
ObjFmla fmlaLinkedCell;
ObjFmla fmlaListFillRange;
ObjFmla fmlaLinkedCell;
ObjFmla fmlaListFillRange;
};
} // namespace XLS

View File

@ -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);

View File

@ -36,9 +36,7 @@
namespace XLS
{
PtgTbl::PtgTbl()
: Ptg(fixed_id)
PtgTbl::PtgTbl() : Ptg(fixed_id)
{
}
@ -59,7 +57,11 @@ void PtgTbl::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full
{
// The reference coordinates shall be obtained from row/column values.
// No textual form need but the empty line.
ptg_stack.push(L"");
//CellRef ref(row, col, true, true);
//ptg_stack.push(ref.toString());
}

View File

@ -302,8 +302,13 @@ const bool CELLTABLE::loadContent(BinProcessor& proc)
CELL_GROUP cell_group2(shared_formulas_locations_ref_);
m_count_CELL_GROUP = proc.repeated(cell_group2, 0, 0);
proc.repeated<EntExU2>(0, 0);
int count = proc.repeated<EntExU2>(0, 0);
while(count > 0)
{
m_arEntExU2.insert(m_arEntExU2.begin(), elements_.back());
elements_.pop_back();
count--;
}
return true;
}

View File

@ -38,7 +38,6 @@ namespace XLS
class CellRef;
// Logical representation of CELLTABLE union of records
class CELLTABLE: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(CELLTABLE)
@ -50,13 +49,13 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeCELLTABLE;
static const ElementType type = typeCELLTABLE;
int serialize(std::wostream & stream);
std::vector<CellRangeRef>& shared_formulas_locations_ref_;
int m_count_CELL_GROUP;
int m_count_CELL_GROUP;
std::vector<BaseObjectPtr> m_arEntExU2;
};
} // namespace XLS

View File

@ -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)
{

View File

@ -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;

View File

@ -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

View File

@ -123,7 +123,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
bVbaProjectExist = false;
bMacrosExist = false;
idPivotCache = 0;
idPivotCache = 0;
}
GlobalWorkbookInfo::~GlobalWorkbookInfo()

View File

@ -121,8 +121,13 @@ public:
std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
std::vector<std::wstring> arDefineNames;
std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data;
std::vector<std::pair<boost::shared_array<unsigned char>, size_t> > bin_data;
std::pair<boost::shared_array<unsigned char>, size_t> listdata_data;
std::pair<boost::shared_array<unsigned char>, size_t> controls_data;
std::map<int, std::pair<boost::shared_array<unsigned char>, size_t> > embeddings_data; //parsing ???
std::map<int, std::pair<boost::shared_array<unsigned char>, size_t> > link_data;
struct _xti
{
int iSup;

View File

@ -137,41 +137,6 @@ namespace NSCustomShapesConvert
}
};
//class CRectF
//{
//public:
// float X;
// float Y;
// float Width;
// float Height;
//public:
// CRectF()
// {
// X = 0;
// Y = 0;
// Width = 0;
// Height = 0;
// }
// CRectF(const CRectF& oSrc)
// {
// *this = oSrc;
// }
// CRectF& operator=(const CRectF& oSrc)
// {
// X = oSrc.X;
// Y = oSrc.Y;
// Width = oSrc.Width;
// Height = oSrc.Height;
// return *this;
// }
// bool Equals(const CRect& oSrc)
// {
// return ((X == oSrc.X) && (Y == oSrc.Y) && (Width == oSrc.Width) && (Height == oSrc.Height));
// }
//};
class CGeomShapeInfo
{
public:
@ -314,7 +279,7 @@ namespace NSCustomShapesConvert
enum RulesType
{
// VML
// VML
rtLineTo = 0, // 2*
rtCurveTo = 1, // 6*
rtMoveTo = 2, // 2
@ -360,58 +325,14 @@ namespace NSCustomShapesConvert
class CGraphicPath
{
public:
//virtual void InternalFromXmlNode(XmlUtils::CXmlNode& oXmlNode)
//{
// Metric = XmlUtils::GetInteger(oXmlNode.GetAttributeOrValue(_T("metric"), _T("0")));
// m_bStroke = (1 == XmlUtils::GetInteger(oXmlNode.GetAttributeOrValue(_T("stroke"), _T("0"))));
// m_bFill = (1 == XmlUtils::GetInteger(oXmlNode.GetAttributeOrValue(_T("fill"), _T("0"))));
// m_dWidthMM = XmlUtils::GetDouble(oXmlNode.GetAttributeOrValue(_T("widthmm"), _T("210")));
// m_dHeightMM = XmlUtils::GetDouble(oXmlNode.GetAttributeOrValue(_T("heightmm"), _T("190")));
// m_dAngle = XmlUtils::GetDouble(oXmlNode.GetAttributeOrValue(_T("angle"), _T("0")));
// m_lFlags = XmlUtils::GetInteger(oXmlNode.GetAttributeOrValue(_T("flags"), _T("0")));
// m_oBounds.left = XmlUtils::GetDouble(oXmlNode.GetAttributeOrValue(_T("bounds-left"), _T("0")));
// m_oBounds.top = XmlUtils::GetDouble(oXmlNode.GetAttributeOrValue(_T("bounds-top"), _T("0")));
// m_oBounds.right = XmlUtils::GetDouble(oXmlNode.GetAttributeOrValue(_T("bounds-right"), _T("0")));
// m_oBounds.bottom = XmlUtils::GetDouble(oXmlNode.GetAttributeOrValue(_T("bounds-bottom"), _T("0")));
// XmlUtils::CXmlNodes oNodes;
// oXmlNode.GetNodes(_T("part"), oNodes);
// for (int nIndex = 0; nIndex < oNodes.GetCount(); ++nIndex)
// {
// CPart oPart;
// XmlUtils::CXmlNode oNode;
// oNodes.GetAt(nIndex, oNode);
// oPart.FromXmlNode(oNode);
// m_arParts.push_back(oPart);
// }
// //XmlUtils::CXmlNode oPenNode;
// //if (oXmlNode.GetNode(_T("pen"), oPenNode))
// //{
// // Pen.FromXmlNode(oPenNode);
// //}
// //XmlUtils::CXmlNode oBrushNode;
// //if (oXmlNode.GetNode(_T("brush"), oBrushNode))
// //{
// // Brush.FromXmlNode(oBrushNode);
// //}
//}
virtual void InternalClear()
{
m_lFlags = 0;
}
public:
CGraphicPath()
{
InternalClear();
}
public:
class CPart
{
public:
@ -1028,9 +949,6 @@ namespace NSCustomShapesConvert
{
m_arParts.clear();
}
public:
std::vector<CPart> m_arParts;
int m_lFlags;

View File

@ -275,6 +275,7 @@ namespace oox
case msosptRectangle : return L"rect";
case msosptRoundRectangle : return L"roundRect";
case msosptEllipse : return L"ellipse";
case msosptPictureFrame : return L"rect";
//case msosptDiamond : return L"diamond";
case msosptIsocelesTriangle : return L"triangle";
//case msosptRightTriangle : return L"rtTriangle";

View File

@ -122,9 +122,9 @@ typedef struct tagBITMAPCOREHEADER {
} BITMAPCOREHEADER;
#endif
XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* CallBack, bool & bMacros)
XlsConverter::XlsConverter(const std::wstring & xlsFileName, const std::wstring & xlsxFilePath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* CallBack, bool & bMacros)
{
xlsx_path = _xlsx_path;
xlsx_path = xlsxFilePath;
output_document = NULL;
xlsx_context = NULL;
@ -136,9 +136,9 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
try
{
XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode);
xls_file = boost::shared_ptr<XLS::CompoundFile>(new XLS::CompoundFile(xlsFileName, XLS::CompoundFile::cf_ReadMode));
if (cfile.isError())
if (xls_file->isError())
{
return;
}
@ -148,7 +148,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
try
{
summary = cfile.getNamedStream("SummaryInformation");
summary = xls_file->getNamedStream("SummaryInformation");
}
catch (...)
{
@ -156,7 +156,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
try
{
doc_summary = cfile.getNamedStream("DocumentSummaryInformation");
doc_summary = xls_file->getNamedStream("DocumentSummaryInformation");
}
catch (...)
{
@ -184,7 +184,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
xls_global_info->fontsDirectory = fontsPath;
xls_global_info->password = password;
XLS::CFStreamCacheReader stream_reader(cfile.getWorkbookStream(), xls_global_info);
XLS::CFStreamCacheReader stream_reader(xls_file->getWorkbookStream(), xls_global_info);
xls_document = boost::shared_ptr<XLS::WorkbookStreamObject>(new XLS::WorkbookStreamObject(workbook_code_page));
@ -197,38 +197,38 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
if (xls_global_info->decryptor->IsVerify() == false) return;
}
if (cfile.storage_->isDirectory("_SX_DB_CUR"))
if (xls_file->storage_->isDirectory("_SX_DB_CUR"))
{
std::list<std::string> listStream = cfile.storage_->entries("_SX_DB_CUR");
std::list<std::string> listStream = xls_file->storage_->entries("_SX_DB_CUR");
int last_index = 0;
for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
{
XLS::CFStreamCacheReader pivot_cache_reader(cfile.getNamedStream("_SX_DB_CUR/" + *it), xls_global_info);
XLS::CFStreamCacheReader pivot_cache_reader(xls_file->getNamedStream("_SX_DB_CUR/" + *it), xls_global_info);
XLS::BaseObjectPtr pivot_cache = boost::shared_ptr<XLS::PIVOTCACHE>(new XLS::PIVOTCACHE());
XLS::BinReaderProcessor proc(pivot_cache_reader , pivot_cache.get() , true);
proc.mandatory(*pivot_cache.get());
int index = XmlUtils::GetHex(*it);
int index = XmlUtils::GetHex(*it); //hexadecimal digits uniquely identifying
xls_global_info->mapPivotCacheStream.insert(std::make_pair(index, pivot_cache));
last_index = index;
}
}
if (bMacros && cfile.storage_->isDirectory("_VBA_PROJECT_CUR"))
if (bMacros && xls_file->storage_->isDirectory("_VBA_PROJECT_CUR"))
{
std::wstring xl_path = xlsx_path + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(xl_path.c_str());
std::wstring sVbaProjectFile = xl_path + FILE_SEPARATOR_STR + L"vbaProject.bin";
POLE::Storage *storageVbaProject = new POLE::Storage(sVbaProjectFile.c_str());
POLE::Storage *storageVbaProject = new POLE::Storage(sVbaProjectFile.c_str());
if ((storageVbaProject) && (storageVbaProject->open(true, true)))
{
cfile.copy(0, "_VBA_PROJECT_CUR/", storageVbaProject, false);
xls_file->copy(0, "_VBA_PROJECT_CUR/", storageVbaProject, false);
storageVbaProject->close();
delete storageVbaProject;
@ -238,6 +238,27 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
}
else
bMacros = false;
XLS::CFStreamPtr controls = xls_file->getNamedStream("Ctls");
if(controls)
{
unsigned long size = controls->getStreamSize();
boost::shared_array<BYTE> buffer(new BYTE[size]);
controls->read(buffer.get(), size);
xls_global_info->controls_data = std::make_pair(buffer, size);
}
XLS::CFStreamPtr listdata = xls_file->getNamedStream("List Data");
if(listdata)
{
unsigned long size = controls->getStreamSize();
boost::shared_array<BYTE> buffer(new BYTE[size]);
listdata->read(buffer.get(), size);
xls_global_info->listdata_data = std::make_pair(buffer, size);
}
}
catch(...)
{
@ -340,6 +361,11 @@ void XlsConverter::convert(XLS::BaseObject *xls_unknown)
XLS::TxO * txo = dynamic_cast<XLS::TxO *>(xls_unknown);
convert(txo);
}break;
case XLS::typeObj:
{
XLS::Obj * obj = dynamic_cast<XLS::Obj *>(xls_unknown);
convert(obj);
}break;
case XLS::typeAnyObject:
default:
{
@ -673,7 +699,6 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
bool res = false;
std::wstring file_name = L"image" + std::to_wstring(id);
if (type_ext == L"dib_data")
{
bool bPNG = false;
@ -925,17 +950,6 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
if (type_object == 0)
continue;
//{
// _group_object gr;
// if (group_objects.back().ind < group_objects.back().spgr->child_records.size())
// {
// gr.spgr = dynamic_cast<ODRAW::OfficeArtSpgrContainer*>(group_objects.back().spgr->child_records[group_objects.back().ind++].get());
// gr.count = gr.spgr->child_records.size();
// group_objects.push_back(gr);
// }
// else //сюда попадать не должно !!!!
// continue;
//}
if (xlsx_context->get_drawing_context().start_drawing(type_object))
{
@ -954,9 +968,9 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
{
convert(obj->old_version.additional[i].get());
}
convert(image_obj);
convert(chart);
convert(obj);
xlsx_context->get_drawing_context().end_drawing();
}
@ -965,13 +979,6 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
elem++;
count++;
}
//while ((group_objects.size() >0) && (group_objects.back().ind >= group_objects.back().count))
//{
// group_objects.back().spgr = NULL;
// group_objects.pop_back();
//
// xlsx_context->get_drawing_context().end_group();
//}
}
}
void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * sheet)
@ -1033,7 +1040,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
if (text_obj)
{
if (type_object <0) type_object = 0x0006;
if (type_object < 0) type_object = 0x0006;
}
//-----------------------------------------------------------------------------
@ -1086,6 +1093,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
}
convert(text_obj);
convert(chart);
convert(obj);
xlsx_context->get_drawing_context().end_drawing();
}
@ -1107,7 +1115,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
void XlsConverter::convert(ODRAW::OfficeArtSpgrContainer * spgr)
{
if (spgr == NULL) return;
if (spgr->anchor_type_ != ODRAW::OfficeArtRecord::CA_HF) return; //todooo проверить что тока для header/footer это нужно
if (spgr->anchor_type_ != ODRAW::OfficeArtRecord::CA_HF) return;
for (size_t i = 0; i < spgr->child_records.size(); i++)
{
@ -1115,7 +1123,7 @@ void XlsConverter::convert(ODRAW::OfficeArtSpgrContainer * spgr)
if (xlsx_context->get_drawing_context().start_drawing(type_object))
{
xlsx_context->get_drawing_context().set_mode_vmlwrite(true);
xlsx_context->get_drawing_context().set_mode_HF(true);
convert(spgr->child_records[i].get());
xlsx_context->get_drawing_context().end_drawing();
@ -1507,7 +1515,7 @@ void XlsConverter::convert_blip(std::vector<ODRAW::OfficeArtFOPTEPtr> & props)
std::wstring target;
int id = props[i]->op;
if (xlsx_context->get_drawing_context().get_mode_vmlwrite())
if (xlsx_context->get_drawing_context().get_mode_HF())
id += 3000;
std::wstring rId = xlsx_context->get_mediaitems().find_image(id , target, isIternal);
@ -1882,14 +1890,10 @@ void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings)
}
}
}
void XlsConverter::convert(XLS::TxO * text_obj)
{
if (text_obj == NULL) return;
std::wstringstream strm;
text_obj->serialize(strm);
int rot = text_obj->rot;
if (rot > 0)
@ -1921,7 +1925,89 @@ void XlsConverter::convert(XLS::TxO * text_obj)
xlsx_context->get_drawing_context().set_text_align (text_obj->hAlignment);
xlsx_context->get_drawing_context().set_text_vert_align (text_obj->vAlignment);
std::wstringstream strm, strm_vml;
text_obj->serialize(strm);
xlsx_context->get_drawing_context().set_text(strm.str());
text_obj->serialize_vml(strm_vml);
xlsx_context->get_drawing_context().set_text_vml(strm_vml.str());
}
void XlsConverter::convert(XLS::Obj * obj)
{
if ( obj == NULL ) return;
//controls & objects
if ( obj->cmo.ot == 8 && obj->pictFmla.fExist && obj->pictFlags.fExist)
{
std::wstring info;
if (obj->pictFmla.fmla.bFmlaExist)
{
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)
{
}
bool full_ref = false;
if (obj->cmo.ot > 0x06) full_ref = true;
if (obj->linkFmla.fExist && obj->linkFmla.fmla.bFmlaExist)
{
std::wstring link = obj->linkFmla.fmla.fmla.getAssembledFormula(full_ref);
xlsx_context->get_drawing_context().set_object_link(link);
}
if (obj->macro.fExist && obj->macro.fmla.bFmlaExist)
{
std::wstring macro = obj->macro.fmla.fmla.getAssembledFormula(full_ref);
xlsx_context->get_drawing_context().set_macro(macro);
}
}
void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream * chart)

View File

@ -48,9 +48,12 @@ namespace oox
}
namespace XLS
{
class BaseObject;
class BiffStructure;
class CompoundFile;
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
class BaseObject;
typedef boost::shared_ptr<BaseObject> BaseObjectPtr;
class GlobalWorkbookInfo;
@ -76,6 +79,7 @@ namespace XLS
class Note;
class TxO;
class Obj;
}
namespace ODRAW
@ -94,7 +98,7 @@ namespace ODRAW
class XlsConverter
{
public:
XlsConverter(const std::wstring & xls_file, const std::wstring & xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack, bool & bMacros);
XlsConverter(const std::wstring & xlsFileName, const std::wstring & xlsxFilePath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack, bool & bMacros);
~XlsConverter() ;
oox::xlsx_conversion_context * xlsx_context;
@ -118,6 +122,7 @@ public:
void convert(XLS::OBJECTS * objects, XLS::WorksheetSubstream * sheet);
void convert(XLS::MSODRAWINGGROUP * mso_drawing);
void convert(XLS::TxO * text_obj);
void convert(XLS::Obj * obj);
void convert(XLS::Note * note);
void convert(XLS::IMDATA * imadata);
void convert(XLS::PIVOTVIEW * pivot_view);
@ -163,4 +168,6 @@ private:
XLS::BaseObjectPtr xls_document;
XLS::GlobalWorkbookInfoPtr xls_global_info;
XLS::CompoundFilePtr xls_file;
};

View File

@ -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 ++)
@ -169,6 +191,35 @@ void external_items::create_media_path(const std::wstring & out_path)
media_path_ = xl_path + FILE_SEPARATOR_STR + L"media" + FILE_SEPARATOR_STR;
}
std::wstring external_items::activeX_path()
{
return activeX_path_;
}
void external_items::create_activeX_path(const std::wstring & out_path)
{
if (!activeX_path_.empty()) return;
std::wstring xl_path = out_path + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(xl_path.c_str());
NSDirectory::CreateDirectory((xl_path + FILE_SEPARATOR_STR + L"activeX").c_str());
activeX_path_ = xl_path + FILE_SEPARATOR_STR + L"activeX" + FILE_SEPARATOR_STR;
}
void external_items::create_embeddings_path(const std::wstring & out_path)
{
if (!embeddings_path_.empty()) return;
std::wstring xl_path = out_path + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(xl_path.c_str());
NSDirectory::CreateDirectory((xl_path + FILE_SEPARATOR_STR + L"embeddings").c_str());
embeddings_path_ = xl_path + FILE_SEPARATOR_STR + L"embeddings" + FILE_SEPARATOR_STR;
}
std::wstring external_items::embeddings_path()
{
return embeddings_path_;
}
}

View File

@ -41,16 +41,33 @@ class rels;
class external_items
{
public:
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeTable, typeHyperlink, typeComment, typeMedia, typeGroup, typeExternalLink};
enum Type
{
typeUnknown = 0,
typeImage,
typeChart,
typeShape,
typeTable,
typeHyperlink,
typeComment,
typeMedia,
typeGroup,
typeExternalLink,
typeOleObject,
typeActiveX,
typeControl
};
external_items()
{
count_charts =0;
count_shape =0;
count_image =0;
count_tables =0;
count_media =0;
count_charts = 0;
count_shape = 0;
count_image = 0;
count_tables = 0;
count_media = 0;
count_activeX = 0;
count_embeddings= 0;
count_controls = 0;
}
struct item
@ -76,10 +93,14 @@ public:
size_t count_media;
size_t count_shape;
size_t count_tables;
size_t count_activeX;
size_t count_embeddings;
size_t count_controls;
//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);
@ -88,13 +109,20 @@ public:
items_array & items() { return items_; }
void create_media_path(const std::wstring & out_path);
void create_activeX_path(const std::wstring & out_path);
void create_embeddings_path(const std::wstring & out_path);
std::wstring activeX_path();
std::wstring media_path();
std::wstring embeddings_path();
private:
std::wstring create_file_name(const std::wstring & uri, external_items::Type type, size_t Num);
std::wstring media_path_;
std::wstring activeX_path_;
std::wstring embeddings_path_;
items_array items_;
};

View File

@ -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);
}
}
}

View File

@ -152,7 +152,10 @@ void xlsx_conversion_context::end_external()
void xlsx_conversion_context::end_table()
{
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks());
get_table_context().serialize_ole_objects(current_sheet().ole_objects());
get_table_context().dump_rels_ole_objects(current_sheet().sheet_rels());
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks());
get_table_context().dump_rels_hyperlinks(current_sheet().sheet_rels());
get_table_context().end_table();

View File

@ -46,6 +46,155 @@
namespace oox {
class PathParser
{
public:
PathParser (std::vector<ODRAW::MSOPATHINFO> &arSegments, std::vector<ODRAW::MSOPOINT>& arPoints, std::vector<ODRAW::MSOSG> & arGuides)
: m_arSegments(arSegments)
{
LONG lMinF = (_INT32)0x80000000;
POINT point;
for (size_t i = 0; i < arPoints.size(); i++)
{
point.x = arPoints[i].x;
point.y = arPoints[i].y;
if (lMinF <= point.x)
{
int index = (_UINT32)point.x - 0x80000000;
if (index >= 0 && index < arGuides.size())
{
point.x = arGuides[index].m_param_value3;
}
}
if (lMinF <= point.y)
{
int index = (_UINT32)point.y - 0x80000000;
if (index >= 0 && index < arGuides.size())
{
point.y = arGuides[index].m_param_value3;
}
}
if ((size_t)point.y > 0xffff) point.y &= 0xffff;
if ((size_t)point.x > 0xffff) point.x &= 0xffff;
m_arPoints.push_back(point);
}
}
inline std::wstring GetVmlPath () const
{
if (m_arSegments.empty() && m_arPoints.empty())
return std::wstring(L"");
std::wstring strVmlPath;
size_t valuePointer = 0;
if (m_arSegments.empty())
{
for (size_t i = 0; i < m_arPoints.size(); ++i)
{
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[i].x);
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[i].y);
++valuePointer;
}
strVmlPath += L"xe";
return strVmlPath;
}
for (size_t i = 0; i < m_arSegments.size(); i++)
{
switch (m_arSegments[i].m_eRuler)
{
case NSCustomShapesConvert::rtLineTo:
{
for (_UINT16 i = 0; i < m_arSegments[i].m_nCount; ++i)
{
if (valuePointer + 1 > m_arPoints.size())
{
break;
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[0].y);
++valuePointer;
}
else
{
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
++valuePointer;
}
}
}break;
case NSCustomShapesConvert::rtCurveTo:
{
for (_UINT16 i = 0; i < m_arSegments[i].m_nCount; ++i)
{
if (valuePointer + 3 > m_arPoints.size())
break;
strVmlPath += L"c";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 1].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 1].y );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 2].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 2].y );
valuePointer += 3;
}
}break;
case NSCustomShapesConvert::rtMoveTo:
{
if (valuePointer < m_arPoints.size())
{
strVmlPath += L"m";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
++valuePointer;
}
}
break;
case NSCustomShapesConvert::rtClose:
{
strVmlPath += L"x";
}
break;
case NSCustomShapesConvert::rtEnd:
{
strVmlPath += L"e";
}break;
}
}
if ( !strVmlPath.empty() && ( strVmlPath[strVmlPath.size() - 1] != L'e' ) )
strVmlPath +=L"e";
return strVmlPath;
}
private:
std::vector<ODRAW::MSOPATHINFO> &m_arSegments;
std::vector<POINT> m_arPoints;
};
//-----------------------------------------------------------------------------------------------------------
const static std::wstring shemeColor[18] =
{L"accent1",L"accent2",L"accent3",L"accent4",L"accent5",L"accent6",L"bk1",L"bk2",L"dk1",L"dk2",L"folHlink",L"hlink",L"lt1",L"lt2",L"none", L"tx1",L"tx2",L"phClr"};
@ -284,11 +433,12 @@ _color xlsx_drawing_context::CorrectSysColor(int nColorCode, _drawing_state_ptr
//}
return color;
}
//-----------------------------------------------------------------------------------------------------------
xlsx_drawing_context::xlsx_drawing_context(xlsx_conversion_context & Context) : context_(Context), handle_(Context.get_drawing_context_handle())
, rels_ (xlsx_drawings_rels::create())
, vml_HF_rels_ (xlsx_drawings_rels::create())
, vml_comments_rels_(xlsx_drawings_rels::create())
, vml_rels_(xlsx_drawings_rels::create())
, sheet_rels_ (xlsx_drawings_rels::create())
{
in_chart_ = false;
count_object = 0;
@ -325,10 +475,9 @@ bool xlsx_drawing_context::start_drawing(int type)
case 0x0010: // Spin control
case 0x0012: // List
case 0x0013: // Group box
start_shape(0x0002); return true;
case 0x0011: // Scrollbar
case 0x0014: // Dropdown list
break;
start_control(type); return true;
case 0x0019: // Note
start_comment(); return true;
break;
@ -356,6 +505,7 @@ void xlsx_drawing_context::start_image()
current_drawing_states->push_back(create_drawing_state());
current_drawing_states->back()->type = external_items::typeImage;
current_drawing_states->back()->type_control = 0x0008;
count_object++;
}
@ -366,9 +516,12 @@ void xlsx_drawing_context::start_comment()
current_drawing_states->push_back(create_drawing_state());
current_drawing_states->back()->type = external_items::typeComment;
//current_drawing_states->back()->vmlwrite_mode_ = true; это только для HF !!!
current_drawing_states->back()->type = external_items::typeComment;
current_drawing_states->back()->shape_id = MSOSPT::msosptRectangle;
current_drawing_states->back()->type_control = 0x0019;
current_drawing_states->back()->object.visible = false;
count_object++;
context_.get_comments_context().start_comment();
@ -388,6 +541,7 @@ void xlsx_drawing_context::start_group()
current_drawing_states->push_back(newState);
current_drawing_states->back()->type = external_items::typeGroup;
current_drawing_states->back()->type_control = 0x0000;
}
void xlsx_drawing_context::end_group()
{
@ -411,7 +565,19 @@ void xlsx_drawing_context::start_chart()
in_chart_ = true;
count_object++;
}
void xlsx_drawing_context::start_control(int type)
{
if (current_drawing_states == NULL) return;
current_drawing_states->push_back(create_drawing_state());
current_drawing_states->back()->type = external_items::typeControl;
current_drawing_states->back()->shape_id = MSOSPT::msosptRectangle;
current_drawing_states->back()->type_control = type;
count_object++;
}
void xlsx_drawing_context::start_shape(int type)
{
if (current_drawing_states == NULL) return;
@ -419,6 +585,7 @@ void xlsx_drawing_context::start_shape(int type)
current_drawing_states->push_back(create_drawing_state());
current_drawing_states->back()->type = external_items::typeShape;
current_drawing_states->back()->type_control = type;
switch(type)
{
@ -464,14 +631,14 @@ void xlsx_drawing_context::set_shape_id(int id)
current_drawing_states->back()->shape_id = (MSOSPT)id;
}
void xlsx_drawing_context::set_object_visible (bool val)
void xlsx_drawing_context::set_object_visible(bool val)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->object.visible = val;
}
void xlsx_drawing_context::set_object_anchor (int col, int row)
void xlsx_drawing_context::set_object_anchor(int col, int row)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
@ -483,7 +650,13 @@ void xlsx_drawing_context::set_object_anchor (int col, int row)
void xlsx_drawing_context::set_object_id(int val)
{
}
void xlsx_drawing_context::set_object_link(const std::wstring & formula)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->object.link = formula;
}
void xlsx_drawing_context::end_drawing()
{
@ -494,17 +667,19 @@ void xlsx_drawing_context::end_drawing()
end_drawing(current_drawing_states->back());
if ( current_drawing_states->back()->type == external_items::typeComment )
if ( current_drawing_states->back()->type == external_items::typeComment ||
current_drawing_states->back()->type == external_items::typeControl )
{
drawing_states_vml_comments.push_back(current_drawing_states->back());
drawing_states_vml.push_back(current_drawing_states->back());
if (current_drawing_states->back()->type == external_items::typeComment)
current_drawing_states->pop_back();
}
else if (!current_drawing_states->back()->vml_shape.empty())
{ // && current_drawing_states->back()->vml_HF_mode_
drawing_states_vml_HF.push_back(current_drawing_states->back());
current_drawing_states->pop_back();
}
else
if (current_drawing_states->back()->vmlwrite_mode_)
{
drawing_states_vml_HF.push_back(current_drawing_states->back());
current_drawing_states->pop_back();
}
}
void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
@ -526,14 +701,22 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
serialize_pic(drawing_state, rId);
if (drawing_state->vmlwrite_mode_)
if (drawing_state->vml_HF_mode_)
{
vml_HF_rels_->add(isIternal, rId , drawing_state->fill.texture_target, drawing_state->type);
}
else
{
rels_->add(isIternal, rId , drawing_state->fill.texture_target, drawing_state->type);
}
}
else
drawing_state->type = external_items::typeShape;
}
if ( drawing_state->type == external_items::typeOleObject )
{
serialize_shape(drawing_state);
}
if ( drawing_state->type == external_items::typeChart )
{
//функциональная часть
@ -556,15 +739,18 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
{
context_.get_comments_context().set_content(drawing_state->text.content);
serialize_shape_comment(drawing_state);
serialize_vml_shape(drawing_state);
//context_.get_comments_context().set_shape_drawing(drawing_state->shape);
context_.get_comments_context().end_comment();
}
if ( drawing_state->type == external_items::typeShape)
{
serialize_shape(drawing_state);
}
if ( drawing_state->type == external_items::typeControl)
{
serialize_control(drawing_state);
}
}
void xlsx_drawing_context::serialize_group()
@ -595,7 +781,10 @@ void xlsx_drawing_context::serialize_group()
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty())
{
CP_XML_NODE(L"a:hlinkClick")
@ -632,7 +821,7 @@ void xlsx_drawing_context::serialize_group()
drawing_state->shape = strm.str();
}
void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_state)
void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_state)
{
std::wstringstream strm;
@ -643,18 +832,23 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
strmStyle << L"position:absolute;";
strmStyle << L"margin-left:" << std::to_wstring(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu)
strmStyle << L"margin-top:" << std::to_wstring(drawing_state->child_anchor.y / 12700.) << L"pt;";
strmStyle << L"width:" << std::to_wstring(drawing_state->child_anchor.cx / 12700.) << L"pt;";
strmStyle << L"height:" << std::to_wstring(drawing_state->child_anchor.cy / 12700.) << L"pt;";
strmStyle << L"z-index:" << std::to_wstring(drawing_state->id) << L";";
strmStyle << L"width:" << std::to_wstring(drawing_state->child_anchor.cx / 12700.) << L"pt;";
strmStyle << L"height:" << std::to_wstring(drawing_state->child_anchor.cy / 12700.) << L"pt;";
strmStyle << L"z-index:" << std::to_wstring(drawing_state->id) << L";";
if (drawing_state->object.visible == false)
strmStyle << L"visibility:hidden;";
CP_XML_NODE(L"v:shape")
{
//CP_XML_ATTR(L"id" , std::to_wstring(drawing_state->object.id));
CP_XML_ATTR(L"type" , L"_x0000_t202");
CP_XML_ATTR(L"fillcolor" , L"#" + drawing_state->fill.color.sRGB);
CP_XML_ATTR(L"id", L"_x0000_s" + std::to_wstring(drawing_state->id));
if (drawing_state->shape_id != msosptNotPrimitive)
{
CP_XML_ATTR(L"type", L"#_x0000_t" + std::to_wstring(drawing_state->shape_id));
CP_XML_ATTR(L"o:spt", drawing_state->shape_id);
}
CP_XML_ATTR(L"fillcolor", L"#" + drawing_state->fill.color.sRGB);
if (drawing_state->line.width > 0)
{
@ -662,6 +856,32 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
}
CP_XML_ATTR(L"style", strmStyle.str());
if (!current_drawing_states->back()->custom_verticles.empty() &&
!current_drawing_states->back()->custom_segments.empty())
{
PathParser oParser (current_drawing_states->back()->custom_segments, current_drawing_states->back()->custom_verticles, current_drawing_states->back()->custom_guides);
std::wstring path = oParser.GetVmlPath();
if (false == path.empty())
CP_XML_ATTR(L"path", path);
}
if (drawing_state->type == external_items::typeControl)
{
CP_XML_ATTR(L"o:button", L"t");
}
if (drawing_state->line.fill.type == fillNone)
{
CP_XML_ATTR(L"stroked", L"f");
}
if (drawing_state->line.fill.type == fillNone)
{
CP_XML_ATTR(L"stroked", L"f");
}
if (drawing_state->fill.type == fillNone)
{
CP_XML_ATTR(L"filled", L"f");
}
//----------------------------------------------------------------------------------------------
CP_XML_NODE(L"v:shadow")
{
CP_XML_ATTR(L"color", L"black");
@ -688,7 +908,14 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
CP_XML_ATTR(L"o:relid" , rId);
CP_XML_ATTR(L"type" , L"tile");
vml_comments_rels_->add(isIternal, rId , drawing_state->fill.texture_target, external_items::typeImage);
if (current_drawing_states->back()->vml_HF_mode_ )
{
vml_HF_rels_->add(isIternal, rId , drawing_state->fill.texture_target, external_items::typeImage);
}
else
{
vml_rels_->add(isIternal, rId , drawing_state->fill.texture_target, external_items::typeImage);
}
}
else if (drawing_state->fill.type == fillGradient || drawing_state->fill.type == fillGradientOne)
{
@ -717,10 +944,43 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
case lineDashDot: CP_XML_ATTR(L"dashstyle", L"dashDot"); break;
case lineDashDotDot:CP_XML_ATTR(L"dashstyle", L"lgDashDotDot"); break;
}
}
}
if (!drawing_state->text.vml_content.empty())
{
CP_XML_NODE(L"v:textbox")
{
//style='mso-direction-alt:auto'
//o:singleclick="f"
CP_XML_STREAM() << drawing_state->text.vml_content;
}
}
CP_XML_NODE(L"x:ClientData")
{
CP_XML_ATTR(L"ObjectType", L"Note");
switch(drawing_state->type_control)
{
case 0x0000: CP_XML_ATTR(L"ObjectType", L"Group"); break;
case 0x0001: CP_XML_ATTR(L"ObjectType", L"Shape"); break; // Line
case 0x0002: CP_XML_ATTR(L"ObjectType", L"Rect"); break;
case 0x0003: CP_XML_ATTR(L"ObjectType", L"Shape"); break; // Oval
case 0x0004: CP_XML_ATTR(L"ObjectType", L"Shape"); break; // Arc
case 0x0006: CP_XML_ATTR(L"ObjectType", L"Shape"); break; // Text
case 0x0007: CP_XML_ATTR(L"ObjectType", L"Button"); break;
case 0x0008: CP_XML_ATTR(L"ObjectType", L"Pict"); break;
case 0x0009: CP_XML_ATTR(L"ObjectType", L"Shape"); break; // Polygon:
case 0x000B: CP_XML_ATTR(L"ObjectType", L"Checkbox"); break;
case 0x000C: CP_XML_ATTR(L"ObjectType", L"Radio"); break;
case 0x000D: CP_XML_ATTR(L"ObjectType", L"Edit"); break;
case 0x000E: CP_XML_ATTR(L"ObjectType", L"Label"); break;
case 0x000F: CP_XML_ATTR(L"ObjectType", L"Dialog"); break;
case 0x0010: CP_XML_ATTR(L"ObjectType", L"Spin"); break;
case 0x0012: CP_XML_ATTR(L"ObjectType", L"List"); break;
case 0x0013: CP_XML_ATTR(L"ObjectType", L"GBox"); break;
case 0x0011: CP_XML_ATTR(L"ObjectType", L"Scroll"); break;
case 0x0014: CP_XML_ATTR(L"ObjectType", L"Drop"); break;
case 0x001E: CP_XML_ATTR(L"ObjectType", L"Shape"); break; // OfficeArt object
case 0x0019: CP_XML_ATTR(L"ObjectType", L"Note"); break;
default: break;
}
CP_XML_NODE(L"x:MoveWithCells"){}
CP_XML_NODE(L"x:SizeWithCells"){}
@ -740,16 +1000,22 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
CP_XML_NODE(L"x:AutoFill") {CP_XML_CONTENT("False");}
CP_XML_NODE(L"x:Row") {CP_XML_CONTENT(drawing_state->object.row);}
CP_XML_NODE(L"x:Column") {CP_XML_CONTENT(drawing_state->object.col);}
if (drawing_state->object.visible) CP_XML_NODE(L"x:Visible");
if (!drawing_state->object.macro.empty())
{
CP_XML_NODE(L"x:FmlaMacro"){CP_XML_CONTENT(drawing_state->object.macro);}
}
if (!drawing_state->object.link.empty() )
{
CP_XML_NODE(L"x:FmlaLink"){CP_XML_CONTENT(drawing_state->object.link);}
}
}
}
}
drawing_state->shape = strm.str();
}
void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_state)
{
drawing_state->vml_shape = strm.str();
}
void xlsx_drawing_context::serialize_vml_pic(_drawing_state_ptr & drawing_state, std::wstring rId)
{
@ -782,12 +1048,12 @@ void xlsx_drawing_context::serialize_vml_pic(_drawing_state_ptr & drawing_state,
}
}
}
drawing_state->shape = strm.str();
drawing_state->vml_shape = strm.str();
}
void xlsx_drawing_context::serialize_pic(_drawing_state_ptr & drawing_state, std::wstring rId)
{
if (drawing_state->vmlwrite_mode_)
if (drawing_state->vml_HF_mode_)
return serialize_vml_pic(drawing_state, rId);
std::wstringstream strm;
@ -796,20 +1062,25 @@ void xlsx_drawing_context::serialize_pic(_drawing_state_ptr & drawing_state, std
{
CP_XML_NODE(L"xdr:pic")
{
CP_XML_ATTR(L"macro", drawing_state->object.macro);
CP_XML_NODE(L"xdr:nvPicPr")
{
CP_XML_NODE(L"xdr:cNvPr")
{
CP_XML_ATTR(L"id", drawing_state->id);
if (drawing_state->name.empty())
drawing_state->name = L"Picture_" + rId.substr(5);
CP_XML_ATTR(L"name", drawing_state->name);
CP_XML_ATTR(L"name", drawing_state->name);
if (!drawing_state->description.empty())
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty())
{
@ -872,6 +1143,10 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
}
CP_XML_NODE(L"xdr:cNvGraphicFramePr");
@ -897,10 +1172,73 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
}
drawing_state->shape = strm.str();
}
void xlsx_drawing_context::serialize_control(_drawing_state_ptr & drawing_state)
{
std::wstringstream strm;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"xdr:sp")
{
CP_XML_NODE(L"xdr:nvSpPr")
{
CP_XML_NODE(L"xdr:cNvPr")
{
CP_XML_ATTR(L"id", drawing_state->id);
if (drawing_state->name.empty())
{
drawing_state->name = L"Control_" + std::to_wstring(count_object);
}
CP_XML_ATTR(L"name", drawing_state->name);
if (!drawing_state->description.empty())
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
CP_XML_ATTR(L"hidden", 1);
CP_XML_NODE(L"a:extLst")
{
CP_XML_NODE(L"a:ext")
{
CP_XML_ATTR(L"uri", L"{63B3BB69-23CF-44E3-9099-C40C66FF867C}");
CP_XML_ATTR(L"xmlns:a14", L"http://schemas.microsoft.com/office/drawing/2010/main");
CP_XML_NODE(L"a14:compatExt")
{
CP_XML_ATTR(L"spid", L"_x0000_s" + std::to_wstring(drawing_state->id));
}
}
}
}
CP_XML_NODE(L"xdr:cNvSpPr");
}
CP_XML_NODE(L"xdr:spPr")
{
serialize_xfrm(CP_XML_STREAM(), drawing_state);
CP_XML_NODE(L"a:prstGeom")
{
CP_XML_ATTR(L"prst", L"rect");
if (!drawing_state->wordart.is) CP_XML_NODE(L"a:avLst");
}
CP_XML_NODE(L"a:noFill");
CP_XML_NODE(L"a:ln")
{
CP_XML_NODE(L"a:noFill");
}
}
serialize_text(CP_XML_STREAM(), drawing_state);
}
}
drawing_state->shape = strm.str();
serialize_vml_shape(drawing_state);
}
void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{
if (drawing_state->vmlwrite_mode_)
if (drawing_state->vml_HF_mode_)
return serialize_vml_shape(drawing_state);
std::wstringstream strm;
@ -932,6 +1270,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{
CP_XML_NODE(L"xdr:sp")
{
CP_XML_ATTR(L"macro", drawing_state->object.macro);
CP_XML_NODE(L"xdr:nvSpPr")
{
CP_XML_NODE(L"xdr:cNvPr")
@ -942,6 +1282,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{
if (drawing_state->wordart.is)
drawing_state->name = L"WordArt_" + std::to_wstring(count_object);
else if ( drawing_state->type == external_items::typeOleObject )
drawing_state->name = L"Object_" + std::to_wstring(count_object);
else
drawing_state->name = L"Shape_" + std::to_wstring(count_object);
}
@ -951,7 +1293,10 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty())
{
CP_XML_NODE(L"a:hlinkClick")
@ -961,6 +1306,22 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
CP_XML_ATTR(L"r:id", drawing_state->hyperlink);
}
}
//if ( drawing_state->type == external_items::typeOleObject ) + VmlDrawing
//{
// CP_XML_NODE(L"a:extLst")
// {
// CP_XML_NODE(L"a:ext")
// {
// CP_XML_ATTR(L"uri", L"{63B3BB69-23CF-44E3-9099-C40C66FF867C}");
// CP_XML_ATTR(L"xmlns:a14", L"http://schemas.microsoft.com/office/drawing/2010/main");
// CP_XML_NODE(L"a14:compatExt")
// {
// CP_XML_ATTR(L"spid", L"_x0000_s" + std::to_wstring(drawing_state->id));
// }
// }
// }
//}
}
CP_XML_NODE(L"xdr:cNvSpPr")
{
@ -1338,20 +1699,20 @@ void xlsx_drawing_context::serialize_gradient_fill(std::wostream & stream, _draw
}
}
void xlsx_drawing_context::serialize_anchor (std::wostream & stream, _drawing_state_ptr & drawing_state)
void xlsx_drawing_context::serialize_anchor (std::wostream & stream, _drawing_state_ptr & drawing_state, std::wstring ns)
{
CP_XML_WRITER(stream)
{
if (drawing_state->type_anchor == 1)
{
CP_XML_NODE(L"xdr:from")
CP_XML_NODE(ns + L"from")
{
CP_XML_NODE(L"xdr:col") { CP_XML_CONTENT (drawing_state->sheet_anchor.colFrom); }
CP_XML_NODE(L"xdr:colOff") { CP_XML_CONTENT (drawing_state->sheet_anchor.xFrom) ; }
CP_XML_NODE(L"xdr:row") { CP_XML_CONTENT (drawing_state->sheet_anchor.rwFrom); }
CP_XML_NODE(L"xdr:rowOff") { CP_XML_CONTENT (drawing_state->sheet_anchor.yFrom) ; }
}
CP_XML_NODE(L"xdr:to")
CP_XML_NODE(ns + L"to")
{
CP_XML_NODE(L"xdr:col") { CP_XML_CONTENT (drawing_state->sheet_anchor.colTo); }
CP_XML_NODE(L"xdr:colOff") { CP_XML_CONTENT (drawing_state->sheet_anchor.xTo); }
@ -1361,12 +1722,12 @@ void xlsx_drawing_context::serialize_anchor (std::wostream & stream, _drawing_st
}
if (drawing_state->type_anchor == 3)
{
CP_XML_NODE(L"xdr:pos")//in emu (1 pt = 12700)
CP_XML_NODE(ns + L"pos")//in emu (1 pt = 12700)
{
CP_XML_ATTR(L"x", (int)(drawing_state->absolute_anchor.x * 12700));
CP_XML_ATTR(L"y", (int)(drawing_state->absolute_anchor.y * 12700));
}
CP_XML_NODE(L"xdr:ext") //in emu (1 pt = 12700)
CP_XML_NODE(ns + L"ext") //in emu (1 pt = 12700)
{
CP_XML_ATTR(L"cx", (int)(drawing_state->absolute_anchor.cx * 12700));
CP_XML_ATTR(L"cy", (int)(drawing_state->absolute_anchor.cy * 12700));
@ -1708,11 +2069,6 @@ void xlsx_drawing_context::serialize_bitmap_fill(std::wostream & stream, _drawin
}
}
void xlsx_drawing_context::serialize_vml(std::wostream & stream, _drawing_state_ptr & drawing_state)
{
stream << drawing_state->shape;
}
void xlsx_drawing_context::serialize(std::wostream & stream, _drawing_state_ptr & drawing_state)
{
if (drawing_state->type_anchor == 0) return;
@ -1739,6 +2095,46 @@ void xlsx_drawing_context::serialize(std::wostream & stream, _drawing_state_ptr
}
}
}
void xlsx_drawing_context::serialize_object(std::wostream & stream, _drawing_state_ptr & drawing_state)
{
if (drawing_state->type != external_items::typeOleObject) return;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"oleObject")
{
if (!drawing_state->objectProgId.empty())
{
CP_XML_ATTR(L"progId", drawing_state->objectProgId);
}
CP_XML_ATTR(L"shapeId", drawing_state->id);
CP_XML_ATTR(L"r:id", drawing_state->objectId);
CP_XML_NODE(L"objectPr")
{
CP_XML_ATTR(L"defaultSize", 0);
//CP_XML_ATTR(L"autoPict", 0);
if (!drawing_state->fill.texture_target.empty())
{
bool isIternal = false;
std::wstring rId = handle_.impl_->get_mediaitems().find_image( drawing_state->fill.texture_target, isIternal);
CP_XML_ATTR(L"r:id", rId);
sheet_rels_->add(isIternal, rId , drawing_state->fill.texture_target, external_items::typeImage);
}
CP_XML_NODE(L"anchor")
{
CP_XML_ATTR(L"moveWithCells", 1);
serialize_anchor(CP_XML_STREAM(), drawing_state, L"");
}
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------
void xlsx_drawing_context::set_name(const std::wstring & str)
{
@ -1752,6 +2148,21 @@ void xlsx_drawing_context::set_description(const std::wstring & str)
current_drawing_states->back()->description = str;
}
void xlsx_drawing_context::set_macro(const std::wstring & str)
{
if (current_drawing_states == NULL) return;
current_drawing_states->back()->object.macro = str;
}
void xlsx_drawing_context::set_ole_object(const std::wstring & id, const std::wstring & info)
{
if (current_drawing_states == NULL) return;
current_drawing_states->back()->type = external_items::typeOleObject;
current_drawing_states->back()->objectId = id;
current_drawing_states->back()->objectProgId = info;
}
void xlsx_drawing_context::set_sheet_anchor(int colFrom, int xFrom, int rwFrom, int yFrom, int colTo, int xTo, int rwTo,int yTo)
{
if (current_drawing_states == NULL) return;
@ -2351,6 +2762,13 @@ void xlsx_drawing_context::set_text (const std::wstring & text)
current_drawing_states->back()->text.content = text;
}
void xlsx_drawing_context::set_text_vml (const std::wstring & text)
{
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->text.vml_content = text;
}
void xlsx_drawing_context::set_text_wrap (int val)
{
if (current_drawing_states == NULL) return;
@ -2452,25 +2870,29 @@ void xlsx_drawing_context::set_custom_y_limo(int val)
current_drawing_states->back()->custom_y_limo = val;
}
//----------------------------------------------------------------------------------------------------------
bool xlsx_drawing_context::get_mode_vmlwrite ()
bool xlsx_drawing_context::get_mode_HF ()
{//comment, shapes in header/footer, ....
if (current_drawing_states == NULL) return false;
if (current_drawing_states->empty()) return false;
return current_drawing_states->back()->vmlwrite_mode_;
return current_drawing_states->back()->vml_HF_mode_;
}
void xlsx_drawing_context::set_mode_vmlwrite (bool val)
void xlsx_drawing_context::set_mode_HF (bool val)
{//comment, shapes in header/footer, ....
if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return;
current_drawing_states->back()->vmlwrite_mode_ = val;
current_drawing_states->back()->vml_HF_mode_ = val;
}
//----------------------------------------------------------------------------------------------------------
bool xlsx_drawing_context::empty()
{
return drawing_states.empty();
}
bool xlsx_drawing_context::empty_vml()
{
return drawing_states_vml.empty();
}
bool xlsx_drawing_context::empty_vml_HF()
{
return drawing_states_vml_HF.empty();
@ -2483,9 +2905,13 @@ xlsx_drawings_rels_ptr xlsx_drawing_context::get_vml_HF_rels()
{
return vml_HF_rels_;
}
xlsx_drawings_rels_ptr xlsx_drawing_context::get_vml_comments_rels()
xlsx_drawings_rels_ptr xlsx_drawing_context::get_vml_rels()
{
return vml_comments_rels_;
return vml_rels_;
}
xlsx_drawings_rels_ptr xlsx_drawing_context::get_sheet_rels()
{
return sheet_rels_;
}
bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::wstring sRgbColor2, _drawing_state_ptr & drawing_state)
{
@ -2500,7 +2926,16 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::
return bgraFrame.ReColorPatternImage(image_path, rgbColor1, rgbColor2);
}
void xlsx_drawing_context::serialize_objects(std::wostream & strm)
{
for (size_t i = 0; i < drawing_states.size(); i++)
{
if (drawing_states[i]->type != external_items::typeOleObject) continue;
serialize_object(strm, drawing_states[i]);
}
}
//-------------------------------------------------------------------------------------------------------------------
void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
{
CP_XML_WRITER(strm)
@ -2513,13 +2948,13 @@ void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
for (size_t i = 0 ; i < drawing_states_vml_HF.size(); i++)
{
serialize_vml(CP_XML_STREAM(), drawing_states_vml_HF[i]);
CP_XML_STREAM() << drawing_states_vml_HF[i]->vml_shape;
}
}
}
}
void xlsx_drawing_context::serialize_vml_comments(std::wostream & strm)
void xlsx_drawing_context::serialize_vml(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
@ -2529,27 +2964,9 @@ void xlsx_drawing_context::serialize_vml_comments(std::wostream & strm)
CP_XML_ATTR(L"xmlns:o" , L"urn:schemas-microsoft-com:office:office");
CP_XML_ATTR(L"xmlns:x" , L"urn:schemas-microsoft-com:office:excel");
CP_XML_NODE(L"v:shapetype")
for (size_t i = 0 ; i < drawing_states_vml.size(); i++)
{
CP_XML_ATTR(L"id" , L"_x0000_t202");
CP_XML_ATTR(L"coordsize", L"21600,21600");
CP_XML_ATTR(L"o:spt" , L"202");
CP_XML_ATTR(L"path" , L"m,l,21600r21600,l21600,xe");
CP_XML_NODE(L"v:stroke")
{
CP_XML_ATTR(L"joinstyle", L"miter");
}
CP_XML_NODE(L"v:path")
{
CP_XML_ATTR(L"gradientshapeok", L"t");
CP_XML_ATTR(L"o:connecttype", L"rect");
}
}
for (size_t i = 0 ; i < drawing_states_vml_comments.size(); i++)
{
serialize_vml(CP_XML_STREAM(), drawing_states_vml_comments[i]);
CP_XML_STREAM() << drawing_states_vml[i]->vml_shape;
}
}
@ -2565,6 +2982,7 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:mc" , L"http://schemas.openxmlformats.org/markup-compatibility/2006");
CP_XML_ATTR(L"xmlns:a14", L"http://schemas.microsoft.com/office/drawing/2010/main");
for (size_t i = 0 ; i < drawing_states.size(); i++)
{

View File

@ -135,31 +135,39 @@ public:
flipH(false), flipV(false),
bTextBox(false),
type_anchor(0),
vmlwrite_mode_(false)
vml_HF_mode_(false),
hidden(false)
{
id = -1;
rotation = 0;
parent_drawing_states = NULL;
custom_path = -1;
custom_x_limo = 0x80000000;
custom_y_limo = 0x80000000;
custom_y_limo = 0x80000000;
type_control = -1;
}
external_items::Type type;
bool hidden;
std::wstring name;
std::wstring description;
std::wstring objectId;
std::wstring objectProgId;
int type_control;
struct _anchor
{
_anchor() : colFrom(-1), rwFrom(-1), colTo(-1), rwTo(0), xFrom(0), yFrom(0),xTo(0),yTo(0){}
int colFrom;
int xFrom;
int rwFrom;
int yFrom;
int colTo;
int xTo;
int rwTo;
int yTo;
int colFrom = -1;
int xFrom = 0;
int rwFrom = -1;
int yFrom = 0;
int colTo = 0;
int xTo = 0;
int rwTo = 0;
int yTo = 0;
} sheet_anchor;
_rect child_anchor;
_rect group_anchor;
@ -167,8 +175,10 @@ public:
int type_anchor;
bool vmlwrite_mode_;
bool vml_HF_mode_;
std::wstring shape;
std::wstring vml_shape;
int id;
MSOSPT shape_id;
@ -199,7 +209,8 @@ public:
margins.left = margins.right = 0x00016530;
margins.top = margins.bottom = 0x0000b298;
}
std::wstring content; //c форматированием
std::wstring content; //c форматированием oox
std::wstring vml_content; //c форматированием vml
int wrap;
int align;
int vert_align;
@ -284,11 +295,13 @@ public:
}line;
struct _object
{
_object() {visible = false; col = row = 0; id = 0;}
_object() {visible = true; col = row = 0; id = 0;}
int id;
bool visible;
int col;
int row;
std::wstring macro;
std::wstring link;
}object;
//for group
std::vector<_drawing_state_ptr> drawing_states;
@ -312,9 +325,11 @@ public:
xlsx_drawings_rels_ptr get_rels();
xlsx_drawings_rels_ptr get_vml_HF_rels();
xlsx_drawings_rels_ptr get_vml_comments_rels();
xlsx_drawings_rels_ptr get_vml_rels();
xlsx_drawings_rels_ptr get_sheet_rels();
bool empty();
bool empty_vml();
bool empty_vml_HF();
void start_group();
@ -324,17 +339,20 @@ public:
void start_shape(int type);
void start_chart();
void start_comment();
void start_control(int type);
void set_id (int id);
void set_FlipH ();
void set_FlipV ();
void set_shape_id (int id);
//--------------------------------------------------------------------------------------
void set_mode_vmlwrite (bool val);
bool get_mode_vmlwrite ();
void set_mode_HF (bool val);
bool get_mode_HF ();
//--------------------------------------------------------------------------------------
void set_name (const std::wstring & str);
void set_description (const std::wstring & str);
void set_macro (const std::wstring & str);
void set_ole_object (const std::wstring & id, const std::wstring & info);
void set_crop_top (double val);
void set_crop_bottom (double val);
@ -384,6 +402,7 @@ public:
void set_hyperlink (const std::wstring & link, const std::wstring & display, bool is_external);
void set_text (const std::wstring & text);
void set_text_vml (const std::wstring & text);
void set_text_wrap (int val);
void set_text_align (int val);
void set_text_vert_align (int val);
@ -404,6 +423,7 @@ public:
void set_object_id (int val);
void set_object_visible (bool val);
void set_object_anchor (int col, int row);
void set_object_link (const std::wstring & text);
//---------------------------------------------------------------------------------------------
void set_custom_rect (_rect & rect);
void set_custom_verticles (std::vector<ODRAW::MSOPOINT> & points);
@ -422,8 +442,8 @@ public:
void serialize_shape (_drawing_state_ptr & drawing_state);
void serialize_chart (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_pic (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_shape_comment(_drawing_state_ptr & drawing_state); //part of vml shape
void serialize_object (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_control (_drawing_state_ptr & drawing_state);
//-----------------------------------------------------------------------------------
void serialize_vml_shape (_drawing_state_ptr & drawing_state);
void serialize_vml_pic (_drawing_state_ptr & drawing_state, std::wstring rId );
@ -432,10 +452,11 @@ public:
void serialize_fill (std::wostream & stream);
//-----------------------------------------------------------------------------------
void serialize (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_vml (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_object (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_objects (std::wostream & stream);
//-----------------------------------------------------------------------------------
void serialize_vml_HF (std::wostream & stream);
void serialize_vml_comments (std::wostream & stream);
void serialize_vml (std::wostream & stream);
void serialize (std::wostream & stream);
//-----------------------------------------------------------------------------------
bool is_lined_shape (_drawing_state_ptr & drawing_state);
@ -448,8 +469,9 @@ private:
xlsx_drawing_context_handle & handle_;
xlsx_drawings_rels_ptr rels_;
xlsx_drawings_rels_ptr vml_comments_rels_;
xlsx_drawings_rels_ptr vml_rels_;
xlsx_drawings_rels_ptr vml_HF_rels_;
xlsx_drawings_rels_ptr sheet_rels_;
int count_object;
bool in_chart_;
@ -457,7 +479,7 @@ private:
std::vector<_hlink_desc> hlinks_;
std::vector<_drawing_state_ptr> drawing_states_vml_HF;
std::vector<_drawing_state_ptr> drawing_states_vml_comments;
std::vector<_drawing_state_ptr> drawing_states_vml;
std::vector<_drawing_state_ptr> drawing_states;
std::vector<_drawing_state_ptr>* current_drawing_states;
@ -474,7 +496,7 @@ private:
void serialize_line (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_xfrm (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_anchor (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_anchor (std::wostream & stream, _drawing_state_ptr & drawing_state, std::wstring ns = L"xdr:");
void serialize_text (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_color (std::wostream & stream, const _color &color, double opacity = 0);

View File

@ -54,6 +54,7 @@ public:
std::wstringstream sheetFormatPr_;
std::wstringstream sheetData_;
std::wstringstream mergeCells_;
std::wstringstream ole_objects_;
std::wstringstream drawing_;
std::wstringstream hyperlinks_;
std::wstringstream comments_;
@ -77,8 +78,8 @@ public:
std::wstring vml_drawingName_;
std::wstring vml_drawingId_;
std::wstring vml_drawingName_HF_;
std::wstring vml_drawingId_HF_;
std::wstring vml_HF_drawingName_;
std::wstring vml_HF_drawingId_;
};
std::wstring xlsx_xml_worksheet::name() const
@ -132,6 +133,10 @@ std::wostream & xlsx_xml_worksheet::mergeCells()
{
return impl_->mergeCells_;
}
std::wostream & xlsx_xml_worksheet::ole_objects()
{
return impl_->ole_objects_;
}
std::wostream & xlsx_xml_worksheet::drawing()
{
@ -183,6 +188,8 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
CP_XML_ATTR(L"xmlns:x14", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
CP_XML_ATTR(L"mc:Ignorable", L"x14ac");
CP_XML_ATTR(L"xmlns:x14ac", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
@ -216,21 +223,27 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->drawing_.str();
if (!impl_->commentsId_.empty() && !impl_->vml_drawingId_.empty())
if (!impl_->vml_drawingId_.empty())
{
CP_XML_NODE(L"legacyDrawing")
{
CP_XML_ATTR(L"r:id", impl_->vml_drawingId_);
}
}
if (!impl_->vml_drawingId_HF_.empty())
if (!impl_->vml_HF_drawingId_.empty())
{
CP_XML_NODE(L"legacyDrawingHF")
{
CP_XML_ATTR(L"r:id", impl_->vml_drawingId_HF_);
CP_XML_ATTR(L"r:id", impl_->vml_HF_drawingId_);
}
}
if (!impl_->ole_objects_.str().empty())
{
CP_XML_NODE(L"oleObjects")
{
CP_XML_STREAM() << impl_->ole_objects_.str();
}
}
CP_XML_STREAM() << impl_->picture_background_.str();
//CP_XML_NODE(L"rowBreaks){}
@ -258,10 +271,10 @@ void xlsx_xml_worksheet::set_vml_drawing_link(std::wstring const & fileName, std
impl_->vml_drawingName_ = fileName;
impl_->vml_drawingId_ = id;
}
void xlsx_xml_worksheet::set_vml_drawing_link_HF(std::wstring const & fileName, std::wstring const & id)
void xlsx_xml_worksheet::set_vml_HF_drawing_link(std::wstring const & fileName, std::wstring const & id)
{
impl_->vml_drawingName_HF_ = fileName;
impl_->vml_drawingId_HF_ = id;
impl_->vml_HF_drawingName_ = fileName;
impl_->vml_HF_drawingId_ = id;
}
std::pair<std::wstring, std::wstring> xlsx_xml_worksheet::get_drawing_link() const
{
@ -277,7 +290,7 @@ std::pair<std::wstring, std::wstring> xlsx_xml_worksheet::get_vml_drawing_link()
}
std::pair<std::wstring, std::wstring> xlsx_xml_worksheet::get_vml_drawing_HF_link() const
{
return std::pair<std::wstring, std::wstring>(impl_->vml_drawingName_HF_, impl_->vml_drawingId_HF_);
return std::pair<std::wstring, std::wstring>(impl_->vml_HF_drawingName_, impl_->vml_HF_drawingId_);
}
}

View File

@ -60,6 +60,7 @@ public:
std::wostream & hyperlinks();
std::wostream & mergeCells();
std::wostream & drawing();
std::wostream & ole_objects();
//std::wostream & comments();
std::wostream & sheetSortAndFilters();
std::wostream & pageProperties();
@ -76,7 +77,7 @@ public:
void set_vml_drawing_link (std::wstring const & fileName, std::wstring const & id);
void set_comments_link (std::wstring const & fileName, std::wstring const & id);
void set_state (std::wstring const & state);
void set_vml_drawing_link_HF(std::wstring const & fileName, std::wstring const & id);
void set_vml_HF_drawing_link(std::wstring const & fileName, std::wstring const & id);
std::pair<std::wstring, std::wstring> get_drawing_link() const;
std::pair<std::wstring, std::wstring> get_vml_drawing_link() const;

View File

@ -104,25 +104,27 @@ void xlsx_table_context::end_table()
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_HF_rels());
context_.current_sheet().set_vml_drawing_link_HF(vmlDrawingName.first, vmlDrawingName.second);
context_.current_sheet().set_vml_HF_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_drawing_context().empty_vml())
{
std::wstringstream strm;
get_drawing_context().serialize_vml(strm);
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(strm.str(), get_drawing_context().get_vml_rels());
context_.current_sheet().set_vml_drawing_link(vmlDrawingName.first, vmlDrawingName.second);
}
if (!get_comments_context().empty())
{
std::wstringstream strm;
get_comments_context().write_comments(strm);
std::wstringstream vml_strm;
get_drawing_context().serialize_vml_comments(vml_strm);
const std::pair<std::wstring, std::wstring> commentsName =
context_.get_comments_context_handle().add_comments_xml(strm.str(), context_.get_comments_context().get_comments());
const std::pair<std::wstring, std::wstring> vmlDrawingName =
context_.get_drawing_context_handle().add_drawing_vml(vml_strm.str(), get_drawing_context().get_vml_comments_rels());
context_.current_sheet().set_comments_link (commentsName.first, commentsName.second);
context_.current_sheet().set_vml_drawing_link (vmlDrawingName.first, vmlDrawingName.second);
}
}
@ -143,12 +145,21 @@ std::wstring xlsx_table_context::add_hyperlink(std::wstring const & ref, std::ws
}
void xlsx_table_context::dump_rels_hyperlinks(rels & Rels)
{
return state()->hyperlinks_.dump_rels(Rels);
state()->hyperlinks_.dump_rels(Rels);
}
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{
return state()->hyperlinks_.serialize(_Wostream);
state()->hyperlinks_.serialize(_Wostream);
}
void xlsx_table_context::dump_rels_ole_objects(rels & Rels)
{
xlsx_drawings_rels_ptr ole_rels = state()->drawing_context_.get_sheet_rels();
ole_rels->dump_rels(Rels);
}
void xlsx_table_context::serialize_ole_objects(std::wostream & strm)
{
state()->drawing_context_.serialize_objects(strm);
}
}

View File

@ -71,6 +71,9 @@ public:
std::wstring add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal);
void dump_rels_hyperlinks(rels & Rels);
void serialize_hyperlinks(std::wostream & _Wostream);
void dump_rels_ole_objects(rels & Rels);
void serialize_ole_objects(std::wostream & _Wostream);
private:
xlsx_conversion_context & context_;

View File

@ -125,6 +125,7 @@ class DirEntry
public:
DirEntry(): valid(), name(), dir(), size(), start(), prev(), next(), child() {}
bool valid; // false if invalid (should be skipped)
unsigned char prefix;
std::string name; // the name, not in unicode anymore
bool dir; // true if directory
uint64 size; // size (not valid if directory)
@ -805,49 +806,67 @@ DirEntry* DirTree::entry( const std::string& name, bool create, int64 bigBlockSi
}
else
{
// not found among children
if( !create || !io->writeable)
std::vector<uint64> chi = children( index );
for( unsigned i = 0; i < chi.size(); i++ )
{
DirEntry* ce = entry( chi[i] );
if( ce )
if( ce->valid && ( ce->name.length()>1 ) )
if( ce->name == *it )
{
child = chi[i];
break;
}
}
}
if( child > 0 )
{
index = child;
}
else
{
// not found among children ..wrong header???
if( !create || !io->writeable)
{
return (DirEntry*)0;
}
// create a new entry
uint64 parent2 = index;
index = unused();
DirEntry* e = entry( index );
e->valid = true;
e->name = *it;
e->dir = (levelsLeft > 0);
if (!e->dir)
e->size = streamSize;
else
e->size = 0;
e->start = AllocTable::Eof;
e->child = End;
if (closest == End)
{
return (DirEntry*)0;
e->prev = End;
e->next = entry(parent2)->child;
entry(parent2)->child = index;
markAsDirty(parent2, bigBlockSize);
}
else
{
DirEntry* closeE = entry( closest );
if (closeE->compare(*e) < 0)
{
e->prev = closeE->next;
e->next = End;
closeE->next = index;
}
else
{
e->next = closeE->prev;
e->prev = End;
closeE->prev = index;
}
markAsDirty(closest, bigBlockSize);
}
// create a new entry
uint64 parent2 = index;
index = unused();
DirEntry* e = entry( index );
e->valid = true;
e->name = *it;
e->dir = (levelsLeft > 0);
if (!e->dir)
e->size = streamSize;
else
e->size = 0;
e->start = AllocTable::Eof;
e->child = End;
if (closest == End)
{
e->prev = End;
e->next = entry(parent2)->child;
entry(parent2)->child = index;
markAsDirty(parent2, bigBlockSize);
}
else
{
DirEntry* closeE = entry( closest );
if (closeE->compare(*e) < 0)
{
e->prev = closeE->next;
e->next = End;
closeE->next = index;
}
else
{
e->next = closeE->prev;
e->prev = End;
closeE->prev = index;
}
markAsDirty(closest, bigBlockSize);
}
markAsDirty(index, bigBlockSize);
uint64 bbidx = index / (bigBlockSize / 128);
std::vector <uint64> blocks = io->bbat->follow(io->header->dirent_start);
@ -937,7 +956,7 @@ void DirTree::load( unsigned char* buffer, uint64 size )
uint64 p = i * 128;
// would be < 32 if first char in the name isn't printable
unsigned prefix = 32;
unsigned char prefix = 32;
// parse name of this entry, which stored as Unicode 16-bit
std::string name;
@ -949,7 +968,7 @@ void DirTree::load( unsigned char* buffer, uint64 size )
// first char isn't printable ? remove it...
if( buffer[p] < 32 )
{
prefix = buffer[0];
prefix = name[0];
name.erase( 0,1 );
}
@ -959,6 +978,7 @@ void DirTree::load( unsigned char* buffer, uint64 size )
DirEntry e;
e.valid = ( type != 0 );
e.name = name;
e.prefix = prefix;
e.start = readU32( buffer + 0x74+p );
e.size = readU32( buffer + 0x78+p );
e.prev = readU32( buffer + 0x44+p );
@ -2225,12 +2245,35 @@ std::list<std::string> Storage::entries( const std::string& path )
uint64 parent = dt->indexOf( e );
std::vector<uint64> children = dt->children( parent );
for( uint64 i = 0; i < children.size(); i++ )
localResult.push_back( dt->entry( children[i] )->name );
{
localResult.push_back( dt->entry( children[i] )->name );
}
}
return localResult;
}
std::list<std::string> Storage::entries_with_prefix( const std::string& path )
{
std::list<std::string> localResult;
DirTree* dt = io->dirtree;
DirEntry* e = dt->entry( path, false );
if( e && e->dir )
{
uint64 parent = dt->indexOf( e );
std::vector<uint64> children = dt->children( parent );
for( uint64 i = 0; i < children.size(); i++ )
{
std::string val;
if (dt->entry( children[i] )->prefix != 32)
val = (char) dt->entry( children[i] )->prefix;
val += dt->entry( children[i] )->name;
localResult.push_back(val);
}
}
return localResult;
}
bool Storage::isDirectory( const std::string& name )
{
DirEntry* e = io->dirtree->entry( name, false );
@ -2271,7 +2314,9 @@ void CollectStreams( std::list<std::string>& result, DirTree* tree, DirEntry* pa
DirEntry* c = tree->entry( parent->child );
std::queue<DirEntry*> queue;
if ( c ) queue.push( c );
while ( !queue.empty() ) {
while ( !queue.empty() )
{
DirEntry* e = queue.front();
queue.pop();
if ( e->dir )

View File

@ -124,6 +124,7 @@ public:
* Finds all stream and directories in given path.
**/
std::list<std::string> entries( const std::string& path = "/" );
std::list<std::string> entries_with_prefix( const std::string& path = "/" );
/**
* Returns true if specified entry name is a directory.

View File

@ -5,6 +5,9 @@ if exist "depot_tools" (
echo "depot_tools already fetched"
) else (
call git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
CD depot_tools
git reset --hard e29cf7cb78009c80b04ddeab04763e8d218937c2
CD ../
call powershell -File .\fix-depot_tools.ps1
)

View File

@ -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")));
}

Some files were not shown because too many files have changed in this diff Show More