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

(1.0.1.197): ASCOfficeOdfFile

25141

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57093 954022d7-b5bf-4e40-9824-e11837661b57
parent df14c70f
......@@ -2,6 +2,6 @@
//1
//0
//1
//196
#define INTVER 1,0,1,196
#define STRVER "1,0,1,196\0"
//197
#define INTVER 1,0,1,197
#define STRVER "1,0,1,197\0"
......@@ -124,11 +124,12 @@ void oox_axis_content::oox_serialize_content(std::wostream & _Wostream)
//oox_serialize_ln(_Wostream,content_.graphic_properties_);
oox_chart_shape shape;
shape.content_ = content_.graphic_properties_;
shape.set(content_.graphic_properties_,content_.fill_) ;
shape.oox_serialize(_Wostream);
BOOST_FOREACH(odf::chart::axis::grid const & g, content_.grids_)
BOOST_FOREACH(odf::chart::axis::grid & g, content_.grids_)
{
shape.content_ = g.graphic_properties_;
_oox_fill fill_null;
shape.set(g.graphic_properties_, fill_null);
if (g.type_ == odf::chart::axis::grid::major)
{
......
......@@ -71,7 +71,7 @@ void oox_chart_context::write_to(std::wostream & strm)
}
}
oox_chart_shape shape;
shape.content_ = graphic_properties_;
shape.set(graphic_properties_,fill_);
shape.oox_serialize(CP_XML_STREAM());
......
......@@ -61,6 +61,7 @@ public:
{
//plot_area_.wall_graphic_properties_ = l.graphic_properties_;
plot_area_.graphic_properties_ = l.graphic_properties_;
plot_area_.fill_ = l.fill_;
}
void set_floor(odf::chart::simple & l)
{
......@@ -71,23 +72,26 @@ public:
legend_.content_= l;
}
void set_chart_graphic_properties(std::vector<odf::_property> & prop)
void set_chart_graphic_properties(std::vector<odf::_property> & prop, _oox_fill &fill)
{
graphic_properties_= prop;
fill_ = fill;
}
void set_plot_area_properties(std::vector<odf::_property> & prop)
void set_plot_area_properties(std::vector<odf::_property> & prop, _oox_fill &fill)
{
plot_area_.properties_ = prop;
plot_area_.properties_ = prop;
plot_area_.fill_ = fill;
}
private:
class Impl;
_CP_SCOPED_PTR(Impl) impl_;
cpdoccore::oox::oox_title title_;
cpdoccore::oox::oox_plot_area plot_area_;
cpdoccore::oox::oox_chart_legend legend_;
cpdoccore::oox::oox_title title_;
cpdoccore::oox::oox_plot_area plot_area_;
cpdoccore::oox::oox_chart_legend legend_;
std::vector<odf::_property> graphic_properties_;
std::vector<odf::_property> graphic_properties_;
_oox_fill fill_;
};
//autoTitleDeleted (Auto Title Is Deleted) 21.2.2.7
......
......@@ -72,11 +72,11 @@ void oox_chart_legend::oox_serialize(std::wostream & _Wostream)
CP_XML_ATTR(L"val", "r");// "b" | "l" | "r" | "t"// == bottom left right top
}
shape.content_ = content_.graphic_properties_;
shape.set(content_.graphic_properties_,content_.fill_);
shape.oox_serialize(CP_XML_STREAM());
oox_chart_shape shape;
shape.content_ = content_.graphic_properties_;
//oox_chart_shape shape;
//shape.set(content_.graphic_properties_,content_.fill_);
oox_serialize_default_text(CP_XML_STREAM());
......
......@@ -54,11 +54,22 @@ void oox_chart_series::setName(std::wstring &value)
void oox_chart_series::setFormula(int ind, std::wstring &value)
{
formulasconvert::odf2oox_converter converter;
values_[ind].numRef_.formula=converter.convert_chart_distance(value);
values_[ind].numRef_.present = true;
values_[ind].present = true;
if (ind == 4)
{
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;
}
else
{
values_[ind].numRef_.formula=converter.convert_chart_distance(value);
values_[ind].numRef_.present = true;
values_[ind].present = true;
}
}
void oox_chart_series::parse_properties()
......@@ -81,11 +92,22 @@ 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;
BOOST_FOREACH(std::wstring & v, values)
{
boost::algorithm::trim(v);
values_[ind].numRef_.num_cash.push_back(v);
values_[ind].numRef_.num_cash_count++;
if (ind == 4)
{
values_[ind].strRef_.str_cash.push_back(v);
values_[ind].strRef_.str_cash_count++;
}
else
{
values_[ind].numRef_.num_cash.push_back(v);
values_[ind].numRef_.num_cash_count++;
}
}
}
void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
......@@ -93,7 +115,7 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
parse_properties();
oox_chart_shape shape;
shape.content_ = content_.graphic_properties_;
shape.set(content_.graphic_properties_, content_.fill_);
CP_XML_WRITER(_Wostream)
{
......@@ -107,7 +129,8 @@ 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 < 4; i++)
{
if (values_[i].present)
{
......@@ -134,12 +157,12 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_ATTR(L"val", values_[i].numRef_.num_cash_count);
}
int i=0;
int j=0;
BOOST_FOREACH(std::wstring & v, values_[i].numRef_.num_cash)
{
CP_XML_NODE(L"c:pt")
{
CP_XML_ATTR(L"idx", i++);
CP_XML_ATTR(L"idx", j++);
CP_XML_NODE(L"c:v")
{
CP_XML_CONTENT(boost::lexical_cast<double>(v));
......@@ -150,13 +173,46 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
}
}
}
//if (values_[i].strRef_.present)
//{
// CP_XML_NODE(L"c:strRef")
// {
// CP_XML_NODE(L"c:f")
// {
// CP_XML_CONTENT(values_[i].strRef_.formula);
// }
//
// if (values_[i].strRef_.str_cash_count>0)
// {
// CP_XML_NODE(L"c:strCache")//
// {
// CP_XML_NODE(L"c:ptCount")
// {
// CP_XML_ATTR(L"val", values_[i].strRef_.str_cash_count);
// }
// int j=0;
// BOOST_FOREACH(std::wstring & v, values_[i].strRef_.str_cash)
// {
// CP_XML_NODE(L"c:pt")
// {
// CP_XML_ATTR(L"idx", j++);
// CP_XML_NODE(L"c:v")
// {
// CP_XML_CONTENT(v);
// }
// }
// }
// }
// }
// }
//}
}
}
}
if (content_.regression_curve_.line_properties_.size()>0)
{
std::wstring typeTrendline= L"log"; //"exp" | "linear" | "log" | "movingAvg" | "poly" | "power"
shape.content_ = content_.regression_curve_.line_properties_;
shape.set(content_.regression_curve_.line_properties_,_oox_fill());
_CP_OPT(int) iType;
odf::GetProperty(content_.properties_, L"regression-type",iType); // none, linear, logarithmic, exponential, power
......@@ -184,12 +240,12 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:trendlineLbl")
{
shape.content_ = content_.regression_curve_.equation_properties_.graphic_properties_;
shape.set(content_.regression_curve_.equation_properties_.graphic_properties_,content_.regression_curve_.equation_properties_.fill_);
shape.oox_serialize(CP_XML_STREAM());
}
}
shape.content_ = content_.regression_curve_.line_properties_;
shape.set( content_.regression_curve_.line_properties_,_oox_fill());
shape.oox_serialize(CP_XML_STREAM());
......
......@@ -22,6 +22,7 @@ public:
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;
}
......@@ -30,7 +31,7 @@ public:
void oox_serialize_common(std::wostream & _Wostream);
virtual void oox_serialize(std::wostream & _Wostream){}
_oox_chart_values values_[4]; //common,x, y, bubble
_oox_chart_values values_[5]; //common,x, y, bubble, cat(labels)
int id_;
......
......@@ -15,19 +15,23 @@ namespace oox {
void oox_chart_shape::oox_serialize(std::wostream & _Wostream)
{
_CP_OPT(std::wstring) strVal;
_CP_OPT(double) dVal;
_CP_OPT(int) iVal;
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"c:spPr")
{
oox_serialize_fill(CP_XML_STREAM(),fill);
oox_serialize_fill(CP_XML_STREAM(),fill_);
oox_serialize_ln(CP_XML_STREAM(),content_);
}
}
}
void oox_chart_shape::set(std::vector<odf::_property> & prop,_oox_fill & fill)
{
content_ = prop;
fill_ = fill;
}
}
}
......@@ -15,12 +15,14 @@ class oox_chart_shape: boost::noncopyable
public:
oox_chart_shape(){}
~oox_chart_shape(){}
void set(std::vector<odf::_property> & prop,_oox_fill & fill);
void oox_serialize(std::wostream & _Wostream);
private:
std::vector<odf::_property> content_;
_oox_fill fill;
_oox_fill fill_;
private:
......
......@@ -27,6 +27,15 @@ struct _oox_numLit
// int formatCode;
// std::vector<std::wstring>num_cash;
//};
struct _oox_strRef
{
bool present;
std::wstring formula;
int str_cash_count;
std::vector<std::wstring>str_cash;
};
struct _oox_numRef
{
bool present;
......@@ -51,6 +60,9 @@ public:
numRef_.formatCode = L"General";
numRef_.num_cash_count=0;
strRef_.present=false;
strRef_.str_cash_count=0;
present = false;
}
......@@ -59,6 +71,8 @@ public:
_oox_numLit numLit_;
_oox_numRef numRef_;
_oox_strRef strRef_;
};
//numLit (Number Literal) 21.2.2.122
//numRef (Number Reference) 21.2.2.123
......
......@@ -60,6 +60,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf::_property> &
_CP_OPT(std::wstring) strVal;
_CP_OPT(int) iVal;
_CP_OPT(double) dVal;
odf::GetProperty(prop,L"stroke-color",strVal);
odf::GetProperty(prop,L"stroke",iVal);
odf::GetProperty(prop,L"stroke-width",dVal);
......
......@@ -61,7 +61,7 @@ void oox_plot_area::oox_serialize(std::wostream & _Wostream)
reset_cross_axis();
oox_chart_shape shape;
shape.content_ = graphic_properties_;
shape.set(graphic_properties_, fill_);
CP_XML_WRITER(_Wostream)
{
......
......@@ -22,6 +22,8 @@ public:
std::vector<odf::_property> graphic_properties_;
std::vector<odf::_property> properties_;
_oox_fill fill_;
//std::vector<odf::_property> wall_graphic_properties_;
void oox_serialize(std::wostream & _Wostream);
......
......@@ -369,7 +369,7 @@ void oox_stock_chart::set_properties(std::vector<odf::_property> g)
void oox_stock_chart::oox_serialize(std::wostream & _Wostream)
{
oox_chart_shape shape;
shape.content_ = graphic_properties_;
shape.set(graphic_properties_, fill_);
CP_XML_WRITER(_Wostream)
{
......
......@@ -294,6 +294,8 @@ class oox_stock_chart: public oox_chart
std::vector<odf::_property> properties_;
std::vector<odf::_property> graphic_properties_;
_oox_fill fill_;
//dropLines (Drop Lines) 21.2.2.53
//hiLowLines (High Low Lines) 21.2.2.80
//ser (Line Chart Series) 21.2.2.171
......
......@@ -96,6 +96,8 @@ public:
void end_axis();
void add_categories(std::wstring const & cellRangeAddress);
void add_grid(std::wstring const & className, std::wstring const & styleName);
void add_series(std::wstring const & cellRangeAddress,
std::wstring const & labelCell,
......@@ -124,8 +126,10 @@ public:
std::wstring name_;
bool in_axis_;
std::vector<chart::axis> axises_;
std::vector<chart::series> series_;
std::vector<chart::axis> axises_;
std::vector<chart::series> series_;
std::vector<std::wstring> categories_;
std::wstring domain_cell_range_adress_;
chart::title title_;
......@@ -134,15 +138,16 @@ public:
chart::title sub_title_;
chart::simple legend_;
chart::simple plot_area_;
chart::plot_area plot_area_;
chart::simple wall_;
chart::simple floor_;
chart::simple footer_;
std::vector<_property> chart_properties_;
std::vector<_property> chart_graphic_properties_;
std::vector<_property> chart_properties_;
std::vector<_property> chart_graphic_properties_;
oox::_oox_fill chart_fill_;
std::vector<_cell> cash_values;
public:
......@@ -217,10 +222,11 @@ class process_build_chart : public base_visitor,
{
public:
process_build_chart(chart_build & chartBuild, styles_container & styles):
process_build_chart(chart_build & chartBuild, styles_container & styles, styles_lite_container & draw_styles):
stop_(false)
,chart_build_(chartBuild)
,styles_(styles)
,draw_styles_(draw_styles)
{
_CP_LOG(warning) << L"[process_draw_object] \"" << L"\"" << std::endl;
......@@ -229,7 +235,7 @@ public:
private:
void ApplyChartProperties(std::wstring style,std::vector<_property> & propertiesOut);
void ApplyTextProperties(std::wstring style,std::vector<_property> & propertiesOut);
void ApplyGraphicProperties(std::wstring style,std::vector<_property> & propertiesOut);
void ApplyGraphicProperties(std::wstring style,std::vector<_property> & propertiesOut, oox::_oox_fill & fill);
bool visit_table(std::wstring const & name);
void visit_column(unsigned int repeated);
......@@ -283,8 +289,10 @@ public:
private:
bool stop_;
chart_build & chart_build_;
styles_container & styles_;
chart_build & chart_build_;
styles_container & styles_;
styles_lite_container & draw_styles_;
};
......
#pragma once
#include <cpdoccore/xml/attributes.h>
#include "..\docx\oox_drawing_fills.h"
// ( ) xlsx & odf -
namespace cpdoccore {
......@@ -43,6 +43,7 @@ namespace chart {
std::vector<_property> properties_;
std::vector<_property> text_properties_;
std::vector<_property> graphic_properties_;
oox::_oox_fill fill_;
};
struct treadline
{
......@@ -54,7 +55,13 @@ namespace chart {
treadline(){bEquation = false;bREquation = false;}
};
struct axis
struct plot_area : public simple
{
std::wstring cell_range_address_;
//series_in_column_or_row
//uses_first_as_label
};
struct axis: public simple
{
struct grid
{
......@@ -73,11 +80,8 @@ namespace chart {
std::wstring style_name_;
std::vector<grid> grids_;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
std::vector<_property> graphic_properties_;
};
struct series
struct series : public simple
{
struct point
{
......@@ -101,10 +105,6 @@ namespace chart {
simple error_indicator_;
treadline regression_curve_;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
std::vector<_property> graphic_properties_;
series(){}
series(
std::wstring const & rangeAddress,
......
......@@ -1182,7 +1182,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
return;
chart_build chartBuild;
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer());
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer(),objectSubDoc.odf_context().drawStyles());
contentSubDoc->accept(process_build_chart_);
if (chartBuild.object_type_ != 1)return;
......
......@@ -267,7 +267,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
chart_build chartBuild;
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer());
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer(),objectSubDoc.odf_context().drawStyles());
contentSubDoc->accept(process_build_chart_);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -238,7 +238,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
chart_build chartBuild;
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer());
process_build_chart process_build_chart_(chartBuild,objectSubDoc.odf_context().styleContainer(),objectSubDoc.odf_context().drawStyles() );
contentSubDoc->accept(process_build_chart_);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
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