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

XlsFile2

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63585 954022d7-b5bf-4e40-9824-e11837661b57
parent 78779482
......@@ -6,6 +6,7 @@
#include <Logic/Biff_structures/CellRangeRef.h>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
namespace AUX
{;
......
......@@ -4,7 +4,10 @@
#include "CFStream.h"
#include "BinSmartPointers.h"
#include "../Logic/GlobalWorkbookInfo.h"
#include <common.h>
#include <Auxiliary/HelpFunc.h>
namespace XLS
{;
......
......@@ -31,7 +31,7 @@ CFStream::~CFStream()
// Read 'size' unsigned chars from the stream
void CFStream::read(void* buf, const size_t size)
{
if(NULL == buf)
if(NULL == buf || stream_ == NULL)
{
throw;// EXCEPT::RT::CompoundFileFormatError("Wrong buffer pointer (NULL)");
}
......@@ -48,7 +48,7 @@ void CFStream::read(void* buf, const size_t size)
// Write 'size' unsigned chars to the stream
void CFStream::write(const void* buf, const size_t size)
{
if(NULL == buf)
if(NULL == buf || stream_ == NULL)
{
throw;// EXCEPT::RT::CompoundFileFormatError("Wrong buffer pointer (NULL)");
}
......
......@@ -58,42 +58,42 @@ CFStreamPtr CompoundFile::createWorkbookStream()
// Opens "SummaryInformation" stream and returns the only reference
CFStreamPtr CompoundFile::getSummaryInformationStream()
{
return getNamedStream("\005SummaryInformation");
return getNamedStream("SummaryInformation");
}
// Creates "SummaryInformation" stream and returns the only reference
CFStreamPtr CompoundFile::createSummaryInformationStream()
{
return createNamedStream("\005SummaryInformation");
return createNamedStream("SummaryInformation");
}
// Closes "SummaryInformation" stream
void CompoundFile::closeSummaryInformationStream()
{
return closeNamedStream("\005SummaryInformation");
return closeNamedStream("SummaryInformation");
}
// Opens "SummaryInformation" stream and returns the only reference
CFStreamPtr CompoundFile::getDocumentSummaryInformationStream()
{
return getNamedStream("\005DocumentSummaryInformation");
return getNamedStream("DocumentSummaryInformation");
}
// Creates "SummaryInformation" stream and returns the only reference
CFStreamPtr CompoundFile::createDocumentSummaryInformationStream()
{
return createNamedStream("\005DocumentSummaryInformation");
return createNamedStream("DocumentSummaryInformation");
}
// Closes "SummaryInformation" stream
void CompoundFile::closeDocumentSummaryInformationStream()
{
closeNamedStream("\005DocumentSummaryInformation");
closeNamedStream("DocumentSummaryInformation");
}
......
#include "precompiled_xls.h"
#include <Logic\Biff_Structures\BiffStructure.h>
#include <../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h>
#include "Document.h"
......@@ -16,7 +17,7 @@ Document::Document(const std::wstring & root_name)
Document::~Document()
{
all_documents[guid_] = NULL;
all_documents[uniq_] = NULL;
}
//
......@@ -34,20 +35,38 @@ Document::~Document()
void Document::newDoc(const std::wstring & root_name)
{
if(guid_.length()>0)
if(!uniq_.empty())
{
all_documents.erase(guid_);
all_documents.erase(uniq_);
}
GUID guid = {0};
CoCreateGuid(&guid);
guid_ = STR::guid2bstr(guid);
#if defined(_WIN32) || defined (_WIN64)
UUID uuid;
RPC_WSTR str_uuid;
UuidCreate (&uuid);
UuidToString (&uuid, &str_uuid);
uniq_ = (TCHAR *) str_uuid;
RpcStringFree (&str_uuid);
#else
char pcRes[MAX_PATH] = "XXXXXX";
pcRes[6] = '\0';
int res = mkstemp( pcRes);
std::string sRes = pcRes;
uniq_ = stringUtf8ToWString(sRes);
#endif
//xmlDoc->set_document_guid(guid_);
//xmlDoc->set_document_name(root_name);
//xmlDoc->loadXML(L"<?xml version=\"1.0\" encoding=\"utf-8\" ?> <" + root_name + L" id=\"" + guid_ + L"\"/>"); // Initial tag;
all_documents[guid_] = this;
all_documents[uniq_] = this;
}
const int Document::appendBinaryData(XLS::BiffStructurePtr & elem, const char * data, const size_t size)
......@@ -89,7 +108,7 @@ const std::pair<char*, size_t> Document::getBinaryData(const int index) const
Document* Document::findDocumentByElement(XLS::BiffStructurePtr & elem)
{
return all_documents[static_cast<std::wstring>(elem->get_document()->guid_)];
return all_documents[static_cast<std::wstring>(elem->get_document()->uniq_)];
}
......
......@@ -29,7 +29,7 @@ public:
const std::pair<char*, size_t> getBinaryData(const int index) const;
std::wstring guid_;
std::wstring uniq_;
private:
//XLS::BiffStructurePtr xmlDoc;
......
......@@ -32,7 +32,7 @@ void GUIDTypeLib::readFields(CFRecord& record)
{
record.skipNunBytes(12);
#pragma message("############################ frtHeader skipped here")
GUID guid_num;
_GUID_ guid_num;
record >> guid_num;
guid = STR::guid2bstr(guid_num);
}
......
......@@ -23,14 +23,14 @@ BaseObjectPtr HLink::clone()
void HLink::writeFields(CFRecord& record)
{
static CLSID StdLink_CLSID = {0x79EAC9D0, 0xBAF9, 0x11CE, {0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B}};
static _GUID_ StdLink_CLSID = {0x79EAC9D0, 0xBAF9, 0x11CE, {0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B}};
record << ref8 << StdLink_CLSID << hyperlink;
}
void HLink::readFields(CFRecord& record)
{
CLSID clsid;
_GUID_ clsid;
record >> ref8 >> clsid >> hyperlink;
hlinkClsid = STR::guid2bstr(clsid);
}
......
......@@ -28,12 +28,7 @@ public:
Ref8U ref8;
ForwardOnlyParam<std::wstring > hlinkClsid;
OSHARED::HyperlinkObject hyperlink;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_COMPLEX(ref8)
//BO_ATTRIB_MARKUP_ATTRIB(hlinkClsid)
//BO_ATTRIB_MARKUP_COMPLEX(hyperlink)
//BO_ATTRIB_MARKUP_END
};
......
......@@ -26,7 +26,7 @@ void HeaderFooter::writeFields(CFRecord& record)
{
FrtHeader frtHeader(rt_HeaderFooter);
record << frtHeader;
GUID guid_num;
_GUID_ guid_num;
if(!STR::bstr2guid(guidSView, guid_num))
{
throw;// EXCEPT::LE::AttributeDataWrong(L"guid", L"HeaderFooter", guidSView);
......@@ -67,7 +67,7 @@ void HeaderFooter::readFields(CFRecord& record)
FrtHeader frtHeader(rt_HeaderFooter);
record >> frtHeader;
unsigned short flags;
GUID guid_num;
_GUID_ guid_num;
record >> guid_num >> flags;
guidSView = STR::guid2bstr(guid_num);
fHFDiffOddEven = GETBIT(flags, 0);
......
......@@ -26,7 +26,7 @@ void UserBView::writeFields(CFRecord& record)
record.reserveNunBytes(4); // unused1
record << tabId;
record.reserveNunBytes(2); // reserved1
GUID guid_num;
_GUID_ guid_num;
if(!STR::bstr2guid(guid, guid_num))
{
throw;// EXCEPT::LE::AttributeDataWrong(L"guid", L"UserBView", guid);
......@@ -110,7 +110,7 @@ void UserBView::readFields(CFRecord& record)
record.skipNunBytes(4); // unused1
record >> tabId;
record.skipNunBytes(2); // reserved1
GUID guid_num;
_GUID_ guid_num;
record >> guid_num >> x >> y >> dx >> dy >> wTabRatio;
guid = STR::guid2bstr(guid_num);
......
......@@ -24,7 +24,7 @@ BaseObjectPtr UserSViewBegin::clone()
void UserSViewBegin::writeFields(CFRecord& record)
{
GUID guid_num;
_GUID_ guid_num;
if(!STR::bstr2guid(guid, guid_num))
{
throw;// EXCEPT::LE::AttributeDataWrong(L"guid", L"UserSViewBegin", guid);
......@@ -96,7 +96,7 @@ void UserSViewBegin::writeFields(CFRecord& record)
void UserSViewBegin::readFields(CFRecord& record)
{
GUID guid_num;
_GUID_ guid_num;
record >> guid_num >> iTabid;
guid = STR::guid2bstr(guid_num);
record.skipNunBytes(2); // reserved
......
......@@ -33,7 +33,7 @@ void FtNts::store(CFRecord& record)
unsigned short cb = 0x16; // reserved
record << ft << cb;
GUID guid_num;
_GUID_ guid_num;
if(!STR::bstr2guid(guid, guid_num))
{
throw;// EXCEPT::LE::AttributeDataWrong(L"guid", L"FtNts", guid);
......@@ -46,7 +46,7 @@ void FtNts::load(CFRecord& record)
{
record.skipNunBytes(4); // reserved
GUID guid_num;
_GUID_ guid_num;
record >> guid_num >> fSharedNote;
guid = STR::guid2bstr(guid_num);
record.skipNunBytes(4);
......
#include "precompiled_xls.h"
#include "HyperlinkMoniker.h"
#include <Binary/CFRecord.h>
#include <Logic/Biff_structures/URLMoniker.h>
#include <Logic/Biff_structures/FileMoniker.h>
#include <Logic/Biff_structures/CompositeMoniker.h>
......@@ -8,14 +10,24 @@
#include <Logic/Biff_structures/ItemMoniker.h>
//#include <Exception/WrongBiffRecord.h>
bool operator ==(const _GUID_ & rguid1,const _GUID_ &rguid2)
{
return (
((_UINT32 *) &rguid1)[0] == ((_UINT32 *) &rguid2)[0] &&
((_UINT32 *) &rguid1)[1] == ((_UINT32 *) &rguid2)[1] &&
((_UINT32 *) &rguid1)[2] == ((_UINT32 *) &rguid2)[2] &&
((_UINT32 *) &rguid1)[3] == ((_UINT32 *) &rguid2)[3]);
}
namespace OSHARED
{;
static const CLSID URLMoniker_CLSID = {0x79EAC9E0, 0xBAF9, 0x11CE, {0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B}};
static const CLSID FileMoniker_CLSID = {0x00000303, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
static const CLSID CompositeMoniker_CLSID = {0x00000309, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
static const CLSID AntiMoniker_CLSID = {0x00000305, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
static const CLSID ItemMoniker_CLSID = {0x00000304, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
static const _GUID_ URLMoniker_CLSID = {0x79EAC9E0, 0xBAF9, 0x11CE, {0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B}};
static const _GUID_ FileMoniker_CLSID = {0x00000303, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
static const _GUID_ CompositeMoniker_CLSID = {0x00000309, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
static const _GUID_ AntiMoniker_CLSID = {0x00000305, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
static const _GUID_ ItemMoniker_CLSID = {0x00000304, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
XLS::BiffStructurePtr HyperlinkMoniker::clone()
......@@ -40,7 +52,7 @@ XLS::BiffStructurePtr HyperlinkMoniker::clone()
void HyperlinkMoniker::store(XLS::CFRecord& record)
{
CLSID clsid = URLMoniker_CLSID;
_GUID_ clsid = URLMoniker_CLSID;
record << clsid;
record << *data;
}
......@@ -48,7 +60,7 @@ void HyperlinkMoniker::store(XLS::CFRecord& record)
void HyperlinkMoniker::load(XLS::CFRecord& record)
{
CLSID clsid;
_GUID_ clsid;
record >> clsid;
monikerClsid = STR::guid2bstr(clsid);
......
......@@ -145,7 +145,7 @@ void HyperlinkObject::store(XLS::CFRecord& record)
}
if(hlstmfHasGUID)
{
GUID guid_num;
_GUID_ guid_num;
if(!STR::bstr2guid(guid, guid_num))
{
throw;// EXCEPT::LE::AttributeDataWrong(L"guid", L"HyperlinkObject", guid);
......@@ -197,7 +197,7 @@ void HyperlinkObject::load(XLS::CFRecord& record)
}
if(hlstmfHasGUID)
{
GUID guid_num;
_GUID_ guid_num;
record >> guid_num;
guid = STR::guid2bstr(guid_num);
}
......
......@@ -32,7 +32,7 @@ private:
bool fShow;
bool fRwHidden;
bool fColHidden;
GUID guid;
_GUID_ guid;
unsigned int ichEnd;
unsigned int cchNote;
XLUnicodeString stAuthor;
......
......@@ -55,7 +55,7 @@ void URLMoniker::load(XLS::CFRecord& record)
if(!record.isEOF())
{
GUID guid;
_GUID_ guid;
record >> guid >> serialVersion >> uriFlags;
serialGUID = STR::guid2bstr(guid);
}
......
......@@ -9,17 +9,18 @@ namespace OLEPS
PropertySetStream::PropertySetStream(XLS::CFStreamPtr stream)
{
unsigned short ByteOrder;
unsigned short Version;
unsigned int SystemIdentifier;
CLSID clsid;
unsigned int NumPropertySets;
*stream >> ByteOrder >> Version >> SystemIdentifier >> clsid >> NumPropertySets;
unsigned short ByteOrder;
unsigned short Version;
unsigned int SystemIdentifier;
unsigned int NumPropertySets;
_GUID_ Clsid;
*stream >> ByteOrder >> Version >> SystemIdentifier >> Clsid >> NumPropertySets;
std::vector<unsigned int> property_sets_offsets;
for(unsigned int i = 0; i < NumPropertySets; ++i)
{
GUID FMTID;
_GUID_ FMTID;
unsigned int Offset;
*stream >> FMTID >> Offset;
property_sets_offsets.push_back(Offset);
......
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