From 65eab867cafbabf690dd46910a2647983c88a40a Mon Sep 17 00:00:00 2001 From: "Elen.Subbotina" Date: Fri, 31 Jul 2015 16:09:57 +0000 Subject: [PATCH] XlsFile2 git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63799 954022d7-b5bf-4e40-9824-e11837661b57 --- .gitattributes | 1 - .../source/XlsFormat/Document/Document.cpp | 128 ------------------ .../source/XlsFormat/Document/Document.h | 41 ------ .../XlsFormat/Logic/BaseObjectDocument.h | 6 - .../XlsFormat/Logic/Biff_records/Axis.h | 2 +- .../XlsFormat/Logic/Biff_records/BiffRecord.h | 2 - .../XlsFormat/Logic/Biff_records/Pls.cpp | 75 ++++++---- .../Logic/Biff_structures/BiffStructure.cpp | 11 -- .../Logic/Biff_structures/BiffStructure.h | 26 +--- .../ODRAW/OfficeArtBStoreContainer.h | 2 + .../OfficeArtBStoreContainerFileBlock.cpp | 1 - .../Biff_structures/ODRAW/OfficeArtBlip.h | 3 +- .../ODRAW/OfficeArtClientAnchorChart.h | 2 +- .../ODRAW/OfficeArtClientAnchorHF.h | 3 +- .../ODRAW/OfficeArtClientAnchorSheet.h | 3 +- .../ODRAW/OfficeArtContainer.cpp | 4 +- .../ODRAW/OfficeArtContainer.h | 4 +- .../ODRAW/OfficeArtDgContainer.cpp | 39 ++++++ .../ODRAW/OfficeArtDgContainer.h | 7 + .../Biff_structures/ODRAW/OfficeArtFDG.h | 3 +- .../ODRAW/OfficeArtFDGGBlock.h | 2 +- .../Biff_structures/ODRAW/OfficeArtFOPT.h | 3 +- .../ODRAW/OfficeArtFRITContainer.h | 3 +- .../Biff_structures/ODRAW/OfficeArtFSP.h | 3 +- .../Biff_structures/ODRAW/OfficeArtFSPGR.h | 3 +- .../Biff_structures/ODRAW/OfficeArtRecord.h | 4 +- .../ODRAW/OfficeArtSplitMenuColorContainer.h | 4 +- .../ODRAW/OfficeArtTertiaryFOPT.h | 3 +- .../ODRAW/SimpleOfficeArtContainers.cpp | 65 +++++++++ .../ODRAW/SimpleOfficeArtContainers.h | 15 ++ .../XlsFormat/Logic/Biff_unions/OBJECTS.cpp | 7 +- .../XlsFormat/Logic/Biff_unions/OBJECTS.h | 8 +- .../XlsFormat/Logic/GlobalWorkbookInfo.cpp | 1 + .../XlsFormat/Logic/GlobalWorkbookInfo.h | 14 +- .../source/XlsFormat/Logic/XlsElementsType.h | 22 ++- .../source/XlsXlsxConverter/XlsConverter.cpp | 65 ++++++--- .../source/XlsXlsxConverter/XlsConverter.h | 5 + .../XlsXlsxConverter/xlsx_drawing_context.cpp | 75 ++++++++-- .../XlsXlsxConverter/xlsx_drawing_context.h | 27 +++- .../source/win32/XlsFormat.vcproj | 16 +-- 40 files changed, 378 insertions(+), 330 deletions(-) delete mode 100644 ASCOfficeXlsFile2/source/XlsFormat/Document/Document.cpp delete mode 100644 ASCOfficeXlsFile2/source/XlsFormat/Document/Document.h create mode 100644 ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.cpp diff --git a/.gitattributes b/.gitattributes index 050aa1798c..e7334aaf73 100644 --- a/.gitattributes +++ b/.gitattributes @@ -404,7 +404,6 @@ ASCOfficeXlsFile2/source/XlsFormat/Auxiliary svnc_tsvn_003alogminsize=5 ASCOfficeXlsFile2/source/XlsFormat/Binary svnc_tsvn_003alogminsize=5 ASCOfficeXlsFile2/source/XlsFormat/Crypt svnc_tsvn_003alogminsize=5 ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl svnc_tsvn_003alogminsize=5 -ASCOfficeXlsFile2/source/XlsFormat/Document svnc_tsvn_003alogminsize=5 ASCOfficeXlsFile2/source/XlsFormat/Logging svnc_tsvn_003alogminsize=5 ASCOfficeXlsFile2/source/XlsFormat/Logic svnc_tsvn_003alogminsize=5 ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records svnc_tsvn_003alogminsize=5 diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Document/Document.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Document/Document.cpp deleted file mode 100644 index 6194c49d4e..0000000000 --- a/ASCOfficeXlsFile2/source/XlsFormat/Document/Document.cpp +++ /dev/null @@ -1,128 +0,0 @@ - - -#include -#include <../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h> - -#include "Document.h" - -std::map Document::all_documents; - -Document::Document(const std::wstring & root_name) -{ - objectDoc = boost::shared_ptr(new XLS::BaseObjectDocument()); - - newDoc(L"root"); -} - - -Document::~Document() -{ - all_documents[uniq_] = NULL; -} - -// -//BiffStructurePtr & Document::getRoot() const -//{ -// return xmlDoc->GetdocumentElement(); // current root independent on its name -//} -// - -//BiffStructurePtr & Document::getDoc() const -//{ -// return this; -//} - - -void Document::newDoc(const std::wstring & root_name) -{ - if(!uniq_.empty()) - { - all_documents.erase(uniq_); - } - -#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 - - XLS::BaseObjectDocument * doc = dynamic_cast(objectDoc.get()); - - if (doc) - { - doc->set_document_uniq(uniq_); - doc->set_document_name(root_name); - } - - //xmlDoc->loadXML(L" <" + root_name + L" id=\"" + guid_ + L"\"/>"); // Initial tag; - - all_documents[uniq_] = this; -} - -const int Document::appendBinaryData(XLS::BaseObject * elem, const char * data, const size_t size) -{ - if (elem == NULL) - return 0; - - boost::shared_array buffer(new char[size]); - memcpy_s(buffer.get(), size, data, size); - return appendBinaryData(elem, buffer, size); -} - - -const int Document::appendBinaryData(XLS::BaseObject * elem, boost::shared_array& pre_allocated_data, const size_t size) -{ - if (elem == NULL) - return 0; - - std::wstring name = elem->getClassName(); - - Document* doc = findDocumentByElement(elem); - if(!doc) - { - return -1; - } - doc->bin_data.push_back(std::pair, size_t>(pre_allocated_data, size)); - return doc->bin_data.size() - 1; -} - - -const std::pair Document::getBinaryData(const int index) const -{ - if(index < 0 || static_cast(index) > bin_data.size() - 1) - { - return std::pair(NULL, 0); - } - return std::pair(bin_data[index].first.get(), bin_data[index].second); -} - - -Document* Document::findDocumentByElement(XLS::BaseObject* elem) -{ - XLS::BaseObjectDocument * doc = dynamic_cast(elem); - - if (doc) - { - return all_documents[doc->m_document_uniq]; - } - else - return NULL; -} - - - diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Document/Document.h b/ASCOfficeXlsFile2/source/XlsFormat/Document/Document.h deleted file mode 100644 index c884158db9..0000000000 --- a/ASCOfficeXlsFile2/source/XlsFormat/Document/Document.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -class Document; -typedef boost::shared_ptr DocumentPtr; - -namespace XLS -{ - class BaseObject; - typedef boost::shared_ptr BaseObjectPtr; -}; - -class Document -{ -public: - Document(const std::wstring & root_name); - ~Document(); - - void newDoc(const std::wstring & root_name); - - static const int appendBinaryData(XLS::BaseObject* elem, const char * data, const size_t size); - static const int appendBinaryData(XLS::BaseObject* elem, boost::shared_array& pre_allocated_data, const size_t size); - - static Document* findDocumentByElement(XLS::BaseObject* elem); - - const std::pair getBinaryData(const int index) const; - -//------------------------------------------------------------- - std::wstring uniq_; - - XLS::BaseObjectPtr objectDoc; - std::vector, size_t> > bin_data; - - static std::map all_documents; -}; - diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObjectDocument.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObjectDocument.h index 09c7913d24..774f6fc604 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObjectDocument.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObjectDocument.h @@ -21,12 +21,6 @@ public: 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 BaseObjectDocumentPtr; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Axis.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Axis.h index 81c54e4ec9..b4219687b4 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Axis.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Axis.h @@ -20,7 +20,7 @@ public: void writeFields(CFRecord& record); void readFields(CFRecord& record); - static const ElementType type = typeAxis;; + static const ElementType type = typeAxis; //----------------------------- BIFF_WORD wType; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BiffRecord.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BiffRecord.h index c3f2e91383..3086fc88e6 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BiffRecord.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BiffRecord.h @@ -2,7 +2,6 @@ #include #include -//#include #include namespace XLS @@ -17,7 +16,6 @@ public: BiffRecord(); ~BiffRecord(); -// virtual const bool doSomething(BinProcessor& proc); virtual const bool read(CFStreamCacheReader& reader, BaseObject* parent, const bool is_mandatory); // Read self and children //virtual const bool write(BinWriterProcessor& proc, const bool is_mandatory); // Write self and children diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pls.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pls.cpp index 243884d8e6..81e6c5e39c 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pls.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pls.cpp @@ -1,6 +1,5 @@ #include "Pls.h" -#include namespace XLS {; @@ -24,37 +23,37 @@ BaseObjectPtr Pls::clone() void Pls::writeFields(CFRecord& record) { - record.reserveNunBytes(2); // reserved + //record.reserveNunBytes(2); // reserved - std::list& recs = continue_records[rt_Continue]; - Document* doc = Document::findDocumentByElement(parent_); + //std::list& recs = continue_records[rt_Continue]; + //Document* doc = Document::findDocumentByElement(parent_); - const std::pair bin_data = doc->getBinaryData(bin_data_id); - if(record.checkFitWriteSafe(bin_data.second)) - { - record.storeLongData(bin_data.first, bin_data.second); - } - else - { - char* buffer = bin_data.first; - size_t size = bin_data.second; - while(size) - { - CFRecord& current_record = recs.size() ? *recs.back() : record; // Points to the original 'record' or the last created 'Continue' - size_t space_left = current_record.getMaxRecordSize() - current_record.getDataSize(); - size_t write_size = min(size, space_left); - current_record.storeLongData(buffer, write_size); - buffer += write_size; - size -= write_size; - current_record.commitData(); + //const std::pair bin_data = doc->getBinaryData(bin_data_id); + //if(record.checkFitWriteSafe(bin_data.second)) + //{ + // record.storeLongData(bin_data.first, bin_data.second); + //} + //else + //{ + // char* buffer = bin_data.first; + // size_t size = bin_data.second; + // while(size) + // { + // CFRecord& current_record = recs.size() ? *recs.back() : record; // Points to the original 'record' or the last created 'Continue' + // size_t space_left = current_record.getMaxRecordSize() - current_record.getDataSize(); + // size_t write_size = min(size, space_left); + // current_record.storeLongData(buffer, write_size); + // buffer += write_size; + // size -= write_size; + // current_record.commitData(); - if(size) - { - CFRecordPtr cont(new CFRecord(rt_Continue, record.getGlobalWorkbookInfo())); - recs.push_back(cont); - } - } - } + // if(size) + // { + // CFRecordPtr cont(new CFRecord(rt_Continue, record.getGlobalWorkbookInfo())); + // recs.push_back(cont); + // } + // } + //} } @@ -62,7 +61,23 @@ void Pls::readFields(CFRecord& record) { record.skipNunBytes(2); // reserved record.loadAnyData(rgb); - bin_data_id = Document::appendBinaryData(parent_, record.getData() + 2, record.getDataSize() - 2); + + int size = record.getDataSize() - 2; + const char* data = record.getData() + 2; + + boost::shared_array buffer(new char[size]); + memcpy_s(buffer.get(), size, data, size); + + bin_data_id = -1; + + GlobalWorkbookInfo* globla_info = record.getGlobalWorkbookInfo().get(); + if (globla_info) + { + globla_info->bin_data.push_back(std::pair, size_t>(buffer, size)); + + bin_data_id = globla_info->bin_data.size() - 1; + } + record.skipNunBytes(record.getDataSize() - record.getRdPtr()); // avoid size inconsistency warning } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BiffStructure.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BiffStructure.cpp index 57e8724283..4bbff1bfb0 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BiffStructure.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BiffStructure.cpp @@ -1,21 +1,10 @@ #include "BiffStructure.h" #include -#include namespace XLS {; -Document* BiffStructure::get_document() -{ - return document_; -} - -void BiffStructure::set_document(Document* d) -{ - document_ = d; -} - // this function will never be called ( look at operator>>(CFRecord& record, T& val)) void BiffStructure_NoVtbl::store(CFRecord& record) { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BiffStructure.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BiffStructure.h index 56dc2bac02..2cb9afb289 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BiffStructure.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BiffStructure.h @@ -2,15 +2,13 @@ #include #include - #include +#include "../XlsElementsType.h" + #include #include -//#include - -class Document; namespace XLS {; @@ -24,8 +22,6 @@ public: void load(CFRecord& record); // this function will never be called ( look at operator>>(CFRecord& record, T& val)) void store(CFRecord& record); // this function will never be called ( look at operator>>(CFRecord& record, T& val)) -// protected: -// static MSXML2::IXMLDOMElementPtr createElement(BiffStructurePtr & parent, const std::wstring tag_name); }; class BiffStructure; @@ -38,18 +34,11 @@ public: virtual BiffStructurePtr clone() = 0; - Document* get_document(); - void set_document(Document* d); - - //// Makes XML data - ////virtual void toXML(BiffStructurePtr & parent); - //// Reads XML data - ////virtual const bool fromXML(BiffStructurePtr & parent, const size_t position, const bool is_mandatory); - - ////virtual const bool fromXML(BiffStructurePtr & parent); - virtual void load(CFRecord& record) = 0; virtual void store(CFRecord& record) = 0; + + static const ElementType type = typeBiffStructure; + virtual ElementType get_type() const { return type; } virtual int serialize(std::wostream & _stream) { @@ -61,11 +50,6 @@ public: virtual const std::wstring & getClassName() const = 0; // Must be overridden in every deriver. The return value must be a reference to a static variable inside the getter - std::wstring tagName_; -protected: - Document * document_; - //const AUX::BetterVariantT getStructAttribute(BiffStructurePtr & parent, const std::wstring & attrib_name); - //MSXML2::IXMLDOMElementPtr getStructNode(BiffStructurePtr & parent, const std::wstring & tag_name); }; #define BASE_STRUCTURE_DEFINE_CLASS_NAME(class_name)\ diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.h index 3bba877722..00ff934f43 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.h @@ -27,6 +27,8 @@ public: } } + static const XLS::ElementType type = XLS::typeOfficeArtBStoreContainer; + virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainerFileBlock.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainerFileBlock.cpp index 52ebe36611..7d8f61ff2a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainerFileBlock.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainerFileBlock.cpp @@ -1,6 +1,5 @@ #include "OfficeArtBStoreContainerFileBlock.h" -#include #include "../../../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h" diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBlip.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBlip.h index f732be4b25..f1368ea805 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBlip.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBlip.h @@ -22,8 +22,9 @@ public: OfficeArtBlip(const unsigned short recType); static OfficeArtBlipPtr load_blip(XLS::CFRecord& record); + + static const XLS::ElementType type = XLS::typeOfficeArtBlip; -public: unsigned int csp; unsigned int spidCur; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorChart.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorChart.h index 1e1d7ff0cf..f4d18ca386 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorChart.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorChart.h @@ -18,12 +18,12 @@ public: OfficeArtClientAnchorChart(); XLS::BiffStructurePtr clone(); + static const XLS::ElementType type = XLS::typeOfficeArtClientAnchorChart; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); -private: // bool fMove; // This attribute is ignored for chart sheets bool fSize; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h index 6f81f6c2a2..bc54df075a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h @@ -18,12 +18,11 @@ public: OfficeArtClientAnchorHF(); XLS::BiffStructurePtr clone(); - + static const XLS::ElementType type = XLS::typeOfficeArtClientAnchorHF; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); -private: long width; long height; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorSheet.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorSheet.h index a7dae71e33..44345e3940 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorSheet.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorSheet.h @@ -19,12 +19,11 @@ public: OfficeArtClientAnchorSheet(); XLS::BiffStructurePtr clone(); - + static const XLS::ElementType type = XLS::typeOfficeArtClientAnchorSheet; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); -private: bool fMove; bool fSize; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtContainer.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtContainer.cpp index 167db3caf3..1d68a0dc45 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtContainer.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtContainer.cpp @@ -125,8 +125,8 @@ void OfficeArtContainer::loadFields(XLS::CFRecord& record) art_record = OfficeArtRecordPtr(new OfficeArtSplitMenuColorContainer); break; case BStoreContainer: - Log::event("OfficeArtBStoreContainer record found. OfficeArtBStoreContainerFileBlock records count = " + STR::int2str(rh_child.recInstance) + - ". RecLen = " + STR::int2str(rh_child.recLen)); + //Log::event("OfficeArtBStoreContainer record found. OfficeArtBStoreContainerFileBlock records count = " + STR::int2str(rh_child.recInstance) + + // ". RecLen = " + STR::int2str(rh_child.recLen)); art_record = OfficeArtRecordPtr(new OfficeArtBStoreContainer); break; case TertiaryFOPT: diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtContainer.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtContainer.h index 13ccc69cd8..b07e678e22 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtContainer.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtContainer.h @@ -17,6 +17,7 @@ class OfficeArtContainer : public OfficeArtRecord public: OfficeArtContainer(const unsigned char recVer, const unsigned short recType, const OfficeArtClientAnchorType anchor_type); + static const XLS::ElementType type = XLS::typeOfficeArtContainer; // overridden: virtual void loadFields(XLS::CFRecord& record); @@ -24,8 +25,9 @@ public: static OfficeArtRecordPtr loadAnyArtRecord(XLS::CFRecord& record); - std::vector child_records; OfficeArtClientAnchorType anchor_type_; + std::vector child_records; + }; typedef boost::shared_ptr OfficeArtContainerPtr; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.cpp index 1ffa95cff7..a28b1f7cf7 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.cpp @@ -36,5 +36,44 @@ const bool OfficeArtDgContainer::CheckIfContainerSizeOK(XLS::CFRecord& record) return 0xF002 == rh.recType && record.getDataSize() == rh.recLen + rh.size(); } +void OfficeArtDgContainer::loadFields(XLS::CFRecord& record) +{ + OfficeArtContainer::loadFields(record); + + for (long i = 0 ; i < child_records.size(); i++) + { + switch(child_records[i]->rh_own.recType) + { + case ODRAW::OfficeArtRecord::FDG: + { + m_OfficeArtFDG = child_records[i]; + child_records.erase(child_records.begin() + i, child_records.begin() + i + 1); i--; + }break; + case ODRAW::OfficeArtRecord::FRITContainer: + { + m_OfficeArtFRITContainer = child_records[i]; + child_records.erase(child_records.begin() + i, child_records.begin() + i + 1); i--; + }break; + case ODRAW::OfficeArtRecord::SpgrContainer: + { + m_OfficeArtSpgrContainer = child_records[i]; + child_records.erase(child_records.begin() + i, child_records.begin() + i + 1); i--; + }break; + case ODRAW::OfficeArtRecord::SpContainer: + { + m_OfficeArtSpContainer = child_records[i]; + child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); i--; + }break; + //case ODRAW::OfficeArtRecord::SpgrContainerFileBlock: + // { + // m_OfficeArtSpgrContainerFileBlock = OfficeArtContainerPtr(art_container); + // child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); + // }break; + + } + } + + +} } // namespace ODRAW diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.h index e8b9e2550b..85ecb57471 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtDgContainer.h @@ -21,6 +21,13 @@ public: static const bool CheckIfContainerStartFound(XLS::CFRecord& record); static const bool CheckIfContainerSizeOK(XLS::CFRecord& record); + void loadFields(XLS::CFRecord& record); + + OfficeArtRecordPtr m_OfficeArtFDG; + OfficeArtRecordPtr m_OfficeArtFRITContainer; + OfficeArtRecordPtr m_OfficeArtSpgrContainer; + OfficeArtRecordPtr m_OfficeArtSpContainer; // todooo - one???? + OfficeArtRecordPtr m_OfficeArtSpgrContainerFileBlock; }; typedef boost::shared_ptr OfficeArtDgContainerPtr; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFDG.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFDG.h index aafc4fbe89..d3c79cf40d 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFDG.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFDG.h @@ -21,7 +21,8 @@ public: virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); -public: + static const XLS::ElementType type = XLS::typeOfficeArtFDG; + unsigned int csp; unsigned int spidCur; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFDGGBlock.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFDGGBlock.h index 976f383b99..9f927618f8 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFDGGBlock.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFDGGBlock.h @@ -19,12 +19,12 @@ public: OfficeArtFDGGBlock(); XLS::BiffStructurePtr clone(); + static const XLS::ElementType type = XLS::typeOfficeArtFDGGBlock; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); -public: unsigned int spidMax; unsigned int cspSaved; unsigned int cdgSaved; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFOPT.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFOPT.h index 2dd1bd03df..be0a6618b9 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFOPT.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFOPT.h @@ -19,7 +19,7 @@ public: OfficeArtFOPT(); XLS::BiffStructurePtr clone(); - + static const XLS::ElementType type = XLS::typeOfficeArtFOPT; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); @@ -27,7 +27,6 @@ public: // overriden const unsigned short GetInstanceToStore(); -private: OfficeArtRGFOPTE fopt; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFRITContainer.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFRITContainer.h index ad9bbc4afd..83a7778cc0 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFRITContainer.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFRITContainer.h @@ -18,8 +18,8 @@ class OfficeArtFRITContainer : public OfficeArtRecord public: OfficeArtFRITContainer(); XLS::BiffStructurePtr clone(); - + static const XLS::ElementType type = XLS::typeOfficeArtFRITContainer; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); @@ -27,7 +27,6 @@ public: // overriden const unsigned short GetInstanceToStore(); -public: std::vector rgfrit; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSP.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSP.h index 25673f5999..1925d2fffe 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSP.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSP.h @@ -22,7 +22,8 @@ public: virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); - // overriden + static const XLS::ElementType type = XLS::typeOfficeArtFSP; + const unsigned short GetInstanceToStore(); unsigned short shape_id; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSPGR.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSPGR.h index 943ee70b07..094a914693 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSPGR.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSPGR.h @@ -18,12 +18,11 @@ public: OfficeArtFSPGR(); XLS::BiffStructurePtr clone(); - + static const XLS::ElementType type = XLS::typeOfficeArtFSPGR; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); -private: long xLeft; long yTop; long xRight; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtRecord.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtRecord.h index cb869c97c4..4509d7dca8 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtRecord.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtRecord.h @@ -27,6 +27,7 @@ public: virtual void loadFields(XLS::CFRecord& record) = 0; virtual void storeFields(XLS::CFRecord& record) = 0; + static const XLS::ElementType type = XLS::typeOfficeArtRecord; OfficeArtRecordHeader rh_own; enum OfficeArtRecordType @@ -70,7 +71,8 @@ public: FPSPL = 0xF11D, SplitMenuColorContainer = 0xF11E, // Implemented SecondaryFOPT = 0xF121, - TertiaryFOPT = 0xF122, // Implemented + TertiaryFOPT = 0xF122, // Implemented + SpgrContainerFileBlock }; enum OfficeArtClientAnchorType diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtSplitMenuColorContainer.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtSplitMenuColorContainer.h index aef6837a7a..ff576b923d 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtSplitMenuColorContainer.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtSplitMenuColorContainer.h @@ -19,15 +19,13 @@ public: OfficeArtSplitMenuColorContainer(); XLS::BiffStructurePtr clone(); - + static const XLS::ElementType type = XLS::typeOfficeArtSplitMenuColorContainer; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); - // overriden const unsigned short GetInstanceToStore(); -public: std::vector smca; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtTertiaryFOPT.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtTertiaryFOPT.h index 8a82915515..f87cdccfd0 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtTertiaryFOPT.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtTertiaryFOPT.h @@ -19,7 +19,7 @@ public: OfficeArtTertiaryFOPT(); XLS::BiffStructurePtr clone(); - + static const XLS::ElementType type = XLS::typeOfficeArtTertiaryFOPT; virtual void loadFields(XLS::CFRecord& record); virtual void storeFields(XLS::CFRecord& record); @@ -27,7 +27,6 @@ public: // overriden const unsigned short GetInstanceToStore(); -private: OfficeArtRGFOPTE fopt; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.cpp new file mode 100644 index 0000000000..a4d539e761 --- /dev/null +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.cpp @@ -0,0 +1,65 @@ + +#include "SimpleOfficeArtContainers.h" +#include + +namespace ODRAW +{; + + +void OfficeArtDggContainer::loadFields(XLS::CFRecord& record) +{ + OfficeArtContainer::loadFields(record); + + for (long i = 0 ; i < child_records.size(); i++) + { + switch(child_records[i]->rh_own.recType) + { + case ODRAW::OfficeArtRecord::BStoreContainer: + { + m_OfficeArtBStoreContainer = child_records[i]; + child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); i--; + }break; + case ODRAW::OfficeArtRecord::ColorMRUContainer: + { + m_OfficeArtColorMRUContainer = child_records[i]; + child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); i--; + }break; + case ODRAW::OfficeArtRecord::SplitMenuColorContainer: + { + m_OfficeArtSplitMenuColorContainer = child_records[i]; + child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); i--; + }break; + case ODRAW::OfficeArtRecord::FDGGBlock: + { + m_OfficeArtFDGGBlock = child_records[i]; + child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); i--; + }break; + //case ODRAW::OfficeArtRecord::SpgrContainerFileBlock: + // { + // m_OfficeArtSpgrContainerFileBlock = OfficeArtContainerPtr(art_container); + // child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); + // }break; + + } + } +} + +void OfficeArtSpgrContainer::loadFields(XLS::CFRecord& record) +{ + OfficeArtContainer::loadFields(record); + + //for (long i = 0 ; i < child_records.size(); i++) + //{ + // switch(child_records[i]->rh_own.recType) + // { + // case ODRAW::OfficeArtRecord::SpgrContainerFileBlock: + // { + // m_OfficeArtSpgrContainerFileBlock.push_back(child_records[i]); + // child_records.erase(child_records.begin() + i,child_records.begin() + i + 1); + // }break; + // } + //} + +} + +} // namespace ODRAW diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h index 41b7085561..b3b4503ef0 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h @@ -12,6 +12,13 @@ public: OfficeArtDggContainer(const OfficeArtClientAnchorType anchor_type) : OfficeArtContainer(0x0F, DggContainer, anchor_type) {} XLS::BiffStructurePtr clone() { return XLS::BiffStructurePtr(new OfficeArtDggContainer(*this)); } + void loadFields(XLS::CFRecord& record); + + OfficeArtRecordPtr m_OfficeArtBStoreContainer; + OfficeArtRecordPtr m_OfficeArtColorMRUContainer; + OfficeArtRecordPtr m_OfficeArtSplitMenuColorContainer; + OfficeArtRecordPtr m_OfficeArtFDGGBlock; + //+ OfficeArtFOPT + OfficeArtTertiaryFOPT }; class OfficeArtSpgrContainer : public OfficeArtContainer @@ -21,6 +28,9 @@ public: OfficeArtSpgrContainer(const OfficeArtClientAnchorType anchor_type) : OfficeArtContainer(0x0F, SpgrContainer, anchor_type) {} XLS::BiffStructurePtr clone() { return XLS::BiffStructurePtr(new OfficeArtSpgrContainer(*this)); } + void loadFields(XLS::CFRecord& record); + + std::vector m_OfficeArtSpgrContainerFileBlock; }; class OfficeArtSpContainer : public OfficeArtContainer @@ -41,6 +51,8 @@ public: virtual void loadFields(XLS::CFRecord& record) {} virtual void storeFields(XLS::CFRecord& record) {} + static const ElementType type = XLS::typeOfficeArtClientData; + }; class OfficeArtClientTextbox : public OfficeArtRecord @@ -52,6 +64,9 @@ public: virtual void loadFields(XLS::CFRecord& record) {} virtual void storeFields(XLS::CFRecord& record) {} + static const XLS::ElementType type = XLS::typeOfficeArtClientTextbox; + + }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/OBJECTS.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/OBJECTS.cpp index b0e6722915..6bb6dbb225 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/OBJECTS.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/OBJECTS.cpp @@ -95,15 +95,16 @@ const bool OBJECTS::loadContentRead(BinReaderProcessor& proc) int count1 = proc.repeated(Parenthesis_OBJECTS_1(m_MsoDrawing), 0, 0); + int i = 0 ; for(std::list::iterator it = elements_.begin(); it != elements_.end() ; it++) { XLS::ElementType type = (*it)->get_type(); switch (type) { - case XLS::typeOBJ: m_OBJs.push_back(*it); break; - case XLS::typeTEXTOBJECT: m_TEXTOBJECTs.push_back(*it); break; - case XLS::typeCHART: m_CHARTs.push_back(*it); break; + case XLS::typeOBJ: m_OBJs.push_back(std::pair(*it, i)); i++; break; + case XLS::typeTEXTOBJECT: m_TEXTOBJECTs.push_back(std::pair(*it, i)); i++; break; + case XLS::typeCHART: m_CHARTs.push_back(std::pair(*it, i)); i++; break; } } elements_.clear(); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/OBJECTS.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/OBJECTS.h index 46502f2ad1..aa2bd6dc0a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/OBJECTS.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/OBJECTS.h @@ -26,11 +26,11 @@ public: bool is_inside_chart_sheet_; - MsoDrawingPtr m_MsoDrawing; + MsoDrawingPtr m_MsoDrawing; - std::vector m_OBJs; - std::vector m_TEXTOBJECTs; - std::vector m_CHARTs; + std::vector> m_OBJs; + std::vector> m_TEXTOBJECTs; + std::vector> m_CHARTs; }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.cpp index 95487a1421..b36105fa62 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.cpp @@ -9,6 +9,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page) { fill_x_ids[FillInfo(0, 0, 0)] = 0; fill_x_ids[FillInfo(17, 64, 65)] = 1; + last_AXES_id = initial_AXES_id; } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.h index ac7405dc16..3bbc39655e 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalWorkbookInfo.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include "../Crypt/Decryptor.h" @@ -25,13 +26,16 @@ public: std::vector xti_parsed; std::vector AddinUdfs; - boost::unordered_map border_x_ids; - boost::unordered_map fill_x_ids; + boost::unordered_map border_x_ids; + boost::unordered_map fill_x_ids; - unsigned int last_AXES_id; - const static unsigned int initial_AXES_id = 0; + unsigned int last_AXES_id; + const static unsigned int initial_AXES_id = 0; + + std::vector defineNames; + + std::vector, size_t> > bin_data; - std::vector defineNames; }; typedef boost::shared_ptr GlobalWorkbookInfoPtr; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/XlsElementsType.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/XlsElementsType.h index 6ae884e906..e09fbbf004 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/XlsElementsType.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/XlsElementsType.h @@ -460,8 +460,28 @@ enum ElementType typeGlobalsSubstream, typeMacroSheetSubstream, typeWorkbookStreamObject, - typeWorksheetSubstream + typeWorksheetSubstream, + typeBiffStructure = 2000, + + typeOfficeArtRecord = 3000, + typeOfficeArtBlip, + typeOfficeArtBStoreContainer, + typeOfficeArtClientAnchorChart, + typeOfficeArtClientAnchorHF, + typeOfficeArtClientAnchorSheet, + typeOfficeArtColorMRUContainer, + typeOfficeArtContainer, + typeOfficeArtFDG, + typeOfficeArtFDGGBlock, + typeOfficeArtFOPT, + typeOfficeArtFRITContainer, + typeOfficeArtFSP, + typeOfficeArtFSPGR, + typeOfficeArtSplitMenuColorContainer, + typeOfficeArtTertiaryFOPT, + typeOfficeArtClientData, + typeOfficeArtClientTextbox }; diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp index 2e2891c01c..ba67fb2095 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp @@ -30,6 +30,7 @@ #include #include +#include #include "xlsx_conversion_context.h" #include "xlsx_package.h" @@ -367,24 +368,9 @@ void XlsConverter::convert(XLS::MSODRAWINGGROUP * mso_drawing) XLS::MsoDrawingGroup * mso_group = dynamic_cast(mso_drawing->m_MsoDrawingGroup.get()); if (mso_group == NULL) return; + //files + convert (dynamic_cast(mso_group->rgChildRec.m_OfficeArtBStoreContainer.get())); - for (long i = 0 ; i < mso_group->rgChildRec.child_records.size(); i++) - { - ODRAW::OfficeArtRecord * art_record = dynamic_cast(mso_group->rgChildRec.child_records[i].get()); - - if (art_record == NULL) return; - - switch(art_record->rh_own.recType) - { - case ODRAW::OfficeArtRecord::BStoreContainer: - { - convert((ODRAW::OfficeArtBStoreContainer*)art_record); - }break; - case ODRAW::OfficeArtRecord::BlipPICT: - { - }break; - } - } } @@ -446,16 +432,25 @@ void XlsConverter::convert(XLS::THEME* theme) void XlsConverter::convert(XLS::OBJECTS* objects) { if (objects == NULL) return; + + ODRAW::OfficeArtSpgrContainer *spgr = dynamic_cast(objects->m_MsoDrawing.get()->rgChildRec.m_OfficeArtSpgrContainer.get()); + + if (spgr == NULL) return; for (long i = 0 ; i < objects->m_OBJs.size(); i++) { - XLS::OBJ* OBJ = dynamic_cast(objects->m_OBJs[i].get()); + int ind = objects->m_OBJs[i].second; + + if (ind > spgr->child_records.size()-1) continue; + + XLS::OBJ* OBJ = dynamic_cast(objects->m_OBJs[i].first.get()); XLS::Obj *obj = dynamic_cast(OBJ->m_Obj.get()); - - if (obj->cmo.ot == 0x08)//image + + if (xlsx_context->get_drawing_context().start_drawing(obj->cmo.ot)) { - xlsx_context->get_drawing_context().start_drawing(L"", obj->cmo.id); + ODRAW::OfficeArtSpContainer *sp = dynamic_cast(spgr->child_records[ind+1].get()); + convert(sp); xlsx_context->get_drawing_context().end_drawing(); } @@ -463,13 +458,39 @@ void XlsConverter::convert(XLS::OBJECTS* objects) for (long i = 0 ; i < objects->m_CHARTs.size(); i++) { + int ind = objects->m_OBJs[i].second; //xlsx_context->get_chart_context().start_drawing(); - + //xlsx_context->get_chart_context().end_drawing(); } } +void XlsConverter::convert(ODRAW::OfficeArtSpContainer *sp) +{ + if (sp == NULL) return; + + for (int i = 0; i < sp->child_records.size(); i++) + { + convert(sp->child_records[i].get()); + } +} + +void XlsConverter::convert(ODRAW::OfficeArtRecord * art) +{ + if (art == NULL) return; + + std::wstringstream strm; + + art->serialize(strm); + + switch(art->rh_own.recType) + { + break; + } + +} + void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings) { if (sharedstrings == NULL) return; diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h index cc4a9fccbf..7d33332292 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h @@ -39,7 +39,9 @@ namespace XLS namespace ODRAW { + class OfficeArtRecord; class OfficeArtBStoreContainer; + class OfficeArtSpContainer; } class XlsConverter @@ -75,7 +77,10 @@ private: void convert(XLS::LBL * def_name); void convert(XLS::OBJECTS * objects); void convert(XLS::MSODRAWINGGROUP * mso_drawing); + + void convert(ODRAW::OfficeArtRecord * art); void convert(ODRAW::OfficeArtBStoreContainer* art_bstore); + void convert(ODRAW::OfficeArtSpContainer * sp); std::wstring GetTargetMoniker(XLS::BiffStructure *moniker); diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp index 4b0e841706..514f2921fd 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp @@ -79,27 +79,76 @@ xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle & h) { } -void xlsx_drawing_context::start_drawing(std::wstring const & name, int type) +bool xlsx_drawing_context::start_drawing(int type) { - count_object++; - - bool isIternal = false; - std::wstring target; - std::wstring rId = handle_.impl_->get_mediaitems().find_image(type, target, isIternal); - - - if (!rId.empty()) + switch(type) { - xlsx_drawings_->add(stream_.str(), isIternal, rId , target, external_items::typeImage); + case 0x0000: // Group + case 0x0001: // Line + case 0x0002: // Rectangle + case 0x0003: // Oval + case 0x0004: // Arc + start_shape(type); return true; + case 0x0005: // Chart + case 0x0006: // Text + case 0x0007: // Button + break; + case 0x0008: // Picture + start_image(); return true; + case 0x0009: // Polygon: + case 0x000B: // Checkbox + case 0x000C: // Radio button + case 0x000D: // Edit box + case 0x000E: // Label + case 0x000F: // Dialog box + case 0x0010: // Spin control + case 0x0011: // Scrollbar + case 0x0012: // List + case 0x0013: // Group box + case 0x0014: // Dropdown list + case 0x0019: // Note + case 0x001E: // OfficeArt object + break; } + return false; + //count_object++; + + //bool isIternal = false; + //std::wstring target; + //std::wstring rId = handle_.impl_->get_mediaitems().find_image(type, target, isIternal); + + + //if (!rId.empty()) + //{ + // xlsx_drawings_->add(stream_.str(), isIternal, rId , target, external_items::typeImage); + //} } +void xlsx_drawing_context::start_image() +{ + _drawing_state st; + drawing_state.push_back(st); + + drawing_state.back().type = external_items::typeImage; +} + +void xlsx_drawing_context::start_shape(int type) +{ + _drawing_state st; + drawing_state.push_back(st); + + drawing_state.back().type = external_items::typeShape; +} void xlsx_drawing_context::end_drawing() { - bool isMediaInternal = true; + if (drawing_state.size() < 1 )return; - //xlsx_drawings_->add(stream_.str(), isMediaInternal, rId , ref, external_items::typeImage); - stream_.clear(); + std::wstringstream strm; + + //serialize + + xlsx_drawings_->add(strm.str(), drawing_state.back().isMediaInternal, + drawing_state.back().rId , drawing_state.back().target, drawing_state.back().type); } diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.h index 4efabdaed8..75cd957c13 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "xlsx_drawings.h" @@ -23,25 +24,43 @@ private: _CP_PTR(Impl) impl_; }; +class _drawing_state +{ +public: + _drawing_state() {isMediaInternal = false;} + + external_items::Type type; + + std::wstring rId; + std::wstring target; + std::wstring anchor; + std::wstring shape; + bool isMediaInternal; +}; class xlsx_drawing_context { public: + + xlsx_drawing_context(xlsx_drawing_context_handle & h); ~xlsx_drawing_context(){} - void start_drawing(std::wstring const & name, int type); + bool start_drawing(int type); void end_drawing(); - std::wostream & drawing_stream() {return stream_;} - xlsx_drawings_ptr get_drawings(); bool empty(); + void start_image(); + void start_shape(int type); + private: - std::wstringstream stream_; + + std::vector<_drawing_state> drawing_state; + xlsx_drawing_context_handle & handle_; xlsx_drawings_ptr xlsx_drawings_; int count_object; diff --git a/ASCOfficeXlsFile2/source/win32/XlsFormat.vcproj b/ASCOfficeXlsFile2/source/win32/XlsFormat.vcproj index 2a0ffb566f..202a6a0bde 100644 --- a/ASCOfficeXlsFile2/source/win32/XlsFormat.vcproj +++ b/ASCOfficeXlsFile2/source/win32/XlsFormat.vcproj @@ -5012,6 +5012,10 @@ RelativePath="..\XlsFormat\Logic\Biff_structures\ODRAW\OfficeArtTertiaryFOPT.h" > + + @@ -7463,18 +7467,6 @@ > - - - - - -