Compare commits

..

9 Commits

15 changed files with 134 additions and 114 deletions

View File

@ -245,12 +245,16 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
{
names.push_back(L"adj1");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
std::wstring::npos != shapeGeomPreset.find(L"decagon"))
{
values.clear();
}
//else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
//{
// names.push_back(L"vf");
//}
//else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
// std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
//else if (std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
//{
// names.push_back(L"hf");
// names.push_back(L"vf");

View File

@ -218,13 +218,6 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_ATTR(L"r:id",impl_->vml_drawingId_);
}
}
if (!impl_->tableParts_.str().empty())
{
CP_XML_NODE(L"tableParts")
{
CP_XML_STREAM() << impl_->tableParts_.str();
}
}
if (!impl_->ole_objects_.str().empty())
{
CP_XML_NODE(L"oleObjects")
@ -239,6 +232,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->controls_.str();
}
}
if (!impl_->tableParts_.str().empty())
{
CP_XML_NODE(L"tableParts")
{
CP_XML_STREAM() << impl_->tableParts_.str();
}
}
CP_XML_STREAM() << impl_->picture_background_.str();
//CP_XML_NODE(L"headerFooter){}

View File

@ -590,11 +590,17 @@ void xlsx_pivots_context::Impl::sort_fields()
i--;
}
}
if ((bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol)) && (current_.grand_total == 1 || current_.grand_total == 2))/* && bShowEmptyCol*/ ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
bool data_col_repeate = false;
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow)) && (current_.grand_total == 1 || current_.grand_total == 3 || current_.data_on_row))/* && bShowEmptyRow*/
{
current_.row_fields.push_back(-2);
data_col_repeate = true;
}
if (!data_col_repeate && (bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol)) && (current_.grand_total == 1 || current_.grand_total == 2 || current_.data_fields.size() > 1 ))/* && bShowEmptyCol*/ ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
current_.col_fields.push_back(-2);
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow)) && (current_.grand_total == 1 || current_.grand_total == 3))/* && bShowEmptyRow*/
current_.row_fields.push_back(-2);
}
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
{

View File

@ -81,8 +81,8 @@ void xlsx_data_range::serialize_sort (std::wostream & _Wostream)
std::wstring ref1, ref2;
size_t col_1, row_1, col_2, row_2;
int pos = ref.find(L":");
if (pos >= 0)
size_t pos = ref.find(L":");
if (pos != std::wstring::npos)
{
ref1 = ref.substr(0, pos );
ref2 = ref.substr(pos + 1);

View File

@ -53,37 +53,6 @@ typedef _CP_PTR(xlsx_table_state) xlsx_table_state_ptr;
class xlsx_data_range;
typedef _CP_PTR(xlsx_data_range) xlsx_data_range_ptr;
class xlsx_data_range_values;
typedef _CP_PTR(xlsx_data_range_values) xlsx_data_range_values_ptr;
class xlsx_data_range_values
{
public:
xlsx_data_range_values(size_t row, size_t col1, size_t col2) : withHeader(false), filter(false), row_header(row), start_column(col1), end_column(col2)
{
for (size_t i = start_column; i <= end_column; i++)
values.push_back(L"");
}
size_t row_header;
size_t start_column;
size_t end_column;
bool withHeader;
bool filter;
std::vector<std::wstring> values;
void set_value(size_t col, size_t row, const std::wstring& value)
{
while (col - start_column + 1 >= values.size())
values.push_back(L"");
values[col - start_column] = value;
}
bool in_range(size_t col, size_t row) {return (row_header == row && (col >= start_column && col <= end_column));}
};
class xlsx_data_range
{
public:
@ -106,6 +75,33 @@ public:
void serialize_sort (std::wostream & _Wostream);
void serialize_autofilter (std::wostream & _Wostream);
size_t row_header;
size_t start_column_header;
size_t end_column_header;
std::vector<std::wstring> header_values;
void set_header(size_t row, size_t col1, size_t col2)
{
row_header = row;
start_column_header = col1;
end_column_header = col2;
for (size_t i = start_column_header; i <= end_column_header; i++)
header_values.push_back(L"");
}
void set_header_value(size_t col, size_t row, const std::wstring& value)
{
while (col - start_column_header + 1 >= header_values.size())
header_values.push_back(L"");
header_values[col - start_column_header] = value;
}
bool in_header(size_t col, size_t row)
{
return (row_header == row && (col >= start_column_header && col <= end_column_header));
}
};
class xlsx_table_state

View File

@ -63,17 +63,17 @@ xlsx_table_state_ptr xlsx_table_context::state()
bool xlsx_table_context::start_database_range(const std::wstring & name, const std::wstring & ref)
{
formulasconvert::odf2oox_converter convert;
std::wstring odf_ref = convert.convert_named_ref(ref);
std::wstring oox_ref = convert.convert_named_ref(ref);
std::wstring ref1, ref2;
size_t pos = odf_ref.find(L":");
size_t pos = oox_ref.find(L":");
std::wstring xlsx_table_name;
if (pos != std::wstring::npos)
{
ref1 = odf_ref.substr(0, pos );
ref2 = odf_ref.substr(pos + 1);
ref1 = oox_ref.substr(0, pos );
ref2 = oox_ref.substr(pos + 1);
pos = ref1.find(L"!");
if (pos > 0)
@ -91,10 +91,11 @@ bool xlsx_table_context::start_database_range(const std::wstring & name, const s
getCellAddressInv(ref1, col1, row1);
getCellAddressInv(ref2, col2, row2);
xlsx_data_ranges_.push_back(xlsx_data_range_ptr(new xlsx_data_range()));
if (name.find(L"__Anonymous_Sheet_DB__") != std::wstring::npos || col1 == col2)
{
if (/*name.find(L"__Anonymous_Sheet_DB__") != std::wstring::npos ||*/ col1 == col2)
{//check range in pivots
xlsx_data_ranges_.back()->bTablePart = false;
}
xlsx_data_ranges_.back()->name = name;
@ -103,7 +104,7 @@ bool xlsx_table_context::start_database_range(const std::wstring & name, const s
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col1, row1);
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col2, row2);
xlsx_data_ranges_values_.push_back(xlsx_data_range_values_ptr(new xlsx_data_range_values(row1, col1, col2)));
xlsx_data_ranges_.back()->set_header(row1, col1, col2);
}
if (!xlsx_table_name.empty())
@ -123,14 +124,12 @@ void xlsx_table_context::set_database_header (bool val)
if (xlsx_data_ranges_.empty()) return;
xlsx_data_ranges_.back()->withHeader = val;
xlsx_data_ranges_values_.back()->withHeader = val;
}
void xlsx_table_context::set_database_filter (bool val)
{
if (xlsx_data_ranges_.empty()) return;
xlsx_data_ranges_.back()->filter = val;
xlsx_data_ranges_values_.back()->filter = val;
}
void xlsx_table_context::end_database_range()
{
@ -138,23 +137,55 @@ void xlsx_table_context::end_database_range()
void xlsx_table_context::set_database_range_value(int index, const std::wstring& value)
{
if (index < 0 || index > xlsx_data_ranges_.size()) return;
size_t col = state()->current_column();
size_t row = state()->current_row();
xlsx_data_ranges_values_[index]->set_value(col, row, value);
xlsx_data_ranges_[index]->set_header_value(col, row, value);
}
void xlsx_table_context::check_database_range_intersection(const std::wstring& table_name, const std::wstring& ref)
{
std::wstring ref1, ref2;
size_t col_1, row_1, col_2, row_2;
size_t pos = ref.find(L":");
if (pos != std::wstring::npos)
{
ref1 = ref.substr(0, pos );
ref2 = ref.substr(pos + 1);
}
getCellAddressInv(ref1, col_1, row_1);
getCellAddressInv(ref2, col_2, row_2);
for (size_t i = 0; i < xlsx_data_ranges_.size(); i++)
{
if (xlsx_data_ranges_[i]->table_name != table_name) continue;
//if ( xlsx_data_ranges_[i]->cell_start.second < row_2 || xlsx_data_ranges_[i]->cell_end.second > row_1
// || xlsx_data_ranges_[i]->cell_end.first < col_1 || xlsx_data_ranges_[i]->cell_start.first > col_2 )
if (((col_1 <= xlsx_data_ranges_[i]->cell_start.first && xlsx_data_ranges_[i]->cell_start.first <= col_2) ||
(xlsx_data_ranges_[i]->cell_start.first <= col_1 && col_1 <= xlsx_data_ranges_[i]->cell_end.first))
&&
(( row_1 <= xlsx_data_ranges_[i]->cell_start.second && xlsx_data_ranges_[i]->cell_start.second <= row_2) ||
(xlsx_data_ranges_[i]->cell_start.second <= row_1 && row_1 <= xlsx_data_ranges_[i]->cell_end.second )))
{
xlsx_data_ranges_[i]->bTablePart = false;
}
}
}
int xlsx_table_context::in_database_range()
{
int col = state()->current_column();
int row = state()->current_row();
for (size_t i = 0; i < xlsx_data_ranges_values_.size(); i++)
for (size_t i = 0; i < xlsx_data_ranges_.size(); i++)
{
if (xlsx_data_ranges_[i]->table_name != state()->get_table_name()) continue;
if (/*(xlsx_data_ranges_values_[i]->withHeader || xlsx_data_ranges_values_[i]->filter)&& */
xlsx_data_ranges_values_[i]->in_range(col, row)) //header row only
xlsx_data_ranges_[i]->in_header(col, row))
{
return (int)i;
}
@ -350,7 +381,7 @@ void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels &
{
CP_XML_NODE(L"tableColumn")
{
std::wstring column_name = xlsx_data_ranges_values_[it->second]->values[id];
std::wstring column_name = xlsx_data_ranges_[it->second]->header_values[id];
if (column_name.empty())
{
column_name = L"Column_" + std::to_wstring(id + 1);

View File

@ -116,19 +116,19 @@ public:
void set_database_orientation (bool val);
void set_database_header (bool val);
void set_database_filter (bool val);
void add_database_sort (int field_number, int order);
void add_database_sort (int field_number, int order);
void end_database_range();
int in_database_range();
void set_database_range_value(int index, const std::wstring& value);
void check_database_range_intersection(const std::wstring& table_name, const std::wstring& ref);
private:
xlsx_conversion_context *xlsx_conversion_context_;
xlsx_text_context &xlsx_text_context_;
std::vector<xlsx_table_state_ptr> xlsx_table_states_;
std::vector<xlsx_data_range_ptr> xlsx_data_ranges_;
std::vector<xlsx_data_range_values_ptr> xlsx_data_ranges_values_;
std::multimap<std::wstring, int> xlsx_data_ranges_map_;

View File

@ -106,6 +106,8 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
std::wstring ref = formulas_converter.convert_named_ref(*table_target_range_address_, false);
sheet_name = formulas_converter.get_table_name();
Context.get_table_context().check_database_range_intersection(sheet_name, ref);
Context.get_pivots_context().set_view_target_range(ref);
Context.get_pivots_context().set_view_target_table_name(sheet_name);
}

View File

@ -37,7 +37,14 @@ mkdir "build"
fi
cef_binary=cef_binary
cef_arch=$cef_binary.7z
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/3163/$platform$arch/$cef_arch
cef_version="3163"
if [[ "$platform" == *"linux"* ]]
then
cef_version="3202"
fi
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/$cef_version/$platform$arch/$cef_arch
if [[ "$platform" == *"linux"* ]]
then

View File

@ -1 +1 @@
2.4.556.0
2.5.556.0

View File

@ -398,9 +398,9 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
const char* nenv[4];
nenv[0] = sLibraryDir.c_str();
nenv[1] = "LD_PRELOAD=./libcef.so";
nenv[2] = "DISPLAY=:0";
nenv[3] = NULL;
nenv[1] = "DISPLAY=:0";
nenv[2] = NULL;
nenv[3] = NULL;
execve(sProgramm.c_str(),
(char * const *)nargs,
@ -419,9 +419,8 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
const char* nenv[4];
nenv[0] = sLibraryDir.c_str();
nenv[1] = "LD_PRELOAD=./libcef.so";
nenv[2] = NULL;//"DISPLAY=:99";
nenv[3] = NULL;
nenv[1] = NULL;//"DISPLAY=:99";
nenv[2] = NULL;
execve("/usr/bin/xvfb-run", (char * const *)nargs, (char * const *)nenv);
exit(EXIT_SUCCESS);

View File

@ -16,6 +16,11 @@ CONFIG -= debug_and_release debug_and_release_target
DEFINES += HTMLFILE_USE_DYNAMIC_LIBRARY
DEFINES += UNICODECONVERTER_USE_DYNAMIC_LIBRARY
CORE_ROOT_DIR = $$PWD/../..
PWD_ROOT_DIR = $$PWD
include($$CORE_ROOT_DIR/Common/base.pri)
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/Debug
} else {
@ -25,41 +30,10 @@ CONFIG(debug, debug|release) {
CONFIG += c++11
TEMPLATE = app
############### destination path ###############
DESTINATION_SDK_PATH = $$PWD/../../build/lib
# WINDOWS
win32:contains(QMAKE_TARGET.arch, x86_64):{
CONFIG(debug, debug|release) {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_64/DEBUG
} else {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_64
}
}
win32:!contains(QMAKE_TARGET.arch, x86_64):{
CONFIG(debug, debug|release) {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_32/DEBUG
} else {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_32
}
}
linux-g++:contains(QMAKE_HOST.arch, x86_64):{
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/linux_64
}
linux-g++:!contains(QMAKE_HOST.arch, x86_64):{
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/linux_32
}
LIBS += -L$$DESTINATION_SDK_PATH -lHtmlFile
LIBS += -L$$DESTINATION_SDK_PATH -lUnicodeConverter
LIBS += -L$$DESTINATION_SDK_PATH -lgraphics
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lUnicodeConverter -lkernel -lgraphics -lHtmlFile
linux-g++ | linux-g++-64 | linux-g++-32 {
QMAKE_LFLAGS += -Wl,--rpath=./
LIBS += $$PWD/../../build/bin/icu/linux_64/libicuuc.so.55
LIBS += $$PWD/../../build/bin/icu/linux_64/libicudata.so.55
message(linux)
}
@ -67,9 +41,6 @@ win32 {
LIBS += -ladvapi32 \
-luser32 \
-lshell32
LIBS += -L$$PWD/../../build/bin/icu/win_64/ -licudt
LIBS += -L$$PWD/../../build/bin/icu/win_64/ -licuuc
}
SOURCES += main.cpp

View File

@ -11,7 +11,7 @@ apply from: "$rootProject.projectDir/extra-builds/gradle/common.gradle"
// Common native libs path
def TOOLCHAIN_VERSION = 4.9
def NDK_VERSION = "android-ndk-r17c"
def HOST_PLATFORM = getHostName()
def HOST_PLATFORM = getHostNameFull()
def PATH_NDK = "${project.rootDir.path}/${NDK_VERSION}"
def PATH_TOOLCHAIN = "$PATH_NDK/toolchains/\$1/prebuilt/$HOST_PLATFORM/bin"
def PATH_STANDALONE_SCRIPT = "$PATH_NDK/build/tools"
@ -43,7 +43,7 @@ def ICONV_LIBS_PATH = "$project.ext.PATH_TO_NATIVE_LIBS/iconv"
def ICONV_LIBS_INSTALL = "$ICONV_LIBS_PATH/install"
// Icu
def ICU_SRC = "$PATH_3PARTY/icu/" + getDirName("$PATH_3PARTY/icu")
def ICU_SRC = "$PATH_3PARTY/icu/" + findDirName("$PATH_3PARTY/icu", getHostName())
def ICU_BUILD = "$ICU_SRC/build"
def ICU_SRC_ROOT = "$ICU_SRC/icu/source"
def ICU_LIBS_PATH = "$project.ext.PATH_TO_NATIVE_LIBS/icu"

View File

@ -28,7 +28,8 @@ endif()
if (NOT DEFINED ARG_LIBS)
message(FATAL_ERROR "You must set argument \"ARG_LIBS\" with path to 3d-party library...")
elseif (NOT EXISTS ${ARG_LIBS})
message(FATAL_ERROR "3d party libraries path doesn't exist!")
file(MAKE_DIRECTORY ${ARG_LIBS})
message(STATUS "3d party libraries path doesn't exist! Created!")
endif()
# ---------- Libs names ----------

View File

@ -89,13 +89,15 @@ def getBackSlashExt(String str) {
return str.replaceAll("\\\\", "/")
}
def getDirNameExt(String path) {
def findDirNameExt(String path, String name) {
def countFolders = 0
def nameFolder = ''
file(path).listFiles().each { it ->
if (it.isDirectory()) {
nameFolder = it.getName()
++countFolders
if (it.getName().contains(name)) {
nameFolder = it.getName()
++countFolders
}
}
}
@ -144,7 +146,7 @@ ext {
// Extra path
// Args for cmake
project.ext.SRC_CORE = "$rootProject.rootDir/../../../"
project.ext.SRC_CORE = "$rootProject.rootDir/../../.."
project.ext.PATH_TO_NATIVE_BUILDS = getBackSlashExt("$rootProject.projectDir/extra-builds/native")
project.ext.PATH_TO_NATIVE_LIBS = "$project.ext.PATH_TO_NATIVE_BUILDS/libs"
project.ext.PATH_TO_NATIVE_ARCHS = "$project.ext.PATH_TO_NATIVE_BUILDS/libs.tar"
@ -171,7 +173,8 @@ ext {
getPathEnv = this.&getPathEnvOs
isFolderNotEmpty = this.&isFolderNotEmptyCheck
getBackSlash = this.&getBackSlashExt
getDirName = this.&getDirNameExt
getHostName = this.&getHostNameFullExt
findDirName = this.&findDirNameExt
getHostNameFull = this.&getHostNameFullExt
getHostName = this.&getHostNameExt
}