Commit 85226c08 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation audio backgrounds

parent fecefb67
......@@ -2424,13 +2424,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";
......@@ -2472,7 +2489,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();
......
......@@ -167,7 +167,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)
......@@ -284,7 +284,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;
}
}
......
......@@ -211,8 +211,22 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
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 = odf_context()->add_media(pathMedia);
std::wstring odf_ref = odf_context()->add_media(pathMedia);
if (!odf_ref.empty())
{
......
......@@ -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;
}
......
......@@ -129,6 +129,8 @@ namespace PPTX
return smart_ptr<OOX::File>(new OOX::Image(filename));
else if (relation.Type() == OOX::FileTypes::Audio)
return smart_ptr<OOX::File>(new OOX::Audio(filename));
else if (relation.Type() == OOX::FileTypes::Media)
return smart_ptr<OOX::File>(new OOX::Media(filename));
else if (relation.Type() == OOX::FileTypes::Video)
return smart_ptr<OOX::File>(new OOX::Video(filename));
else if (relation.Type() == OOX::FileTypes::Data)
......
......@@ -144,6 +144,10 @@ namespace OOX
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"));
const FileType Media (L"media", L"media",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/media"));
const FileType Data (L"diagrams", L"data.xml",
_T("application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData"));
......
......@@ -50,8 +50,6 @@ namespace OOX
virtual ~Audio()
{
}
public:
virtual const FileType type() const
{
return FileTypes::Audio;
......
......@@ -53,7 +53,10 @@ namespace OOX
virtual ~Media()
{
}
virtual const FileType type() const
{
return FileTypes::Media;
}
virtual void read(const CPath& filename)
{
m_filename = filename;
......@@ -78,7 +81,15 @@ namespace OOX
void copy_to(const CPath& path) const
{
}
virtual const CPath DefaultDirectory() const
{
if (m_bDocument) return type().DefaultDirectory();
else return L"../" + type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return m_filename.GetFilename();
}
protected:
CPath m_filename;
bool m_bDocument; //for upper/lower level rels (defaultDirectory)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment