Commit 8cb1b2af authored by ElenaSubbotina's avatar ElenaSubbotina

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

parent f2df0618
......@@ -20,7 +20,7 @@
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="WORD_EXAMPLE.odtWORD_EXAMPLE.odt"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
......
......@@ -61,11 +61,6 @@ void oox_axis_content::oox_serialize(std::wostream & _Wostream)
{
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;
case 3:
......@@ -89,8 +84,9 @@ void oox_axis_content::oox_serialize(std::wostream & _Wostream)
}
void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
{
oox_chart_shape shape;
_CP_OPT(bool) boolVal;
oox_chart_shape shape;
_CP_OPT(bool) boolVal;
_CP_OPT(std::wstring) strVal;
oox_title title;
title.set_content(content_.title_);//todo layout
......@@ -138,6 +134,18 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
}
//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_)
{
_oox_fill fill_null;
......@@ -177,7 +185,7 @@ void oox_axis_content::oox_serialize_content(std::wostream & _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))
{
CP_XML_NODE(L"c:tickLblPos")
......@@ -188,6 +196,8 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
shape.set(content_.graphic_properties_,content_.fill_) ;
shape.oox_serialize(_Wostream);
oox_serialize_default_text(_Wostream, content_.text_properties_);
BOOST_FOREACH(int const & ii, cross_id_)
{
......
......@@ -30,11 +30,11 @@ public:
int get_Id(){return id_;}
void add_CrossedId (int id){cross_id_.push_back( id);}
int id_;
std::vector<int> cross_id_;
int id_;
std::vector<int> cross_id_;
odf_reader::chart::axis content_;
int type_;
int type_;
};
}
......
......@@ -61,7 +61,7 @@ void oox_chart_series::setName(std::wstring &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;
......@@ -79,9 +79,11 @@ void oox_chart_series::setFormula(int ind, std::wstring &value)
long res = value.find(L"local-table");
if (res >=0 && !bLocalTable_ ) return; // xlsx .... table.xml
values_[ind].numRef_.formula = converter.convert_chart_distance(value);
values_[ind].numRef_.present = true;
values_[ind].present = true;
values_[ind].numRef_.formula = converter.convert_chart_distance(value);
values_[ind].numRef_.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)
{
CP_XML_NODE(L"c:formatCode")
{
CP_XML_CONTENT(L"General");//????
CP_XML_CONTENT(values_[i].numRef_.formatCode);
}
CP_XML_NODE(L"c:ptCount")
{
......@@ -227,7 +229,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:formatCode")
{
CP_XML_CONTENT(L"General");//????
CP_XML_CONTENT(values_[i].numRef_.formatCode);
}
CP_XML_NODE(L"c:ptCount")
{
......
......@@ -32,7 +32,7 @@ public:
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 parse_properties();
......
......@@ -2,7 +2,6 @@
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
//#include <cpdoccore/CPScopedPtr.h>
namespace cpdoccore {
......@@ -22,11 +21,7 @@ struct _oox_numLit
//formatCode (Format Code) 21.2.2.71
//pt (Numeric Point) 21.2.2.150
//ptCount (Point Count)
//struct _xlsx_num_cash
//{
// int formatCode;
// std::vector<std::wstring>num_cash;
//};
struct _oox_strRef
{
bool present;
......@@ -42,6 +37,7 @@ struct _oox_numRef
std::wstring formula;
std::wstring formatCode;
bool link_to_source;
int num_cache_count;
std::vector<std::wstring> num_cache;
......@@ -55,21 +51,22 @@ struct _oox_chart_values
public:
_oox_chart_values()
{
numRef_.present=false;
numRef_.formatCode = L"General";
numRef_.num_cache_count=0;
numRef_.present = false;
numRef_.formatCode = L"General";
numRef_.num_cache_count = 0;
numRef_.link_to_source = true;
strRef_.present=false;
strRef_.str_cache_count=0;
strRef_.present = false;
strRef_.str_cache_count = 0;
present = false;
present = false;
}
bool present;
std::wstring type;
bool present;
std::wstring type;
_oox_numRef numRef_;
_oox_strRef strRef_;
_oox_numRef numRef_;
_oox_strRef strRef_;
};
//numLit (Number Literal) 21.2.2.122
......
......@@ -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();
current_ptr->setFormula(ind,val);
current_ptr->setFormula(ind, val, formatCode, link_to_source);
}
void oox_chart::set_name(std::wstring val)
......
......@@ -45,7 +45,7 @@ public:
virtual void add_series(int id){}
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_name (std::wstring val);
void set_content_series (odf_reader::chart::series & content);
......
......@@ -87,9 +87,9 @@ private:
size_t paragraphs_cout_; //???? ?
std::wstringstream text_; //
std::wstringstream paragraph_; //
std::wstringstream run_; //
std::wstringstream text_; //
std::wstringstream paragraph_; //
std::wstringstream run_; //
std::wstring paragraph_style_name_;
std::wstring span_style_name_;
......@@ -158,8 +158,8 @@ void pptx_text_context::Impl::start_paragraph(const std::wstring & styleName)
text_.str(std::wstring());
field_value_.str(std::wstring());
}
paragraph_style_name_ = styleName;
in_paragraph = true;
paragraph_style_name_ = styleName;
in_paragraph = true;
}
void pptx_text_context::Impl::end_paragraph()
......@@ -515,8 +515,7 @@ void pptx_text_context::Impl::dump_run()
//if (content.length() <1 && span_style_name_.length()<1) return ; ... ...
if (content .length() > 0)
{
{
CP_XML_WRITER(run_)
{
CP_XML_NODE(L"a:r")
......@@ -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 name = ListStyleName;
while (list_style_renames_.count(name) > 0)
while (list_style_renames_.count(name) > 0)
name = list_style_renames_.at(name);
return name;
......@@ -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()
{
dump_paragraph();
paragraphs_cout_--;
paragraph_style_name_ = L"";
......@@ -723,9 +724,6 @@ void pptx_text_context::Impl::write_list_styles(std::wostream & strm)//defaults
list_style_stack_.clear();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
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 )
CP_XML_NODE(L"a:lstStyle");
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_complex_number_format.h"
#include <sstream>
#include <map>
#include "..\odf\odfcontext.h"
namespace cpdoccore {
namespace oox {
......@@ -36,7 +40,7 @@ public:
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_
#define _CPDOCCORE_XLSX_NUM_FORMAT_CONTEXT_H_
#pragma once
#include <string>
#include <iosfwd>
......@@ -7,12 +6,16 @@
#include <cpdoccore/CPScopedPtr.h>
namespace cpdoccore {
namespace odf_reader
{
class odf_read_context;
}
namespace oox {
class num_format_context : boost::noncopyable
{
public:
num_format_context();
num_format_context(odf_reader::odf_read_context & odfContext);
~num_format_context();
public:
......@@ -27,7 +30,7 @@ public:
void end_complex_format();
//std::wstring default_data_style(int type);
odf_reader::odf_read_context & odf_context_;
private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;
......@@ -38,5 +41,3 @@ private:
}
}
#endif
......@@ -76,16 +76,20 @@ private:
odf_reader::text_format_properties_content * text_properties_cell_;
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_pPr(std::wostream & strm);
size_t paragraphs_cout_; //???? тока из за начала отсчета?
std::wstringstream text_;
std::wstringstream output_;
std::wstringstream text_; //приходящий текст
std::wstringstream paragraph_; //перманенто скидываемые параграфы
std::wstringstream run_; //перманенто скидываемые куски с быть может разными свойствами
xlsx_shared_strings xlsx_shared_strings_;
std::wstring paragraph_style_name_;//был вектор ... не нужен, так как в один момент времени может быть тока один стиль параграфа,текста,объекта при приходе нового - дампится
std::wstring span_style_name_;
......@@ -108,7 +112,7 @@ void xlsx_text_context::Impl::add_text(const std::wstring & text)
text_ << text;
if (!in_comment && !in_draw)
dump_text();
dump_run();
}
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)
{
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
{
......@@ -136,7 +146,7 @@ void xlsx_text_context::Impl::end_paragraph()
{
if (!in_comment && !in_draw)
{
dump_text();
dump_run();
paragraph_style_name_ = L"";
}
in_paragraph = false;
......@@ -144,27 +154,32 @@ void xlsx_text_context::Impl::end_paragraph()
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
{
if (span_style_name_ !=styleName || in_span)
{
dump_text();
}
text_.str(std::wstring());
}
span_style_name_ = styleName;
in_span=true;
span_style_name_ = styleName;
in_span = true;
}
void xlsx_text_context::Impl::end_span() //odf корявенько написан - возможны повторы стилей в последовательных кусках текста
//пока с анализом стилей тока комменты - остальные текстовые куски как есть.. с охрененным возможно дубляжом
{
if (!in_comment && !in_draw)
if (!in_comment)
{
dump_text();
dump_run();
span_style_name_=L"";
}
in_span=false;
......@@ -172,21 +187,23 @@ void xlsx_text_context::Impl::end_span() //odf корявенько написа
std::wstring xlsx_text_context::Impl::end_span2()
{
const std::wstring content = dump_text();
const std::wstring content = dump_run();
span_style_name_ = L"";
in_span = false;
return content;
}
void xlsx_text_context::Impl::start_hyperlink()
{
dump_text();
dump_run();
}
void xlsx_text_context::Impl::end_hyperlink(std::wstring 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)
{
std::vector<const odf_reader::style_instance *> instances;
......@@ -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);
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)
......@@ -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());
if (content.length()<1)
return content;
return L"";
std::wstring prefix_draw;
if (in_draw) prefix_draw=L"a:";
CP_XML_WRITER(output_)
CP_XML_WRITER(run_)
{
if (!content.empty())
{
......@@ -398,81 +430,81 @@ void xlsx_text_context::Impl::start_cell_content()
paragraphs_cout_ = 0;
local_styles_ptr_ =NULL;
output_.str(std::wstring());//строка дампа
text_.str(std::wstring()); //приходящие куски текста
run_.str(std::wstring());
paragraph_.str(std::wstring());
text_.str(std::wstring());
paragraph_style_name_ = L"";
span_style_name_ = L"";
paragraph_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()
{
paragraphs_cout_ = 0;
output_.str(std::wstring());
run_.str(std::wstring());
paragraph_.str(std::wstring());
text_.str(std::wstring());
paragraph_style_name_ = L"";
span_style_name_ = L"";
paragraph_style_name_ = L"";
span_style_name_ = L"";
in_comment = true;
in_comment = true;
}
void xlsx_text_context::Impl::start_drawing_content()
{
paragraphs_cout_ = 0;
output_.str(std::wstring());
run_.str(std::wstring());
paragraph_.str(std::wstring());
text_.str(std::wstring());
paragraph_style_name_ = L"";
span_style_name_ = L"";
paragraph_style_name_ = L"";
span_style_name_ = L"";
in_draw = true;
in_draw = true;
}
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;
output_.str(std::wstring());
text_.str(std::wstring());
paragraph_style_name_ = L"";
span_style_name_=L"";
paragraph_style_name_ = L"";
span_style_name_ = L"";
in_comment = false;
in_comment = false;
return comment;
}
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;
output_.str(std::wstring());
text_.str(std::wstring());
paragraphs_cout_ = 0;
paragraph_style_name_ = L"";
span_style_name_=L"";
run_.str(std::wstring());
paragraph_.str(std::wstring());
text_.str(std::wstring());
paragraph_style_name_ = L"";
span_style_name_ = L"";
in_draw = false;
return draw;
}
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;
return sharedStrId;
......
......@@ -32,6 +32,7 @@ namespace package
xlsx_conversion_context::xlsx_conversion_context(odf_reader::odf_document * odfDocument) :
odf_document_ (odfDocument),
output_document_ (NULL),
num_format_context_ (odf_document_->odf_context()),
xlsx_text_context_ (odf_document_->odf_context().styleContainer()),
xlsx_table_context_ (this, xlsx_text_context_),
......
#include "../docx/xlsx_textcontext.h"
#include "../docx/xlsx_num_format_context.h"
#include "serialize_elements.h"
#include <cpdoccore/odf/odf_document.h>
#include "../formulasconvert/formulasconvert.h"
#include "style_graphic_properties.h"
......@@ -15,6 +13,7 @@
#include "draw_common.h"
#include "number_style.h"
#include "calcs_styles.h"
#include "chart_build_oox.h"
......@@ -311,34 +310,46 @@ void chart_build::oox_convert(oox::oox_chart_context & chart_context)
if (categories_.size() >0)
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 (last_set_type == chart_bubble)
{
current->set_formula_series(4, domain_cell_range_adress_); //bubble(x)
current->set_values_series (4, domain_cash); //bubble(x)
current->set_formula_series(3, s.cell_range_address_); //y
{ //bubble(x)
current->set_formula_series(4, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (4, domain_cash);
//y
current->set_formula_series(3, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series (3, cell_cash);
}
else
{
current->set_formula_series(2, domain_cell_range_adress_); //x
current->set_values_series (2, domain_cash); //x
current->set_formula_series(3, s.cell_range_address_); //y
current->set_values_series (3, cell_cash); //y
{ //x
current->set_formula_series(2, domain_cell_range_adress_, formatCode, boolVal.get_value_or(true));
current->set_values_series (2, domain_cash);
//y
current->set_formula_series(3, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series (3, cell_cash);
}
}
else
{
current->set_formula_series(1, s.cell_range_address_); //common
current->set_values_series(1, cell_cash); //common
{ //common
current->set_formula_series(1, s.cell_range_address_, formatCode, boolVal.get_value_or(true));
current->set_values_series(1, cell_cash);
}
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_name(s.name_);
......@@ -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) :
stop_ (false)
,chart_build_ (chartBuild)
,styles_ (context.styleContainer())
,settings_ (context.Settings())
,draw_styles_ (context.drawStyles())
stop_ (false)
,chart_build_ (chartBuild)
,styles_ (context.styleContainer())
,settings_ (context.Settings())
,draw_styles_ (context.drawStyles())
,number_styles_ (context.numberStyles())
,num_format_context_(context)
{
office_element_ptr sett_elm = settings_.find_by_style_name(L"BaseFontHeight");
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
}
}
}
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)
{
const style_content * Content = styleInst->content();
const style_chart_properties *properties = Content->get_style_chart_properties();
const style_content * Content = styleInst->content();
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;
......@@ -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)
{
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)
{
text_format_properties_content properties = calc_text_properties_content(styleInst);
......@@ -611,9 +644,11 @@ void process_build_chart::visit(const chart_axis& val)
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_);
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_);
std::wstring style_name = val.chart_axis_attlist_.common_attlist_.chart_style_name_.get_value_or(L"");
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();
}
......
......@@ -299,10 +299,12 @@ private:
chart_build & chart_build_;
styles_container & styles_;
styles_lite_container & settings_;
styles_lite_container & draw_styles_;
styles_lite_container & number_styles_;
oox::num_format_context num_format_context_;
};
......
......@@ -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>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleHeaderFooterProperties;
CPDOCCORE_DEFINE_VISITABLE();
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleHeaderFooterProperties;
CPDOCCORE_DEFINE_VISITABLE();
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);
......
This diff is collapsed.
This diff is collapsed.
......@@ -13,9 +13,7 @@
namespace cpdoccore {
namespace odf_reader {
/// \class style_map
/// \brief style:map
/// style-map
// style:map
class style_map : public office_element_impl<style_map>
{
public:
......@@ -30,10 +28,10 @@ private:
virtual void add_child_element( xml::sax * Reader, const ::std::wstring & Ns, const ::std::wstring & Name);
public:
std::wstring style_condition_;
odf_types::style_ref style_name_;
std::wstring style_base_cell_address_;
odf_types::style_ref style_apply_style_name_;
std::wstring style_condition_;
odf_types::style_ref style_name_;
std::wstring style_base_cell_address_;
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
CP_CREATE_ELEMENT_SIMPLE(text_list_style_);
}
else if (
CP_CHECK_NAME(L"number", L"number-style") ||
CP_CHECK_NAME(L"number", L"currency-style") ||
CP_CHECK_NAME(L"number", L"number-style") ||
CP_CHECK_NAME(L"number", L"currency-style") ||
CP_CHECK_NAME(L"number", L"percentage-style") ||
CP_CHECK_NAME(L"number", L"date-style") ||
CP_CHECK_NAME(L"number", L"time-style") ||
CP_CHECK_NAME(L"number", L"date-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")
)
{
......
......@@ -276,22 +276,22 @@ private:
private:
// attr
std::wstring style_name_;
_CP_OPT( std::wstring ) style_display_name_; // optional
std::wstring style_name_;
bool style_auto_update_; // default = false
_CP_OPT( std::wstring ) style_display_name_;
odf_types::style_family style_family_;
_CP_OPT( std::wstring ) style_parent_style_name_; // optional
_CP_OPT( std::wstring ) style_next_style_name_; // optional
_CP_OPT( std::wstring ) style_list_style_name_; // optional, may be empty
_CP_OPT( std::wstring ) style_master_page_name_; // optional
bool style_auto_update_; // optional, default = false
_CP_OPT( std::wstring ) style_data_style_name_; // // optional
_CP_OPT( std::wstring ) style_class_; // optional
_CP_OPT(std::wstring) style_default_outline_level_; // optional
_CP_OPT( std::wstring ) style_parent_style_name_;
_CP_OPT( std::wstring ) style_next_style_name_;
_CP_OPT( std::wstring ) style_list_style_name_;
_CP_OPT( std::wstring ) style_master_page_name_;
_CP_OPT( std::wstring ) style_data_style_name_;
_CP_OPT( std::wstring ) style_class_;
_CP_OPT( std::wstring ) style_default_outline_level_;
private:
style_content style_content_;
office_element_ptr_array style_map_;
style_content style_content_;
office_element_ptr_array style_map_;
friend class odf_document;
......
......@@ -12,6 +12,7 @@
#include "serialize_elements.h"
#include "odfcontext.h"
#include "number_style.h"
#include "calcs_styles.h"
#include "search_table_cell.h"
......@@ -671,12 +672,16 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
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();
num_style->xlsx_convert(Context);
num_style->oox_convert(Context.get_num_format_context());
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)
{
empty_cell_count++;
//__.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;
}
......
......@@ -359,6 +359,22 @@
RelativePath="..\src\odf\header_footer.h"
>
</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
RelativePath="..\src\odf\style_chart_properties.cpp"
>
......@@ -1423,22 +1439,6 @@
RelativePath="..\src\odf\note.h"
>
</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
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