Commit f72d6dfe authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat-...

parent 23029a6a
...@@ -57,6 +57,8 @@ namespace writer ...@@ -57,6 +57,8 @@ namespace writer
static const char colon = ':'; static const char colon = ':';
static const char amp = '&'; static const char amp = '&';
static const char apos = '\''; static const char apos = '\'';
static const char a = '\x0a';
static const char * cdata_open() { return "<![CDATA["; } static const char * cdata_open() { return "<![CDATA["; }
static const char * cdata_close() { return "]]>"; } static const char * cdata_close() { return "]]>"; }
static const char * amp_str(){ return "&amp;"; } static const char * amp_str(){ return "&amp;"; }
...@@ -64,6 +66,7 @@ namespace writer ...@@ -64,6 +66,7 @@ namespace writer
static const char * right_brocket_str() { return "&gt;"; } static const char * right_brocket_str() { return "&gt;"; }
static const char * apos_str() { return "&apos;"; } static const char * apos_str() { return "&apos;"; }
static const char * quote_str() { return "&quot;"; } static const char * quote_str() { return "&quot;"; }
static const char * a_str() { return "&#10;"; }
}; };
template <> template <>
...@@ -78,14 +81,17 @@ namespace writer ...@@ -78,14 +81,17 @@ namespace writer
static const wchar_t colon = L':'; static const wchar_t colon = L':';
static const wchar_t amp = L'&'; static const wchar_t amp = L'&';
static const wchar_t apos = L'\''; static const wchar_t apos = L'\'';
static const wchar_t * cdata_open() { return L"<![CDATA["; } static const wchar_t a = L'\x0a';
static const wchar_t * cdata_open() { return L"<![CDATA["; }
static const wchar_t * cdata_close() { return L"]]>"; } static const wchar_t * cdata_close() { return L"]]>"; }
static const wchar_t * amp_str(){ return L"&amp;"; } static const wchar_t * amp_str(){ return L"&amp;"; }
static const wchar_t * left_brocket_str() { return L"&lt;"; } static const wchar_t * left_brocket_str() { return L"&lt;"; }
static const wchar_t * right_brocket_str() { return L"&gt;"; } static const wchar_t * right_brocket_str() { return L"&gt;"; }
static const wchar_t * apos_str() { return L"&apos;"; } static const wchar_t * apos_str() { return L"&apos;"; }
static const wchar_t * quote_str() { return L"&quot;"; } static const wchar_t * quote_str() { return L"&quot;"; }
}; static const wchar_t * a_str() { return L"&#10;"; }
};
template <class V> template <class V>
class element; class element;
...@@ -279,7 +285,9 @@ namespace writer ...@@ -279,7 +285,9 @@ namespace writer
case chars<T>::quote: case chars<T>::quote:
wr_.puts(chars<T>::quote_str()); break; wr_.puts(chars<T>::quote_str()); break;
default: case chars<T>::a:
wr_.puts(chars<T>::a_str()); break;
default:
wr_.putc(*str); break; wr_.putc(*str); break;
} }
} }
......
...@@ -53,7 +53,7 @@ static inline void trim(std::wstring &s) ...@@ -53,7 +53,7 @@ static inline void trim(std::wstring &s)
AutoFilter::AutoFilter() AutoFilter::AutoFilter()
{ {
wTopN = wJoin = 0; wTopN = wJoin = 0;
size = -1; size = 0xffffffff;
bExist = false; bExist = false;
} }
...@@ -72,7 +72,7 @@ void AutoFilter::readFields(CFRecord& record) ...@@ -72,7 +72,7 @@ void AutoFilter::readFields(CFRecord& record)
{ {
size_t pos_record = record.getRdPtr(); size_t pos_record = record.getRdPtr();
if (size < 0) size = record.getDataSize() - pos_record; if (size == 0xffffffff) size = record.getDataSize() - pos_record;
if (size > 0) if (size > 0)
{ {
......
...@@ -73,9 +73,8 @@ public: ...@@ -73,9 +73,8 @@ public:
std::wstring str2; std::wstring str2;
//---------------------------------------- //----------------------------------------
int size;
bool bExist; bool bExist;
_UINT32 size;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -31,6 +31,13 @@ ...@@ -31,6 +31,13 @@
*/ */
#include "AutoFilter12.h" #include "AutoFilter12.h"
#include "../Biff_structures/DXFN12List.h"
#include "../Biff_structures/BiffString.h"
#include "../Biff_structures/AFDOper.h"
#include "../Biff_structures/AF12Criteria.h"
#include "../Biff_structures/AF12CellIcon.h"
namespace XLS namespace XLS
{ {
...@@ -58,12 +65,29 @@ void AutoFilter12::readFields(CFRecord& record) ...@@ -58,12 +65,29 @@ void AutoFilter12::readFields(CFRecord& record)
record >> frtRefHeader >> iEntry >> fHideArrow >> ft >> cft >> cCriteria >> cDateGroupings >> flags >> unused2 >> idList; record >> frtRefHeader >> iEntry >> fHideArrow >> ft >> cft >> cCriteria >> cDateGroupings >> flags >> unused2 >> idList;
// TODO доделать _GUID_ guid_num;
record.skipNunBytes(record.getDataSize() - record.getRdPtr()); record >> guid_num;
guidSview = STR::guid2bstr(guid_num);
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
//-------------------------------------------------------------------------------------------------------
std::list<CFRecordPtr>& recs = continue_records[rt_ContinueFrt12]; std::list<CFRecordPtr>& recs = continue_records[rt_ContinueFrt12];
size_t size = recs.size(); size_t size = recs.size();
switch(ft)
{
case 0x00000000://not exist
break;
case 0x00000001: rgb = BiffStructurePtr(new DXFN12List); //color
break;
case 0x00000002: rgb = BiffStructurePtr(new DXFN12List); //font
break;
case 0x00000003: rgb = BiffStructurePtr(new AF12CellIcon); //icon
break;
}
if (rgb)
rgb->load(record);
while( !recs.empty() ) while( !recs.empty() )
{ {
record.appendRawData(recs.front()); record.appendRawData(recs.front());
......
...@@ -34,10 +34,7 @@ ...@@ -34,10 +34,7 @@
#include "BiffRecordContinued.h" #include "BiffRecordContinued.h"
#include "../Biff_structures/FrtRefHeader.h" #include "../Biff_structures/FrtRefHeader.h"
#include "../Biff_structures/BiffString.h"
#include "../Biff_structures/FrtRefHeader.h"
#include "../Biff_structures/AFDOper.h"
#include "../Biff_structures/AF12Criteria.h"
namespace XLS namespace XLS
{ {
...@@ -65,6 +62,9 @@ public: ...@@ -65,6 +62,9 @@ public:
_UINT32 cCriteria; _UINT32 cCriteria;
_UINT32 cDateGroupings; _UINT32 cDateGroupings;
_UINT32 idList; _UINT32 idList;
std::wstring guidSview;
BiffStructurePtr rgb;
BiffStructurePtrVector arAF12Criteries; BiffStructurePtrVector arAF12Criteries;
}; };
......
...@@ -32,14 +32,12 @@ ...@@ -32,14 +32,12 @@
#pragma once #pragma once
#include "BiffRecord.h" #include "BiffRecord.h"
#include <Logic/Biff_structures/DXFN.h> #include "../Biff_structures/DXFN.h"
#include <Logic/Biff_structures/CFParsedFormulaNoCCE.h> #include "../Biff_structures/CFParsedFormulaNoCCE.h"
namespace XLS namespace XLS
{ {
// Logical representation of CF record in BIFF8
class CF: public BiffRecord class CF: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(CF) BIFF_RECORD_DEFINE_TYPE_INFO(CF)
...@@ -50,7 +48,6 @@ public: ...@@ -50,7 +48,6 @@ public:
BaseObjectPtr clone(); BaseObjectPtr clone();
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeCF; static const ElementType type = typeCF;
...@@ -69,6 +66,7 @@ public: ...@@ -69,6 +66,7 @@ public:
CFParsedFormulaNoCCE rgce2; CFParsedFormulaNoCCE rgce2;
BaseObjectPtr m_CFEx; BaseObjectPtr m_CFEx;
BaseObjectPtr m_CF12;
GlobalWorkbookInfoPtr global_info_; GlobalWorkbookInfoPtr global_info_;
}; };
......
...@@ -32,18 +32,16 @@ ...@@ -32,18 +32,16 @@
#pragma once #pragma once
#include "BiffRecord.h" #include "BiffRecord.h"
#include <Logic/Biff_structures/FrtRefHeader.h> #include "../Biff_structures/FrtRefHeader.h"
#include <Logic/Biff_structures/DXFN12.h> #include "../Biff_structures/DXFN12.h"
#include <Logic/Biff_structures/CFParsedFormulaNoCCE.h> #include "../Biff_structures/CFParsedFormulaNoCCE.h"
#include <Logic/Biff_structures/CFParsedFormula.h> #include "../Biff_structures/CFParsedFormula.h"
#include <Logic/Biff_structures/CFExTemplateParams.h> #include "../Biff_structures/CFExTemplateParams.h"
namespace XLS namespace XLS
{ {
// Logical representation of CF12 record in BIFF8
class CF12: public BiffRecord class CF12: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(CF12) BIFF_RECORD_DEFINE_TYPE_INFO(CF12)
...@@ -84,6 +82,7 @@ public: ...@@ -84,6 +82,7 @@ public:
int dxfId_; int dxfId_;
BaseObjectPtr m_CFEx; BaseObjectPtr m_CFEx;
BaseObjectPtr m_CF12_2;
}; };
typedef boost::shared_ptr<CF12> CF12Ptr; typedef boost::shared_ptr<CF12> CF12Ptr;
......
/*
* (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 "AF12CellIcon.h"
#include <Binary/CFRecord.h>
namespace XLS
{
BiffStructurePtr AF12CellIcon::clone()
{
return BiffStructurePtr(new AF12CellIcon(*this));
}
AF12CellIcon::AF12CellIcon()
{
}
AF12CellIcon::~AF12CellIcon()
{
}
void AF12CellIcon::load(CFRecord& record)
{
record >> iIconSet >> iIcon;
}
} // namespace XLS
/*
* (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 "BiffStructure.h"
namespace XLS
{
class AF12CellIcon: public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(AF12CellIcon)
public:
BiffStructurePtr clone();
AF12CellIcon();
~AF12CellIcon();
virtual void load(CFRecord& record);
static const ElementType type = typeAF12CellIcon;
_UINT32 iIconSet;
_UINT32 iIcon;
};
typedef boost::shared_ptr<AF12CellIcon> AF12CellIconPtr;
} // namespace XLS
...@@ -31,8 +31,7 @@ ...@@ -31,8 +31,7 @@
*/ */
#pragma once #pragma once
#include <Logic/Biff_records/BiffRecord.h> #include "BiffString.h"
#include <Logic/Biff_structures/BiffString.h>
#include "AFDOper.h" #include "AFDOper.h"
namespace XLS namespace XLS
...@@ -49,8 +48,7 @@ public: ...@@ -49,8 +48,7 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
static const ElementType type = typeAF12Criteria;
static const ElementType type = typeAF12Criteria;
AFDOper doper; AFDOper doper;
XLUnicodeStringNoCch str; XLUnicodeStringNoCch str;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#pragma once #pragma once
#include <Logic/Biff_records/BiffRecord.h> #include <Logic/Biff_records/BiffRecord.h>
#include <Logic/Biff_structures/BiffString.h> #include "BiffString.h"
#include "AFDOperStr.h" #include "AFDOperStr.h"
#include "AFDOperRk.h" #include "AFDOperRk.h"
......
...@@ -44,8 +44,8 @@ BiffStructurePtr DXFN12List::clone() ...@@ -44,8 +44,8 @@ BiffStructurePtr DXFN12List::clone()
DXFN12List::DXFN12List() DXFN12List::DXFN12List()
{ {
bExist = false; bExist = false;
size = -1; size = 0xffffffff;
} }
...@@ -57,7 +57,7 @@ void DXFN12List::load(CFRecord& record) ...@@ -57,7 +57,7 @@ void DXFN12List::load(CFRecord& record)
{ {
size_t pos_record = record.getRdPtr(); size_t pos_record = record.getRdPtr();
if (size < 0) size = record.getDataSize() - pos_record; if (size == 0xffffffff) size = record.getDataSize() - pos_record;
if (size > 0) if (size > 0)
{ {
......
...@@ -31,10 +31,11 @@ ...@@ -31,10 +31,11 @@
*/ */
#pragma once #pragma once
#include "BiffString.h"
#include "DXFN.h"
#include "XFExtNoFRT.h"
#include "../Biff_records/BiffRecord.h" #include "../Biff_records/BiffRecord.h"
#include "../Biff_structures/BiffString.h"
#include "../Biff_structures/DXFN.h"
#include "../Biff_structures/XFExtNoFRT.h"
namespace XLS namespace XLS
{ {
...@@ -48,7 +49,7 @@ public: ...@@ -48,7 +49,7 @@ public:
DXFN12List(); DXFN12List();
~DXFN12List(); ~DXFN12List();
static const ElementType type = typeDXFN12List; static const ElementType type = typeDXFN12List;
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
...@@ -56,7 +57,7 @@ public: ...@@ -56,7 +57,7 @@ public:
XFExtNoFRT xfext; XFExtNoFRT xfext;
//----------------------------------------------------------------- //-----------------------------------------------------------------
bool bExist; bool bExist;
int size; _UINT32 size;
}; };
typedef boost::shared_ptr<DXFN12List> DXFN12ListPtr; typedef boost::shared_ptr<DXFN12List> DXFN12ListPtr;
......
...@@ -47,12 +47,13 @@ BiffStructurePtr DXFNum::clone() ...@@ -47,12 +47,13 @@ BiffStructurePtr DXFNum::clone()
void DXFNum::load(CFRecord& record) void DXFNum::load(CFRecord& record)
{ {
if (!parent) return; if (!parent) return;
if (parent->ifmtNinch)return;
if (parent->fIfmtUser) if (parent->fIfmtUser)
{ {
record >> user_defined; record >> user_defined;
} }
if (!parent->ifmtNinch)//else else
{ {
record >> fmt_id; record >> fmt_id;
} }
......
...@@ -50,7 +50,10 @@ BiffStructurePtr DXFNumUsr::clone() ...@@ -50,7 +50,10 @@ BiffStructurePtr DXFNumUsr::clone()
void DXFNumUsr::load(CFRecord& record) void DXFNumUsr::load(CFRecord& record)
{ {
record >> cb >> fmt; record >> cb;
fmt.setSize(cb);
record >> fmt;
} }
......
...@@ -50,7 +50,6 @@ public: ...@@ -50,7 +50,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned short cb; unsigned short cb;
XLUnicodeString fmt; XLUnicodeString fmt;
}; };
......
...@@ -45,6 +45,12 @@ BiffStructurePtr Feat11FdaAutoFilter::clone() ...@@ -45,6 +45,12 @@ BiffStructurePtr Feat11FdaAutoFilter::clone()
void Feat11FdaAutoFilter::load(CFRecord& record) void Feat11FdaAutoFilter::load(CFRecord& record)
{ {
record >> cbAutoFilter; record >> cbAutoFilter;
if (cbAutoFilter >= 0xffff0000)
{
//LCA BI - Financial Report Usage2010.xls
return;
}
record.skipNunBytes(2); record.skipNunBytes(2);
if (cbAutoFilter > 0 && cbAutoFilter < 2080) if (cbAutoFilter > 0 && cbAutoFilter < 2080)
......
...@@ -77,14 +77,12 @@ void Feat11FieldDataItem::load(CFRecord& record) ...@@ -77,14 +77,12 @@ void Feat11FieldDataItem::load(CFRecord& record)
{ {
dxfFmtAgg.size = cbFmtAgg; dxfFmtAgg.size = cbFmtAgg;
record >> dxfFmtAgg; record >> dxfFmtAgg;
} }
if (cbFmtInsertRow > 0) if (cbFmtInsertRow > 0)
{ {
dxfFmtInsertRow.size = cbFmtInsertRow; dxfFmtInsertRow.size = cbFmtInsertRow;
record >> dxfFmtInsertRow; record >> dxfFmtInsertRow;
} }
if (fAutoFilter) if (fAutoFilter)
{ {
record >> AutoFilter; record >> AutoFilter;
...@@ -92,9 +90,8 @@ void Feat11FieldDataItem::load(CFRecord& record) ...@@ -92,9 +90,8 @@ void Feat11FieldDataItem::load(CFRecord& record)
if (fLoadXmapi) if (fLoadXmapi)
{ {
record >> AutoFilter; record >> rgXmap;
} }
if (fLoadFmla) if (fLoadFmla)
{ {
fmla.load(record); fmla.load(record);
...@@ -110,8 +107,10 @@ void Feat11FieldDataItem::load(CFRecord& record) ...@@ -110,8 +107,10 @@ void Feat11FieldDataItem::load(CFRecord& record)
totalFmla.load(record); totalFmla.load(record);
} }
} }
record >> strTotal; if (fLoadTotalStr)
{
record >> strTotal;
}
if (lt == 0x00000001) if (lt == 0x00000001)
{ {
wssInfo.lfdt = lfdt; wssInfo.lfdt = lfdt;
......
...@@ -122,8 +122,6 @@ void OfficeArtFOPTE::load(XLS::CFRecord& record) ...@@ -122,8 +122,6 @@ void OfficeArtFOPTE::load(XLS::CFRecord& record)
opid = GETBITS(flags, 0, 13); opid = GETBITS(flags, 0, 13);
fBid = GETBIT(flags, 14); fBid = GETBIT(flags, 14);
fComplex = GETBIT(flags, 15); fComplex = GETBIT(flags, 15);
// TODO: complex data shall be parsed here
} }
OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record) OfficeArtFOPTEPtr OfficeArtFOPTE::load_and_create(XLS::CFRecord& record)
......
...@@ -31,11 +31,13 @@ ...@@ -31,11 +31,13 @@
*/ */
#include "AUTOFILTER.h" #include "AUTOFILTER.h"
#include <Logic/Biff_records/AutoFilterInfo.h> #include "SORTDATA12.h"
#include <Logic/Biff_records/AutoFilter12.h>
#include <Logic/Biff_records/AutoFilter.h> #include "../Biff_records/AutoFilterInfo.h"
#include <Logic/Biff_records/ContinueFrt12.h> #include "../Biff_records/AutoFilter12.h"
#include <Logic/Biff_unions/SORTDATA12.h> #include "../Biff_records/AutoFilter.h"
#include "../Biff_records/ContinueFrt12.h"
#include "../Biff_structures/AF12Criteria.h"
namespace XLS namespace XLS
{ {
...@@ -45,12 +47,10 @@ AUTOFILTER::AUTOFILTER() ...@@ -45,12 +47,10 @@ AUTOFILTER::AUTOFILTER()
{ {
} }
AUTOFILTER::~AUTOFILTER() AUTOFILTER::~AUTOFILTER()
{ {
} }
class Parenthesis_AUTOFILTER_1: public ABNFParenthesis class Parenthesis_AUTOFILTER_1: public ABNFParenthesis
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(Parenthesis_AUTOFILTER_1) BASE_OBJECT_DEFINE_CLASS_NAME(Parenthesis_AUTOFILTER_1)
...@@ -79,7 +79,6 @@ BaseObjectPtr AUTOFILTER::clone() ...@@ -79,7 +79,6 @@ BaseObjectPtr AUTOFILTER::clone()
return BaseObjectPtr(new AUTOFILTER(*this)); return BaseObjectPtr(new AUTOFILTER(*this));
} }
// AUTOFILTER = AutoFilterInfo *(AutoFilter / (AutoFilter12 *ContinueFrt12)) *SORTDATA12 // AUTOFILTER = AutoFilterInfo *(AutoFilter / (AutoFilter12 *ContinueFrt12)) *SORTDATA12
const bool AUTOFILTER::loadContent(BinProcessor& proc) const bool AUTOFILTER::loadContent(BinProcessor& proc)
{ {
......
...@@ -31,13 +31,14 @@ ...@@ -31,13 +31,14 @@
*/ */
#include "CONDFMTS.h" #include "CONDFMTS.h"
#include <Logic/Biff_unions/CONDFMT.h> #include "CONDFMT.h"
#include <Logic/Biff_unions/CONDFMT12.h> #include "CONDFMT12.h"
#include <Logic/Biff_records/CFEx.h>
#include <Logic/Biff_records/CF12.h> #include "../Biff_records/CFEx.h"
#include <Logic/Biff_records/CF.h> #include "../Biff_records/CF12.h"
#include <Logic/Biff_records/CondFmt.h> #include "../Biff_records/CF.h"
#include <Logic/Biff_records/CondFmt12.h> #include "../Biff_records/CondFmt.h"
#include "../Biff_records/CondFmt12.h"
namespace XLS namespace XLS
{ {
...@@ -84,7 +85,9 @@ public: ...@@ -84,7 +85,9 @@ public:
{ {
return false; return false;
} }
//proc.optional<CF12>(); // TODO: uncomment this and pass a base cell reference to the constructor CellRef ref;
CF12 cf (ref);
proc.optional(cf);
return true; return true;
}; };
}; };
...@@ -113,18 +116,27 @@ const bool CONDFMTS::loadContent(BinProcessor& proc) ...@@ -113,18 +116,27 @@ const bool CONDFMTS::loadContent(BinProcessor& proc)
count = proc.repeated<Parenthesis_CONDFMTS_2>(0, 0); count = proc.repeated<Parenthesis_CONDFMTS_2>(0, 0);
if (count > 0) res = true; if (count > 0) res = true;
while(count > 0)
while(!elements_.empty())
{ {
m_arCFEx.insert(m_arCFEx.begin(), elements_.back()); if (elements_.front()->get_type() == typeCFEx)
elements_.pop_back(); {
count--; _data_ex data_ex;
} data_ex.ex = elements_.front();
m_arCFEx.push_back(data_ex);
}
else
{
if (!m_arCFEx.empty())
m_arCFEx.back().cf12 = elements_.front();
}
elements_.pop_front();
}
//----------------------------------------------------------------------------
for (size_t i = 0 ; i < m_arCFEx.size(); i++) for (size_t i = 0 ; i < m_arCFEx.size(); i++)
{ {
if (!m_arCFEx[i]) continue;
CFEx * cfEx = dynamic_cast<CFEx *>(m_arCFEx[i].get()); CFEx * cfEx = dynamic_cast<CFEx *>(m_arCFEx[i].ex.get());
if (cfEx) if (cfEx)
{ {
size_t ind_cf = cfEx->content.icf; size_t ind_cf = cfEx->content.icf;
...@@ -139,7 +151,10 @@ const bool CONDFMTS::loadContent(BinProcessor& proc) ...@@ -139,7 +151,10 @@ const bool CONDFMTS::loadContent(BinProcessor& proc)
{ {
CF* cf = dynamic_cast<CF *>(CONDFMT_->m_arCF[ind_cf].get()); CF* cf = dynamic_cast<CF *>(CONDFMT_->m_arCF[ind_cf].get());
if (cf) if (cf)
cf->m_CFEx = m_arCFEx[i]; {
cf->m_CFEx = m_arCFEx[i].ex;
cf->m_CF12 = m_arCFEx[i].cf12;
}
} }
} }
...@@ -151,7 +166,10 @@ const bool CONDFMTS::loadContent(BinProcessor& proc) ...@@ -151,7 +166,10 @@ const bool CONDFMTS::loadContent(BinProcessor& proc)
{ {
CF12* cf = dynamic_cast<CF12 *>(CONDFMT12_->m_arCF12[ind_cf].get()); CF12* cf = dynamic_cast<CF12 *>(CONDFMT12_->m_arCF12[ind_cf].get());
if (cf) if (cf)
cf->m_CFEx = m_arCFEx[i]; {
cf->m_CFEx = m_arCFEx[i].ex;
cf->m_CF12_2 = m_arCFEx[i].cf12;
}
} }
} }
} }
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace XLS namespace XLS
{ {
// Logical representation of CONDFMTS union of records
class CONDFMTS: public CompositeObject class CONDFMTS: public CompositeObject
{ {
BASE_OBJECT_DEFINE_CLASS_NAME(CONDFMTS) BASE_OBJECT_DEFINE_CLASS_NAME(CONDFMTS)
...@@ -54,7 +52,13 @@ public: ...@@ -54,7 +52,13 @@ public:
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
std::vector<BaseObjectPtr> m_arCONDFMT; //CONDFMT or CONDFMT12 std::vector<BaseObjectPtr> m_arCONDFMT; //CONDFMT or CONDFMT12
std::vector<BaseObjectPtr> m_arCFEx;
struct _data_ex
{
BaseObjectPtr ex;
BaseObjectPtr cf12;
};
std::vector<_data_ex> m_arCFEx;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -40,11 +40,14 @@ ...@@ -40,11 +40,14 @@
#include "../Biff_records/AutoFilter12.h" #include "../Biff_records/AutoFilter12.h"
#include "../Biff_records/ContinueFrt12.h" #include "../Biff_records/ContinueFrt12.h"
#include "../Biff_records/List12.h" #include "../Biff_records/List12.h"
#include "../Biff_records/SortData.h"
#include "../Biff_structures/List12BlockLevel.h" #include "../Biff_structures/List12BlockLevel.h"
#include "../Biff_structures/List12TableStyleClientInfo.h" #include "../Biff_structures/List12TableStyleClientInfo.h"
#include "../Biff_structures/List12DisplayName.h" #include "../Biff_structures/List12DisplayName.h"
#include "../Biff_structures/Feat11FieldDataItem.h" #include "../Biff_structures/Feat11FieldDataItem.h"
#include "../Biff_structures/AF12Criteria.h"
#include "../Biff_structures/SortCond12.h"
namespace XLS namespace XLS
{ {
...@@ -154,8 +157,10 @@ int FEAT11::serialize(std::wostream & strm, size_t index) ...@@ -154,8 +157,10 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
{ {
FeatHdr11 * feature = dynamic_cast<FeatHdr11*>(m_FeatHdr11.get()); FeatHdr11 * feature = dynamic_cast<FeatHdr11*>(m_FeatHdr11.get());
Feature11 * feature11 = dynamic_cast<Feature11*>(m_arFEAT[index].m_Feature.get()); Feature11 *feature11 = dynamic_cast<Feature11*>(m_arFEAT[index].m_Feature.get());
Feature12 * feature12 = dynamic_cast<Feature12*>(m_arFEAT[index].m_Feature.get()); Feature12 *feature12 = dynamic_cast<Feature12*>(m_arFEAT[index].m_Feature.get());
AutoFilter12 *filter = dynamic_cast<AutoFilter12*>(m_arFEAT[index].m_AutoFilter12.get());
SORTDATA12 *sort = dynamic_cast<SORTDATA12*>(m_arFEAT[index].m_SORTDATA12.get());
if (feature12 && !feature11) if (feature12 && !feature11)
{ {
...@@ -176,34 +181,78 @@ int FEAT11::serialize(std::wostream & strm, size_t index) ...@@ -176,34 +181,78 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
if (!display_name) display_name = dynamic_cast<List12DisplayName*> (list_prop->rgbList12.get()); if (!display_name) display_name = dynamic_cast<List12DisplayName*> (list_prop->rgbList12.get());
} }
//---------------------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------------------
std::wstring display, comment;
if (display_name)
{
display = display_name->stListName.value();
comment = display_name->stListComment.value();
}
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"table") CP_XML_NODE(L"table")
{ {
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"); CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
if (display_name)
{
if (!display_name->stListName.value().empty())
CP_XML_ATTR(L"displayName", display_name->stListName.value());
if (!display_name->stListComment.value().empty())
CP_XML_ATTR(L"comment", display_name->stListComment.value());
}
if (block_level)
{
if (!block_level->stData.value().empty())
CP_XML_ATTR(L"dataCellStyle", block_level->stData.value());
}
if (feature11) if (feature11)
{ {
CP_XML_ATTR(L"id", feature11->rgbFeat.idList); if (display.empty()) display = feature11->rgbFeat.rgbName.value();
CP_XML_ATTR(L"name", feature11->rgbFeat.rgbName.value());
CP_XML_ATTR(L"ref", feature11->sqref); CP_XML_ATTR(L"id", feature11->rgbFeat.idList);
CP_XML_ATTR(L"name", feature11->rgbFeat.rgbName.value());
CP_XML_ATTR(L"displayName", display);
CP_XML_ATTR(L"ref", feature11->sqref);
if (!comment.empty())
CP_XML_ATTR(L"comment", comment);
if (feature11->rgbFeat.fAutoFilter) if (block_level)
{
if (!block_level->stData.value().empty())
CP_XML_ATTR(L"dataCellStyle", block_level->stData.value());
}
if (feature11->rgbFeat.fAutoFilter && (filter || sort))
{ {
CP_XML_NODE(L"autoFilter") if(sort)
{
SortData *sort_data = dynamic_cast<SortData*>(sort->m_SortData.get());
CP_XML_NODE(L"autoFilter")
{
//if (filter)
//else
CP_XML_ATTR(L"ref", sort_data->rfx);
}
CP_XML_NODE(L"sortState")
{
CP_XML_ATTR(L"ref", sort_data->rfx);
for (size_t s = 0; s < sort_data->sortCond12Array.size(); s++)
{
SortCond12 *sort_cond = dynamic_cast<SortCond12*>(sort_data->sortCond12Array[s].get());
CP_XML_NODE(L"sortCondition")
{
CP_XML_ATTR(L"descending", sort_cond->fSortDes);
CP_XML_ATTR(L"ref", sort_cond->rfx.toString());
}
}
}
}
else
{ {
CP_XML_ATTR(L"ref", feature11->sqref); CP_XML_NODE(L"autoFilter")
{
//CP_XML_ATTR(L"ref", filter->rfx);
for (size_t k = 0 ; k < (std::min)((size_t)1, filter->arAF12Criteries.size()); k++)
{
AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(filter->arAF12Criteries[k].get());
if (af12Criteria == NULL) continue;
//CP_XML_NODE(L"filter")
{
//CP_XML_ATTR(L"val", af12Criteria->_str);
CP_XML_ATTR(L"ref", af12Criteria->_str);
}
}
}
} }
} }
...@@ -228,6 +277,7 @@ int FEAT11::serialize(std::wostream & strm, size_t index) ...@@ -228,6 +277,7 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
//if (!field->stData.value().empty()) //if (!field->stData.value().empty())
// CP_XML_ATTR(L"dataDxfId", field->stData.value()); // CP_XML_ATTR(L"dataDxfId", field->stData.value());
} }
//totalsRowFunction
} }
} }
} }
......
...@@ -217,9 +217,9 @@ int PAGESETUP::serialize(std::wostream & stream) ...@@ -217,9 +217,9 @@ int PAGESETUP::serialize(std::wostream & stream)
if (!r) CP_XML_ATTR(L"right" , 0.75); if (!r) CP_XML_ATTR(L"right" , 0.75);
} }
CP_XML_NODE(L"pageSetup") //CP_XML_NODE(L"pageSetup") - для chartsheet аккуратнее
{ //{
} //}
if (m_Header || m_Footer) if (m_Header || m_Footer)
{ {
......
...@@ -163,19 +163,19 @@ int TABLESTYLES::serialize(std::wostream & stream) ...@@ -163,19 +163,19 @@ int TABLESTYLES::serialize(std::wostream & stream)
case 0x0000000a: CP_XML_ATTR(L"type", L"lastHeaderCell"); break; case 0x0000000a: CP_XML_ATTR(L"type", L"lastHeaderCell"); break;
case 0x0000000b: CP_XML_ATTR(L"type", L"firstTotalCell"); break; case 0x0000000b: CP_XML_ATTR(L"type", L"firstTotalCell"); break;
case 0x0000000c: CP_XML_ATTR(L"type", L"lastTotalCell"); break; case 0x0000000c: CP_XML_ATTR(L"type", L"lastTotalCell"); break;
case 0x0000000d: CP_XML_ATTR(L"type", L"firstSubtotalColumn"); break;//?? case 0x0000000d: CP_XML_ATTR(L"type", L"firstSubtotalColumn"); break;
case 0x0000000e: CP_XML_ATTR(L"type", L"firstSubtotalColumn"); break;//even case 0x0000000e: CP_XML_ATTR(L"type", L"secondSubtotalColumn"); break;
case 0x0000000f: CP_XML_ATTR(L"type", L"lastSubtotalColumn"); break;//odd case 0x0000000f: CP_XML_ATTR(L"type", L"thirdSubtotalColumn"); break;
case 0x00000010: CP_XML_ATTR(L"type", L"firstSubtotalRow"); break;//?? case 0x00000010: CP_XML_ATTR(L"type", L"firstSubtotalRow"); break;
case 0x00000011: CP_XML_ATTR(L"type", L"firstSubtotalRow"); break;//even case 0x00000011: CP_XML_ATTR(L"type", L"secondSubtotalRow"); break;
case 0x00000012: CP_XML_ATTR(L"type", L"lastSubtotalRow"); break;//odd case 0x00000012: CP_XML_ATTR(L"type", L"thirdSubtotalRow"); break;
case 0x00000013: CP_XML_ATTR(L"type", L"blankRow"); break; case 0x00000013: CP_XML_ATTR(L"type", L"blankRow"); break;
case 0x00000014: CP_XML_ATTR(L"type", L"firstColumnSubheading");break; case 0x00000014: CP_XML_ATTR(L"type", L"firstColumnSubheading");break;
case 0x00000015: CP_XML_ATTR(L"type", L"firstColumnSubheading");break; case 0x00000015: CP_XML_ATTR(L"type", L"secondColumnSubheading");break;
case 0x00000016: CP_XML_ATTR(L"type", L"lastColumnSubheading"); break; case 0x00000016: CP_XML_ATTR(L"type", L"thirdColumnSubheading");break;
case 0x00000017: CP_XML_ATTR(L"type", L"firstRowSubheading"); break; case 0x00000017: CP_XML_ATTR(L"type", L"firstRowSubheading"); break;
case 0x00000018: CP_XML_ATTR(L"type", L"firstRowSubheading"); break; case 0x00000018: CP_XML_ATTR(L"type", L"secondRowSubheading"); break;
case 0x00000019: CP_XML_ATTR(L"type", L"lastRowSubheading"); break; case 0x00000019: CP_XML_ATTR(L"type", L"thirdRowSubheading"); break;
case 0x0000001a: CP_XML_ATTR(L"type", L"pageFieldLabels"); break; case 0x0000001a: CP_XML_ATTR(L"type", L"pageFieldLabels"); break;
case 0x0000001b: CP_XML_ATTR(L"type", L"pageFieldValues"); break; case 0x0000001b: CP_XML_ATTR(L"type", L"pageFieldValues"); break;
} }
......
...@@ -215,7 +215,6 @@ void GlobalWorkbookInfo::GetDigitFontSizePixels() ...@@ -215,7 +215,6 @@ void GlobalWorkbookInfo::GetDigitFontSizePixels()
} }
catch(...) catch(...)
{ {
// TODO: default value!
} }
} }
......
...@@ -546,6 +546,7 @@ enum ElementType ...@@ -546,6 +546,7 @@ enum ElementType
typeBopPopCustomPiesIndices, typeBopPopCustomPiesIndices,
typeIXFCellMulBlankSpecial, typeIXFCellMulBlankSpecial,
typeAddinUdf, typeAddinUdf,
typeAF12CellIcon,
typeAF12Criteria, typeAF12Criteria,
typeAFDOper, typeAFDOper,
typeAFDOperRk, typeAFDOperRk,
......
...@@ -128,10 +128,6 @@ void xlsx_conversion_context::set_sheet_type(int type) ...@@ -128,10 +128,6 @@ void xlsx_conversion_context::set_sheet_type(int type)
if (sheets_.empty()) return; if (sheets_.empty()) return;
sheets_.back()->type = type; sheets_.back()->type = type;
if (type == 3)
{
get_sheet_context().set_chart_view();
}
} }
void xlsx_conversion_context::start_table() void xlsx_conversion_context::start_table()
{ {
...@@ -170,6 +166,8 @@ void xlsx_conversion_context::set_sheet_id(int id) ...@@ -170,6 +166,8 @@ void xlsx_conversion_context::set_sheet_id(int id)
{ {
if (id < 0) return; if (id < 0) return;
sheets_.back()->id = id; sheets_.back()->id = id;
sheets_map_.insert(std::make_pair(id, sheets_.size() - 1));
} }
void xlsx_conversion_context::start_chart() void xlsx_conversion_context::start_chart()
{ {
...@@ -246,8 +244,11 @@ void xlsx_conversion_context::end_document() ...@@ -246,8 +244,11 @@ void xlsx_conversion_context::end_document()
{ {
std::wstringstream workbook_content; std::wstringstream workbook_content;
for (size_t i = 0; i < sheets_.size(); i++) //for (size_t i = 0; i < sheets_.size(); i++) нужно по id
for (std::map<int, int>::iterator it = sheets_map_.begin(); it != sheets_map_.end(); it++)
{ {
int i = it->second;
package::sheet_content_ptr content = package::sheet_content::create(); package::sheet_content_ptr content = package::sheet_content::create();
const std::wstring slideRId = std::wstring(L"sId") + std::to_wstring(i + 1); const std::wstring slideRId = std::wstring(L"sId") + std::to_wstring(i + 1);
......
...@@ -130,7 +130,9 @@ private: ...@@ -130,7 +130,9 @@ private:
size_t next_vml_file_id_; //используется для footer/header & comments size_t next_vml_file_id_; //используется для footer/header & comments
std::map<int, int> sheets_map_;
std::vector<xlsx_xml_worksheet_ptr> sheets_; std::vector<xlsx_xml_worksheet_ptr> sheets_;
std::wstring connections_; std::wstring connections_;
std::map<std::wstring, std::wstring>query_tables_; std::map<std::wstring, std::wstring>query_tables_;
std::map<std::wstring, std::wstring>control_props_; std::map<std::wstring, std::wstring>control_props_;
......
...@@ -59,21 +59,6 @@ void xlsx_sheet_context::start_table() ...@@ -59,21 +59,6 @@ void xlsx_sheet_context::start_table()
tables_state_.push_back( table_state_ptr(new table_state(context_))); tables_state_.push_back( table_state_ptr(new table_state(context_)));
} }
void xlsx_sheet_context::set_chart_view()
{
CP_XML_WRITER(context_.current_sheet().sheetViews())
{
CP_XML_NODE(L"sheetViews")
{
CP_XML_NODE(L"sheetView")
{
CP_XML_ATTR(L"showGridLines", 0);
CP_XML_ATTR(L"workbookViewId", 0);
}
}
}
}
void xlsx_sheet_context::end_table() void xlsx_sheet_context::end_table()
{ {
if (!get_drawing_context().empty()) if (!get_drawing_context().empty())
......
...@@ -59,7 +59,6 @@ public: ...@@ -59,7 +59,6 @@ public:
xlsx_sheet_context(xlsx_conversion_context & Context); xlsx_sheet_context(xlsx_conversion_context & Context);
void start_table(); void start_table();
void set_chart_view();
void end_table(); void end_table();
xlsx_drawing_context & get_drawing_context(); xlsx_drawing_context & get_drawing_context();
......
...@@ -375,6 +375,7 @@ SOURCES += \ ...@@ -375,6 +375,7 @@ SOURCES += \
../XlsFormat/Logic/Biff_structures/AFDOper.cpp \ ../XlsFormat/Logic/Biff_structures/AFDOper.cpp \
../XlsFormat/Logic/Biff_structures/AFDOperRk.cpp \ ../XlsFormat/Logic/Biff_structures/AFDOperRk.cpp \
../XlsFormat/Logic/Biff_structures/AFDOperStr.cpp \ ../XlsFormat/Logic/Biff_structures/AFDOperStr.cpp \
../XlsFormat/Logic/Biff_structures/AF12CellIcon.cpp \
../XlsFormat/Logic/Biff_structures/AntiMoniker.cpp \ ../XlsFormat/Logic/Biff_structures/AntiMoniker.cpp \
../XlsFormat/Logic/Biff_structures/ArrayParsedFormula.cpp \ ../XlsFormat/Logic/Biff_structures/ArrayParsedFormula.cpp \
../XlsFormat/Logic/Biff_structures/Bes.cpp \ ../XlsFormat/Logic/Biff_structures/Bes.cpp \
...@@ -1183,6 +1184,7 @@ HEADERS += \ ...@@ -1183,6 +1184,7 @@ HEADERS += \
../XlsFormat/Logging/Logger.h \ ../XlsFormat/Logging/Logger.h \
../XlsFormat/Logic/Biff_structures/AddinUdf.h \ ../XlsFormat/Logic/Biff_structures/AddinUdf.h \
../XlsFormat/Logic/Biff_structures/AF12Criteria.h \ ../XlsFormat/Logic/Biff_structures/AF12Criteria.h \
../XlsFormat/Logic/Biff_structures/AF12CellIcon.h \
../XlsFormat/Logic/Biff_structures/AFDOper.h \ ../XlsFormat/Logic/Biff_structures/AFDOper.h \
../XlsFormat/Logic/Biff_structures/AFDOperRk.h \ ../XlsFormat/Logic/Biff_structures/AFDOperRk.h \
../XlsFormat/Logic/Biff_structures/AFDOperStr.h \ ../XlsFormat/Logic/Biff_structures/AFDOperStr.h \
......
...@@ -624,6 +624,7 @@ ...@@ -624,6 +624,7 @@
#include "../XlsFormat/Logic/Biff_structures/Feat11Fmla.cpp" #include "../XlsFormat/Logic/Biff_structures/Feat11Fmla.cpp"
#include "../XlsFormat/Logic/Biff_structures/Feat11WSSListInfo.cpp" #include "../XlsFormat/Logic/Biff_structures/Feat11WSSListInfo.cpp"
#include "../XlsFormat/Logic/Biff_structures/Feat11XMap.cpp" #include "../XlsFormat/Logic/Biff_structures/Feat11XMap.cpp"
#include "../XlsFormat/Logic/Biff_structures/AF12CellIcon.cpp"
#include "../XlsFormat/Logic/Biff_unions/AI.cpp" #include "../XlsFormat/Logic/Biff_unions/AI.cpp"
#include "../XlsFormat/Logic/Biff_unions/ATTACHEDLABEL_bu.cpp" #include "../XlsFormat/Logic/Biff_unions/ATTACHEDLABEL_bu.cpp"
......
...@@ -3121,6 +3121,14 @@ ...@@ -3121,6 +3121,14 @@
RelativePath="..\XlsFormat\Logic\Biff_structures\AddinUdf.h" RelativePath="..\XlsFormat\Logic\Biff_structures\AddinUdf.h"
> >
</File> </File>
<File
RelativePath="..\XlsFormat\Logic\Biff_structures\AF12CellIcon.cpp"
>
</File>
<File
RelativePath="..\XlsFormat\Logic\Biff_structures\AF12CellIcon.h"
>
</File>
<File <File
RelativePath="..\XlsFormat\Logic\Biff_structures\AF12Criteria.cpp" RelativePath="..\XlsFormat\Logic\Biff_structures\AF12Criteria.cpp"
> >
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment