Compare commits

...

8 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
50d4f451b9 . 2018-07-12 20:46:00 +03:00
d464aa659a OdfFormat - .. 2018-07-12 19:37:33 +03:00
db2d001110 Fix possible typo
`realink -n` return empty string
Introduced in
51569b626f
Seems have nothing to do with mac, since all other file has `readlink
-f`
2018-07-12 18:24:22 +03:00
23 changed files with 693 additions and 261 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

@ -693,7 +693,8 @@ public:
{
current_content_template_.clear();
}
current_content_template_ = pFind->second.content;
else
current_content_template_ = pFind->second.content;
current_content_template_index_ = 0;
}
@ -730,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)
{
@ -754,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++)
{
@ -283,16 +303,17 @@ void odt_conversion_context::end_drawings()
}
void odt_conversion_context::start_paragraph(bool styled)
{
if (!current_fields.empty() && current_fields.back().started == false && !current_fields.back().in_span)
if (!current_fields.empty() && current_fields.back().status == 1 && !current_fields.back().in_span)
{
current_fields.back().status = 2;
//if (!current_fields.empty() && !current_fields.back().result) return; //Стандартное_составное_письмо.docx
switch (current_fields.back().type)
{
case 6: current_fields.back().started = start_bibliography(); break;
case 7: current_fields.back().started = start_alphabetical_index(); break;
case 8: //current_fields.back().started = start_table_index(); break;
case 9: current_fields.back().started = start_illustration_index(); break;
case 10:current_fields.back().started = 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)
@ -352,56 +373,100 @@ void odt_conversion_context::add_paragraph_break(int type)
//}
}
}
bool odt_conversion_context::start_table_of_content()
void odt_conversion_context::start_table_of_content()
{
office_element_ptr elm1, elm2;
office_element_ptr elm;
create_element(L"text", L"table-of-content", elm1, this);
text_context()->start_element(elm1);
create_element(L"text", L"table-of-content", elm, this);
text_context()->start_element(elm);
add_to_root();
start_index_field();
}
void odt_conversion_context::end_table_of_content()
{
text_context()->end_element();
office_element_ptr elm;
create_element(L"text", L"table-of-content-source", elm, this);
text_table_of_content_source* source = dynamic_cast<text_table_of_content_source*>(elm.get());
if (source)
{
if (false == current_fields.back().arStyleLevels.empty())
{
source->outline_level_ = (int) current_fields.back().arStyleLevels.size();
source->use_index_source_styles_ = true;
}
else if (current_fields.back().outline_levels > 0)
{
source->outline_level_ = current_fields.back().outline_levels;
}
}
text_context()->start_element(elm);
//template
text_context()->end_element();
text_context()->end_element();
}
void odt_conversion_context::start_alphabetical_index()
{
office_element_ptr elm;
create_element(L"text", L"alphabetical-index", elm, this);
text_context()->start_element(elm);
add_to_root();
create_element(L"text", L"table-of-content-source", elm2, this);
text_context()->start_element(elm2);
text_context()->end_element();
start_index_field();
return true;
}
bool odt_conversion_context::start_alphabetical_index()
void odt_conversion_context::end_alphabetical_index()
{
office_element_ptr elm1, elm2;
create_element(L"text", L"alphabetical-index", elm1, this);
text_context()->start_element(elm1);
add_to_root();
create_element(L"text", L"alphabetical-index-source", elm2, this);
text_context()->start_element(elm2);
text_context()->end_element();
start_index_field();
return true;
}
bool odt_conversion_context::start_illustration_index()
office_element_ptr elm;
create_element(L"text", L"alphabetical-index-source", elm, this);
text_context()->start_element(elm);
//tempalte
text_context()->end_element();
text_context()->end_element();
}
void odt_conversion_context::start_illustration_index()
{
office_element_ptr elm1, elm2;
create_element(L"text", L"illustration-index", elm1, this);
text_context()->start_element(elm1);
office_element_ptr elm;
create_element(L"text", L"illustration-index", elm, this);
text_context()->start_element(elm);
add_to_root();
create_element(L"text", L"illustration-index-source", elm2, this);
text_context()->start_element(elm2);
text_context()->end_element();
start_index_field();
return true;
}
void odt_conversion_context::end_illustration_index()
{
text_context()->end_element();
office_element_ptr elm;
create_element(L"text", L"illustration-index-source", elm, this);
text_illustration_index_source* index_source = dynamic_cast<text_illustration_index_source*>(elm.get());
if (index_source)
{
if (false == current_fields.back().captionSEQ.empty())
{
index_source->caption_sequence_name_ = current_fields.back().captionSEQ;
index_source->caption_sequence_format_ = L"text";
}
}
text_context()->start_element(elm);
//template
text_context()->end_element();
text_context()->end_element();
}
bool odt_conversion_context::start_bibliography()
void odt_conversion_context::start_bibliography()
{
office_element_ptr elm;
create_element(L"text", L"bibliography", elm, this);
@ -409,34 +474,42 @@ bool odt_conversion_context::start_bibliography()
add_to_root();
create_element(L"text", L"bibliography-source", elm, this);
text_context()->start_element(elm);
text_context()->end_element();
start_index_field();
return true;
}
bool odt_conversion_context::start_table_index()
void odt_conversion_context::end_bibliography()
{
text_context()->end_element();
office_element_ptr elm;
create_element(L"text", L"bibliography-source", elm, this);
text_context()->start_element(elm);
//template
text_context()->end_element();
text_context()->end_element();
}
void odt_conversion_context::start_table_index()
{
end_paragraph();
office_element_ptr elm;
create_element(L"text", L"table-index", elm, this);
text_context()->start_element(elm);
add_to_root();
create_element(L"text", L"table-index-source", elm, this);
text_context()->start_element(elm);
text_context()->end_element();
start_index_field();
start_paragraph();
return true;
}
void odt_conversion_context::end_table_index()
{
text_context()->end_element();
office_element_ptr elm;
create_element(L"text", L"table-index-source", elm, this);
text_context()->start_element(elm);
//template
text_context()->end_element();
text_context()->end_element();
}
void odt_conversion_context::start_index_field()
{
if (current_fields.empty()) return;
@ -458,26 +531,21 @@ void odt_conversion_context::end_index_field()
text_context()->end_element();
}
bool odt_conversion_context::start_hyperlink(std::wstring ref)
void odt_conversion_context::start_hyperlink(std::wstring ref)
{
office_element_ptr hyperlink_elm;
create_element(L"text", L"a", hyperlink_elm, this);
text_a* hyperlink = dynamic_cast<text_a*>(hyperlink_elm.get());
if (!hyperlink)return false;
if (hyperlink)
{
hyperlink->common_xlink_attlist_.href_ = ref;
hyperlink->common_xlink_attlist_.type_ = xlink_type::Simple;
text_context()->start_element(hyperlink_elm);
////////////////////////////
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;
return true;
is_hyperlink_ = true;
}
}
void odt_conversion_context::end_hyperlink()
{
@ -487,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;
@ -499,9 +597,23 @@ std::map<std::wstring, std::wstring> odt_conversion_context::parse_instr_options
{
std::wstring key = arOptions[i].substr(0, 1);
std::wstring value;
if (arOptions[i].length() > 1)
if (arOptions[i].length() > 2)
{
value = arOptions[i].substr(1);
size_t pos = arOptions[i].find(L"\"");
if (std::wstring::npos != pos)
{
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));
}
@ -514,10 +626,12 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
{
if (current_fields.empty()) return;
current_fields.back().status = 1; //prepare
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;
@ -533,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));
@ -584,12 +716,36 @@ 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
{
current_fields.back().type = 10;
std::vector<std::wstring> arLevels;
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 = fieldToc;
current_fields.back().outline_levels = XmlUtils::GetInteger(arLevels[1]);
}
}
pFind = options.find(L"t");
if ( pFind != options.end())//content styles name
{
std::vector<std::wstring> arStyles;
boost::algorithm::split(arStyles, pFind->second, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
for (size_t i = 0; i < arStyles.size() - 1; i += 2)
{
int level = XmlUtils::GetInteger(arStyles[i + 1]);
if (level < 1) continue;
while(current_fields.back().arStyleLevels.size() + 1 < level )
{
current_fields.back().arStyleLevels.push_back(L"");
}
current_fields.back().arStyleLevels.push_back(arStyles[i]);
}
}
pFind = options.find(L"z");
if ( pFind != options.end())//table of content outline levels style
@ -761,28 +917,38 @@ void odt_conversion_context::end_field()
{
if (current_fields.empty()) return;
if (current_fields.back().started)
if (current_fields.back().status == 2)
{
switch(current_fields.back().type)
current_fields.back().status = 3;//prepare for delete
if (current_fields.back().type < 0xff)
{
case 1: end_hyperlink(); break;
case 6:
case 7:
case 8:
case 9:
case 10: end_index_field(); break;
default:
text_context()->end_field();
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();
}
}
current_fields.pop_back();
}
void odt_conversion_context::end_paragraph()
{
if (!current_fields.empty() && !current_fields.back().result) return; //Стандартное_составное_письмо.docx
//if (!current_fields.empty() && !current_fields.back().result) return; //Стандартное_составное_письмо.docx
text_context()->end_paragraph();
if (false == current_fields.empty() && current_fields.back().status == 3) //prepare for delete
{
switch(current_fields.back().type)
{
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();
}
flush_section();
}
@ -882,10 +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().started == false && !current_fields.back().in_span)
if (!current_fields.empty() && current_fields.back().status == 1 && !current_fields.back().in_span && current_fields.back().type < 0xff)
{
if (current_fields.back().type == 1) current_fields.back().started = start_hyperlink(current_fields.back().value);
else if (current_fields.back().type < 6) current_fields.back().started = text_context()->start_field(current_fields.back().type);
current_fields.back().status = 2;
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);
@ -897,16 +1066,17 @@ void odt_conversion_context::start_run(bool styled)
props->apply_from(dynamic_cast<style_text_properties*>(drop_cap_state_.text_properties.get()));
}
if (!current_fields.empty() && current_fields.back().started == false && current_fields.back().in_span)//поле стартуется в span - нужно для сохранения стиля
if (!current_fields.empty() && current_fields.back().status == 1 && current_fields.back().in_span)//поле стартуется в span - нужно для сохранения стиля
{
current_fields.back().started = text_context()->start_field(current_fields.back().type);
current_fields.back().status = 2;
text_context()->start_field(current_fields.back().type);
}
}
void odt_conversion_context::end_run()
{
if (is_hyperlink_ && text_context_.size() > 0) return;
if (!current_fields.empty() && current_fields.back().started == true && current_fields.back().in_span)
if (!current_fields.empty() && current_fields.back().status == 1 && current_fields.back().in_span)
{
end_field();
}

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;
@ -90,14 +87,26 @@ public:
void add_paragraph_break(int type);
bool start_hyperlink (std::wstring ref);
void start_hyperlink (std::wstring ref);
void end_hyperlink ();
bool start_table_of_content ();
bool start_bibliography ();
bool start_alphabetical_index ();
bool start_illustration_index ();
bool start_table_index ();
void start_sequence ();
void end_sequence ();
void start_table_of_content ();
void end_table_of_content ();
void start_bibliography ();
void end_bibliography ();
void start_alphabetical_index ();
void end_alphabetical_index ();
void start_illustration_index ();
void end_illustration_index ();
void start_table_index ();
void end_table_index ();
void start_index_field();
void end_index_field();
@ -192,23 +201,29 @@ 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;
std::wstring format;
bool started = false;
short status = 0;//0, 1, 2, 3 - init, prapare, start, finish
bool in_span = false;
bool result;
bool result = false; //after separate
bool bHyperlinks = false;
bool bHidePageNumbers = false;
std::wstring captionSEQ;
std::wstring title;
std::vector<std::wstring> arStyleLevels;
int outline_levels = 0;
std::vector<int> arTemplateTypes;//text, link, tab ....
int tabLeader = 0;//dot
};
std::vector<_field_state> current_fields;

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)
@ -3036,27 +3036,34 @@ void DocxConverter::convert_styles()
void DocxConverter::convert(OOX::Logic::CHyperlink *oox_hyperlink)
{
if (oox_hyperlink == NULL)return;
std::wstring ref;
if (oox_hyperlink->m_oId.IsInit()) //гиперлинк
{
std::wstring ref = find_link_by_id(oox_hyperlink->m_oId->GetValue(),2);
ref = find_link_by_id(oox_hyperlink->m_oId->GetValue(),2);
}
else if (oox_hyperlink->m_sAnchor.IsInit())
{
ref = L"#" + *oox_hyperlink->m_sAnchor;
}
if (false == ref.empty())
{
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
{//ссылка внутри дока
//anchor todooo
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_sAnchor;
//nullable<std::wstring > m_sDocLocation;
//nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse> > m_oHistory;
//nullable<std::wstring > m_sTgtFrame;
@ -3606,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();
@ -3631,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();
@ -3658,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();
@ -3675,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;
}
@ -3854,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)
@ -3970,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();
@ -4030,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

@ -1,6 +1,6 @@
#!/bin/bash
SCRIPT=$(readlink -n "$0" || grealpath "$0")
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
os=$(uname -s)

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);
@ -649,6 +649,8 @@ bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring & fileN
delete []pBuffer;
pBuffer = NULL;
}
nBufferSize = 0;
hresult = OfficeUtils.LoadFileFromArchive(fileName, L"mimetype", &pBuffer, nBufferSize);
if (hresult == S_OK && pBuffer != NULL)
{
@ -689,7 +691,8 @@ bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring & fileN
else
{
//если не записан тип смотрим манифест
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"META-INF/manifest.xml", &pBuffer, nBufferSize);
nBufferSize = 0;
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"META-INF/manifest.xml", &pBuffer, nBufferSize);
if (hresult == S_OK && pBuffer != NULL)
{
std::string xml_string((char*)pBuffer, nBufferSize);

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
@ -981,6 +981,88 @@ namespace NSEditorApi
LINK_PROPERTY_INT_JS(InsertPageNum)
};
class CAscSlideTiming : public IMenuEventDataBase
{
private:
js_wrapper<int> m_nTransitionType;
js_wrapper<int> m_nTransitionOption;
js_wrapper<int> m_nTransitionDuration;
js_wrapper<bool> m_bSlideAdvanceOnMouseClick;
js_wrapper<bool> m_bSlideAdvanceAfter;
js_wrapper<bool> m_bSlideAdvanceDuration;
js_wrapper<bool> m_bShowLoop;
public:
CAscSlideTiming()
{
}
virtual ~CAscSlideTiming()
{
}
LINK_PROPERTY_INT_JS(TransitionType)
LINK_PROPERTY_INT_JS(TransitionOption)
LINK_PROPERTY_INT_JS(TransitionDuration)
LINK_PROPERTY_BOOL_JS(SlideAdvanceOnMouseClick)
LINK_PROPERTY_BOOL_JS(SlideAdvanceAfter)
LINK_PROPERTY_BOOL_JS(SlideAdvanceDuration)
LINK_PROPERTY_BOOL_JS(ShowLoop)
};
class CAscTransitions : public IMenuEventDataBase
{
public:
std::vector<CAscSlideTiming> m_arTransitions;
public:
CAscTransitions()
{}
virtual ~CAscTransitions()
{
}
};
class CAscSlideProp : public IMenuEventDataBase
{
js_wrapper<CAscFill> m_oBackground;
js_wrapper<CAscSlideTiming> m_oTiming;
js_wrapper<int> m_nLayoutIndex;
js_wrapper<bool> m_bIsHidden;
js_wrapper<bool> m_bLockBackground;
js_wrapper<bool> m_bLockDelete;
js_wrapper<bool> m_bLockLayout;
js_wrapper<bool> m_bLockRemove;
js_wrapper<bool> m_bLockTiming;
js_wrapper<bool> m_bLockTransition;
public:
CAscSlideProp()
{
}
virtual ~CAscSlideProp()
{
}
LINK_PROPERTY_OBJECT_JS(CAscFill, Background)
LINK_PROPERTY_OBJECT_JS(CAscSlideTiming, Timing)
LINK_PROPERTY_INT_JS(LayoutIndex)
LINK_PROPERTY_BOOL_JS(IsHidden)
LINK_PROPERTY_BOOL_JS(LockBackground)
LINK_PROPERTY_BOOL_JS(LockDelete)
LINK_PROPERTY_BOOL_JS(LockLayout)
LINK_PROPERTY_BOOL_JS(LockRemove)
LINK_PROPERTY_BOOL_JS(LockTiming)
LINK_PROPERTY_BOOL_JS(LockTransition)
};
class CAscImagePosition
{

View File

@ -689,6 +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 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