mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-26 07:11:53 +08:00
Compare commits
53 Commits
core-linux
...
core-win-6
| Author | SHA1 | Date | |
|---|---|---|---|
| 48d4b72d4b | |||
| 85de7ec7a6 | |||
| 9e6d4950c2 | |||
| cb4befa078 | |||
| ac1292a17a | |||
| 007a984c36 | |||
| d3d3180402 | |||
| fa9c096f3c | |||
| e1ec9d942e | |||
| 4acaa75b06 | |||
| 431115ef48 | |||
| 2d66d9902e | |||
| 206dd12a47 | |||
| e8d3059fe8 | |||
| f624f731de | |||
| ed373b7e2d | |||
| a67eb5644d | |||
| 5040220d82 | |||
| 4f0b889f04 | |||
| c94768902b | |||
| f575947c03 | |||
| 16bdbafa75 | |||
| 089871d3ae | |||
| 765677d952 | |||
| 6afc38c899 | |||
| a43639587f | |||
| 46d022388d | |||
| 31363e8f83 | |||
| e1286e4b73 | |||
| 0366bcb341 | |||
| 452f717e0e | |||
| ab3add9577 | |||
| 54939bca61 | |||
| 7ccde9c777 | |||
| 6bdfa26c7e | |||
| a5bae64959 | |||
| 4d04a0d649 | |||
| fb7af5b902 | |||
| 77172fb39c | |||
| 78ecdc676c | |||
| bbccdf009b | |||
| 4b26066377 | |||
| 8742163d51 | |||
| 212753f831 | |||
| 903236d890 | |||
| 15bd732b22 | |||
| 3e86bf7644 | |||
| d6cd7c30f5 | |||
| 89b384abfe | |||
| f54baf3aa8 | |||
| b2184f7167 | |||
| 3a10eabfe9 | |||
| f9e80f3602 |
@ -483,26 +483,27 @@ namespace DocFileFormat
|
||||
delete storageOut;
|
||||
return false;
|
||||
}
|
||||
DecryptStream( 0, "/", storageIn, storageOut, Decryptor);
|
||||
|
||||
std::list<std::string> listStream = storageIn->entries();
|
||||
//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);
|
||||
}
|
||||
//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;
|
||||
|
||||
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;
|
||||
|
||||
return true;
|
||||
std::list<std::string> entries;
|
||||
entries = storageIn->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( storageIn->isDirectory( fullname ) )
|
||||
{
|
||||
DecryptStream( level + 1, fullname + "/", storageIn, storageOut, Decryptor );
|
||||
}
|
||||
else
|
||||
{
|
||||
DecryptStream(fullname, storageIn, storageOut, Decryptor );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool WordDocument::DecryptStream(CRYPT::Decryptor* Decryptor, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut)
|
||||
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;
|
||||
@ -567,9 +562,9 @@ namespace DocFileFormat
|
||||
stream->read(data_stream, size_stream);
|
||||
|
||||
unsigned char* data_store = NULL;
|
||||
int size_data_store = 0;
|
||||
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,9 +102,10 @@ 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
|
||||
{
|
||||
return m_pStorage;
|
||||
|
||||
@ -314,7 +314,7 @@
|
||||
17E17ED41AC453F800BEA2EA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0710;
|
||||
LastUpgradeCheck = 0830;
|
||||
ORGANIZATIONNAME = "Ascensio System SIA";
|
||||
};
|
||||
buildConfigurationList = 17E17ED71AC453F800BEA2EA /* Build configuration list for PBXProject "ASCOfficeDocxFile2Lib" */;
|
||||
@ -446,8 +446,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -455,6 +457,7 @@
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@ -488,8 +491,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -497,6 +502,7 @@
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../include/cpdoccore/CPScopedPtr.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -58,6 +59,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);
|
||||
|
||||
|
||||
@ -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
|
||||
{
|
||||
@ -389,25 +391,24 @@ 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"NULLFORMULA"
|
||||
//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 = c.find('.');
|
||||
cells.push_back(c.substr(colon+1));
|
||||
if (sheet.size()<1)
|
||||
sheet=c.substr(0, colon);
|
||||
const std::string::size_type colon = range[j].find('.');
|
||||
cells.push_back(range[j].substr(colon + 1));
|
||||
if (sheet.size() < 1)
|
||||
{
|
||||
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}.*?')");// поиск того что в апострофах и замена там
|
||||
|
||||
@ -1427,7 +1427,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertImage()
|
||||
m_oWriter.WriteString(std::wstring(L"<a:xfrm"));
|
||||
if (0 != m_pImageElement->m_dRotate)
|
||||
{
|
||||
m_oWriter.WriteString(L" rot=\"" + std::to_wstring(m_pImageElement->m_dRotate * 60000) + L"\"");
|
||||
m_oWriter.WriteString(L" rot=\"" + std::to_wstring((int)(m_pImageElement->m_dRotate * 60000)) + L"\"");
|
||||
}
|
||||
if (m_pImageElement->m_bFlipH)
|
||||
{
|
||||
|
||||
@ -996,8 +996,8 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
|
||||
//даты и номера могут быть и не только в колонтитулах
|
||||
//todooo ... возможно нужно все перенести плейсхолдеры без ID a-la как в AddLayout
|
||||
|
||||
AddLayoutSlidePlaceholder(pSlide, MasterSlideNumber , pLayout);
|
||||
AddLayoutSlidePlaceholder(pSlide, MasterDate , pLayout);
|
||||
//AddLayoutSlidePlaceholder(pSlide, MasterSlideNumber , pLayout);
|
||||
//AddLayoutSlidePlaceholder(pSlide, MasterDate , pLayout);
|
||||
|
||||
//-------------элементы колонтитулов
|
||||
std::multimap<int, int>::iterator it;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -1922,7 +1922,7 @@
|
||||
17063B5B1AC5708E0056A3F1 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0730;
|
||||
LastUpgradeCheck = 0830;
|
||||
ORGANIZATIONNAME = "Ascensio System SIA";
|
||||
};
|
||||
buildConfigurationList = 17063B5E1AC5708E0056A3F1 /* Build configuration list for PBXProject "PPTXFormatLib" */;
|
||||
@ -2009,8 +2009,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -2018,6 +2020,7 @@
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@ -2051,8 +2054,10 @@
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -2060,6 +2065,7 @@
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -90,10 +99,16 @@ HRESULT convert_directory(std::wstring pathName)
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
HRESULT hr = convert_single(argv[1]);
|
||||
|
||||
//HRESULT hr = convert_directory(argv[1]);
|
||||
HRESULT hr = -1;
|
||||
if (NSFile::CFileBinary::Exists(argv[1]))
|
||||
{
|
||||
hr = convert_single(argv[1]);
|
||||
}
|
||||
else if (NSDirectory::Exists(argv[1]))
|
||||
{
|
||||
hr = convert_directory(argv[1]);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
@ -229,7 +229,7 @@ const std::wstring int2wstr(const int val, const int radix)
|
||||
|
||||
const std::wstring double2str(const double val)
|
||||
{
|
||||
return std::to_wstring(val);
|
||||
return boost::lexical_cast<std::wstring>(val);// std::to_wstring(val); - округление (
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ int BopPop::serialize(std::wostream & _stream)
|
||||
{
|
||||
CP_XML_NODE(L"c:custSplit")
|
||||
{
|
||||
for (int i = 0 ; i < custom->rggrbit.pie_indices.size(); i++)
|
||||
for (size_t i = 0 ; i < custom->rggrbit.pie_indices.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"c:secondPiePt")
|
||||
{
|
||||
|
||||
@ -160,7 +160,7 @@ int CF12::serialize(std::wostream & stream)
|
||||
CFGradient *gradient = dynamic_cast<CFGradient*>(rgbCT.get());
|
||||
CP_XML_NODE(L"colorScale")
|
||||
{
|
||||
for (int i = 0; i < gradient->rgInterp.size(); i ++)
|
||||
for (size_t i = 0; i < gradient->rgInterp.size(); i ++)
|
||||
{
|
||||
CP_XML_NODE(L"cfvo")
|
||||
{
|
||||
@ -181,7 +181,7 @@ int CF12::serialize(std::wostream & stream)
|
||||
CP_XML_ATTR(L"val", cfvo.numValue);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < gradient->rgCurve.size(); i ++)
|
||||
for (size_t i = 0; i < gradient->rgCurve.size(); i ++)
|
||||
{
|
||||
CP_XML_NODE(L"color")
|
||||
{
|
||||
|
||||
@ -54,14 +54,17 @@ BaseObjectPtr Chart3d::clone()
|
||||
void Chart3d::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short flags;
|
||||
unsigned short pcHeight_raw;
|
||||
record >> anRot >> anElev >> pcDist >> pcHeight_raw >> pcDepth >> pcGap >> flags;
|
||||
record >> anRot >> anElev >> pcDist >> pcHeightPie >> pcDepth >> pcGap >> flags;
|
||||
fPerspective = GETBIT(flags, 0);
|
||||
fCluster = GETBIT(flags, 1);
|
||||
f3DScaling = GETBIT(flags, 2);
|
||||
fNotPieChart = GETBIT(flags, 4);
|
||||
fWalls2D = GETBIT(flags, 5);
|
||||
pcHeight = fNotPieChart ? static_cast<short>(pcHeight_raw) : pcHeight_raw;
|
||||
|
||||
if (fNotPieChart)
|
||||
{
|
||||
pcHeight3D = static_cast<short>(pcHeightPie);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -48,7 +48,6 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeChart3d;
|
||||
@ -57,7 +56,8 @@ public:
|
||||
_INT16 anRot;
|
||||
_INT16 anElev;
|
||||
_INT16 pcDist;
|
||||
_UINT32 pcHeight;
|
||||
_UINT16 pcHeightPie;
|
||||
short pcHeight3D;
|
||||
_INT16 pcDepth;
|
||||
_UINT16 pcGap;
|
||||
|
||||
|
||||
@ -31,14 +31,15 @@
|
||||
*/
|
||||
|
||||
#include "DConRef.h"
|
||||
#include "../../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
DConRef::DConRef()
|
||||
{
|
||||
index_external = -1;
|
||||
bFilePath = false;
|
||||
bSheetName = false;
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +55,8 @@ BaseObjectPtr DConRef::clone()
|
||||
|
||||
void DConRef::readFields(CFRecord& record)
|
||||
{
|
||||
global_info_ = record.getGlobalWorkbookInfo();
|
||||
|
||||
record >> ref >> cchFile;
|
||||
|
||||
if (cchFile > 1)
|
||||
@ -67,21 +70,109 @@ void DConRef::readFields(CFRecord& record)
|
||||
//self-reference = %x0002 sheet-name
|
||||
|
||||
stFile = stFile_.value();
|
||||
if (stFile.substr(0, 1) == L"\x0001")
|
||||
|
||||
std::wstring sTmp = stFile;
|
||||
|
||||
while(true)
|
||||
{
|
||||
bFilePath = true;
|
||||
stFile = stFile.substr(1);
|
||||
int pos = sTmp.find(L"\x0001");
|
||||
if (pos >= 0)
|
||||
{
|
||||
bFilePath = true;
|
||||
|
||||
path.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0002");
|
||||
if (pos >= 0)
|
||||
{
|
||||
path.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0003");
|
||||
if (pos >= 0)
|
||||
{
|
||||
bFilePath = true;
|
||||
|
||||
path.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (stFile.substr(0, 1) == L"\x0002")
|
||||
int pos = sTmp.find(L"]");
|
||||
if (pos >= 0)
|
||||
{
|
||||
bSheetName = true;
|
||||
stFile = stFile.substr(1);
|
||||
}
|
||||
file_name = sTmp.substr(1, pos - 1);
|
||||
sheet_name = sTmp.substr(pos + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sheet_name = sTmp;
|
||||
}
|
||||
}
|
||||
|
||||
int unused = record.getDataSize() - record.getRdPtr();
|
||||
record.skipNunBytes(unused);
|
||||
}
|
||||
|
||||
void DConRef::check_external()
|
||||
{
|
||||
bool bFound = false;
|
||||
|
||||
for (size_t i = 0; !bFilePath && i < global_info_->sheets_names.size(); i++)
|
||||
{
|
||||
if (global_info_->sheets_names[i] == sheet_name)
|
||||
{
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bFound && (!path.empty() || !file_name.empty()) && bFilePath)
|
||||
{//external sheet
|
||||
std::wstring full_path;
|
||||
if (!path.empty())
|
||||
{
|
||||
full_path = get_external_path();
|
||||
}
|
||||
std::unordered_map<std::wstring, std::wstring>::iterator pFind = global_info_->mapPivotCacheExternal.find(file_name);
|
||||
|
||||
if (pFind == global_info_->mapPivotCacheExternal.end())
|
||||
{
|
||||
index_external = global_info_->mapPivotCacheExternal.size() ;
|
||||
|
||||
global_info_->mapPivotCacheExternal.insert(std::make_pair(file_name, full_path));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pFind->second.empty() && !full_path.empty())
|
||||
{
|
||||
pFind->second = full_path;
|
||||
}
|
||||
index_external = std::distance( global_info_->mapPivotCacheExternal.begin(), pFind) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring DConRef::get_external_path()
|
||||
{
|
||||
if (path.empty() && file_name.empty()) return L"";
|
||||
|
||||
std::wstring result = L"file:///";
|
||||
|
||||
for (size_t i = 0; i < path.size(); i++)
|
||||
{
|
||||
result += L"\\" + path[i];
|
||||
}
|
||||
|
||||
if (!file_name.empty())
|
||||
result += L"\\" + file_name;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -57,9 +57,18 @@ public:
|
||||
unsigned short cchFile;
|
||||
std::wstring stFile;
|
||||
|
||||
bool bFilePath;
|
||||
bool bSheetName;
|
||||
std::vector<std::wstring> path;
|
||||
std::wstring file_name;
|
||||
std::wstring sheet_name;
|
||||
|
||||
int index_external;
|
||||
|
||||
void check_external();
|
||||
private:
|
||||
GlobalWorkbookInfoPtr global_info_;
|
||||
|
||||
std::wstring get_external_path();
|
||||
bool bFilePath;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -65,9 +65,8 @@ void MergeCells::readFields(CFRecord& record)
|
||||
int MergeCells::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
|
||||
for (int i = 0 ; i < rgref.size(); i++)
|
||||
{
|
||||
for (size_t i = 0 ; i < rgref.size(); i++)
|
||||
{
|
||||
Ref8* ref = dynamic_cast<Ref8*>(rgref[i].get());
|
||||
CP_XML_NODE(L"mergeCell")
|
||||
|
||||
@ -86,7 +86,7 @@ int MulRk::serialize(std::wostream & stream)
|
||||
{
|
||||
int row = GetRow();
|
||||
|
||||
for (int i = 0; i < cells.size(); i++)
|
||||
for (size_t i = 0; i < cells.size(); i++)
|
||||
{
|
||||
Cell * cell = dynamic_cast<Cell *>(cells[i].get());
|
||||
RkRec * rkrec = dynamic_cast<RkRec *>(rgrkrec[i].get());
|
||||
|
||||
@ -103,7 +103,7 @@ int Palette::serialize(std::wostream & stream)
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < rgColor.size(); ++i)
|
||||
for(size_t i = 0; i < rgColor.size(); ++i)
|
||||
{
|
||||
LongRGB * rgb = dynamic_cast<LongRGB *>(rgColor[i].get());
|
||||
CP_XML_NODE(L"rgbColor")
|
||||
|
||||
@ -67,7 +67,7 @@ int SIIndex::serialize(std::wostream & _stream, int idx, const CellRef & in_ref)
|
||||
int res = 0;
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
for (int i = 0 ; i < m_arData.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arData.size(); i++)
|
||||
{
|
||||
Number * number = dynamic_cast<Number*> (m_arData[i].get());
|
||||
BoolErr * boolErr = dynamic_cast<BoolErr*>(m_arData[i].get());
|
||||
@ -108,7 +108,7 @@ int SIIndex::serialize(std::wostream & _stream, ChartParsedFormula & in_ref)
|
||||
int idx = 0;
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
for (int i = 0 ; i < m_arData.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arData.size(); i++)
|
||||
{
|
||||
Number * number = dynamic_cast<Number*> (m_arData[i].get());
|
||||
BoolErr * boolErr = dynamic_cast<BoolErr*>(m_arData[i].get());
|
||||
|
||||
@ -83,7 +83,7 @@ int SST::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
for (size_t i=0; i < rgb.size(); i++)
|
||||
for (size_t i = 0; i < rgb.size(); i++)
|
||||
{
|
||||
XLUnicodeRichExtendedString *richText = dynamic_cast<XLUnicodeRichExtendedString *>(rgb[i].get());
|
||||
|
||||
|
||||
@ -101,7 +101,9 @@ BiffStructurePtr SXAddl::createSxcView(CFRecord& record)
|
||||
switch(sxd)
|
||||
{
|
||||
case 0x00: result = BiffStructurePtr(new SXAddl_SXCView_SXDId()); break;
|
||||
case 0x1E: result = BiffStructurePtr(new SXAddl_SXCView_SXDTableStyleClient()); 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;
|
||||
}
|
||||
return result;
|
||||
@ -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
|
||||
|
||||
@ -72,6 +72,20 @@ int SXDI::serialize(std::wostream & strm)
|
||||
CP_XML_ATTR(L"baseField", df);
|
||||
CP_XML_ATTR(L"baseItem", isxvi);
|
||||
CP_XML_ATTR(L"numFmtId", ifmt);
|
||||
switch(iiftab)
|
||||
{
|
||||
case 0x0000: CP_XML_ATTR(L"subtotal", L"sum"); break;
|
||||
case 0x0001: CP_XML_ATTR(L"subtotal", L"count"); break;
|
||||
case 0x0002: CP_XML_ATTR(L"subtotal", L"average"); break;
|
||||
case 0x0003: CP_XML_ATTR(L"subtotal", L"max"); break;
|
||||
case 0x0004: CP_XML_ATTR(L"subtotal", L"min"); break;
|
||||
case 0x0005: CP_XML_ATTR(L"subtotal", L"product"); break;
|
||||
case 0x0006: CP_XML_ATTR(L"subtotal", L"countNums");break;
|
||||
case 0x0007: CP_XML_ATTR(L"subtotal", L"stdDev"); break;
|
||||
case 0x0008: CP_XML_ATTR(L"subtotal", L"stdDevp"); break;
|
||||
case 0x0009: CP_XML_ATTR(L"subtotal", L"var"); break;
|
||||
case 0x000a: CP_XML_ATTR(L"subtotal", L"varp"); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@ -55,6 +55,11 @@ void SXDtr::readFields(CFRecord& record)
|
||||
|
||||
std::wstring SXDtr::value()
|
||||
{
|
||||
if (mon < 1 || mon > 12) mon = 1;
|
||||
if (dom < 1 || dom > 31) dom = 1;
|
||||
|
||||
if (yr < 1) yr = 1; //???
|
||||
|
||||
std::wstringstream s;
|
||||
s << yr << L"-" << (mon < 10 ? L"0" : L"") << mon << L"-" << (dom < 10 ? L"0" : L"") << dom << L"T"
|
||||
<< (hr < 10 ? L"0" : L"") << hr << L":" << (min < 10 ? L"0" : L"") << min << L":" << (sec < 10 ? L"0" : L"") << sec;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -53,15 +53,17 @@ BaseObjectPtr SXTH::clone()
|
||||
void SXTH::readFields(CFRecord& record)
|
||||
{
|
||||
_UINT32 flags1;
|
||||
unsigned short flags2;
|
||||
unsigned short flags2, reserved;
|
||||
|
||||
record >> frtHeaderOld >> flags1 >> sxaxis >> isxvd >> csxvdXl >> flags2;
|
||||
record >> frtHeaderOld >> flags1 >> sxaxis >> reserved >> isxvd >> csxvdXl >> flags2;
|
||||
|
||||
record >> stUnique >> stDisplay >> stDefault >> stAll >> stDimension;
|
||||
|
||||
record >> cisxvd;
|
||||
for (int i = 0; i < cisxvd; i++)
|
||||
{
|
||||
if (record.getRdPtr() + 4 > record.getDataSize())
|
||||
break;
|
||||
_INT32 val;
|
||||
record >> val;
|
||||
rgisxvd.push_back(val);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -38,8 +38,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of Style record in BIFF8
|
||||
class Style: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(Style)
|
||||
@ -49,7 +47,6 @@ public:
|
||||
~Style();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ namespace XLS
|
||||
|
||||
Theme::Theme()
|
||||
{
|
||||
nThemeDataSize = 0;
|
||||
}
|
||||
|
||||
Theme::~Theme()
|
||||
@ -54,16 +55,18 @@ void Theme::readFields(CFRecord& record)
|
||||
{
|
||||
record >> frtHeader >> dwThemeVersion;
|
||||
|
||||
if(!dwThemeVersion)
|
||||
if (dwThemeVersion == 124226)
|
||||
{
|
||||
Log::info("\"Theme\" binary parsing is not implemented.");
|
||||
|
||||
/*
|
||||
std::ofstream file1("D:\\temp.xlsx", std::ios_base::binary);
|
||||
file1.write(record.getCurData<char>(), (record.getDataSize() - record.getRdPtr()));
|
||||
*/
|
||||
//default theme
|
||||
}
|
||||
else if (dwThemeVersion == 0)
|
||||
{
|
||||
nThemeDataSize = record.getDataSize() - record.getRdPtr();
|
||||
pThemeData = boost::shared_array<char>(new char[nThemeDataSize]);
|
||||
|
||||
memcpy(pThemeData.get(), record.getCurData<char>(), nThemeDataSize);
|
||||
record.skipNunBytes(nThemeDataSize);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -54,6 +54,9 @@ public:
|
||||
//-----------------------------
|
||||
_UINT32 dwThemeVersion;
|
||||
FrtHeader frtHeader;
|
||||
|
||||
_UINT32 nThemeDataSize;
|
||||
boost::shared_array<char> pThemeData;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -55,10 +55,11 @@ void XFExt::readFields(CFRecord& record)
|
||||
record >> ixfe;
|
||||
record.skipNunBytes(2); // reserved
|
||||
record >> cexts;
|
||||
|
||||
while(!record.isEOF())
|
||||
{
|
||||
if(record.getRdPtr() + 8 < record.getDataSize())
|
||||
break;// 8 = миним размер структуры
|
||||
if(record.getRdPtr() + 4 > record.getDataSize())
|
||||
break;// миним размер структуры
|
||||
ExtPropPtr element(new ExtProp);
|
||||
record >> *element;
|
||||
rgExt.push_back(element);
|
||||
|
||||
@ -108,63 +108,70 @@ int FillInfo::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"fill")
|
||||
if (!ext.empty())
|
||||
{
|
||||
CP_XML_NODE(L"patternFill")
|
||||
stream << ext;
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_NODE(L"fill")
|
||||
{
|
||||
if (fls < 0 || fls > 18)
|
||||
fls = 1;
|
||||
|
||||
CP_XML_ATTR(L"patternType", PatternType[fls]);
|
||||
|
||||
if (fls > 0)
|
||||
CP_XML_NODE(L"patternFill")
|
||||
{
|
||||
CP_XML_NODE(L"fgColor")
|
||||
{
|
||||
if (foreFillInfo_.enabled)
|
||||
{
|
||||
switch(foreFillInfo_.xclrType)
|
||||
{
|
||||
case 0://auto
|
||||
/*CP_XML_ATTR(L"auto");*/ break;
|
||||
case 1://indexed
|
||||
if (foreFillInfo_.icv < 64)
|
||||
CP_XML_ATTR(L"indexed", foreFillInfo_.icv); break;
|
||||
case 2://rgb
|
||||
CP_XML_ATTR(L"rgb", STR::toARGB(foreFillInfo_.xclrValue)); break;
|
||||
case 3://theme color
|
||||
CP_XML_ATTR(L"theme", foreFillInfo_.xclrValue/* + 1*/);
|
||||
CP_XML_ATTR(L"tint", foreFillInfo_.nTintShade / 32767.0); break;
|
||||
case 4://not set
|
||||
break;
|
||||
}
|
||||
}else
|
||||
CP_XML_ATTR(L"indexed", icvFore);
|
||||
if (fls < 0 || fls > 18)
|
||||
fls = 1;
|
||||
|
||||
}
|
||||
CP_XML_NODE(L"bgColor")
|
||||
CP_XML_ATTR(L"patternType", PatternType[fls]);
|
||||
|
||||
if (fls > 0)
|
||||
{
|
||||
if (backFillInfo_.enabled)
|
||||
CP_XML_NODE(L"fgColor")
|
||||
{
|
||||
switch(backFillInfo_.xclrType)
|
||||
if (foreFillInfo_.enabled)
|
||||
{
|
||||
case 0://auto
|
||||
/*CP_XML_ATTR(L"auto");*/ break;
|
||||
case 1://indexed
|
||||
if (backFillInfo_.icv < 64)
|
||||
CP_XML_ATTR(L"indexed", backFillInfo_.icv); break;
|
||||
case 2://rgb
|
||||
CP_XML_ATTR(L"rgb", STR::toARGB(backFillInfo_.xclrValue)); break;
|
||||
case 3://theme color
|
||||
CP_XML_ATTR(L"theme", backFillInfo_.xclrValue /*+ 1*/);
|
||||
CP_XML_ATTR(L"tint", backFillInfo_.nTintShade / 32767.0); break;
|
||||
case 4://not set
|
||||
break;
|
||||
}
|
||||
switch(foreFillInfo_.xclrType)
|
||||
{
|
||||
case 0://auto
|
||||
/*CP_XML_ATTR(L"auto");*/ break;
|
||||
case 1://indexed
|
||||
if (foreFillInfo_.icv < 64)
|
||||
CP_XML_ATTR(L"indexed", foreFillInfo_.icv); break;
|
||||
case 2://rgb
|
||||
CP_XML_ATTR(L"rgb", STR::toARGB(foreFillInfo_.xclrValue)); break;
|
||||
case 3://theme color
|
||||
CP_XML_ATTR(L"theme", foreFillInfo_.xclrValue/* + 1*/);
|
||||
CP_XML_ATTR(L"tint", foreFillInfo_.nTintShade / 32767.0); break;
|
||||
case 4://not set
|
||||
break;
|
||||
}
|
||||
}else
|
||||
CP_XML_ATTR(L"indexed", icvFore);
|
||||
|
||||
}
|
||||
else
|
||||
CP_XML_ATTR(L"indexed", icvBack);
|
||||
CP_XML_NODE(L"bgColor")
|
||||
{
|
||||
if (backFillInfo_.enabled)
|
||||
{
|
||||
switch(backFillInfo_.xclrType)
|
||||
{
|
||||
case 0://auto
|
||||
/*CP_XML_ATTR(L"auto");*/ break;
|
||||
case 1://indexed
|
||||
if (backFillInfo_.icv < 64)
|
||||
CP_XML_ATTR(L"indexed", backFillInfo_.icv); break;
|
||||
case 2://rgb
|
||||
CP_XML_ATTR(L"rgb", STR::toARGB(backFillInfo_.xclrValue)); break;
|
||||
case 3://theme color
|
||||
CP_XML_ATTR(L"theme", backFillInfo_.xclrValue /*+ 1*/);
|
||||
CP_XML_ATTR(L"tint", backFillInfo_.nTintShade / 32767.0); break;
|
||||
case 4://not set
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
CP_XML_ATTR(L"indexed", icvBack);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ struct FillInfo
|
||||
FillInfoExt foreFillInfo_;
|
||||
FillInfoExt backFillInfo_;
|
||||
|
||||
|
||||
std::wstring ext;
|
||||
};
|
||||
|
||||
struct BorderInfo
|
||||
|
||||
@ -154,7 +154,7 @@ void CellXF::load(CFRecord& record)
|
||||
|
||||
void CellXF::RegisterFillBorder()
|
||||
{
|
||||
for (int i = 0; i < ext_props.size(); i++ )
|
||||
for (size_t i = 0; i < ext_props.size(); i++ )
|
||||
{
|
||||
ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get());
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ void ChartParsedFormula::load(CFRecord& record)
|
||||
|
||||
bool ChartParsedFormula::inRange(const CellRef & ref)
|
||||
{
|
||||
for (int i = 0 ; i < cell_ranges.size(); i++)
|
||||
for (size_t i = 0 ; i < cell_ranges.size(); i++)
|
||||
{
|
||||
if (cell_ranges[i].inRange(ref))
|
||||
{
|
||||
|
||||
@ -62,6 +62,7 @@ void DXFNum::load(CFRecord& record)
|
||||
int DXFNum::serialize(std::wostream & stream)
|
||||
{
|
||||
if (!parent) return 0;
|
||||
if (fmt_id.ifmt == 0) return 0;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
|
||||
@ -46,6 +46,11 @@ BiffStructurePtr ExtProp::clone()
|
||||
void ExtProp::load(CFRecord& record)
|
||||
{
|
||||
record >> extType >> cb;
|
||||
|
||||
if ((int)(cb - 4) > (int)(record.getDataSize() - record.getRdPtr()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch(extType)
|
||||
{
|
||||
case 0x0004:
|
||||
|
||||
@ -78,7 +78,7 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
|
||||
{
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < child_records.size(); i++)
|
||||
for (size_t i = 0 ; i < child_records.size(); i++)
|
||||
{
|
||||
switch(child_records[i]->rh_own.recType)
|
||||
{
|
||||
@ -87,7 +87,7 @@ void OfficeArtDgContainer::loadFields(XLS::CFRecord& record)
|
||||
OfficeArtDgContainer * dg = dynamic_cast<OfficeArtDgContainer *>(child_records[i].get());
|
||||
if (dg)
|
||||
{
|
||||
for (int i = 0 ; i < dg->child_records.size(); i++)
|
||||
for (size_t i = 0 ; i < dg->child_records.size(); i++)
|
||||
{
|
||||
child_records.push_back(dg->child_records[i]);
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ namespace ODRAW
|
||||
//shift for all trailing zeros
|
||||
std::bitset<sizeof(int)*8> bits( mask );
|
||||
|
||||
for ( unsigned int i = 0; i < bits.size(); i++ )
|
||||
for ( size_t i = 0; i < bits.size(); i++ )
|
||||
{
|
||||
if ( !bits[i] )
|
||||
{
|
||||
|
||||
@ -73,7 +73,7 @@ void OfficeArtDggContainer::loadFields(XLS::CFRecord& record)
|
||||
{
|
||||
OfficeArtContainer::loadFields(record);
|
||||
|
||||
for (int i = 0 ; i < child_records.size(); i++)
|
||||
for (size_t i = 0 ; i < child_records.size(); i++)
|
||||
{
|
||||
switch(child_records[i]->rh_own.recType)
|
||||
{
|
||||
@ -111,7 +111,7 @@ void OfficeArtSpgrContainer::loadFields(XLS::CFRecord& record)
|
||||
{
|
||||
OfficeArtContainer::loadFields(record);
|
||||
|
||||
//for (int i = 0 ; i < child_records.size(); i++)
|
||||
//for (size_t i = 0 ; i < child_records.size(); i++)
|
||||
//{
|
||||
// switch(child_records[i]->rh_own.recType)
|
||||
// {
|
||||
@ -128,7 +128,7 @@ void OfficeArtSpContainer::loadFields(XLS::CFRecord& record)
|
||||
{
|
||||
OfficeArtContainer::loadFields(record);
|
||||
|
||||
for (int i = 0 ; i < child_records.size(); i++)
|
||||
for (size_t i = 0 ; i < child_records.size(); i++)
|
||||
{
|
||||
switch(child_records[i]->rh_own.recType)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -31,7 +31,9 @@
|
||||
*/
|
||||
|
||||
#include "StyleXF.h"
|
||||
#include "XFProps.h"
|
||||
#include "ExtProp.h"
|
||||
|
||||
#include <Binary/CFRecord.h>
|
||||
|
||||
namespace XLS
|
||||
@ -139,85 +141,100 @@ void StyleXF::load(CFRecord& record)
|
||||
fill.icvFore = GETBITS(flags4, 0, 6);
|
||||
fill.icvBack = GETBITS(flags4, 7, 13);
|
||||
}
|
||||
|
||||
}
|
||||
void StyleXF::Update(ExtProp* ext_prop)
|
||||
{
|
||||
if (!ext_prop) return;
|
||||
|
||||
switch(ext_prop->extType)
|
||||
{
|
||||
case 0x0004:
|
||||
{
|
||||
fill.foreFillInfo_.enabled = true;
|
||||
fill.foreFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
fill.foreFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
fill.foreFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
fill.foreFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0005:
|
||||
{
|
||||
fill.backFillInfo_.enabled = true;
|
||||
fill.backFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
fill.backFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
fill.backFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
fill.backFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0007:
|
||||
{
|
||||
border.topFillInfo_.enabled = true;
|
||||
border.topFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.topFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.topFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.topFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0008:
|
||||
{
|
||||
border.bottomFillInfo_.enabled = true;
|
||||
border.bottomFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.bottomFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.bottomFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.bottomFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0009:
|
||||
{
|
||||
border.leftFillInfo_.enabled = true;
|
||||
border.leftFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.leftFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.leftFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.leftFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x000A:
|
||||
{
|
||||
border.rightFillInfo_.enabled = true;
|
||||
border.rightFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.rightFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.rightFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.rightFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
//case 0x000B: //diag color
|
||||
//case 0x000C: //diag color
|
||||
case 0x000D:
|
||||
{
|
||||
font_color.enabled = true;
|
||||
font_color.icv = ext_prop->extPropData.color.icv;
|
||||
font_color.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
font_color.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
font_color.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
//case 0x0006:
|
||||
// extPropData.gradient_fill.toXML(own_tag);
|
||||
// break;
|
||||
case 0x000E:
|
||||
{
|
||||
font_id = ext_prop->extPropData.font_scheme;
|
||||
}break;
|
||||
case 0x000F:
|
||||
{
|
||||
cIndent = ext_prop->extPropData.indent_level;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
void StyleXF::Update(XFProps* xfProps)
|
||||
{
|
||||
if (!xfProps) return;
|
||||
|
||||
std::wstringstream strm;
|
||||
xfProps->serialize_fill(strm);
|
||||
fill.ext = strm.str();
|
||||
}
|
||||
void StyleXF::RegisterFillBorder()
|
||||
{
|
||||
for (int i = 0; i < ext_props.size(); i++ )
|
||||
for (size_t i = 0; i < ext_props.size(); i++ )
|
||||
{
|
||||
ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get());
|
||||
Update (ext_prop);
|
||||
}
|
||||
|
||||
switch(ext_prop->extType)
|
||||
{
|
||||
case 0x0004:
|
||||
{
|
||||
fill.foreFillInfo_.enabled = true;
|
||||
fill.foreFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
fill.foreFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
fill.foreFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
fill.foreFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0005:
|
||||
{
|
||||
fill.backFillInfo_.enabled = true;
|
||||
fill.backFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
fill.backFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
fill.backFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
fill.backFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0007:
|
||||
{
|
||||
border.topFillInfo_.enabled = true;
|
||||
border.topFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.topFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.topFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.topFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0008:
|
||||
{
|
||||
border.bottomFillInfo_.enabled = true;
|
||||
border.bottomFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.bottomFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.bottomFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.bottomFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x0009:
|
||||
{
|
||||
border.leftFillInfo_.enabled = true;
|
||||
border.leftFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.leftFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.leftFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.leftFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
case 0x000A:
|
||||
{
|
||||
border.rightFillInfo_.enabled = true;
|
||||
border.rightFillInfo_.icv = ext_prop->extPropData.color.icv;
|
||||
border.rightFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
border.rightFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
border.rightFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
}break;
|
||||
//case 0x000B: //diag color
|
||||
//case 0x000C: //diag color
|
||||
case 0x000D:
|
||||
font_color.enabled = true;
|
||||
font_color.icv = ext_prop->extPropData.color.icv;
|
||||
font_color.xclrType = ext_prop->extPropData.color.xclrType;
|
||||
font_color.nTintShade = ext_prop->extPropData.color.nTintShade;
|
||||
font_color.xclrValue = ext_prop->extPropData.color.xclrValue;
|
||||
break;
|
||||
//case 0x0006:
|
||||
// extPropData.gradient_fill.toXML(own_tag);
|
||||
// break;
|
||||
case 0x000E:
|
||||
font_id = ext_prop->extPropData.font_scheme;
|
||||
break;
|
||||
case 0x000F:
|
||||
cIndent = ext_prop->extPropData.indent_level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border);
|
||||
fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill);
|
||||
|
||||
|
||||
@ -36,8 +36,10 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class XFProps;
|
||||
class ExtProp;
|
||||
class CFRecord;
|
||||
|
||||
class GlobalWorkbookInfo;
|
||||
typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr;
|
||||
|
||||
@ -50,13 +52,15 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
GlobalWorkbookInfoPtr m_GlobalWorkbookInfo;
|
||||
|
||||
static const ElementType type = typeStyleXF;
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
void Update(ExtProp* extProp); // xls style
|
||||
void Update(XFProps* xfProps); //xlsx style
|
||||
|
||||
void RegisterFillBorder();
|
||||
|
||||
unsigned char alc;
|
||||
|
||||
@ -70,12 +70,13 @@ int XFPropColor::serialize(std::wostream & stream)
|
||||
{
|
||||
case 0: CP_XML_ATTR(L"auto", 1); break;
|
||||
case 1: CP_XML_ATTR(L"indexed", icv); break;
|
||||
case 2: CP_XML_ATTR(L"rgb", dwRgba.strRGB); break;
|
||||
case 3: CP_XML_ATTR(L"theme", icv); break;
|
||||
case 2:
|
||||
case 3: CP_XML_ATTR(L"rgb", dwRgba.strRGB); break;
|
||||
//CP_XML_ATTR(L"theme", icv); break;
|
||||
}
|
||||
if (nTintShade != 0)
|
||||
{
|
||||
CP_XML_ATTR(L"tint", nTintShade);
|
||||
CP_XML_ATTR(L"tint", nTintShade/ 32767.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,15 +110,68 @@ void XFProps::load(CFRecord& record)
|
||||
}
|
||||
}
|
||||
}
|
||||
int XFProps::serialize(std::wostream & stream, bool dxf)
|
||||
|
||||
int XFProps::serialize_fill(std::wostream & stream)
|
||||
{
|
||||
if (arXFPropFill.empty()) return 0;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
XFProp *pPatternType = NULL;
|
||||
XFPropGradient *pGradient = NULL;
|
||||
|
||||
for (size_t i = 0; i < arXFPropFill.size(); i++)
|
||||
{
|
||||
switch(arXFPropFill[i].xfPropType)
|
||||
{
|
||||
case 1:
|
||||
case 0: pPatternType = &arXFPropFill[i]; break;
|
||||
case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i].xfPropDataBlob.get()); break;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"fill")
|
||||
{
|
||||
if (pGradient || arXFPropGradient.size() > 0)
|
||||
{
|
||||
CP_XML_NODE(L"gradientFill")
|
||||
{
|
||||
if (pGradient)
|
||||
pGradient->serialize_attr(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0 ; i < arXFPropGradient.size(); i++)
|
||||
{
|
||||
if (arXFPropGradient[i].xfPropDataBlob == NULL) continue;
|
||||
arXFPropGradient[i].xfPropDataBlob->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pPatternType)
|
||||
{
|
||||
CP_XML_NODE(L"patternFill")
|
||||
{
|
||||
pPatternType->serialize_attr(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0; i < arXFPropFill.size(); i++)
|
||||
{
|
||||
arXFPropFill[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XFProps::serialize(std::wostream & strm, bool dxf)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (arXFPropFont.size() > 0)
|
||||
{
|
||||
CP_XML_NODE(L"font")
|
||||
{
|
||||
for (int i = 0; i < arXFPropFont.size(); i++)
|
||||
for (size_t i = 0; i < arXFPropFont.size(); i++)
|
||||
{
|
||||
arXFPropFont[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -128,7 +181,7 @@ int XFProps::serialize(std::wostream & stream, bool dxf)
|
||||
{
|
||||
CP_XML_NODE(L"numFmt")
|
||||
{
|
||||
for (int i = 0; i < arXFPropNumFmt.size(); i++)
|
||||
for (size_t i = 0; i < arXFPropNumFmt.size(); i++)
|
||||
{
|
||||
if (dxf)
|
||||
{
|
||||
@ -141,54 +194,13 @@ int XFProps::serialize(std::wostream & stream, bool dxf)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (arXFPropFill.size() > 0)
|
||||
{
|
||||
XFProp pPatternType;
|
||||
XFPropGradient *pGradient = NULL;
|
||||
serialize_fill(strm);
|
||||
|
||||
for (int i = 0; i < arXFPropFill.size(); i++)
|
||||
{
|
||||
switch(arXFPropFill[i].xfPropType)
|
||||
{
|
||||
case 0: pPatternType = arXFPropFill[i]; break;
|
||||
case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i].xfPropDataBlob.get()); break;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"fill")
|
||||
{
|
||||
if (pGradient || arXFPropGradient.size()>0)
|
||||
{
|
||||
CP_XML_NODE(L"gradientFill")
|
||||
{
|
||||
if (pGradient)
|
||||
pGradient->serialize_attr(CP_GET_XML_NODE());
|
||||
|
||||
for (int i = 0 ; i < arXFPropGradient.size(); i++)
|
||||
{
|
||||
if (arXFPropGradient[i].xfPropDataBlob == NULL) continue;
|
||||
arXFPropGradient[i].xfPropDataBlob->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_NODE(L"patternFill")
|
||||
{
|
||||
pPatternType.serialize_attr(CP_GET_XML_NODE());
|
||||
|
||||
for (int i = 0; i < arXFPropFill.size(); i++)
|
||||
{
|
||||
arXFPropFill[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (arXFPropAlignment.size() > 0)
|
||||
{
|
||||
CP_XML_NODE(L"alignment")
|
||||
{
|
||||
for (int i = 0; i < arXFPropAlignment.size(); i++)
|
||||
for (size_t i = 0; i < arXFPropAlignment.size(); i++)
|
||||
{
|
||||
arXFPropAlignment[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -205,7 +217,7 @@ int XFProps::serialize(std::wostream & stream, bool dxf)
|
||||
if (arXFPropBorder.bottom) arXFPropBorder.bottom->serialize(CP_XML_STREAM());
|
||||
|
||||
//----------------------------------------
|
||||
for (int i = 0; i < arXFPropBorder.other.size(); i++)
|
||||
for (size_t i = 0; i < arXFPropBorder.other.size(); i++)
|
||||
{
|
||||
arXFPropBorder.other[i].serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include "../Biff_structures/XFProp.h"
|
||||
#include "XFProp.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -47,13 +47,14 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
static const ElementType type = typeXFProps;
|
||||
|
||||
unsigned short cprops;
|
||||
|
||||
int serialize(std::wostream & stream){ return serialize(stream, false) ; }
|
||||
int serialize(std::wostream & stream, bool dxf);
|
||||
|
||||
int serialize_fill(std::wostream & stream);
|
||||
|
||||
std::vector<XFProp> arXFPropFont;
|
||||
std::vector<XFProp> arXFPropNumFmt;
|
||||
|
||||
@ -112,7 +112,7 @@ int XLUnicodeRichExtendedString::serialize (std::wostream & _stream)
|
||||
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
for (int i = 0 ; i < rgRun.size(); i++)
|
||||
for (size_t i = 0 ; i < rgRun.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"r")
|
||||
{
|
||||
|
||||
@ -116,7 +116,7 @@ const bool AUTOFILTER::loadContent(BinProcessor& proc)
|
||||
std::vector<BaseObjectPtr> ar;
|
||||
ar.push_back(elements_.back());
|
||||
|
||||
m_mapFilters12.insert(std::pair<int, std::vector<BaseObjectPtr>>(ind, ar));
|
||||
m_mapFilters12.insert(std::make_pair(ind, ar));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,7 +187,7 @@ int AUTOFILTER::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_ATTR(L"ref", ref);
|
||||
|
||||
for (int i = 0 ; i < m_arFilters.size(); i++)//todooo сделать на оставшиеся - count_columns (hidden)
|
||||
for (size_t i = 0 ; i < m_arFilters.size(); i++)//todooo сделать на оставшиеся - count_columns (hidden)
|
||||
{
|
||||
AutoFilter * filter = dynamic_cast<AutoFilter*>(m_arFilters[i].get());
|
||||
CP_XML_NODE(L"filterColumn")
|
||||
@ -214,12 +214,12 @@ int AUTOFILTER::serialize(std::wostream & stream)
|
||||
std::map<int, std::vector<BaseObjectPtr>>::iterator itF = m_mapFilters12.find(filter->iEntry);
|
||||
if (itF != m_mapFilters12.end())
|
||||
{
|
||||
for (int j = 0 ; j < itF->second.size(); j++)
|
||||
for (size_t j = 0 ; j < itF->second.size(); j++)
|
||||
{
|
||||
AutoFilter12* af12 = dynamic_cast<AutoFilter12*>(itF->second[j].get());
|
||||
if (af12 == NULL) continue;
|
||||
|
||||
for (int k = 0 ; k < af12->rgbAF12Criteries.size(); k++)
|
||||
for (size_t k = 0 ; k < af12->rgbAF12Criteries.size(); k++)
|
||||
{
|
||||
AF12Criteria * af12Criteria = dynamic_cast<AF12Criteria *>(af12->rgbAF12Criteries[k].get());
|
||||
if (af12Criteria == NULL) continue;
|
||||
|
||||
@ -225,7 +225,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary)
|
||||
{
|
||||
CatSerRange * iv_CatSerRange = NULL;
|
||||
|
||||
for (int i = 0 ; i < m_arAxes.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arAxes.size(); i++)
|
||||
{
|
||||
IVAXIS * iv = dynamic_cast<IVAXIS*> (m_arAxes[i].get());
|
||||
if (iv)
|
||||
@ -237,7 +237,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary)
|
||||
}
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
for (int i = 0 ; i < m_arAxes.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arAxes.size(); i++)
|
||||
{
|
||||
IVAXIS * iv = dynamic_cast<IVAXIS*> (m_arAxes[i].get());
|
||||
DVAXIS * dv = dynamic_cast<DVAXIS*> (m_arAxes[i].get());
|
||||
@ -263,7 +263,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary)
|
||||
CP_XML_NODE(node_ax_type)
|
||||
{
|
||||
ATTACHEDLABEL *label = NULL;
|
||||
for ( int h = 0 ; h < m_arATTACHEDLABEL.size(); h++)
|
||||
for ( size_t h = 0 ; h < m_arATTACHEDLABEL.size(); h++)
|
||||
{
|
||||
ATTACHEDLABEL *l_= dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[h].get() );
|
||||
|
||||
@ -309,7 +309,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary)
|
||||
// }
|
||||
//}
|
||||
|
||||
for (int j = 0 ; j < m_arAxesId.size(); j++)
|
||||
for (size_t j = 0 ; j < m_arAxesId.size(); j++)
|
||||
{
|
||||
if (m_arAxesId[j].first != m_arAxesId[i].first && m_arAxesId[j].second != 3)
|
||||
{
|
||||
|
||||
@ -104,7 +104,7 @@ void AXISPARENT::concatinate_second (BaseObjectPtr & addit)
|
||||
|
||||
if (second == NULL) return;
|
||||
|
||||
for (int i = 0; i < second->m_arCRT.size(); i++)
|
||||
for (size_t i = 0; i < second->m_arCRT.size(); i++)
|
||||
{
|
||||
CRT* crt = dynamic_cast<CRT*>(second->m_arCRT[i].get());
|
||||
crt->m_indAXISPARENT = 1;
|
||||
|
||||
@ -161,7 +161,7 @@ int AXS::serialize(std::wostream & _stream)
|
||||
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
for (int i = 0 ; i < m_AxisLine_Format.size(); i++)
|
||||
for (size_t i = 0 ; i < m_AxisLine_Format.size(); i++)
|
||||
{
|
||||
std::wstring grid;
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ public:
|
||||
{
|
||||
if (row->miyRw > 0 && std::abs(row->miyRw/20. - sheet_info.defaultRowHeight) > 0.001)
|
||||
{
|
||||
sheet_info.customRowsHeight.insert(std::pair<int, double>(row->rw, row->miyRw / 20.));
|
||||
sheet_info.customRowsHeight.insert(std::make_pair(row->rw, row->miyRw / 20.));
|
||||
}
|
||||
}
|
||||
m_rows.push_back(elements_.front());
|
||||
@ -102,7 +102,7 @@ public:
|
||||
{
|
||||
std::list<BaseObjectPtr> c;
|
||||
c.push_back(elements_.front());
|
||||
m_cells.insert(std::pair<int, std::list<BaseObjectPtr>>(cell->RowNumber, c));
|
||||
m_cells.insert(std::make_pair(cell->RowNumber, c));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -283,7 +283,7 @@ const bool CHARTFORMATS::loadContent(BinProcessor& proc)
|
||||
}
|
||||
BaseObjectPtr CHARTFORMATS::find_label( _UINT16 link_id, unsigned short ex)
|
||||
{
|
||||
for (int i = 0 ; i < m_arATTACHEDLABEL.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arATTACHEDLABEL.size(); i++)
|
||||
{
|
||||
ATTACHEDLABEL * label = dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[i].get());
|
||||
ObjectLink * obj_link = dynamic_cast<ObjectLink *> (label->m_ObjectLink.get());
|
||||
@ -306,7 +306,7 @@ std::vector<std::pair<int, BaseObjectPtr>> CHARTFORMATS::find_labels( _UINT16 li
|
||||
{
|
||||
std::vector<std::pair<int, BaseObjectPtr>> result;
|
||||
|
||||
for (int i = 0 ; i < m_arATTACHEDLABEL.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arATTACHEDLABEL.size(); i++)
|
||||
{
|
||||
ATTACHEDLABEL * label = dynamic_cast<ATTACHEDLABEL *> (m_arATTACHEDLABEL[i].get());
|
||||
ObjectLink * obj_link = dynamic_cast<ObjectLink *> (label->m_ObjectLink.get());
|
||||
|
||||
@ -77,10 +77,10 @@ const bool COLUMNS::loadContent(BinProcessor& proc)
|
||||
|
||||
for (int i = column_info->colFirst; i <= column_info->colLast; i++)
|
||||
{
|
||||
global_info_->sheet_size_info.back().customColumnsWidth.insert(std::pair<int, double>(i, column_info->coldx / 256.));
|
||||
global_info_->sheet_size_info.back().customColumnsWidth.insert(std::make_pair(i, column_info->coldx / 256.));
|
||||
//else if (def_ok)
|
||||
//{
|
||||
// global_info_->sheet_size_info.back().customColumnsWidth.insert(std::pair<int, double>(i, global_info_->sheet_size_info.back().defaultColumnWidth));
|
||||
// global_info_->sheet_size_info.back().customColumnsWidth.insert(std::make_pair(i, global_info_->sheet_size_info.back().defaultColumnWidth));
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ int CONDFMT12::serialize(std::wostream & stream)
|
||||
CP_XML_ATTR(L"sqref", condFmt->mainCF.sqref.strValue);
|
||||
//condition_id
|
||||
//condition_pos
|
||||
for (int i = 0; i < m_arCF12.size(); i++)
|
||||
for (size_t i = 0; i < m_arCF12.size(); i++)
|
||||
{
|
||||
if (m_arCF12[i] == NULL) continue;
|
||||
m_arCF12[i]->serialize(CP_XML_STREAM());
|
||||
|
||||
@ -120,7 +120,7 @@ const bool CONDFMTS::loadContent(BinProcessor& proc)
|
||||
count--;
|
||||
}
|
||||
|
||||
for (int i = 0 ; i < m_arCFEx.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arCFEx.size(); i++)
|
||||
{
|
||||
if (!m_arCFEx[i]) continue;
|
||||
|
||||
@ -129,7 +129,7 @@ const bool CONDFMTS::loadContent(BinProcessor& proc)
|
||||
{
|
||||
int ind_cf = cfEx->content.icf;
|
||||
|
||||
for (int j = 0 ; j < m_arCONDFMT.size(); j++)
|
||||
for (size_t j = 0 ; j < m_arCONDFMT.size(); j++)
|
||||
{
|
||||
CONDFMT * CONDFMT_ = dynamic_cast<CONDFMT *>(m_arCONDFMT[j].get());
|
||||
if (CONDFMT_/* && cfEx->fIsCF12 == 0*/)
|
||||
@ -166,7 +166,7 @@ int CONDFMTS::serialize(std::wostream & stream)
|
||||
{
|
||||
if (m_arCONDFMT.empty()) return 0;
|
||||
|
||||
for (int i = 0 ; i < m_arCONDFMT.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arCONDFMT.size(); i++)
|
||||
{
|
||||
if (!m_arCONDFMT[i]) continue;
|
||||
m_arCONDFMT[i]->serialize(stream);
|
||||
|
||||
@ -112,7 +112,7 @@ int CONDFMT::serialize(std::wostream & stream)
|
||||
CP_XML_ATTR(L"sqref", condFmt->sqref.strValue);
|
||||
//condition_id
|
||||
//condition_pos
|
||||
for (int i = 0; i < m_arCF.size(); i++)
|
||||
for (size_t i = 0; i < m_arCF.size(); i++)
|
||||
{
|
||||
if (m_arCF[i] == NULL) continue;
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@ int CUSTOMVIEW::serialize(std::wostream & stream)
|
||||
else
|
||||
CP_XML_ATTR(L"state", L"split");
|
||||
}
|
||||
for (int i = 0; i < m_arSelection.size(); i++)
|
||||
for (size_t i = 0; i < m_arSelection.size(); i++)
|
||||
{
|
||||
if (m_arSelection[i] == NULL) continue;
|
||||
m_arSelection[i]->serialize(CP_XML_STREAM());
|
||||
|
||||
@ -31,9 +31,9 @@
|
||||
*/
|
||||
|
||||
#include "DREF.h"
|
||||
#include <Logic/Biff_records/DConName.h>
|
||||
#include <Logic/Biff_records/DConBin.h>
|
||||
#include <Logic/Biff_records/DConRef.h>
|
||||
#include "../Biff_records/DConName.h"
|
||||
#include "../Biff_records/DConBin.h"
|
||||
#include "../Biff_records/DConRef.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -116,11 +116,18 @@ int DREF::serialize(std::wostream & strm)
|
||||
}
|
||||
else if(ref)
|
||||
{
|
||||
ref->check_external();
|
||||
|
||||
CP_XML_ATTR(L"type", L"worksheet");
|
||||
CP_XML_NODE(L"worksheetSource")
|
||||
{
|
||||
CP_XML_ATTR(L"ref", ref->ref.toString());
|
||||
CP_XML_ATTR(L"sheet", ref->stFile);
|
||||
CP_XML_ATTR(L"sheet", ref->sheet_name);
|
||||
|
||||
if (ref->index_external >= 0)
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", L"extId" + std::to_wstring(ref->index_external + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Logic/CompositeObject.h>
|
||||
#include "../CompositeObject.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -88,7 +88,7 @@ int DVAL::serialize(std::wostream & stream)
|
||||
|
||||
DVal * dval = dynamic_cast<DVal*>(m_DVal.get());
|
||||
|
||||
for (int i = 0 ; i < m_arDv.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arDv.size(); i++)
|
||||
{
|
||||
if (!m_arDv[i]) continue;
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ const bool FDB::loadContent(BinProcessor& proc)
|
||||
return true;
|
||||
}
|
||||
|
||||
int FDB::serialize(std::wostream & strm, bool bSql)
|
||||
int FDB::serialize(std::wostream & strm, bool bSql, bool bDBB)
|
||||
{
|
||||
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
|
||||
SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get());
|
||||
@ -227,7 +227,7 @@ int FDB::serialize(std::wostream & strm, bool bSql)
|
||||
Formula->serialize_attr(CP_GET_XML_NODE());
|
||||
}
|
||||
|
||||
if (m_arSRCSXOPER.empty() == false)
|
||||
if (!m_arSRCSXOPER.empty() && (bDBB || (!bDBB && bSql) || !m_arGRPSXOPER.empty()) )
|
||||
{
|
||||
CP_XML_NODE(L"sharedItems")
|
||||
{
|
||||
@ -250,17 +250,26 @@ int FDB::serialize(std::wostream & strm, bool bSql)
|
||||
// }
|
||||
//}
|
||||
|
||||
if ((bDate & bNumber) || (bNumber & bString))
|
||||
if ((bDate & bNumber)/* || (bNumber & bString & !bEmpty & !bInteger)*/)
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 1);
|
||||
}
|
||||
else if (bDate & bString)
|
||||
else if ((bString && bDate) ||
|
||||
(bString && (bNumber || bInteger)) ||
|
||||
(!bString && bDate && bEmpty && (bNumber || bInteger)))
|
||||
{
|
||||
CP_XML_ATTR(L"containsMixedTypes", 1);
|
||||
|
||||
if (bString && !bNumber && bInteger) bNumber = true;
|
||||
else if (bString && bNumber && bInteger) bInteger = false;
|
||||
}
|
||||
else if (!bEmpty && !bString && !bBool)
|
||||
{
|
||||
CP_XML_ATTR(L"containsSemiMixedTypes", 0);
|
||||
if (bDate && (bNumber || bInteger))
|
||||
{
|
||||
CP_XML_ATTR(L"containsMixedTypes", 1);
|
||||
}
|
||||
}
|
||||
if (bDate && ! (bNumber || bInteger || bString || bEmpty ))
|
||||
{
|
||||
@ -311,7 +320,7 @@ int FDB::serialize(std::wostream & strm, bool bSql)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_arGRPSXOPER.empty() == false)
|
||||
if (!m_arGRPSXOPER.empty())
|
||||
{
|
||||
CP_XML_NODE(L"fieldGroup")
|
||||
{
|
||||
@ -341,5 +350,25 @@ int FDB::serialize(std::wostream & strm, bool bSql)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FDB::serialize_record(std::wostream & strm)
|
||||
{
|
||||
SXFDB* fdb = dynamic_cast<SXFDB*>(m_SXFDB.get());
|
||||
SXFDBType* fdb_type = dynamic_cast<SXFDBType*>(m_SXFDBType.get());
|
||||
|
||||
if (!fdb || !fdb_type) return 0;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"r")
|
||||
{
|
||||
for (size_t i = 0; i < m_arSRCSXOPER.size(); i++)
|
||||
{
|
||||
SXOPER* oper = dynamic_cast<SXOPER*>(m_arSRCSXOPER[i].get());
|
||||
oper->serialize_record(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -47,7 +47,8 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
int serialize(std::wostream & strm, bool bSql);
|
||||
int serialize(std::wostream & strm, bool bSql, bool bDBB);
|
||||
int serialize_record(std::wostream & strm);
|
||||
|
||||
static const ElementType type = typeFDB;
|
||||
|
||||
|
||||
@ -31,18 +31,22 @@
|
||||
*/
|
||||
|
||||
#include "FORMATTING.h"
|
||||
#include <Logic/Biff_records/Font.h>
|
||||
#include <Logic/Biff_records/Format.h>
|
||||
#include <Logic/Biff_records/DXF.h>
|
||||
#include <Logic/Biff_unions/STYLES.h>
|
||||
#include <Logic/Biff_records/Palette.h>
|
||||
#include <Logic/Biff_records/ClrtClient.h>
|
||||
#include <Logic/Biff_records/TableStyles.h>
|
||||
#include <Logic/Biff_records/Compat12.h>
|
||||
#include <Logic/Biff_unions/TABLESTYLES.h>
|
||||
#include <Logic/Biff_unions/XFS.h>
|
||||
#include <Logic/Biff_unions/THEME.h>
|
||||
#include "TABLESTYLES.h"
|
||||
#include "XFS.h"
|
||||
#include "THEME.h"
|
||||
#include "STYLES.h"
|
||||
|
||||
#include "../Biff_records/XF.h"
|
||||
#include "../Biff_records/Font.h"
|
||||
#include "../Biff_records/Format.h"
|
||||
#include "../Biff_records/DXF.h"
|
||||
#include "../Biff_records/Palette.h"
|
||||
#include "../Biff_records/ClrtClient.h"
|
||||
#include "../Biff_records/TableStyles.h"
|
||||
#include "../Biff_records/Compat12.h"
|
||||
|
||||
#include "../Biff_records/Style.h"
|
||||
#include "../Biff_records/StyleExt.h"
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -141,9 +145,53 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
update_xfs();
|
||||
|
||||
return true;
|
||||
}
|
||||
void FORMATTING::update_xfs()
|
||||
{
|
||||
STYLES * st = dynamic_cast<STYLES*>(m_Styles.get());
|
||||
XFS * xfs = dynamic_cast<XFS*>(m_XFS.get());
|
||||
|
||||
if (!xfs) return;
|
||||
|
||||
//for (size_t i = 0; (st) && (i < st->m_arStyles.size()); i++)
|
||||
//{
|
||||
// XLS::Style * style = dynamic_cast<Style*>(st->m_arStyles[i].first.get());
|
||||
// XLS::StyleExt * styleExt = dynamic_cast<StyleExt*>(st->m_arStyles[i].second.get());
|
||||
//
|
||||
// if (styleExt && style)
|
||||
// {
|
||||
// if (styleExt->fBuiltIn && styleExt->xfProps.cprops > 0)
|
||||
// {
|
||||
// bool bFound = false;
|
||||
// for (size_t i = 0; i < xfs->m_arCellStyles.size(); i++)
|
||||
// {
|
||||
// XF* xf = dynamic_cast<XF*>(xfs->m_arCellStyles[i].get());
|
||||
|
||||
// if (xf->ind_xf == style->ixfe)
|
||||
// {
|
||||
// xf->style.Update(&styleExt->xfProps);
|
||||
// bFound = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// //for (size_t i = 0; !bFound && i < xfs->m_arCellXFs.size(); i++)
|
||||
// //{
|
||||
// // XF* xf = dynamic_cast<XF*>(xfs->m_arCellXFs[i].get());
|
||||
// // if (xf->ind_xf == style->ixfe)
|
||||
// // {
|
||||
// // xf->cell.Update(&styleExt->xfProps);
|
||||
// // bFound = true;
|
||||
// // break;
|
||||
// // }
|
||||
// //}
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
xfs->RegisterFillBorder();
|
||||
}
|
||||
void FORMATTING::concatinate(FORMATTING* ext)
|
||||
{
|
||||
if (ext->m_XFS)
|
||||
@ -180,7 +228,7 @@ int FORMATTING::serialize1(std::wostream & stream)
|
||||
CP_XML_NODE(L"numFmts")
|
||||
{
|
||||
CP_XML_ATTR(L"count", m_arFormats.size());
|
||||
for (int i = 0 ; i < m_arFormats.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arFormats.size(); i++)
|
||||
{
|
||||
m_arFormats[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -191,7 +239,7 @@ int FORMATTING::serialize1(std::wostream & stream)
|
||||
CP_XML_NODE(L"fonts")
|
||||
{
|
||||
CP_XML_ATTR(L"count", m_arFonts.size());
|
||||
for (int i = 0 ; i < m_arFonts.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arFonts.size(); i++)
|
||||
{
|
||||
Font * font = dynamic_cast<Font*>(m_arFonts[i].get());
|
||||
std::map<int, FillInfoExt>::iterator it = global_info->fonts_color_ext.find(i);
|
||||
@ -225,7 +273,7 @@ int FORMATTING::serialize2(std::wostream & stream)
|
||||
{
|
||||
CP_XML_ATTR(L"count", global_info->cellStyleDxfs_count);
|
||||
|
||||
for (int i = 0 ; i < m_arDXF.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arDXF.size(); i++)
|
||||
{
|
||||
m_arDXF[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ public:
|
||||
int serialize2(std::wostream & stream);
|
||||
|
||||
void concatinate(FORMATTING* ext);
|
||||
void update_xfs();
|
||||
|
||||
static const ElementType type = typeFORMATTING;
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ const bool FORMULA::loadContent(BinProcessor& proc)
|
||||
|
||||
if ((formula) && (formula->fShrFmla))
|
||||
{
|
||||
for (int i = 0; i < shared_formulas_locations_ref_.size(); i++)
|
||||
for (size_t i = 0; i < shared_formulas_locations_ref_.size(); i++)
|
||||
{
|
||||
if (shared_formulas_locations_ref_[i].inRange(location)) m_sharedIndex = i;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ const bool LBL::loadContent(BinProcessor& proc)
|
||||
ar[ind_sheet] = value;
|
||||
//ar.push_back(value);
|
||||
|
||||
global_info_->mapDefineNames.insert(std::pair<std::wstring, std::vector<std::wstring>>(name, ar));
|
||||
global_info_->mapDefineNames.insert(std::make_pair(name, ar));
|
||||
}
|
||||
isSerialize = true;
|
||||
}
|
||||
@ -151,7 +151,7 @@ int LBL::serialize(std::wostream & stream)
|
||||
|
||||
if ((lbl->itab == 0) && (res = value.find(L"#REF!")) >= 0)
|
||||
{
|
||||
for (int i = 0 ; i < lbl->rgce.rgce.sequence.size(); i++)
|
||||
for (size_t i = 0 ; i < lbl->rgce.rgce.sequence.size(); i++)
|
||||
{
|
||||
PtgRef3d* ptg = dynamic_cast<PtgRef3d*>(lbl->rgce.rgce.sequence[i].get());
|
||||
if (ptg)
|
||||
|
||||
@ -78,12 +78,25 @@ 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>())
|
||||
//{
|
||||
// return false;
|
||||
|
||||
@ -98,8 +98,8 @@ 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;
|
||||
|
||||
@ -111,7 +111,15 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
|
||||
|
||||
if (!db || !db_ex)return 0;
|
||||
|
||||
bool bSql = false;
|
||||
if (pivot_cache->m_arFDB.empty() && pivot_cache->m_arSXFORMULA.empty())
|
||||
{
|
||||
global_info_->mapPivotCacheStream.erase(pFind);
|
||||
return 0;
|
||||
}
|
||||
global_info_->mapPivotCacheIndex.insert(std::make_pair(global_info_->idPivotCache, global_info_->mapPivotCacheIndex.size()));
|
||||
|
||||
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
|
||||
bool bSql = src ? src->bSql : false;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -120,27 +128,25 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
if (pivot_cache->m_arDBB.empty() == false)
|
||||
if (pivot_cache->m_arDBB.empty() && bSql)
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", L"rId1" );
|
||||
CP_XML_ATTR(L"saveData", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"saveData", 0);
|
||||
CP_XML_ATTR(L"r:id", L"rId1" );
|
||||
}
|
||||
CP_XML_ATTR(L"enableRefresh", 1);
|
||||
CP_XML_ATTR(L"refreshedBy", db->rgb.value());
|
||||
CP_XML_ATTR(L"refreshedDate", db_ex->numDate.data.value);
|
||||
CP_XML_ATTR(L"recordCount", db->crdbdb);
|
||||
//upgradeOnRefresh="1"
|
||||
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
|
||||
|
||||
if (src)
|
||||
{
|
||||
bSql = src->bSql;
|
||||
src->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
if (pivot_cache->m_arFDB.empty() == false)
|
||||
if (!pivot_cache->m_arFDB.empty())
|
||||
{
|
||||
CP_XML_NODE(L"cacheFields")
|
||||
{
|
||||
@ -151,11 +157,11 @@ int PIVOTCACHEDEFINITION::serialize_definitions(std::wostream & strm)
|
||||
FDB *field = dynamic_cast<FDB *>(pivot_cache->m_arFDB[i].get());
|
||||
if (!field) continue;
|
||||
|
||||
field->serialize(CP_XML_STREAM(), bSql);
|
||||
field->serialize(CP_XML_STREAM(), bSql, !pivot_cache->m_arDBB.empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pivot_cache->m_arSXFORMULA.empty() == false)
|
||||
if (!pivot_cache->m_arSXFORMULA.empty())
|
||||
{
|
||||
CP_XML_NODE(L"calculatedItems")
|
||||
{
|
||||
@ -178,13 +184,16 @@ 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;
|
||||
|
||||
if (pivot_cache->m_arDBB.empty()) return 0;
|
||||
SXSRC* src = dynamic_cast<SXSRC*>(m_SXSRC.get());
|
||||
bool bSql = src ? src->bSql : false;
|
||||
|
||||
if (pivot_cache->m_arDBB.empty() && bSql) return 0;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -193,11 +202,22 @@ int PIVOTCACHEDEFINITION::serialize_records(std::wostream & strm)
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
|
||||
CP_XML_ATTR(L"count", pivot_cache->m_arDBB.size());
|
||||
|
||||
for (size_t i = 0; i < pivot_cache->m_arDBB.size(); i++)
|
||||
if (!pivot_cache->m_arDBB.empty())
|
||||
{
|
||||
pivot_cache->m_arDBB[i]->serialize(CP_XML_STREAM());
|
||||
CP_XML_ATTR(L"count", pivot_cache->m_arDBB.size());
|
||||
for (size_t i = 0; i < pivot_cache->m_arDBB.size(); i++)
|
||||
{
|
||||
pivot_cache->m_arDBB[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"count", pivot_cache->m_arFDB.size());
|
||||
for (size_t i = 0; i < pivot_cache->m_arFDB.size(); i++)
|
||||
{
|
||||
FDB* fdb = dynamic_cast<FDB*>(pivot_cache->m_arFDB[i].get());
|
||||
fdb->serialize_record(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
@ -49,7 +47,12 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
static const ElementType type = typePIVOTEX;
|
||||
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)
|
||||
@ -49,7 +47,11 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
static const ElementType type = typePIVOTFORMAT;
|
||||
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,17 +39,24 @@
|
||||
#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()
|
||||
{
|
||||
indexCache = -1;
|
||||
indexStream = -1;
|
||||
indexCache = -1;
|
||||
}
|
||||
|
||||
PIVOTVIEW::~PIVOTVIEW()
|
||||
@ -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,24 @@ 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;
|
||||
|
||||
indexCache = view->iCache;
|
||||
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_SXDVer10Info.get()) : NULL;
|
||||
SXAddl_SXCView_SXDVer12Info *view_ex12 = addls ? dynamic_cast<SXAddl_SXCView_SXDVer12Info*>(addls->m_SXAddl_SXCView_SXDVer12Info.get()) : NULL;
|
||||
|
||||
indexStream = global_info_->arPivotCacheStream[view->iCache];
|
||||
|
||||
std::map<int, int>::iterator pFindIndex = global_info_->mapPivotCacheIndex.find(indexStream);
|
||||
|
||||
if (pFindIndex == global_info_->mapPivotCacheIndex.end())
|
||||
return 0;
|
||||
|
||||
indexCache = pFindIndex->second;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -109,8 +132,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"dataOnRows", view->sxaxis4Data.bRw);
|
||||
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 +147,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);
|
||||
CP_XML_ATTR(L"autoFormatId", view->itblAutoFmt);
|
||||
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,54 +187,66 @@ 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);
|
||||
CP_XML_ATTR(L"colPageCount", 1);
|
||||
}
|
||||
CP_XML_NODE(L"pivotFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", view->cDim);//Sxvd
|
||||
for (size_t i = 0; i < core->m_arPIVOTVD.size(); i++)
|
||||
|
||||
if (view->cDimPg > 0)
|
||||
{
|
||||
core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM());
|
||||
CP_XML_ATTR(L"rowPageCount", view->cDimPg);
|
||||
CP_XML_ATTR(L"colPageCount", 1);
|
||||
}
|
||||
}
|
||||
if (core->m_arPIVOTIVD.size() >= 1)
|
||||
if (!core->m_arPIVOTVD.empty())
|
||||
{
|
||||
CP_XML_NODE(L"pivotFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", view->cDim);//Sxvd
|
||||
for (size_t i = 0; i < core->m_arPIVOTVD.size(); i++)
|
||||
{
|
||||
core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
int index_ivd = 0;
|
||||
int index_tli = 0;
|
||||
|
||||
if (view->cDimRw > 0 && index_ivd < core->m_arPIVOTIVD.size())
|
||||
{
|
||||
CP_XML_NODE(L"rowFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", view->cDimRw);
|
||||
|
||||
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[0].get());
|
||||
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[index_ivd].get());
|
||||
ivd->serialize(CP_XML_STREAM());
|
||||
index_ivd++;
|
||||
}
|
||||
}
|
||||
if (core->m_arPIVOTLI.size() >= 1)//0 or 2
|
||||
if (view->cRw > 0 && index_tli < core->m_arPIVOTLI.size())
|
||||
{
|
||||
CP_XML_NODE(L"rowItems")
|
||||
{
|
||||
CP_XML_ATTR(L"count", view->cRw);
|
||||
|
||||
PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[0].get());
|
||||
PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[index_tli].get());
|
||||
line->serialize(CP_XML_STREAM());
|
||||
index_tli++;
|
||||
}
|
||||
}
|
||||
if (core->m_arPIVOTIVD.size() == 2)//0 or 2
|
||||
if (view->cDimCol > 0 && index_ivd < core->m_arPIVOTIVD.size())
|
||||
{
|
||||
CP_XML_NODE(L"colFields")
|
||||
{
|
||||
CP_XML_ATTR(L"count", view->cDimCol);
|
||||
|
||||
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[1].get());
|
||||
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[index_ivd].get());
|
||||
ivd->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
if (core->m_arPIVOTLI.size() == 2)//0 or 2
|
||||
if (view->cCol > 0 && index_tli < core->m_arPIVOTLI.size())
|
||||
{
|
||||
CP_XML_NODE(L"colItems")
|
||||
{
|
||||
CP_XML_ATTR(L"count", view->cCol);
|
||||
|
||||
PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[1].get());
|
||||
PIVOTLI* line = dynamic_cast<PIVOTLI*>(core->m_arPIVOTLI[index_tli].get());
|
||||
line->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
@ -197,7 +259,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
|
||||
core->m_PIVOTPI->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
if (core->m_arSXDI.empty() == false)
|
||||
if (!core->m_arSXDI.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dataFields")
|
||||
{
|
||||
@ -215,7 +277,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")
|
||||
{
|
||||
CP_XML_ATTR(L"name", table_style->stName.value());
|
||||
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
|
||||
|
||||
@ -86,7 +86,7 @@ int SORTDATA12::serialize(std::wostream & stream)
|
||||
if (info->fCaseSensitive) CP_XML_ATTR(L"caseSensitive", 1);
|
||||
if (info->fAltMethod) CP_XML_ATTR(L"sortMethod", L"stroke");
|
||||
|
||||
for (int i = 0 ; i < info->sortCond12Array.size(); i++)
|
||||
for (size_t i = 0 ; i < info->sortCond12Array.size(); i++)
|
||||
{
|
||||
SortCond12 * sortCond = dynamic_cast<SortCond12 *>(info->sortCond12Array[i].get());
|
||||
if (sortCond == NULL) continue;
|
||||
|
||||
@ -31,8 +31,9 @@
|
||||
*/
|
||||
|
||||
#include "STYLES.h"
|
||||
#include <Logic/Biff_records/Style.h>
|
||||
#include <Logic/Biff_records/StyleExt.h>
|
||||
|
||||
#include "../Biff_records/Style.h"
|
||||
#include "../Biff_records/StyleExt.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -84,6 +85,17 @@ const bool STYLES::loadContent(BinProcessor& proc)
|
||||
{
|
||||
styles_count = proc.repeated<Parenthesis_STYLES_1>(0, 0);
|
||||
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
{
|
||||
Parenthesis_STYLES_1 * style_1 = dynamic_cast<Parenthesis_STYLES_1*>(it->get());
|
||||
|
||||
if (style_1)
|
||||
{
|
||||
m_arStyles.push_back(std::make_pair(style_1->m_Style, style_1->m_StyleEx));
|
||||
}
|
||||
}
|
||||
elements_.clear();
|
||||
|
||||
if (styles_count > 0) return true;
|
||||
else return false;
|
||||
}
|
||||
@ -98,57 +110,52 @@ int STYLES::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_ATTR(L"count", styles_count);
|
||||
|
||||
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
|
||||
for (size_t i = 0; i < m_arStyles.size(); i++)
|
||||
{
|
||||
Parenthesis_STYLES_1 * style_1 = dynamic_cast<Parenthesis_STYLES_1*>(it->get());
|
||||
|
||||
if (style_1)
|
||||
CP_XML_NODE(L"cellStyle")
|
||||
{
|
||||
CP_XML_NODE(L"cellStyle")
|
||||
XLS::Style * style = dynamic_cast<Style*> (m_arStyles[i].first.get());
|
||||
XLS::StyleExt * styleExt = dynamic_cast<StyleExt*> (m_arStyles[i].second.get());
|
||||
|
||||
if (styleExt)
|
||||
{
|
||||
XLS::Style * style = dynamic_cast<Style*> (style_1->m_Style.get());
|
||||
XLS::StyleExt * styleExt = dynamic_cast<StyleExt*>(style_1->m_StyleEx.get());
|
||||
|
||||
if (styleExt)
|
||||
CP_XML_ATTR(L"name", styleExt->stName.value());
|
||||
|
||||
if (styleExt->fBuiltIn)
|
||||
{
|
||||
CP_XML_ATTR(L"name", styleExt->stName.value());
|
||||
|
||||
if (styleExt->fBuiltIn)
|
||||
CP_XML_ATTR(L"builtinId", styleExt->builtInData.istyBuiltIn);
|
||||
|
||||
if (styleExt->builtInData.iLevel > 0 && styleExt->builtInData.iLevel < 255)
|
||||
{
|
||||
CP_XML_ATTR(L"builtinId", styleExt->builtInData.istyBuiltIn);
|
||||
|
||||
if (styleExt->builtInData.iLevel > 0 && styleExt->builtInData.iLevel < 255)
|
||||
{
|
||||
CP_XML_ATTR(L"iLevel", styleExt->builtInData.iLevel);
|
||||
}
|
||||
}
|
||||
|
||||
// for (int i = 0; i < styleExt->xfProps.xfPropArray.size(); i++)
|
||||
//{
|
||||
//}
|
||||
}
|
||||
else if (style)
|
||||
{
|
||||
CP_XML_ATTR(L"name", style->user.value());
|
||||
|
||||
if (style->fBuiltIn)
|
||||
{
|
||||
CP_XML_ATTR(L"builtinId", style->builtInData.istyBuiltIn);
|
||||
if (style->builtInData.iLevel > 0 && style->builtInData.iLevel < 255)
|
||||
{
|
||||
CP_XML_ATTR(L"iLevel", style->builtInData.iLevel);
|
||||
}
|
||||
CP_XML_ATTR(L"iLevel", styleExt->builtInData.iLevel);
|
||||
}
|
||||
}
|
||||
|
||||
if (style)
|
||||
// for (size_t i = 0; i < styleExt->xfProps.xfPropArray.size(); i++)
|
||||
//{
|
||||
//}
|
||||
}
|
||||
else if (style)
|
||||
{
|
||||
CP_XML_ATTR(L"name", style->user.value());
|
||||
|
||||
if (style->fBuiltIn)
|
||||
{
|
||||
int xfId = style->ixfe - 1;
|
||||
if (xfId < 0) xfId = 0;
|
||||
|
||||
CP_XML_ATTR(L"xfId", xfId);
|
||||
CP_XML_ATTR(L"builtinId", style->builtInData.istyBuiltIn);
|
||||
if (style->builtInData.iLevel > 0 && style->builtInData.iLevel < 255)
|
||||
{
|
||||
CP_XML_ATTR(L"iLevel", style->builtInData.iLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (style)
|
||||
{
|
||||
int xfId = style->ixfe - 1;
|
||||
if (xfId < 0) xfId = 0;
|
||||
|
||||
CP_XML_ATTR(L"xfId", xfId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of STYLES union of records
|
||||
class STYLES : public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(STYLES)
|
||||
@ -53,6 +51,8 @@ public:
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
std::vector<std::pair<BaseObjectPtr, BaseObjectPtr>> m_arStyles;
|
||||
|
||||
int styles_count;
|
||||
|
||||
};
|
||||
|
||||
@ -82,7 +82,7 @@ const bool SXOPER::loadContent(BinProcessor& proc)
|
||||
bNumber = !bInteger;
|
||||
node = L"n";
|
||||
if (bInteger)
|
||||
value = std::to_wstring((int)num->num.data.value);
|
||||
value = std::to_wstring((_INT64)num->num.data.value);
|
||||
else
|
||||
value = boost::lexical_cast<std::wstring>(num->num.data.value);
|
||||
}
|
||||
@ -97,9 +97,18 @@ const bool SXOPER::loadContent(BinProcessor& proc)
|
||||
else if(proc.optional<SxErr>())
|
||||
{
|
||||
SxErr* err = dynamic_cast<SxErr*>(elements_.back().get());
|
||||
bNumber = true;
|
||||
bString = true;
|
||||
node = L"e";
|
||||
value = std::to_wstring(err->wbe);
|
||||
switch(err->wbe)
|
||||
{
|
||||
case 0x00: value = L"NULL!"; break;
|
||||
case 0x07: value = L"#DIV/0!"; break;
|
||||
case 0x0F: value = L"#VALUE!"; break;
|
||||
case 0x17: value = L"#REF!"; break;
|
||||
case 0x1D: value = L"#NAME?"; break;
|
||||
case 0x24: value = L"#NUM!"; break;
|
||||
case 0x2A: value = L"#N/A"; break;
|
||||
}
|
||||
}
|
||||
else if(proc.optional<SXString>())
|
||||
{
|
||||
@ -146,5 +155,20 @@ int SXOPER::serialize(std::wostream & strm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SXOPER::serialize_record(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(node)
|
||||
{
|
||||
if (!value.empty() || bString)
|
||||
{
|
||||
CP_XML_ATTR(L"v", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ public:
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
int serialize(std::wostream & strm);
|
||||
int serialize_record(std::wostream & strm);
|
||||
|
||||
static const ElementType type = typeSXOPER;
|
||||
|
||||
|
||||
@ -31,9 +31,9 @@
|
||||
*/
|
||||
|
||||
#include "SXSRC.h"
|
||||
#include <Logic/Biff_unions/DREF.h>
|
||||
#include <Logic/Biff_unions/SXTBL.h>
|
||||
#include <Logic/Biff_unions/DBQUERY.h>
|
||||
#include "DREF.h"
|
||||
#include "SXTBL.h"
|
||||
#include "DBQUERY.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -31,12 +31,16 @@
|
||||
*/
|
||||
|
||||
#include "SXTBL.h"
|
||||
#include <Logic/Biff_records/SXTbl.h>
|
||||
#include <Logic/Biff_unions/DREF.h>
|
||||
#include <Logic/Biff_records/SxTbpg.h>
|
||||
#include <Logic/Biff_records/SXTBRGIITM.h>
|
||||
#include <Logic/Biff_records/SXString.h>
|
||||
#include "DREF.h"
|
||||
|
||||
#include "../Biff_records/SXTbl.h"
|
||||
#include "../Biff_records/SxTbpg.h"
|
||||
#include "../Biff_records/SXTBRGIITM.h"
|
||||
#include "../Biff_records/SXString.h"
|
||||
|
||||
#include "../Biff_records/DConName.h"
|
||||
#include "../Biff_records/DConBin.h"
|
||||
#include "../Biff_records/DConRef.h"
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -124,11 +128,99 @@ const bool SXTBL::loadContent(BinProcessor& proc)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
int SXTBL::serialize(std::wostream & stream)
|
||||
int SXTBL::serialize(std::wostream & strm)
|
||||
{
|
||||
if (!m_SXTbl) return 0;
|
||||
|
||||
SXTbl *tbl = dynamic_cast<SXTbl*>(m_SXTbl.get());
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"cacheSource")
|
||||
{
|
||||
CP_XML_ATTR(L"type", L"consolidation");
|
||||
|
||||
CP_XML_NODE(L"consolidation")
|
||||
{
|
||||
CP_XML_NODE(L"pages")
|
||||
{
|
||||
CP_XML_ATTR(L"count", m_arSXTBRGIITM.size());
|
||||
|
||||
for (size_t i = 0; i < m_arSXTBRGIITM.size(); i++)
|
||||
{
|
||||
SXTBRGIITM * item = dynamic_cast<SXTBRGIITM*>(m_arSXTBRGIITM[i].item.get());
|
||||
|
||||
CP_XML_NODE(L"page")
|
||||
{
|
||||
CP_XML_ATTR(L"count", item->cItems);
|
||||
|
||||
for (size_t j = 0; j < m_arSXTBRGIITM[i].strings.size(); j++)
|
||||
{
|
||||
SXString* str = dynamic_cast<SXString*>(m_arSXTBRGIITM[i].strings[j].get());
|
||||
CP_XML_NODE(L"pageItem")
|
||||
{
|
||||
CP_XML_ATTR(L"name", str->segment.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"rangeSets")
|
||||
{
|
||||
CP_XML_ATTR(L"count", m_arDREF.size());
|
||||
for (size_t i = 0; i < m_arDREF.size(); i++)
|
||||
{
|
||||
DREF* dref = dynamic_cast<DREF*>(m_arDREF[i].get());
|
||||
|
||||
DConName* name = dynamic_cast<DConName*>(dref->m_DCon.get());
|
||||
DConBin* bin = dynamic_cast<DConBin*>(dref->m_DCon.get());
|
||||
DConRef* ref = dynamic_cast<DConRef*>(dref->m_DCon.get());
|
||||
|
||||
CP_XML_NODE(L"rangeSet")
|
||||
{
|
||||
CP_XML_ATTR(L"i1", i);
|
||||
if (name)
|
||||
{
|
||||
CP_XML_ATTR(L"name", name->stName.value());
|
||||
}
|
||||
if (bin)
|
||||
{
|
||||
switch(bin->nBuiltin)
|
||||
{
|
||||
case 0x0000: CP_XML_ATTR(L"name", L"_xlnm.Consolidate_Area"); break;
|
||||
case 0x0001: CP_XML_ATTR(L"name", L"_xlnm.Auto_Open"); break;
|
||||
case 0x0002: CP_XML_ATTR(L"name", L"_xlnm.Auto_Close"); break;
|
||||
case 0x0003: CP_XML_ATTR(L"name", L"_xlnm.Extract"); break;
|
||||
case 0x0004: CP_XML_ATTR(L"name", L"_xlnm.Database"); break;
|
||||
case 0x0005: CP_XML_ATTR(L"name", L"_xlnm.Criteria"); break;
|
||||
case 0x0006: CP_XML_ATTR(L"name", L"_xlnm.Print_Area"); break;
|
||||
case 0x0007: CP_XML_ATTR(L"name", L"_xlnm.Print_Titles"); break;
|
||||
case 0x0008: CP_XML_ATTR(L"name", L"_xlnm.Recorder"); break;
|
||||
case 0x0009: CP_XML_ATTR(L"name", L"_xlnm.Data_Form"); break;
|
||||
case 0x000a: CP_XML_ATTR(L"name", L"_xlnm.Auto_Activate"); break;
|
||||
case 0x000b: CP_XML_ATTR(L"name", L"_xlnm.Auto_Deactivate"); break;
|
||||
case 0x000c: CP_XML_ATTR(L"name", L"_xlnm.Sheet_Title"); break;
|
||||
case 0x000d: CP_XML_ATTR(L"name", L"_xlnm._FilterDatabase"); break; //??
|
||||
}
|
||||
}
|
||||
if (ref)
|
||||
{
|
||||
ref->check_external();
|
||||
|
||||
CP_XML_ATTR(L"ref", ref->ref.toString());
|
||||
CP_XML_ATTR(L"sheet", ref->sheet_name);
|
||||
|
||||
if (ref->index_external >= 0)
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", L"extId" + std::to_wstring(ref->index_external + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
@ -177,7 +177,7 @@ int WINDOW::serialize(std::wostream & stream)
|
||||
CP_XML_ATTR(L"state", L"split");
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_arSelection.size(); i++)
|
||||
for (size_t i = 0; i < m_arSelection.size(); i++)
|
||||
{
|
||||
if (m_arSelection[i] == NULL) continue;
|
||||
m_arSelection[i]->serialize(CP_XML_STREAM());
|
||||
|
||||
@ -115,28 +115,45 @@ const bool XFS::loadContent(BinProcessor& proc)
|
||||
count--;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------
|
||||
return true;
|
||||
}
|
||||
void XFS::RegisterFillBorder()
|
||||
{
|
||||
int first_xf_ext = 0;
|
||||
|
||||
for (_UINT16 i = 0 ; i < m_arCellStyles.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arCellStyles.size(); i++)
|
||||
{
|
||||
XF *xfs = dynamic_cast<XF*>(m_arCellStyles[i].get());
|
||||
XF *xfs = dynamic_cast<XF*>(m_arCellStyles[i].get());
|
||||
|
||||
for (size_t j = first_xf_ext ; j < m_arXFext.size(); j++)
|
||||
{
|
||||
XFExt *ext = dynamic_cast<XFExt*>(m_arXFext[j].get());
|
||||
if (ext->ixfe > i)
|
||||
break;
|
||||
|
||||
if (ext->ixfe == xfs->ind_xf)
|
||||
{
|
||||
xfs->style.ext_props = ext->rgExt;
|
||||
first_xf_ext = j + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
xfs->style.RegisterFillBorder();
|
||||
|
||||
}
|
||||
first_xf_ext = 0;
|
||||
|
||||
for (int i = 0 ; i < m_arCellXFs.size(); i++)
|
||||
for (size_t i = 0 ; i < m_arCellXFs.size(); i++)
|
||||
{
|
||||
XF *xfs = dynamic_cast<XF*>(m_arCellXFs[i].get());
|
||||
XF *xfs = dynamic_cast<XF*>(m_arCellXFs[i].get());
|
||||
|
||||
if (m_arXFext.size() > 0 && xfs->cell.fHasXFExt)
|
||||
if (!m_arXFext.empty() && xfs->cell.fHasXFExt)
|
||||
{
|
||||
for (_UINT16 j = first_xf_ext ; j < m_arXFext.size(); j++)
|
||||
for (size_t j = first_xf_ext ; j < m_arXFext.size(); j++)
|
||||
{
|
||||
XFExt *ext = dynamic_cast<XFExt*>(m_arXFext[j].get());
|
||||
if (ext->ixfe > i)break;
|
||||
if (ext->ixfe > i)
|
||||
break;
|
||||
|
||||
if (ext->ixfe == xfs->ind_xf)
|
||||
{
|
||||
@ -148,8 +165,6 @@ const bool XFS::loadContent(BinProcessor& proc)
|
||||
}
|
||||
xfs->cell.RegisterFillBorder();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
int XFS::serialize(std::wostream & stream)
|
||||
{
|
||||
@ -158,7 +173,7 @@ int XFS::serialize(std::wostream & stream)
|
||||
CP_XML_NODE(L"cellStyleXfs")
|
||||
{
|
||||
CP_XML_ATTR(L"count", m_arCellStyles.size());
|
||||
for (int i = 0; i < m_arCellStyles.size(); i++)
|
||||
for (size_t i = 0; i < m_arCellStyles.size(); i++)
|
||||
{
|
||||
m_arCellStyles[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -166,7 +181,7 @@ int XFS::serialize(std::wostream & stream)
|
||||
CP_XML_NODE(L"cellXfs")
|
||||
{
|
||||
CP_XML_ATTR(L"count", m_arCellXFs.size());
|
||||
for (int i = 0; i < m_arCellXFs.size(); i++)
|
||||
for (size_t i = 0; i < m_arCellXFs.size(); i++)
|
||||
{
|
||||
m_arCellXFs[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
@ -51,6 +51,8 @@ public:
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
void RegisterFillBorder();
|
||||
|
||||
static const ElementType type = typeXFS;
|
||||
|
||||
size_t cell_xf_current_id;
|
||||
|
||||
@ -324,6 +324,13 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts)
|
||||
|
||||
int iCrt = -1;
|
||||
|
||||
if (charts->m_arSERIESFORMAT.empty() && !parent0->m_arCRT.empty())
|
||||
{
|
||||
std::vector<int> ser;
|
||||
m_mapTypeChart.insert(std::make_pair(0, ser));
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0 ; i < charts->m_arSERIESFORMAT.size(); i++)
|
||||
{
|
||||
SERIESFORMAT * series = dynamic_cast<SERIESFORMAT *>(charts->m_arSERIESFORMAT[i].get());
|
||||
@ -334,7 +341,7 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts)
|
||||
if ( serCrt == NULL)
|
||||
{
|
||||
//для доп линий может и не существовать - брать предыдущий - и объеденить!!!
|
||||
std::map<int,std::vector<int>>::iterator it = m_mapTypeChart.find(iCrt);
|
||||
std::unordered_map<int,std::vector<int>>::iterator it = m_mapTypeChart.find(iCrt);
|
||||
if (it != m_mapTypeChart.end())
|
||||
{
|
||||
SERIESFORMAT * series_prev = dynamic_cast<SERIESFORMAT *>(charts->m_arSERIESFORMAT[it->second.back()].get());
|
||||
@ -359,12 +366,12 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts)
|
||||
|
||||
CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[iCrt].get());
|
||||
|
||||
std::map<int,std::vector<int>>::iterator it = m_mapTypeChart.find(iCrt);
|
||||
std::unordered_map<int,std::vector<int>>::iterator it = m_mapTypeChart.find(iCrt);
|
||||
if (it == m_mapTypeChart.end())
|
||||
{
|
||||
std::vector<int> ser;
|
||||
ser.push_back(i);
|
||||
m_mapTypeChart.insert(std::pair<int, std::vector<int>>(iCrt, ser));
|
||||
m_mapTypeChart.insert(std::make_pair(iCrt, ser));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -507,7 +514,7 @@ int ChartSheetSubstream::serialize_3D (std::wostream & _stream)
|
||||
BaseObjectPtr wallSpPr;
|
||||
BaseObjectPtr floorSpPr;
|
||||
|
||||
for (int i = 0; i < chart_formats->m_arAXISPARENT.size(); i++)
|
||||
for (size_t i = 0; i < chart_formats->m_arAXISPARENT.size(); i++)
|
||||
{
|
||||
AXISPARENT* parent = dynamic_cast<AXISPARENT*> (chart_formats->m_arAXISPARENT[i].get());
|
||||
AxisParent* ax_parent = dynamic_cast<AxisParent*> (parent->m_AxisParent.get());
|
||||
@ -545,11 +552,11 @@ int ChartSheetSubstream::serialize_3D (std::wostream & _stream)
|
||||
CP_XML_ATTR (L"val" , chart3D->anElev);
|
||||
}
|
||||
}
|
||||
if (chart3D->pcHeight != 100)
|
||||
if (chart3D->pcHeight3D != 100 && chart3D->pcHeight3D >= 5 && chart3D->pcHeight3D <= 500)
|
||||
{
|
||||
CP_XML_NODE(L"c:hPercent")
|
||||
{
|
||||
CP_XML_ATTR (L"val" , chart3D->pcHeight);
|
||||
CP_XML_ATTR (L"val" , chart3D->pcHeight3D);
|
||||
}
|
||||
}
|
||||
if (chart3D->anRot != 0)
|
||||
@ -662,7 +669,7 @@ int ChartSheetSubstream::serialize_legend (std::wostream & _stream, const std::w
|
||||
//}
|
||||
|
||||
//todooo разобраться с разными типами в одном чарте .. считать количество серий??
|
||||
std::map< int, std::vector<int>>::iterator it = m_mapTypeChart.begin();
|
||||
std::unordered_map< int, std::vector<int>>::iterator it = m_mapTypeChart.begin();
|
||||
if (it != m_mapTypeChart.end())
|
||||
{
|
||||
CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[it->first].get());
|
||||
@ -746,7 +753,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
|
||||
PlotAreaPos->serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
for (std::map<int, std::vector<int>>::iterator it = m_mapTypeChart.begin(); it != m_mapTypeChart.end(); it++)
|
||||
for (std::unordered_map<int, std::vector<int>>::iterator it = m_mapTypeChart.begin(); it != m_mapTypeChart.end(); it++)
|
||||
{
|
||||
CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[it->first].get());
|
||||
|
||||
@ -871,7 +878,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
|
||||
AXES * axes = dynamic_cast<AXES*>(parent->m_AXES.get());
|
||||
if (axes)
|
||||
{
|
||||
for (int a = 0 ; a < axes->m_arAxesId.size(); a++)
|
||||
for (size_t a = 0 ; a < axes->m_arAxesId.size(); a++)
|
||||
{
|
||||
CP_XML_NODE(L"c:axId")
|
||||
{
|
||||
@ -883,7 +890,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < chart_formats->m_arAXISPARENT.size(); i++)
|
||||
for (size_t i = 0; i < chart_formats->m_arAXISPARENT.size(); i++)
|
||||
{
|
||||
AXISPARENT* parent = dynamic_cast<AXISPARENT*> (chart_formats->m_arAXISPARENT[i].get());
|
||||
AxisParent* ax_parent = dynamic_cast<AxisParent*> (parent->m_AxisParent.get());
|
||||
@ -942,7 +949,7 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt
|
||||
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
for (int i = 0 ; i < series->m_arPtSS.size(); i++)
|
||||
for (size_t i = 0 ; i < series->m_arPtSS.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"c:dPt")
|
||||
{
|
||||
@ -962,7 +969,7 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt
|
||||
CP_XML_ATTR(L"val", series_data_format->xi);
|
||||
|
||||
if (format->fVaried)
|
||||
present_idx.insert(std::pair<int, bool>(series_data_format->xi, true));
|
||||
present_idx.insert(std::make_pair(series_data_format->xi, true));
|
||||
}
|
||||
series_ss->serialize (CP_XML_STREAM(), crt->m_iChartType, series_data_format->xi);
|
||||
series_ss->serialize2 (CP_XML_STREAM(), crt->m_iChartType);
|
||||
@ -1088,7 +1095,7 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT *
|
||||
CP_XML_NODE(L"c:showSerName") { CP_XML_ATTR (L"val" , 0); }
|
||||
}
|
||||
//подписи к точкам (отдельные)
|
||||
for (int i = 0; i < labels.size(); i++)
|
||||
for (size_t i = 0; i < labels.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"c:dLbl")
|
||||
{
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Logic/CompositeObject.h>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace XLS
|
||||
{;
|
||||
@ -86,7 +87,7 @@ private:
|
||||
void recalc(CHARTFORMATS* charts);
|
||||
void recalc(SERIESDATA* data);
|
||||
|
||||
std::map<int, std::vector<int>> m_mapTypeChart;//тут нужен несортированый .. пока оставим этот
|
||||
std::unordered_map<int, std::vector<int>> m_mapTypeChart;
|
||||
|
||||
GlobalWorkbookInfoPtr pGlobalWorkbookInfo;
|
||||
};
|
||||
|
||||
@ -165,12 +165,12 @@ const size_t GlobalWorkbookInfo::RegisterFillId(const FillInfo& fill)
|
||||
|
||||
void GlobalWorkbookInfo::RegisterFontColorId (int id, const FillInfoExt & font_color)
|
||||
{
|
||||
fonts_color_ext.insert(std::pair<int, FillInfoExt>(id, font_color));
|
||||
fonts_color_ext.insert(std::make_pair(id, font_color));
|
||||
}
|
||||
|
||||
void GlobalWorkbookInfo::RegisterPaletteColor(int id, const std::wstring & rgb)
|
||||
{
|
||||
colors_palette.insert(std::pair<int, std::wstring>(id, rgb));
|
||||
colors_palette.insert(std::make_pair(id, rgb));
|
||||
}
|
||||
|
||||
unsigned int GlobalWorkbookInfo::GenerateAXESId()
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include <boost/smart_ptr/shared_array.hpp>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Biff_structures/BorderFillInfo.h"
|
||||
|
||||
@ -106,13 +107,17 @@ 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;
|
||||
|
||||
std::vector<_sx_name> arPivotSxNames;
|
||||
std::vector<std::wstring> arPivotCacheSxNames;
|
||||
std::vector<std::wstring> arPivotCacheReferences;
|
||||
|
||||
std::unordered_map<std::wstring, std::wstring> mapPivotCacheExternal;
|
||||
|
||||
std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
|
||||
std::vector<std::wstring> arDefineNames;
|
||||
|
||||
@ -491,7 +491,7 @@ void GlobalsSubstream::LoadHFPicture()
|
||||
if (m_arHFPicture.empty()) return;
|
||||
|
||||
int current_size_hf = 0, j = 0;
|
||||
for ( int i = 0; i < m_arHFPicture.size(); i++)
|
||||
for ( size_t i = 0; i < m_arHFPicture.size(); i++)
|
||||
{
|
||||
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get());
|
||||
if ((hf) && (hf->recordDrawingGroup))
|
||||
|
||||
@ -63,7 +63,7 @@ PropertySet::PropertySet(XLS::CFStreamPtr stream, const unsigned int property_se
|
||||
}
|
||||
|
||||
code_page = 0;
|
||||
for(unsigned int i = 0; i < prop_offsets.size(); ++i)
|
||||
for(size_t i = 0; i < prop_offsets.size(); ++i)
|
||||
{
|
||||
if (stream->getStreamPointer() - property_set_offset > Size)
|
||||
break;
|
||||
|
||||
@ -467,7 +467,7 @@ void WorksheetSubstream::LoadHFPicture()
|
||||
if (m_arHFPicture.empty()) return;
|
||||
|
||||
int current_size_hf = 0, j = 0;
|
||||
for ( int i = 0; i < m_arHFPicture.size(); i++)
|
||||
for ( size_t i = 0; i < m_arHFPicture.size(); i++)
|
||||
{
|
||||
HFPicture* hf = dynamic_cast<HFPicture*>(m_arHFPicture[i].get());
|
||||
if ((hf) && (hf->recordDrawingGroup))
|
||||
|
||||
@ -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);
|
||||
long ConvertXls2Xlsx(const std::wstring & srcFile, const std::wstring & dstPath, const std::wstring & password, const std::wstring& fontsPath, const ProgressCallback* CallBack, bool & bMacros);
|
||||
@ -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())
|
||||
@ -198,6 +200,7 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
|
||||
{
|
||||
std::list<std::string> listStream = cfile.storage_->entries("_SX_DB_CUR");
|
||||
|
||||
int last_index = 0;
|
||||
for (std::list<std::string>::iterator it = listStream.begin(); it != listStream.end(); it++)
|
||||
{
|
||||
XLS::CFStreamCacheReader pivot_cache_reader(cfile.getNamedStream("_SX_DB_CUR/" + *it), xls_global_info);
|
||||
@ -206,18 +209,34 @@ XlsConverter::XlsConverter(const std::wstring & xls_file, const std::wstring & _
|
||||
XLS::BinReaderProcessor proc(pivot_cache_reader , pivot_cache.get() , true);
|
||||
proc.mandatory(*pivot_cache.get());
|
||||
|
||||
int index = 0;
|
||||
try
|
||||
{
|
||||
index = atoi(it->c_str());
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
int index = XmlUtils::GetHex(*it);
|
||||
|
||||
xls_global_info->mapPivotCache.insert(std::make_pair(index, pivot_cache));
|
||||
xls_global_info->mapPivotCacheStream.insert(std::make_pair(index, pivot_cache));
|
||||
|
||||
last_index = index;
|
||||
}
|
||||
}
|
||||
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,8 +250,7 @@ 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);
|
||||
xlsx_context = new oox::xlsx_conversion_context(output_document);
|
||||
}
|
||||
|
||||
XlsConverter::~XlsConverter()
|
||||
@ -268,6 +286,7 @@ bool XlsConverter::UpdateProgress(long nComplete)
|
||||
void XlsConverter::write()
|
||||
{
|
||||
if (!output_document)return;
|
||||
|
||||
output_document->write(xlsx_path);
|
||||
|
||||
delete output_document; output_document = NULL;
|
||||
@ -1944,4 +1963,9 @@ void XlsConverter::convert(XLS::PIVOTCACHEDEFINITION * pivot_cached)
|
||||
pivot_cached->serialize_records(strmR);
|
||||
|
||||
xlsx_context->get_pivots_context().add_cache(strmD.str(), strmR.str());
|
||||
|
||||
if (!xls_global_info->mapPivotCacheExternal.empty())
|
||||
{
|
||||
xlsx_context->get_pivots_context().add_cache_external(xls_global_info->mapPivotCacheExternal);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user