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

.....

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57789 954022d7-b5bf-4e40-9824-e11837661b57
parent d94d6c0f
...@@ -325,7 +325,7 @@ public: ...@@ -325,7 +325,7 @@ public:
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
public: public:
_CP_OPT(std::wstring) style_num_format_; _CP_OPT(std::wstring) style_num_format_;
_CP_OPT(Bool) style_num_letter_sync_; _CP_OPT(Bool) style_num_letter_sync_;
}; };
......
...@@ -1182,6 +1182,14 @@ ...@@ -1182,6 +1182,14 @@
<Filter <Filter
Name="contexts" Name="contexts"
> >
<File
RelativePath=".\OdfFormat\odf_lists_styles_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_lists_styles_context.h"
>
</File>
<File <File
RelativePath=".\OdfFormat\odf_number_styles_context.cpp" RelativePath=".\OdfFormat\odf_number_styles_context.cpp"
> >
......
...@@ -591,6 +591,10 @@ void odf_drawing_context::start_shape(int type) ...@@ -591,6 +591,10 @@ void odf_drawing_context::start_shape(int type)
{ {
start_image(L""); start_image(L"");
} }
else if (type > 2000 && type < 3000)
{
impl_->create_draw_base(7);
}
} }
void odf_drawing_context::end_shape() void odf_drawing_context::end_shape()
{ {
...@@ -654,10 +658,12 @@ void odf_drawing_context::end_shape() ...@@ -654,10 +658,12 @@ void odf_drawing_context::end_shape()
{ {
sub_type = Shape_Types_Mapping[impl_->current_drawing_state_.oox_shape_preset].first; sub_type = Shape_Types_Mapping[impl_->current_drawing_state_.oox_shape_preset].first;
} }
else //if (impl_->current_drawing_state_.oox_shape_preset != 2000)// 3000 - else if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000)// 3000 -
{ {
sub_type = L"polyline"; sub_type = L"fontwork-plain-text";
} }
else
sub_type = L"polyline";
office_element_ptr enhanced_elm; office_element_ptr enhanced_elm;
create_element(L"draw", L"enhanced-geometry", enhanced_elm, impl_->odf_context_); create_element(L"draw", L"enhanced-geometry", enhanced_elm, impl_->odf_context_);
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include "odf_lists_styles_context.h"
#include "styles_list.h"
namespace cpdoccore {
namespace odf {
odf_lists_styles_context::odf_lists_styles_context()
{
}
void odf_lists_styles_context::set_odf_context(odf_conversion_context * Context)
{
odf_context_ = Context;
}
void odf_lists_styles_context::process_styles(office_element_ptr root )
{
for (long i=0; i< lists_format_array_.size(); i++)
{
if (lists_format_array_[i].elements.size() < 1) continue;
root->add_child_element(lists_format_array_[i].elements[0]);
}
}
void odf_lists_styles_context::add_style(int style_num, int based_num)
{
//find index array for based_num
std::wstring style_name;
for (long i=0 ; i < lists_format_array_.size(); i++)
{
if (lists_format_array_[i].oox_based_number == based_num)
{
link_format_map_[based_num] = lists_format_array_[i].odf_list_style_name;
break;
}
}
}
std::wstring odf_lists_styles_context::get_style_name(int oox_style_num)
{
if (link_format_map_.count(oox_style_num) > 0)
{
return link_format_map_.at(oox_style_num);
}
else
{
return L"";
}
}
void odf_lists_styles_context::start_style(int based_number)
{
list_format_state state;
office_element_ptr elm;
create_element(L"text", L"list-style", elm, odf_context_);
state.elements.push_back(elm);
state.oox_based_number = based_number;
state.odf_list_style_name = std::wstring(L"WWNum") + boost::lexical_cast<std::wstring>(based_number + 1);
text_list_style *style = dynamic_cast<text_list_style *>(elm.get());
if (style == NULL)return;
style->text_list_style_attr_.style_name_ = state.odf_list_style_name;
lists_format_array_.push_back(state); // end??
}
void odf_lists_styles_context::start_style_level(int level, int type)
{
if (lists_format_array_.size() < 1) return;
int odf_type =-1;
int format_type = -1;
switch(type)
{
case 0: //numberformatAiueo :
break;
case 1: //numberformatAiueoFullWidth :
break;
case 2: //numberformatArabicAbjad :
break;
case 3: //numberformatArabicAlpha :
break;
case 4: //numberformatBahtText :
break;
case 5: //numberformatBullet :
odf_type = 2;
break;
case 6: //numberformatCardinalText :
break;
case 7: //numberformatChicago :
break;
case 8: //numberformatChineseCounting :
break;
case 9: //numberformatChineseCountingThousand :
break;
case 10: //numberformatChineseLegalSimplified :
break;
case 11: //numberformatChosung :
break;
case 12: //numberformatCustom :
break;
case 13: //numberformatDecimal :
break;
case 14: //numberformatDecimalEnclosedCircle :
break;
case 15: //numberformatDecimalEnclosedCircleChinese :
break;
case 16: //numberformatDecimalEnclosedFullstop :
break;
case 17: //numberformatDecimalEnclosedParen :
break;
case 18: //numberformatDecimalFullWidth :
break;
case 19: //numberformatDecimalFullWidth2 :
break;
case 20: //numberformatDecimalHalfWidth :
break;
case 21: //numberformatDecimalZero :
break;
case 22: //numberformatDollarText :
break;
case 23: //numberformatGanada :
break;
case 24: //numberformatHebrew1 :
break;
case 25: //numberformatHebrew2 :
break;
case 26: //numberformatHex :
break;
case 27: //numberformatHindiConsonants :
break;
case 28: //numberformatHindiCounting :
break;
case 29: //numberformatHindiNumbers :
break;
case 30: //numberformatHindiVowels :
break;
case 31: //numberformatIdeographDigital :
break;
case 32: //numberformatIdeographEnclosedCircle :
break;
case 33: //numberformatIdeographLegalTraditional :
break;
case 34: //numberformatIdeographTraditional :
break;
case 35: //numberformatIdeographZodiac :
break;
case 36: //numberformatIdeographZodiacTraditional :
break;
case 37: //numberformatIroha :
break;
case 38: //numberformatIrohaFullWidth :
break;
case 39: //numberformatJapaneseCounting :
break;
case 40: //numberformatJapaneseDigitalTenThousand :
break;
case 41: //numberformatJapaneseLegal :
break;
case 42: //numberformatKoreanCounting :
break;
case 43: //numberformatKoreanDigital :
break;
case 44: //numberformatKoreanDigital2 :
break;
case 45: //numberformatKoreanLegal :
break;
case 46: //numberformatLowerLetter :
break;
case 47: //numberformatLowerRoman :
break;
case 48: //numberformatNone :
break;
case 49: //numberformatNumberInDash :
break;
case 50: //numberformatOrdinal :
break;
case 51: //numberformatOrdinalText :
break;
case 52: //numberformatRussianLower :
break;
case 53: //numberformatRussianUpper :
break;
case 54: //numberformatTaiwaneseCounting :
break;
case 55: //numberformatTaiwaneseCountingThousand :
break;
case 56: //numberformatTaiwaneseDigital :
break;
case 57: //numberformatThaiCounting :
break;
case 58: //numberformatThaiLetters :
break;
case 59: //numberformatThaiNumbers :
break;
case 60: //numberformatUpperLetter :
break;
case 61: //numberformatUpperRoman :
break;
case 62: //numberformatVietnameseCounting :
break;
default :
odf_type = 1;
break;
}
office_element_ptr elm;
if (odf_type == 2)
create_element(L"text", L"list-level-style-bullet", elm, odf_context_);
else
create_element(L"text", L"list-level-style-number", elm, odf_context_);
text_list_level_style_number *style_number_ = dynamic_cast<text_list_level_style_number *>(elm.get());
text_list_level_style_bullet *style_bullet_ = dynamic_cast<text_list_level_style_bullet *>(elm.get());
if (style_number_)
{
style_number_->text_list_level_style_attr_.text_level_ = level;
style_number_->text_list_level_style_number_attr_.text_display_levels_ = level;
style_number_->text_list_level_style_number_attr_.common_num_format_attlist_.style_num_format_ = L"1";
}
if (style_bullet_)
{
style_bullet_->text_list_level_style_attr_.text_level_ = level;
}
lists_format_array_.back().elements.push_back(elm);
lists_format_array_.back().elements[0]->add_child_element(elm);
}
void odf_lists_styles_context::end_style_level()
{
}
void odf_lists_styles_context::end_style()
{
}
}
}
\ No newline at end of file
#pragma once
#include <string>
#include <vector>
#include <boost/unordered_map.hpp>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf {
class ods_conversion_context;
class office_element;
typedef shared_ptr<office_element>::Type office_element_ptr;
struct list_format_state
{
int oox_based_number;
std::vector<office_element_ptr> elements;
std::wstring odf_list_style_name;
};
class odf_lists_styles_context
{
public:
odf_lists_styles_context();
void set_odf_context(odf_conversion_context * Context);
void start_style(int abstract_number);
void start_style_level(int level, int type);
void end_style_level();
void end_style();
void add_style(int oox_style_num, int oox_based_num);
void process_styles(office_element_ptr root );
std::wstring get_style_name(int oox_style_num);
private:
std::vector<list_format_state> lists_format_array_;
boost::unordered_map<int, std::wstring> link_format_map_;
//void create(int oox_num_fmt, std::wstring formatCode = L"");
//void create_default(int oox_num_fmt, std::wstring formatCode = L"");
//void create_style(number_format_state & state);
//void detect_format(number_format_state & state);
////////////////
odf_conversion_context *odf_context_;
//std::vector<office_element_ptr> styles_elments;
};
}
}
...@@ -36,6 +36,7 @@ void odf_style_context::set_odf_context(odf_conversion_context * Context) ...@@ -36,6 +36,7 @@ void odf_style_context::set_odf_context(odf_conversion_context * Context)
number_styles_context_.set_odf_context(Context); number_styles_context_.set_odf_context(Context);
table_styles_context_.set_odf_context(Context); table_styles_context_.set_odf_context(Context);
lists_styles_context_.set_odf_context(Context);
} }
...@@ -130,6 +131,8 @@ void odf_style_context::process_office_styles(office_element_ptr root ) ...@@ -130,6 +131,8 @@ void odf_style_context::process_office_styles(office_element_ptr root )
if (style_state_list_[i]->automatic_== false && style_state_list_[i]->root_ == true && style_state_list_[i]->odf_style_) 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_); root->add_child_element(style_state_list_[i]->odf_style_);
} }
lists_styles_context_.process_styles(root );
} }
std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_family::type family, bool root) std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_family::type family, bool root)
{ {
...@@ -220,6 +223,20 @@ bool odf_style_context::find_odf_style_state(int oox_id_style, style_family::typ ...@@ -220,6 +223,20 @@ bool odf_style_context::find_odf_style_state(int oox_id_style, style_family::typ
} }
return false; return false;
} }
bool odf_style_context::find_odf_default_style_state(style_family::type family, odf_style_state_ptr & state)
{
for (int i=0;i<style_state_list_.size(); i++)
{
if (style_state_list_[i]->default_ == false) continue;
if (style_state_list_[i]->odf_style_ && style_state_list_[i]->get_family_type() == family)
{
state = style_state_list_[i];
return true;
}
}
return false;
}
bool odf_style_context::find_odf_style(std::wstring style_name, style_family::type family, style *& style_) bool odf_style_context::find_odf_style(std::wstring style_name, style_family::type family, style *& style_)
{ {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "odf_style_state.h" #include "odf_style_state.h"
#include "odf_number_styles_context.h" #include "odf_number_styles_context.h"
#include "odf_table_styles_context.h" #include "odf_table_styles_context.h"
#include "odf_lists_styles_context.h"
namespace cpdoccore { namespace cpdoccore {
...@@ -51,13 +52,16 @@ public: ...@@ -51,13 +52,16 @@ public:
office_element_ptr find_conditional_style (int oox_id_style, style_family::type family); office_element_ptr find_conditional_style (int oox_id_style, style_family::type family);
bool find_odf_style_state(int oox_id_style, style_family::type family, odf_style_state_ptr & state, bool root = false); bool find_odf_style_state(int oox_id_style, style_family::type family, odf_style_state_ptr & state, bool root = false);
bool find_odf_default_style_state(style_family::type family, odf_style_state_ptr & state);
bool find_odf_style(std::wstring style_name, style_family::type family, style *& style_); bool find_odf_style(std::wstring style_name, style_family::type family, style *& style_);
odf_style_state_ptr last_state(style_family::type family = style_family::None); odf_style_state_ptr last_state(style_family::type family = style_family::None);
odf_number_styles_context & numbers_styles() {return number_styles_context_;} odf_number_styles_context & numbers_styles() {return number_styles_context_;}
odf_table_styles_context & table_styles() {return table_styles_context_;} odf_table_styles_context & table_styles() {return table_styles_context_;}
odf_lists_styles_context & lists_styles() {return lists_styles_context_;}
std::wstring find_free_name(style_family::type family); std::wstring find_free_name(style_family::type family);
...@@ -67,14 +71,15 @@ public: ...@@ -67,14 +71,15 @@ public:
private: private:
odf_table_styles_context table_styles_context_; odf_table_styles_context table_styles_context_;
odf_number_styles_context number_styles_context_; odf_number_styles_context number_styles_context_;
odf_conversion_context * odf_context_; odf_lists_styles_context lists_styles_context_;
std::vector<odf_style_state_ptr> style_state_list_; std::vector<odf_style_state_ptr> style_state_list_;
std::vector<odf_style_state_ptr> current_default_styles_;// .. std::vector<odf_style_state_ptr> current_default_styles_;// ..
std::wstring get_name_family(style_family::type family); std::wstring get_name_family(style_family::type family);
odf_conversion_context * odf_context_;
}; };
......
...@@ -86,6 +86,17 @@ void odf_style_state::set_parent_style_name(std::wstring & name) ...@@ -86,6 +86,17 @@ void odf_style_state::set_parent_style_name(std::wstring & name)
return; return;
style_->style_parent_style_name_ = name; style_->style_parent_style_name_ = name;
} }
void odf_style_state::set_list_style_name(std::wstring & name)
{
if (name.length() < 1) return;
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_)return;
if (name == style_->style_name_ || name.length() <1)
return;
style_->style_list_style_name_ = name;
}
void odf_style_state::set_dont_write(bool Val) void odf_style_state::set_dont_write(bool Val)
{ {
writable_ = !Val; writable_ = !Val;
......
...@@ -55,9 +55,9 @@ public: ...@@ -55,9 +55,9 @@ public:
void set_number_format(int id) {num_fmt_id_ = id;} void set_number_format(int id) {num_fmt_id_ = id;}
int get_number_format() {return num_fmt_id_;} int get_number_format() {return num_fmt_id_;}
void set_parent_style_name(std::wstring & name) ; void set_parent_style_name(std::wstring & name) ;
void set_data_style_name(std::wstring & name); void set_data_style_name(std::wstring & name);
void set_list_style_name(std::wstring & name);
void set_display_name(std::wstring & name); void set_display_name(std::wstring & name);
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -194,7 +194,10 @@ void odf_table_context::end_row() ...@@ -194,7 +194,10 @@ void odf_table_context::end_row()
} }
bool odf_table_context::empty()
{
return impl_->empty();
}
void odf_table_context::add_column(office_element_ptr &elm, bool styled) void odf_table_context::add_column(office_element_ptr &elm, bool styled)
{ {
if (impl_->empty()) return; if (impl_->empty()) return;
...@@ -248,7 +251,7 @@ void odf_table_context::set_column_width(double width) ...@@ -248,7 +251,7 @@ void odf_table_context::set_column_width(double width)
style_table_column_properties *properties = style_->style_content_.get_style_table_column_properties(); style_table_column_properties *properties = style_->style_content_.get_style_table_column_properties();
if (properties == NULL) return; if (properties == NULL) return;
if (width >= 0) 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_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
//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_rel_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
......
...@@ -26,6 +26,8 @@ public: ...@@ -26,6 +26,8 @@ public:
void set_table_styled(bool val); void set_table_styled(bool val);
bool is_styled(); bool is_styled();
bool empty();
int current_column (); int current_column ();
int current_row (); int current_row ();
int count_column (); int count_column ();
......
...@@ -238,10 +238,14 @@ void odf_text_context::start_element(office_element_ptr & elm, office_element_pt ...@@ -238,10 +238,14 @@ void odf_text_context::start_element(office_element_ptr & elm, office_element_pt
} }
void odf_text_context::end_element() void odf_text_context::end_element()
{ {
if (single_paragraph_ == false) if (single_paragraph_ == false && current_level_.size() > 0)
{ {
current_level_.pop_back(); current_level_.pop_back();
} }
else
{
int t=0;
}
} }
void odf_text_context::start_span(bool styled) void odf_text_context::start_span(bool styled)
...@@ -299,7 +303,66 @@ void odf_text_context::end_span() ...@@ -299,7 +303,66 @@ void odf_text_context::end_span()
text_properties_ = NULL; text_properties_ = NULL;
} }
///////////////////////////////////////////////////////////////////////////////// LIST
void odf_text_context::start_list_item()
{
if (styles_context_ == NULL || single_paragraph_)return;
office_element_ptr list_elm;
create_element(L"text", L"list-item", list_elm, odf_context_);
int level = current_level_.size();
std::wstring style_name;
office_element_ptr style_elm;
odf_element_state state={list_elm, style_name, style_elm, level};
text_elements_list_.push_back(state);
if (current_level_.size()>0)
current_level_.back().elm->add_child_element(list_elm);
current_level_.push_back(state);
}
void odf_text_context::end_list_item()
{
if (styles_context_ == NULL || single_paragraph_)return;
if (current_level_.size() > 0)
current_level_.pop_back();
}
void odf_text_context::start_list(std::wstring style_name)
{
if (styles_context_ == NULL || single_paragraph_)return;
office_element_ptr list_elm;
create_element(L"text", L"list", list_elm, odf_context_);
int level = current_level_.size();
office_element_ptr style_elm;
odf_element_state state = { list_elm, style_name, style_elm, level};
if (style_name.length() > 0)
{
text_list* list = dynamic_cast<text_list*>(list_elm.get());
if (list) list->text_style_name_ = style_ref(style_name);
}
text_elements_list_.push_back(state);
if (current_level_.size()>0)
current_level_.back().elm->add_child_element(list_elm);
current_level_.push_back(state);
}
void odf_text_context::end_list()
{
if (styles_context_ == NULL || single_paragraph_)return;
if (current_level_.size() > 0)
current_level_.pop_back();
}
/////////////////////////////////////////////////////////////////////////////////////////// LIST
void odf_text_context::start_field(int type) void odf_text_context::start_field(int type)
{ {
if (single_paragraph_ == true) return; if (single_paragraph_ == true) return;
......
...@@ -57,7 +57,12 @@ public: ...@@ -57,7 +57,12 @@ public:
void start_span (bool styled = false); void start_span (bool styled = false);
void end_span(); void end_span();
void start_list_item();
void end_list_item();
void start_list(std::wstring style_name);
void end_list();
void add_break(int type, int clear); void add_break(int type, int clear);
void add_tab(); void add_tab();
......
...@@ -45,6 +45,9 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc ...@@ -45,6 +45,9 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc
is_hyperlink_ = false; is_hyperlink_ = false;
is_footer_header_ = false; is_footer_header_ = false;
list_state_.currnet_level = -1 ;
list_state_.started = false;
drop_cap_state_.clear(); drop_cap_state_.clear();
} }
...@@ -433,6 +436,59 @@ void odt_conversion_context::end_paragraph() ...@@ -433,6 +436,59 @@ void odt_conversion_context::end_paragraph()
flush_section(); flush_section();
} }
void odt_conversion_context::start_list_item(int level, std::wstring style_name )
{
if (list_state_.started == false)
{
text_context()->start_list(style_name);
list_state_.started = true;
add_to_root();
}
/* if (list_state_.currnet_level == level)
{
text_context()->start_list_item();
list_state_.currnet_level++;
}
else */
if (list_state_.currnet_level >= level)
{
while (list_state_.currnet_level >= level)
{
text_context()->end_list_item();
list_state_.currnet_level--;
}
}
if (list_state_.currnet_level < level)
{
while (list_state_.currnet_level < level)
{
text_context()->start_list_item();
list_state_.currnet_level++;
}
}
}
void odt_conversion_context::end_list_item()
{
if (list_state_.currnet_level < 0) return;
text_context()->end_list_item();
list_state_.currnet_level--;
}
void odt_conversion_context::set_no_list()
{
if (list_state_.started == false) return;
while (list_state_.currnet_level >=0)
{
text_context()->end_list_item();
list_state_.currnet_level--;
}
text_context()->end_list();
list_state_.started = false;
}
void odt_conversion_context::flush_section() void odt_conversion_context::flush_section()
{ {
if (sections_.size() > 0 && sections_.back().empty) if (sections_.size() > 0 && sections_.back().empty)
......
...@@ -25,6 +25,7 @@ struct odt_section_state ...@@ -25,6 +25,7 @@ struct odt_section_state
bool continuous; bool continuous;
}; };
class odt_conversion_context : public odf_conversion_context class odt_conversion_context : public odf_conversion_context
{ {
public: public:
...@@ -97,6 +98,11 @@ public: ...@@ -97,6 +98,11 @@ public:
void end_table_row(); void end_table_row();
void end_table(); void end_table();
void start_list_item(int level, std::wstring style_name);
void end_list_item();
void set_no_list();
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); void start_header(int type);
...@@ -148,7 +154,18 @@ private: ...@@ -148,7 +154,18 @@ private:
double characters_size_pt; double characters_size_pt;
}drop_cap_state_; }drop_cap_state_;
struct _list_state
{
// office_element_ptr elm;
// office_element_ptr style_elm;
// std::wstring style_name;
//
// bool empty;
// bool continuous;
bool started;
int currnet_level;
}list_state_;
}; };
......
...@@ -33,13 +33,13 @@ void text_format_properties_content::apply_from(const text_format_properties_con ...@@ -33,13 +33,13 @@ void text_format_properties_content::apply_from(const text_format_properties_con
{ {
_CP_APPLY_PROP(r_style_, Other.r_style_); _CP_APPLY_PROP(r_style_, Other.r_style_);
_CP_APPLY_PROP(fo_font_variant_, Other.fo_font_variant_); _CP_APPLY_PROP(fo_font_variant_, Other.fo_font_variant_);
_CP_APPLY_PROP(fo_text_transform_, Other.fo_text_transform_); _CP_APPLY_PROP(fo_text_transform_, Other.fo_text_transform_);
_CP_APPLY_PROP(fo_color_, Other.fo_color_); _CP_APPLY_PROP(fo_color_, Other.fo_color_);
_CP_APPLY_PROP(style_use_window_font_color_, Other.style_use_window_font_color_); _CP_APPLY_PROP(style_use_window_font_color_, Other.style_use_window_font_color_);
_CP_APPLY_PROP(style_text_outline_, Other.style_text_outline_); _CP_APPLY_PROP(style_text_outline_, Other.style_text_outline_);
_CP_APPLY_PROP(style_text_line_through_type_, Other.style_text_line_through_type_); _CP_APPLY_PROP(style_text_line_through_type_, Other.style_text_line_through_type_);
_CP_APPLY_PROP(style_text_line_through_style_, Other.style_text_line_through_style_); _CP_APPLY_PROP(style_text_line_through_style_, Other.style_text_line_through_style_);
apply_line_width(style_text_line_through_width_, Other.style_text_line_through_width_); apply_line_width(style_text_line_through_width_, Other.style_text_line_through_width_);
...@@ -66,19 +66,22 @@ void text_format_properties_content::apply_from(const text_format_properties_con ...@@ -66,19 +66,22 @@ void text_format_properties_content::apply_from(const text_format_properties_con
_CP_APPLY_PROP(style_font_pitch_asian_, Other.style_font_pitch_asian_); _CP_APPLY_PROP(style_font_pitch_asian_, Other.style_font_pitch_asian_);
_CP_APPLY_PROP(style_font_pitch_complex_, Other.style_font_pitch_complex_); _CP_APPLY_PROP(style_font_pitch_complex_, Other.style_font_pitch_complex_);
_CP_APPLY_PROP(style_font_charset_, Other.style_font_charset_); _CP_APPLY_PROP(style_font_charset_, Other.style_font_charset_);
_CP_APPLY_PROP(style_font_charset_asian_, Other.style_font_charset_asian_); _CP_APPLY_PROP(style_font_charset_asian_, Other.style_font_charset_asian_);
_CP_APPLY_PROP(style_font_charset_complex_, Other.style_font_charset_complex_); _CP_APPLY_PROP(style_font_charset_complex_, Other.style_font_charset_complex_);
// TODO check _CP_APPLY_PROP(fo_font_size_, Other.fo_font_size_);
_CP_APPLY_PROP(style_font_size_rel_, Other.style_font_size_rel_); _CP_APPLY_PROP(style_font_size_asian_, Other.style_font_size_asian_);
_CP_APPLY_PROP(style_font_size_rel_asian_, Other.style_font_size_rel_asian_); _CP_APPLY_PROP(style_font_size_complex_, Other.style_font_size_complex_);
_CP_APPLY_PROP(style_font_size_rel_, Other.style_font_size_rel_);
_CP_APPLY_PROP(style_font_size_rel_asian_, Other.style_font_size_rel_asian_);
_CP_APPLY_PROP(style_font_size_rel_complex_, Other.style_font_size_rel_complex_); _CP_APPLY_PROP(style_font_size_rel_complex_, Other.style_font_size_rel_complex_);
_CP_APPLY_PROP(style_script_type_, Other.style_script_type_); _CP_APPLY_PROP(style_script_type_, Other.style_script_type_);
_CP_APPLY_PROP(fo_letter_spacing_, Other.fo_letter_spacing_); _CP_APPLY_PROP(fo_letter_spacing_, Other.fo_letter_spacing_);
_CP_APPLY_PROP(fo_language_, Other.fo_language_); _CP_APPLY_PROP(fo_language_, Other.fo_language_);
_CP_APPLY_PROP(style_language_asian_, Other.style_language_asian_); _CP_APPLY_PROP(style_language_asian_, Other.style_language_asian_);
_CP_APPLY_PROP(style_language_complex_, Other.style_language_complex_); _CP_APPLY_PROP(style_language_complex_, Other.style_language_complex_);
_CP_APPLY_PROP(fo_country_, Other.fo_country_); _CP_APPLY_PROP(fo_country_, Other.fo_country_);
...@@ -122,6 +125,8 @@ void text_format_properties_content::apply_from(const text_format_properties_con ...@@ -122,6 +125,8 @@ void text_format_properties_content::apply_from(const text_format_properties_con
_CP_APPLY_PROP(style_text_overline_mode_, Other.style_text_overline_mode_); _CP_APPLY_PROP(style_text_overline_mode_, Other.style_text_overline_mode_);
_CP_APPLY_PROP(style_text_overline_style_, Other.style_text_overline_style_); _CP_APPLY_PROP(style_text_overline_style_, Other.style_text_overline_style_);
common_border_attlist_.apply_from(Other.common_border_attlist_);
} }
void text_format_properties_content::serialize(std::wostream & _Wostream,const wchar_t * ns, const wchar_t * name ) void text_format_properties_content::serialize(std::wostream & _Wostream,const wchar_t * ns, const wchar_t * name )
{ {
...@@ -166,29 +171,29 @@ void text_format_properties_content::serialize(std::wostream & _Wostream,const w ...@@ -166,29 +171,29 @@ void text_format_properties_content::serialize(std::wostream & _Wostream,const w
CP_XML_ATTR_OPT(L"style:text-position", style_text_position_); CP_XML_ATTR_OPT(L"style:text-position", style_text_position_);
// 15.4.13 // 15.4.13
CP_XML_ATTR_OPT(L"style:font-name", style_font_name_); CP_XML_ATTR_OPT(L"style:font-name", style_font_name_);
CP_XML_ATTR_OPT(L"style:font-name-asian", style_font_name_asian_); CP_XML_ATTR_OPT(L"style:font-name-asian", style_font_name_asian_);
CP_XML_ATTR_OPT(L"style:font-name-complex", style_font_name_complex_); CP_XML_ATTR_OPT(L"style:font-name-complex", style_font_name_complex_);
// 15.4.14 // 15.4.14
CP_XML_ATTR_OPT(L"fo:font-family", fo_font_family_); CP_XML_ATTR_OPT(L"fo:font-family", fo_font_family_);
CP_XML_ATTR_OPT(L"style:font-family-asian", style_font_family_asian_); CP_XML_ATTR_OPT(L"style:font-family-asian", style_font_family_asian_);
CP_XML_ATTR_OPT(L"style:font-family-complex", style_font_family_complex_); CP_XML_ATTR_OPT(L"style:font-family-complex", style_font_family_complex_);
// 15.4.15 // 15.4.15
CP_XML_ATTR_OPT(L"style:font-family-generic", style_font_family_generic_); CP_XML_ATTR_OPT(L"style:font-family-generic", style_font_family_generic_);
CP_XML_ATTR_OPT(L"style:font-family-generic-asian", style_font_family_generic_asian_); CP_XML_ATTR_OPT(L"style:font-family-generic-asian", style_font_family_generic_asian_);
CP_XML_ATTR_OPT(L"style:font-family-generic-complex", style_font_family_generic_complex_); CP_XML_ATTR_OPT(L"style:font-family-generic-complex", style_font_family_generic_complex_);
// 15.4.16 // 15.4.16
CP_XML_ATTR_OPT(L"style:font-style-name", style_font_style_name_); CP_XML_ATTR_OPT(L"style:font-style-name", style_font_style_name_);
CP_XML_ATTR_OPT(L"style:font-style-name-asian", style_font_style_name_asian_); CP_XML_ATTR_OPT(L"style:font-style-name-asian", style_font_style_name_asian_);
CP_XML_ATTR_OPT(L"style:font-style-name-complex", style_font_style_name_complex_); CP_XML_ATTR_OPT(L"style:font-style-name-complex", style_font_style_name_complex_);
// 15.4.17 // 15.4.17
CP_XML_ATTR_OPT(L"style:font-pitch", style_font_pitch_); CP_XML_ATTR_OPT(L"style:font-pitch", style_font_pitch_);
CP_XML_ATTR_OPT(L"style:font-pitch", style_font_pitch_asian_); CP_XML_ATTR_OPT(L"style:font-pitch", style_font_pitch_asian_);
CP_XML_ATTR_OPT(L"style:font-pitch-complex", style_font_pitch_complex_); CP_XML_ATTR_OPT(L"style:font-pitch-complex", style_font_pitch_complex_);
// 15.4.18 // 15.4.18
CP_XML_ATTR_OPT(L"style:font-charset", style_font_charset_); CP_XML_ATTR_OPT(L"style:font-charset", style_font_charset_);
...@@ -196,13 +201,13 @@ void text_format_properties_content::serialize(std::wostream & _Wostream,const w ...@@ -196,13 +201,13 @@ void text_format_properties_content::serialize(std::wostream & _Wostream,const w
CP_XML_ATTR_OPT(L"style:font-charset-complex", style_font_charset_complex_); CP_XML_ATTR_OPT(L"style:font-charset-complex", style_font_charset_complex_);
// 15.4.19 // 15.4.19
CP_XML_ATTR_OPT(L"fo:font-size", fo_font_size_); CP_XML_ATTR_OPT(L"fo:font-size", fo_font_size_);
CP_XML_ATTR_OPT(L"style:font-size-asian", style_font_size_asian_); CP_XML_ATTR_OPT(L"style:font-size-asian", style_font_size_asian_);
CP_XML_ATTR_OPT(L"style:font-size-complex", style_font_size_complex_); CP_XML_ATTR_OPT(L"style:font-size-complex", style_font_size_complex_);
// 15.4.20 // 15.4.20
CP_XML_ATTR_OPT(L"style:font-size-rel", style_font_size_rel_); CP_XML_ATTR_OPT(L"style:font-size-rel", style_font_size_rel_);
CP_XML_ATTR_OPT(L"style:font-size-rel-asian", style_font_size_rel_asian_); CP_XML_ATTR_OPT(L"style:font-size-rel-asian", style_font_size_rel_asian_);
CP_XML_ATTR_OPT(L"style:font-size-rel-complex", style_font_size_rel_complex_); CP_XML_ATTR_OPT(L"style:font-size-rel-complex", style_font_size_rel_complex_);
// 15.4.21 // 15.4.21
......
...@@ -299,7 +299,7 @@ public: ...@@ -299,7 +299,7 @@ public:
_CP_OPT( std::wstring ) style_parent_style_name_; _CP_OPT( std::wstring ) style_parent_style_name_;
_CP_OPT( std::wstring ) style_next_style_name_; _CP_OPT( std::wstring ) style_next_style_name_;
_CP_OPT( std::wstring ) style_list_style_name_; // may be empty _CP_OPT( std::wstring ) style_list_style_name_;
_CP_OPT( std::wstring ) style_master_page_name_; _CP_OPT( std::wstring ) style_master_page_name_;
_CP_OPT( bool) style_auto_update_; // default = false _CP_OPT( bool) style_auto_update_; // default = false
_CP_OPT( std::wstring ) style_data_style_name_; _CP_OPT( std::wstring ) style_data_style_name_;
......
...@@ -9,8 +9,36 @@ ...@@ -9,8 +9,36 @@
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
using xml::xml_char_wc;
///////////////////////////////////////
void text_list_style_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"style:name", style_name_);
CP_XML_ATTR_OPT(L"style:display-name", style_display_name_);
CP_XML_ATTR_OPT(L"text:consecutive-numbering", text_consecutive_numbering_);
}
void text_list_level_style_number_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
CP_XML_ATTR(L"text:display-levels", text_display_levels_);
CP_XML_ATTR_OPT(L"text:start-value", text_start_value_);
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_num_format_prefix_suffix_attlist_.serialize(CP_GET_XML_NODE());
}
void text_list_level_style_bullet_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
CP_XML_ATTR_OPT(L"text:bullet-char", text_bullet_char_);
CP_XML_ATTR_OPT(L"text:bullet-relative-size", text_bullet_relative_size_);
common_num_format_prefix_suffix_attlist_.serialize(CP_GET_XML_NODE());
}
void text_list_level_style_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR(L"text:level", text_level_);
}
// text:list-style // text:list-style
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -29,7 +57,27 @@ void text_list_style::create_child_element( const ::std::wstring & Ns, const ::s ...@@ -29,7 +57,27 @@ void text_list_style::create_child_element( const ::std::wstring & Ns, const ::s
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
} }
void text_list_style::add_child_element( office_element_ptr & child)
{
ElementType type = child->get_type();
text_list_style_content_.push_back(child);
}
void text_list_style::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
text_list_style_attr_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(office_element_ptr & elm, text_list_style_content_)
{
if (elm) elm->serialize(CP_XML_STREAM());
}
}
}
}
// text:list-level-style-number // text:list-level-style-number
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -39,7 +87,7 @@ const wchar_t * text_list_level_style_number::name = L"list-level-style-number"; ...@@ -39,7 +87,7 @@ const wchar_t * text_list_level_style_number::name = L"list-level-style-number";
void text_list_level_style_number::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name) void text_list_level_style_number::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{ {
if (L"style" == Ns && L"list-level-properties" == Name) if (L"style" == Ns && L"list-level-properties" == Name)
CP_CREATE_ELEMENT(style_list_level_properties_); CP_CREATE_ELEMENT(style_list_level_properties_);
else if (L"style" == Ns && L"text-properties" == Name) else if (L"style" == Ns && L"text-properties" == Name)
CP_CREATE_ELEMENT(style_text_properties_); CP_CREATE_ELEMENT(style_text_properties_);
...@@ -48,13 +96,37 @@ void text_list_level_style_number::create_child_element(const ::std::wstring & N ...@@ -48,13 +96,37 @@ void text_list_level_style_number::create_child_element(const ::std::wstring & N
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
} }
void text_list_level_style_number::add_child_element( office_element_ptr & child)
{
ElementType type = child->get_type();
if (type == typeStyleListLevelProperties)
style_list_level_properties_ = child;
else if (type == typeStyleTextProperties)
style_text_properties_ = child;
else
{
}
}
void text_list_level_style_number::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
text_list_level_style_attr_.serialize(CP_GET_XML_NODE());
text_list_level_style_number_attr_.serialize(CP_GET_XML_NODE());
if (style_list_level_properties_) style_list_level_properties_->serialize(CP_XML_STREAM());
if (style_text_properties_) style_text_properties_->serialize(CP_XML_STREAM());
}
}
}
// style:list-level-properties // style:list-level-properties
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_list_level_properties::ns = L"style"; const wchar_t * style_list_level_properties::ns = L"style";
const wchar_t * style_list_level_properties::name = L"list-level-properties"; const wchar_t * style_list_level_properties::name = L"list-level-properties";
void style_list_level_properties::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name) void style_list_level_properties::create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name)
{ {
if CP_CHECK_NAME(L"style", L"list-level-label-alignment") if CP_CHECK_NAME(L"style", L"list-level-label-alignment")
...@@ -66,19 +138,64 @@ void style_list_level_properties::create_child_element( const ::std::wstring & N ...@@ -66,19 +138,64 @@ void style_list_level_properties::create_child_element( const ::std::wstring & N
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
} }
void style_list_level_properties::add_child_element( office_element_ptr & child)
{
ElementType type = child->get_type();
if (type == typeStyleListLevelProperties)
style_list_level_label_alignment_ = child;
else
{
}
}
void style_list_level_properties::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"text:space-before", text_space_before_);
CP_XML_ATTR_OPT(L"text:min-label-width", text_min_label_width_);
CP_XML_ATTR_OPT(L"text:min-label-distance", text_min_label_distance_);
CP_XML_ATTR_OPT(L"style:font-name", style_font_name_);
CP_XML_ATTR_OPT(L"fo:width", fo_width_);
CP_XML_ATTR_OPT(L"fo:height", fo_height_);
common_text_align_.serialize(CP_GET_XML_NODE());
common_vertical_rel_attlist_.serialize(CP_GET_XML_NODE());
common_vertical_pos_attlist_.serialize(CP_GET_XML_NODE());
if (style_list_level_label_alignment_) style_list_level_label_alignment_->serialize(CP_XML_STREAM());
}
}
}
// style:list-level-label-alignment // style:list-level-label-alignment
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_list_level_label_alignment::ns = L"style"; const wchar_t * style_list_level_label_alignment::ns = L"style";
const wchar_t * style_list_level_label_alignment::name = L"list-level-label-alignment"; const wchar_t * style_list_level_label_alignment::name = L"list-level-label-alignment";
void style_list_level_label_alignment::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name) void style_list_level_label_alignment::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void style_list_level_label_alignment::add_child_element( office_element_ptr & child)
{
// CP_NOT_APPLICABLE_ELM();
}
void style_list_level_label_alignment::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"text:label-followed-by", text_label_followed_by_);
CP_XML_ATTR_OPT(L"text:list-tab-stop-position", text_list_tab_stop_position_);
CP_XML_ATTR_OPT(L"fo:text-indent", fo_text_indent_);
CP_XML_ATTR_OPT(L"fo:margin-left", fo_margin_left_);
}
}
}
// text:list-level-style-bullet // text:list-level-style-bullet
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * text_list_level_style_bullet::ns = L"text"; const wchar_t * text_list_level_style_bullet::ns = L"text";
...@@ -96,6 +213,31 @@ void text_list_level_style_bullet::create_child_element( const ::std::wstring & ...@@ -96,6 +213,31 @@ void text_list_level_style_bullet::create_child_element( const ::std::wstring &
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
} }
void text_list_level_style_bullet::add_child_element( office_element_ptr & child)
{
ElementType type = child->get_type();
if (type == typeStyleListLevelProperties)
style_list_level_properties_ = child;
else if (type == typeStyleTextProperties)
style_text_properties_ = child;
else
{
}
}
void text_list_level_style_bullet::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
text_list_level_style_attr_.serialize(CP_GET_XML_NODE());
text_list_level_style_bullet_attr_.serialize(CP_GET_XML_NODE());
if (style_list_level_properties_) style_list_level_properties_->serialize(CP_XML_STREAM());
if (style_text_properties_) style_text_properties_->serialize(CP_XML_STREAM());
}
}
}
} }
} }
...@@ -21,12 +21,11 @@ class text_list_style_attr ...@@ -21,12 +21,11 @@ class text_list_style_attr
{ {
public: public:
const std::wstring & get_style_name() { return style_name_; } _CP_OPT(std::wstring) style_name_;
_CP_OPT(std::wstring) style_display_name_;
std::wstring style_name_; _CP_OPT(Bool) text_consecutive_numbering_;
optional<std::wstring>::Type style_display_name_;
optional<bool>::Type text_consecutive_numbering_;
void serialize(CP_ATTR_NODE);
}; };
/// \class text_list_style /// \class text_list_style
...@@ -40,16 +39,12 @@ public: ...@@ -40,16 +39,12 @@ public:
static const ElementType type = typeTextListStyle; static const ElementType type = typeTextListStyle;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
const std::wstring & get_style_name() { return text_list_style_attr_.get_style_name(); } virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
office_element_ptr_array & get_content() { return text_list_style_content_; } virtual void add_child_element(office_element_ptr & child);
virtual void serialize(std::wostream & strm);
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(office_element_ptr & child)
{std::wstringstream str; str <<L"Non add child in "; str << ns; str << L":"; str <<name; _CP_LOG(error) << str.str();}
virtual void serialize(std::wostream & strm){}
text_list_style_attr text_list_style_attr_; text_list_style_attr text_list_style_attr_;
office_element_ptr_array text_list_style_content_; office_element_ptr_array text_list_style_content_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(text_list_style); CP_REGISTER_OFFICE_ELEMENT2(text_list_style);
...@@ -63,13 +58,13 @@ public: ...@@ -63,13 +58,13 @@ public:
_CP_OPT(style_ref) text_style_name_; _CP_OPT(style_ref) text_style_name_;
common_num_format_attlist common_num_format_attlist_; common_num_format_attlist common_num_format_attlist_;
common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_; common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
unsigned int text_display_levels_; unsigned int text_display_levels_;
unsigned int text_start_value_; _CP_OPT(unsigned int) text_start_value_;
friend class text_list_level_style_number; void serialize(CP_ATTR_NODE);
}; };
...@@ -79,13 +74,12 @@ class text_list_level_style_attr ...@@ -79,13 +74,12 @@ class text_list_level_style_attr
public: public:
text_list_level_style_attr() : text_level_(0) {} text_list_level_style_attr() : text_level_(0) {}
unsigned int get_text_level() const { return text_level_; }
unsigned int text_level_; unsigned int text_level_;
void serialize(CP_ATTR_NODE);
}; };
/// \class style_list_level_properties /// \class style_list_level_properties
/// style:list-level-properties (style-list-level-properties) /// style:list-level-properties (style-list-level-properties)
class style_list_level_properties : public office_element_impl<style_list_level_properties> class style_list_level_properties : public office_element_impl<style_list_level_properties>
...@@ -98,27 +92,21 @@ public: ...@@ -98,27 +92,21 @@ public:
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name); virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(office_element_ptr & child) virtual void add_child_element(office_element_ptr & child);
{std::wstringstream str; str <<L"Non add child in "; str << ns; str << L":"; str <<name; _CP_LOG(error) << str.str();} virtual void serialize(std::wostream & strm);
virtual void serialize(std::wostream & strm){}
_CP_OPT(length) text_space_before_;
friend class text_list_level_style_number; _CP_OPT(length) text_min_label_width_;
friend class text_list_level_style_bullet; _CP_OPT(length) text_min_label_distance_;
_CP_OPT(std::wstring) style_font_name_;
const common_text_align & get_common_text_align() const { return common_text_align_; } _CP_OPT(length) fo_width_;
_CP_OPT(length) fo_height_;
common_text_align common_text_align_;
optional<length>::Type text_space_before_;
optional<length>::Type text_min_label_width_;
optional<length>::Type text_min_label_distance_;
optional<std::wstring>::Type style_font_name_;
optional<length>::Type fo_width_;
optional<length>::Type fo_height_;
common_text_align common_text_align_;
common_vertical_rel_attlist common_vertical_rel_attlist_; common_vertical_rel_attlist common_vertical_rel_attlist_;
common_vertical_pos_attlist common_vertical_pos_attlist_; common_vertical_pos_attlist common_vertical_pos_attlist_;
office_element_ptr style_list_level_label_alignment_; office_element_ptr style_list_level_label_alignment_;
}; };
...@@ -137,16 +125,10 @@ public: ...@@ -137,16 +125,10 @@ public:
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name); virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(office_element_ptr & child) virtual void add_child_element(office_element_ptr & child);
{std::wstringstream str; str <<L"Non add child in "; str << ns; str << L":"; str <<name; _CP_LOG(error) << str.str();} virtual void serialize(std::wostream & strm);
virtual void serialize(std::wostream & strm){}
const _CP_OPT(length) & get_fo_text_indent() const { return fo_text_indent_; }
const _CP_OPT(length) & get_fo_margin_left() const { return fo_margin_left_; }
const _CP_OPT(length) & get_text_list_tab_stop_position() const { return text_list_tab_stop_position_; }
_CP_OPT(std::wstring) text_label_followed_by_;
_CP_OPT(std::wstring) text_label_followed_by_;
_CP_OPT(length) text_list_tab_stop_position_; _CP_OPT(length) text_list_tab_stop_position_;
_CP_OPT(length) fo_text_indent_; _CP_OPT(length) fo_text_indent_;
_CP_OPT(length) fo_margin_left_; _CP_OPT(length) fo_margin_left_;
...@@ -170,12 +152,11 @@ public: ...@@ -170,12 +152,11 @@ public:
office_element_ptr style_list_level_properties_; office_element_ptr style_list_level_properties_;
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name); virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element(office_element_ptr & child) virtual void add_child_element(office_element_ptr & child);
{std::wstringstream str; str <<L"Non add child in "; str << ns; str << L":"; str <<name; _CP_LOG(error) << str.str();} virtual void serialize(std::wostream & strm);
virtual void serialize(std::wostream & strm){}
text_list_level_style_attr text_list_level_style_attr_; text_list_level_style_attr text_list_level_style_attr_;
text_list_level_style_number_attr text_list_level_style_number_attr_; text_list_level_style_number_attr text_list_level_style_number_attr_;
office_element_ptr style_text_properties_; office_element_ptr style_text_properties_;
...@@ -189,12 +170,13 @@ class text_list_level_style_bullet_attr ...@@ -189,12 +170,13 @@ class text_list_level_style_bullet_attr
{ {
public: public:
_CP_OPT(style_ref) text_style_name_; _CP_OPT(style_ref) text_style_name_;
optional<wchar_t>::Type text_bullet_char_; _CP_OPT(wchar_t) text_bullet_char_;
common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_; _CP_OPT(percent) text_bullet_relative_size_;
optional<percent>::Type text_bullet_relative_size_;
common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
void serialize(CP_ATTR_NODE);
}; };
/// \class text_list_level_style_bullet /// \class text_list_level_style_bullet
...@@ -208,22 +190,20 @@ public: ...@@ -208,22 +190,20 @@ public:
static const ElementType type = typeTextListLevelStyleBullet; static const ElementType type = typeTextListLevelStyleBullet;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
office_element_ptr style_list_level_properties_; virtual void add_child_element(office_element_ptr & child);
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name); virtual void serialize(std::wostream & strm);
virtual void add_child_element(office_element_ptr & child)
{std::wstringstream str; str <<L"Non add child in "; str << ns; str << L":"; str <<name; _CP_LOG(error) << str.str();}
virtual void serialize(std::wostream & strm){}
text_list_level_style_attr text_list_level_style_attr_; text_list_level_style_attr text_list_level_style_attr_;
text_list_level_style_bullet_attr text_list_level_style_bullet_attr_; text_list_level_style_bullet_attr text_list_level_style_bullet_attr_;
office_element_ptr style_text_properties_; office_element_ptr style_text_properties_;
office_element_ptr style_list_level_properties_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(text_list_level_style_bullet); CP_REGISTER_OFFICE_ELEMENT2(text_list_level_style_bullet);
} } }
}
...@@ -76,6 +76,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -76,6 +76,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
switch(oox_unknown->getType()) switch(oox_unknown->getType())
{ {
case OOX::et_a_Shape:
{
OOX::Drawing::CShape* pShape = static_cast<OOX::Drawing::CShape*>(oox_unknown);
convert(pShape);
}break;
case OOX::et_a_prstGeom: case OOX::et_a_prstGeom:
{ {
OOX::Drawing::CPresetGeometry2D* pPresetGeom = static_cast<OOX::Drawing::CPresetGeometry2D*>(oox_unknown); OOX::Drawing::CPresetGeometry2D* pPresetGeom = static_cast<OOX::Drawing::CPresetGeometry2D*>(oox_unknown);
...@@ -185,6 +190,89 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -185,6 +190,89 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
} }
} }
} }
void OoxConverter::convert(OOX::Drawing::CShape *oox_shape)
{
if (oox_shape == NULL)return;
if (!oox_shape->m_oSpPr.IsInit()) return;
odf_context()->drawing_context()->start_drawing();
int type = -1;
if (oox_shape->m_oSpPr->m_oCustGeom.IsInit())
{
type = 1000;//6???
}
if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
{
OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
type =(geometry->m_oPrst.GetValue());
}
if (oox_shape->m_oNvSpPr.IsInit() && oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit())
{
if (oox_shape->m_oNvSpPr->m_oCNvSpPr->m_otxBox.GetValue() == 1)
type = 2000; //textBox
}
if (type == SimpleTypes::shapetypeRect && oox_shape->m_oTxSp.IsInit() && oox_shape->m_oTxSp->m_oTxBody.IsInit())
{
type = 2000;// , , ...
if (oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr.IsInit())
{
int wordart_type = convert(oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr->m_oPrstTxWrap.GetPointer());
if (wordart_type >=0)type = wordart_type;
}
}
if (type < 0)return;
/////////////////////////////////////////////////////////////////////////////////
odf_context()->drawing_context()->start_shape(type);
convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
//, , ...
if (oox_shape->m_oNvSpPr.IsInit())
convert(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer());
if (oox_shape->m_oTxSp.IsInit() && oox_shape->m_oTxSp->m_oTxBody.IsInit())
{
odf_context()->start_text_context();
convert(oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr.GetPointer());
for (long i=0 ; i < oox_shape->m_oTxSp->m_oTxBody->m_arrItems.GetSize();i++)
{
convert(oox_shape->m_oTxSp->m_oTxBody->m_arrItems[i]);
}
odf_context()->drawing_context()->set_text( odf_context()->text_context());
odf_context()->end_text_context();
}
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
}
void OoxConverter::convert(OOX::Drawing::CLockedCanvas *oox_canvas)
{
if (oox_canvas == NULL)return;
odf_context()->drawing_context()->start_group();
if (oox_canvas->m_oNvGroupSpPr.IsInit() && oox_canvas->m_oNvGroupSpPr->m_oCNvPr.IsInit())
{
if (oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
odf_context()->drawing_context()->set_group_name(string2std_string(*oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName));
if (oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
odf_context()->drawing_context()->set_group_z_order(oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
}
convert(oox_canvas->m_oGroupSpPr.GetPointer());
convert(oox_canvas->m_oSpPr.GetPointer());
for (long i=0; i < oox_canvas->m_arrItems.GetSize(); i++)
{
convert(oox_canvas->m_arrItems[i]);
}
odf_context()->drawing_context()->end_group();
}
void OoxConverter::convert(OOX::Drawing::CGroupShapeProperties * oox_group_spPr) void OoxConverter::convert(OOX::Drawing::CGroupShapeProperties * oox_group_spPr)
{ {
if (!oox_group_spPr) return; if (!oox_group_spPr) return;
...@@ -884,6 +972,64 @@ void OoxConverter::convert(OOX::Drawing::CTextBodyProperties *oox_bodyPr) ...@@ -884,6 +972,64 @@ void OoxConverter::convert(OOX::Drawing::CTextBodyProperties *oox_bodyPr)
//+ style section //+ style section
//+element text:section //+element text:section
} }
//for (long i=0; i<oox_prst_geom->m_oAvLst->m_arrGd.GetSize(); i++)
//{
// odf_context()->drawing_context()->add_modifier(string2std_string(oox_prst_geom->m_oAvLst->m_arrGd[i].m_oFmla.GetValue()));
//}
}
int OoxConverter::convert(OOX::Drawing::CPresetTextShape *oox_text_preset)
{
if (oox_text_preset == NULL) return -1;
int type = 2001 + oox_text_preset->m_oPrst.GetValue();
switch(oox_text_preset->m_oPrst.GetValue())
{
case SimpleTypes::textshapetypeTextArchDown : break;
case SimpleTypes::textshapetypeTextArchDownPour : break;
case SimpleTypes::textshapetypeTextArchUp : break;
case SimpleTypes::textshapetypeTextArchUpPour : break;
case SimpleTypes::textshapetypeTextButton : break;
case SimpleTypes::textshapetypeTextButtonPour : break;
case SimpleTypes::textshapetypeTextCanDown : break;
case SimpleTypes::textshapetypeTextCanUp : break;
case SimpleTypes::textshapetypeTextCascadeDown : break;
case SimpleTypes::textshapetypeTextCascadeUp : break;
case SimpleTypes::textshapetypeTextChevron : break;
case SimpleTypes::textshapetypeTextChevronInverted: break;
case SimpleTypes::textshapetypeTextCircle : break;
case SimpleTypes::textshapetypeTextCirclePour : break;
case SimpleTypes::textshapetypeTextCurveDown : break;
case SimpleTypes::textshapetypeTextCurveUp : break;
case SimpleTypes::textshapetypeTextDeflate : break;
case SimpleTypes::textshapetypeTextDeflateBottom: break;
case SimpleTypes::textshapetypeTextDeflateInflate: break;
case SimpleTypes::textshapetypeTextDeflateInflateDeflate: break;
case SimpleTypes::textshapetypeTextDeflateTop : break;
case SimpleTypes::textshapetypeTextDoubleWave1 : break;
case SimpleTypes::textshapetypeTextFadeDown : break;
case SimpleTypes::textshapetypeTextFadeLeft : break;
case SimpleTypes::textshapetypeTextFadeRight : break;
case SimpleTypes::textshapetypeTextFadeUp : break;
case SimpleTypes::textshapetypeTextInflate : break;
case SimpleTypes::textshapetypeTextInflateBottom: break;
case SimpleTypes::textshapetypeTextInflateTop : break;
case SimpleTypes::textshapetypeTextNoShape : break;
case SimpleTypes::textshapetypeTextPlain : break;
case SimpleTypes::textshapetypeTextRingInside : break;
case SimpleTypes::textshapetypeTextRingOutside : break;
case SimpleTypes::textshapetypeTextSlantDown : break;
case SimpleTypes::textshapetypeTextSlantUp : break;
case SimpleTypes::textshapetypeTextStop : break;
case SimpleTypes::textshapetypeTextTriangle : break;
case SimpleTypes::textshapetypeTextTriangleInverted : break;
case SimpleTypes::textshapetypeTextWave1 : break;
case SimpleTypes::textshapetypeTextWave2 : break;
case SimpleTypes::textshapetypeTextWave4 : break;
}
return type;
} }
void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf::style_text_properties * text_properties) void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf::style_text_properties * text_properties)
{ {
......
...@@ -45,6 +45,9 @@ namespace OOX ...@@ -45,6 +45,9 @@ namespace OOX
namespace Drawing namespace Drawing
{ {
class CPresetTextShape;
class CShape;
class CLockedCanvas;
class CPicture; class CPicture;
class CChart; class CChart;
class CGraphic; class CGraphic;
...@@ -304,6 +307,8 @@ public: ...@@ -304,6 +307,8 @@ public:
void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size); void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size);
//.drawing...................................................................................................................... //.drawing......................................................................................................................
void convert(OOX::Drawing::CLockedCanvas *oox_canvas);
void convert(OOX::Drawing::CShape *oox_shape);
void convert(OOX::Drawing::CNonVisualDrawingProps *oox_cnvPr); 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::CShapeProperties *oox_spPr, OOX::Drawing::CShapeStyle* oox_sp_style = NULL);
void convert(OOX::Drawing::CGroupShapeProperties *oox_groupSpPr); void convert(OOX::Drawing::CGroupShapeProperties *oox_groupSpPr);
...@@ -311,6 +316,7 @@ public: ...@@ -311,6 +316,7 @@ public:
void convert(OOX::Drawing::CCustomGeometry2D *oox_cust_geom); void convert(OOX::Drawing::CCustomGeometry2D *oox_cust_geom);
void convert(OOX::Drawing::CPresetGeometry2D *oox_prst_geom); void convert(OOX::Drawing::CPresetGeometry2D *oox_prst_geom);
int convert(OOX::Drawing::CPresetTextShape *oox_text_preset);
void convert(OOX::Drawing::CLineProperties *oox_line_prop, CString *change_sheme_color = NULL); void convert(OOX::Drawing::CLineProperties *oox_line_prop, CString *change_sheme_color = NULL);
......
...@@ -51,6 +51,11 @@ namespace OOX ...@@ -51,6 +51,11 @@ namespace OOX
class CBackground; class CBackground;
} }
namespace Numbering
{
class CAbstractNum;
class CLvl;
};
} }
namespace ComplexTypes namespace ComplexTypes
...@@ -108,6 +113,7 @@ namespace Oox2Odf ...@@ -108,6 +113,7 @@ namespace Oox2Odf
void convert_document(); void convert_document();
void convert_styles(); void convert_styles();
void convert_lists_styles();
void convert_settings(); void convert_settings();
void convert_comment (int oox_comm_id); void convert_comment (int oox_comm_id);
...@@ -161,6 +167,8 @@ namespace Oox2Odf ...@@ -161,6 +167,8 @@ namespace Oox2Odf
void convert(OOX::CDocDefaults *def_style); void convert(OOX::CDocDefaults *def_style);
void convert(OOX::CStyle *style); void convert(OOX::CStyle *style);
void convert_table_style(OOX::CStyle *oox_style); void convert_table_style(OOX::CStyle *oox_style);
void convert(OOX::Numbering::CAbstractNum *oox_num_style);
void convert(OOX::Numbering::CLvl *oox_num_lvl);
void convert(OOX::Logic::CCommentRangeStart *oox_comm_start); void convert(OOX::Logic::CCommentRangeStart *oox_comm_start);
void convert(OOX::Logic::CCommentRangeEnd *oox_comm_end); void convert(OOX::Logic::CCommentRangeEnd *oox_comm_end);
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//2 //2
//0 //0
//125 //126
#define INTVER 1,2,0,125 #define INTVER 1,2,0,126
#define STRVER "1,2,0,125\0" #define STRVER "1,2,0,126\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