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

миноритарные свойства диаграмм

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56226 954022d7-b5bf-4e40-9824-e11837661b57
parent 5f53c262
......@@ -60,6 +60,8 @@ public:
std::wstring convert_spacechar(std::wstring expr);
int get_count_value_points(std::wstring expr);
// // =[.A1]+[.B1] -> table = ""; ref = "A1"
// // of:=['Sheet2 A'.B2] -> table= "Sheet2 A"; ref = "B2"
// bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
......
......@@ -3,7 +3,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/regex.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
namespace cpdoccore {
namespace formulasconvert {
......@@ -459,14 +459,14 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring& expr)
//â
//Sheet2.C3:Sheet2.C19 Sheet2.L29:Sheet2.L36
//todooo
std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring& expr)
std::wstring oox2odf_converter::Impl::convert_chart_distance(const std::wstring& expr1)
{
if (is_forbidden1(expr))
return L"NULLFORMULA()";
std::wstring expr = expr1;
int res = expr.find(L"(");
if (res >=0) expr = expr.substr(res + 1, expr.size()-1);
//std::wstring workstr = expr;
//replace_space(workstr);
//return workstr;
res= expr.find(L")");
if (res >=0) expr = expr.substr(0, res);
//ðàñïàðñèòü ïî äèàïàçîíàì - îäô-ïðîáåë, èê-ýëü-çàïÿòàÿ
......@@ -561,6 +561,94 @@ std::wstring oox2odf_converter::convert_spacechar(std::wstring expr)
}
return expr;
}
size_t getColAddressInv(const std::wstring & a_)
{
std::wstring a = a_;
::boost::algorithm::to_upper(a);
static const size_t r = (L'Z' - L'A' + 1);
size_t mul = 1;
bool f = true;
size_t res = 0;
BOOST_REVERSE_FOREACH(const wchar_t c, a)
{
size_t v = c - L'A';
if (f)
f = false;
else
v += 1;
res += v * mul;
mul *= r;
}
return res;
}
size_t getRowAdderssInv(const std::wstring & a_)
{
int sz = a_.length();
if (a_.length()>0)
{
return boost::lexical_cast<size_t>(a_)-1;
}
else
return 0;
}
void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring & row)
{
std::wstring a = a_;
std::reverse(a.begin(), a.end());
::boost::algorithm::replace_all(a, L"$", L"");
//::boost::algorithm::replace_all(a, L"'", L"");
::boost::algorithm::to_upper(a);
BOOST_FOREACH(wchar_t c, a)
{
if (c >= L'0' && c <= L'9')
row +=c;
else
col += c;
}
std::reverse(col.begin(), col.end());
std::reverse(row.begin(), row.end());
}
void getCellAddressInv(const std::wstring & a_, int & col, int & row)
{
std::wstring colStr=L"", rowStr=L"";
splitCellAddress(a_, colStr, rowStr);
col = getColAddressInv(colStr);
row = getRowAdderssInv(rowStr);
}
int oox2odf_converter::get_count_value_points(std::wstring expr)
{
int count =0;
std::vector< std::wstring > splitted;
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
for (long i=0; i < splitted.size(); i++)
{
int res = splitted[i].find(L"!");
if (res > 0) splitted[i] = splitted[i].substr(res+1, splitted[i].size()-res);
std::vector< std::wstring >cells;
boost::algorithm::split(cells, splitted[i], boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
if (cells.size() >1)
{
int col_1, row_1, col_2, row_2;
getCellAddressInv(cells[0],col_1,row_1);
getCellAddressInv(cells[1],col_2,row_2);
count += std::max(col_2-col_1+1, row_2-row_1+1);
}
else count ++;
}
return count;
}
//bool oox2odf_converter::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
//{
......
......@@ -295,7 +295,7 @@ std::wstring xlsx_text_context::Impl::dump_text()
CP_XML_NODE(prefix_draw + L"t")
{
CP_XML_ATTR(L"xml:space", L"preserve");
if (!in_draw)CP_XML_ATTR(L"xml:space", L"preserve");
CP_XML_STREAM() << content;
}
}
......
......@@ -107,6 +107,7 @@ namespace odf
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0");
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart");
CP_XML_ATTR(L"office:version", L"1.2");
CP_XML_NODE(L"office:meta")
{
......@@ -294,6 +295,7 @@ namespace odf
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
......@@ -356,6 +358,7 @@ namespace odf
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
......
......@@ -30,16 +30,24 @@ public:
odf_text_context *text_context();
void start_chart(office_element_ptr & root);
void set_type_chart(std::wstring type);
void set_3D(bool Val);
void set_size_chart(double width_pt, double height_pt);
void set_chart_type(std::wstring type);
void set_chart_3D(bool Val);
void set_chart_size(double width_pt, double height_pt);
void set_chart_colored(bool val);
void set_chart_scatter_type(int type);
void set_marker_size(int size);
void set_marker_type(int type);
void start_group_series();
void add_axis_group_series(unsigned int id);
void start_series(std::wstring type);
void set_series_value_formula(std::wstring oox_formula);
void set_series_label_formula(std::wstring oox_formula);
void set_category_axis_formula(std::wstring oox_formula);
void set_category_axis_formula(std::wstring oox_formula,int type);
void start_data_point_series(int count);
long get_count_data_points_series();
void end_series();
void end_group_series();
void set_label_name(std::wstring name);
......@@ -66,6 +74,8 @@ public:
void start_grid(int type);
void start_plot_area();
void start_legend();
void start_floor();
void start_wall();
void set_legend_position(int val);
void start_element(office_element_ptr & elm, office_element_ptr & style_elm, std::wstring style_name);
......@@ -74,6 +84,7 @@ public:
void start_text();
void end_text();
void add_domain(std::wstring formula);
void add_categories(std::wstring formula, office_element_ptr & axis);
void set_layout_x(double *val,int mode);
......
......@@ -2,6 +2,7 @@
#include <boost_filesystem_version.h>
#include <cpdoccore/CPOptional.h>
#include <atlcoll.h>
static std::wstring string2std_string(CString val)
{
......@@ -293,7 +294,7 @@ public:
void convert(OOX::Spreadsheet::CT_ScatterSer *ser);
void convert(OOX::Spreadsheet::CT_RadarSer *ser);
void convert(OOX::Spreadsheet::CT_LineSer *ser);
void convert(OOX::Spreadsheet::CT_AxDataSource *cat);
void convert(OOX::Spreadsheet::CT_AxDataSource *cat, int type);
void convert(OOX::Spreadsheet::CT_NumDataSource *val);
void convert(OOX::Spreadsheet::CRichText *rich);
void convert(OOX::Spreadsheet::CTextProperties *txPr);
......@@ -303,6 +304,8 @@ public:
void convert(OOX::Spreadsheet::CT_ChartLines *grid, int type);
void convert(OOX::Spreadsheet::CT_SerTx *ser_tx);
void convert(OOX::Spreadsheet::CT_DLbls *ser_lbls);
void convert(OOX::Spreadsheet::CT_Marker *marker, int count);
void convert(OOX::Spreadsheet::CT_Marker *marker, CAtlArray<OOX::Spreadsheet::CT_DPt*> & dPt);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
void convert(double oox_font_size, cpdoccore::_CP_OPT(cpdoccore::odf::font_size) & odf_font_size);
};
......
......@@ -1266,9 +1266,11 @@ void XlsxConverter::convert(OOX::Spreadsheet::CGraphicFrame* oox_graphic_frame)
if (pChart)
{
OoxConverter::convert(pChart->m_oChartSpace.m_oSpPr.GetPointer());
oox_current_chart = pChart;
odf_context()->start_chart();
odf_context()->chart_context()->set_size_chart(width, height);
odf_context()->chart_context()->set_chart_size(width, height);
OoxConverter::convert(&pChart->m_oChartSpace);
odf_context()->end_chart();
oox_current_chart = NULL; // object???
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//42
#define INTVER 1,2,0,42
#define STRVER "1,2,0,42\0"
//43
#define INTVER 1,2,0,43
#define STRVER "1,2,0,43\0"
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