Commit 362cad18 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfReader - поправлены составные/разрывные диапазоны в диаграммах Book 50.ods

parent 23ed051a
......@@ -233,6 +233,20 @@ std::wstring replace_vertical_formater(boost::wsmatch const & what)
else if (what[3].matched)
return what[3].str();
}
std::wstring replace_space_PROBEL(boost::wsmatch const & what)
{
if (what[1].matched)
{
std::wstring inner = what[1].str();
boost::algorithm::replace_all(inner, L" ", L"PROBEL");
return inner;
}
else if (what[2].matched)
return what[2].str();
else if (what[3].matched)
return what[3].str();
}
std::wstring replace_space_formater(boost::wsmatch const & what)
{
if (what[1].matched)
......@@ -332,16 +346,24 @@ std::wstring odf2oox_converter::Impl::convert_chart_distance(const std::wstring&
if (is_forbidden(expr))
return L"NULLFORMULA()";
//std::wstring workstr = expr;
std::wstring workstr = expr;
//replace_space(workstr);
//return workstr;
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");
// boost::wregex complexRef(L"(\\'(.*?)\\')"); // ïîèñê òîãî ÷òî â àïîñòðîôàõ è çàìåíà òàì ïðîáåëîâ íà PROBEL
workstr = boost::regex_replace(
expr,
complexRef,
&replace_space_PROBEL,
boost::match_default | boost::format_all);
//ðàñïàðñèòü ïî äèàïàçîíàì - îäô-ïðîáåë, èê-ýëü-çàïÿòàÿ
std::vector<std::wstring> distance_inp;
std::vector<std::wstring> distance_out;
boost::algorithm::split(distance_inp,expr, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
boost::algorithm::split(distance_inp, workstr, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d,distance_inp)
{
......@@ -367,21 +389,23 @@ std::wstring odf2oox_converter::Impl::convert_chart_distance(const std::wstring&
int res1 = sheet.find(L"-");
int res2 = sheet.find(L"'");
if (res1>=0 && !(res2==0))
if (res1 >= 0 && !(res2 == 0))
{
sheet = L"'" + sheet + L"'";
}
distance_out.push_back(sheet+L"!"+cells_out.substr(0, cells_out.size()-1));
distance_out.push_back(sheet+L"!" + cells_out.substr(0, cells_out.size()-1));
}
std::wstring result;
BOOST_FOREACH(std::wstring &d,distance_out)
BOOST_FOREACH(std::wstring &d, distance_out)
{
result.append(d);
result.append(L",");
}
return result.substr(0, result.size()-1);
boost::algorithm::replace_all(result, L"PROBEL", L" ");
return result.substr(0, result.size()-1);// ìèíóñ ïîñëåäíÿÿ ëèøíÿÿ çàïÿòàÿ
}
odf2oox_converter::odf2oox_converter(): impl_(new odf2oox_converter::Impl)
{
......
......@@ -356,8 +356,18 @@ void oox_chart_series::oox_serialize_common(std::wostream & _Wostream)
if (data_labels_)
data_labels_->oox_serialize(_Wostream);
int indPoint = 0;
bool bEmpty_dPt = true;
for (int i = 0 ; i < content_.points_.size(); i++)
{
if (content_.points_[i].graphic_properties_.size() > 0 ||
content_.points_[i].fill_.type >= 0)
{
bEmpty_dPt = false;
}
}
int indPoint = 0;
for (int i = 0 ; !bEmpty_dPt && i < content_.points_.size(); i++)
{
for (int j = 0 ; j < content_.points_[i].repeated_; j++)
{
......
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