Commit 77172fb3 authored by ElenaSubbotina's avatar ElenaSubbotina

Merge remote-tracking branch 'origin/release/v5.0.0' into develop

parents 80b1e5e8 78ecdc67
......@@ -483,26 +483,27 @@ namespace DocFileFormat
delete storageOut;
return false;
}
std::list<std::string> listStream = storageIn->entries();
for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
{
if (storageIn->isDirectory(*it))
{
std::list<std::string> list_entry = storageIn->GetAllStreams(*it);
for (std::list<std::string>::iterator it2 = list_entry.begin(); it2 != list_entry.end(); it2++)
{
DecryptStream(Decryptor, *it2, storageIn, storageOut);
}
}
else
{
DecryptStream(Decryptor, *it, storageIn, storageOut);
}
}
DecryptStream( 0, "/", storageIn, storageOut, Decryptor);
//std::list<std::string> listStream = storageIn->entries();
//for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
//{
// if (storageIn->isDirectory(*it))
// {
// std::list<std::string> list_entry = storageIn->GetAllStreams(*it);
//
// for (std::list<std::string>::iterator it2 = list_entry.begin(); it2 != list_entry.end(); it2++)
// {
// DecryptStream(Decryptor, *it2, storageIn, storageOut);
// }
// }
// else
// {
// DecryptStream(Decryptor, *it, storageIn, storageOut);
// }
//}
storageOut->close();
delete storageOut;
......@@ -525,34 +526,28 @@ namespace DocFileFormat
}
return true;
}
bool WordDocument::CopyStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
void WordDocument::DecryptStream( int level, std::string path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
{
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
if (!stream) return false;
stream->seek(0);
int sz_stream = stream->size();
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, sz_stream);
if (!streamNew) return false;
std::list<std::string> entries;
entries = storageIn->entries( path );
unsigned char* data_stream = new unsigned char[sz_stream];
stream->read(data_stream, sz_stream);
streamNew->write(data_stream, sz_stream);
RELEASEARRAYOBJECTS(data_stream);
streamNew->flush();
delete streamNew;
delete stream;
std::list<std::string>::iterator it;
for( it = entries.begin(); it != entries.end(); ++it )
{
std::string name = *it;
std::string fullname = path + name;
return true;
if( storageIn->isDirectory( fullname ) )
{
DecryptStream( level + 1, fullname + "/", storageIn, storageOut, Decryptor );
}
bool WordDocument::DecryptStream(CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
else
{
DecryptStream(fullname, storageIn, storageOut, Decryptor );
}
}
}
bool WordDocument::DecryptStream(std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
{
POLE::Stream *stream = new POLE::Stream(storageIn, streamName);
if (!stream) return false;
......@@ -569,7 +564,7 @@ namespace DocFileFormat
unsigned char* data_store = NULL;
int size_data_store = 0;
if ("WordDocument" == streamName)
if ( std::wstring::npos != streamName.find("WordDocument") )
{
size_data_store = 68;
data_store = new unsigned char[size_data_store];
......
......@@ -102,8 +102,9 @@ namespace DocFileFormat
private:
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
bool DecryptStream (CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut);
bool CopyStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut);
bool DecryptStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
void DecryptStream (int level, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
inline StructuredStorageReader* GetStorage() const
{
......
......@@ -32,6 +32,7 @@
#pragma once
#include <string>
#include <vector>
#include "../include/cpdoccore/CPScopedPtr.h"
namespace cpdoccore {
......@@ -59,6 +60,8 @@ public:
//Sheet2.C3:Sheet2.C19 -> Sheet2!C3:C19
std::wstring convert_chart_distance(std::wstring const & expr);
void split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out);
std::wstring convert_ref(std::wstring const & expr);
std::wstring convert_spacechar(std::wstring expr);
......
......@@ -32,7 +32,6 @@
#include "formulasconvert.h"
#include <boost/regex.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include"../../Common/DocxFormat/Source/XML/Utils.h"
......@@ -46,6 +45,9 @@ namespace formulasconvert {
std::wstring convert(const std::wstring& expr);
std::wstring convert_chart_distance(const std::wstring& expr);
void split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out);
void replace_cells_range(std::wstring& expr, bool withTableName);
bool check_formula(std::wstring& expr);
void replace_semicolons(std::wstring& expr);
......@@ -189,7 +191,7 @@ namespace formulasconvert {
if (convert_with_TableName)
{
return (sheet1 + L"!") + c1 + (c2.empty() ? L"" : (L":" + c3) );
return (sheet1 + L"!") + c1 + (c3.empty() ? L"" : (L":" + c3) );
}
else
{
......@@ -390,24 +392,23 @@ namespace formulasconvert {
std::wstring forbidden_formulas[] =
{
L"NULLFORMULA"
/*
L"BETADIST",
L"CEILING",
L"FLOOR",
L"RANK",
L"ROUND",
L"ROUNDDOWN",
L"ROUNDUP",
L"SUBTOTAL",
L"FORMULA",
L"ISREF"*/
//L"BETADIST",
//L"CEILING",
//L"FLOOR",
//L"RANK",
//L"ROUND",
//L"ROUNDDOWN",
//L"ROUNDUP",
//L"SUBTOTAL",
//L"FORMULA",
//L"ISREF"
};
bool is_forbidden(const std::wstring & formula)
{
BOOST_FOREACH(const std::wstring & s, forbidden_formulas)
for (size_t i = 0; i < 1/*forbidden_formulas.size()*/; i++)
{
if (boost::algorithm::contains(formula, s))
if (boost::algorithm::contains(formula, forbidden_formulas[i]))
return true;
}
return false;
......@@ -490,10 +491,30 @@ namespace formulasconvert {
return workstr;
}
void odf2oox_converter::Impl::split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out)
{
std::wstring workstr = expr;
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
workstr = boost::regex_replace(
expr,
complexRef,
&replace_point_space,
boost::match_default | boost::format_all);
boost::algorithm::split(out, workstr, boost::algorithm::is_any_of(by), boost::algorithm::token_compress_on);
for (size_t i = 0; i < out.size(); i++)
{
XmlUtils::replace_all( out[i], L"PROBEL", L" ");
XmlUtils::replace_all( out[i], L"TOCHKA", L".");
}
}
//Sheet2.C3:Sheet2.C19 Sheet2.L29:Sheet2.L36
//в
//Sheet2!C3:C19,Sheet2!L27:L34
std::wstring odf2oox_converter::Impl::convert_chart_distance(const std::wstring& expr)
{
if (is_forbidden(expr))
......@@ -515,25 +536,27 @@ namespace formulasconvert {
boost::algorithm::split(distance_inp, workstr, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d,distance_inp)
for (size_t i = 0; i < distance_inp.size(); i++)
{
std::wstring sheet;
std::vector<std::wstring> range;
std::vector<std::wstring> cells;
boost::algorithm::split(range,d, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
boost::algorithm::split(range, distance_inp[i], boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &c,range)
for (size_t j = 0; j < range.size(); j++)
{
const std::string::size_type colon = range[j].find('.');
cells.push_back(range[j].substr(colon + 1));
if (sheet.size() < 1)
{
const std::string::size_type colon = c.find('.');
cells.push_back(c.substr(colon+1));
if (sheet.size()<1)
sheet=c.substr(0, colon);
sheet = range[j].substr(0, colon);
}
}
std::wstring cells_out;
BOOST_FOREACH(std::wstring &c,cells)
for (size_t j = 0; j < cells.size(); j++)
{
cells_out.append(c);
cells_out.append(cells[j]);
cells_out.append(L":");
}
int res1 = sheet.find(L"-");
......@@ -544,19 +567,19 @@ namespace formulasconvert {
sheet = L"'" + sheet + L"'";
}
distance_out.push_back(sheet+L"!" + cells_out.substr(0, cells_out.size()-1));
distance_out.push_back(sheet + L"!" + cells_out.substr(0, cells_out.size()-1));
}
std::wstring result;
BOOST_FOREACH(std::wstring &d, distance_out)
for (size_t i = 0; i < distance_out.size(); i++)
{
result.append(d);
result.append(distance_out[i]);
result.append(L",");
}
XmlUtils::replace_all( result, L"PROBEL" , L" ");
XmlUtils::replace_all( result, L"TOCHKA" , L".");
XmlUtils::replace_all( result, L"TOCHKA", L".");
return result.substr(0, result.size()-1);// минус последняя лишняя запятая
return result.substr(0, result.size() - 1);// минус последняя лишняя запятая
}
odf2oox_converter::odf2oox_converter(): impl_(new odf2oox_converter::Impl)
{
......@@ -579,6 +602,10 @@ namespace formulasconvert {
{
return impl_->convert_chart_distance(expr);
}
void odf2oox_converter::split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out)
{
return impl_->split_distance_by(expr, by, out);
}
std::wstring odf2oox_converter::convert_named_ref(const std::wstring& expr, bool withTableName, std::wstring separator)
{
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
......
......@@ -160,7 +160,8 @@ namespace PPTX
COfficeFileFormatChecker office_checker;
office_checker.isOOXFormatFile(oox_file.GetPath());
//if ( std::wstring::npos != sProgID.find(L"Word.Document"))
if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX)
if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX ||
office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM )
{
pWriter->StartRecord(1);
pWriter->WriteBYTE(1);
......@@ -189,7 +190,8 @@ namespace PPTX
*pWriter->m_pCurrentContainer = old_rels;
pWriter->m_pMainDocument = old_serial;
}
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX)
else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX ||
office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM)
//if ( std::wstring::npos != sProgID.find(L"Excel.Sheet")) //"ET.Xlsx.6" !!!
{
pWriter->StartRecord(1);
......
......@@ -51,18 +51,26 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
HRESULT convert_single(std::wstring fileName)
HRESULT convert_single(std::wstring srcFileName)
{
HRESULT hr = S_OK;
std::wstring srcFileName = fileName;
std::wstring dstPath = srcFileName + L"-my.xlsx";
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
std::wstring outputDir = NSDirectory::GetFolderPath(srcFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstPath;
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", NULL);
bool bMacros = true;
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password", L"C:\\Windows\\Fonts", NULL, bMacros);
if (bMacros)
{
dstPath = srcFileName + L"-my.xlsm";
}
else
{
dstPath = srcFileName + L"-my.xlsx";
}
if (hr == S_OK)
{
COfficeUtils oCOfficeUtils(NULL);
......@@ -71,6 +79,7 @@ HRESULT convert_single(std::wstring fileName)
NSDirectory::DeleteDirectory(dstTempPath);
return hr;
}
......
......@@ -96,7 +96,63 @@ CompoundFile::CompoundFile(const std::wstring & file_path, const ReadWriteMode m
storage_ = NULL;
Open(file_path, mode);
}
// Opens "Workbook" stream and returns the only reference
void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot)
{
POLE::Stream *stream = new POLE::Stream(storage_, streamName);
if (!stream) return;
stream->seek(0);
int size_stream = stream->size();
if (withRoot == false)
{
int pos = streamName.find("/");
if (pos >= 0)
streamName = streamName.substr(pos + 1);
}
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
if (!streamNew) return;
unsigned char* data_stream = new unsigned char[size_stream];
if (data_stream)
{
stream->read(data_stream, size_stream);
streamNew->write(data_stream, size_stream);
delete []data_stream;
data_stream = NULL;
}
streamNew->flush();
delete streamNew;
delete stream;
}
void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot)
{
std::list<std::string> entries;
entries = storage_->entries( path );
std::list<std::string>::iterator it;
for( it = entries.begin(); it != entries.end(); ++it )
{
std::string name = *it;
std::string fullname = path + name;
if( storage_->isDirectory( fullname ) )
{
copy( indent + 1, fullname + "/", storageOut, withRoot );
}
else
{
copy_stream(fullname, storageOut, withRoot);
}
}
}
CFStreamPtr CompoundFile::getWorkbookStream()
{
CFStreamPtr stream = getNamedStream("Workbook");
......@@ -123,7 +179,6 @@ CFStreamPtr CompoundFile::getNamedStream(const std::string& name)
return streams[name];
}
CFStreamPtr CompoundFile::createNamedStream(const std::string& name)
{
if(!streams[name])
......
......@@ -58,11 +58,15 @@ public:
bool isError();
void copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot = true);
CFStreamPtr getWorkbookStream ();
CFStreamPtr getNamedStream (const std::string& name);
POLE::Storage *storage_;
private:
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot = true);
POLE::Stream* openStream (const std::string & stream_name); // Opens a stream in the storage (shall be called not more than once per stream)
POLE::Stream* createStream (const std::string & stream_name); // Creates a new stream in the storage
......
......@@ -101,6 +101,8 @@ BiffStructurePtr SXAddl::createSxcView(CFRecord& record)
switch(sxd)
{
case 0x00: result = BiffStructurePtr(new SXAddl_SXCView_SXDId()); break;
case 0x02: result = BiffStructurePtr(new SXAddl_SXCView_SXDVer10Info()); break;
case 0x19: result = BiffStructurePtr(new SXAddl_SXCView_SXDVer12Info()); break;
case 0x1E: result = BiffStructurePtr(new SXAddl_SXCView_SXDTableStyleClient()); break;
case 0xff: result = BiffStructurePtr(new SXAddl_SXCView_SXDEnd()); break;
}
......@@ -327,6 +329,61 @@ void SXAddl_SXCView_SXDId::load(CFRecord& record)
record >> stName;
}
//----------------------------------------------------------------------------
BiffStructurePtr SXAddl_SXCView_SXDVer10Info::clone()
{
return BiffStructurePtr(new SXAddl_SXCView_SXDVer10Info(*this));
}
void SXAddl_SXCView_SXDVer10Info::load(CFRecord& record)
{
unsigned short flags, reserved2;
unsigned char unused;
record >> bVerSxMacro >> flags >> unused >> reserved2;
fDisplayImmediateItems = GETBIT(flags, 0);
fEnableDataEd = GETBIT(flags, 1);
fDisableFList = GETBIT(flags, 2);
fReenterOnLoadOnce = GETBIT(flags, 3);
fNotViewCalculatedMembers = GETBIT(flags, 4);
fNotVisualTotals = GETBIT(flags, 5);
fPageMultipleItemLabel = GETBIT(flags, 6);
fTensorFillCv = GETBIT(flags, 7);
fHideDDData = GETBIT(flags, 8);
}
//----------------------------------------------------------------------------
BiffStructurePtr SXAddl_SXCView_SXDVer12Info::clone()
{
return BiffStructurePtr(new SXAddl_SXCView_SXDVer12Info(*this));
}
void SXAddl_SXCView_SXDVer12Info::load(CFRecord& record)
{
_UINT32 flags;
unsigned short reserved3;
record >> flags >> reserved3;
fDefaultCompact = GETBIT(flags, 0);
fDefaultOutline = GETBIT(flags, 1);
fOutlineData = GETBIT(flags, 2);
fCompactData = GETBIT(flags, 3);
fNewDropZones = GETBIT(flags, 4);
fPublished = GETBIT(flags, 5);
fTurnOffImmersive = GETBIT(flags, 6);
fSingleFilterPerField = GETBIT(flags, 7);
fNonDefaultSortInFlist = GETBIT(flags, 8);
fDontUseCustomLists = GETBIT(flags, 10);
fHideDrillIndicators = GETBIT(flags, 12);
fPrintDrillIndicators = GETBIT(flags, 13);
fMemPropsInTips = GETBIT(flags, 14);
fNoPivotTips = GETBIT(flags, 15);
cIndentInc = GETBITS(flags, 16, 22);
fNoHeaders = GETBIT(flags, 23);
}
//----------------------------------------------------------------------------
BiffStructurePtr SXAddl_SXCField_SXDEnd::clone()
{
return BiffStructurePtr(new SXAddl_SXCField_SXDEnd(*this));
......
......@@ -501,6 +501,60 @@ public:
_UINT32 dwItem;
};
class SXAddl_SXCView_SXDVer10Info: public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(SXAddl_SXCView_SXDVer10Info)
public:
BiffStructurePtr clone();
SXAddl_SXCView_SXDVer10Info(){}
~SXAddl_SXCView_SXDVer10Info(){}
virtual void load(CFRecord& record);
static const ElementType type = typeSXAddl;
unsigned char bVerSxMacro;
bool fDisplayImmediateItems;
bool fEnableDataEd;
bool fDisableFList;
bool fReenterOnLoadOnce;
bool fNotViewCalculatedMembers;
bool fNotVisualTotals;
bool fPageMultipleItemLabel;
bool fTensorFillCv;
bool fHideDDData;
};
class SXAddl_SXCView_SXDVer12Info: public BiffStructure
{
BASE_STRUCTURE_DEFINE_CLASS_NAME(SXAddl_SXCView_SXDVer12Info)
public:
BiffStructurePtr clone();
SXAddl_SXCView_SXDVer12Info(){}
~SXAddl_SXCView_SXDVer12Info(){}
virtual void load(CFRecord& record);
static const ElementType type = typeSXAddl;
bool fDefaultCompact;
bool fDefaultOutline;
bool fOutlineData;
bool fCompactData;
bool fNewDropZones;
bool fPublished;
bool fTurnOffImmersive;
bool fSingleFilterPerField;
bool fNonDefaultSortInFlist;
bool fDontUseCustomLists;
bool fHideDrillIndicators;
bool fPrintDrillIndicators;
bool fMemPropsInTips;
bool fNoPivotTips;
unsigned char cIndentInc;
bool fNoHeaders;
};
//class SXAddl_SXCCacheItem_SXDItmMpMapCount : public SXAddl {};
//class SXAddl_SXCCacheItem_SXDItmMpropMap : public SXAddl {};
......@@ -601,8 +655,6 @@ public:
// SXAddl_SXCView_SXDSXPIIvmb(CFRecord& record);
//};
//class SXAddl_SXCView_SXDVer10Info : public SXAddl {};
//class SXAddl_SXCView_SXDVer12Info : public SXAddl {};
//class SXAddl_SXCView_SXDVerUpdInv : public SXAddl {};
} // namespace XLS
......
......@@ -53,7 +53,10 @@ BaseObjectPtr SXStreamID::clone()
void SXStreamID::readFields(CFRecord& record)
{
GlobalWorkbookInfoPtr global_info = record.getGlobalWorkbookInfo();
record >> idStm;
global_info->arPivotCacheStream.push_back(idStm);
}
} // namespace XLS
......
......@@ -73,13 +73,14 @@ int SXVI::serialize(std::wostream & strm)
{
CP_XML_NODE(L"item")
{
if (fHidden) CP_XML_ATTR(L"h", 1);
if (fMissing) CP_XML_ATTR(L"m", 1);
if (fHideDetail)CP_XML_ATTR(L"sd", 0);
if (fFormula) CP_XML_ATTR(L"f", 1);
if (itmType == 0)
{
if (fHidden) CP_XML_ATTR(L"h", 1);
CP_XML_ATTR(L"x", iCache);
}
switch(itmType)
......
......@@ -77,8 +77,8 @@ void PtgSxName::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
SXPair *pair = dynamic_cast<SXPair*>(global_info->arPivotSxNames[sxIndex].pair[0].get());
if (pair)
{
std::map<int, BaseObjectPtr>::iterator pFind = global_info->mapPivotCache.find(global_info->idPivotCache);
if (pFind != global_info->mapPivotCache.end())
std::unordered_map<int, BaseObjectPtr>::iterator pFind = global_info->mapPivotCacheStream.find(global_info->idPivotCache);
if (pFind != global_info->mapPivotCacheStream.end())
{
PIVOTCACHE* pivot_cache = dynamic_cast<PIVOTCACHE*>(pFind->second.get());
if (pivot_cache)
......
......@@ -254,8 +254,10 @@ int FDB::serialize(std::wostream & strm, bool bSql)
{
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
}
else if (bDate & bString)
else if ((bDate & bString) || (bEmpty & bInteger & bString))
{
if (bEmpty && bInteger)
bNumber = true;
CP_XML_ATTR(L"containsMixedTypes", 1);
}
else if (!bEmpty && !bString && !bBool)
......
......@@ -78,10 +78,23 @@ const bool PIVOTADDL::loadContent(BinProcessor& proc)
{
SXAddl* addl = dynamic_cast<SXAddl*>(it->get());
if (!addl) continue;
SXAddl_SXCView_SXDTableStyleClient* p = dynamic_cast<SXAddl_SXCView_SXDTableStyleClient*>(addl->content.get());
if (p)
SXAddl_SXCView_SXDTableStyleClient* p1 = dynamic_cast<SXAddl_SXCView_SXDTableStyleClient*>(addl->content.get());
if (p1)
{
m_SXAddl_SXCView_SXDTableStyleClient = addl->content;
continue;
}
SXAddl_SXCView_SXDVer10Info* p2 = dynamic_cast<SXAddl_SXCView_SXDVer10Info*>(addl->content.get());
if (p2)
{
m_SXAddl_SXCView_SXDVer10Info = addl->content;
continue;
}
SXAddl_SXCView_SXDVer12Info* p3 = dynamic_cast<SXAddl_SXCView_SXDVer12Info*>(addl->content.get());
if (p3)
{
m_SXAddl_SXCView_SXDVer12Info = addl->content;
continue;
}
}
//if(!proc.mandatory<SXAddl_SXCView_SXDId>())
......
......@@ -98,11 +98,13 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
SXStreamID* streamId = dynamic_cast<SXStreamID*>(m_SXStreamID.get());
if (!streamId) return 0;
std::map<int, BaseObjectPtr>::iterator pFind = global_info_->mapPivotCache.find(streamId->idStm);
if (pFind == global_info_->mapPivotCache.end()) return 0;
std::unordered_map<int, BaseObjectPtr>::iterator pFind = global_info_->mapPivotCacheStream.find(streamId->idStm);
if (pFind == global_info_->mapPivotCacheStream.end()) return 0;
global_info_->idPivotCache = streamId->idStm;
global_info_->mapPivotCacheIndex.insert(std::make_pair(global_info_->idPivotCache, global_info_->mapPivotCacheIndex.size()));
PIVOTCACHE* pivot_cache = dynamic_cast<PIVOTCACHE*>(pFind->second.get());
if (!pivot_cache) return 0;
......@@ -178,8 +180,8 @@ int PIVOTCACHEDEFINITION::serialize_records(std::wostream & strm)
SXStreamID* streamId = dynamic_cast<SXStreamID*>(m_SXStreamID.get());
if (!streamId) return 0;
std::map<int, BaseObjectPtr>::iterator pFind = global_info_->mapPivotCache.find(streamId->idStm);
if (pFind == global_info_->mapPivotCache.end()) return 0;
std::unordered_map<int, BaseObjectPtr>::iterator pFind = global_info_->mapPivotCacheStream.find(streamId->idStm);
if (pFind == global_info_->mapPivotCacheStream.end()) return 0;
PIVOTCACHE* pivot_cache = dynamic_cast<PIVOTCACHE*>(pFind->second.get());
if (!pivot_cache) return 0;
......
......@@ -31,9 +31,10 @@
*/
#include "PIVOTEX.h"
#include <Logic/Biff_records/SXEx.h>
#include <Logic/Biff_unions/PIVOTSELECT.h>
#include <Logic/Biff_unions/PIVOTFORMAT.h>
#include "PIVOTSELECT.h"
#include "PIVOTFORMAT.h"
#include "../Biff_records/SXEx.h"
namespace XLS
{
......@@ -54,7 +55,6 @@ BaseObjectPtr PIVOTEX::clone()
return BaseObjectPtr(new PIVOTEX(*this));
}
// PIVOTEX = SXEx *PIVOTSELECT *PIVOTFORMAT
const bool PIVOTEX::loadContent(BinProcessor& proc)
{
......@@ -62,9 +62,21 @@ const bool PIVOTEX::loadContent(BinProcessor& proc)
{
return false;
}
m_SXEx = elements_.back();
elements_.pop_back();
int count = 0;
count = proc.repeated<PIVOTSELECT>(0, 0);
while(count--)
{
m_arPIVOTSELECT.push_back(elements_.front()); elements_.pop_front();
}
count = proc.repeated<PIVOTFORMAT>(0, 0);
while(count--)
{
m_arPIVOTFORMAT.push_back(elements_.front()); elements_.pop_front();
}
return true;
}
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of PIVOTEX union of records
class PIVOTEX: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTEX)
......@@ -50,6 +48,11 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typePIVOTEX;
BaseObjectPtr m_SXEx;
std::vector<BaseObjectPtr> m_arPIVOTSELECT;
std::vector<BaseObjectPtr> m_arPIVOTFORMAT;
};
} // namespace XLS
......
......@@ -31,9 +31,10 @@
*/
#include "PIVOTFORMAT.h"
#include <Logic/Biff_records/SxFormat.h>
#include <Logic/Biff_unions/PIVOTRULE.h>
#include <Logic/Biff_records/SxDXF.h>
#include "PIVOTRULE.h"
#include "../Biff_records/SxFormat.h"
#include "../Biff_records/SxDXF.h"
namespace XLS
{
......@@ -54,7 +55,6 @@ BaseObjectPtr PIVOTFORMAT::clone()
return BaseObjectPtr(new PIVOTFORMAT(*this));
}
// PIVOTFORMAT = SxFormat PIVOTRULE [SxDXF]
const bool PIVOTFORMAT::loadContent(BinProcessor& proc)
{
......@@ -62,11 +62,18 @@ const bool PIVOTFORMAT::loadContent(BinProcessor& proc)
{
return false;
}
m_SxFormat = elements_.back();
elements_.pop_back();
if (proc.mandatory<PIVOTRULE>())
{
m_PIVOTRULE = elements_.back();
elements_.pop_back();
}
if (proc.optional<SxDXF>())
{
m_SxDXF = elements_.back();
elements_.pop_back();
}
return true;
......
......@@ -36,8 +36,6 @@
namespace XLS
{
// Logical representation of PIVOTFORMAT union of records
class PIVOTFORMAT: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(PIVOTFORMAT)
......@@ -50,6 +48,10 @@ public:
virtual const bool loadContent(BinProcessor& proc);
static const ElementType type = typePIVOTFORMAT;
BaseObjectPtr m_SxFormat;
BaseObjectPtr m_PIVOTRULE;
BaseObjectPtr m_SxDXF;
};
} // namespace XLS
......
......@@ -99,7 +99,7 @@ int PIVOTVD::serialize(std::wostream & strm)
if (vd_ex->ifmt > 0)
{
CP_XML_ATTR(L"numFmtId", vd_ex->ifmt);
CP_XML_ATTR(L"numFmtId", vd_ex->ifmt != 44 ? vd_ex->ifmt : 0);
}
if (vd->stName.value().empty() == false)
......
......@@ -39,16 +39,23 @@
#include "PIVOTLI.h"
#include "PIVOTEX.h"
#include "PIVOTADDL.h"
#include "PIVOTFORMAT.h"
#include "PIVOTFRT9.h"
#include "../Biff_records/SXDI.h"
#include "../Biff_records/SxView.h"
#include "../Biff_records/SXAddl.h"
#include "../Biff_records/SXEx.h"
#include "../Biff_records/SxFormat.h"
#include "../Biff_records/SxDXF.h"
#include "../Biff_records/SXViewEx9.h"
namespace XLS
{
PIVOTVIEW::PIVOTVIEW()
{
indexStream = -1;
indexCache = -1;
}
......@@ -64,6 +71,8 @@ BaseObjectPtr PIVOTVIEW::clone()
// PIVOTVIEW = PIVOTCORE [PIVOTFRT]
const bool PIVOTVIEW::loadContent(BinProcessor& proc)
{
global_info_ = proc.getGlobalWorkbookInfo();
if(!proc.mandatory<PIVOTCORE>())
{
return false;
......@@ -97,10 +106,20 @@ int PIVOTVIEW::serialize(std::wostream & strm)
if (!view) return 0;
PIVOTFRT* frt = dynamic_cast<PIVOTFRT*>(m_PIVOTFRT.get());
PIVOTEX* pivot_ex = dynamic_cast<PIVOTEX*>(core->m_PIVOTEX.get());
PIVOTADDL* addls = frt ? dynamic_cast<PIVOTADDL*>(frt->m_PIVOTADDL.get()) : NULL;
PIVOTFRT9* frt9 = frt ? dynamic_cast<PIVOTFRT9*>(frt->m_PIVOTFRT9.get()) : NULL;
SXEx *view_ex = pivot_ex ? dynamic_cast<SXEx*>(pivot_ex->m_SXEx.get()) : NULL;
SXViewEx9 *view_ex9 = pivot_ex ? dynamic_cast<SXViewEx9*>(frt9->m_SXViewEx9.get()) : NULL;
SXAddl_SXCView_SXDVer10Info *view_ex10 = addls ? dynamic_cast<SXAddl_SXCView_SXDVer10Info*>(addls->m_SXAddl_SXCView_SXDTableStyleClient.get()) : NULL;
SXAddl_SXCView_SXDVer12Info *view_ex12 = addls ? dynamic_cast<SXAddl_SXCView_SXDVer12Info*>(addls->m_SXAddl_SXCView_SXDTableStyleClient.get()) : NULL;
indexStream = global_info_->arPivotCacheStream[view->iCache];
indexCache = view->iCache;
std::map<int, int>::iterator pFindIndex = global_info_->mapPivotCacheIndex.find(indexStream);
indexCache = pFindIndex->second;
CP_XML_WRITER(strm)
{
......@@ -109,8 +128,11 @@ int PIVOTVIEW::serialize(std::wostream & strm)
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"name", view->stTable.value());
CP_XML_ATTR(L"cacheId", view->iCache);
CP_XML_ATTR(L"cacheId", indexCache);
if (view->sxaxis4Data.bRw)
{
CP_XML_ATTR(L"dataOnRows", view->sxaxis4Data.bRw);
}
CP_XML_ATTR(L"applyNumberFormats", view->fAtrNum);
CP_XML_ATTR(L"applyBorderFormats", view->fAtrBdr);
CP_XML_ATTR(L"applyFontFormats", view->fAtrFnt);
......@@ -121,15 +143,39 @@ int PIVOTVIEW::serialize(std::wostream & strm)
{
CP_XML_ATTR(L"dataCaption", view->stData.value());
}
CP_XML_ATTR(L"asteriskTotals", 1);
CP_XML_ATTR(L"showMemberPropertyTips", 0);
CP_XML_ATTR(L"useAutoFormatting", view->fAutoFormat);
CP_XML_ATTR(L"autoFormatId", view->itblAutoFmt);
CP_XML_ATTR(L"itemPrintTitles", 1);
CP_XML_ATTR(L"indent", 0);
CP_XML_ATTR(L"compact", 0);
CP_XML_ATTR(L"compactData", 0);
CP_XML_ATTR(L"gridDropZones", 1);
if (view_ex9)
{
CP_XML_ATTR(L"itemPrintTitles", view_ex9->fPrintTitles);
CP_XML_ATTR(L"outline", view_ex9->fLineMode);
CP_XML_ATTR(L"outlineData", view_ex12 ? view_ex12->fOutlineData : view_ex9->fLineMode);
}
CP_XML_ATTR(L"asteriskTotals", view_ex10 ? view_ex10->fNotVisualTotals : 0);
if (view_ex12)
{
CP_XML_ATTR(L"indent", view_ex12->cIndentInc );
CP_XML_ATTR(L"published", view_ex12->fPublished);
CP_XML_ATTR(L"compact", view_ex12->fCompactData);
CP_XML_ATTR(L"compactData", view_ex12->fCompactData);
CP_XML_ATTR(L"gridDropZones", view_ex12->fNewDropZones);
CP_XML_ATTR(L"showDrill", !view_ex12->fHideDrillIndicators);
CP_XML_ATTR(L"printDrill", view_ex12->fPrintDrillIndicators);
}
if (view_ex)
{
if (!view_ex->fEnableWizard) CP_XML_ATTR(L"enableWizard", 0);
if (!view_ex->fEnableDrilldown) CP_XML_ATTR(L"enableDrill", 0);
//CP_XML_ATTR(L"disableFieldList", !view_ex->fEnableFieldDialog);//enableFieldPropert
if (!view_ex->stError.value().empty())
CP_XML_ATTR(L"errorCaption", view_ex->stError.value());
}
CP_XML_NODE(L"location")
{
......@@ -137,9 +183,13 @@ int PIVOTVIEW::serialize(std::wostream & strm)
CP_XML_ATTR(L"firstHeaderRow", view->rwFirstHead - view->ref.rowFirst );
CP_XML_ATTR(L"firstDataRow", view->rwFirstData - view->ref.rowFirst);
CP_XML_ATTR(L"firstDataCol", view->colFirstData - view->ref.columnFirst);
CP_XML_ATTR(L"rowPageCount", 1);
if (view->cDimPg > 0)
{
CP_XML_ATTR(L"rowPageCount", view->cDimPg);
CP_XML_ATTR(L"colPageCount", 1);
}
}
CP_XML_NODE(L"pivotFields")
{
CP_XML_ATTR(L"count", view->cDim);//Sxvd
......@@ -215,7 +265,9 @@ int PIVOTVIEW::serialize(std::wostream & strm)
SXAddl_SXCView_SXDTableStyleClient* table_style = dynamic_cast<SXAddl_SXCView_SXDTableStyleClient*>(addls->m_SXAddl_SXCView_SXDTableStyleClient.get());
CP_XML_NODE(L"pivotTableStyleInfo")
{
if (!table_style->stName.value().empty())
CP_XML_ATTR(L"name", table_style->stName.value());
CP_XML_ATTR(L"showRowHeaders", table_style->fRowHeaders);
CP_XML_ATTR(L"showColHeaders", table_style->fColumnHeaders);
CP_XML_ATTR(L"showRowStripes", table_style->fRowStrips);
......
......@@ -54,8 +54,11 @@ public:
BaseObjectPtr m_PIVOTCORE;
BaseObjectPtr m_PIVOTFRT;
//----------------------------------
int indexStream;
int indexCache;
std::wstring name;
GlobalWorkbookInfoPtr global_info_;
};
} // namespace XLS
......
......@@ -35,6 +35,7 @@
#include <boost/smart_ptr/shared_array.hpp>
#include <vector>
#include <map>
#include <unordered_map>
#include "Biff_structures/BorderFillInfo.h"
......@@ -106,7 +107,10 @@ public:
const static unsigned int initial_AXES_id = 0x2000000;
short idPivotCache;
std::map<int, BaseObjectPtr> mapPivotCache;
std::map<int, int> mapPivotCacheIndex; //streamIdCache, write index order
std::unordered_map<int, BaseObjectPtr> mapPivotCacheStream;//streamIdCache, object
std::vector<int> arPivotCacheStream; //order streamIdCache = iCache
std::vector<bool> arPivotCacheFields;
std::vector<bool> arPivotCacheFieldShortSize;
......
......@@ -36,9 +36,9 @@
#include "../../../Common/OfficeFileErrorDescription.h"
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* pCallBack)
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* pCallBack, bool &bMacros)
{
XlsConverter converter(srcFile, dstPath, password, fontsPath, pCallBack);
XlsConverter converter(srcFile, dstPath, password, fontsPath, pCallBack, bMacros);
if (converter.isError())
{
......
......@@ -33,4 +33,4 @@
struct ProgressCallback;
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring& fontsPath, const ProgressCallback* CallBack);
\ No newline at end of file
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring& fontsPath, const ProgressCallback* CallBack, bool & bMacros);
\ No newline at end of file
......@@ -121,7 +121,7 @@ typedef struct tagBITMAPCOREHEADER {
} BITMAPCOREHEADER;
#endif
XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* CallBack)
XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* CallBack, bool & bMacros)
{
xlsx_path = _xlsx_path;
output_document = NULL;
......@@ -131,8 +131,10 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
bUserStopConvert = false;
is_older_version = false;
is_encrypted = false;
output_document = new oox::package::xlsx_document();
try{
try
{
XLS::CompoundFile cfile(xls_file, XLS::CompoundFile::cf_ReadMode);
if (cfile.isError())
......@@ -215,9 +217,30 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
{
}
xls_global_info->mapPivotCache.insert(std::make_pair(index, pivot_cache));
xls_global_info->mapPivotCacheStream.insert(std::make_pair(index, pivot_cache));
}
}
if (bMacros && cfile.storage_->isDirectory("_VBA_PROJECT_CUR"))
{
std::wstring xl_path = xlsx_path + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(xl_path.c_str());
std::wstring sVbaProjectFile = xl_path + FILE_SEPARATOR_STR + L"vbaProject.bin";
POLE::Storage *storageVbaProject = new POLE::Storage(sVbaProjectFile.c_str());
if ((storageVbaProject) && (storageVbaProject->open(true, true)))
{
cfile.copy(0, "_VBA_PROJECT_CUR/", storageVbaProject, false);
storageVbaProject->close();
delete storageVbaProject;
output_document->get_xl_files().add_vba_project();
}
}
else
bMacros = false;
}
catch(...)
{
......@@ -231,7 +254,6 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
Log::error("Version xls is old !!! - " + std::string(sVer.begin(), sVer.end()));
is_older_version = true;
}
output_document = new oox::package::xlsx_document();
xlsx_context = new oox::xlsx_conversion_context(output_document);
}
......@@ -268,6 +290,7 @@ bool XlsConverter::UpdateProgress(long nComplete)
void XlsConverter::write()
{
if (!output_document)return;
output_document->write(xlsx_path);
delete output_document; output_document = NULL;
......@@ -1924,6 +1947,7 @@ void XlsConverter::convert(XLS::PIVOTVIEW * pivot_view)
pivot_view->serialize(strm);
int index_view = xlsx_context->get_pivots_context().add_view(strm.str(), pivot_view->indexCache);
if (index_view > 0)
......
......@@ -93,7 +93,7 @@ namespace ODRAW
class XlsConverter
{
public:
XlsConverter(const std::wstring & xls_file, const std::wstring & xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack);
XlsConverter(const std::wstring & xls_file, const std::wstring & xlsx_path, const std::wstring & password, const std::wstring & fontsPath, const ProgressCallback* ffCallBack, bool & bMacros);
~XlsConverter() ;
oox::xlsx_conversion_context * xlsx_context;
......
......@@ -53,7 +53,6 @@ xlsx_content_types_file::xlsx_content_types_file()
content_type_.add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/xl/_rels/workbook.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content_type_.add_override(L"/xl/workbook.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
content_type_.add_override(L"/xl/styles.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
content_type_.add_override(L"/docProps/app.xml", L"application/vnd.openxmlformats-officedocument.extended-properties+xml");
content_type_.add_override(L"/docProps/core.xml", L"application/vnd.openxmlformats-package.core-properties+xml");
......@@ -140,6 +139,7 @@ void sheets_files::write(const std::wstring & RootPath)
const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(i + 1) + L".xml";
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
contentTypes.add_override(std::wstring(L"/xl/worksheets/") + fileName, kWSConType);
......@@ -168,6 +168,7 @@ void sheets_files::write(const std::wstring & RootPath)
xl_files::xl_files()
{
rels_files_.add_rel_file(rels_file::create(L"workbook.xml.rels"));
bVbaProject = false;
}
void xl_files::write(const std::wstring & RootPath)
......@@ -175,6 +176,8 @@ void xl_files::write(const std::wstring & RootPath)
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"xl";
NSDirectory::CreateDirectory(path.c_str());
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
{
pivot_cache_files_.set_rels(&rels_files_);
pivot_cache_files_.set_main_document(get_main_document());
......@@ -204,7 +207,6 @@ void xl_files::write(const std::wstring & RootPath)
connections_->write(path);
rels_files_.add( relationship( L"cnId1", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections", L"connections.xml" ) );
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
contentTypes.add_override(L"/xl/connections.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml");
}
......@@ -217,6 +219,18 @@ void xl_files::write(const std::wstring & RootPath)
if (workbook_)
{
workbook_->write(path);
if (bVbaProject)
{
rels_files_.add( relationship( L"vbId1", L"http://schemas.microsoft.com/office/2006/relationships/vbaProject", L"vbaProject.bin" ) );
contentTypes.add_override(L"/xl/vbaProject.bin", L"application/vnd.ms-office.vbaProject");
contentTypes.add_override(L"/xl/workbook.xml", L"application/vnd.ms-excel.sheet.macroEnabled.main+xml");
}
else
{
contentTypes.add_override(L"/xl/workbook.xml", L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
}
}
if (theme_)
......@@ -253,6 +267,11 @@ void xl_files::write(const std::wstring & RootPath)
rels_files_.write(path);
}
void xl_files::add_vba_project()
{
bVbaProject = true;
}
void xl_files::set_workbook(element_ptr Element)
{
workbook_ = Element;
......
......@@ -226,6 +226,8 @@ public:
void add_charts (chart_content_ptr chart);
void add_pivot_cache (pivot_cache_content_ptr cache);
void add_pivot_table (pivot_table_content_ptr table);
void add_vba_project ();
private:
rels_files rels_files_;
sheets_files sheets_files_;
......@@ -244,6 +246,8 @@ private:
element_ptr vml_drawings_;
element_ptr comments_;
bool bVbaProject;
};
class xlsx_document : public document
......@@ -251,7 +255,6 @@ class xlsx_document : public document
public:
xlsx_document();
public:
virtual void write(const std::wstring & RootPath);
virtual content_types_file & content_type() { return content_type_; }
xl_files & get_xl_files() { return xl_files_; }
......
......@@ -34,6 +34,8 @@
#include <boost/make_shared.hpp>
#include <simple_xml_writer.h>
#include <map>
namespace oox {
class xlsx_pivots_context::Impl
......@@ -86,11 +88,11 @@ void xlsx_pivots_context::dump_rels_cache(int index, rels & Rels)
}
void xlsx_pivots_context::dump_rels_view(int index, rels & Rels)
{
if (impl_->views_[index].indexCache_ >= 0)
if (impl_->views_[index].indexCache_ > 0)
{
Rels.add(relationship(L"rId1",
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
L"../pivotCache/pivotCacheDefinition" + std::to_wstring(impl_->views_[index].indexCache_ + 1) + L".xml", L""));
L"../pivotCache/pivotCacheDefinition" + std::to_wstring( impl_->views_[index].indexCache_ ) + L".xml", L""));
}
}
void xlsx_pivots_context::write_cache_definitions_to(int index, std::wostream & strm)
......@@ -122,7 +124,7 @@ int xlsx_pivots_context::add_view(std::wstring table_view, int indexCache)
{
if (table_view.empty()) return 0;
Impl::_pivot_view v = {table_view, indexCache};
Impl::_pivot_view v = {table_view, indexCache + 1};
impl_->views_.push_back(v);
return (int)impl_->views_.size();
......
......@@ -111,15 +111,17 @@ namespace OOX
std::wstring sResult = _T("<");
sResult += sNamespace;
sResult += _T("ext");
sResult += m_sAdditionalNamespace;
if ( m_sUri.IsInit() )
{
sResult += _T(" uri=\"");
sResult += m_sUri.get2();
sResult += _T("\">");
sResult += L" uri=\"" + m_sUri.get2() + L"\"";
}
else
if (!m_sAdditionalNamespace.empty())
{
sResult += L" " + m_sAdditionalNamespace;
}
sResult += _T(">");
if(m_oCompatExt.IsInit())
......
......@@ -110,6 +110,8 @@ namespace OOX
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
if (m_arrItems.empty()) return;
writer.WriteString(_T("<externalReferences>"));
for(size_t i = 0, length = m_arrItems.size(); i < length; ++i)
......
......@@ -67,7 +67,7 @@ namespace OOX
WritingStringAttrString(L"type", m_oType->ToString());
if (m_oGte.IsInit() && false == m_oGte->ToBool())
writer.WriteString(L" gte=\"0\"");
WritingStringNullableAttrString(L"val", m_oVal, m_oVal.get());
WritingStringNullableAttrEncodeXmlString(L"val", m_oVal, m_oVal.get());
writer.WriteString(_T("/>"));
}
}
......
......@@ -433,8 +433,8 @@ namespace OOX
writer.WriteString(_T("<selection"));
WritingStringNullableAttrString(L"activeCell", m_oActiveCell, m_oActiveCell.get());
WritingStringNullableAttrInt(L"activeCellId", m_oActiveCellId, m_oActiveCellId->GetValue());
WritingStringNullableAttrString(L"sqref", m_oSqref, m_oSqref.get());
WritingStringNullableAttrString(L"pane", m_oPane, m_oPane->ToString());
WritingStringNullableAttrString(L"sqref", m_oSqref, m_oSqref.get());
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......
......@@ -357,35 +357,67 @@ bool COfficeFileFormatChecker::isOOXFormatFile(const std::wstring & fileName)
std::string::size_type res1 = std::string::npos;
std::string::size_type res = 0;
if ((std::string::npos != strContentTypes.find(docxFormatLine)) ||
(std::string::npos != strContentTypes.find(dotxFormatLine)) ||
(std::string::npos != strContentTypes.find(docmFormatLine)) ||
(std::string::npos != strContentTypes.find(dotmFormatLine)))
if (std::string::npos != strContentTypes.find(docxFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
}
else if ((std::string::npos != strContentTypes.find(xlsxFormatLine)) ||
(std::string::npos != strContentTypes.find(xltxFormatLine)) ||
(std::string::npos != strContentTypes.find(xlsmFormatLine)) ||
(std::string::npos != strContentTypes.find(xltmFormatLine)))
else if (std::string::npos != strContentTypes.find(docmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM;
}
else if (std::string::npos != strContentTypes.find(dotxFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX;
}
else if (std::string::npos != strContentTypes.find(dotmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM;
}
else if (std::string::npos != strContentTypes.find(xlsxFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
}
else if ((std::string::npos != strContentTypes.find(pptxFormatLine)) ||
(std::string::npos != strContentTypes.find(potxFormatLine)) ||
(std::string::npos != strContentTypes.find(pptmFormatLine)) ||
(std::string::npos != strContentTypes.find(ppsmFormatLine)) ||
(std::string::npos != strContentTypes.find(potmFormatLine)))
else if (std::string::npos != strContentTypes.find(xlsmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM;
}
else if (std::string::npos != strContentTypes.find(xltxFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX;
}
else if (std::string::npos != strContentTypes.find(xltmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM;
}
else if (std::string::npos != strContentTypes.find(pptxFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
}
else if ((std::string::npos != strContentTypes.find(ppsxFormatLine)))
else if (std::string::npos != strContentTypes.find(pptmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM;
}
else if (std::string::npos != strContentTypes.find(ppsmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM;
}
else if (std::string::npos != strContentTypes.find(ppsmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM;
}
else if (std::string::npos != strContentTypes.find(ppsxFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX;
}
else if (std::string::npos != strContentTypes.find(potxFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX;
}
else if (std::string::npos != strContentTypes.find(potmFormatLine))
{
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM;
}
delete []pBuffer;
pBuffer = NULL;
......@@ -519,6 +551,9 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
switch (type)
{
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX: return L".docx";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM: return L".docm";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX: return L".dotx";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM: return L".dotm";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: return L".doc";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT: return L".odt";
case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF: return L".rtf";
......@@ -530,11 +565,18 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
case AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI: return L".mobi";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX: return L".pptx";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM: return L".pptm";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: return L".ppt";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP: return L".odp";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX: return L".ppsx";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM: return L".ppsm";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX: return L".potx";
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM: return L".potm";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX: return L".xlsx";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM: return L".xlsm";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX: return L".xltx";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM: return L".xltm";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS: return L".xls";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS: return L".ods";
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV: return L".csv";
......@@ -581,6 +623,12 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring& ext)
{
if (L".docx" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
if (L".docm" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM;
if (L".dotx" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX;
if (L".dotm" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM;
if (L".doc" == ext)
return AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC;
if (L".odt" == ext)
......@@ -603,15 +651,29 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring& ext)
if (L".pptx" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
if (L".pptm" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM;
if (L".ppsm" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM;
if (L".ppt" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT;
if (L".odp" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP;
if (L".ppsx" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX;
if (L".potx" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX;
if (L".potm" == ext)
return AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM;
if (L".xlsx" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
if (L".xlsm" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM;
if (L".xltx" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX;
if (L".xltm" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM;
if (L".xls" == ext)
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS;
if (L".ods" == ext)
......
......@@ -44,18 +44,28 @@
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0008
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2 AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x0009
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000a
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000b
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000c
#define AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM AVS_OFFICESTUDIO_FILE_DOCUMENT + 0x000d
#define AVS_OFFICESTUDIO_FILE_PRESENTATION 0x0080
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0001
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0002
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0003
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0004
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0005
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0006
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0007
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0008
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET 0x0100
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0001
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0002
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0003
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0004
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0005
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0006
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0007
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM 0x0200
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001
......
......@@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.4.475.0
VERSION = 2.4.476.0
DEFINES += INTVER=$$VERSION
TARGET = x2t
......
This diff is collapsed.
......@@ -55,6 +55,15 @@ namespace NExtractTools
int doct_bin2docx_dir (const std::wstring &sFrom, const std::wstring &sToResult, const std::wstring &sTo, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int doct2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int dotm2docm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotm2docm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int dotx2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotx2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int docm2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int docm2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int dotm2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int dotm2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xlsx2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xlsx_dir2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params, bool bXmlOptions);
int xlsx2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......@@ -62,6 +71,15 @@ namespace NExtractTools
int xlst_bin2xlsx_dir (const std::wstring &sFrom, const std::wstring &sToResult, const std::wstring &sTo, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int xlst2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params);
int xltx2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xltx2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xltm2xlsm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xltm2xlsm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xlsm2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xlsm2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int xltm2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xltm2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int pptx2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int pptx_dir2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int pptx2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......@@ -80,6 +98,18 @@ namespace NExtractTools
int ppsx2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppsx2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int potx2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int potx2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int ppsm2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppsm2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int potm2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int potm2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int ppsm2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppsm2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int pptm2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int pptm2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int potm2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int potm2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, InputParams& params);
int ppt2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......@@ -105,6 +135,8 @@ namespace NExtractTools
int xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlst (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlst_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlsm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlsm_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int txt2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int txt2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......
......@@ -109,25 +109,74 @@ namespace NExtractTools
switch (OfficeFileFormatChecker.nFileType)
{
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX:
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM:
{
if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOCX2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOCX2DOCT_BIN;
else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCX2RTF;
else if (0 == sExt2.compare(_T(".odt"))) res = TCD_DOCX2ODT;
else if (0 == sExt2.compare(_T(".docx")))
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX)
res = TCD_DOTX2DOCX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM)
res = TCD_DOCM2DOCX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM)
res = TCD_DOTM2DOCX;
}
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOTM2DOCM;
}break;
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX:
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM:
{
if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLSX2XLST;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLSX2XLST_BIN;
else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLSX2CSV;
else if (0 == sExt2.compare(_T(".ods"))) res = TCD_XLSX2ODS;
else if (0 == sExt2.compare(_T(".xlsx")))
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX)
res = TCD_XLTX2XLSX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM)
res = TCD_XLSM2XLSX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM)
res = TCD_XLTM2XLSX;
}
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLTM2XLSM;
}break;
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM:
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM:
{
if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPTX2PPTT_BIN;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPTX2PPTT;
else if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPSX2PPTX;
else if (0 == sExt2.compare(_T(".pptx")))
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX)
res = TCD_PPSX2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX)
res = TCD_POTX2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM)
res = TCD_PPTM2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM)
res = TCD_POTM2PPTX;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM)
res = TCD_PPSM2PPTX;
}
else if (0 == sExt2.compare(_T(".pptm")))
{
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM)
res = TCD_PPSM2PPTM;
if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM)
res = TCD_POTM2PPTM;
}
else if (0 == sExt2.compare(_T(".odp"))) res = TCD_PPTX2ODP;
}break;
case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY:
......@@ -198,6 +247,7 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS:
{
if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLS2XLSX;
else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLS2XLSM;
else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLS2XLST;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLS2XLST_BIN;
}break;
......
......@@ -62,16 +62,31 @@ namespace NExtractTools
TCD_DOCT2DOCX,
TCD_DOCX2DOCT_BIN,
TCD_DOCT_BIN2DOCX,
TCD_DOTX2DOCX,
TCD_DOCM2DOCX,
TCD_DOTM2DOCX,
TCD_DOTM2DOCM,
TCD_XLSX2XLST,
TCD_XLST2XLSX,
TCD_XLSX2XLST_BIN,
TCD_XLST_BIN2XLSX,
TCD_XLTX2XLSX,
TCD_XLSM2XLSX,
TCD_XLTM2XLSX,
TCD_XLTM2XLSM,
TCD_PPTX2PPTT,
TCD_PPTT2PPTX,
TCD_PPTX2PPTT_BIN,
TCD_PPTT_BIN2PPTX,
TCD_PPSX2PPTX,
TCD_POTX2PPTX,
TCD_PPTM2PPTX,
TCD_POTM2PPTX,
TCD_PPSM2PPTX,
TCD_POTM2PPTM,
TCD_PPSM2PPTM,
TCD_ZIPDIR,
TCD_UNZIPDIR,
......@@ -89,7 +104,6 @@ namespace NExtractTools
TCD_T2BIN,
TCD_BIN2T,
TCD_PPSX2PPTX,
//ppt 2
TCD_PPT2PPTX,
TCD_PPT2PPTT,
......@@ -102,6 +116,7 @@ namespace NExtractTools
TCD_XLS2XLST,
TCD_XLS2XLST_BIN,
TCD_XLS2XLSX,
TCD_XLS2XLSM,
//rtf 2
TCD_RTF2DOCX,
TCD_RTF2DOCT,
......@@ -535,7 +550,7 @@ namespace NExtractTools
}
bool getIsNoBase64() const
{
return (NULL != m_bIsNoBase64) ? (*m_bIsNoBase64) : false;
return (NULL != m_bIsNoBase64) ? (*m_bIsNoBase64) : true;
}
bool getSaveXFile() const
{
......@@ -718,7 +733,7 @@ namespace NExtractTools
int nDelimitersCount = 6;
int aDelimiters[6] = { 0, 0, 0, 0, 0, 0 };
for(int i = 0; i < dwBytesRead; ++i)
for (DWORD i = 0; i < dwBytesRead; ++i)
{
char cCurChar = pBuffer[i];
if ('\n' == cCurChar)
......@@ -757,20 +772,42 @@ namespace NExtractTools
*m_nFormatFrom = formatFrom;
int toFormat = *m_nFormatTo;
if (AVS_OFFICESTUDIO_FILE_CANVAS == toFormat) {
if (AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & formatFrom)) {
if (AVS_OFFICESTUDIO_FILE_CANVAS == toFormat)
{
if ( AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_SPREADSHEET & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET;
} else if (AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_PRESENTATION & formatFrom)) {
}
else if ( AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == formatFrom
|| 0 != ( AVS_OFFICESTUDIO_FILE_PRESENTATION & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION;
} else if (AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_DOCUMENT & formatFrom)) {
}
else if ( AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_DOCUMENT & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_CANVAS_WORD;
}
} else if (AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER == toFormat) {
if (AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == formatFrom || AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & formatFrom)) {
}
else if ( AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER == toFormat)
{
if ( AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == formatFrom ||
AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_SPREADSHEET & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
} else if (AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION == formatFrom || AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_PRESENTATION & formatFrom)) {
}
else if ( AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION == formatFrom ||
AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_PRESENTATION & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
} else if (AVS_OFFICESTUDIO_FILE_CANVAS_WORD == formatFrom || AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == formatFrom || 0 != (AVS_OFFICESTUDIO_FILE_DOCUMENT & formatFrom)) {
}
else if ( AVS_OFFICESTUDIO_FILE_CANVAS_WORD == formatFrom ||
AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY == formatFrom ||
0 != ( AVS_OFFICESTUDIO_FILE_DOCUMENT & formatFrom))
{
toFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
}
size_t nIndex = m_sFileTo->rfind('.');
......@@ -899,6 +936,24 @@ namespace NExtractTools
}
else if (0 == sArg3.compare(_T("ppsx2pptx"))) {
res = TCD_PPSX2PPTX;
}
else if (0 == sArg3.compare(_T("potx2pptx"))) {
res = TCD_POTX2PPTX;
}
else if (0 == sArg3.compare(_T("potm2pptm"))) {
res = TCD_POTM2PPTM;
}
else if (0 == sArg3.compare(_T("xltx2xlsx"))) {
res = TCD_XLTX2XLSX;
}
else if (0 == sArg3.compare(_T("xltm2xlsm"))) {
res = TCD_XLTM2XLSM;
}
else if (0 == sArg3.compare(_T("dotx2docx"))) {
res = TCD_DOTX2DOCX;
}
else if (0 == sArg3.compare(_T("dotm2docm"))) {
res = TCD_DOTM2DOCM;
}
else if (0 == sArg3.compare(_T("ppt2pptx"))) {
res = TCD_PPT2PPTX;
......
......@@ -212,7 +212,7 @@ namespace BinXlsxRW {
pOfficeArtExtension->m_sUri.Init();
pOfficeArtExtension->m_sUri->append(_T("{504A1905-F514-4f6f-8877-14C23A59335A}"));
pOfficeArtExtension->m_sAdditionalNamespace = _T(" xmlns:x14=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\"");
pOfficeArtExtension->m_sAdditionalNamespace = _T("xmlns:x14=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\"");
pTable->m_oExtLst.Init();
pTable->m_oExtLst->m_arrExt.push_back(pOfficeArtExtension);
}
......@@ -2580,7 +2580,7 @@ namespace BinXlsxRW {
pOfficeArtExtension->m_sUri.Init();
pOfficeArtExtension->m_sUri->append(_T("{05C60535-1F16-4fd2-B633-F4F36F0B64E0}"));
pOfficeArtExtension->m_sAdditionalNamespace = _T(" xmlns:x14=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\"");
pOfficeArtExtension->m_sAdditionalNamespace = _T("xmlns:x14=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\"");
m_pCurWorksheet->m_oExtLst.Init();
m_pCurWorksheet->m_oExtLst->m_arrExt.push_back(pOfficeArtExtension);
}
......
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