Commit 8cb1b2af authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - форматированый вывод чисел, дат, ... в осях и данных диаграм

parent f2df0618
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<Configurations> <Configurations>
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="WORD_EXAMPLE.odtWORD_EXAMPLE.odt" OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
......
...@@ -61,11 +61,6 @@ void oox_axis_content::oox_serialize(std::wostream & _Wostream) ...@@ -61,11 +61,6 @@ void oox_axis_content::oox_serialize(std::wostream & _Wostream)
{ {
CP_XML_ATTR(L"val", L"between"); CP_XML_ATTR(L"val", L"between");
} }
//CP_XML_NODE(L"c:numFmt")
//{
// CP_XML_ATTR(L"sourceLinked", 1);
// CP_XML_ATTR(L"formatCode", "General");
//}
} }
break; break;
case 3: case 3:
...@@ -89,8 +84,9 @@ void oox_axis_content::oox_serialize(std::wostream & _Wostream) ...@@ -89,8 +84,9 @@ void oox_axis_content::oox_serialize(std::wostream & _Wostream)
} }
void oox_axis_content::oox_serialize_content(std::wostream & _Wostream) void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
{ {
oox_chart_shape shape; oox_chart_shape shape;
_CP_OPT(bool) boolVal; _CP_OPT(bool) boolVal;
_CP_OPT(std::wstring) strVal;
oox_title title; oox_title title;
title.set_content(content_.title_);//todo layout title.set_content(content_.title_);//todo layout
...@@ -138,6 +134,18 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream) ...@@ -138,6 +134,18 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
} }
//oox_serialize_ln(_Wostream,content_.graphic_properties_); //oox_serialize_ln(_Wostream,content_.graphic_properties_);
odf_reader::GetProperty(content_.properties_, L"num_format", strVal);
odf_reader::GetProperty(content_.properties_, L"link-data-style-to-source", boolVal);
if ((strVal) && (strVal->length() > 1))
{
CP_XML_NODE(L"c:numFmt")
{
CP_XML_ATTR(L"formatCode", *strVal);
CP_XML_ATTR(L"sourceLinked", boolVal.get_value_or(true));
}
}
BOOST_FOREACH(odf_reader::chart::axis::grid & g, content_.grids_) BOOST_FOREACH(odf_reader::chart::axis::grid & g, content_.grids_)
{ {
_oox_fill fill_null; _oox_fill fill_null;
...@@ -177,7 +185,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream) ...@@ -177,7 +185,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
title.oox_serialize(_Wostream); title.oox_serialize(_Wostream);
odf_reader::GetProperty(content_.properties_,L"display_label",boolVal); odf_reader::GetProperty(content_.properties_,L"display_label", boolVal);
if ((boolVal == true) && (boolVal.get()==true)) if ((boolVal == true) && (boolVal.get()==true))
{ {
CP_XML_NODE(L"c:tickLblPos") CP_XML_NODE(L"c:tickLblPos")
...@@ -188,6 +196,8 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream) ...@@ -188,6 +196,8 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
shape.set(content_.graphic_properties_,content_.fill_) ; shape.set(content_.graphic_properties_,content_.fill_) ;
shape.oox_serialize(_Wostream); shape.oox_serialize(_Wostream);
oox_serialize_default_text(_Wostream, content_.text_properties_);
BOOST_FOREACH(int const & ii, cross_id_) BOOST_FOREACH(int const & ii, cross_id_)
{ {
......
...@@ -30,11 +30,11 @@ public: ...@@ -30,11 +30,11 @@ public:
int get_Id(){return id_;} int get_Id(){return id_;}
void add_CrossedId (int id){cross_id_.push_back( id);} void add_CrossedId (int id){cross_id_.push_back( id);}
int id_; int id_;
std::vector<int> cross_id_; std::vector<int> cross_id_;
odf_reader::chart::axis content_; odf_reader::chart::axis content_;
int type_; int type_;
}; };
} }
......
...@@ -61,7 +61,7 @@ void oox_chart_series::setName(std::wstring &value) ...@@ -61,7 +61,7 @@ void oox_chart_series::setName(std::wstring &value)
name_=value; name_=value;
} }
void oox_chart_series::setFormula(int ind, std::wstring &value) void oox_chart_series::setFormula(int ind, std::wstring &value, std::wstring & formatCode, bool link_to_source)
{ {
formulasconvert::odf2oox_converter converter; formulasconvert::odf2oox_converter converter;
...@@ -79,9 +79,11 @@ void oox_chart_series::setFormula(int ind, std::wstring &value) ...@@ -79,9 +79,11 @@ void oox_chart_series::setFormula(int ind, std::wstring &value)
long res = value.find(L"local-table"); long res = value.find(L"local-table");
if (res >=0 && !bLocalTable_ ) return; // xlsx .... table.xml if (res >=0 && !bLocalTable_ ) return; // xlsx .... table.xml
values_[ind].numRef_.formula = converter.convert_chart_distance(value); values_[ind].numRef_.formula = converter.convert_chart_distance(value);
values_[ind].numRef_.present = true; values_[ind].numRef_.present = true;
values_[ind].present = true; values_[ind].numRef_.formatCode = formatCode;
values_[ind].numRef_.link_to_source = link_to_source;
values_[ind].present = true;
} }
} }
...@@ -194,7 +196,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream) ...@@ -194,7 +196,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{ {
CP_XML_NODE(L"c:formatCode") CP_XML_NODE(L"c:formatCode")
{ {
CP_XML_CONTENT(L"General");//???? CP_XML_CONTENT(values_[i].numRef_.formatCode);
} }
CP_XML_NODE(L"c:ptCount") CP_XML_NODE(L"c:ptCount")
{ {
...@@ -227,7 +229,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream) ...@@ -227,7 +229,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{ {
CP_XML_NODE(L"c:formatCode") CP_XML_NODE(L"c:formatCode")
{ {
CP_XML_CONTENT(L"General");//???? CP_XML_CONTENT(values_[i].numRef_.formatCode);
} }
CP_XML_NODE(L"c:ptCount") CP_XML_NODE(L"c:ptCount")
{ {
......
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
void setName(std::wstring &value); void setName(std::wstring &value);
void setFormula (int ind, std::wstring & value); void setFormula (int ind, std::wstring & value, std::wstring & formatCode, bool link_to_source);
void setValues (int ind, std::vector<std::wstring> & values); void setValues (int ind, std::vector<std::wstring> & values);
void parse_properties(); void parse_properties();
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#include <iosfwd> #include <iosfwd>
#include <cpdoccore/CPOptional.h> #include <cpdoccore/CPOptional.h>
//#include <cpdoccore/CPScopedPtr.h>
namespace cpdoccore { namespace cpdoccore {
...@@ -22,11 +21,7 @@ struct _oox_numLit ...@@ -22,11 +21,7 @@ struct _oox_numLit
//formatCode (Format Code) 21.2.2.71 //formatCode (Format Code) 21.2.2.71
//pt (Numeric Point) 21.2.2.150 //pt (Numeric Point) 21.2.2.150
//ptCount (Point Count) //ptCount (Point Count)
//struct _xlsx_num_cash
//{
// int formatCode;
// std::vector<std::wstring>num_cash;
//};
struct _oox_strRef struct _oox_strRef
{ {
bool present; bool present;
...@@ -42,6 +37,7 @@ struct _oox_numRef ...@@ -42,6 +37,7 @@ struct _oox_numRef
std::wstring formula; std::wstring formula;
std::wstring formatCode; std::wstring formatCode;
bool link_to_source;
int num_cache_count; int num_cache_count;
std::vector<std::wstring> num_cache; std::vector<std::wstring> num_cache;
...@@ -55,21 +51,22 @@ struct _oox_chart_values ...@@ -55,21 +51,22 @@ struct _oox_chart_values
public: public:
_oox_chart_values() _oox_chart_values()
{ {
numRef_.present=false; numRef_.present = false;
numRef_.formatCode = L"General"; numRef_.formatCode = L"General";
numRef_.num_cache_count=0; numRef_.num_cache_count = 0;
numRef_.link_to_source = true;
strRef_.present=false; strRef_.present = false;
strRef_.str_cache_count=0; strRef_.str_cache_count = 0;
present = false; present = false;
} }
bool present; bool present;
std::wstring type; std::wstring type;
_oox_numRef numRef_; _oox_numRef numRef_;
_oox_strRef strRef_; _oox_strRef strRef_;
}; };
//numLit (Number Literal) 21.2.2.122 //numLit (Number Literal) 21.2.2.122
......
...@@ -19,10 +19,10 @@ void oox_chart::set_cache_only (bool val) ...@@ -19,10 +19,10 @@ void oox_chart::set_cache_only (bool val)
} }
void oox_chart::set_formula_series(int ind, std::wstring val) void oox_chart::set_formula_series(int ind, std::wstring val, std::wstring formatCode, bool link_to_source)
{ {
oox_series_ptr & current_ptr = series_.back(); oox_series_ptr & current_ptr = series_.back();
current_ptr->setFormula(ind,val); current_ptr->setFormula(ind, val, formatCode, link_to_source);
} }
void oox_chart::set_name(std::wstring val) void oox_chart::set_name(std::wstring val)
......
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
virtual void add_series(int id){} virtual void add_series(int id){}
void set_cache_only (bool val); void set_cache_only (bool val);
void set_formula_series (int ind,std::wstring val); void set_formula_series (int ind, std::wstring val, std::wstring formatCode, bool link_to_source);
void set_values_series (int ind, std::vector<std::wstring> & val); void set_values_series (int ind, std::vector<std::wstring> & val);
void set_name (std::wstring val); void set_name (std::wstring val);
void set_content_series (odf_reader::chart::series & content); void set_content_series (odf_reader::chart::series & content);
......
...@@ -87,9 +87,9 @@ private: ...@@ -87,9 +87,9 @@ private:
size_t paragraphs_cout_; //???? ? size_t paragraphs_cout_; //???? ?
std::wstringstream text_; // std::wstringstream text_; //
std::wstringstream paragraph_; // std::wstringstream paragraph_; //
std::wstringstream run_; // std::wstringstream run_; //
std::wstring paragraph_style_name_; std::wstring paragraph_style_name_;
std::wstring span_style_name_; std::wstring span_style_name_;
...@@ -158,8 +158,8 @@ void pptx_text_context::Impl::start_paragraph(const std::wstring & styleName) ...@@ -158,8 +158,8 @@ void pptx_text_context::Impl::start_paragraph(const std::wstring & styleName)
text_.str(std::wstring()); text_.str(std::wstring());
field_value_.str(std::wstring()); field_value_.str(std::wstring());
} }
paragraph_style_name_ = styleName; paragraph_style_name_ = styleName;
in_paragraph = true; in_paragraph = true;
} }
void pptx_text_context::Impl::end_paragraph() void pptx_text_context::Impl::end_paragraph()
...@@ -515,8 +515,7 @@ void pptx_text_context::Impl::dump_run() ...@@ -515,8 +515,7 @@ void pptx_text_context::Impl::dump_run()
//if (content.length() <1 && span_style_name_.length()<1) return ; ... ... //if (content.length() <1 && span_style_name_.length()<1) return ; ... ...
if (content .length() > 0) if (content .length() > 0)
{ {
CP_XML_WRITER(run_) CP_XML_WRITER(run_)
{ {
CP_XML_NODE(L"a:r") CP_XML_NODE(L"a:r")
...@@ -649,7 +648,8 @@ std::wstring pptx_text_context::Impl::current_list_style() ...@@ -649,7 +648,8 @@ std::wstring pptx_text_context::Impl::current_list_style()
std::wstring pptx_text_context::Impl::find_list_rename(const std::wstring & ListStyleName) std::wstring pptx_text_context::Impl::find_list_rename(const std::wstring & ListStyleName)
{ {
std::wstring name = ListStyleName; std::wstring name = ListStyleName;
while (list_style_renames_.count(name) > 0)
while (list_style_renames_.count(name) > 0)
name = list_style_renames_.at(name); name = list_style_renames_.at(name);
return name; return name;
...@@ -658,6 +658,7 @@ std::wstring pptx_text_context::Impl::find_list_rename(const std::wstring & List ...@@ -658,6 +658,7 @@ std::wstring pptx_text_context::Impl::find_list_rename(const std::wstring & List
void pptx_text_context::Impl::end_list_item() void pptx_text_context::Impl::end_list_item()
{ {
dump_paragraph(); dump_paragraph();
paragraphs_cout_--; paragraphs_cout_--;
paragraph_style_name_ = L""; paragraph_style_name_ = L"";
...@@ -723,9 +724,6 @@ void pptx_text_context::Impl::write_list_styles(std::wostream & strm)//defaults ...@@ -723,9 +724,6 @@ void pptx_text_context::Impl::write_list_styles(std::wostream & strm)//defaults
list_style_stack_.clear(); list_style_stack_.clear();
} }
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
pptx_text_context::pptx_text_context(odf_reader::odf_read_context & odf_context_, pptx_conversion_context & pptx_context_): pptx_text_context::pptx_text_context(odf_reader::odf_read_context & odf_context_, pptx_conversion_context & pptx_context_):
......
...@@ -37,10 +37,7 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val ) ...@@ -37,10 +37,7 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val )
CP_XML_NODE(L"a:lstStyle"); CP_XML_NODE(L"a:lstStyle");
if (strTextContent) if (strTextContent)
{ {
CP_XML_NODE(L"a:p") CP_XML_STREAM() << strTextContent.get();
{
CP_XML_STREAM() << strTextContent.get();
}
} }
} }
} }
......
#include "xlsx_num_format_context.h" #include "xlsx_num_format_context.h"
#include "xlsx_complex_number_format.h" #include "xlsx_complex_number_format.h"
#include <sstream> #include <sstream>
#include <map> #include <map>
#include "..\odf\odfcontext.h"
namespace cpdoccore { namespace cpdoccore {
namespace oox { namespace oox {
...@@ -36,7 +40,7 @@ public: ...@@ -36,7 +40,7 @@ public:
bool in_convert_style_; bool in_convert_style_;
}; };
num_format_context::num_format_context(): impl_(new Impl()), impl2_(new Impl2()) num_format_context::num_format_context(odf_reader::odf_read_context & odfContext): odf_context_(odfContext), impl_(new Impl()), impl2_(new Impl2())
{ {
} }
......
#ifndef _CPDOCCORE_XLSX_NUM_FORMAT_CONTEXT_H_ #pragma once
#define _CPDOCCORE_XLSX_NUM_FORMAT_CONTEXT_H_
#include <string> #include <string>
#include <iosfwd> #include <iosfwd>
...@@ -7,12 +6,16 @@ ...@@ -7,12 +6,16 @@
#include <cpdoccore/CPScopedPtr.h> #include <cpdoccore/CPScopedPtr.h>
namespace cpdoccore { namespace cpdoccore {
namespace odf_reader
{
class odf_read_context;
}
namespace oox { namespace oox {
class num_format_context : boost::noncopyable class num_format_context : boost::noncopyable
{ {
public: public:
num_format_context(); num_format_context(odf_reader::odf_read_context & odfContext);
~num_format_context(); ~num_format_context();
public: public:
...@@ -27,7 +30,7 @@ public: ...@@ -27,7 +30,7 @@ public:
void end_complex_format(); void end_complex_format();
//std::wstring default_data_style(int type); //std::wstring default_data_style(int type);
odf_reader::odf_read_context & odf_context_;
private: private:
class Impl; class Impl;
_CP_SCOPED_PTR(Impl) impl_; _CP_SCOPED_PTR(Impl) impl_;
...@@ -38,5 +41,3 @@ private: ...@@ -38,5 +41,3 @@ private:
} }
} }
#endif
...@@ -76,16 +76,20 @@ private: ...@@ -76,16 +76,20 @@ private:
odf_reader::text_format_properties_content * text_properties_cell_; odf_reader::text_format_properties_content * text_properties_cell_;
odf_reader::styles_container * local_styles_ptr_; odf_reader::styles_container * local_styles_ptr_;
std::wstring dump_text(); std::wstring dump_paragraph();
std::wstring dump_run();
void write_rPr(std::wostream & strm); void write_rPr(std::wostream & strm);
void write_pPr(std::wostream & strm); void write_pPr(std::wostream & strm);
size_t paragraphs_cout_; //???? тока из за начала отсчета? size_t paragraphs_cout_; //???? тока из за начала отсчета?
std::wstringstream text_; std::wstringstream text_; //приходящий текст
std::wstringstream output_; std::wstringstream paragraph_; //перманенто скидываемые параграфы
std::wstringstream run_; //перманенто скидываемые куски с быть может разными свойствами
xlsx_shared_strings xlsx_shared_strings_; xlsx_shared_strings xlsx_shared_strings_;
std::wstring paragraph_style_name_;//был вектор ... не нужен, так как в один момент времени может быть тока один стиль параграфа,текста,объекта при приходе нового - дампится std::wstring paragraph_style_name_;//был вектор ... не нужен, так как в один момент времени может быть тока один стиль параграфа,текста,объекта при приходе нового - дампится
std::wstring span_style_name_; std::wstring span_style_name_;
...@@ -108,7 +112,7 @@ void xlsx_text_context::Impl::add_text(const std::wstring & text) ...@@ -108,7 +112,7 @@ void xlsx_text_context::Impl::add_text(const std::wstring & text)
text_ << text; text_ << text;
if (!in_comment && !in_draw) if (!in_comment && !in_draw)
dump_text(); dump_run();
} }
void xlsx_text_context::Impl::set_local_styles_container(odf_reader::styles_container * local_styles_) void xlsx_text_context::Impl::set_local_styles_container(odf_reader::styles_container * local_styles_)
...@@ -120,9 +124,15 @@ void xlsx_text_context::Impl::start_paragraph(const std::wstring & styleName) ...@@ -120,9 +124,15 @@ void xlsx_text_context::Impl::start_paragraph(const std::wstring & styleName)
{ {
if (paragraphs_cout_++ > 0) if (paragraphs_cout_++ > 0)
{ {
if (paragraph_style_name_ != styleName) if ( in_comment == true )
{
// конец предыдущего абзаца и начало следующего
//text_ << L"&#10;";
text_ << L"\n";
}
else/* (paragraph_style_name_ != styleName)*/
{ {
dump_text(); dump_paragraph();
} }
}else }else
{ {
...@@ -136,7 +146,7 @@ void xlsx_text_context::Impl::end_paragraph() ...@@ -136,7 +146,7 @@ void xlsx_text_context::Impl::end_paragraph()
{ {
if (!in_comment && !in_draw) if (!in_comment && !in_draw)
{ {
dump_text(); dump_run();
paragraph_style_name_ = L""; paragraph_style_name_ = L"";
} }
in_paragraph = false; in_paragraph = false;
...@@ -144,27 +154,32 @@ void xlsx_text_context::Impl::end_paragraph() ...@@ -144,27 +154,32 @@ void xlsx_text_context::Impl::end_paragraph()
void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//кусок текста в абзаце(параграфе) со своими свойствами - этто может быть и 1 буква void xlsx_text_context::Impl::start_span(const std::wstring & styleName)//кусок текста в абзаце(параграфе) со своими свойствами - этто может быть и 1 буква
{ {
if (!in_comment && !in_draw) int text_size = text_.str().length();
if (in_comment || in_draw)
{ {
text_.str(std::wstring()); if (( span_style_name_ != styleName && text_size > 0 ) || in_span)
{
dump_run();
}
if (in_draw && !in_paragraph)
start_paragraph(L"");
} }
else else
{ {
if (span_style_name_ !=styleName || in_span) text_.str(std::wstring());
{
dump_text();
}
} }
span_style_name_ = styleName; span_style_name_ = styleName;
in_span=true; in_span = true;
} }
void xlsx_text_context::Impl::end_span() //odf корявенько написан - возможны повторы стилей в последовательных кусках текста void xlsx_text_context::Impl::end_span() //odf корявенько написан - возможны повторы стилей в последовательных кусках текста
//пока с анализом стилей тока комменты - остальные текстовые куски как есть.. с охрененным возможно дубляжом //пока с анализом стилей тока комменты - остальные текстовые куски как есть.. с охрененным возможно дубляжом
{ {
if (!in_comment && !in_draw) if (!in_comment)
{ {
dump_text(); dump_run();
span_style_name_=L""; span_style_name_=L"";
} }
in_span=false; in_span=false;
...@@ -172,21 +187,23 @@ void xlsx_text_context::Impl::end_span() //odf корявенько написа ...@@ -172,21 +187,23 @@ void xlsx_text_context::Impl::end_span() //odf корявенько написа
std::wstring xlsx_text_context::Impl::end_span2() std::wstring xlsx_text_context::Impl::end_span2()
{ {
const std::wstring content = dump_text(); const std::wstring content = dump_run();
span_style_name_ = L""; span_style_name_ = L"";
in_span = false; in_span = false;
return content; return content;
} }
void xlsx_text_context::Impl::start_hyperlink() void xlsx_text_context::Impl::start_hyperlink()
{ {
dump_text(); dump_run();
} }
void xlsx_text_context::Impl::end_hyperlink(std::wstring hId) void xlsx_text_context::Impl::end_hyperlink(std::wstring hId)
{ {
hyperlink_hId = hId; hyperlink_hId = hId;
} }
void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type) void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type)
{ {
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
...@@ -245,23 +262,6 @@ void xlsx_text_context::Impl::write_pPr (std::wostream & strm) ...@@ -245,23 +262,6 @@ void xlsx_text_context::Impl::write_pPr (std::wostream & strm)
ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_ , odf_types::style_family::Paragraph); ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_ , odf_types::style_family::Paragraph);
paragraph_format_properties_.xlsx_convert(strm, in_draw); paragraph_format_properties_.xlsx_convert(strm, in_draw);
//CP_XML_WRITER(strm)
// {
// if (in_draw)
// {
// CP_XML_NODE(L"a:pPr")
// {
// }
// }
// else
// {
// CP_XML_NODE(L"rPr")
// {
// }
// }
//}
} }
void xlsx_text_context::Impl::write_rPr(std::wostream & strm) void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
...@@ -361,17 +361,49 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm) ...@@ -361,17 +361,49 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
} }
} }
std::wstring xlsx_text_context::Impl::dump_text()
std::wstring xlsx_text_context::Impl::dump_paragraph(/*bool last*/)
{
if (!in_draw) return L"";
end_span();
std::wstring str_run = run_.str();
if (str_run.length() > 0 || paragraph_style_name_.length() > 0)
{
CP_XML_WRITER(paragraph_)
{
CP_XML_NODE(L"a:p")
{
write_pPr(CP_XML_STREAM());
if (str_run.length() > 0)
{
CP_XML_STREAM() << run_.str();
}
else
{
CP_XML_NODE(L"a:endParaRPr");
}
}
}
run_.str(std::wstring());
}
return paragraph_.str();
}
std::wstring xlsx_text_context::Impl::dump_run()
{ {
const std::wstring content = xml::utils::replace_text_to_xml(text_.str()); const std::wstring content = xml::utils::replace_text_to_xml(text_.str());
if (content.length()<1) if (content.length()<1)
return content; return L"";
std::wstring prefix_draw; std::wstring prefix_draw;
if (in_draw) prefix_draw=L"a:"; if (in_draw) prefix_draw=L"a:";
CP_XML_WRITER(output_) CP_XML_WRITER(run_)
{ {
if (!content.empty()) if (!content.empty())
{ {
...@@ -398,81 +430,81 @@ void xlsx_text_context::Impl::start_cell_content() ...@@ -398,81 +430,81 @@ void xlsx_text_context::Impl::start_cell_content()
paragraphs_cout_ = 0; paragraphs_cout_ = 0;
local_styles_ptr_ =NULL; local_styles_ptr_ =NULL;
output_.str(std::wstring());//строка дампа run_.str(std::wstring());
paragraph_.str(std::wstring());
text_.str(std::wstring()); //приходящие куски текста text_.str(std::wstring());
paragraph_style_name_ = L""; paragraph_style_name_ = L"";
span_style_name_ = L""; span_style_name_ = L"";
in_cell_content = true; in_cell_content = true;
text_properties_cell_ = NULL; text_properties_cell_ = NULL;
} }
void xlsx_text_context::Impl::start_comment_content() void xlsx_text_context::Impl::start_comment_content()
{ {
paragraphs_cout_ = 0; paragraphs_cout_ = 0;
output_.str(std::wstring()); run_.str(std::wstring());
paragraph_.str(std::wstring());
text_.str(std::wstring()); text_.str(std::wstring());
paragraph_style_name_ = L""; paragraph_style_name_ = L"";
span_style_name_ = L""; span_style_name_ = L"";
in_comment = true; in_comment = true;
} }
void xlsx_text_context::Impl::start_drawing_content() void xlsx_text_context::Impl::start_drawing_content()
{ {
paragraphs_cout_ = 0; paragraphs_cout_ = 0;
output_.str(std::wstring()); run_.str(std::wstring());
paragraph_.str(std::wstring());
text_.str(std::wstring()); text_.str(std::wstring());
paragraph_style_name_ = L""; paragraph_style_name_ = L"";
span_style_name_ = L""; span_style_name_ = L"";
in_draw = true; in_draw = true;
} }
std::wstring xlsx_text_context::Impl::end_comment_content() std::wstring xlsx_text_context::Impl::end_comment_content()
{ {
dump_text();//если в комменте куча абзацев со одним стилем - сдампится здесь - иначе дампится по мере прихода каждого нового стиля dump_run();//если в комменте куча абзацев со одним стилем - сдампится здесь - иначе дампится по мере прихода каждого нового стиля
std::wstring comment= output_.str(); std::wstring comment= run_.str();
paragraphs_cout_ = 0; paragraphs_cout_ = 0;
output_.str(std::wstring()); paragraph_style_name_ = L"";
text_.str(std::wstring()); span_style_name_ = L"";
paragraph_style_name_ = L"";
span_style_name_=L"";
in_comment = false; in_comment = false;
return comment; return comment;
} }
std::wstring xlsx_text_context::Impl::end_drawing_content() std::wstring xlsx_text_context::Impl::end_drawing_content()
{ {
dump_text();//если в draw куча абзацев со одним стилем - сдампится здесь - иначе дампится по мере прихода каждого нового стиля dump_paragraph();//если в draw куча абзацев со одним стилем - сдампится здесь - иначе дампится по мере прихода каждого нового стиля
std::wstring draw= output_.str(); std::wstring draw = paragraph_.str();
paragraphs_cout_ = 0; paragraphs_cout_ = 0;
output_.str(std::wstring());
text_.str(std::wstring());
paragraph_style_name_ = L""; run_.str(std::wstring());
span_style_name_=L""; paragraph_.str(std::wstring());
text_.str(std::wstring());
paragraph_style_name_ = L"";
span_style_name_ = L"";
in_draw = false; in_draw = false;
return draw; return draw;
} }
int xlsx_text_context::Impl::end_cell_content() int xlsx_text_context::Impl::end_cell_content()
{ {
dump_text(); dump_run();
const int sharedStrId = output_.str().empty() ? (-1) : static_cast<int>(xlsx_shared_strings_.add(output_.str())); const int sharedStrId = run_.str().empty() ? (-1) : static_cast<int>(xlsx_shared_strings_.add(run_.str()));
//???? нужно ли здесь очищать все ????? - проверить стили на кучках - и проверить как меняются стили внутри одной ячейки - то есть здешнее переопределение внешнего стиля //???? нужно ли здесь очищать все ????? - проверить стили на кучках - и проверить как меняются стили внутри одной ячейки - то есть здешнее переопределение внешнего стиля
in_cell_content = false; in_cell_content = false;
return sharedStrId; return sharedStrId;
......
...@@ -32,6 +32,7 @@ namespace package ...@@ -32,6 +32,7 @@ namespace package
xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfDocument) : xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfDocument) :
odf_document_ (odfDocument), odf_document_ (odfDocument),
output_document_ (NULL), output_document_ (NULL),
num_format_context_ (odf_document_->odf_context()),
xlsx_text_context_ (odf_document_->odf_context().styleContainer()), xlsx_text_context_ (odf_document_->odf_context().styleContainer()),
xlsx_table_context_ (this, xlsx_text_context_), xlsx_table_context_ (this, xlsx_text_context_),
......
#include "../docx/xlsx_textcontext.h" #include "../docx/xlsx_textcontext.h"
#include "../docx/xlsx_num_format_context.h"
#include "serialize_elements.h" #include "serialize_elements.h"
#include <cpdoccore/odf/odf_document.h> #include <cpdoccore/odf/odf_document.h>
#include "../formulasconvert/formulasconvert.h" #include "../formulasconvert/formulasconvert.h"
#include "style_graphic_properties.h" #include "style_graphic_properties.h"
...@@ -15,6 +13,7 @@ ...@@ -15,6 +13,7 @@
#include "draw_common.h" #include "draw_common.h"
#include "number_style.h"
#include "calcs_styles.h" #include "calcs_styles.h"
#include "chart_build_oox.h" #include "chart_build_oox.h"
...@@ -311,34 +310,46 @@ void chart_build::oox_convert(oox::oox_chart_context & chart_context) ...@@ -311,34 +310,46 @@ void chart_build::oox_convert(oox::oox_chart_context & chart_context)
if (categories_.size() >0) if (categories_.size() >0)
calc_cache_series (categories_[0], cat_cash); calc_cache_series (categories_[0], cat_cash);
std::wstring formatCode = L"General";
_CP_OPT(std::wstring) strVal;
_CP_OPT(bool) boolVal;
odf_reader::GetProperty(s.properties_, L"num_format", strVal);
odf_reader::GetProperty(s.properties_, L"link-data-style-to-source", boolVal);
if ((strVal) && (strVal->length() > 1))
{
formatCode = *strVal;
}
if (domain_cell_range_adress_.empty() == false) if (domain_cell_range_adress_.empty() == false)
{ {
if (last_set_type == chart_bubble) if (last_set_type == chart_bubble)
{ { //bubble(x)
current->set_formula_series(4, domain_cell_range_adress_); //bubble(x) current->set_formula_series(4, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (4, domain_cash); //bubble(x) current->set_values_series (4, domain_cash);
//y
current->set_formula_series(3, s.cell_range_address_); //y current->set_formula_series(3, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series (3, cell_cash); current->set_values_series (3, cell_cash);
} }
else else
{ { //x
current->set_formula_series(2, domain_cell_range_adress_); //x current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (2, domain_cash); //x current->set_values_series (2, domain_cash);
//y
current->set_formula_series(3, s.cell_range_address_); //y current->set_formula_series(3, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series (3, cell_cash); //y current->set_values_series (3, cell_cash);
} }
} }
else else
{ { //common
current->set_formula_series(1, s.cell_range_address_); //common current->set_formula_series(1, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series(1, cell_cash); //common current->set_values_series(1, cell_cash);
} }
if (categories_.empty() == false)// if (categories_.empty() == false)//
{ {
current->set_formula_series(0, categories_[0]); current->set_formula_series(0, categories_[0], L"General", true);
current->set_values_series(0, cat_cash); current->set_values_series(0, cat_cash);
} }
current->set_name(s.name_); current->set_name(s.name_);
...@@ -397,11 +408,13 @@ void chart_build::oox_convert(oox::oox_chart_context & chart_context) ...@@ -397,11 +408,13 @@ void chart_build::oox_convert(oox::oox_chart_context & chart_context)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
process_build_chart::process_build_chart(chart_build & chartBuild, odf_read_context & context) : process_build_chart::process_build_chart(chart_build & chartBuild, odf_read_context & context) :
stop_ (false) stop_ (false)
,chart_build_ (chartBuild) ,chart_build_ (chartBuild)
,styles_ (context.styleContainer()) ,styles_ (context.styleContainer())
,settings_ (context.Settings()) ,settings_ (context.Settings())
,draw_styles_ (context.drawStyles()) ,draw_styles_ (context.drawStyles())
,number_styles_ (context.numberStyles())
,num_format_context_(context)
{ {
office_element_ptr sett_elm = settings_.find_by_style_name(L"BaseFontHeight"); office_element_ptr sett_elm = settings_.find_by_style_name(L"BaseFontHeight");
settings_config_item* sett = dynamic_cast<settings_config_item*>(sett_elm.get()); settings_config_item* sett = dynamic_cast<settings_config_item*>(sett_elm.get());
...@@ -416,13 +429,33 @@ process_build_chart::process_build_chart(chart_build & chartBuild, odf_read_cont ...@@ -416,13 +429,33 @@ process_build_chart::process_build_chart(chart_build & chartBuild, odf_read_cont
} }
} }
} }
void process_build_chart::ApplyChartProperties(std::wstring style,std::vector<_property> & propertiesOut) void process_build_chart::ApplyChartProperties(std::wstring style, std::vector<_property> & propertiesOut)
{ {
style_instance* styleInst = styles_.style_by_name(style, odf_types::style_family::Chart,false); style_instance* styleInst = styles_.style_by_name(style, odf_types::style_family::Chart, false);
if(styleInst) if(styleInst)
{ {
const style_content * Content = styleInst->content(); const style_content * Content = styleInst->content();
const style_chart_properties *properties = Content->get_style_chart_properties(); const style_chart_properties *properties = Content->get_style_chart_properties();
std::wstring data_style_name = styleInst->data_style_name();
if (!data_style_name.empty())
{
office_element_ptr elm = number_styles_.find_by_style_name(data_style_name);
number_style_base *number_style = dynamic_cast<number_style_base*>(elm.get());
if (number_style)
{
num_format_context_.start_complex_format();
number_style->oox_convert(num_format_context_);
num_format_context_.end_complex_format();
std::wstring num_format = num_format_context_.get_last_format();
_property p(L"num_format", num_format);
propertiesOut.push_back(p);
}
}
if (!properties)return; if (!properties)return;
...@@ -434,7 +467,7 @@ void process_build_chart::ApplyChartProperties(std::wstring style,std::vector<_p ...@@ -434,7 +467,7 @@ void process_build_chart::ApplyChartProperties(std::wstring style,std::vector<_p
} }
void process_build_chart::ApplyTextProperties(std::wstring style,std::vector<_property> & propertiesOut) void process_build_chart::ApplyTextProperties(std::wstring style,std::vector<_property> & propertiesOut)
{ {
style_instance* styleInst = styles_.style_by_name(style, odf_types::style_family::Chart,false/*Context.process_headers_footers_*/); style_instance* styleInst = styles_.style_by_name(style, odf_types::style_family::Chart, false/*Context.process_headers_footers_*/);
if(styleInst) if(styleInst)
{ {
text_format_properties_content properties = calc_text_properties_content(styleInst); text_format_properties_content properties = calc_text_properties_content(styleInst);
...@@ -611,9 +644,11 @@ void process_build_chart::visit(const chart_axis& val) ...@@ -611,9 +644,11 @@ void process_build_chart::visit(const chart_axis& val)
ACCEPT_ALL_CONTENT_CONST(val.content_); ACCEPT_ALL_CONTENT_CONST(val.content_);
ApplyChartProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().properties_); std::wstring style_name = val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L"");
ApplyGraphicProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().graphic_properties_,chart_build_.axises_.back().fill_);
ApplyTextProperties (val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L""),chart_build_.axises_.back().text_properties_); ApplyChartProperties (style_name, chart_build_.axises_.back().properties_);
ApplyGraphicProperties (style_name, chart_build_.axises_.back().graphic_properties_, chart_build_.axises_.back().fill_);
ApplyTextProperties (style_name, chart_build_.axises_.back().text_properties_);
chart_build_.end_axis(); chart_build_.end_axis();
} }
......
...@@ -299,10 +299,12 @@ private: ...@@ -299,10 +299,12 @@ private:
chart_build & chart_build_; chart_build & chart_build_;
styles_container & styles_; styles_container & styles_;
styles_lite_container & settings_; styles_lite_container & settings_;
styles_lite_container & draw_styles_; styles_lite_container & draw_styles_;
styles_lite_container & number_styles_;
oox::num_format_context num_format_context_;
}; };
......
...@@ -34,16 +34,17 @@ public: ...@@ -34,16 +34,17 @@ public:
}; };
/// \class style_header_footer_properties // style:header-footer-properties
/// style-header-footer-properties
class style_header_footer_properties : public office_element_impl<style_header_footer_properties> class style_header_footer_properties : public office_element_impl<style_header_footer_properties>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleHeaderFooterProperties; static const xml::NodeType xml_type = xml::typeElement;
CPDOCCORE_DEFINE_VISITABLE(); static const ElementType type = typeStyleHeaderFooterProperties;
CPDOCCORE_DEFINE_VISITABLE();
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#include "number_style.h" #include "number_style.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "odfcontext.h"
#include <cpdoccore/odf/odf_document.h> #include <cpdoccore/odf/odf_document.h>
#include <cpdoccore/xml/xmlchar.h> #include <cpdoccore/xml/xmlchar.h>
...@@ -30,13 +29,13 @@ std::wstring number_style_base::get_style_name() const ...@@ -30,13 +29,13 @@ std::wstring number_style_base::get_style_name() const
return L""; return L"";
} }
void number_style_base::xlsx_convert_impl(oox::xlsx_conversion_context & Context) void number_style_base::oox_convert_impl(oox::num_format_context & Context)
{ {
std::wstring style_name = L""; std::wstring style_name = L"";
if (common_data_style_attlist_.style_name_) if (common_data_style_attlist_.style_name_)
style_name = common_data_style_attlist_.style_name_->style_name(); style_name = common_data_style_attlist_.style_name_->style_name();
Context.get_num_format_context().start_format(style_name); Context.start_format(style_name);
if (style_text_properties_) if (style_text_properties_)
{ {
...@@ -47,7 +46,7 @@ void number_style_base::xlsx_convert_impl(oox::xlsx_conversion_context & Context ...@@ -47,7 +46,7 @@ void number_style_base::xlsx_convert_impl(oox::xlsx_conversion_context & Context
int r = 0, g = 0, b = 0; int r = 0, g = 0, b = 0;
if (HEXStringToRGB(textProp->content().fo_color_->get_hex_value(), r, g, b)) if (HEXStringToRGB(textProp->content().fo_color_->get_hex_value(), r, g, b))
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
strm << L"[" << RGBToString(r, g, b) << L"]"; strm << L"[" << RGBToString(r, g, b) << L"]";
} }
} }
...@@ -56,12 +55,16 @@ void number_style_base::xlsx_convert_impl(oox::xlsx_conversion_context & Context ...@@ -56,12 +55,16 @@ void number_style_base::xlsx_convert_impl(oox::xlsx_conversion_context & Context
BOOST_FOREACH(const office_element_ptr & elm, content_) BOOST_FOREACH(const office_element_ptr & elm, content_)
{ {
elm->xlsx_convert(Context); number_style_base *number_style_ = dynamic_cast<number_style_base *> (elm.get());
number_element *number_element_ = dynamic_cast<number_element *> (elm.get());
if (number_style_) number_style_->oox_convert(Context);
if (number_element_) number_element_->oox_convert(Context);
} }
Context.get_num_format_context().end_format(); Context.end_format();
} }
void number_style_base::xlsx_convert(oox::xlsx_conversion_context & Context) void number_style_base::oox_convert(oox::num_format_context & Context)
{ {
if (!style_map_.empty()) if (!style_map_.empty())
{ {
...@@ -69,30 +72,63 @@ void number_style_base::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -69,30 +72,63 @@ void number_style_base::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
if (const style_map * styleMap = dynamic_cast<const style_map *>(elm.get())) if (const style_map * styleMap = dynamic_cast<const style_map *>(elm.get()))
{ {
const std::wstring applyStyleName = styleMap->style_apply_style_name_.style_name(); const std::wstring applyStyleName = styleMap->style_apply_style_name_.style_name();
const std::wstring condition = styleMap->style_condition_; const std::wstring condition = styleMap->style_condition_;
odf_read_context & odfContext = Context.root()->odf_context(); if (office_element_ptr num_style = Context.odf_context_.numberStyles().find_by_style_name(applyStyleName))
if (office_element_ptr num_style = odfContext.numberStyles().find_by_style_name(applyStyleName))
{ {
if (number_style_base * concrete_num_style = dynamic_cast<number_style_base *>(num_style.get())) if (number_style_base * concrete_num_style = dynamic_cast<number_style_base *>(num_style.get()))
{ {
concrete_num_style->xlsx_convert_impl(Context); concrete_num_style->oox_convert_impl(Context);
const std::wstring num_format = Context.get_num_format_context().get_last_format(); const std::wstring num_format = Context.get_last_format();
Context.get_num_format_context().add_format(condition, num_format); Context.add_format(condition, num_format);
} }
} }
} }
} }
} }
this->xlsx_convert_impl(Context); oox_convert_impl(Context);
const std::wstring num_format = Context.get_num_format_context().get_last_format(); const std::wstring num_format = Context.get_last_format();
Context.get_num_format_context().add_format(L"", num_format); Context.add_format(L"", num_format);
} }
//void number_style_base::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// if (!style_map_.empty())
// {
// BOOST_FOREACH(const office_element_ptr & elm, style_map_)
// {
// if (const style_map * styleMap = dynamic_cast<const style_map *>(elm.get()))
// {
// const std::wstring applyStyleName = styleMap->style_apply_style_name_.style_name();
// const std::wstring condition = styleMap->style_condition_;
//
// odf_read_context & odfContext = Context.root()->odf_context();
//
// if (office_element_ptr num_style = odfContext.numberStyles().find_by_style_name(applyStyleName))
// {
// if (number_style_base * concrete_num_style = dynamic_cast<number_style_base *>(num_style.get()))
// {
// concrete_num_style->oox_convert_impl(Context.get_num_format_context());
//
// const std::wstring num_format = Context.get_num_format_context().get_last_format();
// Context.get_num_format_context().add_format(condition, num_format);
// }
// }
// }
// }
// }
//
// this->oox_convert_impl(Context);
// const std::wstring num_format = Context.get_num_format_context().get_last_format();
// Context.get_num_format_context().add_format(L"", num_format);
//
//}
//
void number_style_base::add_attributes( const xml::attributes_wc_ptr & Attributes ) void number_style_base::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
common_data_style_attlist_.add_attributes(Attributes); common_data_style_attlist_.add_attributes(Attributes);
...@@ -124,7 +160,9 @@ void number_style_base::add_child_element( xml::sax * Reader, const ::std::wstri ...@@ -124,7 +160,9 @@ void number_style_base::add_child_element( xml::sax * Reader, const ::std::wstri
CP_CREATE_ELEMENT(content_); CP_CREATE_ELEMENT(content_);
} }
} }
void number_style_base::add_text(const std::wstring & Text)
{
}
// number:number-style // number:number-style
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_number_style::ns = L"number"; const wchar_t * number_number_style::ns = L"number";
...@@ -170,7 +208,9 @@ void number_embedded_text::add_text(const std::wstring & Text) ...@@ -170,7 +208,9 @@ void number_embedded_text::add_text(const std::wstring & Text)
office_element_ptr elm = text::text::create(Text) ; office_element_ptr elm = text::text::create(Text) ;
text_.push_back( elm ); text_.push_back( elm );
} }
void number_embedded_text::oox_convert(oox::num_format_context & Context)
{
}
// number:number // number:number
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_number::ns = L"number"; const wchar_t * number_number::ns = L"number";
...@@ -241,9 +281,9 @@ void number_currency_symbol::add_text(const std::wstring & Text) ...@@ -241,9 +281,9 @@ void number_currency_symbol::add_text(const std::wstring & Text)
text_.push_back(Text); text_.push_back(Text);
} }
void number_currency_symbol::xlsx_convert(oox::xlsx_conversion_context & Context) void number_currency_symbol::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
strm << L"[$";//xml::utils::replace_text_to_xml(L"\""); strm << L"[$";//xml::utils::replace_text_to_xml(L"\"");
BOOST_FOREACH(const std::wstring & t, text_) BOOST_FOREACH(const std::wstring & t, text_)
{ {
...@@ -278,6 +318,10 @@ void number_text_content::add_text(const std::wstring & Text) ...@@ -278,6 +318,10 @@ void number_text_content::add_text(const std::wstring & Text)
text_.push_back( elm ); text_.push_back( elm );
} }
void number_text_content::oox_convert(oox::num_format_context & Context)
{
}
// number:text-style // number:text-style
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_text_style::ns = L"number"; const wchar_t * number_text_style::ns = L"number";
...@@ -325,9 +369,9 @@ void format_number_number( ...@@ -325,9 +369,9 @@ void format_number_number(
} }
} }
void number_number::xlsx_convert(oox::xlsx_conversion_context & Context) void number_number::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
format_number_number( format_number_number(
strm, strm,
...@@ -337,9 +381,9 @@ void number_number::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -337,9 +381,9 @@ void number_number::xlsx_convert(oox::xlsx_conversion_context & Context)
); );
} }
void number_text::xlsx_convert(oox::xlsx_conversion_context & Context) void number_text::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
BOOST_FOREACH(const office_element_ptr & elm, text_) BOOST_FOREACH(const office_element_ptr & elm, text_)
{ {
...@@ -363,10 +407,12 @@ void number_day::add_child_element( xml::sax * Reader, const ::std::wstring & Ns ...@@ -363,10 +407,12 @@ void number_day::add_child_element( xml::sax * Reader, const ::std::wstring & Ns
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_day::add_text(const std::wstring & Text)
void number_day::xlsx_convert(oox::xlsx_conversion_context & Context) {
}
void number_day::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
if (number_style_.get_value_or(L"short") == L"long") if (number_style_.get_value_or(L"short") == L"long")
{ {
strm << L"DD"; strm << L"DD";
...@@ -393,10 +439,13 @@ void number_day_of_week::add_child_element( xml::sax * Reader, const ::std::wstr ...@@ -393,10 +439,13 @@ void number_day_of_week::add_child_element( xml::sax * Reader, const ::std::wstr
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_day_of_week::add_text(const std::wstring & Text)
{
}
void number_day_of_week::xlsx_convert(oox::xlsx_conversion_context & Context) void number_day_of_week::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
if (number_style_.get_value_or(L"short") == L"long") if (number_style_.get_value_or(L"short") == L"long")
{ {
strm << L"DDDD"; strm << L"DDDD";
...@@ -423,9 +472,13 @@ void number_quarter::add_child_element( xml::sax * Reader, const ::std::wstring ...@@ -423,9 +472,13 @@ void number_quarter::add_child_element( xml::sax * Reader, const ::std::wstring
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_quarter::xlsx_convert(oox::xlsx_conversion_context & Context) void number_quarter::add_text(const std::wstring & Text)
{ {
std::wostream & strm = Context.get_num_format_context().output(); }
void number_quarter::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
if (number_style_.get_value_or(L"short") == L"long") if (number_style_.get_value_or(L"short") == L"long")
{ {
// TODO: ?? // TODO: ??
...@@ -455,10 +508,12 @@ void number_month::add_child_element( xml::sax * Reader, const ::std::wstring & ...@@ -455,10 +508,12 @@ void number_month::add_child_element( xml::sax * Reader, const ::std::wstring &
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_month::add_text(const std::wstring & Text)
void number_month::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); }
void number_month::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
if (!number_textual_.get_value_or(false)) if (!number_textual_.get_value_or(false))
{ {
if (number_style_.get_value_or(L"short") == L"long") if (number_style_.get_value_or(L"short") == L"long")
...@@ -498,10 +553,12 @@ void number_year::add_child_element( xml::sax * Reader, const ::std::wstring & N ...@@ -498,10 +553,12 @@ void number_year::add_child_element( xml::sax * Reader, const ::std::wstring & N
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_year::add_text(const std::wstring & Text)
void number_year::xlsx_convert(oox::xlsx_conversion_context & Context) {
}
void number_year::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
if (number_style_.get_value_or(L"short") == L"long") if (number_style_.get_value_or(L"short") == L"long")
{ {
strm << L"YYYY"; strm << L"YYYY";
...@@ -537,10 +594,13 @@ void number_hours::add_child_element( xml::sax * Reader, const ::std::wstring & ...@@ -537,10 +594,13 @@ void number_hours::add_child_element( xml::sax * Reader, const ::std::wstring &
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_hours::add_text(const std::wstring & Text)
{
}
void number_hours::xlsx_convert(oox::xlsx_conversion_context & Context) void number_hours::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
if (number_style_.get_value_or(L"short") == L"long") if (number_style_.get_value_or(L"short") == L"long")
{ {
strm << L"HH"; strm << L"HH";
...@@ -567,10 +627,12 @@ void number_minutes::add_child_element( xml::sax * Reader, const ::std::wstring ...@@ -567,10 +627,12 @@ void number_minutes::add_child_element( xml::sax * Reader, const ::std::wstring
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_minutes::add_text(const std::wstring & Text)
void number_minutes::xlsx_convert(oox::xlsx_conversion_context & Context) {
}
void number_minutes::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
if (number_style_.get_value_or(L"short") == L"long") if (number_style_.get_value_or(L"short") == L"long")
{ {
strm << L"MM"; strm << L"MM";
...@@ -598,10 +660,12 @@ void number_seconds::add_child_element( xml::sax * Reader, const ::std::wstring ...@@ -598,10 +660,12 @@ void number_seconds::add_child_element( xml::sax * Reader, const ::std::wstring
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_seconds::add_text(const std::wstring & Text)
void number_seconds::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); }
void number_seconds::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
if (number_style_.get_value_or(L"short") == L"long") if (number_style_.get_value_or(L"short") == L"long")
{ {
strm << L"SS"; strm << L"SS";
...@@ -632,17 +696,19 @@ void number_am_pm::add_child_element( xml::sax * Reader, const ::std::wstring & ...@@ -632,17 +696,19 @@ void number_am_pm::add_child_element( xml::sax * Reader, const ::std::wstring &
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_am_pm::add_text(const std::wstring & Text)
void number_am_pm::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); }
void number_am_pm::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
strm << L"AM/PM"; strm << L"AM/PM";
} }
// number:fraction // number:fraction
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_fraction::ns = L"number"; const wchar_t * number_fraction::ns = L"number";
const wchar_t * number_fraction::name = L"fraction"; const wchar_t * number_fraction::name = L"fraction";
void number_fraction::add_attributes( const xml::attributes_wc_ptr & Attributes ) void number_fraction::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
...@@ -658,10 +724,12 @@ void number_fraction::add_child_element( xml::sax * Reader, const ::std::wstring ...@@ -658,10 +724,12 @@ void number_fraction::add_child_element( xml::sax * Reader, const ::std::wstring
{ {
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void number_fraction::add_text(const std::wstring & Text)
void number_fraction::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); }
void number_fraction::oox_convert(oox::num_format_context & Context)
{
std::wostream & strm = Context.output();
format_number_number(strm, format_number_number(strm,
number_grouping_.get_value_or(false), number_grouping_.get_value_or(false),
...@@ -682,9 +750,13 @@ void number_fraction::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -682,9 +750,13 @@ void number_fraction::xlsx_convert(oox::xlsx_conversion_context & Context)
} }
} }
void number_scientific_number::xlsx_convert(oox::xlsx_conversion_context & Context) void number_scientific_number::add_text(const std::wstring & Text)
{
}
void number_scientific_number::oox_convert(oox::num_format_context & Context)
{ {
std::wostream & strm = Context.get_num_format_context().output(); std::wostream & strm = Context.output();
format_number_number( format_number_number(
strm, strm,
number_grouping_.get_value_or(false), number_grouping_.get_value_or(false),
......
...@@ -5,101 +5,100 @@ ...@@ -5,101 +5,100 @@
#include <cpdoccore/xml/xmlelement.h> #include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h> #include <cpdoccore/xml/nodetype.h>
#include "odfcontext.h"
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
#include "datatypes/common_attlists.h" #include "datatypes/common_attlists.h"
namespace cpdoccore { namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
class number_style_base : public office_element class number_style_base : public office_element
{ {
public: public:
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ; virtual void oox_convert (oox::num_format_context & Context) ;
void xlsx_convert_impl(oox::xlsx_conversion_context & Context); void oox_convert_impl (oox::num_format_context & Context);
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
std::wstring get_style_name() const;
private: private:
virtual void add_text(const std::wstring &) {} virtual void add_text(const std::wstring &);
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: odf_types::common_data_style_attlist common_data_style_attlist_;
std::wstring get_style_name() const;
private:
odf_types::common_data_style_attlist common_data_style_attlist_;
office_element_ptr style_text_properties_; office_element_ptr style_text_properties_;
office_element_ptr_array content_; office_element_ptr_array content_;
office_element_ptr_array style_map_; office_element_ptr_array style_map_;
}; };
/// \class number_number_style // number:number-style
/// \brief number:number-style
/// number-number-style
class number_number_style : public number_style_base class number_number_style : public number_style_base
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberNumberStyle; static const ElementType type = typeNumberNumberStyle;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_; CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_number_style); CP_REGISTER_OFFICE_ELEMENT2(number_number_style);
/// \class number_currency_style // number:currency-style
/// \brief number:currency-style
/// number-currency-style
class number_currency_style : public number_style_base class number_currency_style : public number_style_base
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberCurrencyStyle; static const ElementType type = typeNumberCurrencyStyle;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_; CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_currency_style); CP_REGISTER_OFFICE_ELEMENT2(number_currency_style);
/// \class number_text_style // number:text-style
/// \brief number:text-style
/// number-text-style
class number_text_style : public number_style_base class number_text_style : public number_style_base
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberTextStyle; static const ElementType type = typeNumberTextStyle;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_; CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_text_style); CP_REGISTER_OFFICE_ELEMENT2(number_text_style);
/// \class number_date_style // number:date-style
/// \brief number:date-style
/// number-date-style
class number_date_style : public number_style_base class number_date_style : public number_style_base
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberDataStyle; static const ElementType type = typeNumberDataStyle;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_; CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
...@@ -108,94 +107,104 @@ public: ...@@ -108,94 +107,104 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(number_date_style); CP_REGISTER_OFFICE_ELEMENT2(number_date_style);
/// \class number_percentage_style // number:percentage-style
/// \brief number:percentage-style
/// number-percentage-style
class number_percentage_style : public number_style_base class number_percentage_style : public number_style_base
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberPercentageStyle; static const ElementType type = typeNumberPercentageStyle;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_; CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_percentage_style); CP_REGISTER_OFFICE_ELEMENT2(number_percentage_style);
/// \class number_time_style // number:time-style
/// \brief number:time-style
/// number-time-style
class number_time_style : public number_style_base class number_time_style : public number_style_base
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberTimeStyle; static const ElementType type = typeNumberTimeStyle;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_; CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(bool) number_automatic_order_; _CP_OPT(bool) number_automatic_order_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_time_style); CP_REGISTER_OFFICE_ELEMENT2(number_time_style);
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////// class number_element : public office_element
//////////////////////////////////////////////////////////////////////////////////////// {
public:
virtual void oox_convert (oox::num_format_context & Context) = 0;
CPDOCCORE_DEFINE_VISITABLE();
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes ) = 0;
virtual void add_text (const std::wstring &) = 0;
virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name) = 0;
/// \class number_text };
/// \brief number:text
/// number-text // number:text
class number_text : public office_element_impl<number_text> class number_text : public number_element
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberText; static const ElementType type = typeNumberText;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
public: virtual void oox_convert(oox::num_format_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text); virtual void add_text (const std::wstring & Text);
private:
office_element_ptr_array text_; office_element_ptr_array text_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_text); CP_REGISTER_OFFICE_ELEMENT2(number_text);
/// \class number_number // number:number
/// \brief number:number class number_number : public number_element
/// number-number
class number_number : public office_element_impl<number_number>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberNumber; static const ElementType type = typeNumberNumber;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
public: virtual void oox_convert(oox::num_format_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element(xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text); virtual void add_text (const std::wstring & Text);
private:
// number-number-attlist // number-number-attlist
_CP_OPT(std::wstring) number_decimal_replacement_; _CP_OPT(std::wstring) number_decimal_replacement_;
_CP_OPT(double) number_display_factor_; _CP_OPT(double) number_display_factor_;
...@@ -213,49 +222,51 @@ private: ...@@ -213,49 +222,51 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(number_number); CP_REGISTER_OFFICE_ELEMENT2(number_number);
/// \class number_embedded_text // number:embedded-text
/// \brief number:embedded-text class number_embedded_text : public number_element
/// number-embedded-text
class number_embedded_text : public office_element_impl<number_embedded_text>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberEmbeddedText; static const ElementType type = typeNumberEmbeddedText;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void oox_convert(oox::num_format_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text); virtual void add_text (const std::wstring & Text);
private: _CP_OPT(int) number_position_;
_CP_OPT(int) number_position_;
office_element_ptr_array text_; office_element_ptr_array text_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_embedded_text); CP_REGISTER_OFFICE_ELEMENT2(number_embedded_text);
/// \class number_scientific_number // number:scientific-number
/// \brief number:scientific-number class number_scientific_number : public number_element
/// number-scientific-number
class number_scientific_number : public office_element_impl<number_scientific_number>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberScientificNumber; static const ElementType type = typeNumberScientificNumber;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void oox_convert(oox::num_format_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
public:
void xlsx_convert(oox::xlsx_conversion_context & Context);
private: private:
// number-scientific-number-attlist // number-scientific-number-attlist
...@@ -272,26 +283,26 @@ private: ...@@ -272,26 +283,26 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(number_scientific_number); CP_REGISTER_OFFICE_ELEMENT2(number_scientific_number);
/// \class number_currency_symbol // number:currency-symbol
/// \brief number:currency-symbol class number_currency_symbol : public number_element
/// number-currency-symbol
class number_currency_symbol : public office_element_impl<number_currency_symbol>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberCurrencySymbol; static const ElementType type = typeNumberCurrencySymbol;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
void xlsx_convert(oox::xlsx_conversion_context & Context); virtual void oox_convert(oox::num_format_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text); virtual void add_text (const std::wstring & Text);
private:
_CP_OPT(std::wstring) number_language_; _CP_OPT(std::wstring) number_language_;
_CP_OPT(std::wstring) number_country_; _CP_OPT(std::wstring) number_country_;
...@@ -301,77 +312,79 @@ private: ...@@ -301,77 +312,79 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(number_currency_symbol); CP_REGISTER_OFFICE_ELEMENT2(number_currency_symbol);
/// \class number_text_content // number:text-content
/// \brief number:text-content class number_text_content : public number_element
/// number-text-content
class number_text_content : public office_element_impl<number_text_content>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberTextContent; static const xml::NodeType xml_type = xml::typeElement;
CPDOCCORE_DEFINE_VISITABLE(); static const ElementType type = typeNumberTextContent;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
private: virtual void oox_convert(oox::num_format_context & Context);
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text);
private: private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
office_element_ptr_array text_; office_element_ptr_array text_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_text_content); CP_REGISTER_OFFICE_ELEMENT2(number_text_content);
/// \class number_day_of_week // number:day-of-week
/// \brief number:day-of-week class number_day_of_week : public number_element
/// number-day-of-week
class number_day_of_week : public office_element_impl<number_day_of_week>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberDayOfWeek; static const xml::NodeType xml_type = xml::typeElement;
CPDOCCORE_DEFINE_VISITABLE(); static const ElementType type = typeNumberDayOfWeek;
private: CPDOCCORE_DEFINE_VISITABLE();
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: virtual void oox_convert(oox::num_format_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
private: private:
_CP_OPT(std::wstring) number_style_; virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_; _CP_OPT(std::wstring) number_calendar_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_day_of_week); CP_REGISTER_OFFICE_ELEMENT2(number_day_of_week);
/// \class number_quarter // number:quarter
/// \brief number:quarter class number_quarter : public number_element
/// number-quarter
class number_quarter : public office_element_impl<number_quarter>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberQuarter;
CPDOCCORE_DEFINE_VISITABLE();
private: static const xml::NodeType xml_type = xml::typeElement;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); static const ElementType type = typeNumberQuarter;
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
public: virtual void oox_convert(oox::num_format_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
private: private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
_CP_OPT(std::wstring) number_style_; _CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_; _CP_OPT(std::wstring) number_calendar_;
...@@ -380,26 +393,25 @@ private: ...@@ -380,26 +393,25 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(number_quarter); CP_REGISTER_OFFICE_ELEMENT2(number_quarter);
/// \class number_day // number:day
/// \brief number:day class number_day : public number_element
/// number-day
class number_day : public office_element_impl<number_day>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberDay;
CPDOCCORE_DEFINE_VISITABLE();
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberDay;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void oox_convert(oox::num_format_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text);
public:
void xlsx_convert(oox::xlsx_conversion_context & Context);
private:
_CP_OPT(std::wstring) number_style_; _CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_; _CP_OPT(std::wstring) number_calendar_;
...@@ -407,80 +419,81 @@ private: ...@@ -407,80 +419,81 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(number_day); CP_REGISTER_OFFICE_ELEMENT2(number_day);
/// \class number_month // number:month
/// \brief number:month class number_month : public number_element
/// number-month
class number_month : public office_element_impl<number_month>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberMonth; static const xml::NodeType xml_type = xml::typeElement;
CPDOCCORE_DEFINE_VISITABLE(); static const ElementType type = typeNumberMonth;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void oox_convert(oox::num_format_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
public: _CP_OPT(bool) number_textual_;
void xlsx_convert(oox::xlsx_conversion_context & Context); _CP_OPT(bool) number_possessive_form_;
_CP_OPT(std::wstring) number_style_;
private: _CP_OPT(std::wstring) number_calendar_;
_CP_OPT(bool) number_textual_;
_CP_OPT(bool) number_possessive_form_;
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_month); CP_REGISTER_OFFICE_ELEMENT2(number_month);
/// \class number_year // number:year
/// \brief number:year class number_year : public number_element
/// number-year
class number_year : public office_element_impl<number_year>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberYear; static const xml::NodeType xml_type = xml::typeElement;
CPDOCCORE_DEFINE_VISITABLE(); static const ElementType type = typeNumberYear;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void oox_convert(oox::num_format_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text(const std::wstring & Text);
public: _CP_OPT(std::wstring) number_style_;
void xlsx_convert(oox::xlsx_conversion_context & Context);
private:
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_; _CP_OPT(std::wstring) number_calendar_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_year); CP_REGISTER_OFFICE_ELEMENT2(number_year);
/// \class number_hours // number:hours
/// \brief number:hours class number_hours : public number_element
/// number-hours
class number_hours : public office_element_impl<number_hours>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberHours; static const xml::NodeType xml_type = xml::typeElement;
CPDOCCORE_DEFINE_VISITABLE(); static const ElementType type = typeNumberHours;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
public: public:
void xlsx_convert(oox::xlsx_conversion_context & Context); void oox_convert(oox::num_format_context & Context);
private: private:
_CP_OPT(std::wstring) number_style_; _CP_OPT(std::wstring) number_style_;
...@@ -490,26 +503,25 @@ private: ...@@ -490,26 +503,25 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(number_hours); CP_REGISTER_OFFICE_ELEMENT2(number_hours);
/// \class number_minutes // number:minutes
/// \brief number:minutes class number_minutes : public number_element
/// number-minutes
class number_minutes : public office_element_impl<number_minutes>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberMinutes; static const ElementType type = typeNumberMinutes;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void oox_convert(oox::num_format_context & Context);
private: private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
public:
void xlsx_convert(oox::xlsx_conversion_context & Context);
private:
_CP_OPT(std::wstring) number_style_; _CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_; _CP_OPT(std::wstring) number_calendar_;
...@@ -517,77 +529,77 @@ private: ...@@ -517,77 +529,77 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(number_minutes); CP_REGISTER_OFFICE_ELEMENT2(number_minutes);
/// \class number_seconds // number:seconds
/// \brief number:seconds class number_seconds : public number_element
/// number-seconds
class number_seconds : public office_element_impl<number_seconds>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberSeconds; static const ElementType type = typeNumberSeconds;
CPDOCCORE_DEFINE_VISITABLE();
CPDOCCORE_DEFINE_VISITABLE();
private: CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: virtual void oox_convert(oox::num_format_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
private: private:
_CP_OPT(std::wstring) number_style_; virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(int) number_decimal_places_; virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
_CP_OPT(std::wstring) number_calendar_; virtual void add_text (const std::wstring & Text);
_CP_OPT(std::wstring) number_style_;
_CP_OPT(int) number_decimal_places_;
_CP_OPT(std::wstring) number_calendar_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_seconds); CP_REGISTER_OFFICE_ELEMENT2(number_seconds);
/// \class number_am_pm // number:am-pm
/// \brief number:am-pm class number_am_pm : public number_element
/// number-am-pm
class number_am_pm : public office_element_impl<number_am_pm>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberAmPm; static const xml::NodeType xml_type = xml::typeElement;
CPDOCCORE_DEFINE_VISITABLE(); static const ElementType type = typeNumberAmPm;
private: CPDOCCORE_DEFINE_VISITABLE();
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: virtual void oox_convert(oox::num_format_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
}; };
CP_REGISTER_OFFICE_ELEMENT2(number_am_pm); CP_REGISTER_OFFICE_ELEMENT2(number_am_pm);
/// \class number_fraction // number:fraction
/// \brief number:fraction class number_fraction : public number_element
/// number-fraction
class number_fraction : public office_element_impl<number_fraction>
{ {
public: public:
static const wchar_t * ns; static const wchar_t * ns;
static const wchar_t * name; static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeNumberFraction; static const xml::NodeType xml_type = xml::typeElement;
CPDOCCORE_DEFINE_VISITABLE(); static const ElementType type = typeNumberFraction;
private: CPDOCCORE_DEFINE_VISITABLE();
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); CPDOCCORE_OFFICE_DOCUMENT_IMPL_NAME_FUNCS_;
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: virtual void oox_convert(oox::num_format_context & Context);
void xlsx_convert(oox::xlsx_conversion_context & Context);
private: private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
virtual void add_text (const std::wstring & Text);
_CP_OPT(int) number_min_integer_digits_; _CP_OPT(int) number_min_integer_digits_;
_CP_OPT(bool) number_grouping_; _CP_OPT(bool) number_grouping_;
_CP_OPT(std::wstring) number_calendar_; _CP_OPT(std::wstring) number_calendar_;
......
...@@ -13,9 +13,7 @@ ...@@ -13,9 +13,7 @@
namespace cpdoccore { namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
/// \class style_map // style:map
/// \brief style:map
/// style-map
class style_map : public office_element_impl<style_map> class style_map : public office_element_impl<style_map>
{ {
public: public:
...@@ -30,10 +28,10 @@ private: ...@@ -30,10 +28,10 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public: public:
std::wstring style_condition_; std::wstring style_condition_;
odf_types::style_ref style_name_; odf_types::style_ref style_name_;
std::wstring style_base_cell_address_; std::wstring style_base_cell_address_;
odf_types::style_ref style_apply_style_name_; odf_types::style_ref style_apply_style_name_;
}; };
......
...@@ -410,12 +410,12 @@ void styles::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, co ...@@ -410,12 +410,12 @@ void styles::add_child_element( xml::sax * Reader, const ::std::wstring & Ns, co
CP_CREATE_ELEMENT_SIMPLE(text_list_style_); CP_CREATE_ELEMENT_SIMPLE(text_list_style_);
} }
else if ( else if (
CP_CHECK_NAME(L"number", L"number-style") || CP_CHECK_NAME(L"number", L"number-style") ||
CP_CHECK_NAME(L"number", L"currency-style") ||
CP_CHECK_NAME(L"number", L"currency-style") || CP_CHECK_NAME(L"number", L"currency-style") ||
CP_CHECK_NAME(L"number", L"percentage-style") || CP_CHECK_NAME(L"number", L"percentage-style") ||
CP_CHECK_NAME(L"number", L"date-style") || CP_CHECK_NAME(L"number", L"date-style") ||
CP_CHECK_NAME(L"number", L"time-style") || CP_CHECK_NAME(L"number", L"time-style") ||
CP_CHECK_NAME(L"number", L"text-style") ||
CP_CHECK_NAME(L"number", L"number-boolean-style") CP_CHECK_NAME(L"number", L"number-boolean-style")
) )
{ {
......
...@@ -276,22 +276,22 @@ private: ...@@ -276,22 +276,22 @@ private:
private: private:
// attr // attr
std::wstring style_name_; std::wstring style_name_;
_CP_OPT( std::wstring ) style_display_name_; // optional bool style_auto_update_; // default = false
_CP_OPT( std::wstring ) style_display_name_;
odf_types::style_family style_family_; odf_types::style_family style_family_;
_CP_OPT( std::wstring ) style_parent_style_name_; // optional _CP_OPT( std::wstring ) style_parent_style_name_;
_CP_OPT( std::wstring ) style_next_style_name_; // optional _CP_OPT( std::wstring ) style_next_style_name_;
_CP_OPT( std::wstring ) style_list_style_name_; // optional, may be empty _CP_OPT( std::wstring ) style_list_style_name_;
_CP_OPT( std::wstring ) style_master_page_name_; // optional _CP_OPT( std::wstring ) style_master_page_name_;
bool style_auto_update_; // optional, default = false _CP_OPT( std::wstring ) style_data_style_name_;
_CP_OPT( std::wstring ) style_data_style_name_; // // optional _CP_OPT( std::wstring ) style_class_;
_CP_OPT( std::wstring ) style_class_; // optional _CP_OPT( std::wstring ) style_default_outline_level_;
_CP_OPT(std::wstring) style_default_outline_level_; // optional
private: private:
style_content style_content_; style_content style_content_;
office_element_ptr_array style_map_; office_element_ptr_array style_map_;
friend class odf_document; friend class odf_document;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "serialize_elements.h" #include "serialize_elements.h"
#include "odfcontext.h" #include "odfcontext.h"
#include "number_style.h"
#include "calcs_styles.h" #include "calcs_styles.h"
#include "search_table_cell.h" #include "search_table_cell.h"
...@@ -671,12 +672,16 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -671,12 +672,16 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
if (!data_style.empty()) if (!data_style.empty())
{ {
if (office_element_ptr num_style = odfContext.numberStyles().find_by_style_name(data_style)) office_element_ptr elm = odfContext.numberStyles().find_by_style_name(data_style);
{ number_style_base *num_style = dynamic_cast<number_style_base*>(elm.get());
if (num_style)
{
Context.get_num_format_context().start_complex_format(); Context.get_num_format_context().start_complex_format();
num_style->xlsx_convert(Context); num_style->oox_convert(Context.get_num_format_context());
Context.get_num_format_context().end_complex_format(); Context.get_num_format_context().end_complex_format();
num_format = Context.get_num_format_context().get_last_format();
num_format = Context.get_num_format_context().get_last_format();
} }
} }
...@@ -769,7 +774,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -769,7 +774,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
empty_cell_count++; empty_cell_count++;
//__.ods - 13 cellStyle=NULL - !!! //__.ods - 13 cellStyle=NULL - !!!
if (empty_cell_count > 19 && (table_table_cell_attlist_.table_number_columns_repeated_> 299 || cellStyle == NULL)) if (empty_cell_count > 19 && last_cell_&& (table_table_cell_attlist_.table_number_columns_repeated_> 299 || cellStyle == NULL))
{// {//
skip_next_cell = true; skip_next_cell = true;
} }
......
...@@ -359,6 +359,22 @@ ...@@ -359,6 +359,22 @@
RelativePath="..\src\odf\header_footer.h" RelativePath="..\src\odf\header_footer.h"
> >
</File> </File>
<File
RelativePath="..\src\odf\number_style.cpp"
>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\odf\number_style.h"
>
</File>
<File <File
RelativePath="..\src\odf\style_chart_properties.cpp" RelativePath="..\src\odf\style_chart_properties.cpp"
> >
...@@ -1423,22 +1439,6 @@ ...@@ -1423,22 +1439,6 @@
RelativePath="..\src\odf\note.h" RelativePath="..\src\odf\note.h"
> >
</File> </File>
<File
RelativePath="..\src\odf\number_style.cpp"
>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\odf\number_style.h"
>
</File>
<File <File
RelativePath="..\src\odf\odf_content_xml.cpp" RelativePath="..\src\odf\odf_content_xml.cpp"
> >
......
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