Files
core/ASCOfficeOdtFile/Source/DocxFormat/Media/Image.cpp
Elen.Subbotina 8c7afb377a (1.0.1.110): ASCOfficeOdtFile
проект теперь стал ПОЛНОСТЬЮ независимым от исходников других библиотек в других местах 

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53782 954022d7-b5bf-4e40-9824-e11837661b57
2016-05-20 22:39:07 +03:00

79 lines
1.8 KiB
C++

// auto inserted precompiled begin
#include "precompiled_docxformat.h"
// auto inserted precompiled end
#include "Image.h"
#include "..\FileTypes.h"
#include <boost/algorithm/string/replace.hpp>
//#include "OfficeSvmFile.h"
//#include "SvmConverter.h"
#include "FileNameUtility.h"
namespace OOX
{
Image::Image()
{
}
Image::Image(const boost::filesystem::wpath& filename)
{
read(filename);
}
Image::~Image()
{
}
void Image::write(const boost::filesystem::wpath& filename, const boost::filesystem::wpath& directory, ContentTypes::File& content) const
{
std::wstring newFilename = filename.filename();
boost::filesystem::wpath newFilePath = filename.parent_path();
boost::replace_all(newFilename, L" ", L"_");
if (boost::filesystem::exists(m_filename) && !boost::filesystem::exists(newFilePath/newFilename))
{
//if (m_filename.extension() == L".svm")
//{
// ConvertSvmToImage(m_filename, replace_extension(newFilePath/newFilename, L"png"));
//}
//else
if (m_filename.extension() != L"")
{
boost::filesystem::copy_file(m_filename, newFilePath/newFilename);
}
else
{
newFilename += L".wmf";
boost::filesystem::copy_file(m_filename, newFilePath/newFilename);
}
}
//if (m_filename.extension() == L".svm")
// content.Default->add(replace_extension(newFilePath/newFilename, L"png"));
//else
content.Default->add(newFilePath/newFilename);
}
const FileType Image::type() const
{
return FileTypes::Image;
}
const boost::filesystem::wpath Image::DefaultDirectory() const
{
return type().DefaultDirectory();
}
const boost::filesystem::wpath Image::DefaultFileName() const
{
return m_filename.filename();
}
} // namespace OOX