mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-19 23:12:48 +08:00
Compare commits
7 Commits
core-win-6
...
core-win-6
| Author | SHA1 | Date | |
|---|---|---|---|
| 452917f213 | |||
| 5b5ccdc9be | |||
| adf7ca65ea | |||
| 08d551752e | |||
| 77b1303d62 | |||
| 93e56e2b8a | |||
| e032fc8294 |
@ -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()
|
||||
{
|
||||
@ -587,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
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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))
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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,7 +1288,7 @@ void sequence::docx_convert(oox::docx_conversion_context & Context)
|
||||
num_format= L"ARABIC"; break;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@ -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 );
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -71,12 +71,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
template <class ElementT>
|
||||
class text_content_impl : public office_element_impl<ElementT>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 )
|
||||
@ -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)
|
||||
{
|
||||
@ -1324,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1336,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)
|
||||
{
|
||||
@ -1426,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1438,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)
|
||||
{
|
||||
@ -1567,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1580,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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -785,6 +785,9 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
}
|
||||
void odt_conversion_context::start_field(bool in_span)
|
||||
{
|
||||
if (false == current_fields.empty() && current_fields.back().status == 0)
|
||||
return; //start_field из sdt
|
||||
|
||||
_field_state field;
|
||||
current_fields.push_back(field);
|
||||
}
|
||||
@ -944,6 +947,10 @@ void odt_conversion_context::end_field()
|
||||
current_fields.pop_back();
|
||||
}
|
||||
}
|
||||
else if (current_fields.back().status == 0)
|
||||
{
|
||||
current_fields.pop_back();
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::end_paragraph()
|
||||
{
|
||||
|
||||
@ -403,10 +403,39 @@ 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)
|
||||
{
|
||||
|
||||
@ -991,10 +991,10 @@ namespace NSEditorApi
|
||||
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_bSlideAdvanceDuration;
|
||||
js_wrapper<bool> m_bShowLoop;
|
||||
|
||||
public:
|
||||
@ -1007,10 +1007,10 @@ namespace NSEditorApi
|
||||
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(SlideAdvanceDuration)
|
||||
LINK_PROPERTY_BOOL_JS(ShowLoop)
|
||||
};
|
||||
|
||||
|
||||
@ -690,6 +690,9 @@
|
||||
#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
|
||||
#define ASC_MENU_EVENT_TYPE_SLIDETIMINGALL 23
|
||||
|
||||
// insert commands
|
||||
#define ASC_MENU_EVENT_TYPE_INSERT_IMAGE 50
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -73,6 +73,7 @@ namespace NSThreads
|
||||
virtual void Suspend();
|
||||
virtual void Resume();
|
||||
virtual void Stop();
|
||||
virtual void StopNoJoin();
|
||||
|
||||
INT IsSuspended();
|
||||
INT IsRunned();
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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_
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#include "./XmlCanonicalizator.h"
|
||||
#include "./XmlTransform.h"
|
||||
#include "./../include/OOXMLVerifier.h"
|
||||
|
||||
|
||||
@ -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_
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -77,32 +77,32 @@ public:
|
||||
m_mode = -1;
|
||||
if ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315" == alg)
|
||||
{
|
||||
m_mode = XML_C14N_1_0;
|
||||
m_mode = XmlUtils::XML_C14N_1_0;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" == alg)
|
||||
{
|
||||
m_mode = XML_C14N_1_0;
|
||||
m_mode = XmlUtils::XML_C14N_1_0;
|
||||
m_comments = true;
|
||||
}
|
||||
else if ("http://www.w3.org/2006/12/xml-c14n11" == alg)
|
||||
{
|
||||
m_mode = XML_C14N_1_1;
|
||||
m_mode = XmlUtils::XML_C14N_1_1;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/2006/12/xml-c14n11#WithComments" == alg)
|
||||
{
|
||||
m_mode = XML_C14N_1_1;
|
||||
m_mode = XmlUtils::XML_C14N_1_1;
|
||||
m_comments = true;
|
||||
}
|
||||
else if ("http://www.w3.org/2001/10/xml-exc-c14n#" == alg)
|
||||
{
|
||||
m_mode = XML_C14N_EXCLUSIVE_1_0;
|
||||
m_mode = XmlUtils::XML_C14N_EXCLUSIVE_1_0;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/2001/10/xml-exc-c14n#WithComments" == alg)
|
||||
{
|
||||
m_mode = XML_C14N_EXCLUSIVE_1_0;
|
||||
m_mode = XmlUtils::XML_C14N_EXCLUSIVE_1_0;
|
||||
m_comments = true;
|
||||
}
|
||||
return (-1 != m_mode) ? true : false;
|
||||
@ -112,7 +112,7 @@ public:
|
||||
{
|
||||
if (-1 == m_mode)
|
||||
return xml;
|
||||
return CXmlCanonicalizator::Execute(xml, m_mode, m_comments);
|
||||
return XmlUtils::NSXmlCanonicalizator::Execute(xml, m_mode, m_comments);
|
||||
}
|
||||
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node)
|
||||
|
||||
Reference in New Issue
Block a user