mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-02 23:51:48 +08:00
Compare commits
9 Commits
core-win-3
...
core-win-6
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e2e5996f3 | |||
| 033feeaf9d | |||
| de336e5f96 | |||
| 82b3dbdae6 | |||
| d1227f7759 | |||
| 4d134387f9 | |||
| 3f8600dfb7 | |||
| 511f043d63 | |||
| 69a41343c2 |
@ -133,7 +133,8 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
|
||||
xlsx_drawing_context_ (Context->get_drawing_context_handle()),
|
||||
xlsx_comments_context_ (Context->get_comments_context_handle()),
|
||||
table_column_last_width_(0.0),
|
||||
in_cell(false)
|
||||
in_cell(false),
|
||||
bEndTable(false)
|
||||
|
||||
{
|
||||
memset(&group_row_,0,sizeof(_group_row));
|
||||
|
||||
@ -91,6 +91,9 @@ public:
|
||||
void end_row ();
|
||||
|
||||
void add_empty_row(int count);
|
||||
|
||||
void set_end_table(){ bEndTable = true; }
|
||||
bool get_end_table(){ return bEndTable; }
|
||||
|
||||
std::wstring current_row_style () const;
|
||||
std::wstring default_row_cell_style () const;
|
||||
@ -153,6 +156,7 @@ public:
|
||||
friend class xlsx_table_context;
|
||||
|
||||
private:
|
||||
bool bEndTable;
|
||||
xlsx_conversion_context * context_;
|
||||
|
||||
std::wstring tableName_;
|
||||
|
||||
@ -195,7 +195,14 @@ std::wstring cellType2Str(XlsxCellType::type type)
|
||||
|
||||
boost::int64_t convertDate(int Year, int Month, int Day)
|
||||
{
|
||||
boost::int64_t daysFrom1900 = boost::gregorian::date_duration(boost::gregorian::date(Year, Month, Day) - boost::gregorian::date(1900, 1, 1)).days() + 1;
|
||||
if (Year < 1400 || Year >10000)
|
||||
return - 1;
|
||||
if (Month < 1 || Month > 12)
|
||||
return - 1;
|
||||
if (Day < 1 || Day > 31)
|
||||
return - 1;
|
||||
|
||||
boost::int64_t daysFrom1900 = boost::gregorian::date_duration(boost::gregorian::date(Year, Month, Day) - boost::gregorian::date(1900, 1, 1)).days() + 1;
|
||||
|
||||
if (Year <= 1900 &&
|
||||
Month <= 2 &&
|
||||
|
||||
@ -78,13 +78,16 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
|
||||
|
||||
void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
bool bEndTable = Context.get_table_context().state()->get_end_table();
|
||||
|
||||
if (attlist_.table_number_rows_repeated_ > 1 && empty())
|
||||
{
|
||||
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
|
||||
return;
|
||||
}
|
||||
if (attlist_.table_number_rows_repeated_ > 0xf000 && empty_content_cells())
|
||||
if (attlist_.table_number_rows_repeated_ > 0x0f00 && empty_content_cells() || bEndTable)//0xf000 - conv_KDZO3J3xLIbZ5fC0HR0__xlsx.ods
|
||||
{
|
||||
Context.get_table_context().state()->set_end_table();
|
||||
Context.get_table_context().state()->add_empty_row(attlist_.table_number_rows_repeated_);
|
||||
return; //conv_hSX8n3lVbhALjt0aafg__xlsx.ods, conv_MA2CauoNfX_7ejKS5eg__xlsx.ods
|
||||
}
|
||||
@ -731,7 +734,15 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
int y, m, d;
|
||||
if (oox::parseDate(attr.office_date_value_.get(), y, m, d))
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(oox::convertDate(y, m, d));
|
||||
boost::int64_t intDate = oox::convertDate(y, m, d);
|
||||
if (intDate > 0)
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(intDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_val = attr.office_date_value_.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -742,11 +753,19 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
if (attr.office_time_value_)
|
||||
{
|
||||
const std::wstring tv = attr.office_time_value_.get();
|
||||
int h,m;
|
||||
int h, m;
|
||||
double s;
|
||||
if (oox::parseTime(tv, h, m, s))
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(oox::convertTime(h, m, s));
|
||||
boost::int64_t intTime = oox::convertTime(h, m, s);
|
||||
if (intTime > 0)
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(intTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_val = tv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -999,7 +1018,15 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
int y, m, d;
|
||||
if (oox::parseDate(attr.office_date_value_.get(), y, m, d))
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(oox::convertDate(y, m, d));
|
||||
boost::int64_t intDate = oox::convertDate(y, m, d);
|
||||
if (intDate > 0)
|
||||
{
|
||||
number_val = boost::lexical_cast<std::wstring>(intDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
str_val = attr.office_date_value_.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1687,6 +1687,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
|
||||
NSPresentationEditor::CShapeElement oShapeElem;
|
||||
CPPTShape* pPPTShape = NULL;
|
||||
bool bSetShape = false;
|
||||
|
||||
if (L"v:background" == strNameNode)
|
||||
{
|
||||
@ -1885,6 +1886,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
}
|
||||
}
|
||||
oShapeElem.m_pShape->setBaseShape(CBaseShapePtr(pPPTShape));
|
||||
bSetShape = true;
|
||||
|
||||
if (bIsNeedCoordSizes)
|
||||
{
|
||||
@ -1895,7 +1897,8 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
|
||||
if (pPPTShape != NULL)
|
||||
{
|
||||
oShapeElem.m_pShape->setBaseShape(CBaseShapePtr(pPPTShape));
|
||||
if (!bSetShape)
|
||||
oShapeElem.m_pShape->setBaseShape(CBaseShapePtr(pPPTShape));
|
||||
if (bIsNeedCoordSizes)
|
||||
{
|
||||
LoadCoordSize(oNodeShape, oShapeElem.m_pShape);
|
||||
|
||||
@ -73,6 +73,47 @@ void CFStream::read(void* buf, const size_t size)
|
||||
return;// EndOfStreamReached
|
||||
}
|
||||
}
|
||||
void CFStream::copy( std::wstring streamNameCreate, POLE::Storage * storageOut)
|
||||
{
|
||||
stream_->seek(0);
|
||||
int size_stream = stream_->size();
|
||||
|
||||
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamNameCreate, true, size_stream);
|
||||
if (!streamNew) return;
|
||||
|
||||
unsigned char buffer[4096];
|
||||
int bytesRead = 0;
|
||||
|
||||
while(true)
|
||||
{
|
||||
int bytesToRead = size_stream - bytesRead;
|
||||
if (bytesToRead <= 0)
|
||||
break;
|
||||
if (bytesToRead > 4096)
|
||||
bytesToRead = 4096;
|
||||
|
||||
stream_->read(buffer, bytesToRead);
|
||||
streamNew->write(buffer, bytesToRead);
|
||||
|
||||
bytesRead += bytesToRead;
|
||||
}
|
||||
//unsigned char* data_stream = new unsigned char[size_stream + 64];
|
||||
//memset(data_stream, 0, size_stream + 64);
|
||||
//if (data_stream)
|
||||
//{
|
||||
// stream->read(data_stream, size_stream);
|
||||
|
||||
// streamNew->write(data_stream, size_stream);
|
||||
|
||||
// delete []data_stream;
|
||||
// data_stream = NULL;
|
||||
//}
|
||||
|
||||
streamNew->flush();
|
||||
|
||||
delete streamNew;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Write 'size' unsigned chars to the stream
|
||||
|
||||
@ -46,6 +46,8 @@ class CFStream
|
||||
public:
|
||||
CFStream(POLE::Stream* stream);
|
||||
~CFStream();
|
||||
|
||||
void copy( std::wstring streamNameCreate, POLE::Storage * storageOut);
|
||||
|
||||
template<class Type>
|
||||
CFStream& operator>>(Type& val) // Read a simple type or an object (not array)
|
||||
|
||||
@ -103,7 +103,7 @@ void CompoundFile::copy_stream(std::wstring streamNameOpen, std::wstring streamN
|
||||
if (!stream) return;
|
||||
|
||||
stream->seek(0);
|
||||
int size_stream = stream->size();
|
||||
POLE::uint64 size_stream = stream->size();
|
||||
|
||||
if (bWithRoot == false)
|
||||
{
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of ObjProtect record in BIFF8
|
||||
class ObjProtect: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(ObjProtect)
|
||||
@ -51,7 +49,7 @@ public:
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeObjProtect;
|
||||
static const ElementType type = typeObjProtect;
|
||||
|
||||
//-----------------------------
|
||||
Boolean<unsigned short> fLockObj;
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of Protect record in BIFF8
|
||||
class Protect: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(Protect)
|
||||
|
||||
@ -44,7 +44,6 @@ ScenarioProtect::~ScenarioProtect()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr ScenarioProtect::clone()
|
||||
{
|
||||
return BaseObjectPtr(new ScenarioProtect(*this));
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of ScenarioProtect record in BIFF8
|
||||
class ScenarioProtect: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(ScenarioProtect)
|
||||
@ -48,14 +46,12 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeScenarioProtect;
|
||||
|
||||
//-----------------------------
|
||||
Boolean<unsigned short> fScenProtect;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of BIGNAME union of records
|
||||
class BIGNAME: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(BIGNAME)
|
||||
@ -49,6 +47,7 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
BaseObjectPtr m_BigName;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,29 +31,25 @@
|
||||
*/
|
||||
|
||||
#include "BIGNAME.h"
|
||||
#include <Logic/Biff_records/BigName.h>
|
||||
#include <Logic/Biff_records/ContinueBigName.h>
|
||||
|
||||
#include "../Biff_records/BigName.h"
|
||||
#include "../Biff_records/ContinueBigName.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
BIGNAME::BIGNAME()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BIGNAME::~BIGNAME()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr BIGNAME::clone()
|
||||
{
|
||||
return BaseObjectPtr(new BIGNAME(*this));
|
||||
}
|
||||
|
||||
|
||||
// BIGNAME = BigName *ContinueBigName
|
||||
const bool BIGNAME::loadContent(BinProcessor& proc)
|
||||
{
|
||||
@ -61,7 +57,10 @@ const bool BIGNAME::loadContent(BinProcessor& proc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
proc.repeated<ContinueBigName>(0, 0);
|
||||
m_BigName = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
int count = proc.repeated<ContinueBigName>(0, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of FEAT union of records
|
||||
class FEAT: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(FEAT)
|
||||
@ -49,7 +47,7 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
static const ElementType type = typeFEAT;
|
||||
static const ElementType type = typeFEAT;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,11 +31,12 @@
|
||||
*/
|
||||
|
||||
#include "PROTECTION.h"
|
||||
#include <Logic/Biff_records/WinProtect.h>
|
||||
#include <Logic/Biff_records/Protect.h>
|
||||
#include <Logic/Biff_records/Password.h>
|
||||
#include <Logic/Biff_records/Prot4Rev.h>
|
||||
#include <Logic/Biff_records/Prot4RevPass.h>
|
||||
|
||||
#include "../Biff_records/WinProtect.h"
|
||||
#include "../Biff_records/Protect.h"
|
||||
#include "../Biff_records/Password.h"
|
||||
#include "../Biff_records/Prot4Rev.h"
|
||||
#include "../Biff_records/Prot4RevPass.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -85,7 +86,7 @@ const bool PROTECTION::loadContent(BinProcessor& proc)
|
||||
m_Prot4RevPass = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
return true;
|
||||
return m_WinProtect || m_Protect || m_Password;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of PROTECTION union of records
|
||||
class PROTECTION: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(PROTECTION)
|
||||
@ -49,7 +47,7 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
static const ElementType type = typePROTECTION;
|
||||
static const ElementType type = typePROTECTION;
|
||||
|
||||
BaseObjectPtr m_WinProtect;
|
||||
BaseObjectPtr m_Protect;
|
||||
|
||||
@ -31,25 +31,23 @@
|
||||
*/
|
||||
|
||||
#include "PROTECTION_COMMON.h"
|
||||
#include <Logic/Biff_records/Protect.h>
|
||||
#include <Logic/Biff_records/ScenarioProtect.h>
|
||||
#include <Logic/Biff_records/ObjProtect.h>
|
||||
#include <Logic/Biff_records/Password.h>
|
||||
|
||||
#include "../Biff_records/Protect.h"
|
||||
#include "../Biff_records/ScenarioProtect.h"
|
||||
#include "../Biff_records/ObjProtect.h"
|
||||
#include "../Biff_records/Password.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
PROTECTION_COMMON::PROTECTION_COMMON()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PROTECTION_COMMON::~PROTECTION_COMMON()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr PROTECTION_COMMON::clone()
|
||||
{
|
||||
return BaseObjectPtr(new PROTECTION_COMMON(*this));
|
||||
@ -59,12 +57,58 @@ BaseObjectPtr PROTECTION_COMMON::clone()
|
||||
// PROTECTION_COMMON = [Protect] [ScenarioProtect] [ObjProtect] [Password]
|
||||
const bool PROTECTION_COMMON::loadContent(BinProcessor& proc)
|
||||
{
|
||||
bool res1 = proc.optional<Protect>();
|
||||
bool res2 = proc.optional<ScenarioProtect>();
|
||||
bool res3 = proc.optional<ObjProtect>();
|
||||
bool res4 = proc.optional<Password>();
|
||||
if (proc.optional<Protect>())
|
||||
{
|
||||
m_Protect = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (proc.optional<ScenarioProtect>())
|
||||
{
|
||||
m_ScenarioProtect = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (proc.optional<ObjProtect>())
|
||||
{
|
||||
m_ObjProtect = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (proc.optional<Password>())
|
||||
{
|
||||
m_Password = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
return res1 || res2 || res3 || res4;
|
||||
return m_Protect || m_ScenarioProtect || m_ObjProtect || m_Password;
|
||||
}
|
||||
|
||||
int PROTECTION_COMMON::serialize (std::wostream & _stream)
|
||||
{
|
||||
Protect *protect = dynamic_cast<Protect*> (m_Protect.get());
|
||||
Password *password = dynamic_cast<Password*> (m_Password.get());
|
||||
ScenarioProtect *scenario = dynamic_cast<ScenarioProtect*>(m_ScenarioProtect.get());
|
||||
ObjProtect *object = dynamic_cast<ObjProtect*> (m_ObjProtect.get());
|
||||
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
CP_XML_NODE(L"sheetProtection")
|
||||
{
|
||||
if (protect)
|
||||
{
|
||||
CP_XML_ATTR(L"sheet", (protect->fLock ? 1 : 0));
|
||||
}
|
||||
if (object)
|
||||
{
|
||||
CP_XML_ATTR(L"objects", (object->fLockObj ? 1 : 0));
|
||||
}
|
||||
if (scenario)
|
||||
{
|
||||
CP_XML_ATTR(L"scenarios", (scenario->fScenProtect ? 1 : 0));
|
||||
}
|
||||
CP_XML_ATTR(L"selectLockedCells", 1);
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of PROTECTION_COMMON union of records
|
||||
class PROTECTION_COMMON: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(PROTECTION)
|
||||
@ -48,8 +46,14 @@ public:
|
||||
BaseObjectPtr clone();
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
int serialize (std::wostream & _stream);
|
||||
|
||||
static const ElementType type = typePROTECTION_COMMON;
|
||||
static const ElementType type = typePROTECTION_COMMON;
|
||||
|
||||
BaseObjectPtr m_Protect;
|
||||
BaseObjectPtr m_ScenarioProtect;
|
||||
BaseObjectPtr m_ObjProtect;
|
||||
BaseObjectPtr m_Password;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,12 +31,11 @@
|
||||
*/
|
||||
|
||||
#include "RECORD12.h"
|
||||
#include <Logic/Biff_records/HeaderFooter.h>
|
||||
#include "../Biff_records/HeaderFooter.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
RECORD12::RECORD12()
|
||||
{
|
||||
}
|
||||
@ -60,6 +59,9 @@ const bool RECORD12::loadContent(BinProcessor& proc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_HeaderFooter = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of RECORD12 union of records
|
||||
class RECORD12: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(RECORD12)
|
||||
@ -49,7 +47,9 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
static const ElementType type = typeRECORD12;
|
||||
static const ElementType type = typeRECORD12;
|
||||
|
||||
BaseObjectPtr m_HeaderFooter;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
#include "Biff_records/WebPub.h"
|
||||
#include "Biff_records/HFPicture.h"
|
||||
#include "Biff_records/PrintSize.h"
|
||||
#include "Biff_records/HeaderFooter.h"
|
||||
#include "Biff_records/Fbi.h"
|
||||
#include "Biff_records/Fbi2.h"
|
||||
#include "Biff_records/ClrtClient.h"
|
||||
@ -92,6 +91,7 @@
|
||||
#include "Biff_unions/LD.h"
|
||||
#include "Biff_unions/DAT.h"
|
||||
#include "Biff_unions/PIVOTVIEW.h"
|
||||
#include "Biff_unions/RECORD12.h"
|
||||
|
||||
#include "../../XlsXlsxConverter/XlsConverter.h"
|
||||
#include "../../XlsXlsxConverter/xlsx_conversion_context.h"
|
||||
@ -101,7 +101,7 @@ namespace XLS
|
||||
{;
|
||||
|
||||
|
||||
ChartSheetSubstream::ChartSheetSubstream(const size_t ws_index) : ws_index_(ws_index)
|
||||
ChartSheetSubstream::ChartSheetSubstream(const size_t ws_index) : CommonSubstream(ws_index)
|
||||
{
|
||||
}
|
||||
|
||||
@ -150,7 +150,14 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case rt_WriteProtect: proc.optional<WriteProtect>(); break;
|
||||
case rt_WriteProtect:
|
||||
{
|
||||
if (proc.optional<WriteProtect>())
|
||||
{
|
||||
m_WriteProtect = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_SheetExt:
|
||||
{
|
||||
if (proc.optional<SheetExt>())
|
||||
@ -160,19 +167,47 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
}
|
||||
}break;
|
||||
case rt_WebPub: proc.optional<WebPub>(); break;
|
||||
case rt_HFPicture: proc.repeated<HFPicture>(0, 0); break;
|
||||
|
||||
case rt_HFPicture:
|
||||
{
|
||||
count = proc.repeated<HFPicture>(0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arHFPicture.insert(m_arHFPicture.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
}break;
|
||||
case rt_Header:
|
||||
case rt_Footer:
|
||||
case rt_BottomMargin:
|
||||
case rt_TopMargin:
|
||||
case rt_LeftMargin:
|
||||
case rt_RightMargin:
|
||||
proc.mandatory<PAGESETUP>(); break;
|
||||
|
||||
case rt_PrintSize: proc.mandatory<PrintSize>(); break;
|
||||
case rt_HeaderFooter: proc.optional<HeaderFooter>(); break;
|
||||
|
||||
{
|
||||
if (proc.mandatory<PAGESETUP>())
|
||||
{
|
||||
m_PAGESETUP = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_PrintSize:
|
||||
{
|
||||
if (proc.mandatory<PrintSize>())
|
||||
{
|
||||
m_PrintSize = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_HeaderFooter:
|
||||
{
|
||||
count = proc.repeated<RECORD12> (0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arRECORD12.insert(m_arRECORD12.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
}break;
|
||||
case rt_BkHim:
|
||||
{
|
||||
if (proc.optional<BACKGROUND>())
|
||||
@ -207,10 +242,22 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
case rt_Protect:
|
||||
case rt_ScenarioProtect:
|
||||
case rt_ObjProtect:
|
||||
case rt_Password:
|
||||
proc.optional<PROTECTION_COMMON>(); break;
|
||||
|
||||
case rt_Palette: proc.optional<Palette>(); break;
|
||||
case rt_Password:
|
||||
{
|
||||
if (proc.optional<PROTECTION_COMMON>())
|
||||
{
|
||||
m_PROTECTION = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_Palette:
|
||||
{
|
||||
if (proc.optional<Palette>())
|
||||
{
|
||||
m_Palette = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_SXViewLink:
|
||||
{
|
||||
if (proc.optional<SXViewLink>())
|
||||
@ -244,7 +291,7 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
OBJECTS objects(true);
|
||||
if (proc.mandatory(objects))
|
||||
{
|
||||
m_OBJECTSCHART = elements_.back();
|
||||
m_OBJECTS = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
@ -310,7 +357,14 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
}
|
||||
}break;
|
||||
|
||||
case rt_CodeName: proc.optional<CodeName>(); break;
|
||||
case rt_CodeName:
|
||||
{
|
||||
if (proc.optional<CodeName>())
|
||||
{
|
||||
m_CodeName = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_CrtMlFrt: proc.optional<CRTMLFRT>(); break;
|
||||
|
||||
default://unknown .... skip
|
||||
@ -319,7 +373,8 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
LoadHFPicture();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Logic/CompositeObject.h>
|
||||
#include "CommonSubstream.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace XLS
|
||||
@ -44,7 +45,7 @@ class CRT;
|
||||
class ChartSheetSubstream;
|
||||
typedef boost::shared_ptr<ChartSheetSubstream> ChartSheetSubstreamPtr;
|
||||
|
||||
class ChartSheetSubstream: public CompositeObject
|
||||
class ChartSheetSubstream: public CompositeObject, public CommonSubstream
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(ChartSheetSubstream)
|
||||
public:
|
||||
@ -68,25 +69,17 @@ public:
|
||||
|
||||
static const ElementType type = typeChartSheetSubstream;
|
||||
|
||||
|
||||
GlobalWorkbookInfoPtr global_info_;
|
||||
size_t ws_index_;
|
||||
|
||||
BaseObjectPtr m_BACKGROUND;
|
||||
std::vector<BaseObjectPtr> m_arFbi;
|
||||
BaseObjectPtr m_CHARTFORMATS;
|
||||
BaseObjectPtr m_SERIESDATA;
|
||||
BaseObjectPtr m_OBJECTSCHART;
|
||||
std::vector<BaseObjectPtr> m_arWINDOW;
|
||||
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
|
||||
BaseObjectPtr m_Units;
|
||||
BaseObjectPtr m_ExternSheet;
|
||||
BaseObjectPtr m_SXViewLink;
|
||||
BaseObjectPtr m_PivotChartBits;
|
||||
BaseObjectPtr m_SBaseRef;
|
||||
|
||||
BaseObjectPtr m_CodeName;
|
||||
BaseObjectPtr m_SheetExt;
|
||||
BaseObjectPtr m_PrintSize;
|
||||
BaseObjectPtr m_Palette;
|
||||
BaseObjectPtr m_WriteProtect;
|
||||
private:
|
||||
|
||||
void recalc(CHARTFORMATS* charts);
|
||||
|
||||
118
ASCOfficeXlsFile2/source/XlsFormat/Logic/CommonSubstream.cpp
Normal file
118
ASCOfficeXlsFile2/source/XlsFormat/Logic/CommonSubstream.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "CommonSubstream.h"
|
||||
|
||||
#include "Biff_records/HFPicture.h"
|
||||
#include "Biff_records/SheetExt.h"
|
||||
#include "Biff_records/CodeName.h"
|
||||
|
||||
#include "Biff_structures/ODRAW/OfficeArtDgContainer.h"
|
||||
|
||||
namespace XLS
|
||||
{;
|
||||
|
||||
void CommonSubstream::LoadHFPicture()
|
||||
{
|
||||
if (m_arHFPicture.empty()) return;
|
||||
|
||||
size_t current_size_hf = 0, j = 0;
|
||||
for ( size_t i = 0; i < m_arHFPicture.size(); i++)
|
||||
{
|
||||
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get());
|
||||
if ((hf) && (hf->recordDrawingGroup))
|
||||
{
|
||||
if (!hf->fContinue && current_size_hf > 0)
|
||||
{
|
||||
XLS::CFRecord record(CFRecordType::ANY_TYPE, global_info_);
|
||||
for (; j < i; j++)
|
||||
{
|
||||
hf = dynamic_cast<HFPicture*>(m_arHFPicture[j].get());
|
||||
record.appendRawData(hf->recordDrawingGroup);
|
||||
}
|
||||
ODRAW::OfficeArtDgContainerPtr rgDrawing = ODRAW::OfficeArtDgContainerPtr(new ODRAW::OfficeArtDgContainer(ODRAW::OfficeArtRecord::CA_HF));
|
||||
rgDrawing->loadFields(record);
|
||||
m_arHFPictureDrawing.push_back(rgDrawing);
|
||||
current_size_hf = 0;
|
||||
|
||||
}
|
||||
current_size_hf += hf->recordDrawingGroup->getDataSize();
|
||||
}
|
||||
}
|
||||
if (current_size_hf > 0)
|
||||
{
|
||||
XLS::CFRecord record(ODRAW::OfficeArtRecord::DggContainer, global_info_);
|
||||
for (; j < m_arHFPicture.size(); j++)
|
||||
{
|
||||
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[j].get());
|
||||
record.appendRawData(hf->recordDrawingGroup);
|
||||
}
|
||||
ODRAW::OfficeArtDgContainerPtr rgDrawing = ODRAW::OfficeArtDgContainerPtr(new ODRAW::OfficeArtDgContainer(ODRAW::OfficeArtRecord::CA_HF));
|
||||
rgDrawing->loadFields(record);
|
||||
m_arHFPictureDrawing.push_back(rgDrawing);
|
||||
}
|
||||
}
|
||||
|
||||
int CommonSubstream::serialize_format(std::wostream & strm)
|
||||
{
|
||||
SheetExt *sheet_ext = dynamic_cast<SheetExt*>(m_SheetExt.get());
|
||||
CodeName *code_name = dynamic_cast<CodeName*>(m_CodeName.get());
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"sheetPr")
|
||||
{
|
||||
if (code_name)
|
||||
{
|
||||
CP_XML_ATTR(L"codeName", code_name->value);
|
||||
}
|
||||
if ((sheet_ext) && (sheet_ext->sheetExtOptional.bEnabled))
|
||||
{
|
||||
if (!sheet_ext->sheetExtOptional.fCondFmtCalc)
|
||||
CP_XML_ATTR(L"enableFormatConditionsCalculation", false);
|
||||
if (!sheet_ext->sheetExtOptional.fNotPublished)
|
||||
CP_XML_ATTR(L"published" ,false);
|
||||
|
||||
if (sheet_ext->sheetExtOptional.color.xclrType.type == XColorType::XCLRRGB)
|
||||
{
|
||||
CP_XML_NODE(L"tabColor")
|
||||
{
|
||||
CP_XML_ATTR(L"rgb", sheet_ext->sheetExtOptional.color.rgb.strARGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
78
ASCOfficeXlsFile2/source/XlsFormat/Logic/CommonSubstream.h
Normal file
78
ASCOfficeXlsFile2/source/XlsFormat/Logic/CommonSubstream.h
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "CompositeObject.h"
|
||||
#include "Biff_structures/CellRef.h"
|
||||
|
||||
namespace XLS
|
||||
{;
|
||||
|
||||
class CommonSubstream
|
||||
{
|
||||
public:
|
||||
CommonSubstream(const size_t ws_index) : ws_index_(ws_index) {}
|
||||
~CommonSubstream(){}
|
||||
|
||||
int serialize_format(std::wostream & _stream);
|
||||
|
||||
GlobalWorkbookInfoPtr global_info_;
|
||||
size_t ws_index_;
|
||||
|
||||
std::vector<BiffStructurePtr> m_arHFPictureDrawing;
|
||||
|
||||
BaseObjectPtr m_PAGESETUP;
|
||||
BaseObjectPtr m_PROTECTION;
|
||||
BaseObjectPtr m_BACKGROUND;
|
||||
BaseObjectPtr m_GLOBALS;
|
||||
BaseObjectPtr m_COLUMNS;
|
||||
BaseObjectPtr m_CELLTABLE;
|
||||
BaseObjectPtr m_SORTANDFILTER;
|
||||
BaseObjectPtr m_OBJECTS;
|
||||
BaseObjectPtr m_DCON;
|
||||
BaseObjectPtr m_CodeName;
|
||||
BaseObjectPtr m_SheetExt;
|
||||
BaseObjectPtr m_SXADDLDBQUERY;
|
||||
|
||||
std::vector<BaseObjectPtr> m_arHFPicture;
|
||||
std::vector<BaseObjectPtr> m_arWINDOW;
|
||||
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
|
||||
std::vector<BaseObjectPtr> m_arFEAT;
|
||||
std::vector<BaseObjectPtr> m_arRECORD12;
|
||||
std::vector<BaseObjectPtr> m_arFEAT11;
|
||||
std::vector<BaseObjectPtr> m_arSORT;
|
||||
|
||||
void LoadHFPicture();
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -73,6 +73,7 @@ public:
|
||||
BaseObjectPtr m_METADATA;
|
||||
BaseObjectPtr m_MTRSettings;
|
||||
|
||||
std::vector<BaseObjectPtr> m_arBIGNAME;
|
||||
std::vector<BaseObjectPtr> m_arHFPicture;
|
||||
std::vector<BaseObjectPtr> m_arLBL;
|
||||
std::vector<BaseObjectPtr> m_arMSODRAWINGGROUP;
|
||||
|
||||
@ -67,7 +67,7 @@ namespace XLS
|
||||
{;
|
||||
|
||||
|
||||
MacroSheetSubstream::MacroSheetSubstream(const size_t ws_index) : ws_index_(ws_index)
|
||||
MacroSheetSubstream::MacroSheetSubstream(const size_t ws_index) : CommonSubstream(ws_index)
|
||||
{
|
||||
}
|
||||
|
||||
@ -125,7 +125,12 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
}
|
||||
proc.repeated<BIGNAME>(0, 0);
|
||||
proc.optional<PROTECTION_COMMON>();
|
||||
|
||||
if (proc.optional<PROTECTION_COMMON>())
|
||||
{
|
||||
m_PROTECTION = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
if (proc.mandatory<COLUMNS>())
|
||||
{
|
||||
@ -186,8 +191,7 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
|
||||
m_arWINDOW.insert(m_arWINDOW.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
|
||||
}
|
||||
count = proc.repeated<CUSTOMVIEW>(0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
@ -224,7 +228,7 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
|
||||
m_SheetExt = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
count = proc.repeated<FEAT> (0, 0);
|
||||
count = proc.repeated<FEAT> (0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arFEAT.insert(m_arFEAT.begin(), elements_.back());
|
||||
@ -240,6 +244,8 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
|
||||
}
|
||||
proc.mandatory<EOF_T>();
|
||||
|
||||
LoadHFPicture();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Logic/CompositeObject.h>
|
||||
#include "CommonSubstream.h"
|
||||
|
||||
namespace XLS
|
||||
{;
|
||||
@ -39,7 +39,7 @@ namespace XLS
|
||||
class MacroSheetSubstream;
|
||||
typedef boost::shared_ptr<MacroSheetSubstream> MacroSheetSubstreamPtr;
|
||||
|
||||
class MacroSheetSubstream: public CompositeObject
|
||||
class MacroSheetSubstream : public CompositeObject, public CommonSubstream
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(MacroSheetSubstream)
|
||||
public:
|
||||
@ -52,28 +52,11 @@ public:
|
||||
|
||||
static const ElementType type = typeMacroSheetSubstream;
|
||||
|
||||
GlobalWorkbookInfoPtr global_info_;
|
||||
size_t ws_index_;
|
||||
|
||||
BaseObjectPtr m_PAGESETUP;
|
||||
BaseObjectPtr m_BACKGROUND;
|
||||
BaseObjectPtr m_GLOBALS;
|
||||
BaseObjectPtr m_OBJECTS;
|
||||
BaseObjectPtr m_SheetExt;
|
||||
BaseObjectPtr m_CodeName;
|
||||
BaseObjectPtr m_DxGCol;
|
||||
BaseObjectPtr m_DCON;
|
||||
BaseObjectPtr m_Dimensions;
|
||||
BaseObjectPtr m_CELLTABLE;
|
||||
BaseObjectPtr m_COLUMNS;
|
||||
|
||||
BaseObjectPtr m_MACROSORTANDFILTER;
|
||||
|
||||
std::vector<BaseObjectPtr> m_arWINDOW;
|
||||
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
|
||||
std::vector<BaseObjectPtr> m_arFEAT;
|
||||
std::vector<BaseObjectPtr> m_arSORT;
|
||||
std::vector<BaseObjectPtr> m_arHFPicture;
|
||||
std::vector<BaseObjectPtr> m_arRECORD12;
|
||||
std::vector<BaseObjectPtr> m_arNote;
|
||||
};
|
||||
|
||||
|
||||
@ -80,23 +80,19 @@
|
||||
namespace XLS
|
||||
{;
|
||||
|
||||
|
||||
WorksheetSubstream::WorksheetSubstream(const size_t ws_index) : ws_index_(ws_index)
|
||||
WorksheetSubstream::WorksheetSubstream(const size_t ws_index) : CommonSubstream(ws_index)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WorksheetSubstream::~WorksheetSubstream()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr WorksheetSubstream::clone()
|
||||
{
|
||||
return BaseObjectPtr(new WorksheetSubstream(*this));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
WORKSHEETCONTENT = [Uncalced] Index GLOBALS PAGESETUP [HeaderFooter] [BACKGROUND] *BIGNAME [PROTECTION]
|
||||
COLUMNS [SCENARIOS] SORTANDFILTER Dimensions [CELLTABLE] OBJECTS *HFPicture *Note
|
||||
@ -205,8 +201,27 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_BigName: proc.repeated<BIGNAME>(0, 0); break;
|
||||
case rt_Protect: proc.optional<PROTECTION_COMMON>(); break;
|
||||
case rt_BigName:
|
||||
{
|
||||
count = proc.repeated<BIGNAME>(0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arBIGNAME.insert(m_arNote.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
}break;
|
||||
case rt_Protect:
|
||||
case rt_ScenarioProtect:
|
||||
case rt_ObjProtect:
|
||||
case rt_Password:
|
||||
{
|
||||
if (proc.optional<PROTECTION_COMMON>())
|
||||
{
|
||||
m_PROTECTION = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_ScenMan: proc.optional<SCENARIOS>(); break;
|
||||
case rt_Sort:
|
||||
case rt_AutoFilterInfo:
|
||||
@ -457,78 +472,6 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
|
||||
|
||||
return true;
|
||||
}
|
||||
void WorksheetSubstream::LoadHFPicture()
|
||||
{
|
||||
if (m_arHFPicture.empty()) return;
|
||||
|
||||
size_t current_size_hf = 0, j = 0;
|
||||
for ( size_t i = 0; i < m_arHFPicture.size(); i++)
|
||||
{
|
||||
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get());
|
||||
if ((hf) && (hf->recordDrawingGroup))
|
||||
{
|
||||
if (!hf->fContinue && current_size_hf > 0)
|
||||
{
|
||||
XLS::CFRecord record(CFRecordType::ANY_TYPE, global_info_);
|
||||
for (; j < i; j++)
|
||||
{
|
||||
hf = dynamic_cast<HFPicture*>(m_arHFPicture[j].get());
|
||||
record.appendRawData(hf->recordDrawingGroup);
|
||||
}
|
||||
ODRAW::OfficeArtDgContainerPtr rgDrawing = ODRAW::OfficeArtDgContainerPtr(new ODRAW::OfficeArtDgContainer(ODRAW::OfficeArtRecord::CA_HF));
|
||||
rgDrawing->loadFields(record);
|
||||
m_arHFPictureDrawing.push_back(rgDrawing);
|
||||
current_size_hf = 0;
|
||||
|
||||
}
|
||||
current_size_hf += hf->recordDrawingGroup->getDataSize();
|
||||
}
|
||||
}
|
||||
if (current_size_hf > 0)
|
||||
{
|
||||
XLS::CFRecord record(ODRAW::OfficeArtRecord::DggContainer, global_info_);
|
||||
for (; j < m_arHFPicture.size(); j++)
|
||||
{
|
||||
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[j].get());
|
||||
record.appendRawData(hf->recordDrawingGroup);
|
||||
}
|
||||
ODRAW::OfficeArtDgContainerPtr rgDrawing = ODRAW::OfficeArtDgContainerPtr(new ODRAW::OfficeArtDgContainer(ODRAW::OfficeArtRecord::CA_HF));
|
||||
rgDrawing->loadFields(record);
|
||||
m_arHFPictureDrawing.push_back(rgDrawing);
|
||||
}
|
||||
}
|
||||
|
||||
int WorksheetSubstream::serialize_format(std::wostream & strm)
|
||||
{
|
||||
SheetExt *sheet_ext = dynamic_cast<SheetExt*>(m_SheetExt.get());
|
||||
CodeName *code_name = dynamic_cast<CodeName*>(m_CodeName.get());
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"sheetPr")
|
||||
{
|
||||
if (code_name)
|
||||
{
|
||||
CP_XML_ATTR(L"codeName", code_name->value);
|
||||
}
|
||||
if ((sheet_ext) && (sheet_ext->sheetExtOptional.bEnabled))
|
||||
{
|
||||
if (!sheet_ext->sheetExtOptional.fCondFmtCalc)
|
||||
CP_XML_ATTR(L"enableFormatConditionsCalculation", false);
|
||||
if (!sheet_ext->sheetExtOptional.fNotPublished)
|
||||
CP_XML_ATTR(L"published" ,false);
|
||||
|
||||
if (sheet_ext->sheetExtOptional.color.xclrType.type == XColorType::XCLRRGB)
|
||||
{
|
||||
CP_XML_NODE(L"tabColor")
|
||||
{
|
||||
CP_XML_ATTR(L"rgb", sheet_ext->sheetExtOptional.color.rgb.strARGB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -31,8 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Logic/CompositeObject.h>
|
||||
#include <Logic/Biff_structures/CellRef.h>
|
||||
#include "CommonSubstream.h"
|
||||
|
||||
namespace XLS
|
||||
{;
|
||||
@ -40,7 +39,7 @@ namespace XLS
|
||||
class WorksheetSubstream;
|
||||
typedef boost::shared_ptr<WorksheetSubstream> WorksheetSubstreamPtr;
|
||||
|
||||
class WorksheetSubstream: public CompositeObject
|
||||
class WorksheetSubstream: public CompositeObject, public CommonSubstream
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(WorksheetSubstream)
|
||||
public:
|
||||
@ -50,53 +49,28 @@ public:
|
||||
BaseObjectPtr clone();
|
||||
|
||||
virtual const bool loadContent (BinProcessor& proc);
|
||||
int serialize_format(std::wostream & _stream);
|
||||
|
||||
static const ElementType type = typeWorksheetSubstream;
|
||||
|
||||
GlobalWorkbookInfoPtr global_info_;
|
||||
size_t ws_index_;
|
||||
|
||||
BaseObjectPtr m_GLOBALS;
|
||||
BaseObjectPtr m_PAGESETUP;
|
||||
BaseObjectPtr m_BACKGROUND;
|
||||
BaseObjectPtr m_DefaultRowHeight;
|
||||
BaseObjectPtr m_COLUMNS;
|
||||
BaseObjectPtr m_CELLTABLE;
|
||||
BaseObjectPtr m_SHFMLA_SET;
|
||||
BaseObjectPtr m_Dimensions;
|
||||
BaseObjectPtr m_SORTANDFILTER;
|
||||
BaseObjectPtr m_OBJECTS;
|
||||
BaseObjectPtr m_CONDFMTS;
|
||||
BaseObjectPtr m_CodeName;
|
||||
BaseObjectPtr m_SheetExt;
|
||||
BaseObjectPtr m_DxGCol;
|
||||
BaseObjectPtr m_DVAL;
|
||||
BaseObjectPtr m_DCON;
|
||||
BaseObjectPtr m_LRng;
|
||||
|
||||
std::vector<BaseObjectPtr> m_arMergeCells;
|
||||
std::vector<BaseObjectPtr> m_arWINDOW;
|
||||
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
|
||||
std::vector<BaseObjectPtr> m_arPIVOTVIEW;
|
||||
std::vector<BaseObjectPtr> m_arQUERYTABLE;
|
||||
std::vector<BaseObjectPtr> m_arFEAT;
|
||||
std::vector<BaseObjectPtr> m_arFEAT11;
|
||||
std::vector<BaseObjectPtr> m_arNote;
|
||||
std::vector<BaseObjectPtr> m_arHLINK;
|
||||
std::vector<BaseObjectPtr> m_arSORT;
|
||||
std::vector<BaseObjectPtr> m_arLabel;
|
||||
std::vector<BaseObjectPtr> m_arHFPicture;
|
||||
std::vector<BaseObjectPtr> m_arRECORD12;
|
||||
|
||||
std::vector<BiffStructurePtr> m_arHFPictureDrawing;
|
||||
std::vector<BaseObjectPtr> m_arBIGNAME;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
std::map<std::wstring, BaseObjectPtr> mapPivotViews;
|
||||
|
||||
private:
|
||||
|
||||
void LoadHFPicture(); //todoooo - обобщить
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -247,7 +247,7 @@ XlsConverter::XlsConverter(const std::wstring & xlsFileName, const std::wstring
|
||||
XLS::CFStreamPtr listdata = xls_file->getNamedStream(L"List Data");
|
||||
if(listdata)
|
||||
{
|
||||
unsigned long size = controls->getStreamSize();
|
||||
unsigned long size = listdata->getStreamSize();
|
||||
boost::shared_array<BYTE> buffer(new BYTE[size]);
|
||||
|
||||
listdata->read(buffer.get(), size);
|
||||
@ -289,6 +289,38 @@ XlsConverter::XlsConverter(const std::wstring & xlsFileName, const std::wstring
|
||||
output_document->add_customXml(content);
|
||||
}
|
||||
}
|
||||
XLS::CFStreamPtr toolbar_data = xls_file->getNamedStream(L"XCB");
|
||||
if(toolbar_data)
|
||||
{
|
||||
std::wstring xl_path = xlsx_path + FILE_SEPARATOR_STR + L"xl";
|
||||
NSDirectory::CreateDirectory(xl_path.c_str());
|
||||
|
||||
std::wstring sToolbarsFile = xl_path + FILE_SEPARATOR_STR + L"attachedToolbars.bin";
|
||||
|
||||
//POLE::Storage *storageToolbars = new POLE::Storage(sToolbarsFile.c_str());
|
||||
|
||||
//if ((storageToolbars) && (storageToolbars->open(true, true)))
|
||||
//{
|
||||
// toolbar_data->copy(L"attachedToolbars", storageToolbars);
|
||||
|
||||
// storageToolbars->close();
|
||||
// delete storageToolbars;
|
||||
|
||||
// output_document->get_xl_files().add_attachedToolbars();
|
||||
//}
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(sToolbarsFile))
|
||||
{
|
||||
unsigned long size = toolbar_data->getStreamSize();
|
||||
boost::shared_array<BYTE> buffer(new BYTE[size]);
|
||||
|
||||
toolbar_data->read(buffer.get(), size);
|
||||
file.WriteFile(buffer.get(), size);
|
||||
file.CloseFile();
|
||||
|
||||
output_document->get_xl_files().add_attachedToolbars();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
@ -441,47 +473,27 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
|
||||
xlsx_context->add_connections(xls_global_info->connections_stream.str());
|
||||
}
|
||||
|
||||
void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
|
||||
void XlsConverter::convert_common (XLS::CommonSubstream* sheet)
|
||||
{
|
||||
if (sheet == NULL) return;
|
||||
|
||||
xls_global_info->current_sheet = sheet->ws_index_ + 1;
|
||||
|
||||
std::wstring name = xls_global_info->sheets_info[sheet->ws_index_].name;
|
||||
if (name.empty())
|
||||
name = L"Sheet_" + std::to_wstring(sheet->ws_index_ + 1);
|
||||
|
||||
xlsx_context->set_table_type(1);
|
||||
xlsx_context->set_table_name(name) ;
|
||||
xlsx_context->set_table_id(sheet->ws_index_ + 1);
|
||||
xlsx_context->set_table_state(xls_global_info->sheets_info[sheet->ws_index_].state);
|
||||
|
||||
xls_global_info->current_sheet = sheet->ws_index_ + 1;
|
||||
|
||||
if (sheet->m_GLOBALS)
|
||||
{
|
||||
sheet->m_GLOBALS->serialize(xlsx_context->current_sheet().sheetFormat());
|
||||
}
|
||||
|
||||
if (!sheet->m_arWINDOW.empty())
|
||||
{
|
||||
sheet->m_arWINDOW[0]->serialize(xlsx_context->current_sheet().sheetViews());
|
||||
}
|
||||
if (sheet->m_Dimensions)
|
||||
{
|
||||
sheet->m_Dimensions->serialize(xlsx_context->current_sheet().dimension());
|
||||
}
|
||||
}
|
||||
|
||||
sheet->serialize_format(xlsx_context->current_sheet().sheetProperties());
|
||||
|
||||
if (sheet->m_GLOBALS)
|
||||
if (sheet->m_PROTECTION)
|
||||
{
|
||||
XLS::GLOBALS * globals = dynamic_cast<XLS::GLOBALS *>(sheet->m_GLOBALS.get());
|
||||
XLS::COLUMNS * columns = dynamic_cast<XLS::COLUMNS *>(sheet->m_COLUMNS.get());
|
||||
|
||||
if (columns)
|
||||
{
|
||||
globals->m_DefColWidth = columns->m_DefColWidth;
|
||||
}
|
||||
globals->m_DxGCol = sheet->m_DxGCol;
|
||||
|
||||
sheet->m_GLOBALS->serialize(xlsx_context->current_sheet().sheetFormat());
|
||||
|
||||
if (globals->is_dialog)
|
||||
xlsx_context->set_table_type(2);
|
||||
sheet->m_PROTECTION->serialize(xlsx_context->current_sheet().protection());
|
||||
}
|
||||
if (sheet->m_COLUMNS)
|
||||
{
|
||||
@ -491,72 +503,15 @@ void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
|
||||
{
|
||||
sheet->m_CELLTABLE->serialize(xlsx_context->current_sheet().sheetData());
|
||||
}
|
||||
if (sheet->m_arMergeCells.size() > 0)
|
||||
{
|
||||
CP_XML_WRITER(xlsx_context->current_sheet().mergeCells())
|
||||
{
|
||||
CP_XML_NODE(L"mergeCells")
|
||||
{
|
||||
for (size_t i = 0 ; i < sheet->m_arMergeCells.size(); i++)
|
||||
{
|
||||
sheet->m_arMergeCells[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 0 ; i < sheet->m_arHLINK.size(); i++)
|
||||
{
|
||||
convert((XLS::HLINK*)sheet->m_arHLINK[i].get());
|
||||
}
|
||||
|
||||
if (sheet->m_SORTANDFILTER)
|
||||
{
|
||||
sheet->m_SORTANDFILTER->serialize(xlsx_context->current_sheet().sheetSortAndFilters());
|
||||
}
|
||||
|
||||
if (sheet->m_CONDFMTS)
|
||||
{
|
||||
sheet->m_CONDFMTS->serialize(xlsx_context->current_sheet().conditionalFormatting());
|
||||
}
|
||||
|
||||
if (sheet->m_DVAL)
|
||||
{
|
||||
sheet->m_DVAL->serialize(xlsx_context->current_sheet().dataValidations());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sheet->m_arQUERYTABLE.size(); i++)
|
||||
{
|
||||
convert(dynamic_cast<XLS::QUERYTABLE*>(sheet->m_arQUERYTABLE[i].get()));
|
||||
}
|
||||
for (size_t i = 0; i < sheet->m_arPIVOTVIEW.size(); i++)
|
||||
{
|
||||
convert((XLS::PIVOTVIEW*)sheet->m_arPIVOTVIEW[i].get());
|
||||
}
|
||||
|
||||
convert((XLS::OBJECTS*)sheet->m_OBJECTS.get(), sheet);
|
||||
|
||||
if (!sheet->m_arNote.empty() && xls_global_info->Version < 0x0600)
|
||||
{
|
||||
xlsx_context->get_drawing_context().start_drawing(0);
|
||||
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
|
||||
{
|
||||
xlsx_context->get_drawing_context().start_drawing(0x0019);
|
||||
convert(dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get()));
|
||||
xlsx_context->get_drawing_context().end_drawing();
|
||||
}
|
||||
xlsx_context->get_drawing_context().end_group();
|
||||
}
|
||||
|
||||
}
|
||||
if (sheet->m_PAGESETUP)
|
||||
{
|
||||
sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties());
|
||||
}
|
||||
|
||||
for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
|
||||
{
|
||||
//convert(dynamic_cast<XLS::Note*>(sheet->sheet->m_arHFPictureDrawing[i].get(),
|
||||
}
|
||||
|
||||
if (sheet->m_arCUSTOMVIEW.size() > 0)
|
||||
{
|
||||
CP_XML_WRITER(xlsx_context->current_sheet().customViews())
|
||||
@ -582,6 +537,89 @@ void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
|
||||
}
|
||||
}
|
||||
|
||||
void XlsConverter::convert (XLS::WorksheetSubstream* sheet)
|
||||
{
|
||||
if (sheet == NULL) return;
|
||||
|
||||
std::wstring name = xls_global_info->sheets_info[sheet->ws_index_].name;
|
||||
if (name.empty())
|
||||
name = L"Sheet_" + std::to_wstring(sheet->ws_index_ + 1);
|
||||
|
||||
xlsx_context->set_table_type(1);
|
||||
xlsx_context->set_table_name(name) ;
|
||||
xlsx_context->set_table_id(sheet->ws_index_ + 1);
|
||||
xlsx_context->set_table_state(xls_global_info->sheets_info[sheet->ws_index_].state);
|
||||
|
||||
if (sheet->m_GLOBALS)
|
||||
{
|
||||
XLS::GLOBALS * globals = dynamic_cast<XLS::GLOBALS *>(sheet->m_GLOBALS.get());
|
||||
XLS::COLUMNS * columns = dynamic_cast<XLS::COLUMNS *>(sheet->m_COLUMNS.get());
|
||||
|
||||
if (columns)
|
||||
{
|
||||
globals->m_DefColWidth = columns->m_DefColWidth;
|
||||
}
|
||||
globals->m_DxGCol = sheet->m_DxGCol;
|
||||
|
||||
if (globals->is_dialog)
|
||||
xlsx_context->set_table_type(2);
|
||||
}
|
||||
|
||||
convert_common(dynamic_cast<XLS::CommonSubstream*>(sheet));
|
||||
|
||||
convert((XLS::OBJECTS*)sheet->m_OBJECTS.get(), sheet);
|
||||
|
||||
if (sheet->m_Dimensions)
|
||||
{
|
||||
sheet->m_Dimensions->serialize(xlsx_context->current_sheet().dimension());
|
||||
}
|
||||
if (sheet->m_arMergeCells.size() > 0)
|
||||
{
|
||||
CP_XML_WRITER(xlsx_context->current_sheet().mergeCells())
|
||||
{
|
||||
CP_XML_NODE(L"mergeCells")
|
||||
{
|
||||
for (size_t i = 0 ; i < sheet->m_arMergeCells.size(); i++)
|
||||
{
|
||||
sheet->m_arMergeCells[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 0 ; i < sheet->m_arHLINK.size(); i++)
|
||||
{
|
||||
convert((XLS::HLINK*)sheet->m_arHLINK[i].get());
|
||||
}
|
||||
if (sheet->m_CONDFMTS)
|
||||
{
|
||||
sheet->m_CONDFMTS->serialize(xlsx_context->current_sheet().conditionalFormatting());
|
||||
}
|
||||
if (sheet->m_DVAL)
|
||||
{
|
||||
sheet->m_DVAL->serialize(xlsx_context->current_sheet().dataValidations());
|
||||
}
|
||||
if (!sheet->m_arNote.empty() && xls_global_info->Version < 0x0600)
|
||||
{
|
||||
xlsx_context->get_drawing_context().start_drawing(0);
|
||||
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
|
||||
{
|
||||
xlsx_context->get_drawing_context().start_drawing(0x0019);
|
||||
convert(dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get()));
|
||||
xlsx_context->get_drawing_context().end_drawing();
|
||||
}
|
||||
xlsx_context->get_drawing_context().end_group();
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sheet->m_arQUERYTABLE.size(); i++)
|
||||
{
|
||||
convert(dynamic_cast<XLS::QUERYTABLE*>(sheet->m_arQUERYTABLE[i].get()));
|
||||
}
|
||||
for (size_t i = 0; i < sheet->m_arPIVOTVIEW.size(); i++)
|
||||
{
|
||||
convert((XLS::PIVOTVIEW*)sheet->m_arPIVOTVIEW[i].get());
|
||||
}
|
||||
}
|
||||
|
||||
void XlsConverter::convert (XLS::MacroSheetSubstream* sheet)
|
||||
{
|
||||
if (sheet == NULL) return;
|
||||
@ -597,17 +635,6 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet)
|
||||
xlsx_context->set_table_id(sheet->ws_index_ + 1);
|
||||
xlsx_context->set_table_state(xls_global_info->sheets_info[sheet->ws_index_].state);
|
||||
|
||||
if (!sheet->m_arWINDOW.empty())
|
||||
{
|
||||
sheet->m_arWINDOW[0]->serialize(xlsx_context->current_sheet().sheetViews());
|
||||
}
|
||||
if (sheet->m_Dimensions)
|
||||
{
|
||||
sheet->m_Dimensions->serialize(xlsx_context->current_sheet().dimension());
|
||||
}
|
||||
|
||||
//sheet->serialize_format(xlsx_context->current_sheet().sheetProperties());
|
||||
|
||||
if (sheet->m_GLOBALS)
|
||||
{
|
||||
XLS::GLOBALS * globals = dynamic_cast<XLS::GLOBALS *>(sheet->m_GLOBALS.get());
|
||||
@ -617,20 +644,20 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet)
|
||||
{
|
||||
globals->m_DefColWidth = columns->m_DefColWidth;
|
||||
}
|
||||
globals->m_DxGCol = sheet->m_DxGCol;
|
||||
|
||||
sheet->m_GLOBALS->serialize(xlsx_context->current_sheet().sheetFormat());
|
||||
}
|
||||
if (sheet->m_COLUMNS)
|
||||
{
|
||||
sheet->m_COLUMNS->serialize(xlsx_context->current_sheet().cols());
|
||||
}
|
||||
if (sheet->m_CELLTABLE)
|
||||
{
|
||||
sheet->m_CELLTABLE->serialize(xlsx_context->current_sheet().sheetData());
|
||||
globals->m_DxGCol = sheet->m_DxGCol;
|
||||
|
||||
if (globals->is_dialog)
|
||||
xlsx_context->set_table_type(2);
|
||||
}
|
||||
convert_common(dynamic_cast<XLS::CommonSubstream*>(sheet));
|
||||
|
||||
convert((XLS::OBJECTS*)sheet->m_OBJECTS.get(), NULL);
|
||||
|
||||
if (sheet->m_Dimensions)
|
||||
{
|
||||
sheet->m_Dimensions->serialize(xlsx_context->current_sheet().dimension());
|
||||
}
|
||||
|
||||
if (!sheet->m_arNote.empty() && xls_global_info->Version < 0x0600)
|
||||
{
|
||||
xlsx_context->get_drawing_context().start_drawing(0);
|
||||
@ -642,40 +669,6 @@ void XlsConverter::convert (XLS::MacroSheetSubstream* sheet)
|
||||
}
|
||||
xlsx_context->get_drawing_context().end_group();
|
||||
}
|
||||
|
||||
if (sheet->m_PAGESETUP)
|
||||
{
|
||||
sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties());
|
||||
}
|
||||
|
||||
//for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
|
||||
//{
|
||||
// //convert(dynamic_cast<XLS::Note*>(sheet->sheet->m_arHFPictureDrawing[i].get(),
|
||||
//}
|
||||
|
||||
if (sheet->m_arCUSTOMVIEW.size() > 0)
|
||||
{
|
||||
CP_XML_WRITER(xlsx_context->current_sheet().customViews())
|
||||
{
|
||||
CP_XML_NODE(L"customSheetViews")
|
||||
{
|
||||
for (size_t i = 0 ; i < sheet->m_arCUSTOMVIEW.size(); i++)
|
||||
{
|
||||
sheet->m_arCUSTOMVIEW[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sheet->m_BACKGROUND)
|
||||
{
|
||||
convert(dynamic_cast<XLS::BACKGROUND*>(sheet->m_BACKGROUND.get()));
|
||||
}
|
||||
|
||||
//for (size_t i = 0 ; i < sheet->m_arHFPictureDrawing.size(); i++)
|
||||
//{
|
||||
// convert((ODRAW::OfficeArtDgContainer*)sheet->m_arHFPictureDrawing[i].get());
|
||||
//}
|
||||
}
|
||||
|
||||
void XlsConverter::convert(XLS::GlobalsSubstream* globals)
|
||||
@ -725,6 +718,31 @@ void XlsConverter::convert(XLS::GlobalsSubstream* globals)
|
||||
}
|
||||
}
|
||||
|
||||
void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream* chartsheet)
|
||||
{
|
||||
if (chartsheet == NULL) return;
|
||||
|
||||
xls_global_info->current_sheet = chartsheet->ws_index_ + 1;
|
||||
|
||||
std::wstring name = xls_global_info->sheets_info[chartsheet->ws_index_].name;
|
||||
if (name.empty())
|
||||
name = L"ChartSheet_" + std::to_wstring(chartsheet->ws_index_ + 1);
|
||||
|
||||
xlsx_context->set_table_type(3);
|
||||
xlsx_context->set_table_name(name) ;
|
||||
xlsx_context->set_table_id(chartsheet->ws_index_ + 1);
|
||||
xlsx_context->set_table_state(xls_global_info->sheets_info[chartsheet->ws_index_].state);
|
||||
|
||||
convert_common(dynamic_cast<XLS::CommonSubstream*>(chartsheet));
|
||||
|
||||
if (xlsx_context->get_drawing_context().start_drawing(0x0005))
|
||||
{
|
||||
xlsx_context->get_drawing_context().set_id(1);
|
||||
convert(chartsheet);
|
||||
|
||||
xlsx_context->get_drawing_context().end_drawing();
|
||||
}
|
||||
}
|
||||
typedef boost::unordered_map<XLS::FillInfo, int> mapFillInfo;
|
||||
typedef boost::unordered_map<XLS::BorderInfo, int> mapBorderInfo;
|
||||
|
||||
@ -2207,29 +2225,6 @@ void XlsConverter::convert(XLS::Obj * obj)
|
||||
}
|
||||
}
|
||||
|
||||
void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream* chartsheet)
|
||||
{
|
||||
if (chartsheet == NULL) return;
|
||||
|
||||
xls_global_info->current_sheet = chartsheet->ws_index_ + 1;
|
||||
|
||||
std::wstring name = xls_global_info->sheets_info[chartsheet->ws_index_].name;
|
||||
if (name.empty())
|
||||
name = L"ChartSheet_" + std::to_wstring(chartsheet->ws_index_ + 1);
|
||||
|
||||
xlsx_context->set_table_type(3);
|
||||
xlsx_context->set_table_name(name) ;
|
||||
xlsx_context->set_table_id(chartsheet->ws_index_ + 1);
|
||||
xlsx_context->set_table_state(xls_global_info->sheets_info[chartsheet->ws_index_].state);
|
||||
|
||||
if (xlsx_context->get_drawing_context().start_drawing(0x0005))
|
||||
{
|
||||
xlsx_context->get_drawing_context().set_id(1);
|
||||
convert(chartsheet);
|
||||
|
||||
xlsx_context->get_drawing_context().end_drawing();
|
||||
}
|
||||
}
|
||||
void XlsConverter::convert(XLS::ChartSheetSubstream* chart)
|
||||
{
|
||||
if (chart == NULL) return;
|
||||
|
||||
@ -60,6 +60,7 @@ namespace XLS
|
||||
typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr;
|
||||
|
||||
class WorkbookStreamObject;
|
||||
class CommonSubstream;
|
||||
class WorksheetSubstream;
|
||||
class GlobalsSubstream;
|
||||
class ChartSheetSubstream;
|
||||
@ -110,6 +111,8 @@ public:
|
||||
|
||||
void convert(XLS::BaseObject * xls_unknown);
|
||||
|
||||
void convert_common(XLS::CommonSubstream* strm);
|
||||
|
||||
void convert(XLS::WorkbookStreamObject * woorkbook);
|
||||
void convert(XLS::WorksheetSubstream * sheet);
|
||||
void convert(XLS::ChartSheetSubstream * chart);
|
||||
|
||||
@ -63,6 +63,7 @@ public:
|
||||
std::wstringstream conditionalFormatting_;
|
||||
std::wstringstream picture_background_;
|
||||
std::wstringstream dataValidations_;
|
||||
std::wstringstream protection_;
|
||||
|
||||
rels rels_;
|
||||
|
||||
@ -166,6 +167,11 @@ std::wostream & xlsx_xml_worksheet::dataValidations()
|
||||
{
|
||||
return impl_->dataValidations_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::protection()
|
||||
{
|
||||
return impl_->protection_;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
rels & xlsx_xml_worksheet::sheet_rels()
|
||||
{
|
||||
@ -209,6 +215,9 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_STREAM() << impl_->sheetData_.str();
|
||||
}
|
||||
|
||||
CP_XML_STREAM() << impl_->protection_.str();
|
||||
|
||||
//оказывается порядок нахождения элементов важен !!! (для office 2010)
|
||||
//объединенные ячейки раньше чем гиперлинки !!!
|
||||
|
||||
|
||||
@ -71,7 +71,8 @@ public:
|
||||
std::wostream & conditionalFormatting();
|
||||
std::wostream & picture_background();
|
||||
std::wostream & dataValidations();
|
||||
|
||||
std::wostream & protection();
|
||||
|
||||
rels & sheet_rels();//hyperlink, background image, external, media ...
|
||||
|
||||
void write_to(std::wostream & strm);
|
||||
|
||||
@ -237,7 +237,9 @@ void sheets_files::write_(std::vector<sheet_content_ptr> & sheets_, int & id,
|
||||
xl_files::xl_files()
|
||||
{
|
||||
rels_files_.add_rel_file(rels_file::create(L"workbook.xml.rels"));
|
||||
|
||||
bVbaProject = false;
|
||||
bAttachedToolbars = false;
|
||||
}
|
||||
|
||||
void xl_files::write(const std::wstring & RootPath)
|
||||
@ -308,6 +310,11 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
contentTypes.add_override(L"/xl/workbook.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
|
||||
}
|
||||
}
|
||||
if (bAttachedToolbars)
|
||||
{
|
||||
rels_files_.add( relationship( L"vbId2", L"http://schemas.microsoft.com/office/2006/relationships/attachedToolbars", L"attachedToolbars.bin" ) );
|
||||
contentTypes.add_override(L"/xl/attachedToolbars.bin", L"application/vnd.ms-excel.attachedToolbars");
|
||||
}
|
||||
|
||||
if (theme_)
|
||||
{
|
||||
@ -356,7 +363,10 @@ void xl_files::add_vba_project()
|
||||
{
|
||||
bVbaProject = true;
|
||||
}
|
||||
|
||||
void xl_files::add_attachedToolbars()
|
||||
{
|
||||
bAttachedToolbars = true;
|
||||
}
|
||||
void xl_files::set_workbook(element_ptr Element)
|
||||
{
|
||||
workbook_ = Element;
|
||||
|
||||
@ -324,6 +324,7 @@ public:
|
||||
void add_query_table (simple_element_ptr element);
|
||||
void add_control_props (simple_element_ptr element);
|
||||
void add_vba_project ();
|
||||
void add_attachedToolbars();
|
||||
private:
|
||||
rels_files rels_files_;
|
||||
sheets_files sheets_files_;
|
||||
@ -347,6 +348,7 @@ private:
|
||||
element_ptr comments_;
|
||||
|
||||
bool bVbaProject;
|
||||
bool bAttachedToolbars;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -790,6 +790,7 @@ SOURCES += \
|
||||
../XlsFormat/Logic/MacroSheetSubstream.cpp \
|
||||
../XlsFormat/Logic/WorkbookStreamObject.cpp \
|
||||
../XlsFormat/Logic/WorksheetSubstream.cpp \
|
||||
../XlsFormat/Logic/CommonSubstream.cpp \
|
||||
../XlsFormat/Logic/SummaryInformationStream/Structures/CodePageOle.cpp \
|
||||
../XlsFormat/Logic/Biff_structures/SharedProperty.cpp \
|
||||
../XlsFormat/Logic/Biff_records/FrtWrapper.cpp \
|
||||
@ -1622,6 +1623,7 @@ HEADERS += \
|
||||
../XlsFormat/Logic/MacroSheetSubstream.h \
|
||||
../XlsFormat/Logic/WorkbookStreamObject.h \
|
||||
../XlsFormat/Logic/WorksheetSubstream.h \
|
||||
../XlsFormat/Logic/CommonSubstream.h \
|
||||
../XlsFormat/Logic/XlsElementsType.h \
|
||||
../XlsXlsxConverter/ShapeType.h \
|
||||
../XlsFormat/Auxiliary/HelpFunc.h \
|
||||
|
||||
@ -771,6 +771,7 @@
|
||||
#include "../XlsFormat/Logic/MacroSheetSubstream.cpp"
|
||||
#include "../XlsFormat/Logic/WorkbookStreamObject.cpp"
|
||||
#include "../XlsFormat/Logic/WorksheetSubstream.cpp"
|
||||
#include "../XlsFormat/Logic/CommonSubstream.cpp"
|
||||
|
||||
#include "../XlsFormat/Logic/Biff_unions/IMDATAOBJECT.cpp"
|
||||
#include "../XlsFormat/Logic/Biff_records/IMDATA.cpp"
|
||||
|
||||
@ -374,6 +374,14 @@
|
||||
RelativePath="..\XlsFormat\Logic\ChartSheetSubstream.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Logic\CommonSubstream.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Logic\CommonSubstream.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsFormat\Logic\CompositeObject.cpp"
|
||||
>
|
||||
|
||||
@ -410,7 +410,7 @@ private:
|
||||
}
|
||||
|
||||
if (carry > 0)
|
||||
temp.insert(0, 1, (carry+'0'));
|
||||
temp.insert(0, 1, (char)(carry+'0'));
|
||||
|
||||
temp.append((n1.length() - i - 1), '0'); // as like mult by 10, 100, 1000, 10000 and so on
|
||||
|
||||
|
||||
@ -4177,6 +4177,14 @@ namespace NExtractTools
|
||||
{
|
||||
result = fromMscrypt (sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||
}break;
|
||||
case TCD_MSCRYPT2_RAW:
|
||||
{
|
||||
result = mscrypt2oox(sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||
}break;
|
||||
case TCD_2MSCRYPT_RAW:
|
||||
{
|
||||
result = oox2mscrypt(sFileFrom, sFileTo, sTempDir, oInputParams);
|
||||
}break;
|
||||
case TCD_MSCRYPT2DOCT:
|
||||
case TCD_MSCRYPT2XLST:
|
||||
case TCD_MSCRYPT2PPTT:
|
||||
|
||||
@ -165,6 +165,10 @@ namespace NExtractTools
|
||||
TCD_MSCRYPT2XLST,
|
||||
TCD_MSCRYPT2PPTT,
|
||||
TCD_MSCRYPT2BIN,
|
||||
|
||||
TCD_MSCRYPT2_RAW,
|
||||
TCD_2MSCRYPT_RAW,
|
||||
|
||||
//
|
||||
TCD_HTML2DOCX,
|
||||
TCD_HTML2DOCT,
|
||||
|
||||
Reference in New Issue
Block a user