mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-23 10:11:50 +08:00
Compare commits
10 Commits
core-win-6
...
core-win-3
| Author | SHA1 | Date | |
|---|---|---|---|
| e0630979c5 | |||
| 8bc8b7cf58 | |||
| 14f4364962 | |||
| 9de3cb016f | |||
| f12cd8ff8f | |||
| 436015b5d2 | |||
| c078df93c9 | |||
| e5e8e01490 | |||
| 4fcc3b4f41 | |||
| ce44e50d0e |
@ -32,9 +32,38 @@
|
||||
|
||||
|
||||
#include "SettingsMapping.h"
|
||||
#include "../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
std::string DecodeBase64(const std::string & value)
|
||||
{
|
||||
int nLength = 0;
|
||||
unsigned char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string((char*)pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
std::wstring EncodeBase64(const std::string & value)
|
||||
{
|
||||
int nLength = 0;
|
||||
char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
NSFile::CBase64Converter::Encode((BYTE*)value.c_str(), value.length(), pData, nLength, NSBase64::B64_BASE64_FLAG_NOCRLF);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string(pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return std::wstring(result.begin(), result.end());
|
||||
}
|
||||
SettingsMapping::SettingsMapping (ConversionContext* ctx): PropertiesMapping(&m_oXmlWriter)
|
||||
{
|
||||
_ctx = ctx;
|
||||
@ -49,11 +78,39 @@ namespace DocFileFormat
|
||||
//start w:settings
|
||||
m_oXmlWriter.WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_oXmlWriter.WriteNodeBegin( L"w:settings", TRUE );
|
||||
|
||||
//write namespaces
|
||||
m_oXmlWriter.WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
m_oXmlWriter.WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
if (_ctx->_doc->FIB->m_FibBase.fWriteReservation)
|
||||
{
|
||||
m_oXmlWriter.WriteNodeBegin( L"w:writeProtection", TRUE );
|
||||
WideString* passw = static_cast<WideString*>(_ctx->_doc->AssocNames->operator[]( 17 ));
|
||||
if (passw && false == passw->empty())
|
||||
{
|
||||
CRYPT::_ecmaWriteProtectData data;
|
||||
|
||||
CRYPT::ECMAWriteProtect protect;
|
||||
protect.SetCryptData(data);
|
||||
protect.SetPassword(*passw);
|
||||
|
||||
protect.Generate();
|
||||
protect.GetCryptData(data);
|
||||
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptProviderType", L"rsaAES");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmSid", 14); //sha-512
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmType", L"typeAny");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptAlgorithmClass", L"hash");
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:cryptSpinCount", data.spinCount);
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:hash", EncodeBase64(data.hashValue));
|
||||
//m_oXmlWriter.WriteAttribute ( L"w:salt", EncodeBase64(data.saltValue));
|
||||
m_oXmlWriter.WriteAttribute ( L"w:algorithmName", L"SHA-512");
|
||||
m_oXmlWriter.WriteAttribute ( L"w:spinCount", data.spinCount);
|
||||
m_oXmlWriter.WriteAttribute ( L"w:hashValue", EncodeBase64(data.hashValue));
|
||||
m_oXmlWriter.WriteAttribute ( L"w:saltValue", EncodeBase64(data.saltValue));
|
||||
}
|
||||
m_oXmlWriter.WriteNodeEnd( L"", TRUE, TRUE );
|
||||
}
|
||||
//zoom
|
||||
m_oXmlWriter.WriteNodeBegin ( L"w:zoom", TRUE );
|
||||
m_oXmlWriter.WriteAttribute ( L"w:percent", FormatUtils::IntToWideString( dop->wScaleSaved > 0 ? dop->wScaleSaved : 100 ) );
|
||||
|
||||
@ -88,6 +88,7 @@ namespace DocFileFormat
|
||||
friend class VMLPictureMapping;
|
||||
friend class OpenXmlPackage;
|
||||
friend class TextboxMapping;
|
||||
friend class SettingsMapping;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -332,6 +332,7 @@ enum ElementType
|
||||
typeTableTableRowGroup,
|
||||
typeTableTableRowNoGroup,
|
||||
typeTableTableSource,
|
||||
typeTableTableProtection,
|
||||
|
||||
typeTableDataPilotTables,
|
||||
typeTableDataPilotTable,
|
||||
|
||||
@ -60,6 +60,7 @@ public:
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
std::wstringstream controls_;
|
||||
std::wstringstream protection_;
|
||||
|
||||
rels sheet_rels_;
|
||||
|
||||
@ -156,6 +157,10 @@ std::wostream & xlsx_xml_worksheet::dataValidations()
|
||||
{
|
||||
return impl_->dataValidations_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::protection()
|
||||
{
|
||||
return impl_->protection_;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
rels & xlsx_xml_worksheet::sheet_rels()
|
||||
{
|
||||
@ -203,6 +208,10 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->hyperlinks_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->protection_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->protection_.str();
|
||||
}
|
||||
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
|
||||
@ -68,6 +68,7 @@ public:
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
std::wostream & controls();
|
||||
std::wostream & protection();
|
||||
|
||||
rels & sheet_rels(); //hyperlink, background image, external, media ...
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
|
||||
#include "../../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -134,9 +135,8 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
|
||||
xlsx_comments_context_ (Context->get_comments_context_handle()),
|
||||
table_column_last_width_(0.0),
|
||||
in_cell(false),
|
||||
bEndTable_(false),
|
||||
bRTL_(false)
|
||||
|
||||
bEndTable(false),
|
||||
bRTL(false)
|
||||
{
|
||||
odf_reader::style_table_properties * table_prop = NULL;
|
||||
odf_reader::style_instance * tableStyle = context_->root()->odf_context().styleContainer().style_by_name(table_style_, odf_types::style_family::Table, false);
|
||||
@ -147,7 +147,7 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context * Context, std::wstri
|
||||
if ((table_prop) && (table_prop->content().common_writing_mode_attlist_.style_writing_mode_))
|
||||
{
|
||||
if (table_prop->content().common_writing_mode_attlist_.style_writing_mode_->get_type() == odf_types::writing_mode::RlTb)
|
||||
bRTL_ = true;
|
||||
bRTL = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,7 +162,27 @@ void xlsx_table_state::start_column(unsigned int repeated, const std::wstring &
|
||||
|
||||
void xlsx_table_state::set_rtl(bool val)
|
||||
{
|
||||
bRTL_ = val;
|
||||
bRTL = val;
|
||||
}
|
||||
|
||||
void xlsx_table_state::set_protection(bool val, const std::wstring &key, const std::wstring &algorithm)
|
||||
{
|
||||
bProtected = val;
|
||||
protect_key = key;
|
||||
|
||||
size_t pos = algorithm.find(L"#");
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
protect_key_algorithm = algorithm.substr(pos + 1);
|
||||
}
|
||||
|
||||
//test
|
||||
//CRYPT::odfWriteProtect protect;
|
||||
//protect.SetProtectKey(DecodeBase64(protect_key));
|
||||
//protect.SetPassword(L"123");
|
||||
|
||||
//bool res = protect.Verify();
|
||||
|
||||
}
|
||||
|
||||
unsigned int xlsx_table_state::columns_count() const
|
||||
@ -389,6 +409,19 @@ void xlsx_table_state::serialize_background (std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_protection (std::wostream & strm)
|
||||
{
|
||||
if (!bProtected) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"sheetProtection")
|
||||
{
|
||||
CP_XML_ATTR(L"sheet", 1);
|
||||
//convert protection odf->ooxml impossible without password !!!
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
|
||||
@ -437,7 +470,7 @@ void xlsx_table_state::serialize_table_format (std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"workbookViewId", 0);
|
||||
|
||||
if (bRTL_)
|
||||
if (bRTL)
|
||||
CP_XML_ATTR(L"rightToLeft", 1);
|
||||
|
||||
std::wstring s_col, s_row;
|
||||
|
||||
@ -126,7 +126,8 @@ public:
|
||||
std::wstring current_style() const { return table_style_; }
|
||||
|
||||
void set_rtl(bool val);
|
||||
|
||||
void set_protection(bool val, const std::wstring &key, const std::wstring &algorithm);
|
||||
|
||||
void start_column (unsigned int repeated, const std::wstring & defaultCellStyleName);
|
||||
void start_row (const std::wstring & StyleName, const std::wstring & defaultCellStyleName);
|
||||
|
||||
@ -136,8 +137,8 @@ public:
|
||||
|
||||
void add_empty_row(int count);
|
||||
|
||||
void set_end_table(){ bEndTable_ = true; }
|
||||
bool get_end_table(){ return bEndTable_; }
|
||||
void set_end_table(){ bEndTable = true; }
|
||||
bool get_end_table(){ return bEndTable; }
|
||||
|
||||
std::wstring current_row_style () const;
|
||||
std::wstring default_row_cell_style () const;
|
||||
@ -182,6 +183,7 @@ public:
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
@ -201,10 +203,14 @@ public:
|
||||
friend class xlsx_table_context;
|
||||
|
||||
private:
|
||||
bool bRTL_;
|
||||
bool bEndTable_;
|
||||
xlsx_conversion_context * context_;
|
||||
|
||||
bool bProtected;
|
||||
std::wstring protect_key;
|
||||
std::wstring protect_key_algorithm;
|
||||
bool bRTL;
|
||||
bool bEndTable;
|
||||
|
||||
std::wstring tableName_;
|
||||
int tableId_;
|
||||
std::wstring tableBackground_;
|
||||
|
||||
@ -204,17 +204,19 @@ xlsx_text_context_(textContext)
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_table_context::start_table(std::wstring tableName, std::wstring tableStyleName, int id)
|
||||
void xlsx_table_context::start_table(const std::wstring & tableName, const std::wstring & tableStyleName, int id)
|
||||
{
|
||||
xlsx_table_state_ptr state = boost::make_shared<xlsx_table_state>(xlsx_conversion_context_, tableStyleName, tableName, id);
|
||||
xlsx_table_states_.push_back( state);
|
||||
}
|
||||
|
||||
void xlsx_table_context::set_protection(bool val, const std::wstring &key, const std::wstring &algorithm)
|
||||
{
|
||||
xlsx_table_states_.back()->set_protection(val, key, algorithm);
|
||||
}
|
||||
void xlsx_table_context::end_table()
|
||||
{
|
||||
//xlsx_table_states_.pop_back();
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_table_context::start_cell(const std::wstring & formula, size_t columnsSpanned, size_t rowsSpanned)
|
||||
{
|
||||
state()->start_cell(columnsSpanned, rowsSpanned);
|
||||
@ -451,6 +453,10 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_context::serialize_protection(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_protection(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_conditionalFormatting(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_conditionalFormatting(_Wostream);
|
||||
|
||||
@ -48,7 +48,8 @@ class xlsx_table_context
|
||||
public:
|
||||
xlsx_table_context(xlsx_conversion_context * Context, xlsx_text_context & textCotnext);
|
||||
|
||||
void start_table(std::wstring tableName, std::wstring tableStyleName, int id);
|
||||
void start_table(const std::wstring &tableName, const std::wstring & tableStyleName, int id);
|
||||
void set_protection(bool val, const std::wstring &key, const std::wstring &algorithm);
|
||||
void end_table();
|
||||
|
||||
void start_cell(const std::wstring & formula,
|
||||
@ -94,6 +95,7 @@ public:
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
|
||||
@ -481,7 +481,8 @@ void xlsx_conversion_context::end_table()
|
||||
get_table_context().serialize_sort (current_sheet().sort());
|
||||
get_table_context().serialize_merge_cells (current_sheet().mergeCells());
|
||||
get_table_context().serialize_data_validation (current_sheet().dataValidations());
|
||||
|
||||
get_table_context().serialize_protection (current_sheet().protection());
|
||||
|
||||
get_drawing_context().set_odf_packet_path (root()->get_folder());
|
||||
get_drawing_context().process_objects (get_table_metrics());
|
||||
|
||||
|
||||
@ -332,22 +332,6 @@ bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std
|
||||
}
|
||||
return result;
|
||||
}
|
||||
std::string DecodeBase64(const std::wstring & value1)
|
||||
{
|
||||
int nLength = 0;
|
||||
unsigned char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
std::string value(value1.begin(), value1.end());
|
||||
|
||||
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string((char*)pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
bool odf_document::Impl::decrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, office_element_ptr element, int file_size )
|
||||
{
|
||||
manifest_encryption_data* encryption_data = dynamic_cast<manifest_encryption_data*>(element.get());
|
||||
|
||||
@ -35,7 +35,23 @@
|
||||
namespace cpdoccore {
|
||||
|
||||
using namespace odf_types;
|
||||
|
||||
std::string DecodeBase64(const std::wstring & value1)
|
||||
{
|
||||
int nLength = 0;
|
||||
unsigned char *pData = NULL;
|
||||
std::string result;
|
||||
|
||||
std::string value(value1.begin(), value1.end());
|
||||
|
||||
NSFile::CBase64Converter::Decode(value.c_str(), value.length(), pData, nLength);
|
||||
if (pData)
|
||||
{
|
||||
result = std::string((char*)pData, nLength);
|
||||
delete []pData; pData = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
namespace odf_reader {
|
||||
|
||||
style_instance::style_instance(
|
||||
|
||||
@ -44,6 +44,9 @@
|
||||
#include <iosfwd>
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
std::string DecodeBase64(const std::wstring & value);
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
class styles_container;
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
|
||||
virtual void visit(const table_table& val)
|
||||
{
|
||||
if (visit_table(val.table_table_attlist_.table_name_.get_value_or(L"")))
|
||||
if (visit_table(val.attlist_.table_name_.get_value_or(L"")))
|
||||
{
|
||||
ACCEPT_ALL_CONTENT_CONST(val.table_columns_and_groups_.content_, stop_);
|
||||
ACCEPT_ALL_CONTENT_CONST(val.table_rows_and_groups_.content_, stop_);
|
||||
|
||||
@ -57,6 +57,8 @@ void table_table_attlist::add_attributes( const xml::attributes_wc_ptr & Attribu
|
||||
|
||||
CP_APPLY_ATTR(L"table:protected", table_protected_, false);
|
||||
CP_APPLY_ATTR(L"table:protection-key", table_protection_key_);
|
||||
CP_APPLY_ATTR(L"table:protection-key-digest-algorithm", table_protection_key_digest_algorithm_);
|
||||
|
||||
CP_APPLY_ATTR(L"table:print", table_print_, true);
|
||||
CP_APPLY_ATTR(L"table:print-ranges", table_print_ranges_);
|
||||
|
||||
@ -134,7 +136,23 @@ void table_table_source::add_child_element( xml::sax * Reader, const std::wstrin
|
||||
{
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:table-protection
|
||||
const wchar_t * table_table_protection::ns = L"loext"; //?? table odf 1.3
|
||||
const wchar_t * table_table_protection::name = L"table-protection";
|
||||
|
||||
void table_table_protection::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"loext:select-protected-cells", select_protected_cells);
|
||||
CP_APPLY_ATTR(L"loext:select-unprotected-cells",select_unprotected_cells);
|
||||
CP_APPLY_ATTR(L"loext:insert-columns", insert_columns);
|
||||
CP_APPLY_ATTR(L"loext:insert-rows", insert_rows);
|
||||
CP_APPLY_ATTR(L"loext:delete-columns", delete_columns);
|
||||
CP_APPLY_ATTR(L"loext:delete-rows", delete_rows);
|
||||
//CP_APPLY_ATTR(L"loext:format-columns", format_columns);
|
||||
//CP_APPLY_ATTR(L"loext:format-rows", format_rows);
|
||||
//CP_APPLY_ATTR(L"loext:format-cells", format_cells);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:table
|
||||
const wchar_t * table_table::ns = L"table";
|
||||
@ -144,7 +162,7 @@ void table_table::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:style-name", element_style_name);
|
||||
|
||||
table_table_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -172,9 +190,13 @@ void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
else if CP_CHECK_NAME(L"table", L"shapes")
|
||||
{
|
||||
CP_CREATE_ELEMENT(table_shapes_);
|
||||
}
|
||||
else if ( L"table-protection" == Name) //ns = loext or table
|
||||
{
|
||||
CP_CREATE_ELEMENT(table_protection_);
|
||||
}
|
||||
else if ( CP_CHECK_NAME(L"table", L"named-expressions") ||
|
||||
CP_CHECK_NAME(L"table", L"named-range") ) //???
|
||||
CP_CHECK_NAME(L"table", L"named-range") )
|
||||
{
|
||||
CP_CREATE_ELEMENT(table_named_);
|
||||
}
|
||||
|
||||
@ -61,15 +61,17 @@ public:
|
||||
_CP_OPT(std::wstring) table_style_name_;
|
||||
_CP_OPT(std::wstring) table_template_name_;
|
||||
|
||||
bool table_protected_; // default false
|
||||
bool table_protected_; // default false
|
||||
_CP_OPT(std::wstring) table_protection_key_;
|
||||
bool table_print_; // default true
|
||||
_CP_OPT(std::wstring) table_protection_key_digest_algorithm_;
|
||||
|
||||
bool table_print_; // default true
|
||||
_CP_OPT(std::wstring) table_print_ranges_;
|
||||
|
||||
bool table_use_first_row_styles_; // default false;
|
||||
bool table_use_banding_rows_styles_; //defualt false;
|
||||
bool table_use_first_column_styles_; //defualt false;
|
||||
bool table_use_banding_columns_styles_; //defualt false;
|
||||
bool table_use_banding_rows_styles_; // defualt false;
|
||||
bool table_use_first_column_styles_; // defualt false;
|
||||
bool table_use_banding_columns_styles_; // defualt false;
|
||||
|
||||
friend class table_table;
|
||||
};
|
||||
@ -617,6 +619,38 @@ public:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group);
|
||||
|
||||
class table_table_protection : public office_element_impl<table_table_protection>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableTableProtection;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) {}
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) {}
|
||||
virtual void pptx_convert(oox::pptx_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){}
|
||||
|
||||
public:
|
||||
_CP_OPT(bool) select_protected_cells;
|
||||
_CP_OPT(bool) select_unprotected_cells;
|
||||
_CP_OPT(bool) insert_columns;
|
||||
_CP_OPT(bool) insert_rows;
|
||||
|
||||
_CP_OPT(bool) delete_columns;
|
||||
_CP_OPT(bool) delete_rows;
|
||||
//_CP_OPT(bool) format_columns; //???
|
||||
//_CP_OPT(bool) format_rows;
|
||||
//_CP_OPT(bool) format_cells;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_table_protection);
|
||||
|
||||
class table_table : public office_element_impl<table_table>
|
||||
{
|
||||
public:
|
||||
@ -636,7 +670,9 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
table_table_attlist table_table_attlist_;
|
||||
table_table_attlist attlist_;
|
||||
|
||||
office_element_ptr table_protection_;
|
||||
|
||||
table_columns_and_groups table_columns_and_groups_;
|
||||
table_rows_and_groups table_rows_and_groups_;
|
||||
|
||||
@ -171,10 +171,10 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
|
||||
}
|
||||
}
|
||||
|
||||
bool sub_table = table_table_attlist_.table_is_sub_table_.get_value_or(false);
|
||||
bool sub_table = attlist_.table_is_sub_table_.get_value_or(false);
|
||||
//todooo придумать как сделать внешние границы sub-таблицы границами внешней ячейки (чтоб слияние произошло)
|
||||
|
||||
std::wstring tableStyleName = table_table_attlist_.table_style_name_.get_value_or(L"");
|
||||
std::wstring tableStyleName = attlist_.table_style_name_.get_value_or(L"");
|
||||
|
||||
_Wostream << L"<w:tbl>";
|
||||
|
||||
|
||||
@ -159,13 +159,13 @@ void table_table::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
Context.get_slide_context().start_table();
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
std::wstring tableStyleName = table_table_attlist_.table_style_name_.get_value_or(L"");
|
||||
std::wstring tableStyleName = attlist_.table_style_name_.get_value_or(L"");
|
||||
|
||||
Context.get_table_context().start_table(tableStyleName);
|
||||
|
||||
if (table_table_attlist_.table_template_name_)
|
||||
if (attlist_.table_template_name_)
|
||||
{
|
||||
std::wstring name = L"table:" + table_table_attlist_.table_template_name_.get() ;
|
||||
std::wstring name = L"table:" + attlist_.table_template_name_.get() ;
|
||||
if (office_element_ptr style = Context.root()->odf_context().Templates().find_by_style_name(name))
|
||||
{
|
||||
if (table_table_template* template_ = dynamic_cast<table_table_template *>(style.get()))
|
||||
@ -184,13 +184,13 @@ void table_table::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
_Wostream << L"<a:tbl>";
|
||||
|
||||
_Wostream << L"<a:tblPr";
|
||||
if (table_table_attlist_.table_use_banding_rows_styles_)
|
||||
if (attlist_.table_use_banding_rows_styles_)
|
||||
_Wostream << L" bandRow=\"1\"";
|
||||
if (table_table_attlist_.table_use_first_row_styles_)
|
||||
if (attlist_.table_use_first_row_styles_)
|
||||
_Wostream << L" firstRow=\"1\"";
|
||||
if (table_table_attlist_.table_use_banding_columns_styles_)
|
||||
if (attlist_.table_use_banding_columns_styles_)
|
||||
_Wostream << L" bandCol=\"1\"";
|
||||
if (table_table_attlist_.table_use_first_column_styles_)
|
||||
if (attlist_.table_use_first_column_styles_)
|
||||
_Wostream << L" firstCol=\"1\"";
|
||||
_Wostream << ">";
|
||||
|
||||
|
||||
@ -319,8 +319,8 @@ void table_table_row_group::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
const std::wstring tableStyleName = table_table_attlist_.table_style_name_.get_value_or(L"");
|
||||
const std::wstring tableName = table_table_attlist_.table_name_.get_value_or(L"");
|
||||
const std::wstring tableStyleName = attlist_.table_style_name_.get_value_or(L"");
|
||||
const std::wstring tableName = attlist_.table_name_.get_value_or(L"");
|
||||
|
||||
_CP_LOG << L"[info][xlsx] process table \"" << tableName << L"\"\n" << std::endl;
|
||||
|
||||
@ -340,6 +340,16 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
Context.start_table(tableName, tableStyleName);
|
||||
|
||||
if (attlist_.table_protected_)
|
||||
{
|
||||
Context.get_table_context().set_protection(true, attlist_.table_protection_key_.get_value_or(L""),
|
||||
attlist_.table_protection_key_digest_algorithm_.get_value_or(L""));
|
||||
table_table_protection* prot = dynamic_cast<table_table_protection*>( table_protection_.get() );
|
||||
if (prot)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
table_columns_and_groups_.xlsx_convert(Context);
|
||||
|
||||
// check last rows for equal style and empties - collapsed
|
||||
|
||||
@ -174,7 +174,7 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled)
|
||||
state.table.style_elm = style_state->get_office_element();
|
||||
state.table.style_name = style_state->get_name();
|
||||
|
||||
table->table_table_attlist_.table_style_name_ = state.table.style_name;
|
||||
table->attlist_.table_style_name_ = state.table.style_name;
|
||||
}
|
||||
}
|
||||
impl_->default_cell_properties = L"";
|
||||
@ -226,11 +226,11 @@ void odf_table_context::start_row(office_element_ptr &elm, bool styled)
|
||||
state.style_elm = style_state->get_office_element();
|
||||
state.style_name = style_state->get_name();
|
||||
|
||||
row->table_table_row_attlist_.table_style_name_ = state.style_name;
|
||||
row->attlist_.table_style_name_ = state.style_name;
|
||||
}
|
||||
}
|
||||
if (!impl_->current_table().default_cell_properties.empty())
|
||||
row->table_table_row_attlist_.table_default_cell_style_name_ = impl_->current_table().default_cell_properties;
|
||||
row->attlist_.table_default_cell_style_name_ = impl_->current_table().default_cell_properties;
|
||||
|
||||
|
||||
impl_->current_table().rows.push_back(state);
|
||||
@ -277,7 +277,7 @@ void odf_table_context::add_column(office_element_ptr &elm, bool styled)
|
||||
{
|
||||
state.style_elm = style_state->get_office_element();
|
||||
state.style_name = style_state->get_name();
|
||||
column->table_table_column_attlist_.table_style_name_ = state.style_name;
|
||||
column->attlist_.table_style_name_ = state.style_name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -466,7 +466,7 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
|
||||
state.style_elm = style_state->get_office_element();
|
||||
state.style_name = style_state->get_name();
|
||||
|
||||
cell->table_table_cell_attlist_.table_style_name_ = state.style_name;
|
||||
cell->attlist_.table_style_name_ = state.style_name;
|
||||
}
|
||||
|
||||
if (!impl_->current_table().default_cell_properties.empty())
|
||||
@ -498,7 +498,7 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(state_row.spanned_column_cell[0].get());
|
||||
if (!cell)return;
|
||||
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = (unsigned int)state_row.spanned_column_cell.size();
|
||||
cell->attlist_extra_.table_number_columns_spanned_ = (unsigned int)state_row.spanned_column_cell.size();
|
||||
state_row.spanned_column_cell.clear();
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ void odf_table_context::set_cell_column_span_restart()
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(state.spanned_column_cell[0].get());
|
||||
if (!cell)return;
|
||||
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = sz;
|
||||
cell->attlist_extra_.table_number_columns_spanned_ = sz;
|
||||
}
|
||||
state.spanned_column_cell.clear();
|
||||
}
|
||||
@ -530,7 +530,7 @@ void odf_table_context::set_cell_column_span(int spanned)
|
||||
{
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(impl_->current_table().cells.back().elm.get());
|
||||
if (cell)
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned;
|
||||
cell->attlist_extra_.table_number_columns_spanned_ = spanned;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -551,7 +551,7 @@ void odf_table_context::set_cell_row_span(int spanned)
|
||||
{
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(impl_->current_table().cells.back().elm.get());
|
||||
if (cell)
|
||||
cell->table_table_cell_attlist_extra_.table_number_rows_spanned_ = spanned;
|
||||
cell->attlist_extra_.table_number_rows_spanned_ = spanned;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -574,7 +574,7 @@ void odf_table_context::set_cell_row_span_restart()
|
||||
table_table_cell * cell = dynamic_cast<table_table_cell *>(state.spanned_row_cell[0].get());
|
||||
if (!cell)return;
|
||||
|
||||
cell->table_table_cell_attlist_extra_.table_number_rows_spanned_ = sz;
|
||||
cell->attlist_extra_.table_number_rows_spanned_ = sz;
|
||||
}
|
||||
state.spanned_row_cell.clear();
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ void ods_table_state::set_table_name(std::wstring name)
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table->table_table_attlist_.table_name_ = name;
|
||||
table->attlist_.table_name_ = name;
|
||||
}
|
||||
|
||||
void ods_table_state::set_table_master_page(std::wstring name)
|
||||
@ -178,7 +178,74 @@ void ods_table_state::set_table_master_page(std::wstring name)
|
||||
|
||||
office_table_style_->style_master_page_name_ = name;
|
||||
}
|
||||
void ods_table_state::set_table_protection(bool Val)
|
||||
{
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table->attlist_.table_protected_ = true;
|
||||
create_element(L"loext", L"table-protection", table->table_protection_, context_);
|
||||
}
|
||||
void ods_table_state::set_table_protection_insert_columns(bool Val)
|
||||
{
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table_table_protection *prot = dynamic_cast<table_table_protection*>(table->table_protection_.get());
|
||||
if (!prot) return;
|
||||
|
||||
prot->insert_columns = Val;
|
||||
}
|
||||
void ods_table_state::set_table_protection_insert_rows(bool Val)
|
||||
{
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table_table_protection *prot = dynamic_cast<table_table_protection*>(table->table_protection_.get());
|
||||
if (!prot) return;
|
||||
|
||||
prot->insert_rows = Val;
|
||||
}
|
||||
void ods_table_state::set_table_protection_delete_columns(bool Val)
|
||||
{
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table_table_protection *prot = dynamic_cast<table_table_protection*>(table->table_protection_.get());
|
||||
if (!prot) return;
|
||||
|
||||
prot->delete_columns = Val;
|
||||
}
|
||||
void ods_table_state::set_table_protection_delete_rows(bool Val)
|
||||
{
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table_table_protection *prot = dynamic_cast<table_table_protection*>(table->table_protection_.get());
|
||||
if (!prot) return;
|
||||
|
||||
prot->delete_rows = Val;
|
||||
}
|
||||
void ods_table_state::set_table_protection_protected_cells(bool Val)
|
||||
{
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table_table_protection *prot = dynamic_cast<table_table_protection*>(table->table_protection_.get());
|
||||
if (!prot) return;
|
||||
|
||||
prot->select_protected_cells = Val;
|
||||
}
|
||||
void ods_table_state::set_table_protection_unprotected_cells(bool Val)
|
||||
{
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table_table_protection *prot = dynamic_cast<table_table_protection*>(table->table_protection_.get());
|
||||
if (!prot) return;
|
||||
|
||||
prot->select_unprotected_cells = Val;
|
||||
}
|
||||
void ods_table_state::set_table_hidden(bool Val)
|
||||
{
|
||||
if (!office_table_style_)return;
|
||||
@ -205,7 +272,7 @@ void ods_table_state::set_print_range(std::wstring range)
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table->table_table_attlist_.table_print_ranges_ = range;
|
||||
table->attlist_.table_print_ranges_ = range;
|
||||
}
|
||||
|
||||
void ods_table_state::set_table_tab_color(_CP_OPT(color) & _color)
|
||||
@ -227,7 +294,7 @@ void ods_table_state::set_table_style(office_element_ptr & elm)
|
||||
table_table* table = dynamic_cast<table_table*>(office_table_.get());
|
||||
if (table == NULL)return;
|
||||
|
||||
table->table_table_attlist_.table_style_name_ = office_table_style_->style_name_;
|
||||
table->attlist_.table_style_name_ = office_table_style_->style_name_;
|
||||
//потом в принципе и по имени можно будет связать(найти)
|
||||
|
||||
|
||||
@ -273,8 +340,8 @@ void ods_table_state::add_column(office_element_ptr & elm, unsigned int repeated
|
||||
table_table_column* column = dynamic_cast<table_table_column*>(columns_.back().elm.get());
|
||||
if (column == NULL)return;
|
||||
|
||||
if (style_name.length()>0) column->table_table_column_attlist_.table_style_name_ = style_name;
|
||||
column->table_table_column_attlist_.table_number_columns_repeated_ = repeated;
|
||||
if (style_name.length()>0) column->attlist_.table_style_name_ = style_name;
|
||||
column->attlist_.table_number_columns_repeated_ = repeated;
|
||||
|
||||
}
|
||||
void ods_table_state::set_column_default_cell_style(std::wstring & style_name)
|
||||
@ -284,7 +351,7 @@ void ods_table_state::set_column_default_cell_style(std::wstring & style_name)
|
||||
table_table_column* column = dynamic_cast<table_table_column*>(columns_.back().elm.get());
|
||||
if (column == NULL)return;
|
||||
|
||||
column->table_table_column_attlist_.table_default_cell_style_name_ = style_name;
|
||||
column->attlist_.table_default_cell_style_name_ = style_name;
|
||||
|
||||
columns_.back().cell_style_name = style_name;
|
||||
}
|
||||
@ -330,7 +397,7 @@ void ods_table_state::set_column_hidden(bool val)
|
||||
table_table_column* column = dynamic_cast<table_table_column*>(columns_.back().elm.get());
|
||||
if (column == NULL)return;
|
||||
|
||||
column->table_table_column_attlist_.table_visibility_ = table_visibility(table_visibility::Collapse);
|
||||
column->attlist_.table_visibility_ = table_visibility(table_visibility::Collapse);
|
||||
}
|
||||
void ods_table_state::set_table_dimension(int col, int row)
|
||||
{
|
||||
@ -370,8 +437,8 @@ void ods_table_state::add_row(office_element_ptr & elm, unsigned int repeated, o
|
||||
table_table_row* row = dynamic_cast<table_table_row*>(rows_.back().elm.get());
|
||||
if (row == NULL)return;
|
||||
|
||||
if (style_name.length()>0) row->table_table_row_attlist_.table_style_name_ = style_name;
|
||||
row->table_table_row_attlist_.table_number_rows_repeated_ = repeated;
|
||||
if (style_name.length()>0) row->attlist_.table_style_name_ = style_name;
|
||||
row->attlist_.table_number_rows_repeated_ = repeated;
|
||||
|
||||
row_default_cell_style_name_ = L"";
|
||||
|
||||
@ -394,14 +461,14 @@ void ods_table_state::add_row_repeated()
|
||||
i--;
|
||||
}
|
||||
}
|
||||
row->table_table_row_attlist_.table_number_rows_repeated_ = rows_.back().repeated;
|
||||
row->attlist_.table_number_rows_repeated_ = rows_.back().repeated;
|
||||
}
|
||||
void ods_table_state::set_row_hidden(bool Val)
|
||||
{
|
||||
table_table_row* row = dynamic_cast<table_table_row*>(rows_.back().elm.get());
|
||||
if (row == NULL)return;
|
||||
|
||||
row->table_table_row_attlist_.table_visibility_ = table_visibility(table_visibility::Collapse);
|
||||
row->attlist_.table_visibility_ = table_visibility(table_visibility::Collapse);
|
||||
}
|
||||
void ods_table_state::set_row_optimal_height(bool val)
|
||||
{
|
||||
@ -496,7 +563,7 @@ void ods_table_state::set_row_default_cell_style(std::wstring & style_name)
|
||||
//table_table_row* row = dynamic_cast<table_table_row*>(rows_.back().elm.get());
|
||||
//if (row == NULL)return;
|
||||
|
||||
//row->table_table_row_attlist_.table_default_cell_style_name_ = style_name;
|
||||
//row->attlist_.table_default_cell_style_name_ = style_name;
|
||||
}
|
||||
|
||||
office_element_ptr & ods_table_state::current_row_element()
|
||||
@ -536,12 +603,12 @@ void ods_table_state::start_cell(office_element_ptr & elm, office_element_ptr &
|
||||
table_table_cell* cell = dynamic_cast<table_table_cell*>(elm.get());
|
||||
if (cell && !style_name.empty() && style_name != get_column_default_cell_style(current_column()))
|
||||
{
|
||||
cell->table_table_cell_attlist_.table_style_name_ = style_name;
|
||||
cell->attlist_.table_style_name_ = style_name;
|
||||
}
|
||||
table_covered_table_cell* covered_cell = dynamic_cast<table_covered_table_cell*>(elm.get());
|
||||
if (covered_cell && !style_name.empty() && style_name != get_column_default_cell_style(current_column()))
|
||||
{
|
||||
covered_cell->table_table_cell_attlist_.table_style_name_ = style_name;
|
||||
covered_cell->attlist_.table_style_name_ = style_name;
|
||||
}
|
||||
ods_cell_state state;
|
||||
|
||||
@ -571,7 +638,7 @@ void ods_table_state::set_cell_format_value(office_value_type::type value_type)
|
||||
common_value_and_type_attlist cell_type;
|
||||
cell_type.office_value_type_ = office_value_type(value_type);
|
||||
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_ = cell_type;
|
||||
cell->attlist_.common_value_and_type_attlist_ = cell_type;
|
||||
|
||||
}
|
||||
void ods_table_state::set_cell_type(int type)
|
||||
@ -599,11 +666,11 @@ void ods_table_state::set_cell_type(int type)
|
||||
}
|
||||
if (cell_type)
|
||||
{
|
||||
if (!cell->table_table_cell_attlist_.common_value_and_type_attlist_)
|
||||
if (!cell->attlist_.common_value_and_type_attlist_)
|
||||
{
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
|
||||
cell->attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
|
||||
}
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_ = cell_type;
|
||||
cell->attlist_.common_value_and_type_attlist_->office_value_type_ = cell_type;
|
||||
}
|
||||
}
|
||||
void ods_table_state::add_definded_expression(office_element_ptr & elm)
|
||||
@ -693,8 +760,8 @@ void ods_table_state::check_spanned_cells()
|
||||
table_table_cell* cell_elm = dynamic_cast<table_table_cell*>(cells_[i].elm.get());
|
||||
if (cell_elm == NULL)break;
|
||||
|
||||
cell_elm->table_table_cell_attlist_extra_.table_number_columns_spanned_ = jt->second.spanned_cols;
|
||||
cell_elm->table_table_cell_attlist_extra_.table_number_rows_spanned_ = jt->second.spanned_rows;
|
||||
cell_elm->attlist_extra_.table_number_columns_spanned_ = jt->second.spanned_cols;
|
||||
cell_elm->attlist_extra_.table_number_rows_spanned_ = jt->second.spanned_rows;
|
||||
|
||||
break;
|
||||
}
|
||||
@ -794,8 +861,8 @@ void ods_table_state::set_cell_spanned(int spanned_cols, int spanned_rows)
|
||||
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
|
||||
if (cell == NULL)return;
|
||||
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned_cols;
|
||||
cell->table_table_cell_attlist_extra_.table_number_rows_spanned_ = spanned_rows;
|
||||
cell->attlist_extra_.table_number_columns_spanned_ = spanned_cols;
|
||||
cell->attlist_extra_.table_number_rows_spanned_ = spanned_rows;
|
||||
}
|
||||
void ods_table_state::set_cell_formula(std::wstring & formula)
|
||||
{
|
||||
@ -866,7 +933,7 @@ void ods_table_state::set_cell_formula(std::wstring & formula)
|
||||
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
|
||||
if (cell == NULL)return;
|
||||
|
||||
cell->table_table_cell_attlist_.table_formula_ = odfFormula;
|
||||
cell->attlist_.table_formula_ = odfFormula;
|
||||
cells_.back().empty = false;
|
||||
}
|
||||
|
||||
@ -939,7 +1006,7 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
|
||||
ods_shared_formula_state state = {(unsigned int)ind, odf_formula,ref, current_table_column_,current_table_row_, moving_type};
|
||||
shared_formulas_.push_back(state);
|
||||
|
||||
cell->table_table_cell_attlist_.table_formula_ = odf_formula;
|
||||
cell->attlist_.table_formula_ = odf_formula;
|
||||
cells_.back().empty = false;
|
||||
}
|
||||
else
|
||||
@ -975,7 +1042,7 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
|
||||
boost::match_default | boost::format_all);
|
||||
odf_formula = res;
|
||||
}
|
||||
cell->table_table_cell_attlist_.table_formula_ = odf_formula;
|
||||
cell->attlist_.table_formula_ = odf_formula;
|
||||
cells_.back().empty = false;
|
||||
}
|
||||
}
|
||||
@ -1016,8 +1083,8 @@ void ods_table_state::set_cell_array_formula(std::wstring & formula, std::wstrin
|
||||
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
|
||||
if (cell == NULL)return;
|
||||
|
||||
cell->table_table_cell_attlist_extra_.table_number_matrix_columns_spanned_ = col_span;
|
||||
cell->table_table_cell_attlist_extra_.table_number_matrix_rows_spanned_ = row_span;
|
||||
cell->attlist_extra_.table_number_matrix_columns_spanned_ = col_span;
|
||||
cell->attlist_extra_.table_number_matrix_rows_spanned_ = row_span;
|
||||
|
||||
}
|
||||
}
|
||||
@ -1100,11 +1167,11 @@ void ods_table_state::set_cell_text(odf_text_context* text_context, bool cash_va
|
||||
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
|
||||
if (cell)
|
||||
{
|
||||
if (!cell->table_table_cell_attlist_.common_value_and_type_attlist_)
|
||||
if (!cell->attlist_.common_value_and_type_attlist_)
|
||||
{
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
|
||||
cell->attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
|
||||
}
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_ = cell_type;
|
||||
cell->attlist_.common_value_and_type_attlist_->office_value_type_ = cell_type;
|
||||
}
|
||||
cells_.back().empty = false;
|
||||
|
||||
@ -1127,35 +1194,35 @@ void ods_table_state::set_cell_value(const std::wstring & value, bool need_cash)
|
||||
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
|
||||
if (cell == NULL)return;
|
||||
|
||||
if (!cell->table_table_cell_attlist_.common_value_and_type_attlist_)
|
||||
if (!cell->attlist_.common_value_and_type_attlist_)
|
||||
{
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_ = office_value_type(office_value_type::Float);
|
||||
cell->attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
|
||||
cell->attlist_.common_value_and_type_attlist_->office_value_type_ = office_value_type(office_value_type::Float);
|
||||
//временно... пока нет определялки типов
|
||||
}
|
||||
cells_.back().empty = false;
|
||||
|
||||
if (cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_)
|
||||
if (cell->attlist_.common_value_and_type_attlist_->office_value_type_)
|
||||
{
|
||||
switch(cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_->get_type())
|
||||
switch(cell->attlist_.common_value_and_type_attlist_->office_value_type_->get_type())
|
||||
{
|
||||
case office_value_type::String:
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_string_value_ = value;
|
||||
cell->attlist_.common_value_and_type_attlist_->office_string_value_ = value;
|
||||
break;
|
||||
case office_value_type::Boolean:
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_boolean_value_ = value;
|
||||
cell->attlist_.common_value_and_type_attlist_->office_boolean_value_ = value;
|
||||
break;
|
||||
case office_value_type::Date:
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_date_value_ = utils::convert_date(value);
|
||||
cell->attlist_.common_value_and_type_attlist_->office_date_value_ = utils::convert_date(value);
|
||||
break;
|
||||
case office_value_type::Time:
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_time_value_ = utils::convert_time(value);
|
||||
cell->attlist_.common_value_and_type_attlist_->office_time_value_ = utils::convert_time(value);
|
||||
break;
|
||||
case office_value_type::Currency:
|
||||
case office_value_type::Percentage:
|
||||
case office_value_type::Float:
|
||||
default:
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_ = value;
|
||||
cell->attlist_.common_value_and_type_attlist_->office_value_ = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1168,11 +1235,11 @@ void ods_table_state::set_cell_value(const std::wstring & value, bool need_cash)
|
||||
{
|
||||
bool need_test_cach = false;
|
||||
|
||||
if (cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_)
|
||||
if (cell->attlist_.common_value_and_type_attlist_->office_value_type_)
|
||||
{
|
||||
if (cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_->get_type() == office_value_type::Float) need_test_cach = true;
|
||||
if (cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_->get_type() == office_value_type::Currency) need_test_cach = true;
|
||||
if (cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_->get_type() == office_value_type::Percentage) need_test_cach = true;
|
||||
if (cell->attlist_.common_value_and_type_attlist_->office_value_type_->get_type() == office_value_type::Float) need_test_cach = true;
|
||||
if (cell->attlist_.common_value_and_type_attlist_->office_value_type_->get_type() == office_value_type::Currency) need_test_cach = true;
|
||||
if (cell->attlist_.common_value_and_type_attlist_->office_value_type_->get_type() == office_value_type::Percentage) need_test_cach = true;
|
||||
}
|
||||
try
|
||||
{
|
||||
@ -1186,8 +1253,8 @@ void ods_table_state::set_cell_value(const std::wstring & value, bool need_cash)
|
||||
{
|
||||
if (need_cash)
|
||||
{
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_ = boost::none;
|
||||
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_ = office_value_type(office_value_type::String);
|
||||
cell->attlist_.common_value_and_type_attlist_->office_value_ = boost::none;
|
||||
cell->attlist_.common_value_and_type_attlist_->office_value_type_ = office_value_type(office_value_type::String);
|
||||
}
|
||||
}
|
||||
if (need_cash)
|
||||
@ -1216,7 +1283,7 @@ void ods_table_state::end_cell()
|
||||
if (cells_.back().empty)
|
||||
{
|
||||
table_table_cell* cell = dynamic_cast<table_table_cell*>(cells_.back().elm.get());
|
||||
if (cell)cell->table_table_cell_attlist_.common_value_and_type_attlist_ = boost::none;
|
||||
if (cell)cell->attlist_.common_value_and_type_attlist_ = boost::none;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1315,8 +1382,8 @@ void ods_table_state::add_default_cell( unsigned int repeated)
|
||||
int spanned_rows = 0, spanned_cols = 0;
|
||||
if (cell && isSpannedCell(current_table_column_, current_table_row_, spanned_cols, spanned_rows))
|
||||
{
|
||||
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned_cols;
|
||||
cell->table_table_cell_attlist_extra_.table_number_rows_spanned_ = spanned_rows;
|
||||
cell->attlist_extra_.table_number_columns_spanned_ = spanned_cols;
|
||||
cell->attlist_extra_.table_number_rows_spanned_ = spanned_rows;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1338,17 +1405,17 @@ void ods_table_state::add_default_cell( unsigned int repeated)
|
||||
|
||||
if (cell)
|
||||
{
|
||||
cell->table_table_cell_attlist_.table_number_columns_repeated_ = repeated;
|
||||
cell->attlist_.table_number_columns_repeated_ = repeated;
|
||||
|
||||
if (!row_default_cell_style_name_.empty())
|
||||
cell->table_table_cell_attlist_.table_style_name_ = row_default_cell_style_name_;
|
||||
cell->attlist_.table_style_name_ = row_default_cell_style_name_;
|
||||
}
|
||||
if (covered_cell)
|
||||
{
|
||||
covered_cell->table_table_cell_attlist_.table_number_columns_repeated_ = repeated;
|
||||
covered_cell->attlist_.table_number_columns_repeated_ = repeated;
|
||||
|
||||
if (!row_default_cell_style_name_.empty())
|
||||
covered_cell->table_table_cell_attlist_.table_style_name_ = row_default_cell_style_name_;
|
||||
covered_cell->attlist_.table_style_name_ = row_default_cell_style_name_;
|
||||
|
||||
current_covered_cols_ -= repeated;
|
||||
}
|
||||
|
||||
@ -253,6 +253,14 @@ public:
|
||||
void set_table_tab_color(_CP_OPT(odf_types::color) & _color);
|
||||
void set_table_dimension(int col, int row);
|
||||
void set_print_range(std::wstring range);
|
||||
|
||||
void set_table_protection(bool Val);
|
||||
void set_table_protection_insert_columns(bool Val);
|
||||
void set_table_protection_insert_rows(bool Val);
|
||||
void set_table_protection_delete_columns(bool Val);
|
||||
void set_table_protection_delete_rows(bool Val);
|
||||
void set_table_protection_unprotected_cells(bool Val);
|
||||
void set_table_protection_protected_cells(bool Val);
|
||||
|
||||
void add_column(office_element_ptr & elm, unsigned int repeated ,office_element_ptr & style);
|
||||
void set_column_width(double width);
|
||||
|
||||
@ -50,13 +50,17 @@ using xml::xml_char_wc;
|
||||
|
||||
void table_table_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT( L"table:name", table_name_);
|
||||
CP_XML_ATTR_OPT( L"table:style-name", table_style_name_);
|
||||
CP_XML_ATTR_OPT( L"table:template-name", table_template_name_);
|
||||
CP_XML_ATTR_OPT( L"table:name", table_name_);
|
||||
CP_XML_ATTR_OPT( L"table:style-name", table_style_name_);
|
||||
CP_XML_ATTR_OPT( L"table:template-name", table_template_name_);
|
||||
|
||||
if (table_protected_ && table_protected_->get())
|
||||
{
|
||||
CP_XML_ATTR_OPT( L"table:protected", table_protected_);
|
||||
CP_XML_ATTR_OPT( L"table:protection-key", table_protection_key_);
|
||||
CP_XML_ATTR_OPT( L"table:protection-digest-algorithm", table_protection_key_digest_algorithm_);
|
||||
}
|
||||
|
||||
if (table_protected_)
|
||||
CP_XML_ATTR_OPT( L"table:protection-key", table_protection_key_);
|
||||
|
||||
if (table_print_)
|
||||
CP_XML_ATTR_OPT( L"table:print-ranges", table_print_ranges_);
|
||||
}
|
||||
@ -120,6 +124,28 @@ void table_table_column_attlist::serialize(CP_ATTR_NODE)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const wchar_t * table_table_protection::ns = L"loext"; //table ???
|
||||
const wchar_t * table_table_protection::name = L"table-protection";
|
||||
|
||||
void table_table_protection::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
CP_XML_ATTR(L"loext:select-protected-cells", select_protected_cells);
|
||||
CP_XML_ATTR(L"loext:select-unprotected-cells", select_unprotected_cells);
|
||||
|
||||
CP_XML_ATTR_OPT(L"loext:insert-columns", insert_columns);
|
||||
CP_XML_ATTR_OPT(L"loext:insert-rows", insert_rows);
|
||||
|
||||
CP_XML_ATTR_OPT(L"loext:delete-columns", delete_columns);
|
||||
CP_XML_ATTR_OPT(L"loext:delete-rows", delete_rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const wchar_t * table_table_source::ns = L"table";
|
||||
const wchar_t * table_table_source::name = L"table-source";
|
||||
|
||||
@ -225,7 +251,9 @@ void table_table::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
table_table_attlist_.serialize(CP_GET_XML_NODE());
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
if (table_protection_)table_protection_->serialize(CP_XML_STREAM());
|
||||
|
||||
if (table_shapes_)table_shapes_->serialize(CP_XML_STREAM());
|
||||
|
||||
@ -257,7 +285,7 @@ void table_table_column::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
table_table_column_attlist_.serialize(CP_GET_XML_NODE());
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -553,12 +581,12 @@ const wchar_t * table_table_cell::name = L"table-cell";
|
||||
|
||||
void table_table_cell::create_child_element( const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
table_table_cell_content_.create_child_element(Ns, Name, getContext());
|
||||
content_.create_child_element(Ns, Name, getContext());
|
||||
}
|
||||
|
||||
void table_table_cell::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
table_table_cell_content_.add_child_element(child_element);
|
||||
content_.add_child_element(child_element);
|
||||
}
|
||||
void table_table_cell::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -566,10 +594,10 @@ void table_table_cell::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
table_table_cell_attlist_.serialize(CP_GET_XML_NODE());
|
||||
table_table_cell_attlist_extra_.serialize(CP_GET_XML_NODE());
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
attlist_extra_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
table_table_cell_content_.serialize(CP_XML_STREAM());
|
||||
content_.serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -582,12 +610,12 @@ const wchar_t * table_covered_table_cell::name = L"covered-table-cell";
|
||||
void table_covered_table_cell::create_child_element( const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
empty_ = false;
|
||||
table_table_cell_content_.create_child_element( Ns, Name, getContext());
|
||||
content_.create_child_element( Ns, Name, getContext());
|
||||
}
|
||||
void table_covered_table_cell::add_child_element( const office_element_ptr & child_element)
|
||||
{
|
||||
empty_ = false;
|
||||
table_table_cell_content_.add_child_element(child_element);
|
||||
content_.add_child_element(child_element);
|
||||
}
|
||||
void table_covered_table_cell::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
@ -595,9 +623,9 @@ void table_covered_table_cell::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
table_table_cell_attlist_.serialize(CP_GET_XML_NODE());
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
table_table_cell_content_.serialize(CP_XML_STREAM());
|
||||
content_.serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -632,7 +660,7 @@ void table_table_row::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
CP_XML_NODE_SIMPLE()
|
||||
{
|
||||
table_table_row_attlist_.serialize(CP_GET_XML_NODE());
|
||||
attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
|
||||
@ -66,10 +66,11 @@ public:
|
||||
_CP_OPT(std::wstring) table_style_name_;
|
||||
_CP_OPT(std::wstring) table_template_name_;
|
||||
|
||||
_CP_OPT(std::wstring) table_protection_key_;
|
||||
_CP_OPT(std::wstring) table_print_ranges_;
|
||||
|
||||
_CP_OPT(odf_types::Bool) table_protected_; // default false
|
||||
_CP_OPT(odf_types::Bool) table_protected_; // default false
|
||||
_CP_OPT(std::wstring) table_protection_key_;
|
||||
_CP_OPT(std::wstring) table_protection_key_digest_algorithm_;
|
||||
|
||||
bool table_print_; // default true
|
||||
|
||||
@ -152,7 +153,37 @@ public:
|
||||
|
||||
void serialize(CP_ATTR_NODE);
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
class table_table_protection : public office_element_impl<table_table_protection>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableTableProtection;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
table_table_protection() : select_protected_cells(true), select_unprotected_cells(true) {}
|
||||
|
||||
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_child_element( const office_element_ptr & child_element){}
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
odf_types::Bool select_protected_cells;
|
||||
odf_types::Bool select_unprotected_cells;
|
||||
|
||||
_CP_OPT(odf_types::Bool) insert_columns;
|
||||
_CP_OPT(odf_types::Bool) insert_rows;
|
||||
|
||||
_CP_OPT(odf_types::Bool) delete_columns;
|
||||
_CP_OPT(odf_types::Bool) delete_rows;
|
||||
//_CP_OPT(bool) format_columns; //???
|
||||
//_CP_OPT(bool) format_rows;
|
||||
//_CP_OPT(bool) format_cells;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_table_protection);
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
class table_table_source : public office_element_impl<table_table_source>
|
||||
{
|
||||
@ -274,7 +305,7 @@ public:
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
public:
|
||||
table_table_column_attlist table_table_column_attlist_;
|
||||
table_table_column_attlist attlist_;
|
||||
|
||||
};
|
||||
|
||||
@ -378,7 +409,7 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
table_table_row_attlist table_table_row_attlist_;
|
||||
table_table_row_attlist attlist_;
|
||||
office_element_ptr_array content_; // table-table-cell, table-covered-table-cell
|
||||
|
||||
};
|
||||
@ -418,9 +449,9 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
table_table_cell_attlist table_table_cell_attlist_;
|
||||
table_table_cell_attlist_extra table_table_cell_attlist_extra_;
|
||||
table_table_cell_content table_table_cell_content_;
|
||||
table_table_cell_attlist attlist_;
|
||||
table_table_cell_attlist_extra attlist_extra_;
|
||||
table_table_cell_content content_;
|
||||
|
||||
};
|
||||
|
||||
@ -445,8 +476,8 @@ public:
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
bool empty_;
|
||||
table_table_cell_attlist table_table_cell_attlist_;
|
||||
table_table_cell_content table_table_cell_content_;
|
||||
table_table_cell_attlist attlist_;
|
||||
table_table_cell_content content_;
|
||||
|
||||
};
|
||||
|
||||
@ -616,17 +647,20 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & _Wostream);
|
||||
|
||||
table_table_attlist table_table_attlist_;
|
||||
office_element_ptr table_table_source_;//table-table-source
|
||||
table_table_attlist attlist_;
|
||||
|
||||
office_element_ptr table_table_source_;//table-table-source
|
||||
office_element_ptr table_protection_;
|
||||
|
||||
office_element_ptr table_named_expressions_;
|
||||
office_element_ptr table_conditional_formats_;
|
||||
office_element_ptr table_shapes_;
|
||||
table_columns_and_groups table_columns_and_groups_;//table-columns-and-groups
|
||||
table_rows_and_groups table_rows_and_groups_;
|
||||
|
||||
//office-dde-source
|
||||
//table-scenario
|
||||
//office-forms
|
||||
office_element_ptr table_named_expressions_;
|
||||
office_element_ptr table_conditional_formats_;
|
||||
office_element_ptr table_shapes_;
|
||||
table_columns_and_groups table_columns_and_groups_;//table-columns-and-groups
|
||||
table_rows_and_groups table_rows_and_groups_;
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_table);
|
||||
|
||||
@ -374,11 +374,13 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
convert(oox_sheet->m_oDataValidations.GetPointer());
|
||||
convert(oox_sheet->m_oSheetViews.GetPointer());
|
||||
convert(oox_sheet->m_oHeaderFooter.GetPointer());
|
||||
convert(oox_sheet->m_oPageSetup.GetPointer());
|
||||
convert(oox_sheet->m_oPageMargins.GetPointer());
|
||||
convert(oox_sheet->m_oPicture.GetPointer());
|
||||
convert(oox_sheet->m_oSheetProtection.GetPointer());
|
||||
|
||||
OoxConverter::convert(oox_sheet->m_oExtLst.GetPointer());
|
||||
|
||||
@ -389,6 +391,51 @@ void XlsxConverter::convert(OOX::Spreadsheet::CHeaderFooter * oox_header_footer)
|
||||
if (!oox_header_footer) return;
|
||||
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CSheetProtection *oox_prot)
|
||||
{
|
||||
if (!oox_prot) return;
|
||||
|
||||
ods_context->current_table().set_table_protection(true);
|
||||
|
||||
if (oox_prot->m_oInsertColumns.IsInit())
|
||||
{
|
||||
ods_context->current_table().set_table_protection_insert_columns(oox_prot->m_oInsertColumns->ToBool());
|
||||
}
|
||||
if (oox_prot->m_oInsertRows.IsInit())
|
||||
{
|
||||
ods_context->current_table().set_table_protection_insert_rows(oox_prot->m_oInsertRows->ToBool());
|
||||
}
|
||||
if (oox_prot->m_oDeleteColumns.IsInit())
|
||||
{
|
||||
ods_context->current_table().set_table_protection_delete_columns(oox_prot->m_oDeleteColumns->ToBool());
|
||||
}
|
||||
if (oox_prot->m_oDeleteRows.IsInit())
|
||||
{
|
||||
ods_context->current_table().set_table_protection_delete_rows(oox_prot->m_oDeleteRows->ToBool());
|
||||
}
|
||||
if (oox_prot->m_oSelectLockedCells.IsInit())
|
||||
{
|
||||
ods_context->current_table().set_table_protection_protected_cells(oox_prot->m_oSelectLockedCells->ToBool());
|
||||
}
|
||||
if (oox_prot->m_oSelectUnlockedCell.IsInit())
|
||||
{
|
||||
ods_context->current_table().set_table_protection_unprotected_cells(oox_prot->m_oSelectUnlockedCell->ToBool());
|
||||
}
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CDataValidations *oox_validations)
|
||||
{
|
||||
if (!oox_validations) return;
|
||||
|
||||
for (size_t i = 0; i < oox_validations->m_arrItems.size(); i++)
|
||||
{
|
||||
convert(oox_validations->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CDataValidation *oox_validation)
|
||||
{
|
||||
if (!oox_validation) return;
|
||||
}
|
||||
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CPictureWorksheet *oox_background)
|
||||
{
|
||||
if (!oox_background) return;
|
||||
|
||||
@ -94,6 +94,9 @@ namespace OOX
|
||||
class CSparklineGroups;
|
||||
class CAltTextTable;
|
||||
class CExternalLink;
|
||||
class CDataValidations;
|
||||
class CSheetProtection;
|
||||
class CDataValidation;
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,6 +204,9 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::Spreadsheet::CFromTo *oox_from_to, oox_table_position *pos);
|
||||
|
||||
void convert(OOX::Spreadsheet::CSheetProtection *oox_prot);
|
||||
void convert(OOX::Spreadsheet::CDataValidations *oox_validations);
|
||||
void convert(OOX::Spreadsheet::CDataValidation *oox_validation);
|
||||
void convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt);
|
||||
void convert(OOX::Spreadsheet::CConditionalFormattingRule *oox_cond_rule);
|
||||
void convert(OOX::Spreadsheet::CAutofilter *oox_filter);
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
#include "../Biff_records/ObjProtect.h"
|
||||
#include "../Biff_records/Password.h"
|
||||
|
||||
#include "../../../../../OfficeCryptReader/source/CryptTransform.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -76,6 +78,18 @@ const bool PROTECTION_COMMON::loadContent(BinProcessor& proc)
|
||||
{
|
||||
m_Password = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
////test
|
||||
//Password* passw = dynamic_cast<Password*>(m_Password.get());
|
||||
|
||||
//CRYPT::_ecmaWriteProtectData data;
|
||||
//data.hashValue = std::string(passw->wPassword.begin(), passw->wPassword.end());
|
||||
|
||||
//CRYPT::ECMAWriteProtect protect;
|
||||
//protect.SetCryptData(data);
|
||||
//protect.SetPassword(L"123");
|
||||
|
||||
//bool res = protect.VerifyWrike();
|
||||
}
|
||||
|
||||
return m_Protect || m_ScenarioProtect || m_ObjProtect || m_Password;
|
||||
|
||||
@ -6778,22 +6778,23 @@ namespace SimpleTypes
|
||||
|
||||
virtual ECryptAlgoritmName FromString(std::wstring &sValue)
|
||||
{
|
||||
if ( (L"MD2") == sValue ) this->m_eValue = cryptalgoritmnameMD2;
|
||||
else if ( (L"MD4") == sValue ) this->m_eValue = cryptalgoritmnameMD4;
|
||||
else if ( (L"MD5") == sValue ) this->m_eValue = cryptalgoritmnameMD5;
|
||||
else if ( (L"RIPEMD-128") == sValue ) this->m_eValue = cryptalgoritmnameRIPEMD128;
|
||||
else if ( (L"RIPEMD-160") == sValue ) this->m_eValue = cryptalgoritmnameRIPEMD160;
|
||||
else if ( (L"SHA-1") == sValue ) this->m_eValue = cryptalgoritmnameSHA1;
|
||||
else if ( (L"SHA-256") == sValue ) this->m_eValue = cryptalgoritmnameSHA256;
|
||||
else if ( (L"SHA-384") == sValue ) this->m_eValue = cryptalgoritmnameSHA384;
|
||||
else if ( (L"SHA-512") == sValue ) this->m_eValue = cryptalgoritmnameSHA512;
|
||||
else if ( (L"WHIRLPOOL") == sValue ) this->m_eValue = cryptalgoritmnameWHIRLPOOL;
|
||||
else this->m_eValue = eDefValue;
|
||||
if ( L"MD2" == sValue || L"1" == sValue ) this->m_eValue = cryptalgoritmnameMD2;
|
||||
else if ( L"MD4" == sValue || L"2" == sValue ) this->m_eValue = cryptalgoritmnameMD4;
|
||||
else if ( L"MD5" == sValue || L"3" == sValue ) this->m_eValue = cryptalgoritmnameMD5;
|
||||
else if ( L"RIPEMD-128" == sValue || L"6" == sValue ) this->m_eValue = cryptalgoritmnameRIPEMD128;
|
||||
else if ( L"RIPEMD-160" == sValue || L"7" == sValue ) this->m_eValue = cryptalgoritmnameRIPEMD160;
|
||||
else if ( L"SHA-1" == sValue || L"4" == sValue ) this->m_eValue = cryptalgoritmnameSHA1;
|
||||
else if ( L"SHA-256" == sValue || L"12" == sValue ) this->m_eValue = cryptalgoritmnameSHA256;
|
||||
else if ( L"SHA-384" == sValue || L"13" == sValue ) this->m_eValue = cryptalgoritmnameSHA384;
|
||||
else if ( L"SHA-512" == sValue || L"14" == sValue ) this->m_eValue = cryptalgoritmnameSHA512;
|
||||
else if ( L"WHIRLPOOL" == sValue ) this->m_eValue = cryptalgoritmnameWHIRLPOOL;
|
||||
else
|
||||
this->m_eValue = eDefValue;
|
||||
|
||||
return this->m_eValue;
|
||||
}
|
||||
|
||||
virtual std::wstring ToString () const
|
||||
virtual std::wstring ToString() const
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
@ -6810,7 +6811,6 @@ namespace SimpleTypes
|
||||
default : return (L"");
|
||||
}
|
||||
}
|
||||
|
||||
SimpleType_FromString (ECryptAlgoritmName)
|
||||
SimpleType_Operator_Equal (CCryptAlgoritmName)
|
||||
};
|
||||
|
||||
@ -2134,20 +2134,28 @@ namespace OOX
|
||||
switch ( wsChar2 )
|
||||
{
|
||||
case 'a':
|
||||
if ( _T("w:algorithmName") == wsName ) m_oAlgorithmName = oReader.GetText();
|
||||
if ( L"w:algorithmName" == wsName ) m_oAlgorithmName = oReader.GetText();
|
||||
break;
|
||||
case 'c':
|
||||
if ( L"w:cryptProviderType" == wsName ) m_oCryptProviderType = oReader.GetText();
|
||||
else if ( L"w:cryptAlgorithmSid" == wsName ) m_oAlgorithmName = oReader.GetText();
|
||||
else if ( L"w:cryptAlgorithmType" == wsName ) m_oCryptAlgorithmType = oReader.GetText();
|
||||
else if ( L"w:cryptAlgorithmClass" == wsName ) m_oCryptAlgorithmClass = oReader.GetText();
|
||||
else if ( L"w:cryptSpinCount" == wsName ) m_oSpinCount = oReader.GetText();
|
||||
break;
|
||||
case 'h':
|
||||
if ( _T("w:hashValue") == wsName ) m_sHashValue = oReader.GetText();
|
||||
if ( L"w:hashValue" == wsName ) m_sHashValue = oReader.GetText();
|
||||
else if ( L"w:hash" == wsName ) m_sHashValue = oReader.GetText();
|
||||
break;
|
||||
case 'r':
|
||||
if ( _T("w:recommended") == wsName ) m_oRecommended = oReader.GetText();
|
||||
if ( L"w:recommended" == wsName ) m_oRecommended = oReader.GetText();
|
||||
break;
|
||||
case 's':
|
||||
if ( _T("w:saltValue") == wsName ) m_sSaltValue = oReader.GetText();
|
||||
else if ( _T("w:spinCount") == wsName ) m_oSpinCount = oReader.GetText();
|
||||
if ( L"w:saltValue" == wsName ) m_sSaltValue = oReader.GetText();
|
||||
else if ( L"w:salt" == wsName ) m_sSaltValue = oReader.GetText();
|
||||
else if ( L"w:spinCount" == wsName ) m_oSpinCount = oReader.GetText();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( !oReader.MoveToNextAttribute() )
|
||||
@ -2161,14 +2169,14 @@ namespace OOX
|
||||
}
|
||||
|
||||
public:
|
||||
nullable<std::wstring> m_oCryptProviderType;
|
||||
nullable<std::wstring> m_oCryptAlgorithmType;
|
||||
nullable<std::wstring> m_oCryptAlgorithmClass;
|
||||
|
||||
// TO DO: Добавить атрибуты из 9.7.2.5 Part4
|
||||
|
||||
// Attributes
|
||||
nullable<SimpleTypes::CCryptAlgoritmName<>> m_oAlgorithmName;
|
||||
nullable<std::wstring> m_sHashValue;
|
||||
nullable<std::wstring> m_sHashValue;
|
||||
nullable<SimpleTypes::COnOff<>> m_oRecommended;
|
||||
nullable<std::wstring> m_sSaltValue;
|
||||
nullable<std::wstring> m_sSaltValue;
|
||||
nullable<SimpleTypes::CDecimalNumber<>> m_oSpinCount;
|
||||
};
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef _USE_NULLABLE_PROPERTY_
|
||||
using namespace NSCommon;
|
||||
@ -231,6 +232,8 @@ namespace XmlUtils
|
||||
double d = 0;
|
||||
#if defined (_WIN32) || defined (_WIN64)
|
||||
swscanf_s(string.c_str(), L"%lf", &d);
|
||||
#elif defined(_IOS) || defined(__ANDROID__)
|
||||
swscanf(string.c_str(), L"%lf", &d);
|
||||
#else
|
||||
_stscanf(string.c_str(), L"%lf", &d);
|
||||
#endif
|
||||
@ -243,6 +246,8 @@ namespace XmlUtils
|
||||
float f = 0;
|
||||
#if defined (_WIN32) || defined (_WIN64)
|
||||
swscanf_s(string.c_str(), L"%f", &f);
|
||||
#elif defined(_IOS) || defined(__ANDROID__)
|
||||
swscanf(string.c_str(), L"%f", &f);
|
||||
#else
|
||||
_stscanf(string.c_str(), L"%f", &f);
|
||||
#endif
|
||||
|
||||
@ -1221,7 +1221,7 @@ namespace OOX
|
||||
{
|
||||
writer.WriteString(L"<sheetProtection");
|
||||
WritingStringNullableAttrString(L"password", m_oPassword, m_oPassword.get());
|
||||
WritingStringNullableAttrString(L"algorithmName",m_oAlgorithmName, m_oAlgorithmName.get());
|
||||
WritingStringNullableAttrString(L"algorithmName",m_oAlgorithmName, m_oAlgorithmName->ToString());
|
||||
WritingStringNullableAttrString(L"hashValue", m_oHashValue, m_oHashValue.get());
|
||||
WritingStringNullableAttrString(L"saltValue", m_oSaltValue, m_oSaltValue.get());
|
||||
WritingStringNullableAttrInt(L"spinCount", m_oSpinCount, m_oSpinCount->GetValue());
|
||||
@ -1265,30 +1265,30 @@ namespace OOX
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("saltValue"), m_oSaltValue)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("spinCount"), m_oSpinCount)
|
||||
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoFilter"), m_oAutoFilter)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("content"), m_oContent)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("autoFilter"), m_oAutoFilter)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("content"), m_oContent)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("deleteColumns"), m_oDeleteColumns)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("deleteRows"), m_oDeleteRows)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("formatCells"), m_oFormatCells)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("deleteRows"), m_oDeleteRows)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("formatCells"), m_oFormatCells)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("formatColumns"), m_oFormatColumns)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("formatRows"), m_oFormatRows)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("formatRows"), m_oFormatRows)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("insertColumns"), m_oInsertColumns)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("insertHyperlinks"),m_oInsertHyperlinks)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("insertRows"), m_oInsertRows)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("objects"), m_oObjects)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("pivotTables"), m_oPivotTables)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("insertRows"), m_oInsertRows)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("objects"), m_oObjects)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("pivotTables"), m_oPivotTables)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("scenarios"), m_oScenarios)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("sheet"), m_oSelectLockedCells)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("sheet"), m_oSelectUnlockedCell)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("selectLockedCells"),m_oSelectLockedCells)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("selectUnlockedCell"),m_oSelectUnlockedCell)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("sheet"), m_oSheet)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("sort"), m_oSort)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
nullable_string m_oPassword;
|
||||
nullable_string m_oAlgorithmName;
|
||||
nullable<SimpleTypes::CCryptAlgoritmName<>> m_oAlgorithmName;
|
||||
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oSpinCount;
|
||||
nullable_string m_oHashValue;
|
||||
nullable_string m_oSaltValue;
|
||||
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oSpinCount;
|
||||
nullable_string m_oPassword; //for old wrike protection
|
||||
|
||||
nullable<SimpleTypes::COnOff<>> m_oAutoFilter;
|
||||
nullable<SimpleTypes::COnOff<>> m_oContent;
|
||||
|
||||
@ -53,9 +53,9 @@
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
#include "../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
|
||||
static const unsigned char encrVerifierHashInputBlockKey[8] = { 0xfe, 0xa7, 0xd2, 0x76, 0x3b, 0x4b, 0x9e, 0x79 };
|
||||
static const unsigned char encrVerifierHashValueBlockKey[8] = { 0xd7, 0xaa, 0x0f, 0x6d, 0x30, 0x61, 0x34, 0x4e };
|
||||
static const unsigned char encrKeyValueBlockKey[8] = { 0x14, 0x6e, 0x0b, 0xe7, 0xab, 0xac, 0xd0, 0xd6 };
|
||||
@ -810,7 +810,114 @@ void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*&
|
||||
DecryptCipher(hashKey, empty, pInp, pOut, cryptData.cipherAlgorithm);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
void odfWriteProtect::SetPassword (const std::wstring &password_)
|
||||
{
|
||||
password = password_;
|
||||
}
|
||||
void odfWriteProtect::SetProtectKey (const std::string &key)
|
||||
{
|
||||
protect_key = key;
|
||||
}
|
||||
void odfWriteProtect::SetProtectAlgorithm (const CRYPT_METHOD::_hashAlgorithm &alg)
|
||||
{
|
||||
hash = alg;
|
||||
}
|
||||
void odfWriteProtect::Generate()
|
||||
{
|
||||
_buf pPassword (password);
|
||||
_buf empty (NULL, 0, false);
|
||||
|
||||
_buf pHashTest = HashAppend(empty, pPassword, hash);
|
||||
|
||||
protect_key = std::string((char*)pHashTest.ptr, pHashTest.size);
|
||||
}
|
||||
bool odfWriteProtect::Verify()
|
||||
{
|
||||
_buf pPassword (password);
|
||||
_buf empty (NULL, 0, false);
|
||||
_buf pHash (protect_key);
|
||||
|
||||
_buf pHashTest = HashAppend(empty, pPassword, hash);
|
||||
|
||||
return (pHashTest == pHash);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
void ECMAWriteProtect::SetPassword (const std::wstring &password_)
|
||||
{
|
||||
password = password_;
|
||||
}
|
||||
void ECMAWriteProtect::SetCryptData(_ecmaWriteProtectData &_data)
|
||||
{
|
||||
data = _data;
|
||||
}
|
||||
void ECMAWriteProtect::GetCryptData(_ecmaWriteProtectData &_data)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
void ECMAWriteProtect::Generate()
|
||||
{
|
||||
//сгенерить соль
|
||||
RandomPool prng;
|
||||
SecByteBlock seed_salt(16);
|
||||
OS_GenerateRandomBlock(false, seed_salt, seed_salt.size());
|
||||
prng.IncorporateEntropy(seed_salt, seed_salt.size());
|
||||
|
||||
_buf pPassword (password);
|
||||
_buf empty (NULL, 0, false);
|
||||
_buf pSalt (seed_salt.data(), seed_salt.size());
|
||||
|
||||
_buf pHashBuf = HashAppend(pSalt, pPassword, data.hashAlgorithm);
|
||||
|
||||
for (int i = 0; i < data.spinCount; i++)
|
||||
{
|
||||
_buf iterator((unsigned char*)&i, 4, false);
|
||||
pHashBuf = HashAppend(pHashBuf, iterator, data.hashAlgorithm);
|
||||
}
|
||||
|
||||
data.saltValue = std::string((char*)pSalt.ptr, pSalt.size);
|
||||
data.hashValue = std::string((char*)pHashBuf.ptr, pHashBuf.size);
|
||||
}
|
||||
bool ECMAWriteProtect::VerifyWrike()
|
||||
{
|
||||
std::string p = std::string(password.begin(), password.end());
|
||||
|
||||
unsigned int wPasswordHash = 0;
|
||||
|
||||
const char* pch = p.c_str() + p.length();
|
||||
while (pch-- != p.c_str())
|
||||
{
|
||||
wPasswordHash = ((wPasswordHash >> 14) & 0x01) |
|
||||
((wPasswordHash << 1) & 0x7fff);
|
||||
wPasswordHash ^= *pch;
|
||||
}
|
||||
|
||||
wPasswordHash = ((wPasswordHash >> 14) & 0x01) |
|
||||
((wPasswordHash << 1) & 0x7fff);
|
||||
|
||||
wPasswordHash ^= (0x8000 | ('N' << 8) | 'K');
|
||||
wPasswordHash ^= p.length();
|
||||
|
||||
std::string sPasswordHash = XmlUtils::IntToString(wPasswordHash, "%4.4X");
|
||||
|
||||
return data.hashValue == sPasswordHash;
|
||||
}
|
||||
bool ECMAWriteProtect::Verify()
|
||||
{
|
||||
_buf pPassword (password);
|
||||
_buf empty (NULL, 0, false);
|
||||
_buf pSalt (data.saltValue);
|
||||
_buf pHash (data.hashValue);
|
||||
|
||||
_buf pHashTest = HashAppend(pSalt, pPassword, data.hashAlgorithm);
|
||||
|
||||
for (int i = 0; i < data.spinCount; i++)
|
||||
{
|
||||
_buf iterator((unsigned char*)&i, 4, false);
|
||||
pHashTest = HashAppend(pHashTest, iterator, data.hashAlgorithm);
|
||||
}
|
||||
return (pHashTest == pHash);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
ECMAEncryptor::ECMAEncryptor()
|
||||
{
|
||||
|
||||
@ -74,6 +74,13 @@ class Decryptor
|
||||
};
|
||||
typedef boost::shared_ptr<Decryptor> DecryptorPtr;
|
||||
|
||||
struct _ecmaWriteProtectData
|
||||
{
|
||||
CRYPT_METHOD::_hashAlgorithm hashAlgorithm = CRYPT_METHOD::SHA512;
|
||||
int spinCount = 100000;
|
||||
std::string saltValue;
|
||||
std::string hashValue;
|
||||
};
|
||||
struct _ecmaCryptData
|
||||
{
|
||||
//default ms2010
|
||||
@ -126,6 +133,44 @@ struct _odfCryptData
|
||||
CRYPT_METHOD::_hashAlgorithm checksum_hashAlgorithm = CRYPT_METHOD::SHA1;
|
||||
};
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class ECMAWriteProtect
|
||||
{
|
||||
public:
|
||||
ECMAWriteProtect(){}
|
||||
virtual ~ECMAWriteProtect(){}
|
||||
|
||||
void SetPassword (const std::wstring &password);
|
||||
|
||||
void SetCryptData(_ecmaWriteProtectData &data);
|
||||
void GetCryptData(_ecmaWriteProtectData &data);
|
||||
|
||||
void Generate();
|
||||
bool Verify();
|
||||
|
||||
bool VerifyWrike();
|
||||
private:
|
||||
std::wstring password;
|
||||
_ecmaWriteProtectData data;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class odfWriteProtect
|
||||
{
|
||||
public:
|
||||
odfWriteProtect() : hash(CRYPT_METHOD::SHA1) {}
|
||||
|
||||
void SetPassword (const std::wstring & password);
|
||||
void SetProtectKey (const std::string & protect_key);
|
||||
void SetProtectAlgorithm (const CRYPT_METHOD::_hashAlgorithm & hash);
|
||||
|
||||
void Generate();
|
||||
bool Verify();
|
||||
private:
|
||||
std::wstring password;
|
||||
CRYPT_METHOD::_hashAlgorithm hash;
|
||||
std::string protect_key;
|
||||
};
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class ECMAEncryptor
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user