Commit 33aeef2c authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormat - spreadsheets - support page cover

parent 7c97941a
...@@ -1195,7 +1195,7 @@ void docx_conversion_context::process_headers_footers() ...@@ -1195,7 +1195,7 @@ void docx_conversion_context::process_headers_footers()
// проходим по всем page layout // проходим по всем page layout
BOOST_FOREACH(const odf_reader::style_master_page* page, pageLayouts.master_pages()) BOOST_FOREACH(const odf_reader::style_master_page* page, pageLayouts.master_pages())
{ {
const std::wstring & styleName = page->style_master_page_attlist_.style_name_.get_value_or( L"" ); const std::wstring & styleName = page->attlist_.style_name_.get_value_or( L"" );
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName); const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
add_page_properties(masterPageNameLayout); add_page_properties(masterPageNameLayout);
......
...@@ -272,9 +272,9 @@ void pptx_conversion_context::end_document() ...@@ -272,9 +272,9 @@ void pptx_conversion_context::end_document()
odf_reader::odf_read_context & context = root()->odf_context(); odf_reader::odf_read_context & context = root()->odf_context();
odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer(); odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer();
if ((pageLayouts.master_pages().size() > 0) && (pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_))//default if ((pageLayouts.master_pages().size() > 0) && (pageLayouts.master_pages()[0]->attlist_.style_name_))//default
{ {
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_.get(); const std::wstring masterStyleName = pageLayouts.master_pages()[0]->attlist_.style_name_.get();
const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterStyleName); const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterStyleName);
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties); odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
std::wstringstream autofilter_; std::wstringstream autofilter_;
std::wstringstream conditionalFormatting_; std::wstringstream conditionalFormatting_;
std::wstringstream ole_objects_; std::wstringstream ole_objects_;
std::wstringstream page_props_;
rels hyperlinks_rels_; rels hyperlinks_rels_;
rels ole_objects_rels_; rels ole_objects_rels_;
...@@ -134,6 +135,11 @@ std::wostream & xlsx_xml_worksheet::ole_objects() ...@@ -134,6 +135,11 @@ std::wostream & xlsx_xml_worksheet::ole_objects()
{ {
return impl_->ole_objects_; return impl_->ole_objects_;
} }
std::wostream & xlsx_xml_worksheet::page_properties()
{
return impl_->page_props_;
}
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
rels & xlsx_xml_worksheet::hyperlinks_rels() rels & xlsx_xml_worksheet::hyperlinks_rels()
{ {
...@@ -196,9 +202,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm) ...@@ -196,9 +202,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
{ {
CP_XML_NODE(L"oleObjects") CP_XML_NODE(L"oleObjects")
{ {
CP_XML_STREAM() << impl_->ole_objects_.str(); CP_XML_STREAM() << impl_->ole_objects_.str();
} }
} }
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}
//CP_XML_NODE(L"headerFooter){} //CP_XML_NODE(L"headerFooter){}
//CP_XML_NODE(L"rowBreaks){} //CP_XML_NODE(L"rowBreaks){}
......
...@@ -63,6 +63,7 @@ public: ...@@ -63,6 +63,7 @@ public:
std::wostream & conditionalFormatting(); std::wostream & conditionalFormatting();
std::wostream & sort(); std::wostream & sort();
std::wostream & ole_objects(); std::wostream & ole_objects();
std::wostream & page_properties();
rels & hyperlinks_rels(); rels & hyperlinks_rels();
rels & ole_objects_rels(); rels & ole_objects_rels();
......
...@@ -341,11 +341,26 @@ double charsToSize(unsigned int charsCount, double maxDigitSize) ...@@ -341,11 +341,26 @@ double charsToSize(unsigned int charsCount, double maxDigitSize)
return 1.0 * int((maxDigitSize * charsCount + 5.0) / maxDigitSize * 256.0) / 256.0; return 1.0 * int((maxDigitSize * charsCount + 5.0) / maxDigitSize * 256.0) / 256.0;
} }
void xlsx_table_state::serialize_table_format(std::wostream & _Wostream) void xlsx_table_state::serialize_page_properties (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;
if (!master_style_->attlist_.style_page_layout_name_) return;
odf_reader::page_layout_instance * page_layout = context_->root()->odf_context().pageLayoutContainer().page_layout_by_name(*master_style_->attlist_.style_page_layout_name_);
if (!page_layout) return;
page_layout->xlsx_serialize(strm, *context_);
}
void xlsx_table_state::serialize_table_format (std::wostream & strm)
{ {
odf_reader::odf_read_context & odfContext = context_->root()->odf_context(); odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
CP_XML_WRITER(_Wostream) CP_XML_WRITER(strm)
{ {
odf_reader::style_table_properties * table_prop = NULL; odf_reader::style_table_properties * table_prop = NULL;
odf_reader::style_instance * tableStyle = odfContext.styleContainer().style_by_name(table_style_, odf_types::style_family::Table, false); odf_reader::style_instance * tableStyle = odfContext.styleContainer().style_by_name(table_style_, odf_types::style_family::Table, false);
...@@ -435,9 +450,9 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream) ...@@ -435,9 +450,9 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
{ {
const odf_reader::style_table_row_properties * prop = rowDefStyle->content()->get_style_table_row_properties(); const odf_reader::style_table_row_properties * prop = rowDefStyle->content()->get_style_table_row_properties();
if ( (prop) && (prop->style_table_row_properties_attlist_.style_row_height_)) if ( (prop) && (prop->attlist_.style_row_height_))
{ {
default_height = prop->style_table_row_properties_attlist_.style_row_height_->get_value_unit(odf_types::length::pt); default_height = prop->attlist_.style_row_height_->get_value_unit(odf_types::length::pt);
} }
std::wstringstream ht_s; std::wstringstream ht_s;
ht_s.precision(1); ht_s.precision(1);
...@@ -451,21 +466,21 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream) ...@@ -451,21 +466,21 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
} }
} }
void xlsx_table_state::serialize_merge_cells(std::wostream & _Wostream) void xlsx_table_state::serialize_merge_cells(std::wostream & strm)
{ {
return xlsx_merge_cells_.xlsx_serialize(_Wostream); return xlsx_merge_cells_.xlsx_serialize(strm);
} }
void xlsx_table_state::serialize_ole_objects(std::wostream & _Wostream) void xlsx_table_state::serialize_ole_objects(std::wostream & strm)
{ {
return xlsx_drawing_context_.get_drawings()->serialize_objects(_Wostream); return xlsx_drawing_context_.get_drawings()->serialize_objects(strm);
} }
void xlsx_table_state::serialize_hyperlinks(std::wostream & _Wostream) void xlsx_table_state::serialize_hyperlinks(std::wostream & strm)
{ {
return xlsx_hyperlinks_.xlsx_serialize(_Wostream); return xlsx_hyperlinks_.xlsx_serialize(strm);
} }
void xlsx_table_state::serialize_conditionalFormatting(std::wostream & _Wostream) void xlsx_table_state::serialize_conditionalFormatting(std::wostream & strm)
{ {
return xlsx_conditionalFormatting_context_.serialize(_Wostream); return xlsx_conditionalFormatting_context_.serialize(strm);
} }
void xlsx_table_state::dump_rels_hyperlinks(rels & Rels) void xlsx_table_state::dump_rels_hyperlinks(rels & Rels)
{ {
......
...@@ -128,7 +128,8 @@ public: ...@@ -128,7 +128,8 @@ public:
void serialize_merge_cells (std::wostream & _Wostream); void serialize_merge_cells (std::wostream & _Wostream);
void serialize_hyperlinks (std::wostream & _Wostream); void serialize_hyperlinks (std::wostream & _Wostream);
void serialize_ole_objects (std::wostream & _Wostream); void serialize_ole_objects (std::wostream & _Wostream);
void serialize_page_properties (std::wostream & _Wostream);
void dump_rels_hyperlinks (rels & Rels); void dump_rels_hyperlinks (rels & Rels);
void dump_rels_ole_objects (rels & Rels); void dump_rels_ole_objects (rels & Rels);
......
...@@ -317,6 +317,10 @@ void xlsx_table_context::serialize_table_format(std::wostream & _Wostream) ...@@ -317,6 +317,10 @@ void xlsx_table_context::serialize_table_format(std::wostream & _Wostream)
{ {
return state()->serialize_table_format(_Wostream); return state()->serialize_table_format(_Wostream);
} }
void xlsx_table_context::serialize_page_properties(std::wostream & _Wostream)
{
return state()->serialize_page_properties(_Wostream);
}
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream) void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{ {
return state()->serialize_hyperlinks(_Wostream); return state()->serialize_hyperlinks(_Wostream);
......
...@@ -90,6 +90,7 @@ public: ...@@ -90,6 +90,7 @@ public:
void serialize_conditionalFormatting(std::wostream & _Wostream); void serialize_conditionalFormatting(std::wostream & _Wostream);
void serialize_hyperlinks (std::wostream & _Wostream); void serialize_hyperlinks (std::wostream & _Wostream);
void serialize_ole_objects (std::wostream & _Wostream); void serialize_ole_objects (std::wostream & _Wostream);
void serialize_page_properties (std::wostream & _Wostream);
xlsx_table_metrics & get_table_metrics(); xlsx_table_metrics & get_table_metrics();
......
...@@ -369,6 +369,7 @@ void xlsx_conversion_context::end_table() ...@@ -369,6 +369,7 @@ void xlsx_conversion_context::end_table()
current_sheet().cols() << L"</cols>"; current_sheet().cols() << L"</cols>";
get_table_context().serialize_table_format (current_sheet().sheetFormat()); get_table_context().serialize_table_format (current_sheet().sheetFormat());
get_table_context().serialize_page_properties (current_sheet().page_properties());
get_table_context().serialize_conditionalFormatting (current_sheet().conditionalFormatting()); get_table_context().serialize_conditionalFormatting (current_sheet().conditionalFormatting());
get_table_context().serialize_autofilter (current_sheet().autofilter()); get_table_context().serialize_autofilter (current_sheet().autofilter());
get_table_context().serialize_sort (current_sheet().sort()); get_table_context().serialize_sort (current_sheet().sort());
...@@ -420,7 +421,7 @@ void xlsx_conversion_context::end_table() ...@@ -420,7 +421,7 @@ void xlsx_conversion_context::end_table()
current_sheet().set_comments_link(commentsName.first, commentsName.second); current_sheet().set_comments_link(commentsName.first, commentsName.second);
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second); current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
} }
//background picture
get_table_context().end_table(); get_table_context().end_table();
} }
......
...@@ -161,7 +161,7 @@ style_table_cell_properties_attlist calc_table_cell_properties(const std::vector ...@@ -161,7 +161,7 @@ style_table_cell_properties_attlist calc_table_cell_properties(const std::vector
BOOST_FOREACH(const style_table_cell_properties* v, props) BOOST_FOREACH(const style_table_cell_properties* v, props)
{ {
if (v) if (v)
result.apply_from(v->style_table_cell_properties_attlist_); result.apply_from(v->attlist_);
} }
return result; return result;
} }
......
...@@ -153,7 +153,7 @@ length ComputeContextWidth(const style_page_layout_properties * pageProperties ...@@ -153,7 +153,7 @@ length ComputeContextWidth(const style_page_layout_properties * pageProperties
if (pagePropertiesNode) if (pagePropertiesNode)
{ {
if (const style_columns * styleColumns if (const style_columns * styleColumns
= dynamic_cast<const style_columns*>( pagePropertiesNode->style_page_layout_properties_elements_.style_columns_.get())) = dynamic_cast<const style_columns*>( pagePropertiesNode->elements_.style_columns_.get()))
{ {
columnsCount = styleColumns->fo_column_count_.get_value_or(1); columnsCount = styleColumns->fo_column_count_.get_value_or(1);
if (!columnsCount) if (!columnsCount)
...@@ -784,7 +784,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -784,7 +784,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
style_page_layout_properties_attlist emptyPageProperties; style_page_layout_properties_attlist emptyPageProperties;
const style_page_layout_properties_attlist & pageProperties = const style_page_layout_properties_attlist & pageProperties =
pagePropertiesNode ? pagePropertiesNode->style_page_layout_properties_attlist_ : emptyPageProperties; pagePropertiesNode ? pagePropertiesNode->attlist_ : emptyPageProperties;
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -462,8 +462,8 @@ void odf_document::Impl::parse_styles() ...@@ -462,8 +462,8 @@ void odf_document::Impl::parse_styles()
continue; continue;
} }
const std::wstring styleName = masterPage->style_master_page_attlist_.style_name_.get_value_or(L""); const std::wstring styleName = masterPage->attlist_.style_name_.get_value_or(L"");
const std::wstring pageLayoutName = masterPage->style_master_page_attlist_.style_page_layout_name_.get_value_or(L""); const std::wstring pageLayoutName = masterPage->attlist_.style_page_layout_name_.get_value_or(L"");
context_->pageLayoutContainer().add_master_page(styleName, pageLayoutName, masterPage); context_->pageLayoutContainer().add_master_page(styleName, pageLayoutName, masterPage);
} }
......
...@@ -40,23 +40,24 @@ namespace cpdoccore { ...@@ -40,23 +40,24 @@ namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
style_instance::style_instance( style_instance::style_instance(
styles_container *Container, styles_container *Container,
const std::wstring &Name, const std::wstring &Name,
style_family::type Type, style_family::type Type,
style_content *Content, style_content *Content,
bool IsAutomatic, bool IsAutomatic,
bool IsDefault, bool IsDefault,
const std::wstring & ParentStyleName, const std::wstring & ParentStyleName,
const std::wstring & NextStyleName, const std::wstring & NextStyleName,
const std::wstring & DataStyleName const std::wstring & DataStyleName
) : container_(Container), ) :
name_(Name), container_ (Container),
style_type_(Type), name_ (Name),
content_(Content), style_type_ (Type),
is_automatic_(IsAutomatic), content_ (Content),
is_default_(IsDefault), is_automatic_ (IsAutomatic),
next_name_(NextStyleName), is_default_ (IsDefault),
next_(Container->style_by_name(NextStyleName, style_type_,false)), next_name_ (NextStyleName),
next_ (Container->style_by_name(NextStyleName, style_type_, false)),
data_style_name_(DataStyleName) data_style_name_(DataStyleName)
{ {
parent_name_ = ParentStyleName; parent_name_ = ParentStyleName;
...@@ -64,8 +65,7 @@ style_instance::style_instance( ...@@ -64,8 +65,7 @@ style_instance::style_instance(
{ {
parent_name_ = L"Standard"; parent_name_ = L"Standard";
} }
parent_ = Container->style_by_name(parent_name_, style_type_,false); parent_ = Container->style_by_name(parent_name_, style_type_, false);
} }
style_instance * styles_container::hyperlink_style() style_instance * styles_container::hyperlink_style()
...@@ -325,6 +325,13 @@ style_page_layout_properties * page_layout_instance::properties() const ...@@ -325,6 +325,13 @@ style_page_layout_properties * page_layout_instance::properties() const
return dynamic_cast<style_page_layout_properties *>(style_page_layout_->style_page_layout_properties_.get()); return dynamic_cast<style_page_layout_properties *>(style_page_layout_->style_page_layout_properties_.get());
} }
void page_layout_instance::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
{
style_page_layout_properties * props = properties();
if (props)
props->xlsx_serialize(strm, Context);
}
void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context) void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
{ {
const style_header_style * headerStyle = dynamic_cast<style_header_style *>(style_page_layout_->style_header_style_.get()); const style_header_style * headerStyle = dynamic_cast<style_header_style *>(style_page_layout_->style_header_style_.get());
...@@ -348,8 +355,10 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc ...@@ -348,8 +355,10 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc
_CP_OPT(length) bottom = attr.fo_min_height_ ? attr.fo_min_height_ : attr.svg_height_; _CP_OPT(length) bottom = attr.fo_min_height_ ? attr.fo_min_height_ : attr.svg_height_;
Context.get_header_footer_context().set_footer(bottom); Context.get_header_footer_context().set_footer(bottom);
} }
properties()->docx_convert_serialize(strm, Context); style_page_layout_properties * props = properties();
if (props)
props->docx_convert_serialize(strm, Context);
} }
void page_layout_instance::pptx_convert(oox::pptx_conversion_context & Context) void page_layout_instance::pptx_convert(oox::pptx_conversion_context & Context)
{ {
......
...@@ -193,8 +193,9 @@ public: ...@@ -193,8 +193,9 @@ public:
const std::wstring & name() const; const std::wstring & name() const;
style_page_layout_properties * properties() const; style_page_layout_properties * properties() const;
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context); void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context); void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
void pptx_convert (oox::pptx_conversion_context & Context);
const style_page_layout * style_page_layout_; const style_page_layout * style_page_layout_;
......
...@@ -98,7 +98,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context) ...@@ -98,7 +98,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
std::vector<style_master_page*> & masterPages = Context.root()->odf_context().pageLayoutContainer().master_pages(); std::vector<style_master_page*> & masterPages = Context.root()->odf_context().pageLayoutContainer().master_pages();
if (!masterPages.empty()) if (!masterPages.empty())
{ {
Context.set_master_page_name(masterPages[0]->style_master_page_attlist_.style_name_.get_value_or(L"Standard")); Context.set_master_page_name(masterPages[0]->attlist_.style_name_.get_value_or(L"Standard"));
} }
const page_layout_instance * layout = Context.root()->odf_context().pageLayoutContainer().page_layout_first(); const page_layout_instance * layout = Context.root()->odf_context().pageLayoutContainer().page_layout_first();
...@@ -116,15 +116,15 @@ void office_body::docx_convert(oox::docx_conversion_context & Context) ...@@ -116,15 +116,15 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
//background (for all pages) //background (for all pages)
if (page_layout_instance * firtsPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties())) if (page_layout_instance * firtsPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{ {
if (style_page_layout_properties * prop = firtsPageLayout->properties()) if (style_page_layout_properties * layout_properties = firtsPageLayout->properties())
{ {
oox::_oox_fill fill; oox::_oox_fill fill;
Compute_GraphicFill(prop->style_page_layout_properties_attlist_.common_draw_fill_attlist_, Compute_GraphicFill(layout_properties->attlist_.common_draw_fill_attlist_,
prop->style_page_layout_properties_elements_.style_background_image_, layout_properties->elements_.style_background_image_,
Context.root()->odf_context().drawStyles(), fill); Context.root()->odf_context().drawStyles(), fill);
if (prop->style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ || fill.type != 0) if (layout_properties->attlist_.common_background_color_attlist_.fo_background_color_ || fill.type != 0)
{ {
if ((fill.bitmap) && (fill.bitmap->rId.empty())) if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{ {
...@@ -132,7 +132,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context) ...@@ -132,7 +132,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, fill.bitmap->isInternal, href); fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, fill.bitmap->isInternal, href);
} }
int id = Context.get_drawing_context().get_current_shape_id(); int id = Context.get_drawing_context().get_current_shape_id();
if (prop->docx_background_serialize(Context.output_stream(), Context, fill, id)) if (layout_properties->docx_background_serialize(Context.output_stream(), Context, fill, id))
{ {
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape", true)); Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape", true));
} }
......
...@@ -155,17 +155,17 @@ const wchar_t * style_table_properties::name = L"table-properties"; ...@@ -155,17 +155,17 @@ const wchar_t * style_table_properties::name = L"table-properties";
void style_table_properties::add_attributes( const xml::attributes_wc_ptr & Attributes ) void style_table_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
table_format_properties_.add_attributes(Attributes); content_.add_attributes(Attributes);
} }
void style_table_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void style_table_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{ {
table_format_properties_.add_child_element(Reader, Ns, Name, getContext()); content_.add_child_element(Reader, Ns, Name, getContext());
} }
void style_table_properties::docx_convert(oox::docx_conversion_context & Context) void style_table_properties::docx_convert(oox::docx_conversion_context & Context)
{ {
table_format_properties_.docx_convert(Context); content_.docx_convert(Context);
} }
// style-table-column-properties-attlist // style-table-column-properties-attlist
...@@ -186,7 +186,7 @@ const wchar_t * style_table_column_properties::name = L"table-column-properties" ...@@ -186,7 +186,7 @@ const wchar_t * style_table_column_properties::name = L"table-column-properties"
void style_table_column_properties::add_attributes( const xml::attributes_wc_ptr & Attributes ) void style_table_column_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
style_table_column_properties_attlist_.add_attributes(Attributes); attlist_.add_attributes(Attributes);
} }
void style_table_column_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void style_table_column_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
...@@ -199,14 +199,14 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context & ...@@ -199,14 +199,14 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
std::wostream & strm = Context.output_stream(); std::wostream & strm = Context.output_stream();
if (style_table_column_properties_attlist_.style_column_width_) if (attlist_.style_column_width_)
{ {
double kf_max_width_ms =1.; double kf_max_width_ms =1.;
const page_layout_instance * pp = Context.root()->odf_context().pageLayoutContainer().page_layout_first();// const page_layout_instance * pp = Context.root()->odf_context().pageLayoutContainer().page_layout_first();//
if (pp) if (pp)
{ {
style_page_layout_properties_attlist & attr_page = pp->properties()->style_page_layout_properties_attlist_; style_page_layout_properties_attlist & attr_page = pp->properties()->attlist_;
if (attr_page.fo_page_width_) if (attr_page.fo_page_width_)
{ {
int val = 0.5 + 20.0 * attr_page.fo_page_width_->get_value_unit(length::pt); int val = 0.5 + 20.0 * attr_page.fo_page_width_->get_value_unit(length::pt);
...@@ -215,7 +215,7 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context & ...@@ -215,7 +215,7 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
} }
} }
int val = style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::pt); int val = attlist_.style_column_width_->get_value_unit(length::pt);
//_CP_OPT(int) iUnormalWidth; //_CP_OPT(int) iUnormalWidth;
...@@ -236,9 +236,9 @@ void style_table_column_properties::pptx_convert(oox::pptx_conversion_context & ...@@ -236,9 +236,9 @@ void style_table_column_properties::pptx_convert(oox::pptx_conversion_context &
std::wostream & strm = Context.get_table_context().tableData(); std::wostream & strm = Context.get_table_context().tableData();
if (style_table_column_properties_attlist_.style_column_width_) if (attlist_.style_column_width_)
{ {
int val = style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::emu); int val = attlist_.style_column_width_->get_value_unit(length::emu);
strm << L"<a:gridCol w=\"" << val << "\"/>"; strm << L"<a:gridCol w=\"" << val << "\"/>";
} }
...@@ -289,7 +289,7 @@ const wchar_t * style_table_cell_properties::name = L"table-cell-properties"; ...@@ -289,7 +289,7 @@ const wchar_t * style_table_cell_properties::name = L"table-cell-properties";
void style_table_cell_properties::add_attributes( const xml::attributes_wc_ptr & Attributes ) void style_table_cell_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
style_table_cell_properties_attlist_.add_attributes(Attributes); attlist_.add_attributes(Attributes);
} }
void style_table_cell_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void style_table_cell_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
...@@ -351,7 +351,7 @@ const wchar_t * style_table_row_properties::name = L"table-row-properties"; ...@@ -351,7 +351,7 @@ const wchar_t * style_table_row_properties::name = L"table-row-properties";
void style_table_row_properties::add_attributes( const xml::attributes_wc_ptr & Attributes ) void style_table_row_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
style_table_row_properties_attlist_.add_attributes(Attributes); attlist_.add_attributes(Attributes);
} }
void style_table_row_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void style_table_row_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
...@@ -368,7 +368,7 @@ void style_table_row_properties::add_child_element( xml::sax * Reader, const std ...@@ -368,7 +368,7 @@ void style_table_row_properties::add_child_element( xml::sax * Reader, const std
void style_table_row_properties::docx_convert(oox::docx_conversion_context & Context) void style_table_row_properties::docx_convert(oox::docx_conversion_context & Context)
{ {
style_table_row_properties_attlist_.docx_convert(Context); attlist_.docx_convert(Context);
} }
///// /////
...@@ -654,7 +654,7 @@ void style_table_cell_properties_attlist::pptx_serialize(oox::pptx_conversion_co ...@@ -654,7 +654,7 @@ void style_table_cell_properties_attlist::pptx_serialize(oox::pptx_conversion_co
void style_table_cell_properties::docx_convert(oox::docx_conversion_context & Context) void style_table_cell_properties::docx_convert(oox::docx_conversion_context & Context)
{ {
style_table_cell_properties_attlist_.docx_convert(Context); attlist_.docx_convert(Context);
} }
void style_table_cell_properties_attlist::apply_from(const style_table_cell_properties_attlist & Other) void style_table_cell_properties_attlist::apply_from(const style_table_cell_properties_attlist & Other)
......
...@@ -89,7 +89,6 @@ public: ...@@ -89,7 +89,6 @@ public:
}; };
/// style:table-properties
class style_table_properties : public office_element_impl<style_table_properties> class style_table_properties : public office_element_impl<style_table_properties>
{ {
public: public:
...@@ -101,19 +100,17 @@ public: ...@@ -101,19 +100,17 @@ public:
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ; virtual void docx_convert(oox::docx_conversion_context & Context) ;
table_format_properties & content() {return table_format_properties_;} table_format_properties & content() {return content_;}
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); 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_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
table_format_properties table_format_properties_; table_format_properties content_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(style_table_properties); CP_REGISTER_OFFICE_ELEMENT2(style_table_properties);
// style-table-column-properties-attlist
class style_table_column_properties_attlist class style_table_column_properties_attlist
{ {
public: public:
...@@ -126,7 +123,6 @@ public: ...@@ -126,7 +123,6 @@ public:
}; };
/// style:table-column-properties
class style_table_column_properties : public office_element_impl<style_table_column_properties> class style_table_column_properties : public office_element_impl<style_table_column_properties>
{ {
public: public:
...@@ -146,13 +142,12 @@ private: ...@@ -146,13 +142,12 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public: public:
style_table_column_properties_attlist style_table_column_properties_attlist_; style_table_column_properties_attlist attlist_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(style_table_column_properties); CP_REGISTER_OFFICE_ELEMENT2(style_table_column_properties);
// style-table-row-properties-attlist
class style_table_row_properties_attlist class style_table_row_properties_attlist
{ {
public: public:
...@@ -161,7 +156,6 @@ public: ...@@ -161,7 +156,6 @@ public:
void docx_convert(oox::docx_conversion_context & Context); void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context); void pptx_convert(oox::pptx_conversion_context & Context);
public:
_CP_OPT(odf_types::length) style_row_height_; _CP_OPT(odf_types::length) style_row_height_;
_CP_OPT(odf_types::length) style_min_row_height_; _CP_OPT(odf_types::length) style_min_row_height_;
_CP_OPT(bool) style_use_optimal_row_height_; _CP_OPT(bool) style_use_optimal_row_height_;
...@@ -171,7 +165,6 @@ public: ...@@ -171,7 +165,6 @@ public:
}; };
/// style:table-row-properties
class style_table_row_properties : public office_element_impl<style_table_row_properties> class style_table_row_properties : public office_element_impl<style_table_row_properties>
{ {
public: public:
...@@ -189,14 +182,13 @@ private: ...@@ -189,14 +182,13 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public: public:
style_table_row_properties_attlist style_table_row_properties_attlist_; style_table_row_properties_attlist attlist_;
office_element_ptr style_background_image_; office_element_ptr style_background_image_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(style_table_row_properties); CP_REGISTER_OFFICE_ELEMENT2(style_table_row_properties);
// style-table-cell-properties-attlist
class style_table_cell_properties_attlist class style_table_cell_properties_attlist
{ {
public: public:
...@@ -207,7 +199,6 @@ public: ...@@ -207,7 +199,6 @@ public:
void apply_from(const style_table_cell_properties_attlist & Other); void apply_from(const style_table_cell_properties_attlist & Other);
public:
odf_types::common_shadow_attlist common_shadow_attlist_; odf_types::common_shadow_attlist common_shadow_attlist_;
odf_types::common_background_color_attlist common_background_color_attlist_; odf_types::common_background_color_attlist common_background_color_attlist_;
odf_types::common_border_attlist common_border_attlist_; odf_types::common_border_attlist common_border_attlist_;
...@@ -227,26 +218,21 @@ public: ...@@ -227,26 +218,21 @@ public:
_CP_OPT(std::wstring) style_cell_protect_; _CP_OPT(std::wstring) style_cell_protect_;
_CP_OPT(bool) style_print_content_; _CP_OPT(bool) style_print_content_;
_CP_OPT(unsigned int) style_decimal_places_; _CP_OPT(unsigned int) style_decimal_places_;
_CP_OPT(bool) style_repeat_content_; _CP_OPT(bool) style_repeat_content_;
_CP_OPT(bool) style_shrink_to_fit_; _CP_OPT(bool) style_shrink_to_fit_;
_CP_OPT(odf_types::wrap_option) fo_wrap_option_; _CP_OPT(odf_types::wrap_option) fo_wrap_option_;
}; };
// style-table-cell-properties-elements
class style_table_cell_properties_elements class style_table_cell_properties_elements
{ {
public: public:
void add_attributes( const xml::attributes_wc_ptr & Attributes ); void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
// 15.11.6
office_element_ptr style_background_image_; office_element_ptr style_background_image_;
}; };
/// style:table-cell-properties
class style_table_cell_properties : public office_element_impl<style_table_cell_properties> class style_table_cell_properties : public office_element_impl<style_table_cell_properties>
{ {
public: public:
...@@ -264,8 +250,8 @@ private: ...@@ -264,8 +250,8 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public: public:
style_table_cell_properties_attlist style_table_cell_properties_attlist_; style_table_cell_properties_attlist attlist_;
office_element_ptr style_background_image_; office_element_ptr style_background_image_;
}; };
......
This diff is collapsed.
...@@ -442,7 +442,6 @@ public: ...@@ -442,7 +442,6 @@ public:
_CP_OPT(std::wstring) style_next_style_name_; _CP_OPT(std::wstring) style_next_style_name_;
}; };
// style:master-page
class style_master_page; class style_master_page;
typedef boost::shared_ptr<style_master_page> style_master_page_ptr; typedef boost::shared_ptr<style_master_page> style_master_page_ptr;
...@@ -465,7 +464,7 @@ private: ...@@ -465,7 +464,7 @@ private:
public: public:
int find_placeHolderIndex(odf_types::presentation_class::type placeHolder,int & last_idx); int find_placeHolderIndex(odf_types::presentation_class::type placeHolder,int & last_idx);
style_master_page_attlist style_master_page_attlist_; style_master_page_attlist attlist_;
office_element_ptr style_header_; office_element_ptr style_header_;
office_element_ptr style_header_left_; office_element_ptr style_header_left_;
...@@ -975,15 +974,17 @@ public: ...@@ -975,15 +974,17 @@ public:
static const ElementType type = typeStylePageLayout; static const ElementType type = typeStylePageLayout;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context); void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context); void pptx_convert (oox::pptx_conversion_context & Context);
void xlsx_convert (oox::xlsx_conversion_context & Context);
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id); bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
style_page_layout_properties() { } style_page_layout_properties() { }
style_page_layout_properties_attlist style_page_layout_properties_attlist_; style_page_layout_properties_attlist attlist_;
style_page_layout_properties_elements style_page_layout_properties_elements_; style_page_layout_properties_elements elements_;
private: private:
......
...@@ -81,7 +81,7 @@ void table_table_row::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -81,7 +81,7 @@ void table_table_row::pptx_convert(oox::pptx_conversion_context & Context)
if ((inst) && (inst->content()) && (inst->content()->get_style_table_row_properties())) if ((inst) && (inst->content()) && (inst->content()->get_style_table_row_properties()))
{ {
style_table_row_properties_attlist & row_attlist = inst->content()->get_style_table_row_properties()->style_table_row_properties_attlist_; style_table_row_properties_attlist & row_attlist = inst->content()->get_style_table_row_properties()->attlist_;
if (row_attlist.style_row_height_) if (row_attlist.style_row_height_)
{ {
height = (int)( 0.5 +row_attlist.style_row_height_->get_value_unit(length::emu) ); height = (int)( 0.5 +row_attlist.style_row_height_->get_value_unit(length::emu) );
......
...@@ -120,12 +120,12 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -120,12 +120,12 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
if ((rowStyle) && (rowStyle->content())) if ((rowStyle) && (rowStyle->content()))
{ {
const odf_reader::style_table_row_properties * prop = rowStyle->content()->get_style_table_row_properties(); const odf_reader::style_table_row_properties * prop = rowStyle->content()->get_style_table_row_properties();
if ((prop) && (prop->style_table_row_properties_attlist_.style_row_height_)) if ((prop) && (prop->attlist_.style_row_height_))
{ {
row_height = prop->style_table_row_properties_attlist_.style_row_height_->get_value_unit(odf_types::length::pt); row_height = prop->attlist_.style_row_height_->get_value_unit(odf_types::length::pt);
if ((prop->style_table_row_properties_attlist_.style_use_optimal_row_height_) && if ((prop->attlist_.style_use_optimal_row_height_) &&
(*prop->style_table_row_properties_attlist_.style_use_optimal_row_height_==true)) (*prop->attlist_.style_use_optimal_row_height_==true))
{ {
//автоматическая подстройка высоты. //автоматическая подстройка высоты.
//нету в оох //нету в оох
...@@ -478,11 +478,11 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -478,11 +478,11 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
if (const style_table_column_properties * prop = inst->content()->get_style_table_column_properties()) if (const style_table_column_properties * prop = inst->content()->get_style_table_column_properties())
{ {
if (prop->style_table_column_properties_attlist_.style_column_width_) if (prop->attlist_.style_column_width_)
{ {
pt_width = prop->style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::pt); pt_width = prop->attlist_.style_column_width_->get_value_unit(length::pt);
cm_width = prop->style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::cm); cm_width = prop->attlist_.style_column_width_->get_value_unit(length::cm);
in_width = prop->style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::inch); in_width = prop->attlist_.style_column_width_->get_value_unit(length::inch);
if (collapsed) if (collapsed)
{ {
...@@ -492,7 +492,7 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -492,7 +492,7 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
const double pixDpi = in_width * 96.; const double pixDpi = in_width * 96.;
width = pixToSize(pixDpi, Context.getMaxDigitSize().first); width = pixToSize(pixDpi, Context.getMaxDigitSize().first);
//const double width = cmToChars(prop->style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::cm)); //const double width = cmToChars(prop->attlist_.style_column_width_->get_value_unit(length::cm));
// see ECMA-376 page 1768 // see ECMA-376 page 1768
if (in_width > 0) if (in_width > 0)
......
...@@ -3037,8 +3037,8 @@ void odf_drawing_context::start_bitmap_style() ...@@ -3037,8 +3037,8 @@ void odf_drawing_context::start_bitmap_style()
odf_writer::office_element_ptr fill_image_element; odf_writer::office_element_ptr fill_image_element;
odf_writer::create_element(L"draw",L"fill-image", fill_image_element, impl_->odf_context_); odf_writer::create_element(L"draw", L"fill-image", fill_image_element, impl_->odf_context_);
impl_->styles_context_->add_style(fill_image_element,false,true, style_family::FillImage); impl_->styles_context_->add_style(fill_image_element, false, true, style_family::FillImage);
draw_fill_image * fill_image = dynamic_cast<draw_fill_image *>(fill_image_element.get()); draw_fill_image * fill_image = dynamic_cast<draw_fill_image *>(fill_image_element.get());
if (!fill_image) return; if (!fill_image) return;
......
...@@ -126,12 +126,12 @@ void style_background_image::serialize(std::wostream & strm) ...@@ -126,12 +126,12 @@ void style_background_image::serialize(std::wostream & strm)
{ {
CP_XML_NODE_SIMPLE() CP_XML_NODE_SIMPLE()
{ {
CP_XML_ATTR_OPT(L"style:repeat", style_repeat_); CP_XML_ATTR_OPT(L"style:repeat", style_repeat_);
CP_XML_ATTR_OPT(L"style:position", style_position_); CP_XML_ATTR_OPT(L"style:position", style_position_);
CP_XML_ATTR_OPT(L"filter:name", filter_name_); CP_XML_ATTR_OPT(L"filter:name", filter_name_);
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_); CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
if (common_xlink_attlist_) common_xlink_attlist_->serialize(CP_GET_XML_NODE()); if (xlink_attlist_) xlink_attlist_->serialize(CP_GET_XML_NODE());
if (office_binary_data_) office_binary_data_->serialize(CP_XML_STREAM()); if (office_binary_data_) office_binary_data_->serialize(CP_XML_STREAM());
} }
} }
......
...@@ -169,13 +169,14 @@ public: ...@@ -169,13 +169,14 @@ public:
virtual void serialize(std::wostream & strm); virtual void serialize(std::wostream & strm);
_CP_OPT(odf_types::style_repeat) style_repeat_; _CP_OPT(odf_types::style_repeat) style_repeat_;
_CP_OPT(odf_types::style_position) style_position_; _CP_OPT(odf_types::style_position) style_position_;
_CP_OPT(std::wstring) filter_name_; _CP_OPT(std::wstring) filter_name_;
_CP_OPT(odf_types::percent) draw_opacity_; _CP_OPT(odf_types::percent) draw_opacity_;
_CP_OPT(odf_types::common_xlink_attlist) common_xlink_attlist_; _CP_OPT(odf_types::common_xlink_attlist) xlink_attlist_;
office_element_ptr office_binary_data_;
office_element_ptr office_binary_data_;
}; };
......
...@@ -1164,13 +1164,13 @@ void style_page_layout::serialize(std::wostream & strm) ...@@ -1164,13 +1164,13 @@ void style_page_layout::serialize(std::wostream & strm)
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
void style_footnote_sep_attlist::serialize(CP_ATTR_NODE) void style_footnote_sep_attlist::serialize(CP_ATTR_NODE)
{ {
CP_XML_ATTR_OPT(L"style:width", style_width_); CP_XML_ATTR_OPT(L"style:width", style_width_);
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_); CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
CP_XML_ATTR_OPT(L"style:color", style_color_); CP_XML_ATTR_OPT(L"style:color", style_color_);
CP_XML_ATTR_OPT(L"style:line-style", style_line_style_); CP_XML_ATTR_OPT(L"style:line-style", style_line_style_);
CP_XML_ATTR_OPT(L"style:type", style_adjustment_); // default Left CP_XML_ATTR_OPT(L"style:type", style_adjustment_); // default Left
CP_XML_ATTR_OPT(L"style:distance-before-sep", style_distance_before_sep_); CP_XML_ATTR_OPT(L"style:distance-before-sep", style_distance_before_sep_);
CP_XML_ATTR_OPT(L"style:distance-after-sep", style_distance_after_sep_); CP_XML_ATTR_OPT(L"style:distance-after-sep", style_distance_after_sep_);
} }
const wchar_t * style_footnote_sep::ns = L"style"; const wchar_t * style_footnote_sep::ns = L"style";
......
...@@ -30,9 +30,7 @@ ...@@ -30,9 +30,7 @@
* *
*/ */
#include "XlsxConverter.h" #include "XlsxConverter.h"
#include "../utils.h" #include "../../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
#include <boost/foreach.hpp>
#include "../OdfFormat/ods_conversion_context.h" #include "../OdfFormat/ods_conversion_context.h"
...@@ -45,8 +43,9 @@ ...@@ -45,8 +43,9 @@
#include "../OdfFormat/style_text_properties.h" #include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_properties.h" #include "../OdfFormat/style_paragraph_properties.h"
#include "../OdfFormat/style_graphic_properties.h" #include "../OdfFormat/style_graphic_properties.h"
#include "../OdfFormat/style_page_layout_properties.h"
#include "../../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h" #include "../utils.h"
using namespace cpdoccore; using namespace cpdoccore;
...@@ -241,10 +240,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet) ...@@ -241,10 +240,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
{ {
if (!oox_sheet) return; if (!oox_sheet) return;
OOX::IFileContainer* old_container = xlsx_current_container;
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_sheet);
if (oox_sheet->m_oDimension.IsInit()) if (oox_sheet->m_oDimension.IsInit())
{ {
ods_context->set_sheet_dimension(oox_sheet->m_oDimension->m_oRef.get()); ods_context->set_sheet_dimension(oox_sheet->m_oDimension->m_oRef.get());
} }
convert(oox_sheet->m_oSheetFormatPr.GetPointer()); convert(oox_sheet->m_oSheetFormatPr.GetPointer());
convert(oox_sheet->m_oSheetPr.GetPointer()); convert(oox_sheet->m_oSheetPr.GetPointer());
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -346,8 +349,37 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet) ...@@ -346,8 +349,37 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(oox_sheet->m_oSheetViews.GetPointer()); convert(oox_sheet->m_oSheetViews.GetPointer());
convert(oox_sheet->m_oPageSetup.GetPointer()); convert(oox_sheet->m_oPageSetup.GetPointer());
convert(oox_sheet->m_oPageMargins.GetPointer()); convert(oox_sheet->m_oPageMargins.GetPointer());
convert(oox_sheet->m_oPicture.GetPointer());
xlsx_current_container = old_container;
} }
void XlsxConverter::convert(OOX::Spreadsheet::CPictureWorksheet *oox_background)
{
if (!oox_background) return;
if (!oox_background->m_oId.IsInit())return;
std::wstring sID, pathImage, href;
sID = oox_background->m_oId->GetValue();
pathImage = find_link_by_id(sID, 1);
href = ods_context->add_image(pathImage);
if (href.empty()) return;
odf_writer::office_element_ptr fill_image_element;
odf_writer::create_element(L"style", L"background-image", fill_image_element, ods_context);
odf_writer::style_background_image * fill_image = dynamic_cast<odf_writer::style_background_image*>(fill_image_element.get());
if (!fill_image) return;
fill_image->xlink_attlist_ = odf_types::common_xlink_attlist();
fill_image->xlink_attlist_->type_ = odf_types::xlink_type::Simple;
fill_image->xlink_attlist_->actuate_ = odf_types::xlink_actuate::OnLoad;
fill_image->xlink_attlist_->href_ = href;
odf_writer::style_page_layout_properties* page_props = ods_context->page_layout_context()->last_layout()->get_properties();
page_props->add_child_element(fill_image_element);
}
void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part) void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part)
{ {
if (!oox_table_part) return; if (!oox_table_part) return;
...@@ -1012,7 +1044,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views) ...@@ -1012,7 +1044,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
//nullable<SimpleTypes::COnOff<>> m_oDefaultGridColor; //nullable<SimpleTypes::COnOff<>> m_oDefaultGridColor;
//nullable<SimpleTypes::COnOff<>> m_oShowRuler; //nullable<SimpleTypes::COnOff<>> m_oShowRuler;
//nullable<SimpleTypes::COnOff<>> m_oShowWhiteSpace; //nullable<SimpleTypes::COnOff<>> m_oShowWhiteSpace;
//nullable<std::wstring> m_oTopLeftCell; //nullable<std::wstring> m_oTopLeftCell;
//nullable<SimpleTypes::Spreadsheet::CSheetViewType<>> m_oView; //nullable<SimpleTypes::Spreadsheet::CSheetViewType<>> m_oView;
//nullable<SimpleTypes::COnOff<>> m_oWindowProtection; //nullable<SimpleTypes::COnOff<>> m_oWindowProtection;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScaleNormal; //nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScaleNormal;
...@@ -1026,6 +1058,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPageSetup *oox_page) ...@@ -1026,6 +1058,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPageSetup *oox_page)
if (!oox_page) return; if (!oox_page) return;
int type = 1; int type = 1;
if (oox_page->m_oOrientation.IsInit())
{
type = (int)oox_page->m_oOrientation->GetValue();
}
ods_context->page_layout_context()->set_page_orientation(type); ods_context->page_layout_context()->set_page_orientation(type);
} }
...@@ -1736,6 +1772,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing) ...@@ -1736,6 +1772,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
{ {
if (!oox_drawing)return; if (!oox_drawing)return;
OOX::IFileContainer* old_container = xlsx_current_container;
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_drawing); xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_drawing);
for (unsigned int dr = 0 ; dr < oox_drawing->m_arrItems.size(); dr++) for (unsigned int dr = 0 ; dr < oox_drawing->m_arrItems.size(); dr++)
...@@ -1745,7 +1782,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing) ...@@ -1745,7 +1782,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
ods_context->end_drawings(); ods_context->end_drawings();
} }
xlsx_current_container = NULL; xlsx_current_container = old_container;
} }
......
...@@ -88,6 +88,7 @@ namespace OOX ...@@ -88,6 +88,7 @@ namespace OOX
class CPageMargins; class CPageMargins;
class CSi; class CSi;
class CWorkbookView; class CWorkbookView;
class CPictureWorksheet;
} }
} }
...@@ -151,6 +152,7 @@ namespace Oox2Odf ...@@ -151,6 +152,7 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CWorksheet *oox_sheet); void convert(OOX::Spreadsheet::CWorksheet *oox_sheet);
void convert(OOX::Spreadsheet::CDefinedName *oox_defined); void convert(OOX::Spreadsheet::CDefinedName *oox_defined);
void convert(OOX::Spreadsheet::CTable *oox_table_part); void convert(OOX::Spreadsheet::CTable *oox_table_part);
void convert(OOX::Spreadsheet::CPictureWorksheet *oox_background);
void convert(OOX::Spreadsheet::CCol *oox_column); void convert(OOX::Spreadsheet::CCol *oox_column);
void convert(OOX::Spreadsheet::CRow *oox_row); void convert(OOX::Spreadsheet::CRow *oox_row);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment