Commit 19960fa3 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation tables

parent 32121d6d
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" 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" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
......
...@@ -105,7 +105,7 @@ SOURCES += \ ...@@ -105,7 +105,7 @@ SOURCES += \
../source/OdfFormat/odp_page_state.cpp \ ../source/OdfFormat/odp_page_state.cpp \
../source/OdfFormat/odp_slide_context.cpp \ ../source/OdfFormat/odp_slide_context.cpp \
../source/OdfFormat/office_presentation.cpp \ ../source/OdfFormat/office_presentation.cpp \
../source/OdfFormat/style_presentation.cpp \ ../source/OdfFormat/style_presentation.cpp
} }
SOURCES += \ SOURCES += \
...@@ -115,9 +115,7 @@ SOURCES += \ ...@@ -115,9 +115,7 @@ SOURCES += \
../source/Oox2OdfConverter/DocxConverter.cpp \ ../source/Oox2OdfConverter/DocxConverter.cpp \
../source/Oox2OdfConverter/XlsxConverter.cpp \ ../source/Oox2OdfConverter/XlsxConverter.cpp \
../source/Oox2OdfConverter/ConvertDrawing.cpp \ ../source/Oox2OdfConverter/ConvertDrawing.cpp \
../source/Oox2OdfConverter/PptxConverter.cpp \ ../source/Oox2OdfConverter/PptxConverter.cpp
../source/OdfFormat/anim_elements.cpp \
../source/OdfFormat/style_presentation.cpp
HEADERS += \ HEADERS += \
../source/OdfFormat/abstract_xml.h \ ../source/OdfFormat/abstract_xml.h \
......
...@@ -109,7 +109,7 @@ namespace odf_writer ...@@ -109,7 +109,7 @@ namespace odf_writer
struct odf_chart_level_state struct odf_chart_level_state
{ {
style_text_properties *text_properties_; style_text_properties *text_properties_;
style_graphic_properties *graphic_properties_; graphic_format_properties *graphic_properties_;
style_paragraph_properties *paragraph_properties_; style_paragraph_properties *paragraph_properties_;
style_chart_properties *chart_properties_; style_chart_properties *chart_properties_;
...@@ -297,8 +297,8 @@ void odf_chart_context::Impl::set_default_series_color() ...@@ -297,8 +297,8 @@ void odf_chart_context::Impl::set_default_series_color()
color col = color(default_MS_series_colors[current_series_count_]); 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_->common_draw_fill_attlist_.draw_fill_color_ = col;
current_level_.back().graphic_properties_->content_.svg_stroke_color_ = col; current_level_.back().graphic_properties_->svg_stroke_color_ = col;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
...@@ -641,7 +641,7 @@ void odf_chart_context::start_series(std::wstring type) ...@@ -641,7 +641,7 @@ void odf_chart_context::start_series(std::wstring type)
if (style_) 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(); impl_->set_default_series_color();
} }
...@@ -968,7 +968,7 @@ void odf_chart_context::start_floor() ...@@ -968,7 +968,7 @@ void odf_chart_context::start_floor()
if (style_) 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() void odf_chart_context::start_wall()
...@@ -993,9 +993,9 @@ void odf_chart_context::start_wall() ...@@ -993,9 +993,9 @@ void odf_chart_context::start_wall()
if (style_) 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_) 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() void odf_chart_context::start_legend()
...@@ -1036,7 +1036,7 @@ void odf_chart_context::start_stock_range_line() ...@@ -1036,7 +1036,7 @@ void odf_chart_context::start_stock_range_line()
style_name = style_->style_name_; style_name = style_->style_name_;
line->common_attlist_.chart_style_name_ = 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(); impl_->set_default_series_color();
} }
start_element(elm, style_elm, style_name); start_element(elm, style_elm, style_name);
...@@ -1059,7 +1059,7 @@ void odf_chart_context::start_stock_gain_marker() ...@@ -1059,7 +1059,7 @@ void odf_chart_context::start_stock_gain_marker()
style_name = style_->style_name_; style_name = style_->style_name_;
marker->common_attlist_.chart_style_name_ = 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(); impl_->set_default_series_color();
} }
start_element(elm, style_elm, style_name); start_element(elm, style_elm, style_name);
...@@ -1082,7 +1082,7 @@ void odf_chart_context::start_stock_loss_marker() ...@@ -1082,7 +1082,7 @@ void odf_chart_context::start_stock_loss_marker()
style_name = style_->style_name_; style_name = style_->style_name_;
marker->common_attlist_.chart_style_name_ = 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(); impl_->set_default_series_color();
} }
start_element(elm, style_elm, style_name); start_element(elm, style_elm, style_name);
...@@ -1219,7 +1219,7 @@ void odf_chart_context::set_no_fill(bool Val) ...@@ -1219,7 +1219,7 @@ void odf_chart_context::set_no_fill(bool Val)
if (Val == false)return; if (Val == false)return;
if (!impl_->current_level_.back().graphic_properties_)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) void odf_chart_context::set_axis_tick_major(int type)
......
...@@ -121,6 +121,9 @@ public: ...@@ -121,6 +121,9 @@ public:
void start_shape (int type); void start_shape (int type);
void end_shape (); void end_shape ();
void start_frame ();
void end_frame ();
bool change_text_box_2_wordart(); bool change_text_box_2_wordart();
void start_image (std::wstring file_path); void start_image (std::wstring file_path);
...@@ -249,9 +252,6 @@ public: ...@@ -249,9 +252,6 @@ public:
private: private:
void start_frame();
void end_frame();
class Impl; class Impl;
_CP_PTR(Impl) impl_; _CP_PTR(Impl) impl_;
......
...@@ -102,9 +102,9 @@ void odf_style_context::create_style(std::wstring oox_name, style_family::type f ...@@ -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_.push_back( state );
/////////////////////////////////////// ///////////////////////////////////////
style_state_list_.back()->set_name(odf_name); style_state_list_.back()->set_name (odf_name);
style_state_list_.back()->set_automatic(automatic); style_state_list_.back()->set_automatic (automatic);
style_state_list_.back()->set_root(root); style_state_list_.back()->set_root (root);
style_state_list_.back()->style_oox_id_ = oox_id; style_state_list_.back()->style_oox_id_ = oox_id;
......
...@@ -60,12 +60,14 @@ namespace odf_writer { ...@@ -60,12 +60,14 @@ namespace odf_writer {
if (style_) if (style_)
{ {
style_->style_family_ = style_family(style_family_); style_->style_family_ = style_family(style_family_);
style_->content_.style_family_ = style_family_;
} }
default_style* default_style_ = dynamic_cast<default_style*>(elm.get()); default_style* default_style_ = dynamic_cast<default_style*>(elm.get());
if (default_style_) if (default_style_)
{ {
default_style_->style_family_ = style_family(style_family_); default_style_->style_family_ = style_family(style_family_);
default_style_->content_.style_family_ = style_family_;
} }
list_style_exist = false; list_style_exist = false;
...@@ -112,6 +114,12 @@ style_family::type odf_style_state::get_family_type() ...@@ -112,6 +114,12 @@ style_family::type odf_style_state::get_family_type()
{ {
return style_family_; 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) void odf_style_state::set_parent_style_name(std::wstring name)
{ {
if (name.length() < 1) return; if (name.length() < 1) return;
...@@ -229,16 +237,17 @@ style_paragraph_properties * odf_style_state::get_paragraph_properties() ...@@ -229,16 +237,17 @@ style_paragraph_properties * odf_style_state::get_paragraph_properties()
return NULL; 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()); 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()); 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; return NULL;
} }
style_table_properties * odf_style_state::get_table_properties() style_table_properties * odf_style_state::get_table_properties()
{ {
style* style_ = dynamic_cast<style*>(odf_style_.get()); style* style_ = dynamic_cast<style*>(odf_style_.get());
...@@ -304,13 +313,14 @@ style_chart_properties * odf_style_state::get_chart_properties() ...@@ -304,13 +313,14 @@ style_chart_properties * odf_style_state::get_chart_properties()
return NULL; return NULL;
} }
//style_drawing_page_properties * odf_style_state::get_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; style* style_ = dynamic_cast<style*>(odf_style_.get());
// if (!style_)return NULL;
// return style_->content_.get_style_drawing_page_properties();
//} return style_->content_.get_style_drawing_page_properties();
}
/////////////////////// ///////////////////////
......
...@@ -45,16 +45,17 @@ class style; ...@@ -45,16 +45,17 @@ class style;
class odf_conversion_context; class odf_conversion_context;
class odf_style_context; class odf_style_context;
class graphic_format_properties;
class style_text_properties; class style_text_properties;
class style_paragraph_properties; class style_paragraph_properties;
class style_graphic_properties;
class style_table_properties; class style_table_properties;
class style_section_properties; class style_section_properties;
class style_table_cell_properties; class style_table_cell_properties;
class style_table_row_properties; class style_table_row_properties;
class style_table_column_properties; class style_table_column_properties;
class style_chart_properties; class style_chart_properties;
//class style_drawing_page_properties; class style_drawing_page_properties;
class odf_style_state; class odf_style_state;
typedef shared_ptr<odf_style_state>::Type odf_style_state_ptr; typedef shared_ptr<odf_style_state>::Type odf_style_state_ptr;
...@@ -80,7 +81,8 @@ public: ...@@ -80,7 +81,8 @@ public:
void set_name(std::wstring name); void set_name(std::wstring name);
std::wstring get_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;} void set_number_format(int id) {num_fmt_id_ = id;}
int get_number_format() {return num_fmt_id_;} int get_number_format() {return num_fmt_id_;}
...@@ -91,16 +93,17 @@ public: ...@@ -91,16 +93,17 @@ public:
void set_display_name(std::wstring name); 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_paragraph_properties * get_paragraph_properties() ;
style_graphic_properties * get_graphic_properties() ;
style_table_properties * get_table_properties(); style_table_properties * get_table_properties();
style_section_properties * get_section_properties(); style_section_properties * get_section_properties();
style_table_cell_properties * get_table_cell_properties(); style_table_cell_properties * get_table_cell_properties();
style_table_row_properties * get_table_row_properties() ; style_table_row_properties * get_table_row_properties() ;
style_table_column_properties * get_table_column_properties() ; style_table_column_properties * get_table_column_properties() ;
style_chart_properties * get_chart_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(); bool get_list_style_exist();
int get_list_style_level(); int get_list_style_level();
......
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
#include "table.h" #include "table.h"
#include "style_table_properties.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_paragraph_properties.h"
//#include "style_graphic_properties.h"
namespace cpdoccore namespace cpdoccore
...@@ -151,7 +151,9 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled) ...@@ -151,7 +151,9 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled)
if (!table)return; if (!table)return;
odf_table_state state; 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) if (styled)
{ {
...@@ -160,14 +162,12 @@ void odf_table_context::start_table(office_element_ptr &elm, bool 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_elm = style_state->get_office_element();
state.table.style_name = style_state->get_name(); state.table.style_name = style_state->get_name();
table->table_table_attlist_.table_style_name_ = state.table.style_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_->default_cell_properties = L"";
impl_->start_table(state); impl_->start_table(state);
} }
void odf_table_context::end_table() void odf_table_context::end_table()
{ {
...@@ -196,27 +196,31 @@ void odf_table_context::start_row(office_element_ptr &elm, bool styled) ...@@ -196,27 +196,31 @@ void odf_table_context::start_row(office_element_ptr &elm, bool styled)
{ {
if (impl_->empty()) return; 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; if (!row)return;
odf_element_state state; odf_element_state state;
state.elm = elm; state.elm = elm;
if (styled) if (styled)
{ {
odf_style_state_ptr style_state = impl_->styles_context()->last_state(style_family::TableRow); odf_style_state_ptr style_state = impl_->styles_context()->last_state(style_family::TableRow);
if (style_state) if (style_state)
{ {
state.style_elm = style_state->get_office_element(); state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name(); state.style_name = style_state->get_name();
row->table_table_row_attlist_.table_style_name_ = state.style_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().rows.push_back(state);
impl_->current_table().current_column =0; impl_->current_table().current_column = 0;
impl_->current_table().current_row ++; impl_->current_table().current_row ++;
} }
...@@ -411,8 +415,9 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled) ...@@ -411,8 +415,9 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
{ {
if (impl_->empty()) return; if (impl_->empty()) return;
table_table_cell * cell = dynamic_cast<table_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()); table_covered_table_cell* covered_cell = dynamic_cast<table_covered_table_cell *>(elm.get());
if (!cell && !covered_cell)return; if (!cell && !covered_cell)return;
odf_element_state state; odf_element_state state;
...@@ -423,10 +428,32 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled) ...@@ -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); odf_style_state_ptr style_state = impl_->styles_context()->last_state(style_family::TableCell);
if (style_state) if (style_state)
{ {
state.style_elm = style_state->get_office_element(); state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name(); state.style_name = style_state->get_name();
cell->table_table_cell_attlist_.table_style_name_ = state.style_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) //if (cell)
//{ //{
...@@ -438,6 +465,7 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled) ...@@ -438,6 +465,7 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
impl_->current_table().current_column++; impl_->current_table().current_column++;
} }
void odf_table_context::set_cell_column_span(int spanned) void odf_table_context::set_cell_column_span(int spanned)
{ {
if (impl_->empty()) return; if (impl_->empty()) return;
...@@ -449,16 +477,24 @@ void odf_table_context::set_cell_column_span(int spanned) ...@@ -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; 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; if (spanned > 0)
odf_column_state & state = impl_->current_table().columns[col]; {
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() void odf_table_context::set_cell_row_span_restart()
......
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
void start_cell(office_element_ptr &elm, bool styled = false); void start_cell(office_element_ptr &elm, bool styled = false);
void set_cell_column_span(int spanned); 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 set_cell_row_span_restart();
void end_cell(); void end_cell();
......
...@@ -53,8 +53,7 @@ namespace odf_writer { ...@@ -53,8 +53,7 @@ namespace odf_writer {
odp_conversion_context::odp_conversion_context(package::odf_document * outputDocument) odp_conversion_context::odp_conversion_context(package::odf_document * outputDocument)
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this) : odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this), text_context_(NULL)
//, current_text_context_(NULL)
{ {
} }
...@@ -102,14 +101,14 @@ void odp_conversion_context::end_slide() ...@@ -102,14 +101,14 @@ void odp_conversion_context::end_slide()
void odp_conversion_context::start_text_context() 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() void odp_conversion_context::end_text_context()
{ {
if (current_text_context_) if (text_context_)
delete current_text_context_; delete text_context_;
current_text_context_ = NULL; text_context_ = NULL;
} }
void odp_conversion_context::start_drawings() void odp_conversion_context::start_drawings()
......
...@@ -55,15 +55,16 @@ public: ...@@ -55,15 +55,16 @@ public:
void start_master_slide(std::wstring name); void start_master_slide(std::wstring name);
void end_master_slide(); 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 start_text_context();
virtual void end_text_context(); virtual void end_text_context();
virtual odf_drawing_context * drawing_context() {return current_slide().drawing_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 start_drawings();
void end_drawings(); void end_drawings();
...@@ -72,7 +73,7 @@ public: ...@@ -72,7 +73,7 @@ public:
private: private:
odp_slide_context slide_context_; odp_slide_context slide_context_;
odf_text_context* current_text_context_; odf_text_context* text_context_;
office_presentation* root_presentation_; office_presentation* root_presentation_;
}; };
......
...@@ -29,12 +29,11 @@ ...@@ -29,12 +29,11 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#include "logging.h"
#include "odp_slide_context.h"
#include "odp_conversion_context.h" #include "odp_conversion_context.h"
#include "logging.h" #include "odp_slide_context.h"
#include "odf_text_context.h"
#include <iostream> #include <iostream>
...@@ -45,7 +44,7 @@ namespace cpdoccore { ...@@ -45,7 +44,7 @@ namespace cpdoccore {
namespace odf_writer { 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(); styles_context_ = Context.styles_context();
} }
...@@ -81,5 +80,172 @@ void odp_slide_context::end_page() ...@@ -81,5 +80,172 @@ void odp_slide_context::end_page()
state().drawing_context()->finalize(state().page_elm_); 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 @@ ...@@ -31,9 +31,11 @@
*/ */
#pragma once #pragma once
#include <string>
#include "odp_page_state.h" #include "odp_page_state.h"
#include "odf_table_context.h"
#include "odf_comment_context.h"
namespace cpdoccore { namespace cpdoccore {
namespace odf_writer { namespace odf_writer {
...@@ -55,11 +57,29 @@ public: ...@@ -55,11 +57,29 @@ public:
odp_page_state & state(); 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: private:
odp_conversion_context& context_; odp_conversion_context& context_;
odf_style_context* styles_context_; odf_style_context* styles_context_;
odf_table_context table_context_;
odf_comment_context comment_context_;
std::list<odp_page_state> page_state_list_; std::list<odp_page_state> page_state_list_;
friend class odp_conversion_context; friend class odp_conversion_context;
......
...@@ -231,7 +231,6 @@ void ods_table_context::start_table(office_element_ptr & elm) ...@@ -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); 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"); style->create_child_element(L"style", L"table-properties");
state().set_table_style(style); state().set_table_style(style);
state().set_table_hidden(false); state().set_table_hidden(false);
......
...@@ -44,8 +44,8 @@ class office_text; ...@@ -44,8 +44,8 @@ class office_text;
class odf_text_context; class odf_text_context;
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr; 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_drawing_context>::Type odf_drawing_context_ptr;
struct odt_section_state struct odt_section_state
{ {
......
...@@ -49,6 +49,65 @@ graphic_format_properties::graphic_format_properties() ...@@ -49,6 +49,65 @@ graphic_format_properties::graphic_format_properties()
//style_mirror_ = L"none"; //style_mirror_ = L"none";
//common_draw_fill_attlist_.draw_fill_ = draw_fill::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 ) void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar_t * ns, const wchar_t * name )
{ {
CP_XML_WRITER(_Wostream) CP_XML_WRITER(_Wostream)
...@@ -121,8 +180,7 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar ...@@ -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::ns = L"style";
const wchar_t * style_graphic_properties::name = L"graphic-properties"; const wchar_t * style_graphic_properties::name = L"graphic-properties";
...@@ -131,6 +189,14 @@ void style_graphic_properties::serialize(std::wostream & strm) ...@@ -131,6 +189,14 @@ void style_graphic_properties::serialize(std::wostream & strm)
content_.serialize(strm,ns,name); 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: ...@@ -147,8 +147,7 @@ public:
office_element_ptr style_background_image_; office_element_ptr style_background_image_;
}; };
/// \class style_graphic_properties
/// style:graphic-properties
class style_graphic_properties : public office_element_impl<style_graphic_properties> class style_graphic_properties : public office_element_impl<style_graphic_properties>
{ {
public: public:
...@@ -170,7 +169,26 @@ public: ...@@ -170,7 +169,26 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(style_graphic_properties); 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() ...@@ -75,17 +75,33 @@ style_paragraph_properties * style_content::get_style_paragraph_properties()
return dynamic_cast<style_paragraph_properties *>(style_paragraph_properties_.get()); 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_) if (!style_graphic_properties_)
create_element(L"style", L"graphic-properties",style_graphic_properties_, Context); {
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() style_table_properties * style_content::get_style_table_properties()
{ {
if (!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()); return dynamic_cast<style_table_properties *>(style_table_properties_.get());
} }
......
...@@ -72,9 +72,10 @@ ...@@ -72,9 +72,10 @@
namespace cpdoccore { namespace cpdoccore {
namespace odf_writer { namespace odf_writer {
class graphic_format_properties;
class style_text_properties; class style_text_properties;
class style_paragraph_properties; class style_paragraph_properties;
class style_graphic_properties;
class style_section_properties; class style_section_properties;
class style_table_cell_properties; class style_table_cell_properties;
class style_table_row_properties; class style_table_row_properties;
...@@ -88,13 +89,14 @@ class style_content : noncopyable ...@@ -88,13 +89,14 @@ class style_content : noncopyable
public: public:
style_content(odf_conversion_context * _context){Context = _context;} style_content(odf_conversion_context * _context){Context = _context;}
void create_child_element( const std::wstring & Ns, const std::wstring & Name); void create_child_element ( const std::wstring & Ns, const std::wstring & Name);
void add_child_element( const office_element_ptr & child); void add_child_element ( const office_element_ptr & child);
void serialize(std::wostream & strm); 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_paragraph_properties * get_style_paragraph_properties() ;
style_graphic_properties * get_style_graphic_properties() ;
style_table_properties * get_style_table_properties(); style_table_properties * get_style_table_properties();
style_section_properties * get_style_section_properties(); style_section_properties * get_style_section_properties();
style_table_cell_properties * get_style_table_cell_properties(); style_table_cell_properties * get_style_table_cell_properties();
...@@ -103,9 +105,9 @@ public: ...@@ -103,9 +105,9 @@ public:
style_chart_properties * get_style_chart_properties() ; style_chart_properties * get_style_chart_properties() ;
style_drawing_page_properties* get_style_drawing_page_properties(); style_drawing_page_properties* get_style_drawing_page_properties();
odf_types::style_family style_family_;
private: private:
odf_conversion_context * Context; odf_conversion_context * Context;
odf_types::style_family style_family_;
office_element_ptr style_text_properties_; office_element_ptr style_text_properties_;
office_element_ptr style_paragraph_properties_; office_element_ptr style_paragraph_properties_;
...@@ -349,7 +351,6 @@ public: ...@@ -349,7 +351,6 @@ public:
virtual void serialize(std::wostream & strm); virtual void serialize(std::wostream & strm);
// attr
std::wstring style_name_; std::wstring style_name_;
_CP_OPT( std::wstring ) style_display_name_; _CP_OPT( std::wstring ) style_display_name_;
odf_types::style_family style_family_; odf_types::style_family style_family_;
...@@ -363,7 +364,6 @@ public: ...@@ -363,7 +364,6 @@ public:
_CP_OPT( std::wstring ) style_class_; _CP_OPT( std::wstring ) style_class_;
_CP_OPT(std::wstring) style_default_outline_level_; _CP_OPT(std::wstring) style_default_outline_level_;
style_content content_; style_content content_;
office_element_ptr_array style_map_; office_element_ptr_array style_map_;
......
...@@ -54,11 +54,11 @@ class table_table_attlist ...@@ -54,11 +54,11 @@ class table_table_attlist
public: public:
table_table_attlist() table_table_attlist()
{ {
table_print_ = true; table_print_ = true;
table_use_first_row_styles_ = false; table_use_first_row_styles_ = false;
table_use_banding_rows_styles_ = false; table_use_banding_rows_styles_ = false;
table_use_first_column_styles_ = false; table_use_first_column_styles_ = false;
table_use_banding_columns_styles_ = false; table_use_banding_columns_styles_ = false;
} }
unsigned int table_number_columns_repeated_; // default 1 unsigned int table_number_columns_repeated_; // default 1
...@@ -70,19 +70,20 @@ public: ...@@ -70,19 +70,20 @@ public:
_CP_OPT(std::wstring) table_print_ranges_; _CP_OPT(std::wstring) table_print_ranges_;
_CP_OPT(odf_types::Bool) table_protected_; // default false _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_first_row_styles_; // default false;
bool table_use_banding_rows_styles_; //defualt false; bool table_use_banding_rows_styles_; // defualt false;
bool table_use_first_column_styles_;//defualt false; bool table_use_first_column_styles_; // defualt false;
bool table_use_banding_columns_styles_; //defualt false; bool table_use_banding_columns_styles_; // defualt false;
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
friend class table_table; friend class table_table;
}; };
// table-table-row-attlist //-----------------------------------------------------------------------------------------------------
class table_table_row_attlist class table_table_row_attlist
{ {
public: public:
...@@ -97,7 +98,7 @@ public: ...@@ -97,7 +98,7 @@ public:
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
}; };
// table-table-cell-attlist //-----------------------------------------------------------------------------------------------------
class table_table_cell_attlist class table_table_cell_attlist
{ {
public: public:
...@@ -115,12 +116,12 @@ public: ...@@ -115,12 +116,12 @@ public:
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
}; };
// table-table-cell-attlist-extra //-----------------------------------------------------------------------------------------------------
class table_table_cell_attlist_extra class table_table_cell_attlist_extra
{ {
public: public:
_CP_OPT(unsigned int) table_number_columns_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_rows_spanned_; // default 1
_CP_OPT(unsigned int) table_number_matrix_columns_spanned_; _CP_OPT(unsigned int) table_number_matrix_columns_spanned_;
_CP_OPT(unsigned int) table_number_matrix_rows_spanned_; _CP_OPT(unsigned int) table_number_matrix_rows_spanned_;
...@@ -152,9 +153,7 @@ public: ...@@ -152,9 +153,7 @@ public:
void serialize(CP_ATTR_NODE); 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> class table_table_source : public office_element_impl<table_table_source>
{ {
public: public:
...@@ -177,7 +176,7 @@ public: ...@@ -177,7 +176,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_source); CP_REGISTER_OFFICE_ELEMENT2(table_table_source);
// table-columns //-----------------------------------------------------------------------------------------------------
class table_columns class table_columns
{ {
public: public:
...@@ -192,7 +191,7 @@ public: ...@@ -192,7 +191,7 @@ public:
}; };
// table-columns-no-group //-----------------------------------------------------------------------------------------------------
class table_columns_no_group: public office_element class table_columns_no_group: public office_element
{ {
public: public:
...@@ -226,7 +225,7 @@ private: ...@@ -226,7 +225,7 @@ private:
}; };
// table-columns-and-groups //-----------------------------------------------------------------------------------------------------
class table_columns_and_groups class table_columns_and_groups
{ {
public: public:
...@@ -244,7 +243,7 @@ public: ...@@ -244,7 +243,7 @@ public:
}; };
// table-table-column-attlist //-----------------------------------------------------------------------------------------------------
class table_table_column_attlist class table_table_column_attlist
{ {
public: public:
...@@ -258,9 +257,7 @@ public: ...@@ -258,9 +257,7 @@ public:
void serialize(CP_ATTR_NODE); 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> class table_table_column : public office_element_impl<table_table_column>
{ {
public: public:
...@@ -283,9 +280,7 @@ public: ...@@ -283,9 +280,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_column); 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> class table_table_columns : public office_element_impl<table_table_columns>
{ {
public: public:
...@@ -307,9 +302,7 @@ public: ...@@ -307,9 +302,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_columns); 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> class table_table_header_columns : public office_element_impl<table_table_header_columns>
{ {
public: public:
...@@ -369,9 +362,7 @@ public: ...@@ -369,9 +362,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_column_group); 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> class table_table_row : public office_element_impl<table_table_row>
{ {
public: public:
...@@ -394,8 +385,7 @@ public: ...@@ -394,8 +385,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_row); CP_REGISTER_OFFICE_ELEMENT2(table_table_row);
// \class table_table_cell_content //-----------------------------------------------------------------------------------------------------
// table-table-cell-content
class table_table_cell_content class table_table_cell_content
{ {
public: public:
...@@ -410,9 +400,7 @@ private: ...@@ -410,9 +400,7 @@ private:
office_element_ptr_array text_content_; // text-content 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> class table_table_cell : public office_element_impl<table_table_cell>
{ {
public: public:
...@@ -430,17 +418,15 @@ public: ...@@ -430,17 +418,15 @@ public:
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
table_table_cell_attlist table_table_cell_attlist_; table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_; table_table_cell_attlist_extra table_table_cell_attlist_extra_;
table_table_cell_content table_table_cell_content_; table_table_cell_content table_table_cell_content_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell); 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> class table_covered_table_cell : public office_element_impl<table_covered_table_cell>
{ {
public: public:
...@@ -466,9 +452,7 @@ public: ...@@ -466,9 +452,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_covered_table_cell); 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> class table_table_rows : public office_element_impl<table_table_rows>
{ {
public: public:
...@@ -494,9 +478,7 @@ public: ...@@ -494,9 +478,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_rows); 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> class table_table_header_rows : public office_element_impl<table_table_header_rows>
{ {
public: public:
...@@ -517,9 +499,7 @@ public: ...@@ -517,9 +499,7 @@ public:
}; };
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows); CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows);
//-----------------------------------------------------------------------------------------------------
// \class table_rows
// table-rows
class table_rows class table_rows
{ {
public: public:
...@@ -533,7 +513,7 @@ public: ...@@ -533,7 +513,7 @@ public:
}; };
// table-rows-no-group //-----------------------------------------------------------------------------------------------------
class table_rows_no_group : public office_element class table_rows_no_group : public office_element
{ {
public: public:
...@@ -567,7 +547,7 @@ private: ...@@ -567,7 +547,7 @@ private:
}; };
// table-rows-and-groups //-----------------------------------------------------------------------------------------------------
class table_rows_and_groups class table_rows_and_groups
{ {
public: public:
...@@ -587,15 +567,14 @@ public: ...@@ -587,15 +567,14 @@ public:
}; };
// table-table-row-group-attlist //-----------------------------------------------------------------------------------------------------
class table_table_row_group_attlist class table_table_row_group_attlist
{ {
public: public:
table_table_row_group_attlist() : table_display_(true) {} table_table_row_group_attlist() : table_display_(true) {}
bool table_display_; // default true bool table_display_; // default true
}; };
//-----------------------------------------------------------------------------------------------------
// table:table-row-group
class table_table_row_group : public office_element_impl<table_table_row_group> class table_table_row_group : public office_element_impl<table_table_row_group>
{ {
public: public:
...@@ -621,9 +600,7 @@ public: ...@@ -621,9 +600,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group); 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> class table_table : public office_element_impl<table_table>
{ {
public: public:
...@@ -654,9 +631,7 @@ public: ...@@ -654,9 +631,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table); CP_REGISTER_OFFICE_ELEMENT2(table_table);
/// \class table_shapes //-----------------------------------------------------------------------------------------------------
/// \brief table:shapes
/// table-shapes
class table_shapes : public office_element_impl<table_shapes> class table_shapes : public office_element_impl<table_shapes>
{ {
public: public:
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#include "Converter.h" #include "PptxConverter.h"
#include "../utils.h" #include "../utils.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h" #include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/PrstClr.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/PrstClr.h"
...@@ -98,7 +99,9 @@ void OoxConverter::convert(PPTX::Logic::GraphicFrame *oox_graphic_frame) ...@@ -98,7 +99,9 @@ void OoxConverter::convert(PPTX::Logic::GraphicFrame *oox_graphic_frame)
} }
else if ( oox_graphic_frame->table.IsInit()) else if ( oox_graphic_frame->table.IsInit())
{ {
OoxConverter::convert(oox_graphic_frame->table.GetPointer()); PptxConverter *pptx_converter = dynamic_cast<PptxConverter *>(this);
if (pptx_converter)
pptx_converter->convert(oox_graphic_frame->table.GetPointer());
} }
else if ( oox_graphic_frame->element.IsInit()) else if ( oox_graphic_frame->element.IsInit())
{ {
...@@ -111,15 +114,7 @@ void OoxConverter::convert(PPTX::Logic::NvGraphicFramePr *oox_framePr) ...@@ -111,15 +114,7 @@ void OoxConverter::convert(PPTX::Logic::NvGraphicFramePr *oox_framePr)
if (oox_framePr == NULL) return; if (oox_framePr == NULL) return;
} }
void OoxConverter::convert(PPTX::Logic::Table *oox_table)
{
if (oox_table == NULL) return;
odf_context()->drawing_context()->start_shape(0);//frame
odf_context()->drawing_context()->end_shape();
}
void OoxConverter::convert(PPTX::Logic::Xfrm *oox_xfrm) void OoxConverter::convert(PPTX::Logic::Xfrm *oox_xfrm)
{ {
if (oox_xfrm == NULL) return; //CTransform2D if (oox_xfrm == NULL) return; //CTransform2D
...@@ -280,7 +275,21 @@ void OoxConverter::convert(PPTX::Logic::SpTree *oox_shape_tree) ...@@ -280,7 +275,21 @@ void OoxConverter::convert(PPTX::Logic::SpTree *oox_shape_tree)
convert(oox_shape_tree->SpTreeElems[i].GetElem().operator->()); convert(oox_shape_tree->SpTreeElems[i].GetElem().operator->());
} }
} }
void OoxConverter::convert(PPTX::Logic::CxnSp *oox_connect)
{
if (oox_connect == NULL) return;
odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeLine);
convert(&oox_connect->spPr, oox_connect->style.GetPointer());
convert(&oox_connect->nvCxnSpPr);
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
}
void OoxConverter::convert(PPTX::Logic::Shape *oox_shape) void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
{ {
if (oox_shape == NULL) return; if (oox_shape == NULL) return;
...@@ -334,14 +343,19 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* ...@@ -334,14 +343,19 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
convert(prstGeom); convert(prstGeom);
convert(custGeom); convert(custGeom);
odf_context()->drawing_context()->start_area_properties(); bool bLine = prstGeom ? (prstGeom->prst.get() == L"line") : false;
if (!bLine)
{ {
if (oox_spPr->Fill.is_init()) odf_context()->drawing_context()->start_area_properties();
convert(&oox_spPr->Fill); {
else if (oox_sp_style) if (oox_spPr->Fill.is_init())
convert(&oox_sp_style->fillRef, 1); convert(&oox_spPr->Fill);
else if (oox_sp_style)
convert(&oox_sp_style->fillRef, 1);
}
odf_context()->drawing_context()->end_area_properties();
} }
odf_context()->drawing_context()->end_area_properties();
odf_context()->drawing_context()->start_line_properties(); odf_context()->drawing_context()->start_line_properties();
{ {
...@@ -506,11 +520,11 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill) ...@@ -506,11 +520,11 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
// convert(oox_bitmap_fill->blip->m_arrEffects[i]); // convert(oox_bitmap_fill->blip->m_arrEffects[i]);
//} //}
} }
if (oox_bitmap_fill->srcRect.IsInit() && Width >0 && Height >0)//часть изображения if (oox_bitmap_fill->srcRect.IsInit() && Width > 0 && Height > 0)//часть изображения
{ {
odf_context()->drawing_context()->set_image_client_rect_inch( odf_context()->drawing_context()->set_image_client_rect_inch(
(oox_bitmap_fill->srcRect->l.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->l.get()) : 0 ) /100. * Width / currentSystemDPI, (oox_bitmap_fill->srcRect->l.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->l.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->t.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->t.get()) : 0 ) /100. * Height/ currentSystemDPI, (oox_bitmap_fill->srcRect->t.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->t.get()) : 0 ) /100. * Height/ currentSystemDPI,
(oox_bitmap_fill->srcRect->r.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->r.get()) : 0 ) /100. * Width / currentSystemDPI, (oox_bitmap_fill->srcRect->r.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->r.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->b.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->b.get()) : 0 ) /100. * Height/ currentSystemDPI); (oox_bitmap_fill->srcRect->b.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->b.get()) : 0 ) /100. * Height/ currentSystemDPI);
} }
...@@ -523,21 +537,21 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill) ...@@ -523,21 +537,21 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
if (oox_bitmap_fill->tile->flip.IsInit()) {} if (oox_bitmap_fill->tile->flip.IsInit()) {}
if (oox_bitmap_fill->tile->sx.IsInit() && Width >0) if (oox_bitmap_fill->tile->sx.IsInit() && Width > 0)
{ {
odf_context()->drawing_context()->set_bitmap_tile_scale_x(*oox_bitmap_fill->tile->sx / 100. * Width); odf_context()->drawing_context()->set_bitmap_tile_scale_x(*oox_bitmap_fill->tile->sx / 100000. * Width);
} }
if (oox_bitmap_fill->tile->sy.IsInit()&& Height >0) if (oox_bitmap_fill->tile->sy.IsInit()&& Height > 0)
{ {
odf_context()->drawing_context()->set_bitmap_tile_scale_y(*oox_bitmap_fill->tile->sy / 100. * Height); odf_context()->drawing_context()->set_bitmap_tile_scale_y(*oox_bitmap_fill->tile->sy / 100000. * Height);
} }
if (oox_bitmap_fill->tile->tx.IsInit() && Width >0) if (oox_bitmap_fill->tile->tx.IsInit() && Width > 0)
{ {
odf_context()->drawing_context()->set_bitmap_tile_translate_x(*oox_bitmap_fill->tile->tx * 100. / Width ); odf_context()->drawing_context()->set_bitmap_tile_translate_x(*oox_bitmap_fill->tile->tx * 100000. / Width );
} }
if (oox_bitmap_fill->tile->ty.IsInit() && Height >0) if (oox_bitmap_fill->tile->ty.IsInit() && Height > 0)
{ {
odf_context()->drawing_context()->set_bitmap_tile_translate_y(*oox_bitmap_fill->tile->ty * 100. / Height ); odf_context()->drawing_context()->set_bitmap_tile_translate_y(*oox_bitmap_fill->tile->ty * 100000. / Height );
} }
} }
if (oox_bitmap_fill->stretch.IsInit()) if (oox_bitmap_fill->stretch.IsInit())
...@@ -667,11 +681,11 @@ void OoxConverter::convert(PPTX::Logic::EffectLst *oox_effect_lst) ...@@ -667,11 +681,11 @@ void OoxConverter::convert(PPTX::Logic::EffectLst *oox_effect_lst)
{ {
if (!oox_effect_lst) return; if (!oox_effect_lst) return;
} }
void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop) void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB)
{ {
if (!oox_line_prop) return; if (!oox_line_prop) return;
convert (&oox_line_prop->Fill); convert (&oox_line_prop->Fill, ARGB);
if (oox_line_prop->w.IsInit()) if (oox_line_prop->w.IsInit())
{ {
...@@ -801,6 +815,20 @@ void OoxConverter::convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr) ...@@ -801,6 +815,20 @@ void OoxConverter::convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr)
if (!oox_cnvSpPr) return; if (!oox_cnvSpPr) return;
} }
void OoxConverter::convert(PPTX::Logic::CNvCxnSpPr *oox_cnvSpPr)
{
if (!oox_cnvSpPr) return;
}
void OoxConverter::convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr)
{
if (!oox_nvSpPr) return;
convert(&oox_nvSpPr->cNvPr);
convert(&oox_nvSpPr->cNvCxnSpPr);
convert(&oox_nvSpPr->nvPr);
}
void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr) void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr)
{ {
if (!oox_nvPr) return; if (!oox_nvPr) return;
...@@ -942,7 +970,9 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s ...@@ -942,7 +970,9 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
_CP_OPT(double) opacity; _CP_OPT(double) opacity;
convert(&solidFill->Color, hexColor, opacity); convert(&solidFill->Color, hexColor, opacity);
text_properties->content_.fo_color_ = odf_types::color(std::wstring(L"#") + hexColor); int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
text_properties->content_.fo_color_ = odf_types::color(hexColor);
} }
if (oox_run_pr->i.IsInit()) if (oox_run_pr->i.IsInit())
{ {
...@@ -1158,23 +1188,26 @@ void OoxConverter::convert(PPTX::Logic::Close *oox_geom_path) ...@@ -1158,23 +1188,26 @@ void OoxConverter::convert(PPTX::Logic::Close *oox_geom_path)
void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type) void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type)
{ {
if (!style_ref) return; if (!style_ref) return;
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&style_ref->Color, hexColor, opacity);
if (type == 1)
if (style_ref->idx.IsInit() == false)
{ {
odf_context()->drawing_context()->set_solid_fill(hexColor); std::wstring hexColor;
_CP_OPT(double) opacity;
if (opacity)
odf_context()->drawing_context()->set_opacity(*opacity); convert(&style_ref->Color, hexColor, opacity);
if (type != 3) //?? todooo
{
odf_context()->drawing_context()->set_solid_fill(hexColor);
if (opacity)
odf_context()->drawing_context()->set_opacity(*opacity);
}
return;
} }
if (style_ref->idx.IsInit() == false) return; int index = *style_ref->idx;
size_t index = *style_ref->idx;
PPTX::Theme *theme = oox_theme(); PPTX::Theme *theme = oox_theme();
if (!theme) return; if (!theme) return;
...@@ -1206,14 +1239,15 @@ void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type) ...@@ -1206,14 +1239,15 @@ void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type)
} }
else if (type == 2) else if (type == 2)
{ {
//index -= 1; index -= 1;
if ((index >= 0) || (index < theme->themeElements.fmtScheme.lnStyleLst.size())) if ((index >= 0) || (index < theme->themeElements.fmtScheme.lnStyleLst.size()))
{ {
convert(&theme->themeElements.fmtScheme.lnStyleLst[index]); convert(&theme->themeElements.fmtScheme.lnStyleLst[index], style_ref->Color.GetARGB());
} }
} }
else if (type == 3) else if (type == 3)
{ {
index -= 1;
if ((index >= 0) || (index < theme->themeElements.fmtScheme.effectStyleLst.size())) if ((index >= 0) || (index < theme->themeElements.fmtScheme.effectStyleLst.size()))
{ {
convert(&theme->themeElements.fmtScheme.effectStyleLst[index]); convert(&theme->themeElements.fmtScheme.effectStyleLst[index]);
...@@ -1249,4 +1283,5 @@ void OoxConverter::convert(PPTX::Logic::FontRef *style_font_ref) ...@@ -1249,4 +1283,5 @@ void OoxConverter::convert(PPTX::Logic::FontRef *style_font_ref)
odf_context()->drawing_context()->set_textarea_font(style_font->latin.typeface, style_font->ea.typeface, style_font->cs.typeface); odf_context()->drawing_context()->set_textarea_font(style_font->latin.typeface, style_font->ea.typeface, style_font->cs.typeface);
} }
} }
} }
...@@ -268,8 +268,13 @@ namespace PPTX ...@@ -268,8 +268,13 @@ namespace PPTX
class GraphicFrame; class GraphicFrame;
class SpTree; class SpTree;
class Shape; class Shape;
class CxnSp;
class Pic; class Pic;
class Table; class Table;
class TableProperties;
class TableRow;
class TableCell;
class TableCellProperties;
class SmartArt; class SmartArt;
class ChartRec; class ChartRec;
class SpPr; class SpPr;
...@@ -295,6 +300,8 @@ namespace PPTX ...@@ -295,6 +300,8 @@ namespace PPTX
class NvSpPr; class NvSpPr;
class CNvPr; class CNvPr;
class CNvSpPr; class CNvSpPr;
class CNvCxnSpPr;
class NvCxnSpPr;
class NvPr; class NvPr;
class Paragraph; class Paragraph;
class TxBody; class TxBody;
...@@ -359,6 +366,7 @@ public: ...@@ -359,6 +366,7 @@ public:
void convert(PPTX::Logic::GraphicFrame *oox_graphicFrame); void convert(PPTX::Logic::GraphicFrame *oox_graphicFrame);
void convert(PPTX::Logic::SpTree *oox_shape_tree); void convert(PPTX::Logic::SpTree *oox_shape_tree);
void convert(PPTX::Logic::Shape *oox_shape); 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::Pic *oox_pic);
void convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* oox_sp_style = NULL); 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::TextSpacing *oox_spacing, cpdoccore::odf_types::length_or_percent & length_or_percent);
...@@ -371,7 +379,7 @@ public: ...@@ -371,7 +379,7 @@ public:
void convert(PPTX::Logic::SolidFill *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::PattFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::EffectLst *oox_effect_lst); 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);
void convert(PPTX::Logic::FontRef *oox_fontRef); void convert(PPTX::Logic::FontRef *oox_fontRef);
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type); void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
void convert(PPTX::Logic::Path2D *oox_path2D); void convert(PPTX::Logic::Path2D *oox_path2D);
...@@ -381,7 +389,9 @@ public: ...@@ -381,7 +389,9 @@ public:
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0); 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::NvSpPr *oox_nvSpPr);
void convert(PPTX::Logic::CNvPr *oox_cnvPr); 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::CNvSpPr *oox_cnvSpPr);
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr); void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para); void convert(PPTX::Logic::Paragraph *oox_para);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties); void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
...@@ -394,13 +404,13 @@ public: ...@@ -394,13 +404,13 @@ public:
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr); void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
void convert(PPTX::Logic::ChartRec *oox_chart); void convert(PPTX::Logic::ChartRec *oox_chart);
void convert(PPTX::Logic::SmartArt *oox_smart_art); 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::LineTo *oox_geom_path);
void convert(PPTX::Logic::MoveTo *oox_geom_path); void convert(PPTX::Logic::MoveTo *oox_geom_path);
void convert(PPTX::Logic::ArcTo *oox_geom_path); void convert(PPTX::Logic::ArcTo *oox_geom_path);
void convert(PPTX::Logic::QuadBezTo *oox_geom_path); void convert(PPTX::Logic::QuadBezTo *oox_geom_path);
void convert(PPTX::Logic::CubicBezTo *oox_geom_path); void convert(PPTX::Logic::CubicBezTo *oox_geom_path);
void convert(PPTX::Logic::Close *oox_geom_path); void convert(PPTX::Logic::Close *oox_geom_path);
//.chart............................................................................................................................ //.chart............................................................................................................................
void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart); void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart);
void convert(OOX::Spreadsheet::CT_Title *ct_title); void convert(OOX::Spreadsheet::CT_Title *ct_title);
......
...@@ -3011,8 +3011,8 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style) ...@@ -3011,8 +3011,8 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style)
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
//зачемто ?! для OpenOffice для врезок/фреймов нужен базовый стиль - без него другой тип геометрии oO !!! //зачемто ?! для OpenOffice для врезок/фреймов нужен базовый стиль - без него другой тип геометрии oO !!!
odt_context->styles_context()->create_style(L"Frame", odf_types::style_family::Graphic,false,true); 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(); 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); //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) ...@@ -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) if (oox_table_cell->m_oTableCellProperties)
{ {
...@@ -3909,7 +3909,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell) ...@@ -3909,7 +3909,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
if (id_change_properties >= 0) if (id_change_properties >= 0)
odt_context->end_change(id_change_properties, 3); 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 (oox_table_pr == NULL) return false;
if (table_properties == NULL) return false; if (table_properties == NULL) return false;
......
...@@ -46,6 +46,7 @@ namespace OOX ...@@ -46,6 +46,7 @@ namespace OOX
} }
namespace PPTX namespace PPTX
{ {
class TableStyles;
class Presentation; class Presentation;
class Folder; class Folder;
...@@ -55,6 +56,7 @@ namespace PPTX ...@@ -55,6 +56,7 @@ namespace PPTX
class Bg; class Bg;
class Transition; class Transition;
class Timing; class Timing;
class TablePartStyle;
} }
} }
...@@ -95,15 +97,30 @@ namespace Oox2Odf ...@@ -95,15 +97,30 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown); void convert(OOX::WritingElement *oox_unknown);
void convert(PPTX::Logic::CSld *oox_slide, bool placeholders = true); void convert(PPTX::Logic::CSld *oox_slide, bool placeholders = true);
void convert(PPTX::Logic::Bg *oox_background); void convert(PPTX::Logic::Bg *oox_background);
private:
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);
bool convert(PPTX::Logic::TableProperties *oox_table_pr, odf_writer::style_table_properties *table_properties);
void convert(PPTX::Logic::TableProperties *oox_table_pr, odf_writer::style_table_cell_properties *table_cell_properties);
void convert(PPTX::Logic::Ln *oox_ln_boreder, std::wstring & odf_border);
private:
PPTX::Folder *pptx_document; PPTX::Folder *pptx_document;
PPTX::Presentation *presentation; PPTX::Presentation *presentation;
cpdoccore::odf_writer::package::odf_document *output_document; cpdoccore::odf_writer::package::odf_document *output_document;
PPTX::Theme *current_theme; PPTX::Theme *current_theme;
PPTX::TableStyles *current_tableStyles;
OOX::IFileContainer *current_slide; OOX::IFileContainer *current_slide;
PPTX::Logic::ClrMap *current_clrMap; PPTX::Logic::ClrMap *current_clrMap;
......
...@@ -52,6 +52,7 @@ namespace PPTX ...@@ -52,6 +52,7 @@ namespace PPTX
TableCellProperties() TableCellProperties()
{ {
is_empty = true;
} }
TableCellProperties& operator=(const TableCellProperties& oSrc) TableCellProperties& operator=(const TableCellProperties& oSrc)
...@@ -76,6 +77,9 @@ namespace PPTX ...@@ -76,6 +77,9 @@ namespace PPTX
Anchor = oSrc.Anchor; Anchor = oSrc.Anchor;
AnchorCtr = oSrc.AnchorCtr; AnchorCtr = oSrc.AnchorCtr;
HorzOverflow = oSrc.HorzOverflow; HorzOverflow = oSrc.HorzOverflow;
is_empty = oSrc.is_empty;
return *this; return *this;
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
...@@ -107,9 +111,13 @@ namespace PPTX ...@@ -107,9 +111,13 @@ namespace PPTX
else else
Fill.fromXML(oReader); Fill.fromXML(oReader);
} }
FillParentPointersForChilds();
} }
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{ {
is_empty = (oReader.GetAttributesCount() == 0);
WritingElement_ReadAttributes_Start ( oReader ) WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("marL"), MarL ) WritingElement_ReadAttributes_Read_if ( oReader, _T("marL"), MarL )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("marR"), MarR ) WritingElement_ReadAttributes_Read_else_if ( oReader, _T("marR"), MarR )
...@@ -123,6 +131,8 @@ namespace PPTX ...@@ -123,6 +131,8 @@ namespace PPTX
} }
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
is_empty = (node.GetAttributesCount() == 0);
LnL = node.ReadNode(_T("a:lnL")); LnL = node.ReadNode(_T("a:lnL"));
LnR = node.ReadNode(_T("a:lnR")); LnR = node.ReadNode(_T("a:lnR"));
LnT = node.ReadNode(_T("a:lnT")); LnT = node.ReadNode(_T("a:lnT"));
...@@ -324,7 +334,6 @@ namespace PPTX ...@@ -324,7 +334,6 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
public:
nullable<Ln> LnL; nullable<Ln> LnL;
nullable<Ln> LnR; nullable<Ln> LnR;
nullable<Ln> LnT; nullable<Ln> LnT;
...@@ -335,17 +344,22 @@ namespace PPTX ...@@ -335,17 +344,22 @@ namespace PPTX
UniFill Fill; UniFill Fill;
// <xsd:element name="headers" type="CT_Headers" minOccurs="0"/> // <xsd:element name="headers" type="CT_Headers" minOccurs="0"/>
nullable_int MarL;//default="91440" nullable_int MarL; //default="91440"
nullable_int MarR;//default="91440" nullable_int MarR; //default="91440"
nullable_int MarT;//default="45720" nullable_int MarT; //default="45720"
nullable_int MarB;//default="45720" nullable_int MarB; //default="45720"
nullable_limit<Limit::TextVerticalType> Vert;//default="horz" nullable_limit<Limit::TextVerticalType> Vert; //default="horz"
nullable_limit<Limit::TextAnchor> Anchor;//default="t" nullable_limit<Limit::TextAnchor> Anchor; //default="t"
nullable_bool AnchorCtr;//default="false" nullable_bool AnchorCtr; //default="false"
nullable_limit<Limit::HorzOverflow> HorzOverflow;//default="clip" nullable_limit<Limit::HorzOverflow> HorzOverflow; //default="clip"
bool is_empty;
protected: protected:
virtual void FillParentPointersForChilds() 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()) if(LnL.IsInit())
LnL->SetParentPointer(this); LnL->SetParentPointer(this);
if(LnR.IsInit()) if(LnR.IsInit())
......
...@@ -618,7 +618,7 @@ namespace OOX ...@@ -618,7 +618,7 @@ namespace OOX
CTableCellProperties *GetProperties() 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() ) if ( m_arrItems[nIndex] && OOX::et_w_tcPr == m_arrItems[nIndex]->getType() )
{ {
......
...@@ -208,6 +208,8 @@ namespace XmlUtils ...@@ -208,6 +208,8 @@ namespace XmlUtils
std::wstring ReadAttributeBase(const wchar_t* bstrName); std::wstring ReadAttributeBase(const wchar_t* bstrName);
std::wstring ReadAttribute(const std::wstring& strAttibuteName); 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::string& sName, const std::string& _default = "");
std::string GetAttributeA(const std::wstring& sName, const std::string& _default = ""); std::string GetAttributeA(const std::wstring& sName, const std::string& _default = "");
......
...@@ -434,6 +434,15 @@ namespace XmlUtils ...@@ -434,6 +434,15 @@ namespace XmlUtils
{ {
return GetAttribute(std::wstring(strAttributeName), strDefaultValue); 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 CXmlNode::GetAttributeIfExist(const std::wstring& sName, std::wstring& sOutput)
{ {
bool bRes = false; 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