Commit f1f25c21 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

OdfFile Writer

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62596 954022d7-b5bf-4e40-9824-e11837661b57
parent 17991310
#include "precompiled_cpodf.h"
#include "abstract_xml.h"
......
#include "precompiled_cpodf.h"
#include "calcext_elements.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "draw_base.h"
#include <ostream>
......
#include "precompiled_cpodf.h"
#include "draw_frame.h"
#include <ostream>
......
#include "precompiled_cpodf.h"
#include "draw_shapes.h"
#include <ostream>
......@@ -8,6 +8,7 @@
#include <boost/foreach.hpp>
#include <boost_string.h>
#include <regex.h>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/xml/xmlchar.h>
......
#include "precompiled_cpodf.h"
#include "header_footer.h"
#include <cpdoccore/xml/attributes.h>
......
#include "precompiled_cpodf.h"
#include "list.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <iostream>
......
#include "precompiled_cpodf.h"
#include "mediaitems.h"
#include "odf_rels.h"
#include <regex.h>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <cpdoccore/xml/utils.h>
#include "mediaitems_utils.h"
#include <cpdoccore/common/boost_filesystem_version.h>
namespace cpdoccore {
namespace odf {
using boost::filesystem::wpath;
_mediaitems::item::item( std::wstring const & _oox_ref,
Type _type,
std::wstring const & _odf_ref
......@@ -30,8 +26,6 @@ _mediaitems::item::item( std::wstring const & _oox_ref,
}
namespace fs = boost::filesystem;
void _mediaitems::add_or_find(const std::wstring & oox_ref, Type type, std::wstring & odf_ref)
{
std::wstring output_sub_path;//
......
#include "precompiled_cpodf.h"
#include "mediaitems_utils.h"
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <cpdoccore/common/boost_filesystem_version.h>
namespace cpdoccore {
namespace odf{
......@@ -13,8 +11,6 @@ namespace utils {
namespace media {
using boost::filesystem::wpath;
std::wstring get_rel_type(_mediaitems::Type type)
{
switch (type)
......@@ -39,11 +35,12 @@ std::wstring get_default_file_name(_mediaitems::Type type)
std::wstring create_file_name(const std::wstring & uri, _mediaitems::Type type, size_t Num)
{
#ifdef BOOST_FILESYSTEM_LEGACY
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + wpath(uri).extension();
#else
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + wpath(uri).extension().string<std::wstring>();
#endif
std::wstring sExt;
int n = uri.rfind(L".");
if (n>=0) sExt = uri.substr(n);
//todooo
return get_default_file_name(type) + boost::lexical_cast<std::wstring>(Num) + sExt;
}
......
#include "precompiled_cpodf.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include <boost/foreach.hpp>
#include <cpdoccore/utf8cpp/utf8.h>
......@@ -9,6 +9,9 @@
#include "../../../DesktopEditor/common/File.h"
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
namespace cpdoccore
{
namespace odf
......@@ -26,7 +29,7 @@ namespace odf
void simple_element::write(const std::wstring & RootPath)
{
NSFile::CBinaryFile file;
NSFile::CFileBinary file;
if (file.CreateFileW( RootPath + FILE_SEPARATOR_STR + file_name_ ) == true)
{
......@@ -94,10 +97,10 @@ namespace odf
rels_.serialize(CP_XML_STREAM());
}
}
fs::wpath path = fs::wpath(RootPath) / L"META-INF";
fs::create_directory(path);
std::wstring path = RootPath + FILE_SEPARATOR + L"META-INF";
FileSystem::Directory::CreateDirectory(path);
simple_element elm(L"manifest.xml", resStream.str());
elm.write(path.string());
elm.write(path);
}
void meta_file::write(const std::wstring & RootPath)
......@@ -186,7 +189,7 @@ namespace odf
try
{
boost::filesystem::copy_file(item.oox_ref, file_name_out);
NSFile::CFileBinary::Copy(item.oox_ref, file_name_out);
}catch (...)
{
}
......@@ -255,10 +258,10 @@ namespace odf
long count = 0;
BOOST_FOREACH(const element_ptr & item, objects_)
{
fs::wpath path = fs::wpath(RootPath) / item->local_path;
fs::create_directory(path);
std::wstring path = RootPath + FILE_SEPARATOR_STR + item->local_path;
FileSystem::Directory::CreateDirectory(path);
item->write(path.string());
item->write(path);
}
if (manifest_) manifest_->write(RootPath);
if (mimetype_) mimetype_->write(RootPath);
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
......
#include "precompiled_cpodf.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include "office_spreadsheet.h"
#include "office_chart.h"
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include "odf_drawing_context.h"
......
#include "precompiled_cpodf.h"
#include "logging.h"
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include "odf_page_layout_state.h"
......
#include "precompiled_cpodf.h"
#include <boost/foreach.hpp>
......
#pragma once
#include <vector>
#include <string>
#include <iosfwd>
//#include <iosfwd>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/CPSharedPtr.h>
......
#include "precompiled_cpodf.h"
#include "odf_style_context.h"
#include "ods_conversion_context.h"
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include "odf_style_state.h"
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "logging.h"
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include <boost/foreach.hpp>
#include <boost/regex.hpp>
#include <iostream>
#include "odf_text_context.h"
......
#include "precompiled_cpodf.h"
#include "../utils.h"
......
#include "precompiled_cpodf.h"
#include "ods_table_context.h"
#include "table.h"
......
#include "precompiled_cpodf.h"
#include "logging.h"
#include "../../../ASCOfficeOdfFile/formulasconvert/include/cpdoccore/formulasconvert.h"
......@@ -40,15 +40,16 @@ std::wstring convert_date(std::wstring & oox_date)
{
return oox_date;
}
//todoooo !!!!
boost::gregorian::date date_ = boost::gregorian::date(1900, 1, 1) + boost::gregorian::date_duration(iDate-2);
//boost::gregorian::date date_ = boost::gregorian::date(1900, 1, 1) + boost::gregorian::date_duration(iDate-2);
//to for example, "1899-12-31T05:37:46.66569
std::wstring date_str = boost::lexical_cast<std::wstring>(date_.year())
+ L"-" +
(date_.month() < 10 ? L"0": L"") + boost::lexical_cast<std::wstring>(date_.month())
+ L"-" +
(date_.day() < 10 ? L"0": L"") + boost::lexical_cast<std::wstring>(date_.day());
////to for example, "1899-12-31T05:37:46.66569
std::wstring date_str = L"";//boost::lexical_cast<std::wstring>(date_.year())
// + L"-" +
// (date_.month() < 10 ? L"0": L"") + boost::lexical_cast<std::wstring>(date_.month())
// + L"-" +
// (date_.day() < 10 ? L"0": L"") + boost::lexical_cast<std::wstring>(date_.day());
return date_str;
}
......@@ -68,14 +69,16 @@ std::wstring convert_time(std::wstring & oox_time)
int hours=0, minutes=0;
double sec=0;
boost::posix_time::time_duration day(24, 0, 0);
//todooo !!!
//boost::posix_time::time_duration day(24, 0, 0);
//
//double millisec = day.total_milliseconds() * dTime;
double millisec = day.total_milliseconds() * dTime;
sec = millisec /1000.;
hours = sec/60./60.;
minutes = (sec - (hours * 60 * 60))/60.;
sec = sec - (hours *60 + minutes) * 60.;
//sec = millisec /1000.;
//hours = sec/60./60.;
//minutes = (sec - (hours * 60 * 60))/60.;
//sec = sec - (hours *60 + minutes) * 60.;
int sec1 = sec;
......
......@@ -4,6 +4,7 @@
#include <vector>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include "odf_drawing_context.h"
......
#include "precompiled_cpodf.h"
#include <boost/regex.hpp>
#include "../utils.h"
......
#include "precompiled_cpodf.h"
#include "office_annotation.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "office_body.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "office_chart.h"
......
#include "precompiled_cpodf.h"
#include "office_elements_create.h"
#include <iostream>
#include <boost/thread/mutex.hpp>
#include <boost/thread/shared_mutex.hpp>
#include "logging.h"
namespace cpdoccore {
namespace odf {
namespace {
static boost::mutex create_lock_;
}
office_element_creator * office_element_creator::instance_ = NULL;
office_element_creator::office_element_creator() : rw_lock_( new boost::shared_mutex() )
office_element_creator::office_element_creator()
{
}
......@@ -24,8 +18,6 @@ office_element_ptr office_element_creator::create(const ::std::wstring & ns, con
{
const std::wstring fullName = ns + (ns.size() > 0 ? L":" : L"") + name;
boost::shared_lock< boost::shared_mutex > lock( *rw_lock_ );
MapType::const_iterator i = map_.find( fullName );
if (i != map_.end() )
{
......@@ -53,7 +45,6 @@ office_element_creator * office_element_creator::get()
{
if (!instance_)
{
boost::mutex::scoped_lock lock(create_lock_);
if (!instance_)
{
office_element_creator * temp = new office_element_creator();
......@@ -68,8 +59,6 @@ bool office_element_creator::register_element(const std::wstring &ns, const std:
{
const std::wstring fullName = ns + (ns.size() > 0 ? L":" : L"") + name;
boost::unique_lock< boost::shared_mutex > lock( *rw_lock_ );
MapType::iterator i = map_.find( fullName );
if ( i == map_.end() )
{
......
......@@ -2,16 +2,11 @@
#include <string>
#include <map>
#include <boost/function.hpp>
#include <cpdoccore/CPAssert.h>
#include <cpdoccore/CPSharedPtr.h>
#include "office_elements.h"
namespace boost {
class shared_mutex;
}
namespace cpdoccore {
namespace odf {
......@@ -49,7 +44,6 @@ public:
private:
office_element_creator();
static office_element_creator * instance_;
shared_ptr<boost::shared_mutex>::Type rw_lock_;
};
/// ,
......@@ -73,7 +67,6 @@ public:
{
if (class_registered_++ == 0)
{
// Jerry Schwarz counter
office_element_creator::get()->register_element(T::ns, T::name, &CreateImpl_<T>::create);
}
};
......
#include "precompiled_cpodf.h"
#include "office_spreadsheet.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "office_text.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include "Shapes\oox_shapeMaths.h"
#include "Shapes\oox_shapeSnipRoundRects.h"
......
#include "precompiled_cpodf.h"
#include "paragraph_elements.h"
#include <ostream>
......
#include "precompiled_cpodf.h"
\ No newline at end of file
#pragma once
#include <string>
#include <map>
#include <vector>
#include <ostream>
#include <boost/optional.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
static float getDefaultDpi(){return 96;}
#include "precompiled_cpodf.h"
#include "style_chart_properties.h"
#include <iostream>
......
#include "precompiled_cpodf.h"
#include <iostream>
#include "style_graphic_properties.h"
......
#include "precompiled_cpodf.h"
#include "style_map.h"
#include <boost/foreach.hpp>
......
#include "precompiled_cpodf.h"
#include <cpdoccore/xml/xmlchar.h>
......
#include "precompiled_cpodf.h"
#include <iostream>
#include "style_paragraph_properties.h"
......
#include "precompiled_cpodf.h"
#include <cpdoccore/xml/xmlchar.h>
......
#include "precompiled_cpodf.h"
#include <iostream>
#include "style_table_properties.h"
#include "borderstyle.h"
......
#include "precompiled_cpodf.h"
#include <iostream>
#include "style_text_properties.h"
......
#include "precompiled_cpodf.h"
#include "styles.h"
#include <cpdoccore/xml/xmlchar.h>
......
#include "precompiled_cpodf.h"
#include "styles_list.h"
......
#pragma once
#include "precompiled_cpodf.h"
#include "svg_creator.h"
......
#include "precompiled_cpodf.h"
#include "table.h"
#include <boost/make_shared.hpp>
......
#include "precompiled_cpodf.h"
#include "table_database_ranges.h"
#include <boost/make_shared.hpp>
......
#include "precompiled_cpodf.h"
#include "table_named_expressions.h"
#include <boost/make_shared.hpp>
......
#include "precompiled_cpodf.h"
#include "text_elements.h"
#include <boost/foreach.hpp>
......
#include "Oox2OdfConverter.h"
#include "Converter.h"
#include "../utils.h"
#include <boost/lexical_cast.hpp>
#include "XlsxConverter.h"
#include "DocxConverter.h"
......@@ -53,7 +59,7 @@ namespace Oox2Odf
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL OoxConverter::UpdateProgress(long nComplete)
bool OoxConverter::UpdateProgress(long nComplete)
{
if (pCallBack)
{
......
#pragma once
#include <boost/lexical_cast.hpp>
#include <cpdoccore/CPOptional.h>
#include "../progressCallback.h"
......@@ -12,6 +11,8 @@
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include <vector>
namespace cpdoccore
{
namespace odf
......@@ -300,7 +301,7 @@ public:
const ProgressCallback* pCallBack;
short bUserStopConvert;
BOOL UpdateProgress(long nComplete);
bool UpdateProgress(long nComplete);
//.......................................................................................................................
virtual cpdoccore::odf::odf_conversion_context *odf_context() = 0;
......@@ -436,22 +437,4 @@ public:
void convert(OOX::Vml::CVmlCommonElements *vml_attr);
};
class Converter
{
public:
Converter(const std::wstring & path, std::wstring type, const ProgressCallback* ffCallBack);
virtual ~Converter();
public:
void convert();
void write(const std::wstring & path) const;
OoxConverter * get_ooxConverter() { return impl_; }
private:
OoxConverter* impl_;
};
} // namespace Oox2Odf:Convert
} // namespace Oox2Odf
......@@ -9,6 +9,7 @@
#include "VmlShapeTypes2Oox.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include "../OdfFormat/odt_conversion_context.h"
......
#pragma once
#include "../progressCallback.h"
#include <string>
namespace Oox2Odf
{
class OoxConverter;
class Converter
{
public:
Converter(const std::wstring & path, std::wstring type, const ProgressCallback* ffCallBack);
virtual ~Converter();
public:
void convert();
void write(const std::wstring & path) const;
OoxConverter * get_ooxConverter() { return impl_; }
private:
OoxConverter* impl_;
};
} // namespace Oox2Odf
#pragma once
typedef void (*OdfOnProgressCallback)( LPVOID lpParam, long nID, long nPercent );
typedef void (*OdfOnProgressExCallback)( LPVOID lpParam, long nID, long nPercent, short* Cancel );
typedef void (*OdfOnProgressCallback)( void* lpParam, long nID, long nPercent );
typedef void (*OdfOnProgressExCallback)( void* lpParam, long nID, long nPercent, short* Cancel );
struct ProgressCallback
{
OdfOnProgressCallback OnProgress;
OdfOnProgressExCallback OnProgressEx;
LPVOID caller;
void* caller;
};
#pragma once
#include <atlbase.h>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")
#include <string>
#include <vector>
#import "../../../Redist/ASCGraphics.dll" rename_namespace("ASCGraphics")
#if defined(_WIN32) || defined(_WIN64)
#include <atlbase.h>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")
#import "../../../Redist/ASCGraphics.dll" rename_namespace("ASCGraphics")
#endif
namespace _gdi_graphics_
{
//todoooo !!!
std::pair<double,double> static GetMaxDigitSizePixelsImpl(const wchar_t * fontName, float fontSize, float dpi, long fontStyle)
{
float width = 70, height = 80;
#if defined(_WIN32) || defined(_WIN64)
CComPtr<ASCGraphics::IASCFontManager> fontMan;
HRESULT hr;
......@@ -33,14 +42,14 @@ namespace _gdi_graphics_
return std::pair<double,double>(7,8);
}
}
double maxWidth=0;
double maxWidth=0 ;
float x, y;
std::wstring TestString = L"0123456789";
if (S_OK != (hr = fontMan->LoadString2( TestString.c_str(), 0, 0)))
return std::pair<double,double>(7,8);
float x, y, width, height;
try
{
hr = fontMan->MeasureString(&x, &y, &width, &height);
......@@ -48,7 +57,7 @@ namespace _gdi_graphics_
{
return std::pair<double,double>(7,8);
}
#endif
return std::pair<double,double>(width/10.,height/10.);
}
......@@ -56,6 +65,7 @@ namespace _gdi_graphics_
bool static GetResolution(const WCHAR* fileName, double & Width, double &Height) //pt
{
bool result =false;
#if defined(_WIN32) || defined(_WIN64)
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken=0;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
......@@ -79,11 +89,13 @@ namespace _gdi_graphics_
delete file;
}
Gdiplus::GdiplusShutdown(gdiplusToken);
#endif
return result;
}
double static calculate_size_symbol(std::wstring name, double size, bool italic, bool bold, std::wstring test_str = L"")
{
double result =0;
#if defined(_WIN32) || defined(_WIN64)
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken=0;
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
......@@ -125,6 +137,7 @@ namespace _gdi_graphics_
delete gr;
}
Gdiplus::GdiplusShutdown(gdiplusToken);
#endif
return result;
}
double static calculate_size_symbol_asc(std::wstring name, double size, bool italic, bool bold)
......
......@@ -360,6 +360,10 @@
>
</File>
</Filter>
<File
RelativePath="..\Oox2OdfConverter\Oox2OdfConverter.h"
>
</File>
</Files>
<Globals>
</Globals>
......
// OfficeOdfFileW.cpp : Implementation of COfficeOdfFileW
#include "stdafx.h"
#include "OfficeOdfFileW.h"
#include "../../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
......@@ -6,11 +7,12 @@
#include <string>
#include <boost/lexical_cast.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/algorithm/string.hpp>
#include "../source/Oox2OdfConverter/Converter.h"
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../source/Oox2OdfConverter/Oox2OdfConverter.h"
#ifndef STANDALONE_USE
......@@ -19,13 +21,7 @@
// - uuid
boost::filesystem::wpath MakeTempDirectoryName(const std::wstring& Dst)
{
boost::uuids::random_generator gen;
boost::uuids::uuid u = gen();
boost::filesystem::wpath path = boost::filesystem::wpath(Dst) / boost::lexical_cast<std::wstring>(u);
return path;
}
std::wstring bstr2wstring(BSTR str)
{
return str ? std::wstring(&str[0], &str[::SysStringLen(str)]) : L"";
......@@ -45,32 +41,33 @@ STDMETHODIMP COfficeOdfFileW::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR
}
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
boost::filesystem::wpath inputDir = boost::filesystem::wpath(CString(sSrcPath)).parent_path();
std::wstring inputDir = FileSystem::Directory::GetFolderPath(std::wstring(sSrcPath));
#else
boost::filesystem::wpath inputDir = boost::filesystem::wpath(CString(sSrcPath));
std::wstring inputDir = sSrcPath;
#endif
boost::filesystem::wpath outputDir = boost::filesystem::wpath(CString(sDstFileName)).parent_path();
std::wstring outputDir = FileSystem::Directory::GetFolderPath(std::wstring(sDstFileName));
//
boost::filesystem::wpath dstTempPath = MakeTempDirectoryName(outputDir.string());
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
boost::filesystem::wpath srcTempPath = MakeTempDirectoryName(BOOST_STRING_PATH(outputDir));
std::wstring srcTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
#else
boost::filesystem::wpath srcTempPath = inputDir.string();
std::wstring srcTempPath = inputDir;
#endif
try
{
boost::filesystem::create_directory(dstTempPath);
FileSystem::Directory::CreateDirectory(dstTempPath);
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
boost::filesystem::create_directory(srcTempPath); //
FileSystem::Directory::CreateDirectory(srcTempPath); //
#endif
hr = SaveToFileImpl(bstr2wstring(sSrcPath),srcTempPath.string(), dstTempPath.string(), bstr2wstring(sDstFileName));
hr = SaveToFileImpl(bstr2wstring(sSrcPath),srcTempPath, dstTempPath, bstr2wstring(sDstFileName));
}
catch(...)
......@@ -81,7 +78,7 @@ STDMETHODIMP COfficeOdfFileW::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR
//
try
{
boost::filesystem::remove_all(dstTempPath);
FileSystem::Directory::DeleteDirectory(dstTempPath);
}
catch(...)
{
......@@ -91,7 +88,7 @@ STDMETHODIMP COfficeOdfFileW::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR
// ( )
try
{
boost::filesystem::remove_all(srcTempPath);
FileSystem::Directory::DeleteDirectory(srcTempPath);
}
catch(...)
{
......@@ -141,53 +138,12 @@ HRESULT COfficeOdfFileW::SaveToFileImpl(const std::wstring & srcPath,
return S_OK;
}
namespace fs = boost::filesystem;
//FileChecker !!
std::wstring COfficeOdfFileW::DetectTypeDocument(const std::wstring & Path)
{
fs::wpath full_path(/* fs::initial_path<fs::wpath>()*/ Path);
//full_path = fs::system_complete( fs::wpath( Path ) );
unsigned long file_count = 0;
unsigned long dir_count = 0;
unsigned long other_count = 0;
unsigned long err_count = 0;
if (!fs::exists( full_path ) )return L"";
if (!fs::is_directory( full_path ) )return L"";
fs::wdirectory_iterator end_iter;
for ( fs::wdirectory_iterator dir_itr( full_path ); dir_itr != end_iter; ++dir_itr )
{
try
{
if ( fs::is_directory( dir_itr->status() ) )
{
++dir_count;
std::wstring tmp = dir_itr->path().filename();
boost::algorithm::to_lower(tmp);
if (tmp == L"word") return L"text";
if (tmp == L"xl") return L"spreadsheet";
}
else if ( fs::is_regular_file( dir_itr->status() ) )
{
++file_count;
}
else
{
++other_count;
}
}
catch ( const std::exception & ex )
{
++err_count;
}
}
return L"";
return L"text";
//return L"spreadsheet";
}
void COfficeOdfFileW::OnProgressFunc (LPVOID lpParam, long nID, long nPercent)
......
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