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

RtfConverter linux build

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62125 954022d7-b5bf-4e40-9824-e11837661b57
parent 639f43fc
......@@ -3090,6 +3090,10 @@ Redist/ASCPresentationEditor.dll svn_mime_002dtype=application%2Foctet-stream
Redist/ASCVectorImage.dll svn_mime_002dtype=application%2Foctet-stream
Redist/DoctRenderer.dll svn_mime_002dtype=application%2Foctet-stream
Redist/EncryptRes.exe svn_mime_002dtype=application%2Foctet-stream
Redist/Linux/ASCDocConverter svn_mime_002dtype=application%2Foctet-stream
Redist/Linux/ASCPptConverter svn_mime_002dtype=application%2Foctet-stream
Redist/Linux/ASCRtfConverter svn_mime_002dtype=application%2Foctet-stream
Redist/Linux/x2t svn_mime_002dtype=application%2Foctet-stream
Redist/OfficeCore.dll svn_mime_002dtype=application%2Foctet-stream
Redist/OfficeEditors.dll svn_mime_002dtype=application%2Foctet-stream
Redist/Repairing.exe svn_mime_002dtype=application%2Foctet-stream
......
#include "../RtfFormatLib/source/ConvertationManager.h"
#include <iostream>
#include "../version.h"
static std::wstring utf8_to_unicode(const char *src)
{
if (src == NULL) return _T("");
std::string temp = src;
unsigned int nLength = temp.length();
UTF32 *pStrUtf32 = new UTF32 [nLength+1];
memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength+1));
UTF8 *pStrUtf8 = (UTF8 *) src;
// 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 L"";
}
std::wstring wsEntryName ((wchar_t *) pStrUtf32);
delete [] pStrUtf32;
return wsEntryName;
}
int main(int argc, char *argv[])
{
// check arguments
if (argc < 3)
{
// print out help topic
std::cout << std::endl;
std::cout << std::endl;
std::cout << "-------------------------------------------------------------------------------" << std::endl;
std::cout << "\t\tRtf/Docx file converter. Version: " << STRVER << std::endl;
std::cout << "-------------------------------------------------------------------------------" << std::endl;
std::cout << std::endl;
std::cout << "USAGE: ASCRtfConverter \"path_to_file_1\" \"path_to_file_2\" " << std::endl;
std::cout << "WHERE:" << std::endl;
std::cout << "\t\"path_to_file_1\" is a path to file to be converted" << std::endl;
std::cout << "\t\"path_to_file_2\" is a path to the corresponding output file" << std::endl << std::endl;
return 1;
}
CString sArg1, sArg2, sExePath;
sExePath = utf8_to_unicode(argv [0]);
sArg1 = utf8_to_unicode(argv [1]);
sArg2 = utf8_to_unicode(argv [2]);
CString sXMLOptions = _T("");
{// rtf->docx
::ConvertationManager rtfFile;
HRESULT hRes = rtfFile.ConvertRtfToOOX(sArg1, sArg2, sXMLOptions);
if (hRes != S_OK)return 2;
}
return 0;
}
#-------------------------------------------------
#
# Project created by QtCreator 2014-12-16T18:25:28
#
#-------------------------------------------------
QT -= core
QT -= gui
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wno-ignored-qualifiers
DEFINES += UNICODE \
_UNICODE \
_USE_LIBXML2_READER_ \
_LINUX_QT \
LINUX \
_USE_XMLLITE_READER_ \
USE_LITE_READER \
TARGET = ASCRtfConverter
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += \
/usr/include/libxml2
SOURCES += \
RtfFileConverter.cpp
LIBS += -lxml2
INCLUDEPATH += \
/usr/include/libxml2
CONFIG(debug, debug|release){
message(Debug)
linux-g++{
message(64 bit)
unix:!macx: LIBS += -L$$PWD/../RtfFormatLib/Linux/build-RtfFormatLib-Desktop64-Debug/ -lRtfFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../RtfFormatLib/Linux/build-RtfFormatLib-Desktop64-Debug/libRtfFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop64-Debug/ -lASCOfficeUtilsLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop64-Debug/libASCOfficeUtilsLib.a
unix:!macx: LIBS += -L$$PWD/../../Common/DocxFormat/build-DocxFormatLib-Desktop64-Debug/ -lDocxFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../Common/DocxFormat/build-DocxFormatLib-Desktop64-Debug/libDocxFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop64-Debug/ -lgraphics
unix:!macx: PRE_TARGETDEPS += $$PWD/../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop64-Debug/libgraphics.a
}
else{
message(32 bit)
unix:!macx: LIBS += -L$$PWD/../RtfFormatLib/Linux/build-RtfFormatLib-Desktop-Debug/ -lRtfFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../RtfFormatLib/Linux/build-RtfFormatLib-Desktop-Debug/libRtfFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop-Debug/ -lASCOfficeUtilsLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop-Debug/libASCOfficeUtilsLib.a
unix:!macx: LIBS += -L$$PWD/../../Common/DocxFormat/build-DocxFormatLib-Desktop-Debug/ -lDocxFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../Common/DocxFormat/build-DocxFormatLib-Desktop-Debug/libDocxFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop-Debug/ -lgraphics
unix:!macx: PRE_TARGETDEPS += $$PWD/../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop-Debug/libgraphics.a
}
}
CONFIG(release, debug|release){
message(Release)
linux-g++{
message(64 bit)
unix:!macx: LIBS += -L$$PWD/../RtfFormatLib/Linux/build-RtfFormatLib-Desktop64-Release/ -lRtfFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../RtfFormatLib/Linux/build-RtfFormatLib-Desktop64-Release/libRtfFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop64-Release/ -lASCOfficeUtilsLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop64-Release/libASCOfficeUtilsLib.a
unix:!macx: LIBS += -L$$PWD/../../Common/DocxFormat/build-DocxFormatLib-Desktop64-Release/ -lDocxFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../Common/DocxFormat/build-DocxFormatLib-Desktop64-Release/libDocxFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop64-Release/ -lgraphics
unix:!macx: PRE_TARGETDEPS += $$PWD/../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop64-Release/libgraphics.a
}
else{
message(32 bit)
unix:!macx: LIBS += -L$$PWD/../RtfFormatLib/Linux/build-RtfFormatLib-Desktop-Release/ -lRtfFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../RtfFormatLib/Linux/build-RtfFormatLib-Desktop-Release/libRtfFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop-Release/ -lASCOfficeUtilsLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../ASCOfficeUtils/ASCOfficeUtilsLib/build-ASCOfficeUtilsLib-Desktop-Release/libASCOfficeUtilsLib.a
unix:!macx: LIBS += -L$$PWD/../../Common/DocxFormat/build-DocxFormatLib-Desktop-Release/ -lDocxFormatLib
unix:!macx: PRE_TARGETDEPS += $$PWD/../../Common/DocxFormat/build-DocxFormatLib-Desktop-Release/libDocxFormatLib.a
unix:!macx: LIBS += -L$$PWD/../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop-Release/ -lgraphics
unix:!macx: PRE_TARGETDEPS += $$PWD/../../DesktopEditor/Qt_build/graphics/build-graphics-Desktop-Release/libgraphics.a
}
}
#####################################################
# внешнее подключение сторонних библиотек
unix:!macx: LIBS += -lxml2
########################################################
#include "RtfFormatLib.h"
RtfFormatLib::RtfFormatLib()
{
}
#ifndef RTFFORMATLIB_H
#define RTFFORMATLIB_H
class RtfFormatLib
{
public:
RtfFormatLib();
};
#endif // RTFFORMATLIB_H
#-------------------------------------------------
#
# Project created by QtCreator 2015-04-15T14:10:45
#
#-------------------------------------------------
QT -= core gui
TARGET = RtfFormatLib
TEMPLATE = lib
CONFIG += staticlib
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wno-ignored-qualifiers
DEFINES += _LINUX LINUX UNICODE _UNICODE _USE_LIBXML2_READER_ _LINUX_QT _USE_XMLLITE_READER_ USE_LITE_READER
LIBS += -lxml2
INCLUDEPATH += \
/usr/include/libxml2
SOURCES += RtfFormatLib.cpp \
../source/DestinationCommand.cpp \
../source/RtfBookmark.cpp \
../source/RtfChar.cpp \
../source/RtfDocument.cpp \
../source/RtfGlobalTables.cpp \
../source/RtfOldList.cpp \
../source/RtfOle.cpp \
../source/RtfPicture.cpp \
../source/RtfProperty.cpp \
../source/RtfReader.cpp \
../source/RtfSection.cpp \
../source/RtfShape.cpp \
../source/RtfWriter.cpp \
../source/Reader/OOXHeaderReader.cpp \
../source/Reader/OOXParagraphElementReaders.cpp \
../source/Reader/OOXReader.cpp \
../source/Reader/OOXShapeReader.cpp \
../source/Reader/OOXTableReader.cpp \
../source/Writer/OOXDocumentWriter.cpp \
../source/Writer/OOXWriter.cpp
HEADERS += RtfFormatLib.h \
../source/Basic.h \
../source/ConvertationManager.h \
../source/DestinationCommand.h \
../source/IdGenerator.h \
../source/OOXColorTable.h \
../source/RtfBookmark.h \
../source/RtfChar.h \
../source/RtfDefine.h \
../source/RtfDocument.h \
../source/RtfErrors.h \
../source/RtfField.h \
../source/RtfGlobalTables.h \
../source/RtfLex.h \
../source/RtfMath.h \
../source/RtfOle.h \
../source/RtfParagraph.h \
../source/RtfPicture.h \
../source/RtfProperty.h \
../source/RtfReader.h \
../source/RtfSection.h \
../source/RtfShape.h \
../source/RtfTable.h \
../source/RtfTableCell.h \
../source/RtfTableRow.h \
../source/RtfToken.h \
../source/RtfWriter.h \
../source/UniversalConverterUtils.h \
../source/Utils.h \
../source/Reader/OOXAbstractNumReader.h \
../source/Reader/OOXAppReader.h \
../source/Reader/OOXBorderReader.h \
../source/Reader/OOXcnfStyleReader.h \
../source/Reader/OOXColorReader.h \
../source/Reader/OOXColorReader2.h \
../source/Reader/OOXColorSchemeReader.h \
../source/Reader/OOXContentTypeReader.h \
../source/Reader/OOXCoreReader.h \
../source/Reader/OOXDocDefaultsReader.h \
../source/Reader/OOXDocumentReader.h \
../source/Reader/OOXFontReader.h \
../source/Reader/OOXFontSchemeReader.h \
../source/Reader/OOXFontTableReader.h \
../source/Reader/OOXFootnotesReader.h \
../source/Reader/OOXHeaderReader.h \
../source/Reader/OOXLatentStyleReader.h \
../source/Reader/OOXLevelReader.h \
../source/Reader/OOXMathPropReader.h \
../source/Reader/OOXMathReader.h \
../source/Reader/OOXNumberingMapReader.h \
../source/Reader/OOXNumberingReader.h \
../source/Reader/OOXParagraphReader.h \
../source/Reader/OOXPictureAnchorReader.h \
../source/Reader/OOXPictureGraphicReader.h \
../source/Reader/OOXPictureInlineReader.h \
../source/Reader/OOXPictureReader.h \
../source/Reader/OOXpPrFrameReader.h \
../source/Reader/OOXpPrReader.h \
../source/Reader/OOXpPrTabReader.h \
../source/Reader/OOXReader.h \
../source/Reader/OOXReaderBasic.h \
../source/Reader/OOXRelsReader.h \
../source/Reader/OOXrPrReader.h \
../source/Reader/OOXRunReader.h \
../source/Reader/OOXSectionPropertyReader.h \
../source/Reader/OOXSettingsReader.h \
../source/Reader/OOXShadingReader.h \
../source/Reader/OOXShapeReader.h \
../source/Reader/OOXStyleReader.h \
../source/Reader/OOXStyleTableReader.h \
../source/Reader/OOXTableCellReader.h \
../source/Reader/OOXTableReader.h \
../source/Reader/OOXTableRowReader.h \
../source/Reader/OOXtblLookReader.h \
../source/Reader/OOXtblpPrReader.h \
../source/Reader/OOXtblPrReader.h \
../source/Reader/OOXtcPrReader.h \
../source/Reader/OOXTextItemReader.h \
../source/Reader/OOXThemeReader.h \
../source/Reader/OOXtrPrReader.h \
../source/Writer/OOXContentTypesWriter.h \
../source/Writer/OOXDocumentWriter.h \
../source/Writer/OOXFontTableWriter.h \
../source/Writer/OOXFootnoteWriter.h \
../source/Writer/OOXNumberingWriter.h \
../source/Writer/OOXRelsWriter.h \
../source/Writer/OOXSettingsWriter.h \
../source/Writer/OOXStylesWriter.h \
../source/Writer/OOXThemeWriter.h \
../source/Writer/OOXWriter.h
unix {
target.path = /usr/lib
INSTALLS += target
}
......@@ -32,6 +32,9 @@ public:
RtfReader oReader( oDocument, sSrcFileName );
OOXWriter oWriter( oDocument, sDstPath );
if (m_sTempFolder.GetLength() < 1)
m_sTempFolder = FileSystem::Directory::GetTempPath();
oReader.m_sTempFolder = FileSystem::Directory::CreateDirectoryWithUniqueName(m_sTempFolder);
oWriter.m_sTempFolder = FileSystem::Directory::CreateDirectoryWithUniqueName(m_sTempFolder);
......@@ -71,7 +74,10 @@ public:
OOXReader oReader( oDocument, sSrcPath );
RtfWriter oWriter( oDocument, sDstFileName, sSrcPath );
oReader.m_sTempFolder = FileSystem::Directory::CreateDirectoryWithUniqueName(m_sTempFolder);
if (m_sTempFolder.GetLength() < 1)
m_sTempFolder = FileSystem::Directory::GetTempPath();
oReader.m_sTempFolder = FileSystem::Directory::CreateDirectoryWithUniqueName(m_sTempFolder);
oWriter.m_sTempFolder = FileSystem::Directory::CreateDirectoryWithUniqueName(m_sTempFolder);
m_poOOXReader = &oReader;
......@@ -119,4 +125,4 @@ private:
bool m_bParseFirstItem;
};
\ No newline at end of file
};
......@@ -6,7 +6,7 @@
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../../../Common/DocxFormat/Source/Base/ASCString.h"
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
class IdGenerator
......
......@@ -38,8 +38,10 @@ public:
opPrReader.m_bDefStyle = false;
bool bStartNewSectoion;
CcnfStyle style;
if( true == opPrReader.Parse( oParam, oNewProperty, CcnfStyle(), bStartNewSectoion ) )
if( true == opPrReader.Parse( oParam, oNewProperty, style, bStartNewSectoion ) )
oParam.oRtf->m_oDefaultParagraphProp = oNewProperty;
}
return true;
......
......@@ -95,7 +95,8 @@ public:
OOXpPrReader opPrReader(m_ooxLvlNum->m_oPPr.GetPointer());
bool bStartNewSectoion;
if( true == opPrReader.Parse( oParam, oNewProperty, CcnfStyle(), bStartNewSectoion ) )
CcnfStyle style;
if( true == opPrReader.Parse( oParam, oNewProperty, style, bStartNewSectoion ) )
{
oLevelProperty.m_nFirstIndent = oNewProperty.m_nIndFirstLine;
oLevelProperty.m_nIndent = oNewProperty.m_nIndLeft;
......
......@@ -86,8 +86,9 @@ public:
OOXpPrReader opPrReader(m_ooxStyle->m_oParPr.GetPointer());
opPrReader.m_bDefStyle = false;
bool bStartNewSection;
opPrReader.Parse( oParam, oNewParStyle->m_oParProp, CcnfStyle(), bStartNewSection );
bool bStartNewSection;
CcnfStyle style;
opPrReader.Parse( oParam, oNewParStyle->m_oParProp, style, bStartNewSection );
oNewParStyle->m_oParProp.m_nListId = PROP_DEF; //экспериментально вроде нельзя иметь numbering в параграф стиле
oNewParStyle->m_oParProp.m_nListLevel = PROP_DEF;
......@@ -108,7 +109,8 @@ public:
OOXtrPrReader otrPrReader(m_ooxStyle->m_oTrPr.GetPointer());
otrPrReader.Parse( oParam, oNewTableStyle->m_oRowProp, CcnfStyle() );
CcnfStyle style;
otrPrReader.Parse( oParam, oNewTableStyle->m_oRowProp, style );
}
if (m_ooxStyle->m_oTcPr.IsInit() && RtfStyle::stTable == eStyleType )
{
......@@ -116,7 +118,8 @@ public:
OOXtcPrReader otcPrReader(m_ooxStyle->m_oTcPr.GetPointer());
otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, CcnfStyle(), -1, -1, -1, -1 );
CcnfStyle style;
otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, style, -1, -1, -1, -1 );
}
if (m_ooxStyle->m_arrTblStylePr.size() > 0 && RtfStyle::stTable == eStyleType )
{
......@@ -247,8 +250,10 @@ public:
OOXpPrReader opPrReader(oox_tableStyle->m_oParPr.GetPointer());
opPrReader.m_bDefStyle = false;
bool bStartNewSection;
opPrReader.Parse( oParam, oNewParStyle->m_oParProp, CcnfStyle(), bStartNewSection );
bool bStartNewSection;
CcnfStyle style;
opPrReader.Parse( oParam, oNewParStyle->m_oParProp, style, bStartNewSection );
oNewParStyle->m_oParProp.m_nListId = PROP_DEF; //экспериментально вроде нельзя иметь numbering в параграф стиле
oNewParStyle->m_oParProp.m_nListLevel = PROP_DEF;
......@@ -269,7 +274,8 @@ public:
OOXtrPrReader otrPrReader(oox_tableStyle->m_oTrPr.GetPointer());
otrPrReader.Parse( oParam, oNewTableStyle->m_oRowProp, CcnfStyle() );
CcnfStyle style;
otrPrReader.Parse( oParam, oNewTableStyle->m_oRowProp, style );
}
if (oox_tableStyle->m_oTcPr.IsInit() && RtfStyle::stTable == eStyleType )
{
......@@ -277,7 +283,8 @@ public:
OOXtcPrReader otcPrReader(oox_tableStyle->m_oTcPr.GetPointer());
otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, CcnfStyle(), -1, -1, -1, -1 );
CcnfStyle style;
otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, style, -1, -1, -1, -1 );
}
return true;
}
......
......@@ -4,7 +4,7 @@
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../../../Common/DocxFormat/Source/Base/ASCString.h"
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
class RtfToken
......
......@@ -28,7 +28,7 @@ public:
bool SaveByItemStart( CString sFolder )
{
CString pathWord = sFolder + FILE_SEPARATOR_STR + _T("word");
FileSystem::Directory::CreateDirectoryW(pathWord) ;
FileSystem::Directory::CreateDirectory(pathWord) ;
try
{
......@@ -43,9 +43,10 @@ public:
m_oWriter.m_oContentTypes.AddContent( _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"), _T("/word/document.xml") );
CString sXml = CreateXmlStart( );
CStringA sXmlUTF = Convert::UnicodeToUtf8( sXml );
m_oFileWriter->Write( (BYTE*)(LPCSTR)sXmlUTF, sXmlUTF.GetLength() );
return true;
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
return true;
}
bool SaveByItem()
{
......@@ -81,8 +82,9 @@ public:
}
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
CStringA sXmlUTF = Convert::UnicodeToUtf8( sXml );
m_oFileWriter->Write( (BYTE*)(LPCSTR)sXmlUTF, sXmlUTF.GetLength() );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
//удаляем секцию
m_oDocument.RemoveItem( 0 );
......@@ -92,9 +94,10 @@ public:
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
CStringA sXmlUTF = Convert::UnicodeToUtf8( sXml );
m_oFileWriter->Write( (BYTE*)(LPCSTR)sXmlUTF, sXmlUTF.GetLength() );
}
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
}
return true;
}
......@@ -111,13 +114,15 @@ public:
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
CStringA sXmlUTF = Convert::UnicodeToUtf8( sXml );
m_oFileWriter->Write( (BYTE*)(LPCSTR)sXmlUTF, sXmlUTF.GetLength() );
}
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
CString sXml = CreateXmlEnd( );
CStringA sXmlUTF = Convert::UnicodeToUtf8( sXml );
m_oFileWriter->Write( (BYTE*)(LPCSTR)sXmlUTF, sXmlUTF.GetLength() );
RELEASEOBJECT( m_oFileWriter );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
RELEASEOBJECT( m_oFileWriter );
return true;
}
int GetCount()
......@@ -127,4 +132,4 @@ public:
nCount += m_oDocument[i]->GetCount();
return nCount;
}
};
\ No newline at end of file
};
......@@ -14,8 +14,8 @@ public:
{
CString pathWord = sFolder + FILE_SEPARATOR_STR + _T("word");
FileSystem::Directory::CreateDirectoryW(pathWord) ;
FileSystem::Directory::CreateDirectoryW(pathWord + FILE_SEPARATOR_STR + _T("theme")) ;
FileSystem::Directory::CreateDirectory(pathWord) ;
FileSystem::Directory::CreateDirectory(pathWord + FILE_SEPARATOR_STR + _T("theme")) ;
//todooo default theme !!!!!
//
......@@ -30,4 +30,4 @@ public:
//}
return true;
}
};
\ No newline at end of file
};
......@@ -112,7 +112,7 @@ bool OOXWriter::SaveByItemEnd()
}
//-----------------------------------------------------------------------------------------------------
OOX::CPath pathTheme = pathWord + FILE_SEPARATOR_STR + _T("theme");
FileSystem::Directory::CreateDirectoryW(pathTheme.GetPath()) ;
FileSystem::Directory::CreateDirectory(pathTheme.GetPath()) ;
Writers::DefaultThemeWriter themeWriter;
themeWriter.Write(pathTheme.GetPath() + FILE_SEPARATOR_STR + _T("theme1.xml"));
......@@ -137,4 +137,4 @@ bool OOXWriter::SaveByItemEnd()
for( int i = 0; i < (int)m_oCustomRelsWriter.size(); i++ )
m_oCustomRelsWriter[i]->Save(pathWord.GetPath());
return nResult;
}
\ No newline at end of file
}
......@@ -75,42 +75,21 @@ using namespace ATL;
#endif
/*
typedef int BOOL;
static const BOOL TRUE = 1;
static const BOOL FALSE = 0;
typedef int HRESULT;
static const HRESULT S_OK = 0;
static const HRESULT S_FALSE = -1;
typedef unsigned char BYTE;
typedef unsigned short USHORT;
typedef short SHORT;
typedef long LONG;
typedef unsigned long ULONG;
typedef unsigned int DWORD;
typedef unsigned long long ULONG64;
typedef long long LONG64;
typedef wchar_t WCHAR;
*/
#ifndef _wtof
#include <string>
#define _wtof std::stod
#define _wtoi std::stoi
#define _wtoi64(p) std::wcstoll((p),NULL,10)
#ifdef UNICODE
#define _ttoi _wtoi
#define _tstof _wtof
#define _stscanf swscanf
#else
#define _ttoi atoi
#define _tstof atof
#define _stscanf scanf
#endif // #ifdef UNICODE
#include <string>
#define _wtof std::stod
#define _wtoi std::stoi
#define _wtoi64(p) std::wcstoll((p),NULL,10)
#ifdef UNICODE
#define _ttoi _wtoi
#define _tstof _wtof
#define _stscanf swscanf
#else
#define _ttoi atoi
#define _tstof atof
#define _stscanf scanf
#endif // #ifdef UNICODE
#endif // #ifndef _wtof
#endif // #if defined(_WIN32) || defined (_WIN64)
......
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