Commit 4d6e99bd authored by Ivan.Shulga's avatar Ivan.Shulga Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52309 954022d7-b5bf-4e40-9824-e11837661b57
parent 56b85d28
#pragma once
#include <atlcoll.h>
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "IdGenerator.h"
#include "RtfDefine.h"
#include <boost/shared_ptr.hpp>
......
#pragma once
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfDocument.h"
#include "OOXReader.h"
......
#pragma once
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfDocument.h"
#include "RtfProperty.h"
#include "OOXReaderBasic.h"
......
#pragma once
#include "stdafx.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
class OOXContentTypesWriter
{
......
#pragma once
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfDocument.h"
#include "OOXReader.h"
......
#pragma once
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "OOXRelsWriter.h"
#include "Resource.h"
......
......@@ -2,7 +2,7 @@
#include "stdafx.h"
#include "RtfDocument.h"
#include "OOXWriter.h"
#include "FileWriter.h"
#include "../Common/FileWriter.h"
class OOXDocumentWriter
{
......
#pragma once
#include "stdafx.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "OOXWriter.h"
class OOXFootnoteWriter
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "StringUtils.h"
#include "../Common/XmlUtils.h"
#include "../Common/StringUtils.h"
#include "RtfProperty.h"
#include "Utils.h"
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
class OOXMathPropReader
{
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfMath.h"
class OOXMathReader
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "OOXLevelReader.h"
class OOXNumberingMapReader
......
#pragma once
#include "RtfPicture.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "OOXReaderBasic.h"
#define PICTURE_BUFFER_SIZE 1024
......
#pragma once
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
class OOXRelsReader
{
......
#pragma once
#include "stdafx.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfDocument.h"
class OOXRelsWriter
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfProperty.h"
#include "OOXrPrReader.h"
#include "RtfField.h"
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfShape.h"
#include "OOXPictureGraphicReader.h"
#include "OOXReaderBasic.h"
......
#pragma once
#include "stdafx.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "IdGenerator.h"
#include "Resource.h"
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfTable.h"
#include "OOXTableReader.h"
#include "OOXParagraphReader.h"
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "OOXTableCellReader.h"
#include "RtfTableRow.h"
#include "OOXtrPrReader.h"
......
......@@ -2,7 +2,7 @@
#include "OOXColorSchemeReader.h"
#include "OOXFontSchemeReader.h"
#include "Utils.h"
#include "ATLDefine.h"
#include "../Common/ATLDefine.h"
class OOXThemeReader
{
......
#pragma once
#include "stdafx.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "IdGenerator.h"
#include "ATLDefine.h"
#include "../Common/ATLDefine.h"
#include "Resource.h"
class OOXThemeWriter
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfProperty.h"
#include "OOXFontReader.h"
#include "OOXReaderBasic.h"
......
#pragma once
#include "RtfDocument.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "OOXBorderReader.h"
#include "OOXcnfStyleReader.h"
......
#pragma once
#include "Basic.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "Utils.h"
#include "RtfProperty.h"
......
#pragma once
#include "RtfProperty.h"
#include "Utils.h"
#include "MediaFormatDefine.h"
#include "../Common/MediaFormatDefine.h"
class RtfPicture : public IDocumentElement
{
//public: RtfShape m_oShapeProp;
......
......@@ -3,7 +3,7 @@
#include "RtfWriter.h"
#include "OOXWriter.h"
#include "RtfProperty.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
CString RtfFont::RenderToRtf(RenderParameter oRenderParameter)
{
......
#pragma once
#include "RtfPicture.h"
#include "MediaFormatDefine.h"
#include "../Common/MediaFormatDefine.h"
class RtfShape: public IRenderableProperty
{
......
#pragma once
#include "Basic.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfTableRow.h"
......
#pragma once
#include "Basic.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
class RtfTableCell : public ITextItemContainer
{
......
#pragma once
#include "Basic.h"
#include "XmlUtils.h"
#include "../Common/XmlUtils.h"
#include "RtfTableCell.h"
class RtfTableRow : public IDocumentElement, public ItemContainer< RtfTableCellPtr >
......
#pragma once
#include "FileWriter.h"
#include "AtlDefine.h"
#include "..\AVSOfficeUniversalConverter\Utils.h"
#include "../Common/FileWriter.h"
#include "../Common/AtlDefine.h"
#include "UniversalConverterUtils.h"
class RtfDocument;
......
#pragma once
#define BUFSIZE 2048
#include <time.h>
class CCritSect
{
public: CRITICAL_SECTION m_csThread;
CCritSect()
{
InitializeCriticalSection(&m_csThread);
}
~CCritSect()
{
DeleteCriticalSection(&m_csThread);
}
};
__declspec(selectany) CCritSect g_oCS;
class Utils
{
public: static INT32 CopyDirOrFile(CString sSource, CString sDestination)
{
// '\' '/'
int nSourceLen = sSource.GetLength();
int nDestLen = sDestination.GetLength();
if( sSource[ nSourceLen - 1 ] == '\\' || sSource[ nSourceLen - 1 ] == '/' )
sSource.Delete( nSourceLen - 1, 1 );
if( sDestination[ nDestLen - 1 ] == '\\' || sDestination[ nDestLen - 1 ] == '/' )
sDestination.Delete( nDestLen - 1, 1 );
// sDestination, .
if( 0 != RemoveDirOrFile( sDestination ) )
return 1;
//
DWORD dwFileAttrib = ::GetFileAttributes( sSource );
if( dwFileAttrib != INVALID_FILE_ATTRIBUTES )
{
DWORD dwResult = 0;
if( 0 != (FILE_ATTRIBUTE_DIRECTORY & dwFileAttrib) )
{
DWORD dwRes = CreateDirectory( sDestination ,NULL) ;
DWORD dwExistDirAttrib = ::GetFileAttributes( sDestination );
if( dwExistDirAttrib == INVALID_FILE_ATTRIBUTES)
return dwRes;
HANDLE Handle;
WIN32_FIND_DATA FindData;
DWORDLONG Result = 0;
Handle = FindFirstFile( ( sSource + _T("\\*.*") ), &FindData );
if ( Handle == INVALID_HANDLE_VALUE )
return 0;
do
{
BOOL bRes = TRUE;
if( ( CString( FindData.cFileName ) != _T(".") ) && ( CString( FindData.cFileName ) != _T("..") ) )
if( FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
dwResult = CopyDirOrFile( sSource + _T("\\") + FindData.cFileName, sDestination + _T("\\") + FindData.cFileName );
else
bRes = CopyFile( sSource + _T("\\") + FindData.cFileName, sDestination + _T("\\") + FindData.cFileName, FALSE );
if( FALSE == bRes || 1 == dwResult )
{
dwResult = 1;
break;
}
}
while( FindNextFile( Handle, &FindData ) != 0 );
FindClose( Handle );
}
else
{
BOOL bRes = CopyFile( sSource, sDestination, FALSE );
if( FALSE == bRes )
dwResult = 1;
}
return dwResult;
}// 0 -
return 0;
}
// return ""
public: static INT32 RemoveDirOrFile(CString sPath)
{
DWORD dwFileAttrib = ::GetFileAttributes( sPath );
if( dwFileAttrib != INVALID_FILE_ATTRIBUTES )
{
DWORD dwResult = 0;
if( 0 != (FILE_ATTRIBUTE_DIRECTORY & dwFileAttrib) )
{
HANDLE Handle;
WIN32_FIND_DATA FindData;
DWORDLONG Result = 0;
Handle = FindFirstFile( ( sPath + _T("\\*.*") ), &FindData );
if ( Handle == INVALID_HANDLE_VALUE )
return 0;
do
{
BOOL bRes = TRUE;
if( ( CString( FindData.cFileName ) != _T(".") ) && ( CString( FindData.cFileName ) != _T("..") ) )
if( FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
Result += RemoveDirOrFile( sPath + _T("\\") + FindData.cFileName ); //
else
bRes = DeleteFile( sPath + _T("\\") + FindData.cFileName );
if( FALSE == bRes )
dwResult += 1;
}
while( FindNextFile( Handle, &FindData ) != 0 );
FindClose( Handle );
BOOL bRes = RemoveDirectory( sPath );
if( FALSE == bRes )
dwResult += 1;
}
else
{
if( FALSE == DeleteFile( sPath ) )
dwResult = 1;
}
return dwResult;
}// 0 -
return 0;
}
public: static CString CreateTempFile( )
{
DWORD dwBufSize = BUFSIZE;
TCHAR lpPathBuffer[BUFSIZE];
//
DWORD dwRetVal = ::GetTempPath(dwBufSize,lpPathBuffer);
if( dwRetVal < dwBufSize && 0 != dwRetVal )
return CreateTempFile( CString(lpPathBuffer) );
else
return _T("");
}
public: static CString CreateTempFile( CString sDir )
{
if( _T("") != sDir )
{
int nLen = sDir.GetLength();
if( sDir.GetLength() > 0 && ( sDir[sDir.GetLength() - 1 ] == '\\' || sDir[sDir.GetLength()- 1 ] == '/' ) )
{
sDir = sDir.Left( sDir.GetLength() - 1 );
}
TCHAR szTempName[BUFSIZE];
//
UINT uRetVal = ::GetTempFileName(sDir, NULL, 0, szTempName);
//HANDLE hFile = CreateFile( szTempName, GENERIC_ALL, FILE_SHARE_READ , NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (0!=uRetVal)
{
//RELEASEHANDLE( hFile );
return CString( szTempName );
}
else
return _T("");
}
else
return CreateTempFile();
}
// return ""
public: static CString CreateTempDir( CString sDir )// sDir
{
if( _T("") != sDir )
{
int nLen = sDir.GetLength();
if( sDir.GetLength() > 0 && ( sDir[sDir.GetLength() - 1 ] == '\\' || sDir[sDir.GetLength()- 1 ] == '/' ) )
{
sDir = sDir.Left( sDir.GetLength() - 1 );
}
HANDLE oMutex = CreateMutex(NULL, FALSE, _T("AVSOfficeUniversalConverter_Utils_h"));
DWORD dwWaitResult = WaitForSingleObject( oMutex, INFINITE);
DWORD dwRes = 0;
CString sNewDirName;
try
{
if(WAIT_OBJECT_0 == dwWaitResult)
{
srand( (unsigned)time(NULL) );
do
{
int nRandom = rand() % 100000000;
CString sRandName;
sRandName.AppendFormat( _T("AvsTmpDll%d"), nRandom );
sNewDirName = sDir + _T("\\") + sRandName;
}
while( INVALID_FILE_ATTRIBUTES != ::GetFileAttributes( sNewDirName ) );
dwRes = CreateDirectory( sNewDirName ,NULL);
}
}
catch(...)
{
}
ReleaseMutex(oMutex);
if( 0 != dwRes)
return sNewDirName;
return _T("");
}
else
return CreateTempDir();
}
public: static CString CreateTempDir()
{
DWORD dwBufSize = BUFSIZE;
TCHAR lpPathBuffer[BUFSIZE];
//
DWORD dwRetVal = ::GetTempPath(dwBufSize, lpPathBuffer);
if( dwRetVal < dwBufSize && 0 != dwRetVal )
return CreateTempDir( CString(lpPathBuffer) );
else
return _T("");
}
public: static CString PrepareToXML( CString sInput)
{
CString sResult = sInput;
//&amp; (&), &lt; (<), &gt; (>), &apos; ('), &quot; (")
sResult.Replace(_T("&"), _T("&amp;"));
sResult.Replace(_T("<"), _T("&lt;"));
sResult.Replace(_T(">"), _T("&gt;"));
sResult.Replace(_T("\""), _T("&quot;"));
sResult.Replace(_T("'"), _T("&apos;"));
return sResult;
}
public: static CStringA UnicodeToCodepage( CStringW sUni, UINT nCodepage = CP_UTF8 )
{
CStringA sUtf;
int nBufSize = WideCharToMultiByte(nCodepage, 0, sUni, -1, NULL, NULL, NULL, NULL);
LPSTR pBuff = new CHAR[ nBufSize + 1 ];
WideCharToMultiByte(nCodepage, 0, sUni, -1, pBuff, nBufSize, NULL, NULL);
pBuff[ nBufSize ] = 0;
sUtf.Append( pBuff );
delete pBuff;
return sUtf;
}
public: static CStringW CodepageToUnicode( CStringA sUtf, UINT nCodepage = CP_UTF8 )
{
CStringW sUni;
int nBufSize = MultiByteToWideChar(nCodepage, 0, sUtf, -1, NULL, NULL);
LPWSTR pBuff = new WCHAR[ nBufSize + 1 ];
MultiByteToWideChar(nCodepage, 0, sUtf, -1, pBuff, nBufSize);
pBuff[ nBufSize ] = 0;
sUni.Append( pBuff );
delete pBuff;
return sUni;
}
};
#pragma once
#include "StringUtils.h"
#include "ATLDefine.h"
#include "..\AVSOfficeUniversalConverter\Utils.h"
#include "../Common/StringUtils.h"
#include "../Common/ATLDefine.h"
#include "UniversalConverterUtils.h"
#include "../Common/OfficeFileTemplate.h"
#include "FileWriter.h"
#include "XmlUtils.h"
#include "../Common/FileWriter.h"
#include "../Common/XmlUtils.h"
#define BUF_SIZE 2048
#define ONE_INCH 2.54
......
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