Commit 1d405512 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

.....

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57400 954022d7-b5bf-4e40-9824-e11837661b57
parent c85c7ddc
......@@ -43,7 +43,7 @@ std::wostream & operator << (std::wostream & _Wostream, const length::unit _Unit
std::wostream & operator << (std::wostream & _Wostream, const length & _Length)
{
_Wostream << _Length.get_value() << _Length.get_unit();
_Wostream << std::setprecision(4) << _Length.get_value() << _Length.get_unit();
return _Wostream;
}
length operator + (length & _Length1, length & _Length2)
......
......@@ -41,6 +41,15 @@ public:
return Length_;
}
percent & get_percent()
{
return Percent_;
}
length & get_length()
{
return Length_;
}
static length_or_percent parse(const std::wstring & );
private:
......
......@@ -32,5 +32,33 @@ shadow_type shadow_type::parse(const std::wstring & Str)
return shadow_type( Str );
}
//----------------------------------------------------------------------------------------
std::wostream & operator << (std::wostream & _Wostream, const shadow_type1 & _Val)
{
switch(_Val.get_type())
{
case shadow_type1::Hidden:
_Wostream << L"hidden";
break;
case shadow_type1::Visible:
_Wostream << L"visible";
break;
default:
break;
}
return _Wostream;
}
shadow_type1 shadow_type1::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
boost::algorithm::to_lower(tmp);
if (tmp == L"visible")
return shadow_type1( Visible );
else
return shadow_type1( Hidden );
}
} }
#ifndef _CPDOCCORE_ODF_SHADOWTYPE_H_
#define _CPDOCCORE_ODF_SHADOWTYPE_H_
#ifdef _MSC_VER
#pragma once
#endif
#include <iosfwd>
#include <string>
......@@ -49,10 +44,46 @@ private:
std::wostream & operator << (std::wostream & _Wostream, const shadow_type & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf::shadow_type);
//--------------------------------------------------------------------------------------------------------------------------------
class shadow_type1
{
public:
enum type
{
Hidden,
Visible
};
}
shadow_type1() {}
shadow_type1(type _Type) : type_(_Type)
{}
shadow_type1(const std::wstring & _Name) : type_(Visible), name_(_Name)
{}
type get_type() const
{
return type_;
};
#endif
const std::wstring & get_name() const
{
return name_;
}
static shadow_type1 parse(const std::wstring & Str);
private:
type type_;
std::wstring name_;
};
std::wostream & operator << (std::wostream & _Wostream, const shadow_type1 & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf::shadow_type);
APPLY_PARSE_XML_ATTRIBUTES(odf::shadow_type1);
}
......@@ -296,6 +296,8 @@ namespace odf
CP_XML_ATTR(L"xmlns:of", L"urn:oasis:names:tc:opendocument:xmlns:of:1.2" );
CP_XML_ATTR(L"xmlns:xhtml", L"http://www.w3.org/1999/xhtml" );
CP_XML_ATTR(L"xmlns:grddl", L"http://www.w3.org/2003/g/data-view#" );
CP_XML_ATTR(L"xmlns:officeooo", L"http://openoffice.org/2009/office" );
CP_XML_ATTR(L"xmlns:textooo", L"http://openoffice.org/2013/office" );
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
CP_XML_ATTR(L"xmlns:drawooo", L"http://openoffice.org/2010/draw" );
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
......@@ -359,6 +361,8 @@ namespace odf
CP_XML_ATTR(L"xmlns:of", L"urn:oasis:names:tc:opendocument:xmlns:of:1.2" );
CP_XML_ATTR(L"xmlns:xhtml", L"http://www.w3.org/1999/xhtml" );
CP_XML_ATTR(L"xmlns:grddl", L"http://www.w3.org/2003/g/data-view#" );
CP_XML_ATTR(L"xmlns:officeooo", L"http://openoffice.org/2009/office" );
CP_XML_ATTR(L"xmlns:textooo", L"http://openoffice.org/2013/office" );
CP_XML_ATTR(L"xmlns:tableooo", L"http://openoffice.org/2009/table" );
CP_XML_ATTR(L"xmlns:drawooo", L"http://openoffice.org/2010/draw" );
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
......
......@@ -48,6 +48,8 @@ public:
virtual void start_text_context() = 0;
virtual void end_text_context() = 0;
virtual void start_image(std::wstring & image_file_name) = 0;
odf_chart_context * chart_context();
odf_style_context * styles_context();
odf_page_layout_context * page_layout_context();
......
......@@ -729,6 +729,22 @@ void odf_drawing_context::set_opacity(double percent_)
break;
}
}
void odf_drawing_context::set_shadow(int type, std::wstring hexColor, _CP_OPT(double) opacity, double dist_pt, double dist_pt_y )
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content().draw_shadow_ = shadow_type1(shadow_type1::Visible);
if (opacity) impl_->current_graphic_properties->content().draw_shadow_opacity_ = *opacity;
impl_->current_graphic_properties->content().draw_shadow_color_ = hexColor;
impl_->current_graphic_properties->content().draw_shadow_offset_y_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
if (dist_pt_y > 0)
impl_->current_graphic_properties->content().draw_shadow_offset_x_ = length(length(dist_pt_y,length::pt).get_value_unit(length::cm),length::cm);
else
impl_->current_graphic_properties->content().draw_shadow_offset_x_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_drawing_context::set_no_fill()
{
if (!impl_->current_graphic_properties)return;
......@@ -828,9 +844,9 @@ void odf_drawing_context::set_margin_bottom (double valPt)
{
impl_->anchor_settings_.fo_margin_bottom_ = length(length(valPt,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_drawing_context::set_anchor(anchor_type::type type)
void odf_drawing_context::set_anchor(int type)
{
impl_->anchor_settings_.anchor_type_ = anchor_type(type);
impl_->anchor_settings_.anchor_type_ = anchor_type((anchor_type::type)type);
}
//////////////////////////////////////////////////////////////////////////////////////
void odf_drawing_context::set_vertical_rel(int from)
......@@ -948,9 +964,9 @@ void odf_drawing_context::set_size( double width_pt, double height_pt)
height_pt *= impl_->group_list_.back().koef_cy;
}
//if (!impl_->current_drawing_state_.svg_width_)
impl_->current_drawing_state_.svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm);
if (width_pt >= 0) impl_->current_drawing_state_.svg_width_ = length(length(width_pt,length::pt).get_value_unit(length::cm),length::cm);
//if (!impl_->current_drawing_state_.svg_height_)
impl_->current_drawing_state_.svg_height_= length(length(height_pt,length::pt).get_value_unit(length::cm),length::cm);
if (height_pt >=0) impl_->current_drawing_state_.svg_height_= length(length(height_pt,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_drawing_context::set_line_width(double pt)
{
......@@ -1141,6 +1157,13 @@ void odf_drawing_context::start_text_box()
{
start_frame();
// Frame - :(
style* style_ = dynamic_cast<style*>(impl_->current_drawing_state_.elements_.back().style_elm.get());
if (style_)
{
style_->style_parent_style_name_ = L"Frame";
}
if (impl_->current_graphic_properties)
{
......@@ -1151,6 +1174,17 @@ void odf_drawing_context::start_text_box()
start_element(text_box_elm);
}
void odf_drawing_context::set_text_box_min_size(double w_pt, double h_pt)
{
draw_text_box* draw = dynamic_cast<draw_text_box*>(impl_->current_drawing_state_.elements_.back().elm.get());
if (draw)
{
if (h_pt >=0) draw->draw_text_box_attlist_.fo_min_height_= length(length(h_pt,length::pt).get_value_unit(length::cm), length::cm);
if (w_pt >=0) draw->draw_text_box_attlist_.fo_min_width_= length(length(w_pt,length::pt).get_value_unit(length::cm), length::cm);
}
}
void odf_drawing_context::end_image()
{
end_element();
......@@ -1217,6 +1251,7 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
impl_->current_graphic_properties->content().draw_auto_grow_height_ = false;
impl_->current_graphic_properties->content().draw_auto_grow_width_ = false;
impl_->current_graphic_properties->content().draw_fit_to_size_ = false;//???
}
}
void odf_drawing_context::start_gradient_style()
......
......@@ -34,7 +34,7 @@ public:
void set_margin_top (double valPt);
void set_margin_bottom (double valPt);
void set_anchor (anchor_type::type type);
void set_anchor (int type);//anchor_type
void set_vertical_rel(int from);
void set_vertical_pos(int align);
......@@ -71,6 +71,7 @@ public:
void end_image();
void start_text_box();
void set_text_box_min_size(double w_pt, double h_pt);
void end_text_box();
void start_object(std::wstring name);
......@@ -121,6 +122,8 @@ public:
void start_shadow_properies();
void end_shadow_properies();
// ..
void set_shadow(int type, std::wstring hexColor, _CP_OPT(double) opacity, double dist_pt, double dist_pt_y = -1);
void set_text(odf_text_context* text_context);
void set_textarea_vertical_align(int align);
......
......@@ -111,6 +111,8 @@ void odf_style_context::process_automatic_styles(office_element_ptr root )
{//
for (long i =0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i].writable_ == false) continue;
if (style_state_list_[i].automatic_== true && style_state_list_[i].root_== true && style_state_list_[i].odf_style_)
root->add_child_element(style_state_list_[i].odf_style_);
}
......@@ -119,6 +121,8 @@ void odf_style_context::process_automatic(office_element_ptr root )
{//
for (long i =0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i].writable_ == false) continue;
if (/*it->automatic_== true && */style_state_list_[i].root_== false && style_state_list_[i].odf_style_)
root->add_child_element(style_state_list_[i].odf_style_);
}
......@@ -127,6 +131,8 @@ void odf_style_context::process_master(office_element_ptr root )
{
for (long i =0; i < master_style_list_.size(); i++)
{
if (style_state_list_[i].writable_ == false) continue;
root->add_child_element(master_style_list_[i]);
}
}
......@@ -136,6 +142,8 @@ void odf_style_context::process_office(office_element_ptr root )
for (long i =0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i].writable_ == false) continue;
if (style_state_list_[i].automatic_== false && style_state_list_[i].root_ == true && style_state_list_[i].odf_style_)
root->add_child_element(style_state_list_[i].odf_style_);
}
......
......@@ -20,6 +20,8 @@ odf_style_state::odf_style_state(office_element_ptr & elm, const style_family fa
num_fmt_id_ =0;
style_family_ = family;
writable_ = true;
style* style_ = dynamic_cast<style*>(elm.get());
if (style_)
{
......@@ -82,6 +84,10 @@ void odf_style_state::set_parent_style_name(std::wstring & name)
return;
style_->style_parent_style_name_ = name;
}
void odf_style_state::set_dont_write(bool Val)
{
writable_ = !Val;
}
void odf_style_state::set_data_style_name(std::wstring & name)
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
......
......@@ -41,6 +41,8 @@ public:
void apply_from(style* other_style);
void set_dont_write(bool val);
void add_child(office_element_ptr & child);
/////////////////////////////////////////////////////////////////////////////////////////
void set_name(std::wstring & name);
......@@ -80,6 +82,8 @@ private:
bool default_; // root
bool conditional_; //
bool writable_;
style_family style_family_;
office_element_ptr odf_style_;
......
......@@ -13,6 +13,7 @@
#include "table.h"
#include "style_table_properties.h"
//#include "style_text_properties.h"
//#include "style_paragraph_properties.h"
//#include "style_graphic_properties.h"
......@@ -34,6 +35,8 @@ namespace odf
current_column = 0;
count_header_row = 0;
styled = false;
table_width = 0;
}
std::vector<odf_element_state> rows;
std::vector<odf_column_state> columns;
......@@ -48,6 +51,8 @@ namespace odf
bool styled;
double table_width;
std::wstring default_cell_properties;
};
class odf_table_context::Impl
......@@ -55,7 +60,7 @@ class odf_table_context::Impl
public:
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
{
default_column_width = -1;
}
odf_table_state & current_table() {return tables_.back();}
......@@ -63,12 +68,15 @@ public:
void start_table(odf_table_state & state) {tables_.push_back(state);}
void end_table() {if (tables_.size() > 0) tables_.pop_back();}
void end_table() {if (tables_.size() > 0) tables_.pop_back(); default_column_width = -1; default_cell_properties = L"";}
odf_style_context * styles_context() {return odf_context_->styles_context();}
odf_conversion_context *odf_context_;
double default_column_width;
std::wstring default_cell_properties; // ..
private:
std::vector<odf_table_state> tables_;// current level ...
......@@ -112,14 +120,13 @@ 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;
// -
style_table_properties *table_properties = style_state->get_table_properties();
table_properties->table_format_properties_.table_border_model_ = odf::border_model(odf::border_model::Collapsing);
}
}
state.default_cell_properties = impl_->default_cell_properties;
impl_->default_cell_properties = L"";
impl_->start_table(state);
}
void odf_table_context::end_table()
{
......@@ -129,6 +136,19 @@ void odf_table_context::end_table()
impl_->current_table().current_column = i+1;
set_cell_row_span_restart();
}
style * style_ = dynamic_cast<style *>(impl_->current_table().table.style_elm.get());
if (style_)
{
if (impl_->current_table().table_width > 0)
{
style_table_properties * table_props = style_->style_content_.get_style_table_properties();
if (table_props)
{
table_props->table_format_properties_.style_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);
}
}
}
impl_->end_table();
}
void odf_table_context::start_row(office_element_ptr &elm, bool styled)
......@@ -199,6 +219,24 @@ void odf_table_context::add_column(office_element_ptr &elm, bool styled)
impl_->current_table().columns.push_back(state);
}
void odf_table_context::set_default_cell_properties(std::wstring style_name)
{
impl_->default_cell_properties = style_name;
}
double odf_table_context::get_table_width()
{
if (impl_->empty()) return -1;
else return impl_->current_table().table_width;
}
std::wstring odf_table_context::get_default_cell_properties()
{
if (impl_->empty()) return impl_->default_cell_properties;
else return impl_->current_table().default_cell_properties;
}
void odf_table_context::set_default_column_width(double width)
{
impl_->default_column_width = width;
}
void odf_table_context::set_column_width(double width)
{
if (impl_->empty()) return;
......@@ -213,10 +251,23 @@ void odf_table_context::set_column_width(double width)
if (width >= 0)
{
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = false;
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = false;
impl_->current_table().table_width += width;
}
else
{
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
if (impl_->default_column_width >=0)
{
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(impl_->default_column_width,length::pt).get_value_unit(length::cm),length::cm);
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_table().table_width += impl_->default_column_width;
}
}
}
int odf_table_context::current_column ()
{
......@@ -258,6 +309,11 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
cell->table_table_cell_attlist_.table_style_name_ = state.style_name;
}
}
//if (cell)
//{
// cell->table_table_cell_attlist_.common_value_and_type_attlist_ = common_value_and_type_attlist();
// cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_type_ = office_value_type(office_value_type::String);
//}
impl_->current_table().cells.push_back(state);
......
......@@ -31,7 +31,13 @@ public:
int count_column ();
void start_table(office_element_ptr &elm, bool styled = false);
void set_default_column_width(double width);
void end_table();
void set_default_cell_properties(std::wstring style_name);
std::wstring get_default_cell_properties();
double get_table_width();
void start_row(office_element_ptr &elm, bool styled = false);
void end_row();
......
......@@ -54,20 +54,22 @@ void odf_text_context::set_single_object(bool val, style_paragraph_properties *p
void odf_text_context::add_text_content(const std::wstring & text)
{
//if (text == L" " && single_paragraph_ == false)
//{
// office_element_ptr elm;
// create_element(L"text", L"s", elm, odf_context_);
// current_level_.back().elm->add_child_element(elm);
//}
//else
{
if (current_level_.size() > 0 )
current_level_.back().elm->add_text(text);
if (current_level_.size() > 0 )
current_level_.back().elm->add_text(text);
}
void odf_text_context::set_symbol_font(std::wstring & font)
{
if (text_properties_ == NULL) return;
}
text_properties_->text_format_properties_content_.fo_font_family_ = font;
text_properties_->text_format_properties_content_.style_font_family_complex_ = font;
text_properties_->text_format_properties_content_.style_font_family_asian_ = font;
}
void odf_text_context::set_symbol_text(int sym)
{
char ch = char( sym ^ 0xF000);
std::wstring s;s.push_back(ch);
add_text_content(s);
}
void odf_text_context::start_paragraph(bool styled)
{
......
......@@ -35,7 +35,9 @@ public:
void set_single_object(bool val, style_paragraph_properties *para_props, style_text_properties *text_props);
void add_text_content(const std::wstring & text);
void set_symbol_font(std::wstring & font);
void set_symbol_text(int sym);
void start_paragraph(bool styled = false);
void start_paragraph(office_element_ptr & elm, bool styled = false);
void end_paragraph();
......
......@@ -70,7 +70,7 @@ public:
void start_drawings();
void end_drawings();
void start_image(std::wstring & image_file_name);
virtual void start_image(std::wstring & image_file_name);
double convert_symbol_width(double val);
......
......@@ -175,9 +175,8 @@ void odt_conversion_context::end_drawings()
if (drawing_context_.size() < 1) return;
office_element_ptr & elm = drawing_context()->get_root_element();
if (elm )
if (elm && text_context()->current_level_.size() > 0)
{
text_context()->current_level_.back().elm->add_child_element(elm);
}
drawing_context()->clear();
......@@ -556,7 +555,22 @@ void odt_conversion_context::add_table_column(double width)
office_element_ptr elm;
create_element(L"table", L"table-column",elm,this);
styles_context()->create_style(L"",odf::style_family::TableColumn, true, false, -1);
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::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_->style_content_.get_style_table_cell_properties();
// props->apply_from(parent);
// }
//}
table_context()->add_column(elm, true);
table_context()->set_column_width(width);
......
......@@ -45,7 +45,7 @@ public:
void start_drawings();
void end_drawings();
void start_image(std::wstring & image_file_name);
virtual void start_image(std::wstring & image_file_name);
void add_text_content (std::wstring & text);
void start_paragraph(bool styled = false);
......
......@@ -24,18 +24,18 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
common_draw_fill_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"draw:wrap-influence-on-position", draw_wrap_influence_on_position_);
CP_XML_ATTR_OPT(L"draw:textarea-horizontal-align", draw_textarea_horizontal_align_);
CP_XML_ATTR_OPT(L"draw:textarea-vertical-align", draw_textarea_vertical_align_);
CP_XML_ATTR_OPT(L"draw:auto-grow-height", draw_auto_grow_height_);
CP_XML_ATTR_OPT(L"draw:auto-grow-width", draw_auto_grow_width_);
CP_XML_ATTR_OPT(L"draw:textarea-horizontal-align", draw_textarea_horizontal_align_);
CP_XML_ATTR_OPT(L"draw:textarea-vertical-align", draw_textarea_vertical_align_);
CP_XML_ATTR_OPT(L"draw:auto-grow-height", draw_auto_grow_height_);
CP_XML_ATTR_OPT(L"draw:auto-grow-width", draw_auto_grow_width_);
CP_XML_ATTR_OPT(L"draw:stroke", draw_stroke_);
CP_XML_ATTR_OPT(L"draw:stroke-dash",draw_stroke_dash_);
CP_XML_ATTR_OPT(L"draw:marker-start",draw_marker_start_);
CP_XML_ATTR_OPT(L"draw:marker-end", draw_marker_end_);
CP_XML_ATTR_OPT(L"svg:stroke-color",svg_stroke_color_);
CP_XML_ATTR_OPT(L"svg:stroke-width", svg_stroke_width_);
CP_XML_ATTR_OPT(L"svg:stroke-opacity",svg_stroke_opacity_);
CP_XML_ATTR_OPT(L"draw:stroke", draw_stroke_);
CP_XML_ATTR_OPT(L"draw:stroke-dash", draw_stroke_dash_);
CP_XML_ATTR_OPT(L"draw:marker-start", draw_marker_start_);
CP_XML_ATTR_OPT(L"draw:marker-end", draw_marker_end_);
CP_XML_ATTR_OPT(L"svg:stroke-color", svg_stroke_color_);
CP_XML_ATTR_OPT(L"svg:stroke-width", svg_stroke_width_);
CP_XML_ATTR_OPT(L"svg:stroke-opacity", svg_stroke_opacity_);
CP_XML_ATTR_OPT(L"fo:min-width", fo_min_width_);
CP_XML_ATTR_OPT(L"fo:min-height", fo_min_height_);
......@@ -44,20 +44,28 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
CP_XML_ATTR_OPT(L"fo:clip", fo_clip_);
CP_XML_ATTR_OPT(L"fo:wrap-option", fo_wrap_option_);
CP_XML_ATTR_OPT(L"style:print-content", style_print_content_);
CP_XML_ATTR_OPT(L"style:protect", style_protect_);
CP_XML_ATTR_OPT(L"style:editable", style_editable_);
CP_XML_ATTR_OPT(L"style:wrap", style_wrap_);
CP_XML_ATTR_OPT(L"style:print-content", style_print_content_);
CP_XML_ATTR_OPT(L"style:protect", style_protect_);
CP_XML_ATTR_OPT(L"style:editable", style_editable_);
CP_XML_ATTR_OPT(L"style:wrap", style_wrap_);
CP_XML_ATTR_OPT(L"style:wrap-dynamic-treshold", style_wrap_dynamic_treshold_);
CP_XML_ATTR_OPT(L"style:number-wrapped-paragraphs", style_number_wrapped_paragraphs_);
CP_XML_ATTR_OPT(L"style:wrap-contour", style_wrap_contour_);
CP_XML_ATTR_OPT(L"style:wrap-contour", style_wrap_contour_);
CP_XML_ATTR_OPT(L"style:wrap-contour-mode", style_wrap_contour_mode_);
CP_XML_ATTR_OPT(L"style:run-through", style_run_through_);
CP_XML_ATTR_OPT(L"style:flow-with-text", style_flow_with_text_);
CP_XML_ATTR_OPT(L"style:run-through", style_run_through_);
CP_XML_ATTR_OPT(L"style:flow-with-text", style_flow_with_text_);
CP_XML_ATTR_OPT(L"style:overflow-behavior", style_overflow_behavior_);
CP_XML_ATTR_OPT(L"style:mirror", style_mirror_);
CP_XML_ATTR_OPT(L"style:mirror", style_mirror_);
CP_XML_ATTR_OPT(L"draw:fit-to-size", draw_fit_to_size_);
//common_shadow_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"draw:shadow", draw_shadow_);
CP_XML_ATTR_OPT(L"draw:shadow-opacity", draw_shadow_opacity_);
CP_XML_ATTR_OPT(L"draw:shadow-color", draw_shadow_color_);
CP_XML_ATTR_OPT(L"draw:shadow-offset-y", draw_shadow_offset_y_);
CP_XML_ATTR_OPT(L"draw:shadow-offset-x", draw_shadow_offset_x_);
common_draw_rel_size_attlist_.serialize(CP_GET_XML_NODE());
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE());
common_vertical_margin_attlist_.serialize(CP_GET_XML_NODE());
......@@ -70,7 +78,6 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
common_border_attlist_.serialize(CP_GET_XML_NODE());
common_border_line_width_attlist_.serialize(CP_GET_XML_NODE());
common_padding_attlist_.serialize(CP_GET_XML_NODE());
common_shadow_attlist_.serialize(CP_GET_XML_NODE());
common_background_color_attlist_.serialize(CP_GET_XML_NODE());
}
}
......
......@@ -58,6 +58,13 @@ public:
_CP_OPT(Bool) draw_auto_grow_height_;
_CP_OPT(Bool) draw_auto_grow_width_;
//common_shadow_attlist common_shadow_attlist_;
_CP_OPT(shadow_type1) draw_shadow_;
_CP_OPT(percent) draw_shadow_opacity_;
_CP_OPT(color) draw_shadow_color_;
_CP_OPT(length) draw_shadow_offset_y_;
_CP_OPT(length) draw_shadow_offset_x_;
common_draw_fill_attlist common_draw_fill_attlist_;
common_draw_rel_size_attlist common_draw_rel_size_attlist_;
......@@ -80,8 +87,6 @@ public:
common_padding_attlist common_padding_attlist_;
common_shadow_attlist common_shadow_attlist_;
common_background_color_attlist common_background_color_attlist_;
_CP_OPT(style_wrap) style_wrap_;
......
......@@ -33,7 +33,6 @@ void table_format_properties::serialize(std::wostream & _Wostream,const wchar_t
{
CP_XML_ATTR_OPT(L"style:width", style_width_);
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
CP_XML_ATTR_OPT(L"table:align", table_align_);
CP_XML_ATTR_OPT(L"style:may-break-between-rows", style_may_break_between_rows_);
CP_XML_ATTR_OPT(L"table:border-model", table_border_model_);
CP_XML_ATTR_OPT(L"table:display", table_display_);
......@@ -51,6 +50,7 @@ void table_format_properties::serialize(std::wostream & _Wostream,const wchar_t
common_border_attlist_.serialize(CP_GET_XML_NODE());
if (style_background_image_) style_background_image_->serialize(_Wostream);
CP_XML_ATTR_OPT(L"table:align", table_align_);
}
}
}
......
......@@ -156,6 +156,10 @@
RelativePath=".\Oox2OdfConverter\ConverterChart.cpp"
>
</File>
<File
RelativePath=".\Oox2OdfConverter\ConvertVml.cpp"
>
</File>
<File
RelativePath=".\Oox2OdfConverter\DocxConverter.cpp"
>
......@@ -180,6 +184,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Oox2OdfConverter\VmlShapeTypes2Oox.h"
>
</File>
<File
RelativePath=".\Oox2OdfConverter\XlsxConverter.cpp"
>
......
This diff is collapsed.
......@@ -8,7 +8,6 @@
#include "..\progressCallback.h"
static std::wstring string2std_string(CString val)
{
return std::wstring(val.GetBuffer());
......@@ -83,6 +82,9 @@ namespace OOX
class CColor;
class CShapeStyle;
class CStyleMatrixReference;
class CEffectList;
class COuterShadowEffect;
class CInnerShadowEffect;
namespace Colors
{
......@@ -233,6 +235,42 @@ namespace OOX
class CRichText;
class CTextProperties;
}
namespace Vml
{
class CVmlShapeElements;
class CShapeType;
class CShape;
class CImage;
class CImageData;
class CArc;
class CBackground;
class CCurve;
class CFill;
class CLine;
class COval;
class CPath ;
class CPolyLine ;
class CRect;
class CRoundRect;
class CShadow;
class CStroke;
class CTextbox;
class CTextPath;
class CGroup;
}
namespace VmlWord
{
class CWrap;
}
}
namespace SimpleTypes
{
namespace Vml
{
class CCssStyle;
}
}
namespace Oox2Odf
......@@ -244,16 +282,21 @@ public:
virtual void write(const std::wstring & path) = 0;
OoxConverter(const ProgressCallback* CallBack = NULL){oox_current_chart = NULL; pCallBack = CallBack;bUserStopConvert = 0;}
const ProgressCallback* pCallBack;
short bUserStopConvert;
BOOL UpdateProgress(long nComplete);
//.......................................................................................................................
virtual cpdoccore::odf::odf_conversion_context *odf_context() = 0;
virtual OOX::CTheme *oox_theme() = 0;
virtual CString find_link_by_id(CString sId, int t) = 0;
OOX::Spreadsheet::CChartSpace *oox_current_chart;
//.......................................................................................................................
void convert(OOX::WritingElement *oox_unknown);
void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size);
//.drawing......................................................................................................................
void convert(OOX::Drawing::CNonVisualDrawingProps *oox_cnvPr);
void convert(OOX::Drawing::CShapeProperties *oox_spPr, OOX::Drawing::CShapeStyle* oox_sp_style = NULL);
void convert(OOX::Drawing::CGroupShapeProperties *oox_groupSpPr);
......@@ -268,8 +311,12 @@ public:
void convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill , CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fill, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill , CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CEffectList *oox_effect_list, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::COuterShadowEffect *oox_shadow, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CInnerShadowEffect *oox_shadow, CString *change_sheme_color = NULL);
void convert(OOX::Drawing::CStyleMatrixReference *style_matrix_ref);
//////////////////////////////////////////////
void convert(OOX::Drawing::CPath2D *oox_geom_path);
void convert(OOX::Drawing::CPath2DLineTo *oox_geom_path);
void convert(OOX::Drawing::CPath2DMoveTo *oox_geom_path);
......@@ -277,19 +324,17 @@ public:
void convert(OOX::Drawing::CPath2DQuadBezierTo *oox_geom_path);
void convert(OOX::Drawing::CPath2DCubicBezierTo *oox_geom_path);
void convert(OOX::Drawing::CPath2DClose *oox_geom_path);
/////////////////////////////////////////
void convert(OOX::Drawing::CColor *oox_color, std::wstring & hexColor , cpdoccore::_CP_OPT(double) &opacity);
void convert(OOX::Drawing::CSchemeColor *oox_ShemeClr, std::wstring & hexString, cpdoccore::_CP_OPT(double) &opacity);
void convert(OOX::Drawing::Colors::CColorTransform *oox_ScrgbClr, std::wstring & hexString, cpdoccore::_CP_OPT(double) &opacity);
void convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill,std::wstring & hexColor , cpdoccore::_CP_OPT(double) &opacity);
///////////////////////////////
void convert(OOX::Drawing::CParagraph *oox_paragraph);
void convert(OOX::Drawing::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf::style_paragraph_properties * paragraph_properties);
void convert(OOX::Drawing::CRun *oox_run);
void convert(OOX::Drawing::CRunProperty *oox_run_pr, cpdoccore::odf::style_text_properties * text_properties);
void convert(OOX::Drawing::CLineSpacing *oox_spacing, cpdoccore::odf::length_or_percent & length_or_percent);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//.chart............................................................................................................................
void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart);
void convert(OOX::Spreadsheet::CT_Title *ct_title);
void convert(OOX::Spreadsheet::CT_Legend *ct_legend);
......@@ -340,11 +385,31 @@ public:
void convert(OOX::Spreadsheet::CT_NumData *num_data);
void convert(OOX::Spreadsheet::CT_StrData *str_data, bool label = false);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size);
const ProgressCallback* pCallBack;
short bUserStopConvert;
//.vml............................................................................................................................
void convert(OOX::Vml::CVmlShapeElements *vml);
void convert(OOX::Vml::CShapeType *vml_shape_type);
void convert(OOX::Vml::CShape *vml_shape);
void convert(OOX::Vml::CImage *vml_image);
void convert(OOX::Vml::CImageData *vml_image_data);
void convert(OOX::Vml::CArc *vml_arc);
void convert(OOX::Vml::CBackground *vml_background);
void convert(OOX::Vml::CCurve *vml_curve);
void convert(OOX::Vml::CFill *vml_fill);
void convert(OOX::Vml::CLine *vml_line);
void convert(OOX::Vml::COval *vml_oval);
void convert(OOX::Vml::CPath *vml_path);
void convert(OOX::Vml::CPolyLine *vml_polyline);
void convert(OOX::Vml::CRect *vml_rect);
void convert(OOX::Vml::CRoundRect *vml_roundrect);
void convert(OOX::Vml::CShadow *vml_shadow);
void convert(OOX::Vml::CStroke *vml_stroke);
void convert(OOX::Vml::CTextbox *vml_textbox);
void convert(OOX::Vml::CTextPath *vml_textpath);
void convert(SimpleTypes::Vml::CCssStyle *vml_style);
void convert(OOX::VmlWord::CWrap *vml_wrap);
void convert(OOX::Vml::CGroup *vml_group);
};
class Converter
......
......@@ -20,6 +20,7 @@ namespace OOX
class CParagraph;
class CParagraphProperty;
class CRun;
class CSym;
class CRunProperty;
class CSectionProperty;
class CText;
......@@ -27,6 +28,7 @@ namespace OOX
class CDrawing;
class CGroupShape;
class CShape;
class CPicture;
class CPBdr;
class CHyperlink;
class CFldChar;
......@@ -57,6 +59,7 @@ namespace ComplexTypes
class CBorder;
class CShading;
class CFramePr;
class CTblWidth;
}
}
namespace cpdoccore
......@@ -89,6 +92,7 @@ namespace Oox2Odf
virtual OOX::CTheme *oox_theme();
virtual CString find_link_by_id (CString sId, int t);
void convert(OOX::WritingElement *oox_unknown);
private:
OOX::CDocx *docx_document;
cpdoccore::odf::package::odf_document *output_document;
......@@ -100,8 +104,6 @@ namespace Oox2Odf
void convert_styles();
void convert_comment(int oox_comm_id);
void convert(OOX::WritingElement *oox_unknown);
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool root = false);
void convert(OOX::Logic::CParagraph *oox_paragraph);
void convert(OOX::Logic::CRun *oox_run);
......@@ -113,18 +115,24 @@ namespace Oox2Odf
void convert(OOX::Logic::CInstrText *oox_instr);
void convert(OOX::Logic::CText *oox_text);
void convert(OOX::Logic::CHyperlink *oox_hyperlink);
void convert(OOX::Logic::CSym *oox_sym);
void convert(OOX::Logic::CAlternateContent *oox_alt_content);
void convert(OOX::Logic::CDrawing *oox_drawing);
void convert(OOX::Drawing::CAnchor *oox_anchor);
void convert(OOX::Drawing::CInline *oox_inline);
void convert(OOX::Drawing::CGraphic *oox_graphic);
void convert(OOX::Logic::CGroupShape *oox_group_shape);
void convert(OOX::Logic::CShape *oox_shape);
void convert(OOX::Logic::CPicture *oox_picture);
void convert(OOX::Drawing::CAnchor *oox_anchor);
void convert(OOX::Drawing::CInline *oox_inline);
void convert(OOX::Drawing::CGraphic *oox_graphic);
void convert(OOX::Drawing::CChart *oox_chart);
void convert(OOX::Drawing::CPicture *oox_picture);
void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf::color) & odf_color);
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf::length) & odf_size);
void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf::length_or_percent) & odf_size);
void convert(ComplexTypes::Word::CTblWidth *oox_size, _CP_OPT(odf::length) & odf_size);
void convert(ComplexTypes::Word::CJc *oox_jc, _CP_OPT(odf::text_align) & align);
void convert(ComplexTypes::Word::CBorder *borderProp, std::wstring & odf_border_prop);
......@@ -153,6 +161,7 @@ namespace Oox2Odf
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, odf::style_table_cell_properties *table_cell_properties/*,odf::style_table_cell_properties * table_cell_properties = NULL*/);
bool convert(OOX::Logic::CTableProperty *oox_table_pr);
bool convert(OOX::Logic::CTableProperty *oox_table_pr, odf::style_table_properties *table_properties);
void convert(OOX::Logic::CTableProperty *oox_table_pr, odf::style_table_cell_properties *table_cell_properties);
void convert(OOX::Logic::CTableRowProperties *oox_table_row_pr);
void convert(OOX::Logic::CTableRowProperties *oox_table_row_pr, odf::style_table_row_properties *table_row_properties);
//--------------------------------------------------------------------------------
......
......@@ -1102,52 +1102,35 @@ void XlsxConverter::convert(OOX::Spreadsheet::CAligment *aligment, odf::style_pa
//nullable<SimpleTypes::CDecimalNumber<>> m_oRelativeIndent;
}
void XlsxConverter::convert(OOX::Spreadsheet::CBorder *border, odf::style_table_cell_properties * cell_properties)
void XlsxConverter::convert(OOX::Spreadsheet::CBorder *oox_border, odf::style_table_cell_properties * table_cell_properties)
{
if (!border)return;
if (!oox_border)return;
if (border->m_oBottom.IsInit())
{
std::wstring odf_border;
convert(border->m_oBottom.GetPointer(), odf_border);
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = odf_border;
}
if (border->m_oTop.IsInit())
{
std::wstring odf_border;
convert(border->m_oTop.GetPointer(), odf_border);
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ = odf_border;
}
if (border->m_oStart.IsInit())
{
std::wstring odf_border;
convert(border->m_oStart.GetPointer(), odf_border);
if (odf_border.length()>0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ = odf_border;
}
if (border->m_oEnd.IsInit())
{
std::wstring odf_border;
convert(border->m_oEnd.GetPointer(), odf_border);
if (odf_border.length()>0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = odf_border;
}
if (border->m_oEnd.IsInit())
std::wstring left,right,top,bottom, other;
convert(oox_border->m_oBottom.GetPointer() , bottom);
convert(oox_border->m_oTop.GetPointer() , top);
convert(oox_border->m_oStart.GetPointer() , left);
convert(oox_border->m_oEnd.GetPointer() , right);
if (bottom == top && top == left && left== right && bottom.length() > 0)
{
std::wstring odf_border;
convert(border->m_oEnd.GetPointer(), odf_border);
if (odf_border.length()>0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = odf_border;
table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_ = left;
}
if (border->m_oDiagonal.IsInit())
else
{
std::wstring odf_border;
convert(border->m_oDiagonal.GetPointer(), odf_border);
if (border->m_oDiagonalDown.IsInit() && odf_border.length()>0) //and true???
cell_properties->style_table_cell_properties_attlist_.style_diagonal_tl_br_= odf_border;
if (border->m_oDiagonalUp.IsInit() && odf_border.length()>0) //and true???
cell_properties->style_table_cell_properties_attlist_.style_diagonal_bl_tr_= odf_border;
if (bottom.length() >0 )table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = bottom;
if (top.length() >0 ) table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ = top;
if (left.length() >0 ) table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ = left;
if (right.length() >0 ) table_cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = right;
}
convert(oox_border->m_oDiagonal.GetPointer(), other);
if (oox_border->m_oDiagonalDown.IsInit() && other.length()>0) //and true???
table_cell_properties->style_table_cell_properties_attlist_.style_diagonal_tl_br_= other;
if (oox_border->m_oDiagonalUp.IsInit() && other.length()>0) //and true???
table_cell_properties->style_table_cell_properties_attlist_.style_diagonal_bl_tr_= other;
//nullable<CBorderProp> m_oHorizontal;
//nullable<CBorderProp> m_oVertical;
//nullable<SimpleTypes::COnOff<>> m_oOutline;
......
......@@ -99,6 +99,7 @@ namespace Oox2Odf
virtual OOX::CTheme *oox_theme();
virtual CString find_link_by_id (CString sId, int t);
void convert(OOX::Spreadsheet::WritingElement *oox_unknown);
private:
OOX::Spreadsheet::CXlsx *xlsx_document;
odf::package::odf_document *output_document;
......@@ -107,9 +108,7 @@ namespace Oox2Odf
odf::ods_conversion_context *ods_context;
void convert_sheets();
void convert_styles();
void convert(OOX::Spreadsheet::WritingElement *oox_unknown);
void convert_styles();
void convert(OOX::Spreadsheet::CWorksheet *oox_sheet);
void convert(OOX::Spreadsheet::CDefinedName *oox_defined);
......
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