mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-05 02:11:47 +08:00
Compare commits
17 Commits
core-win-3
...
core-win-3
| Author | SHA1 | Date | |
|---|---|---|---|
| e3ff8912f0 | |||
| 98114aa7a5 | |||
| 6bd1d9b90b | |||
| 36aa148aa0 | |||
| f69180dcf6 | |||
| 864c3bfdc7 | |||
| 4bb34abf91 | |||
| 3887879671 | |||
| 9516a0b02b | |||
| 047041aa9b | |||
| ca5e70118c | |||
| 99159d5932 | |||
| 5d89558b5d | |||
| 5058d41d6a | |||
| 69be19feda | |||
| 73933c683e | |||
| e8f1da2478 |
@ -82,6 +82,7 @@ namespace DocFileFormat
|
||||
int cp = m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr;
|
||||
|
||||
size_t count = m_document->AnnotationsReferencePlex->Elements.size();
|
||||
|
||||
for (size_t index = 0; index < count; ++index)
|
||||
{
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
|
||||
@ -92,14 +93,15 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comment", TRUE );
|
||||
if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 + count + 1024 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (atrdPre10->m_BookmarkId < 0)//-1 - easy ref (not start/end comment ref)
|
||||
//{
|
||||
// m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 + count + 1024 ));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::SizeTToWideString( index + 1 ));
|
||||
}
|
||||
//}
|
||||
|
||||
if (atrdPost10)
|
||||
{
|
||||
m_pXmlWriter->WriteAttribute( L"w:date", atrdPost10->m_nDTTM.getString());
|
||||
|
||||
@ -1057,8 +1057,8 @@ namespace DocFileFormat
|
||||
|
||||
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index - 1]);
|
||||
|
||||
if (atrdPre10->m_BookmarkId < 0)
|
||||
index += m_document->AnnotationsReferencePlex->Elements.size() + 1024;
|
||||
//if (atrdPre10->m_BookmarkId < 0)
|
||||
// index += m_document->AnnotationsReferencePlex->Elements.size() + 1024;
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"w:id", FormatUtils::IntToWideString(index));
|
||||
m_pXmlWriter->WriteNodeEnd( L"", true );
|
||||
|
||||
@ -39,7 +39,8 @@ enum ElementType
|
||||
typeNone = 0,
|
||||
type_AbstractXml,
|
||||
|
||||
typeTextText = 1000,
|
||||
typeTextTextElement = 1000,
|
||||
typeTextText,
|
||||
typeTextS,
|
||||
typeTextTab,
|
||||
typeTextLineBreak,
|
||||
@ -247,6 +248,7 @@ enum ElementType
|
||||
typeStyleTableColumnProperties,
|
||||
typeStyleTableRowProperties,
|
||||
typeStyleTableCellProperties,
|
||||
typeStyleHeaderFooter,
|
||||
typeStyleHeader,
|
||||
typeStyleFooter,
|
||||
typeStyleHeaderFirst,
|
||||
@ -535,7 +537,10 @@ enum ElementType
|
||||
typeOfficeAnnotation,
|
||||
typeOfficeAnnotationStart,
|
||||
typeOfficeAnnotationEnd,
|
||||
typeStyleRegion,
|
||||
typeStyleRegionLeft,
|
||||
typeStyleRegionCenter,
|
||||
typeStyleRegionRight,
|
||||
typeOfficeScripts,
|
||||
typeOfficeScript,
|
||||
typeOfficePresentation,
|
||||
@ -591,8 +596,6 @@ enum ElementType
|
||||
typeChartRegressionCurve,
|
||||
typeChartEquation,
|
||||
|
||||
typeStyleRegionCenter,
|
||||
typeStyleRegionRight,
|
||||
typeStyleChartProperties,
|
||||
|
||||
typeCalcextColorScaleEntry,
|
||||
|
||||
@ -38,8 +38,9 @@
|
||||
#include "oox_rels.h"
|
||||
namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
class header_footer_impl;
|
||||
namespace odf_reader
|
||||
{
|
||||
class header_footer_impl;
|
||||
}
|
||||
|
||||
namespace oox {
|
||||
|
||||
@ -59,6 +59,7 @@ public:
|
||||
std::wstringstream dataValidations_;
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
std::wstringstream header_footer_;
|
||||
std::wstringstream controls_;
|
||||
std::wstringstream protection_;
|
||||
|
||||
@ -149,6 +150,10 @@ std::wostream & xlsx_xml_worksheet::page_properties()
|
||||
{
|
||||
return impl_->page_props_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::header_footer()
|
||||
{
|
||||
return impl_->header_footer_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::picture_background()
|
||||
{
|
||||
return impl_->picture_background_;
|
||||
@ -212,10 +217,10 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->hyperlinks_.str();
|
||||
}
|
||||
}
|
||||
if (false == impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}//props выше legacyDrawing !!
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
//props выше legacyDrawing !!
|
||||
|
||||
CP_XML_STREAM() << impl_->header_footer_.str();
|
||||
|
||||
if (false == impl_->drawingId_.empty())
|
||||
{
|
||||
|
||||
@ -67,6 +67,7 @@ public:
|
||||
std::wostream & sort();
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
std::wostream & header_footer();
|
||||
std::wostream & controls();
|
||||
std::wostream & protection();
|
||||
|
||||
|
||||
@ -406,6 +406,49 @@ void xlsx_table_state::serialize_page_properties (std::wostream & strm)
|
||||
|
||||
page_layout->xlsx_serialize(strm, *context_);
|
||||
}
|
||||
void xlsx_table_state::serialize_header_footer (std::wostream & strm)
|
||||
{
|
||||
_CP_OPT(std::wstring) masterPageName = context_->root()->odf_context().styleContainer().master_page_name_by_name(table_style_);
|
||||
if (!masterPageName) return;
|
||||
|
||||
odf_reader::style_master_page* master_style_ = context_->root()->odf_context().pageLayoutContainer().master_page_by_name(*masterPageName);
|
||||
if (!master_style_) return;
|
||||
|
||||
odf_reader::style_header *header_odd = dynamic_cast<odf_reader::style_header*> (master_style_->style_header_.get());
|
||||
odf_reader::style_header_first *header_first = dynamic_cast<odf_reader::style_header_first*> (master_style_->style_header_first_.get());
|
||||
odf_reader::style_header_left *header_even = dynamic_cast<odf_reader::style_header_left*> (master_style_->style_header_left_.get());
|
||||
|
||||
odf_reader::style_footer *footer_odd = dynamic_cast<odf_reader::style_footer*> (master_style_->style_footer_.get());
|
||||
odf_reader::style_footer_first *footer_first = dynamic_cast<odf_reader::style_footer_first*> (master_style_->style_footer_first_.get());
|
||||
odf_reader::style_footer_left *footer_even = dynamic_cast<odf_reader::style_footer_left*> (master_style_->style_footer_left_.get());
|
||||
|
||||
if (!header_odd && !header_first && !header_even &&
|
||||
!footer_odd && !footer_first && !footer_even) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"headerFooter")
|
||||
{
|
||||
if (master_style_->style_header_left_ || master_style_->style_footer_left_)
|
||||
{
|
||||
CP_XML_ATTR(L"differentOddEven", 1);
|
||||
}
|
||||
if (master_style_->style_header_first_ || master_style_->style_footer_first_)
|
||||
{
|
||||
CP_XML_ATTR(L"differentFirst", 1);
|
||||
}
|
||||
|
||||
if (header_odd) header_odd->xlsx_serialize(CP_XML_STREAM(), *context_);
|
||||
if (footer_odd) footer_odd->xlsx_serialize(CP_XML_STREAM(), *context_);
|
||||
|
||||
if (header_even) header_even->xlsx_serialize(CP_XML_STREAM(), *context_);
|
||||
if (footer_even) footer_even->xlsx_serialize(CP_XML_STREAM(), *context_);
|
||||
|
||||
if (header_first) header_first->xlsx_serialize(CP_XML_STREAM(), *context_);
|
||||
if (footer_first) footer_first->xlsx_serialize(CP_XML_STREAM(), *context_);
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_table_state::serialize_background (std::wostream & strm)
|
||||
{
|
||||
if (tableBackground_.empty()) return;
|
||||
|
||||
@ -184,6 +184,7 @@ public:
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
void serialize_header_footer (std::wostream & _Wostream);
|
||||
|
||||
void dump_rels_hyperlinks (rels & Rels);
|
||||
void dump_rels_ole_objects (rels & Rels);
|
||||
@ -217,6 +218,9 @@ private:
|
||||
int tableId_;
|
||||
std::wstring tableBackground_;
|
||||
|
||||
_CP_OPT(double) header_page;
|
||||
_CP_OPT(double) footer_page;
|
||||
|
||||
std::wstring table_style_;
|
||||
std::wstring table_row_style_;
|
||||
std::wstring cell_style_;
|
||||
|
||||
@ -290,6 +290,23 @@ unsigned int xlsx_table_context::columns_count()
|
||||
return state()->columns_count();
|
||||
}
|
||||
|
||||
void xlsx_table_context::set_header_page(_CP_OPT(double) val)
|
||||
{
|
||||
state()->header_page = val;
|
||||
}
|
||||
_CP_OPT(double) xlsx_table_context::get_header_page()
|
||||
{
|
||||
return state()->header_page;
|
||||
}
|
||||
void xlsx_table_context::set_footer_page(_CP_OPT(double) val)
|
||||
{
|
||||
state()->footer_page = val;
|
||||
}
|
||||
_CP_OPT(double) xlsx_table_context::get_footer_page()
|
||||
{
|
||||
return state()->footer_page;
|
||||
}
|
||||
|
||||
std::wstring xlsx_table_context::default_row_cell_style()
|
||||
{
|
||||
return state()->default_row_cell_style();
|
||||
@ -511,6 +528,10 @@ void xlsx_table_context::serialize_page_properties(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_page_properties(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_header_footer(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_header_footer(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_background(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_background(_Wostream);
|
||||
|
||||
@ -83,6 +83,12 @@ public:
|
||||
|
||||
unsigned int columns_count();
|
||||
|
||||
void set_header_page(_CP_OPT(double) val);
|
||||
_CP_OPT(double) get_header_page();
|
||||
|
||||
void set_footer_page(_CP_OPT(double) val);
|
||||
_CP_OPT(double) get_footer_page();
|
||||
|
||||
void serialize_tableParts (std::wostream & _Wostream, rels & Rels);
|
||||
void serialize_sort (std::wostream & _Wostream);
|
||||
void serialize_autofilter (std::wostream & _Wostream);
|
||||
@ -96,6 +102,7 @@ public:
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
void serialize_protection (std::wostream & _Wostream);
|
||||
void serialize_header_footer (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
|
||||
@ -475,6 +475,7 @@ void xlsx_conversion_context::end_table()
|
||||
|
||||
get_table_context().serialize_table_format (current_sheet().sheetFormat());
|
||||
get_table_context().serialize_page_properties (current_sheet().page_properties());
|
||||
get_table_context().serialize_header_footer (current_sheet().header_footer());
|
||||
get_table_context().serialize_conditionalFormatting (current_sheet().conditionalFormatting());
|
||||
get_table_context().serialize_tableParts (current_sheet().tableParts(), current_sheet().sheet_rels());
|
||||
get_table_context().serialize_autofilter (current_sheet().autofilter());
|
||||
|
||||
@ -159,7 +159,7 @@ length ComputeContextWidth(const style_page_layout_properties * pageProperties
|
||||
if (pagePropertiesNode)
|
||||
{
|
||||
if (const style_columns * styleColumns
|
||||
= dynamic_cast<const style_columns*>( pagePropertiesNode->elements_.style_columns_.get()))
|
||||
= dynamic_cast<const style_columns*>( pagePropertiesNode->style_columns_.get()))
|
||||
{
|
||||
columnsCount = styleColumns->fo_column_count_.get_value_or(1);
|
||||
if (!columnsCount)
|
||||
|
||||
@ -41,8 +41,6 @@ namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
// style-header-footer-properties-attlist
|
||||
|
||||
void style_header_footer_properties_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"svg:height", svg_height_);
|
||||
@ -58,7 +56,7 @@ void style_header_footer_properties_attlist::add_attributes( const xml::attribut
|
||||
CP_APPLY_ATTR(L"style:dynamic-spacing", style_dynamic_spacing_);
|
||||
}
|
||||
|
||||
/// style-header-footer-properties
|
||||
|
||||
const wchar_t * style_header_footer_properties::ns = L"style";
|
||||
const wchar_t * style_header_footer_properties::name = L"header-footer-properties";
|
||||
|
||||
@ -78,30 +76,10 @@ void style_header_footer_properties::add_child_element( xml::sax * Reader, const
|
||||
not_applicable_element(L"style-header-footer-properties", Reader, Ns, Name);
|
||||
}
|
||||
}
|
||||
|
||||
// common-style-header-footer-attlist
|
||||
|
||||
void common_style_header_footer_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"style:display", style_display_, true);
|
||||
}
|
||||
|
||||
// header-footer-content
|
||||
std::wostream & header_footer_content::text_to_stream(std::wostream & _Wostream, bool bXmlEncode) const
|
||||
{
|
||||
serialize_elements_text(_Wostream, content_, bXmlEncode);
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
void header_footer_content::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context)
|
||||
{
|
||||
if CP_CHECK_NAME(L"text", L"tracked-changes")
|
||||
{
|
||||
CP_CREATE_ELEMENT_SIMPLE(tracked_changes_);
|
||||
}
|
||||
else
|
||||
CP_CREATE_ELEMENT_SIMPLE(content_);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,17 +95,6 @@ public:
|
||||
private:
|
||||
bool style_display_; // default true
|
||||
|
||||
};
|
||||
// header-footer-content
|
||||
class header_footer_content
|
||||
{
|
||||
public:
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
|
||||
|
||||
office_element_ptr tracked_changes_;
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -364,6 +364,34 @@ style_page_layout_properties * page_layout_instance::properties() const
|
||||
|
||||
void page_layout_instance::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
const style_header_style * headerStyle = dynamic_cast<style_header_style *>(style_page_layout_->style_header_style_.get());
|
||||
const style_footer_style * footerStyle = dynamic_cast<style_footer_style *>(style_page_layout_->style_footer_style_.get());
|
||||
|
||||
style_header_footer_properties * headerProp = headerStyle ? dynamic_cast<style_header_footer_properties *>(headerStyle->style_header_footer_properties_.get()) : NULL;
|
||||
style_header_footer_properties * footerProp = footerStyle ? dynamic_cast<style_header_footer_properties *>(footerStyle->style_header_footer_properties_.get()) : NULL;
|
||||
|
||||
if (headerProp)
|
||||
{
|
||||
const style_header_footer_properties_attlist & attr = headerProp->style_header_footer_properties_attlist_;
|
||||
_CP_OPT(double) header;
|
||||
|
||||
if (attr.fo_min_height_) header = attr.fo_min_height_->get_value_unit(length::pt);
|
||||
else if (attr.svg_height_) header = attr.svg_height_->get_value_unit(length::pt);
|
||||
|
||||
Context.get_table_context().set_header_page(header);
|
||||
}
|
||||
|
||||
if (footerProp)
|
||||
{
|
||||
const style_header_footer_properties_attlist & attr = footerProp->style_header_footer_properties_attlist_;
|
||||
_CP_OPT(double) footer;
|
||||
|
||||
if (attr.fo_min_height_) footer = attr.fo_min_height_->get_value_unit(length::pt);
|
||||
else if (attr.svg_height_) footer = attr.svg_height_->get_value_unit(length::pt);
|
||||
|
||||
Context.get_table_context().set_footer_page(footer);
|
||||
}
|
||||
|
||||
style_page_layout_properties * props = properties();
|
||||
if (props)
|
||||
props->xlsx_serialize(strm, Context);
|
||||
|
||||
@ -80,7 +80,7 @@ public:
|
||||
const std::wstring & parent_name() const;
|
||||
style_instance * next() const;
|
||||
const std::wstring & next_name() const;
|
||||
const styles_container * container() const { return container_; }
|
||||
const styles_container * container() const { return container_; }
|
||||
const std::wstring & data_style_name() const;
|
||||
const std::wstring & style_class() const;
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
oox::_oox_fill fill;
|
||||
|
||||
Compute_GraphicFill(layout_properties->attlist_.common_draw_fill_attlist_,
|
||||
layout_properties->elements_.style_background_image_,
|
||||
layout_properties->style_background_image_,
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
|
||||
if (layout_properties->attlist_.common_background_color_attlist_.fo_background_color_ || fill.type != 0)
|
||||
|
||||
@ -65,8 +65,11 @@ namespace odf_reader {
|
||||
|
||||
namespace text {
|
||||
|
||||
template <class ElementT>
|
||||
void paragraph_content_element<ElementT>::docx_serialize_field(const std::wstring & field_name, office_element_ptr & text,
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * paragraph_content_element::ns = L"";
|
||||
const wchar_t * paragraph_content_element::name = L"";
|
||||
|
||||
void paragraph_content_element::docx_serialize_field(const std::wstring & field_name, office_element_ptr & text,
|
||||
oox::docx_conversion_context & Context, bool bLock )
|
||||
{
|
||||
std::wostream & strm = Context.output_stream();
|
||||
@ -90,8 +93,7 @@ void paragraph_content_element<ElementT>::docx_serialize_field(const std::wstrin
|
||||
strm << L"<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>";
|
||||
}
|
||||
}
|
||||
template <class ElementT>
|
||||
void paragraph_content_element<ElementT>::docx_serialize_sdt_placeholder(const std::wstring & name, office_element_ptr & text, oox::docx_conversion_context & Context)
|
||||
void paragraph_content_element::docx_serialize_sdt_placeholder(const std::wstring & name, office_element_ptr & text, oox::docx_conversion_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output_stream();
|
||||
Context.finish_run();
|
||||
@ -106,8 +108,7 @@ void paragraph_content_element<ElementT>::docx_serialize_sdt_placeholder(const s
|
||||
strm << L"</w:sdtContent></w:sdt>";
|
||||
}
|
||||
|
||||
template <class ElementT>
|
||||
void paragraph_content_element<ElementT>::docx_serialize_run(office_element_ptr & text, oox::docx_conversion_context & Context)
|
||||
void paragraph_content_element::docx_serialize_run(office_element_ptr & text, oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.add_new_run();
|
||||
if (text)
|
||||
@ -116,6 +117,7 @@ void paragraph_content_element<ElementT>::docx_serialize_run(office_element_ptr
|
||||
}
|
||||
Context.finish_run();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * text::ns = L"";
|
||||
const wchar_t * text::name = L"";
|
||||
@ -570,9 +572,40 @@ void span::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
Context.end_span();
|
||||
}
|
||||
void span::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (content_.empty()) return;
|
||||
|
||||
if (false == text_style_name_.empty())
|
||||
{
|
||||
if (style_instance *styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text, true))
|
||||
{
|
||||
if (style_content* style = styleInst->content())
|
||||
{
|
||||
style->xlsx_serialize(_Wostream, Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
text *t = dynamic_cast<text*>(content_[i].get());
|
||||
if (t)
|
||||
{
|
||||
t->text_to_stream(_Wostream, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
text::paragraph_content_element *element = dynamic_cast<text::paragraph_content_element*>(content_[i].get());
|
||||
if (element)
|
||||
{
|
||||
element->xlsx_serialize(_Wostream, Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void span::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
if (style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text,false))
|
||||
if (style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text, false))
|
||||
Context.get_text_context().get_styles_context().start_process_style(styleInst);
|
||||
|
||||
Context.get_text_context().start_span(text_style_name_);
|
||||
@ -1015,6 +1048,10 @@ void text_page_number::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
docx_serialize_field(L"PAGE", text_, Context);
|
||||
}
|
||||
void text_page_number::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
_Wostream << L"&P";
|
||||
}
|
||||
void text_page_number::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_text_context().start_field(oox::page_number, L"");
|
||||
@ -1053,6 +1090,10 @@ void text_page_count::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
docx_serialize_field(L"NUMPAGES", text_, Context);
|
||||
}
|
||||
void text_page_count::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
_Wostream << L"&N";
|
||||
}
|
||||
void text_page_count::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
//поскольку такого поля в ms нет - конвертим как обычный текст
|
||||
@ -1090,7 +1131,10 @@ void text_date::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
docx_serialize_field(L"DATE", text_, Context, bLock);
|
||||
}
|
||||
|
||||
void text_date::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
_Wostream << L"&D";
|
||||
}
|
||||
void text_date::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_text_context().start_field(oox::date,style_data_style_name_.get_value_or(L""));
|
||||
@ -1151,6 +1195,10 @@ void text_time::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
docx_serialize_field(L"TIME", text_, Context, bLock);
|
||||
}
|
||||
void text_time::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
_Wostream << L"&T";
|
||||
}
|
||||
void text_time::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_text_context().start_field(oox::time, style_data_style_name_.get_value_or(L""));
|
||||
@ -1204,6 +1252,10 @@ void text_file_name::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
docx_serialize_field(L"FILENAME", text_, Context);
|
||||
}
|
||||
void text_file_name::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
_Wostream << L"&F";
|
||||
}
|
||||
void text_file_name::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
// Context.get_text_context().start_field(oox::file_name, style_data_style_name_.get_value_or(L""));
|
||||
@ -1467,6 +1519,10 @@ void sheet_name::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
docx_serialize_sdt_placeholder(L"sheet name", text_, Context);
|
||||
}
|
||||
void sheet_name::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
_Wostream << L"&A";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * author_name::ns = L"text";
|
||||
const wchar_t * author_name::name = L"author-name";
|
||||
|
||||
@ -53,18 +53,32 @@ namespace odf_reader {
|
||||
|
||||
namespace text {
|
||||
|
||||
template <class ElementT>
|
||||
class paragraph_content_element : public office_element_impl<ElementT>
|
||||
class paragraph_content_element : public office_element_impl<paragraph_content_element>
|
||||
{
|
||||
public:
|
||||
void docx_serialize_sdt_placeholder(const std::wstring & name, office_element_ptr & text, oox::docx_conversion_context & Context);
|
||||
void docx_serialize_field(const std::wstring & field_name, office_element_ptr & text, oox::docx_conversion_context & Context, bool bLock = false);
|
||||
void docx_serialize_run(office_element_ptr & text, oox::docx_conversion_context & Context);
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTextTextElement;
|
||||
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){}
|
||||
|
||||
virtual void docx_serialize_sdt_placeholder(const std::wstring & name, office_element_ptr & text, oox::docx_conversion_context & Context);
|
||||
virtual void docx_serialize_field(const std::wstring & field_name, office_element_ptr & text, oox::docx_conversion_context & Context, bool bLock = false);
|
||||
virtual void docx_serialize_run(office_element_ptr & text, oox::docx_conversion_context & Context);
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_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){}
|
||||
};
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// simple text
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text : public paragraph_content_element<text>
|
||||
class text : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static office_element_ptr create(const std::wstring & Text);
|
||||
@ -99,7 +113,7 @@ private:
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:s
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class s : public paragraph_content_element<s>
|
||||
class s : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -130,7 +144,7 @@ CP_REGISTER_OFFICE_ELEMENT2(s);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:tab
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class tab : public paragraph_content_element<tab>
|
||||
class tab : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -161,7 +175,7 @@ CP_REGISTER_OFFICE_ELEMENT2(tab);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:line-break
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class line_break : public paragraph_content_element<line_break>
|
||||
class line_break : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -187,7 +201,7 @@ CP_REGISTER_OFFICE_ELEMENT2(line_break);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:bookmark
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class bookmark : public paragraph_content_element<bookmark>
|
||||
class bookmark : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -211,7 +225,7 @@ CP_REGISTER_OFFICE_ELEMENT2(bookmark);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:bookmark-start
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class bookmark_start : public paragraph_content_element<bookmark_start>
|
||||
class bookmark_start : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -235,7 +249,7 @@ CP_REGISTER_OFFICE_ELEMENT2(bookmark_start);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:bookmark-end
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class bookmark_end : public paragraph_content_element<bookmark_end>
|
||||
class bookmark_end : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -260,7 +274,7 @@ CP_REGISTER_OFFICE_ELEMENT2(bookmark_end);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:bookmark-ref
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class bookmark_ref : public paragraph_content_element<bookmark_ref>
|
||||
class bookmark_ref : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -281,7 +295,7 @@ CP_REGISTER_OFFICE_ELEMENT2(bookmark_ref);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:reference-ref
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class reference_ref : public paragraph_content_element<reference_ref>
|
||||
class reference_ref : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -303,7 +317,7 @@ CP_REGISTER_OFFICE_ELEMENT2(reference_ref);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:reference-mark
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class reference_mark : public paragraph_content_element<reference_mark>
|
||||
class reference_mark : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -324,7 +338,7 @@ CP_REGISTER_OFFICE_ELEMENT2(reference_mark);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:reference-mark-start
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class reference_mark_start : public paragraph_content_element<reference_mark_start>
|
||||
class reference_mark_start : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -345,7 +359,7 @@ CP_REGISTER_OFFICE_ELEMENT2(reference_mark_start);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:reference-mark-end
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class reference_mark_end : public paragraph_content_element<reference_mark_end>
|
||||
class reference_mark_end : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -367,7 +381,7 @@ CP_REGISTER_OFFICE_ELEMENT2(reference_mark_end);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:span
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class span : public paragraph_content_element<span>
|
||||
class span : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -380,6 +394,8 @@ public:
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context);
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
span() {}
|
||||
@ -400,7 +416,7 @@ CP_REGISTER_OFFICE_ELEMENT2(span);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:a
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class a : public paragraph_content_element<a>
|
||||
class a : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -438,7 +454,7 @@ CP_REGISTER_OFFICE_ELEMENT2(a);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:note
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class note : public paragraph_content_element<note>
|
||||
class note : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -467,7 +483,7 @@ CP_REGISTER_OFFICE_ELEMENT2(note);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:ruby
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class ruby : public paragraph_content_element<ruby>
|
||||
class ruby : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -491,7 +507,7 @@ CP_REGISTER_OFFICE_ELEMENT2(ruby);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:title
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class title : public paragraph_content_element<title>
|
||||
class title : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -519,7 +535,7 @@ CP_REGISTER_OFFICE_ELEMENT2(title);
|
||||
|
||||
// text:chapter
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
class chapter : public paragraph_content_element<chapter>
|
||||
class chapter : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -545,7 +561,7 @@ CP_REGISTER_OFFICE_ELEMENT2(chapter);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//text:subject
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class subject : public paragraph_content_element<subject>
|
||||
class subject : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -570,7 +586,7 @@ CP_REGISTER_OFFICE_ELEMENT2(subject);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:placeholder
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_placeholder : public paragraph_content_element<text_placeholder>
|
||||
class text_placeholder : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -597,7 +613,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_placeholder);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:page-number
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_page_number: public paragraph_content_element<text_page_number>
|
||||
class text_page_number: public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -609,6 +625,8 @@ public:
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context);
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
private:
|
||||
@ -629,7 +647,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_page_number);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:page-count
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_page_count : public paragraph_content_element<text_page_count>
|
||||
class text_page_count : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -641,6 +659,8 @@ public:
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context);
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
_CP_OPT(odf_types::style_numformat) style_num_format_;
|
||||
@ -658,7 +678,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_page_count);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:date
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_date : public paragraph_content_element<text_date>
|
||||
class text_date : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -670,7 +690,8 @@ public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
virtual void xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context);
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
_CP_OPT(std::wstring) style_data_style_name_;
|
||||
_CP_OPT(odf_types::Bool) text_fixed_;
|
||||
@ -713,7 +734,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_modification_date);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:time
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_time : public paragraph_content_element<text_time>
|
||||
class text_time : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -725,7 +746,9 @@ public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
virtual void xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context);
|
||||
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
_CP_OPT(std::wstring) style_data_style_name_;
|
||||
_CP_OPT(odf_types::Bool)text_fixed_;
|
||||
@ -768,7 +791,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_modification_time);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:file-name
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_file_name : public paragraph_content_element<text_file_name>
|
||||
class text_file_name : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -780,7 +803,9 @@ public:
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
virtual void xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context);
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
private:
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
@ -795,7 +820,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_file_name);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:hidden-paragraph
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class hidden_paragraph : public paragraph_content_element<hidden_paragraph>
|
||||
class hidden_paragraph : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -819,7 +844,7 @@ CP_REGISTER_OFFICE_ELEMENT2(hidden_paragraph);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:hidden-text
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class hidden_text : public paragraph_content_element<hidden_text>
|
||||
class hidden_text : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -844,7 +869,7 @@ CP_REGISTER_OFFICE_ELEMENT2(hidden_text);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sequence
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sequence : public paragraph_content_element<sequence>
|
||||
class sequence : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -875,7 +900,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sequence);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:expression
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class expression: public paragraph_content_element<expression>
|
||||
class expression: public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -903,7 +928,7 @@ CP_REGISTER_OFFICE_ELEMENT2(expression);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:text-input
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_input: public paragraph_content_element<text_input>
|
||||
class text_input: public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -927,7 +952,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_input);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sequence_ref
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sequence_ref : public paragraph_content_element<sequence_ref>
|
||||
class sequence_ref : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -952,7 +977,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sequence_ref);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//text:drop-down
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_drop_down : public paragraph_content_element<text_drop_down>
|
||||
class text_drop_down : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -979,7 +1004,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_drop_down);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//text:label
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class text_label : public paragraph_content_element<text_label>
|
||||
class text_label : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1000,7 +1025,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_label);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sheet-name
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sheet_name : public paragraph_content_element<sheet_name>
|
||||
class sheet_name : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1010,6 +1035,8 @@ public:
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_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){}
|
||||
@ -1022,7 +1049,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sheet_name);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:author-name
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class author_name : public paragraph_content_element<author_name>
|
||||
class author_name : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1044,7 +1071,7 @@ CP_REGISTER_OFFICE_ELEMENT2(author_name);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:author-initials
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class author_initials : public paragraph_content_element<author_initials>
|
||||
class author_initials : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1066,7 +1093,7 @@ CP_REGISTER_OFFICE_ELEMENT2(author_initials);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sender-city
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sender_city : public paragraph_content_element<sender_city>
|
||||
class sender_city : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1088,7 +1115,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sender_city);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sender-postal-code
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sender_postal_code : public paragraph_content_element<sender_postal_code>
|
||||
class sender_postal_code : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1112,7 +1139,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sender_postal_code);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sender-street
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sender_street : public paragraph_content_element<sender_street>
|
||||
class sender_street : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1134,7 +1161,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sender_street);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sender-state-or-province
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sender_state_or_province : public paragraph_content_element<sender_state_or_province>
|
||||
class sender_state_or_province : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1156,7 +1183,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sender_state_or_province);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sender-email
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sender_email : public paragraph_content_element<sender_email>
|
||||
class sender_email : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1178,7 +1205,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sender_email);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sender-firstname
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sender_firstname : public paragraph_content_element<sender_firstname>
|
||||
class sender_firstname : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1200,7 +1227,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sender_firstname);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sender-lastname
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sender_lastname : public paragraph_content_element<sender_lastname>
|
||||
class sender_lastname : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1222,7 +1249,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sender_lastname);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// text:sender-company
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class sender_company : public paragraph_content_element<sender_company>
|
||||
class sender_company : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1245,7 +1272,7 @@ CP_REGISTER_OFFICE_ELEMENT2(sender_company);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//text:user-field-get
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class text_user_field_get : public paragraph_content_element<text_user_field_get>
|
||||
class text_user_field_get : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1271,7 +1298,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_user_field_get);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//text:user-defined
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class text_user_defined : public paragraph_content_element<text_user_defined>
|
||||
class text_user_defined : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1299,7 +1326,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_user_defined);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:bibliography-mark
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class bibliography_mark : public paragraph_content_element<bibliography_mark>
|
||||
class bibliography_mark : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1356,7 +1383,7 @@ CP_REGISTER_OFFICE_ELEMENT2(bibliography_mark);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:alphabetical-index-auto-mark-file
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class alphabetical_index_auto_mark_file : public paragraph_content_element<alphabetical_index_auto_mark_file>
|
||||
class alphabetical_index_auto_mark_file : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1377,7 +1404,7 @@ CP_REGISTER_OFFICE_ELEMENT2(alphabetical_index_auto_mark_file);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:alphabetical-index-mark-start
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class alphabetical_index_mark_start : public paragraph_content_element<alphabetical_index_mark_start>
|
||||
class alphabetical_index_mark_start : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1403,7 +1430,7 @@ CP_REGISTER_OFFICE_ELEMENT2(alphabetical_index_mark_start);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:alphabetical-index-mark-end
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class alphabetical_index_mark_end : public paragraph_content_element<alphabetical_index_mark_end>
|
||||
class alphabetical_index_mark_end : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1424,7 +1451,7 @@ CP_REGISTER_OFFICE_ELEMENT2(alphabetical_index_mark_end);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:alphabetical-index-mark
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class alphabetical_index_mark : public paragraph_content_element<alphabetical_index_mark>
|
||||
class alphabetical_index_mark : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1450,7 +1477,7 @@ CP_REGISTER_OFFICE_ELEMENT2(alphabetical_index_mark);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:user-index-mark-start
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class user_index_mark_start : public paragraph_content_element<user_index_mark_start>
|
||||
class user_index_mark_start : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1473,7 +1500,7 @@ CP_REGISTER_OFFICE_ELEMENT2(user_index_mark_start);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:user-index-mark-end
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class user_index_mark_end : public paragraph_content_element<user_index_mark_end>
|
||||
class user_index_mark_end : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1494,7 +1521,7 @@ CP_REGISTER_OFFICE_ELEMENT2(user_index_mark_end);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:user-index-mark
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class user_index_mark : public paragraph_content_element<user_index_mark>
|
||||
class user_index_mark : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1517,7 +1544,7 @@ CP_REGISTER_OFFICE_ELEMENT2(user_index_mark);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:toc-mark-start
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class toc_mark_start : public paragraph_content_element<toc_mark_start>
|
||||
class toc_mark_start : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1539,7 +1566,7 @@ CP_REGISTER_OFFICE_ELEMENT2(toc_mark_start);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:toc-mark-end
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class toc_mark_end : public paragraph_content_element<toc_mark_end>
|
||||
class toc_mark_end : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1560,7 +1587,7 @@ CP_REGISTER_OFFICE_ELEMENT2(toc_mark_end);
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//text:toc-mark
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
class toc_mark : public paragraph_content_element<toc_mark>
|
||||
class toc_mark : public paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1584,7 +1611,7 @@ CP_REGISTER_OFFICE_ELEMENT2(toc_mark);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//presentation:footer
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class presentation_footer : public text::paragraph_content_element<presentation_footer>
|
||||
class presentation_footer : public text::paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1606,7 +1633,7 @@ CP_REGISTER_OFFICE_ELEMENT2(presentation_footer);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//presentation:date-time
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class presentation_date_time: public text::paragraph_content_element<presentation_date_time>
|
||||
class presentation_date_time: public text::paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1629,7 +1656,7 @@ CP_REGISTER_OFFICE_ELEMENT2(presentation_date_time);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// field:fieldmark-start
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class field_fieldmark_start : public text::paragraph_content_element<field_fieldmark_start>
|
||||
class field_fieldmark_start : public text::paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1651,7 +1678,7 @@ CP_REGISTER_OFFICE_ELEMENT2(field_fieldmark_start);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// field:fieldmark-end
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class field_fieldmark_end : public text::paragraph_content_element<field_fieldmark_end>
|
||||
class field_fieldmark_end : public text::paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1670,7 +1697,7 @@ CP_REGISTER_OFFICE_ELEMENT2(field_fieldmark_end);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// field:fieldmark
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class field_fieldmark : public text::paragraph_content_element<field_fieldmark>
|
||||
class field_fieldmark : public text::paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -1694,7 +1721,7 @@ CP_REGISTER_OFFICE_ELEMENT2(field_fieldmark);
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// field:param
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
class field_param : public text::paragraph_content_element<field_param>
|
||||
class field_param : public text::paragraph_content_element
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
|
||||
@ -31,118 +31,110 @@
|
||||
*/
|
||||
|
||||
#include "style_regions.h"
|
||||
#include "text_elements.h"
|
||||
#include "paragraph_elements.h"
|
||||
|
||||
#include <xml/xmlchar.h>
|
||||
#include <xml/attributes.h>
|
||||
|
||||
#include "serialize_elements.h"
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
const wchar_t * style_region_impl::ns = L"style";
|
||||
const wchar_t * style_region_impl::name = L"region";
|
||||
|
||||
void style_region_impl::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
void style_region_impl::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
void style_region_impl::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
text::p* paragr = dynamic_cast<text::p*>(content_[i].get());
|
||||
text::h* header = dynamic_cast<text::h*>(content_[i].get());
|
||||
|
||||
if (paragr || header)
|
||||
{
|
||||
text::paragraph* p = paragr ? ¶gr->paragraph_ : &header->paragraph_;
|
||||
|
||||
if (false == p->attrs_.text_style_name_.empty())
|
||||
{
|
||||
}
|
||||
|
||||
for (size_t j = 0; j < p->content_.size(); j++)
|
||||
{
|
||||
text::paragraph_content_element *element = dynamic_cast<text::paragraph_content_element*>(p->content_[j].get());
|
||||
|
||||
if (element)
|
||||
{
|
||||
element->xlsx_serialize(_Wostream, Context);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_SERIALIZE_TEXT(p->content_[j], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_SERIALIZE_TEXT(content_[i], true);
|
||||
}
|
||||
if (i < content_.size() - 1)
|
||||
_Wostream << L"
";
|
||||
}
|
||||
}
|
||||
void style_region_impl::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
}
|
||||
|
||||
void style_region_impl::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
// style:region-left
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_region_left::ns = L"style";
|
||||
const wchar_t * style_region_left::name = L"region-left";
|
||||
|
||||
void style_region_left::docx_convert(oox::docx_conversion_context & Context)
|
||||
void style_region_left::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
_Wostream << L"&L";
|
||||
style_region_impl::xlsx_serialize(_Wostream, Context);
|
||||
}
|
||||
|
||||
void style_region_left::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
void style_region_left::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
}
|
||||
|
||||
void style_region_left::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void style_region_left::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
// style:region-right
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_region_right::ns = L"style";
|
||||
const wchar_t * style_region_right::name = L"region-right";
|
||||
|
||||
void style_region_right::docx_convert(oox::docx_conversion_context & Context)
|
||||
void style_region_right::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
_Wostream << L"&R";
|
||||
style_region_impl::xlsx_serialize(_Wostream, Context);
|
||||
}
|
||||
|
||||
void style_region_right::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
void style_region_right::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
}
|
||||
|
||||
void style_region_right::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void style_region_right::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
// style:region-center
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_region_center::ns = L"style";
|
||||
const wchar_t * style_region_center::name = L"region-center";
|
||||
|
||||
void style_region_center::docx_convert(oox::docx_conversion_context & Context)
|
||||
void style_region_center::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
void style_region_center::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
|
||||
void style_region_center::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
}
|
||||
|
||||
void style_region_center::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
void style_region_center::add_text(const std::wstring & Text)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
_Wostream << L"&C";
|
||||
style_region_impl::xlsx_serialize(_Wostream, Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,80 +40,66 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
class style_region_impl : public office_element_impl<style_region_impl>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleRegion;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
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);
|
||||
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
// style:region-left
|
||||
class style_region_left : public office_element_impl<style_region_left>
|
||||
class style_region_left : public style_region_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleRegionLeft;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_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);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;
|
||||
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_region_left);
|
||||
|
||||
// style:region-right
|
||||
class style_region_right : public office_element_impl<style_region_right>
|
||||
class style_region_right : public style_region_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleRegionRight;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_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);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;
|
||||
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_region_right);
|
||||
|
||||
|
||||
// style:region-center
|
||||
class style_region_center : public office_element_impl<style_region_center>
|
||||
class style_region_center : public style_region_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleRegionCenter;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context) ;
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_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);
|
||||
|
||||
private:
|
||||
office_element_ptr_array content_;
|
||||
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_region_center);
|
||||
|
||||
}
|
||||
|
||||
@ -552,7 +552,71 @@ void text_format_properties_content::drawing_serialize(std::wostream & strm, std
|
||||
}
|
||||
}
|
||||
}
|
||||
void text_format_properties_content::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
double font_size = process_font_size_impl(fo_font_size_, NULL);
|
||||
|
||||
bool bBold = false, bItalic = false;
|
||||
if (font_size > 0)
|
||||
{
|
||||
strm << L"&" << font_size;
|
||||
}
|
||||
if (fo_font_style_ && fo_font_style_->get_type() == font_style::Italic)
|
||||
{
|
||||
bItalic = true;
|
||||
//strm << L"&I";
|
||||
}
|
||||
if (fo_font_weight_ && fo_font_weight_->get_type() == font_weight::WNormal)
|
||||
{
|
||||
bBold = true;
|
||||
//strm << L"&B";
|
||||
}
|
||||
std::wstring font_name;
|
||||
if (fo_font_family_)
|
||||
{
|
||||
font_name = *fo_font_family_;
|
||||
}
|
||||
else if (style_font_name_)
|
||||
{
|
||||
odf_read_context & context = Context.root()->odf_context();
|
||||
fonts_container & fonts = context.fontContainer();
|
||||
|
||||
font_instance * font = fonts.font_by_style_name(*style_font_name_);
|
||||
if (font)
|
||||
font_name = font->name();
|
||||
}
|
||||
//if (font_name.empty())
|
||||
{
|
||||
font_name = L"-";
|
||||
}
|
||||
font_name += L",";
|
||||
|
||||
if (!bBold && !bItalic) font_name += L"Regular";
|
||||
else if (bBold && bItalic) font_name += L"Bold Italic";
|
||||
else if (bBold) font_name += L"Bold";
|
||||
else if (bItalic) font_name += L"Italic";
|
||||
|
||||
strm << L"&"" << font_name << L""";
|
||||
|
||||
if (style_text_underline_type_)
|
||||
{
|
||||
if (style_text_underline_type_->get_type() == line_type::Single) strm << L"&U";
|
||||
if (style_text_underline_type_->get_type() == line_type::Double) strm << L"&E";
|
||||
}
|
||||
if (style_text_line_through_type_ && style_text_line_through_type_->get_type() != line_type::None)
|
||||
{
|
||||
strm << L"&S";
|
||||
}
|
||||
if (style_text_position_)
|
||||
{
|
||||
if (style_text_position_->get_position().get_value() < 0) strm << L"&Y";
|
||||
if (style_text_position_->get_position().get_value() > 0) strm << L"&X";
|
||||
}
|
||||
if (fo_color_)
|
||||
{
|
||||
strm << L"&K" << fo_color_->get_hex_value();
|
||||
}
|
||||
}
|
||||
void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_container & fonts)
|
||||
{//упрощенный вариант
|
||||
|
||||
@ -1603,7 +1667,7 @@ const wchar_t * style_text_properties::name = L"text-properties";
|
||||
|
||||
void style_text_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
text_format_properties_content_.add_attributes(Attributes);
|
||||
content_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void style_text_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -1613,12 +1677,12 @@ void style_text_properties::add_child_element( xml::sax * Reader, const std::wst
|
||||
|
||||
void style_text_properties::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
text_format_properties_content_.docx_convert(Context);
|
||||
content_.docx_convert(Context);
|
||||
}
|
||||
|
||||
void style_text_properties::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
text_format_properties_content_.pptx_convert(Context);
|
||||
content_.pptx_convert(Context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -70,7 +70,6 @@ namespace odf_reader {
|
||||
class style_instance;
|
||||
class fonts_container;
|
||||
|
||||
// 15.4
|
||||
class text_format_properties_content : public oox::conversion_element
|
||||
{
|
||||
public:
|
||||
@ -84,7 +83,9 @@ public:
|
||||
void docx_serialize (std::wostream & stream, fonts_container & fonts);
|
||||
void drawing_serialize (std::wostream & stream, std::wstring node, fonts_container & fonts, const odf_reader::style_instance *current_style = NULL, std::wstring hlink = L"");
|
||||
|
||||
void apply_from (const text_format_properties_content & Other);
|
||||
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
|
||||
void apply_from (const text_format_properties_content & Other);
|
||||
void apply_to (std::vector<_property> & properties);
|
||||
void set_r_style (const std::wstring & rStyle) { r_style_ = rStyle; }
|
||||
|
||||
@ -178,7 +179,7 @@ class style_text_properties;
|
||||
typedef shared_ptr<style_text_properties>::Type style_text_properties_ptr;
|
||||
|
||||
|
||||
/// style:text-properties
|
||||
// style:text-properties
|
||||
class style_text_properties : public office_element_impl<style_text_properties>
|
||||
{
|
||||
public:
|
||||
@ -192,17 +193,17 @@ public:
|
||||
void docx_convert (oox::docx_conversion_context & Context);
|
||||
void pptx_convert (oox::pptx_conversion_context & Context);
|
||||
|
||||
const text_format_properties_content & content() const { return text_format_properties_content_; } ;
|
||||
text_format_properties_content & content() { return text_format_properties_content_; } ;
|
||||
const text_format_properties_content & content() const { return content_; } ;
|
||||
text_format_properties_content & content() { return content_; } ;
|
||||
|
||||
style_text_properties(){};
|
||||
style_text_properties(const std::wstring & rStyle) { text_format_properties_content_.set_r_style(rStyle); };
|
||||
style_text_properties(const std::wstring & rStyle) { content_.set_r_style(rStyle); };
|
||||
|
||||
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);
|
||||
|
||||
text_format_properties_content text_format_properties_content_;
|
||||
text_format_properties_content content_;
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_text_properties);
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "style_graphic_properties.h"
|
||||
#include "style_chart_properties.h"
|
||||
#include "style_presentation.h"
|
||||
#include "style_regions.h"
|
||||
|
||||
#include "serialize_elements.h"
|
||||
#include "odfcontext.h"
|
||||
@ -204,7 +205,13 @@ style_drawing_page_properties * style_content::get_style_drawing_page_properties
|
||||
{
|
||||
return dynamic_cast<style_drawing_page_properties *>(style_drawing_page_properties_.get());
|
||||
}
|
||||
|
||||
void style_content::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (style_text_properties *text_props = get_style_text_properties())
|
||||
{
|
||||
text_props->content().xlsx_serialize(strm, Context);
|
||||
}
|
||||
}
|
||||
void style_content::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
if (style_table_column_properties_)
|
||||
@ -215,7 +222,6 @@ void style_content::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
if (style_chart_properties_)
|
||||
style_chart_properties_->xlsx_convert(Context);
|
||||
|
||||
}
|
||||
|
||||
void style_content::docx_convert(oox::docx_conversion_context & Context, bool in_styles)
|
||||
@ -659,93 +665,6 @@ void office_styles::add_child_element( xml::sax * Reader, const std::wstring & N
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// style:header
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_header::ns = L"style";
|
||||
const wchar_t * style_header::name = L"header";
|
||||
|
||||
void style_header::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
content().common_style_header_footer_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void style_header::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
content().header_footer_content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_footer::ns = L"style";
|
||||
const wchar_t * style_footer::name = L"footer";
|
||||
|
||||
void style_footer::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
content().common_style_header_footer_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void style_footer::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
content().header_footer_content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_header_first::ns = L"style";
|
||||
const wchar_t * style_header_first::name = L"header-first";
|
||||
|
||||
void style_header_first::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
content().common_style_header_footer_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void style_header_first::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
content().header_footer_content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_footer_first::ns = L"style";
|
||||
const wchar_t * style_footer_first::name = L"footer-first";
|
||||
|
||||
void style_footer_first::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
content().common_style_header_footer_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void style_footer_first::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
content().header_footer_content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_header_left::ns = L"style";
|
||||
const wchar_t * style_header_left::name = L"header-left";
|
||||
|
||||
void style_header_left::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
content().common_style_header_footer_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void style_header_left::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
content().header_footer_content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_footer_left::ns = L"style";
|
||||
const wchar_t * style_footer_left::name = L"footer-left";
|
||||
|
||||
void style_footer_left::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
content().common_style_header_footer_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void style_footer_left::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
content().header_footer_content_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_columns::ns = L"style";
|
||||
const wchar_t * style_columns::name = L"columns";
|
||||
@ -1265,7 +1184,21 @@ void style_page_layout_properties::add_attributes( const xml::attributes_wc_ptr
|
||||
|
||||
void style_page_layout_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
elements_.add_child_element(Reader, Ns, Name, getContext());
|
||||
if (L"style" == Ns && L"background-image" == Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(style_background_image_);
|
||||
}
|
||||
else if (L"style" == Ns && L"columns" == Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(style_columns_);
|
||||
}
|
||||
else if (L"style" == Ns && L"footnote-sep" == Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(style_footnote_sep_);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
bool style_page_layout_properties::docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id)
|
||||
@ -1292,9 +1225,7 @@ bool style_page_layout_properties::docx_background_serialize(std::wostream & str
|
||||
return true;
|
||||
}
|
||||
|
||||
void style_page_layout_properties::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
|
||||
void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
@ -1305,10 +1236,10 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
if (horizontal_margins.fo_margin_left_ || horizontal_margins.fo_margin_right_ ||
|
||||
vertical_margins.fo_margin_top_ || vertical_margins.fo_margin_bottom_ )
|
||||
{
|
||||
//_CP_OPT(odf_types::length) margin_top, margin_bottom;
|
||||
_CP_OPT(double) header, footer;
|
||||
|
||||
//margin_top = Context.get_header_footer_context().header();
|
||||
//margin_bottom = Context.get_header_footer_context().footer();
|
||||
header = Context.get_table_context().get_header_page();
|
||||
footer = Context.get_table_context().get_footer_page();
|
||||
|
||||
CP_XML_NODE(L"pageMargins")
|
||||
{
|
||||
@ -1328,12 +1259,10 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
CP_XML_ATTR(L"bottom" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
|
||||
else CP_XML_ATTR(L"bottom", 1.025);
|
||||
|
||||
if (vertical_margins.fo_margin_top_)
|
||||
CP_XML_ATTR(L"header" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
|
||||
if (header) CP_XML_ATTR(L"header" , *header / 72.0); // pt -> inch
|
||||
else CP_XML_ATTR(L"header", 0.7875);
|
||||
|
||||
if (vertical_margins.fo_margin_bottom_)
|
||||
CP_XML_ATTR(L"footer" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
|
||||
if (footer) CP_XML_ATTR(L"footer" , *footer / 72.0);
|
||||
else CP_XML_ATTR(L"footer", 0.7875);
|
||||
}
|
||||
}
|
||||
@ -1360,11 +1289,11 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
}
|
||||
}
|
||||
}
|
||||
if (elements_.style_background_image_)
|
||||
if (style_background_image_)
|
||||
{
|
||||
oox::_oox_fill fill;
|
||||
|
||||
Compute_GraphicFill(attlist_.common_draw_fill_attlist_, elements_.style_background_image_, Context.root()->odf_context().drawStyles(), fill);
|
||||
Compute_GraphicFill(attlist_.common_draw_fill_attlist_, style_background_image_, Context.root()->odf_context().drawStyles(), fill);
|
||||
if (fill.bitmap)
|
||||
{
|
||||
if ( fill.bitmap->rId.empty())
|
||||
@ -1382,7 +1311,7 @@ void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xls
|
||||
|
||||
void style_page_layout_properties::docx_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
{
|
||||
style_columns * columns = dynamic_cast<style_columns *>( elements_.style_columns_.get());
|
||||
style_columns * columns = dynamic_cast<style_columns *>( style_columns_.get());
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -1474,28 +1403,6 @@ void style_page_layout_properties::pptx_serialize(std::wostream & strm, oox::ppt
|
||||
}
|
||||
}
|
||||
|
||||
// style-page-layout-properties-elements
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void style_page_layout_properties_elements::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context )
|
||||
{
|
||||
if (L"style" == Ns && L"background-image" == Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT_SIMPLE(style_background_image_);
|
||||
}
|
||||
else if (L"style" == Ns && L"columns" == Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT_SIMPLE(style_columns_);
|
||||
}
|
||||
else if (L"style" == Ns && L"footnote-sep" == Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT_SIMPLE(style_footnote_sep_);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_applicable_element(L"style-page-layout-properties-elements", Reader, Ns, Name);
|
||||
}
|
||||
}
|
||||
|
||||
// style-master-page-attlist
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1620,7 +1527,6 @@ void style_master_page::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
|
||||
}
|
||||
////////////////
|
||||
|
||||
const wchar_t * hdrHeader = L"<w:hdr \
|
||||
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
|
||||
@ -1661,6 +1567,10 @@ xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\"
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * style_header::ns = L"style";
|
||||
const wchar_t * style_header::name = L"header";
|
||||
|
||||
void style_header::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
std::wostream & strm = Context.output_stream();
|
||||
@ -1670,6 +1580,20 @@ void style_header::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
strm << L"</w:hdr>";
|
||||
}
|
||||
void style_header::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"oddHeader")
|
||||
{
|
||||
header_footer_impl::xlsx_serialize(CP_XML_STREAM(), Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * style_footer::ns = L"style";
|
||||
const wchar_t * style_footer::name = L"footer";
|
||||
|
||||
void style_footer::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1679,6 +1603,19 @@ void style_footer::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
strm << L"</w:ftr>";
|
||||
}
|
||||
void style_footer::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"oddFooter")
|
||||
{
|
||||
header_footer_impl::xlsx_serialize(CP_XML_STREAM(), Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * style_header_first::ns = L"style";
|
||||
const wchar_t * style_header_first::name = L"header-first";
|
||||
|
||||
void style_header_first::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1689,6 +1626,20 @@ void style_header_first::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
strm << L"</w:hdr>";
|
||||
}
|
||||
void style_header_first::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"firstHeader")
|
||||
{
|
||||
header_footer_impl::xlsx_serialize(CP_XML_STREAM(), Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * style_footer_first::ns = L"style";
|
||||
const wchar_t * style_footer_first::name = L"footer-first";
|
||||
|
||||
void style_footer_first::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1698,7 +1649,19 @@ void style_footer_first::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
strm << L"</w:ftr>";
|
||||
}
|
||||
|
||||
void style_footer_first::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"firstFooter")
|
||||
{
|
||||
header_footer_impl::xlsx_serialize(CP_XML_STREAM(), Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * style_header_left::ns = L"style";
|
||||
const wchar_t * style_header_left::name = L"header-left";
|
||||
|
||||
void style_header_left::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1708,6 +1671,20 @@ void style_header_left::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
strm << L"</w:hdr>";
|
||||
}
|
||||
void style_header_left::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"evenHeader")
|
||||
{
|
||||
header_footer_impl::xlsx_serialize(CP_XML_STREAM(), Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
const wchar_t * style_footer_left::ns = L"style";
|
||||
const wchar_t * style_footer_left::name = L"footer-left";
|
||||
|
||||
void style_footer_left::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
@ -1717,18 +1694,66 @@ void style_footer_left::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
strm << L"</w:ftr>";
|
||||
}
|
||||
void style_footer_left::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"evenFooter")
|
||||
{
|
||||
header_footer_impl::xlsx_serialize(CP_XML_STREAM(), Context);
|
||||
}
|
||||
}
|
||||
}
|
||||
const wchar_t * header_footer_impl::ns = L"style";
|
||||
const wchar_t * header_footer_impl::name = L"header-footer";
|
||||
|
||||
void header_footer_impl::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void header_footer_impl::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"text", L"tracked-changes")
|
||||
{
|
||||
CP_CREATE_ELEMENT(tracked_changes_);
|
||||
}
|
||||
else
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
std::wostream & header_footer_impl::text_to_stream(std::wostream & _Wostream, bool bXmlEncode) const
|
||||
{
|
||||
serialize_elements_text(_Wostream, content_, bXmlEncode);
|
||||
return _Wostream;
|
||||
}
|
||||
|
||||
void header_footer_impl::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (content_.header_footer_content_.tracked_changes_)
|
||||
content_.header_footer_content_.tracked_changes_->docx_convert(Context);
|
||||
if (tracked_changes_)
|
||||
tracked_changes_->docx_convert(Context);
|
||||
|
||||
for (size_t i = 0; i < content_.header_footer_content_.content_.size(); i++)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_.header_footer_content_.content_[i]->docx_convert(Context);
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
}
|
||||
void header_footer_impl::xlsx_serialize(std::wostream & _Wostream, oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
style_region_impl* region = dynamic_cast<style_region_impl*>(content_[i].get());
|
||||
|
||||
if (region)
|
||||
{
|
||||
region->xlsx_serialize(_Wostream, Context);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_SERIALIZE_TEXT(content_[i], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// text:notes-configuration
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * text_notes_configuration::ns = L"text";
|
||||
|
||||
@ -89,7 +89,9 @@ public:
|
||||
|
||||
void docx_convert(oox::docx_conversion_context & Context, bool in_styles = false);
|
||||
void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
|
||||
|
||||
void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
|
||||
graphic_format_properties * get_graphic_properties() const;
|
||||
|
||||
style_text_properties * get_style_text_properties() const;
|
||||
@ -570,28 +572,38 @@ public:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_styles);
|
||||
|
||||
class header_footer_content_impl
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class header_footer_impl : public office_element_impl<header_footer_impl>
|
||||
{
|
||||
public:
|
||||
common_style_header_footer_attlist common_style_header_footer_attlist_;
|
||||
header_footer_content header_footer_content_;
|
||||
};
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeStyleHeaderFooter;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
class header_footer_impl
|
||||
{
|
||||
public:
|
||||
header_footer_content_impl & content() { return content_; }
|
||||
const header_footer_content_impl & content() const { return content_; }
|
||||
virtual ~header_footer_impl() {}
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
friend class odf_document;
|
||||
|
||||
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 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) {}
|
||||
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
|
||||
header_footer_content_impl content_;
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
|
||||
std::wostream & text_to_stream(std::wostream & _Wostream, bool bXmlEncode = true) const;
|
||||
|
||||
common_style_header_footer_attlist attlist_;
|
||||
|
||||
office_element_ptr tracked_changes_;
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
// style:header
|
||||
class style_header : public office_element_impl<style_header>, public header_footer_impl
|
||||
// style:header
|
||||
class style_header : public header_footer_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
@ -600,133 +612,86 @@ public:
|
||||
static const ElementType type = typeStyleHeader;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_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);
|
||||
|
||||
public:
|
||||
//header_footer_content_impl content_;
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_header);
|
||||
|
||||
/// style:footer
|
||||
class style_footer : public office_element_impl<style_footer>, public header_footer_impl
|
||||
// style:footer
|
||||
class style_footer : public header_footer_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleFooter;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_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);
|
||||
|
||||
public:
|
||||
// header_footer_content_impl content_;
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_footer);
|
||||
|
||||
/// style:header-first
|
||||
class style_header_first : public office_element_impl<style_header_first>, public header_footer_impl
|
||||
// style:header-first
|
||||
class style_header_first : public header_footer_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleHeaderFirst;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_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);
|
||||
|
||||
public:
|
||||
//header_footer_content_impl content_;
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_header_first);
|
||||
|
||||
/// style:footer_first
|
||||
class style_footer_first : public office_element_impl<style_footer_first>, public header_footer_impl
|
||||
// style:footer_first
|
||||
class style_footer_first : public header_footer_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleFooterFirst;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_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);
|
||||
|
||||
public:
|
||||
// header_footer_content_impl content_;
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_footer_first);
|
||||
|
||||
/// style:header-left
|
||||
class style_header_left : public office_element_impl<style_header_left>, public header_footer_impl
|
||||
// style:header-left
|
||||
class style_header_left : public header_footer_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleHeaderLeft;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_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);
|
||||
|
||||
public:
|
||||
// header_footer_content_impl content_;
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_header_left);
|
||||
|
||||
/// style:footer-left
|
||||
class style_footer_left : public office_element_impl<style_footer_left>, public header_footer_impl
|
||||
// style:footer-left
|
||||
class style_footer_left : public header_footer_impl
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeStyleFooterLeft;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_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);
|
||||
|
||||
public:
|
||||
// header_footer_content_impl content_;
|
||||
|
||||
virtual void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_footer_left);
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
class style_columns : public office_element_impl<style_columns>
|
||||
{
|
||||
public:
|
||||
@ -982,20 +947,6 @@ private:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_footnote_sep);
|
||||
|
||||
// style-page-layout-properties-elements
|
||||
class style_page_layout_properties_elements
|
||||
{
|
||||
public:
|
||||
void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context);
|
||||
|
||||
office_element_ptr style_background_image_;
|
||||
office_element_ptr style_columns_;
|
||||
|
||||
// 15.2.20
|
||||
office_element_ptr style_footnote_sep_;
|
||||
|
||||
};
|
||||
|
||||
// style:page-layout-properties
|
||||
class style_page_layout_properties : public office_element_impl<style_page_layout_properties>
|
||||
{
|
||||
@ -1006,19 +957,21 @@ public:
|
||||
static const ElementType type = typeStylePageLayout;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
void pptx_convert (oox::pptx_conversion_context & Context);
|
||||
void xlsx_convert (oox::xlsx_conversion_context & Context);
|
||||
void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
|
||||
|
||||
void docx_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void docx_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
|
||||
void pptx_serialize(std::wostream & strm, oox::pptx_conversion_context & Context);
|
||||
|
||||
style_page_layout_properties() { }
|
||||
|
||||
style_page_layout_properties_attlist attlist_;
|
||||
style_page_layout_properties_elements elements_;
|
||||
style_page_layout_properties_attlist attlist_;
|
||||
|
||||
office_element_ptr style_background_image_;
|
||||
office_element_ptr style_columns_;
|
||||
office_element_ptr style_footnote_sep_;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -78,13 +78,13 @@ public:
|
||||
|
||||
size_t drop_cap_docx_convert(oox::docx_conversion_context & Context);
|
||||
|
||||
paragraph_attrs attrs_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr sequence_;
|
||||
private:
|
||||
void drop_cap_text_docx_convert(office_element_ptr first_text_paragraph,oox::docx_conversion_context & Context);
|
||||
|
||||
paragraph_attrs attrs_;
|
||||
|
||||
|
||||
bool next_section_;
|
||||
bool next_end_section_;
|
||||
|
||||
|
||||
@ -427,6 +427,14 @@
|
||||
RelativePath="..\src\odf\style_ref.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\style_regions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\style_regions.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\style_table_properties.cpp"
|
||||
>
|
||||
@ -1667,14 +1675,6 @@
|
||||
RelativePath="..\src\odf\skipelement.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\style_regions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\style_regions.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\odf\table.cpp"
|
||||
>
|
||||
|
||||
@ -330,31 +330,11 @@ bool odf_page_layout_context::add_footer(int type)
|
||||
style_page_layout_properties *props = get_properties();
|
||||
if (!props)return true;
|
||||
|
||||
length length_ = length(layout_state_list_.back().footer_size_->get_value_unit(length::cm),length::cm);
|
||||
length length_ = length(layout_state_list_.back().footer_size_->get_value_unit(length::cm), length::cm);
|
||||
|
||||
_CP_OPT(length) bottom_;
|
||||
|
||||
if (props->attlist_.common_vertical_margin_attlist_.fo_margin_bottom_)
|
||||
bottom_= props->attlist_.common_vertical_margin_attlist_.fo_margin_bottom_->get_length();
|
||||
footer_props->style_header_footer_properties_attlist_.svg_height_ = length_;
|
||||
footer_props->style_header_footer_properties_attlist_.fo_min_height_ = length_;
|
||||
|
||||
if (bottom_)
|
||||
{
|
||||
double length_cm = bottom_->get_value_unit(length::cm) - length_.get_value_unit(length::cm);
|
||||
|
||||
if (length_cm > 0.01)
|
||||
{
|
||||
props->attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
|
||||
footer_props->style_header_footer_properties_attlist_.svg_height_ = length(fabs(length_cm),length::cm);//fo_min_height_
|
||||
footer_props->style_header_footer_properties_attlist_.fo_min_height_ = length(fabs(length_cm),length::cm);
|
||||
}
|
||||
else if (-length_cm >0.01)
|
||||
{
|
||||
footer_props->style_header_footer_properties_attlist_.svg_height_ = length(-length_cm,length::cm);//fo_min_height_
|
||||
}
|
||||
}else
|
||||
{
|
||||
props->attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
|
||||
}
|
||||
layout_state_list_.back().footer_size_ = boost::none;
|
||||
|
||||
return true;
|
||||
@ -395,29 +375,9 @@ bool odf_page_layout_context::add_header(int type)
|
||||
|
||||
length length_ = length(layout_state_list_.back().header_size_->get_value_unit(length::cm), length::cm);
|
||||
|
||||
_CP_OPT(length) top_;
|
||||
header_props->style_header_footer_properties_attlist_.svg_height_ = length_;
|
||||
header_props->style_header_footer_properties_attlist_.fo_min_height_ = length_;
|
||||
|
||||
if (props->attlist_.common_vertical_margin_attlist_.fo_margin_top_)
|
||||
top_ = props->attlist_.common_vertical_margin_attlist_.fo_margin_top_->get_length();;
|
||||
|
||||
if (top_)
|
||||
{
|
||||
double length_cm = top_->get_value_unit(length::cm) - length_.get_value_unit(length::cm);
|
||||
if (length_cm > 0.01)
|
||||
{
|
||||
props->attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
|
||||
header_props->style_header_footer_properties_attlist_.svg_height_ = length(fabs(length_cm),length::cm);
|
||||
header_props->style_header_footer_properties_attlist_.fo_min_height_ = length(fabs(length_cm),length::cm);//fo_min_height_
|
||||
}
|
||||
else if (-length_cm >0.01)
|
||||
{
|
||||
header_props->style_header_footer_properties_attlist_.svg_height_ = length(-length_cm,length::cm);
|
||||
header_props->style_header_footer_properties_attlist_.fo_min_height_ = length(-length_cm,length::cm);//fo_min_height_
|
||||
}
|
||||
}
|
||||
else
|
||||
props->attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
|
||||
|
||||
layout_state_list_.back().header_size_ = boost::none;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1591,37 +1591,59 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
{
|
||||
odt_context->page_layout_context()->add_master_page(master_name);
|
||||
}
|
||||
|
||||
bool present_header = false;
|
||||
bool present_footer = false;
|
||||
|
||||
if (oox_section_pr->m_oPgMar.IsInit())
|
||||
{
|
||||
_CP_OPT(odf_types::length) top, left, right, bottom, other;
|
||||
_CP_OPT(odf_types::length) top, left, right, bottom, header, footer, gutter;
|
||||
|
||||
convert(oox_section_pr->m_oPgMar->m_oBottom.GetPointer(), bottom);
|
||||
convert(oox_section_pr->m_oPgMar->m_oLeft.GetPointer(), left);
|
||||
convert(oox_section_pr->m_oPgMar->m_oRight.GetPointer(), right);
|
||||
convert(oox_section_pr->m_oPgMar->m_oTop.GetPointer(), top);
|
||||
convert(oox_section_pr->m_oPgMar->m_oHeader.GetPointer(), header);
|
||||
convert(oox_section_pr->m_oPgMar->m_oFooter.GetPointer(), footer);
|
||||
convert(oox_section_pr->m_oPgMar->m_oGutter.GetPointer(), gutter);
|
||||
|
||||
if (bottom)
|
||||
{
|
||||
double length_cm = bottom->get_value_unit(length::cm) -( footer ? footer->get_value_unit(length::cm) : 0);
|
||||
|
||||
if (length_cm > 0.01)
|
||||
{
|
||||
bottom = footer;
|
||||
footer = length(fabs(length_cm), length::cm);
|
||||
}
|
||||
else if (-length_cm > 0.01)
|
||||
{
|
||||
footer = length(-length_cm, length::cm);//fo_min_height_
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bottom = footer;
|
||||
}
|
||||
if (top)
|
||||
{
|
||||
double length_cm = top->get_value_unit(length::cm) - (header ? header->get_value_unit(length::cm) : 0);
|
||||
|
||||
if (length_cm > 0.01)
|
||||
{
|
||||
top = header;
|
||||
header = length(fabs(length_cm), length::cm);
|
||||
}
|
||||
else if (-length_cm > 0.01)
|
||||
{
|
||||
header = length(-length_cm, length::cm);//fo_min_height_
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
top = header;
|
||||
}
|
||||
odt_context->page_layout_context()->set_page_margin(top, left, bottom, right);
|
||||
|
||||
convert(oox_section_pr->m_oPgMar->m_oGutter.GetPointer(), other);
|
||||
odt_context->page_layout_context()->set_page_gutter(other);
|
||||
|
||||
if (oox_section_pr->m_oPgMar->m_oFooter.IsInit())
|
||||
{
|
||||
convert(oox_section_pr->m_oPgMar->m_oFooter.GetPointer(), other);
|
||||
odt_context->page_layout_context()->set_footer_size(other);
|
||||
present_footer = true;
|
||||
}
|
||||
|
||||
if (oox_section_pr->m_oPgMar->m_oHeader.IsInit())
|
||||
{
|
||||
convert(oox_section_pr->m_oPgMar->m_oHeader.GetPointer(), other);
|
||||
odt_context->page_layout_context()->set_header_size(other);
|
||||
present_header =true;
|
||||
}
|
||||
odt_context->page_layout_context()->set_page_gutter(gutter);
|
||||
odt_context->page_layout_context()->set_header_size(header);
|
||||
odt_context->page_layout_context()->set_footer_size(footer);
|
||||
}
|
||||
if (oox_section_pr->m_oPgBorders.IsInit())
|
||||
{
|
||||
|
||||
@ -515,23 +515,93 @@ void XlsxConverter::convert(OOX::Spreadsheet::CHeaderFooterElement *oox_header_f
|
||||
case '&': type_add = 8; pos++; break;
|
||||
case 'G': pos++; break;
|
||||
|
||||
case 'E': current_text_props.content_.style_text_underline_type_ = odf_types::line_type::Double; pos++; break;
|
||||
case 'X': current_text_props.content_.style_text_position_ = odf_types::text_position(+33.); pos++; break;
|
||||
case 'Y': current_text_props.content_.style_text_position_ = odf_types::text_position(-33.); pos++; break;
|
||||
case 'B': current_text_props.content_.fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WBold); pos++; break;
|
||||
case 'I': current_text_props.content_.fo_font_style_ = odf_types::font_style(odf_types::font_style::Italic); pos++; break;
|
||||
case 'U': current_text_props.content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::Single); pos++; break;
|
||||
case 'S': current_text_props.content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::Single); pos++; break;
|
||||
case 'E':
|
||||
{
|
||||
if (current_text_props.content_.style_text_underline_type_)
|
||||
current_text_props.content_.style_text_underline_type_ = boost::none;
|
||||
else
|
||||
current_text_props.content_.style_text_underline_type_ = odf_types::line_type::Double;
|
||||
pos++;
|
||||
}break;
|
||||
case 'X':
|
||||
{
|
||||
if (current_text_props.content_.style_text_position_ && current_text_props.content_.style_text_position_->get_position().get_value() > 0)
|
||||
current_text_props.content_.style_text_position_ = boost::none;
|
||||
else
|
||||
current_text_props.content_.style_text_position_ = odf_types::text_position(+33.);
|
||||
pos++;
|
||||
}break;
|
||||
case 'Y':
|
||||
{
|
||||
if (current_text_props.content_.style_text_position_ && current_text_props.content_.style_text_position_->get_position().get_value() < 0)
|
||||
current_text_props.content_.style_text_position_ = boost::none;
|
||||
else
|
||||
current_text_props.content_.style_text_position_ = odf_types::text_position(-33.);
|
||||
pos++;
|
||||
}break;
|
||||
case 'B':
|
||||
{
|
||||
if (current_text_props.content_.fo_font_weight_)
|
||||
current_text_props.content_.fo_font_weight_ = boost::none;
|
||||
else
|
||||
current_text_props.content_.fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WBold);
|
||||
pos++;
|
||||
}break;
|
||||
case 'I':
|
||||
{
|
||||
if (!current_text_props.content_.fo_font_style_)
|
||||
current_text_props.content_.fo_font_style_ = odf_types::font_style(odf_types::font_style::Italic);
|
||||
else
|
||||
current_text_props.content_.fo_font_style_ = boost::none;
|
||||
pos++;
|
||||
}break;
|
||||
case 'U':
|
||||
{
|
||||
if (current_text_props.content_.style_text_underline_type_)
|
||||
current_text_props.content_.style_text_underline_type_ = boost::none;
|
||||
else
|
||||
current_text_props.content_.style_text_underline_type_ = odf_types::line_type(odf_types::line_type::Single);
|
||||
pos++;
|
||||
}break;
|
||||
case 'S':
|
||||
{
|
||||
if (current_text_props.content_.style_text_line_through_type_)
|
||||
current_text_props.content_.style_text_line_through_type_ = boost::none;
|
||||
else
|
||||
current_text_props.content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::Single);
|
||||
pos++;
|
||||
}break;
|
||||
case 'K':
|
||||
{
|
||||
pos++;
|
||||
std::wstring color = oox_header_footer->m_sText.substr(pos, 6); pos += 6;
|
||||
|
||||
current_text_props.content_.fo_color_ = odf_types::color(L"#" + color);
|
||||
};break;
|
||||
}break;
|
||||
case '\"':
|
||||
{
|
||||
pos = oox_header_footer->m_sText.find(L'\"', pos + 1); pos++;
|
||||
size_t pos1 = oox_header_footer->m_sText.find(L'\"', pos + 1);
|
||||
std::wstring font = oox_header_footer->m_sText.substr(pos + 1, pos1 - pos - 1); pos = pos1;
|
||||
|
||||
pos1 = font.find(L",");
|
||||
if (pos1 != std::wstring::npos)
|
||||
{
|
||||
std::wstring format = font.substr(pos1 + 1);
|
||||
font = font.substr(0, pos1);
|
||||
|
||||
if (std::wstring::npos != format.find(L"Bold"))
|
||||
current_text_props.content_.fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WBold);
|
||||
if (std::wstring::npos != format.find(L"Italic"))
|
||||
current_text_props.content_.fo_font_style_ = odf_types::font_style(odf_types::font_style::Italic);
|
||||
if (std::wstring::npos != format.find(L"Regular"))
|
||||
{
|
||||
current_text_props.content_.fo_font_weight_ = boost::none;
|
||||
current_text_props.content_.fo_font_style_ = boost::none;
|
||||
}
|
||||
}
|
||||
|
||||
current_text_props.content_.fo_font_family_ = font;
|
||||
pos++;
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
@ -555,8 +625,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CHeaderFooterElement *oox_header_f
|
||||
current_text_props.content_.fo_font_size_ = odf_types::font_size(odf_types::length(font_size, odf_types::length::pt));
|
||||
}
|
||||
}break;
|
||||
|
||||
//&nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points.
|
||||
}
|
||||
size_t next = oox_header_footer->m_sText.find(L'&', pos);
|
||||
if (next == std::wstring::npos) next = oox_header_footer->m_sText.length();
|
||||
@ -581,13 +649,31 @@ void XlsxConverter::convert(OOX::Spreadsheet::CHeaderFooterElement *oox_header_f
|
||||
case 8: ods_context->text_context()->add_text_content(L"&"); break;
|
||||
}
|
||||
type_add = 0;
|
||||
std::wstring text;
|
||||
if (next - pos > 0)
|
||||
{
|
||||
text = oox_header_footer->m_sText.substr(pos, next - pos);
|
||||
std::wstring text = oox_header_footer->m_sText.substr(pos, next - pos);
|
||||
|
||||
size_t pos2 = text.find(10);
|
||||
while(pos2 != std::wstring::npos)
|
||||
{
|
||||
std::wstring text1 = text.substr(0, pos2);
|
||||
text = text.substr(pos2 + 1);
|
||||
if (false == text1.empty())
|
||||
{
|
||||
ods_context->text_context()->add_text_content(text1);
|
||||
}
|
||||
ods_context->text_context()->end_span();
|
||||
ods_context->text_context()->end_paragraph();
|
||||
ods_context->text_context()->start_paragraph(false);
|
||||
ods_context->text_context()->start_span(true);
|
||||
|
||||
pos2 = text.find(10);
|
||||
}
|
||||
if (false == text.empty())
|
||||
{
|
||||
ods_context->text_context()->add_text_content(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
ods_context->text_context()->end_span();
|
||||
}
|
||||
pos = next;
|
||||
@ -1595,13 +1681,13 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPageSetup *oox_page)
|
||||
height = odf_types::length(11, odf_types::length::inch);
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::pagesizeA3Paper:
|
||||
width = odf_types::length(210, odf_types::length::mm);
|
||||
height = odf_types::length(297, odf_types::length::mm);
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::pagesizeA4Paper:
|
||||
width = odf_types::length(297, odf_types::length::mm);
|
||||
height = odf_types::length(420, odf_types::length::mm);
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::pagesizeA4Paper:
|
||||
width = odf_types::length(210, odf_types::length::mm);
|
||||
height = odf_types::length(297, odf_types::length::mm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
//todooo
|
||||
|
||||
@ -86,98 +86,89 @@ void SupBook::readFields(CFRecord& record)
|
||||
if (!origin.empty())
|
||||
{
|
||||
std::wstring sTmp = origin;
|
||||
std::wstring sResult;
|
||||
size_t pos = 0;
|
||||
|
||||
while(true)
|
||||
while(pos < sTmp.length())
|
||||
{
|
||||
int pos = sTmp.find(L"\x0001");
|
||||
if (pos >= 0)
|
||||
switch(sTmp[pos])
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if (bSimple)
|
||||
{
|
||||
bFilePathType = true;
|
||||
bPath = true; //xls_result.xls
|
||||
}
|
||||
else bSimple = true; //file name or file path
|
||||
else bSimple = true; //file name or file path
|
||||
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0002");
|
||||
if (pos >= 0)
|
||||
if (false == sResult.empty())
|
||||
virtPath.push_back(sResult);
|
||||
sResult.clear();
|
||||
}break;
|
||||
case 2:
|
||||
{
|
||||
if (bSimple)
|
||||
bPath = true;
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0003");
|
||||
if (pos >= 0)
|
||||
|
||||
if (false == sResult.empty())
|
||||
virtPath.push_back(sResult);
|
||||
sResult.clear();
|
||||
}break;
|
||||
case 3:
|
||||
{
|
||||
if (bPath)
|
||||
if (false == sResult.empty())
|
||||
{
|
||||
if (bFilePathType)
|
||||
if (bPath)
|
||||
{
|
||||
virtPath.back() += L"file:///" + sTmp.substr(0, 1) + L":\\" + sTmp.substr(1, pos - 1);
|
||||
bFilePathType = false;
|
||||
if (bFilePathType)
|
||||
{
|
||||
virtPath.back() += L"file:///" + sResult.substr(0, 1) + L":\\" + sResult.substr(1, sResult.length() - 1);
|
||||
bFilePathType = false;
|
||||
}
|
||||
else
|
||||
virtPath.back() += L"/" + sResult;
|
||||
}
|
||||
else
|
||||
virtPath.back() += L"/" + sTmp.substr(0, pos);
|
||||
{
|
||||
bOleLink = true;
|
||||
virtPath.push_back(sResult);
|
||||
}
|
||||
sResult.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
bOleLink = true;
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
}
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0004");
|
||||
if (pos >= 0)
|
||||
}break;
|
||||
case 5:
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0005");
|
||||
if (pos >= 0)
|
||||
if (false == sResult.empty())
|
||||
virtPath.push_back(sResult);
|
||||
sResult.clear();
|
||||
|
||||
pos++;//skip http size
|
||||
}break;
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
//skip http size
|
||||
sTmp = sTmp.substr(pos + 2);
|
||||
continue;
|
||||
if (false == sResult.empty())
|
||||
virtPath.push_back(sResult);
|
||||
sResult.clear();
|
||||
}break;
|
||||
default:
|
||||
sResult += sTmp[pos];
|
||||
}
|
||||
pos = sTmp.find(L"\x0006");
|
||||
if (pos >= 0)
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0007");
|
||||
if (pos >= 0)
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0008");
|
||||
if (pos >= 0)
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
pos++;
|
||||
}
|
||||
if (bPath)
|
||||
if (false == sResult.empty())
|
||||
{
|
||||
virtPath.back() += L"/" + sTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
virtPath.push_back(sTmp);
|
||||
if (bPath)
|
||||
{
|
||||
virtPath.back() += L"/" + sResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
virtPath.push_back(sResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,4 +36,5 @@
|
||||
- (BOOL)copyFolderAtPath:(NSString *)sourceFolder toDestinationFolderAtPath:(NSString*)destinationFolder;
|
||||
- (NSString*)createTemporaryDirectory;
|
||||
- (void)createDirectory:(NSString*)directory;
|
||||
- (NSString*)createCacheDirectory:(NSString*)prefix;
|
||||
@end
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString*)createTemporaryDirectory {
|
||||
|
||||
NSError *error = nil;
|
||||
@ -77,4 +78,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString*)createCacheDirectory:(NSString*)prefix {
|
||||
NSError *error = nil;
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
if (paths) {
|
||||
NSString *cacheDirectory = [paths objectAtIndex:0];
|
||||
if (cacheDirectory) {
|
||||
NSString* path = [NSString stringWithFormat:@"%@/%@", cacheDirectory, prefix];
|
||||
if(![self createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error])
|
||||
{
|
||||
NSLog(@"Could not creat temp path %@. error %@", path, error);
|
||||
return @"";
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
return @"";
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -776,54 +776,33 @@ int CFontList::GetFixedPitchPenalty(INT bCandFixed, INT bReqFixed)
|
||||
|
||||
return nPenalty;
|
||||
}
|
||||
int CFontList::GetFaceNamePenalty(std::wstring sCandName, std::wstring sReqName, std::vector<std::wstring>* pArrayLikes)
|
||||
|
||||
CFontListNamePicker CFontList::m_oPicker;
|
||||
int CFontList::GetFaceNamePenalty(std::wstring sCandName, std::wstring sReqName, bool bIsUseNamePicker)
|
||||
{
|
||||
// На MSDN написано, что если имена не совпадают, то вес 10000.
|
||||
// Мы будем сравнивать сколько совпало символов у запрашиваемого
|
||||
// имени и с именем кандидата, без учета решистра, пробелов, запятых
|
||||
// и тире.
|
||||
|
||||
/*
|
||||
TODO:
|
||||
sCandName.Remove(' '); sReqName.Remove(' ');
|
||||
sCandName.Remove(','); sReqName.Remove(',');
|
||||
sCandName.Remove('-'); sReqName.Remove('-');
|
||||
|
||||
sCandName.MakeLower(); sReqName.MakeLower();
|
||||
*/
|
||||
|
||||
if ( 0 == sReqName.length() )
|
||||
if ( 0 == sReqName.length() )
|
||||
return 0;
|
||||
|
||||
if ( 0 == sCandName.length() )
|
||||
if ( 0 == sCandName.length() )
|
||||
return 10000;
|
||||
|
||||
if ( sReqName == sCandName )
|
||||
return 0;
|
||||
else if ( std::wstring::npos != sReqName.find( sCandName ) || std::wstring::npos != sCandName.find( sReqName ) )
|
||||
|
||||
if ( std::wstring::npos != sReqName.find( sCandName ) || std::wstring::npos != sCandName.find( sReqName ) )
|
||||
{
|
||||
if (m_oPicker.IsLikeFonts(sCandName, sReqName))
|
||||
return 700;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
if (NULL != pArrayLikes)
|
||||
if (bIsUseNamePicker)
|
||||
{
|
||||
for (std::vector<std::wstring>::iterator iter = pArrayLikes->begin(); iter != pArrayLikes->end(); iter++)
|
||||
{
|
||||
if (sCandName == *iter)
|
||||
return 2000;
|
||||
}
|
||||
}
|
||||
if (m_oPicker.IsLikeFonts(sCandName, sReqName))
|
||||
return 1000;
|
||||
|
||||
/*
|
||||
NSFonts::makeLower(sCandName);
|
||||
NSFonts::makeLower(sReqName);
|
||||
if ( sReqName == sCandName )
|
||||
return 1500;
|
||||
|
||||
sCandName = NSFonts::prepareFont3000(sCandName);
|
||||
sReqName = NSFonts::prepareFont3000(sReqName);
|
||||
|
||||
if ( sReqName == sCandName )
|
||||
return 3000;
|
||||
*/
|
||||
return m_oPicker.CheckEqualsFonts(sCandName, sReqName);
|
||||
}
|
||||
|
||||
return 10000;
|
||||
}
|
||||
@ -1048,16 +1027,6 @@ NSFonts::CFontInfo* CFontList::GetByParams(NSFonts::CFontSelectFormat& oSelect,
|
||||
|
||||
int nDefPenalty = 2147483647;
|
||||
|
||||
std::vector<std::wstring>* pArrayLikes = NULL;
|
||||
if (oSelect.wsName != NULL)
|
||||
{
|
||||
std::map<std::wstring, int>::iterator iterLikeIndex = m_mapNamesToIndex.find(*oSelect.wsName);
|
||||
if (iterLikeIndex != m_mapNamesToIndex.end())
|
||||
{
|
||||
pArrayLikes = &m_listLikes[iterLikeIndex->second];
|
||||
}
|
||||
}
|
||||
|
||||
NSFonts::CFontInfo* pInfoMin = NULL;
|
||||
for (std::vector<NSFonts::CFontInfo*>::iterator iter = m_pList.begin(); iter != m_pList.end(); iter++)
|
||||
{
|
||||
@ -1094,13 +1063,13 @@ NSFonts::CFontInfo* CFontList::GetByParams(NSFonts::CFontSelectFormat& oSelect,
|
||||
|
||||
if ( oSelect.wsName != NULL && oSelect.wsAltName != NULL )
|
||||
{
|
||||
nCurPenalty += min( GetFaceNamePenalty( pInfo->m_wsFontName, *oSelect.wsName, pArrayLikes ),
|
||||
GetFaceNamePenalty( pInfo->m_wsFontName, *oSelect.wsAltName, pArrayLikes ) );
|
||||
nCurPenalty += min( GetFaceNamePenalty( pInfo->m_wsFontName, *oSelect.wsName, true ),
|
||||
GetFaceNamePenalty( pInfo->m_wsFontName, *oSelect.wsAltName, true ) );
|
||||
}
|
||||
else if ( oSelect.wsName != NULL )
|
||||
nCurPenalty += GetFaceNamePenalty( pInfo->m_wsFontName, *oSelect.wsName, pArrayLikes );
|
||||
nCurPenalty += GetFaceNamePenalty( pInfo->m_wsFontName, *oSelect.wsName, true );
|
||||
else if ( oSelect.wsAltName != NULL )
|
||||
nCurPenalty += GetFaceNamePenalty( pInfo->m_wsFontName, *oSelect.wsAltName, pArrayLikes );
|
||||
nCurPenalty += GetFaceNamePenalty( pInfo->m_wsFontName, *oSelect.wsAltName, true );
|
||||
|
||||
if ( NULL != oSelect.usWidth )
|
||||
nCurPenalty += GetWidthPenalty( pInfo->m_usWidth, *oSelect.usWidth );
|
||||
|
||||
@ -56,24 +56,16 @@ public:
|
||||
int End;
|
||||
};
|
||||
|
||||
class CFontList : public NSFonts::IFontList
|
||||
class CFontListNamePicker
|
||||
{
|
||||
private:
|
||||
std::vector<NSFonts::CFontInfo*> m_pList;
|
||||
std::wstring m_sDirectory;
|
||||
// вспомогогательные данные для подбора "похожих шрифтов"
|
||||
std::map<std::wstring, int> m_mapNamesToIndex;
|
||||
std::map<std::wstring, int> m_mapNamesToIndex;
|
||||
std::vector<std::vector<std::wstring> > m_listLikes;
|
||||
|
||||
CFontRange* m_pRanges;
|
||||
int m_nRangesCount;
|
||||
|
||||
std::list<CFontRange> m_listRanges; // последние использованные (найденные)
|
||||
|
||||
public:
|
||||
CFontList()
|
||||
{
|
||||
// 0
|
||||
CFontListNamePicker()
|
||||
{
|
||||
// 0 [Cambria Math]
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Cambria Math", 0));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Asana Math", 0));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"XITS Math", 0));
|
||||
@ -86,12 +78,180 @@ public:
|
||||
ar0.push_back(L"Latin Modern");
|
||||
m_listLikes.push_back(ar0);
|
||||
|
||||
// 1
|
||||
// 1 [Symbol]
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Symbol", 1));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Wingdings", 1));
|
||||
std::vector<std::wstring> ar1;
|
||||
ar1.push_back(L"OpenSymbol");
|
||||
m_listLikes.push_back(ar1);
|
||||
|
||||
// 2 [Arial]
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Arial", 2));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Liberation Sans", 2));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Helvetica", 2));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Nimbus Sans L", 2));
|
||||
|
||||
std::vector<std::wstring> ar2;
|
||||
ar2.push_back(L"Arial");
|
||||
ar2.push_back(L"Liberation Sans");
|
||||
ar2.push_back(L"Helvetica");
|
||||
ar2.push_back(L"Nimbus Sans L");
|
||||
m_listLikes.push_back(ar2);
|
||||
|
||||
// 3 [Times New Roman]
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Times New Roman", 3));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Liberation Serif", 3));
|
||||
|
||||
std::vector<std::wstring> ar3;
|
||||
ar3.push_back(L"Times New Roman");
|
||||
ar3.push_back(L"Liberation Serif");
|
||||
m_listLikes.push_back(ar3);
|
||||
|
||||
// 4 [Courier New]
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Courier New", 4));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Liberation Mono", 4));
|
||||
|
||||
std::vector<std::wstring> ar4;
|
||||
ar4.push_back(L"Courier New");
|
||||
ar4.push_back(L"Liberation Mono");
|
||||
m_listLikes.push_back(ar4);
|
||||
|
||||
// 5 [Segoe]
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Segoe", 5));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Segoe UI", 5));
|
||||
|
||||
std::vector<std::wstring> ar5;
|
||||
ar5.push_back(L"Segoe");
|
||||
ar5.push_back(L"Segoe UI");
|
||||
m_listLikes.push_back(ar5);
|
||||
|
||||
// 6 [Cambria]
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Cambria", 6));
|
||||
m_mapNamesToIndex.insert(std::pair<std::wstring, int>(L"Caladea", 6));
|
||||
|
||||
std::vector<std::wstring> ar6;
|
||||
ar6.push_back(L"Cambria");
|
||||
ar6.push_back(L"Caladea");
|
||||
m_listLikes.push_back(ar6);
|
||||
}
|
||||
|
||||
bool IsLikeFonts(const std::wstring& name, const std::wstring& req)
|
||||
{
|
||||
std::map<std::wstring, int>::iterator pos = m_mapNamesToIndex.find(req);
|
||||
if (pos == m_mapNamesToIndex.end())
|
||||
return false;
|
||||
|
||||
const std::vector<std::wstring>& names = m_listLikes.at(pos->second);
|
||||
for (std::vector<std::wstring>::const_iterator iter = names.begin(); iter != names.end(); iter++)
|
||||
{
|
||||
if (name == *iter)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int CheckEqualsFonts(const std::wstring& name, const std::wstring& req)
|
||||
{
|
||||
int lenName = (int)name.length();
|
||||
int lenReq = (int)req.length();
|
||||
|
||||
const wchar_t* pName = name.c_str();
|
||||
const wchar_t* pReq = req.c_str();
|
||||
|
||||
if (lenName == lenReq)
|
||||
{
|
||||
int i = 0;
|
||||
while (i < lenName)
|
||||
{
|
||||
wchar_t mem1 = *pName++;
|
||||
wchar_t mem2 = *pReq++;
|
||||
if (mem1 == mem2)
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (mem1 >= 'A' && mem1 <= 'Z' && (mem1 + 'a' - 'A') == mem2)
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (mem2 >= 'A' && mem2 <= 'Z' && (mem2 + 'a' - 'A') == mem1)
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (i == lenName)
|
||||
return 1500;
|
||||
}
|
||||
|
||||
pName = name.c_str();
|
||||
pReq = req.c_str();
|
||||
|
||||
wchar_t* pNameD = new wchar_t[lenName]; int nLenName = 0;
|
||||
wchar_t* pReqD = new wchar_t[lenReq]; int nLenReq = 0;
|
||||
|
||||
for (int i = 0; i < lenName; ++i)
|
||||
{
|
||||
wchar_t mem = *pName++;
|
||||
if (mem == '-' || mem == ' ' || mem == ',')
|
||||
continue;
|
||||
if (mem >= 'A' && mem <= 'Z')
|
||||
mem += ('a' - 'A');
|
||||
pNameD[nLenName++] = mem;
|
||||
}
|
||||
for (int i = 0; i < lenReq; ++i)
|
||||
{
|
||||
wchar_t mem = *pReq++;
|
||||
if (mem == '-' || mem == ' ' || mem == ',')
|
||||
continue;
|
||||
if (mem >= 'A' && mem <= 'Z')
|
||||
mem += ('a' - 'A');
|
||||
pReqD[nLenReq++] = mem;
|
||||
}
|
||||
|
||||
wchar_t* pNameDCur = pNameD;
|
||||
wchar_t* pReqDCur = pReqD;
|
||||
|
||||
bool bIsEq = false;
|
||||
if (nLenName == nLenReq)
|
||||
{
|
||||
int i = 0;
|
||||
while (i < nLenName)
|
||||
{
|
||||
if (*pNameDCur++ != *pReqDCur++)
|
||||
break;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (i == nLenName)
|
||||
bIsEq = true;
|
||||
}
|
||||
|
||||
delete [] pNameD;
|
||||
delete [] pReqD;
|
||||
|
||||
return bIsEq ? 3000 : 10000;
|
||||
}
|
||||
};
|
||||
|
||||
class CFontList : public NSFonts::IFontList
|
||||
{
|
||||
private:
|
||||
std::vector<NSFonts::CFontInfo*> m_pList;
|
||||
std::wstring m_sDirectory;
|
||||
|
||||
static CFontListNamePicker m_oPicker;
|
||||
|
||||
CFontRange* m_pRanges;
|
||||
int m_nRangesCount;
|
||||
|
||||
std::list<CFontRange> m_listRanges; // последние использованные (найденные)
|
||||
|
||||
public:
|
||||
CFontList()
|
||||
{
|
||||
m_pRanges = NULL;
|
||||
m_nRangesCount = 0;
|
||||
}
|
||||
@ -113,7 +273,7 @@ private:
|
||||
int GetCharsetPenalty(ULONG ulCandRanges[6], unsigned char unReqCharset);
|
||||
int GetSigPenalty(ULONG ulCandRanges[6], ULONG ulReqRanges[6], double dRangeWeight = 1, double dRangeWeightSuferflouous = 0);
|
||||
int GetFixedPitchPenalty(INT bCandFixed, INT bReqFixed);
|
||||
int GetFaceNamePenalty(std::wstring sCandName, std::wstring sReqName, std::vector<std::wstring>* pArrayLikes = NULL);
|
||||
int GetFaceNamePenalty(std::wstring sCandName, std::wstring sReqName, bool bIsUseNamePicker = false);
|
||||
int GetFamilyUnlikelyPenalty(SHORT nCandFamilyClass, SHORT nReqFamilyClass);
|
||||
int GetFamilyUnlikelyPenalty(int nCandFamilyClass, std::wstring sReqFamilyClass);
|
||||
int GetWidthPenalty(USHORT usCandWidth, USHORT usReqWidth);
|
||||
|
||||
@ -111,19 +111,6 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
|
||||
if (m_bIsUseSystemFonts)
|
||||
strFontsW_Cur = pApplicationF->GetSetupFontFiles();
|
||||
|
||||
#if defined(_LINUX) && !defined(__ANDROID__)
|
||||
std::wstring sHome = GetHomeDirectory();
|
||||
if (!sHome.empty())
|
||||
{
|
||||
#ifdef _MAC
|
||||
NSDirectory::GetFiles2(sHome + L"/Library/Fonts", strFontsW_Cur, true);
|
||||
#else
|
||||
NSDirectory::GetFiles2(sHome + L"/.fonts", strFontsW_Cur, true);
|
||||
NSDirectory::GetFiles2(sHome + L"/.local/share/fonts", strFontsW_Cur, true);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
for (std::vector<std::wstring>::iterator i = m_arAdditionalFolders.begin(); i != m_arAdditionalFolders.end(); i++)
|
||||
{
|
||||
NSDirectory::GetFiles2(*i, strFontsW_Cur, true);
|
||||
|
||||
@ -1019,6 +1019,20 @@ double CFontFile::GetCharWidth(int gid)
|
||||
return dRet;
|
||||
}
|
||||
|
||||
int CFontFile::GetGIDByUnicode(int code)
|
||||
{
|
||||
int nCMapIndex = 0;
|
||||
int unGID = m_bStringGID ? code : SetCMapForCharCode(code, &nCMapIndex);
|
||||
|
||||
if (unGID <= 0 && !m_bStringGID)
|
||||
{
|
||||
if (-1 != m_nSymbolic && code < 0xF000)
|
||||
unGID = SetCMapForCharCode(code, &nCMapIndex);
|
||||
}
|
||||
|
||||
return unGID;
|
||||
}
|
||||
|
||||
INT CFontFile::GetString(CGlyphString& oString)
|
||||
{
|
||||
int nCountGlyph = oString.GetLength();
|
||||
|
||||
@ -210,6 +210,8 @@ public:
|
||||
CFontManager* m_pFontManager;
|
||||
INT m_bHintsSupport;
|
||||
|
||||
std::wstring m_sName;
|
||||
|
||||
public:
|
||||
|
||||
CFontFile();
|
||||
@ -250,6 +252,8 @@ public:
|
||||
|
||||
double GetCharWidth(int gid);
|
||||
|
||||
int GetGIDByUnicode(int code);
|
||||
|
||||
int GetKerning(FT_UInt unPrevGID, FT_UInt unGID);
|
||||
void SetStringGID(const INT& bGID);
|
||||
INT GetStringGID();
|
||||
|
||||
@ -688,7 +688,8 @@ INT CFontManager::LoadFontFromFile(const std::wstring& sPath, const int& lFaceIn
|
||||
m_sName = L"";
|
||||
if (m_pFont->m_pFace && m_pFont->m_pFace->family_name)
|
||||
{
|
||||
m_sName = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)m_pFont->m_pFace->family_name, strlen(m_pFont->m_pFace->family_name));
|
||||
m_pFont->m_sName = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)m_pFont->m_pFace->family_name, strlen(m_pFont->m_pFace->family_name));
|
||||
m_sName = m_pFont->m_sName;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@ -33,14 +33,132 @@
|
||||
|
||||
#include "./MetafileToRendererCheck.h"
|
||||
#include "agg_math.h"
|
||||
#include "../fontengine/FontManager.h"
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
#include "../common/StringExt.h"
|
||||
#endif
|
||||
|
||||
// этот класс нужно переписать. должно работать как и в js
|
||||
// а не просто на каждом символе переключаться, если нужно
|
||||
class CMetafileFontPicker
|
||||
{
|
||||
private:
|
||||
NSFonts::IApplicationFonts* m_pApplication;
|
||||
NSFonts::IFontManager* m_pManager;
|
||||
IRenderer* m_pRenderer;
|
||||
|
||||
public:
|
||||
CMetafileFontPicker(std::wstring sFolder)
|
||||
{
|
||||
m_pApplication = NSFonts::NSApplication::Create();
|
||||
m_pApplication->InitializeFromFolder(sFolder);
|
||||
m_pManager = m_pApplication->GenerateFontManager();
|
||||
|
||||
NSFonts::IFontsCache* pCache = NSFonts::NSFontCache::Create();
|
||||
pCache->SetStreams(m_pApplication->GetStreams());
|
||||
m_pManager->SetOwnerCache(pCache);
|
||||
|
||||
m_pRenderer = NULL;
|
||||
}
|
||||
CMetafileFontPicker(NSFonts::IApplicationFonts* pFonts)
|
||||
{
|
||||
m_pApplication = pFonts;
|
||||
m_pApplication->AddRef();
|
||||
m_pManager = m_pApplication->GenerateFontManager();
|
||||
|
||||
NSFonts::IFontsCache* pCache = NSFonts::NSFontCache::Create();
|
||||
pCache->SetStreams(m_pApplication->GetStreams());
|
||||
m_pManager->SetOwnerCache(pCache);
|
||||
|
||||
m_pRenderer = NULL;
|
||||
}
|
||||
~CMetafileFontPicker()
|
||||
{
|
||||
m_pManager->Release();
|
||||
m_pApplication->Release();
|
||||
}
|
||||
|
||||
void SetFont(const std::wstring& sName, const bool& bBold, const bool& bItalic)
|
||||
{
|
||||
int nStyle = 0;
|
||||
if (bBold) nStyle |= 0x01;
|
||||
if (bItalic) nStyle |= 0x02;
|
||||
SetFont(sName, nStyle);
|
||||
}
|
||||
void SetFont(const std::wstring& sName, const int& nStyle)
|
||||
{
|
||||
m_pManager->LoadFontByName(sName, 10, nStyle, 72, 72);
|
||||
}
|
||||
|
||||
void FillText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h)
|
||||
{
|
||||
int bGID = 0;
|
||||
m_pRenderer->get_FontStringGID(&bGID);
|
||||
|
||||
CGlyphString oString(bsText, 0, 0);
|
||||
if (bGID || oString.GetLength() != 1)
|
||||
{
|
||||
m_pRenderer->CommandDrawText(bsText, x, y, w, h);
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring sName;
|
||||
LONG nStyle = 0;
|
||||
m_pRenderer->get_FontName(&sName);
|
||||
m_pRenderer->get_FontStyle(&nStyle);
|
||||
SetFont(sName, (int)nStyle);
|
||||
|
||||
NSFonts::IFontFile* pFont = m_pManager->GetFile();
|
||||
if (!pFont)
|
||||
{
|
||||
m_pRenderer->CommandDrawText(bsText, x, y, w, h);
|
||||
return;
|
||||
}
|
||||
|
||||
int code = oString.GetAt(0)->lUnicode;
|
||||
if (pFont->GetGIDByUnicode(code))
|
||||
{
|
||||
m_pRenderer->CommandDrawText(bsText, x, y, w, h);
|
||||
return;
|
||||
}
|
||||
|
||||
CFontFile* pFileNew = ((CFontManager*)m_pManager)->GetFontFileBySymbol((CFontFile*)m_pManager->GetFile(), code);
|
||||
if (!pFileNew)
|
||||
{
|
||||
m_pRenderer->CommandDrawText(bsText, x, y, w, h);
|
||||
return;
|
||||
}
|
||||
|
||||
m_pRenderer->put_FontName(pFileNew->m_sName);
|
||||
int nNewStyle = 0;
|
||||
if (pFileNew->IsBold()) nNewStyle |= 0x01;
|
||||
if (pFileNew->IsItalic()) nNewStyle |= 0x02;
|
||||
m_pRenderer->put_FontStyle(nNewStyle);
|
||||
m_pRenderer->CommandDrawText(bsText, x, y, w, h);
|
||||
m_pRenderer->put_FontName(sName);
|
||||
m_pRenderer->put_FontStyle(nStyle);
|
||||
}
|
||||
|
||||
void SetRenderer(IRenderer* pRenderer)
|
||||
{
|
||||
m_pRenderer = pRenderer;
|
||||
}
|
||||
};
|
||||
|
||||
IMetafileToRenderter::IMetafileToRenderter(IRenderer* pRenderer)
|
||||
{
|
||||
m_pRenderer = pRenderer;
|
||||
m_pPicker = NULL;
|
||||
}
|
||||
IMetafileToRenderter::~IMetafileToRenderter()
|
||||
{
|
||||
if (!m_pPicker)
|
||||
return;
|
||||
|
||||
CMetafileFontPicker* pPicker = (CMetafileFontPicker*)m_pPicker;
|
||||
RELEASEOBJECT(pPicker);
|
||||
m_pPicker = NULL;
|
||||
}
|
||||
void IMetafileToRenderter::EnableBrushRect(bool bValue)
|
||||
{
|
||||
@ -61,6 +179,17 @@ void IMetafileToRenderter::SetRadialGradiant(const double& dX0, const double& dY
|
||||
m_pRenderer->put_BrushType(/*c_BrushTypePathGradient2*/2007);
|
||||
}
|
||||
|
||||
void IMetafileToRenderter::InitPicker(const std::wstring& sFontsFolder)
|
||||
{
|
||||
CMetafileFontPicker* pPicker = new CMetafileFontPicker(sFontsFolder);
|
||||
m_pPicker = (void*)pPicker;
|
||||
}
|
||||
void IMetafileToRenderter::InitPicker(NSFonts::IApplicationFonts* pFonts)
|
||||
{
|
||||
CMetafileFontPicker* pPicker = new CMetafileFontPicker(pFonts);
|
||||
m_pPicker = (void*)pPicker;
|
||||
}
|
||||
|
||||
namespace NSOnlineOfficeBinToPdf
|
||||
{
|
||||
inline INT32 ReadInt(BYTE*& pData, int& nOffset)
|
||||
@ -156,6 +285,12 @@ namespace NSOnlineOfficeBinToPdf
|
||||
bool ConvertBufferToRenderer(BYTE* pBuffer, LONG lBufferLen, IMetafileToRenderter* pCorrector)
|
||||
{
|
||||
IRenderer* pRenderer = pCorrector->m_pRenderer;
|
||||
CMetafileFontPicker* pPicker = NULL;
|
||||
if (pCorrector->m_pPicker)
|
||||
{
|
||||
pPicker = (CMetafileFontPicker*)pCorrector->m_pPicker;
|
||||
pPicker->SetRenderer(pRenderer);
|
||||
}
|
||||
|
||||
LONG lRendererType = 0;
|
||||
pRenderer->get_Type(&lRendererType);
|
||||
@ -549,7 +684,10 @@ namespace NSOnlineOfficeBinToPdf
|
||||
double m1 = ReadInt(current, curindex) / 100000.0;
|
||||
double m2 = ReadInt(current, curindex) / 100000.0;
|
||||
|
||||
pRenderer->CommandDrawText(wsTempString, m1, m2, 0, 0);
|
||||
if (!pPicker)
|
||||
pRenderer->CommandDrawText(wsTempString, m1, m2, 0, 0);
|
||||
else
|
||||
pPicker->FillText(wsTempString, m1, m2, 0, 0);
|
||||
break;
|
||||
}
|
||||
case ctBeginCommand:
|
||||
|
||||
@ -44,15 +44,19 @@ class GRAPHICS_DECL IMetafileToRenderter
|
||||
{
|
||||
public:
|
||||
IRenderer* m_pRenderer;
|
||||
void* m_pPicker;
|
||||
|
||||
public:
|
||||
IMetafileToRenderter(IRenderer* pRenderer);
|
||||
virtual ~IMetafileToRenderter();
|
||||
|
||||
public:
|
||||
virtual std::wstring GetImagePath(const std::wstring& sPath) = 0;
|
||||
virtual void EnableBrushRect(bool bValue);
|
||||
virtual void SetLinearGradiant(const double& x0, const double& y0, const double& x1, const double& y1);
|
||||
virtual void SetRadialGradiant(const double& dX0, const double& dY0, const double& dR0, const double& dX1, const double& dY1, const double& dR1);
|
||||
virtual void InitPicker(const std::wstring& sFontsFolder);
|
||||
virtual void InitPicker(NSFonts::IApplicationFonts* pFonts);
|
||||
};
|
||||
|
||||
namespace NSOnlineOfficeBinToPdf
|
||||
|
||||
@ -489,6 +489,8 @@ namespace NSFonts
|
||||
|
||||
virtual int SetCMapForCharCode(long lUnicode, int *pnCMapIndex) = 0;
|
||||
virtual double GetCharWidth(int gid) = 0;
|
||||
|
||||
virtual int GetGIDByUnicode(int code) = 0;
|
||||
};
|
||||
|
||||
namespace NSFontFile
|
||||
|
||||
@ -167,15 +167,17 @@ namespace NSOnlineOfficeBinToPdf
|
||||
}
|
||||
};
|
||||
|
||||
static bool ConvertBufferToPdf(CPdfRenderer* pPdf, BYTE* pBuffer, LONG lBufferLen, const std::wstring& wsHtmlPlace)
|
||||
static bool ConvertBufferToPdf(CPdfRenderer* pPdf, BYTE* pBuffer, LONG lBufferLen, const std::wstring& wsHtmlPlace, const bool& bIsUsePicker = false)
|
||||
{
|
||||
CMetafileToRenderterPDF oCorrector(pPdf);
|
||||
oCorrector.wsHtmlPlace = wsHtmlPlace;
|
||||
if (bIsUsePicker)
|
||||
oCorrector.InitPicker(pPdf->GetApplicationFonts());
|
||||
NSOnlineOfficeBinToPdf::ConvertBufferToRenderer(pBuffer, lBufferLen, &oCorrector);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool ConvertBinToPdf(CPdfRenderer* pPdf, const std::wstring& wsSrcFile, const std::wstring& wsDstFile, bool bBinary)
|
||||
bool ConvertBinToPdf(CPdfRenderer* pPdf, const std::wstring& wsSrcFile, const std::wstring& wsDstFile, bool bBinary, const bool& bIsUsePicker)
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
if (!oFile.OpenFile(wsSrcFile))
|
||||
@ -196,7 +198,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
std::wstring wsHtmlPlace = NSDirectory::GetFolderPath(wsSrcFile);
|
||||
if (bBinary)
|
||||
{
|
||||
ConvertBufferToPdf(pPdf, pFileContent, dwFileSize, wsHtmlPlace);
|
||||
ConvertBufferToPdf(pPdf, pFileContent, dwFileSize, wsHtmlPlace, bIsUsePicker);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -210,7 +212,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
|
||||
if (NSBase64::Base64Decode((const char*)pFileContent, dwFileSize, pBuffer, &nBufferLen))
|
||||
{
|
||||
ConvertBufferToPdf(pPdf, pBuffer, nBufferLen, wsHtmlPlace);
|
||||
ConvertBufferToPdf(pPdf, pBuffer, nBufferLen, wsHtmlPlace, bIsUsePicker);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -37,8 +37,8 @@
|
||||
|
||||
namespace NSOnlineOfficeBinToPdf
|
||||
{
|
||||
bool ConvertBinToPdf(CPdfRenderer* pPdf, const std::wstring& wsSrcFile, const std::wstring& wsDstFile, bool bBinary);
|
||||
};
|
||||
bool ConvertBinToPdf(CPdfRenderer* pPdf, const std::wstring& wsSrcFile, const std::wstring& wsDstFile, bool bBinary, const bool& bIsUsePicker = false);
|
||||
}
|
||||
|
||||
#endif // _PDF_WRITER_ONLINEOFFICEBINTOPDF_H
|
||||
|
||||
|
||||
@ -1515,6 +1515,11 @@ HRESULT CPdfRenderer::DrawImageWith1bppMask(IGrObject* pImage, NSImages::CPixJbi
|
||||
m_pPage->GrRestore();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
NSFonts::IApplicationFonts* CPdfRenderer::GetApplicationFonts()
|
||||
{
|
||||
return m_pAppFonts;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Внутренние функции
|
||||
//----------------------------------------------------------------------------------------
|
||||
@ -1947,16 +1952,16 @@ void CPdfRenderer::UpdateBrush()
|
||||
m_pPage->SetFillAlpha((unsigned char)m_oBrush.GetAlpha1());
|
||||
}
|
||||
}
|
||||
HRESULT CPdfRenderer::OnlineWordToPdf (const std::wstring& wsSrcFile, const std::wstring& wsDstFile)
|
||||
HRESULT CPdfRenderer::OnlineWordToPdf (const std::wstring& wsSrcFile, const std::wstring& wsDstFile, const bool& bIsUsePicker)
|
||||
{
|
||||
if (!NSOnlineOfficeBinToPdf::ConvertBinToPdf(this, wsSrcFile, wsDstFile, false))
|
||||
if (!NSOnlineOfficeBinToPdf::ConvertBinToPdf(this, wsSrcFile, wsDstFile, false, bIsUsePicker))
|
||||
return S_FALSE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CPdfRenderer::OnlineWordToPdfFromBinary(const std::wstring& wsSrcFile, const std::wstring& wsDstFile)
|
||||
HRESULT CPdfRenderer::OnlineWordToPdfFromBinary(const std::wstring& wsSrcFile, const std::wstring& wsDstFile, const bool& bIsUsePicker)
|
||||
{
|
||||
if (!NSOnlineOfficeBinToPdf::ConvertBinToPdf(this, wsSrcFile, wsDstFile, true))
|
||||
if (!NSOnlineOfficeBinToPdf::ConvertBinToPdf(this, wsSrcFile, wsDstFile, true, bIsUsePicker))
|
||||
return S_FALSE;
|
||||
|
||||
return S_OK;
|
||||
|
||||
@ -218,10 +218,12 @@ public:
|
||||
HRESULT EnableBrushRect(const LONG& lEnable);
|
||||
HRESULT SetLinearGradient(const double& dX1, const double& dY1, const double& dX2, const double& dY2);
|
||||
HRESULT SetRadialGradient(const double& dX1, const double& dY1, const double& dR1, const double& dX2, const double& dY2, const double& dR2);
|
||||
HRESULT OnlineWordToPdf (const std::wstring& wsSrcFile, const std::wstring& wsDstFile);
|
||||
HRESULT OnlineWordToPdfFromBinary(const std::wstring& wsSrcFile, const std::wstring& wsDstFile);
|
||||
HRESULT OnlineWordToPdf (const std::wstring& wsSrcFile, const std::wstring& wsDstFile, const bool& bIsUsePicker = false);
|
||||
HRESULT OnlineWordToPdfFromBinary(const std::wstring& wsSrcFile, const std::wstring& wsDstFile, const bool& bIsUsePicker = false);
|
||||
HRESULT DrawImageWith1bppMask(IGrObject* pImage, NSImages::CPixJbig2* pMaskBuffer, const unsigned int& unMaskWidth, const unsigned int& unMaskHeight, const double& dX, const double& dY, const double& dW, const double& dH);
|
||||
|
||||
NSFonts::IApplicationFonts* GetApplicationFonts();
|
||||
|
||||
private:
|
||||
|
||||
void OnlineWordToPdfInternal(BYTE* dstArray, LONG lLen, const std::wstring& wsHtmlPlace, std::wstring& wsHypers, int& nCountPages, const std::wstring& wsTempLogo, LONG lReg);
|
||||
|
||||
Reference in New Issue
Block a user