Commit d35619ee authored by Alexey.Musinov's avatar Alexey.Musinov

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

* 'develop' of https://github.com/ONLYOFFICE/core:
  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
parents b38c552c 1b91ee57
...@@ -576,11 +576,31 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_ ...@@ -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_); // не объект 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; std::wstring ref;
bool isMediaInternal = true; 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.objectId = impl_->get_mediaitems().add_or_find(obj.xlink_href_, obj.type_, isMediaInternal, ref);
drawing.objectProgId = obj.descriptor_; drawing.objectProgId = obj.descriptor_;
...@@ -602,7 +622,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_ ...@@ -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)); 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; std::wstringstream strm;
...@@ -620,9 +640,9 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_ ...@@ -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) 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++) for (size_t i = 0 ; i < objects.size(); i++)
{ {
...@@ -661,7 +681,7 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio ...@@ -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 typeGroupShape: process_group ( obj, table_metrics, drawing, xlsx_drawings_); break;
case typeMsObject: case typeMsObject:
case typeOleObject: case typeOleObject:
process_object ( obj, drawing, xlsx_drawings_); break; process_object ( obj, table_metrics, drawing, xlsx_drawings_); break;
} }
} }
} }
......
...@@ -133,13 +133,13 @@ private: ...@@ -133,13 +133,13 @@ private:
class Impl; class Impl;
_CP_PTR(Impl) 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 (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_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_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_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); void process_common_properties (drawing_object_description & obj, _xlsx_drawing & drawing, xlsx_table_metrics & table_metrics);
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
if (sheet_rel) 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) if (xlsx_sheet_rels_[i].rid == rid && xlsx_sheet_rels_[i].ref == ref)
present = true; present = true;
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
} }
else 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) if (xlsx_drawing_rels_[i].rid == rid && xlsx_drawing_rels_[i].ref == ref)
present = true; present = true;
...@@ -89,7 +89,7 @@ public: ...@@ -89,7 +89,7 @@ public:
{ {
if (inGroup) 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); xlsx_drawings_[i].serialize(strm);
} }
...@@ -114,7 +114,7 @@ public: ...@@ -114,7 +114,7 @@ public:
} }
void serialize_objects(std::wostream & strm) 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; if (xlsx_drawings_[i].type != typeOleObject && xlsx_drawings_[i].type != typeMsObject) continue;
...@@ -129,7 +129,7 @@ public: ...@@ -129,7 +129,7 @@ public:
void dump_rels_drawing(rels & Rels) 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 || if (xlsx_drawing_rels_[i].type == typeImage ||
xlsx_drawing_rels_[i].type == typeMedia || xlsx_drawing_rels_[i].type == typeMedia ||
...@@ -146,7 +146,7 @@ public: ...@@ -146,7 +146,7 @@ public:
} }
void dump_rels_sheet(rels & Rels) 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, Rels.add(relationship( xlsx_sheet_rels_[i].rid,
mediaitems::get_rel_type(xlsx_sheet_rels_[i].type), mediaitems::get_rel_type(xlsx_sheet_rels_[i].type),
......
...@@ -77,6 +77,8 @@ private: ...@@ -77,6 +77,8 @@ private:
std::map<std::string, CFStreamPtr> streams; std::map<std::string, CFStreamPtr> streams;
ReadWriteMode rwMode; ReadWriteMode rwMode;
}; };
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
} // namespace XLS } // namespace XLS
...@@ -67,8 +67,12 @@ void MsoDrawing::readFields() ...@@ -67,8 +67,12 @@ void MsoDrawing::readFields()
rgChildRec.rh_own.recLen = stored_record->getDataSize(); rgChildRec.rh_own.recLen = stored_record->getDataSize();
rgChildRec.loadFields(*stored_record); rgChildRec.loadFields(*stored_record);
}
if (stored_record->getRdPtr() < stored_record->getDataSize())
{
int g = 0;
}
}
isReading = true; isReading = true;
} }
...@@ -77,6 +81,11 @@ void MsoDrawing::readFields(CFRecord& record) ...@@ -77,6 +81,11 @@ void MsoDrawing::readFields(CFRecord& record)
record >> rgChildRec; record >> rgChildRec;
isReading = true; isReading = true;
if (record.getRdPtr() < record.getDataSize())
{
int g = 0;
}
} }
......
...@@ -57,9 +57,9 @@ ...@@ -57,9 +57,9 @@
#define OBJ_Label 0x000E #define OBJ_Label 0x000E
#define OBJ_DialogBox 0x000F #define OBJ_DialogBox 0x000F
#define OBJ_SpinControl 0x0010 #define OBJ_SpinControl 0x0010
#define OBJ_Scrollbar 0x0011
#define OBJ_List 0x0012 #define OBJ_List 0x0012
#define OBJ_GroupBox 0x0013 #define OBJ_GroupBox 0x0013
#define OBJ_Scrollbar 0x0011
#define OBJ_DropdownList 0x0014 #define OBJ_DropdownList 0x0014
#define OBJ_Note 0x0019 #define OBJ_Note 0x0019
...@@ -80,7 +80,6 @@ BaseObjectPtr Obj::clone() ...@@ -80,7 +80,6 @@ BaseObjectPtr Obj::clone()
void Obj::readFields(CFRecord& record) void Obj::readFields(CFRecord& record)
{ {
record >> cmo; record >> cmo;
size_t rdPtr = record.getRdPtr();
if (record.getGlobalWorkbookInfo()->Version >= 0x0600) if (record.getGlobalWorkbookInfo()->Version >= 0x0600)
{ {
...@@ -88,61 +87,73 @@ void Obj::readFields(CFRecord& record) ...@@ -88,61 +87,73 @@ void Obj::readFields(CFRecord& record)
{ {
record.skipNunBytes(6); // Skip FtGmo (obsolete) record.skipNunBytes(6); // Skip FtGmo (obsolete)
} }
if(OBJ_Picture == cmo.ot) if( OBJ_Picture == cmo.ot)
{ {
record >> pictFormat; record >> pictFormat;
record >> pictFlags; record >> pictFlags;
} }
if(0x0B == cmo.ot || 0x0C == cmo.ot) if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot)
{ {
record.skipNunBytes(16); // Skip FtCbls (obsolete) record.skipNunBytes(16); // Skip FtCbls (obsolete)
} }
if(0x0C == cmo.ot) if( OBJ_RadioButton == cmo.ot)
{ {
record.skipNunBytes(10); // Skip FtRbo (obsolete) 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; record >> sbs;
} }
if(0x19 == cmo.ot) if( OBJ_Note == cmo.ot)
{ {
record >> nts; 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); linkFmla.load(record);
} }
if(0x0B == cmo.ot || 0x0C == cmo.ot) if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot)
{ {
checkBox.load(record); checkBox.load(record);
} }
if(0x0C == cmo.ot) if( OBJ_RadioButton == cmo.ot)
{ {
radioButton.load(record); radioButton.load(record);
} }
if(0x0D == cmo.ot) if( OBJ_EditBox == cmo.ot)
{ {
edit.load(record); edit.load(record);
} }
if(0x12 == cmo.ot || 0x14 == cmo.ot) if( OBJ_List == cmo.ot ||
OBJ_DropdownList == cmo.ot)
{ {
list.load(record, cmo.ot); list.load(record, cmo.ot);
} }
if(0x13 == cmo.ot) if( OBJ_GroupBox == cmo.ot)
{ {
gbo.load(record); gbo.load(record);
} }
if( OBJ_List != cmo.ot && OBJ_DropdownList != cmo.ot)
if(0x12 != cmo.ot && 0x14 != cmo.ot)
{ {
record.skipNunBytes(4); // reserved record.skipNunBytes(4); // reserved
} }
//------------------------------------------------------------------------------------------------------
if (continue_records.size() > 0) if (continue_records.size() > 0)
{ {
......
...@@ -32,27 +32,25 @@ ...@@ -32,27 +32,25 @@
#pragma once #pragma once
#include "BiffRecordContinued.h" #include "BiffRecordContinued.h"
#include "MsoDrawing.h"
#include <Logic/Biff_structures/FtCmo.h>
#include <Logic/Biff_structures/FtCf.h> #include "../Biff_structures/FtCmo.h"
#include <Logic/Biff_structures/FtPioGrbit.h> #include "../Biff_structures/FtCf.h"
#include <Logic/Biff_structures/FtSbs.h> #include "../Biff_structures/FtPioGrbit.h"
#include <Logic/Biff_structures/FtNts.h> #include "../Biff_structures/FtSbs.h"
#include <Logic/Biff_structures/FtMacro.h> #include "../Biff_structures/FtNts.h"
#include <Logic/Biff_structures/FtPictFmla.h> #include "../Biff_structures/FtMacro.h"
#include <Logic/Biff_structures/ObjLinkFmla.h> #include "../Biff_structures/FtPictFmla.h"
#include <Logic/Biff_structures/FtCblsData.h> #include "../Biff_structures/ObjLinkFmla.h"
#include <Logic/Biff_structures/FtRboData.h> #include "../Biff_structures/FtCblsData.h"
#include <Logic/Biff_structures/FtEdoData.h> #include "../Biff_structures/FtRboData.h"
#include <Logic/Biff_structures/FtLbsData.h> #include "../Biff_structures/FtEdoData.h"
#include <Logic/Biff_structures/FtGboData.h> #include "../Biff_structures/FtLbsData.h"
#include "../Biff_structures/FtGboData.h"
#include <Logic/Biff_records/MsoDrawing.h>
namespace XLS namespace XLS
{ {
// Logical representation of Obj record in BIFF8
class Obj : public BiffRecordContinued class Obj : public BiffRecordContinued
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Obj) BIFF_RECORD_DEFINE_TYPE_INFO(Obj)
...@@ -66,7 +64,6 @@ public: ...@@ -66,7 +64,6 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeObj; static const ElementType type = typeObj;
...@@ -104,8 +101,6 @@ public: ...@@ -104,8 +101,6 @@ public:
_UINT16 flag; _UINT16 flag;
_UINT16 flag2; _UINT16 flag2;
}old_version; }old_version;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -39,12 +39,10 @@ Pls::Pls() ...@@ -39,12 +39,10 @@ Pls::Pls()
{ {
} }
Pls::~Pls() Pls::~Pls()
{ {
} }
BaseObjectPtr Pls::clone() BaseObjectPtr Pls::clone()
{ {
return BaseObjectPtr(new Pls()); return BaseObjectPtr(new Pls());
...@@ -71,9 +69,9 @@ void Pls::readFields(CFRecord& record) ...@@ -71,9 +69,9 @@ void Pls::readFields(CFRecord& record)
} }
int size = record.getDataSize() - 2; 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); memcpy(buffer.get(), data, size);
bin_data_id = -1; bin_data_id = -1;
...@@ -81,7 +79,7 @@ void Pls::readFields(CFRecord& record) ...@@ -81,7 +79,7 @@ void Pls::readFields(CFRecord& record)
GlobalWorkbookInfo* globla_info = record.getGlobalWorkbookInfo().get(); GlobalWorkbookInfo* globla_info = record.getGlobalWorkbookInfo().get();
if (globla_info) 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; bin_data_id = globla_info->bin_data.size() - 1;
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
*/ */
#pragma once #pragma once
#include <Logic/Biff_records/BiffRecordContinued.h> #include "BiffRecordContinued.h"
#if !defined(_WIN32) && !defined(_WIN64) #if !defined(_WIN32) && !defined(_WIN64)
...@@ -109,9 +109,7 @@ ...@@ -109,9 +109,7 @@
namespace XLS namespace XLS
{ {
class Pls : public BiffRecordContinued
// Logical representation of Pls record in BIFF8
class Pls : public BiffRecordContinued
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(Pls) BIFF_RECORD_DEFINE_TYPE_INFO(Pls)
BASE_OBJECT_DEFINE_CLASS_NAME(Pls) BASE_OBJECT_DEFINE_CLASS_NAME(Pls)
......
...@@ -32,14 +32,12 @@ ...@@ -32,14 +32,12 @@
#pragma once #pragma once
#include "BiffRecord.h" #include "BiffRecord.h"
#include <Logic/Biff_structures/RkRec.h> #include "../Biff_structures/RkRec.h"
#include <Logic/Biff_structures/Cell.h> #include "../Biff_structures/Cell.h"
namespace XLS namespace XLS
{ {
// Logical representation of RK record in BIFF8
class RK: public BiffRecord class RK: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(RK) BIFF_RECORD_DEFINE_TYPE_INFO(RK)
...@@ -50,7 +48,6 @@ public: ...@@ -50,7 +48,6 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeRK; static const ElementType type = typeRK;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
*/ */
#include "Sync.h" #include "Sync.h"
#include <Logic/Biff_structures/CellRef.h> #include "../Biff_structures/CellRef.h"
namespace XLS namespace XLS
{ {
......
...@@ -37,16 +37,22 @@ ...@@ -37,16 +37,22 @@
namespace XLS namespace XLS
{ {
BiffStructurePtr FtCblsData::clone() BiffStructurePtr FtCblsData::clone()
{ {
return BiffStructurePtr(new FtCblsData(*this)); return BiffStructurePtr(new FtCblsData(*this));
} }
void FtCblsData::load(CFRecord& record) 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 >> fChecked >> accel;
record.skipNunBytes(2); // reserved record.skipNunBytes(2); // reserved
......
...@@ -42,16 +42,20 @@ class FtCblsData : public BiffStructure ...@@ -42,16 +42,20 @@ class FtCblsData : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtCblsData) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtCblsData)
public: public:
FtCblsData() : fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeFtCblsData; static const ElementType type = typeFtCblsData;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned short fChecked; unsigned short fChecked;
unsigned short accel; unsigned short accel;
bool fNo3d; bool fNo3d;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -46,7 +46,6 @@ public: ...@@ -46,7 +46,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
static const ElementType type = typeFtCmo; static const ElementType type = typeFtCmo;
unsigned short ot; unsigned short ot;
...@@ -60,7 +59,6 @@ public: ...@@ -60,7 +59,6 @@ public:
bool fUIObj; bool fUIObj;
bool fRecalcObj; bool fRecalcObj;
bool fRecalcObjAlways; bool fRecalcObjAlways;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -36,16 +36,22 @@ ...@@ -36,16 +36,22 @@
namespace XLS namespace XLS
{ {
BiffStructurePtr FtEdoData::clone() BiffStructurePtr FtEdoData::clone()
{ {
return BiffStructurePtr(new FtEdoData(*this)); return BiffStructurePtr(new FtEdoData(*this));
} }
void FtEdoData::load(CFRecord& record) 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; record >> ivtEdit >> fMultiLine >> fVScroll >> id;
} }
......
...@@ -43,17 +43,21 @@ class FtEdoData : public BiffStructure ...@@ -43,17 +43,21 @@ class FtEdoData : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtEdoData) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtEdoData)
public: public:
FtEdoData() : fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeFtEdoData; static const ElementType type = typeFtEdoData;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned short ivtEdit; unsigned short ivtEdit;
Boolean<unsigned short> fMultiLine; Boolean<unsigned short> fMultiLine;
unsigned short fVScroll; unsigned short fVScroll;
unsigned short id; unsigned short id;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
namespace XLS namespace XLS
{ {
BiffStructurePtr FtGboData::clone() BiffStructurePtr FtGboData::clone()
{ {
return BiffStructurePtr(new FtGboData(*this)); return BiffStructurePtr(new FtGboData(*this));
...@@ -44,7 +43,15 @@ BiffStructurePtr FtGboData::clone() ...@@ -44,7 +43,15 @@ BiffStructurePtr FtGboData::clone()
void FtGboData::load(CFRecord& record) 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 >> accel;
record.skipNunBytes(2); // reserved record.skipNunBytes(2); // reserved
......
...@@ -43,15 +43,19 @@ class FtGboData : public BiffStructure ...@@ -43,15 +43,19 @@ class FtGboData : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtGboData) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtGboData)
public: public:
FtGboData() : fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
static const ElementType type = typeFtGboData; static const ElementType type = typeFtGboData;
unsigned short accel; unsigned short accel;
bool fNo3d; bool fNo3d;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -36,12 +36,6 @@ ...@@ -36,12 +36,6 @@
namespace XLS namespace XLS
{ {
FtLbsData::FtLbsData()
: fmla(false)
{
}
BiffStructurePtr FtLbsData::clone() BiffStructurePtr FtLbsData::clone()
{ {
return BiffStructurePtr(new FtLbsData(*this)); return BiffStructurePtr(new FtLbsData(*this));
...@@ -49,7 +43,15 @@ BiffStructurePtr FtLbsData::clone() ...@@ -49,7 +43,15 @@ BiffStructurePtr FtLbsData::clone()
void FtLbsData::load(CFRecord& record, const unsigned short ot) 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); fmla.load(record);
......
...@@ -46,7 +46,9 @@ class FtLbsData : public BiffStructure ...@@ -46,7 +46,9 @@ class FtLbsData : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtLbsData) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtLbsData)
public: public:
FtLbsData(); FtLbsData() : fmla(false), fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeFtLbsData; static const ElementType type = typeFtLbsData;
...@@ -72,6 +74,7 @@ public: ...@@ -72,6 +74,7 @@ public:
std::vector<XLUnicodeString> rgLines; std::vector<XLUnicodeString> rgLines;
std::vector<Boolean<unsigned char>> bsels; std::vector<Boolean<unsigned char>> bsels;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -36,9 +36,7 @@ ...@@ -36,9 +36,7 @@
namespace XLS namespace XLS
{ {
FtMacro::FtMacro() : fmla(false), fExist(false)
FtMacro::FtMacro()
: fmla(false)
{ {
} }
...@@ -48,14 +46,18 @@ BiffStructurePtr FtMacro::clone() ...@@ -48,14 +46,18 @@ BiffStructurePtr FtMacro::clone()
} }
void FtMacro::load(CFRecord& record) 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); fmla.load(record);
} }
} // namespace XLS } // namespace XLS
...@@ -50,8 +50,8 @@ public: ...@@ -50,8 +50,8 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
ObjFmla fmla; ObjFmla fmla;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -37,16 +37,22 @@ ...@@ -37,16 +37,22 @@
namespace XLS namespace XLS
{ {
BiffStructurePtr FtNts::clone() BiffStructurePtr FtNts::clone()
{ {
return BiffStructurePtr(new FtNts(*this)); return BiffStructurePtr(new FtNts(*this));
} }
void FtNts::load(CFRecord& record) 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; _GUID_ guid_num;
record >> guid_num >> fSharedNote; record >> guid_num >> fSharedNote;
......
...@@ -43,15 +43,19 @@ class FtNts : public BiffStructure ...@@ -43,15 +43,19 @@ class FtNts : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtNts) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtNts)
public: public:
FtNts() : fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeFtNts; static const ElementType type = typeFtNts;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
std::wstring guid; std::wstring guid;
Boolean<unsigned short> fSharedNote; Boolean<unsigned short> fSharedNote;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -36,18 +36,11 @@ ...@@ -36,18 +36,11 @@
namespace XLS namespace XLS
{ {
FtPictFmla::FtPictFmla()
: fmla(true)
{
}
BiffStructurePtr FtPictFmla::clone() BiffStructurePtr FtPictFmla::clone()
{ {
return BiffStructurePtr(new FtPictFmla(*this)); return BiffStructurePtr(new FtPictFmla(*this));
} }
void FtPictFmla::load(CFRecord& record, int linkSize) void FtPictFmla::load(CFRecord& record, int linkSize)
{ {
bool bLinked = false; bool bLinked = false;
...@@ -74,11 +67,8 @@ void FtPictFmla::load(CFRecord& record, int linkSize) ...@@ -74,11 +67,8 @@ void FtPictFmla::load(CFRecord& record, int linkSize)
record >> nNameIdx; record >> nNameIdx;
record.skipNunBytes(12); 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; bEmbedded = true;
...@@ -103,7 +93,17 @@ void FtPictFmla::load(CFRecord& record, int linkSize) ...@@ -103,7 +93,17 @@ void FtPictFmla::load(CFRecord& record, int linkSize)
void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags) 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); fmla.load(record);
...@@ -111,12 +111,11 @@ void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags) ...@@ -111,12 +111,11 @@ void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags)
{ {
record >> lPosInCtlStm; record >> lPosInCtlStm;
} }
record >> lPosInCtlStm;
if(pictFlags.fPrstm) if(pictFlags.fPrstm)
{ {
record >> cbBufInCtlStm; record >> cbBufInCtlStm;
} }
if(pictFlags.fPrstm) if(pictFlags.fCtl)
{ {
key.load(record); key.load(record);
} }
......
...@@ -45,20 +45,25 @@ class FtPictFmla : public BiffStructure ...@@ -45,20 +45,25 @@ class FtPictFmla : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPictFmla) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPictFmla)
public: public:
FtPictFmla(); FtPictFmla() : fmla(true), cbBufInCtlStm(0xffffffff), lPosInCtlStm(0xffffffff), fExist(false)
BiffStructurePtr clone(); {
}
BiffStructurePtr clone();
virtual void load(CFRecord& record){}
//biff5
virtual void load(CFRecord& record, int linkSize); virtual void load(CFRecord& record, int linkSize);
//biff8
virtual void load(CFRecord& record, FtPioGrbit& pictFlags); virtual void load(CFRecord& record, FtPioGrbit& pictFlags);
static const ElementType type = typeFtPictFmla; static const ElementType type = typeFtPictFmla;
virtual void load(CFRecord& record){}
ObjFmla fmla;
_UINT32 lPosInCtlStm; _UINT32 lPosInCtlStm;
_UINT32 cbBufInCtlStm; _UINT32 cbBufInCtlStm;
PictFmlaKey key; PictFmlaKey key;
ObjFmla fmla;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -44,19 +44,19 @@ BiffStructurePtr FtPioGrbit::clone() ...@@ -44,19 +44,19 @@ BiffStructurePtr FtPioGrbit::clone()
void FtPioGrbit::load(CFRecord& record) void FtPioGrbit::load(CFRecord& record)
{ {
//record.skipNunBytes(4); // reserved
unsigned short ft, cb; unsigned short ft, cb;
record >> ft; record >> ft >> cb;
record >> cb;
if (record.getDataSize() == record.getRdPtr()) if ( ft != 0x0008 || cb != 2)
{ {
record.RollRdPtrBack(4); record.RollRdPtrBack(4);
return; return;
} }
fExist = true;
unsigned short flags; unsigned short flags;
record >> flags; record >> flags;
fAutoPict = GETBIT(flags, 0); fAutoPict = GETBIT(flags, 0);
fDde = GETBIT(flags, 1); fDde = GETBIT(flags, 1);
fPrintCalc = GETBIT(flags, 2); fPrintCalc = GETBIT(flags, 2);
......
...@@ -42,13 +42,15 @@ class FtPioGrbit : public BiffStructure ...@@ -42,13 +42,15 @@ class FtPioGrbit : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPioGrbit) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPioGrbit)
public: public:
FtPioGrbit() : fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeFtPioGrbit; static const ElementType type = typeFtPioGrbit;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
bool fAutoPict; bool fAutoPict;
bool fDde; bool fDde;
bool fPrintCalc; bool fPrintCalc;
...@@ -58,6 +60,8 @@ public: ...@@ -58,6 +60,8 @@ public:
bool fCamera; bool fCamera;
bool fDefaultSize; bool fDefaultSize;
bool fAutoLoad; bool fAutoLoad;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -45,7 +45,15 @@ BiffStructurePtr FtRboData::clone() ...@@ -45,7 +45,15 @@ BiffStructurePtr FtRboData::clone()
void FtRboData::load(CFRecord& record) 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; record >> idRadNext >> fFirstBtn;
} }
......
...@@ -43,15 +43,19 @@ class FtRboData : public BiffStructure ...@@ -43,15 +43,19 @@ class FtRboData : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtRboData) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtRboData)
public: public:
FtRboData() : fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeFtRboData; static const ElementType type = typeFtRboData;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned short idRadNext; unsigned short idRadNext;
Boolean<unsigned short> fFirstBtn; Boolean<unsigned short> fFirstBtn;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
namespace XLS namespace XLS
{ {
BiffStructurePtr FtSbs::clone() BiffStructurePtr FtSbs::clone()
{ {
return BiffStructurePtr(new FtSbs(*this)); return BiffStructurePtr(new FtSbs(*this));
...@@ -44,10 +43,15 @@ BiffStructurePtr FtSbs::clone() ...@@ -44,10 +43,15 @@ BiffStructurePtr FtSbs::clone()
void FtSbs::load(CFRecord& record) void FtSbs::load(CFRecord& record)
{ {
//record.skipNunBytes(4); // reserved unsigned short ft, cb;
record >> ft >> cb;
record >> ft; if ( ft != 0x000c && cb != 0x0014)
record >> cb; {
record.RollRdPtrBack(4);
return;
}
fExist = true;
record.skipNunBytes(4); // unused1 record.skipNunBytes(4); // unused1
......
...@@ -43,16 +43,15 @@ class FtSbs : public BiffStructure ...@@ -43,16 +43,15 @@ class FtSbs : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtSbs) BASE_STRUCTURE_DEFINE_CLASS_NAME(FtSbs)
public: public:
FtSbs() : fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeFtSbs; static const ElementType type = typeFtSbs;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned short ft;
unsigned short cb;
short iVal; short iVal;
short iMin; short iMin;
short iMax; short iMax;
...@@ -65,6 +64,8 @@ public: ...@@ -65,6 +64,8 @@ public:
bool fDrawSliderOnly; bool fDrawSliderOnly;
bool fTrackElevator; bool fTrackElevator;
bool fNo3d; bool fNo3d;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -126,7 +126,8 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record) ...@@ -126,7 +126,8 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
// m_OfficeArtSpgrContainerFileBlock = OfficeArtContainerPtr(art_container); // m_OfficeArtSpgrContainerFileBlock = OfficeArtContainerPtr(art_container);
// child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); // child_records.erase(child_records.begin() + i,child_records.begin() + i + 1);
// }break; // }break;
default:
break;
} }
} }
......
...@@ -49,6 +49,8 @@ void OfficeArtRecord::load(XLS::CFRecord& record) ...@@ -49,6 +49,8 @@ void OfficeArtRecord::load(XLS::CFRecord& record)
record >> rh_own; record >> rh_own;
loadFields(record); loadFields(record);
//Log::warning(STR::int2str(rh_own.recType, 16));
} }
......
...@@ -37,8 +37,7 @@ namespace XLS ...@@ -37,8 +37,7 @@ namespace XLS
{ {
ObjFmla::ObjFmla(const bool is_part_of_FtPictFmla) ObjFmla::ObjFmla(const bool is_part_of_FtPictFmla) : is_part_of_FtPictFmla_(is_part_of_FtPictFmla), bFmlaExist(false), bInfoExist(false)
: is_part_of_FtPictFmla_(is_part_of_FtPictFmla)
{ {
} }
...@@ -47,7 +46,6 @@ BiffStructurePtr ObjFmla::clone() ...@@ -47,7 +46,6 @@ BiffStructurePtr ObjFmla::clone()
return BiffStructurePtr(new ObjFmla(*this)); return BiffStructurePtr(new ObjFmla(*this));
} }
void ObjFmla::load(CFRecord& record) void ObjFmla::load(CFRecord& record)
{ {
unsigned short cbFmla; unsigned short cbFmla;
...@@ -56,15 +54,17 @@ void ObjFmla::load(CFRecord& record) ...@@ -56,15 +54,17 @@ void ObjFmla::load(CFRecord& record)
if(0 != cbFmla) if(0 != cbFmla)
{ {
bFmlaExist = true;
fmla.load(record); fmla.load(record);
if(is_part_of_FtPictFmla_ && fmla.HasPtgTbl()) if(is_part_of_FtPictFmla_ && fmla.HasPtgTbl())
{ {
record >> embedInfo; record >> embedInfo;
bInfoExist = true;
} }
} }
size_t data_size = record.getRdPtr() - start_ptr; size_t data_size = record.getRdPtr() - start_ptr;
size_t padding_size = cbFmla - data_size; size_t padding_size = cbFmla - data_size;
if(0 != padding_size && (record.getRdPtr() + padding_size) <= record.getDataSize()) if(0 != padding_size && (record.getRdPtr() + padding_size) <= record.getDataSize())
......
...@@ -51,13 +51,14 @@ public: ...@@ -51,13 +51,14 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
ObjectParsedFormula fmla; ObjectParsedFormula fmla;
bool is_part_of_FtPictFmla_; bool bFmlaExist;
bool fmla_found; bool bInfoExist;
PictFmlaEmbedInfo embedInfo;
PictFmlaEmbedInfo embedInfo;
private:
bool is_part_of_FtPictFmla_;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -35,13 +35,6 @@ ...@@ -35,13 +35,6 @@
namespace XLS namespace XLS
{ {
ObjLinkFmla::ObjLinkFmla()
: fmla(false)
{
}
BiffStructurePtr ObjLinkFmla::clone() BiffStructurePtr ObjLinkFmla::clone()
{ {
return BiffStructurePtr(new ObjLinkFmla(*this)); return BiffStructurePtr(new ObjLinkFmla(*this));
...@@ -49,8 +42,15 @@ BiffStructurePtr ObjLinkFmla::clone() ...@@ -49,8 +42,15 @@ BiffStructurePtr ObjLinkFmla::clone()
void ObjLinkFmla::load(CFRecord& record) 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); fmla.load(record);
} }
......
...@@ -43,7 +43,9 @@ class ObjLinkFmla : public BiffStructure ...@@ -43,7 +43,9 @@ class ObjLinkFmla : public BiffStructure
{ {
BASE_STRUCTURE_DEFINE_CLASS_NAME(ObjLinkFmla) BASE_STRUCTURE_DEFINE_CLASS_NAME(ObjLinkFmla)
public: public:
ObjLinkFmla(); ObjLinkFmla(): fmla(false), fExist(false)
{
}
BiffStructurePtr clone(); BiffStructurePtr clone();
static const ElementType type = typeObjLinkFmla; static const ElementType type = typeObjLinkFmla;
...@@ -51,6 +53,7 @@ public: ...@@ -51,6 +53,7 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
ObjFmla fmla; ObjFmla fmla;
bool fExist;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -45,8 +45,6 @@ public: ...@@ -45,8 +45,6 @@ public:
ObjectParsedFormula(); ObjectParsedFormula();
BiffStructurePtr clone(); BiffStructurePtr clone();
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
}; };
} // namespace XLS } // namespace XLS
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#pragma once #pragma once
#include "BiffStructure.h" #include "BiffStructure.h"
#include <Logic/Biff_structures/BiffString.h> #include "BiffString.h"
namespace XLS namespace XLS
{ {
...@@ -49,7 +49,6 @@ public: ...@@ -49,7 +49,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
XLUnicodeStringNoCch strClass; XLUnicodeStringNoCch strClass;
}; };
......
...@@ -36,9 +36,7 @@ ...@@ -36,9 +36,7 @@
namespace XLS namespace XLS
{ {
PictFmlaKey::PictFmlaKey() : fmlaLinkedCell(false), fmlaListFillRange(false)
PictFmlaKey::PictFmlaKey()
: fmlaLinkedCell(false), fmlaListFillRange(false)
{ {
} }
...@@ -49,10 +47,16 @@ BiffStructurePtr PictFmlaKey::clone() ...@@ -49,10 +47,16 @@ BiffStructurePtr PictFmlaKey::clone()
void PictFmlaKey::load(CFRecord& record) void PictFmlaKey::load(CFRecord& record)
{ {
_UINT32 cbKey;
record >> 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); fmlaLinkedCell.load(record);
fmlaListFillRange.load(record); fmlaListFillRange.load(record);
......
...@@ -51,6 +51,8 @@ public: ...@@ -51,6 +51,8 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
_UINT32 cbKey;
std::string keyBuf; // ActiveX license key
ObjFmla fmlaLinkedCell; ObjFmla fmlaLinkedCell;
ObjFmla fmlaListFillRange; ObjFmla fmlaListFillRange;
......
...@@ -36,9 +36,7 @@ ...@@ -36,9 +36,7 @@
namespace XLS 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 ...@@ -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. // The reference coordinates shall be obtained from row/column values.
// No textual form need but the empty line. // No textual form need but the empty line.
ptg_stack.push(L""); ptg_stack.push(L"");
//CellRef ref(row, col, true, true);
//ptg_stack.push(ref.toString());
} }
......
...@@ -302,8 +302,13 @@ const bool CELLTABLE::loadContent(BinProcessor& proc) ...@@ -302,8 +302,13 @@ const bool CELLTABLE::loadContent(BinProcessor& proc)
CELL_GROUP cell_group2(shared_formulas_locations_ref_); CELL_GROUP cell_group2(shared_formulas_locations_ref_);
m_count_CELL_GROUP = proc.repeated(cell_group2, 0, 0); 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; return true;
} }
......
...@@ -38,7 +38,6 @@ namespace XLS ...@@ -38,7 +38,6 @@ namespace XLS
class CellRef; class CellRef;
// Logical representation of CELLTABLE union of records
class CELLTABLE: public CompositeObject class CELLTABLE: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(CELLTABLE) BASE_OBJECT_DEFINE_CLASS_NAME(CELLTABLE)
...@@ -55,8 +54,8 @@ public: ...@@ -55,8 +54,8 @@ public:
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
std::vector<CellRangeRef>& shared_formulas_locations_ref_; std::vector<CellRangeRef>& shared_formulas_locations_ref_;
int m_count_CELL_GROUP; int m_count_CELL_GROUP;
std::vector<BaseObjectPtr> m_arEntExU2;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -121,7 +121,12 @@ public: ...@@ -121,7 +121,12 @@ public:
std::map<std::wstring, std::vector<std::wstring>> mapDefineNames; std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
std::vector<std::wstring> arDefineNames; 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 struct _xti
{ {
......
...@@ -275,6 +275,7 @@ namespace oox ...@@ -275,6 +275,7 @@ namespace oox
case msosptRectangle : return L"rect"; case msosptRectangle : return L"rect";
case msosptRoundRectangle : return L"roundRect"; case msosptRoundRectangle : return L"roundRect";
case msosptEllipse : return L"ellipse"; case msosptEllipse : return L"ellipse";
case msosptPictureFrame : return L"rect";
//case msosptDiamond : return L"diamond"; //case msosptDiamond : return L"diamond";
case msosptIsocelesTriangle : return L"triangle"; case msosptIsocelesTriangle : return L"triangle";
//case msosptRightTriangle : return L"rtTriangle"; //case msosptRightTriangle : return L"rtTriangle";
......
...@@ -122,9 +122,9 @@ typedef struct tagBITMAPCOREHEADER { ...@@ -122,9 +122,9 @@ typedef struct tagBITMAPCOREHEADER {
} BITMAPCOREHEADER; } BITMAPCOREHEADER;
#endif #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; output_document = NULL;
xlsx_context = NULL; xlsx_context = NULL;
...@@ -136,9 +136,9 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -136,9 +136,9 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
try 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; return;
} }
...@@ -148,7 +148,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -148,7 +148,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
try try
{ {
summary = cfile.getNamedStream("SummaryInformation"); summary = xls_file->getNamedStream("SummaryInformation");
} }
catch (...) catch (...)
{ {
...@@ -156,7 +156,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -156,7 +156,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
try try
{ {
doc_summary = cfile.getNamedStream("DocumentSummaryInformation"); doc_summary = xls_file->getNamedStream("DocumentSummaryInformation");
} }
catch (...) catch (...)
{ {
...@@ -184,7 +184,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -184,7 +184,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
xls_global_info->fontsDirectory = fontsPath; xls_global_info->fontsDirectory = fontsPath;
xls_global_info->password = password; 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)); xls_document = boost::shared_ptr<XLS::WorkbookStreamObject>(new XLS::WorkbookStreamObject(workbook_code_page));
...@@ -197,27 +197,27 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -197,27 +197,27 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
if (xls_global_info->decryptor->IsVerify() == false) return; 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; int last_index = 0;
for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++) 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::BaseObjectPtr pivot_cache = boost::shared_ptr<XLS::PIVOTCACHE>(new XLS::PIVOTCACHE());
XLS::BinReaderProcessor proc(pivot_cache_reader , pivot_cache.get() , true); XLS::BinReaderProcessor proc(pivot_cache_reader , pivot_cache.get() , true);
proc.mandatory(*pivot_cache.get()); 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)); xls_global_info->mapPivotCacheStream.insert(std::make_pair(index, pivot_cache));
last_index = index; 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"; std::wstring xl_path = xlsx_path + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(xl_path.c_str()); NSDirectory::CreateDirectory(xl_path.c_str());
...@@ -228,7 +228,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -228,7 +228,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
if ((storageVbaProject) && (storageVbaProject->open(true, true))) 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(); storageVbaProject->close();
delete storageVbaProject; delete storageVbaProject;
...@@ -238,6 +238,27 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -238,6 +238,27 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
} }
else else
bMacros = false; 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(...) catch(...)
{ {
...@@ -340,6 +361,11 @@ void XlsConverter::convert(XLS::BaseObject *xls_unknown) ...@@ -340,6 +361,11 @@ void XlsConverter::convert(XLS::BaseObject *xls_unknown)
XLS::TxO * txo = dynamic_cast<XLS::TxO *>(xls_unknown); XLS::TxO * txo = dynamic_cast<XLS::TxO *>(xls_unknown);
convert(txo); convert(txo);
}break; }break;
case XLS::typeObj:
{
XLS::Obj * obj = dynamic_cast<XLS::Obj *>(xls_unknown);
convert(obj);
}break;
case XLS::typeAnyObject: case XLS::typeAnyObject:
default: default:
{ {
...@@ -673,7 +699,6 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ ...@@ -673,7 +699,6 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
bool res = false; bool res = false;
std::wstring file_name = L"image" + std::to_wstring(id); std::wstring file_name = L"image" + std::to_wstring(id);
if (type_ext == L"dib_data") if (type_ext == L"dib_data")
{ {
bool bPNG = false; bool bPNG = false;
...@@ -925,17 +950,6 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream * ...@@ -925,17 +950,6 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
if (type_object == 0) if (type_object == 0)
continue; 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)) if (xlsx_context->get_drawing_context().start_drawing(type_object))
{ {
...@@ -954,9 +968,9 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream * ...@@ -954,9 +968,9 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
{ {
convert(obj->old_version.additional[i].get()); convert(obj->old_version.additional[i].get());
} }
convert(image_obj); convert(image_obj);
convert(chart); convert(chart);
convert(obj);
xlsx_context->get_drawing_context().end_drawing(); xlsx_context->get_drawing_context().end_drawing();
} }
...@@ -965,13 +979,6 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream * ...@@ -965,13 +979,6 @@ void XlsConverter::convert_old(XLS::OBJECTS* objects, XLS::WorksheetSubstream *
elem++; elem++;
count++; 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) void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * sheet)
...@@ -1086,6 +1093,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee ...@@ -1086,6 +1093,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
} }
convert(text_obj); convert(text_obj);
convert(chart); convert(chart);
convert(obj);
xlsx_context->get_drawing_context().end_drawing(); xlsx_context->get_drawing_context().end_drawing();
} }
...@@ -1882,7 +1890,6 @@ void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings) ...@@ -1882,7 +1890,6 @@ void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings)
} }
} }
} }
void XlsConverter::convert(XLS::TxO * text_obj) void XlsConverter::convert(XLS::TxO * text_obj)
{ {
if (text_obj == NULL) return; if (text_obj == NULL) return;
...@@ -1924,6 +1931,76 @@ void XlsConverter::convert(XLS::TxO * text_obj) ...@@ -1924,6 +1931,76 @@ void XlsConverter::convert(XLS::TxO * text_obj)
xlsx_context->get_drawing_context().set_text(strm.str()); xlsx_context->get_drawing_context().set_text(strm.str());
} }
void XlsConverter::convert(XLS::Obj * obj)
{
if (obj == NULL) return;
//controls & objects
if (!obj->pictFlags.fExist || !obj->pictFmla.fExist || obj->cmo.ot != 8) return;
std::wstring link_cell, fill_range, fmla, info;
if (obj->pictFmla.fmla.bFmlaExist)
{
fmla = obj->pictFmla.fmla.fmla.getAssembledFormula();
if (obj->pictFmla.fmla.bInfoExist)
info = obj->pictFmla.fmla.embedInfo.strClass.value();
}
if (obj->pictFmla.key.fmlaLinkedCell.bFmlaExist)
{
link_cell = obj->pictFmla.key.fmlaLinkedCell.fmla.getAssembledFormula();
}
if (obj->pictFmla.key.fmlaListFillRange.bFmlaExist)
{
fill_range = obj->pictFmla.key.fmlaListFillRange.fmla.getAssembledFormula();
}
if (obj->pictFlags.fCtl && obj->pictFlags.fPrstm)//Controls Storage
{
xlsx_context->get_mediaitems().create_activeX_path(xlsx_path);
int id = ++xlsx_context->get_mediaitems().count_activeX;
std::wstring file_name = xlsx_context->get_mediaitems().activeX_path() + L"activeX" + std::to_wstring(id) + L".bin";
NSFile::CFileBinary file;
if ( file.CreateFileW(file_name) )
{
file.WriteFile(xls_global_info->controls_data.first.get() + obj->pictFmla.lPosInCtlStm, obj->pictFmla.cbBufInCtlStm);
file.CloseFile();
}
}
else if (!obj->pictFlags.fPrstm)
{
std::string object_stream;
if (obj->pictFlags.fDde) object_stream = "LNK";
else object_stream = "MBD";
object_stream += XmlUtils::IntToString(obj->pictFmla.lPosInCtlStm, "%08X") + "/";
if (xls_file->storage_->isDirectory(object_stream))
{
xlsx_context->get_mediaitems().create_embeddings_path(xlsx_path);
int id = ++xlsx_context->get_mediaitems().count_embeddings;
std::wstring file_name = L"oleObject" + std::to_wstring(id) + L".bin";
POLE::Storage *storageOle = new POLE::Storage((xlsx_context->get_mediaitems().embeddings_path() + file_name).c_str());
if ((storageOle) && (storageOle->open(true, true)))
{
xls_file->copy(0, object_stream, storageOle, false);
storageOle->close();
delete storageOle;
}
std::wstring objectId = L"objId" + std::to_wstring(id);
xlsx_context->current_sheet().sheet_rels().add(oox::relationship(
objectId, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject", L"../embeddings/" + file_name));
xlsx_context->get_drawing_context().set_ole_object(objectId, info);
}
}
}
void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream * chart) void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream * chart)
{ {
if (chart == NULL) return; if (chart == NULL) return;
......
...@@ -48,9 +48,12 @@ namespace oox ...@@ -48,9 +48,12 @@ namespace oox
} }
namespace XLS namespace XLS
{ {
class BaseObject;
class BiffStructure; class BiffStructure;
class CompoundFile;
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
class BaseObject;
typedef boost::shared_ptr<BaseObject> BaseObjectPtr; typedef boost::shared_ptr<BaseObject> BaseObjectPtr;
class GlobalWorkbookInfo; class GlobalWorkbookInfo;
...@@ -76,6 +79,7 @@ namespace XLS ...@@ -76,6 +79,7 @@ namespace XLS
class Note; class Note;
class TxO; class TxO;
class Obj;
} }
namespace ODRAW namespace ODRAW
...@@ -94,7 +98,7 @@ namespace ODRAW ...@@ -94,7 +98,7 @@ namespace ODRAW
class XlsConverter class XlsConverter
{ {
public: 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() ; ~XlsConverter() ;
oox::xlsx_conversion_context * xlsx_context; oox::xlsx_conversion_context * xlsx_context;
...@@ -118,6 +122,7 @@ public: ...@@ -118,6 +122,7 @@ public:
void convert(XLS::OBJECTS * objects, XLS::WorksheetSubstream * sheet); void convert(XLS::OBJECTS * objects, XLS::WorksheetSubstream * sheet);
void convert(XLS::MSODRAWINGGROUP * mso_drawing); void convert(XLS::MSODRAWINGGROUP * mso_drawing);
void convert(XLS::TxO * text_obj); void convert(XLS::TxO * text_obj);
void convert(XLS::Obj * obj);
void convert(XLS::Note * note); void convert(XLS::Note * note);
void convert(XLS::IMDATA * imadata); void convert(XLS::IMDATA * imadata);
void convert(XLS::PIVOTVIEW * pivot_view); void convert(XLS::PIVOTVIEW * pivot_view);
...@@ -163,4 +168,6 @@ private: ...@@ -163,4 +168,6 @@ private:
XLS::BaseObjectPtr xls_document; XLS::BaseObjectPtr xls_document;
XLS::GlobalWorkbookInfoPtr xls_global_info; XLS::GlobalWorkbookInfoPtr xls_global_info;
XLS::CompoundFilePtr xls_file;
}; };
...@@ -169,6 +169,35 @@ void external_items::create_media_path(const std::wstring & out_path) ...@@ -169,6 +169,35 @@ void external_items::create_media_path(const std::wstring & out_path)
media_path_ = xl_path + FILE_SEPARATOR_STR + L"media" + FILE_SEPARATOR_STR; 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_;
}
} }
...@@ -41,16 +41,17 @@ class rels; ...@@ -41,16 +41,17 @@ class rels;
class external_items class external_items
{ {
public: 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};
external_items() external_items()
{ {
count_charts =0; count_charts = 0;
count_shape =0; count_shape = 0;
count_image =0; count_image = 0;
count_tables =0; count_tables = 0;
count_media =0; count_media = 0;
count_activeX = 0;
count_embeddings= 0;
} }
struct item struct item
...@@ -76,6 +77,8 @@ public: ...@@ -76,6 +77,8 @@ public:
size_t count_media; size_t count_media;
size_t count_shape; size_t count_shape;
size_t count_tables; size_t count_tables;
size_t count_activeX;
size_t count_embeddings;
//std::wstring add_or_find(const std::wstring & href, Type type, bool & isInternal);//возможны ссылки на один и тот же объект //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_image (const std::wstring & file_name, int bin_id);
...@@ -88,13 +91,20 @@ public: ...@@ -88,13 +91,20 @@ public:
items_array & items() { return items_; } items_array & items() { return items_; }
void create_media_path(const std::wstring & out_path); 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 media_path();
std::wstring embeddings_path();
private: private:
std::wstring create_file_name(const std::wstring & uri, external_items::Type type, size_t Num); std::wstring create_file_name(const std::wstring & uri, external_items::Type type, size_t Num);
std::wstring media_path_; std::wstring media_path_;
std::wstring activeX_path_;
std::wstring embeddings_path_;
items_array items_; items_array items_;
}; };
......
...@@ -152,6 +152,9 @@ void xlsx_conversion_context::end_external() ...@@ -152,6 +152,9 @@ void xlsx_conversion_context::end_external()
void xlsx_conversion_context::end_table() void xlsx_conversion_context::end_table()
{ {
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().serialize_hyperlinks(current_sheet().hyperlinks());
get_table_context().dump_rels_hyperlinks(current_sheet().sheet_rels()); get_table_context().dump_rels_hyperlinks(current_sheet().sheet_rels());
......
...@@ -289,6 +289,7 @@ xlsx_drawing_context::xlsx_drawing_context(xlsx_conversion_context & Context) : ...@@ -289,6 +289,7 @@ xlsx_drawing_context::xlsx_drawing_context(xlsx_conversion_context & Context) :
, rels_ (xlsx_drawings_rels::create()) , rels_ (xlsx_drawings_rels::create())
, vml_HF_rels_ (xlsx_drawings_rels::create()) , vml_HF_rels_ (xlsx_drawings_rels::create())
, vml_comments_rels_(xlsx_drawings_rels::create()) , vml_comments_rels_(xlsx_drawings_rels::create())
, sheet_rels_ (xlsx_drawings_rels::create())
{ {
in_chart_ = false; in_chart_ = false;
count_object = 0; count_object = 0;
...@@ -534,6 +535,10 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state) ...@@ -534,6 +535,10 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
else else
drawing_state->type = external_items::typeShape; drawing_state->type = external_items::typeShape;
} }
if ( drawing_state->type == external_items::typeOleObject )
{
serialize_shape(drawing_state);
}
if ( drawing_state->type == external_items::typeChart ) if ( drawing_state->type == external_items::typeChart )
{ {
//функциональная часть //функциональная часть
...@@ -595,7 +600,10 @@ void xlsx_drawing_context::serialize_group() ...@@ -595,7 +600,10 @@ void xlsx_drawing_context::serialize_group()
{ {
CP_XML_ATTR(L"descr", drawing_state->description); CP_XML_ATTR(L"descr", drawing_state->description);
} }
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty()) if (!drawing_state->hyperlink.empty())
{ {
CP_XML_NODE(L"a:hlinkClick") CP_XML_NODE(L"a:hlinkClick")
...@@ -796,12 +804,13 @@ void xlsx_drawing_context::serialize_pic(_drawing_state_ptr & drawing_state, std ...@@ -796,12 +804,13 @@ void xlsx_drawing_context::serialize_pic(_drawing_state_ptr & drawing_state, std
{ {
CP_XML_NODE(L"xdr:pic") CP_XML_NODE(L"xdr:pic")
{ {
CP_XML_ATTR(L"macro", drawing_state->macro);
CP_XML_NODE(L"xdr:nvPicPr") CP_XML_NODE(L"xdr:nvPicPr")
{ {
CP_XML_NODE(L"xdr:cNvPr") CP_XML_NODE(L"xdr:cNvPr")
{ {
CP_XML_ATTR(L"id", drawing_state->id); CP_XML_ATTR(L"id", drawing_state->id);
if (drawing_state->name.empty()) if (drawing_state->name.empty())
drawing_state->name = L"Picture_" + rId.substr(5); drawing_state->name = L"Picture_" + rId.substr(5);
CP_XML_ATTR(L"name", drawing_state->name); CP_XML_ATTR(L"name", drawing_state->name);
...@@ -810,6 +819,10 @@ void xlsx_drawing_context::serialize_pic(_drawing_state_ptr & drawing_state, std ...@@ -810,6 +819,10 @@ void xlsx_drawing_context::serialize_pic(_drawing_state_ptr & drawing_state, std
{ {
CP_XML_ATTR(L"descr", drawing_state->description); CP_XML_ATTR(L"descr", drawing_state->description);
} }
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty()) if (!drawing_state->hyperlink.empty())
{ {
...@@ -872,6 +885,10 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s ...@@ -872,6 +885,10 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
{ {
CP_XML_ATTR(L"descr", drawing_state->description); CP_XML_ATTR(L"descr", drawing_state->description);
} }
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
} }
CP_XML_NODE(L"xdr:cNvGraphicFramePr"); CP_XML_NODE(L"xdr:cNvGraphicFramePr");
...@@ -932,6 +949,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state) ...@@ -932,6 +949,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{ {
CP_XML_NODE(L"xdr:sp") CP_XML_NODE(L"xdr:sp")
{ {
CP_XML_ATTR(L"macro", drawing_state->macro);
CP_XML_NODE(L"xdr:nvSpPr") CP_XML_NODE(L"xdr:nvSpPr")
{ {
CP_XML_NODE(L"xdr:cNvPr") CP_XML_NODE(L"xdr:cNvPr")
...@@ -942,6 +961,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state) ...@@ -942,6 +961,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{ {
if (drawing_state->wordart.is) if (drawing_state->wordart.is)
drawing_state->name = L"WordArt_" + std::to_wstring(count_object); 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 else
drawing_state->name = L"Shape_" + std::to_wstring(count_object); drawing_state->name = L"Shape_" + std::to_wstring(count_object);
} }
...@@ -951,7 +972,10 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state) ...@@ -951,7 +972,10 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{ {
CP_XML_ATTR(L"descr", drawing_state->description); CP_XML_ATTR(L"descr", drawing_state->description);
} }
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty()) if (!drawing_state->hyperlink.empty())
{ {
CP_XML_NODE(L"a:hlinkClick") CP_XML_NODE(L"a:hlinkClick")
...@@ -961,6 +985,22 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state) ...@@ -961,6 +985,22 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
CP_XML_ATTR(L"r:id", drawing_state->hyperlink); 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") CP_XML_NODE(L"xdr:cNvSpPr")
{ {
...@@ -1338,20 +1378,20 @@ void xlsx_drawing_context::serialize_gradient_fill(std::wostream & stream, _draw ...@@ -1338,20 +1378,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) CP_XML_WRITER(stream)
{ {
if (drawing_state->type_anchor == 1) 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: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: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: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: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:col") { CP_XML_CONTENT (drawing_state->sheet_anchor.colTo); }
CP_XML_NODE(L"xdr:colOff") { CP_XML_CONTENT (drawing_state->sheet_anchor.xTo); } CP_XML_NODE(L"xdr:colOff") { CP_XML_CONTENT (drawing_state->sheet_anchor.xTo); }
...@@ -1361,12 +1401,12 @@ void xlsx_drawing_context::serialize_anchor (std::wostream & stream, _drawing_st ...@@ -1361,12 +1401,12 @@ void xlsx_drawing_context::serialize_anchor (std::wostream & stream, _drawing_st
} }
if (drawing_state->type_anchor == 3) 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"x", (int)(drawing_state->absolute_anchor.x * 12700));
CP_XML_ATTR(L"y", (int)(drawing_state->absolute_anchor.y * 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"cx", (int)(drawing_state->absolute_anchor.cx * 12700));
CP_XML_ATTR(L"cy", (int)(drawing_state->absolute_anchor.cy * 12700)); CP_XML_ATTR(L"cy", (int)(drawing_state->absolute_anchor.cy * 12700));
...@@ -1739,6 +1779,46 @@ void xlsx_drawing_context::serialize(std::wostream & stream, _drawing_state_ptr ...@@ -1739,6 +1779,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) void xlsx_drawing_context::set_name(const std::wstring & str)
{ {
...@@ -1752,6 +1832,21 @@ void xlsx_drawing_context::set_description(const std::wstring & str) ...@@ -1752,6 +1832,21 @@ void xlsx_drawing_context::set_description(const std::wstring & str)
current_drawing_states->back()->description = 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()->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) 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; if (current_drawing_states == NULL) return;
...@@ -2487,6 +2582,10 @@ xlsx_drawings_rels_ptr xlsx_drawing_context::get_vml_comments_rels() ...@@ -2487,6 +2582,10 @@ xlsx_drawings_rels_ptr xlsx_drawing_context::get_vml_comments_rels()
{ {
return vml_comments_rels_; return vml_comments_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) bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::wstring sRgbColor2, _drawing_state_ptr & drawing_state)
{ {
if (drawing_state->fill.texture_target.length() < 6) return false; if (drawing_state->fill.texture_target.length() < 6) return false;
...@@ -2500,7 +2599,15 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std:: ...@@ -2500,7 +2599,15 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::
return bgraFrame.ReColorPatternImage(image_path, rgbColor1, rgbColor2); 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) void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
{ {
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
...@@ -2565,6 +2672,7 @@ void xlsx_drawing_context::serialize(std::wostream & strm) ...@@ -2565,6 +2672,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: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: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: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++) for (size_t i = 0 ; i < drawing_states.size(); i++)
{ {
......
...@@ -135,7 +135,8 @@ public: ...@@ -135,7 +135,8 @@ public:
flipH(false), flipV(false), flipH(false), flipV(false),
bTextBox(false), bTextBox(false),
type_anchor(0), type_anchor(0),
vmlwrite_mode_(false) vmlwrite_mode_(false),
hidden(false)
{ {
id = -1; id = -1;
rotation = 0; rotation = 0;
...@@ -146,20 +147,24 @@ public: ...@@ -146,20 +147,24 @@ public:
} }
external_items::Type type; external_items::Type type;
bool hidden;
std::wstring name; std::wstring name;
std::wstring description; std::wstring description;
std::wstring macro;
std::wstring objectId;
std::wstring objectProgId;
struct _anchor struct _anchor
{ {
_anchor() : colFrom(-1), rwFrom(-1), colTo(-1), rwTo(0), xFrom(0), yFrom(0),xTo(0),yTo(0){} int colFrom = -1;
int colFrom; int xFrom = 0;
int xFrom; int rwFrom = -1;
int rwFrom; int yFrom = 0;
int yFrom; int colTo = 0;
int colTo; int xTo = 0;
int xTo; int rwTo = 0;
int rwTo; int yTo = 0;
int yTo;
} sheet_anchor; } sheet_anchor;
_rect child_anchor; _rect child_anchor;
_rect group_anchor; _rect group_anchor;
...@@ -313,6 +318,7 @@ public: ...@@ -313,6 +318,7 @@ public:
xlsx_drawings_rels_ptr get_rels(); xlsx_drawings_rels_ptr get_rels();
xlsx_drawings_rels_ptr get_vml_HF_rels(); xlsx_drawings_rels_ptr get_vml_HF_rels();
xlsx_drawings_rels_ptr get_vml_comments_rels(); xlsx_drawings_rels_ptr get_vml_comments_rels();
xlsx_drawings_rels_ptr get_sheet_rels();
bool empty(); bool empty();
bool empty_vml_HF(); bool empty_vml_HF();
...@@ -335,6 +341,8 @@ public: ...@@ -335,6 +341,8 @@ public:
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
void set_name (const std::wstring & str); void set_name (const std::wstring & str);
void set_description (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_top (double val);
void set_crop_bottom (double val); void set_crop_bottom (double val);
...@@ -422,6 +430,7 @@ public: ...@@ -422,6 +430,7 @@ public:
void serialize_shape (_drawing_state_ptr & drawing_state); void serialize_shape (_drawing_state_ptr & drawing_state);
void serialize_chart (_drawing_state_ptr & drawing_state, std::wstring rId ); void serialize_chart (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_pic (_drawing_state_ptr & drawing_state, std::wstring rId ); void serialize_pic (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_object (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_shape_comment(_drawing_state_ptr & drawing_state); //part of vml shape void serialize_shape_comment(_drawing_state_ptr & drawing_state); //part of vml shape
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -433,9 +442,11 @@ public: ...@@ -433,9 +442,11 @@ public:
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
void serialize (std::wostream & stream, _drawing_state_ptr & drawing_state); void serialize (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_vml (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_vml_HF (std::wostream & stream); void serialize_vml_HF (std::wostream & stream);
void serialize_vml_comments (std::wostream & stream); void serialize_vml_comments (std::wostream & stream);
void serialize_objects (std::wostream & stream);
void serialize (std::wostream & stream); void serialize (std::wostream & stream);
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
bool is_lined_shape (_drawing_state_ptr & drawing_state); bool is_lined_shape (_drawing_state_ptr & drawing_state);
...@@ -450,6 +461,7 @@ private: ...@@ -450,6 +461,7 @@ private:
xlsx_drawings_rels_ptr rels_; xlsx_drawings_rels_ptr rels_;
xlsx_drawings_rels_ptr vml_comments_rels_; xlsx_drawings_rels_ptr vml_comments_rels_;
xlsx_drawings_rels_ptr vml_HF_rels_; xlsx_drawings_rels_ptr vml_HF_rels_;
xlsx_drawings_rels_ptr sheet_rels_;
int count_object; int count_object;
bool in_chart_; bool in_chart_;
...@@ -474,7 +486,7 @@ private: ...@@ -474,7 +486,7 @@ private:
void serialize_line (std::wostream & stream, _drawing_state_ptr & drawing_state); void serialize_line (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_xfrm (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_text (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_color (std::wostream & stream, const _color &color, double opacity = 0); void serialize_color (std::wostream & stream, const _color &color, double opacity = 0);
......
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
std::wstringstream sheetFormatPr_; std::wstringstream sheetFormatPr_;
std::wstringstream sheetData_; std::wstringstream sheetData_;
std::wstringstream mergeCells_; std::wstringstream mergeCells_;
std::wstringstream ole_objects_;
std::wstringstream drawing_; std::wstringstream drawing_;
std::wstringstream hyperlinks_; std::wstringstream hyperlinks_;
std::wstringstream comments_; std::wstringstream comments_;
...@@ -132,6 +133,10 @@ std::wostream & xlsx_xml_worksheet::mergeCells() ...@@ -132,6 +133,10 @@ std::wostream & xlsx_xml_worksheet::mergeCells()
{ {
return impl_->mergeCells_; return impl_->mergeCells_;
} }
std::wostream & xlsx_xml_worksheet::ole_objects()
{
return impl_->ole_objects_;
}
std::wostream & xlsx_xml_worksheet::drawing() std::wostream & xlsx_xml_worksheet::drawing()
{ {
...@@ -183,6 +188,8 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm) ...@@ -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", 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: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: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"mc:Ignorable", L"x14ac");
CP_XML_ATTR(L"xmlns:x14ac", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); CP_XML_ATTR(L"xmlns:x14ac", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
...@@ -230,7 +237,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm) ...@@ -230,7 +237,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_ATTR(L"r:id", impl_->vml_drawingId_HF_); CP_XML_ATTR(L"r:id", impl_->vml_drawingId_HF_);
} }
} }
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_STREAM() << impl_->picture_background_.str();
//CP_XML_NODE(L"rowBreaks){} //CP_XML_NODE(L"rowBreaks){}
......
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
std::wostream & hyperlinks(); std::wostream & hyperlinks();
std::wostream & mergeCells(); std::wostream & mergeCells();
std::wostream & drawing(); std::wostream & drawing();
std::wostream & ole_objects();
//std::wostream & comments(); //std::wostream & comments();
std::wostream & sheetSortAndFilters(); std::wostream & sheetSortAndFilters();
std::wostream & pageProperties(); std::wostream & pageProperties();
......
...@@ -143,12 +143,21 @@ std::wstring xlsx_table_context::add_hyperlink(std::wstring const & ref, std::ws ...@@ -143,12 +143,21 @@ std::wstring xlsx_table_context::add_hyperlink(std::wstring const & ref, std::ws
} }
void xlsx_table_context::dump_rels_hyperlinks(rels & Rels) 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) 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);
}
} }
...@@ -72,6 +72,9 @@ public: ...@@ -72,6 +72,9 @@ public:
void dump_rels_hyperlinks(rels & Rels); void dump_rels_hyperlinks(rels & Rels);
void serialize_hyperlinks(std::wostream & _Wostream); void serialize_hyperlinks(std::wostream & _Wostream);
void dump_rels_ole_objects(rels & Rels);
void serialize_ole_objects(std::wostream & _Wostream);
private: private:
xlsx_conversion_context & context_; xlsx_conversion_context & context_;
......
...@@ -5,6 +5,9 @@ if exist "depot_tools" ( ...@@ -5,6 +5,9 @@ if exist "depot_tools" (
echo "depot_tools already fetched" echo "depot_tools already fetched"
) else ( ) else (
call git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 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 call powershell -File .\fix-depot_tools.ps1
) )
......
...@@ -255,7 +255,13 @@ namespace XmlUtils ...@@ -255,7 +255,13 @@ namespace XmlUtils
sstream << boost::wformat(format) % value; sstream << boost::wformat(format) % value;
return sstream.str(); return sstream.str();
} }
AVSINLINE static std::string IntToString( int value, const char* format )
{
if ( format == NULL ) return "";
std::stringstream sstream;
sstream << boost::format(format) % value;
return sstream.str();
}
AVSINLINE static std::wstring DoubleToString( double value, wchar_t* format ) AVSINLINE static std::wstring DoubleToString( double value, wchar_t* format )
{ {
if ( format == NULL ) return L""; if ( format == NULL ) return L"";
......
...@@ -154,6 +154,7 @@ namespace OOX ...@@ -154,6 +154,7 @@ namespace OOX
smart_ptr<PPTX::Logic::Shape> shape = m_oElement->GetElem().smart_dynamic_cast<PPTX::Logic::Shape>(); smart_ptr<PPTX::Logic::Shape> shape = m_oElement->GetElem().smart_dynamic_cast<PPTX::Logic::Shape>();
if (shape.IsInit()) if (shape.IsInit())
{ {
m_nId = shape->nvSpPr.cNvPr.id;
if (shape->nvSpPr.cNvPr.oleSpid.IsInit()) if (shape->nvSpPr.cNvPr.oleSpid.IsInit())
{ {
//ссылка на объект //ссылка на объект
...@@ -221,6 +222,7 @@ namespace OOX ...@@ -221,6 +222,7 @@ namespace OOX
//для удобства //для удобства
nullable<std::wstring> m_sSpId; nullable<std::wstring> m_sSpId;
nullable<int> m_nId;
}; };
} //Spreadsheet } //Spreadsheet
} // namespace OOX } // namespace OOX
......
...@@ -546,6 +546,7 @@ namespace NSDoctRenderer ...@@ -546,6 +546,7 @@ namespace NSDoctRenderer
std::wstring m_strFilePath; std::wstring m_strFilePath;
std::wstring m_strAllFonts; std::wstring m_strAllFonts;
bool m_bIsNotUseConfigAllFontsDir;
std::wstring m_sTmpFolder; std::wstring m_sTmpFolder;
std::wstring m_sFileDir; std::wstring m_sFileDir;
...@@ -585,6 +586,8 @@ namespace NSDoctRenderer ...@@ -585,6 +586,8 @@ namespace NSDoctRenderer
m_sGlobalVariable = ""; m_sGlobalVariable = "";
m_bIsGlobalVariableUse = false; m_bIsGlobalVariableUse = false;
m_bIsNotUseConfigAllFontsDir = false;
} }
void Init() void Init()
...@@ -634,7 +637,7 @@ namespace NSDoctRenderer ...@@ -634,7 +637,7 @@ namespace NSDoctRenderer
oNodes.GetAt(i, _node); oNodes.GetAt(i, _node);
std::wstring strFilePath = _node.GetText(); std::wstring strFilePath = _node.GetText();
if (std::wstring::npos != strFilePath.find(L"AllFonts.js")) if (std::wstring::npos != strFilePath.find(L"AllFonts.js") && !m_bIsNotUseConfigAllFontsDir)
{ {
m_strAllFonts = strFilePath; m_strAllFonts = strFilePath;
...@@ -1717,6 +1720,11 @@ namespace NSDoctRenderer ...@@ -1717,6 +1720,11 @@ namespace NSDoctRenderer
m_pInternal->m_bIsCacheScript = (std::wstring(value) == L"true"); m_pInternal->m_bIsCacheScript = (std::wstring(value) == L"true");
else if (sParam == "--save-use-only-names") else if (sParam == "--save-use-only-names")
m_pInternal->m_sFolderForSaveOnlyUseNames = std::wstring(value); m_pInternal->m_sFolderForSaveOnlyUseNames = std::wstring(value);
else if (sParam == "--all-fonts-path")
{
m_pInternal->m_strAllFonts = std::wstring(value);
m_pInternal->m_bIsNotUseConfigAllFontsDir = true;
}
else if (sParam == "--argument") else if (sParam == "--argument")
{ {
std::wstring sArg(value); std::wstring sArg(value);
......
...@@ -43,9 +43,11 @@ endif ...@@ -43,9 +43,11 @@ endif
TARGET := $(PLATFORM)_$(ARCHITECTURE) TARGET := $(PLATFORM)_$(ARCHITECTURE)
LIBDIR := build/lib/$(TARGET) LIBDIR := build/lib/$(TARGET)
BINDIR := build/bin/$(TARGET)
ALLFONTSGEN := build/bin/AllFontsGen/$(TARGET)$(EXEC_EXT) ALLFONTSGEN := build/bin/AllFontsGen/$(TARGET)$(EXEC_EXT)
X2T := build/bin/$(TARGET)/x2t$(EXEC_EXT) X2T := $(BINDIR)/x2t$(EXEC_EXT)
DOCBUILDER := $(BINDIR)/docbuilder$(EXEC_EXT)
HTMLFILEINTERNAL := $(LIBDIR)/HtmlFileInternal$(EXEC_EXT) HTMLFILEINTERNAL := $(LIBDIR)/HtmlFileInternal$(EXEC_EXT)
XLSFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)XlsFormatLib$(LIB_EXT) XLSFORMATLIB := $(LIBDIR)/$(LIB_PREFIX)XlsFormatLib$(LIB_EXT)
ODFFILEWRITERLIB := $(LIBDIR)/$(LIB_PREFIX)OdfFileWriterLib$(LIB_EXT) ODFFILEWRITERLIB := $(LIBDIR)/$(LIB_PREFIX)OdfFileWriterLib$(LIB_EXT)
...@@ -75,6 +77,7 @@ HUNSPELL := $(LIBDIR)/$(LIB_PREFIX)hunspell$(SHARED_EXT) ...@@ -75,6 +77,7 @@ HUNSPELL := $(LIBDIR)/$(LIB_PREFIX)hunspell$(SHARED_EXT)
TARGETS += $(ALLFONTSGEN) TARGETS += $(ALLFONTSGEN)
TARGETS += $(X2T) TARGETS += $(X2T)
TARGETS += $(DOCBUILDER)
TARGETS += $(HTMLFILEINTERNAL) TARGETS += $(HTMLFILEINTERNAL)
TARGETS += $(XLSFORMATLIB) TARGETS += $(XLSFORMATLIB)
TARGETS += $(ODFFILEWRITERLIB) TARGETS += $(ODFFILEWRITERLIB)
...@@ -105,6 +108,7 @@ TARGETS += $(HUNSPELL) ...@@ -105,6 +108,7 @@ TARGETS += $(HUNSPELL)
X2T_PRO := $(abspath X2tConverter/build/Qt/X2tSLN.pro) X2T_PRO := $(abspath X2tConverter/build/Qt/X2tSLN.pro)
HTMLFILEINTERNAL_PRO := $(abspath ../desktop-sdk/HtmlFile/Internal/Internal.pro) HTMLFILEINTERNAL_PRO := $(abspath ../desktop-sdk/HtmlFile/Internal/Internal.pro)
ALLFONTSGEN_PRO := $(abspath DesktopEditor/AllFontsGen/AllFontsGen.pro) ALLFONTSGEN_PRO := $(abspath DesktopEditor/AllFontsGen/AllFontsGen.pro)
DOCBUILDER_PRO := $(abspath ../core-ext/docbuilder/test_builder/docbuilder.pro)
XLSFORMATLIB_PRO := $(abspath ASCOfficeXlsFile2/source/linux/XlsFormatLib.pro) XLSFORMATLIB_PRO := $(abspath ASCOfficeXlsFile2/source/linux/XlsFormatLib.pro)
ODFFILEWRITERLIB_PRO := $(abspath ASCOfficeOdfFileW/linux/OdfFileWriterLib.pro) ODFFILEWRITERLIB_PRO := $(abspath ASCOfficeOdfFileW/linux/OdfFileWriterLib.pro)
ODFFILEREADERLIB_PRO := $(abspath ASCOfficeOdfFile/linux/OdfFileReaderLib.pro) ODFFILEREADERLIB_PRO := $(abspath ASCOfficeOdfFile/linux/OdfFileReaderLib.pro)
...@@ -157,6 +161,7 @@ HUNSPELL_PRO := $(abspath DesktopEditor/hunspell-1.3.3/src/qt/hunspell.pro) ...@@ -157,6 +161,7 @@ HUNSPELL_PRO := $(abspath DesktopEditor/hunspell-1.3.3/src/qt/hunspell.pro)
QT_PROJ += X2T QT_PROJ += X2T
QT_PROJ += HTMLFILEINTERNAL QT_PROJ += HTMLFILEINTERNAL
QT_PROJ += ALLFONTSGEN QT_PROJ += ALLFONTSGEN
QT_PROJ += DOCBUILDER
QT_PROJ += XLSFORMATLIB QT_PROJ += XLSFORMATLIB
QT_PROJ += ODFFILEWRITERLIB QT_PROJ += ODFFILEWRITERLIB
QT_PROJ += ODFFILEREADERLIB QT_PROJ += ODFFILEREADERLIB
...@@ -214,6 +219,8 @@ ALLFONTSGEN_DEP += $(GRAPHICS) ...@@ -214,6 +219,8 @@ ALLFONTSGEN_DEP += $(GRAPHICS)
ALLFONTSGEN_DEP += $(OFFICEUTILS) ALLFONTSGEN_DEP += $(OFFICEUTILS)
ALLFONTSGEN_DEP += $(UNICODECONVERTER) ALLFONTSGEN_DEP += $(UNICODECONVERTER)
DOCBUILDER_DEP += $(DOCTRENDERER)
HTMLFILE_DEP += $(UNICODECONVERTER) HTMLFILE_DEP += $(UNICODECONVERTER)
RTFFORMATLIB_DEP += $(UNICODECONVERTER) RTFFORMATLIB_DEP += $(UNICODECONVERTER)
...@@ -271,7 +278,7 @@ bin: $(X2T) $(ALLFONTSGEN) ...@@ -271,7 +278,7 @@ bin: $(X2T) $(ALLFONTSGEN)
lib: $(PDFWRITER) $(DOCTRENDERER) $(HTMLRENDERER) $(PDFREADER) $(DJVUFILE) $(XPSFILE) $(HTMLFILE) $(UNICODECONVERTER) lib: $(PDFWRITER) $(DOCTRENDERER) $(HTMLRENDERER) $(PDFREADER) $(DJVUFILE) $(XPSFILE) $(HTMLFILE) $(UNICODECONVERTER)
ext: $(ASCDOCUMENTSCORE) $(HTMLFILEINTERNAL) ext: $(ASCDOCUMENTSCORE) $(HTMLFILEINTERNAL) $(DOCBUILDER)
$(foreach proj, $(QT_PROJ), $(eval $(call build_proj_tmpl, $(proj)))) $(foreach proj, $(QT_PROJ), $(eval $(call build_proj_tmpl, $(proj))))
...@@ -283,6 +290,8 @@ $(XPSFILE): $(XPSFILE_DEP) ...@@ -283,6 +290,8 @@ $(XPSFILE): $(XPSFILE_DEP)
$(ALLFONTSGEN): $(ALLFONTSGEN_DEP) $(ALLFONTSGEN): $(ALLFONTSGEN_DEP)
$(DOCBUILDER): $(DOCBUILDER_DEP)
$(HTMLFILE): $(HTMLFILE_DEP) $(HTMLFILE): $(HTMLFILE_DEP)
$(RTFFORMATLIB): $(RTFFORMATLIB_DEP) $(RTFFORMATLIB): $(RTFFORMATLIB_DEP)
......
...@@ -5,19 +5,22 @@ ...@@ -5,19 +5,22 @@
int _tmain(int argc, _TCHAR* argv[]) int _tmain(int argc, _TCHAR* argv[])
{ {
std::wstring srcFileName = L"D:\\test\\_crypted\\test-password-2016.docx"; //std::wstring srcFileName = L"D:\\test\\_crypted\\test-password-2016.docx";
std::wstring dstFileName = srcFileName + L".oox"; //std::wstring dstFileName = srcFileName + L".oox";
std::wstring dstFileName2 = dstFileName + L"-mycrypt.docx"; //std::wstring dstFileName2 = dstFileName + L"-mycrypt.docx";
std::wstring password = L"password"; std::wstring srcFileName = L"D:\\test\\_crypted\\test.docx";
std::wstring dstFileName2 = srcFileName + L"-mycrypt.docx";
std::wstring password = L"password132eqdqdwewedwdwwskskms09elzwewedskjsdnkjsdnjksjsnkcsdncskjdnss";
ECMACryptFile crypt_file; ECMACryptFile crypt_file;
bool result, bDataIntegrity; bool result, bDataIntegrity;
result = crypt_file.DecryptOfficeFile(srcFileName, dstFileName, password, bDataIntegrity); //result = crypt_file.DecryptOfficeFile(srcFileName, dstFileName, password, bDataIntegrity);
result = crypt_file.EncryptOfficeFile(dstFileName, dstFileName2, password);
//result = crypt_file.EncryptOfficeFile(dstFileName, dstFileName2, password);
result = crypt_file.EncryptOfficeFile(srcFileName, dstFileName2, password);
return 0; return 0;
} }
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../DesktopEditor/xml/build/vs2005;../../DesktopEditor/xml/libxml2/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
......
...@@ -471,11 +471,13 @@ namespace NExtractTools ...@@ -471,11 +471,13 @@ namespace NExtractTools
std::wstring sName = oXmlNode.GetName(); std::wstring sName = oXmlNode.GetName();
if(_T("m_oMailMergeSend") == sName) if(_T("m_oMailMergeSend") == sName)
{ {
RELEASEOBJECT(m_oMailMergeSend);
m_oMailMergeSend = new InputParamsMailMerge(); m_oMailMergeSend = new InputParamsMailMerge();
m_oMailMergeSend->FromXmlNode(oXmlNode); m_oMailMergeSend->FromXmlNode(oXmlNode);
} }
else if(_T("m_oThumbnail") == sName) else if(_T("m_oThumbnail") == sName)
{ {
RELEASEOBJECT(m_oThumbnail);
m_oThumbnail = new InputParamsThumbnail(); m_oThumbnail = new InputParamsThumbnail();
m_oThumbnail->FromXmlNode(oXmlNode); m_oThumbnail->FromXmlNode(oXmlNode);
} }
...@@ -485,49 +487,107 @@ namespace NExtractTools ...@@ -485,49 +487,107 @@ namespace NExtractTools
if(oXmlNode.GetTextIfExist(sValue)) if(oXmlNode.GetTextIfExist(sValue))
{ {
if(_T("m_sKey") == sName) if(_T("m_sKey") == sName)
{
RELEASEOBJECT(m_sKey);
m_sKey = new std::wstring(sValue); m_sKey = new std::wstring(sValue);
}
else if(_T("m_sFileFrom") == sName) else if(_T("m_sFileFrom") == sName)
{
RELEASEOBJECT(m_sFileFrom);
m_sFileFrom = new std::wstring(sValue); m_sFileFrom = new std::wstring(sValue);
}
else if(_T("m_sFileTo") == sName) else if(_T("m_sFileTo") == sName)
{
RELEASEOBJECT(m_sFileTo);
m_sFileTo = new std::wstring(sValue); m_sFileTo = new std::wstring(sValue);
}
else if(_T("m_nFormatFrom") == sName) else if(_T("m_nFormatFrom") == sName)
{
RELEASEOBJECT(m_nFormatFrom);
m_nFormatFrom = new int(XmlUtils::GetInteger(sValue)); m_nFormatFrom = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_nFormatTo") == sName) else if(_T("m_nFormatTo") == sName)
{
RELEASEOBJECT(m_nFormatTo);
m_nFormatTo = new int(XmlUtils::GetInteger(sValue)); m_nFormatTo = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_nCsvTxtEncoding") == sName) else if(_T("m_nCsvTxtEncoding") == sName)
{
RELEASEOBJECT(m_nCsvTxtEncoding);
m_nCsvTxtEncoding = new int(XmlUtils::GetInteger(sValue)); m_nCsvTxtEncoding = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_nCsvDelimiter") == sName) else if(_T("m_nCsvDelimiter") == sName)
{
RELEASEOBJECT(m_nCsvDelimiter);
m_nCsvDelimiter = new int(XmlUtils::GetInteger(sValue)); m_nCsvDelimiter = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_nCsvDelimiterChar") == sName) else if(_T("m_nCsvDelimiterChar") == sName)
{
RELEASEOBJECT(m_sCsvDelimiterChar);
m_sCsvDelimiterChar = new std::wstring(sValue); m_sCsvDelimiterChar = new std::wstring(sValue);
}
else if(_T("m_bPaid") == sName) else if(_T("m_bPaid") == sName)
{
RELEASEOBJECT(m_bPaid);
m_bPaid = new bool(XmlUtils::GetBoolean2(sValue)); m_bPaid = new bool(XmlUtils::GetBoolean2(sValue));
}
else if(_T("m_bFromChanges") == sName) else if(_T("m_bFromChanges") == sName)
{
RELEASEOBJECT(m_bFromChanges);
m_bFromChanges = new bool(XmlUtils::GetBoolean2(sValue)); m_bFromChanges = new bool(XmlUtils::GetBoolean2(sValue));
}
else if(_T("m_sAllFontsPath") == sName) else if(_T("m_sAllFontsPath") == sName)
{
RELEASEOBJECT(m_sAllFontsPath);
m_sAllFontsPath = new std::wstring(sValue); m_sAllFontsPath = new std::wstring(sValue);
}
else if(_T("m_sFontDir") == sName) else if(_T("m_sFontDir") == sName)
{
RELEASEOBJECT(m_sFontDir);
m_sFontDir = new std::wstring(sValue); m_sFontDir = new std::wstring(sValue);
}
else if(_T("m_sThemeDir") == sName) else if(_T("m_sThemeDir") == sName)
{
RELEASEOBJECT(m_sThemeDir);
m_sThemeDir = new std::wstring(sValue); m_sThemeDir = new std::wstring(sValue);
}
else if(_T("m_bDontSaveAdditional") == sName) else if(_T("m_bDontSaveAdditional") == sName)
{
RELEASEOBJECT(m_bDontSaveAdditional);
m_bDontSaveAdditional = new bool(XmlUtils::GetBoolean2(sValue)); m_bDontSaveAdditional = new bool(XmlUtils::GetBoolean2(sValue));
}
else if(_T("m_nDoctParams") == sName) else if(_T("m_nDoctParams") == sName)
{
RELEASEOBJECT(m_nDoctParams);
m_nDoctParams = new int(XmlUtils::GetInteger(sValue)); m_nDoctParams = new int(XmlUtils::GetInteger(sValue));
}
else if(_T("m_sHtmlFileInternalPath") == sName) else if(_T("m_sHtmlFileInternalPath") == sName)
{
RELEASEOBJECT(m_sHtmlFileInternalPath);
m_sHtmlFileInternalPath = new std::wstring(sValue); m_sHtmlFileInternalPath = new std::wstring(sValue);
}
else if(_T("m_sPassword") == sName) else if(_T("m_sPassword") == sName)
{
RELEASEOBJECT(m_sPassword);
m_sPassword = new std::wstring(sValue); m_sPassword = new std::wstring(sValue);
}
else if(_T("m_sTempDir") == sName) else if(_T("m_sTempDir") == sName)
{
RELEASEOBJECT(m_sTempDir);
m_sTempDir = new std::wstring(sValue); m_sTempDir = new std::wstring(sValue);
}
else if(_T("m_bIsNoBase64") == sName) else if(_T("m_bIsNoBase64") == sName)
{
RELEASEOBJECT(m_bIsNoBase64);
m_bIsNoBase64 = new bool(XmlUtils::GetBoolean2(sValue)); m_bIsNoBase64 = new bool(XmlUtils::GetBoolean2(sValue));
} }
}
else if(_T("m_nCsvDelimiterChar") == sName) else if(_T("m_nCsvDelimiterChar") == sName)
{ {
std::wstring sNil; std::wstring sNil;
if (!oXmlNode.GetAttributeIfExist(L"xsi:nil", sNil)) if (!oXmlNode.GetAttributeIfExist(L"xsi:nil", sNil))
{ {
RELEASEOBJECT(m_sCsvDelimiterChar);
m_sCsvDelimiterChar = new std::wstring(L""); m_sCsvDelimiterChar = new std::wstring(L"");
} }
} }
......
...@@ -104,33 +104,41 @@ static std::wstring utf8_to_unicode(const char *src) ...@@ -104,33 +104,41 @@ static std::wstring utf8_to_unicode(const char *src)
return getReturnErrorCode(AVS_FILEUTILS_ERROR_CONVERT_PARAMS); return getReturnErrorCode(AVS_FILEUTILS_ERROR_CONVERT_PARAMS);
} }
std::wstring sArg1, sExePath; std::wstring sArg1, sArg2, sExePath;
#if !defined(_WIN32) && !defined (_WIN64) #if !defined(_WIN32) && !defined (_WIN64)
sExePath = utf8_to_unicode(argv [0]); sExePath = utf8_to_unicode(argv [0]);
sArg1 = utf8_to_unicode(argv [1]); sArg1 = utf8_to_unicode(argv [1]);
if (argc >= 3) sArg2 = utf8_to_unicode(argv [2]);
#else #else
sExePath = std::wstring(argv [0]); sExePath = std::wstring(argv [0]);
sArg1 = std::wstring(argv [1]); sArg1 = std::wstring(argv [1]);
if (argc >= 3) sArg2 = std::wstring(argv [2]);
#endif #endif
int result = 0; int result = 0;
std::wstring sXmlExt = _T(".xml"); std::wstring sXmlExt = _T(".xml");
if(sXmlExt == sArg1.substr(sArg1.length() - sXmlExt.length(), sXmlExt.length())) if(sXmlExt == sArg1.substr(sArg1.length() - sXmlExt.length(), sXmlExt.length()))
{ {
result = NExtractTools::FromFile(sArg1); NExtractTools::InputParams oInputParams;
if (oInputParams.FromXmlFile(sArg1) && (sArg2.empty() || oInputParams.FromXml(sArg2)))
{
result = NExtractTools::fromInputParams(oInputParams);
}
else
{
result = AVS_FILEUTILS_ERROR_CONVERT_PARAMS;
}
} }
else else
{ {
std::wstring sArg2, sArg3, sArg4, sArg5; std::wstring sArg3, sArg4, sArg5;
#if !defined(_WIN32) && !defined (_WIN64) #if !defined(_WIN32) && !defined (_WIN64)
if (argc >= 3) sArg2 = utf8_to_unicode(argv [2]);
if (argc >= 4) sArg3 = utf8_to_unicode(argv [3]); if (argc >= 4) sArg3 = utf8_to_unicode(argv [3]);
if (argc >= 5) sArg4 = utf8_to_unicode(argv [4]); if (argc >= 5) sArg4 = utf8_to_unicode(argv [4]);
if (argc >= 6) sArg5 = utf8_to_unicode(argv [5]); if (argc >= 6) sArg5 = utf8_to_unicode(argv [5]);
#else #else
if (argc >= 3) sArg2 = std::wstring(argv [2]);
if (argc >= 4) sArg3 = std::wstring(argv [3]); if (argc >= 4) sArg3 = std::wstring(argv [3]);
if (argc >= 5) sArg4 = std::wstring(argv [4]); if (argc >= 5) sArg4 = std::wstring(argv [4]);
if (argc >= 6) sArg5 = std::wstring(argv [5]); if (argc >= 6) sArg5 = std::wstring(argv [5]);
......
...@@ -2956,6 +2956,15 @@ namespace BinXlsxRW ...@@ -2956,6 +2956,15 @@ namespace BinXlsxRW
if (!pCellAnchor->m_bShapeOle && pCellAnchor->isValid()) if (!pCellAnchor->m_bShapeOle && pCellAnchor->isValid())
{ {
if(oWorksheet.m_oOleObjects.IsInit() && pCellAnchor->m_nId.IsInit())
{
std::map<int, COleObject*>::const_iterator pFind = oWorksheet.m_oOleObjects->m_mapOleObjects.find(pCellAnchor->m_nId.get());
if (pFind != oWorksheet.m_oOleObjects->m_mapOleObjects.end())
{
pCellAnchor->m_bShapeOle = true;
continue;
}
}
int nCurPos = m_oBcw.WriteItemStart(c_oSerWorksheetsTypes::Drawing); int nCurPos = m_oBcw.WriteItemStart(c_oSerWorksheetsTypes::Drawing);
WriteDrawing(oWorksheet, pDrawing, pCellAnchor, pVmlDrawing); WriteDrawing(oWorksheet, pDrawing, pCellAnchor, pVmlDrawing);
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment