Compare commits

..

43 Commits

Author SHA1 Message Date
5b5ccdc9be [pe][ios] Events 2018-07-18 19:19:13 +03:00
adf7ca65ea [ios][pe] events 2018-07-18 16:48:45 +03:00
08d551752e Changes for desktop (develop branch) 2018-07-17 19:55:31 +03:00
77b1303d62 . 2018-07-17 18:12:51 +03:00
93e56e2b8a OdfFormatReader - fix issue #128, add cross references, fix simple annotations 2018-07-17 16:14:20 +03:00
e032fc8294 [bug] Compilation bug 2018-07-17 14:04:07 +03:00
5ae2ac2385 [ios][x2t] fixed build 2018-07-16 15:43:07 +03:00
6b8cb6cae4 Merge pull request #94 from ONLYOFFICE/feature/bin2xlsx-enh
[x2t] Decrease memory consumption while bin->xlsx conversion
2018-07-16 14:10:56 +03:00
e66ea7c628 [x2t] Add saving of templates to fromDocxDir, fromXlsxDir, fromPptxDir 2018-07-16 13:57:20 +03:00
2447925fd6 OdfFormatWriter - alphabetical indexes 2018-07-16 11:31:58 +03:00
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
b883cfcbd4 Add workaround for building icu on ArchLinux
See https://bugs.archlinux.org/task/55246
2018-07-12 16:51:17 +03:00
bb8add215a Fail on any error in subscripts
Without this command any errors are just ignored and script continues
2018-07-12 16:24:32 +03:00
ff7d7a908c [ios][pe] events 2018-07-12 11:15:40 +03:00
958e213f9b [x2t] Fix RemoveWhiteSpaces 2018-07-11 19:40:27 +03:00
3d3baa50b5 . 2018-07-11 18:15:28 +03:00
ee987f8713 OdfFormatWriter - add documentID, add table of content, table of indexes 2018-07-11 17:20:51 +03:00
5e126e28ff [x2t] Decrease memory consumption while bin->xlsx conversion 2018-07-11 16:58:07 +03:00
e98f4ae7b4 PdfWriter - add documentID 2018-07-11 12:30:37 +03:00
6900c0a640 [x2t] Remove LvlRestart stubs 2018-07-10 20:28:09 +03:00
5f09bf7835 . 2018-07-10 19:06:46 +03:00
5a9a89979c Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2018-07-10 18:38:26 +03:00
6a052f68aa PdfWriter - fix encrypt 2018-07-10 18:37:50 +03:00
fc9b5e0613 [ios][x2t] fixed icu 2018-07-10 18:33:35 +03:00
f7d1009974 OdfFormatReader - styles template table of content 2018-07-09 19:27:30 +03:00
cb729d306b [ios][x2t] fixed build 2018-07-09 16:15:17 +03:00
ab449707f3 Merge remote-tracking branch 'origin/hotfix/v5.1.5' into develop 2018-07-09 14:47:31 +03:00
47f28ac212 RtfFormat - fix bug #34747 2018-07-09 14:43:46 +03:00
016b77f9ab Merge pull request #88 from ONLYOFFICE/feature/no-history-gsync
Add --no-historyt to `gclient-sync`
2018-07-05 17:23:32 +03:00
d81c895610 Add --no-historyt to gclient-sync
Greatly reduce time to fetch v8 sources.
Time to execute `gclient-sync`
Default varinant `real    21m2.279s`
With `--no-history` - `real    0m53.638s`
2018-07-05 17:21:57 +03:00
653a4e77c5 moved 'encrypt' data type 2018-07-04 18:11:43 +03:00
1c94b64399 added class for "encrypt" data event 2018-07-04 14:37:48 +03:00
2b2352fc74 Fix error build 2018-07-04 12:22:28 +03:00
11b97bcd6d [x2t] Add m_bIsPDFA param 2018-07-03 18:31:25 +03:00
06150358a9 Fix bug with calculating inverse matrix 2018-06-27 14:29:21 +03:00
945c04b294 Hatched brush support in builder mode 2018-06-26 17:57:25 +03:00
129 changed files with 2891 additions and 1343 deletions

View File

@ -1417,7 +1417,7 @@ public:
oWriter.WriteString(L"<w:numFmt w:val=\"" + sFormat + L"\"/>");
}
}
if(bRestart && 0 == Restart)
if(bRestart)
{
oWriter.WriteString(L"<w:lvlRestart w:val=\"" + std::to_wstring(Restart) + L"\"/>");
}

View File

@ -2915,12 +2915,9 @@ namespace BinDocxRW
const ComplexTypes::Word::CDecimalNumber& oVal = lvl.m_oLvlRestart.get();
if(oVal.m_oVal.IsInit())
{
int nVal = oVal.m_oVal.get().GetValue();
if(0 != nVal)
nVal = -1;
m_oBcw.m_oStream.WriteBYTE(c_oSerNumTypes::lvl_Restart);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
m_oBcw.m_oStream.WriteLONG(nVal);
m_oBcw.m_oStream.WriteLONG(oVal.m_oVal.get().GetValue());
}
}
//Start

View File

@ -397,7 +397,7 @@
"$(PROJECT_DIR)/../../DesktopEditor/freetype-2.5.2/include",
"$(PROJECT_DIR)/../../Common/3dParty/boost/boost_1_58_0",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = ASCOfficeDocxFile2Lib_ios;
SDKROOT = iphoneos;
};
@ -436,7 +436,7 @@
"$(PROJECT_DIR)/../../DesktopEditor/freetype-2.5.2/include",
"$(PROJECT_DIR)/../../Common/3dParty/boost/boost_1_58_0",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = ASCOfficeDocxFile2Lib_ios;
SDKROOT = iphoneos;
};

View File

@ -306,10 +306,15 @@ void docx_conversion_context::finish_run()
{
if (false == in_run_) return;
if (get_comments_context().state() == 4)
{
output_stream()<< L"<w:commentReference w:id=\"" << get_comments_context().current_id() << L"\"/>";
get_comments_context().state(0);
}
output_stream() << L"</w:r>";
in_run_ = false;
if (get_comments_context().state()==2)
if (get_comments_context().state() == 2)
{
output_stream()<< L"<w:commentRangeEnd w:id=\"" << get_comments_context().current_id() << L"\"/>";
@ -318,7 +323,6 @@ void docx_conversion_context::finish_run()
get_comments_context().state(0);
finish_run();
}
}
void docx_conversion_context::start_math_formula()
{
@ -369,31 +373,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\"";
}
/*\\l 1-3*/
if (!table_content_context_.caption_sequence_name.empty())
else
{
sInstrText += L" \\c \"" + table_content_context_.caption_sequence_name + L"\"";
}
sInstrText += L" TOC \\h";
if (table_content_context_.type_table_content == 1)
sInstrText += L" \\f \\u";
else
sInstrText += L" \\z";
if (table_content_context_.min_outline_level > 0)
{
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"\"";
}
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>";
@ -567,7 +591,8 @@ oox_chart_context & docx_conversion_context::current_chart()
void docx_conversion_context::add_new_run(std::wstring parentStyleId)
{
finish_run();
if (get_comments_context().state()==1)
if (get_comments_context().state() == 1 ||
get_comments_context().state() == 4)//??? comment in run
{
output_stream() << L"<w:commentRangeStart w:id=\"" << get_comments_context().current_id() << L"\" />";
get_comments_context().state(2);//active

View File

@ -486,14 +486,14 @@ public:
std::wstring author;
std::wstring initials;
};
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date)
void start_comment(const std::wstring & content, const std::wstring & author, const std::wstring & date, bool inRun = false)
{
int id = comments_.size()+1;
_comment_desc new_comment={content,id,date,author};
int id = comments_.size() + 1;
_comment_desc new_comment={content, id, date, author};
comments_.push_back(new_comment);
state_ = 1;
state_ = inRun ? 4 : 1;
}
int current_id()
{
@ -668,7 +668,7 @@ public:
{
current_state.content.push_back(type);
}
void set_outline_level(int level)
void add_outline_level_style(int level, const std::wstring& style_name)
{
if (min_outline_level == -1 || min_outline_level > level)
min_outline_level = level;
@ -676,6 +676,9 @@ public:
if (max_outline_level == -1 || max_outline_level < level)
max_outline_level = level;
if (!style_name.empty())
outline_level_styles.insert(std::make_pair(level, style_name));
current_state.outline_level = level;
}
void end_level()
@ -690,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;
}
@ -726,6 +730,8 @@ public:
caption_sequence_name.clear();
min_outline_level = -1;
max_outline_level = -1;
outline_level_styles.clear();
bSeparators = false;
}
void add_sequence(const std::wstring & name, int outline_level)
{
@ -749,6 +755,8 @@ public:
int type_table_content;
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

@ -50,7 +50,7 @@ std::wostream & operator << (std::wostream & _Wostream, const style_repeat & _Va
case style_repeat::Stretch:
_Wostream << L"stretch";
break;
default:
default:
break;
}
return _Wostream;
@ -67,9 +67,10 @@ style_repeat style_repeat::parse(const std::wstring & Str)
return style_repeat( Repeat );
else if (tmp == L"stretch")
return style_repeat( Stretch );
else
else if (tmp == L"scale")//LOWriter-form-controls modded.odt
return style_repeat( Stretch );
else
{
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return style_repeat( NoRepeat );
}
}

View File

@ -39,21 +39,22 @@ namespace odf_reader {
class document_context::Impl
{
public:
Impl() : last_paragraph_(NULL) {}
Impl() : last_element_(NULL) {}
public:
void set_last_paragraph(text::paragraph * Paragraph)
void set_last_element(office_element* elem)
{
last_paragraph_ = Paragraph;
last_element_ = elem;
}
text::paragraph * get_last_paragraph()
office_element* get_last_element()
{
return last_paragraph_;
return last_element_;
}
private:
text::paragraph * last_paragraph_;
office_element * last_element_;
};
@ -68,18 +69,15 @@ document_context::~document_context()
{
delete impl_;
}
void document_context::set_last_paragraph(text::paragraph * Paragraph)
void document_context::set_last_element(office_element* elem)
{
return impl_->set_last_paragraph(Paragraph);
return impl_->set_last_element(elem);
}
text::paragraph * document_context::get_last_paragraph()
office_element* document_context::get_last_element()
{
return impl_->get_last_paragraph();
return impl_->get_last_element();
}
}
}

View File

@ -36,18 +36,14 @@ namespace odf_reader {
class office_element;
namespace text {
class paragraph;
}
class document_context
{
public:
document_context();
virtual ~document_context();
void set_last_paragraph(text::paragraph * Paragraph);
text::paragraph * get_last_paragraph();
void set_last_element(office_element* elem);
office_element* get_last_element();
int level;

View File

@ -1255,7 +1255,19 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
//}
auto_fit_shape = true;
}
else if ((frame->draw_frame_attlist_.fo_min_height_) && (draw_text_box_attlist_.fo_min_height_->get_type()==length_or_percent::Length))
{
size_t min_y = get_value_emu(frame->draw_frame_attlist_.fo_min_height_->get_length());
if (drawing->cy < min_y)
{
drawing->cy = min_y;
}
auto_fit_shape = true;
}
else if ((frame->common_draw_attlists_.rel_size_.style_rel_height_) && (frame->common_draw_attlists_.rel_size_.style_rel_height_->get_type() == percent_or_scale::ScaleMin))
{
auto_fit_shape = true;
}
if ((draw_text_box_attlist_.fo_min_width_) && (draw_text_box_attlist_.fo_min_width_->get_type()==length_or_percent::Length))
{

View File

@ -148,7 +148,7 @@ void office_annotation::docx_convert(oox::docx_conversion_context & Context)
Context.set_run_state(runState);
Context.set_paragraph_state(pState);
Context.get_comments_context().start_comment(temp_stream.str(), author,date);//content, date, author
Context.get_comments_context().start_comment(temp_stream.str(), author, date, runState);//content, date, author
Context.dump_hyperlinks(Context.get_comments_context().get_rels(), oox::hyperlinks::comment_place);

View File

@ -142,14 +142,14 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
if (content_)
content_->docx_convert(Context);
if (!Context.get_section_context().dump_.empty() && !Context.get_table_context().in_table())
if (false == Context.get_section_context().dump_.empty() && false == Context.get_table_context().in_table())
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
}
else
{
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
if (page_layout_instance *lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{
Context.next_dump_page_properties(true);

View File

@ -34,7 +34,6 @@
#include <vector>
#include <CPSharedPtr.h>
#include <CPWeakPtr.h>
#include <xml/xmlelement.h>
#include <common/readdocelement.h>
@ -47,16 +46,17 @@
#include "visitor.h"
#include "../conversionelement.h"
#include "documentcontext.h"
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
namespace cpdoccore {
namespace odf_reader {
class document_context;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
typedef weak_ptr<office_element>::Type office_element_weak_ptr;
typedef std::vector<office_element_ptr> office_element_ptr_array;
class office_element : public xml::element<wchar_t>,
@ -69,17 +69,41 @@ public:
virtual ElementType get_type() const = 0;
virtual ~office_element() = 0;
void set_root(bool isRoot) { is_root_ = isRoot; }
bool is_root() const { return is_root_; }
virtual void afterCreate() {};
virtual void afterReadContent() {};
virtual void afterCreate()
{
if (context_ && this->get_type() != typeTextSection)
{
context_->level++;
}
}
virtual void afterReadContent()
{
if (context_ && this->get_type() != typeTextSection)
{
if (context_->level == 4)
{
if (office_element * prev= context_->get_last_element())
{
prev->next_element_style_name = element_style_name;
}
context_->set_last_element(this);
}
context_->level--;
}
}
CPDOCCORE_DEFINE_VISITABLE();
void setContext(document_context * Context) { context_ = Context; }
public:
_CP_OPT(std::wstring) element_style_name;
_CP_OPT(std::wstring) next_element_style_name; //for master page
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const
{
_CP_LOG << L"[warning] use base text_to_stream\n";
@ -92,8 +116,7 @@ public:
return _Wostream;
}
document_context * getContext() { return context_; }
//
//protected:
const document_context * getContext() const { return context_; }
private:

View File

@ -36,8 +36,10 @@
#include <xml/xmlchar.h>
#include <xml/attributes.h>
#include <xml/utils.h>
#include <odf/odf_document.h>
#include "serialize_elements.h"
#include "odfcontext.h"
namespace cpdoccore {
namespace odf_reader {
@ -155,7 +157,41 @@ void office_text::docx_convert(oox::docx_conversion_context & Context)
Context.start_office_text();
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
if (content_[i]->element_style_name)
{
std::wstring text___ = *content_[i]->element_style_name;
const _CP_OPT(std::wstring) masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(*content_[i]->element_style_name);
if (masterPageName)
{
Context.set_master_page_name(*masterPageName);
const std::wstring masterPageNameLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_name_by_style(*masterPageName);
Context.remove_page_properties();
Context.add_page_properties(masterPageNameLayout);
}
}
if (content_[i]->next_element_style_name)
{
std::wstring text___ = *content_[i]->next_element_style_name;
// проверяем не сменится ли свойства страницы.
// если да — устанавливаем контексту флаг на то что необходимо в текущем параграфе
// распечатать свойства раздела/секции
//проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(*content_[i]->next_element_style_name);
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
{
if (false == Context.root()->odf_context().pageLayoutContainer().compare_page_properties(Context.get_master_page_name(), *next_masterPageName))
{
Context.next_dump_page_properties(true);
//is_empty = false;
}
}
}
content_[i]->docx_convert(Context);
}
Context.end_office_text();
}

View File

@ -1209,10 +1209,21 @@ void sequence_ref::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void sequence_ref::add_text(const std::wstring & Text)
{
content_ = Text;
text_ = text::create(Text) ;
}
void sequence_ref::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring ref, sequence;
if (!ref_name_) return;
Context.finish_run();
Context.output_stream() << L"<w:fldSimple w:instr=\" REF " << *ref_name_ << L" \\h\">";
Context.add_new_run();
if (text_)
text_->docx_convert(Context);
Context.finish_run();
Context.output_stream() << L"</w:fldSimple>";
}
//------------------------------------------------------------------------------------------------------------
const wchar_t * sequence::ns = L"text";
@ -1277,8 +1288,8 @@ void sequence::docx_convert(oox::docx_conversion_context & Context)
num_format= L"ARABIC"; break;
}
}
Context.output_stream() << L"<w:fldSimple w:instr=\" SEQ " << sequence << L" \\* " << num_format << L" \">";
Context.start_bookmark(*ref_name_);
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++)
{
@ -1291,6 +1302,8 @@ void sequence::docx_convert(oox::docx_conversion_context & Context)
// Context.end_bookmark(ref);
//}
Context.output_stream() << L"</w:fldSimple>";
Context.end_bookmark(*ref_name_);
}
void sequence::pptx_convert(oox::pptx_conversion_context & Context)
{
@ -1846,12 +1859,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

@ -891,7 +891,7 @@ public:
_CP_OPT(std::wstring) reference_format_;//caption, category-and-value, value, chapter, direction, page, text, number, number-all-superior, number-no-superior
_CP_OPT(std::wstring) ref_name_;
std::wstring content_;
office_element_ptr text_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );

View File

@ -142,7 +142,9 @@ const wchar_t * table_table::name = L"table";
void table_table::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
table_table_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"table:style-name", element_style_name);
table_table_attlist_.add_attributes(Attributes);
}
void table_table::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)

View File

@ -144,6 +144,16 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
{
std::wostream & _Wostream = Context.output_stream();
std::wstring sDumpPageProperties;
if (false == Context.get_paragraph_state())
{
std::wstringstream strm;
if (Context.process_page_properties(strm))
{
sDumpPageProperties = strm.str();
}
}
bool sub_table = table_table_attlist_.table_is_sub_table_.get_value_or(false);
//todooo придумать как сделать внешние границы sub-таблицы границами внешней ячейки (чтоб слияние произошло)
@ -173,6 +183,15 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
Context.get_table_context().end_table();
_Wostream << L"</w:tbl>";
if (false == sDumpPageProperties.empty())
{
Context.output_stream() << L"<w:p>";
Context.output_stream() << L"<w:pPr>";
Context.output_stream() << sDumpPageProperties;
Context.output_stream() << L"</w:pPr>";
Context.output_stream() << L"</w:p>";
}
}
void table_columns::docx_convert(oox::docx_conversion_context & Context)

View File

@ -71,12 +71,6 @@ public:
};
template <class ElementT>
class text_content_impl : public office_element_impl<ElementT>
{
};
}
}
}

View File

@ -161,35 +161,6 @@ void paragraph::add_text(const std::wstring & Text)
office_element_ptr elm = text::create(Text) ;
content_.push_back( elm );
}
void paragraph::afterCreate(document_context * Context)
{
// вызывается сразу после создания объекта
if (Context)
{
Context->level++;
// выставляем у предыдущего параграфа указатель на следующий (т.е. на вновь созданный)
if (Context->level == 1)
{
if (paragraph * prevPar = Context->get_last_paragraph())
{
prevPar->set_next(this);
}
// запоминаем в контексте вновь созданный параграф
Context->set_last_paragraph(this);
}
}
}
void paragraph::afterReadContent(document_context * Context)
{
if (Context)
{
Context->level--;
}
}
const wchar_t * emptyParagraphContent = L"<w:pPr></w:pPr><w:r><w:rPr></w:rPr></w:r>";
const wchar_t * emptyParagraphDrawing = L"<w:p><w:pPr></w:pPr></w:p>";
@ -315,30 +286,22 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
if (masterPageName)
{
Context.set_master_page_name(*masterPageName);
const std::wstring masterPageNameLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_name_by_style(*masterPageName);
Context.remove_page_properties();
Context.add_page_properties(masterPageNameLayout);
is_empty = false;
}
if (next_par_)
if (next_element_style_name)
{
// проверяем не сменит ли следующий параграф свойства страницы.
// если да — устанавливаем контексту флаг на то что необходимо в текущем параграфе
// распечатать свойства раздела/секции
//проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_;
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(next_styleName);
// проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
// dump был выше уровнем
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(*next_element_style_name);
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
{
if (false == Context.root()->odf_context().pageLayoutContainer().compare_page_properties(Context.get_master_page_name(), *next_masterPageName))
{
Context.next_dump_page_properties(true);
is_empty = false;
}
}
@ -473,7 +436,9 @@ std::wostream & h::text_to_stream(std::wostream & _Wostream) const
void h::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:outline-level" , outline_level_);
CP_APPLY_ATTR(L"text:style-name", element_style_name);
CP_APPLY_ATTR(L"text:outline-level" , outline_level_);
CP_APPLY_ATTR(L"text:restart-numbering" , restart_numbering_);
CP_APPLY_ATTR(L"text:start-value" , start_value_);
CP_APPLY_ATTR(L"text:is-list-header" , is_list_header_);
@ -494,14 +459,12 @@ void h::add_text(const std::wstring & Text)
paragraph_.add_text(Text);
}
void h::afterCreate()
{
paragraph_.afterCreate( getContext() );
}
void h::afterReadContent()
{
paragraph_.afterReadContent( getContext() );
office_element::afterReadContent();
paragraph_.next_element_style_name = next_element_style_name;
}
void h::docx_convert(oox::docx_conversion_context & Context)
{
paragraph_.docx_convert(Context);
@ -520,14 +483,6 @@ void h::pptx_convert(oox::pptx_conversion_context & Context)
const wchar_t * p::ns = L"text";
const wchar_t * p::name = L"p";
void p::afterCreate()
{
paragraph_.afterCreate( getContext() );
}
void p::afterReadContent()
{
paragraph_.afterReadContent( getContext() );
}
std::wostream & p::text_to_stream(std::wostream & _Wostream) const
{
return paragraph_.text_to_stream(_Wostream);
@ -535,6 +490,8 @@ std::wostream & p::text_to_stream(std::wostream & _Wostream) const
void p::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:style-name", element_style_name);
paragraph_.add_attributes(Attributes);
}
@ -562,6 +519,11 @@ void p::pptx_convert(oox::pptx_conversion_context & Context)
{
paragraph_.pptx_convert(Context);
}
void p::afterReadContent()
{
office_element::afterReadContent();
paragraph_.next_element_style_name = next_element_style_name;
}
// text:list
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * list::ns = L"text";
@ -661,24 +623,35 @@ std::wostream & section::text_to_stream(std::wostream & _Wostream) const
void section::afterCreate()
{
if (document_context * context = getContext())
office_element::afterCreate();
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_section(true);
lastPar->paragraph_.set_next_section(true);
}
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_section(true);
}
}
}
void section::afterReadContent()
{
if (document_context * context = getContext())
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_end_section(true);
lastPar->paragraph_.set_next_end_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_end_section(true);
}
}
office_element::afterReadContent();
}
void section::add_attributes( const xml::attributes_wc_ptr & Attributes )
@ -947,7 +920,7 @@ void common_entry_template::docx_convert(oox::docx_conversion_context & Context)
if (outline_level_)
{
Context.get_table_content_context().set_outline_level(*outline_level_);
Context.get_table_content_context().add_outline_level_style(*outline_level_, style_name_.get_value_or(L""));
}
for (size_t i = 0; i < content_.size(); i++)
{
@ -1076,11 +1049,17 @@ const wchar_t * illustration_index::name = L"illustration-index";
void illustration_index::afterCreate()
{
if (document_context * context = getContext())
office_element::afterCreate();
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_section(true);
lastPar->paragraph_.set_next_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_section(true);
}
}
}
@ -1089,11 +1068,16 @@ void illustration_index::afterReadContent()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_end_section(true);
lastPar->paragraph_.set_next_end_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_end_section(true);
}
}
office_element::afterReadContent();
}
void illustration_index::docx_convert(oox::docx_conversion_context & Context)
{
@ -1219,11 +1203,17 @@ void alphabetical_index::add_child_element( xml::sax * Reader, const std::wstrin
}
void alphabetical_index::afterCreate()
{
if (document_context * context = getContext())
office_element::afterCreate();
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_section(true);
lastPar->paragraph_.set_next_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_section(true);
}
}
}
@ -1231,11 +1221,16 @@ void alphabetical_index::afterReadContent()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_end_section(true);
lastPar->paragraph_.set_next_end_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_end_section(true);
}
}
office_element::afterReadContent();
}
void alphabetical_index::docx_convert(oox::docx_conversion_context & Context)
{
@ -1273,7 +1268,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 +1283,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++)
{
@ -1317,11 +1319,17 @@ const wchar_t * object_index::name = L"object-index";
void object_index::afterCreate()
{
if (document_context * context = getContext())
office_element::afterCreate();
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_section(true);
lastPar->paragraph_.set_next_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_section(true);
}
}
}
@ -1329,11 +1337,16 @@ void object_index::afterReadContent()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_end_section(true);
lastPar->paragraph_.set_next_end_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_end_section(true);
}
}
office_element::afterReadContent();
}
void object_index::docx_convert(oox::docx_conversion_context & Context)
{
@ -1419,11 +1432,17 @@ const wchar_t * user_index::name = L"user-index";
void user_index::afterCreate()
{
if (document_context * context = getContext())
office_element::afterCreate();
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_section(true);
lastPar->paragraph_.set_next_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_section(true);
}
}
}
@ -1431,11 +1450,16 @@ void user_index::afterReadContent()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_end_section(true);
lastPar->paragraph_.set_next_end_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_end_section(true);
}
}
office_element::afterReadContent();
}
void user_index::docx_convert(oox::docx_conversion_context & Context)
{
@ -1560,11 +1584,17 @@ const wchar_t * bibliography::name = L"bibliography";
void bibliography::afterCreate()
{
if (document_context * context = getContext())
office_element::afterCreate();
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_section(true);
lastPar->paragraph_.set_next_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_section(true);
}
}
}
@ -1573,11 +1603,16 @@ void bibliography::afterReadContent()
{
if (document_context * context = getContext())
{
if (paragraph * lastPar = context->get_last_paragraph())
if (p *lastPar = dynamic_cast<p*>(context->get_last_element()))
{
lastPar->set_next_end_section(true);
lastPar->paragraph_.set_next_end_section(true);
}
else if (h *lastPar = dynamic_cast<h*>(context->get_last_element()))
{
lastPar->paragraph_.set_next_end_section(true);
}
}
office_element::afterReadContent();
}
void bibliography::docx_convert(oox::docx_conversion_context & Context)
{

View File

@ -51,7 +51,7 @@ namespace text {
class paragraph
{
public:
paragraph() : next_par_(NULL), next_section_(false), next_end_section_(false), is_header_(false) {}
paragraph() : next_section_(false), next_end_section_(false), is_header_(false) {}
std::wostream & text_to_stream(std::wostream & _Wostream) const;
@ -59,9 +59,8 @@ public:
void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
void add_text (const std::wstring & Text);
paragraph * get_next() { return next_par_; }
void set_next(paragraph * next) {next_par_ = next;}
_CP_OPT(std::wstring) next_element_style_name; //for master page
void set_next_section(bool Val)
{
next_section_ = Val;
@ -71,9 +70,6 @@ public:
{
next_end_section_ = Val;
}
void afterCreate(document_context * ctx);
void afterReadContent(document_context * ctx);
void docx_convert (oox::docx_conversion_context & Context) ;
void xlsx_convert (oox::xlsx_conversion_context & Context) ;
@ -88,21 +84,18 @@ private:
paragraph_attrs attrs_;
paragraph *next_par_;
bool next_section_;
bool next_end_section_;
bool is_header_;
friend class par_docx_convert_class;
friend class p;
friend class h;
};
//---------------------------------------------------------------------------------------------------
class h : public text_content_impl<h>
class h : public office_element_impl<h>
{
public:
static const wchar_t * ns;
@ -115,9 +108,8 @@ public:
void xlsx_convert(oox::xlsx_conversion_context & Context) ;
void pptx_convert(oox::pptx_conversion_context & Context) ;
virtual void afterCreate();
virtual void afterReadContent();
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
paragraph paragraph_;
@ -134,14 +126,12 @@ private:
_CP_OPT(bool) is_list_header_;
_CP_OPT(std::wstring) number_;
friend class par_docx_convert_class;
};
CP_REGISTER_OFFICE_ELEMENT2(h);
//---------------------------------------------------------------------------------------------------
class p : public text_content_impl<p>
class p : public office_element_impl<p>
{
public:
static const wchar_t * ns;
@ -154,7 +144,6 @@ public:
void xlsx_convert(oox::xlsx_conversion_context & Context) ;
void pptx_convert(oox::pptx_conversion_context & Context) ;
virtual void afterCreate();
virtual void afterReadContent();
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
@ -167,12 +156,11 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
friend class par_docx_convert_class;
};
CP_REGISTER_OFFICE_ELEMENT2(p);
//---------------------------------------------------------------------------------------------------
class list : public text_content_impl<list>
class list : public office_element_impl<list>
{
public:
static const wchar_t * ns;
@ -203,7 +191,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(list);
//---------------------------------------------------------------------------------------------------
class soft_page_break : public text_content_impl<soft_page_break>
class soft_page_break : public office_element_impl<soft_page_break>
{
public:
static const wchar_t * ns;
@ -223,7 +211,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(soft_page_break);
//---------------------------------------------------------------------------------------------------
class section : public text_content_impl<section>
class section : public office_element_impl<section>
{
public:
static const wchar_t * ns;
@ -265,7 +253,7 @@ private:
};
//---------------------------------------------------------------------------------------------------
class section_source : public text_content_impl<section_source>
class section_source : public office_element_impl<section_source>
{
public:
static const wchar_t * ns;
@ -305,7 +293,7 @@ public:
};
//---------------------------------------------------------------------------------------------------
class table_of_content : public text_content_impl<table_of_content>
class table_of_content : public office_element_impl<table_of_content>
{
public:
static const wchar_t * ns;
@ -335,7 +323,7 @@ CP_REGISTER_OFFICE_ELEMENT2(table_of_content);
//---------------------------------------------------------------------------------------------------
// text:table-index
//---------------------------------------------------------------------------------------------------
class table_index : public text_content_impl<table_index>
class table_index : public office_element_impl<table_index>
{
public:
static const wchar_t * ns;
@ -364,7 +352,7 @@ CP_REGISTER_OFFICE_ELEMENT2(table_index);
//---------------------------------------------------------------------------------------------------
// text:illustration-index
//---------------------------------------------------------------------------------------------------
class illustration_index : public text_content_impl<illustration_index>
class illustration_index : public office_element_impl<illustration_index>
{
public:
static const wchar_t * ns;
@ -396,7 +384,7 @@ CP_REGISTER_OFFICE_ELEMENT2(illustration_index);
//---------------------------------------------------------------------------------------------------
// text:alphabetical-index
//---------------------------------------------------------------------------------------------------
class alphabetical_index : public text_content_impl<alphabetical_index>
class alphabetical_index : public office_element_impl<alphabetical_index>
{
public:
static const wchar_t * ns;
@ -428,7 +416,7 @@ CP_REGISTER_OFFICE_ELEMENT2(alphabetical_index);
//---------------------------------------------------------------------------------------------------
// text:object-index
//---------------------------------------------------------------------------------------------------
class object_index : public text_content_impl<object_index>
class object_index : public office_element_impl<object_index>
{
public:
static const wchar_t * ns;
@ -460,7 +448,7 @@ CP_REGISTER_OFFICE_ELEMENT2(object_index);
//---------------------------------------------------------------------------------------------------
// text:user-index
//---------------------------------------------------------------------------------------------------
class user_index : public text_content_impl<user_index>
class user_index : public office_element_impl<user_index>
{
public:
static const wchar_t * ns;
@ -492,7 +480,7 @@ CP_REGISTER_OFFICE_ELEMENT2(user_index);
//------------------------------------------------------------------------------------------------------------
// text:bibliography
//------------------------------------------------------------------------------------------------------------
class bibliography : public text_content_impl<bibliography>
class bibliography : public office_element_impl<bibliography>
{
public:
static const wchar_t * ns;
@ -565,7 +553,7 @@ CP_REGISTER_OFFICE_ELEMENT2(bibliography_entry_template);
//---------------------------------------------------------------------------------------------------
//text:index-body
//---------------------------------------------------------------------------------------------------
class index_body : public text_content_impl<index_body>
class index_body : public office_element_impl<index_body>
{
public:
static const wchar_t * ns;
@ -588,7 +576,7 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(index_body);
//---------------------------------------------------------------------------------------------------
class index_title : public text_content_impl<index_title>
class index_title : public office_element_impl<index_title>
{
public:
static const wchar_t * ns;
@ -613,7 +601,7 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(index_title);
//---------------------------------------------------------------------------------------------------
class index_title_template : public text_content_impl<index_title_template>
class index_title_template : public office_element_impl<index_title_template>
{
public:
static const wchar_t * ns;
@ -1283,7 +1271,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 +1285,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

@ -96,10 +96,10 @@ HRESULT convert_single(std::wstring srcFileName)
Oox2Odf::Converter converter(srcTempPath, type, L"C:\\Windows\\Fonts", NULL);
std::wstring sPassword = L"password";
std::wstring sPassword = L"";//password";
converter.convert();
converter.write(dstTempPath, srcTempPath, sPassword);
converter.write(dstTempPath, srcTempPath, sPassword, L"hiuh56f56tfy7g");
NSDirectory::DeleteDirectory(srcTempPath);

View File

@ -124,6 +124,15 @@ namespace odf_writer
{
type_ = t;
}
documentID_file::documentID_file(std::wstring v)
{
value_ = v;
}
void documentID_file::write(const std::wstring & RootPath, bool add_padding)
{
simple_element elm(L"documentID", value_, false);
elm.write(RootPath, false);
}
mimetype_file::mimetype_file(std::wstring t)
{
type_ = t;
@ -291,6 +300,14 @@ namespace odf_writer
{
dynamic_cast<manifect_file*>(manifest_.get())->add_rels(r);
}
void odf_document::set_documentID(const std::wstring &value)
{
add_object(element_ptr(new documentID_file(value)));
rels rels_;
rels_.add(relationship(std::wstring(L"application/binary"), L"documentID"));
set_rels(rels_);
}
odf_document::odf_document(std::wstring type)
{

View File

@ -159,6 +159,17 @@ namespace odf_writer
rels rels_;
std::wstring type_;
};
class documentID_file : public element
{
public:
documentID_file(std::wstring value);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
private:
std::wstring value_;
};
class mimetype_file : public element
{
@ -219,11 +230,12 @@ namespace odf_writer
void set_rels(rels & r);
virtual void write(const std::wstring & RootPath, bool add_padding = false);
void write_manifest(const std::wstring & RootPath);
manifect_file* get_manifest() {return dynamic_cast<manifect_file*>(manifest_.get());}
void set_documentID(const std::wstring &value);
private:
element_ptr base_;
std::vector<element_ptr> objects_;

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

@ -462,42 +462,61 @@ void odf_text_context::end_list()
list_state_.levels.pop_back();
}
/////////////////////////////////////////////////////////////////////////////////////////// LIST
void odf_text_context::start_field(int type)
//------------------------------------------------------------------------------------------ LIST
bool odf_text_context::start_field(int type, const std::wstring& value)
{
if (single_paragraph_ == true) return;
if (single_paragraph_ == true) return false;
office_element_ptr elm;
if (type == 2)
switch(type)
{
create_element(L"text", L"page-number", elm, odf_context_);
text_page_number *page_numb = dynamic_cast<text_page_number*>(elm.get());
if (page_numb)
case fieldXE:
{
page_numb->text_select_page_ = L"current";
create_element(L"text", L"alphabetical-index-mark", elm, odf_context_);
text_alphabetical_index_mark *index = dynamic_cast<text_alphabetical_index_mark*>(elm.get());
if (index)
{
index->key1_ = value;
index->string_value_ = value;
}
}break;
case fieldPage:
{
create_element(L"text", L"page-number", elm, odf_context_);
text_page_number *page_numb = dynamic_cast<text_page_number*>(elm.get());
if (page_numb)
{
page_numb->text_select_page_ = L"current";
if ( (odf_context_->page_layout_context()) &&
(odf_context_->page_layout_context()->last_layout()) &&
(odf_context_->page_layout_context()->last_layout()->page_number_format))
{
if ( (odf_context_->page_layout_context()) &&
(odf_context_->page_layout_context()->last_layout()) &&
(odf_context_->page_layout_context()->last_layout()->page_number_format))
{
page_numb->common_num_format_attlist_.style_num_format_ = odf_context_->page_layout_context()->last_layout()->page_number_format;
}
}
}
if (type == 3)
{
create_element(L"text", L"page-count", elm, odf_context_);
}
if (type == 4)
{
create_element(L"text", L"date", elm, odf_context_);
page_numb->common_num_format_attlist_.style_num_format_ = odf_context_->page_layout_context()->last_layout()->page_number_format;
}
}
}break;
case fieldNumPages:
{
create_element(L"text", L"page-count", elm, odf_context_);
}break;
case fieldTime:
{
create_element(L"text", L"date", elm, odf_context_);
}break;
}
if (elm)
{
in_field_ = true;
start_element(elm);
return true;
}
return false;
}
void odf_text_context::end_field()

View File

@ -43,7 +43,23 @@
namespace cpdoccore {
namespace odf_writer
{
enum _typeField
{
fieldUnknown = 0,
fieldHyperlink,
fieldPage,
fieldNumPages,
fieldTime,
fieldPageRef,
fieldSeq,
fieldXE,
fieldBibliography = 0xff + 1,
fieldIndex,
fieldIllustration,
fieldTable,
fieldToc
};
class odf_conversion_context;
class odf_style_context;
class paragraph;
@ -80,7 +96,7 @@ public:
void start_element (office_element_ptr & elm, office_element_ptr style_elm = office_element_ptr(),std::wstring style_name = L"");
void end_element ();
void start_field (int type);
bool start_field (int type, const std::wstring& value);
void end_field ();
void start_span (bool styled = false);
@ -139,6 +155,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

@ -32,11 +32,11 @@
#include <boost/regex.hpp>
#include <boost/algorithm/string.hpp>
#include "../utils.h"
#include "odt_conversion_context.h"
#include "odf_text_context.h"
#include "styles.h"
@ -78,10 +78,6 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc
comment_context_(this), notes_context_(this), main_text_context_(NULL), table_context_(this)
{
current_field_.enabled = false;
current_field_.started = false;
current_field_.in_span = false;
is_hyperlink_ = false;
is_header_ = false;
@ -117,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++)
{
@ -286,8 +303,19 @@ void odt_conversion_context::end_drawings()
}
void odt_conversion_context::start_paragraph(bool styled)
{
if (current_field_.enabled && !current_field_.result) return; //Стандартное_составное_письмо.docx
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 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)
{
styles_context()->create_style(L"", odf_types::style_family::Paragraph, true, false, -1);
@ -345,45 +373,266 @@ void odt_conversion_context::add_paragraph_break(int type)
//}
}
}
void odt_conversion_context::start_table_of_content()
{
office_element_ptr elm;
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();
start_index_field();
}
void odt_conversion_context::end_alphabetical_index()
{
text_context()->end_element();
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 elm;
create_element(L"text", L"illustration-index", elm, this);
text_context()->start_element(elm);
add_to_root();
start_index_field();
}
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();
}
void odt_conversion_context::start_bibliography()
{
office_element_ptr elm;
create_element(L"text", L"bibliography", elm, this);
text_context()->start_element(elm);
add_to_root();
start_index_field();
}
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()
{
office_element_ptr elm;
create_element(L"text", L"table-index", elm, this);
text_context()->start_element(elm);
add_to_root();
start_index_field();
}
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;
office_element_ptr elm1, elm2;
create_element(L"text", L"index-body", elm1, this);
text_context()->start_element(elm1);
if (false == current_fields.back().title.empty())
{
create_element(L"text", L"index-title", elm2, this);
text_context()->start_element(elm2);
text_context()->end_element();
}
}
void odt_conversion_context::end_index_field()
{
text_context()->end_element();
text_context()->end_element();
}
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;
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;
is_hyperlink_ = true;
}
}
void odt_conversion_context::end_hyperlink()
{
if (!is_hyperlink_) return;
//current_level_.pop_back();
text_context()->end_element();
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;
std::vector<std::wstring> arOptions;
boost::algorithm::split(arOptions, value, boost::algorithm::is_any_of(L"\\"), boost::algorithm::token_compress_on);
for (size_t i = 0; i < arOptions.size(); i++)
{
std::wstring key = arOptions[i].substr(0, 1);
std::wstring value;
if (arOptions[i].length() > 2)
{
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));
}
return result;
}
void odt_conversion_context::set_field_instr(std::wstring instr)
{
if (current_field_.enabled == false) return;
if (current_fields.empty()) return;
current_fields.back().status = 1; //prepare
current_field_.type = 0; //users field
size_t res1 = instr.find(L"HYPERLINK");
if (std::wstring::npos != res1) //это не поле - это hyperlink
if (std::wstring::npos != res1)
{
current_field_.type = 1;
current_fields.back().type = fieldHyperlink;
current_fields.back().in_span = false;
std::wstring ref;
boost::match_results<std::wstring::const_iterator> res;
@ -391,66 +640,162 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
if (boost::regex_search(instr, res, r2))
{
ref = res[1].str();
current_field_.value = ref.substr(1, ref.length()-2);
current_fields.back().value = ref.substr(1, ref.length() - 2);
}
}
res1 = instr.find(L"NUMPAGES");
if (std::wstring::npos != res1 && current_field_.type == 0)
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_field_.type = 3;
current_fields.back().type = fieldNumPages;
}
res1 = instr.find(L"PAGEREF");
if (std::wstring::npos != res1 && current_field_.type == 0 ) //это не поле - это bookmark
if (std::wstring::npos != res1 && current_fields.back().type == 0 )
{
current_field_.type = 5;
current_fields.back().type = fieldPageRef;
if (instr.length() > 9)
current_field_.value = instr.substr(9, instr.length()-5);
current_fields.back().value = instr.substr(9, instr.length() - 5);
}
res1 = instr.find(L"PAGE");
if (std::wstring::npos != res1 && current_field_.type == 0)
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_field_.type = 2;
current_fields.back().type = fieldPage;
}
res1 = instr.find(L"TIME");
if (std::wstring::npos != res1 && current_field_.type == 0)
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_field_.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" ")//field-argument
{
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"XE");
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_fields.back().type = fieldXE;
std::map<std::wstring, std::wstring> options = parse_instr_options(instr.substr(3));
for (std::map<std::wstring, std::wstring>::iterator it = options.begin(); it != options.end(); ++it)
{
if (it->first == L" ")//field-argument
{
current_fields.back().value = it->second.substr(0, it->second.length() - 1);
}
}
}
res1 = instr.find(L"BIBLIOGRAPHY");
if (std::wstring::npos != res1 && current_field_.type == 0)
if (std::wstring::npos != res1 && current_fields.back().type == 0)
{
current_field_.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 = 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 = fieldIllustration;
current_fields.back().in_span = false;
std::map<std::wstring, std::wstring> options = parse_instr_options(instr.substr(res1 + 3));
std::map<std::wstring, std::wstring>::iterator pFind = options.find(L"c");
if ( pFind != options.end())
{
current_fields.back().captionSEQ = pFind->second;
}
pFind = options.find(L"h");
if ( pFind != options.end())
{
current_fields.back().bHyperlinks = true;
}
pFind = options.find(L"u"); //paragraph outline level
if ( pFind != options.end())
{
current_fields.back().type = fieldToc; //table of content
}
pFind = options.find(L"o");
if ( pFind != options.end())//table of content outline levels style
{
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
{
current_fields.back().bHidePageNumbers = true;
}
}
//////////////////////////////////////////
res1 = instr.find(L"@");
if (std::wstring::npos != res1)
{
current_field_.format = instr.substr(res1 + 1, instr.length());
current_fields.back().format = instr.substr(res1 + 1, instr.length());
}
if (current_field_.type == 0)
if (current_fields.back().type == 0)
{
res1 = instr.find(L" ");
if (std::wstring::npos != res1)
{
current_field_.name = instr.substr(0, res1);
current_fields.back().name = instr.substr(0, res1);
}
}
}
void odt_conversion_context::start_field(bool in_span)
{
current_field_.enabled = true;
current_field_.result = false;
current_field_.in_span = in_span;
current_field_.value.clear();
current_field_.name.clear();
current_field_.type = 0; // users field
if (false == current_fields.empty() && current_fields.back().status == 0)
return; //start_field из sdt
_field_state field;
current_fields.push_back(field);
}
void odt_conversion_context::separate_field()
{
current_field_.result = true;
if (current_fields.empty()) return;
current_fields.back().result = true;
}
void odt_conversion_context::set_master_page_name(std::wstring master_name)
{
@ -587,26 +932,44 @@ void odt_conversion_context::add_section_column(std::vector<std::pair<double, do
}
void odt_conversion_context::end_field()
{
if (current_field_.enabled && current_field_.started)
{
if (current_field_.type == 1) end_hyperlink();
else text_context()->end_field();
}
current_field_.value = L"";
current_field_.format = L"";
current_field_.name = L"";
if (current_fields.empty()) return;
current_field_.result = false;
current_field_.enabled = false;
current_field_.started = false;
current_field_.in_span = false;
if (current_fields.back().status == 2)
{
current_fields.back().status = 3;//prepare for delete
if (current_fields.back().type < 0xff)
{
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();
}
}
else if (current_fields.back().status == 0)
{
current_fields.pop_back();
}
}
void odt_conversion_context::end_paragraph()
{
if (current_field_.enabled && !current_field_.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();
}
@ -706,11 +1069,13 @@ void odt_conversion_context::start_run(bool styled)
{
if (is_hyperlink_ && text_context_.size() > 0) return;
if (current_field_.started == false && current_field_.type > 1 && current_field_.enabled == true && !current_field_.in_span)
if (!current_fields.empty() && current_fields.back().status == 1 && !current_fields.back().in_span && current_fields.back().type < 0xff)
{
text_context()->start_field(current_field_.type);
current_field_.started = true;
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, current_fields.back().value);
}
text_context()->start_span(styled);
@ -722,25 +1087,28 @@ void odt_conversion_context::start_run(bool styled)
props->apply_from(dynamic_cast<style_text_properties*>(drop_cap_state_.text_properties.get()));
}
if (current_field_.started == false && current_field_.type > 1 && current_field_.enabled == true && current_field_.in_span)//поле стартуется в span - нужно для сохранения стиля
if (!current_fields.empty() && current_fields.back().status == 1 && current_fields.back().in_span)//поле стартуется в span - нужно для сохранения стиля
{
text_context()->start_field(current_field_.type);
current_field_.started = true;
current_fields.back().status = 2;
text_context()->start_field(current_fields.back().type, current_fields.back().value);
}
}
void odt_conversion_context::end_run()
{
if (is_hyperlink_ && text_context_.size() > 0) return;
if (current_field_.in_span && current_field_.started== true && current_field_.enabled ==true) end_field();
if (!current_fields.empty() && current_fields.back().status == 1 && current_fields.back().in_span)
{
end_field();
}
text_context()->end_span();
if (current_field_.started== false && current_field_.type == 1 && current_field_.enabled ==true)
{
start_hyperlink(current_field_.value);
current_field_.started = true;
}
//if (current_field_.enabled == true && current_field_.started== false && current_field_.type == 1)
//{
// start_hyperlink(current_field_.value);
// current_field_.started = true;
//}
}
//--------------------------------------------------------------------------------------------------------
bool odt_conversion_context::start_comment(int oox_comm_id)

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,11 +90,33 @@ 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 ();
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();
void start_field (bool in_span);
void end_field ();
void separate_field ();
void set_field_instr (std::wstring instr);
std::map<std::wstring, std::wstring> parse_instr_options(const std::wstring& value);
void start_run (bool styled = false);
void end_run ();
@ -182,19 +201,32 @@ 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
{
_typeField type = fieldUnknown;
std::wstring name;
bool enabled;
int type;
std::wstring value;
std::wstring format;
bool started;
bool in_span;
bool result;
}current_field_;
short status = 0;//0, 1, 2, 3 - init, prapare, start, finish
bool in_span = false;
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;
struct _text_changes_state
{

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

@ -379,25 +379,30 @@ void text_table_of_content::serialize(std::wostream & _Wostream)
{
text_section_attr_.serialize(CP_GET_XML_NODE());
if (text_index_body_)
text_index_body_->serialize(CP_XML_STREAM());
if (table_of_content_source_)
table_of_content_source_->serialize(CP_XML_STREAM());
if (text_table_of_content_source_)
text_table_of_content_source_->serialize(CP_XML_STREAM());
if (index_body_)
index_body_->serialize(CP_XML_STREAM());
}
}
}
void text_table_of_content::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"text", L"index-body")
{
CP_CREATE_ELEMENT(text_index_body_);
}
if (L"text" == Ns && L"table-of-content-source" == Name) CP_CREATE_ELEMENT(table_of_content_source_);
else if CP_CHECK_NAME(L"text", L"index-body") CP_CREATE_ELEMENT(index_body_);
}
void text_table_of_content::add_child_element( const office_element_ptr & child_element)
{
text_index_body_ = child_element;
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextTableOfContentSource)
table_of_content_source_= child_element;
else if (type == typeTextIndexBody)
index_body_ = child_element;
}
//--------------------------------------------------------------------------------------------------------
@ -616,7 +621,7 @@ const wchar_t * text_table_index::name = L"table-index";
void text_table_index::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if (L"text" == Ns && L"index-body_" == Name) CP_CREATE_ELEMENT(index_body_);
if (L"text" == Ns && L"index-body" == Name) CP_CREATE_ELEMENT(index_body_);
else if (L"text" == Ns && L"table-index-source" == Name)CP_CREATE_ELEMENT(table_index_source_);
}
@ -654,7 +659,7 @@ const wchar_t * text_illustration_index::name = L"illustration-index";
void text_illustration_index::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if (L"text" == Ns && L"index-body_" == Name) CP_CREATE_ELEMENT(index_body_);
if (L"text" == Ns && L"index-body" == Name) CP_CREATE_ELEMENT(index_body_);
else if (L"text" == Ns && L"illustration-index-source" == Name) CP_CREATE_ELEMENT(illustration_index_source_);
}
@ -687,12 +692,50 @@ void text_illustration_index::serialize(std::wostream & _Wostream)
}
}
//------------------------------------------------------------
const wchar_t * text_user_index::ns = L"text";
const wchar_t * text_user_index::name = L"user-index";
void text_user_index::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if (L"text" == Ns && L"index-body" == Name) CP_CREATE_ELEMENT(index_body_);
else if (L"text" == Ns && L"user-index-source" == Name) CP_CREATE_ELEMENT(user_index_source_);
}
void text_user_index::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextUserIndexSource)
user_index_source_= child_element;
else if (type == typeTextIndexBody)
index_body_= child_element;
}
void text_user_index::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
section_attr_.serialize(CP_GET_XML_NODE());
if (user_index_source_)
user_index_source_->serialize(CP_XML_STREAM());
if (index_body_)
index_body_->serialize(CP_XML_STREAM());
}
}
}
//------------------------------------------------------------
const wchar_t * text_alphabetical_index::ns = L"text";
const wchar_t * text_alphabetical_index::name = L"alphabetical-index";
void text_alphabetical_index::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if (L"text" == Ns && L"index-body_" == Name) CP_CREATE_ELEMENT(index_body_);
if (L"text" == Ns && L"index-body" == Name) CP_CREATE_ELEMENT(index_body_);
else if (L"text" == Ns && L"alphabetical-index-source" == Name) CP_CREATE_ELEMENT(alphabetical_index_source_);
}
@ -730,7 +773,7 @@ const wchar_t * text_bibliography::name = L"bibliography";
void text_bibliography::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if (L"text" == Ns && L"index-body_" == Name) CP_CREATE_ELEMENT(index_body_);
if (L"text" == Ns && L"index-body" == Name) CP_CREATE_ELEMENT(index_body_);
else if (L"text" == Ns && L"bibliography-source" == Name) CP_CREATE_ELEMENT(bibliography_source_);
}
@ -898,6 +941,62 @@ void text_illustration_index_source::serialize(std::wostream & _Wostream)
}
}
//----------------------------------------------------------------------------------------------------------
const wchar_t * text_user_index_source::ns = L"text";
const wchar_t * text_user_index_source::name = L"user-index-source";
void text_user_index_source::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if (L"text" == Ns && L"index-title-template" == Name) CP_CREATE_ELEMENT(index_title_template_);
else CP_CREATE_ELEMENT(entry_templates_);
}
void text_user_index_source::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextIndexTitleTemplate)
index_title_template_ = child_element;
else
entry_templates_.push_back(child_element);
}
void text_user_index_source::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"text:index-name", index_name_);
CP_XML_ATTR_OPT(L"text:copy-outline-levels", copy_outline_levels_);
CP_XML_ATTR_OPT(L"text:use-chart-objects", use_chart_objects_);
CP_XML_ATTR_OPT(L"text:use-draw-objects", use_draw_objects_);
CP_XML_ATTR_OPT(L"text:use-graphics", use_graphics_);
CP_XML_ATTR_OPT(L"text:use-floating-frames", use_floating_frames_);
CP_XML_ATTR_OPT(L"text:use-index-marks", use_index_marks_);
CP_XML_ATTR_OPT(L"text:use-index_source_styles", use_index_source_styles_);
CP_XML_ATTR_OPT(L"text:use-objects", use_objects_);
CP_XML_ATTR_OPT(L"text:use-tables", use_tables_);
CP_XML_ATTR_OPT(L"text:relative_tab-stop-position", relative_tab_stop_position_);
CP_XML_ATTR_OPT(L"text:index-scope", index_scope_); // chapter or document
if (index_title_template_)
index_title_template_->serialize(CP_XML_STREAM());
for (size_t i = 0 ; i < index_source_styles_.size(); i++)
{
index_source_styles_[i]->serialize(CP_XML_STREAM());
}
for (size_t i = 0 ; i < entry_templates_.size(); i++)
{
entry_templates_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//----------------------------------------------------------------------------------------------------------
const wchar_t * alphabetical_index_source::ns = L"text";
const wchar_t * alphabetical_index_source::name = L"alphabetical-index-source";
@ -995,6 +1094,9 @@ const wchar_t * text_table_index_entry_template::name = L"table-index-entry-te
const wchar_t * text_table_of_content_entry_template::ns = L"text";
const wchar_t * text_table_of_content_entry_template::name = L"table-of-content-entry-template";
//----------------------------------------------------------------------------------------------------------
const wchar_t * text_user_index_entry_template::ns = L"text";
const wchar_t * text_user_index_entry_template::name = L"user-index-entry-template";
//----------------------------------------------------------------------------------------------------------
const wchar_t * text_bibliography_entry_template::ns = L"text";
const wchar_t * text_bibliography_entry_template::name = L"bibliography-entry-template";
@ -1153,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

@ -272,8 +272,8 @@ public:
text_section_attr text_section_attr_;
office_element_ptr text_table_of_content_source_;
office_element_ptr text_index_body_;
office_element_ptr table_of_content_source_;
office_element_ptr index_body_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_table_of_content);
@ -555,6 +555,30 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(text_alphabetical_index);
//---------------------------------------------------------------------------------------------------
// text:user-index
//---------------------------------------------------------------------------------------------------
class text_user_index : public office_element_impl<text_user_index>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextUserIndex;
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);
odf_types::section_attlists section_attr_;
office_element_ptr user_index_source_;
office_element_ptr index_body_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_user_index);
//------------------------------------------------------------------------------------------------------------
// text:bibliography
//------------------------------------------------------------------------------------------------------------
@ -654,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
//---------------------------------------------------------------------------------------------------
@ -928,6 +952,54 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(text_illustration_index_entry_template);
//---------------------------------------------------------------------------------------------------
//text:user-index-source
//---------------------------------------------------------------------------------------------------
class text_user_index_source: public office_element_impl<text_user_index_source>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextUserIndexSource;
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) index_name_;
_CP_OPT(odf_types::Bool) copy_outline_levels_;
_CP_OPT(odf_types::Bool) relative_tab_stop_position_;
_CP_OPT(odf_types::Bool) use_chart_objects_;
_CP_OPT(odf_types::Bool) use_draw_objects_;
_CP_OPT(odf_types::Bool) use_graphics_;
_CP_OPT(odf_types::Bool) use_floating_frames_;
_CP_OPT(odf_types::Bool) use_index_marks_;
_CP_OPT(odf_types::Bool) use_index_source_styles_;
_CP_OPT(odf_types::Bool) use_objects_;
_CP_OPT(odf_types::Bool) use_tables_;
_CP_OPT(std::wstring) index_scope_; // chapter or document:
office_element_ptr index_title_template_;
office_element_ptr_array entry_templates_;
office_element_ptr_array index_source_styles_;
};
CP_REGISTER_OFFICE_ELEMENT2(text_user_index_source);
//---------------------------------------------------------------------------------------------------
//text:user-index-entry-template
//---------------------------------------------------------------------------------------------------
class text_user_index_entry_template : public common_entry_template
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextUserIndexEntryTemplate;
CPDOCCORE_DEFINE_VISITABLE()
};
CP_REGISTER_OFFICE_ELEMENT2(text_user_index_entry_template);
//---------------------------------------------------------------------------------------------------
//text:alphabetical-index-source
//---------------------------------------------------------------------------------------------------
class alphabetical_index_source : public office_element_impl<alphabetical_index_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

@ -101,13 +101,13 @@ namespace Oox2Odf
impl_->convertDocument();
}
void Converter::write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password) const
void Converter::write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password, const std::wstring & documentID) const
{
if (!impl_)return;
if (impl_->bUserStopConvert) return;
return impl_->write(out_path, temp_path, password);
return impl_->write(out_path, temp_path, password, documentID);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -126,10 +126,15 @@ bool OoxConverter::UpdateProgress(long nComplete)
return FALSE;
}
void OoxConverter::write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password)
void OoxConverter::write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password, const std::wstring & documentID)
{
if (!output_document)return;
if (false == documentID.empty())
{
output_document->set_documentID(documentID);
}
if (password.empty())
{
output_document->write(out_path);
@ -192,6 +197,7 @@ bool OoxConverter::encrypt_document (const std::wstring &password, const std::ws
encrypt_file(password, inp_file_name, out_file_name, rels->relationships_[i].encryption_, rels->relationships_[i].size_);
}
return true;
}
bool OoxConverter::encrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, std::wstring &encrypt_info, int &size)
{

View File

@ -343,7 +343,7 @@ namespace Oox2Odf
public:
virtual void convertDocument() = 0;
void write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password);
void write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password, const std::wstring & documentID);
OoxConverter(const ProgressCallback* CallBack = NULL){
oox_current_child_document = NULL;

View File

@ -403,18 +403,47 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
void DocxConverter::convert(OOX::Logic::CSdt *oox_sdt)
{
if (oox_sdt == NULL) return;
//nullable<OOX::Logic::CSdtEndPr > m_oSdtEndPr;
//nullable<OOX::Logic::CSdtPr > m_oSdtPr;
bool bField = false;
if (oox_sdt->m_oSdtPr.IsInit())
{
if (oox_sdt->m_oSdtPr->m_oAlias.IsInit())//friendly name
{
}
if (oox_sdt->m_oSdtPr->m_oDocPartObj.IsInit())
{
if (oox_sdt->m_oSdtPr->m_oDocPartObj->m_oDocPartGallery.IsInit() &&
oox_sdt->m_oSdtPr->m_oDocPartObj->m_oDocPartGallery->m_sVal.IsInit())
{
if (*oox_sdt->m_oSdtPr->m_oDocPartObj->m_oDocPartGallery->m_sVal == L"List od Illustrations" ||
*oox_sdt->m_oSdtPr->m_oDocPartObj->m_oDocPartGallery->m_sVal == L"Table of Contents")
{
odt_context->start_field(false);
bField = true;
}
}
}
if (oox_sdt->m_oSdtPr->m_eType == OOX::Logic::sdttypeBibliography)
{
odt_context->start_field(false);
bField = true;
}
}
convert(oox_sdt->m_oSdtContent.GetPointer());
if (bField)
{
odt_context->end_field();
}
}
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 +636,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 +660,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 +720,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 +748,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 +761,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 +788,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();
@ -861,9 +890,9 @@ void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
if (oox_fld->m_sInstr.IsInit())
odt_context->set_field_instr(oox_fld->m_sInstr.get2());
for (std::vector<OOX::WritingElement*>::iterator it = oox_fld->m_arrItems.begin(); it != oox_fld->m_arrItems.end(); ++it)
for (size_t i = 0; i < oox_fld->m_arrItems.size(); ++i)
{
convert(*it);
convert(oox_fld->m_arrItems[i]);
}
}
odt_context->end_field();
@ -898,9 +927,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 +1132,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 +1143,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 +3065,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 +3642,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 +3667,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 +3694,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 +3711,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 +3890,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 +4006,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 +4066,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

@ -46,7 +46,7 @@ namespace Oox2Odf
void convert();
void write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password) const;
void write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password, const std::wstring & documentID) const;
OoxConverter * get_ooxConverter() { return impl_; }

View File

@ -3764,7 +3764,7 @@
"$(PROJECT_DIR)/../../../Common/ASCDocxFormat/Source",
"$(PROJECT_DIR)/../../../Common/3dParty/boost/boost_1_58_0",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = PPTXFormatLib_ios;
SDKROOT = iphoneos;
};
@ -3806,7 +3806,7 @@
"$(PROJECT_DIR)/../../../Common/ASCDocxFormat/Source",
"$(PROJECT_DIR)/../../../Common/3dParty/boost/boost_1_58_0",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = PPTXFormatLib_ios;
SDKROOT = iphoneos;
};

View File

@ -594,7 +594,7 @@
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/include",
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/devel",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -628,7 +628,7 @@
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/include",
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/devel",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;

View File

@ -1839,6 +1839,12 @@ bool RtfOleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, st
{
TextReader oTextReader( m_oOle.m_sOleClass, false );
StartSubReader( oTextReader, oDocument, oReader );
size_t pos = m_oOle.m_sOleClass.find(L"asc.");
if (std::wstring::npos != pos)
{
m_oOle.m_sOleClass = L"asc.{" + m_oOle.m_sOleClass.substr(pos + 4) + L"}";
}
}
else if ( "objdata" == sCommand )
{

View File

@ -34,7 +34,6 @@
#include "Writer/OOXRelsWriter.h"
#include "RtfDocument.h"
#include "../../../Common/OfficeFileFormatChecker.h"
std::wstring RtfOle::RenderToOOX(RenderParameter oRenderParameter)
{
@ -98,6 +97,7 @@ std::wstring RtfOle::RenderToOOX(RenderParameter oRenderParameter)
if (m_oResultShape)
{
m_oResultShape->m_bIsOle = true;
sResult += m_oResultShape->RenderToOOX(oNewRenderParameter);
oNewRenderParameter.nValue = m_oResultShape->m_nID;
@ -120,37 +120,6 @@ std::wstring RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
OOXRelsWriter * poRelsWriter = static_cast<OOXRelsWriter*> (oRenderParameter.poRels);
RtfDocument * poDocument = static_cast<RtfDocument*> (oRenderParameter.poDocument);
int ind_ole = poDocument->m_oIdGenerator.Generate_OleIndex();
std::wstring sName = L"oleObject" + std::to_wstring(ind_ole);
std::wstring sExtension = L"bin";
std::wstring sMime = L"application/vnd.openxmlformats-officedocument.oleObject";
std::wstring sRelsType = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
COfficeFileFormatChecker checker;
if (checker.isOfficeFile(m_sOleFilename))
{
switch(checker.nFileType)
{
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
{
sName = L"_____Microsoft_Excel" + ((ind_ole > 1) ? (L"_" + std::to_wstring(ind_ole - 1)) : L"");
sExtension = L"xlsx";
sMime = L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
sRelsType = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
m_sOleClass = L"Excel.Sheet.12";
}break;
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS:
{
sName = L"_____Microsoft_Excel_97-2003" + ((ind_ole > 1) ? (L"_" + std::to_wstring(ind_ole - 1)) : L"");
sExtension = L"xls";
sMime = L"application/vnd.ms-excel";
m_sOleClass = L"Excel.Sheet.8";
}break;
}
}
sResult += L"<o:OLEObject";
switch ( m_eOleType )
{
@ -161,9 +130,13 @@ std::wstring RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
sResult += L" ShapeID=\"_x0000_s" + std::to_wstring(poDocument->GetShapeId( oRenderParameter.nValue )) + L"\"";
sResult += L" DrawAspect=\"Content\"";
sResult += L" ObjectID=\"" + poDocument->m_oIdGenerator.Generate_OleId() + L"\"";
std::wstring sExtension = L"bin";
std::wstring sMime = L"application/vnd.openxmlformats-officedocument.oleObject";
std::wstring sFilenameRels;
sFilenameRels += sName + L"." + sExtension;
sFilenameRels += L"oleObject" + std::to_wstring(poDocument->m_oIdGenerator.Generate_OleIndex()) + L".";
sFilenameRels += sExtension;
std::wstring sFilenameFull = poOOXWriter->m_sTargetFolder + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"embeddings";
@ -175,7 +148,7 @@ std::wstring RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
Utils::CopyDirOrFile( m_sOleFilename, sFilenameFull );
poOOXWriter->m_oContentTypes.AddExtension( sMime, sExtension);
std::wstring srId = poRelsWriter->AddRelationship( sRelsType, sFilenameRels);
std::wstring srId = poRelsWriter->AddRelationship( L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject", sFilenameRels);
sResult += L" r:id=\"" + srId + L"\"";
sResult += L"/>";

View File

@ -803,7 +803,8 @@ std::wstring RtfShape::RenderToOOX(RenderParameter oRenderParameter)
}
std::wstring RtfShape::GetShapeNodeName()
{
if (m_bBackground) return L"v:background";
if (m_bBackground) return L"v:background";
if (m_bIsOle) return L"v:rect";
switch(m_nShapeType)
{
@ -1386,7 +1387,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
{
sPicture = m_oPicture->RenderToOOX(oRenderParameter);
if (m_nShapeType == PROP_DEF || m_nShapeType == 75)
if (m_nShapeType == PROP_DEF || m_nShapeType == 75 || m_bIsOle)
{
if( sPicture.empty() )//если не сохранилась картинка, то весь shape-picture будет бесполезным
return L"";

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

@ -37,7 +37,7 @@ nmake /f Makefile.vc mode=static ENABLE_WINSSL=yes MACHINE=%MACHINE% VC=12
if not exist "%SCRIPTPATH%%OUTPUT%" (
md %SCRIPTPATH%%OUTPUT%\build
xcopy /Y /S ..\builds\libcurl-vc12-%MACHINE%-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\
mv %SCRIPTPATH%%OUTPUT%\build\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\curl.lib
move %SCRIPTPATH%%OUTPUT%\build\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\curl.lib
)
cd ..\..
cd ..\..

View File

@ -59,6 +59,13 @@ else
svn export http://source.icu-project.org/repos/icu/tags/release-$ICU_MAJOR_VER-$ICU_MINOR_VER/icu4c ./icu
fi
# Workaround for building icu older than 60.0 on Archlinux
# See https://bugs.archlinux.org/task/55246
if [ -f "/etc/arch-release" ]; then
echo "Arch Linux detected. Applying 'xlocale.h' error patch"
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
fi
cd ./icu/source/
if [ ! -f "./Makefile" ]

View File

@ -0,0 +1,50 @@
#!/bin/bash
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
ICU_MAJOR_VER=62
ICU_MINOR_VER=1
SHARED_LIB_VER=$ICU_MAJOR_VER.$ICU_MINOR_VER
os=$(uname -s)
platform=""
case "$os" in
Linux*)
platform="linux"
BUILD_PLATFORM=Linux
SHARED_LIB_EXT=.so.$SHARED_LIB_VER
SHARED_LIB_SHORT_EXT=.so.$ICU_MAJOR_VER
;;
Darwin*)
platform="mac"
BUILD_PLATFORM=MacOSX
SHARED_LIB_EXT=.$SHARED_LIB_VER.dylib
SHARED_LIB_SHORT_EXT=.$ICU_MAJOR_VER.dylib
;;
*) exit ;;
esac
architecture=$(uname -m)
arch=""
case "$architecture" in
x86_64*) arch="_64" ;;
*) arch="_32" ;;
esac
rm -rf "$SCRIPTPATH/$platform$arch"
if [[ -d "$SCRIPTPATH/$platform$arch" ]]
then
echo
else
mkdir "$SCRIPTPATH/$platform$arch"
fi
cd "$SCRIPTPATH/$platform$arch"
svn export http://source.icu-project.org/repos/icu/tags/release-$ICU_MAJOR_VER-$ICU_MINOR_VER/icu4c ./icu

View File

@ -1,4 +1,5 @@
#!/bin/bash
set -e
SCRIPT=$(readlink -f "$0" || grealpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")

View File

@ -23,4 +23,4 @@ cd v8
call git checkout -b 6.0 -t branch-heads/6.0
cd ../
call gclient sync
call gclient sync --no-history

View File

@ -22,7 +22,7 @@ else
cd v8
fi
gclient sync
gclient sync --no-history
os=$(uname -s)
platform=""

View File

@ -13,7 +13,7 @@ if [ -d "$SCRIPTPATH/v8/third_party/binutils/Linux_ia32/Release" ]; then
fi
cd "$SCRIPTPATH/v8"
gclient sync
gclient sync --no-history
if [ -d "$SCRIPTPATH/v8/third_party/binutils/Linux_x64/Release/bin" ]; then
cd "$SCRIPTPATH/v8/third_party/binutils/Linux_x64/Release/bin"

View File

@ -218,6 +218,8 @@
69E6AC8D2031ACA900795D9D /* VbaProject.h in Headers */ = {isa = PBXBuildFile; fileRef = 69E6AC8B2031ACA900795D9D /* VbaProject.h */; };
69E6AC8F2031B72500795D9D /* Worksheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69E6AC8E2031B72500795D9D /* Worksheet.cpp */; };
69F181EC1C7734A700B2952B /* strings_hack_printf.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181EA1C7734A700B2952B /* strings_hack_printf.h */; };
8A218DBF20FCC770006589C2 /* StreamWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A218DBD20FCC76F006589C2 /* StreamWriter.h */; };
8A218DC020FCC770006589C2 /* StreamWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A218DBE20FCC770006589C2 /* StreamWriter.cpp */; };
8A404FCA2089FF7E00F2D5CF /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FC92089FF7E00F2D5CF /* Base64.cpp */; };
8A404FCC2089FFE700F2D5CF /* Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FCB2089FFE700F2D5CF /* Directory.cpp */; };
8A404FCE208A001E00F2D5CF /* Path.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A404FCD208A001D00F2D5CF /* Path.cpp */; };
@ -443,6 +445,8 @@
69E6AC8B2031ACA900795D9D /* VbaProject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VbaProject.h; sourceTree = "<group>"; };
69E6AC8E2031B72500795D9D /* Worksheet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Worksheet.cpp; sourceTree = "<group>"; };
69F181EA1C7734A700B2952B /* strings_hack_printf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = strings_hack_printf.h; path = ../../Common/DocxFormat/Source/Base/strings_hack_printf.h; sourceTree = "<group>"; };
8A218DBD20FCC76F006589C2 /* StreamWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamWriter.h; sourceTree = "<group>"; };
8A218DBE20FCC770006589C2 /* StreamWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StreamWriter.cpp; sourceTree = "<group>"; };
8A404FC92089FF7E00F2D5CF /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Base64.cpp; path = ../../../../DesktopEditor/common/Base64.cpp; sourceTree = "<group>"; };
8A404FCB2089FFE700F2D5CF /* Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Directory.cpp; path = ../../../../DesktopEditor/common/Directory.cpp; sourceTree = "<group>"; };
8A404FCD208A001D00F2D5CF /* Path.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Path.cpp; path = ../../../../DesktopEditor/common/Path.cpp; sourceTree = "<group>"; };
@ -925,6 +929,8 @@
17E6B3C01AC4298500F28F8B /* Path.h */,
17E6B3C11AC4298500F28F8B /* Types.h */,
69F181EA1C7734A700B2952B /* strings_hack_printf.h */,
8A218DBE20FCC770006589C2 /* StreamWriter.cpp */,
8A218DBD20FCC76F006589C2 /* StreamWriter.h */,
);
name = common;
path = ../../../../DesktopEditor/common;
@ -970,6 +976,7 @@
17C1FBEE1ACC4250006B99B3 /* MergeCells.h in Headers */,
17C1FBEF1ACC4250006B99B3 /* Docx.h in Headers */,
17C1FBF11ACC4250006B99B3 /* SimpleTypes_OMath.h in Headers */,
8A218DBF20FCC770006589C2 /* StreamWriter.h in Headers */,
17C1FBF21ACC4250006B99B3 /* StringOutput.h in Headers */,
17C1FBF41ACC4250006B99B3 /* Image.h in Headers */,
17C1FBF51ACC4250006B99B3 /* Dir.h in Headers */,
@ -1198,6 +1205,7 @@
17C1FBBA1ACC4250006B99B3 /* SimpleTypes_Word.cpp in Sources */,
17C1FBBB1ACC4250006B99B3 /* MathEquation.cpp in Sources */,
17C1FBBC1ACC4250006B99B3 /* Wrap.cpp in Sources */,
8A218DC020FCC770006589C2 /* StreamWriter.cpp in Sources */,
17C1FBBD1ACC4250006B99B3 /* Common.cpp in Sources */,
1732414A1BBEC90000E67992 /* pole.cpp in Sources */,
17C1FBBE1ACC4250006B99B3 /* IFileContainer.cpp in Sources */,
@ -1246,7 +1254,7 @@
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/devel",
"$(PROJECT_DIR)/../../../Common/3dParty/boost/boost_1_58_0",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = DocxFormatLib_ios;
SDKROOT = iphoneos;
};
@ -1288,7 +1296,7 @@
"$(PROJECT_DIR)/../../../DesktopEditor/freetype-2.5.2/devel",
"$(PROJECT_DIR)/../../../Common/3dParty/boost/boost_1_58_0",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = DocxFormatLib_ios;
SDKROOT = iphoneos;
};

View File

@ -3403,9 +3403,10 @@ namespace SimpleTypes
std::wstring result;
for (size_t i = 0 ; i < sText.length(); i++)
{
if (XmlUtils::IsUnicodeSymbol(sText[i]) == true)
WCHAR wChar = sText[i];
if (XmlUtils::IsUnicodeSymbol(wChar) == true && wChar > 0x20)
{
result += sText[i];
result += wChar;
}
}
return result;

View File

@ -601,7 +601,9 @@ namespace OOX
if ( _T("v:path") == sName )
pItem = new OOX::Vml::CPath( oSubReader );
break;
case 'r':
if ( _T("v:rect") == sName )
m_oShape = oSubReader;
case 's':
if ( _T("v:shadow") == sName )
pItem = new OOX::Vml::CShadow( oSubReader );
@ -662,7 +664,7 @@ namespace OOX
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:dxaOrig"), m_oDxaOrig )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("w:dxyOrig"), m_oDyaOrig )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("w:dyaOrig"), m_oDyaOrig )
WritingElement_ReadAttributes_End( oReader )
}
};

View File

@ -91,6 +91,12 @@ namespace OOX
bool FileInDirectoryCorrect();
AVSINLINE std::wstring GetBasename() const
{
std::wstring sFilename = GetFilename();
std::wstring sExt = GetExtention();
return sFilename.substr(0, sFilename.length() - sExt.length());
}
AVSINLINE std::wstring GetExtention(bool bIsPoint = true) const
{
int nFind = (int)m_strFilename.rfind('.');

View File

@ -229,6 +229,22 @@ namespace OOX
pWorkbookView->m_oWindowHeight->SetValue(9720);
}
}
LONG GetActiveSheetIndex()
{
LONG lActiveSheet = 0;
std::wstring sSheetRId = _T("Sheet1"); // Читаем не по rId, а по имени листа
// Get active sheet
if ( m_oBookViews.IsInit() && !m_oBookViews->m_arrItems.empty())
{
if (m_oBookViews->m_arrItems.front()->m_oActiveTab.IsInit())
{
lActiveSheet = m_oBookViews->m_arrItems.front()->m_oActiveTab->GetValue();
if (0 > lActiveSheet)
lActiveSheet = 0;
}
}
return lActiveSheet;
}
private:
CPath m_oReadPath;

View File

@ -376,6 +376,20 @@ namespace OOX
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
toXMLStart(writer);
for ( size_t i = 0; i < m_arrItems.size(); ++i)
{
if ( m_arrItems[i] )
{
m_arrItems[i]->toXML(writer);
}
}
toXMLEnd(writer);
}
virtual void toXMLStart(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<row"));
WritingStringNullableAttrBool(L"collapsed", m_oCollapsed);
@ -390,15 +404,9 @@ namespace OOX
WritingStringNullableAttrBool(L"thickBot", m_oThickBot);
WritingStringNullableAttrBool(L"thickTop", m_oThickTop);
writer.WriteString(_T(">"));
for ( size_t i = 0; i < m_arrItems.size(); ++i)
{
if ( m_arrItems[i] )
{
m_arrItems[i]->toXML(writer);
}
}
}
virtual void toXMLEnd(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("</row>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
@ -489,8 +497,7 @@ namespace OOX
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<sheetData>"));
toXMLStart(writer);
for ( size_t i = 0; i < m_arrItems.size(); ++i)
{
if ( m_arrItems[i] )
@ -498,7 +505,14 @@ namespace OOX
m_arrItems[i]->toXML(writer);
}
}
toXMLEnd(writer);
}
virtual void toXMLStart(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<sheetData>"));
}
virtual void toXMLEnd(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("</sheetData>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)

View File

@ -345,54 +345,71 @@ namespace OOX
}
void CWorksheet::write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
NSStringUtils::CStringBuilder sXml;
sXml.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\" xmlns:x14=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\" mc:Ignorable=\"x14ac\">"));
if(m_oSheetPr.IsInit())
m_oSheetPr->toXML(sXml);
if(m_oSheetViews.IsInit())
m_oSheetViews->toXML(sXml);
if(m_oSheetFormatPr.IsInit())
m_oSheetFormatPr->toXML(sXml);
if(m_oCols.IsInit())
m_oCols->toXML(sXml);
if(m_oSheetData.IsInit())
m_oSheetData->toXML(sXml);
if(m_oAutofilter.IsInit())
m_oAutofilter->toXML(sXml);
if(m_oMergeCells.IsInit())
m_oMergeCells->toXML(sXml);
for (size_t nIndex = 0, nLength = m_arrConditionalFormatting.size(); nIndex < nLength; ++nIndex)
m_arrConditionalFormatting[nIndex]->toXML(sXml);
if(m_oHyperlinks.IsInit())
m_oHyperlinks->toXML(sXml);
if(m_oPrintOptions.IsInit())
m_oPrintOptions->toXML(sXml);
if(m_oPageMargins.IsInit())
m_oPageMargins->toXML(sXml);
if(m_oPageSetup.IsInit())
m_oPageSetup->toXML(sXml);
if(m_oDrawing.IsInit())
m_oDrawing->toXML(sXml);
if(m_oLegacyDrawing.IsInit())
m_oLegacyDrawing->toXML(sXml);
if(m_oLegacyDrawingHF.IsInit())
m_oLegacyDrawingHF->toXML(sXml);
if(m_oOleObjects.IsInit())
m_oOleObjects->toXML(sXml);
if (m_oControls.IsInit())
m_oControls->toXML(sXml);
if(m_oTableParts.IsInit())
m_oTableParts->toXML(sXml);
if(m_oExtLst.IsInit())
if (m_sOutputFilename.empty())
{
sXml.WriteString(m_oExtLst->toXMLWithNS(_T("")));
NSStringUtils::CStringBuilder sXml;
toXMLStart(sXml);
if(m_oSheetPr.IsInit())
m_oSheetPr->toXML(sXml);
if(m_oSheetViews.IsInit())
m_oSheetViews->toXML(sXml);
if(m_oSheetFormatPr.IsInit())
m_oSheetFormatPr->toXML(sXml);
if(m_oCols.IsInit())
m_oCols->toXML(sXml);
if(m_oSheetData.IsInit())
m_oSheetData->toXML(sXml);
if(m_oAutofilter.IsInit())
m_oAutofilter->toXML(sXml);
if(m_oMergeCells.IsInit())
m_oMergeCells->toXML(sXml);
for (size_t nIndex = 0, nLength = m_arrConditionalFormatting.size(); nIndex < nLength; ++nIndex)
m_arrConditionalFormatting[nIndex]->toXML(sXml);
if(m_oHyperlinks.IsInit())
m_oHyperlinks->toXML(sXml);
if(m_oPrintOptions.IsInit())
m_oPrintOptions->toXML(sXml);
if(m_oPageMargins.IsInit())
m_oPageMargins->toXML(sXml);
if(m_oPageSetup.IsInit())
m_oPageSetup->toXML(sXml);
if(m_oDrawing.IsInit())
m_oDrawing->toXML(sXml);
if(m_oLegacyDrawing.IsInit())
m_oLegacyDrawing->toXML(sXml);
if(m_oLegacyDrawingHF.IsInit())
m_oLegacyDrawingHF->toXML(sXml);
if(m_oOleObjects.IsInit())
m_oOleObjects->toXML(sXml);
if (m_oControls.IsInit())
m_oControls->toXML(sXml);
if(m_oTableParts.IsInit())
m_oTableParts->toXML(sXml);
if(m_oExtLst.IsInit())
{
sXml.WriteString(m_oExtLst->toXMLWithNS(_T("")));
}
toXMLEnd(sXml);
NSFile::CFileBinary::SaveToFile(oPath.GetPath(), sXml.GetData());
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write( oPath, oDirectory, oContent );
}
sXml.WriteString(_T("</worksheet>"));
NSFile::CFileBinary::SaveToFile(oPath.GetPath(), sXml.GetData());
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write( oPath, oDirectory, oContent );
else
{
CPath oRealPath(oPath.GetDirectory() + FILE_SEPARATOR_STR + m_sOutputFilename);
oContent.Registration( type().OverrideType(), oDirectory, oRealPath.GetFilename() );
IFileContainer::Write( oRealPath, oDirectory, oContent );
}
}
void CWorksheet::toXMLStart(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\" xmlns:x14=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\" mc:Ignorable=\"x14ac\">"));
}
void CWorksheet::toXMLEnd(NSStringUtils::CStringBuilder& writer) const
{
writer.WriteString(_T("</worksheet>"));
}
const OOX::RId CWorksheet::AddHyperlink (std::wstring& sHref)
@ -427,4 +444,4 @@ namespace OOX
m_arrConditionalFormatting.clear();
}
}
}
}

View File

@ -90,6 +90,8 @@ namespace OOX
void PrepareComments(OOX::Spreadsheet::CComments* pComments, OOX::CVmlDrawing* pVmlDrawing);
void PrepareToWrite();
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const;
void toXMLStart(NSStringUtils::CStringBuilder& writer) const;
void toXMLEnd(NSStringUtils::CStringBuilder& writer) const;
virtual const OOX::FileType type() const
{
return OOX::Spreadsheet::FileTypes::Worksheet;

View File

@ -65,7 +65,7 @@ public:
static int GetFormatByExtension(const std::wstring& ext);
bool isOOXFormatFile (const std::wstring & fileName);
bool isOpenOfficeFormatFile (const std::wstring & fileName);
bool isOpenOfficeFormatFile (const std::wstring & fileName, std::wstring & documentID);
bool isOnlyOfficeFormatFile (const std::wstring & fileName);
bool isDocFormatFile (POLE::Storage *storage);
@ -74,11 +74,13 @@ public:
bool isMS_OFFCRYPTOFormatFile (POLE::Storage * storage, std::wstring & documentID);
bool isMS_OFFCRYPTOFormatFile (const std::wstring & fileName, std::wstring & documentID);
bool isDocFlatFormatFile (unsigned char* pBuffer,int dwBytes);
std::wstring getDocumentID (const std::wstring & fileName);
bool isDocFlatFormatFile(unsigned char* pBuffer,int dwBytes);
bool isRtfFormatFile (unsigned char* pBuffer,int dwBytes);
bool isHtmlFormatFile (unsigned char* pBuffer,int dwBytes, bool testCloseTag);
bool isPdfFormatFile (unsigned char* pBuffer,int dwBytes);
bool isPdfFormatFile (unsigned char* pBuffer,int dwBytes, std::wstring & documentID);
bool isOpenOfficeFlatFormatFile(unsigned char* pBuffer,int dwBytes);
bool isBinaryDoctFormatFile (unsigned char* pBuffer,int dwBytes);

View File

@ -117,24 +117,34 @@ bool COfficeFileFormatChecker::isBinaryPpttFormatFile (unsigned char* pBuffer,in
return false;
}
bool COfficeFileFormatChecker::isPdfFormatFile (unsigned char* pBuffer,int dwBytes)
bool COfficeFileFormatChecker::isPdfFormatFile (unsigned char* pBuffer,int dwBytes, std::wstring & documentID)
{
if (pBuffer == NULL) return false;
int nTempBufferSize = dwBytes < 20 ? dwBytes : 20;
if (nTempBufferSize < 1)
documentID.clear();
if (dwBytes < 1)
return false;
char* pTempBuffer = new char[nTempBufferSize];
pBuffer[dwBytes - 1] = '\0';
memcpy ( pTempBuffer, pBuffer, nTempBufferSize );
pTempBuffer[nTempBufferSize - 1] = '\0';
char* pFirst = strstr( (char*)pTempBuffer, "%PDF-" );
delete [] pTempBuffer;
char* pFirst = strstr( (char*)pBuffer, "%PDF-" );
if( NULL != pFirst )
{
pFirst = strstr( (char*)pBuffer, "%DocumentID " );
if( NULL != pFirst )
{
pFirst += 12;
char* pLast = strstr( pFirst, " ");
if( NULL != pLast )
{
std::string s(pFirst, pLast - pFirst);
documentID = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)s.c_str(), s.length());
}
}
return true;
}
return false;
}
@ -232,6 +242,49 @@ bool COfficeFileFormatChecker::isPptFormatFile (POLE::Storage * storage)
return true;
}
std::wstring COfficeFileFormatChecker::getDocumentID (const std::wstring & _fileName )
{
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
std::wstring fileName = CorrectPathW(_fileName);
#else
std::wstring fileName = _fileName;
#endif
std::wstring documentID;
POLE::Storage storage(fileName.c_str());
if (storage.open())
{
if ( isMS_OFFCRYPTOFormatFile(&storage, documentID) )
{
nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO;
}
}
else
{
if ( false == isOpenOfficeFormatFile(fileName, sDocumentID))
{
NSFile::CFileBinary file;
if (!file.OpenFile(fileName))
return documentID;
unsigned char* buffer = new unsigned char[4096]; //enaf !!
if (!buffer){file.CloseFile();return documentID;}
DWORD dwReadBytes = 0;
file.ReadFile(buffer, MIN_SIZE_BUFFER, dwReadBytes);
file.CloseFile();
if (isPdfFormatFile(buffer, (int)dwReadBytes, sDocumentID) )
{
nFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
}
}
}
return documentID;
}
bool COfficeFileFormatChecker::isMS_OFFCRYPTOFormatFile (const std::wstring & _fileName, std::wstring & documentID)
{
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
@ -256,6 +309,8 @@ bool COfficeFileFormatChecker::isMS_OFFCRYPTOFormatFile (POLE::Storage * storage
{
if (storage == NULL) return false;
documentID.clear();
bool result = false;
std::list<std::wstring> entries = storage->entries(L"DataSpaces");
if (entries.size() > 0)
@ -331,10 +386,10 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
COfficeUtils OfficeUtils(NULL);
if (OfficeUtils.IsArchive(fileName) == S_OK)
{
if ( isOOXFormatFile(fileName) ) return true;
else if ( isOpenOfficeFormatFile(fileName) ) return true;
else if ( isOnlyOfficeFormatFile(fileName) ) return true;
else if ( isXpsFile(fileName) ) return true;
if ( isOOXFormatFile(fileName) ) return true;
else if ( isOpenOfficeFormatFile(fileName, sDocumentID) ) return true;
else if ( isOnlyOfficeFormatFile(fileName) ) return true;
else if ( isXpsFile(fileName) ) return true;
}
//-----------------------------------------------------------------------------------------------
// others
@ -366,7 +421,7 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
{
nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION;
}
else if (isPdfFormatFile(buffer,sizeRead) )
else if (isPdfFormatFile(buffer,sizeRead, sDocumentID) )
{
nFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
}
@ -569,8 +624,10 @@ bool COfficeFileFormatChecker::isOnlyOfficeFormatFile(const std::wstring & fileN
}
return false;
}
bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring & fileName)
bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring & fileName, std::wstring & documentID)
{
documentID.clear();
const char *odtFormatLine = "application/vnd.oasis.opendocument.text";
const char *odsFormatLine = "application/vnd.oasis.opendocument.spreadsheet";
const char *odpFormatLine = "application/vnd.oasis.opendocument.presentation";
@ -584,7 +641,17 @@ bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring & fileN
ULONG nBufferSize = 0;
BYTE *pBuffer = NULL;
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"mimetype", &pBuffer, nBufferSize);
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"documentID", &pBuffer, nBufferSize);
if (hresult == S_OK && pBuffer != NULL)
{
documentID = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8(pBuffer, nBufferSize);
delete []pBuffer;
pBuffer = NULL;
}
nBufferSize = 0;
hresult = OfficeUtils.LoadFileFromArchive(fileName, L"mimetype", &pBuffer, nBufferSize);
if (hresult == S_OK && pBuffer != NULL)
{
if ( NULL != strstr((char*)pBuffer, ottFormatLine) )
@ -620,10 +687,12 @@ bool COfficeFileFormatChecker::isOpenOfficeFormatFile(const std::wstring & fileN
pBuffer = NULL;
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN) return true;
}else
}
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

@ -2,8 +2,8 @@
VERSION = $$cat(version.txt)
DEFINES += INTVER=$$VERSION
QMAKE_TARGET_COMPANY = Ascensio System SIA
QMAKE_TARGET_COPYRIGHT = Ascensio System SIA Copyright (c) 2018
QMAKE_TARGET_COMPANY = $$cat(copyright.txt)
QMAKE_TARGET_COPYRIGHT = $$cat(copyright.txt) (c) 2018
# CONFIGURATION
CONFIG(debug, debug|release) {

1
Common/copyright.txt Normal file
View File

@ -0,0 +1 @@
Ascensio System SIA

View File

@ -97,6 +97,9 @@ SOURCES += ./../DesktopEditor/common/Base64.cpp
HEADERS += ./../DesktopEditor/common/File.h
SOURCES += ./../DesktopEditor/common/File.cpp
HEADERS += ./../DesktopEditor/common/StreamWriter.h
SOURCES += ./../DesktopEditor/common/StreamWriter.cpp
# DIRECTORY
HEADERS += ./../DesktopEditor/common/Directory.h
SOURCES += ./../DesktopEditor/common/Directory.cpp

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<int> m_nSlideAdvanceDuration;
js_wrapper<bool> m_bSlideAdvanceOnMouseClick;
js_wrapper<bool> m_bSlideAdvanceAfter;
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_INT_JS(SlideAdvanceDuration)
LINK_PROPERTY_BOOL_JS(SlideAdvanceOnMouseClick)
LINK_PROPERTY_BOOL_JS(SlideAdvanceAfter)
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

@ -688,6 +688,10 @@
#define ASC_MENU_EVENT_TYPE_TABLEMERGECELLS 15
#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
#define ASC_MENU_EVENT_TYPE_THEME_THUMBNAILS 21
#define ASC_MENU_EVENT_TYPE_LAYOUT_THUMBNAILS 22
// insert commands
#define ASC_MENU_EVENT_TYPE_INSERT_IMAGE 50

View File

@ -130,9 +130,9 @@ namespace NSFile
public:
CFileBinary();
~CFileBinary();
virtual ~CFileBinary();
void CloseFile();
virtual void CloseFile();
FILE* GetFileNative();
long GetFileSize();

View File

@ -0,0 +1,70 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "StreamWriter.h"
namespace NSFile
{
CStreamWriter::CStreamWriter(size_t bufferSize)
{
m_lSize = bufferSize;
m_pData = (wchar_t*)malloc(bufferSize * sizeof(wchar_t));
m_lSizeCur = 0;
m_pDataCur = m_pData;
}
void CStreamWriter::AddSize(size_t nSize)
{
if ((m_lSizeCur + nSize) > m_lSize)
{
Flush();
if ((m_lSizeCur + nSize) > m_lSize)
{
NSStringUtils::CStringBuilder::AddSize(nSize);
}
}
}
void CStreamWriter::CloseFile()
{
Flush();
CFileBinary::CloseFile();
}
void CStreamWriter::Flush()
{
if (m_lSizeCur > 0)
{
CFileBinary::WriteStringUTF8(NSStringUtils::CStringBuilder::GetData());
}
m_lSizeCur = 0;
m_pDataCur = m_pData;
}
}

View File

@ -0,0 +1,51 @@
/*
* (c) Copyright Ascensio System SIA 2010-2018
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _BUILD_STREAM_WRITER_CROSSPLATFORM_H_
#define _BUILD_STREAM_WRITER_CROSSPLATFORM_H_
#include "File.h"
#include "StringBuilder.h"
namespace NSFile
{
class KERNEL_DECL CStreamWriter : public CFileBinary, public NSStringUtils::CStringBuilder
{
public:
CStreamWriter(size_t bufferSize = 16777216);
void AddSize(size_t nSize);
void CloseFile();
void Flush();
};
}
#endif // _BUILD_STREAM_WRITER_CROSSPLATFORM_H_

View File

@ -78,7 +78,7 @@ namespace NSStringUtils
class KERNEL_DECL CStringBuilder
{
private:
protected:
wchar_t* m_pData;
size_t m_lSize;
@ -87,9 +87,9 @@ namespace NSStringUtils
public:
CStringBuilder();
~CStringBuilder();
virtual ~CStringBuilder();
void AddSize(size_t nSize);
virtual void AddSize(size_t nSize);
public:

View File

@ -492,7 +492,7 @@ namespace NSCommon
pImageData[i] = 0;
}
NSGraphics::IGraphicsRenderer pRenderer = NSGraphics::Create();
NSGraphics::IGraphicsRenderer* pRenderer = NSGraphics::Create();
pRenderer->CreateFromBgraFrame(&oFrame);
pRenderer->SetFontManager(pManager);

View File

@ -180,6 +180,11 @@ namespace NSThreads
Join();
RELEASEOBJECT(m_hThread);
}
void CBaseThread::StopNoJoin()
{
m_bRunThread = FALSE;
RELEASEOBJECT(m_hThread);
}
INT CBaseThread::IsSuspended() { return m_bSuspend; }
INT CBaseThread::IsRunned() { return m_bRunThread; }

View File

@ -73,6 +73,7 @@ namespace NSThreads
virtual void Suspend();
virtual void Resume();
virtual void Stop();
virtual void StopNoJoin();
INT IsSuspended();
INT IsRunned();

View File

@ -120,7 +120,7 @@ public:
void SaveBrush(NSStructures::CBrush& oBrush) { oBrush = m_oBrush; }
void RestoreBrush(const NSStructures::CBrush& oBrush) { m_oBrush = oBrush; }
virtual void SetSwapRGB(bool bValue){ if (m_pRenderer) m_pRenderer->m_bSwapRGB = bValue; }
void SetTileImageDpi(const double& dDpi) { if (m_pRenderer) m_pRenderer->m_dDpiTile = dDpi; }
virtual void SetTileImageDpi(const double& dDpi) { if (m_pRenderer) m_pRenderer->m_dDpiTile = dDpi; }
void Save();
void Restore();

View File

@ -83,6 +83,7 @@ namespace NSGraphics
virtual void CloseFont() = 0;
virtual void SetSwapRGB(bool bValue) = 0;
virtual void SetTileImageDpi(const double& dDpi) = 0;
public:
virtual void CreateFromBgraFrame(CBgraFrame* pFrame) = 0;

View File

@ -488,7 +488,7 @@
../../../Common/DocxFormat/Source/XML/libxml2/XML/include/libxml,
../../../Common/DocxFormat/Source/XML/libxml2/XML/include,
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -530,7 +530,7 @@
../../../Common/DocxFormat/Source/XML/libxml2/XML/include/libxml,
../../../Common/DocxFormat/Source/XML/libxml2/XML/include,
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -812,7 +812,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../agg-2.4/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = agg_ios;
SDKROOT = iphoneos;
};
@ -838,7 +838,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../agg-2.4/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = agg_ios;
SDKROOT = iphoneos;
};
@ -889,7 +889,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -936,7 +936,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;

View File

@ -362,7 +362,7 @@
"$(PROJECT_DIR)/../../cximage/zlib",
"$(PROJECT_DIR)/../../cximage/jasper/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = cximage_ios;
SDKROOT = iphoneos;
};
@ -388,7 +388,7 @@
"$(PROJECT_DIR)/../../cximage/zlib",
"$(PROJECT_DIR)/../../cximage/jasper/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = cximage_ios;
SDKROOT = iphoneos;
};
@ -439,7 +439,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -486,7 +486,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;

View File

@ -584,7 +584,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -631,7 +631,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -656,7 +656,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../../cximage/jasper/include/",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = jasper_ios;
SDKROOT = iphoneos;
};
@ -680,7 +680,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../../cximage/jasper/include/",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = jasper_ios;
SDKROOT = iphoneos;
};

View File

@ -171,7 +171,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -218,7 +218,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -239,7 +239,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../../cximage/zlib/",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = jbig_ios;
SDKROOT = iphoneos;
};
@ -259,7 +259,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../../cximage/zlib/",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = jbig_ios;
SDKROOT = iphoneos;
};

View File

@ -479,7 +479,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -526,7 +526,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -542,7 +542,7 @@
GCC_ENABLE_CPP_RTTI = YES;
GCC_PREPROCESSOR_DEFINITIONS = _IOS;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = jpeg_ios;
SDKROOT = iphoneos;
};
@ -557,7 +557,7 @@
GCC_ENABLE_CPP_RTTI = YES;
GCC_PREPROCESSOR_DEFINITIONS = _IOS;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = jpeg_ios;
SDKROOT = iphoneos;
};

View File

@ -407,7 +407,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -454,7 +454,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -474,7 +474,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../../cximage/zlib/",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = libpsd_ios;
SDKROOT = iphoneos;
};
@ -493,7 +493,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../../cximage/zlib/",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = libpsd_ios;
SDKROOT = iphoneos;
};

View File

@ -398,7 +398,7 @@
/usr/include,
"$(PROJECT_DIR)/../../../cximage/zlib",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = mng_ios;
SDKROOT = iphoneos;
};
@ -425,7 +425,7 @@
/usr/include,
"$(PROJECT_DIR)/../../../cximage/zlib",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = mng_ios;
SDKROOT = iphoneos;
};

View File

@ -251,7 +251,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -298,7 +298,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -318,7 +318,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../../cximage/zlib/",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = png_ios;
SDKROOT = iphoneos;
};
@ -337,7 +337,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../../cximage/zlib/",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = png_ios;
SDKROOT = iphoneos;
};

View File

@ -167,7 +167,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -214,7 +214,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -229,7 +229,7 @@
GCC_ENABLE_CPP_EXCEPTIONS = YES;
GCC_ENABLE_CPP_RTTI = YES;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = raw_ios;
SDKROOT = iphoneos;
};
@ -243,7 +243,7 @@
GCC_ENABLE_CPP_EXCEPTIONS = YES;
GCC_ENABLE_CPP_RTTI = YES;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = raw_ios;
SDKROOT = iphoneos;
};

View File

@ -363,7 +363,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -410,7 +410,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
@ -429,7 +429,7 @@
_LINUX,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = tiff_ios;
SDKROOT = iphoneos;
};
@ -447,7 +447,7 @@
_LINUX,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = tiff_ios;
SDKROOT = iphoneos;
};

View File

@ -262,7 +262,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../freetype-2.5.2/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = fontengine_ios;
SDKROOT = iphoneos;
};
@ -287,7 +287,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(PROJECT_DIR)/../../freetype-2.5.2/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = fontengine_ios;
SDKROOT = iphoneos;
};

View File

@ -600,7 +600,7 @@
"$(PROJECT_DIR)/../../freetype-2.5.2/include",
"$(PROJECT_DIR)/../../freetype-2.5.2/devel",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = freetype_ios;
SDKROOT = iphoneos;
};
@ -624,7 +624,7 @@
"$(PROJECT_DIR)/../../freetype-2.5.2/include",
"$(PROJECT_DIR)/../../freetype-2.5.2/devel",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = freetype_ios;
SDKROOT = iphoneos;
};
@ -675,7 +675,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -722,7 +722,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;

View File

@ -363,7 +363,7 @@
"$(PROJECT_DIR)/../../agg-2.4/include",
"$(PROJECT_DIR)/../../freetype-2.5.2/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = graphics_ios;
SDKROOT = iphoneos;
};
@ -392,7 +392,7 @@
"$(PROJECT_DIR)/../../agg-2.4/include",
"$(PROJECT_DIR)/../../freetype-2.5.2/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = graphics_ios;
SDKROOT = iphoneos;
};

View File

@ -1060,7 +1060,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@ -1107,7 +1107,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
@ -1125,7 +1125,7 @@
"$(PROJECT_DIR)/../../agg-2.4/include",
"$(PROJECT_DIR)/../../freetype-2.5.2/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = metafile_ios;
SKIP_INSTALL = YES;
@ -1143,7 +1143,7 @@
"$(PROJECT_DIR)/../../agg-2.4/include",
"$(PROJECT_DIR)/../../freetype-2.5.2/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = metafile_ios;
SKIP_INSTALL = YES;

View File

@ -144,7 +144,7 @@
_IOS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = raster_ios;
SDKROOT = iphoneos;
};
@ -164,7 +164,7 @@
_IOS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
PRODUCT_NAME = raster_ios;
SDKROOT = iphoneos;
};
@ -215,7 +215,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@ -262,7 +262,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;

View File

@ -39,6 +39,10 @@
#include "../../common/StringBuilder.h"
#ifndef XML_UNUSED
#define XML_UNUSED( arg ) ( (arg) = (arg) )
#endif
namespace XmlUtils
{
typedef enum XmlNodeType
@ -64,6 +68,12 @@ namespace XmlUtils
_XmlNodeType_Last = 17
} XmlNodeType;
typedef enum {
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
XML_C14N_1_1 = 2 /* C14N 1.1 spec */
} xmlC14NMode;
class CXmlLiteReader_Private;
class KERNEL_DECL CXmlLiteReader
{
@ -178,6 +188,8 @@ namespace XmlUtils
std::wstring ReadAttributeBase(const wchar_t* bstrName);
std::wstring ReadAttribute(const std::wstring& strAttibuteName);
void ReadAllAttributesA(std::vector<std::string>& strNames, std::vector<std::string>& strValues);
void ReadAllAttributes(std::vector<std::wstring>& strNames, std::vector<std::wstring>& strValues);
int GetAttributesCount();
void GetAllAttributes(std::vector<std::wstring>& names, std::vector<std::wstring>& values);
@ -302,6 +314,12 @@ namespace XmlUtils
{ \
value = node.ReadNodeTextBase(name); \
}
namespace NSXmlCanonicalizator
{
std::string KERNEL_DECL Execute(const std::string& sXml, int mode = XML_C14N_1_0, bool withComments = false);
std::string KERNEL_DECL Execute(const std::wstring& sXmlFile, int mode = XML_C14N_1_0, bool withComments = false);
}
}
#endif // _BUILD_XMLUTILS_CROSSPLATFORM_H_

View File

@ -437,6 +437,32 @@ namespace XmlUtils
return GetAttribute(std::wstring(strAttibuteName));
}
void CXmlNode::ReadAllAttributesA(std::vector<std::string>& strNames, std::vector<std::string>& strValues)
{
if (!IsValid())
return;
std::map<std::string, std::string>::iterator p;
for (p = m_pBase->m_attributes.begin(); p != m_pBase->m_attributes.end(); ++p)
{
strNames.push_back(p->first);
strValues.push_back(p->second);
}
}
void CXmlNode::ReadAllAttributes(std::vector<std::wstring>& strNames, std::vector<std::wstring>& strValues)
{
if (!IsValid())
return;
std::map<std::string, std::string>::iterator p;
for (p = m_pBase->m_attributes.begin(); p != m_pBase->m_attributes.end(); ++p)
{
strNames.push_back (NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)p->first.c_str(), (long)p->first.length()));
strValues.push_back (NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)p->second.c_str(), (long)p->second.length()));
}
}
std::string CXmlNode::GetAttributeA(const std::string& sName, const std::string& _default)
{
if (!IsValid())
@ -956,3 +982,73 @@ namespace XmlUtils
WriteString(L"\"");
}
}
namespace XmlUtils
{
class CXmlBuffer
{
public:
NSStringUtils::CStringBuilderA builder;
public:
CXmlBuffer()
{
}
~CXmlBuffer()
{
}
};
static int buffer_xmlBufferIOWrite(CXmlBuffer* buf, const char* buffer, int len)
{
buf->builder.WriteString(buffer, (size_t)len);
return len;
}
static int buffer_xmlBufferIOClose(CXmlBuffer* buf)
{
XML_UNUSED(buf);
return 0;
}
static int buffer_xmlC14NIsVisibleCallback(void * user_data, xmlNodePtr node, xmlNodePtr parent)
{
XML_UNUSED(user_data);
XML_UNUSED(parent);
if (node->type == XML_TEXT_NODE)
{
const char* cur = (char*)node->content;
size_t size = strlen(cur);
for (size_t i = 0; i < size; ++i, ++cur)
{
if (*cur != '\n' && *cur != '\r' && *cur != '\t')
return 1;
}
return 0;
}
return 1;
}
std::string NSXmlCanonicalizator::Execute(const std::string& sXml, int mode, bool withComments)
{
xmlDocPtr xmlDoc = xmlParseMemory((char*)sXml.c_str(), (int)sXml.length());
CXmlBuffer bufferC14N;
xmlOutputBufferPtr _buffer = xmlOutputBufferCreateIO((xmlOutputWriteCallback)buffer_xmlBufferIOWrite,
(xmlOutputCloseCallback)buffer_xmlBufferIOClose,
&bufferC14N,
NULL);
xmlC14NExecute(xmlDoc, buffer_xmlC14NIsVisibleCallback, NULL, mode, NULL, withComments ? 1 : 0, _buffer);
xmlOutputBufferClose(_buffer);
return bufferC14N.builder.GetData();
}
std::string NSXmlCanonicalizator::Execute(const std::wstring& sXmlFile, int mode, bool withComments)
{
std::string sXml;
NSFile::CFileBinary::ReadAllTextUtf8A(sXmlFile, sXml);
return Execute(sXml, mode, withComments);
}
}

View File

@ -36,6 +36,7 @@
#include "../libxml2/libxml.h"
#include "../libxml2/include/libxml/xmlreader.h"
#include "../libxml2/include/libxml/c14n.h"
#include "../include/xmlutils.h"
namespace XmlUtils

View File

@ -16,8 +16,7 @@ CORE_ROOT_DIR = $$PWD/../../..
PWD_ROOT_DIR = $$PWD
include($$CORE_ROOT_DIR/Common/base.pri)
CONFIG += core_static_link_xml_full
include($$CORE_ROOT_DIR/DesktopEditor/xml/build/qt/libxml2.pri)
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lkernel
DEFINES -= UNICODE

View File

@ -69,7 +69,7 @@ public:
std::string GetHashXml(const std::wstring& xml)
{
std::string sXmlSigned = U_TO_UTF8(xml);
sXmlSigned = CXmlCanonicalizator::Execute(sXmlSigned, XML_C14N_1_0);
sXmlSigned = XmlUtils::NSXmlCanonicalizator::Execute(sXmlSigned, XmlUtils::XML_C14N_1_0);
return m_certificate->GetHash(sXmlSigned, m_certificate->GetHashAlg());
}
@ -517,7 +517,7 @@ Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-sign
sSignedXml += sXml;
sSignedXml += L"</xd:SignedProperties>";
std::string sXmlTmp = CXmlCanonicalizator::Execute(U_TO_UTF8(sSignedXml), XML_C14N_1_0);
std::string sXmlTmp = XmlUtils::NSXmlCanonicalizator::Execute(U_TO_UTF8(sSignedXml), XmlUtils::XML_C14N_1_0);
m_signed_info.WriteString("<Reference Type=\"http://uri.etsi.org/01903#SignedProperties\" URI=\"#idSignedProperties\">");
m_signed_info.WriteString("<Transforms><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>");
@ -568,7 +568,7 @@ Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-sign
std::string sSignedInfoData = m_signed_info.GetData();
std::string sSignedXml = "<SignedInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">" + sSignedInfoData + "</SignedInfo>";
sSignedXml = CXmlCanonicalizator::Execute(sSignedXml, XML_C14N_1_0);
sSignedXml = XmlUtils::NSXmlCanonicalizator::Execute(sSignedXml, XmlUtils::XML_C14N_1_0);
sSignedXml = m_certificate->Sign(sSignedXml);
NSStringUtils::CStringBuilder builderResult;

View File

@ -1,4 +1,3 @@
#include "./XmlCanonicalizator.h"
#include "./XmlTransform.h"
#include "./../include/OOXMLVerifier.h"

View File

@ -1,88 +0,0 @@
#ifndef _XML_CANONICALIZATOR_H_
#define _XML_CANONICALIZATOR_H_
#include "../../../common/File.h"
#include "../../../common/Directory.h"
#include "../../../common/StringBuilder.h"
#include "../../../xml/include/xmlutils.h"
#include "../../../xml/libxml2/include/libxml/c14n.h"
#ifndef XML_UNUSED
#define XML_UNUSED( arg ) ( (arg) = (arg) )
#endif
class CXmlCanonicalizator
{
private:
class CXmlBuffer
{
public:
NSStringUtils::CStringBuilderA builder;
public:
CXmlBuffer()
{
}
~CXmlBuffer()
{
}
};
static int buffer_xmlBufferIOWrite(CXmlBuffer* buf, const char* buffer, int len)
{
buf->builder.WriteString(buffer, (size_t)len);
return len;
}
static int buffer_xmlBufferIOClose(CXmlBuffer* buf)
{
XML_UNUSED(buf);
return 0;
}
static int buffer_xmlC14NIsVisibleCallback(void * user_data, xmlNodePtr node, xmlNodePtr parent)
{
XML_UNUSED(user_data);
XML_UNUSED(parent);
if (node->type == XML_TEXT_NODE)
{
const char* cur = (char*)node->content;
size_t size = strlen(cur);
for (size_t i = 0; i < size; ++i, ++cur)
{
if (*cur != '\n' && *cur != '\r' && *cur != '\t')
return 1;
}
return 0;
}
return 1;
}
public:
static std::string Execute(const std::string& sXml, int mode = XML_C14N_1_0, bool withComments = false)
{
xmlDocPtr xmlDoc = xmlParseMemory((char*)sXml.c_str(), (int)sXml.length());
CXmlBuffer bufferC14N;
xmlOutputBufferPtr _buffer = xmlOutputBufferCreateIO((xmlOutputWriteCallback)buffer_xmlBufferIOWrite,
(xmlOutputCloseCallback)buffer_xmlBufferIOClose,
&bufferC14N,
NULL);
xmlC14NExecute(xmlDoc, buffer_xmlC14NIsVisibleCallback, NULL, mode, NULL, withComments ? 1 : 0, _buffer);
xmlOutputBufferClose(_buffer);
return bufferC14N.builder.GetData();
}
static std::string Execute(const std::wstring& sXmlFile, int mode = XML_C14N_1_0, bool withComments = false)
{
std::string sXml;
NSFile::CFileBinary::ReadAllTextUtf8A(sXmlFile, sXml);
return Execute(sXml, mode, withComments);
}
};
#endif //_XML_CANONICALIZATOR_H_

View File

@ -1,7 +1,10 @@
#ifndef _XML_RELS_H_
#define _XML_RELS_H_
#include "./XmlCanonicalizator.h"
#include "../../../xml/include/xmlutils.h"
#include "../../../common/StringBuilder.h"
#include "../../../common/File.h"
#include "../../../common/Directory.h"
class COOXMLRelationship
{

Some files were not shown because too many files have changed in this diff Show More