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()
// проходим по всем page layout
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);
add_page_properties(masterPageNameLayout);
......
......@@ -272,9 +272,9 @@ void pptx_conversion_context::end_document()
odf_reader::odf_read_context & context = root()->odf_context();
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);
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
......
......@@ -55,6 +55,7 @@ public:
std::wstringstream autofilter_;
std::wstringstream conditionalFormatting_;
std::wstringstream ole_objects_;
std::wstringstream page_props_;
rels hyperlinks_rels_;
rels ole_objects_rels_;
......@@ -134,6 +135,11 @@ std::wostream & xlsx_xml_worksheet::ole_objects()
{
return impl_->ole_objects_;
}
std::wostream & xlsx_xml_worksheet::page_properties()
{
return impl_->page_props_;
}
//---------------------------------------------------------------------------------------
rels & xlsx_xml_worksheet::hyperlinks_rels()
{
......@@ -196,9 +202,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
{
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"rowBreaks){}
......
......@@ -63,6 +63,7 @@ public:
std::wostream & conditionalFormatting();
std::wostream & sort();
std::wostream & ole_objects();
std::wostream & page_properties();
rels & hyperlinks_rels();
rels & ole_objects_rels();
......
......@@ -341,11 +341,26 @@ double charsToSize(unsigned int charsCount, double maxDigitSize)
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();
CP_XML_WRITER(_Wostream)
CP_XML_WRITER(strm)
{
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);
......@@ -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();
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;
ht_s.precision(1);
......@@ -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)
{
......
......@@ -128,7 +128,8 @@ public:
void serialize_merge_cells (std::wostream & _Wostream);
void serialize_hyperlinks (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_ole_objects (rels & Rels);
......
......@@ -317,6 +317,10 @@ void xlsx_table_context::serialize_table_format(std::wostream & _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)
{
return state()->serialize_hyperlinks(_Wostream);
......
......@@ -90,6 +90,7 @@ public:
void serialize_conditionalFormatting(std::wostream & _Wostream);
void serialize_hyperlinks (std::wostream & _Wostream);
void serialize_ole_objects (std::wostream & _Wostream);
void serialize_page_properties (std::wostream & _Wostream);
xlsx_table_metrics & get_table_metrics();
......
......@@ -369,6 +369,7 @@ void xlsx_conversion_context::end_table()
current_sheet().cols() << L"</cols>";
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_autofilter (current_sheet().autofilter());
get_table_context().serialize_sort (current_sheet().sort());
......@@ -420,7 +421,7 @@ void xlsx_conversion_context::end_table()
current_sheet().set_comments_link(commentsName.first, commentsName.second);
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
}
//background picture
get_table_context().end_table();
}
......
......@@ -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)
{
if (v)
result.apply_from(v->style_table_cell_properties_attlist_);
result.apply_from(v->attlist_);
}
return result;
}
......
......@@ -153,7 +153,7 @@ length ComputeContextWidth(const style_page_layout_properties * pageProperties
if (pagePropertiesNode)
{
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);
if (!columnsCount)
......@@ -784,7 +784,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
style_page_layout_properties_attlist emptyPageProperties;
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()
continue;
}
const std::wstring styleName = masterPage->style_master_page_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 styleName = masterPage->attlist_.style_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);
}
......
......@@ -40,23 +40,24 @@ namespace cpdoccore {
namespace odf_reader {
style_instance::style_instance(
styles_container *Container,
const std::wstring &Name,
style_family::type Type,
style_content *Content,
bool IsAutomatic,
bool IsDefault,
const std::wstring & ParentStyleName,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName
) : container_(Container),
name_(Name),
style_type_(Type),
content_(Content),
is_automatic_(IsAutomatic),
is_default_(IsDefault),
next_name_(NextStyleName),
next_(Container->style_by_name(NextStyleName, style_type_,false)),
styles_container *Container,
const std::wstring &Name,
style_family::type Type,
style_content *Content,
bool IsAutomatic,
bool IsDefault,
const std::wstring & ParentStyleName,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName
) :
container_ (Container),
name_ (Name),
style_type_ (Type),
content_ (Content),
is_automatic_ (IsAutomatic),
is_default_ (IsDefault),
next_name_ (NextStyleName),
next_ (Container->style_by_name(NextStyleName, style_type_, false)),
data_style_name_(DataStyleName)
{
parent_name_ = ParentStyleName;
......@@ -64,8 +65,7 @@ style_instance::style_instance(
{
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()
......@@ -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());
}
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)
{
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
_CP_OPT(length) bottom = attr.fo_min_height_ ? attr.fo_min_height_ : attr.svg_height_;
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)
{
......
......@@ -193,8 +193,9 @@ public:
const std::wstring & name() const;
style_page_layout_properties * properties() const;
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
void docx_convert_serialize (std::wostream & strm, oox::docx_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_;
......
......@@ -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();
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();
......@@ -116,15 +116,15 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
//background (for all pages)
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;
Compute_GraphicFill(prop->style_page_layout_properties_attlist_.common_draw_fill_attlist_,
prop->style_page_layout_properties_elements_.style_background_image_,
Compute_GraphicFill(layout_properties->attlist_.common_draw_fill_attlist_,
layout_properties->elements_.style_background_image_,
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()))
{
......@@ -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);
}
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));
}
......
......@@ -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 )
{
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)
{
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)
{
table_format_properties_.docx_convert(Context);
content_.docx_convert(Context);
}
// style-table-column-properties-attlist
......@@ -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 )
{
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)
......@@ -199,14 +199,14 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
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.;
const page_layout_instance * pp = Context.root()->odf_context().pageLayoutContainer().page_layout_first();//
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_)
{
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 &
}
}
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;
......@@ -236,9 +236,9 @@ void style_table_column_properties::pptx_convert(oox::pptx_conversion_context &
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 << "\"/>";
}
......@@ -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 )
{
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)
......@@ -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 )
{
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)
......@@ -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)
{
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
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)
......
......@@ -89,7 +89,6 @@ public:
};
/// style:table-properties
class style_table_properties : public office_element_impl<style_table_properties>
{
public:
......@@ -101,19 +100,17 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
table_format_properties & content() {return table_format_properties_;}
table_format_properties & content() {return 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);
table_format_properties table_format_properties_;
table_format_properties content_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_table_properties);
// style-table-column-properties-attlist
class style_table_column_properties_attlist
{
public:
......@@ -126,7 +123,6 @@ public:
};
/// style:table-column-properties
class style_table_column_properties : public office_element_impl<style_table_column_properties>
{
public:
......@@ -146,13 +142,12 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
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);
// style-table-row-properties-attlist
class style_table_row_properties_attlist
{
public:
......@@ -161,7 +156,6 @@ public:
void docx_convert(oox::docx_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_min_row_height_;
_CP_OPT(bool) style_use_optimal_row_height_;
......@@ -171,7 +165,6 @@ public:
};
/// style:table-row-properties
class style_table_row_properties : public office_element_impl<style_table_row_properties>
{
public:
......@@ -189,14 +182,13 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
style_table_row_properties_attlist style_table_row_properties_attlist_;
style_table_row_properties_attlist attlist_;
office_element_ptr style_background_image_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_table_row_properties);
// style-table-cell-properties-attlist
class style_table_cell_properties_attlist
{
public:
......@@ -207,7 +199,6 @@ public:
void apply_from(const style_table_cell_properties_attlist & Other);
public:
odf_types::common_shadow_attlist common_shadow_attlist_;
odf_types::common_background_color_attlist common_background_color_attlist_;
odf_types::common_border_attlist common_border_attlist_;
......@@ -227,26 +218,21 @@ public:
_CP_OPT(std::wstring) style_cell_protect_;
_CP_OPT(bool) style_print_content_;
_CP_OPT(unsigned int) style_decimal_places_;
_CP_OPT(bool) style_repeat_content_;
_CP_OPT(bool) style_shrink_to_fit_;
_CP_OPT(bool) style_repeat_content_;
_CP_OPT(bool) style_shrink_to_fit_;
_CP_OPT(odf_types::wrap_option) fo_wrap_option_;
};
// style-table-cell-properties-elements
class style_table_cell_properties_elements
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
// 15.11.6
office_element_ptr style_background_image_;
};
/// style:table-cell-properties
class style_table_cell_properties : public office_element_impl<style_table_cell_properties>
{
public:
......@@ -264,8 +250,8 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
style_table_cell_properties_attlist style_table_cell_properties_attlist_;
office_element_ptr style_background_image_;
style_table_cell_properties_attlist attlist_;
office_element_ptr style_background_image_;
};
......
......@@ -722,7 +722,6 @@ void style_footer_left::add_child_element( xml::sax * Reader, const std::wstring
content().header_footer_content_.add_child_element(Reader, Ns, Name, getContext());
}
/// style:columns
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_columns::ns = L"style";
const wchar_t * style_columns::name = L"columns";
......@@ -745,7 +744,6 @@ void style_columns::add_child_element( xml::sax * Reader, const std::wstring & N
}
}
/// style:column
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_column::ns = L"style";
const wchar_t * style_column::name = L"column";
......@@ -765,7 +763,6 @@ void style_column::add_child_element( xml::sax * Reader, const std::wstring & Ns
CP_NOT_APPLICABLE_ELM();
}
/// style:column-sep
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_column_sep::ns = L"style";
const wchar_t * style_column_sep::name = L":column-sep";
......@@ -784,8 +781,6 @@ void style_column_sep::add_child_element( xml::sax * Reader, const std::wstring
CP_NOT_APPLICABLE_ELM();
}
/// style:section-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_section_properties::ns = L"style";
const wchar_t * style_section_properties::name = L"section-properties";
......@@ -811,7 +806,6 @@ void style_section_properties::add_child_element( xml::sax * Reader, const std::
}
}
/// style:header-style
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_header_style::ns = L"style";
const wchar_t * style_header_style::name = L"header-style";
......@@ -837,7 +831,6 @@ void style_header_style::add_child_element( xml::sax * Reader, const std::wstrin
}
}
/// style:footer-style
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_footer_style::ns = L"style";
const wchar_t * style_footer_style::name = L"footer-style";
......@@ -863,15 +856,12 @@ void style_footer_style::add_child_element( xml::sax * Reader, const std::wstrin
}
}
/// style-page-layout-attlist
void style_page_layout_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:name", style_name_, std::wstring(L""));
CP_APPLY_ATTR(L"style:page-usage", style_page_usage_, page_usage(page_usage::All));
}
/// style:page-layout
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_page_layout::ns = L"style";
const wchar_t * style_page_layout::name = L"page-layout";
......@@ -906,7 +896,6 @@ void style_page_layout::add_child_element( xml::sax * Reader, const std::wstring
}
}
// style-page-layout-properties-attlist
void style_page_layout_properties_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"fo:page-width", fo_page_width_);
......@@ -947,34 +936,6 @@ void style_page_layout_properties_attlist::add_attributes( const xml::attributes
CP_APPLY_ATTR(L"style:layout-grid-display", style_layout_grid_display_);
}
/*
Choice [0..6]
[ ] w:headerReference Header Reference
[ ] w:footerReference Footer Reference
[ ] from group w:EG_SectPrContents
[ ] Sequence
[ ] w:footnotePr Section-Wide Footnote Properties
[ ] w:endnotePr Section-Wide Endnote Properties
[ ] w:type Section Type
[x] w:pgSz Page Size
[ ] w:pgMar Page Margins
[ ] w:paperSrc Paper Source Information
[ ] w:pgBorders Page Borders
[ ] w:lnNumType Line Numbering Settings
[ ] w:pgNumType Page Numbering Settings
[ ] w:cols Column Definitions
[ ] w:formProt Only Allow Editing of Form Fields
[ ] w:vAlign Vertical Text Alignment on Page
[ ] w:noEndnote Suppress Endnotes In Document
[ ] w:titlePg Different First Page Headers and Footers
[ ] w:textDirection Text Flow Direction
[ ] w:bidi Right to Left Section Layout
[ ] w:rtlGutter Gutter on Right Side of Page
[ ] w:docGrid Document Grid
[ ] w:printerSettings Reference to Printer Settings Data
[ ] w:sectPrChange Revision Information for Section Properties
*/
namespace {
std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val,
......@@ -1012,7 +973,7 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
//Context.set_settings_property(odf_reader::_property(L"UnormalWidthPage",val));
val =31680;//22"
}
w_w = boost::lexical_cast<std::wstring>(val);
w_w = std::to_wstring(val);
}
if (fo_page_height_)
{
......@@ -1259,18 +1220,18 @@ const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
void style_page_layout_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
style_page_layout_properties_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void style_page_layout_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
style_page_layout_properties_elements_.add_child_element(Reader, Ns, Name, getContext());
elements_.add_child_element(Reader, Ns, Name, getContext());
}
bool style_page_layout_properties::docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id)
{
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ &&
style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent)
if (attlist_.common_background_color_attlist_.fo_background_color_ &&
attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent)
return true; //??
//прозрачный фон
......@@ -1280,8 +1241,8 @@ bool style_page_layout_properties::docx_background_serialize(std::wostream & str
{
std::wstring color = L"ffffff";
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_)
color = style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
if (attlist_.common_background_color_attlist_.fo_background_color_)
color = attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
CP_XML_ATTR(L"w:color", color);
......@@ -1290,9 +1251,42 @@ 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)
{
if (elements_.style_background_image_)
{
oox::_oox_fill fill;
Compute_GraphicFill(attlist_.common_draw_fill_attlist_, elements_.style_background_image_, Context.root()->odf_context().drawStyles(), fill);
if (fill.bitmap)
{
if ( fill.bitmap->rId.empty())
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
}
CP_XML_NODE(L"picture")
{
CP_XML_ATTR(L"r:id", fill.bitmap->rId );
}
}
}
}
}
void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
{
style_columns * columns = dynamic_cast<style_columns *>( style_page_layout_properties_elements_.style_columns_.get());
style_columns * columns = dynamic_cast<style_columns *>( elements_.style_columns_.get());
CP_XML_WRITER(strm)
{
......@@ -1325,14 +1319,14 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
oox::section_context::_section & section = Context.get_section_context().get();
style_page_layout_properties_attlist_.docx_convert_serialize(strm, Context, section.margin_left_, section.margin_right_);
attlist_.docx_convert_serialize(strm, Context, section.margin_left_, section.margin_right_);
//todooo при появлении еще накладок - переписать !!
}
}
}
void style_page_layout_properties::pptx_convert(oox::pptx_conversion_context & Context)
{
style_page_layout_properties_attlist_.pptx_convert(Context);
attlist_.pptx_convert(Context);
}
......@@ -1363,10 +1357,10 @@ void style_page_layout_properties_elements::add_child_element( xml::sax * Reader
//////////////////////////////////////////////////////////////////////////////////////////////////
void style_master_page_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:name", style_name_);
CP_APPLY_ATTR(L"style:display-name", style_display_name_);
CP_APPLY_ATTR(L"style:page-layout-name", style_page_layout_name_);
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_);
CP_APPLY_ATTR(L"style:name", style_name_);
CP_APPLY_ATTR(L"style:display-name", style_display_name_);
CP_APPLY_ATTR(L"style:page-layout-name",style_page_layout_name_);
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_);
CP_APPLY_ATTR(L"style:next-style-name", style_next_style_name_);
}
......@@ -1382,7 +1376,7 @@ std::wostream & style_master_page::text_to_stream(std::wostream & _Wostream) con
void style_master_page::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
style_master_page_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void style_master_page::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
......@@ -1457,9 +1451,9 @@ int style_master_page::find_placeHolderIndex(presentation_class::type placeHolde
void style_master_page::pptx_convert(oox::pptx_conversion_context & Context)
{
if (style_master_page_attlist_.draw_style_name_)
if (attlist_.draw_style_name_)
{
std::wstring style_name = style_master_page_attlist_.draw_style_name_.get();
std::wstring style_name = attlist_.draw_style_name_.get();
style_instance * style_inst = Context.root()->odf_context().styleContainer().style_by_name(style_name,style_family::DrawingPage,true);
if ((style_inst) && (style_inst->content()))
......
......@@ -442,7 +442,6 @@ public:
_CP_OPT(std::wstring) style_next_style_name_;
};
// style:master-page
class style_master_page;
typedef boost::shared_ptr<style_master_page> style_master_page_ptr;
......@@ -465,7 +464,7 @@ private:
public:
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_left_;
......@@ -975,15 +974,17 @@ public:
static const ElementType type = typeStylePageLayout;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_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_convert (oox::xlsx_conversion_context & Context);
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_attlist style_page_layout_properties_attlist_;
style_page_layout_properties_elements style_page_layout_properties_elements_;
style_page_layout_properties_attlist attlist_;
style_page_layout_properties_elements elements_;
private:
......
......@@ -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()))
{
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_)
{
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)
if ((rowStyle) && (rowStyle->content()))
{
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_) &&
(*prop->style_table_row_properties_attlist_.style_use_optimal_row_height_==true))
if ((prop->attlist_.style_use_optimal_row_height_) &&
(*prop->attlist_.style_use_optimal_row_height_==true))
{
//автоматическая подстройка высоты.
//нету в оох
......@@ -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 (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);
cm_width = prop->style_table_column_properties_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);
pt_width = prop->attlist_.style_column_width_->get_value_unit(length::pt);
cm_width = prop->attlist_.style_column_width_->get_value_unit(length::cm);
in_width = prop->attlist_.style_column_width_->get_value_unit(length::inch);
if (collapsed)
{
......@@ -492,7 +492,7 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
const double pixDpi = in_width * 96.;
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
if (in_width > 0)
......
......@@ -3037,8 +3037,8 @@ void odf_drawing_context::start_bitmap_style()
odf_writer::office_element_ptr fill_image_element;
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);
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);
draw_fill_image * fill_image = dynamic_cast<draw_fill_image *>(fill_image_element.get());
if (!fill_image) return;
......
......@@ -126,12 +126,12 @@ void style_background_image::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:repeat", style_repeat_);
CP_XML_ATTR_OPT(L"style:position", style_position_);
CP_XML_ATTR_OPT(L"filter:name", filter_name_);
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
CP_XML_ATTR_OPT(L"style:repeat", style_repeat_);
CP_XML_ATTR_OPT(L"style:position", style_position_);
CP_XML_ATTR_OPT(L"filter:name", filter_name_);
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());
}
}
......
......@@ -169,13 +169,14 @@ public:
virtual void serialize(std::wostream & strm);
_CP_OPT(odf_types::style_repeat) style_repeat_;
_CP_OPT(odf_types::style_position) style_position_;
_CP_OPT(std::wstring) filter_name_;
_CP_OPT(odf_types::percent) draw_opacity_;
_CP_OPT(odf_types::style_repeat) style_repeat_;
_CP_OPT(odf_types::style_position) style_position_;
_CP_OPT(std::wstring) filter_name_;
_CP_OPT(odf_types::percent) draw_opacity_;
_CP_OPT(odf_types::common_xlink_attlist) common_xlink_attlist_;
office_element_ptr office_binary_data_;
_CP_OPT(odf_types::common_xlink_attlist) xlink_attlist_;
office_element_ptr office_binary_data_;
};
......
......@@ -1164,13 +1164,13 @@ void style_page_layout::serialize(std::wostream & strm)
//////////////////////////////////////////////////////////////////////////////////////////////////
void style_footnote_sep_attlist::serialize(CP_ATTR_NODE)
{
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:color", style_color_);
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: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:width", style_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:line-style", style_line_style_);
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-after-sep", style_distance_after_sep_);
}
const wchar_t * style_footnote_sep::ns = L"style";
......
......@@ -30,9 +30,7 @@
*
*/
#include "XlsxConverter.h"
#include "../utils.h"
#include <boost/foreach.hpp>
#include "../../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
#include "../OdfFormat/ods_conversion_context.h"
......@@ -45,8 +43,9 @@
#include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_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;
......@@ -241,10 +240,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
{
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())
{
ods_context->set_sheet_dimension(oox_sheet->m_oDimension->m_oRef.get());
}
convert(oox_sheet->m_oSheetFormatPr.GetPointer());
convert(oox_sheet->m_oSheetPr.GetPointer());
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -346,8 +349,37 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
convert(oox_sheet->m_oSheetViews.GetPointer());
convert(oox_sheet->m_oPageSetup.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)
{
if (!oox_table_part) return;
......@@ -1012,7 +1044,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
//nullable<SimpleTypes::COnOff<>> m_oDefaultGridColor;
//nullable<SimpleTypes::COnOff<>> m_oShowRuler;
//nullable<SimpleTypes::COnOff<>> m_oShowWhiteSpace;
//nullable<std::wstring> m_oTopLeftCell;
//nullable<std::wstring> m_oTopLeftCell;
//nullable<SimpleTypes::Spreadsheet::CSheetViewType<>> m_oView;
//nullable<SimpleTypes::COnOff<>> m_oWindowProtection;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScaleNormal;
......@@ -1026,6 +1058,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPageSetup *oox_page)
if (!oox_page) return;
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);
}
......@@ -1736,6 +1772,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
{
if (!oox_drawing)return;
OOX::IFileContainer* old_container = xlsx_current_container;
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_drawing);
for (unsigned int dr = 0 ; dr < oox_drawing->m_arrItems.size(); dr++)
......@@ -1745,7 +1782,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
ods_context->end_drawings();
}
xlsx_current_container = NULL;
xlsx_current_container = old_container;
}
......
......@@ -88,6 +88,7 @@ namespace OOX
class CPageMargins;
class CSi;
class CWorkbookView;
class CPictureWorksheet;
}
}
......@@ -151,6 +152,7 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CWorksheet *oox_sheet);
void convert(OOX::Spreadsheet::CDefinedName *oox_defined);
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::CRow *oox_row);
......
......@@ -87,17 +87,14 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("left"), m_oLeft)
WritingElement_ReadAttributes_Read_if ( oReader, _T("top"), m_oTop)
WritingElement_ReadAttributes_Read_if ( oReader, _T("right"), m_oRight)
WritingElement_ReadAttributes_Read_if ( oReader, _T("bottom"), m_oBottom)
WritingElement_ReadAttributes_Read_if ( oReader, _T("header"), m_oHeader)
WritingElement_ReadAttributes_Read_if ( oReader, _T("footer"), m_oFooter)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("left"), m_oLeft)
WritingElement_ReadAttributes_Read_if ( oReader, _T("top"), m_oTop)
WritingElement_ReadAttributes_Read_if ( oReader, _T("right"), m_oRight)
WritingElement_ReadAttributes_Read_if ( oReader, _T("bottom"), m_oBottom)
WritingElement_ReadAttributes_Read_if ( oReader, _T("header"), m_oHeader)
WritingElement_ReadAttributes_Read_if ( oReader, _T("footer"), m_oFooter)
WritingElement_ReadAttributes_End( oReader )
}
public:
......@@ -121,7 +118,7 @@ namespace OOX
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
return _T("");
}
......@@ -138,10 +135,14 @@ namespace OOX
writer.WriteString(sOrientation.c_str());
writer.WriteString(L"\"");
}
if (m_oRId.IsInit())
{
WritingStringAttrString(L"r:id", m_oRId->ToString());
}
writer.WriteString(L"/>");
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
......@@ -153,22 +154,16 @@ namespace OOX
{
return et_x_PageSetup;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("orientation"), m_oOrientation)
WritingElement_ReadAttributes_Read_if ( oReader, _T("paperSize"), m_oPaperSize)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("orientation"), m_oOrientation)
WritingElement_ReadAttributes_Read_if ( oReader, _T("paperSize"), m_oPaperSize)
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oRId)
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CPageOrientation<>> m_oOrientation;
nullable<SimpleTypes::CRelationshipId> m_oRId;
nullable<SimpleTypes::CPageOrientation<>> m_oOrientation;
nullable<SimpleTypes::Spreadsheet::CPageSize<>> m_oPaperSize;
};
class CPrintOptions : public WritingElement
......@@ -193,8 +188,8 @@ namespace OOX
if(m_oGridLines.IsInit() || m_oGridLinesSet.IsInit() || m_oHeadings.IsInit())
{
writer.WriteString(L"<printOptions");
WritingStringNullableAttrBool(L"headings", m_oHeadings);
WritingStringNullableAttrBool(L"gridLines", m_oGridLines);
WritingStringNullableAttrBool(L"headings", m_oHeadings);
WritingStringNullableAttrBool(L"gridLines", m_oGridLines);
WritingStringNullableAttrBool(L"gridLinesSet", m_oGridLinesSet);
writer.WriteString(L"/>");
}
......@@ -216,16 +211,13 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("gridLines"), m_oGridLines)
WritingElement_ReadAttributes_Read_if ( oReader, _T("gridLinesSet"), m_oGridLinesSet)
WritingElement_ReadAttributes_Read_if ( oReader, _T("headings"), m_oHeadings)
WritingElement_ReadAttributes_Read_if ( oReader, _T("horizontalCentered"), m_oHorizontalCentered)
WritingElement_ReadAttributes_Read_if ( oReader, _T("verticalCentered"), m_oVerticalCentered)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("gridLines"), m_oGridLines)
WritingElement_ReadAttributes_Read_if ( oReader, _T("gridLinesSet"), m_oGridLinesSet)
WritingElement_ReadAttributes_Read_if ( oReader, _T("headings"), m_oHeadings)
WritingElement_ReadAttributes_Read_if ( oReader, _T("horizontalCentered"), m_oHorizontalCentered)
WritingElement_ReadAttributes_Read_if ( oReader, _T("verticalCentered"), m_oVerticalCentered)
WritingElement_ReadAttributes_End( oReader )
}
public:
......@@ -272,12 +264,9 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("ref"), m_oRef)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End( oReader )
}
public:
......@@ -315,7 +304,7 @@ namespace OOX
WritingStringNullableAttrBool(L"zeroHeight", m_oZeroHeight);
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
......@@ -332,20 +321,17 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("baseColWidth"), m_oBaseColWidth) // ToDo Excel не воспринимает значения не uint (мы приводим к uint)
WritingElement_ReadAttributes_Read_if ( oReader, _T("customHeight"), m_oCustomHeight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultColWidth"), m_oDefaultColWidth )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultRowHeight"), m_oDefaultRowHeight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outlineLevelCol"), m_oOutlineLevelCol )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outlineLevelRow"), m_oOutlineLevelRow )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thickBottom"), m_oThickBottom )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thickTop"), m_oThickTop )
WritingElement_ReadAttributes_Read_if ( oReader, _T("zeroHeight"), m_oZeroHeight )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("baseColWidth"), m_oBaseColWidth) // ToDo Excel не воспринимает значения не uint (мы приводим к uint)
WritingElement_ReadAttributes_Read_if ( oReader, _T("customHeight"), m_oCustomHeight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultColWidth"), m_oDefaultColWidth )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultRowHeight"), m_oDefaultRowHeight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outlineLevelCol"), m_oOutlineLevelCol )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outlineLevelRow"), m_oOutlineLevelRow )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thickBottom"), m_oThickBottom )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thickTop"), m_oThickTop )
WritingElement_ReadAttributes_Read_if ( oReader, _T("zeroHeight"), m_oZeroHeight )
WritingElement_ReadAttributes_End( oReader )
}
public:
......@@ -402,22 +388,19 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("activePane") , m_oActivePane)
WritingElement_ReadAttributes_Read_if ( oReader, _T("state") , m_oState)
WritingElement_ReadAttributes_Read_if ( oReader, _T("topLeftCell") , m_oTopLeftCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("xSplit") , m_oXSplit)
WritingElement_ReadAttributes_Read_if ( oReader, _T("ySplit") , m_oYSplit)
WritingElement_ReadAttributes_Read_if ( oReader, _T("activePane") , m_oActivePane)
WritingElement_ReadAttributes_Read_if ( oReader, _T("state") , m_oState)
WritingElement_ReadAttributes_Read_if ( oReader, _T("topLeftCell") , m_oTopLeftCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("xSplit") , m_oXSplit)
WritingElement_ReadAttributes_Read_if ( oReader, _T("ySplit") , m_oYSplit)
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CActivePane<>> m_oActivePane;
nullable<SimpleTypes::Spreadsheet::CPaneState<>> m_oState;
nullable<std::wstring> m_oTopLeftCell;
nullable<std::wstring> m_oTopLeftCell;
nullable<SimpleTypes::CDouble> m_oXSplit;
nullable<SimpleTypes::CDouble> m_oYSplit;
};
......@@ -464,21 +447,18 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCell") , m_oActiveCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCellId") , m_oActiveCellId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("sqref") , m_oSqref)
WritingElement_ReadAttributes_Read_if ( oReader, _T("pane") , m_oPane)
WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCell") , m_oActiveCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCellId") , m_oActiveCellId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("sqref") , m_oSqref)
WritingElement_ReadAttributes_Read_if ( oReader, _T("pane") , m_oPane)
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<std::wstring> m_oActiveCell;
nullable<std::wstring> m_oActiveCell;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oActiveCellId;
nullable<std::wstring> m_oSqref;
nullable<std::wstring> m_oSqref;
nullable<SimpleTypes::Spreadsheet::CActivePane<>> m_oPane;
};
......@@ -566,30 +546,27 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("colorId"), m_oColorId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultGridColor"), m_oDefaultGridColor)
WritingElement_ReadAttributes_Read_if ( oReader, _T("rightToLeft"), m_oRightToLeft)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showFormulas"), m_oShowFormulas)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showGridLines"), m_oShowGridLines)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showOutlineSymbols"), m_oShowOutlineSymbols)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showRowColHeaders"), m_oShowRowColHeaders)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showRuler"), m_oShowRuler)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showWhiteSpace"), m_oShowWhiteSpace)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showZeros"), m_oShowZeros)
WritingElement_ReadAttributes_Read_if ( oReader, _T("tabSelected"), m_oTabSelected)
WritingElement_ReadAttributes_Read_if ( oReader, _T("topLeftCell"), m_oTopLeftCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("view"), m_oView)
WritingElement_ReadAttributes_Read_if ( oReader, _T("windowProtection"), m_oWindowProtection)
WritingElement_ReadAttributes_Read_if ( oReader, _T("workbookViewId"), m_oWorkbookViewId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScale"), m_oZoomScale)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScaleNormal"), m_oZoomScaleNormal)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScalePageLayoutView"), m_oZoomScalePageLayoutView)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScaleSheetLayoutView"), m_oZoomScaleSheetLayoutView)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("colorId"), m_oColorId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultGridColor"), m_oDefaultGridColor)
WritingElement_ReadAttributes_Read_if ( oReader, _T("rightToLeft"), m_oRightToLeft)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showFormulas"), m_oShowFormulas)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showGridLines"), m_oShowGridLines)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showOutlineSymbols"), m_oShowOutlineSymbols)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showRowColHeaders"), m_oShowRowColHeaders)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showRuler"), m_oShowRuler)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showWhiteSpace"), m_oShowWhiteSpace)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showZeros"), m_oShowZeros)
WritingElement_ReadAttributes_Read_if ( oReader, _T("tabSelected"), m_oTabSelected)
WritingElement_ReadAttributes_Read_if ( oReader, _T("topLeftCell"), m_oTopLeftCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("view"), m_oView)
WritingElement_ReadAttributes_Read_if ( oReader, _T("windowProtection"), m_oWindowProtection)
WritingElement_ReadAttributes_Read_if ( oReader, _T("workbookViewId"), m_oWorkbookViewId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScale"), m_oZoomScale)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScaleNormal"), m_oZoomScaleNormal)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScalePageLayoutView"), m_oZoomScalePageLayoutView)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScaleSheetLayoutView"), m_oZoomScaleSheetLayoutView)
WritingElement_ReadAttributes_End( oReader )
}
public:
......@@ -606,7 +583,7 @@ namespace OOX
nullable<SimpleTypes::COnOff<>> m_oShowWhiteSpace;
nullable<SimpleTypes::COnOff<>> m_oShowZeros;
nullable<SimpleTypes::COnOff<>> m_oTabSelected;
nullable<std::wstring> m_oTopLeftCell;
nullable<std::wstring> m_oTopLeftCell;
nullable<SimpleTypes::Spreadsheet::CSheetViewType<>>m_oView;
nullable<SimpleTypes::COnOff<>> m_oWindowProtection;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oWorkbookViewId;
......@@ -746,12 +723,12 @@ namespace OOX
public:
nullable<CColor> m_oTabColor;
nullable<std::wstring> m_oCodeName;
nullable<std::wstring> m_oCodeName;
nullable<SimpleTypes::COnOff<>> m_oEnableFormatConditionsCalculation;
nullable<SimpleTypes::COnOff<>> m_oFilterMode;
nullable<SimpleTypes::COnOff<>> m_oPublished;
nullable<SimpleTypes::COnOff<>> m_oSyncHorizontal;
nullable<std::wstring> m_oSyncRef;
nullable<std::wstring> m_oSyncRef;
nullable<SimpleTypes::COnOff<>> m_oSyncVertical;
nullable<SimpleTypes::COnOff<>> m_oTransitionEntry;
nullable<SimpleTypes::COnOff<>> m_oTransitionEvaluation;
......@@ -1070,10 +1047,8 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CRelationshipId > m_oId;
......
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