mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-11 02:16:02 +08:00
Compare commits
70 Commits
core/devel
...
core/devel
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e2bd8989d | |||
| 8f434efb95 | |||
| 244dafb02b | |||
| 149a1bdbd5 | |||
| a79d9041bc | |||
| 3954c42602 | |||
| 29dc0aee32 | |||
| d805972d6d | |||
| 549d5a46a6 | |||
| 771bf2d55c | |||
| 3c58cd96fc | |||
| e50864fa98 | |||
| c8c0924c74 | |||
| af732e4e85 | |||
| 47ffdae8cc | |||
| fd5870083b | |||
| 5ba62cb25d | |||
| 79e0588544 | |||
| a3d08cfc35 | |||
| 5caccb284a | |||
| ce19969b52 | |||
| 0f91dc392e | |||
| e9805cef30 | |||
| e3e05eb2db | |||
| c09f17cffb | |||
| ce73dd5987 | |||
| 77df8aacb9 | |||
| ce45b2802f | |||
| 7886018d6f | |||
| 5b5cb4188e | |||
| f797af5f17 | |||
| 055977535e | |||
| 6ab24f10f0 | |||
| 12a03da231 | |||
| cb7088979a | |||
| 1fb1fc6c97 | |||
| e633c3c5d1 | |||
| 0f04de34b1 | |||
| 3f8c2c293a | |||
| 2c97e743da | |||
| 2c83860c04 | |||
| c64b624de2 | |||
| 5e3990937d | |||
| 21744c1607 | |||
| 0892e2549f | |||
| cff6f305d4 | |||
| 5060071227 | |||
| d64109eaa4 | |||
| ec064bbd50 | |||
| baf952a151 | |||
| 0dd36c5e6a | |||
| 474404a8f9 | |||
| f2f6483b6f | |||
| c30161dbd0 | |||
| ec4f4fe476 | |||
| 634509ae28 | |||
| 1244048c50 | |||
| a62b69fb31 | |||
| 5eb36efb63 | |||
| fb8c4231b0 | |||
| 9774d1de46 | |||
| f5b141eeee | |||
| 1e47dc1111 | |||
| d3f4a2127d | |||
| 4d5f328c30 | |||
| b18cd44cf6 | |||
| 6705045dd4 | |||
| 533bc2c250 | |||
| 85226c0821 | |||
| 8197fb8900 |
15
.travis.yml
15
.travis.yml
@ -1 +1,14 @@
|
||||
language: cpp
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- p7zip-full
|
||||
script:
|
||||
- exit 0
|
||||
# Build fails anyway. See explanation in
|
||||
# https://github.com/ONLYOFFICE/core/pull/29#issuecomment-306773327
|
||||
- cd Common/3dParty && ./make.sh
|
||||
- cd ../../
|
||||
- make
|
||||
@ -811,10 +811,10 @@ namespace DocFileFormat
|
||||
{
|
||||
Symbol s = getSymbol( chpx );
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
|
||||
m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
|
||||
m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
|
||||
m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||
//m_pXmlWriter->WriteNodeBegin(L"w:sym", true);
|
||||
//m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName));
|
||||
//m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue));
|
||||
//m_pXmlWriter->WriteNodeEnd(L"", true);
|
||||
}
|
||||
else if ((TextMark::DrawnObject == code) && fSpec)
|
||||
{
|
||||
@ -1663,12 +1663,17 @@ namespace DocFileFormat
|
||||
FontFamilyName* ffn = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( fontIndex ) );
|
||||
|
||||
ret.FontName = ffn->xszFtn;
|
||||
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );
|
||||
ret.HexValue = L"f0" + FormatUtils::IntToFormattedWideString( code, L"%02x" );//-123 - ShortToFormattedWideString
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret.HexValue.length() > 4)
|
||||
{
|
||||
ret.HexValue = ret.HexValue.substr(ret.HexValue.length() - 4, 4);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -184,104 +184,100 @@ namespace DocFileFormat
|
||||
std::vector<PathSegment>::const_iterator end = m_arSegments.end();
|
||||
for (std::vector<PathSegment>::const_iterator iter = m_arSegments.begin(); iter != end; ++iter, cc++)
|
||||
{
|
||||
try
|
||||
switch (iter->Type)
|
||||
{
|
||||
switch (iter->Type)
|
||||
case PathSegment::msopathLineTo:
|
||||
{
|
||||
case PathSegment::msopathLineTo:
|
||||
for (int i = 0; i < iter->Count; ++i)
|
||||
{
|
||||
for (int i = 0; i < iter->Count; ++i)
|
||||
if (valuePointer + 1 > (int)m_arPoints.size())
|
||||
{
|
||||
if (valuePointer >= (int)m_arPoints.size())
|
||||
{
|
||||
break;
|
||||
break;
|
||||
|
||||
strVmlPath += L"l";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
|
||||
|
||||
++valuePointer;
|
||||
|
||||
//break;
|
||||
}
|
||||
else
|
||||
{
|
||||
strVmlPath += L"l";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
|
||||
|
||||
++valuePointer;
|
||||
}
|
||||
strVmlPath += L"l";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].x);
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[0].y);
|
||||
|
||||
++valuePointer;
|
||||
|
||||
//break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathCurveTo:
|
||||
{
|
||||
for (int i = 0; i < iter->Count; ++i)
|
||||
else
|
||||
{
|
||||
strVmlPath += L"c";
|
||||
strVmlPath += L"l";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
|
||||
valuePointer += 3;
|
||||
|
||||
++valuePointer;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathMoveTo:
|
||||
case PathSegment::msopathCurveTo:
|
||||
{
|
||||
for (int i = 0; i < iter->Count; ++i)
|
||||
{
|
||||
strVmlPath += L"m";
|
||||
if (valuePointer + 3 > (int)m_arPoints.size())
|
||||
break;
|
||||
strVmlPath += L"c";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 1].y );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer + 2].y );
|
||||
valuePointer += 3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathMoveTo:
|
||||
{
|
||||
if (valuePointer < (int)m_arPoints.size())
|
||||
{
|
||||
strVmlPath += L"m";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
|
||||
strVmlPath += L",";
|
||||
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].y );
|
||||
|
||||
++valuePointer;
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathClose:
|
||||
{
|
||||
strVmlPath += L"x";
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathEnd:
|
||||
{
|
||||
strVmlPath += L"e";
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathEscape:
|
||||
{
|
||||
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
|
||||
strVmlPath += L"nf";
|
||||
|
||||
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
|
||||
strVmlPath += L"ns";
|
||||
}
|
||||
case PathSegment::msopathClientEscape:
|
||||
case PathSegment::msopathInvalid:
|
||||
{
|
||||
//ignore escape segments and invalid segments
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// Sometimes there are more Segments than available m_arPoints.
|
||||
// Accordingly to the spec this should never happen :)
|
||||
break;
|
||||
|
||||
case PathSegment::msopathClose:
|
||||
{
|
||||
strVmlPath += L"x";
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathEnd:
|
||||
{
|
||||
strVmlPath += L"e";
|
||||
}
|
||||
break;
|
||||
|
||||
case PathSegment::msopathEscape:
|
||||
{
|
||||
if (PathSegment::msopathEscapeNoFill == iter->EscapeCode)
|
||||
strVmlPath += L"nf";
|
||||
|
||||
if (PathSegment::msopathEscapeNoLine == iter->EscapeCode)
|
||||
strVmlPath += L"ns";
|
||||
}
|
||||
case PathSegment::msopathClientEscape:
|
||||
case PathSegment::msopathInvalid:
|
||||
{
|
||||
//ignore escape segments and invalid segments
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,9 @@ namespace BinXlsxRW{
|
||||
{
|
||||
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
|
||||
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
|
||||
|
||||
writeChartXlsx(sXlsxPath, oChartSpace);
|
||||
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(L"xlsx");
|
||||
|
||||
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
|
||||
long rId;
|
||||
|
||||
@ -188,7 +188,7 @@ std::wstring styles_map::get(const std::wstring & Name, odf_types::style_family:
|
||||
}
|
||||
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));
|
||||
return id;
|
||||
}
|
||||
@ -1060,7 +1060,7 @@ void docx_conversion_context::start_list_item(bool restart)
|
||||
if (restart && !list_style_stack_.empty())
|
||||
{
|
||||
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;
|
||||
|
||||
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
|
||||
std::wstring notes_context::next_id()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1291,14 +1291,14 @@ void docx_conversion_context::start_text_changes (std::wstring id)
|
||||
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)
|
||||
{
|
||||
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];
|
||||
|
||||
@ -1330,7 +1330,7 @@ void docx_conversion_context::start_changes()
|
||||
std::wstring change_attr;
|
||||
change_attr += L" w:date=\"" + state.date + 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)
|
||||
{
|
||||
|
||||
@ -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"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")
|
||||
@ -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"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"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"o:spid", L"_x0000_s" + std::to_wstring(1024 + val.id));
|
||||
|
||||
@ -223,7 +223,7 @@ void docx_charts_files::write(const std::wstring & RootPath)
|
||||
if (item)
|
||||
{
|
||||
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";
|
||||
|
||||
content_type_content * contentTypes = get_main_document()->get_content_types_file().content();
|
||||
@ -307,6 +307,7 @@ namespace
|
||||
content << L"<w:" << Node << L"s \
|
||||
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
|
||||
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
|
||||
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
|
||||
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
|
||||
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
|
||||
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
|
||||
|
||||
@ -62,7 +62,9 @@ struct drawing_object_description
|
||||
double anchor_x_;
|
||||
double anchor_y_;
|
||||
|
||||
_action_desc action_;
|
||||
std::vector<_hlink_desc> hlinks_;
|
||||
|
||||
std::vector<odf_reader::_property> additional_; //shape properties
|
||||
|
||||
std::wstring xlink_href_; //ссылка на внешний объект
|
||||
|
||||
@ -39,13 +39,13 @@ namespace oox {
|
||||
|
||||
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)
|
||||
{
|
||||
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,
|
||||
@ -64,9 +64,10 @@ std::wstring headers_footers::add(const std::wstring & StyleName,
|
||||
}
|
||||
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);
|
||||
return id;
|
||||
|
||||
@ -44,7 +44,8 @@ namespace oox {
|
||||
hyperlinks::_ref hyperlinks::last()
|
||||
{
|
||||
_ref r={};
|
||||
if (hrefs_.size()>0)
|
||||
|
||||
if (!hrefs_.empty())
|
||||
r = hrefs_.back();
|
||||
|
||||
return r;
|
||||
@ -52,9 +53,9 @@ hyperlinks::_ref hyperlinks::last()
|
||||
|
||||
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);
|
||||
|
||||
@ -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)
|
||||
{
|
||||
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" ) );
|
||||
elm.used_rels = true;
|
||||
Rels.add( relationship(hrefs_[i].id, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hrefs_[i].href, L"External" ) );
|
||||
hrefs_[i].used_rels = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
|
||||
|
||||
// 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);
|
||||
|
||||
if (FALSE == (hr = pFontManager->LoadString2( L"xxxxx" , 0, 0)))
|
||||
|
||||
@ -33,9 +33,6 @@
|
||||
#include "mediaitems.h"
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <cpdoccore/xml/utils.h>
|
||||
|
||||
@ -92,12 +89,18 @@ std::wstring static get_default_file_name(RelsType type)
|
||||
return L"image";
|
||||
case typeChart:
|
||||
return L"chart";
|
||||
case typeMedia:
|
||||
return L"media";
|
||||
case typeMsObject:
|
||||
return L"msObject";
|
||||
case typeOleObject:
|
||||
return L"oleObject";
|
||||
case typeMedia:
|
||||
return L"media";
|
||||
case typeSlide:
|
||||
return L"slide";
|
||||
case typeVideo:
|
||||
return L"video";
|
||||
case typeAudio:
|
||||
return L"audio";
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
@ -140,10 +143,9 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
|
||||
if (type == typeOleObject && sExt.empty())
|
||||
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(const std::wstring &fileName)
|
||||
{
|
||||
CFile file;
|
||||
|
||||
@ -187,6 +189,9 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
else if ( type == typeImage) number = count_image + 1;
|
||||
else if ( type == typeShape) number = count_shape + 1;
|
||||
else if ( type == typeMedia) number = count_media + 1;
|
||||
else if ( type == typeAudio) number = count_audio + 1;
|
||||
else if ( type == typeVideo) number = count_video + 1;
|
||||
else if ( type == typeSlide) number = count_slide + 1;
|
||||
else if ( type == typeMsObject ||
|
||||
type == typeOleObject) number = count_object + 1;
|
||||
else
|
||||
@ -219,7 +224,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
{
|
||||
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++;
|
||||
}
|
||||
else if ( type == typeImage)
|
||||
@ -232,17 +237,32 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
//------------------------------------------------
|
||||
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++;
|
||||
}
|
||||
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++;
|
||||
}
|
||||
else if ( type == typeAudio)
|
||||
{
|
||||
id = std::wstring(L"aId") + std::to_wstring(count_audio + 1);
|
||||
count_audio++;
|
||||
}
|
||||
else if ( type == typeVideo)
|
||||
{
|
||||
id = std::wstring(L"vId") + std::to_wstring(count_video + 1);
|
||||
count_video++;
|
||||
}
|
||||
else if ( type == typeMedia)
|
||||
{
|
||||
id = std::wstring(L"mId") + std::to_wstring(count_media + 1);
|
||||
count_media++;
|
||||
}
|
||||
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++;
|
||||
}
|
||||
|
||||
|
||||
@ -31,11 +31,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "oox_rels.h"
|
||||
|
||||
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
@ -50,6 +49,9 @@ public:
|
||||
count_tables = 0;
|
||||
count_media = 0;
|
||||
count_object = 0;
|
||||
count_audio = 0;
|
||||
count_video = 0;
|
||||
count_slide = 0;
|
||||
}
|
||||
|
||||
struct item
|
||||
@ -74,6 +76,9 @@ public:
|
||||
size_t count_charts;
|
||||
size_t count_image;
|
||||
size_t count_media;
|
||||
size_t count_audio;
|
||||
size_t count_video;
|
||||
size_t count_slide;
|
||||
size_t count_shape;
|
||||
size_t count_tables;
|
||||
size_t count_object;
|
||||
@ -88,20 +93,47 @@ public:
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
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 typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
|
||||
case typeOleObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
|
||||
case typeHyperlink: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
||||
default:
|
||||
return L"";
|
||||
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 typeMsObject: return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
|
||||
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 typeMedia: return L"http://schemas.microsoft.com/office/2007/relationships/media";
|
||||
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"";
|
||||
}
|
||||
}
|
||||
static RelsType detectMediaType(const std::wstring & fileName)
|
||||
{
|
||||
int pos = fileName.rfind(L".");
|
||||
|
||||
std::wstring sExt = (pos >=0 ? fileName.substr(pos + 1) : L"");
|
||||
|
||||
if (sExt.empty()) return typeMedia;
|
||||
|
||||
sExt = XmlUtils::GetLower(sExt);
|
||||
|
||||
if (sExt == L"wmv") return typeVideo;
|
||||
if (sExt == L"avi") return typeVideo;
|
||||
if (sExt == L"wmv") return typeVideo;
|
||||
if (sExt == L"wma") return typeAudio;
|
||||
if (sExt == L"wav") return typeAudio;
|
||||
|
||||
if (sExt == L"mp3") return typeAudio;
|
||||
if (sExt == L"m4a") return typeAudio;
|
||||
if (sExt == L"m4v") return typeVideo;
|
||||
if (sExt == L"mp4") return typeVideo;
|
||||
if (sExt == L"mov") return typeVideo;
|
||||
|
||||
return typeMedia;
|
||||
}
|
||||
private:
|
||||
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 (const std::wstring &fileName);
|
||||
|
||||
items_array items_;
|
||||
std::wstring odf_packet_;
|
||||
|
||||
|
||||
@ -516,22 +516,32 @@ 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)
|
||||
{
|
||||
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");
|
||||
|
||||
if (!val.action.empty())
|
||||
CP_XML_ATTR(L"action", val.action);
|
||||
|
||||
if (val.highlightClick)
|
||||
CP_XML_ATTR(L"highlightClick", val.highlightClick);
|
||||
|
||||
CP_XML_ATTR(L"r:id", val.hId);
|
||||
|
||||
if (!val.hSoundId.empty())
|
||||
{
|
||||
CP_XML_NODE(L"a:hlinkClick")
|
||||
CP_XML_NODE(L"a:snd")
|
||||
{
|
||||
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_ATTR(L"r:id", h.hId);
|
||||
CP_XML_ATTR(L"r:embed", val.hSoundId);
|
||||
CP_XML_ATTR(L"name", L"sound");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,10 +51,35 @@ namespace oox {
|
||||
{
|
||||
std::wstring hId;
|
||||
std::wstring hRef;
|
||||
|
||||
bool in_object;
|
||||
};
|
||||
};
|
||||
struct _action_desc
|
||||
{
|
||||
_action_desc() : enabled(false), highlightClick(false) {}
|
||||
void clear()
|
||||
{
|
||||
enabled = false;
|
||||
highlightClick = false;
|
||||
|
||||
hSoundId.clear();
|
||||
hSoundRef.clear();
|
||||
|
||||
hId.clear();
|
||||
hRef.clear();
|
||||
|
||||
action.clear();
|
||||
}
|
||||
bool enabled;
|
||||
std::wstring action;
|
||||
|
||||
std::wstring hSoundId;
|
||||
std::wstring hSoundRef;
|
||||
|
||||
std::wstring hId;
|
||||
std::wstring hRef;
|
||||
|
||||
RelsType typeRels;
|
||||
bool highlightClick;
|
||||
};
|
||||
class _oox_drawing
|
||||
{
|
||||
public:
|
||||
@ -74,10 +99,14 @@ namespace oox {
|
||||
|
||||
_oox_fill fill;
|
||||
|
||||
std::wstring objectId;
|
||||
std::wstring objectProgId;
|
||||
std::wstring objectId;
|
||||
std::wstring objectProgId;
|
||||
|
||||
std::wstring extId;
|
||||
|
||||
_action_desc action;
|
||||
std::vector<_hlink_desc> hlinks;
|
||||
|
||||
std::vector<_hlink_desc> hlinks;
|
||||
std::vector<odf_reader::_property> additional;
|
||||
|
||||
virtual void serialize (std::wostream & strm) = 0;
|
||||
@ -90,7 +119,7 @@ namespace oox {
|
||||
|
||||
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_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)
|
||||
{
|
||||
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
|
||||
{
|
||||
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"%");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,18 @@ static std::wstring get_mime_type(const std::wstring & extension)
|
||||
else if (L"tif" == extension) return L"image/x-tiff";
|
||||
else if (L"tiff" == extension) return L"image/x-tiff";
|
||||
else if (L"pdf" == extension) return L"application/pdf";
|
||||
|
||||
else if (L"wav" == extension) return L"audio/wav";
|
||||
else if (L"mp3" == extension) return L"audio/mpeg";
|
||||
else if (L"wma" == extension) return L"audio/x-ms-wma";
|
||||
else if (L"m4a" == extension) return L"audio/unknown";
|
||||
|
||||
else if (L"avi" == extension) return L"video/avi";
|
||||
else if (L"wmv" == extension) return L"video/x-ms-wmv";
|
||||
else if (L"mov" == extension) return L"video/unknown";
|
||||
else if (L"mp4" == extension) return L"video/unknown";
|
||||
else if (L"m4v" == extension) return L"video/unknown";
|
||||
|
||||
else if (L"bin" == extension) return L"application/vnd.openxmlformats-officedocument.oleObject";
|
||||
else if (L"xlsx" == extension) return L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
else if (L"docx" == extension) return L"application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
||||
@ -130,7 +141,7 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
|
||||
{
|
||||
std::vector<override_content_type> & override_ = content_type_content_.get_override();
|
||||
|
||||
for (int i = 0 ; i < override_.size(); i++)
|
||||
for (size_t i = 0 ; i < override_.size(); i++)
|
||||
{
|
||||
if (override_[i].part_name() == fileName)
|
||||
return true;
|
||||
@ -158,14 +169,18 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
|
||||
|
||||
void content_types_file::set_media(mediaitems & _Mediaitems)
|
||||
{
|
||||
BOOST_FOREACH( mediaitems::item & item, _Mediaitems.items() )
|
||||
std::vector<mediaitems::item> & items_ = _Mediaitems.items();
|
||||
for (size_t i = 0; i < items_.size(); i++)
|
||||
{
|
||||
if ((item.type == typeImage || item.type == typeMedia) && item.mediaInternal)
|
||||
if ((items_[i].type == typeImage ||
|
||||
items_[i].type == typeMedia ||
|
||||
items_[i].type == typeVideo ||
|
||||
items_[i].type == typeAudio) && items_[i].mediaInternal)
|
||||
{
|
||||
int n = item.outputName.rfind(L".");
|
||||
int n = items_[i].outputName.rfind(L".");
|
||||
if (n > 0)
|
||||
{
|
||||
add_or_find_default(item.outputName.substr(n+1, item.outputName.length() - n));
|
||||
add_or_find_default(items_[i].outputName.substr(n + 1, items_[i].outputName.length() - n));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,9 +335,12 @@ void media::write(const std::wstring & RootPath)
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
mediaitems::items_array & items = mediaitems_.items();
|
||||
for (int i = 0; i < items.size(); i++ )
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if (items[i].mediaInternal && items[i].valid && (items[i].type == typeImage || items[i].type == typeMedia))
|
||||
if (items[i].mediaInternal && items[i].valid && ( items[i].type == typeImage ||
|
||||
items[i].type == typeMedia ||
|
||||
items[i].type == typeAudio ||
|
||||
items[i].type == typeVideo ))
|
||||
{
|
||||
std::wstring & file_name = items[i].href;
|
||||
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + items[i].outputName;
|
||||
@ -359,7 +377,7 @@ void embeddings::write(const std::wstring & RootPath)
|
||||
content_types_file & content_types = get_main_document()->get_content_types_file();
|
||||
|
||||
mediaitems::items_array & items = embeddingsitems_.items();
|
||||
for (int i = 0; i < items.size(); i++ )
|
||||
for (size_t i = 0; i < items.size(); i++ )
|
||||
{
|
||||
if ( items[i].mediaInternal && items[i].valid &&
|
||||
(items[i].type == typeMsObject || items[i].type == typeOleObject))
|
||||
|
||||
@ -56,18 +56,6 @@ std::wostream & relationship::xml_to_stream(std::wostream & _Wostream) const
|
||||
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;
|
||||
}
|
||||
|
||||
@ -82,23 +70,12 @@ std::wostream & rels::xml_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,10 @@ enum RelsType
|
||||
typeMedia,
|
||||
typeGroupShape,
|
||||
typeMsObject,
|
||||
typeOleObject
|
||||
typeOleObject,
|
||||
typeSlide,
|
||||
typeVideo,
|
||||
typeAudio
|
||||
};
|
||||
|
||||
struct _rel
|
||||
|
||||
@ -54,13 +54,13 @@ public:
|
||||
|
||||
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";
|
||||
|
||||
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;
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ void pptx_conversion_context::process_theme(std::wstring name)
|
||||
|
||||
if (name.empty())
|
||||
{
|
||||
name = L"User Theme: " + boost::lexical_cast<std::wstring>(current);
|
||||
name = L"User Theme: " + std::to_wstring(current);
|
||||
}
|
||||
start_theme(name);
|
||||
//
|
||||
@ -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]);
|
||||
|
||||
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)
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
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")
|
||||
@ -109,6 +109,75 @@ 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")
|
||||
{
|
||||
std::wstring strNode;
|
||||
|
||||
if (val.type == typeVideo) strNode = L"a:videoFile";
|
||||
else if (val.type == typeAudio) strNode = L"a:audioFile";
|
||||
|
||||
if (strNode.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(strNode)
|
||||
{
|
||||
CP_XML_ATTR(L"r:link", val.objectId);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:extLst")
|
||||
{
|
||||
CP_XML_NODE(L"p:ext")
|
||||
{
|
||||
CP_XML_ATTR(L"uri", L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}");
|
||||
CP_XML_NODE(L"p14:media")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
|
||||
CP_XML_ATTR(L"r:embed", val.extId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
@ -123,7 +192,7 @@ void pptx_serialize_shape(std::wostream & strm, _pptx_drawing & val)
|
||||
CP_XML_ATTR(L"id", val.id);//числовое значение val.rId
|
||||
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 там)
|
||||
{
|
||||
@ -310,11 +379,14 @@ void _pptx_drawing::serialize(std::wostream & strm)
|
||||
{
|
||||
pptx_serialize_table(strm, *this);
|
||||
}
|
||||
else if (type == typeMsObject ||
|
||||
type == typeOleObject)
|
||||
else if (type == typeMsObject || type == typeOleObject)
|
||||
{
|
||||
pptx_serialize_object(strm, *this);
|
||||
}
|
||||
else if (type == typeMedia || type == typeAudio || type == typeVideo )
|
||||
{
|
||||
pptx_serialize_media(strm, *this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,11 +65,16 @@ public:
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
if (!d.action.hId.empty())
|
||||
{
|
||||
bool bInternal = (d.action.typeRels != typeHyperlink);
|
||||
pptx_drawing_rels_.push_back(_rel(bInternal, d.action.hId, d.action.hRef, d.action.typeRels));
|
||||
}
|
||||
}
|
||||
|
||||
void add(/**/
|
||||
bool isInternal,
|
||||
@ -120,10 +125,13 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring ref = pptx_drawing_rels_[i].ref;
|
||||
if (pptx_drawing_rels_[i].is_internal && ref != L"NULL")
|
||||
{
|
||||
ref = L"../" + ref;
|
||||
}
|
||||
Rels.add(relationship( pptx_drawing_rels_[i].rid,
|
||||
mediaitems::get_rel_type(pptx_drawing_rels_[i].type),
|
||||
(pptx_drawing_rels_[i].is_internal ? std::wstring(L"../") + pptx_drawing_rels_[i].ref : pptx_drawing_rels_[i].ref),
|
||||
(pptx_drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
mediaitems::get_rel_type(pptx_drawing_rels_[i].type), ref, (pptx_drawing_rels_[i].is_internal ? L"" : L"External")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ std::wstring pptx_xml_slide::rId() const
|
||||
pptx_xml_slide_ptr pptx_xml_slide::create(std::wstring const & name,int id)
|
||||
{
|
||||
const std::wstring rId = std::wstring(L"sId") + std::to_wstring(id);
|
||||
return boost::make_shared<pptx_xml_slide>(name,rId);
|
||||
return boost::make_shared<pptx_xml_slide>(name, rId);
|
||||
}
|
||||
|
||||
pptx_xml_slide::pptx_xml_slide(std::wstring const & name,std::wstring const & id)
|
||||
@ -273,7 +273,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
CP_XML_ATTR(L"accent6",L"accent6");
|
||||
CP_XML_ATTR(L"accent5",L"accent5");
|
||||
CP_XML_ATTR(L"accent4",L"accent4");
|
||||
CP_XML_ATTR(L"accent3",L"accent5");
|
||||
CP_XML_ATTR(L"accent3",L"accent3");
|
||||
CP_XML_ATTR(L"accent2",L"accent2");
|
||||
CP_XML_ATTR(L"accent1",L"accent1");
|
||||
CP_XML_ATTR(L"tx2",L"dk2");
|
||||
@ -283,7 +283,7 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
|
||||
}
|
||||
CP_XML_NODE(L"p:sldLayoutIdLst")
|
||||
{
|
||||
for (int i = 0; i < layoutsId_.size(); i++)
|
||||
for (size_t i = 0; i < layoutsId_.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"p:sldLayoutId")
|
||||
{
|
||||
@ -420,10 +420,14 @@ void pptx_xml_presentation::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_STREAM() << slideMastersData_.str();
|
||||
}
|
||||
CP_XML_NODE(L"p:notesMasterIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << slideNotesMastersData_.str();
|
||||
}
|
||||
std::wstring notesMaster = slideNotesMastersData_.str();
|
||||
if (notesMaster.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"p:notesMasterIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << notesMaster;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"p:sldIdLst")
|
||||
{
|
||||
CP_XML_STREAM() << slidesData_.str();
|
||||
|
||||
@ -100,7 +100,7 @@ void slide_content::add_rels(rels & _r)
|
||||
{
|
||||
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]);
|
||||
}
|
||||
|
||||
@ -60,6 +60,7 @@ public:
|
||||
|
||||
_CP_OPT(std::wstring) Speed;
|
||||
_CP_OPT(int) Time;
|
||||
_CP_OPT(int) PageTime;
|
||||
_CP_OPT(std::wstring) Dir;
|
||||
_CP_OPT(std::wstring) Param;
|
||||
bool onClick;
|
||||
@ -135,6 +136,7 @@ private:
|
||||
void process_chart (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
void process_table (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
void process_object (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
void process_media (drawing_object_description& obj, _pptx_drawing & drawing);
|
||||
|
||||
size_t rId_;
|
||||
mediaitems mediaitems_;
|
||||
@ -160,6 +162,7 @@ void pptx_slide_context::Impl::process_drawings()
|
||||
case typeChart: process_chart(objects_[i], drawing); break;
|
||||
case typeShape: process_shape(objects_[i], drawing); break;
|
||||
case typeTable: process_table(objects_[i], drawing); break;
|
||||
case typeMedia: process_media(objects_[i], drawing); break;
|
||||
case typeMsObject:
|
||||
case typeOleObject: process_object(objects_[i], drawing); break;
|
||||
}
|
||||
@ -228,6 +231,8 @@ void pptx_slide_context::default_set()
|
||||
impl_->object_description_.svg_rect_ = boost::none;
|
||||
|
||||
impl_->object_description_.hlinks_.clear();
|
||||
impl_->object_description_.action_.clear();
|
||||
|
||||
impl_->object_description_.additional_.clear();
|
||||
|
||||
impl_->object_description_.fill_.clear();
|
||||
@ -323,15 +328,15 @@ void pptx_slide_context::set_fill(_oox_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_;
|
||||
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);
|
||||
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);
|
||||
|
||||
return hId;
|
||||
@ -347,14 +352,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);
|
||||
add_rels(isMediaInternal, fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
|
||||
impl_->background_fill_ = fill;
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_name(std::wstring const & name)
|
||||
{
|
||||
impl_->object_description_.name_ = name;
|
||||
|
||||
}
|
||||
|
||||
void pptx_slide_context::start_shape(int type)
|
||||
@ -362,6 +365,74 @@ void pptx_slide_context::start_shape(int type)
|
||||
impl_->object_description_.type_ = typeShape;
|
||||
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_.action = L"ppaction://noaction";
|
||||
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_;
|
||||
|
||||
impl_->object_description_.action_.highlightClick = true;
|
||||
|
||||
if (typeRels == typeAudio)
|
||||
{
|
||||
bool isMediaInternal = true;
|
||||
|
||||
impl_->object_description_.action_.hSoundId = get_mediaitems().add_or_find(link, typeAudio, isMediaInternal, impl_->object_description_.action_.hSoundRef);
|
||||
impl_->add_additional_rels(isMediaInternal, impl_->object_description_.action_.hSoundId, impl_->object_description_.action_.hSoundRef, typeAudio);
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->object_description_.action_.typeRels = typeRels;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::end_action()
|
||||
{
|
||||
}
|
||||
|
||||
void pptx_slide_context::start_table()
|
||||
{
|
||||
@ -385,6 +456,20 @@ void pptx_slide_context::set_ole_object(const std::wstring & path, const std::ws
|
||||
impl_->object_description_.xlink_href_ = path;
|
||||
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)
|
||||
{
|
||||
@ -532,7 +617,6 @@ void pptx_slide_context::Impl::process_shape(drawing_object_description & obj, _
|
||||
|
||||
add_drawing(drawing, isMediaInternal, rId, ref, typeShape);
|
||||
}
|
||||
|
||||
void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
std::wstring ref;
|
||||
@ -550,30 +634,48 @@ void pptx_slide_context::Impl::process_object(drawing_object_description& obj, _
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::Impl::process_media(drawing_object_description& obj, _pptx_drawing & drawing)
|
||||
{
|
||||
std::wstring ref;
|
||||
bool isMediaInternal = true;
|
||||
|
||||
drawing.type = mediaitems::detectMediaType(obj.xlink_href_); //reset from Media to Audio, Video, ... QuickTime? AudioCD? ...
|
||||
|
||||
drawing.objectId = get_mediaitems().add_or_find(obj.xlink_href_, drawing.type, isMediaInternal, ref);
|
||||
drawing.extId = L"ext" + drawing.objectId;
|
||||
|
||||
add_drawing(drawing, false, drawing.objectId, L"NULL", drawing.type);
|
||||
add_additional_rels( true, drawing.extId, ref, typeMedia);
|
||||
|
||||
if (drawing.fill.bitmap)
|
||||
{
|
||||
drawing.fill.bitmap->rId = get_mediaitems().add_or_find(drawing.fill.bitmap->xlink_href_, typeImage, isMediaInternal, ref);
|
||||
|
||||
add_additional_rels(isMediaInternal, drawing.fill.bitmap->rId, ref, typeImage);
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::Impl::process_common_properties(drawing_object_description & pic, _pptx_drawing & drawing)
|
||||
{
|
||||
if (pic.svg_rect_)
|
||||
{
|
||||
//todooo непонятки с отрицательными значениями
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
if (val >=0) drawing.cy = val;
|
||||
if ( val >=0 ) drawing.cy = val;
|
||||
}
|
||||
|
||||
drawing.additional = pic.additional_;
|
||||
|
||||
drawing.hlinks = pic.hlinks_;
|
||||
|
||||
drawing.fill = pic.fill_;
|
||||
drawing.additional = pic.additional_;
|
||||
drawing.hlinks = pic.hlinks_;
|
||||
drawing.action = pic.action_;
|
||||
drawing.fill = pic.fill_;
|
||||
}
|
||||
|
||||
void pptx_slide_context::dump_rels(rels & Rels)
|
||||
@ -645,8 +747,12 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
|
||||
}
|
||||
if (impl_->transition_.Time)
|
||||
{
|
||||
CP_XML_ATTR(L"advTm",impl_->transition_.Time.get());
|
||||
}
|
||||
CP_XML_ATTR(L"p14:dur", impl_->transition_.Time.get());
|
||||
}
|
||||
if (impl_->transition_.PageTime)
|
||||
{
|
||||
CP_XML_ATTR(L"advTm", impl_->transition_.PageTime.get());
|
||||
}
|
||||
CP_XML_ATTR(L"advClick", impl_->transition_.onClick);
|
||||
|
||||
CP_XML_NODE(std::wstring(L"p:" + impl_->transition_.Type))
|
||||
@ -669,9 +775,22 @@ void pptx_slide_context::serialize_animations(std::wostream & strm)
|
||||
//p:sndAc
|
||||
}
|
||||
}
|
||||
//CP_XML_NODE(L"p:timing")- последовательности p:par
|
||||
//{
|
||||
//}
|
||||
CP_XML_NODE(L"p:timing")
|
||||
{
|
||||
CP_XML_NODE(L"p:tnLst")
|
||||
{
|
||||
CP_XML_NODE(L"p:par")
|
||||
{
|
||||
CP_XML_NODE(L"p:cTn")
|
||||
{
|
||||
CP_XML_ATTR(L"nodeType", L"tmRoot");
|
||||
CP_XML_ATTR(L"id", 1);
|
||||
CP_XML_ATTR(L"dur", L"indefinite");
|
||||
CP_XML_ATTR(L"restart", L"never");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
void set_placeHolder_type (std::wstring typeHolder);
|
||||
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 set_image (const std::wstring & path);
|
||||
@ -83,8 +83,14 @@ public:
|
||||
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_text_box ();
|
||||
void set_media (const std::wstring & path);
|
||||
void set_media_param(std::wstring name, std::wstring value);
|
||||
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 end_table();
|
||||
|
||||
|
||||
@ -631,7 +631,7 @@ void pptx_text_context::Impl::start_list_item(bool restart)
|
||||
if (restart && !list_style_stack_.empty())
|
||||
{
|
||||
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;
|
||||
|
||||
odf_reader::list_style_container & lists = odf_context_.listStyleContainer();
|
||||
|
||||
@ -143,9 +143,9 @@ public:
|
||||
|
||||
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"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;");
|
||||
|
||||
if (c.visibly_ == false)style += std::wstring(L"visibility:hidden;");
|
||||
@ -227,14 +227,14 @@ public:
|
||||
if (c.author_ == author_list_[i])
|
||||
{
|
||||
find=true;
|
||||
c.author_ = boost::lexical_cast<std::wstring>(i);
|
||||
c.author_ = std::to_wstring(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!find)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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)
|
||||
{
|
||||
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 vml_fileName = std::wstring(L"vmlDrawing") + file_id + L".vml";
|
||||
|
||||
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;
|
||||
return std::pair<std::wstring, std::wstring>(fileName, rId);
|
||||
}
|
||||
|
||||
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;
|
||||
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)
|
||||
CP_XML_ATTR(L"id", val.id);
|
||||
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")
|
||||
@ -158,7 +158,7 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
|
||||
|
||||
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 там)
|
||||
{
|
||||
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
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";
|
||||
drawings_.push_back(drawing_elm(fileName, content, drawings));
|
||||
const std::wstring rId = std::wstring(L"rId") + id;//rDrId
|
||||
@ -173,6 +173,7 @@ void xlsx_drawing_context::clear()
|
||||
|
||||
impl_->object_description_.additional_.clear();
|
||||
impl_->object_description_.hlinks_.clear();
|
||||
impl_->object_description_.action_.clear();
|
||||
impl_->object_description_.additional_.clear();
|
||||
|
||||
impl_->use_image_replacement_ = false;
|
||||
@ -399,16 +400,17 @@ void xlsx_drawing_context::set_fill(_oox_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_;
|
||||
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);
|
||||
XmlUtils::replace_all( href_correct, L" .", L".");//1 (130).odt
|
||||
|
||||
_hlink_desc desc = {hId, href_correct, object}; //корректность написания ссылки важна для ms office и не важна для open office ->
|
||||
//todooo
|
||||
//корректность написания ссылки важна для ms office и не важна для open office ->
|
||||
//todooo
|
||||
_hlink_desc desc = {hId, href_correct};
|
||||
impl_->object_description_.hlinks_.push_back(desc);
|
||||
|
||||
return hId;
|
||||
@ -464,6 +466,7 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
|
||||
|
||||
drawing.additional = obj.additional_;
|
||||
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)
|
||||
{
|
||||
@ -662,11 +665,33 @@ void xlsx_drawing_context::serialize(std::wostream & strm)
|
||||
impl_->serialize(strm);
|
||||
}
|
||||
|
||||
|
||||
xlsx_drawings_ptr xlsx_drawing_context::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:
|
||||
|
||||
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();
|
||||
|
||||
@ -125,6 +125,10 @@ public:
|
||||
|
||||
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:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
@ -50,10 +50,12 @@ public:
|
||||
|
||||
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));
|
||||
}
|
||||
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) //не объект
|
||||
{
|
||||
|
||||
@ -82,7 +82,7 @@ public:
|
||||
record r;
|
||||
r.ref = ref;
|
||||
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"#");
|
||||
if (pos_target == 0)//ссыль на страницу или метку в текущем документе
|
||||
|
||||
@ -191,6 +191,12 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
}
|
||||
|
||||
CP_XML_STREAM() << impl_->drawing_.str();
|
||||
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}//props выше legacyDrawing !!
|
||||
|
||||
if (impl_->commentsId_.length()>0)
|
||||
{
|
||||
CP_XML_NODE(L"legacyDrawing")
|
||||
@ -205,10 +211,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
if (!impl_->page_props_.str().empty())
|
||||
{
|
||||
CP_XML_STREAM() << impl_->page_props_.str();
|
||||
}
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
|
||||
//CP_XML_NODE(L"rowBreaks){}
|
||||
|
||||
@ -128,7 +128,7 @@ void sheets_files::write(const std::wstring & RootPath)
|
||||
if (item)
|
||||
{
|
||||
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";
|
||||
|
||||
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)
|
||||
|
||||
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";
|
||||
const std::wstring fileRef = std::wstring(L"worksheets/") + fileName;
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
@ -286,7 +286,7 @@ void xl_charts_files::write(const std::wstring & RootPath)
|
||||
if (item)
|
||||
{
|
||||
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();
|
||||
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
||||
|
||||
@ -66,7 +66,7 @@ std::wstring getColAddress(size_t col)
|
||||
|
||||
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)
|
||||
|
||||
@ -138,7 +138,7 @@ void xlsx_conversion_context::end_document()
|
||||
{
|
||||
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();
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -634,7 +634,7 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href)
|
||||
}
|
||||
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_span2();
|
||||
|
||||
@ -117,21 +117,24 @@ void anim_seq::add_child_element( xml::sax * Reader, const std::wstring & Ns, co
|
||||
////////////////////////////////////////////////////////////////
|
||||
void anim_transition_filter_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"smil:direction", smil_direction_);
|
||||
CP_APPLY_ATTR(L"smil:subtype", smil_subtype_);
|
||||
CP_APPLY_ATTR(L"smil:type", smil_type_);
|
||||
CP_APPLY_ATTR(L"smil:fadeColor", smil_fadeColor_);
|
||||
CP_APPLY_ATTR(L"smil:mode", smil_mode_);
|
||||
CP_APPLY_ATTR(L"smil:dur", smil_dur_);
|
||||
|
||||
}
|
||||
void anim_audio_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"xlink:href", xlink_href_);
|
||||
CP_APPLY_ATTR(L"anim:audio-level", anim_audio_level_);
|
||||
}
|
||||
|
||||
const wchar_t * anim_transitionFilter::ns = L"anim";
|
||||
const wchar_t * anim_transitionFilter::ns = L"anim";
|
||||
const wchar_t * anim_transitionFilter::name = L"transitionFilter";
|
||||
|
||||
void anim_transitionFilter::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
attlist_.add_attributes(Attributes);
|
||||
common_attlist_.add_attributes(Attributes);
|
||||
filter_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
@ -143,20 +146,20 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
_CP_OPT(std::wstring) param;
|
||||
|
||||
if (attlist_.smil_dur_)
|
||||
if (common_attlist_.smil_dur_)
|
||||
{
|
||||
time = attlist_.smil_dur_->get_value();
|
||||
time = common_attlist_.smil_dur_->get_value();
|
||||
}
|
||||
if (attlist_.smil_fadeColor_)
|
||||
if (filter_attlist_.smil_fadeColor_)
|
||||
{
|
||||
color =attlist_.smil_fadeColor_->get_hex_value();
|
||||
color = filter_attlist_.smil_fadeColor_->get_hex_value();
|
||||
}
|
||||
|
||||
smil_transition_type::type transition_type;
|
||||
|
||||
if (attlist_.smil_type_)
|
||||
if (filter_attlist_.smil_type_)
|
||||
{
|
||||
transition_type = attlist_.smil_type_->get_type();
|
||||
transition_type = filter_attlist_.smil_type_->get_type();
|
||||
}
|
||||
|
||||
switch(transition_type)
|
||||
@ -165,13 +168,13 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
type = L"split";
|
||||
break;
|
||||
case smil_transition_type::irisWipe:
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"diamond"))
|
||||
if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"diamond"))
|
||||
type = L"diamond";
|
||||
else
|
||||
type = L"zoom";
|
||||
break;
|
||||
case smil_transition_type::miscDiagonalWipe:
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"doubleDiamond"))
|
||||
if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"doubleDiamond"))
|
||||
type = L"diamond";
|
||||
else
|
||||
type = L"zoom";
|
||||
@ -198,10 +201,10 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
case smil_transition_type::singleSweepWipe: //
|
||||
case smil_transition_type::doubleFanWipe: //
|
||||
type = L"wheel";
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"oneBlade")) param = L"1";
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"threeBlade")) param = L"3";
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"fourBlade")) param = L"4";
|
||||
if ((attlist_.smil_subtype_) && (attlist_.smil_subtype_.get()==L"eightBlade")) param = L"8";
|
||||
if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"oneBlade")) param = L"1";
|
||||
else if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"threeBlade")) param = L"3";
|
||||
else if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"fourBlade")) param = L"4";
|
||||
else if ((filter_attlist_.smil_subtype_) && (filter_attlist_.smil_subtype_.get()==L"eightBlade")) param = L"8";
|
||||
break;
|
||||
case smil_transition_type::fanWipe:
|
||||
type = L"wedge";
|
||||
@ -212,22 +215,22 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
case smil_transition_type::checkerBoardWipe:
|
||||
type = L"checker";
|
||||
if (attlist_.smil_subtype_.get()==L"across") dir = L"horz";
|
||||
if (attlist_.smil_subtype_.get()==L"down") dir = L"vert";
|
||||
if (filter_attlist_.smil_subtype_.get()==L"across") dir = L"horz";
|
||||
if (filter_attlist_.smil_subtype_.get()==L"down") dir = L"vert";
|
||||
break;
|
||||
case smil_transition_type::blindsWipe:
|
||||
type = L"blinds";
|
||||
if (attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
|
||||
if (filter_attlist_.smil_subtype_.get()==L"vertical") dir = L"vert";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"horizontal") dir = L"horz";
|
||||
break;
|
||||
case smil_transition_type::diagonalWipe:
|
||||
case smil_transition_type::waterfallWipe:
|
||||
type = L"strips";
|
||||
if (attlist_.smil_subtype_)
|
||||
if (filter_attlist_.smil_subtype_)
|
||||
{
|
||||
if (attlist_.smil_subtype_.get() == L"horizontalLeft") dir = L"rd";
|
||||
else if (attlist_.smil_subtype_.get() == L"horizontalRight") dir = L"lu";
|
||||
else if (attlist_.smil_subtype_.get() == L"verticalRight") dir = L"ld";
|
||||
if (filter_attlist_.smil_subtype_.get() == L"horizontalLeft") dir = L"rd";
|
||||
else if (filter_attlist_.smil_subtype_.get() == L"horizontalRight") dir = L"lu";
|
||||
else if (filter_attlist_.smil_subtype_.get() == L"verticalRight") dir = L"ld";
|
||||
else dir = L"ru";
|
||||
}
|
||||
break;
|
||||
@ -236,13 +239,13 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
case smil_transition_type::randomBarWipe:
|
||||
type = L"randomBar";
|
||||
if (attlist_.smil_subtype_.get() == L"vertical") dir = L"vert";
|
||||
if (attlist_.smil_subtype_.get() == L"horizontal") dir = L"horz";
|
||||
if (filter_attlist_.smil_subtype_.get() == L"vertical") dir = L"vert";
|
||||
else if (filter_attlist_.smil_subtype_.get() == L"horizontal") dir = L"horz";
|
||||
break;
|
||||
case smil_transition_type::pushWipe:
|
||||
type = L"push";
|
||||
if (attlist_.smil_subtype_.get()==L"combVertical") {type = L"comb"; dir = L"vert";};
|
||||
if (attlist_.smil_subtype_.get()==L"combHorizontal") {type = L"comb"; dir = L"horz";};
|
||||
if (filter_attlist_.smil_subtype_.get() == L"combVertical") {type = L"comb"; dir = L"vert";}
|
||||
else if (filter_attlist_.smil_subtype_.get() == L"combHorizontal") {type = L"comb"; dir = L"horz";}
|
||||
break;
|
||||
case smil_transition_type::slideWipe:
|
||||
type = L"pull";
|
||||
@ -252,19 +255,19 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
case smil_transition_type::barnDoorWipe:
|
||||
type = L"split";
|
||||
if (attlist_.smil_subtype_.get()==L"vertical") param = L"vert";
|
||||
if (attlist_.smil_subtype_.get()==L"horizontal") param = L"horz";
|
||||
if (filter_attlist_.smil_subtype_.get() == L"vertical") param = L"vert";
|
||||
if (filter_attlist_.smil_subtype_.get() == L"horizontal") param = L"horz";
|
||||
break;
|
||||
case smil_transition_type::barWipe:
|
||||
type = L"wipe";
|
||||
if (attlist_.smil_subtype_)
|
||||
if (filter_attlist_.smil_subtype_)
|
||||
{
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopLeft") {type = L"strips"; dir = L"rd";}
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomLeft"){type = L"strips"; dir = L"ru";}
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopRight") {type = L"strips"; dir = L"ld";}
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomRight"){type = L"strips"; dir = L"lu";}
|
||||
if (filter_attlist_.smil_subtype_.get()==L"fromTopLeft") {type = L"strips"; dir = L"rd";}
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomLeft") {type = L"strips"; dir = L"ru";}
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromTopRight") {type = L"strips"; dir = L"ld";}
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomRight") {type = L"strips"; dir = L"lu";}
|
||||
|
||||
if (attlist_.smil_subtype_.get()==L"fadeOverColor") {type = L"fade"; param = L"0";}
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fadeOverColor") {type = L"fade"; param = L"0";}
|
||||
}
|
||||
break;
|
||||
///////////////////////////////////////////////////////
|
||||
@ -282,44 +285,56 @@ void anim_transitionFilter::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
break;
|
||||
//////////////////////////////////////////////////////
|
||||
}
|
||||
if (attlist_.smil_subtype_)
|
||||
if (filter_attlist_.smil_subtype_)
|
||||
{
|
||||
if (!dir)
|
||||
{
|
||||
if (attlist_.smil_subtype_.get()==L"leftToRight")
|
||||
if (filter_attlist_.smil_subtype_.get()==L"leftToRight")
|
||||
{
|
||||
if ((attlist_.smil_direction_) && (attlist_.smil_direction_.get()==L"reverse"))dir = L"l";
|
||||
if ((common_attlist_.smil_direction_) && (common_attlist_.smil_direction_.get()==L"reverse"))dir = L"l";
|
||||
else dir = L"r";
|
||||
}
|
||||
if (attlist_.smil_subtype_.get()==L"topToBottom")
|
||||
if (filter_attlist_.smil_subtype_.get()==L"topToBottom")
|
||||
{
|
||||
if ((attlist_.smil_direction_) && (attlist_.smil_direction_.get()==L"reverse"))dir = L"u";
|
||||
if ((common_attlist_.smil_direction_) && (common_attlist_.smil_direction_.get()==L"reverse"))dir = L"u";
|
||||
else dir = L"d";
|
||||
}
|
||||
|
||||
if (attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
|
||||
if (attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
|
||||
if (attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
|
||||
if (filter_attlist_.smil_subtype_.get()==L"fromTop") dir = L"d";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromLeft") dir = L"r";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromRight") dir = L"l";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottom") dir = L"u";
|
||||
|
||||
if (attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
|
||||
if (attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
|
||||
if (attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
|
||||
if (attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"topRight") dir = L"ld";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"bottomLeft") dir = L"lu";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"bottomRight") dir = L"ru";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"topLeft") dir = L"rd";
|
||||
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomLeft")dir = L"ru";
|
||||
if (attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
|
||||
if (attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromTopLeft") dir = L"rd";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomLeft")dir = L"ru";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromTopRight") dir = L"ld";
|
||||
else if (filter_attlist_.smil_subtype_.get()==L"fromBottomRight")dir = L"lu";
|
||||
|
||||
}
|
||||
|
||||
if (!dir && (attlist_.smil_direction_) && (attlist_.smil_direction_.get()==L"reverse"))
|
||||
if (!dir && (common_attlist_.smil_direction_) && (common_attlist_.smil_direction_.get()==L"reverse"))
|
||||
dir = L"in";
|
||||
}
|
||||
|
||||
Context.get_slide_context().set_transitionFilter(type , dir, param , time);
|
||||
}
|
||||
|
||||
const wchar_t * anim_audio::ns = L"anim";
|
||||
const wchar_t * anim_audio::name = L"audio";
|
||||
|
||||
void anim_audio::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
common_attlist_.add_attributes(Attributes);
|
||||
audio_attlist_.add_attributes(Attributes);
|
||||
}
|
||||
|
||||
void anim_audio::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -45,7 +45,6 @@ namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
|
||||
|
||||
//anim:par
|
||||
class anim_par : public office_element_impl<anim_par>//Параллельные анимации
|
||||
{
|
||||
@ -95,26 +94,25 @@ private:
|
||||
CP_REGISTER_OFFICE_ELEMENT2(anim_seq);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//anim:iterate
|
||||
//class anim_iterate : public office_element_impl<anim_iterate>//Итеративные анимации
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------------------------/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//anim-transition-filter-attlist
|
||||
//-------------------------------------------------------------------------------
|
||||
class anim_audio_attlist
|
||||
{
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
_CP_OPT(std::wstring) xlink_href_;
|
||||
_CP_OPT(std::wstring) anim_audio_level_;
|
||||
};
|
||||
class anim_transition_filter_attlist
|
||||
{
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
_CP_OPT(std::wstring) smil_direction_;
|
||||
_CP_OPT(std::wstring) smil_subtype_;
|
||||
_CP_OPT(odf_types::smil_transition_type) smil_type_;
|
||||
_CP_OPT(std::wstring) smil_mode_;
|
||||
_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>
|
||||
{
|
||||
public:
|
||||
@ -126,7 +124,8 @@ public:
|
||||
|
||||
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:
|
||||
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 );
|
||||
@ -135,7 +134,26 @@ private:
|
||||
};
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
@ -46,27 +46,60 @@ std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
|
||||
_Wostream << L"indefinite";
|
||||
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;
|
||||
}
|
||||
|
||||
static bool parseTime(const std::wstring & Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
|
||||
bool parseTime(std::wstring Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::match_results<std::wstring::const_iterator> res;
|
||||
|
||||
//Full clock values:
|
||||
// 02:30:03 = 2 hours, 30 minutes and 3 seconds
|
||||
// 50:00:10.25 = 50 hours, 10 seconds and 250 milliseconds
|
||||
|
||||
boost::match_results<std::wstring::const_iterator> res1;
|
||||
boost::wregex r1 (L"([\\d]+):([\\d]+):([\\d+(\\.\\d{0,})?]+)");
|
||||
if (boost::regex_match(Time, res, r1))
|
||||
if (boost::regex_match(Time, res1, r1))
|
||||
{
|
||||
Hours = boost::lexical_cast<int>(res[1].str());
|
||||
Minutes = boost::lexical_cast<int>(res[2].str());
|
||||
Seconds = boost::lexical_cast<double>(res[3].str());
|
||||
Hours = boost::lexical_cast<int>(res1[1].str());
|
||||
Minutes = boost::lexical_cast<int>(res1[2].str());
|
||||
Seconds = boost::lexical_cast<double>(res1[3].str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -74,11 +107,12 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
|
||||
// 02:33 = 2 minutes and 33 seconds
|
||||
// 00:10.5 = 10.5 seconds = 10 seconds and 500 milliseconds
|
||||
std::wstring Time2 = L"00:10.5";
|
||||
boost::match_results<std::wstring::const_iterator> res2;
|
||||
boost::wregex r2 (L"([\\d]+):([\\d+(\\.\\d{0,})?]+)");
|
||||
if (boost::regex_match(Time, res, r2))
|
||||
if (boost::regex_match(Time, res2, r2))
|
||||
{
|
||||
Minutes = boost::lexical_cast<int>(res[1].str());
|
||||
Seconds = boost::lexical_cast<double>(res[2].str());
|
||||
Minutes = boost::lexical_cast<int>(res2[1].str());
|
||||
Seconds = boost::lexical_cast<double>(res2[2].str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -88,32 +122,51 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
|
||||
// 30s = 30 seconds
|
||||
// 5ms = 5 milliseconds
|
||||
// 12.467 = 12 seconds and 467 milliseconds
|
||||
boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]{0,})");
|
||||
if (boost::regex_match(Time, res, r3))
|
||||
{
|
||||
if (!res[2].str().empty())
|
||||
std::vector<std::wstring> values;
|
||||
boost::wregex r3 (L"([\\d+(\\.\\d{0,})?]+)([A-Za-z]+)");
|
||||
if (boost::regex_split(std::back_inserter(values), Time, r3, boost::match_default | boost::format_all))
|
||||
{
|
||||
int val = -1;
|
||||
for (size_t i = 0; i < values.size() ; i++ )
|
||||
{
|
||||
std::wstring n = res[2].str();
|
||||
std::transform(n.begin(), n.end(), n.begin(), ::tolower);
|
||||
if (n == L"h")
|
||||
if (values[i].empty()) continue;
|
||||
|
||||
if (values[i] == L"h")
|
||||
{
|
||||
Hours = boost::lexical_cast<double>(res[1].str());
|
||||
if (val >= 0)
|
||||
Hours = val;
|
||||
val = -1;
|
||||
}
|
||||
else if (n == L"min")
|
||||
else if (values[i] == L"min")
|
||||
{
|
||||
Minutes = boost::lexical_cast<double>(res[1].str());
|
||||
if (val >= 0)
|
||||
Minutes = val;
|
||||
val = -1;
|
||||
}
|
||||
else if (n == L"s")
|
||||
else if (values[i] == L"s")
|
||||
{
|
||||
Seconds = boost::lexical_cast<double>(res[1].str());
|
||||
if (val >= 0)
|
||||
Seconds = val;
|
||||
val = -1;
|
||||
}
|
||||
else if (n == L"ms")
|
||||
else if (values[i] == L"ms")
|
||||
{
|
||||
Ms = boost::lexical_cast<int>(res[1].str());
|
||||
if (val >= 0)
|
||||
Ms = val;
|
||||
val = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
val = boost::lexical_cast<double>(values[i]);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
Seconds = boost::lexical_cast<double>(res[1].str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -131,11 +184,11 @@ clockvalue clockvalue::parse(const std::wstring & Str)
|
||||
{
|
||||
int v=0;
|
||||
|
||||
int ms=0;
|
||||
double h=0,m=0,s =0;
|
||||
bool res = parseTime(Str,h,m,s,ms);
|
||||
int ms = 0;
|
||||
double h = 0, m = 0, s = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
@ -112,9 +112,10 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
|
||||
std::vector<length> Points_pt;
|
||||
|
||||
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;
|
||||
}
|
||||
@ -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 (Points_pt.size() > 3)//если другое количество точек .. попозже
|
||||
{
|
||||
float dpi_ = 96.;
|
||||
@ -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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Context.get_slide_context().add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""),true);//стиль на текст не нужен ..текста то нет - ссылка с объекта
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
Context.get_slide_context().start_action(L"");
|
||||
Context.get_slide_context().set_link(common_xlink_attlist_.href_.get_value_or(L""));
|
||||
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)
|
||||
{
|
||||
std::wstring rId = Context.add_hyperlink(common_xlink_attlist_.href_.get_value_or(L""), true);//гиперлинк с объекта, а не с текста ..
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, content_)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->docx_convert(Context);
|
||||
}
|
||||
|
||||
}
|
||||
@ -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_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
|
||||
|
||||
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";
|
||||
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)//тока с аргументами
|
||||
{
|
||||
@ -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_FOREACH(std::wstring const & t, transforms)
|
||||
for (size_t i = 0; i < transforms.size(); i++)
|
||||
{
|
||||
//_CP_LOG << "[info] : transform = " << t << L"\n";
|
||||
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)//тока с аргументами
|
||||
{
|
||||
|
||||
@ -383,6 +383,38 @@ std::wstring draw_object::office_convert(odf_document * odfDocument, int type)
|
||||
|
||||
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:
|
||||
|
||||
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
|
||||
if (*zIndex < 0)
|
||||
drawing->relativeHeight = L"0";
|
||||
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
|
||||
@ -1111,10 +1111,13 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
oox::hyperlinks::_ref hyperlink = Context.last_hyperlink();
|
||||
//нужно еще систему конроля - могут придте уже "использованные" линки с картинок - из колонтитулов (но на них уже использовали релсы)
|
||||
//дыра осталась если картинка в картинке - линк продублируется с внутренней на внешнюю
|
||||
|
||||
if (hyperlink.drawing == true && hyperlink.used_rels == false)
|
||||
{
|
||||
oox::_hlink_desc desc = {hyperlink.id, hyperlink.href, true};
|
||||
drawing->hlinks.push_back(desc);
|
||||
{//link from object
|
||||
drawing->action.enabled = true;
|
||||
drawing->action.hId = hyperlink.id;
|
||||
drawing->action.hRef = hyperlink.href;
|
||||
drawing->action.typeRels= oox::typeHyperlink;
|
||||
}
|
||||
/////////
|
||||
drawing->fill.bitmap = oox::oox_bitmap_fill::create();
|
||||
|
||||
@ -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 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_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)
|
||||
|
||||
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)
|
||||
@ -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));
|
||||
}
|
||||
|
||||
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
|
||||
item.layout_name = layout_name;
|
||||
item.master_name = master_name;
|
||||
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);
|
||||
index = content.size()-1;
|
||||
@ -265,7 +265,7 @@ std::pair<int,std::wstring> presentation_masters_instance::add_or_find(const std
|
||||
presentation_masters_instance::_master item;
|
||||
item.master_name = master_name;
|
||||
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);
|
||||
index = content.size()-1;
|
||||
|
||||
@ -164,6 +164,7 @@ enum ElementType
|
||||
typeStyleFooterStyle,
|
||||
typeStyleHeaderFooterProperties,
|
||||
|
||||
typeStylePresentationSound,
|
||||
typeStylePresentationPageLayout,
|
||||
typeStylePresentationPlaceholder,
|
||||
typeStyleDrawingPageProperties,
|
||||
@ -290,6 +291,8 @@ enum ElementType
|
||||
typeDrawObject,
|
||||
typeDrawObjectOle,
|
||||
typeDrawChart,
|
||||
typeDrawParam,
|
||||
typeDrawPlugin,
|
||||
|
||||
typeDrawShape,
|
||||
|
||||
@ -321,6 +324,9 @@ enum ElementType
|
||||
typeAnimPar,
|
||||
typeAnimSeq,
|
||||
typeAnimTransitionFilter,
|
||||
typeAnimAudio,
|
||||
typeAnimCommand,
|
||||
typeAnimIterate,
|
||||
|
||||
typeStyleGraphicPropertis,
|
||||
typeStyleDrawGradient,
|
||||
|
||||
@ -47,8 +47,8 @@ namespace odf_reader {
|
||||
|
||||
// office:event_listeners
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
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::ns = L"office";
|
||||
const wchar_t * office_event_listeners::name = L"event-listeners";
|
||||
|
||||
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
|
||||
|
||||
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")
|
||||
CP_CREATE_ELEMENT(presentation_event_listeners_);
|
||||
else if CP_CHECK_NAME(L"script", L"event-listener")
|
||||
CP_CREATE_ELEMENT(script_event_listeners_);
|
||||
else
|
||||
if CP_CHECK_NAME (L"presentation", L"event-listener")
|
||||
CP_CREATE_ELEMENT (presentation_event_listeners_);
|
||||
else if CP_CHECK_NAME (L"script", L"event-listener")
|
||||
CP_CREATE_ELEMENT (script_event_listeners_);
|
||||
else
|
||||
CP_NOT_APPLICABLE_ELM();
|
||||
}
|
||||
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
|
||||
@ -77,7 +77,7 @@ void presentation_event_listener_attlist::add_attributes( const xml::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_);
|
||||
|
||||
//...
|
||||
@ -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 )
|
||||
{
|
||||
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)
|
||||
@ -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)
|
||||
{
|
||||
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
|
||||
|
||||
@ -43,7 +43,6 @@
|
||||
namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
// office:event-listeners
|
||||
class office_event_listeners : public office_element_impl<office_event_listeners>
|
||||
{
|
||||
public:
|
||||
@ -62,20 +61,17 @@ private:
|
||||
private:
|
||||
office_element_ptr_array presentation_event_listeners_;
|
||||
office_element_ptr_array script_event_listeners_;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// presentation-event-listener-attlist
|
||||
//-------------------------------------------------------------------------------------
|
||||
class presentation_event_listener_attlist
|
||||
{
|
||||
public:
|
||||
void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
public:
|
||||
odf_types::common_xlink_attlist common_xlink_attlist_;
|
||||
|
||||
_CP_OPT(std::wstring) script_event_name_;
|
||||
@ -87,7 +83,6 @@ public:
|
||||
//presentation:effect
|
||||
};
|
||||
|
||||
// presentation:event-listeners_
|
||||
class presentation_event_listener : public office_element_impl<presentation_event_listener>
|
||||
{
|
||||
public:
|
||||
@ -104,9 +99,9 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
private:
|
||||
//office_element_ptr_array content_;
|
||||
office_element_ptr presentation_sound_;
|
||||
presentation_event_listener_attlist presentation_event_listener_attlist_;
|
||||
//office_element_ptr_array content_;
|
||||
office_element_ptr presentation_sound_;
|
||||
presentation_event_listener_attlist attlist_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -34,8 +34,6 @@
|
||||
#include "office_presentation.h"
|
||||
#include "draw_page.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <cpdoccore/xml/xmlchar.h>
|
||||
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
@ -76,9 +74,10 @@ void office_presentation::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
Context.start_office_text();
|
||||
_CP_LOG << L"[info][docx] process pages (" << pages_.size() << L" elmements)" << std::endl;
|
||||
BOOST_FOREACH(const office_element_ptr & elm, pages_)
|
||||
{
|
||||
elm->docx_convert(Context);
|
||||
|
||||
for (size_t i = 0; i < pages_.size(); i++)
|
||||
{
|
||||
pages_[i]->docx_convert(Context);
|
||||
}
|
||||
Context.end_office_text();
|
||||
}
|
||||
@ -87,9 +86,10 @@ void office_presentation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.start_office_spreadsheet(this);
|
||||
_CP_LOG << L"[info][xlsx] process pages (" << pages_.size() << L" elmements)" << std::endl;
|
||||
BOOST_FOREACH(const office_element_ptr & elm, pages_)
|
||||
{
|
||||
elm->xlsx_convert(Context);
|
||||
|
||||
for (size_t i = 0; i < pages_.size(); i++)
|
||||
{
|
||||
pages_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.end_office_spreadsheet();
|
||||
}
|
||||
@ -100,29 +100,29 @@ void office_presentation::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
|
||||
_CP_LOG << L"[info][pptx] process pages(" << pages_.size() << L" elmements)" << std::endl;
|
||||
|
||||
BOOST_FOREACH(const office_element_ptr & elm, footer_decls_)
|
||||
for (size_t i = 0; i < footer_decls_.size(); i++)
|
||||
{
|
||||
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(elm.get());
|
||||
presentation_footer_decl * style = dynamic_cast<presentation_footer_decl *>(footer_decls_[i].get());
|
||||
|
||||
if (!style)
|
||||
continue;
|
||||
|
||||
std::wstring style_name_ = L"footer:" + style->presentation_name_.get_value_or(L"");
|
||||
Context.root()->odf_context().drawStyles().add(style_name_, elm);
|
||||
Context.root()->odf_context().drawStyles().add(style_name_, footer_decls_[i]);
|
||||
}
|
||||
BOOST_FOREACH(const office_element_ptr & elm, date_time_decls_)
|
||||
{
|
||||
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(elm.get());
|
||||
for (size_t i = 0; i < date_time_decls_.size(); i++)
|
||||
{
|
||||
presentation_date_time_decl * style = dynamic_cast<presentation_date_time_decl *>(date_time_decls_[i].get());
|
||||
|
||||
if (!style)
|
||||
continue;
|
||||
|
||||
std::wstring style_name_ = L"datetime:" + style->presentation_name_.get_value_or(L"");
|
||||
Context.root()->odf_context().drawStyles().add(style_name_, elm);
|
||||
Context.root()->odf_context().drawStyles().add(style_name_, date_time_decls_[i]);
|
||||
}
|
||||
BOOST_FOREACH(const office_element_ptr & elm, pages_)
|
||||
for (size_t i = 0; i < pages_.size(); i++)
|
||||
{
|
||||
elm->pptx_convert(Context);
|
||||
pages_[i]->pptx_convert(Context);
|
||||
}
|
||||
Context.end_office_presentation();
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ void a::pptx_convert(oox::pptx_conversion_context & 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);
|
||||
|
||||
}
|
||||
|
||||
@ -73,11 +73,11 @@ std::wstring process_border(const border_style & borderStyle,
|
||||
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();
|
||||
|
||||
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())
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -298,7 +298,7 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
|
||||
{
|
||||
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";
|
||||
}
|
||||
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
|
||||
}
|
||||
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";
|
||||
}
|
||||
}
|
||||
else if (style_line_height_at_least_)
|
||||
{
|
||||
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_)
|
||||
{
|
||||
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")
|
||||
{
|
||||
|
||||
@ -70,11 +70,11 @@ std::wstring process_border(border_style & borderStyle,
|
||||
|
||||
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();
|
||||
|
||||
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())
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
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";
|
||||
}
|
||||
//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
|
||||
//}
|
||||
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";
|
||||
}
|
||||
}
|
||||
else if (style_line_height_at_least_)
|
||||
{
|
||||
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_)
|
||||
{
|
||||
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")
|
||||
@ -422,7 +422,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
|
||||
if (fo_line_height_->get_type() == line_width::Percent)
|
||||
{
|
||||
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";
|
||||
}
|
||||
//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
|
||||
//}
|
||||
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";
|
||||
}
|
||||
}
|
||||
else if (style_line_height_at_least_)
|
||||
{
|
||||
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_)
|
||||
{
|
||||
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")
|
||||
|
||||
@ -42,12 +42,8 @@ namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
//
|
||||
|
||||
// style:chart-properties
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * presentation_placeholder::ns = L"presentation";
|
||||
const wchar_t * presentation_placeholder::name = L"placeholder";
|
||||
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 )
|
||||
{
|
||||
@ -88,9 +84,26 @@ void presentation_placeholder::pptx_convert(oox::pptx_conversion_context & Conte
|
||||
|
||||
Context.get_slide_context().end_shape();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * presentation_sound::ns = L"presentation";
|
||||
const wchar_t * presentation_sound::name = L"sound";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * style_drawing_page_properties::ns = L"style";
|
||||
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)
|
||||
{
|
||||
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";
|
||||
|
||||
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
|
||||
}
|
||||
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 )
|
||||
@ -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-date-time", presentation_display_date_time_);
|
||||
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)
|
||||
{
|
||||
@ -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_date_time_);
|
||||
_CP_APPLY_PROP2(presentation_display_header_);
|
||||
|
||||
_CP_APPLY_PROP2(presentation_page_duration_);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,6 @@ namespace cpdoccore {
|
||||
namespace odf_reader {
|
||||
|
||||
|
||||
// presentation:placeholder
|
||||
class presentation_placeholder : public office_element_impl<presentation_placeholder>
|
||||
{
|
||||
public:
|
||||
@ -76,13 +75,34 @@ public:
|
||||
};
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
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_;
|
||||
anim_transition_filter_attlist anim_transition_filter_attlist_;
|
||||
@ -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_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_style_;//none, fade, move, uncover,clockwise, .... игнор если smil
|
||||
_CP_OPT(std::wstring) presentation_transition_speed_;//slow, medium, fast
|
||||
_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_speed_; //slow, medium, fast
|
||||
|
||||
_CP_OPT(bool) presentation_display_footer_;
|
||||
_CP_OPT(bool) presentation_display_page_number_;
|
||||
_CP_OPT(bool) presentation_display_date_time_;
|
||||
_CP_OPT(bool) presentation_display_header_;
|
||||
_CP_OPT(std::wstring) presentation_page_duration_;
|
||||
|
||||
office_element_ptr presentation_sound_;
|
||||
|
||||
//presentation:background-objects-visible
|
||||
//presentation:background-visible
|
||||
//style:repeat
|
||||
//presentation:page-duration
|
||||
//presentation:visibility.
|
||||
//presentation:sound.
|
||||
//draw:background-size
|
||||
|
||||
};
|
||||
//style:drawing-page-properties
|
||||
|
||||
class style_drawing_page_properties : public office_element_impl<style_drawing_page_properties>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -131,7 +131,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
|
||||
}
|
||||
}
|
||||
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 << "\" />";
|
||||
}
|
||||
@ -432,7 +432,7 @@ void insert_cell_border(oox::docx_conversion_context & Context,
|
||||
else if (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,
|
||||
else if (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);
|
||||
|
||||
@ -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;
|
||||
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())
|
||||
{
|
||||
_rPr << L"<w:position w:val=\"" << position << "\" />";
|
||||
@ -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;
|
||||
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())
|
||||
{
|
||||
needProcessFontSize = false;
|
||||
@ -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;
|
||||
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())
|
||||
{
|
||||
_rPr << L"<w:position w:val=\"" << position << "\" />";
|
||||
@ -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;
|
||||
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())
|
||||
{
|
||||
needProcessFontSize = false;
|
||||
|
||||
@ -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)
|
||||
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() ;
|
||||
|
||||
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())
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -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;
|
||||
|
||||
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
|
||||
{
|
||||
int val = 0.5 + 20.0 * fo_page_height_->get_value_unit(length::pt);
|
||||
if (val > 31680) val =31680;//22"
|
||||
w_h = boost::lexical_cast<std::wstring>(val);
|
||||
w_h = std::to_wstring(val);
|
||||
|
||||
height_page = val;
|
||||
}
|
||||
@ -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);
|
||||
if (w < 914400) w = 914400;
|
||||
|
||||
w_w = boost::lexical_cast<std::wstring>(w);
|
||||
w_w = std::to_wstring(w);
|
||||
}
|
||||
if (fo_page_height_)
|
||||
{
|
||||
@ -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);
|
||||
if (w < 914400) w = 914400;
|
||||
|
||||
w_w = boost::lexical_cast<std::wstring>(w);
|
||||
w_w = std::to_wstring(w);
|
||||
}
|
||||
if (attlist_.fo_page_height_)
|
||||
{
|
||||
|
||||
@ -271,7 +271,7 @@ std::wstring GetLevelText(unsigned int displayLevels,
|
||||
if (displayLevels > 1)
|
||||
res += L".";
|
||||
res += L"%";
|
||||
res += boost::lexical_cast<std::wstring>(textLevel);
|
||||
res += std::to_wstring(textLevel);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@ -156,9 +156,9 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
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":";
|
||||
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"";
|
||||
|
||||
CP_XML_ATTR(L"collapsed", Context.get_table_context().state()->group_row_.collapsed);
|
||||
|
||||
@ -161,10 +161,10 @@ struct anchor_settings
|
||||
|
||||
enum _drawing_part
|
||||
{
|
||||
Unknown=0,
|
||||
Area,
|
||||
Line,
|
||||
Shadow
|
||||
Unknown = 0,
|
||||
Area = 1,
|
||||
Line = 2,
|
||||
Shadow = 3
|
||||
};
|
||||
struct odf_drawing_state
|
||||
{
|
||||
@ -192,6 +192,7 @@ struct odf_drawing_state
|
||||
view_box_ = L"";
|
||||
path_last_command_ = L"";
|
||||
|
||||
replacement_ = L"";
|
||||
oox_shape_preset_ = -1;
|
||||
oox_shape_.reset();
|
||||
|
||||
@ -222,12 +223,12 @@ struct odf_drawing_state
|
||||
_CP_OPT(presentation_class) presentation_class_;
|
||||
_CP_OPT(std::wstring) presentation_placeholder_;
|
||||
|
||||
|
||||
std::wstring replacement_;
|
||||
std::wstring path_;
|
||||
std::wstring view_box_;
|
||||
std::wstring path_last_command_;
|
||||
oox_shape_ptr oox_shape_;
|
||||
///////////////////////
|
||||
//----------------------------------------------------------
|
||||
int oox_shape_preset_;
|
||||
bool in_group_;
|
||||
bool text_box_tableframe_;
|
||||
@ -236,7 +237,7 @@ struct odf_drawing_state
|
||||
class odf_drawing_context::Impl
|
||||
{
|
||||
public:
|
||||
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
|
||||
Impl(odf_conversion_context *odf_context) : odf_context_(odf_context)
|
||||
{
|
||||
current_drawing_state_.clear();
|
||||
styles_context_ = odf_context_->styles_context();
|
||||
@ -250,7 +251,7 @@ public:
|
||||
is_header_ = false;
|
||||
is_footer_ = false;
|
||||
is_background_ = false;
|
||||
//некоторые свойства для объектов графики не поддерживаюися в редакторах Liber && OpenOffice.net
|
||||
//некоторые свойства для объектов графики не поддерживаюися в редакторах Libre && OpenOffice.net
|
||||
//в MS Office и в нашем - проблем таких нет.
|
||||
}
|
||||
|
||||
@ -295,8 +296,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
odf_drawing_context::odf_drawing_context(odf_conversion_context *odf_context)
|
||||
: impl_(new odf_drawing_context::Impl(odf_context))
|
||||
{
|
||||
@ -2277,9 +2277,7 @@ void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(d
|
||||
if (right) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_right_ = length(*right,length::pt);
|
||||
if (bottom) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_bottom_ = length(*bottom,length::pt);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//вложенные элементы
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
void odf_drawing_context::start_image(std::wstring odf_path)
|
||||
{
|
||||
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
|
||||
@ -2359,9 +2357,31 @@ void odf_drawing_context::start_media(std::wstring name)
|
||||
|
||||
start_element(plugin_elm);
|
||||
}
|
||||
void odf_drawing_context::add_image_replacement()
|
||||
{
|
||||
if (impl_->current_drawing_state_.replacement_.empty()) return;
|
||||
|
||||
office_element_ptr image_elm;
|
||||
create_element(L"draw", L"image", image_elm, impl_->odf_context_);
|
||||
|
||||
draw_image* image = dynamic_cast<draw_image*>(image_elm.get());
|
||||
if (image == NULL)return;
|
||||
|
||||
image->common_xlink_attlist_.href_ = impl_->current_drawing_state_.replacement_;
|
||||
image->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
image->common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
image->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
|
||||
|
||||
start_element(image_elm);
|
||||
set_image_style_repeat(1);//default
|
||||
end_element();
|
||||
}
|
||||
void odf_drawing_context::end_media()
|
||||
{
|
||||
end_element();
|
||||
|
||||
add_image_replacement();
|
||||
|
||||
end_frame();
|
||||
}
|
||||
void odf_drawing_context::start_text_box()
|
||||
@ -2424,13 +2444,30 @@ void odf_drawing_context::start_action(std::wstring value)
|
||||
{
|
||||
if (std::wstring::npos != value.find(L"previousslide"))
|
||||
event_->attlist_.presentation_action_ = L"previous-page";
|
||||
if (std::wstring::npos != value.find(L"nextslide"))
|
||||
else if (std::wstring::npos != value.find(L"nextslide"))
|
||||
event_->attlist_.presentation_action_ = L"next-page";
|
||||
else if (std::wstring::npos != value.find(L"firstslide"))
|
||||
event_->attlist_.presentation_action_ = L"first-page";
|
||||
else if (std::wstring::npos != value.find(L"lastslide"))
|
||||
event_->attlist_.presentation_action_ = L"last-page";
|
||||
else if (std::wstring::npos != value.find(L"endshow"))
|
||||
event_->attlist_.presentation_action_ = L"end";
|
||||
else if (std::wstring::npos != value.find(L"endshow"))
|
||||
event_->attlist_.presentation_action_ = L"end";
|
||||
}
|
||||
else if (std::wstring::npos != value.find(L"hlinksldjump"))
|
||||
{
|
||||
event_->attlist_.presentation_action_ = L"previous-page";
|
||||
}
|
||||
else if (std::wstring::npos != value.find(L"macro"))
|
||||
{
|
||||
}
|
||||
else if (std::wstring::npos != value.find(L"hlinkfile"))
|
||||
{
|
||||
}
|
||||
else if (std::wstring::npos != value.find(L"hlinkpres"))
|
||||
{
|
||||
}
|
||||
else
|
||||
{//hyperlink
|
||||
event_->attlist_.presentation_action_ = L"show";
|
||||
@ -2458,8 +2495,10 @@ void odf_drawing_context::add_sound(std::wstring href)
|
||||
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
|
||||
if (event_)
|
||||
{
|
||||
event_->attlist_.script_event_name_ = L"dom:click";
|
||||
event_->attlist_.presentation_action_ = L"sound";
|
||||
event_->attlist_.script_event_name_ = L"dom:click";
|
||||
|
||||
if (!event_->attlist_.presentation_action_)
|
||||
event_->attlist_.presentation_action_ = L"sound";
|
||||
}
|
||||
|
||||
office_element_ptr elm;
|
||||
@ -2472,7 +2511,7 @@ void odf_drawing_context::add_sound(std::wstring href)
|
||||
{
|
||||
sound->common_xlink_attlist_.href_ = href;
|
||||
sound->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
sound->common_xlink_attlist_.show_ = xlink_show::New;
|
||||
sound->common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
sound->common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
|
||||
}
|
||||
end_element();
|
||||
@ -2602,6 +2641,36 @@ void odf_drawing_context::end_object()
|
||||
|
||||
end_frame();
|
||||
}
|
||||
void odf_drawing_context::start_object_ole(std::wstring ref)
|
||||
{
|
||||
start_frame();
|
||||
|
||||
office_element_ptr object_elm;
|
||||
create_element(L"draw", L"object-ole", object_elm, impl_->odf_context_);
|
||||
|
||||
draw_object_ole* object = dynamic_cast<draw_object_ole*>(object_elm.get());
|
||||
if (object == NULL)return;
|
||||
|
||||
object->common_xlink_attlist_.href_ = ref;
|
||||
object->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
object->common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
object->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
|
||||
|
||||
start_element(object_elm);
|
||||
}
|
||||
void odf_drawing_context::end_object_ole()
|
||||
{
|
||||
end_element();
|
||||
|
||||
add_image_replacement();
|
||||
|
||||
end_frame();
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_image_replacement(std::wstring ref)
|
||||
{
|
||||
impl_->current_drawing_state_.replacement_ = ref;
|
||||
}
|
||||
|
||||
bool odf_drawing_context::is_exist_content()
|
||||
{
|
||||
|
||||
@ -141,12 +141,18 @@ public:
|
||||
void set_text_box_tableframe (bool val);
|
||||
void end_text_box ();
|
||||
|
||||
void start_object(std::wstring name);
|
||||
void start_object(std::wstring ref); //формулы, диаграммы ...
|
||||
void end_object();
|
||||
|
||||
void start_media(std::wstring name);
|
||||
void start_object_ole(std::wstring ref);
|
||||
void end_object_ole();
|
||||
|
||||
void start_media(std::wstring ref);
|
||||
void end_media();
|
||||
|
||||
void add_image_replacement();
|
||||
void set_image_replacement(std::wstring ref);
|
||||
|
||||
bool isLineShape();
|
||||
void corrected_line_fill();
|
||||
|
||||
|
||||
@ -84,6 +84,12 @@ void odp_page_state::set_page_name(std::wstring name)
|
||||
// master_page->attlist_.style_display_name_ = name;
|
||||
}
|
||||
}
|
||||
void odp_page_state::set_page_duration(int id)
|
||||
{
|
||||
if (!page_properties_) return;
|
||||
|
||||
page_properties_->content_.presentation_page_duration_ = id;
|
||||
}
|
||||
|
||||
void odp_page_state::set_layout_page(std::wstring name)
|
||||
{
|
||||
@ -167,7 +173,7 @@ void odp_page_state::set_anim_type(std::wstring val)
|
||||
anim_levels.back().attlist->presentation_node_type_ = L"timing-root";
|
||||
if (transactions.empty() == false)
|
||||
{
|
||||
std::wstring slide_id = L"slide_id" + std::to_wstring(page_id_);
|
||||
std::wstring slide_id = L"slide" + std::to_wstring(page_id_) + L"id";
|
||||
|
||||
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
|
||||
if (page)
|
||||
@ -224,6 +230,14 @@ void odp_page_state::set_transition_subtype(std::wstring val)
|
||||
if (trans)
|
||||
trans->filter_attlist_.smil_subtype_ = val;
|
||||
}
|
||||
void odp_page_state::set_transition_direction(std::wstring val)
|
||||
{
|
||||
if (transactions.empty()) return;
|
||||
|
||||
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
|
||||
if (trans)
|
||||
trans->common_attlist_.smil_direction_ = val;
|
||||
}
|
||||
void odp_page_state::set_transition_speed(int val)
|
||||
{
|
||||
if (transactions.empty()) return;
|
||||
@ -284,7 +298,7 @@ void odp_page_state::set_transition_sound(std::wstring ref, bool loop)
|
||||
{
|
||||
sound->common_xlink_attlist_.href_ = ref;
|
||||
sound->common_xlink_attlist_.type_ = xlink_type::Simple;
|
||||
sound->common_xlink_attlist_.show_ = xlink_show::New;
|
||||
sound->common_xlink_attlist_.show_ = xlink_show::Embed;
|
||||
sound->common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,9 +70,10 @@ class odp_page_state
|
||||
{
|
||||
public:
|
||||
odp_page_state(odf_conversion_context * Context, office_element_ptr & elm);
|
||||
void set_page_name (std::wstring name);
|
||||
void set_page_id (int id);
|
||||
void set_page_style (office_element_ptr & _style);
|
||||
void set_page_name (std::wstring name);
|
||||
void set_page_id (int id);
|
||||
void set_page_style (office_element_ptr & _style);
|
||||
void set_page_duration (int id);
|
||||
|
||||
void set_master_page(std::wstring name);
|
||||
void set_layout_page(std::wstring name);
|
||||
@ -107,6 +108,7 @@ public:
|
||||
void start_transition();
|
||||
void set_transition_type (int val);
|
||||
void set_transition_subtype (std::wstring val);
|
||||
void set_transition_direction(std::wstring val);
|
||||
void set_transition_speed (int val);
|
||||
void set_transition_duration(int val);
|
||||
void set_transition_sound (std::wstring ref, bool loop);
|
||||
|
||||
@ -119,7 +119,7 @@ public:
|
||||
_CP_OPT(bool) presentation_display_page_number_;
|
||||
_CP_OPT(bool) presentation_display_date_time_;
|
||||
_CP_OPT(bool) presentation_display_header_;
|
||||
_CP_OPT(std::wstring) presentation_page_duration_;
|
||||
_CP_OPT(odf_types::clockvalue) presentation_page_duration_;
|
||||
|
||||
office_element_ptr presentation_sound_;
|
||||
|
||||
|
||||
@ -203,33 +203,7 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
if (oox_picture->nvPicPr.nvPr.media.is_init())
|
||||
{
|
||||
if (oox_picture->nvPicPr.nvPr.media.is<PPTX::Logic::MediaFile>())
|
||||
{
|
||||
PPTX::Logic::MediaFile & media = oox_picture->nvPicPr.nvPr.media.as<PPTX::Logic::MediaFile>();
|
||||
|
||||
std::wstring sID = media.link.get();
|
||||
std::wstring pathMedia = find_link_by_id(sID, 3);
|
||||
|
||||
std::wstring odf_ref = odf_context()->add_media(pathMedia);
|
||||
|
||||
if (!odf_ref.empty())
|
||||
{
|
||||
odf_context()->drawing_context()->start_media(odf_ref);
|
||||
//... params
|
||||
|
||||
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
|
||||
OoxConverter::convert(&oox_picture->spPr, oox_picture->style.GetPointer());
|
||||
|
||||
odf_context()->drawing_context()->end_media();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
std::wstring odf_ref;
|
||||
std::wstring odf_ref_image;
|
||||
std::wstring pathImage;
|
||||
if (oox_picture->blipFill.blip.IsInit())
|
||||
{
|
||||
@ -239,15 +213,68 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
|
||||
std::wstring sID = oox_picture->blipFill.blip->embed->get();
|
||||
pathImage = find_link_by_id(sID, 1);
|
||||
|
||||
odf_ref = odf_context()->add_image(pathImage);
|
||||
odf_ref_image = odf_context()->add_image(pathImage);
|
||||
}
|
||||
else if (oox_picture->blipFill.blip->link.IsInit())
|
||||
{
|
||||
odf_ref = oox_picture->blipFill.blip->link->get();
|
||||
odf_ref_image = oox_picture->blipFill.blip->link->get();
|
||||
bEmbedded = false;
|
||||
}
|
||||
}
|
||||
odf_context()->drawing_context()->start_image(odf_ref);
|
||||
//--------------------------------------------------------------------------------------
|
||||
if (oox_picture->nvPicPr.nvPr.media.is_init())
|
||||
{
|
||||
if (oox_picture->nvPicPr.nvPr.media.is<PPTX::Logic::MediaFile>())
|
||||
{
|
||||
PPTX::Logic::MediaFile & media = oox_picture->nvPicPr.nvPr.media.as<PPTX::Logic::MediaFile>();
|
||||
|
||||
std::wstring sID = media.link.get();
|
||||
std::wstring pathMedia = find_link_by_id(sID, 3);
|
||||
|
||||
double start = -1, end = -1;
|
||||
|
||||
for (size_t i = 0; i < oox_picture->nvPicPr.nvPr.extLst.size(); i++)
|
||||
{
|
||||
PPTX::Logic::Ext & ext = oox_picture->nvPicPr.nvPr.extLst[i];
|
||||
if (pathMedia.empty() && ext.link.IsInit())
|
||||
{
|
||||
pathMedia= find_link_by_id(ext.link->get(), 3);
|
||||
//например файлики mp3
|
||||
}
|
||||
if (ext.st.IsInit()) start = *ext.st;
|
||||
if (ext.end.IsInit()) end = *ext.end;
|
||||
}
|
||||
|
||||
std::wstring odf_ref_media = odf_context()->add_media(pathMedia);
|
||||
|
||||
if (!odf_ref_media.empty())
|
||||
{
|
||||
odf_context()->drawing_context()->start_media(odf_ref_media);
|
||||
//... params
|
||||
|
||||
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
|
||||
OoxConverter::convert(&oox_picture->spPr, oox_picture->style.GetPointer());
|
||||
|
||||
odf_context()->drawing_context()->set_image_replacement(odf_ref_image);
|
||||
|
||||
odf_context()->drawing_context()->end_media();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oox_picture->oleObject.IsInit())
|
||||
{
|
||||
//nullable_limit<Limit::OLEDrawAspectType>m_oDrawAspect;
|
||||
//nullable<OOX::RId> m_oId;
|
||||
//nullable_string m_sObjectId;
|
||||
//nullable_string m_sProgId;
|
||||
//nullable_string m_sShapeId;
|
||||
//nullable_limit<Limit::OLEType> m_oType;
|
||||
//nullable_limit<Limit::OLEUpdateMode> m_oUpdateMode;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
odf_context()->drawing_context()->start_image(odf_ref_image);
|
||||
{
|
||||
double Width = 0, Height = 0;
|
||||
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
|
||||
@ -575,17 +602,24 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
|
||||
|
||||
bool bLine = odf_context()->drawing_context()->isLineShape();
|
||||
|
||||
if (!bLine)
|
||||
if (custGeom && !custGeom->cxnLst.empty())
|
||||
bLine = true;
|
||||
|
||||
odf_context()->drawing_context()->start_area_properties();
|
||||
{
|
||||
odf_context()->drawing_context()->start_area_properties();
|
||||
if (bLine)
|
||||
{
|
||||
odf_context()->drawing_context()->set_no_fill();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oox_spPr->Fill.is_init())
|
||||
convert(&oox_spPr->Fill);
|
||||
else if (oox_sp_style)
|
||||
convert(&oox_sp_style->fillRef, 1);
|
||||
}
|
||||
odf_context()->drawing_context()->end_area_properties();
|
||||
}
|
||||
odf_context()->drawing_context()->end_area_properties();
|
||||
|
||||
odf_context()->drawing_context()->start_line_properties();
|
||||
{
|
||||
|
||||
@ -311,21 +311,24 @@ std::wstring OoxConverter::find_link_by (smart_ptr<OOX::File> & oFile, int type)
|
||||
std::wstring ref;
|
||||
if (type == 1 && OOX::FileTypes::Image == oFile->type())
|
||||
{
|
||||
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
|
||||
OOX::Image* pImage = dynamic_cast<OOX::Image*>(oFile.operator->());
|
||||
|
||||
ref = pImage->filename().GetPath();
|
||||
if (pImage)
|
||||
ref = pImage->filename().GetPath();
|
||||
}
|
||||
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
|
||||
{
|
||||
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
|
||||
if (pHyperlink->bHyperlink)
|
||||
OOX::HyperLink* pHyperlink = dynamic_cast<OOX::HyperLink*>(oFile.operator->());
|
||||
|
||||
if (pHyperlink && pHyperlink->bHyperlink)
|
||||
ref = pHyperlink->Uri().GetPath();
|
||||
}
|
||||
if (type == 3)
|
||||
{
|
||||
OOX::Media* pMedia = (OOX::Media*)oFile.operator->();
|
||||
OOX::Media* pMedia = dynamic_cast<OOX::Media*>(oFile.operator->());
|
||||
|
||||
ref = pMedia->filename().GetPath();
|
||||
if (pMedia)
|
||||
ref = pMedia->filename().GetPath();
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
@ -72,6 +72,7 @@ using namespace cpdoccore;
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
|
||||
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
|
||||
{
|
||||
current_clrMap = NULL;
|
||||
@ -342,7 +343,7 @@ void PptxConverter::convert_slides()
|
||||
current_slide = slide->Master.operator->();
|
||||
|
||||
if (bShowLayoutMasterSp && bShowMasterSp)
|
||||
convert_slide(&slide->Master->cSld, current_txStyles, false, true, 2);
|
||||
convert_slide(&slide->Master->cSld, current_txStyles, false, true, Master);
|
||||
else
|
||||
convert(slide->Master->cSld.bg.GetPointer());
|
||||
|
||||
@ -350,7 +351,7 @@ void PptxConverter::convert_slides()
|
||||
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
|
||||
current_slide = slide->Layout.operator->();
|
||||
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, 3);
|
||||
convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp, Layout);
|
||||
|
||||
if (slide->Layout->transition.IsInit()) convert (slide->Layout->transition.GetPointer());
|
||||
else convert (slide->Master->transition.GetPointer());
|
||||
@ -402,7 +403,7 @@ void PptxConverter::convert_slides()
|
||||
odp_context->current_slide().set_master_page (master_style_name);
|
||||
odp_context->current_slide().set_layout_page (layout_style_name);
|
||||
|
||||
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, 1);
|
||||
convert_slide (slide->cSld.GetPointer(), current_txStyles, true, bShowMasterSp, Slide);
|
||||
convert (slide->comments.operator->());
|
||||
convert (slide->Note.operator->());
|
||||
|
||||
@ -435,7 +436,7 @@ void PptxConverter::convert(PPTX::NotesMaster *oox_notes)
|
||||
|
||||
odf_context()->page_layout_context()->set_page_size(width, height);
|
||||
}
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, 2);
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, NotesMaster);
|
||||
|
||||
odp_context->end_note();
|
||||
|
||||
@ -468,7 +469,7 @@ void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
|
||||
if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
|
||||
current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
|
||||
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, 1);
|
||||
convert_slide(&oox_notes->cSld, NULL, true, true, Notes);
|
||||
|
||||
odp_context->end_note();
|
||||
|
||||
@ -544,14 +545,24 @@ void PptxConverter::convert(PPTX::Comments *oox_comments)
|
||||
void PptxConverter::convert( PPTX::Logic::Transition *oox_transition )
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
if (oox_transition->base.is_init() == false) return;
|
||||
|
||||
if (oox_transition->advTm.is_init())
|
||||
{
|
||||
odp_context->current_slide().set_page_duration(*oox_transition->dur);
|
||||
}
|
||||
|
||||
if (oox_transition->base.is_init() == false) return;
|
||||
|
||||
odp_context->current_slide().start_transition();
|
||||
if (oox_transition->spd.is_init())
|
||||
{
|
||||
odp_context->current_slide().set_transition_speed(oox_transition->spd->GetBYTECode());
|
||||
}
|
||||
if (oox_transition->dur.is_init())
|
||||
{
|
||||
odp_context->current_slide().set_transition_duration(*oox_transition->dur);
|
||||
|
||||
}
|
||||
|
||||
convert(oox_transition->base.base.operator->());
|
||||
|
||||
if (oox_transition->sndAc.is_init() && oox_transition->sndAc->stSnd.is_init())
|
||||
@ -606,27 +617,52 @@ void PptxConverter::convert(PPTX::Logic::EmptyTransition *oox_transition)
|
||||
|
||||
if (oox_transition->name == L"random")
|
||||
odp_context->current_slide().set_transition_type(40);
|
||||
if (oox_transition->name == L"circle")
|
||||
else if (oox_transition->name == L"circle")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(16);
|
||||
odp_context->current_slide().set_transition_subtype(L"circle");
|
||||
}
|
||||
if (oox_transition->name == L"dissolve")
|
||||
else if (oox_transition->name == L"dissolve")
|
||||
odp_context->current_slide().set_transition_type(39);
|
||||
if (oox_transition->name == L"diamond")
|
||||
else if (oox_transition->name == L"diamond")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(11);
|
||||
odp_context->current_slide().set_transition_subtype(L"diamond");
|
||||
}
|
||||
if (oox_transition->name == L"newsflash")
|
||||
odp_context->current_slide().set_transition_type(24);
|
||||
if (oox_transition->name == L"plus")
|
||||
else if (oox_transition->name == L"newsflash")
|
||||
odp_context->current_slide().set_transition_type(24); //fanWipe
|
||||
else if (oox_transition->name == L"plus")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(19);
|
||||
odp_context->current_slide().set_transition_type(19); //starWipe
|
||||
odp_context->current_slide().set_transition_subtype(L"fourPoint");
|
||||
}
|
||||
if (oox_transition->name == L"wedge")
|
||||
odp_context->current_slide().set_transition_type(24);
|
||||
else if (oox_transition->name == L"wedge")
|
||||
odp_context->current_slide().set_transition_type(24); //fanWipe
|
||||
else if (oox_transition->name == L"vortex")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(20); //miscShapeWipe
|
||||
odp_context->current_slide().set_transition_subtype(L"vertical");
|
||||
}
|
||||
else if (oox_transition->name == L"doors")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(0); //barWipe
|
||||
odp_context->current_slide().set_transition_subtype(L"topToBottom");
|
||||
odp_context->current_slide().set_transition_direction(L"reverse");
|
||||
}
|
||||
else if (oox_transition->name == L"prism")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(20); //miscShapeWipe
|
||||
odp_context->current_slide().set_transition_subtype(L"cornersOut");
|
||||
}
|
||||
else if (oox_transition->name == L"switch")
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(20); //miscShapeWipe
|
||||
odp_context->current_slide().set_transition_subtype(L"topToBottom");
|
||||
}
|
||||
else
|
||||
{
|
||||
odp_context->current_slide().set_transition_type(36); //fade
|
||||
}
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::OrientationTransition *oox_transition)
|
||||
{
|
||||
@ -742,7 +778,8 @@ void PptxConverter::convert(PPTX::Logic::SplitTransition *oox_transition)
|
||||
{
|
||||
if (!oox_transition) return;
|
||||
//name == split
|
||||
odp_context->current_slide().set_transition_type(8);
|
||||
odp_context->current_slide().set_transition_type(3);
|
||||
odp_context->current_slide().set_transition_subtype(L"vertical");
|
||||
}
|
||||
void PptxConverter::convert(PPTX::Logic::ZoomTransition *oox_transition)
|
||||
{
|
||||
@ -1276,13 +1313,19 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
|
||||
}
|
||||
odf_writer::style* page_style_ = dynamic_cast<odf_writer::style*>(odp_context->current_slide().page_style_elm_.get());
|
||||
odf_writer::style_drawing_page_properties* page_props = page_style_->content_.get_style_drawing_page_properties();
|
||||
|
||||
//необязательно
|
||||
//if (page_props->content_.common_draw_fill_attlist_.draw_fill_image_name_)
|
||||
//{
|
||||
// page_props->content_.draw_background_size_ = L"border";
|
||||
//}
|
||||
|
||||
odp_context->drawing_context()->end_drawing_background(page_props->content_.common_draw_fill_attlist_);
|
||||
|
||||
odp_context->end_drawings();
|
||||
}
|
||||
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type)
|
||||
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type)
|
||||
{
|
||||
if (oox_slide == NULL) return;
|
||||
|
||||
@ -1292,7 +1335,10 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
|
||||
if (oox_slide->attrName.IsInit())
|
||||
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
|
||||
|
||||
convert(oox_slide->bg.GetPointer());
|
||||
if (type != Notes && type != NotesMaster)
|
||||
{
|
||||
convert(oox_slide->bg.GetPointer());
|
||||
}
|
||||
|
||||
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
|
||||
{
|
||||
@ -1312,7 +1358,7 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
|
||||
{
|
||||
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
|
||||
|
||||
if (type == 3 && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
|
||||
if (type == Layout && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
|
||||
continue;
|
||||
|
||||
odf_context()->drawing_context()->set_placeholder_type(ph_type);
|
||||
|
||||
@ -100,6 +100,14 @@ using namespace cpdoccore;
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
enum _typePages
|
||||
{
|
||||
Slide,
|
||||
Master,
|
||||
Layout,
|
||||
NotesMaster,
|
||||
Notes
|
||||
};
|
||||
class PptxConverter : public OoxConverter
|
||||
{
|
||||
public:
|
||||
@ -119,7 +127,7 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::WritingElement *oox_unknown);
|
||||
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, int type);
|
||||
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp, _typePages type);
|
||||
void convert_layout (PPTX::Logic::CSld *oox_slide);
|
||||
void convert (PPTX::Comments *oox_comments);
|
||||
void convert (PPTX::NotesSlide *oox_notes);
|
||||
|
||||
@ -158,7 +158,6 @@ HEADERS += \
|
||||
../PPTXWriter/ShapeWriter.h \
|
||||
../PPTXWriter/StylesWriter.h \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/Element.h \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/ElementProperties.h \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/Elements.h \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/Layout.h \
|
||||
../../../ASCOfficePPTXFile/Editor/Drawing/Slide.h \
|
||||
|
||||
@ -196,6 +196,15 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
|
||||
<Default Extension=\"xml\" ContentType=\"application/xml\" />\
|
||||
<Default Extension=\"gif\" ContentType=\"image/gif\"/>\
|
||||
<Default Extension=\"emf\" ContentType=\"image/x-emf\"/>\
|
||||
<Default Extension=\"wav\" ContentType=\"audio/wav\"/>\
|
||||
<Default Extension=\"wma\" ContentType=\"audio/x-ms-wma\"/>\
|
||||
<Default Extension=\"mp3\" ContentType=\"audio/unknown\"/>\
|
||||
<Default Extension=\"m4a\" ContentType=\"audio/unknown\"/>\
|
||||
<Default Extension=\"wmv\" ContentType=\"video/x-ms-wmv\"/>\
|
||||
<Default Extension=\"avi\" ContentType=\"video/avi\"/>\
|
||||
<Default Extension=\"m4v\" ContentType=\"video/unknown\"/>\
|
||||
<Default Extension=\"mp4\" ContentType=\"video/unknown\"/>\
|
||||
<Default Extension=\"mov\" ContentType=\"video/unknown\"/>\
|
||||
<Default Extension=\"xls\" ContentType=\"application/vnd.ms-excel\"/>\
|
||||
<Default Extension=\"xlsx\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"/>\
|
||||
<Default Extension=\"bin\" ContentType=\"application/vnd.openxmlformats-officedocument.oleObject\" />\
|
||||
@ -770,25 +779,14 @@ void NSPresentationEditor::CPPTXWriter::WriteBackground(CStringWriter& oWriter,
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteElement(CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout)
|
||||
{
|
||||
CImageElement* pImageElem = dynamic_cast<CImageElement*>(pElement);
|
||||
if (pImageElem)
|
||||
{
|
||||
pImageElem->m_oMetric = m_pDocument->m_oInfo;
|
||||
pImageElem->NormalizeCoordsByMetric();
|
||||
if (!pElement) return;
|
||||
|
||||
m_pShapeWriter->SetShape(pImageElem);
|
||||
}
|
||||
pElement->m_oMetric = m_pDocument->m_oInfo;
|
||||
pElement->NormalizeCoordsByMetric();
|
||||
|
||||
CShapeElement* pShapeElem = dynamic_cast<CShapeElement*>(pElement);
|
||||
if (pShapeElem)
|
||||
{
|
||||
pShapeElem->m_oMetric = m_pDocument->m_oInfo;
|
||||
pShapeElem->NormalizeCoordsByMetric();
|
||||
bool bObject = m_pShapeWriter->SetElement(pElement);
|
||||
|
||||
m_pShapeWriter->SetShape(pShapeElem);
|
||||
}
|
||||
|
||||
if (pImageElem || pShapeElem)
|
||||
if (bObject)
|
||||
{
|
||||
m_pShapeWriter->SetRelsGenerator(&oRels);
|
||||
|
||||
@ -920,7 +918,11 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide)
|
||||
oWriter.WriteString(std::wstring(L"</p:spTree></p:cSld>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>"));
|
||||
|
||||
WriteTransition(oWriter, pSlide->m_oSlideShow.m_oTransition);
|
||||
|
||||
oWriter.WriteString(std::wstring(L"<p:timing><p:tnLst><p:par><p:cTn id=\"1\" dur=\"indefinite\" restart=\"never\" nodeType=\"tmRoot\" /></p:par></p:tnLst></p:timing>"));
|
||||
|
||||
oWriter.WriteString(std::wstring(L"</p:sld>"));
|
||||
|
||||
oRels.CloseRels();
|
||||
@ -937,6 +939,193 @@ void NSPresentationEditor::CPPTXWriter::WriteSlide(int nIndexSlide)
|
||||
strFile = L"slide" + std::to_wstring(nIndexSlide + 1) + L".xml.rels";
|
||||
oRels.SaveRels(strFileSlidePath + _T("_rels") + FILE_SEPARATOR_STR + strFile);
|
||||
}
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteTransition(CStringWriter& oWriter, CTransition& transition)
|
||||
{
|
||||
if (!transition.m_nEffectType == 0xFF) return;
|
||||
|
||||
std::wstring type;
|
||||
|
||||
std::wstring param_name, param_value;
|
||||
std::wstring param_name2, param_value2;
|
||||
|
||||
switch(transition.m_nEffectType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
type = L"p:cut";
|
||||
param_name = L"thruBlk";
|
||||
param_value = transition.m_nEffectDirection ? L"true" : L"false";
|
||||
}break;
|
||||
case 1:
|
||||
{
|
||||
type = L"p:random";
|
||||
}break;
|
||||
case 2:
|
||||
{
|
||||
type = L"p:blinds";
|
||||
param_name = L"dir";
|
||||
param_value = transition.m_nEffectDirection ? L"vert" : L"horz";
|
||||
}break;
|
||||
case 3:
|
||||
{
|
||||
type = L"p:checker";
|
||||
param_name = L"dir";
|
||||
param_value = transition.m_nEffectDirection ? L"vert" : L"horz";
|
||||
}break;
|
||||
case 5:
|
||||
{
|
||||
type = L"p:dissolve";
|
||||
param_name = L"thruBlk";
|
||||
param_value = transition.m_nEffectDirection ? L"true" : L"false";
|
||||
}break;
|
||||
case 6:
|
||||
{
|
||||
type = L"p:fade";
|
||||
param_name = L"thruBlk";
|
||||
param_value = transition.m_nEffectDirection ? L"true" : L"false";
|
||||
}break;
|
||||
case 4:
|
||||
case 7:
|
||||
{
|
||||
if (transition.m_nEffectType == 4) type = L"p:cover";
|
||||
if (transition.m_nEffectType == 7) type = L"p:pull";
|
||||
param_name = L"dir";
|
||||
switch(transition.m_nEffectDirection)
|
||||
{
|
||||
case 0: param_value = L"r"; break;
|
||||
case 1: param_value = L"b"; break;
|
||||
case 2: param_value = L"l"; break;
|
||||
case 3: param_value = L"t"; break;
|
||||
case 4: param_value = L"br"; break;
|
||||
case 5: param_value = L"bl"; break;
|
||||
case 6: param_value = L"tr"; break;
|
||||
case 7: param_value = L"tl"; break;
|
||||
}
|
||||
}break;
|
||||
case 8:
|
||||
{
|
||||
type = L"p:randomBars";
|
||||
param_name = L"dir";
|
||||
param_value = transition.m_nEffectDirection ? L"vert" : L"horz";
|
||||
}break;
|
||||
case 9:
|
||||
{
|
||||
type = L"p:strips";
|
||||
param_name = L"dir";
|
||||
switch(transition.m_nEffectDirection)
|
||||
{
|
||||
case 0: param_value = L"ru"; break;
|
||||
case 1: param_value = L"lu"; break;
|
||||
case 2: param_value = L"rd"; break;
|
||||
case 3: param_value = L"ld"; break;
|
||||
}
|
||||
}break;
|
||||
case 10:
|
||||
case 20:
|
||||
{
|
||||
if (transition.m_nEffectType == 10) type = L"p:wipe";
|
||||
if (transition.m_nEffectType == 20) type = L"p:push";
|
||||
|
||||
param_name = L"dir";
|
||||
switch(transition.m_nEffectDirection)
|
||||
{
|
||||
case 0: param_value = L"l"; break;
|
||||
case 1: param_value = L"u"; break;
|
||||
case 2: param_value = L"r"; break;
|
||||
case 3: param_value = L"d"; break;
|
||||
}
|
||||
}break;
|
||||
case 11:
|
||||
{
|
||||
type = L"p:zoom";
|
||||
param_name = L"dir";
|
||||
param_value = transition.m_nEffectDirection ? L"in" : L"out";
|
||||
}break;
|
||||
case 13:
|
||||
{
|
||||
type = L"p:split";
|
||||
param_name = L"dir";
|
||||
param_name2 = L"orient";
|
||||
switch(transition.m_nEffectDirection)
|
||||
{
|
||||
case 0: param_value = L"horz"; param_value2 = L"out"; break;
|
||||
case 1: param_value = L"horz"; param_value2 = L"in"; break;
|
||||
case 2: param_value = L"vert"; param_value2 = L"out"; break;
|
||||
case 3: param_value = L"vert"; param_value2 = L"in"; break;
|
||||
}
|
||||
}break;
|
||||
case 17:
|
||||
{
|
||||
type = L"p:diamond";
|
||||
}break;
|
||||
case 18:
|
||||
{
|
||||
type = L"p:plus";
|
||||
}break;
|
||||
case 19:
|
||||
{
|
||||
type = L"p:wedge";
|
||||
}break;
|
||||
|
||||
case 21:
|
||||
{
|
||||
type = L"p:comb";
|
||||
param_name = L"dir";
|
||||
param_value = transition.m_nEffectDirection ? L"vert" : L"horz";
|
||||
}break;
|
||||
case 22:
|
||||
{
|
||||
type = L"p:newsflash";
|
||||
}break;
|
||||
case 23:
|
||||
{
|
||||
type = L"p:alphaFade";
|
||||
}break;
|
||||
case 26:
|
||||
{
|
||||
type = L"p:wheel";
|
||||
param_name = L"spokes";
|
||||
param_value = std::to_wstring(transition.m_nEffectDirection);
|
||||
}break;
|
||||
case 27:
|
||||
{
|
||||
type = L"p:circle";
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (type.empty()) return;
|
||||
oWriter.WriteString(std::wstring(L"<p:transition"));
|
||||
switch (transition.m_nSpeed)
|
||||
{
|
||||
case 0x00: oWriter.WriteString(L" spd=\"fast\""); break;
|
||||
case 0x01: oWriter.WriteString(L" spd=\"med\""); break;
|
||||
case 0x02:
|
||||
default: oWriter.WriteString(L" spd=\"slow\""); break;
|
||||
}
|
||||
oWriter.WriteString(L">");
|
||||
oWriter.WriteString(L"<" + type);
|
||||
if (!param_name.empty() && !param_value.empty())
|
||||
{
|
||||
oWriter.WriteString(L" " + param_name + L"=\"" + param_value + L"\"");
|
||||
}
|
||||
if (!param_name2.empty() && !param_value2.empty())
|
||||
{
|
||||
oWriter.WriteString(L" " + param_name2 + L"=\"" + param_value2 + L"\"");
|
||||
}
|
||||
oWriter.WriteString(L"/>");
|
||||
if (transition.m_bAudioPresent)
|
||||
{
|
||||
std::wstring rId = m_pShapeWriter->m_pRels->WriteAudio(transition.m_oAudio.m_strAudioFileName);
|
||||
oWriter.WriteString(std::wstring(L"<p:sndAc><p:stSnd>"));
|
||||
oWriter.WriteString(L"<p:snd r:embed=\"" + rId + L"\" name=\"" + transition.m_oAudio.m_sImageName + L"\"/>");
|
||||
oWriter.WriteString(std::wstring(L"</p:stSnd></p:sndAc>"));
|
||||
}
|
||||
oWriter.WriteString(std::wstring(L"</p:transition>"));
|
||||
}
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteNotes(int nIndexNotes)
|
||||
{
|
||||
CStringWriter oWriter;
|
||||
|
||||
@ -50,7 +50,7 @@ namespace NSPresentationEditor
|
||||
|
||||
CDocument * m_pDocument;
|
||||
CPPTUserInfo* m_pUserInfo;
|
||||
CImageManager m_oManager;
|
||||
CMediaManager m_oManager;
|
||||
|
||||
CShapeWriter* m_pShapeWriter;
|
||||
|
||||
@ -79,6 +79,7 @@ namespace NSPresentationEditor
|
||||
void WriteSlide (int nIndexSlide);
|
||||
void WriteNotes (int nIndexNotes);
|
||||
|
||||
void WriteTransition (CStringWriter& oWriter, CTransition& transition);
|
||||
void WriteColorScheme (CStringWriter& oWriter, const std::wstring & name, const std::vector<CColor> & colors, bool extra = false);
|
||||
void WriteBackground (CStringWriter& oWriter, CRelsGenerator& oRels, CBrush& oBackground);
|
||||
void WriteElement (CStringWriter& oWriter, CRelsGenerator& oRels, IElement* pElement, CLayout* pLayout = NULL);
|
||||
|
||||
@ -37,56 +37,95 @@
|
||||
|
||||
namespace NSPresentationEditor
|
||||
{
|
||||
class CImageManager
|
||||
class CMediaManager
|
||||
{
|
||||
private:
|
||||
std::map<std::wstring, std::wstring> m_mapImages;
|
||||
std::map<std::wstring, std::wstring> m_mapMedia;
|
||||
|
||||
long m_lIndexNextAudio;
|
||||
long m_lIndexNextVideo;
|
||||
long m_lIndexNextImage;
|
||||
|
||||
long m_lIndexNextImage;
|
||||
std::wstring m_strDstMedia;
|
||||
|
||||
public:
|
||||
CImageManager() : m_lIndexNextImage(0)
|
||||
CMediaManager() : m_lIndexNextImage(0), m_lIndexNextAudio(0), m_lIndexNextVideo(0)
|
||||
{
|
||||
}
|
||||
~CImageManager()
|
||||
~CMediaManager()
|
||||
{
|
||||
}
|
||||
inline void Clear()
|
||||
{
|
||||
m_mapImages.clear();
|
||||
m_mapMedia.clear();
|
||||
|
||||
m_lIndexNextImage = 0;
|
||||
m_lIndexNextAudio = 0;
|
||||
m_lIndexNextVideo = 0;
|
||||
}
|
||||
inline std::wstring FindMedia(const std::wstring& strInput)
|
||||
{
|
||||
std::map<std::wstring, std::wstring>::iterator pPair = m_mapMedia.find(strInput);
|
||||
if (m_mapMedia.end() != pPair)
|
||||
{
|
||||
return pPair->second;
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
inline void SetDstMedia(const std::wstring& strDst)
|
||||
{
|
||||
m_strDstMedia = strDst;
|
||||
}
|
||||
|
||||
public:
|
||||
inline std::wstring GenerateImage(const std::wstring& strInput)
|
||||
inline std::wstring GenerateVideo(const std::wstring& strInput)
|
||||
{
|
||||
std::map<std::wstring, std::wstring>::iterator pPair = m_mapImages.find(strInput);
|
||||
if (m_mapImages.end() != pPair)
|
||||
return GenerateMedia(strInput, L"video", m_lIndexNextVideo, L".avi");
|
||||
}
|
||||
inline std::wstring GenerateAudio(const std::wstring& strInput)
|
||||
{
|
||||
return GenerateMedia(strInput, L"audio", m_lIndexNextAudio, L".wav");
|
||||
}
|
||||
inline std::wstring GenerateImage(const std::wstring& strInput)
|
||||
{
|
||||
return GenerateMedia(strInput, L"image", m_lIndexNextImage, L".png");
|
||||
}
|
||||
inline std::wstring GenerateMedia(const std::wstring& strInput, const std::wstring& Template, long & Indexer, const std::wstring& strDefaultExt)
|
||||
{
|
||||
std::map<std::wstring, std::wstring>::iterator pPair = m_mapMedia.find(strInput);
|
||||
if (m_mapMedia.end() != pPair)
|
||||
{
|
||||
return pPair->second;
|
||||
}
|
||||
|
||||
if (IsNeedDownload(strInput))
|
||||
return DownloadImage(strInput);
|
||||
{
|
||||
#ifndef DISABLE_FILE_DOWNLOADER
|
||||
CFileDownloader oDownloader(strInput, TRUE);
|
||||
if ( oDownloader.DownloadSync() )
|
||||
{
|
||||
return GenerateMedia( oDownloader.GetFilePath(), Template, Indexer, strDefaultExt);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring strExts = _T(".jpg");
|
||||
int nIndexExt = strInput.rfind(wchar_t('.'));
|
||||
std::wstring strExts = strDefaultExt;
|
||||
int nIndexExt = strInput.rfind(wchar_t('.'));
|
||||
if (-1 != nIndexExt)
|
||||
strExts = strInput.substr(nIndexExt);
|
||||
|
||||
if (strExts == _T(".tmp")) strExts = _T(".png");
|
||||
if (strExts == _T(".video") || strExts == _T(".audio"))
|
||||
{
|
||||
std::wstring strInput1 = strInput.substr(0, nIndexExt);
|
||||
nIndexExt = strInput1.rfind(wchar_t('.'));
|
||||
strExts = nIndexExt < 0 ? L"" : strInput1.substr(nIndexExt);
|
||||
}
|
||||
if (strExts == _T(".tmp")) strExts = strDefaultExt;
|
||||
|
||||
std::wstring strImage = L"image" + std::to_wstring(m_lIndexNextImage++);
|
||||
std::wstring strMediaName = Template + std::to_wstring(++Indexer);
|
||||
|
||||
std::wstring strOutput = m_strDstMedia + strImage + strExts;
|
||||
strImage = _T("../media/") + strImage + strExts;
|
||||
std::wstring strOutput = m_strDstMedia + strMediaName + strExts;
|
||||
strMediaName = _T("../media/") + strMediaName + strExts;
|
||||
|
||||
// теперь нужно скопировать картинку
|
||||
// теперь нужно скопировать
|
||||
if (strOutput != strInput)
|
||||
{
|
||||
if (CDirectory::CopyFile(strInput, strOutput) == false)
|
||||
@ -94,8 +133,8 @@ namespace NSPresentationEditor
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
m_mapImages[strInput] = strImage;
|
||||
return strImage;
|
||||
m_mapMedia[strInput] = strMediaName;
|
||||
return strMediaName;
|
||||
}
|
||||
|
||||
inline bool IsNeedDownload(const std::wstring& strFile)
|
||||
@ -108,18 +147,8 @@ namespace NSPresentationEditor
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
inline std::wstring DownloadImage(const std::wstring& strFile)
|
||||
{
|
||||
#ifndef DISABLE_FILE_DOWNLOADER
|
||||
CFileDownloader oDownloader(strFile, TRUE);
|
||||
if ( oDownloader.DownloadSync() )
|
||||
{
|
||||
return GenerateImage( oDownloader.GetFilePath() );
|
||||
}
|
||||
#endif
|
||||
return _T("");
|
||||
}
|
||||
};
|
||||
|
||||
static std::wstring CorrectXmlString3(const std::wstring & str)
|
||||
{
|
||||
std::wstring buffer;
|
||||
@ -128,12 +157,12 @@ namespace NSPresentationEditor
|
||||
{
|
||||
switch(str[pos])
|
||||
{
|
||||
case '&': buffer.append(_T("&")); break;
|
||||
case '\"': buffer.append(_T(""")); break;
|
||||
case '\'': buffer.append(_T("'")); break;
|
||||
case '<': buffer.append(_T("<")); break;
|
||||
case '>': buffer.append(_T(">")); break;
|
||||
default: buffer.append(&str[pos], 1); break;
|
||||
case '&': buffer.append(_T("&")); break;
|
||||
case '\"': buffer.append(_T(""")); break;
|
||||
case '\'': buffer.append(_T("'")); break;
|
||||
case '<': buffer.append(_T("<")); break;
|
||||
case '>': buffer.append(_T(">")); break;
|
||||
default: buffer.append(&str[pos], 1); break;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
@ -143,12 +172,12 @@ namespace NSPresentationEditor
|
||||
private:
|
||||
NSPresentationEditor::CStringWriter m_oWriter;
|
||||
int m_lNextRelsID;
|
||||
std::map<std::wstring, int> m_mapImages;
|
||||
CImageManager* m_pManager;
|
||||
std::map<std::wstring, int> m_mapMediaRelsID;
|
||||
CMediaManager* m_pManager;
|
||||
std::map<std::wstring, std::wstring> m_mapHyperlinks;
|
||||
|
||||
public:
|
||||
CRelsGenerator(CImageManager* pManager) : m_oWriter(), m_lNextRelsID(1)
|
||||
CRelsGenerator(CMediaManager* pManager) : m_oWriter(), m_lNextRelsID(1)
|
||||
{
|
||||
m_pManager = pManager;
|
||||
}
|
||||
@ -159,7 +188,7 @@ namespace NSPresentationEditor
|
||||
{
|
||||
m_oWriter.ClearNoAttack();
|
||||
m_lNextRelsID = 1;
|
||||
m_mapImages.clear();
|
||||
m_mapMediaRelsID.clear();
|
||||
m_mapHyperlinks.clear();
|
||||
}
|
||||
|
||||
@ -262,23 +291,25 @@ namespace NSPresentationEditor
|
||||
return strRid;
|
||||
}
|
||||
|
||||
inline std::wstring WriteHyperlinkImage(const std::wstring& strImage, bool bExternal = true)
|
||||
inline std::wstring WriteHyperlinkMedia(const std::wstring& strMedia, bool bExternal = true, bool newRIdAlways = false, std::wstring strRelsType = L"http://schemas.microsoft.com/office/2007/relationships/media")
|
||||
{
|
||||
std::map<std::wstring, int>::iterator pPair = m_mapImages.find(strImage);
|
||||
|
||||
if (m_mapImages.end() != pPair)
|
||||
if (!newRIdAlways)
|
||||
{
|
||||
std::wstring strRid = L"rId" + std::to_wstring(pPair->second);
|
||||
return strRid;
|
||||
std::map<std::wstring, int>::iterator pPair = m_mapMediaRelsID.find(strMedia);
|
||||
|
||||
if (m_mapMediaRelsID.end() != pPair)
|
||||
{
|
||||
std::wstring strRid = L"rId" + std::to_wstring(pPair->second);
|
||||
return strRid;
|
||||
}
|
||||
|
||||
m_mapMediaRelsID[strMedia] = m_lNextRelsID;
|
||||
}
|
||||
|
||||
m_mapImages[strImage] = m_lNextRelsID;
|
||||
|
||||
std::wstring strRid = L"rId" + std::to_wstring(m_lNextRelsID++);
|
||||
std::wstring strRid = L"rId" + std::to_wstring(m_lNextRelsID++);
|
||||
|
||||
std::wstring strRels = L"<Relationship Id=\"" + strRid + L"\"";
|
||||
strRels += L" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\"";
|
||||
strRels += L" Target=\"" + strImage + L"\"";
|
||||
std::wstring strRels = L"<Relationship Id=\"" + strRid + L"\"" + L" Type=\"" + strRelsType + L"\""
|
||||
+ L" Target=\"" + strMedia + L"\"";
|
||||
|
||||
if (bExternal)
|
||||
strRels += L" TargetMode=\"External\"";
|
||||
@ -288,13 +319,45 @@ namespace NSPresentationEditor
|
||||
|
||||
return strRid;
|
||||
}
|
||||
inline std::wstring WriteImage(const std::wstring& strImagePath)
|
||||
inline std::wstring WriteHyperlinkImage(const std::wstring& strImage, bool bExternal = true)
|
||||
{
|
||||
return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image");
|
||||
}
|
||||
inline std::wstring WriteHyperlinkAudio(const std::wstring& strImage, bool bExternal = true)
|
||||
{
|
||||
return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio");
|
||||
}
|
||||
inline std::wstring WriteHyperlinkVideo(const std::wstring& strImage, bool bExternal = true)
|
||||
{
|
||||
return WriteHyperlinkMedia(strImage, bExternal, false, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video");
|
||||
}
|
||||
inline std::wstring WriteMedia(const std::wstring& strMediaPath)
|
||||
{
|
||||
std::wstring strMedia = m_pManager->FindMedia(strMediaPath);
|
||||
|
||||
if (strMedia.empty()) return WriteHyperlinkMedia(CorrectXmlString3(strMediaPath), true, true);
|
||||
return WriteHyperlinkMedia(strMedia, false, true);
|
||||
}
|
||||
inline std::wstring WriteImage(const std::wstring& strImagePath)
|
||||
{
|
||||
std::wstring strImage = m_pManager->GenerateImage(strImagePath);
|
||||
|
||||
if (strImage.empty()) return WriteHyperlinkImage(CorrectXmlString3(strImagePath), true);
|
||||
return WriteHyperlinkImage(strImage, false);
|
||||
if (strImage.empty()) return WriteHyperlinkImage(CorrectXmlString3(strImagePath), true);
|
||||
return WriteHyperlinkImage(strImage, false);
|
||||
}
|
||||
inline std::wstring WriteAudio(const std::wstring& strAudioPath)
|
||||
{
|
||||
std::wstring strAudio = m_pManager->GenerateAudio(strAudioPath);
|
||||
|
||||
if (strAudio.empty()) return WriteHyperlinkAudio(CorrectXmlString3(strAudioPath), true);
|
||||
return WriteHyperlinkAudio(strAudio, false);
|
||||
}
|
||||
inline std::wstring WriteVideo(const std::wstring& strVideoPath)
|
||||
{
|
||||
std::wstring strVideo = m_pManager->GenerateVideo(strVideoPath);
|
||||
|
||||
if (strVideo.empty()) return WriteHyperlinkVideo(CorrectXmlString3(strVideoPath), true);
|
||||
return WriteHyperlinkVideo(strVideo, false);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -293,6 +293,31 @@ NSPresentationEditor::CShapeWriter::CShapeWriter()
|
||||
m_pImageElement = NULL;
|
||||
m_pShapeElement = NULL;
|
||||
}
|
||||
bool NSPresentationEditor::CShapeWriter::SetElement(IElement* pElem)
|
||||
{
|
||||
m_pShapeElement = dynamic_cast<CShapeElement*>(pElem);
|
||||
m_pImageElement = dynamic_cast<CImageElement*>(pElem);
|
||||
|
||||
m_pSimpleGraphicsConverter->PathCommandEnd();
|
||||
|
||||
m_oMetricInfo = pElem->m_oMetric;
|
||||
m_oBounds = pElem->m_rcBounds;
|
||||
m_oTextRect = m_oBounds;
|
||||
|
||||
m_bWordArt = false;
|
||||
m_bTextBox = false;
|
||||
|
||||
if (m_pShapeElement)
|
||||
{
|
||||
m_pShapeElement->m_oShape.GetTextRect(m_oTextRect);
|
||||
}
|
||||
|
||||
m_oWriter.ClearNoAttack();
|
||||
m_oWriterPath.ClearNoAttack();
|
||||
m_oWriterVML.ClearNoAttack();
|
||||
|
||||
return (m_pShapeElement || m_pImageElement);
|
||||
}
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertLine(CPen & pen)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter line_writer;
|
||||
@ -366,7 +391,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertLineEnd(unsigned char ca
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter brush_writer;
|
||||
|
||||
@ -458,7 +483,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertBrush(CBrush & brush)
|
||||
return brush_writer.GetData();
|
||||
}
|
||||
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertShadow(CShadow & shadow)
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertShadow(CShadow & shadow)
|
||||
{
|
||||
std::wstring Preset;
|
||||
bool Inner = false;
|
||||
@ -575,7 +600,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertShadow(CShadow & shadow)
|
||||
return shadow_writer.GetData();
|
||||
}
|
||||
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertColor(CColor & color, long alpha)
|
||||
std::wstring NSPresentationEditor::CShapeWriter::ConvertColor(CColor & color, long alpha)
|
||||
{
|
||||
NSPresentationEditor::CStringWriter color_writer;
|
||||
if (color.m_lSchemeIndex == -1)
|
||||
@ -606,14 +631,24 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertColor(CColor & color, l
|
||||
}
|
||||
void NSPresentationEditor::CShapeWriter::WriteImageInfo()
|
||||
{
|
||||
CAudioElement* pAudioElement = dynamic_cast<CAudioElement*>(m_pImageElement);
|
||||
CVideoElement* pVideoElement = dynamic_cast<CVideoElement*>(m_pImageElement);
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"<p:nvPicPr>"));
|
||||
|
||||
std::wstring strShapeID = std::to_wstring(m_lNextShapeID);
|
||||
if (m_pImageElement->m_lID < 0)
|
||||
m_pImageElement->m_lID = m_lNextShapeID;
|
||||
|
||||
std::wstring strShapeID = std::to_wstring(m_pImageElement->m_lID);
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"<p:cNvPr id=\"") + strShapeID + L"\"" );
|
||||
|
||||
if (m_pImageElement->m_sName.empty())
|
||||
m_pImageElement->m_sName = std::wstring(L"Image ") + strShapeID;
|
||||
{
|
||||
if (pAudioElement) m_pImageElement->m_sName = std::wstring(L"Audio ") + strShapeID;
|
||||
else if (pVideoElement) m_pImageElement->m_sName = std::wstring(L"Video ") + strShapeID;
|
||||
else m_pImageElement->m_sName = std::wstring(L"Image ") + strShapeID;
|
||||
}
|
||||
|
||||
if (m_pImageElement->m_bHidden) m_oWriter.WriteString(std::wstring(L" hidden=\"1\""));
|
||||
|
||||
@ -627,14 +662,22 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
|
||||
// m_oWriter.WriteStringXML(m_pImageElement->m_sDescription);
|
||||
// m_oWriter.WriteString(std::wstring(L"\""));
|
||||
//}
|
||||
m_oWriter.WriteString(std::wstring(L">"));
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"></p:cNvPr><p:cNvPicPr><a:spLocks noGrp=\"1\" noChangeAspect=\"1\"/></p:cNvPicPr>"));
|
||||
if (pVideoElement || pAudioElement)
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L"<a:hlinkClick r:id=\"\" action=\"ppaction://media\"/>"));
|
||||
}
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"</p:cNvPr><p:cNvPicPr><a:picLocks noGrp=\"1\" noChangeAspect=\"1\"/></p:cNvPicPr>"));
|
||||
|
||||
++m_lNextShapeID;
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"<p:nvPr>"));
|
||||
|
||||
if (-1 != m_pImageElement->m_lPlaceholderType)
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L"<p:nvPr><p:ph"));
|
||||
m_oWriter.WriteString(std::wstring(L"<p:ph"));
|
||||
if (m_pImageElement->m_lPlaceholderType > 0)
|
||||
m_oWriter.WriteString(std::wstring(L" type=\"") + GetPhType(m_pImageElement->m_lPlaceholderType) + L"\"");
|
||||
|
||||
@ -644,12 +687,39 @@ void NSPresentationEditor::CShapeWriter::WriteImageInfo()
|
||||
m_oWriter.WriteString(std::wstring(L" idx=\"") + strIdx + L"\"");
|
||||
|
||||
}
|
||||
m_oWriter.WriteString(std::wstring(L"/></p:nvPr>"));
|
||||
m_oWriter.WriteString(std::wstring(L"/>"));
|
||||
}
|
||||
else
|
||||
|
||||
std::wstring sMediaFile;
|
||||
|
||||
if ((pVideoElement) && (!pVideoElement->m_strVideoFileName.empty()))
|
||||
{
|
||||
m_oWriter.WriteString(std::wstring(L"<p:nvPr/>"));
|
||||
std::wstring strRid = m_pRels->WriteVideo(pVideoElement->m_strVideoFileName);
|
||||
|
||||
m_oWriter.WriteString(L"<a:videoFile r:link=\"" + strRid + L"\"/>");
|
||||
|
||||
sMediaFile = pVideoElement->m_strVideoFileName;
|
||||
}
|
||||
|
||||
if ((pAudioElement) && (!pAudioElement->m_strAudioFileName.empty()))
|
||||
{
|
||||
std::wstring strRid = m_pRels->WriteAudio(pAudioElement->m_strAudioFileName);
|
||||
|
||||
m_oWriter.WriteString(L"<a:audioFile r:link=\"" + strRid + L"\"/>");
|
||||
|
||||
sMediaFile = pAudioElement->m_strAudioFileName;
|
||||
}
|
||||
if (sMediaFile.empty() == false)
|
||||
{
|
||||
std::wstring strRid = m_pRels->WriteMedia(sMediaFile);
|
||||
if (!strRid.empty())
|
||||
{
|
||||
m_oWriter.WriteString(L"<p:extLst><p:ext uri=\"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}\">\
|
||||
<p14:media xmlns:p14=\"http://schemas.microsoft.com/office/powerpoint/2010/main\" r:embed=\"" + strRid + L"\"/></p:ext></p:extLst>");
|
||||
}
|
||||
}
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"</p:nvPr>"));
|
||||
|
||||
std::wstring str2 = _T("</p:nvPicPr>");
|
||||
m_oWriter.WriteString(str2);
|
||||
@ -1306,7 +1376,7 @@ std::wstring NSPresentationEditor::CShapeWriter::ConvertImage()
|
||||
strRid = m_pRels->WriteHyperlinkImage(CorrectXmlString3(m_pImageElement->m_sImageName));
|
||||
}
|
||||
|
||||
if (strRid.empty()) return _T("");
|
||||
if (strRid.empty()) return _T("");
|
||||
|
||||
m_oWriter.WriteString(std::wstring(L"<p:pic>"));
|
||||
|
||||
|
||||
@ -163,57 +163,22 @@ namespace NSPresentationEditor
|
||||
RELEASEOBJECT(m_pSimpleGraphicsConverter);
|
||||
}
|
||||
|
||||
friend class CPPTXWriter;
|
||||
|
||||
AVSINLINE void InitNextId()
|
||||
{
|
||||
m_lNextShapeID = 1000;
|
||||
}
|
||||
AVSINLINE void SetShape(CImageElement* pShapeElem)
|
||||
{
|
||||
m_pSimpleGraphicsConverter->PathCommandEnd();
|
||||
m_pImageElement = pShapeElem;
|
||||
m_pShapeElement = NULL;
|
||||
|
||||
m_oMetricInfo = m_pImageElement->m_oMetric;
|
||||
m_oBounds = m_pImageElement->m_rcBounds;
|
||||
m_oTextRect = m_oBounds;
|
||||
|
||||
m_bWordArt = false;
|
||||
m_bTextBox = false;
|
||||
|
||||
m_oWriter.ClearNoAttack();
|
||||
m_oWriterPath.ClearNoAttack();
|
||||
m_oWriterVML.ClearNoAttack();
|
||||
}
|
||||
AVSINLINE void SetShape(CShapeElement* pShapeElem)
|
||||
{
|
||||
m_pSimpleGraphicsConverter->PathCommandEnd();
|
||||
m_pShapeElement = pShapeElem;
|
||||
m_pImageElement = NULL;
|
||||
|
||||
m_oMetricInfo = m_pShapeElement->m_oMetric;
|
||||
m_oBounds = m_pShapeElement->m_rcBounds;
|
||||
m_oTextRect = m_oBounds;
|
||||
|
||||
m_bWordArt = false;
|
||||
m_bTextBox = false;
|
||||
|
||||
if (m_pShapeElement)
|
||||
{
|
||||
m_pShapeElement->m_oShape.GetTextRect(m_oTextRect);
|
||||
}
|
||||
|
||||
m_oWriter.ClearNoAttack();
|
||||
m_oWriterPath.ClearNoAttack();
|
||||
m_oWriterVML.ClearNoAttack();
|
||||
}
|
||||
bool SetElement(IElement* pElem);
|
||||
//--------------------------------------------------------------------
|
||||
std::wstring ConvertShape ();
|
||||
std::wstring ConvertImage ();
|
||||
std::wstring ConvertLine (CPen & pen);
|
||||
std::wstring ConvertShape ();
|
||||
std::wstring ConvertImage ();
|
||||
std::wstring ConvertLine (CPen & pen);
|
||||
std::wstring ConvertShadow (CShadow & shadow);
|
||||
std::wstring ConvertBrush (CBrush & brush);
|
||||
std::wstring ConvertLineEnd (unsigned char cap, unsigned char length, unsigned char width);
|
||||
static std::wstring ConvertColor (CColor & color, long alpha);
|
||||
std::wstring ConvertLineEnd(unsigned char cap, unsigned char length, unsigned char width);
|
||||
// тип рендерера-----------------------------------------------------------------------------
|
||||
virtual HRESULT get_Type(LONG* lType) ;
|
||||
//-------- Функции для работы со страницей --------------------------------------------------
|
||||
|
||||
@ -686,29 +686,9 @@ void CPPTUserInfo::LoadSlide(DWORD dwSlideID, CSlide* pSlide)
|
||||
pTransition->m_bStopSound = pAtom->m_bStopSound;
|
||||
pTransition->m_nEffectDirection = pAtom->m_nEffectDirection;
|
||||
pTransition->m_nEffectType = pAtom->m_nEffectType; // тут нужно сконвертить тип
|
||||
pTransition->m_nSpeed = pAtom->m_nSpeed;
|
||||
|
||||
pSlide->m_oSlideShow.m_dSlideDuration = pAtom->m_nSlideTime;
|
||||
|
||||
switch (pAtom->m_nSpeed)
|
||||
{
|
||||
case 0x00:
|
||||
pTransition->m_dSpeed = 750.0;
|
||||
break;
|
||||
case 0x01:
|
||||
pTransition->m_dSpeed = 500.0;
|
||||
break;
|
||||
case 0x02:
|
||||
pTransition->m_dSpeed = 250.0;
|
||||
break;
|
||||
default:
|
||||
pTransition->m_dSpeed = 500.0;
|
||||
break;
|
||||
};
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pTransition->m_dSpeed = 0.0;
|
||||
}
|
||||
|
||||
CSlideShowSlideInfoAtom* pAtom = &pRecordSlide->m_oSlideShowSlideInfoAtom;
|
||||
|
||||
@ -93,7 +93,7 @@ IRecord* CreateByType(SRecordHeader oHeader)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_VBAINFO_ATOM , CRecordVBAInfoAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_SSDOCINFO_ATOM , CRecordSSDocInfoAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_DOC_ROUTING_SLIP , CRecordDocRoutingSlipAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM , CRecordExObjListAtom)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM , CRecordExObjListAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordGridSpacing10Atom)
|
||||
CREATE_BY_TYPE(RT_RoundTripTheme12Atom , CRecordRoundTripThemeAtom)
|
||||
CREATE_BY_TYPE(RT_RoundTripColorMapping12Atom , CRecordRoundTripColorMappingAtom)
|
||||
@ -148,6 +148,7 @@ IRecord* CreateByType(SRecordHeader oHeader)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_FONT_EMBEDDEDDATA , CRecordFontEmbedDataBlob)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_METAFILE , CRecordMetafileBlob)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_CSTRING , CRecordCString)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_SOUNDCOLL_ATOM , CRecordSoundCollAtom)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_EXOLEOBJ_ATOM , CRecordExOleObjAtom)
|
||||
CREATE_BY_TYPE(RECORD_TYPE_EXEMBEDATOM , CRecordExOleEmbedAtom)
|
||||
//CREATE_BY_TYPE(RECORD_TYPE_BOOKMARK_ENTITY_ATOM , CRecordBookmarkEntityAtom)
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
#include "../../Reader/Records.h"
|
||||
#include "../../../../ASCOfficePPTXFile/Editor/Drawing/Document.h"
|
||||
|
||||
#define __USE_ANIMATION__
|
||||
#define MIN_SLIDE_TIME 5000.0
|
||||
|
||||
inline int sort (const long* a, const long* b) { return *a > *b ? 1 : -1; }
|
||||
|
||||
@ -369,7 +369,13 @@ namespace Animations
|
||||
delayTime = StreamUtils::ReadDWORD ( pStream );
|
||||
}
|
||||
|
||||
virtual bool IsCorrect () { return m_oHeader.RecVersion == 0x1 && m_oHeader.RecInstance == 0x0 && m_oHeader.RecType == RT_ParaBuildAtom && m_oHeader.RecLen == 0x00000010; }
|
||||
virtual bool IsCorrect ()
|
||||
{
|
||||
return m_oHeader.RecVersion == 0x1 &&
|
||||
m_oHeader.RecInstance == 0x0 &&
|
||||
m_oHeader.RecType == RT_ParaBuildAtom &&
|
||||
m_oHeader.RecLen == 0x00000010;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@ -3097,9 +3103,6 @@ namespace Animations
|
||||
{
|
||||
Clear ();
|
||||
|
||||
#if defined(_DEBUG_LOG) && (defined(_WIN32) || defined(_WIN64))
|
||||
ATLTRACE(_T("======================================== Slide ========================================\n"));
|
||||
#endif
|
||||
m_bSaveEffect = false;
|
||||
m_HaveAfterEffect = false;
|
||||
|
||||
@ -3115,15 +3118,13 @@ namespace Animations
|
||||
return false;
|
||||
}
|
||||
|
||||
inline EffectsMap& GetAnimation ()
|
||||
inline EffectsMap& GetAnimation ()
|
||||
{
|
||||
return m_oAnimation;
|
||||
}
|
||||
|
||||
inline double GetTime ()
|
||||
inline double GetTime ()
|
||||
{
|
||||
#define MIN_SLIDE_TIME 5000.0
|
||||
|
||||
double dTime = m_oNodeTiming.GetTimeLine ();
|
||||
if (dTime < MIN_SLIDE_TIME)
|
||||
return MIN_SLIDE_TIME;
|
||||
@ -3137,12 +3138,12 @@ namespace Animations
|
||||
private:
|
||||
inline void ExploreTree (ExtTimeNodeContainer* pContainer)
|
||||
{
|
||||
unsigned long nNodeType = pContainer->GetEffectNodeType ();
|
||||
unsigned long nNodeType = pContainer->GetEffectNodeType ();
|
||||
if (nNodeType)
|
||||
{
|
||||
if (CNodeTiming::MainSequenceNode != nNodeType && CNodeTiming::TimingRootNode != nNodeType)
|
||||
{
|
||||
m_oTopEffect = CreateEffectFromNode ( pContainer->timePropertyList );
|
||||
m_oTopEffect = CreateEffectFromNode ( pContainer->timePropertyList );
|
||||
|
||||
m_ComposeEffectMothionPath = _T("");
|
||||
|
||||
@ -3200,7 +3201,7 @@ namespace Animations
|
||||
}
|
||||
}
|
||||
|
||||
int nID = GetShapeID ( pContainer );
|
||||
int nID = GetShapeID ( pContainer );
|
||||
if ( -1 != nID )
|
||||
{
|
||||
// TODO :
|
||||
@ -3448,7 +3449,7 @@ namespace Animations
|
||||
{
|
||||
if (pChild->timeNodeAtom.m_bDurationProperty)
|
||||
{
|
||||
m_dEffectDuration = pChild->timeNodeAtom.m_nDuration;
|
||||
m_dEffectDuration = pChild->timeNodeAtom.m_nDuration;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3649,9 +3650,9 @@ namespace Animations
|
||||
//
|
||||
inline void ProcessMediaCall (ExtTimeNodeContainer* pContainer)
|
||||
{
|
||||
if (MediaCallEffect == m_oTopEffect.m_nEffectType) // если анимация применена к VIDEO или AUDIO элементу
|
||||
if (MediaCallEffect == m_oTopEffect.m_nEffectType) // если анимация применена к VIDEO или AUDIO элементу
|
||||
{
|
||||
m_nMediaPush = GetAttachedShapeToVideo (pContainer); // если к видео добавлена картинка, надо учитывать смещение при поиск ID
|
||||
m_nMediaPush = GetAttachedShapeToVideo (pContainer); // если к видео добавлена картинка, надо учитывать смещение при поиск ID
|
||||
|
||||
if (GetMediaID (pContainer))
|
||||
{
|
||||
@ -3844,8 +3845,6 @@ public:
|
||||
|
||||
if ( RECORD_PROG_BINARY_TAG == m_oHeaderChild.RecType )
|
||||
{
|
||||
#ifdef __USE_ANIMATION__
|
||||
|
||||
SRecordHeader rgSubRec;
|
||||
|
||||
rgSubRec.ReadFromStream(pStream) ;
|
||||
@ -3874,7 +3873,6 @@ public:
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream );
|
||||
|
||||
@ -236,7 +236,6 @@ public:
|
||||
{
|
||||
case NSPresentationEditor::etVideo:
|
||||
{
|
||||
//default -> line = false
|
||||
pElement->m_bLine = false;
|
||||
for (long i = 0; i < lCount; ++i)
|
||||
{
|
||||
@ -246,7 +245,6 @@ public:
|
||||
}
|
||||
case NSPresentationEditor::etPicture:
|
||||
{
|
||||
//default -> line = false
|
||||
pElement->m_oBrush.Type = c_BrushTypeTexture;
|
||||
pElement->m_bLine = false;
|
||||
for (long i = 0; i < lCount; ++i)
|
||||
@ -257,7 +255,6 @@ public:
|
||||
}
|
||||
case NSPresentationEditor::etAudio:
|
||||
{
|
||||
//default -> line = false
|
||||
pElement->m_bLine = false;
|
||||
for (long i = 0; i < lCount; ++i)
|
||||
{
|
||||
@ -806,7 +803,7 @@ public:
|
||||
}
|
||||
inline void SetUpPropertyAudio(CAudioElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
|
||||
{
|
||||
SetUpProperty((IElement*)pElement, pTheme, pInfo, pSlide, pProperty);
|
||||
SetUpPropertyImage((CImageElement*)pElement, pTheme, pInfo, pSlide, pProperty);
|
||||
}
|
||||
inline void SetUpPropertyImage(CImageElement* pElement, CTheme* pTheme, CSlideInfo* pInfo, CSlide* pSlide, CProperty* pProperty)
|
||||
{
|
||||
@ -864,8 +861,6 @@ public:
|
||||
CShape* pParentShape = &pElement->m_oShape;
|
||||
CPPTShape* pShape = dynamic_cast<CPPTShape*>(pParentShape->m_pShape);
|
||||
|
||||
CElementProperties* pElemProps = &pElement->m_oProperties;
|
||||
|
||||
if (NULL == pShape)
|
||||
return;
|
||||
|
||||
@ -1199,7 +1194,9 @@ public:
|
||||
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
{
|
||||
int unknown_value = pProperty->m_lValue;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1362,8 +1359,8 @@ public:
|
||||
{
|
||||
CVideoElement* pVideoElem = new CVideoElement();
|
||||
|
||||
pVideoElem->m_strVideoFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
|
||||
pVideoElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
|
||||
pVideoElem->m_strVideoFileName = oInfo.m_strFilePath ;
|
||||
pVideoElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
|
||||
|
||||
pElem = (IElement*)pVideoElem;
|
||||
}
|
||||
@ -1371,7 +1368,8 @@ public:
|
||||
{
|
||||
CAudioElement* pAudioElem = new CAudioElement();
|
||||
|
||||
pAudioElem->m_strAudioFileName = oInfo.m_strFilePath + FILE_SEPARATOR_STR;
|
||||
pAudioElem->m_strAudioFileName = oInfo.m_strFilePath;
|
||||
pAudioElem->m_strImageFileName = oInfoDefault.m_strFilePath + FILE_SEPARATOR_STR;
|
||||
|
||||
pAudioElem->m_dClipStartTime = oInfo.m_dStartTime;
|
||||
pAudioElem->m_dClipEndTime = oInfo.m_dEndTime;
|
||||
@ -1667,11 +1665,43 @@ public:
|
||||
pShapeElem->m_oShape.m_oText.m_oRuler = oArrayTextRuler[0]->m_oTextRuler;
|
||||
}
|
||||
|
||||
std::vector<CRecordTextInteractiveInfoAtom*> oArrayTextInteractive;
|
||||
this->GetRecordsByType(&oArrayTextInteractive, true);
|
||||
if (0 != oArrayTextInteractive.size())
|
||||
std::vector<CRecordInteractiveInfoAtom*> oArrayInteractive;
|
||||
GetRecordsByType(&oArrayInteractive, true, true);
|
||||
|
||||
if (!oArrayInteractive.empty())
|
||||
{
|
||||
pShapeElem->m_oActions.m_bPresent = true;
|
||||
|
||||
if (pMapIDs)
|
||||
{
|
||||
CExFilesInfo* pInfo1 = pMapIDs->LockAudioFromCollection(oArrayInteractive[0]->m_nSoundIdRef);
|
||||
if (NULL != pInfo1)
|
||||
{
|
||||
pShapeElem->m_oActions.m_strAudioFileName = pInfo1->m_strFilePath;
|
||||
}
|
||||
CExFilesInfo* pInfo2 = pMapIDs->LockHyperlink(oArrayInteractive[0]->m_nExHyperlinkIdRef);
|
||||
if (NULL != pInfo2)
|
||||
{
|
||||
pShapeElem->m_oActions.m_strHyperlink = pInfo2->m_strFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
pShapeElem->m_oActions.m_lType = oArrayInteractive[0]->m_nAction;
|
||||
pShapeElem->m_oActions.m_lOleVerb = oArrayInteractive[0]->m_nOleVerb;
|
||||
pShapeElem->m_oActions.m_lJump = oArrayInteractive[0]->m_nJump;
|
||||
pShapeElem->m_oActions.m_lHyperlinkType = oArrayInteractive[0]->m_nHyperlinkType;
|
||||
|
||||
pShapeElem->m_oActions.m_bAnimated = oArrayInteractive[0]->m_bAnimated;
|
||||
pShapeElem->m_oActions.m_bStopSound = oArrayInteractive[0]->m_bStopSound;
|
||||
pShapeElem->m_oActions.m_bCustomShowReturn = oArrayInteractive[0]->m_bCustomShowReturn;
|
||||
pShapeElem->m_oActions.m_bVisited = oArrayInteractive[0]->m_bVisited;
|
||||
}
|
||||
|
||||
std::vector<CRecordTextInteractiveInfoAtom*> oArrayTextInteractive;
|
||||
this->GetRecordsByType(&oArrayTextInteractive, true);
|
||||
if (!oArrayTextInteractive.empty())
|
||||
{
|
||||
pShapeElem->m_oTextActions.m_bPresent = true;
|
||||
|
||||
int nSize = oArrayTextInteractive.size();
|
||||
for (int i = 0; i < nSize; ++i)
|
||||
@ -1681,7 +1711,7 @@ public:
|
||||
oRange.m_lStart = oArrayTextInteractive[i]->m_lStart;
|
||||
oRange.m_lEnd = oArrayTextInteractive[i]->m_lEnd;
|
||||
|
||||
pShapeElem->m_oActions.m_arRanges.push_back(oRange);
|
||||
pShapeElem->m_oTextActions.m_arRanges.push_back(oRange);
|
||||
}
|
||||
}
|
||||
double dAngle = pShapeElem->m_dRotate;
|
||||
@ -1926,11 +1956,11 @@ protected:
|
||||
eTypePersist = (NSOfficePPT::TextType)pSettings->m_nTextType;
|
||||
strText = pSettings->ApplyProperties(pTextSettings);
|
||||
|
||||
if ((0 != pSettings->m_arRanges.size()) && (0 == pShape->m_oActions.m_arRanges.size()))
|
||||
if ((0 != pSettings->m_arRanges.size()) && (0 == pShape->m_oTextActions.m_arRanges.size()))
|
||||
{
|
||||
pShape->m_oActions.m_bPresent = true;
|
||||
pShape->m_oTextActions.m_bPresent = true;
|
||||
|
||||
pShape->m_oActions.m_arRanges = pSettings->m_arRanges;
|
||||
pShape->m_oTextActions.m_arRanges = pSettings->m_arRanges;
|
||||
}
|
||||
|
||||
bIsPersistPresentSettings = ((NULL != pSettings->m_pTextStyleProp) && (0 < pSettings->m_pTextStyleProp->m_lCount));
|
||||
@ -2204,7 +2234,7 @@ protected:
|
||||
|
||||
ApplyThemeStyle(pElem, pTheme, master_levels);
|
||||
|
||||
if (pShape->m_oActions.m_bPresent)
|
||||
if (pShape->m_oTextActions.m_bPresent)
|
||||
{
|
||||
//todooo разобраться нужно ли менять цвет на гиперлинк - 1-(34).ppt
|
||||
NSPresentationEditor::CColor oColor;
|
||||
@ -2279,8 +2309,8 @@ protected:
|
||||
|
||||
void ApplyHyperlink(CShapeElement* pShape, CColor& oColor)
|
||||
{
|
||||
std::vector<CTextRange>* pRanges = &pShape->m_oActions.m_arRanges;
|
||||
CTextAttributesEx* pTextAttributes = &pShape->m_oShape.m_oText;
|
||||
std::vector<CTextRange>* pRanges = &pShape->m_oTextActions.m_arRanges;
|
||||
CTextAttributesEx* pTextAttributes = &pShape->m_oShape.m_oText;
|
||||
|
||||
int lCountHyper = pRanges->size();
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ public:
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
return CUnknownRecord::ReadFromStream(oHeader, pStream);
|
||||
m_oHeader = oHeader;
|
||||
m_nSlideID = StreamUtils::ReadDWORD(pStream);
|
||||
}
|
||||
};
|
||||
@ -34,10 +34,9 @@
|
||||
|
||||
class CRecordExObjListAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
INT m_nObjectIdSeed;
|
||||
|
||||
public:
|
||||
|
||||
CRecordExObjListAtom()
|
||||
{
|
||||
}
|
||||
@ -46,4 +45,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
m_nObjectIdSeed = StreamUtils::ReadDWORD(pStream);
|
||||
}
|
||||
|
||||
};
|
||||
@ -35,6 +35,17 @@
|
||||
class CRecordInteractiveInfoAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
UINT m_nSoundIdRef;
|
||||
UINT m_nExHyperlinkIdRef;
|
||||
BYTE m_nAction;
|
||||
BYTE m_nOleVerb;
|
||||
BYTE m_nJump;
|
||||
BYTE m_nHyperlinkType;
|
||||
|
||||
bool m_bAnimated;
|
||||
bool m_bStopSound;
|
||||
bool m_bCustomShowReturn;
|
||||
bool m_bVisited;
|
||||
|
||||
CRecordInteractiveInfoAtom()
|
||||
{
|
||||
@ -46,6 +57,22 @@ public:
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
CUnknownRecord::ReadFromStream(oHeader, pStream);
|
||||
m_oHeader = oHeader;
|
||||
|
||||
m_nSoundIdRef = StreamUtils::ReadDWORD(pStream);
|
||||
m_nExHyperlinkIdRef = StreamUtils::ReadDWORD(pStream);
|
||||
m_nAction = StreamUtils::ReadBYTE(pStream);
|
||||
m_nOleVerb = StreamUtils::ReadBYTE(pStream);
|
||||
m_nJump = StreamUtils::ReadBYTE(pStream);
|
||||
|
||||
BYTE nFlag = StreamUtils::ReadBYTE(pStream);
|
||||
|
||||
m_bAnimated = ((nFlag & 0x01) == 0x01);
|
||||
m_bStopSound = ((nFlag & 0x02) == 0x02);
|
||||
m_bCustomShowReturn = ((nFlag & 0x04) == 0x04);
|
||||
m_bVisited = ((nFlag & 0x08) == 0x08);
|
||||
|
||||
m_nHyperlinkType = StreamUtils::ReadBYTE(pStream);
|
||||
StreamUtils::StreamSkip(3, pStream);
|
||||
}
|
||||
};
|
||||
@ -34,6 +34,7 @@
|
||||
|
||||
class CRecordNormalViewSetInfoAtom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
SRatioAtom m_oLeftPortion;
|
||||
SRatioAtom m_oTopPortion;
|
||||
|
||||
@ -43,7 +44,6 @@ class CRecordNormalViewSetInfoAtom : public CUnknownRecord
|
||||
BOOL1 m_fPreferSingleSet;
|
||||
BYTE m_nFlags;
|
||||
|
||||
public:
|
||||
|
||||
CRecordNormalViewSetInfoAtom()
|
||||
{
|
||||
|
||||
@ -37,7 +37,6 @@ class CRecordOutlineTextRefAtom : public CUnknownRecord
|
||||
public:
|
||||
DWORD m_nIndex;
|
||||
|
||||
public:
|
||||
|
||||
CRecordOutlineTextRefAtom()
|
||||
{
|
||||
|
||||
@ -36,8 +36,6 @@ class CRecordTripOriginalMasterId12Atom : public CUnknownRecord
|
||||
{
|
||||
public:
|
||||
DWORD m_dwID;
|
||||
|
||||
public:
|
||||
|
||||
CRecordTripOriginalMasterId12Atom()
|
||||
{
|
||||
|
||||
@ -34,9 +34,8 @@
|
||||
|
||||
class CRecordSlideColorSchemeAtom : public CUnknownRecord
|
||||
{
|
||||
SColorAtom m_arColors[8];
|
||||
|
||||
public:
|
||||
SColorAtom m_arColors[8];
|
||||
|
||||
CRecordSlideColorSchemeAtom()
|
||||
{
|
||||
|
||||
@ -34,9 +34,8 @@
|
||||
|
||||
class CRecordSoundCollAtom : public CUnknownRecord
|
||||
{
|
||||
INT m_nObjectIdSeed;
|
||||
|
||||
public:
|
||||
INT m_nObjectIdSeed;
|
||||
|
||||
CRecordSoundCollAtom()
|
||||
{
|
||||
@ -48,6 +47,8 @@ public:
|
||||
|
||||
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
|
||||
{
|
||||
return CUnknownRecord::ReadFromStream(oHeader, pStream);
|
||||
m_oHeader = oHeader;
|
||||
|
||||
m_nObjectIdSeed = StreamUtils::ReadDWORD(pStream);
|
||||
}
|
||||
};
|
||||
@ -38,8 +38,6 @@ public:
|
||||
LONG m_lStart;
|
||||
LONG m_lEnd;
|
||||
|
||||
public:
|
||||
|
||||
CRecordTextInteractiveInfoAtom()
|
||||
{
|
||||
m_lStart = 0;
|
||||
|
||||
@ -750,10 +750,6 @@
|
||||
RelativePath="..\Records\SlideListWithText.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Records\SlideNumberMCAtom.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Records\SlidePersistAtom.h"
|
||||
>
|
||||
@ -966,10 +962,6 @@
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Element.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\ElementProperties.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Elements.cpp"
|
||||
>
|
||||
@ -978,10 +970,6 @@
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Elements.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Enums.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficePPTXFile\Editor\Drawing\Interactive.h"
|
||||
>
|
||||
@ -1058,10 +1046,6 @@
|
||||
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\CommentsWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\ContentTypesWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PPTXWriter\Converter.cpp"
|
||||
>
|
||||
|
||||
@ -2754,6 +2754,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
|
||||
{
|
||||
pShape->nvSpPr.cNvPr.id = -1;
|
||||
}
|
||||
pShape->signatureLine = pPPTShape->m_oSignatureLine;
|
||||
|
||||
elem->InitElem(pShape);
|
||||
|
||||
@ -4374,6 +4375,15 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const std::wstr
|
||||
bOle = oPic.oleObject->isValid();
|
||||
}
|
||||
}
|
||||
bool bSignatureLine = false;
|
||||
if (oElem.is<PPTX::Logic::Shape>())
|
||||
{
|
||||
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
|
||||
if(oShape.signatureLine.IsInit())
|
||||
{
|
||||
bSignatureLine = true;
|
||||
}
|
||||
}
|
||||
|
||||
m_pReader->m_nDocumentType = XMLWRITER_DOC_TYPE_PPTX;
|
||||
|
||||
@ -4393,6 +4403,12 @@ HRESULT CDrawingConverter::SaveObject(LONG lStart, LONG lLength, const std::wstr
|
||||
{
|
||||
ConvertPicVML(oElem, bsMainProps, oXmlWriter);
|
||||
}
|
||||
else if(bSignatureLine)
|
||||
{
|
||||
oXmlWriter.WriteString(L"<w:pict>");
|
||||
ConvertShapeVML(oElem, bsMainProps, oXmlWriter, true);
|
||||
oXmlWriter.WriteString(L"</w:pict>");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -4586,13 +4602,13 @@ void CDrawingConverter::ConvertPicVML(PPTX::Logic::SpTreeElem& oElem, const std:
|
||||
oPic.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
|
||||
}
|
||||
|
||||
void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
|
||||
void CDrawingConverter::ConvertShapeVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter, bool bSignature)
|
||||
{
|
||||
ConvertMainPropsToVML(bsMainProps, oWriter, oElem);
|
||||
|
||||
oWriter.m_bIsTop = true; // не забыть скинуть в самом шейпе
|
||||
PPTX::Logic::Shape& oShape = oElem.as<PPTX::Logic::Shape>();
|
||||
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap);
|
||||
oShape.toXmlWriterVML(&oWriter, *m_pTheme, *m_pClrMap, false, bSignature);
|
||||
}
|
||||
|
||||
void CDrawingConverter::ConvertGroupVML(PPTX::Logic::SpTreeElem& oElem, const std::wstring& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter)
|
||||
|
||||
@ -279,7 +279,7 @@ namespace NSBinPptxRW
|
||||
|
||||
void ConvertMainPropsToVML (const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter, PPTX::Logic::SpTreeElem& oElem);
|
||||
void ConvertPicVML (PPTX::Logic::SpTreeElem& oElem, const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter);
|
||||
void ConvertShapeVML (PPTX::Logic::SpTreeElem& oShape, const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter);
|
||||
void ConvertShapeVML (PPTX::Logic::SpTreeElem& oShape, const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter, bool bSignature = false);
|
||||
void ConvertGroupVML (PPTX::Logic::SpTreeElem& oGroup, const std::wstring& sMainProps, NSBinPptxRW::CXmlWriter& oWriter);
|
||||
|
||||
void ConvertTextVML (XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape);
|
||||
|
||||
@ -186,6 +186,8 @@ namespace NSBinPptxRW
|
||||
#define SPTREE_TYPE_SPTREE 4
|
||||
#define SPTREE_TYPE_GRFRAME 5
|
||||
#define SPTREE_TYPE_OLE 6
|
||||
#define SPTREE_TYPE_VIDEO 7
|
||||
#define SPTREE_TYPE_AUDIO 8
|
||||
|
||||
static BYTE SchemeClr_GetBYTECode(const std::wstring& sValue)
|
||||
{
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
|
||||
|
||||
#include "../../Common/Base64.h"
|
||||
|
||||
@ -106,7 +108,7 @@ namespace NSBinPptxRW
|
||||
CreateFontPicker(NULL);
|
||||
}
|
||||
|
||||
CImageManager2::CImageManager2() : m_mapImages(), m_lIndexNextImage(0), m_lIndexNextOle(0)
|
||||
CImageManager2::CImageManager2() : m_mapImages(), m_lIndexNextImage(0), m_lIndexCounter(0)
|
||||
{
|
||||
m_nDocumentType = XMLWRITER_DOC_TYPE_PPTX;
|
||||
m_pContentTypes = new OOX::CContentTypes();
|
||||
@ -118,8 +120,8 @@ namespace NSBinPptxRW
|
||||
void CImageManager2::Clear()
|
||||
{
|
||||
m_mapImages.clear();
|
||||
m_lIndexNextImage = 1;
|
||||
m_lIndexNextOle = 1;
|
||||
m_lIndexNextImage = 0;
|
||||
m_lIndexCounter = 0;
|
||||
}
|
||||
void CImageManager2::SetDstMedia(const std::wstring& strDst)
|
||||
{
|
||||
@ -147,34 +149,50 @@ namespace NSBinPptxRW
|
||||
{
|
||||
if(nIndex1 + sFind1.length() < strInput.length())
|
||||
{
|
||||
wchar_t cRes = strInput[nIndex1 + sFind1.length()];
|
||||
if('1' <= cRes && cRes <= '6')
|
||||
wchar_t cRes1 = strInput[nIndex1 + sFind1.length()];
|
||||
if('1' <= cRes1 && cRes1 <= '9')
|
||||
{
|
||||
wchar_t cRes2 = strInput[nIndex1 + sFind1.length() + 1];
|
||||
|
||||
int nImageIndex = nIndex1 + (int)sFind1.length() + 1;
|
||||
if(nImageIndex == (int)strInput.find(_T("image"), nImageIndex))
|
||||
nRes = cRes - '0';
|
||||
if (std::wstring::npos != strInput.find(_T("image"), nImageIndex))
|
||||
{
|
||||
nRes = cRes1 - '0';
|
||||
if('0' <= cRes2 && cRes2 <= '9')
|
||||
{
|
||||
nRes = nRes * 10 + (cRes2 - '0');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
_imageManager2Info CImageManager2::GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::OleObject> & oleFile, const std::wstring& oleData, std::wstring strBase64Image)
|
||||
_imageManager2Info CImageManager2::GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image)
|
||||
{
|
||||
if (IsNeedDownload(strInput))
|
||||
return DownloadImage(strInput);
|
||||
|
||||
std::map<std::wstring, _imageManager2Info>::const_iterator pPair = m_mapImages.find ((_T("") == strBase64Image) ? strInput : strBase64Image);
|
||||
std::map<std::wstring, _imageManager2Info>::const_iterator pPair = m_mapImages.find ((strBase64Image.empty()) ? strInput : strBase64Image);
|
||||
|
||||
if (pPair != m_mapImages.end())
|
||||
{
|
||||
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
if (mediaFile.IsInit())
|
||||
mediaFile->set_filename(pPair->second.sFilepathAdditional);
|
||||
|
||||
return pPair->second;
|
||||
}
|
||||
|
||||
std::wstring strExts = _T(".jpg");
|
||||
int nIndexExt = (int)strInput.rfind(wchar_t('.'));
|
||||
if (-1 != nIndexExt)
|
||||
strExts = strInput.substr(nIndexExt);
|
||||
|
||||
std::wstring strOleBin;
|
||||
int typeAdditional = 0;
|
||||
std::wstring strAdditional;
|
||||
std::wstring strImage = strInput;
|
||||
|
||||
int nDisplayType = IsDisplayedImage(strInput);
|
||||
@ -208,21 +226,52 @@ namespace NSBinPptxRW
|
||||
}
|
||||
if(0 != (nDisplayType & 4))
|
||||
{
|
||||
smart_ptr<OOX::OleObject> oleFile = additionalFile.smart_dynamic_cast<OOX::OleObject>();
|
||||
if (oleFile.IsInit())
|
||||
{
|
||||
if (OOX::CSystemUtility::IsFileExist(oleFile->filename()) == false)
|
||||
{
|
||||
typeAdditional = 1;
|
||||
|
||||
std::wstring strOle = strFolder + strFileName + oleFile->filename().GetExtention();
|
||||
if (OOX::CSystemUtility::IsFileExist(strOle))
|
||||
{
|
||||
m_pContentTypes->AddDefault(oleFile->filename().GetExtention(false));
|
||||
strOleBin = strOle;
|
||||
strAdditional = strOle;
|
||||
}
|
||||
else
|
||||
{
|
||||
strOle = strFolder + strFileName + L".bin";
|
||||
if (OOX::CSystemUtility::IsFileExist(strOle))
|
||||
strOleBin = strOle;
|
||||
strAdditional = strOle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(0 != (nDisplayType & 8))
|
||||
{
|
||||
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
if (mediaFile.IsInit())
|
||||
{
|
||||
if (OOX::CSystemUtility::IsFileExist(mediaFile->filename()) == false)
|
||||
{
|
||||
typeAdditional = 2;
|
||||
|
||||
std::wstring strMedia = strFolder + strFileName + mediaFile->filename().GetExtention();
|
||||
if (OOX::CSystemUtility::IsFileExist(strMedia))
|
||||
{
|
||||
m_pContentTypes->AddDefault(mediaFile->filename().GetExtention(false));
|
||||
strAdditional = strMedia;
|
||||
}
|
||||
else
|
||||
{
|
||||
strMedia = strFolder + strFileName;
|
||||
|
||||
if (mediaFile.is<OOX::Audio>()) strMedia += L".wav";
|
||||
if (mediaFile.is<OOX::Video>()) strMedia += L".avi";
|
||||
|
||||
if (OOX::CSystemUtility::IsFileExist(strMedia))
|
||||
strAdditional = strMedia;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -233,10 +282,20 @@ namespace NSBinPptxRW
|
||||
m_pContentTypes->AddDefault(strExts.substr(1));
|
||||
}
|
||||
|
||||
_imageManager2Info oImageManagerInfo = GenerateImageExec(strImage, strExts, strOleBin, oleData);
|
||||
if (oleData.empty() == false)
|
||||
{
|
||||
//plugins data - generate ole
|
||||
typeAdditional = 1;
|
||||
}
|
||||
|
||||
if (!oImageManagerInfo.sFilepathOle.empty())
|
||||
oleFile->set_filename(oImageManagerInfo.sFilepathOle);
|
||||
_imageManager2Info oImageManagerInfo = GenerateImageExec(strImage, strExts, strAdditional, typeAdditional, oleData);
|
||||
|
||||
if (!oImageManagerInfo.sFilepathAdditional.empty())
|
||||
{
|
||||
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
if (mediaFile.IsInit())
|
||||
mediaFile->set_filename(oImageManagerInfo.sFilepathAdditional);
|
||||
}
|
||||
|
||||
if (strBase64Image.empty())
|
||||
m_mapImages[strInput] = oImageManagerInfo;
|
||||
@ -281,7 +340,7 @@ namespace NSBinPptxRW
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
_imageManager2Info CImageManager2::GenerateImageExec(const std::wstring& strInput, const std::wstring& sExts, const std::wstring& strOleImage, const std::wstring& oleData)
|
||||
_imageManager2Info CImageManager2::GenerateImageExec(const std::wstring& strInput, const std::wstring& sExts, const std::wstring& strAdditionalImage, int nAdditionalType, const std::wstring& oleData)
|
||||
{
|
||||
OOX::CPath oPathOutput;
|
||||
_imageManager2Info oImageManagerInfo;
|
||||
@ -293,8 +352,11 @@ namespace NSBinPptxRW
|
||||
{
|
||||
oPathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImage + strExts;
|
||||
|
||||
if (oPathOutput.GetPath() != strInput)
|
||||
CDirectory::CopyFile(strInput, oPathOutput.GetPath());
|
||||
if (oPathOutput.GetPath() != strInput && NSFile::CFileBinary::Exists(strInput))
|
||||
{
|
||||
NSFile::CFileBinary::Copy(strInput, oPathOutput.GetPath());
|
||||
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -302,32 +364,52 @@ namespace NSBinPptxRW
|
||||
strExts = _T(".png");
|
||||
oPathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImage + strExts;
|
||||
SaveImageAsPng(strInput, oPathOutput.GetPath());
|
||||
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
|
||||
}
|
||||
oImageManagerInfo.sFilepathImage = oPathOutput.GetPath();
|
||||
|
||||
if (!strOleImage.empty() || !oleData.empty() )
|
||||
if ((!strAdditionalImage.empty() || !oleData.empty() ) && (nAdditionalType == 1))
|
||||
{
|
||||
std::wstring strExtsOle = L".bin";
|
||||
std::wstring strAdditionalExt = L".bin";
|
||||
|
||||
int pos = (int)strOleImage.rfind(L".");
|
||||
if (pos >= 0) strExtsOle = strOleImage.substr(pos);
|
||||
int pos = (int)strAdditionalImage.rfind(L".");
|
||||
if (pos >= 0) strAdditionalExt = strAdditionalImage.substr(pos);
|
||||
|
||||
std::wstring strImageOle = L"oleObject" + std::to_wstring(++m_lIndexNextOle) + strExtsOle;
|
||||
std::wstring strImageAdditional = L"oleObject" + std::to_wstring(++m_lIndexCounter) + strAdditionalExt;
|
||||
|
||||
OOX::CPath pathOutputOle = m_strDstEmbed + FILE_SEPARATOR_STR + strImageOle;
|
||||
OOX::CPath pathOutput = m_strDstEmbed + FILE_SEPARATOR_STR + strImageAdditional;
|
||||
|
||||
std::wstring strOleImageOut = pathOutputOle.GetPath();
|
||||
std::wstring strAdditionalImageOut = pathOutput.GetPath();
|
||||
|
||||
if(!oleData.empty())
|
||||
{
|
||||
WriteOleData(strOleImageOut, oleData);
|
||||
WriteOleData(strAdditionalImageOut, oleData);
|
||||
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
|
||||
}
|
||||
else
|
||||
else if (NSFile::CFileBinary::Exists(strAdditionalImage))
|
||||
{
|
||||
CDirectory::CopyFile(strOleImage, strOleImageOut);
|
||||
NSFile::CFileBinary::Copy(strAdditionalImage, strAdditionalImageOut);
|
||||
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
|
||||
}
|
||||
|
||||
oImageManagerInfo.sFilepathOle = strOleImageOut;
|
||||
}
|
||||
else if (!strAdditionalImage.empty() && nAdditionalType == 2)
|
||||
{
|
||||
std::wstring strAdditionalExt;
|
||||
|
||||
int pos = (int)strAdditionalImage.rfind(L".");
|
||||
if (pos >= 0) strAdditionalExt = strAdditionalImage.substr(pos);
|
||||
|
||||
std::wstring strImageAdditional = L"media" + std::to_wstring(++m_lIndexCounter) + strAdditionalExt;
|
||||
|
||||
OOX::CPath pathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImageAdditional;
|
||||
|
||||
std::wstring strAdditionalImageOut = pathOutput.GetPath();
|
||||
|
||||
if (NSFile::CFileBinary::Exists(strAdditionalImage))
|
||||
{
|
||||
NSFile::CFileBinary::Copy(strAdditionalImage, strAdditionalImageOut);
|
||||
oImageManagerInfo.sFilepathAdditional = strAdditionalImageOut;
|
||||
}
|
||||
}
|
||||
|
||||
return oImageManagerInfo;
|
||||
@ -372,7 +454,6 @@ namespace NSBinPptxRW
|
||||
strExts = strUrl.substr(nIndexExt);
|
||||
|
||||
std::wstring strImage;
|
||||
std::wstring strOleImage;
|
||||
|
||||
int nDisplayType = IsDisplayedImage(strUrl);
|
||||
|
||||
@ -380,11 +461,6 @@ namespace NSBinPptxRW
|
||||
{
|
||||
std::wstring strInputMetafile = strUrl.substr(0, strUrl.length() - strExts.length());
|
||||
std::wstring sDownloadRes;
|
||||
//todo
|
||||
if(0 != (nDisplayType & 4))
|
||||
{
|
||||
strOleImage = DownloadImageExec(strInputMetafile + _T(".bin"));
|
||||
}
|
||||
|
||||
if(0 != (nDisplayType & 1))
|
||||
{
|
||||
@ -414,11 +490,9 @@ namespace NSBinPptxRW
|
||||
_imageManager2Info oImageManagerInfo;
|
||||
if (!strImage.empty())
|
||||
{
|
||||
oImageManagerInfo = GenerateImageExec(strImage, strExts, strOleImage, L"");
|
||||
oImageManagerInfo = GenerateImageExec(strImage, strExts, L"", 0, L"");
|
||||
CDirectory::DeleteFile(strImage);
|
||||
}
|
||||
if (!strOleImage.empty())
|
||||
CDirectory::DeleteFile(strOleImage);
|
||||
|
||||
m_mapImages[strUrl] = oImageManagerInfo;
|
||||
return oImageManagerInfo;
|
||||
@ -1166,36 +1240,42 @@ namespace NSBinPptxRW
|
||||
oFile.CloseFile();
|
||||
}
|
||||
|
||||
_relsGeneratorInfo CRelsGenerator::WriteImage(const std::wstring& strImage, smart_ptr<OOX::OleObject> & oleFile, const std::wstring& oleData, std::wstring strBase64Image = _T(""))
|
||||
_relsGeneratorInfo CRelsGenerator::WriteImage(const std::wstring& strImage, smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image = _T(""))
|
||||
{
|
||||
_imageManager2Info oImageManagerInfo = m_pManager->GenerateImage(strImage, oleFile, oleData, strBase64Image);
|
||||
_imageManager2Info oImageManagerInfo = m_pManager->GenerateImage(strImage, additionalFile, oleData, strBase64Image);
|
||||
|
||||
std::wstring strImageRelsPath;
|
||||
|
||||
if (m_pManager->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strImageRelsPath = L"media/";
|
||||
else strImageRelsPath = L"../media/";
|
||||
|
||||
strImageRelsPath += OOX::CPath(oImageManagerInfo.sFilepathImage).GetFilename();
|
||||
|
||||
std::map<std::wstring, _relsGeneratorInfo>::iterator pPair = m_mapImages.find(strImageRelsPath);
|
||||
|
||||
if (m_mapImages.end() != pPair)
|
||||
{
|
||||
return pPair->second;
|
||||
}
|
||||
_relsGeneratorInfo oRelsGeneratorInfo;
|
||||
|
||||
oRelsGeneratorInfo.nImageRId = m_lNextRelsID++;
|
||||
oRelsGeneratorInfo.sFilepathImage = oImageManagerInfo.sFilepathImage;
|
||||
|
||||
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nImageRId);
|
||||
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"" + strImageRelsPath +
|
||||
L"\"/>");
|
||||
|
||||
if( oleFile.IsInit() )
|
||||
if (!oImageManagerInfo.sFilepathImage.empty())
|
||||
{
|
||||
strImageRelsPath += OOX::CPath(oImageManagerInfo.sFilepathImage).GetFilename();
|
||||
|
||||
std::map<std::wstring, _relsGeneratorInfo>::iterator pPair = m_mapImages.find(strImageRelsPath);
|
||||
|
||||
if (m_mapImages.end() != pPair)
|
||||
{
|
||||
return pPair->second;
|
||||
}
|
||||
|
||||
oRelsGeneratorInfo.nImageRId = m_lNextRelsID++;
|
||||
oRelsGeneratorInfo.sFilepathImage = oImageManagerInfo.sFilepathImage;
|
||||
|
||||
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nImageRId);
|
||||
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"" + strImageRelsPath +
|
||||
L"\"/>");
|
||||
}
|
||||
|
||||
if(additionalFile.is<OOX::OleObject>())
|
||||
{
|
||||
smart_ptr<OOX::OleObject> oleFile = additionalFile.smart_dynamic_cast<OOX::OleObject>();
|
||||
|
||||
std::wstring strOleRelsPath;
|
||||
|
||||
oRelsGeneratorInfo.nOleRId = m_lNextRelsID++;
|
||||
@ -1222,7 +1302,29 @@ namespace NSBinPptxRW
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(additionalFile.is<OOX::Media>())
|
||||
{
|
||||
smart_ptr<OOX::Media> mediaFile = additionalFile.smart_dynamic_cast<OOX::Media>();
|
||||
|
||||
std::wstring strMediaRelsPath;
|
||||
|
||||
oRelsGeneratorInfo.nMediaRId = m_lNextRelsID++;
|
||||
oRelsGeneratorInfo.sFilepathOle = mediaFile->filename().GetPath();
|
||||
|
||||
if (m_pManager->m_nDocumentType != XMLWRITER_DOC_TYPE_XLSX)
|
||||
{
|
||||
std::wstring strRid = L"rId" + std::to_wstring(oRelsGeneratorInfo.nMediaRId);
|
||||
|
||||
if (m_pManager->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) strMediaRelsPath = L"media/";
|
||||
else strMediaRelsPath = L"../media/";
|
||||
|
||||
strMediaRelsPath += mediaFile->filename().GetFilename();
|
||||
|
||||
m_pWriter->WriteString( L"<Relationship Id=\"" + strRid
|
||||
+ L"\" Type=\"http://schemas.microsoft.com/office/2007/relationships/media\" Target=\"" +
|
||||
strMediaRelsPath + L"\"/>");
|
||||
}
|
||||
}
|
||||
m_mapImages.insert(std::pair<std::wstring, _relsGeneratorInfo>(strImageRelsPath, oRelsGeneratorInfo));
|
||||
return oRelsGeneratorInfo;
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ class COfficeFontPicker;
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class OleObject;
|
||||
class File;
|
||||
class CContentTypes;
|
||||
class WritingElement;
|
||||
class IFileContainer;
|
||||
@ -91,7 +91,7 @@ namespace NSBinPptxRW
|
||||
|
||||
struct _imageManager2Info
|
||||
{
|
||||
std::wstring sFilepathOle;
|
||||
std::wstring sFilepathAdditional;
|
||||
std::wstring sFilepathImage;
|
||||
};
|
||||
|
||||
@ -99,7 +99,9 @@ namespace NSBinPptxRW
|
||||
{
|
||||
int nImageRId;
|
||||
int nOleRId;
|
||||
int nMediaRId;
|
||||
|
||||
std::wstring sFilepathMedia;
|
||||
std::wstring sFilepathOle;
|
||||
std::wstring sFilepathImage;
|
||||
|
||||
@ -107,6 +109,7 @@ namespace NSBinPptxRW
|
||||
{
|
||||
nImageRId = -1;
|
||||
nOleRId = -1;
|
||||
nMediaRId = -1;
|
||||
}
|
||||
};
|
||||
|
||||
@ -158,17 +161,13 @@ namespace NSBinPptxRW
|
||||
|
||||
NSShapeImageGen::CImageManager* m_pImageManager;
|
||||
|
||||
//NSFontCutter::CFontDstManager m_oFontPicker;
|
||||
|
||||
NSFontCutter::CFontDstManager* m_pNativePicker;
|
||||
COfficeFontPicker* m_pFontPicker;
|
||||
bool m_bDeleteFontPicker;
|
||||
|
||||
public:
|
||||
CCommonWriter();
|
||||
~CCommonWriter();
|
||||
|
||||
public:
|
||||
void CreateFontPicker(COfficeFontPicker* pPicker);
|
||||
void CheckFontPicker();
|
||||
};
|
||||
@ -178,7 +177,7 @@ namespace NSBinPptxRW
|
||||
private:
|
||||
std::map<std::wstring, _imageManager2Info> m_mapImages;
|
||||
_INT32 m_lIndexNextImage;
|
||||
_INT32 m_lIndexNextOle;
|
||||
_INT32 m_lIndexCounter;
|
||||
std::wstring m_strDstMedia;
|
||||
std::wstring m_strDstEmbed;
|
||||
public:
|
||||
@ -197,8 +196,8 @@ namespace NSBinPptxRW
|
||||
|
||||
int IsDisplayedImage(const std::wstring& strInput);
|
||||
|
||||
_imageManager2Info GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::OleObject> & oleFile, const std::wstring& oleData, std::wstring strBase64Image);
|
||||
_imageManager2Info GenerateImageExec(const std::wstring& strInput, const std::wstring& strExts, const std::wstring& strOleImage, const std::wstring& oleData);
|
||||
_imageManager2Info GenerateImage(const std::wstring& strInput, NSCommon::smart_ptr<OOX::File> & additionalFile, const std::wstring& oleData, std::wstring strBase64Image);
|
||||
_imageManager2Info GenerateImageExec(const std::wstring& strInput, const std::wstring& strExts, const std::wstring& strAdditionalImage, int nAdditionalType, const std::wstring& oleData);
|
||||
|
||||
void SaveImageAsPng(const std::wstring& strFileSrc, const std::wstring& strFileDst);
|
||||
void SaveImageAsJPG(const std::wstring& strFileSrc, const std::wstring& strFileDst);
|
||||
@ -426,7 +425,7 @@ namespace NSBinPptxRW
|
||||
void AddRels (const std::wstring& strRels);
|
||||
void SaveRels (const std::wstring& strFile);
|
||||
|
||||
_relsGeneratorInfo WriteImage (const std::wstring& strImage, NSCommon::smart_ptr<OOX::OleObject>& strOle, const std::wstring& oleData, std::wstring strBase64Image);
|
||||
_relsGeneratorInfo WriteImage (const std::wstring& strImage, NSCommon::smart_ptr<OOX::File>& additionalFile, const std::wstring& oleData, std::wstring strBase64Image);
|
||||
};
|
||||
|
||||
class CBinaryFileReader
|
||||
|
||||
@ -303,7 +303,6 @@ namespace NSPresentationEditor
|
||||
|
||||
std::vector <std::wstring> m_oQuery;
|
||||
|
||||
public:
|
||||
CAnimationInfo() : m_arAnimations()
|
||||
{
|
||||
}
|
||||
@ -323,7 +322,6 @@ namespace NSPresentationEditor
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// std::wstring ToXml(const double& dStartTime, const double& dEndTime, bool bIgnore = false)
|
||||
// {
|
||||
@ -453,13 +451,5 @@ namespace NSPresentationEditor
|
||||
// return baseXML;
|
||||
// }
|
||||
|
||||
inline std::wstring FormatXml ()
|
||||
{
|
||||
std::wstring Xml;
|
||||
for ( long i = 0; i < (long)m_oQuery.size(); ++i )
|
||||
Xml += m_oQuery[i];
|
||||
|
||||
return Xml;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -905,8 +905,6 @@ namespace NSPresentationEditor
|
||||
std::wstring Panose;
|
||||
bool Monospace;
|
||||
|
||||
public:
|
||||
|
||||
bool IsEqual(CFont* pFont)
|
||||
{
|
||||
if (NULL == pFont)
|
||||
@ -974,8 +972,7 @@ namespace NSPresentationEditor
|
||||
Monospace = false;
|
||||
}
|
||||
|
||||
public:
|
||||
CFont()
|
||||
CFont()
|
||||
{
|
||||
SetDefaultParams();
|
||||
}
|
||||
@ -1034,8 +1031,6 @@ namespace NSPresentationEditor
|
||||
int PerspectiveX;
|
||||
int PerspectiveY;
|
||||
|
||||
public:
|
||||
|
||||
void SetDefaultParams()
|
||||
{
|
||||
Visible = false;
|
||||
@ -1060,8 +1055,6 @@ namespace NSPresentationEditor
|
||||
Color.SetRGB(0x80, 0x80, 0x80);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
CShadow()
|
||||
{
|
||||
SetDefaultParams();
|
||||
@ -1123,8 +1116,6 @@ namespace NSPresentationEditor
|
||||
CColor Color;
|
||||
long Alpha;
|
||||
|
||||
public:
|
||||
|
||||
void SetDefaultParams()
|
||||
{
|
||||
Visible = 0;
|
||||
@ -1133,8 +1124,6 @@ namespace NSPresentationEditor
|
||||
Alpha = 255;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
CEdgeText()
|
||||
{
|
||||
SetDefaultParams();
|
||||
@ -1172,7 +1161,6 @@ namespace NSPresentationEditor
|
||||
int m_nTextAlignVertical;
|
||||
double m_dTextRotate;
|
||||
|
||||
public:
|
||||
CTextAttributes() : m_oFont(), m_oTextBrush(), m_oTextShadow(), m_oTextEdge()
|
||||
{
|
||||
m_oFont.Size = 36;
|
||||
@ -1196,4 +1184,6 @@ namespace NSPresentationEditor
|
||||
return (*this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -89,315 +89,6 @@ namespace NSPresentationEditor
|
||||
}
|
||||
m_arNotes.clear();
|
||||
}
|
||||
|
||||
#if defined (_DEBUG)
|
||||
std::wstring GetXmlSlideTransition ( CSlide& oSlide/*, CAudioOverlay& oAudioOverlay*/ )
|
||||
{
|
||||
std::wstring Source = std::wstring ( _T("") );
|
||||
|
||||
int EffectID = 1;
|
||||
int lEffectDirection = oSlide.m_oSlideShow.m_oTransition.m_nEffectDirection;
|
||||
|
||||
switch ( oSlide.m_oSlideShow.m_oTransition.m_nEffectType )
|
||||
{
|
||||
case 0 : // Cut
|
||||
{
|
||||
// Отрабатывается выше ( выкидывать слайд, или вставлять на несколько ms )
|
||||
}
|
||||
break;
|
||||
case 1 : // Random //
|
||||
{
|
||||
// рандом вставить
|
||||
EffectID = 1; // Fade Solid Smal
|
||||
}
|
||||
break;
|
||||
case 2 : // Blinds
|
||||
{
|
||||
if ( 0x00 == lEffectDirection ) // Vertical // Slide Side Top To Bottom
|
||||
EffectID = 1003;
|
||||
if ( 0x01 == lEffectDirection ) // Horizontal // Slide Side Left To Righ
|
||||
EffectID = 1001;
|
||||
}
|
||||
break;
|
||||
case 3 : // Checker
|
||||
{
|
||||
if ( 0x00 == lEffectDirection ) // Horizontal // WipeCheckerRightToLef
|
||||
EffectID = 2901;
|
||||
if ( 0x01 == lEffectDirection ) // Vertical // WipeCheckerTopToBottom
|
||||
EffectID = 2903;
|
||||
}
|
||||
break;
|
||||
case 4 : // Cover
|
||||
{
|
||||
//0x00 Left
|
||||
#pragma message ("TODO : Cover - добавить такой эффект в ImageStudio")
|
||||
//0x01 Up
|
||||
//0x02 Right
|
||||
//0x03 Down
|
||||
//0x04 Left Up
|
||||
//0x05 Right Up
|
||||
//0x06 Left Down
|
||||
//0x07 Right Down
|
||||
}
|
||||
break;
|
||||
case 5 : // Dissolve
|
||||
{
|
||||
#pragma message ("TODO : Dissolve - добавить такой эффект в ImageStudio")
|
||||
|
||||
EffectID = 1; // Fade Solid Smal
|
||||
}
|
||||
break;
|
||||
case 6 : // Fade
|
||||
{
|
||||
EffectID = 4904; // Flash Dark
|
||||
}
|
||||
break;
|
||||
case 7 : // Uncover
|
||||
{
|
||||
#pragma message ("TODO : Uncover - добавить такой эффект в ImageStudio")
|
||||
//0x00 Left
|
||||
//0x01 Up
|
||||
//0x02 Right
|
||||
//0x03 Down
|
||||
//0x04 Left Up
|
||||
//0x05 Right Up
|
||||
//0x06 Left Down
|
||||
//0x07 Right Down
|
||||
}
|
||||
break;
|
||||
case 8 : // Random Bars
|
||||
{
|
||||
if ( 0x00 == lEffectDirection ) // Horizontal
|
||||
EffectID = 5331;
|
||||
if ( 0x01 == lEffectDirection ) // Vertical
|
||||
EffectID = 5332;
|
||||
}
|
||||
break;
|
||||
case 9 : // Strips
|
||||
{
|
||||
if ( 0x04 == lEffectDirection ) // Left Up // Mosaic Right Bottom
|
||||
EffectID = 110;
|
||||
if ( 0x05 == lEffectDirection ) // Right Up // Mosaic Left Bottom
|
||||
EffectID = 111;
|
||||
if ( 0x06 == lEffectDirection ) // Left Down // Mosaic Right Top
|
||||
EffectID = 109;
|
||||
if ( 0x07 == lEffectDirection ) // Right Down // Mosaic Left Top
|
||||
EffectID = 108;
|
||||
}
|
||||
break;
|
||||
case 10: // Wipe
|
||||
{
|
||||
if ( 0x00 == lEffectDirection ) // Left // Reveal, Left
|
||||
EffectID = 5322;
|
||||
if ( 0x01 == lEffectDirection ) // Up // Reveal, Up
|
||||
EffectID = 5323;
|
||||
if ( 0x02 == lEffectDirection ) // Right // Reveal, Right
|
||||
EffectID = 5321;
|
||||
if ( 0x03 == lEffectDirection ) // Down // Reveal, Down
|
||||
EffectID = 5320;
|
||||
}
|
||||
break;
|
||||
case 11: // Box In/Out
|
||||
{
|
||||
if ( 0x00 == lEffectDirection ) // Wipe Center Box Out
|
||||
EffectID = 702;
|
||||
if ( 0x01 == lEffectDirection ) // Wipe Center Box In
|
||||
EffectID = 701;
|
||||
}
|
||||
break;
|
||||
case 13 :// Split
|
||||
{
|
||||
if ( 0x00 == lEffectDirection ) // Horizontally out // Split, Horizontal
|
||||
EffectID = 5324;
|
||||
#pragma message ("TODO : Split Horizontal In - добавить такой эффект в ImageStudio")
|
||||
if ( 0x01 == lEffectDirection ) // Horizontally in //
|
||||
EffectID = 5324;
|
||||
if ( 0x02 == lEffectDirection ) // Vertically out // Split, Vertical
|
||||
EffectID = 5325;
|
||||
#pragma message ("TODO : Split Vertical In - добавить такой эффект в ImageStudio")
|
||||
if ( 0x03 == lEffectDirection ) // Vertically in //
|
||||
EffectID = 5325;
|
||||
}
|
||||
break;
|
||||
case 17 : // Diamond
|
||||
{
|
||||
EffectID = 704; // Wipe Center Diamond Out
|
||||
}
|
||||
break;
|
||||
case 18 : // Plus
|
||||
{
|
||||
EffectID = 708; // Wipe Center Cross Out
|
||||
}
|
||||
break;
|
||||
case 19 : // Wedge
|
||||
{
|
||||
EffectID = 3006; // Clock Top Opposite
|
||||
}
|
||||
break;
|
||||
case 20 : // Push
|
||||
{
|
||||
if ( 0x00 == lEffectDirection ) // Left // Push Side Right To Left
|
||||
EffectID = 1402;
|
||||
if ( 0x01 == lEffectDirection ) // Up // Push Side Bottom To Top
|
||||
EffectID = 1404;
|
||||
if ( 0x02 == lEffectDirection ) // Right // Push Side Left To Right
|
||||
EffectID = 1401;
|
||||
if ( 0x03 == lEffectDirection ) // Down // Push Side Top To Bottom
|
||||
EffectID = 1403;
|
||||
}
|
||||
break;
|
||||
case 21 : // Comb
|
||||
{
|
||||
if ( 0x00 == lEffectDirection ) // Horizontal // MosaicStrips
|
||||
EffectID = 103;
|
||||
#pragma message ("TODO : MosaicStrips Vertical - добавить такой эффект в ImageStudio")
|
||||
if ( 0x01 == lEffectDirection ) // Vertical // MosaicStrips
|
||||
EffectID = 103;
|
||||
}
|
||||
break;
|
||||
case 22 : // Newsflash
|
||||
{
|
||||
EffectID = 313; // Rotate Twice Out Clockwise
|
||||
}
|
||||
break;
|
||||
case 23 :// AlphaFade
|
||||
{
|
||||
EffectID = 1; // Fade Solid Smal
|
||||
}
|
||||
break;
|
||||
case 26 : // Wheel
|
||||
{
|
||||
if ( 0x01 == lEffectDirection ) // ClockBottomReverse
|
||||
EffectID = 3004;
|
||||
if ( 0x02 == lEffectDirection ) // Clock2AnglesClockwise
|
||||
EffectID = 3013;
|
||||
if ( 0x03 == lEffectDirection ) // Clock4AnglesClockwise
|
||||
EffectID = 3017;
|
||||
if ( 0x04 == lEffectDirection ) // Clock6AnglesClockwise
|
||||
EffectID = 3019;
|
||||
if ( 0x08 == lEffectDirection ) // Clock8AnglesClockwise
|
||||
EffectID = 3021;
|
||||
}
|
||||
break;
|
||||
case 27 : // Circle
|
||||
{
|
||||
EffectID = 706; // Wipe Center Circle Out
|
||||
}
|
||||
break;
|
||||
default :
|
||||
{
|
||||
return Source;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Source = L"<VideoCompose Time=\"" + std::to_wstring(oSlide.m_oSlideShow.m_oTransition.m_dSpeed) + L"\" effectid=\"" + std::to_wstring(EffectID) + L"\"/>";
|
||||
|
||||
/*
|
||||
|
||||
if (oSlide.m_oSlideShow.m_oTransition.m_bAudioPresent)
|
||||
{
|
||||
CAudioElement oAudioElem;
|
||||
|
||||
oAudioElem.m_dStartTime = oSlide.m_dStartTime - oSlide.m_oSlideShow.m_oTransition.m_dSpeed;
|
||||
oAudioElem.m_dEndTime = oAudioOverlay.m_dAllDuration;
|
||||
oAudioElem.m_strFileName = oSlide.m_oSlideShow.m_oTransition.m_oAudio.m_strFileName;
|
||||
|
||||
CAudioPart oPart(&oAudioElem);
|
||||
oPart.m_bStop = oSlide.m_oSlideShow.m_oTransition.m_bStopSound;
|
||||
oPart.m_bLoop = oSlide.m_oSlideShow.m_oTransition.m_bLoopSound;
|
||||
oPart.m_bIsTransition = true;
|
||||
|
||||
oAudioOverlay.m_arParts.Add(oPart);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
return Source;
|
||||
}
|
||||
#endif
|
||||
double CalculateTimes(CAudioOverlay& oAudioOverlay)
|
||||
{
|
||||
CaclulateSlideTimes();
|
||||
|
||||
int lCount = (LONG)m_arSlides.size();
|
||||
|
||||
double dAllDuration = 0;
|
||||
if (lCount > 0)
|
||||
{
|
||||
dAllDuration = m_arSlides[lCount - 1]->m_dEndTime;
|
||||
}
|
||||
|
||||
oAudioOverlay.m_dAllDuration = dAllDuration;
|
||||
|
||||
for (LONG i = 0; i < lCount; ++i)
|
||||
{
|
||||
CalculateSlideElements(i, oAudioOverlay);
|
||||
}
|
||||
|
||||
return dAllDuration;
|
||||
}
|
||||
|
||||
void CaclulateSlideTimes()
|
||||
{
|
||||
double Transition1 = 0;
|
||||
double Duration = 0;
|
||||
double Transition2 = 0;
|
||||
|
||||
int nCount = (int)m_arSlides.size();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
CSlide* pSlide = m_arSlides[i];
|
||||
|
||||
double dSlideDuration = 0;
|
||||
if (pSlide->m_oSlideShow.m_dSlideDuration > 0)
|
||||
{
|
||||
dSlideDuration = m_arSlides[i]->m_oSlideShow.m_dSlideDuration;
|
||||
}
|
||||
if (0 == dSlideDuration)
|
||||
{
|
||||
// решено сделать так: если время слайда не выставлено - то берем максимальную
|
||||
// длительность видео, лежащего на нем. Если таких нет - то дефолтовая длительность,
|
||||
// впрочем она уже выставлена
|
||||
|
||||
size_t nSize = pSlide->m_arElements.size();
|
||||
for (size_t j = 0; j < nSize; ++j)
|
||||
{
|
||||
if (etVideo == pSlide->m_arElements[j]->m_etType)
|
||||
{
|
||||
dSlideDuration = (std::max)(dSlideDuration, ((CVideoElement*)pSlide->m_arElements[j])->m_dVideoDuration);
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == dSlideDuration)
|
||||
{
|
||||
dSlideDuration = pSlide->m_dDuration;
|
||||
}
|
||||
}
|
||||
|
||||
pSlide->m_dDuration = dSlideDuration;
|
||||
|
||||
Transition1 = pSlide->m_oSlideShow.m_oTransition.m_dSpeed;
|
||||
|
||||
if (i < (nCount - 1))
|
||||
Transition2 = m_arSlides[i + 1]->m_oSlideShow.m_oTransition.m_dSpeed;
|
||||
|
||||
Duration = pSlide->m_dDuration;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
pSlide->m_dStartTime = Transition1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSlide->m_dStartTime = m_arSlides[i-1]->m_dStartTime + m_arSlides[i-1]->m_dDuration;
|
||||
}
|
||||
|
||||
pSlide->m_dDuration = Transition1 + Duration + Transition2;
|
||||
pSlide->m_dEndTime = pSlide->m_dStartTime + pSlide->m_dDuration;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateSlideElements(int nIndex, CAudioOverlay& oAudioOverlay)
|
||||
{
|
||||
double dStartTime = m_arSlides[nIndex]->m_dStartTime;
|
||||
@ -413,16 +104,6 @@ namespace NSPresentationEditor
|
||||
|
||||
switch (pElement->m_etType)
|
||||
{
|
||||
//case etPicture:
|
||||
//case etShape:
|
||||
//case etVideo:
|
||||
//case etText:
|
||||
// {
|
||||
// //pElement->m_dStartTime = 0;
|
||||
// //pElement->m_dEndTime = dDuration;
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
case etAudio:
|
||||
{
|
||||
CAudioElement* pAudioElem = dynamic_cast<CAudioElement*>(pElement);
|
||||
@ -520,8 +201,6 @@ namespace NSPresentationEditor
|
||||
|
||||
pElement->m_oMetric = m_oInfo;
|
||||
pElement->NormalizeCoords(dScaleX, dScaleY);
|
||||
|
||||
pElement->SetupProperties(NULL, pTheme, NULL);
|
||||
}
|
||||
|
||||
size_t nCountLayouts = pTheme->m_arLayouts.size();
|
||||
@ -591,8 +270,6 @@ namespace NSPresentationEditor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pElement->SetupProperties(NULL, pTheme, pLayout);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -631,8 +308,6 @@ namespace NSPresentationEditor
|
||||
pElement->m_pLayout = pLayout;
|
||||
|
||||
pElement->m_oMetric = m_oInfo;
|
||||
|
||||
pElement->SetupProperties(pSlide, pTheme, pLayout);
|
||||
}
|
||||
|
||||
if (NULL != pLayout && bIsPlaceholderSetUp)
|
||||
|
||||
@ -33,7 +33,6 @@
|
||||
#include "TextAttributesEx.h"
|
||||
#include "Interactive.h"
|
||||
#include "Animations.h"
|
||||
#include "ElementProperties.h"
|
||||
|
||||
namespace NSPresentationEditor
|
||||
{
|
||||
@ -127,6 +126,9 @@ namespace NSPresentationEditor
|
||||
|
||||
class IElement
|
||||
{
|
||||
protected:
|
||||
ULONG m_lCountRef;
|
||||
|
||||
public:
|
||||
ElementType m_etType;
|
||||
CDoubleRect m_rcBounds;
|
||||
@ -136,7 +138,9 @@ namespace NSPresentationEditor
|
||||
double m_dStartTime;
|
||||
double m_dEndTime;
|
||||
|
||||
CTextInteractiveInfo m_oTextActions;
|
||||
CInteractiveInfo m_oActions;
|
||||
|
||||
CAnimationInfo m_oAnimations;
|
||||
CEffects m_oEffects;
|
||||
|
||||
@ -169,8 +173,6 @@ namespace NSPresentationEditor
|
||||
|
||||
bool m_bIsChangeable; // можно ли редактировать элемент
|
||||
|
||||
CElementProperties m_oProperties;
|
||||
|
||||
CTheme* m_pTheme;
|
||||
CLayout* m_pLayout;
|
||||
|
||||
@ -179,11 +181,6 @@ namespace NSPresentationEditor
|
||||
|
||||
std::wstring m_sHyperlink;
|
||||
|
||||
protected:
|
||||
ULONG m_lCountRef;
|
||||
|
||||
public:
|
||||
|
||||
virtual ULONG AddRef()
|
||||
{
|
||||
++m_lCountRef;
|
||||
@ -200,8 +197,6 @@ namespace NSPresentationEditor
|
||||
return m_lCountRef;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
IElement()
|
||||
{
|
||||
m_bIsBackground = false;
|
||||
@ -268,6 +263,7 @@ namespace NSPresentationEditor
|
||||
m_rcBoundsOriginal.top = dScaleY * m_rcBounds.top;
|
||||
m_rcBoundsOriginal.bottom = dScaleY * m_rcBounds.bottom;
|
||||
}
|
||||
virtual IElement* CreateDublicate() = 0;
|
||||
|
||||
protected:
|
||||
virtual void SetProperiesToDublicate(IElement* pDublicate)
|
||||
@ -295,6 +291,7 @@ namespace NSPresentationEditor
|
||||
pDublicate->m_lLayoutID = m_lLayoutID;
|
||||
|
||||
pDublicate->m_oActions = m_oActions;
|
||||
pDublicate->m_oTextActions = m_oTextActions;
|
||||
pDublicate->m_oAnimations = m_oAnimations;
|
||||
pDublicate->m_oEffects = m_oEffects;
|
||||
|
||||
@ -307,7 +304,6 @@ namespace NSPresentationEditor
|
||||
pDublicate->m_nFormatDate = m_nFormatDate;
|
||||
|
||||
pDublicate->m_oMetric = m_oMetric;
|
||||
pDublicate->m_oProperties = m_oProperties;
|
||||
|
||||
pDublicate->m_dRotate = m_dRotate;
|
||||
pDublicate->m_bFlipH = m_bFlipH;
|
||||
@ -321,29 +317,5 @@ namespace NSPresentationEditor
|
||||
pDublicate->m_oBrush = m_oBrush;
|
||||
pDublicate->m_oShadow = m_oShadow;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual void SetupProperties(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout)
|
||||
{
|
||||
std::map<CElementProperty::Type, CElementProperty>* pMap = &m_oProperties.m_arProperties;
|
||||
|
||||
for (std::map<CElementProperty::Type, CElementProperty>::iterator pPair = pMap->begin(); pPair != pMap->end(); ++pPair)
|
||||
{
|
||||
CElementProperty oProperty = pPair->second;
|
||||
SetupProperty(pSlide, pTheme, pLayout, &oProperty);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetupProperty(CSlide* pSlide, CTheme* pTheme, CLayout* pLayout, CElementProperty* pProperty) = 0;
|
||||
virtual IElement* CreateDublicate() = 0;
|
||||
|
||||
virtual std::wstring SerializeToXml()
|
||||
{
|
||||
std::wstring strElement;
|
||||
// strElement.Format(_T("<Element type='%d' id='%d' lid='%d' pid='%d' ptp='%d' />"),
|
||||
// (int)m_etType, m_lID, m_lLayoutID, m_lPlaceholderID, m_lPlaceholderType);
|
||||
return strElement;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user