Commit 6f0f09cd authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

XlsFormat - autofilters & custom views

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68020 954022d7-b5bf-4e40-9824-e11837661b57
parent 86274b3b
...@@ -34,22 +34,20 @@ void AutoFilter::readFields(CFRecord& record) ...@@ -34,22 +34,20 @@ void AutoFilter::readFields(CFRecord& record)
unsigned short flags; unsigned short flags;
record >> iEntry >> flags; record >> iEntry >> flags;
wJoin = static_cast<unsigned char>(GETBITS(flags, 0, 1));
fSimple1 = GETBIT(flags, 2); wJoin = static_cast<unsigned char>(GETBITS(flags, 0, 1));
fSimple2 = GETBIT(flags, 3);
fTopN = GETBIT(flags, 4); fSimple1 = GETBIT(flags, 2);
fTop = GETBIT(flags, 5); fSimple2 = GETBIT(flags, 3);
fPercent = GETBIT(flags, 6); fTopN = GETBIT(flags, 4);
wTopN = static_cast<unsigned short>(GETBITS(flags, 7, 15)); fTop = GETBIT(flags, 5); //top(1) or bottom(0)
fPercent = GETBIT(flags, 6);
unsigned short _iEntry = iEntry;
unsigned char _wJoin = wJoin; wTopN = static_cast<unsigned short>(GETBITS(flags, 7, 15));
unsigned char _fSimple1 = fSimple1;
unsigned char _fSimple2 = fSimple2; unsigned short _iEntry = iEntry;
unsigned char _fTopN = fTopN; unsigned char _wJoin = wJoin;
unsigned char _fTop = fTop; unsigned short _wTopN = wTopN;
unsigned char _fPercent = fPercent;
unsigned short _wTopN = wTopN;
if (fTopN != 1) if (fTopN != 1)
record >> doper1; record >> doper1;
...@@ -64,15 +62,32 @@ void AutoFilter::readFields(CFRecord& record) ...@@ -64,15 +62,32 @@ void AutoFilter::readFields(CFRecord& record)
if (doper1.vt == BIFF_BYTE(0x06)) if (doper1.vt == BIFF_BYTE(0x06))
{ {
str1.setSize(doper1.vtValue.cch); XLUnicodeStringNoCch s;
record >> str1; s.setSize(doper1.vtValue.cch);
record >> s;
str1 = s.value();
} }
if (doper2.vt == BIFF_BYTE(0x06)) if (doper2.vt == BIFF_BYTE(0x06))
{ {
str2.setSize(doper2.vtValue.cch); XLUnicodeStringNoCch s;
record >> str2; s.setSize(doper2.vtValue.cch);
record >> s;
str2 = s.value();
} }
if (record.getRdPtr() < record.getDataSize())
{
int sz = record.getDataSize() - record.getRdPtr();
char *dd = new char [sz];
memcpy(dd, record.getCurData<char>(), sz);
record.skipNunBytes(sz);
delete []dd;
}
} }
} // namespace XLS } // namespace XLS
......
...@@ -24,39 +24,25 @@ public: ...@@ -24,39 +24,25 @@ public:
static const ElementType type = typeAutoFilter; static const ElementType type = typeAutoFilter;
BIFF_WORD iEntry; BIFF_WORD iEntry;
BIFF_BYTE wJoin; BIFF_BYTE wJoin;
BIFF_BYTE fSimple1;
BIFF_BYTE fSimple2; bool fSimple1;
BIFF_BYTE fTopN; bool fSimple2;
bool fTopN;
bool fPercent;
BIFF_BYTE fTop; BIFF_BYTE fTop;
BIFF_BYTE fPercent;
BIFF_WORD wTopN; BIFF_WORD wTopN;
AFDOper doper1; AFDOper doper1;
AFDOper doper2; AFDOper doper2;
bool m_bAutoFilter12; bool m_bAutoFilter12;
XLUnicodeStringNoCch str1;
XLUnicodeStringNoCch str2; std::wstring str1;
std::wstring str2;
//-----------------------------
//if (!m_bAutoFilter12)
//{
// if (fSimple1)
// {
// //BO_ATTRIB_MARKUP_ATTRIB(str1)
// //BO_ATTRIB_MARKUP_COMPLEX(doper1)
// }
// if (fSimple2)
// {
// //BO_ATTRIB_MARKUP_ATTRIB(str2)
// //BO_ATTRIB_MARKUP_COMPLEX(doper2)
// }
//}
}; };
......
...@@ -28,24 +28,19 @@ public: ...@@ -28,24 +28,19 @@ public:
static const ElementType type = typeAutoFilter12; static const ElementType type = typeAutoFilter12;
FrtRefHeader frtRefHeader; FrtRefHeader frtRefHeader;
BIFF_WORD iEntry; BIFF_WORD iEntry;
BIFF_DWORD fHideArrow; BIFF_DWORD fHideArrow;
BIFF_DWORD ft; BIFF_DWORD ft;
BIFF_DWORD cft; BIFF_DWORD cft;
BIFF_DWORD cCriteria; BIFF_DWORD cCriteria;
BIFF_DWORD cDateGroupings; BIFF_DWORD cDateGroupings;
BIFF_DWORD idList; BIFF_DWORD idList;
BiffStructurePtrVector rgbAF12Criteries; BiffStructurePtrVector rgbAF12Criteries;
//----------------------------- //-----------------------------
// BIFF_WORD userName;
//if ( (ft == BIFF_DWORD(0)) && (cCriteria > 0) )
//{
// //BO_ATTRIB_MARKUP_VECTOR_COMPLEX(rgbAF12Criteries, AF12Criteria)
//}
std::vector<BaseObjectPtr> m_arContinueFrt12;
}; };
......
...@@ -56,5 +56,37 @@ void Selection::readFields(CFRecord& record) ...@@ -56,5 +56,37 @@ void Selection::readFields(CFRecord& record)
sqref = sqref_str; sqref = sqref_str;
} }
int Selection::serialize(std::wostream & stream)
{
if (pnn == (unsigned char)PaneType::REVTPNNTOPLEFT &&
activeCell == L"A1" &&
irefAct == (_INT16)0 &&
sqref == L"A1") return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"selection")
{
switch(pnn)
{
case PaneType::REVTPNNBOTRIGHT: CP_XML_ATTR(L"pane", L"bottomRight"); break;
case PaneType::REVTPNNTOPRIGHT: CP_XML_ATTR(L"pane", L"topRight"); break;
case PaneType::REVTPNNBOTLEFT: CP_XML_ATTR(L"pane", L"bottomLeft"); break;
// default: CP_XML_ATTR(L"pane", L"topLeft");
}
if (*activeCell.value() != L"A1")
CP_XML_ATTR(L"activeCell", *activeCell.value());
if (irefAct != 0)
CP_XML_ATTR(L"activeCellId", irefAct);
if (*sqref.value() != L"A1")
CP_XML_ATTR(L"sqref", *sqref.value());
}
}
return 0;
}
} // namespace XLS } // namespace XLS
...@@ -24,6 +24,8 @@ public: ...@@ -24,6 +24,8 @@ public:
static const ElementType type = typeSelection; static const ElementType type = typeSelection;
int serialize(std::wostream & stream);
//----------------------------- //-----------------------------
PaneType pnn; PaneType pnn;
......
...@@ -110,63 +110,106 @@ void UserBView::readFields(CFRecord& record) ...@@ -110,63 +110,106 @@ void UserBView::readFields(CFRecord& record)
record.skipNunBytes(4); // unused1 record.skipNunBytes(4); // unused1
record >> tabId; record >> tabId;
record.skipNunBytes(2); // reserved1 record.skipNunBytes(2); // reserved1
_GUID_ guid_num; _GUID_ guid_num;
record >> guid_num >> x >> y >> dx >> dy >> wTabRatio; record >> guid_num >> x >> y >> dx >> dy >> wTabRatio;
guid = STR::guid2bstr(guid_num); guid = STR::guid2bstr(guid_num);
unsigned short flags1; unsigned short flags1;
record >> flags1; record >> flags1;
fDspFmlaBar = GETBIT(flags1, 0); fDspFmlaBar = GETBIT(flags1, 0);
fDspStatus = GETBIT(flags1, 1); fDspStatus = GETBIT(flags1, 1);
unsigned char mdNoteDisp_num = GETBITS(flags1, 2, 3); unsigned char mdNoteDisp_num = GETBITS(flags1, 2, 3);
switch(mdNoteDisp_num) switch(mdNoteDisp_num)
{ {
case 0x0: case 0x0:
mdNoteDisp = std::wstring (L"commNone"); mdNoteDisp = std::wstring (L"commNone");
break; break;
case 0x1:
mdNoteDisp = std::wstring (L"commIndicator");
break;
case 0x2: case 0x2:
mdNoteDisp = std::wstring (L"commIndAndComment"); mdNoteDisp = std::wstring (L"commIndAndComment");
break; break;
case 0x1:
default: default:
throw;// EXCEPT::RT::WrongBiffRecord("Unsupported value of mdNoteDisp.", record.getTypeString()); mdNoteDisp = std::wstring (L"commIndicator");
break;
} }
fDspHScroll = GETBIT(flags1, 4); fDspHScroll = GETBIT(flags1, 4);
fDspVScroll = GETBIT(flags1, 5); fDspVScroll = GETBIT(flags1, 5);
fBotAdornment = GETBIT(flags1, 6); fBotAdornment = GETBIT(flags1, 6);
fZoom = GETBIT(flags1, 7); fZoom = GETBIT(flags1, 7);
unsigned char fHideObj_num = GETBITS(flags1, 8, 9); unsigned char fHideObj_num = GETBITS(flags1, 8, 9);
switch(fHideObj_num) switch(fHideObj_num)
{ {
case 0x0:
fHideObj = std::wstring (L"all");
break;
case 0x1: case 0x1:
fHideObj = std::wstring (L"placeholders"); fHideObj = std::wstring (L"placeholders");
break; break;
case 0x2: case 0x2:
fHideObj = std::wstring (L"none"); fHideObj = std::wstring (L"none");
break; break;
case 0x0:
default: default:
throw;// EXCEPT::RT::WrongBiffRecord("Unsupported value of fHideObj.", record.getTypeString()); fHideObj = std::wstring (L"all");
break;
} }
fPrintIncl = GETBIT(flags1, 10); fPrintIncl = GETBIT(flags1, 10);
fRowColIncl = GETBIT(flags1, 11); fRowColIncl = GETBIT(flags1, 11);
fInvalidTabId = GETBIT(flags1, 12); fInvalidTabId = GETBIT(flags1, 12);
fTimedUpdate = GETBIT(flags1, 13); fTimedUpdate = GETBIT(flags1, 13);
fAllMemChanges = GETBIT(flags1, 14); fAllMemChanges = GETBIT(flags1, 14);
fOnlySync = GETBIT(flags1, 15); fOnlySync = GETBIT(flags1, 15);
record.skipNunBytes(2); // unused2 record.skipNunBytes(2); // unused2
unsigned short flags2; unsigned short flags2;
record >> flags2; record >> flags2;
fPersonalView = GETBIT(flags2, 0);
fIconic = GETBIT(flags2, 1); fPersonalView = GETBIT(flags2, 0);
fIconic = GETBIT(flags2, 1);
record >> wMergeInterval >> st; record >> wMergeInterval >> st;
} }
int UserBView::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"customWorkbookView")
{
if (!st.value().empty())
{
CP_XML_ATTR(L"name", st.value());
}
CP_XML_ATTR(L"windowWidth", dx);
CP_XML_ATTR(L"windowHeight", dy);
CP_XML_ATTR(L"activeSheetId", tabId);
CP_XML_ATTR(L"guid", *guid.value());
CP_XML_ATTR(L"mergeInterval", wMergeInterval);
if (fTimedUpdate) CP_XML_ATTR(L"autoUpdate" , true);
if (fAllMemChanges) CP_XML_ATTR(L"changesSavedWin" , true);
if (!fRowColIncl) CP_XML_ATTR(L"includeHiddenRowCol", false);
if (!fPrintIncl) CP_XML_ATTR(L"includePrintSettings",false);
if (fZoom) CP_XML_ATTR(L"maximized" , true);
if (fIconic) CP_XML_ATTR(L"minimized" , true);
if (fOnlySync) CP_XML_ATTR(L"onlySync" , true);
if (fPersonalView) CP_XML_ATTR(L"personalView" , true);
if (!fDspFmlaBar) CP_XML_ATTR(L"showFormulaBar" , false);
if (!fDspHScroll) CP_XML_ATTR(L"showHorizontalScroll",false);
if (!fDspVScroll) CP_XML_ATTR(L"showVerticalScroll", false);
if (!fBotAdornment) CP_XML_ATTR(L"showSheetTabs" , false);
if (!fDspStatus) CP_XML_ATTR(L"showStatusbar" , false);
if (mdNoteDisp != L"commIndicator") CP_XML_ATTR(L"showComments", mdNoteDisp);
if (fHideObj != L"all") CP_XML_ATTR(L"showObjects" , fHideObj);
if (wTabRatio != 600) CP_XML_ATTR(L"tabRatio" , wTabRatio);
if (x != 0) CP_XML_ATTR(L"xWindow" , x);
if (y != 0) CP_XML_ATTR(L"yWindow" , y);
}
}
return 0;
}
} // namespace XLS } // namespace XLS
...@@ -23,23 +23,30 @@ public: ...@@ -23,23 +23,30 @@ public:
static const ElementType type = typeUserBView; static const ElementType type = typeUserBView;
int serialize(std::wostream & stream);
//----------------------------- //-----------------------------
BIFF_WORD tabId; BIFF_WORD tabId;
BIFF_BSTR guid; BIFF_BSTR guid;
BIFF_DWORD x; BIFF_DWORD x;
BIFF_DWORD y; BIFF_DWORD y;
BIFF_DWORD dx; BIFF_DWORD dx;
BIFF_DWORD dy; BIFF_DWORD dy;
BIFF_WORD wTabRatio; BIFF_WORD wTabRatio;
bool fDspFmlaBar; bool fDspFmlaBar;
bool fDspStatus; bool fDspStatus;
BIFF_BSTR mdNoteDisp;
std::wstring mdNoteDisp;
bool fDspHScroll; bool fDspHScroll;
bool fDspVScroll; bool fDspVScroll;
bool fBotAdornment; bool fBotAdornment;
bool fZoom; bool fZoom;
BIFF_BSTR fHideObj;
std::wstring fHideObj;
bool fPrintIncl; bool fPrintIncl;
bool fRowColIncl; bool fRowColIncl;
bool fInvalidTabId; bool fInvalidTabId;
...@@ -48,14 +55,10 @@ public: ...@@ -48,14 +55,10 @@ public:
bool fOnlySync; bool fOnlySync;
bool fPersonalView; bool fPersonalView;
bool fIconic; bool fIconic;
BIFF_WORD wMergeInterval;
BIFF_WORD wMergeInterval;
XLUnicodeString st; XLUnicodeString st;
//if(fPersonalView && fTimedUpdate)
//{
// //BO_ATTRIB_MARKUP_ATTRIB(wMergeInterval)
//}
}; };
} // namespace XLS } // namespace XLS
......
...@@ -108,22 +108,22 @@ void UserSViewBegin::readFields(CFRecord& record) ...@@ -108,22 +108,22 @@ void UserSViewBegin::readFields(CFRecord& record)
unsigned short flags; unsigned short flags;
record >> flags; record >> flags;
fShowBrks = GETBIT(flags, 0); fShowBrks = GETBIT(flags, 0);
fDspFmlaSv = GETBIT(flags, 1); fDspFmlaSv = GETBIT(flags, 1);
fDspGridSv = GETBIT(flags, 2); fDspGridSv = GETBIT(flags, 2);
fDspRwColSv = GETBIT(flags, 3); fDspRwColSv = GETBIT(flags, 3);
fDspGutsSv = GETBIT(flags, 4); fDspGutsSv = GETBIT(flags, 4);
fDspZerosSv = GETBIT(flags, 5); fDspZerosSv = GETBIT(flags, 5);
fHorizontal = GETBIT(flags, 6); fHorizontal = GETBIT(flags, 6);
fVertical = GETBIT(flags, 7); fVertical = GETBIT(flags, 7);
fPrintRwCol = GETBIT(flags, 8); fPrintRwCol = GETBIT(flags, 8);
fPrintGrid = GETBIT(flags, 9); fPrintGrid = GETBIT(flags, 9);
fFitToPage = GETBIT(flags, 10); fFitToPage = GETBIT(flags, 10);
fPrintArea = GETBIT(flags, 11); fPrintArea = GETBIT(flags, 11);
fOnePrintArea = GETBIT(flags, 12); fOnePrintArea = GETBIT(flags, 12);
fFilterMode = GETBIT(flags, 13); fFilterMode = GETBIT(flags, 13);
fEzFilter = GETBIT(flags, 14); fEzFilter = GETBIT(flags, 14);
fFrozen = GETBIT(flags, 15); fFrozen = GETBIT(flags, 15);
record >> flags; record >> flags;
...@@ -131,20 +131,19 @@ void UserSViewBegin::readFields(CFRecord& record) ...@@ -131,20 +131,19 @@ void UserSViewBegin::readFields(CFRecord& record)
record >> top_left; record >> top_left;
ref8TopLeft = static_cast<std::wstring >(top_left.getTopLeftCell()); ref8TopLeft = static_cast<std::wstring >(top_left.getTopLeftCell());
fFrozenNoSplit = GETBIT(flags, 0); fFrozenNoSplit = GETBIT(flags, 0);
fSplitV = GETBIT(flags, 1); fSplitV = GETBIT(flags, 1);
fSplitH = GETBIT(flags, 2); fSplitH = GETBIT(flags, 2);
fHiddenRw = GETBIT(flags, 3); fHiddenRw = GETBIT(flags, 3);
fHiddenCol = GETBIT(flags, 5); fHiddenCol = GETBIT(flags, 5);
fFilterUnique = GETBIT(flags, 9); fFilterUnique = GETBIT(flags, 9);
fSheetLayoutView = GETBIT(flags, 10); fSheetLayoutView = GETBIT(flags, 10);
fPageLayoutView = GETBIT(flags, 11); fPageLayoutView = GETBIT(flags, 11);
fRuler = GETBIT(flags, 13); fRuler = GETBIT(flags, 13);
record >> operNumX >> operNumY >> colRPane >> rwBPane; record >> operNumX >> operNumY >> colRPane >> rwBPane;
//todooo pane_top_left_cell = CellRef(fSplitH ? rwBPane : 0 , fSplitV ? colRPane : 0, true, true).toString();
//pane_top_left_cell = std::wstring (CellRef(fSplitH ? rwBPane : 0 , fSplitV ? colRPane : 0, true, true).toString().c_str());
} }
} // namespace XLS } // namespace XLS
......
...@@ -24,11 +24,11 @@ public: ...@@ -24,11 +24,11 @@ public:
static const ElementType type = typeUserSViewBegin; static const ElementType type = typeUserSViewBegin;
//----------------------------- //-----------------------------
BIFF_BSTR guid; BIFF_BSTR guid;
TabId iTabid; TabId iTabid;
BIFF_DWORD wScale; BIFF_DWORD wScale;
Icv icvHdr; Icv icvHdr;
PaneType pnnSel; PaneType pnnSel;
bool fShowBrks; bool fShowBrks;
bool fDspFmlaSv; bool fDspFmlaSv;
...@@ -57,13 +57,14 @@ public: ...@@ -57,13 +57,14 @@ public:
bool fPageLayoutView; bool fPageLayoutView;
bool fRuler; bool fRuler;
BIFF_BSTR ref8TopLeft; std::wstring ref8TopLeft;
BIFF_DOUBLE operNumX; BIFF_DOUBLE operNumX;
BIFF_DOUBLE operNumY; BIFF_DOUBLE operNumY;
ForwardOnlyParam<unsigned short> colRPane; ForwardOnlyParam<unsigned short> colRPane;
ForwardOnlyParam<unsigned short> rwBPane; ForwardOnlyParam<unsigned short> rwBPane;
BIFF_BSTR pane_top_left_cell; std::wstring pane_top_left_cell;
}; };
......
...@@ -20,17 +20,6 @@ AF12Criteria::~AF12Criteria() ...@@ -20,17 +20,6 @@ AF12Criteria::~AF12Criteria()
{ {
} }
//
//void AF12Criteria::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"str", _str);
//}
//
//
//void AF12Criteria::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
//}
void AF12Criteria::store(CFRecord& record) void AF12Criteria::store(CFRecord& record)
{ {
......
...@@ -24,6 +24,7 @@ public: ...@@ -24,6 +24,7 @@ public:
AFDOper doper; AFDOper doper;
XLUnicodeStringNoCch str; XLUnicodeStringNoCch str;
BIFF_BSTR _str; BIFF_BSTR _str;
}; };
......
...@@ -18,6 +18,16 @@ public: ...@@ -18,6 +18,16 @@ public:
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & stream);
BaseObjectPtr m_AutoFilterInfo;
std::vector<BaseObjectPtr> m_arFilters;
std::map<int, std::vector<BaseObjectPtr>> m_mapFilters12;
std::vector<BaseObjectPtr> m_arSORTDATA12;
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -37,7 +37,15 @@ public: ...@@ -37,7 +37,15 @@ public:
{ {
return false; return false;
} }
proc.repeated<ContinueFrt12>(0, 0); AutoFilter12 * af12 = dynamic_cast<AutoFilter12*>(elements_.back().get());
int count = proc.repeated<ContinueFrt12>(0, 0);
while(count > 0)
{
af12->m_arContinueFrt12.insert(af12->m_arContinueFrt12.begin(), elements_.back());
elements_.pop_back();
count--;
}
} }
return true; return true;
}; };
...@@ -57,11 +65,132 @@ const bool AUTOFILTER::loadContent(BinProcessor& proc) ...@@ -57,11 +65,132 @@ const bool AUTOFILTER::loadContent(BinProcessor& proc)
{ {
return false; return false;
} }
proc.repeated<Parenthesis_AUTOFILTER_1>(0, 0);
proc.repeated<SORTDATA12>(0, 0); pGlobalWorkbookInfoPtr = proc.getGlobalWorkbookInfo();
m_AutoFilterInfo = elements_.back();
elements_.pop_back();
int count = proc.repeated<Parenthesis_AUTOFILTER_1>(0, 0);
while(count > 0)
{
if (elements_.back()->get_type() == typeAutoFilter)
{
m_arFilters.insert(m_arFilters.begin(), elements_.back());
}
else
{
AutoFilter12* af12 = dynamic_cast<AutoFilter12*>(elements_.back().get());
if (af12)
{
int ind = af12->iEntry;
std::map<int, std::vector<BaseObjectPtr>>::iterator it = m_mapFilters12.find(ind);
if (it != m_mapFilters12.end())
{
it->second.push_back(elements_.back());
}
else
{
std::vector<BaseObjectPtr> ar;
ar.push_back(elements_.back());
m_mapFilters12.insert(std::pair<int, std::vector<BaseObjectPtr>>(ind, ar));
}
}
}
elements_.pop_back();
count--;
}
count = proc.repeated<SORTDATA12>(0, 0);
while(count > 0)
{
m_arSORTDATA12.insert(m_arSORTDATA12.begin(), elements_.back());
elements_.pop_back();
count--;
}
return true; return true;
} }
int AUTOFILTER::serialize(std::wostream & stream)
{
if (m_AutoFilterInfo == NULL) return 0;
AutoFilterInfo *info = dynamic_cast<AutoFilterInfo*>(m_AutoFilterInfo.get());
std::map<std::wstring, std::vector<std::wstring>>::iterator it = pGlobalWorkbookInfoPtr->mapDefineNames.find(L"_xlnm._FilterDatabase");
if (it == pGlobalWorkbookInfoPtr->mapDefineNames.end()) return 0;
int count_columns = info->cEntries;
int ind = pGlobalWorkbookInfoPtr->current_sheet;
std::wstring ref;
if (ind < it->second.size())
ref = it->second[ind]; //from current worksheet
if (ref.empty())
{
ref = it->second[0]; //from workbook
}
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"autoFilter")
{
CP_XML_ATTR(L"ref", ref);
for (int i = 0 ; i < m_arFilters.size(); i++)//todooo - count_columns (hidden)
{
AutoFilter * filter = dynamic_cast<AutoFilter*>(m_arFilters[i].get());
CP_XML_NODE(L"filterColumn")
{
CP_XML_ATTR(L"colId", filter->iEntry);
CP_XML_NODE(L"filters")
{
if (filter->fSimple1 && !filter->str1.empty())
{
CP_XML_NODE(L"filter")
{
CP_XML_ATTR(L"val", filter->str1);
}
}
if (filter->fSimple2 && !filter->str2.empty())
{
CP_XML_NODE(L"filter")
{
CP_XML_ATTR(L"val", filter->str2);
}
}
std::map<int, std::vector<BaseObjectPtr>>::iterator itF = m_mapFilters12.find(filter->iEntry);
if (itF != m_mapFilters12.end())
{
for (int j = 0 ; j < itF->second.size(); j++)
{
AutoFilter12* af12 = dynamic_cast<AutoFilter12*>(itF->second[j].get());
if (af12 == NULL) continue;
for (int k = 0 ; k < af12->rgbAF12Criteries.size(); k++)
{
AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(af12->rgbAF12Criteries[k].get());
if (af12Criteria == NULL) continue;
CP_XML_NODE(L"filter")
{
CP_XML_ATTR(L"val", *af12Criteria->_str.value());
}
}
}
}
}
}
}
}
}
return 0;
}
} // namespace XLS } // namespace XLS
...@@ -50,29 +50,119 @@ const bool CUSTOMVIEW::loadContent(BinProcessor& proc) ...@@ -50,29 +50,119 @@ const bool CUSTOMVIEW::loadContent(BinProcessor& proc)
{ {
return false; return false;
} }
proc.repeated<Selection>(0, 2); m_UserSView = elements_.back();
elements_.pop_back();
int count = proc.repeated<Selection>(0, 0);
while(count > 0)
{
m_arSelection.insert(m_arSelection.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.optional<HorizontalPageBreaks>(); proc.optional<HorizontalPageBreaks>();
proc.optional<VerticalPageBreaks>(); proc.optional<VerticalPageBreaks>();
proc.optional<Header>(); proc.optional<Header>();
proc.optional<Footer>(); proc.optional<Footer>();
proc.optional<HCenter>(); proc.optional<HCenter>();
proc.optional<VCenter>(); proc.optional<VCenter>();
proc.optional<LeftMargin>(); proc.optional<LeftMargin>();
proc.optional<RightMargin>(); proc.optional<RightMargin>();
proc.optional<TopMargin>(); proc.optional<TopMargin>();
proc.optional<BottomMargin>(); proc.optional<BottomMargin>();
Pls pls(proc.getParent()); Pls pls(proc.getParent());
proc.optional(pls);//?????? if (proc.optional(pls))//??????
{
m_pls = elements_.back();
elements_.pop_back();
}
proc.optional<Setup>(); proc.optional<Setup>();
proc.optional<PrintSize>(); proc.optional<PrintSize>();
proc.optional<HeaderFooter>(); proc.optional<HeaderFooter>();
proc.optional<AUTOFILTER>();
if (proc.optional<AUTOFILTER>())
{
m_AUTOFILTER = elements_.back();
elements_.pop_back();
}
proc.mandatory<UserSViewEnd>(); proc.mandatory<UserSViewEnd>();
return true; return true;
} }
int CUSTOMVIEW::serialize(std::wostream & stream)
{
if (m_UserSView == NULL) return 0;
UserSViewBegin* userSView = dynamic_cast<UserSViewBegin*>(m_UserSView.get());
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"customSheetView")
{
CP_XML_ATTR(L"guid", *userSView->guid.value());
CP_XML_ATTR(L"showGridLines", userSView->fDspGridSv);
if (userSView->wScale != 100) CP_XML_ATTR(L"scale", userSView->wScale);
if (userSView->icvHdr != 64) CP_XML_ATTR(L"colorId", userSView->icvHdr);
if (userSView->fShowBrks) CP_XML_ATTR(L"showPageBreaks", true);
if (userSView->fDspFmlaSv) CP_XML_ATTR(L"showFormulas", true);
if (userSView->fFitToPage) CP_XML_ATTR(L"fitToPage", true);
if (!userSView->fDspRwColSv) CP_XML_ATTR(L"showRowCol", false);
if (!userSView->fDspGutsSv) CP_XML_ATTR(L"outlineSymbols", false);
if (!userSView->fDspZerosSv) CP_XML_ATTR(L"zeroValues", false);
if (!userSView->fPrintArea) CP_XML_ATTR(L"printArea", false);
if (!userSView->fFilterMode) CP_XML_ATTR(L"filter", false);
if (userSView->fEzFilter) CP_XML_ATTR(L"showAutoFilter", true);
if (userSView->fHiddenRw) CP_XML_ATTR(L"hiddenRows", true);
if (userSView->fFilterUnique) CP_XML_ATTR(L"filterUnique", true);
if (!userSView->fRuler) CP_XML_ATTR(L"showRuler", false);
if (userSView->fSheetLayoutView) CP_XML_ATTR(L"view", L"pageBreakPreview");
else if (userSView->fPageLayoutView)CP_XML_ATTR(L"view", L"pageLayout");
else CP_XML_ATTR(L"view", L"normal");
if (userSView->ref8TopLeft != L"A1")CP_XML_ATTR(L"topLeftCell", userSView->ref8TopLeft);
CP_XML_NODE(L"pane")
{
if (userSView->operNumX != 0) CP_XML_ATTR(L"xSplit", userSView->operNumX);
if (userSView->operNumY != 0) CP_XML_ATTR(L"ySplit", userSView->operNumY);
if (userSView->pane_top_left_cell != L"A1")CP_XML_ATTR(L"topLeftCell", userSView->pane_top_left_cell);
switch(userSView->pnnSel)
{
case PaneType::REVTPNNBOTRIGHT: CP_XML_ATTR(L"activePane", L"bottomRight"); break;
case PaneType::REVTPNNTOPRIGHT: CP_XML_ATTR(L"activePane", L"topRight"); break;
case PaneType::REVTPNNBOTLEFT: CP_XML_ATTR(L"activePane", L"bottomLeft"); break;
//default: CP_XML_ATTR(L"activePane", L"topLeft");
}
if (userSView->fFrozen && userSView->fFrozenNoSplit)
CP_XML_ATTR(L"state", L"frozen");
else if (userSView->fFrozen && !userSView->fFrozenNoSplit)
CP_XML_ATTR(L"state", L"frozenSplit");
else
CP_XML_ATTR(L"state", L"split");
}
for (int i = 0; i < m_arSelection.size(); i++)
{
if (m_arSelection[i] == NULL) continue;
m_arSelection[i]->serialize(CP_XML_STREAM());
}
//todooo ref
//if (m_AUTOFILTER)
// m_AUTOFILTER->serialize(CP_XML_STREAM());
}
}
return 0;
}
} // namespace XLS } // namespace XLS
...@@ -20,6 +20,12 @@ public: ...@@ -20,6 +20,12 @@ public:
static const ElementType type = typeCUSTOMVIEW; static const ElementType type = typeCUSTOMVIEW;
int serialize(std::wostream & stream);
BaseObjectPtr m_UserSView;
std::vector<BaseObjectPtr> m_arSelection;
BaseObjectPtr m_pls;
BaseObjectPtr m_AUTOFILTER;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -68,28 +68,29 @@ const bool LBL::loadContent(BinProcessor& proc) ...@@ -68,28 +68,29 @@ const bool LBL::loadContent(BinProcessor& proc)
if (!value.empty() && !name.empty()) if (!value.empty() && !name.empty())
{ {
//bool insert = false; int ind_sheet = lbl->itab;
//std::multimap<std::wstring, std::wstring>::iterator it = global_info_->mapDefineNames.find(name); std::map<std::wstring, std::vector<std::wstring>>::iterator it = global_info_->mapDefineNames.find(name);
//
//if (it == global_info_->mapDefineNames.end()) if (it != global_info_->mapDefineNames.end())
//{ {
// insert = true; if (ind_sheet >= it->second.size())
//} {
//else it->second.reserve(ind_sheet + 1);
//{ }
// while (it != global_info_->mapDefineNames.end())// it->second[ind_sheet] = value;
// { //it->second.push_back(value);
// if (it->second != value) insert = true; }
// else break; else
// it++;
// }
//}
//if (insert)
{ {
global_info_->mapDefineNames.insert(std::pair<std::wstring, std::wstring>(name, value)); // std::vector<std::wstring> ar(ind_sheet + 1);
isSerialize = true;
ar[ind_sheet] = value;
//ar.push_back(value);
global_info_->mapDefineNames.insert(std::pair<std::wstring, std::vector<std::wstring>>(name, ar));
} }
isSerialize = true;
} }
else else
{ {
......
...@@ -30,13 +30,46 @@ BaseObjectPtr SORTANDFILTER::clone() ...@@ -30,13 +30,46 @@ BaseObjectPtr SORTANDFILTER::clone()
const bool SORTANDFILTER::loadContent(BinProcessor& proc) const bool SORTANDFILTER::loadContent(BinProcessor& proc)
{ {
bool res1 = proc.optional<Sort>(); bool res1 = proc.optional<Sort>();
if (res1)
{
m_Sort = elements_.back();
elements_.pop_back();
}
bool res2 = proc.optional<SORTDATA12>(); bool res2 = proc.optional<SORTDATA12>();
if (res2)
{
m_SORTDATA12 = elements_.back();
elements_.pop_back();
}
bool res3 = proc.optional<FilterMode>(); bool res3 = proc.optional<FilterMode>();
if (res3)
{
m_FilterMode = elements_.back();
elements_.pop_back();
}
bool res4 = proc.optional<DropDownObjIds>(); bool res4 = proc.optional<DropDownObjIds>();
if (res3)
{
m_DropDownObjIds = elements_.back();
elements_.pop_back();
}
bool res5 = proc.optional<AUTOFILTER>(); bool res5 = proc.optional<AUTOFILTER>();
if (res5)
{
m_AUTOFILTER = elements_.back();
elements_.pop_back();
}
return res1 || res2 || res3 || res4 || res5; return res1 || res2 || res3 || res4 || res5;
} }
int SORTANDFILTER::serialize(std::wostream & stream)
{
if (m_AUTOFILTER)
{
m_AUTOFILTER->serialize(stream);
}
return 0;
}
} // namespace XLS } // namespace XLS
...@@ -18,8 +18,15 @@ public: ...@@ -18,8 +18,15 @@ public:
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & stream);
static const ElementType type = typeSORTANDFILTER; static const ElementType type = typeSORTANDFILTER;
BaseObjectPtr m_Sort;
BaseObjectPtr m_SORTDATA12;
BaseObjectPtr m_FilterMode;
BaseObjectPtr m_DropDownObjIds;
BaseObjectPtr m_AUTOFILTER;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -148,34 +148,8 @@ int WINDOW::serialize(std::wostream & stream) ...@@ -148,34 +148,8 @@ int WINDOW::serialize(std::wostream & stream)
} }
for (int i = 0; i < m_arSelection.size(); i++) for (int i = 0; i < m_arSelection.size(); i++)
{ {
Selection * selection = dynamic_cast<Selection*>(m_arSelection[i].get()); if (m_arSelection[i] == NULL) continue;
if (selection == NULL) continue; m_arSelection[i]->serialize(CP_XML_STREAM());
if (selection->pnn == (unsigned char)PaneType::REVTPNNTOPLEFT &&
selection->activeCell == L"A1" &&
selection->irefAct == (_INT16)0 &&
selection->sqref == L"A1") continue;
CP_XML_NODE(L"selection")
{
switch(selection->pnn)
{
case PaneType::REVTPNNBOTRIGHT: CP_XML_ATTR(L"pane", L"bottomRight"); break;
case PaneType::REVTPNNTOPRIGHT: CP_XML_ATTR(L"pane", L"topRight"); break;
case PaneType::REVTPNNBOTLEFT: CP_XML_ATTR(L"pane", L"bottomLeft"); break;
// default: CP_XML_ATTR(L"pane", L"topLeft");
}
if (*selection->activeCell.value() != L"A1")
CP_XML_ATTR(L"activeCell", *selection->activeCell.value());
if (selection->irefAct != 0)
CP_XML_ATTR(L"activeCellId", selection->irefAct);
if (*selection->sqref.value() != L"A1")
CP_XML_ATTR(L"sqref", *selection->sqref.value());
}
} }
} }
} }
......
...@@ -162,8 +162,23 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc) ...@@ -162,8 +162,23 @@ const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
recalc((SERIESDATA*)m_SERIESDATA.get()); recalc((SERIESDATA*)m_SERIESDATA.get());
} }
proc.repeated<WINDOW>(0, 0);
proc.repeated<CUSTOMVIEW>(0, 0); 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)
{
m_arCUSTOMVIEW.insert(m_arCUSTOMVIEW.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.optional<CodeName>(); proc.optional<CodeName>();
proc.optional<CRTMLFRT>(); proc.optional<CRTMLFRT>();
......
...@@ -40,7 +40,8 @@ public: ...@@ -40,7 +40,8 @@ public:
BaseObjectPtr m_CHARTFORMATS; BaseObjectPtr m_CHARTFORMATS;
BaseObjectPtr m_SERIESDATA; BaseObjectPtr m_SERIESDATA;
BaseObjectPtr m_OBJECTSCHART; BaseObjectPtr m_OBJECTSCHART;
std::vector<BaseObjectPtr> m_arWINDOW;
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
private: private:
void recalc(CHARTFORMATS* charts); void recalc(CHARTFORMATS* charts);
......
...@@ -19,6 +19,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver ...@@ -19,6 +19,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
xls_converter = xls_converter_; xls_converter = xls_converter_;
startAddedSharedStrings = 0; startAddedSharedStrings = 0;
current_sheet = 0;
} }
......
...@@ -55,11 +55,12 @@ public: ...@@ -55,11 +55,12 @@ public:
std::vector<BaseObjectPtr> *m_arFonts; std::vector<BaseObjectPtr> *m_arFonts;
unsigned int current_sheet;
unsigned int last_AXES_id; unsigned int last_AXES_id;
const static unsigned int initial_AXES_id = 0x2000000; const static unsigned int initial_AXES_id = 0x2000000;
std::multimap<std::wstring, std::wstring> mapDefineNames; std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
std::vector<std::wstring> arDefineNames; std::vector<std::wstring> arDefineNames;
unsigned int startAddedSharedStrings; unsigned int startAddedSharedStrings;
std::vector<std::wstring> arAddedSharedStrings; std::vector<std::wstring> arAddedSharedStrings;
......
...@@ -182,6 +182,7 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc) ...@@ -182,6 +182,7 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
proc.mandatory<CalcPrecision>(); proc.mandatory<CalcPrecision>();
proc.mandatory<RefreshAll>(); proc.mandatory<RefreshAll>();
proc.mandatory<BookBool>(); proc.mandatory<BookBool>();
if (proc.optional<Country>()) // OpenOffice Calc stored files workaround if (proc.optional<Country>()) // OpenOffice Calc stored files workaround
{ {
m_Country = elements_.back(); m_Country = elements_.back();
...@@ -198,8 +199,14 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc) ...@@ -198,8 +199,14 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
} }
proc.optional<UsesELFs>(); // OpenOffice Calc stored files workaround proc.optional<UsesELFs>(); // OpenOffice Calc stored files workaround
proc.optional<RecalcId>(); // OpenOffice Calc stored files workaround proc.optional<RecalcId>(); // OpenOffice Calc stored files workaround
proc.repeated<Window1>(0, 0); // OpenOffice Calc stored files workaround
count = proc.repeated<Window1>(0, 0); // OpenOffice Calc stored files workaround
while(count > 0)
{
m_arWindow1.insert(m_arWindow1.begin(), elements_.back());
elements_.pop_back();
count--;
}
if (proc.mandatory<FORMATTING>()) if (proc.mandatory<FORMATTING>())
{ {
...@@ -215,7 +222,14 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc) ...@@ -215,7 +222,14 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
proc.repeated<PIVOTCACHEDEFINITION>(0, 0); proc.repeated<PIVOTCACHEDEFINITION>(0, 0);
proc.optional<DOCROUTE>(); proc.optional<DOCROUTE>();
proc.repeated<UserBView>(0, 0);
count = proc.repeated<UserBView>(0, 0);
while(count > 0)
{
m_arUserBView.insert(m_arUserBView.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.optional<UsesELFs>(); proc.optional<UsesELFs>();
proc.repeated<BUNDLESHEET>(1, 0); proc.repeated<BUNDLESHEET>(1, 0);
......
...@@ -36,6 +36,7 @@ public: ...@@ -36,6 +36,7 @@ public:
std::vector<BaseObjectPtr> m_arLBL; std::vector<BaseObjectPtr> m_arLBL;
std::vector<BaseObjectPtr> m_arMSODRAWINGGROUP; std::vector<BaseObjectPtr> m_arMSODRAWINGGROUP;
std::vector<BaseObjectPtr> m_arWindow1; std::vector<BaseObjectPtr> m_arWindow1;
std::vector<BaseObjectPtr> m_arUserBView;
unsigned short code_page_; unsigned short code_page_;
}; };
......
...@@ -70,7 +70,12 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc) ...@@ -70,7 +70,12 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
proc.optional<Intl>(); proc.optional<Intl>();
GLOBALS globals(false); GLOBALS globals(false);
proc.mandatory(globals); // not dialog if (proc.mandatory(globals)) // not dialog
{
m_GLOBALS = elements_.back();
elements_.pop_back();
}
int count = 0;
proc.mandatory<PAGESETUP>(); proc.mandatory<PAGESETUP>();
proc.optional<HeaderFooter>(); proc.optional<HeaderFooter>();
...@@ -78,6 +83,7 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc) ...@@ -78,6 +83,7 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
proc.repeated<BIGNAME>(0, 0); proc.repeated<BIGNAME>(0, 0);
proc.optional<PROTECTION_COMMON>(); proc.optional<PROTECTION_COMMON>();
proc.mandatory<COLUMNS>(); proc.mandatory<COLUMNS>();
proc.mandatory<MACROSORTANDFILTER>(); proc.mandatory<MACROSORTANDFILTER>();
proc.mandatory<Dimensions>(); proc.mandatory<Dimensions>();
...@@ -86,13 +92,24 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc) ...@@ -86,13 +92,24 @@ const bool MacroSheetSubstream::loadContent(BinProcessor& proc)
proc.optional(cell_table); proc.optional(cell_table);
OBJECTS objects(false); OBJECTS objects(false);
proc.mandatory(objects); if (proc.mandatory(objects))
{
m_OBJECTS = elements_.back();
elements_.pop_back();
}
proc.repeated<HFPicture>(0, 0); proc.repeated<HFPicture>(0, 0);
proc.repeated<Note>(0, 0); proc.repeated<Note>(0, 0);
proc.optional<DCON>(); proc.optional<DCON>();
proc.repeated<WINDOW>(1, 0); proc.repeated<WINDOW>(1, 0);
proc.repeated<CUSTOMVIEW>(0, 0);
count = proc.repeated<CUSTOMVIEW>(0, 0);
while(count > 0)
{
m_arCUSTOMVIEW.insert(m_arCUSTOMVIEW.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.repeated<SORT>(0, 2); proc.repeated<SORT>(0, 2);
proc.optional<DxGCol>(); proc.optional<DxGCol>();
proc.optional<PHONETICINFO>(); proc.optional<PHONETICINFO>();
......
...@@ -19,6 +19,10 @@ public: ...@@ -19,6 +19,10 @@ public:
virtual const bool loadContent(BinProcessor& proc); virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typeMacroSheetSubstream; static const ElementType type = typeMacroSheetSubstream;
BaseObjectPtr m_GLOBALS;
BaseObjectPtr m_OBJECTS;
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
}; };
......
...@@ -249,6 +249,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook) ...@@ -249,6 +249,7 @@ void XlsConverter::convert(XLS::WorkbookStreamObject* woorkbook)
for (int i=0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++) for (int i=0 ; i < woorkbook->m_arWorksheetSubstream.size(); i++)
{ {
xls_global_info->current_sheet = i + 1;
xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + boost::lexical_cast<std::wstring>(i+1)); xlsx_context->start_table(xls_global_info->sheets_names.size() > i ? xls_global_info->sheets_names[i] : L"Sheet_" + boost::lexical_cast<std::wstring>(i+1));
if (woorkbook->m_arWorksheetSubstream[i]->get_type() == XLS::typeWorksheetSubstream) if (woorkbook->m_arWorksheetSubstream[i]->get_type() == XLS::typeWorksheetSubstream)
...@@ -322,12 +323,33 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet) ...@@ -322,12 +323,33 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{ {
convert((XLS::HLINK*)sheet->m_arHLINK[i].get()); convert((XLS::HLINK*)sheet->m_arHLINK[i].get());
} }
if (sheet->m_SORTANDFILTER)
{
sheet->m_SORTANDFILTER->serialize(xlsx_context->current_sheet().sheetSortAndFilters());
}
convert((XLS::OBJECTS*)sheet->m_OBJECTS.get()); convert((XLS::OBJECTS*)sheet->m_OBJECTS.get());
if (sheet->m_PAGESETUP) if (sheet->m_PAGESETUP)
{ {
sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties()); sheet->m_PAGESETUP->serialize(xlsx_context->current_sheet().pageProperties());
} }
if (sheet->m_arCUSTOMVIEW.size() > 0)
{
CP_XML_WRITER(xlsx_context->current_sheet().customViews())
{
CP_XML_NODE(L"customSheetViews")
{
for (int i = 0 ; i < sheet->m_arCUSTOMVIEW.size(); i++)
{
sheet->m_arCUSTOMVIEW[i]->serialize(CP_XML_STREAM());
}
}
}
}
} }
void XlsConverter::convert(XLS::GlobalsSubstream* global) void XlsConverter::convert(XLS::GlobalsSubstream* global)
...@@ -353,6 +375,10 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global) ...@@ -353,6 +375,10 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
{ {
global->m_arWindow1[i]->serialize(xlsx_context->workbook_views()); global->m_arWindow1[i]->serialize(xlsx_context->workbook_views());
} }
for (int i = 0 ; i < global->m_arUserBView.size(); i++)
{
global->m_arUserBView[i]->serialize(xlsx_context->custom_views());
}
} }
typedef boost::unordered_map<XLS::FillInfo, int> mapFillInfo; typedef boost::unordered_map<XLS::FillInfo, int> mapFillInfo;
......
...@@ -173,8 +173,8 @@ void core_file::write(const std::wstring & RootPath) ...@@ -173,8 +173,8 @@ void core_file::write(const std::wstring & RootPath)
L"xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" " L"xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" "
L"xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" >"; L"xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" >";
resStream << L"<dc:creator>ONLYOFFICE Online Editor</dc:creator>"; resStream << L"<dc:creator>ONLYOFFICE</dc:creator>";
resStream << L"<cp:lastModifiedBy>ONLYOFFICE Online Editor</cp:lastModifiedBy>"; resStream << L"<cp:lastModifiedBy>ONLYOFFICE</cp:lastModifiedBy>";
resStream << L"<cp:revision>1</cp:revision>"; resStream << L"<cp:revision>1</cp:revision>";
resStream << L"</cp:coreProperties>"; resStream << L"</cp:coreProperties>";
...@@ -189,7 +189,7 @@ void app_file::write(const std::wstring & RootPath) ...@@ -189,7 +189,7 @@ void app_file::write(const std::wstring & RootPath)
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" " resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >"; L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
resStream << L"<Application>ONLYOFFICE Online Editor</Application>"; resStream << L"<Application>ONLYOFFICE Editor</Application>";
resStream << L"</Properties>"; resStream << L"</Properties>";
simple_element elm(L"app.xml", resStream.str()); simple_element elm(L"app.xml", resStream.str());
......
...@@ -194,7 +194,11 @@ void xlsx_conversion_context::end_document() ...@@ -194,7 +194,11 @@ void xlsx_conversion_context::end_document()
{ {
CP_XML_STREAM() << xlsx_defined_names_.str(); CP_XML_STREAM() << xlsx_defined_names_.str();
} }
} CP_XML_NODE(L"customWorkbookViews")
{
CP_XML_STREAM() << xlsx_custom_views_.str();
}
}
} }
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) ); output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );
......
...@@ -38,7 +38,8 @@ public: ...@@ -38,7 +38,8 @@ public:
std::wostream & shared_strings() { return xlsx_shared_strings_; } std::wostream & shared_strings() { return xlsx_shared_strings_; }
std::wostream & defined_names() { return xlsx_defined_names_; } std::wostream & defined_names() { return xlsx_defined_names_; }
std::wostream & workbook_views() { return xlsx_workbook_views_; } std::wostream & workbook_views() { return xlsx_workbook_views_; }
std::wostream & custom_views() { return xlsx_custom_views_; }
xlsx_text_context & get_text_context() { return xlsx_text_context_; } xlsx_text_context & get_text_context() { return xlsx_text_context_; }
xlsx_table_context & get_table_context() { return xlsx_table_context_; } xlsx_table_context & get_table_context() { return xlsx_table_context_; }
xlsx_xml_worksheet & current_sheet(); xlsx_xml_worksheet & current_sheet();
...@@ -74,6 +75,7 @@ private: ...@@ -74,6 +75,7 @@ private:
std::wstringstream xlsx_shared_strings_; std::wstringstream xlsx_shared_strings_;
std::wstringstream xlsx_defined_names_; std::wstringstream xlsx_defined_names_;
std::wstringstream xlsx_workbook_views_; std::wstringstream xlsx_workbook_views_;
std::wstringstream xlsx_custom_views_;
xlsx_drawing_context_handle xlsx_drawing_context_handle_; xlsx_drawing_context_handle xlsx_drawing_context_handle_;
//xlsx_comments_context_handle xlsx_comments_context_handle_; //xlsx_comments_context_handle xlsx_comments_context_handle_;
......
...@@ -253,11 +253,11 @@ bool xlsx_drawing_context::start_drawing(int type) ...@@ -253,11 +253,11 @@ bool xlsx_drawing_context::start_drawing(int type)
case 0x000E: // Label case 0x000E: // Label
case 0x000F: // Dialog box case 0x000F: // Dialog box
case 0x0010: // Spin control case 0x0010: // Spin control
case 0x0011: // Scrollbar
case 0x0012: // List case 0x0012: // List
case 0x0013: // Group box case 0x0013: // Group box
case 0x0014: // Dropdown list
start_shape(0x0002); return true; start_shape(0x0002); return true;
case 0x0011: // Scrollbar
case 0x0014: // Dropdown list
case 0x0019: // Note case 0x0019: // Note
break; break;
} }
......
...@@ -24,6 +24,8 @@ public: ...@@ -24,6 +24,8 @@ public:
std::wstringstream dimension_; std::wstringstream dimension_;
std::wstringstream sheetViews_; std::wstringstream sheetViews_;
std::wstringstream pageProperties_; std::wstringstream pageProperties_;
std::wstringstream sortAndFilters_;
std::wstringstream customViews_;
rels hyperlinks_rels_; rels hyperlinks_rels_;
...@@ -102,6 +104,15 @@ std::wostream & xlsx_xml_worksheet::hyperlinks() ...@@ -102,6 +104,15 @@ std::wostream & xlsx_xml_worksheet::hyperlinks()
{ {
return impl_->hyperlinks_; return impl_->hyperlinks_;
} }
std::wostream & xlsx_xml_worksheet::sheetSortAndFilters()
{
return impl_->sortAndFilters_;
}
std::wostream & xlsx_xml_worksheet::customViews()
{
return impl_->customViews_;
}
//-----------------------------------------------------------------
rels & xlsx_xml_worksheet::hyperlinks_rels() rels & xlsx_xml_worksheet::hyperlinks_rels()
{ {
return impl_->hyperlinks_rels_; return impl_->hyperlinks_rels_;
...@@ -133,8 +144,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm) ...@@ -133,8 +144,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
// !!! // !!!
CP_XML_STREAM() << impl_->mergeCells_.str(); CP_XML_STREAM() << impl_->mergeCells_.str();
CP_XML_STREAM() << impl_->hyperlinks_.str(); CP_XML_STREAM() << impl_->hyperlinks_.str();
CP_XML_STREAM() << impl_->sortAndFilters_.str();
CP_XML_STREAM() << impl_->customViews_.str();
CP_XML_STREAM() << impl_->pageProperties_.str(); CP_XML_STREAM() << impl_->pageProperties_.str();
CP_XML_STREAM() << impl_->drawing_.str(); CP_XML_STREAM() << impl_->drawing_.str();
......
...@@ -32,7 +32,9 @@ public: ...@@ -32,7 +32,9 @@ public:
std::wostream & mergeCells(); std::wostream & mergeCells();
std::wostream & drawing(); std::wostream & drawing();
std::wostream & comments(); std::wostream & comments();
std::wostream & sheetSortAndFilters();
std::wostream & pageProperties(); std::wostream & pageProperties();
std::wostream & customViews();
rels & hyperlinks_rels(); rels & hyperlinks_rels();
......
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