Commit e3091a43 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@61923 954022d7-b5bf-4e40-9824-e11837661b57
parent 8836662b
......@@ -375,6 +375,31 @@ 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
ASCOfficeUtils/ASCOfficeUtilsLib/Mac svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib.xcodeproj svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib.xcodeproj/project.xcworkspace svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib.xcodeproj/project.xcworkspace/xcuserdata svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib.xcodeproj/project.xcworkspace/xcuserdata/alexey.musinov.xcuserdatad svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib.xcodeproj/project.xcworkspace/xcuserdata/alexey.musinov.xcuserdatad/UserInterfaceState.xcuserstate svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib.xcodeproj/xcuserdata svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ASCOfficeUtilsLib/Mac/ASCOfficeUtilsLib.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad/xcschemes svnc_tsvn_003alogminsize=5
ASCOfficeUtils/ZLIB/crtdll/crtdll.lib svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib-1.2.3/contrib/blast/test.pk svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib-1.2.3/contrib/dotzlib/DotZLib.chm svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib-1.2.3/contrib/masmx64/gvmat64.obj svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib-1.2.3/contrib/masmx64/inffasx64.obj svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib-1.2.3/contrib/masmx86/gvmat32.obj svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib-1.2.3/contrib/masmx86/inffas32.obj svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib-1.2.3/contrib/puff/zeros.raw svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib123dll/dll32/demo/miniunz.exe svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib123dll/dll32/demo/minizip.exe svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib123dll/dll32/demo/testzlib.exe svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib123dll/dll32/zlib_bor.lib svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib123dll/dll32/zlibwapi.dll svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib123dll/dll32/zlibwapi.lib svn_mime_002dtype=application%2Foctet-stream
ASCOfficeUtils/ZLIB/zlib123dll/static32/zlibstat.lib svn_mime_002dtype=application%2Foctet-stream
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
......

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeUtils", "ASCOfficeUtils\ASCOfficeUtils.vcproj", "{6215E3BF-2D42-40FB-B951-B8C448A596D2}"
ProjectSection(ProjectDependencies) = postProject
{DD328E05-26BE-4C81-A13E-489D15321212} = {DD328E05-26BE-4C81-A13E-489D15321212}
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60} = {56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GOCR", "GOCR\GOCR.vcproj", "{DD328E05-26BE-4C81-A13E-489D15321212}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PNM", "PNM\PNM.vcproj", "{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.Debug|Win32.ActiveCfg = Debug|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.Debug|Win32.Build.0 = Debug|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.Release|Win32.ActiveCfg = Release|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.Release|Win32.Build.0 = Release|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.Debug|Win32.ActiveCfg = Debug|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.Debug|Win32.Build.0 = Debug|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.Release|Win32.ActiveCfg = Release|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.Release|Win32.Build.0 = Release|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.Debug|Win32.ActiveCfg = Debug|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.Debug|Win32.Build.0 = Debug|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.Release|Win32.ActiveCfg = Release|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
#pragma once
#include "../../DesktopEditor/graphics/TemporaryCS.h"
class AVSOfficeCriticalSection
{
private:
NSCriticalSection::CRITICAL_SECTION CriticalSection;
public:
AVSOfficeCriticalSection()
{
CriticalSection.InitializeCriticalSection();
}
~AVSOfficeCriticalSection()
{
CriticalSection.DeleteCriticalSection();
}
void Enter()
{
CriticalSection.Enter();
}
void Leave()
{
CriticalSection.Leave();
}
};
\ No newline at end of file
// ASCOfficeUtils.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 = "{92F87FA9-D3C2-4820-82F6-DEAEC0A3539D}",
name = "ASCOfficeUtils",
helpstring = "ASCOfficeUtils 1.0 Type Library",
resource_name = "IDR_ASCOFFICEUTILS") ]
class CAVSOfficeUtilsModule
{
public:
// Override CAtlDllModuleT members
};
#include "OfficeUtils.h"
#include "OfficeOCR.h"
\ No newline at end of file
//Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "version.h"
#define COMPONENT_NAME "OfficeUtils"
#include "../../Common/FileInfo.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#pragma code_page(1251)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// 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 "040904B0"
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION_ACTIVEX
VALUE "FileVersion", STRVER
VALUE "LegalCopyright", LEGAL_COPYRIGHT
VALUE "InternalName", COMPONENT_FILE_NAME_DLL
VALUE "OriginalFilename", COMPONENT_FILE_NAME_DLL
VALUE "ProductName", FILE_DESCRIPTION_ACTIVEX
VALUE "ProductVersion", STRVER
VALUE "OLESelfRegister", ""
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 0x04B0
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "ASCOfficeUtils"
END
IDR_ASCOFFICEUTILS REGISTRY "ASCOfficeUtils.rgs"
////////////////////////////////////////////////////////////////////////////
#endif
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'ASCOfficeUtils'
'ASCOfficeUtils.DLL'
{
val AppID = s '%APPID%'
}
}
}
This diff is collapsed.
This diff is collapsed.
#pragma once
#include "ASCOfficeCriticalSection.h"
// This class helps to lock/unlock critical section and defend any using code from deadlocks due to unhandled exceptions
class CSLocker
{
public:
CSLocker(AVSOfficeCriticalSection &critical_section) : cs(critical_section)
{
cs.Enter();
}
~CSLocker(void)
{
cs.Leave();
}
private:
AVSOfficeCriticalSection &cs;
};
#include "StdAfx.h"
#include "CallbackHelpers.h"
#include "OfficeUtils.h"
// ========= ExtractedFileCallback ==============
ExtractedFileCallback::ExtractedFileCallback(IExtractedFileEvent* data_receiver) : invokable_object(data_receiver)
{
}
void ExtractedFileCallback::Invoke(_bstr_t file_name, SAFEARRAY** arr)
{
if(invokable_object)
{
invokable_object->ExtractedFile(file_name, arr);
}
}
// ========= RequestFileCallback ==============
RequestFileCallback::RequestFileCallback(IRequestFileEvent* data_receiver) : invokable_object(data_receiver)
{
}
bool RequestFileCallback::Invoke(BSTR* file_name, SAFEARRAY** arr)
{
if(invokable_object)
{
VARIANT_BOOL is_data_attached;
invokable_object->RequestFile(file_name, arr, &is_data_attached);
return VARIANT_TRUE == is_data_attached;
}
}
#pragma once
__interface IExtractedFileEvent;
// This callback class serves as a separator for external COM interface and ZLibZipUtils namespace
class ExtractedFileCallback
{
public:
ExtractedFileCallback(IExtractedFileEvent* data_receiver);
void Invoke(_bstr_t file_name, SAFEARRAY** arr);
private:
IExtractedFileEvent* invokable_object;
};
__interface IRequestFileEvent;
// This callback class serves as a separator for external COM interface and ZLibZipUtils namespace
class RequestFileCallback
{
public:
RequestFileCallback(IRequestFileEvent* data_receiver);
bool Invoke(BSTR* file_name, SAFEARRAY** arr);
private:
IRequestFileEvent* invokable_object;
};
#pragma once
//------------------------------------------------------------------------------------------------------
// IOfficeOCR
//------------------------------------------------------------------------------------------------------
// , ( ),
//------------------------------------------------------------------------------------------------------
[ object, uuid("804C1FF6-7020-477E-AD9F-980E9201C237"), dual, pointer_default(unique) ]
__interface IOfficeOCR : IDispatch
{
[id(1)] HRESULT Recognize([in] IUnknown *Image, [out, retval] BSTR* Text); // ,
[id(2), propput]HRESULT OutputFormat([in] LONG Type); // ( XML )
[id(2), propget]HRESULT OutputFormat([ out, retval ] LONG *Type); // ( XML )
[id(3), propput]HRESULT GrayLevel([in] LONG Type); // ( 0 - )
[id(3), propget]HRESULT GrayLevel([ out, retval ] LONG *Type); // ( 0 - )
[id(4), propput]HRESULT DustSize([in] LONG Type); // ( -1 - )
[id(4), propget]HRESULT DustSize([ out, retval ] LONG *Type); // ( -1 - )
[id(5), propput]HRESULT SpaceWidthDots([in] LONG Type); // / ( 0 - )
[id(5), propget]HRESULT SpaceWidthDots([ out, retval ] LONG *Type); // / ( 0 - )
[id(6), propput]HRESULT Certainty([in] LONG Type); // ( 95 )
[id(6), propget]HRESULT Certainty([ out, retval ] LONG *Type); // ( 95 )
[id(100000)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue); //
[id(100001)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue); //
};
\ No newline at end of file
#include "stdafx.h"
#include "../../Common/ASCUtils.h"
#include "../../Common/MediaFormatDefine.h"
#include "OfficeOCR.h"
#include "ImageToPNM.h"
#include "gocr.h"
COfficeOCR::COfficeOCR ()
: CAVSATLError ( __uuidof ( COfficeOCR ), __uuidof ( IOfficeOCR ) )
{
m_lOutputFormatType = OUTPUT_FORMAT_TYPE_XML;
m_lGrayLevel = 0;
m_lDustSize = -1;
m_lSpaceWidthDots = 0;
m_lCertainty = 95;
}
HRESULT COfficeOCR::FinalConstruct()
{
return S_OK;
}
void COfficeOCR::FinalRelease()
{
}
// ,
STDMETHODIMP COfficeOCR::Recognize ( IUnknown *Image, BSTR* Text )
{
#ifdef BUILD_CONFIG_FULL_VERSION
if ( NULL == Text )
return CAVSATLError::Error ( MEMORY );
*Text = NULL;
if ( NULL == Image )
return CAVSATLError::Error ( FILEFORMAT );
MediaCore::IAVSUncompressedVideoFrame *pUncompressedVideoFrame = NULL; Image->QueryInterface ( &pUncompressedVideoFrame );
if ( NULL == pUncompressedVideoFrame )
return CAVSATLError::Error ( FILEFORMAT );
LPBYTE pBuffer = NULL; pUncompressedVideoFrame->get_Buffer ( &pBuffer );
LONG lWidth = 0; pUncompressedVideoFrame->get_Width ( &lWidth );
LONG lHeight = 0; pUncompressedVideoFrame->get_Height ( &lHeight );
LONG lColorSpace = 0; pUncompressedVideoFrame->get_ColorSpace ( &lColorSpace );
LONG lBitCount = 0;
if ( ( CSP_BGRA & CSP_COLOR_MASK ) == lColorSpace || ( ( CSP_BGRA | CSP_VFLIP ) & CSP_COLOR_MASK ) == lColorSpace ||
( CSP_ABGR & CSP_COLOR_MASK ) == lColorSpace || ( ( CSP_ABGR | CSP_VFLIP ) & CSP_COLOR_MASK ) == lColorSpace ||
( CSP_RGBA & CSP_COLOR_MASK ) == lColorSpace || ( ( CSP_RGBA | CSP_VFLIP ) & CSP_COLOR_MASK ) == lColorSpace ||
( CSP_ARGB & CSP_COLOR_MASK ) == lColorSpace || ( ( CSP_ARGB | CSP_VFLIP ) & CSP_COLOR_MASK ) == lColorSpace )
lBitCount = 32;
else if ( ( CSP_BGR & CSP_COLOR_MASK ) == lColorSpace || ( ( CSP_BGR | CSP_VFLIP ) & CSP_COLOR_MASK ) == lColorSpace )
lBitCount = 24;
else if ( ( CSP_RGB555 & CSP_COLOR_MASK ) == lColorSpace || ( ( CSP_RGB555 | CSP_VFLIP ) & CSP_COLOR_MASK ) == lColorSpace ||
( CSP_RGB565 & CSP_COLOR_MASK ) == lColorSpace || ( ( CSP_RGB565 | CSP_VFLIP ) & CSP_COLOR_MASK ) == lColorSpace )
lBitCount = 16;
else
lBitCount = 32;
long lCount = 0;
CHAR *pPBMImage = convertToPNM ( pBuffer, lWidth, lHeight, lBitCount, true, true, lCount );
CStringA sOutputFormat = "";
switch ( m_lOutputFormatType )
{
case OUTPUT_FORMAT_TYPE_XML :
sOutputFormat = "XML";
break;
case OUTPUT_FORMAT_TYPE_TEXT :
sOutputFormat = "UTF8";
break;
}
CHAR *pText = PNMToText (pPBMImage, lCount, sOutputFormat.GetBuffer(), m_lGrayLevel, m_lDustSize, m_lSpaceWidthDots, m_lCertainty);
free ( pPBMImage );
RELEASEINTERFACE ( pUncompressedVideoFrame );
CString sText ( pText );
free ( pText );
CString sResult = _T("");
if ( OUTPUT_FORMAT_TYPE_XML == m_lOutputFormatType )
{
sResult += _T("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
sResult += _T ("<Text>");
}
sResult += sText;
if ( OUTPUT_FORMAT_TYPE_XML == m_lOutputFormatType )
sResult += _T ("</Text>");
*Text = sResult.AllocSysString();
#endif
return S_OK;
}
// ( XML )
STDMETHODIMP COfficeOCR::put_OutputFormat ( LONG Type )
{
if ( 0 <= Type && 2 >Type )
m_lOutputFormatType = Type;
return S_OK;
}
// ( XML )
STDMETHODIMP COfficeOCR::get_OutputFormat ( LONG *Type )
{
*Type = m_lOutputFormatType;
return S_OK;
}
// ( 0 - )
STDMETHODIMP COfficeOCR::put_GrayLevel ( LONG Type )
{
m_lGrayLevel = Type;
if ( 0 > m_lGrayLevel )
m_lGrayLevel = 0;
if ( 255 < m_lGrayLevel )
m_lGrayLevel = 255;
return S_OK;
}
// ( 0 - )
STDMETHODIMP COfficeOCR::get_GrayLevel ( LONG *Type )
{
*Type = m_lDustSize;
return S_OK;
}
// ( -1 - )
STDMETHODIMP COfficeOCR::put_DustSize ( LONG Type )
{
m_lDustSize = Type;
return S_OK;
}
// ( -1 - )
STDMETHODIMP COfficeOCR::get_DustSize ( LONG *Type )
{
*Type = m_lGrayLevel;
return S_OK;
}
// / ( 0 - )
STDMETHODIMP COfficeOCR::put_SpaceWidthDots ( LONG Type )
{
m_lSpaceWidthDots = Type;
if ( 0 > m_lSpaceWidthDots )
m_lSpaceWidthDots = 0;
return S_OK;
}
// / ( 0 - )
STDMETHODIMP COfficeOCR::get_SpaceWidthDots ( LONG *Type )
{
*Type = m_lSpaceWidthDots;
return S_OK;
}
// ( 95 )
STDMETHODIMP COfficeOCR::put_Certainty ( LONG Type )
{
m_lCertainty = Type;
if ( 0 > m_lCertainty )
m_lSpaceWidthDots = 0;
if ( 100 < m_lCertainty )
m_lCertainty = 100;
return S_OK;
}
// ( 95 )
STDMETHODIMP COfficeOCR::get_Certainty ( LONG *Type )
{
*Type = m_lCertainty;
return S_OK;
}
//
STDMETHODIMP COfficeOCR::SetAdditionalParam ( BSTR ParamName, VARIANT ParamValue )
{
return S_OK;
}
//
STDMETHODIMP COfficeOCR::GetAdditionalParam ( BSTR ParamName, VARIANT *ParamValue )
{
return S_OK;
}
\ No newline at end of file
#pragma once
#include "resource.h"
#include "IOfficeOCR.h"
#include "../../Common/ASCATLError.h"
#define OUTPUT_FORMAT_TYPE_XML 0
#define OUTPUT_FORMAT_TYPE_TEXT 1
[ coclass, uuid("5E4BC6BB-26B4-4237-894E-2C872842A8EE"), threading(apartment), vi_progid("AVSOfficeUtils.OfficeOCR"), progid("AVSOfficeUtils.OfficeOCR.1"), version(1.0), support_error_info(IOfficeOCR) ]
class ATL_NO_VTABLE COfficeOCR : public IOfficeOCR, public CAVSATLError
{
public :
COfficeOCR();
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct();
void FinalRelease();
public :
STDMETHOD ( Recognize )( IUnknown *Image, BSTR* Text ); // ,
STDMETHOD ( put_OutputFormat )( LONG Type ); // ( XML )
STDMETHOD ( get_OutputFormat )( LONG *Type ); // ( XML )
STDMETHOD ( put_GrayLevel )( LONG Type ); // ( 0 - )
STDMETHOD ( get_GrayLevel )( LONG *Type ); // ( 0 - )
STDMETHOD ( put_DustSize )( LONG Type ); // ( -1 - )
STDMETHOD ( get_DustSize )( LONG *Type ); // ( -1 - )
STDMETHOD ( put_SpaceWidthDots )( LONG Type ); // / ( 0 - )
STDMETHOD ( get_SpaceWidthDots )( LONG *Type ); // / ( 0 - )
STDMETHOD ( put_Certainty )( LONG Type ); // ( 95 )
STDMETHOD ( get_Certainty )( LONG *Type ); // ( 95 )
STDMETHOD ( SetAdditionalParam )( BSTR ParamName, VARIANT ParamValue ); //
STDMETHOD ( GetAdditionalParam )( BSTR ParamName, VARIANT *ParamValue );//
private :
LONG m_lOutputFormatType; // ( XML )
LONG m_lGrayLevel; // ( 0 - )
LONG m_lDustSize; // ( -1 - )
LONG m_lSpaceWidthDots; // / ( 0 - )
LONG m_lCertainty; // ( 95 )
};
\ No newline at end of file
// OfficeUtils.cpp : Implementation of COfficeUtils
#include "stdafx.h"
#include "OfficeUtils.h"
// COfficeUtils
STDMETHODIMP COfficeUtils::ExtractToDirectory(BSTR zipFile, BSTR unzipDir, BSTR password, SHORT extract_without_path)
{
ProgressCallback progress;
progress.OnProgress = OnProgressFunc;
progress.caller = this;
if( ZLibZipUtils::UnzipToDir( zipFile, unzipDir, &progress, password, ( extract_without_path > 0 ) ? (true) : (false) ) == 0 )
{
return S_OK;
}
else
{
return S_FALSE;
}
}
/*========================================================================================================*/
STDMETHODIMP COfficeUtils::CompressFileOrDirectory(BSTR name, BSTR outputFile, SHORT level)
{
WIN32_FIND_DATA ffd;
HANDLE hFind = INVALID_HANDLE_VALUE;
HRESULT result = S_FALSE;
hFind = FindFirstFile( name, &ffd );
if ( hFind == INVALID_HANDLE_VALUE )
{
return result;
}
if ( ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
{
ProgressCallback progress;
progress.OnProgress = OnProgressFunc;
progress.caller = this;
if ( ZLibZipUtils::ZipDir( name, outputFile, &progress, level ) == 0 )
{
result = S_OK;
}
else
{
result = S_FALSE;
}
}
else
{
if ( ZLibZipUtils::ZipFile( name, outputFile, level ) == 0 )
{
result = S_OK;
}
else
{
result = S_FALSE;
}
}
FindClose( hFind );
return result;
}
/*========================================================================================================*/
STDMETHODIMP COfficeUtils::Uncompress(BYTE* destBuf, ULONG* destSize, BYTE* sourceBuf, ULONG sourceSize)
{
if ( ZLibZipUtils::UncompressBytes( destBuf, destSize, sourceBuf, sourceSize ) == Z_OK )
{
return S_OK;
}
else
{
return S_FALSE;
}
}
/*========================================================================================================*/
STDMETHODIMP COfficeUtils::Compress(BYTE* destBuf, ULONG* destSize, BYTE* sourceBuf, ULONG sourceSize, SHORT level)
{
if ( ZLibZipUtils::CompressBytes( destBuf, destSize, sourceBuf, sourceSize, level ) == Z_OK )
{
return S_OK;
}
else
{
return S_FALSE;
}
}
/*========================================================================================================*/
STDMETHODIMP COfficeUtils::IsArchive(BSTR filename)
{
if( ZLibZipUtils::IsArchive(filename) )
{
return S_OK;
}
else
{
return S_FALSE;
}
}
/*========================================================================================================*/
STDMETHODIMP COfficeUtils::IsFileExistInArchive(BSTR zipFile, BSTR filePath)
{
if( ZLibZipUtils::IsFileExistInArchive( zipFile, filePath) )
{
return S_OK;
}
else
{
return S_FALSE;
}
}
/*========================================================================================================*/
STDMETHODIMP COfficeUtils::LoadFileFromArchive(BSTR zipFile, BSTR filePath, BYTE** fileInBytes)
{
if( ZLibZipUtils::LoadFileFromArchive( zipFile, filePath, fileInBytes))
{
return S_OK;
}
else
{
return S_FALSE;
}
}
/*========================================================================================================*/
STDMETHODIMP COfficeUtils::ExtractFilesToMemory(BSTR zipFile, IExtractedFileEvent* data_receiver, VARIANT_BOOL* result)
{
*result = ZLibZipUtils::ExtractFiles(_bstr_t(zipFile), ExtractedFileCallback (data_receiver)) ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
/*========================================================================================================*/
STDMETHODIMP COfficeUtils::CompressFilesFromMemory(BSTR zipFile, IRequestFileEvent* data_source, SHORT compression_level, VARIANT_BOOL* result)
{
*result = ZLibZipUtils::CompressFiles(_bstr_t(zipFile), RequestFileCallback (data_source), compression_level) ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
/*========================================================================================================*/
void COfficeUtils::OnProgressFunc( LPVOID lpParam, long nID, long nPercent, short* Cancel )
{
COfficeUtils* pOfficeUtils = reinterpret_cast<COfficeUtils*>( lpParam );
if ( pOfficeUtils != NULL )
{
pOfficeUtils->OnProgress( nID, nPercent, Cancel );
}
}
// OfficeUtils.h : Declaration of the COfficeUtils
#pragma once
#include "resource.h" // main symbols
#include "ZipUtils.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
// IOfficeUtils
[
object,
uuid("D1E2A35D-AD68-4E0E-9FF2-859155151328"),
dual, helpstring("IOfficeUtils Interface"),
pointer_default(unique)
]
__interface IOfficeUtils : IDispatch
{
[id(1), helpstring("method ExtractToDirectory")] HRESULT ExtractToDirectory([in] BSTR zipFile, [in] BSTR unzipDir, [in] BSTR password, [in] SHORT extract_without_path);
[id(2), helpstring("method CompressFileOrDirectory")] HRESULT CompressFileOrDirectory([in] BSTR name, [in] BSTR outputFile, [in] SHORT level);
[id(3), helpstring("method Uncompress")] HRESULT Uncompress([out] BYTE* destBuf, [in,out] ULONG* destSize, [in] BYTE* sourceBuf, [in] ULONG sourceSize);
[id(4), helpstring("method Compress")] HRESULT Compress([out] BYTE* destBuf, [in,out] ULONG* destSize, [in] BYTE* sourceBuf, [in] ULONG sourceSize, [in] SHORT level);
};
// IExtractedFileEvent
[
object,
uuid("6BA9C2ED-263A-456d-882F-646DA4CE1FEA"),
dual, helpstring("IExtractedFileEvent Interface"),
pointer_default(unique)
]
__interface IExtractedFileEvent : IDispatch
{
[id(9), helpstring("method ExtractedFile")] HRESULT ExtractedFile([in] BSTR file_name, [in, satype("unsigned char")] SAFEARRAY** arr);
};
// IRequestFileEvent
[
object,
uuid("6013A180-406F-48fc-94BD-B0AC8B72CC0E"),
dual, helpstring("IRequestFileEvent Interface"),
pointer_default(unique)
]
__interface IRequestFileEvent : IDispatch
{
[id(11), helpstring("method RequestFile")] HRESULT RequestFile([out] BSTR* file_name, [out, satype("unsigned char")] SAFEARRAY** arr, [out, retval] VARIANT_BOOL* is_data_attached);
};
// IOfficeUtils2
[
object,
uuid("F9C00AE2-7B59-4210-B348-5E34B8F495D7"),
dual, helpstring("IOfficeUtils2 Interface"),
pointer_default(unique)
]
__interface IOfficeUtils2 : IOfficeUtils
{
[id(5), helpstring("method IsArchive")] HRESULT IsArchive([in] BSTR filename);
[id(6), helpstring("method IsFileExistInArchive")] HRESULT IsFileExistInArchive([in] BSTR zipFile, [in] BSTR filePath);
[id(7), helpstring("method LoadFileFromArchive")] HRESULT LoadFileFromArchive([in] BSTR zipFile, [in] BSTR filePath, [out] BYTE** fileInBytes);
[id(8), helpstring("method ExtractFilesToMemory")] HRESULT ExtractFilesToMemory([in] BSTR zipFile, [in] IExtractedFileEvent* data_receiver, [out, retval] VARIANT_BOOL* result);
[id(10), helpstring("method CompressFilesFromMemory")] HRESULT CompressFilesFromMemory([in] BSTR zipFile, [in] IRequestFileEvent* data_source, [in] SHORT compression_level, [out, retval] VARIANT_BOOL* result);
};
// _IAVSOfficeUtilsEvents
[
dispinterface,
uuid("FB7DE28F-2E10-4dc8-813E-943701B9FB81"),
helpstring("_IAVSOfficeUtilsEvents Interface")
]
__interface _IAVSOfficeUtilsEvents
{
//Max Value nPercent == 1000000
//Example 23,56 % == 235600
[id(1), helpstring("method OnProgress")] HRESULT OnProgress([in] LONG nID, [in] LONG nPercent, [in, out, ref] SHORT* Cancel);
};
// COfficeUtils
[
coclass,
default(IOfficeUtils, _IAVSOfficeUtilsEvents),
threading(apartment),
event_source(com),
vi_progid("AVSOfficeUtils.OfficeUtils"),
progid("AVSOfficeUtils.OfficeUtils.1"),
version(1.0),
uuid("27AC89C1-0995-46FA-90A5-01EE850A09AC"),
helpstring("OfficeUtils Class")
]
class ATL_NO_VTABLE COfficeUtils :
public IOfficeUtils2
{
public:
COfficeUtils()
{
}
__event __interface _IAVSOfficeUtilsEvents;
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(ExtractToDirectory)(BSTR zipFile, BSTR unzipDir, BSTR password, SHORT extract_without_path);
STDMETHOD(CompressFileOrDirectory)(BSTR name, BSTR outputFile, SHORT level);
STDMETHOD(Uncompress)(BYTE* destBuf, ULONG* destSize, BYTE* sourceBuf, ULONG sourceSize);
STDMETHOD(Compress)(BYTE* destBuf, ULONG* destSize, BYTE* sourceBuf, ULONG sourceSize, SHORT level);
STDMETHOD(IsArchive)(BSTR filename);
STDMETHOD(IsFileExistInArchive)(BSTR zipFile, BSTR filePath);
STDMETHOD(LoadFileFromArchive)(BSTR zipFile, BSTR filePath, BYTE** fileInBytes);
STDMETHOD(ExtractFilesToMemory)(BSTR zipFile, IExtractedFileEvent* data_receiver, VARIANT_BOOL* result);
STDMETHOD(CompressFilesFromMemory)(BSTR zipFile, IRequestFileEvent* data_source, SHORT compression_level, VARIANT_BOOL* result);
protected:
static void OnProgressFunc( LPVOID lpParam, long nID, long nPercent, short* Cancel );
};
========================================================================
ACTIVE TEMPLATE LIBRARY : AVSOfficeUtils Project Overview
========================================================================
AppWizard has created this AVSOfficeUtils project for you to use as the starting point for
writing your Dynamic Link Library (DLL).
This project is implemented with Visual C++ attributes.
This file contains a summary of what you will find in each of the files that
make up your project.
AVSOfficeUtils.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
_AVSOfficeUtils.idl
This file will be generated by the compiler when the project is built. It will contain the IDL
definitions of the type library, the interfaces and co-classes defined in your project.
This file will be processed by the MIDL compiler to generate:
C++ interface definitions and GUID declarations (_AVSOfficeUtils.h)
GUID definitions (_AVSOfficeUtils_i.c)
A type library (_AVSOfficeUtils.tlb)
Marshaling code (_AVSOfficeUtils_p.c and dlldata.c)
AVSOfficeUtils.cpp
This file contains the object map and the implementation of your DLL's exports.
AVSOfficeUtils.rc
This is a listing of all of the Microsoft Windows resources that the
program uses.
AVSOfficeUtils.def
This module-definition file provides the linker with information about the exports
required by your DLL. It contains exports for:
DllGetClassObject
DllCanUnloadNow
GetProxyDllInfo
DllRegisterServer
DllUnregisterServer
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named AVSOfficeUtils.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file that defines resource IDs.
/////////////////////////////////////////////////////////////////////////////
Proxy/stub DLL project and module definition file:
AVSOfficeUtilsps.vcproj
This file is the project file for building a proxy/stub DLL if necessary.
The IDL file in the main project must contain at least one interface and you must
first compile the IDL file before building the proxy/stub DLL. This process generates
dlldata.c, AVSOfficeUtils_i.c and AVSOfficeUtils_p.c which are required
to build the proxy/stub DLL.
AVSOfficeUtilsps.def
This module definition file provides the linker with information about the exports
required by the proxy/stub.
/////////////////////////////////////////////////////////////////////////////
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by AVSOfficeUtils.rc
//
#define IDS_PROJNAME 100
#define IDR_ASCOFFICEUTILS 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif
#include "stdafx.h"
#include "UniversalString.h"
void UniversalString::ClearUniversalString()
{
this->length = 0;
this->charSize = 0;
this->wcharSize = 0;
if ( this->str != NULL )
{
delete [](this->str);
this->str = NULL;
}
if ( this->wstr != NULL )
{
delete [](this->wstr);
this->wstr = NULL;
}
}
/*========================================================================================================*/
UniversalString::UniversalString():
str(NULL), wstr(NULL), length(0), charSize(1), wcharSize(1)
{
this->str = new char[this->charSize];
this->str[0] = '\0';
this->wstr = new wchar_t[this->wcharSize];
this->wstr[0] = '\0';
}
/*========================================================================================================*/
UniversalString::UniversalString( const UniversalString& _ustr ):
str(NULL), wstr(NULL), length(_ustr.length), charSize(_ustr.charSize), wcharSize(_ustr.wcharSize)
{
if ( ( this->charSize > 0 ) && ( this->wcharSize > 0 ) )
{
this->str = new char[this->charSize];
this->wstr = new wchar_t[this->wcharSize];
if ( ( this->str != NULL ) && ( this->wstr != NULL ) )
{
memset( this->str, 0, ( sizeof(char) * this->charSize ) );
memset( this->wstr, 0, ( sizeof(wchar_t) * this->wcharSize ) );
memcpy( this->str, _ustr.str, ( sizeof(char) * this->charSize ) );
memcpy( this->wstr, _ustr.wstr, ( sizeof(wchar_t) * this->wcharSize ) );
}
}
}
/*========================================================================================================*/
UniversalString::UniversalString( const char* _str, unsigned int CodePage ):
str(NULL), wstr(NULL), length(0), charSize(0), wcharSize(0)
{
if ( _str != NULL )
{
this->length = (unsigned int)strlen( _str );
this->charSize = ( this->length + 1 );
this->str = new char[this->charSize];
if ( this->str != NULL )
{
memset( this->str, 0, ( sizeof(char) * this->charSize ) );
memcpy( this->str, _str, ( sizeof(char) * this->charSize ) );
this->wcharSize = MultiByteToWideChar( CodePage, 0, this->str, -1, NULL, 0 );
this->wstr = new wchar_t[this->wcharSize];
if ( this->wstr != NULL )
{
memset( this->wstr, 0, ( sizeof(wchar_t) * this->wcharSize ) );
MultiByteToWideChar( CodePage, 0, this->str, -1, this->wstr, this->wcharSize );
}
}
}
}
/*========================================================================================================*/
UniversalString::UniversalString( const wchar_t* _wstr, unsigned int CodePage ):
str(NULL), wstr(NULL), length(0), charSize(0), wcharSize(0)
{
if ( _wstr != NULL )
{
this->length = (unsigned int)wcslen( _wstr );
this->wcharSize = ( this->length + 1 );
this->wstr = new wchar_t[this->wcharSize];
if ( this->wstr != NULL )
{
memset( this->wstr, 0, ( sizeof(wchar_t) * this->wcharSize ) );
memcpy( this->wstr, _wstr, ( sizeof(wchar_t) * this->wcharSize ) );
this->charSize = WideCharToMultiByte( CodePage, 0, this->wstr, -1, NULL, 0, NULL, NULL );
this->str = new char[this->charSize];
if ( this->str != NULL )
{
memset( this->str, 0, ( sizeof(char) * this->charSize ) );
WideCharToMultiByte( CodePage, 0, this->wstr, -1, this->str, this->charSize, NULL, NULL );
}
}
}
}
/*========================================================================================================*/
UniversalString::~UniversalString()
{
this->ClearUniversalString();
}
/*========================================================================================================*/
UniversalString::operator char* ()
{
return this->str;
}
/*========================================================================================================*/
UniversalString::operator wchar_t* ()
{
return this->wstr;
}
/*========================================================================================================*/
bool UniversalString::operator == ( const UniversalString& _ustr )
{
if ( ( this->length == _ustr.length ) && ( this->charSize == _ustr.charSize ) && ( this->wcharSize == _ustr.wcharSize ) &&
( strncmp( this->str, _ustr.str, _ustr.charSize ) == 0 ) && ( wcsncmp( this->wstr, _ustr.wstr, _ustr.wcharSize ) == 0 ) )
{
return true;
}
else
{
return false;
}
}
/*========================================================================================================*/
bool UniversalString::operator != ( const UniversalString& _ustr )
{
return !(this->operator == ( _ustr ));
}
/*========================================================================================================*/
UniversalString& UniversalString::operator = ( const UniversalString& _ustr )
{
if ( this != &_ustr )
{
this->ClearUniversalString();
this->length = _ustr.length;
this->charSize = _ustr.charSize;
this->wcharSize = _ustr.wcharSize;
if ( ( this->charSize > 0 ) && ( this->wcharSize > 0 ) )
{
this->str = new char[this->charSize];
this->wstr = new wchar_t[this->wcharSize];
if ( ( this->str != NULL ) && ( this->wstr != NULL ) )
{
memset( this->str, 0, ( sizeof(char) * this->charSize ) );
memset( this->wstr, 0, ( sizeof(wchar_t) * this->wcharSize ) );
memcpy( this->str, _ustr.str, ( sizeof(char) * this->charSize ) );
memcpy( this->wstr, _ustr.wstr, ( sizeof(wchar_t) * this->wcharSize ) );
}
}
}
return *this;
}
/*========================================================================================================*/
unsigned int UniversalString::GetLength() const
{
return this->length;
}
\ No newline at end of file
#pragma once
#include <string.h>
#include <stdlib.h>
class UniversalString
{
private:
char *str;
wchar_t *wstr;
unsigned int length;
unsigned int charSize;
unsigned int wcharSize;
void ClearUniversalString();
public:
UniversalString();
UniversalString( const UniversalString& _ustr );
UniversalString( const char* _str, unsigned int CodePage = CP_ACP);
UniversalString( const wchar_t* _wstr, unsigned int CodePage = CP_ACP);
~UniversalString();
operator char* ();
operator wchar_t* ();
bool operator == ( const UniversalString& _ustr );
bool operator != ( const UniversalString& _ustr );
UniversalString& operator = ( const UniversalString& _ustr );
unsigned int GetLength() const;
};
\ No newline at end of file
This diff is collapsed.
#pragma once
#include "UniversalString.h"
#include <string>
#include <deque>
#include <fstream>
#include <vector>
#include <list>
#include <direct.h>
#include "CallbackHelpers.h"
using namespace std;
#define ZLIB_WINAPI
#define CODEPAGE_ISSUE_FIX
//#pragma comment(lib, "zlibstat.lib")
#include "unzip.h"
#include "zip.h"
namespace ZLibZipUtils
{
int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const ProgressCallback* progress, int compressionLevel = -1 );
int ZipFile( const WCHAR* inputFile, const WCHAR* outputFile, int compressionLevel = -1 );
bool ClearDirectory( const WCHAR* dir, bool delDir = false );
int UnzipToDir( const WCHAR* zipFile, const WCHAR* unzipDir, const ProgressCallback* progress, const WCHAR* password = NULL, bool opt_extract_without_path = false, bool clearOutputDirectory = false );
int UncompressBytes( BYTE* destBuf, ULONG* destSize, const BYTE* sourceBuf, ULONG sourceSize );
int CompressBytes( BYTE* destBuf, ULONG* destSize, const BYTE* sourceBuf, ULONG sourceSize, SHORT level );
bool IsArchive(const WCHAR* filename);
bool IsFileExistInArchive(const WCHAR* zipFile, const WCHAR* filePathInZip);
bool LoadFileFromArchive(const WCHAR* zipFile, const WCHAR* filePathInZip, BYTE** fileInBytes);
bool ExtractFiles(const _bstr_t zip_file_path, ExtractedFileCallback& callback);
bool CompressFiles(_bstr_t zip_file_path, RequestFileCallback& callback, int compression_level);
}
\ No newline at end of file
This diff is collapsed.
#pragma once
#include <string>
#include <deque>
#include <fstream>
#include <vector>
#include <list>
#if defined(_WIN32) || defined (_WIN64)
#include <direct.h>
#endif
#include "../ASCOfficeUtilsLib/OfficeUtilsCommon.h"
#include "../../DesktopEditor/common/Types.h"
using namespace std;
//#define ZLIB_WINAPI
//#define CODEPAGE_ISSUE_FIX
//#pragma comment(lib, "zlibstat.lib")
//#if defined(_WIN32) || defined (_WIN64)
#include "../ZLIB/zlib-1.2.3/contrib/minizip/unzip.h"
#include "../ZLIB/zlib-1.2.3/contrib/minizip/zip.h"
//#else
#include <zlib.h>
//#endif
namespace ZLibZipUtils
{
int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback* progress, int compressionLevel = -1 );
int ZipFile( const WCHAR* inputFile, const WCHAR* outputFile, int compressionLevel = -1 );
bool ClearDirectory( const WCHAR* dir, bool delDir = false );
int UnzipToDir( const WCHAR* zipFile, const WCHAR* unzipDir, const OnProgressCallback* progress, const WCHAR* password = NULL, bool opt_extract_without_path = false, bool clearOutputDirectory = false );
int UncompressBytes( BYTE* destBuf, ULONG* destSize, const BYTE* sourceBuf, ULONG sourceSize );
int CompressBytes( BYTE* destBuf, ULONG* destSize, const BYTE* sourceBuf, ULONG sourceSize, SHORT level );
bool IsArchive(const WCHAR* filename);
bool IsFileExistInArchive(const WCHAR* zipFile, const WCHAR* filePathInZip);
bool LoadFileFromArchive(const WCHAR* zipFile, const WCHAR* filePathInZip, BYTE** fileInBytes, ULONG& nFileSize);
bool ExtractFiles(const WCHAR* zip_file_path, const ExtractedFileCallback& callback, void* pParam);
bool CompressFiles(const WCHAR* zip_file_path, const RequestFileCallback& callback, void* pParam, int compression_level);
}
// stdafx.cpp : source file that includes just the standard includes
// AVSOfficeUtils.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>
#include "CSLocker.h"
using namespace ATL;
#include "../../Common/Config.h"
#ifdef BUILD_CONFIG_FULL_VERSION
#import "../../Redist/ASCMediaCore3.dll" named_guids raw_interfaces_only rename_namespace("MediaCore"), exclude("tagRECT")
#else
#import "../../Redist/OfficeCore.dll" named_guids raw_interfaces_only rename_namespace("OfficeCore")
#endif
#ifdef _DEBUG
#pragma comment(lib, "..\\GOCR\\Debug\\GOCR.lib")
#pragma comment(lib, "..\\PNM\\Debug\\PNM.lib")
#else
#ifdef BUILD_CONFIG_FULL_VERSION
#pragma comment(lib, "..\\GOCR\\Release\\GOCR.lib")
#pragma comment(lib, "..\\PNM\\Release\\PNM.lib")
#else
#pragma comment(lib, "..\\GOCR\\ReleaseOpenSource\\GOCR.lib")
#pragma comment(lib, "..\\PNM\\ReleaseOpenSource\\PNM.lib")
#endif
#endif
static const long UTILS_ONPROGRESSEVENT_ID = 0;
typedef void (*OnProgressCallback)( LPVOID lpParam, long nID, long nPercent, short* Cancel );
struct ProgressCallback
{
OnProgressCallback OnProgress;
LPVOID caller;
};
\ No newline at end of file
#pragma once
//1
//0
//0
//18
#define INTVER 1,0,0,18
#define STRVER "1,0,0,18\0"

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeUtils", "ASCOfficeUtils\ASCOfficeUtils2005.vcproj", "{6215E3BF-2D42-40FB-B951-B8C448A596D2}"
ProjectSection(ProjectDependencies) = postProject
{DD328E05-26BE-4C81-A13E-489D15321212} = {DD328E05-26BE-4C81-A13E-489D15321212}
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60} = {56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GOCR", "GOCR\GOCR2005.vcproj", "{DD328E05-26BE-4C81-A13E-489D15321212}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PNM", "PNM\PNM2005.vcproj", "{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseASC|Win32 = ReleaseASC|Win32
ReleaseOpenSource|Win32 = ReleaseOpenSource|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.Debug|Win32.ActiveCfg = Debug|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.Debug|Win32.Build.0 = Debug|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.Release|Win32.ActiveCfg = Release|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.Release|Win32.Build.0 = Release|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{6215E3BF-2D42-40FB-B951-B8C448A596D2}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.Debug|Win32.ActiveCfg = Debug|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.Debug|Win32.Build.0 = Debug|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.Release|Win32.ActiveCfg = Release|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.Release|Win32.Build.0 = Release|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{DD328E05-26BE-4C81-A13E-489D15321212}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.Debug|Win32.ActiveCfg = Debug|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.Debug|Win32.Build.0 = Debug|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.Release|Win32.ActiveCfg = Release|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.Release|Win32.Build.0 = Release|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{56BDD4BE-4F4B-458C-BAA4-5E058BE94E60}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
#-------------------------------------------------
#
# Project created by QtCreator 2014-10-10T14:24:04
#
#-------------------------------------------------
QT -= core gui
TARGET = ASCOfficeUtilsLib
TEMPLATE = lib
CONFIG += staticlib
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wno-ignored-qualifiers
DEFINES += UNICODE \
_UNICODE \
LINUX \
_LINUX_QT
#INCLUDEPATH += \
# ../../ZLIB/zlib-1.2.3/contrib/minizip \
# ../../ZLIB/zlib-1.2.3
SOURCES += \
../OfficeUtils.cpp \
../../ASCOfficeUtils/ZipUtilsCP.cpp \
../../ZLIB/zlib-1.2.3/contrib/minizip/ioapi.c \
../../ZLIB/zlib-1.2.3/contrib/minizip/miniunz.c \
../../ZLIB/zlib-1.2.3/contrib/minizip/minizip.c \
../../ZLIB/zlib-1.2.3/contrib/minizip/mztools.c \
../../ZLIB/zlib-1.2.3/contrib/minizip/unzip.c \
../../ZLIB/zlib-1.2.3/contrib/minizip/zip.c
HEADERS += \
../OfficeUtilsCommon.h \
../OfficeUtils.h \
../../ASCOfficeUtils/ASCOfficeCriticalSection.h \
../../ASCOfficeUtils/CSLocker.h \
../../ASCOfficeUtils/ZipUtilsCP.h \
../../ZLIB/zlib-1.2.3/contrib/minizip/crypt.h \
../../ZLIB/zlib-1.2.3/contrib/minizip/ioapi.h \
../../ZLIB/zlib-1.2.3/contrib/minizip/mztools.h \
../../ZLIB/zlib-1.2.3/contrib/minizip/unzip.h \
../../ZLIB/zlib-1.2.3/contrib/minizip/zip.h
unix {
target.path = /usr/lib
INSTALLS += target
}
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:ASCOfficeUtilsLib.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0620"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1710273B1AC44C54006BEB11"
BuildableName = "libASCOfficeUtilsLib.a"
BlueprintName = "ASCOfficeUtilsLib"
ReferencedContainer = "container:ASCOfficeUtilsLib.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1710273B1AC44C54006BEB11"
BuildableName = "libASCOfficeUtilsLib.a"
BlueprintName = "ASCOfficeUtilsLib"
ReferencedContainer = "container:ASCOfficeUtilsLib.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1710273B1AC44C54006BEB11"
BuildableName = "libASCOfficeUtilsLib.a"
BlueprintName = "ASCOfficeUtilsLib"
ReferencedContainer = "container:ASCOfficeUtilsLib.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>ASCOfficeUtilsLib.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>ASCOfficeUtilsLib_ios.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>20</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>1710273B1AC44C54006BEB11</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>17C1FB721ACC4216006B99B3</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
This diff is collapsed.
#ifndef OFFICE_UTILS_H
#define OFFICE_UTILS_H
#include "OfficeUtilsCommon.h"
class COfficeUtils
{
private:
OnProgressCallback* m_fCallback;
public:
COfficeUtils(OnProgressCallback* fCallback);
public:
HRESULT ExtractToDirectory(const std::wstring& zipFile, const std::wstring& unzipDir, wchar_t* password, SHORT extract_without_path);
HRESULT CompressFileOrDirectory(const std::wstring& name, const std::wstring& outputFile, SHORT level);
HRESULT Uncompress(BYTE* destBuf, ULONG* destSize, BYTE* sourceBuf, ULONG sourceSize);
HRESULT Compress(BYTE* destBuf, ULONG* destSize, BYTE* sourceBuf, ULONG sourceSize, SHORT level);
HRESULT IsArchive(const std::wstring& filename);
HRESULT IsFileExistInArchive(const std::wstring& zipFile, const std::wstring& filePath);
HRESULT LoadFileFromArchive(const std::wstring& zipFile, const std::wstring& filePath, BYTE** fileInBytes, ULONG& nFileSize);
HRESULT ExtractFilesToMemory(const std::wstring& zipFile, const ExtractedFileCallback& data_receiver, void* pParam, bool* result);
HRESULT CompressFilesFromMemory(const std::wstring& zipFile, const RequestFileCallback& data_source, void* pParam, SHORT compression_level, bool* result);
};
#endif
#ifndef OFFICE_UTILS_COMMON_H
#define OFFICE_UTILS_COMMON_H
#include <string>
#include "../../DesktopEditor/common/Types.h"
static const long UTILS_ONPROGRESSEVENT_ID = 0;
typedef void (*OnProgressCallback)( long nID, long nPercent, short* Cancel );
typedef void (*ExtractedFileCallback)( const std::wstring& file_name, BYTE* pData, const long& nSize, void* pParam );
typedef bool (*RequestFileCallback)( std::wstring& file_name, BYTE*& pData, long& nSize, void* pParam );
#endif
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeUtilsLib", "ASCOfficeUtilsLib.vcproj", "{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}.Debug|Win32.ActiveCfg = Debug|Win32
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}.Debug|Win32.Build.0 = Debug|Win32
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}.Release|Win32.ActiveCfg = Release|Win32
{3F3CB5A1-BB01-49C1-9342-4A69E30F9EF6}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
this file was suggested by Uffe Holst Jun05,2000
to compile gocr using SAS/C under AmigaOS
uhc@post6.tele.dk
SAS/C propably does not support ANSI C++, therefore this changes
I am a little bit confused about using declaration and
macro definition of abs(). I think that should not be necessary.
Tell me, if you have an Amiga and you can give answer
to the following questions.
Joerg Schulenburg, see README for EMAIL-address
*/
#ifdef _AMIGA
#ifdef __SASC
#if 0
#include <string.h> /* may be this can be removed ??? */
#include <stdlib.h> /* may be this can be removed ??? */
extern int abs(int); /* may be this can be removed ??? */
#endif
#ifndef abs
#define abs(i) ((i) < 0 ? -(i) : (i))
#endif
#endif
#endif
#ifndef _BARCODE_H
#define _BARCODE_H
#include "pnm.h"
/*
detect barcode and add a string to the box (obj-pointer)
*/
int detect_barcode(job_t *job);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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