Commit 86274b3b authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

XlsFormat - визуальные настройки для книг и листов, закрепленные области, ..

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68001 954022d7-b5bf-4e40-9824-e11837661b57
parent 8aa53255
......@@ -37,7 +37,7 @@ CFRecordPtr CFStreamCacheReader::getNextRecord(const CFRecordType::TypeId desira
{
CFRecordType::TypeString rec_name = records_cache.front()->getTypeString();
Log::warning(rec_name);
//Log::warning(rec_name);
if (desirable_type == rt_MsoDrawingGroup) // rt_MsoDrawingGroup + rt_Continue
{
......
......@@ -16,6 +16,13 @@ CompoundFile::~CompoundFile()
storage_ = NULL;
}
bool CompoundFile::isError()
{
if (storage_ != NULL) return false;
return true;
}
CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode mode)
: rwMode(mode)
{
......
......@@ -22,6 +22,8 @@ public:
public:
CompoundFile(const std::wstring & file_path, const ReadWriteMode mode);
~CompoundFile();
bool isError();
CFStreamPtr getWorkbookStream();
CFStreamPtr createWorkbookStream();
......
......@@ -30,10 +30,10 @@ void Chart::readFields(CFRecord& record)
{
record >> x >> y >> dx >> dy;
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo();
//GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo();
pGlobalWorkbookInfoPtr->currentChartWidth = dx.Integral + dx.Fractional / 65536.;
pGlobalWorkbookInfoPtr->currentChartHeight = dy.Integral + dy.Fractional / 65536.;
//pGlobalWorkbookInfoPtr->currentChartWidth = dx.dVal;
//pGlobalWorkbookInfoPtr->currentChartHeight = dy.dVal;
}
......
......@@ -25,10 +25,6 @@ public:
//-----------------------------
XLUnicodeString codeName;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(codeName)
//BO_ATTRIB_MARKUP_END
};
......
......@@ -21,11 +21,6 @@ public:
void readFields(CFRecord& record);
static const ElementType type = typeGridSet;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_END
};
} // namespace XLS
......
......@@ -24,16 +24,10 @@ public:
//-----------------------------
BIFF_WORD wScalePLV;
bool fPageLayoutView;
bool fRulerVisible;
bool fWhitespaceHidden;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(wScalePLV)
//BO_ATTRIB_MARKUP_ATTRIB(fPageLayoutView)
//BO_ATTRIB_MARKUP_ATTRIB(fRulerVisible)
//BO_ATTRIB_MARKUP_ATTRIB(fWhitespaceHidden)
//BO_ATTRIB_MARKUP_END
};
......
......@@ -23,9 +23,12 @@ BaseObjectPtr Pane::clone()
void Pane::writeFields(CFRecord& record)
{
record << x << y;
CellRef topLeftCell_ref(topLeftCell);
rwTop = static_cast<unsigned short>(topLeftCell_ref.getRow());
rwTop = static_cast<unsigned short>(topLeftCell_ref.getRow());
colLeft = static_cast<unsigned short>(topLeftCell_ref.getColumn());
record << rwTop << colLeft << pnnAcct;
record.reserveNunBytes(1); // reserved
}
......@@ -34,6 +37,7 @@ void Pane::writeFields(CFRecord& record)
void Pane::readFields(CFRecord& record)
{
record >> x >> y >> rwTop >> colLeft >> pnnAcct;
topLeftCell = static_cast<std::wstring >(CellRef(rwTop, colLeft, true, true));
record.skipNunBytes(1); // reserved
}
......
......@@ -25,22 +25,13 @@ public:
static const ElementType type = typePane;
//-----------------------------
BIFF_WORD x;
BIFF_WORD y;
R_RwU rwTop;
ColU colLeft;
PaneType pnnAcct;
BIFF_BSTR topLeftCell;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(x)
//BO_ATTRIB_MARKUP_ATTRIB(y)
// //BO_ATTRIB_MARKUP_ATTRIB(rwTop)
// //BO_ATTRIB_MARKUP_ATTRIB(colLeft)
//BO_ATTRIB_MARKUP_ATTRIB(pnnAcct)
//BO_ATTRIB_MARKUP_ATTRIB(topLeftCell)
//BO_ATTRIB_MARKUP_END
BIFF_WORD x;
BIFF_WORD y;
R_RwU rwTop;
ColU colLeft;
PaneType pnnAcct;
BIFF_BSTR topLeftCell;
};
} // namespace XLS
......
......@@ -23,21 +23,22 @@ public:
static const ElementType type = typeRow;
//-----------------------------
Rw rw;
Rw rw;
BackwardOnlyParam<unsigned short> colMic;
BackwardOnlyParam<unsigned short> colMac;
BIFF_WORD miyRw;
BIFF_WORD miyRw;
BIFF_BYTE iOutLevel;
bool fCollapsed;
bool fDyZero;
bool fUnsynced;
bool fGhostDirty;
BIFF_BYTE iOutLevel;
bool fCollapsed;
bool fDyZero;
bool fUnsynced;
bool fGhostDirty;
BIFF_WORD ixfe_val;
bool fExAsc;
bool fExDes;
bool fPhonetic;
BIFF_WORD ixfe_val;
bool fExAsc;
bool fExDes;
bool fPhonetic;
BackwardOnlyParam<_UINT32> in_block_position;
};
......
......@@ -25,22 +25,14 @@ public:
static const ElementType type = typeSelection;
//-----------------------------
PaneType pnn;
R_RwU rwAct;
ColU colAct;
BIFF_SHORT irefAct;
BIFF_BSTR sqref;
BIFF_BSTR activeCell;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(pnn)
// //BO_ATTRIB_MARKUP_ATTRIB_NAME(rwAct.rw,L"rwAct")
// //BO_ATTRIB_MARKUP_ATTRIB_NAME(colAct.col,L"colAct")
//BO_ATTRIB_MARKUP_ATTRIB(activeCell)
//BO_ATTRIB_MARKUP_ATTRIB(irefAct)
//BO_ATTRIB_MARKUP_ATTRIB(sqref)
//BO_ATTRIB_MARKUP_END
PaneType pnn;
R_RwU rwAct;
ColU colAct;
BIFF_SHORT irefAct;
BIFF_BSTR sqref;
BIFF_BSTR activeCell;
};
} // namespace XLS
......
......@@ -50,5 +50,31 @@ void SheetExt::readFields(CFRecord& record)
}
}
int SheetExt::serialize(std::wostream & stream)
{
if (!sheetExtOptional.bEnabled) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"sheetPr")
{
if (!sheetExtOptional.fCondFmtCalc)
CP_XML_ATTR(L"enableFormatConditionsCalculation", false);
if (!sheetExtOptional.fNotPublished)
CP_XML_ATTR(L"published" ,false);
if (sheetExtOptional.color.xclrType.type == XColorType::XCLRRGB)
{
CP_XML_NODE(L"tabColor")
{
CP_XML_ATTR(L"rgb", sheetExtOptional.color.rgb.strARGB);
}
}
}
}
return 0;
}
} // namespace XLS
......@@ -23,19 +23,12 @@ public:
static const ElementType type = typeSheetExt;
int serialize(std::wostream & stream);
//-----------------------------
BIFF_DWORD cb;
BIFF_BYTE icvPlain;
SheetExtOptional sheetExtOptional;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(icvPlain)
//if(0x00000028 == cb)
//{
// //BO_ATTRIB_MARKUP_COMPLEX(sheetExtOptional)
//}
//BO_ATTRIB_MARKUP_END
};
} // namespace XLS
......
......@@ -69,24 +69,27 @@ void Window2::readFields(CFRecord& record)
return;
}
fDspFmlaRt = GETBIT(flags, 0);
fDspGridRt = GETBIT(flags, 1);
fDspRwColRt = GETBIT(flags, 2);
fFrozenRt = GETBIT(flags, 3);
fDspZerosRt = GETBIT(flags, 4);
fDefaultHdr = GETBIT(flags, 5);
fRightToLeft = GETBIT(flags, 6);
fDspGuts = GETBIT(flags, 7);
fFrozenNoSplit = GETBIT(flags, 8);
fPaged = GETBIT(flags, 10);
fSLV = GETBIT(flags, 11);
fDspFmlaRt = GETBIT(flags, 0);
fDspGridRt = GETBIT(flags, 1);
fDspRwColRt = GETBIT(flags, 2);
fFrozenRt = GETBIT(flags, 3);
fDspZerosRt = GETBIT(flags, 4);
fDefaultHdr = GETBIT(flags, 5);
fRightToLeft = GETBIT(flags, 6);
fDspGuts = GETBIT(flags, 7);
fFrozenNoSplit = GETBIT(flags, 8);
fPaged = GETBIT(flags, 10);
fSLV = GETBIT(flags, 11);
record >> rwTop >> colLeft >> icvHdr;
topLeftCell = static_cast<std::wstring >(CellRef(rwTop, colLeft, true, true));
record.skipNunBytes(2); // reserved
record >> wScaleSLV >> wScaleNormal;
record.skipNunBytes(4); // unused / reserved
}
} // namespace XLS
......@@ -39,36 +39,14 @@ public:
bool is_contained_in_chart_substream;
R_RwU rwTop;
ColU colLeft;
Icv icvHdr;
BIFF_WORD wScaleSLV;
BIFF_WORD wScaleNormal;
BIFF_BSTR topLeftCell;
// if(!is_contained_in_chart_substream)
// {
// //BO_ATTRIB_MARKUP_ATTRIB(fDspFmlaRt)
// //BO_ATTRIB_MARKUP_ATTRIB(fDspGridRt)
// //BO_ATTRIB_MARKUP_ATTRIB(fDspRwColRt)
// //BO_ATTRIB_MARKUP_ATTRIB(fFrozenRt)
// //BO_ATTRIB_MARKUP_ATTRIB(fDspZerosRt)
// //BO_ATTRIB_MARKUP_ATTRIB(fDefaultHdr)
// //BO_ATTRIB_MARKUP_ATTRIB(fRightToLeft)
// //BO_ATTRIB_MARKUP_ATTRIB(fDspGuts)
// //BO_ATTRIB_MARKUP_ATTRIB(fFrozenNoSplit)
// //BO_ATTRIB_MARKUP_ATTRIB(fPaged)
// //BO_ATTRIB_MARKUP_ATTRIB(fSLV)
//
//// //BO_ATTRIB_MARKUP_ATTRIB_NAME(rwTop.rw, L"rwTop")
//// //BO_ATTRIB_MARKUP_ATTRIB_NAME(colLeft.col, L"colLeft")
// //BO_ATTRIB_MARKUP_ATTRIB(topLeftCell)
// //BO_ATTRIB_MARKUP_ATTRIB(icvHdr)
// //BO_ATTRIB_MARKUP_ATTRIB(wScaleSLV)
// //BO_ATTRIB_MARKUP_ATTRIB(wScaleNormal)
// }
R_RwU rwTop;
ColU colLeft;
Icv icvHdr;
BIFF_WORD wScaleSLV;
BIFF_WORD wScaleNormal;
BIFF_BSTR topLeftCell;
};
} // namespace XLS
......
......@@ -10,15 +10,12 @@ class PaneType : public BiffAttributeSimple<unsigned char>
public:
BiffStructurePtr clone();
////virtual void toXML(BiffStructurePtr & parent, const std::wstring & attrib_name);
////virtual const bool fromXML(BiffStructurePtr & parent, const std::wstring & attrib_name);
enum
{
REVTPNNBOTRIGHT = 0x00, // logical bottom-right pane
REVTPNNTOPRIGHT = 0x01, // logical top-right pane
REVTPNNBOTLEFT = 0x02, // logical bottom-left pane
REVTPNNTOPLEFT = 0x03 // logical top-left pane
REVTPNNBOTLEFT = 0x02, // logical bottom-left pane
REVTPNNTOPLEFT = 0x03 // logical top-left pane
};
};
......
......@@ -8,6 +8,10 @@ namespace XLS
SheetExtOptional::SheetExtOptional()
{
fCondFmtCalc = true;
fNotPublished = true;
bEnabled = false;
}
......@@ -33,12 +37,16 @@ void SheetExtOptional::store(CFRecord& record)
void SheetExtOptional::load(CFRecord& record)
{
bEnabled = true;
_UINT32 flags;
record >> flags;
icvPlain12 = static_cast<unsigned char>(GETBITS(flags, 0, 6));
fCondFmtCalc = GETBIT(flags, 7);
fNotPublished = GETBIT(flags, 8);
record >> color;
}
......
......@@ -22,10 +22,13 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
unsigned char icvPlain12;
bool fCondFmtCalc;
bool fNotPublished;
CFColor color;
unsigned char icvPlain12;
bool fCondFmtCalc;
bool fNotPublished;
CFColor color;
//----------------------------------------
bool bEnabled;
};
} // namespace XLS
......
......@@ -201,6 +201,10 @@ int CELL_GROUP::serialize(std::wostream & stream)
{
CP_XML_ATTR(L"thickBot", true);
}
if (row->fDyZero)
{
CP_XML_ATTR(L"hidden", true);
}
}
if (row->rw + 1 <= current_row_number)
{
......
......@@ -75,7 +75,11 @@ const bool GLOBALS::loadContent(BinProcessor& proc)
}
WsBool wsbool(is_dialog);
proc.mandatory(wsbool); // The most interesting
if (proc.mandatory(wsbool)) // The most interesting
{
m_WsBool = elements_.back();
elements_.pop_back();
}
proc.optional<Sync>();
proc.optional<LPr>();
......@@ -83,6 +87,7 @@ const bool GLOBALS::loadContent(BinProcessor& proc)
proc.optional<VerticalPageBreaks>();
proc.optional<PrintRowCol>();// OpenOffice Calc stored files workaround (PrintRowCol is mandatory according to [MS-XLS])
proc.optional<PrintGrid>();// OpenOffice Calc stored files workaround (PrintGrid is mandatory according to [MS-XLS])
proc.optional<GridSet>();// OpenOffice Calc stored files workaround (GridSet is mandatory according to [MS-XLS])
return true;
}
......
......@@ -24,10 +24,11 @@ public:
bool is_dialog;
BaseObjectPtr m_DefColWidth;
BaseObjectPtr m_DefaultRowHeight;
BaseObjectPtr m_Guts;
};
BaseObjectPtr m_DefColWidth;
BaseObjectPtr m_DefaultRowHeight;
BaseObjectPtr m_Guts;
BaseObjectPtr m_WsBool;
};
} // namespace XLS
......@@ -33,13 +33,155 @@ const bool WINDOW::loadContent(BinProcessor& proc)
{
return false;
}
proc.optional<PLV>();
proc.optional<Scl>();
proc.optional<Pane>();
proc.repeated<Selection>(0, 0);
m_Window2 = elements_.back();
elements_.pop_back();
if (proc.optional<PLV>())
{
m_PLV = elements_.back();
elements_.pop_back();
}
if (proc.optional<Scl>())
{
m_Scl = elements_.back();
elements_.pop_back();
}
if (proc.optional<Pane>())
{
m_Pane = 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--;
}
return true;
}
int WINDOW::serialize(std::wostream & stream)
{
Window2 * window2 = dynamic_cast<Window2*>(m_Window2.get());
if (window2 == NULL) return 0;
Pane * pane = dynamic_cast<Pane*> (m_Pane.get());
PLV * plv = dynamic_cast<PLV*> (m_PLV.get());
Scl * scl = dynamic_cast<Scl*> (m_Scl.get());
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"sheetViews")
{
CP_XML_NODE(L"sheetView")
{
if (window2->fSelected) CP_XML_ATTR(L"tabSelected" , true);
if (window2->fDspFmlaRt) CP_XML_ATTR(L"showFormulas" , true);
if (!window2->fDspGridRt) CP_XML_ATTR(L"showGridLines" , false);
if (!window2->fDspRwColRt) CP_XML_ATTR(L"showRowColHeaders", false);
if (!window2->fDspZerosRt) CP_XML_ATTR(L"showZeros" , false);
if (window2->fRightToLeft) CP_XML_ATTR(L"rightToLeft" , true);
if ((plv) && (!plv->fRulerVisible)) CP_XML_ATTR(L"showRuler" , false);
if (!window2->fDspGuts) CP_XML_ATTR(L"showOutlineSymbols", false);
if (!window2->fDefaultHdr) CP_XML_ATTR(L"defaultGridColor" , false);
if ((plv) && (plv->fWhitespaceHidden))
{
CP_XML_ATTR(L"showWhiteSpace", false);
}
if (window2->fSLV)
{
CP_XML_ATTR(L"view", L"pageBreakPreview");
}
else if ((plv) && (plv->fPageLayoutView))
{
CP_XML_ATTR(L"view", L"pageLayout");
}
if ((window2->topLeftCell.value()) && (*window2->topLeftCell.value() != L"A1"))
{
CP_XML_ATTR(L"topLeftCell", *window2->topLeftCell.value());
}
if ( window2->icvHdr != (_UINT16)64)
{
CP_XML_ATTR(L"colorId", window2->icvHdr);
}
if (scl)
{
int scale = (int)(scl->nscl * 100./ scl->dscl);
if (scale != 100 && scale > 0)
CP_XML_ATTR(L"zoomScale", scale);
}
if ( (window2->fSLV || ((plv) && (plv->fPageLayoutView)) || !scl) && window2->wScaleNormal != (_UINT16)0)
{
CP_XML_ATTR(L"zoomScaleNormal", window2->wScaleNormal);
}
if ( (!window2->fSLV || !scl) && window2->wScaleSLV != (_UINT16)0)
{
CP_XML_ATTR(L"zoomScaleSheetLayoutView", window2->wScaleSLV);
}
CP_XML_ATTR(L"workbookViewId", 0);
if (pane)
{
CP_XML_NODE(L"pane")
{
if (pane->x != (_INT32)0) CP_XML_ATTR(L"xSplit", pane->x);
if (pane->y != (_INT32)0) CP_XML_ATTR(L"ySplit", pane->y);
if ((pane->topLeftCell.value()) && (*pane->topLeftCell.value() != L"A1"))
CP_XML_ATTR(L"topLeftCell", *pane->topLeftCell.value());
switch(pane->pnnAcct)
{
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 (window2->fFrozenRt && window2->fFrozenNoSplit)
CP_XML_ATTR(L"state", L"frozen");
else if (window2->fFrozenRt && !window2->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++)
{
Selection * selection = dynamic_cast<Selection*>(m_arSelection[i].get());
if (selection == NULL) continue;
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());
}
}
}
}
}
return 0;
}
} // namespace XLS
......@@ -21,6 +21,14 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & stream);
std::vector<BaseObjectPtr> m_arSelection;
BaseObjectPtr m_Scl;
BaseObjectPtr m_PLV;
BaseObjectPtr m_Window2;
BaseObjectPtr m_Pane;
};
......
#include "ChartSheetSubstream.h"
#include <Logic/Biff_records/WriteProtect.h>
#include <Logic/Biff_records/SheetExt.h>
#include <Logic/Biff_records/WebPub.h>
......@@ -36,6 +37,7 @@
#include <Logic/Biff_records/DataLabExtContents.h>
#include <Logic/Biff_records/CrtLine.h>
#include <Logic/Biff_records/Dat.h>
#include <Logic/Biff_records/Chart.h>
#include <Logic/Biff_unions/PAGESETUP.h>
#include <Logic/Biff_unions/BACKGROUND.h>
......@@ -57,6 +59,10 @@
#include <Logic/Biff_unions/LD.h>
#include <Logic/Biff_unions/DAT.h>
#include "../../XlsXlsxConverter/XlsConverter.h"
#include "../../XlsXlsxConverter/xlsx_conversion_context.h"
namespace XLS
{;
......@@ -86,6 +92,8 @@ CHARTSHEET = BOF CHARTSHEETCONTENT
*/
const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
{
pGlobalWorkbookInfo = proc.getGlobalWorkbookInfo();
if(!proc.mandatory<BOF>())
{
return false;
......@@ -219,7 +227,8 @@ int ChartSheetSubstream::serialize (std::wostream & _stream)
chart_area_format = dynamic_cast<AreaFormat*>(chart_frame->m_AreaFormat.get());
ShtProps *sht_props = dynamic_cast<ShtProps*>(chart_formats->m_ShtProps.get());
Chart *chart_rect = dynamic_cast<Chart*>(chart_formats->m_ChartRect.get());
CP_XML_WRITER(_stream)
{
CP_XML_NODE(L"c:roundedCorners")
......@@ -258,6 +267,12 @@ int ChartSheetSubstream::serialize (std::wostream & _stream)
//default spPr ???
}
}
if (chart_rect)
{
pGlobalWorkbookInfo->xls_converter->xlsx_context->get_drawing_context().set_chart_sheet_anchor(chart_rect->dx.dVal, chart_rect->dy.dVal);
}
return 0;
}
int ChartSheetSubstream::serialize_3D (std::wostream & _stream)
......@@ -516,7 +531,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
series_ss->serialize(CP_XML_STREAM(), crt->m_iChartType);
serialize_dPt(CP_XML_STREAM(), it->second[i], crt, std::max(ser->cValx, ser->cValy));//+bubbles
serialize_dPt(CP_XML_STREAM(), it->second[i], crt, (std::max)(ser->cValx, ser->cValy));//+bubbles
if (crt->m_iChartType == CHART_TYPE_Scatter ||
crt->m_iChartType == CHART_TYPE_Bubble)
......
......@@ -49,6 +49,9 @@ private:
std::map<int, std::vector<int>> m_mapTypeChart;// ..
GlobalWorkbookInfoPtr pGlobalWorkbookInfo;
};
} // namespace XLS
......
......@@ -18,9 +18,6 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
xls_converter = xls_converter_;
currentChartWidth = 1.;
currentChartHeight = 1.;
startAddedSharedStrings = 0;
}
......
......@@ -72,9 +72,6 @@ public:
double defaultColumnWidth;
double defaultRowHeight;
double currentChartWidth;
double currentChartHeight;
int Version;
XlsConverter *xls_converter;
......
......@@ -138,6 +138,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
}
proc.optional<SCENARIOS>();
if (proc.optional<SORTANDFILTER>())// Let it be optional
{
m_SORTANDFILTER = elements_.back();
......@@ -151,7 +152,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
}
std::vector<CellRangeRef> shared_formulas_locations;
CELLTABLE cell_table(shared_formulas_locations);
CELLTABLE cell_table(shared_formulas_locations);
if (proc.optional(cell_table))
{
m_CELLTABLE = elements_.back();
......@@ -176,11 +177,18 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
}
proc.repeated<HFPicture>(0, 0);
proc.repeated<Note> (0, 0);
count = proc.repeated<Note>(0, 0);
while(count > 0)
{
m_arNote.insert(m_arNote.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.repeated<PIVOTVIEW>(0, 0);
proc.optional<DCON> ();
count = proc.repeated<WINDOW>(1, 0);
count = proc.repeated<WINDOW>(1, 0);//?? 1
while(count > 0)
{
if (elements_.back()->get_type() == typeWINDOW)
......@@ -193,8 +201,22 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
proc.optional<SheetExt>(); //BulletinSearch.xls ???
proc.repeated<CUSTOMVIEW> (0, 0);
proc.repeated<SORT> (0, 2);
count = proc.repeated<CUSTOMVIEW>(0, 0);
while(count > 0)
{
m_arCUSTOMVIEW.insert(m_arCUSTOMVIEW.begin(), elements_.back());
elements_.pop_back();
count--;
}
count = proc.repeated<SORT>(0, 2);
while(count > 0)
{
m_arSORT.insert(m_arSORT.begin(), elements_.back());
elements_.pop_back();
count--;
}
proc.optional<DxGCol> ();
count = proc.repeated<MergeCells>(0, 0);
......@@ -208,7 +230,12 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
proc.optional<LRng> ();
proc.repeated<QUERYTABLE> (0, 0);
proc.optional<PHONETICINFO> ();
proc.optional<CONDFMTS> (); // Let it be optional
if (proc.optional<CONDFMTS>()) // Let it be optional
{
m_CONDFMTS = elements_.back();
elements_.pop_back();
}
count = proc.repeated<HLINK>(0, 0) ;
while(count > 0)
......@@ -218,11 +245,23 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
count--;
}
proc.optional<DVAL> ();
proc.optional<CodeName> ();
proc.optional<DVAL>();
if (proc.optional<CodeName> ())
{
m_CodeName = elements_.back();
elements_.pop_back();
}
proc.repeated<WebPub> (0, 0);
proc.repeated<CellWatch>(0, 0);
proc.optional<SheetExt> ();
if (proc.optional<SheetExt>())
{
m_SheetExt = elements_.back();
elements_.pop_back();
}
proc.repeated<FEAT> (0, 0);
proc.repeated<FEAT11> (0, 0);
proc.repeated<RECORD12> (0, 0);
......
......@@ -26,6 +26,7 @@ public:
std::vector<BaseObjectPtr> m_arMergeCells;
std::vector<BaseObjectPtr> m_arWINDOW;
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
BaseObjectPtr m_GLOBALS;
BaseObjectPtr m_PAGESETUP;
......@@ -36,7 +37,13 @@ public:
BaseObjectPtr m_Dimensions;
BaseObjectPtr m_SORTANDFILTER;
BaseObjectPtr m_OBJECTS;
BaseObjectPtr m_CONDFMTS;
BaseObjectPtr m_CodeName;
BaseObjectPtr m_SheetExt;
std::vector<BaseObjectPtr> m_arNote;
std::vector<BaseObjectPtr> m_arHLINK;
std::vector<BaseObjectPtr> m_arSORT;
};
} // namespace XLS
......
......@@ -82,6 +82,8 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
try{
XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode);
if (cfile.isError())return;
XLS::CFStreamPtr summary;
XLS::CFStreamPtr doc_summary;
......@@ -271,10 +273,19 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{
if (sheet == NULL) return;
if (sheet->m_arWINDOW.size() > 0)
{
sheet->m_arWINDOW[0]->serialize(xlsx_context->current_sheet().sheetViews());
}
if (sheet->m_Dimensions)
{
sheet->m_Dimensions->serialize(xlsx_context->current_sheet().dimension());
}
if (sheet->m_SheetExt)
{
sheet->m_SheetExt->serialize(xlsx_context->current_sheet().sheetProperties());
// todooo + GLOBALS->WsBool
}
if (sheet->m_GLOBALS)
{
XLS::GLOBALS * globals = dynamic_cast<XLS::GLOBALS *>(sheet->m_GLOBALS.get());
......@@ -518,12 +529,6 @@ void XlsConverter::convert(XLS::LBL * def_name)
def_name->serialize(xlsx_context->defined_names());
}
void XlsConverter::convert(XLS::WINDOW * window)
{
if (window == NULL) return;
//window->serialize(xlsx_context->worksheet_view());
}
void XlsConverter::convert(XLS::THEME* theme)
{
if (theme == NULL) return;
......@@ -1091,7 +1096,9 @@ void XlsConverter::convert_geometry_text(std::vector<ODRAW::OfficeArtFOPTEPtr> &
if (bools->fUsegFItalic && bools->fItalic) xlsx_context->get_drawing_context().set_wordart_italic (true);
if (bools->fUsegFVertical && bools->fVertical) xlsx_context->get_drawing_context().set_wordart_vertical(true);
if (bools->fUsegFUnderline && bools->fUnderline) xlsx_context->get_drawing_context().set_wordart_underline(true);
if (bools->fStrikethrough && bools->fStrikethrough)xlsx_context->get_drawing_context().set_wordart_strike(true);
if (bools->fStrikethrough && bools->fStrikethrough)xlsx_context->get_drawing_context().set_wordart_strike(true);
//if (bools->fUsegFShrinkFit && bools->fShrinkFit)
}
}break;
}
......@@ -1329,9 +1336,8 @@ void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream * chart)
if (xlsx_context->get_drawing_context().start_drawing(0x0005))
{
convert(chart);
xlsx_context->get_drawing_context().set_chart_sheet_anchor(xls_global_info->currentChartWidth, xls_global_info->currentChartHeight);//todooo - size chart
xlsx_context->get_drawing_context().set_id(1);
convert(chart);
xlsx_context->get_drawing_context().end_drawing();
}
......
......@@ -30,7 +30,6 @@ namespace XLS
class GlobalsSubstream;
class ChartSheetSubstream;
class WINDOW;
class FORMATTING;
class THEME;
class SHAREDSTRINGS;
......@@ -80,7 +79,6 @@ public:
void convert(XLS::OBJECTS * objects);
void convert(XLS::MSODRAWINGGROUP * mso_drawing);
void convert(XLS::TxO * text_obj);
void convert(XLS::WINDOW * window);
void convert(ODRAW::OfficeArtRecord * art);
void convert(ODRAW::OfficeArtBStoreContainer* art_bstore);
......
......@@ -1135,7 +1135,8 @@ void xlsx_drawing_context::set_anchor(const std::wstring & str)
if (str.empty()) return;
if (current_drawing_states == NULL) return;
current_drawing_states->back()->anchor = str;
current_drawing_states->back()->anchor = str;
current_drawing_states->back()->type_anchor = 1;
}
bool xlsx_drawing_context::is_anchor()
......@@ -1526,6 +1527,7 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::
void xlsx_drawing_context::set_chart_sheet_anchor(double width, double height)
{
if (current_drawing_states == NULL) return;
if (!current_drawing_states->back()->anchor.empty()) return; //
std::wstringstream stream;
......
......@@ -14,7 +14,8 @@ public:
std::wstring name_;
std::wstringstream cols_;
std::wstringstream sheetFormatPr_;
std::wstringstream sheetPr_;
std::wstringstream sheetFormatPr_;
std::wstringstream sheetData_;
std::wstringstream mergeCells_;
std::wstringstream drawing_;
......@@ -71,7 +72,10 @@ std::wostream & xlsx_xml_worksheet::sheetFormat()
{
return impl_->sheetFormatPr_;
}
std::wostream & xlsx_xml_worksheet::sheetProperties()
{
return impl_->sheetPr_;
}
std::wostream & xlsx_xml_worksheet::sheetData()
{
return impl_->sheetData_;
......@@ -114,6 +118,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_ATTR(L"mc:Ignorable", L"x14ac");
CP_XML_ATTR(L"xmlns:x14ac", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
CP_XML_STREAM() << impl_->sheetPr_.str();
CP_XML_STREAM() << impl_->dimension_.str();
CP_XML_STREAM() << impl_->sheetViews_.str();
CP_XML_STREAM() << impl_->sheetFormatPr_.str();
......
......@@ -25,6 +25,7 @@ public:
std::wostream & dimension();
std::wostream & sheetViews();
std::wostream & cols();
std::wostream & sheetProperties();
std::wostream & sheetFormat();
std::wostream & sheetData();
std::wostream & hyperlinks();
......@@ -37,9 +38,9 @@ public:
void write_to(std::wostream & strm);
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_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);
std::pair<std::wstring, std::wstring> get_drawing_link() const;
std::pair<std::wstring, std::wstring> get_vml_drawing_link() const;
......
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