Commit 5bfc9ca5 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

(1.0.0.132) opensource & full versions

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52554 954022d7-b5bf-4e40-9824-e11837661b57
parent 344c6c83
//Microsoft Visual C++ generated resource script.
//
#define COMPONENT_NAME "OfficePDFWriter"
#include "../../../../Common/FileInfo.h"
#include "../Common/FileInfo.h"
#include "version.h"
#include "resource.h"
......
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AVSOfficePDFWriter", "AVSOfficePDFWriter_vs2005.vcproj", "{FD508B11-154E-491B-BA4A-EA81978955EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseASC|Win32 = ReleaseASC|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FD508B11-154E-491B-BA4A-EA81978955EF}.Debug|Win32.ActiveCfg = Debug|Win32
{FD508B11-154E-491B-BA4A-EA81978955EF}.Debug|Win32.Build.0 = Debug|Win32
{FD508B11-154E-491B-BA4A-EA81978955EF}.Release|Win32.ActiveCfg = Release|Win32
{FD508B11-154E-491B-BA4A-EA81978955EF}.Release|Win32.Build.0 = Release|Win32
{FD508B11-154E-491B-BA4A-EA81978955EF}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{FD508B11-154E-491B-BA4A-EA81978955EF}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -51,7 +51,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\AVSVideoStudio3\Common;..\..\AVSOfficeStudio\AVSOfficePDFWriter\Zlib;..\..\AVSImageStudio3\AVSGraphics\Objects\Font\FreeType"
AdditionalIncludeDirectories="../OfficeCore/Fonts/FreeType"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES"
MinimalRebuild="true"
BasicRuntimeChecks="3"
......@@ -122,7 +122,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="..\..\..\..\AVS\Redist\VersionControl.exe &quot;$(SolutionDir)\version.h&quot;"
CommandLine="..\Redist\VersionControl.exe &quot;$(SolutionDir)\version.h&quot;"
/>
<Tool
Name="VCCustomBuildTool"
......@@ -147,7 +147,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\AVSVideoStudio3\Common;..\..\AVSOfficeStudio\AVSOfficePDFWriter\Zlib;..\..\AVSImageStudio3\AVSGraphics\Objects\Font\FreeType"
AdditionalIncludeDirectories="../OfficeCore/Fonts/FreeType"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
......
#ifndef _BASE_64_H
#define _BASE_64_H
#include <iostream>
static const std::string c_sBase64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
class CBase64
{
public:
CBase64()
{
}
~CBase64()
{
}
BYTE* GetBuffer(void)
{
return (BYTE*)m_sBuffer.c_str();
}
int GetSize(void)
{
return m_sBuffer.length();
}
std::string GetString()
{
return m_sBuffer;
}
void Encode(BYTE *pBytesToEncode, unsigned int unSize)
{
m_sBuffer = Base64Encode( pBytesToEncode, unSize );
}
void Encode(BYTE **ppBytesToEncode, unsigned int *punSize)
{
Encode( *ppBytesToEncode, *punSize );
*punSize = GetSize();
delete [](*ppBytesToEncode);
*ppBytesToEncode = new BYTE[*punSize];
if ( !(*ppBytesToEncode) )
return;
::memcpy( *ppBytesToEncode, GetBuffer(), sizeof(BYTE) * *punSize );
}
void Decode(BYTE *pBytesToDecode, unsigned int unSize)
{
std::string sEncodedString;
for ( unsigned int unIndex = 0; unIndex < unSize; unIndex++ )
{
sEncodedString += pBytesToDecode[unIndex];
}
m_sBuffer = Base64Decode( sEncodedString );
}
void Decode(BYTE **ppBytesToDecode, unsigned int *punSize)
{
Decode( *ppBytesToDecode, *punSize );
*punSize = GetSize();
delete [](*ppBytesToDecode);
*ppBytesToDecode = new BYTE[*punSize];
if ( !(*ppBytesToDecode) )
return;
::memcpy( *ppBytesToDecode, GetBuffer(), sizeof(BYTE) * *punSize );
}
private:
inline bool IsBase64(unsigned char nChar)
{
return ( isalnum(nChar) || ( '+' == nChar ) || ( '/' == nChar ) );
}
std::string Base64Encode(unsigned char const *pBuffer, unsigned int unSize)
{
std::string sResult;
unsigned char arrChar_3[3];
unsigned char arrChar_4[4];
int nI = 0;
int nJ = 0;
while ( unSize-- )
{
arrChar_3[nI++] = *(pBuffer++);
if ( 3 == nI )
{
arrChar_4[0] = ( arrChar_3[0] & 0xfc ) >> 2;
arrChar_4[1] = ( ( arrChar_3[0] & 0x03 ) << 4 ) + ( ( arrChar_3[1] & 0xf0 ) >> 4);
arrChar_4[2] = ( ( arrChar_3[1] & 0x0f ) << 2 ) + ( ( arrChar_3[2] & 0xc0 ) >> 6);
arrChar_4[3] = arrChar_3[2] & 0x3f;
for( nI = 0; nI < 4 ; nI++ )
{
sResult += c_sBase64Chars[arrChar_4[nI]];
}
nI = 0;
}
}
if ( nI )
{
for( nJ = nI; nJ < 3; nJ++ )
{
arrChar_3[nJ] = '\0';
}
arrChar_4[0] = ( arrChar_3[0] & 0xfc ) >> 2;
arrChar_4[1] = ( ( arrChar_3[0] & 0x03 ) << 4 ) + ( ( arrChar_3[1] & 0xf0 ) >> 4 );
arrChar_4[2] = ( ( arrChar_3[1] & 0x0f ) << 2 ) + ( ( arrChar_3[2] & 0xc0 ) >> 6 );
arrChar_4[3] = arrChar_3[2] & 0x3f;
for ( nJ = 0; nJ < nI + 1; nJ++ )
{
sResult += c_sBase64Chars[arrChar_4[nJ]];
}
while( nI++ < 3 )
{
sResult += '=';
}
}
return sResult;
}
std::string Base64Decode(std::string const& sEncodedString)
{
std::string sResult;
int nSize = sEncodedString.size();
int nI = 0;
int nJ = 0;
int nPos = 0;
unsigned char arrChar_3[3];
unsigned char arrChar_4[4];
while ( nSize-- && ( sEncodedString[nPos] != '=' ) && IsBase64( sEncodedString[nPos] ) )
{
arrChar_4[nI++] = sEncodedString[nPos];
nPos++;
if ( 4 == nI )
{
for ( nI = 0; nI < 4; nI++ )
{
arrChar_4[nI] = c_sBase64Chars.find( arrChar_4[nI] );
}
arrChar_3[0] = ( arrChar_4[0] << 2 ) + ( ( arrChar_4[1] & 0x30 ) >> 4 );
arrChar_3[1] = ( ( arrChar_4[1] & 0xf ) << 4 ) + ( ( arrChar_4[2] & 0x3c ) >> 2 );
arrChar_3[2] = ( ( arrChar_4[2] & 0x3 ) << 6 ) + arrChar_4[3];
for ( nI = 0; nI < 3; nI++ )
{
sResult += arrChar_3[nI];
}
nI = 0;
}
}
if ( nI )
{
for ( nJ = nI; nJ < 4; nJ++ )
{
arrChar_4[nJ] = 0;
}
for ( nJ = 0; nJ < 4; nJ++)
{
arrChar_4[nJ] = c_sBase64Chars.find( arrChar_4[nJ] );
}
arrChar_3[0] = ( arrChar_4[0] << 2 ) + ( ( arrChar_4[1] & 0x30 ) >> 4 );
arrChar_3[1] = ( ( arrChar_4[1] & 0xf ) << 4 ) + ( ( arrChar_4[2] & 0x3c ) >> 2 );
arrChar_3[2] = ( ( arrChar_4[2] & 0x3 ) << 6 ) + arrChar_4[3];
for ( nJ = 0; nJ < nI - 1; nJ++ )
{
sResult += arrChar_3[nJ];
}
}
return sResult;
}
private:
std::string m_sBuffer;
};
#endif /* _BASE_64_H */
\ No newline at end of file
......@@ -1063,6 +1063,18 @@ struct ImageUtils
{
static inline IUnknown* LoadImage(CString sFilePath)
{
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
OfficeCore::IImageGdipFilePtr pImageFile;
pImageFile.CreateInstance(OfficeCore::CLSID_CImageGdipFile);
BSTR filename = sFilePath.AllocSysString();
pImageFile->OpenFile(filename);
SysFreeString(filename);
IUnknown* punkFrame = NULL;
pImageFile->get_Frame(&punkFrame);
return punkFrame;
#else
ImageStudio::IImageTransforms* pTransform = NULL;
if (FAILED(CoCreateInstance(__uuidof(ImageStudio::ImageTransforms), NULL, CLSCTX_INPROC_SERVER, __uuidof(ImageStudio::IImageTransforms), (void**)(&pTransform))))
return NULL;
......@@ -1124,6 +1136,7 @@ struct ImageUtils
return NULL;
return vImage.punkVal;
#endif
}
};
......
......@@ -1086,6 +1086,9 @@ ImageDict LoadRawImageFromMem (Doc pPDF, const BYTE *pBuffer, unsigned int nW
}
ImageDict LoadJbig2ImageFromInt(Doc pPDF, IUnknown **pInterface, unsigned int nWidth, unsigned int nHeight, unsigned int unImageCheckSum, BOOL bAlpha = FALSE, const BYTE *pAlphaBuffer = NULL, unsigned int unAlphaCheckSum = 0)
{
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
return NULL;
#else
ImageDict pImage = NULL;
if ( !(HasDoc(pPDF)) )
......@@ -1125,6 +1128,7 @@ ImageDict LoadJbig2ImageFromInt(Doc pPDF, IUnknown **pInterface, unsigned int nW
#endif
return pImage;
#endif
}
ImageDict LoadJpegImageFromFile(Doc pPDF, const wchar_t *wsFileName)
{
......@@ -1173,6 +1177,9 @@ ImageDict LoadJpxImageFromFile (Doc pPDF, const wchar_t *wsFileName, long nOpaci
}
ImageDict LoadJpxImageFromMem (Doc pPDF, const BYTE *pBuffer, unsigned int nWidth, unsigned int nHeight, unsigned int unImageCheckSum, BOOL bAlpha = FALSE, const BYTE *pAlphaBuffer = NULL, unsigned int unAlphaCheckSum = 0)
{
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
return NULL;
#else
if ( !HasDoc( pPDF ))
return NULL;
......@@ -1319,6 +1326,7 @@ ImageDict LoadJpxImageFromMem (Doc pPDF, const BYTE *pBuffer, unsigned int nW
#endif
return pImage;
#endif
}
ImageDict LoadJpegImageFromMem (Doc pPDF, const BYTE *pBuffer, unsigned int nWidth, unsigned int nHeight, unsigned int unImageCheckSum, BOOL bAlpha = FALSE, const BYTE *pAlphaBuffer = NULL, unsigned int unAlphaCheckSum = 0)
{
......@@ -1372,6 +1380,15 @@ ImageDict LoadJpegImageFromMem (Doc pPDF, const BYTE *pBuffer, unsigned int nW
return NULL;
}
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
OfficeCore::IImageGdipFilePtr pImageFile;
pImageFile.CreateInstance(OfficeCore::CLSID_CImageGdipFile);
pImageFile->put_Frame((IUnknown*)pInterface);
BSTR bsTempFile = ::SysAllocString( wsTempFile );
pImageFile->SaveFile(bsTempFile, 3);
SysFreeString(bsTempFile);
#else
// Jpx
ImageFile::IImageFile3 *pImageFile = NULL;
::CoCreateInstance( __uuidof( ImageFile::ImageFile3 ), NULL, CLSCTX_ALL, __uuidof( ImageFile::IImageFile3 ), (void**)&pImageFile );
......@@ -1387,6 +1404,7 @@ ImageDict LoadJpegImageFromMem (Doc pPDF, const BYTE *pBuffer, unsigned int nW
RELEASEINTERFACE( pInterface );
RELEASEINTERFACE( pImageFile );
#endif
if ( bAlpha )
{
......
......@@ -308,8 +308,9 @@ namespace NSImageExt
return 0;
}
BOOL DrawOnRenderer(AVSGraphics::IAVSRenderer* pRenderer, BSTR strFile, double dX, double dY, double dW, double dH)
BOOL DrawOnRenderer(IASCRenderer* pRenderer, BSTR strFile, double dX, double dY, double dW, double dH)
{
#if BUILD_CONFIG_FULL_VERSION
if (NULL == pRenderer)
return FALSE;
......@@ -378,6 +379,7 @@ namespace NSImageExt
return TRUE;
}
#endif
return FALSE;
}
......
......@@ -4,7 +4,7 @@
HRESULT CPDFWriter::OnlineWordToPdf (BSTR sPathXml, BSTR sDstFile, BSTR sHtmlPlace, LONG nReg)
{
using namespace NOnlineOfficeBinToPdf;
bool hRes = S_OK;
HRESULT hRes = S_OK;
NOnlineOfficeBinToPdf::CommandType eCommand = NOnlineOfficeBinToPdf::ctError;
CString sTempLogo;
......@@ -14,6 +14,11 @@ HRESULT CPDFWriter::OnlineWordToPdf (BSTR sPathXml, BSTR sDstFile, BSTR sHtmlPla
try
{
hRes = CoCreateInstance (AVSGraphics::CLSID_CAVSWinFonts, NULL, CLSCTX_ALL, AVSGraphics::IID_IAVSWinFonts, (void **) &piWinFonts);
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
piWinFonts->Init(L"", TRUE, TRUE);
#endif
if (S_OK != hRes)
throw "Can't create IAVSWinFonts object!";
......
B// PDFWriter.h : Declaration of the CPDFWriter
......
......@@ -3,7 +3,7 @@
#include <float.h>
#include <atlstr.h>
#include <atlcoll.h>
#include <atldefine.h>
#include "../Common/atldefine.h"
#include "Utils.h"
#include "Objects.h"
......
......@@ -1014,8 +1014,62 @@ BOOL GetFontFile (NSStructures::CFont *pFont, LPCTSTR lpszFontName, LPTST
return bResult;
}
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
BOOL GetFontFile2(NSStructures::CFont *pFont, LPCTSTR lpszFontName, LPTSTR lpszDisplayName, int nDisplayNameSize, LPTSTR lpszFontFile, int nFontFileSize, BOOL *bBold, BOOL *bItalic, OfficeCore::IWinFonts *pFontManager = NULL)
{
if ( pFontManager )
{
long lStyle = *bBold + 2 * *bItalic;
CString sParams;
sParams.Format( _T("<FontProperties><Name value='%s'/><Style bold='%d' italic='%d'/></FontProperties>"), lpszFontName, ( *bBold ? 1 : 0 ), ( *bItalic ? 1 : 0 ) );
BSTR bsParams = sParams.AllocSysString();
BSTR bsFontName = NULL;
BSTR bsFontPath = NULL;
BSTR bsFontStyle = NULL;
LONG lIndex = 0;
if ( FAILED( pFontManager->raw_GetWinFontByParams( bsParams, &bsFontName, &bsFontPath, &bsFontStyle, &lIndex ) ) )
{
::SysFreeString( bsParams );
::SysFreeString( bsFontName );
::SysFreeString( bsFontPath );
::SysFreeString( bsFontStyle );
return FALSE;
}
::SysFreeString( bsParams );
::memset( lpszFontFile, 0x00, nFontFileSize );
::memset( lpszDisplayName, 0x00, nDisplayNameSize );
_tcsncpy( lpszFontFile, bsFontPath, min( nFontFileSize - 1, wcslen( bsFontPath ) ) );
::SysFreeString( bsFontPath );
_tcsncpy( lpszDisplayName, bsFontName, min( nDisplayNameSize - 1, wcslen( bsFontName ) ) );
::SysFreeString( bsFontName );
BOOL GetFontFile2(NSStructures::CFont *pFont, LPCTSTR lpszFontName, LPTSTR lpszDisplayName, int nDisplayNameSize, LPTSTR lpszFontFile, int nFontFileSize, BOOL *bBold, BOOL *bItalic, AVSGraphics::IAVSFontManager *pFontManager = NULL)
// pFontManager->raw_GetAdditionalParam( _T("GetFontIndex"), &vTemp );
CString sStyle( bsFontStyle );
::SysFreeString( bsFontStyle );
if ( *bBold && -1 != sStyle.Find( _T("Bold") ) )
*bBold = FALSE;
if ( *bItalic && ( -1 != sStyle.Find( _T("Italic") ) || -1 != sStyle.Find( _T("Oblique") ) ) )
*bItalic = FALSE;
return TRUE;
}
else
{
return GetFontFile( pFont, lpszFontName, lpszDisplayName, nDisplayNameSize, lpszFontFile, nFontFileSize, bBold, bItalic );
}
}
#else
BOOL GetFontFile2(NSStructures::CFont *pFont, LPCTSTR lpszFontName, LPTSTR lpszDisplayName, int nDisplayNameSize, LPTSTR lpszFontFile, int nFontFileSize, BOOL *bBold, BOOL *bItalic, AVSGraphics::IAVSFontManager *pFontManager = NULL)
{
if ( pFontManager )
{
......@@ -1086,6 +1140,7 @@ BOOL GetFontFile2(NSStructures::CFont *pFont, LPCTSTR lpszFontName, LPTST
return GetFontFile( pFont, lpszFontName, lpszDisplayName, nDisplayNameSize, lpszFontFile, nFontFileSize, bBold, bItalic );
}
}
#endif
//-----------------------------------------------------------------------------------------------------
// CRC 32
//-----------------------------------------------------------------------------------------------------
......
......@@ -37,18 +37,6 @@
#pragma warning(disable: 4018 4996 4101 4305 4244)
// 4101 ,
// FreeType
#include <ft2build.h>
#include FT_FREETYPE_H
//#ifdef _VS_2005
#pragma comment (lib, "..\\..\\AVSImageStudio3\\AVSGraphics\\Objects\\Font\\FreeType\\freetype242_vs2005.lib")
//#endif
//
//#ifdef _VS_2008
//#pragma comment (lib, "FreeType\\freetype2312.lib")
//#endif
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
......@@ -58,7 +46,41 @@
#include <atlsafe.h>
#include <atlcoll.h>
#include <atlstr.h>
#include <atldefine.h>
#include "../Common/atldefine.h"
#include "../Common/Config.h"
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
#include <ft2build.h>
#include FT_FREETYPE_H
#pragma comment (lib, "../OfficeCore/Fonts/FreeType/freetype242_vs2005.lib")
#import "../Redist/OfficeCore.dll" named_guids rename_namespace("OfficeCore")
namespace MediaCore
{
typedef OfficeCore::IUncompressedFrame IAVSUncompressedVideoFrame;
const GUID CLSID_CAVSUncompressedVideoFrame = OfficeCore::CLSID_CUncompressedFrame;
const GUID IID_IAVSUncompressedVideoFrame = OfficeCore::IID_IUncompressedFrame;
}
namespace AVSGraphics
{
typedef OfficeCore::IWinFonts IAVSWinFonts;
const GUID CLSID_CAVSWinFonts = OfficeCore::CLSID_CWinFonts;
const GUID IID_IAVSWinFonts = OfficeCore::IID_IWinFonts;
}
#else
// FreeType
#include <ft2build.h>
#include FT_FREETYPE_H
#pragma comment (lib, "..\\..\\AVSImageStudio3\\AVSGraphics\\Objects\\Font\\FreeType\\freetype242_vs2005.lib")
#import "../../../../AVS/Redist/AVSMediaCore3.dll" named_guids rename_namespace("MediaCore"), exclude("tagRECT")
#import "../../../../AVS/Redist/AVSMediaFormatSettings3.dll" named_guids rename_namespace("MediaFormat"), exclude("tagRECT")
......@@ -67,5 +89,6 @@
#import "../../../../AVS/Redist/AVSImageJpeg2000.dll" named_guids rename_namespace("Jpx")
#import "../../../../AVS/Redist/AVSImageFile3.dll" named_guids rename_namespace("ImageFile")
#import "../../../../AVS/Redist/AVSGraphics.dll" named_guids rename_namespace("AVSGraphics")
#endif
using namespace ATL;
\ No newline at end of file
......@@ -2,6 +2,6 @@
//1
//0
//0
//131
#define INTVER 1,0,0,131
#define STRVER "1,0,0,131\0"
//132
#define INTVER 1,0,0,132
#define STRVER "1,0,0,132\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