mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
13 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| c046776b9c | |||
| 055a02570b | |||
| 1e2e5996f3 | |||
| 875717acd4 | |||
| 033feeaf9d | |||
| de336e5f96 | |||
| 82b3dbdae6 | |||
| d1227f7759 | |||
| 4d134387f9 | |||
| 3f8600dfb7 | |||
| 511f043d63 | |||
| 69a41343c2 | |||
| 578327bab6 |
@ -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);
|
||||
|
||||
@ -513,7 +513,23 @@ const std::wstring tab2sheet_name(const short tabid, std::vector<std::wstring>&
|
||||
}
|
||||
return L"#REF";
|
||||
}
|
||||
|
||||
const std::wstring name2sheet_name(std::wstring name, const std::wstring prefix)
|
||||
{
|
||||
static boost::wregex correct_sheet_name(L"^\\'.+?\\'$");
|
||||
static boost::wregex test_sheet_name(L"[\\s)(\\'&:-]+"); //.??? 6442946.xls
|
||||
|
||||
std::wstring sheet_first = prefix + name;
|
||||
|
||||
if(!boost::regex_search(sheet_first.begin(), sheet_first.end(), correct_sheet_name))
|
||||
{
|
||||
if(boost::regex_search(sheet_first.begin(), sheet_first.end(), test_sheet_name))
|
||||
{
|
||||
sheet_first = boost::algorithm::replace_all_copy(sheet_first, L"'", L"''");
|
||||
sheet_first = std::wstring(L"'") + sheet_first + std::wstring(L"'");
|
||||
}
|
||||
}
|
||||
return sheet_first;
|
||||
}
|
||||
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix)
|
||||
{
|
||||
if(-1 == tabFirst)
|
||||
@ -538,7 +554,7 @@ const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabL
|
||||
std::wstring sheet_last;
|
||||
if (tabLast != tabFirst)
|
||||
{
|
||||
sheet_last = prefix + tab2sheet_name(tabLast, names);
|
||||
sheet_last = std::wstring(L":") + prefix + tab2sheet_name(tabLast, names);
|
||||
|
||||
if(!boost::regex_search(sheet_last.begin(), sheet_last.end(), correct_sheet_name))
|
||||
{
|
||||
@ -548,7 +564,6 @@ const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabL
|
||||
sheet_last = std::wstring(L"\'") + sheet_last + std::wstring(L"\'");
|
||||
}
|
||||
}
|
||||
sheet_last = std::wstring(L":") + sheet_last;
|
||||
}
|
||||
|
||||
return sheet_first + sheet_last;
|
||||
|
||||
@ -95,6 +95,7 @@ namespace STR
|
||||
namespace XMLSTUFF
|
||||
{;
|
||||
|
||||
const std::wstring name2sheet_name(std::wstring name, const std::wstring prefix);
|
||||
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix = L"");
|
||||
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -70,7 +70,7 @@ const bool BiffRecord::read(CFStreamCacheReader& reader, BaseObject* parent, con
|
||||
size_t rdPtr = record->getRdPtr();
|
||||
size_t typeId = getTypeId();
|
||||
|
||||
if(record->getDataSize() != record->getRdPtr() && getTypeId() != rt_ANY_TYPE && getTypeId() != rt_MsoDrawing)
|
||||
if(record->getDataSize() != record->getRdPtr() && getTypeId() != rt_ANY_TYPE/* && getTypeId() != rt_MsoDrawing*/)
|
||||
{
|
||||
Log::warning(STR::int2str(record->getDataSize() - record->getRdPtr(), 10) + " unsigned chars were not processed while reading from " + record->getTypeString());
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ void BoundSheet8::readFields(CFRecord& record)
|
||||
hsState = std::wstring (L"hidden");
|
||||
break;
|
||||
case 2:
|
||||
hsState = std::wstring (L"hidden");//(L"veryHidden");
|
||||
hsState = std::wstring (L"veryHidden");
|
||||
break;
|
||||
}
|
||||
if (name_.length() > 31)
|
||||
@ -91,9 +91,11 @@ void BoundSheet8::readFields(CFRecord& record)
|
||||
{//file(6).xls
|
||||
name_ = L"Sheet_" + boost::lexical_cast<std::wstring>(record.getGlobalWorkbookInfo()->current_sheet + 1);
|
||||
}
|
||||
|
||||
record.getGlobalWorkbookInfo()->sheets_names.push_back(name_);
|
||||
record.getGlobalWorkbookInfo()->sheets_state.push_back(hsState);
|
||||
|
||||
GlobalWorkbookInfo::_sheet_info sheet_info;
|
||||
sheet_info.state = hsState;
|
||||
sheet_info.name = name_;
|
||||
record.getGlobalWorkbookInfo()->sheets_info.push_back(sheet_info);
|
||||
|
||||
dt = GETBITS(flags, 8, 15);
|
||||
}
|
||||
|
||||
@ -122,9 +122,9 @@ void DConRef::check_external()
|
||||
{
|
||||
bool bFound = false;
|
||||
|
||||
for (size_t i = 0; !bFilePath && i < global_info_->sheets_names.size(); i++)
|
||||
for (size_t i = 0; !bFilePath && i < global_info_->sheets_info.size(); i++)
|
||||
{
|
||||
if (global_info_->sheets_names[i] == sheet_name)
|
||||
if (global_info_->sheets_info[i].name == sheet_name)
|
||||
{
|
||||
bFound = true;
|
||||
break;
|
||||
|
||||
@ -55,9 +55,9 @@ void DefColWidth::readFields(CFRecord& record)
|
||||
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
|
||||
record >> cchdefColWidth;
|
||||
|
||||
if (!global_info->sheet_size_info.empty())
|
||||
if (!global_info->sheets_info.empty())
|
||||
{
|
||||
global_info->sheet_size_info.back().defaultColumnWidth = cchdefColWidth ;
|
||||
global_info->sheets_info.back().defaultColumnWidth = cchdefColWidth ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,9 +65,9 @@ void DefaultRowHeight::readFields(CFRecord& record)
|
||||
|
||||
record >> miyRw;
|
||||
|
||||
if (!global_info->sheet_size_info.empty())
|
||||
if (!global_info->sheets_info.empty())
|
||||
{
|
||||
global_info->sheet_size_info.back().defaultRowHeight = miyRw / 20.;
|
||||
global_info->sheets_info.back().defaultRowHeight = miyRw / 20.;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -35,17 +35,14 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
WsBool::WsBool(const bool is_dialog_sheet)
|
||||
: fDialog(is_dialog_sheet)
|
||||
WsBool::WsBool(bool & is_dialog_sheet) : fDialog(is_dialog_sheet)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WsBool::~WsBool()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr WsBool::clone()
|
||||
{
|
||||
return BaseObjectPtr(new WsBool(*this));
|
||||
@ -56,16 +53,17 @@ void WsBool::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short flags;
|
||||
record >> flags;
|
||||
|
||||
fShowAutoBreaks = GETBIT(flags, 0);
|
||||
fDialog = GETBIT(flags, 4);
|
||||
fApplyStyles = GETBIT(flags, 5);
|
||||
fRowSumsBelow = GETBIT(flags, 6);
|
||||
fColSumsRight = GETBIT(flags, 7);
|
||||
fFitToPage = GETBIT(flags, 8);
|
||||
fDspGuts = GETBIT(flags, 10);
|
||||
fSyncHoriz = GETBIT(flags, 12);
|
||||
fSyncVert = GETBIT(flags, 13);
|
||||
fAltExprEval = GETBIT(flags, 14);
|
||||
fDialog = GETBIT(flags, 4);
|
||||
fApplyStyles = GETBIT(flags, 5);
|
||||
fRowSumsBelow = GETBIT(flags, 6);
|
||||
fColSumsRight = GETBIT(flags, 7);
|
||||
fFitToPage = GETBIT(flags, 8);
|
||||
fDspGuts = GETBIT(flags, 10);
|
||||
fSyncHoriz = GETBIT(flags, 12);
|
||||
fSyncVert = GETBIT(flags, 13);
|
||||
fAltExprEval = GETBIT(flags, 14);
|
||||
fAltFormulaEntry = GETBIT(flags, 15);
|
||||
}
|
||||
|
||||
|
||||
@ -36,14 +36,12 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of WsBool record in BIFF8
|
||||
class WsBool: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(WsBool)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(WsBool)
|
||||
public:
|
||||
WsBool(const bool is_dialog_sheet);
|
||||
WsBool(bool & is_dialog_sheet);
|
||||
~WsBool();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
@ -53,17 +51,17 @@ public:
|
||||
static const ElementType type = typeWsBool;
|
||||
|
||||
//-----------------------------
|
||||
bool fShowAutoBreaks;
|
||||
bool fDialog;
|
||||
bool fApplyStyles;
|
||||
bool fRowSumsBelow;
|
||||
bool fColSumsRight;
|
||||
bool fFitToPage;
|
||||
bool fDspGuts;
|
||||
bool fSyncHoriz;
|
||||
bool fSyncVert;
|
||||
bool fAltExprEval;
|
||||
bool fAltFormulaEntry;
|
||||
bool fShowAutoBreaks;
|
||||
bool& fDialog;
|
||||
bool fApplyStyles;
|
||||
bool fRowSumsBelow;
|
||||
bool fColSumsRight;
|
||||
bool fFitToPage;
|
||||
bool fDspGuts;
|
||||
bool fSyncHoriz;
|
||||
bool fSyncVert;
|
||||
bool fAltExprEval;
|
||||
bool fAltFormulaEntry;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -88,9 +88,9 @@ void NoteSh::load(CFRecord& record)
|
||||
//-----------------------------------------------------------------------
|
||||
void NoteSh::calculate()
|
||||
{
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheets_info[global_info->current_sheet - 1] : zero;
|
||||
|
||||
ref_ = CellRef(row, col, true, true).toString();
|
||||
|
||||
|
||||
@ -40,8 +40,7 @@ namespace ODRAW
|
||||
{
|
||||
|
||||
|
||||
OfficeArtClientAnchorSheet::OfficeArtClientAnchorSheet()
|
||||
: OfficeArtRecord(0x00, ClientAnchor)
|
||||
OfficeArtClientAnchorSheet::OfficeArtClientAnchorSheet() : OfficeArtRecord(0x00, ClientAnchor)
|
||||
{
|
||||
_x = _y = _cx = _cy = 0;
|
||||
}
|
||||
@ -79,9 +78,9 @@ void OfficeArtClientAnchorSheet::calculate()
|
||||
{
|
||||
global_info->GetDigitFontSizePixels();
|
||||
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheets_info[global_info->current_sheet - 1] : zero;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
//1 inch = 72 point
|
||||
@ -134,9 +133,9 @@ void OfficeArtClientAnchorSheet::calculate_1()
|
||||
{
|
||||
global_info->GetDigitFontSizePixels();
|
||||
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheet_size_info[global_info->current_sheet - 1] : zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info & sheet_info = global_info->current_sheet >= 0 ?
|
||||
global_info->sheets_info[global_info->current_sheet - 1] : zero;
|
||||
|
||||
double kfRow = ( 360000 * 2.54 / 72) / 256. ;
|
||||
double Digit_Width = global_info->defaultDigitFontSize.first;
|
||||
|
||||
@ -36,8 +36,7 @@
|
||||
namespace ODRAW
|
||||
{
|
||||
|
||||
OfficeArtDgContainer::OfficeArtDgContainer(const OfficeArtClientAnchorType anchor_type)
|
||||
: OfficeArtContainer(0x0F, DgContainer, anchor_type)
|
||||
OfficeArtDgContainer::OfficeArtDgContainer(const OfficeArtClientAnchorType anchor_type) : OfficeArtContainer(0x0F, DgContainer, anchor_type)
|
||||
{
|
||||
}
|
||||
|
||||
@ -73,6 +72,14 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
|
||||
{
|
||||
try
|
||||
{
|
||||
OfficeArtRecordHeader rh_test;
|
||||
record >> rh_test;
|
||||
record.RollRdPtrBack(8);//sizeof(OfficeArtRecordHeader)
|
||||
|
||||
if ((rh_test.recType & 0xF000) != 0xF000)
|
||||
{
|
||||
return;
|
||||
}
|
||||
OfficeArtContainer::loadFields(record);
|
||||
}catch(...)
|
||||
{
|
||||
|
||||
@ -41,8 +41,7 @@ namespace XLS
|
||||
{
|
||||
|
||||
|
||||
PtgArea3d::PtgArea3d(const CellRef& cell_base_ref_init)
|
||||
: cell_base_ref(cell_base_ref_init)
|
||||
PtgArea3d::PtgArea3d(const CellRef& cell_base_ref_init) : cell_base_ref(cell_base_ref_init)
|
||||
{
|
||||
}
|
||||
|
||||
@ -114,10 +113,22 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
|
||||
ixti = ixals;
|
||||
if (ixals == 0xffff)
|
||||
{
|
||||
std::wstring prefix = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, global_info->sheets_names);
|
||||
if (!prefix.empty()) prefix += L"!";
|
||||
std::wstring strRange;
|
||||
if(-1 == itabFirst)
|
||||
{
|
||||
strRange = L"#REF";
|
||||
}
|
||||
else
|
||||
{
|
||||
strRange = XMLSTUFF::name2sheet_name(global_info->sheets_info[itabFirst].name, L"");
|
||||
if (itabFirst != itabLast)
|
||||
{
|
||||
strRange += std::wstring(L":") + XMLSTUFF::name2sheet_name(global_info->sheets_info[itabLast].name, L"");
|
||||
}
|
||||
}
|
||||
if (!strRange.empty()) strRange += L"!";
|
||||
|
||||
ptg_stack.push(prefix + range_ref);
|
||||
ptg_stack.push(strRange + range_ref);
|
||||
}
|
||||
}
|
||||
if (ixti != 0xffff)
|
||||
@ -125,8 +136,13 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
|
||||
std::wstring link = global_info->arXti[ixti].link;
|
||||
if (!link.empty() && !range_ref.empty())
|
||||
link += L"!";
|
||||
|
||||
if (full_ref && link.empty()) //4673306.xls defined name "Категория"
|
||||
{
|
||||
link = L"#REF!";
|
||||
}
|
||||
|
||||
ptg_stack.push(link + range_ref); // full_ref ???
|
||||
ptg_stack.push(link + range_ref);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,9 +42,7 @@ PtgErr::PtgErr()
|
||||
}
|
||||
|
||||
|
||||
PtgErr::PtgErr(const std::wstring str)
|
||||
: err(str),
|
||||
OperandPtg(fixed_id)
|
||||
PtgErr::PtgErr(const std::wstring str) : err(str), OperandPtg(fixed_id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -41,8 +41,7 @@ namespace XLS
|
||||
{
|
||||
|
||||
|
||||
PtgRef3d::PtgRef3d(const CellRef& cell_base_ref_init)
|
||||
: cell_base_ref(cell_base_ref_init)
|
||||
PtgRef3d::PtgRef3d(const CellRef& cell_base_ref_init) : cell_base_ref(cell_base_ref_init)
|
||||
{
|
||||
}
|
||||
|
||||
@ -109,10 +108,22 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
|
||||
ixti = ixals;
|
||||
if (ixals == 0xffff)
|
||||
{
|
||||
std::wstring prefix = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, global_info->sheets_names);
|
||||
if (!prefix.empty()) prefix += L"!";
|
||||
std::wstring strRange;
|
||||
if(-1 == itabFirst)
|
||||
{
|
||||
strRange = L"#REF";
|
||||
}
|
||||
else
|
||||
{
|
||||
strRange = XMLSTUFF::name2sheet_name(global_info->sheets_info[itabFirst].name, L"");
|
||||
if (itabFirst != itabLast)
|
||||
{
|
||||
strRange += std::wstring(L":") + XMLSTUFF::name2sheet_name(global_info->sheets_info[itabLast].name, L"");
|
||||
}
|
||||
}
|
||||
if (!strRange.empty()) strRange += L"!";
|
||||
|
||||
ptg_stack.push(prefix + cell_ref);
|
||||
ptg_stack.push(strRange + cell_ref);
|
||||
}
|
||||
}
|
||||
if (ixti != 0xffff)
|
||||
@ -121,7 +132,11 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
|
||||
if (!link.empty() && !cell_ref.empty())
|
||||
link += L"!";
|
||||
|
||||
ptg_stack.push(link + cell_ref); // full_ref ???
|
||||
if (full_ref && link.empty()) //Stock symbols comparison1.xls defined name "check_phrase"
|
||||
{
|
||||
link = L"#REF!";
|
||||
}
|
||||
ptg_stack.push(link + cell_ref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -145,6 +145,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
|
||||
if (it == pGlobalWorkbookInfoPtr->mapDefineNames.end()) return 0;
|
||||
|
||||
int count_columns = info->cEntries;
|
||||
|
||||
size_t ind = pGlobalWorkbookInfoPtr->current_sheet;
|
||||
std::wstring ref;
|
||||
|
||||
@ -159,7 +160,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
|
||||
}
|
||||
if (ref.empty()) return 0;
|
||||
|
||||
std::wstring sheet_name = ind <= pGlobalWorkbookInfoPtr->sheets_names.size() ? pGlobalWorkbookInfoPtr->sheets_names[ind-1] : L"";
|
||||
std::wstring sheet_name = ind <= pGlobalWorkbookInfoPtr->sheets_info.size() ? pGlobalWorkbookInfoPtr->sheets_info[ind-1].name : L"";
|
||||
if (!sheet_name.empty())
|
||||
{
|
||||
int pos = ref.find(sheet_name);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -61,9 +61,9 @@ public:
|
||||
{
|
||||
global_info_ = proc.getGlobalWorkbookInfo();
|
||||
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info_->current_sheet >=0 ?
|
||||
global_info_->sheet_size_info[global_info_->current_sheet - 1] : zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info & sheet_info = global_info_->current_sheet >=0 ?
|
||||
global_info_->sheets_info[global_info_->current_sheet - 1] : zero;
|
||||
|
||||
int count, count_row = 0;
|
||||
|
||||
@ -175,9 +175,9 @@ struct _CompareColumnCell
|
||||
|
||||
int CELL_GROUP::serialize(std::wostream & stream)
|
||||
{
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_size_info & sheet_info = global_info_->current_sheet >=0 ?
|
||||
global_info_->sheet_size_info[global_info_->current_sheet - 1] : zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info zero;
|
||||
XLS::GlobalWorkbookInfo::_sheet_info & sheet_info = global_info_->current_sheet >=0 ?
|
||||
global_info_->sheets_info[global_info_->current_sheet - 1] : zero;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
|
||||
@ -56,7 +56,8 @@ const bool CHART::loadContent(BinProcessor& proc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(!proc.mandatory<ChartSheetSubstream>())
|
||||
ChartSheetSubstream chart_sheet(-1);
|
||||
if(!proc.mandatory(chart_sheet))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -77,10 +77,10 @@ const bool COLUMNS::loadContent(BinProcessor& proc)
|
||||
|
||||
for (int i = column_info->colFirst; i <= column_info->colLast; i++)
|
||||
{
|
||||
global_info_->sheet_size_info.back().customColumnsWidth.insert(std::make_pair(i, column_info->coldx / 256.));
|
||||
global_info_->sheets_info[global_info_->current_sheet - 1].customColumnsWidth.insert(std::make_pair(i, column_info->coldx / 256.));
|
||||
//else if (def_ok)
|
||||
//{
|
||||
// global_info_->sheet_size_info.back().customColumnsWidth.insert(std::make_pair(i, global_info_->sheet_size_info.back().defaultColumnWidth));
|
||||
// global_info_->sheets_info.back().customColumnsWidth.insert(std::make_pair(i, global_info_->sheets_info.back().defaultColumnWidth));
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@ -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,34 +31,33 @@
|
||||
*/
|
||||
|
||||
#include "GLOBALS.h"
|
||||
#include <Logic/Biff_records/DefColWidth.h>
|
||||
#include <Logic/Biff_records/DxGCol.h>
|
||||
|
||||
#include <Logic/Biff_records/Protect.h>
|
||||
#include <Logic/Biff_records/CalcMode.h>
|
||||
#include <Logic/Biff_records/CalcCount.h>
|
||||
#include <Logic/Biff_records/CalcRefMode.h>
|
||||
#include <Logic/Biff_records/CalcIter.h>
|
||||
#include <Logic/Biff_records/CalcDelta.h>
|
||||
#include <Logic/Biff_records/CalcSaveRecalc.h>
|
||||
#include <Logic/Biff_records/PrintRowCol.h>
|
||||
#include <Logic/Biff_records/PrintGrid.h>
|
||||
#include <Logic/Biff_records/GridSet.h>
|
||||
#include <Logic/Biff_records/Guts.h>
|
||||
#include <Logic/Biff_records/DefaultRowHeight.h>
|
||||
#include <Logic/Biff_records/WsBool.h>
|
||||
#include <Logic/Biff_records/Sync.h>
|
||||
#include <Logic/Biff_records/LPr.h>
|
||||
#include <Logic/Biff_records/HorizontalPageBreaks.h>
|
||||
#include <Logic/Biff_records/VerticalPageBreaks.h>
|
||||
#include <Logic/Biff_records/Country.h>
|
||||
#include "../Biff_records/DefColWidth.h"
|
||||
#include "../Biff_records/DxGCol.h"
|
||||
#include "../Biff_records/Protect.h"
|
||||
#include "../Biff_records/CalcMode.h"
|
||||
#include "../Biff_records/CalcCount.h"
|
||||
#include "../Biff_records/CalcRefMode.h"
|
||||
#include "../Biff_records/CalcIter.h"
|
||||
#include "../Biff_records/CalcDelta.h"
|
||||
#include "../Biff_records/CalcSaveRecalc.h"
|
||||
#include "../Biff_records/PrintRowCol.h"
|
||||
#include "../Biff_records/PrintGrid.h"
|
||||
#include "../Biff_records/GridSet.h"
|
||||
#include "../Biff_records/Guts.h"
|
||||
#include "../Biff_records/DefaultRowHeight.h"
|
||||
#include "../Biff_records/WsBool.h"
|
||||
#include "../Biff_records/Sync.h"
|
||||
#include "../Biff_records/LPr.h"
|
||||
#include "../Biff_records/HorizontalPageBreaks.h"
|
||||
#include "../Biff_records/VerticalPageBreaks.h"
|
||||
#include "../Biff_records/Country.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
GLOBALS::GLOBALS(const bool is_dialog_sheet)
|
||||
: is_dialog(is_dialog_sheet)
|
||||
GLOBALS::GLOBALS() : is_dialog(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -40,12 +40,12 @@ class GLOBALS: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(GLOBALS)
|
||||
public:
|
||||
GLOBALS(const bool is_dialog_sheet);
|
||||
GLOBALS();
|
||||
~GLOBALS();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
virtual const bool loadContent (BinProcessor& proc);
|
||||
virtual const bool loadContent (BinProcessor& proc);
|
||||
|
||||
static const ElementType type = typeGLOBALS;
|
||||
|
||||
|
||||
@ -96,21 +96,21 @@ const bool METADATA::loadContent(BinProcessor& proc)
|
||||
int count2 = proc.repeated<MDXSTR>(0, 0);
|
||||
while(!elements_.empty())
|
||||
{
|
||||
m_arMDXSTR.insert(m_arMDTINFO.begin(), elements_.back());
|
||||
m_arMDXSTR.insert(m_arMDXSTR.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
int count3 = proc.repeated<Parenthesis_METADATA_1>(0, 0);
|
||||
while(!elements_.empty())
|
||||
{
|
||||
m_arMDTSET.insert(m_arMDTINFO.begin(), elements_.back());
|
||||
m_arMDTSET.insert(m_arMDTSET.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
int count4 = proc.repeated<MDBLOCK>(0, 0);
|
||||
while(!elements_.empty())
|
||||
{
|
||||
m_arMDBLOCK.insert(m_arMDTINFO.begin(), elements_.back());
|
||||
m_arMDBLOCK.insert(m_arMDBLOCK.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (count1 > 0 || count2 > 0 || count3 > 0 || count4 > 0)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -68,7 +68,7 @@ const bool XFS::loadContent(BinProcessor& proc)
|
||||
int cellXfs_count = 0;
|
||||
|
||||
XF xf(cell_xf_current_id, style_xf_current_id);
|
||||
int count = proc.repeated(xf ,16, 0);
|
||||
int count = proc.repeated(xf , 0/*16*/, 0); // "Stock symbols comparison1.xls" (второй FORMATING)
|
||||
|
||||
int ind = 0;
|
||||
while (count > 0 && elements_.size() > 0)
|
||||
|
||||
@ -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()
|
||||
ChartSheetSubstream::ChartSheetSubstream(const size_t ws_index) : CommonSubstream(ws_index)
|
||||
{
|
||||
}
|
||||
|
||||
@ -126,7 +126,8 @@ CHARTSHEETCONTENT = [WriteProtect] [SheetExt] [WebPub] *HFPicture PAGESETUP Prin
|
||||
*/
|
||||
const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
{
|
||||
pGlobalWorkbookInfo = proc.getGlobalWorkbookInfo();
|
||||
global_info_ = proc.getGlobalWorkbookInfo();
|
||||
global_info_->current_sheet = ws_index_ + 1;
|
||||
|
||||
int count = 0 ;
|
||||
|
||||
@ -150,7 +151,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 +168,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 +243,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 +292,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 +358,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 +374,8 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
LoadHFPicture();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -507,7 +563,7 @@ int ChartSheetSubstream::serialize(std::wostream & _stream)
|
||||
|
||||
if (chart_rect)
|
||||
{
|
||||
pGlobalWorkbookInfo->xls_converter->xlsx_context->get_drawing_context().set_absolute_anchor(
|
||||
global_info_->xls_converter->xlsx_context->get_drawing_context().set_absolute_anchor(
|
||||
0, 0, chart_rect->dx.dVal, chart_rect->dy.dVal);
|
||||
|
||||
}
|
||||
|
||||
@ -31,7 +31,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Logic/CompositeObject.h>
|
||||
#include "CommonSubstream.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace XLS
|
||||
@ -44,12 +45,11 @@ class CRT;
|
||||
class ChartSheetSubstream;
|
||||
typedef boost::shared_ptr<ChartSheetSubstream> ChartSheetSubstreamPtr;
|
||||
|
||||
// Logical representation of ChartSheetSubstream union of records
|
||||
class ChartSheetSubstream: public CompositeObject
|
||||
class ChartSheetSubstream: public CompositeObject, public CommonSubstream
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(ChartSheetSubstream)
|
||||
public:
|
||||
ChartSheetSubstream();
|
||||
ChartSheetSubstream(const size_t ws_index);
|
||||
~ChartSheetSubstream();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
@ -69,29 +69,23 @@ public:
|
||||
|
||||
static const ElementType type = typeChartSheetSubstream;
|
||||
|
||||
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);
|
||||
void recalc(SERIESDATA* data);
|
||||
|
||||
std::unordered_map<int, std::vector<int>> m_mapTypeChart;
|
||||
|
||||
GlobalWorkbookInfoPtr pGlobalWorkbookInfo;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
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
|
||||
|
||||
@ -221,8 +221,8 @@ void GlobalWorkbookInfo::GetDigitFontSizePixels()
|
||||
|
||||
void GlobalWorkbookInfo::CalculateAnchor(int colL, int colR, int rwT, int rwB, _UINT32 & x, _UINT32 &y, _UINT32 &cx, _UINT32 & cy)
|
||||
{
|
||||
_sheet_size_info zero;
|
||||
_sheet_size_info & sheet_info = current_sheet >= 0 ? sheet_size_info[current_sheet - 1] : zero;
|
||||
_sheet_info zero;
|
||||
_sheet_info & sheet_info = current_sheet >= 0 ? sheets_info[current_sheet - 1] : zero;
|
||||
|
||||
GetDigitFontSizePixels();
|
||||
|
||||
|
||||
@ -89,9 +89,6 @@ public:
|
||||
CRYPT::DecryptorPtr decryptor;
|
||||
std::wstring password;
|
||||
|
||||
std::vector<std::wstring> sheets_state;
|
||||
std::vector<std::wstring> sheets_names;
|
||||
|
||||
boost::unordered_map<BorderInfo, int> border_x_ids;
|
||||
boost::unordered_map<FillInfo, int> fill_x_ids;
|
||||
|
||||
@ -141,18 +138,18 @@ public:
|
||||
unsigned int startAddedSharedStrings;
|
||||
std::vector<std::wstring> arAddedSharedStrings;
|
||||
|
||||
|
||||
struct _sheet_size_info
|
||||
struct _sheet_info
|
||||
{
|
||||
std::wstring state;
|
||||
std::wstring name;
|
||||
|
||||
std::map<int, double> customColumnsWidth;
|
||||
std::map<int, double> customRowsHeight;
|
||||
|
||||
double defaultColumnWidth = 8.0;
|
||||
double defaultRowHeight = 14.4;
|
||||
|
||||
bool bMacrosSheet = false;
|
||||
};
|
||||
std::vector<_sheet_size_info> sheet_size_info;
|
||||
std::vector<_sheet_info> sheets_info;
|
||||
|
||||
std::pair<float, float> defaultDigitFontSize;
|
||||
CApplicationFonts *applicationFonts;
|
||||
|
||||
@ -140,8 +140,7 @@ static const int aCodePages[][2] = {
|
||||
255, 850//OEM
|
||||
};
|
||||
|
||||
GlobalsSubstream::GlobalsSubstream(const unsigned short code_page)
|
||||
: code_page_(code_page)
|
||||
GlobalsSubstream::GlobalsSubstream(const unsigned short code_page) : code_page_(code_page)
|
||||
{
|
||||
}
|
||||
|
||||
@ -653,7 +652,20 @@ void GlobalsSubstream::UpdateXti()
|
||||
{
|
||||
if (info->rgst.empty() && index_book->nExternIndex < 0)
|
||||
{
|
||||
val.link = XMLSTUFF::xti_indexes2sheet_name(xti->itabFirst, xti->itabLast, global_info_->sheets_names);
|
||||
std::wstring strRange;
|
||||
if(-1 == xti->itabFirst)
|
||||
{
|
||||
strRange = L"#REF";
|
||||
}
|
||||
else
|
||||
{
|
||||
strRange = XMLSTUFF::name2sheet_name(global_info_->sheets_info[xti->itabFirst].name, L"");
|
||||
if (xti->itabFirst != xti->itabLast)
|
||||
{
|
||||
strRange += std::wstring(L":") + XMLSTUFF::name2sheet_name(global_info_->sheets_info[xti->itabLast].name, L"");
|
||||
}
|
||||
}
|
||||
val.link = strRange;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -31,42 +31,43 @@
|
||||
*/
|
||||
|
||||
#include "MacroSheetSubstream.h"
|
||||
#include <Logic/Biff_records/BOF.h>
|
||||
#include <Logic/Biff_records/Uncalced.h>
|
||||
#include <Logic/Biff_records/Index.h>
|
||||
#include <Logic/Biff_records/Intl.h>
|
||||
#include <Logic/Biff_records/HeaderFooter.h>
|
||||
#include <Logic/Biff_records/Dimensions.h>
|
||||
#include <Logic/Biff_records/HFPicture.h>
|
||||
#include <Logic/Biff_records/Note.h>
|
||||
#include <Logic/Biff_records/DxGCol.h>
|
||||
#include <Logic/Biff_records/CodeName.h>
|
||||
#include <Logic/Biff_records/CellWatch.h>
|
||||
#include <Logic/Biff_records/SheetExt.h>
|
||||
#include <Logic/Biff_records/EOF.h>
|
||||
|
||||
#include <Logic/Biff_unions/MACROSORTANDFILTER.h>
|
||||
#include <Logic/Biff_unions/GLOBALS.h>
|
||||
#include <Logic/Biff_unions/PAGESETUP.h>
|
||||
#include <Logic/Biff_unions/BACKGROUND.h>
|
||||
#include <Logic/Biff_unions/BIGNAME.h>
|
||||
#include <Logic/Biff_unions/PROTECTION_COMMON.h>
|
||||
#include <Logic/Biff_unions/COLUMNS.h>
|
||||
#include <Logic/Biff_unions/CELLTABLE.h>
|
||||
#include <Logic/Biff_unions/OBJECTS.h>
|
||||
#include <Logic/Biff_unions/DCON.h>
|
||||
#include <Logic/Biff_unions/WINDOW.h>
|
||||
#include <Logic/Biff_unions/CUSTOMVIEW.h>
|
||||
#include <Logic/Biff_unions/SORT.h>
|
||||
#include <Logic/Biff_unions/PHONETICINFO.h>
|
||||
#include <Logic/Biff_unions/FEAT.h>
|
||||
#include <Logic/Biff_unions/RECORD12.h>
|
||||
#include "Biff_records/BOF.h"
|
||||
#include "Biff_records/Uncalced.h"
|
||||
#include "Biff_records/Index.h"
|
||||
#include "Biff_records/Intl.h"
|
||||
#include "Biff_records/HeaderFooter.h"
|
||||
#include "Biff_records/Dimensions.h"
|
||||
#include "Biff_records/HFPicture.h"
|
||||
#include "Biff_records/Note.h"
|
||||
#include "Biff_records/DxGCol.h"
|
||||
#include "Biff_records/CodeName.h"
|
||||
#include "Biff_records/CellWatch.h"
|
||||
#include "Biff_records/SheetExt.h"
|
||||
#include "Biff_records/EOF.h"
|
||||
|
||||
#include "Biff_unions/MACROSORTANDFILTER.h"
|
||||
#include "Biff_unions/GLOBALS.h"
|
||||
#include "Biff_unions/PAGESETUP.h"
|
||||
#include "Biff_unions/BACKGROUND.h"
|
||||
#include "Biff_unions/BIGNAME.h"
|
||||
#include "Biff_unions/PROTECTION_COMMON.h"
|
||||
#include "Biff_unions/COLUMNS.h"
|
||||
#include "Biff_unions/CELLTABLE.h"
|
||||
#include "Biff_unions/OBJECTS.h"
|
||||
#include "Biff_unions/DCON.h"
|
||||
#include "Biff_unions/WINDOW.h"
|
||||
#include "Biff_unions/CUSTOMVIEW.h"
|
||||
#include "Biff_unions/SORT.h"
|
||||
#include "Biff_unions/PHONETICINFO.h"
|
||||
#include "Biff_unions/FEAT.h"
|
||||
#include "Biff_unions/RECORD12.h"
|
||||
|
||||
namespace XLS
|
||||
{;
|
||||
|
||||
|
||||
MacroSheetSubstream::MacroSheetSubstream()
|
||||
MacroSheetSubstream::MacroSheetSubstream(const size_t ws_index) : CommonSubstream(ws_index)
|
||||
{
|
||||
}
|
||||
|
||||
@ -97,39 +98,63 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
|
||||
return false;
|
||||
}
|
||||
global_info_ = proc.getGlobalWorkbookInfo();
|
||||
|
||||
GlobalWorkbookInfo::_sheet_size_info sheet_size_info;
|
||||
|
||||
global_info_->sheet_size_info.push_back(sheet_size_info);
|
||||
global_info_->current_sheet = global_info_->sheet_size_info.size();
|
||||
|
||||
global_info_->sheet_size_info.back().bMacrosSheet = true;
|
||||
global_info_->current_sheet = ws_index_ + 1;
|
||||
|
||||
proc.optional<Uncalced>();
|
||||
proc.mandatory<Index>();
|
||||
proc.optional<Intl>();
|
||||
|
||||
GLOBALS globals(false);
|
||||
if (proc.mandatory(globals)) // not dialog
|
||||
if (proc.mandatory<GLOBALS>())
|
||||
{
|
||||
m_GLOBALS = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
int count = 0;
|
||||
|
||||
proc.mandatory<PAGESETUP>();
|
||||
if (proc.mandatory<PAGESETUP>())
|
||||
{
|
||||
m_PAGESETUP = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
proc.optional<HeaderFooter>();
|
||||
proc.optional<BACKGROUND>();
|
||||
proc.repeated<BIGNAME>(0, 0);
|
||||
proc.optional<PROTECTION_COMMON>();
|
||||
proc.mandatory<COLUMNS>();
|
||||
|
||||
proc.mandatory<MACROSORTANDFILTER>();
|
||||
proc.mandatory<Dimensions>();
|
||||
|
||||
std::vector<CellRangeRef> shared_formulas_locations;
|
||||
CELLTABLE cell_table(shared_formulas_locations);
|
||||
proc.optional(cell_table);
|
||||
if (proc.optional<BACKGROUND>())
|
||||
{
|
||||
m_BACKGROUND = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
proc.repeated<BIGNAME>(0, 0);
|
||||
|
||||
if (proc.optional<PROTECTION_COMMON>())
|
||||
{
|
||||
m_PROTECTION = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
if (proc.mandatory<COLUMNS>())
|
||||
{
|
||||
m_COLUMNS = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
if (proc.mandatory<MACROSORTANDFILTER>())
|
||||
{
|
||||
m_MACROSORTANDFILTER = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (proc.mandatory<Dimensions>())
|
||||
{
|
||||
m_Dimensions = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
std::vector<CellRangeRef> shared_formulas_locations;
|
||||
CELLTABLE cell_table(shared_formulas_locations);
|
||||
if (proc.optional(cell_table))
|
||||
{
|
||||
m_CELLTABLE = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
OBJECTS objects(false);
|
||||
if (proc.mandatory(objects))
|
||||
@ -138,11 +163,34 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
proc.repeated<HFPicture>(0, 0);
|
||||
proc.repeated<Note>(0, 0);
|
||||
proc.optional<DCON>();
|
||||
proc.repeated<WINDOW>(1, 0);
|
||||
count = proc.repeated<HFPicture>(0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arHFPicture.insert(m_arHFPicture.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
|
||||
count = proc.repeated<Note>(0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arNote.insert(m_arNote.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
if (proc.optional<DCON>())
|
||||
{
|
||||
m_DCON = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
count = proc.repeated<WINDOW>(0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arWINDOW.insert(m_arWINDOW.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
count = proc.repeated<CUSTOMVIEW>(0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
@ -150,9 +198,24 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
proc.repeated<SORT>(0, 2);
|
||||
proc.optional<DxGCol>();
|
||||
count = proc.repeated<SORT>(0, 2);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arSORT.insert(m_arSORT.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
if (proc.optional<DxGCol>())
|
||||
{
|
||||
m_DxGCol = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
DxGCol* dx = dynamic_cast<DxGCol*>(m_DxGCol.get());
|
||||
global_info_->sheets_info.back().defaultColumnWidth = dx->dxgCol / 256.;
|
||||
}
|
||||
|
||||
proc.optional<PHONETICINFO>();
|
||||
|
||||
if (proc.optional<CodeName>())
|
||||
{
|
||||
m_CodeName = elements_.back();
|
||||
@ -164,10 +227,24 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
|
||||
m_SheetExt = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
proc.repeated<FEAT>(0, 0);
|
||||
proc.repeated<RECORD12>(0, 0);
|
||||
count = proc.repeated<FEAT> (0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arFEAT.insert(m_arFEAT.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
count = proc.repeated<RECORD12> (0, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arRECORD12.insert(m_arRECORD12.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
proc.mandatory<EOF_T>();
|
||||
|
||||
LoadHFPicture();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Logic/CompositeObject.h>
|
||||
#include "CommonSubstream.h"
|
||||
|
||||
namespace XLS
|
||||
{;
|
||||
@ -39,11 +39,11 @@ 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:
|
||||
MacroSheetSubstream();
|
||||
MacroSheetSubstream(const size_t ws_index);
|
||||
~MacroSheetSubstream();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
@ -52,16 +52,12 @@ public:
|
||||
|
||||
static const ElementType type = typeMacroSheetSubstream;
|
||||
|
||||
BaseObjectPtr m_GLOBALS;
|
||||
BaseObjectPtr m_OBJECTS;
|
||||
BaseObjectPtr m_DxGCol;
|
||||
BaseObjectPtr m_Dimensions;
|
||||
|
||||
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
|
||||
BaseObjectPtr m_MACROSORTANDFILTER;
|
||||
|
||||
BaseObjectPtr m_SheetExt;
|
||||
BaseObjectPtr m_CodeName;
|
||||
|
||||
GlobalWorkbookInfoPtr global_info_;
|
||||
|
||||
std::vector<BaseObjectPtr> m_arNote;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -46,18 +46,16 @@
|
||||
namespace XLS
|
||||
{;
|
||||
|
||||
WorkbookStreamObject::WorkbookStreamObject()
|
||||
: code_page_(DefaultCodePage)
|
||||
WorkbookStreamObject::WorkbookStreamObject() : code_page_(DefaultCodePage)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WorkbookStreamObject::WorkbookStreamObject(const unsigned short code_page)
|
||||
: code_page_(code_page)
|
||||
WorkbookStreamObject::WorkbookStreamObject(const unsigned short code_page) : code_page_(code_page)
|
||||
{
|
||||
}
|
||||
|
||||
void WorkbookStreamObject::set_code_page(const unsigned short code_page)
|
||||
void WorkbookStreamObject::set_code_page(const unsigned short code_page)
|
||||
{
|
||||
code_page_ = code_page;
|
||||
}
|
||||
@ -76,16 +74,22 @@ BaseObjectPtr WorkbookStreamObject::clone()
|
||||
|
||||
const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
{
|
||||
bool to_continue = true;
|
||||
|
||||
bool GlobalsSubstream_found = false;
|
||||
bool WorksheetSubstream_found = false;
|
||||
GlobalWorkbookInfoPtr global_info_ = proc.getGlobalWorkbookInfo();
|
||||
|
||||
bool GlobalsSubstream_found = false;
|
||||
bool WorksheetSubstream_found = false;
|
||||
|
||||
size_t ws_index = 0;
|
||||
|
||||
while(to_continue)
|
||||
GlobalWorkbookInfo::_sheet_info sheet_info;
|
||||
sheet_info.state = L"visible";
|
||||
|
||||
while(true)
|
||||
{
|
||||
unsigned short substream_type = 0;
|
||||
to_continue = proc.getNextSubstreamType(substream_type);
|
||||
|
||||
if (!proc.getNextSubstreamType(substream_type))
|
||||
break;
|
||||
|
||||
switch(substream_type)
|
||||
{
|
||||
@ -115,7 +119,11 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
return false;
|
||||
}
|
||||
Log::event("Worksheet or Dialog substream detected");
|
||||
WorksheetSubstream worksheet_substream(ws_index++);
|
||||
|
||||
if (ws_index >= global_info_->sheets_info.size())
|
||||
global_info_->sheets_info.push_back(sheet_info);
|
||||
|
||||
WorksheetSubstream worksheet_substream(ws_index++);
|
||||
if ((proc.mandatory(worksheet_substream)) && (elements_.size() > 0))
|
||||
{
|
||||
WorksheetSubstream_found = true;
|
||||
@ -132,11 +140,16 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
return false;
|
||||
}
|
||||
Log::event("Chart substream detected");
|
||||
if ((proc.mandatory<ChartSheetSubstream>()) && (elements_.size() > 0))
|
||||
|
||||
if (ws_index >= global_info_->sheets_info.size())
|
||||
global_info_->sheets_info.push_back(sheet_info);
|
||||
|
||||
ChartSheetSubstream chartsheet_substream(ws_index++);
|
||||
if ((proc.mandatory(chartsheet_substream)) && (elements_.size() > 0))
|
||||
{
|
||||
WorksheetSubstream_found = true;
|
||||
|
||||
m_arWorksheetSubstream.push_back(elements_.back()); elements_.pop_back();
|
||||
m_arChartSheetSubstream.push_back(elements_.back()); elements_.pop_back();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -148,7 +161,12 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
return false;
|
||||
}
|
||||
Log::event("Macro substream detected");
|
||||
if ((proc.mandatory<MacroSheetSubstream>()) && (elements_.size() > 0))
|
||||
|
||||
if (ws_index >= global_info_->sheets_info.size())
|
||||
global_info_->sheets_info.push_back(sheet_info);
|
||||
|
||||
MacroSheetSubstream macrosheet_substream(ws_index++);
|
||||
if ((proc.mandatory(macrosheet_substream)) && (elements_.size() > 0))
|
||||
{
|
||||
WorksheetSubstream_found = true;
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ public:
|
||||
|
||||
std::vector<BaseObjectPtr> m_arWorksheetSubstream;
|
||||
std::vector<BaseObjectPtr> m_arMacroSheetSubstream;
|
||||
std::vector<BaseObjectPtr> m_arChartSheetSubstream;
|
||||
|
||||
unsigned short code_page_;
|
||||
};
|
||||
|
||||
@ -80,24 +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
|
||||
@ -109,11 +104,7 @@ WORKSHEET = BOF WORKSHEETCONTENT
|
||||
const bool WorksheetSubstream::loadContent(BinProcessor& proc)
|
||||
{
|
||||
global_info_ = proc.getGlobalWorkbookInfo();
|
||||
|
||||
GlobalWorkbookInfo::_sheet_size_info sheet_size_info;
|
||||
|
||||
global_info_->sheet_size_info.push_back(sheet_size_info);
|
||||
global_info_->current_sheet = global_info_->sheet_size_info.size();
|
||||
global_info_->current_sheet = ws_index_ + 1;
|
||||
|
||||
global_info_->cmt_rules = 0;
|
||||
|
||||
@ -145,8 +136,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
|
||||
case rt_CalcMode:
|
||||
case rt_PrintRowCol:
|
||||
{
|
||||
GLOBALS globals(false);
|
||||
if (proc.mandatory(globals))
|
||||
if (proc.mandatory<GLOBALS>())
|
||||
{
|
||||
m_GLOBALS = elements_.back();
|
||||
elements_.pop_back();
|
||||
@ -210,8 +200,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:
|
||||
@ -336,7 +345,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
|
||||
DxGCol* dx = dynamic_cast<DxGCol*>(m_DxGCol.get());
|
||||
global_info_->sheet_size_info.back().defaultColumnWidth = dx->dxgCol / 256.;
|
||||
global_info_->sheets_info.back().defaultColumnWidth = dx->dxgCol / 256.;
|
||||
}
|
||||
}break;
|
||||
case rt_MergeCells:
|
||||
@ -462,78 +471,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
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
#include "../XlsFormat/Logic/WorksheetSubstream.h"
|
||||
#include "../XlsFormat/Logic/GlobalsSubstream.h"
|
||||
#include "../XlsFormat/Logic/ChartSheetSubstream.h"
|
||||
#include "../XlsFormat/Logic/MacroSheetSubstream.h"
|
||||
|
||||
#include "../XlsFormat/Logic/BinProcessor.h"
|
||||
#include "../XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h"
|
||||
@ -71,6 +72,7 @@
|
||||
#include "../XlsFormat/Logic/Biff_records/TxO.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/IMDATA.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/Note.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/WsBool.h"
|
||||
|
||||
#include "../XlsFormat/Logic/Biff_structures/URLMoniker.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/FileMoniker.h"
|
||||
@ -245,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);
|
||||
@ -287,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(...)
|
||||
{
|
||||
@ -382,7 +416,7 @@ void XlsConverter::convert(XLS::BaseObject *xls_unknown)
|
||||
case XLS::typeOBJECTS:
|
||||
{
|
||||
XLS::OBJECTS * obj = dynamic_cast<XLS::OBJECTS*>(xls_unknown);
|
||||
convert(obj);
|
||||
convert(obj, NULL);
|
||||
}break;
|
||||
case XLS::typeTxO:
|
||||
{
|
||||
@ -412,34 +446,25 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
|
||||
|
||||
convert(dynamic_cast<XLS::GlobalsSubstream*>(woorkbook->m_GlobalsSubstream.get()));
|
||||
|
||||
int count_sheets = 0, count_chart_sheets = 0;
|
||||
for (size_t i = 0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
|
||||
{
|
||||
if (woorkbook->m_arWorksheetSubstream[i]->get_type() == XLS::typeWorksheetSubstream)
|
||||
{
|
||||
count_sheets++;
|
||||
xls_global_info->current_sheet = count_sheets;
|
||||
|
||||
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + std::to_wstring(count_sheets));
|
||||
xlsx_context->set_state(xls_global_info->sheets_state.size() > i ? xls_global_info->sheets_state[i] : L"visible");
|
||||
|
||||
xlsx_context->start_table();
|
||||
convert(dynamic_cast<XLS::WorksheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get()));
|
||||
}
|
||||
else if (woorkbook->m_arWorksheetSubstream[i]->get_type() == XLS::typeChartSheetSubstream)
|
||||
{
|
||||
count_chart_sheets++;
|
||||
xls_global_info->current_sheet = -1;
|
||||
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"ChartSheet_" + std::to_wstring(count_chart_sheets));
|
||||
|
||||
xlsx_context->set_chart_view();
|
||||
|
||||
XLS::ChartSheetSubstream* chart = dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arWorksheetSubstream[i].get());
|
||||
|
||||
convert_chart_sheet(chart);
|
||||
}
|
||||
|
||||
xlsx_context->end_table();
|
||||
}
|
||||
for (size_t i = 0 ; i < woorkbook->m_arChartSheetSubstream.size(); i++)
|
||||
{
|
||||
xlsx_context->start_table();
|
||||
convert_chart_sheet(dynamic_cast<XLS::ChartSheetSubstream*>(woorkbook->m_arChartSheetSubstream[i].get()));
|
||||
xlsx_context->end_table();
|
||||
}
|
||||
for (size_t i = 0 ; i < woorkbook->m_arMacroSheetSubstream.size(); i++)
|
||||
{
|
||||
xlsx_context->start_table();
|
||||
convert(dynamic_cast<XLS::MacroSheetSubstream*>(woorkbook->m_arMacroSheetSubstream[i].get()));
|
||||
xlsx_context->end_table();
|
||||
}
|
||||
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = woorkbook->elements_.begin(); it != woorkbook->elements_.end(); it++)
|
||||
{
|
||||
convert(it->get());
|
||||
@ -448,33 +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;
|
||||
|
||||
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());
|
||||
sheet->m_PROTECTION->serialize(xlsx_context->current_sheet().protection());
|
||||
}
|
||||
if (sheet->m_COLUMNS)
|
||||
{
|
||||
@ -484,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())
|
||||
@ -575,6 +537,140 @@ 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;
|
||||
|
||||
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"MacroSheet_" + std::to_wstring(sheet->ws_index_ + 1);
|
||||
|
||||
xlsx_context->set_table_type(4);
|
||||
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(), 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);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void XlsConverter::convert(XLS::GlobalsSubstream* globals)
|
||||
{
|
||||
if (globals == NULL) return;
|
||||
@ -622,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;
|
||||
|
||||
@ -1112,7 +1233,7 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
|
||||
{
|
||||
text_obj->preserve_enabled = true;
|
||||
|
||||
for (size_t i = 0 ; i < sheet->m_arNote.size(); i++)
|
||||
for (size_t i = 0 ; sheet && i < sheet->m_arNote.size(); i++)
|
||||
{
|
||||
XLS::Note* note = dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get());
|
||||
if ((note) && (note->note_sh.idObj == obj->cmo.id))
|
||||
@ -1870,10 +1991,10 @@ void XlsConverter::convert_transform(std::vector<ODRAW::OfficeArtFOPTEPtr> & pro
|
||||
{
|
||||
case 0x0004:
|
||||
{
|
||||
double d = props[i]->op / 65536.;
|
||||
d *= 60000; //60 000 per 1 gr - 19.5.5 oox
|
||||
double d = props[i]->op / 65536.;
|
||||
if (d < 0) d += 360;
|
||||
|
||||
xlsx_context->get_drawing_context().set_rotation((int)d);
|
||||
xlsx_context->get_drawing_context().set_rotation(d);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@ -2104,18 +2225,6 @@ void XlsConverter::convert(XLS::Obj * obj)
|
||||
}
|
||||
}
|
||||
|
||||
void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream* chart)
|
||||
{
|
||||
if (chart == NULL) return;
|
||||
|
||||
if (xlsx_context->get_drawing_context().start_drawing(0x0005))
|
||||
{
|
||||
xlsx_context->get_drawing_context().set_id(1);
|
||||
convert(chart);
|
||||
|
||||
xlsx_context->get_drawing_context().end_drawing();
|
||||
}
|
||||
}
|
||||
void XlsConverter::convert(XLS::ChartSheetSubstream* chart)
|
||||
{
|
||||
if (chart == NULL) return;
|
||||
|
||||
@ -60,9 +60,11 @@ namespace XLS
|
||||
typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr;
|
||||
|
||||
class WorkbookStreamObject;
|
||||
class CommonSubstream;
|
||||
class WorksheetSubstream;
|
||||
class GlobalsSubstream;
|
||||
class ChartSheetSubstream;
|
||||
class MacroSheetSubstream;
|
||||
|
||||
class BACKGROUND;
|
||||
class FORMATTING;
|
||||
@ -109,10 +111,13 @@ 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);
|
||||
void convert(XLS::GlobalsSubstream * elem);
|
||||
void convert(XLS::MacroSheetSubstream * chart);
|
||||
|
||||
void convert(XLS::FORMATTING * formating);
|
||||
void convert(XLS::THEME * theme);
|
||||
|
||||
@ -64,7 +64,6 @@ public:
|
||||
void set_main_document(document * _document) { document_ = _document; }
|
||||
document * get_main_document() { return document_; }
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath) = 0;
|
||||
|
||||
private:
|
||||
|
||||
@ -118,28 +118,42 @@ oox_activeX_context & xlsx_conversion_context::current_activeX()
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
bool xlsx_conversion_context::start_table(const std::wstring & name)
|
||||
bool xlsx_conversion_context::start_table()
|
||||
{
|
||||
sheets_.push_back(xlsx_xml_worksheet::create(name));
|
||||
get_table_context().start_table(name);
|
||||
sheets_.push_back(xlsx_xml_worksheet::create());
|
||||
get_table_context().start_table();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_chart_view()
|
||||
void xlsx_conversion_context::set_table_type(int type)
|
||||
{
|
||||
if (sheets_.empty()) return;
|
||||
|
||||
get_table_context().set_chart_view();
|
||||
}
|
||||
sheets_.back()->type = type;
|
||||
if (type == 3)
|
||||
{
|
||||
get_table_context().set_chart_view();
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::set_state(const std::wstring & state)
|
||||
}
|
||||
void xlsx_conversion_context::set_table_name(const std::wstring & name)
|
||||
{
|
||||
if (name.empty()) return;
|
||||
|
||||
sheets_.back()->name = name;
|
||||
}
|
||||
void xlsx_conversion_context::set_table_state(const std::wstring & state)
|
||||
{
|
||||
if (state.empty()) return;
|
||||
|
||||
sheets_.back()->set_state(state);
|
||||
sheets_.back()->state = state;
|
||||
}
|
||||
void xlsx_conversion_context::set_table_id(int id)
|
||||
{
|
||||
if (id < 0) return;
|
||||
sheets_.back()->id = id;
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_chart()
|
||||
{
|
||||
charts_.push_back(oox_chart_context::create());
|
||||
@ -215,17 +229,15 @@ void xlsx_conversion_context::end_document()
|
||||
{
|
||||
std::wstringstream workbook_content;
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
for (size_t i = 0; i < sheets_.size(); i++)
|
||||
{
|
||||
xlsx_xml_worksheet_ptr & sheet = sheets_[i];
|
||||
count++;
|
||||
const std::wstring slideRId = std::wstring(L"sId") + std::to_wstring(count);
|
||||
|
||||
package::sheet_content_ptr content = package::sheet_content::create();
|
||||
|
||||
const std::wstring slideRId = std::wstring(L"sId") + std::to_wstring(i + 1);
|
||||
content->set_rId(slideRId);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const std::pair<std::wstring, std::wstring> p1 = sheet->get_drawing_link();
|
||||
const std::pair<std::wstring, std::wstring> p1 = sheets_[i]->get_drawing_link();
|
||||
|
||||
if (!p1.first.empty())
|
||||
{
|
||||
@ -235,9 +247,9 @@ void xlsx_conversion_context::end_document()
|
||||
content->add_rel(relationship(dId, kType, dName));
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
content->add_rels(sheet->sheet_rels());
|
||||
content->add_rels(sheets_[i]->sheet_rels());
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const std::pair<std::wstring, std::wstring> p2 = sheet->get_comments_link();
|
||||
const std::pair<std::wstring, std::wstring> p2 = sheets_[i]->get_comments_link();
|
||||
if (!p2.first.empty())
|
||||
{
|
||||
const std::wstring dId = p2.second;
|
||||
@ -246,7 +258,7 @@ void xlsx_conversion_context::end_document()
|
||||
content->add_rel(relationship(dId, kType, dName));
|
||||
}
|
||||
|
||||
const std::pair<std::wstring, std::wstring> p3 = sheet->get_vml_drawing_link();
|
||||
const std::pair<std::wstring, std::wstring> p3 = sheets_[i]->get_vml_drawing_link();
|
||||
if (!p3.first.empty())
|
||||
{
|
||||
const std::wstring dId = p3.second;
|
||||
@ -255,7 +267,7 @@ void xlsx_conversion_context::end_document()
|
||||
content->add_rel(relationship(dId, kType, dName));
|
||||
}
|
||||
|
||||
const std::pair<std::wstring, std::wstring> p4 = sheet->get_vml_drawing_HF_link();
|
||||
const std::pair<std::wstring, std::wstring> p4 = sheets_[i]->get_vml_drawing_HF_link();
|
||||
if (!p4.first.empty())
|
||||
{
|
||||
const std::wstring dId = p4.second;
|
||||
@ -264,22 +276,24 @@ void xlsx_conversion_context::end_document()
|
||||
content->add_rel(relationship(dId, kType, dName));
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
sheet->write_to(content->content());
|
||||
output_document_->get_xl_files().add_sheet(content);
|
||||
sheets_[i]->write_to(content->content());
|
||||
|
||||
output_document_->get_xl_files().add_sheet(sheets_[i]->type, content);
|
||||
|
||||
/////////////////////////////////////////////
|
||||
CP_XML_WRITER(workbook_content)
|
||||
{
|
||||
CP_XML_NODE(L"sheet")
|
||||
{
|
||||
CP_XML_ATTR(L"name", sheet->name());
|
||||
CP_XML_ATTR(L"sheetId", count);
|
||||
CP_XML_ATTR(L"state", sheet->state() );
|
||||
CP_XML_ATTR(L"name", sheets_[i]->name);
|
||||
CP_XML_ATTR(L"sheetId", sheets_[i]->id);
|
||||
CP_XML_ATTR(L"state", sheets_[i]->state);
|
||||
CP_XML_ATTR(L"r:id", slideRId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
unsigned int count = 0;
|
||||
for (size_t i = 0; i < activeXs_.size(); i++)
|
||||
{
|
||||
package::activeX_content_ptr content = package::activeX_content::create();
|
||||
|
||||
@ -66,10 +66,12 @@ public:
|
||||
void start_document();
|
||||
void end_document();
|
||||
|
||||
bool start_table(const std::wstring & name);
|
||||
void set_state(const std::wstring & state);
|
||||
void set_chart_view();
|
||||
void end_table();
|
||||
bool start_table();
|
||||
void set_table_state(const std::wstring & state);
|
||||
void set_table_type(int type);
|
||||
void set_table_name(const std::wstring & name);
|
||||
void set_table_id(int id);
|
||||
void end_table();
|
||||
|
||||
void start_chart();
|
||||
void end_chart(){}
|
||||
|
||||
@ -550,32 +550,34 @@ void xlsx_drawing_context::end_group()
|
||||
{
|
||||
if (current_level < 1) return;
|
||||
|
||||
serialize_group();
|
||||
|
||||
std::vector<_drawing_state_ptr>* cur_states = NULL;
|
||||
for (size_t i = 0; i < current_drawing_states->size(); i++)
|
||||
{
|
||||
int level = current_level;
|
||||
cur_states = current_drawing_states;
|
||||
while (level > 0)
|
||||
{
|
||||
_drawing_state_ptr & drawing_state = cur_states->front();
|
||||
|
||||
if (i != 0 || level != current_level) // группа сама себя
|
||||
{
|
||||
if (!current_drawing_states->empty())
|
||||
{
|
||||
int level = current_level;
|
||||
cur_states = current_drawing_states;
|
||||
while (level > 0)
|
||||
{
|
||||
double kf_x = (double)drawing_state->child_anchor.cx / drawing_state->group_anchor.cx;
|
||||
double kf_y = (double)drawing_state->child_anchor.cy / drawing_state->group_anchor.cy;
|
||||
_drawing_state_ptr & drawing_state = cur_states->front();
|
||||
|
||||
current_drawing_states->at(i)->child_anchor.cx *= kf_x;
|
||||
current_drawing_states->at(i)->child_anchor.cy *= kf_y;
|
||||
if (i != 0 || level != current_level) // группа сама себя
|
||||
{
|
||||
double kf_x = (double)drawing_state->child_anchor.cx / drawing_state->group_anchor.cx;
|
||||
double kf_y = (double)drawing_state->child_anchor.cy / drawing_state->group_anchor.cy;
|
||||
|
||||
current_drawing_states->at(i)->child_anchor.cx *= kf_x;
|
||||
current_drawing_states->at(i)->child_anchor.cy *= kf_y;
|
||||
|
||||
current_drawing_states->at(i)->child_anchor.x = current_drawing_states->at(i)->child_anchor.x * kf_x + drawing_state->child_anchor.x;
|
||||
current_drawing_states->at(i)->child_anchor.y = current_drawing_states->at(i)->child_anchor.y * kf_y + drawing_state->child_anchor.y;
|
||||
current_drawing_states->at(i)->child_anchor.x = current_drawing_states->at(i)->child_anchor.x * kf_x + drawing_state->child_anchor.x;
|
||||
current_drawing_states->at(i)->child_anchor.y = current_drawing_states->at(i)->child_anchor.y * kf_y + drawing_state->child_anchor.y;
|
||||
}
|
||||
level--;
|
||||
cur_states = cur_states->front()->parent_drawing_states;
|
||||
}
|
||||
level--;
|
||||
cur_states = cur_states->front()->parent_drawing_states;
|
||||
}
|
||||
}
|
||||
serialize_group();
|
||||
|
||||
current_drawing_states = current_drawing_states->front()->parent_drawing_states;
|
||||
|
||||
@ -770,6 +772,29 @@ void xlsx_drawing_context::end_drawing()
|
||||
|
||||
if (current_drawing_states->back()->type == external_items::typeGroup) return;
|
||||
|
||||
//std::vector<_drawing_state_ptr>* cur_states = current_drawing_states;;
|
||||
//
|
||||
//int level = current_level;
|
||||
|
||||
//while (level > 0)
|
||||
//{
|
||||
// _drawing_state_ptr & drawing_state = cur_states->front();
|
||||
|
||||
// double kf_x = (double)drawing_state->child_anchor.cx / drawing_state->group_anchor.cx;
|
||||
// double kf_y = (double)drawing_state->child_anchor.cy / drawing_state->group_anchor.cy;
|
||||
|
||||
// current_drawing_states->back()->child_anchor.cx *= kf_x;
|
||||
// current_drawing_states->back()->child_anchor.cy *= kf_y;
|
||||
//
|
||||
// current_drawing_states->back()->child_anchor.x = drawing_state->group_anchor.x +
|
||||
// (long)(kf_x * (current_drawing_states->back()->child_anchor.x - drawing_state->group_anchor.x));
|
||||
// current_drawing_states->back()->child_anchor.y = drawing_state->group_anchor.y +
|
||||
// (long)(kf_y * (current_drawing_states->back()->child_anchor.y - drawing_state->group_anchor.y));
|
||||
|
||||
// level--;
|
||||
// cur_states = cur_states->front()->parent_drawing_states;
|
||||
//}
|
||||
|
||||
end_drawing(current_drawing_states->back());
|
||||
|
||||
if ( current_drawing_states->back()->type == external_items::typeComment ||
|
||||
@ -794,6 +819,13 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
|
||||
if (drawing_state->id < 0)
|
||||
drawing_state->id = count_object + 0x20000;
|
||||
|
||||
if ( current_level > 0 && drawing_state->rotation > 0 && ((int)drawing_state->rotation % 90 == 0))
|
||||
{
|
||||
int v = drawing_state->child_anchor.cx;
|
||||
drawing_state->child_anchor.cx = drawing_state->child_anchor.cy;
|
||||
drawing_state->child_anchor.cy = v;
|
||||
}
|
||||
|
||||
if ( drawing_state->type == external_items::typeImage ||
|
||||
( drawing_state->type == external_items::typeShape && drawing_state->shape_id == msosptPictureFrame ))
|
||||
{
|
||||
@ -993,10 +1025,6 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat
|
||||
{
|
||||
CP_XML_ATTR(L"stroked", L"f");
|
||||
}
|
||||
if (drawing_state->line.fill.type == fillNone)
|
||||
{
|
||||
CP_XML_ATTR(L"stroked", L"f");
|
||||
}
|
||||
if (drawing_state->fill.type == fillNone)
|
||||
{
|
||||
CP_XML_ATTR(L"filled", L"f");
|
||||
@ -1009,10 +1037,10 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat
|
||||
CP_XML_ATTR(L"on", L"t");
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"v:wrap")
|
||||
{
|
||||
CP_XML_ATTR(L"v:type", L"none");
|
||||
}
|
||||
//CP_XML_NODE(L"v:wrap")
|
||||
//{
|
||||
// CP_XML_ATTR(L"v:type", L"none");
|
||||
//}
|
||||
|
||||
CP_XML_NODE(L"v:fill")
|
||||
{
|
||||
@ -1074,6 +1102,17 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat
|
||||
CP_XML_STREAM() << drawing_state->text.vml_content;
|
||||
}
|
||||
}
|
||||
if (drawing_state->type_control == 0x000b)
|
||||
{
|
||||
CP_XML_NODE(L"v:textbox")
|
||||
{
|
||||
CP_XML_ATTR(L"o:singleclick", L"f");
|
||||
CP_XML_NODE(L"div")
|
||||
{
|
||||
CP_XML_ATTR(L"style", L"text-align:left");
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"x:ClientData")
|
||||
{
|
||||
switch(drawing_state->type_control)
|
||||
@ -1118,8 +1157,12 @@ void xlsx_drawing_context::serialize_vml_shape(_drawing_state_ptr & drawing_stat
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"x:AutoFill") {CP_XML_CONTENT("False");}
|
||||
CP_XML_NODE(L"x:Row") {CP_XML_CONTENT(drawing_state->object.row);}
|
||||
CP_XML_NODE(L"x:Column") {CP_XML_CONTENT(drawing_state->object.col);}
|
||||
|
||||
//if (drawing_state->type_control != 0x000b)
|
||||
{
|
||||
CP_XML_NODE(L"x:Row") {CP_XML_CONTENT(drawing_state->object.row);}
|
||||
CP_XML_NODE(L"x:Column") {CP_XML_CONTENT(drawing_state->object.col);}
|
||||
}
|
||||
|
||||
if (drawing_state->object.bVisible) CP_XML_NODE(L"x:Visible");
|
||||
|
||||
@ -1507,11 +1550,11 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
|
||||
CP_XML_NODE(L"xdr:cNvSpPr")
|
||||
{
|
||||
if (drawing_state->bTextBox)CP_XML_ATTR(L"txBox", 1);
|
||||
CP_XML_NODE(L"a:spLocks")
|
||||
{
|
||||
CP_XML_ATTR(L"noGrp", 1);
|
||||
CP_XML_ATTR(L"noChangeArrowheads", 1);
|
||||
}
|
||||
//CP_XML_NODE(L"a:spLocks")
|
||||
//{
|
||||
// CP_XML_ATTR(L"noGrp", 1);
|
||||
// CP_XML_ATTR(L"noChangeArrowheads", 1);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1938,7 +1981,7 @@ void xlsx_drawing_context::serialize_xfrm(std::wostream & stream, _drawing_state
|
||||
if (drawing_state->flipV) CP_XML_ATTR(L"flipV", true);
|
||||
if (drawing_state->flipH) CP_XML_ATTR(L"flipH", true);
|
||||
|
||||
if (drawing_state->rotation != 0) CP_XML_ATTR(L"rot", drawing_state->rotation);
|
||||
if (drawing_state->rotation != 0) CP_XML_ATTR(L"rot", (int)(drawing_state->rotation * 60000));
|
||||
|
||||
CP_XML_NODE(L"a:off")
|
||||
{
|
||||
@ -2655,8 +2698,16 @@ void xlsx_drawing_context::set_rotation (double val)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
if (val < 0.001) return;
|
||||
|
||||
current_drawing_states->back()->rotation = val;
|
||||
|
||||
if (((int)current_drawing_states->back()->rotation % 90) == 0 && current_level > 0)
|
||||
{
|
||||
int v = current_drawing_states->back()->child_anchor.cx;
|
||||
current_drawing_states->back()->child_anchor.cx = current_drawing_states->back()->child_anchor.cy;
|
||||
current_drawing_states->back()->child_anchor.cy = v;
|
||||
}
|
||||
}
|
||||
void xlsx_drawing_context::set_line_color (int nColor, const std::wstring & sColor)
|
||||
{
|
||||
|
||||
@ -37,18 +37,14 @@
|
||||
|
||||
namespace oox {
|
||||
|
||||
/// \class xlsx_xml_worksheet::Impl
|
||||
|
||||
class xlsx_xml_worksheet::Impl
|
||||
{
|
||||
public:
|
||||
Impl(std::wstring const & name) : name_(name)
|
||||
Impl()
|
||||
{
|
||||
state_ = L"visible";
|
||||
}
|
||||
|
||||
std::wstring name_;
|
||||
std::wstring state_;
|
||||
|
||||
|
||||
std::wstringstream cols_;
|
||||
std::wstringstream sheetPr_;
|
||||
std::wstringstream sheetFormatPr_;
|
||||
@ -67,6 +63,7 @@ public:
|
||||
std::wstringstream conditionalFormatting_;
|
||||
std::wstringstream picture_background_;
|
||||
std::wstringstream dataValidations_;
|
||||
std::wstringstream protection_;
|
||||
|
||||
rels rels_;
|
||||
|
||||
@ -83,21 +80,12 @@ public:
|
||||
std::wstring vml_HF_drawingId_;
|
||||
};
|
||||
|
||||
std::wstring xlsx_xml_worksheet::name() const
|
||||
xlsx_xml_worksheet_ptr xlsx_xml_worksheet::create()
|
||||
{
|
||||
return impl_->name_;
|
||||
}
|
||||
std::wstring xlsx_xml_worksheet::state() const
|
||||
{
|
||||
return impl_->state_;
|
||||
}
|
||||
xlsx_xml_worksheet_ptr xlsx_xml_worksheet::create(std::wstring const & name)
|
||||
{
|
||||
return boost::make_shared<xlsx_xml_worksheet>(name);
|
||||
return boost::make_shared<xlsx_xml_worksheet>();
|
||||
}
|
||||
|
||||
xlsx_xml_worksheet::xlsx_xml_worksheet(std::wstring const & name)
|
||||
: impl_(new xlsx_xml_worksheet::Impl(name))
|
||||
xlsx_xml_worksheet::xlsx_xml_worksheet() : impl_(new xlsx_xml_worksheet::Impl()), type(1), id(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -179,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()
|
||||
{
|
||||
@ -186,12 +179,25 @@ rels & xlsx_xml_worksheet::sheet_rels()
|
||||
}
|
||||
void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
{
|
||||
std::wstring node_name;
|
||||
switch(type)
|
||||
{
|
||||
case 2: node_name = L"dialogsheet"; break;
|
||||
case 3: node_name = L"chartsheet"; break;
|
||||
case 4: node_name = L"xm:macrosheet"; break;
|
||||
case 1:
|
||||
default: node_name = L"worksheet"; break;
|
||||
}
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"worksheet")
|
||||
CP_XML_NODE(node_name)
|
||||
{
|
||||
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");
|
||||
if (type == 4)
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xm", L"http://schemas.microsoft.com/office/excel/2006/main");
|
||||
}
|
||||
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
CP_XML_ATTR(L"xmlns:x14", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
@ -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)
|
||||
//объединенные ячейки раньше чем гиперлинки !!!
|
||||
|
||||
@ -266,10 +275,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_xml_worksheet::set_state (std::wstring const & state)
|
||||
{
|
||||
impl_->state_ = state;
|
||||
}
|
||||
|
||||
void xlsx_xml_worksheet::set_drawing_link(std::wstring const & fileName, std::wstring const & id)
|
||||
{
|
||||
impl_->drawingName_ = fileName;
|
||||
|
||||
@ -45,12 +45,14 @@ typedef boost::shared_ptr<xlsx_xml_worksheet> xlsx_xml_worksheet_ptr;
|
||||
class xlsx_xml_worksheet: boost::noncopyable
|
||||
{
|
||||
public:
|
||||
xlsx_xml_worksheet(std::wstring const & name);
|
||||
xlsx_xml_worksheet();
|
||||
~xlsx_xml_worksheet();
|
||||
public:
|
||||
std::wstring name() const;
|
||||
std::wstring state() const;
|
||||
|
||||
|
||||
std::wstring name;
|
||||
std::wstring state;
|
||||
int type;
|
||||
int id;
|
||||
|
||||
std::wostream & dimension();
|
||||
std::wostream & sheetViews();
|
||||
std::wostream & cols();
|
||||
@ -69,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);
|
||||
@ -77,7 +80,6 @@ public:
|
||||
void set_drawing_link (std::wstring const & fileName, std::wstring const & id);
|
||||
void set_vml_drawing_link (std::wstring const & fileName, std::wstring const & id);
|
||||
void set_comments_link (std::wstring const & fileName, std::wstring const & id);
|
||||
void set_state (std::wstring const & state);
|
||||
void set_vml_HF_drawing_link(std::wstring const & fileName, std::wstring const & id);
|
||||
|
||||
std::pair<std::wstring, std::wstring> get_drawing_link() const;
|
||||
@ -85,7 +87,7 @@ public:
|
||||
std::pair<std::wstring, std::wstring> get_vml_drawing_HF_link() const;
|
||||
std::pair<std::wstring, std::wstring> get_comments_link() const;
|
||||
|
||||
static xlsx_xml_worksheet_ptr create(std::wstring const & name);
|
||||
static xlsx_xml_worksheet_ptr create();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
||||
@ -162,44 +162,74 @@ void sheet_content::add_rels(rels & r)
|
||||
sheets_files::sheets_files()
|
||||
{}
|
||||
|
||||
void sheets_files::add_sheet(sheet_content_ptr sheet)
|
||||
void sheets_files::add_sheet(int type, sheet_content_ptr sheet)
|
||||
{
|
||||
sheets_.push_back(sheet);
|
||||
switch(type)
|
||||
{
|
||||
case 2: dialogsheets_.push_back(sheet); break;
|
||||
case 3: chartsheets_.push_back(sheet); break;
|
||||
case 4: macrosheets_.push_back(sheet); break;
|
||||
case 1:
|
||||
default: worksheets_.push_back(sheet); break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void sheets_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"worksheets";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
int id = 0;
|
||||
write_(worksheets_, id, RootPath, L"worksheet", L"sheet",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
|
||||
L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml");
|
||||
|
||||
write_(dialogsheets_,id, RootPath, L"dialogsheet", L"sheet",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet",
|
||||
L"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml");
|
||||
|
||||
write_(chartsheets_, id, RootPath, L"chartsheet", L"sheet",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet",
|
||||
L"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml");
|
||||
|
||||
write_(macrosheets_, id, RootPath, L"macrosheet", L"intlsheet",
|
||||
L"http://schemas.microsoft.com/office/2006/relationships/xlIntlMacrosheet",
|
||||
L"application/vnd.ms-excel.intlmacrosheet+xml");
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sheets_.size(); i++)
|
||||
{
|
||||
if (!sheets_[i]) continue;
|
||||
void sheets_files::write_(std::vector<sheet_content_ptr> & sheets_, int & id,
|
||||
const std::wstring & RootPath, const std::wstring & local, const std::wstring & name,
|
||||
const std::wstring & rels_type, const std::wstring & content_type)
|
||||
{
|
||||
if (sheets_.empty()) return;
|
||||
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + local + L"s";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
oox::content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
for (size_t i = 0; i < sheets_.size(); i++, id++)
|
||||
{
|
||||
if (!sheets_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
const std::wstring fileName = name + std::to_wstring(i + 1) + L".xml";
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
|
||||
contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
|
||||
contentTypes.add_override(L"/xl/" + local + L"s/" + fileName, content_type);
|
||||
|
||||
if (rels_)
|
||||
{
|
||||
const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
|
||||
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
}
|
||||
if (rels_)
|
||||
{
|
||||
std::wstring fileRef = local + L"s/" + fileName;
|
||||
rels_->add(sheets_[i]->get_rId(), rels_type, fileRef);
|
||||
}
|
||||
|
||||
sheets_[i]->get_rel_file()->set_file_name(fileName + L".rels");
|
||||
sheets_[i]->get_rel_file()->set_file_name(fileName + L".rels");
|
||||
|
||||
rels_files relFiles;
|
||||
relFiles.add_rel_file(sheets_[i]->get_rel_file());
|
||||
relFiles.write(path);
|
||||
relFiles.add_rel_file(sheets_[i]->get_rel_file());
|
||||
relFiles.write(path);
|
||||
|
||||
//item->get_rel_file()->write(path.string<std::wstring>());
|
||||
//item->get_rel_file()->write(path.string<std::wstring>());
|
||||
|
||||
package::simple_element(fileName, sheets_[i]->str()).write(path);
|
||||
}
|
||||
package::simple_element(fileName, sheets_[i]->str()).write(path);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
@ -207,7 +237,9 @@ void sheets_files::write(const std::wstring & RootPath)
|
||||
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)
|
||||
@ -278,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_)
|
||||
{
|
||||
@ -326,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;
|
||||
@ -346,9 +386,9 @@ void xl_files::set_connections(element_ptr Element)
|
||||
connections_ = Element;
|
||||
}
|
||||
|
||||
void xl_files::add_sheet(sheet_content_ptr sheet)
|
||||
void xl_files::add_sheet(int type, sheet_content_ptr sheet)
|
||||
{
|
||||
sheets_files_.add_sheet(sheet);
|
||||
sheets_files_.add_sheet(type, sheet);
|
||||
}
|
||||
|
||||
void xl_files::set_media(external_items & _Mediaitems)
|
||||
|
||||
@ -50,17 +50,24 @@ public:
|
||||
class sheet_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
static _CP_PTR(sheet_content) create();
|
||||
|
||||
sheet_content();
|
||||
std::wostream & content() { return content_; }
|
||||
|
||||
void add_rel(relationship const & r);
|
||||
void add_rels(rels & r);
|
||||
rels_file_ptr get_rel_file() { return rels_; }
|
||||
std::wstring str() { return content_.str(); }
|
||||
static _CP_PTR(sheet_content) create();
|
||||
|
||||
std::wostream & content() { return content_; }
|
||||
std::wstring str() { return content_.str(); }
|
||||
|
||||
void set_rId(std::wstring rid) {rId_ = rid;}
|
||||
std::wstring get_rId() {return rId_;}
|
||||
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
std::wstring rId_;
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
};
|
||||
typedef _CP_PTR(sheet_content) sheet_content_ptr;
|
||||
//------------------------------------------------------------------------
|
||||
@ -126,7 +133,7 @@ class sheets_files : public element
|
||||
public:
|
||||
sheets_files();
|
||||
|
||||
void add_sheet(sheet_content_ptr sheet);
|
||||
void add_sheet(int type, sheet_content_ptr sheet);
|
||||
|
||||
void set_rels(rels_files * rels)
|
||||
{
|
||||
@ -135,7 +142,15 @@ public:
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
std::vector<sheet_content_ptr> sheets_;
|
||||
std::vector<sheet_content_ptr> worksheets_;
|
||||
std::vector<sheet_content_ptr> dialogsheets_;
|
||||
std::vector<sheet_content_ptr> macrosheets_;
|
||||
std::vector<sheet_content_ptr> chartsheets_;
|
||||
|
||||
private:
|
||||
void write_(std::vector<sheet_content_ptr> & sheets_, int & id,
|
||||
const std::wstring & RootPath, const std::wstring & local, const std::wstring & name,
|
||||
const std::wstring & rels_type, const std::wstring & content_type);
|
||||
rels_files * rels_;
|
||||
|
||||
};
|
||||
@ -295,7 +310,7 @@ public:
|
||||
void set_styles (element_ptr Element);
|
||||
void set_sharedStrings (element_ptr Element);
|
||||
void set_connections (element_ptr Element);
|
||||
void add_sheet (sheet_content_ptr sheet);
|
||||
void add_sheet (int type, sheet_content_ptr sheet);
|
||||
void set_media (external_items & _Mediaitems);
|
||||
void set_drawings (element_ptr Element);
|
||||
void set_vml_drawings (element_ptr Element);
|
||||
@ -309,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_;
|
||||
@ -332,6 +348,7 @@ private:
|
||||
element_ptr comments_;
|
||||
|
||||
bool bVbaProject;
|
||||
bool bAttachedToolbars;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ xlsx_table_context::xlsx_table_context(xlsx_conversion_context & Context) : cont
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_table_context::start_table(const std::wstring & name)
|
||||
void xlsx_table_context::start_table()
|
||||
{
|
||||
tables_state_.push_back( table_state_ptr(new table_state(context_)));
|
||||
}
|
||||
|
||||
@ -58,8 +58,7 @@ class xlsx_table_context
|
||||
public:
|
||||
xlsx_table_context(xlsx_conversion_context & Context);
|
||||
|
||||
public:
|
||||
void start_table(const std::wstring & name);
|
||||
void start_table();
|
||||
void set_chart_view();
|
||||
void end_table();
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -2553,7 +2553,7 @@ namespace NExtractTools
|
||||
}
|
||||
int oox2mscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
{
|
||||
std::wstring password = params.getPassword();
|
||||
std::wstring password = params.getSavePassword();
|
||||
|
||||
ECMACryptFile cryptReader;
|
||||
|
||||
@ -2987,7 +2987,7 @@ namespace NExtractTools
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX == nFormatTo)
|
||||
{
|
||||
if(params.hasPassword())
|
||||
if(params.hasSavePassword())
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.docx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
@ -3199,7 +3199,7 @@ namespace NExtractTools
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
|
||||
{
|
||||
if(params.hasPassword())
|
||||
if(params.hasSavePassword())
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.xlsx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
@ -3386,7 +3386,7 @@ namespace NExtractTools
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo)
|
||||
{
|
||||
if(params.hasPassword())
|
||||
if(params.hasSavePassword())
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.pptx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
@ -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,
|
||||
@ -378,6 +382,7 @@ namespace NExtractTools
|
||||
int* m_nDoctParams;
|
||||
std::wstring* m_sHtmlFileInternalPath;
|
||||
std::wstring* m_sPassword;
|
||||
std::wstring* m_sSavePassword;
|
||||
std::wstring* m_sTempDir;
|
||||
bool* m_bIsNoBase64;
|
||||
//output params
|
||||
@ -404,6 +409,7 @@ namespace NExtractTools
|
||||
m_nDoctParams = NULL;
|
||||
m_sHtmlFileInternalPath = NULL;
|
||||
m_sPassword = NULL;
|
||||
m_sSavePassword = NULL;
|
||||
m_sTempDir = NULL;
|
||||
m_bIsNoBase64 = NULL;
|
||||
|
||||
@ -430,6 +436,7 @@ namespace NExtractTools
|
||||
RELEASEOBJECT(m_nDoctParams);
|
||||
RELEASEOBJECT(m_sHtmlFileInternalPath);
|
||||
RELEASEOBJECT(m_sPassword);
|
||||
RELEASEOBJECT(m_sSavePassword);
|
||||
RELEASEOBJECT(m_sTempDir);
|
||||
RELEASEOBJECT(m_bIsNoBase64);
|
||||
}
|
||||
@ -571,6 +578,11 @@ namespace NExtractTools
|
||||
RELEASEOBJECT(m_sPassword);
|
||||
m_sPassword = new std::wstring(sValue);
|
||||
}
|
||||
else if(_T("m_sSavePassword") == sName)
|
||||
{
|
||||
RELEASEOBJECT(m_sSavePassword);
|
||||
m_sSavePassword = new std::wstring(sValue);
|
||||
}
|
||||
else if(_T("m_sTempDir") == sName)
|
||||
{
|
||||
RELEASEOBJECT(m_sTempDir);
|
||||
@ -605,6 +617,14 @@ namespace NExtractTools
|
||||
{
|
||||
return (NULL != m_sPassword) ? (*m_sPassword) : L"";
|
||||
}
|
||||
bool hasSavePassword() const
|
||||
{
|
||||
return NULL != m_sSavePassword;
|
||||
}
|
||||
std::wstring getSavePassword() const
|
||||
{
|
||||
return (NULL != m_sSavePassword) ? (*m_sSavePassword) : L"";
|
||||
}
|
||||
std::wstring getFontPath() const
|
||||
{
|
||||
return (NULL != m_sFontDir) ? (*m_sFontDir) : L"";
|
||||
|
||||
@ -154,6 +154,7 @@ static std::wstring utf8_to_unicode(const char *src)
|
||||
if (argc > 4)
|
||||
{
|
||||
oInputParams.m_sPassword = new std::wstring(sArg4);
|
||||
oInputParams.m_sSavePassword = new std::wstring(sArg4);
|
||||
}
|
||||
result = NExtractTools::fromInputParams(oInputParams);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user