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

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@61922 954022d7-b5bf-4e40-9824-e11837661b57
parent 322fe87e
......@@ -372,6 +372,9 @@ ASCOfficeRtfFile/RtfFormatLib/source svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/RtfFormatLib/source/Reader svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/RtfFormatLib/source/Writer svnc_tsvn_003alogminsize=5
ASCOfficeRtfFile/Win32 svnc_tsvn_003alogminsize=5
ASCOfficeTxtFile/TxtXmlFormatLib/Linux svnc_tsvn_003alogminsize=5
ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common svnc_tsvn_003alogminsize=5
ASCOfficeTxtFile/TxtXmlFormatLib/Win32 svnc_tsvn_003alogminsize=5
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/xls-xlsx.odp svn_mime_002dtype=application%2Foctet-stream
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/xls-xlsx_short.odp svn_mime_002dtype=application%2Foctet-stream
ASCOfficeXlsFile/ASCWorksheetConverter/Documents/22_04_09[!!-~]Презентация/Презентация[!!-~]конвертера[!!-~]XLSX.doc svn_mime_002dtype=application%2Foctet-stream
......
#include "precompiled_utility.h"
#include "Encoding.h"
#include "Utility.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include "../../../../Base/unicode_util.h"
const std::wstring Encoding::ansi2unicode(const std::string& line)
{
return std::wstring(line.begin(), line.end());//cp2unicode(line, CP_ACP);
}
const std::wstring Encoding::cp2unicode(const std::string& sline, const unsigned int codePage)
{
#ifdef _WIN32
const int nSize = MultiByteToWideChar(codePage, 0, sline.c_str(), sline.size(), NULL, 0);
wchar_t *sTemp = new wchar_t[nSize];
if (!sTemp)
return std::wstring();
int size = MultiByteToWideChar(codePage, 0, sline.c_str(), sline.size(), sTemp, nSize);
std::wstring sResult(sTemp, size);
delete []sTemp;
return sResult;
#elif __linux__
return std::wstring();
#else
return std::wstring();
#endif
}
const std::wstring Encoding::utf82unicode(const std::string& line)
{
if (sizeof(wchar_t) == 2)//utf8 -> utf16
{
unsigned __int32 nLength = line.length();
UTF16 *pStrUtf16 = new UTF16 [nLength+1];
memset ((void *) pStrUtf16, 0, sizeof (UTF16) * (nLength+1));
UTF8 *pStrUtf8 = (UTF8 *) &line[0];
// this values will be modificated
const UTF8 *pStrUtf8_Conv = pStrUtf8;
UTF16 *pStrUtf16_Conv = pStrUtf16;
ConversionResult eUnicodeConversionResult = ConvertUTF8toUTF16 (&pStrUtf8_Conv, &pStrUtf8[nLength]
, &pStrUtf16_Conv, &pStrUtf16 [nLength]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete [] pStrUtf16;
return std::wstring();
}
std::wstring utf16Str ((wchar_t *) pStrUtf16);
delete [] pStrUtf16;
return utf16Str;
}
else //utf8 -> utf32
{
unsigned __int32 nLength = line.length();
UTF32 *pStrUtf32 = new UTF32 [nLength+1];
memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength+1));
UTF8 *pStrUtf8 = (UTF8 *) &line[0];
// this values will be modificated
const UTF8 *pStrUtf8_Conv = pStrUtf8;
UTF32 *pStrUtf32_Conv = pStrUtf32;
ConversionResult eUnicodeConversionResult = ConvertUTF8toUTF32 (&pStrUtf8_Conv, &pStrUtf8[nLength]
, &pStrUtf32_Conv, &pStrUtf32 [nLength]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete [] pStrUtf32;
return std::wstring();
}
std::wstring utf32Str ((wchar_t *) pStrUtf32);
delete [] pStrUtf32;
return utf32Str;
}
}
const std::string Encoding::unicode2ansi(const std::wstring& line)
{
return unicode2cp(line, CP_ACP);
}
const std::string Encoding::unicode2utf8(const std::wstring& line)
{
if (sizeof(wchar_t) == 2)
{
UTF16 *pStrUtf16 = (UTF16 *) &line[0];
unsigned __int32 nLength = line.length();
unsigned __int32 nDstLength = 4*nLength + 1;
UTF8 *pStrUtf8 = new UTF8 [nDstLength];
memset ((void *) pStrUtf8, 0, sizeof (UTF8) * (nDstLength));
// this values will be modificated
const UTF16 *pStrUtf16_Conv = pStrUtf16;
UTF8 *pStrUtf8_Conv = pStrUtf8;
ConversionResult eUnicodeConversionResult = ConvertUTF16toUTF8 (&pStrUtf16_Conv, &pStrUtf16[nLength]
, &pStrUtf8_Conv , &pStrUtf8 [nDstLength]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete [] pStrUtf8;
return std::string();
}
std::string utf8Str ((char *) pStrUtf8);
delete [] pStrUtf8;
return utf8Str;
}
else //utf32 -> utf8
{
UTF32 *pStrUtf32 = (UTF32 *) &line[0];
unsigned __int32 nLength = line.length();
unsigned __int32 nDstLength = 4*nLength + 1;
UTF8 *pStrUtf8 = new UTF8 [nDstLength];
memset ((void *) pStrUtf8, 0, sizeof (UTF8) * (nDstLength));
// this values will be modificated
const UTF32 *pStrUtf32_Conv = pStrUtf32;
UTF8 *pStrUtf8_Conv = pStrUtf8;
ConversionResult eUnicodeConversionResult = ConvertUTF32toUTF8 (&pStrUtf32_Conv, &pStrUtf32[nLength]
, &pStrUtf8_Conv , &pStrUtf8 [nDstLength]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete [] pStrUtf8;
return std::string();
}
std::string utf8Str ((char *) pStrUtf8);
delete [] pStrUtf8;
return utf8Str;
}
}
const std::string Encoding::unicode2cp(const std::wstring& sLine, const unsigned int codePage)
{
#ifdef _WIN32
const int nSize = WideCharToMultiByte(codePage, 0, sLine.c_str(), sLine.length(), NULL, 0, NULL, NULL);
char *sTemp = new char[nSize];
if (!sTemp)
return std::string();
int size = WideCharToMultiByte(codePage, 0, sLine.c_str(), sLine.length(), sTemp, nSize, NULL, NULL);
std::string sResult(sTemp, size);
delete []sTemp;
return sResult;
#elif __linux__
return std::string();
#else
return std::string();
#endif
}
#pragma once
#ifndef UTILITY_ENCODING_INCLUDE_H_
#define UTILITY_ENCODING_INCLUDE_H_
#include <string>
class Encoding
{
public:
static const std::wstring ansi2unicode (const std::string& line);
static const std::wstring cp2unicode (const std::string& line, const unsigned int codePage);
static const std::wstring utf82unicode (const std::string& line);
static const std::string unicode2ansi (const std::wstring& line);
static const std::string unicode2utf8 (const std::wstring& line);
static const std::string unicode2cp (const std::wstring& line, const unsigned int codePage);
};
#endif // UTILITY_ENCODING_INCLUDE_H_
\ No newline at end of file
#pragma once
#ifndef ASC_STL_UTILS_INCLUDE_H_
#define ASC_STL_UTILS_INCLUDE_H_
#include <string>
namespace StlUtils
{
static inline std::wstring IntToWideString(int value, int radix = 10)
{
wchar_t strValue[256];
_itow_s(value, strValue, 256, radix);
return std::wstring(strValue);
}
static inline std::wstring DoubleToWideString(double value)
{
wchar_t strValue[256];
swprintf_s(strValue, 256, L"%f", value);
return std::wstring(strValue);
}
static inline std::string IntToString(int value, int radix = 10)
{
char strValue[256];
_itoa_s(value, strValue, 256, radix);
return std::string(strValue);
}
static inline std::string DoubleToString(double value)
{
char strValue[256];
sprintf_s(strValue, 256, "%f", value);
return std::string(strValue);
}
static int ToInteger(const std::string& strValue)
{
return atoi(strValue.c_str());
}
static int ToInteger(const std::wstring& strValue)
{
return _wtoi(strValue.c_str());
}
static double ToDouble(const std::string& strValue)
{
return atof(strValue.c_str());
}
static double ToDouble(const std::wstring& strValue)
{
return _wtof(strValue.c_str());
}
}
#endif // ASC_STL_UTILS_INCLUDE_H_
\ No newline at end of file
#include "precompiled_utility.h"
#include "ToString.h"
#include "Encoding.h"
#include "StlUtils.h"
const std::string ToString(const bool value)
{
if (value)
return "true";
return "false";
}
const std::wstring ToWString(const bool value)
{
if (value)
return L"true";
return L"false";
}
const std::string ToString(const int value)
{
return StlUtils::IntToString(value);
}
const std::wstring ToWString(const int value)
{
return StlUtils::IntToWideString(value);
}
const std::string ToString(const size_t value)
{
return StlUtils::IntToString(value);
}
const std::string ToString(const std::wstring& value)
{
return Encoding::unicode2utf8(value);
}
const std::string ToString(const wchar_t* value)
{
return Encoding::unicode2utf8(value);
}
const std::wstring ToWString(const size_t value)
{
return StlUtils::IntToWideString(value);
}
const std::string ToString(const double value)
{
return StlUtils::DoubleToString(value);
}
const std::wstring ToWString(const double value)
{
return StlUtils::DoubleToWideString(value);
}
const std::string ToString(const std::string& value)
{
return value;
}
const std::wstring ToWString(const std::wstring& value)
{
return value;
}
const std::wstring ToWString(const std::string& value)
{
return Encoding::utf82unicode(value);
}
const std::wstring ToWString(const char* value)
{
return Encoding::utf82unicode(value);
}
const std::string ToString(const char* value)
{
return value;
}
const std::wstring ToWString(const wchar_t* value)
{
return value;
}
#pragma once
#ifndef UTILITY_TO_STRING_INCLUDE_H_
#define UTILITY_TO_STRING_INCLUDE_H_
#include <string>
#include <wchar.h>
const std::string ToString(const bool value);
const std::string ToString(const int value);
const std::string ToString(const size_t value);
const std::string ToString(const double value);
const std::string ToString(const std::string& value);
const std::string ToString(const char* value);
const std::string ToString(const std::wstring& value);
const std::string ToString(const wchar_t* value);
const std::wstring ToWString(const bool value);
const std::wstring ToWString(const int value);
const std::wstring ToWString(const size_t value);
const std::wstring ToWString(const double value);
const std::wstring ToWString(const std::string& value);
const std::wstring ToWString(const char* value);
const std::wstring ToWString(const std::wstring& value);
const std::wstring ToWString(const wchar_t* value);
template<class T> const std::string ToString(const T& value) {return value.ToString();}
template<class T> const std::wstring ToWString(const T& value) {return value.ToWString();}
#endif // UTILITY_TO_STRING_INCLUDE_H_
\ No newline at end of file
#pragma once
#ifndef UTILITY_UTILITY_INCLUDE_H_
#define UTILITY_UTILITY_INCLUDE_H_
#include "../../../../Common/DocxFormat/Source/XML/stringcommon.h"
#include "../Common/Encoding.h"
template<typename Out, typename In>
static const std::vector<Out> _transform(const std::vector<In>& lines, const Out(*func)(const In&))
{
std::vector<Out> result;
for (std::vector<In>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
{
result.push_back(func(*iter));
}
return result;
}
template<typename Out, typename In>
static const std::list<Out> _transform(const std::list<In>& lines, const Out(*func)(const In&))
{
std::list<Out> result;
for (std::list<In>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
{
result.push_back(func(*iter));
}
return result;
}
template<typename Out, typename In, typename In2>
static const std::list<Out> _transform2(const std::list<In>& lines, const int codepage, const Out(*func)(const In&, const In2 codePage))
{
std::list<Out> result;
for (std::list<In>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
{
result.push_back(func(*iter, codepage));
}
return result;
}
#endif // UTILITY_UTILITY_INCLUDE_H_
\ No newline at end of file
#pragma once
#include <string>
#include <list>
#include <vector>
#include <map>
This diff is collapsed.
#pragma once
#ifndef DOCX_2_TXT_CONVERTER_INCLUDE_H_
#define DOCX_2_TXT_CONVERTER_INCLUDE_H_
#include <boost/filesystem.hpp>
#include <vector>
#include <string>
namespace TxtXml
{
class ITxtXmlEvent;
}
namespace Docx2Txt
{
class Converter_Impl;
class Converter
{
public:
Converter();
~Converter();
void convert(TxtXml::ITxtXmlEvent& Event);
void read (const boost::filesystem::wpath& path);
void write (const boost::filesystem::wpath& path);
void writeUtf8 (const boost::filesystem::wpath& path) const;
void writeUnicode (const boost::filesystem::wpath& path) const;
void writeBigEndian (const boost::filesystem::wpath& path) const;
void writeAnsi (const boost::filesystem::wpath& path) const;
private:
Converter_Impl * converter_;
};
} // namespace Docx2Txt
#endif // DOCX_2_TXT_CONVERTER_INCLUDE_H_
\ No newline at end of file
#include "Converter.h"
//#include <boost/foreach.hpp>
//#include "../Common/AbstractConverter.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
#include "../TxtFormat/TxtFormat.h"
#include "../TxtXmlEvent.h"
namespace Txt2Docx
{
class Converter_Impl
{
public:
Converter_Impl(int encoding);
void convert(TxtXml::ITxtXmlEvent& Event);
Txt::File m_inputFile;
OOX::CDocument m_outputFile;
};
Converter::Converter(int encoding) : converter_( new Converter_Impl(encoding) )
{
}
Converter::~Converter()
{
delete converter_;
}
void Converter::convert(TxtXml::ITxtXmlEvent& Event)
{
return converter_->convert(Event);
}
void Converter::read(const boost::filesystem::wpath& path)
{
return converter_->m_inputFile.read(path);
}
void Converter::write(/*const boost::filesystem::wpath& path*/XmlUtils::CStringWriter & stringWriter)
{
for (long i=0;i < converter_->m_outputFile.m_arrItems.size(); i++)
{
if (converter_->m_outputFile.m_arrItems[i] != NULL)
stringWriter.WriteString(converter_->m_outputFile.m_arrItems[i]->toXML());
}
//BOOL res = converter_->m_outputFile.Write(std_string2string(path.string()));
return;
}
Converter_Impl::Converter_Impl(int encoding)
{
m_inputFile.m_nEncoding = encoding;
}
void Converter_Impl::convert(TxtXml::ITxtXmlEvent& Event)
{
//smart_ptr<OOX::File> pFile = m_outputFile.Find(OOX::FileTypes::Document);
OOX::CDocument *pDocument = &m_outputFile;//NULL;
if (!m_inputFile.m_listContent.empty() /*&& pFile.IsInit() && OOX::FileTypes::Document == pFile->type()*/)
{
//pDocument = (OOX::CDocument*)pFile.operator->();
//pDocument->ClearItems();
int percent = 100000;
int step = 800000 / m_inputFile.m_listContentSize; // !!!!!
bool cancel = Event.Progress(0, 100000);
if(cancel)
return;
/*
OOX::Logic::ParagraphProperty pPr;
OOX::Logic::Spacing space;
space.After = 0;
space.Line = 240;
space.LineRule = "auto";
pPr.Spacing = space;
OOX::Logic::RFonts rFont;
rFont.Ascii = "Courier New";
rFont.HAnsi = "Courier New";
rFont.Cs = "Courier New";
OOX::Logic::RunProperty rPr;
rPr.RFonts = rFont;
pPr.RunProperty = rPr;
OOX::Logic::Paragraph paragraph;
paragraph.Property = pPr;
*/
for (std::list<std::wstring>::iterator line = m_inputFile.m_listContent.begin(); line != m_inputFile.m_listContent.end(); line++)
{
//OOX::Logic::ParagraphProperty pPr;
//OOX::Logic::Spacing space;
//space.After = 0;
//space.Line = 240;
//space.LineRule = "auto";
//pPr.Spacing = space;
//OOX::Logic::RFonts rFont;
//rFont.Ascii = "Courier New";
//rFont.HAnsi = "Courier New";
//rFont.Cs = "Courier New";
//OOX::Logic::RunProperty rPr;
//rPr.RFonts = rFont;
//pPr.RunProperty = rPr;
//OOX::Logic::Paragraph paragraph;
//paragraph.Property = pPr;
OOX::Logic::CParagraph *temp = new OOX::Logic::CParagraph();
while(line->find(_T("\x08")) != line->npos)
{
line->erase(line->find(_T("\x08")), 1);//, "");
}
if(line->length() > 0)
temp->AddText(std_string2string(*line));//, rPr);
pDocument->m_arrItems.push_back(temp);
percent += step;
cancel = Event.Progress(0, percent);
if(cancel)
return;
}
}
Event.Progress(0, 900000);
}
} // namespace Txt2Docx
\ No newline at end of file
#pragma once
#ifndef TXT_2_DOCX_CONVERTER_INCLUDE_H_
#define TXT_2_DOCX_CONVERTER_INCLUDE_H_
#include <boost/filesystem.hpp>
#include "../../../../Common/DocxFormat/Source/XML/Utils.h"
namespace TxtXml
{
class ITxtXmlEvent;
}
namespace Txt2Docx
{
class Converter_Impl;
class Converter
{
public:
Converter (int encoding);
~Converter ();
void convert(TxtXml::ITxtXmlEvent& Event);
void read (const boost::filesystem::wpath& path);
void write (XmlUtils::CStringWriter & stringWriter/*const boost::filesystem::wpath& path*/);
private:
Converter_Impl * converter_;
};
} // namespace Txt2Docx
#endif // TXT_2_DOCX_CONVERTER_INCLUDE_H_
\ No newline at end of file
#include "File.h"
#include "../Common/Utility.h"
#include "TxtFile.h"
namespace Txt
{
File::File()
{
}
File::~File()
{
m_listContent.clear();
}
void File::read(const boost::filesystem::wpath& filename, int code_page) //
{
m_listContent.clear();
if (filename.empty())
return;
TxtFile file(std_string2string(filename.string()));
std::list<std::string> codePageContent = file.readAnsiOrCodePage();
m_listContentSize = file.getLinesCount();
for (std::list<std::string>::const_iterator iter = codePageContent.begin(); iter != codePageContent.end(); ++iter)
{
m_listContent.push_back(Encoding::cp2unicode(*iter, code_page));
}
codePageContent.clear();
}
void File::read(const boost::filesystem::wpath& filename)
{
m_listContent.clear();
if (filename.empty())
return;
TxtFile file(std_string2string(filename.string()));
//
if (file.isUtf8())
{
m_listContent = _transform(file.readUtf8(), Encoding::utf82unicode);
}
else if (file.isUnicode())
{
m_listContent = file.readUnicode();
}
else if (file.isBigEndian())
{
m_listContent = file.readBigEndian();
}
// , :
// BigEndian LittleEndian
//notepad++ ansi .
//else if (file.isUnicodeWithOutBOM())
// listContentUnicode = file.readUnicodeWithOutBOM();
else
{
m_listContent = _transform(file.readAnsiOrCodePage(), Encoding::utf82unicode);
}
m_listContentSize = file.getLinesCount();
//correctUnicode(listContentUnicode); - (
}
void File::write(const boost::filesystem::wpath& filename) const
{
TxtFile file(std_string2string(filename.string()));
file.writeUtf8(_transform(m_listContent, Encoding::unicode2utf8));
}
void File::writeCodePage(const boost::filesystem::wpath& filename, int code_page) const
{
TxtFile file(std_string2string(filename.string()));
std::list<std::string> result;
for (std::list<std::wstring>::const_iterator iter = m_listContent.begin(); iter != m_listContent.end(); ++iter)
{
result.push_back(Encoding::unicode2cp(*iter,code_page));
}
file.writeAnsiOrCodePage(result);
}
void File::writeUtf8(const boost::filesystem::wpath& filename) const
{
TxtFile file(std_string2string(filename.string()));
file.writeUtf8(_transform(m_listContent, Encoding::unicode2utf8));
}
void File::writeUnicode(const boost::filesystem::wpath& filename) const
{
TxtFile file(std_string2string(filename.string()));
file.writeUnicode(m_listContent);
}
void File::writeBigEndian(const boost::filesystem::wpath& filename) const
{
TxtFile file(std_string2string(filename.string()));
file.writeBigEndian(m_listContent);
}
void File::writeAnsi(const boost::filesystem::wpath& filename) const
{
TxtFile file(std_string2string(filename.string()));
file.writeAnsiOrCodePage(_transform(m_listContent, Encoding::unicode2ansi));
}
const bool File::isValid(const boost::filesystem::wpath& filename) const
{
if (filename.empty())
return true;
return boost::filesystem::exists(filename);
}
void File::correctUnicode(std::list<std::wstring>& input)
{
for(std::list<std::wstring>::iterator iter = input.begin(); iter != input.end(); iter++)
{
const std::wstring& inputStr = *iter;
std::wstring outputStr;
outputStr.reserve(inputStr.length());
for(int i = 0, length = inputStr.length(); i < length; ++i)
{
wchar_t inputChr = inputStr[i];
if(IsUnicodeSymbol(inputChr))
outputStr.push_back(inputChr);
}
*iter = outputStr;
}
}
bool File::IsUnicodeSymbol( wchar_t symbol )
{
bool result = false;
if ( ( 0x0009 == symbol ) || ( 0x000A == symbol ) || ( 0x000D == symbol ) ||
( ( 0x0020 <= symbol ) && ( 0xD7FF >= symbol ) ) || ( ( 0xE000 <= symbol ) && ( symbol <= 0xFFFD ) ) ||
( ( 0x10000 <= symbol ) && symbol ) )
{
result = true;
}
return result;
}
} // namespace Txt
\ No newline at end of file
#pragma once
#ifndef TXT_FILE_INCLUDE_H_
#define TXT_FILE_INCLUDE_H_
//#include <vector>
#include <list>
#include <string>
#include <boost/filesystem.hpp>
//#include "property.h"
namespace Txt
{
class File
{
public:
File();
~File();
void read (const boost::filesystem::wpath& filename);
void read (const boost::filesystem::wpath& filename, int code_page);
void write (const boost::filesystem::wpath& filename) const;
void writeCodePage (const boost::filesystem::wpath& filename, int code_page) const;
void writeUtf8 (const boost::filesystem::wpath& filename) const;
void writeUnicode (const boost::filesystem::wpath& filename) const;
void writeBigEndian (const boost::filesystem::wpath& filename) const;
void writeAnsi (const boost::filesystem::wpath& filename) const;
const bool isValid (const boost::filesystem::wpath& filename) const;
std::list<std::wstring> m_listContent; //unicode ( utf8)
int m_listContentSize; //
int m_nEncoding;
private:
void correctUnicode(std::list<std::wstring>& oList);
bool IsUnicodeSymbol( wchar_t symbol );
};
} // namespace Txt
#endif // TXT_FILE_INCLUDE_H_
\ No newline at end of file
#include "TxtFile.h"
#include "../Common/Encoding.h"
#include "../../../../Common/DocxFormat/Source/SystemUtility/File.h"
static const std::string BadSymbols = "\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19";
static std::wstring convertUtf16ToWString(UTF16 * Data, int nLength)
{
UTF32 *pStrUtf32 = new UTF32 [nLength + 1];
memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength + 1));
// this values will be modificated
const UTF16 *pStrUtf16_Conv = Data;
UTF32 *pStrUtf32_Conv = pStrUtf32;
ConversionResult eUnicodeConversionResult =
ConvertUTF16toUTF32 (&pStrUtf16_Conv,
&Data[nLength]
, &pStrUtf32_Conv
, &pStrUtf32 [nLength]
, strictConversion);
if (conversionOK != eUnicodeConversionResult)
{
delete [] pStrUtf32;
return std::wstring();
}
std::wstring wstr ((wchar_t *) pStrUtf32);
delete [] pStrUtf32;
return wstr;
}
TxtFile::TxtFile(const OOX::CPath& path) : m_path(path), m_linesCount(0)
{
}
const int TxtFile::getLinesCount()
{
return m_linesCount;
}
const std::list<std::string> TxtFile::readAnsiOrCodePage() // == readUtf8withoutPref
{
std::list<std::string> result;
CFile file_binary;
if (file_binary.OpenFile(m_path.GetPath()) != S_OK) return result;
long file_size = file_binary.GetFileSize();
char *file_data = new char[file_size];
if (file_data == NULL) return result;
file_binary.ReadFile((BYTE*)file_data, file_size);
long start_pos = 0;
for (long end_pos = 0; end_pos < file_size; end_pos++)
{
if (file_data[end_pos] == 0x0a)
{
//string from start_pos to end_pos
std::string str(file_data + start_pos, file_data + end_pos);
start_pos = end_pos + 1;
result.push_back(str);
m_linesCount++;
}
}//last
std::string str(file_data + start_pos, file_data + file_size);
result.push_back(str);
m_linesCount++;
return result;
}
const std::list<std::wstring> TxtFile::readUnicode()
{
std::list<std::wstring> result;
CFile file_binary;
if (file_binary.OpenFile(m_path.GetPath()) != S_OK) return result;
long file_size = file_binary.GetFileSize();
char *file_data = new char[file_size];
if (file_data == NULL) return result;
file_binary.ReadFile((BYTE*)file_data, file_size);
long start_pos = 2; // skip Header
for (long end_pos = 2; end_pos < file_size; end_pos+=2)
{
if ((((UTF16*)(file_data+end_pos))[0] == 0x000a) &&
((UTF16*)(file_data+end_pos))[1] == 0x000d)
{
if (sizeof(wchar_t) == 4)
{
result.push_back(convertUtf16ToWString((UTF16*)(file_data + start_pos), (end_pos-start_pos) /2));
}
else
{
std::wstring wstr((wchar_t*)(file_data + start_pos), (wchar_t*)(file_data + end_pos));
result.push_back(wstr);
}
start_pos = end_pos + 4;
m_linesCount++;
}
}
//last
if (sizeof(wchar_t) == 4)
{
result.push_back(convertUtf16ToWString((UTF16*)(file_data + start_pos), (file_size-start_pos) /2));
}
else
{
std::wstring wstr(file_data + start_pos, file_data + file_size);
result.push_back(wstr);
}
m_linesCount++;
return result;
}
const std::list<std::wstring> TxtFile::readBigEndian()
{
std::list<std::wstring> result;
CFile file_binary;
if (file_binary.OpenFile(m_path.GetPath()) != S_OK) return result;
long file_size = file_binary.GetFileSize();
char *file_data = new char[file_size];
if (file_data == NULL) return result;
file_binary.ReadFile((BYTE*)file_data, file_size);
long start_pos = 2; // skip Header
for (long end_pos = 2; end_pos < file_size; end_pos+=2)
{
if (((UTF16*)(file_data+end_pos))[0] == 0x000d &&
((UTF16*)(file_data+end_pos))[1] == 0x000a)
{
//swap bytes
for (long i = start_pos; i < end_pos; i+=2)
{
char v = file_data[i];
file_data[i] = file_data[i+1];
file_data[i+1] = v;
}
if (sizeof(wchar_t) == 4)
{
result.push_back(convertUtf16ToWString((UTF16*)(file_data + start_pos), (end_pos-start_pos) /2));
}
else
{
std::wstring wstr((wchar_t*)(file_data + start_pos), (wchar_t*)(file_data + end_pos));
result.push_back(wstr);
}
start_pos = end_pos + 4;
m_linesCount++;
}
}
//last
//swap bytes
for (long i = start_pos; i < file_size; i+=2)
{
char v = file_data[i];
file_data[i] = file_data[i+1];
file_data[i+1] = v;
}
if (sizeof(wchar_t) == 4)
{
result.push_back(convertUtf16ToWString((UTF16*)(file_data + start_pos), (file_size-start_pos) /2));
}
else
{
std::wstring wstr(file_data + start_pos, file_data + file_size);
result.push_back(wstr);
}
m_linesCount++;
return result;
}
const std::list<std::string> TxtFile::readUtf8()
{
std::list<std::string> result;
CFile file_binary;
if (file_binary.OpenFile(m_path.GetPath()) != S_OK) return result;
long file_size = file_binary.GetFileSize();
char *file_data = new char[file_size];
if (file_data == NULL) return result;
file_binary.ReadFile((BYTE*)file_data, file_size);
long start_pos = 3; //skip header
for (long end_pos = 3; end_pos < file_size; end_pos++)
{
if (file_data[end_pos] == 0x0a)
{
//string from start_pos to end_pos
std::string str(file_data + start_pos, file_data + end_pos);
start_pos = end_pos + 1;
result.push_back(str);
m_linesCount++;
}
}//last
std::string str(file_data + start_pos, file_data + file_size);
result.push_back(str);
m_linesCount++;
return result;
}
void TxtFile::writeAnsiOrCodePage(const std::list<std::string>& content) // === writeUtf8withoutPref
{
CFile file;
if (file.CreateFileW(m_path.GetPath()) == S_OK)
{
BYTE endLine[2] = {0x0d, 0x0a};
for (std::list<std::string>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
{
file.WriteFile((void*)(*iter).c_str(), (*iter).length());
file.WriteFile(endLine, 2);
m_linesCount++;
}
}
}
void TxtFile::writeUnicode(const std::list<std::wstring>& content)
{
CFile file;
if (file.CreateFileW(m_path.GetPath()) == S_OK)
{
BYTE Header[2] = {0xff, 0xfe};
BYTE EndLine[4] = {0x0d, 0x00, 0x0a, 0x00};
file.WriteFile(Header,2);
for (std::list<std::wstring>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
{
const wchar_t * data = (*iter).c_str();
int size = (*iter).length();
if(sizeof(wchar_t) == 2)
{
file.WriteFile((void*)data, size << 1);
}
else
{
//convert Utf 32 to Utf 16
}
file.WriteFile(EndLine, 4);
m_linesCount++;
}
}
}
void TxtFile::writeBigEndian(const std::list<std::wstring>& content)
{
CFile file;
if (file.CreateFileW(m_path.GetPath()) == S_OK)
{
BYTE Header[2] = {0xfe, 0xff};
BYTE EndLine[4] = {0x00, 0x0d, 0x00, 0x0a};
file.WriteFile(Header,2);
for (std::list<std::wstring>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
{
if(sizeof(wchar_t) == 2)
{
BYTE* data = (BYTE*)(*iter).c_str();
int size = (*iter).length();
//swap bytes
for (long i = 0; i < size << 1; i+=2)
{
char v = data[i];
data[i] = data[i+1];
data[i+1] = v;
}
file.WriteFile((void*)(*iter).c_str(), size << 1);
}
else
{
//convert Utf 32 to Utf 16
}
file.WriteFile(EndLine, 4);
m_linesCount++;
}
}
}
void TxtFile::writeUtf8(const std::list<std::string>& content)
{
CFile file;
if (file.CreateFileW(m_path.GetPath()) == S_OK)
{
BYTE Header[3] = {0xef ,0xbb , 0xbf};
BYTE EndLine[2] = {0x0d ,0x0a};
file.WriteFile(Header,3);
for (std::list<std::string>::const_iterator iter = content.begin(); iter != content.end(); ++iter)
{
file.WriteFile((void*)(*iter).c_str(), (*iter).length());
file.WriteFile((void*)EndLine, 2);
m_linesCount++;
}
}
}
const bool TxtFile::isUnicode()
{
CFile file;
if (file.OpenFile(m_path.GetPath()) != S_OK) return false;
BYTE data [2];
file.ReadFile(data,2);
file.CloseFile();
if ((data [0] == 0xff) && (data [1] == 0xfe))return true;
return false;
}
const bool TxtFile::isBigEndian()
{
CFile file;
if (file.OpenFile(m_path.GetPath()) != S_OK) return false;
BYTE data [2];
file.ReadFile(data,2);
file.CloseFile();
if ((data [0] == 0xfe) && (data [1] == 0xff))return true;
return false;
}
const bool TxtFile::isUtf8()
{
CFile file;
if (file.OpenFile(m_path.GetPath()) != S_OK) return false;
BYTE data [3];
file.ReadFile(data,3);
file.CloseFile();
if ((data [0] == 0xef) && (data [1] == 0xbb) && (data [2] == 0xbf))return true;
return false;
}
#pragma once
#ifndef UTILITY_TXT_FILE_INCLUDE_H_
#define UTILITY_TXT_FILE_INCLUDE_H_
#include <string>
#include <list>
#include "../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
class TxtFile
{
public:
TxtFile(const OOX::CPath& path);
const std::list<std::string> readAnsiOrCodePage();
const std::list<std::wstring> readUnicode();
//const std::list<std::wstring> readUnicodeWithOutBOM(); ///
const std::list<std::wstring> readBigEndian();
const std::list<std::string> readUtf8();
void writeAnsiOrCodePage (const std::list<std::string>& content);
void writeUnicode (const std::list<std::wstring>& content);
void writeBigEndian (const std::list<std::wstring>& content);
void writeUtf8 (const std::list<std::string>& content);
const bool isUnicode();
const bool isBigEndian();
const bool isUtf8();
const int getLinesCount();
private:
OOX::CPath m_path;
int m_linesCount;
};
#endif // UTILITY_TXT_FILE_INCLUDE_H_
\ No newline at end of file
#pragma once
#ifndef TXT_INCLUDE_H_
#define TXT_INCLUDE_H_
#include "File.h"
#endif // TXT_INCLUDE_H_
\ No newline at end of file
#pragma once
#ifndef TXT_XML_EVENT_INCLUDE_H_
#define TXT_XML_EVENT_INCLUDE_H_
namespace TxtXml
{
class ITxtXmlEvent
{
public:
ITxtXmlEvent()
{
m_lPercent = 0;
}
virtual bool Progress(long ID, long Percent) = 0;
virtual long GetPercent()
{
return m_lPercent;
}
virtual void AddPercent(long addition)
{
m_lPercent += addition;
}
protected:
long m_lPercent;
};
}
#endif // TXT_XML_EVENT_INCLUDE_H_
\ No newline at end of file
#include <string>
#include <boost/filesystem.hpp>
#include "TxtXmlFile.h"
#include "Docx2Txt/Converter.h"
#include "Txt2Docx/Converter.h"
#include "Common/StlUtils.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
namespace NSBinPptxRW
{
class CDrawingConverter;
}
namespace BinDocxRW
{
int g_nCurFormatVersion = 0;
}
#include "../../../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
#include "../../../Common/OfficeDefines.h"
#include "../../../common/docxformat/source/systemutility/file.h"
#include "../../../DesktopEditor/common/Path.h"
#include "../../../ASCOfficeDocxFile2/DocWrapper/FontProcessor.h"
#include "../../../ASCOfficeDocxFile2/BinReader/FileWriter.h"
CTxtXmlFile::CTxtXmlFile()
{
}
bool CTxtXmlFile::Progress(long ID, long Percent)
{
SHORT res = 0;
m_lPercent = Percent;
//OnProgressEx(ID, Percent, &res); todooo out event
return (res != 0);
}
static int ParseTxtOptions(static CString & sXmlOptions)
{
int encoding = -1;
XmlUtils::CXmlLiteReader xmlReader;
if (xmlReader.FromString(sXmlOptions))
{
xmlReader.ReadNextNode();//root - <Options>
int nCurDepth = xmlReader.GetDepth();
while ( xmlReader.ReadNextSiblingNode( nCurDepth ) )
{
CString sName = xmlReader.GetName();
if (sName == _T("TXTOptions"))
{
int nCurDepth1 = xmlReader.GetDepth();
while ( xmlReader.ReadNextSiblingNode( nCurDepth1 ) )
{
CString sName1 = xmlReader.GetName();
if (sName1 == _T("Encoding"))
{
CString strValue = xmlReader.GetText2();
encoding = StlUtils::ToInteger(string2std_string(strValue));
}
}
}
}
}
return encoding;
}
HRESULT CTxtXmlFile::txt_LoadFromFile(CString sSrcFileName, CString sDstPath, CString sXMLOptions)
{
// xml -
//HRESULT hr = xml_LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
//if(hr == S_OK)
// return S_OK;
//As Text
const boost::filesystem::wpath txtFile = string2std_string(sSrcFileName);
const boost::filesystem::wpath docxPath = string2std_string(sDstPath);
const boost::filesystem::wpath origin = docxPath/L"Origin";
Writers::FileWriter *pDocxWriter = new Writers::FileWriter(sDstPath, _T(""), 1, false, NULL, _T(""));
if (pDocxWriter == NULL) return S_FALSE;
CreateDocxEmpty(sDstPath, pDocxWriter);
try
{
int encoding = ParseTxtOptions(sXMLOptions);
Progress(0, 0);
Txt2Docx::Converter converter( encoding);
converter.read(txtFile);
Progress(0, 100000);
converter.convert(*this);
converter.write(pDocxWriter->m_oDocumentWriter.m_oContent);
Progress(0, 1000000);
}
catch(...)
{
return S_FALSE;
}
pDocxWriter->m_oDocumentWriter.Write(); //overwrite document.xml
delete pDocxWriter;
pDocxWriter = NULL;
return S_OK;
}
HRESULT CTxtXmlFile::txt_SaveToFile(CString sDstFileName, CString sSrcPath, CString sXMLOptions)
{
const boost::filesystem::wpath txtFile = string2std_string(sDstFileName);
const boost::filesystem::wpath docxPath = string2std_string(sSrcPath);
try
{
Progress(0, 0);
Docx2Txt::Converter converter;
converter.read(docxPath);
Progress(0, 100000);
converter.convert(*this);
int encoding = ParseTxtOptions(sXMLOptions);
if (encoding == EncodingType::Utf8)
converter.writeUtf8(txtFile);
else if (encoding == EncodingType::Unicode)
converter.writeUnicode(txtFile);
else if (encoding == EncodingType::Ansi)
converter.writeAnsi(txtFile);
else if (encoding == EncodingType::BigEndian)
converter.writeBigEndian(txtFile);
else if (encoding > 0) //code page
{
converter.write(txtFile);
}
else //auto define
converter.write(txtFile);
Progress(0, 1000000);
}
catch(...)
{
return S_FALSE;
}
return S_OK;
}
void CTxtXmlFile::CreateDocxEmpty(CString strDirectory, Writers::FileWriter * pDocxWriter)
{
// rels
OOX::CPath pathRels = strDirectory + FILE_SEPARATOR_STR + _T("_rels");
FileSystem::Directory::CreateDirectory(pathRels.GetPath());
// word
OOX::CPath pathWord = strDirectory + FILE_SEPARATOR_STR + _T("word");
FileSystem::Directory::CreateDirectory(pathWord.GetPath());
// documentRels
OOX::CPath pathWordRels = pathWord + FILE_SEPARATOR_STR + _T("_rels");
FileSystem::Directory::CreateDirectory(pathWordRels.GetPath());
//media
OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + _T("media");
CString sMediaPath = pathMedia.GetPath();
// theme
OOX::CPath pathTheme = pathWord + FILE_SEPARATOR_STR + _T("theme");
FileSystem::Directory::CreateDirectory(pathTheme.GetPath());
OOX::CPath pathThemeRels = pathTheme + FILE_SEPARATOR_STR + _T("_rels");
FileSystem::Directory::CreateDirectory(pathThemeRels.GetPath());
pathTheme = pathTheme + FILE_SEPARATOR_STR + _T("theme1.xml");
//default files
pDocxWriter->m_oDefaultTheme.Write(pathTheme.GetPath());
OOX::CContentTypes oContentTypes;
//docProps
OOX::CPath pathDocProps = strDirectory + FILE_SEPARATOR_STR + _T("docProps");
FileSystem::Directory::CreateDirectory(pathDocProps.GetPath());
OOX::CPath DocProps = CString(_T("docProps"));
OOX::CApp* pApp = new OOX::CApp();
if (pApp)
{
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("3.0000"));
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
pApp->SetSharedDoc(false);
pApp->SetHyperlinksChanged(false);
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore();
if (pCore)
{
pCore->SetCreator(_T(""));
pCore->SetLastModifiedBy(_T(""));
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes);
delete pCore;
}
/////////////////////////////////////////////////////////////////////////////////////
pDocxWriter->m_oCommentsWriter.Write();
pDocxWriter->m_oChartWriter.Write();
pDocxWriter->m_oStylesWriter.Write();
pDocxWriter->m_oNumberingWriter.Write();
pDocxWriter->m_oFontTableWriter.Write();
pDocxWriter->m_oHeaderFooterWriter.Write();
//Setting HeaderFooter, evenAndOddHeaders
pDocxWriter->m_oSettingWriter.Write();
pDocxWriter->m_oWebSettingsWriter.Write();
//Document HeaderFooter, sectPr
pDocxWriter->m_oDocumentWriter.Write();
//Rels ContentTypes
pDocxWriter->m_oDocumentRelsWriter.Write();
pDocxWriter->m_oContentTypesWriter.Write();
}
#pragma once
#include "TxtXmlEvent.h"
#include "../../../Common/DocxFormat/Source/XML/stringcommon.h"
namespace Writers
{
class FileWriter;
}
class CTxtXmlFile : public TxtXml::ITxtXmlEvent
{
public:
virtual bool Progress(long ID, long Percent);
HRESULT txt_LoadFromFile(CString sSrcFileName, CString sDstPath, CString sXMLOptions);
HRESULT txt_SaveToFile (CString sDstFileName, CString sSrcPath, CString sXMLOptions);
//HRESULT xml_LoadFromFile(CString sSrcFileName, CString sDstPath, CString sXMLOptions);
//HRESULT xml_SaveToFile (CString sDstFileName, CString sSrcPath, CString sXMLOptions);
CTxtXmlFile();
private:
void CreateDocxEmpty(CString path, Writers::FileWriter * DocxWriter) ;
};
\ No newline at end of file
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="TxtFormatLib"
ProjectGUID="{DACBE6CA-E089-47D1-8CE7-C7DB59C15417}"
RootNamespace="TxtXmlFileFormatLib"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\Common\DocxFormat\Source\DocxFormat;&quot;D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\branches\Docx2DoctConverter\ServerComponents\DesktopEditor\freetype-2.5.2\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Docx2Txt"
>
<File
RelativePath="..\Source\Docx2Txt\Converter.cpp"
>
</File>
<File
RelativePath="..\Source\Docx2Txt\Converter.h"
>
</File>
</Filter>
<Filter
Name="Txt2Docx"
>
<File
RelativePath="..\Source\Txt2Docx\Converter.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Source\Txt2Docx\Converter.h"
>
</File>
</Filter>
<Filter
Name="TxtFormat"
>
<File
RelativePath="..\Source\Common\Encoding.cpp"
>
</File>
<File
RelativePath="..\Source\TxtFormat\File.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Source\TxtFormat\File.h"
>
</File>
<File
RelativePath="..\Source\Common\ToString.cpp"
>
</File>
<File
RelativePath="..\Source\TxtFormat\TxtFile.cpp"
>
</File>
<File
RelativePath="..\Source\TxtFormat\TxtFile.h"
>
</File>
<File
RelativePath="..\Source\TxtFormat\TxtFormat.h"
>
</File>
</Filter>
<Filter
Name="DocxWriters"
>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\ChartWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\CommentsWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\ContentTypesWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\DefaultThemeWriterWin.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\DocumentRelsWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\DocumentWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\FileWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\fontTableWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\HeaderFooterWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\MediaWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\NumberingWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\SettingWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\StylesWriter.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinReader\webSettingsWriter.h"
>
</File>
<Filter
Name="DocxWrapper"
>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.h"
>
</File>
</Filter>
</Filter>
<File
RelativePath="..\..\..\Common\DocxFormat\Source\XML\libxml2\libxml2.cpp"
>
</File>
<File
RelativePath="..\Source\TxtXmlFile.cpp"
>
</File>
<File
RelativePath="..\Source\TxtXmlFile.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
// AVSTxtFile.cpp : Implementation of DLL Exports.
#include "stdafx.h"
#include "resource.h"
// The module attribute causes DllMain, DllRegisterServer and DllUnregisterServer to be automatically implemented for you
[ module(dll, uuid = "{30D961A6-9131-48E8-A7D9-3826E3D7818A}",
name = "ASCOfficeTxtFile",
helpstring = "ASCOfficeTxtFile 1.0 Type Library",
resource_name = "IDR_ASCTXTFILE") ]
class CAVSTxtFileModule
{
public:
// Override CAtlDllModuleT members
};
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define COMPONENT_NAME "OfficeTxtFile"
#include "../Common/FileInfo.h"
#include "../version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION INTVER
PRODUCTVERSION INTVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION_ACTIVEX
VALUE "FileVersion", STRVER
VALUE "InternalName", COMPONENT_FILE_NAME_DLL
VALUE "LegalCopyright", LEGAL_COPYRIGHT
VALUE "LegalTrademarks", LEGAL_COPYRIGHT
VALUE "OriginalFilename", COMPONENT_FILE_NAME_DLL
VALUE "ProductName", FILE_DESCRIPTION_ACTIVEX
VALUE "ProductVersion", STRVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_ASCTXTFILE REGISTRY "ASCOfficeTxtFile.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "ASCOfficeTxtFile"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'ASCOfficeTxtFile'
'ASCOfficeTxtFile.DLL'
{
val AppID = s '%APPID%'
}
}
}

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TxtFormat", "Projects\TxtFormat.vcproj", "{0405AC50-F4FC-4212-82CB-FEBACF0E1D93}"
ProjectSection(ProjectDependencies) = postProject
{873D625C-37E4-47C4-8120-2D9FC6A98765} = {873D625C-37E4-47C4-8120-2D9FC6A98765}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Docx2Txt", "Projects\Docx2Txt.vcproj", "{9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE}"
ProjectSection(ProjectDependencies) = postProject
{0405AC50-F4FC-4212-82CB-FEBACF0E1D93} = {0405AC50-F4FC-4212-82CB-FEBACF0E1D93}
{67EB0D73-21A0-44C9-ADB2-109526E60429} = {67EB0D73-21A0-44C9-ADB2-109526E60429}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Txt2Docx", "Projects\Txt2Docx.vcproj", "{866414A9-C488-4028-82C8-5343383B331E}"
ProjectSection(ProjectDependencies) = postProject
{0405AC50-F4FC-4212-82CB-FEBACF0E1D93} = {0405AC50-F4FC-4212-82CB-FEBACF0E1D93}
{9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE} = {9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\ASCDocxFormat\Projects\DocxFormat.vcproj", "{67EB0D73-21A0-44C9-ADB2-109526E60429}"
ProjectSection(ProjectDependencies) = postProject
{CF068422-CD0A-484E-B4A9-A0CD108EBBB9} = {CF068422-CD0A-484E-B4A9-A0CD108EBBB9}
{56F6B346-D0EA-4149-88C4-B6D09E0E9BA6} = {56F6B346-D0EA-4149-88C4-B6D09E0E9BA6}
{873D625C-37E4-47C4-8120-2D9FC6A98765} = {873D625C-37E4-47C4-8120-2D9FC6A98765}
{7D2165DA-B528-4318-A03F-6E922547C09D} = {7D2165DA-B528-4318-A03F-6E922547C09D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeTxtFile", "ASCOfficeTxtFile.vcproj", "{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}"
ProjectSection(ProjectDependencies) = postProject
{9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE} = {9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE}
{866414A9-C488-4028-82C8-5343383B331E} = {866414A9-C488-4028-82C8-5343383B331E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML", "..\Common\ASCDocxFormat\Projects\XML.vcproj", "{CF068422-CD0A-484E-B4A9-A0CD108EBBB9}"
ProjectSection(ProjectDependencies) = postProject
{56F6B346-D0EA-4149-88C4-B6D09E0E9BA6} = {56F6B346-D0EA-4149-88C4-B6D09E0E9BA6}
{3C7D3E76-9C62-4D0E-9645-8731700B1D70} = {3C7D3E76-9C62-4D0E-9645-8731700B1D70}
{7A3C0AE1-9FA1-4F56-99C0-139192364F57} = {7A3C0AE1-9FA1-4F56-99C0-139192364F57}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "..\Common\ASCDocxFormat\Projects\Common.vcproj", "{873D625C-37E4-47C4-8120-2D9FC6A98765}"
ProjectSection(ProjectDependencies) = postProject
{CF068422-CD0A-484E-B4A9-A0CD108EBBB9} = {CF068422-CD0A-484E-B4A9-A0CD108EBBB9}
{56F6B346-D0EA-4149-88C4-B6D09E0E9BA6} = {56F6B346-D0EA-4149-88C4-B6D09E0E9BA6}
{3C7D3E76-9C62-4D0E-9645-8731700B1D70} = {3C7D3E76-9C62-4D0E-9645-8731700B1D70}
{7A3C0AE1-9FA1-4F56-99C0-139192364F57} = {7A3C0AE1-9FA1-4F56-99C0-139192364F57}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_system", "..\Common\ASCDocxFormat\Projects\boost_system.vcproj", "{7A3C0AE1-9FA1-4F56-99C0-139192364F57}"
ProjectSection(ProjectDependencies) = postProject
{3C7D3E76-9C62-4D0E-9645-8731700B1D70} = {3C7D3E76-9C62-4D0E-9645-8731700B1D70}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boost_filesystem", "..\Common\ASCDocxFormat\Projects\boost_filesystem.vcproj", "{3C7D3E76-9C62-4D0E-9645-8731700B1D70}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utility", "..\Common\ASCDocxFormat\Projects\Utility.vcproj", "{56F6B346-D0EA-4149-88C4-B6D09E0E9BA6}"
ProjectSection(ProjectDependencies) = postProject
{3C7D3E76-9C62-4D0E-9645-8731700B1D70} = {3C7D3E76-9C62-4D0E-9645-8731700B1D70}
{7A3C0AE1-9FA1-4F56-99C0-139192364F57} = {7A3C0AE1-9FA1-4F56-99C0-139192364F57}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeSvmFile", "..\ASCOfficeOdtFile\Source\OfficeSvmFile\OfficeSvmFile.vcproj", "{7D2165DA-B528-4318-A03F-6E922547C09D}"
ProjectSection(ProjectDependencies) = postProject
{3C7D3E76-9C62-4D0E-9645-8731700B1D70} = {3C7D3E76-9C62-4D0E-9645-8731700B1D70}
{7A3C0AE1-9FA1-4F56-99C0-139192364F57} = {7A3C0AE1-9FA1-4F56-99C0-139192364F57}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0405AC50-F4FC-4212-82CB-FEBACF0E1D93}.Debug|Win32.ActiveCfg = Debug|Win32
{0405AC50-F4FC-4212-82CB-FEBACF0E1D93}.Debug|Win32.Build.0 = Debug|Win32
{0405AC50-F4FC-4212-82CB-FEBACF0E1D93}.Release|Win32.ActiveCfg = Release|Win32
{0405AC50-F4FC-4212-82CB-FEBACF0E1D93}.Release|Win32.Build.0 = Release|Win32
{9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE}.Debug|Win32.ActiveCfg = Debug|Win32
{9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE}.Debug|Win32.Build.0 = Debug|Win32
{9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE}.Release|Win32.ActiveCfg = Release|Win32
{9D3D4B8F-62B8-4029-AF89-EB640DBEEDEE}.Release|Win32.Build.0 = Release|Win32
{866414A9-C488-4028-82C8-5343383B331E}.Debug|Win32.ActiveCfg = Debug|Win32
{866414A9-C488-4028-82C8-5343383B331E}.Debug|Win32.Build.0 = Debug|Win32
{866414A9-C488-4028-82C8-5343383B331E}.Release|Win32.ActiveCfg = Release|Win32
{866414A9-C488-4028-82C8-5343383B331E}.Release|Win32.Build.0 = Release|Win32
{67EB0D73-21A0-44C9-ADB2-109526E60429}.Debug|Win32.ActiveCfg = Debug|Win32
{67EB0D73-21A0-44C9-ADB2-109526E60429}.Debug|Win32.Build.0 = Debug|Win32
{67EB0D73-21A0-44C9-ADB2-109526E60429}.Release|Win32.ActiveCfg = Release|Win32
{67EB0D73-21A0-44C9-ADB2-109526E60429}.Release|Win32.Build.0 = Release|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug|Win32.ActiveCfg = Debug|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Debug|Win32.Build.0 = Debug|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release|Win32.ActiveCfg = Release|Win32
{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}.Release|Win32.Build.0 = Release|Win32
{CF068422-CD0A-484E-B4A9-A0CD108EBBB9}.Debug|Win32.ActiveCfg = Debug|Win32
{CF068422-CD0A-484E-B4A9-A0CD108EBBB9}.Debug|Win32.Build.0 = Debug|Win32
{CF068422-CD0A-484E-B4A9-A0CD108EBBB9}.Release|Win32.ActiveCfg = Release|Win32
{CF068422-CD0A-484E-B4A9-A0CD108EBBB9}.Release|Win32.Build.0 = Release|Win32
{873D625C-37E4-47C4-8120-2D9FC6A98765}.Debug|Win32.ActiveCfg = Debug|Win32
{873D625C-37E4-47C4-8120-2D9FC6A98765}.Debug|Win32.Build.0 = Debug|Win32
{873D625C-37E4-47C4-8120-2D9FC6A98765}.Release|Win32.ActiveCfg = Release|Win32
{873D625C-37E4-47C4-8120-2D9FC6A98765}.Release|Win32.Build.0 = Release|Win32
{7A3C0AE1-9FA1-4F56-99C0-139192364F57}.Debug|Win32.ActiveCfg = Debug|Win32
{7A3C0AE1-9FA1-4F56-99C0-139192364F57}.Debug|Win32.Build.0 = Debug|Win32
{7A3C0AE1-9FA1-4F56-99C0-139192364F57}.Release|Win32.ActiveCfg = Release|Win32
{7A3C0AE1-9FA1-4F56-99C0-139192364F57}.Release|Win32.Build.0 = Release|Win32
{3C7D3E76-9C62-4D0E-9645-8731700B1D70}.Debug|Win32.ActiveCfg = Debug|Win32
{3C7D3E76-9C62-4D0E-9645-8731700B1D70}.Debug|Win32.Build.0 = Debug|Win32
{3C7D3E76-9C62-4D0E-9645-8731700B1D70}.Release|Win32.ActiveCfg = Release|Win32
{3C7D3E76-9C62-4D0E-9645-8731700B1D70}.Release|Win32.Build.0 = Release|Win32
{56F6B346-D0EA-4149-88C4-B6D09E0E9BA6}.Debug|Win32.ActiveCfg = Debug|Win32
{56F6B346-D0EA-4149-88C4-B6D09E0E9BA6}.Debug|Win32.Build.0 = Debug|Win32
{56F6B346-D0EA-4149-88C4-B6D09E0E9BA6}.Release|Win32.ActiveCfg = Release|Win32
{56F6B346-D0EA-4149-88C4-B6D09E0E9BA6}.Release|Win32.Build.0 = Release|Win32
{7D2165DA-B528-4318-A03F-6E922547C09D}.Debug|Win32.ActiveCfg = Debug|Win32
{7D2165DA-B528-4318-A03F-6E922547C09D}.Debug|Win32.Build.0 = Debug|Win32
{7D2165DA-B528-4318-A03F-6E922547C09D}.Release|Win32.ActiveCfg = Release|Win32
{7D2165DA-B528-4318-A03F-6E922547C09D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="ASCOfficeTxtFile"
ProjectGUID="{D02A88E6-5B2B-4A15-A4F6-C057F698FC53}"
RootNamespace="ASCOfficeTxtFile"
Keyword="AtlProj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/ASCOfficeTxtFile.tlb"
HeaderFileName="ASCOfficeTxtFile.h"
DLLDataFileName=""
InterfaceIdentifierFileName="ASCOfficeTxtFile_i.c"
ProxyFileName="ASCOfficeTxtFile_p.c"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="Source;.\..\Common\ASCDocxFormat\Source\Utility;.\..\Common\ASCDocxFormat\Source\XML;.\..\Common\ASCDocxFormat\Source\Common;.\..\Common\ASCDocxFormat\Source\DocxFormat;Source\TxtFormat"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1049"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
AdditionalDependencies="comsvcs.lib comsuppw.lib Msimg32.lib"
OutputFile="$(OutDir)/ASCOfficeTxtFile.dll"
LinkIncremental="2"
AdditionalLibraryDirectories=".\..\Common\ASCDocxFormat\Lib\Debug; ..\ASCOfficeUtils\ZLIB\zlib123dll\static32"
IgnoreDefaultLibraryNames="LIBC.lib"
MergedIDLBaseFileName="_ASCOfficeTxtFile.idl"
GenerateDebugInformation="true"
SubSystem="2"
ImportLibrary="$(OutDir)/ASCOfficeTxtFile.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/ASCOfficeTxtFile.tlb"
HeaderFileName="ASCOfficeTxtFile.h"
DLLDataFileName=""
InterfaceIdentifierFileName="ASCOfficeTxtFile_i.c"
ProxyFileName="ASCOfficeTxtFile_p.c"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="Source;.\..\Common\ASCDocxFormat\Source\Utility;.\..\Common\ASCDocxFormat\Source\XML;.\..\Common\ASCDocxFormat\Source\Common;.\..\Common\ASCDocxFormat\Source\DocxFormat;Source\TxtFormat"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1049"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
AdditionalDependencies="comsvcs.lib comsuppw.lib Msimg32.lib"
OutputFile=".\..\..\..\Redist\ASCOfficeStudio\$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories=".\..\Common\ASCDocxFormat\Lib\Release; ..\ASCOfficeUtils\ZLIB\zlib123dll\static32"
IgnoreDefaultLibraryNames="LIBC.lib"
MergedIDLBaseFileName="_ASCOfficeTxtFile.idl"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/ASCOfficeTxtFile.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\ASCOfficeTxtFile.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\ASC\"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\ASC\"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
ObjectFile="$(IntDir)\ASC\"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
ObjectFile="$(IntDir)\ASC\"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\TxtFile.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\ASC\"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\ASC\"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\Common\OfficeFileErrorDescription.h"
>
</File>
<File
RelativePath="..\Common\OfficeFileTemplate.h"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\TxtFile.h"
>
</File>
<File
RelativePath=".\version.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\ASCOfficeTxtFile.rc"
>
</File>
<File
RelativePath=".\ASCOfficeTxtFile.rgs"
>
</File>
<File
RelativePath=".\Resource\DocxTemplate.docx"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
This diff is collapsed.
This diff is collapsed.
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ASCOfficeTxtFile.rc
//
#define IDS_PROJNAME 100
#define IDR_ASCTXTFILE 101
#define IDR_DOCUMENT1 207
#define IDR_DOCUMENT2 208
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 209
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif
#include "stdafx.h"
#include "TxtFile.h"
#include "../TxtXmlFormatLib/Source/TxtXmlFile.h"
#include "../../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
CTxtFile::CTxtFile()
{
}
HRESULT CTxtFile::FinalConstruct()
{
return S_OK;
}
void CTxtFile::FinalRelease()
{
}
bool CTxtFile::Progress(long ID, long Percent)
{
SHORT res = 0;
m_lPercent = Percent;
OnProgressEx(ID, Percent, &res);
return (res != 0);
}
STDMETHODIMP CTxtFile::LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
CTxtXmlFile file;
//As Text
try
{
file.txt_LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
Progress(0, 1000000);
}
catch(...)
{
return S_FALSE;
}
return S_OK;
}
STDMETHODIMP CTxtFile::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
try
{
CTxtXmlFile file;
file.txt_SaveToFile(sDstFileName, sSrcPath, sXMLOptions);
Progress(0, 1000000);
}
catch(...)
{
return S_FALSE;
}
return S_OK;
}
#pragma once
#include "../../Common/OfficeFileTemplate.h"
#include "../TxtXmlFormatLib/Source/TxtXmlEvent.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
// ITxtFile
[
object,
uuid("313EFCD4-D6D2-4E5D-A99A-47890DA1FAAA"),
dual, helpstring("ITxtFile Interface"),
pointer_default(unique)
]
__interface ITxtFile : IAVSOfficeFileTemplate
{
};
// CTxtFile
[
coclass,
event_source(com),
default(ITxtFile),
threading(apartment),
vi_progid("AVSTxtFile.TxtFile"),
progid("AVSTxtFile.TxtFile.1"),
version(1.0),
uuid("91D835EB-A37E-4AF7-8B53-F56D353E2161"),
helpstring("TxtFile Class")
]
class ATL_NO_VTABLE CTxtFile : public ITxtFile, public TxtXml::ITxtXmlEvent
{
public:
__event __interface _IAVSOfficeFileTemplateEvents2;
virtual bool Progress(long ID, long Percent);
STDMETHOD(LoadFromFile)(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions);
STDMETHOD(SaveToFile)(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions);
CTxtFile();
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct();
void FinalRelease();
};
\ No newline at end of file
#include "stdafx.h"
#include "XmlFile.h"
#include "../TxtXmlFormatLib/Source/TxtXmlFile.h"
#include "../../ASCOfficeUtils/ASCOfficeUtilsLib/OfficeUtils.h"
CXmlFile::CXmlFile()
{
}
HRESULT CXmlFile::FinalConstruct()
{
return S_OK;
}
void CXmlFile::FinalRelease()
{
}
bool CXmlFile::Progress(long ID, long Percent)
{
SHORT res = 0;
m_lPercent = Percent;
OnProgressEx(ID, Percent, &res);
return (res != 0);
}
STDMETHODIMP CXmlFile::LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
CTxtXmlFile file;
file.txt_LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
return S_OK;
}
STDMETHODIMP CXmlFile::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
return S_OK;
}
//const unsigned long CXmlFile::LoadFromResource(LPCWSTR lpResName, LPCWSTR lpResType, LPCWSTR fileName) const
//{
// HMODULE hMod = GetModuleHandle(L"ASCOfficeTxtFile.dll");
// if (hMod)
// {
// HRSRC hRes = FindResource(hMod, lpResName, lpResType);
// if (hRes)
// {
// HGLOBAL hGlob = LoadResource(hMod, hRes);
// if (hGlob)
// {
// BYTE *lpbArray = (BYTE*)LockResource(hGlob);
// if (lpbArray)
// {
// const DWORD dwFileSize = SizeofResource(hMod, hRes);
// if (dwFileSize != 0)
// {
// int hFile = 0;
// if (!_wsopen_s(&hFile, fileName, (O_BINARY | O_CREAT | _O_RDWR ), _SH_DENYNO, S_IWRITE))
// {
// _write(hFile, lpbArray, dwFileSize);
// _close(hFile);
// }
// }
// }
// }
// }
// }
// return GetLastError();
//}
\ No newline at end of file
#pragma once
#include "../../Common/OfficeFileTemplate.h"
#include "../TxtXmlFormatLib/Source/TxtXmlEvent.h"
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
// IXmlFile
[
object,
//uuid("313EFCD4-D6D2-4E5D-A99A-47890DA1FAAA"),
uuid("AA15FAE9-AB71-4f01-B3A9-59FC4D12AB34"),
dual, helpstring("IXmlFile Interface"),
pointer_default(unique)
]
__interface IXmlFile : IAVSOfficeFileTemplate
{
};
// CXmlFile
[
coclass,
event_source(com),
default(IXmlFile),
threading(apartment),
vi_progid("AVSXmlFile.XmlFile"),
progid("AVSXmlFile.XmlFile.1"),
version(1.0),
//uuid("91D835EB-A37E-4AF7-8B53-F56D353E2161"),
uuid("DD887DF2-E1A4-492A-9D87-05E0E0BC485D"),
helpstring("XmlFile Class")
]
class ATL_NO_VTABLE CXmlFile : public IXmlFile, public TxtXml::ITxtXmlEvent
{
public:
__event __interface _IAVSOfficeFileTemplateEvents2;
virtual bool Progress(long ID, long Percent);
STDMETHOD(LoadFromFile)(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions);
STDMETHOD(SaveToFile)(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions);
CXmlFile();
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct();
void FinalRelease();
};
\ No newline at end of file
// stdafx.cpp : source file that includes just the standard includes
// AVSTxtFile.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
#ifndef STRICT
#define STRICT
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
#endif
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off ATL's hiding of some common and often safely ignored warning messages
#define _ATL_ALL_WARNINGS
#include <atlbase.h>
#include <atlcom.h>
//#include <atlwin.h>
//#include <atltypes.h>
//#include <atlctl.h>
//#include <atlhost.h>
using namespace ATL;
//
//#ifndef DEBUG
//#define SVMLIB_ROOT "../ASCImageStudio3/ASCGraphics/OfficeSvmFile/Release/"
//#else
//#define SVMLIB_ROOT "../ASCImageStudio3/ASCGraphics/OfficeSvmFile/Debug/"
//#endif
//
//#pragma message ("Using library: OfficeSvmFile.lib")
//#pragma comment(lib, SVMLIB_ROOT "OfficeSvmFile.lib")
\ No newline at end of file
#pragma once
//1
//0
//1
//67
#define INTVER 1,0,1,67
#define STRVER "1,0,1,67\0"
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