mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
(1.0.1.206): ASCOfficeOdfFile
(1.2.0.112): ASCOfficeOdfFileW git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57616 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
a494b1c708
commit
aa09c791ba
@ -2,6 +2,6 @@
|
||||
//1
|
||||
//0
|
||||
//1
|
||||
//205
|
||||
#define INTVER 1,0,1,205
|
||||
#define STRVER "1,0,1,205\0"
|
||||
//206
|
||||
#define INTVER 1,0,1,206
|
||||
#define STRVER "1,0,1,206\0"
|
||||
|
||||
@ -853,8 +853,10 @@ std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val, const _
|
||||
double v2 = (!Val2 || Val2->get_type() == length_or_percent::Percent) ? 0 :
|
||||
(20.0 * Val2->get_length().get_value_unit(length::pt));
|
||||
|
||||
|
||||
return boost::lexical_cast<std::wstring>( (int)( (!Val ? v2 : v1) + AddVal.get_value_or(length(0, length::pt)).get_value_unit(length::pt) + 0.5 ));
|
||||
double dAddVal = AddVal.get_value_or(length(0, length::pt)).get_value_unit(length::pt) + 0.5;
|
||||
|
||||
if (dAddVal < 0 ) dAddVal = 0;
|
||||
return boost::lexical_cast<std::wstring>( (int)( (!Val ? v2 : v1) + dAddVal));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,17 +21,17 @@ class style_header_footer_properties_attlist
|
||||
public:
|
||||
void serialize(CP_ATTR_NODE);
|
||||
|
||||
_CP_OPT(length) svg_height_;
|
||||
_CP_OPT(length) fo_min_height_;
|
||||
common_horizontal_margin_attlist common_horizontal_margin_attlist_;
|
||||
common_vertical_margin_attlist common_vertical_margin_attlist_;
|
||||
common_margin_attlist common_margin_attlist_;
|
||||
common_border_attlist common_border_attlist_;
|
||||
common_border_line_width_attlist common_border_line_width_attlist_;
|
||||
common_padding_attlist common_padding_attlist_;
|
||||
common_background_color_attlist common_background_color_attlist_;
|
||||
common_shadow_attlist common_shadow_attlist_;
|
||||
_CP_OPT(Bool) style_dynamic_spacing_;
|
||||
_CP_OPT(length) svg_height_;
|
||||
_CP_OPT(length) fo_min_height_;
|
||||
common_horizontal_margin_attlist common_horizontal_margin_attlist_;
|
||||
common_vertical_margin_attlist common_vertical_margin_attlist_;
|
||||
common_margin_attlist common_margin_attlist_;
|
||||
common_border_attlist common_border_attlist_;
|
||||
common_border_line_width_attlist common_border_line_width_attlist_;
|
||||
common_padding_attlist common_padding_attlist_;
|
||||
common_background_color_attlist common_background_color_attlist_;
|
||||
common_shadow_attlist common_shadow_attlist_;
|
||||
_CP_OPT(Bool) style_dynamic_spacing_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -149,27 +149,93 @@ void odf_page_layout_context::set_page_margin(_CP_OPT(length) top, _CP_OPT(lengt
|
||||
void odf_page_layout_context::set_page_gutter(_CP_OPT(length) length_)
|
||||
{
|
||||
if (!length_) return;
|
||||
|
||||
|
||||
}
|
||||
void odf_page_layout_context::set_page_footer(_CP_OPT(length) length_)
|
||||
{
|
||||
if (!length_) return;
|
||||
|
||||
style_page_layout_properties * props = get_properties();
|
||||
if (!props)return;
|
||||
|
||||
if (props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_)
|
||||
if (props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_)
|
||||
{
|
||||
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_=
|
||||
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_->get_length() + length(length_->get_value_unit(length::cm),length::cm);
|
||||
props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_=
|
||||
props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_->get_length() + length(length_->get_value_unit(length::cm),length::cm);
|
||||
}
|
||||
else
|
||||
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_= length(length_->get_value_unit(length::cm),length::cm);
|
||||
props->style_page_layout_properties_attlist_.common_horizontal_margin_attlist_.fo_margin_left_= length(length_->get_value_unit(length::cm),length::cm);
|
||||
|
||||
}
|
||||
void odf_page_layout_context::set_footer_size(_CP_OPT(length) length_)//<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> footer <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
if (!length_) return;
|
||||
style_header_footer_properties * footer_props = get_footer_properties();
|
||||
if (!footer_props)return;
|
||||
style_page_layout_properties * props = get_properties();
|
||||
if (!props)return;
|
||||
|
||||
_CP_OPT(length) bottom_;
|
||||
|
||||
if (props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_)
|
||||
bottom_= props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_->get_length();
|
||||
|
||||
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
|
||||
|
||||
if (bottom_)
|
||||
footer_props->style_header_footer_properties_attlist_.svg_height_ = bottom_.get() - length_.get();//fo_min_height_
|
||||
}
|
||||
void odf_page_layout_context::set_header_size(_CP_OPT(length) length_)
|
||||
{
|
||||
if (!length_) return;
|
||||
style_header_footer_properties * header_props = get_header_properties();
|
||||
if (!header_props)return;
|
||||
style_page_layout_properties * props = get_properties();
|
||||
if (!props)return;
|
||||
|
||||
_CP_OPT(length) top_;
|
||||
|
||||
if (props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_)
|
||||
top_ = props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_->get_length();;
|
||||
|
||||
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
|
||||
|
||||
if (top_)
|
||||
header_props->style_header_footer_properties_attlist_.svg_height_ = top_.get()- length_.get();//fo_min_height_
|
||||
}
|
||||
|
||||
void odf_page_layout_context::set_background(_CP_OPT(color) & color, int type)
|
||||
{
|
||||
if (!color) return;
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
style_page_layout_properties * props = get_properties();
|
||||
if (!props)return;
|
||||
|
||||
props->style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ = color;
|
||||
}
|
||||
if (type == 2)
|
||||
{
|
||||
style_header_footer_properties * props = get_header_properties();
|
||||
if (!props)return;
|
||||
|
||||
props->style_header_footer_properties_attlist_.common_background_color_attlist_.fo_background_color_ = color;
|
||||
}
|
||||
if (type == 3)
|
||||
{
|
||||
style_header_footer_properties * props = get_footer_properties();
|
||||
if (!props)return;
|
||||
|
||||
props->style_header_footer_properties_attlist_.common_background_color_attlist_.fo_background_color_ = color;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
void odf_page_layout_context::add_footer(int type)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
|
||||
if (type == 1)
|
||||
create_element(L"style", L"footer-left", elm, odf_context_);
|
||||
else if (type == 2)
|
||||
create_element(L"style", L"footer-first", elm, odf_context_);
|
||||
else
|
||||
create_element(L"style", L"footer", elm, odf_context_);
|
||||
|
||||
master_state_list_.back().add_footer(elm);
|
||||
@ -177,25 +243,18 @@ void odf_page_layout_context::add_footer(int type)
|
||||
void odf_page_layout_context::add_header(int type)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"style", L"header", elm, odf_context_);
|
||||
|
||||
if (type == 1)
|
||||
create_element(L"style", L"header-left", elm, odf_context_);
|
||||
else if (type == 2)
|
||||
create_element(L"style", L"header-first", elm, odf_context_);
|
||||
else
|
||||
create_element(L"style", L"header", elm, odf_context_);
|
||||
|
||||
master_state_list_.back().add_header(elm);
|
||||
|
||||
}
|
||||
void odf_page_layout_context::set_page_header(_CP_OPT(length) length_)
|
||||
{
|
||||
if (!length_) return;
|
||||
style_page_layout_properties * props = get_properties();
|
||||
if (!props)return;
|
||||
|
||||
if (props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_)
|
||||
{
|
||||
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_=
|
||||
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_->get_length() + length(length_->get_value_unit(length::cm),length::cm);
|
||||
}
|
||||
else
|
||||
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_= length(length_->get_value_unit(length::cm),length::cm);
|
||||
}
|
||||
void odf_page_layout_context::set_page_border_shadow(bool val)
|
||||
{
|
||||
style_page_layout_properties * props = get_properties();
|
||||
@ -246,6 +305,45 @@ style_page_layout_properties * odf_page_layout_context::get_properties()
|
||||
}
|
||||
return props;
|
||||
}
|
||||
style_header_footer_properties *odf_page_layout_context::get_header_properties()
|
||||
{
|
||||
if (layout_state_list_.size() < 1) return NULL;
|
||||
style_header_footer_properties *props = layout_state_list_.back().get_header_properties();
|
||||
if (props == NULL)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"style", L"header-style", elm, odf_context_);
|
||||
layout_state_list_.back().add_child(elm, office_element_ptr(),L"");
|
||||
|
||||
office_element_ptr pr;
|
||||
create_element(L"style", L"header-footer-properties", pr, odf_context_);
|
||||
elm->add_child_element(pr);
|
||||
|
||||
props = layout_state_list_.back().get_header_properties();
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
style_header_footer_properties *odf_page_layout_context::get_footer_properties()
|
||||
{
|
||||
if (layout_state_list_.size() < 1) return NULL;
|
||||
style_header_footer_properties *props = layout_state_list_.back().get_footer_properties();
|
||||
if (props == NULL)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"style", L"footer-style", elm, odf_context_);
|
||||
layout_state_list_.back().add_child(elm, office_element_ptr(),L"");
|
||||
|
||||
office_element_ptr pr;
|
||||
create_element(L"style", L"header-footer-properties", pr, odf_context_);
|
||||
elm->add_child_element(pr);
|
||||
|
||||
props = layout_state_list_.back().get_footer_properties();
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
void odf_page_layout_context::set_page_orientation(int type)
|
||||
{
|
||||
style_page_layout_properties * props = get_properties();
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "odf_page_layout_state.h"
|
||||
#include "length.h"
|
||||
#include "color.h"
|
||||
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -45,8 +46,6 @@ public:
|
||||
void set_page_margin(_CP_OPT(double) top, _CP_OPT(double) left, _CP_OPT(double) bottom, _CP_OPT(double) right, _CP_OPT(double) header, _CP_OPT(double) footer);
|
||||
void set_page_margin(_CP_OPT(length) top, _CP_OPT(length) left, _CP_OPT(length) bottom, _CP_OPT(length) right);
|
||||
void set_page_gutter(_CP_OPT(length) length_);
|
||||
void set_page_header(_CP_OPT(length) length_);
|
||||
void set_page_footer(_CP_OPT(length) length_);
|
||||
|
||||
void set_page_border(std::wstring top, std::wstring left, std::wstring bottom, std::wstring right);
|
||||
void set_page_border_shadow(bool val);
|
||||
@ -54,11 +53,17 @@ public:
|
||||
void set_page_size(_CP_OPT(length) width, _CP_OPT(length) height);
|
||||
|
||||
void add_footer(int type);
|
||||
void set_footer_size(_CP_OPT(length) length_);
|
||||
void add_header(int type);
|
||||
void set_header_size(_CP_OPT(length) length_);
|
||||
|
||||
void set_background(_CP_OPT(color) & color, int type);
|
||||
|
||||
private:
|
||||
|
||||
style_page_layout_properties *get_properties();
|
||||
style_page_layout_properties *get_properties();
|
||||
style_header_footer_properties *get_header_properties();
|
||||
style_header_footer_properties *get_footer_properties();
|
||||
|
||||
odf_conversion_context * odf_context_;
|
||||
odf_style_context * style_context_;
|
||||
|
||||
@ -139,7 +139,29 @@ style_page_layout_properties *odf_layout_state::get_properties()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
style_header_footer_properties *odf_layout_state::get_header_properties()
|
||||
{
|
||||
for (long i= 1; i<elements_.size(); i++)//"0" - root
|
||||
{
|
||||
style_header_style *style_ = dynamic_cast<style_header_style *>(elements_[i].elm.get());
|
||||
if (style_)
|
||||
{
|
||||
return dynamic_cast<style_header_footer_properties *>(style_->style_header_footer_properties_.get());
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
style_header_footer_properties *odf_layout_state::get_footer_properties()
|
||||
{
|
||||
for (long i= 1; i<elements_.size(); i++)//"0" - root
|
||||
{
|
||||
style_footer_style *style_ = dynamic_cast<style_footer_style *>(elements_[i].elm.get());
|
||||
if (style_)
|
||||
{
|
||||
return dynamic_cast<style_header_footer_properties *>(style_->style_header_footer_properties_.get());
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,10 @@ namespace odf {
|
||||
class odf_conversion_context;
|
||||
class odf_style_context;
|
||||
class odf_page_layout_context;
|
||||
|
||||
class style_page_layout_properties;
|
||||
class style_header_footer_properties;
|
||||
|
||||
|
||||
struct odf_element_state
|
||||
{
|
||||
@ -62,7 +65,9 @@ public:
|
||||
void set_name(std::wstring & name);
|
||||
std::wstring get_name();
|
||||
|
||||
style_page_layout_properties * get_properties();//<2F><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ... <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
style_page_layout_properties *get_properties();//<2F><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ... <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
style_header_footer_properties *get_header_properties();//-''-
|
||||
style_header_footer_properties *get_footer_properties();//-''-
|
||||
private:
|
||||
std::wstring style_oox_name_;
|
||||
|
||||
|
||||
@ -37,6 +37,14 @@ style_text_properties *odf_table_styles_context::get_text_properties()
|
||||
create_element(L"style", L"text-properties",current->text_props, context_);
|
||||
return dynamic_cast<style_text_properties *>(current->text_props.get());
|
||||
}
|
||||
style_table_properties *odf_table_styles_context::get_table_properties()
|
||||
{
|
||||
if (current == NULL)return NULL;
|
||||
|
||||
if (!current->table_props)
|
||||
create_element(L"style", L"table-properties",current->table_props, context_);
|
||||
return dynamic_cast<style_table_properties *>(current->table_props.get());
|
||||
}
|
||||
|
||||
void odf_table_styles_context::start_style(std::wstring style_name)
|
||||
{
|
||||
@ -212,10 +220,22 @@ void odf_table_styles_context::get_table_cell_properties (int col, int row, styl
|
||||
if (se) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.seCell_.table_cell_props.get()));
|
||||
if (sw) cell_props->apply_from(dynamic_cast<style_table_cell_properties *>(state.swCell_.table_cell_props.get()));
|
||||
}
|
||||
|
||||
void odf_table_styles_context::get_table_properties (style_table_properties* table_props)
|
||||
{
|
||||
if (current_used_.size() < 1) return;
|
||||
if (table_props == NULL) return;
|
||||
|
||||
table_format_state & state = table_format_array_[current_used_.back().table_style_];
|
||||
|
||||
|
||||
table_props->apply_from(dynamic_cast<style_table_properties *>(state.table_.table_props.get()));
|
||||
|
||||
}
|
||||
void odf_table_styles_context::get_text_properties (int col, int row, style_text_properties* text_props)
|
||||
{
|
||||
if (current_used_.size() < 1) return;
|
||||
if (text_props == NULL) return;
|
||||
if (text_props == NULL) return;
|
||||
|
||||
table_format_state & state = table_format_array_[current_used_.back().table_style_];
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ namespace odf {
|
||||
class style_table_cell_properties;
|
||||
class style_text_properties;
|
||||
class style_paragraph_properties;
|
||||
class style_table_properties;
|
||||
|
||||
//typedef shared_ptr<style_text_properties>::Type style_text_properties_ptr;
|
||||
//typedef shared_ptr<style_paragraph_properties>::Type style_paragraph_properties_ptr;
|
||||
@ -22,6 +23,7 @@ class style_paragraph_properties;
|
||||
struct _style_properties
|
||||
{
|
||||
_style_properties(){is = false;}
|
||||
office_element_ptr table_props;
|
||||
office_element_ptr text_props;
|
||||
office_element_ptr paragraph_props;
|
||||
office_element_ptr table_cell_props;
|
||||
@ -83,6 +85,7 @@ public:
|
||||
style_table_cell_properties *get_table_cell_properties();
|
||||
style_paragraph_properties *get_paragraph_properties();
|
||||
style_text_properties *get_text_properties();
|
||||
style_table_properties *get_table_properties();
|
||||
|
||||
//-----------------------------------------------
|
||||
// output
|
||||
@ -91,9 +94,10 @@ public:
|
||||
void set_current_dimension(int col, int row);
|
||||
void set_flags(int val);
|
||||
|
||||
void get_table_cell_properties (int col, int row, style_table_cell_properties *props);
|
||||
void get_text_properties (int col, int row, style_text_properties *props);
|
||||
void get_paragraph_properties (int col, int row, style_paragraph_properties *props);
|
||||
void get_table_properties ( style_table_properties *props);
|
||||
void get_table_cell_properties (int col, int row, style_table_cell_properties *props);
|
||||
void get_text_properties (int col, int row, style_text_properties *props);
|
||||
void get_paragraph_properties (int col, int row, style_paragraph_properties *props);
|
||||
void end_table();
|
||||
|
||||
private:
|
||||
|
||||
@ -314,6 +314,14 @@ void odf_text_context::start_field(int type)
|
||||
page_numb->text_select_page_ = L"current";
|
||||
}
|
||||
}
|
||||
if (type == 3)
|
||||
{
|
||||
create_element(L"text", L"page-count", elm, odf_context_);
|
||||
}
|
||||
if (type == 4)
|
||||
{
|
||||
create_element(L"text", L"date", elm, odf_context_);
|
||||
}
|
||||
if (elm)
|
||||
{
|
||||
in_field_ = true;
|
||||
|
||||
@ -40,6 +40,7 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc
|
||||
{
|
||||
current_field_.enabled = false;
|
||||
current_field_.started = false;
|
||||
current_field_.in_span = false;
|
||||
|
||||
is_hyperlink_ = false;
|
||||
drop_cap_state_.clear();
|
||||
@ -278,13 +279,11 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
if (current_field_.enabled == false) return;
|
||||
|
||||
int res1 = instr.find(L"HYPERLINK");
|
||||
//FORMCHECKBOX
|
||||
|
||||
if (res1 >=0)
|
||||
if (res1 >=0) //<2F><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> - <20><><EFBFBD> hyperlink
|
||||
{
|
||||
std::wstring ref;
|
||||
current_field_.type = 1;
|
||||
|
||||
|
||||
std::wstring ref;
|
||||
boost::match_results<std::wstring::const_iterator> res;
|
||||
boost::wregex r2 (L"(\".*?\")+");
|
||||
if (boost::regex_search(instr, res, r2))
|
||||
@ -294,18 +293,44 @@ void odt_conversion_context::set_field_instr(std::wstring instr)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
res1 = instr.find(L"NUMPAGES");
|
||||
if (res1 >=0 && current_field_.type == 0)
|
||||
{
|
||||
current_field_.type = 3;
|
||||
}
|
||||
res1 = instr.find(L"PAGEREF");
|
||||
if (res1 >=0 && current_field_.type == 0) //<2F><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> - <20><><EFBFBD> bookmark
|
||||
{
|
||||
current_field_.type = 5;
|
||||
current_field_.value = instr.substr(9, instr.length()-5);
|
||||
}
|
||||
res1 = instr.find(L"PAGE");
|
||||
if (res1 >=0)
|
||||
if (res1 >=0 && current_field_.type == 0)
|
||||
{
|
||||
current_field_.type = 2;
|
||||
}
|
||||
|
||||
res1 = instr.find(L"TIME");
|
||||
if (res1 >=0 && current_field_.type == 0)
|
||||
{
|
||||
current_field_.type = 4;
|
||||
}
|
||||
res1 = instr.find(L"BIBLIOGRAPHY");
|
||||
if (res1 >=0 && current_field_.type == 0)
|
||||
{
|
||||
current_field_.type = 6;
|
||||
}
|
||||
//////////////////////////////////////////
|
||||
res1 = instr.find(L"@");
|
||||
if (res1 >=0)
|
||||
{
|
||||
current_field_.format = instr.substr(res1+1, instr.length());
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::start_field()
|
||||
void odt_conversion_context::start_field(bool in_span)
|
||||
{
|
||||
current_field_.enabled = true;
|
||||
|
||||
current_field_.in_span = in_span;
|
||||
current_field_.value = L"";
|
||||
current_field_.type = 0;
|
||||
}
|
||||
@ -392,8 +417,12 @@ void odt_conversion_context::end_field()
|
||||
if (current_field_.type == 1) end_hyperlink();
|
||||
else text_context()->end_field();
|
||||
}
|
||||
current_field_.value = L"";
|
||||
current_field_.format = L"";
|
||||
|
||||
current_field_.enabled = false;
|
||||
current_field_.started = false;
|
||||
current_field_.in_span = false;
|
||||
}
|
||||
void odt_conversion_context::end_paragraph()
|
||||
{
|
||||
@ -435,30 +464,32 @@ void odt_conversion_context::flush_section()
|
||||
void odt_conversion_context::start_run(bool styled)
|
||||
{
|
||||
if (is_hyperlink_ && text_context_.size() > 0) return;
|
||||
|
||||
|
||||
text_context()->start_span(styled);
|
||||
|
||||
if (current_field_.started== false && current_field_.type >1 && current_field_.enabled ==true)//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> span - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (current_field_.started== false && current_field_.type >1 && current_field_.enabled ==true && !current_field_.in_span)
|
||||
{
|
||||
text_context()->start_field(current_field_.type);
|
||||
current_field_.started = true;
|
||||
}
|
||||
}
|
||||
|
||||
text_context()->start_span(styled);
|
||||
|
||||
if (current_field_.started== false && current_field_.type >1 && current_field_.enabled ==true && current_field_.in_span)//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> span - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
text_context()->start_field(current_field_.type);
|
||||
current_field_.started = true;
|
||||
}
|
||||
}
|
||||
void odt_conversion_context::end_run()
|
||||
{
|
||||
if (is_hyperlink_ && text_context_.size() > 0) return;
|
||||
|
||||
if (current_field_.started== true && current_field_.type >1 && current_field_.enabled ==true)
|
||||
{
|
||||
end_field();
|
||||
}
|
||||
|
||||
if (current_field_.in_span && current_field_.started== true && current_field_.enabled ==true) end_field();
|
||||
|
||||
text_context()->end_span();
|
||||
|
||||
if (current_field_.started== false && current_field_.type == 1 && current_field_.enabled ==true)
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD> <20> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ... <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
start_hyperlink(current_field_.value);
|
||||
current_field_.started = true;
|
||||
}
|
||||
@ -730,6 +761,13 @@ void odt_conversion_context::end_header_footer()
|
||||
end_text_context();
|
||||
}
|
||||
|
||||
void odt_conversion_context::set_background(_CP_OPT(color) & color, int type)
|
||||
{
|
||||
if (!color) return;
|
||||
|
||||
page_layout_context()->set_background(color, type);
|
||||
}
|
||||
|
||||
void odt_conversion_context::start_footer(int type)
|
||||
{
|
||||
page_layout_context()->add_footer(type);
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
void start_hyperlink(std::wstring ref);
|
||||
void end_hyperlink();
|
||||
|
||||
void start_field();
|
||||
void start_field(bool in_span);
|
||||
void end_field();
|
||||
void set_field_instr(std::wstring instr);
|
||||
|
||||
@ -103,6 +103,8 @@ public:
|
||||
void start_footer(int type);
|
||||
void end_header_footer();
|
||||
|
||||
void set_background(_CP_OPT(color) & color, int type);
|
||||
|
||||
private:
|
||||
office_text* root_text_;
|
||||
office_element_ptr root_document_;
|
||||
@ -125,7 +127,9 @@ private:
|
||||
bool enabled;
|
||||
int type;
|
||||
std::wstring value;
|
||||
std::wstring format;
|
||||
bool started;
|
||||
bool in_span;
|
||||
}current_field_;
|
||||
|
||||
bool is_hyperlink_;
|
||||
|
||||
@ -133,8 +133,8 @@ public:
|
||||
|
||||
virtual void serialize(std::wostream & strm);
|
||||
|
||||
style_page_layout_properties_attlist style_page_layout_properties_attlist_;
|
||||
style_page_layout_properties_elements style_page_layout_properties_elements_;
|
||||
style_page_layout_properties_attlist style_page_layout_properties_attlist_;
|
||||
style_page_layout_properties_elements style_page_layout_properties_elements_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -54,6 +54,29 @@ void table_format_properties::serialize(std::wostream & _Wostream,const wchar_t
|
||||
}
|
||||
}
|
||||
}
|
||||
void table_format_properties::apply_from(const table_format_properties & Other)
|
||||
{
|
||||
_CP_APPLY_PROP(style_width_ , Other.style_width_);
|
||||
_CP_APPLY_PROP(style_rel_width_ , Other.style_rel_width_);
|
||||
_CP_APPLY_PROP(style_may_break_between_rows_, Other.style_may_break_between_rows_);
|
||||
_CP_APPLY_PROP(table_border_model_ , Other.table_border_model_);
|
||||
_CP_APPLY_PROP(table_display_ , Other.table_display_);
|
||||
_CP_APPLY_PROP(tableooo_tab_color_ , Other.tableooo_tab_color_);
|
||||
_CP_APPLY_PROP(table_align_ , Other.table_align_);
|
||||
|
||||
common_writing_mode_attlist_.apply_from(Other.common_writing_mode_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_page_number_attlist_.apply_from(Other.common_page_number_attlist_);
|
||||
common_break_attlist_.apply_from(Other.common_break_attlist_);
|
||||
common_background_color_attlist_.apply_from(Other.common_background_color_attlist_);
|
||||
common_shadow_attlist_.apply_from(Other.common_shadow_attlist_);
|
||||
common_keep_with_next_attlist_.apply_from(Other.common_keep_with_next_attlist_);
|
||||
common_border_attlist_.apply_from(Other.common_border_attlist_);
|
||||
|
||||
style_background_image_ = Other.style_background_image_;
|
||||
}
|
||||
|
||||
// style:table-properties
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -71,6 +94,14 @@ void style_table_properties::serialize(std::wostream & _Wostream)
|
||||
table_format_properties_.serialize(_Wostream,ns,name);
|
||||
|
||||
}
|
||||
|
||||
void style_table_properties::apply_from(const style_table_properties * Other)
|
||||
{
|
||||
if (Other == NULL) return;
|
||||
|
||||
table_format_properties_.apply_from(Other->table_format_properties_);
|
||||
}
|
||||
|
||||
|
||||
// style-table-column-properties-attlist
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -31,7 +31,7 @@ class table_format_properties
|
||||
{
|
||||
public:
|
||||
bool create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
|
||||
|
||||
void apply_from(const table_format_properties & Other);
|
||||
void serialize(std::wostream & strm ,const wchar_t * ns, const wchar_t * name );
|
||||
|
||||
_CP_OPT(length) style_width_;
|
||||
@ -74,6 +74,8 @@ public:
|
||||
virtual void create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name);
|
||||
virtual void add_child_element(office_element_ptr & child){}
|
||||
|
||||
void apply_from(const style_table_properties * Other);
|
||||
|
||||
virtual void serialize(std::wostream & strm);
|
||||
|
||||
table_format_properties table_format_properties_;
|
||||
|
||||
@ -93,6 +93,7 @@ namespace OOX
|
||||
}
|
||||
namespace Spreadsheet
|
||||
{
|
||||
class IFileContainer;
|
||||
class CChartSpace;
|
||||
|
||||
class CT_extLst;
|
||||
@ -281,7 +282,11 @@ public:
|
||||
virtual void convertDocument() = 0;
|
||||
virtual void write(const std::wstring & path) = 0;
|
||||
|
||||
OoxConverter(const ProgressCallback* CallBack = NULL){oox_current_chart = NULL; pCallBack = CallBack;bUserStopConvert = 0;}
|
||||
OoxConverter(const ProgressCallback* CallBack = NULL){ oox_current_child_document_spreadsheet = NULL;
|
||||
oox_current_child_document = NULL;
|
||||
|
||||
pCallBack = CallBack;
|
||||
bUserStopConvert = 0;}
|
||||
|
||||
const ProgressCallback* pCallBack;
|
||||
short bUserStopConvert;
|
||||
@ -291,7 +296,9 @@ public:
|
||||
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;
|
||||
|
||||
OOX::Spreadsheet::IFileContainer *oox_current_child_document_spreadsheet;
|
||||
OOX::IFileContainer *oox_current_child_document;
|
||||
//.......................................................................................................................
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size);
|
||||
|
||||
@ -70,26 +70,10 @@ CString DocxConverter::find_link_by_id (CString sId, int type)
|
||||
if (oox_doc == NULL)return L"";
|
||||
|
||||
CString ref;
|
||||
smart_ptr<OOX::File> oFile = docx_document->GetDocument()->Find(sId);
|
||||
|
||||
if (oFile.IsInit())
|
||||
if (ref.GetLength() < 1 && oox_current_child_document_spreadsheet)
|
||||
{
|
||||
if (type==1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
|
||||
{
|
||||
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
|
||||
|
||||
ref = pHyperlink->Uri().GetPath();
|
||||
}
|
||||
}
|
||||
if (ref.GetLength() < 1 && oox_current_chart)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = oox_current_chart->Find(sId);
|
||||
smart_ptr<OOX::File> oFile = oox_current_child_document_spreadsheet->Find(sId);
|
||||
if (oFile.IsInit())
|
||||
{
|
||||
if (type==1 && OOX::FileTypes::Image == oFile->type())
|
||||
@ -106,6 +90,42 @@ CString DocxConverter::find_link_by_id (CString sId, int type)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ref.GetLength() < 1 && oox_current_child_document)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = oox_current_child_document->Find(sId);
|
||||
if (oFile.IsInit())
|
||||
{
|
||||
if (type==1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type==2 && oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
smart_ptr<OOX::File> oFile = docx_document->GetDocument()->Find(sId);
|
||||
if (ref.GetLength() < 1 && oFile.IsInit())
|
||||
{
|
||||
if (type==1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
|
||||
{
|
||||
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
|
||||
|
||||
ref = pHyperlink->Uri().GetPath();
|
||||
}
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
@ -140,8 +160,6 @@ void DocxConverter::convert_document()
|
||||
const OOX::CDocument* document = docx_document->GetDocument();
|
||||
if (!document)return;
|
||||
|
||||
convert(document->m_oBackground.GetPointer());//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
for ( int nIndex = 0; nIndex < document->m_arrItems.GetSize(); nIndex++ )
|
||||
{
|
||||
convert(document->m_arrItems[nIndex]);
|
||||
@ -438,8 +456,9 @@ void DocxConverter::convert(OOX::Logic::CFldChar *oox_fld)
|
||||
//nullable<OOX::Logic::CFFData > m_oFFData;
|
||||
if (oox_fld->m_oFldCharType.IsInit())
|
||||
{
|
||||
if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeBegin) odt_context->start_field();
|
||||
if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeBegin) odt_context->start_field(false);
|
||||
if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeEnd) odt_context->end_field();
|
||||
if (oox_fld->m_oFldCharType->GetValue() == SimpleTypes::fldchartypeSeparate){}
|
||||
}
|
||||
|
||||
}
|
||||
@ -450,7 +469,7 @@ void DocxConverter::convert(OOX::Logic::CFldSimple *oox_fld)
|
||||
//SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oDirty;
|
||||
//SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oFldLock;
|
||||
|
||||
odt_context->start_field();
|
||||
odt_context->start_field(true);
|
||||
if (oox_fld->m_sInstr.IsInit()) odt_context->set_field_instr(string2std_string(oox_fld->m_sInstr.get2()));
|
||||
|
||||
for (long i=0; i< oox_fld->m_arrItems.GetSize(); i++)
|
||||
@ -660,10 +679,10 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
odt_context->page_layout_context()->set_page_gutter(other);
|
||||
|
||||
convert(oox_section_pr->m_oPgMar->m_oFooter.GetPointer(), other);
|
||||
odt_context->page_layout_context()->set_page_footer(other);
|
||||
odt_context->page_layout_context()->set_footer_size(other);
|
||||
|
||||
convert(oox_section_pr->m_oPgMar->m_oHeader.GetPointer(), other);
|
||||
odt_context->page_layout_context()->set_page_header(other);
|
||||
odt_context->page_layout_context()->set_header_size(other);
|
||||
}
|
||||
if (oox_section_pr->m_oPgBorders.IsInit())
|
||||
{
|
||||
@ -709,6 +728,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
|
||||
//nullable<SimpleTypes::CDecimalNumber<> > m_oCode;
|
||||
}
|
||||
convert(docx_document->GetDocument()->m_oBackground.GetPointer(), 1);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> :(, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD> <20> <20><>
|
||||
//nullable<ComplexTypes::Word::CTextDirection > m_oTextDirection;
|
||||
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oRtlGutter;
|
||||
//nullable<ComplexTypes::Word::CVerticalJc > m_oVAlign;
|
||||
@ -722,7 +742,10 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
odt_context->start_header(type);
|
||||
|
||||
if (oox_section_pr->m_arrHeaderReference[i].m_oId.IsInit())
|
||||
{
|
||||
convert_hdr_ftr(oox_section_pr->m_arrHeaderReference[i].m_oId->GetValue());
|
||||
//convert(docx_document->GetDocument()->m_oBackground.GetPointer(), 2);
|
||||
}
|
||||
|
||||
odt_context->end_header_footer();
|
||||
}
|
||||
@ -733,16 +756,15 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
odt_context->start_footer(type);
|
||||
|
||||
if (oox_section_pr->m_arrFooterReference[i].m_oId.IsInit())
|
||||
{
|
||||
convert_hdr_ftr(oox_section_pr->m_arrFooterReference[i].m_oId->GetValue());
|
||||
//convert(docx_document->GetDocument()->m_oBackground.GetPointer(), 3);
|
||||
}
|
||||
|
||||
odt_context->end_header_footer();
|
||||
}
|
||||
//master page create
|
||||
// add colontitul
|
||||
// style name master page -> 0-<2D> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (!root)odt_context->add_section(continuous);
|
||||
|
||||
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oBidi;
|
||||
@ -796,9 +818,29 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
|
||||
if (root) odt_context->flush_section();
|
||||
}
|
||||
|
||||
|
||||
if (root)odt_context->page_layout_context()->set_current_master_page_base();
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
|
||||
{
|
||||
if (oox_background == NULL) return;
|
||||
|
||||
if (oox_background->m_oDrawing.IsInit())
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
_CP_OPT(odf::color) color;
|
||||
convert ( oox_background->m_oColor.GetPointer(),
|
||||
oox_background->m_oThemeColor.GetPointer(),
|
||||
oox_background->m_oThemeTint.GetPointer(),
|
||||
oox_background->m_oThemeShade.GetPointer(), color);
|
||||
|
||||
odt_context->set_background(color, type);
|
||||
}
|
||||
}
|
||||
|
||||
void DocxConverter::convert(ComplexTypes::Word::CFramePr *oox_frame_pr, odf::style_paragraph_properties * paragraph_properties)
|
||||
{
|
||||
if (oox_frame_pr == NULL) return;
|
||||
@ -1612,7 +1654,13 @@ void DocxConverter::convert(OOX::Drawing::CChart * oox_chart)
|
||||
|
||||
if (oox_chart->m_oRId.IsInit())
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = docx_document->GetDocument()->Find(oox_chart->m_oRId->GetValue());
|
||||
smart_ptr<OOX::File> oFile;
|
||||
|
||||
if (oox_current_child_document)
|
||||
oFile = oox_current_child_document->Find(oox_chart->m_oRId->GetValue());
|
||||
else
|
||||
oFile = docx_document->GetDocument()->Find(oox_chart->m_oRId->GetValue());
|
||||
|
||||
if (oFile.IsInit() && OOX::FileTypes::Chart == oFile->type())
|
||||
{
|
||||
OOX::Spreadsheet::CChartSpace* pChart = (OOX::Spreadsheet::CChartSpace*)oFile.operator->();
|
||||
@ -1627,12 +1675,14 @@ void DocxConverter::convert(OOX::Drawing::CChart * oox_chart)
|
||||
|
||||
OoxConverter::convert(pChart->m_oChartSpace.m_oSpPr.GetPointer());
|
||||
|
||||
oox_current_chart = pChart;
|
||||
oox_current_child_document_spreadsheet = dynamic_cast<OOX::Spreadsheet::IFileContainer*>(pChart);
|
||||
|
||||
odf_context()->start_chart();
|
||||
odf_context()->chart_context()->set_chart_size(width, height);
|
||||
OoxConverter::convert(&pChart->m_oChartSpace);
|
||||
odf_context()->end_chart();
|
||||
oox_current_chart = NULL; // object???
|
||||
|
||||
oox_current_child_document_spreadsheet = NULL;
|
||||
|
||||
odt_context->drawing_context()->end_object();
|
||||
odt_context->drawing_context()->end_drawing();
|
||||
@ -1933,8 +1983,8 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style)
|
||||
|
||||
if (oox_style->m_oTblPr.IsInit())
|
||||
{
|
||||
//odf::style_table_properties * table_properties = odt_context->styles_context()->table_styles().get_table_properties();
|
||||
//convert(oox_style->m_oTblPr.GetPointer(), table_properties);
|
||||
odf::style_table_properties * table_properties = odt_context->styles_context()->table_styles().get_table_properties();
|
||||
convert(oox_style->m_oTblPr.GetPointer(), table_properties);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> base_on
|
||||
|
||||
@ -2123,10 +2173,14 @@ void DocxConverter::convert_hdr_ftr (CString sId)
|
||||
OOX::CHdrFtr * oox_hdr_ftr = docx_document->GetHeaderOrFooter(sId);
|
||||
if (oox_hdr_ftr == NULL ) return;
|
||||
|
||||
oox_current_child_document = dynamic_cast<OOX::IFileContainer*>(oox_hdr_ftr);
|
||||
|
||||
for ( int nIndex = 0; nIndex < oox_hdr_ftr->m_arrItems.GetSize(); nIndex++ )
|
||||
{
|
||||
convert(oox_hdr_ftr->m_arrItems[nIndex]);
|
||||
}
|
||||
|
||||
oox_current_child_document = NULL;
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
{
|
||||
@ -2137,8 +2191,18 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
odt_context->end_paragraph();
|
||||
m_bKeepNextParagraph = false;
|
||||
}
|
||||
bool styled_table = false;
|
||||
bool in_frame = false;
|
||||
|
||||
if (oox_table->m_oTableProperties && (oox_table->m_oTableProperties->m_oTblStyle.IsInit() && oox_table->m_oTableProperties->m_oTblStyle->m_sVal.IsInit()))
|
||||
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::wstring base_style_name = string2std_string(*oox_table->m_oTableProperties->m_oTblStyle->m_sVal);
|
||||
|
||||
bool in_frame = false;
|
||||
styled_table = odt_context->styles_context()->table_styles().start_table(base_style_name);
|
||||
}
|
||||
|
||||
convert(oox_table->m_oTableProperties, styled_table );
|
||||
|
||||
if(oox_table->m_oTableProperties && oox_table->m_oTableProperties->m_oTblpPr.IsInit() &&
|
||||
(oox_table->m_oTableProperties->m_oTblpPr->m_oTblpX.IsInit() && oox_table->m_oTableProperties->m_oTblpPr->m_oTblpY.IsInit()))
|
||||
{
|
||||
@ -2157,21 +2221,13 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
odt_context->start_text_context();
|
||||
}
|
||||
|
||||
convert(oox_table->m_oTableProperties);
|
||||
odt_context->start_table(true);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (oox_table->m_oTableProperties && (oox_table->m_oTableProperties->m_oTblStyle.IsInit() && oox_table->m_oTableProperties->m_oTblStyle->m_sVal.IsInit()))
|
||||
if (styled_table)
|
||||
{
|
||||
std::wstring base_style_name = string2std_string(*oox_table->m_oTableProperties->m_oTblStyle->m_sVal);
|
||||
|
||||
bool res = odt_context->styles_context()->table_styles().start_table(base_style_name);
|
||||
if (res)
|
||||
{
|
||||
odt_context->table_context()->set_table_styled(res);
|
||||
if (oox_table->m_oTableProperties->m_oTblLook.IsInit() && oox_table->m_oTableProperties->m_oTblLook->m_oVal.IsInit())
|
||||
odt_context->styles_context()->table_styles().set_flags(oox_table->m_oTableProperties->m_oTblLook->m_oVal->GetValue());
|
||||
}
|
||||
odt_context->table_context()->set_table_styled(styled_table);
|
||||
if (oox_table->m_oTableProperties->m_oTblLook.IsInit() && oox_table->m_oTableProperties->m_oTblLook->m_oVal.IsInit())
|
||||
odt_context->styles_context()->table_styles().set_flags(oox_table->m_oTableProperties->m_oTblLook->m_oVal->GetValue());
|
||||
}
|
||||
|
||||
int count_rows = oox_table->m_nCountRow;
|
||||
@ -2415,11 +2471,9 @@ void DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf::style
|
||||
|
||||
}
|
||||
}
|
||||
bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr)
|
||||
bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, bool base_styled)
|
||||
{
|
||||
if (oox_table_pr == NULL) return false;
|
||||
|
||||
if (oox_table_pr->m_oTblBorders.IsInit())
|
||||
if (oox_table_pr && oox_table_pr->m_oTblBorders.IsInit())
|
||||
{//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cell_prop <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20><><EFBFBD> default-cell-style-name <20><> columns & row
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
@ -2431,11 +2485,15 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr)
|
||||
|
||||
odt_context->table_context()->set_default_cell_properties(odt_context->styles_context()->last_state()->get_name());
|
||||
}
|
||||
|
||||
odt_context->styles_context()->create_style(L"",odf::style_family::Table, true, false, -1); //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> cells
|
||||
if (oox_table_pr == NULL) return false;
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
odt_context->styles_context()->create_style(L"",odf::style_family::Table, true, false, -1);
|
||||
|
||||
odf::style_table_properties * table_properties = odt_context->styles_context()->last_state()->get_table_properties();
|
||||
if (base_styled)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> :(
|
||||
odt_context->styles_context()->table_styles().get_table_properties(table_properties);
|
||||
}
|
||||
convert(oox_table_pr, table_properties);
|
||||
|
||||
return true;
|
||||
@ -2606,8 +2664,8 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
|
||||
int row=odt_context->table_context()->current_row();
|
||||
|
||||
odt_context->styles_context()->table_styles().get_table_cell_properties (col, row, cell_properties);
|
||||
odt_context->styles_context()->table_styles().get_text_properties (col, row, text_properties);
|
||||
odt_context->styles_context()->table_styles().get_paragraph_properties (col, row, paragraph_properties);
|
||||
odt_context->styles_context()->table_styles().get_text_properties (col, row, text_properties);
|
||||
odt_context->styles_context()->table_styles().get_paragraph_properties (col, row, paragraph_properties);
|
||||
}
|
||||
cell_properties->apply_from(parent_cell_properties);
|
||||
bool res = convert(oox_table_cell_pr, cell_properties);
|
||||
|
||||
@ -48,6 +48,7 @@ namespace OOX
|
||||
class CTcBorders;
|
||||
class CTblBorders;
|
||||
class CSdt;
|
||||
class CBackground;
|
||||
|
||||
}
|
||||
|
||||
@ -110,6 +111,7 @@ namespace Oox2Odf
|
||||
void convert_comment (int oox_comm_id);
|
||||
void convert_hdr_ftr (CString sId);
|
||||
|
||||
void convert(OOX::Logic::CBackground *oox_background, int type);
|
||||
void convert(OOX::Logic::CSdt *oox_sdt);
|
||||
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool root = false);
|
||||
void convert(OOX::Logic::CParagraph *oox_paragraph);
|
||||
@ -169,11 +171,11 @@ namespace Oox2Odf
|
||||
|
||||
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, int col = -1);
|
||||
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);
|
||||
bool convert(OOX::Logic::CTableProperty *oox_table_pr, bool base_styled);
|
||||
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);
|
||||
void convert(OOX::Logic::CTableRowProperties *oox_table_row_pr, odf::style_table_row_properties *table_row_properties);
|
||||
//--------------------------------------------------------------------------------
|
||||
bool m_bKeepNextParagraph;
|
||||
};
|
||||
|
||||
@ -76,9 +76,19 @@ CString XlsxConverter::find_link_by_id (CString sId, int type)
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
}
|
||||
if (ref.GetLength() < 1 && oox_current_chart)
|
||||
if (ref.GetLength() < 1 && oox_current_child_document)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = oox_current_chart->Find(sId);
|
||||
smart_ptr<OOX::File> oFile = oox_current_child_document->Find(sId);
|
||||
if (oFile.IsInit() && OOX::Spreadsheet::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Spreadsheet::Image* pImage = (OOX::Spreadsheet::Image*)oFile.operator->();
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
}
|
||||
if (ref.GetLength() < 1 && oox_current_child_document_spreadsheet)
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = oox_current_child_document_spreadsheet->Find(sId);
|
||||
if (oFile.IsInit() && OOX::Spreadsheet::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Spreadsheet::Image* pImage = (OOX::Spreadsheet::Image*)oFile.operator->();
|
||||
@ -1635,12 +1645,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CGraphicFrame* oox_graphic_frame)
|
||||
{
|
||||
OoxConverter::convert(pChart->m_oChartSpace.m_oSpPr.GetPointer());
|
||||
|
||||
oox_current_chart = pChart;
|
||||
oox_current_child_document_spreadsheet = dynamic_cast<OOX::Spreadsheet::IFileContainer*>(pChart);
|
||||
|
||||
odf_context()->start_chart();
|
||||
odf_context()->chart_context()->set_chart_size(width, height);
|
||||
OoxConverter::convert(&pChart->m_oChartSpace);
|
||||
odf_context()->end_chart();
|
||||
oox_current_chart = NULL; // object???
|
||||
|
||||
oox_current_child_document_spreadsheet = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
//1
|
||||
//2
|
||||
//0
|
||||
//111
|
||||
#define INTVER 1,2,0,111
|
||||
#define STRVER "1,2,0,111\0"
|
||||
//112
|
||||
#define INTVER 1,2,0,112
|
||||
#define STRVER "1,2,0,112\0"
|
||||
|
||||
Reference in New Issue
Block a user