Commit 533bc2c2 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - presentation - actions

parent 85226c08
...@@ -188,7 +188,7 @@ std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family: ...@@ -188,7 +188,7 @@ std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family:
} }
else else
{ {
const std::wstring id = std::wstring(L"style") + boost::lexical_cast<std::wstring>(count_++); const std::wstring id = std::wstring(L"style") + std::to_wstring(count_++);
map_.insert(std::make_pair(n, id)); map_.insert(std::make_pair(n, id));
return id; return id;
} }
...@@ -1060,7 +1060,7 @@ void docx_conversion_context::start_list_item(bool restart) ...@@ -1060,7 +1060,7 @@ void docx_conversion_context::start_list_item(bool restart)
if (restart && !list_style_stack_.empty()) if (restart && !list_style_stack_.empty())
{ {
const std::wstring curStyleName = current_list_style(); const std::wstring curStyleName = current_list_style();
const std::wstring newStyleName = curStyleName + boost::lexical_cast<std::wstring>(new_list_style_number_++); const std::wstring newStyleName = curStyleName + std::to_wstring(new_list_style_number_++);
list_style_renames_[curStyleName] = newStyleName; list_style_renames_[curStyleName] = newStyleName;
odf_reader::list_style_container & lists = root()->odf_context().listStyleContainer(); odf_reader::list_style_container & lists = root()->odf_context().listStyleContainer();
...@@ -1240,7 +1240,7 @@ std::wstring notes_context::add(const std::wstring & Content, const std::wstring ...@@ -1240,7 +1240,7 @@ std::wstring notes_context::add(const std::wstring & Content, const std::wstring
std::wstring notes_context::next_id() std::wstring notes_context::next_id()
{ {
instances_map & map = (type_ == odf_types::noteclass::Endnote) ? instances_endnotes_ : instances_footnotes_; instances_map & map = (type_ == odf_types::noteclass::Endnote) ? instances_endnotes_ : instances_footnotes_;
const std::wstring s = boost::lexical_cast<std::wstring>(map.size() + 1); const std::wstring s = std::to_wstring(map.size() + 1);
return s; return s;
} }
...@@ -1291,14 +1291,14 @@ void docx_conversion_context::start_text_changes (std::wstring id) ...@@ -1291,14 +1291,14 @@ void docx_conversion_context::start_text_changes (std::wstring id)
if (state.type == 1) if (state.type == 1)
{ {
output_stream() << L"<w:ins" << format_change << L" w:id=\"" << boost::lexical_cast<std::wstring>(current_id_changes++) << L"\">"; output_stream() << L"<w:ins" << format_change << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\">";
} }
if (state.type == 2) if (state.type == 2)
{ {
for (size_t i = 0 ; i < state.content.size(); i++) for (size_t i = 0 ; i < state.content.size(); i++)
{ {
output_stream() << L"<w:del" << format_change << L" w:id=\"" << boost::lexical_cast<std::wstring>(current_id_changes++) << L"\">"; output_stream() << L"<w:del" << format_change << L" w:id=\"" << std::to_wstring(current_id_changes++) << L"\">";
output_stream() << state.content[i]; output_stream() << state.content[i];
...@@ -1330,7 +1330,7 @@ void docx_conversion_context::start_changes() ...@@ -1330,7 +1330,7 @@ void docx_conversion_context::start_changes()
std::wstring change_attr; std::wstring change_attr;
change_attr += L" w:date=\"" + state.date + L"\""; change_attr += L" w:date=\"" + state.date + L"\"";
change_attr += L" w:author=\"" + state.author + L"\""; change_attr += L" w:author=\"" + state.author + L"\"";
change_attr += L" w:id=\"" + boost::lexical_cast<std::wstring>(current_id_changes++) + L"\""; change_attr += L" w:id=\"" + std::to_wstring(current_id_changes++) + L"\"";
if (state.type == 1) if (state.type == 1)
{ {
......
...@@ -317,7 +317,8 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val) ...@@ -317,7 +317,8 @@ void docx_serialize_common(std::wostream & strm, _docx_drawing & val)
{ {
CP_XML_ATTR(L"name", val.name); CP_XML_ATTR(L"name", val.name);
CP_XML_ATTR(L"id", val.id + 1); CP_XML_ATTR(L"id", val.id + 1);
oox_serialize_hlink(CP_XML_STREAM(), val.hlinks);
oox_serialize_action(CP_XML_STREAM(), val.action);
} }
CP_XML_NODE(L"wp:cNvGraphicFramePr") CP_XML_NODE(L"wp:cNvGraphicFramePr")
...@@ -529,7 +530,7 @@ mso-position-vertical-relative:text;"; ...@@ -529,7 +530,7 @@ mso-position-vertical-relative:text;";
strStyle += L"margin-top:" + boost::lexical_cast<std::wstring>(val.y / 12700.) + L"pt;"; strStyle += L"margin-top:" + boost::lexical_cast<std::wstring>(val.y / 12700.) + L"pt;";
strStyle += L"width:" + boost::lexical_cast<std::wstring>(val.cx / 12700.) + L"pt;"; strStyle += L"width:" + boost::lexical_cast<std::wstring>(val.cx / 12700.) + L"pt;";
strStyle += L"height:" + boost::lexical_cast<std::wstring>(val.cy / 12700.) + L"pt;"; strStyle += L"height:" + boost::lexical_cast<std::wstring>(val.cy / 12700.) + L"pt;";
strStyle += L"z-index:" + boost::lexical_cast<std::wstring>(0xF000800 - val.id); strStyle += L"z-index:" + std::to_wstring(0xF000800 - val.id);
CP_XML_ATTR(L"id", L"Rect" + std::to_wstring(val.id)); CP_XML_ATTR(L"id", L"Rect" + std::to_wstring(val.id));
CP_XML_ATTR(L"o:spid", L"_x0000_s" + std::to_wstring(1024 + val.id)); CP_XML_ATTR(L"o:spid", L"_x0000_s" + std::to_wstring(1024 + val.id));
......
...@@ -223,7 +223,7 @@ void docx_charts_files::write(const std::wstring & RootPath) ...@@ -223,7 +223,7 @@ void docx_charts_files::write(const std::wstring & RootPath)
if (item) if (item)
{ {
count++; count++;
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml"; const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml"; const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
content_type_content * contentTypes = get_main_document()->get_content_types_file().content(); content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
......
...@@ -62,7 +62,9 @@ struct drawing_object_description ...@@ -62,7 +62,9 @@ struct drawing_object_description
double anchor_x_; double anchor_x_;
double anchor_y_; double anchor_y_;
_action_desc action_;
std::vector<_hlink_desc> hlinks_; std::vector<_hlink_desc> hlinks_;
std::vector<odf_reader::_property> additional_; //shape properties std::vector<odf_reader::_property> additional_; //shape properties
std::wstring xlink_href_; //ссылка на внешний объект std::wstring xlink_href_; //ссылка на внешний объект
......
...@@ -39,13 +39,13 @@ namespace oox { ...@@ -39,13 +39,13 @@ namespace oox {
std::wstring headers_footers::create_id(size_t i) std::wstring headers_footers::create_id(size_t i)
{ {
return std::wstring(L"rHFId") + boost::lexical_cast<std::wstring>(i); return std::wstring(L"rHFId") + std::to_wstring(i);
} }
std::wstring headers_footers::create_name(size_t i, headers_footers::Type _Type) std::wstring headers_footers::create_name(size_t i, headers_footers::Type _Type)
{ {
return ((_Type == header || _Type == headerLeft || _Type == headerFirst) ? std::wstring(L"header") : std::wstring(L"footer") ) return ((_Type == header || _Type == headerLeft || _Type == headerFirst) ? std::wstring(L"header") : std::wstring(L"footer") )
+ boost::lexical_cast<std::wstring>(i) + L".xml"; + std::to_wstring(i) + L".xml";
} }
std::wstring headers_footers::add(const std::wstring & StyleName, std::wstring headers_footers::add(const std::wstring & StyleName,
...@@ -64,9 +64,10 @@ std::wstring headers_footers::add(const std::wstring & StyleName, ...@@ -64,9 +64,10 @@ std::wstring headers_footers::add(const std::wstring & StyleName,
} }
instance_ptr inst = instance_ptr( new instance(id, Content, type, name) ); instance_ptr inst = instance_ptr( new instance(id, Content, type, name) );
BOOST_FOREACH(const relationship & r, _rels.relationships()) std::vector<relationship> & rels = _rels.relationships();
for (size_t i = 0; i < rels.size(); i++)
{ {
inst->rels_.add(r); inst->rels_.add(rels[i]);
} }
instances_[StyleName].push_back(inst); instances_[StyleName].push_back(inst);
return id; return id;
......
...@@ -44,7 +44,8 @@ namespace oox { ...@@ -44,7 +44,8 @@ namespace oox {
hyperlinks::_ref hyperlinks::last() hyperlinks::_ref hyperlinks::last()
{ {
_ref r={}; _ref r={};
if (hrefs_.size()>0)
if (!hrefs_.empty())
r = hrefs_.back(); r = hrefs_.back();
return r; return r;
...@@ -52,9 +53,9 @@ hyperlinks::_ref hyperlinks::last() ...@@ -52,9 +53,9 @@ hyperlinks::_ref hyperlinks::last()
std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place, bool drawing) std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place, bool drawing)
{ {
std::wstring id = std::wstring(L"rHpId") + boost::lexical_cast<std::wstring>(hrefs_.size()+1); std::wstring id = std::wstring(L"rHpId") + std::to_wstring(hrefs_.size() + 1);
_ref r ={xml::utils::replace_text_to_xml(href), type_place, drawing, id, false}; _ref r = {xml::utils::replace_text_to_xml(href), type_place, drawing, id};
hrefs_.push_back(r); hrefs_.push_back(r);
...@@ -65,14 +66,14 @@ std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place, ...@@ -65,14 +66,14 @@ std::wstring hyperlinks::add(const std::wstring & href, _type_place type_place,
void hyperlinks::dump_rels(rels & Rels, _type_place type) void hyperlinks::dump_rels(rels & Rels, _type_place type)
{ {
size_t i = 0; size_t i = 0;
BOOST_FOREACH(_ref & elm, hrefs_) for (size_t i = 0; i < hrefs_.size(); i++)
{ {
if (elm.used_rels)continue; // уже использовали этот релс if (hrefs_[i].used_rels)continue; // уже использовали этот релс
if (elm.type_place == type) if (hrefs_[i].type_place == type)
{ {
Rels.add( relationship(elm.id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", elm.href, L"External" ) ); Rels.add( relationship(hrefs_[i].id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hrefs_[i].href, L"External" ) );
elm.used_rels = true; hrefs_[i].used_rels = true;
} }
} }
} }
......
...@@ -71,7 +71,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName, ...@@ -71,7 +71,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
// for (int i = 0; i <= 9; ++i) // for (int i = 0; i <= 9; ++i)
{ {
//if (FALSE == (hr = pFontManager->LoadString2( boost::lexical_cast<std::wstring>(i), 0, 0))) //if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0)))
// return std::pair<float, float>(7,8); // return std::pair<float, float>(7,8);
if (FALSE == (hr = pFontManager->LoadString2( L"xxxxx" , 0, 0))) if (FALSE == (hr = pFontManager->LoadString2( L"xxxxx" , 0, 0)))
......
...@@ -140,7 +140,7 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ ...@@ -140,7 +140,7 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
if (type == typeOleObject && sExt.empty()) if (type == typeOleObject && sExt.empty())
sExt = L".bin"; sExt = L".bin";
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt; return get_default_file_name(type) + std::to_wstring(Num) + sExt;
} }
std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName) std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
...@@ -219,7 +219,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b ...@@ -219,7 +219,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
{ {
if ( type == typeChart) if ( type == typeChart)
{ {
id = std::wstring(L"chId") + boost::lexical_cast<std::wstring>(count_charts + 1); id = std::wstring(L"chId") + std::to_wstring(count_charts + 1);
count_charts++; count_charts++;
} }
else if ( type == typeImage) else if ( type == typeImage)
...@@ -232,17 +232,17 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b ...@@ -232,17 +232,17 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
//------------------------------------------------ //------------------------------------------------
if (inputFileName.empty()) return L""; if (inputFileName.empty()) return L"";
id = std::wstring(L"picId") + boost::lexical_cast<std::wstring>(count_image + 1); id = std::wstring(L"picId") + std::to_wstring(count_image + 1);
count_image++; count_image++;
} }
else if ( type == typeMsObject || type == typeOleObject) else if ( type == typeMsObject || type == typeOleObject)
{ {
id = std::wstring(L"objId") + boost::lexical_cast<std::wstring>(count_object + 1); id = std::wstring(L"objId") + std::to_wstring(count_object + 1);
count_object++; count_object++;
} }
else else
{ {
id = std::wstring(L"rId") + boost::lexical_cast<std::wstring>(count_shape + 1); id = std::wstring(L"rId") + std::to_wstring(count_shape + 1);
count_shape++; count_shape++;
} }
......
...@@ -88,16 +88,19 @@ public: ...@@ -88,16 +88,19 @@ public:
{ {
switch (type) switch (type)
{ {
case typeImage: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"; case typeImage: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
case typeChart: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"; case typeChart: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
case typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"; case typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
case typeOleObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"; case typeOleObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
case typeHyperlink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"; case typeHyperlink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
default: case typeMedia: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/media";
return L""; case typeAudio: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio";
case typeVideo: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video";
case typeSlide: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
default:
return L"";
} }
} }
private: private:
std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num); std::wstring create_file_name (const std::wstring & uri, RelsType type, bool & isInternal, size_t Num);
std::wstring detectImageFileExtension (std::wstring &fileName); std::wstring detectImageFileExtension (std::wstring &fileName);
......
...@@ -516,23 +516,24 @@ void _oox_drawing::serialize_xfrm(std::wostream & strm, const std::wstring & nam ...@@ -516,23 +516,24 @@ void _oox_drawing::serialize_xfrm(std::wostream & strm, const std::wstring & nam
} }
} }
} }
void oox_serialize_hlink(std::wostream & strm, std::vector<_hlink_desc> const & val) void oox_serialize_action(std::wostream & strm, _action_desc const & val)
{ {
if (val.enabled == false) return;
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
BOOST_FOREACH(const _hlink_desc & h, val) CP_XML_NODE(L"a:hlinkClick")
{ {
if (h.in_object == true) //CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
{ //CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_NODE(L"a:hlinkClick")
{ CP_XML_ATTR(L"r:id", val.hId);
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main"); if (!val.action.empty())
CP_XML_ATTR(L"action", val.action);
CP_XML_ATTR(L"r:id", h.hId);
} if (val.highlightClick)
break; CP_XML_ATTR(L"highlightClick", val.highlightClick);
}
} }
} }
} }
......
...@@ -51,10 +51,28 @@ namespace oox { ...@@ -51,10 +51,28 @@ namespace oox {
{ {
std::wstring hId; std::wstring hId;
std::wstring hRef; std::wstring hRef;
};
struct _action_desc
{
_action_desc() : enabled(false), highlightClick(false) {}
void clear()
{
enabled = false;
highlightClick = false;
hId.clear();
hRef.clear();
action.clear();
}
bool enabled;
bool in_object; std::wstring hId;
}; std::wstring hRef;
std::wstring action;
RelsType typeRels;
bool highlightClick;
};
class _oox_drawing class _oox_drawing
{ {
public: public:
...@@ -74,10 +92,12 @@ namespace oox { ...@@ -74,10 +92,12 @@ namespace oox {
_oox_fill fill; _oox_fill fill;
std::wstring objectId; std::wstring objectId;
std::wstring objectProgId; std::wstring objectProgId;
_action_desc action;
std::vector<_hlink_desc> hlinks;
std::vector<_hlink_desc> hlinks;
std::vector<odf_reader::_property> additional; std::vector<odf_reader::_property> additional;
virtual void serialize (std::wostream & strm) = 0; virtual void serialize (std::wostream & strm) = 0;
...@@ -90,7 +110,7 @@ namespace oox { ...@@ -90,7 +110,7 @@ namespace oox {
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false); void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val); void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val);
void oox_serialize_hlink (std::wostream & strm, const std::vector<_hlink_desc> & val); void oox_serialize_action (std::wostream & strm, const _action_desc & val);
} }
} }
......
...@@ -71,7 +71,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double) ...@@ -71,7 +71,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double)
{ {
CP_XML_NODE(L"a:alpha") CP_XML_NODE(L"a:alpha")
{ {
CP_XML_ATTR(L"val", boost::lexical_cast<std::wstring>((int)(*opacity)*1000));// + L"%"); CP_XML_ATTR(L"val", std::to_wstring((int)(*opacity)*1000));// + L"%");
} }
} }
} }
...@@ -88,7 +88,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_type ...@@ -88,7 +88,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_type
{ {
CP_XML_NODE(L"a:alpha") CP_XML_NODE(L"a:alpha")
{ {
CP_XML_ATTR(L"val", boost::lexical_cast<std::wstring>((int)opacity->get_value()*1000));// + L"%"); CP_XML_ATTR(L"val", std::to_wstring((int)opacity->get_value()*1000));// + L"%");
} }
} }
} }
......
...@@ -56,18 +56,6 @@ std::wostream & relationship::xml_to_stream(std::wostream & _Wostream) const ...@@ -56,18 +56,6 @@ std::wostream & relationship::xml_to_stream(std::wostream & _Wostream) const
CP_XML_ATTR(L"TargetMode", target_mode()); CP_XML_ATTR(L"TargetMode", target_mode());
} }
} }
//_Wostream << L"<Relationship ";
//CP_XML_SERIALIZE_ATTR(L"Id", id());
//CP_XML_SERIALIZE_ATTR(L"Type", type());
//CP_XML_SERIALIZE_ATTR(L"Target", target());
//
//if (!target_mode().empty())
//{
// CP_XML_SERIALIZE_ATTR(L"TargetMode", target_mode());
//}
//_Wostream << L" />";
return _Wostream; return _Wostream;
} }
...@@ -82,23 +70,12 @@ std::wostream & rels::xml_to_stream(std::wostream & _Wostream) const ...@@ -82,23 +70,12 @@ std::wostream & rels::xml_to_stream(std::wostream & _Wostream) const
{ {
CP_XML_ATTR(L"xmlns", xmlns::rels.value); CP_XML_ATTR(L"xmlns", xmlns::rels.value);
BOOST_FOREACH(const relationship & r, relationship_) for (size_t i = 0; i < relationship_.size(); i++)
{ {
r.xml_to_stream(CP_XML_STREAM()); relationship_[i].xml_to_stream(CP_XML_STREAM());
} }
} // "Relationships" }
} }
//_Wostream << L"<Relationships ";
//CP_XML_SERIALIZE_ATTR(L"xmlns", xmlns::rels.value);
//_Wostream << L">";
//BOOST_FOREACH(const relationship & r, relationship_)
//{
// r.xml_to_stream(_Wostream);
//}
//_Wostream << L"</Relationships>";
return _Wostream; return _Wostream;
} }
......
...@@ -52,7 +52,10 @@ enum RelsType ...@@ -52,7 +52,10 @@ enum RelsType
typeMedia, typeMedia,
typeGroupShape, typeGroupShape,
typeMsObject, typeMsObject,
typeOleObject typeOleObject,
typeSlide,
typeVideo,
typeAudio
}; };
struct _rel struct _rel
......
...@@ -54,13 +54,13 @@ public: ...@@ -54,13 +54,13 @@ public:
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content,pptx_comments_ptr comments) std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content,pptx_comments_ptr comments)
{ {
const std::wstring file_id = boost::lexical_cast<std::wstring>(next_file_id_++); const std::wstring file_id = std::to_wstring(next_file_id_++);
const std::wstring fileName = std::wstring(L"comment") + file_id + L".xml"; const std::wstring fileName = std::wstring(L"comment") + file_id + L".xml";
comments_.push_back(pptx_comment_elm(fileName, content, comments)); comments_.push_back(pptx_comment_elm(fileName, content, comments));
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++); const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id; const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(fileName, rId); return std::pair<std::wstring, std::wstring>(fileName, rId);
} }
......
...@@ -195,7 +195,7 @@ void pptx_conversion_context::process_theme(std::wstring name) ...@@ -195,7 +195,7 @@ void pptx_conversion_context::process_theme(std::wstring name)
if (name.empty()) if (name.empty())
{ {
name = L"User Theme: " + boost::lexical_cast<std::wstring>(current); name = L"User Theme: " + std::to_wstring(current);
} }
start_theme(name); start_theme(name);
// //
...@@ -489,7 +489,7 @@ bool pptx_conversion_context::start_layout(int layout_index) ...@@ -489,7 +489,7 @@ bool pptx_conversion_context::start_layout(int layout_index)
root()->odf_context().styleContainer().presentation_masters().add_layout_to(layouts.content[layout_index].master_name,layouts.content[layout_index]); root()->odf_context().styleContainer().presentation_masters().add_layout_to(layouts.content[layout_index].master_name,layouts.content[layout_index]);
current_layout().Rels().add(relationship(L"smId1"/*master_id.second*/, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster", current_layout().Rels().add(relationship(L"smId1"/*master_id.second*/, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster",
std::wstring(L"../slideMasters/slideMaster") + boost::lexical_cast<std::wstring>(master_id.first) + L".xml")); std::wstring(L"../slideMasters/slideMaster") + std::to_wstring(master_id.first) + L".xml"));
// //
} }
......
...@@ -76,7 +76,7 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val) ...@@ -76,7 +76,7 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val)
CP_XML_ATTR(L"id", val.id); CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name); CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(), val.hlinks); oox_serialize_action(CP_XML_STREAM(), val.action);
} }
CP_XML_NODE(L"p:cNvPicPr") CP_XML_NODE(L"p:cNvPicPr")
...@@ -109,6 +109,55 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val) ...@@ -109,6 +109,55 @@ void pptx_serialize_image(std::wostream & strm, _pptx_drawing & val)
} }
} }
} }
void pptx_serialize_media(std::wostream & strm, _pptx_drawing & val)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"p:pic")
{
CP_XML_NODE(L"p:nvPicPr")
{
CP_XML_NODE(L"p:cNvPr")
{
CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name);
oox_serialize_action(CP_XML_STREAM(), val.action);
}
CP_XML_NODE(L"p:cNvPicPr")
{
}
CP_XML_NODE(L"p:nvPr")
{
CP_XML_NODE(L"a:videoFile")
{
CP_XML_ATTR(L"r:link", val.objectId);
}
}
}
if (val.fill.bitmap)
val.fill.bitmap->name_space = L"p";
oox_serialize_fill(CP_XML_STREAM(), val.fill);
CP_XML_NODE(L"p:spPr")
{
val.serialize_xfrm(CP_XML_STREAM(), L"a", true);
CP_XML_NODE(L"a:prstGeom")
{
CP_XML_ATTR(L"prst", L"rect");
CP_XML_NODE(L"a:avLst");
}
oox_serialize_ln(CP_XML_STREAM(), val.additional);
}
//_CP_OPT(std::wstring) strTextContent;
//odf::GetProperty(properties,L"text-content",strTextContent);
//pptx_serialize_text(CP_XML_STREAM(),val.additional);
//на картинке тект нельзя... - выше сменили тип на рект с заливкой
}
}
}
void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val) void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
{ {
...@@ -123,7 +172,7 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val) ...@@ -123,7 +172,7 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
CP_XML_ATTR(L"name", val.name); CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks); oox_serialize_action(CP_XML_STREAM(),val.action);
} }
CP_XML_NODE(L"p:cNvSpPr")//non visual properies (собственно тока 1 там) CP_XML_NODE(L"p:cNvSpPr")//non visual properies (собственно тока 1 там)
{ {
...@@ -315,6 +364,10 @@ void _pptx_drawing::serialize(std::wostream & strm) ...@@ -315,6 +364,10 @@ void _pptx_drawing::serialize(std::wostream & strm)
{ {
pptx_serialize_object(strm, *this); pptx_serialize_object(strm, *this);
} }
else if (type == typeMedia)
{
pptx_serialize_media(strm, *this);
}
} }
......
...@@ -65,11 +65,15 @@ public: ...@@ -65,11 +65,15 @@ public:
{ {
pptx_drawing_rels_.push_back(_rel(isInternal, rid, ref, type)); pptx_drawing_rels_.push_back(_rel(isInternal, rid, ref, type));
} }
for (int i = 0; i < d.hlinks.size(); i++) for (size_t i = 0; i < d.hlinks.size(); i++)
{ {
pptx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink)); pptx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
} }
} if (!d.action.hId.empty())
{
pptx_drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
}
}
void add(/**/ void add(/**/
bool isInternal, bool isInternal,
......
...@@ -100,7 +100,7 @@ void slide_content::add_rels(rels & _r) ...@@ -100,7 +100,7 @@ void slide_content::add_rels(rels & _r)
{ {
std::vector<relationship> & r = _r.relationships(); std::vector<relationship> & r = _r.relationships();
for (int i = 0; i < r.size(); i++) for (size_t i = 0; i < r.size(); i++)
{ {
rels_->get_rels().add(r[i]); rels_->get_rels().add(r[i]);
} }
......
...@@ -160,6 +160,7 @@ void pptx_slide_context::Impl::process_drawings() ...@@ -160,6 +160,7 @@ void pptx_slide_context::Impl::process_drawings()
case typeChart: process_chart(objects_[i], drawing); break; case typeChart: process_chart(objects_[i], drawing); break;
case typeShape: process_shape(objects_[i], drawing); break; case typeShape: process_shape(objects_[i], drawing); break;
case typeTable: process_table(objects_[i], drawing); break; case typeTable: process_table(objects_[i], drawing); break;
case typeMedia:
case typeMsObject: case typeMsObject:
case typeOleObject: process_object(objects_[i], drawing); break; case typeOleObject: process_object(objects_[i], drawing); break;
} }
...@@ -228,6 +229,8 @@ void pptx_slide_context::default_set() ...@@ -228,6 +229,8 @@ void pptx_slide_context::default_set()
impl_->object_description_.svg_rect_ = boost::none; impl_->object_description_.svg_rect_ = boost::none;
impl_->object_description_.hlinks_.clear(); impl_->object_description_.hlinks_.clear();
impl_->object_description_.action_.clear();
impl_->object_description_.additional_.clear(); impl_->object_description_.additional_.clear();
impl_->object_description_.fill_.clear(); impl_->object_description_.fill_.clear();
...@@ -323,15 +326,15 @@ void pptx_slide_context::set_fill(_oox_fill & fill) ...@@ -323,15 +326,15 @@ void pptx_slide_context::set_fill(_oox_fill & fill)
impl_->object_description_.fill_= fill; impl_->object_description_.fill_= fill;
} }
std::wstring pptx_slide_context::add_hyperlink(std::wstring const & href,bool object) std::wstring pptx_slide_context::add_hyperlink(std::wstring const & href)
{ {
++hlinks_size_; ++hlinks_size_;
std::wstring hId=std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_size_); std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
std::wstring href_correct = xml::utils::replace_text_to_xml(href); std::wstring href_correct = xml::utils::replace_text_to_xml(href);
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
_hlink_desc desc={hId, href_correct, object}; _hlink_desc desc = {hId, href_correct};
impl_->object_description_.hlinks_.push_back(desc); impl_->object_description_.hlinks_.push_back(desc);
return hId; return hId;
...@@ -347,14 +350,12 @@ void pptx_slide_context::add_background(_oox_fill & fill) ...@@ -347,14 +350,12 @@ void pptx_slide_context::add_background(_oox_fill & fill)
fill.bitmap->rId = get_mediaitems().add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref); fill.bitmap->rId = get_mediaitems().add_or_find(fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage); add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
} }
impl_->background_fill_ = fill; impl_->background_fill_ = fill;
} }
void pptx_slide_context::set_name(std::wstring const & name) void pptx_slide_context::set_name(std::wstring const & name)
{ {
impl_->object_description_.name_ = name; impl_->object_description_.name_ = name;
} }
void pptx_slide_context::start_shape(int type) void pptx_slide_context::start_shape(int type)
...@@ -362,6 +363,62 @@ void pptx_slide_context::start_shape(int type) ...@@ -362,6 +363,62 @@ void pptx_slide_context::start_shape(int type)
impl_->object_description_.type_ = typeShape; impl_->object_description_.type_ = typeShape;
impl_->object_description_.shape_type_ = type; //2,3... impl_->object_description_.shape_type_ = type; //2,3...
} }
void pptx_slide_context::start_action(std::wstring action)
{
impl_->object_description_.action_.enabled = true;
if (action == L"sound")
{
impl_->object_description_.action_.typeRels = typeAudio;
impl_->object_description_.action_.highlightClick = true;
}
else if (action == L"next-page")
{
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=nextslide";
impl_->object_description_.action_.highlightClick = true;
}
else if (action == L"previous-page")
{
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=previousslide";
impl_->object_description_.action_.highlightClick = true;
}
else if (action == L"first-page")
{
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=firstslide";
impl_->object_description_.action_.highlightClick = true;
}
else if (action == L"last-page")
{
impl_->object_description_.action_.action = L"ppaction://hlinkshowjump?jump=lastslide";
impl_->object_description_.action_.highlightClick = true;
}
//ppaction://hlinkshowjump?jump=endshow
else if (action == L"execute")
{
impl_->object_description_.action_.action = L"ppaction://program";
impl_->object_description_.action_.typeRels = typeHyperlink;
impl_->object_description_.action_.highlightClick = true;
}
}
void pptx_slide_context::set_link(std::wstring link, RelsType typeRels)
{
++hlinks_size_;
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
link = xml::utils::replace_text_to_xml(link);
if (typeRels == typeHyperlink)
XmlUtils::replace_all( link, L" .", L"."); //1 (130).odt
impl_->object_description_.action_.highlightClick = true;
impl_->object_description_.action_.hId = hId;
impl_->object_description_.action_.hRef = link;
impl_->object_description_.action_.typeRels = typeRels;
}
void pptx_slide_context::end_action()
{
}
void pptx_slide_context::start_table() void pptx_slide_context::start_table()
{ {
...@@ -385,6 +442,20 @@ void pptx_slide_context::set_ole_object(const std::wstring & path, const std::ws ...@@ -385,6 +442,20 @@ void pptx_slide_context::set_ole_object(const std::wstring & path, const std::ws
impl_->object_description_.xlink_href_ = path; impl_->object_description_.xlink_href_ = path;
impl_->object_description_.descriptor_ = progId; impl_->object_description_.descriptor_ = progId;
} }
void pptx_slide_context::set_media(const std::wstring & path)
{
if (path.empty()) return;
impl_->object_description_.type_ = typeMedia;
impl_->object_description_.xlink_href_ = path;
impl_->object_description_.action_.enabled = true;
impl_->object_description_.action_.action = L"ppaction://media";
}
void pptx_slide_context::set_media_param(std::wstring name, std::wstring value)
{
}
void pptx_slide_context::set_image(const std::wstring & path) void pptx_slide_context::set_image(const std::wstring & path)
{ {
...@@ -532,7 +603,6 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _ ...@@ -532,7 +603,6 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
add_drawing(drawing, isMediaInternal, rId, ref, typeShape); add_drawing(drawing, isMediaInternal, rId, ref, typeShape);
} }
void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _pptx_drawing & drawing) void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _pptx_drawing & drawing)
{ {
std::wstring ref; std::wstring ref;
...@@ -557,23 +627,22 @@ void pptx_slide_context::Impl::process_common_properties(drawing_object_descript ...@@ -557,23 +627,22 @@ void pptx_slide_context::Impl::process_common_properties(drawing_object_descript
{ {
//todooo непонятки с отрицательными значениями //todooo непонятки с отрицательными значениями
int val = (int)(0.5 + odf_types::length(pic.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu)); int val = (int)(0.5 + odf_types::length(pic.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >= 0) drawing.x = val; if ( val >= 0) drawing.x = val;
val = (int)(0.5 + odf_types::length(pic.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu)); val = (int)(0.5 + odf_types::length(pic.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >= 0) drawing.y = val; if ( val >= 0 ) drawing.y = val;
val = (int)(0.5 + odf_types::length(pic.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu)); val = (int)(0.5 + odf_types::length(pic.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >=0) drawing.cx = val; if ( val >=0 ) drawing.cx = val;
val = (int)(0.5 + odf_types::length(pic.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu)); val = (int)(0.5 + odf_types::length(pic.svg_rect_->cy, odf_types::length::pt).get_value_unit(odf_types::length::emu));
if (val >=0) drawing.cy = val; if ( val >=0 ) drawing.cy = val;
} }
drawing.additional = pic.additional_; drawing.additional = pic.additional_;
drawing.hlinks = pic.hlinks_;
drawing.hlinks = pic.hlinks_; drawing.action = pic.action_;
drawing.fill = pic.fill_;
drawing.fill = pic.fill_;
} }
void pptx_slide_context::dump_rels(rels & Rels) void pptx_slide_context::dump_rels(rels & Rels)
......
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
void set_placeHolder_type (std::wstring typeHolder); void set_placeHolder_type (std::wstring typeHolder);
void set_placeHolder_idx (int idx); void set_placeHolder_idx (int idx);
std::wstring add_hyperlink(std::wstring const & ref, bool object); std::wstring add_hyperlink(std::wstring const & ref);
void start_frame(); void start_frame();
void set_image (const std::wstring & path); void set_image (const std::wstring & path);
...@@ -83,8 +83,14 @@ public: ...@@ -83,8 +83,14 @@ public:
void set_ms_object (const std::wstring & path, const std::wstring & progId); void set_ms_object (const std::wstring & path, const std::wstring & progId);
void set_ole_object (const std::wstring & path, const std::wstring & progId); void set_ole_object (const std::wstring & path, const std::wstring & progId);
void set_text_box (); void set_text_box ();
void set_media (const std::wstring & path);
void set_media_param(std::wstring name, std::wstring value);
void end_frame(); void end_frame();
void start_action (std::wstring action);
void set_link (std::wstring link, RelsType typeRels = typeHyperlink);
void end_action ();
void start_table(); void start_table();
void end_table(); void end_table();
......
...@@ -631,7 +631,7 @@ void pptx_text_context::Impl::start_list_item(bool restart) ...@@ -631,7 +631,7 @@ void pptx_text_context::Impl::start_list_item(bool restart)
if (restart && !list_style_stack_.empty()) if (restart && !list_style_stack_.empty())
{ {
const std::wstring curStyleName = current_list_style(); const std::wstring curStyleName = current_list_style();
const std::wstring newStyleName = curStyleName + boost::lexical_cast<std::wstring>(new_list_style_number_++); const std::wstring newStyleName = curStyleName + std::to_wstring(new_list_style_number_++);
list_style_renames_[curStyleName] = newStyleName; list_style_renames_[curStyleName] = newStyleName;
odf_reader::list_style_container & lists = odf_context_.listStyleContainer(); odf_reader::list_style_container & lists = odf_context_.listStyleContainer();
......
...@@ -143,9 +143,9 @@ public: ...@@ -143,9 +143,9 @@ public:
std::wstring style = std::wstring(L"position:absolute;"); std::wstring style = std::wstring(L"position:absolute;");
style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;"); style += std::wstring(L"margin-left:") + boost::lexical_cast<std::wstring>(c.left_) + std::wstring(L"pt;");
style += std::wstring(L"margin-top:") + boost::lexical_cast<std::wstring>(c.top_) + std::wstring(L"pt;"); style += std::wstring(L"margin-top:") + boost::lexical_cast<std::wstring>(c.top_) + std::wstring(L"pt;");
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;"); style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(c.height_) + std::wstring(L"pt;"); style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(c.height_) + std::wstring(L"pt;");
if (c.visibly_ == false)style += std::wstring(L"visibility:hidden;"); if (c.visibly_ == false)style += std::wstring(L"visibility:hidden;");
...@@ -227,14 +227,14 @@ public: ...@@ -227,14 +227,14 @@ public:
if (c.author_ == author_list_[i]) if (c.author_ == author_list_[i])
{ {
find=true; find=true;
c.author_ = boost::lexical_cast<std::wstring>(i); c.author_ = std::to_wstring(i);
break; break;
} }
} }
if (!find) if (!find)
{ {
author_list_.push_back(c.author_); author_list_.push_back(c.author_);
c.author_ = boost::lexical_cast<std::wstring>(author_list_.size()-1); c.author_ = std::to_wstring(author_list_.size()-1);
} }
xlsx_comment_.push_back(c); xlsx_comment_.push_back(c);
} }
......
...@@ -54,21 +54,21 @@ public: ...@@ -54,21 +54,21 @@ public:
std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments) std::pair<std::wstring, std::wstring> add_comments_xml(std::wstring const & content, std::wstring const & vml_content,xlsx_comments_ptr comments)
{ {
const std::wstring file_id = boost::lexical_cast<std::wstring>(next_file_id_++); const std::wstring file_id = std::to_wstring(next_file_id_++);
const std::wstring fileName = std::wstring(L"comments") + file_id + L".xml"; const std::wstring fileName = std::wstring(L"comments") + file_id + L".xml";
const std::wstring vml_fileName = std::wstring(L"vmlDrawing") + file_id + L".vml"; const std::wstring vml_fileName = std::wstring(L"vmlDrawing") + file_id + L".vml";
comments_.push_back(comment_elm(fileName,vml_fileName, content, vml_content, comments)); comments_.push_back(comment_elm(fileName,vml_fileName, content, vml_content, comments));
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++); const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id; const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(fileName, rId); return std::pair<std::wstring, std::wstring>(fileName, rId);
} }
std::pair<std::wstring, std::wstring> get_vml_drawing_xml() std::pair<std::wstring, std::wstring> get_vml_drawing_xml()
{ {
const std::wstring id = boost::lexical_cast<std::wstring>(next_comments_id_++); const std::wstring id = std::to_wstring(next_comments_id_++);
const std::wstring rId = std::wstring(L"comId") + id; const std::wstring rId = std::wstring(L"comId") + id;
return std::pair<std::wstring, std::wstring>(comments_.back().vml_filename, rId); return std::pair<std::wstring, std::wstring>(comments_.back().vml_filename, rId);
} }
......
...@@ -113,7 +113,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val) ...@@ -113,7 +113,7 @@ void xlsx_serialize_image(std::wostream & strm, _xlsx_drawing & val)
CP_XML_ATTR(L"id", val.id); CP_XML_ATTR(L"id", val.id);
CP_XML_ATTR(L"name", val.name); CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks); oox_serialize_action(CP_XML_STREAM(), val.action);
} }
CP_XML_NODE(L"xdr:cNvPicPr") CP_XML_NODE(L"xdr:cNvPicPr")
...@@ -158,7 +158,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val) ...@@ -158,7 +158,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
CP_XML_ATTR(L"name", val.name); CP_XML_ATTR(L"name", val.name);
oox_serialize_hlink(CP_XML_STREAM(),val.hlinks); oox_serialize_action(CP_XML_STREAM(), val.action);
} }
CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там) CP_XML_NODE(L"xdr:cNvSpPr")//non visual properies (собственно тока 1 там)
{ {
......
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings) std::pair<std::wstring, std::wstring> add_drawing_xml(std::wstring const & content, xlsx_drawings_ptr drawings)
{ {
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, drawings)); drawings_.push_back(drawing_elm(fileName, content, drawings));
const std::wstring rId = std::wstring(L"rId") + id;//rDrId const std::wstring rId = std::wstring(L"rId") + id;//rDrId
...@@ -173,6 +173,7 @@ void xlsx_drawing_context::clear() ...@@ -173,6 +173,7 @@ void xlsx_drawing_context::clear()
impl_->object_description_.additional_.clear(); impl_->object_description_.additional_.clear();
impl_->object_description_.hlinks_.clear(); impl_->object_description_.hlinks_.clear();
impl_->object_description_.action_.clear();
impl_->object_description_.additional_.clear(); impl_->object_description_.additional_.clear();
impl_->use_image_replacement_ = false; impl_->use_image_replacement_ = false;
...@@ -399,16 +400,17 @@ void xlsx_drawing_context::set_fill(_oox_fill & fill) ...@@ -399,16 +400,17 @@ void xlsx_drawing_context::set_fill(_oox_fill & fill)
impl_->object_description_.fill_= fill; impl_->object_description_.fill_= fill;
} }
std::wstring xlsx_drawing_context::add_hyperlink(std::wstring const & href,bool object) std::wstring xlsx_drawing_context::add_hyperlink(std::wstring const & href)
{ {
++hlinks_size_; ++hlinks_size_;
std::wstring hId=std::wstring(L"hId") + boost::lexical_cast<std::wstring>(hlinks_size_); std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
std::wstring href_correct = xml::utils::replace_text_to_xml(href); std::wstring href_correct = xml::utils::replace_text_to_xml(href);
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
_hlink_desc desc = {hId, href_correct, object}; //корректность написания ссылки важна для ms office и не важна для open office -> //корректность написания ссылки важна для ms office и не важна для open office ->
//todooo //todooo
_hlink_desc desc = {hId, href_correct};
impl_->object_description_.hlinks_.push_back(desc); impl_->object_description_.hlinks_.push_back(desc);
return hId; return hId;
...@@ -464,6 +466,7 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description ...@@ -464,6 +466,7 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
drawing.additional = obj.additional_; drawing.additional = obj.additional_;
drawing.hlinks = obj.hlinks_; drawing.hlinks = obj.hlinks_;
drawing.action = obj.action_;
} }
void xlsx_drawing_context::process_position_properties(drawing_object_description & obj, xlsx_table_metrics & table_metrics,xlsx_table_position & from,xlsx_table_position & to) void xlsx_drawing_context::process_position_properties(drawing_object_description & obj, xlsx_table_metrics & table_metrics,xlsx_table_position & from,xlsx_table_position & to)
{ {
...@@ -662,11 +665,33 @@ void xlsx_drawing_context::serialize(std::wostream & strm) ...@@ -662,11 +665,33 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
impl_->serialize(strm); impl_->serialize(strm);
} }
xlsx_drawings_ptr xlsx_drawing_context::get_drawings() xlsx_drawings_ptr xlsx_drawing_context::get_drawings()
{ {
return impl_->get_drawings(); return impl_->get_drawings();
} }
void xlsx_drawing_context::start_action(std::wstring action)
{
impl_->object_description_.action_.enabled = true;
}
void xlsx_drawing_context::set_link(std::wstring link, RelsType typeRels)
{//hyprelinks only
++hlinks_size_;
std::wstring hId = L"hId" + std::to_wstring(hlinks_size_);
link = xml::utils::replace_text_to_xml(link);
if (typeRels == typeHyperlink)
XmlUtils::replace_all( link, L" .", L"."); //1 (130).odt
impl_->object_description_.action_.hId = hId;
impl_->object_description_.action_.hRef = link;
impl_->object_description_.action_.typeRels = typeRels;
}
void xlsx_drawing_context::end_action()
{
}
} }
} }
...@@ -111,7 +111,7 @@ public: ...@@ -111,7 +111,7 @@ public:
std::vector<odf_reader::_property> & get_properties(); std::vector<odf_reader::_property> & get_properties();
std::wstring add_hyperlink(std::wstring const & ref, bool object); std::wstring add_hyperlink(std::wstring const & ref);
void set_use_image_replacement(); void set_use_image_replacement();
...@@ -125,6 +125,10 @@ public: ...@@ -125,6 +125,10 @@ public:
void process_objects(xlsx_table_metrics & table_metrics); void process_objects(xlsx_table_metrics & table_metrics);
void start_action(std::wstring action);
void set_link(std::wstring link, RelsType typeRels = typeHyperlink);
void end_action();
private: private:
class Impl; class Impl;
_CP_PTR(Impl) impl_; _CP_PTR(Impl) impl_;
......
...@@ -50,10 +50,12 @@ public: ...@@ -50,10 +50,12 @@ public:
add (isInternal, rid, ref, type, sheet_rel); add (isInternal, rid, ref, type, sheet_rel);
for (int i = 0 ; i < d.hlinks.size(); i++) for (size_t i = 0; i < d.hlinks.size(); i++)
{ {
xlsx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink)); xlsx_drawing_rels_.push_back(_rel(false, d.hlinks[i].hId, d.hlinks[i].hRef, typeHyperlink));
} }
if (!d.action.hId.empty())
xlsx_drawing_rels_.push_back(_rel(false, d.action.hId, d.action.hRef, d.action.typeRels));
} }
void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel) //не объект void add( bool isInternal, std::wstring const & rid, std::wstring const & ref, RelsType type, bool sheet_rel) //не объект
{ {
......
...@@ -82,7 +82,7 @@ public: ...@@ -82,7 +82,7 @@ public:
record r; record r;
r.ref = ref; r.ref = ref;
r.display = display; r.display = display;
r.id = std::wstring(L"hId") + boost::lexical_cast<std::wstring>(records_.size()+1); r.id = std::wstring(L"hId") + std::to_wstring(records_.size()+1);
int pos_target = target.find(L"#"); int pos_target = target.find(L"#");
if (pos_target == 0)//ссыль на страницу или метку в текущем документе if (pos_target == 0)//ссыль на страницу или метку в текущем документе
......
...@@ -128,7 +128,7 @@ void sheets_files::write(const std::wstring & RootPath) ...@@ -128,7 +128,7 @@ void sheets_files::write(const std::wstring & RootPath)
if (item) if (item)
{ {
count++; count++;
const std::wstring fileName = std::wstring(L"sheet") + boost::lexical_cast<std::wstring>(count) + L".xml"; const std::wstring fileName = std::wstring(L"sheet") + std::to_wstring(count) + L".xml";
const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"; const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content(); content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
...@@ -136,7 +136,7 @@ void sheets_files::write(const std::wstring & RootPath) ...@@ -136,7 +136,7 @@ void sheets_files::write(const std::wstring & RootPath)
if (rels_) if (rels_)
{ {
const std::wstring id = std::wstring(L"sId") + boost::lexical_cast<std::wstring>(count); const std::wstring id = std::wstring(L"sId") + std::to_wstring(count);
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"; static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName; const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
rels_->add(id, kWSRel, fileRef); rels_->add(id, kWSRel, fileRef);
...@@ -286,7 +286,7 @@ void xl_charts_files::write(const std::wstring & RootPath) ...@@ -286,7 +286,7 @@ void xl_charts_files::write(const std::wstring & RootPath)
if (item) if (item)
{ {
count++; count++;
const std::wstring fileName = std::wstring(L"chart") + boost::lexical_cast<std::wstring>(count) + L".xml"; const std::wstring fileName = std::wstring(L"chart") + std::to_wstring(count) + L".xml";
content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content(); content_type_content * contentTypes = this->get_main_document()->get_content_types_file().content();
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml"; static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
......
...@@ -66,7 +66,7 @@ std::wstring getColAddress(size_t col) ...@@ -66,7 +66,7 @@ std::wstring getColAddress(size_t col)
std::wstring getRowAddress(size_t row) std::wstring getRowAddress(size_t row)
{ {
return boost::lexical_cast<std::wstring>(row + 1); return std::to_wstring(row + 1);
} }
std::wstring getCellAddress(size_t col, size_t row) std::wstring getCellAddress(size_t col, size_t row)
......
...@@ -138,7 +138,7 @@ void xlsx_conversion_context::end_document() ...@@ -138,7 +138,7 @@ void xlsx_conversion_context::end_document()
{ {
xlsx_xml_worksheet_ptr& sheet = sheets_[i]; xlsx_xml_worksheet_ptr& sheet = sheets_[i];
const std::wstring id = std::wstring(L"sId") + boost::lexical_cast<std::wstring>(i + 1); const std::wstring id = std::wstring(L"sId") + std::to_wstring(i + 1);
package::sheet_content_ptr content = package::sheet_content::create(); package::sheet_content_ptr content = package::sheet_content::create();
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
...@@ -634,7 +634,7 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href) ...@@ -634,7 +634,7 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href)
} }
else else
{ {
std::wstring hId = get_drawing_context().add_hyperlink(href,false); std::wstring hId = get_drawing_context().add_hyperlink(href);
xlsx_text_context_.end_hyperlink(hId); xlsx_text_context_.end_hyperlink(hId);
xlsx_text_context_.end_span2(); xlsx_text_context_.end_span2();
......
This diff is collapsed.
...@@ -45,7 +45,6 @@ namespace cpdoccore { ...@@ -45,7 +45,6 @@ namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
//anim:par //anim:par
class anim_par : public office_element_impl<anim_par>//Параллельные анимации class anim_par : public office_element_impl<anim_par>//Параллельные анимации
{ {
...@@ -95,26 +94,25 @@ private: ...@@ -95,26 +94,25 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(anim_seq); CP_REGISTER_OFFICE_ELEMENT2(anim_seq);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim:iterate //anim:iterate
//class anim_iterate : public office_element_impl<anim_iterate>//Итеративные анимации //-------------------------------------------------------------------------------
class anim_audio_attlist
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// {
//----------------------------------------------------------------------------------------------------------------/ public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void add_attributes( const xml::attributes_wc_ptr & Attributes );
//anim-transition-filter-attlist
_CP_OPT(std::wstring) xlink_href_;
_CP_OPT(std::wstring) anim_audio_level_;
};
class anim_transition_filter_attlist class anim_transition_filter_attlist
{ {
public: public:
void add_attributes( const xml::attributes_wc_ptr & Attributes ); void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(std::wstring) smil_direction_;
_CP_OPT(std::wstring) smil_subtype_; _CP_OPT(std::wstring) smil_subtype_;
_CP_OPT(odf_types::smil_transition_type) smil_type_; _CP_OPT(odf_types::smil_transition_type) smil_type_;
_CP_OPT(std::wstring) smil_mode_; _CP_OPT(std::wstring) smil_mode_;
_CP_OPT(odf_types::color) smil_fadeColor_; _CP_OPT(odf_types::color) smil_fadeColor_;
_CP_OPT(odf_types::clockvalue) smil_dur_;
}; };
//anim:transitionFilter
class anim_transitionFilter : public office_element_impl<anim_transitionFilter> class anim_transitionFilter : public office_element_impl<anim_transitionFilter>
{ {
public: public:
...@@ -126,7 +124,8 @@ public: ...@@ -126,7 +124,8 @@ public:
virtual void pptx_convert(oox::pptx_conversion_context & Context); virtual void pptx_convert(oox::pptx_conversion_context & Context);
anim_transition_filter_attlist attlist_; odf_types::common_anim_smil_attlist common_attlist_;
anim_transition_filter_attlist filter_attlist_;
private: private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){} virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
...@@ -135,7 +134,26 @@ private: ...@@ -135,7 +134,26 @@ private:
}; };
CP_REGISTER_OFFICE_ELEMENT2(anim_transitionFilter); CP_REGISTER_OFFICE_ELEMENT2(anim_transitionFilter);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim:audio class anim_audio : public office_element_impl<anim_audio>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeAnimAudio;
CPDOCCORE_DEFINE_VISITABLE();
virtual void pptx_convert(oox::pptx_conversion_context & Context);
odf_types::common_anim_smil_attlist common_attlist_;
anim_audio_attlist audio_attlist_;
private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
};
CP_REGISTER_OFFICE_ELEMENT2(anim_audio);
//anim:command //anim:command
} }
......
...@@ -46,7 +46,40 @@ std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val) ...@@ -46,7 +46,40 @@ std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
_Wostream << L"indefinite"; _Wostream << L"indefinite";
else else
{ {
_Wostream << _Val.get_value() << "ms"; // todoooo усложнить .. int ms = _Val.get_value();
int sec = 0;
int min = 0;
int h = 0;
if (ms > 1000)
{
sec = ms / 1000;
ms -= sec * 1000;
if (sec > 60)
{
min = sec / 60;
sec -= min * 60;
if (min > 60)
{
h = min / 60;
min -= h * 60;
}
}
}
if ( h > 0)
_Wostream << h << "h";
if ( min > 0)
_Wostream << min << "min";
if ( sec > 0)
_Wostream << sec << "s";
if ( ms > 0)
_Wostream << ms << "ms";
if (h == 0 && min == 0 && ms == 0 && sec == 0)
_Wostream << "0s";
} }
return _Wostream; return _Wostream;
} }
...@@ -131,11 +164,11 @@ clockvalue clockvalue::parse(const std::wstring & Str) ...@@ -131,11 +164,11 @@ clockvalue clockvalue::parse(const std::wstring & Str)
{ {
int v=0; int v=0;
int ms=0; int ms = 0;
double h=0,m=0,s =0; double h = 0, m = 0, s = 0;
bool res = parseTime(Str,h,m,s,ms); bool res = parseTime(Str, h, m, s, ms);
v = (((h*60)+m)*60+s)*1000+ms; v = (((h * 60) + m) * 60 + s) * 1000 + ms;
return clockvalue(v); return clockvalue(v);
} }
......
...@@ -112,9 +112,10 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c ...@@ -112,9 +112,10 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
std::vector<length> Points_pt; std::vector<length> Points_pt;
boost::algorithm::split(Points,strClipping, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on); boost::algorithm::split(Points,strClipping, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring const & p, Points)
for (size_t i = 0; i < Points.size(); i++)
{ {
Points_pt.push_back(length::parse(p) ); Points_pt.push_back(length::parse(Points[i]) );
if (Points_pt.back().get_value() > 0.00001) bEnableCrop = true; if (Points_pt.back().get_value() > 0.00001) bEnableCrop = true;
} }
...@@ -125,8 +126,6 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c ...@@ -125,8 +126,6 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
if (!_image_file_::GetResolution(fileName.data(), fileWidth, fileHeight, appFonts) || fileWidth<1 || fileHeight<1) return false; if (!_image_file_::GetResolution(fileName.data(), fileWidth, fileHeight, appFonts) || fileWidth<1 || fileHeight<1) return false;
if (Points_pt.size() > 3)//если другое количество точек .. попозже if (Points_pt.size() > 3)//если другое количество точек .. попозже
{ {
float dpi_ = 96.; float dpi_ = 96.;
...@@ -561,30 +560,33 @@ void draw_a::add_attributes( const xml::attributes_wc_ptr & Attributes ) ...@@ -561,30 +560,33 @@ void draw_a::add_attributes( const xml::attributes_wc_ptr & Attributes )
void draw_a::xlsx_convert(oox::xlsx_conversion_context & Context) void draw_a::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
Context.get_drawing_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""),true); Context.get_drawing_context().start_action(L"");
//стиль на текст не нужен ..текста то нет - ссылка с объекта Context.get_drawing_context().set_link(common_xlink_attlist_.href_.get_value_or(L""));
Context.get_drawing_context().end_action();
BOOST_FOREACH(const office_element_ptr & elm, content_) for (size_t i = 0; i < content_.size(); i++)
{ {
elm->xlsx_convert(Context); content_[i]->xlsx_convert(Context);
} }
} }
void draw_a::pptx_convert(oox::pptx_conversion_context & Context) void draw_a::pptx_convert(oox::pptx_conversion_context & Context)
{ {
Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""),true);//стиль на текст не нужен ..текста то нет - ссылка с объекта Context.get_slide_context().start_action(L"");
Context.get_slide_context().set_link(common_xlink_attlist_.href_.get_value_or(L""));
BOOST_FOREACH(const office_element_ptr & elm, content_) Context.get_slide_context().end_action();
for (size_t i = 0; i < content_.size(); i++)
{ {
elm->pptx_convert(Context); content_[i]->pptx_convert(Context);
} }
} }
void draw_a::docx_convert(oox::docx_conversion_context & Context) void draw_a::docx_convert(oox::docx_conversion_context & Context)
{ {
std::wstring rId = Context.add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""), true);//гиперлинк с объекта, а не с текста .. std::wstring rId = Context.add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""), true);//гиперлинк с объекта, а не с текста ..
BOOST_FOREACH(const office_element_ptr & elm, content_) for (size_t i = 0; i < content_.size(); i++)
{ {
elm->docx_convert(Context); content_[i]->docx_convert(Context);
} }
} }
...@@ -596,9 +598,9 @@ void parse_string_to_points(std::wstring str, std::vector<length> & Points) ...@@ -596,9 +598,9 @@ void parse_string_to_points(std::wstring str, std::vector<length> & Points)
boost::algorithm::split(Points_s,str, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on); boost::algorithm::split(Points_s,str, boost::algorithm::is_any_of(L" ,"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring const & p, Points_s) for (size_t i = 0; i < Points_s.size(); i++)
{ {
Points.push_back(length::parse(p) ); Points.push_back(length::parse(Points_s[i]) );
} }
} }
...@@ -608,12 +610,12 @@ void oox_convert_transforms(std::wstring transformStr,std::vector<odf_reader::_p ...@@ -608,12 +610,12 @@ void oox_convert_transforms(std::wstring transformStr,std::vector<odf_reader::_p
boost::algorithm::split(transforms,transformStr, boost::algorithm::is_any_of(L")"), boost::algorithm::token_compress_on); boost::algorithm::split(transforms,transformStr, boost::algorithm::is_any_of(L")"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring const & t, transforms) for (size_t i = 0; i < transforms.size(); i++)
{ {
//_CP_LOG << "[info] : transform = " << t << L"\n"; //_CP_LOG << "[info] : transform = " << t << L"\n";
std::vector<std::wstring> transform; std::vector<std::wstring> transform;
boost::algorithm::split(transform,t, boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on); boost::algorithm::split(transform, transforms[i], boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);
if (transform.size() > 1)//тока с аргументами if (transform.size() > 1)//тока с аргументами
{ {
...@@ -725,11 +727,11 @@ void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_con ...@@ -725,11 +727,11 @@ void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_con
boost::algorithm::split(transforms,transformStr, boost::algorithm::is_any_of(L")"), boost::algorithm::token_compress_on); boost::algorithm::split(transforms,transformStr, boost::algorithm::is_any_of(L")"), boost::algorithm::token_compress_on);
BOOST_FOREACH(std::wstring const & t, transforms) for (size_t i = 0; i < transforms.size(); i++)
{ {
//_CP_LOG << "[info] : transform = " << t << L"\n"; //_CP_LOG << "[info] : transform = " << t << L"\n";
std::vector<std::wstring> transform; std::vector<std::wstring> transform;
boost::algorithm::split(transform,t, boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on); boost::algorithm::split(transform, transforms[i], boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);
if (transform.size()>1)//тока с аргументами if (transform.size()>1)//тока с аргументами
{ {
......
...@@ -383,6 +383,38 @@ std::wstring draw_object::office_convert(odf_document * odfDocument, int type) ...@@ -383,6 +383,38 @@ std::wstring draw_object::office_convert(odf_document * odfDocument, int type)
return href_result; return href_result;
} }
// draw:param
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_param::ns = L"draw";
const wchar_t * draw_param::name = L"param";
void draw_param::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:name", draw_name_);
CP_APPLY_ATTR(L"draw:value", draw_value_);
}
void draw_param::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
// draw:plugin
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_plugin::ns = L"draw";
const wchar_t * draw_plugin::name = L"plugin";
void draw_plugin::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:mime-type", draw_mime_type_);
common_xlink_attlist_.add_attributes(Attributes);
}
void draw_plugin::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
} }
} }
...@@ -332,5 +332,56 @@ private: ...@@ -332,5 +332,56 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole); CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole);
// draw:param
class draw_param : public office_element_impl<draw_param>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawParam;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context){}
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context);
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_value_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_param);
// draw:plugin
class draw_plugin : public office_element_impl<draw_plugin>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawPlugin;
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context){}
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
virtual void pptx_convert(oox::pptx_conversion_context & Context);
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) draw_mime_type_;
office_element_ptr_array content_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_plugin);
} }
} }
...@@ -831,7 +831,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -831,7 +831,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
if (*zIndex < 0) if (*zIndex < 0)
drawing->relativeHeight = L"0"; drawing->relativeHeight = L"0";
else else
drawing->relativeHeight = boost::lexical_cast<std::wstring>( 2 + *zIndex ); drawing->relativeHeight = std::to_wstring( 2 + *zIndex );
} }
if (drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough if (drawing->styleWrap && drawing->styleWrap->get_type() == style_wrap::RunThrough
...@@ -1111,10 +1111,13 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -1111,10 +1111,13 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
oox::hyperlinks::_ref hyperlink = Context.last_hyperlink(); oox::hyperlinks::_ref hyperlink = Context.last_hyperlink();
//нужно еще систему конроля - могут придте уже "использованные" линки с картинок - из колонтитулов (но на них уже использовали релсы) //нужно еще систему конроля - могут придте уже "использованные" линки с картинок - из колонтитулов (но на них уже использовали релсы)
//дыра осталась если картинка в картинке - линк продублируется с внутренней на внешнюю //дыра осталась если картинка в картинке - линк продублируется с внутренней на внешнюю
if (hyperlink.drawing == true && hyperlink.used_rels == false) if (hyperlink.drawing == true && hyperlink.used_rels == false)
{ {//link from object
oox::_hlink_desc desc = {hyperlink.id, hyperlink.href, true}; drawing->action.enabled = true;
drawing->hlinks.push_back(desc); drawing->action.hId = hyperlink.id;
drawing->action.hRef = hyperlink.href;
drawing->action.typeRels= oox::typeHyperlink;
} }
///////// /////////
drawing->fill.bitmap = oox::oox_bitmap_fill::create(); drawing->fill.bitmap = oox::oox_bitmap_fill::create();
......
...@@ -92,6 +92,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -92,6 +92,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L""); const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L""); const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L"");
Context.get_slide_context().set_name(name);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
const _CP_OPT(length) svg_widthVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_; const _CP_OPT(length) svg_widthVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_;
const _CP_OPT(length) svg_heightVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_; const _CP_OPT(length) svg_heightVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_;
...@@ -248,9 +249,9 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -248,9 +249,9 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
std::wstring text_content_ = Context.get_text_context().end_object(); std::wstring text_content_ = Context.get_text_context().end_object();
if (text_content_.length()>0) if (!text_content_.empty())
{ {
Context.get_slide_context().set_property(_property(L"text-content",text_content_)); Context.get_slide_context().set_property(_property(L"text-content", text_content_));
} }
} }
void draw_object::pptx_convert(oox::pptx_conversion_context & Context) void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
...@@ -358,6 +359,28 @@ void draw_object_ole::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -358,6 +359,28 @@ void draw_object_ole::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_ole_object(href, detectObject(objectPath)); Context.get_slide_context().set_ole_object(href, detectObject(objectPath));
} }
void draw_param::pptx_convert(oox::pptx_conversion_context & Context)
{
if (!draw_name_ && !draw_value_) return;
Context.get_slide_context().set_media_param(*draw_name_, *draw_value_);
}
void draw_plugin::pptx_convert(oox::pptx_conversion_context & Context)
{
// Context.get_slide_context().set_use_image_replacement();
//
// std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
// std::wstring folderPath = Context.root()->get_folder();
// std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
//
// Context.get_slide_context().set_media(href);
////params
// for (size_t i = 0; i < content_.size(); i++)
// {
// content_[i]->pptx_convert(Context);
// }
}
} }
} }
...@@ -239,7 +239,7 @@ std::pair<int,std::wstring> presentation_layouts_instance::add_or_find(const std ...@@ -239,7 +239,7 @@ std::pair<int,std::wstring> presentation_layouts_instance::add_or_find(const std
item.layout_name = layout_name; item.layout_name = layout_name;
item.master_name = master_name; item.master_name = master_name;
item.Id = content.size() +1; item.Id = content.size() +1;
item.rId = std::wstring(L"lrId") + boost::lexical_cast<std::wstring>(item.Id); item.rId = std::wstring(L"lrId") + std::to_wstring(item.Id);
content.push_back(item); content.push_back(item);
index = content.size()-1; index = content.size()-1;
...@@ -265,7 +265,7 @@ std::pair<int,std::wstring> presentation_masters_instance::add_or_find(const std ...@@ -265,7 +265,7 @@ std::pair<int,std::wstring> presentation_masters_instance::add_or_find(const std
presentation_masters_instance::_master item; presentation_masters_instance::_master item;
item.master_name = master_name; item.master_name = master_name;
item.Id = content.size() +1; item.Id = content.size() +1;
item.rId = std::wstring(L"smId") + boost::lexical_cast<std::wstring>(item.Id); item.rId = std::wstring(L"smId") + std::to_wstring(item.Id);
content.push_back(item); content.push_back(item);
index = content.size()-1; index = content.size()-1;
......
...@@ -164,6 +164,7 @@ enum ElementType ...@@ -164,6 +164,7 @@ enum ElementType
typeStyleFooterStyle, typeStyleFooterStyle,
typeStyleHeaderFooterProperties, typeStyleHeaderFooterProperties,
typeStylePresentationSound,
typeStylePresentationPageLayout, typeStylePresentationPageLayout,
typeStylePresentationPlaceholder, typeStylePresentationPlaceholder,
typeStyleDrawingPageProperties, typeStyleDrawingPageProperties,
...@@ -290,6 +291,8 @@ enum ElementType ...@@ -290,6 +291,8 @@ enum ElementType
typeDrawObject, typeDrawObject,
typeDrawObjectOle, typeDrawObjectOle,
typeDrawChart, typeDrawChart,
typeDrawParam,
typeDrawPlugin,
typeDrawShape, typeDrawShape,
...@@ -321,6 +324,9 @@ enum ElementType ...@@ -321,6 +324,9 @@ enum ElementType
typeAnimPar, typeAnimPar,
typeAnimSeq, typeAnimSeq,
typeAnimTransitionFilter, typeAnimTransitionFilter,
typeAnimAudio,
typeAnimCommand,
typeAnimIterate,
typeStyleGraphicPropertis, typeStyleGraphicPropertis,
typeStyleDrawGradient, typeStyleDrawGradient,
......
...@@ -47,8 +47,8 @@ namespace odf_reader { ...@@ -47,8 +47,8 @@ namespace odf_reader {
// office:event_listeners // office:event_listeners
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * office_event_listeners::ns = L"office"; const wchar_t * office_event_listeners::ns = L"office";
const wchar_t * office_event_listeners::name = L"event-listeners"; const wchar_t * office_event_listeners::name = L"event-listeners";
void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attributes ) void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
...@@ -56,18 +56,18 @@ void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attr ...@@ -56,18 +56,18 @@ void office_event_listeners::add_attributes( const xml::attributes_wc_ptr & Attr
void office_event_listeners::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void office_event_listeners::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{ {
if CP_CHECK_NAME(L"presentation", L"event-listener") if CP_CHECK_NAME (L"presentation", L"event-listener")
CP_CREATE_ELEMENT(presentation_event_listeners_); CP_CREATE_ELEMENT (presentation_event_listeners_);
else if CP_CHECK_NAME(L"script", L"event-listener") else if CP_CHECK_NAME (L"script", L"event-listener")
CP_CREATE_ELEMENT(script_event_listeners_); CP_CREATE_ELEMENT (script_event_listeners_);
else else
CP_NOT_APPLICABLE_ELM(); CP_NOT_APPLICABLE_ELM();
} }
void office_event_listeners::pptx_convert(oox::pptx_conversion_context & Context) void office_event_listeners::pptx_convert(oox::pptx_conversion_context & Context)
{ {
BOOST_FOREACH(const office_element_ptr & elm, presentation_event_listeners_) for (size_t i = 0; i < presentation_event_listeners_.size(); i++)
{ {
elm->pptx_convert(Context); presentation_event_listeners_[i]->pptx_convert(Context);
} }
} }
// presentation:event-listener-attlist // presentation:event-listener-attlist
...@@ -77,7 +77,7 @@ void presentation_event_listener_attlist::add_attributes( const xml::attributes_ ...@@ -77,7 +77,7 @@ void presentation_event_listener_attlist::add_attributes( const xml::attributes_
{ {
common_xlink_attlist_.add_attributes(Attributes); common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"script:event_name", script_event_name_); CP_APPLY_ATTR(L"script:event-name", script_event_name_);
CP_APPLY_ATTR(L"presentation:action", presentation_action_); CP_APPLY_ATTR(L"presentation:action", presentation_action_);
//... //...
...@@ -89,7 +89,7 @@ const wchar_t * presentation_event_listener::name = L"event-listener"; ...@@ -89,7 +89,7 @@ const wchar_t * presentation_event_listener::name = L"event-listener";
void presentation_event_listener::add_attributes( const xml::attributes_wc_ptr & Attributes ) void presentation_event_listener::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
presentation_event_listener_attlist_.add_attributes(Attributes); attlist_.add_attributes(Attributes);
} }
void presentation_event_listener::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void presentation_event_listener::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
...@@ -101,12 +101,16 @@ void presentation_event_listener::add_child_element( xml::sax * Reader, const st ...@@ -101,12 +101,16 @@ void presentation_event_listener::add_child_element( xml::sax * Reader, const st
} }
void presentation_event_listener::pptx_convert(oox::pptx_conversion_context & Context) void presentation_event_listener::pptx_convert(oox::pptx_conversion_context & Context)
{ {
common_xlink_attlist & xlink = presentation_event_listener_attlist_.common_xlink_attlist_; Context.get_slide_context().start_action(attlist_.presentation_action_.get_value_or(L""));
if (attlist_.common_xlink_attlist_.href_)
Context.get_slide_context().set_link(*attlist_.common_xlink_attlist_.href_);
if (xlink.href_) if (presentation_sound_)
{ {
Context.get_slide_context().add_hyperlink(*xlink.href_,true); presentation_sound_->pptx_convert(Context);
} }
Context.get_slide_context().end_action();
} }
// script:event-listener // script:event-listener
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
namespace cpdoccore { namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
// office:event-listeners
class office_event_listeners : public office_element_impl<office_event_listeners> class office_event_listeners : public office_element_impl<office_event_listeners>
{ {
public: public:
...@@ -62,20 +61,17 @@ private: ...@@ -62,20 +61,17 @@ private:
private: private:
office_element_ptr_array presentation_event_listeners_; office_element_ptr_array presentation_event_listeners_;
office_element_ptr_array script_event_listeners_; office_element_ptr_array script_event_listeners_;
}; };
CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners); CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //-------------------------------------------------------------------------------------
// presentation-event-listener-attlist
class presentation_event_listener_attlist class presentation_event_listener_attlist
{ {
public: public:
void add_attributes( const xml::attributes_wc_ptr & Attributes ); void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
odf_types::common_xlink_attlist common_xlink_attlist_; odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) script_event_name_; _CP_OPT(std::wstring) script_event_name_;
...@@ -87,7 +83,6 @@ public: ...@@ -87,7 +83,6 @@ public:
//presentation:effect //presentation:effect
}; };
// presentation:event-listeners_
class presentation_event_listener : public office_element_impl<presentation_event_listener> class presentation_event_listener : public office_element_impl<presentation_event_listener>
{ {
public: public:
...@@ -104,9 +99,9 @@ private: ...@@ -104,9 +99,9 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
private: private:
//office_element_ptr_array content_; //office_element_ptr_array content_;
office_element_ptr presentation_sound_; office_element_ptr presentation_sound_;
presentation_event_listener_attlist presentation_event_listener_attlist_; presentation_event_listener_attlist attlist_;
}; };
......
...@@ -555,7 +555,7 @@ void a::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -555,7 +555,7 @@ void a::pptx_convert(oox::pptx_conversion_context & Context)
elm->pptx_convert(Context); elm->pptx_convert(Context);
} }
std::wstring hId = Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""),false); std::wstring hId = Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""));
Context.get_text_context().end_hyperlink(hId); Context.get_text_context().end_hyperlink(hId);
} }
......
...@@ -73,11 +73,11 @@ std::wstring process_border(const border_style & borderStyle, ...@@ -73,11 +73,11 @@ std::wstring process_border(const border_style & borderStyle,
if (szInt <= 0) if (szInt <= 0)
szInt = 1; szInt = 1;
w_sz = boost::lexical_cast<std::wstring>( szInt ); w_sz = std::to_wstring( szInt );
w_color = borderStyle.get_color().get_hex_value(); w_color = borderStyle.get_color().get_hex_value();
if (borderPadding) if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) ); w_space = std::to_wstring((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
switch(borderStyle.get_style()) switch(borderStyle.get_style())
{ {
...@@ -118,7 +118,7 @@ std::wstring docx_process_margin(const _CP_OPT(length_or_percent) & margin, doub ...@@ -118,7 +118,7 @@ std::wstring docx_process_margin(const _CP_OPT(length_or_percent) & margin, doub
if (margin->get_type() == length_or_percent::Length) if (margin->get_type() == length_or_percent::Length)
{ {
int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(length::pt)); int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(length::pt));
return boost::lexical_cast<std::wstring>( val ); return std::to_wstring( val );
} }
else else
{ {
...@@ -298,7 +298,7 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co ...@@ -298,7 +298,7 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
{ {
if (fo_line_height_->get_type() == line_width::Percent) if (fo_line_height_->get_type() == line_width::Percent)
{ {
w_line = boost::lexical_cast<std::wstring>( (int)( 0.5 + fo_line_height_->get_percent().get_value() * 240.0 / 100.0 ) ); w_line = std::to_wstring( (int)( 0.5 + fo_line_height_->get_percent().get_value() * 240.0 / 100.0 ) );
w_lineRule = L"auto"; w_lineRule = L"auto";
} }
else if(fo_line_height_->get_type() == line_width::Normal) else if(fo_line_height_->get_type() == line_width::Normal)
...@@ -308,19 +308,19 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co ...@@ -308,19 +308,19 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
} }
else if (fo_line_height_->get_type() == line_width::PositiveLength) else if (fo_line_height_->get_type() == line_width::PositiveLength)
{ {
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 20.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt))); w_line = std::to_wstring((int)(0.5 + 20.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_lineRule = L"exact"; w_lineRule = L"exact";
} }
} }
else if (style_line_height_at_least_) else if (style_line_height_at_least_)
{ {
w_lineRule = L"atLeast"; w_lineRule = L"atLeast";
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 20.0 * style_line_height_at_least_->get_value_unit(length::pt))); w_line = std::to_wstring((int)(0.5 + 20.0 * style_line_height_at_least_->get_value_unit(length::pt)));
} }
else if (style_line_spacing_) else if (style_line_spacing_)
{ {
w_lineRule = L"auto"; w_lineRule = L"auto";
w_line = boost::lexical_cast<std::wstring>( (int)(0.5 + 240.0 + 20.0 * style_line_spacing_->get_value_unit(length::pt)) ); w_line = std::to_wstring( (int)(0.5 + 240.0 + 20.0 * style_line_spacing_->get_value_unit(length::pt)) );
} }
CP_XML_NODE(L"w:spacing") CP_XML_NODE(L"w:spacing")
{ {
......
...@@ -70,11 +70,11 @@ std::wstring process_border(border_style & borderStyle, ...@@ -70,11 +70,11 @@ std::wstring process_border(border_style & borderStyle,
if (szInt <= 0) szInt = 1; if (szInt <= 0) szInt = 1;
w_sz = boost::lexical_cast<std::wstring>( szInt ); w_sz = std::to_wstring( szInt );
w_color = borderStyle.get_color().get_hex_value(); w_color = borderStyle.get_color().get_hex_value();
if (borderPadding) if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt)) ); w_space = std::to_wstring((int)(borderPadding->get_value_unit(length::pt)) );
switch(borderStyle.get_style()) switch(borderStyle.get_style())
{ {
...@@ -113,7 +113,7 @@ std::wstring pptx_process_margin(const _CP_OPT(length_or_percent) & margin, leng ...@@ -113,7 +113,7 @@ std::wstring pptx_process_margin(const _CP_OPT(length_or_percent) & margin, leng
if (margin->get_type() == length_or_percent::Length) if (margin->get_type() == length_or_percent::Length)
{ {
int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(unit)); int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(unit));
return boost::lexical_cast<std::wstring>( val ); return std::to_wstring( val );
} }
else else
{ {
...@@ -190,7 +190,7 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra ...@@ -190,7 +190,7 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
if (fo_line_height_->get_type() == line_width::Percent) if (fo_line_height_->get_type() == line_width::Percent)
{ {
double percent = fo_line_height_->get_percent().get_value(); double percent = fo_line_height_->get_percent().get_value();
w_line = boost::lexical_cast<std::wstring>( (int)( 0.5 + percent *1000. ) ); w_line = std::to_wstring( (int)( 0.5 + percent *1000. ) );
w_lineRule = L"a:spcPct"; w_lineRule = L"a:spcPct";
} }
//else if(fo_line_height_->get_type() == line_width::Normal) //else if(fo_line_height_->get_type() == line_width::Normal)
...@@ -198,19 +198,19 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra ...@@ -198,19 +198,19 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
//} //}
else if (fo_line_height_->get_type() == line_width::PositiveLength) else if (fo_line_height_->get_type() == line_width::PositiveLength)
{ {
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 100.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt))); w_line = std::to_wstring((int)(0.5 + 100.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_lineRule = L"a:spcPts"; w_lineRule = L"a:spcPts";
} }
} }
else if (style_line_height_at_least_) else if (style_line_height_at_least_)
{ {
w_lineRule = L"a:spcPts"; w_lineRule = L"a:spcPts";
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 100.0 * style_line_height_at_least_->get_value_unit(length::pt))); w_line = std::to_wstring((int)(0.5 + 100.0 * style_line_height_at_least_->get_value_unit(length::pt)));
} }
else if (style_line_spacing_) else if (style_line_spacing_)
{ {
w_lineRule = L"a:spcPts"; w_lineRule = L"a:spcPts";
w_line = boost::lexical_cast<std::wstring>( (int)(0.5 + 240.0 + 100.0 * style_line_spacing_->get_value_unit(length::pt)) ); w_line = std::to_wstring( (int)(0.5 + 240.0 + 100.0 * style_line_spacing_->get_value_unit(length::pt)) );
} }
CP_XML_NODE(L"a:lnSpc") CP_XML_NODE(L"a:lnSpc")
...@@ -422,7 +422,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co ...@@ -422,7 +422,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
if (fo_line_height_->get_type() == line_width::Percent) if (fo_line_height_->get_type() == line_width::Percent)
{ {
double percent = fo_line_height_->get_percent().get_value(); double percent = fo_line_height_->get_percent().get_value();
w_line = boost::lexical_cast<std::wstring>( (int)( 0.5 + percent *1000. ) ); w_line = std::to_wstring( (int)( 0.5 + percent *1000. ) );
w_lineRule = L"a:spcPct"; w_lineRule = L"a:spcPct";
} }
//else if(fo_line_height_->get_type() == line_width::Normal) //else if(fo_line_height_->get_type() == line_width::Normal)
...@@ -430,19 +430,19 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co ...@@ -430,19 +430,19 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
//} //}
else if (fo_line_height_->get_type() == line_width::PositiveLength) else if (fo_line_height_->get_type() == line_width::PositiveLength)
{ {
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 100.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt))); w_line = std::to_wstring((int)(0.5 + 100.0 * fo_line_height_->get_positive_length().get_value_unit(length::pt)));
w_lineRule = L"a:spcPts"; w_lineRule = L"a:spcPts";
} }
} }
else if (style_line_height_at_least_) else if (style_line_height_at_least_)
{ {
w_lineRule = L"a:spcPts"; w_lineRule = L"a:spcPts";
w_line = boost::lexical_cast<std::wstring>((int)(0.5 + 100.0 * style_line_height_at_least_->get_value_unit(length::pt))); w_line = std::to_wstring((int)(0.5 + 100.0 * style_line_height_at_least_->get_value_unit(length::pt)));
} }
else if (style_line_spacing_) else if (style_line_spacing_)
{ {
w_lineRule = L"a:spcPts"; w_lineRule = L"a:spcPts";
w_line = boost::lexical_cast<std::wstring>( (int)(0.5 + 240.0 + 100.0 * style_line_spacing_->get_value_unit(length::pt)) ); w_line = std::to_wstring( (int)(0.5 + 240.0 + 100.0 * style_line_spacing_->get_value_unit(length::pt)) );
} }
CP_XML_NODE(L"a:lnSpc") CP_XML_NODE(L"a:lnSpc")
......
...@@ -42,12 +42,8 @@ namespace cpdoccore { ...@@ -42,12 +42,8 @@ namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
// const wchar_t * presentation_placeholder::ns = L"presentation";
const wchar_t * presentation_placeholder::name = L"placeholder";
// style:chart-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_placeholder::ns = L"presentation";
const wchar_t * presentation_placeholder::name = L"placeholder";
void presentation_placeholder::add_attributes( const xml::attributes_wc_ptr & Attributes ) void presentation_placeholder::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
...@@ -88,9 +84,26 @@ void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Conte ...@@ -88,9 +84,26 @@ void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Conte
Context.get_slide_context().end_shape(); Context.get_slide_context().end_shape();
} }
//-------------------------------------------------------------------------------------------------
const wchar_t * presentation_sound::ns = L"presentation";
const wchar_t * presentation_sound::name = L"sound";
void presentation_sound::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
}
void presentation_sound::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_NOT_APPLICABLE_ELM();
}
////////////////////////////////////////////////////////////////////////////////////////////////// void presentation_sound::pptx_convert(oox::pptx_conversion_context & Context)
const wchar_t * style_drawing_page_properties::ns = L"style"; {
Context.get_slide_context().set_link(common_xlink_attlist_.href_.get_value_or(L""), oox::typeAudio);
}
//-------------------------------------------------------------------------------------------------
const wchar_t * style_drawing_page_properties::ns = L"style";
const wchar_t * style_drawing_page_properties::name = L"drawing-page-properties"; const wchar_t * style_drawing_page_properties::name = L"drawing-page-properties";
void style_drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes ) void style_drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
...@@ -99,7 +112,10 @@ void style_drawing_page_properties::add_attributes( const xml::attributes_wc_ptr ...@@ -99,7 +112,10 @@ void style_drawing_page_properties::add_attributes( const xml::attributes_wc_ptr
} }
void style_drawing_page_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) void style_drawing_page_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{ {
CP_NOT_APPLICABLE_ELM(); if CP_CHECK_NAME(L"presentation", L"sound")
CP_CREATE_ELEMENT(drawing_page_properties_.presentation_sound_);
else
CP_NOT_APPLICABLE_ELM();
} }
void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes ) void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
...@@ -119,6 +135,7 @@ void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Att ...@@ -119,6 +135,7 @@ void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Att
CP_APPLY_ATTR(L"presentation:display-page-number", presentation_display_page_number_); CP_APPLY_ATTR(L"presentation:display-page-number", presentation_display_page_number_);
CP_APPLY_ATTR(L"presentation:display-date-time", presentation_display_date_time_); CP_APPLY_ATTR(L"presentation:display-date-time", presentation_display_date_time_);
CP_APPLY_ATTR(L"presentation:display-header", presentation_display_header_); CP_APPLY_ATTR(L"presentation:display-header", presentation_display_header_);
CP_APPLY_ATTR(L"presentation:page-duration", presentation_page_duration_);
} }
void drawing_page_properties::apply_from(const drawing_page_properties & Other) void drawing_page_properties::apply_from(const drawing_page_properties & Other)
{ {
...@@ -137,6 +154,8 @@ void drawing_page_properties::apply_from(const drawing_page_properties & Other) ...@@ -137,6 +154,8 @@ void drawing_page_properties::apply_from(const drawing_page_properties & Other)
_CP_APPLY_PROP2(presentation_display_page_number_); _CP_APPLY_PROP2(presentation_display_page_number_);
_CP_APPLY_PROP2(presentation_display_date_time_); _CP_APPLY_PROP2(presentation_display_date_time_);
_CP_APPLY_PROP2(presentation_display_header_); _CP_APPLY_PROP2(presentation_display_header_);
_CP_APPLY_PROP2(presentation_page_duration_);
} }
} }
......
...@@ -49,7 +49,6 @@ namespace cpdoccore { ...@@ -49,7 +49,6 @@ namespace cpdoccore {
namespace odf_reader { namespace odf_reader {
// presentation:placeholder
class presentation_placeholder : public office_element_impl<presentation_placeholder> class presentation_placeholder : public office_element_impl<presentation_placeholder>
{ {
public: public:
...@@ -76,13 +75,34 @@ public: ...@@ -76,13 +75,34 @@ public:
}; };
CP_REGISTER_OFFICE_ELEMENT2(presentation_placeholder); CP_REGISTER_OFFICE_ELEMENT2(presentation_placeholder);
//-------------------------------------------------------------------------------------------
////////////////////////////////////////////// class presentation_sound : public office_element_impl<presentation_sound>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStylePresentationSound;
CPDOCCORE_DEFINE_VISITABLE();
odf_types::common_xlink_attlist common_xlink_attlist_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void pptx_convert(oox::pptx_conversion_context & Context);
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_sound);
//-------------------------------------------------------------------------------------------
class drawing_page_properties class drawing_page_properties
{ {
public: public:
void add_attributes( const xml::attributes_wc_ptr & Attributes ); void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const drawing_page_properties & Other);
void apply_from(const drawing_page_properties & Other);
odf_types::common_draw_fill_attlist common_draw_fill_attlist_; odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
anim_transition_filter_attlist anim_transition_filter_attlist_; anim_transition_filter_attlist anim_transition_filter_attlist_;
...@@ -90,27 +110,28 @@ public: ...@@ -90,27 +110,28 @@ public:
_CP_OPT(odf_types::length_or_percent) draw_fill_image_height_; _CP_OPT(odf_types::length_or_percent) draw_fill_image_height_;
_CP_OPT(odf_types::length_or_percent) draw_fill_image_width_; _CP_OPT(odf_types::length_or_percent) draw_fill_image_width_;
_CP_OPT(std::wstring) draw_background_size_;//"border" or "full" _CP_OPT(std::wstring) draw_background_size_; //"border" or "full"
_CP_OPT(std::wstring) presentation_transition_type_;//manual, automatic, semi-automatic (переход отделен от эффектов кликом) _CP_OPT(std::wstring) presentation_transition_type_; //manual, automatic, semi-automatic (переход отделен от эффектов кликом)
_CP_OPT(std::wstring) presentation_transition_style_;//none, fade, move, uncover,clockwise, .... игнор если smil _CP_OPT(std::wstring) presentation_transition_style_; //none, fade, move, uncover,clockwise, .... игнор если smil
_CP_OPT(std::wstring) presentation_transition_speed_;//slow, medium, fast _CP_OPT(std::wstring) presentation_transition_speed_; //slow, medium, fast
_CP_OPT(bool) presentation_display_footer_; _CP_OPT(bool) presentation_display_footer_;
_CP_OPT(bool) presentation_display_page_number_; _CP_OPT(bool) presentation_display_page_number_;
_CP_OPT(bool) presentation_display_date_time_; _CP_OPT(bool) presentation_display_date_time_;
_CP_OPT(bool) presentation_display_header_; _CP_OPT(bool) presentation_display_header_;
_CP_OPT(std::wstring) presentation_page_duration_;
office_element_ptr presentation_sound_;
//presentation:background-objects-visible //presentation:background-objects-visible
//presentation:background-visible //presentation:background-visible
//style:repeat //style:repeat
//presentation:page-duration
//presentation:visibility. //presentation:visibility.
//presentation:sound.
//draw:background-size //draw:background-size
}; };
//style:drawing-page-properties
class style_drawing_page_properties : public office_element_impl<style_drawing_page_properties> class style_drawing_page_properties : public office_element_impl<style_drawing_page_properties>
{ {
public: public:
......
...@@ -131,7 +131,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex ...@@ -131,7 +131,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
} }
} }
else //if (table_align_->get_type() == table_align::Center) else //if (table_align_->get_type() == table_align::Center)
w_val = boost::lexical_cast<std::wstring>(*table_align_); w_val = boost::lexical_cast<std::wstring>(*table_align_);
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />"; _tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
} }
...@@ -432,7 +432,7 @@ void insert_cell_border(oox::docx_conversion_context & Context, ...@@ -432,7 +432,7 @@ void insert_cell_border(oox::docx_conversion_context & Context,
else if (w_sz_ > 96.0) else if (w_sz_ > 96.0)
w_sz_ = 96.0; w_sz_ = 96.0;
w_sz = boost::lexical_cast<std::wstring>( w_sz_ ); w_sz = std::to_wstring( w_sz_ );
} }
} }
} }
...@@ -510,7 +510,7 @@ void insert_cell_border(oox::pptx_conversion_context & Context, ...@@ -510,7 +510,7 @@ void insert_cell_border(oox::pptx_conversion_context & Context,
else if (w_sz_ > 96.0) else if (w_sz_ > 96.0)
w_sz_ = 96.0; w_sz_ = 96.0;
w_sz = boost::lexical_cast<std::wstring>( w_sz_ ); w_sz = std::to_wstring( w_sz_ );
} }
while (0); while (0);
......
...@@ -737,7 +737,7 @@ void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_ ...@@ -737,7 +737,7 @@ void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_
const double mul = style_text_position_->get_position().get_value() / 100.0; const double mul = style_text_position_->get_position().get_value() / 100.0;
if (fontSizeVal > 0) if (fontSizeVal > 0)
{ {
const std::wstring position = boost::lexical_cast<std::wstring>( (int)(fontSizeVal * mul + 0.5)); const std::wstring position = std::to_wstring( (int)(fontSizeVal * mul + 0.5));
if (!position.empty()) if (!position.empty())
{ {
_rPr << L"<w:position w:val=\"" << position << "\" />"; _rPr << L"<w:position w:val=\"" << position << "\" />";
...@@ -750,7 +750,7 @@ void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_ ...@@ -750,7 +750,7 @@ void text_format_properties_content::docx_serialize(std::wostream & _rPr, fonts_
const double mul = style_text_position_->font_size().get_value() / 100.0; const double mul = style_text_position_->font_size().get_value() / 100.0;
if (fontSizeVal > 0 && mul > 0) if (fontSizeVal > 0 && mul > 0)
{ {
const std::wstring fontSize = boost::lexical_cast<std::wstring>((int)(fontSizeVal * mul + 0.5)); const std::wstring fontSize = std::to_wstring((int)(fontSizeVal * mul + 0.5));
if (!fontSize.empty()) if (!fontSize.empty())
{ {
needProcessFontSize = false; needProcessFontSize = false;
...@@ -1182,7 +1182,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -1182,7 +1182,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
const double mul = style_text_position_->get_position().get_value() / 100.0; const double mul = style_text_position_->get_position().get_value() / 100.0;
if (fontSizeVal > 0) if (fontSizeVal > 0)
{ {
const std::wstring position = boost::lexical_cast<std::wstring>( (int)(fontSizeVal * mul + 0.5)); const std::wstring position = std::to_wstring( (int)(fontSizeVal * mul + 0.5));
if (!position.empty()) if (!position.empty())
{ {
_rPr << L"<w:position w:val=\"" << position << "\" />"; _rPr << L"<w:position w:val=\"" << position << "\" />";
...@@ -1195,7 +1195,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -1195,7 +1195,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
const double mul = style_text_position_->font_size().get_value() / 100.0; const double mul = style_text_position_->font_size().get_value() / 100.0;
if (fontSizeVal > 0 && mul > 0) if (fontSizeVal > 0 && mul > 0)
{ {
const std::wstring fontSize = boost::lexical_cast<std::wstring>((int)(fontSizeVal * mul + 0.5)); const std::wstring fontSize = std::to_wstring((int)(fontSizeVal * mul + 0.5));
if (!fontSize.empty()) if (!fontSize.empty())
{ {
needProcessFontSize = false; needProcessFontSize = false;
......
...@@ -91,11 +91,11 @@ std::wstring process_border(const border_style & borderStyle, ...@@ -91,11 +91,11 @@ std::wstring process_border(const border_style & borderStyle,
int szInt = (int)(0.5 + 8.0 * width); //eighths of a point (ST_EighthPointMeasure) int szInt = (int)(0.5 + 8.0 * width); //eighths of a point (ST_EighthPointMeasure)
if (szInt <= 0) szInt = 1; if (szInt <= 0) szInt = 1;
w_sz = boost::lexical_cast<std::wstring>( szInt ); w_sz = std::to_wstring( szInt );
w_color = borderStyle.get_color().get_hex_value() ; w_color = borderStyle.get_color().get_hex_value() ;
if (borderPadding) if (borderPadding)
w_space = boost::lexical_cast<std::wstring>((int)(borderPadding->get_value_unit(length::pt) + 0.5) ); w_space = std::to_wstring((int)(borderPadding->get_value_unit(length::pt) + 0.5) );
switch(borderStyle.get_style()) switch(borderStyle.get_style())
{ {
...@@ -135,7 +135,7 @@ std::wstring process_margin(const _CP_OPT(length_or_percent) & margin, double Mu ...@@ -135,7 +135,7 @@ std::wstring process_margin(const _CP_OPT(length_or_percent) & margin, double Mu
if (margin->get_type() == length_or_percent::Length) if (margin->get_type() == length_or_percent::Length)
{ {
int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(length::pt)); int val = (int)(0.5 + Mul * margin->get_length().get_value_unit(length::pt));
return boost::lexical_cast<std::wstring>( val ); return std::to_wstring( val );
} }
else else
{ {
...@@ -950,7 +950,7 @@ std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val, ...@@ -950,7 +950,7 @@ std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val,
double dAddVal = 20.0 * AddVal.get_value_or(length(0, length::pt)).get_value_unit(length::pt) + 0.5; double dAddVal = 20.0 * AddVal.get_value_or(length(0, length::pt)).get_value_unit(length::pt) + 0.5;
if (dAddVal < 0 ) dAddVal = 0; if (dAddVal < 0 ) dAddVal = 0;
return boost::lexical_cast<std::wstring>( (int)( v + dAddVal)); return std::to_wstring( (int)( v + dAddVal));
} }
} }
...@@ -979,7 +979,7 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream ...@@ -979,7 +979,7 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
{ {
int val = 0.5 + 20.0 * fo_page_height_->get_value_unit(length::pt); int val = 0.5 + 20.0 * fo_page_height_->get_value_unit(length::pt);
if (val > 31680) val =31680;//22" if (val > 31680) val =31680;//22"
w_h = boost::lexical_cast<std::wstring>(val); w_h = std::to_wstring(val);
height_page = val; height_page = val;
} }
...@@ -1153,7 +1153,7 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con ...@@ -1153,7 +1153,7 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con
w = fo_page_width_->get_value_unit(length::emu); w = fo_page_width_->get_value_unit(length::emu);
if (w < 914400) w = 914400; if (w < 914400) w = 914400;
w_w = boost::lexical_cast<std::wstring>(w); w_w = std::to_wstring(w);
} }
if (fo_page_height_) if (fo_page_height_)
{ {
...@@ -1391,7 +1391,7 @@ void style_page_layout_properties::pptx_serialize(std::wostream & strm, oox::ppt ...@@ -1391,7 +1391,7 @@ void style_page_layout_properties::pptx_serialize(std::wostream & strm, oox::ppt
w = attlist_.fo_page_width_->get_value_unit(length::emu); w = attlist_.fo_page_width_->get_value_unit(length::emu);
if (w < 914400) w = 914400; if (w < 914400) w = 914400;
w_w = boost::lexical_cast<std::wstring>(w); w_w = std::to_wstring(w);
} }
if (attlist_.fo_page_height_) if (attlist_.fo_page_height_)
{ {
......
...@@ -271,7 +271,7 @@ std::wstring GetLevelText(unsigned int displayLevels, ...@@ -271,7 +271,7 @@ std::wstring GetLevelText(unsigned int displayLevels,
if (displayLevels > 1) if (displayLevels > 1)
res += L"."; res += L".";
res += L"%"; res += L"%";
res += boost::lexical_cast<std::wstring>(textLevel); res += std::to_wstring(textLevel);
return res; return res;
} }
......
...@@ -156,9 +156,9 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -156,9 +156,9 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
if (Context.get_table_context().state()->group_row_.enabled) if (Context.get_table_context().state()->group_row_.enabled)
{ {
//std::wstring str_spans = boost::lexical_cast<std::wstring>(Context.get_table_context().state()->group_row_.count); //std::wstring str_spans = std::to_wstring(Context.get_table_context().state()->group_row_.count);
//str_spans = str_spans + L":"; //str_spans = str_spans + L":";
std::wstring str_spans = L"1:" + boost::lexical_cast<std::wstring>(Context.get_table_context().columns_count()); std::wstring str_spans = L"1:" + std::to_wstring(Context.get_table_context().columns_count());
ht = L""; ht = L"";
CP_XML_ATTR(L"collapsed", Context.get_table_context().state()->group_row_.collapsed); CP_XML_ATTR(L"collapsed", Context.get_table_context().state()->group_row_.collapsed);
......
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