mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-03 01:01:53 +08:00
Compare commits
7 Commits
v4.5.dev.3
...
core-win-3
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a75916944 | |||
| da45eb4f33 | |||
| 59d75ed148 | |||
| ccc4d751d0 | |||
| a020d3dbf9 | |||
| 7852b7fbe8 | |||
| a64fd8792d |
@ -250,12 +250,26 @@ namespace PPTX
|
||||
}
|
||||
else if (L"oleObj" == strName)
|
||||
{
|
||||
olePic = oNode.ReadNode(L"p:pic");
|
||||
olePic = oNode.ReadNode(L"p:pic"); //нормальный вариант объекта
|
||||
if (olePic.IsInit())
|
||||
{
|
||||
olePic->fromXMLOle(oNode);
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
olePic.Init(); //старый вариант описания объекта через spid в VmlDrawing
|
||||
olePic->spPr.xfrm;
|
||||
|
||||
Logic::PrstGeom* geom = new Logic::PrstGeom();
|
||||
geom->prst = L"rect";
|
||||
olePic->spPr.Geometry.m_geometry.reset(geom);
|
||||
|
||||
olePic->fromXMLOle(oNode);
|
||||
result = true;
|
||||
}
|
||||
if (olePic->spPr.xfrm.IsInit() == false)
|
||||
olePic->spPr.xfrm = xfrm;
|
||||
}
|
||||
else if (L"AlternateContent" == strName)
|
||||
{
|
||||
|
||||
@ -619,6 +619,45 @@ namespace PPTX
|
||||
if(oleObject.IsInit())
|
||||
{
|
||||
pWriter->StartRecord(SPTREE_TYPE_OLE);
|
||||
|
||||
if (oleObject->m_sShapeId.IsInit() && (!blipFill.blip->embed.IsInit() && blipFill.blip->oleFilepathImage.empty()) &&
|
||||
parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
|
||||
{
|
||||
OOX::CVmlDrawing *pVml = parentFileAs<PPTX::Slide>().Vml.operator->();
|
||||
|
||||
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = pVml->m_mapShapes.find(*oleObject->m_sShapeId);
|
||||
if (pVml->m_mapShapes.end() != pPair)
|
||||
{
|
||||
pPair->second.bUsed = true;
|
||||
OOX::Vml::CShape* pShape = dynamic_cast<OOX::Vml::CShape*>(pPair->second.pElement);
|
||||
for(size_t j = 0; (pShape) && (j < pShape->m_arrItems.size()); ++j)
|
||||
{
|
||||
OOX::WritingElement* pChildElemShape = pShape->m_arrItems[j];
|
||||
if(OOX::et_v_imagedata == pChildElemShape->getType())
|
||||
{
|
||||
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
|
||||
|
||||
std::wstring sIdImageFileCache;
|
||||
|
||||
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
|
||||
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
|
||||
|
||||
if (!sIdImageFileCache.empty())
|
||||
{
|
||||
//ищем физический файл ( rId относительно vml_drawing)
|
||||
smart_ptr<OOX::File> pFile = pVml->Find(sIdImageFileCache);
|
||||
|
||||
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
|
||||
{
|
||||
OOX::Image* pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
|
||||
|
||||
blipFill.blip->oleFilepathImage = pImageFileCache->filename().GetPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (nvPicPr.nvPr.media.is_init())
|
||||
{
|
||||
@ -630,10 +669,17 @@ namespace PPTX
|
||||
blipFill.blip->mediaFilepath = mediaFile->filename().GetPath();
|
||||
}
|
||||
|
||||
if (nvPicPr.nvPr.media.as<MediaFile>().name == L"audioFile")
|
||||
if (nvPicPr.nvPr.media.is<MediaFile>())
|
||||
{
|
||||
if (nvPicPr.nvPr.media.as<MediaFile>().name == L"audioFile")
|
||||
pWriter->StartRecord(SPTREE_TYPE_AUDIO);
|
||||
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile")
|
||||
pWriter->StartRecord(SPTREE_TYPE_VIDEO);
|
||||
}
|
||||
else if (nvPicPr.nvPr.media.is<WavAudioFile>() || nvPicPr.nvPr.media.is<AudioCD>())
|
||||
{
|
||||
pWriter->StartRecord(SPTREE_TYPE_AUDIO);
|
||||
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile")
|
||||
pWriter->StartRecord(SPTREE_TYPE_VIDEO);
|
||||
}
|
||||
else
|
||||
pWriter->StartRecord(SPTREE_TYPE_PIC);
|
||||
}
|
||||
@ -1338,6 +1384,7 @@ namespace PPTX
|
||||
blipFill.blip.Init();
|
||||
blipFill.blip->oleRid = oleObject->m_oId->get();
|
||||
}
|
||||
node.ReadAttributeBase(L"spid", oleObject->m_sShapeId);
|
||||
}
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
@ -259,7 +259,7 @@ namespace PPTX
|
||||
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group = false);
|
||||
//----------------------------------------------------------------------
|
||||
NvPicPr nvPicPr;
|
||||
BlipFill blipFill;
|
||||
mutable BlipFill blipFill;
|
||||
SpPr spPr;
|
||||
nullable<ShapeStyle> style;
|
||||
//internal
|
||||
|
||||
@ -35,11 +35,11 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
DbOrParamQry::DbOrParamQry()
|
||||
DbOrParamQry::DbOrParamQry(int typeRecord_)
|
||||
{
|
||||
typeRecord = typeRecord_;
|
||||
}
|
||||
|
||||
|
||||
DbOrParamQry::~DbOrParamQry()
|
||||
{
|
||||
}
|
||||
@ -52,10 +52,32 @@ BaseObjectPtr DbOrParamQry::clone()
|
||||
|
||||
void DbOrParamQry::readFields(CFRecord& record)
|
||||
{
|
||||
#pragma message("####################### DbOrParamQry record is not implemented")
|
||||
Log::error("DbOrParamQry record is not implemented.");
|
||||
size_t size = record.getDataSize() - record.getRdPtr();
|
||||
|
||||
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
|
||||
if (typeRecord == 1)
|
||||
{
|
||||
unsigned short flags;
|
||||
|
||||
record >> param.wTypeSql >> flags >> param.grbit >> param.fVal;
|
||||
|
||||
param.pbt = GETBITS(flags, 0, 1);
|
||||
param.fNonDefaultName = GETBIT(flags, 2);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned short flags;
|
||||
|
||||
record >> flags >> query.cparams >> query.cstQuery >> query.cstWebPost >> query.cstSQLSav >> query.cstOdbcConn;
|
||||
|
||||
query.dbt = GETBITS(flags, 0, 2);
|
||||
query.fOdbcConn = GETBIT(flags, 3);
|
||||
query.fSql = GETBIT(flags, 4);
|
||||
query.fSqlSav = GETBIT(flags, 5);
|
||||
query.fWeb = GETBIT(flags, 6);
|
||||
query.fSavePwd = GETBIT(flags, 7);
|
||||
query.fTablesOnlyHTML = GETBIT(flags, 8);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,24 +36,48 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of DbOrParamQry record in BIFF8
|
||||
class DbOrParamQry: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(DbOrParamQry)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(DbOrParamQry)
|
||||
public:
|
||||
DbOrParamQry();
|
||||
DbOrParamQry(int typeRecord = 2);
|
||||
~DbOrParamQry();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeDbOrParamQry;
|
||||
static const ElementType type = typeDbOrParamQry;
|
||||
|
||||
int typeRecord;
|
||||
|
||||
//PARAMQRY_Fixed - 8 bytes + variable
|
||||
struct
|
||||
{
|
||||
unsigned short wTypeSql;
|
||||
unsigned char pbt;
|
||||
bool fNonDefaultName;
|
||||
unsigned short grbit;
|
||||
unsigned short fVal;
|
||||
}param;
|
||||
|
||||
//---------------------------------------
|
||||
struct
|
||||
{
|
||||
unsigned char dbt;
|
||||
bool fOdbcConn;
|
||||
bool fSql;
|
||||
bool fSqlSav;
|
||||
bool fWeb;
|
||||
bool fSavePwd;
|
||||
bool fTablesOnlyHTML;
|
||||
short cparams;
|
||||
short cstQuery;
|
||||
short cstWebPost;
|
||||
short cstSQLSav;
|
||||
short cstOdbcConn;
|
||||
}query;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -70,11 +70,10 @@ void SXFDB::readFields(CFRecord& record)
|
||||
fCantGetUniqueItems = GETBIT(flags, 14);
|
||||
fCalculatedField = GETBIT(flags, 15);
|
||||
|
||||
if (fAllAtoms)
|
||||
{
|
||||
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
|
||||
global_info->arCacheFieldShortSize.push_back(fShortIitms);
|
||||
}
|
||||
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
|
||||
|
||||
global_info->arPivotCacheFieldShortSize.push_back(fShortIitms);
|
||||
global_info->arPivotCacheFields.push_back(fAllAtoms);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -35,8 +35,9 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
SXLI::SXLI()
|
||||
SXLI::SXLI(int count_)
|
||||
{
|
||||
count = count_;
|
||||
}
|
||||
|
||||
|
||||
@ -72,14 +73,24 @@ void SXLI::readFields(CFRecord& record)
|
||||
item.fGrand = GETBIT(flags, 11);
|
||||
item.fMultiDataOnAxis = GETBIT(flags, 12);
|
||||
|
||||
//if (!item.fGrand && item.itmType != 0x000E)
|
||||
if (item.fGrand)
|
||||
item.isxviMac = 1;
|
||||
|
||||
if (item.cSic > item.isxviMac)
|
||||
item.cSic = item.isxviMac;
|
||||
|
||||
if (item.fSbt && item.itmType < 0x000D)
|
||||
item.isxviMac++;
|
||||
|
||||
for (short i = 0; i < count/*item.isxviMac*/; i++)
|
||||
{
|
||||
for (short i = 0; i < item.isxviMac; i++)
|
||||
short val; record >> val;
|
||||
if (val >= 0x0000 && val <= 0x7EF4)
|
||||
{
|
||||
short val; record >> val;
|
||||
item.rgisxvi.push_back(val);
|
||||
}
|
||||
}
|
||||
|
||||
m_arItems.push_back(item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ class SXLI: public BiffRecordContinued
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(SXLI)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(SXLI)
|
||||
public:
|
||||
SXLI();
|
||||
SXLI(int count_);
|
||||
~SXLI();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
@ -65,6 +65,7 @@ public:
|
||||
static const ElementType type = typeSXLI;
|
||||
|
||||
std::vector<SXLIItem> m_arItems;
|
||||
int count;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "SXString.h"
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -39,12 +39,10 @@ SXString::SXString()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SXString::~SXString()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr SXString::clone()
|
||||
{
|
||||
return BaseObjectPtr(new SXString(*this));
|
||||
@ -73,5 +71,15 @@ int SXString::serialize(std::wostream & strm)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::wstring SXString::value()
|
||||
{
|
||||
std::wstring s = segment.value();
|
||||
XmlUtils::replace_all(s, L"\x0d", L"_x000d_");
|
||||
XmlUtils::replace_all(s, L"\x0a", L"_x000a_");
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -49,6 +49,8 @@ public:
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
std::wstring value();
|
||||
|
||||
int serialize(std::wostream & strm);
|
||||
|
||||
static const ElementType type = typeSXString;
|
||||
|
||||
@ -73,14 +73,10 @@ int SXVI::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
if (fMissing)
|
||||
CP_XML_ATTR(L"m", 1);
|
||||
if (fHidden)
|
||||
CP_XML_ATTR(L"h", 1);
|
||||
if (fHideDetail)
|
||||
CP_XML_ATTR(L"h", 1);
|
||||
if (fFormula)
|
||||
CP_XML_ATTR(L"f", 1);
|
||||
if (fMissing) CP_XML_ATTR(L"m", 1);
|
||||
if (fHidden) CP_XML_ATTR(L"h", 1);
|
||||
if (fHideDetail)CP_XML_ATTR(L"sd", 1);
|
||||
if (fFormula) CP_XML_ATTR(L"f", 1);
|
||||
|
||||
if (itmType == 0)
|
||||
{
|
||||
|
||||
@ -56,6 +56,18 @@ void SxBool::readFields(CFRecord& record)
|
||||
|
||||
val = (flags != 0);
|
||||
}
|
||||
int SxBool::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"b")
|
||||
{
|
||||
|
||||
CP_XML_ATTR(L"v", val);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -48,6 +48,8 @@ public:
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
int serialize(std::wostream & strm);
|
||||
|
||||
static const ElementType type = typeSxBool;
|
||||
|
||||
bool val;
|
||||
|
||||
@ -53,7 +53,7 @@ BaseObjectPtr SxFilt::clone()
|
||||
void SxFilt::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short flags1;
|
||||
unsigned char flags2;
|
||||
unsigned short flags2;
|
||||
|
||||
record >> flags1 >> isxvd >> flags2 >> grbitSbt >> cisxvi;
|
||||
|
||||
@ -63,7 +63,8 @@ void SxFilt::readFields(CFRecord& record)
|
||||
sxaxisData = GETBIT(flags1, 3);
|
||||
iDim = GETBITS(flags1, 4, 15);
|
||||
|
||||
fSelected = GETBIT(flags2, 0);
|
||||
isxvd = GETBITS(flags2, 0, 9);
|
||||
fSelected = GETBIT(flags2, 10);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -58,7 +58,7 @@ public:
|
||||
unsigned short isxvd;
|
||||
bool fSelected;
|
||||
|
||||
unsigned short grbitSbt;
|
||||
short grbitSbt;
|
||||
unsigned short cisxvi;
|
||||
};
|
||||
|
||||
|
||||
@ -750,7 +750,7 @@ class pConnectionSitesDir : public OfficeArtFOPTE
|
||||
|
||||
virtual void ReadComplexData(XLS::CFRecord& record);
|
||||
|
||||
IMsoArray<ODRAW::FixedPoint> complex;
|
||||
IMsoArray<OSHARED::FixedPoint> complex;
|
||||
};
|
||||
|
||||
class pInscribe : public OfficeArtFOPTE
|
||||
|
||||
@ -45,13 +45,51 @@ BiffStructurePtr PtgSxName::clone()
|
||||
void PtgSxName::loadFields(CFRecord& record)
|
||||
{
|
||||
record >> sxIndex;
|
||||
|
||||
global_info = record.getGlobalWorkbookInfo();
|
||||
}
|
||||
|
||||
void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full_ref)
|
||||
{
|
||||
Log::info("PtgSxName structure is not assemble.");
|
||||
//RevNamePtr tab_id;
|
||||
//if(!extra_data.empty() && (tab_id = boost::dynamic_pointer_cast<RevName>(extra_data.front())))
|
||||
//{
|
||||
// Log::error("PtgNameX struct for revisions is not assemble.");
|
||||
// ptg_stack.push(L"#REF!");
|
||||
// extra_data.pop();
|
||||
// return;
|
||||
//}
|
||||
|
||||
std::wstring _Name;
|
||||
if(sxIndex > 0 && sxIndex <= global_info->AddinUdfs.size() && !(_Name = global_info->AddinUdfs[sxIndex - 1]).empty())
|
||||
{
|
||||
ptg_stack.push(_Name);
|
||||
}
|
||||
else if(sxIndex > 0 && sxIndex <= global_info->xti_parsed.size())
|
||||
{
|
||||
std::wstring sheet = global_info->xti_parsed[sxIndex-1];
|
||||
|
||||
if (!sheet.empty()) sheet += L"!";
|
||||
|
||||
if (sxIndex > 0 && sxIndex <= global_info->arDefineNames.size())
|
||||
{
|
||||
_Name = global_info->arDefineNames[sxIndex - 1];
|
||||
}
|
||||
|
||||
if (sheet.empty() && _Name.empty() && sxIndex <= global_info->arExternalNames.size() && sxIndex > 0)
|
||||
{
|
||||
_Name = global_info->arExternalNames[sxIndex - 1];
|
||||
}
|
||||
|
||||
ptg_stack.push(sheet + _Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::warning("PtgSxName structure is not assemble.");
|
||||
|
||||
ptg_stack.push(L""); // This would let us to continue without an error
|
||||
}
|
||||
|
||||
ptg_stack.push(L"#REF!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -44,14 +44,13 @@ class PtgSxName: public OperandPtg
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
|
||||
|
||||
virtual void loadFields(CFRecord& record);
|
||||
|
||||
virtual void loadFields(CFRecord& record);
|
||||
|
||||
virtual void assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full_ref = false);
|
||||
|
||||
private:
|
||||
_UINT32 sxIndex;
|
||||
private:
|
||||
GlobalWorkbookInfoPtr global_info;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -55,10 +55,13 @@ BiffStructurePtr XFExtNoFRT::clone()
|
||||
|
||||
void XFExtNoFRT::load(CFRecord& record)
|
||||
{
|
||||
if (record.isEOF()) return;
|
||||
|
||||
record.skipNunBytes(6); // reserved
|
||||
unsigned short cexts;
|
||||
record >> cexts;
|
||||
for(unsigned short i = 0; i < cexts; ++i)
|
||||
|
||||
for(unsigned short i = 0; !record.isEOF() && i < cexts; ++i)
|
||||
{
|
||||
ExtProp prop;
|
||||
record >> prop;
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
unsigned char Byte4;
|
||||
unsigned short type;
|
||||
unsigned short fExprO;
|
||||
};
|
||||
}bytes;
|
||||
double value;
|
||||
} data;
|
||||
};
|
||||
|
||||
@ -44,8 +44,7 @@ DBB::DBB()
|
||||
bDate = false;
|
||||
bNumber = false;
|
||||
bEmpty = false;
|
||||
|
||||
fShortIitms = false;
|
||||
bBool = false;
|
||||
}
|
||||
|
||||
DBB::~DBB()
|
||||
@ -75,6 +74,7 @@ const bool DBB::loadContent(BinProcessor& proc)
|
||||
bDate |= operatr->bDate;
|
||||
bNumber |= operatr->bNumber;
|
||||
bEmpty |= operatr->bEmpty;
|
||||
bBool |= operatr->bBool;
|
||||
}
|
||||
|
||||
if (!m_SXDBB && m_arSXOPER.empty())
|
||||
@ -92,34 +92,34 @@ int DBB::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_NODE(L"r")
|
||||
{
|
||||
if (m_arSXOPER.empty() == false)
|
||||
int indexOPER = 0;
|
||||
size_t posBlob = 0;
|
||||
|
||||
for (size_t i = 0; i < arPivotCacheFields.size(); i++)
|
||||
{
|
||||
for (size_t i = 0; i < m_arSXOPER.size(); i++)
|
||||
if(arPivotCacheFields[i] == false)
|
||||
{
|
||||
m_arSXOPER[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fShortIitms == false)
|
||||
{
|
||||
for (size_t i = 0; i < dbb->size; i++)
|
||||
{
|
||||
CP_XML_NODE(L"x")
|
||||
{
|
||||
CP_XML_ATTR(L"v", dbb->blob[i]);
|
||||
}
|
||||
}
|
||||
m_arSXOPER[indexOPER++]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned short * values = (unsigned short *)dbb->blob.get();
|
||||
for (size_t i = 0; i < dbb->size / 2; i++)
|
||||
if (arPivotCacheFieldShortSize[i])//fShortIitms
|
||||
{
|
||||
unsigned short * values = (unsigned short *)(dbb->blob.get() + posBlob);
|
||||
CP_XML_NODE(L"x")
|
||||
{
|
||||
CP_XML_ATTR(L"v", values[i]);
|
||||
CP_XML_ATTR(L"v", *values);
|
||||
}
|
||||
posBlob+=2;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char * values = (unsigned char *)(dbb->blob.get() + posBlob);
|
||||
CP_XML_NODE(L"x")
|
||||
{
|
||||
CP_XML_ATTR(L"v", *values);
|
||||
}
|
||||
posBlob++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,12 +55,14 @@ public:
|
||||
std::vector<BaseObjectPtr> m_arSXOPER;
|
||||
|
||||
//---------------------------------------------------
|
||||
bool fShortIitms;
|
||||
std::vector<bool> arPivotCacheFields;
|
||||
std::vector<bool> arPivotCacheFieldShortSize;
|
||||
|
||||
bool bString;
|
||||
bool bDate;
|
||||
bool bNumber;
|
||||
bool bEmpty;
|
||||
bool bBool;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -63,7 +63,8 @@ public:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
proc.mandatory<DbOrParamQry>();
|
||||
DbOrParamQry param(1);
|
||||
proc.mandatory(param);
|
||||
return true;
|
||||
};
|
||||
};
|
||||
@ -80,11 +81,14 @@ public:
|
||||
|
||||
const bool loadContent(BinProcessor& proc)
|
||||
{
|
||||
if(!proc.mandatory<DbOrParamQry>())
|
||||
DbOrParamQry param(1);
|
||||
if(!proc.mandatory(param))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
proc.repeated<Parenthesis_DBQUERY_3>(0, 0);
|
||||
|
||||
int count = proc.repeated<Parenthesis_DBQUERY_3>(0, 0);
|
||||
|
||||
return true;
|
||||
};
|
||||
};
|
||||
@ -105,8 +109,11 @@ public:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
proc.repeated<SXString>(0, 0);
|
||||
|
||||
int count = proc.repeated<SXString>(0, 0);
|
||||
|
||||
proc.optional<Parenthesis_DBQUERY_2>();
|
||||
|
||||
return true;
|
||||
};
|
||||
};
|
||||
@ -117,20 +124,126 @@ BaseObjectPtr DBQUERY::clone()
|
||||
return BaseObjectPtr(new DBQUERY(*this));
|
||||
}
|
||||
|
||||
|
||||
// DBQUERY = DbOrParamQry [1*SXString [DbOrParamQry *(SXString DbOrParamQry)]] *SXString
|
||||
const bool DBQUERY::loadContent(BinProcessor& proc)
|
||||
{
|
||||
global_info = proc.getGlobalWorkbookInfo();
|
||||
|
||||
if(!proc.mandatory<DbOrParamQry>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
proc.optional<Parenthesis_DBQUERY_1>();
|
||||
proc.repeated<SXString>(0, 0);
|
||||
m_DbQry = elements_.front(); elements_.pop_front();
|
||||
|
||||
proc.optional<Parenthesis_DBQUERY_1>();
|
||||
|
||||
while(!elements_.empty())
|
||||
{
|
||||
SXString* str = dynamic_cast<SXString*>(elements_.front().get());
|
||||
if (!str)
|
||||
{
|
||||
m_DbParam = elements_.front(); elements_.pop_front();
|
||||
break;
|
||||
}
|
||||
m_arSXString.push_back(str->value());
|
||||
elements_.pop_front();
|
||||
}
|
||||
|
||||
while(!elements_.empty())
|
||||
{
|
||||
SXString* str = dynamic_cast<SXString*>(elements_.front().get());
|
||||
if (str)
|
||||
{
|
||||
_DbParam a;
|
||||
a.string = str->value();
|
||||
m_arParams.push_back(a);
|
||||
}
|
||||
else
|
||||
{
|
||||
DbOrParamQry* param = dynamic_cast<DbOrParamQry*>(elements_.front().get());
|
||||
if (param)
|
||||
{
|
||||
m_arParams.back().param = elements_.front();
|
||||
}
|
||||
|
||||
}
|
||||
elements_.pop_front();
|
||||
}
|
||||
int count = proc.repeated<SXString>(0, 0);
|
||||
while(!elements_.empty())
|
||||
{
|
||||
SXString* str = dynamic_cast<SXString*>(elements_.front().get());
|
||||
if (str)
|
||||
{
|
||||
m_arSXString.push_back(str->value());
|
||||
}
|
||||
elements_.pop_front();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int DBQUERY::serialize(std::wostream & strm)
|
||||
{
|
||||
connectionId = ++global_info->connectionId;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"cacheSource")
|
||||
{
|
||||
CP_XML_ATTR(L"type", L"external");
|
||||
CP_XML_ATTR(L"connectionId", connectionId); //connectionId in connections(root)
|
||||
}
|
||||
}
|
||||
serialize_connection(global_info->connections_stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DBQUERY::serialize_connection(std::wostream & strm)
|
||||
{
|
||||
DbOrParamQry* queryOrParam = dynamic_cast<DbOrParamQry*>(m_DbQry.get());
|
||||
if (!queryOrParam) return 0;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"connection")
|
||||
{
|
||||
CP_XML_ATTR(L"id", 1); //connectionId in connections(root)
|
||||
CP_XML_ATTR(L"name", L"Connection");
|
||||
|
||||
CP_XML_ATTR(L"type", queryOrParam->query.dbt);
|
||||
//switch(queryOrParam->query.dbt)
|
||||
//{
|
||||
// case 0x1: CP_XML_ATTR(L"type", 1); break;
|
||||
// case 0x2:
|
||||
// case 0x3:
|
||||
// case 0x4:
|
||||
// case 0x5:
|
||||
// case 0x6:
|
||||
// case 0x7:
|
||||
//}
|
||||
|
||||
if (queryOrParam->query.fSavePwd) CP_XML_ATTR(L"savePassword", 1);
|
||||
if (queryOrParam->query.fSavePwd) CP_XML_ATTR(L"refreshedVersion", 1);
|
||||
|
||||
int index = 0;
|
||||
CP_XML_NODE(L"dbPr")
|
||||
{
|
||||
if (index < m_arSXString.size())
|
||||
{
|
||||
CP_XML_ATTR(L"command", m_arSXString[index]);
|
||||
}
|
||||
index++;
|
||||
|
||||
if (index < m_arSXString.size())
|
||||
{
|
||||
CP_XML_ATTR(L"connection", m_arSXString[index]);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -35,9 +35,12 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
struct _DbParam
|
||||
{
|
||||
std::wstring string;
|
||||
BaseObjectPtr param;
|
||||
};
|
||||
|
||||
|
||||
// Logical representation of DBQUERY union of records
|
||||
class DBQUERY: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(DBQUERY)
|
||||
@ -49,6 +52,18 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
int serialize_connection(std::wostream & strm);
|
||||
|
||||
BaseObjectPtr m_DbQry;
|
||||
|
||||
BaseObjectPtr m_DbParam;
|
||||
std::vector<_DbParam> m_arParams;
|
||||
|
||||
std::vector<std::wstring> m_arSXString;
|
||||
//------------------------------------------------------
|
||||
GlobalWorkbookInfoPtr global_info;
|
||||
int connectionId;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of DBQUERYEXT union of records
|
||||
class DBQUERYEXT: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(DBQUERYEXT)
|
||||
@ -49,6 +47,11 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
BaseObjectPtr m_TxtQry;
|
||||
BaseObjectPtr m_DBQueryExt;
|
||||
BaseObjectPtr m_ExtString;
|
||||
std::vector<BaseObjectPtr> m_arExtString;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,10 +31,11 @@
|
||||
*/
|
||||
|
||||
#include "DBQUERYEXT.h"
|
||||
#include <Logic/Biff_records/DBQueryExt.h>
|
||||
#include <Logic/Biff_records/ExtString.h>
|
||||
#include <Logic/Biff_records/OleDbConn.h>
|
||||
#include <Logic/Biff_records/TxtQry.h>
|
||||
|
||||
#include "../Biff_records/DBQueryExt.h"
|
||||
#include "../Biff_records/ExtString.h"
|
||||
#include "../Biff_records/OleDbConn.h"
|
||||
#include "../Biff_records/TxtQry.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -84,11 +85,30 @@ const bool DBQUERYEXT::loadContent(BinProcessor& proc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
proc.optional<ExtString>();
|
||||
proc.repeated<Parenthesis_DBQUERYEXT_1>(0, 4);
|
||||
m_DBQueryExt = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
if (proc.optional<ExtString>())
|
||||
{
|
||||
m_ExtString = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
int count = proc.repeated<Parenthesis_DBQUERYEXT_1>(0, 4);
|
||||
|
||||
//....
|
||||
|
||||
if(proc.optional<TxtQry>())
|
||||
{
|
||||
proc.repeated<ExtString>(0, 0);
|
||||
m_TxtQry = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
int count = proc.repeated<ExtString>(0, 0);
|
||||
|
||||
while(count--)
|
||||
{
|
||||
m_arExtString.insert(m_arExtString.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -92,6 +92,42 @@ int DREF::serialize(std::wostream & strm)
|
||||
}
|
||||
else if(bin)
|
||||
{
|
||||
switch(bin->nBuiltin)
|
||||
{
|
||||
|
||||
case 0x0004:/*Database*/
|
||||
case 0x000d:/*_FilterDatabase*/
|
||||
{
|
||||
CP_XML_ATTR(L"type", L"external");
|
||||
//connectionId in connections(root)
|
||||
}break;
|
||||
case 0x0000:/*Consolidate_Area*/
|
||||
//{
|
||||
// CP_XML_ATTR(L"type", L"consolidation");
|
||||
// CP_XML_NODE(L"consolidation")
|
||||
// {
|
||||
// CP_XML_ATTR(L"name", bin->stFile.value());
|
||||
// }
|
||||
//}break;
|
||||
case 0x0001:/*Auto_Open*/
|
||||
case 0x0002:/*Auto_Close*/
|
||||
case 0x0003:/*Extract*/
|
||||
case 0x0005:/*Criteria*/
|
||||
case 0x0006:/*Print_Area*/
|
||||
case 0x0007:/*Print_Titles*/
|
||||
case 0x0008:/*Recorder*/
|
||||
case 0x0009:/*Data_Form*/
|
||||
case 0x000a:/*Auto_Activate*/
|
||||
case 0x000b:/*Auto_Deactivate*/
|
||||
case 0x000c:/*Sheet_Title*/
|
||||
{
|
||||
CP_XML_ATTR(L"type", L"scenario");
|
||||
CP_XML_NODE(L"worksheetSource")
|
||||
{
|
||||
CP_XML_ATTR(L"name", bin->stFile.value());
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
else if(ref)
|
||||
{
|
||||
|
||||
@ -78,6 +78,8 @@ FDB::FDB()
|
||||
bDate = false;
|
||||
bNumber = false;
|
||||
bEmpty = false;
|
||||
bInteger = false;
|
||||
bBool = false;
|
||||
}
|
||||
|
||||
FDB::~FDB()
|
||||
@ -164,6 +166,8 @@ const bool FDB::loadContent(BinProcessor& proc)
|
||||
bDate |= operatr->bDate;
|
||||
bNumber |= operatr->bNumber;
|
||||
bEmpty |= operatr->bEmpty;
|
||||
bInteger|= operatr->bInteger;
|
||||
bBool |= operatr->bBool;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -185,8 +189,9 @@ int FDB::serialize(std::wostream & strm)
|
||||
if (fdb_type->wTypeSql > 0)
|
||||
{
|
||||
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
|
||||
//CP_XML_ATTR(L"sqlType", fdb_type->wTypeSql); //in db
|
||||
}
|
||||
if (m_arSRCSXOPER.empty())
|
||||
if (m_arSRCSXOPER.empty() && m_arGRPSXOPER.empty() == false)
|
||||
{
|
||||
CP_XML_ATTR(L"databaseField", 0);
|
||||
}
|
||||
@ -234,6 +239,11 @@ int FDB::serialize(std::wostream & strm)
|
||||
// CP_XML_ATTR(L"containsString", 0);
|
||||
// }
|
||||
//}
|
||||
if (bInteger)
|
||||
{
|
||||
if (bNumber) bInteger = false;
|
||||
else bNumber = true;
|
||||
}
|
||||
if ((bDate & bNumber) || (bNumber & bString))
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
|
||||
@ -242,14 +252,17 @@ int FDB::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"containsMixedTypes", 1);
|
||||
}
|
||||
else if (!bEmpty && !bString)
|
||||
else if (!bEmpty && !bString && !bBool)
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 0);
|
||||
}
|
||||
if (bNumber) CP_XML_ATTR(L"containsNumber", 1);
|
||||
if (bDate) CP_XML_ATTR(L"containsDate", 1);
|
||||
if (!bString) CP_XML_ATTR(L"containsString", 0);
|
||||
if (bEmpty) CP_XML_ATTR(L"containsBlank", 1);
|
||||
if (bInteger) CP_XML_ATTR(L"containsInteger", 1);
|
||||
|
||||
if (!bString && (bInteger || bDate || bNumber || bEmpty))
|
||||
CP_XML_ATTR(L"containsString", 0);
|
||||
|
||||
if (fdb->fnumMinMaxValid)
|
||||
{
|
||||
|
||||
@ -64,6 +64,8 @@ public:
|
||||
bool bDate;
|
||||
bool bNumber;
|
||||
bool bEmpty;
|
||||
bool bInteger;
|
||||
bool bBool;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -62,6 +62,9 @@ const bool PIVOTCACHE::loadContent(BinProcessor& proc)
|
||||
{
|
||||
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
|
||||
|
||||
global_info->arPivotCacheFieldShortSize.clear();
|
||||
global_info->arPivotCacheFields.clear();
|
||||
|
||||
if(!proc.mandatory<SXDB>())
|
||||
{
|
||||
return false;
|
||||
@ -95,14 +98,8 @@ const bool PIVOTCACHE::loadContent(BinProcessor& proc)
|
||||
|
||||
DBB* dbb = dynamic_cast<DBB*>(m_arDBB.back().get());
|
||||
|
||||
if (global_info->arCacheFieldShortSize.size() >= m_arDBB.size())
|
||||
{
|
||||
dbb->fShortIitms = global_info->arCacheFieldShortSize[m_arDBB.size() - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
//???? группы??
|
||||
}
|
||||
dbb->arPivotCacheFieldShortSize = global_info->arPivotCacheFieldShortSize;
|
||||
dbb->arPivotCacheFields = global_info->arPivotCacheFields;
|
||||
}
|
||||
if (proc.optional<EOF_T>())
|
||||
{
|
||||
|
||||
@ -55,6 +55,8 @@ public:
|
||||
std::vector<BaseObjectPtr> m_arFDB;
|
||||
std::vector<BaseObjectPtr> m_arDBB;
|
||||
|
||||
std::vector<bool> m_arAllAtoms;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -139,7 +139,18 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pivot_cache->m_arSXFORMULA.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"calculatedItems")
|
||||
{
|
||||
CP_XML_ATTR(L"count", pivot_cache->m_arSXFORMULA.size());
|
||||
|
||||
for (size_t i = 0; i < pivot_cache->m_arSXFORMULA.size(); i++)
|
||||
{
|
||||
pivot_cache->m_arSXFORMULA[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -66,6 +66,8 @@ const bool PIVOTCORE::loadContent(BinProcessor& proc)
|
||||
m_SxView = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
SxView* sxView = dynamic_cast<SxView*>(m_SxView.get());
|
||||
|
||||
int count = 0;
|
||||
|
||||
count = proc.repeated<PIVOTVD>(0, 0);
|
||||
@ -90,12 +92,21 @@ const bool PIVOTCORE::loadContent(BinProcessor& proc)
|
||||
{
|
||||
m_arSXDI.push_back(elements_.front()); elements_.pop_front();
|
||||
}
|
||||
|
||||
count = proc.repeated<PIVOTLI>(0, 0);
|
||||
while(count--)
|
||||
PIVOTLI rwLines(sxView->cDimRw);
|
||||
if (proc.optional(rwLines))
|
||||
{
|
||||
m_arPIVOTLI.push_back(elements_.front()); elements_.pop_front();
|
||||
}
|
||||
PIVOTLI colLines(sxView->cDimCol);
|
||||
if (proc.optional(colLines))
|
||||
{
|
||||
m_arPIVOTLI.push_back(elements_.front()); elements_.pop_front();
|
||||
}
|
||||
//count = proc.repeated<PIVOTLI>(0, 0);
|
||||
//while(count--)
|
||||
//{
|
||||
// m_arPIVOTLI.push_back(elements_.front()); elements_.pop_front();
|
||||
//}
|
||||
|
||||
if (proc.mandatory<PIVOTEX>())
|
||||
{
|
||||
|
||||
@ -38,8 +38,9 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
PIVOTLI::PIVOTLI()
|
||||
PIVOTLI::PIVOTLI(int count_lines_)
|
||||
{
|
||||
count_lines = count_lines_;
|
||||
}
|
||||
|
||||
PIVOTLI::~PIVOTLI()
|
||||
@ -54,7 +55,9 @@ BaseObjectPtr PIVOTLI::clone()
|
||||
// PIVOTLI = SXLI *Continue
|
||||
const bool PIVOTLI::loadContent(BinProcessor& proc)
|
||||
{
|
||||
if(!proc.mandatory<SXLI>())
|
||||
SXLI sx_line(count_lines);
|
||||
|
||||
if(!proc.mandatory(sx_line))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -95,7 +98,12 @@ int PIVOTLI::serialize(std::wostream & strm)
|
||||
case 0x000E: CP_XML_ATTR(L"t", L"blank"); break;
|
||||
}
|
||||
|
||||
for (size_t j = 0; j < line_items->m_arItems[i].rgisxvi.size(); j++)
|
||||
if (line_items->m_arItems[i].cSic > 0 && line_items->m_arItems[i].itmType == 0)//??
|
||||
{
|
||||
CP_XML_ATTR(L"r", line_items->m_arItems[i].cSic);
|
||||
}
|
||||
|
||||
for (size_t j = line_items->m_arItems[i].cSic; j < line_items->m_arItems[i].rgisxvi.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"x")
|
||||
{
|
||||
@ -105,6 +113,7 @@ int PIVOTLI::serialize(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class PIVOTLI: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTLI)
|
||||
public:
|
||||
PIVOTLI();
|
||||
PIVOTLI(int count_lines_);
|
||||
~PIVOTLI();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
@ -52,6 +52,8 @@ public:
|
||||
static const ElementType type = typePIVOTLI;
|
||||
|
||||
BaseObjectPtr m_SXLI;
|
||||
|
||||
int count_lines;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -106,7 +106,6 @@ int PIVOTVD::serialize(std::wostream & strm)
|
||||
|
||||
if (vd->fCounta) CP_XML_ATTR(L"countASubtotal", 1);
|
||||
if (vd->fCount) CP_XML_ATTR(L"countSubtotal", 1);
|
||||
if (vd->fDefault) CP_XML_ATTR(L"defaultSubtotal", 1);
|
||||
if (vd->fSum) CP_XML_ATTR(L"sumSubtotal", 1);
|
||||
if (vd->fAverage) CP_XML_ATTR(L"avgSubtotal", 1);
|
||||
if (vd->fMax) CP_XML_ATTR(L"maxSubtotal", 1);
|
||||
@ -147,6 +146,7 @@ int PIVOTVD::serialize(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"rankBy", vd_ex->isxdiAutoShow);
|
||||
}
|
||||
if (!vd->fDefault) CP_XML_ATTR(L"defaultSubtotal", 0);
|
||||
if (!m_arSXVI.empty())
|
||||
{
|
||||
CP_XML_NODE(L"items")
|
||||
|
||||
@ -137,7 +137,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
|
||||
core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
if (core->m_arPIVOTIVD.size() == 2)//0 or 2
|
||||
if (core->m_arPIVOTIVD.size() >= 1)
|
||||
{
|
||||
CP_XML_NODE(L"rowFields")
|
||||
{
|
||||
@ -147,7 +147,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
|
||||
ivd->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
if (core->m_arPIVOTLI.size() == 2)//0 or 2
|
||||
if (core->m_arPIVOTLI.size() >= 1)//0 or 2
|
||||
{
|
||||
CP_XML_NODE(L"rowItems")
|
||||
{
|
||||
|
||||
@ -38,6 +38,28 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
// (SxName *SXPair)
|
||||
class Parenthesis_SXFMLA: public ABNFParenthesis
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(Parenthesis_SXFMLA)
|
||||
public:
|
||||
BaseObjectPtr clone()
|
||||
{
|
||||
return BaseObjectPtr(new Parenthesis_SXFMLA(*this));
|
||||
}
|
||||
|
||||
const bool loadContent(BinProcessor& proc)
|
||||
{
|
||||
if(!proc.mandatory<SxName>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int count = proc.repeated<SXPair>(0, 0);
|
||||
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
SXFMLA::SXFMLA()
|
||||
{
|
||||
@ -57,6 +79,8 @@ BaseObjectPtr SXFMLA::clone()
|
||||
// SXFMLA = SxFmla *(SxName *SXPair)
|
||||
const bool SXFMLA::loadContent(BinProcessor& proc)
|
||||
{
|
||||
GlobalWorkbookInfoPtr global_info = proc.getGlobalWorkbookInfo();
|
||||
|
||||
if(!proc.mandatory<SxFmla>())
|
||||
{
|
||||
return false;
|
||||
@ -64,6 +88,34 @@ const bool SXFMLA::loadContent(BinProcessor& proc)
|
||||
m_SxFmla = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
int count = proc.repeated<Parenthesis_SXFMLA>(0, 0);
|
||||
|
||||
while(!elements_.empty())
|
||||
{
|
||||
if (dynamic_cast<SxName*>(elements_.front().get()))
|
||||
{
|
||||
_sx_name sx_name;
|
||||
sx_name.name = elements_.front(); elements_.pop_front();
|
||||
|
||||
global_info->arPivotSxNames.push_back(sx_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
while(!elements_.empty())
|
||||
{
|
||||
if (dynamic_cast<SxName*>(elements_.front().get()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
global_info->arPivotSxNames.back().pair.push_back(elements_.front());
|
||||
elements_.pop_front();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -35,11 +35,11 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class SXFMLA: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(SXFMLA)
|
||||
public:
|
||||
|
||||
SXFMLA();
|
||||
~SXFMLA();
|
||||
|
||||
@ -49,7 +49,7 @@ public:
|
||||
|
||||
static const ElementType type = typeSXFMLA;
|
||||
|
||||
BaseObjectPtr m_SxFmla;
|
||||
BaseObjectPtr m_SxFmla;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -34,7 +34,11 @@
|
||||
|
||||
#include "SXFMLA_bu.h"
|
||||
#include "PIVOTRULE.h"
|
||||
|
||||
#include "../Biff_records/SXFormula.h"
|
||||
#include "../Biff_records/SxFmla.h"
|
||||
#include "../Biff_records/SxName.h"
|
||||
#include "../Biff_records/SXPair.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -56,6 +60,8 @@ BaseObjectPtr SXFORMULA::clone()
|
||||
// SXFORMULA = SXFMLA PIVOTRULE SXFormula
|
||||
const bool SXFORMULA::loadContent(BinProcessor& proc)
|
||||
{
|
||||
global_info = proc.getGlobalWorkbookInfo();
|
||||
|
||||
if(!proc.mandatory<SXFMLA>())
|
||||
{
|
||||
return false;
|
||||
@ -74,6 +80,29 @@ const bool SXFORMULA::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
} return true;
|
||||
}
|
||||
int SXFORMULA::serialize(std::wostream & strm)
|
||||
{
|
||||
SXFMLA* fmla = dynamic_cast<SXFMLA*>(m_SXFMLA.get());
|
||||
if (!fmla) return 0;
|
||||
|
||||
SxFmla* sx_fmla = dynamic_cast<SxFmla*>(fmla->m_SxFmla.get());
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"calculatedItem")
|
||||
{
|
||||
CP_XML_ATTR(L"formula", sx_fmla->fmla.getAssembledFormula());
|
||||
|
||||
//for (size_t j = 0; j < global_info->arPivotSxNames.size(); j++)//???
|
||||
//{
|
||||
// SxName *name = dynamic_cast<SxName*>(global_info->arPivotSxNames[j].m_SxName.get());
|
||||
// CP_XML_NODE(L"pivotArea")
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -47,11 +47,15 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
static const ElementType type = typeSXFORMULA;
|
||||
|
||||
BaseObjectPtr m_SXFMLA;
|
||||
BaseObjectPtr m_PIVOTRULE;
|
||||
BaseObjectPtr m_SXFormula;
|
||||
|
||||
GlobalWorkbookInfoPtr global_info;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -47,6 +47,8 @@ SXOPER::SXOPER()
|
||||
bDate = false;
|
||||
bNumber = false;
|
||||
bEmpty = false;
|
||||
bInteger= false;
|
||||
bBool = false;
|
||||
}
|
||||
|
||||
SXOPER::~SXOPER()
|
||||
@ -67,11 +69,20 @@ const bool SXOPER::loadContent(BinProcessor& proc)
|
||||
}
|
||||
else if(proc.optional<SXNum>())
|
||||
{
|
||||
bNumber = true;
|
||||
|
||||
SXNum *num = dynamic_cast<SXNum*>(elements_.back().get());
|
||||
if (num)
|
||||
{
|
||||
bInteger = (num->num.data.bytes.Byte1==num->num.data.bytes.Byte2 &&
|
||||
num->num.data.bytes.Byte2==num->num.data.bytes.Byte3 &&
|
||||
num->num.data.bytes.Byte3==num->num.data.bytes.Byte4 &&
|
||||
num->num.data.bytes.Byte4==0);
|
||||
}
|
||||
bNumber = !bInteger;
|
||||
}
|
||||
else if(proc.optional<SxBool>())
|
||||
{
|
||||
bNumber = true;
|
||||
bBool = true;
|
||||
}
|
||||
else if(proc.optional<SxErr>())
|
||||
{
|
||||
|
||||
@ -57,6 +57,8 @@ public:
|
||||
bool bDate;
|
||||
bool bNumber;
|
||||
bool bEmpty;
|
||||
bool bInteger;
|
||||
bool bBool;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -54,7 +54,6 @@ BaseObjectPtr SXSRC::clone()
|
||||
return BaseObjectPtr(new SXSRC(*this));
|
||||
}
|
||||
|
||||
|
||||
// SXSRC = DREF / SXTBL / DBQUERY
|
||||
const bool SXSRC::loadContent(BinProcessor& proc)
|
||||
{
|
||||
|
||||
@ -31,11 +31,12 @@
|
||||
*/
|
||||
|
||||
#include "XFS.h"
|
||||
#include <Logic/Biff_records/XF.h>
|
||||
#include <Logic/Biff_records/XFCRC.h>
|
||||
#include <Logic/Biff_records/XFExt.h>
|
||||
|
||||
#include <Logic/Biff_structures/ExtProp.h>
|
||||
#include "../Biff_records/XF.h"
|
||||
#include "../Biff_records/XFCRC.h"
|
||||
#include "../Biff_records/XFExt.h"
|
||||
|
||||
#include "../Biff_structures/ExtProp.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -114,6 +114,8 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
|
||||
cellStyleXfs_count = 0;
|
||||
cellStyleDxfs_count = 0;
|
||||
|
||||
connectionId = 0;
|
||||
|
||||
defaultDigitFontSize = std::pair<float, float>(0, 0);
|
||||
applicationFonts = NULL;
|
||||
}
|
||||
|
||||
@ -60,6 +60,13 @@ static const std::wstring DefaultPalette[] = {
|
||||
L"00003366", L"00339966", L"00003300", L"00333300", L"00993300", L"00993366", L"00333399", L"00333333"
|
||||
};
|
||||
|
||||
|
||||
struct _sx_name
|
||||
{
|
||||
BaseObjectPtr name;
|
||||
std::vector<BaseObjectPtr> pair;
|
||||
};
|
||||
|
||||
class GlobalWorkbookInfo
|
||||
{
|
||||
public:
|
||||
@ -75,7 +82,6 @@ public:
|
||||
|
||||
unsigned int GenerateAXESId();
|
||||
|
||||
|
||||
unsigned short CodePage;
|
||||
CRYPT::DecryptorPtr decryptor;
|
||||
std::wstring password;
|
||||
@ -100,7 +106,9 @@ public:
|
||||
const static unsigned int initial_AXES_id = 0x2000000;
|
||||
|
||||
std::map<int, BaseObjectPtr> mapPivotCache;
|
||||
std::vector<bool> arCacheFieldShortSize;
|
||||
std::vector<bool> arPivotCacheFields;
|
||||
std::vector<bool> arPivotCacheFieldShortSize;
|
||||
std::vector<_sx_name> arPivotSxNames;
|
||||
|
||||
std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
|
||||
std::vector<std::wstring> arDefineNames;
|
||||
@ -134,6 +142,9 @@ public:
|
||||
int cellStyleDxfs_count;
|
||||
|
||||
std::wstringstream users_Dxfs_stream;
|
||||
std::wstringstream connections_stream;
|
||||
|
||||
int connectionId;
|
||||
|
||||
XlsConverter *xls_converter;
|
||||
|
||||
|
||||
@ -218,7 +218,6 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
|
||||
xls_global_info->mapPivotCache.insert(std::make_pair(index, pivot_cache));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
@ -533,6 +532,7 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
|
||||
{
|
||||
convert((XLS::PIVOTCACHEDEFINITION*)global->m_arPIVOTCACHEDEFINITION[i].get());
|
||||
}
|
||||
xlsx_context->get_pivots_context().add_connections(xls_global_info->connections_stream.str());
|
||||
}
|
||||
|
||||
typedef boost::unordered_map<XLS::FillInfo, int> mapFillInfo;
|
||||
|
||||
@ -293,8 +293,14 @@ void xlsx_conversion_context::end_document()
|
||||
output_document_->get_xl_files().add_pivot_table(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (xlsx_pivots_context_.is_connections())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
xlsx_pivots_context_.write_connections_to(strm);
|
||||
|
||||
output_document_->get_xl_files().set_connections( package::simple_element::create(L"connections.xml", strm.str()) );
|
||||
}
|
||||
}
|
||||
output_document_->get_xl_files().set_workbook( package::simple_element::create(L"workbook.xml", strm_workbook.str()) );
|
||||
|
||||
output_document_->content_type().set_media(get_mediaitems());
|
||||
@ -307,10 +313,8 @@ void xlsx_conversion_context::end_document()
|
||||
output_document_->get_xl_files().set_vml_drawings(drawings_vml);
|
||||
|
||||
package::xl_comments_ptr comments = package::xl_comments::create(xlsx_comments_context_handle_.content());
|
||||
output_document_->get_xl_files().set_comments(comments);
|
||||
|
||||
output_document_->get_xl_files().set_comments(comments);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2423,7 +2423,7 @@ void xlsx_drawing_context::set_custom_connection(std::vector<ODRAW::MSOPOINT>& p
|
||||
|
||||
current_drawing_states->back()->custom_connection = points;
|
||||
}
|
||||
void xlsx_drawing_context::set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points)
|
||||
void xlsx_drawing_context::set_custom_connectionDir(std::vector<OSHARED::FixedPoint>& points)
|
||||
{
|
||||
if (current_drawing_states == NULL) return;
|
||||
if (current_drawing_states->empty()) return;
|
||||
|
||||
@ -182,7 +182,7 @@ public:
|
||||
std::vector<ODRAW::MSOPOINT> custom_verticles;
|
||||
std::vector<ODRAW::ADJH> custom_adjustHandles;
|
||||
std::vector<ODRAW::MSOPOINT> custom_connection;
|
||||
std::vector<ODRAW::FixedPoint> custom_connectionDir;
|
||||
std::vector<OSHARED::FixedPoint>custom_connectionDir;
|
||||
std::vector<ODRAW::MSORECT> custom_inscribe;
|
||||
|
||||
_rect custom_rect;
|
||||
@ -413,7 +413,7 @@ public:
|
||||
void set_custom_adjustValues(std::vector<_CP_OPT(int)> & values);
|
||||
void set_custom_path (int type_path);
|
||||
void set_custom_connection (std::vector<ODRAW::MSOPOINT> & points);
|
||||
void set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points);
|
||||
void set_custom_connectionDir(std::vector<OSHARED::FixedPoint>& points);
|
||||
void set_custom_inscribe (std::vector<ODRAW::MSORECT> & rects);
|
||||
void set_custom_x_limo (int val);
|
||||
void set_custom_y_limo (int val);
|
||||
|
||||
@ -53,7 +53,6 @@ xlsx_content_types_file::xlsx_content_types_file()
|
||||
|
||||
content_type_.add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
|
||||
content_type_.add_override(L"/xl/_rels/workbook.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
|
||||
content_type_.add_override(L"/xl/sharedStrings.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
|
||||
content_type_.add_override(L"/xl/workbook.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
|
||||
content_type_.add_override(L"/xl/styles.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
|
||||
content_type_.add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
|
||||
@ -194,7 +193,19 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
sharedStrings_->write(path);
|
||||
rels_files_.add( relationship( L"shId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings", L"sharedStrings.xml" ) );
|
||||
}
|
||||
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
contentTypes.add_override(L"/xl/sharedStrings.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
|
||||
}
|
||||
|
||||
if (connections_)
|
||||
{
|
||||
connections_->write(path);
|
||||
rels_files_.add( relationship( L"cnId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", L"connections.xml" ) );
|
||||
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
contentTypes.add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
|
||||
}
|
||||
|
||||
if (styles_)
|
||||
{
|
||||
@ -255,6 +266,10 @@ void xl_files::set_sharedStrings(element_ptr Element)
|
||||
{
|
||||
sharedStrings_ = Element;
|
||||
}
|
||||
void xl_files::set_connections(element_ptr Element)
|
||||
{
|
||||
connections_ = Element;
|
||||
}
|
||||
|
||||
void xl_files::add_sheet(sheet_content_ptr sheet)
|
||||
{
|
||||
|
||||
@ -223,6 +223,7 @@ public:
|
||||
void set_workbook (element_ptr Element);
|
||||
void set_styles (element_ptr Element);
|
||||
void set_sharedStrings (element_ptr Element);
|
||||
void set_connections (element_ptr Element);
|
||||
void add_sheet (sheet_content_ptr sheet);
|
||||
void set_media (external_items & _Mediaitems);
|
||||
void set_drawings (element_ptr Element);
|
||||
@ -241,6 +242,7 @@ private:
|
||||
element_ptr theme_;
|
||||
element_ptr workbook_;
|
||||
|
||||
element_ptr connections_;
|
||||
element_ptr styles_;
|
||||
element_ptr sharedStrings_;
|
||||
element_ptr media_;
|
||||
|
||||
@ -54,6 +54,7 @@ public:
|
||||
|
||||
std::vector<_pivot_cache> caches_;
|
||||
std::vector<_pivot_view> views_;
|
||||
std::wstring connections_;
|
||||
};
|
||||
|
||||
xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl())
|
||||
@ -70,7 +71,10 @@ int xlsx_pivots_context::get_cache_count()
|
||||
{
|
||||
return (int)impl_->caches_.size();
|
||||
}
|
||||
|
||||
bool xlsx_pivots_context::is_connections()
|
||||
{
|
||||
return !impl_->connections_.empty();
|
||||
}
|
||||
void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
|
||||
{
|
||||
if (impl_->caches_[index].recordsData_.empty() == false)
|
||||
@ -93,6 +97,18 @@ void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream &
|
||||
{
|
||||
strm << impl_->caches_[index].definitionsData_;
|
||||
}
|
||||
void xlsx_pivots_context::write_connections_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"connections")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
|
||||
CP_XML_STREAM() << impl_->connections_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::write_cache_records_to(int index, std::wostream & strm)
|
||||
{
|
||||
@ -112,6 +128,13 @@ int xlsx_pivots_context::add_view(std::wstring table_view, int indexCache)
|
||||
return (int)impl_->views_.size();
|
||||
}
|
||||
|
||||
void xlsx_pivots_context::add_connections(std::wstring connections)
|
||||
{
|
||||
if (connections.empty()) return;
|
||||
|
||||
impl_->connections_ = connections;
|
||||
}
|
||||
|
||||
int xlsx_pivots_context::get_view_count()
|
||||
{
|
||||
return (int)impl_->views_.size();
|
||||
|
||||
@ -51,11 +51,16 @@ public:
|
||||
|
||||
void write_cache_definitions_to (int index, std::wostream & strm);
|
||||
void write_cache_records_to (int index, std::wostream & strm);
|
||||
void write_connections_to (std::wostream & strm);
|
||||
|
||||
void write_table_view_to (int index, std::wostream & strm);
|
||||
|
||||
void dump_rels_cache(int index, rels & Rels);
|
||||
void dump_rels_view (int index, rels & Rels);
|
||||
|
||||
void add_connections(std::wstring connections);
|
||||
bool is_connections();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
@ -40,8 +40,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../3dParty/curl/curl/include/curl/curl.h"
|
||||
#include "../3dParty/curl/curl/include/curl/easy.h"
|
||||
#include <curl/curl.h>
|
||||
#include <curl/easy.h>
|
||||
|
||||
|
||||
class CFileDownloaderBaseCURL : public CFileDownloaderBase
|
||||
|
||||
Reference in New Issue
Block a user