Commit 253a3069 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55011 954022d7-b5bf-4e40-9824-e11837661b57
parent 92e97d24
......@@ -19,7 +19,7 @@ void ods_conversion_context::start_document()
{
create_element(L"office", L"spreadsheet", content_, this,true);
current_spreadsheet_ = (office_spreadsheet*)dynamic_cast<office_spreadsheet*>(content_.back().get());
current_spreadsheet_ = dynamic_cast<office_spreadsheet*>(content_.back().get());
}
......@@ -36,8 +36,18 @@ void ods_conversion_context::end_sheet()
ods_table_context_.end_table();
}
void ods_conversion_context::add_column(int repeated, const std::wstring & style_name)
void ods_conversion_context::add_column(int start_column, int repeated, const std::wstring & style_name)
{
if (start_column > ods_table_context_.state().columns_count())
{
//default_columns
int repeated_default = start_column - ods_table_context_.state().columns_count();
office_element_ptr element_column_default;
create_element(L"table", L"table-column",element_column_default,this);
ods_table_context_.add_column(element_column_default,repeated_default,L"");
}
office_element_ptr element_column;
create_element(L"table", L"table-column",element_column,this);
......
......@@ -18,7 +18,7 @@ public:
void start_sheet(std::wstring & name);
void end_sheet();
void add_column(int repeated, const std::wstring & StyleName);
void add_column(int start_column, int repeated, const std::wstring & StyleName);
ods_table_context ods_table_context_;
......
......@@ -17,7 +17,7 @@ ods_table_state::ods_table_state(ods_conversion_context & Context, office_elemen
void ods_table_state::set_name(std::wstring name)
{
table_table* table = (table_table*)dynamic_cast<table_table*>(office_table_.get());
table_table* table = dynamic_cast<table_table*>(office_table_.get());
if (table == NULL)return;
tableName_ = name;
......@@ -34,11 +34,11 @@ void ods_table_state::convert()
void ods_table_state::set_table_style(office_element_ptr & elm)
{
office_table_style_ = (style*)dynamic_cast<style*>(elm.get());
office_table_style_ = dynamic_cast<style*>(elm.get());
if (!office_table_style_)return;
table_table* table = (table_table*)dynamic_cast<table_table*>(office_table_.get());
table_table* table = dynamic_cast<table_table*>(office_table_.get());
if (table == NULL)return;
table->table_table_attlist_.table_style_name_ = office_table_style_->style_name_;
......@@ -46,13 +46,22 @@ void ods_table_state::set_table_style(office_element_ptr & elm)
}
void ods_table_state::add_column(office_element_ptr & elm, int repeated, const std::wstring & StyleName)
void ods_table_state::add_column(office_element_ptr & elm, int repeated, const std::wstring & style_name)
{
office_table_->add_child_element(elm);
ods_column_state state = {elm, repeated,StyleName};
ods_column_state state = {elm, repeated,style_name};
columns_count_ += repeated;
columns_.push_back(state);
///
table_table_column* column = dynamic_cast<table_table_column*>(columns_.back().elm.get());
if (column == NULL)return;
column->table_table_column_attlist_.table_style_name_ = style_ref(style_name);
column->table_table_column_attlist_.table_number_columns_repeated_ = repeated;
}
unsigned int ods_table_state::columns_count() const
......
......@@ -288,7 +288,7 @@ void style::serialize(std::wostream & strm)
CP_XML_ATTR_OPT(L"style:parent-style-name", style_parent_style_name_);
CP_XML_ATTR_OPT(L"style:next-style-name", style_next_style_name_);
CP_XML_ATTR_OPT(L"style:list-style-name", style_list_style_name_);
CP_XML_ATTR(L"style:auto-update", style_auto_update_);
CP_XML_ATTR_OPT(L"style:auto-update", style_auto_update_);
CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
CP_XML_ATTR_OPT(L"style:class", style_class_);
CP_XML_ATTR_OPT(L"style:master-page-name", style_master_page_name_);
......
......@@ -259,7 +259,7 @@ public:
static const ElementType type = typeStyleStyle;
CPDOCCORE_DEFINE_VISITABLE();
style() : style_auto_update_(false), style_content_(getContext()) {}
style() : style_content_(getContext()) {}
virtual void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element(office_element_ptr & child);
......@@ -275,10 +275,10 @@ public:
_CP_OPT( std::wstring ) style_next_style_name_; // optional
_CP_OPT( std::wstring ) style_list_style_name_; // optional, may be empty
_CP_OPT( std::wstring ) style_master_page_name_; // optional
bool style_auto_update_; // optional, default = false
_CP_OPT( bool) style_auto_update_; // optional, default = false
_CP_OPT( std::wstring ) style_data_style_name_; // // optional
_CP_OPT( std::wstring ) style_class_; // optional
_CP_OPT(std::wstring) style_default_outline_level_; // optional
_CP_OPT(std::wstring) style_default_outline_level_; // optional
style_content style_content_;
......
......@@ -2,12 +2,12 @@
#include "table.h"
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include <cpdoccore/odf/odf_document.h>
#include "common_attlists.h"
......@@ -16,6 +16,69 @@ namespace odf {
using xml::xml_char_wc;
void table_table_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT( L"table:name", table_name_);
CP_XML_ATTR_OPT( L"table:style-name", table_style_name_);
CP_XML_ATTR_OPT( L"table:template-name", table_template_name_);
if (table_protected_)
CP_XML_ATTR_OPT( L"table:protection-key", table_protection_key_);
if (table_print_)
CP_XML_ATTR_OPT( L"table:print-ranges", table_print_ranges_);
}
void table_table_row_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR(L"table:number-rows-repeated", table_number_rows_repeated_);
CP_XML_ATTR(L"table:style-name", table_style_name_);
CP_XML_ATTR_OPT(L"table:default-cell-style-name", table_default_cell_style_name_);
CP_XML_ATTR_OPT(L"table:visibility", table_visibility_);
}
void table_table_cell_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR(L"table:number-columns-repeated", table_number_columns_repeated_);
CP_XML_ATTR_OPT(L"table:style-name", table_style_name_);
CP_XML_ATTR_OPT(L"table:content-validation-name", table_content_validation_name_);
CP_XML_ATTR_OPT(L"table:formula", table_formula_);
if (common_value_and_type_attlist_)
common_value_and_type_attlist_->serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"table:protect", table_protect_);
}
void table_table_cell_attlist_extra::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"table:number-columns-spanned", table_number_columns_spanned_);
CP_XML_ATTR_OPT(L"table:number-rows-spanned", table_number_rows_spanned_);
CP_XML_ATTR_OPT(L"table:number-matrix-columns-spanned", table_number_matrix_columns_spanned_);
CP_XML_ATTR_OPT(L"table:number-matrix-rows-spanned", table_number_matrix_rows_spanned_);
}
void table_table_source_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR(L"table:mode", table_mode_ );
CP_XML_ATTR_OPT(L"table:table-name", table_table_name_);
}
void table_linked_source_attlist::serialize(CP_ATTR_NODE)
{
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"table:filter-name", table_filter_name_);
CP_XML_ATTR_OPT(L"table:filter-options", table_filter_options_);
CP_XML_ATTR_OPT(L"table:refresh-delay", table_refresh_delay_);
}
void table_table_column_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR(L"table:number-columns-repeated", table_number_columns_repeated_);
CP_XML_ATTR_OPT(L"table:style-name", table_style_name_);
CP_XML_ATTR_OPT(L"table:visibility", table_visibility_);
CP_XML_ATTR_OPT(L"table:default-cell-style-name", table_default_cell_style_name_);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_table_source::ns = L"table";
const wchar_t * table_table_source::name = L"table-source";
......@@ -23,6 +86,20 @@ void table_table_source::create_child_element(const ::std::wstring & Ns, const :
{
CP_NOT_APPLICABLE_ELM();
}
void table_table_source::add_child_element( office_element_ptr & child_element)
{
}
void table_table_source::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
table_table_source_attlist_.serialize(CP_GET_XML_NODE());
table_linked_source_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
// table:table
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -59,25 +136,43 @@ void table_table::create_child_element(const ::std::wstring & Ns, const ::std::w
}
void table_table::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableSource)
{
table_table_source_ = child_element;
}
else if ( type == typeTableTableColumn ||
type == typeTableTableColumns ||
type == typeTableTableHeaderColumns ||
type == typeTableTableColumnGroup)
{
table_columns_and_groups_.add_child_element(child_element, getContext());
}
else if ( type == typeTableTableRow ||
type == typeTableTableRows ||
type == typeTableTableHeaderRows ||
type == typeTableTableRowGroup)
{
table_rows_and_groups_.add_child_element(child_element, getContext());
}
else if (type == typeTableShapes)
{
table_shapes_ = child_element;
}
}
void table_table::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT( L"table:name", table_table_attlist_.table_name_);
CP_XML_ATTR_OPT( L"table:style-name", table_table_attlist_.table_style_name_);
CP_XML_ATTR_OPT( L"table:template-name", table_table_attlist_.table_template_name_);
if (table_table_attlist_.table_protected_)
CP_XML_ATTR_OPT( L"table:protection-key", table_table_attlist_.table_protection_key_);
if (table_table_attlist_.table_print_)
CP_XML_ATTR_OPT( L"table:print-ranges", table_table_attlist_.table_print_ranges_);
table_table_attlist_.serialize(CP_GET_XML_NODE());
if (table_shapes_)table_shapes_->serialize(CP_XML_STREAM());
if (table_shapes_)table_shapes_->serialize(CP_XML_STREAM());
table_columns_and_groups_.serialize(CP_XML_STREAM());
table_rows_and_groups_.serialize(CP_XML_STREAM());
......@@ -95,6 +190,19 @@ void table_table_column::create_child_element( const ::std::wstring & Ns, const
{
CP_NOT_APPLICABLE_ELM();
}
void table_table_column::add_child_element(office_element_ptr & child_element)
{
}
void table_table_column::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
table_table_column_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
// table:table-columns
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -110,6 +218,26 @@ void table_table_columns::create_child_element(const ::std::wstring & Ns, const
else
CP_NOT_APPLICABLE_ELM();
}
void table_table_columns::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
}
void table_table_columns::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
{
elm->serialize(CP_XML_STREAM());
}
}
}
}
// table:table-header-columns
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -125,6 +253,26 @@ void table_table_header_columns::create_child_element( const ::std::wstring & Ns
else
CP_NOT_APPLICABLE_ELM();
}
void table_table_header_columns::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
}
void table_table_header_columns::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
{
elm->serialize(CP_XML_STREAM());
}
}
}
}
// table-columns
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -141,9 +289,35 @@ void table_columns::create_child_element( const ::std::wstring & Ns, const ::std
else
not_applicable_element(L"table-columns", Ns, Name);
}
void table_columns::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableColumns)
{
if (table_table_columns_)
{
//error???
}
table_table_columns_ = child_element;
}
else if (type == typeTableTableColumn)
table_table_column_.push_back(child_element);
}
void table_columns::serialize(std::wostream & _Wostream)
{
if (table_table_columns_) table_table_columns_->serialize(_Wostream);
BOOST_FOREACH(const office_element_ptr & elm, table_table_column_)
{
elm->serialize(_Wostream);
}
}
// table-columns-no-group
//////////////////////////////////////////////////////////////////////////////////////////////////
//const wchar_t * table_columns_no_group::ns = L"table";
//const wchar_t * table_columns_no_group::name = L"table-columns";
table_columns_no_group::table_columns_no_group(odf_conversion_context * _Context) : was_header_(false)
{
Context = _Context;
......@@ -167,15 +341,43 @@ void table_columns_no_group::create_child_element( const ::std::wstring & Ns, c
else
not_applicable_element(L"table-columns-no-group", Ns, Name);
}
void table_columns_no_group::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableColumns || type == typeTableTableColumn)
{
if (!was_header_)
table_columns_1_.add_child_element(child_element);
else
table_columns_2_.add_child_element(child_element);
}
else if (type == typeTableTableHeaderColumns)
{
was_header_ = true;
table_table_header_columns_ = child_element;
}
}
void table_columns_no_group::serialize(std::wostream & _Wostream)
{
// CP_XML_WRITER(_Wostream)
// {
//CP_XML_NODE_SIMPLE()
// {
table_columns_1_.serialize(_Wostream);
if (table_table_header_columns_)
table_table_header_columns_->serialize(_Wostream);
table_columns_2_.serialize(_Wostream);
// }
//}
}
_CP_PTR(table_columns_no_group) table_columns_no_group::create(odf_conversion_context * Context)
{
return boost::make_shared<table_columns_no_group>(Context);
}
// table:table-column-group
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_table_column_group::ns = L"table";
......@@ -185,7 +387,22 @@ void table_table_column_group::create_child_element( const ::std::wstring & Ns,
{
table_columns_and_groups_.create_child_element(Ns, Name, getContext());
}
void table_table_column_group::add_child_element(office_element_ptr & child_element)
{
table_columns_and_groups_.add_child_element(child_element,getContext());
}
void table_table_column_group::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR( L"table:display", table_table_column_group_attlist_.table_display_);
table_columns_and_groups_.serialize(CP_XML_STREAM());
}
}
}
// table-columns-and-groups
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -213,7 +430,32 @@ void table_columns_and_groups::create_child_element(const ::std::wstring & Ns, c
not_applicable_element(L"table-columns-and-groups", Ns, Name);
}
void table_columns_and_groups::add_child_element(office_element_ptr & child_element, odf_conversion_context * Context)
{
ElementType type = child_element->get_type();
if (type == typeTableTableColumnGroup)
{
content_.push_back(child_element);
}
else if (type == typeTableTableColumns ||
type == typeTableTableColumn ||
type == typeTableTableHeaderColumns)
{
_CP_PTR(table_columns_no_group) elm = table_columns_no_group::create(Context);
elm->add_child_element(child_element);
content_.push_back(elm);
}
}
void table_columns_and_groups::serialize(std::wostream & _Wostream)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->serialize(_Wostream);
}
}
// table-table-cell-content
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -221,7 +463,17 @@ void table_table_cell_content::create_child_element( const ::std::wstring & Ns,
{
CP_CREATE_ELEMENT_SIMPLE(text_content_);
}
void table_table_cell_content::add_child_element( office_element_ptr & child_element)
{
text_content_.push_back(child_element);
}
void table_table_cell_content::serialize(std::wostream & _Wostream)
{
BOOST_FOREACH(const office_element_ptr & elm, text_content_)
{
elm->serialize(_Wostream);
}
}
// table:table-cell
// table-table-cell
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -233,7 +485,23 @@ void table_table_cell::create_child_element( const ::std::wstring & Ns, const ::
table_table_cell_content_.create_child_element(Ns, Name, getContext());
}
void table_table_cell::add_child_element(office_element_ptr & child_element)
{
table_table_cell_content_.add_child_element(child_element);
}
void table_table_cell::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
table_table_cell_attlist_.serialize(CP_GET_XML_NODE());
table_table_cell_attlist_extra_.serialize(CP_GET_XML_NODE());
table_table_cell_content_.serialize(CP_XML_STREAM());
}
}
}
// table:covered-table-cell
// table-covered-table-cell
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -245,8 +513,23 @@ void table_covered_table_cell::create_child_element( const ::std::wstring & Ns,
empty_ = false;
table_table_cell_content_.create_child_element( Ns, Name, getContext());
}
void table_covered_table_cell::add_child_element(office_element_ptr & child_element)
{
empty_ = false;
table_table_cell_content_.add_child_element(child_element);
}
void table_covered_table_cell::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
table_table_cell_attlist_.serialize(CP_GET_XML_NODE());
table_table_cell_content_.serialize(CP_XML_STREAM());
}
}
}
// table:table-row
// table-table-row
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -263,7 +546,28 @@ void table_table_row::create_child_element( const ::std::wstring & Ns, const ::s
else
CP_NOT_APPLICABLE_ELM();
}
void table_table_row::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableCell || type == typeTableCoveredTableCell )
content_.push_back(child_element);
}
void table_table_row::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
table_table_row_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->serialize(CP_XML_STREAM());
}
}
}
}
// table:table-rows
// table-table-rows
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -274,7 +578,23 @@ void table_table_rows::create_child_element( const ::std::wstring & Ns, const :
{
CP_CREATE_ELEMENT(table_table_row_);
}
void table_table_rows::add_child_element(office_element_ptr & child_element)
{
table_table_row_.push_back(child_element);
}
void table_table_rows::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
{
elm->serialize(CP_XML_STREAM());
}
}
}
}
// table:table-header-rows
// table-table-header-rows
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -290,8 +610,26 @@ void table_table_header_rows::create_child_element( const ::std::wstring & Ns, c
else
CP_NOT_APPLICABLE_ELM();
}
void table_table_header_rows::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableRow)
table_table_row_.push_back(child_element);
}
void table_table_header_rows::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
{
elm->serialize(CP_XML_STREAM());
}
}
}
}
// table-rows
//////////////////////////////////////////////////////////////////////////////////////////////////
void table_rows::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context)
......@@ -309,7 +647,26 @@ void table_rows::create_child_element(const ::std::wstring & Ns, const ::std::ws
not_applicable_element(L"table-rows", Ns, Name);
}
}
void table_rows::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableRows)
table_table_rows_ = child_element;
else if (type == typeTableTableRow)
table_table_row_.push_back(child_element);
}
void table_rows::serialize(std::wostream & _Wostream)
{
if (table_table_rows_)
table_table_rows_->serialize(_Wostream);
BOOST_FOREACH(const office_element_ptr & elm, table_table_row_)
{
elm->serialize(_Wostream);
}
}
// table-rows-no-group
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * table_rows_no_group::ns = L"table";
......@@ -342,7 +699,38 @@ void table_rows_no_group::create_child_element( const ::std::wstring & Ns, const
else
not_applicable_element(L"table-rows-no-group",Ns, Name);
}
void table_rows_no_group::add_child_element(office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeTableTableRows || type == typeTableTableRow)
{
if (!was_header_)
table_rows_1_.add_child_element(child_element);
else
table_rows_2_.add_child_element(child_element);
}
else if (type == typeTableTableHeaderRows)
{
was_header_ = true;
table_table_header_rows_ = child_element;
}
}
void table_rows_no_group::serialize(std::wostream & _Wostream)
{
// CP_XML_WRITER(_Wostream)
// {
//CP_XML_NODE_SIMPLE()
// {
table_rows_1_.serialize(_Wostream);
if (table_table_header_rows_)
table_table_header_rows_->serialize(_Wostream);
table_rows_2_.serialize(_Wostream);
/* }
}*/
}
// table-rows-and-groups
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -365,7 +753,28 @@ void table_rows_and_groups::create_child_element( const ::std::wstring & Ns, con
else
not_applicable_element(L"table-rows-and-groups", Ns, Name);
}
void table_rows_and_groups::add_child_element(office_element_ptr & child_element, odf_conversion_context * Context)
{
ElementType type = child_element->get_type();
if (type == typeTableTableRowGroup)
{
content_.push_back(child_element);
}
else if (type == typeTableTableRows || type == typeTableTableRow)
{
_CP_PTR(table_rows_no_group) elm = table_rows_no_group::create(Context);
elm->add_child_element(child_element);
content_.push_back(elm);
}
}
void table_rows_and_groups::serialize(std::wostream & _Wostream)
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->serialize(_Wostream);
}
}
// table:table-row-group
// table-table-row-group
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -378,7 +787,22 @@ void table_table_row_group::create_child_element(const ::std::wstring & Ns, cons
table_rows_and_groups_.create_child_element(Ns, Name, getContext());
}
void table_table_row_group::add_child_element(office_element_ptr & child_element)
{
table_rows_and_groups_.add_child_element(child_element, getContext());
}
void table_table_row_group::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR( L"table:display", table_table_row_group_attlist_.table_display_);
table_rows_and_groups_.serialize(CP_XML_STREAM());
}
}
}
///////////
......@@ -393,7 +817,24 @@ void table_shapes::create_child_element(const ::std::wstring & Ns, const ::std::
create_element(Ns,Name,content_,getContext());
}
void table_shapes::add_child_element(office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void table_shapes::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->serialize(CP_XML_STREAM());
}
}
}
}
}
}
......@@ -21,67 +21,90 @@ namespace odf {
class table_table_attlist
{
public:
table_table_attlist()
{
table_print_ = true;
table_use_first_row_styles_ = false;
table_use_banding_rows_styles_ = false;
table_use_first_column_styles_ = false;
table_use_banding_columns_styles_ = false;
}
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(std::wstring) table_name_;
_CP_OPT(style_ref) table_style_name_;
_CP_OPT(std::wstring) table_template_name_;
bool table_protected_; // default false
_CP_OPT(std::wstring) table_protection_key_;
bool table_print_; // default true
_CP_OPT(std::wstring) table_print_ranges_;
_CP_OPT(bool) table_protected_; // default false
bool table_print_; // default true
bool table_use_first_row_styles_; // default false;
bool table_use_banding_rows_styles_; //defualt false;
bool table_use_first_column_styles_;//defualt false;
bool table_use_banding_columns_styles_; //defualt false;
friend class table_table;
void serialize(CP_ATTR_NODE);
friend class table_table;
};
// table-table-row-attlist
class table_table_row_attlist
{
public:
unsigned int table_number_rows_repeated_; // default 1
table_table_row_attlist() : table_number_rows_repeated_(1){}
unsigned int table_number_rows_repeated_; // default 1
_CP_OPT(style_ref) table_style_name_;
_CP_OPT(style_ref) table_default_cell_style_name_;
table_visibility table_visibility_; // default Visible
_CP_OPT(table_visibility) table_visibility_; // default Visible
void serialize(CP_ATTR_NODE);
};
// table-table-cell-attlist
class table_table_cell_attlist
{
public:
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(style_ref) table_style_name_;
_CP_OPT(std::wstring) table_content_validation_name_;
_CP_OPT(std::wstring) table_formula_;
table_table_cell_attlist() : table_number_columns_repeated_(1) {}
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(style_ref) table_style_name_;
_CP_OPT(std::wstring) table_content_validation_name_;
_CP_OPT(std::wstring) table_formula_;
_CP_OPT(common_value_and_type_attlist) common_value_and_type_attlist_;
bool table_protect_; // default false
_CP_OPT(bool) table_protect_; // default false
void serialize(CP_ATTR_NODE);
};
// table-table-cell-attlist-extra
class table_table_cell_attlist_extra
{
public:
unsigned int table_number_columns_spanned_; // default 1
unsigned int table_number_rows_spanned_; // default 1
_CP_OPT(unsigned int) table_number_columns_spanned_; // default 1
_CP_OPT(unsigned int) table_number_rows_spanned_; // default 1
_CP_OPT(unsigned int) table_number_matrix_columns_spanned_;
_CP_OPT(unsigned int) table_number_matrix_rows_spanned_;
void serialize(CP_ATTR_NODE);
};
// table-table-source-attlist
class table_table_source_attlist
{
public:
table_mode table_mode_; // default CopyAll
table_table_source_attlist() : table_mode_(table_mode::CopyAll) {}
table_mode table_mode_; // default CopyAll
_CP_OPT(std::wstring) table_table_name_;
void serialize(CP_ATTR_NODE);
};
// table-linked-source-attlist
......@@ -94,6 +117,7 @@ public:
_CP_OPT(std::wstring) table_filter_options_;
_CP_OPT(std::wstring) table_refresh_delay_;
void serialize(CP_ATTR_NODE);
};
/// \class table_table_source
......@@ -113,9 +137,9 @@ public:
table_linked_source_attlist table_linked_source_attlist_;
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
};
......@@ -126,9 +150,9 @@ class table_columns
{
public:
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
public:
office_element_ptr table_table_columns_;
......@@ -152,9 +176,9 @@ public:
table_columns_no_group(odf_conversion_context * _Context);
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name/*, odf_conversion_context * Context*/);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
static _CP_PTR(table_columns_no_group) create(odf_conversion_context * Context);
......@@ -177,9 +201,9 @@ public:
table_columns_and_groups();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element, odf_conversion_context * Context);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
public:
// office_element_ptr table_table_column_group_;
......@@ -192,11 +216,14 @@ public:
class table_table_column_attlist
{
public:
table_table_column_attlist() : table_number_columns_repeated_(1){}
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(style_ref) table_style_name_;
table_visibility table_visibility_; // default Visible
_CP_OPT(style_ref) table_default_cell_style_name_;
_CP_OPT(style_ref) table_style_name_;
_CP_OPT(table_visibility) table_visibility_; // default Visible
_CP_OPT(style_ref) table_default_cell_style_name_;
void serialize(CP_ATTR_NODE);
};
// \class table_table_column
......@@ -213,9 +240,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
public:
table_table_column_attlist table_table_column_attlist_;
......@@ -238,9 +265,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_column_;
......@@ -262,9 +289,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_column_;
......@@ -275,7 +302,9 @@ CP_REGISTER_OFFICE_ELEMENT2(table_table_header_columns);
// table-table-column-group-attlist
class table_table_column_group_attlist
{
bool table_display_; // default true
public:
table_table_column_group_attlist() : table_display_(true) {}
bool table_display_; // default true
};
......@@ -293,9 +322,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
table_table_column_group()
{
......@@ -322,9 +351,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
table_table_row_attlist table_table_row_attlist_;
office_element_ptr_array content_; // table-table-cell, table-covered-table-cell
......@@ -339,9 +368,9 @@ class table_table_cell_content
{
public:
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
private:
// TODO table-cell-range-source
// TODO office-annotation
......@@ -365,9 +394,9 @@ public:
table_table_cell() { }
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_;
......@@ -393,9 +422,9 @@ public:
table_covered_table_cell() {empty_ = true; }
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
bool empty_;
table_table_cell_attlist table_table_cell_attlist_;
......@@ -419,9 +448,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
table_table_rows()
{
......@@ -447,9 +476,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array table_table_row_;
......@@ -463,9 +492,9 @@ class table_rows
{
public:
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
office_element_ptr table_table_rows_;
office_element_ptr_array table_table_row_;
......@@ -490,9 +519,9 @@ public:
table_rows_no_group(odf_conversion_context * Context);
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
table_rows table_rows_1_;
......@@ -513,9 +542,9 @@ public:
table_rows_and_groups();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element, odf_conversion_context * Context);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
int get_count(){return content_.size();}// ..
......@@ -530,9 +559,8 @@ public:
class table_table_row_group_attlist
{
public:
table_table_row_group_attlist() : table_display_(true) {}
bool table_display_; // default true
};
// table:table-row-group
......@@ -550,9 +578,9 @@ public:
{
}
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
table_table_row_group_attlist table_table_row_group_attlist_;
table_rows_and_groups table_rows_and_groups_;
......@@ -575,7 +603,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
......@@ -606,9 +634,9 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_child_element( office_element_ptr & child_element){}
virtual void add_child_element( office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream){}
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
......
......@@ -113,8 +113,9 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCol *oox_column)
//nullable<SimpleTypes::COnOff<>> m_oPhonetic;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oStyle;
//nullable<SimpleTypes::CDouble> m_oWidth;
int start_column = oox_column->m_oMin.IsInit() ? oox_column->m_oMin->GetValue() : 0 ;
int repeated = (oox_column->m_oMax.IsInit() ? oox_column->m_oMax->GetValue() : 0) -
(oox_column->m_oMin.IsInit() ? oox_column->m_oMin->GetValue() : 0);
(oox_column->m_oMin.IsInit() ? oox_column->m_oMin->GetValue() : 0) + 1;
int oox_style_id = -1;
......@@ -140,7 +141,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCol *oox_column)
column_properties->style_table_column_properties_attlist_.style_column_width_ = odf::length(width,odf::length::cm);
// !!!
}
ods_context->add_column(repeated, style->style_name_);
ods_context->add_column(start_column, repeated, style->style_name_);
}
void XlsxConverter::convert_styles()
......
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