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

XlsFile2 linux build

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64120 954022d7-b5bf-4e40-9824-e11837661b57
parent efc8565d
#include "../DocFormatLib/DocFormatLib.h"
#include "../source/XlsXlsxConverter/ConvertXls2Xlsx.h"
#include "../Win32/ASCOfficeCriticalSection.h"
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#else
#include "../../DesktopEditor/common/ASCVariant.h"
#endif
#include <iostream>
#include "../Win32/version.h"
#include "../version.h"
static std::wstring utf8_to_unicode(const char *src)
{
......@@ -39,7 +43,6 @@ static std::wstring utf8_to_unicode(const char *src)
return wsEntryName;
}
ASCOfficeCriticalSection g_oCriticalSection;
int main(int argc, char *argv[])
{
......@@ -51,28 +54,26 @@ int main(int argc, char *argv[])
std::cout << std::endl;
std::cout << std::endl;
std::cout << "-------------------------------------------------------------------------------" << std::endl;
std::cout << "\t\tDoc/Docx file converter. Version: " << STRVER << std::endl;
std::cout << "\t\tXls/Xlsx file converter. Version: " << STRVER << std::endl;
std::cout << "-------------------------------------------------------------------------------" << std::endl;
std::cout << std::endl;
std::cout << "USAGE: ASCDocConverter \"path_to_file_1\" \"path_to_file_2\" " << std::endl;
std::cout << "USAGE: ASCXlsConverter \"path_to_file_1\" \"path_to_file_2\" " << std::endl;
std::cout << "WHERE:" << std::endl;
std::cout << "\t\"path_to_file_1\" is a path to file to be converted" << std::endl;
std::cout << "\t\"path_to_file_2\" is a path to the corresponding output file" << std::endl << std::endl;
return 1;
}
CString sArg1, sArg2, sExePath;
std::wstring sArg1, sArg2, sExePath;
sExePath = utf8_to_unicode(argv [0]);
sArg1 = utf8_to_unicode(argv [1]);
sArg2 = utf8_to_unicode(argv [2]);
CString sXMLOptions = _T("");
{// xls->xlsx
{// doc->docx
COfficeDocFile docFile;
HRESULT hRes = docFile.LoadFromFile(sArg1, sArg2, sXMLOptions);
HRESULT hRes = ConvertXls2Xlsx(sArg1, sArg2, NULL);
if (hRes != S_OK)return 2;
......
......@@ -5,7 +5,6 @@
#-------------------------------------------------
QT -= core
QT -= gui
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wno-ignored-qualifiers
......@@ -19,6 +18,7 @@ TARGET = ASCXlsConverter
CONFIG += console
CONFIG -= app_bundle
CONFIG += c++11
TEMPLATE = app
......@@ -26,7 +26,12 @@ INCLUDEPATH += \
/usr/include/libxml2
SOURCES += \
XlsFileConverter.cpp
XlsFileConverter.cpp \
../../Common/DocxFormat/Source/Base/unicode_util.cpp \
../../Common/3dParty/pole/pole.cpp \
../../Common/DocxFormat/Source/SystemUtility/FileSystem/FilePosix.cpp \
../../Common/DocxFormat/Source/SystemUtility/FileSystem/DirectoryPosix.cpp \
../../Common/DocxFormat/Source/XML/stringcommon.cpp
linux-g++{
......@@ -36,8 +41,8 @@ linux-g++{
unix:!macx: LIBS += -L$$PWD/../../SDK/lib/linux_64/ -lXlsFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../SDK/lib/linux_64/libXlsFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../SDK/lib/linux_64/ -lgraphics
unix:!macx: PRE_TARGETDEPS += $$PWD/../../SDK/lib/linux_64/libgraphics.a
LIBS += -L$$PWD/../../SDK/lib/linux_64/ -lgraphics
LIBS += -L$$PWD/../../SDK/lib/linux_64/ -lASCOfficeUtilsLib
}
else{
......@@ -47,8 +52,12 @@ else{
unix:!macx: LIBS += -L$$PWD/../../SDK/lib/linux_32/ -lXlsFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../SDK/lib/linux_32/libXlsFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../SDK/lib/linux_32/ -lgraphics
unix:!macx: PRE_TARGETDEPS += $$PWD/../../SDK/lib/linux_32/libgraphics.a
LIBS += -L$$PWD/../../SDK/lib/linux_32/ -lgraphics
LIBS += -L$$PWD/../../SDK/lib/linux_32/ -lASCOfficeUtilsLib
}
LIBS += -lboost_regex
LIBS += -lz
LIBS += -lxml2
LIBS += -lcurl
#include "HelpFunc.h"
#include "shlwapi.h"
#if defined (_WIN32) || defined (_WIN64)
#include "shlwapi.h"
#else
#include <iconv.h>
#endif
#include <Logic/Biff_structures/CellRangeRef.h>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
namespace AUX
{;
{
const int normalizeColumn(const int column)
{
......@@ -125,20 +131,23 @@ const bool str2rel(std::wstring::const_iterator& str_begin, std::wstring::const_
return true;
}
void str2loc(std::wstring::const_iterator& str_begin, std::wstring::const_iterator& str_end, long& row, bool& row_rel, long& column, bool& col_rel)
{
col_rel = str2rel (str_begin, str_end);
column = str2column (str_begin, str_end);
row_rel = str2rel (str_begin, str_end);
row = str2row (str_begin, str_end);
}
void str2loc(const std::wstring& str, long& row, bool& row_rel, long& column, bool& col_rel)
{
str2loc(str.begin(), str.end(), row, row_rel, column, col_rel);
std::wstring::const_iterator str_begin = str.begin();
std::wstring::const_iterator str_end = str.end();
str2loc(str_begin, str_end, row, row_rel, column, col_rel);
}
void str2loc(std::wstring::const_iterator& str_begin, std::wstring::const_iterator& str_end, long& row, bool& row_rel, long& column, bool& col_rel)
{
col_rel = str2rel(str_begin, str_end);
column = str2column(str_begin, str_end);
row_rel = str2rel(str_begin, str_end);
row = str2row(str_begin, str_end);
}
void str2refs(const std::wstring& str, std::vector<XLS::CellRangeRef>& vec)
......@@ -167,16 +176,24 @@ namespace STR
const std::string int2str(const int val, const int radix)
{
static char num_buf[10];
static char num_buf[10]={};
#if defined(_WIN64) || defined(_WIN64)
_itoa_s(val, num_buf, 9, radix);
#else
sprintf( num_buf, "%d", val);
#endif
return num_buf;
}
const std::wstring int2wstr(const int val, const int radix)
{
static wchar_t num_buf[10];
static wchar_t num_buf[10]={};
#if defined(_WIN64) || defined(_WIN64)
_itow_s(val, num_buf, 9, radix);
#else
wprintf( num_buf, "%d", val);
#endif
return num_buf;
}
......@@ -205,16 +222,20 @@ const std::string bin2str(const char* buf, const size_t nbuf)
const std::wstring guid2bstr(const _GUID_ guid)
{
std::wstring guid_ret;
#if defined(_WIN64) || defined(_WIN64)
LPOLESTR guid_str;
if(S_OK != StringFromIID(guid, &guid_str))
{
// The only case is E_OUTOFMEMORY, so just throw anything
throw;// EXCEPT::LE::WhatIsTheFuck("StringFromIID failed.", "guid2bstr");
}
guid_ret = guid_str;
CoTaskMemFree(guid_str);
#else
//todooooo
//LPOLESTR guid_str;
//if(S_OK != StringFromIID(guid, &guid_str))
//{
// // The only case is E_OUTOFMEMORY, so just throw anything
// throw;// EXCEPT::LE::WhatIsTheFuck("StringFromIID failed.", "guid2bstr");
//}
std::wstring guid_ret;// = guid_str;
//CoTaskMemFree(guid_str);
#endif
return guid_ret;
}
......@@ -228,30 +249,38 @@ const std::string guid2str(const _GUID_ guid)
const bool bstr2guid(const std::wstring & guid_str, _GUID_& guid)
{
//todoooo
//HRESULT res = IIDFromString((LPWSTR)(guid_str.c_str()), &guid);
//if(S_OK != res)
//{
// switch(res)
// {
// case E_INVALIDARG:
// return false;
// case E_OUTOFMEMORY:
// throw;// EXCEPT::LE::WhatIsTheFuck("IIDFromString failed.", "bstr2guid");
// }
//}
#if defined(_WIN64) || defined(_WIN64)
HRESULT res = IIDFromString((LPWSTR)(guid_str.c_str()), &guid);
if(S_OK != res)
{
switch(res)
{
case E_INVALIDARG:
return false;
case E_OUTOFMEMORY:
throw;// EXCEPT::LE::WhatIsTheFuck("IIDFromString failed.", "bstr2guid");
}
}
#else
//todooooo
#endif
return true;
}
const std::wstring int2hex_wstr(const int val, const size_t size_of)
{
static wchar_t num_buf[10];
if(size_of > 4)
{
return L"";
}
if(size_of > 4) return L"";
static wchar_t num_buf[10]={};
#if defined(_WIN64) || defined(_WIN64)
swprintf_s(num_buf, 9, (L"%0" + STR::int2wstr(size_of << 1, 10) + L"X").c_str(), val);
#else
//todooooo
#endif
return std::wstring(num_buf);
}
......@@ -270,25 +299,6 @@ const std::wstring wchar_t2hex_str(const wchar_t val)
}
const std::wstring escapeUrlW(const std::wstring& str)
{
wchar_t dumb[2];
DWORD buffer_size = 1;
HRESULT res = UrlEscapeW(str.c_str(), dumb, &buffer_size, 0);
if (0 == buffer_size)
{
return L"";
}
wchar_t* buffer = new wchar_t[buffer_size + 1];
res = UrlEscapeW(str.c_str(), buffer, &buffer_size, 0);
std::wstring ret_val(buffer);
delete[] buffer;
return ret_val;
}
static boost::wregex match_hex(L"^_x[0-9A-F]{4}_");
const std::wstring escape_ST_Xstring(const std::wstring& wstr)
{
......@@ -321,8 +331,13 @@ const std::wstring unescape_ST_Xstring(const std::wstring& wstr)
std::wstring::const_iterator x_pos_next;// = wstr.begin();
std::wstring::const_iterator wstr_end = wstr.end();
std::wstring ret_val = L"";
while(wstr_end != (x_pos_next = boost::algorithm::find_first(boost::make_iterator_range(x_pos_noncopied, wstr_end), L"_x").begin()))
while(true)
{
const auto it_range = boost::make_iterator_range(x_pos_noncopied, wstr_end);
x_pos_next = boost::algorithm::find_first(it_range, L"_x").begin();
if ( wstr_end == x_pos_next) break;
if(!boost::regex_search(x_pos_next, wstr_end, match_hex))
{
x_pos_next += 2;
......@@ -400,25 +415,100 @@ const size_t hex_str2int(const std::wstring::const_iterator& it_begin, const std
const std::string toStdString(const std::wstring& wide_string, const unsigned int code_page)
{
//todooo ðàçðóëèòü íà linux - e !!!
unsigned int bufferSize = (unsigned int)wide_string.length() + 1;
boost::scoped_array<char> pBuffer(new char[bufferSize]);
WideCharToMultiByte(code_page, 0, wide_string.c_str(), (int)wide_string.length(), pBuffer.get(), bufferSize, NULL, NULL);
pBuffer[bufferSize - 1] = '\0';
return pBuffer.get();
#if defined (_WIN32) || defined (_WIN64)
const int nSize = WideCharToMultiByte(code_page, 0, wide_string.c_str(), wide_string.length(), NULL, 0, NULL, NULL);
char *sTemp = new char[nSize];
if (!sTemp)
return std::string();
int size = WideCharToMultiByte(code_page, 0, wide_string.c_str(), wide_string.length(), sTemp, nSize, NULL, NULL);
std::string sResult(sTemp, size);
delete []sTemp;
return sResult;
#else
std::string out;
bool ansi = true;
size_t insize = wide_string.length();
out.reserve(insize);
char *inptr = (char*)wide_string.c_str();
char* outptr = (char*)out.c_str();
if (code_page >= 0)
{
std::string sCodepage = "CP" + std::to_string(code_page);
iconv_t ic= iconv_open(sCodepage.c_str(), "WCHAR_T");
if (ic != (iconv_t) -1)
{
size_t nconv = 0, avail = insize * sizeof(wchar_t);
nconv = iconv (ic, &inptr, &insize, &outptr, &avail);
if (nconv == 0) ansi = false;
iconv_close(ic);
}
}
if (ansi)
out = std::string(wide_string.begin(), wide_string.end());
return out;
#endif
}
const std::wstring toStdWString(const std::string& ansi_string, const unsigned int code_page)
{
//todooo ðàçðóëèòü íà linux - e !!!
unsigned int bufferSize = (unsigned int)ansi_string.length() + 1;
boost::scoped_array<wchar_t> pBuffer(new wchar_t[bufferSize]);
unsigned int code = code_page == 1251 ? 1252 : code_page ;
#if defined (_WIN32) || defined (_WIN64)
const int nSize = MultiByteToWideChar(code_page, 0, ansi_string.c_str(), ansi_string.size(), NULL, 0);
wchar_t *sTemp = new wchar_t[nSize];
if (!sTemp)
return std::wstring();
int size = MultiByteToWideChar(code_page, 0, ansi_string.c_str(), ansi_string.size(), sTemp, nSize);
std::wstring sResult(sTemp, size);
delete []sTemp;
return sResult;
#else
bool ansi = true;
size_t insize = ansi_string.length();
std::wstring w_out;
w_out.reserve(insize);
char *inptr = (char*)ansi_string.c_str();
char* outptr = (char*)w_out.c_str();
if (code_page >= 0)
{
std::string sCodepage = "CP" + std::to_string(code_page);
iconv_t ic= iconv_open("WCHAR_T", sCodepage.c_str());
if (ic != (iconv_t) -1)
{
size_t nconv = 0, avail = (insize) * sizeof(wchar_t);
nconv = iconv (ic, &inptr, &insize, &outptr, &avail);
if (nconv == 0)
{
ansi = false;
}
iconv_close(ic);
}
}
if (ansi)
w_out = std::wstring(ansi_string.begin(), ansi_string.end());
MultiByteToWideChar(/*code_page*/code, 0, ansi_string.c_str(), (int)ansi_string.length(), pBuffer.get(), bufferSize);
pBuffer[bufferSize - 1] = L'\0';
return pBuffer.get();
return w_out;
#endif
}
......
......@@ -41,7 +41,6 @@ namespace STR
const bool bstr2guid(const std::wstring & guid_str, _GUID_& guid);
const std::wstring int2hex_wstr(const int val, const size_t size_of = 4);
const std::wstring wchar_t2hex_str(const wchar_t val);
const std::wstring escapeUrlW(const std::wstring& str);
const std::wstring escape_ST_Xstring(const std::wstring& str);
const std::wstring unescape_ST_Xstring(const std::wstring& str);
const std::wstring toARGB(const unsigned int rgba);
......
......@@ -9,40 +9,6 @@
namespace XLS
{
template<class T>
CFRecord& operator<<(CFRecord& record, std::vector<T>& vec)
{
for(typename std::vector<T>::iterator it = vec.begin(); it != vec.end(); ++it)
{
record << *it;
}
return record;
}
template<class T>
CFRecord& operator>>(CFRecord & record, std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str)
{
str.clear();
T symbol;
do
{
record.loadAnyData(symbol);
str += symbol;
} while (symbol);
return record;
}
template<class T>
CFRecord& operator<<(CFRecord & record, std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str)
{
for(typename std::basic_string<T, std::char_traits<T>, std::allocator<T> >::iterator it = str.begin(); it != str.end(); ++it)
{
record << *it;
}
record.storeAnyData(static_cast<T>(0));
return record;
}
char CFRecord::intData[MAX_RECORD_SIZE];
// Create a record and read its data from the stream
......
......@@ -111,27 +111,27 @@ public:
GlobalWorkbookInfoPtr getGlobalWorkbookInfo() { return global_info_; }
CFRecord& operator>>(unsigned char& val) { loadAnyData(val); return *this; };
CFRecord& operator>>(unsigned short& val) { loadAnyData(val); return *this; };
CFRecord& operator>>(unsigned int& val) { loadAnyData(val); return *this; };
CFRecord& operator>>(long& val) { loadAnyData(val); return *this; };
CFRecord& operator>>(double& val) { loadAnyData(val); return *this; };
CFRecord& operator>>(_GUID_& val) { loadAnyData(val); return *this; };
//CFRecord& operator>>(unsigned int& val) { loadAnyData(val); return *this; };
CFRecord& operator>>(short& val) { loadAnyData(val); return *this; };
CFRecord& operator>>(char& val) { loadAnyData(val); return *this; };
CFRecord& operator>>(unsigned char& val) { loadAnyData(val); return *this; }
CFRecord& operator>>(unsigned short& val) { loadAnyData(val); return *this; }
CFRecord& operator>>(unsigned int& val) { loadAnyData(val); return *this; }
CFRecord& operator>>(long& val) { loadAnyData(val); return *this; }
CFRecord& operator>>(double& val) { loadAnyData(val); return *this; }
CFRecord& operator>>(_GUID_& val) { loadAnyData(val); return *this; }
//CFRecord& operator>>(unsigned int& val) { loadAnyData(val); return *this; }
CFRecord& operator>>(short& val) { loadAnyData(val); return *this; }
CFRecord& operator>>(char& val) { loadAnyData(val); return *this; }
CFRecord& operator>>(bool& val);
CFRecord& operator<<(unsigned char& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(unsigned short& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(unsigned int& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(long& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(double& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(_GUID_& val) { storeAnyData(val); return *this; };
//CFRecord& operator<<(unsigned int& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(short& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(char& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(wchar_t& val) { storeAnyData(val); return *this; };
CFRecord& operator<<(unsigned char& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(unsigned short& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(unsigned int& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(long& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(double& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(_GUID_& val) { storeAnyData(val); return *this; }
//CFRecord& operator<<(unsigned int& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(short& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(char& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(wchar_t& val) { storeAnyData(val); return *this; }
CFRecord& operator<<(bool& val);
private:
......@@ -153,7 +153,6 @@ private:
GlobalWorkbookInfoPtr global_info_;
};
// moved out of the class to be higher in priority than the universal operator
template<class T>
CFRecord& operator>>(CFRecord& record, std::vector<T>& vec)
{
......@@ -166,17 +165,41 @@ CFRecord& operator>>(CFRecord& record, std::vector<T>& vec)
return record;
}
template<class T>
CFRecord& operator<<(CFRecord& record, std::vector<T>& vec)
{
for(typename std::vector<T>::iterator it = vec.begin(), itEnd = vec.end(); it != itEnd; ++it)
{
record << *it;
}
return record;
}
template<class T>
CFRecord& operator<<(CFRecord& record, std::vector<T>& vec);
CFRecord& operator>>(CFRecord & record, std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str)
{
str.clear();
T symbol;
do
{
record.loadAnyData(symbol);
str += symbol;
} while (symbol);
return record;
}
template<class T>
CFRecord& operator>>(CFRecord & record, std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str);
template<class T>
CFRecord& operator<<(CFRecord & record, std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str);
CFRecord& operator<<(CFRecord & record, std::basic_string<T, std::char_traits<T>, std::allocator<T> >& str)
{
for(typename std::basic_string<T, std::char_traits<T>, std::allocator<T> >::iterator it = str.begin(), itEnd = str.end(); it != itEnd; ++it)
{
record << *it;
}
record.storeAnyData(static_cast<T>(0));
return record;
}
template<class T>
CFRecord& operator>>(CFRecord & record, _CP_OPT(T)& val)
......
......@@ -21,10 +21,6 @@ public:
void readFields(CFRecord& record);
//-----------------------------
BIFF_WORD cv;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(cv)
//BO_ATTRIB_MARKUP_END
};
......
......@@ -22,13 +22,6 @@ public:
static const ElementType type = typeDSF;
//-----------------------------
// XLUnicodeString userName;
public:
//BO_ATTRIB_MARKUP_BEGIN
// //BO_ATTRIB_MARKUP_ATTRIB(userName)
//BO_ATTRIB_MARKUP_END
};
} // namespace XLS
......
......@@ -42,7 +42,7 @@ void SupBook::readFields(CFRecord& record)
{
virtPath.setSize(cch);
record >> virtPath;
virtPath.EscapeUrlW();
//virtPath.EscapeUrlW(); //todooo проверить спец символы !!!
//if(virtPath.isConformToVirtPath() && !virtPath.isConformToOleLink())
{
record >> rgst;
......
......@@ -160,25 +160,6 @@ const bool BiffString::isConformToVirtPath() const
return true;
}
const std::wstring BiffString::getEscapedUrlW() const
{
if(!str_.length())
{
return str_;
}
std::wstring copy_str(str_);
return STR::escapeUrlW(copy_str).c_str();
}
void BiffString::EscapeUrlW()
{
str_ = getEscapedUrlW();
}
const std::wstring BiffString::getEscaped_ST_Xstring() const
{
if(!str_.length())
......
......@@ -54,9 +54,6 @@ public:
const bool isConformToOleLink() const;
const bool isConformToVirtPath() const;
const std::wstring getEscapedUrlW() const;
void EscapeUrlW();
const std::wstring getEscaped_ST_Xstring() const;
void Escape_ST_Xstring();
......
......@@ -11,34 +11,10 @@ BiffStructurePtr ExtRst::clone()
return BiffStructurePtr(new ExtRst(*this));
}
//void ExtRst::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->setAttribute(L"cb", cb);
// phs.toXML(xml_tag);
// rphssub.toXML(xml_tag);
// std::for_each(rgphruns.begin(), rgphruns.end(), boost::bind(&PhRuns::toXML, _1, xml_tag));
//}
//void ExtRst::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// cb = getStructAttribute(xml_tag, L"cb");
// phs.fromXML(xml_tag);
// rphssub.fromXML(xml_tag);
//
// PhRuns runs;
// size_t number = 0;
// while(runs.fromXML(xml_tag, ++number, false))
// {
// rgphruns.push_back(runs);
// }
//}
//
void ExtRst::store(CFRecord& record)
{
unsigned short reserved = 1;
record << reserved << cb << phs << rphssub << rgphruns;
// unsigned short reserved = 1;
// record << reserved << cb << phs << rphssub << rgphruns;
}
......
......@@ -22,27 +22,6 @@ XLS::BiffStructurePtr FileMoniker::clone()
return XLS::BiffStructurePtr(new FileMoniker(*this));
}
//
//void FileMoniker::setXMLAttributes(BiffStructurePtr & xml_tag)
//{
// xml_tag->setAttribute(L"cAnti", cAnti);
// xml_tag->setAttribute(L"ansiPath", ansiPath.c_str());
// xml_tag->setAttribute(L"endServer", endServer);
// xml_tag->setAttribute(L"versionNumber", versionNumber);
// if(cbUnicodePathSize)
// {
// xml_tag->setAttribute(L"usKeyValue", usKeyValue);
// xml_tag->setAttribute(L"unicodePath", STR::escapeUrlW(unicodePath).c_str());
// }
//}
//void FileMoniker::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
//#pragma message("####################### FileMoniker record has no BiffStructure::fromXML() implemented")
// Log::error(" Error!!! FileMoniker record has no BiffStructure::fromXML() implemented.");
//}
void FileMoniker::store(XLS::CFRecord& record)
{
......
......@@ -17,27 +17,9 @@ XLS::BiffStructurePtr OfficeArtSplitMenuColorContainer::clone()
return XLS::BiffStructurePtr(new OfficeArtSplitMenuColorContainer(*this));
}
//
//void OfficeArtSplitMenuColorContainer::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// std::for_each(smca.begin(), smca.end(), boost::bind(&MSOCR::toXML, _1, xml_tag));
//}
//
//
//void OfficeArtSplitMenuColorContainer::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// MSOCR color;
// size_t number = 0;
// while(color.fromXML(xml_tag, ++number, false))
// {
// smca.push_back(color);
// }
//}
void OfficeArtSplitMenuColorContainer::storeFields(XLS::CFRecord& record)
{
record << smca;
// record << smca;
}
......
......@@ -5,29 +5,15 @@
namespace OSHARED
{
PropertyBag::PropertyBag()
{
}
XLS::BiffStructurePtr PropertyBag::clone()
{
return XLS::BiffStructurePtr(new PropertyBag(*this));
}
//
//void PropertyBag::toXML(BiffStructurePtr & parent)
//{
// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent);
//
// own_tag->setAttribute(L"id", id);
// std::for_each(properties.begin(), properties.end(), boost::bind(&Property::toXML, _1, own_tag));
//}
//
//
//const bool PropertyBag::fromXML(BiffStructurePtr & parent)
//{
//#pragma message("####################### PropertyBag record has no BiffStructure::fromXML() implemented")
// Log::error(" Error!!! PropertyBag record has no BiffStructure::fromXML() implemented.");
// return false;
//}
void PropertyBag::store(XLS::CFRecord& record)
{
......@@ -44,7 +30,7 @@ void PropertyBag::load(XLS::CFRecord& record)
record.skipNunBytes(2); // ignored
for (int i = 0; i < cProp ; i++)
{
Property prop;
OSHARED::SharedProperty prop;
record >> prop;
properties.push_back(prop);
}
......
#pragma once
#include "BiffStructure.h"
#include <Logic/Biff_structures/Property.h>
#include "SharedProperty.h"
namespace OSHARED
{
......@@ -12,6 +11,8 @@ class PropertyBag : public XLS::BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(PropertyBag)
public:
PropertyBag();
XLS::BiffStructurePtr clone();
static const XLS::ElementType type = XLS::typePropertyBag;
......@@ -20,7 +21,7 @@ public:
virtual void store(XLS::CFRecord& record);
unsigned short id;
std::vector<Property> properties;
std::vector<SharedProperty> properties;
};
} // namespace OSHARED
......
......@@ -11,31 +11,24 @@
namespace XLS
{
//void SerAr::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag)
//{
// xml_tag->Puttext(toString().c_str());
//}
// static
SerArPtr SerAr::createSerAr(const unsigned char type)
{
switch(type)
{
case SerBool::fixed_type:
case typeSerBool:
return SerArPtr(new SerBool);
break;
case SerErr::fixed_type:
case typeSerErr:
return SerArPtr(new SerErr);
break;
case SerNil::fixed_type:
case typeSerNil:
return SerArPtr(new SerNil);
break;
case SerNum::fixed_type:
case typeSerNum:
return SerArPtr(new SerNum);
break;
case SerStr::fixed_type:
case typeSerStr:
return SerArPtr(new SerStr);
break;
default:
......
......@@ -11,6 +11,15 @@ typedef boost::shared_ptr<SerAr> SerArPtr;
class SerAr : public BiffStructure
{
public:
enum SerType
{
typeSerNil = 0x00,
typeSerNum = 0x01,
typeSerStr = 0x02,
typeSerBool = 0x04,
typeSerErr = 0x10
};
static SerArPtr createSerAr(const unsigned char type);
......
......@@ -5,8 +5,6 @@
namespace XLS
{
class CFRecord;
class SerBool : public SerAr
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(SerBool)
......@@ -18,8 +16,8 @@ public:
virtual void store(CFRecord& record);
virtual const std::wstring toString() const;
static const unsigned char fixed_type = 0x04;
private:
const SerType fixed_type = typeSerBool;
unsigned char f;
};
......
......@@ -6,8 +6,6 @@
namespace XLS
{
class CFRecord;
class SerErr : public SerAr
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(SerErr)
......@@ -19,9 +17,10 @@ public:
virtual void store(CFRecord& record);
virtual const std::wstring toString() const;
static const unsigned char fixed_type = 0x10;
private:
const SerType fixed_type = typeSerErr;
BErr err;
};
} // namespace XLS
......@@ -5,8 +5,6 @@
namespace XLS
{
class CFRecord;
class SerNil : public SerAr
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(SerNil)
......@@ -15,7 +13,9 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
virtual const std::wstring toString() const;
static const unsigned char fixed_type = 0x00;
private:
const SerType fixed_type = typeSerNil;
};
} // namespace XLS
......@@ -5,8 +5,6 @@
namespace XLS
{
class CFRecord;
class SerNum : public SerAr
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(SerNum)
......@@ -18,9 +16,10 @@ public:
virtual void store(CFRecord& record);
virtual const std::wstring toString() const;
static const unsigned char fixed_type = 0x01;
private:
const SerType fixed_type = typeSerNum;
double xnum;
};
} // namespace XLS
......@@ -6,8 +6,6 @@
namespace XLS
{
class CFRecord;
class SerStr : public SerAr
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(SerStr)
......@@ -19,9 +17,11 @@ public:
virtual void store(CFRecord& record);
virtual const std::wstring toString() const;
static const unsigned char fixed_type = 0x02;
private:
const SerType fixed_type = typeSerStr;
XLUnicodeString string_;
};
} // namespace XLS
......@@ -7,7 +7,7 @@
#include "GlobalWorkbookInfo.h"
namespace XLS
{;
{
class BiffString;
class CFStreamCacheWriter;
......
......@@ -2,7 +2,7 @@
#include <Binary/CFStream.h>
#include "PropertyFactory.h"
#include "CodePage.h"
#include "CodePageOle.h"
namespace OLEPS
......@@ -21,8 +21,8 @@ PropertyPtr PropertyFactory::ReadProperty(const unsigned int prop_type, XLS::CFS
switch(prop_type)
{
case CodePage::Type:
return PropertyPtr(new CodePage(value_type, stream));
case CodePageOle::Type:
return PropertyPtr(new CodePageOle(value_type, stream));
default:
return PropertyPtr();
......
......@@ -3,7 +3,7 @@
#include "PropertySet.h"
#include <Binary/CFStream.h>
#include "PropertyFactory.h"
#include "CodePage.h"
#include "CodePageOle.h"
namespace OLEPS
......@@ -26,7 +26,7 @@ PropertySet::PropertySet(XLS::CFStreamPtr stream, const unsigned int property_se
prop_offsets.push_back(prop_offset);
}
code_page = CodePage::DefaultCodePage;
code_page = CodePageOle::DefaultCodePage;
for(unsigned int i = 0; i < NumProperties; ++i)
{
PropertyPtr next_property = PropertyFactory::ReadProperty(prop_offsets[i].PropertyIdentifier, stream, property_set_offset + prop_offsets[i].Offset);
......@@ -34,7 +34,7 @@ PropertySet::PropertySet(XLS::CFStreamPtr stream, const unsigned int property_se
{
properties.push_back(next_property);
CodePagePropertyPtr code_page_property = boost::dynamic_pointer_cast<CodePage>(next_property);
CodePagePropertyPtr code_page_property = boost::dynamic_pointer_cast<CodePageOle>(next_property);
if(code_page_property)
{
code_page = code_page_property->GetCodePage();
......
#pragma once
#include "CompositeObject.h"
#include "SummaryInformationStream/Structures/CodePage.h"
#include "SummaryInformationStream/Structures/CodePageOle.h"
#include "GlobalWorkbookInfo.h"
namespace XLS
......@@ -21,7 +21,7 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const unsigned short DefaultCodePage = OLEPS::CodePage::DefaultCodePage;
static const unsigned short DefaultCodePage = OLEPS::CodePageOle::DefaultCodePage;
void set_code_page(const unsigned short code_page);
......
......@@ -516,7 +516,6 @@ SOURCES += \
../XlsFormat/Logic/Biff_structures/Phs.cpp \
../XlsFormat/Logic/Biff_structures/PictFmlaEmbedInfo.cpp \
../XlsFormat/Logic/Biff_structures/PictFmlaKey.cpp \
../XlsFormat/Logic/Biff_structures/Property.cpp \
../XlsFormat/Logic/Biff_structures/PropertyBag.cpp \
../XlsFormat/Logic/Biff_structures/PropertyBagStore.cpp \
../XlsFormat/Logic/Biff_structures/Ptg.cpp \
......@@ -777,7 +776,6 @@ SOURCES += \
../XlsFormat/Logic/Biff_unions/UNKNOWNFRT.cpp \
../XlsFormat/Logic/Biff_unions/WINDOW.cpp \
../XlsFormat/Logic/Biff_unions/XFS.cpp \
../XlsFormat/Logic/SummaryInformationStream/Structures/CodePage.cpp \
../XlsFormat/Logic/SummaryInformationStream/Structures/Property.cpp \
../XlsFormat/Logic/SummaryInformationStream/Structures/PropertyFactory.cpp \
../XlsFormat/Logic/SummaryInformationStream/Structures/PropertySet.cpp \
......@@ -810,7 +808,11 @@ SOURCES += \
../XlsFormat/Logic/GlobalWorkbookInfo.cpp \
../XlsFormat/Logic/MacroSheetSubstream.cpp \
../XlsFormat/Logic/WorkbookStreamObject.cpp \
../XlsFormat/Logic/WorksheetSubstream.cpp
../XlsFormat/Logic/WorksheetSubstream.cpp \
../XlsFormat/Auxiliary/HelpersTagsGenerator.cpp \
../XlsFormat/Auxiliary/HelpFunc.cpp \
../XlsFormat/Logic/SummaryInformationStream/Structures/CodePageOle.cpp \
../XlsFormat/Logic/Biff_structures/SharedProperty.cpp
......@@ -1271,7 +1273,6 @@ HEADERS += \
../XlsFormat/Logic/Biff_structures/Phs.h \
../XlsFormat/Logic/Biff_structures/PictFmlaEmbedInfo.h \
../XlsFormat/Logic/Biff_structures/PictFmlaKey.h \
../XlsFormat/Logic/Biff_structures/Property.h \
../XlsFormat/Logic/Biff_structures/PropertyBag.h \
../XlsFormat/Logic/Biff_structures/PropertyBagStore.h \
../XlsFormat/Logic/Biff_structures/Ptg.h \
......@@ -1534,7 +1535,6 @@ HEADERS += \
../XlsFormat/Logic/Biff_unions/UNKNOWNFRT.h \
../XlsFormat/Logic/Biff_unions/WINDOW.h \
../XlsFormat/Logic/Biff_unions/XFS.h \
../XlsFormat/Logic/SummaryInformationStream/Structures/CodePage.h \
../XlsFormat/Logic/SummaryInformationStream/Structures/Property.h \
../XlsFormat/Logic/SummaryInformationStream/Structures/PropertyFactory.h \
../XlsFormat/Logic/SummaryInformationStream/Structures/PropertySet.h \
......@@ -1575,7 +1575,11 @@ HEADERS += \
../XlsFormat/Logic/WorkbookStreamObject.h \
../XlsFormat/Logic/WorksheetSubstream.h \
../XlsFormat/Logic/XlsElementsType.h \
../XlsXlsxConverter/ShapeType.h
../XlsXlsxConverter/ShapeType.h \
../XlsFormat/Auxiliary/HelpersTagsGenerator.h \
../XlsFormat/Auxiliary/HelpFunc.h \
../XlsFormat/Logic/SummaryInformationStream/Structures/CodePageOle.h \
../XlsFormat/Logic/Biff_structures/SharedProperty.h
......
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