Commit 17e46a2c authored by Alexey.Musinov's avatar Alexey.Musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop

* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatWriter - presentation tables styled
  OdfFormatWriter - presentation tables
parents c5ffcd4b 38813fd1
......@@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_EXCEPTION_DISABLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......
......@@ -105,7 +105,7 @@ SOURCES += \
../source/OdfFormat/odp_page_state.cpp \
../source/OdfFormat/odp_slide_context.cpp \
../source/OdfFormat/office_presentation.cpp \
../source/OdfFormat/style_presentation.cpp \
../source/OdfFormat/style_presentation.cpp
}
SOURCES += \
......@@ -115,9 +115,7 @@ SOURCES += \
../source/Oox2OdfConverter/DocxConverter.cpp \
../source/Oox2OdfConverter/XlsxConverter.cpp \
../source/Oox2OdfConverter/ConvertDrawing.cpp \
../source/Oox2OdfConverter/PptxConverter.cpp \
../source/OdfFormat/anim_elements.cpp \
../source/OdfFormat/style_presentation.cpp
../source/Oox2OdfConverter/PptxConverter.cpp
HEADERS += \
../source/OdfFormat/abstract_xml.h \
......
......@@ -109,7 +109,7 @@ namespace odf_writer
struct odf_chart_level_state
{
style_text_properties *text_properties_;
style_graphic_properties *graphic_properties_;
graphic_format_properties *graphic_properties_;
style_paragraph_properties *paragraph_properties_;
style_chart_properties *chart_properties_;
......@@ -297,8 +297,8 @@ void odf_chart_context::Impl::set_default_series_color()
color col = color(default_MS_series_colors[current_series_count_]);
current_level_.back().graphic_properties_->content_.common_draw_fill_attlist_.draw_fill_color_ = col;
current_level_.back().graphic_properties_->content_.svg_stroke_color_ = col;
current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_color_ = col;
current_level_.back().graphic_properties_->svg_stroke_color_ = col;
}
////////////////////////////////////////////////////////////////////////////
......@@ -641,7 +641,7 @@ void odf_chart_context::start_series(std::wstring type)
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
......@@ -968,7 +968,7 @@ void odf_chart_context::start_floor()
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
}
}
void odf_chart_context::start_wall()
......@@ -993,9 +993,9 @@ void odf_chart_context::start_wall()
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
if (impl_->current_level_.back().graphic_properties_)
impl_->current_level_.back().graphic_properties_->content_.common_draw_fill_attlist_.draw_fill_color_ = color(L"#ffffff");
impl_->current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_color_ = color(L"#ffffff");
}
}
void odf_chart_context::start_legend()
......@@ -1036,7 +1036,7 @@ void odf_chart_context::start_stock_range_line()
style_name = style_->style_name_;
line->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
......@@ -1059,7 +1059,7 @@ void odf_chart_context::start_stock_gain_marker()
style_name = style_->style_name_;
marker->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
......@@ -1082,7 +1082,7 @@ void odf_chart_context::start_stock_loss_marker()
style_name = style_->style_name_;
marker->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
......@@ -1219,7 +1219,7 @@ void odf_chart_context::set_no_fill(bool Val)
if (Val == false)return;
if (!impl_->current_level_.back().graphic_properties_)return;
impl_->current_level_.back().graphic_properties_->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
impl_->current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
}
void odf_chart_context::set_axis_tick_major(int type)
......
......@@ -121,6 +121,9 @@ public:
void start_shape (int type);
void end_shape ();
void start_frame ();
void end_frame ();
bool change_text_box_2_wordart();
void start_image (std::wstring file_path);
......@@ -171,7 +174,7 @@ public:
void set_flip_H (bool bVal);
void set_flip_V (bool bVal);
void set_rotate (double iVal);
void set_rotate (double dVal);
void set_no_fill ();
void set_type_fill (int type);//for area - temp for objects
......@@ -194,6 +197,8 @@ public:
_CP_OPT(unsigned int) get_fill_color ();
void set_fill_color (unsigned int color);
_CP_OPT(odf_types::color) get_line_color();
//void start_shadow_properties();
//void end_shadow_properties();
// пока одной функией ..
......@@ -201,11 +206,12 @@ public:
void set_text (odf_text_context* text_context);
void set_textarea_vertical_align(int align);
void set_textarea_padding (_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom);//in cm
void set_textarea_padding (_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom);//in pt
void set_textarea_writing_mode (int mode);
void set_textarea_wrap (bool val);
void set_textarea_fontcolor (std::wstring hexColor);
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
void set_textarea_rotate (double dVal);
void set_layer (std::wstring val);
//////////////////////////////////////////////////////////////////////////////////////
void start_gradient_style ();
......@@ -249,9 +255,6 @@ public:
private:
void start_frame();
void end_frame();
class Impl;
_CP_PTR(Impl) impl_;
......
......@@ -102,9 +102,9 @@ void odf_style_context::create_style(std::wstring oox_name, style_family::type f
style_state_list_.push_back( state );
///////////////////////////////////////
style_state_list_.back()->set_name(odf_name);
style_state_list_.back()->set_automatic(automatic);
style_state_list_.back()->set_root(root);
style_state_list_.back()->set_name (odf_name);
style_state_list_.back()->set_automatic (automatic);
style_state_list_.back()->set_root (root);
style_state_list_.back()->style_oox_id_ = oox_id;
......
......@@ -60,12 +60,14 @@ namespace odf_writer {
if (style_)
{
style_->style_family_ = style_family(style_family_);
style_->content_.style_family_ = style_family_;
}
default_style* default_style_ = dynamic_cast<default_style*>(elm.get());
if (default_style_)
{
default_style_->style_family_ = style_family(style_family_);
default_style_->content_.style_family_ = style_family_;
}
list_style_exist = false;
......@@ -112,6 +114,12 @@ style_family::type odf_style_state::get_family_type()
{
return style_family_;
}
void odf_style_state::set_family_type (odf_types::style_family::type type)
{
style_family_ = type;
}
void odf_style_state::set_parent_style_name(std::wstring name)
{
if (name.length() < 1) return;
......@@ -229,16 +237,17 @@ style_paragraph_properties * odf_style_state::get_paragraph_properties()
return NULL;
}
style_graphic_properties * odf_style_state::get_graphic_properties()
graphic_format_properties * odf_style_state::get_graphic_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_)return style_->content_.get_style_graphic_properties();
if (style_)return style_->content_.get_graphic_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_)return default_style_->content_.get_style_graphic_properties();
if (default_style_)return default_style_->content_.get_graphic_properties();
return NULL;
}
style_table_properties * odf_style_state::get_table_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
......@@ -304,13 +313,14 @@ style_chart_properties * odf_style_state::get_chart_properties()
return NULL;
}
//style_drawing_page_properties * odf_style_state::get_drawing_page_properties()
//{
// style* style_ = dynamic_cast<style*>(odf_style_.get());
// if (!style_)return NULL;
//
// return style_->content_.get_style_drawing_page_properties();
//}
style_drawing_page_properties * odf_style_state::get_drawing_page_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_)return NULL;
return style_->content_.get_style_drawing_page_properties();
}
///////////////////////
......
......@@ -45,16 +45,17 @@ class style;
class odf_conversion_context;
class odf_style_context;
class graphic_format_properties;
class style_text_properties;
class style_paragraph_properties;
class style_graphic_properties;
class style_table_properties;
class style_section_properties;
class style_table_cell_properties;
class style_table_row_properties;
class style_table_column_properties;
class style_chart_properties;
//class style_drawing_page_properties;
class style_drawing_page_properties;
class odf_style_state;
typedef shared_ptr<odf_style_state>::Type odf_style_state_ptr;
......@@ -80,7 +81,8 @@ public:
void set_name(std::wstring name);
std::wstring get_name();
odf_types::style_family::type get_family_type();
odf_types::style_family::type get_family_type ();
void set_family_type (odf_types::style_family::type type);
void set_number_format(int id) {num_fmt_id_ = id;}
int get_number_format() {return num_fmt_id_;}
......@@ -91,16 +93,17 @@ public:
void set_display_name(std::wstring name);
//////////////////////////////////////////////////////////////////////////////////////////
style_text_properties * get_text_properties();
graphic_format_properties * get_graphic_properties() ;
style_text_properties * get_text_properties();
style_paragraph_properties * get_paragraph_properties() ;
style_graphic_properties * get_graphic_properties() ;
style_table_properties * get_table_properties();
style_section_properties * get_section_properties();
style_table_cell_properties * get_table_cell_properties();
style_table_row_properties * get_table_row_properties() ;
style_table_column_properties * get_table_column_properties() ;
style_chart_properties * get_chart_properties() ;
//style_drawing_page_properties* get_drawing_page_properties();
style_drawing_page_properties* get_drawing_page_properties();
bool get_list_style_exist();
int get_list_style_level();
......
......@@ -44,10 +44,10 @@
#include "table.h"
#include "style_table_properties.h"
#include "style_graphic_properties.h"
#include "style_text_properties.h"
//#include "style_text_properties.h"
//#include "style_paragraph_properties.h"
//#include "style_graphic_properties.h"
namespace cpdoccore
......@@ -151,7 +151,9 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled)
if (!table)return;
odf_table_state state;
state.table.elm = elm;
state.table.elm = elm;
state.default_cell_properties = impl_->default_cell_properties; //write in row default cell props
if (styled)
{
......@@ -160,14 +162,12 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled)
{
state.table.style_elm = style_state->get_office_element();
state.table.style_name = style_state->get_name();
table->table_table_attlist_.table_style_name_ = state.table.style_name;
}
}
state.default_cell_properties = impl_->default_cell_properties;
impl_->default_cell_properties = L"";
impl_->start_table(state);
}
void odf_table_context::end_table()
{
......@@ -196,27 +196,31 @@ void odf_table_context::start_row(office_element_ptr &elm, bool styled)
{
if (impl_->empty()) return;
table_table_row * row = dynamic_cast<table_table_row *>(elm.get());;
table_table_row * row = dynamic_cast<table_table_row *>(elm.get());
if (!row)return;
odf_element_state state;
state.elm = elm;
if (styled)
{
odf_style_state_ptr style_state = impl_->styles_context()->last_state(style_family::TableRow);
if (style_state)
{
state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name();
state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name();
row->table_table_row_attlist_.table_style_name_ = state.style_name;
}
}
if (!impl_->current_table().default_cell_properties.empty())
row->table_table_row_attlist_.table_default_cell_style_name_ = impl_->current_table().default_cell_properties;
impl_->current_table().rows.push_back(state);
impl_->current_table().current_column =0;
impl_->current_table().current_column = 0;
impl_->current_table().current_row ++;
}
......@@ -411,8 +415,9 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
{
if (impl_->empty()) return;
table_table_cell * cell = dynamic_cast<table_table_cell *>(elm.get());;
table_covered_table_cell * covered_cell = dynamic_cast<table_covered_table_cell *>(elm.get());
table_table_cell* cell = dynamic_cast<table_table_cell *>(elm.get());;
table_covered_table_cell* covered_cell = dynamic_cast<table_covered_table_cell *>(elm.get());
if (!cell && !covered_cell)return;
odf_element_state state;
......@@ -423,10 +428,32 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
odf_style_state_ptr style_state = impl_->styles_context()->last_state(style_family::TableCell);
if (style_state)
{
state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name();
state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name();
cell->table_table_cell_attlist_.table_style_name_ = state.style_name;
}
if (!impl_->current_table().default_cell_properties.empty())
{
odf_style_state_ptr default_style_state;
impl_->styles_context()->find_odf_style_state(impl_->current_table().default_cell_properties, style_family::TableCell, default_style_state);
if (default_style_state && style_state)
{
graphic_format_properties * g = style_state->get_graphic_properties() ;
style_text_properties * t = style_state->get_text_properties();
style_table_cell_properties * c = style_state->get_table_cell_properties();
graphic_format_properties * d_g = default_style_state->get_graphic_properties() ;
style_text_properties * d_t = default_style_state->get_text_properties();
style_table_cell_properties * d_c = default_style_state->get_table_cell_properties();
if (g && d_g) g->apply_from(*d_g);
if (t && d_t) t->apply_from(d_t);
if (c && d_c) c->apply_from(d_c);
}
}
}
//if (cell)
//{
......@@ -438,6 +465,7 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
impl_->current_table().current_column++;
}
void odf_table_context::set_cell_column_span(int spanned)
{
if (impl_->empty()) return;
......@@ -449,16 +477,24 @@ void odf_table_context::set_cell_column_span(int spanned)
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned;
//impl_->current_table().current_column += spanned-1;
//impl_->current_table().current_column += spanned - 1;
}
void odf_table_context::set_cell_row_span()
void odf_table_context::set_cell_row_span(int spanned)
{
int col = impl_->current_table().current_column-1;
odf_column_state & state = impl_->current_table().columns[col];
if (spanned > 0)
{
table_table_cell * cell = dynamic_cast<table_table_cell *>(impl_->current_table().cells.back().elm.get());
if (cell)
cell->table_table_cell_attlist_extra_.table_number_rows_spanned_ = spanned;
}
else
{
int col = impl_->current_table().current_column - 1;
odf_column_state & state = impl_->current_table().columns[col];
state.spanned_row_cell.push_back(impl_->current_table().cells.back().elm);
state.spanned_row_cell.push_back(impl_->current_table().cells.back().elm);
}
}
void odf_table_context::set_cell_row_span_restart()
......
......@@ -85,7 +85,7 @@ public:
void start_cell(office_element_ptr &elm, bool styled = false);
void set_cell_column_span(int spanned);
void set_cell_row_span();
void set_cell_row_span(int spanned = 0);
void set_cell_row_span_restart();
void end_cell();
......
......@@ -53,8 +53,7 @@ namespace odf_writer {
odp_conversion_context::odp_conversion_context(package::odf_document * outputDocument)
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this)
//, current_text_context_(NULL)
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this), text_context_(NULL)
{
}
......@@ -102,14 +101,14 @@ void odp_conversion_context::end_slide()
void odp_conversion_context::start_text_context()
{
current_text_context_ = new odf_text_context(this);
text_context_ = new odf_text_context(this);
}
void odp_conversion_context::end_text_context()
{
if (current_text_context_)
delete current_text_context_;
current_text_context_ = NULL;
if (text_context_)
delete text_context_;
text_context_ = NULL;
}
void odp_conversion_context::start_drawings()
......
......@@ -55,15 +55,16 @@ public:
void start_master_slide(std::wstring name);
void end_master_slide();
///////////////////////////////////////////////////////
odp_page_state & current_slide() { return slide_context_.state();}
odp_page_state & current_slide() { return slide_context_.state();}
/////////////////////////////////////////////////////
virtual void start_text_context();
virtual void end_text_context();
virtual odf_drawing_context * drawing_context() {return current_slide().drawing_context();}
virtual odf_text_context * text_context() {return current_text_context_;}
virtual odf_text_context * text_context() {return text_context_; }
odp_slide_context * slide_context() {return &slide_context_;}
void start_drawings();
void end_drawings();
......@@ -72,7 +73,7 @@ public:
private:
odp_slide_context slide_context_;
odf_text_context* current_text_context_;
odf_text_context* text_context_;
office_presentation* root_presentation_;
};
......
......@@ -29,12 +29,11 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "odp_slide_context.h"
#include "logging.h"
#include "odp_conversion_context.h"
#include "logging.h"
#include "odp_slide_context.h"
#include "odf_text_context.h"
#include <iostream>
......@@ -45,7 +44,7 @@ namespace cpdoccore {
namespace odf_writer {
odp_slide_context::odp_slide_context(odp_conversion_context & Context): context_(Context)
odp_slide_context::odp_slide_context(odp_conversion_context & Context): context_(Context), table_context_(&Context), comment_context_(&Context)
{
styles_context_ = Context.styles_context();
}
......@@ -81,5 +80,172 @@ void odp_slide_context::end_page()
state().drawing_context()->finalize(state().page_elm_);
}
odf_table_context* odp_slide_context::table_context()
{
return &table_context_;
}
void odp_slide_context::start_table()
{
state().drawing_context()->start_frame();
office_element_ptr elm, style_elm, default_cell;
create_element(L"table", L"table", elm, &context_);
//--------------------------------------------------------------------
odf_style_state_ptr style_state;
//общие свойства ячеек
styles_context_->create_style(L"", odf_types::style_family::TableCell, true, false, -1);
//ради нормального задания дефолтовых свойств на cells
style_state = styles_context_->last_state(style_family::TableCell);
if (style_state)
{
default_cell = style_state->get_office_element();
table_context()->set_default_cell_properties(style_state->get_name());
}
//стиль создаем всегда
styles_context_->create_style(L"", odf_types::style_family::Table, true, false, -1);
style_state = styles_context_->last_state(style_family::Table);
if (style_state) style_elm = style_state->get_office_element();
//--------------------------------------------------------------------
table_context()->start_table(elm, true);
state().drawing_context()->start_element(elm, default_cell);
}
void odp_slide_context::start_table_columns()
{
office_element_ptr elm;
create_element(L"table", L"table-columns", elm, &context_);
state().drawing_context()->start_element(elm);
}
void odp_slide_context::add_table_column(double width)
{
office_element_ptr elm;
create_element(L"table", L"table-column", elm, &context_);
styles_context_->create_style(L"", style_family::TableColumn, true, false, -1);
//не срабатывает ..
//std::wstring parent_name = table_context()->get_default_cell_properties();
//if (parent_name.length() > 0)
//{
// odf_writer::style_table_cell_properties * props = styles_context()->last_state().get_table_cell_properties();
// style * style_ = NULL;
//
// if (styles_context()->find_odf_style(parent_name,style_family::TableCell,style_))
// {
// style_table_cell_properties * parent = style_->content_.get_style_table_cell_properties();
// props->apply_from(parent);
// }
//}
table_context()->add_column(elm, true);
table_context()->set_column_width(width);
state().drawing_context()->start_element(elm); // для связи элментов
state().drawing_context()->end_element();
}
void odp_slide_context::end_table_columns()
{
state().drawing_context()->end_element();
}
void odp_slide_context::start_table_header_rows()
{
office_element_ptr elm;
create_element(L"table", L"table-header-rows", elm, &context_);
state().drawing_context()->start_element(elm);
}
void odp_slide_context::end_table_header_rows()
{
state().drawing_context()->end_element();
}
void odp_slide_context::start_table_row (bool styled)
{
office_element_ptr elm, style_elm;
create_element(L"table", L"table-row", elm, &context_);
if (styled)
{
styles_context_->create_style(L"",odf_types::style_family::TableRow, true, false, -1);
odf_style_state_ptr style_state = styles_context_->last_state(style_family::TableRow);
if (style_state)
style_elm = style_state->get_office_element();
}
state().drawing_context()->start_element(elm, style_elm);
table_context()->start_row(elm, styled);
}
void odp_slide_context::start_table_cell(int col, bool covered, bool styled)
{
for (int i = table_context()->current_column() ; i < col; i++)
{
add_default_cell();
}
//-------------------------------------------------------
office_element_ptr elm, style_elm;
if (covered)
create_element(L"table", L"covered-table-cell", elm, &context_);
else
create_element(L"table", L"table-cell", elm, &context_);
if (styled)
{
styles_context_->create_style(L"", odf_types::style_family::TableCell, true, false, -1);
odf_style_state_ptr style_state = styles_context_->last_state(style_family::TableCell);
if (style_state)
style_elm = style_state->get_office_element();
}
table_context()->start_cell(elm, style_elm ? true : false);
state().drawing_context()->start_element(elm, style_elm);
}
void odp_slide_context::end_table_cell()
{
table_context()->end_cell();
state().drawing_context()->end_element();
}
void odp_slide_context::end_table_row()
{
for (int i = table_context()->current_column() ; i < table_context()->count_columns(); i++)
{
add_default_cell();
}
//---------------------------------------------
table_context()->end_row();
state().drawing_context()->end_element();
}
void odp_slide_context::add_default_cell()
{
office_element_ptr elm;
create_element(L"table", L"covered-table-cell", elm, &context_);
table_context()->start_cell(elm, false);
state().drawing_context()->start_element(elm);
table_context()->end_cell();
state().drawing_context()->end_element();
}
void odp_slide_context::end_table()
{
table_context()->end_table();
state().drawing_context()->end_element();
state().drawing_context()->end_frame();
}
}
}
......@@ -31,9 +31,11 @@
*/
#pragma once
#include <string>
#include "odp_page_state.h"
#include "odf_table_context.h"
#include "odf_comment_context.h"
namespace cpdoccore {
namespace odf_writer {
......@@ -55,11 +57,29 @@ public:
odp_page_state & state();
odf_comment_context * comment_context();
odf_table_context * table_context();
void start_table ();
void start_table_columns ();
void add_table_column (double width = -1);
void end_table_columns ();
void start_table_header_rows();
void end_table_header_rows ();
void start_table_row (bool styled = false);
void add_default_cell ();
void start_table_cell (int col, bool covered, bool styled = true);
void end_table_cell ();
void end_table_row ();
void end_table ();
private:
odp_conversion_context& context_;
odf_style_context* styles_context_;
odf_table_context table_context_;
odf_comment_context comment_context_;
std::list<odp_page_state> page_state_list_;
friend class odp_conversion_context;
......
......@@ -231,7 +231,6 @@ void ods_table_context::start_table(office_element_ptr & elm)
office_element_ptr & style = context_.styles_context()->add_or_find(style_name_new, style_family::Table, true);
style->create_child_element(L"style", L"table-properties");
state().set_table_style(style);
state().set_table_hidden(false);
......
......@@ -44,8 +44,8 @@ class office_text;
class odf_text_context;
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
struct odt_section_state
{
......
......@@ -49,6 +49,65 @@ graphic_format_properties::graphic_format_properties()
//style_mirror_ = L"none";
//common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
}
void graphic_format_properties::apply_from(const graphic_format_properties & Other)
{
_CP_APPLY_PROP2(draw_stroke_);
_CP_APPLY_PROP2(draw_stroke_dash_);
_CP_APPLY_PROP2(draw_marker_start_);
_CP_APPLY_PROP2(draw_marker_end_);
_CP_APPLY_PROP2(draw_textarea_horizontal_align_);
_CP_APPLY_PROP2(draw_textarea_vertical_align_);
_CP_APPLY_PROP2(draw_auto_grow_height_);
_CP_APPLY_PROP2(draw_auto_grow_width_);
_CP_APPLY_PROP2(draw_fit_to_size_);
_CP_APPLY_PROP2(draw_fit_to_contour_);
_CP_APPLY_PROP2(svg_stroke_color_);
_CP_APPLY_PROP2(svg_stroke_width_);
_CP_APPLY_PROP2(svg_stroke_opacity_);
_CP_APPLY_PROP2(fo_min_width_);
_CP_APPLY_PROP2(fo_min_height_);
_CP_APPLY_PROP2(fo_max_width_);
_CP_APPLY_PROP2(fo_max_height_);
_CP_APPLY_PROP2(fo_wrap_option_);
_CP_APPLY_PROP2(style_print_content_);
_CP_APPLY_PROP2(style_protect_);
_CP_APPLY_PROP2(style_editable_);
_CP_APPLY_PROP2(style_wrap_);
_CP_APPLY_PROP2(style_wrap_dynamic_treshold_);
_CP_APPLY_PROP2(style_number_wrapped_paragraphs_);
_CP_APPLY_PROP2(style_wrap_contour_);
_CP_APPLY_PROP2(style_wrap_contour_mode_);
_CP_APPLY_PROP2(style_run_through_);
_CP_APPLY_PROP2(style_flow_with_text_);
_CP_APPLY_PROP2(style_overflow_behavior_);
_CP_APPLY_PROP2(style_mirror_);
_CP_APPLY_PROP2(fo_clip_);
_CP_APPLY_PROP2(draw_wrap_influence_on_position_);
common_draw_fill_attlist_.apply_from(Other.common_draw_fill_attlist_);
common_draw_rel_size_attlist_.apply_from(Other.common_draw_rel_size_attlist_);
common_horizontal_margin_attlist_.apply_from(Other.common_horizontal_margin_attlist_);
common_vertical_margin_attlist_.apply_from(Other.common_vertical_margin_attlist_);
common_margin_attlist_.apply_from(Other.common_margin_attlist_);
common_horizontal_pos_attlist_.apply_from(Other.common_horizontal_pos_attlist_);
common_horizontal_rel_attlist_.apply_from(Other.common_horizontal_rel_attlist_);
common_vertical_pos_attlist_.apply_from(Other.common_vertical_pos_attlist_);
common_vertical_rel_attlist_.apply_from(Other.common_vertical_rel_attlist_);
common_text_anchor_attlist_.apply_from(Other.common_text_anchor_attlist_);
common_border_attlist_.apply_from(Other.common_border_attlist_);
common_border_line_width_attlist_.apply_from(Other.common_border_line_width_attlist_);
common_padding_attlist_.apply_from(Other.common_padding_attlist_);
common_shadow_attlist_.apply_from(Other.common_shadow_attlist_);
common_background_color_attlist_.apply_from(Other.common_background_color_attlist_);
_CP_APPLY_PROP(style_background_image_, Other.style_background_image_);
}
void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar_t * ns, const wchar_t * name )
{
CP_XML_WRITER(_Wostream)
......@@ -121,8 +180,7 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
}
}
// style:graphic-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
//------------------------------------
const wchar_t * style_graphic_properties::ns = L"style";
const wchar_t * style_graphic_properties::name = L"graphic-properties";
......@@ -131,6 +189,14 @@ void style_graphic_properties::serialize(std::wostream & strm)
content_.serialize(strm,ns,name);
}
//------------------------------------
const wchar_t * loext_graphic_properties::ns = L"loext";
const wchar_t * loext_graphic_properties::name = L"graphic-properties";
void loext_graphic_properties::serialize(std::wostream & strm)
{
content_.serialize(strm,ns,name);
}
}
}
......@@ -147,8 +147,7 @@ public:
office_element_ptr style_background_image_;
};
/// \class style_graphic_properties
/// style:graphic-properties
class style_graphic_properties : public office_element_impl<style_graphic_properties>
{
public:
......@@ -170,7 +169,26 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(style_graphic_properties);
class loext_graphic_properties : public office_element_impl<loext_graphic_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleGraphicPropertis;
CPDOCCORE_DEFINE_VISITABLE()
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
graphic_format_properties content_;
};
CP_REGISTER_OFFICE_ELEMENT2(loext_graphic_properties);
}
}
......@@ -75,17 +75,33 @@ style_paragraph_properties * style_content::get_style_paragraph_properties()
return dynamic_cast<style_paragraph_properties *>(style_paragraph_properties_.get());
}
style_graphic_properties * style_content::get_style_graphic_properties()
graphic_format_properties * style_content::get_graphic_properties()
{
if (!style_graphic_properties_)
create_element(L"style", L"graphic-properties",style_graphic_properties_, Context);
if (!style_graphic_properties_)
{
if (style_family_ == odf_types::style_family::TableCell)
create_element(L"loext", L"graphic-properties", style_graphic_properties_, Context);
else
create_element(L"style", L"graphic-properties", style_graphic_properties_, Context);
}
style_graphic_properties * style_gr = dynamic_cast<style_graphic_properties *>(style_graphic_properties_.get());
loext_graphic_properties * loext_gr = dynamic_cast<loext_graphic_properties *>(style_graphic_properties_.get());
if (style_gr)
{
return &style_gr->content_;
}
else if (loext_gr)
{
return &loext_gr->content_;
}
return NULL;
return dynamic_cast<style_graphic_properties *>(style_graphic_properties_.get());
}
style_table_properties * style_content::get_style_table_properties()
{
if (!style_table_properties_)
create_element(L"style", L"table-properties",style_table_properties_, Context);
create_element(L"style", L"table-properties", style_table_properties_, Context);
return dynamic_cast<style_table_properties *>(style_table_properties_.get());
}
......
......@@ -72,9 +72,10 @@
namespace cpdoccore {
namespace odf_writer {
class graphic_format_properties;
class style_text_properties;
class style_paragraph_properties;
class style_graphic_properties;
class style_section_properties;
class style_table_cell_properties;
class style_table_row_properties;
......@@ -88,13 +89,14 @@ class style_content : noncopyable
public:
style_content(odf_conversion_context * _context){Context = _context;}
void create_child_element( const std::wstring & Ns, const std::wstring & Name);
void add_child_element( const office_element_ptr & child);
void serialize(std::wostream & strm);
void create_child_element ( const std::wstring & Ns, const std::wstring & Name);
void add_child_element ( const office_element_ptr & child);
void serialize (std::wostream & strm);
style_text_properties * get_style_text_properties();
graphic_format_properties * get_graphic_properties() ;
style_text_properties * get_style_text_properties();
style_paragraph_properties * get_style_paragraph_properties() ;
style_graphic_properties * get_style_graphic_properties() ;
style_table_properties * get_style_table_properties();
style_section_properties * get_style_section_properties();
style_table_cell_properties * get_style_table_cell_properties();
......@@ -103,9 +105,9 @@ public:
style_chart_properties * get_style_chart_properties() ;
style_drawing_page_properties* get_style_drawing_page_properties();
odf_types::style_family style_family_;
private:
odf_conversion_context * Context;
odf_types::style_family style_family_;
office_element_ptr style_text_properties_;
office_element_ptr style_paragraph_properties_;
......@@ -349,7 +351,6 @@ public:
virtual void serialize(std::wostream & strm);
// attr
std::wstring style_name_;
_CP_OPT( std::wstring ) style_display_name_;
odf_types::style_family style_family_;
......@@ -363,7 +364,6 @@ public:
_CP_OPT( std::wstring ) style_class_;
_CP_OPT(std::wstring) style_default_outline_level_;
style_content content_;
office_element_ptr_array style_map_;
......
......@@ -54,11 +54,11 @@ 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;
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
......@@ -70,19 +70,20 @@ public:
_CP_OPT(std::wstring) table_print_ranges_;
_CP_OPT(odf_types::Bool) table_protected_; // default false
bool table_print_; // default true
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;
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;
void serialize(CP_ATTR_NODE);
friend class table_table;
};
// table-table-row-attlist
//-----------------------------------------------------------------------------------------------------
class table_table_row_attlist
{
public:
......@@ -97,7 +98,7 @@ public:
void serialize(CP_ATTR_NODE);
};
// table-table-cell-attlist
//-----------------------------------------------------------------------------------------------------
class table_table_cell_attlist
{
public:
......@@ -115,12 +116,12 @@ public:
void serialize(CP_ATTR_NODE);
};
// table-table-cell-attlist-extra
//-----------------------------------------------------------------------------------------------------
class table_table_cell_attlist_extra
{
public:
_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_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_;
......@@ -152,9 +153,7 @@ public:
void serialize(CP_ATTR_NODE);
};
/// \class table_table_source
/// \brief table:table-source
/// table-table-source
//-----------------------------------------------------------------------------------------------------
class table_table_source : public office_element_impl<table_table_source>
{
public:
......@@ -177,7 +176,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_source);
// table-columns
//-----------------------------------------------------------------------------------------------------
class table_columns
{
public:
......@@ -192,7 +191,7 @@ public:
};
// table-columns-no-group
//-----------------------------------------------------------------------------------------------------
class table_columns_no_group: public office_element
{
public:
......@@ -226,7 +225,7 @@ private:
};
// table-columns-and-groups
//-----------------------------------------------------------------------------------------------------
class table_columns_and_groups
{
public:
......@@ -244,7 +243,7 @@ public:
};
// table-table-column-attlist
//-----------------------------------------------------------------------------------------------------
class table_table_column_attlist
{
public:
......@@ -258,9 +257,7 @@ public:
void serialize(CP_ATTR_NODE);
};
// \class table_table_column
// table:table-column
// table-table-column
//-----------------------------------------------------------------------------------------------------
class table_table_column : public office_element_impl<table_table_column>
{
public:
......@@ -283,9 +280,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_column);
// \class table_table_columns
// table:table-columns
// table-table-columns
//-----------------------------------------------------------------------------------------------------
class table_table_columns : public office_element_impl<table_table_columns>
{
public:
......@@ -307,9 +302,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_columns);
// \class table_table_header_columns
// table:table-header-columns
// table-table-header-columns
//-----------------------------------------------------------------------------------------------------
class table_table_header_columns : public office_element_impl<table_table_header_columns>
{
public:
......@@ -369,9 +362,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_column_group);
/// \class table_table_row
/// \brief table:table-row
/// table-table-row
//-----------------------------------------------------------------------------------------------------
class table_table_row : public office_element_impl<table_table_row>
{
public:
......@@ -394,8 +385,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_row);
// \class table_table_cell_content
// table-table-cell-content
//-----------------------------------------------------------------------------------------------------
class table_table_cell_content
{
public:
......@@ -410,9 +400,7 @@ private:
office_element_ptr_array text_content_; // text-content
};
// \class table_table_cell
// table-table-cell
// table:table-cell
//-----------------------------------------------------------------------------------------------------
class table_table_cell : public office_element_impl<table_table_cell>
{
public:
......@@ -430,17 +418,15 @@ public:
virtual void serialize(std::wostream & _Wostream);
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_;
table_table_cell_content table_table_cell_content_;
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_;
table_table_cell_content table_table_cell_content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell);
// \class table_covered_table_cell
// table-covered-table-cell
// table:covered-table-cell
//-----------------------------------------------------------------------------------------------------
class table_covered_table_cell : public office_element_impl<table_covered_table_cell>
{
public:
......@@ -466,9 +452,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_covered_table_cell);
// \class table_table_rows
// table-table-rows
// table:table-rows
//-----------------------------------------------------------------------------------------------------
class table_table_rows : public office_element_impl<table_table_rows>
{
public:
......@@ -494,9 +478,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_rows);
// \class table_table_header_rows
// table-table-header-rows
// table:table-header-rows
//-----------------------------------------------------------------------------------------------------
class table_table_header_rows : public office_element_impl<table_table_header_rows>
{
public:
......@@ -517,9 +499,7 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows);
// \class table_rows
// table-rows
//-----------------------------------------------------------------------------------------------------
class table_rows
{
public:
......@@ -533,7 +513,7 @@ public:
};
// table-rows-no-group
//-----------------------------------------------------------------------------------------------------
class table_rows_no_group : public office_element
{
public:
......@@ -567,7 +547,7 @@ private:
};
// table-rows-and-groups
//-----------------------------------------------------------------------------------------------------
class table_rows_and_groups
{
public:
......@@ -587,15 +567,14 @@ public:
};
// table-table-row-group-attlist
//-----------------------------------------------------------------------------------------------------
class table_table_row_group_attlist
{
public:
table_table_row_group_attlist() : table_display_(true) {}
bool table_display_; // default true
};
// table:table-row-group
//-----------------------------------------------------------------------------------------------------
class table_table_row_group : public office_element_impl<table_table_row_group>
{
public:
......@@ -621,9 +600,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group);
/// \class table_table
/// \brief table:table
/// table-table
//-----------------------------------------------------------------------------------------------------
class table_table : public office_element_impl<table_table>
{
public:
......@@ -654,9 +631,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table);
/// \class table_shapes
/// \brief table:shapes
/// table-shapes
//-----------------------------------------------------------------------------------------------------
class table_shapes : public office_element_impl<table_shapes>
{
public:
......
......@@ -268,8 +268,8 @@ namespace PPTX
class GraphicFrame;
class SpTree;
class Shape;
class CxnSp;
class Pic;
class Table;
class SmartArt;
class ChartRec;
class SpPr;
......@@ -295,6 +295,8 @@ namespace PPTX
class NvSpPr;
class CNvPr;
class CNvSpPr;
class CNvCxnSpPr;
class NvCxnSpPr;
class NvPr;
class Paragraph;
class TxBody;
......@@ -312,6 +314,10 @@ namespace PPTX
class QuadBezTo;
class CubicBezTo;
class Close;
class EffectStyle;
class InnerShdw;
class OuterShdw;
class PrstShdw;
}
}
......@@ -359,10 +365,12 @@ public:
void convert(PPTX::Logic::GraphicFrame *oox_graphicFrame);
void convert(PPTX::Logic::SpTree *oox_shape_tree);
void convert(PPTX::Logic::Shape *oox_shape);
void convert(PPTX::Logic::CxnSp *oox_connect);
void convert(PPTX::Logic::Pic *oox_pic);
void convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::TextSpacing *oox_spacing, cpdoccore::odf_types::length_or_percent & length_or_percent);
void convert(PPTX::Logic::Xfrm *oox_xfrm);
void convert(PPTX::Logic::Xfrm *oox_txbx, PPTX::Logic::Xfrm *oox_xfrm);
int convert(PPTX::Logic::PrstTxWarp *oox_text_preset);
void convert(PPTX::Logic::PrstGeom *oox_geom);
void convert(PPTX::Logic::CustGeom *oox_geom);
......@@ -370,8 +378,7 @@ public:
void convert(PPTX::Logic::GradFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::SolidFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::PattFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::EffectLst *oox_effect_lst);
void convert(PPTX::Logic::Ln *oox_line);
void convert(PPTX::Logic::Ln *oox_line, DWORD ARGB = 0, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::FontRef *oox_fontRef);
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
void convert(PPTX::Logic::Path2D *oox_path2D);
......@@ -381,7 +388,9 @@ public:
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
void convert(PPTX::Logic::NvSpPr *oox_nvSpPr);
void convert(PPTX::Logic::CNvPr *oox_cnvPr);
void convert(PPTX::Logic::CNvCxnSpPr *oox_cnvPr);
void convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr);
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
......@@ -394,13 +403,18 @@ public:
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
void convert(PPTX::Logic::ChartRec *oox_chart);
void convert(PPTX::Logic::SmartArt *oox_smart_art);
void convert(PPTX::Logic::Table *oox_table);
void convert(PPTX::Logic::LineTo *oox_geom_path);
void convert(PPTX::Logic::MoveTo *oox_geom_path);
void convert(PPTX::Logic::ArcTo *oox_geom_path);
void convert(PPTX::Logic::QuadBezTo *oox_geom_path);
void convert(PPTX::Logic::CubicBezTo *oox_geom_path);
void convert(PPTX::Logic::Close *oox_geom_path);
void convert(PPTX::Logic::EffectStyle *oox_effect);
void convert(PPTX::Logic::EffectLst *oox_effect_list);
void convert(PPTX::Logic::InnerShdw *oox_effect);
void convert(PPTX::Logic::OuterShdw *oox_effect);
void convert(PPTX::Logic::PrstShdw *oox_effect);
//.chart............................................................................................................................
void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart);
void convert(OOX::Spreadsheet::CT_Title *ct_title);
......
......@@ -3011,8 +3011,8 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style)
/////////////////////////////////////////////////////////////////////////////////////////////////
//зачемто ?! для OpenOffice для врезок/фреймов нужен базовый стиль - без него другой тип геометрии oO !!!
odt_context->styles_context()->create_style(L"Frame", odf_types::style_family::Graphic,false,true);
odf_writer::style_graphic_properties * graphic_properties = odt_context->styles_context()->last_state()->get_graphic_properties();
odt_context->styles_context()->create_style(L"Frame", odf_types::style_family::Graphic,false, true);
odf_writer::graphic_format_properties * graphic_properties = odt_context->styles_context()->last_state()->get_graphic_properties();
//if (graphic_properties)graphic_properties->content_.common_background_color_attlist_.fo_background_color_ = odf_types::background_color(odf_types::background_color::Transparent);
}
......@@ -3876,7 +3876,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
}
}
odt_context->start_table_cell( oox_table_cell->m_nNumCol,covered, convert(oox_table_cell->m_oTableCellProperties, oox_table_cell->m_nNumCol+1));
odt_context->start_table_cell( oox_table_cell->m_nNumCol, covered, convert(oox_table_cell->m_oTableCellProperties, oox_table_cell->m_nNumCol + 1));
if (oox_table_cell->m_oTableCellProperties)
{
......@@ -3909,7 +3909,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
if (id_change_properties >= 0)
odt_context->end_change(id_change_properties, 3);
}
bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_properties * table_properties )
bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_properties * table_properties )
{
if (oox_table_pr == NULL) return false;
if (table_properties == NULL) return false;
......
......@@ -46,6 +46,7 @@ namespace OOX
}
namespace PPTX
{
class TableStyles;
class Presentation;
class Folder;
......@@ -55,6 +56,13 @@ namespace PPTX
class Bg;
class Transition;
class Timing;
class TablePartStyle;
class Table;
class TableProperties;
class TableRow;
class TableCell;
class TableCellProperties;
class TcBdr;
}
}
......@@ -95,15 +103,29 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert(PPTX::Logic::CSld *oox_slide, bool placeholders = true);
void convert(PPTX::Logic::Bg *oox_background);
private:
void convert(PPTX::Logic::CSld *oox_slide, bool placeholders = true);
void convert(PPTX::Logic::Bg *oox_background);
void convert(PPTX::Logic::Table *oox_table);
void convert(PPTX::Logic::TableRow *oox_table_row);
void convert(PPTX::Logic::TableCell *oox_table_cell, int numCol);
void convert(PPTX::Logic::TablePartStyle *oox_table_part_style);
bool convert(PPTX::Logic::TableCellProperties *oox_table_cell_pr, int col);
bool convert(PPTX::Logic::TableCellProperties *oox_table_cell_pr);
void convert(PPTX::Logic::TableProperties *oox_table_pr);
void convert(PPTX::Logic::TcBdr *oox_table_borders);
void convert(PPTX::Logic::Ln *oox_ln_border, std::wstring & odf_border);
private:
PPTX::Folder *pptx_document;
PPTX::Presentation *presentation;
cpdoccore::odf_writer::package::odf_document *output_document;
PPTX::Theme *current_theme;
PPTX::Theme *current_theme;
PPTX::TableStyles *current_tableStyles;
OOX::IFileContainer *current_slide;
PPTX::Logic::ClrMap *current_clrMap;
......
......@@ -122,8 +122,6 @@ namespace PPTX
List->toXmlWriter(pWriter);
}
//public:
private:
nullable<WrapperWritingElement> List;
protected:
virtual void FillParentPointersForChilds(){};
......
......@@ -52,6 +52,7 @@ namespace PPTX
TableCellProperties()
{
is_empty = true;
}
TableCellProperties& operator=(const TableCellProperties& oSrc)
......@@ -76,6 +77,9 @@ namespace PPTX
Anchor = oSrc.Anchor;
AnchorCtr = oSrc.AnchorCtr;
HorzOverflow = oSrc.HorzOverflow;
is_empty = oSrc.is_empty;
return *this;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -107,9 +111,13 @@ namespace PPTX
else
Fill.fromXML(oReader);
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
is_empty = (oReader.GetAttributesCount() == 0);
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("marL"), MarL )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("marR"), MarR )
......@@ -123,6 +131,8 @@ namespace PPTX
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
is_empty = (node.GetAttributesCount() == 0);
LnL = node.ReadNode(_T("a:lnL"));
LnR = node.ReadNode(_T("a:lnR"));
LnT = node.ReadNode(_T("a:lnT"));
......@@ -324,7 +334,6 @@ namespace PPTX
pReader->Seek(_end_rec);
}
public:
nullable<Ln> LnL;
nullable<Ln> LnR;
nullable<Ln> LnT;
......@@ -335,17 +344,22 @@ namespace PPTX
UniFill Fill;
// <xsd:element name="headers" type="CT_Headers" minOccurs="0"/>
nullable_int MarL;//default="91440"
nullable_int MarR;//default="91440"
nullable_int MarT;//default="45720"
nullable_int MarB;//default="45720"
nullable_limit<Limit::TextVerticalType> Vert;//default="horz"
nullable_limit<Limit::TextAnchor> Anchor;//default="t"
nullable_bool AnchorCtr;//default="false"
nullable_limit<Limit::HorzOverflow> HorzOverflow;//default="clip"
nullable_int MarL; //default="91440"
nullable_int MarR; //default="91440"
nullable_int MarT; //default="45720"
nullable_int MarB; //default="45720"
nullable_limit<Limit::TextVerticalType> Vert; //default="horz"
nullable_limit<Limit::TextAnchor> Anchor; //default="t"
nullable_bool AnchorCtr; //default="false"
nullable_limit<Limit::HorzOverflow> HorzOverflow; //default="clip"
bool is_empty;
protected:
virtual void FillParentPointersForChilds()
{
is_empty = is_empty & !(LnL.IsInit() || LnR.IsInit() || LnT.IsInit() || LnB.IsInit() || LnTlToBr.IsInit() || LnBlToTr.IsInit() ||
cell3D.IsInit() || Fill.is_init());
if(LnL.IsInit())
LnL->SetParentPointer(this);
if(LnR.IsInit())
......
......@@ -618,7 +618,7 @@ namespace OOX
CTableCellProperties *GetProperties()
{
for ( size_t nIndex = m_arrItems.size() - 1; nIndex >= 0; nIndex-- )
for ( int nIndex = (int)m_arrItems.size() - 1; nIndex >= 0; nIndex-- )
{
if ( m_arrItems[nIndex] && OOX::et_w_tcPr == m_arrItems[nIndex]->getType() )
{
......
......@@ -208,6 +208,8 @@ namespace XmlUtils
std::wstring ReadAttributeBase(const wchar_t* bstrName);
std::wstring ReadAttribute(const std::wstring& strAttibuteName);
int GetAttributesCount();
std::string GetAttributeA(const std::string& sName, const std::string& _default = "");
std::string GetAttributeA(const std::wstring& sName, const std::string& _default = "");
......
......@@ -434,6 +434,15 @@ namespace XmlUtils
{
return GetAttribute(std::wstring(strAttributeName), strDefaultValue);
}
int CXmlNode::GetAttributesCount()
{
if (IsValid())
{
return m_pBase->m_attributes.size();
}
else
return 0;
}
bool CXmlNode::GetAttributeIfExist(const std::wstring& sName, std::wstring& sOutput)
{
bool bRes = false;
......
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