Commit 8fe1eb75 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - activeX, controls & ole embedded & links

parent 1deb2a69
......@@ -77,6 +77,8 @@ private:
std::map<std::string, CFStreamPtr> streams;
ReadWriteMode rwMode;
};
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
} // namespace XLS
......@@ -67,8 +67,12 @@ void MsoDrawing::readFields()
rgChildRec.rh_own.recLen = stored_record->getDataSize();
rgChildRec.loadFields(*stored_record);
if (stored_record->getRdPtr() < stored_record->getDataSize())
{
int g = 0;
}
}
isReading = true;
}
......@@ -77,6 +81,11 @@ void MsoDrawing::readFields(CFRecord& record)
record >> rgChildRec;
isReading = true;
if (record.getRdPtr() < record.getDataSize())
{
int g = 0;
}
}
......
......@@ -57,9 +57,9 @@
#define OBJ_Label 0x000E
#define OBJ_DialogBox 0x000F
#define OBJ_SpinControl 0x0010
#define OBJ_Scrollbar 0x0011
#define OBJ_List 0x0012
#define OBJ_GroupBox 0x0013
#define OBJ_Scrollbar 0x0011
#define OBJ_DropdownList 0x0014
#define OBJ_Note 0x0019
......@@ -80,7 +80,6 @@ BaseObjectPtr Obj::clone()
void Obj::readFields(CFRecord& record)
{
record >> cmo;
size_t rdPtr = record.getRdPtr();
if (record.getGlobalWorkbookInfo()->Version >= 0x0600)
{
......@@ -88,62 +87,74 @@ void Obj::readFields(CFRecord& record)
{
record.skipNunBytes(6); // Skip FtGmo (obsolete)
}
if(OBJ_Picture == cmo.ot)
if( OBJ_Picture == cmo.ot)
{
record >> pictFormat;
record >> pictFlags;
}
if(0x0B == cmo.ot || 0x0C == cmo.ot)
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot)
{
record.skipNunBytes(16); // Skip FtCbls (obsolete)
}
if(0x0C == cmo.ot)
if( OBJ_RadioButton == cmo.ot)
{
record.skipNunBytes(10); // Skip FtRbo (obsolete)
}
if(0x10 == cmo.ot || 0x11 == cmo.ot || 0x12 == cmo.ot || 0x14 == cmo.ot)
if( OBJ_SpinControl == cmo.ot ||
OBJ_Scrollbar == cmo.ot ||
OBJ_List == cmo.ot ||
OBJ_DropdownList == cmo.ot)
{
record >> sbs;
}
if(0x19 == cmo.ot)
if( OBJ_Note == cmo.ot)
{
record >> nts;
}
//if(false) // TODO: Find out the condition
//{
// macro.load(record);
//}
if(0x0B == cmo.ot || 0x0C == cmo.ot || 0x10 == cmo.ot || 0x11 == cmo.ot || 0x12 == cmo.ot /*|| 0x14 == cmo.ot*/)
macro.load(record);
if( OBJ_Picture == cmo.ot)
{
pictFmla.load(record, pictFlags);
}
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot ||
OBJ_SpinControl == cmo.ot ||
OBJ_Scrollbar == cmo.ot ||
OBJ_List == cmo.ot /*|| OBJ_DropdownList == cmo.ot*/)
{
linkFmla.load(record);
}
if(0x0B == cmo.ot || 0x0C == cmo.ot)
if( OBJ_CheckBox == cmo.ot ||
OBJ_RadioButton == cmo.ot)
{
checkBox.load(record);
}
if(0x0C == cmo.ot)
if( OBJ_RadioButton == cmo.ot)
{
radioButton.load(record);
}
if(0x0D == cmo.ot)
if( OBJ_EditBox == cmo.ot)
{
edit.load(record);
}
if(0x12 == cmo.ot || 0x14 == cmo.ot)
if( OBJ_List == cmo.ot ||
OBJ_DropdownList == cmo.ot)
{
list.load(record, cmo.ot);
}
if(0x13 == cmo.ot)
if( OBJ_GroupBox == cmo.ot)
{
gbo.load(record);
}
if(0x12 != cmo.ot && 0x14 != cmo.ot)
}
if( OBJ_List != cmo.ot && OBJ_DropdownList != cmo.ot)
{
record.skipNunBytes(4); // reserved
}
//------------------------------------------------------------------------------------------------------
if (continue_records.size() > 0)
{
std::list<CFRecordPtr>& recs = continue_records[rt_Continue];
......
......@@ -32,27 +32,25 @@
#pragma once
#include "BiffRecordContinued.h"
#include <Logic/Biff_structures/FtCmo.h>
#include <Logic/Biff_structures/FtCf.h>
#include <Logic/Biff_structures/FtPioGrbit.h>
#include <Logic/Biff_structures/FtSbs.h>
#include <Logic/Biff_structures/FtNts.h>
#include <Logic/Biff_structures/FtMacro.h>
#include <Logic/Biff_structures/FtPictFmla.h>
#include <Logic/Biff_structures/ObjLinkFmla.h>
#include <Logic/Biff_structures/FtCblsData.h>
#include <Logic/Biff_structures/FtRboData.h>
#include <Logic/Biff_structures/FtEdoData.h>
#include <Logic/Biff_structures/FtLbsData.h>
#include <Logic/Biff_structures/FtGboData.h>
#include <Logic/Biff_records/MsoDrawing.h>
#include "MsoDrawing.h"
#include "../Biff_structures/FtCmo.h"
#include "../Biff_structures/FtCf.h"
#include "../Biff_structures/FtPioGrbit.h"
#include "../Biff_structures/FtSbs.h"
#include "../Biff_structures/FtNts.h"
#include "../Biff_structures/FtMacro.h"
#include "../Biff_structures/FtPictFmla.h"
#include "../Biff_structures/ObjLinkFmla.h"
#include "../Biff_structures/FtCblsData.h"
#include "../Biff_structures/FtRboData.h"
#include "../Biff_structures/FtEdoData.h"
#include "../Biff_structures/FtLbsData.h"
#include "../Biff_structures/FtGboData.h"
namespace XLS
{
// Logical representation of Obj record in BIFF8
class Obj : public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(Obj)
......@@ -65,11 +63,10 @@ public:
~Obj();
BaseObjectPtr clone();
void readFields(CFRecord& record);
static const ElementType type = typeObj;
static const ElementType type = typeObj;
//-----------------------------
FtCmo cmo;
......@@ -104,8 +101,6 @@ public:
_UINT16 flag;
_UINT16 flag2;
}old_version;
};
} // namespace XLS
......
......@@ -39,12 +39,10 @@ Pls::Pls()
{
}
Pls::~Pls()
{
}
BaseObjectPtr Pls::clone()
{
return BaseObjectPtr(new Pls());
......@@ -71,9 +69,9 @@ void Pls::readFields(CFRecord& record)
}
int size = record.getDataSize() - 2;
const char* data = record.getData() + 2;
const BYTE* data = (BYTE*)record.getData() + 2;
boost::shared_array<char> buffer(new char[size]);
boost::shared_array<BYTE> buffer(new BYTE[size]);
memcpy(buffer.get(), data, size);
bin_data_id = -1;
......@@ -81,7 +79,7 @@ void Pls::readFields(CFRecord& record)
GlobalWorkbookInfo* globla_info = record.getGlobalWorkbookInfo().get();
if (globla_info)
{
globla_info->bin_data.push_back(std::pair<boost::shared_array<char>, size_t>(buffer, size));
globla_info->bin_data.push_back(std::pair<boost::shared_array<BYTE>, size_t>(buffer, size));
bin_data_id = globla_info->bin_data.size() - 1;
}
......
......@@ -31,7 +31,7 @@
*/
#pragma once
#include <Logic/Biff_records/BiffRecordContinued.h>
#include "BiffRecordContinued.h"
#if !defined(_WIN32) && !defined(_WIN64)
......@@ -109,9 +109,7 @@
namespace XLS
{
// Logical representation of Pls record in BIFF8
class Pls : public BiffRecordContinued
class Pls : public BiffRecordContinued
{
BIFF_RECORD_DEFINE_TYPE_INFO(Pls)
BASE_OBJECT_DEFINE_CLASS_NAME(Pls)
......
......@@ -32,14 +32,12 @@
#pragma once
#include "BiffRecord.h"
#include <Logic/Biff_structures/RkRec.h>
#include <Logic/Biff_structures/Cell.h>
#include "../Biff_structures/RkRec.h"
#include "../Biff_structures/Cell.h"
namespace XLS
{
// Logical representation of RK record in BIFF8
class RK: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(RK)
......@@ -49,7 +47,6 @@ public:
~RK();
BaseObjectPtr clone();
void readFields(CFRecord& record);
......
......@@ -31,7 +31,7 @@
*/
#include "Sync.h"
#include <Logic/Biff_structures/CellRef.h>
#include "../Biff_structures/CellRef.h"
namespace XLS
{
......
......@@ -37,16 +37,22 @@
namespace XLS
{
BiffStructurePtr FtCblsData::clone()
{
return BiffStructurePtr(new FtCblsData(*this));
}
void FtCblsData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000a && cb != 0x000c)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> fChecked >> accel;
record.skipNunBytes(2); // reserved
......
......@@ -42,16 +42,20 @@ class FtCblsData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtCblsData)
public:
FtCblsData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtCblsData;
static const ElementType type = typeFtCblsData;
virtual void load(CFRecord& record);
unsigned short fChecked;
unsigned short accel;
bool fNo3d;
bool fExist;
};
} // namespace XLS
......
......@@ -46,8 +46,7 @@ public:
virtual void load(CFRecord& record);
static const ElementType type = typeFtCmo;
static const ElementType type = typeFtCmo;
unsigned short ot;
unsigned short id;
......@@ -60,7 +59,6 @@ public:
bool fUIObj;
bool fRecalcObj;
bool fRecalcObjAlways;
};
} // namespace XLS
......
......@@ -36,16 +36,22 @@
namespace XLS
{
BiffStructurePtr FtEdoData::clone()
{
return BiffStructurePtr(new FtEdoData(*this));
}
void FtEdoData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x0010 && cb != 0x0008)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> ivtEdit >> fMultiLine >> fVScroll >> id;
}
......
......@@ -43,17 +43,21 @@ class FtEdoData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtEdoData)
public:
FtEdoData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtEdoData;
static const ElementType type = typeFtEdoData;
virtual void load(CFRecord& record);
unsigned short ivtEdit;
Boolean<unsigned short> fMultiLine;
unsigned short fVScroll;
unsigned short id;
bool fExist;
};
} // namespace XLS
......
......@@ -36,7 +36,6 @@
namespace XLS
{
BiffStructurePtr FtGboData::clone()
{
return BiffStructurePtr(new FtGboData(*this));
......@@ -44,7 +43,15 @@ BiffStructurePtr FtGboData::clone()
void FtGboData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000F && cb != 0x0006)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> accel;
record.skipNunBytes(2); // reserved
......
......@@ -43,15 +43,19 @@ class FtGboData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtGboData)
public:
FtGboData() : fExist(false)
{
}
BiffStructurePtr clone();
virtual void load(CFRecord& record);
static const ElementType type = typeFtGboData;
static const ElementType type = typeFtGboData;
unsigned short accel;
bool fNo3d;
bool fExist;
};
} // namespace XLS
......
......@@ -36,12 +36,6 @@
namespace XLS
{
FtLbsData::FtLbsData()
: fmla(false)
{
}
BiffStructurePtr FtLbsData::clone()
{
return BiffStructurePtr(new FtLbsData(*this));
......@@ -49,19 +43,27 @@ BiffStructurePtr FtLbsData::clone()
void FtLbsData::load(CFRecord& record, const unsigned short ot)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x0013)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
fmla.load(record);
unsigned short flags;
record >> cLines >> iSel >> flags >> idEdit;
fUseCB = GETBIT(flags, 0);
fValidPlex = GETBIT(flags, 1);
fValidIds = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
fUseCB = GETBIT(flags, 0);
fValidPlex = GETBIT(flags, 1);
fValidIds = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
wListSelType = GETBITS(flags, 4, 5);
lct = GETBITS(flags, 8, 15);
lct = GETBITS(flags, 8, 15);
if(0x0014 == ot)
{
......
......@@ -46,10 +46,12 @@ class FtLbsData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtLbsData)
public:
FtLbsData();
FtLbsData() : fmla(false), fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtLbsData;
static const ElementType type = typeFtLbsData;
virtual void load(CFRecord& record, const unsigned short ot);
......@@ -72,6 +74,7 @@ public:
std::vector<XLUnicodeString> rgLines;
std::vector<Boolean<unsigned char>> bsels;
bool fExist;
};
} // namespace XLS
......
......@@ -36,9 +36,7 @@
namespace XLS
{
FtMacro::FtMacro()
: fmla(false)
FtMacro::FtMacro() : fmla(false), fExist(false)
{
}
......@@ -48,14 +46,18 @@ BiffStructurePtr FtMacro::clone()
}
void FtMacro::load(CFRecord& record)
{
record.skipNunBytes(2); // reserved
short ft;
record >> ft;
if (ft != 0x0004)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
fmla.load(record);
}
} // namespace XLS
......@@ -50,8 +50,8 @@ public:
virtual void load(CFRecord& record);
ObjFmla fmla;
bool fExist;
};
} // namespace XLS
......
......@@ -37,16 +37,22 @@
namespace XLS
{
BiffStructurePtr FtNts::clone()
{
return BiffStructurePtr(new FtNts(*this));
}
void FtNts::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000d && cb != 0x0016)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
_GUID_ guid_num;
record >> guid_num >> fSharedNote;
......
......@@ -43,15 +43,19 @@ class FtNts : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtNts)
public:
FtNts() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtNts;
static const ElementType type = typeFtNts;
virtual void load(CFRecord& record);
std::wstring guid;
Boolean<unsigned short> fSharedNote;
bool fExist;
};
} // namespace XLS
......
......@@ -36,18 +36,11 @@
namespace XLS
{
FtPictFmla::FtPictFmla()
: fmla(true)
{
}
BiffStructurePtr FtPictFmla::clone()
{
return BiffStructurePtr(new FtPictFmla(*this));
}
void FtPictFmla::load(CFRecord& record, int linkSize)
{
bool bLinked = false;
......@@ -74,11 +67,8 @@ void FtPictFmla::load(CFRecord& record, int linkSize)
record >> nNameIdx;
record.skipNunBytes(12);
//const ExtName* pExtName = GetOldRoot().pExtNameBuff->GetNameByIndex( nRefIdx, nNameIdx );
// if( pExtName && pExtName->IsOLE() )
// mnStorageId = pExtName->nStorageId;
}
else if( nToken == 2)//XclTokenArrayHelper::GetTokenId( EXC_TOKID_TBL, EXC_TOKCLASS_NONE ) )
else if( nToken == 2)
{
bEmbedded = true;
......@@ -103,7 +93,17 @@ void FtPictFmla::load(CFRecord& record, int linkSize)
void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags)
{
record.skipNunBytes(4); // reserved
short ft, size;
record >> ft; // must be
if (ft != 0x0009)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
record >> size;
if (size < 1) return;
fmla.load(record);
......@@ -111,12 +111,11 @@ void FtPictFmla::load(CFRecord& record, FtPioGrbit& pictFlags)
{
record >> lPosInCtlStm;
}
record >> lPosInCtlStm;
if(pictFlags.fPrstm)
{
record >> cbBufInCtlStm;
}
if(pictFlags.fPrstm)
if(pictFlags.fCtl)
{
key.load(record);
}
......
......@@ -45,20 +45,25 @@ class FtPictFmla : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPictFmla)
public:
FtPictFmla();
BiffStructurePtr clone();
FtPictFmla() : fmla(true), cbBufInCtlStm(0xffffffff), lPosInCtlStm(0xffffffff), fExist(false)
{
}
BiffStructurePtr clone();
virtual void load(CFRecord& record){}
//biff5
virtual void load(CFRecord& record, int linkSize);
//biff8
virtual void load(CFRecord& record, FtPioGrbit& pictFlags);
static const ElementType type = typeFtPictFmla;
virtual void load(CFRecord& record){}
ObjFmla fmla;
_UINT32 lPosInCtlStm;
_UINT32 cbBufInCtlStm;
PictFmlaKey key;
PictFmlaKey key;
ObjFmla fmla;
bool fExist;
};
} // namespace XLS
......
......@@ -44,28 +44,28 @@ BiffStructurePtr FtPioGrbit::clone()
void FtPioGrbit::load(CFRecord& record)
{
//record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft;
record >> cb;
record >> ft >> cb;
if (record.getDataSize() == record.getRdPtr())
if ( ft != 0x0008 || cb != 2)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
unsigned short flags;
record >> flags;
fAutoPict = GETBIT(flags, 0);
fDde = GETBIT(flags, 1);
fPrintCalc = GETBIT(flags, 2);
fIcon = GETBIT(flags, 3);
fCtl = GETBIT(flags, 4);
fPrstm = GETBIT(flags, 5);
fCamera = GETBIT(flags, 7);
fAutoPict = GETBIT(flags, 0);
fDde = GETBIT(flags, 1);
fPrintCalc = GETBIT(flags, 2);
fIcon = GETBIT(flags, 3);
fCtl = GETBIT(flags, 4);
fPrstm = GETBIT(flags, 5);
fCamera = GETBIT(flags, 7);
fDefaultSize = GETBIT(flags, 8);
fAutoLoad = GETBIT(flags, 9);
fAutoLoad = GETBIT(flags, 9);
}
......
......@@ -42,13 +42,15 @@ class FtPioGrbit : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtPioGrbit)
public:
FtPioGrbit() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtPioGrbit;
virtual void load(CFRecord& record);
bool fAutoPict;
bool fDde;
bool fPrintCalc;
......@@ -58,6 +60,8 @@ public:
bool fCamera;
bool fDefaultSize;
bool fAutoLoad;
bool fExist;
};
} // namespace XLS
......
......@@ -45,7 +45,15 @@ BiffStructurePtr FtRboData::clone()
void FtRboData::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
if ( ft != 0x000b && cb != 0x0006)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record >> idRadNext >> fFirstBtn;
}
......
......@@ -43,15 +43,19 @@ class FtRboData : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtRboData)
public:
FtRboData() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtRboData;
static const ElementType type = typeFtRboData;
virtual void load(CFRecord& record);
unsigned short idRadNext;
Boolean<unsigned short> fFirstBtn;
bool fExist;
};
} // namespace XLS
......
......@@ -36,7 +36,6 @@
namespace XLS
{
BiffStructurePtr FtSbs::clone()
{
return BiffStructurePtr(new FtSbs(*this));
......@@ -44,10 +43,15 @@ BiffStructurePtr FtSbs::clone()
void FtSbs::load(CFRecord& record)
{
//record.skipNunBytes(4); // reserved
unsigned short ft, cb;
record >> ft >> cb;
record >> ft;
record >> cb;
if ( ft != 0x000c && cb != 0x0014)
{
record.RollRdPtrBack(4);
return;
}
fExist = true;
record.skipNunBytes(4); // unused1
......@@ -55,10 +59,10 @@ void FtSbs::load(CFRecord& record)
record >> iVal >> iMin >> iMax >> dInc >> dPage >> fHoriz >> dxScroll >> flags;
fDraw = GETBIT(flags, 0);
fDraw = GETBIT(flags, 0);
fDrawSliderOnly = GETBIT(flags, 1);
fTrackElevator = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
fTrackElevator = GETBIT(flags, 2);
fNo3d = GETBIT(flags, 3);
}
......
......@@ -43,16 +43,15 @@ class FtSbs : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(FtSbs)
public:
FtSbs() : fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeFtSbs;
static const ElementType type = typeFtSbs;
virtual void load(CFRecord& record);
unsigned short ft;
unsigned short cb;
short iVal;
short iMin;
short iMax;
......@@ -65,6 +64,8 @@ public:
bool fDrawSliderOnly;
bool fTrackElevator;
bool fNo3d;
bool fExist;
};
} // namespace XLS
......
......@@ -126,7 +126,8 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
// m_OfficeArtSpgrContainerFileBlock = OfficeArtContainerPtr(art_container);
// child_records.erase(child_records.begin() + i,child_records.begin() + i + 1);
// }break;
default:
break;
}
}
......
......@@ -49,6 +49,8 @@ void OfficeArtRecord::load(XLS::CFRecord& record)
record >> rh_own;
loadFields(record);
//Log::warning(STR::int2str(rh_own.recType, 16));
}
......
......@@ -37,8 +37,7 @@ namespace XLS
{
ObjFmla::ObjFmla(const bool is_part_of_FtPictFmla)
: is_part_of_FtPictFmla_(is_part_of_FtPictFmla)
ObjFmla::ObjFmla(const bool is_part_of_FtPictFmla) : is_part_of_FtPictFmla_(is_part_of_FtPictFmla), bFmlaExist(false), bInfoExist(false)
{
}
......@@ -47,7 +46,6 @@ BiffStructurePtr ObjFmla::clone()
return BiffStructurePtr(new ObjFmla(*this));
}
void ObjFmla::load(CFRecord& record)
{
unsigned short cbFmla;
......@@ -56,15 +54,17 @@ void ObjFmla::load(CFRecord& record)
if(0 != cbFmla)
{
bFmlaExist = true;
fmla.load(record);
if(is_part_of_FtPictFmla_ && fmla.HasPtgTbl())
{
record >> embedInfo;
bInfoExist = true;
}
}
size_t data_size = record.getRdPtr() - start_ptr;
size_t padding_size = cbFmla - data_size;
if(0 != padding_size && (record.getRdPtr() + padding_size) <= record.getDataSize())
......
......@@ -47,17 +47,18 @@ public:
ObjFmla(const bool is_part_of_FtPictFmla);
BiffStructurePtr clone();
static const ElementType type = typeObjFmla;
static const ElementType type = typeObjFmla;
virtual void load(CFRecord& record);
ObjectParsedFormula fmla;
bool is_part_of_FtPictFmla_;
bool fmla_found;
PictFmlaEmbedInfo embedInfo;
bool bFmlaExist;
bool bInfoExist;
PictFmlaEmbedInfo embedInfo;
private:
bool is_part_of_FtPictFmla_;
};
} // namespace XLS
......
......@@ -35,13 +35,6 @@
namespace XLS
{
ObjLinkFmla::ObjLinkFmla()
: fmla(false)
{
}
BiffStructurePtr ObjLinkFmla::clone()
{
return BiffStructurePtr(new ObjLinkFmla(*this));
......@@ -49,8 +42,15 @@ BiffStructurePtr ObjLinkFmla::clone()
void ObjLinkFmla::load(CFRecord& record)
{
record.skipNunBytes(2); // reserved
unsigned short ft;
record >> ft;
if ( ft != 0x0014)
{
record.RollRdPtrBack(2);
return;
}
fExist = true;
fmla.load(record);
}
......
......@@ -43,7 +43,9 @@ class ObjLinkFmla : public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(ObjLinkFmla)
public:
ObjLinkFmla();
ObjLinkFmla(): fmla(false), fExist(false)
{
}
BiffStructurePtr clone();
static const ElementType type = typeObjLinkFmla;
......@@ -51,6 +53,7 @@ public:
virtual void load(CFRecord& record);
ObjFmla fmla;
bool fExist;
};
} // namespace XLS
......
......@@ -45,8 +45,6 @@ public:
ObjectParsedFormula();
BiffStructurePtr clone();
virtual void load(CFRecord& record);
};
} // namespace XLS
......
......@@ -32,7 +32,7 @@
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/BiffString.h>
#include "BiffString.h"
namespace XLS
{
......@@ -49,7 +49,6 @@ public:
virtual void load(CFRecord& record);
XLUnicodeStringNoCch strClass;
};
......
......@@ -36,9 +36,7 @@
namespace XLS
{
PictFmlaKey::PictFmlaKey()
: fmlaLinkedCell(false), fmlaListFillRange(false)
PictFmlaKey::PictFmlaKey() : fmlaLinkedCell(false), fmlaListFillRange(false)
{
}
......@@ -49,10 +47,16 @@ BiffStructurePtr PictFmlaKey::clone()
void PictFmlaKey::load(CFRecord& record)
{
_UINT32 cbKey;
record >> cbKey;
record.skipNunBytes(cbKey); // ActiveX license key is here
if (cbKey > 0)
{
char *buf = new char[cbKey];
memcpy(buf, record.getCurData<char>(), cbKey);
keyBuf = std::string(buf, cbKey);
record.skipNunBytes(cbKey);
delete []buf;
}
fmlaLinkedCell.load(record);
fmlaListFillRange.load(record);
......
......@@ -47,13 +47,15 @@ public:
PictFmlaKey();
BiffStructurePtr clone();
static const ElementType type = typePictFmlaKey;
static const ElementType type = typePictFmlaKey;
virtual void load(CFRecord& record);
_UINT32 cbKey;
std::string keyBuf; // ActiveX license key
ObjFmla fmlaLinkedCell;
ObjFmla fmlaListFillRange;
ObjFmla fmlaLinkedCell;
ObjFmla fmlaListFillRange;
};
} // namespace XLS
......
......@@ -36,9 +36,7 @@
namespace XLS
{
PtgTbl::PtgTbl()
: Ptg(fixed_id)
PtgTbl::PtgTbl() : Ptg(fixed_id)
{
}
......@@ -59,7 +57,11 @@ void PtgTbl::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full
{
// The reference coordinates shall be obtained from row/column values.
// No textual form need but the empty line.
ptg_stack.push(L"");
//CellRef ref(row, col, true, true);
//ptg_stack.push(ref.toString());
}
......
......@@ -302,8 +302,13 @@ const bool CELLTABLE::loadContent(BinProcessor& proc)
CELL_GROUP cell_group2(shared_formulas_locations_ref_);
m_count_CELL_GROUP = proc.repeated(cell_group2, 0, 0);
proc.repeated<EntExU2>(0, 0);
int count = proc.repeated<EntExU2>(0, 0);
while(count > 0)
{
m_arEntExU2.insert(m_arEntExU2.begin(), elements_.back());
elements_.pop_back();
count--;
}
return true;
}
......
......@@ -38,7 +38,6 @@ namespace XLS
class CellRef;
// Logical representation of CELLTABLE union of records
class CELLTABLE: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(CELLTABLE)
......@@ -50,13 +49,13 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeCELLTABLE;
static const ElementType type = typeCELLTABLE;
int serialize(std::wostream & stream);
std::vector<CellRangeRef>& shared_formulas_locations_ref_;
int m_count_CELL_GROUP;
int m_count_CELL_GROUP;
std::vector<BaseObjectPtr> m_arEntExU2;
};
} // namespace XLS
......
......@@ -123,7 +123,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
bVbaProjectExist = false;
bMacrosExist = false;
idPivotCache = 0;
idPivotCache = 0;
}
GlobalWorkbookInfo::~GlobalWorkbookInfo()
......
......@@ -121,8 +121,13 @@ public:
std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
std::vector<std::wstring> arDefineNames;
std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data;
std::vector<std::pair<boost::shared_array<unsigned char>, size_t> > bin_data;
std::pair<boost::shared_array<unsigned char>, size_t> listdata_data;
std::pair<boost::shared_array<unsigned char>, size_t> controls_data;
std::map<int, std::pair<boost::shared_array<unsigned char>, size_t> > embeddings_data; //parsing ???
std::map<int, std::pair<boost::shared_array<unsigned char>, size_t> > link_data;
struct _xti
{
int iSup;
......
......@@ -275,6 +275,7 @@ namespace oox
case msosptRectangle : return L"rect";
case msosptRoundRectangle : return L"roundRect";
case msosptEllipse : return L"ellipse";
case msosptPictureFrame : return L"rect";
//case msosptDiamond : return L"diamond";
case msosptIsocelesTriangle : return L"triangle";
//case msosptRightTriangle : return L"rtTriangle";
......
......@@ -48,9 +48,12 @@ namespace oox
}
namespace XLS
{
class BaseObject;
class BiffStructure;
class CompoundFile;
typedef boost::shared_ptr<CompoundFile> CompoundFilePtr;
class BaseObject;
typedef boost::shared_ptr<BaseObject> BaseObjectPtr;
class GlobalWorkbookInfo;
......@@ -76,6 +79,7 @@ namespace XLS
class Note;
class TxO;
class Obj;
}
namespace ODRAW
......@@ -94,7 +98,7 @@ namespace ODRAW
class XlsConverter
{
public:
XlsConverter(const std::wstring & xls_file, const std::wstring & xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack, bool & bMacros);
XlsConverter(const std::wstring & xlsFileName, const std::wstring & xlsxFilePath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack, bool & bMacros);
~XlsConverter() ;
oox::xlsx_conversion_context * xlsx_context;
......@@ -118,6 +122,7 @@ public:
void convert(XLS::OBJECTS * objects, XLS::WorksheetSubstream * sheet);
void convert(XLS::MSODRAWINGGROUP * mso_drawing);
void convert(XLS::TxO * text_obj);
void convert(XLS::Obj * obj);
void convert(XLS::Note * note);
void convert(XLS::IMDATA * imadata);
void convert(XLS::PIVOTVIEW * pivot_view);
......@@ -163,4 +168,6 @@ private:
XLS::BaseObjectPtr xls_document;
XLS::GlobalWorkbookInfoPtr xls_global_info;
XLS::CompoundFilePtr xls_file;
};
......@@ -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;
}
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;
class external_items
{
public:
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeTable, typeHyperlink, typeComment, typeMedia, typeGroup, typeExternalLink};
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeTable, typeHyperlink, typeComment, typeMedia, typeGroup, typeExternalLink, typeOleObject};
external_items()
{
count_charts =0;
count_shape =0;
count_image =0;
count_tables =0;
count_media =0;
count_charts = 0;
count_shape = 0;
count_image = 0;
count_tables = 0;
count_media = 0;
count_activeX = 0;
count_embeddings= 0;
}
struct item
......@@ -76,6 +77,8 @@ public:
size_t count_media;
size_t count_shape;
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_image (const std::wstring & file_name, int bin_id);
......@@ -88,13 +91,20 @@ public:
items_array & items() { return items_; }
void create_media_path(const std::wstring & out_path);
void create_activeX_path(const std::wstring & out_path);
void create_embeddings_path(const std::wstring & out_path);
std::wstring activeX_path();
std::wstring media_path();
std::wstring embeddings_path();
private:
std::wstring create_file_name(const std::wstring & uri, external_items::Type type, size_t Num);
std::wstring media_path_;
std::wstring activeX_path_;
std::wstring embeddings_path_;
items_array items_;
};
......
......@@ -152,7 +152,10 @@ void xlsx_conversion_context::end_external()
void xlsx_conversion_context::end_table()
{
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks());
get_table_context().serialize_ole_objects(current_sheet().ole_objects());
get_table_context().dump_rels_ole_objects(current_sheet().sheet_rels());
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks());
get_table_context().dump_rels_hyperlinks(current_sheet().sheet_rels());
get_table_context().end_table();
......
......@@ -289,6 +289,7 @@ xlsx_drawing_context::xlsx_drawing_context(xlsx_conversion_context & Context) :
, rels_ (xlsx_drawings_rels::create())
, vml_HF_rels_ (xlsx_drawings_rels::create())
, vml_comments_rels_(xlsx_drawings_rels::create())
, sheet_rels_ (xlsx_drawings_rels::create())
{
in_chart_ = false;
count_object = 0;
......@@ -534,6 +535,11 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
else
drawing_state->type = external_items::typeShape;
}
if ( drawing_state->type == external_items::typeOleObject )
{
drawing_state->hidden = true;
serialize_shape(drawing_state);
}
if ( drawing_state->type == external_items::typeChart )
{
//функциональная часть
......@@ -595,7 +601,10 @@ void xlsx_drawing_context::serialize_group()
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty())
{
CP_XML_NODE(L"a:hlinkClick")
......@@ -796,20 +805,25 @@ void xlsx_drawing_context::serialize_pic(_drawing_state_ptr & drawing_state, std
{
CP_XML_NODE(L"xdr:pic")
{
CP_XML_ATTR(L"macro", drawing_state->macro);
CP_XML_NODE(L"xdr:nvPicPr")
{
CP_XML_NODE(L"xdr:cNvPr")
{
CP_XML_ATTR(L"id", drawing_state->id);
if (drawing_state->name.empty())
drawing_state->name = L"Picture_" + rId.substr(5);
CP_XML_ATTR(L"name", drawing_state->name);
CP_XML_ATTR(L"name", drawing_state->name);
if (!drawing_state->description.empty())
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty())
{
......@@ -872,6 +886,10 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
}
CP_XML_NODE(L"xdr:cNvGraphicFramePr");
......@@ -932,6 +950,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{
CP_XML_NODE(L"xdr:sp")
{
CP_XML_ATTR(L"macro", drawing_state->macro);
CP_XML_NODE(L"xdr:nvSpPr")
{
CP_XML_NODE(L"xdr:cNvPr")
......@@ -942,6 +962,8 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{
if (drawing_state->wordart.is)
drawing_state->name = L"WordArt_" + std::to_wstring(count_object);
else if ( drawing_state->type == external_items::typeOleObject )
drawing_state->name = L"Object_" + std::to_wstring(count_object);
else
drawing_state->name = L"Shape_" + std::to_wstring(count_object);
}
......@@ -951,7 +973,10 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
{
CP_XML_ATTR(L"descr", drawing_state->description);
}
if (drawing_state->hidden)
{
CP_XML_ATTR(L"hidden", 1);
}
if (!drawing_state->hyperlink.empty())
{
CP_XML_NODE(L"a:hlinkClick")
......@@ -961,6 +986,22 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
CP_XML_ATTR(L"r:id", drawing_state->hyperlink);
}
}
//if ( drawing_state->type == external_items::typeOleObject ) + VmlDrawing
//{
// CP_XML_NODE(L"a:extLst")
// {
// CP_XML_NODE(L"a:ext")
// {
// CP_XML_ATTR(L"uri", L"{63B3BB69-23CF-44E3-9099-C40C66FF867C}");
// CP_XML_ATTR(L"xmlns:a14", L"http://schemas.microsoft.com/office/drawing/2010/main");
// CP_XML_NODE(L"a14:compatExt")
// {
// CP_XML_ATTR(L"spid", L"_x0000_s" + std::to_wstring(drawing_state->id));
// }
// }
// }
//}
}
CP_XML_NODE(L"xdr:cNvSpPr")
{
......@@ -1338,20 +1379,20 @@ void xlsx_drawing_context::serialize_gradient_fill(std::wostream & stream, _draw
}
}
void xlsx_drawing_context::serialize_anchor (std::wostream & stream, _drawing_state_ptr & drawing_state)
void xlsx_drawing_context::serialize_anchor (std::wostream & stream, _drawing_state_ptr & drawing_state, std::wstring ns)
{
CP_XML_WRITER(stream)
{
if (drawing_state->type_anchor == 1)
{
CP_XML_NODE(L"xdr:from")
CP_XML_NODE(ns + L"from")
{
CP_XML_NODE(L"xdr:col") { CP_XML_CONTENT (drawing_state->sheet_anchor.colFrom); }
CP_XML_NODE(L"xdr:colOff") { CP_XML_CONTENT (drawing_state->sheet_anchor.xFrom) ; }
CP_XML_NODE(L"xdr:row") { CP_XML_CONTENT (drawing_state->sheet_anchor.rwFrom); }
CP_XML_NODE(L"xdr:rowOff") { CP_XML_CONTENT (drawing_state->sheet_anchor.yFrom) ; }
}
CP_XML_NODE(L"xdr:to")
CP_XML_NODE(ns + L"to")
{
CP_XML_NODE(L"xdr:col") { CP_XML_CONTENT (drawing_state->sheet_anchor.colTo); }
CP_XML_NODE(L"xdr:colOff") { CP_XML_CONTENT (drawing_state->sheet_anchor.xTo); }
......@@ -1361,12 +1402,12 @@ void xlsx_drawing_context::serialize_anchor (std::wostream & stream, _drawing_st
}
if (drawing_state->type_anchor == 3)
{
CP_XML_NODE(L"xdr:pos")//in emu (1 pt = 12700)
CP_XML_NODE(ns + L"pos")//in emu (1 pt = 12700)
{
CP_XML_ATTR(L"x", (int)(drawing_state->absolute_anchor.x * 12700));
CP_XML_ATTR(L"y", (int)(drawing_state->absolute_anchor.y * 12700));
}
CP_XML_NODE(L"xdr:ext") //in emu (1 pt = 12700)
CP_XML_NODE(ns + L"ext") //in emu (1 pt = 12700)
{
CP_XML_ATTR(L"cx", (int)(drawing_state->absolute_anchor.cx * 12700));
CP_XML_ATTR(L"cy", (int)(drawing_state->absolute_anchor.cy * 12700));
......@@ -1739,6 +1780,46 @@ void xlsx_drawing_context::serialize(std::wostream & stream, _drawing_state_ptr
}
}
}
void xlsx_drawing_context::serialize_object(std::wostream & stream, _drawing_state_ptr & drawing_state)
{
if (drawing_state->type != external_items::typeOleObject) return;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"oleObject")
{
if (!drawing_state->objectProgId.empty())
{
CP_XML_ATTR(L"progId", drawing_state->objectProgId);
}
CP_XML_ATTR(L"shapeId", drawing_state->id);
CP_XML_ATTR(L"r:id", drawing_state->objectId);
CP_XML_NODE(L"objectPr")
{
CP_XML_ATTR(L"defaultSize", 0);
//CP_XML_ATTR(L"autoPict", 0);
if (!drawing_state->fill.texture_target.empty())
{
bool isIternal = false;
std::wstring rId = handle_.impl_->get_mediaitems().find_image( drawing_state->fill.texture_target, isIternal);
CP_XML_ATTR(L"r:id", rId);
sheet_rels_->add(isIternal, rId , drawing_state->fill.texture_target, external_items::typeImage);
}
CP_XML_NODE(L"anchor")
{
CP_XML_ATTR(L"moveWithCells", 1);
serialize_anchor(CP_XML_STREAM(), drawing_state, L"");
}
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------
void xlsx_drawing_context::set_name(const std::wstring & str)
{
......@@ -1752,6 +1833,21 @@ void xlsx_drawing_context::set_description(const std::wstring & str)
current_drawing_states->back()->description = str;
}
void xlsx_drawing_context::set_macro(const std::wstring & str)
{
if (current_drawing_states == NULL) return;
current_drawing_states->back()->macro = str;
}
void xlsx_drawing_context::set_ole_object(const std::wstring & id, const std::wstring & info)
{
if (current_drawing_states == NULL) return;
current_drawing_states->back()->type = external_items::typeOleObject;
current_drawing_states->back()->objectId = id;
current_drawing_states->back()->objectProgId = info;
}
void xlsx_drawing_context::set_sheet_anchor(int colFrom, int xFrom, int rwFrom, int yFrom, int colTo, int xTo, int rwTo,int yTo)
{
if (current_drawing_states == NULL) return;
......@@ -2487,6 +2583,10 @@ xlsx_drawings_rels_ptr xlsx_drawing_context::get_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)
{
if (drawing_state->fill.texture_target.length() < 6) return false;
......@@ -2500,7 +2600,15 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::
return bgraFrame.ReColorPatternImage(image_path, rgbColor1, rgbColor2);
}
void xlsx_drawing_context::serialize_objects(std::wostream & strm)
{
for (size_t i = 0; i < drawing_states.size(); i++)
{
if (drawing_states[i]->type != external_items::typeOleObject) continue;
serialize_object(strm, drawing_states[i]);
}
}
void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
{
CP_XML_WRITER(strm)
......@@ -2565,6 +2673,7 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:mc" , L"http://schemas.openxmlformats.org/markup-compatibility/2006");
CP_XML_ATTR(L"xmlns:a14", L"http://schemas.microsoft.com/office/drawing/2010/main");
for (size_t i = 0 ; i < drawing_states.size(); i++)
{
......
......@@ -135,7 +135,8 @@ public:
flipH(false), flipV(false),
bTextBox(false),
type_anchor(0),
vmlwrite_mode_(false)
vmlwrite_mode_(false),
hidden(false)
{
id = -1;
rotation = 0;
......@@ -146,20 +147,24 @@ public:
}
external_items::Type type;
bool hidden;
std::wstring name;
std::wstring description;
std::wstring macro;
std::wstring objectId;
std::wstring objectProgId;
struct _anchor
{
_anchor() : colFrom(-1), rwFrom(-1), colTo(-1), rwTo(0), xFrom(0), yFrom(0),xTo(0),yTo(0){}
int colFrom;
int xFrom;
int rwFrom;
int yFrom;
int colTo;
int xTo;
int rwTo;
int yTo;
int colFrom = -1;
int xFrom = 0;
int rwFrom = -1;
int yFrom = 0;
int colTo = 0;
int xTo = 0;
int rwTo = 0;
int yTo = 0;
} sheet_anchor;
_rect child_anchor;
_rect group_anchor;
......@@ -313,6 +318,7 @@ public:
xlsx_drawings_rels_ptr get_rels();
xlsx_drawings_rels_ptr get_vml_HF_rels();
xlsx_drawings_rels_ptr get_vml_comments_rels();
xlsx_drawings_rels_ptr get_sheet_rels();
bool empty();
bool empty_vml_HF();
......@@ -335,6 +341,8 @@ public:
//--------------------------------------------------------------------------------------
void set_name (const std::wstring & str);
void set_description (const std::wstring & str);
void set_macro (const std::wstring & str);
void set_ole_object (const std::wstring & id, const std::wstring & info);
void set_crop_top (double val);
void set_crop_bottom (double val);
......@@ -422,6 +430,7 @@ public:
void serialize_shape (_drawing_state_ptr & drawing_state);
void serialize_chart (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_pic (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_object (_drawing_state_ptr & drawing_state, std::wstring rId );
void serialize_shape_comment(_drawing_state_ptr & drawing_state); //part of vml shape
//-----------------------------------------------------------------------------------
......@@ -432,10 +441,12 @@ public:
void serialize_fill (std::wostream & stream);
//-----------------------------------------------------------------------------------
void serialize (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_vml (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_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_comments (std::wostream & stream);
void serialize_objects (std::wostream & stream);
void serialize (std::wostream & stream);
//-----------------------------------------------------------------------------------
bool is_lined_shape (_drawing_state_ptr & drawing_state);
......@@ -450,6 +461,7 @@ private:
xlsx_drawings_rels_ptr rels_;
xlsx_drawings_rels_ptr vml_comments_rels_;
xlsx_drawings_rels_ptr vml_HF_rels_;
xlsx_drawings_rels_ptr sheet_rels_;
int count_object;
bool in_chart_;
......@@ -474,7 +486,7 @@ private:
void serialize_line (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_xfrm (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_anchor (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_anchor (std::wostream & stream, _drawing_state_ptr & drawing_state, std::wstring ns = L"xdr:");
void serialize_text (std::wostream & stream, _drawing_state_ptr & drawing_state);
void serialize_color (std::wostream & stream, const _color &color, double opacity = 0);
......
......@@ -54,6 +54,7 @@ public:
std::wstringstream sheetFormatPr_;
std::wstringstream sheetData_;
std::wstringstream mergeCells_;
std::wstringstream ole_objects_;
std::wstringstream drawing_;
std::wstringstream hyperlinks_;
std::wstringstream comments_;
......@@ -132,6 +133,10 @@ std::wostream & xlsx_xml_worksheet::mergeCells()
{
return impl_->mergeCells_;
}
std::wostream & xlsx_xml_worksheet::ole_objects()
{
return impl_->ole_objects_;
}
std::wostream & xlsx_xml_worksheet::drawing()
{
......@@ -183,6 +188,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
CP_XML_ATTR(L"mc:Ignorable", L"x14ac");
CP_XML_ATTR(L"xmlns:x14ac", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
......@@ -230,7 +236,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
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_NODE(L"rowBreaks){}
......
......@@ -60,6 +60,7 @@ public:
std::wostream & hyperlinks();
std::wostream & mergeCells();
std::wostream & drawing();
std::wostream & ole_objects();
//std::wostream & comments();
std::wostream & sheetSortAndFilters();
std::wostream & pageProperties();
......
......@@ -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)
{
return state()->hyperlinks_.dump_rels(Rels);
state()->hyperlinks_.dump_rels(Rels);
}
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{
return state()->hyperlinks_.serialize(_Wostream);
state()->hyperlinks_.serialize(_Wostream);
}
void xlsx_table_context::dump_rels_ole_objects(rels & Rels)
{
xlsx_drawings_rels_ptr ole_rels = state()->drawing_context_.get_sheet_rels();
ole_rels->dump_rels(Rels);
}
void xlsx_table_context::serialize_ole_objects(std::wostream & strm)
{
state()->drawing_context_.serialize_objects(strm);
}
}
......@@ -71,6 +71,9 @@ public:
std::wstring add_hyperlink(std::wstring const & ref, std::wstring const & target, std::wstring const & display, bool bExternal);
void dump_rels_hyperlinks(rels & Rels);
void serialize_hyperlinks(std::wostream & _Wostream);
void dump_rels_ole_objects(rels & Rels);
void serialize_ole_objects(std::wostream & _Wostream);
private:
xlsx_conversion_context & context_;
......
......@@ -255,7 +255,13 @@ namespace XmlUtils
sstream << boost::wformat(format) % value;
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 )
{
if ( format == NULL ) return L"";
......
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