From 55531d6edebd2ca796fe88bb6b83cca10d38e665 Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Wed, 25 Aug 2021 07:52:01 +0300 Subject: [PATCH 01/12] fix bug #51935 --- .../src/docx/xlsx_conditionalFormatting.cpp | 32 +- .../src/docx/xlsx_conditionalFormatting.h | 4 +- .../src/docx/xlsxconversioncontext.cpp | 58 +- .../src/docx/xlsxconversioncontext.h | 37 +- ASCOfficeOdfFile/src/odf/calcext_elements.cpp | 78 +- ASCOfficeOdfFile/src/odf/calcext_elements.h | 11 +- .../src/odf/datatypes/timeperiod.cpp | 91 + .../src/odf/datatypes/timeperiod.h | 83 + ASCOfficeOdfFile/win32/cpcommon.vcxproj | 2 + .../win32/cpcommon.vcxproj.filters | 6 + ASCOfficeOdfFile/win32/cpodf.vcxproj | 2 - ASCOfficeOdfFile/win32/cpodf.vcxproj.filters | 6 - .../source/OdfFormat/calcext_elements.h | 10 +- .../source/OdfFormat/ods_table_state.cpp | 48 +- .../source/OdfFormat/ods_table_state.h | 6 +- .../source/Oox2OdfConverter/XlsxConverter.cpp | 2 +- .../PPTFormatLib/PPTXWriter/ShapeWriter.cpp | 36 +- .../XlsxFormat/SimpleTypes_Spreadsheet.h | 1843 +++++++++-------- .../Worksheets/ConditionalFormatting.cpp | 2 +- .../Worksheets/ConditionalFormatting.h | 4 +- .../Common/BinReaderWriterDefines.h | 3 +- XlsxSerializerCom/Reader/BinaryWriter.cpp | 7 +- XlsxSerializerCom/Writer/BinaryReader.cpp | 8 +- 23 files changed, 1322 insertions(+), 1057 deletions(-) create mode 100644 ASCOfficeOdfFile/src/odf/datatypes/timeperiod.cpp create mode 100644 ASCOfficeOdfFile/src/odf/datatypes/timeperiod.h diff --git a/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp b/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp index d0fa542d42..85a830e5c0 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp @@ -94,15 +94,17 @@ namespace oox { std::vector<_cfvo> cfvo; //color scale data_bar(1 element) std::vector color; -//data_bar icon_set +//data bar icon_set _CP_OPT(bool) showValue; -//data_bar +//data bar _CP_OPT(int) minLength; _CP_OPT(int) maxLength; //icon set _CP_OPT(bool) reverse; _CP_OPT(bool) iconset_percent; _CP_OPT(int) iconset_type; +//date is + _CP_OPT(int) time_period; }; struct conditionalFormatting { @@ -220,6 +222,23 @@ public: } } } + else if (c.rules[j].type == 5) + { + CP_XML_ATTR(L"type", L"timePeriod"); + switch (*c.rules[j].time_period) + { + case 0: CP_XML_ATTR(L"timePeriod", L"today"); break; + case 1: CP_XML_ATTR(L"timePeriod", L"yesterday"); break; + case 2: CP_XML_ATTR(L"timePeriod", L"tomorrow"); break; + case 3: CP_XML_ATTR(L"timePeriod", L"last7Days"); break; + case 4: CP_XML_ATTR(L"timePeriod", L"thisMonth"); break; + case 5: CP_XML_ATTR(L"timePeriod", L"lastMonth"); break; + case 6: CP_XML_ATTR(L"timePeriod", L"nextMonth"); break; + case 7: CP_XML_ATTR(L"timePeriod", L"thisWeek"); break; + case 8: CP_XML_ATTR(L"timePeriod", L"lastWeek"); break; + case 9: CP_XML_ATTR(L"timePeriod", L"nextWeek"); break; + } + } } } } @@ -243,7 +262,7 @@ void xlsx_conditionalFormatting_context::serialize(std::wostream & _Wostream) return impl_->serialize(_Wostream); } -void xlsx_conditionalFormatting_context::add(std::wstring ref) +void xlsx_conditionalFormatting_context::start(std::wstring ref) { formulasconvert::odf2oox_converter converter; impl_->conditionalFormattings_.push_back(conditionalFormatting()); @@ -255,7 +274,6 @@ void xlsx_conditionalFormatting_context::add_rule(int type) { impl_->conditionalFormattings_.back().rules.push_back(rule()); impl_->conditionalFormattings_.back().rules.back().type = type; - } void xlsx_conditionalFormatting_context::set_formula(std::wstring f) { @@ -483,7 +501,9 @@ void xlsx_conditionalFormatting_context::set_showVal(bool val) { impl_->conditionalFormattings_.back().rules.back().showValue = val; } - - +void xlsx_conditionalFormatting_context::set_time_period(int val) +{ + impl_->conditionalFormattings_.back().rules.back().time_period = val; +} } } diff --git a/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.h b/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.h index 82eb691e2c..2a5553935c 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.h +++ b/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.h @@ -44,7 +44,8 @@ public: xlsx_conditionalFormatting_context(); ~xlsx_conditionalFormatting_context(); - void add(std::wstring ref); + void start(std::wstring ref); + void end(){} void add_rule(int type); @@ -53,6 +54,7 @@ public: void set_dxf (int dxf_id); void set_showVal(bool val); + void set_time_period(int val); void add_sfv (int type, std::wstring value); void add_color (std::wstring col); diff --git a/ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp b/ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp index 7b9e45eeaf..0da6ff76db 100644 --- a/ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp @@ -672,7 +672,27 @@ int xlsx_conversion_context::get_current_cell_style_id() { return get_table_context().get_current_cell_style_id(); } +int xlsx_conversion_context::get_dxfId_style(const std::wstring &style_name) +{ + if (style_name.empty()) return -1; + int dxfId = -1; + odf_reader::style_instance * instStyle = + root()->odf_context().styleContainer().style_by_name(style_name, odf_types::style_family::TableCell, false); + + if (!instStyle) + instStyle = root()->odf_context().styleContainer().style_by_display_name(style_name, odf_types::style_family::TableCell, false); + + if (instStyle) + { + odf_reader::text_format_properties_content_ptr textFormats = calc_text_properties_content(instStyle); + odf_reader::graphic_format_properties graphicFormats = calc_graphic_properties_content(instStyle); + odf_reader::style_table_cell_properties_attlist cellFormats = calc_table_cell_properties(instStyle); + + dxfId = get_style_manager().dxfId(textFormats, &graphicFormats, &cellFormats); + } + return dxfId; +} std::pair xlsx_conversion_context::getMaxDigitSize() { if (maxDigitSize_.first <= 0.1) @@ -739,7 +759,10 @@ xlsx_drawing_context & xlsx_conversion_context::get_drawing_context() { return get_table_context().get_drawing_context(); } - +xlsx_conditionalFormatting_context & xlsx_conversion_context::get_conditionalFormatting_context() +{ + return get_table_context().state()->get_conditionalFormatting_context(); +} xlsx_drawing_context_handle_ptr & xlsx_conversion_context::get_drawing_context_handle() { return drawing_context_handle_; @@ -791,39 +814,6 @@ void xlsx_conversion_context::add_pivot_sheet_source (const std::wstring & sheet {//ващето в либре жесткая привязка что на одном листе тока одна сводная может быть .. mapPivotsTableView_.insert(std::make_pair(sheet_name, index_table_view)); } - -void xlsx_conversion_context::start_conditional_format(std::wstring ref) -{ - get_table_context().state()->get_conditionalFormatting_context().add(ref); -} -void xlsx_conversion_context::start_conditional_format_rule(int type) -{ - get_table_context().state()->get_conditionalFormatting_context().add_rule(type); -} -void xlsx_conversion_context::set_conditional_format_formula (std::wstring f) -{ - get_table_context().state()->get_conditionalFormatting_context().set_formula(f); -} -void xlsx_conversion_context::set_conditional_format_dxf (int dxfId) -{ - get_table_context().state()->get_conditionalFormatting_context().set_dxf(dxfId); -} -void xlsx_conversion_context::add_conditional_format_entry (int type, std::wstring value) -{ - get_table_context().state()->get_conditionalFormatting_context().add_sfv(type, value); -} -void xlsx_conversion_context::set_conditional_format_showval (bool val) -{ - get_table_context().state()->get_conditionalFormatting_context().set_showVal(val); -} -void xlsx_conversion_context::add_conditional_format_color (std::wstring col) -{ - get_table_context().state()->get_conditionalFormatting_context().add_color(col); -} -void xlsx_conversion_context::set_conditional_format_dataBar (_CP_OPT(int) min, _CP_OPT(int) max) -{ - get_table_context().state()->get_conditionalFormatting_context().set_dataBar(min, max); -} void xlsx_conversion_context::add_jsaProject(const std::string &content) { if (content.empty()) return; diff --git a/ASCOfficeOdfFile/src/docx/xlsxconversioncontext.h b/ASCOfficeOdfFile/src/docx/xlsxconversioncontext.h index 719ae4df4f..f7eae983d2 100644 --- a/ASCOfficeOdfFile/src/docx/xlsxconversioncontext.h +++ b/ASCOfficeOdfFile/src/docx/xlsxconversioncontext.h @@ -115,9 +115,6 @@ public: void start_table_cell (const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned); void end_table_cell (); - - void set_current_cell_style_id (unsigned int xfId); - int get_current_cell_style_id (); void start_table_covered_cell (); void end_table_covered_cell (); @@ -129,24 +126,16 @@ public: void start_hyperlink (const std::wstring & styleName); void end_hyperlink (std::wstring const & href); + + void set_current_cell_style_id (unsigned int xfId); + int get_current_cell_style_id (); + + size_t get_default_cell_style() const { return default_style_; } + int get_dxfId_style(const std::wstring &style_name); //------------------------------------------------------------------------------------ void add_pivot_sheet_source (const std::wstring & sheet_name, int index_table_view); - void start_conditional_format (std::wstring ref); - void end_conditional_format (){} - - void start_conditional_format_rule (int type); - void end_conditional_format_rule () {} - - void set_conditional_format_formula (std::wstring f); - void set_conditional_format_dxf (int dxfId); - void set_conditional_format_showval (bool val); - - void add_conditional_format_color (std::wstring col); - void add_conditional_format_entry (int type, std::wstring value); - void set_conditional_format_dataBar (_CP_OPT(int) min, _CP_OPT(int) max); - void add_jsaProject (const std::string &content); void add_control_props(const std::wstring & rid, const std::wstring & target, const std::wstring & props); @@ -155,7 +144,6 @@ public: void add_table_part(const std::wstring & table) {table_parts_.push_back(table);} size_t get_table_parts_size() {return table_parts_.size();} - //------------------------------------------------------------------------------------ odf_reader::odf_document * root() @@ -172,26 +160,25 @@ public: const xlsx_table_context & get_table_context() const { return xlsx_table_context_; } xlsx_style_manager & get_style_manager() { return xlsx_style_; } forms_context & get_forms_context() { return forms_context_; } - oox_chart_context & current_chart(); math_context & get_math_context() { return math_context_; } num_format_context & get_num_format_context() { return num_format_context_; } - size_t get_default_cell_style() const { return default_style_; } xlsx_defined_names & get_xlsx_defined_names() { return xlsx_defined_names_; } xlsx_pivots_context & get_pivots_context() { return xlsx_pivots_context_;} xlsx_table_metrics & get_table_metrics(); xlsx_drawing_context & get_drawing_context(); xlsx_comments_context & get_comments_context(); xlsx_comments_context_handle & get_comments_context_handle(); - xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;} + xlsx_conditionalFormatting_context & get_conditionalFormatting_context(); - - xlsx_drawing_context_handle_ptr & get_drawing_context_handle(); + xlsx_dataValidations_context & get_dataValidations_context() { return xlsx_dataValidations_context_;} + + xlsx_drawing_context_handle_ptr & get_drawing_context_handle(); void set_drawing_context_handle(xlsx_drawing_context_handle_ptr &handle); mediaitems_ptr & get_mediaitems() { return mediaitems_; } - void set_mediaitems(mediaitems_ptr &items); - + void set_mediaitems(mediaitems_ptr &items); +//--------------------------------------- static std::unordered_map mapExternalLink_; std::map mapUsedNames_; private: diff --git a/ASCOfficeOdfFile/src/odf/calcext_elements.cpp b/ASCOfficeOdfFile/src/odf/calcext_elements.cpp index 1b07f76ee8..b5d84210c7 100644 --- a/ASCOfficeOdfFile/src/odf/calcext_elements.cpp +++ b/ASCOfficeOdfFile/src/odf/calcext_elements.cpp @@ -113,13 +113,13 @@ void calcext_conditional_format::xlsx_convert(oox::xlsx_conversion_context & Con { if (!calcext_target_range_address_) return; - Context.start_conditional_format(*calcext_target_range_address_); + Context.get_conditionalFormatting_context().start(*calcext_target_range_address_); for (size_t i = 0 ; i < content_.size(); i++) { content_[i]->xlsx_convert(Context); } - Context.end_conditional_format(); + Context.get_conditionalFormatting_context().end(); } // calcext_data_bar @@ -130,7 +130,7 @@ const wchar_t * calcext_data_bar::name = L"data-bar"; void calcext_data_bar::add_attributes( const xml::attributes_wc_ptr & Attributes ) { CP_APPLY_ATTR(L"calcext:show-value", calcext_show_value_); - calcext_data_bar_attr_.add_attributes(Attributes); + attr_.add_attributes(Attributes); } void calcext_data_bar::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) @@ -139,20 +139,19 @@ void calcext_data_bar::add_child_element( xml::sax * Reader, const std::wstring } void calcext_data_bar::xlsx_convert(oox::xlsx_conversion_context & Context) { - Context.start_conditional_format_rule(2); + Context.get_conditionalFormatting_context().add_rule(2); if (calcext_show_value_) - Context.set_conditional_format_showval(*calcext_show_value_); + Context.get_conditionalFormatting_context().set_showVal(*calcext_show_value_); - if (calcext_data_bar_attr_.calcext_positive_color_) - Context.add_conditional_format_color(L"ff" + calcext_data_bar_attr_.calcext_positive_color_->get_hex_value()); + if (attr_.calcext_positive_color_) + Context.get_conditionalFormatting_context().add_color(L"ff" + attr_.calcext_positive_color_->get_hex_value()); - Context.set_conditional_format_dataBar(calcext_data_bar_attr_.calcext_min_length_, calcext_data_bar_attr_.calcext_max_length_); + Context.get_conditionalFormatting_context().set_dataBar(attr_.calcext_min_length_, attr_.calcext_max_length_); for (size_t i = 0 ; i < content_.size(); i++) { content_[i]->xlsx_convert(Context); } - Context.end_conditional_format_rule(); } // calcext_color_scale ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -168,12 +167,11 @@ void calcext_color_scale::add_child_element( xml::sax * Reader, const std::wstri } void calcext_color_scale::xlsx_convert(oox::xlsx_conversion_context & Context) { - Context.start_conditional_format_rule(3); + Context.get_conditionalFormatting_context().add_rule(3); for (size_t i = 0 ; i < content_.size(); i++) { content_[i]->xlsx_convert(Context); } - Context.end_conditional_format_rule(); } // calcext_icon_set ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -183,7 +181,7 @@ const wchar_t * calcext_icon_set::name = L"icon-set"; void calcext_icon_set::add_attributes( const xml::attributes_wc_ptr & Attributes ) { CP_APPLY_ATTR(L"calcext:show-value", calcext_show_value_); - calcext_icon_set_attr_.add_attributes(Attributes); + attr_.add_attributes(Attributes); } void calcext_icon_set::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) { @@ -191,15 +189,15 @@ void calcext_icon_set::add_child_element( xml::sax * Reader, const std::wstring } void calcext_icon_set::xlsx_convert(oox::xlsx_conversion_context & Context) { - Context.start_conditional_format_rule(4); + Context.get_conditionalFormatting_context().add_rule(4); + if (calcext_show_value_) - Context.set_conditional_format_showval(*calcext_show_value_); + Context.get_conditionalFormatting_context().set_showVal(*calcext_show_value_); for (size_t i = 0 ; i < content_.size(); i++) { content_[i]->xlsx_convert(Context); } - Context.end_conditional_format_rule(); } // calcext_formatting_entry @@ -219,7 +217,7 @@ void calcext_formatting_entry::add_child_element( xml::sax * Reader, const std:: void calcext_formatting_entry::xlsx_convert(oox::xlsx_conversion_context & Context) { calcext_type::type type_ = calcext_type_.get_value_or(calcext_type::Number).get_type(); - Context.add_conditional_format_entry((int)type_, calcext_value_.get_value_or(L"")); + Context.get_conditionalFormatting_context().add_sfv((int)type_, calcext_value_.get_value_or(L"")); } // calcext_color_scale_entry @@ -240,12 +238,12 @@ void calcext_color_scale_entry::add_child_element( xml::sax * Reader, const std: void calcext_color_scale_entry::xlsx_convert(oox::xlsx_conversion_context & Context) { if (calcext_color_) - Context.add_conditional_format_color(L"ff" + calcext_color_->get_hex_value()); + Context.get_conditionalFormatting_context().add_color(L"ff" + calcext_color_->get_hex_value()); else - Context.add_conditional_format_color(L"ffffffff"); + Context.get_conditionalFormatting_context().add_color(L"ffffffff"); calcext_type::type type_ = calcext_type_.get_value_or(calcext_type::Number).get_type(); - Context.add_conditional_format_entry((int)type_, calcext_value_.get_value_or(L"")); + Context.get_conditionalFormatting_context().add_sfv((int)type_, calcext_value_.get_value_or(L"")); } // calcext_condition ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -254,7 +252,7 @@ const wchar_t * calcext_condition::name = L"condition"; void calcext_condition::add_attributes( const xml::attributes_wc_ptr & Attributes ) { - calcext_condition_attr_.add_attributes(Attributes); + attr_.add_attributes(Attributes); } void calcext_condition::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) { @@ -262,28 +260,18 @@ void calcext_condition::add_child_element( xml::sax * Reader, const std::wstring } void calcext_condition::xlsx_convert(oox::xlsx_conversion_context & Context) { - Context.start_conditional_format_rule(1); + Context.get_conditionalFormatting_context().add_rule(1); - if (calcext_condition_attr_.calcext_value_) + if (attr_.calcext_value_) { - Context.set_conditional_format_formula(*calcext_condition_attr_.calcext_value_); + Context.get_conditionalFormatting_context().set_formula(*attr_.calcext_value_); } - std::wstring style_name = calcext_condition_attr_.calcext_apply_style_name_.get_value_or(L""); + std::wstring style_name = attr_.calcext_apply_style_name_.get_value_or(L""); - style_instance * instStyle = - Context.root()->odf_context().styleContainer().style_by_name(style_name, style_family::TableCell, false); - if (!instStyle) - instStyle = Context.root()->odf_context().styleContainer().style_by_display_name(style_name, style_family::TableCell, false); - if (instStyle) - { - text_format_properties_content_ptr textFormats = calc_text_properties_content (instStyle); - graphic_format_properties graphicFormats = calc_graphic_properties_content (instStyle); - style_table_cell_properties_attlist cellFormats = calc_table_cell_properties (instStyle); - - int dxfId = Context.get_style_manager().dxfId(textFormats, &graphicFormats, &cellFormats); - Context.set_conditional_format_dxf(dxfId); - } - Context.end_conditional_format_rule(); + int dxfId = Context.get_dxfId_style(style_name); + + if (dxfId >= 0) + Context.get_conditionalFormatting_context().set_dxf(dxfId); } // calcext_condition ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -292,7 +280,7 @@ const wchar_t * calcext_date_is::name = L"date-is"; void calcext_date_is::add_attributes( const xml::attributes_wc_ptr & Attributes ) { - calcext_date_is_attr_.add_attributes(Attributes); + attr_.add_attributes(Attributes); } void calcext_date_is::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) { @@ -300,8 +288,16 @@ void calcext_date_is::add_child_element( xml::sax * Reader, const std::wstring & } void calcext_date_is::xlsx_convert(oox::xlsx_conversion_context & Context) { - //Context.start_conditional_format_rule(5); - //Context.end_conditional_format_rule(); + Context.get_conditionalFormatting_context().add_rule(5); + + Context.get_conditionalFormatting_context().set_time_period(attr_.calcext_date_.get_value_or(odf_types::time_period::today).get_type()); + + std::wstring style_name = attr_.calcext_style_.get_value_or(L""); + + int dxfId = Context.get_dxfId_style(style_name); + + if (dxfId >= 0) + Context.get_conditionalFormatting_context().set_dxf(dxfId); } } diff --git a/ASCOfficeOdfFile/src/odf/calcext_elements.h b/ASCOfficeOdfFile/src/odf/calcext_elements.h index cacaec4618..568362fe9c 100644 --- a/ASCOfficeOdfFile/src/odf/calcext_elements.h +++ b/ASCOfficeOdfFile/src/odf/calcext_elements.h @@ -44,6 +44,7 @@ #include "datatypes/iconset_type.h" #include "datatypes/calcext_type.h" +#include "datatypes/timeperiod.h" namespace cpdoccore { namespace odf_reader { @@ -87,7 +88,7 @@ public: void add_attributes( const xml::attributes_wc_ptr & Attributes ); _CP_OPT(std::wstring) calcext_style_; - _CP_OPT(std::wstring) calcext_date_; + _CP_OPT(odf_types::time_period) calcext_date_; }; ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -151,7 +152,7 @@ public: virtual void xlsx_convert(oox::xlsx_conversion_context & Context); _CP_OPT(bool) calcext_show_value_; - calcext_icon_set_attr calcext_icon_set_attr_; + calcext_icon_set_attr attr_; office_element_ptr_array content_; }; @@ -173,7 +174,7 @@ public: virtual void xlsx_convert(oox::xlsx_conversion_context & Context); _CP_OPT(bool) calcext_show_value_; - calcext_data_bar_attr calcext_data_bar_attr_; + calcext_data_bar_attr attr_; office_element_ptr_array content_; }; CP_REGISTER_OFFICE_ELEMENT2(calcext_data_bar) @@ -212,7 +213,7 @@ public: virtual void xlsx_convert(oox::xlsx_conversion_context & Context); - calcext_date_is_attr calcext_date_is_attr_; + calcext_date_is_attr attr_; }; CP_REGISTER_OFFICE_ELEMENT2(calcext_date_is) @@ -231,7 +232,7 @@ public: virtual void xlsx_convert(oox::xlsx_conversion_context & Context); - calcext_condition_attr calcext_condition_attr_; + calcext_condition_attr attr_; }; CP_REGISTER_OFFICE_ELEMENT2(calcext_condition) diff --git a/ASCOfficeOdfFile/src/odf/datatypes/timeperiod.cpp b/ASCOfficeOdfFile/src/odf/datatypes/timeperiod.cpp new file mode 100644 index 0000000000..31cf7369c9 --- /dev/null +++ b/ASCOfficeOdfFile/src/odf/datatypes/timeperiod.cpp @@ -0,0 +1,91 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +#include "timeperiod.h" +#include + +#include + +namespace cpdoccore { namespace odf_types { + +std::wostream & operator << (std::wostream & _Wostream, const time_period & _Val) +{ + switch(_Val.get_type()) + { + case time_period::yesterday: _Wostream << L"yesterday"; break; + case time_period::tomorrow: _Wostream << L"tomorrow"; break; + case time_period::last7Days: _Wostream << L"last-7-days"; break; + case time_period::thisMonth: _Wostream << L"this-month"; break; + case time_period::lastMonth: _Wostream << L"last-month"; break; + case time_period::nextMonth: _Wostream << L"next-month"; break; + case time_period::thisWeek: _Wostream << L"this-week"; break; + case time_period::lastWeek: _Wostream << L"last-week"; break; + case time_period::nextWeek: _Wostream << L"next-week"; break; + case time_period::today: _Wostream << L"today"; break; + default: + _Wostream << L"today"; break; + } + return _Wostream; +} + +time_period time_period::parse(const std::wstring & Str) +{ + std::wstring tmp = Str; + boost::algorithm::to_lower(tmp); + + if (tmp == L"today") + return time_period(today); + else if (tmp == L"yesterday") + return time_period(yesterday); + else if (tmp == L"tomorrow") + return time_period(tomorrow); + else if (tmp == L"last-7-days") + return time_period(last7Days); + else if (tmp == L"this-month") + return time_period(thisMonth); + else if (tmp == L"last-month") + return time_period(lastMonth); + else if (tmp == L"next-month") + return time_period(nextMonth); + else if (tmp == L"this-week") + return time_period(thisWeek); + else if (tmp == L"last-week") + return time_period(lastWeek); + else if (tmp == L"next-week") + return time_period(nextWeek); + else + { + return time_period(today); + } +} + +} } diff --git a/ASCOfficeOdfFile/src/odf/datatypes/timeperiod.h b/ASCOfficeOdfFile/src/odf/datatypes/timeperiod.h new file mode 100644 index 0000000000..7920306b2c --- /dev/null +++ b/ASCOfficeOdfFile/src/odf/datatypes/timeperiod.h @@ -0,0 +1,83 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +#pragma once + + +#include +#include +#include "odfattributes.h" + + +namespace cpdoccore { namespace odf_types { + +class time_period +{ +public: + enum type + { + today = 0, + yesterday = 1, + tomorrow = 2, + last7Days = 3, + thisMonth = 4, + lastMonth = 5, + nextMonth = 6, + thisWeek = 7, + lastWeek = 8, + nextWeek = 9 + + }; + + time_period() {} + + time_period(type _Type) : type_(_Type) + {} + + type get_type() const + { + return type_; + }; + static time_period parse(const std::wstring & Str); + +private: + type type_; + +}; + +std::wostream & operator << (std::wostream & _Wostream, const time_period & _Val); + +} + +APPLY_PARSE_XML_ATTRIBUTES(odf_types::time_period); + +} + diff --git a/ASCOfficeOdfFile/win32/cpcommon.vcxproj b/ASCOfficeOdfFile/win32/cpcommon.vcxproj index 1478f57960..3922d4b125 100644 --- a/ASCOfficeOdfFile/win32/cpcommon.vcxproj +++ b/ASCOfficeOdfFile/win32/cpcommon.vcxproj @@ -275,6 +275,7 @@ + @@ -402,6 +403,7 @@ + diff --git a/ASCOfficeOdfFile/win32/cpcommon.vcxproj.filters b/ASCOfficeOdfFile/win32/cpcommon.vcxproj.filters index 3334a2dc46..88fac4b0b1 100644 --- a/ASCOfficeOdfFile/win32/cpcommon.vcxproj.filters +++ b/ASCOfficeOdfFile/win32/cpcommon.vcxproj.filters @@ -348,6 +348,9 @@ datatypes odf + + datatypes odf + @@ -674,5 +677,8 @@ datatypes odf + + datatypes odf + \ No newline at end of file diff --git a/ASCOfficeOdfFile/win32/cpodf.vcxproj b/ASCOfficeOdfFile/win32/cpodf.vcxproj index d4faadfafb..4b7c0ecd85 100644 --- a/ASCOfficeOdfFile/win32/cpodf.vcxproj +++ b/ASCOfficeOdfFile/win32/cpodf.vcxproj @@ -274,7 +274,6 @@ /bigobj %(AdditionalOptions) - @@ -464,7 +463,6 @@ - diff --git a/ASCOfficeOdfFile/win32/cpodf.vcxproj.filters b/ASCOfficeOdfFile/win32/cpodf.vcxproj.filters index 12f0dc2fc5..07ee3258e7 100644 --- a/ASCOfficeOdfFile/win32/cpodf.vcxproj.filters +++ b/ASCOfficeOdfFile/win32/cpodf.vcxproj.filters @@ -474,9 +474,6 @@ elements - - elements - elements @@ -939,9 +936,6 @@ elements - - elements - elements diff --git a/ASCOfficeOdfFileW/source/OdfFormat/calcext_elements.h b/ASCOfficeOdfFileW/source/OdfFormat/calcext_elements.h index 5ab0ab20c5..5576895b16 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/calcext_elements.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/calcext_elements.h @@ -39,10 +39,10 @@ #include "office_elements_create.h" - -#include "color.h" -#include "iconset_type.h" -#include "calcext_type.h" +#include "../datatypes/color.h" +#include "../datatypes/iconset_type.h" +#include "../datatypes/calcext_type.h" +#include "../datatypes/timeperiod.h" namespace cpdoccore { namespace odf_writer { @@ -83,7 +83,7 @@ public: void serialize(CP_ATTR_NODE); _CP_OPT(std::wstring) calcext_style_; - _CP_OPT(std::wstring) calcext_date_; + _CP_OPT(odf_types::time_period) calcext_date_; }; ////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.cpp b/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.cpp index 5448523cbb..3fd2659ab4 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.cpp @@ -120,11 +120,11 @@ std::wstring convert_time(const std::wstring & oox_time) sec = millisec /1000.; - hours = sec/60./60.; - minutes = (sec - (hours * 60 * 60))/60.; + hours = (int)(sec/60./60.); + minutes = (int)((sec - (hours * 60 * 60))/60.); sec = sec - (hours *60 + minutes) * 60.; - int sec1 = sec; + int sec1 = (int)sec; std::wstring time_str = std::wstring(L"PT") + (hours < 10 ? L"0" : L"") + boost::lexical_cast(hours) @@ -363,7 +363,7 @@ std::wstring ods_table_state::get_column_default_cell_style(int column) for (size_t i=0; i < columns_.size(); i++) { - if (curr + columns_[i].repeated < column + 1)continue; + if (curr + (int)columns_[i].repeated < column + 1)continue; else { return columns_[i].cell_style_name; @@ -552,7 +552,7 @@ int ods_table_state::is_cell_comment(int col, int row, unsigned int repeate_col) { for (size_t i = 0; i < comments_.size(); i++) { - if ((comments_[i].col < col + repeate_col && comments_[i].col >= col) && comments_[i].row == row && comments_[i].used == false) + if ((comments_[i].col < col + (int)repeate_col && comments_[i].col >= col) && comments_[i].row == row && comments_[i].used == false) { return (int)i; } @@ -961,9 +961,9 @@ void ods_table_state::set_cell_formula(std::wstring & formula) std::wstring refExternal = result[1].str(); int idExternal = XmlUtils::GetInteger(refExternal.substr(1, refExternal.length() - 1)) - 1; - bExternal = idExternal >= 0 && idExternal < ods_context->externals_.size(); + bExternal = (idExternal >= 0 && idExternal < (int)ods_context->externals_.size()); - while(idExternal >= 0 && idExternal < ods_context->externals_.size()) + while(idExternal >= 0 && idExternal < (int)ods_context->externals_.size()) { size_t pos = formula.find(refExternal); if (pos == std::wstring::npos) @@ -1180,7 +1180,7 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x, for (i = 0; i < columns_.size(); i++) { - if (oox_pos.col > columns_[i].repeated + curr_col) + if (oox_pos.col >(int)(columns_[i].repeated + curr_col)) { sz_col += (columns_[i].repeated ) * columns_[i].size; } @@ -1193,7 +1193,7 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x, curr_col += columns_[i].repeated; } - if (curr_col < oox_pos.col && columns_.size() > 0) + if ((int)curr_col < oox_pos.col && false == columns_.empty()) { sz_col += (oox_pos.col - curr_col) * columns_[columns_.size() - 1].size; } @@ -1205,7 +1205,7 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x, size_t curr_row =0 ; for (i = 0; i < rows_.size(); i++) { - if (oox_pos.row > rows_[i].repeated + curr_row) + if (oox_pos.row >(int)(rows_[i].repeated + curr_row)) { sz_row += (rows_[i].repeated ) * rows_[i].size; } @@ -1219,7 +1219,7 @@ void ods_table_state::convert_position(oox_table_position & oox_pos, double & x, curr_row += rows_[i].repeated; } - if (curr_row < oox_pos.row && rows_.size() > 0) + if ((int)curr_row < oox_pos.row && false == rows_.empty()) { sz_row += (oox_pos.row - curr_row ) * rows_[rows_.size() - 1].size; } @@ -1745,14 +1745,30 @@ void ods_table_state::set_conditional_style_name(const std::wstring &style_name) calcext_condition* condition = dynamic_cast (current_level_.back().get()); calcext_date_is* date_is = dynamic_cast (current_level_.back().get()); - if (condition) condition->attr_.calcext_apply_style_name_ = style_name; - if (date_is) date_is->attr_.calcext_style_ = style_name; + if (condition) condition->attr_.calcext_apply_style_name_ = style_name; + if (date_is) date_is->attr_.calcext_style_ = style_name; } -void ods_table_state::set_conditional_time(const std::wstring &period) +void ods_table_state::set_conditional_time(int period) { calcext_date_is* date_is = dynamic_cast(current_level_.back().get()); if (date_is) - date_is->attr_.calcext_date_ = period; + { + switch (period) + { + case 1: date_is->attr_.calcext_date_ = odf_types::time_period::yesterday; break; + case 2: date_is->attr_.calcext_date_ = odf_types::time_period::tomorrow; break; + case 3: date_is->attr_.calcext_date_ = odf_types::time_period::last7Days; break; + case 4: date_is->attr_.calcext_date_ = odf_types::time_period::thisMonth; break; + case 5: date_is->attr_.calcext_date_ = odf_types::time_period::lastMonth; break; + case 6: date_is->attr_.calcext_date_ = odf_types::time_period::nextMonth; break; + case 7: date_is->attr_.calcext_date_ = odf_types::time_period::thisWeek; break; + case 8: date_is->attr_.calcext_date_ = odf_types::time_period::lastWeek; break; + case 9: date_is->attr_.calcext_date_ = odf_types::time_period::nextWeek; break; + case 0: + default: + date_is->attr_.calcext_date_ = odf_types::time_period::today; + } + } } void ods_table_state::set_conditional_text(const std::wstring &text) { @@ -1874,7 +1890,7 @@ void ods_table_state::add_conditional_colorscale(int index, _CP_OPT(color) color calcext_color_scale *scale = dynamic_cast(current_level_.back().get()); if (!scale) return; - if (index >= scale->content_.size() || index < 0) return; + if (index >= (int)scale->content_.size() || index < 0) return; calcext_color_scale_entry* color_scale_entry = dynamic_cast(scale->content_[index].get()); diff --git a/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h b/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h index eed66912e9..8d9d198ad9 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h @@ -275,7 +275,7 @@ struct data_validation_state { if (row < refs[i].row_start || row > refs[i].row_end) continue; - if (col + repeate_col <= refs[i].col_start || col > refs[i].col_end) continue; + if (col + (int)repeate_col <= refs[i].col_start || col > refs[i].col_end) continue; ref = refs[i]; return true; @@ -286,7 +286,7 @@ struct data_validation_state { for (size_t i = 0; i < refs.size(); i++) { - if (row + repeate_row <= refs[i].row_start || row > refs[i].row_end) continue; + if (row + (int)repeate_row <= refs[i].row_start || row > refs[i].row_end) continue; ref = refs[i]; return true; @@ -387,7 +387,7 @@ public: void set_conditional_text(const std::wstring &text); - void set_conditional_time(const std::wstring &period); + void set_conditional_time(int period); void end_conditional_rule(); void end_conditional_format(); void end_conditional_formats(); diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp index 7a0088a7e7..128727d8bf 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp @@ -3259,7 +3259,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_co ods_context->current_table()->set_conditional_text(*oox_cond_rule->m_oText); if (oox_cond_rule->m_oTimePeriod.IsInit()) - ods_context->current_table()->set_conditional_time(*oox_cond_rule->m_oTimePeriod); + ods_context->current_table()->set_conditional_time(oox_cond_rule->m_oTimePeriod->GetValue()); convert(oox_cond_rule->m_oIconSet.GetPointer()); convert(oox_cond_rule->m_oColorScale.GetPointer()); diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp index aa2cdff02f..27a6c703a0 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp @@ -794,10 +794,13 @@ void PPT_FORMAT::CShapeWriter::WriteGroupInfo() { std::wstring rId = m_pRels->WriteHyperlink(pGroupElement->m_sHyperlink); - m_oWriter.WriteString(std::wstring(L"")); + if (false == rId.empty()) + { + m_oWriter.WriteString(std::wstring(L"")); + } } m_oWriter.WriteString(std::wstring(L"")); @@ -844,10 +847,13 @@ void PPT_FORMAT::CShapeWriter::WriteTableInfo() { std::wstring rId = m_pRels->WriteHyperlink(pGroupElement->m_sHyperlink); - m_oWriter.WriteString(std::wstring(L"")); + if (false == rId.empty()) + { + m_oWriter.WriteString(std::wstring(L"")); + } } m_oWriter.WriteString(std::wstring(L"")); @@ -895,10 +901,13 @@ void PPT_FORMAT::CShapeWriter::WriteShapeInfo() { std::wstring rId = m_pRels->WriteHyperlink(pShapeElement->m_sHyperlink); - m_oWriter.WriteString(std::wstring(L"")); + if (false == rId.empty()) + { + m_oWriter.WriteString(std::wstring(L"")); + } } m_oWriter.WriteString(std::wstring(L"")); @@ -1705,6 +1714,9 @@ void PPT_FORMAT::CShapeWriter::WriteHyperlink(const std::vectorm_eValue = typeQueryTable; else if ( L"worksheet" == sValue ) this->m_eValue = typeWorksheet; else if ( L"xml" == sValue ) this->m_eValue = typeXml; - else this->m_eValue = eDefValue; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -190,7 +190,7 @@ namespace SimpleTypes else if ( L"none" == sValue ) this->m_eValue = none_method; else if ( L"prompt" == sValue ) this->m_eValue = prompt_method; else if ( L"stored" == sValue ) this->m_eValue = stored_method; - else this->m_eValue = integrated_method; + else this->m_eValue = integrated_method; return this->m_eValue; } @@ -231,7 +231,7 @@ namespace SimpleTypes if ( L"hidden" == sValue ) this->m_eValue = visibleHidden; else if ( L"veryHidden" == sValue ) this->m_eValue = visibleVeryHidden; else if ( L"visible" == sValue ) this->m_eValue = visibleVisible; - else this->m_eValue = eDefValue; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -266,7 +266,7 @@ namespace SimpleTypes if ( L"none" == sValue ) this->m_eValue = htmlNone; else if ( L"veryHidden" == sValue ) this->m_eValue = htmlRtf; else if ( L"visible" == sValue ) this->m_eValue = htmlAll; - else this->m_eValue = eDefValue; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -547,25 +547,25 @@ namespace SimpleTypes std::wstring sRes; switch(this->m_eValue) { - case fontcharsetANSI: sRes = _T("00");break; - case fontcharsetDefault: sRes = _T("01");break; - case fontcharsetSymbol: sRes = _T("02");break; - case fontcharsetMacintosh: sRes = _T("4D");break; - case fontcharsetShitJIS: sRes = _T("80");break; - case fontcharsetHangeul: sRes = _T("81");break; - case fontcharsetJohab: sRes = _T("82");break; - case fontcharsetGB2313: sRes = _T("86");break; - case fontcharsetChineseBig5: sRes = _T("88");break; - case fontcharsetGreek: sRes = _T("A1");break; - case fontcharsetTurkish: sRes = _T("A2");break; - case fontcharsetVietnamese: sRes = _T("A3");break; - case fontcharsetHebrew: sRes = _T("B1");break; - case fontcharsetArabic: sRes = _T("B2");break; - case fontcharsetBaltic: sRes = _T("BA");break; - case fontcharsetRussian: sRes = _T("CC");break; - case fontcharsetThai: sRes = _T("DE");break; - case fontcharsetEastEurope: sRes = _T("EE");break; - case fontcharsetOEM: sRes = _T("FF");break; + case fontcharsetANSI: sRes = L"00";break; + case fontcharsetDefault: sRes = L"01";break; + case fontcharsetSymbol: sRes = L"02";break; + case fontcharsetMacintosh: sRes = L"4D";break; + case fontcharsetShitJIS: sRes = L"80";break; + case fontcharsetHangeul: sRes = L"81";break; + case fontcharsetJohab: sRes = L"82";break; + case fontcharsetGB2313: sRes = L"86";break; + case fontcharsetChineseBig5: sRes = L"88";break; + case fontcharsetGreek: sRes = L"A1";break; + case fontcharsetTurkish: sRes = L"A2";break; + case fontcharsetVietnamese: sRes = L"A3";break; + case fontcharsetHebrew: sRes = L"B1";break; + case fontcharsetArabic: sRes = L"B2";break; + case fontcharsetBaltic: sRes = L"BA";break; + case fontcharsetRussian: sRes = L"CC";break; + case fontcharsetThai: sRes = L"DE";break; + case fontcharsetEastEurope: sRes = L"EE";break; + case fontcharsetOEM: sRes = L"FF";break; } return sRes; } @@ -637,7 +637,7 @@ namespace SimpleTypes default: return L""; } - return _T(""); + return L""; } SimpleType_FromString (EThemeColor) @@ -838,13 +838,13 @@ namespace SimpleTypes std::wstring sRes; switch(this->m_eValue) { - case fontfamilyNotApplicable:sRes = _T("auto");break; - case fontfamilyRoman:sRes = _T("roman");break; - case fontfamilySwiss:sRes = _T("swiss");break; - case fontfamilyModern:sRes = _T("modern");break; - case fontfamilyScript:sRes = _T("script");break; - case fontfamilyDecorative:sRes = _T("decorative");break; - default:sRes = _T("auto"); + case fontfamilyNotApplicable:sRes = L"auto";break; + case fontfamilyRoman:sRes = L"roman";break; + case fontfamilySwiss:sRes = L"swiss";break; + case fontfamilyModern:sRes = L"modern";break; + case fontfamilyScript:sRes = L"script";break; + case fontfamilyDecorative:sRes = L"decorative";break; + default:sRes = L"auto"; } return sRes; } @@ -868,11 +868,11 @@ namespace SimpleTypes virtual EFontScheme FromString(std::wstring &sValue) { - if(_T("major") == sValue) + if(L"major" == sValue) this->m_eValue = fontschemeMajor; - else if(_T("minor") == sValue) + else if(L"minor" == sValue) this->m_eValue = fontschemeMinor; - else if(_T("none") == sValue) + else if(L"none" == sValue) this->m_eValue = fontschemeNone; else this->m_eValue = eDefValue; @@ -884,9 +884,9 @@ namespace SimpleTypes std::wstring sRes; switch(this->m_eValue) { - case fontschemeMajor: sRes = _T("major");break; - case fontschemeMinor: sRes = _T("minor");break; - case fontschemeNone: sRes = _T("none");break; + case fontschemeMajor: sRes = L"major";break; + case fontschemeMinor: sRes = L"minor";break; + case fontschemeNone: sRes = L"none";break; } return sRes; } @@ -911,15 +911,15 @@ namespace SimpleTypes virtual EUnderline FromString(std::wstring &sValue) { - if(_T("double") == sValue) + if(L"double" == sValue) this->m_eValue = underlineDouble; - else if(_T("doubleAccounting") == sValue) + else if(L"doubleAccounting" == sValue) this->m_eValue = underlineDoubleAccounting; - else if(_T("none") == sValue) + else if(L"none" == sValue) this->m_eValue = underlineNone; - else if(_T("single") == sValue) + else if(L"single" == sValue) this->m_eValue = underlineSingle; - else if(_T("singleAccounting") == sValue) + else if(L"singleAccounting" == sValue) this->m_eValue = underlineSingleAccounting; else this->m_eValue = eDefValue; @@ -930,12 +930,12 @@ namespace SimpleTypes { switch(this->m_eValue) { - case underlineDouble: return _T("double");break; - case underlineDoubleAccounting: return _T("doubleAccounting");break; - case underlineNone: return _T("none");break; - case underlineSingle: return _T("single");break; - case underlineSingleAccounting: return _T("singleAccounting");break; - default: return _T("none"); + case underlineDouble: return L"double";break; + case underlineDoubleAccounting: return L"doubleAccounting";break; + case underlineNone: return L"none";break; + case underlineSingle: return L"single";break; + case underlineSingleAccounting: return L"singleAccounting";break; + default: return L"none"; } } @@ -969,33 +969,33 @@ namespace SimpleTypes virtual EBorderStyle FromString(std::wstring &sValue) { - if(_T("dashDot") == sValue) + if(L"dashDot" == sValue) this->m_eValue = borderstyleDashDot; - else if(_T("dashDotDot") == sValue) + else if(L"dashDotDot" == sValue) this->m_eValue = borderstyleDashDotDot; - else if(_T("dashed") == sValue) + else if(L"dashed" == sValue) this->m_eValue = borderstyleDashed; - else if(_T("dotted") == sValue) + else if(L"dotted" == sValue) this->m_eValue = borderstyleDotted; - else if(_T("double") == sValue) + else if(L"double" == sValue) this->m_eValue = borderstyleDouble; - else if(_T("hair") == sValue) + else if(L"hair" == sValue) this->m_eValue = borderstyleHair; - else if(_T("medium") == sValue) + else if(L"medium" == sValue) this->m_eValue = borderstyleMedium; - else if(_T("mediumDashDot") == sValue) + else if(L"mediumDashDot" == sValue) this->m_eValue = borderstyleMediumDashDot; - else if(_T("mediumDashDotDot") == sValue) + else if(L"mediumDashDotDot" == sValue) this->m_eValue = borderstyleMediumDashDotDot; - else if(_T("mediumDashed") == sValue) + else if(L"mediumDashed" == sValue) this->m_eValue = borderstyleMediumDashed; - else if(_T("none") == sValue) + else if(L"none" == sValue) this->m_eValue = borderstyleNone; - else if(_T("slantDashDot") == sValue) + else if(L"slantDashDot" == sValue) this->m_eValue = borderstyleSlantDashDot; - else if(_T("thick") == sValue) + else if(L"thick" == sValue) this->m_eValue = borderstyleThick; - else if(_T("thin") == sValue) + else if(L"thin" == sValue) this->m_eValue = borderstyleThin; else this->m_eValue = eDefValue; @@ -1006,21 +1006,21 @@ namespace SimpleTypes { switch(this->m_eValue) { - case borderstyleDashDot : return _T("dashDot");break; - case borderstyleDashDotDot : return _T("dashDotDot");break; - case borderstyleDashed : return _T("dashed");break; - case borderstyleDotted : return _T("dotted");break; - case borderstyleDouble : return _T("double");break; - case borderstyleHair : return _T("hair");break; - case borderstyleMedium : return _T("medium");break; - case borderstyleMediumDashDot : return _T("mediumDashDot");break; - case borderstyleMediumDashDotDot : return _T("mediumDashDotDot");break; - case borderstyleMediumDashed : return _T("mediumDashed");break; - case borderstyleNone : return _T("none");break; - case borderstyleSlantDashDot : return _T("slantDashDot");break; - case borderstyleThick : return _T("thick");break; - case borderstyleThin : return _T("thin");break; - default:return _T("none"); + case borderstyleDashDot : return L"dashDot";break; + case borderstyleDashDotDot : return L"dashDotDot";break; + case borderstyleDashed : return L"dashed";break; + case borderstyleDotted : return L"dotted";break; + case borderstyleDouble : return L"double";break; + case borderstyleHair : return L"hair";break; + case borderstyleMedium : return L"medium";break; + case borderstyleMediumDashDot : return L"mediumDashDot";break; + case borderstyleMediumDashDotDot : return L"mediumDashDotDot";break; + case borderstyleMediumDashed : return L"mediumDashed";break; + case borderstyleNone : return L"none";break; + case borderstyleSlantDashDot : return L"slantDashDot";break; + case borderstyleThick : return L"thick";break; + case borderstyleThin : return L"thin";break; + default:return L"none"; } } @@ -1150,9 +1150,9 @@ namespace SimpleTypes virtual EGradientType FromString(std::wstring &sValue) { - if(_T("line") == sValue) + if(L"line" == sValue) this->m_eValue = gradienttypeLine; - else if(_T("path") == sValue) + else if(L"path" == sValue) this->m_eValue = gradienttypePath; else this->m_eValue = eDefValue; @@ -1163,9 +1163,9 @@ namespace SimpleTypes { switch(this->m_eValue) { - case gradienttypeLine : return _T("line"); break; - case gradienttypePath : return _T("path"); break; - default:return _T("line"); + case gradienttypeLine : return L"line"; break; + case gradienttypePath : return L"path"; break; + default:return L"line"; } } @@ -1203,43 +1203,43 @@ namespace SimpleTypes virtual EPatternType FromString(std::wstring &sValue) { - if(_T("darkDown") == sValue) + if(L"darkDown" == sValue) this->m_eValue = patterntypeDarkDown; - else if(_T("darkGray") == sValue) + else if(L"darkGray" == sValue) this->m_eValue = patterntypeDarkGray; - else if(_T("darkGrid") == sValue) + else if(L"darkGrid" == sValue) this->m_eValue = patterntypeDarkGrid; - else if(_T("darkHorizontal") == sValue) + else if(L"darkHorizontal" == sValue) this->m_eValue = patterntypeDarkHorizontal; - else if(_T("darkTrellis") == sValue) + else if(L"darkTrellis" == sValue) this->m_eValue = patterntypeDarkTrellis; - else if(_T("darkUp") == sValue) + else if(L"darkUp" == sValue) this->m_eValue = patterntypeDarkUp; - else if(_T("darkVertical") == sValue || L"VertStripe" == sValue) + else if(L"darkVertical" == sValue || L"VertStripe" == sValue) this->m_eValue = patterntypeDarkVertical; - else if(_T("gray0625") == sValue || L"Gray0625" == sValue ) + else if(L"gray0625" == sValue || L"Gray0625" == sValue ) this->m_eValue = patterntypeGray0625; - else if(_T("gray125") == sValue || L"Gray125" == sValue) + else if(L"gray125" == sValue || L"Gray125" == sValue) this->m_eValue = patterntypeGray125; - else if(_T("lightDown") == sValue) + else if(L"lightDown" == sValue) this->m_eValue = patterntypeLightDown; - else if(_T("lightGray") == sValue) + else if(L"lightGray" == sValue) this->m_eValue = patterntypeLightGray; - else if(_T("lightGrid") == sValue || L"ThinHorzCross" == sValue) + else if(L"lightGrid" == sValue || L"ThinHorzCross" == sValue) this->m_eValue = patterntypeLightGrid; - else if(_T("lightHorizontal") == sValue || L"HorzStripe" == sValue) + else if(L"lightHorizontal" == sValue || L"HorzStripe" == sValue) this->m_eValue = patterntypeLightHorizontal; - else if(_T("lightTrellis") == sValue) + else if(L"lightTrellis" == sValue) this->m_eValue = patterntypeLightTrellis; - else if(_T("lightUp") == sValue) + else if(L"lightUp" == sValue) this->m_eValue = patterntypeLightUp; - else if(_T("lightVertical") == sValue) + else if(L"lightVertical" == sValue) this->m_eValue = patterntypeLightVertical; - else if(_T("mediumGray") == sValue || L"Gray50" == sValue) + else if(L"mediumGray" == sValue || L"Gray50" == sValue) this->m_eValue = patterntypeMediumGray; - else if(_T("none") == sValue || L"None" == sValue) + else if(L"none" == sValue || L"None" == sValue) this->m_eValue = patterntypeNone; - else if(_T("solid") == sValue || L"Solid" == sValue) + else if(L"solid" == sValue || L"Solid" == sValue) this->m_eValue = patterntypeSolid; else this->m_eValue = eDefValue; @@ -1250,29 +1250,29 @@ namespace SimpleTypes { switch(this->m_eValue) { - case patterntypeDarkDown:return _T("darkDown");break; - case patterntypeDarkGray:return _T("darkGray");break; - case patterntypeDarkGrid:return _T("darkGrid");break; - case patterntypeDarkHorizontal:return _T("darkHorizontal");break; - case patterntypeDarkTrellis:return _T("darkTrellis");break; - case patterntypeDarkUp:return _T("darkUp");break; - case patterntypeDarkVertical:return _T("darkVertical");break; - case patterntypeGray0625:return _T("gray0625");break; - case patterntypeGray125:return _T("gray125");break; - case patterntypeLightDown:return _T("lightDown");break; - case patterntypeLightGray:return _T("lightGray");break; - case patterntypeLightGrid:return _T("lightGrid");break; - case patterntypeLightHorizontal:return _T("lightHorizontal");break; - case patterntypeLightTrellis:return _T("lightTrellis");break; - case patterntypeLightUp:return _T("lightUp");break; - case patterntypeLightVertical:return _T("lightVertical");break; - case patterntypeMediumGray:return _T("mediumGray");break; - case patterntypeNone:return _T("none");break; - case patterntypeSolid:return _T("solid");break; - default: return _T("none"); + case patterntypeDarkDown:return L"darkDown";break; + case patterntypeDarkGray:return L"darkGray";break; + case patterntypeDarkGrid:return L"darkGrid";break; + case patterntypeDarkHorizontal:return L"darkHorizontal";break; + case patterntypeDarkTrellis:return L"darkTrellis";break; + case patterntypeDarkUp:return L"darkUp";break; + case patterntypeDarkVertical:return L"darkVertical";break; + case patterntypeGray0625:return L"gray0625";break; + case patterntypeGray125:return L"gray125";break; + case patterntypeLightDown:return L"lightDown";break; + case patterntypeLightGray:return L"lightGray";break; + case patterntypeLightGrid:return L"lightGrid";break; + case patterntypeLightHorizontal:return L"lightHorizontal";break; + case patterntypeLightTrellis:return L"lightTrellis";break; + case patterntypeLightUp:return L"lightUp";break; + case patterntypeLightVertical:return L"lightVertical";break; + case patterntypeMediumGray:return L"mediumGray";break; + case patterntypeNone:return L"none";break; + case patterntypeSolid:return L"solid";break; + default: return L"none"; } - return _T("none"); + return L"none"; } SimpleType_FromString (EPatternType) @@ -1319,61 +1319,61 @@ namespace SimpleTypes virtual ETableStyleType FromString(std::wstring &sValue) { - if(_T("blankRow") == sValue) + if(L"blankRow" == sValue) this->m_eValue = tablestyletypeBlankRow; - else if(_T("firstColumn") == sValue) + else if(L"firstColumn" == sValue) this->m_eValue = tablestyletypeFirstColumn; - else if(_T("firstColumnStripe") == sValue) + else if(L"firstColumnStripe" == sValue) this->m_eValue = tablestyletypeFirstColumnStripe; - else if(_T("firstColumnSubheading") == sValue) + else if(L"firstColumnSubheading" == sValue) this->m_eValue = tablestyletypeFirstColumnSubheading; - else if(_T("firstHeaderCell") == sValue) + else if(L"firstHeaderCell" == sValue) this->m_eValue = tablestyletypeFirstHeaderCell; - else if(_T("firstRowStripe") == sValue) + else if(L"firstRowStripe" == sValue) this->m_eValue = tablestyletypeFirstRowStripe; - else if(_T("firstRowSubheading") == sValue) + else if(L"firstRowSubheading" == sValue) this->m_eValue = tablestyletypeFirstRowSubheading; - else if(_T("firstSubtotalColumn") == sValue) + else if(L"firstSubtotalColumn" == sValue) this->m_eValue = tablestyletypeFirstSubtotalColumn; - else if(_T("firstSubtotalRow") == sValue) + else if(L"firstSubtotalRow" == sValue) this->m_eValue = tablestyletypeFirstSubtotalRow; - else if(_T("firstTotalCell") == sValue) + else if(L"firstTotalCell" == sValue) this->m_eValue = tablestyletypeFirstTotalCell; - else if(_T("headerRow") == sValue) + else if(L"headerRow" == sValue) this->m_eValue = tablestyletypeHeaderRow; - else if(_T("lastColumn") == sValue) + else if(L"lastColumn" == sValue) this->m_eValue = tablestyletypeLastColumn; - else if(_T("lastHeaderCell") == sValue) + else if(L"lastHeaderCell" == sValue) this->m_eValue = tablestyletypeLastHeaderCell; - else if(_T("lastTotalCell") == sValue) + else if(L"lastTotalCell" == sValue) this->m_eValue = tablestyletypeLastTotalCell; - else if(_T("pageFieldLabels") == sValue) + else if(L"pageFieldLabels" == sValue) this->m_eValue = tablestyletypePageFieldLabels; - else if(_T("pageFieldValues") == sValue) + else if(L"pageFieldValues" == sValue) this->m_eValue = tablestyletypePageFieldValues; - else if(_T("secondColumnStripe") == sValue) + else if(L"secondColumnStripe" == sValue) this->m_eValue = tablestyletypeSecondColumnStripe; - else if(_T("secondColumnSubheading") == sValue) + else if(L"secondColumnSubheading" == sValue) this->m_eValue = tablestyletypeSecondColumnSubheading; - else if(_T("secondRowStripe") == sValue) + else if(L"secondRowStripe" == sValue) this->m_eValue = tablestyletypeSecondRowStripe; - else if(_T("secondRowSubheading") == sValue) + else if(L"secondRowSubheading" == sValue) this->m_eValue = tablestyletypeSecondRowSubheading; - else if(_T("secondSubtotalColumn") == sValue) + else if(L"secondSubtotalColumn" == sValue) this->m_eValue = tablestyletypeSecondSubtotalColumn; - else if(_T("secondSubtotalRow") == sValue) + else if(L"secondSubtotalRow" == sValue) this->m_eValue = tablestyletypeSecondSubtotalRow; - else if(_T("thirdColumnSubheading") == sValue) + else if(L"thirdColumnSubheading" == sValue) this->m_eValue = tablestyletypeThirdColumnSubheading; - else if(_T("thirdRowSubheading") == sValue) + else if(L"thirdRowSubheading" == sValue) this->m_eValue = tablestyletypeThirdRowSubheading; - else if(_T("thirdSubtotalColumn") == sValue) + else if(L"thirdSubtotalColumn" == sValue) this->m_eValue = tablestyletypeThirdSubtotalColumn; - else if(_T("thirdSubtotalRow") == sValue) + else if(L"thirdSubtotalRow" == sValue) this->m_eValue = tablestyletypeThirdSubtotalRow; - else if(_T("totalRow") == sValue) + else if(L"totalRow" == sValue) this->m_eValue = tablestyletypeTotalRow; - else if(_T("wholeTable") == sValue) + else if(L"wholeTable" == sValue) this->m_eValue = tablestyletypeWholeTable; else this->m_eValue = eDefValue; @@ -1384,37 +1384,37 @@ namespace SimpleTypes { switch(this->m_eValue) { - case tablestyletypeBlankRow: return _T("blankRow");break; - case tablestyletypeFirstColumn: return _T("firstColumn");break; - case tablestyletypeFirstColumnStripe: return _T("firstColumnStripe");break; - case tablestyletypeFirstColumnSubheading: return _T("firstColumnSubheading");break; - case tablestyletypeFirstHeaderCell: return _T("firstHeaderCell");break; - case tablestyletypeFirstRowStripe: return _T("firstRowStripe");break; - case tablestyletypeFirstRowSubheading: return _T("firstRowSubheading");break; - case tablestyletypeFirstSubtotalColumn: return _T("firstSubtotalColumn");break; - case tablestyletypeFirstSubtotalRow: return _T("firstSubtotalRow");break; - case tablestyletypeFirstTotalCell: return _T("firstTotalCell");break; - case tablestyletypeHeaderRow: return _T("headerRow");break; - case tablestyletypeLastColumn: return _T("lastColumn");break; - case tablestyletypeLastHeaderCell: return _T("lastHeaderCell");break; - case tablestyletypeLastTotalCell: return _T("lastTotalCell");break; - case tablestyletypePageFieldLabels: return _T("pageFieldLabels");break; - case tablestyletypePageFieldValues: return _T("pageFieldValues");break; - case tablestyletypeSecondColumnStripe: return _T("secondColumnStripe");break; - case tablestyletypeSecondColumnSubheading: return _T("secondColumnSubheading");break; - case tablestyletypeSecondRowStripe: return _T("secondRowStripe");break; - case tablestyletypeSecondRowSubheading: return _T("secondRowSubheading");break; - case tablestyletypeSecondSubtotalColumn: return _T("secondSubtotalColumn");break; - case tablestyletypeSecondSubtotalRow: return _T("secondSubtotalRow");break; - case tablestyletypeThirdColumnSubheading: return _T("thirdColumnSubheading");break; - case tablestyletypeThirdRowSubheading: return _T("thirdRowSubheading");break; - case tablestyletypeThirdSubtotalColumn: return _T("thirdSubtotalColumn");break; - case tablestyletypeThirdSubtotalRow: return _T("thirdSubtotalRow");break; - case tablestyletypeTotalRow: return _T("totalRow");break; - case tablestyletypeWholeTable: return _T("wholeTable");break; - default : return _T("blankRow");break; + case tablestyletypeBlankRow: return L"blankRow";break; + case tablestyletypeFirstColumn: return L"firstColumn";break; + case tablestyletypeFirstColumnStripe: return L"firstColumnStripe";break; + case tablestyletypeFirstColumnSubheading: return L"firstColumnSubheading";break; + case tablestyletypeFirstHeaderCell: return L"firstHeaderCell";break; + case tablestyletypeFirstRowStripe: return L"firstRowStripe";break; + case tablestyletypeFirstRowSubheading: return L"firstRowSubheading";break; + case tablestyletypeFirstSubtotalColumn: return L"firstSubtotalColumn";break; + case tablestyletypeFirstSubtotalRow: return L"firstSubtotalRow";break; + case tablestyletypeFirstTotalCell: return L"firstTotalCell";break; + case tablestyletypeHeaderRow: return L"headerRow";break; + case tablestyletypeLastColumn: return L"lastColumn";break; + case tablestyletypeLastHeaderCell: return L"lastHeaderCell";break; + case tablestyletypeLastTotalCell: return L"lastTotalCell";break; + case tablestyletypePageFieldLabels: return L"pageFieldLabels";break; + case tablestyletypePageFieldValues: return L"pageFieldValues";break; + case tablestyletypeSecondColumnStripe: return L"secondColumnStripe";break; + case tablestyletypeSecondColumnSubheading: return L"secondColumnSubheading";break; + case tablestyletypeSecondRowStripe: return L"secondRowStripe";break; + case tablestyletypeSecondRowSubheading: return L"secondRowSubheading";break; + case tablestyletypeSecondSubtotalColumn: return L"secondSubtotalColumn";break; + case tablestyletypeSecondSubtotalRow: return L"secondSubtotalRow";break; + case tablestyletypeThirdColumnSubheading: return L"thirdColumnSubheading";break; + case tablestyletypeThirdRowSubheading: return L"thirdRowSubheading";break; + case tablestyletypeThirdSubtotalColumn: return L"thirdSubtotalColumn";break; + case tablestyletypeThirdSubtotalRow: return L"thirdSubtotalRow";break; + case tablestyletypeTotalRow: return L"totalRow";break; + case tablestyletypeWholeTable: return L"wholeTable";break; + default : return L"blankRow";break; } - return _T("blankRow"); + return L"blankRow"; } SimpleType_FromString (ETableStyleType) @@ -1436,13 +1436,13 @@ namespace SimpleTypes virtual ECellFormulaType FromString(std::wstring &sValue) { - if(_T("array") == sValue) + if(L"array" == sValue) this->m_eValue = cellformulatypeArray; - else if(_T("dataTable") == sValue) + else if(L"dataTable" == sValue) this->m_eValue = cellformulatypeDataTable; - else if(_T("normal") == sValue) + else if(L"normal" == sValue) this->m_eValue = cellformulatypeNormal; - else if(_T("shared") == sValue) + else if(L"shared" == sValue) this->m_eValue = cellformulatypeShared; else this->m_eValue = eDefValue; @@ -1467,11 +1467,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case cellformulatypeArray : return _T("array");break; - case cellformulatypeDataTable : return _T("dataTable");break; - case cellformulatypeNormal : return _T("normal");break; - case cellformulatypeShared : return _T("shared");break; - default: return _T("normal"); + case cellformulatypeArray : return L"array";break; + case cellformulatypeDataTable : return L"dataTable";break; + case cellformulatypeNormal : return L"normal";break; + case cellformulatypeShared : return L"shared";break; + default: return L"normal"; } } @@ -1493,11 +1493,11 @@ namespace SimpleTypes virtual EUpdateLinksType FromString(std::wstring &sValue) { - if(_T("always") == sValue) + if(L"always" == sValue) this->m_eValue = updatelinksAlways; - else if(_T("never") == sValue) + else if(L"never" == sValue) this->m_eValue = updatelinksNever; - else if(_T("userSet") == sValue) + else if(L"userSet" == sValue) this->m_eValue = updatelinksUserSet; else this->m_eValue = eDefValue; @@ -1508,10 +1508,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case updatelinksAlways: return _T("always");break; - case updatelinksNever: return _T("never");break; - case updatelinksUserSet: return _T("userSet");break; - default: return _T("always"); + case updatelinksAlways: return L"always";break; + case updatelinksNever: return L"never";break; + case updatelinksUserSet: return L"userSet";break; + default: return L"always"; } } @@ -1544,17 +1544,17 @@ namespace SimpleTypes virtual ECellTypeType FromString(std::wstring &sValue) { - if(_T("b") == sValue) + if(L"b" == sValue) this->m_eValue = celltypeBool; - else if(_T("d") == sValue || L"DateTime" == sValue) + else if(L"d" == sValue || L"DateTime" == sValue) this->m_eValue = celltypeDate; - else if(_T("e") == sValue) + else if(L"e" == sValue) this->m_eValue = celltypeError; - else if(_T("inlineStr") == sValue) + else if(L"inlineStr" == sValue) this->m_eValue = celltypeInlineStr; - else if(_T("n") == sValue || L"Number" == sValue) + else if(L"n" == sValue || L"Number" == sValue) this->m_eValue = celltypeNumber; - else if(_T("s") == sValue) + else if(L"s" == sValue) this->m_eValue = celltypeSharedString; else if(L"str" == sValue || L"String" == sValue) this->m_eValue = celltypeStr; @@ -1587,14 +1587,14 @@ namespace SimpleTypes { switch(this->m_eValue) { - case celltypeBool: return _T("b");break; - case celltypeDate: return _T("d");break; - case celltypeError: return _T("e");break; - case celltypeInlineStr: return _T("inlineStr");break; - case celltypeNumber: return _T("n");break; - case celltypeSharedString: return _T("s");break; - case celltypeStr: return _T("str");break; - default: return _T("n"); + case celltypeBool: return L"b";break; + case celltypeDate: return L"d";break; + case celltypeError: return L"e";break; + case celltypeInlineStr: return L"inlineStr";break; + case celltypeNumber: return L"n";break; + case celltypeSharedString: return L"s";break; + case celltypeStr: return L"str";break; + default: return L"n"; } } @@ -1616,11 +1616,11 @@ namespace SimpleTypes virtual ECellAnchorType FromString(std::wstring &sValue) { - if(_T("absolute") == sValue) + if(L"absolute" == sValue) this->m_eValue = cellanchorAbsolute; - else if(_T("oneCell") == sValue) + else if(L"oneCell" == sValue) this->m_eValue = cellanchorOneCell; - else if(_T("twoCell") == sValue) + else if(L"twoCell" == sValue) this->m_eValue = cellanchorTwoCell; else this->m_eValue = eDefValue; @@ -1631,10 +1631,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case cellanchorAbsolute: return _T("absolute"); break; - case cellanchorOneCell: return _T("oneCell"); break; - case cellanchorTwoCell: return _T("twoCell"); break; - default: return _T("twoCell"); + case cellanchorAbsolute: return L"absolute"; break; + case cellanchorOneCell: return L"oneCell"; break; + case cellanchorTwoCell: return L"twoCell"; break; + default: return L"twoCell"; } } @@ -1657,11 +1657,11 @@ namespace SimpleTypes virtual ESheetViewType FromString(std::wstring &sValue) { - if(_T("normal") == sValue) + if(L"normal" == sValue) this->m_eValue = sheetviewNormal; - else if(_T("pageBreakPreview") == sValue) + else if(L"pageBreakPreview" == sValue) this->m_eValue = sheetviewPageBreakPreview; - else if(_T("pageLayout") == sValue) + else if(L"pageLayout" == sValue) this->m_eValue = sheetviewPageLayout; else this->m_eValue = eDefValue; @@ -1672,10 +1672,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case sheetviewNormal: return _T("normal"); break; - case sheetviewPageBreakPreview: return _T("pageBreakPreview"); break; - case sheetviewPageLayout: return _T("pageLayout"); break; - default: return _T("normal"); + case sheetviewNormal: return L"normal"; break; + case sheetviewPageBreakPreview: return L"pageBreakPreview"; break; + case sheetviewPageLayout: return L"pageLayout"; break; + default: return L"normal"; } } @@ -1699,15 +1699,15 @@ namespace SimpleTypes virtual EChartLegendPos FromString(std::wstring &sValue) { - if(_T("l") == sValue) + if(L"l" == sValue) this->m_eValue = chartlegendposLeft; - else if(_T("t") == sValue) + else if(L"t" == sValue) this->m_eValue = chartlegendposTop; - else if(_T("r") == sValue) + else if(L"r" == sValue) this->m_eValue = chartlegendposRight; - else if(_T("b") == sValue) + else if(L"b" == sValue) this->m_eValue = chartlegendposBottom; - else if(_T("tr") == sValue) + else if(L"tr" == sValue) this->m_eValue = chartlegendposRightTop; else this->m_eValue = eDefValue; @@ -1718,12 +1718,12 @@ namespace SimpleTypes { switch(this->m_eValue) { - case chartlegendposLeft: return _T("l"); break; - case chartlegendposTop: return _T("t"); break; - case chartlegendposRight: return _T("r"); break; - case chartlegendposBottom: return _T("b"); break; - case chartlegendposRightTop: return _T("tr"); break; - default: return _T("t"); + case chartlegendposLeft: return L"l"; break; + case chartlegendposTop: return L"t"; break; + case chartlegendposRight: return L"r"; break; + case chartlegendposBottom: return L"b"; break; + case chartlegendposRightTop: return L"tr"; break; + default: return L"t"; } } @@ -1744,9 +1744,9 @@ namespace SimpleTypes virtual EChartHMode FromString(std::wstring &sValue) { - if(_T("factor") == sValue) + if(L"factor" == sValue) this->m_eValue = charthmodeFactor; - else if(_T("edge") == sValue) + else if(L"edge" == sValue) this->m_eValue = charthmodeEdge; else this->m_eValue = eDefValue; @@ -1757,9 +1757,9 @@ namespace SimpleTypes { switch(this->m_eValue) { - case charthmodeFactor: return _T("factor"); break; - case charthmodeEdge: return _T("edge"); break; - default: return _T("factor"); + case charthmodeFactor: return L"factor"; break; + case charthmodeEdge: return L"edge"; break; + default: return L"factor"; } } @@ -1780,9 +1780,9 @@ namespace SimpleTypes virtual EChartLayoutTarget FromString(std::wstring &sValue) { - if(_T("inner") == sValue) + if(L"inner" == sValue) this->m_eValue = chartlayouttargetInner; - else if(_T("outer") == sValue) + else if(L"outer" == sValue) this->m_eValue = chartlayouttargetOuter; else this->m_eValue = eDefValue; @@ -1793,9 +1793,9 @@ namespace SimpleTypes { switch(this->m_eValue) { - case chartlayouttargetInner: return _T("inner"); break; - case chartlayouttargetOuter: return _T("outer"); break; - default: return _T("inner"); + case chartlayouttargetInner: return L"inner"; break; + case chartlayouttargetOuter: return L"outer"; break; + default: return L"inner"; } } @@ -1818,13 +1818,13 @@ namespace SimpleTypes virtual EChartAxPos FromString(std::wstring &sValue) { - if(_T("l") == sValue) + if(L"l" == sValue) this->m_eValue = chartaxposLeft; - else if(_T("t") == sValue) + else if(L"t" == sValue) this->m_eValue = chartaxposTop; - else if(_T("r") == sValue) + else if(L"r" == sValue) this->m_eValue = chartaxposRight; - else if(_T("b") == sValue) + else if(L"b" == sValue) this->m_eValue = chartaxposBottom; else this->m_eValue = eDefValue; @@ -1835,11 +1835,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case chartaxposLeft: return _T("l"); break; - case chartaxposTop: return _T("t"); break; - case chartaxposRight: return _T("r"); break; - case chartaxposBottom: return _T("b"); break; - default: return _T("l"); + case chartaxposLeft: return L"l"; break; + case chartaxposTop: return L"t"; break; + case chartaxposRight: return L"r"; break; + case chartaxposBottom: return L"b"; break; + default: return L"l"; } } @@ -1862,13 +1862,13 @@ namespace SimpleTypes virtual EChartBarGrouping FromString(std::wstring &sValue) { - if(_T("clustered") == sValue) + if(L"clustered" == sValue) this->m_eValue = chartbargroupingClustered; - else if(_T("percentStacked") == sValue) + else if(L"percentStacked" == sValue) this->m_eValue = chartbargroupingPercentStacked; - else if(_T("stacked") == sValue) + else if(L"stacked" == sValue) this->m_eValue = chartbargroupingStacked; - else if(_T("standard") == sValue) + else if(L"standard" == sValue) this->m_eValue = chartbargroupingStandard; else this->m_eValue = eDefValue; @@ -1879,11 +1879,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case chartbargroupingClustered: return _T("clustered"); break; - case chartbargroupingPercentStacked: return _T("percentStacked"); break; - case chartbargroupingStacked: return _T("stacked"); break; - case chartbargroupingStandard: return _T("standard"); break; - default: return _T("clustered"); + case chartbargroupingClustered: return L"clustered"; break; + case chartbargroupingPercentStacked: return L"percentStacked"; break; + case chartbargroupingStacked: return L"stacked"; break; + case chartbargroupingStandard: return L"standard"; break; + default: return L"clustered"; } } @@ -1904,9 +1904,9 @@ namespace SimpleTypes virtual EChartBarDirection FromString(std::wstring &sValue) { - if(_T("bar") == sValue) + if(L"bar" == sValue) this->m_eValue = chartbardirectionBar; - else if(_T("col") == sValue) + else if(L"col" == sValue) this->m_eValue = chartbardirectionCol; else this->m_eValue = eDefValue; @@ -1950,27 +1950,27 @@ namespace SimpleTypes virtual EChartSymbol FromString(std::wstring &sValue) { - if(_T("circle") == sValue) + if(L"circle" == sValue) this->m_eValue = chartsymbolCircle; - else if(_T("dash") == sValue) + else if(L"dash" == sValue) this->m_eValue = chartsymbolDash; - else if(_T("diamond") == sValue) + else if(L"diamond" == sValue) this->m_eValue = chartsymbolDiamond; - else if(_T("dot") == sValue) + else if(L"dot" == sValue) this->m_eValue = chartsymbolDot; - else if(_T("none") == sValue) + else if(L"none" == sValue) this->m_eValue = chartsymbolNone; - else if(_T("picture") == sValue) + else if(L"picture" == sValue) this->m_eValue = chartsymbolPicture; - else if(_T("plus") == sValue) + else if(L"plus" == sValue) this->m_eValue = chartsymbolPlus; - else if(_T("square") == sValue) + else if(L"square" == sValue) this->m_eValue = chartsymbolSquare; - else if(_T("star") == sValue) + else if(L"star" == sValue) this->m_eValue = chartsymbolStare; - else if(_T("triangle") == sValue) + else if(L"triangle" == sValue) this->m_eValue = chartsymbolTriangle; - else if(_T("x") == sValue) + else if(L"x" == sValue) this->m_eValue = chartsymbolX; else this->m_eValue = eDefValue; @@ -1981,18 +1981,18 @@ namespace SimpleTypes { switch(this->m_eValue) { - case chartsymbolCircle: return _T("circle"); break; - case chartsymbolDash: return _T("dash"); break; - case chartsymbolDiamond: return _T("diamond"); break; - case chartsymbolDot: return _T("dot"); break; - case chartsymbolNone: return _T("none"); break; - case chartsymbolPicture: return _T("picture"); break; - case chartsymbolPlus: return _T("plus"); break; - case chartsymbolSquare: return _T("square"); break; - case chartsymbolStare: return _T("star"); break; - case chartsymbolTriangle: return _T("triangle"); break; - case chartsymbolX: return _T("x"); break; - default: return _T("none"); + case chartsymbolCircle: return L"circle"; break; + case chartsymbolDash: return L"dash"; break; + case chartsymbolDiamond: return L"diamond"; break; + case chartsymbolDot: return L"dot"; break; + case chartsymbolNone: return L"none"; break; + case chartsymbolPicture: return L"picture"; break; + case chartsymbolPlus: return L"plus"; break; + case chartsymbolSquare: return L"square"; break; + case chartsymbolStare: return L"star"; break; + case chartsymbolTriangle: return L"triangle"; break; + case chartsymbolX: return L"x"; break; + default: return L"none"; } } @@ -2152,10 +2152,10 @@ namespace SimpleTypes virtual ECellComments FromString(std::wstring &sValue) { - if ( (L"asDisplayed") == sValue ) this->m_eValue = cellcommentsAsDisplayed; - else if ( (L"atEnd") == sValue ) this->m_eValue = cellcommentsAtEnd; - else if ( (L"none") == sValue ) this->m_eValue = cellcommentsNone; - else this->m_eValue = eDefValue; + if (L"asDisplayed" == sValue ) this->m_eValue = cellcommentsAsDisplayed; + else if (L"atEnd" == sValue ) this->m_eValue = cellcommentsAtEnd; + else if (L"none" == sValue ) this->m_eValue = cellcommentsNone; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -2164,10 +2164,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case cellcommentsAsDisplayed : return (L"asDisplayed"); - case cellcommentsAtEnd : return (L"atEnd"); - case cellcommentsNone : return (L"none"); - default : return (L"none"); + case cellcommentsAsDisplayed : return L"asDisplayed"; + case cellcommentsAtEnd : return L"atEnd"; + case cellcommentsNone : return L"none"; + default : return L"none"; } } @@ -2191,11 +2191,11 @@ namespace SimpleTypes virtual EPrintError FromString(std::wstring &sValue) { - if ( (L"blank") == sValue ) this->m_eValue = printerrorBlank; - else if ( (L"dash") == sValue ) this->m_eValue = printerrorDash; - else if ( (L"displayed") == sValue ) this->m_eValue = printerrorDisplayed; - else if ( (L"NA") == sValue ) this->m_eValue = printerrorNA; - else this->m_eValue = eDefValue; + if (L"blank" == sValue ) this->m_eValue = printerrorBlank; + else if (L"dash" == sValue ) this->m_eValue = printerrorDash; + else if (L"displayed" == sValue ) this->m_eValue = printerrorDisplayed; + else if (L"NA" == sValue ) this->m_eValue = printerrorNA; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -2204,11 +2204,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case printerrorBlank : return (L"blank"); - case printerrorDash : return (L"dash"); - case printerrorDisplayed : return (L"displayed"); - case printerrorNA : return (L"NA"); - default : return (L"displayed"); + case printerrorBlank: return L"blank"; + case printerrorDash: return L"dash"; + case printerrorDisplayed: return L"displayed"; + case printerrorNA: return L"NA"; + default: return L"displayed"; } } @@ -2230,20 +2230,20 @@ namespace SimpleTypes virtual EPageOrder FromString(std::wstring &sValue) { - if ( (L"downThenOver") == sValue ) this->m_eValue = pageorderDownThenOver; - else if ( (L"overThenDown") == sValue ) this->m_eValue = pageorderOverThenDown; - else this->m_eValue = eDefValue; + if (L"downThenOver" == sValue ) this->m_eValue = pageorderDownThenOver; + else if (L"overThenDown" == sValue ) this->m_eValue = pageorderOverThenDown; + else this->m_eValue = eDefValue; return this->m_eValue; } - virtual std::wstring ToString () const + virtual std::wstring ToString () const { switch(this->m_eValue) { - case pageorderDownThenOver : return (L"downThenOver"); - case pageorderOverThenDown : return (L"overThenDown"); - default : return (L"downThenOver"); + case pageorderDownThenOver : return L"downThenOver"; + case pageorderOverThenDown : return L"overThenDown"; + default : return L"downThenOver"; } } @@ -2273,25 +2273,25 @@ namespace SimpleTypes virtual ETotalsRowFunction FromString(std::wstring &sValue) { - if(_T("average") == sValue) + if(L"average" == sValue) this->m_eValue = totalrowfunctionAverage; - else if(_T("count") == sValue) + else if(L"count" == sValue) this->m_eValue = totalrowfunctionCount; - else if(_T("countNums") == sValue) + else if(L"countNums" == sValue) this->m_eValue = totalrowfunctionCountNums; - else if(_T("custom") == sValue) + else if(L"custom" == sValue) this->m_eValue = totalrowfunctionCustom; - else if(_T("max") == sValue) + else if(L"max" == sValue) this->m_eValue = totalrowfunctionMax; - else if(_T("min") == sValue) + else if(L"min" == sValue) this->m_eValue = totalrowfunctionMin; - else if(_T("none") == sValue) + else if(L"none" == sValue) this->m_eValue = totalrowfunctionNone; - else if(_T("stdDev") == sValue) + else if(L"stdDev" == sValue) this->m_eValue = totalrowfunctionStdDev; - else if(_T("sum") == sValue) + else if(L"sum" == sValue) this->m_eValue = totalrowfunctionSum; - else if(_T("var") == sValue) + else if(L"var" == sValue) this->m_eValue = totalrowfunctionVar; else this->m_eValue = eDefValue; @@ -2336,13 +2336,13 @@ namespace SimpleTypes virtual ESortBy FromString(std::wstring &sValue) { - if(_T("cellColor") == sValue) + if(L"cellColor" == sValue) this->m_eValue = sortbyCellColor; - else if(_T("fontColor") == sValue) + else if(L"fontColor" == sValue) this->m_eValue = sortbyFontColor; - else if(_T("icon") == sValue) + else if(L"icon" == sValue) this->m_eValue = sortbyIcon; - else if(_T("value") == sValue) + else if(L"value" == sValue) this->m_eValue = sortbyValue; else this->m_eValue = eDefValue; @@ -2383,17 +2383,17 @@ namespace SimpleTypes virtual ECustomFilter FromString(std::wstring &sValue) { - if(_T("equal") == sValue) + if(L"equal" == sValue) this->m_eValue = customfilterEqual; - else if(_T("greaterThan") == sValue) + else if(L"greaterThan" == sValue) this->m_eValue = customfilterGreaterThan; - else if(_T("greaterThanOrEqual") == sValue) + else if(L"greaterThanOrEqual" == sValue) this->m_eValue = customfilterGreaterThanOrEqual; - else if(_T("lessThan") == sValue) + else if(L"lessThan" == sValue) this->m_eValue = customfilterLessThan; - else if(_T("lessThanOrEqual") == sValue) + else if(L"lessThanOrEqual" == sValue) this->m_eValue = customfilterLessThanOrEqual; - else if(_T("notEqual") == sValue) + else if(L"notEqual" == sValue) this->m_eValue = customfilterNotEqual; else this->m_eValue = eDefValue; @@ -2436,17 +2436,17 @@ namespace SimpleTypes virtual EDateTimeGroup FromString(std::wstring &sValue) { - if(_T("day") == sValue) + if(L"day" == sValue) this->m_eValue = datetimegroupDay; - else if(_T("hour") == sValue) + else if(L"hour" == sValue) this->m_eValue = datetimegroupHour; - else if(_T("minute") == sValue) + else if(L"minute" == sValue) this->m_eValue = datetimegroupMinute; - else if(_T("month") == sValue) + else if(L"month" == sValue) this->m_eValue = datetimegroupMonth; - else if(_T("second") == sValue) + else if(L"second" == sValue) this->m_eValue = datetimegroupSecond; - else if(_T("year") == sValue) + else if(L"year" == sValue) this->m_eValue = datetimegroupYear; else this->m_eValue = eDefValue; @@ -2486,11 +2486,11 @@ namespace SimpleTypes virtual ESortMethod FromString(std::wstring &sValue) { - if(_T("none") == sValue) + if(L"none" == sValue) this->m_eValue = sortmethodNone; - else if(_T("pinYin") == sValue) + else if(L"pinYin" == sValue) this->m_eValue = sortmethodPinYin; - else if(_T("stroke") == sValue) + else if(L"stroke" == sValue) this->m_eValue = sortmethodStroke; else this->m_eValue = eDefValue; @@ -2559,75 +2559,75 @@ namespace SimpleTypes virtual EDynamicFilterType FromString(std::wstring &sValue) { - if(_T("aboveAverage") == sValue) + if(L"aboveAverage" == sValue) this->m_eValue = dynamicfiltertypeAboveAverage; - else if(_T("belowAverage") == sValue) + else if(L"belowAverage" == sValue) this->m_eValue = dynamicfiltertypeBelowAverage; - else if(_T("lastMonth") == sValue) + else if(L"lastMonth" == sValue) this->m_eValue = dynamicfiltertypeLastMonth; - else if(_T("lastQuarter") == sValue) + else if(L"lastQuarter" == sValue) this->m_eValue = dynamicfiltertypeLastQuarter; - else if(_T("lastWeek") == sValue) + else if(L"lastWeek" == sValue) this->m_eValue = dynamicfiltertypeLastWeek; - else if(_T("lastYear") == sValue) + else if(L"lastYear" == sValue) this->m_eValue = dynamicfiltertypeLastYear; - else if(_T("M1") == sValue) + else if(L"M1" == sValue) this->m_eValue = dynamicfiltertypeM1; - else if(_T("M10") == sValue) + else if(L"M10" == sValue) this->m_eValue = dynamicfiltertypeM10; - else if(_T("M11") == sValue) + else if(L"M11" == sValue) this->m_eValue = dynamicfiltertypeM11; - else if(_T("M12") == sValue) + else if(L"M12" == sValue) this->m_eValue = dynamicfiltertypeM12; - else if(_T("M2") == sValue) + else if(L"M2" == sValue) this->m_eValue = dynamicfiltertypeM2; - else if(_T("M3") == sValue) + else if(L"M3" == sValue) this->m_eValue = dynamicfiltertypeM3; - else if(_T("M4") == sValue) + else if(L"M4" == sValue) this->m_eValue = dynamicfiltertypeM4; - else if(_T("M5") == sValue) + else if(L"M5" == sValue) this->m_eValue = dynamicfiltertypeM5; - else if(_T("M6") == sValue) + else if(L"M6" == sValue) this->m_eValue = dynamicfiltertypeM6; - else if(_T("M7") == sValue) + else if(L"M7" == sValue) this->m_eValue = dynamicfiltertypeM7; - else if(_T("M8") == sValue) + else if(L"M8" == sValue) this->m_eValue = dynamicfiltertypeM8; - else if(_T("M9") == sValue) + else if(L"M9" == sValue) this->m_eValue = dynamicfiltertypeM9; - else if(_T("nextMonth") == sValue) + else if(L"nextMonth" == sValue) this->m_eValue = dynamicfiltertypeNextMonth; - else if(_T("nextQuarter") == sValue) + else if(L"nextQuarter" == sValue) this->m_eValue = dynamicfiltertypeNextQuarter; - else if(_T("nextWeek") == sValue) + else if(L"nextWeek" == sValue) this->m_eValue = dynamicfiltertypeNextWeek; - else if(_T("nextYear") == sValue) + else if(L"nextYear" == sValue) this->m_eValue = dynamicfiltertypeNextYear; - else if(_T("null") == sValue) + else if(L"null" == sValue) this->m_eValue = dynamicfiltertypeNull; - else if(_T("Q1") == sValue) + else if(L"Q1" == sValue) this->m_eValue = dynamicfiltertypeQ1; - else if(_T("Q2") == sValue) + else if(L"Q2" == sValue) this->m_eValue = dynamicfiltertypeQ2; - else if(_T("Q3") == sValue) + else if(L"Q3" == sValue) this->m_eValue = dynamicfiltertypeQ3; - else if(_T("Q4") == sValue) + else if(L"Q4" == sValue) this->m_eValue = dynamicfiltertypeQ4; - else if(_T("thisMonth") == sValue) + else if(L"thisMonth" == sValue) this->m_eValue = dynamicfiltertypeThisMonth; - else if(_T("thisQuarter") == sValue) + else if(L"thisQuarter" == sValue) this->m_eValue = dynamicfiltertypeThisQuarter; - else if(_T("thisWeek") == sValue) + else if(L"thisWeek" == sValue) this->m_eValue = dynamicfiltertypeThisWeek; - else if(_T("thisYear") == sValue) + else if(L"thisYear" == sValue) this->m_eValue = dynamicfiltertypeThisYear; - else if(_T("today") == sValue) + else if(L"today" == sValue) this->m_eValue = dynamicfiltertypeToday; - else if(_T("tomorrow") == sValue) + else if(L"tomorrow" == sValue) this->m_eValue = dynamicfiltertypeTomorrow; - else if(_T("yearToDate") == sValue) + else if(L"yearToDate" == sValue) this->m_eValue = dynamicfiltertypeYearToDate; - else if(_T("yesterday") == sValue) + else if(L"yesterday" == sValue) this->m_eValue = dynamicfiltertypeYesterday; else this->m_eValue = eDefValue; @@ -2884,18 +2884,18 @@ namespace SimpleTypes virtual ECfOperator FromString(std::wstring &sValue) { - if(_T("beginsWith") == sValue) this->m_eValue = Operator_beginsWith; - else if(_T("between") == sValue) this->m_eValue = Operator_between; - else if(_T("containsText") == sValue) this->m_eValue = Operator_containsText; - else if(_T("endsWith") == sValue) this->m_eValue = Operator_endsWith; - else if(_T("equal") == sValue) this->m_eValue = Operator_equal; - else if(_T("greaterThan") == sValue) this->m_eValue = Operator_greaterThan; - else if(_T("greaterThanOrEqual") == sValue) this->m_eValue = Operator_greaterThanOrEqual; - else if(_T("lessThan") == sValue) this->m_eValue = Operator_lessThan; - else if(_T("lessThanOrEqual") == sValue) this->m_eValue = Operator_lessThanOrEqual; - else if(_T("notBetween") == sValue) this->m_eValue = Operator_notBetween; - else if(_T("notContains") == sValue) this->m_eValue = Operator_notContains; - else if(_T("notEqual") == sValue) this->m_eValue = Operator_notEqual; + if(L"beginsWith" == sValue) this->m_eValue = Operator_beginsWith; + else if(L"between" == sValue) this->m_eValue = Operator_between; + else if(L"containsText" == sValue) this->m_eValue = Operator_containsText; + else if(L"endsWith" == sValue) this->m_eValue = Operator_endsWith; + else if(L"equal" == sValue) this->m_eValue = Operator_equal; + else if(L"greaterThan" == sValue) this->m_eValue = Operator_greaterThan; + else if(L"greaterThanOrEqual" == sValue) this->m_eValue = Operator_greaterThanOrEqual; + else if(L"lessThan" == sValue) this->m_eValue = Operator_lessThan; + else if(L"lessThanOrEqual" == sValue) this->m_eValue = Operator_lessThanOrEqual; + else if(L"notBetween" == sValue) this->m_eValue = Operator_notBetween; + else if(L"notContains" == sValue) this->m_eValue = Operator_notContains; + else if(L"notEqual" == sValue) this->m_eValue = Operator_notEqual; return this->m_eValue; } @@ -2903,19 +2903,19 @@ namespace SimpleTypes { switch(this->m_eValue) { - case Operator_beginsWith : return _T("beginsWith"); break; - case Operator_between : return _T("between"); break; - case Operator_containsText : return _T("containsText"); break; - case Operator_endsWith : return _T("endsWith"); break; - case Operator_equal : return _T("equal"); break; - case Operator_greaterThan : return _T("greaterThan"); break; - case Operator_greaterThanOrEqual: return _T("greaterThanOrEqual");break; - case Operator_lessThan : return _T("lessThan"); break; - case Operator_lessThanOrEqual : return _T("lessThanOrEqual"); break; - case Operator_notBetween : return _T("notBetween"); break; - case Operator_notContains : return _T("notContains"); break; - case Operator_notEqual : return _T("notEqual"); break; - default : return _T("equal"); + case Operator_beginsWith : return L"beginsWith"; break; + case Operator_between : return L"between"; break; + case Operator_containsText : return L"containsText"; break; + case Operator_endsWith : return L"endsWith"; break; + case Operator_equal : return L"equal"; break; + case Operator_greaterThan : return L"greaterThan"; break; + case Operator_greaterThanOrEqual: return L"greaterThanOrEqual";break; + case Operator_lessThan : return L"lessThan"; break; + case Operator_lessThanOrEqual : return L"lessThanOrEqual"; break; + case Operator_notBetween : return L"notBetween"; break; + case Operator_notContains : return L"notContains"; break; + case Operator_notEqual : return L"notEqual"; break; + default : return L"equal"; } } @@ -2955,25 +2955,25 @@ namespace SimpleTypes virtual ECfType FromString(std::wstring &sValue) { - if(_T("aboveAverage") == sValue) this->m_eValue = aboveAverage; - else if(_T("beginsWith") == sValue) this->m_eValue = beginsWith; - else if(_T("cellIs") == sValue) this->m_eValue = cellIs; - else if(_T("colorScale") == sValue) this->m_eValue = colorScale; - else if(_T("containsBlanks") == sValue) this->m_eValue = containsBlanks; - else if(_T("containsText") == sValue) this->m_eValue = containsText; - else if(_T("containsErrors") == sValue) this->m_eValue = containsErrors; - else if(_T("dataBar") == sValue) this->m_eValue = dataBar; - else if(_T("duplicateValues") == sValue) this->m_eValue = duplicateValues; - else if(_T("expression") == sValue) this->m_eValue = expression; - else if(_T("iconSet") == sValue) this->m_eValue = iconSet; - else if(_T("notContainsBlanks") == sValue) this->m_eValue = notContainsBlanks; - else if(_T("notContainsErrors") == sValue) this->m_eValue = notContainsErrors; - else if(_T("notContainsText") == sValue) this->m_eValue = notContainsText; - else if(_T("timePeriod") == sValue) this->m_eValue = timePeriod; - else if(_T("top10") == sValue) this->m_eValue = top10; - else if(_T("uniqueValues") == sValue) this->m_eValue = uniqueValues; - else if(_T("endsWith") == sValue) this->m_eValue = endsWith; - else this->m_eValue = eDefValue; + if(L"aboveAverage" == sValue) this->m_eValue = aboveAverage; + else if(L"beginsWith" == sValue) this->m_eValue = beginsWith; + else if(L"cellIs" == sValue) this->m_eValue = cellIs; + else if(L"colorScale" == sValue) this->m_eValue = colorScale; + else if(L"containsBlanks" == sValue) this->m_eValue = containsBlanks; + else if(L"containsText" == sValue) this->m_eValue = containsText; + else if(L"containsErrors" == sValue) this->m_eValue = containsErrors; + else if(L"dataBar" == sValue) this->m_eValue = dataBar; + else if(L"duplicateValues" == sValue) this->m_eValue = duplicateValues; + else if(L"expression" == sValue) this->m_eValue = expression; + else if(L"iconSet" == sValue) this->m_eValue = iconSet; + else if(L"notContainsBlanks" == sValue) this->m_eValue = notContainsBlanks; + else if(L"notContainsErrors" == sValue) this->m_eValue = notContainsErrors; + else if(L"notContainsText" == sValue) this->m_eValue = notContainsText; + else if(L"timePeriod" == sValue) this->m_eValue = timePeriod; + else if(L"top10" == sValue) this->m_eValue = top10; + else if(L"uniqueValues" == sValue) this->m_eValue = uniqueValues; + else if(L"endsWith" == sValue) this->m_eValue = endsWith; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -2981,31 +2981,90 @@ namespace SimpleTypes { switch(this->m_eValue) { - case aboveAverage : return _T("aboveAverage"); break; - case beginsWith : return _T("beginsWith"); break; - case cellIs : return _T("cellIs"); break; - case colorScale : return _T("colorScale"); break; - case containsBlanks : return _T("containsBlanks"); break; - case containsErrors : return _T("containsErrors"); break; - case containsText : return _T("containsText"); break; - case dataBar : return _T("dataBar"); break; - case duplicateValues : return _T("duplicateValues"); break; - case expression : return _T("expression"); break; - case iconSet : return _T("iconSet"); break; - case notContainsBlanks : return _T("notContainsBlanks"); break; - case notContainsErrors : return _T("notContainsErrors"); break; - case notContainsText : return _T("notContainsText"); break; - case timePeriod : return _T("timePeriod"); break; - case top10 : return _T("top10"); break; - case uniqueValues : return _T("uniqueValues"); break; - case endsWith : return _T("endsWith"); break; - default : return _T("dataBar"); + case aboveAverage : return L"aboveAverage"; break; + case beginsWith : return L"beginsWith"; break; + case cellIs : return L"cellIs"; break; + case colorScale : return L"colorScale"; break; + case containsBlanks : return L"containsBlanks"; break; + case containsErrors : return L"containsErrors"; break; + case containsText : return L"containsText"; break; + case dataBar : return L"dataBar"; break; + case duplicateValues : return L"duplicateValues"; break; + case expression : return L"expression"; break; + case iconSet : return L"iconSet"; break; + case notContainsBlanks : return L"notContainsBlanks";break; + case notContainsErrors : return L"notContainsErrors";break; + case notContainsText : return L"notContainsText"; break; + case timePeriod : return L"timePeriod"; break; + case top10 : return L"top10"; break; + case uniqueValues : return L"uniqueValues"; break; + case endsWith : return L"endsWith"; break; + default : return L"dataBar"; } } SimpleType_FromString (ECfType) SimpleType_Operator_Equal (ST_CfType) }; + //---------------------------------------------------- + // 18.18.82 ST_TimePeriod (Time Period Types) + //---------------------------------------------------- + enum ETimePeriod + { + timePeriodToday = 0, + timePeriodYesterday = 1, + timePeriodTomorrow = 2, + timePeriodLast7Days = 3, + timePeriodThisMonth = 4, + timePeriodLastMonth = 5, + timePeriodNextMonth = 6, + timePeriodThisWeek = 7, + timePerioLastWeek = 8, + timePeriodNextWeek = 9 + }; + template + class CTimePeriod : public CSimpleType + { + public: + CTimePeriod() {} + CTimePeriod(const ETimePeriod & val) { this->m_eValue = val; } + + virtual ETimePeriod FromString(std::wstring &sValue) + { + if (L"today" == sValue) this->m_eValue = timePeriodToday; + else if (L"yesterday" == sValue) this->m_eValue = timePeriodYesterday; + else if (L"tomorrow" == sValue) this->m_eValue = timePeriodTomorrow; + else if (L"last7Days" == sValue) this->m_eValue = timePeriodLast7Days; + else if (L"thisMonth" == sValue) this->m_eValue = timePeriodThisMonth; + else if (L"lastMonth" == sValue) this->m_eValue = timePeriodLastMonth; + else if (L"nextMonth" == sValue) this->m_eValue = timePeriodNextMonth; + else if (L"thisWeek" == sValue) this->m_eValue = timePeriodThisWeek; + else if (L"lastWeek" == sValue) this->m_eValue = timePerioLastWeek; + else if (L"nextWeek" == sValue) this->m_eValue = timePeriodNextWeek; + else this->m_eValue = eDefValue; + return this->m_eValue; + } + virtual std::wstring ToString() const + { + switch (this->m_eValue) + { + case timePeriodToday: return L"today"; break; + case timePeriodYesterday: return L"yesterday"; break; + case timePeriodTomorrow: return L"tomorrow"; break; + case timePeriodLast7Days: return L"last7Days"; break; + case timePeriodThisMonth: return L"thisMonth"; break; + case timePeriodLastMonth: return L"lastMonth"; break; + case timePeriodNextMonth: return L"nextMonth"; break; + case timePeriodThisWeek: return L"thisWeek"; break; + case timePerioLastWeek: return L"lastWeek"; break; + case timePeriodNextWeek: return L"nextWeek"; break; + default: return L"today"; + } + } + + SimpleType_FromString(ETimePeriod) + SimpleType_Operator_Equal(CTimePeriod) + }; //---------------------------------------------------- // 18.18.13 ST_CfvoType (Conditional Format Value Object Type) //---------------------------------------------------- @@ -3029,15 +3088,15 @@ namespace SimpleTypes virtual ECfvoType FromString(std::wstring &sValue) { - if(_T("formula") == sValue) this->m_eValue = Formula; - else if(_T("max") == sValue) this->m_eValue = Maximum; - else if(_T("min") == sValue) this->m_eValue = Minimum; - else if(_T("num") == sValue) this->m_eValue = Number; - else if(_T("percent") == sValue) this->m_eValue = Percent; - else if(_T("percentile") == sValue) this->m_eValue = Percentile; - else if(_T("autoMin") == sValue) this->m_eValue = autoMin; - else if(_T("autoMax") == sValue) this->m_eValue = autoMax; - else this->m_eValue = eDefValue; + if(L"formula" == sValue) this->m_eValue = Formula; + else if(L"max" == sValue) this->m_eValue = Maximum; + else if(L"min" == sValue) this->m_eValue = Minimum; + else if(L"num" == sValue) this->m_eValue = Number; + else if(L"percent" == sValue) this->m_eValue = Percent; + else if(L"percentile" == sValue)this->m_eValue = Percentile; + else if(L"autoMin" == sValue) this->m_eValue = autoMin; + else if(L"autoMax" == sValue) this->m_eValue = autoMax; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3045,15 +3104,15 @@ namespace SimpleTypes { switch(this->m_eValue) { - case Formula: return _T("formula"); - case Maximum: return _T("max"); - case Minimum: return _T("min"); - case Number: return _T("num"); - case Percent: return _T("percent"); - case Percentile:return _T("percentile"); - case autoMin: return _T("autoMin"); - case autoMax: return _T("autoMax"); - default : return _T("num"); + case Formula: return L"formula"; + case Maximum: return L"max"; + case Minimum: return L"min"; + case Number: return L"num"; + case Percent: return L"percent"; + case Percentile:return L"percentile"; + case autoMin: return L"autoMin"; + case autoMax: return L"autoMax"; + default : return L"num"; } } @@ -3076,10 +3135,10 @@ namespace SimpleTypes virtual ESparklineType FromString(std::wstring &sValue) { - if(_T("line") == sValue) this->m_eValue = Line; - else if(_T("column") == sValue) this->m_eValue = Column; - else if(_T("stacked") == sValue) this->m_eValue = Stacked; - else this->m_eValue = eDefValue; + if(L"line" == sValue) this->m_eValue = Line; + else if(L"column" == sValue) this->m_eValue = Column; + else if(L"stacked" == sValue) this->m_eValue = Stacked; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3087,10 +3146,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case Line: return _T("line"); break; - case Column: return _T("column"); break; - case Stacked: return _T("stacked"); break; - default : return _T("line"); + case Line: return L"line"; break; + case Column: return L"column"; break; + case Stacked: return L"stacked"; break; + default : return L"line"; } } @@ -3100,7 +3159,7 @@ namespace SimpleTypes enum ESparklineAxisMinMax { - Individual = 0, + Individual = 0, Group = 1, Custom = 2 }; @@ -3113,9 +3172,9 @@ namespace SimpleTypes virtual ESparklineAxisMinMax FromString(std::wstring &sValue) { - if(_T("individual") == sValue) this->m_eValue = Individual; - else if(_T("group") == sValue) this->m_eValue = Group; - else if(_T("custom") == sValue) this->m_eValue = Custom; + if(L"individual" == sValue) this->m_eValue = Individual; + else if(L"group" == sValue) this->m_eValue = Group; + else if(L"custom" == sValue) this->m_eValue = Custom; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3124,10 +3183,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case Individual: return _T("individual"); break; - case Group: return _T("group"); break; - case Custom: return _T("custom"); break; - default: return _T("individual"); + case Individual: return L"individual"; break; + case Group: return L"group"; break; + case Custom: return L"custom"; break; + default: return L"individual"; } } @@ -3148,8 +3207,8 @@ namespace SimpleTypes virtual EDvAspect FromString(std::wstring &sValue) { - if(_T("DVASPECT_CONTENT") == sValue) this->m_eValue = Content; - else if(_T("DVASPECT_ICON") == sValue) this->m_eValue = Icon; + if(L"DVASPECT_CONTENT" == sValue) this->m_eValue = Content; + else if(L"DVASPECT_ICON" == sValue) this->m_eValue = Icon; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3158,9 +3217,9 @@ namespace SimpleTypes { switch(this->m_eValue) { - case Content: return _T("DVASPECT_CONTENT"); break; - case Icon: return _T("DVASPECT_ICON"); break; - default: return _T("DVASPECT_CONTENT"); + case Content: return L"DVASPECT_CONTENT"; break; + case Icon: return L"DVASPECT_ICON"; break; + default: return L"DVASPECT_CONTENT"; } } @@ -3169,8 +3228,8 @@ namespace SimpleTypes }; enum EOleUpdate { - Always = 0, - OnCall = 1 + Always = 0, + OnCall = 1 }; template class ST_OleUpdate : public CSimpleType @@ -3181,9 +3240,9 @@ namespace SimpleTypes virtual EOleUpdate FromString(std::wstring &sValue) { - if(_T("OLEUPDATE_ALWAYS") == sValue) this->m_eValue = Always; - else if(_T("OLEUPDATE_ONCALL") == sValue) this->m_eValue = OnCall; - else this->m_eValue = eDefValue; + if(L"OLEUPDATE_ALWAYS" == sValue) this->m_eValue = Always; + else if(L"OLEUPDATE_ONCALL" == sValue) this->m_eValue = OnCall; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3191,9 +3250,9 @@ namespace SimpleTypes { switch(this->m_eValue) { - case Always: return _T("OLEUPDATE_ALWAYS"); break; - case OnCall: return _T("OLEUPDATE_ONCALL"); break; - default: return _T("OLEUPDATE_ALWAYS"); + case Always: return L"OLEUPDATE_ALWAYS"; break; + case OnCall: return L"OLEUPDATE_ONCALL"; break; + default: return L"OLEUPDATE_ALWAYS"; } } @@ -3218,11 +3277,11 @@ namespace SimpleTypes virtual EActivePane FromString(std::wstring &sValue) { - if ( _T("bottomLeft") == sValue ) this->m_eValue = activepaneBottomLeft; - else if ( _T("bottomRight") == sValue ) this->m_eValue = activepaneBottomRight; - else if ( _T("topLeft") == sValue ) this->m_eValue = activepaneTopLeft; - else if ( _T("topRight") == sValue ) this->m_eValue = activepaneTopRight; - else this->m_eValue = eDefValue; + if ( L"bottomLeft" == sValue ) this->m_eValue = activepaneBottomLeft; + else if ( L"bottomRight" == sValue ) this->m_eValue = activepaneBottomRight; + else if ( L"topLeft" == sValue ) this->m_eValue = activepaneTopLeft; + else if ( L"topRight" == sValue ) this->m_eValue = activepaneTopRight; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3231,11 +3290,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case activepaneBottomLeft : return _T("bottomLeft"); - case activepaneBottomRight : return _T("bottomRight"); - case activepaneTopLeft : return _T("topLeft"); - case activepaneTopRight : return _T("topRight"); - default : return _T("topLeft"); + case activepaneBottomLeft : return L"bottomLeft"; + case activepaneBottomRight : return L"bottomRight"; + case activepaneTopLeft : return L"topLeft"; + case activepaneTopRight : return L"topRight"; + default : return L"topLeft"; } } @@ -3259,9 +3318,9 @@ namespace SimpleTypes virtual EPaneState FromString(std::wstring &sValue) { - if ( _T("frozen") == sValue ) this->m_eValue = panestateFrozen; - else if ( _T("frozenSplit") == sValue ) this->m_eValue = panestateFrozenSplit; - else if ( _T("split") == sValue ) this->m_eValue = panestateSplit; + if ( L"frozen" == sValue ) this->m_eValue = panestateFrozen; + else if ( L"frozenSplit" == sValue ) this->m_eValue = panestateFrozenSplit; + else if ( L"split" == sValue ) this->m_eValue = panestateSplit; else this->m_eValue = eDefValue; return this->m_eValue; @@ -3271,10 +3330,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case panestateFrozen : return _T("frozen"); - case panestateFrozenSplit : return _T("frozenSplit"); - case panestateSplit : return _T("split"); - default : return _T("frozen"); + case panestateFrozen : return L"frozen"; + case panestateFrozenSplit : return L"frozenSplit"; + case panestateSplit : return L"split"; + default : return L"frozen"; } } @@ -3300,12 +3359,12 @@ namespace SimpleTypes virtual EDdeValueType FromString(std::wstring &sValue) { - if ( _T("nil") == sValue ) this->m_eValue = ddevaluetypeNil; - else if ( _T("b") == sValue ) this->m_eValue = ddevaluetypeB; - else if ( _T("n") == sValue ) this->m_eValue = ddevaluetypeN; - else if ( _T("e") == sValue ) this->m_eValue = ddevaluetypeE; - else if ( _T("str") == sValue ) this->m_eValue = ddevaluetypeStr; - else this->m_eValue = eDefValue; + if ( L"nil" == sValue ) this->m_eValue = ddevaluetypeNil; + else if ( L"b" == sValue ) this->m_eValue = ddevaluetypeB; + else if ( L"n" == sValue ) this->m_eValue = ddevaluetypeN; + else if ( L"e" == sValue ) this->m_eValue = ddevaluetypeE; + else if ( L"str" == sValue ) this->m_eValue = ddevaluetypeStr; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3313,12 +3372,12 @@ namespace SimpleTypes { switch(this->m_eValue) { - case ddevaluetypeNil : return _T("nil"); - case ddevaluetypeB : return _T("b"); - case ddevaluetypeN : return _T("n"); - case ddevaluetypeE : return _T("e"); - case ddevaluetypeStr : return _T("str"); - default : return _T("nil"); + case ddevaluetypeNil : return L"nil"; + case ddevaluetypeB : return L"b"; + case ddevaluetypeN : return L"n"; + case ddevaluetypeE : return L"e"; + case ddevaluetypeStr : return L"str"; + default : return L"nil"; } } @@ -3342,22 +3401,22 @@ namespace SimpleTypes virtual ECalcMode FromString(std::wstring &sValue) { - if ( _T("auto") == sValue ) this->m_eValue = calcmodeAuto; - else if ( _T("autoNoTable") == sValue ) this->m_eValue = calcmodeAutoNoTable; - else if ( _T("manual") == sValue ) this->m_eValue = calcmodeManual; - else this->m_eValue = eDefValue; + if ( L"auto" == sValue ) this->m_eValue = calcmodeAuto; + else if ( L"autoNoTable" == sValue ) this->m_eValue = calcmodeAutoNoTable; + else if ( L"manual" == sValue ) this->m_eValue = calcmodeManual; + else this->m_eValue = eDefValue; return this->m_eValue; } - virtual std::wstring ToString () const + virtual std::wstring ToString () const { switch(this->m_eValue) { - case calcmodeAuto : return _T("auto");break; - case calcmodeAutoNoTable : return _T("autoNoTable");break; - case calcmodeManual : return _T("manual");break; - default : return _T("auto"); + case calcmodeAuto : return L"auto";break; + case calcmodeAutoNoTable : return L"autoNoTable";break; + case calcmodeManual : return L"manual";break; + default : return L"auto"; } } @@ -3381,20 +3440,20 @@ namespace SimpleTypes virtual ERefMode FromString(std::wstring &sValue) { - if ( _T("A1") == sValue ) this->m_eValue = refmodeA1; - else if ( _T("R1C1") == sValue ) this->m_eValue = refmodeR1C1; - else this->m_eValue = eDefValue; + if ( L"A1" == sValue ) this->m_eValue = refmodeA1; + else if ( L"R1C1" == sValue ) this->m_eValue = refmodeR1C1; + else this->m_eValue = eDefValue; return this->m_eValue; } - virtual std::wstring ToString () const + virtual std::wstring ToString () const { switch(this->m_eValue) { - case refmodeA1 : return _T("A1");break; - case refmodeR1C1 : return _T("R1C1");break; - default : return _T("A1"); + case refmodeA1 : return L"A1";break; + case refmodeR1C1 : return L"R1C1";break; + default : return L"A1"; } } @@ -3420,7 +3479,7 @@ namespace SimpleTypes virtual EDoubleOrAutomatic FromString(std::wstring &sValue) { - if(_T("auto") == sValue) + if(L"auto" == sValue) { this->m_eValue = typeAuto; m_dValue = 0; @@ -3440,7 +3499,7 @@ namespace SimpleTypes { switch(this->m_eValue) { - case typeAuto : return _T("auto");break; + case typeAuto : return L"auto";break; case typeDouble : default: { @@ -3473,15 +3532,15 @@ namespace SimpleTypes virtual ESeriesLayout FromString(std::wstring &sValue) { - if ( _T("boxWhisker") == sValue ) this->m_eValue = typeSeriesLayoutBoxWhisker; - else if ( _T("clusteredColumn") == sValue ) this->m_eValue = typeSeriesLayoutClusteredColumn; - else if ( _T("funnel") == sValue ) this->m_eValue = typeSeriesLayoutFunnel; - else if ( _T("paretoLine") == sValue ) this->m_eValue = typeSeriesLayoutParetoLine; - else if ( _T("regionMap") == sValue ) this->m_eValue = typeSeriesLayoutRegionMap; - else if ( _T("sunburst") == sValue ) this->m_eValue = typeSeriesLayoutSunburst; - else if ( _T("treemap") == sValue ) this->m_eValue = typeSeriesLayoutTreemap; - else if ( _T("waterfall") == sValue ) this->m_eValue = typeSeriesLayoutWaterfall; - else this->m_eValue = eDefValue; + if ( L"boxWhisker" == sValue ) this->m_eValue = typeSeriesLayoutBoxWhisker; + else if ( L"clusteredColumn" == sValue ) this->m_eValue = typeSeriesLayoutClusteredColumn; + else if ( L"funnel" == sValue ) this->m_eValue = typeSeriesLayoutFunnel; + else if ( L"paretoLine" == sValue ) this->m_eValue = typeSeriesLayoutParetoLine; + else if ( L"regionMap" == sValue ) this->m_eValue = typeSeriesLayoutRegionMap; + else if ( L"sunburst" == sValue ) this->m_eValue = typeSeriesLayoutSunburst; + else if ( L"treemap" == sValue ) this->m_eValue = typeSeriesLayoutTreemap; + else if ( L"waterfall" == sValue ) this->m_eValue = typeSeriesLayoutWaterfall; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3490,15 +3549,15 @@ namespace SimpleTypes { switch(this->m_eValue) { - case typeSeriesLayoutBoxWhisker : return _T("boxWhisker");break; - case typeSeriesLayoutClusteredColumn : return _T("clusteredColumn");break; - case typeSeriesLayoutFunnel: return _T("funnel"); break; - case typeSeriesLayoutParetoLine : return _T("paretoLine");break; - case typeSeriesLayoutRegionMap : return _T("regionMap"); break; - case typeSeriesLayoutSunburst : return _T("sunburst"); break; - case typeSeriesLayoutTreemap : return _T("treemap"); break; - case typeSeriesLayoutWaterfall : return _T("waterfall"); break; - default : return _T("auto"); + case typeSeriesLayoutBoxWhisker : return L"boxWhisker";break; + case typeSeriesLayoutClusteredColumn : return L"clusteredColumn";break; + case typeSeriesLayoutFunnel: return L"funnel"; break; + case typeSeriesLayoutParetoLine : return L"paretoLine";break; + case typeSeriesLayoutRegionMap : return L"regionMap"; break; + case typeSeriesLayoutSunburst : return L"sunburst"; break; + case typeSeriesLayoutTreemap : return L"treemap"; break; + case typeSeriesLayoutWaterfall : return L"waterfall"; break; + default : return L"auto"; } } @@ -3529,17 +3588,17 @@ namespace SimpleTypes virtual EAxisUnit FromString(std::wstring &sValue) { - if ( _T("hundreds") == sValue ) this->m_eValue = unitHundreds; - else if ( _T("thousands") == sValue ) this->m_eValue = unitThousands; - else if ( _T("tenThousands") == sValue ) this->m_eValue = unitTenThousands; - else if ( _T("hundredThousands")== sValue ) this->m_eValue = unitHundredThousands; - else if ( _T("millions") == sValue ) this->m_eValue = unitMillions; - else if ( _T("tenMillions") == sValue ) this->m_eValue = unitTenMillions; - else if ( _T("hundredMillions") == sValue ) this->m_eValue = unitHundredMillions; - else if ( _T("billions") == sValue ) this->m_eValue = unitBillions; - else if ( _T("trillions") == sValue ) this->m_eValue = unitTrillions; - else if ( _T("percentage") == sValue ) this->m_eValue = unitPercentage; - else this->m_eValue = eDefValue; + if ( L"hundreds" == sValue ) this->m_eValue = unitHundreds; + else if ( L"thousands" == sValue ) this->m_eValue = unitThousands; + else if ( L"tenThousands" == sValue ) this->m_eValue = unitTenThousands; + else if ( L"hundredThousands" == sValue ) this->m_eValue = unitHundredThousands; + else if ( L"millions" == sValue ) this->m_eValue = unitMillions; + else if ( L"tenMillions" == sValue ) this->m_eValue = unitTenMillions; + else if ( L"hundredMillions" == sValue ) this->m_eValue = unitHundredMillions; + else if ( L"billions" == sValue ) this->m_eValue = unitBillions; + else if ( L"trillions" == sValue ) this->m_eValue = unitTrillions; + else if ( L"percentage" == sValue ) this->m_eValue = unitPercentage; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3548,17 +3607,17 @@ namespace SimpleTypes { switch(this->m_eValue) { - case unitHundreds : return _T("hundreds"); break; - case unitThousands : return _T("thousands"); break; - case unitTenThousands: return _T("tenThousands"); break; - case unitHundredThousands : return _T("hundredThousands");break; - case unitMillions : return _T("millions"); break; - case unitTenMillions : return _T("tenMillions"); break; - case unitHundredMillions : return _T("hundredMillions");break; - case unitBillions : return _T("billions"); break; - case unitTrillions : return _T("trillions"); break; - case unitPercentage : return _T("percentage"); break; - default : return _T(""); + case unitHundreds : return L"hundreds"; break; + case unitThousands : return L"thousands"; break; + case unitTenThousands: return L"tenThousands"; break; + case unitHundredThousands : return L"hundredThousands";break; + case unitMillions : return L"millions"; break; + case unitTenMillions : return L"tenMillions"; break; + case unitHundredMillions : return L"hundredMillions";break; + case unitBillions : return L"billions"; break; + case unitTrillions : return L"trillions"; break; + case unitPercentage : return L"percentage"; break; + default : return L""; } } @@ -3584,14 +3643,14 @@ namespace SimpleTypes virtual EDimensionType FromString(std::wstring &sValue) { - if ( _T("val") == sValue ) this->m_eValue = typeDimensionVal; - else if ( _T("x") == sValue ) this->m_eValue = typeDimensionX; - else if ( _T("y") == sValue ) this->m_eValue = typeDimensionY; - else if ( _T("size") == sValue ) this->m_eValue = typeDimensionSize; - else if ( _T("colorVal")== sValue ) this->m_eValue = typeDimensionColorVal; - else if ( _T("cat") == sValue ) this->m_eValue = typeDimensionCat; - else if ( _T("colorStr")== sValue ) this->m_eValue = typeDimensionColorStr; - else this->m_eValue = eDefValue; + if ( L"val" == sValue ) this->m_eValue = typeDimensionVal; + else if ( L"x" == sValue ) this->m_eValue = typeDimensionX; + else if ( L"y" == sValue ) this->m_eValue = typeDimensionY; + else if ( L"size" == sValue ) this->m_eValue = typeDimensionSize; + else if ( L"colorVal" == sValue ) this->m_eValue = typeDimensionColorVal; + else if ( L"cat" == sValue ) this->m_eValue = typeDimensionCat; + else if ( L"colorStr" == sValue ) this->m_eValue = typeDimensionColorStr; + else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3599,14 +3658,14 @@ namespace SimpleTypes { switch(this->m_eValue) { - case typeDimensionVal : return _T("val"); - case typeDimensionX : return _T("x"); - case typeDimensionY: return _T("y"); - case typeDimensionSize : return _T("size"); - case typeDimensionColorVal :return _T("colorVal"); - case typeDimensionCat : return _T("cat"); - case typeDimensionColorStr :return _T("colorStr"); - default : return _T(""); + case typeDimensionVal : return L"val"; + case typeDimensionX : return L"x"; + case typeDimensionY: return L"y"; + case typeDimensionSize : return L"size"; + case typeDimensionColorVal :return L"colorVal"; + case typeDimensionCat : return L"cat"; + case typeDimensionColorStr :return L"colorStr"; + default : return L""; } } @@ -3627,7 +3686,7 @@ namespace SimpleTypes virtual EFormulaDirection FromString(std::wstring &sValue) { - if(_T("row") == sValue) this->m_eValue = directionRow; + if(L"row" == sValue) this->m_eValue = directionRow; else this->m_eValue = directionCol; return this->m_eValue; } @@ -3635,11 +3694,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case directionRow : return _T("row"); + case directionRow : return L"row"; case directionCol : default: { - return _T("col"); + return L"col"; }break; } } @@ -3663,10 +3722,10 @@ namespace SimpleTypes virtual ESidePos FromString(std::wstring &sValue) { - if ( _T("t") == sValue ) this->m_eValue = sideTop; - else if ( _T("l") == sValue ) this->m_eValue = sideLeft; - else if ( _T("r") == sValue ) this->m_eValue = sideRight; - else if ( _T("b") == sValue ) this->m_eValue = sideBottom; + if ( L"t" == sValue ) this->m_eValue = sideTop; + else if ( L"l" == sValue ) this->m_eValue = sideLeft; + else if ( L"r" == sValue ) this->m_eValue = sideRight; + else if ( L"b" == sValue ) this->m_eValue = sideBottom; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3675,11 +3734,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case sideLeft : return _T("l"); - case sideRight: return _T("r"); - case sideBottom : return _T("b"); + case sideLeft : return L"l"; + case sideRight: return L"r"; + case sideBottom : return L"b"; case sideTop : - default : return _T("t"); + default : return L"t"; } } @@ -3701,9 +3760,9 @@ namespace SimpleTypes virtual EPosAlign FromString(std::wstring &sValue) { - if ( _T("min") == sValue ) this->m_eValue = posAlignMin; - else if ( _T("max") == sValue ) this->m_eValue = posAlignMax; - else if ( _T("ctr") == sValue ) this->m_eValue = posAlignCtr; + if ( L"min" == sValue ) this->m_eValue = posAlignMin; + else if ( L"max" == sValue ) this->m_eValue = posAlignMax; + else if ( L"ctr" == sValue ) this->m_eValue = posAlignCtr; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3712,10 +3771,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case posAlignMax : return _T("max"); - case posAlignMin: return _T("min"); + case posAlignMax : return L"max"; + case posAlignMin: return L"min"; case posAlignCtr : - default : return _T("ctr"); + default : return L"ctr"; } } @@ -3737,9 +3796,9 @@ namespace SimpleTypes virtual ERegionLabelLayout FromString(std::wstring &sValue) { - if ( _T("none") == sValue ) this->m_eValue = layoutNone; - else if ( _T("bestFitOnly") == sValue ) this->m_eValue = layoutBestFitOnly; - else if ( _T("showAll") == sValue ) this->m_eValue = layoutShowAll; + if ( L"none" == sValue ) this->m_eValue = layoutNone; + else if ( L"bestFitOnly" == sValue ) this->m_eValue = layoutBestFitOnly; + else if ( L"showAll" == sValue ) this->m_eValue = layoutShowAll; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3748,10 +3807,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case layoutNone : return _T("none"); - case layoutBestFitOnly: return _T("bestFitOnly"); + case layoutNone : return L"none"; + case layoutBestFitOnly: return L"bestFitOnly"; case layoutShowAll : - default : return _T("showAll"); + default : return L"showAll"; } } @@ -3773,9 +3832,9 @@ namespace SimpleTypes virtual EParentLabelLayout FromString(std::wstring &sValue) { - if ( _T("none") == sValue ) this->m_eValue = layoutNone_; - else if ( _T("banner") == sValue ) this->m_eValue = layoutBanner; - else if ( _T("overlapping") == sValue ) this->m_eValue = layoutOverlapping; + if ( L"none" == sValue ) this->m_eValue = layoutNone_; + else if ( L"banner" == sValue ) this->m_eValue = layoutBanner; + else if ( L"overlapping" == sValue ) this->m_eValue = layoutOverlapping; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3784,10 +3843,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case layoutNone_ : return _T("none"); - case layoutOverlapping: return _T("banner"); + case layoutNone_ : return L"none"; + case layoutOverlapping: return L"banner"; case layoutBanner : - default : return _T("overlapping"); + default : return L"overlapping"; } } @@ -3809,8 +3868,8 @@ namespace SimpleTypes virtual EQuartileMethod FromString(std::wstring &sValue) { - if ( _T("inclusive") == sValue ) this->m_eValue = methodInclusive; - else if ( _T("exclusive") == sValue ) this->m_eValue = methodExclusive; + if ( L"inclusive" == sValue ) this->m_eValue = methodInclusive; + else if ( L"exclusive" == sValue ) this->m_eValue = methodExclusive; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3819,9 +3878,9 @@ namespace SimpleTypes { switch(this->m_eValue) { - case methodInclusive : return _T("inclusive"); + case methodInclusive : return L"inclusive"; case methodExclusive: - default : return _T("exclusive"); + default : return L"exclusive"; } } @@ -3851,15 +3910,15 @@ namespace SimpleTypes virtual EDataLabelPos FromString(std::wstring &sValue) { - if ( _T("bestFit") == sValue ) this->m_eValue = posBestFit; - else if ( _T("b") == sValue ) this->m_eValue = posBottom; - else if ( _T("ctr") == sValue ) this->m_eValue = posCtr; - else if ( _T("inBase") == sValue ) this->m_eValue = posInBase; - else if ( _T("inEnd") == sValue ) this->m_eValue = posInEnd; - else if ( _T("l") == sValue ) this->m_eValue = posLeft; - else if ( _T("outEnd") == sValue ) this->m_eValue = posOutEnd; - else if ( _T("r") == sValue ) this->m_eValue = posRight; - else if ( _T("t") == sValue ) this->m_eValue = posTop; + if ( L"bestFit" == sValue ) this->m_eValue = posBestFit; + else if ( L"b" == sValue ) this->m_eValue = posBottom; + else if ( L"ctr" == sValue ) this->m_eValue = posCtr; + else if ( L"inBase" == sValue ) this->m_eValue = posInBase; + else if ( L"inEnd" == sValue ) this->m_eValue = posInEnd; + else if ( L"l" == sValue ) this->m_eValue = posLeft; + else if ( L"outEnd" == sValue ) this->m_eValue = posOutEnd; + else if ( L"r" == sValue ) this->m_eValue = posRight; + else if ( L"t" == sValue ) this->m_eValue = posTop; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3868,16 +3927,16 @@ namespace SimpleTypes { switch(this->m_eValue) { - case posBottom : return _T("b"); - case posCtr : return _T("ctr"); - case posInBase : return _T("inBase"); - case posInEnd : return _T("inEnd"); - case posLeft : return _T("l"); - case posOutEnd : return _T("outEnd"); - case posRight : return _T("r"); - case posTop : return _T("t"); + case posBottom : return L"b"; + case posCtr : return L"ctr"; + case posInBase : return L"inBase"; + case posInEnd : return L"inEnd"; + case posLeft : return L"l"; + case posOutEnd : return L"outEnd"; + case posRight : return L"r"; + case posTop : return L"t"; case posBestFit: - default : return _T("bestFit"); + default : return L"bestFit"; } } @@ -3894,8 +3953,8 @@ namespace SimpleTypes virtual ESidePos FromString(std::wstring &sValue) { - if ( _T("l") == sValue ) this->m_eValue = sideLeft; - else if ( _T("r") == sValue ) this->m_eValue = sideRight; + if ( L"l" == sValue ) this->m_eValue = sideLeft; + else if ( L"r" == sValue ) this->m_eValue = sideRight; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3904,9 +3963,9 @@ namespace SimpleTypes { switch(this->m_eValue) { - case sideRight: return _T("r"); + case sideRight: return L"r"; case sideLeft : - default : return _T("l"); + default : return L"l"; } } @@ -3931,10 +3990,10 @@ namespace SimpleTypes virtual ETickMarksType FromString(std::wstring &sValue) { - if ( _T("none") == sValue ) this->m_eValue = marksTypeNone; - else if ( _T("out") == sValue ) this->m_eValue = marksTypeOut; - else if ( _T("in") == sValue ) this->m_eValue = marksTypeIn; - else if ( _T("cross") == sValue ) this->m_eValue = marksTypeCross; + if ( L"none" == sValue ) this->m_eValue = marksTypeNone; + else if ( L"out" == sValue ) this->m_eValue = marksTypeOut; + else if ( L"in" == sValue ) this->m_eValue = marksTypeIn; + else if ( L"cross" == sValue ) this->m_eValue = marksTypeCross; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -3943,11 +4002,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case marksTypeIn : return _T("in"); - case marksTypeOut : return _T("out"); - case marksTypeCross : return _T("cross"); + case marksTypeIn : return L"in"; + case marksTypeOut : return L"out"; + case marksTypeCross : return L"cross"; case marksTypeNone: - default : return _T("none"); + default : return L"none"; } } @@ -3970,10 +4029,10 @@ namespace SimpleTypes virtual ESourceCacheType FromString(std::wstring &sValue) { - if ( _T("consolidation") == sValue ) this->m_eValue = typeSourceConsolidation; - else if ( _T("external") == sValue ) this->m_eValue = typeSourceExternal; - else if ( _T("scenario") == sValue ) this->m_eValue = typeSourceScenario; - else if ( _T("worksheet") == sValue ) this->m_eValue = typeSourceWorksheet; + if ( L"consolidation" == sValue ) this->m_eValue = typeSourceConsolidation; + else if ( L"external" == sValue ) this->m_eValue = typeSourceExternal; + else if ( L"scenario" == sValue ) this->m_eValue = typeSourceScenario; + else if ( L"worksheet" == sValue ) this->m_eValue = typeSourceWorksheet; return this->m_eValue; } @@ -3981,11 +4040,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case typeSourceConsolidation: return _T("consolidation"); - case typeSourceExternal: return _T("external"); - case typeSourceScenario: return _T("scenario"); - case typeSourceWorksheet: return _T("worksheet"); - default : return _T("worksheet"); + case typeSourceConsolidation: return L"consolidation"; + case typeSourceExternal: return L"external"; + case typeSourceScenario: return L"scenario"; + case typeSourceWorksheet: return L"worksheet"; + default : return L"worksheet"; } } SimpleType_FromString (ESourceCacheType) @@ -4011,14 +4070,14 @@ namespace SimpleTypes virtual EValuesGroupBy FromString(std::wstring &sValue) { - if ( _T("days") == sValue ) this->m_eValue = groupByDays; - else if ( _T("hours") == sValue ) this->m_eValue = groupByHours; - else if ( _T("minutes") == sValue ) this->m_eValue = groupByMinutes; - else if ( _T("months") == sValue ) this->m_eValue = groupByMonths; - else if ( _T("quarters")== sValue ) this->m_eValue = groupByQuarters; - else if ( _T("range") == sValue ) this->m_eValue = groupByNumericRanges; - else if ( _T("seconds") == sValue ) this->m_eValue = groupBySeconds; - else if ( _T("years") == sValue ) this->m_eValue = groupByYears; + if ( L"days" == sValue ) this->m_eValue = groupByDays; + else if ( L"hours" == sValue ) this->m_eValue = groupByHours; + else if ( L"minutes" == sValue ) this->m_eValue = groupByMinutes; + else if ( L"months" == sValue ) this->m_eValue = groupByMonths; + else if ( L"quarters" == sValue ) this->m_eValue = groupByQuarters; + else if ( L"range" == sValue ) this->m_eValue = groupByNumericRanges; + else if ( L"seconds" == sValue ) this->m_eValue = groupBySeconds; + else if ( L"years" == sValue ) this->m_eValue = groupByYears; return this->m_eValue; } @@ -4026,15 +4085,15 @@ namespace SimpleTypes { switch(this->m_eValue) { - case groupByDays: return _T("days"); - case groupByHours: return _T("hours"); - case groupByMinutes: return _T("minutes"); - case groupByMonths: return _T("months"); - case groupByQuarters: return _T("quarters"); - case groupByNumericRanges: return _T("range"); - case groupBySeconds: return _T("seconds"); - case groupByYears: return _T("years"); - default : return _T(""); + case groupByDays: return L"days"; + case groupByHours: return L"hours"; + case groupByMinutes: return L"minutes"; + case groupByMonths: return L"months"; + case groupByQuarters: return L"quarters"; + case groupByNumericRanges: return L"range"; + case groupBySeconds: return L"seconds"; + case groupByYears: return L"years"; + default : return L""; } } SimpleType_FromString (EValuesGroupBy) @@ -4067,21 +4126,21 @@ namespace SimpleTypes virtual EPivotItemType FromString(std::wstring &sValue) { - if ( _T("avg") == sValue ) this->m_eValue = typeAverage; - else if ( _T("blank") == sValue ) this->m_eValue = typeBlank; - else if ( _T("count") == sValue ) this->m_eValue = typeCount; - else if ( _T("countA") == sValue ) this->m_eValue = typeCountA; - else if ( _T("data") == sValue ) this->m_eValue = typeData; - else if ( _T("default") == sValue ) this->m_eValue = typeDefault; - else if ( _T("grand") == sValue ) this->m_eValue = typeGrandTotalt; - else if ( _T("min") == sValue ) this->m_eValue = typeMin; - else if ( _T("max") == sValue ) this->m_eValue = typeMax; - else if ( _T("product") == sValue ) this->m_eValue = typeProduct; - else if ( _T("stdDev") == sValue ) this->m_eValue = typeStdDev; - else if ( _T("stdDevP") == sValue ) this->m_eValue = typeStdDevP; - else if ( _T("sum") == sValue ) this->m_eValue = typeSum; - else if ( _T("var") == sValue ) this->m_eValue = typeVar; - else if ( _T("varP") == sValue ) this->m_eValue = typeVarP; + if ( L"avg" == sValue ) this->m_eValue = typeAverage; + else if ( L"blank" == sValue ) this->m_eValue = typeBlank; + else if ( L"count" == sValue ) this->m_eValue = typeCount; + else if ( L"countA" == sValue ) this->m_eValue = typeCountA; + else if ( L"data" == sValue ) this->m_eValue = typeData; + else if ( L"default" == sValue ) this->m_eValue = typeDefault; + else if ( L"grand" == sValue ) this->m_eValue = typeGrandTotalt; + else if ( L"min" == sValue ) this->m_eValue = typeMin; + else if ( L"max" == sValue ) this->m_eValue = typeMax; + else if ( L"product" == sValue ) this->m_eValue = typeProduct; + else if ( L"stdDev" == sValue ) this->m_eValue = typeStdDev; + else if ( L"stdDevP" == sValue ) this->m_eValue = typeStdDevP; + else if ( L"sum" == sValue ) this->m_eValue = typeSum; + else if ( L"var" == sValue ) this->m_eValue = typeVar; + else if ( L"varP" == sValue ) this->m_eValue = typeVarP; return this->m_eValue; } @@ -4089,22 +4148,22 @@ namespace SimpleTypes { switch(this->m_eValue) { - case typeAverage: return _T("avg"); - case typeBlank: return _T("blank"); - case typeCount: return _T("count"); - case typeCountA: return _T("countA"); - case typeData: return _T("data"); - case typeDefault: return _T("default"); - case typeGrandTotalt:return _T("grand"); - case typeMin: return _T("min"); - case typeMax: return _T("max"); - case typeProduct: return _T("product"); - case typeStdDev: return _T("stdDev"); - case typeStdDevP: return _T("stdDevP"); - case typeSum: return _T("sum"); - case typeVar: return _T("var"); - case typeVarP: return _T("varP"); - default : return _T(""); + case typeAverage: return L"avg"; + case typeBlank: return L"blank"; + case typeCount: return L"count"; + case typeCountA: return L"countA"; + case typeData: return L"data"; + case typeDefault: return L"default"; + case typeGrandTotalt:return L"grand"; + case typeMin: return L"min"; + case typeMax: return L"max"; + case typeProduct: return L"product"; + case typeStdDev: return L"stdDev"; + case typeStdDevP: return L"stdDevP"; + case typeSum: return L"sum"; + case typeVar: return L"var"; + case typeVarP: return L"varP"; + default : return L""; } } SimpleType_FromString (EPivotItemType) @@ -4125,9 +4184,9 @@ namespace SimpleTypes virtual EFieldSortType FromString(std::wstring &sValue) { - if ( _T("manual") == sValue ) this->m_eValue = sortManual; - else if ( _T("ascending") == sValue ) this->m_eValue = sortAscending; - else if ( _T("descending") == sValue ) this->m_eValue = sortDescending; + if ( L"manual" == sValue ) this->m_eValue = sortManual; + else if ( L"ascending" == sValue ) this->m_eValue = sortAscending; + else if ( L"descending" == sValue ) this->m_eValue = sortDescending; return this->m_eValue; } @@ -4135,10 +4194,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case sortManual: return _T("manual"); - case sortAscending: return _T("ascending"); - case sortDescending: return _T("descending"); - default : return _T(""); + case sortManual: return L"manual"; + case sortAscending: return L"ascending"; + case sortDescending: return L"descending"; + default : return L""; } } SimpleType_FromString (EFieldSortType) @@ -4164,13 +4223,13 @@ namespace SimpleTypes virtual EPivotAreaType FromString(std::wstring &sValue) { - if ( _T("all") == sValue ) this->m_eValue = areaAll; - else if ( _T("button") == sValue ) this->m_eValue = areaFieldButton; - else if ( _T("data") == sValue ) this->m_eValue = areaData; - else if ( _T("none") == sValue ) this->m_eValue = areaNone; - else if ( _T("normal") == sValue ) this->m_eValue = areaNormal; - else if ( _T("origin") == sValue ) this->m_eValue = areaOrigin; - else if ( _T("topEnd") == sValue ) this->m_eValue = areaTopEnd; + if ( L"all" == sValue ) this->m_eValue = areaAll; + else if ( L"button" == sValue ) this->m_eValue = areaFieldButton; + else if ( L"data" == sValue ) this->m_eValue = areaData; + else if ( L"none" == sValue ) this->m_eValue = areaNone; + else if ( L"normal" == sValue ) this->m_eValue = areaNormal; + else if ( L"origin" == sValue ) this->m_eValue = areaOrigin; + else if ( L"topEnd" == sValue ) this->m_eValue = areaTopEnd; return this->m_eValue; } @@ -4178,14 +4237,14 @@ namespace SimpleTypes { switch(this->m_eValue) { - case areaAll: return _T("all"); - case areaFieldButton: return _T("button"); - case areaData: return _T("data"); - case areaNone: return _T("none"); - case areaNormal: return _T("normal"); - case areaOrigin: return _T("origin"); - case areaTopEnd: return _T("topEnd"); - default : return _T(""); + case areaAll: return L"all"; + case areaFieldButton: return L"button"; + case areaData: return L"data"; + case areaNone: return L"none"; + case areaNormal: return L"normal"; + case areaOrigin: return L"origin"; + case areaTopEnd: return L"topEnd"; + default : return L""; } } SimpleType_FromString (EPivotAreaType) @@ -4207,10 +4266,10 @@ namespace SimpleTypes virtual EPivotAxisType FromString(std::wstring &sValue) { - if ( _T("axisCol") == sValue ) this->m_eValue = axisCol; - else if ( _T("axisPage") == sValue ) this->m_eValue = axisPage; - else if ( _T("axisRow") == sValue ) this->m_eValue = axisRow; - else if ( _T("axisValues") == sValue ) this->m_eValue = axisValues; + if ( L"axisCol" == sValue ) this->m_eValue = axisCol; + else if ( L"axisPage" == sValue ) this->m_eValue = axisPage; + else if ( L"axisRow" == sValue ) this->m_eValue = axisRow; + else if ( L"axisValues" == sValue ) this->m_eValue = axisValues; return this->m_eValue; } @@ -4218,11 +4277,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case axisCol: return _T("axisCol"); - case axisPage: return _T("axisPage"); - case axisRow: return _T("countNums"); - case axisValues: return _T("axisRow"); - default : return _T(""); + case axisCol: return L"axisCol"; + case axisPage: return L"axisPage"; + case axisRow: return L"countNums"; + case axisValues: return L"axisRow"; + default : return L""; } } SimpleType_FromString (EPivotAxisType) @@ -4244,10 +4303,10 @@ namespace SimpleTypes virtual EFormatAction FromString(std::wstring &sValue) { - if ( _T("blank") == sValue ) this->m_eValue = actionBlank; - else if ( _T("drill") == sValue ) this->m_eValue = actionDrill; - else if ( _T("formatting") == sValue ) this->m_eValue = actionFormatting; - else if ( _T("formula") == sValue ) this->m_eValue = actionFormula; + if ( L"blank" == sValue ) this->m_eValue = actionBlank; + else if ( L"drill" == sValue ) this->m_eValue = actionDrill; + else if ( L"formatting" == sValue ) this->m_eValue = actionFormatting; + else if ( L"formula" == sValue ) this->m_eValue = actionFormula; return this->m_eValue; } @@ -4255,11 +4314,11 @@ namespace SimpleTypes { switch(this->m_eValue) { - case actionBlank: return _T("blank"); - case actionDrill: return _T("drill"); - case actionFormatting: return _T("formatting"); - case actionFormula: return _T("formula"); - default : return _T(""); + case actionBlank: return L"blank"; + case actionDrill: return L"drill"; + case actionFormatting: return L"formatting"; + case actionFormula: return L"formula"; + default : return L""; } } SimpleType_FromString (EFormatAction) @@ -4286,15 +4345,15 @@ namespace SimpleTypes virtual EShowDataAs FromString(std::wstring &sValue) { - if ( _T("difference") == sValue ) this->m_eValue = dataAsDifference; - else if ( _T("index") == sValue ) this->m_eValue = dataAsIndex; - else if ( _T("normal") == sValue ) this->m_eValue = dataAsNormal; - else if ( _T("percent") == sValue ) this->m_eValue = dataAsPercentOff; - else if ( _T("percentDiff") == sValue ) this->m_eValue = dataAsPercentDiff; - else if ( _T("percentOfCol") == sValue ) this->m_eValue = dataAsPercentOfCol; - else if ( _T("percentOfRow") == sValue ) this->m_eValue = dataAsPercentOfRow; - else if ( _T("percentOfTotal") == sValue ) this->m_eValue = dataAsPercentOfTotal; - else if ( _T("runTotal") == sValue ) this->m_eValue = dataAsRunTotal; + if ( L"difference" == sValue ) this->m_eValue = dataAsDifference; + else if ( L"index" == sValue ) this->m_eValue = dataAsIndex; + else if ( L"normal" == sValue ) this->m_eValue = dataAsNormal; + else if ( L"percent" == sValue ) this->m_eValue = dataAsPercentOff; + else if ( L"percentDiff" == sValue ) this->m_eValue = dataAsPercentDiff; + else if ( L"percentOfCol" == sValue ) this->m_eValue = dataAsPercentOfCol; + else if ( L"percentOfRow" == sValue ) this->m_eValue = dataAsPercentOfRow; + else if ( L"percentOfTotal" == sValue ) this->m_eValue = dataAsPercentOfTotal; + else if ( L"runTotal" == sValue ) this->m_eValue = dataAsRunTotal; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4303,16 +4362,16 @@ namespace SimpleTypes { switch(this->m_eValue) { - case dataAsDifference: return _T("difference"); - case dataAsIndex: return _T("index"); - case dataAsNormal: return _T("normal"); - case dataAsPercentOff: return _T("percent"); - case dataAsPercentDiff: return _T("percentDiff"); - case dataAsPercentOfCol: return _T("percentOfCol"); - case dataAsPercentOfRow: return _T("percentOfRow"); - case dataAsPercentOfTotal: return _T("percentOfTotal"); - case dataAsRunTotal: return _T("percentOfTotal"); - default : return _T("runTotal"); + case dataAsDifference: return L"difference"; + case dataAsIndex: return L"index"; + case dataAsNormal: return L"normal"; + case dataAsPercentOff: return L"percent"; + case dataAsPercentDiff: return L"percentDiff"; + case dataAsPercentOfCol: return L"percentOfCol"; + case dataAsPercentOfRow: return L"percentOfRow"; + case dataAsPercentOfTotal: return L"percentOfTotal"; + case dataAsRunTotal: return L"percentOfTotal"; + default : return L"runTotal"; } } @@ -4342,17 +4401,17 @@ namespace SimpleTypes virtual EDataConsolidateFunction FromString(std::wstring &sValue) { - if ( _T("average") == sValue ) this->m_eValue = functionAverage; - else if ( _T("count") == sValue ) this->m_eValue = functionCount; - else if ( _T("countNums") == sValue ) this->m_eValue = functionCountNums; - else if ( _T("max") == sValue ) this->m_eValue = functionMaximum; - else if ( _T("min") == sValue ) this->m_eValue = functionMinimum; - else if ( _T("product") == sValue ) this->m_eValue = functionProduct; - else if ( _T("stdDev") == sValue ) this->m_eValue = functionStdDev; - else if ( _T("stdDevp") == sValue ) this->m_eValue = functionStdDevP; - else if ( _T("sum") == sValue ) this->m_eValue = functionSum; - else if ( _T("var") == sValue ) this->m_eValue = functionVariance; - else if ( _T("varp") == sValue ) this->m_eValue = functionVarP; + if ( L"average" == sValue ) this->m_eValue = functionAverage; + else if ( L"count" == sValue ) this->m_eValue = functionCount; + else if ( L"countNums" == sValue ) this->m_eValue = functionCountNums; + else if ( L"max" == sValue ) this->m_eValue = functionMaximum; + else if ( L"min" == sValue ) this->m_eValue = functionMinimum; + else if ( L"product" == sValue ) this->m_eValue = functionProduct; + else if ( L"stdDev" == sValue ) this->m_eValue = functionStdDev; + else if ( L"stdDevp" == sValue ) this->m_eValue = functionStdDevP; + else if ( L"sum" == sValue ) this->m_eValue = functionSum; + else if ( L"var" == sValue ) this->m_eValue = functionVariance; + else if ( L"varp" == sValue ) this->m_eValue = functionVarP; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4361,18 +4420,18 @@ namespace SimpleTypes { switch(this->m_eValue) { - case functionAverage: return _T("average"); - case functionCount: return _T("count"); - case functionCountNums: return _T("countNums"); - case functionMaximum: return _T("max"); - case functionMinimum: return _T("min"); - case functionProduct: return _T("product"); - case functionStdDev: return _T("stdDev"); - case functionStdDevP: return _T("stdDevp"); - case functionSum: return _T("sum"); - case functionVariance: return _T("var"); - case functionVarP: return _T("varp"); - default : return _T("sum"); + case functionAverage: return L"average"; + case functionCount: return L"count"; + case functionCountNums: return L"countNums"; + case functionMaximum: return L"max"; + case functionMinimum: return L"min"; + case functionProduct: return L"product"; + case functionStdDev: return L"stdDev"; + case functionStdDevP: return L"stdDevp"; + case functionSum: return L"sum"; + case functionVariance: return L"var"; + case functionVarP: return L"varp"; + default : return L"sum"; } } @@ -4446,9 +4505,9 @@ namespace SimpleTypes virtual EDataValidationErrorStyle FromString(std::wstring &sValue) { - if ( _T("stop") == sValue ) this->m_eValue = errorStyleStop; - else if ( _T("warning") == sValue ) this->m_eValue = errorStyleWarning; - else if ( _T("information") == sValue ) this->m_eValue = errorStyleInformation; + if ( L"stop" == sValue ) this->m_eValue = errorStyleStop; + else if ( L"warning" == sValue ) this->m_eValue = errorStyleWarning; + else if ( L"information" == sValue ) this->m_eValue = errorStyleInformation; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4457,10 +4516,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case errorStyleInformation : return _T("information"); - case errorStyleWarning : return _T("warning"); + case errorStyleInformation : return L"information"; + case errorStyleWarning : return L"warning"; case errorStyleStop: - default : return _T("stop"); + default : return L"stop"; } } @@ -4487,14 +4546,14 @@ namespace SimpleTypes virtual EDataValidationOperator FromString(std::wstring &sValue) { - if ( _T("between") == sValue ) this->m_eValue = operatorBetween; - else if ( _T("notBetween") == sValue ) this->m_eValue = operatorNotBetween; - else if ( _T("equal") == sValue ) this->m_eValue = operatorEqual; - else if ( _T("notEqual") == sValue ) this->m_eValue = operatorNotEqual; - else if ( _T("lessThan") == sValue ) this->m_eValue = operatorLessThan; - else if ( _T("lessThanOrEqual") == sValue ) this->m_eValue = operatorLessThanOrEqual; - else if ( _T("greaterThan") == sValue ) this->m_eValue = operatorGreaterThan; - else if ( _T("greaterThanOrEqual")== sValue ) this->m_eValue = operatorGreaterThanOrEqual; + if ( L"between" == sValue ) this->m_eValue = operatorBetween; + else if ( L"notBetween" == sValue ) this->m_eValue = operatorNotBetween; + else if ( L"equal" == sValue ) this->m_eValue = operatorEqual; + else if ( L"notEqual" == sValue ) this->m_eValue = operatorNotEqual; + else if ( L"lessThan" == sValue ) this->m_eValue = operatorLessThan; + else if ( L"lessThanOrEqual" == sValue ) this->m_eValue = operatorLessThanOrEqual; + else if ( L"greaterThan" == sValue ) this->m_eValue = operatorGreaterThan; + else if ( L"greaterThanOrEqual" == sValue ) this->m_eValue = operatorGreaterThanOrEqual; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4503,15 +4562,15 @@ namespace SimpleTypes { switch(this->m_eValue) { - case operatorBetween : return _T("between"); - case operatorNotBetween : return _T("notBetween"); - case operatorEqual : return _T("equal"); - case operatorNotEqual : return _T("notEqual"); - case operatorLessThan : return _T("lessThan"); - case operatorLessThanOrEqual : return _T("lessThanOrEqual"); - case operatorGreaterThan: return _T("greaterThan"); - case operatorGreaterThanOrEqual:return _T("greaterThanOrEqual"); - default : return _T("between"); + case operatorBetween : return L"between"; + case operatorNotBetween : return L"notBetween"; + case operatorEqual : return L"equal"; + case operatorNotEqual : return L"notEqual"; + case operatorLessThan : return L"lessThan"; + case operatorLessThanOrEqual : return L"lessThanOrEqual"; + case operatorGreaterThan: return L"greaterThan"; + case operatorGreaterThanOrEqual:return L"greaterThanOrEqual"; + default : return L"between"; } } @@ -4541,17 +4600,17 @@ namespace SimpleTypes virtual EDataValidationImeMode FromString(std::wstring &sValue) { - if ( _T("noControl") == sValue ) this->m_eValue = imeModeNoControl; - else if ( _T("off") == sValue ) this->m_eValue = imeModeOff; - else if ( _T("on") == sValue ) this->m_eValue = imeModeOn; - else if ( _T("disabled") == sValue ) this->m_eValue = imeModeDisabled; - else if ( _T("hiragana") == sValue ) this->m_eValue = imeModeHiragana; - else if ( _T("fullKatakana")== sValue ) this->m_eValue = imeModeFullKatakana; - else if ( _T("halfKatakana")== sValue ) this->m_eValue = imeModeHalfKatakana; - else if ( _T("fullAlpha") == sValue ) this->m_eValue = imeModeFullAlpha; - else if ( _T("halfAlpha") == sValue ) this->m_eValue = imeModeHalfAlpha; - else if ( _T("fullHangul") == sValue ) this->m_eValue = imeModeFullHangul; - else if ( _T("halfHangul") == sValue ) this->m_eValue = imeModeHalfHangul; + if ( L"noControl" == sValue ) this->m_eValue = imeModeNoControl; + else if ( L"off" == sValue ) this->m_eValue = imeModeOff; + else if ( L"on" == sValue ) this->m_eValue = imeModeOn; + else if ( L"disabled" == sValue ) this->m_eValue = imeModeDisabled; + else if ( L"hiragana" == sValue ) this->m_eValue = imeModeHiragana; + else if ( L"fullKatakana" == sValue ) this->m_eValue = imeModeFullKatakana; + else if ( L"halfKatakana" == sValue ) this->m_eValue = imeModeHalfKatakana; + else if ( L"fullAlpha" == sValue ) this->m_eValue = imeModeFullAlpha; + else if ( L"halfAlpha" == sValue ) this->m_eValue = imeModeHalfAlpha; + else if ( L"fullHangul" == sValue ) this->m_eValue = imeModeFullHangul; + else if ( L"halfHangul" == sValue ) this->m_eValue = imeModeHalfHangul; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4560,18 +4619,18 @@ namespace SimpleTypes { switch(this->m_eValue) { - case imeModeNoControl : return _T("noControl"); - case imeModeOff : return _T("off"); - case imeModeOn : return _T("on"); - case imeModeDisabled : return _T("disabled"); - case imeModeHiragana : return _T("hiragana"); - case imeModeFullKatakana : return _T("fullKatakana"); - case imeModeHalfKatakana: return _T("halfKatakana"); - case imeModeFullAlpha: return _T("fullAlpha"); - case imeModeHalfAlpha: return _T("halfAlpha"); - case imeModeFullHangul: return _T("fullHangul"); - case imeModeHalfHangul: return _T("halfHangul"); - default : return _T("noControl"); + case imeModeNoControl : return L"noControl"; + case imeModeOff : return L"off"; + case imeModeOn : return L"on"; + case imeModeDisabled : return L"disabled"; + case imeModeHiragana : return L"hiragana"; + case imeModeFullKatakana : return L"fullKatakana"; + case imeModeHalfKatakana: return L"halfKatakana"; + case imeModeFullAlpha: return L"fullAlpha"; + case imeModeHalfAlpha: return L"halfAlpha"; + case imeModeFullHangul: return L"fullHangul"; + case imeModeHalfHangul: return L"halfHangul"; + default : return L"noControl"; } } @@ -4601,17 +4660,17 @@ namespace SimpleTypes virtual EObjectType FromString(std::wstring &sValue) { - if ( _T("Button") == sValue ) this->m_eValue = objectButton; - else if ( _T("CheckBox")== sValue ) this->m_eValue = objectCheckBox; - else if ( _T("Drop") == sValue ) this->m_eValue = objectDrop; - else if ( _T("GBox") == sValue ) this->m_eValue = objectGBox; - else if ( _T("Label") == sValue ) this->m_eValue = objectLabel; - else if ( _T("List") == sValue ) this->m_eValue = objectList; - else if ( _T("Radio") == sValue ) this->m_eValue = objectRadio; - else if ( _T("Scroll") == sValue ) this->m_eValue = objectScroll; - else if ( _T("Spin") == sValue ) this->m_eValue = objectSpin; - else if ( _T("EditBox") == sValue ) this->m_eValue = objectEditBox; - else if ( _T("Dialog") == sValue ) this->m_eValue = objectDialog; + if ( L"Button" == sValue ) this->m_eValue = objectButton; + else if ( L"CheckBox" == sValue ) this->m_eValue = objectCheckBox; + else if ( L"Drop" == sValue ) this->m_eValue = objectDrop; + else if ( L"GBox" == sValue ) this->m_eValue = objectGBox; + else if ( L"Label" == sValue ) this->m_eValue = objectLabel; + else if ( L"List" == sValue ) this->m_eValue = objectList; + else if ( L"Radio" == sValue ) this->m_eValue = objectRadio; + else if ( L"Scroll" == sValue ) this->m_eValue = objectScroll; + else if ( L"Spin" == sValue ) this->m_eValue = objectSpin; + else if ( L"EditBox" == sValue ) this->m_eValue = objectEditBox; + else if ( L"Dialog" == sValue ) this->m_eValue = objectDialog; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4620,18 +4679,18 @@ namespace SimpleTypes { switch(this->m_eValue) { - case objectButton : return _T("Button"); - case objectCheckBox : return _T("CheckBox"); - case objectDrop : return _T("Drop"); - case objectGBox : return _T("GBox"); - case objectLabel : return _T("Label"); - case objectList : return _T("List"); - case objectRadio: return _T("Radio"); - case objectScroll: return _T("Scroll"); - case objectSpin: return _T("Spin"); - case objectEditBox: return _T("EditBox"); - case objectDialog: return _T("Dialog"); - default : return _T("Button"); + case objectButton : return L"Button"; + case objectCheckBox : return L"CheckBox"; + case objectDrop : return L"Drop"; + case objectGBox : return L"GBox"; + case objectLabel : return L"Label"; + case objectList : return L"List"; + case objectRadio: return L"Radio"; + case objectScroll: return L"Scroll"; + case objectSpin: return L"Spin"; + case objectEditBox: return L"EditBox"; + case objectDialog: return L"Dialog"; + default : return L"Button"; } } SimpleType_FromString (EObjectType) @@ -4652,11 +4711,11 @@ namespace SimpleTypes virtual EChecked FromString(std::wstring &sValue) { - if ( _T("Mixed") == sValue ) this->m_eValue = valMixed; - else if ( _T("Checked") == sValue ) this->m_eValue = valChecked; - else if ( _T("Unchecked") == sValue ) this->m_eValue = valUnchecked; - else if ( _T("1") == sValue ) this->m_eValue = valChecked; - else if ( _T("0") == sValue ) this->m_eValue = valUnchecked; + if ( L"Mixed" == sValue ) this->m_eValue = valMixed; + else if ( L"Checked" == sValue ) this->m_eValue = valChecked; + else if ( L"Unchecked" == sValue ) this->m_eValue = valUnchecked; + else if ( L"1" == sValue ) this->m_eValue = valChecked; + else if ( L"0" == sValue ) this->m_eValue = valUnchecked; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4665,10 +4724,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case valMixed : return _T("Mixed"); - case valChecked : return _T("Checked"); + case valMixed : return L"Mixed"; + case valChecked : return L"Checked"; case valUnchecked: - default : return _T("Unchecked"); + default : return L"Unchecked"; } } @@ -4690,9 +4749,9 @@ namespace SimpleTypes virtual EDropStyle FromString(std::wstring &sValue) { - if ( _T("combo") == sValue ) this->m_eValue = valCombo; - else if ( _T("comboedit") == sValue ) this->m_eValue = valComboedit; - else if ( _T("simple") == sValue ) this->m_eValue = valSimple; + if ( L"combo" == sValue ) this->m_eValue = valCombo; + else if ( L"comboedit" == sValue ) this->m_eValue = valComboedit; + else if ( L"simple" == sValue ) this->m_eValue = valSimple; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4701,10 +4760,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case valCombo : return _T("combo"); - case valComboedit : return _T("comboedit"); + case valCombo : return L"combo"; + case valComboedit : return L"comboedit"; case valSimple: - default : return _T("simple"); + default : return L"simple"; } } @@ -4726,9 +4785,9 @@ namespace SimpleTypes virtual ESelType FromString(std::wstring &sValue) { - if ( _T("extended")== sValue ) this->m_eValue = valExtended; - else if ( _T("multi") == sValue ) this->m_eValue = valMulti; - else if ( _T("single") == sValue ) this->m_eValue = valSingle; + if ( L"extended" == sValue ) this->m_eValue = valExtended; + else if ( L"multi" == sValue ) this->m_eValue = valMulti; + else if ( L"single" == sValue ) this->m_eValue = valSingle; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4737,10 +4796,10 @@ namespace SimpleTypes { switch(this->m_eValue) { - case valExtended: return _T("extended"); - case valMulti : return _T("multi"); + case valExtended: return L"extended"; + case valMulti : return L"multi"; case valSingle: - default : return _T("single"); + default : return L"single"; } } @@ -4764,11 +4823,11 @@ namespace SimpleTypes virtual EEditValidation FromString(std::wstring &sValue) { - if ( _T("text") == sValue ) this->m_eValue = editText; - else if ( _T("integer") == sValue ) this->m_eValue = editInteger; - else if ( _T("number") == sValue ) this->m_eValue = editNumber; - else if ( _T("reference") == sValue ) this->m_eValue = editReference; - else if ( _T("formula") == sValue ) this->m_eValue = editFormula; + if ( L"text" == sValue ) this->m_eValue = editText; + else if ( L"integer" == sValue ) this->m_eValue = editInteger; + else if ( L"number" == sValue ) this->m_eValue = editNumber; + else if ( L"reference" == sValue ) this->m_eValue = editReference; + else if ( L"formula" == sValue ) this->m_eValue = editFormula; else this->m_eValue = eDefValue; return this->m_eValue; } @@ -4777,12 +4836,12 @@ namespace SimpleTypes { switch(this->m_eValue) { - case editInteger: return _T("integer"); - case editNumber : return _T("number"); - case editReference : return _T("reference"); - case editFormula : return _T("formula"); + case editInteger: return L"integer"; + case editNumber : return L"number"; + case editReference : return L"reference"; + case editFormula : return L"formula"; case editText: - default : return _T("text"); + default : return L"text"; } } @@ -5013,4 +5072,4 @@ namespace SimpleTypes }; }// Spreadsheet -} // SimpleTypes +} // SimpleTypes \ No newline at end of file diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.cpp b/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.cpp index 95db6cc699..90da976c3d 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.cpp @@ -567,7 +567,7 @@ void CConditionalFormattingRule::toXML2(NSStringUtils::CStringBuilder& writer, b if (m_oStopIfTrue.IsInit() && true == m_oStopIfTrue->ToBool()) writer.WriteString(L" stopIfTrue=\"1\""); WritingStringNullableAttrEncodeXmlString(L"text", m_oText, m_oText.get()); - WritingStringNullableAttrString(L"timePeriod", m_oTimePeriod, m_oTimePeriod.get()); + WritingStringNullableAttrString(L"timePeriod", m_oTimePeriod, m_oTimePeriod->ToString()); if (bExtendedWrite) { diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h index c017581b06..55b26e0c2f 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h @@ -355,8 +355,8 @@ namespace OOX nullable> m_oStopIfTrue; nullable m_oId; nullable m_oText; - nullable m_oTimePeriod; // ToDo переделать на тип ST_TimePeriod (18.18.82) - nullable> m_oType; + nullable> m_oTimePeriod; + nullable> m_oType; nullable m_oExtLst; nullable m_oExtId; diff --git a/XlsxSerializerCom/Common/BinReaderWriterDefines.h b/XlsxSerializerCom/Common/BinReaderWriterDefines.h index 76d4ce7b28..6a94afaebe 100755 --- a/XlsxSerializerCom/Common/BinReaderWriterDefines.h +++ b/XlsxSerializerCom/Common/BinReaderWriterDefines.h @@ -1062,8 +1062,9 @@ namespace BinXlsxRW StdDev = 8, StopIfTrue = 9, Text = 10, - TimePeriod = 11, + strTimePeriod = 11, Type = 12, + TimePeriod = 13, ColorScale = 14, DataBar = 15, diff --git a/XlsxSerializerCom/Reader/BinaryWriter.cpp b/XlsxSerializerCom/Reader/BinaryWriter.cpp index dc0fe90581..618287c2ef 100644 --- a/XlsxSerializerCom/Reader/BinaryWriter.cpp +++ b/XlsxSerializerCom/Reader/BinaryWriter.cpp @@ -6312,8 +6312,11 @@ void BinaryWorksheetTableWriter::WriteConditionalFormattingRule(const OOX::Sprea } if (oConditionalFormattingRule.m_oTimePeriod.IsInit()) { - m_oBcw.m_oStream.WriteBYTE(c_oSer_ConditionalFormattingRule::TimePeriod); - m_oBcw.m_oStream.WriteStringW(oConditionalFormattingRule.m_oTimePeriod.get2()); + m_oBcw.m_oStream.WriteBYTE(c_oSer_ConditionalFormattingRule::strTimePeriod); + m_oBcw.m_oStream.WriteStringW(oConditionalFormattingRule.m_oTimePeriod->ToString()); + + //m_oBcw.m_oStream.WriteBYTE(c_oSer_ConditionalFormattingRule::TimePeriod); + //m_oBcw.m_oStream.WriteBYTE(oConditionalFormattingRule.m_oTimePeriod->GetValue()); } if (oConditionalFormattingRule.m_oType.IsInit()) { diff --git a/XlsxSerializerCom/Writer/BinaryReader.cpp b/XlsxSerializerCom/Writer/BinaryReader.cpp index 41dba69387..4640a0552a 100644 --- a/XlsxSerializerCom/Writer/BinaryReader.cpp +++ b/XlsxSerializerCom/Writer/BinaryReader.cpp @@ -6321,10 +6321,14 @@ int BinaryWorksheetsTableReader::ReadConditionalFormattingRule(BYTE type, long l pConditionalFormattingRule->m_oText.Init(); pConditionalFormattingRule->m_oText->append(m_oBufferedStream.GetString4(length)); } - else if(c_oSer_ConditionalFormattingRule::TimePeriod == type) + else if(c_oSer_ConditionalFormattingRule::strTimePeriod == type) + { + pConditionalFormattingRule->m_oTimePeriod = m_oBufferedStream.GetString4(length); + } + else if (c_oSer_ConditionalFormattingRule::TimePeriod == type) { pConditionalFormattingRule->m_oTimePeriod.Init(); - pConditionalFormattingRule->m_oTimePeriod->append(m_oBufferedStream.GetString4(length)); + pConditionalFormattingRule->m_oTimePeriod->SetValue((SimpleTypes::Spreadsheet::ETimePeriod)m_oBufferedStream.GetUChar()); } else if(c_oSer_ConditionalFormattingRule::Type == type) { From 4570ac9d1a18f9e8508f3e3cfe8fca47c6dbd301 Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Wed, 25 Aug 2021 07:54:52 +0300 Subject: [PATCH 02/12] fix bug #52159 --- Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h b/Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h index 493a736529..1974d18abe 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h @@ -1017,6 +1017,10 @@ namespace OOX else if ( _T("w:tblStyleColBandSize") == sName ) m_oTblStyleColBandSize = oReader; else if ( _T("w:tblStyleRowBandSize") == sName ) m_oTblStyleRowBandSize = oReader; else if ( _T("w:tblW") == sName ) m_oTblW = oReader; + else if ( _T("w:tblPr") == sName) + {//387.docx + fromXML(oReader); + } } } virtual std::wstring toXML() const From 158546d3fa5a21b54b251b84202cdb4c0483662f Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Wed, 25 Aug 2021 15:57:32 +0300 Subject: [PATCH 03/12] fix bug #51937 --- ASCOfficeOdfFile/linux/OdfFileReaderLib.pro | 6 +- .../linux/odffilereaderlib_odf_datatypes.cpp | 1 + .../src/docx/xlsx_conditionalFormatting.cpp | 26 +++++++- .../source/Oox2OdfConverter/XlsxConverter.cpp | 64 ++++++++++++++++--- 4 files changed, 86 insertions(+), 11 deletions(-) diff --git a/ASCOfficeOdfFile/linux/OdfFileReaderLib.pro b/ASCOfficeOdfFile/linux/OdfFileReaderLib.pro index 0c4561a551..4d7b71bbe0 100644 --- a/ASCOfficeOdfFile/linux/OdfFileReaderLib.pro +++ b/ASCOfficeOdfFile/linux/OdfFileReaderLib.pro @@ -221,7 +221,8 @@ SOURCES += \ ../src/odf/datatypes/styleprint.cpp \ ../src/odf/datatypes/charttimeunit.cpp \ ../src/odf/datatypes/drawangle.cpp \ - ../src/odf/datatypes/messagetype.cpp \ + ../src/odf/datatypes/timeperiod.cpp \ + ../src/odf/datatypes/messagetype.cpp \ ../src/docx/xlsx_conditionalFormatting.cpp \ ../src/docx/xlsx_dxfs.cpp \ ../src/docx/docx_content_type.cpp \ @@ -485,7 +486,8 @@ HEADERS += \ ../src/odf/datatypes/styleprint.h \ ../src/odf/datatypes/drawangle.h \ ../src/odf/datatypes/charttimeunit.h \ - ../src/odf/datatypes/messagetype.h \ + ../src/odf/datatypes/timeperiod.h \ + ../src/odf/datatypes/messagetype.h \ ../src/docx/docx_content_type.h \ ../src/docx/docx_conversion_context.h \ ../src/docx/docx_conversion_state.h \ diff --git a/ASCOfficeOdfFile/linux/odffilereaderlib_odf_datatypes.cpp b/ASCOfficeOdfFile/linux/odffilereaderlib_odf_datatypes.cpp index e6dc1e45f4..1974590ed2 100644 --- a/ASCOfficeOdfFile/linux/odffilereaderlib_odf_datatypes.cpp +++ b/ASCOfficeOdfFile/linux/odffilereaderlib_odf_datatypes.cpp @@ -135,3 +135,4 @@ #include "../src/odf/datatypes/charttimeunit.cpp" #include "../src/odf/datatypes/drawangle.cpp" #include "../src/odf/datatypes/messagetype.cpp"" +#include "../src/odf/datatypes/timeperiod.cpp"" diff --git a/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp b/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp index 85a830e5c0..93c3c33efd 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp @@ -327,11 +327,35 @@ void xlsx_conditionalFormatting_context::set_formula(std::wstring f) { impl_->conditionalFormattings_.back().rules.back().formula_type = L"duplicateValues"; } + else if (0 <= (pos = f.find(L"begins-with"))) + { + impl_->conditionalFormattings_.back().rules.back().formula_type = L"beginsWith"; + std::wstring text = f.substr(pos + 12, f.length() - pos - 13); + + if (0 == text.find(L"\"") && text.length() - 1 == text.rfind(L"\"")) + { + text = text.substr(1, text.length() - 2); + } + + impl_->conditionalFormattings_.back().rules.back().text = text; + } + else if (0 <= (pos = f.find(L"ends-with"))) + { + impl_->conditionalFormattings_.back().rules.back().formula_type = L"endsWith"; + std::wstring text = f.substr(pos + 10, f.length() - pos - 11); + + if (0 == text.find(L"\"") && text.length() - 1 == text.rfind(L"\"")) + { + text = text.substr(1, text.length() - 2); + } + + impl_->conditionalFormattings_.back().rules.back().text = text; + } else if (0 <= (pos = f.find(L"contains-text"))) { impl_->conditionalFormattings_.back().rules.back().formula_type = L"containsText"; - std::wstring text = f.substr(14, f.length() - 15); + std::wstring text = f.substr(pos + 14, f.length() - pos - 15); if (std::wstring::npos != text.find(L"IF(") || std::wstring::npos != text.find(L"AND(") || diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp index 128727d8bf..6b7fd3baa1 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp @@ -418,23 +418,71 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet) //условное форматирование if (!oox_sheet->m_arrConditionalFormatting.empty() || oox_sheet->m_oExtLst.IsInit()) { - ods_context->start_conditional_formats(); - - for (size_t fmt =0; fmt < oox_sheet->m_arrConditionalFormatting.size(); fmt++) + std::multimap mapSorted; + + std::vector arUnsorted; + + // sort by prioritet + for (size_t fmt = 0; fmt < oox_sheet->m_arrConditionalFormatting.size(); fmt++) { - convert(oox_sheet->m_arrConditionalFormatting[fmt]); + OOX::Spreadsheet::CConditionalFormatting* cond_fmt = oox_sheet->m_arrConditionalFormatting[fmt]; + if (cond_fmt) + { + int priority = -1; + for (size_t r = 0; r < cond_fmt->m_arrItems.size(); ++r) + { + if (cond_fmt->m_arrItems[r]->m_oPriority.IsInit()) + { + priority = cond_fmt->m_arrItems[r]->m_oPriority->GetValue(); + break; + } + } + if (priority >= 0) + mapSorted.insert(std::make_pair(priority, cond_fmt)); + else + arUnsorted.push_back(cond_fmt); + } } - + if (oox_sheet->m_oExtLst.IsInit()) { for (size_t ext = 0; ext < oox_sheet->m_oExtLst->m_arrExt.size(); ext++) { - for (size_t i = 0; (oox_sheet->m_oExtLst->m_arrExt[ext]) && (i < oox_sheet->m_oExtLst->m_arrExt[ext]->m_arrConditionalFormatting.size()); i++) + for (size_t fmt = 0; (oox_sheet->m_oExtLst->m_arrExt[ext]) && (fmt < oox_sheet->m_oExtLst->m_arrExt[ext]->m_arrConditionalFormatting.size()); fmt++) { - convert(oox_sheet->m_oExtLst->m_arrExt[ext]->m_arrConditionalFormatting[i]); - } + OOX::Spreadsheet::CConditionalFormatting* cond_fmt = oox_sheet->m_oExtLst->m_arrExt[ext]->m_arrConditionalFormatting[fmt]; + if (cond_fmt) + { + int priority = -1; + for (size_t r = 0; r < cond_fmt->m_arrItems.size(); ++r) + { + if (cond_fmt->m_arrItems[r]->m_oPriority.IsInit()) + { + priority = cond_fmt->m_arrItems[r]->m_oPriority->GetValue(); + break; + } + } + if (priority >= 0) + mapSorted.insert(std::make_pair(priority, cond_fmt)); + else + arUnsorted.push_back(cond_fmt); + } + } } } +//-------------------------------------------------------------------------- + ods_context->start_conditional_formats(); + + for (size_t fmt =0; fmt < arUnsorted.size(); fmt++) + { + convert(arUnsorted[fmt]); + } + + for (std::multimap::iterator it = mapSorted.begin(); + it != mapSorted.end(); ++it) + { + convert(it->second); + } ods_context->end_conditional_formats(); } OoxConverter::convert(oox_sheet->m_oExtLst.GetPointer()); From 77c3a821a0ff203a02c82758e0248317ef4c2bef Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Thu, 26 Aug 2021 17:05:02 +0300 Subject: [PATCH 04/12] fix bug #52191 --- .../PPTFormatLib/PPTXWriter/ShapeWriter.cpp | 15 +++++++++++---- .../PPTFormatLib/PPTXWriter/TableWriter.cpp | 14 +++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp index 27a6c703a0..a52152b049 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp @@ -709,8 +709,10 @@ void PPT_FORMAT::CShapeWriter::WriteImageInfo() { m_oWriter.WriteString(std::wstring(L"m_lPlaceholderType > 0 && pImageElement->m_lPlaceholderType != PT_Body_Empty) - m_oWriter.WriteString(std::wstring(L" type=\"") + GetPhType(pImageElement->m_lPlaceholderType) + L"\""); + if (pImageElement->m_lPlaceholderType > 0 && pImageElement->m_lPlaceholderType != PT_Body_Empty) + m_oWriter.WriteString(std::wstring(L" type=\"") + GetPhType(pImageElement->m_lPlaceholderType) + L"\""); + else if (pImageElement->m_lPlaceholderID == -1) + m_oWriter.WriteString(std::wstring(L" type=\"obj\"")); if (-1 != pImageElement->m_lPlaceholderID) { @@ -932,6 +934,8 @@ void PPT_FORMAT::CShapeWriter::WriteShapeInfo() if (pShapeElement->m_lPlaceholderType > 0 && pShapeElement->m_lPlaceholderType != PT_Body_Empty) m_oWriter.WriteString(std::wstring(L" type=\"") + GetPhType(pShapeElement->m_lPlaceholderType) + _T("\"")); + else if (pShapeElement->m_lPlaceholderID == -1) + m_oWriter.WriteString(std::wstring(L" type=\"obj\"")); if ( pShapeElement->m_lPlaceholderID != -1) { @@ -1411,12 +1415,15 @@ void PPT_FORMAT::CShapeWriter::WriteTextInfo() { m_oWriter.WriteString(L"bulletAutoNum->type.get()); - if (pPF->bulletAutoNum->startAt.get2() != 1) + m_oWriter.WriteString(L"\""); + + if ((pPF->bulletAutoNum->startAt.IsInit()) && (pPF->bulletAutoNum->startAt.get2() != 1)) { m_oWriter.WriteString(L" startAt=\""); m_oWriter.WriteString(std::to_wstring(pPF->bulletAutoNum->startAt.get2())); + m_oWriter.WriteString(L"\""); } - m_oWriter.WriteString(L"\"/>"); + m_oWriter.WriteString(L"/>"); } bool set = true; diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/TableWriter.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/TableWriter.cpp index c9b9471a34..b983e98a14 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/TableWriter.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/TableWriter.cpp @@ -389,17 +389,13 @@ void TableWriter::FillRow(PPTX::Logic::TableRow &oRow, ProtoTableRow& arrCells) std::wstring TableWriter::getXmlForGraphicFrame(int ID, int idx) const { + //в таблице могут быть линки и ссылки на другние объекты (картинки???) + // yliko_provolis.ppt (+ тут есть смарт арты) + auto& rXml = m_pTableElement->m_xmlRawData; - auto startIter = rXml.find(L""); - auto endIter = rXml.find(L""); - std::wstring xml = L""; - xml += std::wstring(rXml.begin() + startIter, rXml.begin() + endIter); - xml += L""; - - PPTX::Logic::GraphicFrame graphic_frame; - - graphic_frame.fromXMLString(xml); + PPTX::Logic::GraphicFrame graphic_frame; + graphic_frame.fromXMLString(rXml); if (graphic_frame.nvGraphicFramePr.IsInit()) { From d0b49a7741b758ea8f4c41c9c43b7d0e9a6ba9ce Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Fri, 27 Aug 2021 12:37:46 +0300 Subject: [PATCH 05/12] fix bug #50003 --- ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp | 2 +- ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp index 2520aa0c7d..c00dfe82f7 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp @@ -810,7 +810,7 @@ std::wstring RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter) RtfStylePtr oStyle; if( true == poRtfDocument->m_oStyleTable.GetStyle( m_nCharStyle, oStyle ) ) { - sResult += L"m_sName; sResult += L"\"/>"; } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h index 5cb59bc665..09d0b60521 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h @@ -2666,6 +2666,7 @@ public: { SetDefault(); + m_nSpaceBefore = 0; // 137.rtf //4.1 Наряд_R7_M133.rtf m_nSpaceAfter = 0; m_nSpaceBetween = 240; From 8c0f2a6b2c99e849ce5fea7d1ef3b8e6126a58c1 Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Mon, 30 Aug 2021 15:02:26 +0300 Subject: [PATCH 06/12] fix bug #52240 --- .../source/OdfFormat/odf_chart_context.cpp | 6 +++++- .../source/OdfFormat/ods_table_state.h | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp b/ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp index d18247276a..6790b50415 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_chart_context.cpp @@ -1881,7 +1881,7 @@ int odf_chart_context::Impl::create_local_table_rows(int curr_row, ods_table_sta create_element(L"table", L"table-row", row_elm, odf_context_); table_state->add_row(row_elm, 1, style_null); curr_row++; - curr_cell=0; + curr_cell = 0; } if (curr_cell + 1 < cells[i].col) @@ -1955,6 +1955,7 @@ void odf_chart_context::Impl::create_local_table() if (std::wstring::npos != r) refs[1] = refs[1].substr(r + 1, refs[1].size() - r); utils::parsing_ref( refs[1], col2, row2); + if (col2 < min_col) min_col = col2; if (row2 < min_row) min_row = row2; @@ -1963,6 +1964,9 @@ void odf_chart_context::Impl::create_local_table() { col2 = col1; row2 = row1; } + + if (row2 < 1 || row1 < 1 || col1 < 1 || col2 < 1) + continue; if (cash_[i].categories || cash_[i].label) { diff --git a/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h b/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h index 8d9d198ad9..4b76bddc75 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h @@ -136,24 +136,30 @@ namespace utils std::reverse(col.begin(), col.end()); std::reverse(row.begin(), row.end()); } - static void parsing_ref (std::wstring ref, int & col,int & row) + static void parsing_ref (std::wstring ref, int & col, int & row) { - int pos = (int)ref.rfind(L"!");//oox table name - if (pos >= 0) + if (std::wstring::npos != ref.find(L" ")) + return; + + size_t pos = ref.rfind(L"!");//oox table name + if (pos != std::wstring::npos) ref = ref.substr(pos + 1); else { - pos = (int)ref.rfind(L".");//odf table name - if (pos >= 0) + pos = ref.rfind(L".");//odf table name + if (pos != std::wstring::npos) ref = ref.substr(pos + 1); } std::wstring strCol, strRow; - splitCellAddress(ref,strCol,strRow); + splitCellAddress(ref, strCol, strRow); if (strCol.empty() || strRow.empty()) return; + if (strCol.size() > 3 || strRow.size() > 7)// 1048576 & 16384(xfd) + return; + col = getColAddressInv(strCol) + 1; row = getRowAdderssInv(strRow) + 1; From 50a765eb4cf0409ff4ce138d4495b0fd67660e3e Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Mon, 30 Aug 2021 15:08:24 +0300 Subject: [PATCH 07/12] fix bug #52259 --- ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h | 22 ++++------ ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp | 2 +- ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp | 45 ++++++++------------ 3 files changed, 28 insertions(+), 41 deletions(-) diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h b/ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h index 1c72b3ee72..e89b121115 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h @@ -135,29 +135,25 @@ namespace PPTX { case 0: { - nvCxnSpPr.fromPPTY(pReader); - break; - } + nvCxnSpPr.fromPPTY(pReader); + }break; case 1: { - spPr.fromPPTY(pReader); - break; - } + spPr.fromPPTY(pReader); + }break; case 2: { style = new ShapeStyle(L"p"); - style->fromPPTY(pReader); - break; - } + style->fromPPTY(pReader); + }break; case SPTREE_TYPE_MACRO: { pReader->Skip(5); // type + size macro = pReader->GetString2(); }break; - default: - { - break; - } + default: + { + }break; } } diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp index 5ff3d413d8..a9e7316c96 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp @@ -938,7 +938,7 @@ namespace PPTX mediaFile->set_filename(strMediaFileMask, isExternal); } pReader->Seek(_end_rec1); - } + }break; case SPTREE_TYPE_MACRO: { pReader->Skip(5); // type + size diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp index 5ca5e08f70..b9d0029e12 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp @@ -336,26 +336,22 @@ namespace PPTX { case 0: { - nvSpPr.fromPPTY(pReader); - break; - } + nvSpPr.fromPPTY(pReader); + }break; case 1: { - spPr.fromPPTY(pReader); - break; - } + spPr.fromPPTY(pReader); + }break; case 2: { style = new ShapeStyle(L"p"); - style->fromPPTY(pReader); - break; - } + style->fromPPTY(pReader); + }break; case 3: { txBody = new TxBody(); - txBody->fromPPTY(pReader); - break; - } + txBody->fromPPTY(pReader); + }break; case 4: { if (NULL != pReader->m_pMainDocument) @@ -380,27 +376,23 @@ namespace PPTX else { pReader->SkipRecord(); - } - break; - } + } + }break; case 5: { oTextBoxBodyPr = new PPTX::Logic::BodyPr(); - oTextBoxBodyPr->fromPPTY(pReader); - break; - } + oTextBoxBodyPr->fromPPTY(pReader); + }break; case 6: { txXfrm = new PPTX::Logic::Xfrm(); - txXfrm->fromPPTY(pReader); - break; - } + txXfrm->fromPPTY(pReader); + }break; case 7: { signatureLine = new OOX::VmlOffice::CSignatureLine(); - signatureLine->fromPPTY(pReader); - break; - } + signatureLine->fromPPTY(pReader); + }break; case SPTREE_TYPE_MACRO: { pReader->Skip(5); // type + size @@ -408,9 +400,8 @@ namespace PPTX }break; default: { - pReader->SkipRecord(); - break; - } + pReader->SkipRecord(); + }break; } } From ac98378b4b25643a623327b8bd452af568e8847b Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Tue, 31 Aug 2021 19:39:52 +0300 Subject: [PATCH 08/12] fix bad temp directory --- ASCOfficeDocxFile2/BinReader/Readers.cpp | 43 +- ASCOfficeDocxFile2/BinWriter/BinWriters.cpp | 119 +++--- ASCOfficeOdfFile/src/odf/draw_frame.cpp | 2 + .../source/Oox2OdfConverter/Converter.cpp | 17 +- .../PPTFormatLib/Reader/PPTFileReader.cpp | 2 +- .../ASCOfficePPTXFileRealization.cpp | 11 +- .../PPTXFormat/Logic/GraphicFrame.cpp | 2 +- ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp | 381 +++++++++--------- .../PPTXFormat/Logic/SmartArt.cpp | 82 ++-- .../source/ConvertationManager.cpp | 19 +- DesktopEditor/common/Directory.cpp | 4 + X2tConverter/src/ASCConverters.cpp | 60 ++- .../Reader/ChartFromToBinary.cpp | 5 +- 13 files changed, 402 insertions(+), 345 deletions(-) diff --git a/ASCOfficeDocxFile2/BinReader/Readers.cpp b/ASCOfficeDocxFile2/BinReader/Readers.cpp index 4a60c8aac5..55ab4a81dc 100644 --- a/ASCOfficeDocxFile2/BinReader/Readers.cpp +++ b/ASCOfficeDocxFile2/BinReader/Readers.cpp @@ -8552,37 +8552,38 @@ int Binary_DocumentTableReader::ReadEmbedded(BYTE type, long length, void* poRes NSDirectory::CreateDirectory(strDstEmbedded); std::wstring strDstEmbeddedTemp = strDstEmbedded + FILE_SEPARATOR_STR + L"Temp"; - NSDirectory::CreateDirectory(strDstEmbeddedTemp); + if (true == NSDirectory::CreateDirectory(strDstEmbeddedTemp)) + { + std::wstring strDstEmbeddedTempXl = strDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl"; + NSDirectory::CreateDirectory(strDstEmbeddedTempXl); - std::wstring strDstEmbeddedTempXl = strDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl"; - NSDirectory::CreateDirectory(strDstEmbeddedTempXl); + std::wstring strDstEmbeddedTempThemePath = strDstEmbeddedTempXl + FILE_SEPARATOR_STR + L"theme"; + std::wstring strDstEmbeddedTempDrawingPath = strDstEmbeddedTempXl + FILE_SEPARATOR_STR + L"drawings"; + std::wstring strDstEmbeddedTempEmbeddingsPath = strDstEmbeddedTempXl + FILE_SEPARATOR_STR + L"embeddings"; - std::wstring strDstEmbeddedTempThemePath = strDstEmbeddedTempXl + FILE_SEPARATOR_STR + L"theme"; - std::wstring strDstEmbeddedTempDrawingPath = strDstEmbeddedTempXl + FILE_SEPARATOR_STR + L"drawings"; - std::wstring strDstEmbeddedTempEmbeddingsPath = strDstEmbeddedTempXl + FILE_SEPARATOR_STR + L"embeddings"; + int id = m_oFileWriter.m_oChartWriter.nEmbeddedCount++; - int id = m_oFileWriter.m_oChartWriter.nEmbeddedCount++; + std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(id + 1) + L".xlsx"; + BinXlsxRW::SaveParams oSaveParams(strDstEmbeddedTempDrawingPath, strDstEmbeddedTempEmbeddingsPath, strDstEmbeddedTempThemePath, m_oFileWriter.m_pDrawingConverter->GetContentTypes());//??? - std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring( id + 1) + L".xlsx"; - BinXlsxRW::SaveParams oSaveParams(strDstEmbeddedTempDrawingPath, strDstEmbeddedTempEmbeddingsPath, strDstEmbeddedTempThemePath, m_oFileWriter.m_pDrawingConverter->GetContentTypes());//??? - - OOX::Spreadsheet::CXlsx oXlsx; + OOX::Spreadsheet::CXlsx oXlsx; - BinXlsxRW::BinaryFileReader embeddedReader; - embeddedReader.ReadMainTable(oXlsx, m_oBufferedStream, L"", strDstEmbeddedTemp, oSaveParams, m_oFileWriter.m_pDrawingConverter); + BinXlsxRW::BinaryFileReader embeddedReader; + embeddedReader.ReadMainTable(oXlsx, m_oBufferedStream, L"", strDstEmbeddedTemp, oSaveParams, m_oFileWriter.m_pDrawingConverter); - oXlsx.PrepareToWrite(); + oXlsx.PrepareToWrite(); - oXlsx.Write(strDstEmbeddedTemp, *oSaveParams.pContentTypes); + oXlsx.Write(strDstEmbeddedTemp, *oSaveParams.pContentTypes); - COfficeUtils oOfficeUtils(NULL); - oOfficeUtils.CompressFileOrDirectory(strDstEmbeddedTemp, strDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, true); + COfficeUtils oOfficeUtils(NULL); + oOfficeUtils.CompressFileOrDirectory(strDstEmbeddedTemp, strDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, true); - std::wstring sEmbWorksheetRelsName = L"embeddings/" + sXlsxFilename; - std::wstring bstrEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType(); - m_oFileWriter.m_pDrawingConverter->WriteRels(bstrEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring(), &pDrawingProperty->nObjectId); + std::wstring sEmbWorksheetRelsName = L"embeddings/" + sXlsxFilename; + std::wstring bstrEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType(); + m_oFileWriter.m_pDrawingConverter->WriteRels(bstrEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring(), &pDrawingProperty->nObjectId); - NSDirectory::DeleteDirectory(strDstEmbeddedTemp); + NSDirectory::DeleteDirectory(strDstEmbeddedTemp); + } } m_oBufferedStream.Seek( pos + length); } diff --git a/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp b/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp index 1b07343730..a982b24d79 100644 --- a/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp +++ b/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp @@ -3416,82 +3416,83 @@ void BinaryDocumentTableWriter::WriteAltChunk(OOX::Media& oAltChunkFile, OOX::CS std::wstring sResultDocxDir = NSDirectory::CreateDirectoryWithUniqueName(oAltChunkFile.filename().GetDirectory()); bool result = false; - + + if (sResultDocxDir.empty() || sTempDir.empty()) return; + COfficeFileFormatChecker OfficeFileFormatChecker; if (OfficeFileFormatChecker.isOfficeFile(file_name_inp)) - { - switch(OfficeFileFormatChecker.nFileType) - { + { + switch (OfficeFileFormatChecker.nFileType) + { #ifndef DONT_USED_EXTRA_LIBRARY - case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: - case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT: - { + case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: + case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT: + { #ifndef _IOS - COfficeDocFile docFile; - docFile.m_sTempFolder = sTempDir; - - bool bMacros = false; - - result = (S_OK == docFile.LoadFromFile( file_name_inp, sResultDocxDir, NULL, bMacros, NULL)); + COfficeDocFile docFile; + docFile.m_sTempFolder = sTempDir; + + bool bMacros = false; + + result = (S_OK == docFile.LoadFromFile(file_name_inp, sResultDocxDir, NULL, bMacros, NULL)); #else - result = S_FALSE; + result = S_FALSE; #endif - }break; - case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF: - { - RtfConvertationManager rtfConvert; - rtfConvert.m_sTempFolder = sTempDir; - - result = (S_OK == rtfConvert.ConvertRtfToOOX(file_name_inp, sResultDocxDir)); - }break; - case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML: + }break; + case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF: + { + RtfConvertationManager rtfConvert; + rtfConvert.m_sTempFolder = sTempDir; + + result = (S_OK == rtfConvert.ConvertRtfToOOX(file_name_inp, sResultDocxDir)); + }break; + case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML: + { + CHtmlFile2 htmlConvert; + CHtmlParams paramsHtml; + + htmlConvert.SetTmpDirectory(sTempDir); + + if (styles) { - CHtmlFile2 htmlConvert; - CHtmlParams paramsHtml; - - htmlConvert.SetTmpDirectory(sTempDir); - - if (styles) + if (styles->m_oDocDefaults.IsInit()) { - if (styles->m_oDocDefaults.IsInit()) + paramsHtml.m_sdocDefaults = styles->m_oDocDefaults->toXML(); + } + std::map::iterator pFind = styles->m_mapStyleDefaults.find(SimpleTypes::styletypeParagraph); + if (pFind != styles->m_mapStyleDefaults.end()) + { + if (styles->m_arrStyle[pFind->second]) { - paramsHtml.m_sdocDefaults = styles->m_oDocDefaults->toXML(); - } - std::map::iterator pFind = styles->m_mapStyleDefaults.find(SimpleTypes::styletypeParagraph); - if (pFind != styles->m_mapStyleDefaults.end()) - { - if (styles->m_arrStyle[pFind->second]) - { - //change styleId + //change styleId - OOX::CStyle updateStyle (*styles->m_arrStyle[pFind->second]); - updateStyle.m_sStyleId = L"normal"; - paramsHtml.m_sNormal = updateStyle.toXML(); - } + OOX::CStyle updateStyle(*styles->m_arrStyle[pFind->second]); + updateStyle.m_sStyleId = L"normal"; + paramsHtml.m_sNormal = updateStyle.toXML(); } } + } - result = (S_OK == htmlConvert.OpenHtml(file_name_inp, sResultDocxDir, ¶msHtml)); - }break; - case AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT: - { - CHtmlFile2 htmlConvert; - htmlConvert.SetTmpDirectory(sTempDir); + result = (S_OK == htmlConvert.OpenHtml(file_name_inp, sResultDocxDir, ¶msHtml)); + }break; + case AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT: + { + CHtmlFile2 htmlConvert; + htmlConvert.SetTmpDirectory(sTempDir); - result = (S_OK == htmlConvert.OpenMht(file_name_inp, sResultDocxDir)); - }break; + result = (S_OK == htmlConvert.OpenMht(file_name_inp, sResultDocxDir)); + }break; #endif - case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX: - case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM: - case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX: - case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM: - { - COfficeUtils oCOfficeUtils(NULL); - result = (S_OK == oCOfficeUtils.ExtractToDirectory(file_name_inp, sResultDocxDir, NULL, 0)); - }break; + case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX: + case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM: + case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX: + case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM: + { + COfficeUtils oCOfficeUtils(NULL); + result = (S_OK == oCOfficeUtils.ExtractToDirectory(file_name_inp, sResultDocxDir, NULL, 0)); + }break; } } - NSDirectory::DeleteDirectory(sTempDir); if (result) diff --git a/ASCOfficeOdfFile/src/odf/draw_frame.cpp b/ASCOfficeOdfFile/src/odf/draw_frame.cpp index f221b87e8d..24378b941c 100644 --- a/ASCOfficeOdfFile/src/odf/draw_frame.cpp +++ b/ASCOfficeOdfFile/src/odf/draw_frame.cpp @@ -460,6 +460,8 @@ std::wstring draw_object::office_convert(odf_document_ptr odfDocument, int type) std::wstring folderPath = odfDocument->get_folder(); std::wstring objectOutPath = NSDirectory::CreateDirectoryWithUniqueName(folderPath); + if (objectOutPath.empty()) return L""; + if (type == 1) { oox::package::docx_document outputDocx; diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp index 572a4541a7..169772d7d0 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp @@ -124,15 +124,18 @@ bool OoxConverter::write(const std::wstring & out_path, const std::wstring & tem { //encrypt files std::wstring temp_folder = NSDirectory::CreateDirectoryWithUniqueName(temp_path); - output_document->write(temp_folder, true); - - encrypt_document(password, temp_folder, out_path); - output_document->write_manifest(out_path); - - NSDirectory::DeleteDirectory(temp_folder); + if (false == temp_folder.empty()) + { + output_document->write(temp_folder, true); + + encrypt_document(password, temp_folder, out_path); + + output_document->write_manifest(out_path); + + NSDirectory::DeleteDirectory(temp_folder); + } } - return true; } std::wstring EncodeBase64(const std::string & value) diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp index b1b2e0e2a0..9e640fb5a7 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileReader.cpp @@ -84,7 +84,7 @@ CPPTFileReader::CPPTFileReader(POLE::Storage *pStorage, std::wstring strTemp): RELEASEOBJECT(pStm); - if (0 == m_strTmpDirectory.length()) + if (m_strTmpDirectory.empty()) { m_strTmpDirectory = NSDirectory::GetTempPath(); } diff --git a/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp b/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp index c52d5cd285..ddeda2ae4b 100644 --- a/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp +++ b/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp @@ -192,11 +192,14 @@ _UINT32 CPPTXFile::OpenFileToPPTY(std::wstring bsInput, std::wstring bsOutput) m_strTempDir = NSDirectory::GetTempPath(); } - NSDirectory::CreateDirectory(m_strTempDir); + if (true == NSDirectory::CreateDirectory(m_strTempDir)) + { + _UINT32 hr = OpenDirectoryToPPTY(bsInput, bsOutput); - _UINT32 hr = OpenDirectoryToPPTY(bsInput, bsOutput); - - return hr; + return hr; + } + else + return S_FALSE; } _UINT32 CPPTXFile::OpenDirectoryToPPTY(std::wstring bsInput, std::wstring bsOutput) { diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp index 6e81b6d41d..e43335af23 100755 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/GraphicFrame.cpp @@ -950,7 +950,7 @@ namespace PPTX std::wstring sUnpackedXlsx = sTempDirectory + FILE_SEPARATOR_STR + (L"xslx_unpacked"); - NSDirectory::CreateDirectory(sUnpackedXlsx); + if (false == NSDirectory::CreateDirectory(sUnpackedXlsx)) return L""; COfficeUtils oCOfficeUtils(NULL); if (S_OK != oCOfficeUtils.ExtractToDirectory(pExternalXslxPackage->filename().GetPath(), sUnpackedXlsx, NULL, 0)) return L""; diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp index a9e7316c96..640b816eca 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp @@ -166,72 +166,74 @@ namespace PPTX { OOX::CPath oox_file = ole_file->filename(); OOX::CPath oox_unpacked = oox_file.GetDirectory(true) + L"Temp"; - NSDirectory::CreateDirectory(oox_unpacked.GetPath()); - - COfficeUtils oOfficeUtils(NULL); - oOfficeUtils.ExtractToDirectory(oox_file.GetPath(), oox_unpacked.GetPath(), NULL, 0); - - COfficeFileFormatChecker office_checker; - office_checker.isOOXFormatFile(oox_file.GetPath()); -//----------------------------------------------------------------------------------------- - DocWrapper::FontProcessor oFontProcessor; - NSBinPptxRW::CDrawingConverter oDrawingConverter; - NSCommon::smart_ptr old_rels = *pWriter->m_pCurrentContainer; - NSCommon::smart_ptr old_theme = *pWriter->m_pTheme; - - NSShapeImageGen::CMediaManager* old_manager = oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager; - oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = pWriter->m_pCommon->m_pMediaManager; - - oDrawingConverter.SetFontPicker(pWriter->m_pCommon->m_pFontPicker); - - int type = 0; - if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX || - office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM ) + if (true == NSDirectory::CreateDirectory(oox_unpacked.GetPath())) { - type = 1; - BinDocxRW::CDocxSerializer* old_serializer = pWriter->m_pMainDocument; - - BinDocxRW::CDocxSerializer oDocxSerializer; - oDrawingConverter.m_pBinaryWriter->m_pMainDocument = &oDocxSerializer; - oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(oDrawingConverter.m_pBinaryWriter, &oFontProcessor, &oDrawingConverter, NULL); - - BinDocxRW::BinaryFileWriter oBinaryFileWriter(*oDocxSerializer.m_pParamsWriter); - oBinaryFileWriter.intoBindoc(oox_unpacked.GetPath()); - - pWriter->m_pMainDocument = old_serializer; - } - else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX || + COfficeUtils oOfficeUtils(NULL); + oOfficeUtils.ExtractToDirectory(oox_file.GetPath(), oox_unpacked.GetPath(), NULL, 0); + + COfficeFileFormatChecker office_checker; + office_checker.isOOXFormatFile(oox_file.GetPath()); + //----------------------------------------------------------------------------------------- + DocWrapper::FontProcessor oFontProcessor; + NSBinPptxRW::CDrawingConverter oDrawingConverter; + + NSCommon::smart_ptr old_rels = *pWriter->m_pCurrentContainer; + NSCommon::smart_ptr old_theme = *pWriter->m_pTheme; + + NSShapeImageGen::CMediaManager* old_manager = oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager; + oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = pWriter->m_pCommon->m_pMediaManager; + + oDrawingConverter.SetFontPicker(pWriter->m_pCommon->m_pFontPicker); + + int type = 0; + if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX || + office_checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM) + { + type = 1; + BinDocxRW::CDocxSerializer* old_serializer = pWriter->m_pMainDocument; + + BinDocxRW::CDocxSerializer oDocxSerializer; + oDrawingConverter.m_pBinaryWriter->m_pMainDocument = &oDocxSerializer; + oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(oDrawingConverter.m_pBinaryWriter, &oFontProcessor, &oDrawingConverter, NULL); + + BinDocxRW::BinaryFileWriter oBinaryFileWriter(*oDocxSerializer.m_pParamsWriter); + oBinaryFileWriter.intoBindoc(oox_unpacked.GetPath()); + + pWriter->m_pMainDocument = old_serializer; + } + else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX || office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM) - { - type = 2; - - BinXlsxRW::BinaryFileWriter xlsxBinaryWriter(oFontProcessor); - OOX::Spreadsheet::CXlsx oXlsxEmbedded(oox_unpacked); - - xlsxBinaryWriter.intoBindoc(&oXlsxEmbedded, *oDrawingConverter.m_pBinaryWriter , NULL, &oDrawingConverter); - } - //else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX) - //{ - //} - else - {//unknown ms package - oDrawingConverter.m_pBinaryWriter->WriteString1(2, ole_file->filename().GetFilename()); - } - *pWriter->m_pCurrentContainer = old_rels; - *pWriter->m_pTheme = old_theme; - oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = old_manager; + { + type = 2; + + BinXlsxRW::BinaryFileWriter xlsxBinaryWriter(oFontProcessor); + OOX::Spreadsheet::CXlsx oXlsxEmbedded(oox_unpacked); + + xlsxBinaryWriter.intoBindoc(&oXlsxEmbedded, *oDrawingConverter.m_pBinaryWriter, NULL, &oDrawingConverter); + } + //else if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX) + //{ + //} + else + {//unknown ms package + oDrawingConverter.m_pBinaryWriter->WriteString1(2, ole_file->filename().GetFilename()); + } + *pWriter->m_pCurrentContainer = old_rels; + *pWriter->m_pTheme = old_theme; + oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = old_manager; //--------------------------------------------------------------------------------------------------------------------- - pWriter->StartRecord(1); + pWriter->StartRecord(1); pWriter->WriteBYTE(type); - pWriter->EndRecord(); + pWriter->EndRecord(); - pWriter->StartRecord(2); + pWriter->StartRecord(2); pWriter->WriteBYTEArray(oDrawingConverter.m_pBinaryWriter->GetBuffer(), oDrawingConverter.m_pBinaryWriter->GetPosition()); - pWriter->EndRecord(); + pWriter->EndRecord(); - NSDirectory::DeleteDirectory(oox_unpacked.GetPath()); + NSDirectory::DeleteDirectory(oox_unpacked.GetPath()); + } } else if ( std::wstring::npos != sProgID.find(L"Equation")) { @@ -312,161 +314,162 @@ namespace PPTX sDstEmbedded = sDstEmbedded.substr(0, nPos); sDstEmbedded += L"embeddings"; - NSDirectory::CreateDirectory(sDstEmbedded); //------------------------------------------------------------------ - std::wstring sDstEmbeddedTemp = sDstEmbedded + FILE_SEPARATOR_STR + L"Temp"; - NSDirectory::CreateDirectory(sDstEmbeddedTemp); - - if (embedded_type == 0) //unknown ms package + if (true == NSDirectory::CreateDirectory(sDstEmbedded)) { - m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX); - - BYTE type = pReader->GetUChar(); - std::wstring strOlePath = pReader->GetString2(true); - m_OleObjectFile->set_filename(strOlePath, false); //temp !!! for ImageManager original file name - } - else if (embedded_type == 4) - { - pReader->Seek(pReader->GetPos() - 4); //roll back to size record - std::wstring sXmlContent; - if (pReader->m_pMainDocument) + std::wstring sDstEmbeddedTemp = sDstEmbedded + FILE_SEPARATOR_STR + L"Temp"; + NSDirectory::CreateDirectory(sDstEmbeddedTemp); + + if (embedded_type == 0) //unknown ms package { - pReader->m_pMainDocument->getXmlContentElem(OOX::et_m_oMathPara, *pReader, sXmlContent); + m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX); + + BYTE type = pReader->GetUChar(); + std::wstring strOlePath = pReader->GetString2(true); + m_OleObjectFile->set_filename(strOlePath, false); //temp !!! for ImageManager original file name } - else + else if (embedded_type == 4) { + pReader->Seek(pReader->GetPos() - 4); //roll back to size record + std::wstring sXmlContent; + if (pReader->m_pMainDocument) + { + pReader->m_pMainDocument->getXmlContentElem(OOX::et_m_oMathPara, *pReader, sXmlContent); + } + else + { + BinDocxRW::CDocxSerializer oDocxSerializer; + NSBinPptxRW::CDrawingConverter oDrawingConverter; + + oDrawingConverter.SetMainDocument(&oDocxSerializer); + + //oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(oDrawingConverter.m_pBinaryWriter, &oFontProcessor, &oDrawingConverter, NULL); + oDocxSerializer.m_pCurFileWriter = new Writers::FileWriter(L"", L"", false, 111, &oDrawingConverter, L""); + + oDocxSerializer.getXmlContentElem(OOX::et_m_oMathPara, *pReader, sXmlContent); + } + + if (!sXmlContent.empty()) + { + m_sAlternateContenteXml = sXmlContent; + } + } + else if (embedded_type == 1) + { + m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX); + + int id = pReader->m_nCountEmbedded++; + BinDocxRW::CDocxSerializer oDocxSerializer; NSBinPptxRW::CDrawingConverter oDrawingConverter; + std::wstring sThemePath, sMediaPath, sEmbedPath; + oDocxSerializer.CreateDocxFolders(sDstEmbeddedTemp, sThemePath, sMediaPath, sEmbedPath); + + oDrawingConverter.m_pReader->Init(pReader->GetData() + pReader->GetPos(), 0, _embed_data_size); + oDrawingConverter.SetMainDocument(&oDocxSerializer); - - //oDocxSerializer.m_pParamsWriter = new BinDocxRW::ParamsWriter(oDrawingConverter.m_pBinaryWriter, &oFontProcessor, &oDrawingConverter, NULL); - oDocxSerializer.m_pCurFileWriter = new Writers::FileWriter(L"", L"", false, 111, &oDrawingConverter, L""); - oDocxSerializer.getXmlContentElem(OOX::et_m_oMathPara, *pReader, sXmlContent); - } + oDrawingConverter.SetDstPath(sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"word"); + oDrawingConverter.SetSrcPath(pReader->m_strFolder, 1); - if (!sXmlContent.empty()) - { - m_sAlternateContenteXml = sXmlContent; - } - } - else if (embedded_type == 1) - { - m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX); + oDrawingConverter.SetMediaDstPath(sMediaPath); + oDrawingConverter.SetEmbedDstPath(sEmbedPath); - int id = pReader->m_nCountEmbedded++; - - BinDocxRW::CDocxSerializer oDocxSerializer; - NSBinPptxRW::CDrawingConverter oDrawingConverter; + std::wstring sDocxFilename = L"Microsoft_Word_Document" + std::to_wstring(id) + L".docx"; - std::wstring sThemePath, sMediaPath, sEmbedPath; - oDocxSerializer.CreateDocxFolders (sDstEmbeddedTemp, sThemePath, sMediaPath, sEmbedPath); + NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader; - oDrawingConverter.m_pReader->Init(pReader->GetData() + pReader->GetPos(), 0, _embed_data_size); + oDocxSerializer.m_pCurFileWriter = new Writers::FileWriter(sDstEmbeddedTemp, L"", false, 111, &oDrawingConverter, sThemePath); - oDrawingConverter.SetMainDocument(&oDocxSerializer); - - oDrawingConverter.SetDstPath(sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"word"); - oDrawingConverter.SetSrcPath(pReader->m_strFolder, 1); - - oDrawingConverter.SetMediaDstPath(sMediaPath); - oDrawingConverter.SetEmbedDstPath(sEmbedPath); - - std::wstring sDocxFilename = L"Microsoft_Word_Document" + std::to_wstring( id ) + L".docx"; - - NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader; - - oDocxSerializer.m_pCurFileWriter = new Writers::FileWriter(sDstEmbeddedTemp, L"", false, 111, &oDrawingConverter, sThemePath); - - BinDocxRW::BinaryFileReader oBinaryFileReader(pReader->m_strFolder, oBufferedStream, *oDocxSerializer.m_pCurFileWriter); - oBinaryFileReader.ReadFile(); + BinDocxRW::BinaryFileReader oBinaryFileReader(pReader->m_strFolder, oBufferedStream, *oDocxSerializer.m_pCurFileWriter); + oBinaryFileReader.ReadFile(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //themes - oDocxSerializer.m_pCurFileWriter->m_oTheme.Write(sThemePath); + //themes + oDocxSerializer.m_pCurFileWriter->m_oTheme.Write(sThemePath); - OOX::CContentTypes *pContentTypes = oDrawingConverter.GetContentTypes(); - //docProps - OOX::CPath pathDocProps = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"docProps"; - NSDirectory::CreateDirectory(pathDocProps.GetPath()); - - OOX::CPath DocProps = std::wstring(L"docProps"); + OOX::CContentTypes *pContentTypes = oDrawingConverter.GetContentTypes(); + //docProps + OOX::CPath pathDocProps = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"docProps"; + NSDirectory::CreateDirectory(pathDocProps.GetPath()); - OOX::CApp oApp(NULL); - oApp.SetDefaults(); - oApp.write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes); + OOX::CPath DocProps = std::wstring(L"docProps"); - OOX::CCore oCore(NULL); - oCore.SetDefaults(); - oCore.write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, *pContentTypes); + OOX::CApp oApp(NULL); + oApp.SetDefaults(); + oApp.write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes); - oDocxSerializer.m_pCurFileWriter->Write(); - pContentTypes->Write(sDstEmbeddedTemp); + OOX::CCore oCore(NULL); + oCore.SetDefaults(); + oCore.write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, *pContentTypes); - COfficeUtils oOfficeUtils(NULL); - oOfficeUtils.CompressFileOrDirectory(sDstEmbeddedTemp, sDstEmbedded + FILE_SEPARATOR_STR + sDocxFilename, true); + oDocxSerializer.m_pCurFileWriter->Write(); + pContentTypes->Write(sDstEmbeddedTemp); + + COfficeUtils oOfficeUtils(NULL); + oOfficeUtils.CompressFileOrDirectory(sDstEmbeddedTemp, sDstEmbedded + FILE_SEPARATOR_STR + sDocxFilename, true); //------------------------------------------------------------------ - //std::wstring sEmbWorksheetRelsName = L"embeddings/" + sDocxFilename; - //std::wstring sEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeWordDocument.RelationType(); - // - //m_oId = pReader->m_pRels->WriteRels(sEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring()); - m_OleObjectFile->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sDocxFilename, false); - - pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"docx"); + //std::wstring sEmbWorksheetRelsName = L"embeddings/" + sDocxFilename; + //std::wstring sEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeWordDocument.RelationType(); + // + //m_oId = pReader->m_pRels->WriteRels(sEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring()); + m_OleObjectFile->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sDocxFilename, false); + + pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"docx"); + } + else if (embedded_type == 2) + { + m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX); + + int id = pReader->m_nCountEmbedded++; //todoooo -> countEmbeddedObjects + + OOX::Spreadsheet::CXlsx oXlsx; + BinXlsxRW::BinaryFileReader oEmbeddedReader; + NSBinPptxRW::CDrawingConverter oDrawingConverter; + + std::wstring sDrawingsPath = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl" + FILE_SEPARATOR_STR + L"drawings"; + std::wstring sThemePath = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl" + FILE_SEPARATOR_STR + L"theme"; + std::wstring sEmbeddingsPath = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl" + FILE_SEPARATOR_STR + L"embeddings"; + + BinXlsxRW::SaveParams oSaveParams(sDrawingsPath, sEmbeddingsPath, sThemePath, oDrawingConverter.GetContentTypes()); + + std::wstring sXmlOptions, sMediaPath, sEmbedPath; + BinXlsxRW::CXlsxSerializer::CreateXlsxFolders(sXmlOptions, sDstEmbeddedTemp, sMediaPath, sEmbedPath); + + boost::unordered_map old_enum_map = oXlsx.m_mapEnumeratedGlobal; + + oXlsx.m_mapEnumeratedGlobal.clear(); + + oDrawingConverter.m_pReader->Init(pReader->GetData() + pReader->GetPos(), 0, _embed_data_size); + + oDrawingConverter.SetDstPath(sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl"); + oDrawingConverter.SetSrcPath(pReader->m_strFolder, 2); + + oDrawingConverter.SetMediaDstPath(sMediaPath); + oDrawingConverter.SetEmbedDstPath(sEmbedPath); + + std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(id) + L".xlsx"; + oEmbeddedReader.ReadMainTable(oXlsx, *oDrawingConverter.m_pReader, pReader->m_strFolder, sDstEmbeddedTemp, oSaveParams, &oDrawingConverter); + + oXlsx.PrepareToWrite(); + + oXlsx.Write(sDstEmbeddedTemp, *oSaveParams.pContentTypes); + + COfficeUtils oOfficeUtils(NULL); + oOfficeUtils.CompressFileOrDirectory(sDstEmbeddedTemp, sDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, true); + + oXlsx.m_mapEnumeratedGlobal = old_enum_map; +//------------------------------------------------------------------ + //std::wstring sEmbWorksheetRelsName = L"embeddings/" + sXlsxFilename; + //std::wstring sEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType(); + // + //m_oId = pReader->m_pRels->WriteRels(sEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring()); + m_OleObjectFile->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, false); + + pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx"); + } + NSDirectory::DeleteDirectory(sDstEmbeddedTemp); } - else if (embedded_type == 2) - { - m_OleObjectFile = new OOX::OleObject(NULL, true, pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX); - - int id = pReader->m_nCountEmbedded++; //todoooo -> countEmbeddedObjects - - OOX::Spreadsheet::CXlsx oXlsx; - BinXlsxRW::BinaryFileReader oEmbeddedReader; - NSBinPptxRW::CDrawingConverter oDrawingConverter; - - std::wstring sDrawingsPath = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl" + FILE_SEPARATOR_STR + L"drawings"; - std::wstring sThemePath = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl" + FILE_SEPARATOR_STR + L"theme"; - std::wstring sEmbeddingsPath = sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl" + FILE_SEPARATOR_STR + L"embeddings"; - - BinXlsxRW::SaveParams oSaveParams(sDrawingsPath, sEmbeddingsPath, sThemePath, oDrawingConverter.GetContentTypes()); - - std::wstring sXmlOptions, sMediaPath, sEmbedPath; - BinXlsxRW::CXlsxSerializer::CreateXlsxFolders (sXmlOptions, sDstEmbeddedTemp, sMediaPath, sEmbedPath); - - boost::unordered_map old_enum_map = oXlsx.m_mapEnumeratedGlobal; - - oXlsx.m_mapEnumeratedGlobal.clear(); - - oDrawingConverter.m_pReader->Init(pReader->GetData() + pReader->GetPos(), 0, _embed_data_size); - - oDrawingConverter.SetDstPath(sDstEmbeddedTemp + FILE_SEPARATOR_STR + L"xl"); - oDrawingConverter.SetSrcPath(pReader->m_strFolder, 2); - - oDrawingConverter.SetMediaDstPath(sMediaPath); - oDrawingConverter.SetEmbedDstPath(sEmbedPath); - - std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring( id ) + L".xlsx"; - oEmbeddedReader.ReadMainTable(oXlsx, *oDrawingConverter.m_pReader, pReader->m_strFolder, sDstEmbeddedTemp, oSaveParams, &oDrawingConverter); - - oXlsx.PrepareToWrite(); - - oXlsx.Write(sDstEmbeddedTemp, *oSaveParams.pContentTypes); - - COfficeUtils oOfficeUtils(NULL); - oOfficeUtils.CompressFileOrDirectory(sDstEmbeddedTemp, sDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, true); - - oXlsx.m_mapEnumeratedGlobal = old_enum_map; -//------------------------------------------------------------------ - //std::wstring sEmbWorksheetRelsName = L"embeddings/" + sXlsxFilename; - //std::wstring sEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType(); - // - //m_oId = pReader->m_pRels->WriteRels(sEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring()); - m_OleObjectFile->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, false); - - pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx"); - } - NSDirectory::DeleteDirectory(sDstEmbeddedTemp); - pReader->Seek(_end_embed_data); }break; diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp index dfd3b0d368..330544d70e 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp @@ -200,58 +200,58 @@ namespace PPTX OOX::CPath oox_file = oMediaFile->filename(); OOX::CPath embed_folder = oox_file.GetDirectory(true); OOX::CPath oox_unpacked = embed_folder + L"Temp_unpacked"; - NSDirectory::CreateDirectory(oox_unpacked.GetPath()); - - COfficeUtils oOfficeUtils(NULL); - oOfficeUtils.ExtractToDirectory(oox_file.GetPath(), oox_unpacked.GetPath(), NULL, 0); - - COfficeFileFormatChecker office_checker; - office_checker.isOOXFormatFile(oox_file.GetPath()); - - if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX || - office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM) + + if (true == NSDirectory::CreateDirectory(oox_unpacked.GetPath())) { - DocWrapper::FontProcessor oFontProcessor; - NSBinPptxRW::CDrawingConverter oDrawingConverter; + COfficeUtils oOfficeUtils(NULL); + oOfficeUtils.ExtractToDirectory(oox_file.GetPath(), oox_unpacked.GetPath(), NULL, 0); + COfficeFileFormatChecker office_checker; + office_checker.isOOXFormatFile(oox_file.GetPath()); - NSCommon::smart_ptr old_rels = *pWriter->m_pCurrentContainer; - NSCommon::smart_ptr old_theme = *pWriter->m_pTheme; + if (office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX || + office_checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM) + { + DocWrapper::FontProcessor oFontProcessor; + NSBinPptxRW::CDrawingConverter oDrawingConverter; - NSShapeImageGen::CMediaManager* old_manager = oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager; - oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = pWriter->m_pCommon->m_pMediaManager; + NSCommon::smart_ptr old_rels = *pWriter->m_pCurrentContainer; + NSCommon::smart_ptr old_theme = *pWriter->m_pTheme; - oDrawingConverter.SetFontPicker(pWriter->m_pCommon->m_pFontPicker); + NSShapeImageGen::CMediaManager* old_manager = oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager; + oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = pWriter->m_pCommon->m_pMediaManager; - BinXlsxRW::BinaryFileWriter xlsxBinaryWriter(oFontProcessor); + oDrawingConverter.SetFontPicker(pWriter->m_pCommon->m_pFontPicker); + + BinXlsxRW::BinaryFileWriter xlsxBinaryWriter(oFontProcessor); //---------------------------- - OOX::Spreadsheet::CXlsx oXlsxEmbedded(oox_unpacked); + OOX::Spreadsheet::CXlsx oXlsxEmbedded(oox_unpacked); - //startheader for test - //oDrawingConverter.m_pBinaryWriter->WriteStringUtf8(xlsxBinaryWriter.WriteFileHeader(0, BinXlsxRW::g_nFormatVersionNoBase64)); - - xlsxBinaryWriter.intoBindoc(&oXlsxEmbedded, *oDrawingConverter.m_pBinaryWriter, NULL, &oDrawingConverter); -//------------------------------ - *pWriter->m_pCurrentContainer = old_rels; - *pWriter->m_pTheme = old_theme; - oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = old_manager; - - pWriter->StartRecord(/*c_oserct_chartspaceXLSX*/16); - - BYTE* pbBinBuffer = oDrawingConverter.m_pBinaryWriter->GetBuffer(); - int nBinBufferLen = oDrawingConverter.m_pBinaryWriter->GetPosition(); + //startheader for test + //oDrawingConverter.m_pBinaryWriter->WriteStringUtf8(xlsxBinaryWriter.WriteFileHeader(0, BinXlsxRW::g_nFormatVersionNoBase64)); - pWriter->WriteBYTEArray(pbBinBuffer, nBinBufferLen); + xlsxBinaryWriter.intoBindoc(&oXlsxEmbedded, *oDrawingConverter.m_pBinaryWriter, NULL, &oDrawingConverter); + //------------------------------ + *pWriter->m_pCurrentContainer = old_rels; + *pWriter->m_pTheme = old_theme; + oDrawingConverter.m_pBinaryWriter->m_pCommon->m_pMediaManager = old_manager; - pWriter->EndRecord(); + pWriter->StartRecord(/*c_oserct_chartspaceXLSX*/16); - //for test - //NSFile::CFileBinary oFile; - //oFile.CreateFileW(L"d:\\Editor.bin"); - //oFile.WriteFile(pbBinBuffer, nBinBufferLen); - //oFile.CloseFile(); + BYTE* pbBinBuffer = oDrawingConverter.m_pBinaryWriter->GetBuffer(); + int nBinBufferLen = oDrawingConverter.m_pBinaryWriter->GetPosition(); + + pWriter->WriteBYTEArray(pbBinBuffer, nBinBufferLen); + + pWriter->EndRecord(); + + //for test + //NSFile::CFileBinary oFile; + //oFile.CreateFileW(L"d:\\Editor.bin"); + //oFile.WriteFile(pbBinBuffer, nBinBufferLen); + //oFile.CloseFile(); + } + NSDirectory::DeleteDirectory(oox_unpacked.GetPath()); } - - NSDirectory::DeleteDirectory(oox_unpacked.GetPath()); } } //---------------------------------------------------------------- diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.cpp index 0e0b8c9c3e..8002c623a4 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.cpp @@ -72,6 +72,15 @@ _UINT32 RtfConvertationManager::ConvertRtfToOOX( std::wstring sSrcFileName, std: oReader.m_sTempFolder = NSDirectory::CreateDirectoryWithUniqueName(sTempFolder); oWriter.m_sTempFolder = NSDirectory::CreateDirectoryWithUniqueName(sTempFolder); + if (oReader.m_sTempFolder.empty()) + { + oReader.m_sTempFolder = NSDirectory::CreateDirectoryWithUniqueName(NSDirectory::GetTempPath()); + } + if (oWriter.m_sTempFolder.empty()) + { + oWriter.m_sTempFolder = NSDirectory::CreateDirectoryWithUniqueName(NSDirectory::GetTempPath()); + } + m_poRtfReader = &oReader; m_poOOXWriter = &oWriter; @@ -117,7 +126,15 @@ _UINT32 RtfConvertationManager::ConvertOOXToRtf( std::wstring sDstFileName, std: oReader.m_sTempFolder = NSDirectory::CreateDirectoryWithUniqueName(sTempFolder); oWriter.m_sTempFolder = NSDirectory::CreateDirectoryWithUniqueName(sTempFolder); - m_poOOXReader = &oReader; + if (oReader.m_sTempFolder.empty()) + { + oReader.m_sTempFolder = NSDirectory::CreateDirectoryWithUniqueName(NSDirectory::GetTempPath()); + } + if (oWriter.m_sTempFolder.empty()) + { + oWriter.m_sTempFolder = NSDirectory::CreateDirectoryWithUniqueName(NSDirectory::GetTempPath()); + } + m_poOOXReader = &oReader; m_poRtfWriter = &oWriter; m_poOOXReader->m_convertationManager = this; diff --git a/DesktopEditor/common/Directory.cpp b/DesktopEditor/common/Directory.cpp index b698ea9c29..ccca4cd93b 100644 --- a/DesktopEditor/common/Directory.cpp +++ b/DesktopEditor/common/Directory.cpp @@ -214,6 +214,8 @@ namespace NSDirectory { std::vector oArray; + if (strDirectory.empty()) return oArray; + #if defined(_WIN32) || defined (_WIN64) WIN32_FIND_DATAW oFD; @@ -480,6 +482,8 @@ namespace NSDirectory } void DeleteDirectory(const std::wstring& strDirectory, bool deleteRoot) { + if (strDirectory.empty()) return; + std::vector aFiles = GetFiles(strDirectory); for(size_t i = 0; i < aFiles.size(); ++i) { diff --git a/X2tConverter/src/ASCConverters.cpp b/X2tConverter/src/ASCConverters.cpp index 24c7a57777..3352d9673a 100644 --- a/X2tConverter/src/ASCConverters.cpp +++ b/X2tConverter/src/ASCConverters.cpp @@ -3606,11 +3606,18 @@ namespace NExtractTools else if(0 != (AVS_OFFICESTUDIO_FILE_DOCUMENT & nFormatTo)) { std::wstring sDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked"); - NSDirectory::CreateDirectory(sDocxDir); - nRes = doct_bin2docx_dir(sFrom, sTo, sDocxDir, bFromChanges, sThemeDir, params); - if(SUCCEEDED_X2T(nRes)) + + if (true == NSDirectory::CreateDirectory(sDocxDir)) { - nRes = fromDocxDir(sDocxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params); + nRes = doct_bin2docx_dir(sFrom, sTo, sDocxDir, bFromChanges, sThemeDir, params); + if (SUCCEEDED_X2T(nRes)) + { + nRes = fromDocxDir(sDocxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params); + } + } + else + { + nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS; } } else @@ -3835,16 +3842,22 @@ namespace NExtractTools NSDoctRenderer::DoctRendererFormat::FormatFile eFromType = NSDoctRenderer::DoctRendererFormat::FormatFile::XLST; nRes = doct_bin2image(eFromType, sFrom, sTo, sTemp, bPaid, sThemeDir, params); } - else if(0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & nFormatTo)) - { - std::wstring sXlsxDir = sTemp + FILE_SEPARATOR_STR + _T("xlsx_unpacked"); - NSDirectory::CreateDirectory(sXlsxDir); - nRes = xlst_bin2xlsx_dir(sFrom, sTo, sXlsxDir, bFromChanges, sThemeDir, params); - if(SUCCEEDED_X2T(nRes)) - { - std::wstring sXlsxFile; - nRes = fromXlsxDir(sXlsxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params, sXlsxFile); - } + else if (0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & nFormatTo)) + { + std::wstring sXlsxDir = sTemp + FILE_SEPARATOR_STR + _T("xlsx_unpacked"); + if (true == NSDirectory::CreateDirectory(sXlsxDir)) + { + nRes = xlst_bin2xlsx_dir(sFrom, sTo, sXlsxDir, bFromChanges, sThemeDir, params); + if (SUCCEEDED_X2T(nRes)) + { + std::wstring sXlsxFile; + nRes = fromXlsxDir(sXlsxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params, sXlsxFile); + } + } + else + { + nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS; + } } else nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS; @@ -4070,12 +4083,19 @@ namespace NExtractTools else if(0 != (AVS_OFFICESTUDIO_FILE_PRESENTATION & nFormatTo)) { std::wstring sPptxDir = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked"); - NSDirectory::CreateDirectory(sPptxDir); - nRes = pptt_bin2pptx_dir(sFrom, sTo, sPptxDir, bFromChanges, sThemeDir, params); - if(SUCCEEDED_X2T(nRes)) - { - nRes = fromPptxDir(sPptxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params); - } + + if (true == NSDirectory::CreateDirectory(sPptxDir)) + { + nRes = pptt_bin2pptx_dir(sFrom, sTo, sPptxDir, bFromChanges, sThemeDir, params); + if (SUCCEEDED_X2T(nRes)) + { + nRes = fromPptxDir(sPptxDir, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params); + } + } + else + { + nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS; + } } else nRes = AVS_FILEUTILS_ERROR_CONVERT_PARAMS; diff --git a/XlsxSerializerCom/Reader/ChartFromToBinary.cpp b/XlsxSerializerCom/Reader/ChartFromToBinary.cpp index 29609ae302..603e39c5de 100644 --- a/XlsxSerializerCom/Reader/ChartFromToBinary.cpp +++ b/XlsxSerializerCom/Reader/ChartFromToBinary.cpp @@ -1297,6 +1297,8 @@ namespace BinXlsxRW std::wstring sDstEmbedded = m_oSaveParams.sEmbeddingsPath; std::wstring sDstEmbeddedTemp = NSDirectory::CreateDirectoryWithUniqueName(sDstEmbedded); + + if (false == sDstEmbeddedTemp.empty()) { file = new OOX::OleObject(NULL, true, m_pOfficeDrawingConverter->m_pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX); @@ -1342,8 +1344,9 @@ namespace BinXlsxRW file->set_filename(sDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, false); m_pOfficeDrawingConverter->m_pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx"); + + NSDirectory::DeleteDirectory(sDstEmbeddedTemp); } - NSDirectory::DeleteDirectory(sDstEmbeddedTemp); return c_oSerConstants::ReadOk; } From 973e263b469bf8401525ba448e36a7c9cd149027 Mon Sep 17 00:00:00 2001 From: "Elena.Subbotina" Date: Wed, 1 Sep 2021 11:02:23 +0300 Subject: [PATCH 09/12] fix open xlsx protect --- X2tConverter/src/ASCConverters.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/X2tConverter/src/ASCConverters.cpp b/X2tConverter/src/ASCConverters.cpp index 3352d9673a..6b7ba15ad8 100644 --- a/X2tConverter/src/ASCConverters.cpp +++ b/X2tConverter/src/ASCConverters.cpp @@ -3020,19 +3020,18 @@ namespace NExtractTools { std::wstring password = params.getPassword(); - if (password.empty()) + std::wstring sResultDecryptFile = sTemp + FILE_SEPARATOR_STR + L"uncrypt_file.oox"; + + _UINT32 nRes = mscrypt2oox(sFrom, sResultDecryptFile, sTemp, params); + + if (!SUCCEEDED_X2T(nRes) && password.empty()) // qiaoshemei1 (1).xlsx - запрокченный xlsx { if(!params.getDontSaveAdditional()) { copyOrigin(sFrom, sTo); } return AVS_FILEUTILS_ERROR_CONVERT_DRM; - } - - std::wstring sResultDecryptFile = sTemp + FILE_SEPARATOR_STR + L"uncrypt_file.oox"; - - _UINT32 nRes = mscrypt2oox(sFrom, sResultDecryptFile, sTemp, params); - + } nRes = processEncryptionError(nRes, sFrom, params); if (SUCCEEDED_X2T(nRes)) { From e6cb6d94385d197c10d27d052e4452ca3e425d95 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Thu, 2 Sep 2021 16:27:22 +0300 Subject: [PATCH 10/12] Add new method to BaseThread (DestroyOnFinish) --- DesktopEditor/graphics/BaseThread.cpp | 15 ++++++++++++++- DesktopEditor/graphics/BaseThread.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/DesktopEditor/graphics/BaseThread.cpp b/DesktopEditor/graphics/BaseThread.cpp index f2746f01c9..4b4b817e7b 100644 --- a/DesktopEditor/graphics/BaseThread.cpp +++ b/DesktopEditor/graphics/BaseThread.cpp @@ -86,7 +86,10 @@ namespace NSThreads DWORD WINAPI CBaseThread::__ThreadProc(void* pv) { CBaseThread* pThis = (CBaseThread*)pv; - return pThis->ThreadProc(); + DWORD value = pThis->ThreadProc(); + if (pThis->m_bIsNeedDestroy) + delete pThis; + return value; } class __native_thread : public CThreadDescriptor @@ -119,6 +122,10 @@ namespace NSThreads CBaseThread* pThis = (CBaseThread*)pv; pThis->ThreadProc(); + + if (pThis->m_bIsNeedDestroy) + delete pThis; + return NULL; } class __native_thread : public CThreadDescriptor @@ -146,6 +153,8 @@ namespace NSThreads m_lError = 0; m_lThreadPriority = 0; + + m_bIsNeedDestroy = false; } CBaseThread::~CBaseThread() { @@ -192,6 +201,10 @@ namespace NSThreads m_bRunThread = FALSE; RELEASEOBJECT(m_hThread); } + void CBaseThread::DestroyOnFinish() + { + m_bIsNeedDestroy = true; + } INT CBaseThread::IsSuspended() { return m_bSuspend; } INT CBaseThread::IsRunned() { return m_bRunThread; } diff --git a/DesktopEditor/graphics/BaseThread.h b/DesktopEditor/graphics/BaseThread.h index 188898b308..d733982278 100644 --- a/DesktopEditor/graphics/BaseThread.h +++ b/DesktopEditor/graphics/BaseThread.h @@ -65,6 +65,8 @@ namespace NSThreads int m_lError; int m_lThreadPriority; + bool m_bIsNeedDestroy; + public: CBaseThread(); virtual ~CBaseThread(); @@ -74,6 +76,7 @@ namespace NSThreads virtual void Resume(); virtual void Stop(); virtual void StopNoJoin(); + virtual void DestroyOnFinish(); INT IsSuspended(); INT IsRunned(); From 334c31fcda978fc9219c4dbc11d40401a35be321 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Fri, 3 Sep 2021 13:24:16 +0300 Subject: [PATCH 11/12] Fix bug 52291 --- DesktopEditor/fontengine/ApplicationFontsWorker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DesktopEditor/fontengine/ApplicationFontsWorker.cpp b/DesktopEditor/fontengine/ApplicationFontsWorker.cpp index 20f20a6483..f58d7a1e51 100644 --- a/DesktopEditor/fontengine/ApplicationFontsWorker.cpp +++ b/DesktopEditor/fontengine/ApplicationFontsWorker.cpp @@ -43,7 +43,7 @@ #include "../raster/BgraFrame.h" #include "../graphics/pro/Graphics.h" -#define ONLYOFFICE_FONTS_VERSION_ 5 +#define ONLYOFFICE_FONTS_VERSION_ 6 class CApplicationFontsWorker_private { From 8c726e475a562e64a39d36cac32226249a3f7697 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Fri, 3 Sep 2021 16:35:56 +0300 Subject: [PATCH 12/12] Fix bug 52097 --- DesktopEditor/doctrenderer/docbuilder_p.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/DesktopEditor/doctrenderer/docbuilder_p.h b/DesktopEditor/doctrenderer/docbuilder_p.h index 0ddac41e47..84be522d5e 100644 --- a/DesktopEditor/doctrenderer/docbuilder_p.h +++ b/DesktopEditor/doctrenderer/docbuilder_p.h @@ -179,9 +179,6 @@ namespace NSDoctRenderer { // Do not forget call СDocBuilder::Dispose() method!!! CJSContext::ExternalInitialize(); - // под линуксом предыдущая функция создает файл!!! - if (NSFile::CFileBinary::Exists(m_sTmpFolder)) - NSFile::CFileBinary::Remove(m_sTmpFolder); } void Init()