Commit 89ce79da authored by Alexey Golubev's avatar Alexey Golubev

v4.4.2

parents ef389872 3982ac06
...@@ -87,9 +87,10 @@ public: ...@@ -87,9 +87,10 @@ public:
std::wstring convert_conditional_formula(std::wstring const & expr); std::wstring convert_conditional_formula(std::wstring const & expr);
// Лист1!$A$1 -> $Лист1.$A$1 // Лист1!$A$1 -> $Лист1.$A$1
std::wstring convert_named_ref(std::wstring const & expr); std::wstring convert_named_ref (std::wstring const & expr);
std::wstring convert_named_formula(std::wstring const & expr);
std::wstring find_base_cell(std::wstring const & expr); std::wstring get_base_cell_formula(std::wstring const & expr);
//Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19 //Sheet2!C3:C19 -> Sheet2.C3:Sheet2.C19
std::wstring convert_chart_distance(std::wstring const & expr); std::wstring convert_chart_distance(std::wstring const & expr);
......
...@@ -57,6 +57,7 @@ namespace formulasconvert { ...@@ -57,6 +57,7 @@ namespace formulasconvert {
static std::wstring replace_named_ref_formater1(boost::wsmatch const & what); static std::wstring replace_named_ref_formater1(boost::wsmatch const & what);
static std::wstring replace_cell_range_formater(boost::wsmatch const & what); static std::wstring replace_cell_range_formater(boost::wsmatch const & what);
void replace_named_formula(std::wstring & expr, bool w = true);
void replace_named_ref(std::wstring & expr, bool w = true); void replace_named_ref(std::wstring & expr, bool w = true);
bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref); bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref);
bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last); bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
...@@ -209,7 +210,7 @@ namespace formulasconvert { ...@@ -209,7 +210,7 @@ namespace formulasconvert {
{ {
convert_with_TableName = withTableName; convert_with_TableName = withTableName;
//boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]"); //boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}\\]"); boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
/* /*
[ $ Sheet2 . A1 : . B5 ] [ $ Sheet2 . A1 : . B5 ]
*/ */
...@@ -226,7 +227,7 @@ namespace formulasconvert { ...@@ -226,7 +227,7 @@ namespace formulasconvert {
convert_with_TableName = withTableName; convert_with_TableName = withTableName;
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}"); //boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}"); boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
const std::wstring res = boost::regex_replace( const std::wstring res = boost::regex_replace(
expr, expr,
...@@ -263,15 +264,12 @@ namespace formulasconvert { ...@@ -263,15 +264,12 @@ namespace formulasconvert {
return what[2].str(); return what[2].str();
else if (what[3].matched) else if (what[3].matched)
return what[3].str(); return what[3].str();
//else if (what[4].matched)
// return what[4].str();
else else
return L""; return L"";
} }
// TODO // TODO
// заменить точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*-- // заменить точки с запятой во всех вхождениях кроме находящихся в кавычках --*и в фигурных скобках*--
// TODO: проверить как сохраняются кавычки в строке
void odf2oox_converter::Impl::replace_semicolons(std::wstring& expr) void odf2oox_converter::Impl::replace_semicolons(std::wstring& expr)
{ {
const std::wstring res = boost::regex_replace( const std::wstring res = boost::regex_replace(
......
...@@ -43,6 +43,7 @@ namespace formulasconvert { ...@@ -43,6 +43,7 @@ namespace formulasconvert {
class oox2odf_converter::Impl class oox2odf_converter::Impl
{ {
public: public:
std::wstring convert(const std::wstring& expr); std::wstring convert(const std::wstring& expr);
std::wstring convert_formula(const std::wstring& expr); std::wstring convert_formula(const std::wstring& expr);
std::wstring convert_conditional_formula(const std::wstring& expr); std::wstring convert_conditional_formula(const std::wstring& expr);
...@@ -59,93 +60,17 @@ public: ...@@ -59,93 +60,17 @@ public:
static std::wstring replace_arguments(boost::wsmatch const & what); static std::wstring replace_arguments(boost::wsmatch const & what);
static std::wstring convert_scobci(boost::wsmatch const & what); static std::wstring convert_scobci(boost::wsmatch const & what);
std::wstring replace_arguments1(std::wstring & workstr);
void replace_named_ref(std::wstring & expr); void replace_named_ref(std::wstring & expr);
void replace_named_formula(std::wstring & expr);
std::wstring find_base_cell(const std::wstring & expr); static bool isFindBaseCell_;
// bool find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref); static std::wstring base_cell_formula_;
//bool find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last);
}; };
////Table!.$A$1:$A2 -> ref $A$1 -> ref $A$2
//bool oox2odf_converter::Impl::find_first_last_ref(std::wstring const & expr, std::wstring & table,std::wstring & ref_first,std::wstring & ref_last) bool oox2odf_converter::Impl::isFindBaseCell_ = false;
//{ std::wstring oox2odf_converter::Impl::base_cell_formula_ = L"";
// std::vector< std::wstring > splitted;
//
// boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L".:"), boost::algorithm::token_compress_on);
//
// if (splitted.size()>2)
// {
// table = splitted[0];
// ref_first = splitted[1];
// ref_last = splitted[2];
// return true;
// }
// return false;
//}
// // =[.A1]+[.B1] -> table = ""; ref = "A1"
// // of:=['Sheet2 A'.B2] -> table= "Sheet2 A"; ref = "B2"
//
//bool oox2odf_converter::Impl::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
//{
// boost::wregex re(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.([a-zA-Z\\$]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
// boost::wsmatch result;
// bool b = boost::regex_search(expr, result, re);
//
// size_t sz = result.size();
// if (sz == 4 && !result[1].matched)
// {
// table = L"";
// ref = result[2].str();
// return true;
// }
// else if (sz == 4 && result[1].matched)
// {
// table = result[1].str();
// XmlUtils::replace_all( table, L"$", L"");
// XmlUtils::replace_all( table, L"'", L"");
// ref = result[2].str();
// return true;
// }
// return false;
//}
//
//namespace
//{
//
//std::wstring replace_cell_range_formater(boost::wsmatch const & what)
//{
// const size_t sz = what.size();
// if (sz == 4 && !what[1].matched)
// {
// const std::wstring c1 = what[2].str();
// const std::wstring c2 = what[3].str();
// const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
// return s;
// }
// else if (sz == 4 && what[1].matched)
// {
// std::wstring sheet1 = what[1].str();
// XmlUtils::replace_all( sheet1, L"$", L"");
//
// const std::wstring c1 = what[2].str();
// const std::wstring c2 = what[3].str();
// const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
// return s;
// }
// return L"";
//}
//
//}
//
// заменяем формат адресации ячеек НАОБОРОТ
// [.A1] -> A1
// [.A1:.B5] -> A1:B5
// [Sheet2.A1:B5] -> Sheet2!A1:B5
// [Sheet2.A1] -> Sheet2!A1
// [$'Sheet2 A'.$B2] -> 'Sheet2 A'!$B2
void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr) void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
{ {
boost::wregex re(L"([:$!])+"); boost::wregex re(L"([:$!])+");
...@@ -155,8 +80,10 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr) ...@@ -155,8 +80,10 @@ void oox2odf_converter::Impl::replace_cells_range(std::wstring& expr)
if (b) if (b)
{ {
boost::wregex re1(L"(\\$?\\w+\\!)?([a-zA-Z$]+\\d{1,})\\:?([a-zA-Z$]+\\d{1,})?"); boost::wregex re1(L"(\\$?\\w+\\!)?([a-zA-Z$]*\\d*)\\:?([a-zA-Z$]*\\d*)?");
// $ Sheet2 ! $ A1 : $ B5 // $ Sheet2 ! $ A1 : $ B5
// $ Sheet2 ! $ A : $ A
// $ Sheet2 ! $ 1 : $ 1
std::wstring workstr = expr; std::wstring workstr = expr;
std::wstring res = boost::regex_replace( std::wstring res = boost::regex_replace(
...@@ -178,19 +105,28 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat ...@@ -178,19 +105,28 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater1(boost::wsmat
{ {
const size_t sz = what.size(); const size_t sz = what.size();
if (sz>3) if (sz > 3)
{ {
std::wstring sheet1 = what[1].matched ? what[1].str() : L""; std::wstring s;
XmlUtils::replace_all( sheet1, L"!", L""); std::wstring sheet = what[1].matched ? what[1].str() : L"";
std::wstring c1 = what[2].str(); std::wstring c1 = what[2].str();
std::wstring c2 = what[3].str(); std::wstring c2 = what[3].str();
int res=0;
if (sheet1.length() > 0 && (res = c1.find(L"$")) >=0) sheet1 = L"$" + sheet1; if (!c1.empty() || !c2.empty() || !sheet.empty())
{
XmlUtils::replace_all( sheet, L"!", L"");
if (isFindBaseCell_ && base_cell_formula_.empty() && !sheet.empty())
{
base_cell_formula_ = sheet + L".$A$1";
}
if (!sheet.empty() && (std::wstring::npos != c1.find(L"$"))) sheet = L"$" + sheet;
const std::wstring s = std::wstring(L"[") + sheet1 + L"." + s = std::wstring(L"[") + sheet + L"." +
c1 + c1 +
(c2.empty() ? L"" : (L":" + sheet1 + L"." + c2) ) + std::wstring(L"]"); (c2.empty() ? L"" : (L":" + sheet + L"." + c2) ) + std::wstring(L"]");
}
return s; return s;
} }
else else
...@@ -209,7 +145,7 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat ...@@ -209,7 +145,7 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
{ {
const size_t sz = what.size(); const size_t sz = what.size();
if (sz>2) if (sz > 2)
{ {
const std::wstring c1 = what[1].str(); const std::wstring c1 = what[1].str();
const std::wstring c2 = what[2].str(); const std::wstring c2 = what[2].str();
...@@ -222,39 +158,22 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat ...@@ -222,39 +158,22 @@ std::wstring oox2odf_converter::Impl::replace_cells_range_formater2(boost::wsmat
return L""; return L"";
} }
//namespace { void oox2odf_converter::Impl::replace_named_formula(std::wstring & expr)
// {
//std::wstring replace_named_ref_formater(boost::wsmatch const & what) base_cell_formula_.clear();
//{
// const size_t sz = what.size(); isFindBaseCell_ = true;
// expr = convert_formula(expr);
// if (sz == 4 && !what[1].matched) isFindBaseCell_ = false;
// { }
// const std::wstring c1 = what[2].str();
// const std::wstring c2 = what[3].str();
// const std::wstring s = c1 + (c2.empty() ? L"" : (L":" + c2) );
// return s;
// }
// else if (sz == 4 && what[1].matched)
// {
// std::wstring sheet1 = what[1].str();
// XmlUtils::replace_all( sheet1, L"$", L"");
//
// const std::wstring c1 = what[2].str();
// const std::wstring c2 = what[3].str();
// const std::wstring s = sheet1 + L"!" + c1 + (c2.empty() ? L"" : (L":" + c2) );
// return s;
// }
// return L"";
//}
//
//}
// Лист1!$A$1 -> $Лист1.$A$1 // Лист1!$A$1 -> $Лист1.$A$1
void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr) void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
{ {
base_cell_formula_.clear();
isFindBaseCell_ = true;
std::wstring workstr = expr, out; std::wstring workstr = expr, out;
replace_vertical(workstr); replace_vertical(workstr);
...@@ -264,8 +183,10 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr) ...@@ -264,8 +183,10 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on); boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d, distance) for (size_t i = 0; i < distance.size(); i++)
{ {
std::wstring &d = distance[i];
XmlUtils::replace_all( d, L"(", L"SCOBCAIN"); XmlUtils::replace_all( d, L"(", L"SCOBCAIN");
XmlUtils::replace_all( d, L")", L"SCOBCAOUT"); XmlUtils::replace_all( d, L")", L"SCOBCAOUT");
XmlUtils::replace_all( d, L" ", L"PROBEL"); XmlUtils::replace_all( d, L" ", L"PROBEL");
...@@ -283,21 +204,9 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr) ...@@ -283,21 +204,9 @@ void oox2odf_converter::Impl::replace_named_ref(std::wstring & expr)
out = out + d + std::wstring(L";"); out = out + d + std::wstring(L";");
} }
if (out.length()>0) expr = out.substr(0,out.length()-1); if (!out.empty()) expr = out.substr(0, out.length() - 1);
}
isFindBaseCell_ = false;
std::wstring oox2odf_converter::Impl::find_base_cell(const std::wstring & expr)
{
std::vector< std::wstring > splitted;
boost::algorithm::split(splitted, expr, boost::algorithm::is_any_of(L"!"), boost::algorithm::token_compress_on);
if (splitted.size()>1)
{
return splitted[0] + L".$A$1";
}
else return L"";
} }
...@@ -440,32 +349,6 @@ std::wstring replace_(boost::wsmatch const & what) ...@@ -440,32 +349,6 @@ std::wstring replace_(boost::wsmatch const & what)
return L""; return L"";
} }
std::wstring oox2odf_converter::Impl::replace_arguments1(std::wstring & workstr1)
{
std::wstring out;
std::wstring workstr = workstr1;
replace_vertical(workstr);
replace_semicolons(workstr);
std::vector<std::wstring> distance;
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d, distance)
{
replace_cells_range(d);
out = out + d + std::wstring(L";");
}
if (out.length()>0) out = out.substr(0,out.length()-1);
return out ;
}
std::wstring oox2odf_converter::Impl::convert_scobci(boost::wsmatch const & what) std::wstring oox2odf_converter::Impl::convert_scobci(boost::wsmatch const & what)
{ {
if (what[1].matched) if (what[1].matched)
...@@ -506,33 +389,31 @@ std::wstring oox2odf_converter::Impl::replace_arguments(boost::wsmatch const & ...@@ -506,33 +389,31 @@ std::wstring oox2odf_converter::Impl::replace_arguments(boost::wsmatch const &
int sz = what.size(); int sz = what.size();
std::wstring c1= what[1].str();
std::wstring c2= what[2].str();
std::wstring c3= what[3].str();
if (what[1].matched) if (what[1].matched)
{ {
std::wstring workstr = what[1].str(); out = what[1].str();
replace_vertical(workstr); }
replace_semicolons(workstr); else if (what[2].matched)
{
out = what[2].str();
}
if (!out.empty())
{
std::vector<std::wstring> distance; std::vector<std::wstring> distance;
boost::algorithm::split(distance,workstr, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on); boost::algorithm::split(distance, out, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring &d, distance) out = L"";
{ for (size_t i = 0; i < distance.size(); i++)
{
replace_cells_range(d); replace_cells_range(distance[i]);
out = out + d + std::wstring(L";"); out = out + distance[i] + std::wstring(L";");
} }
if (out.length()>0) out = out.substr(0,out.length()-1); if (!out.empty()) out = out.substr(0, out.length() - 1);
} }
else if (what[2].matched)
out = what[2].str();
else if (what[3].matched) else if (what[3].matched)
out = what[3].str(); out = what[3].str();
return out ; return out ;
...@@ -560,7 +441,7 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr) ...@@ -560,7 +441,7 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
std::wstring res = boost::regex_replace( std::wstring res = boost::regex_replace(
res1, res1,
boost::wregex(L"(?:(?=[()])(.*?)(?=[)]))"), boost::wregex(L"(?!([a-zA-Z]+\\d*\\())(([a-zA-Z]+\\!)?\\$?[a-zA-Z]*\\$?\\d*(\\:\\$?[a-zA-Z]*\\$?\\d*){0,1})"),
&oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all); &oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all);
if (res1 == res) if (res1 == res)
...@@ -572,10 +453,6 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr) ...@@ -572,10 +453,6 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
boost::wregex(L"(\\$?\\w+\\!)?([a-zA-Z$]+\\d{1,})\\:?([a-zA-Z$]+\\d{1,})?"), boost::wregex(L"(\\$?\\w+\\!)?([a-zA-Z$]+\\d{1,})\\:?([a-zA-Z$]+\\d{1,})?"),
&replace_cells_range_formater1, &replace_cells_range_formater1,
boost::match_default | boost::format_all); boost::match_default | boost::format_all);
replace_vertical(res);
replace_semicolons(res);
} }
XmlUtils::replace_all( res, L"SCOBCAIN", L"("); XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
...@@ -584,12 +461,16 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr) ...@@ -584,12 +461,16 @@ std::wstring oox2odf_converter::Impl::convert_formula(const std::wstring & expr)
XmlUtils::replace_all( res, L"KVADRATIN", L"["); XmlUtils::replace_all( res, L"KVADRATIN", L"[");
XmlUtils::replace_all( res, L"KVADRATOUT", L"]"); XmlUtils::replace_all( res, L"KVADRATOUT", L"]");
XmlUtils::replace_all( res, L"PROBEL", L" ");
XmlUtils::replace_all( res, L"APOSTROF", L"'"); XmlUtils::replace_all( res, L"APOSTROF", L"'");
XmlUtils::replace_all( res, L"KAVYCHKA", L"\""); XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
replace_vertical(res);
replace_semicolons(res);
XmlUtils::replace_all( res, L"PROBEL", L" ");
return std::wstring(L"of:=") + res; return std::wstring(L"of:=") + res;
} }
...@@ -600,12 +481,12 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst ...@@ -600,12 +481,12 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst
std::wstring res1 = boost::regex_replace( std::wstring res1 = boost::regex_replace(
workstr, workstr,
boost::wregex(L"('.*?')|(\".*?\")"), boost::wregex(L"('.*?')|(\".*?\")"),
&oox2odf_converter::Impl::convert_scobci,boost::match_default | boost::format_all); &oox2odf_converter::Impl::convert_scobci, boost::match_default | boost::format_all);
std::wstring res = boost::regex_replace( std::wstring res = boost::regex_replace(
res1, res1,
boost::wregex(L"(?:(?=[()])(.*?)(?=[)]))"), boost::wregex(L"(?:(?=[()])(.*?)(?=[)]))"),
&oox2odf_converter::Impl::replace_arguments,boost::match_default | boost::format_all); &oox2odf_converter::Impl::replace_arguments, boost::match_default | boost::format_all);
if (res1 == res) if (res1 == res)
{ {
...@@ -614,20 +495,21 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst ...@@ -614,20 +495,21 @@ std::wstring oox2odf_converter::Impl::convert_conditional_formula(const std::wst
&replace_cells_range_formater1, &replace_cells_range_formater1,
boost::match_default | boost::format_all); boost::match_default | boost::format_all);
replace_vertical(res);
replace_semicolons(res);
} }
XmlUtils::replace_all( res, L"SCOBCAIN", L"("); XmlUtils::replace_all( res, L"SCOBCAIN", L"(");
XmlUtils::replace_all( res, L"SCOBCAOUT", L")"); XmlUtils::replace_all( res, L"SCOBCAOUT", L")");
XmlUtils::replace_all( res, L"PROBEL", L" ");
XmlUtils::replace_all( res, L"APOSTROF", L"'"); XmlUtils::replace_all( res, L"APOSTROF", L"'");
XmlUtils::replace_all( res, L"KAVYCHKA", L"\""); XmlUtils::replace_all( res, L"KAVYCHKA", L"\"");
return res; replace_vertical(res);
replace_semicolons(res);
XmlUtils::replace_all( res, L"PROBEL", L" ");
return res;
} }
//Sheet2!C3:C19,Sheet2!L27:L34 //Sheet2!C3:C19,Sheet2!L27:L34
...@@ -726,9 +608,15 @@ std::wstring oox2odf_converter::convert_named_ref(const std::wstring& expr) ...@@ -726,9 +608,15 @@ std::wstring oox2odf_converter::convert_named_ref(const std::wstring& expr)
impl_->replace_named_ref(workstr); impl_->replace_named_ref(workstr);
return workstr; return workstr;
} }
std::wstring oox2odf_converter::find_base_cell(const std::wstring& expr) std::wstring oox2odf_converter::convert_named_formula(const std::wstring& expr)
{
std::wstring workstr = expr;
impl_->replace_named_formula(workstr);
return workstr;
}
std::wstring oox2odf_converter::get_base_cell_formula(const std::wstring& expr)
{ {
return impl_->find_base_cell(expr); return impl_->base_cell_formula_;
} }
...@@ -840,14 +728,6 @@ int oox2odf_converter::get_count_value_points(std::wstring expr) ...@@ -840,14 +728,6 @@ int oox2odf_converter::get_count_value_points(std::wstring expr)
return count; return count;
} }
//bool oox2odf_converter::find_first_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref)
//{
// return impl_->find_first_ref(expr, table, ref);
//}
//bool oox2odf_converter::find_first_last_ref(std::wstring const & expr, std::wstring & table, std::wstring & ref_first,std::wstring & ref_last)
//{
// return impl_->find_first_last_ref(expr, table, ref_first,ref_last);
//}
} }
} }
...@@ -189,14 +189,14 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm) ...@@ -189,14 +189,14 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->hyperlinks_.str(); CP_XML_STREAM() << impl_->hyperlinks_.str();
} }
} }
CP_XML_STREAM() << impl_->drawing_.str();
if (!impl_->page_props_.str().empty()) if (!impl_->page_props_.str().empty())
{ {
CP_XML_STREAM() << impl_->page_props_.str(); CP_XML_STREAM() << impl_->page_props_.str();
}//props выше legacyDrawing !! }//props выше legacyDrawing !!
CP_XML_STREAM() << impl_->drawing_.str();
if (impl_->commentsId_.length()>0) if (impl_->commentsId_.length()>0)
{ {
CP_XML_NODE(L"legacyDrawing") CP_XML_NODE(L"legacyDrawing")
......
...@@ -138,7 +138,8 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std:: ...@@ -138,7 +138,8 @@ void ods_table_context::add_defined_range(const std::wstring & name, const std::
std::wstring odf_range = formulas_converter.convert_named_ref(cell_range);//todo - разделить конвертацию диапазонов/рэнжей на c [] и без std::wstring odf_range = formulas_converter.convert_named_ref(cell_range);//todo - разделить конвертацию диапазонов/рэнжей на c [] и без
XmlUtils::replace_all( odf_range, L"[", L""); XmlUtils::replace_all( odf_range, L"[", L"");
XmlUtils::replace_all( odf_range, L"]", L""); XmlUtils::replace_all( odf_range, L"]", L"");
std::wstring odf_base_cell = formulas_converter.find_base_cell(cell_range);
std::wstring odf_base_cell = formulas_converter.get_base_cell_formula(cell_range);
named_range->table_name_ = name; named_range->table_name_ = name;
named_range->table_cell_range_address_ = odf_range; named_range->table_cell_range_address_ = odf_range;
...@@ -181,8 +182,8 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const ...@@ -181,8 +182,8 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const
formulasconvert::oox2odf_converter formulas_converter; formulasconvert::oox2odf_converter formulas_converter;
std::wstring odf_value = formulas_converter.convert_named_ref(value); std::wstring odf_value = formulas_converter.convert_named_formula(value);
std::wstring odf_base_cell = formulas_converter.find_base_cell(value); std::wstring odf_base_cell = formulas_converter.get_base_cell_formula(value);
named_expression->table_name_ = name; named_expression->table_name_ = name;
named_expression->table_expression_ = odf_value; named_expression->table_expression_ = odf_value;
...@@ -215,10 +216,9 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const ...@@ -215,10 +216,9 @@ void ods_table_context::add_defined_expression(const std::wstring & name, const
table_defined_expressions_.root->add_child_element(elm); table_defined_expressions_.root->add_child_element(elm);
} }
if (odf_base_cell.length() > 0) if (!odf_base_cell.empty())
named_expression->table_base_cell_address_ = odf_base_cell; named_expression->table_base_cell_address_ = odf_base_cell;
table_defined_expressions_.elements.push_back(elm); table_defined_expressions_.elements.push_back(elm);
} }
......
...@@ -594,8 +594,17 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* ...@@ -594,8 +594,17 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
convert(oox_spPr->xfrm.GetPointer()); convert(oox_spPr->xfrm.GetPointer());
PPTX::Logic::PrstGeom* prstGeom = &oox_spPr->Geometry.as<PPTX::Logic::PrstGeom>(); PPTX::Logic::PrstGeom* prstGeom = NULL;
PPTX::Logic::CustGeom* custGeom = &oox_spPr->Geometry.as<PPTX::Logic::CustGeom>(); PPTX::Logic::CustGeom* custGeom = NULL;
if (oox_spPr->Geometry.is<PPTX::Logic::PrstGeom>())
{
prstGeom = &oox_spPr->Geometry.as<PPTX::Logic::PrstGeom>();
}
if (oox_spPr->Geometry.is<PPTX::Logic::CustGeom>())
{
custGeom = &oox_spPr->Geometry.as<PPTX::Logic::CustGeom>();
}
convert(prstGeom); convert(prstGeom);
convert(custGeom); convert(custGeom);
...@@ -627,8 +636,13 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* ...@@ -627,8 +636,13 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
} }
odf_context()->drawing_context()->end_line_properties(); odf_context()->drawing_context()->end_line_properties();
//----------------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------------------
PPTX::Logic::EffectLst* effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>(); PPTX::Logic::EffectLst* effectLst = NULL;
if (oox_spPr->EffectList.is<PPTX::Logic::EffectLst>())
{
effectLst = &oox_spPr->EffectList.as<PPTX::Logic::EffectLst>();
}
if (effectLst) convert(effectLst); if (effectLst) convert(effectLst);
else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3); else if (oox_sp_style) convert(&oox_sp_style->effectRef, 3);
...@@ -642,20 +656,14 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* ...@@ -642,20 +656,14 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB) void OoxConverter::convert(PPTX::Logic::UniFill *oox_fill, DWORD nARGB)
{ {
if (oox_fill == NULL) return; if (oox_fill == NULL) return;
PPTX::Logic::NoFill* noFill = &oox_fill->as<PPTX::Logic::NoFill>();
PPTX::Logic::BlipFill* blipFill = &oox_fill->as<PPTX::Logic::BlipFill>();
PPTX::Logic::GradFill* gradFill = &oox_fill->as<PPTX::Logic::GradFill>();
PPTX::Logic::SolidFill* solidFill = &oox_fill->as<PPTX::Logic::SolidFill>();
PPTX::Logic::PattFill* pattFill = &oox_fill->as<PPTX::Logic::PattFill>();
if (solidFill) convert(solidFill, nARGB); if (oox_fill->is<PPTX::Logic::NoFill>()) odf_context()->drawing_context()->set_no_fill();
else if (blipFill) convert(blipFill);
else if (gradFill) convert(gradFill, nARGB);
else if (pattFill) convert(pattFill, nARGB);
else if (noFill) odf_context()->drawing_context()->set_no_fill();
if (oox_fill->is<PPTX::Logic::BlipFill>()) convert(&oox_fill->as<PPTX::Logic::BlipFill>());
if (oox_fill->is<PPTX::Logic::GradFill>()) convert(&oox_fill->as<PPTX::Logic::GradFill>(), nARGB);
if (oox_fill->is<PPTX::Logic::SolidFill>()) convert(&oox_fill->as<PPTX::Logic::SolidFill>(),nARGB);
if (oox_fill->is<PPTX::Logic::PattFill>()) convert(&oox_fill->as<PPTX::Logic::PattFill>(), nARGB);
} }
int OoxConverter::convert(PPTX::Logic::PrstTxWarp *oox_text_preset) int OoxConverter::convert(PPTX::Logic::PrstTxWarp *oox_text_preset)
...@@ -783,8 +791,10 @@ void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path) ...@@ -783,8 +791,10 @@ void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path)
for (size_t i = 0 ; i < oox_geom_path->Paths.size(); i++) for (size_t i = 0 ; i < oox_geom_path->Paths.size(); i++)
{ {
PPTX::Logic::PathBase* pathBase = &oox_geom_path->Paths[i].Path2D.as<PPTX::Logic::PathBase>(); if (oox_geom_path->Paths[i].Path2D.is<PPTX::Logic::PathBase>())
convert(pathBase); {
convert(&oox_geom_path->Paths[i].Path2D.as<PPTX::Logic::PathBase>());
}
} }
if (oox_geom_path->stroke.IsInit() && *oox_geom_path->stroke == false) if (oox_geom_path->stroke.IsInit() && *oox_geom_path->stroke == false)
...@@ -951,7 +961,7 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB) ...@@ -951,7 +961,7 @@ void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill, DWORD nARGB)
{ {
odf_context()->drawing_context()->set_opacity_angle(oox_grad_fill->lin->ang.get()/60000.); odf_context()->drawing_context()->set_opacity_angle(oox_grad_fill->lin->ang.get()/60000.);
} }
else if (oox_grad_fill->path.is_init()) else if (oox_grad_fill->path.is_init() && oox_grad_fill->path->rect.is_init())
{ {
odf_context()->drawing_context()->set_opacity_rect ( XmlUtils::GetInteger(oox_grad_fill->path->rect->l.get_value_or(L"")), odf_context()->drawing_context()->set_opacity_rect ( XmlUtils::GetInteger(oox_grad_fill->path->rect->l.get_value_or(L"")),
XmlUtils::GetInteger(oox_grad_fill->path->rect->t.get_value_or(L"")), XmlUtils::GetInteger(oox_grad_fill->path->rect->t.get_value_or(L"")),
...@@ -1137,12 +1147,24 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr) ...@@ -1137,12 +1147,24 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
//+ style section //+ style section
//+element text:section в котором параграфы //+element text:section в котором параграфы
} }
if (oox_bodyPr->Fit.type == PPTX::Logic::TextFit::FitSpAuto)
{
//изменяемы размеры
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
switch(oox_bodyPr->Fit.type)
{
case PPTX::Logic::TextFit::FitSpAuto:
{//изменяемы размеры
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
}break;
case PPTX::Logic::TextFit::FitNo:
{
}break;
case PPTX::Logic::TextFit::FitNormAuto:
{
}break;
default:
{
}
} }
if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit()) if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit())
{ {
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++) for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
...@@ -1680,12 +1702,21 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s ...@@ -1680,12 +1702,21 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
_CP_OPT(double) opacityText; _CP_OPT(double) opacityText;
std::wstring hexColorText; std::wstring hexColorText;
PPTX::Logic::GradFill* gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>(); PPTX::Logic::GradFill* gradFill = NULL;
PPTX::Logic::SolidFill* solidFill = NULL;
if (oox_run_pr->Fill.is<PPTX::Logic::GradFill>())
{
gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>();
}
if (gradFill && !gradFill->GsLst.empty()) if (gradFill && !gradFill->GsLst.empty())
{ {
convert(&gradFill->GsLst[0].color, hexColorText, opacityText); convert(&gradFill->GsLst[0].color, hexColorText, opacityText);
} }
PPTX::Logic::SolidFill* solidFill = &oox_run_pr->Fill.as<PPTX::Logic::SolidFill>(); if (oox_run_pr->Fill.is<PPTX::Logic::SolidFill>())
{
solidFill = &oox_run_pr->Fill.as<PPTX::Logic::SolidFill>();
}
if (solidFill) if (solidFill)
{ {
convert(&solidFill->Color, hexColorText, opacityText); convert(&solidFill->Color, hexColorText, opacityText);
......
...@@ -601,12 +601,14 @@ void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes) ...@@ -601,12 +601,14 @@ void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes)
CSlideInfo* pNotesWrapper = &m_arNotesWrapper.back(); CSlideInfo* pNotesWrapper = &m_arNotesWrapper.back();
int indexUser = pRecordSlide->m_IndexUser; int indexUser = pRecordSlide->m_IndexUser;
pNotesWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures; if (m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures.empty())
pNotesWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile; pNotesWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[0]->m_arOffsetPictures;
else
pNotesWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
//грузим placeholder pNotesWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
pNotesWrapper->m_arTextPlaceHolders = pRecordSlide->m_oPersist.m_arTextAttrs; pNotesWrapper->m_arTextPlaceHolders = pRecordSlide->m_oPersist.m_arTextAttrs;
std::vector<CRecordNotesAtom*> oArrayNotesAtoms; std::vector<CRecordNotesAtom*> oArrayNotesAtoms;
...@@ -627,6 +629,9 @@ void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes) ...@@ -627,6 +629,9 @@ void CPPTUserInfo::LoadNotes(DWORD dwNoteID, CSlide* pNotes)
//????? у заметок нет слайда !!! //????? у заметок нет слайда !!!
} }
//----------------------------------------------------- //-----------------------------------------------------
size_t index = pPairSlide->second->m_Index;
if (index >= m_arSlides.size())
return;
CSlide* pSlide = m_arSlides[pPairSlide->second->m_Index]; CSlide* pSlide = m_arSlides[pPairSlide->second->m_Index];
pNotes->m_lSlideID = pPairSlide->second->m_Index; pNotes->m_lSlideID = pPairSlide->second->m_Index;
...@@ -796,12 +801,14 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide) ...@@ -796,12 +801,14 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
CSlideInfo* pSlideWrapper = &m_arSlideWrapper.back(); CSlideInfo* pSlideWrapper = &m_arSlideWrapper.back();
int indexUser = pRecordSlide->m_IndexUser; int indexUser = pRecordSlide->m_IndexUser;
pSlideWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures; if (m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures.empty())
pSlideWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[0]->m_arOffsetPictures;
else
pSlideWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
pSlideWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile; pSlideWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
// вот, грузим placeholder
pSlideWrapper->m_arTextPlaceHolders = pRecordSlide->m_oPersist.m_arTextAttrs; pSlideWrapper->m_arTextPlaceHolders = pRecordSlide->m_oPersist.m_arTextAttrs;
// записываем шрифты // записываем шрифты
...@@ -1402,7 +1409,11 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co ...@@ -1402,7 +1409,11 @@ void CPPTUserInfo::LoadMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, co
indexUser = pPairMaster1->second->m_IndexUser; indexUser = pPairMaster1->second->m_IndexUser;
pMasterWrapper->m_arTextPlaceHolders = pPairMaster1->second->m_oPersist.m_arTextAttrs; pMasterWrapper->m_arTextPlaceHolders = pPairMaster1->second->m_oPersist.m_arTextAttrs;
} }
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures; if (m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures.empty() == false)
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[indexUser]->m_arOffsetPictures;
else
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[0]->m_arOffsetPictures;
pMasterWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile; pMasterWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
// читаем настройки текстовых стилей ----------------------------------------------- // читаем настройки текстовых стилей -----------------------------------------------
...@@ -1784,11 +1795,13 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth, ...@@ -1784,11 +1795,13 @@ void CPPTUserInfo::LoadNoMainMaster(DWORD dwMasterID, const LONG& lOriginWidth,
CSlideInfo* pMasterWrapper = &m_arMasterWrapper[m_arMasterWrapper.size() - 1]; CSlideInfo* pMasterWrapper = &m_arMasterWrapper[m_arMasterWrapper.size() - 1];
// вот, грузим placeholder pMasterWrapper->m_arTextPlaceHolders = pCurMaster->m_oPersist.m_arTextAttrs;
pMasterWrapper->m_arTextPlaceHolders = pCurMaster->m_oPersist.m_arTextAttrs;
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[pCurMaster->m_IndexUser]->m_arOffsetPictures;
pMasterWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile; pMasterWrapper->m_mapFilePictures = &m_pDocumentInfo->m_mapStoreImageFile;
if (m_pDocumentInfo->m_arUsers[pCurMaster->m_IndexUser]->m_arOffsetPictures.empty() == false)
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[pCurMaster->m_IndexUser]->m_arOffsetPictures;
else
pMasterWrapper->m_parEmptyPictures = &m_pDocumentInfo->m_arUsers[0]->m_arOffsetPictures;
std::map<DWORD, LONG>::iterator pPairTheme = m_mapMasterToTheme.find(dwID); std::map<DWORD, LONG>::iterator pPairTheme = m_mapMasterToTheme.find(dwID);
......
...@@ -232,10 +232,12 @@ void CPPTFileReader::ReadPictures() ...@@ -232,10 +232,12 @@ void CPPTFileReader::ReadPictures()
while (true) while (true)
{ {
if (pStream->isEOF()) //if (pStream->isEOF()) случаются неверно записанные стримы
break; // break;
int pos = pStream->getStreamPointer(); int pos = pStream->getStreamPointer();
if (pos >= pStream->getStreamSize())
break;
SRecordHeader oHeader; SRecordHeader oHeader;
if (pDecryptor) if (pDecryptor)
...@@ -256,6 +258,9 @@ void CPPTFileReader::ReadPictures() ...@@ -256,6 +258,9 @@ void CPPTFileReader::ReadPictures()
else else
oHeader.ReadFromStream(pStream->stream_); oHeader.ReadFromStream(pStream->stream_);
if (oHeader.RecType == 0 && oHeader.RecLen == 0 )
break;// окончание стрима забито нулями (выравнивание)
CRecordOfficeArtBlip art_blip; CRecordOfficeArtBlip art_blip;
art_blip.m_strTmpDirectory = m_strTmpDirectory; art_blip.m_strTmpDirectory = m_strTmpDirectory;
art_blip.m_oDocumentInfo = &m_oDocumentInfo; art_blip.m_oDocumentInfo = &m_oDocumentInfo;
......
...@@ -250,12 +250,26 @@ namespace PPTX ...@@ -250,12 +250,26 @@ namespace PPTX
} }
else if (L"oleObj" == strName) else if (L"oleObj" == strName)
{ {
olePic = oNode.ReadNode(L"p:pic"); olePic = oNode.ReadNode(L"p:pic"); //нормальный вариант объекта
if (olePic.IsInit()) if (olePic.IsInit())
{ {
olePic->fromXMLOle(oNode); olePic->fromXMLOle(oNode);
result = true; result = true;
} }
else
{
olePic.Init(); //старый вариант описания объекта через spid в VmlDrawing
olePic->spPr.xfrm;
Logic::PrstGeom* geom = new Logic::PrstGeom();
geom->prst = L"rect";
olePic->spPr.Geometry.m_geometry.reset(geom);
olePic->fromXMLOle(oNode);
result = true;
}
if (olePic->spPr.xfrm.IsInit() == false)
olePic->spPr.xfrm = xfrm;
} }
else if (L"AlternateContent" == strName) else if (L"AlternateContent" == strName)
{ {
......
...@@ -619,6 +619,45 @@ namespace PPTX ...@@ -619,6 +619,45 @@ namespace PPTX
if(oleObject.IsInit()) if(oleObject.IsInit())
{ {
pWriter->StartRecord(SPTREE_TYPE_OLE); pWriter->StartRecord(SPTREE_TYPE_OLE);
if (oleObject->m_sShapeId.IsInit() && (!blipFill.blip->embed.IsInit() && blipFill.blip->oleFilepathImage.empty()) &&
parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
{
OOX::CVmlDrawing *pVml = parentFileAs<PPTX::Slide>().Vml.operator->();
std::map<std::wstring, OOX::CVmlDrawing::_vml_shape>::iterator pPair = pVml->m_mapShapes.find(*oleObject->m_sShapeId);
if (pVml->m_mapShapes.end() != pPair)
{
pPair->second.bUsed = true;
OOX::Vml::CShape* pShape = dynamic_cast<OOX::Vml::CShape*>(pPair->second.pElement);
for(size_t j = 0; (pShape) && (j < pShape->m_arrItems.size()); ++j)
{
OOX::WritingElement* pChildElemShape = pShape->m_arrItems[j];
if(OOX::et_v_imagedata == pChildElemShape->getType())
{
OOX::Vml::CImageData* pImageData = static_cast<OOX::Vml::CImageData*>(pChildElemShape);
std::wstring sIdImageFileCache;
if (pImageData->m_oRelId.IsInit()) sIdImageFileCache = pImageData->m_oRelId->GetValue();
else if (pImageData->m_rId.IsInit()) sIdImageFileCache = pImageData->m_rId->GetValue();
if (!sIdImageFileCache.empty())
{
//ищем физический файл ( rId относительно vml_drawing)
smart_ptr<OOX::File> pFile = pVml->Find(sIdImageFileCache);
if (pFile.IsInit() && ( OOX::FileTypes::Image == pFile->type()))
{
OOX::Image* pImageFileCache = static_cast<OOX::Image*>(pFile.operator->());
blipFill.blip->oleFilepathImage = pImageFileCache->filename().GetPath();
}
}
}
}
}
}
} }
else if (nvPicPr.nvPr.media.is_init()) else if (nvPicPr.nvPr.media.is_init())
{ {
...@@ -630,10 +669,17 @@ namespace PPTX ...@@ -630,10 +669,17 @@ namespace PPTX
blipFill.blip->mediaFilepath = mediaFile->filename().GetPath(); blipFill.blip->mediaFilepath = mediaFile->filename().GetPath();
} }
if (nvPicPr.nvPr.media.as<MediaFile>().name == L"audioFile") if (nvPicPr.nvPr.media.is<MediaFile>())
{
if (nvPicPr.nvPr.media.as<MediaFile>().name == L"audioFile")
pWriter->StartRecord(SPTREE_TYPE_AUDIO);
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile")
pWriter->StartRecord(SPTREE_TYPE_VIDEO);
}
else if (nvPicPr.nvPr.media.is<WavAudioFile>() || nvPicPr.nvPr.media.is<AudioCD>())
{
pWriter->StartRecord(SPTREE_TYPE_AUDIO); pWriter->StartRecord(SPTREE_TYPE_AUDIO);
else if (nvPicPr.nvPr.media.as<MediaFile>().name == L"videoFile") }
pWriter->StartRecord(SPTREE_TYPE_VIDEO);
else else
pWriter->StartRecord(SPTREE_TYPE_PIC); pWriter->StartRecord(SPTREE_TYPE_PIC);
} }
...@@ -1338,6 +1384,7 @@ namespace PPTX ...@@ -1338,6 +1384,7 @@ namespace PPTX
blipFill.blip.Init(); blipFill.blip.Init();
blipFill.blip->oleRid = oleObject->m_oId->get(); blipFill.blip->oleRid = oleObject->m_oId->get();
} }
node.ReadAttributeBase(L"spid", oleObject->m_sShapeId);
} }
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX
...@@ -259,7 +259,7 @@ namespace PPTX ...@@ -259,7 +259,7 @@ namespace PPTX
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group = false); void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group = false);
//---------------------------------------------------------------------- //----------------------------------------------------------------------
NvPicPr nvPicPr; NvPicPr nvPicPr;
BlipFill blipFill; mutable BlipFill blipFill;
SpPr spPr; SpPr spPr;
nullable<ShapeStyle> style; nullable<ShapeStyle> style;
//internal //internal
......
...@@ -562,6 +562,7 @@ ...@@ -562,6 +562,7 @@
_IOS, _IOS,
DONT_WRITE_EMBEDDED_FONTS, DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML, AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
_XCODE,
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -595,6 +596,7 @@ ...@@ -595,6 +596,7 @@
_IOS, _IOS,
DONT_WRITE_EMBEDDED_FONTS, DONT_WRITE_EMBEDDED_FONTS,
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML, AVS_USE_CONVERT_PPTX_TOCUSTOM_VML,
_XCODE,
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
......
...@@ -51,7 +51,7 @@ const std::list<std::string> TxtFile::readAnsiOrCodePage() // == readUtf8without ...@@ -51,7 +51,7 @@ const std::list<std::string> TxtFile::readAnsiOrCodePage() // == readUtf8without
std::list<std::string> result; std::list<std::string> result;
NSFile::CFileBinary file_binary; NSFile::CFileBinary file_binary;
if (file_binary.OpenFile(m_path) != S_OK) return result; if (file_binary.OpenFile(m_path) == false) return result;
DWORD file_size = file_binary.GetFileSize(); DWORD file_size = file_binary.GetFileSize();
char *file_data = new char[file_size]; char *file_data = new char[file_size];
...@@ -118,7 +118,7 @@ const std::list<std::wstring> TxtFile::readUnicode() ...@@ -118,7 +118,7 @@ const std::list<std::wstring> TxtFile::readUnicode()
std::list<std::wstring> result; std::list<std::wstring> result;
NSFile::CFileBinary file_binary; NSFile::CFileBinary file_binary;
if (file_binary.OpenFile(m_path) != S_OK) return result; if (file_binary.OpenFile(m_path) == false ) return result;
DWORD file_size = file_binary.GetFileSize(); DWORD file_size = file_binary.GetFileSize();
char *file_data = new char[file_size]; char *file_data = new char[file_size];
...@@ -135,7 +135,7 @@ const std::list<std::wstring> TxtFile::readBigEndian() ...@@ -135,7 +135,7 @@ const std::list<std::wstring> TxtFile::readBigEndian()
std::list<std::wstring> result; std::list<std::wstring> result;
NSFile::CFileBinary file_binary; NSFile::CFileBinary file_binary;
if (file_binary.OpenFile(m_path) != S_OK) return result; if (file_binary.OpenFile(m_path) == false) return result;
DWORD file_size = file_binary.GetFileSize(); DWORD file_size = file_binary.GetFileSize();
char *file_data = new char[file_size]; char *file_data = new char[file_size];
...@@ -160,7 +160,7 @@ const std::list<std::string> TxtFile::readUtf8() ...@@ -160,7 +160,7 @@ const std::list<std::string> TxtFile::readUtf8()
std::list<std::string> result; std::list<std::string> result;
NSFile::CFileBinary file_binary; NSFile::CFileBinary file_binary;
if (file_binary.OpenFile(m_path) != S_OK) return result; if (file_binary.OpenFile(m_path) == false) return result;
DWORD file_size = file_binary.GetFileSize(); DWORD file_size = file_binary.GetFileSize();
char *file_data = new char[file_size]; char *file_data = new char[file_size];
......
...@@ -750,7 +750,7 @@ class pConnectionSitesDir : public OfficeArtFOPTE ...@@ -750,7 +750,7 @@ class pConnectionSitesDir : public OfficeArtFOPTE
virtual void ReadComplexData(XLS::CFRecord& record); virtual void ReadComplexData(XLS::CFRecord& record);
IMsoArray<ODRAW::FixedPoint> complex; IMsoArray<OSHARED::FixedPoint> complex;
}; };
class pInscribe : public OfficeArtFOPTE class pInscribe : public OfficeArtFOPTE
......
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_rels_ptr rels) std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_rels_ptr rels)
{//todooo отсчеты номеров файлов отдельно {//todooo отсчеты номеров файлов отдельно
const std::wstring id = boost::lexical_cast<std::wstring>(next_drawing_id_++); const std::wstring id = std::to_wstring(next_drawing_id_++);
const std::wstring fileName = std::wstring(L"drawing") + id + L".xml"; const std::wstring fileName = std::wstring(L"drawing") + id + L".xml";
drawings_.push_back(drawing_elm(fileName, content, rels)); drawings_.push_back(drawing_elm(fileName, content, rels));
...@@ -97,8 +97,8 @@ public: ...@@ -97,8 +97,8 @@ public:
std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_rels_ptr rels) std::pair<std::wstring, std::wstring> add_drawing_vml(std::wstring const & content, xlsx_drawings_rels_ptr rels)
{ {
const std::wstring drawing_id = boost::lexical_cast<std::wstring>(next_drawing_id_++); const std::wstring drawing_id = std::to_wstring(next_drawing_id_++);
const std::wstring file_vml_id = boost::lexical_cast<std::wstring>(next_vml_file_id_++); const std::wstring file_vml_id = std::to_wstring(next_vml_file_id_++);
const std::wstring fileName = std::wstring(L"vmlDrawing") + file_vml_id + L".vml"; const std::wstring fileName = std::wstring(L"vmlDrawing") + file_vml_id + L".vml";
drawings_vml_.push_back(drawing_elm(fileName, content, rels)); drawings_vml_.push_back(drawing_elm(fileName, content, rels));
...@@ -587,7 +587,7 @@ void xlsx_drawing_context::serialize_group() ...@@ -587,7 +587,7 @@ void xlsx_drawing_context::serialize_group()
if (drawing_state->name.empty()) if (drawing_state->name.empty())
{ {
drawing_state->name = L"Group_" + boost::lexical_cast<std::wstring>(count_object); drawing_state->name = L"Group_" + std::to_wstring(count_object);
} }
CP_XML_ATTR(L"name", drawing_state->name); CP_XML_ATTR(L"name", drawing_state->name);
...@@ -641,24 +641,24 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_ ...@@ -641,24 +641,24 @@ void xlsx_drawing_context::serialize_shape_comment(_drawing_state_ptr & drawing_
std::wstringstream strmStyle; std::wstringstream strmStyle;
strmStyle << L"position:absolute;"; strmStyle << L"position:absolute;";
strmStyle << L"margin-left:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu) strmStyle << L"margin-left:" << std::to_wstring(drawing_state->child_anchor.x / 12700.) << L"pt;"; //in pt (1 pt = 12700 emu)
strmStyle << L"margin-top:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.y / 12700.) << L"pt;"; strmStyle << L"margin-top:" << std::to_wstring(drawing_state->child_anchor.y / 12700.) << L"pt;";
strmStyle << L"width:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cx / 12700.) << L"pt;"; strmStyle << L"width:" << std::to_wstring(drawing_state->child_anchor.cx / 12700.) << L"pt;";
strmStyle << L"height:" << boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cy / 12700.) << L"pt;"; strmStyle << L"height:" << std::to_wstring(drawing_state->child_anchor.cy / 12700.) << L"pt;";
strmStyle << L"z-index:" << boost::lexical_cast<std::wstring>(drawing_state->id) << L";"; strmStyle << L"z-index:" << std::to_wstring(drawing_state->id) << L";";
if (drawing_state->object.visible == false) if (drawing_state->object.visible == false)
strmStyle << L"visibility:hidden;"; strmStyle << L"visibility:hidden;";
CP_XML_NODE(L"v:shape") CP_XML_NODE(L"v:shape")
{ {
//CP_XML_ATTR(L"id" , boost::lexical_cast<std::wstring>(drawing_state->object.id)); //CP_XML_ATTR(L"id" , std::to_wstring(drawing_state->object.id));
CP_XML_ATTR(L"type" , L"_x0000_t202"); CP_XML_ATTR(L"type" , L"_x0000_t202");
CP_XML_ATTR(L"fillcolor" , L"#" + drawing_state->fill.color.sRGB); CP_XML_ATTR(L"fillcolor" , L"#" + drawing_state->fill.color.sRGB);
if (drawing_state->line.width > 0) if (drawing_state->line.width > 0)
{ {
CP_XML_ATTR(L"strokeweight", boost::lexical_cast<std::wstring>(drawing_state->line.width) +L"pt"); CP_XML_ATTR(L"strokeweight", std::to_wstring(drawing_state->line.width) +L"pt");
} }
CP_XML_ATTR(L"style", strmStyle.str()); CP_XML_ATTR(L"style", strmStyle.str());
...@@ -770,9 +770,9 @@ void xlsx_drawing_context::serialize_vml_pic(_drawing_state_ptr & drawing_state, ...@@ -770,9 +770,9 @@ void xlsx_drawing_context::serialize_vml_pic(_drawing_state_ptr & drawing_state,
std::wstring style = std::wstring(L"position:absolute;margin-left:0;margin-top:0;"); std::wstring style = std::wstring(L"position:absolute;margin-left:0;margin-top:0;");
//todooo сделать "покороче" значения .. достаточно 2 знаков после запятой //todooo сделать "покороче" значения .. достаточно 2 знаков после запятой
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cx) + std::wstring(L"pt;"); style += std::wstring(L"width:") + std::to_wstring(drawing_state->child_anchor.cx) + std::wstring(L"pt;");
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(drawing_state->child_anchor.cy) + std::wstring(L"pt;"); style += std::wstring(L"height:") + std::to_wstring(drawing_state->child_anchor.cy) + std::wstring(L"pt;");
style += std::wstring(L"z-index:") + boost::lexical_cast<std::wstring>(drawing_state->id) + std::wstring(L";"); style += std::wstring(L"z-index:") + std::to_wstring(drawing_state->id) + std::wstring(L";");
CP_XML_ATTR(L"style",style); CP_XML_ATTR(L"style",style);
...@@ -865,7 +865,7 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s ...@@ -865,7 +865,7 @@ void xlsx_drawing_context::serialize_chart(_drawing_state_ptr & drawing_state, s
CP_XML_ATTR(L"id", drawing_state->id); CP_XML_ATTR(L"id", drawing_state->id);
if (drawing_state->name.empty()) if (drawing_state->name.empty())
drawing_state->name = L"Chart_" + boost::lexical_cast<std::wstring>(count_object); drawing_state->name = L"Chart_" + std::to_wstring(count_object);
CP_XML_ATTR(L"name", drawing_state->name); CP_XML_ATTR(L"name", drawing_state->name);
if (!drawing_state->description.empty()) if (!drawing_state->description.empty())
...@@ -941,9 +941,9 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state) ...@@ -941,9 +941,9 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
if (drawing_state->name.empty()) if (drawing_state->name.empty())
{ {
if (drawing_state->wordart.is) if (drawing_state->wordart.is)
drawing_state->name = L"WordArt_" + boost::lexical_cast<std::wstring>(count_object); drawing_state->name = L"WordArt_" + std::to_wstring(count_object);
else else
drawing_state->name = L"Shape_" + boost::lexical_cast<std::wstring>(count_object); drawing_state->name = L"Shape_" + std::to_wstring(count_object);
} }
CP_XML_ATTR(L"name", drawing_state->name); CP_XML_ATTR(L"name", drawing_state->name);
...@@ -2232,7 +2232,7 @@ void xlsx_drawing_context::set_hyperlink(const std::wstring & link, const std::w ...@@ -2232,7 +2232,7 @@ void xlsx_drawing_context::set_hyperlink(const std::wstring & link, const std::w
if (current_drawing_states == NULL) return; if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return; if (current_drawing_states->empty()) return;
std::wstring sId = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_.size()+1); std::wstring sId = std::wstring(L"hId") + std::to_wstring(hlinks_.size()+1);
std::wstring link_correct = link; std::wstring link_correct = link;
if (!is_external) link_correct = std::wstring(L"#") + link_correct; if (!is_external) link_correct = std::wstring(L"#") + link_correct;
...@@ -2423,7 +2423,7 @@ void xlsx_drawing_context::set_custom_connection(std::vector<ODRAW::MSOPOINT>& p ...@@ -2423,7 +2423,7 @@ void xlsx_drawing_context::set_custom_connection(std::vector<ODRAW::MSOPOINT>& p
current_drawing_states->back()->custom_connection = points; current_drawing_states->back()->custom_connection = points;
} }
void xlsx_drawing_context::set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points) void xlsx_drawing_context::set_custom_connectionDir(std::vector<OSHARED::FixedPoint>& points)
{ {
if (current_drawing_states == NULL) return; if (current_drawing_states == NULL) return;
if (current_drawing_states->empty()) return; if (current_drawing_states->empty()) return;
......
...@@ -182,7 +182,7 @@ public: ...@@ -182,7 +182,7 @@ public:
std::vector<ODRAW::MSOPOINT> custom_verticles; std::vector<ODRAW::MSOPOINT> custom_verticles;
std::vector<ODRAW::ADJH> custom_adjustHandles; std::vector<ODRAW::ADJH> custom_adjustHandles;
std::vector<ODRAW::MSOPOINT> custom_connection; std::vector<ODRAW::MSOPOINT> custom_connection;
std::vector<ODRAW::FixedPoint> custom_connectionDir; std::vector<OSHARED::FixedPoint>custom_connectionDir;
std::vector<ODRAW::MSORECT> custom_inscribe; std::vector<ODRAW::MSORECT> custom_inscribe;
_rect custom_rect; _rect custom_rect;
...@@ -413,7 +413,7 @@ public: ...@@ -413,7 +413,7 @@ public:
void set_custom_adjustValues(std::vector<_CP_OPT(int)> & values); void set_custom_adjustValues(std::vector<_CP_OPT(int)> & values);
void set_custom_path (int type_path); void set_custom_path (int type_path);
void set_custom_connection (std::vector<ODRAW::MSOPOINT> & points); void set_custom_connection (std::vector<ODRAW::MSOPOINT> & points);
void set_custom_connectionDir(std::vector<ODRAW::FixedPoint>& points); void set_custom_connectionDir(std::vector<OSHARED::FixedPoint>& points);
void set_custom_inscribe (std::vector<ODRAW::MSORECT> & rects); void set_custom_inscribe (std::vector<ODRAW::MSORECT> & rects);
void set_custom_x_limo (int val); void set_custom_x_limo (int val);
void set_custom_y_limo (int val); void set_custom_y_limo (int val);
......
...@@ -213,6 +213,7 @@ ...@@ -213,6 +213,7 @@
690FE07F1E9BBA15004B26D0 /* DrawingExt.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE07B1E9BBA15004B26D0 /* DrawingExt.h */; }; 690FE07F1E9BBA15004B26D0 /* DrawingExt.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE07B1E9BBA15004B26D0 /* DrawingExt.h */; };
690FE0821E9BBA23004B26D0 /* DiagramData.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0801E9BBA23004B26D0 /* DiagramData.h */; }; 690FE0821E9BBA23004B26D0 /* DiagramData.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0801E9BBA23004B26D0 /* DiagramData.h */; };
690FE0831E9BBA23004B26D0 /* DiagramDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */; }; 690FE0831E9BBA23004B26D0 /* DiagramDrawing.h in Headers */ = {isa = PBXBuildFile; fileRef = 690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */; };
691C3E131F20C3D500F1775E /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 691C3E121F20C3D500F1775E /* File.cpp */; };
69F181EC1C7734A700B2952B /* strings_hack_printf.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181EA1C7734A700B2952B /* strings_hack_printf.h */; }; 69F181EC1C7734A700B2952B /* strings_hack_printf.h in Headers */ = {isa = PBXBuildFile; fileRef = 69F181EA1C7734A700B2952B /* strings_hack_printf.h */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -431,6 +432,7 @@ ...@@ -431,6 +432,7 @@
690FE07B1E9BBA15004B26D0 /* DrawingExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingExt.h; sourceTree = "<group>"; }; 690FE07B1E9BBA15004B26D0 /* DrawingExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingExt.h; sourceTree = "<group>"; };
690FE0801E9BBA23004B26D0 /* DiagramData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramData.h; sourceTree = "<group>"; }; 690FE0801E9BBA23004B26D0 /* DiagramData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramData.h; sourceTree = "<group>"; };
690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramDrawing.h; sourceTree = "<group>"; }; 690FE0811E9BBA23004B26D0 /* DiagramDrawing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagramDrawing.h; sourceTree = "<group>"; };
691C3E121F20C3D500F1775E /* File.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = File.cpp; sourceTree = "<group>"; };
69F181EA1C7734A700B2952B /* strings_hack_printf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = strings_hack_printf.h; path = ../../Common/DocxFormat/Source/Base/strings_hack_printf.h; sourceTree = "<group>"; }; 69F181EA1C7734A700B2952B /* strings_hack_printf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = strings_hack_printf.h; path = ../../Common/DocxFormat/Source/Base/strings_hack_printf.h; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -901,6 +903,7 @@ ...@@ -901,6 +903,7 @@
17E6B3BD1AC4298500F28F8B /* Base64.h */, 17E6B3BD1AC4298500F28F8B /* Base64.h */,
17E6B3BE1AC4298500F28F8B /* Directory.h */, 17E6B3BE1AC4298500F28F8B /* Directory.h */,
17E6B3BF1AC4298500F28F8B /* File.h */, 17E6B3BF1AC4298500F28F8B /* File.h */,
691C3E121F20C3D500F1775E /* File.cpp */,
17E6B3C01AC4298500F28F8B /* Path.h */, 17E6B3C01AC4298500F28F8B /* Path.h */,
17E6B3C11AC4298500F28F8B /* Types.h */, 17E6B3C11AC4298500F28F8B /* Types.h */,
69F181EA1C7734A700B2952B /* strings_hack_printf.h */, 69F181EA1C7734A700B2952B /* strings_hack_printf.h */,
...@@ -1163,6 +1166,7 @@ ...@@ -1163,6 +1166,7 @@
17C1FBAE1ACC4250006B99B3 /* oMath.cpp in Sources */, 17C1FBAE1ACC4250006B99B3 /* oMath.cpp in Sources */,
17C1FBAF1ACC4250006B99B3 /* ChartSerialize.cpp in Sources */, 17C1FBAF1ACC4250006B99B3 /* ChartSerialize.cpp in Sources */,
17C1FBB11ACC4250006B99B3 /* Position.cpp in Sources */, 17C1FBB11ACC4250006B99B3 /* Position.cpp in Sources */,
691C3E131F20C3D500F1775E /* File.cpp in Sources */,
17C1FBB21ACC4250006B99B3 /* Vml.cpp in Sources */, 17C1FBB21ACC4250006B99B3 /* Vml.cpp in Sources */,
17C1FBB31ACC4250006B99B3 /* unicode_util.cpp in Sources */, 17C1FBB31ACC4250006B99B3 /* unicode_util.cpp in Sources */,
17C1FBB41ACC4250006B99B3 /* FldSimple.cpp in Sources */, 17C1FBB41ACC4250006B99B3 /* FldSimple.cpp in Sources */,
...@@ -1202,6 +1206,7 @@ ...@@ -1202,6 +1206,7 @@
unix, unix,
_IOS, _IOS,
DONT_WRITE_EMBEDDED_FONTS, DONT_WRITE_EMBEDDED_FONTS,
_XCODE,
); );
GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
...@@ -1242,6 +1247,7 @@ ...@@ -1242,6 +1247,7 @@
unix, unix,
_IOS, _IOS,
DONT_WRITE_EMBEDDED_FONTS, DONT_WRITE_EMBEDDED_FONTS,
_XCODE,
); );
GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "File.h"
#ifdef _IOS
#import <Foundation/Foundation.h>
static const char* fileSystemRepresentation(const std::wstring& sFileName)
{
NSString *path = [[NSString alloc] initWithBytes:(char*)sFileName.data()
length:sFileName.size()* sizeof(wchar_t)
encoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingUTF32LE)];
return (const char*)[path fileSystemRepresentation];
}
namespace NSFile
{
bool CFileBinary::OpenFile(const std::wstring& sFileName, bool bRewrite)
{
m_pFile = fopen(fileSystemRepresentation(sFileName), bRewrite ? "rb+" : "rb");
if (NULL == m_pFile)
return false;
fseek(m_pFile, 0, SEEK_END);
m_lFileSize = ftell(m_pFile);
fseek(m_pFile, 0, SEEK_SET);
m_lFilePosition = 0;
if (0 < sFileName.length())
{
if (((wchar_t)'/') == sFileName.c_str()[sFileName.length() - 1])
m_lFileSize = 0x7FFFFFFF;
}
unsigned int err = 0x7FFFFFFF;
unsigned int cur = (unsigned int)m_lFileSize;
if (err == cur)
{
CloseFile();
return false;
}
return true;
}
bool CFileBinary::CreateFileW(const std::wstring& sFileName)
{
m_pFile = fopen(fileSystemRepresentation(sFileName), "wb");
if (NULL == m_pFile)
return false;
m_lFilePosition = 0;
return true;
}
}
#endif
...@@ -618,6 +618,14 @@ namespace NSFile ...@@ -618,6 +618,14 @@ namespace NSFile
{ {
return m_lFilePosition; return m_lFilePosition;
} }
#ifdef _IOS
bool OpenFile(const std::wstring& sFileName, bool bRewrite = false);
bool CreateFileW(const std::wstring& sFileName);
#else
bool OpenFile(const std::wstring& sFileName, bool bRewrite = false) bool OpenFile(const std::wstring& sFileName, bool bRewrite = false)
{ {
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
...@@ -675,6 +683,9 @@ namespace NSFile ...@@ -675,6 +683,9 @@ namespace NSFile
m_lFilePosition = 0; m_lFilePosition = 0;
return true; return true;
} }
#endif
bool CreateTempFile() bool CreateTempFile()
{ {
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
......
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
7C560F671AA71A91000E5860 /* Project object */ = { 7C560F671AA71A91000E5860 /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 0700; LastUpgradeCheck = 0830;
ORGANIZATIONNAME = "Ascensio System"; ORGANIZATIONNAME = "Ascensio System";
TargetAttributes = { TargetAttributes = {
7C560F6E1AA71A91000E5860 = { 7C560F6E1AA71A91000E5860 = {
...@@ -346,8 +346,10 @@ ...@@ -346,8 +346,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
...@@ -355,6 +357,7 @@ ...@@ -355,6 +357,7 @@
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1", "DEBUG=1",
...@@ -388,14 +391,17 @@ ...@@ -388,14 +391,17 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNDECLARED_SELECTOR = YES;
...@@ -431,6 +437,7 @@ ...@@ -431,6 +437,7 @@
_IOS, _IOS,
FILTER_FLATE_DECODE_ENABLED, FILTER_FLATE_DECODE_ENABLED,
_ARM_ALIGN_, _ARM_ALIGN_,
_XCODE,
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -470,6 +477,7 @@ ...@@ -470,6 +477,7 @@
_IOS, _IOS,
FILTER_FLATE_DECODE_ENABLED, FILTER_FLATE_DECODE_ENABLED,
_ARM_ALIGN_, _ARM_ALIGN_,
_XCODE,
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
......
...@@ -566,6 +566,18 @@ ...@@ -566,6 +566,18 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
DEVELOPMENT_TEAM = 2WH24U26GJ; DEVELOPMENT_TEAM = 2WH24U26GJ;
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
USE_LITE_READER,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
LINUX,
MAC,
_IOS,
LIBXML_READER_ENABLED,
_XCODE,
);
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
...@@ -582,6 +594,18 @@ ...@@ -582,6 +594,18 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
DEVELOPMENT_TEAM = 2WH24U26GJ; DEVELOPMENT_TEAM = 2WH24U26GJ;
GCC_PREPROCESSOR_DEFINITIONS = (
UNICODE,
_UNICODE,
USE_LITE_READER,
_USE_LIBXML2_READER_,
_USE_XMLLITE_READER_,
LINUX,
MAC,
_IOS,
LIBXML_READER_ENABLED,
_XCODE,
);
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
......
...@@ -241,6 +241,7 @@ ...@@ -241,6 +241,7 @@
_IOS, _IOS,
NOMINMAX, NOMINMAX,
LINUX, LINUX,
_XCODE,
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -271,6 +272,7 @@ ...@@ -271,6 +272,7 @@
_IOS, _IOS,
NOMINMAX, NOMINMAX,
LINUX, LINUX,
_XCODE,
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
69676CB81CA58BBD00D7A1D1 /* OfficeUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OfficeUtils.cpp; sourceTree = "<group>"; }; 69676CB81CA58BBD00D7A1D1 /* OfficeUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OfficeUtils.cpp; sourceTree = "<group>"; };
69676CB91CA58BBD00D7A1D1 /* OfficeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfficeUtils.h; sourceTree = "<group>"; }; 69676CB91CA58BBD00D7A1D1 /* OfficeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfficeUtils.h; sourceTree = "<group>"; };
69676CBA1CA58BBD00D7A1D1 /* OfficeUtilsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfficeUtilsCommon.h; sourceTree = "<group>"; }; 69676CBA1CA58BBD00D7A1D1 /* OfficeUtilsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfficeUtilsCommon.h; sourceTree = "<group>"; };
69676CBB1CA58BBD00D7A1D1 /* ZipUtilsCP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ZipUtilsCP.cpp; sourceTree = "<group>"; }; 69676CBB1CA58BBD00D7A1D1 /* ZipUtilsCP.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = ZipUtilsCP.cpp; sourceTree = "<group>"; };
69676CBC1CA58BBD00D7A1D1 /* ZipUtilsCP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipUtilsCP.h; sourceTree = "<group>"; }; 69676CBC1CA58BBD00D7A1D1 /* ZipUtilsCP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipUtilsCP.h; sourceTree = "<group>"; };
69676D291CA58BBD00D7A1D1 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = "<group>"; }; 69676D291CA58BBD00D7A1D1 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = "<group>"; };
69676D2A1CA58BBD00D7A1D1 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = "<group>"; }; 69676D2A1CA58BBD00D7A1D1 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = "<group>"; };
...@@ -292,6 +292,7 @@ ...@@ -292,6 +292,7 @@
MAC, MAC,
unix, unix,
_IOS, _IOS,
_XCODE,
); );
IPHONEOS_DEPLOYMENT_TARGET = 8.2; IPHONEOS_DEPLOYMENT_TARGET = 8.2;
OTHER_LDFLAGS = "-ObjC"; OTHER_LDFLAGS = "-ObjC";
...@@ -309,6 +310,7 @@ ...@@ -309,6 +310,7 @@
MAC, MAC,
unix, unix,
_IOS, _IOS,
_XCODE,
); );
IPHONEOS_DEPLOYMENT_TARGET = 8.2; IPHONEOS_DEPLOYMENT_TARGET = 8.2;
OTHER_LDFLAGS = "-ObjC"; OTHER_LDFLAGS = "-ObjC";
......
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
#include "../../DesktopEditor/common/Directory.h" #include "../../DesktopEditor/common/Directory.h"
#include "../../DesktopEditor/common/Path.h" #include "../../DesktopEditor/common/Path.h"
#if _IOS
#import <Foundation/Foundation.h>
#endif
#define WRITEBUFFERSIZE 8192 #define WRITEBUFFERSIZE 8192
#define READBUFFERSIZE 8192 #define READBUFFERSIZE 8192
...@@ -43,6 +47,13 @@ namespace ZLibZipUtils ...@@ -43,6 +47,13 @@ namespace ZLibZipUtils
{ {
static zipFile zipOpenHelp(const wchar_t* filename) static zipFile zipOpenHelp(const wchar_t* filename)
{ {
#ifdef _IOS
NSString *path =[[NSString alloc] initWithBytes:filename
length:wcslen(filename)*sizeof(*filename)
encoding:NSUTF32LittleEndianStringEncoding];
return zipOpen( (const char*)[path fileSystemRepresentation], APPEND_STATUS_CREATE );
#endif
#if defined(_WIN32) || defined (_WIN64) #if defined(_WIN32) || defined (_WIN64)
zipFile zf = zipOpen( filename, APPEND_STATUS_CREATE ); zipFile zf = zipOpen( filename, APPEND_STATUS_CREATE );
#else #else
...@@ -56,6 +67,13 @@ namespace ZLibZipUtils ...@@ -56,6 +67,13 @@ namespace ZLibZipUtils
} }
static unzFile unzOpenHelp(const wchar_t* filename) static unzFile unzOpenHelp(const wchar_t* filename)
{ {
#ifdef _IOS
NSString *path =[[NSString alloc] initWithBytes:filename
length:wcslen(filename)*sizeof(*filename)
encoding:NSUTF32LittleEndianStringEncoding];
return unzOpen ((const char*)[path fileSystemRepresentation]);
#endif
#if defined(_WIN32) || defined (_WIN64) #if defined(_WIN32) || defined (_WIN64)
unzFile uf = unzOpen (filename); unzFile uf = unzOpen (filename);
#else #else
......
...@@ -232,6 +232,7 @@ ...@@ -232,6 +232,7 @@
MAC, MAC,
unix, unix,
_IOS, _IOS,
_XCODE,
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -260,6 +261,7 @@ ...@@ -260,6 +261,7 @@
MAC, MAC,
unix, unix,
_IOS, _IOS,
_XCODE,
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
QT -= core QT -= core
QT -= gui QT -= gui
VERSION = 2.4.467.0 VERSION = 2.4.470.0
DEFINES += INTVER=$$VERSION DEFINES += INTVER=$$VERSION
TARGET = x2t TARGET = x2t
......
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