Commit 1e4338f4 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@54480 954022d7-b5bf-4e40-9824-e11837661b57
parent bdb8d5cb
...@@ -4,16 +4,19 @@ ...@@ -4,16 +4,19 @@
#include "stdafx.h" #include "stdafx.h"
#include "resource.h" #include "resource.h"
#include "ASCOfficeOdfFileW.h" #include "ASCOfficeOdfFileW.h"
[
module(dll, uuid = "{EDB084E5-EC38-47EF-B421-D5E1A71F98A6}", helpstring = "ASCOfficeOdfFileW 1.0 Type Library", name = "ASCOfficeOdfFileWLib")
];
class CASCOfficeOdfFileWModule : public CAtlDllModuleT< CASCOfficeOdfFileWModule > //class CASCOfficeOdfFileWModule : public CAtlDllModuleT< CASCOfficeOdfFileWModule >
{ //{
public : //public :
DECLARE_LIBID(LIBID_ASCOfficeOdfFileWLib) // DECLARE_LIBID(LIBID_ASCOfficeOdfFileWLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_ASCOFFICEODFFILEW, "{A5D1961C-EE80-4038-A6CA-21F8C454571D}") // DECLARE_REGISTRY_APPID_RESOURCEID(IDR_ASCOFFICEODFFILEW, "{A5D1961C-EE80-4038-A6CA-21F8C454571D}")
}; //};
CASCOfficeOdfFileWModule _AtlModule; //CASCOfficeOdfFileWModule _AtlModule;
#ifdef _MANAGED #ifdef _MANAGED
...@@ -21,11 +24,11 @@ CASCOfficeOdfFileWModule _AtlModule; ...@@ -21,11 +24,11 @@ CASCOfficeOdfFileWModule _AtlModule;
#endif #endif
// DLL Entry Point // DLL Entry Point
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) //extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{ //{
hInstance; // hInstance;
return _AtlModule.DllMain(dwReason, lpReserved); // return _AtlModule.DllMain(dwReason, lpReserved);
} //}
#ifdef _MANAGED #ifdef _MANAGED
#pragma managed(pop) #pragma managed(pop)
...@@ -35,32 +38,32 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRes ...@@ -35,32 +38,32 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRes
// Used to determine whether the DLL can be unloaded by OLE // Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void) //STDAPI DllCanUnloadNow(void)
{ //{
return _AtlModule.DllCanUnloadNow(); // return _AtlModule.DllCanUnloadNow();
} //}
// Returns a class factory to create an object of the requested type // Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) //STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{ //{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv); // return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
} //}
// DllRegisterServer - Adds entries to the system registry // DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void) //STDAPI DllRegisterServer(void)
{ //{
// registers object, typelib and all interfaces in typelib // // registers object, typelib and all interfaces in typelib
HRESULT hr = _AtlModule.DllRegisterServer(); // HRESULT hr = _AtlModule.DllRegisterServer();
return hr; // return hr;
} //}
// DllUnregisterServer - Removes entries from the system registry // DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void) //STDAPI DllUnregisterServer(void)
{ //{
HRESULT hr = _AtlModule.DllUnregisterServer(); // HRESULT hr = _AtlModule.DllUnregisterServer();
return hr; // return hr;
} //}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/* File created by MIDL compiler version 7.00.0555 */ /* File created by MIDL compiler version 7.00.0555 */
/* at Tue Feb 18 14:17:15 2014 /* at Tue Feb 18 20:02:30 2014
*/ */
/* Compiler settings for .\ASCOfficeOdfFileW.idl: /* Compiler settings for .\ASCOfficeOdfFileW.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555
......
//Microsoft Visual C++ generated resource script. // Microsoft Visual C++ generated resource script.
// //
#include "resource.h" #include "resource.h"
...@@ -12,9 +12,15 @@ ...@@ -12,9 +12,15 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Russian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE 25, 1 #ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251) #pragma code_page(1251)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
...@@ -34,13 +40,12 @@ END ...@@ -34,13 +40,12 @@ END
3 TEXTINCLUDE 3 TEXTINCLUDE
BEGIN BEGIN
"1 TYPELIB ""ASCOfficeOdfFileW.tlb""\r\n" "// 1 TYPELIB ""ASCOfficeOdfFileW.tlb""\r\0"
"\0"
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#ifndef _MAC
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Version // Version
...@@ -71,16 +76,21 @@ BEGIN ...@@ -71,16 +76,21 @@ BEGIN
VALUE "OriginalFilename", "ASCOfficeOdfFileW.dll" VALUE "OriginalFilename", "ASCOfficeOdfFileW.dll"
VALUE "ProductName", "TODO: <Product name>" VALUE "ProductName", "TODO: <Product name>"
VALUE "ProductVersion", "1.0.0.1" VALUE "ProductVersion", "1.0.0.1"
VALUE "OLESelfRegister", ""
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
BEGIN BEGIN
VALUE "Translation", 0x0409, 1252 VALUE "Translation", 0x409, 1252
END END
END END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_ASCOFFICEODFFILEW REGISTRY "ASCOfficeOdfFileW.rgs"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
...@@ -92,18 +102,18 @@ BEGIN ...@@ -92,18 +102,18 @@ BEGIN
IDS_PROJNAME "ASCOfficeOdfFileW" IDS_PROJNAME "ASCOfficeOdfFileW"
END END
IDR_ASCOFFICEODFFILEW REGISTRY "ASCOfficeOdfFileW.rgs" #endif // Russian resources
//////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#endif
#ifndef APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Generated from the TEXTINCLUDE 3 resource. // Generated from the TEXTINCLUDE 3 resource.
// //
1 TYPELIB "ASCOfficeOdfFileW.tlb" // 1 TYPELIB "ASCOfficeOdfFileW.tlb"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED #endif // not APSTUDIO_INVOKED
...@@ -2,11 +2,30 @@ ...@@ -2,11 +2,30 @@
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileW", "ASCOfficeOdfFileW.vcproj", "{6258296E-ABCE-4BC6-9F4A-8522CD615603}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileW", "ASCOfficeOdfFileW.vcproj", "{6258296E-ABCE-4BC6-9F4A-8522CD615603}"
ProjectSection(ProjectDependencies) = postProject
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
{BEE01B53-244A-44E6-8947-ED9342D9247E} = {BEE01B53-244A-44E6-8947-ED9342D9247E}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormat", "source\OdfFormat.vcproj", "{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormat", "source\OdfFormat.vcproj", "{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Oox2OdfConverter", "source\Oox2OdfConverter.vcproj", "{BEE01B53-244A-44E6-8947-ED9342D9247E}"
ProjectSection(ProjectDependencies) = postProject
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficeOdfFileWTest", "ASCOfficeOdfFileWTest\ASCOfficeOdfFileWTest.vcproj", "{FBA8446A-150F-4A10-B4DA-1022048D6473}"
ProjectSection(ProjectDependencies) = postProject
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{BEE01B53-244A-44E6-8947-ED9342D9247E} = {BEE01B53-244A-44E6-8947-ED9342D9247E}
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
{6258296E-ABCE-4BC6-9F4A-8522CD615603} = {6258296E-ABCE-4BC6-9F4A-8522CD615603}
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
...@@ -25,6 +44,14 @@ Global ...@@ -25,6 +44,14 @@ Global
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.Build.0 = Debug|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Debug|Win32.Build.0 = Debug|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.ActiveCfg = Release|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.ActiveCfg = Release|Win32
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.Build.0 = Release|Win32 {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}.Release|Win32.Build.0 = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.ActiveCfg = Debug|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Debug|Win32.Build.0 = Debug|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|Win32.ActiveCfg = Release|Win32
{BEE01B53-244A-44E6-8947-ED9342D9247E}.Release|Win32.Build.0 = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|Win32.ActiveCfg = Debug|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Debug|Win32.Build.0 = Debug|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|Win32.ActiveCfg = Release|Win32
{FBA8446A-150F-4A10-B4DA-1022048D6473}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL" AdditionalIncludeDirectories="source\Oox2OdfConverter"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;_ATL_ATTRIBUTES;STANDALONE_USE=1"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
...@@ -77,7 +78,8 @@ ...@@ -77,7 +78,8 @@
RegisterOutput="true" RegisterOutput="true"
IgnoreImportLibrary="true" IgnoreImportLibrary="true"
LinkIncremental="2" LinkIncremental="2"
ModuleDefinitionFile=".\ASCOfficeOdfFileW.def" ModuleDefinitionFile=""
MergedIDLBaseFileName="_ASCOfficeOdfFileW.idl"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
TargetMachine="1" TargetMachine="1"
...@@ -118,6 +120,7 @@ ...@@ -118,6 +120,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="..\Redist\VersionControl.exe $(ProjectDir)\version.h"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
...@@ -144,7 +147,8 @@ ...@@ -144,7 +147,8 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="2" Optimization="2"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL" AdditionalIncludeDirectories="source\Oox2OdfConverter"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;_ATL_ATTRIBUTES;STANDALONE_USE=0"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
WarningLevel="3" WarningLevel="3"
...@@ -168,7 +172,8 @@ ...@@ -168,7 +172,8 @@
RegisterOutput="true" RegisterOutput="true"
IgnoreImportLibrary="true" IgnoreImportLibrary="true"
LinkIncremental="1" LinkIncremental="1"
ModuleDefinitionFile=".\ASCOfficeOdfFileW.def" ModuleDefinitionFile=""
MergedIDLBaseFileName="_ASCOfficeOdfFileW.idl"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
...@@ -198,6 +203,7 @@ ...@@ -198,6 +203,7 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; &quot;../Redist&quot;"
/> />
</Configuration> </Configuration>
</Configurations> </Configurations>
...@@ -214,11 +220,11 @@ ...@@ -214,11 +220,11 @@
> >
</File> </File>
<File <File
RelativePath=".\ASCOfficeOdfFileW.def" RelativePath=".\ASCOfficeOdfFileW.idl"
> >
</File> </File>
<File <File
RelativePath=".\ASCOfficeOdfFileW.idl" RelativePath=".\OfficeOdfFileW.cpp"
> >
</File> </File>
<File <File
...@@ -247,6 +253,10 @@ ...@@ -247,6 +253,10 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd" Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> >
<File
RelativePath=".\OfficeOdfFileW.h"
>
</File>
<File <File
RelativePath=".\Resource.h" RelativePath=".\Resource.h"
> >
...@@ -270,35 +280,6 @@ ...@@ -270,35 +280,6 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="Generated Files"
SourceControlFiles="false"
>
<File
RelativePath=".\ASCOfficeOdfFileW.h"
>
</File>
<File
RelativePath=".\ASCOfficeOdfFileW_i.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
<File <File
RelativePath=".\ReadMe.txt" RelativePath=".\ReadMe.txt"
> >
......
// ASCOfficeOdfFileWTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/timer.hpp>
#include <iostream>
#include <string>
#import "..\..\Redist\ASCOfficeOdfFileW.dll" rename_namespace("ASCOfficeOdfFileW") raw_interfaces_only
#define HR_RET(HR) if FAILED(hr = (HR)) { _ASSERTE(false); return -1; }
int ConvertSingle(int argc, _TCHAR* argv[])
{
ATL::CComPtr<ASCOfficeOdfFileW::IAVSOfficeFileTemplate> officeOdfFileW;
HRESULT hr;
HR_RET(officeOdfFileW.CoCreateInstance(__uuidof(ASCOfficeOdfFileW::COfficeOdfFileW)));
boost::timer t1;
officeOdfFileW->SaveToFile(ATL::CComBSTR(argv[2]), ATL::CComBSTR(argv[1]), NULL);
std::cout << "\n\nTime : " << t1.elapsed() << "\n";
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
if (argc < 3)
return -1;
return ConvertSingle(argc, argv);
return 0;
}
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="ASCOfficeOdfFileWTest"
ProjectGUID="{FBA8446A-150F-4A10-B4DA-1022048D6473}"
RootNamespace="ASCOfficeOdfFileWTest"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\ASCOfficeOdfFileWTest.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
========================================================================
CONSOLE APPLICATION : ASCOfficeOdfFileWTest Project Overview
========================================================================
AppWizard has created this ASCOfficeOdfFileWTest application for you.
This file contains a summary of what you will find in each of the files that
make up your ASCOfficeOdfFileWTest application.
ASCOfficeOdfFileWTest.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.
ASCOfficeOdfFileWTest.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named ASCOfficeOdfFileWTest.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// ASCOfficeOdfFileWTest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// 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 _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <windef.h>
#include <wingdi.h>
using namespace ATL;
// OfficeOdfFileW.cpp : Implementation of COfficeOdfFileW
#include "stdafx.h"
#include "OfficeOdfFileW.h"
#include <string>
#include <boost/lexical_cast.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/random_generator.hpp>
#include "Converter.h"
#import "../Redist/ASCOfficeOdfFile.dll" rename_namespace("ASCOfficeOdfFile"), raw_interfaces_only
#ifndef STANDALONE_USE
#define STANDALONE_USE 0// : (1) (0)
#else
#undef STANDALONE_USE
#define STANDALONE_USE 1
#endif
// - uuid
boost::filesystem::wpath MakeTempDirectoryName(const std::wstring& Dst)
{
boost::uuids::random_generator gen;
boost::uuids::uuid u = gen();
boost::filesystem::wpath path = boost::filesystem::wpath(Dst) / boost::lexical_cast<std::wstring>(u);
return path;
}
STDMETHODIMP COfficeOdfFileW::LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
ATL::CComPtr<IAVSOfficeFileTemplate> odfFile;
HRESULT hr = odfFile.CoCreateInstance(__uuidof(ASCOfficeOdfFile::COfficeOdfFile));
if (hr == S_OK && odfFile)
{
hr = odfFile->LoadFromFile(sSrcFileName, sDstPath, sXMLOptions);
}
return hr;
}
bool COfficeOdfFileW::initialized()
{
return (!!office_utils_);
}
STDMETHODIMP COfficeOdfFileW::SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
HRESULT hr;
if (!initialized())
return E_FAIL;
if (!sSrcPath)
{
_ASSERTE(!!sSrcPath);
return E_FAIL;
}
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
boost::filesystem::wpath inputDir = boost::filesystem::wpath(CString(sSrcPath)).parent_path();
#else
boost::filesystem::wpath inputDir = boost::filesystem::wpath(CString(sSrcPath));
#endif
boost::filesystem::wpath outputDir = boost::filesystem::wpath(CString(sDstFileName)).parent_path();
//
boost::filesystem::wpath dstTempPath = MakeTempDirectoryName(outputDir.string());
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
boost::filesystem::wpath srcTempPath = MakeTempDirectoryName(BOOST_STRING_PATH(outputDir));
#else
boost::filesystem::wpath srcTempPath = inputDir.string();
#endif
try
{
boost::filesystem::create_directory(dstTempPath);
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
boost::filesystem::create_directory(srcTempPath); //
#endif
hr = SaveToFileImpl(CString(sSrcPath), CString(srcTempPath.string().c_str()), CString(dstTempPath.string().c_str()), CString(sDstFileName));
}
catch(...)
{
hr = E_FAIL;
}
//
try
{
boost::filesystem::remove_all(dstTempPath);
}
catch(...)
{
}
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
// ( )
try
{
boost::filesystem::remove_all(srcTempPath);
}
catch(...)
{
}
#endif
return hr;
}
HRESULT COfficeOdfFileW::SaveToFileImpl(const CString & srcPath,
const CString & srcTempPath,
const CString & dstTempPath,
const CString & dstFileName)
{
HRESULT hr = E_FAIL;
// ( )
#if defined(STANDALONE_USE) && (STANDALONE_USE == 1)
if FAILED(hr = office_utils_->ExtractToDirectory(CComBSTR(srcPath), CComBSTR(srcTempPath), NULL, 0))
return hr;
#endif
try
{
Oox2Odf::Converter converter(srcTempPath);
converter.convert();
converter.write(dstTempPath);
}
catch(...)
{
}
if FAILED(hr)
return hr;
if FAILED(hr = office_utils_->CompressFileOrDirectory(CComBSTR(dstTempPath), CComBSTR(dstFileName), (-1)))
return hr;
return S_OK;
}
// OfficeOdfFileW.h : Declaration of the COfficeOdfFileW
#pragma once
#include "resource.h" // main symbols
#include <string>
#include "./../Common/OfficeFileTemplate.h"
#include "./../Common/OfficeFileErrorDescription.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
#ifdef _DEBUG
#import "..\Redist\ASCOfficeUtils.dll" rename_namespace("ASCOfficeUtils") raw_interfaces_only
#else
#import "..\Redist\ASCOfficeUtils.dll" rename_namespace("ASCOfficeUtils") raw_interfaces_only
#endif
// IOfficeOdfFileW
[
object,
uuid("E171F3C8-5715-41AB-9678-85AF4B7CE2FE"),
dual, helpstring("IOfficeOdfFileW Interface"),
pointer_default(unique)
]
__interface IOfficeOdfFileW : IAVSOfficeFileTemplate
{
};
// _IOfficeOdfFileWEvents
[
dispinterface,
uuid("BF816058-77B7-497A-9204-1AE5A37956FC"),
helpstring("_IOfficeOdfFileWEvents Interface")
]
__interface _IOfficeOdfFileWEvents
{
};
// COfficeOdfFileW
[
coclass,
default(IOfficeOdfFileW, _IOfficeOdfFileWEvents),
threading(apartment),
event_source(com),
vi_progid("ASCOfficeOdfFileW.OfficeOdfFileW"),
progid("ASCOfficeOdfFileW.OfficeOdfFileW.1"),
version(1.0),
uuid("E1D4E9D1-69A7-494B-B2A0-0F7F37449044"),
helpstring("OfficeOdfFileW Class")
]
class ATL_NO_VTABLE COfficeOdfFileW :
public IOfficeOdfFileW
{
public:
COfficeOdfFileW()
{
}
__event __interface _IOfficeOdfFileWEvents;
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(LoadFromFile)(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions);
STDMETHOD(SaveToFile)(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions);
private:
ATL::CComPtr< ASCOfficeUtils::IOfficeUtils > office_utils_;
bool initialized();
HRESULT SaveToFileImpl(const CString & srcPath, const CString & srcTempPath,
const CString & dstTempPath, const CString & dstFileName);
};
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="D:\WORK\AVS\Sources\TeamlabOffice\trunk\ServerComponents\ASCOfficeODFFile\include" AdditionalIncludeDirectories="..\..\ASCOfficeOdfFile\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
...@@ -105,9 +105,12 @@ ...@@ -105,9 +105,12 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\ASCOfficeOdfFile\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="2" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="precompiled_cpodf.h"
PrecompiledHeaderFile=""
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="3" DebugInformationFormat="3"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
namespace cpdoccore { namespace cpdoccore {
namespace odf { namespace odf {
_skip_element _skip_element::skip_element_; //_skip_element _skip_element::skip_element_;
const wchar_t * _skip_element::ns = L""; const wchar_t * _skip_element::ns = L"";
const wchar_t * _skip_element::name = L""; const wchar_t * _skip_element::name = L"";
...@@ -23,15 +23,15 @@ void _skip_element::add_child_element( xml::sax * Reader, const ::std::wstring & ...@@ -23,15 +23,15 @@ void _skip_element::add_child_element( xml::sax * Reader, const ::std::wstring &
ss << L"[warning] : skip element " << Ns << L":" << Name << "\n"; ss << L"[warning] : skip element " << Ns << L":" << Name << "\n";
_CP_LOG(error) << ss.str(); _CP_LOG(error) << ss.str();
if (Reader) /* if (Reader)
skip_element_.read_sax(Reader); skip_element_.read_sax(Reader); */
} }
void _skip_element::add_text(const std::wstring & Text) void _skip_element::add_text(const std::wstring & Text)
{ {
std::wstringstream ss; std::wstringstream ss;
ss << L"[warning] : skip element text\n"; ss << L"[warning] : skip element text\n";
_CP_LOG(error) << ss.str(); //_CP_LOG(error) << ss.str();
} }
} }
......
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="Oox2OdfConverter"
ProjectGUID="{BEE01B53-244A-44E6-8947-ED9342D9247E}"
RootNamespace="Oox2OdfConverter"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\OdfFormat;.\Oox2OdfConverter;..\..\Common\DocxFormat\Source;..\..\Common\DocxFormat\Source\XML"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_XMLLITE_READER_"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".\OdfFormat;.\Oox2OdfConverter;..\..\Common\DocxFormat\Source;..\..\Common\DocxFormat\Source\XML"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_USE_XMLLITE_READER_"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\Oox2OdfConverter\Converter.cpp"
>
</File>
<File
RelativePath=".\Oox2OdfConverter\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\Oox2OdfConverter\Converter.h"
>
</File>
<File
RelativePath=".\Oox2OdfConverter\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
#include "stdAfx.h"
#include "Converter.h"
#include <XlsxFormat\Xlsx.h>
#include <DocxFormat\Docx.h>
#include <boost/foreach.hpp>
namespace Oox2Odf
{
class Impl
{
friend class Converter;
public:
Impl(const CString & path)
{
const OOX::CPath oox_path(path);
m_input_docx =0;
m_input_xlsx =0;
int type = 1; //get type oox ????
if (type == 1)
{
m_input_docx = new OOX::CDocx(oox_path);
}
if (type == 2)
{
m_input_xlsx = new OOX::Spreadsheet::CXlsx(oox_path);
}
}
public:
void convert(/*Odt::IOdtEvent& Event*/);
void write(const CString & path);
private:
OOX::CDocx *m_input_docx;
OOX::Spreadsheet::CXlsx *m_input_xlsx;
//Odf::Folder m_output; //odf_document
};
void Impl::write(const CString & path)
{
//m_output.write(path);
}
void Impl::convert()
{
bool cancelled = false;
int percent = 150000;
if (m_input_docx)
{
const OOX::CApp *app = m_input_docx->GetApp();
if (app)
{
percent += 250000;
if(cancelled)
return;
}
const OOX::CCore *core = m_input_docx->GetCore();
if (core)
{
percent += 250000;
if(cancelled)
return;
}
const OOX::CDocument* document = m_input_docx->GetDocument();
if (document)
{
//odf_context.convert(document);
percent += 250000;
if(cancelled)
return;
}
}
else if (m_input_xlsx)
{
}
}
///////////////
Converter::Converter(const CString & path)
{
impl_ = new Impl(path);
}
Converter::~Converter()
{
if (impl_ )delete impl_ ;
}
void Converter::convert(/*Odt::IOdtEvent& Event*/)
{
if (!impl_)return;
impl_->convert(/*Event*/);
}
void Converter::write(const CString & path) const
{
return impl_->write(path);
}
//void Converter::app2meta(const OOX::App& app, Odt::Meta::File& meta) const
//{
// return impl_->app2meta(app, meta);
//}
} // namespace Docx2Odt
\ No newline at end of file
#pragma once
#include <boost_filesystem_version.h>
namespace Oox2Odf
{
class Impl;
class Converter
{
public:
Converter(const CString & path);
virtual ~Converter();
public:
void convert();
void write(const CString & path) const;
Impl * get_impl() { return impl_; }
private:
Impl* impl_;
};
} // namespace Oox2Odf:Convert
// stdafx.cpp : source file that includes just the standard includes
// Oox2OdfConverter.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// 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 _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <atlstr.h>
// TODO: reference additional headers your program requires here
...@@ -37,3 +37,6 @@ ...@@ -37,3 +37,6 @@
#include <atlcom.h> #include <atlcom.h>
using namespace ATL; using namespace ATL;
[
importidl(ASCOfficeOdfFileW.idl)
];
#pragma once
//1
//0
//2
//5
#define INTVER 1,0,2,5
#define STRVER "1,0,2,5\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