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

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@54943 954022d7-b5bf-4e40-9824-e11837661b57
parent 817a90e5
......@@ -974,6 +974,14 @@
RelativePath=".\OdfFormat\style_map.h"
>
</File>
<File
RelativePath=".\OdfFormat\style_paragraph_properties.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\style_paragraph_properties.h"
>
</File>
<File
RelativePath=".\OdfFormat\style_table_properties.cpp"
>
......@@ -982,6 +990,14 @@
RelativePath=".\OdfFormat\style_table_properties.h"
>
</File>
<File
RelativePath=".\OdfFormat\style_text_properties.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\style_text_properties.h"
>
</File>
<File
RelativePath=".\OdfFormat\styles.cpp"
>
......
......@@ -27,9 +27,9 @@ const odf_style_state & odf_style_context::state() const
return style_state_list_.back();
}
void odf_style_context::start_style(std::wstring name,const style_family family, bool automatic )
void odf_style_context::create_style(std::wstring name,const style_family family, bool automatic,int oox_id)
{
int id = style_state_list_.size();
if (oox_id < 0) oox_id = style_state_list_.size();
office_element_ptr elm;
create_element(L"style", L"style", elm, &context_);
......@@ -39,7 +39,7 @@ void odf_style_context::start_style(std::wstring name,const style_family family,
state().set_name(name);
state().set_automatic(automatic);
state().style_oox_id_ = id;
state().style_oox_id_ = oox_id;
}
void odf_style_context::process_automatic(office_element_ptr root )
......@@ -67,22 +67,25 @@ void odf_style_context::process_master(office_element_ptr root )
root->add_child_element(it->odf_style_);
}
}
//office_element_ptr & odf_style_context::find_by_id()
//{
// for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
// {
// if (it->odf_style_)
// {
// if (it->odf_style_->style_family_ == family && it->style_oox_id_ == id)
// return it->get_office_element();
// }
// }
// return office_element_ptr();
//}
void odf_style_context::end_style()
office_element_ptr & odf_style_context::add_or_find(std::wstring name, const style_family family, bool automatic , int oox_id)
{
state().convert();
for (std::list<odf_style_state>::iterator it = style_state_list_.begin(); it != style_state_list_.end(); it++)
{
if (it->odf_style_)
{
if (it->style_family_ == family)
{
if (oox_id >=0 && it->style_oox_id_ == oox_id) return it->get_office_element();
if (name.length() >=0 && it->odf_style_->get_name() == name) return it->get_office_element();
}
}
}
create_style(name,family, true,oox_id);
return state().get_office_element();
}
}
}
\ No newline at end of file
......@@ -21,10 +21,10 @@ class odf_style_context
public:
odf_style_context(odf_conversion_context & Context/*, ods_text_context & textCotnext*/);
void start_style(std::wstring name, const style_family style_family, bool automatic = false);
void end_style();
void create_style(std::wstring name, const style_family style_family, bool automatic = false, int oox_id = -1);
office_element_ptr & add_or_find(std::wstring name, const style_family family, bool automatic = false, int id = -1);
//office_element_ptr & find_by_id(int id, const style_family family);
void process_automatic(office_element_ptr root );
void process_master(office_element_ptr root );
void process_office(office_element_ptr root );
......
......@@ -17,7 +17,7 @@ odf_style_state::odf_style_state(odf_conversion_context & Context, office_elemen
style* style_ = dynamic_cast<style*>(elm.get());
if (!style_)return;
style_->style_family_ = family;
style_->style_family_ = style_family_ = family;
//set default
......
......@@ -38,18 +38,16 @@ public:
office_element_ptr & get_office_element();
void add_child(office_element_ptr & child);
void set_oox_id(int id){style_oox_id_ = id;}
private:
int style_oox_id_;
bool automatic_;
bool master_;
style_family style_family_;
office_element_ptr odf_style_;//
// !!! - , ... ,
// ???
office_element_ptr odf_style_;//
odf_conversion_context & context_;
friend class odf_style_context;
......
#include "precompiled_cpodf.h"
#include <iostream>
#include "style_paragraph_properties.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/serialize.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/utils.h>
#include <boost/foreach.hpp>
#include "borderstyle.h"
namespace cpdoccore {
namespace odf {
using xml::xml_char_wc;
// style:tab-stop
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_tab_stop::ns = L"style";
const wchar_t * style_tab_stop::name = L"tab-stop";
// style:tab-stop
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_tab_stops::ns = L"style";
const wchar_t * style_tab_stops::name = L"tab-stops";
// style:drop-cap
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_drop_cap::ns = L"style";
const wchar_t * style_drop_cap::name = L"drop-cap";
// style:background-image
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_background_image::ns = L"style";
const wchar_t * style_background_image::name = L"background-image";
//////////////////////////////////////////////////////////////////////////////////////////////////
void paragraph_format_properties::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name,odf_conversion_context * Context)
{
if (L"style" == Ns)
{
// 15.5.11 <style:tab-stops>
if (L"tab-stops" == Name)
{
CP_CREATE_ELEMENT_SIMPLE(style_tab_stops_);
}
// 15.5.15 <style:drop-cap>
else if (L"drop-cap" == Name)
{
CP_CREATE_ELEMENT_SIMPLE(style_drop_cap_);
}
// 15.5.24 <style:background-image>
else if (L"background-image" == Name)
{
CP_CREATE_ELEMENT_SIMPLE(style_background_image_);
}
//else
// CP_NOT_APPLICABLE_ELM();
}
}
// style:paragraph-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_paragraph_properties::ns = L"style";
const wchar_t * style_paragraph_properties::name = L"paragraph-properties";
void style_paragraph_properties::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{
style_paragraph_properties_content_.create_child_element(Ns, Name, getContext());
}
void paragraph_format_properties::apply_from(const paragraph_format_properties & Other)
{
apply_line_width(fo_line_height_, Other.fo_line_height_);
_CP_APPLY_PROP(style_line_height_at_least_, Other.style_line_height_at_least_);
_CP_APPLY_PROP(style_line_spacing_, Other.style_line_spacing_);
_CP_APPLY_PROP(style_font_independent_line_spacing_, Other.style_font_independent_line_spacing_);
_CP_APPLY_PROP(fo_text_align_, Other.fo_text_align_);
_CP_APPLY_PROP(fo_text_align_last_, Other.fo_text_align_last_);
_CP_APPLY_PROP(style_justify_single_word_, Other.style_justify_single_word_);
_CP_APPLY_PROP(fo_keep_together_, Other.fo_keep_together_);
_CP_APPLY_PROP(fo_widows_, Other.fo_widows_);
_CP_APPLY_PROP(fo_orphans_, Other.fo_orphans_);
// TODO
_CP_APPLY_PROP(style_tab_stops_, Other.style_tab_stops_);
_CP_APPLY_PROP(style_tab_stop_distance_, Other.style_tab_stop_distance_);
_CP_APPLY_PROP(fo_hyphenation_keep_, Other.fo_hyphenation_keep_);
_CP_APPLY_PROP(fo_hyphenation_ladder_count_, Other.fo_hyphenation_ladder_count_);
// TODO
_CP_APPLY_PROP(style_drop_cap_, Other.style_drop_cap_);
_CP_APPLY_PROP(style_register_true_, Other.style_register_true_);
apply_length_or_percent(fo_margin_left_, Other.fo_margin_left_);
apply_length_or_percent(fo_margin_right_, Other.fo_margin_right_);
apply_length_or_percent(fo_text_indent_, Other.fo_text_indent_);
_CP_APPLY_PROP(style_auto_text_indent_, Other.style_auto_text_indent_);
apply_length_or_percent(fo_margin_top_, Other.fo_margin_top_);
apply_length_or_percent(fo_margin_bottom_, Other.fo_margin_bottom_);
apply_length_or_percent(fo_margin_, Other.fo_margin_);
_CP_APPLY_PROP(fo_break_before_, Other.fo_break_before_);
_CP_APPLY_PROP(fo_break_after_, Other.fo_break_after_);
_CP_APPLY_PROP(fo_background_color_, Other.fo_background_color_);
// TODO
_CP_APPLY_PROP(style_background_image_, Other.style_background_image_);
_CP_APPLY_PROP(fo_border_, Other.fo_border_);
_CP_APPLY_PROP(fo_border_top_, Other.fo_border_top_);
_CP_APPLY_PROP(fo_border_bottom_, Other.fo_border_bottom_);
_CP_APPLY_PROP(fo_border_left_, Other.fo_border_left_);
_CP_APPLY_PROP(fo_border_right_, Other.fo_border_right_);
_CP_APPLY_PROP(style_border_line_width_, Other.style_border_line_width_);
_CP_APPLY_PROP(style_border_line_width_top_, Other.style_border_line_width_top_);
_CP_APPLY_PROP(style_border_line_width_bottom_, Other.style_border_line_width_bottom_);
_CP_APPLY_PROP(style_border_line_width_left_, Other.style_border_line_width_left_);
_CP_APPLY_PROP(style_border_line_width_right_, Other.style_border_line_width_right_);
_CP_APPLY_PROP(fo_padding_, Other.fo_padding_);
_CP_APPLY_PROP(fo_padding_top_, Other.fo_padding_top_);
_CP_APPLY_PROP(fo_padding_bottom_, Other.fo_padding_bottom_);
_CP_APPLY_PROP(fo_padding_left_, Other.fo_padding_left_);
_CP_APPLY_PROP(fo_padding_right_, Other.fo_padding_right_);
_CP_APPLY_PROP(style_shadow_, Other.style_shadow_);
_CP_APPLY_PROP(fo_keep_with_next_, Other.fo_keep_with_next_);
_CP_APPLY_PROP(text_number_lines_, Other.text_number_lines_);
_CP_APPLY_PROP(text_line_number_, Other.text_line_number_);
_CP_APPLY_PROP(style_text_autospace_, Other.style_text_autospace_);
_CP_APPLY_PROP(style_punctuation_wrap_, Other.style_punctuation_wrap_);
_CP_APPLY_PROP(style_line_break_, Other.style_line_break_);
_CP_APPLY_PROP(style_vertical_align_, Other.style_vertical_align_);
_CP_APPLY_PROP(style_writing_mode_, Other.style_writing_mode_);
_CP_APPLY_PROP(style_writing_mode_automatic_, Other.style_writing_mode_automatic_);
_CP_APPLY_PROP(style_snap_to_layout_grid_, Other.style_snap_to_layout_grid_);
_CP_APPLY_PROP(style_page_number_, Other.style_page_number_);
_CP_APPLY_PROP(style_background_transparency_, Other.style_join_border_);
_CP_APPLY_PROP(style_join_border_, Other.style_join_border_);
}
}
}
......@@ -5,6 +5,7 @@
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
......@@ -68,13 +69,11 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
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 add_child_element(office_element_ptr & child){}
table_format_properties table_format_properties_;
virtual void serialize(std::wostream & strm);
table_format_properties table_format_properties_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_table_properties);
......
#include "precompiled_cpodf.h"
#include <iostream>
#include "style_text_properties.h"
#include <cpdoccore/xml/serialize.h>
#include "fontvariant.h"
#include "logging.h"
#include "common_attlists.h"
#include <cpdoccore/xml/simple_xml_writer.h>
//#include "../docx/oox_drawing_fills.h"
namespace cpdoccore {
namespace odf {
using xml::xml_char_wc;
std::wstring delete_apostroph_in_name(std::wstring value)
{
if (value.length()<1)return value;
if (value[0] == 0x27 && value[value.length()-1] == 0x27)
{
return value.substr(1,value.length()-2);
}
return value;
}
void text_format_properties_content::apply_from(const text_format_properties_content & Other)
{
_CP_APPLY_PROP(r_style_, Other.r_style_);
_CP_APPLY_PROP(fo_font_variant_, Other.fo_font_variant_);
_CP_APPLY_PROP(fo_text_transform_, Other.fo_text_transform_);
_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_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_style_, Other.style_text_line_through_style_);
apply_line_width(style_text_line_through_width_, Other.style_text_line_through_width_);
_CP_APPLY_PROP(style_text_line_through_color_, Other.style_text_line_through_color_);
_CP_APPLY_PROP(style_text_line_through_text_, Other.style_text_line_through_text_);
_CP_APPLY_PROP(style_text_line_through_text_style_, Other.style_text_line_through_text_style_);
_CP_APPLY_PROP(style_text_position_, Other.style_text_position_);
_CP_APPLY_PROP(style_font_name_, Other.style_font_name_);
_CP_APPLY_PROP(style_font_name_asian_, Other.style_font_name_asian_);
_CP_APPLY_PROP(style_font_name_complex_, Other.style_font_name_complex_);
_CP_APPLY_PROP(fo_font_family_, Other.fo_font_family_);
_CP_APPLY_PROP(style_font_family_asian_, Other.style_font_family_asian_);
_CP_APPLY_PROP(style_font_family_complex_, Other.style_font_family_complex_);
_CP_APPLY_PROP(style_font_family_generic_, Other.style_font_family_generic_);
_CP_APPLY_PROP(style_font_family_generic_asian_, Other.style_font_family_generic_asian_);
_CP_APPLY_PROP(style_font_family_generic_complex_, Other.style_font_family_generic_complex_);
_CP_APPLY_PROP(style_font_style_name_, Other.style_font_style_name_);
_CP_APPLY_PROP(style_font_style_name_asian_, Other.style_font_style_name_asian_);
_CP_APPLY_PROP(style_font_style_name_complex_, Other.style_font_style_name_complex_);
_CP_APPLY_PROP(style_font_pitch_, Other.style_font_pitch_);
_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_charset_, Other.style_font_charset_);
_CP_APPLY_PROP(style_font_charset_asian_, Other.style_font_charset_asian_);
_CP_APPLY_PROP(style_font_charset_complex_, Other.style_font_charset_complex_);
// TODO check
_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_script_type_, Other.style_script_type_);
_CP_APPLY_PROP(fo_letter_spacing_, Other.fo_letter_spacing_);
_CP_APPLY_PROP(fo_language_, Other.fo_language_);
_CP_APPLY_PROP(style_language_asian_, Other.style_language_asian_);
_CP_APPLY_PROP(style_language_complex_, Other.style_language_complex_);
_CP_APPLY_PROP(fo_country_, Other.fo_country_);
_CP_APPLY_PROP(style_country_asian_, Other.style_country_asian_);
_CP_APPLY_PROP(style_country_complex_, Other.style_country_complex_);
_CP_APPLY_PROP(fo_font_style_, Other.fo_font_style_);
_CP_APPLY_PROP(style_font_style_asian_, Other.style_font_style_asian_);
_CP_APPLY_PROP(style_font_style_complex_, Other.style_font_style_complex_);
_CP_APPLY_PROP(style_font_relief_, Other.style_font_relief_);
_CP_APPLY_PROP(fo_text_shadow_, Other.fo_text_shadow_);
_CP_APPLY_PROP(style_text_underline_type_, Other.style_text_underline_type_);
_CP_APPLY_PROP(style_text_underline_style_, Other.style_text_underline_style_);
apply_line_width(style_text_underline_width_, Other.style_text_underline_width_);
_CP_APPLY_PROP(style_text_underline_color_, Other.style_text_underline_color_);
_CP_APPLY_PROP(fo_font_weight_, Other.fo_font_weight_);
_CP_APPLY_PROP(style_font_weight_asian_, Other.style_font_weight_asian_);
_CP_APPLY_PROP(style_font_weight_complex_, Other.style_font_weight_complex_);
_CP_APPLY_PROP(style_text_underline_mode_, Other.style_text_underline_mode_);
_CP_APPLY_PROP(style_text_line_through_mode_, Other.style_text_line_through_mode_);
_CP_APPLY_PROP(style_letter_kerning_, Other.style_letter_kerning_);
_CP_APPLY_PROP(style_text_blinking_, Other.style_text_blinking_);
_CP_APPLY_PROP(fo_background_color_, Other.fo_background_color_);
_CP_APPLY_PROP(style_text_combine_, Other.style_text_combine_);
_CP_APPLY_PROP(style_text_combine_start_char_, Other.style_text_combine_start_char_);
_CP_APPLY_PROP(style_text_combine_end_char_, Other.style_text_combine_end_char_);
_CP_APPLY_PROP(style_text_emphasize_, Other.style_text_emphasize_);
_CP_APPLY_PROP(style_text_scale_, Other.style_text_scale_);
_CP_APPLY_PROP(style_text_rotation_angle_, Other.style_text_rotation_angle_);
_CP_APPLY_PROP(style_text_rotation_scale_, Other.style_text_rotation_scale_);
_CP_APPLY_PROP(fo_hyphenate_, Other.fo_hyphenate_);
_CP_APPLY_PROP(fo_hyphenation_remain_char_count_, Other.fo_hyphenation_remain_char_count_);
_CP_APPLY_PROP(fo_hyphenation_push_char_count_, Other.fo_hyphenation_push_char_count_);
_CP_APPLY_PROP(text_display_, Other.text_display_);
_CP_APPLY_PROP(text_condition_, Other.text_condition_);
_CP_APPLY_PROP(style_text_overline_color_, Other.style_text_overline_color_);
_CP_APPLY_PROP(style_text_overline_mode_, Other.style_text_overline_mode_);
_CP_APPLY_PROP(style_text_overline_style_, Other.style_text_overline_style_);
}
// style:text-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_text_properties::ns = L"style";
const wchar_t * style_text_properties::name = L"text-properties";
void style_text_properties::create_child_element(const ::std::wstring & Ns, const ::std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
}
}
This diff is collapsed.
......@@ -11,15 +11,14 @@
#include "office_elements.h"
#include "office_elements_create.h"
//#include "style_text_properties.h"
//#include "style_paragraph_properties.h"
#include "style_text_properties.h"
#include "style_paragraph_properties.h"
#include "style_table_properties.h"
//#include "style_graphic_properties.h"
//#include "style_chart_properties.h"
//#include "style_presentation.h"
//#include "serialize_elements.h"
//#include <cpdoccore/odf/odf_document.h>
//#include "odfcontext.h"
//#include "draw_common.h"
......@@ -31,16 +30,16 @@ namespace odf {
using xml::xml_char_wc;
//
//style_text_properties * style_content::get_style_text_properties() const
//{
// return dynamic_cast<style_text_properties *>(style_text_properties_.get());
//}
//
//style_paragraph_properties * style_content::get_style_paragraph_properties() const
//{
// return dynamic_cast<style_paragraph_properties *>(style_paragraph_properties_.get());
//}
//
style_text_properties * style_content::get_style_text_properties() const
{
return dynamic_cast<style_text_properties *>(style_text_properties_.get());
}
style_paragraph_properties * style_content::get_style_paragraph_properties() const
{
return dynamic_cast<style_paragraph_properties *>(style_paragraph_properties_.get());
}
//style_graphic_properties * style_content::get_style_graphic_properties() const
//{
// return dynamic_cast<style_graphic_properties *>(style_graphic_properties_.get());
......@@ -79,13 +78,13 @@ style_table_column_properties * style_content::get_style_table_column_properties
// return dynamic_cast<style_drawing_page_properties *>(style_drawing_page_properties_.get());
//}
void style_content::add_child_element(office_element_ptr & child, odf_conversion_context * Context)
void style_content::add_child_element(office_element_ptr & child)
{
if (!child)return;
ElementType type = child->get_type();
switch(type)
switch(type)//ïåðåçàòèðàòü???
{
case typeStyleTextProperties: style_text_properties_ = child; break;
case typeStyleParagraphProperties: style_paragraph_properties_ = child; break;
......@@ -161,7 +160,7 @@ void default_style::create_child_element( const ::std::wstring & Ns, const ::std
}
void default_style::add_child_element(office_element_ptr & child)
{
style_content_.add_child_element(child, getContext());
style_content_.add_child_element(child);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -224,7 +223,7 @@ void style::add_child_element(office_element_ptr & child)
style_map_.push_back(child);
}
else
style_content_.add_child_element(child, getContext());
style_content_.add_child_element(child);
}
// styles & draw_styles
......
......@@ -57,7 +57,7 @@ class style_content : noncopyable
{
public:
void create_child_element( const ::std::wstring & Ns, const ::std::wstring & Name, odf_conversion_context * Context);
void add_child_element(office_element_ptr & child, odf_conversion_context * Context);
void add_child_element(office_element_ptr & child);
style_text_properties * get_style_text_properties() const;
style_paragraph_properties * get_style_paragraph_properties() const;
......
......@@ -8,6 +8,8 @@
#include "ods_conversion_context.h"
#include "styles.h"
using namespace cpdoccore;
......@@ -96,42 +98,25 @@ void XlsxConverter::convert_styles()
if (!xlsx_styles->m_oCellStyleXfs.IsInit())return;
for (long i=0;i< xlsx_styles->m_oCellStyleXfs->m_oCount->GetValue(); i++)
{
convert(xlsx_styles->m_oCellStyleXfs->m_arrItems[i] , i);
}
for (long i=0;i< xlsx_styles->m_oCellXfs->m_oCount->GetValue(); i++)
{
ods_context->styles_context().start_style(L"" ,odf::style_family::TableCell,true); // - () - oox
ods_context->styles_context().state().set_oox_id (xlsx_styles->m_oCellXfs->m_arrItems[i]->m_oXfId->GetValue() );
int fill_id = xlsx_styles->m_oCellXfs->m_arrItems[i]->m_oFillId->GetValue();
int numFmt_id = xlsx_styles->m_oCellXfs->m_arrItems[i]->m_oNumFmtId->GetValue();
int font_id = xlsx_styles->m_oCellXfs->m_arrItems[i]->m_oFontId->GetValue();
int border_id = xlsx_styles->m_oCellXfs->m_arrItems[i]->m_oBorderId->GetValue();
odf::office_element_ptr element_font = convert(xlsx_styles->m_oFonts->m_arrItems[font_id]); //text_properties
ods_context->styles_context().state().add_child(element_font);
//xlsx_styles->m_oFills->m_arrItems[fill_id];
//xlsx_styles->m_oNumFmts->m_arrItems[numFmt_id];
//xlsx_styles->m_oBorders->m_arrItems[border_id];
convert(xlsx_styles->m_oCellXfs->m_arrItems[i],i);
//
// //find_fill_by_id (xlsx_styles->m_oCellXfs->m_arrItems[i]->m_oFillId); // graphic_properies
// //find_num_format_by_id (xlsx_styles->m_oCellXfs->m_arrItems[i]->m_oNumFmtId); //
// //find_text_by_id (xlsx_styles->m_oCellXfs->m_arrItems[i]->m_oFontId); // text_properties
//
ods_context->styles_context().end_style();
}
for (long i=0;i< xlsx_styles->m_oCellStyles->m_oCount->GetValue(); i++)//styles.xml
{
std::wstring style_name = string2std_string(xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oName.get2());
//std::wstring style_name = string2std_string(xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oName.get2());
ods_context->styles_context().start_style(style_name ,odf::style_family::TableCell);
int id_xfd = xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oXfId->GetValue();
//ods_context->styles_context().start_style(style_name ,odf::style_family::TableCell);
//int id_xfd = xlsx_styles->m_oCellStyles->m_arrItems[i]->m_oXfId->GetValue();
xlsx_styles->m_oCellXfs->m_arrItems[id_xfd];//
//xlsx_styles->m_oCellXfs->m_arrItems[id_xfd];//
//odf::office_element_ptr & elm = ods_context->styles_context().find_by_id(, odf::style_family::TableCell);
//ods_context->styles_.back()->add_child(elm);
......@@ -150,10 +135,62 @@ void XlsxConverter::convert_styles()
}
odf::office_element_ptr XlsxConverter::convert(OOX::Spreadsheet::CFont * font)
void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf::office_element_ptr & odf_style_)
{
odf::style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_)return;
odf::style_text_properties * text_properties = style->style_content_.get_style_text_properties();// -
if (text_properties == NULL)
{
style->style_content_.add_child(L"style", L"text-properties", ods_context);
text_properties = style->style_content_.get_style_text_properties();
if (text_properties == NULL) return;
}
}
void XlsxConverter::convert(OOX::Spreadsheet::CFill * fill, odf::office_element_ptr & odf_style_)
{
odf::office_element_ptr element;
return element;
odf::style* style_ = dynamic_cast<odf::style*>(odf_style_.get());
if (!style_)return;
odf::style_table_cell_properties * cell_properties = style->style_content_.get_style_table_cell_properties();// -
if (cell_properties == NULL)
{
style->style_content_.add_child(L"style", L"table-cell-properties", ods_context);
style->style_content_.get_style_table_cell_properties();
if (cell_properties == NULL) return;
}
}
odf::office_element_ptr XlsxConverter::convert(OOX::Spreadsheet::CXfs * cell_style, int oox_id)
{
int id_parent = cell_style->m_oXfId->GetValue(); //parent
int fill_id = cell_style->m_oFillId->GetValue();
int numFmt_id = cell_style->m_oNumFmtId->GetValue();
int font_id = cell_style->m_oFontId->GetValue();
int border_id = cell_style->m_oBorderId->GetValue();
odf::office_element_ptr elm_style = ods_context->styles_context().add_or_find(L"" ,odf::style_family::TableCell, true, oox_id);
// c - () - oox
convert(xlsx_styles->m_oFonts->m_arrItems[font_id], elm_style);
convert(xlsx_styles->m_oFills->m_arrItems[fill_id], elm_style);
odf::style* style = dynamic_cast<odf::style*>(elm_style.get());
if (!style_)return;
odf::style_table_cell_properties * cell_properties = get_style_table_cell_properties();
return style;
}
} // namespace Docx2Odt
\ No newline at end of file
......@@ -39,13 +39,14 @@ namespace Oox2Odf
OOX::Spreadsheet::CXlsx *xlsx_document;
cpdoccore::odf::package::odf_document *output_document;
cpdoccore::odf::ods_conversion_context *ods_context;
cpdoccore::odf::ods_conversion_context *ods_context;
void convert_sheets();
void convert_styles();
void convert(OOX::Spreadsheet::CWorksheet *oox_sheet);
cpdoccore::odf::office_element_ptr convert(OOX::Spreadsheet::CFont * font);
void convert(OOX::Spreadsheet::CFill * fill, cpdoccore::odf::office_element_ptr & odf_style_);
void convert(OOX::Spreadsheet::CFont * font, cpdoccore::odf::office_element_ptr & odf_style_);
};
}
\ No newline at end of file
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