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

XlsFile2 таблицы, строки, ячейки

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63606 954022d7-b5bf-4e40-9824-e11837661b57
parent 4f0d244c
......@@ -77,25 +77,7 @@ int ConvertSingle(int argc, _TCHAR* argv[])
ATL::CComPtr<ASCOfficeXlsFile::IAVSOfficeFileTemplate> officeXlsFile;
HRESULT hr;
HR_RET(officeXlsFile.CoCreateInstance(__uuidof(ASCOfficeXlsFile::COfficeXlsFile)));
//_______________________________________________________________________________________________________
IUnknown *pUnk;
IConnectionPointContainer* pContainer;
IConnectionPoint* pCP;
CCallback *pEvents = NULL;
DWORD dwAdvise=0;
pEvents = new CCallback;
pEvents->AddRef();
HR_RET(officeXlsFile->QueryInterface(IID_IConnectionPointContainer, (void**)&pContainer));
HR_RET(pContainer->FindConnectionPoint(__uuidof(ASCOfficeXlsFile::_IAVSOfficeFileTemplateEvents),&pCP));
HR_RET(pEvents->QueryInterface(IID_IUnknown,(VOID **)&pUnk));
HR_RET(pCP->Advise(pUnk,&dwAdvise));
pContainer->Release();pContainer=NULL;
pUnk->Release(); pUnk=NULL;
//____________
boost::timer t1;
officeXlsFile->LoadFromFile(ATL::CComBSTR(argv[1]), ATL::CComBSTR(argv[2]), NULL);
std::cout << "\n\nTime : " << t1.elapsed() << "\n";
......
......@@ -10,7 +10,7 @@
#endif
#include <stdio.h>
#include <tchar.h>
#include <tchar.h>
#include <atlbase.h>
#include <atlcom.h>
......
#include "precompiled_xls.h"
#include "BetterVariantT.h"
//#include <Exception/AttributeDataWrong.h>
......
#include "precompiled_xls.h"
#include "HelpFunc.h"
#include "shlwapi.h"
......@@ -6,6 +6,7 @@
#include <Logic/Biff_structures/CellRangeRef.h>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
namespace AUX
{;
......
#pragma once
#include <string>
#include <vector>
#include "../../../Common/DocxFormat/Source/Base/Types_32.h"
typedef struct
......
#include "precompiled_xls.h"
#include "HelpersTagsGenerator.h"
......
#pragma once
#include <list>
#include <boost/shared_ptr.hpp>
namespace XLS
{;
......
#include "precompiled_xls.h"
#include "CFRecord.h"
#include "CFStream.h"
//#include <Exception/WrongFormatInterpretation.h>
//#include <Exception/WrongAPIUsage.h>
//#include <Exception/WrongBiffRecord.h>
namespace XLS
{;
......
#include "precompiled_xls.h"
#include "CFRecordType.h"
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/algorithm/string.hpp>
namespace XLS
{;
struct CFRecordTypeValue{
struct CFRecordTypeValue
{
CFRecordType::TypeString name;
CFRecordType::TypeId id;
}CFRecordTypeValues[] = {
}
CFRecordTypeValues[] =
{
{"Formula", rt_Formula},
{"EOF", rt_EOF},
{"CalcCount", rt_CalcCount},
......
#include "precompiled_xls.h"
#include "CFStream.h"
#include "CFRecordType.h"
//#include <Exception/CompoundFileFormatError.h>
......@@ -6,6 +6,7 @@
#include <boost/bind.hpp>
#include <algorithm>
#include <sstream>
namespace XLS
......
#include "precompiled_xls.h"
#include "CFStreamCacheReader.h"
#include "CFRecord.h"
#include "CFStream.h"
......
#include "precompiled_xls.h"
#include "CFStreamCacheWriter.h"
#include "CFRecord.h"
#include "CFStream.h"
#include <Logic/Biff_records/BOF.h>
//#include <Exception/RequestedRecordNotFound.h>
namespace XLS
......
#include "precompiled_xls.h"
#include "CompoundFile.h"
#include "CFStream.h"
//#include <Exception/CompoundFileFormatError.h>
#include <sstream>
namespace XLS
......
#include "precompiled_xls.h"
#include "BiffDecoder_RCF.h"
......
......@@ -4,6 +4,8 @@
#include "rtl/cipher.h"
#include "rtl/digest.h"
#include <vector>
namespace CRYPT
{;
......
#include "precompiled_xls.h"
#include "BinaryCodec_RCF.h"
......
#include "precompiled_xls.h"
#include "Decryptor.h"
#include "RC4Crypt.h"
......
#include "precompiled_xls.h"
#include "RC4Crypt.h"
......
#include "precompiled_xls.h"
#include "cipher.h"
#include <memory>
CipherARCFOUR::CipherARCFOUR()
......
#include "precompiled_xls.h"
#include "digest.h"
#include <memory>
#define RTL_DIGEST_ROTL(a,n) (((a) << (n)) | ((a) >> (32 - (n))))
......
#include "precompiled_xls.h"
#include <Logic\Biff_Structures\BiffStructure.h>
#include <Logic/BaseObjectDocument.h>
#include <../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h>
#include "Document.h"
......@@ -9,7 +9,7 @@ std::map<std::wstring, Document*> Document::all_documents;
Document::Document(const std::wstring & root_name)
{
//xmlDoc = boost::shared_ptr<XLS::BiffStructure>(new XLS::BiffStructure());
objectDoc = boost::shared_ptr<XLS::BaseObjectDocument>(new XLS::BaseObjectDocument());
newDoc(L"root");
}
......@@ -61,15 +61,20 @@ void Document::newDoc(const std::wstring & root_name)
uniq_ = stringUtf8ToWString(sRes);
#endif
//xmlDoc->set_document_guid(guid_);
//xmlDoc->set_document_name(root_name);
XLS::BaseObjectDocument * doc = dynamic_cast<XLS::BaseObjectDocument *>(objectDoc.get());
if (doc)
{
doc->set_document_uniq(uniq_);
doc->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[uniq_] = this;
}
const int Document::appendBinaryData(XLS::BiffStructurePtr & elem, const char * data, const size_t size)
const int Document::appendBinaryData(XLS::BaseObject * elem, const char * data, const size_t size)
{
if (elem == NULL)
return 0;
......@@ -80,12 +85,13 @@ const int Document::appendBinaryData(XLS::BiffStructurePtr & elem, const char *
}
const int Document::appendBinaryData(XLS::BiffStructurePtr & elem, boost::shared_array<char>& pre_allocated_data, const size_t size)
const int Document::appendBinaryData(XLS::BaseObject * elem, boost::shared_array<char>& pre_allocated_data, const size_t size)
{
if (elem == NULL)
return 0;
std::wstring name = elem->tagName_;
std::wstring name = elem->getClassName();
Document* doc = findDocumentByElement(elem);
if(!doc)
{
......@@ -106,9 +112,16 @@ const std::pair<char*, size_t> Document::getBinaryData(const int index) const
}
Document* Document::findDocumentByElement(XLS::BiffStructurePtr & elem)
Document* Document::findDocumentByElement(XLS::BaseObject* elem)
{
return all_documents[static_cast<std::wstring>(elem->get_document()->uniq_)];
XLS::BaseObjectDocument * doc = dynamic_cast<XLS::BaseObjectDocument *>(elem);
if (doc)
{
return all_documents[doc->m_document_uniq];
}
else
return NULL;
}
......
......@@ -5,13 +5,14 @@
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/smart_ptr/shared_array.hpp>
class Document;
typedef boost::shared_ptr<Document> DocumentPtr;
namespace XLS
{
class BiffStructure;
typedef boost::shared_ptr<BiffStructure> BiffStructurePtr;
class BaseObject;
typedef boost::shared_ptr<BaseObject> BaseObjectPtr;
};
class Document
......@@ -22,20 +23,19 @@ public:
void newDoc(const std::wstring & root_name);
static const int appendBinaryData(XLS::BiffStructurePtr & elem, const char * data, const size_t size);
static const int appendBinaryData(XLS::BiffStructurePtr & elem, boost::shared_array<char>& pre_allocated_data, const size_t size);
static const int appendBinaryData(XLS::BaseObject* elem, const char * data, const size_t size);
static const int appendBinaryData(XLS::BaseObject* elem, boost::shared_array<char>& pre_allocated_data, const size_t size);
static Document* findDocumentByElement(XLS::BiffStructurePtr & elem);
static Document* findDocumentByElement(XLS::BaseObject* elem);
const std::pair<char*, size_t> getBinaryData(const int index) const;
std::wstring uniq_;
//-------------------------------------------------------------
std::wstring uniq_;
private:
//XLS::BiffStructurePtr xmlDoc;
std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data;
XLS::BaseObjectPtr objectDoc;
std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data;
private:
static std::map<std::wstring, Document*> all_documents;
static std::map<std::wstring, Document*> all_documents;
};
#include "precompiled_xls.h"
#include "Log.h"
......
#include "precompiled_xls.h"
#include "Logger.h"
#include <iostream>
#include <sstream>
#include <time.h>
Logger::Logger(const std::string& log_file)
: m_log(log_file.c_str())
......
#include "precompiled_xls.h"
#include "AnyObject.h"
#include <Binary/CFStream.h>
......
#include "precompiled_xls.h"
#include "AnySubstream.h"
#include <Logic/AnyObject.h>
......
#pragma once
#include "BaseObject.h"
namespace XLS
{;
// Logical representation of an XML record
class BaseObjectDocument : public BaseObject
{
public:
BASE_OBJECT_DEFINE_CLASS_NAME(BaseObjectDocument)
BaseObjectDocument(){}
~BaseObjectDocument(){}
static const ElementType type = typeAnyObject;
BaseObjectPtr clone() {return BaseObjectPtr(new BaseObjectDocument(*this));}
virtual const bool read(CFStreamCacheReader& reader, BaseObject* parent, const bool mandatory){return false;}
void set_document_uniq(const std::wstring & uniq) {m_document_uniq = uniq;}
void set_document_name(const std::wstring & name) {m_document_name = name;}
std::wstring m_document_uniq;
std::wstring m_document_name;
};
typedef boost::shared_ptr<BaseObjectDocument> BaseObjectDocumentPtr;
} // namespace XLS
//#include "precompiled_xls.h"
//
#include "AlRuns.h"
namespace XLS
......
//#include "precompiled_xls.h"
//
#include "Area.h"
namespace XLS
......
//#include "precompiled_xls.h"
//
#include "AreaFormat.h"
namespace XLS
......
//#include "precompiled_xls.h"
//
#include "Array.h"
namespace XLS
......
//#include "precompiled_xls.h"
//
#include "AttachedLabel.h"
namespace XLS
......
//#include "precompiled_xls.h"
//
#include "AutoFilter.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "AutoFilter12.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "AutoFilterInfo.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "AxcExt.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "AxesUsed.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Axis.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "AxisLine.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "AxisParent.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "BOF.h"
#include <Binary/CFStream.h>
......
#include "precompiled_xls.h"
#include "BRAI.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Backup.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Bar.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Begin.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "BiffRecord.h"
#include <Binary/CFStream.h>
#include "Binary/CFStreamCacheReader.h"
......
#include "precompiled_xls.h"
#include "BiffRecordContinued.h"
#include "Binary/CFStreamCacheReader.h"
#include "Binary/CFStreamCacheWriter.h"
......
#include "precompiled_xls.h"
#include "BiffRecordSplit.h"
#include "Binary/CFStreamCacheReader.h"
#include "Binary/CFStreamCacheWriter.h"
......
#include "precompiled_xls.h"
#include "BigName.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "BkHim.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Blank.h"
#include <simple_xml_writer.h>
namespace XLS
{;
extern int cellStyleXfs_count;
Blank::Blank()
{
......@@ -13,7 +16,6 @@ Blank::~Blank()
{
}
BaseObjectPtr Blank::clone()
{
return BaseObjectPtr(new Blank(*this));
......@@ -37,5 +39,27 @@ const CellRef Blank::getLocation() const
return cell.getLocation();
}
int Blank::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
int row = cell.rw;
std::wstring ref = cell.getLocation().toString();// getColRowRef(i, row);
CP_XML_NODE(L"c")
{
CP_XML_ATTR(L"r", ref);
if (cell.ixfe.value())
{
CP_XML_ATTR(L"s", *cell.ixfe.value() - cellStyleXfs_count);
}
}
}
return 0;
}
} // namespace XLS
......@@ -24,6 +24,7 @@ public:
static const ElementType type = typeBlank;
int serialize(std::wostream & stream);
const CellRef getLocation() const;
......
#include "precompiled_xls.h"
#include "BookBool.h"
//#include <Exception/AttributeDataWrong.h>
......
#include "precompiled_xls.h"
#include "BookExt.h"
#include <Logic/Biff_structures/FrtHeader.h>
......
#include "precompiled_xls.h"
#include "BoolErr.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "BopPop.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "BopPopCustom.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "BottomMargin.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "BoundSheet8.h"
//#include <Exception/AttributeDataWrong.h>
......
#include "precompiled_xls.h"
#include "BuiltInFnGroupCount.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CF.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CF12.h"
#include <Logic/Biff_structures/CFMultistate.h>
......
#include "precompiled_xls.h"
#include "CFEx.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CRN.h"
#include <Logic/Biff_structures/SerAr.h>
......
#include "precompiled_xls.h"
#include "CalcCount.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CalcDelta.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CalcIter.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CalcMode.h"
//#include <Exception/AttributeDataWrong.h>
......
#include "precompiled_xls.h"
#include "CalcPrecision.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CalcRefMode.h"
//#include <Exception/AttributeDataWrong.h>
......
#include "precompiled_xls.h"
#include "CalcSaveRecalc.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CatLab.h"
#include <Logic/Biff_structures/FrtHeaderOld.h>
......
#include "precompiled_xls.h"
#include "CatSerRange.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CellWatch.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Chart.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Chart3DBarShape.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Chart3d.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "ChartFormat.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "ChartFrtInfo.h"
#include <Logic/Biff_structures/FrtHeaderOld.h>
......
#include "precompiled_xls.h"
#include "CodeName.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CodePage.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "ColInfo.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Compat12.h"
#include <Logic/Biff_structures/FrtHeader.h>
......
#include "precompiled_xls.h"
#include "CompressPictures.h"
#include <Logic/Biff_structures/FrtHeader.h>
......
#include "precompiled_xls.h"
#include "CondFmt.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CondFmt12.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Continue.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "ContinueBigName.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "ContinueFrt.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "ContinueFrt11.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "ContinueFrt12.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "Country.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CrErr.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CrtLayout12.h"
#include <Logic/Biff_structures/FrtHeader.h>
......
#include "precompiled_xls.h"
#include "CrtLayout12A.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CrtLine.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CrtLink.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CrtMlFrt.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "CrtMlFrtContinue.h"
namespace XLS
......
#include "precompiled_xls.h"
#include "DBCell.h"
namespace XLS
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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