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

(1.2.0.132): ASCOfficeOdfFileW


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57885 954022d7-b5bf-4e40-9824-e11837661b57
parent 4eb8c088
...@@ -62,6 +62,11 @@ length operator * (length & _Length1, double val) ...@@ -62,6 +62,11 @@ length operator * (length & _Length1, double val)
{ {
return length(_Length1.get_value() * val ,_Length1.get_unit()); return length(_Length1.get_value() * val ,_Length1.get_unit());
} }
bool operator == (length & _Length1, length & _Length2)
{
if (_Length1.get_value() == _Length2.get_value())return true;
else return false;
}
length length::parse(const std::wstring & Str) length length::parse(const std::wstring & Str)
{ {
......
...@@ -51,6 +51,7 @@ length operator + (length & _Length1, length & _Length2); ...@@ -51,6 +51,7 @@ length operator + (length & _Length1, length & _Length2);
length operator - (length & _Length1, length & _Length2); length operator - (length & _Length1, length & _Length2);
length operator / (length & _Length1, double val); length operator / (length & _Length1, double val);
length operator * (length & _Length1, double val); length operator * (length & _Length1, double val);
bool operator == (length & _Length1, length & _Length2);
typedef length coordinate; typedef length coordinate;
......
...@@ -808,6 +808,11 @@ void odf_drawing_context::start_element(office_element_ptr & elm, office_element ...@@ -808,6 +808,11 @@ void odf_drawing_context::start_element(office_element_ptr & elm, office_element
{ {
style_name = style_->style_name_; style_name = style_->style_name_;
impl_->current_graphic_properties = style_->style_content_.get_style_graphic_properties(); impl_->current_graphic_properties = style_->style_content_.get_style_graphic_properties();
if (impl_->current_drawing_state_.name_.length() < 1)
{
impl_->current_drawing_state_.name_ = std::wstring(L"Object_") + style_name;
}
} }
odf_element_state state={elm, style_name, style_elm, level}; odf_element_state state={elm, style_name, style_elm, level};
...@@ -931,7 +936,7 @@ void odf_drawing_context::set_path(std::wstring path_string) ...@@ -931,7 +936,7 @@ void odf_drawing_context::set_path(std::wstring path_string)
//boost::replace_all(path_string, L",,", L" 0 "); //boost::replace_all(path_string, L",,", L" 0 ");
//boost::replace_all(path_string, L" -", L"-"); //boost::replace_all(path_string, L" -", L"-");
//boost::replace_all(path_string, L",", L"0"); // //boost::replace_all(path_string, L",", L"0"); //
impl_->current_drawing_state_.path_ = path_string; //impl_->current_drawing_state_.path_ = path_string;
} }
void odf_drawing_context::add_path_element(std::wstring command, std::wstring & strE) void odf_drawing_context::add_path_element(std::wstring command, std::wstring & strE)
{ {
......
B#include "precompiled_cpodf.h" B#include "precompiled_cpodf.h"
......
...@@ -14,6 +14,7 @@ namespace odf { ...@@ -14,6 +14,7 @@ namespace odf {
class ods_conversion_context; class ods_conversion_context;
class style_list_level_properties; class style_list_level_properties;
class style_list_level_label_alignment; class style_list_level_label_alignment;
class style_text_properties;
class office_element; class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr; typedef shared_ptr<office_element>::Type office_element_ptr;
...@@ -34,9 +35,14 @@ public: ...@@ -34,9 +35,14 @@ public:
void set_odf_context(odf_conversion_context * Context); void set_odf_context(odf_conversion_context * Context);
void start_style(int abstract_number); void start_style(int abstract_number);
void start_style_level(int level, int type); int start_style_level(int level, int type);
style_list_level_properties * get_list_level_properties(); style_list_level_properties * get_list_level_properties();
style_list_level_label_alignment * get_list_level_alignment_properties(); style_list_level_label_alignment * get_list_level_alignment_properties();
style_text_properties * get_text_properties();
void set_bullet_char (std::wstring val);
void set_start_number (int val);
void set_text_style_name(std::wstring val);
void end_style_level(); void end_style_level();
void end_style(); void end_style();
......
...@@ -23,6 +23,9 @@ odf_page_layout_context::odf_page_layout_context(odf_conversion_context * Contex ...@@ -23,6 +23,9 @@ odf_page_layout_context::odf_page_layout_context(odf_conversion_context * Contex
local_style_context_ = boost::shared_ptr<odf_style_context>(new odf_style_context()); local_style_context_ = boost::shared_ptr<odf_style_context>(new odf_style_context());
local_style_context_->set_odf_context(odf_context_); local_style_context_->set_odf_context(odf_context_);
even_and_left_headers_ = true;
} }
odf_page_layout_context::~odf_page_layout_context() odf_page_layout_context::~odf_page_layout_context()
...@@ -45,7 +48,7 @@ odf_master_state & odf_page_layout_context::last_master() ...@@ -45,7 +48,7 @@ odf_master_state & odf_page_layout_context::last_master()
throw; throw;
} }
void odf_page_layout_context::create_master_page(std::wstring page_name) void odf_page_layout_context::start_master_page(std::wstring page_name)
{ {
office_element_ptr elm; office_element_ptr elm;
create_element(L"style", L"master-page", elm, odf_context_); create_element(L"style", L"master-page", elm, odf_context_);
...@@ -62,6 +65,43 @@ void odf_page_layout_context::create_master_page(std::wstring page_name) ...@@ -62,6 +65,43 @@ void odf_page_layout_context::create_master_page(std::wstring page_name)
create_layout_page(); create_layout_page();
master_state_list_.back().set_layout_name(layout_state_list_.back().get_name()); master_state_list_.back().set_layout_name(layout_state_list_.back().get_name());
} }
void odf_page_layout_context::end_master_page()
{
if (master_state_list_.size() < 1)return;
bool header=false, f_header = false, l_header = false;
bool footer=false, f_footer = false, l_footer = false;
for (long i = 0; i < master_state_list_.back().elements_.size(); i++)
{
if (!master_state_list_.back().elements_[i].elm)continue;
if (master_state_list_.back().elements_[i].elm->get_type() == typeStyleHeader)header = true;
if (master_state_list_.back().elements_[i].elm->get_type() == typeStyleFooter)footer = true;
if (master_state_list_.back().elements_[i].elm->get_type() == typeStyleHeaderFirst)f_header = true;
if (master_state_list_.back().elements_[i].elm->get_type() == typeStyleFooterFirst)f_footer = true;
if (master_state_list_.back().elements_[i].elm->get_type() == typeStyleHeaderLeft)l_header = true;
if (master_state_list_.back().elements_[i].elm->get_type() == typeStyleFooterLeft)l_footer = true;
}
if (f_header && !f_footer && footer)
{
add_footer(2);
f_footer = true;
}
if (!header && (f_header || l_header))
{
add_header(0);
header = true;
}
if (!footer && (f_footer || l_footer))
{
add_footer(0);
footer = true;
}
}
void odf_page_layout_context::process_master_styles(office_element_ptr root ) void odf_page_layout_context::process_master_styles(office_element_ptr root )
{ {
...@@ -211,27 +251,31 @@ void odf_page_layout_context::set_background(_CP_OPT(color) & color, int type) ...@@ -211,27 +251,31 @@ void odf_page_layout_context::set_background(_CP_OPT(color) & color, int type)
} }
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
void odf_page_layout_context::add_footer(int type) bool odf_page_layout_context::add_footer(int type)
{ {
office_element_ptr elm; office_element_ptr elm;
if (type == 1) if (type == 1)
create_element(L"style", L"footer-left", elm, odf_context_); {
if (even_and_left_headers_)create_element(L"style", L"footer-left", elm, odf_context_);
}
else if (type == 2) else if (type == 2)
create_element(L"style", L"footer-first", elm, odf_context_); create_element(L"style", L"footer-first", elm, odf_context_);
else else
create_element(L"style", L"footer", elm, odf_context_); create_element(L"style", L"footer", elm, odf_context_);
if (!elm) return false;
master_state_list_.back().add_footer(elm); master_state_list_.back().add_footer(elm);
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// 1 // 1
if (!layout_state_list_.back().footer_size_) return; if (!layout_state_list_.back().footer_size_) return true;
style_header_footer_properties * footer_props = get_footer_properties(); style_header_footer_properties * footer_props = get_footer_properties();
if (!footer_props)return; if (!footer_props)return true;
style_page_layout_properties * props = get_properties(); style_page_layout_properties * props = get_properties();
if (!props)return; if (!props)return true;
length length_ = length(layout_state_list_.back().footer_size_->get_value_unit(length::cm),length::cm); length length_ = length(layout_state_list_.back().footer_size_->get_value_unit(length::cm),length::cm);
...@@ -259,27 +303,33 @@ void odf_page_layout_context::add_footer(int type) ...@@ -259,27 +303,33 @@ void odf_page_layout_context::add_footer(int type)
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_; props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
} }
layout_state_list_.back().footer_size_ = boost::none; layout_state_list_.back().footer_size_ = boost::none;
return true;
} }
void odf_page_layout_context::add_header(int type) bool odf_page_layout_context::add_header(int type)
{ {
office_element_ptr elm; office_element_ptr elm;
if (type == 1) if (type == 1)
create_element(L"style", L"header-left", elm, odf_context_); {
if (even_and_left_headers_)create_element(L"style", L"header-left", elm, odf_context_);
}
else if (type == 2) else if (type == 2)
create_element(L"style", L"header-first", elm, odf_context_); create_element(L"style", L"header-first", elm, odf_context_);
else else
create_element(L"style", L"header", elm, odf_context_); create_element(L"style", L"header", elm, odf_context_);
if (!elm)return false;
master_state_list_.back().add_header(elm); master_state_list_.back().add_header(elm);
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// //
if (!layout_state_list_.back().header_size_) return; if (!layout_state_list_.back().header_size_) return true;
style_header_footer_properties * header_props = get_header_properties(); style_header_footer_properties * header_props = get_header_properties();
if (!header_props)return; if (!header_props)return true;
style_page_layout_properties * props = get_properties(); style_page_layout_properties * props = get_properties();
if (!props)return; if (!props)return true;
length length_ = length(layout_state_list_.back().header_size_->get_value_unit(length::cm),length::cm); length length_ = length(layout_state_list_.back().header_size_->get_value_unit(length::cm),length::cm);
...@@ -307,6 +357,7 @@ void odf_page_layout_context::add_header(int type) ...@@ -307,6 +357,7 @@ void odf_page_layout_context::add_header(int type)
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_; props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
layout_state_list_.back().header_size_ = boost::none; layout_state_list_.back().header_size_ = boost::none;
return true;
} }
void odf_page_layout_context::set_page_border_padding_bottom(int offset_type, double length_pt) void odf_page_layout_context::set_page_border_padding_bottom(int offset_type, double length_pt)
...@@ -435,6 +486,11 @@ void odf_page_layout_context::set_pages_mirrored(bool val) ...@@ -435,6 +486,11 @@ void odf_page_layout_context::set_pages_mirrored(bool val)
} }
} }
void odf_page_layout_context::set_even_and_left_headers(bool val)
{
even_and_left_headers_ = val;
}
void odf_page_layout_context::set_title_page_enable(bool val) void odf_page_layout_context::set_title_page_enable(bool val)
{ {
} }
......
...@@ -29,8 +29,9 @@ public: ...@@ -29,8 +29,9 @@ public:
void set_styles_context (odf_style_context * Context); void set_styles_context (odf_style_context * Context);
void create_master_page(std::wstring oox_name); void start_master_page(std::wstring oox_name);
void create_layout_page(); void create_layout_page();
void end_master_page();
void set_current_master_page_base(); void set_current_master_page_base();
...@@ -61,16 +62,19 @@ public: ...@@ -61,16 +62,19 @@ public:
void set_title_page_enable(bool val); void set_title_page_enable(bool val);
void set_pages_mirrored(bool val); void set_pages_mirrored(bool val);
void set_even_and_left_headers(bool val);
void add_footer(int type); bool add_footer(int type);
void set_footer_size(_CP_OPT(length) length_); void set_footer_size(_CP_OPT(length) length_);
void add_header(int type); bool add_header(int type);
void set_header_size(_CP_OPT(length) length_); void set_header_size(_CP_OPT(length) length_);
void set_background(_CP_OPT(color) & color, int type); void set_background(_CP_OPT(color) & color, int type);
private: private:
bool even_and_left_headers_;
style_page_layout_properties *get_properties(); style_page_layout_properties *get_properties();
style_header_footer_properties *get_header_properties(); style_header_footer_properties *get_header_properties();
style_header_footer_properties *get_footer_properties(); style_header_footer_properties *get_footer_properties();
......
...@@ -384,7 +384,7 @@ void odf_text_context::start_list(std::wstring style_name) //todoooo add new_num ...@@ -384,7 +384,7 @@ void odf_text_context::start_list(std::wstring style_name) //todoooo add new_num
if (list) if (list)
{ {
list->text_style_name_ = style_ref(style_name); list->text_style_name_ = style_ref(style_name);
//list->text_continue_numbering_ = true; list->text_continue_numbering_ = true;
} }
list_state_.style_name = style_name; list_state_.style_name = style_name;
} }
......
...@@ -86,7 +86,7 @@ void ods_conversion_context::start_sheet() ...@@ -86,7 +86,7 @@ void ods_conversion_context::start_sheet()
drawing_context()->set_styles_context(styles_context()); drawing_context()->set_styles_context(styles_context());
page_layout_context()->set_styles_context(styles_context()); page_layout_context()->set_styles_context(styles_context());
page_layout_context()->create_master_page(L""); page_layout_context()->start_master_page(L"");
current_table().set_table_master_page(page_layout_context()->last_master().get_name()); current_table().set_table_master_page(page_layout_context()->last_master().get_name());
} }
...@@ -123,6 +123,8 @@ void ods_conversion_context::end_sheet() ...@@ -123,6 +123,8 @@ void ods_conversion_context::end_sheet()
table_context_.end_table(); table_context_.end_table();
styles_context()->reset_defaults(); styles_context()->reset_defaults();
page_layout_context()->end_master_page();
} }
void ods_conversion_context::start_row(int _start_row, int repeated, int level, bool _default) void ods_conversion_context::start_row(int _start_row, int repeated, int level, bool _default)
......
...@@ -462,6 +462,7 @@ void odt_conversion_context::start_list_item(int level, std::wstring style_name ...@@ -462,6 +462,7 @@ void odt_conversion_context::start_list_item(int level, std::wstring style_name
if (text_context()->list_state_.started_list == false) if (text_context()->list_state_.started_list == false)
{ {
text_context()->start_list(style_name); text_context()->start_list(style_name);
//text_context()->set_list_continue(true); //??? ????
add_to_root(); add_to_root();
text_context()->start_list_item(); text_context()->start_list_item();
} }
...@@ -818,15 +819,17 @@ void odt_conversion_context::end_table() ...@@ -818,15 +819,17 @@ void odt_conversion_context::end_table()
} }
void odt_conversion_context::start_header(int type) bool odt_conversion_context::start_header(int type)
{ {
page_layout_context()->add_header(type); if (page_layout_context()->add_header(type) == false) return false;
start_text_context(); start_text_context();
text_context()->set_styles_context(page_layout_context()->get_local_styles_context()); text_context()->set_styles_context(page_layout_context()->get_local_styles_context());
text_context()->start_element(page_layout_context()->last_master().get_last_element()); text_context()->start_element(page_layout_context()->last_master().get_last_element());
is_footer_header_ = true; is_footer_header_ = true;
return true;
} }
void odt_conversion_context::end_header_footer() void odt_conversion_context::end_header_footer()
...@@ -844,15 +847,18 @@ void odt_conversion_context::set_background(_CP_OPT(color) & color, int type) ...@@ -844,15 +847,18 @@ void odt_conversion_context::set_background(_CP_OPT(color) & color, int type)
page_layout_context()->set_background(color, type); page_layout_context()->set_background(color, type);
} }
void odt_conversion_context::start_footer(int type) bool odt_conversion_context::start_footer(int type)
{ {
page_layout_context()->add_footer(type); if (page_layout_context()->add_footer(type) == false) return false;
start_text_context(); start_text_context();
text_context()->set_styles_context(page_layout_context()->get_local_styles_context()); text_context()->set_styles_context(page_layout_context()->get_local_styles_context());
text_context()->start_element(page_layout_context()->last_master().get_last_element()); text_context()->start_element(page_layout_context()->last_master().get_last_element());
is_footer_header_ = true; is_footer_header_ = true;
return true;
} }
......
...@@ -105,8 +105,8 @@ public: ...@@ -105,8 +105,8 @@ public:
bool is_empty_section(){return current_root_elements_.size() > 0 ? false : true; } bool is_empty_section(){return current_root_elements_.size() > 0 ? false : true; }
void start_header(int type); bool start_header(int type);
void start_footer(int type); bool start_footer(int type);
void end_header_footer(); void end_header_footer();
void set_background(_CP_OPT(color) & color, int type); void set_background(_CP_OPT(color) & color, int type);
......
...@@ -148,7 +148,7 @@ void text_list::serialize(std::wostream & _Wostream) ...@@ -148,7 +148,7 @@ void text_list::serialize(std::wostream & _Wostream)
CP_XML_NODE_SIMPLE() CP_XML_NODE_SIMPLE()
{ {
CP_XML_ATTR_OPT(L"text:style-name" , text_style_name_); CP_XML_ATTR_OPT(L"text:style-name" , text_style_name_);
CP_XML_ATTR_OPT(L"text_continue_numbering_" , text_continue_numbering_ ); CP_XML_ATTR_OPT(L"text:continue-numbering" , text_continue_numbering_ );
if (text_list_header_) text_list_header_->serialize(CP_XML_STREAM()); if (text_list_header_) text_list_header_->serialize(CP_XML_STREAM());
......
...@@ -168,8 +168,8 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style) ...@@ -168,8 +168,8 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style)
} }
odf_context()->drawing_context()->set_drawings_rect(x, y, width_pt, height_pt); odf_context()->drawing_context()->set_drawings_rect(x, y, width_pt, height_pt);
if (width_pt && height_pt) //if (width_pt && height_pt)
odf_context()->drawing_context()->set_viewBox(width_pt.get(), height_pt.get()); // odf_context()->drawing_context()->set_viewBox(width_pt.get(), height_pt.get());
} }
void OoxConverter::convert(OOX::Vml::CShape *vml_shape) void OoxConverter::convert(OOX::Vml::CShape *vml_shape)
{ {
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//2 //2
//0 //0
//132 //133
#define INTVER 1,2,0,132 #define INTVER 1,2,0,133
#define STRVER "1,2,0,132\0" #define STRVER "1,2,0,133\0"
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