Compare commits

...

5 Commits

Author SHA1 Message Date
9991195d56 . 2018-07-13 18:59:23 +03:00
51f579a682 [ios][pe] events 2018-07-13 18:23:28 +03:00
45e0459434 OdfFormatWriter - .. 2018-07-13 15:26:51 +03:00
2f194ebd97 . 2018-07-13 13:24:56 +03:00
5e4ce83dc1 Ignore -no-warrowing warning while building PdfWriter
Errors looks like:
`../Src/ICCProfile.h:52: error: narrowing conversion of '-72' from 'int'
to 'unsigned char' inside { } [-Wnarrowing]`
2018-07-13 13:05:13 +03:00
22 changed files with 410 additions and 180 deletions

View File

@ -369,42 +369,51 @@ void docx_conversion_context::start_index_content()
std::wstring sInstrText;
switch(table_content_context_.type_table_content)
if (table_content_context_.type_table_content == 3)
{
case 1: sInstrText += L" TOC \\f \\h \\u"; break;
case 2:
case 4:
case 6:
case 7: sInstrText += L" TOC \\h \\z"; break;
case 5: sInstrText += L" INDEX \\z"; break;
case 3: sInstrText += L" BIBLIOGRAPHY"; break;
sInstrText = L" BIBLIOGRAPHY ";
}
if (table_content_context_.min_outline_level > 0)
else if (table_content_context_.type_table_content == 5)
{
if (table_content_context_.max_outline_level > 9)
table_content_context_.max_outline_level = 9;
sInstrText += L" \\o \"" + std::to_wstring(table_content_context_.min_outline_level) + L"-" +
std::to_wstring(table_content_context_.max_outline_level) + L"\"";
sInstrText = L" INDEX";
if (table_content_context_.bSeparators)
sInstrText += L" \\h \"A\"";
}
if (false == table_content_context_.outline_level_styles.empty())
else
{
sInstrText += L"\\t \"";
sInstrText += L" TOC \\h";
for (std::map<int, std::wstring>::iterator it = table_content_context_.outline_level_styles.begin();
it != table_content_context_.outline_level_styles.end(); ++it)
if (table_content_context_.type_table_content == 1)
sInstrText += L" \\f \\u";
else
sInstrText += L" \\z";
if (table_content_context_.min_outline_level > 0)
{
sInstrText += it->second + L";" + std::to_wstring(it->first) + L";";
if (table_content_context_.max_outline_level > 9)
table_content_context_.max_outline_level = 9;
sInstrText += L" \\o \"" + std::to_wstring(table_content_context_.min_outline_level) + L"-" +
std::to_wstring(table_content_context_.max_outline_level) + L"\"";
}
if (false == table_content_context_.outline_level_styles.empty())
{
sInstrText += L" \\t \"";
for (std::map<int, std::wstring>::iterator it = table_content_context_.outline_level_styles.begin();
it != table_content_context_.outline_level_styles.end(); ++it)
{
sInstrText += it->second + L";" + std::to_wstring(it->first) + L";";
}
sInstrText += L"\"";
}
sInstrText += L"\"";
if (!table_content_context_.caption_sequence_name.empty())
{
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\"";
}
}
if (!table_content_context_.caption_sequence_name.empty())
{
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\"";
}
output_stream() << L"<w:r>";
output_stream() << L"<w:fldChar w:fldCharType=\"begin\"/>";
output_stream() << L"</w:r>";

View File

@ -731,6 +731,7 @@ public:
min_outline_level = -1;
max_outline_level = -1;
outline_level_styles.clear();
bSeparators = false;
}
void add_sequence(const std::wstring & name, int outline_level)
{
@ -755,6 +756,7 @@ public:
int min_outline_level;
int max_outline_level;
std::map<int, std::wstring> outline_level_styles;
bool bSeparators;
private:
std::vector<int> current_content_template_;

View File

@ -1278,7 +1278,7 @@ void sequence::docx_convert(oox::docx_conversion_context & Context)
}
}
Context.output_stream() << L"<w:fldSimple w:instr=\" SEQ " << sequence << L" \\* " << num_format << L" \">";
Context.output_stream() << L"<w:fldSimple w:instr=\" SEQ " << XmlUtils::EncodeXmlString(sequence) << L" \\* " << num_format << L" \">";
Context.add_new_run();
for (size_t i = 0; i < text_.size(); i++)
{
@ -1846,12 +1846,22 @@ void alphabetical_index_mark::add_attributes( const xml::attributes_wc_ptr & Att
}
void alphabetical_index_mark::docx_convert(oox::docx_conversion_context & Context)
{
if (!string_value_) return;
std::wstring value;
if (string_value_ && false == string_value_->empty())
{
if (*string_value_ != L" ")
value = *string_value_;
}
if (value.empty() && key1_)
{
value = *key1_;
}
if (value.empty()) return;
Context.finish_run();
Context.output_stream() << L"<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>";
Context.output_stream() << L"<w:r><w:instrText> XE \"" << *string_value_ << L"\"</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
Context.output_stream() << L"<w:r><w:instrText> XE \"" << XmlUtils::EncodeXmlString(value) << L"\"</w:instrText></w:r><w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
}
//-----------------------------------------------------------------------------------------------
// text:alphabetical-index-mark-start

View File

@ -1273,7 +1273,9 @@ const wchar_t * alphabetical_index_source::name = L"alphabetical-index-source";
void alphabetical_index_source::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:index-scope", index_scope_); // chapter or document
CP_APPLY_ATTR(L"text:index-scope", index_scope_); // chapter or document
CP_APPLY_ATTR(L"text:alphabetical-separators", alphabetical_separators_);
CP_APPLY_ATTR(L"text:ignore-case", ignore_case_);
}
void alphabetical_index_source::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -1286,6 +1288,11 @@ void alphabetical_index_source::add_child_element( xml::sax * Reader, const std:
}
void alphabetical_index_source::docx_convert(oox::docx_conversion_context & Context)
{
if (alphabetical_separators_)
{
Context.get_table_content_context().bSeparators = alphabetical_separators_->get();
}
Context.get_table_content_context().start_template(5);
for (size_t i = 0; i < entry_templates_.size(); i++)
{

View File

@ -1283,7 +1283,9 @@ 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) index_scope_; // chapter or document:
_CP_OPT(std::wstring) index_scope_; // chapter or document:
_CP_OPT(odf_types::Bool) alphabetical_separators_;
_CP_OPT(odf_types::Bool) ignore_case_;
//fo:country
//fo:language
@ -1295,7 +1297,6 @@ private:
//text:combine-entries-with-dash
//text:combine-entries-with-pp
//text:comma-separated
//text:ignore-case
//text:main-entry-style-name
//text:relative-tab-stop-position
//text:sort-algorithm

View File

@ -284,8 +284,8 @@ private:
class Impl;
_CP_PTR(Impl) impl_;
};
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
}
}

View File

@ -469,7 +469,7 @@ bool odf_text_context::start_field(int type)
if (single_paragraph_ == true) return false;
office_element_ptr elm;
if (type == 2)
if (type == fieldPage)
{
create_element(L"text", L"page-number", elm, odf_context_);
text_page_number *page_numb = dynamic_cast<text_page_number*>(elm.get());
@ -486,11 +486,11 @@ bool odf_text_context::start_field(int type)
}
}
}
if (type == 3)
if (type == fieldNumPages)
{
create_element(L"text", L"page-count", elm, odf_context_);
}
if (type == 4)
if (type == fieldTime)
{
create_element(L"text", L"date", elm, odf_context_);
}

View File

@ -43,7 +43,22 @@
namespace cpdoccore {
namespace odf_writer
{
enum _typeField
{
fieldUnknown = 0,
fieldHyperlink,
fieldPage,
fieldNumPages,
fieldTime,
fieldPageRef,
fieldSeq,
fieldBibliography = 0xff + 1,
fieldIndex,
fieldIllustration,
fieldTable,
fieldToc
};
class odf_conversion_context;
class odf_style_context;
class paragraph;
@ -139,6 +154,7 @@ private:
std::wstring parent_span_style_;
std::wstring parent_paragraph_style_;
};
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
}
}

View File

@ -37,7 +37,6 @@
#include "../utils.h"
#include "odt_conversion_context.h"
#include "odf_text_context.h"
#include "styles.h"
@ -114,6 +113,27 @@ void odt_conversion_context::start_document()
void odt_conversion_context::end_document()
{
if (false == mapSequenceDecls.empty())
{
office_element_ptr seq_decls;
create_element(L"text", L"sequence-decls", seq_decls, this);
for (std::map<std::wstring, int>::iterator it = mapSequenceDecls.begin(); it != mapSequenceDecls.end(); ++it)
{
office_element_ptr elm;
create_element(L"text", L"sequence-decl", elm, this);
text_sequence_decl* decl = dynamic_cast<text_sequence_decl*>(elm.get());
if (decl)
{
decl->name_ = it->first;
decl->display_outline_level_ = 0;
}
seq_decls->add_child_element(elm);
}
root_document_->add_child_element(seq_decls);
}
//add sections to root
for (size_t i = 0; i < sections_.size(); i++)
{
@ -289,11 +309,11 @@ void odt_conversion_context::start_paragraph(bool styled)
//if (!current_fields.empty() && !current_fields.back().result) return; //Стандартное_составное_письмо.docx
switch (current_fields.back().type)
{
case 6: start_bibliography(); break;
case 7: start_alphabetical_index(); break;
case 8: start_illustration_index(); break;
case 9: start_table_index(); break;
case 10:start_table_of_content(); break;
case fieldBibliography: start_bibliography(); break;
case fieldIndex: start_alphabetical_index(); break;
case fieldIllustration: start_illustration_index(); break;
case fieldTable: start_table_index(); break;
case fieldToc: start_table_of_content(); break;
}
}
if (is_paragraph_in_current_section_ && !styled)
@ -522,9 +542,6 @@ void odt_conversion_context::start_hyperlink(std::wstring ref)
hyperlink->common_xlink_attlist_.href_ = ref;
hyperlink->common_xlink_attlist_.type_ = xlink_type::Simple;
//current_level_.back()->add_child_element(hyperlink_elm);
//current_level_.push_back(hyperlink_elm);
text_context()->start_element(hyperlink_elm);
is_hyperlink_ = true;
@ -538,7 +555,37 @@ void odt_conversion_context::end_hyperlink()
is_hyperlink_ = false; //метка .. для гиперлинков в объектах - там не будет span
}
void odt_conversion_context::start_sequence()
{
std::map<std::wstring, int>::iterator pFind = mapSequenceDecls.find(current_fields.back().value);
int index = 0;
if (pFind == mapSequenceDecls.end())
{
mapSequenceDecls.insert(std::make_pair(current_fields.back().value, index));
}
else
{
index = ++pFind->second;
}
office_element_ptr seq_elm;
create_element(L"text", L"sequence", seq_elm, this);
text_sequence* sequence = dynamic_cast<text_sequence*>(seq_elm.get());
if (sequence)
{
sequence->name_ = current_fields.back().value;
sequence->ref_name_ = L"ref" + current_fields.back().value + std::to_wstring(index);
sequence->formula_ = L"ooow:" + current_fields.back().value + L"+1";
sequence->style_num_format_ = style_numformat(style_numformat::arabic);
text_context()->start_element(seq_elm);
}
}
void odt_conversion_context::end_sequence()
{
text_context()->end_element();
}
std::map<std::wstring, std::wstring> odt_conversion_context::parse_instr_options(const std::wstring& value)
{
std::map<std::wstring, std::wstring> result;
@ -552,12 +599,20 @@ std::map<std::wstring, std::wstring> odt_conversion_context::parse_instr_options
std::wstring value;
if (arOptions[i].length() > 2)
{
value = arOptions[i].substr(2);
boost::algorithm::trim(value);
if (value[0] == L'\"')
size_t pos = arOptions[i].find(L"\"");
if (std::wstring::npos != pos)
{
value = value.substr(1, value.length() - 2);
value = arOptions[i].substr(pos + 1, arOptions[i].length() - pos - 1);
pos = value.rfind(L"\"");
if (std::wstring::npos != pos)
{
value = value.substr(0, pos);
}
}
else
{
value = arOptions[i].substr(1);
}
}
result.insert(std::make_pair(key, value));
@ -576,7 +631,7 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
size_t res1 = instr.find(L"HYPERLINK");
if (std::wstring::npos != res1)
{
current_fields.back().type = 1;
current_fields.back().type = fieldHyperlink;
current_fields.back().in_span = false;
std::wstring ref;
@ -592,41 +647,59 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
res1 = instr.find(L"NUMPAGES");
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_fields.back().type = 3;
current_fields.back().type = fieldNumPages;
}
res1 = instr.find(L"PAGEREF");
if (std::wstring::npos != res1 && current_fields.back().type == 0 )
{
current_fields.back().type = 5;
current_fields.back().type = fieldPageRef;
if (instr.length() > 9)
current_fields.back().value = instr.substr(9, instr.length() - 5);
}
res1 = instr.find(L"PAGE");
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_fields.back().type = 2;
current_fields.back().type = fieldPage;
}
res1 = instr.find(L"TIME");
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_fields.back().type = 4;
current_fields.back().type = fieldTime;
}
res1 = instr.find(L"SEQ");
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_fields.back().type = fieldSeq;
std::map<std::wstring, std::wstring> options = parse_instr_options(instr.substr(4));
for (std::map<std::wstring, std::wstring>::iterator it = options.begin(); it != options.end(); ++it)
{
if (it->first == L" ")
{
current_fields.back().value = it->second.substr(0, it->second.length() - 1);
}
else if (it->first == L"*")
{
current_fields.back().format = it->second.substr(0, it->second.length() - 1);
}
}
}
res1 = instr.find(L"BIBLIOGRAPHY");
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_fields.back().type = 6;
current_fields.back().type = fieldBibliography;
current_fields.back().in_span = false;
}
res1 = instr.find(L"INDEX");
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_fields.back().type = 7;
current_fields.back().type = fieldIndex;
current_fields.back().in_span = false;
}
res1 = instr.find(L"TOC");
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_fields.back().type = 8;
current_fields.back().type = fieldIllustration;
current_fields.back().in_span = false;
std::map<std::wstring, std::wstring> options = parse_instr_options(instr.substr(res1 + 3));
@ -643,7 +716,7 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
pFind = options.find(L"u"); //paragraph outline level
if ( pFind != options.end())
{
current_fields.back().type = 10; //table of content
current_fields.back().type = fieldToc; //table of content
}
pFind = options.find(L"o");
if ( pFind != options.end())//table of content outline levels style
@ -652,7 +725,7 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
boost::algorithm::split(arLevels, pFind->second, boost::algorithm::is_any_of(L"-"), boost::algorithm::token_compress_on);
if (arLevels.size() > 1)
{
current_fields.back().type = 10;
current_fields.back().type = fieldToc;
current_fields.back().outline_levels = XmlUtils::GetInteger(arLevels[1]);
}
}
@ -848,9 +921,10 @@ void odt_conversion_context::end_field()
{
current_fields.back().status = 3;//prepare for delete
if (current_fields.back().type < 6)
if (current_fields.back().type < 0xff)
{
if (current_fields.back().type == 1) end_hyperlink();
if (current_fields.back().type == fieldHyperlink) end_hyperlink();
else if (current_fields.back().type == fieldSeq) end_sequence();
else text_context()->end_field();
current_fields.pop_back();
@ -866,11 +940,11 @@ void odt_conversion_context::end_paragraph()
{
switch(current_fields.back().type)
{
case 6: end_bibliography(); break;
case 7: end_alphabetical_index(); break;
case 8: end_illustration_index(); break;
case 9: end_table_index(); break;
case 10: end_table_of_content(); break;
case fieldBibliography: end_bibliography(); break;
case fieldIndex: end_alphabetical_index(); break;
case fieldIllustration: end_illustration_index(); break;
case fieldTable: end_table_index(); break;
case fieldToc: end_table_of_content(); break;
}
current_fields.pop_back();
}
@ -974,12 +1048,13 @@ void odt_conversion_context::start_run(bool styled)
{
if (is_hyperlink_ && text_context_.size() > 0) return;
if (!current_fields.empty() && current_fields.back().status == 1 && !current_fields.back().in_span && current_fields.back().type < 6)
if (!current_fields.empty() && current_fields.back().status == 1 && !current_fields.back().in_span && current_fields.back().type < 0xff)
{
current_fields.back().status = 2;
if (current_fields.back().type == 1) start_hyperlink(current_fields.back().value);
else text_context()->start_field(current_fields.back().type);
if (current_fields.back().type == fieldHyperlink) start_hyperlink(current_fields.back().value);
else if (current_fields.back().type == fieldSeq) start_sequence();
else text_context()->start_field(current_fields.back().type);
}
text_context()->start_span(styled);

View File

@ -36,17 +36,14 @@
#include "odf_comment_context.h"
#include "odf_notes_context.h"
#include "odf_table_context.h"
#include "odf_text_context.h"
namespace cpdoccore {
namespace odf_writer {
namespace cpdoccore
{
namespace odf_writer
{
class office_text;
class odf_text_context;
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
struct odt_section_state
{
office_element_ptr elm;
@ -93,6 +90,9 @@ public:
void start_hyperlink (std::wstring ref);
void end_hyperlink ();
void start_sequence ();
void end_sequence ();
void start_table_of_content ();
void end_table_of_content ();
@ -201,11 +201,13 @@ private:
std::vector<odf_element_state> current_root_elements_; // for section, if needed
std::vector<odt_section_state> sections_;
std::map<std::wstring, int> mapSequenceDecls;
void add_to_root();
struct _field_state
{
int type = 0;
_typeField type = fieldUnknown;
std::wstring name;
std::wstring value;

View File

@ -89,14 +89,34 @@ void office_text_attlist::serialize(CP_ATTR_NODE)
}
void office_text::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
if (is_text_content(Ns, Name))
{
CP_CREATE_ELEMENT(content_);
}
if CP_CHECK_NAME(L"office", L"forms")
{
CP_CREATE_ELEMENT(forms_);
}
else if CP_CHECK_NAME(L"text", L"tracked-changes")
{
CP_CREATE_ELEMENT(tracked_changes_);
}
else if CP_CHECK_NAME(L"table", L"content-validations")
{
CP_CREATE_ELEMENT(table_content_validations_);
}
else if CP_CHECK_NAME(L"text", L"user-field-decls")
{
CP_CREATE_ELEMENT(user_fields_);
}
else if CP_CHECK_NAME(L"text", L"sequence-decls")
{
CP_CREATE_ELEMENT(sequences_);
}
else if CP_CHECK_NAME(L"text", L"variable-decls")
{
CP_CREATE_ELEMENT(variables_);
}
else if (is_text_content(Ns, Name))
{
CP_CREATE_ELEMENT(content_);
}
else
CP_NOT_APPLICABLE_ELM();
}
@ -107,6 +127,10 @@ void office_text::add_child_element( const office_element_ptr & child_element)
switch(child_element->get_type())
{
case typeTextSequenceDecls:
{
sequences_ = child_element;
}break;
case typeTextTrackedChanges:
{
tracked_changes_ = child_element;
@ -130,6 +154,9 @@ void office_text::serialize(std::wostream & _Wostream)
{
office_text_attlist_.serialize(CP_GET_XML_NODE());
if (sequences_)
sequences_->serialize(CP_XML_STREAM());
if (tracked_changes_)
tracked_changes_->serialize(CP_XML_STREAM());

View File

@ -71,7 +71,13 @@ public:
private:
office_element_ptr tracked_changes_;
office_element_ptr_array content_;
office_element_ptr table_content_validations_;
office_element_ptr user_fields_;
office_element_ptr variables_;
office_element_ptr sequences_;
office_element_ptr forms_;
office_element_ptr_array content_;
// TODO: office-text-content-prelude:
// TODO: office-forms

View File

@ -71,6 +71,13 @@ using xml::xml_char_wc;
const wchar_t * text_text::ns = L"";
const wchar_t * text_text::name = L"";
std::wostream & text_text::text_to_stream(std::wostream & _Wostream) const
{
_Wostream << xml::utils::replace_text_to_xml( text_ );
return _Wostream;
}
void text_text::serialize(std::wostream & _Wostream)
{
_Wostream << xml::utils::replace_text_to_xml( text_ );
@ -236,6 +243,14 @@ void text_reference_mark_end::serialize(std::wostream & _Wostream)
const wchar_t * text_span::ns = L"text";
const wchar_t * text_span::name = L"span";
std::wostream & text_span::text_to_stream(std::wostream & _Wostream) const
{
for (size_t i = 0; i < paragraph_content_.size(); i++)
{
paragraph_content_[i]->text_to_stream(_Wostream);
}
return _Wostream;
}
void text_span::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
@ -772,9 +787,15 @@ void text_sequence::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"text:name", name_);
CP_XML_ATTR_OPT(L"text:ref-name", ref_name_);
CP_XML_ATTR_OPT(L"style:num-format", style_num_format_);
CP_XML_ATTR_OPT(L"style:num-letter-syn", style_num_letter_sync_);
CP_XML_ATTR_OPT(L"text:formula", formula_);
for (size_t i = 0; i < text_.size(); i++)
{
text_[i]->serialize(CP_XML_STREAM());
text_[i]->text_to_stream(CP_XML_STREAM());
}
}
}

View File

@ -65,7 +65,8 @@ public:
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);
std::wostream & text_to_stream(std::wostream & _Wostream) const;
virtual void serialize(std::wostream & _Wostream);
text_text(const std::wstring & Text) : text_(Text) {}
text_text() {}
@ -316,6 +317,7 @@ public:
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
std::wostream & text_to_stream(std::wostream & _Wostream) const;
text_span() {}
@ -678,7 +680,14 @@ public:
virtual void serialize(std::wostream & _Wostream);
virtual void add_text(const std::wstring & Text);
office_element_ptr_array text_;
_CP_OPT(odf_types::style_numformat) style_num_format_;
_CP_OPT(std::wstring) style_num_letter_sync_;
_CP_OPT(std::wstring) formula_;
_CP_OPT(std::wstring) name_;
_CP_OPT(std::wstring) ref_name_;
_CP_OPT(std::wstring) template_;
office_element_ptr_array text_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_sequence);

View File

@ -1255,5 +1255,46 @@ void text_index_entry_text::serialize(std::wostream & _Wostream)
CP_XML_NODE_SIMPLE();
}
}
//----------------------------------------------------------------------------------------------------------
const wchar_t * text_sequence_decl::ns = L"text";
const wchar_t * text_sequence_decl::name = L"sequence-decl";
void text_sequence_decl::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"text:name", name_);
CP_XML_ATTR_OPT(L"text:separation-character", separation_character_);
CP_XML_ATTR_OPT(L"text:display-outline-level", display_outline_level_);
}
}
}
//----------------------------------------------------------------------------------------------------------
const wchar_t * text_sequence_decls::ns = L"text";
const wchar_t * text_sequence_decls::name = L"sequence-decls";
void text_sequence_decls::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void text_sequence_decls::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void text_sequence_decls::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (size_t i = 0 ; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
}

View File

@ -678,48 +678,48 @@ public:
_CP_OPT(std::wstring) content_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_index_title_template);
////---------------------------------------------------------------------------------------------------
////text:sequence-decl
////---------------------------------------------------------------------------------------------------
//class text_sequence_decl : public office_element_impl<text_sequence_decl>
//{
//public:
// static const wchar_t * ns;
// static const wchar_t * name;
// static const xml::NodeType xml_type = xml::typeElement;
// static const ElementType type = typeTextSequenceDecl;
// CPDOCCORE_DEFINE_VISITABLE()
//
// 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);
//
// _CP_OPT(std::wstring) separation_character_; //one char
// _CP_OPT(unsigned int) display_outline_level_;
// _CP_OPT(std::wstring) name_;
//};
//CP_REGISTER_OFFICE_ELEMENT2(text_sequence_decl);
////---------------------------------------------------------------------------------------------------
////text:sequence-decls
////---------------------------------------------------------------------------------------------------
//class text_sequence_decls : public office_element_impl<text_sequence_decls>
//{
//public:
// static const wchar_t * ns;
// static const wchar_t * name;
// static const xml::NodeType xml_type = xml::typeElement;
// static const ElementType type = typeTextSequenceDecls;
// CPDOCCORE_DEFINE_VISITABLE()
//
// 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);
//
// office_element_ptr_array content_;
//};
//CP_REGISTER_OFFICE_ELEMENT2(text_sequence_decls);
//---------------------------------------------------------------------------------------------------
//text:sequence-decl
//---------------------------------------------------------------------------------------------------
class text_sequence_decl : public office_element_impl<text_sequence_decl>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextSequenceDecl;
CPDOCCORE_DEFINE_VISITABLE()
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);
_CP_OPT(std::wstring) separation_character_; //one char
_CP_OPT(unsigned int) display_outline_level_;
_CP_OPT(std::wstring) name_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_sequence_decl);
//---------------------------------------------------------------------------------------------------
//text:sequence-decls
//---------------------------------------------------------------------------------------------------
class text_sequence_decls : public office_element_impl<text_sequence_decls>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextSequenceDecls;
CPDOCCORE_DEFINE_VISITABLE()
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);
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_sequence_decls);
//---------------------------------------------------------------------------------------------------
//text:table-of-content-source
//---------------------------------------------------------------------------------------------------

View File

@ -623,9 +623,9 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
for (std::vector<OOX::WritingElement*>::iterator it = oox_shape->oTextBoxShape->m_arrItems.begin(); it != oox_shape->oTextBoxShape->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_shape->oTextBoxShape->m_arrItems.size(); i++)
{
docx_converter->convert(*it);
docx_converter->convert(oox_shape->oTextBoxShape->m_arrItems[i]);
convert(oox_shape->oTextBoxBodyPr.GetPointer());

View File

@ -412,9 +412,9 @@ void DocxConverter::convert(OOX::Logic::CSdtContent *oox_sdt)
{
if (oox_sdt == NULL) return;
for (std::vector<OOX::WritingElement*>::iterator it = oox_sdt->m_arrItems.begin(); it != oox_sdt->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_sdt->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_sdt->m_arrItems[i]);
}
}
void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
@ -607,9 +607,9 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
{//rapcomnat12.docx - стр 185
bool empty_para = true;
for (std::vector<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_paragraph->m_arrItems.size(); ++i)
{
switch((*it)->getType())
switch(oox_paragraph->m_arrItems[i]->getType())
{
case OOX::et_w_pPr: break;
default:
@ -631,17 +631,17 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
}
//---------------------------------------------------------------------------------------------------------------------
for (std::vector<OOX::WritingElement*>::iterator it = oox_paragraph->m_arrItems.begin(); it != oox_paragraph->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_paragraph->m_arrItems.size(); ++i)
{
//те элементы которые тока для Paragraph - здесь - остальные в общей куче
switch((*it)->getType())
switch(oox_paragraph->m_arrItems[i]->getType())
{
case OOX::et_w_pPr:
{
// пропускаем ..
}break;
default:
convert(*it);
convert(oox_paragraph->m_arrItems[i]);
break;
}
}
@ -691,24 +691,24 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
odt_context->start_run(styled);
for (std::vector<OOX::WritingElement*>::iterator it = oox_run->m_arrItems.begin(); it != oox_run->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_run->m_arrItems.size(); ++i)
{
//те элементы которые тока для Run - здесь - остальные в общей куче
switch((*it)->getType())
switch(oox_run->m_arrItems[i]->getType())
{
case OOX::et_w_fldChar:
{
OOX::Logic::CFldChar* pFldChar= dynamic_cast<OOX::Logic::CFldChar*>(*it);
OOX::Logic::CFldChar* pFldChar= dynamic_cast<OOX::Logic::CFldChar*>(oox_run->m_arrItems[i]);
convert(pFldChar);
}break;
case OOX::et_w_instrText:
{
OOX::Logic::CInstrText* pInstrText= dynamic_cast<OOX::Logic::CInstrText*>(*it);
OOX::Logic::CInstrText* pInstrText= dynamic_cast<OOX::Logic::CInstrText*>(oox_run->m_arrItems[i]);
convert(pInstrText);
}break;
case OOX::et_w_delText:
{
OOX::Logic::CDelText* pDelText= dynamic_cast<OOX::Logic::CDelText*>(*it);
OOX::Logic::CDelText* pDelText= dynamic_cast<OOX::Logic::CDelText*>(oox_run->m_arrItems[i]);
convert(pDelText);
}break;
case OOX::et_w_rPr: // пропускаем ..
@ -719,7 +719,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
}break;
case OOX::et_w_br:
{
OOX::Logic::CBr* pBr= dynamic_cast<OOX::Logic::CBr*>(*it);
OOX::Logic::CBr* pBr= dynamic_cast<OOX::Logic::CBr*>(oox_run->m_arrItems[i]);
if (pBr)
{
int type = pBr->m_oType.GetValue();
@ -732,17 +732,17 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
}break;
case OOX::et_w_t:
{
OOX::Logic::CText* pText= dynamic_cast<OOX::Logic::CText*>(*it);
OOX::Logic::CText* pText= dynamic_cast<OOX::Logic::CText*>(oox_run->m_arrItems[i]);
convert(pText);
}break;
case OOX::et_w_sym:
{
OOX::Logic::CSym* pSym= dynamic_cast<OOX::Logic::CSym*>(*it);
OOX::Logic::CSym* pSym= dynamic_cast<OOX::Logic::CSym*>(oox_run->m_arrItems[i]);
convert(pSym);
}break;
case OOX::et_w_tab:
{
OOX::Logic::CTab* pTab= dynamic_cast<OOX::Logic::CTab*>(*it);
OOX::Logic::CTab* pTab= dynamic_cast<OOX::Logic::CTab*>(oox_run->m_arrItems[i]);
odt_context->text_context()->add_tab();
}break;
@ -759,7 +759,7 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87
//softHyphen
//delInstrText
default:
convert(*it);
convert(oox_run->m_arrItems[i]);
}
}
odt_context->end_run();
@ -898,9 +898,9 @@ void DocxConverter::convert(OOX::Logic::CIns *oox_ins)
bool start_change = odt_context->start_change(id, 1, author, userId, date);
for (std::vector<OOX::WritingElement*>::iterator it = oox_ins->m_arrItems.begin(); it != oox_ins->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_ins->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_ins->m_arrItems[i]);
}
if (start_change)
@ -1103,9 +1103,9 @@ void DocxConverter::convert(OOX::Logic::CDel *oox_del)
bool res_change = odt_context->start_change(id, 2, author, userId, date);
for (std::vector<OOX::WritingElement*>::iterator it = oox_del->m_arrItems.begin(); it != oox_del->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_del->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_del->m_arrItems[i]);
}
if (res_change)
odt_context->end_change(id, 2);
@ -1114,9 +1114,9 @@ void DocxConverter::convert(OOX::Logic::CSmartTag *oox_tag)
{
if (oox_tag == NULL) return;
for (std::vector<OOX::WritingElement*>::iterator it = oox_tag->m_arrItems.begin(); it != oox_tag->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_tag->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_tag->m_arrItems[i]);
}
}
void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties)
@ -3051,17 +3051,17 @@ void DocxConverter::convert(OOX::Logic::CHyperlink *oox_hyperlink)
{
odt_context->start_hyperlink(ref);
for (std::vector<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_hyperlink->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_hyperlink->m_arrItems[i]);
}
odt_context->end_hyperlink();
}
else
{
for (std::vector<OOX::WritingElement*>::iterator it = oox_hyperlink->m_arrItems.begin(); it != oox_hyperlink->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_hyperlink->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_hyperlink->m_arrItems[i]);
}
}
//nullable<std::wstring > m_sDocLocation;
@ -3613,9 +3613,9 @@ void DocxConverter::convert_comment(int oox_comm_id)
if (oox_comment->m_oDate.IsInit()) odt_context->comment_context()->set_date (oox_comment->m_oDate->GetValue());
if (oox_comment->m_oInitials.IsInit()) {}
for (std::vector<OOX::WritingElement*>::iterator it = oox_comment->m_arrItems.begin(); it != oox_comment->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_comment->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_comment->m_arrItems[i]);
}
}
odt_context->end_comment_content();
@ -3638,9 +3638,9 @@ void DocxConverter::convert_footnote(int oox_ref_id)
{
odt_context->start_note_content();
{
for (std::vector<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_note->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_note->m_arrItems[i]);
}
}
odt_context->end_note_content();
@ -3665,9 +3665,9 @@ void DocxConverter::convert_endnote(int oox_ref_id)
{
odt_context->start_note_content();
{
for (std::vector<OOX::WritingElement*>::iterator it = oox_note->m_arrItems.begin(); it != oox_note->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_note->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_note->m_arrItems[i]);
}
}
odt_context->end_note_content();
@ -3682,9 +3682,9 @@ void DocxConverter::convert_hdr_ftr (std::wstring sId)
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(oox_hdr_ftr);
for (std::vector<OOX::WritingElement*>::iterator it = oox_hdr_ftr->m_arrItems.begin(); it != oox_hdr_ftr->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_hdr_ftr->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_hdr_ftr->m_arrItems[i]);
}
oox_current_child_document = NULL;
}
@ -3861,16 +3861,16 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
convert(oox_table->m_oTblGrid.GetPointer());
//------ строки
for (std::vector<OOX::WritingElement*>::iterator it = oox_table->m_arrItems.begin(); it != oox_table->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_table->m_arrItems.size(); ++i)
{
switch((*it)->getType())
switch(oox_table->m_arrItems[i]->getType())
{
case OOX::et_w_tblPr:
{
//skip
}break;
default:
convert(*it);
convert(oox_table->m_arrItems[i]);
}
}
if (in_frame)
@ -3977,16 +3977,16 @@ void DocxConverter::convert(OOX::Logic::CTr *oox_table_row)
convert(oox_table_row->m_pTableRowProperties);
for (std::vector<OOX::WritingElement*>::iterator it = oox_table_row->m_arrItems.begin(); it != oox_table_row->m_arrItems.end(); ++it)
for (size_t i =0; i < oox_table_row->m_arrItems.size(); ++i)
{
switch((*it)->getType())
switch(oox_table_row->m_arrItems[i]->getType())
{
case OOX::et_w_trPr:
{
//skip
}break;
default:
convert(*it);
convert(oox_table_row->m_arrItems[i]);
}
}
odt_context->end_table_row();
@ -4037,16 +4037,16 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
odt_context->table_context()->set_cell_column_span(oox_table_cell->m_pTableCellProperties->m_oGridSpan->m_oVal->GetValue());
}
for (std::vector<OOX::WritingElement*>::iterator it = oox_table_cell->m_arrItems.begin(); it != oox_table_cell->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_table_cell->m_arrItems.size(); ++i)
{
switch((*it)->getType())
switch(oox_table_cell->m_arrItems[i]->getType())
{
case OOX::et_w_tcPr:
{
//skip
}break;
default:
convert(*it);
convert(oox_table_cell->m_arrItems[i]);
}
}
odt_context->end_table_cell();

View File

@ -266,10 +266,10 @@ std::wstring COfficeFileFormatChecker::getDocumentID (const std::wstring & _file
{
NSFile::CFileBinary file;
if (!file.OpenFile(fileName))
return false;
return documentID;
unsigned char* buffer = new unsigned char[4096]; //enaf !!
if (!buffer){file.CloseFile();return false;}
if (!buffer){file.CloseFile();return documentID;}
DWORD dwReadBytes = 0;
file.ReadFile(buffer, MIN_SIZE_BUFFER, dwReadBytes);

View File

@ -1041,7 +1041,7 @@ namespace NSEditorApi
js_wrapper<bool> m_bLockLayout;
js_wrapper<bool> m_bLockRemove;
js_wrapper<bool> m_bLockTiming;
js_wrapper<bool> m_bLockTranzition;
js_wrapper<bool> m_bLockTransition;
public:
CAscSlideProp()
@ -1060,7 +1060,7 @@ namespace NSEditorApi
LINK_PROPERTY_BOOL_JS(LockLayout)
LINK_PROPERTY_BOOL_JS(LockRemove)
LINK_PROPERTY_BOOL_JS(LockTiming)
LINK_PROPERTY_BOOL_JS(LockTranzition)
LINK_PROPERTY_BOOL_JS(LockTransition)
};

View File

@ -689,7 +689,7 @@
#define ASC_MENU_EVENT_TYPE_TABLESPLITCELLS 16
#define ASC_MENU_EVENT_TYPE_SECTION 17
#define ASC_MENU_EVENT_TYPE_SHAPE 18
#define ASC_MENU_EVENT_TYPE_SLIDE 19
#define ASC_MENU_EVENT_TYPE_SLIDE 20
// insert commands
#define ASC_MENU_EVENT_TYPE_INSERT_IMAGE 50

View File

@ -22,6 +22,10 @@ LIBS += -lCryptoPPLib
DEFINES += NOMINMAX
core_linux {
QMAKE_CXXFLAGS += -Wno-narrowing
}
core_windows {
DEFINES -= UNICODE
DEFINES -= _UNICODE