Commit 36bdbad6 authored by Sergey Konovalov's avatar Sergey Konovalov

for bug 27765

external OleLink/DdeLink
parent 525b8285
...@@ -137,7 +137,7 @@ namespace PPTX ...@@ -137,7 +137,7 @@ namespace PPTX
pWriter->WriteLimit2(4, m_oDrawAspect); pWriter->WriteLimit2(4, m_oDrawAspect);
pWriter->WriteLimit2(5, m_oType); pWriter->WriteLimit2(5, m_oType);
pWriter->WriteLimit2(6, m_oUpdateMode); pWriter->WriteLimit2(6, m_oUpdateMode);
if (ole_file.IsInit() == false || ole_file->isMsPackage() == false) if (ole_file.IsInit() && ole_file->isMsPackage() == false)
{ {
std::wstring sExt = ole_file->filename().GetExtention(false); std::wstring sExt = ole_file->filename().GetExtention(false);
if (!sExt.empty()) if (!sExt.empty())
......
...@@ -1099,6 +1099,14 @@ namespace OOX ...@@ -1099,6 +1099,14 @@ namespace OOX
et_x_ExternalSheetData, et_x_ExternalSheetData,
et_x_ExternalRow, et_x_ExternalRow,
et_x_ExternalCell, et_x_ExternalCell,
et_x_OleLink,
et_x_OleItems,
et_x_OleItem,
et_x_DdeLink,
et_x_DdeItems,
et_x_DdeItem,
et_x_DdeValues,
et_x_DdeValue,
et_x_Selection, et_x_Selection,
et_x_LegacyDrawingWorksheet, et_x_LegacyDrawingWorksheet,
et_x_LegacyDrawingHFWorksheet, et_x_LegacyDrawingHFWorksheet,
......
...@@ -68,7 +68,35 @@ namespace OOX ...@@ -68,7 +68,35 @@ namespace OOX
return type().DefaultFileName(); return type().DefaultFileName();
} }
}; };
class ExternalOleObject : public External
{
public:
ExternalOleObject()
{
}
ExternalOleObject(const CPath& uri)
{
read(uri);
}
~ExternalOleObject()
{
}
public:
virtual const FileType type() const
{
return OOX::FileTypes::OleObject;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
}// namespace Spreadsheet }// namespace Spreadsheet
} // namespace OOX } // namespace OOX
#endif // OOX_EXTERNALLINKPATH_INCLUDE_H_ #endif // OOX_EXTERNALLINKPATH_INCLUDE_H_
\ No newline at end of file
...@@ -161,7 +161,16 @@ namespace OOX ...@@ -161,7 +161,16 @@ namespace OOX
else if ( pRelation->Type() == OOX::FileTypes::ExternalLinkPath) else if ( pRelation->Type() == OOX::FileTypes::ExternalLinkPath)
return smart_ptr<OOX::File>(new ExternalLinkPath( oRelationFilename )); return smart_ptr<OOX::File>(new ExternalLinkPath( oRelationFilename ));
else if ( pRelation->Type() == OOX::FileTypes::OleObject) else if ( pRelation->Type() == OOX::FileTypes::OleObject)
return smart_ptr<OOX::File>(new OOX::OleObject( oFileName )); {
if (pRelation->IsExternal())
{
return smart_ptr<OOX::File>(new OOX::OleObject( oRelationFilename ));
}
else
{
return smart_ptr<OOX::File>(new OOX::OleObject( oFileName ));
}
}
else if ( pRelation->Type() == OOX::FileTypes::Data) else if ( pRelation->Type() == OOX::FileTypes::Data)
return smart_ptr<OOX::File>(new OOX::CDiagramData( oRootPath, oFileName )); return smart_ptr<OOX::File>(new OOX::CDiagramData( oRootPath, oFileName ));
else if ( pRelation->Type() == OOX::FileTypes::DiagDrawing) else if ( pRelation->Type() == OOX::FileTypes::DiagDrawing)
......
...@@ -2608,5 +2608,48 @@ namespace SimpleTypes ...@@ -2608,5 +2608,48 @@ namespace SimpleTypes
SimpleType_FromString (EPaneState) SimpleType_FromString (EPaneState)
SimpleType_Operator_Equal (CPaneState) SimpleType_Operator_Equal (CPaneState)
}; };
enum EDdeValueType
{
ddevaluetypeNil = 0,
ddevaluetypeB = 1,
ddevaluetypeN = 2,
ddevaluetypeE = 3,
ddevaluetypeStr = 4
};
template<EDdeValueType eDefValue = ddevaluetypeNil>
class CDdeValueType : public CSimpleType<EDdeValueType, eDefValue>
{
public:
CDdeValueType() {}
virtual EDdeValueType FromString(std::wstring &sValue)
{
if ( _T("nil") == sValue ) this->m_eValue = ddevaluetypeNil;
else if ( _T("b") == sValue ) this->m_eValue = ddevaluetypeB;
else if ( _T("n") == sValue ) this->m_eValue = ddevaluetypeN;
else if ( _T("e") == sValue ) this->m_eValue = ddevaluetypeE;
else if ( _T("str") == sValue ) this->m_eValue = ddevaluetypeStr;
else this->m_eValue = eDefValue;
return this->m_eValue;
}
virtual std::wstring ToString () const
{
switch(this->m_eValue)
{
case ddevaluetypeNil : return _T("nil");
case ddevaluetypeB : return _T("b");
case ddevaluetypeN : return _T("n");
case ddevaluetypeE : return _T("e");
case ddevaluetypeStr : return _T("str");
default : return _T("nil");
}
}
SimpleType_FromString (EDdeValueType)
SimpleType_Operator_Equal (CDdeValueType)
};
};// Spreadsheet };// Spreadsheet
} // SimpleTypes } // SimpleTypes
...@@ -188,7 +188,9 @@ namespace BinXlsxRW ...@@ -188,7 +188,9 @@ namespace BinXlsxRW
ExternalReference = 6, ExternalReference = 6,
PivotCaches = 7, PivotCaches = 7,
PivotCache = 8, PivotCache = 8,
ExternalBook = 9 ExternalBook = 9,
OleLink = 10,
DdeLink = 11
};} };}
namespace c_oSerWorkbookPrTypes{enum c_oSerWorkbookPrTypes namespace c_oSerWorkbookPrTypes{enum c_oSerWorkbookPrTypes
{ {
...@@ -841,6 +843,32 @@ namespace BinXlsxRW ...@@ -841,6 +843,32 @@ namespace BinXlsxRW
SheetDataRowCellType = 16, SheetDataRowCellType = 16,
SheetDataRowCellValue = 17 SheetDataRowCellValue = 17
};} };}
namespace c_oSer_OleLinkTypes{enum c_oSer_OleLinkTypes
{
Id = 0,
ProgId = 1,
OleItem = 2,
Name = 3,
Icon = 4,
Advise = 5,
PreferPic = 6
};}
namespace c_oSer_DdeLinkTypes{enum c_oSer_DdeLinkTypes
{
DdeService = 0,
DdeTopic = 1,
DdeItem = 2,
Name = 3,
Ole = 4,
Advise = 5,
PreferPic = 6,
DdeValues = 7,
DdeValuesRows = 8,
DdeValuesCols = 9,
DdeValue = 10,
DdeValueType = 11,
DdeValueVal = 12
};}
} }
#endif // #endif //
...@@ -1587,22 +1587,50 @@ namespace BinXlsxRW ...@@ -1587,22 +1587,50 @@ namespace BinXlsxRW
if (pFile.IsInit() && OOX::Spreadsheet::FileTypes::ExternalLinks == pFile->type()) if (pFile.IsInit() && OOX::Spreadsheet::FileTypes::ExternalLinks == pFile->type())
{ {
OOX::Spreadsheet::CExternalLink* pExternalLink = static_cast<OOX::Spreadsheet::CExternalLink*>(pFile.operator ->()); OOX::Spreadsheet::CExternalLink* pExternalLink = static_cast<OOX::Spreadsheet::CExternalLink*>(pFile.operator ->());
if ((pExternalLink) && (pExternalLink->m_oExternalBook.IsInit())) if (pExternalLink)
{ {
std::wstring sLink; if(pExternalLink->m_oExternalBook.IsInit())
if (pExternalLink->m_oExternalBook->m_oRid.IsInit())
{ {
smart_ptr<OOX::File> pFile = pExternalLink->Find( OOX::RId(pExternalLink->m_oExternalBook->m_oRid.get().GetValue())); std::wstring sLink;
if (pFile.IsInit() && OOX::FileTypes::ExternalLinkPath == pFile->type()) if (pExternalLink->m_oExternalBook->m_oRid.IsInit())
{ {
OOX::Spreadsheet::ExternalLinkPath* pLinkFile = static_cast<OOX::Spreadsheet::ExternalLinkPath*>(pFile.operator ->()); smart_ptr<OOX::File> pFile = pExternalLink->Find( OOX::RId(pExternalLink->m_oExternalBook->m_oRid.get().GetValue()));
sLink = pLinkFile->Uri().GetPath(); if (pFile.IsInit() && OOX::FileTypes::ExternalLinkPath == pFile->type())
{
OOX::Spreadsheet::ExternalLinkPath* pLinkFile = static_cast<OOX::Spreadsheet::ExternalLinkPath*>(pFile.operator ->());
sLink = pLinkFile->Uri().GetPath();
}
}
if(!sLink.empty())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::ExternalBook);
WriteExternalBook(pExternalLink->m_oExternalBook.get(), sLink);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
} }
} }
if(!sLink.empty()) else if(pExternalLink->m_oOleLink.IsInit())
{ {
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::ExternalBook); std::wstring sLink;
WriteExternalBook(pExternalLink->m_oExternalBook.get(), sLink); if (pExternalLink->m_oOleLink->m_oRid.IsInit())
{
smart_ptr<OOX::File> pFile = pExternalLink->Find( OOX::RId(pExternalLink->m_oOleLink->m_oRid.get().GetValue()));
if (pFile.IsInit() && OOX::FileTypes::OleObject == pFile->type())
{
OOX::OleObject* pLinkFile = static_cast<OOX::OleObject*>(pFile.operator ->());
sLink = pLinkFile->filename().GetPath();
}
}
if(!sLink.empty())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::OleLink);
WriteOleLink(pExternalLink->m_oOleLink.get(), sLink);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
else if(pExternalLink->m_oDdeLink.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::DdeLink);
WriteDdeLink(pExternalLink->m_oDdeLink.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos); m_oBcw.WriteItemWithLengthEnd(nCurPos);
} }
} }
...@@ -1748,6 +1776,155 @@ namespace BinXlsxRW ...@@ -1748,6 +1776,155 @@ namespace BinXlsxRW
m_oBcw.WriteItemWithLengthEnd(nCurPos); m_oBcw.WriteItemWithLengthEnd(nCurPos);
} }
} }
void WriteOleLink(const OOX::Spreadsheet::COleLink& oleLink, const std::wstring& sLink)
{
int nCurPos = 0;
nCurPos = m_oBcw.WriteItemStart(c_oSer_OleLinkTypes::Id);
m_oBcw.m_oStream.WriteStringW3(sLink);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
if (oleLink.m_oProgId.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_OleLinkTypes::ProgId);
m_oBcw.m_oStream.WriteStringW3(oleLink.m_oProgId.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oleLink.m_oOleItems.IsInit())
{
for(size_t i = 0; i < oleLink.m_oOleItems->m_arrItems.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_OleLinkTypes::OleItem);
WriteOleItem(*oleLink.m_oOleItems->m_arrItems[i]);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
}
void WriteOleItem(const OOX::Spreadsheet::COleItem& oleItem)
{
int nCurPos = 0;
if (oleItem.m_oName.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_OleLinkTypes::Name);
m_oBcw.m_oStream.WriteStringW3(oleItem.m_oName.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oleItem.m_oIcon.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_OleLinkTypes::Icon);
m_oBcw.m_oStream.WriteBOOL(oleItem.m_oIcon->ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oleItem.m_oAdvise.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_OleLinkTypes::Advise);
m_oBcw.m_oStream.WriteBOOL(oleItem.m_oAdvise->ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (oleItem.m_oPreferPic.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_OleLinkTypes::PreferPic);
m_oBcw.m_oStream.WriteBOOL(oleItem.m_oPreferPic->ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteDdeLink(const OOX::Spreadsheet::CDdeLink& ddeLink)
{
int nCurPos = 0;
if (ddeLink.m_oDdeService.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeService);
m_oBcw.m_oStream.WriteStringW3(ddeLink.m_oDdeService.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (ddeLink.m_oDdeTopic.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeTopic);
m_oBcw.m_oStream.WriteStringW3(ddeLink.m_oDdeTopic.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (ddeLink.m_oDdeItems.IsInit())
{
for(size_t i = 0; i < ddeLink.m_oDdeItems->m_arrItems.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeItem);
WriteDdeItem(*ddeLink.m_oDdeItems->m_arrItems[i]);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
}
void WriteDdeItem(const OOX::Spreadsheet::CDdeItem& ddeItem)
{
int nCurPos = 0;
if (ddeItem.m_oName.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::Name);
m_oBcw.m_oStream.WriteStringW3(ddeItem.m_oName.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (ddeItem.m_oOle.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::Ole);
m_oBcw.m_oStream.WriteBOOL(ddeItem.m_oOle->ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (ddeItem.m_oAdvise.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::Advise);
m_oBcw.m_oStream.WriteBOOL(ddeItem.m_oAdvise->ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (ddeItem.m_oPreferPic.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::PreferPic);
m_oBcw.m_oStream.WriteBOOL(ddeItem.m_oPreferPic->ToBool());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (ddeItem.m_oDdeValues.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeValues);
WriteDdeValues(ddeItem.m_oDdeValues.get());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteDdeValues(const OOX::Spreadsheet::CDdeValues& ddeValues)
{
int nCurPos = 0;
if (ddeValues.m_oRows.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeValuesRows);
m_oBcw.m_oStream.WriteULONG(ddeValues.m_oRows->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
if (ddeValues.m_oCols.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeValuesCols);
m_oBcw.m_oStream.WriteULONG(ddeValues.m_oCols->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
for(size_t i = 0; i < ddeValues.m_arrItems.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeValue);
WriteDdeValue(*ddeValues.m_arrItems[i]);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteDdeValue(const OOX::Spreadsheet::CDdeValue& ddeValue)
{
int nCurPos = 0;
if (ddeValue.m_oType.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeValueType);
m_oBcw.m_oStream.WriteBYTE(ddeValue.m_oType->GetValue());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
for (size_t i = 0; i < ddeValue.m_arrItems.size(); ++i)
{
nCurPos = m_oBcw.WriteItemStart(c_oSer_DdeLinkTypes::DdeValueVal);
m_oBcw.m_oStream.WriteStringW3(ddeValue.m_arrItems[i]->ToString());
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
void WriteDefinedName(const OOX::Spreadsheet::CDefinedName& definedName) void WriteDefinedName(const OOX::Spreadsheet::CDefinedName& definedName)
{ {
int nCurPos = 0; int nCurPos = 0;
...@@ -2874,7 +3051,10 @@ namespace BinXlsxRW ...@@ -2874,7 +3051,10 @@ namespace BinXlsxRW
{ {
OOX::CPath pathImage = pImageFileCache->filename(); OOX::CPath pathImage = pImageFileCache->filename();
olePic->oleObject->m_OleObjectFile->set_filename_cache(pathImage); if (olePic->oleObject->m_OleObjectFile.IsInit())
{
olePic->oleObject->m_OleObjectFile->set_filename_cache(pathImage);
}
olePic->blipFill.blip->embed = new OOX::RId(sIdImageFileCache); //ваще то тут не важно что - приоритет у того что ниже.. olePic->blipFill.blip->embed = new OOX::RId(sIdImageFileCache); //ваще то тут не важно что - приоритет у того что ниже..
olePic->blipFill.blip->oleFilepathImage = pathImage.GetPath(); olePic->blipFill.blip->oleFilepathImage = pathImage.GetPath();
......
...@@ -1615,6 +1615,40 @@ namespace BinXlsxRW { ...@@ -1615,6 +1615,40 @@ namespace BinXlsxRW {
RELEASEOBJECT(extLink) RELEASEOBJECT(extLink)
} }
} }
else if(c_oSerWorkbookTypes::OleLink == type)
{
OOX::Spreadsheet::CExternalLink *extLink = new OOX::Spreadsheet::CExternalLink();
extLink->m_oOleLink.Init();
res = Read1(length, &BinaryWorkbookTableReader::ReadOleLink, this, extLink);
if (extLink->m_oOleLink->m_oRid.IsInit())
{
smart_ptr<OOX::File> oCurFile(extLink);
const OOX::RId oRId = m_oWorkbook.Add(oCurFile);
OOX::Spreadsheet::CExternalReference* pExternalReference = new OOX::Spreadsheet::CExternalReference();
pExternalReference->m_oRid.Init();
pExternalReference->m_oRid->SetValue(oRId.get());
m_oWorkbook.m_oExternalReferences->m_arrItems.push_back(pExternalReference);
}
else
{
RELEASEOBJECT(extLink)
}
}
else if(c_oSerWorkbookTypes::DdeLink == type)
{
OOX::Spreadsheet::CExternalLink *extLink = new OOX::Spreadsheet::CExternalLink();
extLink->m_oDdeLink.Init();
res = Read1(length, &BinaryWorkbookTableReader::ReadDdeLink, this, extLink->m_oDdeLink.GetPointer());
smart_ptr<OOX::File> oCurFile(extLink);
const OOX::RId oRId = m_oWorkbook.Add(oCurFile);
OOX::Spreadsheet::CExternalReference* pExternalReference = new OOX::Spreadsheet::CExternalReference();
pExternalReference->m_oRid.Init();
pExternalReference->m_oRid->SetValue(oRId.get());
m_oWorkbook.m_oExternalReferences->m_arrItems.push_back(pExternalReference);
}
else else
res = c_oSerConstants::ReadUnknown; res = c_oSerConstants::ReadUnknown;
return res; return res;
...@@ -1832,7 +1866,173 @@ namespace BinXlsxRW { ...@@ -1832,7 +1866,173 @@ namespace BinXlsxRW {
res = c_oSerConstants::ReadUnknown; res = c_oSerConstants::ReadUnknown;
return res; return res;
}; };
int ReadOleLink(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CExternalLink* extLink = static_cast<OOX::Spreadsheet::CExternalLink*>(poResult);
OOX::Spreadsheet::COleLink* oleLink = extLink->m_oOleLink.GetPointer();
int res = c_oSerConstants::ReadOk;
if(c_oSer_OleLinkTypes::Id == type)
{
std::wstring sName(m_oBufferedStream.GetString3(length));
OOX::Spreadsheet::ExternalOleObject *link = new OOX::Spreadsheet::ExternalOleObject(sName);
smart_ptr<OOX::File> oLinkFile(link);
const OOX::RId oRIdLink = extLink->Add(oLinkFile);
oleLink->m_oRid.Init();
oleLink->m_oRid->SetValue(oRIdLink.get());
}
else if(c_oSer_OleLinkTypes::ProgId == type)
{
oleLink->m_oProgId.Init();
oleLink->m_oProgId->append(m_oBufferedStream.GetString3(length));
}
else if(c_oSer_OleLinkTypes::OleItem == type)
{
if (!oleLink->m_oOleItems.IsInit())
{
oleLink->m_oOleItems.Init();
}
OOX::Spreadsheet::COleItem* pOleItem = new OOX::Spreadsheet::COleItem();
res = Read1(length, &BinaryWorkbookTableReader::ReadOleItem, this, pOleItem);
oleLink->m_oOleItems->m_arrItems.push_back(pOleItem);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadOleItem(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::COleItem* pOleItem = static_cast<OOX::Spreadsheet::COleItem*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_OleLinkTypes::Name == type)
{
pOleItem->m_oName.Init();
pOleItem->m_oName->append(m_oBufferedStream.GetString3(length));
}
else if(c_oSer_OleLinkTypes::Icon == type)
{
pOleItem->m_oIcon.Init();
pOleItem->m_oIcon->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_OleLinkTypes::Advise == type)
{
pOleItem->m_oAdvise.Init();
pOleItem->m_oAdvise->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_OleLinkTypes::PreferPic == type)
{
pOleItem->m_oPreferPic.Init();
pOleItem->m_oPreferPic->FromBool(m_oBufferedStream.GetBool());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadDdeLink(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CDdeLink* ddeLink = static_cast<OOX::Spreadsheet::CDdeLink*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_DdeLinkTypes::DdeService == type)
{
ddeLink->m_oDdeService.Init();
ddeLink->m_oDdeService->append(m_oBufferedStream.GetString3(length));
}
else if(c_oSer_DdeLinkTypes::DdeTopic == type)
{
ddeLink->m_oDdeTopic.Init();
ddeLink->m_oDdeTopic->append(m_oBufferedStream.GetString3(length));
}
else if(c_oSer_DdeLinkTypes::DdeItem == type)
{
if (!ddeLink->m_oDdeItems.IsInit())
{
ddeLink->m_oDdeItems.Init();
}
OOX::Spreadsheet::CDdeItem* pDdeItem = new OOX::Spreadsheet::CDdeItem();
res = Read1(length, &BinaryWorkbookTableReader::ReadDdeItem, this, pDdeItem);
ddeLink->m_oDdeItems->m_arrItems.push_back(pDdeItem);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadDdeItem(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CDdeItem* pDdeItem = static_cast<OOX::Spreadsheet::CDdeItem*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_DdeLinkTypes::Name == type)
{
pDdeItem->m_oName.Init();
pDdeItem->m_oName->append(m_oBufferedStream.GetString3(length));
}
else if(c_oSer_DdeLinkTypes::Ole == type)
{
pDdeItem->m_oOle.Init();
pDdeItem->m_oOle->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_DdeLinkTypes::Advise == type)
{
pDdeItem->m_oAdvise.Init();
pDdeItem->m_oAdvise->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_DdeLinkTypes::PreferPic == type)
{
pDdeItem->m_oPreferPic.Init();
pDdeItem->m_oPreferPic->FromBool(m_oBufferedStream.GetBool());
}
else if(c_oSer_DdeLinkTypes::DdeValues == type)
{
pDdeItem->m_oDdeValues.Init();
res = Read1(length, &BinaryWorkbookTableReader::ReadDdeValues, this, pDdeItem->m_oDdeValues.GetPointer());
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadDdeValues(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CDdeValues* pDdeValues = static_cast<OOX::Spreadsheet::CDdeValues*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_DdeLinkTypes::DdeValuesRows == type)
{
pDdeValues->m_oRows.Init();
pDdeValues->m_oRows->SetValue(m_oBufferedStream.GetULong());
}
else if(c_oSer_DdeLinkTypes::DdeValuesCols == type)
{
pDdeValues->m_oCols.Init();
pDdeValues->m_oCols->SetValue(m_oBufferedStream.GetULong());
}
else if(c_oSer_DdeLinkTypes::DdeValue == type)
{
OOX::Spreadsheet::CDdeValue* pDdeValue = new OOX::Spreadsheet::CDdeValue();
res = Read1(length, &BinaryWorkbookTableReader::ReadDdeValue, this, pDdeValue);
pDdeValues->m_arrItems.push_back(pDdeValue);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadDdeValue(BYTE type, long length, void* poResult)
{
OOX::Spreadsheet::CDdeValue* pDdeValue = static_cast<OOX::Spreadsheet::CDdeValue*>(poResult);
int res = c_oSerConstants::ReadOk;
if(c_oSer_DdeLinkTypes::DdeValueType == type)
{
pDdeValue->m_oType.Init();
pDdeValue->m_oType->SetValue((SimpleTypes::Spreadsheet::EDdeValueType)m_oBufferedStream.GetUChar());
}
else if(c_oSer_DdeLinkTypes::DdeValueVal == type)
{
OOX::Spreadsheet::CText* pText = new OOX::Spreadsheet::CText();
pText->m_sText.append(m_oBufferedStream.GetString3(length));
pDdeValue->m_arrItems.push_back(pText);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int ReadPivotCaches(BYTE type, long length, void* poResult) int ReadPivotCaches(BYTE type, long length, void* poResult)
{ {
int res = c_oSerConstants::ReadOk; int res = c_oSerConstants::ReadOk;
......
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