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 ...@@ -37,7 +37,7 @@ CFRecordPtr CFStreamCacheReader::getNextRecord(const CFRecordType::TypeId desira
{ {
CFRecordType::TypeString rec_name = records_cache.front()->getTypeString(); 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 if (desirable_type == rt_MsoDrawingGroup) // rt_MsoDrawingGroup + rt_Continue
{ {
......
...@@ -16,6 +16,13 @@ CompoundFile::~CompoundFile() ...@@ -16,6 +16,13 @@ CompoundFile::~CompoundFile()
storage_ = NULL; storage_ = NULL;
} }
bool CompoundFile::isError()
{
if (storage_ != NULL) return false;
return true;
}
CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode mode) CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode mode)
: rwMode(mode) : rwMode(mode)
{ {
......
...@@ -23,6 +23,8 @@ public: ...@@ -23,6 +23,8 @@ public:
CompoundFile(const std::wstring & file_path, const ReadWriteMode mode); CompoundFile(const std::wstring & file_path, const ReadWriteMode mode);
~CompoundFile(); ~CompoundFile();
bool isError();
CFStreamPtr getWorkbookStream(); CFStreamPtr getWorkbookStream();
CFStreamPtr createWorkbookStream(); CFStreamPtr createWorkbookStream();
......
...@@ -30,10 +30,10 @@ void Chart::readFields(CFRecord& record) ...@@ -30,10 +30,10 @@ void Chart::readFields(CFRecord& record)
{ {
record >> x >> y >> dx >> dy; record >> x >> y >> dx >> dy;
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo(); //GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo();
pGlobalWorkbookInfoPtr->currentChartWidth = dx.Integral + dx.Fractional / 65536.; //pGlobalWorkbookInfoPtr->currentChartWidth = dx.dVal;
pGlobalWorkbookInfoPtr->currentChartHeight = dy.Integral + dy.Fractional / 65536.; //pGlobalWorkbookInfoPtr->currentChartHeight = dy.dVal;
} }
......
...@@ -25,10 +25,6 @@ public: ...@@ -25,10 +25,6 @@ public:
//----------------------------- //-----------------------------
XLUnicodeString codeName; XLUnicodeString codeName;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(codeName)
//BO_ATTRIB_MARKUP_END
}; };
......
...@@ -21,11 +21,6 @@ public: ...@@ -21,11 +21,6 @@ public:
void readFields(CFRecord& record); void readFields(CFRecord& record);
static const ElementType type = typeGridSet; static const ElementType type = typeGridSet;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_END
}; };
} // namespace XLS } // namespace XLS
......
...@@ -24,16 +24,10 @@ public: ...@@ -24,16 +24,10 @@ public:
//----------------------------- //-----------------------------
BIFF_WORD wScalePLV; BIFF_WORD wScalePLV;
bool fPageLayoutView; bool fPageLayoutView;
bool fRulerVisible; bool fRulerVisible;
bool fWhitespaceHidden; 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() ...@@ -23,9 +23,12 @@ BaseObjectPtr Pane::clone()
void Pane::writeFields(CFRecord& record) void Pane::writeFields(CFRecord& record)
{ {
record << x << y; record << x << y;
CellRef topLeftCell_ref(topLeftCell); 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()); colLeft = static_cast<unsigned short>(topLeftCell_ref.getColumn());
record << rwTop << colLeft << pnnAcct; record << rwTop << colLeft << pnnAcct;
record.reserveNunBytes(1); // reserved record.reserveNunBytes(1); // reserved
} }
...@@ -34,6 +37,7 @@ void Pane::writeFields(CFRecord& record) ...@@ -34,6 +37,7 @@ void Pane::writeFields(CFRecord& record)
void Pane::readFields(CFRecord& record) void Pane::readFields(CFRecord& record)
{ {
record >> x >> y >> rwTop >> colLeft >> pnnAcct; record >> x >> y >> rwTop >> colLeft >> pnnAcct;
topLeftCell = static_cast<std::wstring >(CellRef(rwTop, colLeft, true, true)); topLeftCell = static_cast<std::wstring >(CellRef(rwTop, colLeft, true, true));
record.skipNunBytes(1); // reserved record.skipNunBytes(1); // reserved
} }
......
...@@ -30,17 +30,8 @@ public: ...@@ -30,17 +30,8 @@ public:
R_RwU rwTop; R_RwU rwTop;
ColU colLeft; ColU colLeft;
PaneType pnnAcct; 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_BSTR topLeftCell;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -26,6 +26,7 @@ public: ...@@ -26,6 +26,7 @@ public:
Rw rw; Rw rw;
BackwardOnlyParam<unsigned short> colMic; BackwardOnlyParam<unsigned short> colMic;
BackwardOnlyParam<unsigned short> colMac; BackwardOnlyParam<unsigned short> colMac;
BIFF_WORD miyRw; BIFF_WORD miyRw;
BIFF_BYTE iOutLevel; BIFF_BYTE iOutLevel;
......
...@@ -26,21 +26,13 @@ public: ...@@ -26,21 +26,13 @@ public:
//----------------------------- //-----------------------------
PaneType pnn; PaneType pnn;
R_RwU rwAct; R_RwU rwAct;
ColU colAct; ColU colAct;
BIFF_SHORT irefAct; BIFF_SHORT irefAct;
BIFF_BSTR sqref; BIFF_BSTR sqref;
BIFF_BSTR activeCell; 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
}; };
} // namespace XLS } // namespace XLS
......
...@@ -50,5 +50,31 @@ void SheetExt::readFields(CFRecord& record) ...@@ -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 } // namespace XLS
...@@ -23,19 +23,12 @@ public: ...@@ -23,19 +23,12 @@ public:
static const ElementType type = typeSheetExt; static const ElementType type = typeSheetExt;
int serialize(std::wostream & stream);
//----------------------------- //-----------------------------
BIFF_DWORD cb; BIFF_DWORD cb;
BIFF_BYTE icvPlain; 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
SheetExtOptional sheetExtOptional;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -82,11 +82,14 @@ void Window2::readFields(CFRecord& record) ...@@ -82,11 +82,14 @@ void Window2::readFields(CFRecord& record)
fSLV = GETBIT(flags, 11); fSLV = GETBIT(flags, 11);
record >> rwTop >> colLeft >> icvHdr; record >> rwTop >> colLeft >> icvHdr;
topLeftCell = static_cast<std::wstring >(CellRef(rwTop, colLeft, true, true)); topLeftCell = static_cast<std::wstring >(CellRef(rwTop, colLeft, true, true));
record.skipNunBytes(2); // reserved record.skipNunBytes(2); // reserved
record >> wScaleSLV >> wScaleNormal; record >> wScaleSLV >> wScaleNormal;
record.skipNunBytes(4); // unused / reserved record.skipNunBytes(4); // unused / reserved
} }
} // namespace XLS } // namespace XLS
...@@ -41,34 +41,12 @@ public: ...@@ -41,34 +41,12 @@ public:
R_RwU rwTop; R_RwU rwTop;
ColU colLeft; ColU colLeft;
Icv icvHdr; Icv icvHdr;
BIFF_WORD wScaleSLV; BIFF_WORD wScaleSLV;
BIFF_WORD wScaleNormal; BIFF_WORD wScaleNormal;
BIFF_BSTR topLeftCell; 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)
// }
}; };
} // namespace XLS } // namespace XLS
......
...@@ -10,9 +10,6 @@ class PaneType : public BiffAttributeSimple<unsigned char> ...@@ -10,9 +10,6 @@ class PaneType : public BiffAttributeSimple<unsigned char>
public: public:
BiffStructurePtr clone(); BiffStructurePtr clone();
////virtual void toXML(BiffStructurePtr & parent, const std::wstring & attrib_name);
////virtual const bool fromXML(BiffStructurePtr & parent, const std::wstring & attrib_name);
enum enum
{ {
REVTPNNBOTRIGHT = 0x00, // logical bottom-right pane REVTPNNBOTRIGHT = 0x00, // logical bottom-right pane
......
...@@ -8,6 +8,10 @@ namespace XLS ...@@ -8,6 +8,10 @@ namespace XLS
SheetExtOptional::SheetExtOptional() SheetExtOptional::SheetExtOptional()
{ {
fCondFmtCalc = true;
fNotPublished = true;
bEnabled = false;
} }
...@@ -33,12 +37,16 @@ void SheetExtOptional::store(CFRecord& record) ...@@ -33,12 +37,16 @@ void SheetExtOptional::store(CFRecord& record)
void SheetExtOptional::load(CFRecord& record) void SheetExtOptional::load(CFRecord& record)
{ {
bEnabled = true;
_UINT32 flags; _UINT32 flags;
record >> flags; record >> flags;
icvPlain12 = static_cast<unsigned char>(GETBITS(flags, 0, 6)); icvPlain12 = static_cast<unsigned char>(GETBITS(flags, 0, 6));
fCondFmtCalc = GETBIT(flags, 7); fCondFmtCalc = GETBIT(flags, 7);
fNotPublished = GETBIT(flags, 8); fNotPublished = GETBIT(flags, 8);
record >> color; record >> color;
} }
......
...@@ -26,6 +26,9 @@ public: ...@@ -26,6 +26,9 @@ public:
bool fCondFmtCalc; bool fCondFmtCalc;
bool fNotPublished; bool fNotPublished;
CFColor color; CFColor color;
//----------------------------------------
bool bEnabled;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -201,6 +201,10 @@ int CELL_GROUP::serialize(std::wostream & stream) ...@@ -201,6 +201,10 @@ int CELL_GROUP::serialize(std::wostream & stream)
{ {
CP_XML_ATTR(L"thickBot", true); CP_XML_ATTR(L"thickBot", true);
} }
if (row->fDyZero)
{
CP_XML_ATTR(L"hidden", true);
}
} }
if (row->rw + 1 <= current_row_number) if (row->rw + 1 <= current_row_number)
{ {
......
...@@ -75,7 +75,11 @@ const bool GLOBALS::loadContent(BinProcessor& proc) ...@@ -75,7 +75,11 @@ const bool GLOBALS::loadContent(BinProcessor& proc)
} }
WsBool wsbool(is_dialog); 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<Sync>();
proc.optional<LPr>(); proc.optional<LPr>();
...@@ -83,6 +87,7 @@ const bool GLOBALS::loadContent(BinProcessor& proc) ...@@ -83,6 +87,7 @@ const bool GLOBALS::loadContent(BinProcessor& proc)
proc.optional<VerticalPageBreaks>(); proc.optional<VerticalPageBreaks>();
proc.optional<PrintRowCol>();// OpenOffice Calc stored files workaround (PrintRowCol is mandatory according to [MS-XLS]) 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<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]) proc.optional<GridSet>();// OpenOffice Calc stored files workaround (GridSet is mandatory according to [MS-XLS])
return true; return true;
} }
......
...@@ -27,6 +27,7 @@ public: ...@@ -27,6 +27,7 @@ public:
BaseObjectPtr m_DefColWidth; BaseObjectPtr m_DefColWidth;
BaseObjectPtr m_DefaultRowHeight; BaseObjectPtr m_DefaultRowHeight;
BaseObjectPtr m_Guts; BaseObjectPtr m_Guts;
BaseObjectPtr m_WsBool;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -33,13 +33,155 @@ const bool WINDOW::loadContent(BinProcessor& proc) ...@@ -33,13 +33,155 @@ const bool WINDOW::loadContent(BinProcessor& proc)
{ {
return false; return false;
} }
proc.optional<PLV>(); m_Window2 = elements_.back();
proc.optional<Scl>(); elements_.pop_back();
proc.optional<Pane>();
proc.repeated<Selection>(0, 0);
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; 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 } // namespace XLS
...@@ -21,6 +21,14 @@ public: ...@@ -21,6 +21,14 @@ public:
virtual const bool loadContent(BinProcessor& proc); 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 "ChartSheetSubstream.h"
#include <Logic/Biff_records/WriteProtect.h> #include <Logic/Biff_records/WriteProtect.h>
#include <Logic/Biff_records/SheetExt.h> #include <Logic/Biff_records/SheetExt.h>
#include <Logic/Biff_records/WebPub.h> #include <Logic/Biff_records/WebPub.h>
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
#include <Logic/Biff_records/DataLabExtContents.h> #include <Logic/Biff_records/DataLabExtContents.h>
#include <Logic/Biff_records/CrtLine.h> #include <Logic/Biff_records/CrtLine.h>
#include <Logic/Biff_records/Dat.h> #include <Logic/Biff_records/Dat.h>
#include <Logic/Biff_records/Chart.h>
#include <Logic/Biff_unions/PAGESETUP.h> #include <Logic/Biff_unions/PAGESETUP.h>
#include <Logic/Biff_unions/BACKGROUND.h> #include <Logic/Biff_unions/BACKGROUND.h>
...@@ -57,6 +59,10 @@ ...@@ -57,6 +59,10 @@
#include <Logic/Biff_unions/LD.h> #include <Logic/Biff_unions/LD.h>
#include <Logic/Biff_unions/DAT.h> #include <Logic/Biff_unions/DAT.h>
#include "../../XlsXlsxConverter/XlsConverter.h"
#include "../../XlsXlsxConverter/xlsx_conversion_context.h"
namespace XLS namespace XLS
{; {;
...@@ -86,6 +92,8 @@ CHARTSHEET = BOF CHARTSHEETCONTENT ...@@ -86,6 +92,8 @@ CHARTSHEET = BOF CHARTSHEETCONTENT
*/ */
const bool ChartSheetSubstream::loadContent(BinProcessor& proc) const bool ChartSheetSubstream::loadContent(BinProcessor& proc)
{ {
pGlobalWorkbookInfo = proc.getGlobalWorkbookInfo();
if(!proc.mandatory<BOF>()) if(!proc.mandatory<BOF>())
{ {
return false; return false;
...@@ -219,6 +227,7 @@ int ChartSheetSubstream::serialize (std::wostream & _stream) ...@@ -219,6 +227,7 @@ int ChartSheetSubstream::serialize (std::wostream & _stream)
chart_area_format = dynamic_cast<AreaFormat*>(chart_frame->m_AreaFormat.get()); chart_area_format = dynamic_cast<AreaFormat*>(chart_frame->m_AreaFormat.get());
ShtProps *sht_props = dynamic_cast<ShtProps*>(chart_formats->m_ShtProps.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_WRITER(_stream)
{ {
...@@ -258,6 +267,12 @@ int ChartSheetSubstream::serialize (std::wostream & _stream) ...@@ -258,6 +267,12 @@ int ChartSheetSubstream::serialize (std::wostream & _stream)
//default spPr ??? //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; return 0;
} }
int ChartSheetSubstream::serialize_3D (std::wostream & _stream) int ChartSheetSubstream::serialize_3D (std::wostream & _stream)
...@@ -516,7 +531,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) ...@@ -516,7 +531,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
series_ss->serialize(CP_XML_STREAM(), crt->m_iChartType); 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 || if (crt->m_iChartType == CHART_TYPE_Scatter ||
crt->m_iChartType == CHART_TYPE_Bubble) crt->m_iChartType == CHART_TYPE_Bubble)
......
...@@ -49,6 +49,9 @@ private: ...@@ -49,6 +49,9 @@ private:
std::map<int, std::vector<int>> m_mapTypeChart;// .. std::map<int, std::vector<int>> m_mapTypeChart;// ..
GlobalWorkbookInfoPtr pGlobalWorkbookInfo;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -18,9 +18,6 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver ...@@ -18,9 +18,6 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
xls_converter = xls_converter_; xls_converter = xls_converter_;
currentChartWidth = 1.;
currentChartHeight = 1.;
startAddedSharedStrings = 0; startAddedSharedStrings = 0;
} }
......
...@@ -72,9 +72,6 @@ public: ...@@ -72,9 +72,6 @@ public:
double defaultColumnWidth; double defaultColumnWidth;
double defaultRowHeight; double defaultRowHeight;
double currentChartWidth;
double currentChartHeight;
int Version; int Version;
XlsConverter *xls_converter; XlsConverter *xls_converter;
......
...@@ -138,6 +138,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc) ...@@ -138,6 +138,7 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
} }
proc.optional<SCENARIOS>(); proc.optional<SCENARIOS>();
if (proc.optional<SORTANDFILTER>())// Let it be optional if (proc.optional<SORTANDFILTER>())// Let it be optional
{ {
m_SORTANDFILTER = elements_.back(); m_SORTANDFILTER = elements_.back();
...@@ -176,11 +177,18 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc) ...@@ -176,11 +177,18 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
} }
proc.repeated<HFPicture>(0, 0); 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.repeated<PIVOTVIEW>(0, 0);
proc.optional<DCON> (); proc.optional<DCON> ();
count = proc.repeated<WINDOW>(1, 0); count = proc.repeated<WINDOW>(1, 0);//?? 1
while(count > 0) while(count > 0)
{ {
if (elements_.back()->get_type() == typeWINDOW) if (elements_.back()->get_type() == typeWINDOW)
...@@ -193,8 +201,22 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc) ...@@ -193,8 +201,22 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
proc.optional<SheetExt>(); //BulletinSearch.xls ??? proc.optional<SheetExt>(); //BulletinSearch.xls ???
proc.repeated<CUSTOMVIEW> (0, 0); count = proc.repeated<CUSTOMVIEW>(0, 0);
proc.repeated<SORT> (0, 2); 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> (); proc.optional<DxGCol> ();
count = proc.repeated<MergeCells>(0, 0); count = proc.repeated<MergeCells>(0, 0);
...@@ -208,7 +230,12 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc) ...@@ -208,7 +230,12 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
proc.optional<LRng> (); proc.optional<LRng> ();
proc.repeated<QUERYTABLE> (0, 0); proc.repeated<QUERYTABLE> (0, 0);
proc.optional<PHONETICINFO> (); 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) ; count = proc.repeated<HLINK>(0, 0) ;
while(count > 0) while(count > 0)
...@@ -218,11 +245,23 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc) ...@@ -218,11 +245,23 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
count--; count--;
} }
proc.optional<DVAL> (); proc.optional<DVAL>();
proc.optional<CodeName> ();
if (proc.optional<CodeName> ())
{
m_CodeName = elements_.back();
elements_.pop_back();
}
proc.repeated<WebPub> (0, 0); proc.repeated<WebPub> (0, 0);
proc.repeated<CellWatch>(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<FEAT> (0, 0);
proc.repeated<FEAT11> (0, 0); proc.repeated<FEAT11> (0, 0);
proc.repeated<RECORD12> (0, 0); proc.repeated<RECORD12> (0, 0);
......
...@@ -26,6 +26,7 @@ public: ...@@ -26,6 +26,7 @@ public:
std::vector<BaseObjectPtr> m_arMergeCells; std::vector<BaseObjectPtr> m_arMergeCells;
std::vector<BaseObjectPtr> m_arWINDOW; std::vector<BaseObjectPtr> m_arWINDOW;
std::vector<BaseObjectPtr> m_arCUSTOMVIEW;
BaseObjectPtr m_GLOBALS; BaseObjectPtr m_GLOBALS;
BaseObjectPtr m_PAGESETUP; BaseObjectPtr m_PAGESETUP;
...@@ -36,7 +37,13 @@ public: ...@@ -36,7 +37,13 @@ public:
BaseObjectPtr m_Dimensions; BaseObjectPtr m_Dimensions;
BaseObjectPtr m_SORTANDFILTER; BaseObjectPtr m_SORTANDFILTER;
BaseObjectPtr m_OBJECTS; 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_arHLINK;
std::vector<BaseObjectPtr> m_arSORT;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -82,6 +82,8 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _ ...@@ -82,6 +82,8 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
try{ try{
XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode); XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode);
if (cfile.isError())return;
XLS::CFStreamPtr summary; XLS::CFStreamPtr summary;
XLS::CFStreamPtr doc_summary; XLS::CFStreamPtr doc_summary;
...@@ -271,10 +273,19 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet) ...@@ -271,10 +273,19 @@ void XlsConverter::convert(XLS::WorksheetSubstream* sheet)
{ {
if (sheet == NULL) return; if (sheet == NULL) return;
if (sheet->m_arWINDOW.size() > 0)
{
sheet->m_arWINDOW[0]->serialize(xlsx_context->current_sheet().sheetViews());
}
if (sheet->m_Dimensions) if (sheet->m_Dimensions)
{ {
sheet->m_Dimensions->serialize(xlsx_context->current_sheet().dimension()); 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) if (sheet->m_GLOBALS)
{ {
XLS::GLOBALS * globals = dynamic_cast<XLS::GLOBALS *>(sheet->m_GLOBALS.get()); XLS::GLOBALS * globals = dynamic_cast<XLS::GLOBALS *>(sheet->m_GLOBALS.get());
...@@ -518,12 +529,6 @@ void XlsConverter::convert(XLS::LBL * def_name) ...@@ -518,12 +529,6 @@ void XlsConverter::convert(XLS::LBL * def_name)
def_name->serialize(xlsx_context->defined_names()); 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) void XlsConverter::convert(XLS::THEME* theme)
{ {
if (theme == NULL) return; if (theme == NULL) return;
...@@ -1092,6 +1097,8 @@ void XlsConverter::convert_geometry_text(std::vector<ODRAW::OfficeArtFOPTEPtr> & ...@@ -1092,6 +1097,8 @@ void XlsConverter::convert_geometry_text(std::vector<ODRAW::OfficeArtFOPTEPtr> &
if (bools->fUsegFVertical && bools->fVertical) xlsx_context->get_drawing_context().set_wordart_vertical(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->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; }break;
} }
...@@ -1329,9 +1336,8 @@ void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream * chart) ...@@ -1329,9 +1336,8 @@ void XlsConverter::convert_chart_sheet(XLS::ChartSheetSubstream * chart)
if (xlsx_context->get_drawing_context().start_drawing(0x0005)) 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); xlsx_context->get_drawing_context().set_id(1);
convert(chart);
xlsx_context->get_drawing_context().end_drawing(); xlsx_context->get_drawing_context().end_drawing();
} }
......
...@@ -30,7 +30,6 @@ namespace XLS ...@@ -30,7 +30,6 @@ namespace XLS
class GlobalsSubstream; class GlobalsSubstream;
class ChartSheetSubstream; class ChartSheetSubstream;
class WINDOW;
class FORMATTING; class FORMATTING;
class THEME; class THEME;
class SHAREDSTRINGS; class SHAREDSTRINGS;
...@@ -80,7 +79,6 @@ public: ...@@ -80,7 +79,6 @@ public:
void convert(XLS::OBJECTS * objects); void convert(XLS::OBJECTS * objects);
void convert(XLS::MSODRAWINGGROUP * mso_drawing); void convert(XLS::MSODRAWINGGROUP * mso_drawing);
void convert(XLS::TxO * text_obj); void convert(XLS::TxO * text_obj);
void convert(XLS::WINDOW * window);
void convert(ODRAW::OfficeArtRecord * art); void convert(ODRAW::OfficeArtRecord * art);
void convert(ODRAW::OfficeArtBStoreContainer* art_bstore); void convert(ODRAW::OfficeArtBStoreContainer* art_bstore);
......
...@@ -1136,6 +1136,7 @@ void xlsx_drawing_context::set_anchor(const std::wstring & str) ...@@ -1136,6 +1136,7 @@ void xlsx_drawing_context::set_anchor(const std::wstring & str)
if (current_drawing_states == NULL) 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() bool xlsx_drawing_context::is_anchor()
...@@ -1526,6 +1527,7 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std:: ...@@ -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) void xlsx_drawing_context::set_chart_sheet_anchor(double width, double height)
{ {
if (current_drawing_states == NULL) return; if (current_drawing_states == NULL) return;
if (!current_drawing_states->back()->anchor.empty()) return; //
std::wstringstream stream; std::wstringstream stream;
......
...@@ -14,6 +14,7 @@ public: ...@@ -14,6 +14,7 @@ public:
std::wstring name_; std::wstring name_;
std::wstringstream cols_; std::wstringstream cols_;
std::wstringstream sheetPr_;
std::wstringstream sheetFormatPr_; std::wstringstream sheetFormatPr_;
std::wstringstream sheetData_; std::wstringstream sheetData_;
std::wstringstream mergeCells_; std::wstringstream mergeCells_;
...@@ -71,7 +72,10 @@ std::wostream & xlsx_xml_worksheet::sheetFormat() ...@@ -71,7 +72,10 @@ std::wostream & xlsx_xml_worksheet::sheetFormat()
{ {
return impl_->sheetFormatPr_; return impl_->sheetFormatPr_;
} }
std::wostream & xlsx_xml_worksheet::sheetProperties()
{
return impl_->sheetPr_;
}
std::wostream & xlsx_xml_worksheet::sheetData() std::wostream & xlsx_xml_worksheet::sheetData()
{ {
return impl_->sheetData_; return impl_->sheetData_;
...@@ -114,6 +118,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm) ...@@ -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"mc:Ignorable", L"x14ac");
CP_XML_ATTR(L"xmlns:x14ac", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"); 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_->dimension_.str();
CP_XML_STREAM() << impl_->sheetViews_.str(); CP_XML_STREAM() << impl_->sheetViews_.str();
CP_XML_STREAM() << impl_->sheetFormatPr_.str(); CP_XML_STREAM() << impl_->sheetFormatPr_.str();
......
...@@ -25,6 +25,7 @@ public: ...@@ -25,6 +25,7 @@ public:
std::wostream & dimension(); std::wostream & dimension();
std::wostream & sheetViews(); std::wostream & sheetViews();
std::wostream & cols(); std::wostream & cols();
std::wostream & sheetProperties();
std::wostream & sheetFormat(); std::wostream & sheetFormat();
std::wostream & sheetData(); std::wostream & sheetData();
std::wostream & hyperlinks(); std::wostream & hyperlinks();
...@@ -37,9 +38,9 @@ public: ...@@ -37,9 +38,9 @@ public:
void write_to(std::wostream & strm); void write_to(std::wostream & strm);
void set_drawing_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_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_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_drawing_link() const;
std::pair<std::wstring, std::wstring> get_vml_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