Compare commits

..

21 Commits

Author SHA1 Message Date
f86055c713 Epub images bug (xml files) 2019-05-08 12:51:29 +03:00
ea82bea6f1 . 2019-04-29 15:21:20 +03:00
28f5b1251a XlsxFormat - fix bug #41458 2019-04-29 14:20:41 +03:00
39fbf06511 PptFormatReader - fix bug #40482 2019-04-29 14:20:41 +03:00
0821edca07 OdfFormatReader - fix bug #41408 2019-04-27 16:26:46 +03:00
bc4faa26b9 Fix linux build 2019-04-26 17:06:30 +03:00
668a89bbd1 Merge pull request #132 from ONLYOFFICE/feature/svg
Feature/svg
2019-04-26 16:50:48 +03:00
2d21d334cf OdfFormatReader - fix bug #41408 2019-04-26 16:36:56 +03:00
b23bc97fdb Fix bugs 2019-04-25 18:26:02 +03:00
1d25f72ac9 SVG full support 2019-04-24 14:14:34 +03:00
9bfb0321b2 svg position support 2019-04-24 11:45:07 +03:00
6c1bdc6ff8 . 2019-04-23 19:27:56 +03:00
8f8995cbe7 . 2019-04-23 11:00:39 +03:00
fb1ae2c79a . 2019-04-23 10:45:51 +03:00
0f4d594248 . 2019-04-22 18:56:37 +03:00
152d05d5a5 . 2019-04-22 18:40:22 +03:00
5c070f0475 . 2019-04-22 16:50:53 +03:00
ab45804644 . 2019-04-19 18:50:12 +03:00
4cca54900d . 2019-04-18 18:46:34 +03:00
b66ed403e1 . 2019-04-18 18:22:08 +03:00
428b5971e8 . 2019-04-17 18:55:31 +03:00
53 changed files with 8979 additions and 316 deletions

View File

@ -63,8 +63,9 @@ public:
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
virtual void add_attributes (const xml::attributes_wc_ptr & Attributes) = 0;
virtual void add_text (const std::wstring & Text) = 0;
virtual void add_space (const std::wstring & Text) = 0;
};

View File

@ -82,6 +82,11 @@ bool read_doc_element::read_sax( xml::sax * Reader )
}
break;
case xml::typeWhitespace:
{
const std::wstring value = Reader->value();
add_space(value);
}
break;
case xml::typeText:
{
const std::wstring value = Reader->value();

View File

@ -151,7 +151,6 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
break;
case odf_types::style_wrap::Left:
case odf_types::style_wrap::Right:
case odf_types::style_wrap::Dynamic:
serialize_wrap_square(strm, val);
break;
case odf_types::style_wrap::RunThrough:
@ -160,6 +159,7 @@ void serialize_wrap(std::wostream & strm, _docx_drawing const & val)
case odf_types::style_wrap::None:
serialize_wrap_top_bottom(strm, val);
break;
case odf_types::style_wrap::Dynamic:
default:
CP_XML_NODE(L"wp:wrapTopAndBottom");
break;

View File

@ -74,6 +74,10 @@ void abstract_xml::add_text(const std::wstring & Text)
office_element_ptr elm = text::text::create(Text) ;
xml_content_.push_back( elm );
}
void abstract_xml::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::text::create(Text) ;
xml_content_.push_back( elm );
}
}
}

View File

@ -46,19 +46,17 @@ public:
static const ElementType type = type_AbstractXml;
CPDOCCORE_DEFINE_VISITABLE();
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
virtual std::wostream & xml_to_stream(std::wostream & _Wostream) const;
public:
abstract_xml() {};
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);
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text);
private:
office_element_ptr_array xml_content_;
};

View File

@ -324,10 +324,6 @@ void draw_text_box::add_child_element( xml::sax * Reader, const std::wstring & N
CP_CREATE_ELEMENT(content_);
}
void draw_text_box::add_text(const std::wstring & Text)
{
}
// draw:object
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_object::ns = L"draw";

View File

@ -271,7 +271,8 @@ public:
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);
virtual void add_text(const std::wstring & Text);
virtual void add_text(const std::wstring & Text){}
virtual void add_space(const std::wstring & Text){}
};
CP_REGISTER_OFFICE_ELEMENT2(draw_text_box);

View File

@ -1451,7 +1451,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
bool bImage = false;
if (content_.empty() == false)
{
if (content_[0]->get_type() == typeDrawImage)
if (content_[0]->get_type() == typeDrawImage || content_[0]->get_type() == typeDrawObject || content_[0]->get_type() == typeDrawObjectOle )
bImage = true;
}
if (Context.get_drawing_context().get_current_level() > 0 && !Context.get_drawing_context().in_group() && !bImage)

View File

@ -224,7 +224,11 @@ void presentation_footer_decl::add_attributes( const xml::attributes_wc_ptr & At
}
void presentation_footer_decl::add_text(const std::wstring & text)
{
text_ = text;
text_ += text;
}
void presentation_footer_decl::add_space(const std::wstring & text)
{
text_ += text;
}
void presentation_footer_decl::pptx_convert(oox::pptx_conversion_context & Context)
{
@ -242,7 +246,11 @@ void presentation_date_time_decl::add_attributes( const xml::attributes_wc_ptr &
}
void presentation_date_time_decl::add_text(const std::wstring & text)
{
text_ = text;
text_ += text;
}
void presentation_date_time_decl::add_space(const std::wstring & text)
{
text_ += text;
}
void presentation_date_time_decl::pptx_convert(oox::pptx_conversion_context & Context)
{

View File

@ -104,6 +104,7 @@ public:
std::wstring text_;
private:
virtual void add_space(const std::wstring & Text);
virtual void add_text(const std::wstring & Text);
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){}
@ -131,6 +132,7 @@ public:
virtual void pptx_convert(oox::pptx_conversion_context & Context);
private:
virtual void add_space(const std::wstring & Text);
virtual void add_text(const std::wstring & Text);
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){}

View File

@ -52,9 +52,12 @@ std::wostream & svg_desc::text_to_stream(std::wostream & _Wostream, bool bXmlEnc
void svg_desc::add_text(const std::wstring & Text)
{
text_ = Text;
text_ += Text;
}
void svg_desc::add_space(const std::wstring & Text)
{
text_ += Text;
}
// svg:font-face-uri
//---------------------------------------------------------------------------------------
const wchar_t * svg_font_face_uri::ns = L"svg";
@ -80,9 +83,6 @@ void svg_font_face_uri::add_child_element( xml::sax * Reader, const std::wstring
CP_NOT_APPLICABLE_ELM();
}
void svg_font_face_uri::add_text(const std::wstring & Text)
{}
// svg:font-face-format
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * svg_font_face_format::ns = L"svg";
@ -103,9 +103,6 @@ void svg_font_face_format::add_child_element( xml::sax * Reader, const std::wstr
CP_NOT_APPLICABLE_ELM();
}
void svg_font_face_format::add_text(const std::wstring & Text)
{}
// svg:font-face-name
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * svg_font_face_name::ns = L"svg";
@ -126,9 +123,6 @@ void svg_font_face_name::add_child_element( xml::sax * Reader, const std::wstrin
CP_NOT_APPLICABLE_ELM();
}
void svg_font_face_name::add_text(const std::wstring & Text)
{}
//////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -77,7 +77,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_uri);
@ -100,6 +99,7 @@ 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){}
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(svg_desc);
@ -121,7 +121,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_format);
@ -142,7 +141,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(svg_font_face_name);

View File

@ -75,7 +75,11 @@ void note_citation::add_text(const std::wstring & Text)
office_element_ptr elm = text::create(Text) ;
content_.push_back( elm );
}
void note_citation::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::create(Text) ;
content_.push_back( elm );
}
void note_citation::docx_convert(oox::docx_conversion_context & Context)
{
for (size_t i = 0; i < content_.size(); i++)
@ -113,6 +117,11 @@ void note_body::add_text(const std::wstring & Text)
content_.push_back( elm );
}
void note_body::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::create(Text) ;
content_.push_back( elm );
}
void note_body::docx_convert(oox::docx_conversion_context & Context)
{
oox::StreamsManPtr prev = Context.get_stream_man();

View File

@ -50,22 +50,20 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextNoteCitation;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
public:
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
public:
note_citation() {}
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);
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text);
private:
std::wstring text_label_;
office_element_ptr_array content_;
std::wstring text_label_;
office_element_ptr_array content_;
};
@ -81,19 +79,18 @@ public:
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextNoteBody;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
public:
virtual void docx_convert(oox::docx_conversion_context & Context) ;
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
public:
note_body() {}
note_body() {}
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);
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text);
private:
office_element_ptr_array content_;
};

View File

@ -184,9 +184,7 @@ void number_style_base::add_child_element( xml::sax * Reader, const std::wstring
CP_CREATE_ELEMENT(content_);
}
}
void number_style_base::add_text(const std::wstring & Text)
{
}
// number:number-style
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_number_style::ns = L"number";
@ -211,7 +209,11 @@ void number_text::add_text(const std::wstring & Text)
office_element_ptr elm = text::text::create(Text) ;
text_.push_back( elm );
}
void number_text::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::text::create(Text) ;
text_.push_back( elm );
}
// number:embedded-text
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_embedded_text::ns = L"number";
@ -232,6 +234,11 @@ void number_embedded_text::add_text(const std::wstring & Text)
office_element_ptr elm = text::text::create(Text) ;
text_.push_back( elm );
}
void number_embedded_text::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::text::create(Text) ;
text_.push_back( elm );
}
void number_embedded_text::oox_convert(oox::num_format_context & Context)
{
}
@ -261,10 +268,6 @@ void number_number::add_child_element( xml::sax * Reader, const std::wstring & N
CP_NOT_APPLICABLE_ELM();
}
void number_number::add_text(const std::wstring & Text)
{
}
// number:scientific-number
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_scientific_number::ns = L"number";
@ -304,7 +307,10 @@ void number_currency_symbol::add_text(const std::wstring & Text)
{
text_.push_back(Text);
}
void number_currency_symbol::add_space(const std::wstring & Text)
{
text_.push_back(Text);
}
void number_currency_symbol::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -342,7 +348,11 @@ void number_text_content::add_text(const std::wstring & Text)
office_element_ptr elm = text::text::create(Text) ;
text_.push_back( elm );
}
void number_text_content::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::text::create(Text) ;
text_.push_back( elm );
}
void number_text_content::oox_convert(oox::num_format_context & Context)
{
}
@ -443,9 +453,6 @@ void number_day::add_child_element( xml::sax * Reader, const std::wstring & Ns,
{
CP_NOT_APPLICABLE_ELM();
}
void number_day::add_text(const std::wstring & Text)
{
}
void number_day::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -475,9 +482,6 @@ void number_day_of_week::add_child_element( xml::sax * Reader, const std::wstrin
{
CP_NOT_APPLICABLE_ELM();
}
void number_day_of_week::add_text(const std::wstring & Text)
{
}
void number_day_of_week::oox_convert(oox::num_format_context & Context)
{
@ -508,10 +512,6 @@ void number_quarter::add_child_element( xml::sax * Reader, const std::wstring &
CP_NOT_APPLICABLE_ELM();
}
void number_quarter::add_text(const std::wstring & Text)
{
}
void number_quarter::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -544,9 +544,7 @@ void number_month::add_child_element( xml::sax * Reader, const std::wstring & Ns
{
CP_NOT_APPLICABLE_ELM();
}
void number_month::add_text(const std::wstring & Text)
{
}
void number_month::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -589,9 +587,7 @@ void number_year::add_child_element( xml::sax * Reader, const std::wstring & Ns,
{
CP_NOT_APPLICABLE_ELM();
}
void number_year::add_text(const std::wstring & Text)
{
}
void number_year::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -630,9 +626,6 @@ void number_hours::add_child_element( xml::sax * Reader, const std::wstring & Ns
{
CP_NOT_APPLICABLE_ELM();
}
void number_hours::add_text(const std::wstring & Text)
{
}
void number_hours::oox_convert(oox::num_format_context & Context)
{
@ -663,9 +656,7 @@ void number_minutes::add_child_element( xml::sax * Reader, const std::wstring &
{
CP_NOT_APPLICABLE_ELM();
}
void number_minutes::add_text(const std::wstring & Text)
{
}
void number_minutes::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -696,9 +687,7 @@ void number_seconds::add_child_element( xml::sax * Reader, const std::wstring &
{
CP_NOT_APPLICABLE_ELM();
}
void number_seconds::add_text(const std::wstring & Text)
{
}
void number_seconds::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -732,9 +721,7 @@ void number_am_pm::add_child_element( xml::sax * Reader, const std::wstring & Ns
{
CP_NOT_APPLICABLE_ELM();
}
void number_am_pm::add_text(const std::wstring & Text)
{
}
void number_am_pm::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -760,9 +747,7 @@ void number_fraction::add_child_element( xml::sax * Reader, const std::wstring &
{
CP_NOT_APPLICABLE_ELM();
}
void number_fraction::add_text(const std::wstring & Text)
{
}
void number_fraction::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
@ -786,10 +771,6 @@ void number_fraction::oox_convert(oox::num_format_context & Context)
}
}
void number_scientific_number::add_text(const std::wstring & Text)
{
}
void number_scientific_number::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();

View File

@ -58,8 +58,9 @@ public:
std::wstring get_style_name() const;
private:
virtual void add_text(const std::wstring &);
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element (xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
odf_types::common_data_style_attlist common_data_style_attlist_;
@ -182,12 +183,12 @@ public:
virtual void oox_convert (oox::num_format_context & Context) = 0;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
virtual void add_text (const std::wstring &) = 0;
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) = 0;
virtual void add_text (const std::wstring & Text) = 0;
virtual void add_space (const std::wstring & Text) = 0;
};
@ -210,6 +211,7 @@ 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);
virtual void add_text (const std::wstring & Text);
virtual void add_space (const std::wstring & Text);
office_element_ptr_array text_;
};
@ -234,7 +236,8 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
// number-number-attlist
_CP_OPT(std::wstring) number_decimal_replacement_;
@ -272,6 +275,7 @@ 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);
virtual void add_text (const std::wstring & Text);
virtual void add_space (const std::wstring & Text);
_CP_OPT(int) number_position_;
office_element_ptr_array text_;
@ -297,16 +301,13 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
private:
// number-scientific-number-attlist
_CP_OPT(int) number_min_exponent_digits_;
// common-decimal-places-attlist
_CP_OPT(int) number_decimal_places_;
// common-number-attlist
_CP_OPT(int) number_min_integer_digits_;
_CP_OPT(bool) number_grouping_;
@ -333,6 +334,7 @@ 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);
virtual void add_text (const std::wstring & Text);
virtual void add_space (const std::wstring & Text);
_CP_OPT(std::wstring) number_language_;
_CP_OPT(std::wstring) number_country_;
@ -362,6 +364,7 @@ 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);
virtual void add_text (const std::wstring & Text);
virtual void add_space (const std::wstring & Text);
office_element_ptr_array text_;
@ -387,7 +390,8 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_;
@ -414,7 +418,8 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_;
@ -441,7 +446,8 @@ public:
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);
virtual void add_text(const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_;
@ -467,7 +473,8 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
_CP_OPT(bool) number_textual_;
_CP_OPT(bool) number_possessive_form_;
@ -496,7 +503,8 @@ public:
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);
virtual void add_text(const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_;
@ -518,15 +526,13 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
void oox_convert(oox::num_format_context & Context);
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
public:
void oox_convert(oox::num_format_context & Context);
private:
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_;
@ -551,7 +557,8 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_;
@ -578,7 +585,8 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
_CP_OPT(std::wstring) number_style_;
_CP_OPT(int) number_decimal_places_;
@ -606,7 +614,8 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
};
CP_REGISTER_OFFICE_ELEMENT2(number_am_pm);
@ -629,7 +638,8 @@ public:
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);
virtual void add_text (const std::wstring & Text);
virtual void add_text (const std::wstring & Text) {}
virtual void add_space (const std::wstring & Text) {}
_CP_OPT(int) number_min_integer_digits_;
_CP_OPT(bool) number_grouping_;

View File

@ -94,10 +94,7 @@ void content_xml_t::add_child_element( xml::sax * Reader, const std::wstring & N
}
}
void content_xml_t::add_text(const std::wstring & Text)
{
}
}
}

View File

@ -59,8 +59,9 @@ public:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_text(const std::wstring & Text);
virtual void add_text(const std::wstring & Text) {}
virtual void add_space(const std::wstring & Text) {}
friend class odf_document;
office_element_ptr content_;

View File

@ -75,11 +75,6 @@ void office_body::add_child_element( xml::sax * Reader, const std::wstring & Ns,
CP_CREATE_ELEMENT(content_);
}
void office_body::add_text(const std::wstring & Text)
{
// TODO : error
}
void office_body::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_body();

View File

@ -61,17 +61,15 @@ public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
public:
office_body();
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);
virtual void add_text(const std::wstring & Text);
virtual void add_text(const std::wstring & Text) {}
virtual void add_space(const std::wstring & Text) {}
public:
office_element_ptr content_;
};

View File

@ -82,10 +82,6 @@ void office_document_base::add_child_element( xml::sax * Reader, const std::wstr
CP_NOT_APPLICABLE_ELM();
}
void office_document_base::add_text(const std::wstring & Text)
{
}
void office_document_base::docx_convert(oox::docx_conversion_context & Context)
{
if (office_body_)

View File

@ -47,18 +47,17 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
office_document_base();
office_document_base();
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);
virtual void add_text(const std::wstring & Text);
virtual void add_text(const std::wstring & Text) {}
virtual void add_space(const std::wstring & Text) {}
public:
std::wstring office_mimetype_;
@ -190,6 +189,7 @@ public:
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);
virtual void add_text(const std::wstring & Text){}
virtual void add_space(const std::wstring & Text){}
static const wchar_t * ns;
static const wchar_t * name;
@ -216,6 +216,7 @@ public:
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);
virtual void add_text(const std::wstring & Text){}
virtual void add_space(const std::wstring & Text){}
static const wchar_t * ns;
static const wchar_t * name;
@ -243,6 +244,7 @@ public:
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){}
virtual void add_text(const std::wstring & Text){}
virtual void add_space(const std::wstring & Text){}
static const wchar_t * ns;
static const wchar_t * name;
@ -265,6 +267,7 @@ public:
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){}
virtual void add_text(const std::wstring & Text){}
virtual void add_space(const std::wstring & Text){}
static const wchar_t * ns;
static const wchar_t * name;
@ -289,6 +292,7 @@ public:
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){}
virtual void add_text(const std::wstring & Text){}
virtual void add_space(const std::wstring & Text){}
static const wchar_t * ns;
static const wchar_t * name;

View File

@ -168,7 +168,9 @@ private:
virtual void add_text(const std::wstring & Text)
{
}
virtual void add_space(const std::wstring & Text)
{
}
// office_element impl
public:
virtual ElementType get_type() const

View File

@ -57,9 +57,6 @@ void office_scripts::add_child_element( xml::sax * Reader, const std::wstring &
CP_NOT_APPLICABLE_ELM();
}
void office_scripts::add_text(const std::wstring & Text)
{
}
// office:script
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -76,9 +73,5 @@ void office_script::add_child_element( xml::sax * Reader, const std::wstring & N
CP_CREATE_ELEMENT(content_);
}
void office_script::add_text(const std::wstring & Text)
{
}
}
}

View File

@ -55,7 +55,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
private:
office_element_ptr_array content_;
@ -79,7 +78,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
private:
std::wstring script_language_;

View File

@ -125,6 +125,15 @@ std::wostream & text::text_to_stream(std::wostream & _Wostream, bool bXmlEncode)
_Wostream << (bXmlEncode ? xml::utils::replace_text_to_xml( text_, true ) : text_);
return _Wostream;
}
void text::add_space(const std::wstring & Text)
{
text_.reserve(Text.length());
for (size_t i =0; i < Text.length(); i++)
{
if (Text[i] < 0x20) continue;
text_ += Text[i];
}
}
void text::add_text(const std::wstring & Text)
{
@ -498,7 +507,11 @@ void span::add_text(const std::wstring & Text)
office_element_ptr elm = text::create(Text);
content_.push_back( elm );
}
void span::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::create(Text);
content_.push_back( elm );
}
void span::docx_convert(oox::docx_conversion_context & Context)
{
bool addNewRun = false;
@ -603,7 +616,11 @@ void a::add_text(const std::wstring & Text)
office_element_ptr elm = text::create(Text) ;
content_.push_back( elm );
}
void a::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::create(Text);
content_.push_back( elm );
}
void a::docx_convert(oox::docx_conversion_context & Context)
{
bool pushed_style = false;
@ -742,10 +759,6 @@ void note::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
else
CP_NOT_APPLICABLE_ELM();
}
void note::add_text(const std::wstring & Text)
{
}
void note::pptx_convert(oox::pptx_conversion_context & Context)
{
//см presentation:notes
@ -835,12 +848,6 @@ void ruby::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
else
CP_NOT_APPLICABLE_ELM();
}
void ruby::add_text(const std::wstring & Text)
{
}
// text:title
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * title::ns = L"text";

View File

@ -93,7 +93,7 @@ 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) {}
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text);
};
//-------------------------------------------------------------------------------------------------------------------
@ -276,7 +276,6 @@ 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) {}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(bookmark_ref);
//-------------------------------------------------------------------------------------------------------------------
@ -299,7 +298,6 @@ 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) {}
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(reference_ref);
//-------------------------------------------------------------------------------------------------------------------
@ -395,6 +393,7 @@ 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);
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(span);
@ -422,8 +421,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);
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text);
odf_types::common_xlink_attlist xlink_attlist_;
odf_types::common_xlink_attlist xlink_attlist_;
std::wstring office_name_;
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;
@ -456,7 +456,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
std::wstring text_id_;
odf_types::noteclass text_note_class_;
@ -482,7 +481,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
std::wstring text_style_name_;
office_element_ptr text_ruby_base_;

View File

@ -73,12 +73,6 @@ void style_tab_stop::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void style_tab_stop::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{}
void style_tab_stop::add_text(const std::wstring & Text)
{}
// style:tab-stop
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_tab_stops::ns = L"style";
@ -117,12 +111,6 @@ void style_drop_cap::add_attributes( const xml::attributes_wc_ptr & Attributes )
CP_APPLY_ATTR(L"style:style-name", style_style_name_);
}
void style_drop_cap::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{}
void style_drop_cap::add_text(const std::wstring & Text)
{}
// style-background-image
// style:background-image
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -158,9 +146,6 @@ void style_background_image::add_child_element( xml::sax * Reader, const std::ws
}
}
void style_background_image::add_text(const std::wstring & Text)
{}
//////////////////////////////////////////////////////////////////////////////////////////////////
void paragraph_format_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )

View File

@ -95,8 +95,7 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
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);
virtual void add_text(const std::wstring & Text);
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
public:
odf_types::length style_position_;
@ -136,6 +135,7 @@ 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);
virtual void add_text(const std::wstring & Text){}
virtual void add_space(const std::wstring & Text){}
};
@ -160,8 +160,7 @@ public:
_CP_OPT(std::wstring) style_style_name_;
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);
virtual void add_text(const std::wstring & Text);
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) {}
_CP_OPT(odf_types::common_xlink_attlist) xlink_attlist_;
@ -183,8 +182,7 @@ public:
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);
virtual void add_text(const std::wstring & Text);
_CP_OPT(odf_types::style_repeat) style_repeat_;
_CP_OPT(odf_types::style_position) style_position_;
_CP_OPT(std::wstring) filter_name_;

View File

@ -311,10 +311,6 @@ void default_style::add_child_element( xml::sax * Reader, const std::wstring & N
content_.add_child_element(Reader, Ns, Name, getContext());
}
void default_style::add_text(const std::wstring & Text)
{
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_fill_image::ns = L"draw";
const wchar_t * draw_fill_image::name = L"fill-image";
@ -478,10 +474,6 @@ void style::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
content_.add_child_element(Reader, Ns, Name, getContext());
}
void style::add_text(const std::wstring & Text)
{
}
// styles & draw_styles
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -579,9 +571,6 @@ void office_automatic_styles::add_child_element( xml::sax * Reader, const std::w
}
}
void office_automatic_styles::add_text(const std::wstring & Text)
{}
// office:master-styles
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_master_styles::ns = L"office";
@ -610,11 +599,6 @@ void office_master_styles::add_child_element( xml::sax * Reader, const std::wstr
}
}
void office_master_styles::add_text(const std::wstring & Text)
{
}
// office:styles
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_styles::ns = L"office";
@ -1777,10 +1761,6 @@ void text_notes_configuration::add_child_element( xml::sax * Reader, const std::
CP_NOT_APPLICABLE_ELM();
}
void text_notes_configuration::add_text(const std::wstring & Text)
{
}
/// style:presentation-page-layout
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_presentation_page_layout::ns = L"style";

View File

@ -142,7 +142,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(default_style);
@ -357,8 +356,7 @@ public:
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);
virtual void add_text(const std::wstring & Text);
public:
std::wstring style_name_;
bool style_auto_update_; // default = false
@ -452,7 +450,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(office_automatic_styles);
@ -480,7 +477,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(office_master_styles);
@ -1045,7 +1041,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
public:
odf_types::noteclass noteclass_;

View File

@ -186,6 +186,7 @@ public:
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) {}
virtual void add_text(const std::wstring & Text) {}
virtual void add_space(const std::wstring & Text) {}
CPDOCCORE_DEFINE_VISITABLE();
@ -542,6 +543,7 @@ public:
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);
virtual void add_text(const std::wstring & Text) {}
virtual void add_space(const std::wstring & Text) {}
static _CP_PTR(table_rows_no_group) create();

View File

@ -161,6 +161,11 @@ void paragraph::add_text(const std::wstring & Text)
office_element_ptr elm = text::create(Text) ;
content_.push_back( elm );
}
void paragraph::add_space(const std::wstring & Text)
{
office_element_ptr elm = text::create(Text) ;
content_.push_back( elm );
}
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>";
@ -511,6 +516,10 @@ void p::add_text(const std::wstring & Text)
{
paragraph_.add_text(Text);
}
void p::add_space(const std::wstring & Text)
{
paragraph_.add_space(Text);
}
void p::docx_convert(oox::docx_conversion_context & Context)
{
@ -564,11 +573,6 @@ void list::add_child_element( xml::sax * Reader, const std::wstring & Ns, const
}
}
void list::add_text(const std::wstring & Text)
{
// TODO : false
}
void list::docx_convert(oox::docx_conversion_context & Context)
{
bool continue_ = continue_numbering_.get_value_or(false);

View File

@ -58,6 +58,7 @@ public:
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
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);
void add_space (const std::wstring & Text);
_CP_OPT(std::wstring) next_element_style_name; //for master page
@ -118,6 +119,7 @@ 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);
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text){}
// heading-attrs
_CP_OPT(unsigned int) outline_level_;
@ -155,6 +157,7 @@ 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);
virtual void add_text(const std::wstring & Text);
virtual void add_space(const std::wstring & Text);
};
CP_REGISTER_OFFICE_ELEMENT2(p);
@ -179,7 +182,6 @@ public:
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);
virtual void add_text(const std::wstring & Text);
std::wstring style_name_;
_CP_OPT(bool) continue_numbering_;

View File

@ -39,7 +39,7 @@
#define MIN_SLIDE_TIME 5000.0
inline int sort (const long* a, const long* b) { return *a > *b ? 1 : -1; }
//inline int sort (const long* a, const long* b) { return *a > *b ? 1 : -1; }
#if !defined(_WIN32) && !defined (_WIN64)
@ -440,7 +440,7 @@ namespace Animations
virtual ~ParaBuildContainer()
{
for ( long i = 0; i < (long)rgParaBuildLevel.size(); ++i )
for ( size_t i = 0; i < rgParaBuildLevel.size(); ++i )
RELEASEOBJECT (rgParaBuildLevel[i]);
}
@ -510,7 +510,7 @@ namespace Animations
virtual ~BuildListContainer()
{
for ( long i = 0; i < (long)rgChildRec.size(); ++i )
for ( size_t i = 0; i < rgChildRec.size(); ++i )
RELEASEOBJECT (rgChildRec[i]);
}
@ -1051,7 +1051,7 @@ namespace Animations
}
void ClearNodes ()
{
for ( long i = 0; i < (long)m_arrElements.size(); ++i )
for ( size_t i = 0; i < m_arrElements.size(); ++i )
{
RELEASEOBJECT ( m_arrElements[i] );
}
@ -1399,7 +1399,7 @@ namespace Animations
virtual bool IsCorrect () { return m_oHeader.RecVersion == 0xF && m_oHeader.RecInstance == 0x0 && m_oHeader.RecType == 0xF12A; }
inline long GetObjectID ()
inline _UINT32 GetObjectID ()
{
return clientVisualElement.m_oVisualShapeAtom.m_nObjectIdRef;
}
@ -2481,13 +2481,13 @@ namespace Animations
RELEASEOBJECT(rgSlave);
for ( long i = 0; i < (long)rgExtTimeNodeChildren.size(); ++i )
for ( size_t i = 0; i < rgExtTimeNodeChildren.size(); ++i )
RELEASEOBJECT ( rgExtTimeNodeChildren[i] );
for ( long i = 0; i < (long)timeCondition.size(); ++i )
for ( size_t i = 0; i < timeCondition.size(); ++i )
RELEASEOBJECT ( timeCondition[i] );
for ( long i = 0; i < (long)rgTimeModifierAtom.size(); ++i )
for ( size_t i = 0; i < rgTimeModifierAtom.size(); ++i )
RELEASEOBJECT ( rgTimeModifierAtom[i] );
}
@ -2714,7 +2714,7 @@ namespace Animations
//
inline TimeModifierAtom* GetModifier (long Type)
{
for ( long i = 0; i < (long)rgTimeModifierAtom.size(); ++i )
for ( size_t i = 0; i < rgTimeModifierAtom.size(); ++i )
if (rgTimeModifierAtom[i]->type == Type)
return rgTimeModifierAtom[i];
@ -3008,7 +3008,7 @@ namespace Animations
inline long GetBuild (long nShapeID)
{
for ( long i = 0; i < (long)m_arrBuilds.size(); ++i )
for ( size_t i = 0; i < m_arrBuilds.size(); ++i )
{
if (m_arrBuilds[i].m_nShapeID == nShapeID)
return m_arrBuilds[i].m_nBuildType;
@ -3023,7 +3023,7 @@ namespace Animations
{
if ( pContainer->buildList )
{
for ( long i = 0; i < (long)pContainer->buildList->rgChildRec.size(); ++i )
for ( size_t i = 0; i < pContainer->buildList->rgChildRec.size(); ++i )
m_arrBuilds.push_back(EffectBuild(pContainer->buildList->rgChildRec[i]->buildAtom.shapeIdRef, pContainer->buildList->rgChildRec[i]->paraBuildAtom.buildLevel) );
return true;
@ -3193,7 +3193,7 @@ namespace Animations
}
//
inline void AddAnimation (ExtTimeNodeContainer* pTimeNode, long nID)
inline void AddAnimation (ExtTimeNodeContainer* pTimeNode, int nID)
{
CalculateTimeEffect (pTimeNode);
@ -3407,9 +3407,9 @@ namespace Animations
if (MediaCallEffect == m_oTopEffect.m_nEffectType)
{
if ((long)pContainer->rgExtTimeNodeChildren.size())
if (!pContainer->rgExtTimeNodeChildren.empty())
{
ExtTimeNodeContainer* pChild = pContainer->rgExtTimeNodeChildren[0];
ExtTimeNodeContainer* pChild = pContainer->rgExtTimeNodeChildren[0];
if (pChild)
{
if (pChild->timeNodeAtom.m_bDurationProperty)
@ -3474,7 +3474,7 @@ namespace Animations
if (26 == m_oTopEffect.m_nEffectID)
{
if ((long)m_arDurations.size() && (long)m_arBeginTimes.size() )
if (!m_arDurations.empty() && !m_arBeginTimes.empty() )
m_dEffectDuration = m_arDurations.at(m_arDurations.size()-1) + m_arBeginTimes.at(m_arBeginTimes.size()-1);
}
@ -3563,7 +3563,7 @@ namespace Animations
m_oTopEffect.m_nTextSequence = container.clientVisualElement.m_oVisualShapeAtom.m_nData1; // номер параграфа - не нормальзован
m_oTopEffect.m_bRemoveEmptyBlocks = true;
for (long i = 0; i < (long)m_arParIndexer.size(); ++i)
for (size_t i = 0; i < m_arParIndexer.size(); ++i)
{
if (m_oTopEffect.m_nTextSequence == m_arParIndexer.at(i))
return;
@ -3575,7 +3575,7 @@ namespace Animations
inline bool UpdateParagraph ()
{
if ((long)m_arParIndexer.size())
if (!m_arParIndexer.empty())
{
//ATLTRACE ( _T("====================PARAGRAPH==========================================\n"));
//qsort ( m_arParIndexer.GetData(), m_arParIndexer.size(), sizeof (long), (int(*)(const void*, const void*))sort );
@ -3587,12 +3587,12 @@ namespace Animations
Effects* arEffects = pPair->second;
if (arEffects)
{
for (long i = 0; i < (long)arEffects->size(); ++i)
for (size_t i = 0; i < arEffects->size(); ++i)
{
Effect& oEffect = arEffects->at(i);
if (oEffect.m_nTextSequence >= 0)
{
for (long ind = 0; ind < (long)m_arParIndexer.size(); ++ind)
for (size_t ind = 0; ind < m_arParIndexer.size(); ++ind)
{
if (oEffect.m_nTextSequence == m_arParIndexer.at(ind))
{
@ -3646,7 +3646,7 @@ namespace Animations
}
}
for (long i = 0; i < (long)pContainer->rgExtTimeNodeChildren.size(); ++i )
for (size_t i = 0; i < pContainer->rgExtTimeNodeChildren.size(); ++i )
{
if (GetMediaID(pContainer->rgExtTimeNodeChildren [i]))
return true;
@ -3668,7 +3668,7 @@ namespace Animations
}
}
for (long i = 0; i < (long)pContainer->rgExtTimeNodeChildren.size(); ++i )
for (size_t i = 0; i < pContainer->rgExtTimeNodeChildren.size(); ++i )
{
if (CNodeTiming::AfterPreviousNode == pContainer->rgExtTimeNodeChildren [i]->GetEffectNodeType ()) // нод с описанием эффекта
return false;
@ -3704,20 +3704,20 @@ namespace Animations
TimeArray m_arDurations;
TimeArray m_arBeginTimes;
std::wstring m_ComposeEffectMothionPath;
std::wstring m_ComposeEffectMothionPath;
bool m_HaveAfterEffect;
EffectsMap m_oAnimation;
CParagraphBuilds m_oParagraphBuilds;
std::vector <long> m_arParIndexer;
std::vector <_INT32> m_arParIndexer;
// media
int m_nMediaID;
int m_nMediaShapeID;
int m_nMediaPush; // глубина поиска
std::vector <int> m_arrMedia;
std::vector <_INT32> m_arrMedia;
};
}

View File

@ -199,13 +199,13 @@ CColor CPPTElement::CorrectSysColor(int nColorCode, CElementPtr pElement, CTheme
}
void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideInfo* pWrapper, CSlide* pSlide, CProperties* pProperties)
{
long lCount = pProperties->m_lCount;
size_t lCount = pProperties->m_lCount;
switch (pElement->m_etType)
{
case PPT_FORMAT::etVideo:
{
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
for (size_t i = 0; i < lCount; ++i)
{
SetUpPropertyVideo(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
@ -215,7 +215,7 @@ void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideIn
{
pElement->m_oBrush.Type = c_BrushTypeTexture;
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
for (size_t i = 0; i < lCount; ++i)
{
SetUpPropertyImage(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
@ -224,7 +224,7 @@ void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideIn
case PPT_FORMAT::etAudio:
{
pElement->m_bLine = false;
for (long i = 0; i < lCount; ++i)
for (size_t i = 0; i < lCount; ++i)
{
SetUpPropertyAudio(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
@ -234,7 +234,7 @@ void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideIn
{
pElement->m_bLine = false;
pElement->m_bIsFilled = false;
for (long i = 0; i < lCount; ++i)
for (size_t i = 0; i < lCount; ++i)
{
SetUpProperty(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
@ -249,7 +249,7 @@ void CPPTElement::SetUpProperties(CElementPtr pElement, CTheme* pTheme, CSlideIn
pPPTShape->m_oCustomVML.SetAdjusts(&pPPTShape->m_arAdjustments);
}
for (long i = 0; i < lCount; ++i)
for (size_t i = 0; i < lCount; ++i)
{
SetUpPropertyShape(pElement, pTheme, pWrapper, pSlide, &pProperties->m_arProperties[i]);
}
@ -838,22 +838,22 @@ void CPPTElement::SetUpPropertyImage(CElementPtr pElement, CTheme* pTheme, CSlid
}break;
case cropFromTop:
{
image_element->m_lcropFromTop = pProperty->m_lValue;
image_element->m_lcropFromTop = (_INT32)pProperty->m_lValue;
image_element->m_bCropEnabled = true;
}break;
case cropFromBottom:
{
image_element->m_lcropFromBottom = pProperty->m_lValue;
image_element->m_lcropFromBottom = (_INT32)pProperty->m_lValue;
image_element->m_bCropEnabled = true;
}break;
case cropFromLeft:
{
image_element->m_lcropFromLeft = pProperty->m_lValue;
image_element->m_lcropFromLeft = (_INT32)pProperty->m_lValue;
image_element->m_bCropEnabled = true;
}break;
case cropFromRight:
{
image_element->m_lcropFromRight = pProperty->m_lValue;
image_element->m_lcropFromRight = (_INT32)pProperty->m_lValue;
image_element->m_bCropEnabled = true;
}break;
case pibFlags:

View File

@ -293,10 +293,10 @@ namespace PPT_FORMAT
bool m_bCropEnabled;
long m_lcropFromRight;
long m_lcropFromLeft;
long m_lcropFromTop;
long m_lcropFromBottom;
_INT32 m_lcropFromRight;
_INT32 m_lcropFromLeft;
_INT32 m_lcropFromTop;
_INT32 m_lcropFromBottom;
bool m_bStretch;
bool m_bTile;

View File

@ -173,7 +173,7 @@ public:
std::vector<CProperty> m_arProperties;
// по идее - это instance, но нам так удобнее,
// тем более это класс - не связанный с RecordHeader
long m_lCount;
size_t m_lCount;
CProperties() : m_arProperties()
{
@ -187,7 +187,7 @@ public:
void FromStream(POLE::Stream* pStream, long lCount)
{
m_lCount = lCount;
for (long lIndex = 0; lIndex < m_lCount; ++lIndex)
for (size_t lIndex = 0; lIndex < m_lCount; ++lIndex)
{
CProperty elem;
m_arProperties.push_back(elem);
@ -195,7 +195,7 @@ public:
}
// теперь читаем дополнительную информацию
// сортировано по pid'ам (но у нас пока просто по-порядку)
for (long lIndex = 0; lIndex < m_lCount; ++lIndex)
for (size_t lIndex = 0; lIndex < m_lCount; ++lIndex)
{
m_arProperties[lIndex].ComplexFromStream(pStream);
}
@ -205,7 +205,7 @@ public:
_UINT32 GetLen()
{
_UINT32 dwLen = 6 * m_lCount;
for (long nIndex = 0; nIndex < m_lCount; ++nIndex)
for (size_t nIndex = 0; nIndex < m_lCount; ++nIndex)
{
if (m_arProperties[nIndex].m_bComplex)
{

View File

@ -2490,6 +2490,7 @@ namespace SimpleTypes
else if(L"5Arrows" == sValue) this->m_eValue = Arrows5;
else if(L"5ArrowsGray" == sValue) this->m_eValue = Arrows5Gray;
else if(L"5Quarters" == sValue) this->m_eValue = Quarters5;
//..ext....
else if(L"5Rating" == sValue) this->m_eValue = Rating5;
else if(L"3Triangles" == sValue) this->m_eValue = Triangles3;
else if(L"3Stars" == sValue) this->m_eValue = Stars3;

View File

@ -513,7 +513,7 @@ const CIconSet CIconSet::Merge(const CIconSet& oPrev, const CIconSet& oCurrent)
}
bool CIconSet::isExtended ()
{
return (false == m_arrIconSets.empty());
return (false == m_arrIconSets.empty() || (m_oIconSet.IsInit() && m_oIconSet->GetValue() > 15));
}
void CIconSet::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{

View File

@ -107,7 +107,9 @@ HEADERS += \
\
./Fonts.h \
./Graphics.h \
./Image.h
./Image.h \
./../../raster/Metafile/svg/SVGFramework.h \
./../../raster/Metafile/svg/SVGTransformer.h
SOURCES += \
./../Matrix.cpp \
@ -133,7 +135,9 @@ SOURCES += \
\
./pro_Fonts.cpp \
./pro_Image.cpp \
./pro_Graphics.cpp
./pro_Graphics.cpp \
./../../raster/Metafile/svg/SVGFramework.cpp \
./../../raster/Metafile/svg/SVGTransformer.cpp
SOURCES += $$PWD/graphics_pri.cpp

View File

@ -518,7 +518,7 @@ bool CImageFileFormatChecker::isImageFile(std::wstring& fileName)
///////////////////////////////////////////////////////////////////////
if (isSvgFile(fileName))
{
eFileType = _CXIMAGE_FORMAT_UNKNOWN;
eFileType = _CXIMAGE_FORMAT_SVG;
}
if (isRawFile(fileName))
{
@ -599,8 +599,51 @@ bool CImageFileFormatChecker::isRawFile(std::wstring& fileName)
}
bool CImageFileFormatChecker::isSvgFile(std::wstring& fileName)
{
//TODO:
return false;
NSFile::CFileBinary file;
if (!file.OpenFile(fileName))
return false;
DWORD nSize = (DWORD)file.GetFileSize();
if (nSize > 100)
nSize = 100;
BYTE* buffer = new BYTE[nSize];
if (!buffer)
return false;
DWORD sizeRead = 0;
if (!file.ReadFile(buffer, nSize, sizeRead))
{
delete []buffer;
return false;
}
file.CloseFile();
if ('<' == buffer[0] &&
's' == buffer[1] &&
'v' == buffer[2] &&
'g' == buffer[3])
{
delete [] buffer;
return true;
}
if ('<' == buffer[0] &&
'?' == buffer[1] &&
'x' == buffer[2] &&
'm' == buffer[3] &&
'l' == buffer[4])
{
std::string test((char*)buffer, nSize);
if (std::string::npos != test.find("<svg"))
{
delete [] buffer;
return true;
}
}
delete [] buffer;
return false;
}
std::wstring CImageFileFormatChecker::DetectFormatByData(BYTE *Data, int DataSize)

View File

@ -61,7 +61,8 @@ enum __ENUM_CXIMAGE_FORMATS
_CXIMAGE_FORMAT_PSD = 20,
_CXIMAGE_FORMAT_EMF = 21,
_CXIMAGE_FORMAT_WB = 22,
_CXIMAGE_FORMAT_SVM = 23
_CXIMAGE_FORMAT_SVM = 23,
_CXIMAGE_FORMAT_SVG = 24,
};
class GRAPHICS_DECL CImageFileFormatChecker

View File

@ -93,6 +93,8 @@ namespace MetaFile
m_oWmfFile.SetFontManager(m_pFontManager);
m_oEmfFile.SetFontManager(m_pFontManager);
m_oSvmFile.SetFontManager(m_pFontManager);
m_oSvgFile.SetFontManager(m_pFontManager);
//------------------------------------------------------
@ -134,6 +136,12 @@ namespace MetaFile
m_oSvmFile.Close();
}
// Это не svm
if (m_oSvgFile.OpenFromFile(wsFilePath) == true)
{
m_lType = c_lMetaSvg;
return true;
}
return false;
};
@ -162,6 +170,10 @@ namespace MetaFile
m_oSvmFile.SetOutputDevice((IOutputDevice*)&oSvmOut);
m_oSvmFile.PlayMetaFile();
}
else if (c_lMetaSvg == m_lType)
{
m_oSvgFile.Draw(pRenderer, dX, dY, dWidth, dHeight);
}
pRenderer->EndCommand(c_nImageType);
return true;
};
@ -170,6 +182,7 @@ namespace MetaFile
m_oWmfFile.Close();
m_oEmfFile.Close();
m_oSvmFile.Close();
m_oSvgFile.Close();
m_lType = 0;
};
@ -177,49 +190,56 @@ namespace MetaFile
{
return m_lType;
}
void CMetaFile::GetBounds(double* pdX, double* pdY, double* pdW, double* pdH)
void CMetaFile::GetBounds(double* pdX, double* pdY, double* pdW, double* pdH)
{
if (c_lMetaWmf == m_lType)
{
if (c_lMetaWmf == m_lType)
{
const TRectD& oRect = m_oWmfFile.GetBounds();
*pdX = oRect.dLeft;
*pdY = oRect.dTop;
*pdW = oRect.dRight - oRect.dLeft;
*pdH = oRect.dBottom - oRect.dTop;
}
else if (c_lMetaEmf == m_lType)
{
TEmfRectL* pRect = m_oEmfFile.GetBounds();
*pdX = pRect->lLeft;
*pdY = pRect->lTop;
*pdW = pRect->lRight - pRect->lLeft;
*pdH = pRect->lBottom - pRect->lTop;
}
else if (c_lMetaSvm == m_lType)
{
TRect* pRect = m_oSvmFile.GetBounds();
*pdX = pRect->nLeft;
*pdY = pRect->nTop;
*pdW = pRect->nRight - pRect->nLeft;
*pdH = pRect->nBottom - pRect->nTop;
const TRectD& oRect = m_oWmfFile.GetBounds();
*pdX = oRect.dLeft;
*pdY = oRect.dTop;
*pdW = oRect.dRight - oRect.dLeft;
*pdH = oRect.dBottom - oRect.dTop;
}
else if (c_lMetaEmf == m_lType)
{
TEmfRectL* pRect = m_oEmfFile.GetBounds();
*pdX = pRect->lLeft;
*pdY = pRect->lTop;
*pdW = pRect->lRight - pRect->lLeft;
*pdH = pRect->lBottom - pRect->lTop;
}
else if (c_lMetaSvm == m_lType)
{
TRect* pRect = m_oSvmFile.GetBounds();
*pdX = pRect->nLeft;
*pdY = pRect->nTop;
*pdW = pRect->nRight - pRect->nLeft;
*pdH = pRect->nBottom - pRect->nTop;
if (*pdW > 10000 || *pdH > 10000)
{
*pdW /= 10;
*pdH /= 10;
}
}
else
if (*pdW > 10000 || *pdH > 10000)
{
*pdX = 0;
*pdY = 0;
*pdW = 0;
*pdH = 0;
*pdW /= 10;
*pdH /= 10;
}
if (*pdW < 0) *pdW = -*pdW;
if (*pdH < 0) *pdH = -*pdH;
};
void CMetaFile::ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight)
}
else if (c_lMetaSvg == m_lType)
{
*pdX = 0;
*pdY = 0;
*pdW = m_oSvgFile.get_Width();
*pdH = m_oSvgFile.get_Height();
}
else
{
*pdX = 0;
*pdY = 0;
*pdW = 0;
*pdH = 0;
}
if (*pdW < 0) *pdW = -*pdW;
if (*pdH < 0) *pdH = -*pdH;
};
void CMetaFile::ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight)
{
CFontManager *pFontManager = (CFontManager*)m_pAppFonts->GenerateFontManager();
CFontsCache* pFontCache = new CFontsCache();

View File

@ -39,6 +39,7 @@
#include "Wmf/WmfFile.h"
#include "Emf/EmfFile.h"
#include "StarView/SvmFile.h"
#include "svg/SVGTransformer.h"
namespace MetaFile
{
@ -63,6 +64,8 @@ namespace MetaFile
CWmfFile m_oWmfFile;
CEmfFile m_oEmfFile;
CSvmFile m_oSvmFile;
CSVGTransformer m_oSvgFile;
int m_lType;
};
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
#include "SVGTransformer.h"
#include "SVGFramework.h"
class CSVGTransformer_private
{
public:
SVG::Parser m_oXmlParser;
SVG::Storage m_oStorage;
SVG::Painter m_oRender;
};
CSVGTransformer::CSVGTransformer()
{
m_internal = new CSVGTransformer_private();
}
CSVGTransformer::~CSVGTransformer()
{
delete m_internal;
}
bool CSVGTransformer::OpenFromFile(const std::wstring& file)
{
m_internal->m_oStorage.Clear();
std::wstring sDirectory = NSFile::GetDirectoryName(file);
m_internal->m_oXmlParser.SetWorkingDirectory(sDirectory);
m_internal->m_oRender.SetWorkingDirectory(sDirectory);
m_internal->m_oStorage.SetWorkingDirectory(sDirectory);
if (0 == m_internal->m_oXmlParser.LoadFromFile(file, &m_internal->m_oStorage))
return false;
return true;
}
bool CSVGTransformer::Load(const std::wstring& content)
{
m_internal->m_oStorage.Clear();
if (0 == m_internal->m_oXmlParser.LoadFromString(content, &m_internal->m_oStorage))
return false;
return true;
}
void CSVGTransformer::Close()
{
delete m_internal;
m_internal = new CSVGTransformer_private();
}
void CSVGTransformer::SetFontManager(NSFonts::IFontManager* pFontManager)
{
m_internal->m_oRender.SetFontManager(pFontManager);
return;
}
bool CSVGTransformer::Draw(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight)
{
m_internal->m_oRender.SetCSS(m_internal->m_oXmlParser.GetCSS());
m_internal->m_oRender.Draw(&m_internal->m_oStorage, pRenderer, m_internal->m_oXmlParser.GetUnitSystem(), dX, dY, dWidth, dHeight);
return true;
}
int CSVGTransformer::get_Width()
{
return m_internal->m_oXmlParser.GetWidth();
}
int CSVGTransformer::get_Height()
{
return m_internal->m_oXmlParser.GetHeight();
}
int CSVGTransformer::get_Metrics()
{
return m_internal->m_oXmlParser.GetMetrics();
}

View File

@ -0,0 +1,33 @@
#ifndef _BUILD_GRAPHICS_SVG_TRANSFORMER_H_
#define _BUILD_GRAPHICS_SVG_TRANSFORMER_H_
#include "../../../graphics/IRenderer.h"
#include "../../../graphics/config.h"
#include "../../../graphics/pro/Fonts.h"
class CSVGTransformer_private;
class GRAPHICS_DECL CSVGTransformer
{
public:
CSVGTransformer();
~CSVGTransformer();
public:
bool OpenFromFile(const std::wstring& file);
bool Load(const std::wstring& content);
void Close();
void SetFontManager(NSFonts::IFontManager* pFontManager);
bool Draw(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight);
int get_Width();
int get_Height();
int get_Metrics();
private:
CSVGTransformer_private* m_internal;
};
#endif // _BUILD_GRAPHICS_SVG_TRANSFORMER_H_

View File

@ -51,14 +51,26 @@
#include <stdio.h>
#endif
class CHtmlFile_Private
{
public:
bool m_bIsEpub;
public:
CHtmlFile_Private()
{
m_bIsEpub = false;
}
};
CHtmlFile::CHtmlFile()
{
m_internal = new CHtmlFile_Private();
}
CHtmlFile::~CHtmlFile()
{
RELEASEOBJECT(m_internal);
}
static std::wstring GetSdkPath()
@ -261,7 +273,20 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
oBuilder.WriteEncodeXmlString(CorrectHtmlPath(sFilePath));
else
{
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"HTM");
std::wstring sTmpDir = L"";
if (m_internal->m_bIsEpub)
{
// чтобы ссылки на картинки остались
sTmpDir = NSFile::GetDirectoryName(sFilePath);
if (!NSDirectory::Exists(sTmpDir))
sTmpDir = NSDirectory::GetTempPath();
}
else
{
sTmpDir = NSDirectory::GetTempPath();
}
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"HTM");
if (NSFile::CFileBinary::Exists(sTmpFile))
NSFile::CFileBinary::Remove(sTmpFile);
@ -665,7 +690,10 @@ int CHtmlFile::ConvertEpub(const std::wstring& sFolder, std::wstring& sMetaInfo,
if (arHtmls.size() == 0)
return 1;
return this->Convert(arHtmls, sDstfolder, sPathInternal);
m_internal->m_bIsEpub = true;
int nErr = this->Convert(arHtmls, sDstfolder, sPathInternal);
m_internal->m_bIsEpub = false;
return nErr;
}
/////////////////////////////////////////////////////////////////

View File

@ -42,9 +42,11 @@
#define HTMLFILE_DECL_EXPORT Q_DECL_EXPORT
#endif
class CHtmlFile_Private;
class HTMLFILE_DECL_EXPORT CHtmlFile
{
private:
CHtmlFile_Private* m_internal;
public:

View File

@ -32,6 +32,7 @@
//#include <QCoreApplication>
#include "../../DesktopEditor/graphics/pro/Fonts.h"
#include "../../DesktopEditor/graphics/pro/Graphics.h"
#include "../../PdfReader/PdfReader.h"
#include "../../DjVuFile/DjVu.h"
@ -46,9 +47,10 @@
//#define RASTER_TEST
//#define METAFILE_TEST
//#define ONLINE_WORD_TO_PDF
//#define METAFILE_TEST_RASTER
#define ONLINE_WORD_TO_PDF
//#define TO_PDF
#define TO_HTML_RENDERER
//#define TO_HTML_RENDERER
//#define ONLY_TEXT
int main(int argc, char *argv[])
@ -74,14 +76,15 @@ int main(int argc, char *argv[])
#ifdef METAFILE_TEST
NSHtmlRenderer::CASCSVGWriter oWriterSVG;
NSFonts::IFontManager* pManager = pFonts->GenerateFontManager();
NSHtmlRenderer::CASCSVGWriter oWriterSVG;
oWriterSVG.SetFontManager(pManager);
MetaFile::IMetaFile* pMetafile = MetaFile::Create(pFonts);
//pMetafile->LoadFromFile(L"D:\\2\\ppt\\media\\image4.wmf");
pMetafile->LoadFromFile(L"/home/oleg/activex/1/image2.wmf");
pMetafile->LoadFromFile(L"D:\\SVG\\Disigner 2.svg");
double x = 0, y = 0, w = 0, h = 0;
pMetafile->GetBounds(&x, &y, &w, &h);
@ -96,7 +99,7 @@ int main(int argc, char *argv[])
oWriterSVG.put_Height(HH);
pMetafile->DrawOnRenderer(&oWriterSVG, 0, 0, WW, HH);
oWriterSVG.SaveFile(L"/home/oleg/activex/1/oleg.svg");
oWriterSVG.SaveFile(L"D:\\SVG\\out.png");
RELEASEOBJECT(pMetafile);
RELEASEINTERFACE(pManager);
@ -105,6 +108,58 @@ int main(int argc, char *argv[])
#endif
#ifdef METAFILE_TEST_RASTER
NSFonts::IFontManager* pManager = pFonts->GenerateFontManager();
NSGraphics::IGraphicsRenderer* pRasterRenderer = NSGraphics::Create();
pRasterRenderer->SetFontManager(pManager);
int nRasterW = 1000;
int nRasterH = 1000;
BYTE* pData = new BYTE[4 * nRasterW * nRasterH];
//memset(pData, 255, 4 * nRasterW * nRasterH);
unsigned int back = 0xffffff;
unsigned int* pData32 = (unsigned int*)pData;
unsigned int* pData32End = pData32 + nRasterW * nRasterH;
//дефолтный тон должен быть прозрачным, а не белым
while (pData32 < pData32End)
*pData32++ = back;
CBgraFrame oFrame;
oFrame.put_Data(pData);
oFrame.put_Width(nRasterW);
oFrame.put_Height(nRasterH);
oFrame.put_Stride(4 * nRasterW);
pRasterRenderer->CreateFromBgraFrame(&oFrame);
pRasterRenderer->SetSwapRGB(false);
double dW_MM = nRasterW * 25.4 / 96;
double dH_MM = nRasterH * 25.4 / 96;
pRasterRenderer->put_Width(dW_MM);
pRasterRenderer->put_Height(dH_MM);
MetaFile::IMetaFile* pMetafile = MetaFile::Create(pFonts);
pMetafile->LoadFromFile(L"D:\\test\\123.svg");
double x = 0, y = 0, w = 0, h = 0;
pMetafile->GetBounds(&x, &y, &w, &h);
pMetafile->DrawOnRenderer(pRasterRenderer, dW_MM / 4, dW_MM / 4, dW_MM / 2, dH_MM / 2);
pMetafile->ConvertToRaster(L"D:\\SVG\\out2.png", 4, 1000);
oFrame.SaveFile(L"D:\\SVG\\out.png", 4);
RELEASEOBJECT(pMetafile);
RELEASEINTERFACE(pManager);
RELEASEINTERFACE(pRasterRenderer);
return 0;
#endif
#ifdef ONLINE_WORD_TO_PDF
CPdfRenderer oPdfW(pFonts);
oPdfW.SetTempFolder(L"D:\\test\\Document");

View File

@ -1367,7 +1367,10 @@ HRESULT CPdfRenderer::DrawImageFromFile(const std::wstring& wsImagePath, const d
Aggplus::CImage* pAggImage = NULL;
CImageFileFormatChecker oImageFormat(wsImagePath);
if (_CXIMAGE_FORMAT_WMF == oImageFormat.eFileType || _CXIMAGE_FORMAT_EMF == oImageFormat.eFileType || _CXIMAGE_FORMAT_SVM == oImageFormat.eFileType)
if (_CXIMAGE_FORMAT_WMF == oImageFormat.eFileType ||
_CXIMAGE_FORMAT_EMF == oImageFormat.eFileType ||
_CXIMAGE_FORMAT_SVM == oImageFormat.eFileType ||
_CXIMAGE_FORMAT_SVG == oImageFormat.eFileType)
{
// TODO: Реализовать отрисовку метафайлов по-нормальному
MetaFile::IMetaFile* pMeta = MetaFile::Create(m_pAppFonts);
@ -1814,7 +1817,10 @@ void CPdfRenderer::UpdateBrush()
pImage->LoadJpx(wsTexturePath.c_str(), nImageW, nImageH);
}
}
else if (_CXIMAGE_FORMAT_WMF == oImageFormat.eFileType || _CXIMAGE_FORMAT_EMF == oImageFormat.eFileType || _CXIMAGE_FORMAT_SVM == oImageFormat.eFileType)
else if (_CXIMAGE_FORMAT_WMF == oImageFormat.eFileType ||
_CXIMAGE_FORMAT_EMF == oImageFormat.eFileType ||
_CXIMAGE_FORMAT_SVM == oImageFormat.eFileType ||
_CXIMAGE_FORMAT_SVG == oImageFormat.eFileType)
{
// TODO: Реализовать отрисовку метафайлов по-нормальному
MetaFile::IMetaFile* pMeta = MetaFile::Create(m_pAppFonts);