Commit 4e9da3ea authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

OdfReader - улучшена конвертация диаграм, ..

parent 3e605b02
......@@ -57,10 +57,10 @@ void oox_axis_content::oox_serialize(std::wostream & _Wostream)
CP_XML_NODE(L"c:valAx")
{
oox_serialize_content(CP_XML_STREAM());
//CP_XML_NODE(L"c:crossBetween")
//{
// CP_XML_ATTR(L"val", L"between");
//}
CP_XML_NODE(L"c:crossBetween")
{
CP_XML_ATTR(L"val", L"between");
}
//CP_XML_NODE(L"c:numFmt")
//{
// CP_XML_ATTR(L"sourceLinked", 1);
......@@ -89,7 +89,7 @@ void oox_axis_content::oox_serialize(std::wostream & _Wostream)
}
void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
{
//odf::_variant Val;
oox_chart_shape shape;
_CP_OPT(bool) boolVal;
oox_title title;
......@@ -101,10 +101,6 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
{
CP_XML_ATTR(L"val", id_);
}
CP_XML_NODE(L"c:delete")//visible item
{
CP_XML_ATTR(L"val", 0);
}
CP_XML_NODE(L"c:scaling")
{
CP_XML_NODE(L"c:orientation")
......@@ -128,11 +124,20 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
}
}
}
CP_XML_NODE(L"c:delete")//visible item
{
CP_XML_ATTR(L"val", 0);
}
CP_XML_NODE(L"c:axPos")
{
if (content_.dimension_ == L"x")
CP_XML_ATTR(L"val",L"b");// "b" | "l" | "r" | "t"// == bottom left right top
if (content_.dimension_ == L"y")
CP_XML_ATTR(L"val",L"l");// "b" | "l" | "r" | "t"// == bottom left right top
}
//oox_serialize_ln(_Wostream,content_.graphic_properties_);
oox_chart_shape shape;
shape.set(content_.graphic_properties_,content_.fill_) ;
shape.oox_serialize(_Wostream);
BOOST_FOREACH(odf_reader::chart::axis::grid & g, content_.grids_)
{
_oox_fill fill_null;
......@@ -169,6 +174,21 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
}
}
}
title.oox_serialize(_Wostream);
odf_reader::GetProperty(content_.properties_,L"display_label",boolVal);
if ((boolVal == true) && (boolVal.get()==true))
{
CP_XML_NODE(L"c:tickLblPos")
{
CP_XML_ATTR(L"val",L"nextTo");//"high" | "low" | "nextTo" | "none"
}
}
shape.set(content_.graphic_properties_,content_.fill_) ;
shape.oox_serialize(_Wostream);
BOOST_FOREACH(int const & ii, cross_id_)
{
CP_XML_NODE(L"c:crossAx")
......@@ -176,28 +196,12 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
CP_XML_ATTR(L"val", ii);
}
}
CP_XML_NODE(L"c:axPos")
{
if (content_.dimension_ == L"x")
CP_XML_ATTR(L"val",L"b");// "b" | "l" | "r" | "t"// == bottom left right top
if (content_.dimension_ == L"y")
CP_XML_ATTR(L"val",L"l");// "b" | "l" | "r" | "t"// == bottom left right top
}
//////////////////////////////////////////////////////
CP_XML_NODE(L"c:crosses")
{
CP_XML_ATTR(L"val", L"autoZero"); //""autoZero" | "max" | "min"
}
odf_reader::GetProperty(content_.properties_,L"display_label",boolVal);
if ((boolVal == true) && (boolVal.get()==true))
{
CP_XML_NODE(L"c:tickLblPos")
{
CP_XML_ATTR(L"val",L"nextTo");//"high" | "low" | "nextTo" | "none"
}
}
title.oox_serialize(_Wostream);
}
}
......
......@@ -60,6 +60,12 @@ void oox_chart_context::write_to(std::wostream & strm)
}
CP_XML_NODE(L"c:chart")
{
if (plot_area_.current_chart_->is3D_)
{
//CP_XML_NODE(L"c:view3D");
CP_XML_NODE(L"c:floor");
CP_XML_NODE(L"c:backWall");
}
title_.oox_serialize(CP_XML_STREAM());
plot_area_.oox_serialize(CP_XML_STREAM());
legend_.oox_serialize(CP_XML_STREAM());
......@@ -68,6 +74,14 @@ void oox_chart_context::write_to(std::wostream & strm)
{
CP_XML_ATTR(L"val",1);
}
CP_XML_NODE(L"c:dispBlanksAs")
{
CP_XML_ATTR(L"val", L"zero");
}
CP_XML_NODE(L"c:showDLblsOverMax")
{
CP_XML_ATTR(L"val",1);
}
}
oox_chart_shape shape;
shape.set(graphic_properties_,fill_);
......
......@@ -38,17 +38,16 @@ public:
{
title_.set_content(t);
}
void add_axis(int type)
void add_axis(int type, odf_reader::chart::axis & content)
{
plot_area_.add_axis(type);
plot_area_.add_axis(type, content);
}
void set_content_axis(odf_reader::chart::axis & content)
void set_3D_chart(bool val)
{
plot_area_.set_content_axis(content);
}
void set_content_series(odf_reader::chart::series & content)
{
plot_area_.set_content_series(content);
for (int i = 0 ; i < plot_area_.charts_.size(); i++)
{
plot_area_.charts_[i]->is3D_ = val;
}
}
void add_chart(int type)
{
......
......@@ -45,7 +45,17 @@ public:
}
}
};
oox_chart_series::oox_chart_series()
{
values_[0].type = L"c:cat";//
values_[1].type = L"c:val";
values_[2].type = L"c:xVal";
values_[3].type = L"c:yVal";
values_[4].type = L"c:bubbleSize";// !!!!
iSymbolMarkerType_ = 0;
bLocalTable_ = false;
}
void oox_chart_series::setName(std::wstring &value)
{
name_=value;
......@@ -55,20 +65,20 @@ void oox_chart_series::setFormula(int ind, std::wstring &value)
{
formulasconvert::odf2oox_converter converter;
if (ind == 4)
if (ind == 0)
{
long res = value.find(L"local-table");
if (res >=0) return;
values_[ind].strRef_.formula=converter.convert_chart_distance(value);
values_[ind].strRef_.present = true;
values_[ind].present = true;
values_[ind].strRef_.formula = converter.convert_chart_distance(value);
values_[ind].strRef_.present = true;
values_[ind].present = true;
}
else
{
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].present = true;
}
}
......@@ -97,13 +107,13 @@ void oox_chart_series::setValues(int ind, std::vector<std::wstring> & values)
{
values_[ind].present = true;
if (ind == 4)values_[ind].strRef_.present = true;
else values_[ind].numRef_.present = true;
if (ind == 0) values_[ind].strRef_.present = true;
else values_[ind].numRef_.present = true;
BOOST_FOREACH(std::wstring & v, values)
{
boost::algorithm::trim(v);
if (ind == 4)
if (ind == 0)
{
values_[ind].strRef_.str_cache.push_back(v);
values_[ind].strRef_.str_cache_count++;
......@@ -135,7 +145,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
}
shape.oox_serialize(_Wostream);
for (int i=0; i < 4; i++)
for (int i=0; i < 5; i++)
{
if (values_[i].present)
{
......@@ -147,12 +157,15 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:f")
{
CP_XML_CONTENT(values_[i].numRef_.formula);
if (values_[i].numRef_.formula.empty())
CP_XML_CONTENT(L"label");
else
CP_XML_CONTENT(values_[i].numRef_.formula);
}
if (values_[i].numRef_.num_cache_count>0)
{
CP_XML_NODE(L"c:numCache")//
CP_XML_NODE(L"c:numCache")
{
CP_XML_NODE(L"c:formatCode")
{
......@@ -214,6 +227,38 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
}
}
}
else if (values_[i].strRef_.present > 0 && !bLocalTable_)
{
CP_XML_NODE(L"c:strRef")
{
CP_XML_NODE(L"c:f")
{
if (values_[i].strRef_.formula.empty())
CP_XML_CONTENT(L"label");
else
CP_XML_CONTENT(values_[i].strRef_.formula);
}
CP_XML_NODE(L"c:strCache")
{
CP_XML_NODE(L"c:ptCount")
{
CP_XML_ATTR(L"val", values_[i].strRef_.str_cache_count);
}
int j=0;
BOOST_FOREACH(std::wstring & v, values_[i].strRef_.str_cache)
{
CP_XML_NODE(L"c:pt")
{
CP_XML_ATTR(L"idx", j++);
CP_XML_NODE(L"c:v")
{
CP_XML_CONTENT(v);
}
}
}
}
}
}
else if (values_[i].strRef_.str_cache_count > 0)
{
CP_XML_NODE(L"c:strLit")
......@@ -342,7 +387,8 @@ _CP_PTR(oox_chart_series) oox_pie_series::create()
}
void oox_pie_series::oox_serialize(std::wostream & _Wostream)
{
content_.graphic_properties_.clear(); //
content_.fill_.clear(); //
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:ser")
......@@ -353,11 +399,11 @@ void oox_pie_series::oox_serialize(std::wostream & _Wostream)
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
_CP_PTR(oox_chart_series) xlsx_scatter_series::create()
_CP_PTR(oox_chart_series) oox_scatter_series::create()
{
return boost::make_shared<xlsx_scatter_series>();
return boost::make_shared<oox_scatter_series>();
}
void xlsx_scatter_series::oox_serialize(std::wostream & _Wostream)
void oox_scatter_series::oox_serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
......@@ -371,11 +417,11 @@ void xlsx_scatter_series::oox_serialize(std::wostream & _Wostream)
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
_CP_PTR(oox_chart_series) xlsx_bubble_series::create()
_CP_PTR(oox_chart_series) oox_bubble_series::create()
{
return boost::make_shared<xlsx_bubble_series>();
return boost::make_shared<oox_bubble_series>();
}
void xlsx_bubble_series::oox_serialize(std::wostream & _Wostream)
void oox_bubble_series::oox_serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
......
......@@ -16,39 +16,26 @@ typedef _CP_PTR(oox_chart_series) oox_series_ptr;
class oox_chart_series
{
public:
oox_chart_series()
{
values_[0].type=L"c:val";
values_[1].type=L"c:xVal";
values_[2].type=L"c:yVal";
values_[3].type=L"c:bubbleSize";// !!!!
values_[4].type=L"c:cat";//
iSymbolMarkerType_ = 0;
bLocalTable_ = false;
}
oox_chart_series();
~oox_chart_series(){}
void oox_serialize_common(std::wostream & _Wostream);
virtual void oox_serialize(std::wostream & _Wostream){}
_oox_chart_values values_[5]; //common,x, y, bubble, cat(labels)
int id_;
std::wstring name_; //tx (Series Text) 21.2.2.215
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
int id_;
std::wstring name_; //tx (Series Text) 21.2.2.215
int iSymbolMarkerType_;
bool bLocalTable_;
void setName(std::wstring &value);
void setFormula(int ind, std::wstring & value);
void setValues(int ind, std::vector<std::wstring> & values);
void setFormula (int ind, std::wstring & value);
void setValues (int ind, std::vector<std::wstring> & values);
void parse_properties();
void set_cache_only (bool val);
int iSymbolMarkerType_;
bool bLocalTable_;
odf_reader::chart::series content_;
//dLbls (Data Labels) 21.2.2.49
......@@ -121,14 +108,14 @@ public:
//explosion (Explosion) 21.2.2.61
//val (Values) 21.2.2.224
/////////////////////////////////////////////////////////////////////////////////////////////////////////////class oox_pie_series;
class xlsx_bubble_series;
typedef _CP_PTR(xlsx_bubble_series) xlsx_bubble_series_ptr;
class oox_bubble_series;
typedef _CP_PTR(oox_bubble_series) oox_bubble_series_ptr;
class xlsx_bubble_series : public oox_chart_series
class oox_bubble_series : public oox_chart_series
{
public:
xlsx_bubble_series(){}
~xlsx_bubble_series(){}
oox_bubble_series(){}
~oox_bubble_series(){}
static oox_series_ptr create();
......@@ -144,14 +131,14 @@ public:
//yVal (Y Values)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
class xlsx_scatter_series;
typedef _CP_PTR(xlsx_scatter_series) xlsx_scatter_series_ptr;
class oox_scatter_series;
typedef _CP_PTR(oox_scatter_series) oox_scatter_series_ptr;
class xlsx_scatter_series : public oox_chart_series
class oox_scatter_series : public oox_chart_series
{
public:
xlsx_scatter_series(){}
~xlsx_scatter_series(){}
oox_scatter_series(){}
~oox_scatter_series(){}
static oox_series_ptr create();
......
......@@ -56,6 +56,35 @@ void oox_plot_area::add_chart(int type)
}
charts_.push_back(chart);
}
void oox_plot_area::add_axis(int type, odf_reader::chart::axis & content)
{
oox_axis_content_ptr ax=oox_axis_content::create(type);
ax->content_ = content;
axis_.push_back(ax);
}
void oox_plot_area::reset_cross_axis()//
{
BOOST_FOREACH(oox_axis_content_ptr const & ax, axis_)
{
BOOST_FOREACH(oox_chart_ptr const & ch, charts_)
{
ch->add_axis(ax->get_Id());
}
}
BOOST_FOREACH(oox_axis_content_ptr const & a, axis_)
{
int curr_id = a->get_Id();
BOOST_FOREACH(oox_axis_content_ptr const & b, axis_)
{
if (b->get_Id()==curr_id)continue;
b->add_CrossedId(curr_id);
}
}
}
void oox_plot_area::oox_serialize(std::wostream & _Wostream)
{
reset_cross_axis();
......@@ -67,7 +96,7 @@ void oox_plot_area::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:plotArea")
{
CP_XML_NODE(L"c:layout"){}
//CP_XML_NODE(L"c:layout"){}
BOOST_FOREACH(oox_chart_ptr const & ch, charts_)
{
......
......@@ -17,60 +17,26 @@ public:
oox_plot_area(){}
~oox_plot_area(){}
std::vector<oox_chart_ptr> charts_;
oox_chart_ptr current_chart_;
std::vector<oox_chart_ptr> charts_;
oox_chart_ptr current_chart_;
std::vector<oox_axis_content_ptr> axis_;
std::vector<odf_reader::_property> graphic_properties_;
std::vector<odf_reader::_property> properties_;
_oox_fill fill_;
std::vector<odf_reader::_property> graphic_properties_;
std::vector<odf_reader::_property> properties_;
_oox_fill fill_;
//std::vector<odf_reader::_property> wall_graphic_properties_;
void oox_serialize(std::wostream & _Wostream);
void add_chart(int type);
void add_chart (int type);
void add_axis (int type, odf_reader::chart::axis & content);
void add_series(int id)
{
current_chart_->add_series(id);
}
std::vector<oox_axis_content_ptr> axis_;
//void set_content_series (odf_reader::chart::series & content);
void add_axis(int type)
{
oox_axis_content_ptr ax=oox_axis_content::create(type);
private:
void reset_cross_axis();//
axis_.push_back(ax);
}
void set_content_axis(odf_reader::chart::axis & content)
{
axis_.back()->content_=content;
}
void set_content_series(odf_reader::chart::series & content)
{
current_chart_->series_.back()->content_=content;
}
void reset_cross_axis()//
{
BOOST_FOREACH(oox_axis_content_ptr const & ax, axis_)
{
BOOST_FOREACH(oox_chart_ptr const & ch, charts_)
{
ch->add_axis(ax->get_Id());
}
}
BOOST_FOREACH(oox_axis_content_ptr const & a, axis_)
{
int curr_id = a->get_Id();
BOOST_FOREACH(oox_axis_content_ptr const & b, axis_)
{
if (b->get_Id()==curr_id)continue;
b->add_CrossedId(curr_id);
}
}
}
//variable charts
//catAx (Category Axis Data) 21.2.2.25
......
......@@ -30,12 +30,16 @@ void oox_chart::set_name(std::wstring val)
oox_series_ptr & current_ptr = series_.back();
current_ptr->setName(val);
}
void oox_chart::set_values_series(int ind,std::vector<std::wstring> & val)
void oox_chart::set_content_series(odf_reader::chart::series & content)
{
series_.back()->content_=content;
}
void oox_chart::set_values_series(int ind, std::vector<std::wstring> & val)
{
if (val.size()<1)return;
oox_series_ptr & current_ptr = series_.back();
current_ptr->setValues(ind,val);
current_ptr->setValues (ind, val);
}
void oox_chart::set_properties(std::vector<odf_reader::_property> g)
{
......@@ -62,10 +66,6 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
if (grouping_.length()>1)
{
CP_XML_NODE(L"c:grouping")
......@@ -112,9 +112,12 @@ void oox_bar_chart::set_additional_properties(std::vector<odf_reader::_property>
void oox_bar_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
std::wstring strNode = L"c:barChart";
if (is3D_) strNode = L"c:bar3DChart";
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:barChart")
CP_XML_NODE(strNode )
{
CP_XML_NODE(L"c:barDir")
{
......@@ -144,7 +147,19 @@ void oox_bar_chart::oox_serialize(std::wostream & _Wostream)
CP_XML_ATTR(L"val",iGapWidth.get());
}
}
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
oox_serialize_common(CP_XML_STREAM());
if (is3D_)
{
CP_XML_NODE(L"c:shape")
{
CP_XML_ATTR(L"val", L"box");
}
}
}
}
}
......@@ -167,10 +182,17 @@ void oox_line_chart::set_properties(std::vector<odf_reader::_property> g)
}
void oox_line_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
std::wstring strNode = L"c:lineChart";
if (is3D_) strNode = L"c:line3DChart";
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:lineChart")
CP_XML_NODE(strNode)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
oox_serialize_common(CP_XML_STREAM());
}
......@@ -193,10 +215,17 @@ void oox_area_chart::set_properties(std::vector<odf_reader::_property> g)
}
void oox_area_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
std::wstring strNode = L"c:areaChart";
if (is3D_) strNode = L"c:area3DChart";
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:areaChart")
CP_XML_NODE(strNode)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
oox_serialize_common(CP_XML_STREAM());
}
......@@ -209,7 +238,7 @@ _CP_PTR(oox_chart) oox_area_chart::create()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void oox_bubble_chart::add_series(int id)
{
series_.push_back(xlsx_bubble_series::create());
series_.push_back(oox_bubble_series::create());
series_.back()->id_= id;
}
......@@ -223,6 +252,10 @@ void oox_bubble_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:bubbleChart")
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
oox_serialize_common(CP_XML_STREAM());
//CP_XML_NODE(L"c:bubbleScale")
//{
......@@ -256,6 +289,10 @@ void oox_doughnut_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:doughnutChart")
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
oox_serialize_common(CP_XML_STREAM());
CP_XML_NODE(L"c:firstSliceAng")
......@@ -285,10 +322,17 @@ void oox_pie_chart::set_properties(std::vector<odf_reader::_property> g)
}
void oox_pie_chart::oox_serialize(std::wostream & _Wostream)
{
std::wstring strNode = L"c:pieChart";
if (is3D_) strNode = L"c:pie3DChart";
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:pieChart")
CP_XML_NODE(strNode)
{
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
oox_serialize_common(CP_XML_STREAM());
}
}
......@@ -312,11 +356,15 @@ void oox_radar_chart::oox_serialize(std::wostream & _Wostream)
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:radarChart")
{
{
CP_XML_NODE(L"c:radarStyle")
{
CP_XML_ATTR(L"val", radarStyle_);//"standard","marker","filled"
}
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
oox_serialize_common(CP_XML_STREAM());
}
......@@ -329,7 +377,7 @@ _CP_PTR(oox_chart) oox_radar_chart::create(std::wstring radarStyle)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void oox_scatter_chart::add_series(int id)
{
series_.push_back(xlsx_scatter_series::create());
series_.push_back(oox_scatter_series::create());
series_.back()->id_= id;
}
void oox_scatter_chart::set_properties(std::vector<odf_reader::_property> g)
......@@ -351,7 +399,10 @@ void oox_scatter_chart::oox_serialize(std::wostream & _Wostream)
{
CP_XML_ATTR(L"val", L"lineMarker");
}
CP_XML_NODE(L"c:varyColors")
{
CP_XML_ATTR(L"val", 1);
}
oox_serialize_common(CP_XML_STREAM());
}
......
......@@ -23,7 +23,8 @@ public:
oox_chart()
{
grouping_ = L"standard";
grouping_ = L"standard";
is3D_ = false;
}
~oox_chart(){}
......@@ -37,6 +38,7 @@ public:
void set_formula_series (int ind,std::wstring val);
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);
//void set_showBubbleSize(bool Val){data_labels_.set_showBubbleSize(Val);}
//void set_showCatName(bool Val){data_labels_.set_showCatName(Val);}
......@@ -53,15 +55,14 @@ public:
oox_data_labels data_labels_;//dLbls (Data Labels) 21.2.2.49
std::vector<int> axisId_;//axId (Axis ID) 21.2.2.9
std::wstring grouping_; // clustered | percentStacked | stacked | standard
bool is3D_;
std::vector<int> axisId_; //axId (Axis ID) 21.2.2.9
std::wstring grouping_; // clustered | percentStacked | stacked | standard
std::vector<oox_series_ptr> series_; //ser (Bar Chart Series) 21.2.2.170
virtual void set_properties(std::vector<odf_reader::_property> g);
virtual void set_additional_properties(std::vector<odf_reader::_property> g){}
std::vector<oox_series_ptr> series_; //ser (Bar Chart Series) 21.2.2.170
//extLst (Chart Extensibility) 21.2.2.64
};
......
......@@ -247,7 +247,7 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
odf_reader::text_list_style * text_list_style = odf_context_.listStyleContainer().list_style_by_name(list_style_stack_.back());
if (text_list_style)
if ((text_list_style) && (Level < text_list_style->get_content().size()))
{
odf_reader::office_element_ptr elm = text_list_style->get_content()[Level];
odf_reader::office_element_ptr elm_list;
......
......@@ -113,10 +113,10 @@ public:
void calc_cache_series(std::wstring adress, std::vector<std::wstring> & cash);
void xlsx_convert(oox::xlsx_conversion_context & Context);
void docx_convert(oox::docx_conversion_context & Context);
void oox_convert(oox::oox_chart_context & chart);
void pptx_convert(oox::pptx_conversion_context & Context);
void xlsx_convert (oox::xlsx_conversion_context & Context);
void docx_convert (oox::docx_conversion_context & Context);
void oox_convert (oox::oox_chart_context & chart);
void pptx_convert (oox::pptx_conversion_context & Context);
double width_pt_;
double height_pt_;
......@@ -139,6 +139,7 @@ public:
std::vector<std::wstring> categories_;
std::wstring domain_cell_range_adress_;
std::wstring domain_cell_range_adress2_;
chart::title title_;
office_element_ptr_array title_odf_context_;
......@@ -147,29 +148,30 @@ public:
chart::simple legend_;
chart::plot_area plot_area_;
chart::simple wall_;
chart::simple floor_;
chart::simple wall_;
chart::simple floor_;
chart::simple footer_;
chart::simple footer_;
std::vector<_property> chart_properties_;
std::vector<_property> chart_graphic_properties_;
oox::_oox_fill chart_fill_;
std::vector<_property> chart_properties_;
std::vector<_property> chart_graphic_properties_;
oox::_oox_fill chart_fill_;
std::vector<_cell> cash_values;
public:
std::wstring target_table_;
std::wstring table_name_;
//---------------------------------------
std::wstring target_table_;
std::wstring table_name_;
int current_table_column_;
int current_table_row_;
int current_table_column_;
int current_table_row_;
std::vector<unsigned int> columns_;
unsigned int columns_count_;
unsigned int columns_spanned_num_;
std::vector<oox::xlsx_row_spanned> rows_spanned_;
unsigned int columns_spanned_num_;
std::vector<oox::xlsx_row_spanned> rows_spanned_;
std::vector<unsigned int> columns_;
unsigned int columns_count_;
///////////////////////////////////////////
......
......@@ -63,22 +63,24 @@ namespace chart {
};
struct axis: public simple
{
axis() : bCategories_(false), type_(3) {}
struct grid
{
enum grid_type {major, minor};
grid_type type_;
std::wstring style_name_;
grid_type type_;
std::wstring style_name_;
std::vector<_property> graphic_properties_;
};
bool bCategories_;
title title_;
std::wstring dimension_;
std::wstring chart_name_;
std::wstring style_name_;
std::vector<grid> grids_;
int type_;
};
struct series : public simple
......
......@@ -1248,8 +1248,11 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
draw_frame *frame = NULL;
chart_build objectBuild;
//if (!contentSubDoc)//Diagramma.odt -
// return;
if (contentSubDoc)//Diagramma.odt -
if (contentSubDoc)
{
process_build_chart process_build_object_(objectBuild, objectSubDoc.odf_context());
contentSubDoc->accept(process_build_object_);
......
......@@ -230,10 +230,9 @@ double text_format_properties_content::process_font_size_impl(const _CP_OPT(font
{
font_size usedFontSize = (!FontSize) ? font_size(percent(100)) : *FontSize;
if (usedFontSize.get_type() == font_size::Length &&
usedFontSize.get_length().get_unit() == length::pt)
if (usedFontSize.get_type() == font_size::Length)
{
const double w_val = 2.0 * Mul * usedFontSize.get_length().get_value();
const double w_val = 2.0 * Mul * usedFontSize.get_length().get_value_unit(length::pt);
return w_val;
}
else if (usedFontSize.get_type() == font_size::Percent)
......@@ -257,7 +256,7 @@ double text_format_properties_content::process_font_size_impl(const _CP_OPT(font
}
else
{
_CP_LOG << L"[docx_convert] convert font_size error (" << FontSize << ")\n";
//_CP_LOG << L"[docx_convert] convert font_size error (" << FontSize << ")\n";
}
return -1.0;
......@@ -1197,9 +1196,9 @@ void text_format_properties_content::apply_from(const text_format_properties_con
void text_format_properties_content::apply_to(std::vector<_property> & properties)
{
if (fo_font_weight_) properties.push_back(_property(L"font-weight", fo_font_weight_.get().get_type()) );
if (fo_font_family_) properties.push_back(_property(L"font-family",fo_font_family_.get()) );
if (style_font_name_) properties.push_back(_property(L"font-name",style_font_name_.get()) );
if (fo_font_size_) properties.push_back(_property(L"font-size", fo_font_size_.get().get_length().get_value()) );
if (fo_font_family_) properties.push_back(_property(L"font-family", fo_font_family_.get()) );
if (style_font_name_) properties.push_back(_property(L"font-name", style_font_name_.get()) );
if (fo_font_size_) properties.push_back(_property(L"font-size", fo_font_size_.get().get_length().get_value_unit(length::pt)) );
if (fo_font_style_) properties.push_back(_property(L"font-style", fo_font_style_.get().get_type()) );
if (fo_color_) properties.push_back(_property(L"font-color", fo_color_.get().get_hex_value()) );
......
......@@ -55,16 +55,12 @@ void table_table_row_attlist::add_attributes( const xml::attributes_wc_ptr & Att
void table_table_cell_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:number-columns-repeated", table_number_columns_repeated_, (unsigned int)1/*0*/);
CP_APPLY_ATTR(L"table:style-name", table_style_name_);
CP_APPLY_ATTR(L"table:style-name", table_style_name_);
CP_APPLY_ATTR(L"table:content-validation-name", table_content_validation_name_);
CP_APPLY_ATTR(L"table:formula", table_formula_);
common_value_and_type_attlist tmp;
if (tmp.add_attributes(Attributes))
common_value_and_type_attlist_ = tmp;
CP_APPLY_ATTR(L"table:protect", table_protect_, (bool)table_protect_);
CP_APPLY_ATTR(L"table:formula", table_formula_);
CP_APPLY_ATTR(L"table:protect", table_protect_, (bool)table_protect_);
common_value_and_type_attlist_.add_attributes(Attributes);
}
// table-table-cell-attlist-extra
......
......@@ -67,7 +67,7 @@ public:
_CP_OPT(std::wstring) table_content_validation_name_;
_CP_OPT(std::wstring) table_formula_;
_CP_OPT(odf_types::common_value_and_type_attlist) common_value_and_type_attlist_;
odf_types::common_value_and_type_attlist common_value_and_type_attlist_;
bool table_protect_; // default false
......
......@@ -619,9 +619,9 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
office_value_type::type odf_value_type = office_value_type::Custom;
if (table_table_cell_attlist_.common_value_and_type_attlist_)
//if (table_table_cell_attlist_.common_value_and_type_attlist_)
{
const common_value_and_type_attlist & attr = *table_table_cell_attlist_.common_value_and_type_attlist_;
const common_value_and_type_attlist & attr = table_table_cell_attlist_.common_value_and_type_attlist_;
if (attr.office_value_type_)
odf_value_type = attr.office_value_type_->get_type();
......
......@@ -26,7 +26,7 @@ int _tmain(int argc, _TCHAR* argv[])
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"password1", L"C:\\Windows\\Fonts", NULL);
hr = ConvertXls2Xlsx(srcFileName, dstTempPath, L"", L"C:\\Windows\\Fonts", NULL);
if (hr == S_OK)
{
......
......@@ -33,16 +33,23 @@ void FilePass::writeFields(CFRecord& record)
void FilePass::readFields(CFRecord& record)
{
bool bEnabled = false;
record >> wEncryptionType;
if(!wEncryptionType)
{
record >> key;
Log::info("FilePass: Encryption type: XOR");
throw;// EXCEPT::STOP::FileIsEncrypted();
//throw EXCEPT::STOP::FileIsEncrypted();
return;
}
else
{
bEnabled = true;
majorVer = *record.getCurData<unsigned short>();
if(0x0001 == majorVer) // RC4 encryption header structure
{
rc4HeaderPtr = CRYPTO::RC4EncryptionHeaderPtr(new CRYPTO::RC4EncryptionHeader());
......@@ -58,10 +65,12 @@ void FilePass::readFields(CFRecord& record)
{
record >> rc4CryptoAPIHeader;
Log::info("FilePass: Encryption type: RC4 Non-Standard");
throw;// EXCEPT::STOP::FileIsEncrypted();
}
}
if (bEnabled == false && record.getGlobalWorkbookInfo()->decryptor)
record.getGlobalWorkbookInfo()->decryptor.reset();
}
} // namespace XLS
......
......@@ -26,14 +26,12 @@ public:
static const ElementType type = typeFilePass;
//-----------------------------
Boolean<unsigned short> wEncryptionType;
XORObfuscation key;
_UINT16 majorVer;
CRYPTO::RC4EncryptionHeaderPtr rc4HeaderPtr;
CRYPTO::RC4CryptoAPIEncryptionHeader rc4CryptoAPIHeader;
};
} // namespace XLS
......
......@@ -151,7 +151,11 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
if (( proc.getGlobalWorkbookInfo()->decryptor) &&
( proc.getGlobalWorkbookInfo()->decryptor->IsVerify() == false))
{
return false;
if (proc.getGlobalWorkbookInfo()->password.empty())
{
if (!proc.getGlobalWorkbookInfo()->decryptor->SetPassword(L"VelvetSweatshop"))
return false;
}else return false;
}
}
}break;
......
......@@ -15,7 +15,18 @@ PropertySetStream::PropertySetStream(XLS::CFStreamPtr stream)
unsigned int NumPropertySets=0;
_GUID_ Clsid={};
*stream >> ByteOrder >> Version >> SystemIdentifier >> Clsid >> NumPropertySets;
*stream >> ByteOrder >> Version >> SystemIdentifier;
if (ByteOrder != 0xFFFE) //file (53).xls
return;
if (Version != 0x01 && Version != 0x00)
return;
*stream >> SystemIdentifier >> Clsid >> NumPropertySets;
if (NumPropertySets != 0x01 && NumPropertySets != 0x02)
return;
std::vector<unsigned int> property_sets_offsets;
for(unsigned int i = 0; i < NumPropertySets; ++i)
......@@ -23,7 +34,9 @@ PropertySetStream::PropertySetStream(XLS::CFStreamPtr stream)
_GUID_ FMTID;
unsigned int Offset;
*stream >> FMTID >> Offset;
property_sets_offsets.push_back(Offset);
if (Offset > 0)
property_sets_offsets.push_back(Offset);
}
for(unsigned int i = 0; i < NumPropertySets; ++i)
......
......@@ -287,10 +287,13 @@ namespace agg
double c1 = -(projects[iMin].x * m_cos + projects[iMin].y * m_sin);
double c2 = -(projects[iMax].x * m_cos + projects[iMax].y * m_sin);
m_factor.x = m_cos / dFactor;
m_factor.y = m_sin / dFactor;
m_offset.x = c1 / dFactor;
m_offset.y = c2 / dFactor;
if (abs(dFactor) > FLT_EPSILON)
{
m_factor.x = m_cos / dFactor;
m_factor.y = m_sin / dFactor;
m_offset.x = c1 / dFactor;
m_offset.y = c2 / dFactor;
}
}
private:
......
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