Compare commits

..

14 Commits

Author SHA1 Message Date
1393de8057 v5.3.0 2019-05-27 17:21:45 +03:00
2092aef589 [ios][odf] fixed build 2019-05-27 13:58:50 +03:00
eff937699b . 2019-05-27 13:39:25 +03:00
3efc1f0432 [ios][x2t] fixed build 2019-05-27 13:01:12 +03:00
69fee1ae0b . 2019-05-23 20:03:25 +03:00
a0cc6b6274 OdfFormatWriter - ...; fix vml comment 2019-05-23 17:28:24 +03:00
31eb395858 OdfFormat - ... 2019-05-21 19:05:00 +03:00
ed1019a004 Not writing transparency group in pdfa mode 2019-05-20 17:09:22 +03:00
4e554d128a Merge pull request #143 from ONLYOFFICE/feature/tester
Feature/tester
2019-05-20 14:39:17 +03:00
b8d441a327 Fix remove exe 2019-05-20 14:34:24 +03:00
8fb809bf4a tester 2019-05-20 14:22:26 +03:00
35c4d70cf5 Fix bug 41615 2019-05-20 11:57:52 +03:00
0b987aeed2 Add variable for xp support 2019-05-17 15:00:16 +03:00
aefb229343 [x2t] Fix typo (Core props) 2019-05-16 18:25:10 +03:00
40 changed files with 843 additions and 164 deletions

View File

@ -92,8 +92,9 @@ public:
std::wstring convert_conditional_formula(std::wstring const & expr);
// Лист1!$A$1 -> $Лист1.$A$1
std::wstring convert_named_ref (std::wstring const & expr);
std::wstring convert_named_ref(std::wstring const & expr);
std::wstring convert_named_formula(std::wstring const & expr);
bool is_simple_ref(std::wstring const & expr);
std::wstring get_table_name();

View File

@ -174,6 +174,7 @@ public:
}
void replace_named_ref(std::wstring & expr);
void replace_named_formula(std::wstring & expr);
bool is_simple_ref(std::wstring const & expr);
static bool isFindBaseCell_;
@ -195,7 +196,7 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr, bool bSele
if (b)
{
boost::wregex re1(L"(\\$?[^\']+\\!)?([\\w^0-9$]*\\d*)\\:?([\\w^0-9$]*\\d*)?");
boost::wregex re1(L"(\\$?[^\\']+\\!)?([a-zA-Z$]+\\d*)(\\:[a-zA-Z$]+\\d*)?");
// $ Sheet2 ! $ A1 : $ B5
// $ Sheet2 ! $ A : $ A
// $ Sheet2 ! $ 1 : $ 1
@ -238,9 +239,11 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
{
table_name_ = sheet + L".$A$1";
table_name_ = L"$" + sheet + L".$A$1";
}
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
if (!c2.empty() && c2.substr(0, 1) == L":")
c2 = c2.substr(1);
s = L"[" + sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"]");
@ -281,10 +284,12 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
if (isFindBaseCell_ && table_name_.empty() && !sheet.empty())
{
table_name_ = sheet + L".$A$1";
table_name_ = L"$" + sheet + L".$A$1";
}
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
if (!c2.empty() && c2.substr(0, 1) == L":")
c2 = c2.substr(1);
s = sheet + L"." + c1 + (c2.empty() ? L"" : (L":" + sheet + L"." + c2)) + std::wstring(L"");
}
@ -310,6 +315,19 @@ void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
expr = convert_formula(expr);
isFindBaseCell_ = false;
}
bool oox2odf_converter::Impl::is_simple_ref(std::wstring const & expr)
{
if (expr.find(L"(") != std::wstring::npos) return false;
if (expr.find(L" ") != std::wstring::npos) return false;
if (expr.find(L";") != std::wstring::npos) return false;
boost::wsmatch match;
if (boost::regex_search(expr, match, boost::wregex(L"([\\w]+\\!)?\\$?[a-zA-Z]+\\$?\\d+(\\:\\$?[a-zA-Z]+\\$?\\d+)?")))
{
return true;
}
return false;
}
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
{
@ -644,6 +662,11 @@ std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
impl_->replace_named_formula(workstr);
return workstr;
}
bool oox2odf_converter::is_simple_ref(std::wstring const & expr)
{
return impl_->is_simple_ref(expr);
}
std::wstring oox2odf_converter::get_table_name()
{
return impl_->table_name_;

View File

@ -73,7 +73,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
//if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
// return std::pair<float, float>(7,8);
if (FALSE == (hr = pFontManager->LoadString2( L"xxxxx" , 0, 0)))
if (FALSE == (hr = pFontManager->LoadString2( L"0123456789abcdefghijklmnopqrstuvwxyz" , 0, 0)))
return std::pair<float, float>(7,8);
TBBox box;
@ -96,7 +96,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
if (box.fMaxY - box.fMinY < minHeight) minHeight = box.fMaxY - box.fMinY;
}
double width = (minWidth + 2 * maxWidth) /3. /5.;
double width = (minWidth + 2 * maxWidth) /36. /3.;
return std::pair<float, float>(width, maxHeight);
}

View File

@ -104,7 +104,7 @@ void odf_comment_context::start_comment(office_element_ptr &elm, int oox_id)
office_annotation* comm = dynamic_cast<office_annotation*>(elm.get());
if (!comm)return;
comm->office_annotation_attr_.name_ = impl_->comments_.back().odf_name;
comm->attr_.name_ = impl_->comments_.back().odf_name;
}
@ -117,7 +117,7 @@ void odf_comment_context::end_comment(office_element_ptr &elm, int oox_id)
office_annotation_end* comm = dynamic_cast<office_annotation_end*>(elm.get());
if (!comm)return;
comm->office_annotation_attr_.name_ = impl_->comments_[i].odf_name;
comm->attr_.name_ = impl_->comments_[i].odf_name;
impl_->comments_[i].state = 2;//stoped
@ -206,8 +206,8 @@ void odf_comment_context::set_position (double x, double y)
if (comm)
{
comm->office_annotation_attr_.svg_x_ = odf_types::length(x, odf_types::length::pt);
comm->office_annotation_attr_.svg_y_ = odf_types::length(y, odf_types::length::pt);
comm->attr_.svg_x_ = odf_types::length(x, odf_types::length::pt);
comm->attr_.svg_y_ = odf_types::length(y, odf_types::length::pt);
}
}

View File

@ -62,18 +62,18 @@ namespace utils
void calculate_size_font_symbols(_font_metrix & metrix, NSFonts::IApplicationFonts *appFonts)
{
double appr_px = _graphics_utils_::calculate_size_symbol_asc(metrix.font_name, metrix.font_size, metrix.italic, metrix.bold, appFonts);
std::pair<float,float> appr = _graphics_utils_::calculate_size_symbol_asc(metrix.font_name, metrix.font_size, metrix.italic, metrix.bold, appFonts);
if (appr_px <0.01)
if (appr.first < 0.01 || appr.second < 0.01)
{
appr_px = _graphics_utils_::calculate_size_symbol_win(metrix.font_name,metrix.font_size,false/*metrix.italic*/,false/*metrix.bold*/);
appr_px = ((int)(appr_px+0.5) + 2*(int)appr_px)/3.;
appr.first = _graphics_utils_::calculate_size_symbol_win(metrix.font_name,metrix.font_size,false/*metrix.italic*/,false/*metrix.bold*/);
appr.first = ((int)(appr.first + 0.5) + 2 * (int)appr.first)/3.;
}
if (appr_px > 0)
if (appr.first > 0)
{
//pixels to pt
metrix.approx_symbol_size = appr_px ;///1.1;//"1.2" волшебное число оО
metrix.approx_symbol_size = appr.first ;///1.1;//"1.2" волшебное число оО
metrix.IsCalc = true;
}
@ -102,6 +102,9 @@ void ods_conversion_context::end_document()
if (table_context_.table_defined_expressions_.root)
root_spreadsheet_->add_child_element(table_context_.table_defined_expressions_.root);
if (table_context_.table_content_validations_.root)
root_spreadsheet_->add_child_element(table_context_.table_content_validations_.root);
odf_conversion_context::end_document();
}
@ -295,7 +298,14 @@ void ods_conversion_context::end_comment()
current_table().end_comment(current_text_context_);
end_text_context();
}
void ods_conversion_context::set_comment_color(const std::wstring & color)
{
current_table().set_comment_color(color);
}
void ods_conversion_context::set_comment_visible(bool val)
{
current_table().set_comment_visible(val);
}
void ods_conversion_context::set_comment_rect(double l, double t, double w, double h)//in mm
{
current_table().set_comment_rect(l,t,w,h);
@ -331,11 +341,38 @@ void ods_conversion_context::add_hyperlink(const std::wstring & ref, const std::
current_table().add_hyperlink(ref, col, row, link, bLocation);
}
}
bool ods_conversion_context::start_data_validation(const std::wstring & ref, int type)
{
return table_context_.start_data_validation(ref, type);
}
void ods_conversion_context::end_data_validation()
{
table_context_.end_data_validation();
}
void ods_conversion_context::set_data_validation_allow_empty(bool val)
{
table_context_.set_data_validation_allow_empty(val);
}
void ods_conversion_context::set_data_validation_content(const std::wstring &val1, const std::wstring &val2)
{
table_context_.set_data_validation_content(val1, val2);
}
void ods_conversion_context::set_data_validation_operator(int val)
{
table_context_.set_data_validation_operator(val);
}
void ods_conversion_context::set_data_validation_error(const std::wstring &title, const std::wstring &content)
{
table_context_.set_data_validation_error(title, content);
}
void ods_conversion_context::set_data_validation_promt(const std::wstring &title, const std::wstring &content)
{
table_context_.set_data_validation_promt(title, content);
}
void ods_conversion_context::add_merge_cells(const std::wstring & ref)
{
std::vector<std::wstring> ref_cells;
boost::algorithm::split(ref_cells,ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
boost::algorithm::split(ref_cells, ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (ref_cells.size() != 2) return;//тута однозначно .. по правилам оохml

View File

@ -97,10 +97,20 @@ public:
void start_comment (int col, int row, std::wstring & author);
void set_comment_rect (double l, double t, double w, double h);
void set_comment_visible(bool val);
void set_comment_color (const std::wstring & color);
void end_comment ();
///////////////////////////////////////////////////////
ods_table_state & current_table() { return table_context_.state();}
/////////////////////////////////////////////////////
bool start_data_validation(const std::wstring & ref, int type);
void set_data_validation_operator(int val);
void set_data_validation_content(const std::wstring &val1, const std::wstring &val2);
void set_data_validation_allow_empty(bool val);
void set_data_validation_error(const std::wstring &title, const std::wstring &content);
void set_data_validation_promt(const std::wstring &title, const std::wstring &content);
void end_data_validation();
//-----------------------------------------------------------------------
ods_table_state & current_table() { return table_context_.state();}
//-----------------------------------------------------------------------
virtual void start_text_context();
virtual void end_text_context();

View File

@ -37,7 +37,9 @@
#include "ods_conversion_context.h"
#include "logging.h"
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include "../../../ASCOfficeOdfFile/formulasconvert/formulasconvert.h"
@ -47,6 +49,32 @@ namespace cpdoccore {
namespace odf_writer {
std::wstring getColAddress(size_t col)
{
static const size_t r = (L'Z' - L'A' + 1);
std::wstring res;
size_t r0 = col / r;
if (r0 > 0)
{
const std::wstring rest = getColAddress(col - r * r0);
const std::wstring res = getColAddress(r0-1) + rest;
return res;
}
else
return std::wstring(1, (wchar_t)(L'A' + col));
}
std::wstring getRowAddress(size_t row)
{
return std::to_wstring(row + 1);
}
std::wstring getCellAddress(size_t col, size_t row)
{
return getColAddress(col) + getRowAddress(row);
}
ods_table_context::ods_table_context(ods_conversion_context & Context): context_(Context)
{
}
@ -125,7 +153,6 @@ void ods_table_context::set_table_part_autofilter(bool val)
void ods_table_context::end_table_part()
{
}
void ods_table_context::add_autofilter(std::wstring ref)
{
if (!table_database_ranges_.root) create_element(L"table", L"database-ranges",table_database_ranges_.root,&context_);
@ -147,6 +174,253 @@ void ods_table_context::add_autofilter(std::wstring ref)
table_database_ranges_.elements.push_back(elm);
}
bool ods_table_context::start_data_validation( const std::wstring &strRef, int type)
{
if (!table_content_validations_.root) create_element(L"table", L"content-validations", table_content_validations_.root, &context_);
office_element_ptr elm;
create_element(L"table", L"content-validation", elm, &context_);
table_content_validation *validation = dynamic_cast<table_content_validation*>(elm.get());
if (!validation) return false;
std::vector<std::wstring> arRefs;
boost::algorithm::split(arRefs, strRef, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
data_validation_state validation_state;
validation_state.name = L"DataValidation_" + std::to_wstring(state().data_validations_.size() + 1);
validation_state.elm = elm;
validation_state.type = type;
for (size_t i = 0; i < arRefs.size(); i++)
{
data_validation_state::_ref ref;
ref.ref = arRefs[i];
size_t r = arRefs[i].rfind(L":");
if (r == std::wstring::npos)
{
utils::parsing_ref (arRefs[i].substr(0, r), ref.col_start, ref.row_start);
ref.col_end = ref.col_start;
ref.row_end = ref.row_start;
}
else
{
utils::parsing_ref (arRefs[i].substr(0, r), ref.col_start, ref.row_start);
utils::parsing_ref (arRefs[i].substr(r + 1, arRefs[i].size() - r), ref.col_end, ref.row_end);
}
validation_state.refs.push_back(ref);
}
if (validation_state.refs.empty()) return false;
validation->table_base_cell_address_ = state().office_table_name_ + L"." + getCellAddress(validation_state.refs[0].col_start, validation_state.refs[0].row_start);
validation->table_name_ = validation_state.name;
table_content_validations_.root->add_child_element(elm);
table_content_validations_.elements.push_back(elm);
state().data_validations_.push_back(validation_state);
return true;
}
void ods_table_context::set_data_validation_allow_empty(bool val)
{
if (state().data_validations_.empty()) return;
table_content_validation *validation = dynamic_cast<table_content_validation*>(state().data_validations_.back().elm.get());
validation->table_allowempty_cell_ = val;
}
void ods_table_context::set_data_validation_operator(int val)
{
if (state().data_validations_.empty()) return;
state().data_validations_.back().operator_ = val;
}
void ods_table_context::set_data_validation_content( std::wstring oox_formula1, std::wstring oox_formula2)
{
if (state().data_validations_.empty()) return;
if (oox_formula1.empty() && oox_formula2.empty()) return;
std::wstring odf_formula1, odf_formula2;
if (false == oox_formula1.empty() && oox_formula1[0] == L'\"' && oox_formula1[oox_formula1.length() - 1] == L'\"')
{
oox_formula1 = oox_formula1.substr(1, oox_formula1.length() - 2);
std::vector<std::wstring> arItems;
boost::algorithm::split(arItems, oox_formula1, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
for (size_t i = 0; i < arItems.size(); ++i)
{
odf_formula1 += L"\"" + arItems[i] + L"\"" + (i < arItems.size() - 1 ? L";" : L"");
}
}
else
{
formulasconvert::oox2odf_converter formulas_converter;
odf_formula1 = formulas_converter.convert_formula(oox_formula1);
if (false == odf_formula1.empty())
{
odf_formula1 = odf_formula1.substr(4);
}
}
if (false == oox_formula2.empty() && oox_formula2[0] == L'\"' && oox_formula2[oox_formula2.length() - 1] == L'\"')
{
oox_formula2 = oox_formula1.substr(1, oox_formula2.length() - 2);
std::vector<std::wstring> arItems;
std::wstring str = oox_formula2.substr(1, oox_formula1.length() - 2);
boost::algorithm::split(arItems, str,
boost::algorithm::is_any_of(L","),
boost::algorithm::token_compress_on);
for (size_t i = 0; i < arItems.size(); ++i)
{
odf_formula2 += L"\"" + arItems[i] + L"\"" + (i < arItems.size() - 1 ? L";" : L"");
}
}
else
{
formulasconvert::oox2odf_converter formulas_converter;
odf_formula2 = formulas_converter.convert_formula(oox_formula2);
if (false == odf_formula2.empty())
{
odf_formula2 = odf_formula2.substr(4);
}
}
table_content_validation *validation = dynamic_cast<table_content_validation*>(state().data_validations_.back().elm.get());
std::wstring odf_condition;
switch(state().data_validations_.back().operator_)
{
case 0: // SimpleTypes::spreadsheet::operatorBetween
odf_condition = L" and cell-content-between(" + odf_formula1 + L"," + odf_formula1 + L")"; break;
case 1: // SimpleTypes::spreadsheet::operatorNotBetween
odf_condition = L" and cell-content--not-between(" + odf_formula1 + L"," + odf_formula1 + L")"; break;
case 2: // SimpleTypes::spreadsheet::operatorEqual
odf_condition = L" and cell-content() == " + odf_formula1; break;
case 3: // SimpleTypes::spreadsheet::operatorNotEqual
odf_condition = L" and cell-content() <> " + odf_formula1; break;
case 4: // SimpleTypes::spreadsheet::operatorLessThan
odf_condition = L" and cell-content() < " + odf_formula1; break;
case 5: // SimpleTypes::spreadsheet::operatorLessThanOrEqual
odf_condition = L" and cell-content() <= " + odf_formula1; break;
case 6: // SimpleTypes::spreadsheet::operatorGreaterThan
odf_condition = L" and cell-content() > " + odf_formula1; break;
case 7: // SimpleTypes::spreadsheet::operatorGreaterThanOrEqual
odf_condition = L" and cell-content() >= " + odf_formula1; break;
}
switch (state().data_validations_.back().type)
{
case 0://SimpleTypes::spreadsheet::validationTypeNone:
break;
case 1://SimpleTypes::spreadsheet::validationTypeCustom:
break;
case 2://SimpleTypes::spreadsheet::validationTypeDate:
{
if (state().data_validations_.back().operator_ >= 0)
{
odf_condition = L"of:cell-content-is-date()" + odf_condition;
}
else
{
odf_condition = L"of:cell-content-is-date(" + odf_formula1 + L")";
}
}break;
case 3://SimpleTypes::spreadsheet::validationTypeDecimal:
{
if (state().data_validations_.back().operator_ >= 0)
{
odf_condition = L"of:cell-content-is-decimal-number()" + odf_condition;
}
else
{
odf_condition = L"of:cell-content-is-decimal-number(" + odf_formula1 + L")";
}
}break;
case 4://SimpleTypes::spreadsheet::validationTypeList:
{
odf_condition = L"of:cell-content-is-in-list(" + odf_formula1 + L")";
}break;
case 5://SimpleTypes::spreadsheet::validationTypeTextLength:
break;
case 6://SimpleTypes::spreadsheet::validationTypeTime:
{
if (state().data_validations_.back().operator_ >= 0)
{
odf_condition = L"of:cell-content-is-time()" + odf_condition;
}
else
{
odf_condition = L"of:cell-content-is-time(" + odf_formula1 + L")";
}
}break;
case 7://SimpleTypes::spreadsheet::validationTypeWhole:
{
if (state().data_validations_.back().operator_ >= 0)
{
odf_condition = L"of:cell-content-is-whole-number()" + odf_condition;
}
else
{
odf_condition = L"of:cell-content-is-whole-number(" + odf_formula1 + L")";
}
}break;
}
state().data_validations_.back().condition = odf_condition;
validation->table_condition_ = odf_condition;
}
void ods_table_context::set_data_validation_error(const std::wstring &title, const std::wstring &content)
{
if (state().data_validations_.empty()) return;
office_element_ptr elm;
create_element(L"table", L"error-message", elm, &context_);
table_content_validations_.elements.back()->add_child_element(elm);
table_error_message *error_message = dynamic_cast<table_error_message*>(elm.get());
if (error_message)
{
error_message->table_display_ = true;
if (false == title.empty()) error_message->table_title_ = title;
if (false == content.empty())
{
}
}
}
void ods_table_context::set_data_validation_promt(const std::wstring &title, const std::wstring &content)
{
if (state().data_validations_.empty()) return;
office_element_ptr elm;
create_element(L"table", L"help-message", elm, &context_);
table_content_validations_.elements.back()->add_child_element(elm);
table_help_message *help_message = dynamic_cast<table_help_message*>(elm.get());
if (help_message)
{
help_message->table_display_ = true;
if (false == title.empty()) help_message->table_title_ = title;
if (false == content.empty())
{
}
}
}
void ods_table_context::end_data_validation()
{
}
void ods_table_context::start_defined_expressions(office_element_ptr & root_elm)
{
table_defined_expressions_.root = root_elm;
@ -164,14 +438,14 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std::
std::wstring odf_range = formulas_converter.convert_named_ref(cell_range);//todo - разделить конвертацию диапазонов/рэнжей на c [] и без
std::wstring odf_base_cell = formulas_converter.get_table_name() + L".$A$1";
std::wstring odf_base_cell = formulas_converter.get_table_name();
named_range->table_name_ = name;
named_range->table_cell_range_address_ = odf_range;
if (printable)
named_range->table_range_usable_as_ = L"print-range";
if (odf_base_cell.length() > 0)
if (false == odf_base_cell.empty())
named_range->table_base_cell_address_ = odf_base_cell;
table_defined_expressions_.elements.push_back(elm);
@ -197,23 +471,29 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std::
}
void ods_table_context::add_defined_expression(const std::wstring & name, const std::wstring & value, int sheet_id, bool printable)
{
formulasconvert::oox2odf_converter formulas_converter;
bool simple_range = formulas_converter.is_simple_ref(value);
if (simple_range)//если простой - range, составной - выражение
return add_defined_range (name, value, sheet_id, printable);
office_element_ptr elm;
create_element(L"table", L"named-expression",elm, &context_);
table_named_expression* named_expression = dynamic_cast<table_named_expression*>(elm.get());
if (named_expression == NULL)return;
formulasconvert::oox2odf_converter formulas_converter;
std::wstring odf_value = formulas_converter.convert_named_formula(value);
std::wstring odf_base_cell = formulas_converter.get_table_name() + L".$A$1";
std::wstring odf_base_cell = formulas_converter.get_table_name();
named_expression->table_name_ = name;
named_expression->table_expression_ = odf_value;
if (sheet_id >=0 && sheet_id < table_state_list_.size())
{
odf_base_cell = table_state_list_[sheet_id].office_table_name_ + L".$A$1";
odf_base_cell = L"$" + table_state_list_[sheet_id].office_table_name_ + L".$A$1";
table_state_list_[sheet_id].add_definded_expression(elm);
if ( printable)

View File

@ -74,6 +74,13 @@ public:
void add_table_part_column(std::wstring name);
void end_table_part();
bool start_data_validation(const std::wstring &ref, int type);
void set_data_validation_operator(int val);
void set_data_validation_content(std::wstring val1, std::wstring val2);
void set_data_validation_allow_empty(bool val);
void set_data_validation_error(const std::wstring &title, const std::wstring &content);
void set_data_validation_promt(const std::wstring &title, const std::wstring &content);
void end_data_validation();
private:
ods_conversion_context & context_;
@ -82,6 +89,7 @@ private:
table_additional_elements_state table_defined_expressions_;
table_additional_elements_state table_database_ranges_;
table_additional_elements_state table_content_validations_;
friend class ods_conversion_context;

View File

@ -49,7 +49,6 @@
#include "style_table_properties.h"
#include "style_text_properties.h"
#include "style_paragraph_properties.h"
#include "style_graphic_properties.h"
namespace cpdoccore {
@ -522,7 +521,13 @@ int ods_table_state::is_cell_hyperlink(int col, int row)
}
std::wstring ods_table_state::is_cell_data_validation(int col, int row)
{
for (size_t i = 0; i < data_validations_.size(); i++)
{
if (data_validations_[i].in_ref(col, row))
{
return data_validations_[i].name;
}
}
return L"";
}
int ods_table_state::is_cell_comment(int col, int row, unsigned int repeate_col)
@ -716,20 +721,51 @@ void ods_table_state::start_comment(int col, int row, std::wstring & author)
state.row = row; state.col = col; state.author = author;
create_element(L"office", L"annotation", state.elm, context_);
office_annotation * annotation = dynamic_cast<office_annotation*>(state.elm.get());
if (!annotation)return;
context_->styles_context()->create_style(L"", style_family::Graphic, true, false, -1);
office_element_ptr & style_elm = context_->styles_context()->last_state()->get_office_element();
state.graphic_properties = context_->styles_context()->last_state()->get_graphic_properties();
style* style_ = dynamic_cast<style*>(style_elm.get());
if (style_)
{
annotation->attr_.draw_style_name_ = style_->style_name_;
}
comments_.push_back(state);
}
void ods_table_state::set_comment_color(const std::wstring & color)
{
if (color.empty()) return;
if (comments_.empty()) return;
if (!comments_.back().graphic_properties) return;
comments_.back().graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = L"#" + color;
comments_.back().graphic_properties->common_draw_fill_attlist_.draw_fill_ = odf_types::draw_fill::solid;
}
void ods_table_state::set_comment_visible(bool val)
{
if (comments_.empty()) return;
office_annotation * annotation = dynamic_cast<office_annotation*>(comments_.back().elm.get());
if (!annotation)return;
annotation->attr_.display_ = val;
}
void ods_table_state::set_comment_rect(double l, double t, double w, double h)
{
if (comments_.size() < 1)return;
if (comments_.empty())return;
office_annotation * annotation = dynamic_cast<office_annotation*>(comments_.back().elm.get());
if (!annotation)return;
annotation->office_annotation_attr_.svg_y_ = length(t/10.,length::cm);
annotation->office_annotation_attr_.svg_x_ = length(l/10.,length::cm);
annotation->office_annotation_attr_.svg_width_ = length(w/10.,length::cm);
annotation->office_annotation_attr_.svg_height_ = length(h/10.,length::cm);
annotation->attr_.svg_y_ = length(t/10.,length::cm);
annotation->attr_.svg_x_ = length(l/10.,length::cm);
annotation->attr_.svg_width_ = length(w/10.,length::cm);
annotation->attr_.svg_height_ = length(h/10.,length::cm);
}
void ods_table_state::end_comment(odf_text_context *text_context)
{
@ -766,7 +802,7 @@ void ods_table_state::check_spanned_cells()
int start_col = jt->first;
int end_col = jt->first + jt->second.spanned_cols;
for (size_t i = 0; i < cells_.size(); ++i)
for (size_t i = 0; i < cells_.size(); ++i) //todooo cells_ vector -> map by row
{
if (cells_[i].row > end_row) break;
@ -889,7 +925,7 @@ void ods_table_state::set_cell_formula(std::wstring & formula)
//test external link
bool bExternal = !ods_context->externals_.empty();
boost::wregex re(L"([\[]\\d+[\]])+");
boost::wregex re(L"([\\[]\\d+[\\]])+");
while(bExternal)
{
@ -1006,7 +1042,7 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
std::wstring odf_formula;
if (formula.size() > 0)
if (false == formula.empty())
{
odf_formula = formulas_converter_table.convert_formula(formula);
@ -1014,14 +1050,14 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
std::vector<std::wstring> distance;
boost::algorithm::split(distance, ref,boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (distance.size() >1)
if (distance.size() > 1)
{
int col1, row1, col2, row2;
utils::parsing_ref(distance[0],col1,row1);
utils::parsing_ref(distance[1],col2,row2);
if (row2-row1 >0)moving_type = 2;
if (col2-col1 >0)moving_type = 1;
if (row2 - row1 > 0) moving_type = 2;
if (col2 - col1 > 0)moving_type = 1;
}
ods_shared_formula_state state = {(unsigned int)ind, odf_formula,ref, current_table_column_,current_table_row_, moving_type};
shared_formulas_.push_back(state);

View File

@ -43,6 +43,7 @@
#include "odf_controls_context.h"
#include "office_elements_create.h"
#include "style_graphic_properties.h"
#include "officevaluetype.h"
@ -208,6 +209,8 @@ struct ods_comment_state
office_element_ptr elm;
graphic_format_properties *graphic_properties = NULL;
bool used = false;
};
struct ods_shared_formula_state
@ -240,6 +243,38 @@ struct table_part_state
std::vector<std::pair<std::wstring, std::wstring>> columns; //name, odf_ref
};
struct data_validation_state
{
std::wstring name;
int type = 0;
int operator_ = -1;
office_element_ptr elm;
struct _ref
{
std::wstring ref;
int col_start = 0;
int row_start = 0;
int col_end = 0;
int row_end = 0;
};
std::vector<_ref> refs;
std::wstring condition;
bool in_ref(int col, int row)
{
for (size_t i = 0; i < refs.size(); i++)
{
if (col >= refs[i].col_start && col <= refs[i].col_end && row >= refs[i].row_start && row <= refs[i].row_end)
return true;
}
return false;
}
};
struct ods_array_formula_state
{
std::wstring formula;
@ -337,6 +372,8 @@ public:
void start_comment(int col, int row, std::wstring & author);
void set_comment_rect(double l, double t, double w, double h);
void set_comment_visible(bool val);
void set_comment_color(const std::wstring & color);
void end_comment(odf_text_context *text_context);
void set_merge_cells(int start_col, int start_row, int end_col, int end_row);
@ -408,6 +445,7 @@ private:
std::vector<ods_element_state> columns_;
std::vector<ods_element_state> rows_;
// row column
std::map<int, std::map<int, _spanned_info>> map_merged_cells;
std::vector<office_element_ptr> current_level_;//постоянно меняющийся список уровней ("0-й элемент - сама таблица)
@ -420,6 +458,8 @@ private:
std::vector<table_part_state> table_parts_;
std::vector<data_validation_state> data_validations_;
odf_drawing_context drawing_context_;
odf_controls_context controls_context_;

View File

@ -62,15 +62,15 @@ namespace utils
double calculate_size_font_symbols(std::wstring str_test, std::wstring font_name, double font_size, NSFonts::IApplicationFonts *appFonts)
{
double appr_px = _graphics_utils_::calculate_size_symbol_asc(font_name, font_size, false, false, appFonts);
std::pair<float,float> appr = _graphics_utils_::calculate_size_symbol_asc(font_name, font_size, false, false, appFonts);
if (appr_px <0.01)
if (appr.first < 0.01 || appr.second < 0.01)
{
appr_px = _graphics_utils_::calculate_size_symbol_win(font_name, font_size, false, false, str_test);
appr.first = _graphics_utils_::calculate_size_symbol_win(font_name, font_size, false, false, str_test);
//appr_px = ((int)(appr_px+0.5) + 2*(int)appr_px)/3.;
}
return appr_px*0.55;
return appr.first * 0.55;
}
}
odt_conversion_context::odt_conversion_context(package::odf_document * outputDocument)

View File

@ -142,7 +142,7 @@ void office_annotation_end::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
office_annotation_attr_.serialize(CP_GET_XML_NODE());
attr_.serialize(CP_GET_XML_NODE());
}
}
}
@ -152,7 +152,7 @@ void office_annotation::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
office_annotation_attr_.serialize(CP_GET_XML_NODE());
attr_.serialize(CP_GET_XML_NODE());
if (dc_creator_)dc_creator_->serialize(CP_XML_STREAM());
if (dc_date_) dc_date_->serialize(CP_XML_STREAM());
@ -203,7 +203,7 @@ void officeooo_annotation::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
office_annotation_attr_.serialize(CP_GET_XML_NODE());
attr_.serialize(CP_GET_XML_NODE());
if (dc_creator_)dc_creator_->serialize(CP_XML_STREAM());
if (dc_date_) dc_date_->serialize(CP_XML_STREAM());

View File

@ -122,7 +122,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_annotation_attr office_annotation_attr_;
office_annotation_attr attr_;
private:
office_element_ptr_array content_;
@ -148,7 +148,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
office_annotation_attr office_annotation_attr_;
office_annotation_attr attr_;
//
//private:
// office_element_ptr_array content_;
@ -176,7 +176,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
private:
office_annotation_attr office_annotation_attr_;
office_annotation_attr attr_;
office_element_ptr_array content_;
office_element_ptr dc_date_;

View File

@ -68,7 +68,6 @@ public:
void serialize(std::wostream & strm, const wchar_t * ns, const wchar_t * name );
public:
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
_CP_OPT(odf_types::length_or_percent) fo_max_width_;

View File

@ -1002,7 +1002,7 @@ void table_content_validation::serialize(std::wostream & _Wostream)
CP_XML_ATTR_OPT(L"table:name", table_name_);
CP_XML_ATTR_OPT(L"table:condition", table_condition_);
CP_XML_ATTR_OPT(L"table:display-list", table_display_list_);
CP_XML_ATTR_OPT(L"table:allowempty-cell", table_allowempty_cell_);
CP_XML_ATTR_OPT(L"table:allow-empty-cell", table_allowempty_cell_);
CP_XML_ATTR_OPT(L"table:base-cell-address", table_base_cell_address_);
for (size_t i = 0; i < content_.size(); i++)

View File

@ -112,8 +112,8 @@ void table_named_range::serialize(std::wostream & _Wostream)
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"table:name", table_name_);
CP_XML_ATTR_OPT(L"table:cell-range-address", table_cell_range_address_);
CP_XML_ATTR_OPT(L"table:base-cell-address", table_base_cell_address_);
CP_XML_ATTR_OPT(L"table:cell-range-address", table_cell_range_address_);
CP_XML_ATTR_OPT(L"table:range-usable-as", table_range_usable_as_);
}
}
@ -131,8 +131,8 @@ void table_named_expression::serialize(std::wostream & _Wostream)
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"table:name", table_name_);
CP_XML_ATTR_OPT(L"table:expression", table_expression_);
CP_XML_ATTR_OPT(L"table:base-cell-address", table_base_cell_address_);
CP_XML_ATTR_OPT(L"table:expression", table_expression_);
}
}
}

View File

@ -243,14 +243,8 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDefinedName *oox_defined)
bool printable = false;
if (name == L"_xlnm.Print_Area")printable = true;
//todoooo !!!! сделать анализ на функцию, диапазон, константы .... !!!
if (false)//если простой - range, составной - выражение
ods_context->add_defined_range (name, oox_defined->m_oRef.get2(), sheet_id, printable);
else
ods_context->add_defined_expression (name, oox_defined->m_oRef.get2(), sheet_id, printable);
ods_context->add_defined_expression (name, oox_defined->m_oRef.get2(), sheet_id, printable);
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
{
@ -305,6 +299,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
}
}
}
convert(oox_sheet->m_oDataValidations.GetPointer());
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//колонки
ods_context->start_columns();
@ -368,7 +363,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
}
/////////////////////////////////////////////////////////////////////////
convert(oox_sheet->m_oDataValidations.GetPointer());
convert(oox_sheet->m_oSheetViews.GetPointer());
convert(oox_sheet->m_oHeaderFooter.GetPointer());
convert(oox_sheet->m_oPageSetup.GetPointer());
@ -428,6 +422,36 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDataValidations *oox_validations)
void XlsxConverter::convert(OOX::Spreadsheet::CDataValidation *oox_validation)
{
if (!oox_validation) return;
if (!oox_validation->m_oSqRef.IsInit()) return;
if (false == ods_context->start_data_validation(*oox_validation->m_oSqRef, oox_validation->m_oType.IsInit() ? oox_validation->m_oType->GetValue() : 0)) return;
if (oox_validation->m_oOperator.IsInit())
{
ods_context->set_data_validation_operator(oox_validation->m_oOperator->GetValue());
}
if (oox_validation->m_oAllowBlank.IsInit())
{
ods_context->set_data_validation_allow_empty(oox_validation->m_oAllowBlank->ToBool());
}
std::wstring formula_1, formula_2;
if (oox_validation->m_oFormula1.IsInit()) formula_1 = oox_validation->m_oFormula1->m_sText;
if (oox_validation->m_oFormula2.IsInit()) formula_2 = oox_validation->m_oFormula2->m_sText;
ods_context->set_data_validation_content(formula_1, formula_2);
if (oox_validation->m_oShowErrorMessage.IsInit() && oox_validation->m_oShowErrorMessage->ToBool())
{
ods_context->set_data_validation_error(oox_validation->m_oErrorTitle.IsInit() ? *oox_validation->m_oErrorTitle : L"",
oox_validation->m_oError.IsInit() ? *oox_validation->m_oError : L"");
}
if (oox_validation->m_oShowInputMessage.IsInit() && oox_validation->m_oShowInputMessage->ToBool())
{
ods_context->set_data_validation_promt(oox_validation->m_oPromptTitle.IsInit() ? *oox_validation->m_oPromptTitle : L"",
oox_validation->m_oPromt.IsInit() ? *oox_validation->m_oPromt : L"");
}
ods_context->end_data_validation();
}
void XlsxConverter::convert(OOX::Spreadsheet::CPictureWorksheet *oox_background)
@ -516,7 +540,18 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCommentItem * oox_comment)
{
ods_context->set_comment_rect(oox_comment->m_dLeftMM.get(), oox_comment->m_dTopMM.get(), oox_comment->m_dWidthMM.get(), oox_comment->m_dHeightMM.get());
}
if (oox_comment->m_bVisible.IsInit())
{
ods_context->set_comment_visible(*oox_comment->m_bVisible);
}
if (oox_comment->m_sFillColorRgb.IsInit())
{
ods_context->set_comment_color(*oox_comment->m_sFillColorRgb);
}
else
{
ods_context->set_comment_color(L"CCFFFF"); //default ms
}
if (oox_comment->m_oText.IsInit())
{
for(size_t i = 0; i < oox_comment->m_oText->m_arrItems.size(); ++i)

View File

@ -150,13 +150,13 @@ namespace _graphics_utils_
#endif
return result;
}
double calculate_size_symbol_asc(std::wstring name, double size, bool italic, bool bold , NSFonts::IApplicationFonts *appFonts)
std::pair<float,float> calculate_size_symbol_asc(std::wstring name, double size, bool italic, bool bold , NSFonts::IApplicationFonts *appFonts)
{
if (name.empty())
name = L"Arial";
std::pair<float,float> val = cpdoccore::utils::GetMaxDigitSizePixels(name, size, 96., 0 , appFonts);
return val.first;
return val;
}
};

View File

@ -42,5 +42,5 @@ namespace _graphics_utils_
{
bool GetResolution(const wchar_t* fileName, double & Width, double &Height);
double calculate_size_symbol_win(std::wstring name, double size, bool italic, bool bold, std::wstring test_str = L"");
double calculate_size_symbol_asc(std::wstring name, double size, bool italic, bool bold , NSFonts::IApplicationFonts *appFonts);
std::pair<float,float> calculate_size_symbol_asc(std::wstring name, double size, bool italic, bool bold , NSFonts::IApplicationFonts *appFonts);
};

View File

@ -79,7 +79,7 @@ namespace PPTX
XmlMacroReadNodeValueBase(oNode, _T("cp:revision"), revision);
XmlMacroReadNodeValueBase(oNode, _T("dc:subject"), subject);
XmlMacroReadNodeValueBase(oNode, _T("dc:title"), title);
XmlMacroReadNodeValueBase(oNode, _T("cp:version"), title);
XmlMacroReadNodeValueBase(oNode, _T("cp:version"), version);
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{
@ -217,7 +217,7 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->WriteNodeValue2(_T("dc:title"), title);
pWriter->WriteNodeValue2(_T("dc:subject"), title);
pWriter->WriteNodeValue2(_T("dc:subject"), subject);
pWriter->WriteNodeValue2(_T("dc:creator"), creator);
pWriter->WriteNodeValue2(_T("cp:keywords"), keywords);
pWriter->WriteNodeValue2(_T("dc:description"), description);
@ -242,9 +242,9 @@ namespace PPTX
pWriter->WriteStringXML(*modified);
pWriter->WriteNodeEnd(_T("dcterms:modified"));
}
pWriter->WriteNodeValue2(_T("cp:category"), revision);
pWriter->WriteNodeValue2(_T("cp:contentStatus"), revision);
pWriter->WriteNodeValue2(_T("cp:version"), revision);
pWriter->WriteNodeValue2(_T("cp:category"), category);
pWriter->WriteNodeValue2(_T("cp:contentStatus"), contentStatus);
pWriter->WriteNodeValue2(_T("cp:version"), version);
pWriter->EndNode(_T("cp:coreProperties"));
}

View File

@ -40,6 +40,11 @@ namespace SimpleTypes
this->m_eValue = hexcolorAuto;
else
{
size_t split = sValue.find(L" ["); //index ala #ff9 [43]
if (std::wstring::npos != split)
{
sValue = sValue.substr(0, split);
}
//В документации не написано, что цвет может приходить строкой, но в реальных докуентах встречается и word это разруливает.
//CHighlightColor<highlightcolorNone> oHighlightColor(sValue);
CHighlightColor<> oHighlightColor(sValue);

View File

@ -1124,45 +1124,48 @@ namespace OOX
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( L"MoveWithCells" == sName ) m_oMoveWithCells = oReader.GetText2();
else if ( L"SizeWithCells" == sName ) m_oSizeWithCells = oReader.GetText2();
else if ( L"Anchor" == sName ) m_oAnchor = oReader.GetText2();
else if ( L"Row" == sName ) m_oRow = oReader.GetText2();
else if ( L"Column" == sName ) m_oColumn = oReader.GetText2();
else if ( L"DefaultSize" == sName ) m_oDefaultSize = oReader.GetText2();
else if ( L"AutoLine" == sName ) m_oAutoLine = oReader.GetText2();
else if ( L"AutoFill" == sName ) m_oAutoFill = oReader.GetText2();
else if ( L"AutoPict" == sName ) m_oAutoPict = oReader.GetText2();
else if ( L"AutoScale" == sName ) m_oAutoScale = oReader.GetText2();
else if ( L"FmlaLink" == sName ) m_oFmlaLink = oReader.GetText2();
else if ( L"FmlaRange" == sName ) m_oFmlaRange = oReader.GetText2();
else if ( L"FmlaMacro" == sName ) m_oFmlaMacro = oReader.GetText2();
else if ( L"FmlaTxbx" == sName ) m_oFmlaTxbx = oReader.GetText2();
else if ( L"FmlaGroup" == sName ) m_oFmlaGroup = oReader.GetText2();
else if ( L"CF" == sName ) m_oCf = oReader.GetText2();
else if ( L"Min" == sName ) m_oMin = oReader.GetText2();
else if ( L"Max" == sName ) m_oMax = oReader.GetText2();
else if ( L"Val" == sName ) m_oVal = oReader.GetText2();
else if ( L"Inc" == sName ) m_oInc = oReader.GetText2();
else if ( L"Sel" == sName ) m_oSel = oReader.GetText2();
else if ( L"WidthMin" == sName ) m_oWidthMin = oReader.GetText2();
else if ( L"Dx" == sName ) m_oDx = oReader.GetText2();
else if ( L"Page" == sName ) m_oPage = oReader.GetText2();
else if ( L"DropLines" == sName ) m_oDropLines = oReader.GetText2();
else if ( L"NoThreeD2" == sName ) m_oNoThreeD2 = oReader.GetText2();
else if ( L"NoThreeD" == sName ) m_oNoThreeD = oReader.GetText2();
else if ( L"DropStyle" == sName ) m_oDropStyle = oReader.GetText2();
else if ( L"FirstButton" == sName ) m_oFirstButton = oReader.GetText2();
else if ( L"VScroll" == sName ) m_oVScroll = oReader.GetText2();
else if ( L"Horiz" == sName ) m_oHoriz = oReader.GetText2();
else if ( L"TextHAlign" == sName ) m_oTextHAlign = oReader.GetText2();
else if ( L"TextVAlign" == sName ) m_oTextVAlign = oReader.GetText2();
else if ( L"Colored" == sName ) m_oColored = oReader.GetText2();
else if ( L"MultiLine" == sName ) m_oMultiLine = oReader.GetText2();
else if ( L"LockText" == sName ) m_oLockText = oReader.GetText2();
else if ( L"JustLastX" == sName ) m_oJustLastX = oReader.GetText2();
else if ( L"SecretEdit" == sName ) m_oSecretEdit = oReader.GetText2();
else if ( L"SelType" == sName ) m_oSelType = oReader.GetText2();
std::wstring sContent = oReader.GetText2();
if ( L"MoveWithCells" == sName ) m_oMoveWithCells = sContent.empty() ? L"t" : sContent;
else if ( L"SizeWithCells" == sName ) m_oSizeWithCells = sContent.empty() ? L"t" : sContent;
else if ( L"Anchor" == sName ) m_oAnchor = sContent;
else if ( L"Row" == sName ) m_oRow = sContent;
else if ( L"Column" == sName ) m_oColumn = sContent;
else if ( L"DefaultSize" == sName ) m_oDefaultSize = sContent.empty() ? L"t" : sContent;
else if ( L"AutoLine" == sName ) m_oAutoLine = sContent.empty() ? L"t" : sContent;
else if ( L"AutoFill" == sName ) m_oAutoFill = sContent.empty() ? L"t" : sContent;
else if ( L"AutoPict" == sName ) m_oAutoPict = sContent.empty() ? L"t" : sContent;
else if ( L"AutoScale" == sName ) m_oAutoScale = sContent.empty() ? L"t" : sContent;
else if ( L"FmlaLink" == sName ) m_oFmlaLink = sContent;
else if ( L"FmlaRange" == sName ) m_oFmlaRange = sContent;
else if ( L"FmlaMacro" == sName ) m_oFmlaMacro = sContent;
else if ( L"FmlaTxbx" == sName ) m_oFmlaTxbx = sContent;
else if ( L"FmlaGroup" == sName ) m_oFmlaGroup = sContent;
else if ( L"CF" == sName ) m_oCf = sContent;
else if ( L"Min" == sName ) m_oMin = sContent;
else if ( L"Max" == sName ) m_oMax = sContent;
else if ( L"Val" == sName ) m_oVal = sContent;
else if ( L"Inc" == sName ) m_oInc = sContent;
else if ( L"Sel" == sName ) m_oSel = sContent.empty() ? L"t" : sContent;
else if ( L"WidthMin" == sName ) m_oWidthMin = sContent;
else if ( L"Dx" == sName ) m_oDx = sContent;
else if ( L"Page" == sName ) m_oPage = sContent;
else if ( L"DropLines" == sName ) m_oDropLines = sContent;
else if ( L"NoThreeD2" == sName ) m_oNoThreeD2 = sContent.empty() ? L"t" : sContent;
else if ( L"NoThreeD" == sName ) m_oNoThreeD = sContent.empty() ? L"t" : sContent;
else if ( L"DropStyle" == sName ) m_oDropStyle = sContent;
else if ( L"FirstButton" == sName ) m_oFirstButton = sContent.empty() ? L"t" : sContent;
else if ( L"VScroll" == sName ) m_oVScroll = sContent.empty() ? L"t" : sContent;
else if ( L"Horiz" == sName ) m_oHoriz = sContent.empty() ? L"t" : sContent;
else if ( L"TextHAlign" == sName ) m_oTextHAlign = sContent;
else if ( L"TextVAlign" == sName ) m_oTextVAlign = sContent;
else if ( L"Colored" == sName ) m_oColored = sContent.empty() ? L"t" : sContent;
else if ( L"MultiLine" == sName ) m_oMultiLine = sContent.empty() ? L"t" : sContent;
else if ( L"LockText" == sName ) m_oLockText = sContent.empty() ? L"t" : sContent;
else if ( L"JustLastX" == sName ) m_oJustLastX = sContent.empty() ? L"t" : sContent;
else if ( L"SecretEdit" == sName ) m_oSecretEdit = sContent.empty() ? L"t" : sContent;
else if ( L"SelType" == sName ) m_oSelType = sContent;
else if ( L"Visible" == sName ) m_oVisible = sContent.empty() ? L"t" : sContent;
}
}
std::wstring CClientData::toXML() const

View File

@ -1529,6 +1529,7 @@ namespace OOX
nullable_int m_oVal;
nullable<SimpleTypes::Spreadsheet::CHorizontalAlignment<>> m_oTextHAlign;
nullable<SimpleTypes::Spreadsheet::CVerticalAlignment<>>m_oTextVAlign;
nullable_bool m_oVisible;
//x:Accel
//x:Accel2
@ -1555,7 +1556,6 @@ namespace OOX
//x:ScriptText
//x:UIObj
//x:ValidIds
//x:Visible
//x:VTEdit
};
//--------------------------------------------------------------------------------

View File

@ -380,7 +380,7 @@ xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
std::wstring sGfxdata;
if(comment->m_sGfxdata.IsInit())
sGfxdata = L"o:gfxdata=\"" + comment->m_sGfxdata.get2() + L"\"";
sGfxdata = L"o:gfxdata=\"" + *comment->m_sGfxdata + L"\"";
std::wstring sShape;
sShape += L"<v:shape id=\"_x0000_s" + boost::lexical_cast<std::wstring>(nIndex++) + L" \" type=\"#_x0000_t202\" style='position:absolute;";

View File

@ -52,17 +52,19 @@ namespace OOX
nullable<unsigned int> m_nTopOffset;
nullable<unsigned int> m_nRightOffset;
nullable<unsigned int> m_nBottomOffset;
nullable<double> m_dLeftMM;
nullable<double> m_dTopMM;
nullable<double> m_dWidthMM;
nullable<double> m_dHeightMM;
nullable<std::wstring> m_sAuthor;
nullable_double m_dLeftMM;
nullable_double m_dTopMM;
nullable_double m_dWidthMM;
nullable_double m_dHeightMM;
nullable_string m_sAuthor;
nullable<unsigned int> m_nRow;
nullable<unsigned int> m_nCol;
nullable<bool> m_bMove;
nullable<bool> m_bSize;
nullable<CSi> m_oText;
nullable<std::wstring> m_sGfxdata;
nullable_bool m_bMove;
nullable_bool m_bSize;
nullable<CSi> m_oText;
nullable_string m_sGfxdata;
nullable_bool m_bVisible;
nullable_string m_sFillColorRgb;
CCommentItem()
{
}

View File

@ -47,9 +47,6 @@ void CDataValidationFormula::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_sNodeName = oReader.GetName();
if (oReader.IsEmptyNode())
return;
m_sText = oReader.GetText3();
}
@ -86,7 +83,7 @@ void CDataValidation::toXML2(NSStringUtils::CStringBuilder& writer, bool bExtend
WritingStringNullableAttrInt (L"showDropDown", m_oShowDropDown, m_oShowDropDown->GetValue());
WritingStringNullableAttrInt (L"showErrorMessage",m_oShowErrorMessage,m_oShowErrorMessage->GetValue());
WritingStringNullableAttrInt (L"showInputMessage",m_oShowInputMessage,m_oShowInputMessage->GetValue());
writer.WriteString(bExtendedWrite ? L">" : L"/>");
writer.WriteString(L">");
if (bExtendedWrite)
{
@ -106,8 +103,23 @@ void CDataValidation::toXML2(NSStringUtils::CStringBuilder& writer, bool bExtend
{
writer.WriteString(L"<xm:sqref>" + m_oSqRef.get() + L"</xm:sqref>");
}
writer.WriteString(L"</" + node_name + L">");
}
else
{
if (m_oFormula1.IsInit())
{
writer.WriteString(L"<formula1>");
writer.WriteString(m_oFormula1->m_sText);
writer.WriteString(L"</formula1>");
}
if (m_oFormula2.IsInit())
{
writer.WriteString(L"<formula2>");
writer.WriteString(m_oFormula2->m_sText);
writer.WriteString(L"</formula2>");
}
}
writer.WriteString(L"</" + node_name + L">");
}
void CDataValidation::fromXML(XmlUtils::CXmlLiteReader& oReader)
@ -137,7 +149,18 @@ void CDataValidation::fromXML(XmlUtils::CXmlLiteReader& oReader)
}
bool CDataValidation::IsExtended()
{
return (m_oFormula1.IsInit() || m_oFormula2.IsInit());
bool result = true;
if (m_oFormula1.IsInit())
{
if (m_oFormula1->m_sText.find(L"!") != std::wstring::npos && m_oFormula1->m_sText != L"#REF!")
result = false;
}
if (m_oFormula2.IsInit())
{
if (m_oFormula2->m_sText.find(L"!") != std::wstring::npos && m_oFormula2->m_sText != L"#REF!")
result = false;
}
return result;
}
void CDataValidation::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{

View File

@ -117,7 +117,7 @@ namespace OOX
nullable<SimpleTypes::COnOff<>> m_oShowInputMessage;
nullable_string m_oSqRef; // ToDo переделать на тип "sqref" (18.18.76) - последовательность "ref", разделенные пробелом
//ext
mutable nullable_string m_oUuid;
nullable<CDataValidationFormula> m_oFormula1;
nullable<CDataValidationFormula> m_oFormula2;

View File

@ -344,13 +344,23 @@ namespace OOX
pCommentItem->m_nBottom = m_aAnchor[6];
pCommentItem->m_nBottomOffset = m_aAnchor[7];
}
pCommentItem->m_bMove = pClientData->m_oMoveWithCells;
pCommentItem->m_bSize = pClientData->m_oSizeWithCells;
pCommentItem->m_bVisible = pClientData->m_oVisible;
if(pClientData->m_oMoveWithCells.IsInit())
pCommentItem->m_bMove = *pClientData->m_oMoveWithCells;
if(pClientData->m_oSizeWithCells.IsInit())
pCommentItem->m_bSize = *pClientData->m_oSizeWithCells;
if (pShape->m_oFillColor.IsInit())
{
BYTE r = pShape->m_oFillColor->Get_R();
BYTE g = pShape->m_oFillColor->Get_G();
BYTE b = pShape->m_oFillColor->Get_B();
std::wstringstream sstream;
sstream << boost::wformat( L"%02X%02X%02X" ) % r % g % b;
for(size_t k = 0 ,length3 = pShape->m_oStyle->m_arrProperties.size(); k < length3; ++k)
pCommentItem->m_sFillColorRgb = sstream.str();
}
for(size_t k = 0; k < pShape->m_oStyle->m_arrProperties.size(); ++k)
{
if (pShape->m_oStyle->m_arrProperties[k] == NULL) continue;

View File

@ -37,6 +37,12 @@ CONFIG(debug, debug|release) {
#PLATFORM
win32 {
CONFIG += core_windows
WINDOWS_VERSION_XP = $$(WINDOWS_VERSION_XP)
!isEmpty(WINDOWS_VERSION_XP) {
CONFIG += build_xp
message(xp using)
}
}
DST_ARCH=$$QMAKE_TARGET.arch

View File

@ -173,6 +173,8 @@
17A7F02B1B13154500760AFB /* SvmPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A7F0221B13154500760AFB /* SvmPlayer.cpp */; };
17DD67B71B7E2778000F800F /* lepton_utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17DD67B51B7E2778000F800F /* lepton_utils.cpp */; };
697B72D41E3B78D90054C17C /* EmfFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697B72D31E3B78D90054C17C /* EmfFile.cpp */; };
8AA0EB9B229BE96B00297DE5 /* SVGTransformer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AA0EB99229BE96B00297DE5 /* SVGTransformer.cpp */; };
8AA0EB9C229BE96B00297DE5 /* SVGFramework.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AA0EB9A229BE96B00297DE5 /* SVGFramework.cpp */; };
8AC2819D2195A582006FA3D7 /* StringExt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC2819B2195A582006FA3D7 /* StringExt.cpp */; };
/* End PBXBuildFile section */
@ -436,6 +438,10 @@
17A7F0231B13154500760AFB /* SvmPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SvmPlayer.h; sourceTree = "<group>"; };
17DD67B51B7E2778000F800F /* lepton_utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lepton_utils.cpp; sourceTree = "<group>"; };
697B72D31E3B78D90054C17C /* EmfFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmfFile.cpp; sourceTree = "<group>"; };
8AA0EB97229BE96B00297DE5 /* SVGFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFramework.h; sourceTree = "<group>"; };
8AA0EB98229BE96B00297DE5 /* SVGTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTransformer.h; sourceTree = "<group>"; };
8AA0EB99229BE96B00297DE5 /* SVGTransformer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformer.cpp; sourceTree = "<group>"; };
8AA0EB9A229BE96B00297DE5 /* SVGFramework.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFramework.cpp; sourceTree = "<group>"; };
8AC2819B2195A582006FA3D7 /* StringExt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringExt.cpp; path = ../../../common/StringExt.cpp; sourceTree = "<group>"; };
8AC2819C2195A582006FA3D7 /* StringExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringExt.h; path = ../../../common/StringExt.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -470,6 +476,7 @@
17A762BC1B0F35320046BC0B /* metafile */ = {
isa = PBXGroup;
children = (
8AA0EB96229BE96B00297DE5 /* svg */,
17A7F0191B13154500760AFB /* StarView */,
17A765081B0F3A3E0046BC0B /* Jp2 */,
17A7631F1B0F38FE0046BC0B /* JBig2 */,
@ -793,6 +800,18 @@
path = ../../../raster/Metafile/StarView;
sourceTree = "<group>";
};
8AA0EB96229BE96B00297DE5 /* svg */ = {
isa = PBXGroup;
children = (
8AA0EB97229BE96B00297DE5 /* SVGFramework.h */,
8AA0EB98229BE96B00297DE5 /* SVGTransformer.h */,
8AA0EB99229BE96B00297DE5 /* SVGTransformer.cpp */,
8AA0EB9A229BE96B00297DE5 /* SVGFramework.cpp */,
);
name = svg;
path = ../../../raster/Metafile/svg;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -827,6 +846,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 17A762B11B0F35320046BC0B;
@ -1002,6 +1022,8 @@
17A763EF1B0F39370046BC0B /* bardecode.cpp in Sources */,
17A7631E1B0F389C0046BC0B /* MetaFileUtils.cpp in Sources */,
17A763231B0F39120046BC0B /* JBig2File.cpp in Sources */,
8AA0EB9C229BE96B00297DE5 /* SVGFramework.cpp in Sources */,
8AA0EB9B229BE96B00297DE5 /* SVGTransformer.cpp in Sources */,
17A765031B0F39370046BC0B /* writefile.cpp in Sources */,
17A764B11B0F39370046BC0B /* psio2stub.cpp in Sources */,
17A764FF1B0F39370046BC0B /* webpio.cpp in Sources */,

View File

@ -3003,8 +3003,9 @@ namespace SVG
bool CreateImage (BYTE* pBuffer, unsigned long Length, int ImageEncoder = INVALID_ENCODER)
{
return false;
}
private:
BYTE* m_pBuffer;
@ -5580,9 +5581,11 @@ namespace SVG
inline bool LoadFromFile (const std::wstring& strFile, Storage* model)
{
#if 0
std::wstring sExt = NSFile::GetFileExtention(strFile);
if (sExt != L"svg" && sExt != L"xml")
return false;
#endif
if (model)
{
@ -5617,19 +5620,26 @@ namespace SVG
}
XmlUtils::CXmlNode oXml;
if (oXml.FromXmlString(sXml))
{
m_nLayerLevel = 0;
if (!oXml.FromXmlString(sXml))
return false;
if (Explore(oXml))
{
m_model->JoinXLinkReference();
m_model->JoinClipPathLinks();
m_model->JoinStyleLinks();
std::wstring sNodeName = oXml.GetName();
if (L"svg" != sNodeName &&
L"g" != sNodeName &&
L"xml" != sNodeName)
return false;
return true;
}
}
m_nLayerLevel = 0;
if (Explore(oXml))
{
m_model->JoinXLinkReference();
m_model->JoinClipPathLinks();
m_model->JoinStyleLinks();
return true;
}
}
return false;
@ -5926,8 +5936,9 @@ namespace SVG
std::wstring strXmlNode = oXmlNode.GetName();
if (!strXmlNode.empty())
{
if ('#' == strXmlNode.c_str()[0])
return false;
const char symbol = strXmlNode.c_str()[0];
if ('#' == symbol)
return NULL;
}
#ifdef _DEBUG

View File

@ -645,15 +645,18 @@ namespace PdfWriter
}
delete[] pA;
if (!m_pTransparencyGroup)
{
m_pTransparencyGroup = new CDictObject();
m_pTransparencyGroup->Add("Type", "Group");
m_pTransparencyGroup->Add("S", "Transparency");
m_pTransparencyGroup->Add("CS", "DeviceRGB");
}
if (!IsPDFA())
{
if (!m_pTransparencyGroup)
{
m_pTransparencyGroup = new CDictObject();
m_pTransparencyGroup->Add("Type", "Group");
m_pTransparencyGroup->Add("S", "Transparency");
m_pTransparencyGroup->Add("CS", "DeviceRGB");
}
pPage->Add("Group", m_pTransparencyGroup);
pPage->Add("Group", m_pTransparencyGroup);
}
double dWidth = pPage->GetWidth();
double dHeight = pPage->GetHeight();
@ -662,7 +665,8 @@ namespace PdfWriter
pXObject->Add("Type", "XObject");
pXObject->Add("Subtype", "Form");
pXObject->Add("BBox", CArrayObject::CreateBox(0, 0, dWidth, dHeight));
pXObject->Add("Group", m_pTransparencyGroup);
if (m_pTransparencyGroup)
pXObject->Add("Group", m_pTransparencyGroup);
CDictObject* pResources = new CDictObject();
pXObject->Add("Resources", pResources);
CDictObject* pResShadings = new CDictObject();

View File

@ -28,6 +28,7 @@ public:
std::wstring m_sOutputFolder;
bool m_bIsStandard;
bool m_bIsDiffAllInOne;
NSCriticalSection::CRITICAL_SECTION m_oCS;
NSCriticalSection::CRITICAL_SECTION m_oCS_OfficeUtils;
@ -55,6 +56,8 @@ public:
m_nCurrent = 0;
m_nCurrentComplete = 0;
m_bIsDiffAllInOne = true;
m_oCS.InitializeCriticalSection();
m_oCS_OfficeUtils.InitializeCriticalSection();
}
@ -521,7 +524,44 @@ public:
if (!NSDirectory::Exists(strDiffs))
NSDirectory::CreateDirectory(strDiffs);
frameO.SaveFile(sPageDiff, 4);
if (!m_pInternal->m_bIsDiffAllInOne)
{
frameO.SaveFile(sPageDiff, 4);
}
else
{
CBgraFrame frameOSrc;
frameOSrc.OpenFile(sPageO);
BYTE* pData1 = frameI.get_Data();
BYTE* pData2 = frameOSrc.get_Data();
BYTE* pData3 = frameO.get_Data();
int nRowW = 4 * nW_I;
BYTE* pDataAll = new BYTE[3 * nRowW * nH_I];
BYTE* pDataAllSrc = pDataAll;
for (int j = 0; j < nH_I; j++)
{
memcpy(pDataAll, pData1, nRowW);
pDataAll += nRowW;
pData1 += nRowW;
memcpy(pDataAll, pData2, nRowW);
pDataAll += nRowW;
pData2 += nRowW;
memcpy(pDataAll, pData3, nRowW);
pDataAll += nRowW;
pData3 += nRowW;
}
CBgraFrame oFrameAll;
oFrameAll.put_Data(pDataAllSrc);
oFrameAll.put_Width(3 * nW_I);
oFrameAll.put_Height(nH_I);
oFrameAll.put_Stride(-3 * nRowW);
oFrameAll.SaveFile(sPageDiff, 4);
}
std::cout << "file (diffs) : " << U_TO_UTF8(sPageDiff) << std::endl;
}

View File

@ -0,0 +1,22 @@
<Settings>
<file>./sdkjs/common/Native/native.js</file>
<file>./sdkjs/common/Native/jquery_native.js</file>
<file>./sdkjs/vendor/xregexp/xregexp-all-min.js</file>
<file>./fonts/AllFonts.js</file>
<htmlfile>./sdkjs/vendor/jquery/jquery.min.js</htmlfile>
<DoctSdk>
<file>./sdkjs/word/sdk-all-min.js</file>
<file>./sdkjs/common/libfont/js/fonts.js</file>
<file>./sdkjs/word/sdk-all.js</file>
</DoctSdk>
<PpttSdk>
<file>./sdkjs/slide/sdk-all-min.js</file>
<file>./sdkjs/common/libfont/js/fonts.js</file>
<file>./sdkjs/slide/sdk-all.js</file>
</PpttSdk>
<XlstSdk>
<file>./sdkjs/cell/sdk-all-min.js</file>
<file>./sdkjs/common/libfont/js/fonts.js</file>
<file>./sdkjs/cell/sdk-all.js</file>
</XlstSdk>
</Settings>

View File

@ -0,0 +1,14 @@
@echo OFF
rem
rem --input="input-standard-files-dir"
rem --output="output-dir"
rem --standard // generate standarts
rem --use-system-fonts="0/1/false/true"
rem --font-dirs="C:\\Windows\\Fonts;/usr/share/fonts;"
rem --cores=4
rem
set RUN_DIR=%~dp0..
cd "%RUN_DIR%"
RMDIR "%RUN_DIR%\result\check" /S /Q
StandardTester.exe --input="%RUN_DIR%\result\out" --output="%RUN_DIR%\result\check" --cores=1

View File

@ -0,0 +1,13 @@
@echo OFF
rem
rem --input="input-standard-files-dir"
rem --output="output-dir"
rem --standard // generate standarts
rem --use-system-fonts="0/1/false/true"
rem --font-dirs="C:\\Windows\\Fonts;/usr/share/fonts;"
rem --cores=4
rem
set RUN_DIR=%~dp0..
cd "%RUN_DIR%"
StandardTester.exe --input="%RUN_DIR%\result\standard" --output="%RUN_DIR%\result\out" --standard --cores=1

View File

@ -0,0 +1,36 @@
@echo OFF
set RUN_DIR=%~dp0..
set GIT_DIR=%RUN_DIR%\..\..\..\..\..
RMDIR "%RUN_DIR%\sdkjs" /S /Q
rem SDKJS UPDATE
md %RUN_DIR%\sdkjs\cell
copy "%GIT_DIR%\sdkjs\cell\sdk-all.js" "%RUN_DIR%\sdkjs\cell\sdk-all.js"
copy "%GIT_DIR%\sdkjs\cell\sdk-all-min.js" "%RUN_DIR%\sdkjs\cell\sdk-all-min.js"
md %RUN_DIR%\sdkjs\slide\themes
copy "%GIT_DIR%\sdkjs\slide\sdk-all.js" "%RUN_DIR%\sdkjs\slide\sdk-all.js"
copy "%GIT_DIR%\sdkjs\slide\sdk-all-min.js" "%RUN_DIR%\sdkjs\slide\sdk-all-min.js"
xcopy /S /E "%GIT_DIR%\sdkjs\slide\themes" "%RUN_DIR%\sdkjs\slide\themes\"
md %RUN_DIR%\sdkjs\word
copy "%GIT_DIR%\sdkjs\word\sdk-all.js" "%RUN_DIR%\sdkjs\word\sdk-all.js"
copy "%GIT_DIR%\sdkjs\word\sdk-all-min.js" "%RUN_DIR%\sdkjs\word\sdk-all-min.js"
md %RUN_DIR%\sdkjs\common\Native
md %RUN_DIR%\sdkjs\common\libfont\js
copy "%GIT_DIR%\sdkjs\common\Native\jquery_native.js" "%RUN_DIR%\sdkjs\common\Native\jquery_native.js"
copy "%GIT_DIR%\sdkjs\common\Native\native.js" "%RUN_DIR%\sdkjs\common\Native\native.js"
copy "%GIT_DIR%\sdkjs\common\libfont\js\fonts.js" "%RUN_DIR%\sdkjs\common\libfont\js\fonts.js"
md %RUN_DIR%\sdkjs\vendor\jquery
copy "%GIT_DIR%\web-apps-pro\vendor\jquery\jquery.min.js" "%RUN_DIR%\sdkjs\vendor\jquery\jquery.min.js"
md %RUN_DIR%\sdkjs\vendor\xregexp
copy "%GIT_DIR%\web-apps-pro\vendor\xregexp\xregexp-all-min.js" "%RUN_DIR%\sdkjs\vendor\xregexp\xregexp-all-min.js"
rem DLLs UPDATE
del /Q /F "%RUN_DIR%\*.dll"
del /Q /F "%RUN_DIR%\x2t.exe"
copy "%GIT_DIR%\server\FileConverter\bin\*.dll" "%RUN_DIR%\."
copy "%GIT_DIR%\server\FileConverter\bin\x2t.exe" "%RUN_DIR%\."

View File

@ -4943,7 +4943,7 @@ void BinaryWorksheetTableWriter::getSavedComment(OOX::Spreadsheet::CCommentItem&
{
if(oComment.m_sGfxdata.IsInit())
{
const std::wstring& sGfxData = oComment.m_sGfxdata.get2();
const std::wstring& sGfxData = *oComment.m_sGfxdata;
std::wstring sSignatureBase64Old(_T("WExTV"));//XLST
std::wstring sSignatureBase64(_T("WExTM"));//XLS2
//compatibility with fact that previously used long that can be 4 or 8 byte
@ -5180,7 +5180,7 @@ void BinaryWorksheetTableWriter::WriteCommentDataContent(OOX::Spreadsheet::CComm
if(pComment->m_sAuthor.IsInit())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_CommentData::UserName);
m_oBcw.m_oStream.WriteStringW(pComment->m_sAuthor.get2());
m_oBcw.m_oStream.WriteStringW(*pComment->m_sAuthor);
}
}
}

View File

@ -3098,8 +3098,7 @@ int BinaryCommentReader::ReadComment(BYTE type, long length, void* poResult)
if(!sGfxdata.empty())
{
pNewComment->m_sGfxdata.Init();
pNewComment->m_sGfxdata->append(sGfxdata);
pNewComment->m_sGfxdata = sGfxdata;
}
}
READ1_DEF(length, res, this->ReadCommentDatas, pNewComment);