Commit d7f86d41 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander Trofimov

Добавлен тестовый пример для проверки открытия метафайлов.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62255 954022d7-b5bf-4e40-9824-e11837661b57
parent 38b40cf3
......@@ -3035,7 +3035,7 @@ DesktopEditor/mac_build/raster/raster.xcodeproj/project.xcworkspace/xcuserdata/a
DesktopEditor/mac_build/raster/raster.xcodeproj/xcuserdata svnc_tsvn_003alogminsize=5
DesktopEditor/mac_build/raster/raster.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad svnc_tsvn_003alogminsize=5
DesktopEditor/mac_build/raster/raster.xcodeproj/xcuserdata/alexey.musinov.xcuserdatad/xcschemes svnc_tsvn_003alogminsize=5
DesktopEditor/raster/Metafile svnc_tsvn_003alogminsize=5
DesktopEditor/raster/Metafile svnc_tsvn_003alogminsize=5 svn_global_002dignores
DesktopEditor/raster/Metafile/Emf svnc_tsvn_003alogminsize=5
DesktopEditor/raster/Metafile/Wmf svnc_tsvn_003alogminsize=5
DoctRenderer/COMMON/Dlls/AVSGraphics.dll svn_mime_002dtype=application%2Foctet-stream
......
*.sdf
*.user
Debug
x64
Metafile.opensdf
Metafile.v12.suo

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Metafile", "Metafile.vcxproj", "{E0341CD3-CFC0-4544-9DBA-31781C259DBF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Debug|Win32.ActiveCfg = Debug|Win32
{E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Debug|Win32.Build.0 = Debug|Win32
{E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Debug|x64.ActiveCfg = Debug|x64
{E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Debug|x64.Build.0 = Debug|x64
{E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Release|Win32.ActiveCfg = Release|Win32
{E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Release|Win32.Build.0 = Release|Win32
{E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Release|x64.ActiveCfg = Release|x64
{E0341CD3-CFC0-4544-9DBA-31781C259DBF}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E0341CD3-CFC0-4544-9DBA-31781C259DBF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Metafile</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\agg-2.4\include;..\..\freetype-2.5.2\include;..\..\cximage\jasper\include;..\..\cximage\jpeg;..\..\cximage\png;..\..\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\agg-2.4\include;..\..\freetype-2.5.2\include;..\..\cximage\jasper\include;..\..\cximage\jpeg;..\..\cximage\png;..\..\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4005;4018</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\agg-2.4\include;..\..\freetype-2.5.2\include;..\..\cximage\jasper\include;..\..\cximage\jpeg;..\..\cximage\png;..\..\cximage\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Common.h" />
<ClInclude Include="Emf\EmfClip.h" />
<ClInclude Include="Emf\EmfFile.h" />
<ClInclude Include="Emf\EmfObjects.h" />
<ClInclude Include="Emf\EmfOutputDevice.h" />
<ClInclude Include="Emf\EmfPath.h" />
<ClInclude Include="Emf\EmfPlayer.h" />
<ClInclude Include="Emf\EmfTypes.h" />
<ClInclude Include="Emf\RendererOutput.h" />
<ClInclude Include="MetaFile.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="Wmf\RendererOutput.h" />
<ClInclude Include="Wmf\WmfCharsets.h" />
<ClInclude Include="Wmf\WmfCodePage1361.h" />
<ClInclude Include="Wmf\WmfCodePage932.h" />
<ClInclude Include="Wmf\WmfCodePage936.h" />
<ClInclude Include="Wmf\WmfCodePage949.h" />
<ClInclude Include="Wmf\WmfCodePage950.h" />
<ClInclude Include="Wmf\WmfColor.h" />
<ClInclude Include="Wmf\WmfFile.h" />
<ClInclude Include="Wmf\WmfMemory.h" />
<ClInclude Include="Wmf\WmfOutputDevice.h" />
<ClInclude Include="Wmf\WmfRegion.h" />
<ClInclude Include="Wmf\WmfTypes.h" />
<ClInclude Include="Wmf\WmfUtils.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Common.cpp" />
<ClCompile Include="Emf\EmfClip.cpp" />
<ClCompile Include="Emf\EmfObjects.cpp" />
<ClCompile Include="Emf\EmfPath.cpp" />
<ClCompile Include="Emf\EmfPlayer.cpp" />
<ClCompile Include="MetaFile.cpp" />
<ClCompile Include="stdafx.cpp" />
<ClCompile Include="TestMain.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Wmf">
<UniqueIdentifier>{d2706d5c-ed10-4c43-bbb2-211400bb40ac}</UniqueIdentifier>
</Filter>
<Filter Include="Emf">
<UniqueIdentifier>{4c9bc033-8ce8-4711-9c98-6a7605147e5f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Wmf\RendererOutput.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfCharsets.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfCodePage932.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfCodePage936.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfCodePage949.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfCodePage950.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfCodePage1361.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfColor.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfFile.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfMemory.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfOutputDevice.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfRegion.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfTypes.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="Wmf\WmfUtils.h">
<Filter>Wmf</Filter>
</ClInclude>
<ClInclude Include="MetaFile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Emf\EmfFile.h">
<Filter>Emf</Filter>
</ClInclude>
<ClInclude Include="Emf\EmfTypes.h">
<Filter>Emf</Filter>
</ClInclude>
<ClInclude Include="Emf\EmfOutputDevice.h">
<Filter>Emf</Filter>
</ClInclude>
<ClInclude Include="Common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Emf\RendererOutput.h">
<Filter>Emf</Filter>
</ClInclude>
<ClInclude Include="Emf\EmfPlayer.h">
<Filter>Emf</Filter>
</ClInclude>
<ClInclude Include="Emf\EmfObjects.h">
<Filter>Emf</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>Resource Files</Filter>
</ClInclude>
<ClInclude Include="Emf\EmfPath.h">
<Filter>Emf</Filter>
</ClInclude>
<ClInclude Include="Emf\EmfClip.h">
<Filter>Emf</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="TestMain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MetaFile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Common.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Emf\EmfPlayer.cpp">
<Filter>Emf</Filter>
</ClCompile>
<ClCompile Include="Emf\EmfPath.cpp">
<Filter>Emf</Filter>
</ClCompile>
<ClCompile Include="Emf\EmfObjects.cpp">
<Filter>Emf</Filter>
</ClCompile>
<ClCompile Include="Emf\EmfClip.cpp">
<Filter>Emf</Filter>
</ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
//#define _CRTDBG_LEAK_CHECK_DF
#include "stdafx.h"
#include "../../fontengine/ApplicationFonts.h"
#include "MetaFile.h"
#include <Windows.h>
#include <vector>
using namespace MetaFile;
std::vector<std::wstring> GetAllFilesInFolder(std::wstring wsFolder, std::wstring wsExt)
{
std::vector<std::wstring> vwsNames;
std::wstring wsSearchPath = wsFolder;
wsSearchPath.append(L"*.");
wsSearchPath.append(wsExt);
WIN32_FIND_DATA oFindData;
HANDLE hFind = ::FindFirstFile(wsSearchPath.c_str(), &oFindData);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
if (!(oFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
vwsNames.push_back(oFindData.cFileName);
}
} while (::FindNextFile(hFind, &oFindData));
::FindClose(hFind);
}
return vwsNames;
}
void ConvertFile(CMetaFile &oMetaFile, std::wstring wsFilePath)
{
oMetaFile.Close();
std::wstring wsDstFilePath = (wsFilePath.substr(0, wsFilePath.size() - 3)).append(L"jpg");
if (oMetaFile.LoadFromFile(wsFilePath.c_str()))
{
oMetaFile.ConvertToRaster(wsDstFilePath.c_str(), 4, 1000);
}
}
void ConvertFolder(CMetaFile &oMetaFile, std::wstring wsFolderPath)
{
oMetaFile.Close();
std::vector<std::wstring> vFiles = GetAllFilesInFolder(wsFolderPath, L"emf");
for (int nIndex = 0; nIndex < vFiles.size(); nIndex++)
{
std::wstring wsFilePath = wsFolderPath;
wsFilePath.append(vFiles.at(nIndex));
if (oMetaFile.LoadFromFile(wsFilePath.c_str()))
{
std::wstring wsDstFilePath = (wsFilePath.substr(0, wsFilePath.size() - 3)).append(L"jpg");
oMetaFile.ConvertToRaster(wsDstFilePath.c_str(), 4, 1000);
oMetaFile.Close();
}
printf("%d of %d %S\n", nIndex, vFiles.size(), vFiles.at(nIndex).c_str());
}
}
void Test()
{
CApplicationFonts oFonts;
oFonts.Initialize();
CMetaFile oMetaFile(&oFonts);
//ConvertFile(oMetaFile, L"D://Test Files//fulltest.wmf");
ConvertFolder(oMetaFile, L"D://Test Files//Bugs//");
}
void main()
{
Test();
//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
//_CrtDumpMemoryLeaks();
}
\ No newline at end of file
#include "stdafx.h"
\ No newline at end of file
#pragma once
#include <stdio.h>
#pragma comment(lib, "../../Qt_build/graphics/project/debug/graphics.lib")
\ No newline at end of file
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