Compare commits

..

4 Commits

Author SHA1 Message Date
97b4311e95 . 2018-01-26 19:18:41 +03:00
228b3a52e9 . 2018-01-26 17:55:04 +03:00
2f2236646d Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatReader - data validation (type dropdown list)
  no squares
  fix previous commit
  font by symbol table
2018-01-26 17:08:57 +03:00
30603d0561 build fixed 2018-01-26 17:08:51 +03:00
12 changed files with 146 additions and 34 deletions

View File

@ -7449,6 +7449,8 @@ public:
{
PPTX::Logic::CNvPr pNonVisualDrawingProps(L"wp");
res = Read1(length, &Binary_DocumentTableReader::ReadDocPr, this, &pNonVisualDrawingProps);
pNonVisualDrawingProps.id = pDrawingProperty->m_nDocPr;
pDrawingProperty->sDocPr = pNonVisualDrawingProps.toXML2(L"wp:docPr");
}
else

View File

@ -48,13 +48,18 @@ namespace oox {
class xlsx_dataValidation
{
public:
xlsx_dataValidation() {}
xlsx_dataValidation() : showErrorMessage(false), showInputMessage(false), showDropDown(false), allowBlank(false) {}
std::wstring ref;
std::wstring activate_ref;
std::wstring type;
std::wstring formula1;
std::wstring formula2;
std::wstring operator_;
bool showErrorMessage;
bool showInputMessage;
bool showDropDown;
bool allowBlank;
};
typedef shared_ptr<xlsx_dataValidation>::Type xlsx_dataValidation_ptr;
@ -78,6 +83,11 @@ public:
CP_XML_NODE(L"dataValidation")
{
CP_XML_ATTR(L"sqref", it->second->activate_ref);
CP_XML_ATTR(L"allowBlank", it->second->allowBlank);
CP_XML_ATTR(L"operator", it->second->operator_);
CP_XML_ATTR(L"showDropDown", it->second->showDropDown);
CP_XML_ATTR(L"showErrorMessage", it->second->showErrorMessage);
CP_XML_ATTR(L"showInputMessage", it->second->showInputMessage);
CP_XML_ATTR(L"type", it->second->type);
if (!it->second->formula1.empty())
@ -136,9 +146,25 @@ void xlsx_dataValidations_context::activate(const std::wstring & name, const std
impl_->mapActivateDataValidations.insert(std::make_pair(name, pFind->second));
}
}
}
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, bool val)
{
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
if (pFind == impl_->mapDataValidations.end()) return;
pFind->second->showInputMessage = val;
}
void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, bool val)
{
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
if (pFind == impl_->mapDataValidations.end()) return;
pFind->second->showErrorMessage = val;
}
void xlsx_dataValidations_context::add(const std::wstring & name, const std::wstring &ref)
{
xlsx_dataValidation_ptr _new = xlsx_dataValidation_ptr(new xlsx_dataValidation());

View File

@ -46,6 +46,8 @@ public:
void add(const std::wstring & name, const std::wstring & ref);
void add_formula(const std::wstring & name, const std::wstring & f);
void add_help_msg(const std::wstring & name, bool val);
void add_error_msg(const std::wstring & name, bool val);
void activate(const std::wstring & name, const std::wstring & ref);

View File

@ -718,15 +718,6 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href)
xlsx_text_context_.end_span2();
}
}
void xlsx_conversion_context::add_content_validation(const std::wstring & name, const std::wstring & ref)
{
get_dataValidations_context().add(name, ref);
}
void xlsx_conversion_context::add_content_validation_condition(const std::wstring & name, const std::wstring & val)
{
get_dataValidations_context().add_formula(name, val);
}
void xlsx_conversion_context::add_pivot_sheet_source (const std::wstring & sheet_name, int index_table_view)
{//ващето в либре жесткая привязка что на одном листе тока одна сводная может быть ..
mapPivotsTableView_.insert(std::make_pair(sheet_name, index_table_view));

View File

@ -137,9 +137,6 @@ public:
void start_hyperlink (const std::wstring & styleName);
void end_hyperlink (std::wstring const & href);
void add_content_validation(const std::wstring & name, const std::wstring & ref);
void add_content_validation_condition(const std::wstring & name, const std::wstring & val);
//------------------------------------------------------------------------------------
void add_pivot_sheet_source (const std::wstring & sheet_name, int index_table_view);

View File

@ -41,9 +41,10 @@ std::wostream & operator << (std::wostream & _Wostream, const chart_data_label_n
{
switch(_Val.get_type())
{
case chart_data_label_number::none: _Wostream << L"none"; break;
case chart_data_label_number::value: _Wostream << L"value"; break;
case chart_data_label_number::percentage : _Wostream << L"percentage"; break;
case chart_data_label_number::none: _Wostream << L"none"; break;
case chart_data_label_number::value: _Wostream << L"value"; break;
case chart_data_label_number::percentage : _Wostream << L"percentage"; break;
case chart_data_label_number::value_and_percentage: _Wostream << L"value-and-percentage"; break;
}
return _Wostream;
}
@ -59,9 +60,10 @@ chart_data_label_number chart_data_label_number::parse(const std::wstring & Str)
return chart_data_label_number( value );
else if (tmp == L"percentage")
return chart_data_label_number( percentage );
else
else if (tmp == L"value-and-percentage")
return chart_data_label_number( value_and_percentage );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return chart_data_label_number( none );
}
}

View File

@ -45,7 +45,8 @@ public:
{
none,
value,
percentage
percentage,
value_and_percentage
};
chart_data_label_number() {}

View File

@ -238,6 +238,9 @@ enum ElementType
typeTableShapes,
typeTableContentValidation,
typeTableContentValidations,
typeTableHelpMassage,
typeTableErrorMassage,
typeTableErrorMacro,
typeTableFilter,
typeTableFilterAnd,

View File

@ -754,7 +754,35 @@ void table_content_validation::add_child_element( xml::sax * Reader, const std::
{
CP_CREATE_ELEMENT(content_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// table:content-validation
const wchar_t * table_error_message::ns = L"table";
const wchar_t * table_error_message::name = L"error-message";
void table_error_message::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:title", table_title_);
CP_APPLY_ATTR(L"table:message-type", table_message_type_);
CP_APPLY_ATTR(L"table:display", table_display_);
}
void table_error_message::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// table:content-validation
const wchar_t * table_help_message::ns = L"table";
const wchar_t * table_help_message::name = L"help-message";
void table_help_message::add_attributes(xml::attributes_wc_ptr const & Attributes)
{
CP_APPLY_ATTR(L"table:title", table_title_);
CP_APPLY_ATTR(L"table:message-type", table_message_type_);
CP_APPLY_ATTR(L"table:display", table_display_);
}
void table_help_message::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
}
}

View File

@ -725,5 +725,57 @@ private:
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_content_validation);
//table:error-message
class table_error_message : public office_element_impl<table_error_message>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableErrorMassage;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
_CP_OPT(std::wstring) table_title_;
_CP_OPT(odf_types::Bool) table_display_;
_CP_OPT(std::wstring) table_message_type_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_error_message);
//table:help-message
class table_help_message : public office_element_impl<table_help_message>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTableHelpMassage;
CPDOCCORE_DEFINE_VISITABLE();
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
_CP_OPT(std::wstring) table_title_;
_CP_OPT(odf_types::Bool) table_display_;
_CP_OPT(std::wstring) table_message_type_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_help_message);
//table:error-macro
}
}

View File

@ -839,8 +839,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
if (skip_next_cell)break;
// пустые ячейки пропускаем.
if ( is_data_visible || ((cellStyle || defaultColumnCellStyle) && is_style_visible))
{
@ -1199,14 +1198,27 @@ void table_content_validation::xlsx_convert(oox::xlsx_conversion_context & Conte
{
std::wstring name = table_name_.get_value_or(L"");
Context.add_content_validation(name, table_base_cell_address_.get_value_or(L""));
Context.add_content_validation_condition(name, table_condition_.get_value_or(L""));
//for (size_t i = 0 ; i < content_.size(); i++)
//{
// content_[i]->xlsx_convert(Context);
// }
Context.get_dataValidations_context().add(name, table_base_cell_address_.get_value_or(L""));
Context.get_dataValidations_context().add_formula(name, table_condition_.get_value_or(L""));
for (size_t i = 0 ; i < content_.size(); i++)
{
if (content_[i]->get_type() == typeTableErrorMassage)
{
Context.get_dataValidations_context().add_error_msg(name, true);
}
else if (content_[i]->get_type() == typeTableErrorMassage)
{
Context.get_dataValidations_context().add_help_msg(name, true);
}
content_[i]->xlsx_convert(Context);
}
}
void table_error_message::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
void table_help_message::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
}
}

View File

@ -158,7 +158,6 @@
17A764F11B0F39370046BC0B /* textops.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763D61B0F39370046BC0B /* textops.cpp */; };
17A764F31B0F39370046BC0B /* tiffio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763D71B0F39370046BC0B /* tiffio.cpp */; };
17A764F51B0F39370046BC0B /* tiffiostub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763D81B0F39370046BC0B /* tiffiostub.cpp */; };
17A764F91B0F39370046BC0B /* viewfiles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763DA1B0F39370046BC0B /* viewfiles.cpp */; };
17A764FB1B0F39370046BC0B /* warper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763DB1B0F39370046BC0B /* warper.cpp */; };
17A764FD1B0F39370046BC0B /* watershed.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763DC1B0F39370046BC0B /* watershed.cpp */; };
17A764FF1B0F39370046BC0B /* webpio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A763DE1B0F39370046BC0B /* webpio.cpp */; };
@ -394,7 +393,6 @@
17A763D61B0F39370046BC0B /* textops.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = textops.cpp; sourceTree = "<group>"; };
17A763D71B0F39370046BC0B /* tiffio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tiffio.cpp; sourceTree = "<group>"; };
17A763D81B0F39370046BC0B /* tiffiostub.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tiffiostub.cpp; sourceTree = "<group>"; };
17A763DA1B0F39370046BC0B /* viewfiles.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = viewfiles.cpp; sourceTree = "<group>"; };
17A763DB1B0F39370046BC0B /* warper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = warper.cpp; sourceTree = "<group>"; };
17A763DC1B0F39370046BC0B /* watershed.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = watershed.cpp; sourceTree = "<group>"; };
17A763DD1B0F39370046BC0B /* watershed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = watershed.h; sourceTree = "<group>"; };
@ -730,7 +728,6 @@
17A763D61B0F39370046BC0B /* textops.cpp */,
17A763D71B0F39370046BC0B /* tiffio.cpp */,
17A763D81B0F39370046BC0B /* tiffiostub.cpp */,
17A763DA1B0F39370046BC0B /* viewfiles.cpp */,
17A763DB1B0F39370046BC0B /* warper.cpp */,
17A763DC1B0F39370046BC0B /* watershed.cpp */,
17A763DD1B0F39370046BC0B /* watershed.h */,
@ -903,7 +900,6 @@
17A7649B1B0F39370046BC0B /* pixcomp.cpp in Sources */,
17A764171B0F39370046BC0B /* colorcontent.cpp in Sources */,
17A764671B0F39370046BC0B /* jpegiostub.cpp in Sources */,
17A764F91B0F39370046BC0B /* viewfiles.cpp in Sources */,
17A764AD1B0F39370046BC0B /* psio1stub.cpp in Sources */,
17A764CD1B0F39370046BC0B /* rotateamlow.cpp in Sources */,
17A763F31B0F39370046BC0B /* bbuffer.cpp in Sources */,